Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

Rev Author Line No. Line
2809 rexy 1
<?php
2
 
3
/**
4
 * Smarty Method RegisterDefaultPluginHandler
5
 *
6
 * Smarty::registerDefaultPluginHandler() method
7
 *
8
 * @package    Smarty
9
 * @subpackage PluginsInternal
10
 * @author     Uwe Tews
11
 */
12
class Smarty_Internal_Method_RegisterDefaultPluginHandler
13
{
14
    /**
15
     * Valid for Smarty and template object
16
     *
17
     * @var int
18
     */
19
    public $objMap = 3;
20
 
21
    /**
22
     * Registers a default plugin handler
23
     *
24
     * @api  Smarty::registerDefaultPluginHandler()
25
     * @link http://www.smarty.net/docs/en/api.register.default.plugin.handler.tpl
26
     *
27
     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
28
     * @param callable                                                        $callback class/method name
29
     *
30
     * @return \Smarty|\Smarty_Internal_Template
31
     * @throws SmartyException              if $callback is not callable
32
     */
33
    public function registerDefaultPluginHandler(Smarty_Internal_TemplateBase $obj, $callback)
34
    {
35
        $smarty = $obj->_getSmartyObj();
36
        if (is_callable($callback)) {
37
            $smarty->default_plugin_handler_func = $callback;
38
        } else {
39
            throw new SmartyException("Default plugin handler '$callback' not callable");
40
        }
41
        return $obj;
42
    }
43
}