Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

Rev Author Line No. Line
2809 rexy 1
<?php
2
/**
3
 * Smarty Internal Plugin Compile Object Block Function
4
 * Compiles code for registered objects as block function
5
 *
6
 * @package    Smarty
7
 * @subpackage Compiler
8
 * @author     Uwe Tews
9
 */
10
 
11
/**
12
 * Smarty Internal Plugin Compile Object Block Function Class
13
 *
14
 * @package    Smarty
15
 * @subpackage Compiler
16
 */
17
class Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Internal_Compile_Private_Block_Plugin
18
{
19
    /**
20
     * Setup callback and parameter array
21
     *
22
     * @param \Smarty_Internal_TemplateCompilerBase $compiler
23
     * @param array                                 $_attr attributes
24
     * @param string                                $tag
25
     * @param string                                $method
26
     *
27
     * @return array
28
     */
29
    public function setup(Smarty_Internal_TemplateCompilerBase $compiler, $_attr, $tag, $method)
30
    {
31
        $_paramsArray = array();
32
        foreach ($_attr as $_key => $_value) {
33
            if (is_int($_key)) {
34
                $_paramsArray[] = "$_key=>$_value";
35
            } else {
36
                $_paramsArray[] = "'$_key'=>$_value";
37
            }
38
        }
39
        $callback = array("\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]", "->{$method}");
40
        return array($callback, $_paramsArray, "array(\$_block_plugin{$this->nesting}, '{$method}')");
41
    }
42
}