From 2bed4110a5c7a55dd2c034b42ebda55bcf11ec77 Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Fri, 20 May 2016 20:27:29 +0000 Subject: [PATCH] update Smarty to 3.1.29 git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1841 a1433add-5e2c-0410-b055-b7f2511e0802 --- smarty.inc.php | 10 +- smarty/libs/Autoloader.php | 124 + smarty/libs/Smarty.class.php | 1300 ++-- smarty/libs/SmartyBC.class.php | 34 +- smarty/libs/debug.tpl | 57 +- smarty/libs/plugins/modifier.date_format.php | 2 +- .../libs/plugins/modifier.debug_print_var.php | 32 +- .../libs/plugins/modifier.regex_replace.php | 5 +- .../libs/plugins/modifiercompiler.escape.php | 8 +- .../plugins/modifiercompiler.strip_tags.php | 2 +- .../plugins/modifiercompiler.wordwrap.php | 6 +- .../plugins/outputfilter.trimwhitespace.php | 4 +- smarty/libs/plugins/shared.make_timestamp.php | 4 +- .../libs/sysplugins/smarty_cacheresource.php | 251 +- .../smarty_cacheresource_custom.php | 99 +- .../smarty_cacheresource_keyvaluestore.php | 96 +- .../libs/sysplugins/smarty_config_source.php | 94 - smarty/libs/sysplugins/smarty_data.php | 68 + .../smarty_internal_cacheresource_file.php | 176 +- .../smarty_internal_compile_append.php | 8 +- .../smarty_internal_compile_assign.php | 68 +- .../smarty_internal_compile_block.php | 518 +- .../smarty_internal_compile_break.php | 16 +- .../smarty_internal_compile_call.php | 56 +- .../smarty_internal_compile_capture.php | 39 +- .../smarty_internal_compile_config_load.php | 50 +- .../smarty_internal_compile_continue.php | 16 +- .../smarty_internal_compile_debug.php | 4 +- .../smarty_internal_compile_extends.php | 117 +- .../smarty_internal_compile_for.php | 60 +- .../smarty_internal_compile_foreach.php | 324 +- .../smarty_internal_compile_function.php | 208 +- .../sysplugins/smarty_internal_compile_if.php | 114 +- .../smarty_internal_compile_include.php | 377 +- .../smarty_internal_compile_include_php.php | 28 +- .../smarty_internal_compile_insert.php | 37 +- .../smarty_internal_compile_ldelim.php | 9 +- .../smarty_internal_compile_nocache.php | 25 +- ..._internal_compile_private_block_plugin.php | 22 +- ...nternal_compile_private_foreachsection.php | 220 + ...ternal_compile_private_function_plugin.php | 9 +- ...arty_internal_compile_private_modifier.php | 42 +- ..._compile_private_object_block_function.php | 23 +- ...ternal_compile_private_object_function.php | 12 +- .../smarty_internal_compile_private_php.php | 209 + ...ernal_compile_private_print_expression.php | 53 +- ...ernal_compile_private_registered_block.php | 32 +- ...al_compile_private_registered_function.php | 10 +- ...ernal_compile_private_special_variable.php | 160 +- .../smarty_internal_compile_rdelim.php | 4 +- .../smarty_internal_compile_section.php | 382 +- .../smarty_internal_compile_setfilter.php | 12 +- ...ty_internal_compile_shared_inheritance.php | 46 + .../smarty_internal_compile_while.php | 55 +- .../smarty_internal_compilebase.php | 16 +- .../sysplugins/smarty_internal_config.php | 306 - .../smarty_internal_config_file_compiler.php | 81 +- .../smarty_internal_configfilelexer.php | 399 +- .../smarty_internal_configfileparser.php | 710 +-- .../libs/sysplugins/smarty_internal_data.php | 554 +- .../libs/sysplugins/smarty_internal_debug.php | 352 +- .../smarty_internal_extension_clear.php | 126 + .../smarty_internal_extension_handler.php | 157 + .../smarty_internal_function_call_handler.php | 52 - .../smarty_internal_get_include_path.php | 46 - ...rty_internal_method_addautoloadfilters.php | 51 + ...ty_internal_method_adddefaultmodifiers.php | 42 + .../smarty_internal_method_append.php | 74 + .../smarty_internal_method_appendbyref.php | 50 + .../smarty_internal_method_assignbyref.php | 36 + .../smarty_internal_method_assignglobal.php | 43 + .../smarty_internal_method_clearallassign.php | 37 + .../smarty_internal_method_clearallcache.php | 40 + .../smarty_internal_method_clearassign.php | 44 + .../smarty_internal_method_clearcache.php | 43 + ..._internal_method_clearcompiledtemplate.php | 124 + .../smarty_internal_method_clearconfig.php | 41 + ...marty_internal_method_compileallconfig.php | 32 + ...ty_internal_method_compilealltemplates.php | 111 + .../smarty_internal_method_configload.php | 182 + .../smarty_internal_method_createdata.php | 44 + ...rty_internal_method_getautoloadfilters.php | 37 + .../smarty_internal_method_getconfigvars.php | 58 + ...marty_internal_method_getdebugtemplate.php | 35 + ...ty_internal_method_getdefaultmodifiers.php | 35 + ...ty_internal_method_getregisteredobject.php | 44 + ...arty_internal_method_getstreamvariable.php | 51 + .../smarty_internal_method_gettags.php | 62 + ...smarty_internal_method_gettemplatevars.php | 114 + .../smarty_internal_method_loadfilter.php | 77 + .../smarty_internal_method_loadplugin.php | 111 + .../smarty_internal_method_mustcompile.php | 49 + ..._internal_method_registercacheresource.php | 39 + .../smarty_internal_method_registerclass.php | 46 + ...al_method_registerdefaultconfighandler.php | 42 + ...al_method_registerdefaultpluginhandler.php | 43 + ..._method_registerdefaulttemplatehandler.php | 72 + .../smarty_internal_method_registerfilter.php | 88 + .../smarty_internal_method_registerobject.php | 71 + .../smarty_internal_method_registerplugin.php | 50 + ...marty_internal_method_registerresource.php | 44 + ...rty_internal_method_setautoloadfilters.php | 70 + ...marty_internal_method_setdebugtemplate.php | 41 + ...ty_internal_method_setdefaultmodifiers.php | 38 + .../smarty_internal_method_unloadfilter.php | 42 + ...nternal_method_unregistercacheresource.php | 40 + ...marty_internal_method_unregisterfilter.php | 42 + ...marty_internal_method_unregisterobject.php | 40 + ...marty_internal_method_unregisterplugin.php | 41 + ...rty_internal_method_unregisterresource.php | 40 + .../smarty_internal_nocache_insert.php | 4 +- .../sysplugins/smarty_internal_parsetree.php | 325 +- .../smarty_internal_parsetree_code.php | 42 + .../smarty_internal_parsetree_dq.php | 88 + .../smarty_internal_parsetree_dqcontent.php | 42 + .../smarty_internal_parsetree_tag.php | 69 + .../smarty_internal_parsetree_template.php | 128 + .../smarty_internal_parsetree_text.php | 40 + .../smarty_internal_resource_eval.php | 6 +- .../smarty_internal_resource_extends.php | 48 +- .../smarty_internal_resource_file.php | 130 +- .../smarty_internal_resource_php.php | 69 +- .../smarty_internal_resource_registered.php | 7 +- .../smarty_internal_resource_stream.php | 4 +- .../smarty_internal_resource_string.php | 6 +- .../smarty_internal_runtime_cachemodify.php | 67 + .../smarty_internal_runtime_codeframe.php | 94 + ...smarty_internal_runtime_filterhandler.php} | 32 +- .../smarty_internal_runtime_foreach.php | 47 + ...smarty_internal_runtime_getincludepath.php | 180 + .../smarty_internal_runtime_hhvm.php | 30 + .../smarty_internal_runtime_inheritance.php | 233 + .../smarty_internal_runtime_subtemplate.php | 203 + .../smarty_internal_runtime_tplfunction.php | 97 + .../smarty_internal_runtime_updatecache.php | 170 + .../smarty_internal_runtime_updatescope.php | 55 + ...arty_internal_runtime_validatecompiled.php | 86 + .../smarty_internal_runtime_var.php | 33 + ... => smarty_internal_runtime_writefile.php} | 24 +- ...smarty_internal_smartytemplatecompiler.php | 107 +- .../sysplugins/smarty_internal_template.php | 706 +-- .../smarty_internal_templatebase.php | 930 +-- .../smarty_internal_templatecompilerbase.php | 885 ++- .../smarty_internal_templatelexer.php | 1477 ++--- .../smarty_internal_templateparser.php | 5621 ++++++----------- .../smarty_internal_testinstall.php | 604 ++ .../sysplugins/smarty_internal_undefined.php | 48 + .../sysplugins/smarty_internal_utility.php | 837 --- smarty/libs/sysplugins/smarty_resource.php | 790 +-- .../sysplugins/smarty_resource_custom.php | 2 +- .../sysplugins/smarty_resource_recompiled.php | 14 + .../sysplugins/smarty_resource_uncompiled.php | 38 + smarty/libs/sysplugins/smarty_security.php | 433 +- .../sysplugins/smarty_template_cached.php | 246 + .../sysplugins/smarty_template_compiled.php | 297 + .../sysplugins/smarty_template_config.php | 97 + .../smarty_template_resource_base.php | 155 + .../sysplugins/smarty_template_source.php | 267 + .../sysplugins/smarty_undefined_variable.php | 37 + smarty/libs/sysplugins/smarty_variable.php | 47 + .../sysplugins/smartycompilerexception.php | 39 + smarty/libs/sysplugins/smartyexception.php | 15 + smarty/smarty_version | 3 +- 163 files changed, 14834 insertions(+), 12312 deletions(-) create mode 100644 smarty/libs/Autoloader.php delete mode 100644 smarty/libs/sysplugins/smarty_config_source.php create mode 100644 smarty/libs/sysplugins/smarty_data.php create mode 100644 smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php create mode 100644 smarty/libs/sysplugins/smarty_internal_compile_private_php.php create mode 100644 smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php delete mode 100644 smarty/libs/sysplugins/smarty_internal_config.php create mode 100644 smarty/libs/sysplugins/smarty_internal_extension_clear.php create mode 100644 smarty/libs/sysplugins/smarty_internal_extension_handler.php delete mode 100644 smarty/libs/sysplugins/smarty_internal_function_call_handler.php delete mode 100644 smarty/libs/sysplugins/smarty_internal_get_include_path.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_append.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_appendbyref.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_assignbyref.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_assignglobal.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_clearallassign.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_clearallcache.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_clearassign.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_clearcache.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_clearconfig.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_configload.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_createdata.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_gettags.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_loadfilter.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_loadplugin.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_mustcompile.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_registerclass.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_registerfilter.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_registerobject.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_registerplugin.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_registerresource.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php create mode 100644 smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php create mode 100644 smarty/libs/sysplugins/smarty_internal_parsetree_code.php create mode 100644 smarty/libs/sysplugins/smarty_internal_parsetree_dq.php create mode 100644 smarty/libs/sysplugins/smarty_internal_parsetree_dqcontent.php create mode 100644 smarty/libs/sysplugins/smarty_internal_parsetree_tag.php create mode 100644 smarty/libs/sysplugins/smarty_internal_parsetree_template.php create mode 100644 smarty/libs/sysplugins/smarty_internal_parsetree_text.php create mode 100644 smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php create mode 100644 smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php rename smarty/libs/sysplugins/{smarty_internal_filter_handler.php => smarty_internal_runtime_filterhandler.php} (57%) create mode 100644 smarty/libs/sysplugins/smarty_internal_runtime_foreach.php create mode 100644 smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php create mode 100644 smarty/libs/sysplugins/smarty_internal_runtime_hhvm.php create mode 100644 smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php create mode 100644 smarty/libs/sysplugins/smarty_internal_runtime_subtemplate.php create mode 100644 smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php create mode 100644 smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php create mode 100644 smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php create mode 100644 smarty/libs/sysplugins/smarty_internal_runtime_validatecompiled.php create mode 100644 smarty/libs/sysplugins/smarty_internal_runtime_var.php rename smarty/libs/sysplugins/{smarty_internal_write_file.php => smarty_internal_runtime_writefile.php} (77%) create mode 100644 smarty/libs/sysplugins/smarty_internal_testinstall.php create mode 100644 smarty/libs/sysplugins/smarty_internal_undefined.php delete mode 100644 smarty/libs/sysplugins/smarty_internal_utility.php create mode 100644 smarty/libs/sysplugins/smarty_template_cached.php create mode 100644 smarty/libs/sysplugins/smarty_template_compiled.php create mode 100644 smarty/libs/sysplugins/smarty_template_config.php create mode 100644 smarty/libs/sysplugins/smarty_template_resource_base.php create mode 100644 smarty/libs/sysplugins/smarty_template_source.php create mode 100644 smarty/libs/sysplugins/smarty_undefined_variable.php create mode 100644 smarty/libs/sysplugins/smarty_variable.php create mode 100644 smarty/libs/sysplugins/smartycompilerexception.php create mode 100644 smarty/libs/sysplugins/smartyexception.php diff --git a/smarty.inc.php b/smarty.inc.php index 3dcbf80d..f840e0e7 100644 --- a/smarty.inc.php +++ b/smarty.inc.php @@ -1,5 +1,7 @@ template->debugging = true; $incpath = dirname(__FILE__); - $this->template->template_dir = $incpath.'/templates'; - $this->template->compile_dir = $incpath.'/templates_c'; - $this->template->config_dir = $incpath.'/'.$this->template->config_dir[0]; + $this->template->setTemplateDir(dirname(__FILE__) . '/templates'); + $this->template->setCompileDir(dirname(__FILE__) . '/templates_c'); + $this->template->setConfigDir(dirname(__FILE__) . '/configs'); } public function assign($key, $value, $sanitise = true) { diff --git a/smarty/libs/Autoloader.php b/smarty/libs/Autoloader.php new file mode 100644 index 00000000..7d0c388a --- /dev/null +++ b/smarty/libs/Autoloader.php @@ -0,0 +1,124 @@ + 'Smarty.class.php', 'smartybc' => 'SmartyBC.class.php',); + + /** + * Registers Smarty_Autoloader backward compatible to older installations. + * + * @param bool $prepend Whether to prepend the autoloader or not. + */ + public static function registerBC($prepend = false) + { + /** + * register the class autoloader + */ + if (!defined('SMARTY_SPL_AUTOLOAD')) { + define('SMARTY_SPL_AUTOLOAD', 0); + } + if (SMARTY_SPL_AUTOLOAD && + set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false + ) { + $registeredAutoLoadFunctions = spl_autoload_functions(); + if (!isset($registeredAutoLoadFunctions['spl_autoload'])) { + spl_autoload_register(); + } + } else { + self::register($prepend); + } + } + + /** + * Registers Smarty_Autoloader as an SPL autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not. + */ + public static function register($prepend = false) + { + self::$SMARTY_DIR = defined('SMARTY_DIR') ? SMARTY_DIR : dirname(__FILE__) . DIRECTORY_SEPARATOR; + self::$SMARTY_SYSPLUGINS_DIR = defined('SMARTY_SYSPLUGINS_DIR') ? SMARTY_SYSPLUGINS_DIR : + self::$SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR; + if (version_compare(phpversion(), '5.3.0', '>=')) { + spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend); + } else { + spl_autoload_register(array(__CLASS__, 'autoload')); + } + } + + /** + * Handles auto loading of classes. + * + * @param string $class A class name. + */ + public static function autoload($class) + { + $_class = strtolower($class); + $file = self::$SMARTY_SYSPLUGINS_DIR . $_class . '.php'; + if (strpos($_class, 'smarty_internal_') === 0) { + if (strpos($_class, 'smarty_internal_compile_') === 0) { + if (is_file($file)) { + require $file; + } + return; + } + @include $file; + return; + } + if (preg_match('/^(smarty_(((template_(source|config|cache|compiled|resource_base))|((cached|compiled)?resource)|(variable|security)))|(smarty(bc)?)$)/', + $_class, $match)) { + if (!empty($match[3])) { + @include $file; + return; + } elseif (!empty($match[9]) && isset(self::$rootClasses[$_class])) { + $file = self::$rootClasses[$_class]; + require $file; + return; + } + } + if (0 !== strpos($_class, 'smarty')) { + return; + } + if (is_file($file)) { + require $file; + return; + } + return; + } +} diff --git a/smarty/libs/Smarty.class.php b/smarty/libs/Smarty.class.php index 832b0d30..a029f942 100644 --- a/smarty/libs/Smarty.class.php +++ b/smarty/libs/Smarty.class.php @@ -2,15 +2,17 @@ /** * Project: Smarty: the PHP compiling template engine * File: Smarty.class.php - * SVN: $Id: Smarty.class.php 4897 2014-10-14 22:29:58Z Uwe.Tews@googlemail.com $ + * * 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 @@ -19,12 +21,13 @@ * smarty-discussion-subscribe@googlegroups.com * * @link http://www.smarty.net/ - * @copyright 2008 New Digital Group, Inc. + * @copyright 2015 New Digital Group, Inc. + * @copyright 2015 Uwe Tews * @author Monte Ohrt * @author Uwe Tews * @author Rodney Rehm * @package Smarty - * @version 3.1.21 + * @version 3.1.29 */ /** @@ -53,7 +56,7 @@ if (!defined('SMARTY_PLUGINS_DIR')) { define('SMARTY_PLUGINS_DIR', SMARTY_DIR . 'plugins' . DS); } if (!defined('SMARTY_MBSTRING')) { - define('SMARTY_MBSTRING', function_exists('mb_split')); + define('SMARTY_MBSTRING', function_exists('mb_get_info')); } if (!defined('SMARTY_RESOURCE_CHAR_SET')) { // UTF-8 can only be done properly when mbstring is available! @@ -70,36 +73,41 @@ if (!defined('SMARTY_RESOURCE_DATE_FORMAT')) { } /** - * register the class autoloader + * Try loading the Smarty_Internal_Data class + * If we fail we must load Smarty's autoloader. + * Otherwise we may have a global autoloader like Composer */ -if (!defined('SMARTY_SPL_AUTOLOAD')) { - define('SMARTY_SPL_AUTOLOAD', 0); -} - -if (SMARTY_SPL_AUTOLOAD && set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false) { - $registeredAutoLoadFunctions = spl_autoload_functions(); - if (!isset($registeredAutoLoadFunctions['spl_autoload'])) { - spl_autoload_register(); +if (!class_exists('Smarty_Autoloader', false)) { + if (!class_exists('Smarty_Internal_Data', true)) { + require_once dirname(__FILE__) . '/Autoloader.php'; + Smarty_Autoloader::registerBC(); } -} else { - spl_autoload_register('smartyAutoload'); } /** * Load always needed external class files */ -include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_data.php'; -include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_templatebase.php'; -include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_template.php'; -include_once SMARTY_SYSPLUGINS_DIR . 'smarty_resource.php'; -include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_resource_file.php'; -include_once SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php'; -include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_cacheresource_file.php'; +if (!class_exists('Smarty_Internal_Data', false)) { + require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_data.php'; +} +require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_extension_handler.php'; +require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_templatebase.php'; +require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_template.php'; +require_once SMARTY_SYSPLUGINS_DIR . 'smarty_resource.php'; +require_once SMARTY_SYSPLUGINS_DIR . 'smarty_variable.php'; +require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_source.php'; +require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_resource_base.php'; /** * This is the main Smarty class * * @package Smarty + * + * @method int clearAllCache(int $exp_time = null, string $type = null) + * @method int clearCache(string $template_name, string $cache_id = null, string $compile_id = null, int $exp_time = null, string $type = null) + * @method int compileAllTemplates(Smarty $smarty, string $extension = '.tpl', bool $force_compile = false, int $time_limit = 0, int $max_errors = null) + * @method int compileAllConfig(Smarty $smarty, string $extension = '.conf', bool $force_compile = false, int $time_limit = 0, int $max_errors = null) + * */ class Smarty extends Smarty_Internal_TemplateBase { @@ -110,23 +118,36 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = 'Smarty-3.1.21-dev'; + const SMARTY_VERSION = '3.1.29'; /** * define variable scopes */ const SCOPE_LOCAL = 0; - const SCOPE_PARENT = 1; - const SCOPE_ROOT = 2; - const SCOPE_GLOBAL = 3; + + const SCOPE_PARENT = 2; + + const SCOPE_TPL_ROOT = 4; + + const SCOPE_ROOT = 8; + + const SCOPE_SMARTY = 16; + + const SCOPE_GLOBAL = 32; + + const SCOPE_BUBBLE_UP = 64; + /** * define caching modes */ const CACHING_OFF = 0; + const CACHING_LIFETIME_CURRENT = 1; + const CACHING_LIFETIME_SAVED = 2; + /** - * define constant for clearing cache files be saved expiration datees + * define constant for clearing cache files be saved expiration dates */ const CLEAR_EXPIRED = - 1; @@ -134,31 +155,66 @@ class Smarty extends Smarty_Internal_TemplateBase * define compile check modes */ const COMPILECHECK_OFF = 0; + const COMPILECHECK_ON = 1; + const COMPILECHECK_CACHEMISS = 2; + + /** + * define debug modes + */ + const DEBUG_OFF = 0; + + const DEBUG_ON = 1; + + const DEBUG_INDIVIDUAL = 2; + /** * modes for handling of "" tags in templates. */ const PHP_PASSTHRU = 0; //-> print tags as plain text + const PHP_QUOTE = 1; //-> escape tags as entities + const PHP_REMOVE = 2; //-> escape tags as entities + const PHP_ALLOW = 3; //-> escape tags as entities + /** * filter types */ const FILTER_POST = 'post'; + const FILTER_PRE = 'pre'; + const FILTER_OUTPUT = 'output'; + const FILTER_VARIABLE = 'variable'; + /** * plugin types */ const PLUGIN_FUNCTION = 'function'; + const PLUGIN_BLOCK = 'block'; + const PLUGIN_COMPILER = 'compiler'; + const PLUGIN_MODIFIER = 'modifier'; + const PLUGIN_MODIFIERCOMPILER = 'modifiercompiler'; + /** + * Resource caching modes + */ + const RESOURCE_CACHE_OFF = 0; + + const RESOURCE_CACHE_AUTOMATIC = 1; // cache template objects by rules + + const RESOURCE_CACHE_TEMPLATE = 2; // cache all template objects + + const RESOURCE_CACHE_ON = 4; // cache source and compiled resources + /**#@-*/ /** @@ -167,26 +223,31 @@ class Smarty extends Smarty_Internal_TemplateBase public static $global_tpl_vars = array(); /** - * error handler returned by set_error_hanlder() in Smarty::muteExpectedErrors() + * error handler returned by set_error_handler() in Smarty::muteExpectedErrors() */ public static $_previous_error_handler = null; + /** * contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors() */ public static $_muted_directories = array(); + /** * Flag denoting if Multibyte String functions are available */ public static $_MBSTRING = SMARTY_MBSTRING; + /** * The character set to adhere to (e.g. "UTF-8") */ public static $_CHARSET = SMARTY_RESOURCE_CHAR_SET; + /** * The date format to be used internally * (accepts date() and strftime()) */ public static $_DATE_FORMAT = SMARTY_RESOURCE_DATE_FORMAT; + /** * Flag denoting if PCRE should run in UTF-8 mode */ @@ -202,163 +263,152 @@ class Smarty extends Smarty_Internal_TemplateBase */ /** - * auto literal on delimiters with whitspace + * auto literal on delimiters with whitespace * * @var boolean */ public $auto_literal = true; + /** * display error on not assigned variables * * @var boolean */ public $error_unassigned = false; + /** - * look up relative filepaths in include_path + * look up relative file path in include_path * * @var boolean */ public $use_include_path = false; + /** * template directory * * @var array */ - private $template_dir = array(); + private $template_dir = array('./templates/'); + /** * joined template directory string used in cache keys * * @var string */ - public $joined_template_dir = null; + public $_joined_template_dir = null; + /** * joined config directory string used in cache keys * * @var string */ - public $joined_config_dir = null; + public $_joined_config_dir = null; + /** * default template handler * * @var callable */ public $default_template_handler_func = null; + /** * default config handler * * @var callable */ public $default_config_handler_func = null; + /** * default plugin handler * * @var callable */ public $default_plugin_handler_func = null; + /** * compile directory * * @var string */ - private $compile_dir = null; + private $compile_dir = './templates_c/'; + /** * plugins directory * * @var array */ - private $plugins_dir = array(); + private $plugins_dir = null; + /** * cache directory * * @var string */ - private $cache_dir = null; + private $cache_dir = './cache/'; + /** * config directory * * @var array */ - private $config_dir = array(); + private $config_dir = array('./configs/'); + /** * force template compiling? * * @var boolean */ public $force_compile = false; + /** * check template for modifications? * * @var boolean */ public $compile_check = true; + /** * use sub dirs for compiled/cached files? * * @var boolean */ public $use_sub_dirs = false; + /** * allow ambiguous resources (that are made unique by the resource handler) * * @var boolean */ public $allow_ambiguous_resources = false; - /** - * caching enabled - * - * @var boolean - */ - public $caching = false; + /** * merge compiled includes * * @var boolean */ public $merge_compiled_includes = false; - /** - * template inheritance merge compiled includes - * - * @var boolean - */ - public $inheritance_merge_compiled_includes = true; - /** - * cache lifetime in seconds - * - * @var integer - */ - public $cache_lifetime = 3600; + /** * force cache file creation * * @var boolean */ public $force_cache = false; - /** - * Set this if you want different sets of cache files for the same - * templates. - * - * @var string - */ - public $cache_id = null; - /** - * Set this if you want different sets of compiled files for the same - * templates. - * - * @var string - */ - public $compile_id = null; + /** * template left-delimiter * * @var string */ public $left_delimiter = "{"; + /** * template right-delimiter * * @var string */ public $right_delimiter = "}"; + /**#@+ * security */ @@ -370,33 +420,28 @@ class Smarty extends Smarty_Internal_TemplateBase * @see Smarty_Security */ public $security_class = 'Smarty_Security'; + /** * implementation of security class * * @var Smarty_Security */ public $security_policy = null; + /** * controls handling of PHP-blocks * * @var integer */ public $php_handling = self::PHP_PASSTHRU; + /** * controls if the php template file resource is allowed * * @var bool */ public $allow_php_templates = false; - /** - * Should compiled-templates be prevented from being called directly? - * {@internal - * Currently used by Smarty_Internal_Template only. - * }} - * - * @var boolean - */ - public $direct_access_security = true; + /**#@-*/ /** * debug mode @@ -405,6 +450,7 @@ class Smarty extends Smarty_Internal_TemplateBase * @var boolean */ public $debugging = false; + /** * This determines if debugging is enable-able from the browser. *