- optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR (reverted from commit f7a5316205) (reverted from commit beaa293eb3)

This commit is contained in:
Uwe Tews
2017-10-26 04:37:17 +02:00
parent f3950a45a7
commit a675aaf68e
12 changed files with 320 additions and 323 deletions
@@ -1,5 +1,4 @@
<?php
/**
* Smarty Internal Plugin Compile Insert
* Compiles the {insert} tag
@@ -56,7 +55,6 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
$_attr = $this->getAttributes($compiler, $args);
//Does tag create output
$compiler->has_output = isset($_attr[ 'assign' ]) ? false : true;
$nocacheParam = $compiler->template->caching && ($compiler->tag_nocache || $compiler->nocache);
if (!$nocacheParam) {
// do not compile as nocache code
@@ -66,7 +64,6 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
$_smarty_tpl = $compiler->template;
$_name = null;
$_script = null;
$_output = '<?php ';
// save possible attributes
eval('$_name = @' . $_attr[ 'name' ] . ';');
@@ -96,8 +93,8 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
$_dir = $compiler->smarty instanceof SmartyBC ? $compiler->smarty->trusted_dir : null;
}
if (!empty($_dir)) {
foreach ((array) $_dir as $_script_dir) {
$_script_dir = rtrim($_script_dir, '/\\') . $compiler->smarty->ds;
foreach ((array)$_dir as $_script_dir) {
$_script_dir = rtrim($_script_dir, '/\\') . DIRECTORY_SEPARATOR;
if (file_exists($_script_dir . $_script)) {
$_filepath = $_script_dir . $_script;
break;
@@ -113,7 +110,8 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
require_once $_filepath;
if (!is_callable($_function)) {
$compiler->trigger_template_error(" {insert} function '{$_function}' is not callable in script file '{$_script}'",
null, true);
null,
true);
}
} else {
$_filepath = 'null';
@@ -122,7 +120,8 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
if (!is_callable($_function)) {
// try plugin
if (!$_function = $compiler->getPlugin($_name, 'insert')) {
$compiler->trigger_template_error("{insert} no function or plugin found for '{$_name}'", null,
$compiler->trigger_template_error("{insert} no function or plugin found for '{$_name}'",
null,
true);
}
}
@@ -149,7 +148,6 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
$_output .= "echo {$_function}({$_params},\$_smarty_tpl);?>";
}
}
return $_output;
}
}