]> git.mxchange.org Git - friendica.git/blob - vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php
Add Smarty to Composer
[friendica.git] / vendor / smarty / smarty / libs / sysplugins / smarty_internal_compile_private_object_block_function.php
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 }