Smarty v5 update test, initial code setup

This commit is contained in:
2024-08-09 17:28:32 +09:00
parent b2c8fe2e1f
commit 2fc2807a6b
382 changed files with 30655 additions and 28498 deletions

View File

@@ -0,0 +1,47 @@
<?php
namespace Smarty\Compile;
use Smarty\Compiler\Template;
class DefaultHandlerFunctionCallCompiler extends Base {
/**
* Attribute definition: Overwrites base class.
*
* @var array
* @see BasePlugin
*/
public $optional_attributes = ['_any'];
/**
* Compiles code for the execution of a registered function
*
* @param array $args array with attributes from parser
* @param Template $compiler compiler object
* @param array $parameter array with compilation parameter
* @param string $tag name of tag
* @param string $function name of function
*
* @return string compiled code
* @throws \Smarty\CompilerException
* @throws \Smarty\Exception
*/
public function compile($args, Template $compiler, $parameter = [], $tag = null, $function = null): string
{
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
unset($_attr['nocache']);
$_paramsArray = $this->formatParamsArray($_attr);
$_params = 'array(' . implode(',', $_paramsArray) . ')';
$output = "\$_smarty_tpl->getSmarty()->getRuntime('DefaultPluginHandler')->getCallback(" . var_export($function, true) .
",'function')($_params, \$_smarty_tpl)";
if (!empty($parameter['modifierlist'])) {
$output = $compiler->compileModifier($parameter['modifierlist'], $output);
}
return "<?php echo {$output};?>\n";
}
}