From a6cb25020bb5200cc3c00ecc941ddb751644fbcc Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 6 Dec 2015 23:12:37 +0100 Subject: add missing smarty files --- .../smarty_internal_runtime_codeframe.php | 88 ++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 library/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php (limited to 'library/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php') diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php new file mode 100644 index 000000000..a3be60d40 --- /dev/null +++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php @@ -0,0 +1,88 @@ +compiled->has_nocache_code; + $properties['version'] = Smarty::SMARTY_VERSION; + $properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true)); + if (!empty($_template->tpl_function)) { + $properties['tpl_function'] = $_template->tpl_function; + } + if (!$cache) { + $properties['file_dependency'] = $_template->compiled->file_dependency; + $properties['includes'] = $_template->compiled->includes; + } else { + $properties['file_dependency'] = $_template->cached->file_dependency; + $properties['cache_lifetime'] = $_template->cache_lifetime; + } + $output = "source->filepath . "\" */\n\n"; + + $dec = "\$_smarty_tpl->smarty->ext->_validateCompiled->decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' . + ($cache ? 'true' : 'false') . ")"; + $output .= "if ({$dec}) {\n"; + $output .= "function {$properties['unifunc']} (\$_smarty_tpl) {\n"; + // include code for plugins + if (!$cache) { + if (!empty($_template->compiled->required_plugins['compiled'])) { + foreach ($_template->compiled->required_plugins['compiled'] as $tmp) { + foreach ($tmp as $data) { + $file = addslashes($data['file']); + if (is_array($data['function'])) { + $output .= "if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n"; + } else { + $output .= "if (!is_callable('{$data['function']}')) require_once '{$file}';\n"; + } + } + } + } + if ($_template->caching && !empty($_template->compiled->required_plugins['nocache'])) { + $_template->compiled->has_nocache_code = true; + $output .= "echo '/*%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/smarty; "; + foreach ($_template->compiled->required_plugins['nocache'] as $tmp) { + foreach ($tmp as $data) { + $file = addslashes($data['file']); + if (is_Array($data['function'])) { + $output .= addslashes("if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n"); + } else { + $output .= addslashes("if (!is_callable('{$data['function']}')) require_once '{$file}';\n"); + } + } + } + $output .= "?>/*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/';\n"; + } + } + $output .= "?>\n"; + $output .= $content; + $output .= ""; + $output .= $functions; + $output .= "[\n]?<\?php\s*/', "\n", $output); + } +} \ No newline at end of file -- cgit v1.2.3 From 84bf7058119bb2ed48358678be9c212a66c8cb83 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 18 Dec 2015 11:33:34 +0100 Subject: update smarty to 3.1.28 stable --- .../smarty_internal_runtime_codeframe.php | 54 ++++++++++++---------- 1 file changed, 30 insertions(+), 24 deletions(-) (limited to 'library/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php') diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php index a3be60d40..21e6e5221 100644 --- a/library/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php +++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php @@ -17,43 +17,49 @@ class Smarty_Internal_Runtime_CodeFrame /** * Create code frame for compiled and cached templates * - * @param Smarty_Internal_Template $_template - * @param string $content optional template content - * @param bool $cache flag for cache file + * @param Smarty_Internal_Template $_template + * @param string $content optional template content + * @param string $functions compiled template function and block code + * @param bool $cache flag for cache file + * @param \Smarty_Internal_TemplateCompilerBase $compiler * * @return string */ - public function create(Smarty_Internal_Template $_template, $content = '', $functions = '', $cache = false) + public function create(Smarty_Internal_Template $_template, $content = '', $functions = '', $cache = false, + Smarty_Internal_TemplateCompilerBase $compiler = null) { // build property code - $properties['has_nocache_code'] = $_template->compiled->has_nocache_code; - $properties['version'] = Smarty::SMARTY_VERSION; - $properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true)); - if (!empty($_template->tpl_function)) { - $properties['tpl_function'] = $_template->tpl_function; - } + $properties[ 'has_nocache_code' ] = $_template->compiled->has_nocache_code; + $properties[ 'version' ] = Smarty::SMARTY_VERSION; + $properties[ 'unifunc' ] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true)); if (!$cache) { - $properties['file_dependency'] = $_template->compiled->file_dependency; - $properties['includes'] = $_template->compiled->includes; + $properties[ 'file_dependency' ] = $_template->compiled->file_dependency; + $properties[ 'includes' ] = $_template->compiled->includes; + if (!empty($compiler->tpl_function)) { + $properties[ 'tpl_function' ] = $compiler->tpl_function; + } } else { - $properties['file_dependency'] = $_template->cached->file_dependency; - $properties['cache_lifetime'] = $_template->cache_lifetime; + $properties[ 'file_dependency' ] = $_template->cached->file_dependency; + $properties[ 'cache_lifetime' ] = $_template->cache_lifetime; + if (!empty($_template->tpl_function)) { + $properties[ 'tpl_function' ] = $_template->tpl_function; + } } $output = "source->filepath . "\" */\n\n"; - $dec = "\$_smarty_tpl->smarty->ext->_validateCompiled->decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' . - ($cache ? 'true' : 'false') . ")"; + $dec = "\$_smarty_tpl->smarty->ext->_validateCompiled->decodeProperties(\$_smarty_tpl, " . + var_export($properties, true) . ',' . ($cache ? 'true' : 'false') . ")"; $output .= "if ({$dec}) {\n"; $output .= "function {$properties['unifunc']} (\$_smarty_tpl) {\n"; // include code for plugins if (!$cache) { - if (!empty($_template->compiled->required_plugins['compiled'])) { - foreach ($_template->compiled->required_plugins['compiled'] as $tmp) { + if (!empty($_template->compiled->required_plugins[ 'compiled' ])) { + foreach ($_template->compiled->required_plugins[ 'compiled' ] as $tmp) { foreach ($tmp as $data) { - $file = addslashes($data['file']); - if (is_array($data['function'])) { + $file = addslashes($data[ 'file' ]); + if (is_array($data[ 'function' ])) { $output .= "if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n"; } else { $output .= "if (!is_callable('{$data['function']}')) require_once '{$file}';\n"; @@ -61,13 +67,13 @@ class Smarty_Internal_Runtime_CodeFrame } } } - if ($_template->caching && !empty($_template->compiled->required_plugins['nocache'])) { + if ($_template->caching && !empty($_template->compiled->required_plugins[ 'nocache' ])) { $_template->compiled->has_nocache_code = true; $output .= "echo '/*%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/smarty; "; - foreach ($_template->compiled->required_plugins['nocache'] as $tmp) { + foreach ($_template->compiled->required_plugins[ 'nocache' ] as $tmp) { foreach ($tmp as $data) { - $file = addslashes($data['file']); - if (is_Array($data['function'])) { + $file = addslashes($data[ 'file' ]); + if (is_Array($data[ 'function' ])) { $output .= addslashes("if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n"); } else { $output .= addslashes("if (!is_callable('{$data['function']}')) require_once '{$file}';\n"); -- cgit v1.2.3