diff --git a/change_log.txt b/change_log.txt index 3432fe47..37602eb5 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,3 +1,26 @@ +08/08/2009 +- removed all internal calls of Smarty::instance() +- fixed code in double quoted strings + +08/05/2009 +- bugfix mb_string support +- bugfix of \n.\t etc in double quoted strings + +07/29/2009 +- added syntax for variable config vars like #$foo# + +07/28/2009 +- fixed parsing of $smarty.session vars containing objects + +07/22/2009 +- fix of "$" handling in double quoted strings + +07/21/2009 +- fix that {$smarty.current_dir} return correct value within {block} tags. + +07/20/2009 +- drop error message on unmatched {block} {/block} pairs + 07/01/2009 - fixed smarty_function_html_options call in plugin function.html_select_date.php (missing ,) diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 028bca9d..a0c196a5 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -59,8 +59,7 @@ define('SMARTY_CACHING_LIVETIME_SAVED', 2); */ if (!defined('SMARTY_EXCEPTION_HANDLER')) { define('SMARTY_EXCEPTION_HANDLER', 1); -} - +} /** * load required base class for creation of the smarty object @@ -71,6 +70,8 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sysplugins' . DIRECTORY_ * This is the main Smarty class */ class Smarty extends Smarty_Internal_TemplateBase { + // smarty instances + private static $instance = array(); // smarty version public static $_version = 'Smarty3Alpha'; // class used for templates @@ -119,13 +120,13 @@ class Smarty extends Smarty_Internal_TemplateBase { public $debugging = false; public $debugging_ctrl = 'URL'; public $smarty_debug_id = 'SMARTY_DEBUG'; - public $debug_tpl = null; + public $debug_tpl = null; // When set, smarty does uses this value as error_reporting-level. public $error_reporting = null; // config var settings public $config_overwrite = true; //Controls whether variables with the same name overwrite each other. public $config_booleanize = true; //Controls whether config values of on/true/yes and off/false/no get converted to boolean - public $config_read_hidden = true; //Controls whether hidden config sections/vars are read from the file. + public $config_read_hidden = true; //Controls whether hidden config sections/vars are read from the file. // config vars public $config_vars = array(); // assigned tpl vars @@ -187,11 +188,10 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * Class constructor, initializes basic smarty properties */ - public function __construct() + public function __construct($name = 'default') { // set instance object - self::instance($this); - + Smarty::$instance[$name] = $this; if (is_callable('mb_internal_encoding')) { $this->has_mb = true; mb_internal_encoding($this->resource_char_set); @@ -216,9 +216,9 @@ class Smarty extends Smarty_Internal_TemplateBase { $this->loadPlugin('Smarty_Internal_PluginBase'); $this->loadPlugin($this->template_class); $this->loadPlugin('Smarty_Internal_Plugin_Handler'); - $this->plugin_handler = new Smarty_Internal_Plugin_Handler; + $this->plugin_handler = new Smarty_Internal_Plugin_Handler($this); $this->loadPlugin('Smarty_Internal_Run_Filter'); - $this->filter_handler = new Smarty_Internal_Run_Filter; + $this->filter_handler = new Smarty_Internal_Run_Filter($this); if (!$this->debugging && $this->debugging_ctrl == 'URL') { if (isset($_SERVER['QUERY_STRING'])) { $_query_string = $_SERVER['QUERY_STRING']; @@ -258,16 +258,17 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * Sets a static instance of the smarty object. Retrieve with: - * $smarty = Smarty::instance(); + * $smarty = Smarty::instance($name); * * @return object reference to Smarty object */ - public static function &instance($new_instance = null) + public static function &instance($name = 'default') { - static $instance = null; - if (isset($new_instance) && is_object($new_instance)) - $instance = $new_instance; - return $instance; + if (isset(Smarty::$instance[$name])) { + return Smarty::$instance[$name]; + } else { + throw new Exception("Smarty instance $name is not existing"); + } } /** @@ -349,9 +350,9 @@ class Smarty extends Smarty_Internal_TemplateBase { if (!class_exists('Smarty_Security_Policy')) { throw new Exception("Security policy must define class 'Smarty_Security_Policy'"); } - $this->security_policy = new Smarty_Security_Policy(); + $this->security_policy = new Smarty_Security_Policy; $this->loadPlugin('Smarty_Internal_Security_Handler'); - $this->security_handler = new Smarty_Internal_Security_Handler(); + $this->security_handler = new Smarty_Internal_Security_Handler($this); $this->security = true; } else { throw new Exception("Security policy {$security_policy_file} not found"); @@ -454,7 +455,7 @@ class Smarty extends Smarty_Internal_TemplateBase { } // loop through plugin dirs and find the plugin foreach((array)$this->plugins_dir as $_plugin_dir) { - if (strpos('/\\',substr($_plugin_dir, -1)) === false) { + if (strpos('/\\', substr($_plugin_dir, -1)) === false) { $_plugin_dir .= DIRECTORY_SEPARATOR; } @@ -489,19 +490,17 @@ class Smarty extends Smarty_Internal_TemplateBase { */ public function __call($name, $args) { - $_class_name = "Smarty_Method_{$name}"; - if (!class_exists($_class_name, false)) { + if (!is_callable($name)) { $_plugin_filename = strtolower('method.' . $name . $this->php_ext); if (!file_exists($this->sysplugins_dir . $_plugin_filename)) { throw new Exception("Sysplugin file " . $_plugin_filename . " does not exist"); } require_once($this->sysplugins_dir . $_plugin_filename); - if (!class_exists($_class_name, false)) { - throw new Exception ("Sysplugin file " . $_plugin_filename . " does not define class " . $_class_name); + if (!is_callable($name)) { + throw new Exception ("Sysplugin file " . $_plugin_filename . " does not define function " . $name); } } - $_method_object = new $_class_name; - return call_user_func_array(array($_method_object, 'execute'), $args); + return call_user_func_array($name, array_merge(array($this), $args)); } } @@ -519,6 +518,7 @@ class SmartyException { echo "Code: " . $e->getCode() . "
Error: " . htmlentities($e->getMessage()) . "
" . "File: " . $e->getFile() . "
" . "Line: " . $e->getLine() . "
" +// . "Trace" . $e->getTraceAsString() . "
" . "\n"; } diff --git a/libs/plugins/modifier.debug_print_var.php b/libs/plugins/modifier.debug_print_var.php index 8b912182..bf58e35a 100644 --- a/libs/plugins/modifier.debug_print_var.php +++ b/libs/plugins/modifier.debug_print_var.php @@ -20,7 +20,7 @@ * @param integer $ * @return string */ -class Smarty_Modifier_Debug_Print_Var extends Smarty_Internal_PluginBase { +class Smarty_Modifier_Debug_Print_Var { static function execute ($var, $depth = 0, $length = 40) { $_replace = array("\n" => '\n', diff --git a/libs/sysplugins/internal.base.php b/libs/sysplugins/internal.base.php deleted file mode 100644 index 9b5ca47a..00000000 --- a/libs/sysplugins/internal.base.php +++ /dev/null @@ -1,24 +0,0 @@ -smarty = Smarty::instance(); - } -} - -?> diff --git a/libs/sysplugins/internal.cacher_inlinecode.php b/libs/sysplugins/internal.cacher_inlinecode.php index 5c6307ca..71f87c00 100644 --- a/libs/sysplugins/internal.cacher_inlinecode.php +++ b/libs/sysplugins/internal.cacher_inlinecode.php @@ -15,7 +15,12 @@ /** * Smarty Internal Plugin Cacher InlineCode Class */ -class Smarty_Internal_Cacher_InlineCode extends Smarty_Internal_PluginBase { +class Smarty_Internal_Cacher_InlineCode { + function __construct($smarty) + { + $this->smarty = $smarty; + } + /** * Inject inline code for nocache template sections * @@ -30,7 +35,7 @@ class Smarty_Internal_Cacher_InlineCode extends Smarty_Internal_PluginBase { * @return string content */ public function processNocacheCode ($content, $compiler, $tag_nocache, $is_code) - { + { // If the template is not evaluated and we have a nocache section and or a nocache tag if ($is_code) { // generate replacement code diff --git a/libs/sysplugins/internal.cacheresource_file.php b/libs/sysplugins/internal.cacheresource_file.php index e39e6ab3..48398f21 100644 --- a/libs/sysplugins/internal.cacheresource_file.php +++ b/libs/sysplugins/internal.cacheresource_file.php @@ -14,7 +14,11 @@ /** * This class does contain all necessary methods for the HTML cache on file system */ -class Smarty_Internal_CacheResource_File extends Smarty_Internal_PluginBase { +class Smarty_Internal_CacheResource_File { + function __construct($smarty) + { + $this->smarty = $smarty; + } /** * Returns the filepath of the cached template output * diff --git a/libs/sysplugins/internal.compile_config_load.php b/libs/sysplugins/internal.compile_config_load.php index 27560d48..2f51ef34 100644 --- a/libs/sysplugins/internal.compile_config_load.php +++ b/libs/sysplugins/internal.compile_config_load.php @@ -44,7 +44,7 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase { } // create config object $_output = "smarty->loadPlugin('Smarty_Internal_Config');"; - $_output .= "\$_config = new Smarty_Internal_Config($conf_file);"; + $_output .= "\$_config = new Smarty_Internal_Config($conf_file, \$_smarty_tpl->smarty);"; $_output .= "\$_config->loadConfigVars($section, $scope); ?>"; return $_output; } diff --git a/libs/sysplugins/internal.compile_eval.php b/libs/sysplugins/internal.compile_eval.php index c94b8440..22960cd0 100644 --- a/libs/sysplugins/internal.compile_eval.php +++ b/libs/sysplugins/internal.compile_eval.php @@ -32,7 +32,7 @@ class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase { } // create template object - $_output = "\$_template = new Smarty_Template ('string:'.".$_attr['var'].", \$_smarty_tpl);"; + $_output = "\$_template = new Smarty_Template ('string:'.".$_attr['var'].", \$_smarty_tpl->smarty, \$_smarty_tpl);"; //was there an assign attribute? if (isset($_assign)) { $_output .= "\$_smarty_tpl->assign($_assign,\$_smarty_tpl->smarty->fetch(\$_template));"; diff --git a/libs/sysplugins/internal.compile_extend.php b/libs/sysplugins/internal.compile_extend.php index 513a5097..ea90c6ea 100644 --- a/libs/sysplugins/internal.compile_extend.php +++ b/libs/sysplugins/internal.compile_extend.php @@ -30,7 +30,7 @@ class Smarty_Internal_Compile_Extend extends Smarty_Internal_CompileBase { // $include_file = ''; eval('$include_file = ' . $_attr['file'] . ';'); // create template object - $_template = new Smarty_Template ($include_file, $compiler->template); + $_template = new Smarty_Template ($include_file, $this->compiler->smarty, $compiler->template); // save file dependency $compiler->template->properties['file_dependency'][] = array($_template->getTemplateFilepath(), $_template->getTemplateTimestamp()); // $_old_source = preg_replace ('/' . $this->smarty->left_delimiter . 'extend\s+(?:file=)?\s*(\S+?|(["\']).+?\2)' . $this->smarty->right_delimiter . '/i', '' , $compiler->template->template_source, 1); diff --git a/libs/sysplugins/internal.compile_include.php b/libs/sysplugins/internal.compile_include.php index c43acee1..016eb4db 100644 --- a/libs/sysplugins/internal.compile_include.php +++ b/libs/sysplugins/internal.compile_include.php @@ -70,7 +70,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase { } } // create template object - $_output = "cache_id, \$_smarty_tpl->compile_id);"; + $_output = "smarty, \$_smarty_tpl, \$_smarty_tpl->cache_id, \$_smarty_tpl->compile_id);"; // delete {include} standard attributes unset($_attr['file'], $_attr['assign'], $_attr['caching_lifetime'], $_attr['nocache'], $_attr['caching'], $_attr['scope']); // remaining attributes must be assigned as smarty variable diff --git a/libs/sysplugins/internal.compile_internal_function_call.php b/libs/sysplugins/internal.compile_internal_function_call.php index 9e3a0df1..74b51b2e 100644 --- a/libs/sysplugins/internal.compile_internal_function_call.php +++ b/libs/sysplugins/internal.compile_internal_function_call.php @@ -34,7 +34,7 @@ class Smarty_Internal_Compile_Internal_Function_Call extends Smarty_Internal_Com } $_name = trim($_attr['name'], "'"); // create template object - $_output = "smarty, \$_smarty_tpl);\n"; // assign default paramter if (isset($this->smarty->template_functions[$_name]['parameter'])) { // function is already compiled diff --git a/libs/sysplugins/internal.config.php b/libs/sysplugins/internal.config.php index b7cac2af..a23de77a 100644 --- a/libs/sysplugins/internal.config.php +++ b/libs/sysplugins/internal.config.php @@ -9,15 +9,12 @@ * @subpackage Config * @author Uwe Tews */ -class Smarty_Internal_Config extends Smarty_Internal_Base { +class Smarty_Internal_Config { static $config_objects = array(); - public function __construct($config_resource) + public function __construct($config_resource, $smarty) { - parent::__construct(); - // set instance object - // self::instance($this); - // initianlize + $this->smarty = $smarty; $this->config_resource = $config_resource; $this->config_resource_type = null; $this->config_resource_name = null; @@ -77,7 +74,7 @@ class Smarty_Internal_Config extends Smarty_Internal_Base { public function buildConfigFilepath () { foreach((array)$this->smarty->config_dir as $_config_dir) { - if (strpos('/\\',substr($_config_dir, -1)) === false) { + if (strpos('/\\', substr($_config_dir, -1)) === false) { $_config_dir .= DIRECTORY_SEPARATOR; } @@ -134,7 +131,7 @@ class Smarty_Internal_Config extends Smarty_Internal_Base { } public function buildCompiledFilepath() { - $_filepath = (string)abs(crc32($this->config_resource_name)); + $_filepath = (string)abs(crc32($this->config_resource_name)); // if use_sub_dirs, break file into directories if ($this->smarty->use_sub_dirs) { $_filepath = substr($_filepath, 0, 3) . DIRECTORY_SEPARATOR @@ -201,7 +198,7 @@ class Smarty_Internal_Config extends Smarty_Internal_Base { if (!is_object($this->compiler_object)) { // load compiler $this->smarty->loadPlugin('Smarty_Internal_Config_File_Compiler'); - $this->compiler_object = new Smarty_Internal_Config_File_Compiler; + $this->compiler_object = new Smarty_Internal_Config_File_Compiler($this->smarty); } if (!is_object($this->smarty->write_file_object)) { $this->smarty->loadPlugin("Smarty_Internal_Write_File"); @@ -229,8 +226,8 @@ class Smarty_Internal_Config extends Smarty_Internal_Base { */ public function loadConfigVars ($sections = null, $scope) { - $config_data = unserialize($this->getCompiledConfig()); - // var_dump($config_data); + $config_data = unserialize($this->getCompiledConfig()); + // var_dump($config_data); // copy global config vars foreach ($config_data['vars'] as $variable => $value) { $scope->config_vars[$variable] = $value; diff --git a/libs/sysplugins/internal.config_file_compiler.php b/libs/sysplugins/internal.config_file_compiler.php index 2675bb47..796bace2 100644 --- a/libs/sysplugins/internal.config_file_compiler.php +++ b/libs/sysplugins/internal.config_file_compiler.php @@ -13,14 +13,14 @@ /** * Main config file compiler class */ -class Smarty_Internal_Config_File_Compiler extends Smarty_Internal_Base { +class Smarty_Internal_Config_File_Compiler { public $compile_error= false; /** * Initialize compiler */ - public function __construct() + public function __construct($smarty) { - parent::__construct(); + $this->smarty = $smarty; // get required plugins $this->smarty->loadPlugin('Smarty_Internal_Configfilelexer'); $this->smarty->loadPlugin('Smarty_Internal_Configfileparser'); @@ -47,7 +47,7 @@ class Smarty_Internal_Config_File_Compiler extends Smarty_Internal_Base { return true; } // init the lexer/parser to compile the config file - $lex = new Smarty_Internal_Configfilelexer($_content); + $lex = new Smarty_Internal_Configfilelexer($_content, $this->smarty); $parser = new Smarty_Internal_Configfileparser($lex, $this); // $parser->PrintTrace(); // get tokens from lexer and parse them diff --git a/libs/sysplugins/internal.configfilelexer.php b/libs/sysplugins/internal.configfilelexer.php index 3110d470..6e245251 100644 --- a/libs/sysplugins/internal.configfilelexer.php +++ b/libs/sysplugins/internal.configfilelexer.php @@ -24,14 +24,14 @@ class Smarty_Internal_Configfilelexer ); - function __construct($data) + function __construct($data, $smarty) { // set instance object self::instance($this); $this->data = $data; $this->counter = 0; $this->line = 1; - $this->smarty = Smarty::instance(); + $this->smarty = $smarty; } public static function &instance($new_instance = null) { diff --git a/libs/sysplugins/internal.configfileparser.php b/libs/sysplugins/internal.configfileparser.php index 11bb38f1..9b4a7eee 100644 --- a/libs/sysplugins/internal.configfileparser.php +++ b/libs/sysplugins/internal.configfileparser.php @@ -120,7 +120,7 @@ class Smarty_Internal_Configfileparser#line 109 "internal.configfileparser.php" // set instance object self::instance($this); $this->lex = $lex; - $this->smarty = Smarty::instance(); + $this->smarty = $compiler->smarty; $this->compiler = $compiler; $this->current_section = null; $this->hidden_section = false; diff --git a/libs/sysplugins/internal.debug.php b/libs/sysplugins/internal.debug.php index c432eee9..0c649e69 100644 --- a/libs/sysplugins/internal.debug.php +++ b/libs/sysplugins/internal.debug.php @@ -48,7 +48,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_TemplateBase { ksort($_assigned_vars); $_config_vars = $smarty->config_vars; ksort($_config_vars); - $_template = new Smarty_Template ($smarty->debug_tpl); + $_template = new Smarty_Template ($smarty->debug_tpl, $smarty); $_template->caching = false; $_template->force_compile = false; $_template->security = false; diff --git a/libs/sysplugins/internal.plugin_handler.php b/libs/sysplugins/internal.plugin_handler.php index fb2299a9..075bfbe3 100644 --- a/libs/sysplugins/internal.plugin_handler.php +++ b/libs/sysplugins/internal.plugin_handler.php @@ -10,7 +10,11 @@ /** * Smarty Internal Plugin Handler Class */ -class Smarty_Internal_Plugin_Handler extends Smarty_Internal_Base { +class Smarty_Internal_Plugin_Handler { + function __construct($smarty) + { + $this->smarty = $smarty; + } /** * Call a Smarty plugin * diff --git a/libs/sysplugins/internal.pluginbase.php b/libs/sysplugins/internal.pluginbase.php deleted file mode 100644 index 4bba2151..00000000 --- a/libs/sysplugins/internal.pluginbase.php +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/libs/sysplugins/internal.resource_file.php b/libs/sysplugins/internal.resource_file.php index 8565fb87..c7745992 100644 --- a/libs/sysplugins/internal.resource_file.php +++ b/libs/sysplugins/internal.resource_file.php @@ -12,7 +12,11 @@ /** * Smarty Internal Plugin Resource File */ -class Smarty_Internal_Resource_File extends Smarty_Internal_Base { +class Smarty_Internal_Resource_File { + public function __construct($smarty) + { + $this->smarty = $smarty; + } // classes used for compiling Smarty templates from file resource public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler'; public $template_lexer_class = 'Smarty_Internal_Templatelexer'; @@ -92,8 +96,8 @@ class Smarty_Internal_Resource_File extends Smarty_Internal_Base { */ public function getCompiledFilepath($_template) { -// $_filepath = md5($_template->resource_name); - $_filepath = (string)abs(crc32($_template->resource_name)); + // $_filepath = md5($_template->resource_name); + $_filepath = (string)abs(crc32($_template->resource_name)); // if use_sub_dirs, break file into directories if ($_template->smarty->use_sub_dirs) { $_filepath = substr($_filepath, 0, 3) . DIRECTORY_SEPARATOR @@ -111,7 +115,7 @@ class Smarty_Internal_Resource_File extends Smarty_Internal_Base { $_cache = ''; } $_compile_dir = $_template->smarty->compile_dir; - if (strpos('/\\',substr($_compile_dir, -1)) === false) { + if (strpos('/\\', substr($_compile_dir, -1)) === false) { $_compile_dir .= DIRECTORY_SEPARATOR; } return $_compile_dir . $_filepath . '.' . basename($_template->resource_name) . $_cache . $_template->smarty->php_ext; diff --git a/libs/sysplugins/internal.resource_php.php b/libs/sysplugins/internal.resource_php.php index 6b2a30ef..20583b6a 100644 --- a/libs/sysplugins/internal.resource_php.php +++ b/libs/sysplugins/internal.resource_php.php @@ -12,12 +12,13 @@ /** * Smarty Internal Plugin Resource PHP */ -class Smarty_Internal_Resource_PHP extends Smarty_Internal_Base { +class Smarty_Internal_Resource_PHP { /** * Class constructor, enable short open tags */ - public function __construct() + public function __construct($smarty) { + $this->smarty = $smarty; ini_set('short_open_tag', '1'); } /** diff --git a/libs/sysplugins/internal.resource_stream.php b/libs/sysplugins/internal.resource_stream.php index 490ddfc1..a1ad4467 100644 --- a/libs/sysplugins/internal.resource_stream.php +++ b/libs/sysplugins/internal.resource_stream.php @@ -13,7 +13,11 @@ * Smarty Internal Plugin Resource Stream */ -class Smarty_Internal_Resource_Stream extends Smarty_Internal_Base { +class Smarty_Internal_Resource_Stream { + public function __construct($smarty) + { + $this->smarty = $smarty; + } // classes used for compiling Smarty templates from file resource public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler'; public $template_lexer_class = 'Smarty_Internal_Templatelexer'; diff --git a/libs/sysplugins/internal.resource_string.php b/libs/sysplugins/internal.resource_string.php index 69198562..f5e124a1 100644 --- a/libs/sysplugins/internal.resource_string.php +++ b/libs/sysplugins/internal.resource_string.php @@ -12,7 +12,11 @@ * Smarty Internal Plugin Resource String */ -class Smarty_Internal_Resource_String extends Smarty_Internal_Base { +class Smarty_Internal_Resource_String { + public function __construct($smarty) + { + $this->smarty = $smarty; + } // classes used for compiling Smarty templates from file resource public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler'; public $template_lexer_class = 'Smarty_Internal_Templatelexer'; diff --git a/libs/sysplugins/internal.run_filter.php b/libs/sysplugins/internal.run_filter.php index 87235326..f62cbe75 100644 --- a/libs/sysplugins/internal.run_filter.php +++ b/libs/sysplugins/internal.run_filter.php @@ -13,7 +13,11 @@ /** * Class for filter processing */ -class Smarty_Internal_Run_Filter extends Smarty_Internal_Base { +class Smarty_Internal_Run_Filter { + function __construct($smarty) + { + $this->smarty = $smarty; + } /** * Run filters over content * diff --git a/libs/sysplugins/internal.security_handler.php b/libs/sysplugins/internal.security_handler.php index 9151a36a..bf2ee390 100644 --- a/libs/sysplugins/internal.security_handler.php +++ b/libs/sysplugins/internal.security_handler.php @@ -9,7 +9,11 @@ /** * This class contains all methods for security checking */ -class Smarty_Internal_Security_Handler extends Smarty_Internal_Base { +class Smarty_Internal_Security_Handler { + function __construct($smarty) + { + $this->smarty = $smarty; + } /** * Check if PHP function is trusted. * diff --git a/libs/sysplugins/internal.smartytemplatecompiler.php b/libs/sysplugins/internal.smartytemplatecompiler.php index 69c84551..ebb44ded 100644 --- a/libs/sysplugins/internal.smartytemplatecompiler.php +++ b/libs/sysplugins/internal.smartytemplatecompiler.php @@ -16,8 +16,9 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom /** * Initialize compiler */ - public function __construct($lexer_class, $parser_class) + public function __construct($lexer_class, $parser_class, $smarty) { + $this->smarty = $smarty; parent::__construct(); // get required plugins $this->smarty->loadPlugin($lexer_class); @@ -38,7 +39,7 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom tags in the templates are replaces with PHP code, then written to compiled files. */ // init the lexer/parser to compile the template - $lex = new $this->lexer_class($_content); + $lex = new $this->lexer_class($_content,$this->smarty); $parser = new $this->parser_class($lex, $this); // $parser->PrintTrace(); // get tokens from lexer and parse them diff --git a/libs/sysplugins/internal.template.php b/libs/sysplugins/internal.template.php index 0df30a04..9f610d1c 100644 --- a/libs/sysplugins/internal.template.php +++ b/libs/sysplugins/internal.template.php @@ -76,9 +76,9 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase { * @param mixed $_cache_id cache id or null * @param mixed $_compile_id compile id or null */ - public function __construct($template_resource, $_parent = null, $_cache_id = null, $_compile_id = null) + public function __construct($template_resource, $smarty, $_parent = null, $_cache_id = null, $_compile_id = null) { - $this->smarty = Smarty::instance(); + $this->smarty = $smarty; // Smarty parameter $this->cache_id = $_cache_id === null ? $this->smarty->cache_id : $_cache_id; $this->compile_id = $_compile_id === null ? $this->smarty->compile_id : $_compile_id; @@ -102,12 +102,12 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase { // load cacher if ($this->caching) { $this->smarty->loadPlugin($this->cacher_class); - $this->cacher_object = new $this->cacher_class; + $this->cacher_object = new $this->cacher_class($this->smarty); } // load cache resource if (!$this->isEvaluated() && $this->caching && !isset($this->smarty->cache_resource_objects[$this->caching_type])) { $this->smarty->loadPlugin($this->cache_resource_class); - $this->smarty->cache_resource_objects[$this->caching_type] = new $this->cache_resource_class; + $this->smarty->cache_resource_objects[$this->caching_type] = new $this->cache_resource_class($this->smarty); } if ($this->smarty->direct_access_security) { $this->dir_acc_sec_string = "\n"; @@ -296,7 +296,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase { $this->smarty->loadPlugin('Smarty_Internal_CompileBase'); $this->smarty->loadPlugin('Smarty_Internal_TemplateCompilerBase'); $this->smarty->loadPlugin($this->resource_objects[$this->resource_type]->compiler_class); - $this->compiler_object = new $this->resource_objects[$this->resource_type]->compiler_class($this->resource_objects[$this->resource_type]->template_lexer_class, $this->resource_objects[$this->resource_type]->template_parser_class); + $this->compiler_object = new $this->resource_objects[$this->resource_type]->compiler_class($this->resource_objects[$this->resource_type]->template_lexer_class, $this->resource_objects[$this->resource_type]->template_parser_class, $this->smarty); } if (!is_object($this->smarty->write_file_object)) { $this->smarty->loadPlugin("Smarty_Internal_Write_File"); @@ -548,12 +548,12 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase { // try sysplugins dir first $_resource_class = "Smarty_Internal_Resource_{$this->resource_type}"; if ($this->smarty->loadPlugin($_resource_class)) { - $this->resource_objects[$this->resource_type] = new $_resource_class; + $this->resource_objects[$this->resource_type] = new $_resource_class($this->smarty); } else { // try plugins dir $_resource_class = "Smarty_Resource_{$this->resource_type}"; if ($this->smarty->loadPlugin($_resource_class)) { - $this->resource_objects[$this->resource_type] = new $_resource_class; + $this->resource_objects[$this->resource_type] = new $_resource_class($this->smarty); } else { // try streams $_known_stream = stream_get_wrappers(); @@ -564,7 +564,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase { } if (!isset($this->resource_objects['stream'])) { $this->smarty->loadPlugin('Smarty_Internal_Resource_Stream'); - $this->resource_objects['stream'] = new Smarty_Internal_Resource_Stream; + $this->resource_objects['stream'] = new Smarty_Internal_Resource_Stream($this->smarty); } $this->resource_type = 'stream'; $this->resource_name = str_replace(':', '://', $template_resource); @@ -577,7 +577,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase { // cache template object under a unique ID // do not cache string resources if ($this->resource_type != 'string') { - $this->smarty->template_objects[$this->buildTemplateId ($this->template_resource, $this->cache_id, $this->compile_id)] = $this; + $this->smarty->template_objects[$this->buildTemplateId ($this->template_resource, $this->cache_id, $this->compile_id)] = $this; } return true; } diff --git a/libs/sysplugins/internal.templatebase.php b/libs/sysplugins/internal.templatebase.php index f8bc1798..ced47202 100644 --- a/libs/sysplugins/internal.templatebase.php +++ b/libs/sysplugins/internal.templatebase.php @@ -311,16 +311,15 @@ class Smarty_Internal_TemplateBase { public function createTemplate($template, $parent = null, $cache_id = null, $compile_id = null) { if (!is_object($template)) { - $_smarty = Smarty::instance(); // we got a template resource $_templateId = $this->buildTemplateId ($template, $cache_id, $compile_id); // already in template cache? - if (isset($_smarty->template_objects[$_templateId])) { + if (isset($this->template_objects[$_templateId])) { // return cached template object - return $_smarty->template_objects[$_templateId]; + return $this->template_objects[$_templateId]; } else { // create and cache new template object - return new Smarty_Internal_Template ($template, $parent, $cache_id, $compile_id); + return new Smarty_Internal_Template ($template, $this, $parent, $cache_id, $compile_id); } } else { // just return a copy of template class @@ -336,7 +335,7 @@ class Smarty_Internal_TemplateBase { * @param mixed $_compile_id compile id to be used with this template * @returns string a unique template id */ - public function buildTemplateId ($_resource, $_cache_id, $_compile_id) + function buildTemplateId ($_resource, $_cache_id, $_compile_id) { // return md5($_resource . md5($_cache_id) . md5($_compile_id)); return crc32($_resource . $_cache_id . $_compile_id); diff --git a/libs/sysplugins/internal.templatecompilerbase.php b/libs/sysplugins/internal.templatecompilerbase.php index 4e07eeb9..0ee4d005 100644 --- a/libs/sysplugins/internal.templatecompilerbase.php +++ b/libs/sysplugins/internal.templatecompilerbase.php @@ -11,7 +11,7 @@ /** * Main compiler class */ -class Smarty_Internal_TemplateCompilerBase extends Smarty_Internal_Base { +class Smarty_Internal_TemplateCompilerBase { // compile tag objects static $_tag_objects = array(); // tag stack @@ -24,7 +24,6 @@ class Smarty_Internal_TemplateCompilerBase extends Smarty_Internal_Base { */ public function __construct() { - parent::__construct(); // get required plugins if (!is_object($this->smarty->filter_handler) && (isset($this->smarty->autoload_filters['pre']) || isset($this->smarty->registered_filters['pre']) || isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post']))) { $this->smarty->loadPlugin('Smarty_Internal_Run_Filter'); @@ -45,7 +44,7 @@ class Smarty_Internal_TemplateCompilerBase extends Smarty_Internal_Base { then written to compiled files. */ if (!is_object($template->cacher_object)) { $this->smarty->loadPlugin($template->cacher_class); - $template->cacher_object = new $template->cacher_class; + $template->cacher_object = new $template->cacher_class($this->smarty); } // flag for nochache sections $this->nocache = false; diff --git a/libs/sysplugins/internal.templatelexer.php b/libs/sysplugins/internal.templatelexer.php index 265cc9d8..1ee71f42 100644 --- a/libs/sysplugins/internal.templatelexer.php +++ b/libs/sysplugins/internal.templatelexer.php @@ -71,14 +71,14 @@ class Smarty_Internal_Templatelexer ); - function __construct($data) + function __construct($data,$smarty) { // set instance object self::instance($this); $this->data = $data; $this->counter = 0; $this->line = 1; - $this->smarty = Smarty::instance(); + $this->smarty = $smarty; $this->ldel = preg_quote($this->smarty->left_delimiter); $this->rdel = preg_quote($this->smarty->right_delimiter); } diff --git a/libs/sysplugins/internal.templateparser.php b/libs/sysplugins/internal.templateparser.php index 302a28c8..28e10c62 100644 --- a/libs/sysplugins/internal.templateparser.php +++ b/libs/sysplugins/internal.templateparser.php @@ -120,8 +120,8 @@ class Smarty_Internal_Templateparser#line 109 "internal.templateparser.php" // set instance object self::instance($this); $this->lex = $lex; - $this->smarty = Smarty::instance(); $this->compiler = $compiler; + $this->smarty = $this->compiler->smarty; $this->template = $this->compiler->template; $this->cacher = $this->template->cacher_object; $this->nocache = false; @@ -2059,102 +2059,102 @@ static public $yy_action = array( #line 277 "internal.templateparser.y" function yy_r54(){ $this->_retvalue = "''"; } #line 2066 "internal.templateparser.php" -#line 280 "internal.templateparser.y" +#line 279 "internal.templateparser.y" function yy_r55(){ $this->_retvalue = '"'.$this->yystack[$this->yyidx + -1]->minor.'"'; } #line 2069 "internal.templateparser.php" -#line 284 "internal.templateparser.y" +#line 283 "internal.templateparser.y" function yy_r57(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'::'.$this->yystack[$this->yyidx + 0]->minor; } #line 2072 "internal.templateparser.php" -#line 285 "internal.templateparser.y" +#line 284 "internal.templateparser.y" function yy_r58(){ $this->prefix_number++; $this->prefix_code[] = 'prefix_number.'=$_smarty_tpl->getVariable(\''. $this->yystack[$this->yyidx + -3]->minor .'\')->value;?>'; $this->_retvalue = $this->yystack[$this->yyidx + -6]->minor.'::$_tmp'.$this->prefix_number.'('. $this->yystack[$this->yyidx + -1]->minor .')'; } #line 2075 "internal.templateparser.php" -#line 287 "internal.templateparser.y" +#line 286 "internal.templateparser.y" function yy_r59(){ $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor.'::'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; } #line 2078 "internal.templateparser.php" -#line 288 "internal.templateparser.y" +#line 287 "internal.templateparser.y" function yy_r60(){ $this->prefix_number++; $this->prefix_code[] = 'prefix_number.'=$_smarty_tpl->getVariable(\''. $this->yystack[$this->yyidx + -4]->minor .'\')->value;?>'; $this->_retvalue = $this->yystack[$this->yyidx + -7]->minor.'::$_tmp'.$this->prefix_number.'('. $this->yystack[$this->yyidx + -2]->minor .')'.$this->yystack[$this->yyidx + 0]->minor; } #line 2081 "internal.templateparser.php" -#line 290 "internal.templateparser.y" +#line 289 "internal.templateparser.y" function yy_r61(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'::'.$this->yystack[$this->yyidx + 0]->minor; } #line 2084 "internal.templateparser.php" -#line 292 "internal.templateparser.y" +#line 291 "internal.templateparser.y" function yy_r62(){ $this->_retvalue = $this->yystack[$this->yyidx + -4]->minor.'::$'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; } #line 2087 "internal.templateparser.php" -#line 294 "internal.templateparser.y" +#line 293 "internal.templateparser.y" function yy_r63(){ $this->_retvalue = $this->yystack[$this->yyidx + -5]->minor.'::$'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; } #line 2090 "internal.templateparser.php" -#line 301 "internal.templateparser.y" +#line 300 "internal.templateparser.y" function yy_r64(){if ($this->yystack[$this->yyidx + 0]->minor['var'] == '\'smarty\'') { $this->_retvalue = $this->compiler->compileTag('internal_smarty_var',$this->yystack[$this->yyidx + 0]->minor['index']);} else { $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + 0]->minor['var'] .')->value'.$this->yystack[$this->yyidx + 0]->minor['index']; $this->nocache=$this->template->getVariable(trim($this->yystack[$this->yyidx + 0]->minor['var'],"'"))->nocache;} } #line 2094 "internal.templateparser.php" -#line 304 "internal.templateparser.y" +#line 303 "internal.templateparser.y" function yy_r65(){ $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -2]->minor .')->'.$this->yystack[$this->yyidx + 0]->minor; $this->nocache=$this->template->getVariable(trim($this->yystack[$this->yyidx + -2]->minor,"'"))->nocache; } #line 2097 "internal.templateparser.php" -#line 308 "internal.templateparser.y" +#line 307 "internal.templateparser.y" function yy_r67(){$this->_retvalue = '$_smarty_tpl->getConfigVariable(\''. $this->yystack[$this->yyidx + -1]->minor .'\')'; } #line 2100 "internal.templateparser.php" -#line 309 "internal.templateparser.y" +#line 308 "internal.templateparser.y" function yy_r68(){$this->_retvalue = '$_smarty_tpl->getConfigVariable('. $this->yystack[$this->yyidx + -1]->minor .')'; } #line 2103 "internal.templateparser.php" -#line 312 "internal.templateparser.y" +#line 311 "internal.templateparser.y" function yy_r69(){$this->_retvalue = array('var'=>$this->yystack[$this->yyidx + -1]->minor, 'index'=>$this->yystack[$this->yyidx + 0]->minor); } #line 2106 "internal.templateparser.php" -#line 320 "internal.templateparser.y" +#line 319 "internal.templateparser.y" function yy_r71(){return; } #line 2109 "internal.templateparser.php" -#line 324 "internal.templateparser.y" +#line 323 "internal.templateparser.y" function yy_r72(){ $this->_retvalue = "['". $this->yystack[$this->yyidx + 0]->minor ."']"; } #line 2112 "internal.templateparser.php" -#line 325 "internal.templateparser.y" +#line 324 "internal.templateparser.y" function yy_r73(){ $this->_retvalue = "[". $this->yystack[$this->yyidx + 0]->minor ."]"; } #line 2115 "internal.templateparser.php" -#line 326 "internal.templateparser.y" +#line 325 "internal.templateparser.y" function yy_r74(){ $this->_retvalue = "[".$this->yystack[$this->yyidx + 0]->minor."]"; } #line 2118 "internal.templateparser.php" -#line 327 "internal.templateparser.y" +#line 326 "internal.templateparser.y" function yy_r75(){ $this->_retvalue = "[". $this->yystack[$this->yyidx + -1]->minor ."]"; } #line 2121 "internal.templateparser.php" -#line 329 "internal.templateparser.y" +#line 328 "internal.templateparser.y" function yy_r76(){ $this->_retvalue = '['.$this->compiler->compileTag('internal_smarty_var','[\'section\'][\''.$this->yystack[$this->yyidx + -1]->minor.'\'][\'index\']').']'; } #line 2124 "internal.templateparser.php" -#line 333 "internal.templateparser.y" +#line 332 "internal.templateparser.y" function yy_r78(){$this->_retvalue = ''; } #line 2127 "internal.templateparser.php" -#line 341 "internal.templateparser.y" +#line 340 "internal.templateparser.y" function yy_r80(){$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.'.'.$this->yystack[$this->yyidx + 0]->minor; } #line 2130 "internal.templateparser.php" -#line 343 "internal.templateparser.y" +#line 342 "internal.templateparser.y" function yy_r81(){$this->_retvalue = '\''.$this->yystack[$this->yyidx + 0]->minor.'\''; } #line 2133 "internal.templateparser.php" -#line 345 "internal.templateparser.y" +#line 344 "internal.templateparser.y" function yy_r82(){$this->_retvalue = '('.$this->yystack[$this->yyidx + -1]->minor.')'; } #line 2136 "internal.templateparser.php" -#line 350 "internal.templateparser.y" +#line 349 "internal.templateparser.y" function yy_r83(){ if ($this->yystack[$this->yyidx + -1]->minor['var'] == '\'smarty\'') { $this->_retvalue = $this->compiler->compileTag('internal_smarty_var',$this->yystack[$this->yyidx + -1]->minor['index']).$this->yystack[$this->yyidx + 0]->minor;} else { $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -1]->minor['var'] .')->value'.$this->yystack[$this->yyidx + -1]->minor['index'].$this->yystack[$this->yyidx + 0]->minor; $this->nocache=$this->template->getVariable(trim($this->yystack[$this->yyidx + -1]->minor['var'],"'"))->nocache;} } #line 2140 "internal.templateparser.php" -#line 354 "internal.templateparser.y" +#line 353 "internal.templateparser.y" function yy_r84(){$this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; } #line 2143 "internal.templateparser.php" -#line 356 "internal.templateparser.y" +#line 355 "internal.templateparser.y" function yy_r85(){$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; } #line 2146 "internal.templateparser.php" -#line 358 "internal.templateparser.y" +#line 357 "internal.templateparser.y" function yy_r86(){ $this->_retvalue = '->'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; } #line 2149 "internal.templateparser.php" -#line 359 "internal.templateparser.y" +#line 358 "internal.templateparser.y" function yy_r87(){ $this->_retvalue = '->{'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor.'}'; } #line 2152 "internal.templateparser.php" -#line 360 "internal.templateparser.y" +#line 359 "internal.templateparser.y" function yy_r88(){ $this->_retvalue = '->{'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}'; } #line 2155 "internal.templateparser.php" -#line 361 "internal.templateparser.y" +#line 360 "internal.templateparser.y" function yy_r89(){ $this->_retvalue = '->{\''.$this->yystack[$this->yyidx + -4]->minor.'\'.'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}'; } #line 2158 "internal.templateparser.php" -#line 363 "internal.templateparser.y" +#line 362 "internal.templateparser.y" function yy_r90(){ $this->_retvalue = '->'.$this->yystack[$this->yyidx + 0]->minor; } #line 2161 "internal.templateparser.php" -#line 369 "internal.templateparser.y" +#line 368 "internal.templateparser.y" function yy_r91(){if (!$this->template->security || $this->smarty->security_handler->isTrustedPhpFunction($this->yystack[$this->yyidx + -3]->minor, $this->compiler)) { if ($this->yystack[$this->yyidx + -3]->minor == 'isset' || $this->yystack[$this->yyidx + -3]->minor == 'empty' || $this->yystack[$this->yyidx + -3]->minor == 'array' || is_callable($this->yystack[$this->yyidx + -3]->minor)) { $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . "(". $this->yystack[$this->yyidx + -1]->minor .")"; @@ -2163,127 +2163,127 @@ static public $yy_action = array( } } } #line 2170 "internal.templateparser.php" -#line 380 "internal.templateparser.y" +#line 379 "internal.templateparser.y" function yy_r92(){ $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . "(". $this->yystack[$this->yyidx + -1]->minor .")"; } #line 2173 "internal.templateparser.php" -#line 384 "internal.templateparser.y" +#line 383 "internal.templateparser.y" function yy_r93(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.",".$this->yystack[$this->yyidx + 0]->minor; } #line 2176 "internal.templateparser.php" -#line 388 "internal.templateparser.y" +#line 387 "internal.templateparser.y" function yy_r95(){ return; } #line 2179 "internal.templateparser.php" -#line 393 "internal.templateparser.y" +#line 392 "internal.templateparser.y" function yy_r96(){ $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor,true); } #line 2182 "internal.templateparser.php" -#line 394 "internal.templateparser.y" +#line 393 "internal.templateparser.y" function yy_r97(){ $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor,false); } #line 2185 "internal.templateparser.php" -#line 401 "internal.templateparser.y" +#line 400 "internal.templateparser.y" function yy_r98(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; } #line 2188 "internal.templateparser.php" -#line 405 "internal.templateparser.y" +#line 404 "internal.templateparser.y" function yy_r100(){$this->_retvalue = ','.$this->yystack[$this->yyidx + 0]->minor; } #line 2191 "internal.templateparser.php" -#line 406 "internal.templateparser.y" +#line 405 "internal.templateparser.y" function yy_r101(){$this->_retvalue = ',\''.$this->yystack[$this->yyidx + 0]->minor.'\''; } #line 2194 "internal.templateparser.php" -#line 413 "internal.templateparser.y" +#line 412 "internal.templateparser.y" function yy_r103(){$this->_retvalue = '!'.$this->yystack[$this->yyidx + 0]->minor; } #line 2197 "internal.templateparser.php" -#line 418 "internal.templateparser.y" +#line 417 "internal.templateparser.y" function yy_r105(){$this->_retvalue =$this->yystack[$this->yyidx + 0]->minor; } #line 2200 "internal.templateparser.php" -#line 419 "internal.templateparser.y" +#line 418 "internal.templateparser.y" function yy_r106(){$this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; } #line 2203 "internal.templateparser.php" -#line 420 "internal.templateparser.y" +#line 419 "internal.templateparser.y" function yy_r107(){$this->_retvalue = 'in_array('.$this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor.')'; } #line 2206 "internal.templateparser.php" -#line 421 "internal.templateparser.y" +#line 420 "internal.templateparser.y" function yy_r108(){$this->_retvalue = 'in_array('.$this->yystack[$this->yyidx + -2]->minor.',(array)'.$this->yystack[$this->yyidx + 0]->minor.')'; } #line 2209 "internal.templateparser.php" -#line 423 "internal.templateparser.y" +#line 422 "internal.templateparser.y" function yy_r110(){$this->_retvalue = '!('.$this->yystack[$this->yyidx + -2]->minor.' % '.$this->yystack[$this->yyidx + 0]->minor.')'; } #line 2212 "internal.templateparser.php" -#line 424 "internal.templateparser.y" +#line 423 "internal.templateparser.y" function yy_r111(){$this->_retvalue = '('.$this->yystack[$this->yyidx + -2]->minor.' % '.$this->yystack[$this->yyidx + 0]->minor.')'; } #line 2215 "internal.templateparser.php" -#line 425 "internal.templateparser.y" +#line 424 "internal.templateparser.y" function yy_r112(){$this->_retvalue = '!(1 & '.$this->yystack[$this->yyidx + -1]->minor.')'; } #line 2218 "internal.templateparser.php" -#line 426 "internal.templateparser.y" +#line 425 "internal.templateparser.y" function yy_r113(){$this->_retvalue = '(1 & '.$this->yystack[$this->yyidx + -1]->minor.')'; } #line 2221 "internal.templateparser.php" -#line 427 "internal.templateparser.y" +#line 426 "internal.templateparser.y" function yy_r114(){$this->_retvalue = '!(1 & '.$this->yystack[$this->yyidx + -2]->minor.' / '.$this->yystack[$this->yyidx + 0]->minor.')'; } #line 2224 "internal.templateparser.php" -#line 428 "internal.templateparser.y" +#line 427 "internal.templateparser.y" function yy_r115(){$this->_retvalue = '(1 & '.$this->yystack[$this->yyidx + -2]->minor.' / '.$this->yystack[$this->yyidx + 0]->minor.')'; } #line 2227 "internal.templateparser.php" -#line 434 "internal.templateparser.y" +#line 433 "internal.templateparser.y" function yy_r120(){$this->_retvalue = '=='; } #line 2230 "internal.templateparser.php" -#line 435 "internal.templateparser.y" +#line 434 "internal.templateparser.y" function yy_r121(){$this->_retvalue = '!='; } #line 2233 "internal.templateparser.php" -#line 436 "internal.templateparser.y" +#line 435 "internal.templateparser.y" function yy_r122(){$this->_retvalue = '>'; } #line 2236 "internal.templateparser.php" -#line 437 "internal.templateparser.y" +#line 436 "internal.templateparser.y" function yy_r123(){$this->_retvalue = '<'; } #line 2239 "internal.templateparser.php" -#line 438 "internal.templateparser.y" +#line 437 "internal.templateparser.y" function yy_r124(){$this->_retvalue = '>='; } #line 2242 "internal.templateparser.php" -#line 439 "internal.templateparser.y" +#line 438 "internal.templateparser.y" function yy_r125(){$this->_retvalue = '<='; } #line 2245 "internal.templateparser.php" -#line 440 "internal.templateparser.y" +#line 439 "internal.templateparser.y" function yy_r126(){$this->_retvalue = '==='; } #line 2248 "internal.templateparser.php" -#line 441 "internal.templateparser.y" +#line 440 "internal.templateparser.y" function yy_r127(){$this->_retvalue = '!=='; } #line 2251 "internal.templateparser.php" -#line 443 "internal.templateparser.y" +#line 442 "internal.templateparser.y" function yy_r128(){$this->_retvalue = '&&'; } #line 2254 "internal.templateparser.php" -#line 444 "internal.templateparser.y" +#line 443 "internal.templateparser.y" function yy_r129(){$this->_retvalue = '||'; } #line 2257 "internal.templateparser.php" -#line 449 "internal.templateparser.y" +#line 448 "internal.templateparser.y" function yy_r130(){ $this->_retvalue = 'array('.$this->yystack[$this->yyidx + -1]->minor.')'; } #line 2260 "internal.templateparser.php" -#line 451 "internal.templateparser.y" +#line 450 "internal.templateparser.y" function yy_r132(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor; } #line 2263 "internal.templateparser.php" -#line 452 "internal.templateparser.y" +#line 451 "internal.templateparser.y" function yy_r133(){ return; } #line 2266 "internal.templateparser.php" -#line 454 "internal.templateparser.y" +#line 453 "internal.templateparser.y" function yy_r135(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'=>'.$this->yystack[$this->yyidx + 0]->minor; } #line 2269 "internal.templateparser.php" -#line 455 "internal.templateparser.y" +#line 454 "internal.templateparser.y" function yy_r136(){ $this->_retvalue = '\''.$this->yystack[$this->yyidx + -2]->minor.'\'=>'.$this->yystack[$this->yyidx + 0]->minor; } #line 2272 "internal.templateparser.php" -#line 462 "internal.templateparser.y" +#line 461 "internal.templateparser.y" function yy_r139(){$this->_retvalue = "`".$this->yystack[$this->yyidx + -1]->minor."`"; } #line 2275 "internal.templateparser.php" -#line 463 "internal.templateparser.y" - function yy_r140(){$this->_retvalue = "'.".$this->yystack[$this->yyidx + -1]->minor.".'"; } +#line 462 "internal.templateparser.y" + function yy_r140(){$this->_retvalue = '".'.$this->yystack[$this->yyidx + -1]->minor.'."'; } #line 2278 "internal.templateparser.php" -#line 464 "internal.templateparser.y" - function yy_r141(){$this->_retvalue = "'.".'$_smarty_tpl->getVariable(\''. $this->yystack[$this->yyidx + 0]->minor .'\')->value'.".'"; $this->nocache=$this->template->getVariable(trim($this->yystack[$this->yyidx + 0]->minor,"'"))->nocache; } +#line 463 "internal.templateparser.y" + function yy_r141(){$this->_retvalue = '".'.'$_smarty_tpl->getVariable(\''. $this->yystack[$this->yyidx + 0]->minor .'\')->value'.'."'; $this->nocache=$this->template->getVariable(trim($this->yystack[$this->yyidx + 0]->minor,"'"))->nocache; } #line 2281 "internal.templateparser.php" -#line 465 "internal.templateparser.y" - function yy_r142(){$this->_retvalue = "'.(".$this->yystack[$this->yyidx + -1]->minor.").'"; } +#line 464 "internal.templateparser.y" + function yy_r142(){$this->_retvalue = '".('.$this->yystack[$this->yyidx + -1]->minor.')."'; } #line 2284 "internal.templateparser.php" -#line 470 "internal.templateparser.y" +#line 465 "internal.templateparser.y" function yy_r143(){$this->_retvalue = '$'.$this->yystack[$this->yyidx + 0]->minor; } #line 2287 "internal.templateparser.php" -#line 471 "internal.templateparser.y" +#line 466 "internal.templateparser.y" function yy_r144(){$this->_retvalue = '{'.$this->yystack[$this->yyidx + 0]->minor; } #line 2290 "internal.templateparser.php" -#line 472 "internal.templateparser.y" +#line 467 "internal.templateparser.y" function yy_r145(){$this->_retvalue = '`'.$this->yystack[$this->yyidx + 0]->minor; } #line 2293 "internal.templateparser.php" diff --git a/libs/sysplugins/internal.write_file.php b/libs/sysplugins/internal.write_file.php index 5777fb27..490feac7 100644 --- a/libs/sysplugins/internal.write_file.php +++ b/libs/sysplugins/internal.write_file.php @@ -10,7 +10,7 @@ /** * Smarty Internal Write File Class */ -class Smarty_Internal_Write_File extends Smarty_Internal_Base { +class Smarty_Internal_Write_File { /** * Writes file in a save way to disk * diff --git a/libs/sysplugins/method.addpluginsdir.php b/libs/sysplugins/method.addpluginsdir.php index 349bf7d9..008183de 100644 --- a/libs/sysplugins/method.addpluginsdir.php +++ b/libs/sysplugins/method.addpluginsdir.php @@ -11,24 +11,17 @@ */ /** -* Smarty class addPluginsDir -* * Adds directory of plugin files +* +* @param object $smarty +* @param string $ |array $ plugins folder +* @return */ - -class Smarty_Method_AddPluginsDir extends Smarty_Internal_Base { - /** - * Adds directory of plugin files - * - * @param string|array $ plugins folder - * @return - */ - public function execute($plugins_dir) - { - $this->smarty->plugins_dir = array_merge((array)$this->smarty->plugins_dir, (array)$plugins_dir); - $this->smarty->plugins_dir = array_unique($this->smarty->plugins_dir); - return; - } +function AddPluginsDir($smarty, $plugins_dir) +{ + $smarty->plugins_dir = array_merge((array)$smarty->plugins_dir, (array)$plugins_dir); + $smarty->plugins_dir = array_unique($smarty->plugins_dir); + return; } ?> diff --git a/libs/sysplugins/method.clear_all_assign.php b/libs/sysplugins/method.clear_all_assign.php index d0104940..42a914fd 100644 --- a/libs/sysplugins/method.clear_all_assign.php +++ b/libs/sysplugins/method.clear_all_assign.php @@ -11,25 +11,19 @@ */ /** -* Smarty class Clear_All_Assign +* Delete Smarty variables * -* Delete Smarty variables at current level +* @param object $smarty +* @param object $data_object object which holds tpl_vars */ - -class Smarty_Method_Clear_All_Assign extends Smarty_Internal_Base { - /** - * Delete Smarty variables - * @param object $data_object object which holds tpl_vars - */ - public function execute($data_object = null) - { - if (isset($data_object)) { - $ptr = $data_object; - } else { - $ptr = $this->smarty; - } - $ptr->tpl_vars = array(); +function clear_all_assign($smarty, $data_object = null) +{ + if (isset($data_object)) { + $ptr = $data_object; + } else { + $ptr = $smarty; } + $ptr->tpl_vars = array(); } ?> diff --git a/libs/sysplugins/method.clear_all_cache.php b/libs/sysplugins/method.clear_all_cache.php index 945ac581..890f23b1 100644 --- a/libs/sysplugins/method.clear_all_cache.php +++ b/libs/sysplugins/method.clear_all_cache.php @@ -11,31 +11,25 @@ */ /** -* Smarty class Clear_All_Cache +* Empty cache folder * -* Empties the cache folder +* @param object $smarty +* @param integer $exp_time expiration time +* @param string $type resource type +* @return integer number of cache files deleted */ - -class Smarty_Method_Clear_All_Cache extends Smarty_Internal_Base { - /** - * Empty cache folder - * - * @param integer $exp_time expiration time - * @param string $type resource type - * @return integer number of cache files deleted - */ - public function execute($exp_time = null, $type = 'file') - { - // load cache resource - if (!isset($this->smarty->cache_resource_objects[$type])) { - $_cache_resource_class = 'Smarty_Internal_CacheResource_' . $type; - if (!$this->smarty->loadPlugin($_cache_resource_class)) { - throw new Exception("Undefined cache resource type {$type}"); - } - $this->smarty->cache_resource_objects[$type] = new $_cache_resource_class; +function clear_all_cache($smarty, $exp_time = null, $type = 'file') +{ + // load cache resource + if (!isset($smarty->cache_resource_objects[$type])) { + $_cache_resource_class = 'Smarty_Internal_CacheResource_' . $type; + if (!$smarty->loadPlugin($_cache_resource_class)) { + throw new Exception("Undefined cache resource type {$type}"); } - - return $this->smarty->cache_resource_objects[$type]->clearAll($exp_time); + $smarty->cache_resource_objects[$type] = new $_cache_resource_class($smarty); } + + return $smarty->cache_resource_objects[$type]->clearAll($exp_time); } + ?> diff --git a/libs/sysplugins/method.clear_assign.php b/libs/sysplugins/method.clear_assign.php index 4f3bed07..e4dabd29 100644 --- a/libs/sysplugins/method.clear_assign.php +++ b/libs/sysplugins/method.clear_assign.php @@ -11,34 +11,27 @@ */ /** -* Smarty class Clear_Assign +* Delete a Smarty variable or array of variables * -* Delete a Smarty variable or array of variables at current and outer levels +* @param object $smarty +* @param string $ |array $varname variable name or array of variable names +* @param object $data_object object which holds tpl_vars */ - -class Smarty_Method_Clear_Assign extends Smarty_Internal_Base { - /** - * Delete a Smarty variable or array of variables - * - * @param string|array $varname variable name or array of variable names - * @param object $data_object object which holds tpl_vars - */ - public function execute($varname, $data_object = null) - { - foreach ((array)$varname as $variable) { - if (isset($data_object)) { - $ptr = $data_object; - } else { - $ptr = $this->smarty; - } while ($ptr != null) { - if (isset($ptr->tpl_vars[$variable])) { - unset($ptr->tpl_vars[$variable]); - } - $ptr = $ptr->parent; +function clear_assign($smarty, $varname, $data_object = null) +{ + foreach ((array)$varname as $variable) { + if (isset($data_object)) { + $ptr = $data_object; + } else { + $ptr = $smarty; + } while ($ptr != null) { + if (isset($ptr->tpl_vars[$variable])) { + unset($ptr->tpl_vars[$variable]); } + $ptr = $ptr->parent; } - return; } + return; } ?> diff --git a/libs/sysplugins/method.clear_cache.php b/libs/sysplugins/method.clear_cache.php index 278756a8..bbda00ec 100644 --- a/libs/sysplugins/method.clear_cache.php +++ b/libs/sysplugins/method.clear_cache.php @@ -11,34 +11,28 @@ */ /** -* Smarty class Clear_Cache +* Empty cache for a specific template * -* Empties the cache for a specific template +* @param object $smarty +* @param string $template_name template name +* @param string $cache_id cache id +* @param string $compile_id compile id +* @param integer $exp_time expiration time +* @param string $type resource type +* @return integer number of cache files deleted */ - -class Smarty_Method_Clear_Cache extends Smarty_Internal_Base { - /** - * Empty cache for a specific template - * - * @param string $template_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer $exp_time expiration time - * @param string $type resource type - * @return integer number of cache files deleted - */ - public function execute($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = 'file') - { - // load cache resource - if (!isset($this->smarty->cache_resource_objects[$type])) { - $_cache_resource_class = 'Smarty_Internal_CacheResource_' . $type; - if (!$this->smarty->loadPlugin($_cache_resource_class)) { - throw new Exception("Undefined cache resource type {$type}"); - } - $this->smarty->cache_resource_objects[$type] = new $_cache_resource_class; +function clear_cache($smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = 'file') +{ + // load cache resource + if (!isset($smarty->cache_resource_objects[$type])) { + $_cache_resource_class = 'Smarty_Internal_CacheResource_' . $type; + if (!$smarty->loadPlugin($_cache_resource_class)) { + throw new Exception("Undefined cache resource type {$type}"); } - - return $this->smarty->cache_resource_objects[$type]->clear($template_name, $cache_id, $compile_id, $exp_time); + $smarty->cache_resource_objects[$type] = new $_cache_resource_class($smarty); } + + return $smarty->cache_resource_objects[$type]->clear($template_name, $cache_id, $compile_id, $exp_time); } + ?> diff --git a/libs/sysplugins/method.clear_compiled_tpl.php b/libs/sysplugins/method.clear_compiled_tpl.php index 58f7a687..f9675a72 100644 --- a/libs/sysplugins/method.clear_compiled_tpl.php +++ b/libs/sysplugins/method.clear_compiled_tpl.php @@ -11,62 +11,54 @@ */ /** -* Smarty class Clear_Compiled_Tpl +* Delete compiled template file * -* Deletes compiled template files +* @param string $resource_name template name +* @param string $compile_id compile id +* @param integer $exp_time expiration time +* @return integer number of template files deleted */ - -class Smarty_Method_Clear_Compiled_Tpl extends Smarty_Internal_Base { - /** - * Delete compiled template file - * - * @param string $resource_name template name - * @param string $compile_id compile id - * @param integer $exp_time expiration time - * @return integer number of template files deleted - */ - public function execute($resource_name = null, $compile_id = null, $exp_time = null) - { - $_dir_sep = $this->smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^'; - if (isset($resource_name)) { - $_resource_part_1 = $resource_name . $this->smarty->php_ext; - $_resource_part_2 = $resource_name . '.cache' . $this->smarty->php_ext; +function clear_compiled_tpl($smarty, $resource_name = null, $compile_id = null, $exp_time = null) +{ + $_dir_sep = $smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^'; + if (isset($resource_name)) { + $_resource_part_1 = $resource_name . $smarty->php_ext; + $_resource_part_2 = $resource_name . '.cache' . $smarty->php_ext; + } else { + $_resource_part = ''; + } + $_dir = $smarty->compile_dir; + if ($smarty->use_sub_dirs && isset($compile_id)) { + $_dir .= $compile_id . $_dir_sep; + } + if (isset($compile_id)) { + $_compile_id_part = $smarty->compile_dir . $compile_id . $_dir_sep; + } + $_count = 0; + $_compileDirs = new RecursiveDirectoryIterator($_dir); + $_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST); + foreach ($_compile as $_file) { + if (strpos($_file, '.svn') !== false) continue; + if ($_file->isDir()) { + if (!$_compile->isDot()) { + // delete folder if empty + @rmdir($_file->getPathname()); + } } else { - $_resource_part = ''; - } - $_dir = $this->smarty->compile_dir; - if ($this->smarty->use_sub_dirs && isset($compile_id)) { - $_dir .= $compile_id . $_dir_sep; - } - if (isset($compile_id)) { - $_compile_id_part = $this->smarty->compile_dir . $compile_id . $_dir_sep; - } - $_count = 0; - $_compileDirs = new RecursiveDirectoryIterator($_dir); - $_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST); - foreach ($_compile as $_file) { - if (strpos($_file,'.svn') !== false) continue; - if ($_file->isDir()) { - if (!$_compile->isDot()) { - // delete folder if empty - @rmdir($_file->getPathname()); - } - } else { - if ((!isset($compile_id) || substr_compare((string)$_file, $_compile_id_part, 0, strlen($_compile_id_part)) == 0) && - (!isset($resource_name) || substr_compare((string)$_file, $_resource_part_1, - strlen($_resource_part_1), strlen($_resource_part_1)) == 0 || - substr_compare((string)$_file, $_resource_part_2, - strlen($_resource_part_2), strlen($_resource_part_2)) == 0)) { - if (isset($exp_time)) { - if (time() - @filemtime($_file) >= $exp_time) { - $_count += unlink((string) $_file) ? 1 : 0; - } - } else { + if ((!isset($compile_id) || substr_compare((string)$_file, $_compile_id_part, 0, strlen($_compile_id_part)) == 0) && + (!isset($resource_name) || substr_compare((string)$_file, $_resource_part_1, - strlen($_resource_part_1), strlen($_resource_part_1)) == 0 || + substr_compare((string)$_file, $_resource_part_2, - strlen($_resource_part_2), strlen($_resource_part_2)) == 0)) { + if (isset($exp_time)) { + if (time() - @filemtime($_file) >= $exp_time) { $_count += unlink((string) $_file) ? 1 : 0; } + } else { + $_count += unlink((string) $_file) ? 1 : 0; } } } - return $_count; } + return $_count; } ?> diff --git a/libs/sysplugins/method.clear_config.php b/libs/sysplugins/method.clear_config.php index e4de64cd..6a4644d1 100644 --- a/libs/sysplugins/method.clear_config.php +++ b/libs/sysplugins/method.clear_config.php @@ -11,26 +11,19 @@ */ /** -* Smarty class Clear_Config +* Deassigns a single or all global config variables * -* Deassigns a single or all global config variables +* @param object $smarty +* @param string $varname variable name or null */ - -class Smarty_Method_Clear_Config extends Smarty_Internal_Base { - /** -* Deassigns a single or all global config variables - * - * @param string $varname variable name or null - */ - public function execute($varname = null) - { - if (isset($varname)) { - unset($this->smarty->config_vars[$varname]); - return; - } else { - $this->smarty->config_vars = array(); - return; - } +function clear_config($smarty, $varname = null) +{ + if (isset($varname)) { + unset($smarty->config_vars[$varname]); + return; + } else { + $smarty->config_vars = array(); + return; } } diff --git a/libs/sysplugins/method.config_load.php b/libs/sysplugins/method.config_load.php index bc57a8aa..f2096fa5 100644 --- a/libs/sysplugins/method.config_load.php +++ b/libs/sysplugins/method.config_load.php @@ -11,25 +11,18 @@ */ /** -* Smarty class Config_Load +* load a config file optionally load just selected sections * -* Load config file +* @param object $smarty +* @param string $config_file filename +* @param mixed $sections array of section names, single section or null */ - -class Smarty_Method_Config_Load extends Smarty_Internal_Base { - /** - * load a config file optionally load just selected sections - * - * @param string $config_file filename - * @param mixed $sections array of section names, single section or null - */ - function execute($config_file, $sections = null) - { - // load Config class - $this->smarty->loadPlugin('Smarty_Internal_Config'); - $config = new Smarty_Internal_Config($config_file); - $config->loadConfigVars($sections, $this->smarty); - } +function config_load($smarty, $config_file, $sections = null) +{ + // load Config class + $smarty->loadPlugin('Smarty_Internal_Config'); + $config = new Smarty_Internal_Config($config_file, $smarty); + $config->loadConfigVars($sections, $smarty); } ?> diff --git a/libs/sysplugins/method.disablecachemodifycheck.php b/libs/sysplugins/method.disablecachemodifycheck.php index 5a8a71a6..d6197dfd 100644 --- a/libs/sysplugins/method.disablecachemodifycheck.php +++ b/libs/sysplugins/method.disablecachemodifycheck.php @@ -11,16 +11,13 @@ */ /** -* Smarty class disableCacheModifyCheck * * Disable cache modify check */ -class Smarty_Method_disableCacheModifyCheck extends Smarty_Internal_Base { - public function execute() +function disableCacheModifyCheck($smarty) { - $this->smarty->cache_modified_check = false; + $smarty->cache_modified_check = false; return ; } -} ?> diff --git a/libs/sysplugins/method.disablecaching.php b/libs/sysplugins/method.disablecaching.php index efa92410..ba80d605 100644 --- a/libs/sysplugins/method.disablecaching.php +++ b/libs/sysplugins/method.disablecaching.php @@ -11,16 +11,12 @@ */ /** -* Smarty class disableCaching -* * Disable caching */ -class Smarty_Method_DisableCaching extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->caching = false; - return; - } +function DisableCaching() +{ + $this->smarty->caching = false; + return; } ?> diff --git a/libs/sysplugins/method.disablecompilecheck.php b/libs/sysplugins/method.disablecompilecheck.php index c46889aa..c2a33cb8 100644 --- a/libs/sysplugins/method.disablecompilecheck.php +++ b/libs/sysplugins/method.disablecompilecheck.php @@ -11,16 +11,14 @@ */ /** -* Smarty class disableCompileCheck -* * Disable compile checking +* +* @param object $smarty */ -class Smarty_Method_DisableCompileCheck extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->compile_check = false; - return; - } +function DisableCompileCheck($smarty) +{ + $smarty->compile_check = false; + return; } ?> diff --git a/libs/sysplugins/method.disableconfigbooleanize.php b/libs/sysplugins/method.disableconfigbooleanize.php index 04956b97..bae9c537 100644 --- a/libs/sysplugins/method.disableconfigbooleanize.php +++ b/libs/sysplugins/method.disableconfigbooleanize.php @@ -11,16 +11,12 @@ */ /** -* Smarty class disableConfigBooleanize -* * Disable config booleanize mode */ -class Smarty_Method_disableConfigBooleanize extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->config_booleanize = false; - return; - } +function disableConfigBooleanize($smarty) +{ + $this->smarty->config_booleanize = false; + return; } ?> diff --git a/libs/sysplugins/method.disableconfigoverwrite.php b/libs/sysplugins/method.disableconfigoverwrite.php index 98993c6c..7eed9b4f 100644 --- a/libs/sysplugins/method.disableconfigoverwrite.php +++ b/libs/sysplugins/method.disableconfigoverwrite.php @@ -11,16 +11,11 @@ */ /** -* Smarty class disableConfigOverwrite -* * Disable config overwrite mode */ -class Smarty_Method_disableConfigOverwrite extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->config_overwrite = false; - return ; - } +function disableConfigOverwrite($smarty) +{ + $smarty->config_overwrite = false; + return ; } - ?> diff --git a/libs/sysplugins/method.disableconfigreadhidden.php b/libs/sysplugins/method.disableconfigreadhidden.php index 9db5000a..a74a9e7f 100644 --- a/libs/sysplugins/method.disableconfigreadhidden.php +++ b/libs/sysplugins/method.disableconfigreadhidden.php @@ -11,16 +11,11 @@ */ /** -* Smarty class disableConfigReadHidden -* * Disable config read hidden mode */ -class Smarty_Method_disableConfigReadHidden extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->config_read_hidden = false; - return; - } +function disableConfigReadHidden ($smarty) +{ + $this->smarty->config_read_hidden = false; + return; } - ?> diff --git a/libs/sysplugins/method.disabledebugging.php b/libs/sysplugins/method.disabledebugging.php index 3cd1b597..752351cf 100644 --- a/libs/sysplugins/method.disabledebugging.php +++ b/libs/sysplugins/method.disabledebugging.php @@ -11,16 +11,11 @@ */ /** -* Smarty class disableDebugging -* * Disable debugging */ -class Smarty_Method_DisableDebugging extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->debugging = false; - return; - } +function disableDebugging($smarty) +{ + $smarty->debugging = false; + return; } - ?> diff --git a/libs/sysplugins/method.disabledebuggingurlctrl.php b/libs/sysplugins/method.disabledebuggingurlctrl.php index 6cb873c8..37d56966 100644 --- a/libs/sysplugins/method.disabledebuggingurlctrl.php +++ b/libs/sysplugins/method.disabledebuggingurlctrl.php @@ -11,16 +11,12 @@ */ /** -* Smarty class disableDebuggingUrlCtrl -* * Disable possibility to Disable debugging by SMARTY_DEBUG attribute */ -class Smarty_Method_disableDebuggingUrlCtrl extends Smarty_Internal_Base { - public function execute() +function disableDebuggingUrlCtrl($smarty) { - $this->smarty->debugging_ctrl = 'none'; + $smarty->debugging_ctrl = 'none'; return; } -} ?> diff --git a/libs/sysplugins/method.disabledefaulttimezone.php b/libs/sysplugins/method.disabledefaulttimezone.php index 688a0b78..d989141f 100644 --- a/libs/sysplugins/method.disabledefaulttimezone.php +++ b/libs/sysplugins/method.disabledefaulttimezone.php @@ -11,16 +11,12 @@ */ /** -* Smarty class disableDefaultTimezone -* * Disable setting of default timezone */ -class Smarty_Method_disableDefaultTimezone extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->set_timezone = false; - return; - } +function disableDefaultTimezone($smarty) +{ + $smarty->set_timezone = false; + return; } ?> diff --git a/libs/sysplugins/method.disableforcecompile.php b/libs/sysplugins/method.disableforcecompile.php index c3798d44..710497e7 100644 --- a/libs/sysplugins/method.disableforcecompile.php +++ b/libs/sysplugins/method.disableforcecompile.php @@ -11,16 +11,12 @@ */ /** -* Smarty class disableForceCompile -* * Disable forced compiling */ -class Smarty_Method_DisableForceCompile extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->force_compile = false; - return; - } +function disableForceCompile($smarty) +{ + $smarty->force_compile = false; + return; } ?> diff --git a/libs/sysplugins/method.disablevariablefilter.php b/libs/sysplugins/method.disablevariablefilter.php index 45aef81e..d3b74378 100644 --- a/libs/sysplugins/method.disablevariablefilter.php +++ b/libs/sysplugins/method.disablevariablefilter.php @@ -11,16 +11,12 @@ */ /** -* Smarty class disableVariableFilter -* * Disable filter on variable output */ -class Smarty_Method_disableVariableFilter extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->variable_filter = false; - return; - } +function disableVariableFilter($smarty) +{ + $smarty->variable_filter = false; + return; } ?> diff --git a/libs/sysplugins/method.enablecachemodifycheck.php b/libs/sysplugins/method.enablecachemodifycheck.php index c5baee02..b1bb97fa 100644 --- a/libs/sysplugins/method.enablecachemodifycheck.php +++ b/libs/sysplugins/method.enablecachemodifycheck.php @@ -11,16 +11,12 @@ */ /** -* Smarty class enableCacheModifyCheck -* * Enable cache modify check */ -class Smarty_Method_enableCacheModifyCheck extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->cache_modified_check = true; - return; - } +function enableCacheModifyCheck($smarty) +{ + $smarty->cache_modified_check = true; + return; } ?> diff --git a/libs/sysplugins/method.enablecompilecheck.php b/libs/sysplugins/method.enablecompilecheck.php index d2ded7f8..178c7e13 100644 --- a/libs/sysplugins/method.enablecompilecheck.php +++ b/libs/sysplugins/method.enablecompilecheck.php @@ -11,16 +11,12 @@ */ /** -* Smarty class enableCompileCheck -* * Enable compile checking */ -class Smarty_Method_EnableCompileCheck extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->compile_check = true; - return; - } +function enableCompileCheck($smarty) +{ + $smarty->compile_check = true; + return; } ?> diff --git a/libs/sysplugins/method.enableconfigbooleanize.php b/libs/sysplugins/method.enableconfigbooleanize.php index 920eb361..df765ee7 100644 --- a/libs/sysplugins/method.enableconfigbooleanize.php +++ b/libs/sysplugins/method.enableconfigbooleanize.php @@ -11,16 +11,12 @@ */ /** -* Smarty class enableConfigBooleanize -* * Enable config booleanize mode */ -class Smarty_Method_enableConfigBooleanize extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->config_booleanize = true; - return; - } +function enableConfigBooleanize($smarty) +{ + $smarty->config_booleanize = true; + return; } ?> diff --git a/libs/sysplugins/method.enableconfigoverwrite.php b/libs/sysplugins/method.enableconfigoverwrite.php index a56f952a..9d4bb59b 100644 --- a/libs/sysplugins/method.enableconfigoverwrite.php +++ b/libs/sysplugins/method.enableconfigoverwrite.php @@ -11,16 +11,12 @@ */ /** -* Smarty class enableConfigOverwrite -* * Enable config overwrite mode */ -class Smarty_Method_enableConfigOverwrite extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->config_overwrite = true; - return; - } +public function enableConfigOverwrite($smarty) +{ + $smarty->config_overwrite = true; + return; } ?> diff --git a/libs/sysplugins/method.enableconfigreadhidden.php b/libs/sysplugins/method.enableconfigreadhidden.php index b78b41ee..c9d0cdf3 100644 --- a/libs/sysplugins/method.enableconfigreadhidden.php +++ b/libs/sysplugins/method.enableconfigreadhidden.php @@ -11,16 +11,12 @@ */ /** -* Smarty class enableConfigReadHidden -* * Enable config read hidden mode */ -class Smarty_Method_enableConfigReadHidden extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->config_read_hidden = true; - return; - } +function enableConfigReadHidden($smarty) +{ + $this->smarty->config_read_hidden = true; + return; } ?> diff --git a/libs/sysplugins/method.enabledebugging.php b/libs/sysplugins/method.enabledebugging.php index ec534749..8ee66cc6 100644 --- a/libs/sysplugins/method.enabledebugging.php +++ b/libs/sysplugins/method.enabledebugging.php @@ -11,16 +11,12 @@ */ /** -* Smarty class enableDebugging -* * Enable debugging */ -class Smarty_Method_EnableDebugging extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->debugging = true; - return; - } +public function enableDebugging($smarty) +{ + $this->smarty->debugging = true; + return; } ?> diff --git a/libs/sysplugins/method.enabledebuggingurlctrl.php b/libs/sysplugins/method.enabledebuggingurlctrl.php index 219b718a..535db4b6 100644 --- a/libs/sysplugins/method.enabledebuggingurlctrl.php +++ b/libs/sysplugins/method.enabledebuggingurlctrl.php @@ -11,16 +11,12 @@ */ /** -* Smarty class enableDebuggingUrlCtrl -* * Enable possibility to enable debugging by SMARTY_DEBUG attribute */ -class Smarty_Method_EnableDebuggingUrlCtrl extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->debugging_ctrl = 'URL'; - return; - } +function enableDebuggingUrlCtrl($smarty) +{ + $smarty->debugging_ctrl = 'URL'; + return; } ?> diff --git a/libs/sysplugins/method.enabledefaulttimezone.php b/libs/sysplugins/method.enabledefaulttimezone.php index 6c1f50a4..0f3a25ad 100644 --- a/libs/sysplugins/method.enabledefaulttimezone.php +++ b/libs/sysplugins/method.enabledefaulttimezone.php @@ -11,16 +11,12 @@ */ /** -* Smarty class enableDefaultTimezone -* * Enable setting of default timezone */ -class Smarty_Method_enableDefaultTimezone extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->set_timezone = true; - return; - } +function enableDefaultTimezone($smarty) +{ + $this->smarty->set_timezone = true; + return; } ?> diff --git a/libs/sysplugins/method.enableforcecompile.php b/libs/sysplugins/method.enableforcecompile.php index a2ca55d3..7e3d8d83 100644 --- a/libs/sysplugins/method.enableforcecompile.php +++ b/libs/sysplugins/method.enableforcecompile.php @@ -11,16 +11,12 @@ */ /** -* Smarty class enableForceCompile -* * Enable forced compiling */ -class Smarty_Method_enableForceCompile extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->force_compile = true; - return; - } +public function enableForceCompile($smarty) +{ + $smarty->force_compile = true; + return; } ?> diff --git a/libs/sysplugins/method.enablevariablefilter.php b/libs/sysplugins/method.enablevariablefilter.php index cd5f58aa..0b5f9a3f 100644 --- a/libs/sysplugins/method.enablevariablefilter.php +++ b/libs/sysplugins/method.enablevariablefilter.php @@ -11,16 +11,12 @@ */ /** -* Smarty class enableVariableFilter -* * Enable filter on variable output */ -class Smarty_Method_enableVariableFilter extends Smarty_Internal_Base { - public function execute() - { - $this->smarty->variable_filter = true; - return; - } +function enableVariableFilter($smarty) +{ + $smarty->variable_filter = true; + return; } ?> diff --git a/libs/sysplugins/method.get_config_vars.php b/libs/sysplugins/method.get_config_vars.php index f59c95bb..f6cc4662 100644 --- a/libs/sysplugins/method.get_config_vars.php +++ b/libs/sysplugins/method.get_config_vars.php @@ -11,29 +11,25 @@ */ /** -* Smarty class Get_Config_Vars -* * Returns a single or all global config variables */ -class Smarty_Method_Get_Config_Vars extends Smarty_Internal_Base { - /** - * Returns a single or all global config variables - * - * @param string $varname variable name or null - * @return string variable value or or array of variables - */ - public function execute($varname = null) - { - if (isset($varname)) { - if (isset($this->smarty->config_vars[$varname])) { - return $this->smarty->config_vars[$varname]; - } else { - return ''; - } +/** +* Returns a single or all global config variables +* +* @param string $varname variable name or null +* @return string variable value or or array of variables +*/ +function Get_Config_Vars($smarty, $varname = null) +{ + if (isset($varname)) { + if (isset($smarty->config_vars[$varname])) { + return $smarty->config_vars[$varname]; } else { - return $this->smarty->config_vars; + return ''; } + } else { + return $smarty->config_vars; } } diff --git a/libs/sysplugins/method.get_global.php b/libs/sysplugins/method.get_global.php index 305a6af2..410ea184 100644 --- a/libs/sysplugins/method.get_global.php +++ b/libs/sysplugins/method.get_global.php @@ -11,33 +11,26 @@ */ /** -* Smarty class Get_Global -* * Returns a single or all global variables +* +* @param object $smarty +* @param string $varname variable name or null +* @return string variable value or or array of variables */ - -class Smarty_Method_Get_Global extends Smarty_Internal_Base { - /** - * Returns a single or all global variables - * - * @param string $varname variable name or null - * @return string variable value or or array of variables - */ - public function execute($varname = null) - { - if (isset($varname)) { - if (isset($this->smarty->global_tpl_vars[$varname])) { - return $this->smarty->global_tpl_vars[$varname]->value; - } else { - return ''; - } +function get_global($smarty, $varname = null) +{ + if (isset($varname)) { + if (isset($smarty->global_tpl_vars[$varname])) { + return $smarty->global_tpl_vars[$varname]->value; } else { - $_result = array(); - foreach ($this->smarty->global_tpl_vars AS $key => $var) { - $_result[$key] = $var->value; - } - return $_result; + return ''; } + } else { + $_result = array(); + foreach ($smarty->global_tpl_vars AS $key => $var) { + $_result[$key] = $var->value; + } + return $_result; } } diff --git a/libs/sysplugins/method.get_registered_object.php b/libs/sysplugins/method.get_registered_object.php index b88cc63a..a704df06 100644 --- a/libs/sysplugins/method.get_registered_object.php +++ b/libs/sysplugins/method.get_registered_object.php @@ -11,27 +11,24 @@ */ /** -* Smarty class Get_Registered_Object -* * Returns a reference to a registered object */ -class Smarty_Method_Get_Registered_Object extends Smarty_Internal_Base { - /** - * return a reference to a registered object - * - * @param string $name - * @return object - */ - public function execute($name) { - if (!isset($this->smarty->registered_objects[$name])) +/** +* return a reference to a registered object +* +* @param string $name +* @return object +*/ +function get_registered_object($smarty, $name) +{ + if (!isset($smarty->registered_objects[$name])) throw new Exception("'$name' is not a registered object"); - if (!is_object($this->smarty->registered_objects[$name][0])) + if (!is_object($smarty->registered_objects[$name][0])) throw new Exception("registered '$name' is not an object"); - return $this->smarty->registered_objects[$name][0]; - } + return $smarty->registered_objects[$name][0]; } ?> diff --git a/libs/sysplugins/method.get_template_vars.php b/libs/sysplugins/method.get_template_vars.php index 4785adac..5851f92b 100644 --- a/libs/sysplugins/method.get_template_vars.php +++ b/libs/sysplugins/method.get_template_vars.php @@ -11,49 +11,45 @@ */ /** -* Smarty class Get_Template_Vars -* * Returns a single or all template variables */ -class Smarty_Method_Get_Template_Vars extends Smarty_Internal_Base { - /** - * Returns a single or all template variables - * - * @param string $varname variable name or null - * @return string variable value or or array of variables - */ - public function execute($varname = null, $_ptr = null, $search_parents = true) - { - if (isset($varname)) { - $_var = $this->smarty->getVariable($varname, $_ptr, $search_parents); - if (is_object($_var)) { - return $_var->value; - } else { - return null; - } +/** +* Returns a single or all template variables +* +* @param string $varname variable name or null +* @return string variable value or or array of variables +*/ +function get_template_vars($smarty, $varname = null, $_ptr = null, $search_parents = true) +{ + if (isset($varname)) { + $_var = $smarty->getVariable($varname, $_ptr, $search_parents); + if (is_object($_var)) { + return $_var->value; } else { - $_result = array(); - if ($_ptr === null) { - $_ptr = $this->smarty; - } while ($_ptr !== null) { - foreach ($_ptr->tpl_vars AS $key => $var) { - $_result[$key] = $var->value; - } - // not found, try at parent - if ($search_parents) { - $_ptr = $_ptr->parent; - } else { - $_ptr = null; - } - } - if ($search_parents) { - foreach ($this->smarty->global_tpl_vars AS $key => $var) { - $_result[$key] = $var->value; - } - } - return $_result; + return null; } + } else { + $_result = array(); + if ($_ptr === null) { + $_ptr = $smarty; + } while ($_ptr !== null) { + foreach ($_ptr->tpl_vars AS $key => $var) { + $_result[$key] = $var->value; + } + // not found, try at parent + if ($search_parents) { + $_ptr = $_ptr->parent; + } else { + $_ptr = null; + } + } + if ($search_parents) { + foreach ($smarty->global_tpl_vars AS $key => $var) { + $_result[$key] = $var->value; + } + } + return $_result; } } diff --git a/libs/sysplugins/method.getcachedir.php b/libs/sysplugins/method.getcachedir.php index 229f8e10..56a59f2c 100644 --- a/libs/sysplugins/method.getcachedir.php +++ b/libs/sysplugins/method.getcachedir.php @@ -11,21 +11,17 @@ */ /** -* Smarty class getCacheDir -* * Returns directory of cache files */ -class Smarty_Method_GetCacheDir extends Smarty_Internal_Base { - /** - * Returns directory of cache files - * - * @return array cache folder - */ - public function execute() - { - return $this->smarty->cache_dir; - } +/** +* Returns directory of cache files +* +* @return array cache folder +*/ +public function getCacheDir($smarty) +{ + return $this->smarty->cache_dir; } ?> diff --git a/libs/sysplugins/method.getcachelifetime.php b/libs/sysplugins/method.getcachelifetime.php index 56a035c3..a05796fa 100644 --- a/libs/sysplugins/method.getcachelifetime.php +++ b/libs/sysplugins/method.getcachelifetime.php @@ -15,16 +15,14 @@ * * Returns lifetime of cache files */ -class Smarty_Method_GetCacheLifetime extends Smarty_Internal_Base { - /** +/** * Returns lifetime of cache files - * - * @return integer cache file lifetime - */ - public function execute() - { - return $this->smarty->cache_lifetime; - } +* +* @return integer cache file lifetime +*/ +function getCacheLifetime($smarty) +{ + return $smarty->cache_lifetime; } ?> diff --git a/libs/sysplugins/method.getcompiledir.php b/libs/sysplugins/method.getcompiledir.php index c2cf9b55..5a9da46f 100644 --- a/libs/sysplugins/method.getcompiledir.php +++ b/libs/sysplugins/method.getcompiledir.php @@ -11,21 +11,17 @@ */ /** -* Smarty class getCompileDir -* * Returns directory of compiled templates */ -class Smarty_Method_GetCompileDir extends Smarty_Internal_Base { - /** +/** * Returns directory of compiled templates - * - * @return array compiled template folder - */ - public function execute() - { - return $this->smarty->compile_dir; - } +* +* @return array compiled template folder +*/ +function GetCompileDir($smarty) +{ + return $this->smarty->compile_dir; } ?> diff --git a/libs/sysplugins/method.getconfigdir.php b/libs/sysplugins/method.getconfigdir.php index afae9f83..76244115 100644 --- a/libs/sysplugins/method.getconfigdir.php +++ b/libs/sysplugins/method.getconfigdir.php @@ -11,21 +11,17 @@ */ /** -* Smarty class getConfigDir -* * Returns directory of config files */ -class Smarty_Method_GetConfigDir extends Smarty_Internal_Base { - /** - * Returns directory of config files - * - * @return array config folder - */ - public function execute() - { - return $this->smarty->config_dir; - } +/** +* Returns directory of config files +* +* @return array config folder +*/ +function getConfigDir($smarty) +{ + return $smarty->config_dir; } ?> diff --git a/libs/sysplugins/method.getdebugtemplate.php b/libs/sysplugins/method.getdebugtemplate.php index 1f43febf..dcc422e3 100644 --- a/libs/sysplugins/method.getdebugtemplate.php +++ b/libs/sysplugins/method.getdebugtemplate.php @@ -11,21 +11,17 @@ */ /** -* Smarty class getDebugTemplate -* * Returns debug template filepath */ -class Smarty_Method_GetDebugTemplate extends Smarty_Internal_Base { - /** - * Returns directory of cache files - * - * @return string debug template filepath - */ - public function execute() - { - return $this->smarty->debug_tpl; - } +/** +* Returns directory of cache files +* +* @return string debug template filepath +*/ +function GetDebugTemplate($smarty) +{ + return $smarty->debug_tpl; } ?> diff --git a/libs/sysplugins/method.getpluginsdir.php b/libs/sysplugins/method.getpluginsdir.php index aee86943..3abed526 100644 --- a/libs/sysplugins/method.getpluginsdir.php +++ b/libs/sysplugins/method.getpluginsdir.php @@ -11,21 +11,17 @@ */ /** -* Smarty class getPluginsDir -* * Returns directory of plugins */ -class Smarty_Method_GetPluginsDir extends Smarty_Internal_Base { - /** - * Returns directory of plugins - * - * @return array plugins folder - */ - public function execute() - { - return $this->smarty->plugins_dir; - } +/** +* Returns directory of plugins +* +* @return array plugins folder +*/ +function getPluginsDir($smarty) +{ + return $smarty->plugins_dir; } ?> diff --git a/libs/sysplugins/method.gettemplatedir.php b/libs/sysplugins/method.gettemplatedir.php index 9388cedb..6d59a7d0 100644 --- a/libs/sysplugins/method.gettemplatedir.php +++ b/libs/sysplugins/method.gettemplatedir.php @@ -11,21 +11,17 @@ */ /** -* Smarty class getTemplate_dir -* * Returns template directory */ -class Smarty_Method_GetTemplateDir extends Smarty_Internal_Base { - /** - * Returns template directory - * - * @return array template folders - */ - public function execute() - { - return $this->smarty->template_dir; - } +/** +* Returns template directory +* +* @return array template folders +*/ +function getTemplateDir($smarty) +{ + return $smarty->template_dir; } ?> diff --git a/libs/sysplugins/method.getvariablefilter.php b/libs/sysplugins/method.getvariablefilter.php index 7613fd7e..f6ce1293 100644 --- a/libs/sysplugins/method.getvariablefilter.php +++ b/libs/sysplugins/method.getvariablefilter.php @@ -15,11 +15,9 @@ * * get status of filter on variable output */ -class Smarty_Method_getVariableFilter extends Smarty_Internal_Base { - public function execute() - { - return $this->smarty->variable_filter; - } +function getVariableFilter($smarty) +{ + return $smarty->variable_filter; } ?> diff --git a/libs/sysplugins/method.iscachemodifycheck.php b/libs/sysplugins/method.iscachemodifycheck.php index 7a26908c..f9976a8d 100644 --- a/libs/sysplugins/method.iscachemodifycheck.php +++ b/libs/sysplugins/method.iscachemodifycheck.php @@ -11,15 +11,11 @@ */ /** -* Smarty class isCacheModifyCheck -* * is cache modify check */ -class Smarty_Method_isCacheModifyCheck extends Smarty_Internal_Base { - public function execute() - { - return $this->smarty->cache_modified_check; - } +function isCacheModifyCheck() +{ + return $smarty->cache_modified_check; } ?> diff --git a/libs/sysplugins/method.iscaching.php b/libs/sysplugins/method.iscaching.php index c8d8d84d..bebfb58a 100644 --- a/libs/sysplugins/method.iscaching.php +++ b/libs/sysplugins/method.iscaching.php @@ -11,15 +11,11 @@ */ /** -* Smarty class isCaching -* * is caching */ -class Smarty_Method_isCaching extends Smarty_Internal_Base { - public function execute() - { - return $this->smarty->caching; - } +function isCaching($smarty) +{ + return $smarty->caching; } ?> diff --git a/libs/sysplugins/method.iscompilecheck.php b/libs/sysplugins/method.iscompilecheck.php index d41fe7ac..297ddb52 100644 --- a/libs/sysplugins/method.iscompilecheck.php +++ b/libs/sysplugins/method.iscompilecheck.php @@ -11,15 +11,11 @@ */ /** -* Smarty class isCompileCheck -* * is compile checking */ -class Smarty_Method_isCompileCheck extends Smarty_Internal_Base { - public function execute() - { - return $this->smarty->compile_check; - } +function isCompileCheck($smarty) +{ + return $smarty->compile_check; } ?> diff --git a/libs/sysplugins/method.isconfigbooleanize.php b/libs/sysplugins/method.isconfigbooleanize.php index 760ed051..68c7f567 100644 --- a/libs/sysplugins/method.isconfigbooleanize.php +++ b/libs/sysplugins/method.isconfigbooleanize.php @@ -11,15 +11,11 @@ */ /** -* Smarty class isConfigBooleanize -* * is config booleanize mode */ -class Smarty_Method_isConfigBooleanize extends Smarty_Internal_Base { - public function execute() - { - return $this->smarty->config_booleanize; - } +public function isConfigBooleanize($smarty) +{ + return $smarty->config_booleanize; } ?> diff --git a/libs/sysplugins/method.isconfigoverwrite.php b/libs/sysplugins/method.isconfigoverwrite.php index aebea554..28931cd3 100644 --- a/libs/sysplugins/method.isconfigoverwrite.php +++ b/libs/sysplugins/method.isconfigoverwrite.php @@ -11,16 +11,11 @@ */ /** -* Smarty class isConfigOverwrite -* * is config overwrite mode */ -class Smarty_Method_isConfigOverwrite extends Smarty_Internal_Base { - public function execute() - { - return $this->smarty->config_overwrite; - - } +function isConfigOverwrite($smarty) +{ + return $smarty->config_overwrite; } ?> diff --git a/libs/sysplugins/method.isconfigreadhidden.php b/libs/sysplugins/method.isconfigreadhidden.php index ceab8d7e..47c6c771 100644 --- a/libs/sysplugins/method.isconfigreadhidden.php +++ b/libs/sysplugins/method.isconfigreadhidden.php @@ -11,15 +11,11 @@ */ /** -* Smarty class isConfigReadHidden * * is config read hidden mode */ -class Smarty_Method_isConfigReadHidden extends Smarty_Internal_Base { - public function execute() +function isConfigReadHidden($smarty) { - return $this->smarty->config_read_hidden; + return $smarty->config_read_hidden; } -} - ?> diff --git a/libs/sysplugins/method.isdebugging.php b/libs/sysplugins/method.isdebugging.php index e973d80d..277c11df 100644 --- a/libs/sysplugins/method.isdebugging.php +++ b/libs/sysplugins/method.isdebugging.php @@ -11,15 +11,11 @@ */ /** -* Smarty class isDebugging -* * is debugging */ -class Smarty_Method_isDebugging extends Smarty_Internal_Base { - public function execute() - { - return $this->smarty->debugging; - } +function isDebugging($smarty) +{ + return $smarty->debugging; } ?> diff --git a/libs/sysplugins/method.isdebuggingurlctrl.php b/libs/sysplugins/method.isdebuggingurlctrl.php index 6b8f4269..de551fb3 100644 --- a/libs/sysplugins/method.isdebuggingurlctrl.php +++ b/libs/sysplugins/method.isdebuggingurlctrl.php @@ -11,15 +11,11 @@ */ /** -* Smarty class isDebuggingUrlCtrl -* * is possibility to is debugging by SMARTY_DEBUG attribute */ -class Smarty_Method_isDebuggingUrlCtrl extends Smarty_Internal_Base { - public function execute() - { - return $this->smarty->debugging_ctrl != 'none'; - } +function isDebuggingUrlCtrl($smarty) +{ + return $smarty->debugging_ctrl != 'none'; } ?> diff --git a/libs/sysplugins/method.isdefaulttimezone.php b/libs/sysplugins/method.isdefaulttimezone.php index a1b5a048..92839c40 100644 --- a/libs/sysplugins/method.isdefaulttimezone.php +++ b/libs/sysplugins/method.isdefaulttimezone.php @@ -11,15 +11,11 @@ */ /** -* Smarty class isDefaultTimezone -* * is setting of default timezone */ -class Smarty_Method_isDefaultTimezone extends Smarty_Internal_Base { - public function execute() - { - return $this->smarty->set_timezone = false; - } +function isDefaultTimezone($smarty) +{ + return $smarty->set_timezone = false; } ?> diff --git a/libs/sysplugins/method.isforcecompile.php b/libs/sysplugins/method.isforcecompile.php index 91da3079..28c6d4ac 100644 --- a/libs/sysplugins/method.isforcecompile.php +++ b/libs/sysplugins/method.isforcecompile.php @@ -11,15 +11,13 @@ */ /** -* Smarty class isForceCompile * * is forced compiling */ -class Smarty_Method_isForceCompile extends Smarty_Internal_Base { - public function execute() +function isForceCompile($smarty) { - return $this->smarty->force_compile; + return $smarty->force_compile; } -} + ?> diff --git a/libs/sysplugins/method.load_filter.php b/libs/sysplugins/method.load_filter.php index a0e4ee99..9d58ccdb 100644 --- a/libs/sysplugins/method.load_filter.php +++ b/libs/sysplugins/method.load_filter.php @@ -11,33 +11,25 @@ */ /** -* Smarty class Load_Filter +* load a filter of specified type and name * -* Load filter plugin +* @param string $type filter type +* @param string $name filter name */ - -class Smarty_Method_Load_Filter extends Smarty_Internal_Base { - /** - * load a filter of specified type and name - * - * @param string $type filter type - * @param string $name filter name - */ - function execute($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; - } +function load_filter($smarty, $type, $name) +{ + $_plugin = "smarty_{$type}filter_{$name}"; + $_filter_name = $_plugin; + if ($smarty->loadPlugin($_plugin)) { + if (class_exists($_plugin, false)) { + $_plugin = array($_plugin, 'execute'); + } + if (is_callable($_plugin)) { + $smarty->registered_filters[$type][$_filter_name] = $_plugin; + return; } - throw new Exception("{$type}filter \"{$name}\" not callable"); } + throw new Exception("{$type}filter \"{$name}\" not callable"); } ?> diff --git a/libs/sysplugins/method.register_block.php b/libs/sysplugins/method.register_block.php index c1f799e8..0f74e2a5 100644 --- a/libs/sysplugins/method.register_block.php +++ b/libs/sysplugins/method.register_block.php @@ -11,29 +11,25 @@ */ /** -* Smarty class Register_Block -* * Register a PHP function as Smarty block function plugin */ -class Smarty_Method_Register_Block extends Smarty_Internal_Base { - /** - * Registers block function to be used in templates - * - * @param string $block_tag name of template block - * @param string $block_impl PHP function to register - * @param boolean $cacheable if true (default) this fuction is cachable - */ - public function execute($block_tag, $block_impl, $cacheable = true) - { - if (isset($this->smarty->registered_plugins[$block_tag])) { - throw new Exception("Plugin tag \"{$block_tag}\" already registered"); - } elseif (!is_callable($block_impl)) { - throw new Exception("Plugin \"{$block_tag}\" not callable"); - } else { - $this->smarty->registered_plugins[$block_tag] = - array('block', $block_impl, $cacheable); - } +/** +* Registers block function to be used in templates +* +* @param string $block_tag name of template block +* @param string $block_impl PHP function to register +* @param boolean $cacheable if true (default) this fuction is cachable +*/ +function register_block($smarty, $block_tag, $block_impl, $cacheable = true) +{ + if (isset($smarty->registered_plugins[$block_tag])) { + throw new Exception("Plugin tag \"{$block_tag}\" already registered"); + } elseif (!is_callable($block_impl)) { + throw new Exception("Plugin \"{$block_tag}\" not callable"); + } else { + $smarty->registered_plugins[$block_tag] = + array('block', $block_impl, $cacheable); } } diff --git a/libs/sysplugins/method.register_compiler_function.php b/libs/sysplugins/method.register_compiler_function.php index f0267ea6..d84cb4bd 100644 --- a/libs/sysplugins/method.register_compiler_function.php +++ b/libs/sysplugins/method.register_compiler_function.php @@ -11,28 +11,24 @@ */ /** -* Smarty class Register_Compiler_Function -* * Register a PHP function as Smarty compiler function plugin */ -class Smarty_Method_Register_Compiler_Function extends Smarty_Internal_Base { - /** - * Registers compiler function - * - * @param string $compiler_tag of template function - * @param string $compiler_impl name of PHP function to register - */ - public function execute($compiler_tag, $compiler_impl, $cacheable = true) - { - if (isset($this->smarty->registered_plugins[$compiler_tag])) { - throw new Exception("Plugin tag \"{$compiler_tag}\" already registered"); - } elseif (!is_callable($compiler_impl)) { - throw new Exception("Plugin \"{$compiler_tag}\" not callable"); - } else { - $this->smarty->registered_plugins[$compiler_tag] = - array('compiler', $compiler_impl, $cacheable); - } +/** +* Registers compiler function +* +* @param string $compiler_tag of template function +* @param string $compiler_impl name of PHP function to register +*/ +function register_compiler_function($smarty, $compiler_tag, $compiler_impl, $cacheable = true) +{ + if (isset($smarty->registered_plugins[$compiler_tag])) { + throw new Exception("Plugin tag \"{$compiler_tag}\" already registered"); + } elseif (!is_callable($compiler_impl)) { + throw new Exception("Plugin \"{$compiler_tag}\" not callable"); + } else { + $smarty->registered_plugins[$compiler_tag] = + array('compiler', $compiler_impl, $cacheable); } } diff --git a/libs/sysplugins/method.register_function.php b/libs/sysplugins/method.register_function.php index b12d3061..a5bd9bde 100644 --- a/libs/sysplugins/method.register_function.php +++ b/libs/sysplugins/method.register_function.php @@ -11,29 +11,23 @@ */ /** -* Smarty class Register_Function +* Registers custom function to be used in templates * -* Register a PHP function as Smarty function plugin +* @param object $smarty +* @param string $function_tag the name of the template function +* @param string $function_impl the name of the PHP function to register +* @param boolean $cacheable if true (default) this fuction is cachable */ - -class Smarty_Method_Register_Function extends Smarty_Internal_Base { - /** - * Registers custom function to be used in templates - * - * @param string $function_tag the name of the template function - * @param string $function_impl the name of the PHP function to register - * @param boolean $cacheable if true (default) this fuction is cachable - */ - public function execute($function_tag, $function_impl, $cacheable = true) - { - if (isset($this->smarty->registered_plugins[$function_tag])) { - throw new Exception("Plugin tag \"{$function_tag}\" already registered"); - } elseif (!is_callable($function_impl)) { - throw new Exception("Plugin \"{$function_tag}\" not callable"); - } else { - $this->smarty->registered_plugins[$function_tag] = - array('function', $function_impl, $cacheable); - } +function register_function($smarty, $function_tag, $function_impl, $cacheable = true) +{ + if (isset($smarty->registered_plugins[$function_tag])) { + throw new Exception("Plugin tag \"{$function_tag}\" already registered"); + } elseif (!is_callable($function_impl)) { + throw new Exception("Plugin \"{$function_tag}\" not callable"); + } else { + $smarty->registered_plugins[$function_tag] = + array('function', $function_impl, $cacheable); } } + ?> diff --git a/libs/sysplugins/method.register_modifier.php b/libs/sysplugins/method.register_modifier.php index 4e7add18..e89e4e08 100644 --- a/libs/sysplugins/method.register_modifier.php +++ b/libs/sysplugins/method.register_modifier.php @@ -11,29 +11,21 @@ */ /** -* Smarty class Register_Modifier +* Registers modifier to be used in templates * -* Register a PHP function as Smarty modifier plugin +* @param object $smarty +* @param string $modifier name of template modifier +* @param string $modifier_impl name of PHP function to register */ - -class Smarty_Method_Register_Modifier extends Smarty_Internal_Base { - /** - * 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 execute($modifier, $modifier_impl) - { - if (isset($this->smarty->registered_plugins[$modifier])) { - throw new Exception("Plugin \"{$modifier}\" already registered"); - } elseif (!is_callable($modifier_impl)) { - throw new Exception("Plugin \"{$modifier}\" not callable"); - } else { - $this->smarty->registered_plugins[$modifier] = - array('modifier', $modifier_impl); - } +function register_modifier($smarty, $modifier, $modifier_impl) +{ + if (isset($smarty->registered_plugins[$modifier])) { + throw new Exception("Plugin \"{$modifier}\" already registered"); + } elseif (!is_callable($modifier_impl)) { + throw new Exception("Plugin \"{$modifier}\" not callable"); + } else { + $smarty->registered_plugins[$modifier] = + array('modifier', $modifier_impl); } } - ?> diff --git a/libs/sysplugins/method.register_object.php b/libs/sysplugins/method.register_object.php index 75f7f2b8..2ea88371 100644 --- a/libs/sysplugins/method.register_object.php +++ b/libs/sysplugins/method.register_object.php @@ -11,43 +11,36 @@ */ /** -* Smarty class Register_Object +* Registers object to be used in templates * -* Register a PHP object +* @param object $smarty +* @param string $object name of template object +* @param object $ &$object_impl the referenced PHP object to register +* @param null $ |array $allowed list of allowed methods (empty = all) +* @param boolean $smarty_args smarty argument format, else traditional +* @param null $ |array $block_functs list of methods that are block format */ - -class Smarty_Method_Register_Object extends Smarty_Internal_Base { - /** - * 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 null $ |array $allowed list of allowed methods (empty = all) - * @param boolean $smarty_args smarty argument format, else traditional - * @param null $ |array $block_functs list of methods that are block format - */ - public function execute($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array()) - { - // test if allowed methodes callable - if (!empty($allowed)) { - foreach ((array)$allowed as $methode) { - if (!is_callable(array($object_impl, $methode))) { - throw new Exception("Undefined methode '$methode' in registered object"); - } +function register_object($smarty, $object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array()) +{ + // test if allowed methodes callable + if (!empty($allowed)) { + foreach ((array)$allowed as $methode) { + if (!is_callable(array($object_impl, $methode))) { + throw new Exception("Undefined methode '$methode' in registered object"); } } - // test if block methodes callable - if (!empty($block_methods)) { - foreach ((array)$block_methods as $methode) { - if (!is_callable(array($object_impl, $methode))) { - throw new Exception("Undefined methode '$methode' in registered object"); - } - } - } - // register the object - $this->smarty->registered_objects[$object] = - array($object_impl, (array)$allowed, (boolean)$smarty_args, (array)$block_methods); } + // test if block methodes callable + if (!empty($block_methods)) { + foreach ((array)$block_methods as $methode) { + if (!is_callable(array($object_impl, $methode))) { + throw new Exception("Undefined methode '$methode' in registered object"); + } + } + } + // register the object + $smarty->registered_objects[$object] = + array($object_impl, (array)$allowed, (boolean)$smarty_args, (array)$block_methods); } ?> diff --git a/libs/sysplugins/method.register_outputfilter.php b/libs/sysplugins/method.register_outputfilter.php index 43484996..42159df8 100644 --- a/libs/sysplugins/method.register_outputfilter.php +++ b/libs/sysplugins/method.register_outputfilter.php @@ -11,22 +11,16 @@ */ /** -* Smarty class Register_Outputfilter +* Registers an output filter function to apply +* to a template output * -* Register a PHP function as outputfilter +* @param object $smarty +* @param callback $function */ - -class Smarty_Method_Register_Outputfilter extends Smarty_Internal_Base { - /** - * Registers an output filter function to apply - * to a template output - * - * @param callback $function - */ - public function execute($function) - { - $_name = (is_array($function)) ? $function[0] : $function; - $this->smarty->registered_filters['output'][$_name] = $function; - } +function register_outputfilter($smarty, $function) +{ + $_name = (is_array($function)) ? $function[0] : $function; + $smarty->registered_filters['output'][$_name] = $function; } + ?> diff --git a/libs/sysplugins/method.register_postfilter.php b/libs/sysplugins/method.register_postfilter.php index ae806439..1a81a3a2 100644 --- a/libs/sysplugins/method.register_postfilter.php +++ b/libs/sysplugins/method.register_postfilter.php @@ -11,22 +11,16 @@ */ /** -* Smarty class Register_Postfilter +* Registers a postfilter function to apply +* to a compiled template after compilation * -* Register a PHP function as postfilter +* @param object $smarty +* @param callback $function */ - -class Smarty_Method_Register_Postfilter extends Smarty_Internal_Base { - /** - * Registers a postfilter function to apply - * to a compiled template after compilation - * - * @param callback $function - */ - public function execute($function) - { - $_name = (is_array($function)) ? $function[0] : $function; - $this->smarty->registered_filters['post'][$_name] = $function; - } +function register_postfilter($smarty, $function) +{ + $_name = (is_array($function)) ? $function[0] : $function; + $smarty->registered_filters['post'][$_name] = $function; } + ?> diff --git a/libs/sysplugins/method.register_prefilter.php b/libs/sysplugins/method.register_prefilter.php index a0f9bd08..9b2d7f1a 100644 --- a/libs/sysplugins/method.register_prefilter.php +++ b/libs/sysplugins/method.register_prefilter.php @@ -11,23 +11,16 @@ */ /** -* Smarty class Register_Prefilter +* Registers a prefilter function to apply +* to a template before compiling * -* Register a PHP function as prefilter +* @param object $smarty +* @param callback $function */ - -class Smarty_Method_Register_Prefilter extends Smarty_Internal_Base { - /** - * Registers a prefilter function to apply - * to a template before compiling - * - * @param callback $function - */ - public function execute($function) - { - $_name = (is_array($function)) ? $function[0] : $function; - $this->smarty->registered_filters['pre'][$_name] = $function; - } +function register_prefilter($smarty, $function) +{ + $_name = (is_array($function)) ? $function[0] : $function; + $smarty->registered_filters['pre'][$_name] = $function; } ?> diff --git a/libs/sysplugins/method.register_resource.php b/libs/sysplugins/method.register_resource.php index 813af993..fb67eec3 100644 --- a/libs/sysplugins/method.register_resource.php +++ b/libs/sysplugins/method.register_resource.php @@ -11,29 +11,22 @@ */ /** -* Smarty class Register_Resource +* Registers a resource to fetch a template * -* Register a a Smarty template resource +* @param object $smarty +* @param string $type name of resource +* @param array $functions array of functions to handle resource */ - -class Smarty_Method_Register_Resource extends Smarty_Internal_Base { - /** - * Registers a resource to fetch a template - * - * @param string $type name of resource - * @param array $functions array of functions to handle resource - */ - public function execute($type, $functions) - { - if (count($functions) == 4) { - $this->_plugins['resource'][$type] = - array($functions, false); - } elseif (count($functions) == 5) { - $this->smarty->plugins['resource'][$type] = - array(array(array(&$functions[0], $functions[1]) , array(&$functions[0], $functions[2]) , array(&$functions[0], $functions[3]) , array(&$functions[0], $functions[4])) , false); - } else { - throw new Exception("malformed function-list for '$type' in register_resource"); - } +function register_resource($smarty, $type, $functions) +{ + if (count($functions) == 4) { + $smarty->_plugins['resource'][$type] = + array($functions, false); + } elseif (count($functions) == 5) { + $smarty->plugins['resource'][$type] = + array(array(array(&$functions[0], $functions[1]) , array(&$functions[0], $functions[2]) , array(&$functions[0], $functions[3]) , array(&$functions[0], $functions[4])) , false); + } else { + throw new Exception("malformed function-list for '$type' in register_resource"); } } diff --git a/libs/sysplugins/method.register_variablefilter.php b/libs/sysplugins/method.register_variablefilter.php index bd38cbcb..9b0cc35c 100644 --- a/libs/sysplugins/method.register_variablefilter.php +++ b/libs/sysplugins/method.register_variablefilter.php @@ -11,23 +11,16 @@ */ /** -* Smarty class Register_Variablefilter +* Registers an output filter function which +* runs over any variable output * -* Register a PHP function as variablefilter +* @param object $smarty +* @param callback $function */ - -class Smarty_Method_Register_Variablefilter extends Smarty_Internal_Base { - /** - * Registers an output filter function which - * runs over any variable output - * - * @param callback $function - */ - public function execute($function) - { - $_name = (is_array($function)) ? $function[0] : $function; - $this->smarty->registered_filters['variable'][$_name] = $function; - } +function register_variablefilter($smarty, $function) +{ + $_name = (is_array($function)) ? $function[0] : $function; + $smarty->registered_filters['variable'][$_name] = $function; } ?> diff --git a/libs/sysplugins/method.registerdefaultpluginhandler.php b/libs/sysplugins/method.registerdefaultpluginhandler.php index e172d404..9fe38e50 100644 --- a/libs/sysplugins/method.registerdefaultpluginhandler.php +++ b/libs/sysplugins/method.registerdefaultpluginhandler.php @@ -11,24 +11,17 @@ */ /** -* Smarty class registerDefaultPluginHandler +* Registers a default plugin handler * -* Registers a default plugin handler +* @param object $smarty +* @param string $ |array $plugin class/methode name */ - -class Smarty_Method_registerDefaultPluginHandler extends Smarty_Internal_Base { - /** -* Registers a default plugin handler - * - * @param string $ |array $plugin class/methode name - */ - public function execute($plugin) - { - if (is_callable($plugin)) { - $this->smarty->default_plugin_handler_func = $plugin; - } else { - throw new Exception('Default plugin handler "'.$plugin.'" not callable'); - } +function registerDefaultPluginHandler($smarty, $plugin) +{ + if (is_callable($plugin)) { + $smarty->default_plugin_handler_func = $plugin; + } else { + throw new Exception('Default plugin handler "' . $plugin . '" not callable'); } } diff --git a/libs/sysplugins/method.registerdefaulttemplatehandler.php b/libs/sysplugins/method.registerdefaulttemplatehandler.php index a5577fb9..92c440ce 100644 --- a/libs/sysplugins/method.registerdefaulttemplatehandler.php +++ b/libs/sysplugins/method.registerdefaulttemplatehandler.php @@ -11,24 +11,17 @@ */ /** -* Smarty class registerDefaultTemplateHandler -* * Registers a default template handler +* +* @param object $smarty +* @param string $ |array $function class/methode name */ - -class Smarty_Method_registerDefaultTemplateHandler extends Smarty_Internal_Base { - /** - * Registers a default template handler - * - * @param string $ |array $function class/methode name - */ - public function execute($function) - { - if (is_callable($function)) { - $this->smarty->default_template_handler_func = $function; - } else { - throw new Exception('Default template handler "'.$function.'" not callable'); - } +function registerDefaultTemplateHandler($smarty, $function) +{ + if (is_callable($function)) { + $smarty->default_template_handler_func = $function; + } else { + throw new Exception('Default template handler "' . $function . '" not callable'); } } diff --git a/libs/sysplugins/method.setconfigdir.php b/libs/sysplugins/method.setconfigdir.php index 348ae36a..2c549f90 100644 --- a/libs/sysplugins/method.setconfigdir.php +++ b/libs/sysplugins/method.setconfigdir.php @@ -11,23 +11,16 @@ */ /** -* Smarty class setConfigDir -* * Sets directory of config files +* +* @param object $smarty +* @param string $ config folder +* @return */ - -class Smarty_Method_SetConfigDir extends Smarty_Internal_Base { - /** - * Sets directory of config files - * - * @param string $ config folder - * @return - */ - public function execute($config_dir) - { - $this->smarty->config_dir = $config_dir; - return; - } +function SetConfigDir($smarty, $config_dir) +{ + $this->smarty->config_dir = $config_dir; + return; } ?> diff --git a/libs/sysplugins/method.setdebugtemplate.php b/libs/sysplugins/method.setdebugtemplate.php index b9e9ab8a..3d7b7032 100644 --- a/libs/sysplugins/method.setdebugtemplate.php +++ b/libs/sysplugins/method.setdebugtemplate.php @@ -11,22 +11,18 @@ */ /** -* Smarty class setDebugTemplate -* * Sets debug template filepath */ -class Smarty_Method_SetDebugTemplate extends Smarty_Internal_Base { - /** - * Sets debug template filepath - * - * @param string $ array debug template filepath - */ - public function execute($debug_tpl) - { - $this->smarty->debug_tpl = $debug_tpl; - return; - } +/** +* Sets debug template filepath +* +* @param string $ array debug template filepath +*/ +function SetDebugTemplate(smarty, $debug_tpl) +{ + $smarty->debug_tpl = $debug_tpl; + return; } ?> diff --git a/libs/sysplugins/method.setpluginsdir.php b/libs/sysplugins/method.setpluginsdir.php index 00410a41..7f4379fe 100644 --- a/libs/sysplugins/method.setpluginsdir.php +++ b/libs/sysplugins/method.setpluginsdir.php @@ -11,23 +11,19 @@ */ /** -* Smarty class setPluginsDir -* * Sets directory of plugin files */ -class Smarty_Method_SetPluginsDir extends Smarty_Internal_Base { - /** - * Sets directory of plugin files - * - * @param string $ plugins folder - * @return - */ - public function execute($plugins_dir) - { - $this->smarty->plugins_dir = (array)$plugins_dir; - return; - } +/** +* Sets directory of plugin files +* +* @param string $ plugins folder +* @return +*/ +function SetPluginsDir($smarty, $plugins_dir) +{ + $smarty->plugins_dir = (array)$plugins_dir; + return; } ?> diff --git a/libs/sysplugins/method.template_exists.php b/libs/sysplugins/method.template_exists.php index 552705b9..9bb943e6 100644 --- a/libs/sysplugins/method.template_exists.php +++ b/libs/sysplugins/method.template_exists.php @@ -11,29 +11,25 @@ */ /** -* Smarty class Template_Exists -* * Checks if a template resource exists */ -class Smarty_Method_Template_Exists extends Smarty_Internal_Base { - /** - * Check if a template resource exists - * - * @param string $resource_name template name - * @return boolean status - */ - public function execute($resource_name) - { - foreach((array)$this->smarty->template_dir as $_template_dir) { - $_filepath = $_template_dir . $resource_name; - if (file_exists($_filepath)) - return true; - } - if (file_exists($resource_name)) return true; - // no tpl file found - return false; +/** +* Check if a template resource exists +* +* @param string $resource_name template name +* @return boolean status +*/ +function template_exists($smarty, $resource_name) +{ + foreach((array)$smarty->template_dir as $_template_dir) { + $_filepath = $_template_dir . $resource_name; + if (file_exists($_filepath)) + return true; } + if (file_exists($resource_name)) return true; + // no tpl file found + return false; } ?> diff --git a/libs/sysplugins/method.test.php b/libs/sysplugins/method.test.php index 2a08a782..06fd66be 100644 --- a/libs/sysplugins/method.test.php +++ b/libs/sysplugins/method.test.php @@ -1,93 +1,86 @@ \n"; - + echo "Smarty Installation test...\n"; - + echo "Testing template directory...\n"; - - foreach((array)$this->smarty->template_dir as $template_dir) - { - if(!is_dir($template_dir)) - echo "FAILED: $template_dir is not a directory.\n"; - elseif(!is_readable($template_dir)) - echo "FAILED: $template_dir is not readable.\n"; - else - echo "$template_dir is OK.\n"; - } + + foreach((array)$smarty->template_dir as $template_dir) { + if (!is_dir($template_dir)) + echo "FAILED: $template_dir is not a directory.\n"; + elseif (!is_readable($template_dir)) + echo "FAILED: $template_dir is not readable.\n"; + else + echo "$template_dir is OK.\n"; + } echo "Testing compile directory...\n"; - - if(!is_dir($this->smarty->compile_dir)) - echo "FAILED: $compile_dir is not a directory.\n"; - elseif(!is_readable($this->smarty->compile_dir)) - echo "FAILED: $compile_dir is not readable.\n"; - elseif(!is_writable($this->smarty->compile_dir)) - echo "FAILED: $compile_dir is not writable.\n"; - else - echo "{$this->smarty->compile_dir} is OK.\n"; + if (!is_dir($smarty->compile_dir)) + echo "FAILED: $smarty->compile_dir is not a directory.\n"; + elseif (!is_readable($smarty->compile_dir)) + echo "FAILED: $smarty->compile_dir is not readable.\n"; + elseif (!is_writable($smarty->compile_dir)) + echo "FAILED: $smarty->compile_dir is not writable.\n"; + else + echo "{$smarty->compile_dir} is OK.\n"; echo "Testing sysplugins directory...\n"; - - if(!is_dir($this->smarty->sysplugins_dir)) - echo "FAILED: $sysplugins_dir is not a directory.\n"; - elseif(!is_readable($this->smarty->sysplugins_dir)) - echo "FAILED: $sysplugins_dir is not readable.\n"; + + if (!is_dir($smarty->sysplugins_dir)) + echo "FAILED: $smarty->sysplugins_dir is not a directory.\n"; + elseif (!is_readable($smarty->sysplugins_dir)) + echo "FAILED: $smarty->sysplugins_dir is not readable.\n"; else - echo "{$this->smarty->sysplugins_dir} is OK.\n"; - + echo "{$smarty->sysplugins_dir} is OK.\n"; + echo "Testing plugins directory...\n"; - - foreach((array)$this->smarty->plugins_dir as $plugin_dir) - { - if(!is_dir($plugin_dir)) - echo "FAILED: $plugin_dir is not a directory.\n"; - elseif(!is_readable($plugin_dir)) - echo "FAILED: $plugin_dir is not readable.\n"; - else - echo "$plugin_dir is OK.\n"; - } - + + foreach((array)$smarty->plugins_dir as $plugin_dir) { + if (!is_dir($plugin_dir)) + echo "FAILED: $plugin_dir is not a directory.\n"; + elseif (!is_readable($plugin_dir)) + echo "FAILED: $plugin_dir is not readable.\n"; + else + echo "$plugin_dir is OK.\n"; + } + echo "Testing cache directory...\n"; - - if(!is_dir($this->smarty->cache_dir)) - echo "FAILED: $cache_dir is not a directory.\n"; - elseif(!is_readable($this->smarty->cache_dir)) - echo "FAILED: $cache_dir is not readable.\n"; - elseif(!is_writable($this->smarty->cache_dir)) - echo "FAILED: $cache_dir is not writable.\n"; + + if (!is_dir($smarty->cache_dir)) + echo "FAILED: $smarty->cache_dir is not a directory.\n"; + elseif (!is_readable($smarty->cache_dir)) + echo "FAILED: $smarty->cache_dir is not readable.\n"; + elseif (!is_writable($smarty->cache_dir)) + echo "FAILED: $smarty->cache_dir is not writable.\n"; else - echo "{$this->smarty->cache_dir} is OK.\n"; - + echo "{$smarty->cache_dir} is OK.\n"; + echo "Testing configs directory...\n"; - - if(!is_dir($this->smarty->config_dir)) - echo "FAILED: $config_dir is not a directory.\n"; - elseif(!is_readable($this->smarty->config_dir)) - echo "FAILED: $config_dir is not readable.\n"; + + if (!is_dir($smarty->config_dir)) + echo "FAILED: $smarty->config_dir is not a directory.\n"; + elseif (!is_readable($smarty->config_dir)) + echo "FAILED: $smarty->config_dir is not readable.\n"; else - echo "{$this->smarty->config_dir} is OK.\n"; - + echo "{$smarty->config_dir} is OK.\n"; + echo "Tests complete.\n"; - + echo "\n"; - return true; - - } - -} + return true; +} ?> diff --git a/libs/sysplugins/method.trigger_error.php b/libs/sysplugins/method.trigger_error.php index 99621653..c918e57d 100644 --- a/libs/sysplugins/method.trigger_error.php +++ b/libs/sysplugins/method.trigger_error.php @@ -11,23 +11,19 @@ */ /** -* Smarty class Trigger_Error -* * Triggers an error meassage */ -class Smarty_Method_Trigger_Error extends Smarty_Internal_Base { - /** - * trigger Smarty error - * - * @param string $error_msg - * @param integer $error_type - */ - public function execute($error_msg, $error_type = E_USER_WARNING) - { - // trigger_error("Smarty error: $error_msg", $error_type); - throw new Exception("Smarty error: $error_msg"); - } +/** +* trigger Smarty error +* +* @param string $error_msg +* @param integer $error_type +*/ +function trigger_error($smarty, $error_msg, $error_type = E_USER_WARNING) +{ + // trigger_error("Smarty error: $error_msg", $error_type); + throw new Exception("Smarty error: $error_msg"); } ?> diff --git a/libs/sysplugins/method.unregister_block.php b/libs/sysplugins/method.unregister_block.php index b735385f..9e747bdf 100644 --- a/libs/sysplugins/method.unregister_block.php +++ b/libs/sysplugins/method.unregister_block.php @@ -11,22 +11,18 @@ */ /** -* Smarty class Unregister_Block -* * Unregister a Smarty block function plugin */ -class Smarty_Method_Unregister_Block extends Smarty_Internal_Base { - /** - * Unregisters block function - * - * @param string $block_tag name of template function - */ - public function execute($block_tag) - { - if (isset($this->smarty->registered_plugins[$block_tag]) && $this->smarty->registered_plugins[$block_tag][0] == 'block') { - unset($this->smarty->registered_plugins[$block_tag]); - } +/** +* Unregisters block function +* +* @param string $block_tag name of template function +*/ +function unregister_block($smarty, $block_tag) +{ + if (isset($smarty->registered_plugins[$block_tag]) && $smarty->registered_plugins[$block_tag][0] == 'block') { + unset($smarty->registered_plugins[$block_tag]); } } diff --git a/libs/sysplugins/method.unregister_compiler_function.php b/libs/sysplugins/method.unregister_compiler_function.php index 1698dc48..516a4d5d 100644 --- a/libs/sysplugins/method.unregister_compiler_function.php +++ b/libs/sysplugins/method.unregister_compiler_function.php @@ -11,22 +11,19 @@ */ /** -* Smarty class Unregister_Compiler_Function -* * Unregister a Smarty compiler function plugin */ -class Smarty_Method_Unregister_Compiler_Function extends Smarty_Internal_Base { - /** - * Unregisters compiler function - * - * @param string $compiler_tag name of template function - */ - public function execute($compiler_tag) - { - if (isset($this->smarty->registered_plugins[$compiler_tag]) && $this->smarty->registered_plugins[$compiler_tag][0] == 'compiler') { - unset($this->smarty->registered_plugins[$compiler_tag]); - } +/** +* Unregisters compiler function +* +* @param string $compiler_tag name of template function +*/ +function unregister_compiler_function($smarty, $compiler_tag) +{ + if (isset($smarty->registered_plugins[$compiler_tag]) && $smarty->registered_plugins[$compiler_tag][0] == 'compiler') { + unset($smarty->registered_plugins[$compiler_tag]); } } + ?> diff --git a/libs/sysplugins/method.unregister_function.php b/libs/sysplugins/method.unregister_function.php index a84ee1d1..6fe411b9 100644 --- a/libs/sysplugins/method.unregister_function.php +++ b/libs/sysplugins/method.unregister_function.php @@ -11,22 +11,19 @@ */ /** -* Smarty class Unregister_Function -* * Unregister a Smarty function plugin */ -class Smarty_Method_Unregister_Function extends Smarty_Internal_Base { - /** - * Unregisters custom function - * - * @param string $function_tag name of template function - */ - public function execute($function_tag) - { - if (isset($this->smarty->registered_plugins[$function_tag]) && $this->smarty->registered_plugins[$function_tag][0] == 'function') { - unset($this->smarty->registered_plugins[$function_tag]); - } +/** +* Unregisters custom function +* +* @param string $function_tag name of template function +*/ +function unregister_function($smarty, $function_tag) +{ + if (isset($smarty->registered_plugins[$function_tag]) && $smarty->registered_plugins[$function_tag][0] == 'function') { + unset($smarty->registered_plugins[$function_tag]); } } + ?> diff --git a/libs/sysplugins/method.unregister_modifier.php b/libs/sysplugins/method.unregister_modifier.php index cc45af98..c86e7974 100644 --- a/libs/sysplugins/method.unregister_modifier.php +++ b/libs/sysplugins/method.unregister_modifier.php @@ -11,22 +11,18 @@ */ /** -* Smarty class Unregister_Modifier -* * Unregister a Smarty modifier plugin */ -class Smarty_Method_Unregister_Modifier extends Smarty_Internal_Base { - /** - * Unregisters modifier - * - * @param string $modifier name of template modifier - */ - public function execute($modifier) - { - if (isset($this->smarty->registered_plugins[$modifier]) && $this->smarty->registered_plugins[$modifier][0] == 'modifier') { - unset($this->smarty->registered_plugins[$modifier]); - } +/** +* Unregisters modifier +* +* @param string $modifier name of template modifier +*/ +function unregister_modifier($smarty, $modifier) +{ + if (isset($smarty->registered_plugins[$modifier]) && $smarty->registered_plugins[$modifier][0] == 'modifier') { + unset($smarty->registered_plugins[$modifier]); } } diff --git a/libs/sysplugins/method.unregister_object.php b/libs/sysplugins/method.unregister_object.php index be0d1a40..83f1e012 100644 --- a/libs/sysplugins/method.unregister_object.php +++ b/libs/sysplugins/method.unregister_object.php @@ -11,21 +11,18 @@ */ /** -* Smarty class Unregister_Object * * Unregister a PHP object */ -class Smarty_Method_Unregister_Object extends Smarty_Internal_Base { /** * Unregisters object * * @param string $object name of template object */ - public function execute($object) + function unregister_object($smarty, $object) { - unset($this->smarty->registered_objects[$object]); + unset($smarty->registered_objects[$object]); } -} ?> diff --git a/libs/sysplugins/method.unregister_outputfilter.php b/libs/sysplugins/method.unregister_outputfilter.php index 7b477b96..2fb310fc 100644 --- a/libs/sysplugins/method.unregister_outputfilter.php +++ b/libs/sysplugins/method.unregister_outputfilter.php @@ -11,23 +11,19 @@ */ /** -* Smarty class Unregister_Outputfilter -* * Unregister a outputfilter */ -class Smarty_Method_Unregister_Outputfilter extends Smarty_Internal_Base { - /** - * Registers an output filter function to apply - * to a template output - * - * @param callback $function - */ - public function execute($function) - { - $_name = (is_array($function)) ? $function[0] : $function; - unset($this->smarty->registered_filters['output'][$_name]); - } +/** +* Registers an output filter function to apply +* to a template output +* +* @param callback $function +*/ +function unregister_outputfilter($smarty, $function) +{ + $_name = (is_array($function)) ? $function[0] : $function; + unset($smarty->registered_filters['output'][$_name]); } ?> diff --git a/libs/sysplugins/method.unregister_postfilter.php b/libs/sysplugins/method.unregister_postfilter.php index 98b254fc..5dbfc5a1 100644 --- a/libs/sysplugins/method.unregister_postfilter.php +++ b/libs/sysplugins/method.unregister_postfilter.php @@ -11,22 +11,18 @@ */ /** -* Smarty class Unregister_Postfilter -* * Unregister a postfilter */ -class Smarty_Method_Unregister_Postfilter extends Smarty_Internal_Base { - /** - * Unregisters a postfilter function - * - * @param callback $function - */ - public function execute($function) - { - $_name = (is_array($function)) ? $function[0] : $function; - unset($this->smarty->registered_filters['post'][$_name]); - } +/** +* Unregisters a postfilter function +* +* @param callback $function +*/ +function unregister_postfilter($smarty, $function) +{ + $_name = (is_array($function)) ? $function[0] : $function; + unset($smarty->registered_filters['post'][$_name]); } ?> diff --git a/libs/sysplugins/method.unregister_prefilter.php b/libs/sysplugins/method.unregister_prefilter.php index bfab647f..e643784c 100644 --- a/libs/sysplugins/method.unregister_prefilter.php +++ b/libs/sysplugins/method.unregister_prefilter.php @@ -11,22 +11,18 @@ */ /** -* Smarty class Unregister_Prefilter -* * Unregister a prefilter */ -class Smarty_Method_Unregister_Prefilter extends Smarty_Internal_Base { - /** - * Unregisters a prefilter function - * - * @param callback $function - */ - public function execute($function) - { - $_name = (is_array($function)) ? $function[0] : $function; - unset($this->smarty->registered_filters['pre'][$_name]); - } +/** +* Unregisters a prefilter function +* +* @param callback $function +*/ +function unregister_prefilter($smarty, $function) +{ + $_name = (is_array($function)) ? $function[0] : $function; + unset($smarty->registered_filters['pre'][$_name]); } ?> diff --git a/libs/sysplugins/method.unregister_resource.php b/libs/sysplugins/method.unregister_resource.php index 863a3504..14c2e182 100644 --- a/libs/sysplugins/method.unregister_resource.php +++ b/libs/sysplugins/method.unregister_resource.php @@ -11,21 +11,17 @@ */ /** -* Smarty class Unregister_Resource -* * Unregister a template resource */ -class Smarty_Method_Unregister_Resource extends Smarty_Internal_Base { - /** - * Unregisters a resource - * - * @param string $type name of resource - */ - public function execute($type) - { - unset($this->smarty->plugins['resource'][$type]); - } +/** +* Unregisters a resource +* +* @param string $type name of resource +*/ +function Unregister_Resource($smarty, $type) +{ + unset($smarty->plugins['resource'][$type]); } ?> diff --git a/libs/sysplugins/method.unregister_variablefilter.php b/libs/sysplugins/method.unregister_variablefilter.php index 8fd4a3f7..b7981aa3 100644 --- a/libs/sysplugins/method.unregister_variablefilter.php +++ b/libs/sysplugins/method.unregister_variablefilter.php @@ -11,22 +11,18 @@ */ /** -* Smarty class Unregister_Variablefilter -* * Unregister a variablefilter */ -class Smarty_Method_Unregister_Variablefilter extends Smarty_Internal_Base { - /** - * Unregisters a variablefilter function - * - * @param callback $function - */ - public function execute($function) - { - $_name = (is_array($function)) ? $function[0] : $function; - unset($this->smarty->registered_filters['variable'][$_name]); - } +/** +* Unregisters a variablefilter function +* +* @param callback $function +*/ +function unregister_variablefilter($smarty, $function) +{ + $_name = (is_array($function)) ? $function[0] : $function; + unset($smarty->registered_filters['variable'][$_name]); } ?>