summaryrefslogtreecommitdiff
path: root/libs/sysplugins
diff options
context:
space:
mode:
authoruwetews <uwe.tews@googlemail.com>2015-08-17 21:52:32 +0200
committeruwetews <uwe.tews@googlemail.com>2015-08-17 21:52:32 +0200
commit6cbcdf4d7b79aa038e5773c3a93d215542400c95 (patch)
tree223971ecef4cd51327c7e29bfd2af045fb08e0d4 /libs/sysplugins
parenteb7aa8fe9258cf41536e89fe264225e7f1b8f6f3 (diff)
downloadsmarty-6cbcdf4d7b79aa038e5773c3a93d215542400c95.tar.gz
smarty-6cbcdf4d7b79aa038e5773c3a93d215542400c95.tar.bz2
smarty-6cbcdf4d7b79aa038e5773c3a93d215542400c95.zip
- load seldom used Smarty API methods dynamically to reduce memory footprint
Diffstat (limited to 'libs/sysplugins')
-rw-r--r--libs/sysplugins/smarty_cacheresource.php4
-rw-r--r--libs/sysplugins/smarty_cacheresource_custom.php4
-rw-r--r--libs/sysplugins/smarty_data.php8
-rw-r--r--libs/sysplugins/smarty_internal_compile_config_load.php6
-rw-r--r--libs/sysplugins/smarty_internal_compile_private_special_variable.php4
-rw-r--r--libs/sysplugins/smarty_internal_config_file_compiler.php2
-rw-r--r--libs/sysplugins/smarty_internal_data.php341
-rw-r--r--libs/sysplugins/smarty_internal_extension_config.php160
-rw-r--r--libs/sysplugins/smarty_internal_extension_defaulttemplatehandler.php84
-rw-r--r--libs/sysplugins/smarty_internal_extension_filter.php150
-rw-r--r--libs/sysplugins/smarty_internal_extension_getvars.php103
-rw-r--r--libs/sysplugins/smarty_internal_extension_object.php110
-rw-r--r--libs/sysplugins/smarty_internal_method_addautoloadfilters.php51
-rw-r--r--libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php42
-rw-r--r--libs/sysplugins/smarty_internal_method_append.php72
-rw-r--r--libs/sysplugins/smarty_internal_method_appendbyref.php48
-rw-r--r--libs/sysplugins/smarty_internal_method_clearallassign.php37
-rw-r--r--libs/sysplugins/smarty_internal_method_clearallcache.php41
-rw-r--r--libs/sysplugins/smarty_internal_method_clearassign.php44
-rw-r--r--libs/sysplugins/smarty_internal_method_clearcache.php44
-rw-r--r--libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php (renamed from libs/sysplugins/smarty_internal_extension_clearcompiled.php)23
-rw-r--r--libs/sysplugins/smarty_internal_method_clearconfig.php41
-rw-r--r--libs/sysplugins/smarty_internal_method_compileallconfig.php32
-rw-r--r--libs/sysplugins/smarty_internal_method_compilealltemplates.php (renamed from libs/sysplugins/smarty_internal_extension_compileall.php)38
-rw-r--r--libs/sysplugins/smarty_internal_method_configload.php107
-rw-r--r--libs/sysplugins/smarty_internal_method_createdata.php44
-rw-r--r--libs/sysplugins/smarty_internal_method_getautoloadfilters.php37
-rw-r--r--libs/sysplugins/smarty_internal_method_getconfigvars.php58
-rw-r--r--libs/sysplugins/smarty_internal_method_getdebugtemplate.php35
-rw-r--r--libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php35
-rw-r--r--libs/sysplugins/smarty_internal_method_getregisteredobject.php44
-rw-r--r--libs/sysplugins/smarty_internal_method_getstreamvariable.php (renamed from libs/sysplugins/smarty_internal_extension_getstreamvar.php)23
-rw-r--r--libs/sysplugins/smarty_internal_method_gettags.php61
-rw-r--r--libs/sysplugins/smarty_internal_method_gettemplatevars.php71
-rw-r--r--libs/sysplugins/smarty_internal_method_loadfilter.php77
-rw-r--r--libs/sysplugins/smarty_internal_method_mustcompile.php49
-rw-r--r--libs/sysplugins/smarty_internal_method_registercacheresource.php39
-rw-r--r--libs/sysplugins/smarty_internal_method_registerclass.php46
-rw-r--r--libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php42
-rw-r--r--libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php43
-rw-r--r--libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php72
-rw-r--r--libs/sysplugins/smarty_internal_method_registerfilter.php88
-rw-r--r--libs/sysplugins/smarty_internal_method_registerobject.php71
-rw-r--r--libs/sysplugins/smarty_internal_method_registerplugin.php50
-rw-r--r--libs/sysplugins/smarty_internal_method_registerresource.php44
-rw-r--r--libs/sysplugins/smarty_internal_method_setautoloadfilters.php70
-rw-r--r--libs/sysplugins/smarty_internal_method_setdebugtemplate.php41
-rw-r--r--libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php38
-rw-r--r--libs/sysplugins/smarty_internal_method_unloadfilter.php42
-rw-r--r--libs/sysplugins/smarty_internal_method_unregistercacheresource.php40
-rw-r--r--libs/sysplugins/smarty_internal_method_unregisterfilter.php42
-rw-r--r--libs/sysplugins/smarty_internal_method_unregisterobject.php40
-rw-r--r--libs/sysplugins/smarty_internal_method_unregisterplugin.php41
-rw-r--r--libs/sysplugins/smarty_internal_method_unregisterresource.php40
-rw-r--r--libs/sysplugins/smarty_internal_template.php49
-rw-r--r--libs/sysplugins/smarty_internal_templatebase.php521
-rw-r--r--libs/sysplugins/smarty_internal_templatecompilerbase.php2
-rw-r--r--libs/sysplugins/smarty_internal_templateparser.php10
-rw-r--r--libs/sysplugins/smarty_internal_testinstall.php11
-rw-r--r--libs/sysplugins/smarty_internal_utility.php62
-rw-r--r--libs/sysplugins/smarty_template_config.php9
-rw-r--r--libs/sysplugins/smarty_template_source.php7
62 files changed, 2451 insertions, 1239 deletions
diff --git a/libs/sysplugins/smarty_cacheresource.php b/libs/sysplugins/smarty_cacheresource.php
index 98e873e7..36008b9e 100644
--- a/libs/sysplugins/smarty_cacheresource.php
+++ b/libs/sysplugins/smarty_cacheresource.php
@@ -73,8 +73,8 @@ abstract class Smarty_CacheResource
{
if ($_template->cached->handler->process($_template)) {
ob_start();
- $_template->cached->unifunc($_template);
-
+ $unifunc = $_template->cached->unifunc;
+ $unifunc($_template);
return ob_get_clean();
}
diff --git a/libs/sysplugins/smarty_cacheresource_custom.php b/libs/sysplugins/smarty_cacheresource_custom.php
index 33238210..4521daab 100644
--- a/libs/sysplugins/smarty_cacheresource_custom.php
+++ b/libs/sysplugins/smarty_cacheresource_custom.php
@@ -139,7 +139,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
*/
$_smarty_tpl = $_template;
eval("?>" . $content);
-
+ $cached->content = null;
return true;
}
@@ -190,7 +190,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
*/
public function clearAll(Smarty $smarty, $exp_time = null)
{
- return $this->delete(null, null, null, $exp_time);
+ return $this->delete(null, null, null, $exp_time);
}
/**
diff --git a/libs/sysplugins/smarty_data.php b/libs/sysplugins/smarty_data.php
index 8074513d..ecd88c11 100644
--- a/libs/sysplugins/smarty_data.php
+++ b/libs/sysplugins/smarty_data.php
@@ -30,12 +30,20 @@ class Smarty_Data extends Smarty_Internal_Data
* @var string
*/
public $dataObjectName = '';
+
/**
* Smarty object
*
* @var Smarty
*/
public $smarty = null;
+
+ /**
+ * This object type (Smarty = 1, template = 2, data = 4)
+ *
+ * @var int
+ */
+ public $_objType = 4;
/**
* create Smarty data object
diff --git a/libs/sysplugins/smarty_internal_compile_config_load.php b/libs/sysplugins/smarty_internal_compile_config_load.php
index dbbc7bde..69c44882 100644
--- a/libs/sysplugins/smarty_internal_compile_config_load.php
+++ b/libs/sysplugins/smarty_internal_compile_config_load.php
@@ -23,6 +23,7 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase
* @see Smarty_Internal_CompileBase
*/
public $required_attributes = array('file');
+
/**
* Attribute definition: Overwrites base class.
*
@@ -30,6 +31,7 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase
* @see Smarty_Internal_CompileBase
*/
public $shorttag_order = array('file', 'section');
+
/**
* Attribute definition: Overwrites base class.
*
@@ -41,7 +43,7 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase
/**
* Compiles code for the {config_load} tag
*
- * @param array $args array with attributes from parser
+ * @param array $args array with attributes from parser
* @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
*
* @return string compiled code
@@ -75,7 +77,7 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase
}
}
// create config object
- $_output = "<?php Smarty_Internal_Extension_Config::configLoad(\$_smarty_tpl, $conf_file, $section, '$scope');?>";
+ $_output = "<?php \$_smarty_tpl->configLoad($conf_file, $section, '$scope');?>";
return $_output;
}
diff --git a/libs/sysplugins/smarty_internal_compile_private_special_variable.php b/libs/sysplugins/smarty_internal_compile_private_special_variable.php
index 39dc57d4..42741408 100644
--- a/libs/sysplugins/smarty_internal_compile_private_special_variable.php
+++ b/libs/sysplugins/smarty_internal_compile_private_special_variable.php
@@ -99,9 +99,9 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C
case 'config':
if (isset($_index[2])) {
- return "(is_array(\$tmp = \$_smarty_tpl->getConfigVariable($_index[1])) ? \$tmp[$_index[2]] : null)";
+ return "(is_array(\$tmp = \$_smarty_tpl->_getConfigVariable($_index[1])) ? \$tmp[$_index[2]] : null)";
} else {
- return "\$_smarty_tpl->getConfigVariable($_index[1])";
+ return "\$_smarty_tpl->_getConfigVariable($_index[1])";
}
case 'ldelim':
$_ldelim = $compiler->smarty->left_delimiter;
diff --git a/libs/sysplugins/smarty_internal_config_file_compiler.php b/libs/sysplugins/smarty_internal_config_file_compiler.php
index a783b056..d334936c 100644
--- a/libs/sysplugins/smarty_internal_config_file_compiler.php
+++ b/libs/sysplugins/smarty_internal_config_file_compiler.php
@@ -143,7 +143,7 @@ class Smarty_Internal_Config_File_Compiler
strftime("%Y-%m-%d %H:%M:%S") . "\n";
$template_header .= " compiled from \"" . $this->template->source->filepath . "\" */ ?>\n";
- $code = '<?php Smarty_Internal_Extension_Config::loadConfigVars($_smarty_tpl, ' .
+ $code = '<?php Smarty_Internal_Method_ConfigLoad::_loadConfigVars($_smarty_tpl, ' .
var_export($this->config_data, true) . '); ?>';
return $template_header . Smarty_Internal_Extension_CodeFrame::create($this->template, $code);
}
diff --git a/libs/sysplugins/smarty_internal_data.php b/libs/sysplugins/smarty_internal_data.php
index b27f8478..ea948256 100644
--- a/libs/sysplugins/smarty_internal_data.php
+++ b/libs/sysplugins/smarty_internal_data.php
@@ -13,6 +13,15 @@
*
* @package Smarty
* @subpackage Template
+ *
+ * @method mixed getConfigVars(string $varname = null, bool $search_parents = true)
+ * @method mixed getStreamVariable(string $variable)
+ * @local_method mixed getTemplateVars(string $varname = null, Smarty_Internal_Data $_ptr = null, bool $search_parents = true)
+ * @method Smarty_Internal_Data clearAssign(mixed $tpl_var)
+ * @method Smarty_Internal_Data clearAllAssign()
+ * @method Smarty_Internal_Data clearConfig(string $varname = null)
+ * @method Smarty_Internal_Data configLoad(string $config_file, mixed $sections = null, string $scope = 'local')
+ * @property int $_objType
*/
class Smarty_Internal_Data
{
@@ -33,7 +42,7 @@ class Smarty_Internal_Data
/**
* parent template (if any)
*
- * @var Smarty_Internal_Template
+ * @var Smarty|Smarty_Internal_Template|Smarty_Internal_Data
*/
public $parent = null;
@@ -52,6 +61,16 @@ class Smarty_Internal_Data
public $_cache = array();
/**
+ * Cache for property information from generic getter/setter
+ * Preloaded with names which should not use with generic getter/setter
+ *
+ * @var array
+ */
+ private $_property_info = array('AutoloadFilters' => 0, 'DefaultModifiers' => 0, 'ConfigVars' => 0,
+ 'DebugTemplate' => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0,
+ 'TemplateVars' => 0,);
+
+ /**
* assigns a Smarty variable
*
* @param array|string $tpl_var the template variable name(s)
@@ -79,23 +98,50 @@ class Smarty_Internal_Data
}
/**
- * assigns a global Smarty variable
+ * appends values to template variables
*
- * @param string $varname the global variable name
- * @param mixed $value the value to assign
- * @param boolean $nocache if true any output of this variable will be not cached
+ * @api Smarty::append()
+ * @link http://www.smarty.net/docs/en/api.append.tpl
*
- * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for
- * chaining
+ * @param array|string $tpl_var the template variable name(s)
+ * @param mixed $value the value to append
+ * @param bool $merge flag if array elements shall be merged
+ * @param bool $nocache if true any output of this variable will
+ * be not cached
+ *
+ * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
*/
- public function assignGlobal($varname, $value = null, $nocache = false)
+ public function append($tpl_var, $value = null, $merge = false, $nocache = false)
{
- if ($varname != '') {
- Smarty::$global_tpl_vars[$varname] = new Smarty_Variable($value, $nocache);
- $ptr = $this;
- while ($ptr instanceof Smarty_Internal_Template) {
- $ptr->tpl_vars[$varname] = clone Smarty::$global_tpl_vars[$varname];
- $ptr = $ptr->parent;
+ if (is_array($tpl_var)) {
+ // $tpl_var is an array, ignore $value
+ foreach ($tpl_var as $_key => $_val) {
+ if ($_key != '') {
+ $this->append($_key, $_val, $merge, $nocache);
+ }
+ }
+ } else {
+ if ($tpl_var != '' && isset($value)) {
+ if (!isset($this->tpl_vars[$tpl_var])) {
+ $tpl_var_inst = $this->_getVariable($tpl_var, null, true, false);
+ if ($tpl_var_inst instanceof Smarty_Undefined_Variable) {
+ $this->tpl_vars[$tpl_var] = new Smarty_Variable(null, $nocache);
+ } else {
+ $this->tpl_vars[$tpl_var] = clone $tpl_var_inst;
+ }
+ }
+ if (!(is_array($this->tpl_vars[$tpl_var]->value) ||
+ $this->tpl_vars[$tpl_var]->value instanceof ArrayAccess)
+ ) {
+ settype($this->tpl_vars[$tpl_var]->value, 'array');
+ }
+ if ($merge && is_array($value)) {
+ foreach ($value as $_mkey => $_mval) {
+ $this->tpl_vars[$tpl_var]->value[$_mkey] = $_mval;
+ }
+ } else {
+ $this->tpl_vars[$tpl_var]->value[] = $value;
+ }
}
}
@@ -103,39 +149,25 @@ class Smarty_Internal_Data
}
/**
- * assigns values to template variables by reference
+ * assigns a global Smarty variable
*
- * @param string $tpl_var the template variable name
- * @param $value
+ * @param string $varname the global variable name
+ * @param mixed $value the value to assign
* @param boolean $nocache if true any output of this variable will be not cached
*
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for
* chaining
*/
- public function assignByRef($tpl_var, &$value, $nocache = false)
+ public function assignGlobal($varname, $value = null, $nocache = false)
{
- if ($tpl_var != '') {
- $this->tpl_vars[$tpl_var] = new Smarty_Variable(null, $nocache);
- $this->tpl_vars[$tpl_var]->value = &$value;
+ if ($varname != '') {
+ Smarty::$global_tpl_vars[$varname] = new Smarty_Variable($value, $nocache);
+ $ptr = $this;
+ while ($ptr instanceof Smarty_Internal_Template) {
+ $ptr->tpl_vars[$varname] = clone Smarty::$global_tpl_vars[$varname];
+ $ptr = $ptr->parent;
+ }
}
-
- return $this;
- }
-
- /**
- * appends values to template variables
- *
- * @param array|string $tpl_var the template variable name(s)
- * @param mixed $value the value to append
- * @param boolean $merge flag if array elements shall be merged
- * @param boolean $nocache if true any output of this variable will be not cached
- *
- * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for
- * chaining
- */
- public function append($tpl_var, $value = null, $merge = false, $nocache = false)
- {
- Smarty_Internal_Extension_Append::append($this, $tpl_var, $value, $merge, $nocache);
return $this;
}
@@ -151,138 +183,197 @@ class Smarty_Internal_Data
*/
public function appendByRef($tpl_var, &$value, $merge = false)
{
- Smarty_Internal_Extension_Append::appendByRef($this, $tpl_var, $value, $merge);
+ Smarty_Internal_Method_AppendByRef::appendByRef($this, $tpl_var, $value, $merge);
return $this;
}
/**
- * Returns a single or all template variables
- *
- * @param string $varname variable name or null
- * @param object $_ptr optional pointer to data object
- * @param boolean $search_parents include parent templates?
- *
- * @return string variable value or or array of variables
- */
- public function getTemplateVars($varname = null, $_ptr = null, $search_parents = true)
- {
- return Smarty_Internal_Extension_GetVars::getTemplateVars($this, $varname, $_ptr, $search_parents);
- }
-
- /**
- * clear the given assigned template variable.
+ * assigns values to template variables by reference
*
- * @param string|array $tpl_var the template variable(s) to clear
+ * @param string $tpl_var the template variable name
+ * @param $value
+ * @param boolean $nocache if true any output of this variable will be not cached
*
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for
* chaining
*/
- public function clearAssign($tpl_var)
+ public function assignByRef($tpl_var, &$value, $nocache = false)
{
- if (is_array($tpl_var)) {
- foreach ($tpl_var as $curr_var) {
- unset($this->tpl_vars[$curr_var]);
- }
- } else {
- unset($this->tpl_vars[$tpl_var]);
+ if ($tpl_var != '') {
+ $this->tpl_vars[$tpl_var] = new Smarty_Variable(null, $nocache);
+ $this->tpl_vars[$tpl_var]->value = &$value;
}
return $this;
}
/**
- * clear all the assigned template variables.
+ * Returns a single or all template variables
*
- * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for
- * chaining
- */
- public function clearAllAssign()
- {
- $this->tpl_vars = array();
-
- return $this;
- }
-
- /**
- * load a config file, optionally load just selected sections
+ * @api Smarty::getTemplateVars()
+ * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl
*
- * @param string $config_file filename
- * @param mixed $sections array of section names, single section or null
+ * @param string $varname variable name or null
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object
+ * @param bool $search_parents include parent templates?
*
- * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for
- * chaining
+ * @return mixed variable value or or array of variables
*/
- public function configLoad($config_file, $sections = null)
+ public function getTemplateVars($varname = null, Smarty_Internal_Data $_ptr = null, $search_parents = true)
{
- // load Config class
- Smarty_Internal_Extension_Config::configLoad($this, $config_file, $sections);
- return $this;
+ if (isset($varname)) {
+ $_var = $this->_getVariable($varname, $_ptr, $search_parents, false);
+ if (is_object($_var)) {
+ return $_var->value;
+ } else {
+ return null;
+ }
+ } else {
+ $_result = array();
+ if ($_ptr === null) {
+ $_ptr = $this;
+ }
+ while ($_ptr !== null) {
+ foreach ($_ptr->tpl_vars AS $key => $var) {
+ if (!array_key_exists($key, $_result)) {
+ $_result[$key] = $var->value;
+ }
+ }
+ // not found, try at parent
+ if ($search_parents) {
+ $_ptr = $_ptr->parent;
+ } else {
+ $_ptr = null;
+ }
+ }
+ if ($search_parents && isset(Smarty::$global_tpl_vars)) {
+ foreach (Smarty::$global_tpl_vars AS $key => $var) {
+ if (!array_key_exists($key, $_result)) {
+ $_result[$key] = $var->value;
+ }
+ }
+ }
+ return $_result;
+ }
}
-
/**
* gets the object of a Smarty variable
*
- * @param string $variable the name of the Smarty variable
- * @param object $_ptr optional pointer to data object
- * @param boolean $search_parents search also in parent data
- * @param bool $error_enable
+ * @param string $variable the name of the Smarty variable
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object
+ * @param bool $search_parents search also in parent data
+ * @param bool $error_enable
*
- * @return object the object of the variable
+ * @return \Smarty_Variable
*/
- public function getVariable($variable, $_ptr = null, $search_parents = true, $error_enable = true)
+ public function _getVariable($variable, Smarty_Internal_Data $_ptr = null, $search_parents = true, $error_enable = true)
{
- return Smarty_Internal_Extension_GetVars::getVariable($this, $variable, $_ptr, $search_parents, $error_enable);
+ if ($_ptr === null) {
+ $_ptr = $this;
+ }
+ while ($_ptr !== null) {
+ if (isset($_ptr->tpl_vars[$variable])) {
+ // found it, return it
+ return $_ptr->tpl_vars[$variable];
+ }
+ // not found, try at parent
+ if ($search_parents) {
+ $_ptr = $_ptr->parent;
+ } else {
+ $_ptr = null;
+ }
+ }
+ if (isset(Smarty::$global_tpl_vars[$variable])) {
+ // found it, return it
+ return Smarty::$global_tpl_vars[$variable];
+ }
+ /* @var \Smarty $smarty */
+ $smarty = isset($this->smarty) ? $this->smarty : $this;
+ if ($smarty->error_unassigned && $error_enable) {
+ // force a notice
+ $x = $$variable;
+ }
+
+ return new Smarty_Undefined_Variable;
}
/**
- * gets a config variable
+ * gets a config variable value
*
* @param string $variable the name of the config variable
* @param bool $error_enable
*
* @return mixed the value of the config variable
*/
- public function getConfigVariable($variable, $error_enable = true)
+ public function _getConfigVariable($variable, $error_enable = true)
{
- return Smarty_Internal_Extension_Config::getConfigVariable($this, $variable, $error_enable = true);
+ $_ptr = $this;
+ while ($_ptr !== null) {
+ if (isset($_ptr->config_vars[$variable])) {
+ // found it, return it
+ return $_ptr->config_vars[$variable];
+ }
+ // not found, try at parent
+ $_ptr = $_ptr->parent;
+ }
+ /* @var \Smarty $smarty */
+ $smarty = isset($this->smarty) ? $this->smarty : $this;
+ if ($smarty->error_unassigned && $error_enable) {
+ // force a notice
+ $x = $$variable;
+ }
+ return null;
}
/**
- * Returns a single or all config variables
+ * Handle unknown class methods
*
- * @param string $varname variable name or null
- * @param bool $search_parents
+ * @param string $name unknown method-name
+ * @param array $args argument array
*
- * @return string variable value or or array of variables
+ * @return mixed
+ * @throws SmartyException
*/
- public function getConfigVars($varname = null, $search_parents = true)
+ public function __call($name, $args)
{
- return Smarty_Internal_Extension_Config::getConfigVars($this, $varname, $search_parents);
- }
+ static $_resolved_property_name = array();
- /**
- * Deassigns a single or all config variables
- *
- * @param string $varname variable name or null
- *
- * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for
- * chaining
- */
- public function clearConfig($varname = null)
- {
- return Smarty_Internal_Extension_Config::clearConfig($this, $varname);
- }
+ if (!isset(Smarty::$extObjCache[$name])) {
- /**
- * gets a stream variable
- *
- * @param string $variable the stream of the variable
- *
- * @throws SmartyException
- * @return mixed the value of the stream variable
- */
- public function getStreamVariable($variable)
- {
- return Smarty_Internal_Extension_GetStreamVar::getStreamVariable($this, $variable);
+ $class = 'Smarty_Internal_Method_' . ucfirst($name);
+ if (preg_match('/^(set|get)([A-Z].*)$/', $name, $match)) {
+ if (!isset($this->_property_info[$prop = $match[2]])) {
+ $smarty = isset($this->smarty) ? $this->smarty : $this;
+ if (!isset($this->_property_info[$prop])) {
+ // convert camel case to underscored name
+ $_resolved_property_name[$prop] = $pn = strtolower(join('_', preg_split('/([A-Z][^A-Z]*)/', $prop, - 1, PREG_SPLIT_NO_EMPTY |
+ PREG_SPLIT_DELIM_CAPTURE)));
+ $this->_property_info[$prop] = property_exists($this, $pn) ? 1 : ($this->_objType == 2 &&
+ property_exists($smarty, $pn) ? 2 : 0);
+ }
+ }
+ if ($this->_property_info[$prop]) {
+ $pn = $_resolved_property_name[$prop];
+ if ($match[1] == 'get') {
+ return $this->_property_info[$prop] == 1 ? $this->$pn : $this->smarty->$pn;
+ } else {
+ return $this->_property_info[$prop] ==
+ 1 ? $this->$pn = $args[0] : $this->smarty->$pn = $args[0];
+ }
+ } elseif (!class_exists($class)) {
+ throw new SmartyException("property '$pn' does not exist.");
+ }
+ }
+ if (class_exists($class)) {
+ $callback = array(Smarty::$extObjCache[$name] = new $class(), $name);
+ }
+ } else {
+ $callback = array(Smarty::$extObjCache[$name], $name);
+ }
+ if (isset($callback) && $callback[0]->objMap | $this->_objType) {
+ array_unshift($args, $this);
+ return call_user_func_array($callback, $args);
+ }
+ throw new SmartyException("method '$name' does not exist.");
}
}
diff --git a/libs/sysplugins/smarty_internal_extension_config.php b/libs/sysplugins/smarty_internal_extension_config.php
deleted file mode 100644
index c97e3d6d..00000000
--- a/libs/sysplugins/smarty_internal_extension_config.php
+++ /dev/null
@@ -1,160 +0,0 @@
-<?php
-
-/**
- * @package Smarty
- * @subpackage PluginsInternal
- */
-class Smarty_Internal_Extension_Config
-{
- /**
- * @param $obj
- * @param $config_file
- * @param null $sections
- * @param string $scope
- */
- static function configLoad($obj, $config_file, $sections = null, $scope = 'local')
- {
- $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
- $confObj = new $smarty->template_class($config_file, $smarty, $obj);
- $confObj->caching = Smarty::CACHING_OFF;
- $confObj->source = Smarty_Template_Config::load($confObj);
- $confObj->source->config_sections = $sections;
- $confObj->source->scope = $scope;
- $confObj->compiled = Smarty_Template_Compiled::load($confObj);
- if ($confObj->smarty->debugging) {
- Smarty_Internal_Debug::start_render($confObj);
- }
- $confObj->compiled->render($confObj);
- if ($confObj->smarty->debugging) {
- Smarty_Internal_Debug::end_render($confObj);
- }
- if ($obj instanceof Smarty_Internal_Template) {
- $obj->compiled->file_dependency[$confObj->source->uid] = array($confObj->source->filepath, $confObj->source->getTimeStamp(), $confObj->source->type);
- }
- }
-
- /**
- * load config variables
- *
- * @param mixed $sections array of section names, single section or null
- * @param string $scope global,parent or local
- *
- * @throws Exception
- */
- static function loadConfigVars($_template, $_config_vars)
- {
- $scope = $_template->source->scope;
- // pointer to scope (local scope is parent of template object
- $scope_ptr = $_template->parent;
- if ($scope == 'parent') {
- if (isset($_template->parent->parent)) {
- $scope_ptr = $_template->parent->parent;
- }
- } elseif ($scope == 'root' || $scope == 'global') {
- while (isset($scope_ptr->parent)) {
- $scope_ptr = $scope_ptr->parent;
- }
- }
- // copy global config vars
- foreach ($_config_vars['vars'] as $variable => $value) {
- if ($_template->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) {
- $scope_ptr->config_vars[$variable] = $value;
- } else {
- $scope_ptr->config_vars[$variable] = array_merge((array) $scope_ptr->config_vars[$variable], (array) $value);
- }
- }
- // scan sections
- $sections = $_template->source->config_sections;
- if (!empty($sections)) {
- foreach ((array) $sections as $_template_section) {
- if (isset($_config_vars['sections'][$_template_section])) {
- foreach ($_config_vars['sections'][$_template_section]['vars'] as $variable => $value) {
- if ($_template->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) {
- $scope_ptr->config_vars[$variable] = $value;
- } else {
- $scope_ptr->config_vars[$variable] = array_merge((array) $scope_ptr->config_vars[$variable], (array) $value);
- }
- }
- }
- }
- }
- }
-
- /**
- * Returns a single or all config variables
- *
- * @param string $varname variable name or null
- * @param bool $search_parents
- *
- * @return string variable value or or array of variables
- */
- static function getConfigVars($obj, $varname = null, $search_parents = true)
- {
- $_ptr = $obj;
- $var_array = array();
- while ($_ptr !== null) {
- if (isset($varname)) {
- if (isset($_ptr->config_vars[$varname])) {
- return $_ptr->config_vars[$varname];
- }
- } else {
- $var_array = array_merge($_ptr->config_vars, $var_array);
- }
- // not found, try at parent
- if ($search_parents) {
- $_ptr = $_ptr->parent;
- } else {
- $_ptr = null;
- }
- }
- if (isset($varname)) {
- return '';
- } else {
- return $var_array;
- }
- }
-
- /**
- * gets a config variable
- *
- * @param string $variable the name of the config variable
- * @param bool $error_enable
- *
- * @return mixed the value of the config variable
- */
- static function getConfigVariable($obj, $variable, $error_enable = true)
- {
- $_ptr = $obj;
- while ($_ptr !== null) {
- if (isset($_ptr->config_vars[$variable])) {
- // found it, return it
- return $_ptr->config_vars[$variable];
- }
- // not found, try at parent
- $_ptr = $_ptr->parent;
- }
- if ($obj->error_unassigned && $error_enable) {
- // force a notice
- $x = $$variable;
- }
-
- return null;
- }
-
- /**
- * remove a single or all config variables
- *
- * @param string $name variable name or null
- *
- * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
- */
- static function clearConfig($obj, $name = null)
- {
- if (isset($name)) {
- unset($obj->config_vars[$name]);
- } else {
- $obj->config_vars = array();
- }
- return $obj;
- }
-}
diff --git a/libs/sysplugins/smarty_internal_extension_defaulttemplatehandler.php b/libs/sysplugins/smarty_internal_extension_defaulttemplatehandler.php
deleted file mode 100644
index 1f58f04f..00000000
--- a/libs/sysplugins/smarty_internal_extension_defaulttemplatehandler.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-/**
- * Smarty Resource Extension
- *
- * @package Smarty
- * @subpackage TemplateResources
- * @author Uwe Tews
- */
-
-/**
- * Smarty Resource Extension
- * Default template and config file handling
- *
- * @package Smarty
- * @subpackage TemplateResources
- */
-class Smarty_Internal_Extension_DefaultTemplateHandler
-{
-
- /**
- * get default content from template of config resource handler
- *
- * @param Smarty_Internal_Template $_template
- * @param Smarty_Template_Source $source
- */
- static function _getDefault(Smarty_Internal_Template $_template, $source)
- {
- if ($source->isConfig) {
- $default_handler = $_template->smarty->default_config_handler_func;
- } else {
- $default_handler = $_template->smarty->default_template_handler_func;
- }
- $_content = $_timestamp = null;
- $_return = call_user_func_array($default_handler,
- array($source->type, $source->name, &$_content, &$_timestamp, $source->smarty));
- if (is_string($_return)) {
- $source->exists = is_file($_return);
- if ($source->exists) {
- $source->timestamp = filemtime($_return);
- }
- $source->filepath = $_return;
- } elseif ($_return === true) {
- $source->content = $_content;
- $source->timestamp = $_timestamp;
- $source->exists = true;
- $source->recompiled = true;
- $source->filepath = false;
- }
- }
-
- /**
- * register template default handler
- *
- * @param Smarty $smarty
- * @param mixed $callback
- *
- * @throws SmartyException
- */
- static function registerDefaultTemplateHandler(Smarty $smarty, $callback)
- {
- if (is_callable($callback)) {
- $smarty->default_template_handler_func = $callback;
- } else {
- throw new SmartyException("Default template handler not callable");
- }
- }
-
- /**
- * register config default handler
- *
- * @param Smarty $smarty
- * @param mixed $callback
- *
- * @throws SmartyException
- */
- static function registerDefaultConfigHandler(Smarty $smarty, $callback)
- {
- if (is_callable($callback)) {
- $smarty->default_config_handler_func = $callback;
- } else {
- throw new SmartyException("Default config handler not callable");
- }
- }
-} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_extension_filter.php b/libs/sysplugins/smarty_internal_extension_filter.php
deleted file mode 100644
index 1fd8fcaf..00000000
--- a/libs/sysplugins/smarty_internal_extension_filter.php
+++ /dev/null
@@ -1,150 +0,0 @@
-<?php
-
-/**
- * Smarty Extension Filter
- *
- * Register filter methods
- * Load filter method
- *
- * @package Smarty
- * @subpackage PluginsInternal
- * @author Uwe Tews
- */
-class Smarty_Internal_Extension_Filter
-{
- /**
- * Valid filter types
- *
- * @var array
- */
- static $filterTypes = array('pre' => true, 'post' => true, 'output' => true, 'variable' => true);
-
- /**
- * Registers a filter function
- *
- * @param \Smarty_Internal_Template|\Smarty $obj
- * @param string $type filter type
- * @param callback $callback
- * @param string|null $name optional filter name
- *
- * @throws \SmartyException
- */
- static function registerFilter($obj, $type, $callback, $name)
- {
- self::_checkFilterType($type);
- $name = isset($name) ? $name : self::_getFilterName($callback);
- if (!is_callable($callback)) {
- throw new SmartyException("{$type}filter \"{$name}\" not callable");
- }
- $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
- $smarty->registered_filters[$type][$name] = $callback;
- }
-
- /**
- * Unregisters a filter function
- *
- * @param \Smarty_Internal_Template|\Smarty $obj
- * @param string $type filter type
- * @param callback|string $callback
- *
- */
- static function unregisterFilter($obj, $type, $callback)
- {
- self::_checkFilterType($type);
- $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
- if (isset($smarty->registered_filters[$type])) {
- $name = is_string($callback) ? $callback : self::_getFilterName($callback);
- if (isset($smarty->registered_filters[$type][$name])) {
- unset($smarty->registered_filters[$type][$name]);
- if (empty($smarty->registered_filters[$type])) {
- unset($smarty->registered_filters[$type]);
- }
- }
- }
- }
-
- /**
- * load a filter of specified type and name
- *
- * @param \Smarty_Internal_Template|\Smarty $obj
- * @param string $type filter type
- * @param string $name filter name
- *
- * @return bool
- * @throws SmartyException if filter could not be loaded
- */
- static function loadFilter($obj, $type, $name)
- {
- self::_checkFilterType($type);
- $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
- $_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 true;
- }
- }
- throw new SmartyException("{$type}filter \"{$name}\" not callable");
- }
-
- /**
- * unload a filter of specified type and name
- *
- * @param \Smarty_Internal_Template|\Smarty $obj
- * @param string $type filter type
- * @param string $name filter name
- *
- */
- static function unloadFilter($obj, $type, $name)
- {
- self::_checkFilterType($type);
- $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
- if (isset($smarty->registered_filters[$type])) {
- $_filter_name = "smarty_{$type}filter_{$name}";
- if (isset($smarty->registered_filters[$type][$_filter_name])) {
- unset ($smarty->registered_filters[$type][$_filter_name]);
- if (empty($smarty->registered_filters[$type])) {
- unset($smarty->registered_filters[$type]);
- }
- }
- }
- }
-
- /**
- * Return internal filter name
- *
- * @param callback $function_name
- *
- * @return string internal filter name
- */
- static function _getFilterName($function_name)
- {
- if (is_array($function_name)) {
- $_class_name = (is_object($function_name[0]) ? get_class($function_name[0]) : $function_name[0]);
-
- return $_class_name . '_' . $function_name[1];
- } elseif (is_string($function_name)) {
- return $function_name;
- } else {
- return 'closure';
- }
- }
-
- /**
- * Check if filter type is valid
- *
- * @param string $type
- *
- * @throws \SmartyException
- */
- static function _checkFilterType($type)
- {
- if (!isset(self::$filterTypes[$type])) {
- throw new SmartyException("Illegal filter type \"{$type}\"");
- }
- }
-} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_extension_getvars.php b/libs/sysplugins/smarty_internal_extension_getvars.php
deleted file mode 100644
index c2d0d9d4..00000000
--- a/libs/sysplugins/smarty_internal_extension_getvars.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-
-/**
- * Smarty Extension GetVars
- *
- * getTemplateVars() and getVariable() methods
- *
- * @package Smarty
- * @subpackage PluginsInternal
- * @author Uwe Tews
- */
-class Smarty_Internal_Extension_GetVars
-{
- /**
- * Returns a single or all template variables
- *
- * @param $obj
- * @param string $varname variable name or null
- * @param object $_ptr optional pointer to data object
- * @param boolean $search_parents include parent templates?
- *
- * @return string variable value or or array of variables
- */
- public static function getTemplateVars($obj, $varname, $_ptr, $search_parents)
- {
- if (isset($varname)) {
- $_var = self::getVariable($obj, $varname, $_ptr, $search_parents, false);
- if (is_object($_var)) {
- return $_var->value;
- } else {
- return null;
- }
- } else {
- $_result = array();
- if ($_ptr === null) {
- $_ptr = $obj;
- }
- while ($_ptr !== null) {
- foreach ($_ptr->tpl_vars AS $key => $var) {
- if (!array_key_exists($key, $_result)) {
- $_result[$key] = $var->value;
- }
- }
- // not found, try at parent
- if ($search_parents) {
- $_ptr = $_ptr->parent;
- } else {
- $_ptr = null;
- }
- }
- if ($search_parents && isset(Smarty::$global_tpl_vars)) {
- foreach (Smarty::$global_tpl_vars AS $key => $var) {
- if (!array_key_exists($key, $_result)) {
- $_result[$key] = $var->value;
- }
- }
- }
-
- return $_result;
- }
- }
-
- /**
- * gets the object of a Smarty variable
- *
- * @param $obj
- * @param string $variable the name of the Smarty variable
- * @param object $_ptr optional pointer to data object
- * @param boolean $search_parents search also in parent data
- * @param bool $error_enable
- *
- * @return object the object of the variable
- */
- public static function getVariable($obj, $variable, $_ptr, $search_parents, $error_enable)
- {
- if ($_ptr === null) {
- $_ptr = $obj;
- }
- while ($_ptr !== null) {
- if (isset($_ptr->tpl_vars[$variable])) {
- // found it, return it
- return $_ptr->tpl_vars[$variable];
- }
- // not found, try at parent
- if ($search_parents) {
- $_ptr = $_ptr->parent;
- } else {
- $_ptr = null;
- }
- }
- if (isset(Smarty::$global_tpl_vars[$variable])) {
- // found it, return it
- return Smarty::$global_tpl_vars[$variable];
- }
- $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
- if ($smarty->error_unassigned && $error_enable) {
- // force a notice
- $x = $$variable;
- }
-
- return new Smarty_Undefined_Variable;
- }
-} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_extension_object.php b/libs/sysplugins/smarty_internal_extension_object.php
deleted file mode 100644
index 05fc35a6..00000000
--- a/libs/sysplugins/smarty_internal_extension_object.php
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-
-/**
- * Smarty Extension Object
- *
- * Register object methods
- *
- * @package Smarty
- * @subpackage PluginsInternal
- * @author Uwe Tews
- */
-class Smarty_Internal_Extension_Object
-{
- /**
- * Registers object to be used in templates
- *
- * @param \Smarty_Internal_Template|\Smarty $obj
- * @param string $object_name
- * @param object $object_impl the referenced PHP object to register
- * @param array $allowed list of allowed methods (empty = all)
- * @param boolean $smarty_args smarty argument format, else traditional
- * @param array $block_methods list of block-methods
- *
- * @return \Smarty_Internal_Templatebase
- * @throws \SmartyException
- */
- static function registerObject($obj, $object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
- {
- // test if allowed methods callable
- if (!empty($allowed)) {
- foreach ((array) $allowed as $method) {
- if (!is_callable(array($object_impl, $method)) && !property_exists($object_impl, $method)) {
- throw new SmartyException("Undefined method or property '$method' in registered object");
- }
- }
- }
- // test if block methods callable
- if (!empty($block_methods)) {
- foreach ((array) $block_methods as $method) {
- if (!is_callable(array($object_impl, $method))) {
- throw new SmartyException("Undefined method '$method' in registered object");
- }
- }
- }
- // register the object
- $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
- $smarty->registered_objects[$object_name] = array($object_impl, (array) $allowed, (boolean) $smarty_args,
- (array) $block_methods);
- }
-
- /**
- * return a reference to a registered object
- *
- * @param \Smarty_Internal_Template|\Smarty $obj
- * @param string $name object name
- *
- * @return object
- * @throws \SmartyException if no such object is found
- */
- static function getRegisteredObject($obj, $name)
- {
- $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
- if (!isset($smarty->registered_objects[$name])) {
- throw new SmartyException("'$name' is not a registered object");
- }
- if (!is_object($smarty->registered_objects[$name][0])) {
- throw new SmartyException("registered '$name' is not an object");
- }
- return $smarty->registered_objects[$name][0];
- }
-
- /**
- * unregister an object
- *
- * @param \Smarty_Internal_Template|\Smarty $obj
- * @param string $name object name
- *
- * @return \Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or
- * Smarty_Internal_Template) instance for chaining
- */
- static function unregisterObject($obj, $name)
- {
- $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
- if (isset($smarty->registered_objects[$name])) {
- unset($smarty->registered_objects[$name]);
- }
- }
-
- /**
- * Registers static classes to be used in templates
- *
- * @param \Smarty_Internal_Template|\Smarty $obj
- * @param string $class_name
- * @param string $class_impl the referenced PHP class to register
- *
- * @return \Smarty_Internal_Templatebase
- * @throws \SmartyException
- */
- static function registerClass($obj, $class_name, $class_impl)
- {
- // test if exists
- if (!class_exists($class_impl)) {
- throw new SmartyException("Undefined class '$class_impl' in register template class");
- }
- // register the class
- $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
- $smarty->registered_classes[$class_name] = $class_impl;
- }
-
-} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_addautoloadfilters.php b/libs/sysplugins/smarty_internal_method_addautoloadfilters.php
new file mode 100644
index 00000000..b739f0e3
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_addautoloadfilters.php
@@ -0,0 +1,51 @@
+<?php
+
+/**
+ * Smarty Method AddAutoloadFilters
+ *
+ * Smarty::addAutoloadFilters() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_AddAutoloadFilters extends Smarty_Internal_Method_SetAutoloadFilters
+{
+
+ /**
+ * Add autoload filters
+ *
+ * @api Smarty::setAutoloadFilters()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param array $filters filters to load automatically
+ * @param string $type "pre", "output", … specify the
+ * filter type to set. Defaults to
+ * none treating $filters' keys as
+ * the appropriate types
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function addAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if ($type !== null) {
+ $this->_checkFilterType($type);
+ if (!empty($smarty->autoload_filters[$type])) {
+ $smarty->autoload_filters[$type] = array_merge($smarty->autoload_filters[$type], (array) $filters);
+ } else {
+ $smarty->autoload_filters[$type] = (array) $filters;
+ }
+ } else {
+ foreach ((array) $filters as $type => $value) {
+ $this->_checkFilterType($type);
+ if (!empty($smarty->autoload_filters[$type])) {
+ $smarty->autoload_filters[$type] = array_merge($smarty->autoload_filters[$type], (array) $value);
+ } else {
+ $smarty->autoload_filters[$type] = (array) $value;
+ }
+ }
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php b/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php
new file mode 100644
index 00000000..55d2c9e7
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * Smarty Method AddDefaultModifiers
+ *
+ * Smarty::addDefaultModifiers() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_AddDefaultModifiers
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Add default modifiers
+ *
+ * @api Smarty::addDefaultModifiers()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param array|string $modifiers modifier or list of modifiers
+ * to add
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function addDefaultModifiers(Smarty_Internal_TemplateBase $obj, $modifiers)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (is_array($modifiers)) {
+ $this->default_modifiers = array_merge($smarty->default_modifiers, $modifiers);
+ } else {
+ $smarty->default_modifiers[] = $modifiers;
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_append.php b/libs/sysplugins/smarty_internal_method_append.php
new file mode 100644
index 00000000..82b741cc
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_append.php
@@ -0,0 +1,72 @@
+<?php
+
+/**
+ * Smarty Method Append
+ *
+ * Smarty::append() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_Append
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * appends values to template variables
+ *
+ * @api Smarty::append()
+ * @link http://www.smarty.net/docs/en/api.append.tpl
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param array|string $tpl_var the template variable name(s)
+ * @param mixed $value the value to append
+ * @param bool $merge flag if array elements shall be merged
+ * @param bool $nocache if true any output of this variable will
+ * be not cached
+ *
+ * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
+ */
+ public function append(Smarty_Internal_Data $data, $tpl_var, $value = null, $merge = false, $nocache = false)
+ {
+ if (is_array($tpl_var)) {
+ // $tpl_var is an array, ignore $value
+ foreach ($tpl_var as $_key => $_val) {
+ if ($_key != '') {
+ self::append($data, $_key, $_val, $merge, $nocache);
+ }
+ }
+ } else {
+ if ($tpl_var != '' && isset($value)) {
+ if (!isset($data->tpl_vars[$tpl_var])) {
+ $tpl_var_inst = $data->_getVariable($tpl_var, null, true, false);
+ if ($tpl_var_inst instanceof Smarty_Undefined_Variable) {
+ $data->tpl_vars[$tpl_var] = new Smarty_Variable(null, $nocache);
+ } else {
+ $data->tpl_vars[$tpl_var] = clone $tpl_var_inst;
+ }
+ }
+ if (!(is_array($data->tpl_vars[$tpl_var]->value) ||
+ $data->tpl_vars[$tpl_var]->value instanceof ArrayAccess)
+ ) {
+ settype($data->tpl_vars[$tpl_var]->value, 'array');
+ }
+ if ($merge && is_array($value)) {
+ foreach ($value as $_mkey => $_mval) {
+ $data->tpl_vars[$tpl_var]->value[$_mkey] = $_mval;
+ }
+ } else {
+ $data->tpl_vars[$tpl_var]->value[] = $value;
+ }
+ }
+ }
+
+ return $data;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_appendbyref.php b/libs/sysplugins/smarty_internal_method_appendbyref.php
new file mode 100644
index 00000000..5a55e972
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_appendbyref.php
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ * Smarty Method AppendByRef
+ *
+ * Smarty::appendByRef() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_AppendByRef
+{
+
+ /**
+ * appends values to template variables by reference
+ *
+ * @api Smarty::appendByRef()
+ * @link http://www.smarty.net/docs/en/api.append.by.ref.tpl
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string $tpl_var the template variable name
+ * @param mixed &$value the referenced value to append
+ * @param bool $merge flag if array elements shall be merged
+ *
+ * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
+ */
+ public static function appendByRef(Smarty_Internal_Data $data, $tpl_var, &$value, $merge = false)
+ {
+ if ($tpl_var != '' && isset($value)) {
+ if (!isset($data->tpl_vars[$tpl_var])) {
+ $data->tpl_vars[$tpl_var] = new Smarty_Variable();
+ }
+ if (!is_array($data->tpl_vars[$tpl_var]->value)) {
+ settype($data->tpl_vars[$tpl_var]->value, 'array');
+ }
+ if ($merge && is_array($value)) {
+ foreach ($value as $_key => $_val) {
+ $data->tpl_vars[$tpl_var]->value[$_key] = &$value[$_key];
+ }
+ } else {
+ $data->tpl_vars[$tpl_var]->value[] = &$value;
+ }
+ }
+
+ return $data;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_clearallassign.php b/libs/sysplugins/smarty_internal_method_clearallassign.php
new file mode 100644
index 00000000..1e5fec4b
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_clearallassign.php
@@ -0,0 +1,37 @@
+<?php
+
+/**
+ * Smarty Method ClearAllAssign
+ *
+ * Smarty::clearAllAssign() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_ClearAllAssign
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * clear all the assigned template variables.
+ *
+ * @api Smarty::clearAllAssign()
+ * @link http://www.smarty.net/docs/en/api.clear.all.assign.tpl
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ *
+ * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
+ */
+ public function clearAllAssign(Smarty_Internal_Data $data)
+ {
+ $data->tpl_vars = array();
+
+ return $data;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_clearallcache.php b/libs/sysplugins/smarty_internal_method_clearallcache.php
new file mode 100644
index 00000000..24ceb0ed
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_clearallcache.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * Smarty Method ClearAllCache
+ *
+ * Smarty::clearAllCache() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_ClearAllCache
+{
+ /**
+ * Valid for Smarty object
+ *
+ * @var int
+ */
+ public $objMap = 1;
+
+ /**
+ * Empty cache folder
+ *
+ * @api Smarty::clearAllCache()
+ * @link http://www.smarty.net/docs/en/api.clear.all.cache.tpl
+ *
+ * @param \Smarty $smarty
+ * @param integer $exp_time expiration time
+ * @param string $type resource type
+ *
+ * @return integer number of cache files deleted
+ */
+ public function clearAllCache(Smarty $smarty, $exp_time = null, $type = null)
+ {
+ // load cache resource and call clearAll
+ $_cache_resource = Smarty_CacheResource::load($smarty, $type);
+ Smarty_CacheResource::invalidLoadedCache($smarty);
+
+ return $_cache_resource->clearAll($smarty, $exp_time);
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_clearassign.php b/libs/sysplugins/smarty_internal_method_clearassign.php
new file mode 100644
index 00000000..3a7bd1e4
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_clearassign.php
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * Smarty Method ClearAssign
+ *
+ * Smarty::clearAssign() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_ClearAssign
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * clear the given assigned template variable(s).
+ *
+ * @api Smarty::clearAssign()
+ * @link http://www.smarty.net/docs/en/api.clear.assign.tpl
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string|array $tpl_var the template variable(s) to clear
+ *
+ * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
+ */
+ public function clearAssign(Smarty_Internal_Data $data, $tpl_var)
+ {
+ if (is_array($tpl_var)) {
+ foreach ($tpl_var as $curr_var) {
+ unset($data->tpl_vars[$curr_var]);
+ }
+ } else {
+ unset($data->tpl_vars[$tpl_var]);
+ }
+
+ return $data;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_clearcache.php b/libs/sysplugins/smarty_internal_method_clearcache.php
new file mode 100644
index 00000000..7db0a145
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_clearcache.php
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * Smarty Method ClearCache
+ *
+ * Smarty::clearCache() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_ClearCache
+{
+ /**
+ * Valid for Smarty object
+ *
+ * @var int
+ */
+ public $objMap = 1;
+
+ /**
+ * Empty cache for a specific template
+ *
+ * @api Smarty::clearCache()
+ * @link http://www.smarty.net/docs/en/api.clear.cache.tpl
+ *
+ * @param \Smarty $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
+ */
+ public function clearCache(Smarty $smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
+ {
+ // load cache resource and call clear
+ $_cache_resource = Smarty_CacheResource::load($smarty, $type);
+ Smarty_CacheResource::invalidLoadedCache($smarty);
+
+ return $_cache_resource->clear($smarty, $template_name, $cache_id, $compile_id, $exp_time);
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_extension_clearcompiled.php b/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php
index e6761262..6f18bf36 100644
--- a/libs/sysplugins/smarty_internal_extension_clearcompiled.php
+++ b/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php
@@ -1,28 +1,39 @@
<?php
/**
- * Smarty Extension ClearCompiled
+ * Smarty Method ClearCompiledTemplate
*
- * $smarty->clearCompiledTemplate() method
+ * Smarty::clearCompiledTemplate() method
*
* @package Smarty
* @subpackage PluginsInternal
* @author Uwe Tews
*/
-class Smarty_Internal_Extension_ClearCompiled
+class Smarty_Internal_Method_ClearCompiledTemplate
{
/**
+ * Valid for Smarty object
+ *
+ * @var int
+ */
+ public $objMap = 1;
+
+ /**
* Delete compiled template file
*
- * @param Smarty $smarty Smarty instance
+ * @api Smarty::clearCompiledTemplate()
+ * @link http://www.smarty.net/docs/en/api.clear.compiled.template.tpl
+ *
+ * @param \Smarty $smarty
* @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 static function clearCompiledTemplate(Smarty $smarty, $resource_name, $compile_id, $exp_time)
+ public function clearCompiledTemplate(Smarty $smarty, $resource_name = null, $compile_id = null, $exp_time = null)
{
+
$_compile_dir = $smarty->getCompileDir();
if ($_compile_dir == '/') { //We should never want to delete this!
return 0;
@@ -32,6 +43,7 @@ class Smarty_Internal_Extension_ClearCompiled
if (isset($resource_name)) {
$_save_stat = $smarty->caching;
$smarty->caching = false;
+ /* @var Smarty_Internal_Template $tpl */
$tpl = new $smarty->template_class($resource_name, $smarty);
$smarty->caching = $_save_stat;
if ($tpl->source->exists) {
@@ -47,7 +59,6 @@ class Smarty_Internal_Extension_ClearCompiled
} else {
return 0;
}
-
$_resource_part_2 = str_replace('.php', '.cache.php', $_resource_part_1);
$_resource_part_2_length = strlen($_resource_part_2);
}
diff --git a/libs/sysplugins/smarty_internal_method_clearconfig.php b/libs/sysplugins/smarty_internal_method_clearconfig.php
new file mode 100644
index 00000000..9c6167f4
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_clearconfig.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * Smarty Method ClearConfig
+ *
+ * Smarty::clearConfig() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_ClearConfig
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * clear a single or all config variables
+ *
+ * @api Smarty::clearConfig()
+ * @link http://www.smarty.net/docs/en/api.clear.config.tpl
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string|null $name variable name or null
+ *
+ * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
+ */
+ public function clearConfig(Smarty_Internal_Data $data, $name = null)
+ {
+ if (isset($name)) {
+ unset($data->config_vars[$name]);
+ } else {
+ $data->config_vars = array();
+ }
+ return $data;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_compileallconfig.php b/libs/sysplugins/smarty_internal_method_compileallconfig.php
new file mode 100644
index 00000000..4d6be65c
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_compileallconfig.php
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * Smarty Method CompileAllConfig
+ *
+ * Smarty::compileAllConfig() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_CompileAllConfig extends Smarty_Internal_Method_CompileAllTemplates
+{
+
+ /**
+ * Compile all config files
+ *
+ * @api Smarty::compileAllConfig()
+ *
+ * @param \Smarty $smarty
+ * @param string $extension file extension
+ * @param bool $force_compile force all to recompile
+ * @param int $time_limit
+ * @param int $max_errors
+ *
+ * @return integer number of template files recompiled
+ */
+ public function compileAllConfig(Smarty $smarty, $extension = '.conf', $force_compile = false, $time_limit = 0, $max_errors = null)
+ {
+ return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors, true);
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_extension_compileall.php b/libs/sysplugins/smarty_internal_method_compilealltemplates.php
index 40f2a7f5..6e29fc34 100644
--- a/libs/sysplugins/smarty_internal_extension_compileall.php
+++ b/libs/sysplugins/smarty_internal_method_compilealltemplates.php
@@ -1,29 +1,54 @@
<?php
/**
- * Smarty Extension CompileAll
+ * Smarty Method CompileAllTemplates
*
- * $smarty->clearCompiledTemplate() method
+ * Smarty::compileAllTemplates() method
*
* @package Smarty
* @subpackage PluginsInternal
* @author Uwe Tews
*/
-class Smarty_Internal_Extension_CompileAll
+class Smarty_Internal_Method_CompileAllTemplates
{
/**
+ * Valid for Smarty object
+ *
+ * @var int
+ */
+ public $objMap = 1;
+
+ /**
+ * Compile all template files
+ *
+ * @api Smarty::compileAllTemplates()
+ *
+ * @param \Smarty $smarty
+ * @param string $extension file extension
+ * @param bool $force_compile force all to recompile
+ * @param int $time_limit
+ * @param int $max_errors
+ *
+ * @return integer number of template files recompiled
+ */
+ public function compileAllTemplates(Smarty $smarty, $extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
+ {
+ return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors);
+ }
+
+ /**
* Compile all template or config files
*
+ * @param \Smarty $smarty
* @param string $extension template file name extension
* @param bool $force_compile force all to recompile
* @param int $time_limit set maximum execution time
* @param int $max_errors set maximum allowed errors
- * @param Smarty $smarty Smarty instance
* @param bool $isConfig flag true if called for config files
*
* @return int number of template files compiled
*/
- public static function compileAll($extension, $force_compile, $time_limit, $max_errors, Smarty $smarty, $isConfig = false)
+ protected function compileAll(Smarty $smarty, $extension, $force_compile, $time_limit, $max_errors, $isConfig = false)
{
// switch off time limit
if (function_exists('set_time_limit')) {
@@ -53,6 +78,7 @@ class Smarty_Internal_Extension_CompileAll
$_smarty = clone $smarty;
$_smarty->force_compile = $force_compile;
try {
+ /* @var Smarty_Internal_Template $_tpl */
$_tpl = new $smarty->template_class($_file, $_smarty);
$_tpl->caching = Smarty::CACHING_OFF;
$_tpl->source = $isConfig ? Smarty_Template_Config::load($_tpl) : Smarty_Template_Source::load($_tpl);
@@ -82,4 +108,4 @@ class Smarty_Internal_Extension_CompileAll
echo "\n<br>";
return $_count;
}
-}
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_configload.php b/libs/sysplugins/smarty_internal_method_configload.php
new file mode 100644
index 00000000..5fa17efa
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_configload.php
@@ -0,0 +1,107 @@
+<?php
+
+/**
+ * Smarty Method ConfigLoad
+ *
+ * Smarty::configLoad() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_ConfigLoad
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * load a config file, optionally load just selected sections
+ *
+ * @api Smarty::configLoad()
+ * @link http://www.smarty.net/docs/en/api.config.load.tpl
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string $config_file filename
+ * @param mixed $sections array of section names, single
+ * section or null
+ * @param string $scope scope into which config variables
+ * shall be loaded
+ *
+ * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template
+ * @throws \SmartyException
+ */
+ public function configLoad(Smarty_Internal_Data $data, $config_file, $sections = null, $scope = 'local')
+ {
+ /* @var \Smarty $smarty */
+ $smarty = isset($data->smarty) ? $data->smarty : $data;
+ /* @var \Smarty_Internal_Template $confObj */
+ $confObj = new $smarty->template_class($config_file, $smarty, $data);
+ $confObj->caching = Smarty::CACHING_OFF;
+ $confObj->source = Smarty_Template_Config::load($confObj);
+ $confObj->source->config_sections = $sections;
+ $confObj->source->scope = $scope;
+ $confObj->compiled = Smarty_Template_Compiled::load($confObj);
+ if ($confObj->smarty->debugging) {
+ Smarty_Internal_Debug::start_render($confObj);
+ }
+ $confObj->compiled->render($confObj);
+ if ($confObj->smarty->debugging) {
+ Smarty_Internal_Debug::end_render($confObj);
+ }
+ if ($data instanceof Smarty_Internal_Template) {
+ $data->compiled->file_dependency[$confObj->source->uid] = array($confObj->source->filepath,
+ $confObj->source->getTimeStamp(),
+ $confObj->source->type);
+ }
+ return $data;
+ }
+
+ /**
+ * load config variables into template object
+ *
+ * @param \Smarty_Internal_Template $_template
+ * @param array $_config_vars
+ */
+ static function _loadConfigVars(Smarty_Internal_Template $_template, $_config_vars)
+ {
+ $scope = $_template->source->scope;
+ // pointer to scope (local scope is parent of template object
+ $scope_ptr = $_template->parent;
+ if ($scope == 'parent') {
+ if (isset($_template->parent->parent)) {
+ $scope_ptr = $_template->parent->parent;
+ }
+ } elseif ($scope == 'root' || $scope == 'global') {
+ while (isset($scope_ptr->parent)) {
+ $scope_ptr = $scope_ptr->parent;
+ }
+ }
+ // copy global config vars
+ foreach ($_config_vars['vars'] as $variable => $value) {
+ if ($_template->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) {
+ $scope_ptr->config_vars[$variable] = $value;
+ } else {
+ $scope_ptr->config_vars[$variable] = array_merge((array) $scope_ptr->config_vars[$variable], (array) $value);
+ }
+ }
+ // scan sections
+ $sections = $_template->source->config_sections;
+ if (!empty($sections)) {
+ foreach ((array) $sections as $_template_section) {
+ if (isset($_config_vars['sections'][$_template_section])) {
+ foreach ($_config_vars['sections'][$_template_section]['vars'] as $variable => $value) {
+ if ($_template->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) {
+ $scope_ptr->config_vars[$variable] = $value;
+ } else {
+ $scope_ptr->config_vars[$variable] = array_merge((array) $scope_ptr->config_vars[$variable], (array) $value);
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/libs/sysplugins/smarty_internal_method_createdata.php b/libs/sysplugins/smarty_internal_method_createdata.php
new file mode 100644
index 00000000..600bc777
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_createdata.php
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * Smarty Method CreateData
+ *
+ * Smarty::createData() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_CreateData
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * creates a data object
+ *
+ * @api Smarty::createData()
+ * @link http://www.smarty.net/docs/en/api.create.data.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param \Smarty_Internal_Template|\Smarty_Internal_Data|\Smarty_Data|\Smarty $parent next higher level of Smarty
+ * variables
+ * @param string $name optional data block name
+ *
+ * @returns Smarty_Data data object
+ */
+ public function createData(Smarty_Internal_TemplateBase $obj, Smarty_Internal_Data $parent = null, $name = null)
+ {
+ /* @var Smarty $smarty */
+ $smarty = isset($this->smarty) ? $this->smarty : $obj;
+ $dataObj = new Smarty_Data($parent, $smarty, $name);
+ if ($smarty->debugging) {
+ Smarty_Internal_Debug::register_data($dataObj);
+ }
+ return $dataObj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_getautoloadfilters.php b/libs/sysplugins/smarty_internal_method_getautoloadfilters.php
new file mode 100644
index 00000000..e1a7801f
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_getautoloadfilters.php
@@ -0,0 +1,37 @@
+<?php
+
+/**
+ * Smarty Method GetAutoloadFilters
+ *
+ * Smarty::getAutoloadFilters() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_GetAutoloadFilters extends Smarty_Internal_Method_SetAutoloadFilters
+{
+
+ /**
+ * Get autoload filters
+ *
+ * @api Smarty::getAutoloadFilters()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type type of filter to get auto loads
+ * for. Defaults to all autoload
+ * filters
+ *
+ * @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type
+ * was specified
+ */
+ public function getAutoloadFilters(Smarty_Internal_TemplateBase $obj, $type = null)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if ($type !== null) {
+ $this->_checkFilterType($type);
+ return isset($smarty->autoload_filters[$type]) ? $smarty->autoload_filters[$type] : array();
+ }
+ return $smarty->autoload_filters;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_getconfigvars.php b/libs/sysplugins/smarty_internal_method_getconfigvars.php
new file mode 100644
index 00000000..b1567216
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_getconfigvars.php
@@ -0,0 +1,58 @@
+<?php
+
+/**
+ * Smarty Method GetConfigVars
+ *
+ * Smarty::getConfigVars() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_GetConfigVars
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * Returns a single or all config variables
+ *
+ * @api Smarty::getConfigVars()
+ * @link http://www.smarty.net/docs/en/api.get.config.vars.tpl
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string $varname variable name or null
+ * @param bool $search_parents include parent templates?
+ *
+ * @return mixed variable value or or array of variables
+ */
+ public function getConfigVars(Smarty_Internal_Data $data, $varname = null, $search_parents = true)
+ {
+ $_ptr = $data;
+ $var_array = array();
+ while ($_ptr !== null) {
+ if (isset($varname)) {
+ if (isset($_ptr->config_vars[$varname])) {
+ return $_ptr->config_vars[$varname];
+ }
+ } else {
+ $var_array = array_merge($_ptr->config_vars, $var_array);
+ }
+ // not found, try at parent
+ if ($search_parents) {
+ $_ptr = $_ptr->parent;
+ } else {
+ $_ptr = null;
+ }
+ }
+ if (isset($varname)) {
+ return '';
+ } else {
+ return $var_array;
+ }
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_getdebugtemplate.php b/libs/sysplugins/smarty_internal_method_getdebugtemplate.php
new file mode 100644
index 00000000..3c3432ce
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_getdebugtemplate.php
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * Smarty Method GetDebugTemplate
+ *
+ * Smarty::getDebugTemplate() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_GetDebugTemplate
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * return name of debugging template
+ *
+ * @api Smarty::getDebugTemplate()
+
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ *
+ * @return string
+ */
+ public function getDebugTemplate(Smarty_Internal_TemplateBase $obj)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ return $smarty->debug_tpl;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php b/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php
new file mode 100644
index 00000000..32e0cc41
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * Smarty Method GetDefaultModifiers
+ *
+ * Smarty::getDefaultModifiers() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_GetDefaultModifiers
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Get default modifiers
+ *
+ * @api Smarty::getDefaultModifiers()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ *
+ * @return array list of default modifiers
+ */
+ public function getDefaultModifiers(Smarty_Internal_TemplateBase $obj)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ return $smarty->default_modifiers;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_getregisteredobject.php b/libs/sysplugins/smarty_internal_method_getregisteredobject.php
new file mode 100644
index 00000000..be0c0dba
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_getregisteredobject.php
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * Smarty Method GetRegisteredObject
+ *
+ * Smarty::getRegisteredObject() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_GetRegisteredObject
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * return a reference to a registered object
+ *
+ * @api Smarty::getRegisteredObject()
+ * @link http://www.smarty.net/docs/en/api.get.registered.object.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $object_name object name
+ *
+ * @return object
+ * @throws \SmartyException if no such object is found
+ */
+ public function getRegisteredObject(Smarty_Internal_TemplateBase $obj, $object_name)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (!isset($smarty->registered_objects[$object_name])) {
+ throw new SmartyException("'$object_name' is not a registered object");
+ }
+ if (!is_object($smarty->registered_objects[$object_name][0])) {
+ throw new SmartyException("registered '$object_name' is not an object");
+ }
+ return $smarty->registered_objects[$object_name][0];
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_extension_getstreamvar.php b/libs/sysplugins/smarty_internal_method_getstreamvariable.php
index 5f09e908..b922fd08 100644
--- a/libs/sysplugins/smarty_internal_extension_getstreamvar.php
+++ b/libs/sysplugins/smarty_internal_method_getstreamvariable.php
@@ -1,26 +1,35 @@
<?php
/**
- * Smarty Extension GetStreamVar
+ * Smarty Method GetStreamVariable
*
- * getStreamVariable() method
+ * Smarty::getStreamVariable() method
*
* @package Smarty
* @subpackage PluginsInternal
* @author Uwe Tews
*/
-class Smarty_Internal_Extension_GetStreamVar
+class Smarty_Internal_Method_GetStreamVariable
{
/**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
* gets a stream variable
*
- * @param $obj
- * @param string $variable the stream of the variable
+ * @api Smarty::getStreamVariable()
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string $variable the stream of the variable
*
* @return mixed
* @throws \SmartyException
*/
- public static function getStreamVariable($obj, $variable)
+ public function getStreamVariable(Smarty_Internal_Data $data, $variable)
{
$_result = '';
$fp = fopen($variable, 'r+');
@@ -32,7 +41,7 @@ class Smarty_Internal_Extension_GetStreamVar
return $_result;
}
- $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ $smarty = isset($data->smarty) ? $data->smarty : $data;
if ($smarty->error_unassigned) {
throw new SmartyException('Undefined stream variable "' . $variable . '"');
} else {
diff --git a/libs/sysplugins/smarty_internal_method_gettags.php b/libs/sysplugins/smarty_internal_method_gettags.php
new file mode 100644
index 00000000..347983d2
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_gettags.php
@@ -0,0 +1,61 @@
+<?php
+
+/**
+ * Smarty Method GetTags
+ *
+ * Smarty::getTags() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_GetTags
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Return array of tag/attributes of all tags used by an template
+ *
+ * @api Smarty::getTags()
+ * @link http://www.smarty.net/docs/en/api.get.tags.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param null|string|Smarty_Internal_Template $template
+ *
+ * @return array of tag/attributes
+ * @throws \SmartyException
+ */
+ public function getTags(Smarty_Internal_TemplateBase $obj, $template = null)
+ {
+ /* @var Smarty $smarty */
+ $smarty = isset($this->smarty) ? $this->smarty : $obj;
+ if ($obj instanceof Smarty_Internal_Template && !isset($template)) {
+ $tpl = clone $obj;
+ } elseif (isset($template) && $template instanceof Smarty_Internal_Template) {
+ $tpl = clone $template;
+ } elseif (isset($template) && is_string($template)) {
+ /* @var Smarty_Internal_Template $tpl */
+ $tpl = new $smarty->template_class($template, $smarty);
+ // checks if template exists
+ if (!$tpl->source->exists) {
+ throw new SmartyException("Unable to load template {$tpl->source->type} '{$tpl->source->name}'");
+ }
+ }
+ if (isset($tpl)) {
+ $tpl->smarty = clone $tpl->smarty;
+ $tpl->smarty->get_used_tags = true;
+ $tpl->smarty->merge_compiled_includes = false;
+ $tpl->smarty->disableSecurity();
+ $tpl->caching = false;
+ $tpl->loadCompiler();
+ $tpl->compiler->compileTemplate($tpl);
+ return $tpl->used_tags;
+ }
+ throw new SmartyException("Missing template specification");
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_gettemplatevars.php b/libs/sysplugins/smarty_internal_method_gettemplatevars.php
new file mode 100644
index 00000000..9c963074
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_gettemplatevars.php
@@ -0,0 +1,71 @@
+<?php
+
+/**
+ * Smarty Method GetTemplateVars
+ *
+ * Smarty::getTemplateVars() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_GetTemplateVars
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * Returns a single or all template variables
+ *
+ * @api Smarty::getTemplateVars()
+ * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string $varname variable name or null
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object
+ * @param bool $search_parents include parent templates?
+ *
+ * @return mixed variable value or or array of variables
+ */
+ public function getTemplateVars(Smarty_Internal_Data $data, $varname = null, Smarty_Internal_Data $_ptr = null, $search_parents = true)
+ {
+ if (isset($varname)) {
+ $_var = $data->_getVariable($varname, $_ptr, $search_parents, false);
+ if (is_object($_var)) {
+ return $_var->value;
+ } else {
+ return null;
+ }
+ } else {
+ $_result = array();
+ if ($_ptr === null) {
+ $_ptr = $data;
+ }
+ while ($_ptr !== null) {
+ foreach ($_ptr->tpl_vars AS $key => $var) {
+ if (!array_key_exists($key, $_result)) {
+ $_result[$key] = $var->value;
+ }
+ }
+ // not found, try at parent
+ if ($search_parents) {
+ $_ptr = $_ptr->parent;
+ } else {
+ $_ptr = null;
+ }
+ }
+ if ($search_parents && isset(Smarty::$global_tpl_vars)) {
+ foreach (Smarty::$global_tpl_vars AS $key => $var) {
+ if (!array_key_exists($key, $_result)) {
+ $_result[$key] = $var->value;
+ }
+ }
+ }
+ return $_result;
+ }
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_loadfilter.php b/libs/sysplugins/smarty_internal_method_loadfilter.php
new file mode 100644
index 00000000..7fb11179
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_loadfilter.php
@@ -0,0 +1,77 @@
+<?php
+
+/**
+ * Smarty Method LoadFilter
+ *
+ * Smarty::loadFilter() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_LoadFilter
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Valid filter types
+ *
+ * @var array
+ */
+ private $filterTypes = array('pre' => true, 'post' => true, 'output' => true, 'variable' => true);
+
+ /**
+ * load a filter of specified type and name
+ *
+ * @api Smarty::loadFilter()
+ *
+ * @link http://www.smarty.net/docs/en/api.load.filter.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type filter type
+ * @param string $name filter name
+ *
+ * @return bool
+ * @throws SmartyException if filter could not be loaded
+ */
+ public function loadFilter(Smarty_Internal_TemplateBase $obj, $type, $name)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ $this->_checkFilterType($type);
+ $_plugin = "smarty_{$type}filter_{$name}";
+ $_filter_name = $_plugin;
+ if (is_callable($_plugin)) {
+ $smarty->registered_filters[$type][$_filter_name] = $_plugin;
+ return true;
+ }
+ 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 true;
+ }
+ }
+ throw new SmartyException("{$type}filter \"{$name}\" not found or callable");
+ }
+
+ /**
+ * Check if filter type is valid
+ *
+ * @param string $type
+ *
+ * @throws \SmartyException
+ */
+ public function _checkFilterType($type)
+ {
+ if (!isset($this->filterTypes[$type])) {
+ throw new SmartyException("Illegal filter type \"{$type}\"");
+ }
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_mustcompile.php b/libs/sysplugins/smarty_internal_method_mustcompile.php
new file mode 100644
index 00000000..c0922e4e
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_mustcompile.php
@@ -0,0 +1,49 @@
+<?php
+
+/**
+ * Smarty Method UnloadFilter
+ *
+ * Smarty_Internal_Template::mustCompile() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_MustCompile
+{
+ /**
+ * Valid for template object
+ *
+ * @var int
+ */
+ public $objMap = 2;
+
+ /**
+ * Returns if the current template must be compiled by the Smarty compiler
+ * It does compare the timestamps of template source and the compiled templates and checks the force compile
+ * configuration
+ *
+ * @param \Smarty_Internal_Template $_template
+ *
+ * @return bool
+ * @throws \SmartyException
+ */
+ public function mustCompile(Smarty_Internal_Template $_template)
+ {
+ if (!$_template->source->exists) {
+ if ($_template->parent instanceof Smarty_Internal_Template) {
+ $parent_resource = " in '$_template->parent->template_resource}'";
+ } else {
+ $parent_resource = '';
+ }
+ throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}");
+ }
+ if ($_template->mustCompile === null) {
+ $_template->mustCompile = (!$_template->source->uncompiled &&
+ ($_template->smarty->force_compile || $_template->source->recompiled || !$_template->compiled->exists ||
+ ($_template->smarty->compile_check && $_template->compiled->getTimeStamp() < $_template->source->getTimeStamp())));
+ }
+
+ return $_template->mustCompile;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_registercacheresource.php b/libs/sysplugins/smarty_internal_method_registercacheresource.php
new file mode 100644
index 00000000..55c5090a
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_registercacheresource.php
@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * Smarty Method RegisterCacheResource
+ *
+ * Smarty::registerCacheResource() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterCacheResource
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers a resource to fetch a template
+ *
+ * @api Smarty::registerCacheResource()
+ * @link http://www.smarty.net/docs/en/api.register.cacheresource.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $name name of resource type
+ * @param \Smarty_CacheResource $resource_handler
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function registerCacheResource(Smarty_Internal_TemplateBase $obj, $name, Smarty_CacheResource $resource_handler)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ $smarty->registered_cache_resources[$name] = $resource_handler;
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_registerclass.php b/libs/sysplugins/smarty_internal_method_registerclass.php
new file mode 100644
index 00000000..d2e5e20b
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_registerclass.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * Smarty Method RegisterClass
+ *
+ * Smarty::registerClass() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterClass
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers static classes to be used in templates
+ *
+ * @api Smarty::registerClass()
+ * @link http://www.smarty.net/docs/en/api.register.class.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $class_name
+ * @param string $class_impl the referenced PHP class to
+ * register
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws \SmartyException
+ */
+ public function registerClass(Smarty_Internal_TemplateBase $obj, $class_name, $class_impl)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ // test if exists
+ if (!class_exists($class_impl)) {
+ throw new SmartyException("Undefined class '$class_impl' in register template class");
+ }
+ // register the class
+ $smarty->registered_classes[$class_name] = $class_impl;
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php b/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php
new file mode 100644
index 00000000..370aa38d
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * Smarty Method RegisterDefaultConfigHandler
+ *
+ * Smarty::registerDefaultConfigHandler() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterDefaultConfigHandler
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Register config default handler
+ *
+ * @api Smarty::registerDefaultConfigHandler()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param callable $callback class/method name
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws SmartyException if $callback is not callable
+ */
+ public function registerDefaultConfigHandler(Smarty_Internal_TemplateBase $obj, $callback)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (is_callable($callback)) {
+ $smarty->default_config_handler_func = $callback;
+ } else {
+ throw new SmartyException("Default config handler not callable");
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php b/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php
new file mode 100644
index 00000000..80b801ce
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php
@@ -0,0 +1,43 @@
+<?php
+
+/**
+ * Smarty Method RegisterDefaultPluginHandler
+ *
+ * Smarty::registerDefaultPluginHandler() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterDefaultPluginHandler
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers a default plugin handler
+ *
+ * @api Smarty::registerDefaultPluginHandler()
+ * @link http://www.smarty.net/docs/en/api.register.default.plugin.handler.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param callable $callback class/method name
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws SmartyException if $callback is not callable
+ */
+ public function registerDefaultPluginHandler(Smarty_Internal_TemplateBase $obj, $callback)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (is_callable($callback)) {
+ $smarty->default_plugin_handler_func = $callback;
+ } else {
+ throw new SmartyException("Default plugin handler '$callback' not callable");
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php b/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php
new file mode 100644
index 00000000..cbb6b1f7
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php
@@ -0,0 +1,72 @@
+<?php
+
+/**
+ * Smarty Method RegisterDefaultTemplateHandler
+ *
+ * Smarty::registerDefaultTemplateHandler() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterDefaultTemplateHandler
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Register template default handler
+ *
+ * @api Smarty::registerDefaultTemplateHandler()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param callable $callback class/method name
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws SmartyException if $callback is not callable
+ */
+ public function registerDefaultTemplateHandler(Smarty_Internal_TemplateBase $obj, $callback)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (is_callable($callback)) {
+ $smarty->default_template_handler_func = $callback;
+ } else {
+ throw new SmartyException("Default template handler not callable");
+ }
+ return $obj;
+ }
+
+ /**
+ * get default content from template or config resource handler
+ *
+ * @param Smarty_Template_Source $source
+ */
+ public static function _getDefaultTemplate(Smarty_Template_Source $source)
+ {
+ if ($source->isConfig) {
+ $default_handler = $source->smarty->default_config_handler_func;
+ } else {
+ $default_handler = $source->smarty->default_template_handler_func;
+ }
+ $_content = $_timestamp = null;
+ $_return = call_user_func_array($default_handler, array($source->type, $source->name, &$_content, &$_timestamp,
+ $source->smarty));
+ if (is_string($_return)) {
+ $source->exists = is_file($_return);
+ if ($source->exists) {
+ $source->timestamp = filemtime($_return);
+ }
+ $source->filepath = $_return;
+ } elseif ($_return === true) {
+ $source->content = $_content;
+ $source->timestamp = $_timestamp;
+ $source->exists = true;
+ $source->recompiled = true;
+ $source->filepath = false;
+ }
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_registerfilter.php b/libs/sysplugins/smarty_internal_method_registerfilter.php
new file mode 100644
index 00000000..84b2c263
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_registerfilter.php
@@ -0,0 +1,88 @@
+<?php
+
+/**
+ * Smarty Method RegisterFilter
+ *
+ * Smarty::registerFilter() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterFilter
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Valid filter types
+ *
+ * @var array
+ */
+ private $filterTypes = array('pre' => true, 'post' => true, 'output' => true, 'variable' => true);
+
+ /**
+ * Registers a filter function
+ *
+ * @api Smarty::registerFilter()
+ *
+ * @link http://www.smarty.net/docs/en/api.register.filter.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type filter type
+ * @param callback $callback
+ * @param string|null $name optional filter name
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws \SmartyException
+ */
+ public function registerFilter(Smarty_Internal_TemplateBase $obj, $type, $callback, $name = null)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ $this->_checkFilterType($type);
+ $name = isset($name) ? $name : $this->_getFilterName($callback);
+ if (!is_callable($callback)) {
+ throw new SmartyException("{$type}filter \"{$name}\" not callable");
+ }
+ $smarty->registered_filters[$type][$name] = $callback;
+ return $obj;
+ }
+
+ /**
+ * Return internal filter name
+ *
+ * @param callback $function_name
+ *
+ * @return string internal filter name
+ */
+ public function _getFilterName($function_name)
+ {
+ if (is_array($function_name)) {
+ $_class_name = (is_object($function_name[0]) ? get_class($function_name[0]) : $function_name[0]);
+
+ return $_class_name . '_' . $function_name[1];
+ } elseif (is_string($function_name)) {
+ return $function_name;
+ } else {
+ return 'closure';
+ }
+ }
+
+ /**
+ * Check if filter type is valid
+ *
+ * @param string $type
+ *
+ * @throws \SmartyException
+ */
+ public function _checkFilterType($type)
+ {
+ if (!isset($this->filterTypes[$type])) {
+ throw new SmartyException("Illegal filter type \"{$type}\"");
+ }
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_registerobject.php b/libs/sysplugins/smarty_internal_method_registerobject.php
new file mode 100644
index 00000000..f27f1720
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_registerobject.php
@@ -0,0 +1,71 @@
+<?php
+
+/**
+ * Smarty Method RegisterObject
+ *
+ * Smarty::registerObject() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterObject
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers object to be used in templates
+ *
+ * @api Smarty::registerObject()
+ * @link http://www.smarty.net/docs/en/api.register.object.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $object_name
+ * @param object $object the
+ * referenced
+ * PHP object to
+ * register
+ * @param array $allowed_methods_properties list of
+ * allowed
+ * methods
+ * (empty = all)
+ * @param bool $format smarty
+ * argument
+ * format, else
+ * traditional
+ * @param array $block_methods list of
+ * block-methods
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws \SmartyException
+ */
+ public function registerObject(Smarty_Internal_TemplateBase $obj, $object_name, $object, $allowed_methods_properties = array(), $format = true, $block_methods = array())
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ // test if allowed methods callable
+ if (!empty($allowed_methods_properties)) {
+ foreach ((array) $allowed_methods_properties as $method) {
+ if (!is_callable(array($object, $method)) && !property_exists($object, $method)) {
+ throw new SmartyException("Undefined method or property '$method' in registered object");
+ }
+ }
+ }
+ // test if block methods callable
+ if (!empty($block_methods)) {
+ foreach ((array) $block_methods as $method) {
+ if (!is_callable(array($object, $method))) {
+ throw new SmartyException("Undefined method '$method' in registered object");
+ }
+ }
+ }
+ // register the object
+ $smarty->registered_objects[$object_name] = array($object, (array) $allowed_methods_properties,
+ (boolean) $format, (array) $block_methods);
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_registerplugin.php b/libs/sysplugins/smarty_internal_method_registerplugin.php
new file mode 100644
index 00000000..95814581
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_registerplugin.php
@@ -0,0 +1,50 @@
+<?php
+
+/**
+ * Smarty Method RegisterPlugin
+ *
+ * Smarty::registerPlugin() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterPlugin
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers plugin to be used in templates
+ *
+ * @api Smarty::registerPlugin()
+ * @link http://www.smarty.net/docs/en/api.register.plugin.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type plugin type
+ * @param string $name name of template tag
+ * @param callback $callback PHP callback to register
+ * @param bool $cacheable if true (default) this
+ * function is cache able
+ * @param mixed $cache_attr caching attributes if any
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws SmartyException when the plugin tag is invalid
+ */
+ public function registerPlugin(Smarty_Internal_TemplateBase $obj, $type, $name, $callback, $cacheable = true, $cache_attr = null)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (isset($smarty->registered_plugins[$type][$name])) {
+ throw new SmartyException("Plugin tag \"{$name}\" already registered");
+ } elseif (!is_callable($callback)) {
+ throw new SmartyException("Plugin \"{$name}\" not callable");
+ } else {
+ $smarty->registered_plugins[$type][$name] = array($callback, (bool) $cacheable, (array) $cache_attr);
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_registerresource.php b/libs/sysplugins/smarty_internal_method_registerresource.php
new file mode 100644
index 00000000..43246ee9
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_registerresource.php
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * Smarty Method RegisterResource
+ *
+ * Smarty::registerResource() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterResource
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers a resource to fetch a template
+ *
+ * @api Smarty::registerResource()
+ * @link http://www.smarty.net/docs/en/api.register.resource.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $name name of resource type
+ * @param Smarty_Resource|array $resource_handler or instance of
+ * Smarty_Resource, or
+ * array of callbacks to
+ * handle resource
+ * (deprecated)
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function registerResource(Smarty_Internal_TemplateBase $obj, $name, $resource_handler)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ $smarty->registered_resources[$name] = $resource_handler instanceof
+ Smarty_Resource ? $resource_handler : array($resource_handler, false);
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_setautoloadfilters.php b/libs/sysplugins/smarty_internal_method_setautoloadfilters.php
new file mode 100644
index 00000000..b1f965cd
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_setautoloadfilters.php
@@ -0,0 +1,70 @@
+<?php
+
+/**
+ * Smarty Method SetAutoloadFilters
+ *
+ * Smarty::setAutoloadFilters() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_SetAutoloadFilters
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Valid filter types
+ *
+ * @var array
+ */
+ private $filterTypes = array('pre' => true, 'post' => true, 'output' => true, 'variable' => true);
+
+ /**
+ * Set autoload filters
+ *
+ * @api Smarty::setAutoloadFilters()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param array $filters filters to load automatically
+ * @param string $type "pre", "output", … specify the
+ * filter type to set. Defaults to
+ * none treating $filters' keys as
+ * the appropriate types
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function setAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if ($type !== null) {
+ $this->_checkFilterType($type);
+ $smarty->autoload_filters[$type] = (array) $filters;
+ } else {
+ foreach ((array) $filters as $type => $value) {
+ $this->_checkFilterType($type);
+ }
+ $smarty->autoload_filters = (array) $filters;
+ }
+ return $obj;
+ }
+
+ /**
+ * Check if filter type is valid
+ *
+ * @param string $type
+ *
+ * @throws \SmartyException
+ */
+ public function _checkFilterType($type)
+ {
+ if (!isset($this->filterTypes[$type])) {
+ throw new SmartyException("Illegal filter type \"{$type}\"");
+ }
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_setdebugtemplate.php b/libs/sysplugins/smarty_internal_method_setdebugtemplate.php
new file mode 100644
index 00000000..4ff5d7f8
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_setdebugtemplate.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * Smarty Method SetDebugTemplate
+ *
+ * Smarty::setDebugTemplate() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_SetDebugTemplate
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * set the debug template
+ *
+ * @api Smarty::setDebugTemplate()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $tpl_name
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws SmartyException if file is not readable
+ */
+ public function setDebugTemplate(Smarty_Internal_TemplateBase $obj, $tpl_name)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (!is_readable($tpl_name)) {
+ throw new SmartyException("Unknown file '{$tpl_name}'");
+ }
+ $smarty->debug_tpl = $tpl_name;
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php b/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php
new file mode 100644
index 00000000..5a707287
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php
@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * Smarty Method SetDefaultModifiers
+ *
+ * Smarty::setDefaultModifiers() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_SetDefaultModifiers
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Set default modifiers
+ *
+ * @api Smarty::setDefaultModifiers()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param array|string $modifiers modifier or list of modifiers
+ * to set
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function setDefaultModifiers(Smarty_Internal_TemplateBase $obj, $modifiers)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ $smarty->default_modifiers = (array) $modifiers;
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_unloadfilter.php b/libs/sysplugins/smarty_internal_method_unloadfilter.php
new file mode 100644
index 00000000..e3d966e1
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_unloadfilter.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * Smarty Method UnloadFilter
+ *
+ * Smarty::unloadFilter() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_UnloadFilter extends Smarty_Internal_Method_LoadFilter
+{
+ /**
+ * load a filter of specified type and name
+ *
+ * @api Smarty::unloadFilter()
+ *
+ * @link http://www.smarty.net/docs/en/api.unload.filter.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type filter type
+ * @param string $name filter name
+ *
+ * @return bool
+ */
+ public function unloadFilter(Smarty_Internal_TemplateBase $obj, $type, $name)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ $this->_checkFilterType($type);
+ if (isset($smarty->registered_filters[$type])) {
+ $_filter_name = "smarty_{$type}filter_{$name}";
+ if (isset($smarty->registered_filters[$type][$_filter_name])) {
+ unset ($smarty->registered_filters[$type][$_filter_name]);
+ if (empty($smarty->registered_filters[$type])) {
+ unset($smarty->registered_filters[$type]);
+ }
+ }
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_unregistercacheresource.php b/libs/sysplugins/smarty_internal_method_unregistercacheresource.php
new file mode 100644
index 00000000..80381015
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_unregistercacheresource.php
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ * Smarty Method UnregisterCacheResource
+ *
+ * Smarty::unregisterCacheResource() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_UnregisterCacheResource
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers a resource to fetch a template
+ *
+ * @api Smarty::unregisterCacheResource()
+ * @link http://www.smarty.net/docs/en/api.unregister.cacheresource.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type name of cache resource type
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function unregisterCacheResource(Smarty_Internal_TemplateBase $obj, $name)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (isset($smarty->registered_cache_resources[$name])) {
+ unset($smarty->registered_cache_resources[$name]);
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_unregisterfilter.php b/libs/sysplugins/smarty_internal_method_unregisterfilter.php
new file mode 100644
index 00000000..c80ae9a6
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_unregisterfilter.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * Smarty Method UnregisterFilter
+ *
+ * Smarty::unregisterFilter() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_UnregisterFilter extends Smarty_Internal_Method_RegisterFilter
+{
+ /**
+ * Unregisters a filter function
+ *
+ * @api Smarty::unregisterFilter()
+ *
+ * @link http://www.smarty.net/docs/en/api.unregister.filter.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type filter type
+ * @param callback|string $callback
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function unregisterFilter(Smarty_Internal_TemplateBase $obj, $type, $callback)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ $this->_checkFilterType($type);
+ if (isset($smarty->registered_filters[$type])) {
+ $name = is_string($callback) ? $callback : $this->_getFilterName($callback);
+ if (isset($smarty->registered_filters[$type][$name])) {
+ unset($smarty->registered_filters[$type][$name]);
+ if (empty($smarty->registered_filters[$type])) {
+ unset($smarty->registered_filters[$type]);
+ }
+ }
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_unregisterobject.php b/libs/sysplugins/smarty_internal_method_unregisterobject.php
new file mode 100644
index 00000000..a9433168
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_unregisterobject.php
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ * Smarty Method UnregisterObject
+ *
+ * Smarty::unregisterObject() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_UnregisterObject
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers plugin to be used in templates
+ *
+ * @api Smarty::unregisterObject()
+ * @link http://www.smarty.net/docs/en/api.unregister.object.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $object_name name of object
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function unregisterObject(Smarty_Internal_TemplateBase $obj, $object_name)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (isset($smarty->registered_objects[$object_name])) {
+ unset($smarty->registered_objects[$object_name]);
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_unregisterplugin.php b/libs/sysplugins/smarty_internal_method_unregisterplugin.php
new file mode 100644
index 00000000..06cb2d35
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_unregisterplugin.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * Smarty Method UnregisterPlugin
+ *
+ * Smarty::unregisterPlugin() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_UnregisterPlugin
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers plugin to be used in templates
+ *
+ * @api Smarty::unregisterPlugin()
+ * @link http://www.smarty.net/docs/en/api.unregister.plugin.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type plugin type
+ * @param string $name name of template tag
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function unregisterPlugin(Smarty_Internal_TemplateBase $obj, $type, $name)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (isset($smarty->registered_plugins[$type][$name])) {
+ unset($smarty->registered_plugins[$type][$name]);
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_method_unregisterresource.php b/libs/sysplugins/smarty_internal_method_unregisterresource.php
new file mode 100644
index 00000000..767bd74a
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_unregisterresource.php
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ * Smarty Method UnregisterResource
+ *
+ * Smarty::unregisterResource() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_UnregisterResource
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers a resource to fetch a template
+ *
+ * @api Smarty::unregisterResource()
+ * @link http://www.smarty.net/docs/en/api.unregister.resource.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type name of resource type
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function unregisterResource(Smarty_Internal_TemplateBase $obj, $type)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (isset($smarty->registered_resources[$type])) {
+ unset($smarty->registered_resources[$type]);
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php
index 1c3250a8..fd1ffd40 100644
--- a/libs/sysplugins/smarty_internal_template.php
+++ b/libs/sysplugins/smarty_internal_template.php
@@ -17,10 +17,18 @@
* @property Smarty_Template_Source|Smarty_Template_Config $source
* @property Smarty_Template_Compiled $compiled
* @property Smarty_Template_Cached $cached
+ * @method bool mustCompile()
*/
class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
{
/**
+ * This object type (Smarty = 1, template = 2, data = 4)
+ *
+ * @var int
+ */
+ public $_objType = 2;
+
+ /**
* Global smarty instance
*
* @var Smarty
@@ -400,33 +408,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
}
/**
- * Returns if the current template must be compiled by the Smarty compiler
- * It does compare the timestamps of template source and the compiled templates and checks the force compile
- * configuration
- *
- * @throws SmartyException
- * @return boolean true if the template must be compiled
- */
- public function mustCompile()
- {
- if (!$this->source->exists) {
- if ($this->parent instanceof Smarty_Internal_Template) {
- $parent_resource = " in '$this->parent->template_resource}'";
- } else {
- $parent_resource = '';
- }
- throw new SmartyException("Unable to load template {$this->source->type} '{$this->source->name}'{$parent_resource}");
- }
- if ($this->mustCompile === null) {
- $this->mustCompile = (!$this->source->uncompiled &&
- ($this->smarty->force_compile || $this->source->recompiled || !$this->compiled->exists ||
- ($this->smarty->compile_check && $this->compiled->getTimeStamp() < $this->source->getTimeStamp())));
- }
-
- return $this->mustCompile;
- }
-
- /**
* Compiles the template
* If the template is not evaluated the compiled template is saved on disk
*/
@@ -807,20 +788,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
}
/**
- * Empty cache for this template
- *
- * @param integer $exp_time expiration time
- *
- * @return integer number of cache files deleted
- */
- public function clearCache($exp_time = null)
- {
- Smarty_CacheResource::invalidLoadedCache($this->smarty);
-
- return $this->cached->handler->clear($this->smarty, $this->template_resource, $this->cache_id, $this->compile_id, $exp_time);
- }
-
- /**
* Load compiled object
*
*/
diff --git a/libs/sysplugins/smarty_internal_templatebase.php b/libs/sysplugins/smarty_internal_templatebase.php
index 6c2f5ad5..9752b3ed 100644
--- a/libs/sysplugins/smarty_internal_templatebase.php
+++ b/libs/sysplugins/smarty_internal_templatebase.php
@@ -11,8 +11,36 @@
/**
* Class with shared template methods
*
- * @package Smarty
- * @subpackage Template
+ * @package Smarty
+ * @subpackage Template
+ *
+ * @method Smarty_Internal_TemplateBase setAutoloadFilters(mixed $filters, string $type = null)
+ * @method Smarty_Internal_TemplateBase addAutoloadFilters(mixed $filters, string $type = null)
+ * @method array getAutoloadFilters(string $type = null)
+ * @local_method Smarty_Internal_TemplateBase registerFilter(string $type, callback $callback, string $name = null)
+ * @method Smarty_Internal_TemplateBase unregisterFilter(string $type, mixed $callback)
+ * @local_method bool loadFilter(string $type, string $name)
+ * @method Smarty_Internal_TemplateBase unloadFilter(string $type, string $name)
+ * @method string getDebugTemplate()
+ * @method Smarty_Internal_TemplateBase setDebugTemplate(string $tpl_name)
+ * @method Smarty_Internal_TemplateBase setDefaultModifier(mixed $modifiers)
+ * @method Smarty_Internal_TemplateBase addDefaultModifier(mixed $modifiers)
+ * @method array getDefaultModifier()
+ * @method Smarty_Internal_TemplateBase registerDefaultPluginHandler(callback $callback)
+ * @method Smarty_Internal_TemplateBase registerResource(string $name, Smarty_Resource $resource_handler)
+ * @method Smarty_Internal_TemplateBase unregisterResource(string $name)
+ * @method Smarty_Internal_TemplateBase registerCacheResource(string $name, Smarty_CacheResource $resource_handler)
+ * @method Smarty_Internal_TemplateBase unregisterCacheResource(string $name)
+ * @local_method Smarty_Internal_TemplateBase registerPlugin(string $type, string $name, callback $callback, bool
+ * $cacheable = true, mixed $cache_attr = null)
+ * @method Smarty_Internal_TemplateBase unregisterPlugin(string $type, string $name)
+ * @local_method Smarty_Internal_TemplateBase registerObject(string $object_name, object $object, array
+ * $allowed_methods_properties = array(), bool $format = true, array $block_methods = array())
+ * @method Smarty_Internal_TemplateBase unregisterObject(string $object_name)
+ * @method object getRegisteredObject(string $object_name)
+ * @method Smarty_Internal_TemplateBase registerClass(string $class_name, string $class_impl)
+ * @method Smarty_Internal_TemplateBase createData(Smarty_Internal_Data $parent = null, string $name = null)
+ * @method array getTags(mixed $template = null)
*/
abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
{
@@ -47,438 +75,229 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
public $cache_lifetime = 3600;
/**
- * test if cache is valid
- *
- * @param string|\Smarty_Internal_Template $template the resource handle of the template file or template object
- * @param mixed $cache_id cache id to be used with this template
- * @param mixed $compile_id compile id to be used with this template
- * @param object $parent next higher level of Smarty variables
- *
- * @return boolean cache status
- */
- public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null)
- {
- if ($template === null && $this instanceof $this->template_class) {
- $template = $this;
- } else {
- if (!($template instanceof $this->template_class)) {
- if ($parent === null) {
- $parent = $this;
- }
- $smarty = isset($this->smarty) ? $this->smarty : $this;
- $template = $smarty->createTemplate($template, $cache_id, $compile_id, $parent, false);
- }
- }
- // return cache status of template
- if (!isset($template->cached)) {
- $template->loadCached();
- }
- return $template->cached->isCached($template);
- }
-
- /**
- * creates a data object
- *
- * @param object $parent next higher level of Smarty variables
- * @param string $name optional data block name
- *
- * @returns Smarty_Data data object
- */
- public function createData($parent = null, $name = null)
- {
- $dataObj = new Smarty_Data($parent, $this, $name);
- if ($this->debugging) {
- Smarty_Internal_Debug::register_data($dataObj);
- }
- return $dataObj;
- }
-
- /**
- * Get unique template id
- *
- * @param string $template_name
- * @param null|mixed $cache_id
- * @param null|mixed $compile_id
- *
- * @return string
- */
- public function getTemplateId($template_name, $cache_id = null, $compile_id = null)
- {
- $cache_id = isset($cache_id) ? $cache_id : $this->cache_id;
- $compile_id = isset($compile_id) ? $compile_id : $this->compile_id;
- $smarty = isset($this->smarty) ? $this->smarty : $this;
- if ($smarty->allow_ambiguous_resources) {
- $_templateId = Smarty_Resource::getUniqueTemplateName($this, $template_name) . "#{$cache_id}#{$compile_id}";
- } else {
- $_templateId = $smarty->joined_template_dir . "#{$template_name}#{$cache_id}#{$compile_id}";
- }
- if (isset($_templateId[150])) {
- $_templateId = sha1($_templateId);
- }
- return $_templateId;
- }
-
- /**
* Registers plugin to be used in templates
+ * NOTE: this method can be safely removed for dynamic loading
+ *
+ * @api Smarty::registerPlugin()
+ * @link http://www.smarty.net/docs/en/api.register.plugin.tpl
*
* @param string $type plugin type
- * @param string $tag name of template tag
+ * @param string $name name of template tag
* @param callback $callback PHP callback to register
- * @param boolean $cacheable if true (default) this function is cache able
- * @param array $cache_attr caching attributes if any
+ * @param bool $cacheable if true (default) this function is cache able
+ * @param mixed $cache_attr caching attributes if any
*
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or
- * Smarty_Internal_Template) instance for chaining
+ * @return \Smarty|\Smarty_Internal_Template
* @throws SmartyException when the plugin tag is invalid
*/
- public function registerPlugin($type, $tag, $callback, $cacheable = true, $cache_attr = null)
+ public function registerPlugin($type, $name, $callback, $cacheable = true, $cache_attr = null)
{
+ /* @var Smarty $smarty */
$smarty = isset($this->smarty) ? $this->smarty : $this;
- if (isset($smarty->registered_plugins[$type][$tag])) {
- throw new SmartyException("Plugin tag \"{$tag}\" already registered");
+ if (isset($smarty->registered_plugins[$type][$name])) {
+ throw new SmartyException("Plugin tag \"{$name}\" already registered");
} elseif (!is_callable($callback)) {
- throw new SmartyException("Plugin \"{$tag}\" not callable");
+ throw new SmartyException("Plugin \"{$name}\" not callable");
} else {
- $smarty->registered_plugins[$type][$tag] = array($callback, (bool) $cacheable, (array) $cache_attr);
+ $smarty->registered_plugins[$type][$name] = array($callback, (bool) $cacheable, (array) $cache_attr);
}
-
return $this;
}
/**
- * Unregister Plugin
+ * load a filter of specified type and name
+ * NOTE: this method can be safely removed for dynamic loading
*
- * @param string $type of plugin
- * @param string $tag name of plugin
+ * @api Smarty::loadFilter()
+ * @link http://www.smarty.net/docs/en/api.load.filter.tpl
*
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or
- * Smarty_Internal_Template) instance for chaining
+ * @param string $type filter type
+ * @param string $name filter name
+ *
+ * @return bool
+ * @throws SmartyException if filter could not be loaded
*/
- public function unregisterPlugin($type, $tag)
+ public function loadFilter($type, $name)
{
+ /* @var Smarty $smarty */
$smarty = isset($this->smarty) ? $this->smarty : $this;
- if (isset($smarty->registered_plugins[$type][$tag])) {
- unset($smarty->registered_plugins[$type][$tag]);
+ if (!in_array($type, array('pre', 'post', 'output', 'variable'))) {
+ throw new SmartyException("Illegal filter type \"{$type}\"");
}
-
- return $this;
+ $_plugin = "smarty_{$type}filter_{$name}";
+ $_filter_name = $_plugin;
+ if (is_callable($_plugin)) {
+ $smarty->registered_filters[$type][$_filter_name] = $_plugin;
+ return true;
+ }
+ 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 true;
+ }
+ }
+ throw new SmartyException("{$type}filter \"{$name}\" not found or callable");
}
/**
- * Registers a resource to fetch a template
+ * Registers a filter function
+ * NOTE: this method can be safely removed for dynamic loading
*
- * @param string $type name of resource type
- * @param Smarty_Resource|array $callback or instance of Smarty_Resource, or array of callbacks to handle resource
- * (deprecated)
+ * @api Smarty::registerFilter()
+ * @link http://www.smarty.net/docs/en/api.register.filter.tpl
*
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or
- * Smarty_Internal_Template) instance for chaining
- */
- public function registerResource($type, $callback)
- {
- $smarty = isset($this->smarty) ? $this->smarty : $this;
- $smarty->registered_resources[$type] = $callback instanceof Smarty_Resource ? $callback : array($callback,
- false);
-
- return $this;
- }
-
- /**
- * Unregisters a resource
- *
- * @param string $type name of resource type
+ * @param string $type filter type
+ * @param callback $callback
+ * @param string|null $name optional filter name
*
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or
- * Smarty_Internal_Template) instance for chaining
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws \SmartyException
*/
- public function unregisterResource($type)
+ public function registerFilter($type, $callback, $name = null)
{
+ /* @var Smarty $smarty */
$smarty = isset($this->smarty) ? $this->smarty : $this;
- if (isset($smarty->registered_resources[$type])) {
- unset($smarty->registered_resources[$type]);
+ if (!in_array($type, array('pre', 'post', 'output', 'variable'))) {
+ throw new SmartyException("Illegal filter type \"{$type}\"");
}
-
+ $name = isset($name) ? $name : $this->_getFilterName($callback);
+ if (!is_callable($callback)) {
+ throw new SmartyException("{$type}filter \"{$name}\" not callable");
+ }
+ $smarty->registered_filters[$type][$name] = $callback;
return $this;
}
/**
- * Registers a cache resource to cache a template's output
+ * Return internal filter name
*
- * @param string $type name of cache resource type
- * @param Smarty_CacheResource $callback instance of Smarty_CacheResource to handle output caching
+ * @param callback $function_name
*
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or
- * Smarty_Internal_Template) instance for chaining
+ * @return string internal filter name
*/
- public function registerCacheResource($type, Smarty_CacheResource $callback)
+ public function _getFilterName($function_name)
{
- $smarty = isset($this->smarty) ? $this->smarty : $this;
- $smarty->registered_cache_resources[$type] = $callback;
-
- return $this;
- }
+ if (is_array($function_name)) {
+ $_class_name = (is_object($function_name[0]) ? get_class($function_name[0]) : $function_name[0]);
- /**
- * Unregisters a cache resource
- *
- * @param string $type name of cache resource type
- *
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or
- * Smarty_Internal_Template) instance for chaining
- */
- public function unregisterCacheResource($type)
- {
- $smarty = isset($this->smarty) ? $this->smarty : $this;
- if (isset($smarty->registered_cache_resources[$type])) {
- unset($smarty->registered_cache_resources[$type]);
+ return $_class_name . '_' . $function_name[1];
+ } elseif (is_string($function_name)) {
+ return $function_name;
+ } else {
+ return 'closure';
}
-
- return $this;
}
/**
* Registers object to be used in templates
+ * NOTE: this method can be safely removed for dynamic loading
*
- * @param $object_name
- * @param object $object_impl the referenced PHP object to register
- * @param array $allowed list of allowed methods (empty = all)
- * @param boolean $smarty_args smarty argument format, else traditional
- * @param array $block_methods list of block-methods
- *
- * @throws SmartyException
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or
- * Smarty_Internal_Template) instance for chaining
- */
- public function registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
- {
- Smarty_Internal_Extension_Object::registerObject($this, $object_name, $object_impl, $allowed, $smarty_args, $block_methods);
- return $this;
- }
-
- /**
- * return a reference to a registered object
- *
- * @param string $name object name
- *
- * @return object
- * @throws SmartyException if no such object is found
- */
- public function getRegisteredObject($name)
- {
- return Smarty_Internal_Extension_Object::getRegisteredObject($this, $name);
- }
-
- /**
- * unregister an object
- *
- * @param string $name object name
- *
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or
- * Smarty_Internal_Template) instance for chaining
- */
- public function unregisterObject($name)
- {
- Smarty_Internal_Extension_Object::unregisterObject($this, $name);
- return $this;
- }
-
- /**
- * Registers static classes to be used in templates
+ * @api Smarty::registerObject()
+ * @link http://www.smarty.net/docs/en/api.register.object.tpl
*
- * @param $class_name
- * @param string $class_impl the referenced PHP class to register
+ * @param string $object_name
+ * @param object $object the referenced PHP object to register
+ * @param array $allowed_methods_properties list of allowed methods (empty = all)
+ * @param bool $format smarty argument format, else traditional
+ * @param array $block_methods list of block-methods
*
- * @throws SmartyException
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or
- * Smarty_Internal_Template) instance for chaining
- */
- public function registerClass($class_name, $class_impl)
- {
- Smarty_Internal_Extension_Object::registerClass($this, $class_name, $class_impl);
- return $this;
- }
-
- /**
- * Registers a default plugin handler
- *
- * @param callable $callback class/method name
- *
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or
- * Smarty_Internal_Template) instance for chaining
- * @throws SmartyException if $callback is not callable
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws \SmartyException
*/
- public function registerDefaultPluginHandler($callback)
+ public function registerObject($object_name, $object, $allowed_methods_properties = array(), $format = true, $block_methods = array())
{
+ /* @var Smarty $smarty */
$smarty = isset($this->smarty) ? $this->smarty : $this;
- if (is_callable($callback)) {
- $smarty->default_plugin_handler_func = $callback;
- } else {
- throw new SmartyException("Default plugin handler '$callback' not callable");
+ // test if allowed methods callable
+ if (!empty($allowed_methods_properties)) {
+ foreach ((array) $allowed_methods_properties as $method) {
+ if (!is_callable(array($object, $method)) && !property_exists($object, $method)) {
+ throw new SmartyException("Undefined method or property '$method' in registered object");
+ }
+ }
}
-
- return $this;
- }
-
- /**
- * Registers a default template handler
- *
- * @param callable $callback class/method name
- *
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or
- * Smarty_Internal_Template) instance for chaining
- * @throws SmartyException if $callback is not callable
- */
- public function registerDefaultTemplateHandler($callback)
- {
- Smarty_Internal_Extension_DefaultTemplateHandler::registerDefaultTemplateHandler($this, $callback);
+ // test if block methods callable
+ if (!empty($block_methods)) {
+ foreach ((array) $block_methods as $method) {
+ if (!is_callable(array($object, $method))) {
+ throw new SmartyException("Undefined method '$method' in registered object");
+ }
+ }
+ }
+ // register the object
+ $smarty->registered_objects[$object_name] = array($object, (array) $allowed_methods_properties,
+ (boolean) $format, (array) $block_methods);
return $this;
}
/**
- * Registers a default template handler
- *
- * @param callable $callback class/method name
+ * test if cache is valid
*
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or
- * Smarty_Internal_Template) instance for chaining
- * @throws SmartyException if $callback is not callable
- */
- public function registerDefaultConfigHandler($callback)
- {
- Smarty_Internal_Extension_DefaultTemplateHandler::registerDefaultConfigHandler($this, $callback);
- return $this;
- }
-
- /**
- * Registers a filter function
+ * @api Smarty::isCached()
+ * @link http://www.smarty.net/docs/en/api.is.cached.tpl
*
- * @param string $type filter type
- * @param callback $callback
- * @param null|string $name option filter name
+ * @param string|\Smarty_Internal_Template $template the resource handle of the template file or template object
+ * @param mixed $cache_id cache id to be used with this template
+ * @param mixed $compile_id compile id to be used with this template
+ * @param object $parent next higher level of Smarty variables
*
- * @return \Smarty_Internal_TemplateBase current Smarty_Internal_Templatebase (or Smarty or
- * Smarty_Internal_Template) instance for chaining
- * @throws \SmartyException
+ * @return boolean cache status
*/
- public function registerFilter($type, $callback, $name = null)
+ public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null)
{
- Smarty_Internal_Extension_Filter::registerFilter($this, $type, $callback, $name);
- return $this;
+ if ($template === null && $this instanceof $this->template_class) {
+ $template = $this;
+ } else {
+ if (!($template instanceof $this->template_class)) {
+ if ($parent === null) {
+ $parent = $this;
+ }
+ /* @var Smarty $smarty */
+ $smarty = isset($this->smarty) ? $this->smarty : $this;
+ $template = $smarty->createTemplate($template, $cache_id, $compile_id, $parent, false);
+ }
+ }
+ // return cache status of template
+ if (!isset($template->cached)) {
+ $template->loadCached();
+ }
+ return $template->cached->isCached($template);
}
/**
- * Unregisters a filter function
- *
- * @param string $type filter type
- * @param callback|string $callback
- *
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or
- * Smarty_Internal_Template) instance for chaining
+ * @param boolean $caching
*/
- public function unregisterFilter($type, $callback)
+ public function setCaching($caching)
{
- Smarty_Internal_Extension_Filter::unregisterFilter($this, $type, $callback);
- return $this;
+ $this->caching = $caching;
}
/**
- * load a filter of specified type and name
- *
- * @param string $type filter type
- * @param string $name filter name
- *
- * @return bool
- * @throws SmartyException if filter could not be loaded
+ * @param int $cache_lifetime
*/
- public function loadFilter($type, $name)
+ public function setCacheLifetime($cache_lifetime)
{
- return Smarty_Internal_Extension_Filter::loadFilter($this, $type, $name);
+ $this->cache_lifetime = $cache_lifetime;
}
/**
- * unload a filter of specified type and name
- *
- * @param string $type filter type
- * @param string $name filter name
- *
- * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or
- * Smarty_Internal_Template) instance for chaining
+ * @param string $compile_id
*/
- public function unloadFilter($type, $name)
+ public function setCompileId($compile_id)
{
- Smarty_Internal_Extension_Filter::unloadFilter($this, $type, $name);
- return $this;
+ $this->compile_id = $compile_id;
}
/**
- * preg_replace callback to convert camelcase getter/setter to underscore property names
- *
- * @param string $match match string
- *
- * @return string replacement
+ * @param string $cache_id
*/
- private function replaceCamelcase($match)
+ public function setCacheId($cache_id)
{
- return "_" . strtolower($match[1]);
+ $this->cache_id = $cache_id;
}
- /**
- * Handle unknown class methods
- *
- * @param string $name unknown method-name
- * @param array $args argument array
- *
- * @throws SmartyException
- */
- public function __call($name, $args)
- {
- static $_prefixes = array('set' => true, 'get' => true);
- static $_resolved_property_name = array();
- static $_resolved_property_source = array();
-
- // see if this is a set/get for a property
- $first3 = strtolower(substr($name, 0, 3));
- if (isset($_prefixes[$first3]) && isset($name[3]) && $name[3] !== '_') {
- if (isset($_resolved_property_name[$name])) {
- $property_name = $_resolved_property_name[$name];
- } else {
- // try to keep case correct for future PHP 6.0 case-sensitive class methods
- // lcfirst() not available < PHP 5.3.0, so improvise
- $property_name = strtolower(substr($name, 3, 1)) . substr($name, 4);
- // convert camel case to underscored name
- $property_name = preg_replace_callback('/([A-Z])/', array($this, 'replaceCamelcase'), $property_name);
- $_resolved_property_name[$name] = $property_name;
- }
- if (isset($_resolved_property_source[$property_name])) {
- $status = $_resolved_property_source[$property_name];
- } else {
- $status = null;
- if (property_exists($this, $property_name)) {
- $status = true;
- } elseif (property_exists($this->smarty, $property_name)) {
- $status = false;
- } elseif (in_array($name, $this->smarty->obsoleteProperties)) {
- return null;
- } else {
- }
- $_resolved_property_source[$property_name] = $status;
- }
- $smarty = null;
- if ($status === true) {
- $smarty = $this;
- } elseif ($status === false) {
- $smarty = $this->smarty;
- }
- if ($smarty) {
- if ($first3 == 'get') {
- return $smarty->$property_name;
- } else {
- return $smarty->$property_name = $args[0];
- }
- }
- throw new SmartyException("property '$property_name' does not exist.");
- }
- throw new SmartyException("Call of unknown method '$name'.");
- }
}
diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php
index 1569b4ba..e32ca6a3 100644
--- a/libs/sysplugins/smarty_internal_templatecompilerbase.php
+++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php
@@ -785,7 +785,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
if (strpos($variable, '(') == 0) {
// not a variable variable
$var = trim($variable, '\'');
- $this->tag_nocache = $this->tag_nocache | $this->template->getVariable($var, null, true, false)->nocache;
+ $this->tag_nocache = $this->tag_nocache | $this->template->_getVariable($var, null, true, false)->nocache;
// todo $this->template->compiled->properties['variables'][$var] = $this->tag_nocache | $this->nocache;
}
return '$_smarty_tpl->tpl_vars[' . $variable . ']->value';
diff --git a/libs/sysplugins/smarty_internal_templateparser.php b/libs/sysplugins/smarty_internal_templateparser.php
index 88b03401..c4de7801 100644
--- a/libs/sysplugins/smarty_internal_templateparser.php
+++ b/libs/sysplugins/smarty_internal_templateparser.php
@@ -2093,13 +2093,13 @@ class Smarty_Internal_Templateparser
#line 879 "../smarty/lexer/smarty_internal_templateparser.y"
function yy_r116()
{
- $this->_retvalue = '$_smarty_tpl->getConfigVariable( \'' . $this->yystack[$this->yyidx + - 1]->minor . '\')';
+ $this->_retvalue = '$_smarty_tpl->_getConfigVariable( \'' . $this->yystack[$this->yyidx + - 1]->minor . '\')';
}
#line 883 "../smarty/lexer/smarty_internal_templateparser.y"
function yy_r117()
{
- $this->_retvalue = '(is_array($tmp = $_smarty_tpl->getConfigVariable( \'' .
+ $this->_retvalue = '(is_array($tmp = $_smarty_tpl->_getConfigVariable( \'' .
$this->yystack[$this->yyidx + - 2]->minor . '\')) ? $tmp' . $this->yystack[$this->yyidx + 0]->minor .
' :null)';
}
@@ -2107,13 +2107,13 @@ class Smarty_Internal_Templateparser
#line 887 "../smarty/lexer/smarty_internal_templateparser.y"
function yy_r118()
{
- $this->_retvalue = '$_smarty_tpl->getConfigVariable( ' . $this->yystack[$this->yyidx + - 1]->minor . ')';
+ $this->_retvalue = '$_smarty_tpl->_getConfigVariable( ' . $this->yystack[$this->yyidx + - 1]->minor . ')';
}
#line 891 "../smarty/lexer/smarty_internal_templateparser.y"
function yy_r119()
{
- $this->_retvalue = '(is_array($tmp = $_smarty_tpl->getConfigVariable( ' .
+ $this->_retvalue = '(is_array($tmp = $_smarty_tpl->_getConfigVariable( ' .
$this->yystack[$this->yyidx + - 2]->minor . ')) ? $tmp' . $this->yystack[$this->yyidx + 0]->minor .
' : null)';
}
@@ -2332,7 +2332,7 @@ class Smarty_Internal_Templateparser
$this->compiler->trigger_template_error('Illegal number of paramer in "isset()"');
}
$par = implode(',', $this->yystack[$this->yyidx + - 1]->minor);
- if (strncasecmp($par, '$_smarty_tpl->getConfigVariable', strlen('$_smarty_tpl->getConfigVariable')) ===
+ if (strncasecmp($par, '$_smarty_tpl->_getConfigVariable', strlen('$_smarty_tpl->_getConfigVariable')) ===
0
) {
self::$prefix_number ++;
diff --git a/libs/sysplugins/smarty_internal_testinstall.php b/libs/sysplugins/smarty_internal_testinstall.php
index 1ba31638..a89f62c6 100644
--- a/libs/sysplugins/smarty_internal_testinstall.php
+++ b/libs/sysplugins/smarty_internal_testinstall.php
@@ -19,7 +19,6 @@ class Smarty_Internal_TestInstall
* diagnose Smarty setup
* If $errors is secified, the diagnostic report will be appended to the array, rather than being output.
*
- * @param Smarty $smarty Smarty instance to test
* @param array $errors array to push results into rather than outputting them
*
* @return bool status, true if everything is fine, false else
@@ -47,7 +46,7 @@ class Smarty_Internal_TestInstall
if ($_stream_resolve_include_path) {
$template_dir = stream_resolve_include_path($_template_dir);
} else {
- $template_dir = Smarty_Internal_Get_Include_Path::getIncludePath($_template_dir);
+ $template_dir = Smarty_Internal_Get_Include_Path::getIncludePath($_template_dir, null, $smarty);
}
if ($template_dir !== false) {
@@ -166,7 +165,7 @@ class Smarty_Internal_TestInstall
if ($_stream_resolve_include_path) {
$plugin_dir = stream_resolve_include_path($_plugin_dir);
} else {
- $plugin_dir = Smarty_Internal_Get_Include_Path::getIncludePath($_plugin_dir);
+ $plugin_dir = Smarty_Internal_Get_Include_Path::getIncludePath($_plugin_dir, null, $smarty);
}
if ($plugin_dir !== false) {
@@ -288,7 +287,6 @@ class Smarty_Internal_TestInstall
// test if all registered config_dir are accessible
foreach ($smarty->getConfigDir() as $config_dir) {
$_config_dir = $config_dir;
- $config_dir = realpath($config_dir);
// resolve include_path or fail existence
if (!$config_dir) {
if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_config_dir)) {
@@ -296,7 +294,7 @@ class Smarty_Internal_TestInstall
if ($_stream_resolve_include_path) {
$config_dir = stream_resolve_include_path($_config_dir);
} else {
- $config_dir = Smarty_Internal_Get_Include_Path::getIncludePath($_config_dir);
+ $config_dir = Smarty_Internal_Get_Include_Path::getIncludePath($_config_dir, null, $smarty);
}
if ($config_dir !== false) {
@@ -404,8 +402,6 @@ class Smarty_Internal_TestInstall
"smarty_internal_data.php" => true,
"smarty_internal_debug.php" => true,
"smarty_internal_extension_codeframe.php" => true,
- "smarty_internal_extension_config.php" => true,
- "smarty_internal_extension_defaulttemplatehandler.php" => true,
"smarty_internal_filter_handler.php" => true,
"smarty_internal_function_call_handler.php" => true,
"smarty_internal_get_include_path.php" => true,
@@ -430,7 +426,6 @@ class Smarty_Internal_TestInstall
"smarty_internal_templatecompilerbase.php" => true,
"smarty_internal_templatelexer.php" => true,
"smarty_internal_templateparser.php" => true,
- "smarty_internal_utility.php" => true,
"smarty_internal_write_file.php" => true,
"smarty_resource.php" => true,
"smarty_resource_custom.php" => true,
diff --git a/libs/sysplugins/smarty_internal_utility.php b/libs/sysplugins/smarty_internal_utility.php
deleted file mode 100644
index 1ddd0f37..00000000
--- a/libs/sysplugins/smarty_internal_utility.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-/**
- * Project: Smarty: the PHP compiling template engine
- * File: smarty_internal_utility.php
- * SVN: $Id: $
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * For questions, help, comments, discussion, etc., please join the
- * Smarty mailing list. Send a blank e-mail to
- * smarty-discussion-subscribe@googlegroups.com
- *
- * @link http://www.smarty.net/
- * @copyright 2008 New Digital Group, Inc.
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author Uwe Tews
- * @package Smarty
- * @subpackage PluginsInternal
- * @version 3-SVN$Rev: 3286 $
- */
-
-/**
- * Utility class
- *
- * @package Smarty
- * @subpackage Security
- */
-class Smarty_Internal_Utility
-{
- /**
- * private constructor to prevent calls creation of new instances
- */
- final private function __construct()
- {
- // intentionally left blank
- }
-
- /**
- * Return array of tag/attributes of all tags used by an template
- *
- * @param Smarty_Internal_Template $template
- *
- * @throws Exception
- * @throws SmartyException
- * @return array of tag/attributes
- */
- public static function getTags(Smarty_Internal_Template $template)
- {
- $template->smarty->get_used_tags = true;
- $template->compileTemplateSource();
-
- return $template->used_tags;
- }
-}
diff --git a/libs/sysplugins/smarty_template_config.php b/libs/sysplugins/smarty_template_config.php
index 01f04306..57739de8 100644
--- a/libs/sysplugins/smarty_template_config.php
+++ b/libs/sysplugins/smarty_template_config.php
@@ -14,10 +14,7 @@
* @package Smarty
* @subpackage TemplateResources
* @author Uwe Tews
- * @property integer $timestamp Source Timestamp
- * @property boolean $exists Source Existence
- * @property boolean $template Extended Template reference
- * @property string $content Source Content
+ *
*/
class Smarty_Template_Config extends Smarty_Template_Source
{
@@ -89,7 +86,7 @@ class Smarty_Template_Config extends Smarty_Template_Source
* @param Smarty $smarty smarty object
* @param string $template_resource resource identifier
*
- * @return Smarty_Template_Source Source Object
+ * @return Smarty_Template_Config Source Object
* @throws SmartyException
*/
public static function load(Smarty_Internal_Template $_template = null, Smarty $smarty = null, $template_resource = null)
@@ -110,7 +107,7 @@ class Smarty_Template_Config extends Smarty_Template_Source
$source = new Smarty_Template_Config($resource, $smarty, $template_resource, $type, $name);
$resource->populate($source, $_template);
if (!$source->exists && isset($_template->smarty->default_config_handler_func)) {
- Smarty_Internal_Extension_DefaultTemplateHandler::_getDefault($_template, $source);
+ Smarty_Internal_Method_RegisterDefaultTemplateHandler::_getDefaultTemplate($source);
}
$source->unique_resource = $resource->buildUniqueResourceName($smarty, $name, true);
return $source;
diff --git a/libs/sysplugins/smarty_template_source.php b/libs/sysplugins/smarty_template_source.php
index 70bb6a48..e4ea0794 100644
--- a/libs/sysplugins/smarty_template_source.php
+++ b/libs/sysplugins/smarty_template_source.php
@@ -7,10 +7,7 @@
* @package Smarty
* @subpackage TemplateResources
* @author Rodney Rehm
- * @property integer $timestamp Source Timestamp
- * @property boolean $exists Source Existence
- * @property boolean $template Extended Template reference
- * @property string $content Source Content
+ *
*/
class Smarty_Template_Source
{
@@ -217,7 +214,7 @@ class Smarty_Template_Source
$source = new Smarty_Template_Source($resource, $smarty, $template_resource, $type, $name);
$resource->populate($source, $_template);
if (!$source->exists && isset($_template->smarty->default_template_handler_func)) {
- Smarty_Internal_Extension_DefaultTemplateHandler::_getDefault($_template, $source);
+ Smarty_Internal_Method_RegisterDefaultTemplateHandler::_getDefaultTemplate($source);
}
// on recompiling resources we are done
if (($smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_ON) && !$resource->recompiled) {