IP/libs/sysplugins/smarty_internal_compile_private_object_block_function.php

43 lines
1.3 KiB
PHP
Raw Normal View History

2014-04-01 18:38:34 +00:00
<?php
/**
* Smarty Internal Plugin Compile Object Block Function
* Compiles code for registered objects as block function
*
2014-10-13 09:24:53 +00:00
* @package Smarty
2014-04-01 18:38:34 +00:00
* @subpackage Compiler
2014-10-13 09:24:53 +00:00
* @author Uwe Tews
2014-04-01 18:38:34 +00:00
*/
/**
* Smarty Internal Plugin Compile Object Block Function Class
*
2014-10-13 09:24:53 +00:00
* @package Smarty
2014-04-01 18:38:34 +00:00
* @subpackage Compiler
*/
class Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Internal_Compile_Private_Block_Plugin
2014-04-01 18:38:34 +00:00
{
/**
* Setup callback and parameter array
2014-04-01 18:38:34 +00:00
*
* @param \Smarty_Internal_TemplateCompilerBase $compiler
* @param array $_attr attributes
* @param string $tag
* @param string $method
2014-04-01 18:38:34 +00:00
*
* @return array
2014-04-01 18:38:34 +00:00
*/
public function setup(Smarty_Internal_TemplateCompilerBase $compiler, $_attr, $tag, $method)
2014-04-01 18:38:34 +00:00
{
$_paramsArray = array();
foreach ($_attr as $_key => $_value) {
if (is_int($_key)) {
$_paramsArray[] = "$_key=>$_value";
2014-04-01 18:38:34 +00:00
} else {
$_paramsArray[] = "'$_key'=>$_value";
2014-04-01 18:38:34 +00:00
}
}
$callback = array("\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]", "->{$method}");
return array($callback, $_paramsArray, "array(\$_block_plugin{$this->nesting}, '{$method}')");
2014-04-01 18:38:34 +00:00
}
}