diff options
| author | uwetews <uwe.tews@googlemail.com> | 2015-12-27 07:18:35 +0100 |
|---|---|---|
| committer | uwetews <uwe.tews@googlemail.com> | 2015-12-27 07:18:35 +0100 |
| commit | b0691dd05617275908966731eaf2e2b603cda748 (patch) | |
| tree | ade7eda96c9839ef8237d7ca110ab4bcaae14e36 | |
| parent | 4dd8b0bf7346d67aca762e8e841ded6e95713717 (diff) | |
| download | smarty-b0691dd05617275908966731eaf2e2b603cda748.tar.gz smarty-b0691dd05617275908966731eaf2e2b603cda748.tar.bz2 smarty-b0691dd05617275908966731eaf2e2b603cda748.zip | |
- update external methods
| -rw-r--r-- | change_log.txt | 1 | ||||
| -rw-r--r-- | libs/Smarty.class.php | 42 | ||||
| -rw-r--r-- | libs/sysplugins/smarty_internal_data.php | 7 | ||||
| -rw-r--r-- | libs/sysplugins/smarty_internal_method_getglobal.php | 46 | ||||
| -rw-r--r-- | libs/sysplugins/smarty_internal_method_mustcompile.php | 2 | ||||
| -rw-r--r-- | libs/sysplugins/smarty_internal_template.php | 4 | ||||
| -rw-r--r-- | libs/sysplugins/smarty_internal_templatebase.php | 37 | ||||
| -rw-r--r-- | libs/sysplugins/smarty_internal_testinstall.php | 1 |
8 files changed, 86 insertions, 54 deletions
diff --git a/change_log.txt b/change_log.txt index 17f3ffa2..22966a56 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,6 +1,7 @@ ===== 3.1.30-dev ===== (xx.xx.xx) 27.12.2015 - improve inheritance code + - update external methods 25.12.2015 - compile {block} tag code and its processing into classes diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index c8057428..f37fbd75 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -103,11 +103,14 @@ require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_resource_base.php'; * * @package Smarty * + * The following methods will be dynamically loaded by the extension handler when they are called. + * They are located in a corresponding Smarty_Internal_Method_xxxx class + * * @method int clearAllCache(int $exp_time = null, string $type = null) * @method int clearCache(string $template_name, string $cache_id = null, string $compile_id = null, int $exp_time = null, string $type = null) * @method int compileAllTemplates(Smarty $smarty, string $extension = '.tpl', bool $force_compile = false, int $time_limit = 0, int $max_errors = null) * @method int compileAllConfig(Smarty $smarty, string $extension = '.conf', bool $force_compile = false, int $time_limit = 0, int $max_errors = null) - * + * @method int clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null) */ class Smarty extends Smarty_Internal_TemplateBase { @@ -732,31 +735,6 @@ class Smarty extends Smarty_Internal_TemplateBase } /** - * Returns a single or all global variables - * - * @param string $varname variable name or null - * - * @return string variable value or or array of variables - */ - public function getGlobal($varname = null) - { - if (isset($varname)) { - if (isset(self::$global_tpl_vars[ $varname ])) { - return self::$global_tpl_vars[ $varname ]->value; - } else { - return ''; - } - } else { - $_result = array(); - foreach (self::$global_tpl_vars AS $key => $var) { - $_result[ $key ] = $var->value; - } - - return $_result; - } - } - - /** * Loads security class and enables security * * @param string|Smarty_Security $security_class if a string is used, it must be class-name @@ -1340,14 +1318,6 @@ class Smarty extends Smarty_Internal_TemplateBase } /** - * Class destructor - */ - public function __destruct() - { - $i = 0;// intentionally left blank - } - - /** * <<magic>> Generic getter. * Calls the appropriate getter function. * Issues an E_USER_NOTICE if no valid getter is found. @@ -1367,6 +1337,7 @@ class Smarty extends Smarty_Internal_TemplateBase } else { trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE); } + return null; } /** @@ -1436,8 +1407,7 @@ class Smarty extends Smarty_Internal_TemplateBase break; } } - - // pass to next error handler if this error did not occur inside SMARTY_DIR + // pass to next error handler if this error did not occur inside SMARTY_DIR // or the error was within smarty but masked to be ignored if (!$_is_muted_directory || ($errno && $errno & error_reporting())) { if (Smarty::$_previous_error_handler) { diff --git a/libs/sysplugins/smarty_internal_data.php b/libs/sysplugins/smarty_internal_data.php index bba95d30..44cf56ed 100644 --- a/libs/sysplugins/smarty_internal_data.php +++ b/libs/sysplugins/smarty_internal_data.php @@ -14,13 +14,18 @@ * @package Smarty * @subpackage Template * + * @property int $scope + + * The following methods will be dynamically loaded by the extension handler when they are called. + * They are located in a corresponding Smarty_Internal_Method_xxxx class + * * @method mixed getConfigVars(string $varName = null, bool $searchParents = true) + * @method mixed getGlobal(string $varName = null) * @method mixed getStreamVariable(string $variable) * @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 $scope */ class Smarty_Internal_Data { diff --git a/libs/sysplugins/smarty_internal_method_getglobal.php b/libs/sysplugins/smarty_internal_method_getglobal.php new file mode 100644 index 00000000..b2b19316 --- /dev/null +++ b/libs/sysplugins/smarty_internal_method_getglobal.php @@ -0,0 +1,46 @@ +<?php + +/** + * Smarty Method GetGlobal + * + * Smarty::getGlobal() method + * + * @package Smarty + * @subpackage PluginsInternal + * @author Uwe Tews + */ +class Smarty_Internal_Method_GetGlobal +{ + /** + * Valid for all objects + * + * @var int + */ + public $objMap = 7; + + /** + * Returns a single or all global variables + * + * @api Smarty::getGlobal() + + * @param string $varName variable name or null + * + * @return string variable value or or array of variables + */ + public function getGlobal(Smarty_Internal_Data $data, $varName = null) + { + if (isset($varName)) { + if (isset(Smarty::$global_tpl_vars[ $varName ])) { + return Smarty::$global_tpl_vars[ $varName ]->value; + } else { + return ''; + } + } else { + $_result = array(); + foreach (Smarty::$global_tpl_vars AS $key => $var) { + $_result[ $key ] = $var->value; + } + return $_result; + } + } +}
\ No newline at end of file diff --git a/libs/sysplugins/smarty_internal_method_mustcompile.php b/libs/sysplugins/smarty_internal_method_mustcompile.php index f28a68e6..341de8b3 100644 --- a/libs/sysplugins/smarty_internal_method_mustcompile.php +++ b/libs/sysplugins/smarty_internal_method_mustcompile.php @@ -1,7 +1,7 @@ <?php /** - * Smarty Method UnloadFilter + * Smarty Method MustCompile * * Smarty_Internal_Template::mustCompile() method * diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php index b9661009..4ab2c173 100644 --- a/libs/sysplugins/smarty_internal_template.php +++ b/libs/sysplugins/smarty_internal_template.php @@ -17,6 +17,10 @@ * @property Smarty_Template_Source|Smarty_Template_Config $source * @property Smarty_Template_Compiled $compiled * @property Smarty_Template_Cached $cached + * + * The following methods will be dynamically loaded by the extension handler when they are called. + * They are located in a corresponding Smarty_Internal_Method_xxxx class + * * @method bool mustCompile() */ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase diff --git a/libs/sysplugins/smarty_internal_templatebase.php b/libs/sysplugins/smarty_internal_templatebase.php index 9b4953de..b0282b70 100644 --- a/libs/sysplugins/smarty_internal_templatebase.php +++ b/libs/sysplugins/smarty_internal_templatebase.php @@ -9,34 +9,39 @@ */ /** - * Class with shared template methods + * Class with shared smarty/template methods * * @package Smarty * @subpackage Template * * @property Smarty $smarty - * @method Smarty_Internal_TemplateBase setAutoloadFilters(mixed $filters, string $type = null) + * + * The following methods will be dynamically loaded by the extension handler when they are called. + * They are located in a corresponding Smarty_Internal_Method_xxxx class + * * @method Smarty_Internal_TemplateBase addAutoloadFilters(mixed $filters, string $type = null) + * @method Smarty_Internal_TemplateBase addDefaultModifier(mixed $modifiers) + * @method Smarty_Internal_TemplateBase createData(Smarty_Internal_Data $parent = null, string $name = 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) - * @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 array getTags(mixed $template = null) + * @method object getRegisteredObject(string $object_name) * @method Smarty_Internal_TemplateBase registerCacheResource(string $name, Smarty_CacheResource $resource_handler) + * @method Smarty_Internal_TemplateBase registerClass(string $class_name, string $class_impl) + * @method Smarty_Internal_TemplateBase registerDefaultConfigHandler(callback $callback) + * @method Smarty_Internal_TemplateBase registerDefaultPluginHandler(callback $callback) + * @method Smarty_Internal_TemplateBase registerDefaultTemplateHandler(callback $callback) + * @method Smarty_Internal_TemplateBase registerResource(string $name, mixed $resource_handler) + * @method Smarty_Internal_TemplateBase setAutoloadFilters(mixed $filters, string $type = null) + * @method Smarty_Internal_TemplateBase setDebugTemplate(string $tpl_name) + * @method Smarty_Internal_TemplateBase setDefaultModifier(mixed $modifiers) + * @method Smarty_Internal_TemplateBase unloadFilter(string $type, string $name) * @method Smarty_Internal_TemplateBase unregisterCacheResource(string $name) - * @method Smarty_Internal_TemplateBase unregisterPlugin(string $type, string $name) * @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) + * @method Smarty_Internal_TemplateBase unregisterPlugin(string $type, string $name) + * @method Smarty_Internal_TemplateBase unregisterFilter(string $type, mixed $callback) + * @method Smarty_Internal_TemplateBase unregisterResource(string $name) */ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { diff --git a/libs/sysplugins/smarty_internal_testinstall.php b/libs/sysplugins/smarty_internal_testinstall.php index 9217a2b3..fc038302 100644 --- a/libs/sysplugins/smarty_internal_testinstall.php +++ b/libs/sysplugins/smarty_internal_testinstall.php @@ -430,6 +430,7 @@ class Smarty_Internal_TestInstall 'smarty_internal_method_getconfigvars.php' => true, 'smarty_internal_method_getdebugtemplate.php' => true, 'smarty_internal_method_getdefaultmodifiers.php' => true, + 'smarty_internal_method_getglobal.php' => true, 'smarty_internal_method_getregisteredobject.php' => true, 'smarty_internal_method_getstreamvariable.php' => true, 'smarty_internal_method_gettags.php' => true, |
