aboutsummaryrefslogtreecommitdiffstats
path: root/include/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php')
-rw-r--r--include/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php59
1 files changed, 37 insertions, 22 deletions
diff --git a/include/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php b/include/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php
index a33109cc0..9594d2ae7 100644
--- a/include/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php
+++ b/include/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php
@@ -2,31 +2,33 @@
/**
* Smarty Internal Plugin Compile Modifier
- *
* Compiles code for modifier execution
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Modifier Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for modifier execution
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
+ * @param array $args array with attributes from parser
+ * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
* @return string compiled code
+ * @throws \SmartyCompilerException
*/
- public function compile($args, $compiler, $parameter) {
+ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
+ {
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
$output = $parameter['value'];
@@ -51,7 +53,8 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
$output = "{$function}({$params})";
} else {
if (is_object($function[0])) {
- $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';
+ $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' .
+ $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';
} else {
$output = $function[0] . '::' . $function[1] . '(' . $params . ')';
}
@@ -72,7 +75,9 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
// modifiercompiler plugin
if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {
// check if modifier allowed
- if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {
+ if (!is_object($compiler->smarty->security_policy) ||
+ $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
+ ) {
$plugin = 'smarty_modifiercompiler_' . $modifier;
$output = $plugin($single_modifier, $compiler);
}
@@ -84,7 +89,9 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
// modifier plugin
if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) {
// check if modifier allowed
- if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {
+ if (!is_object($compiler->smarty->security_policy) ||
+ $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
+ ) {
$output = "{$function}({$params})";
}
$compiler->known_modifier_type[$modifier] = $type;
@@ -95,7 +102,9 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
// PHP function
if (is_callable($modifier)) {
// check if modifier allowed
- if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)) {
+ if (!is_object($compiler->smarty->security_policy) ||
+ $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)
+ ) {
$output = "{$modifier}({$params})";
}
$compiler->known_modifier_type[$modifier] = $type;
@@ -104,21 +113,29 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
break;
case 6:
// default plugin handler
- if (isset($compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier]) || (is_callable($compiler->smarty->default_plugin_handler_func) && $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER))) {
+ if (isset($compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier]) ||
+ (is_callable($compiler->smarty->default_plugin_handler_func) &&
+ $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER))
+ ) {
$function = $compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];
// check if modifier allowed
- if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {
+ if (!is_object($compiler->smarty->security_policy) ||
+ $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
+ ) {
if (!is_array($function)) {
$output = "{$function}({$params})";
} else {
if (is_object($function[0])) {
- $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';
+ $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' .
+ $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';
} else {
$output = $function[0] . '::' . $function[1] . '(' . $params . ')';
}
}
}
- if (isset($compiler->template->required_plugins['nocache'][$modifier][Smarty::PLUGIN_MODIFIER]['file']) || isset($compiler->template->required_plugins['compiled'][$modifier][Smarty::PLUGIN_MODIFIER]['file'])) {
+ if (isset($compiler->parent_compiler->template->compiled->required_plugins['nocache'][$modifier][Smarty::PLUGIN_MODIFIER]['file']) ||
+ isset($compiler->parent_compiler->template->compiled->required_plugins['compiled'][$modifier][Smarty::PLUGIN_MODIFIER]['file'])
+ ) {
// was a plugin
$compiler->known_modifier_type[$modifier] = 4;
} else {
@@ -129,12 +146,10 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
}
}
if (!isset($compiler->known_modifier_type[$modifier])) {
- $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", $compiler->lex->taglineno);
+ $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", null, true);
}
}
+
return $output;
}
-
}
-
-?> \ No newline at end of file