aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/smarty/libs/SmartyBC.class.php918
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.cat.php58
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.count_characters.php64
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.count_paragraphs.php54
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.count_sentences.php54
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.count_words.php62
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.default.php68
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.escape.php248
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.from_charset.php66
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.indent.php62
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.lower.php60
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.noprint.php48
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.string_format.php50
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.strip.php64
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.strip_tags.php64
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.to_charset.php66
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.unescape.php100
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.upper.php58
-rw-r--r--include/smarty/libs/plugins/modifiercompiler.wordwrap.php90
-rw-r--r--include/smarty/libs/sysplugins/smarty_internal_compile_break.php152
-rw-r--r--include/smarty/libs/sysplugins/smarty_internal_compile_continue.php154
-rw-r--r--include/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php278
-rw-r--r--include/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php224
-rw-r--r--include/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php160
-rw-r--r--include/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php142
-rw-r--r--include/smarty/libs/sysplugins/smarty_internal_function_call_handler.php110
-rw-r--r--include/smarty/libs/sysplugins/smarty_internal_get_include_path.php94
-rw-r--r--include/smarty/libs/sysplugins/smarty_internal_nocache_insert.php106
-rw-r--r--include/smarty/libs/sysplugins/smarty_internal_parsetree.php788
-rw-r--r--include/smarty/libs/sysplugins/smarty_internal_resource_eval.php186
-rw-r--r--include/smarty/libs/sysplugins/smarty_internal_templatebase.php1620
-rw-r--r--include/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php1338
32 files changed, 3803 insertions, 3803 deletions
diff --git a/include/smarty/libs/SmartyBC.class.php b/include/smarty/libs/SmartyBC.class.php
index f8f0a138f..589dcca27 100644
--- a/include/smarty/libs/SmartyBC.class.php
+++ b/include/smarty/libs/SmartyBC.class.php
@@ -1,460 +1,460 @@
-<?php
-/**
- * Project: Smarty: the PHP compiling template engine
- * File: SmartyBC.class.php
- * SVN: $Id: $
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * For questions, help, comments, discussion, etc., please join the
- * Smarty mailing list. Send a blank e-mail to
- * smarty-discussion-subscribe@googlegroups.com
- *
- * @link http://www.smarty.net/
- * @copyright 2008 New Digital Group, Inc.
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author Uwe Tews
- * @author Rodney Rehm
- * @package Smarty
- */
-/**
- * @ignore
- */
-require(dirname(__FILE__) . '/Smarty.class.php');
-
-/**
- * Smarty Backward Compatability Wrapper Class
- *
- * @package Smarty
- */
-class SmartyBC extends Smarty {
-
- /**
- * Smarty 2 BC
- * @var string
- */
- public $_version = self::SMARTY_VERSION;
-
- /**
- * Initialize new SmartyBC object
- *
- * @param array $options options to set during initialization, e.g. array( 'forceCompile' => false )
- */
- public function __construct(array $options=array())
- {
- parent::__construct($options);
- // register {php} tag
- $this->registerPlugin('block', 'php', 'smarty_php_tag');
- }
-
- /**
- * wrapper for assign_by_ref
- *
- * @param string $tpl_var the template variable name
- * @param mixed &$value the referenced value to assign
- */
- public function assign_by_ref($tpl_var, &$value)
- {
- $this->assignByRef($tpl_var, $value);
- }
-
- /**
- * wrapper for append_by_ref
- *
- * @param string $tpl_var the template variable name
- * @param mixed &$value the referenced value to append
- * @param boolean $merge flag if array elements shall be merged
- */
- public function append_by_ref($tpl_var, &$value, $merge = false)
- {
- $this->appendByRef($tpl_var, $value, $merge);
- }
-
- /**
- * clear the given assigned template variable.
- *
- * @param string $tpl_var the template variable to clear
- */
- public function clear_assign($tpl_var)
- {
- $this->clearAssign($tpl_var);
- }
-
- /**
- * Registers custom function to be used in templates
- *
- * @param string $function the name of the template function
- * @param string $function_impl the name of the PHP function to register
- * @param bool $cacheable
- * @param mixed $cache_attrs
- */
- public function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null)
- {
- $this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs);
- }
-
- /**
- * Unregisters custom function
- *
- * @param string $function name of template function
- */
- public function unregister_function($function)
- {
- $this->unregisterPlugin('function', $function);
- }
-
- /**
- * Registers object to be used in templates
- *
- * @param string $object name of template object
- * @param object $object_impl the referenced PHP object to register
- * @param array $allowed list of allowed methods (empty = all)
- * @param boolean $smarty_args smarty argument format, else traditional
- * @param array $block_functs list of methods that are block format
- */
- public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
- {
- settype($allowed, 'array');
- settype($smarty_args, 'boolean');
- $this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods);
- }
-
- /**
- * Unregisters object
- *
- * @param string $object name of template object
- */
- public function unregister_object($object)
- {
- $this->unregisterObject($object);
- }
-
- /**
- * Registers block function to be used in templates
- *
- * @param string $block name of template block
- * @param string $block_impl PHP function to register
- * @param bool $cacheable
- * @param mixed $cache_attrs
- */
- public function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null)
- {
- $this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs);
- }
-
- /**
- * Unregisters block function
- *
- * @param string $block name of template function
- */
- public function unregister_block($block)
- {
- $this->unregisterPlugin('block', $block);
- }
-
- /**
- * Registers compiler function
- *
- * @param string $function name of template function
- * @param string $function_impl name of PHP function to register
- * @param bool $cacheable
- */
- public function register_compiler_function($function, $function_impl, $cacheable=true)
- {
- $this->registerPlugin('compiler', $function, $function_impl, $cacheable);
- }
-
- /**
- * Unregisters compiler function
- *
- * @param string $function name of template function
- */
- public function unregister_compiler_function($function)
- {
- $this->unregisterPlugin('compiler', $function);
- }
-
- /**
- * Registers modifier to be used in templates
- *
- * @param string $modifier name of template modifier
- * @param string $modifier_impl name of PHP function to register
- */
- public function register_modifier($modifier, $modifier_impl)
- {
- $this->registerPlugin('modifier', $modifier, $modifier_impl);
- }
-
- /**
- * Unregisters modifier
- *
- * @param string $modifier name of template modifier
- */
- public function unregister_modifier($modifier)
- {
- $this->unregisterPlugin('modifier', $modifier);
- }
-
- /**
- * Registers a resource to fetch a template
- *
- * @param string $type name of resource
- * @param array $functions array of functions to handle resource
- */
- public function register_resource($type, $functions)
- {
- $this->registerResource($type, $functions);
- }
-
- /**
- * Unregisters a resource
- *
- * @param string $type name of resource
- */
- public function unregister_resource($type)
- {
- $this->unregisterResource($type);
- }
-
- /**
- * Registers a prefilter function to apply
- * to a template before compiling
- *
- * @param callable $function
- */
- public function register_prefilter($function)
- {
- $this->registerFilter('pre', $function);
- }
-
- /**
- * Unregisters a prefilter function
- *
- * @param callable $function
- */
- public function unregister_prefilter($function)
- {
- $this->unregisterFilter('pre', $function);
- }
-
- /**
- * Registers a postfilter function to apply
- * to a compiled template after compilation
- *
- * @param callable $function
- */
- public function register_postfilter($function)
- {
- $this->registerFilter('post', $function);
- }
-
- /**
- * Unregisters a postfilter function
- *
- * @param callable $function
- */
- public function unregister_postfilter($function)
- {
- $this->unregisterFilter('post', $function);
- }
-
- /**
- * Registers an output filter function to apply
- * to a template output
- *
- * @param callable $function
- */
- public function register_outputfilter($function)
- {
- $this->registerFilter('output', $function);
- }
-
- /**
- * Unregisters an outputfilter function
- *
- * @param callable $function
- */
- public function unregister_outputfilter($function)
- {
- $this->unregisterFilter('output', $function);
- }
-
- /**
- * load a filter of specified type and name
- *
- * @param string $type filter type
- * @param string $name filter name
- */
- public function load_filter($type, $name)
- {
- $this->loadFilter($type, $name);
- }
-
- /**
- * clear cached content for the given template and cache id
- *
- * @param string $tpl_file name of template file
- * @param string $cache_id name of cache_id
- * @param string $compile_id name of compile_id
- * @param string $exp_time expiration time
- * @return boolean
- */
- public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
- {
- return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time);
- }
-
- /**
- * clear the entire contents of cache (all templates)
- *
- * @param string $exp_time expire time
- * @return boolean
- */
- public function clear_all_cache($exp_time = null)
- {
- return $this->clearCache(null, null, null, $exp_time);
- }
-
- /**
- * test to see if valid cache exists for this template
- *
- * @param string $tpl_file name of template file
- * @param string $cache_id
- * @param string $compile_id
- * @return boolean
- */
- public function is_cached($tpl_file, $cache_id = null, $compile_id = null)
- {
- return $this->isCached($tpl_file, $cache_id, $compile_id);
- }
-
- /**
- * clear all the assigned template variables.
- */
- public function clear_all_assign()
- {
- $this->clearAllAssign();
- }
-
- /**
- * clears compiled version of specified template resource,
- * or all compiled template files if one is not specified.
- * This function is for advanced use only, not normally needed.
- *
- * @param string $tpl_file
- * @param string $compile_id
- * @param string $exp_time
- * @return boolean results of {@link smarty_core_rm_auto()}
- */
- public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
- {
- return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time);
- }
-
- /**
- * Checks whether requested template exists.
- *
- * @param string $tpl_file
- * @return boolean
- */
- public function template_exists($tpl_file)
- {
- return $this->templateExists($tpl_file);
- }
-
- /**
- * Returns an array containing template variables
- *
- * @param string $name
- * @return array
- */
- public function get_template_vars($name=null)
- {
- return $this->getTemplateVars($name);
- }
-
- /**
- * Returns an array containing config variables
- *
- * @param string $name
- * @return array
- */
- public function get_config_vars($name=null)
- {
- return $this->getConfigVars($name);
- }
-
- /**
- * load configuration values
- *
- * @param string $file
- * @param string $section
- * @param string $scope
- */
- public function config_load($file, $section = null, $scope = 'global')
- {
- $this->ConfigLoad($file, $section, $scope);
- }
-
- /**
- * return a reference to a registered object
- *
- * @param string $name
- * @return object
- */
- public function get_registered_object($name)
- {
- return $this->getRegisteredObject($name);
- }
-
- /**
- * clear configuration values
- *
- * @param string $var
- */
- public function clear_config($var = null)
- {
- $this->clearConfig($var);
- }
-
- /**
- * trigger Smarty error
- *
- * @param string $error_msg
- * @param integer $error_type
- */
- public function trigger_error($error_msg, $error_type = E_USER_WARNING)
- {
- trigger_error("Smarty error: $error_msg", $error_type);
- }
-
-}
-
-/**
- * Smarty {php}{/php} block function
- *
- * @param array $params parameter list
- * @param string $content contents of the block
- * @param object $template template object
- * @param boolean &$repeat repeat flag
- * @return string content re-formatted
- */
-function smarty_php_tag($params, $content, $template, &$repeat)
-{
- eval($content);
- return '';
-}
-
+<?php
+/**
+ * Project: Smarty: the PHP compiling template engine
+ * File: SmartyBC.class.php
+ * SVN: $Id: $
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * For questions, help, comments, discussion, etc., please join the
+ * Smarty mailing list. Send a blank e-mail to
+ * smarty-discussion-subscribe@googlegroups.com
+ *
+ * @link http://www.smarty.net/
+ * @copyright 2008 New Digital Group, Inc.
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author Uwe Tews
+ * @author Rodney Rehm
+ * @package Smarty
+ */
+/**
+ * @ignore
+ */
+require(dirname(__FILE__) . '/Smarty.class.php');
+
+/**
+ * Smarty Backward Compatability Wrapper Class
+ *
+ * @package Smarty
+ */
+class SmartyBC extends Smarty {
+
+ /**
+ * Smarty 2 BC
+ * @var string
+ */
+ public $_version = self::SMARTY_VERSION;
+
+ /**
+ * Initialize new SmartyBC object
+ *
+ * @param array $options options to set during initialization, e.g. array( 'forceCompile' => false )
+ */
+ public function __construct(array $options=array())
+ {
+ parent::__construct($options);
+ // register {php} tag
+ $this->registerPlugin('block', 'php', 'smarty_php_tag');
+ }
+
+ /**
+ * wrapper for assign_by_ref
+ *
+ * @param string $tpl_var the template variable name
+ * @param mixed &$value the referenced value to assign
+ */
+ public function assign_by_ref($tpl_var, &$value)
+ {
+ $this->assignByRef($tpl_var, $value);
+ }
+
+ /**
+ * wrapper for append_by_ref
+ *
+ * @param string $tpl_var the template variable name
+ * @param mixed &$value the referenced value to append
+ * @param boolean $merge flag if array elements shall be merged
+ */
+ public function append_by_ref($tpl_var, &$value, $merge = false)
+ {
+ $this->appendByRef($tpl_var, $value, $merge);
+ }
+
+ /**
+ * clear the given assigned template variable.
+ *
+ * @param string $tpl_var the template variable to clear
+ */
+ public function clear_assign($tpl_var)
+ {
+ $this->clearAssign($tpl_var);
+ }
+
+ /**
+ * Registers custom function to be used in templates
+ *
+ * @param string $function the name of the template function
+ * @param string $function_impl the name of the PHP function to register
+ * @param bool $cacheable
+ * @param mixed $cache_attrs
+ */
+ public function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null)
+ {
+ $this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs);
+ }
+
+ /**
+ * Unregisters custom function
+ *
+ * @param string $function name of template function
+ */
+ public function unregister_function($function)
+ {
+ $this->unregisterPlugin('function', $function);
+ }
+
+ /**
+ * Registers object to be used in templates
+ *
+ * @param string $object name of template object
+ * @param object $object_impl the referenced PHP object to register
+ * @param array $allowed list of allowed methods (empty = all)
+ * @param boolean $smarty_args smarty argument format, else traditional
+ * @param array $block_functs list of methods that are block format
+ */
+ public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
+ {
+ settype($allowed, 'array');
+ settype($smarty_args, 'boolean');
+ $this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods);
+ }
+
+ /**
+ * Unregisters object
+ *
+ * @param string $object name of template object
+ */
+ public function unregister_object($object)
+ {
+ $this->unregisterObject($object);
+ }
+
+ /**
+ * Registers block function to be used in templates
+ *
+ * @param string $block name of template block
+ * @param string $block_impl PHP function to register
+ * @param bool $cacheable
+ * @param mixed $cache_attrs
+ */
+ public function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null)
+ {
+ $this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs);
+ }
+
+ /**
+ * Unregisters block function
+ *
+ * @param string $block name of template function
+ */
+ public function unregister_block($block)
+ {
+ $this->unregisterPlugin('block', $block);
+ }
+
+ /**
+ * Registers compiler function
+ *
+ * @param string $function name of template function
+ * @param string $function_impl name of PHP function to register
+ * @param bool $cacheable
+ */
+ public function register_compiler_function($function, $function_impl, $cacheable=true)
+ {
+ $this->registerPlugin('compiler', $function, $function_impl, $cacheable);
+ }
+
+ /**
+ * Unregisters compiler function
+ *
+ * @param string $function name of template function
+ */
+ public function unregister_compiler_function($function)
+ {
+ $this->unregisterPlugin('compiler', $function);
+ }
+
+ /**
+ * Registers modifier to be used in templates
+ *
+ * @param string $modifier name of template modifier
+ * @param string $modifier_impl name of PHP function to register
+ */
+ public function register_modifier($modifier, $modifier_impl)
+ {
+ $this->registerPlugin('modifier', $modifier, $modifier_impl);
+ }
+
+ /**
+ * Unregisters modifier
+ *
+ * @param string $modifier name of template modifier
+ */
+ public function unregister_modifier($modifier)
+ {
+ $this->unregisterPlugin('modifier', $modifier);
+ }
+
+ /**
+ * Registers a resource to fetch a template
+ *
+ * @param string $type name of resource
+ * @param array $functions array of functions to handle resource
+ */
+ public function register_resource($type, $functions)
+ {
+ $this->registerResource($type, $functions);
+ }
+
+ /**
+ * Unregisters a resource
+ *
+ * @param string $type name of resource
+ */
+ public function unregister_resource($type)
+ {
+ $this->unregisterResource($type);
+ }
+
+ /**
+ * Registers a prefilter function to apply
+ * to a template before compiling
+ *
+ * @param callable $function
+ */
+ public function register_prefilter($function)
+ {
+ $this->registerFilter('pre', $function);
+ }
+
+ /**
+ * Unregisters a prefilter function
+ *
+ * @param callable $function
+ */
+ public function unregister_prefilter($function)
+ {
+ $this->unregisterFilter('pre', $function);
+ }
+
+ /**
+ * Registers a postfilter function to apply
+ * to a compiled template after compilation
+ *
+ * @param callable $function
+ */
+ public function register_postfilter($function)
+ {
+ $this->registerFilter('post', $function);
+ }
+
+ /**
+ * Unregisters a postfilter function
+ *
+ * @param callable $function
+ */
+ public function unregister_postfilter($function)
+ {
+ $this->unregisterFilter('post', $function);
+ }
+
+ /**
+ * Registers an output filter function to apply
+ * to a template output
+ *
+ * @param callable $function
+ */
+ public function register_outputfilter($function)
+ {
+ $this->registerFilter('output', $function);
+ }
+
+ /**
+ * Unregisters an outputfilter function
+ *
+ * @param callable $function
+ */
+ public function unregister_outputfilter($function)
+ {
+ $this->unregisterFilter('output', $function);
+ }
+
+ /**
+ * load a filter of specified type and name
+ *
+ * @param string $type filter type
+ * @param string $name filter name
+ */
+ public function load_filter($type, $name)
+ {
+ $this->loadFilter($type, $name);
+ }
+
+ /**
+ * clear cached content for the given template and cache id
+ *
+ * @param string $tpl_file name of template file
+ * @param string $cache_id name of cache_id
+ * @param string $compile_id name of compile_id
+ * @param string $exp_time expiration time
+ * @return boolean
+ */
+ public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
+ {
+ return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time);
+ }
+
+ /**
+ * clear the entire contents of cache (all templates)
+ *
+ * @param string $exp_time expire time
+ * @return boolean
+ */
+ public function clear_all_cache($exp_time = null)
+ {
+ return $this->clearCache(null, null, null, $exp_time);
+ }
+
+ /**
+ * test to see if valid cache exists for this template
+ *
+ * @param string $tpl_file name of template file
+ * @param string $cache_id
+ * @param string $compile_id
+ * @return boolean
+ */
+ public function is_cached($tpl_file, $cache_id = null, $compile_id = null)
+ {
+ return $this->isCached($tpl_file, $cache_id, $compile_id);
+ }
+
+ /**
+ * clear all the assigned template variables.
+ */
+ public function clear_all_assign()
+ {
+ $this->clearAllAssign();
+ }
+
+ /**
+ * clears compiled version of specified template resource,
+ * or all compiled template files if one is not specified.
+ * This function is for advanced use only, not normally needed.
+ *
+ * @param string $tpl_file
+ * @param string $compile_id
+ * @param string $exp_time
+ * @return boolean results of {@link smarty_core_rm_auto()}
+ */
+ public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
+ {
+ return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time);
+ }
+
+ /**
+ * Checks whether requested template exists.
+ *
+ * @param string $tpl_file
+ * @return boolean
+ */
+ public function template_exists($tpl_file)
+ {
+ return $this->templateExists($tpl_file);
+ }
+
+ /**
+ * Returns an array containing template variables
+ *
+ * @param string $name
+ * @return array
+ */
+ public function get_template_vars($name=null)
+ {
+ return $this->getTemplateVars($name);
+ }
+
+ /**
+ * Returns an array containing config variables
+ *
+ * @param string $name
+ * @return array
+ */
+ public function get_config_vars($name=null)
+ {
+ return $this->getConfigVars($name);
+ }
+
+ /**
+ * load configuration values
+ *
+ * @param string $file
+ * @param string $section
+ * @param string $scope
+ */
+ public function config_load($file, $section = null, $scope = 'global')
+ {
+ $this->ConfigLoad($file, $section, $scope);
+ }
+
+ /**
+ * return a reference to a registered object
+ *
+ * @param string $name
+ * @return object
+ */
+ public function get_registered_object($name)
+ {
+ return $this->getRegisteredObject($name);
+ }
+
+ /**
+ * clear configuration values
+ *
+ * @param string $var
+ */
+ public function clear_config($var = null)
+ {
+ $this->clearConfig($var);
+ }
+
+ /**
+ * trigger Smarty error
+ *
+ * @param string $error_msg
+ * @param integer $error_type
+ */
+ public function trigger_error($error_msg, $error_type = E_USER_WARNING)
+ {
+ trigger_error("Smarty error: $error_msg", $error_type);
+ }
+
+}
+
+/**
+ * Smarty {php}{/php} block function
+ *
+ * @param array $params parameter list
+ * @param string $content contents of the block
+ * @param object $template template object
+ * @param boolean &$repeat repeat flag
+ * @return string content re-formatted
+ */
+function smarty_php_tag($params, $content, $template, &$repeat)
+{
+ eval($content);
+ return '';
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.cat.php b/include/smarty/libs/plugins/modifiercompiler.cat.php
index 1cfe6308a..5049c63e5 100644
--- a/include/smarty/libs/plugins/modifiercompiler.cat.php
+++ b/include/smarty/libs/plugins/modifiercompiler.cat.php
@@ -1,30 +1,30 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty cat modifier plugin
- *
- * Type: modifier<br>
- * Name: cat<br>
- * Date: Feb 24, 2003<br>
- * Purpose: catenate a value to a variable<br>
- * Input: string to catenate<br>
- * Example: {$var|cat:"foo"}
- *
- * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat
- * (Smarty online manual)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_cat($params, $compiler)
-{
- return '('.implode(').(', $params).')';
-}
-
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty cat modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: cat<br>
+ * Date: Feb 24, 2003<br>
+ * Purpose: catenate a value to a variable<br>
+ * Input: string to catenate<br>
+ * Example: {$var|cat:"foo"}
+ *
+ * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat
+ * (Smarty online manual)
+ * @author Uwe Tews
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_cat($params, $compiler)
+{
+ return '('.implode(').(', $params).')';
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.count_characters.php b/include/smarty/libs/plugins/modifiercompiler.count_characters.php
index 98e8efa0d..0f269c9fa 100644
--- a/include/smarty/libs/plugins/modifiercompiler.count_characters.php
+++ b/include/smarty/libs/plugins/modifiercompiler.count_characters.php
@@ -1,33 +1,33 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty count_characters modifier plugin
- *
- * Type: modifier<br>
- * Name: count_characteres<br>
- * Purpose: count the number of characters in a text
- *
- * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_count_characters($params, $compiler)
-{
- if (!isset($params[1]) || $params[1] != 'true') {
- return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[0] . ', $tmp)';
- }
- if (Smarty::$_MBSTRING) {
- return 'mb_strlen(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
- }
- // no MBString fallback
- return 'strlen(' . $params[0] . ')';
-}
-
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty count_characters modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: count_characteres<br>
+ * Purpose: count the number of characters in a text
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual)
+ * @author Uwe Tews
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_count_characters($params, $compiler)
+{
+ if (!isset($params[1]) || $params[1] != 'true') {
+ return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[0] . ', $tmp)';
+ }
+ if (Smarty::$_MBSTRING) {
+ return 'mb_strlen(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
+ }
+ // no MBString fallback
+ return 'strlen(' . $params[0] . ')';
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.count_paragraphs.php b/include/smarty/libs/plugins/modifiercompiler.count_paragraphs.php
index 0e1b0af83..853f98f46 100644
--- a/include/smarty/libs/plugins/modifiercompiler.count_paragraphs.php
+++ b/include/smarty/libs/plugins/modifiercompiler.count_paragraphs.php
@@ -1,28 +1,28 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty count_paragraphs modifier plugin
- *
- * Type: modifier<br>
- * Name: count_paragraphs<br>
- * Purpose: count the number of paragraphs in a text
- *
- * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
- * count_paragraphs (Smarty online manual)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_count_paragraphs($params, $compiler)
-{
- // count \r or \n characters
- return '(preg_match_all(\'#[\r\n]+#\', ' . $params[0] . ', $tmp)+1)';
-}
-
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty count_paragraphs modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: count_paragraphs<br>
+ * Purpose: count the number of paragraphs in a text
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
+ * count_paragraphs (Smarty online manual)
+ * @author Uwe Tews
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_count_paragraphs($params, $compiler)
+{
+ // count \r or \n characters
+ return '(preg_match_all(\'#[\r\n]+#\', ' . $params[0] . ', $tmp)+1)';
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.count_sentences.php b/include/smarty/libs/plugins/modifiercompiler.count_sentences.php
index 2f517be96..f8d79b3f2 100644
--- a/include/smarty/libs/plugins/modifiercompiler.count_sentences.php
+++ b/include/smarty/libs/plugins/modifiercompiler.count_sentences.php
@@ -1,28 +1,28 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty count_sentences modifier plugin
- *
- * Type: modifier<br>
- * Name: count_sentences
- * Purpose: count the number of sentences in a text
- *
- * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
- * count_sentences (Smarty online manual)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_count_sentences($params, $compiler)
-{
- // find periods, question marks, exclamation marks with a word before but not after.
- return 'preg_match_all("#\w[\.\?\!](\W|$)#S' . Smarty::$_UTF8_MODIFIER . '", ' . $params[0] . ', $tmp)';
-}
-
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty count_sentences modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: count_sentences
+ * Purpose: count the number of sentences in a text
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
+ * count_sentences (Smarty online manual)
+ * @author Uwe Tews
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_count_sentences($params, $compiler)
+{
+ // find periods, question marks, exclamation marks with a word before but not after.
+ return 'preg_match_all("#\w[\.\?\!](\W|$)#S' . Smarty::$_UTF8_MODIFIER . '", ' . $params[0] . ', $tmp)';
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.count_words.php b/include/smarty/libs/plugins/modifiercompiler.count_words.php
index e05738c01..f53443e24 100644
--- a/include/smarty/libs/plugins/modifiercompiler.count_words.php
+++ b/include/smarty/libs/plugins/modifiercompiler.count_words.php
@@ -1,32 +1,32 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty count_words modifier plugin
- *
- * Type: modifier<br>
- * Name: count_words<br>
- * Purpose: count the number of words in a text
- *
- * @link http://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
-*/
-function smarty_modifiercompiler_count_words($params, $compiler)
-{
- if (Smarty::$_MBSTRING) {
- // return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
- // expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592
- return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
- }
- // no MBString fallback
- return 'str_word_count(' . $params[0] . ')';
-}
-
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty count_words modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: count_words<br>
+ * Purpose: count the number of words in a text
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual)
+ * @author Uwe Tews
+ * @param array $params parameters
+ * @return string with compiled code
+*/
+function smarty_modifiercompiler_count_words($params, $compiler)
+{
+ if (Smarty::$_MBSTRING) {
+ // return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
+ // expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592
+ return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
+ }
+ // no MBString fallback
+ return 'str_word_count(' . $params[0] . ')';
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.default.php b/include/smarty/libs/plugins/modifiercompiler.default.php
index 4f831a589..3554964e4 100644
--- a/include/smarty/libs/plugins/modifiercompiler.default.php
+++ b/include/smarty/libs/plugins/modifiercompiler.default.php
@@ -1,35 +1,35 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty default modifier plugin
- *
- * Type: modifier<br>
- * Name: default<br>
- * Purpose: designate default value for empty variables
- *
- * @link http://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_default ($params, $compiler)
-{
- $output = $params[0];
- if (!isset($params[1])) {
- $params[1] = "''";
- }
-
- array_shift($params);
- foreach ($params as $param) {
- $output = '(($tmp = @' . $output . ')===null||$tmp===\'\' ? ' . $param . ' : $tmp)';
- }
- return $output;
-}
-
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty default modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: default<br>
+ * Purpose: designate default value for empty variables
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual)
+ * @author Uwe Tews
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_default ($params, $compiler)
+{
+ $output = $params[0];
+ if (!isset($params[1])) {
+ $params[1] = "''";
+ }
+
+ array_shift($params);
+ foreach ($params as $param) {
+ $output = '(($tmp = @' . $output . ')===null||$tmp===\'\' ? ' . $param . ' : $tmp)';
+ }
+ return $output;
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.escape.php b/include/smarty/libs/plugins/modifiercompiler.escape.php
index f50028bd9..d38d12975 100644
--- a/include/smarty/libs/plugins/modifiercompiler.escape.php
+++ b/include/smarty/libs/plugins/modifiercompiler.escape.php
@@ -1,125 +1,125 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * @ignore
- */
-require_once( SMARTY_PLUGINS_DIR .'shared.literal_compiler_param.php' );
-
-/**
- * Smarty escape modifier plugin
- *
- * Type: modifier<br>
- * Name: escape<br>
- * Purpose: escape string for output
- *
- * @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual)
- * @author Rodney Rehm
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_escape($params, $compiler)
-{
- static $_double_encode = null;
- if ($_double_encode === null) {
- $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>=');
- }
-
- try {
- $esc_type = smarty_literal_compiler_param($params, 1, 'html');
- $char_set = smarty_literal_compiler_param($params, 2, Smarty::$_CHARSET);
- $double_encode = smarty_literal_compiler_param($params, 3, true);
-
- if (!$char_set) {
- $char_set = Smarty::$_CHARSET;
- }
-
- switch ($esc_type) {
- case 'html':
- if ($_double_encode) {
- return 'htmlspecialchars('
- . $params[0] .', ENT_QUOTES, '
- . var_export($char_set, true) . ', '
- . var_export($double_encode, true) . ')';
- } else if ($double_encode) {
- return 'htmlspecialchars('
- . $params[0] .', ENT_QUOTES, '
- . var_export($char_set, true) . ')';
- } else {
- // fall back to modifier.escape.php
- }
-
- case 'htmlall':
- if (Smarty::$_MBSTRING) {
- if ($_double_encode) {
- // php >=5.2.3 - go native
- return 'mb_convert_encoding(htmlspecialchars('
- . $params[0] .', ENT_QUOTES, '
- . var_export($char_set, true) . ', '
- . var_export($double_encode, true)
- . '), "HTML-ENTITIES", '
- . var_export($char_set, true) . ')';
- } else if ($double_encode) {
- // php <5.2.3 - only handle double encoding
- return 'mb_convert_encoding(htmlspecialchars('
- . $params[0] .', ENT_QUOTES, '
- . var_export($char_set, true)
- . '), "HTML-ENTITIES", '
- . var_export($char_set, true) . ')';
- } else {
- // fall back to modifier.escape.php
- }
- }
-
- // no MBString fallback
- if ($_double_encode) {
- // php >=5.2.3 - go native
- return 'htmlentities('
- . $params[0] .', ENT_QUOTES, '
- . var_export($char_set, true) . ', '
- . var_export($double_encode, true) . ')';
- } else if ($double_encode) {
- // php <5.2.3 - only handle double encoding
- return 'htmlentities('
- . $params[0] .', ENT_QUOTES, '
- . var_export($char_set, true) . ')';
- } else {
- // fall back to modifier.escape.php
- }
-
- case 'url':
- return 'rawurlencode(' . $params[0] . ')';
-
- case 'urlpathinfo':
- return 'str_replace("%2F", "/", rawurlencode(' . $params[0] . '))';
-
- case 'quotes':
- // escape unescaped single quotes
- return 'preg_replace("%(?<!\\\\\\\\)\'%", "\\\'",' . $params[0] . ')';
-
- case 'javascript':
- // escape quotes and backslashes, newlines, etc.
- return 'strtr(' . $params[0] . ', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", "</" => "<\/" ))';
-
- }
- } catch(SmartyException $e) {
- // pass through to regular plugin fallback
- }
-
- // could not optimize |escape call, so fallback to regular plugin
- if ($compiler->tag_nocache | $compiler->nocache) {
- $compiler->template->required_plugins['nocache']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR .'modifier.escape.php';
- $compiler->template->required_plugins['nocache']['escape']['modifier']['function'] = 'smarty_modifier_escape';
- } else {
- $compiler->template->required_plugins['compiled']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR .'modifier.escape.php';
- $compiler->template->required_plugins['compiled']['escape']['modifier']['function'] = 'smarty_modifier_escape';
- }
- return 'smarty_modifier_escape(' . join( ', ', $params ) . ')';
-}
-
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * @ignore
+ */
+require_once( SMARTY_PLUGINS_DIR .'shared.literal_compiler_param.php' );
+
+/**
+ * Smarty escape modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: escape<br>
+ * Purpose: escape string for output
+ *
+ * @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual)
+ * @author Rodney Rehm
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_escape($params, $compiler)
+{
+ static $_double_encode = null;
+ if ($_double_encode === null) {
+ $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>=');
+ }
+
+ try {
+ $esc_type = smarty_literal_compiler_param($params, 1, 'html');
+ $char_set = smarty_literal_compiler_param($params, 2, Smarty::$_CHARSET);
+ $double_encode = smarty_literal_compiler_param($params, 3, true);
+
+ if (!$char_set) {
+ $char_set = Smarty::$_CHARSET;
+ }
+
+ switch ($esc_type) {
+ case 'html':
+ if ($_double_encode) {
+ return 'htmlspecialchars('
+ . $params[0] .', ENT_QUOTES, '
+ . var_export($char_set, true) . ', '
+ . var_export($double_encode, true) . ')';
+ } else if ($double_encode) {
+ return 'htmlspecialchars('
+ . $params[0] .', ENT_QUOTES, '
+ . var_export($char_set, true) . ')';
+ } else {
+ // fall back to modifier.escape.php
+ }
+
+ case 'htmlall':
+ if (Smarty::$_MBSTRING) {
+ if ($_double_encode) {
+ // php >=5.2.3 - go native
+ return 'mb_convert_encoding(htmlspecialchars('
+ . $params[0] .', ENT_QUOTES, '
+ . var_export($char_set, true) . ', '
+ . var_export($double_encode, true)
+ . '), "HTML-ENTITIES", '
+ . var_export($char_set, true) . ')';
+ } else if ($double_encode) {
+ // php <5.2.3 - only handle double encoding
+ return 'mb_convert_encoding(htmlspecialchars('
+ . $params[0] .', ENT_QUOTES, '
+ . var_export($char_set, true)
+ . '), "HTML-ENTITIES", '
+ . var_export($char_set, true) . ')';
+ } else {
+ // fall back to modifier.escape.php
+ }
+ }
+
+ // no MBString fallback
+ if ($_double_encode) {
+ // php >=5.2.3 - go native
+ return 'htmlentities('
+ . $params[0] .', ENT_QUOTES, '
+ . var_export($char_set, true) . ', '
+ . var_export($double_encode, true) . ')';
+ } else if ($double_encode) {
+ // php <5.2.3 - only handle double encoding
+ return 'htmlentities('
+ . $params[0] .', ENT_QUOTES, '
+ . var_export($char_set, true) . ')';
+ } else {
+ // fall back to modifier.escape.php
+ }
+
+ case 'url':
+ return 'rawurlencode(' . $params[0] . ')';
+
+ case 'urlpathinfo':
+ return 'str_replace("%2F", "/", rawurlencode(' . $params[0] . '))';
+
+ case 'quotes':
+ // escape unescaped single quotes
+ return 'preg_replace("%(?<!\\\\\\\\)\'%", "\\\'",' . $params[0] . ')';
+
+ case 'javascript':
+ // escape quotes and backslashes, newlines, etc.
+ return 'strtr(' . $params[0] . ', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", "</" => "<\/" ))';
+
+ }
+ } catch(SmartyException $e) {
+ // pass through to regular plugin fallback
+ }
+
+ // could not optimize |escape call, so fallback to regular plugin
+ if ($compiler->tag_nocache | $compiler->nocache) {
+ $compiler->template->required_plugins['nocache']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR .'modifier.escape.php';
+ $compiler->template->required_plugins['nocache']['escape']['modifier']['function'] = 'smarty_modifier_escape';
+ } else {
+ $compiler->template->required_plugins['compiled']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR .'modifier.escape.php';
+ $compiler->template->required_plugins['compiled']['escape']['modifier']['function'] = 'smarty_modifier_escape';
+ }
+ return 'smarty_modifier_escape(' . join( ', ', $params ) . ')';
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.from_charset.php b/include/smarty/libs/plugins/modifiercompiler.from_charset.php
index 93b568a5a..5d6b7889a 100644
--- a/include/smarty/libs/plugins/modifiercompiler.from_charset.php
+++ b/include/smarty/libs/plugins/modifiercompiler.from_charset.php
@@ -1,34 +1,34 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty from_charset modifier plugin
- *
- * Type: modifier<br>
- * Name: from_charset<br>
- * Purpose: convert character encoding from $charset to internal encoding
- *
- * @author Rodney Rehm
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_from_charset($params, $compiler)
-{
- if (!Smarty::$_MBSTRING) {
- // FIXME: (rodneyrehm) shouldn't this throw an error?
- return $params[0];
- }
-
- if (!isset($params[1])) {
- $params[1] = '"ISO-8859-1"';
- }
-
- return 'mb_convert_encoding(' . $params[0] . ', "' . addslashes(Smarty::$_CHARSET) . '", ' . $params[1] . ')';
-}
-
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty from_charset modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: from_charset<br>
+ * Purpose: convert character encoding from $charset to internal encoding
+ *
+ * @author Rodney Rehm
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_from_charset($params, $compiler)
+{
+ if (!Smarty::$_MBSTRING) {
+ // FIXME: (rodneyrehm) shouldn't this throw an error?
+ return $params[0];
+ }
+
+ if (!isset($params[1])) {
+ $params[1] = '"ISO-8859-1"';
+ }
+
+ return 'mb_convert_encoding(' . $params[0] . ', "' . addslashes(Smarty::$_CHARSET) . '", ' . $params[1] . ')';
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.indent.php b/include/smarty/libs/plugins/modifiercompiler.indent.php
index 020c4fdb3..26094b7ca 100644
--- a/include/smarty/libs/plugins/modifiercompiler.indent.php
+++ b/include/smarty/libs/plugins/modifiercompiler.indent.php
@@ -1,32 +1,32 @@
-<?php
-/**
- * Smarty plugin
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty indent modifier plugin
- *
- * Type: modifier<br>
- * Name: indent<br>
- * Purpose: indent lines of text
- *
- * @link http://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-
-function smarty_modifiercompiler_indent($params, $compiler)
-{
- if (!isset($params[1])) {
- $params[1] = 4;
- }
- if (!isset($params[2])) {
- $params[2] = "' '";
- }
- return 'preg_replace(\'!^!m\',str_repeat(' . $params[2] . ',' . $params[1] . '),' . $params[0] . ')';
-}
-
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty indent modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: indent<br>
+ * Purpose: indent lines of text
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual)
+ * @author Uwe Tews
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+
+function smarty_modifiercompiler_indent($params, $compiler)
+{
+ if (!isset($params[1])) {
+ $params[1] = 4;
+ }
+ if (!isset($params[2])) {
+ $params[2] = "' '";
+ }
+ return 'preg_replace(\'!^!m\',str_repeat(' . $params[2] . ',' . $params[1] . '),' . $params[0] . ')';
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.lower.php b/include/smarty/libs/plugins/modifiercompiler.lower.php
index 1845cc1d2..bc3abd727 100644
--- a/include/smarty/libs/plugins/modifiercompiler.lower.php
+++ b/include/smarty/libs/plugins/modifiercompiler.lower.php
@@ -1,31 +1,31 @@
-<?php
-/**
- * Smarty plugin
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty lower modifier plugin
- *
- * Type: modifier<br>
- * Name: lower<br>
- * Purpose: convert string to lowercase
- *
- * @link http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-
-function smarty_modifiercompiler_lower($params, $compiler)
-{
- if (Smarty::$_MBSTRING) {
- return 'mb_strtolower(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')' ;
- }
- // no MBString fallback
- return 'strtolower(' . $params[0] . ')';
-}
-
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty lower modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: lower<br>
+ * Purpose: convert string to lowercase
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author Uwe Tews
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+
+function smarty_modifiercompiler_lower($params, $compiler)
+{
+ if (Smarty::$_MBSTRING) {
+ return 'mb_strtolower(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')' ;
+ }
+ // no MBString fallback
+ return 'strtolower(' . $params[0] . ')';
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.noprint.php b/include/smarty/libs/plugins/modifiercompiler.noprint.php
index 3ca26571a..d7433e985 100644
--- a/include/smarty/libs/plugins/modifiercompiler.noprint.php
+++ b/include/smarty/libs/plugins/modifiercompiler.noprint.php
@@ -1,25 +1,25 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty noprint modifier plugin
- *
- * Type: modifier<br>
- * Name: noprint<br>
- * Purpose: return an empty string
- *
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_noprint($params, $compiler)
-{
- return "''";
-}
-
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty noprint modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: noprint<br>
+ * Purpose: return an empty string
+ *
+ * @author Uwe Tews
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_noprint($params, $compiler)
+{
+ return "''";
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.string_format.php b/include/smarty/libs/plugins/modifiercompiler.string_format.php
index 83345977b..5a8d43578 100644
--- a/include/smarty/libs/plugins/modifiercompiler.string_format.php
+++ b/include/smarty/libs/plugins/modifiercompiler.string_format.php
@@ -1,26 +1,26 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty string_format modifier plugin
- *
- * Type: modifier<br>
- * Name: string_format<br>
- * Purpose: format strings via sprintf
- *
- * @link http://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_string_format($params, $compiler)
-{
- return 'sprintf(' . $params[1] . ',' . $params[0] . ')';
-}
-
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty string_format modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: string_format<br>
+ * Purpose: format strings via sprintf
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual)
+ * @author Uwe Tews
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_string_format($params, $compiler)
+{
+ return 'sprintf(' . $params[1] . ',' . $params[0] . ')';
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.strip.php b/include/smarty/libs/plugins/modifiercompiler.strip.php
index f1d5db045..8d15ca434 100644
--- a/include/smarty/libs/plugins/modifiercompiler.strip.php
+++ b/include/smarty/libs/plugins/modifiercompiler.strip.php
@@ -1,33 +1,33 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty strip modifier plugin
- *
- * Type: modifier<br>
- * Name: strip<br>
- * Purpose: Replace all repeated spaces, newlines, tabs
- * with a single space or supplied replacement string.<br>
- * Example: {$var|strip} {$var|strip:"&nbsp;"}<br>
- * Date: September 25th, 2002
- *
- * @link http://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-
-function smarty_modifiercompiler_strip($params, $compiler)
-{
- if (!isset($params[1])) {
- $params[1] = "' '";
- }
- return "preg_replace('!\s+!" . Smarty::$_UTF8_MODIFIER . "', {$params[1]},{$params[0]})";
-}
-
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty strip modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: strip<br>
+ * Purpose: Replace all repeated spaces, newlines, tabs
+ * with a single space or supplied replacement string.<br>
+ * Example: {$var|strip} {$var|strip:"&nbsp;"}<br>
+ * Date: September 25th, 2002
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual)
+ * @author Uwe Tews
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+
+function smarty_modifiercompiler_strip($params, $compiler)
+{
+ if (!isset($params[1])) {
+ $params[1] = "' '";
+ }
+ return "preg_replace('!\s+!" . Smarty::$_UTF8_MODIFIER . "', {$params[1]},{$params[0]})";
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.strip_tags.php b/include/smarty/libs/plugins/modifiercompiler.strip_tags.php
index 296a3a2da..9ba71e3d9 100644
--- a/include/smarty/libs/plugins/modifiercompiler.strip_tags.php
+++ b/include/smarty/libs/plugins/modifiercompiler.strip_tags.php
@@ -1,33 +1,33 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty strip_tags modifier plugin
- *
- * Type: modifier<br>
- * Name: strip_tags<br>
- * Purpose: strip html tags from text
- *
- * @link http://www.smarty.net/manual/en/language.modifier.strip.tags.php strip_tags (Smarty online manual)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_strip_tags($params, $compiler)
-{
- if (!isset($params[1])) {
- $params[1] = true;
- }
- if ($params[1] === true) {
- return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})";
- } else {
- return 'strip_tags(' . $params[0] . ')';
- }
-}
-
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty strip_tags modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: strip_tags<br>
+ * Purpose: strip html tags from text
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.strip.tags.php strip_tags (Smarty online manual)
+ * @author Uwe Tews
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_strip_tags($params, $compiler)
+{
+ if (!isset($params[1])) {
+ $params[1] = true;
+ }
+ if ($params[1] === true) {
+ return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})";
+ } else {
+ return 'strip_tags(' . $params[0] . ')';
+ }
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.to_charset.php b/include/smarty/libs/plugins/modifiercompiler.to_charset.php
index f5cdf455f..d6c0f296b 100644
--- a/include/smarty/libs/plugins/modifiercompiler.to_charset.php
+++ b/include/smarty/libs/plugins/modifiercompiler.to_charset.php
@@ -1,34 +1,34 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty to_charset modifier plugin
- *
- * Type: modifier<br>
- * Name: to_charset<br>
- * Purpose: convert character encoding from internal encoding to $charset
- *
- * @author Rodney Rehm
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_to_charset($params, $compiler)
-{
- if (!Smarty::$_MBSTRING) {
- // FIXME: (rodneyrehm) shouldn't this throw an error?
- return $params[0];
- }
-
- if (!isset($params[1])) {
- $params[1] = '"ISO-8859-1"';
- }
-
- return 'mb_convert_encoding(' . $params[0] . ', ' . $params[1] . ', "' . addslashes(Smarty::$_CHARSET) . '")';
-}
-
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty to_charset modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: to_charset<br>
+ * Purpose: convert character encoding from internal encoding to $charset
+ *
+ * @author Rodney Rehm
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_to_charset($params, $compiler)
+{
+ if (!Smarty::$_MBSTRING) {
+ // FIXME: (rodneyrehm) shouldn't this throw an error?
+ return $params[0];
+ }
+
+ if (!isset($params[1])) {
+ $params[1] = '"ISO-8859-1"';
+ }
+
+ return 'mb_convert_encoding(' . $params[0] . ', ' . $params[1] . ', "' . addslashes(Smarty::$_CHARSET) . '")';
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.unescape.php b/include/smarty/libs/plugins/modifiercompiler.unescape.php
index 4321ff18d..61354926f 100644
--- a/include/smarty/libs/plugins/modifiercompiler.unescape.php
+++ b/include/smarty/libs/plugins/modifiercompiler.unescape.php
@@ -1,51 +1,51 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty unescape modifier plugin
- *
- * Type: modifier<br>
- * Name: unescape<br>
- * Purpose: unescape html entities
- *
- * @author Rodney Rehm
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_unescape($params, $compiler)
-{
- if (!isset($params[1])) {
- $params[1] = 'html';
- }
- if (!isset($params[2])) {
- $params[2] = '\'' . addslashes(Smarty::$_CHARSET) . '\'';
- } else {
- $params[2] = "'" . $params[2] . "'";
- }
-
- switch (trim($params[1], '"\'')) {
- case 'entity':
- case 'htmlall':
- if (Smarty::$_MBSTRING) {
- return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')';
- }
-
- return 'html_entity_decode(' . $params[0] . ', ENT_NOQUOTES, ' . $params[2] . ')';
-
- case 'html':
- return 'htmlspecialchars_decode(' . $params[0] . ', ENT_QUOTES)';
-
- case 'url':
- return 'rawurldecode(' . $params[0] . ')';
-
- default:
- return $params[0];
- }
-}
-
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty unescape modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: unescape<br>
+ * Purpose: unescape html entities
+ *
+ * @author Rodney Rehm
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_unescape($params, $compiler)
+{
+ if (!isset($params[1])) {
+ $params[1] = 'html';
+ }
+ if (!isset($params[2])) {
+ $params[2] = '\'' . addslashes(Smarty::$_CHARSET) . '\'';
+ } else {
+ $params[2] = "'" . $params[2] . "'";
+ }
+
+ switch (trim($params[1], '"\'')) {
+ case 'entity':
+ case 'htmlall':
+ if (Smarty::$_MBSTRING) {
+ return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')';
+ }
+
+ return 'html_entity_decode(' . $params[0] . ', ENT_NOQUOTES, ' . $params[2] . ')';
+
+ case 'html':
+ return 'htmlspecialchars_decode(' . $params[0] . ', ENT_QUOTES)';
+
+ case 'url':
+ return 'rawurldecode(' . $params[0] . ')';
+
+ default:
+ return $params[0];
+ }
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.upper.php b/include/smarty/libs/plugins/modifiercompiler.upper.php
index f368e37dc..8611fa870 100644
--- a/include/smarty/libs/plugins/modifiercompiler.upper.php
+++ b/include/smarty/libs/plugins/modifiercompiler.upper.php
@@ -1,30 +1,30 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty upper modifier plugin
- *
- * Type: modifier<br>
- * Name: lower<br>
- * Purpose: convert string to uppercase
- *
- * @link http://smarty.php.net/manual/en/language.modifier.upper.php lower (Smarty online manual)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_upper($params, $compiler)
-{
- if (Smarty::$_MBSTRING) {
- return 'mb_strtoupper(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')' ;
- }
- // no MBString fallback
- return 'strtoupper(' . $params[0] . ')';
-}
-
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty upper modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: lower<br>
+ * Purpose: convert string to uppercase
+ *
+ * @link http://smarty.php.net/manual/en/language.modifier.upper.php lower (Smarty online manual)
+ * @author Uwe Tews
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_upper($params, $compiler)
+{
+ if (Smarty::$_MBSTRING) {
+ return 'mb_strtoupper(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')' ;
+ }
+ // no MBString fallback
+ return 'strtoupper(' . $params[0] . ')';
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/plugins/modifiercompiler.wordwrap.php b/include/smarty/libs/plugins/modifiercompiler.wordwrap.php
index f6845ad37..8b524f32c 100644
--- a/include/smarty/libs/plugins/modifiercompiler.wordwrap.php
+++ b/include/smarty/libs/plugins/modifiercompiler.wordwrap.php
@@ -1,46 +1,46 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty wordwrap modifier plugin
- *
- * Type: modifier<br>
- * Name: wordwrap<br>
- * Purpose: wrap a string of text at a given length
- *
- * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)
- * @author Uwe Tews
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_wordwrap($params, $compiler)
-{
- if (!isset($params[1])) {
- $params[1] = 80;
- }
- if (!isset($params[2])) {
- $params[2] = '"\n"';
- }
- if (!isset($params[3])) {
- $params[3] = 'false';
- }
- $function = 'wordwrap';
- if (Smarty::$_MBSTRING) {
- if ($compiler->tag_nocache | $compiler->nocache) {
- $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php';
- $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
- } else {
- $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php';
- $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
- }
- $function = 'smarty_mb_wordwrap';
- }
- return $function . '(' . $params[0] . ',' . $params[1] . ',' . $params[2] . ',' . $params[3] . ')';
-}
-
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty wordwrap modifier plugin
+ *
+ * Type: modifier<br>
+ * Name: wordwrap<br>
+ * Purpose: wrap a string of text at a given length
+ *
+ * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)
+ * @author Uwe Tews
+ * @param array $params parameters
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_wordwrap($params, $compiler)
+{
+ if (!isset($params[1])) {
+ $params[1] = 80;
+ }
+ if (!isset($params[2])) {
+ $params[2] = '"\n"';
+ }
+ if (!isset($params[3])) {
+ $params[3] = 'false';
+ }
+ $function = 'wordwrap';
+ if (Smarty::$_MBSTRING) {
+ if ($compiler->tag_nocache | $compiler->nocache) {
+ $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php';
+ $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
+ } else {
+ $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php';
+ $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
+ }
+ $function = 'smarty_mb_wordwrap';
+ }
+ return $function . '(' . $params[0] . ',' . $params[1] . ',' . $params[2] . ',' . $params[3] . ')';
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/sysplugins/smarty_internal_compile_break.php b/include/smarty/libs/sysplugins/smarty_internal_compile_break.php
index 259c66e2b..b25bef6c4 100644
--- a/include/smarty/libs/sysplugins/smarty_internal_compile_break.php
+++ b/include/smarty/libs/sysplugins/smarty_internal_compile_break.php
@@ -1,77 +1,77 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Break
- *
- * Compiles the {break} tag
- *
- * @package Smarty
- * @subpackage Compiler
- * @author Uwe Tews
- */
-/**
- * Smarty Internal Plugin Compile Break Class
- *
- * @package Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase {
-
- /**
- * Attribute definition: Overwrites base class.
- *
- * @var array
- * @see Smarty_Internal_CompileBase
- */
- public $optional_attributes = array('levels');
- /**
- * Attribute definition: Overwrites base class.
- *
- * @var array
- * @see Smarty_Internal_CompileBase
- */
- public $shorttag_order = array('levels');
-
- /**
- * Compiles code for the {break} tag
- *
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
- * @return string compiled code
- */
- public function compile($args, $compiler, $parameter)
- {
- static $_is_loopy = array('for' => true, 'foreach' => true, 'while' => true, 'section' => true);
- // check and get attributes
- $_attr = $this->getAttributes($compiler, $args);
-
- if ($_attr['nocache'] === true) {
- $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
- }
-
- if (isset($_attr['levels'])) {
- if (!is_numeric($_attr['levels'])) {
- $compiler->trigger_template_error('level attribute must be a numeric constant', $compiler->lex->taglineno);
- }
- $_levels = $_attr['levels'];
- } else {
- $_levels = 1;
- }
- $level_count = $_levels;
- $stack_count = count($compiler->_tag_stack) - 1;
- while ($level_count > 0 && $stack_count >= 0) {
- if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) {
- $level_count--;
- }
- $stack_count--;
- }
- if ($level_count != 0) {
- $compiler->trigger_template_error("cannot break {$_levels} level(s)", $compiler->lex->taglineno);
- }
- $compiler->has_code = true;
- return "<?php break {$_levels}?>";
- }
-
-}
-
+<?php
+/**
+ * Smarty Internal Plugin Compile Break
+ *
+ * Compiles the {break} tag
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+/**
+ * Smarty Internal Plugin Compile Break Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase {
+
+ /**
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
+ public $optional_attributes = array('levels');
+ /**
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
+ public $shorttag_order = array('levels');
+
+ /**
+ * Compiles code for the {break} tag
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ * @return string compiled code
+ */
+ public function compile($args, $compiler, $parameter)
+ {
+ static $_is_loopy = array('for' => true, 'foreach' => true, 'while' => true, 'section' => true);
+ // check and get attributes
+ $_attr = $this->getAttributes($compiler, $args);
+
+ if ($_attr['nocache'] === true) {
+ $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
+ }
+
+ if (isset($_attr['levels'])) {
+ if (!is_numeric($_attr['levels'])) {
+ $compiler->trigger_template_error('level attribute must be a numeric constant', $compiler->lex->taglineno);
+ }
+ $_levels = $_attr['levels'];
+ } else {
+ $_levels = 1;
+ }
+ $level_count = $_levels;
+ $stack_count = count($compiler->_tag_stack) - 1;
+ while ($level_count > 0 && $stack_count >= 0) {
+ if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) {
+ $level_count--;
+ }
+ $stack_count--;
+ }
+ if ($level_count != 0) {
+ $compiler->trigger_template_error("cannot break {$_levels} level(s)", $compiler->lex->taglineno);
+ }
+ $compiler->has_code = true;
+ return "<?php break {$_levels}?>";
+ }
+
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/sysplugins/smarty_internal_compile_continue.php b/include/smarty/libs/sysplugins/smarty_internal_compile_continue.php
index 4082a93b3..72a5f8653 100644
--- a/include/smarty/libs/sysplugins/smarty_internal_compile_continue.php
+++ b/include/smarty/libs/sysplugins/smarty_internal_compile_continue.php
@@ -1,78 +1,78 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Continue
- *
- * Compiles the {continue} tag
- *
- * @package Smarty
- * @subpackage Compiler
- * @author Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Continue Class
- *
- * @package Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Continue extends Smarty_Internal_CompileBase {
-
- /**
- * Attribute definition: Overwrites base class.
- *
- * @var array
- * @see Smarty_Internal_CompileBase
- */
- public $optional_attributes = array('levels');
- /**
- * Attribute definition: Overwrites base class.
- *
- * @var array
- * @see Smarty_Internal_CompileBase
- */
- public $shorttag_order = array('levels');
-
- /**
- * Compiles code for the {continue} tag
- *
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
- * @return string compiled code
- */
- public function compile($args, $compiler, $parameter)
- {
- static $_is_loopy = array('for' => true, 'foreach' => true, 'while' => true, 'section' => true);
- // check and get attributes
- $_attr = $this->getAttributes($compiler, $args);
-
- if ($_attr['nocache'] === true) {
- $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
- }
-
- if (isset($_attr['levels'])) {
- if (!is_numeric($_attr['levels'])) {
- $compiler->trigger_template_error('level attribute must be a numeric constant', $compiler->lex->taglineno);
- }
- $_levels = $_attr['levels'];
- } else {
- $_levels = 1;
- }
- $level_count = $_levels;
- $stack_count = count($compiler->_tag_stack) - 1;
- while ($level_count > 0 && $stack_count >= 0) {
- if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) {
- $level_count--;
- }
- $stack_count--;
- }
- if ($level_count != 0) {
- $compiler->trigger_template_error("cannot continue {$_levels} level(s)", $compiler->lex->taglineno);
- }
- $compiler->has_code = true;
- return "<?php continue {$_levels}?>";
- }
-
-}
-
+<?php
+/**
+ * Smarty Internal Plugin Compile Continue
+ *
+ * Compiles the {continue} tag
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Smarty Internal Plugin Compile Continue Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Continue extends Smarty_Internal_CompileBase {
+
+ /**
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
+ public $optional_attributes = array('levels');
+ /**
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
+ public $shorttag_order = array('levels');
+
+ /**
+ * Compiles code for the {continue} tag
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ * @return string compiled code
+ */
+ public function compile($args, $compiler, $parameter)
+ {
+ static $_is_loopy = array('for' => true, 'foreach' => true, 'while' => true, 'section' => true);
+ // check and get attributes
+ $_attr = $this->getAttributes($compiler, $args);
+
+ if ($_attr['nocache'] === true) {
+ $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
+ }
+
+ if (isset($_attr['levels'])) {
+ if (!is_numeric($_attr['levels'])) {
+ $compiler->trigger_template_error('level attribute must be a numeric constant', $compiler->lex->taglineno);
+ }
+ $_levels = $_attr['levels'];
+ } else {
+ $_levels = 1;
+ }
+ $level_count = $_levels;
+ $stack_count = count($compiler->_tag_stack) - 1;
+ while ($level_count > 0 && $stack_count >= 0) {
+ if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) {
+ $level_count--;
+ }
+ $stack_count--;
+ }
+ if ($level_count != 0) {
+ $compiler->trigger_template_error("cannot continue {$_levels} level(s)", $compiler->lex->taglineno);
+ }
+ $compiler->has_code = true;
+ return "<?php continue {$_levels}?>";
+ }
+
+}
+
?> \ No newline at end of file
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 120f3ff10..a33109cc0 100644
--- a/include/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php
+++ b/include/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php
@@ -1,140 +1,140 @@
-<?php
-
-/**
- * Smarty Internal Plugin Compile Modifier
- *
- * Compiles code for modifier execution
- *
- * @package Smarty
- * @subpackage Compiler
- * @author Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Modifier Class
- *
- * @package Smarty
- * @subpackage Compiler
- */
-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
- * @return string compiled code
- */
- public function compile($args, $compiler, $parameter) {
- // check and get attributes
- $_attr = $this->getAttributes($compiler, $args);
- $output = $parameter['value'];
- // loop over list of modifiers
- foreach ($parameter['modifierlist'] as $single_modifier) {
- $modifier = $single_modifier[0];
- $single_modifier[0] = $output;
- $params = implode(',', $single_modifier);
- // check if we know already the type of modifier
- if (isset($compiler->known_modifier_type[$modifier])) {
- $modifier_types = array($compiler->known_modifier_type[$modifier]);
- } else {
- $modifier_types = array(1, 2, 3, 4, 5, 6);
- }
- foreach ($modifier_types as $type) {
- switch ($type) {
- case 1:
- // registered modifier
- if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier])) {
- $function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];
- 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 . ')';
- } else {
- $output = $function[0] . '::' . $function[1] . '(' . $params . ')';
- }
- }
- $compiler->known_modifier_type[$modifier] = $type;
- break 2;
- }
- break;
- case 2:
- // registered modifier compiler
- if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0])) {
- $output = call_user_func($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0], $single_modifier, $compiler->smarty);
- $compiler->known_modifier_type[$modifier] = $type;
- break 2;
- }
- break;
- case 3:
- // 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)) {
- $plugin = 'smarty_modifiercompiler_' . $modifier;
- $output = $plugin($single_modifier, $compiler);
- }
- $compiler->known_modifier_type[$modifier] = $type;
- break 2;
- }
- break;
- case 4:
- // 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)) {
- $output = "{$function}({$params})";
- }
- $compiler->known_modifier_type[$modifier] = $type;
- break 2;
- }
- break;
- case 5:
- // PHP function
- if (is_callable($modifier)) {
- // check if modifier allowed
- if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)) {
- $output = "{$modifier}({$params})";
- }
- $compiler->known_modifier_type[$modifier] = $type;
- break 2;
- }
- 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))) {
- $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_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 . ')';
- } 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'])) {
- // was a plugin
- $compiler->known_modifier_type[$modifier] = 4;
- } else {
- $compiler->known_modifier_type[$modifier] = $type;
- }
- break 2;
- }
- }
- }
- if (!isset($compiler->known_modifier_type[$modifier])) {
- $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", $compiler->lex->taglineno);
- }
- }
- return $output;
- }
-
-}
-
+<?php
+
+/**
+ * Smarty Internal Plugin Compile Modifier
+ *
+ * Compiles code for modifier execution
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Smarty Internal Plugin Compile Modifier Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+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
+ * @return string compiled code
+ */
+ public function compile($args, $compiler, $parameter) {
+ // check and get attributes
+ $_attr = $this->getAttributes($compiler, $args);
+ $output = $parameter['value'];
+ // loop over list of modifiers
+ foreach ($parameter['modifierlist'] as $single_modifier) {
+ $modifier = $single_modifier[0];
+ $single_modifier[0] = $output;
+ $params = implode(',', $single_modifier);
+ // check if we know already the type of modifier
+ if (isset($compiler->known_modifier_type[$modifier])) {
+ $modifier_types = array($compiler->known_modifier_type[$modifier]);
+ } else {
+ $modifier_types = array(1, 2, 3, 4, 5, 6);
+ }
+ foreach ($modifier_types as $type) {
+ switch ($type) {
+ case 1:
+ // registered modifier
+ if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier])) {
+ $function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];
+ 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 . ')';
+ } else {
+ $output = $function[0] . '::' . $function[1] . '(' . $params . ')';
+ }
+ }
+ $compiler->known_modifier_type[$modifier] = $type;
+ break 2;
+ }
+ break;
+ case 2:
+ // registered modifier compiler
+ if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0])) {
+ $output = call_user_func($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0], $single_modifier, $compiler->smarty);
+ $compiler->known_modifier_type[$modifier] = $type;
+ break 2;
+ }
+ break;
+ case 3:
+ // 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)) {
+ $plugin = 'smarty_modifiercompiler_' . $modifier;
+ $output = $plugin($single_modifier, $compiler);
+ }
+ $compiler->known_modifier_type[$modifier] = $type;
+ break 2;
+ }
+ break;
+ case 4:
+ // 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)) {
+ $output = "{$function}({$params})";
+ }
+ $compiler->known_modifier_type[$modifier] = $type;
+ break 2;
+ }
+ break;
+ case 5:
+ // PHP function
+ if (is_callable($modifier)) {
+ // check if modifier allowed
+ if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)) {
+ $output = "{$modifier}({$params})";
+ }
+ $compiler->known_modifier_type[$modifier] = $type;
+ break 2;
+ }
+ 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))) {
+ $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_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 . ')';
+ } 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'])) {
+ // was a plugin
+ $compiler->known_modifier_type[$modifier] = 4;
+ } else {
+ $compiler->known_modifier_type[$modifier] = $type;
+ }
+ break 2;
+ }
+ }
+ }
+ if (!isset($compiler->known_modifier_type[$modifier])) {
+ $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", $compiler->lex->taglineno);
+ }
+ }
+ return $output;
+ }
+
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php b/include/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php
index 9fed36c3b..f104853a8 100644
--- a/include/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php
+++ b/include/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php
@@ -1,113 +1,113 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Registered Block
- *
- * Compiles code for the execution of a registered block function
- *
- * @package Smarty
- * @subpackage Compiler
- * @author Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Registered Block Class
- *
- * @package Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_CompileBase {
-
- /**
- * Attribute definition: Overwrites base class.
- *
- * @var array
- * @see Smarty_Internal_CompileBase
- */
- public $optional_attributes = array('_any');
-
- /**
- * Compiles code for the execution of a block function
- *
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
- * @param string $tag name of block function
- * @return string compiled code
- */
- public function compile($args, $compiler, $parameter, $tag)
- {
- if (!isset($tag[5]) || substr($tag,-5) != 'close') {
- // opening tag of block plugin
- // check and get attributes
- $_attr = $this->getAttributes($compiler, $args);
- if ($_attr['nocache']) {
- $compiler->tag_nocache = true;
- }
- unset($_attr['nocache']);
- if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$tag])) {
- $tag_info = $compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$tag];
- } else {
- $tag_info = $compiler->default_handler_plugins[Smarty::PLUGIN_BLOCK][$tag];
- }
- // convert attributes into parameter array string
- $_paramsArray = array();
- foreach ($_attr as $_key => $_value) {
- if (is_int($_key)) {
- $_paramsArray[] = "$_key=>$_value";
- } elseif ($compiler->template->caching && in_array($_key,$tag_info[2])) {
- $_value = str_replace("'","^#^",$_value);
- $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^";
- } else {
- $_paramsArray[] = "'$_key'=>$_value";
- }
- }
- $_params = 'array(' . implode(",", $_paramsArray) . ')';
-
- $this->openTag($compiler, $tag, array($_params, $compiler->nocache));
- // maybe nocache because of nocache variables or nocache plugin
- $compiler->nocache = !$tag_info[1] | $compiler->nocache | $compiler->tag_nocache;
- $function = $tag_info[0];
- // compile code
- if (!is_array($function)) {
- $output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; echo {$function}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
- } else if (is_object($function[0])) {
- $output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; echo \$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]->{$function[1]}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
- } else {
- $output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; echo {$function[0]}::{$function[1]}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
- }
- } else {
- // must endblock be nocache?
- if ($compiler->nocache) {
- $compiler->tag_nocache = true;
- }
- $base_tag = substr($tag, 0, -5);
- // closing tag of block plugin, restore nocache
- list($_params, $compiler->nocache) = $this->closeTag($compiler, $base_tag);
- // This tag does create output
- $compiler->has_output = true;
- if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag])) {
- $function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag][0];
- } else {
- $function = $compiler->default_handler_plugins[Smarty::PLUGIN_BLOCK][$base_tag][0];
- }
- // compile code
- if (!isset($parameter['modifier_list'])) {
- $mod_pre = $mod_post ='';
- } else {
- $mod_pre = ' ob_start(); ';
- $mod_post = 'echo '.$compiler->compileTag('private_modifier',array(),array('modifierlist'=>$parameter['modifier_list'],'value'=>'ob_get_clean()')).';';
- }
- if (!is_array($function)) {
- $output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;".$mod_pre." echo {$function}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat);".$mod_post." } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
- } else if (is_object($function[0])) {
- $output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;".$mod_pre." echo \$_smarty_tpl->smarty->registered_plugins['block']['{$base_tag}'][0][0]->{$function[1]}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); ".$mod_post."} array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
- } else {
- $output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;".$mod_pre." echo {$function[0]}::{$function[1]}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); ".$mod_post."} array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
- }
- }
- return $output . "\n";
- }
-
-}
-
+<?php
+/**
+ * Smarty Internal Plugin Compile Registered Block
+ *
+ * Compiles code for the execution of a registered block function
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Smarty Internal Plugin Compile Registered Block Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_CompileBase {
+
+ /**
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
+ public $optional_attributes = array('_any');
+
+ /**
+ * Compiles code for the execution of a block function
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ * @param string $tag name of block function
+ * @return string compiled code
+ */
+ public function compile($args, $compiler, $parameter, $tag)
+ {
+ if (!isset($tag[5]) || substr($tag,-5) != 'close') {
+ // opening tag of block plugin
+ // check and get attributes
+ $_attr = $this->getAttributes($compiler, $args);
+ if ($_attr['nocache']) {
+ $compiler->tag_nocache = true;
+ }
+ unset($_attr['nocache']);
+ if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$tag])) {
+ $tag_info = $compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$tag];
+ } else {
+ $tag_info = $compiler->default_handler_plugins[Smarty::PLUGIN_BLOCK][$tag];
+ }
+ // convert attributes into parameter array string
+ $_paramsArray = array();
+ foreach ($_attr as $_key => $_value) {
+ if (is_int($_key)) {
+ $_paramsArray[] = "$_key=>$_value";
+ } elseif ($compiler->template->caching && in_array($_key,$tag_info[2])) {
+ $_value = str_replace("'","^#^",$_value);
+ $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^";
+ } else {
+ $_paramsArray[] = "'$_key'=>$_value";
+ }
+ }
+ $_params = 'array(' . implode(",", $_paramsArray) . ')';
+
+ $this->openTag($compiler, $tag, array($_params, $compiler->nocache));
+ // maybe nocache because of nocache variables or nocache plugin
+ $compiler->nocache = !$tag_info[1] | $compiler->nocache | $compiler->tag_nocache;
+ $function = $tag_info[0];
+ // compile code
+ if (!is_array($function)) {
+ $output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; echo {$function}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
+ } else if (is_object($function[0])) {
+ $output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; echo \$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]->{$function[1]}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
+ } else {
+ $output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; echo {$function[0]}::{$function[1]}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
+ }
+ } else {
+ // must endblock be nocache?
+ if ($compiler->nocache) {
+ $compiler->tag_nocache = true;
+ }
+ $base_tag = substr($tag, 0, -5);
+ // closing tag of block plugin, restore nocache
+ list($_params, $compiler->nocache) = $this->closeTag($compiler, $base_tag);
+ // This tag does create output
+ $compiler->has_output = true;
+ if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag])) {
+ $function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag][0];
+ } else {
+ $function = $compiler->default_handler_plugins[Smarty::PLUGIN_BLOCK][$base_tag][0];
+ }
+ // compile code
+ if (!isset($parameter['modifier_list'])) {
+ $mod_pre = $mod_post ='';
+ } else {
+ $mod_pre = ' ob_start(); ';
+ $mod_post = 'echo '.$compiler->compileTag('private_modifier',array(),array('modifierlist'=>$parameter['modifier_list'],'value'=>'ob_get_clean()')).';';
+ }
+ if (!is_array($function)) {
+ $output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;".$mod_pre." echo {$function}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat);".$mod_post." } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
+ } else if (is_object($function[0])) {
+ $output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;".$mod_pre." echo \$_smarty_tpl->smarty->registered_plugins['block']['{$base_tag}'][0][0]->{$function[1]}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); ".$mod_post."} array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
+ } else {
+ $output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;".$mod_pre." echo {$function[0]}::{$function[1]}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); ".$mod_post."} array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
+ }
+ }
+ return $output . "\n";
+ }
+
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php b/include/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php
index 5058bfbbd..e68a0244d 100644
--- a/include/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php
+++ b/include/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php
@@ -1,81 +1,81 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Registered Function
- *
- * Compiles code for the execution of a registered function
- *
- * @package Smarty
- * @subpackage Compiler
- * @author Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Registered Function Class
- *
- * @package Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Internal_CompileBase {
-
- /**
- * Attribute definition: Overwrites base class.
- *
- * @var array
- * @see Smarty_Internal_CompileBase
- */
- public $optional_attributes = array('_any');
-
- /**
- * Compiles code for the execution of a registered function
- *
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
- * @param string $tag name of function
- * @return string compiled code
- */
- public function compile($args, $compiler, $parameter, $tag)
- {
- // This tag does create output
- $compiler->has_output = true;
- // check and get attributes
- $_attr = $this->getAttributes($compiler, $args);
- if ($_attr['nocache']) {
- $compiler->tag_nocache = true;
- }
- unset($_attr['nocache']);
- if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag])) {
- $tag_info = $compiler->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag];
- } else {
- $tag_info = $compiler->default_handler_plugins[Smarty::PLUGIN_FUNCTION][$tag];
- }
- // not cachable?
- $compiler->tag_nocache = $compiler->tag_nocache || !$tag_info[1];
- // convert attributes into parameter array string
- $_paramsArray = array();
- foreach ($_attr as $_key => $_value) {
- if (is_int($_key)) {
- $_paramsArray[] = "$_key=>$_value";
- } elseif ($compiler->template->caching && in_array($_key,$tag_info[2])) {
- $_value = str_replace("'","^#^",$_value);
- $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^";
- } else {
- $_paramsArray[] = "'$_key'=>$_value";
- }
- }
- $_params = 'array(' . implode(",", $_paramsArray) . ')';
- $function = $tag_info[0];
- // compile code
- if (!is_array($function)) {
- $output = "<?php echo {$function}({$_params},\$_smarty_tpl);?>\n";
- } else if (is_object($function[0])) {
- $output = "<?php echo \$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0][0]->{$function[1]}({$_params},\$_smarty_tpl);?>\n";
- } else {
- $output = "<?php echo {$function[0]}::{$function[1]}({$_params},\$_smarty_tpl);?>\n";
- }
- return $output;
- }
-
-}
-
+<?php
+/**
+ * Smarty Internal Plugin Compile Registered Function
+ *
+ * Compiles code for the execution of a registered function
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Smarty Internal Plugin Compile Registered Function Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Internal_CompileBase {
+
+ /**
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
+ public $optional_attributes = array('_any');
+
+ /**
+ * Compiles code for the execution of a registered function
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ * @param string $tag name of function
+ * @return string compiled code
+ */
+ public function compile($args, $compiler, $parameter, $tag)
+ {
+ // This tag does create output
+ $compiler->has_output = true;
+ // check and get attributes
+ $_attr = $this->getAttributes($compiler, $args);
+ if ($_attr['nocache']) {
+ $compiler->tag_nocache = true;
+ }
+ unset($_attr['nocache']);
+ if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag])) {
+ $tag_info = $compiler->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag];
+ } else {
+ $tag_info = $compiler->default_handler_plugins[Smarty::PLUGIN_FUNCTION][$tag];
+ }
+ // not cachable?
+ $compiler->tag_nocache = $compiler->tag_nocache || !$tag_info[1];
+ // convert attributes into parameter array string
+ $_paramsArray = array();
+ foreach ($_attr as $_key => $_value) {
+ if (is_int($_key)) {
+ $_paramsArray[] = "$_key=>$_value";
+ } elseif ($compiler->template->caching && in_array($_key,$tag_info[2])) {
+ $_value = str_replace("'","^#^",$_value);
+ $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^";
+ } else {
+ $_paramsArray[] = "'$_key'=>$_value";
+ }
+ }
+ $_params = 'array(' . implode(",", $_paramsArray) . ')';
+ $function = $tag_info[0];
+ // compile code
+ if (!is_array($function)) {
+ $output = "<?php echo {$function}({$_params},\$_smarty_tpl);?>\n";
+ } else if (is_object($function[0])) {
+ $output = "<?php echo \$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0][0]->{$function[1]}({$_params},\$_smarty_tpl);?>\n";
+ } else {
+ $output = "<?php echo {$function[0]}::{$function[1]}({$_params},\$_smarty_tpl);?>\n";
+ }
+ return $output;
+ }
+
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php b/include/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php
index d1dd90cf8..50b4cab55 100644
--- a/include/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php
+++ b/include/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php
@@ -1,72 +1,72 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Setfilter
- *
- * Compiles code for setfilter tag
- *
- * @package Smarty
- * @subpackage Compiler
- * @author Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Setfilter Class
- *
- * @package Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase {
-
- /**
- * Compiles code for setfilter tag
- *
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
- * @return string compiled code
- */
- public function compile($args, $compiler, $parameter)
- {
- $compiler->variable_filter_stack[] = $compiler->template->variable_filters;
- $compiler->template->variable_filters = $parameter['modifier_list'];
- // this tag does not return compiled code
- $compiler->has_code = false;
- return true;
- }
-
-}
-
-/**
- * Smarty Internal Plugin Compile Setfilterclose Class
- *
- * @package Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase {
-
- /**
- * Compiles code for the {/setfilter} tag
- *
- * This tag does not generate compiled output. It resets variable filter.
- *
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @return string compiled code
- */
- public function compile($args, $compiler)
- {
- $_attr = $this->getAttributes($compiler, $args);
- // reset variable filter to previous state
- if (count($compiler->variable_filter_stack)) {
- $compiler->template->variable_filters = array_pop($compiler->variable_filter_stack);
- } else {
- $compiler->template->variable_filters = array();
- }
- // this tag does not return compiled code
- $compiler->has_code = false;
- return true;
- }
-
-}
-
+<?php
+/**
+ * Smarty Internal Plugin Compile Setfilter
+ *
+ * Compiles code for setfilter tag
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Smarty Internal Plugin Compile Setfilter Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase {
+
+ /**
+ * Compiles code for setfilter tag
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ * @return string compiled code
+ */
+ public function compile($args, $compiler, $parameter)
+ {
+ $compiler->variable_filter_stack[] = $compiler->template->variable_filters;
+ $compiler->template->variable_filters = $parameter['modifier_list'];
+ // this tag does not return compiled code
+ $compiler->has_code = false;
+ return true;
+ }
+
+}
+
+/**
+ * Smarty Internal Plugin Compile Setfilterclose Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase {
+
+ /**
+ * Compiles code for the {/setfilter} tag
+ *
+ * This tag does not generate compiled output. It resets variable filter.
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @return string compiled code
+ */
+ public function compile($args, $compiler)
+ {
+ $_attr = $this->getAttributes($compiler, $args);
+ // reset variable filter to previous state
+ if (count($compiler->variable_filter_stack)) {
+ $compiler->template->variable_filters = array_pop($compiler->variable_filter_stack);
+ } else {
+ $compiler->template->variable_filters = array();
+ }
+ // this tag does not return compiled code
+ $compiler->has_code = false;
+ return true;
+ }
+
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/sysplugins/smarty_internal_function_call_handler.php b/include/smarty/libs/sysplugins/smarty_internal_function_call_handler.php
index 010d63592..fa4b43b2a 100644
--- a/include/smarty/libs/sysplugins/smarty_internal_function_call_handler.php
+++ b/include/smarty/libs/sysplugins/smarty_internal_function_call_handler.php
@@ -1,55 +1,55 @@
-<?php
-/**
- * Smarty Internal Plugin Function Call Handler
- *
- * @package Smarty
- * @subpackage PluginsInternal
- * @author Uwe Tews
- */
-
-/**
- * This class does call function defined with the {function} tag
- *
- * @package Smarty
- * @subpackage PluginsInternal
- */
-class Smarty_Internal_Function_Call_Handler {
-
- /**
- * This function handles calls to template functions defined by {function}
- * It does create a PHP function at the first call
- *
- * @param string $_name template function name
- * @param Smarty_Internal_Template $_template template object
- * @param array $_params Smarty variables passed as call parameter
- * @param string $_hash nocache hash value
- * @param bool $_nocache nocache flag
- */
- public static function call($_name, Smarty_Internal_Template $_template, $_params, $_hash, $_nocache)
- {
- if ($_nocache) {
- $_function = "smarty_template_function_{$_name}_nocache";
- } else {
- $_function = "smarty_template_function_{$_hash}_{$_name}";
- }
- if (!is_callable($_function)) {
- $_code = "function {$_function}(\$_smarty_tpl,\$params) {
- \$saved_tpl_vars = \$_smarty_tpl->tpl_vars;
- foreach (\$_smarty_tpl->smarty->template_functions['{$_name}']['parameter'] as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);};
- foreach (\$params as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);}?>";
- if ($_nocache) {
- $_code .= preg_replace(array("!<\?php echo \\'/\*%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\*/|/\*/%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\*/\\';\?>!",
- "!\\\'!"), array('', "'"), $_template->smarty->template_functions[$_name]['compiled']);
- $_template->smarty->template_functions[$_name]['called_nocache'] = true;
- } else {
- $_code .= preg_replace("/{$_template->smarty->template_functions[$_name]['nocache_hash']}/", $_template->properties['nocache_hash'], $_template->smarty->template_functions[$_name]['compiled']);
- }
- $_code .= "<?php \$_smarty_tpl->tpl_vars = \$saved_tpl_vars;}";
- eval($_code);
- }
- $_function($_template, $_params);
- }
-
-}
-
-?>
+<?php
+/**
+ * Smarty Internal Plugin Function Call Handler
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+
+/**
+ * This class does call function defined with the {function} tag
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ */
+class Smarty_Internal_Function_Call_Handler {
+
+ /**
+ * This function handles calls to template functions defined by {function}
+ * It does create a PHP function at the first call
+ *
+ * @param string $_name template function name
+ * @param Smarty_Internal_Template $_template template object
+ * @param array $_params Smarty variables passed as call parameter
+ * @param string $_hash nocache hash value
+ * @param bool $_nocache nocache flag
+ */
+ public static function call($_name, Smarty_Internal_Template $_template, $_params, $_hash, $_nocache)
+ {
+ if ($_nocache) {
+ $_function = "smarty_template_function_{$_name}_nocache";
+ } else {
+ $_function = "smarty_template_function_{$_hash}_{$_name}";
+ }
+ if (!is_callable($_function)) {
+ $_code = "function {$_function}(\$_smarty_tpl,\$params) {
+ \$saved_tpl_vars = \$_smarty_tpl->tpl_vars;
+ foreach (\$_smarty_tpl->smarty->template_functions['{$_name}']['parameter'] as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);};
+ foreach (\$params as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);}?>";
+ if ($_nocache) {
+ $_code .= preg_replace(array("!<\?php echo \\'/\*%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\*/|/\*/%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\*/\\';\?>!",
+ "!\\\'!"), array('', "'"), $_template->smarty->template_functions[$_name]['compiled']);
+ $_template->smarty->template_functions[$_name]['called_nocache'] = true;
+ } else {
+ $_code .= preg_replace("/{$_template->smarty->template_functions[$_name]['nocache_hash']}/", $_template->properties['nocache_hash'], $_template->smarty->template_functions[$_name]['compiled']);
+ }
+ $_code .= "<?php \$_smarty_tpl->tpl_vars = \$saved_tpl_vars;}";
+ eval($_code);
+ }
+ $_function($_template, $_params);
+ }
+
+}
+
+?>
diff --git a/include/smarty/libs/sysplugins/smarty_internal_get_include_path.php b/include/smarty/libs/sysplugins/smarty_internal_get_include_path.php
index 518c406aa..bafb72133 100644
--- a/include/smarty/libs/sysplugins/smarty_internal_get_include_path.php
+++ b/include/smarty/libs/sysplugins/smarty_internal_get_include_path.php
@@ -1,48 +1,48 @@
-<?php
-/**
- * Smarty read include path plugin
- *
- * @package Smarty
- * @subpackage PluginsInternal
- * @author Monte Ohrt
- */
-
-/**
- * Smarty Internal Read Include Path Class
- *
- * @package Smarty
- * @subpackage PluginsInternal
- */
-class Smarty_Internal_Get_Include_Path {
-
- /**
- * Return full file path from PHP include_path
- *
- * @param string $filepath filepath
- * @return string|boolean full filepath or false
- */
- public static function getIncludePath($filepath)
- {
- static $_include_path = null;
-
- if (function_exists('stream_resolve_include_path')) {
- // available since PHP 5.3.2
- return stream_resolve_include_path($filepath);
- }
-
- if ($_include_path === null) {
- $_include_path = explode(PATH_SEPARATOR, get_include_path());
- }
-
- foreach ($_include_path as $_path) {
- if (file_exists($_path . DS . $filepath)) {
- return $_path . DS . $filepath;
- }
- }
-
- return false;
- }
-
-}
-
+<?php
+/**
+ * Smarty read include path plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Monte Ohrt
+ */
+
+/**
+ * Smarty Internal Read Include Path Class
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ */
+class Smarty_Internal_Get_Include_Path {
+
+ /**
+ * Return full file path from PHP include_path
+ *
+ * @param string $filepath filepath
+ * @return string|boolean full filepath or false
+ */
+ public static function getIncludePath($filepath)
+ {
+ static $_include_path = null;
+
+ if (function_exists('stream_resolve_include_path')) {
+ // available since PHP 5.3.2
+ return stream_resolve_include_path($filepath);
+ }
+
+ if ($_include_path === null) {
+ $_include_path = explode(PATH_SEPARATOR, get_include_path());
+ }
+
+ foreach ($_include_path as $_path) {
+ if (file_exists($_path . DS . $filepath)) {
+ return $_path . DS . $filepath;
+ }
+ }
+
+ return false;
+ }
+
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/sysplugins/smarty_internal_nocache_insert.php b/include/smarty/libs/sysplugins/smarty_internal_nocache_insert.php
index faae49af6..64a2b1e1b 100644
--- a/include/smarty/libs/sysplugins/smarty_internal_nocache_insert.php
+++ b/include/smarty/libs/sysplugins/smarty_internal_nocache_insert.php
@@ -1,53 +1,53 @@
-<?php
-/**
- * Smarty Internal Plugin Nocache Insert
- *
- * Compiles the {insert} tag into the cache file
- *
- * @package Smarty
- * @subpackage Compiler
- * @author Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Insert Class
- *
- * @package Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Nocache_Insert {
-
- /**
- * Compiles code for the {insert} tag into cache file
- *
- * @param string $_function insert function name
- * @param array $_attr array with parameter
- * @param Smarty_Internal_Template $_template template object
- * @param string $_script script name to load or 'null'
- * @param string $_assign optional variable name
- * @return string compiled code
- */
- public static function compile($_function, $_attr, $_template, $_script, $_assign = null)
- {
- $_output = '<?php ';
- if ($_script != 'null') {
- // script which must be included
- // code for script file loading
- $_output .= "require_once '{$_script}';";
- }
- // call insert
- if (isset($_assign)) {
- $_output .= "\$_smarty_tpl->assign('{$_assign}' , {$_function} (" . var_export($_attr, true) . ",\$_smarty_tpl), true);?>";
- } else {
- $_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl);?>";
- }
- $_tpl = $_template;
- while ($_tpl->parent instanceof Smarty_Internal_Template) {
- $_tpl = $_tpl->parent;
- }
- return "/*%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/" . $_output . "/*/%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/";
- }
-
-}
-
-?>
+<?php
+/**
+ * Smarty Internal Plugin Nocache Insert
+ *
+ * Compiles the {insert} tag into the cache file
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Smarty Internal Plugin Compile Insert Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Nocache_Insert {
+
+ /**
+ * Compiles code for the {insert} tag into cache file
+ *
+ * @param string $_function insert function name
+ * @param array $_attr array with parameter
+ * @param Smarty_Internal_Template $_template template object
+ * @param string $_script script name to load or 'null'
+ * @param string $_assign optional variable name
+ * @return string compiled code
+ */
+ public static function compile($_function, $_attr, $_template, $_script, $_assign = null)
+ {
+ $_output = '<?php ';
+ if ($_script != 'null') {
+ // script which must be included
+ // code for script file loading
+ $_output .= "require_once '{$_script}';";
+ }
+ // call insert
+ if (isset($_assign)) {
+ $_output .= "\$_smarty_tpl->assign('{$_assign}' , {$_function} (" . var_export($_attr, true) . ",\$_smarty_tpl), true);?>";
+ } else {
+ $_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl);?>";
+ }
+ $_tpl = $_template;
+ while ($_tpl->parent instanceof Smarty_Internal_Template) {
+ $_tpl = $_tpl->parent;
+ }
+ return "/*%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/" . $_output . "/*/%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/";
+ }
+
+}
+
+?>
diff --git a/include/smarty/libs/sysplugins/smarty_internal_parsetree.php b/include/smarty/libs/sysplugins/smarty_internal_parsetree.php
index c9fb1f762..99f4c6566 100644
--- a/include/smarty/libs/sysplugins/smarty_internal_parsetree.php
+++ b/include/smarty/libs/sysplugins/smarty_internal_parsetree.php
@@ -1,395 +1,395 @@
-<?php
-/**
- * Smarty Internal Plugin Templateparser Parsetrees
- *
- * These are classes to build parsetrees in the template parser
- *
- * @package Smarty
- * @subpackage Compiler
- * @author Thue Kristensen
- * @author Uwe Tews
- */
-
-/**
- * @package Smarty
- * @subpackage Compiler
- * @ignore
- */
-abstract class _smarty_parsetree {
-
- /**
- * Parser object
- * @var object
- */
- public $parser;
- /**
- * Buffer content
- * @var mixed
- */
- public $data;
-
- /**
- * Return buffer
- *
- * @return string buffer content
- */
- abstract public function to_smarty_php();
-
-}
-
-/**
- * A complete smarty tag.
- *
- * @package Smarty
- * @subpackage Compiler
- * @ignore
- */
-class _smarty_tag extends _smarty_parsetree {
-
- /**
- * Saved block nesting level
- * @var int
- */
- public $saved_block_nesting;
-
- /**
- * Create parse tree buffer for Smarty tag
- *
- * @param object $parser parser object
- * @param string $data content
- */
- public function __construct($parser, $data)
- {
- $this->parser = $parser;
- $this->data = $data;
- $this->saved_block_nesting = $parser->block_nesting_level;
- }
-
- /**
- * Return buffer content
- *
- * @return string content
- */
- public function to_smarty_php()
- {
- return $this->data;
- }
-
- /**
- * Return complied code that loads the evaluated outout of buffer content into a temporary variable
- *
- * @return string template code
- */
- public function assign_to_var()
- {
- $var = sprintf('$_tmp%d', ++$this->parser->prefix_number);
- $this->parser->compiler->prefix_code[] = sprintf('<?php ob_start();?>%s<?php %s=ob_get_clean();?>', $this->data, $var);
- return $var;
- }
-
-}
-
-/**
- * Code fragment inside a tag.
- *
- * @package Smarty
- * @subpackage Compiler
- * @ignore
- */
-class _smarty_code extends _smarty_parsetree {
-
-
- /**
- * Create parse tree buffer for code fragment
- *
- * @param object $parser parser object
- * @param string $data content
- */
- public function __construct($parser, $data)
- {
- $this->parser = $parser;
- $this->data = $data;
- }
-
- /**
- * Return buffer content in parentheses
- *
- * @return string content
- */
- public function to_smarty_php()
- {
- return sprintf("(%s)", $this->data);
- }
-
-}
-
-/**
- * Double quoted string inside a tag.
- *
- * @package Smarty
- * @subpackage Compiler
- * @ignore
- */
-class _smarty_doublequoted extends _smarty_parsetree {
-
- /**
- * Create parse tree buffer for double quoted string subtrees
- *
- * @param object $parser parser object
- * @param _smarty_parsetree $subtree parsetree buffer
- */
- public function __construct($parser, _smarty_parsetree $subtree)
- {
- $this->parser = $parser;
- $this->subtrees[] = $subtree;
- if ($subtree instanceof _smarty_tag) {
- $this->parser->block_nesting_level = count($this->parser->compiler->_tag_stack);
- }
- }
-
- /**
- * Append buffer to subtree
- *
- * @param _smarty_parsetree $subtree parsetree buffer
- */
- public function append_subtree(_smarty_parsetree $subtree)
- {
- $last_subtree = count($this->subtrees) - 1;
- if ($last_subtree >= 0 && $this->subtrees[$last_subtree] instanceof _smarty_tag && $this->subtrees[$last_subtree]->saved_block_nesting < $this->parser->block_nesting_level) {
- if ($subtree instanceof _smarty_code) {
- $this->subtrees[$last_subtree]->data .= '<?php echo ' . $subtree->data . ';?>';
- } elseif ($subtree instanceof _smarty_dq_content) {
- $this->subtrees[$last_subtree]->data .= '<?php echo "' . $subtree->data . '";?>';
- } else {
- $this->subtrees[$last_subtree]->data .= $subtree->data;
- }
- } else {
- $this->subtrees[] = $subtree;
- }
- if ($subtree instanceof _smarty_tag) {
- $this->parser->block_nesting_level = count($this->parser->compiler->_tag_stack);
- }
- }
-
- /**
- * Merge subtree buffer content together
- *
- * @return string compiled template code
- */
- public function to_smarty_php()
- {
- $code = '';
- foreach ($this->subtrees as $subtree) {
- if ($code !== "") {
- $code .= ".";
- }
- if ($subtree instanceof _smarty_tag) {
- $more_php = $subtree->assign_to_var();
- } else {
- $more_php = $subtree->to_smarty_php();
- }
-
- $code .= $more_php;
-
- if (!$subtree instanceof _smarty_dq_content) {
- $this->parser->compiler->has_variable_string = true;
- }
- }
- return $code;
- }
-
-}
-
-/**
- * Raw chars as part of a double quoted string.
- *
- * @package Smarty
- * @subpackage Compiler
- * @ignore
- */
-class _smarty_dq_content extends _smarty_parsetree {
-
-
- /**
- * Create parse tree buffer with string content
- *
- * @param object $parser parser object
- * @param string $data string section
- */
- public function __construct($parser, $data)
- {
- $this->parser = $parser;
- $this->data = $data;
- }
-
- /**
- * Return content as double quoted string
- *
- * @return string doubled quoted string
- */
- public function to_smarty_php()
- {
- return '"' . $this->data . '"';
- }
-
-}
-
-/**
- * Template element
- *
- * @package Smarty
- * @subpackage Compiler
- * @ignore
- */
-class _smarty_template_buffer extends _smarty_parsetree {
-
- /**
- * Array of template elements
- *
- * @var array
- */
- public $subtrees = Array();
-
- /**
- * Create root of parse tree for template elements
- *
- * @param object $parser parse object
- */
- public function __construct($parser)
- {
- $this->parser = $parser;
- }
-
- /**
- * Append buffer to subtree
- *
- * @param _smarty_parsetree $subtree
- */
- public function append_subtree(_smarty_parsetree $subtree)
- {
- $this->subtrees[] = $subtree;
- }
-
- /**
- * Sanitize and merge subtree buffers together
- *
- * @return string template code content
- */
- public function to_smarty_php()
- {
- $code = '';
- for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key++) {
- if ($key + 2 < $cnt) {
- if ($this->subtrees[$key] instanceof _smarty_linebreak && $this->subtrees[$key + 1] instanceof _smarty_tag && $this->subtrees[$key + 1]->data == '' && $this->subtrees[$key + 2] instanceof _smarty_linebreak) {
- $key = $key + 1;
- continue;
- }
- if (substr($this->subtrees[$key]->data, -1) == '<' && $this->subtrees[$key + 1]->data == '' && substr($this->subtrees[$key + 2]->data, -1) == '?') {
- $key = $key + 2;
- continue;
- }
- }
- if (substr($code, -1) == '<') {
- $subtree = $this->subtrees[$key]->to_smarty_php();
- if (substr($subtree, 0, 1) == '?') {
- $code = substr($code, 0, strlen($code) - 1) . '<<?php ?>?' . substr($subtree, 1);
- } elseif ($this->parser->asp_tags && substr($subtree, 0, 1) == '%') {
- $code = substr($code, 0, strlen($code) - 1) . '<<?php ?>%' . substr($subtree, 1);
- } else {
- $code .= $subtree;
- }
- continue;
- }
- if ($this->parser->asp_tags && substr($code, -1) == '%') {
- $subtree = $this->subtrees[$key]->to_smarty_php();
- if (substr($subtree, 0, 1) == '>') {
- $code = substr($code, 0, strlen($code) - 1) . '%<?php ?>>' . substr($subtree, 1);
- } else {
- $code .= $subtree;
- }
- continue;
- }
- if (substr($code, -1) == '?') {
- $subtree = $this->subtrees[$key]->to_smarty_php();
- if (substr($subtree, 0, 1) == '>') {
- $code = substr($code, 0, strlen($code) - 1) . '?<?php ?>>' . substr($subtree, 1);
- } else {
- $code .= $subtree;
- }
- continue;
- }
- $code .= $this->subtrees[$key]->to_smarty_php();
- }
- return $code;
- }
-
-}
-
-/**
- * template text
- *
- * @package Smarty
- * @subpackage Compiler
- * @ignore
- */
-class _smarty_text extends _smarty_parsetree {
-
-
- /**
- * Create template text buffer
- *
- * @param object $parser parser object
- * @param string $data text
- */
- public function __construct($parser, $data)
- {
- $this->parser = $parser;
- $this->data = $data;
- }
-
- /**
- * Return buffer content
- *
- * @return strint text
- */
- public function to_smarty_php()
- {
- return $this->data;
- }
-
-}
-
-/**
- * template linebreaks
- *
- * @package Smarty
- * @subpackage Compiler
- * @ignore
- */
-class _smarty_linebreak extends _smarty_parsetree {
-
- /**
- * Create buffer with linebreak content
- *
- * @param object $parser parser object
- * @param string $data linebreak string
- */
- public function __construct($parser, $data)
- {
- $this->parser = $parser;
- $this->data = $data;
- }
-
- /**
- * Return linebrak
- *
- * @return string linebreak
- */
- public function to_smarty_php()
- {
- return $this->data;
- }
-
-}
-
+<?php
+/**
+ * Smarty Internal Plugin Templateparser Parsetrees
+ *
+ * These are classes to build parsetrees in the template parser
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Thue Kristensen
+ * @author Uwe Tews
+ */
+
+/**
+ * @package Smarty
+ * @subpackage Compiler
+ * @ignore
+ */
+abstract class _smarty_parsetree {
+
+ /**
+ * Parser object
+ * @var object
+ */
+ public $parser;
+ /**
+ * Buffer content
+ * @var mixed
+ */
+ public $data;
+
+ /**
+ * Return buffer
+ *
+ * @return string buffer content
+ */
+ abstract public function to_smarty_php();
+
+}
+
+/**
+ * A complete smarty tag.
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @ignore
+ */
+class _smarty_tag extends _smarty_parsetree {
+
+ /**
+ * Saved block nesting level
+ * @var int
+ */
+ public $saved_block_nesting;
+
+ /**
+ * Create parse tree buffer for Smarty tag
+ *
+ * @param object $parser parser object
+ * @param string $data content
+ */
+ public function __construct($parser, $data)
+ {
+ $this->parser = $parser;
+ $this->data = $data;
+ $this->saved_block_nesting = $parser->block_nesting_level;
+ }
+
+ /**
+ * Return buffer content
+ *
+ * @return string content
+ */
+ public function to_smarty_php()
+ {
+ return $this->data;
+ }
+
+ /**
+ * Return complied code that loads the evaluated outout of buffer content into a temporary variable
+ *
+ * @return string template code
+ */
+ public function assign_to_var()
+ {
+ $var = sprintf('$_tmp%d', ++$this->parser->prefix_number);
+ $this->parser->compiler->prefix_code[] = sprintf('<?php ob_start();?>%s<?php %s=ob_get_clean();?>', $this->data, $var);
+ return $var;
+ }
+
+}
+
+/**
+ * Code fragment inside a tag.
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @ignore
+ */
+class _smarty_code extends _smarty_parsetree {
+
+
+ /**
+ * Create parse tree buffer for code fragment
+ *
+ * @param object $parser parser object
+ * @param string $data content
+ */
+ public function __construct($parser, $data)
+ {
+ $this->parser = $parser;
+ $this->data = $data;
+ }
+
+ /**
+ * Return buffer content in parentheses
+ *
+ * @return string content
+ */
+ public function to_smarty_php()
+ {
+ return sprintf("(%s)", $this->data);
+ }
+
+}
+
+/**
+ * Double quoted string inside a tag.
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @ignore
+ */
+class _smarty_doublequoted extends _smarty_parsetree {
+
+ /**
+ * Create parse tree buffer for double quoted string subtrees
+ *
+ * @param object $parser parser object
+ * @param _smarty_parsetree $subtree parsetree buffer
+ */
+ public function __construct($parser, _smarty_parsetree $subtree)
+ {
+ $this->parser = $parser;
+ $this->subtrees[] = $subtree;
+ if ($subtree instanceof _smarty_tag) {
+ $this->parser->block_nesting_level = count($this->parser->compiler->_tag_stack);
+ }
+ }
+
+ /**
+ * Append buffer to subtree
+ *
+ * @param _smarty_parsetree $subtree parsetree buffer
+ */
+ public function append_subtree(_smarty_parsetree $subtree)
+ {
+ $last_subtree = count($this->subtrees) - 1;
+ if ($last_subtree >= 0 && $this->subtrees[$last_subtree] instanceof _smarty_tag && $this->subtrees[$last_subtree]->saved_block_nesting < $this->parser->block_nesting_level) {
+ if ($subtree instanceof _smarty_code) {
+ $this->subtrees[$last_subtree]->data .= '<?php echo ' . $subtree->data . ';?>';
+ } elseif ($subtree instanceof _smarty_dq_content) {
+ $this->subtrees[$last_subtree]->data .= '<?php echo "' . $subtree->data . '";?>';
+ } else {
+ $this->subtrees[$last_subtree]->data .= $subtree->data;
+ }
+ } else {
+ $this->subtrees[] = $subtree;
+ }
+ if ($subtree instanceof _smarty_tag) {
+ $this->parser->block_nesting_level = count($this->parser->compiler->_tag_stack);
+ }
+ }
+
+ /**
+ * Merge subtree buffer content together
+ *
+ * @return string compiled template code
+ */
+ public function to_smarty_php()
+ {
+ $code = '';
+ foreach ($this->subtrees as $subtree) {
+ if ($code !== "") {
+ $code .= ".";
+ }
+ if ($subtree instanceof _smarty_tag) {
+ $more_php = $subtree->assign_to_var();
+ } else {
+ $more_php = $subtree->to_smarty_php();
+ }
+
+ $code .= $more_php;
+
+ if (!$subtree instanceof _smarty_dq_content) {
+ $this->parser->compiler->has_variable_string = true;
+ }
+ }
+ return $code;
+ }
+
+}
+
+/**
+ * Raw chars as part of a double quoted string.
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @ignore
+ */
+class _smarty_dq_content extends _smarty_parsetree {
+
+
+ /**
+ * Create parse tree buffer with string content
+ *
+ * @param object $parser parser object
+ * @param string $data string section
+ */
+ public function __construct($parser, $data)
+ {
+ $this->parser = $parser;
+ $this->data = $data;
+ }
+
+ /**
+ * Return content as double quoted string
+ *
+ * @return string doubled quoted string
+ */
+ public function to_smarty_php()
+ {
+ return '"' . $this->data . '"';
+ }
+
+}
+
+/**
+ * Template element
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @ignore
+ */
+class _smarty_template_buffer extends _smarty_parsetree {
+
+ /**
+ * Array of template elements
+ *
+ * @var array
+ */
+ public $subtrees = Array();
+
+ /**
+ * Create root of parse tree for template elements
+ *
+ * @param object $parser parse object
+ */
+ public function __construct($parser)
+ {
+ $this->parser = $parser;
+ }
+
+ /**
+ * Append buffer to subtree
+ *
+ * @param _smarty_parsetree $subtree
+ */
+ public function append_subtree(_smarty_parsetree $subtree)
+ {
+ $this->subtrees[] = $subtree;
+ }
+
+ /**
+ * Sanitize and merge subtree buffers together
+ *
+ * @return string template code content
+ */
+ public function to_smarty_php()
+ {
+ $code = '';
+ for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key++) {
+ if ($key + 2 < $cnt) {
+ if ($this->subtrees[$key] instanceof _smarty_linebreak && $this->subtrees[$key + 1] instanceof _smarty_tag && $this->subtrees[$key + 1]->data == '' && $this->subtrees[$key + 2] instanceof _smarty_linebreak) {
+ $key = $key + 1;
+ continue;
+ }
+ if (substr($this->subtrees[$key]->data, -1) == '<' && $this->subtrees[$key + 1]->data == '' && substr($this->subtrees[$key + 2]->data, -1) == '?') {
+ $key = $key + 2;
+ continue;
+ }
+ }
+ if (substr($code, -1) == '<') {
+ $subtree = $this->subtrees[$key]->to_smarty_php();
+ if (substr($subtree, 0, 1) == '?') {
+ $code = substr($code, 0, strlen($code) - 1) . '<<?php ?>?' . substr($subtree, 1);
+ } elseif ($this->parser->asp_tags && substr($subtree, 0, 1) == '%') {
+ $code = substr($code, 0, strlen($code) - 1) . '<<?php ?>%' . substr($subtree, 1);
+ } else {
+ $code .= $subtree;
+ }
+ continue;
+ }
+ if ($this->parser->asp_tags && substr($code, -1) == '%') {
+ $subtree = $this->subtrees[$key]->to_smarty_php();
+ if (substr($subtree, 0, 1) == '>') {
+ $code = substr($code, 0, strlen($code) - 1) . '%<?php ?>>' . substr($subtree, 1);
+ } else {
+ $code .= $subtree;
+ }
+ continue;
+ }
+ if (substr($code, -1) == '?') {
+ $subtree = $this->subtrees[$key]->to_smarty_php();
+ if (substr($subtree, 0, 1) == '>') {
+ $code = substr($code, 0, strlen($code) - 1) . '?<?php ?>>' . substr($subtree, 1);
+ } else {
+ $code .= $subtree;
+ }
+ continue;
+ }
+ $code .= $this->subtrees[$key]->to_smarty_php();
+ }
+ return $code;
+ }
+
+}
+
+/**
+ * template text
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @ignore
+ */
+class _smarty_text extends _smarty_parsetree {
+
+
+ /**
+ * Create template text buffer
+ *
+ * @param object $parser parser object
+ * @param string $data text
+ */
+ public function __construct($parser, $data)
+ {
+ $this->parser = $parser;
+ $this->data = $data;
+ }
+
+ /**
+ * Return buffer content
+ *
+ * @return strint text
+ */
+ public function to_smarty_php()
+ {
+ return $this->data;
+ }
+
+}
+
+/**
+ * template linebreaks
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @ignore
+ */
+class _smarty_linebreak extends _smarty_parsetree {
+
+ /**
+ * Create buffer with linebreak content
+ *
+ * @param object $parser parser object
+ * @param string $data linebreak string
+ */
+ public function __construct($parser, $data)
+ {
+ $this->parser = $parser;
+ $this->data = $data;
+ }
+
+ /**
+ * Return linebrak
+ *
+ * @return string linebreak
+ */
+ public function to_smarty_php()
+ {
+ return $this->data;
+ }
+
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/sysplugins/smarty_internal_resource_eval.php b/include/smarty/libs/sysplugins/smarty_internal_resource_eval.php
index cf2ec3e1c..c025dc26d 100644
--- a/include/smarty/libs/sysplugins/smarty_internal_resource_eval.php
+++ b/include/smarty/libs/sysplugins/smarty_internal_resource_eval.php
@@ -1,94 +1,94 @@
-<?php
-/**
- * Smarty Internal Plugin Resource Eval
- *
- * @package Smarty
- * @subpackage TemplateResources
- * @author Uwe Tews
- * @author Rodney Rehm
- */
-
-/**
- * Smarty Internal Plugin Resource Eval
- *
- * Implements the strings as resource for Smarty template
- *
- * {@internal unlike string-resources the compiled state of eval-resources is NOT saved for subsequent access}}
- *
- * @package Smarty
- * @subpackage TemplateResources
- */
-class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled {
-
- /**
- * populate Source Object with meta data from Resource
- *
- * @param Smarty_Template_Source $source source object
- * @param Smarty_Internal_Template $_template template object
- * @return void
- */
- public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
- {
- $source->uid = $source->filepath = sha1($source->name);
- $source->timestamp = false;
- $source->exists = true;
- }
-
- /**
- * Load template's source from $resource_name into current template object
- *
- * @uses decode() to decode base64 and urlencoded template_resources
- * @param Smarty_Template_Source $source source object
- * @return string template source
- */
- public function getContent(Smarty_Template_Source $source)
- {
- return $this->decode($source->name);
- }
-
- /**
- * decode base64 and urlencode
- *
- * @param string $string template_resource to decode
- * @return string decoded template_resource
- */
- protected function decode($string)
- {
- // decode if specified
- if (($pos = strpos($string, ':')) !== false) {
- if (!strncmp($string, 'base64', 6)) {
- return base64_decode(substr($string, 7));
- } elseif (!strncmp($string, 'urlencode', 9)) {
- return urldecode(substr($string, 10));
- }
- }
-
- return $string;
- }
-
- /**
- * modify resource_name according to resource handlers specifications
- *
- * @param Smarty $smarty Smarty instance
- * @param string $resource_name resource_name to make unique
- * @return string unique resource name
- */
- protected function buildUniqueResourceName(Smarty $smarty, $resource_name)
- {
- return get_class($this) . '#' .$this->decode($resource_name);
- }
-
- /**
- * Determine basename for compiled filename
- *
- * @param Smarty_Template_Source $source source object
- * @return string resource's basename
- */
- protected function getBasename(Smarty_Template_Source $source)
- {
- return '';
- }
-
-}
-
+<?php
+/**
+ * Smarty Internal Plugin Resource Eval
+ *
+ * @package Smarty
+ * @subpackage TemplateResources
+ * @author Uwe Tews
+ * @author Rodney Rehm
+ */
+
+/**
+ * Smarty Internal Plugin Resource Eval
+ *
+ * Implements the strings as resource for Smarty template
+ *
+ * {@internal unlike string-resources the compiled state of eval-resources is NOT saved for subsequent access}}
+ *
+ * @package Smarty
+ * @subpackage TemplateResources
+ */
+class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled {
+
+ /**
+ * populate Source Object with meta data from Resource
+ *
+ * @param Smarty_Template_Source $source source object
+ * @param Smarty_Internal_Template $_template template object
+ * @return void
+ */
+ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
+ {
+ $source->uid = $source->filepath = sha1($source->name);
+ $source->timestamp = false;
+ $source->exists = true;
+ }
+
+ /**
+ * Load template's source from $resource_name into current template object
+ *
+ * @uses decode() to decode base64 and urlencoded template_resources
+ * @param Smarty_Template_Source $source source object
+ * @return string template source
+ */
+ public function getContent(Smarty_Template_Source $source)
+ {
+ return $this->decode($source->name);
+ }
+
+ /**
+ * decode base64 and urlencode
+ *
+ * @param string $string template_resource to decode
+ * @return string decoded template_resource
+ */
+ protected function decode($string)
+ {
+ // decode if specified
+ if (($pos = strpos($string, ':')) !== false) {
+ if (!strncmp($string, 'base64', 6)) {
+ return base64_decode(substr($string, 7));
+ } elseif (!strncmp($string, 'urlencode', 9)) {
+ return urldecode(substr($string, 10));
+ }
+ }
+
+ return $string;
+ }
+
+ /**
+ * modify resource_name according to resource handlers specifications
+ *
+ * @param Smarty $smarty Smarty instance
+ * @param string $resource_name resource_name to make unique
+ * @return string unique resource name
+ */
+ protected function buildUniqueResourceName(Smarty $smarty, $resource_name)
+ {
+ return get_class($this) . '#' .$this->decode($resource_name);
+ }
+
+ /**
+ * Determine basename for compiled filename
+ *
+ * @param Smarty_Template_Source $source source object
+ * @return string resource's basename
+ */
+ protected function getBasename(Smarty_Template_Source $source)
+ {
+ return '';
+ }
+
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/sysplugins/smarty_internal_templatebase.php b/include/smarty/libs/sysplugins/smarty_internal_templatebase.php
index abd48b799..1cb9bb949 100644
--- a/include/smarty/libs/sysplugins/smarty_internal_templatebase.php
+++ b/include/smarty/libs/sysplugins/smarty_internal_templatebase.php
@@ -1,811 +1,811 @@
-<?php
-/**
- * Smarty Internal Plugin Smarty Template Base
- *
- * This file contains the basic shared methodes for template handling
- *
- * @package Smarty
- * @subpackage Template
- * @author Uwe Tews
- */
-
-/**
- * Class with shared template methodes
- *
- * @package Smarty
- * @subpackage Template
- */
-abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
-
- /**
- * fetches a rendered Smarty template
- *
- * @param string $template the resource handle of the template file or template object
- * @param mixed $cache_id cache id to be used with this template
- * @param mixed $compile_id compile id to be used with this template
- * @param object $parent next higher level of Smarty variables
- * @param bool $display true: display, false: fetch
- * @param bool $merge_tpl_vars if true parent template variables merged in to local scope
- * @param bool $no_output_filter if true do not run output filter
- * @return string rendered template output
- */
- public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
- {
- if ($template === null && $this instanceof $this->template_class) {
- $template = $this;
- }
- if (!empty($cache_id) && is_object($cache_id)) {
- $parent = $cache_id;
- $cache_id = null;
- }
- if ($parent === null && ($this instanceof Smarty || is_string($template))) {
- $parent = $this;
- }
- // create template object if necessary
- $_template = ($template instanceof $this->template_class)
- ? $template
- : $this->smarty->createTemplate($template, $cache_id, $compile_id, $parent, false);
- // if called by Smarty object make sure we use current caching status
- if ($this instanceof Smarty) {
- $_template->caching = $this->caching;
- }
- // merge all variable scopes into template
- if ($merge_tpl_vars) {
- // save local variables
- $save_tpl_vars = $_template->tpl_vars;
- $save_config_vars = $_template->config_vars;
- $ptr_array = array($_template);
- $ptr = $_template;
- while (isset($ptr->parent)) {
- $ptr_array[] = $ptr = $ptr->parent;
- }
- $ptr_array = array_reverse($ptr_array);
- $parent_ptr = reset($ptr_array);
- $tpl_vars = $parent_ptr->tpl_vars;
- $config_vars = $parent_ptr->config_vars;
- while ($parent_ptr = next($ptr_array)) {
- if (!empty($parent_ptr->tpl_vars)) {
- $tpl_vars = array_merge($tpl_vars, $parent_ptr->tpl_vars);
- }
- if (!empty($parent_ptr->config_vars)) {
- $config_vars = array_merge($config_vars, $parent_ptr->config_vars);
- }
- }
- if (!empty(Smarty::$global_tpl_vars)) {
- $tpl_vars = array_merge(Smarty::$global_tpl_vars, $tpl_vars);
- }
- $_template->tpl_vars = $tpl_vars;
- $_template->config_vars = $config_vars;
- }
- // dummy local smarty variable
- if (!isset($_template->tpl_vars['smarty'])) {
- $_template->tpl_vars['smarty'] = new Smarty_Variable;
- }
- if (isset($this->smarty->error_reporting)) {
- $_smarty_old_error_level = error_reporting($this->smarty->error_reporting);
- }
- // check URL debugging control
- if (!$this->smarty->debugging && $this->smarty->debugging_ctrl == 'URL') {
- if (isset($_SERVER['QUERY_STRING'])) {
- $_query_string = $_SERVER['QUERY_STRING'];
- } else {
- $_query_string = '';
- }
- if (false !== strpos($_query_string, $this->smarty->smarty_debug_id)) {
- if (false !== strpos($_query_string, $this->smarty->smarty_debug_id . '=on')) {
- // enable debugging for this browser session
- setcookie('SMARTY_DEBUG', true);
- $this->smarty->debugging = true;
- } elseif (false !== strpos($_query_string, $this->smarty->smarty_debug_id . '=off')) {
- // disable debugging for this browser session
- setcookie('SMARTY_DEBUG', false);
- $this->smarty->debugging = false;
- } else {
- // enable debugging for this page
- $this->smarty->debugging = true;
- }
- } else {
- if (isset($_COOKIE['SMARTY_DEBUG'])) {
- $this->smarty->debugging = true;
- }
- }
- }
- // must reset merge template date
- $_template->smarty->merged_templates_func = array();
- // get rendered template
- // disable caching for evaluated code
- if ($_template->source->recompiled) {
- $_template->caching = false;
- }
- // checks if template exists
- if (!$_template->source->exists) {
- if ($_template->parent instanceof Smarty_Internal_Template) {
- $parent_resource = " in '{$_template->parent->template_resource}'";
- } else {
- $parent_resource = '';
- }
- throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}");
- }
- // read from cache or render
- if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT || $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || !$_template->cached->valid) {
- // render template (not loaded and not in cache)
- if (!$_template->source->uncompiled) {
- $_smarty_tpl = $_template;
- if ($_template->source->recompiled) {
- if ($this->smarty->debugging) {
- Smarty_Internal_Debug::start_compile($_template);
- }
- $code = $_template->compiler->compileTemplate($_template);
- if ($this->smarty->debugging) {
- Smarty_Internal_Debug::end_compile($_template);
- }
- if ($this->smarty->debugging) {
- Smarty_Internal_Debug::start_render($_template);
- }
- try {
- ob_start();
- eval("?>" . $code);
- unset($code);
- } catch (Exception $e) {
- ob_get_clean();
- throw $e;
- }
- } else {
- if (!$_template->compiled->exists || ($_template->smarty->force_compile && !$_template->compiled->isCompiled)) {
- $_template->compileTemplateSource();
- }
- if ($this->smarty->debugging) {
- Smarty_Internal_Debug::start_render($_template);
- }
- if (!$_template->compiled->loaded) {
- include($_template->compiled->filepath);
- if ($_template->mustCompile) {
- // recompile and load again
- $_template->compileTemplateSource();
- include($_template->compiled->filepath);
- }
- $_template->compiled->loaded = true;
- } else {
- $_template->decodeProperties($_template->compiled->_properties, false);
- }
- try {
- ob_start();
- if (empty($_template->properties['unifunc']) || !is_callable($_template->properties['unifunc'])) {
- throw new SmartyException("Invalid compiled template for '{$_template->template_resource}'");
- }
- array_unshift($_template->_capture_stack,array());
- //
- // render compiled template
- //
- $_template->properties['unifunc']($_template);
- // any unclosed {capture} tags ?
- if (isset($_template->_capture_stack[0][0])) {
- $_template->capture_error();
- }
- array_shift($_template->_capture_stack);
- } catch (Exception $e) {
- ob_get_clean();
- throw $e;
- }
- }
- } else {
- if ($_template->source->uncompiled) {
- if ($this->smarty->debugging) {
- Smarty_Internal_Debug::start_render($_template);
- }
- try {
- ob_start();
- $_template->source->renderUncompiled($_template);
- } catch (Exception $e) {
- ob_get_clean();
- throw $e;
- }
- } else {
- throw new SmartyException("Resource '$_template->source->type' must have 'renderUncompiled' method");
- }
- }
- $_output = ob_get_clean();
- if (!$_template->source->recompiled && empty($_template->properties['file_dependency'][$_template->source->uid])) {
- $_template->properties['file_dependency'][$_template->source->uid] = array($_template->source->filepath, $_template->source->timestamp, $_template->source->type);
- }
- if ($_template->parent instanceof Smarty_Internal_Template) {
- $_template->parent->properties['file_dependency'] = array_merge($_template->parent->properties['file_dependency'], $_template->properties['file_dependency']);
- foreach ($_template->required_plugins as $code => $tmp1) {
- foreach ($tmp1 as $name => $tmp) {
- foreach ($tmp as $type => $data) {
- $_template->parent->required_plugins[$code][$name][$type] = $data;
- }
- }
- }
- }
- if ($this->smarty->debugging) {
- Smarty_Internal_Debug::end_render($_template);
- }
- // write to cache when nessecary
- if (!$_template->source->recompiled && ($_template->caching == Smarty::CACHING_LIFETIME_SAVED || $_template->caching == Smarty::CACHING_LIFETIME_CURRENT)) {
- if ($this->smarty->debugging) {
- Smarty_Internal_Debug::start_cache($_template);
- }
- $_template->properties['has_nocache_code'] = false;
- // get text between non-cached items
- $cache_split = preg_split("!/\*%%SmartyNocache:{$_template->properties['nocache_hash']}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->properties['nocache_hash']}%%\*/!s", $_output);
- // get non-cached items
- preg_match_all("!/\*%%SmartyNocache:{$_template->properties['nocache_hash']}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->properties['nocache_hash']}%%\*/!s", $_output, $cache_parts);
- $output = '';
- // loop over items, stitch back together
- foreach ($cache_split as $curr_idx => $curr_split) {
- // escape PHP tags in template content
- $output .= preg_replace('/(<%|%>|<\?php|<\?|\?>)/', '<?php echo \'$1\'; ?>', $curr_split);
- if (isset($cache_parts[0][$curr_idx])) {
- $_template->properties['has_nocache_code'] = true;
- // remove nocache tags from cache output
- $output .= preg_replace("!/\*/?%%SmartyNocache:{$_template->properties['nocache_hash']}%%\*/!", '', $cache_parts[0][$curr_idx]);
- }
- }
- if (!$no_output_filter && !$_template->has_nocache_code && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) {
- $output = Smarty_Internal_Filter_Handler::runFilter('output', $output, $_template);
- }
- // rendering (must be done before writing cache file because of {function} nocache handling)
- $_smarty_tpl = $_template;
- try {
- ob_start();
- eval("?>" . $output);
- $_output = ob_get_clean();
- } catch (Exception $e) {
- ob_get_clean();
- throw $e;
- }
- // write cache file content
- $_template->writeCachedContent($output);
- if ($this->smarty->debugging) {
- Smarty_Internal_Debug::end_cache($_template);
- }
- } else {
- // var_dump('renderTemplate', $_template->has_nocache_code, $_template->template_resource, $_template->properties['nocache_hash'], $_template->parent->properties['nocache_hash'], $_output);
- if (!empty($_template->properties['nocache_hash']) && !empty($_template->parent->properties['nocache_hash'])) {
- // replace nocache_hash
- $_output = str_replace("{$_template->properties['nocache_hash']}", $_template->parent->properties['nocache_hash'], $_output);
- $_template->parent->has_nocache_code = $_template->parent->has_nocache_code || $_template->has_nocache_code;
- }
- }
- } else {
- if ($this->smarty->debugging) {
- Smarty_Internal_Debug::start_cache($_template);
- }
- try {
- ob_start();
- array_unshift($_template->_capture_stack,array());
- //
- // render cached template
- //
- $_template->properties['unifunc']($_template);
- // any unclosed {capture} tags ?
- if (isset($_template->_capture_stack[0][0])) {
- $_template->capture_error();
- }
- array_shift($_template->_capture_stack);
- $_output = ob_get_clean();
- } catch (Exception $e) {
- ob_get_clean();
- throw $e;
- }
- if ($this->smarty->debugging) {
- Smarty_Internal_Debug::end_cache($_template);
- }
- }
- if ((!$this->caching || $_template->has_nocache_code || $_template->source->recompiled) && !$no_output_filter && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) {
- $_output = Smarty_Internal_Filter_Handler::runFilter('output', $_output, $_template);
- }
- if (isset($this->error_reporting)) {
- error_reporting($_smarty_old_error_level);
- }
- // display or fetch
- if ($display) {
- if ($this->caching && $this->cache_modified_check) {
- $_isCached = $_template->isCached() && !$_template->has_nocache_code;
- $_last_modified_date = @substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);
- if ($_isCached && $_template->cached->timestamp <= strtotime($_last_modified_date)) {
- switch (PHP_SAPI) {
- case 'cgi': // php-cgi < 5.3
- case 'cgi-fcgi': // php-cgi >= 5.3
- case 'fpm-fcgi': // php-fpm >= 5.3.3
- header('Status: 304 Not Modified');
- break;
-
- case 'cli':
- if (/* ^phpunit */!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])/* phpunit$ */) {
- $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = '304 Not Modified';
- }
- break;
-
- default:
- header($_SERVER['SERVER_PROTOCOL'].' 304 Not Modified');
- break;
- }
- } else {
- switch (PHP_SAPI) {
- case 'cli':
- if (/* ^phpunit */!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])/* phpunit$ */) {
- $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT';
- }
- break;
-
- default:
- header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT');
- break;
- }
- echo $_output;
- }
- } else {
- echo $_output;
- }
- // debug output
- if ($this->smarty->debugging) {
- Smarty_Internal_Debug::display_debug($this);
- }
- if ($merge_tpl_vars) {
- // restore local variables
- $_template->tpl_vars = $save_tpl_vars;
- $_template->config_vars = $save_config_vars;
- }
- return;
- } else {
- if ($merge_tpl_vars) {
- // restore local variables
- $_template->tpl_vars = $save_tpl_vars;
- $_template->config_vars = $save_config_vars;
- }
- // return fetched content
- return $_output;
- }
- }
-
- /**
- * displays a Smarty template
- *
- * @param string $template the resource handle of the template file or template object
- * @param mixed $cache_id cache id to be used with this template
- * @param mixed $compile_id compile id to be used with this template
- * @param object $parent next higher level of Smarty variables
- */
- public function display($template = null, $cache_id = null, $compile_id = null, $parent = null)
- {
- // display template
- $this->fetch($template, $cache_id, $compile_id, $parent, true);
- }
-
- /**
- * test if cache is valid
- *
- * @param string|object $template the resource handle of the template file or template object
- * @param mixed $cache_id cache id to be used with this template
- * @param mixed $compile_id compile id to be used with this template
- * @param object $parent next higher level of Smarty variables
- * @return boolean cache status
- */
- public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null)
- {
- if ($template === null && $this instanceof $this->template_class) {
- return $this->cached->valid;
- }
- if (!($template instanceof $this->template_class)) {
- if ($parent === null) {
- $parent = $this;
- }
- $template = $this->smarty->createTemplate($template, $cache_id, $compile_id, $parent, false);
- }
- // return cache status of template
- return $template->cached->valid;
- }
-
- /**
- * creates a data object
- *
- * @param object $parent next higher level of Smarty variables
- * @returns Smarty_Data data object
- */
- public function createData($parent = null)
- {
- return new Smarty_Data($parent, $this);
- }
-
- /**
- * Registers plugin to be used in templates
- *
- * @param string $type plugin type
- * @param string $tag name of template tag
- * @param callback $callback PHP callback to register
- * @param boolean $cacheable if true (default) this fuction is cachable
- * @param array $cache_attr caching attributes if any
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
- * @throws SmartyException when the plugin tag is invalid
- */
- public function registerPlugin($type, $tag, $callback, $cacheable = true, $cache_attr = null)
- {
- if (isset($this->smarty->registered_plugins[$type][$tag])) {
- throw new SmartyException("Plugin tag \"{$tag}\" already registered");
- } elseif (!is_callable($callback)) {
- throw new SmartyException("Plugin \"{$tag}\" not callable");
- } else {
- $this->smarty->registered_plugins[$type][$tag] = array($callback, (bool) $cacheable, (array) $cache_attr);
- }
-
- return $this;
- }
-
- /**
- * Unregister Plugin
- *
- * @param string $type of plugin
- * @param string $tag name of plugin
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
- */
- public function unregisterPlugin($type, $tag)
- {
- if (isset($this->smarty->registered_plugins[$type][$tag])) {
- unset($this->smarty->registered_plugins[$type][$tag]);
- }
-
- return $this;
- }
-
- /**
- * Registers a resource to fetch a template
- *
- * @param string $type name of resource type
- * @param Smarty_Resource|array $callback or instance of Smarty_Resource, or array of callbacks to handle resource (deprecated)
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
- */
- public function registerResource($type, $callback)
- {
- $this->smarty->registered_resources[$type] = $callback instanceof Smarty_Resource ? $callback : array($callback, false);
- return $this;
- }
-
- /**
- * Unregisters a resource
- *
- * @param string $type name of resource type
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
- */
- public function unregisterResource($type)
- {
- if (isset($this->smarty->registered_resources[$type])) {
- unset($this->smarty->registered_resources[$type]);
- }
-
- return $this;
- }
-
- /**
- * Registers a cache resource to cache a template's output
- *
- * @param string $type name of cache resource type
- * @param Smarty_CacheResource $callback instance of Smarty_CacheResource to handle output caching
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
- */
- public function registerCacheResource($type, Smarty_CacheResource $callback)
- {
- $this->smarty->registered_cache_resources[$type] = $callback;
- return $this;
- }
-
- /**
- * Unregisters a cache resource
- *
- * @param string $type name of cache resource type
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
- */
- public function unregisterCacheResource($type)
- {
- if (isset($this->smarty->registered_cache_resources[$type])) {
- unset($this->smarty->registered_cache_resources[$type]);
- }
-
- return $this;
- }
-
- /**
- * Registers object to be used in templates
- *
- * @param string $object name of template object
- * @param object $object_impl the referenced PHP object to register
- * @param array $allowed list of allowed methods (empty = all)
- * @param boolean $smarty_args smarty argument format, else traditional
- * @param array $block_methods list of block-methods
- * @param array $block_functs list of methods that are block format
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
- * @throws SmartyException if any of the methods in $allowed or $block_methods are invalid
- */
- public function registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
- {
- // test if allowed methodes callable
- if (!empty($allowed)) {
- foreach ((array) $allowed as $method) {
- if (!is_callable(array($object_impl, $method))) {
- throw new SmartyException("Undefined method '$method' in registered object");
- }
- }
- }
- // test if block methodes callable
- if (!empty($block_methods)) {
- foreach ((array) $block_methods as $method) {
- if (!is_callable(array($object_impl, $method))) {
- throw new SmartyException("Undefined method '$method' in registered object");
- }
- }
- }
- // register the object
- $this->smarty->registered_objects[$object_name] =
- array($object_impl, (array) $allowed, (boolean) $smarty_args, (array) $block_methods);
- return $this;
- }
-
- /**
- * return a reference to a registered object
- *
- * @param string $name object name
- * @return object
- * @throws SmartyException if no such object is found
- */
- public function getRegisteredObject($name)
- {
- if (!isset($this->smarty->registered_objects[$name])) {
- throw new SmartyException("'$name' is not a registered object");
- }
- if (!is_object($this->smarty->registered_objects[$name][0])) {
- throw new SmartyException("registered '$name' is not an object");
- }
- return $this->smarty->registered_objects[$name][0];
- }
-
- /**
- * unregister an object
- *
- * @param string $name object name
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
- */
- public function unregisterObject($name)
- {
- if (isset($this->smarty->registered_objects[$name])) {
- unset($this->smarty->registered_objects[$name]);
- }
-
- return $this;
- }
-
- /**
- * Registers static classes to be used in templates
- *
- * @param string $class name of template class
- * @param string $class_impl the referenced PHP class to register
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
- * @throws SmartyException if $class_impl does not refer to an existing class
- */
- public function registerClass($class_name, $class_impl)
- {
- // test if exists
- if (!class_exists($class_impl)) {
- throw new SmartyException("Undefined class '$class_impl' in register template class");
- }
- // register the class
- $this->smarty->registered_classes[$class_name] = $class_impl;
- return $this;
- }
-
- /**
- * Registers a default plugin handler
- *
- * @param callable $callback class/method name
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
- * @throws SmartyException if $callback is not callable
- */
- public function registerDefaultPluginHandler($callback)
- {
- if (is_callable($callback)) {
- $this->smarty->default_plugin_handler_func = $callback;
- } else {
- throw new SmartyException("Default plugin handler '$callback' not callable");
- }
-
- return $this;
- }
-
- /**
- * Registers a default template handler
- *
- * @param callable $callback class/method name
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
- * @throws SmartyException if $callback is not callable
- */
- public function registerDefaultTemplateHandler($callback)
- {
- if (is_callable($callback)) {
- $this->smarty->default_template_handler_func = $callback;
- } else {
- throw new SmartyException("Default template handler '$callback' not callable");
- }
-
- return $this;
- }
-
- /**
- * Registers a default template handler
- *
- * @param callable $callback class/method name
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
- * @throws SmartyException if $callback is not callable
- */
- public function registerDefaultConfigHandler($callback)
- {
- if (is_callable($callback)) {
- $this->smarty->default_config_handler_func = $callback;
- } else {
- throw new SmartyException("Default config handler '$callback' not callable");
- }
-
- return $this;
- }
-
- /**
- * Registers a filter function
- *
- * @param string $type filter type
- * @param callback $callback
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
- */
- public function registerFilter($type, $callback)
- {
- $this->smarty->registered_filters[$type][$this->_get_filter_name($callback)] = $callback;
- return $this;
- }
-
- /**
- * Unregisters a filter function
- *
- * @param string $type filter type
- * @param callback $callback
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
- */
- public function unregisterFilter($type, $callback)
- {
- $name = $this->_get_filter_name($callback);
- if (isset($this->smarty->registered_filters[$type][$name])) {
- unset($this->smarty->registered_filters[$type][$name]);
- }
-
- return $this;
- }
-
- /**
- * Return internal filter name
- *
- * @param callback $function_name
- * @return string internal filter name
- */
- public function _get_filter_name($function_name)
- {
- if (is_array($function_name)) {
- $_class_name = (is_object($function_name[0]) ?
- get_class($function_name[0]) : $function_name[0]);
- return $_class_name . '_' . $function_name[1];
- } else {
- return $function_name;
- }
- }
-
- /**
- * load a filter of specified type and name
- *
- * @param string $type filter type
- * @param string $name filter name
- * @throws SmartyException if filter could not be loaded
- */
- public function loadFilter($type, $name)
- {
- $_plugin = "smarty_{$type}filter_{$name}";
- $_filter_name = $_plugin;
- if ($this->smarty->loadPlugin($_plugin)) {
- if (class_exists($_plugin, false)) {
- $_plugin = array($_plugin, 'execute');
- }
- if (is_callable($_plugin)) {
- $this->smarty->registered_filters[$type][$_filter_name] = $_plugin;
- return true;
- }
- }
- throw new SmartyException("{$type}filter \"{$name}\" not callable");
- }
-
- /**
- * unload a filter of specified type and name
- *
- * @param string $type filter type
- * @param string $name filter name
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
- */
- public function unloadFilter($type, $name)
- {
- $_filter_name = "smarty_{$type}filter_{$name}";
- if (isset($this->smarty->registered_filters[$type][$_filter_name])) {
- unset ($this->smarty->registered_filters[$type][$_filter_name]);
- }
-
- return $this;
- }
-
- /**
- * preg_replace callback to convert camelcase getter/setter to underscore property names
- *
- * @param string $match match string
- * @return string replacemant
- */
- private function replaceCamelcase($match) {
- return "_" . strtolower($match[1]);
- }
-
- /**
- * Handle unknown class methods
- *
- * @param string $name unknown method-name
- * @param array $args argument array
- */
- public function __call($name, $args)
- {
- static $_prefixes = array('set' => true, 'get' => true);
- static $_resolved_property_name = array();
- static $_resolved_property_source = array();
-
- // method of Smarty object?
- if (method_exists($this->smarty, $name)) {
- return call_user_func_array(array($this->smarty, $name), $args);
- }
- // see if this is a set/get for a property
- $first3 = strtolower(substr($name, 0, 3));
- if (isset($_prefixes[$first3]) && isset($name[3]) && $name[3] !== '_') {
- if (isset($_resolved_property_name[$name])) {
- $property_name = $_resolved_property_name[$name];
- } else {
- // try to keep case correct for future PHP 6.0 case-sensitive class methods
- // lcfirst() not available < PHP 5.3.0, so improvise
- $property_name = strtolower(substr($name, 3, 1)) . substr($name, 4);
- // convert camel case to underscored name
- $property_name = preg_replace_callback('/([A-Z])/', array($this,'replaceCamelcase'), $property_name);
- $_resolved_property_name[$name] = $property_name;
- }
- if (isset($_resolved_property_source[$property_name])) {
- $_is_this = $_resolved_property_source[$property_name];
- } else {
- $_is_this = null;
- if (property_exists($this, $property_name)) {
- $_is_this = true;
- } else if (property_exists($this->smarty, $property_name)) {
- $_is_this = false;
- }
- $_resolved_property_source[$property_name] = $_is_this;
- }
- if ($_is_this) {
- if ($first3 == 'get')
- return $this->$property_name;
- else
- return $this->$property_name = $args[0];
- } else if ($_is_this === false) {
- if ($first3 == 'get')
- return $this->smarty->$property_name;
- else
- return $this->smarty->$property_name = $args[0];
- } else {
- throw new SmartyException("property '$property_name' does not exist.");
- return false;
- }
- }
- if ($name == 'Smarty') {
- throw new SmartyException("PHP5 requires you to call __construct() instead of Smarty()");
- }
- // must be unknown
- throw new SmartyException("Call of unknown method '$name'.");
- }
-
-}
-
+<?php
+/**
+ * Smarty Internal Plugin Smarty Template Base
+ *
+ * This file contains the basic shared methodes for template handling
+ *
+ * @package Smarty
+ * @subpackage Template
+ * @author Uwe Tews
+ */
+
+/**
+ * Class with shared template methodes
+ *
+ * @package Smarty
+ * @subpackage Template
+ */
+abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
+
+ /**
+ * fetches a rendered Smarty template
+ *
+ * @param string $template the resource handle of the template file or template object
+ * @param mixed $cache_id cache id to be used with this template
+ * @param mixed $compile_id compile id to be used with this template
+ * @param object $parent next higher level of Smarty variables
+ * @param bool $display true: display, false: fetch
+ * @param bool $merge_tpl_vars if true parent template variables merged in to local scope
+ * @param bool $no_output_filter if true do not run output filter
+ * @return string rendered template output
+ */
+ public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
+ {
+ if ($template === null && $this instanceof $this->template_class) {
+ $template = $this;
+ }
+ if (!empty($cache_id) && is_object($cache_id)) {
+ $parent = $cache_id;
+ $cache_id = null;
+ }
+ if ($parent === null && ($this instanceof Smarty || is_string($template))) {
+ $parent = $this;
+ }
+ // create template object if necessary
+ $_template = ($template instanceof $this->template_class)
+ ? $template
+ : $this->smarty->createTemplate($template, $cache_id, $compile_id, $parent, false);
+ // if called by Smarty object make sure we use current caching status
+ if ($this instanceof Smarty) {
+ $_template->caching = $this->caching;
+ }
+ // merge all variable scopes into template
+ if ($merge_tpl_vars) {
+ // save local variables
+ $save_tpl_vars = $_template->tpl_vars;
+ $save_config_vars = $_template->config_vars;
+ $ptr_array = array($_template);
+ $ptr = $_template;
+ while (isset($ptr->parent)) {
+ $ptr_array[] = $ptr = $ptr->parent;
+ }
+ $ptr_array = array_reverse($ptr_array);
+ $parent_ptr = reset($ptr_array);
+ $tpl_vars = $parent_ptr->tpl_vars;
+ $config_vars = $parent_ptr->config_vars;
+ while ($parent_ptr = next($ptr_array)) {
+ if (!empty($parent_ptr->tpl_vars)) {
+ $tpl_vars = array_merge($tpl_vars, $parent_ptr->tpl_vars);
+ }
+ if (!empty($parent_ptr->config_vars)) {
+ $config_vars = array_merge($config_vars, $parent_ptr->config_vars);
+ }
+ }
+ if (!empty(Smarty::$global_tpl_vars)) {
+ $tpl_vars = array_merge(Smarty::$global_tpl_vars, $tpl_vars);
+ }
+ $_template->tpl_vars = $tpl_vars;
+ $_template->config_vars = $config_vars;
+ }
+ // dummy local smarty variable
+ if (!isset($_template->tpl_vars['smarty'])) {
+ $_template->tpl_vars['smarty'] = new Smarty_Variable;
+ }
+ if (isset($this->smarty->error_reporting)) {
+ $_smarty_old_error_level = error_reporting($this->smarty->error_reporting);
+ }
+ // check URL debugging control
+ if (!$this->smarty->debugging && $this->smarty->debugging_ctrl == 'URL') {
+ if (isset($_SERVER['QUERY_STRING'])) {
+ $_query_string = $_SERVER['QUERY_STRING'];
+ } else {
+ $_query_string = '';
+ }
+ if (false !== strpos($_query_string, $this->smarty->smarty_debug_id)) {
+ if (false !== strpos($_query_string, $this->smarty->smarty_debug_id . '=on')) {
+ // enable debugging for this browser session
+ setcookie('SMARTY_DEBUG', true);
+ $this->smarty->debugging = true;
+ } elseif (false !== strpos($_query_string, $this->smarty->smarty_debug_id . '=off')) {
+ // disable debugging for this browser session
+ setcookie('SMARTY_DEBUG', false);
+ $this->smarty->debugging = false;
+ } else {
+ // enable debugging for this page
+ $this->smarty->debugging = true;
+ }
+ } else {
+ if (isset($_COOKIE['SMARTY_DEBUG'])) {
+ $this->smarty->debugging = true;
+ }
+ }
+ }
+ // must reset merge template date
+ $_template->smarty->merged_templates_func = array();
+ // get rendered template
+ // disable caching for evaluated code
+ if ($_template->source->recompiled) {
+ $_template->caching = false;
+ }
+ // checks if template exists
+ if (!$_template->source->exists) {
+ if ($_template->parent instanceof Smarty_Internal_Template) {
+ $parent_resource = " in '{$_template->parent->template_resource}'";
+ } else {
+ $parent_resource = '';
+ }
+ throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}");
+ }
+ // read from cache or render
+ if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT || $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || !$_template->cached->valid) {
+ // render template (not loaded and not in cache)
+ if (!$_template->source->uncompiled) {
+ $_smarty_tpl = $_template;
+ if ($_template->source->recompiled) {
+ if ($this->smarty->debugging) {
+ Smarty_Internal_Debug::start_compile($_template);
+ }
+ $code = $_template->compiler->compileTemplate($_template);
+ if ($this->smarty->debugging) {
+ Smarty_Internal_Debug::end_compile($_template);
+ }
+ if ($this->smarty->debugging) {
+ Smarty_Internal_Debug::start_render($_template);
+ }
+ try {
+ ob_start();
+ eval("?>" . $code);
+ unset($code);
+ } catch (Exception $e) {
+ ob_get_clean();
+ throw $e;
+ }
+ } else {
+ if (!$_template->compiled->exists || ($_template->smarty->force_compile && !$_template->compiled->isCompiled)) {
+ $_template->compileTemplateSource();
+ }
+ if ($this->smarty->debugging) {
+ Smarty_Internal_Debug::start_render($_template);
+ }
+ if (!$_template->compiled->loaded) {
+ include($_template->compiled->filepath);
+ if ($_template->mustCompile) {
+ // recompile and load again
+ $_template->compileTemplateSource();
+ include($_template->compiled->filepath);
+ }
+ $_template->compiled->loaded = true;
+ } else {
+ $_template->decodeProperties($_template->compiled->_properties, false);
+ }
+ try {
+ ob_start();
+ if (empty($_template->properties['unifunc']) || !is_callable($_template->properties['unifunc'])) {
+ throw new SmartyException("Invalid compiled template for '{$_template->template_resource}'");
+ }
+ array_unshift($_template->_capture_stack,array());
+ //
+ // render compiled template
+ //
+ $_template->properties['unifunc']($_template);
+ // any unclosed {capture} tags ?
+ if (isset($_template->_capture_stack[0][0])) {
+ $_template->capture_error();
+ }
+ array_shift($_template->_capture_stack);
+ } catch (Exception $e) {
+ ob_get_clean();
+ throw $e;
+ }
+ }
+ } else {
+ if ($_template->source->uncompiled) {
+ if ($this->smarty->debugging) {
+ Smarty_Internal_Debug::start_render($_template);
+ }
+ try {
+ ob_start();
+ $_template->source->renderUncompiled($_template);
+ } catch (Exception $e) {
+ ob_get_clean();
+ throw $e;
+ }
+ } else {
+ throw new SmartyException("Resource '$_template->source->type' must have 'renderUncompiled' method");
+ }
+ }
+ $_output = ob_get_clean();
+ if (!$_template->source->recompiled && empty($_template->properties['file_dependency'][$_template->source->uid])) {
+ $_template->properties['file_dependency'][$_template->source->uid] = array($_template->source->filepath, $_template->source->timestamp, $_template->source->type);
+ }
+ if ($_template->parent instanceof Smarty_Internal_Template) {
+ $_template->parent->properties['file_dependency'] = array_merge($_template->parent->properties['file_dependency'], $_template->properties['file_dependency']);
+ foreach ($_template->required_plugins as $code => $tmp1) {
+ foreach ($tmp1 as $name => $tmp) {
+ foreach ($tmp as $type => $data) {
+ $_template->parent->required_plugins[$code][$name][$type] = $data;
+ }
+ }
+ }
+ }
+ if ($this->smarty->debugging) {
+ Smarty_Internal_Debug::end_render($_template);
+ }
+ // write to cache when nessecary
+ if (!$_template->source->recompiled && ($_template->caching == Smarty::CACHING_LIFETIME_SAVED || $_template->caching == Smarty::CACHING_LIFETIME_CURRENT)) {
+ if ($this->smarty->debugging) {
+ Smarty_Internal_Debug::start_cache($_template);
+ }
+ $_template->properties['has_nocache_code'] = false;
+ // get text between non-cached items
+ $cache_split = preg_split("!/\*%%SmartyNocache:{$_template->properties['nocache_hash']}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->properties['nocache_hash']}%%\*/!s", $_output);
+ // get non-cached items
+ preg_match_all("!/\*%%SmartyNocache:{$_template->properties['nocache_hash']}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->properties['nocache_hash']}%%\*/!s", $_output, $cache_parts);
+ $output = '';
+ // loop over items, stitch back together
+ foreach ($cache_split as $curr_idx => $curr_split) {
+ // escape PHP tags in template content
+ $output .= preg_replace('/(<%|%>|<\?php|<\?|\?>)/', '<?php echo \'$1\'; ?>', $curr_split);
+ if (isset($cache_parts[0][$curr_idx])) {
+ $_template->properties['has_nocache_code'] = true;
+ // remove nocache tags from cache output
+ $output .= preg_replace("!/\*/?%%SmartyNocache:{$_template->properties['nocache_hash']}%%\*/!", '', $cache_parts[0][$curr_idx]);
+ }
+ }
+ if (!$no_output_filter && !$_template->has_nocache_code && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) {
+ $output = Smarty_Internal_Filter_Handler::runFilter('output', $output, $_template);
+ }
+ // rendering (must be done before writing cache file because of {function} nocache handling)
+ $_smarty_tpl = $_template;
+ try {
+ ob_start();
+ eval("?>" . $output);
+ $_output = ob_get_clean();
+ } catch (Exception $e) {
+ ob_get_clean();
+ throw $e;
+ }
+ // write cache file content
+ $_template->writeCachedContent($output);
+ if ($this->smarty->debugging) {
+ Smarty_Internal_Debug::end_cache($_template);
+ }
+ } else {
+ // var_dump('renderTemplate', $_template->has_nocache_code, $_template->template_resource, $_template->properties['nocache_hash'], $_template->parent->properties['nocache_hash'], $_output);
+ if (!empty($_template->properties['nocache_hash']) && !empty($_template->parent->properties['nocache_hash'])) {
+ // replace nocache_hash
+ $_output = str_replace("{$_template->properties['nocache_hash']}", $_template->parent->properties['nocache_hash'], $_output);
+ $_template->parent->has_nocache_code = $_template->parent->has_nocache_code || $_template->has_nocache_code;
+ }
+ }
+ } else {
+ if ($this->smarty->debugging) {
+ Smarty_Internal_Debug::start_cache($_template);
+ }
+ try {
+ ob_start();
+ array_unshift($_template->_capture_stack,array());
+ //
+ // render cached template
+ //
+ $_template->properties['unifunc']($_template);
+ // any unclosed {capture} tags ?
+ if (isset($_template->_capture_stack[0][0])) {
+ $_template->capture_error();
+ }
+ array_shift($_template->_capture_stack);
+ $_output = ob_get_clean();
+ } catch (Exception $e) {
+ ob_get_clean();
+ throw $e;
+ }
+ if ($this->smarty->debugging) {
+ Smarty_Internal_Debug::end_cache($_template);
+ }
+ }
+ if ((!$this->caching || $_template->has_nocache_code || $_template->source->recompiled) && !$no_output_filter && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) {
+ $_output = Smarty_Internal_Filter_Handler::runFilter('output', $_output, $_template);
+ }
+ if (isset($this->error_reporting)) {
+ error_reporting($_smarty_old_error_level);
+ }
+ // display or fetch
+ if ($display) {
+ if ($this->caching && $this->cache_modified_check) {
+ $_isCached = $_template->isCached() && !$_template->has_nocache_code;
+ $_last_modified_date = @substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);
+ if ($_isCached && $_template->cached->timestamp <= strtotime($_last_modified_date)) {
+ switch (PHP_SAPI) {
+ case 'cgi': // php-cgi < 5.3
+ case 'cgi-fcgi': // php-cgi >= 5.3
+ case 'fpm-fcgi': // php-fpm >= 5.3.3
+ header('Status: 304 Not Modified');
+ break;
+
+ case 'cli':
+ if (/* ^phpunit */!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])/* phpunit$ */) {
+ $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = '304 Not Modified';
+ }
+ break;
+
+ default:
+ header($_SERVER['SERVER_PROTOCOL'].' 304 Not Modified');
+ break;
+ }
+ } else {
+ switch (PHP_SAPI) {
+ case 'cli':
+ if (/* ^phpunit */!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])/* phpunit$ */) {
+ $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT';
+ }
+ break;
+
+ default:
+ header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT');
+ break;
+ }
+ echo $_output;
+ }
+ } else {
+ echo $_output;
+ }
+ // debug output
+ if ($this->smarty->debugging) {
+ Smarty_Internal_Debug::display_debug($this);
+ }
+ if ($merge_tpl_vars) {
+ // restore local variables
+ $_template->tpl_vars = $save_tpl_vars;
+ $_template->config_vars = $save_config_vars;
+ }
+ return;
+ } else {
+ if ($merge_tpl_vars) {
+ // restore local variables
+ $_template->tpl_vars = $save_tpl_vars;
+ $_template->config_vars = $save_config_vars;
+ }
+ // return fetched content
+ return $_output;
+ }
+ }
+
+ /**
+ * displays a Smarty template
+ *
+ * @param string $template the resource handle of the template file or template object
+ * @param mixed $cache_id cache id to be used with this template
+ * @param mixed $compile_id compile id to be used with this template
+ * @param object $parent next higher level of Smarty variables
+ */
+ public function display($template = null, $cache_id = null, $compile_id = null, $parent = null)
+ {
+ // display template
+ $this->fetch($template, $cache_id, $compile_id, $parent, true);
+ }
+
+ /**
+ * test if cache is valid
+ *
+ * @param string|object $template the resource handle of the template file or template object
+ * @param mixed $cache_id cache id to be used with this template
+ * @param mixed $compile_id compile id to be used with this template
+ * @param object $parent next higher level of Smarty variables
+ * @return boolean cache status
+ */
+ public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null)
+ {
+ if ($template === null && $this instanceof $this->template_class) {
+ return $this->cached->valid;
+ }
+ if (!($template instanceof $this->template_class)) {
+ if ($parent === null) {
+ $parent = $this;
+ }
+ $template = $this->smarty->createTemplate($template, $cache_id, $compile_id, $parent, false);
+ }
+ // return cache status of template
+ return $template->cached->valid;
+ }
+
+ /**
+ * creates a data object
+ *
+ * @param object $parent next higher level of Smarty variables
+ * @returns Smarty_Data data object
+ */
+ public function createData($parent = null)
+ {
+ return new Smarty_Data($parent, $this);
+ }
+
+ /**
+ * Registers plugin to be used in templates
+ *
+ * @param string $type plugin type
+ * @param string $tag name of template tag
+ * @param callback $callback PHP callback to register
+ * @param boolean $cacheable if true (default) this fuction is cachable
+ * @param array $cache_attr caching attributes if any
+ * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
+ * @throws SmartyException when the plugin tag is invalid
+ */
+ public function registerPlugin($type, $tag, $callback, $cacheable = true, $cache_attr = null)
+ {
+ if (isset($this->smarty->registered_plugins[$type][$tag])) {
+ throw new SmartyException("Plugin tag \"{$tag}\" already registered");
+ } elseif (!is_callable($callback)) {
+ throw new SmartyException("Plugin \"{$tag}\" not callable");
+ } else {
+ $this->smarty->registered_plugins[$type][$tag] = array($callback, (bool) $cacheable, (array) $cache_attr);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Unregister Plugin
+ *
+ * @param string $type of plugin
+ * @param string $tag name of plugin
+ * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
+ */
+ public function unregisterPlugin($type, $tag)
+ {
+ if (isset($this->smarty->registered_plugins[$type][$tag])) {
+ unset($this->smarty->registered_plugins[$type][$tag]);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Registers a resource to fetch a template
+ *
+ * @param string $type name of resource type
+ * @param Smarty_Resource|array $callback or instance of Smarty_Resource, or array of callbacks to handle resource (deprecated)
+ * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
+ */
+ public function registerResource($type, $callback)
+ {
+ $this->smarty->registered_resources[$type] = $callback instanceof Smarty_Resource ? $callback : array($callback, false);
+ return $this;
+ }
+
+ /**
+ * Unregisters a resource
+ *
+ * @param string $type name of resource type
+ * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
+ */
+ public function unregisterResource($type)
+ {
+ if (isset($this->smarty->registered_resources[$type])) {
+ unset($this->smarty->registered_resources[$type]);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Registers a cache resource to cache a template's output
+ *
+ * @param string $type name of cache resource type
+ * @param Smarty_CacheResource $callback instance of Smarty_CacheResource to handle output caching
+ * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
+ */
+ public function registerCacheResource($type, Smarty_CacheResource $callback)
+ {
+ $this->smarty->registered_cache_resources[$type] = $callback;
+ return $this;
+ }
+
+ /**
+ * Unregisters a cache resource
+ *
+ * @param string $type name of cache resource type
+ * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
+ */
+ public function unregisterCacheResource($type)
+ {
+ if (isset($this->smarty->registered_cache_resources[$type])) {
+ unset($this->smarty->registered_cache_resources[$type]);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Registers object to be used in templates
+ *
+ * @param string $object name of template object
+ * @param object $object_impl the referenced PHP object to register
+ * @param array $allowed list of allowed methods (empty = all)
+ * @param boolean $smarty_args smarty argument format, else traditional
+ * @param array $block_methods list of block-methods
+ * @param array $block_functs list of methods that are block format
+ * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
+ * @throws SmartyException if any of the methods in $allowed or $block_methods are invalid
+ */
+ public function registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
+ {
+ // test if allowed methodes callable
+ if (!empty($allowed)) {
+ foreach ((array) $allowed as $method) {
+ if (!is_callable(array($object_impl, $method))) {
+ throw new SmartyException("Undefined method '$method' in registered object");
+ }
+ }
+ }
+ // test if block methodes callable
+ if (!empty($block_methods)) {
+ foreach ((array) $block_methods as $method) {
+ if (!is_callable(array($object_impl, $method))) {
+ throw new SmartyException("Undefined method '$method' in registered object");
+ }
+ }
+ }
+ // register the object
+ $this->smarty->registered_objects[$object_name] =
+ array($object_impl, (array) $allowed, (boolean) $smarty_args, (array) $block_methods);
+ return $this;
+ }
+
+ /**
+ * return a reference to a registered object
+ *
+ * @param string $name object name
+ * @return object
+ * @throws SmartyException if no such object is found
+ */
+ public function getRegisteredObject($name)
+ {
+ if (!isset($this->smarty->registered_objects[$name])) {
+ throw new SmartyException("'$name' is not a registered object");
+ }
+ if (!is_object($this->smarty->registered_objects[$name][0])) {
+ throw new SmartyException("registered '$name' is not an object");
+ }
+ return $this->smarty->registered_objects[$name][0];
+ }
+
+ /**
+ * unregister an object
+ *
+ * @param string $name object name
+ * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
+ */
+ public function unregisterObject($name)
+ {
+ if (isset($this->smarty->registered_objects[$name])) {
+ unset($this->smarty->registered_objects[$name]);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Registers static classes to be used in templates
+ *
+ * @param string $class name of template class
+ * @param string $class_impl the referenced PHP class to register
+ * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
+ * @throws SmartyException if $class_impl does not refer to an existing class
+ */
+ public function registerClass($class_name, $class_impl)
+ {
+ // test if exists
+ if (!class_exists($class_impl)) {
+ throw new SmartyException("Undefined class '$class_impl' in register template class");
+ }
+ // register the class
+ $this->smarty->registered_classes[$class_name] = $class_impl;
+ return $this;
+ }
+
+ /**
+ * Registers a default plugin handler
+ *
+ * @param callable $callback class/method name
+ * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
+ * @throws SmartyException if $callback is not callable
+ */
+ public function registerDefaultPluginHandler($callback)
+ {
+ if (is_callable($callback)) {
+ $this->smarty->default_plugin_handler_func = $callback;
+ } else {
+ throw new SmartyException("Default plugin handler '$callback' not callable");
+ }
+
+ return $this;
+ }
+
+ /**
+ * Registers a default template handler
+ *
+ * @param callable $callback class/method name
+ * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
+ * @throws SmartyException if $callback is not callable
+ */
+ public function registerDefaultTemplateHandler($callback)
+ {
+ if (is_callable($callback)) {
+ $this->smarty->default_template_handler_func = $callback;
+ } else {
+ throw new SmartyException("Default template handler '$callback' not callable");
+ }
+
+ return $this;
+ }
+
+ /**
+ * Registers a default template handler
+ *
+ * @param callable $callback class/method name
+ * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
+ * @throws SmartyException if $callback is not callable
+ */
+ public function registerDefaultConfigHandler($callback)
+ {
+ if (is_callable($callback)) {
+ $this->smarty->default_config_handler_func = $callback;
+ } else {
+ throw new SmartyException("Default config handler '$callback' not callable");
+ }
+
+ return $this;
+ }
+
+ /**
+ * Registers a filter function
+ *
+ * @param string $type filter type
+ * @param callback $callback
+ * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
+ */
+ public function registerFilter($type, $callback)
+ {
+ $this->smarty->registered_filters[$type][$this->_get_filter_name($callback)] = $callback;
+ return $this;
+ }
+
+ /**
+ * Unregisters a filter function
+ *
+ * @param string $type filter type
+ * @param callback $callback
+ * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
+ */
+ public function unregisterFilter($type, $callback)
+ {
+ $name = $this->_get_filter_name($callback);
+ if (isset($this->smarty->registered_filters[$type][$name])) {
+ unset($this->smarty->registered_filters[$type][$name]);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Return internal filter name
+ *
+ * @param callback $function_name
+ * @return string internal filter name
+ */
+ public function _get_filter_name($function_name)
+ {
+ if (is_array($function_name)) {
+ $_class_name = (is_object($function_name[0]) ?
+ get_class($function_name[0]) : $function_name[0]);
+ return $_class_name . '_' . $function_name[1];
+ } else {
+ return $function_name;
+ }
+ }
+
+ /**
+ * load a filter of specified type and name
+ *
+ * @param string $type filter type
+ * @param string $name filter name
+ * @throws SmartyException if filter could not be loaded
+ */
+ public function loadFilter($type, $name)
+ {
+ $_plugin = "smarty_{$type}filter_{$name}";
+ $_filter_name = $_plugin;
+ if ($this->smarty->loadPlugin($_plugin)) {
+ if (class_exists($_plugin, false)) {
+ $_plugin = array($_plugin, 'execute');
+ }
+ if (is_callable($_plugin)) {
+ $this->smarty->registered_filters[$type][$_filter_name] = $_plugin;
+ return true;
+ }
+ }
+ throw new SmartyException("{$type}filter \"{$name}\" not callable");
+ }
+
+ /**
+ * unload a filter of specified type and name
+ *
+ * @param string $type filter type
+ * @param string $name filter name
+ * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
+ */
+ public function unloadFilter($type, $name)
+ {
+ $_filter_name = "smarty_{$type}filter_{$name}";
+ if (isset($this->smarty->registered_filters[$type][$_filter_name])) {
+ unset ($this->smarty->registered_filters[$type][$_filter_name]);
+ }
+
+ return $this;
+ }
+
+ /**
+ * preg_replace callback to convert camelcase getter/setter to underscore property names
+ *
+ * @param string $match match string
+ * @return string replacemant
+ */
+ private function replaceCamelcase($match) {
+ return "_" . strtolower($match[1]);
+ }
+
+ /**
+ * Handle unknown class methods
+ *
+ * @param string $name unknown method-name
+ * @param array $args argument array
+ */
+ public function __call($name, $args)
+ {
+ static $_prefixes = array('set' => true, 'get' => true);
+ static $_resolved_property_name = array();
+ static $_resolved_property_source = array();
+
+ // method of Smarty object?
+ if (method_exists($this->smarty, $name)) {
+ return call_user_func_array(array($this->smarty, $name), $args);
+ }
+ // see if this is a set/get for a property
+ $first3 = strtolower(substr($name, 0, 3));
+ if (isset($_prefixes[$first3]) && isset($name[3]) && $name[3] !== '_') {
+ if (isset($_resolved_property_name[$name])) {
+ $property_name = $_resolved_property_name[$name];
+ } else {
+ // try to keep case correct for future PHP 6.0 case-sensitive class methods
+ // lcfirst() not available < PHP 5.3.0, so improvise
+ $property_name = strtolower(substr($name, 3, 1)) . substr($name, 4);
+ // convert camel case to underscored name
+ $property_name = preg_replace_callback('/([A-Z])/', array($this,'replaceCamelcase'), $property_name);
+ $_resolved_property_name[$name] = $property_name;
+ }
+ if (isset($_resolved_property_source[$property_name])) {
+ $_is_this = $_resolved_property_source[$property_name];
+ } else {
+ $_is_this = null;
+ if (property_exists($this, $property_name)) {
+ $_is_this = true;
+ } else if (property_exists($this->smarty, $property_name)) {
+ $_is_this = false;
+ }
+ $_resolved_property_source[$property_name] = $_is_this;
+ }
+ if ($_is_this) {
+ if ($first3 == 'get')
+ return $this->$property_name;
+ else
+ return $this->$property_name = $args[0];
+ } else if ($_is_this === false) {
+ if ($first3 == 'get')
+ return $this->smarty->$property_name;
+ else
+ return $this->smarty->$property_name = $args[0];
+ } else {
+ throw new SmartyException("property '$property_name' does not exist.");
+ return false;
+ }
+ }
+ if ($name == 'Smarty') {
+ throw new SmartyException("PHP5 requires you to call __construct() instead of Smarty()");
+ }
+ // must be unknown
+ throw new SmartyException("Call of unknown method '$name'.");
+ }
+
+}
+
?> \ No newline at end of file
diff --git a/include/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php b/include/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php
index 11fc2144d..c745d294d 100644
--- a/include/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php
+++ b/include/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php
@@ -1,670 +1,670 @@
-<?php
-
-/**
- * Smarty Internal Plugin Smarty Template Compiler Base
- *
- * This file contains the basic classes and methodes for compiling Smarty templates with lexer/parser
- *
- * @package Smarty
- * @subpackage Compiler
- * @author Uwe Tews
- */
-
-/**
- * Main abstract compiler class
- *
- * @package Smarty
- * @subpackage Compiler
- */
-abstract class Smarty_Internal_TemplateCompilerBase {
-
- /**
- * hash for nocache sections
- *
- * @var mixed
- */
- private $nocache_hash = null;
-
- /**
- * suppress generation of nocache code
- *
- * @var bool
- */
- public $suppressNocacheProcessing = false;
-
- /**
- * suppress generation of merged template code
- *
- * @var bool
- */
- public $suppressMergedTemplates = false;
-
- /**
- * compile tag objects
- *
- * @var array
- */
- public static $_tag_objects = array();
-
- /**
- * tag stack
- *
- * @var array
- */
- public $_tag_stack = array();
-
- /**
- * current template
- *
- * @var Smarty_Internal_Template
- */
- public $template = null;
-
- /**
- * merged templates
- *
- * @var array
- */
- public $merged_templates = array();
-
- /**
- * flag when compiling {block}
- *
- * @var bool
- */
- public $inheritance = false;
-
- /**
- * plugins loaded by default plugin handler
- *
- * @var array
- */
- public $default_handler_plugins = array();
-
- /**
- * saved preprocessed modifier list
- *
- * @var mixed
- */
- public $default_modifier_list = null;
-
- /**
- * force compilation of complete template as nocache
- * @var boolean
- */
- public $forceNocache = false;
-
- /**
- * suppress Smarty header code in compiled template
- * @var bool
- */
- public $suppressHeader = false;
-
- /**
- * suppress template property header code in compiled template
- * @var bool
- */
- public $suppressTemplatePropertyHeader = false;
-
- /**
- * flag if compiled template file shall we written
- * @var bool
- */
- public $write_compiled_code = true;
-
- /**
- * flag if currently a template function is compiled
- * @var bool
- */
- public $compiles_template_function = false;
-
- /**
- * called subfuntions from template function
- * @var array
- */
- public $called_functions = array();
-
- /**
- * flags for used modifier plugins
- * @var array
- */
- public $modifier_plugins = array();
-
- /**
- * type of already compiled modifier
- * @var array
- */
- public $known_modifier_type = array();
-
- /**
- * Methode to compile a Smarty template
- *
- * @param mixed $_content template source
- * @return bool true if compiling succeeded, false if it failed
- */
- abstract protected function doCompile($_content);
-
- /**
- * Initialize compiler
- */
- public function __construct() {
- $this->nocache_hash = str_replace('.', '-', uniqid(rand(), true));
- }
-
- /**
- * Method to compile a Smarty template
- *
- * @param Smarty_Internal_Template $template template object to compile
- * @return bool true if compiling succeeded, false if it failed
- */
- public function compileTemplate(Smarty_Internal_Template $template) {
- if (empty($template->properties['nocache_hash'])) {
- $template->properties['nocache_hash'] = $this->nocache_hash;
- } else {
- $this->nocache_hash = $template->properties['nocache_hash'];
- }
- // flag for nochache sections
- $this->nocache = false;
- $this->tag_nocache = false;
- // save template object in compiler class
- $this->template = $template;
- // reset has noche code flag
- $this->template->has_nocache_code = false;
- $this->smarty->_current_file = $saved_filepath = $this->template->source->filepath;
- // template header code
- $template_header = '';
- if (!$this->suppressHeader) {
- $template_header .= "<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") . "\n";
- $template_header .= " compiled from \"" . $this->template->source->filepath . "\" */ ?>\n";
- }
-
- do {
- // flag for aborting current and start recompile
- $this->abort_and_recompile = false;
- // get template source
- $_content = $template->source->content;
- // run prefilter if required
- if (isset($this->smarty->autoload_filters['pre']) || isset($this->smarty->registered_filters['pre'])) {
- $_content = Smarty_Internal_Filter_Handler::runFilter('pre', $_content, $template);
- }
- // on empty template just return header
- if ($_content == '') {
- if ($this->suppressTemplatePropertyHeader) {
- $code = '';
- } else {
- $code = $template_header . $template->createTemplateCodeFrame();
- }
- return $code;
- }
- // call compiler
- $_compiled_code = $this->doCompile($_content);
- } while ($this->abort_and_recompile);
- $this->template->source->filepath = $saved_filepath;
- // free memory
- unset($this->parser->root_buffer, $this->parser->current_buffer, $this->parser, $this->lex, $this->template);
- self::$_tag_objects = array();
- // return compiled code to template object
- $merged_code = '';
- if (!$this->suppressMergedTemplates && !empty($this->merged_templates)) {
- foreach ($this->merged_templates as $code) {
- $merged_code .= $code;
- }
- // run postfilter if required on merged code
- if (isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post'])) {
- $merged_code = Smarty_Internal_Filter_Handler::runFilter('post', $merged_code, $template);
- }
- }
- // run postfilter if required on compiled template code
- if (isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post'])) {
- $_compiled_code = Smarty_Internal_Filter_Handler::runFilter('post', $_compiled_code, $template);
- }
- if ($this->suppressTemplatePropertyHeader) {
- $code = $_compiled_code . $merged_code;
- } else {
- $code = $template_header . $template->createTemplateCodeFrame($_compiled_code) . $merged_code;
- }
- // unset content because template inheritance could have replace source with parent code
- unset ($template->source->content);
- return $code;
- }
-
- /**
- * Compile Tag
- *
- * This is a call back from the lexer/parser
- * It executes the required compile plugin for the Smarty tag
- *
- * @param string $tag tag name
- * @param array $args array with tag attributes
- * @param array $parameter array with compilation parameter
- * @return string compiled code
- */
- public function compileTag($tag, $args, $parameter = array()) {
- // $args contains the attributes parsed and compiled by the lexer/parser
- // assume that tag does compile into code, but creates no HTML output
- $this->has_code = true;
- $this->has_output = false;
- // log tag/attributes
- if (isset($this->smarty->get_used_tags) && $this->smarty->get_used_tags) {
- $this->template->used_tags[] = array($tag, $args);
- }
- // check nocache option flag
- if (in_array("'nocache'", $args) || in_array(array('nocache' => 'true'), $args)
- || in_array(array('nocache' => '"true"'), $args) || in_array(array('nocache' => "'true'"), $args)) {
- $this->tag_nocache = true;
- }
- // compile the smarty tag (required compile classes to compile the tag are autoloaded)
- if (($_output = $this->callTagCompiler($tag, $args, $parameter)) === false) {
- if (isset($this->smarty->template_functions[$tag])) {
- // template defined by {template} tag
- $args['_attr']['name'] = "'" . $tag . "'";
- $_output = $this->callTagCompiler('call', $args, $parameter);
- }
- }
- if ($_output !== false) {
- if ($_output !== true) {
- // did we get compiled code
- if ($this->has_code) {
- // Does it create output?
- if ($this->has_output) {
- $_output .= "\n";
- }
- // return compiled code
- return $_output;
- }
- }
- // tag did not produce compiled code
- return '';
- } else {
- // map_named attributes
- if (isset($args['_attr'])) {
- foreach ($args['_attr'] as $key => $attribute) {
- if (is_array($attribute)) {
- $args = array_merge($args, $attribute);
- }
- }
- }
- // not an internal compiler tag
- if (strlen($tag) < 6 || substr($tag, -5) != 'close') {
- // check if tag is a registered object
- if (isset($this->smarty->registered_objects[$tag]) && isset($parameter['object_methode'])) {
- $methode = $parameter['object_methode'];
- if (!in_array($methode, $this->smarty->registered_objects[$tag][3]) &&
- (empty($this->smarty->registered_objects[$tag][1]) || in_array($methode, $this->smarty->registered_objects[$tag][1]))) {
- return $this->callTagCompiler('private_object_function', $args, $parameter, $tag, $methode);
- } elseif (in_array($methode, $this->smarty->registered_objects[$tag][3])) {
- return $this->callTagCompiler('private_object_block_function', $args, $parameter, $tag, $methode);
- } else {
- return $this->trigger_template_error('unallowed methode "' . $methode . '" in registered object "' . $tag . '"', $this->lex->taglineno);
- }
- }
- // check if tag is registered
- foreach (array(Smarty::PLUGIN_COMPILER, Smarty::PLUGIN_FUNCTION, Smarty::PLUGIN_BLOCK) as $plugin_type) {
- if (isset($this->smarty->registered_plugins[$plugin_type][$tag])) {
- // if compiler function plugin call it now
- if ($plugin_type == Smarty::PLUGIN_COMPILER) {
- $new_args = array();
- foreach ($args as $key => $mixed) {
- if (is_array($mixed)) {
- $new_args = array_merge($new_args, $mixed);
- } else {
- $new_args[$key] = $mixed;
- }
- }
- if (!$this->smarty->registered_plugins[$plugin_type][$tag][1]) {
- $this->tag_nocache = true;
- }
- $function = $this->smarty->registered_plugins[$plugin_type][$tag][0];
- if (!is_array($function)) {
- return $function($new_args, $this);
- } else if (is_object($function[0])) {
- return $this->smarty->registered_plugins[$plugin_type][$tag][0][0]->$function[1]($new_args, $this);
- } else {
- return call_user_func_array($function, array($new_args, $this));
- }
- }
- // compile registered function or block function
- if ($plugin_type == Smarty::PLUGIN_FUNCTION || $plugin_type == Smarty::PLUGIN_BLOCK) {
- return $this->callTagCompiler('private_registered_' . $plugin_type, $args, $parameter, $tag);
- }
- }
- }
- // check plugins from plugins folder
- foreach ($this->smarty->plugin_search_order as $plugin_type) {
- if ($plugin_type == Smarty::PLUGIN_BLOCK && $this->smarty->loadPlugin('smarty_compiler_' . $tag) && (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this))) {
- $plugin = 'smarty_compiler_' . $tag;
- if (is_callable($plugin)) {
- // convert arguments format for old compiler plugins
- $new_args = array();
- foreach ($args as $key => $mixed) {
- if (is_array($mixed)) {
- $new_args = array_merge($new_args, $mixed);
- } else {
- $new_args[$key] = $mixed;
- }
- }
- return $plugin($new_args, $this->smarty);
- }
- if (class_exists($plugin, false)) {
- $plugin_object = new $plugin;
- if (method_exists($plugin_object, 'compile')) {
- return $plugin_object->compile($args, $this);
- }
- }
- throw new SmartyException("Plugin \"{$tag}\" not callable");
- } else {
- if ($function = $this->getPlugin($tag, $plugin_type)) {
- if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) {
- return $this->callTagCompiler('private_' . $plugin_type . '_plugin', $args, $parameter, $tag, $function);
- }
- }
- }
- }
- if (is_callable($this->smarty->default_plugin_handler_func)) {
- $found = false;
- // look for already resolved tags
- foreach ($this->smarty->plugin_search_order as $plugin_type) {
- if (isset($this->default_handler_plugins[$plugin_type][$tag])) {
- $found = true;
- break;
- }
- }
- if (!$found) {
- // call default handler
- foreach ($this->smarty->plugin_search_order as $plugin_type) {
- if ($this->getPluginFromDefaultHandler($tag, $plugin_type)) {
- $found = true;
- break;
- }
- }
- }
- if ($found) {
- // if compiler function plugin call it now
- if ($plugin_type == Smarty::PLUGIN_COMPILER) {
- $new_args = array();
- foreach ($args as $mixed) {
- $new_args = array_merge($new_args, $mixed);
- }
- $function = $this->default_handler_plugins[$plugin_type][$tag][0];
- if (!is_array($function)) {
- return $function($new_args, $this);
- } else if (is_object($function[0])) {
- return $this->default_handler_plugins[$plugin_type][$tag][0][0]->$function[1]($new_args, $this);
- } else {
- return call_user_func_array($function, array($new_args, $this));
- }
- } else {
- return $this->callTagCompiler('private_registered_' . $plugin_type, $args, $parameter, $tag);
- }
- }
- }
- } else {
- // compile closing tag of block function
- $base_tag = substr($tag, 0, -5);
- // check if closing tag is a registered object
- if (isset($this->smarty->registered_objects[$base_tag]) && isset($parameter['object_methode'])) {
- $methode = $parameter['object_methode'];
- if (in_array($methode, $this->smarty->registered_objects[$base_tag][3])) {
- return $this->callTagCompiler('private_object_block_function', $args, $parameter, $tag, $methode);
- } else {
- return $this->trigger_template_error('unallowed closing tag methode "' . $methode . '" in registered object "' . $base_tag . '"', $this->lex->taglineno);
- }
- }
- // registered block tag ?
- if (isset($this->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag]) || isset($this->default_handler_plugins[Smarty::PLUGIN_BLOCK][$base_tag])) {
- return $this->callTagCompiler('private_registered_block', $args, $parameter, $tag);
- }
- // block plugin?
- if ($function = $this->getPlugin($base_tag, Smarty::PLUGIN_BLOCK)) {
- return $this->callTagCompiler('private_block_plugin', $args, $parameter, $tag, $function);
- }
- // registered compiler plugin ?
- if (isset($this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag])) {
- // if compiler function plugin call it now
- $args = array();
- if (!$this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag][1]) {
- $this->tag_nocache = true;
- }
- $function = $this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag][0];
- if (!is_array($function)) {
- return $function($args, $this);
- } else if (is_object($function[0])) {
- return $this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag][0][0]->$function[1]($args, $this);
- } else {
- return call_user_func_array($function, array($args, $this));
- }
- }
- if ($this->smarty->loadPlugin('smarty_compiler_' . $tag)) {
- $plugin = 'smarty_compiler_' . $tag;
- if (is_callable($plugin)) {
- return $plugin($args, $this->smarty);
- }
- if (class_exists($plugin, false)) {
- $plugin_object = new $plugin;
- if (method_exists($plugin_object, 'compile')) {
- return $plugin_object->compile($args, $this);
- }
- }
- throw new SmartyException("Plugin \"{$tag}\" not callable");
- }
- }
- $this->trigger_template_error("unknown tag \"" . $tag . "\"", $this->lex->taglineno);
- }
- }
-
- /**
- * lazy loads internal compile plugin for tag and calls the compile methode
- *
- * compile objects cached for reuse.
- * class name format: Smarty_Internal_Compile_TagName
- * plugin filename format: Smarty_Internal_Tagname.php
- *
- * @param string $tag tag name
- * @param array $args list of tag attributes
- * @param mixed $param1 optional parameter
- * @param mixed $param2 optional parameter
- * @param mixed $param3 optional parameter
- * @return string compiled code
- */
- public function callTagCompiler($tag, $args, $param1 = null, $param2 = null, $param3 = null) {
- // re-use object if already exists
- if (isset(self::$_tag_objects[$tag])) {
- // compile this tag
- return self::$_tag_objects[$tag]->compile($args, $this, $param1, $param2, $param3);
- }
- // lazy load internal compiler plugin
- $class_name = 'Smarty_Internal_Compile_' . $tag;
- if ($this->smarty->loadPlugin($class_name)) {
- // check if tag allowed by security
- if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) {
- // use plugin if found
- self::$_tag_objects[$tag] = new $class_name;
- // compile this tag
- return self::$_tag_objects[$tag]->compile($args, $this, $param1, $param2, $param3);
- }
- }
- // no internal compile plugin for this tag
- return false;
- }
-
- /**
- * Check for plugins and return function name
- *
- * @param string $pugin_name name of plugin or function
- * @param string $plugin_type type of plugin
- * @return string call name of function
- */
- public function getPlugin($plugin_name, $plugin_type) {
- $function = null;
- if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {
- if (isset($this->template->required_plugins['nocache'][$plugin_name][$plugin_type])) {
- $function = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'];
- } else if (isset($this->template->required_plugins['compiled'][$plugin_name][$plugin_type])) {
- $this->template->required_plugins['nocache'][$plugin_name][$plugin_type] = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type];
- $function = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'];
- }
- } else {
- if (isset($this->template->required_plugins['compiled'][$plugin_name][$plugin_type])) {
- $function = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['function'];
- } else if (isset($this->template->required_plugins['nocache'][$plugin_name][$plugin_type])) {
- $this->template->required_plugins['compiled'][$plugin_name][$plugin_type] = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type];
- $function = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['function'];
- }
- }
- if (isset($function)) {
- if ($plugin_type == 'modifier') {
- $this->modifier_plugins[$plugin_name] = true;
- }
- return $function;
- }
- // loop through plugin dirs and find the plugin
- $function = 'smarty_' . $plugin_type . '_' . $plugin_name;
- $file = $this->smarty->loadPlugin($function, false);
-
- if (is_string($file)) {
- if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {
- $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['file'] = $file;
- $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'] = $function;
- } else {
- $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['file'] = $file;
- $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['function'] = $function;
- }
- if ($plugin_type == 'modifier') {
- $this->modifier_plugins[$plugin_name] = true;
- }
- return $function;
- }
- if (is_callable($function)) {
- // plugin function is defined in the script
- return $function;
- }
- return false;
- }
-
- /**
- * Check for plugins by default plugin handler
- *
- * @param string $tag name of tag
- * @param string $plugin_type type of plugin
- * @return boolean true if found
- */
- public function getPluginFromDefaultHandler($tag, $plugin_type) {
- $callback = null;
- $script = null;
- $cacheable = true;
- $result = call_user_func_array(
- $this->smarty->default_plugin_handler_func, array($tag, $plugin_type, $this->template, &$callback, &$script, &$cacheable)
- );
- if ($result) {
- $this->tag_nocache = $this->tag_nocache || !$cacheable;
- if ($script !== null) {
- if (is_file($script)) {
- if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {
- $this->template->required_plugins['nocache'][$tag][$plugin_type]['file'] = $script;
- $this->template->required_plugins['nocache'][$tag][$plugin_type]['function'] = $callback;
- } else {
- $this->template->required_plugins['compiled'][$tag][$plugin_type]['file'] = $script;
- $this->template->required_plugins['compiled'][$tag][$plugin_type]['function'] = $callback;
- }
- include_once $script;
- } else {
- $this->trigger_template_error("Default plugin handler: Returned script file \"{$script}\" for \"{$tag}\" not found");
- }
- }
- if (!is_string($callback) && !(is_array($callback) && is_string($callback[0]) && is_string($callback[1]))) {
- $this->trigger_template_error("Default plugin handler: Returned callback for \"{$tag}\" must be a static function name or array of class and function name");
- }
- if (is_callable($callback)) {
- $this->default_handler_plugins[$plugin_type][$tag] = array($callback, true, array());
- return true;
- } else {
- $this->trigger_template_error("Default plugin handler: Returned callback for \"{$tag}\" not callable");
- }
- }
- return false;
- }
-
- /**
- * Inject inline code for nocache template sections
- *
- * This method gets the content of each template element from the parser.
- * If the content is compiled code and it should be not cached the code is injected
- * into the rendered output.
- *
- * @param string $content content of template element
- * @param boolean $is_code true if content is compiled code
- * @return string content
- */
- public function processNocacheCode($content, $is_code) {
- // If the template is not evaluated and we have a nocache section and or a nocache tag
- if ($is_code && !empty($content)) {
- // generate replacement code
- if ((!($this->template->source->recompiled) || $this->forceNocache) && $this->template->caching && !$this->suppressNocacheProcessing &&
- ($this->nocache || $this->tag_nocache || $this->forceNocache == 2)) {
- $this->template->has_nocache_code = true;
- $_output = addcslashes($content,'\'\\');
- $_output = str_replace("^#^", "'", $_output);
- $_output = "<?php echo '/*%%SmartyNocache:{$this->nocache_hash}%%*/" . $_output . "/*/%%SmartyNocache:{$this->nocache_hash}%%*/';?>\n";
- // make sure we include modifer plugins for nocache code
- foreach ($this->modifier_plugins as $plugin_name => $dummy) {
- if (isset($this->template->required_plugins['compiled'][$plugin_name]['modifier'])) {
- $this->template->required_plugins['nocache'][$plugin_name]['modifier'] = $this->template->required_plugins['compiled'][$plugin_name]['modifier'];
- }
- }
- } else {
- $_output = $content;
- }
- } else {
- $_output = $content;
- }
- $this->modifier_plugins = array();
- $this->suppressNocacheProcessing = false;
- $this->tag_nocache = false;
- return $_output;
- }
-
- /**
- * display compiler error messages without dying
- *
- * If parameter $args is empty it is a parser detected syntax error.
- * In this case the parser is called to obtain information about expected tokens.
- *
- * If parameter $args contains a string this is used as error message
- *
- * @param string $args individual error message or null
- * @param string $line line-number
- * @throws SmartyCompilerException when an unexpected token is found
- */
- public function trigger_template_error($args = null, $line = null) {
- // get template source line which has error
- if (!isset($line)) {
- $line = $this->lex->line;
- }
- $match = preg_split("/\n/", $this->lex->data);
- $error_text = 'Syntax Error in template "' . $this->template->source->filepath . '" on line ' . $line . ' "' . htmlspecialchars(trim(preg_replace('![\t\r\n]+!', ' ', $match[$line - 1]))) . '" ';
- if (isset($args)) {
- // individual error message
- $error_text .= $args;
- } else {
- // expected token from parser
- $error_text .= ' - Unexpected "' . $this->lex->value . '"';
- if (count($this->parser->yy_get_expected_tokens($this->parser->yymajor)) <= 4) {
- foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) {
- $exp_token = $this->parser->yyTokenName[$token];
- if (isset($this->lex->smarty_token_names[$exp_token])) {
- // token type from lexer
- $expect[] = '"' . $this->lex->smarty_token_names[$exp_token] . '"';
- } else {
- // otherwise internal token name
- $expect[] = $this->parser->yyTokenName[$token];
- }
- }
- $error_text .= ', expected one of: ' . implode(' , ', $expect);
- }
- }
- throw new SmartyCompilerException($error_text);
- }
-
-}
-
+<?php
+
+/**
+ * Smarty Internal Plugin Smarty Template Compiler Base
+ *
+ * This file contains the basic classes and methodes for compiling Smarty templates with lexer/parser
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Main abstract compiler class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+abstract class Smarty_Internal_TemplateCompilerBase {
+
+ /**
+ * hash for nocache sections
+ *
+ * @var mixed
+ */
+ private $nocache_hash = null;
+
+ /**
+ * suppress generation of nocache code
+ *
+ * @var bool
+ */
+ public $suppressNocacheProcessing = false;
+
+ /**
+ * suppress generation of merged template code
+ *
+ * @var bool
+ */
+ public $suppressMergedTemplates = false;
+
+ /**
+ * compile tag objects
+ *
+ * @var array
+ */
+ public static $_tag_objects = array();
+
+ /**
+ * tag stack
+ *
+ * @var array
+ */
+ public $_tag_stack = array();
+
+ /**
+ * current template
+ *
+ * @var Smarty_Internal_Template
+ */
+ public $template = null;
+
+ /**
+ * merged templates
+ *
+ * @var array
+ */
+ public $merged_templates = array();
+
+ /**
+ * flag when compiling {block}
+ *
+ * @var bool
+ */
+ public $inheritance = false;
+
+ /**
+ * plugins loaded by default plugin handler
+ *
+ * @var array
+ */
+ public $default_handler_plugins = array();
+
+ /**
+ * saved preprocessed modifier list
+ *
+ * @var mixed
+ */
+ public $default_modifier_list = null;
+
+ /**
+ * force compilation of complete template as nocache
+ * @var boolean
+ */
+ public $forceNocache = false;
+
+ /**
+ * suppress Smarty header code in compiled template
+ * @var bool
+ */
+ public $suppressHeader = false;
+
+ /**
+ * suppress template property header code in compiled template
+ * @var bool
+ */
+ public $suppressTemplatePropertyHeader = false;
+
+ /**
+ * flag if compiled template file shall we written
+ * @var bool
+ */
+ public $write_compiled_code = true;
+
+ /**
+ * flag if currently a template function is compiled
+ * @var bool
+ */
+ public $compiles_template_function = false;
+
+ /**
+ * called subfuntions from template function
+ * @var array
+ */
+ public $called_functions = array();
+
+ /**
+ * flags for used modifier plugins
+ * @var array
+ */
+ public $modifier_plugins = array();
+
+ /**
+ * type of already compiled modifier
+ * @var array
+ */
+ public $known_modifier_type = array();
+
+ /**
+ * Methode to compile a Smarty template
+ *
+ * @param mixed $_content template source
+ * @return bool true if compiling succeeded, false if it failed
+ */
+ abstract protected function doCompile($_content);
+
+ /**
+ * Initialize compiler
+ */
+ public function __construct() {
+ $this->nocache_hash = str_replace('.', '-', uniqid(rand(), true));
+ }
+
+ /**
+ * Method to compile a Smarty template
+ *
+ * @param Smarty_Internal_Template $template template object to compile
+ * @return bool true if compiling succeeded, false if it failed
+ */
+ public function compileTemplate(Smarty_Internal_Template $template) {
+ if (empty($template->properties['nocache_hash'])) {
+ $template->properties['nocache_hash'] = $this->nocache_hash;
+ } else {
+ $this->nocache_hash = $template->properties['nocache_hash'];
+ }
+ // flag for nochache sections
+ $this->nocache = false;
+ $this->tag_nocache = false;
+ // save template object in compiler class
+ $this->template = $template;
+ // reset has noche code flag
+ $this->template->has_nocache_code = false;
+ $this->smarty->_current_file = $saved_filepath = $this->template->source->filepath;
+ // template header code
+ $template_header = '';
+ if (!$this->suppressHeader) {
+ $template_header .= "<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") . "\n";
+ $template_header .= " compiled from \"" . $this->template->source->filepath . "\" */ ?>\n";
+ }
+
+ do {
+ // flag for aborting current and start recompile
+ $this->abort_and_recompile = false;
+ // get template source
+ $_content = $template->source->content;
+ // run prefilter if required
+ if (isset($this->smarty->autoload_filters['pre']) || isset($this->smarty->registered_filters['pre'])) {
+ $_content = Smarty_Internal_Filter_Handler::runFilter('pre', $_content, $template);
+ }
+ // on empty template just return header
+ if ($_content == '') {
+ if ($this->suppressTemplatePropertyHeader) {
+ $code = '';
+ } else {
+ $code = $template_header . $template->createTemplateCodeFrame();
+ }
+ return $code;
+ }
+ // call compiler
+ $_compiled_code = $this->doCompile($_content);
+ } while ($this->abort_and_recompile);
+ $this->template->source->filepath = $saved_filepath;
+ // free memory
+ unset($this->parser->root_buffer, $this->parser->current_buffer, $this->parser, $this->lex, $this->template);
+ self::$_tag_objects = array();
+ // return compiled code to template object
+ $merged_code = '';
+ if (!$this->suppressMergedTemplates && !empty($this->merged_templates)) {
+ foreach ($this->merged_templates as $code) {
+ $merged_code .= $code;
+ }
+ // run postfilter if required on merged code
+ if (isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post'])) {
+ $merged_code = Smarty_Internal_Filter_Handler::runFilter('post', $merged_code, $template);
+ }
+ }
+ // run postfilter if required on compiled template code
+ if (isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post'])) {
+ $_compiled_code = Smarty_Internal_Filter_Handler::runFilter('post', $_compiled_code, $template);
+ }
+ if ($this->suppressTemplatePropertyHeader) {
+ $code = $_compiled_code . $merged_code;
+ } else {
+ $code = $template_header . $template->createTemplateCodeFrame($_compiled_code) . $merged_code;
+ }
+ // unset content because template inheritance could have replace source with parent code
+ unset ($template->source->content);
+ return $code;
+ }
+
+ /**
+ * Compile Tag
+ *
+ * This is a call back from the lexer/parser
+ * It executes the required compile plugin for the Smarty tag
+ *
+ * @param string $tag tag name
+ * @param array $args array with tag attributes
+ * @param array $parameter array with compilation parameter
+ * @return string compiled code
+ */
+ public function compileTag($tag, $args, $parameter = array()) {
+ // $args contains the attributes parsed and compiled by the lexer/parser
+ // assume that tag does compile into code, but creates no HTML output
+ $this->has_code = true;
+ $this->has_output = false;
+ // log tag/attributes
+ if (isset($this->smarty->get_used_tags) && $this->smarty->get_used_tags) {
+ $this->template->used_tags[] = array($tag, $args);
+ }
+ // check nocache option flag
+ if (in_array("'nocache'", $args) || in_array(array('nocache' => 'true'), $args)
+ || in_array(array('nocache' => '"true"'), $args) || in_array(array('nocache' => "'true'"), $args)) {
+ $this->tag_nocache = true;
+ }
+ // compile the smarty tag (required compile classes to compile the tag are autoloaded)
+ if (($_output = $this->callTagCompiler($tag, $args, $parameter)) === false) {
+ if (isset($this->smarty->template_functions[$tag])) {
+ // template defined by {template} tag
+ $args['_attr']['name'] = "'" . $tag . "'";
+ $_output = $this->callTagCompiler('call', $args, $parameter);
+ }
+ }
+ if ($_output !== false) {
+ if ($_output !== true) {
+ // did we get compiled code
+ if ($this->has_code) {
+ // Does it create output?
+ if ($this->has_output) {
+ $_output .= "\n";
+ }
+ // return compiled code
+ return $_output;
+ }
+ }
+ // tag did not produce compiled code
+ return '';
+ } else {
+ // map_named attributes
+ if (isset($args['_attr'])) {
+ foreach ($args['_attr'] as $key => $attribute) {
+ if (is_array($attribute)) {
+ $args = array_merge($args, $attribute);
+ }
+ }
+ }
+ // not an internal compiler tag
+ if (strlen($tag) < 6 || substr($tag, -5) != 'close') {
+ // check if tag is a registered object
+ if (isset($this->smarty->registered_objects[$tag]) && isset($parameter['object_methode'])) {
+ $methode = $parameter['object_methode'];
+ if (!in_array($methode, $this->smarty->registered_objects[$tag][3]) &&
+ (empty($this->smarty->registered_objects[$tag][1]) || in_array($methode, $this->smarty->registered_objects[$tag][1]))) {
+ return $this->callTagCompiler('private_object_function', $args, $parameter, $tag, $methode);
+ } elseif (in_array($methode, $this->smarty->registered_objects[$tag][3])) {
+ return $this->callTagCompiler('private_object_block_function', $args, $parameter, $tag, $methode);
+ } else {
+ return $this->trigger_template_error('unallowed methode "' . $methode . '" in registered object "' . $tag . '"', $this->lex->taglineno);
+ }
+ }
+ // check if tag is registered
+ foreach (array(Smarty::PLUGIN_COMPILER, Smarty::PLUGIN_FUNCTION, Smarty::PLUGIN_BLOCK) as $plugin_type) {
+ if (isset($this->smarty->registered_plugins[$plugin_type][$tag])) {
+ // if compiler function plugin call it now
+ if ($plugin_type == Smarty::PLUGIN_COMPILER) {
+ $new_args = array();
+ foreach ($args as $key => $mixed) {
+ if (is_array($mixed)) {
+ $new_args = array_merge($new_args, $mixed);
+ } else {
+ $new_args[$key] = $mixed;
+ }
+ }
+ if (!$this->smarty->registered_plugins[$plugin_type][$tag][1]) {
+ $this->tag_nocache = true;
+ }
+ $function = $this->smarty->registered_plugins[$plugin_type][$tag][0];
+ if (!is_array($function)) {
+ return $function($new_args, $this);
+ } else if (is_object($function[0])) {
+ return $this->smarty->registered_plugins[$plugin_type][$tag][0][0]->$function[1]($new_args, $this);
+ } else {
+ return call_user_func_array($function, array($new_args, $this));
+ }
+ }
+ // compile registered function or block function
+ if ($plugin_type == Smarty::PLUGIN_FUNCTION || $plugin_type == Smarty::PLUGIN_BLOCK) {
+ return $this->callTagCompiler('private_registered_' . $plugin_type, $args, $parameter, $tag);
+ }
+ }
+ }
+ // check plugins from plugins folder
+ foreach ($this->smarty->plugin_search_order as $plugin_type) {
+ if ($plugin_type == Smarty::PLUGIN_BLOCK && $this->smarty->loadPlugin('smarty_compiler_' . $tag) && (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this))) {
+ $plugin = 'smarty_compiler_' . $tag;
+ if (is_callable($plugin)) {
+ // convert arguments format for old compiler plugins
+ $new_args = array();
+ foreach ($args as $key => $mixed) {
+ if (is_array($mixed)) {
+ $new_args = array_merge($new_args, $mixed);
+ } else {
+ $new_args[$key] = $mixed;
+ }
+ }
+ return $plugin($new_args, $this->smarty);
+ }
+ if (class_exists($plugin, false)) {
+ $plugin_object = new $plugin;
+ if (method_exists($plugin_object, 'compile')) {
+ return $plugin_object->compile($args, $this);
+ }
+ }
+ throw new SmartyException("Plugin \"{$tag}\" not callable");
+ } else {
+ if ($function = $this->getPlugin($tag, $plugin_type)) {
+ if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) {
+ return $this->callTagCompiler('private_' . $plugin_type . '_plugin', $args, $parameter, $tag, $function);
+ }
+ }
+ }
+ }
+ if (is_callable($this->smarty->default_plugin_handler_func)) {
+ $found = false;
+ // look for already resolved tags
+ foreach ($this->smarty->plugin_search_order as $plugin_type) {
+ if (isset($this->default_handler_plugins[$plugin_type][$tag])) {
+ $found = true;
+ break;
+ }
+ }
+ if (!$found) {
+ // call default handler
+ foreach ($this->smarty->plugin_search_order as $plugin_type) {
+ if ($this->getPluginFromDefaultHandler($tag, $plugin_type)) {
+ $found = true;
+ break;
+ }
+ }
+ }
+ if ($found) {
+ // if compiler function plugin call it now
+ if ($plugin_type == Smarty::PLUGIN_COMPILER) {
+ $new_args = array();
+ foreach ($args as $mixed) {
+ $new_args = array_merge($new_args, $mixed);
+ }
+ $function = $this->default_handler_plugins[$plugin_type][$tag][0];
+ if (!is_array($function)) {
+ return $function($new_args, $this);
+ } else if (is_object($function[0])) {
+ return $this->default_handler_plugins[$plugin_type][$tag][0][0]->$function[1]($new_args, $this);
+ } else {
+ return call_user_func_array($function, array($new_args, $this));
+ }
+ } else {
+ return $this->callTagCompiler('private_registered_' . $plugin_type, $args, $parameter, $tag);
+ }
+ }
+ }
+ } else {
+ // compile closing tag of block function
+ $base_tag = substr($tag, 0, -5);
+ // check if closing tag is a registered object
+ if (isset($this->smarty->registered_objects[$base_tag]) && isset($parameter['object_methode'])) {
+ $methode = $parameter['object_methode'];
+ if (in_array($methode, $this->smarty->registered_objects[$base_tag][3])) {
+ return $this->callTagCompiler('private_object_block_function', $args, $parameter, $tag, $methode);
+ } else {
+ return $this->trigger_template_error('unallowed closing tag methode "' . $methode . '" in registered object "' . $base_tag . '"', $this->lex->taglineno);
+ }
+ }
+ // registered block tag ?
+ if (isset($this->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag]) || isset($this->default_handler_plugins[Smarty::PLUGIN_BLOCK][$base_tag])) {
+ return $this->callTagCompiler('private_registered_block', $args, $parameter, $tag);
+ }
+ // block plugin?
+ if ($function = $this->getPlugin($base_tag, Smarty::PLUGIN_BLOCK)) {
+ return $this->callTagCompiler('private_block_plugin', $args, $parameter, $tag, $function);
+ }
+ // registered compiler plugin ?
+ if (isset($this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag])) {
+ // if compiler function plugin call it now
+ $args = array();
+ if (!$this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag][1]) {
+ $this->tag_nocache = true;
+ }
+ $function = $this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag][0];
+ if (!is_array($function)) {
+ return $function($args, $this);
+ } else if (is_object($function[0])) {
+ return $this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag][0][0]->$function[1]($args, $this);
+ } else {
+ return call_user_func_array($function, array($args, $this));
+ }
+ }
+ if ($this->smarty->loadPlugin('smarty_compiler_' . $tag)) {
+ $plugin = 'smarty_compiler_' . $tag;
+ if (is_callable($plugin)) {
+ return $plugin($args, $this->smarty);
+ }
+ if (class_exists($plugin, false)) {
+ $plugin_object = new $plugin;
+ if (method_exists($plugin_object, 'compile')) {
+ return $plugin_object->compile($args, $this);
+ }
+ }
+ throw new SmartyException("Plugin \"{$tag}\" not callable");
+ }
+ }
+ $this->trigger_template_error("unknown tag \"" . $tag . "\"", $this->lex->taglineno);
+ }
+ }
+
+ /**
+ * lazy loads internal compile plugin for tag and calls the compile methode
+ *
+ * compile objects cached for reuse.
+ * class name format: Smarty_Internal_Compile_TagName
+ * plugin filename format: Smarty_Internal_Tagname.php
+ *
+ * @param string $tag tag name
+ * @param array $args list of tag attributes
+ * @param mixed $param1 optional parameter
+ * @param mixed $param2 optional parameter
+ * @param mixed $param3 optional parameter
+ * @return string compiled code
+ */
+ public function callTagCompiler($tag, $args, $param1 = null, $param2 = null, $param3 = null) {
+ // re-use object if already exists
+ if (isset(self::$_tag_objects[$tag])) {
+ // compile this tag
+ return self::$_tag_objects[$tag]->compile($args, $this, $param1, $param2, $param3);
+ }
+ // lazy load internal compiler plugin
+ $class_name = 'Smarty_Internal_Compile_' . $tag;
+ if ($this->smarty->loadPlugin($class_name)) {
+ // check if tag allowed by security
+ if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) {
+ // use plugin if found
+ self::$_tag_objects[$tag] = new $class_name;
+ // compile this tag
+ return self::$_tag_objects[$tag]->compile($args, $this, $param1, $param2, $param3);
+ }
+ }
+ // no internal compile plugin for this tag
+ return false;
+ }
+
+ /**
+ * Check for plugins and return function name
+ *
+ * @param string $pugin_name name of plugin or function
+ * @param string $plugin_type type of plugin
+ * @return string call name of function
+ */
+ public function getPlugin($plugin_name, $plugin_type) {
+ $function = null;
+ if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {
+ if (isset($this->template->required_plugins['nocache'][$plugin_name][$plugin_type])) {
+ $function = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'];
+ } else if (isset($this->template->required_plugins['compiled'][$plugin_name][$plugin_type])) {
+ $this->template->required_plugins['nocache'][$plugin_name][$plugin_type] = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type];
+ $function = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'];
+ }
+ } else {
+ if (isset($this->template->required_plugins['compiled'][$plugin_name][$plugin_type])) {
+ $function = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['function'];
+ } else if (isset($this->template->required_plugins['nocache'][$plugin_name][$plugin_type])) {
+ $this->template->required_plugins['compiled'][$plugin_name][$plugin_type] = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type];
+ $function = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['function'];
+ }
+ }
+ if (isset($function)) {
+ if ($plugin_type == 'modifier') {
+ $this->modifier_plugins[$plugin_name] = true;
+ }
+ return $function;
+ }
+ // loop through plugin dirs and find the plugin
+ $function = 'smarty_' . $plugin_type . '_' . $plugin_name;
+ $file = $this->smarty->loadPlugin($function, false);
+
+ if (is_string($file)) {
+ if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {
+ $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['file'] = $file;
+ $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'] = $function;
+ } else {
+ $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['file'] = $file;
+ $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['function'] = $function;
+ }
+ if ($plugin_type == 'modifier') {
+ $this->modifier_plugins[$plugin_name] = true;
+ }
+ return $function;
+ }
+ if (is_callable($function)) {
+ // plugin function is defined in the script
+ return $function;
+ }
+ return false;
+ }
+
+ /**
+ * Check for plugins by default plugin handler
+ *
+ * @param string $tag name of tag
+ * @param string $plugin_type type of plugin
+ * @return boolean true if found
+ */
+ public function getPluginFromDefaultHandler($tag, $plugin_type) {
+ $callback = null;
+ $script = null;
+ $cacheable = true;
+ $result = call_user_func_array(
+ $this->smarty->default_plugin_handler_func, array($tag, $plugin_type, $this->template, &$callback, &$script, &$cacheable)
+ );
+ if ($result) {
+ $this->tag_nocache = $this->tag_nocache || !$cacheable;
+ if ($script !== null) {
+ if (is_file($script)) {
+ if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {
+ $this->template->required_plugins['nocache'][$tag][$plugin_type]['file'] = $script;
+ $this->template->required_plugins['nocache'][$tag][$plugin_type]['function'] = $callback;
+ } else {
+ $this->template->required_plugins['compiled'][$tag][$plugin_type]['file'] = $script;
+ $this->template->required_plugins['compiled'][$tag][$plugin_type]['function'] = $callback;
+ }
+ include_once $script;
+ } else {
+ $this->trigger_template_error("Default plugin handler: Returned script file \"{$script}\" for \"{$tag}\" not found");
+ }
+ }
+ if (!is_string($callback) && !(is_array($callback) && is_string($callback[0]) && is_string($callback[1]))) {
+ $this->trigger_template_error("Default plugin handler: Returned callback for \"{$tag}\" must be a static function name or array of class and function name");
+ }
+ if (is_callable($callback)) {
+ $this->default_handler_plugins[$plugin_type][$tag] = array($callback, true, array());
+ return true;
+ } else {
+ $this->trigger_template_error("Default plugin handler: Returned callback for \"{$tag}\" not callable");
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Inject inline code for nocache template sections
+ *
+ * This method gets the content of each template element from the parser.
+ * If the content is compiled code and it should be not cached the code is injected
+ * into the rendered output.
+ *
+ * @param string $content content of template element
+ * @param boolean $is_code true if content is compiled code
+ * @return string content
+ */
+ public function processNocacheCode($content, $is_code) {
+ // If the template is not evaluated and we have a nocache section and or a nocache tag
+ if ($is_code && !empty($content)) {
+ // generate replacement code
+ if ((!($this->template->source->recompiled) || $this->forceNocache) && $this->template->caching && !$this->suppressNocacheProcessing &&
+ ($this->nocache || $this->tag_nocache || $this->forceNocache == 2)) {
+ $this->template->has_nocache_code = true;
+ $_output = addcslashes($content,'\'\\');
+ $_output = str_replace("^#^", "'", $_output);
+ $_output = "<?php echo '/*%%SmartyNocache:{$this->nocache_hash}%%*/" . $_output . "/*/%%SmartyNocache:{$this->nocache_hash}%%*/';?>\n";
+ // make sure we include modifer plugins for nocache code
+ foreach ($this->modifier_plugins as $plugin_name => $dummy) {
+ if (isset($this->template->required_plugins['compiled'][$plugin_name]['modifier'])) {
+ $this->template->required_plugins['nocache'][$plugin_name]['modifier'] = $this->template->required_plugins['compiled'][$plugin_name]['modifier'];
+ }
+ }
+ } else {
+ $_output = $content;
+ }
+ } else {
+ $_output = $content;
+ }
+ $this->modifier_plugins = array();
+ $this->suppressNocacheProcessing = false;
+ $this->tag_nocache = false;
+ return $_output;
+ }
+
+ /**
+ * display compiler error messages without dying
+ *
+ * If parameter $args is empty it is a parser detected syntax error.
+ * In this case the parser is called to obtain information about expected tokens.
+ *
+ * If parameter $args contains a string this is used as error message
+ *
+ * @param string $args individual error message or null
+ * @param string $line line-number
+ * @throws SmartyCompilerException when an unexpected token is found
+ */
+ public function trigger_template_error($args = null, $line = null) {
+ // get template source line which has error
+ if (!isset($line)) {
+ $line = $this->lex->line;
+ }
+ $match = preg_split("/\n/", $this->lex->data);
+ $error_text = 'Syntax Error in template "' . $this->template->source->filepath . '" on line ' . $line . ' "' . htmlspecialchars(trim(preg_replace('![\t\r\n]+!', ' ', $match[$line - 1]))) . '" ';
+ if (isset($args)) {
+ // individual error message
+ $error_text .= $args;
+ } else {
+ // expected token from parser
+ $error_text .= ' - Unexpected "' . $this->lex->value . '"';
+ if (count($this->parser->yy_get_expected_tokens($this->parser->yymajor)) <= 4) {
+ foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) {
+ $exp_token = $this->parser->yyTokenName[$token];
+ if (isset($this->lex->smarty_token_names[$exp_token])) {
+ // token type from lexer
+ $expect[] = '"' . $this->lex->smarty_token_names[$exp_token] . '"';
+ } else {
+ // otherwise internal token name
+ $expect[] = $this->parser->yyTokenName[$token];
+ }
+ }
+ $error_text .= ', expected one of: ' . implode(' , ', $expect);
+ }
+ }
+ throw new SmartyCompilerException($error_text);
+ }
+
+}
+
?> \ No newline at end of file