- update external methods

This commit is contained in:
uwetews
2015-12-27 07:18:35 +01:00
parent 4dd8b0bf73
commit b0691dd056
8 changed files with 86 additions and 54 deletions

View File

@@ -1,6 +1,7 @@
 ===== 3.1.30-dev ===== (xx.xx.xx)  ===== 3.1.30-dev ===== (xx.xx.xx)
27.12.2015 27.12.2015
- improve inheritance code - improve inheritance code
- update external methods
25.12.2015 25.12.2015
- compile {block} tag code and its processing into classes - compile {block} tag code and its processing into classes

View File

@@ -103,11 +103,14 @@ require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_resource_base.php';
* *
* @package Smarty * @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 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 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 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 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 class Smarty extends Smarty_Internal_TemplateBase
{ {
@@ -731,31 +734,6 @@ class Smarty extends Smarty_Internal_TemplateBase
return $source->exists; return $source->exists;
} }
/**
* 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 * Loads security class and enables security
* *
@@ -1339,14 +1317,6 @@ class Smarty extends Smarty_Internal_TemplateBase
Smarty_Internal_TestInstall::testInstall($this, $errors); Smarty_Internal_TestInstall::testInstall($this, $errors);
} }
/**
* Class destructor
*/
public function __destruct()
{
$i = 0;// intentionally left blank
}
/** /**
* <<magic>> Generic getter. * <<magic>> Generic getter.
* Calls the appropriate getter function. * Calls the appropriate getter function.
@@ -1367,6 +1337,7 @@ class Smarty extends Smarty_Internal_TemplateBase
} else { } else {
trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE); trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);
} }
return null;
} }
/** /**
@@ -1436,8 +1407,7 @@ class Smarty extends Smarty_Internal_TemplateBase
break; 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 // or the error was within smarty but masked to be ignored
if (!$_is_muted_directory || ($errno && $errno & error_reporting())) { if (!$_is_muted_directory || ($errno && $errno & error_reporting())) {
if (Smarty::$_previous_error_handler) { if (Smarty::$_previous_error_handler) {

View File

@@ -14,13 +14,18 @@
* @package Smarty * @package Smarty
* @subpackage Template * @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 getConfigVars(string $varName = null, bool $searchParents = true)
* @method mixed getGlobal(string $varName = null)
* @method mixed getStreamVariable(string $variable) * @method mixed getStreamVariable(string $variable)
* @method Smarty_Internal_Data clearAssign(mixed $tpl_var) * @method Smarty_Internal_Data clearAssign(mixed $tpl_var)
* @method Smarty_Internal_Data clearAllAssign() * @method Smarty_Internal_Data clearAllAssign()
* @method Smarty_Internal_Data clearConfig(string $varName = null) * @method Smarty_Internal_Data clearConfig(string $varName = null)
* @method Smarty_Internal_Data configLoad(string $config_file, mixed $sections = null, string $scope = 'local') * @method Smarty_Internal_Data configLoad(string $config_file, mixed $sections = null, string $scope = 'local')
* @property int $scope
*/ */
class Smarty_Internal_Data class Smarty_Internal_Data
{ {

View File

@@ -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;
}
}
}

View File

@@ -1,7 +1,7 @@
<?php <?php
/** /**
* Smarty Method UnloadFilter * Smarty Method MustCompile
* *
* Smarty_Internal_Template::mustCompile() method * Smarty_Internal_Template::mustCompile() method
* *

View File

@@ -17,6 +17,10 @@
* @property Smarty_Template_Source|Smarty_Template_Config $source * @property Smarty_Template_Source|Smarty_Template_Config $source
* @property Smarty_Template_Compiled $compiled * @property Smarty_Template_Compiled $compiled
* @property Smarty_Template_Cached $cached * @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() * @method bool mustCompile()
*/ */
class Smarty_Internal_Template extends Smarty_Internal_TemplateBase class Smarty_Internal_Template extends Smarty_Internal_TemplateBase

View File

@@ -9,34 +9,39 @@
*/ */
/** /**
* Class with shared template methods * Class with shared smarty/template methods
* *
* @package Smarty * @package Smarty
* @subpackage Template * @subpackage Template
* *
* @property Smarty $smarty * @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 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) * @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 string getDebugTemplate()
* @method array getDefaultModifier()
* @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 setDebugTemplate(string $tpl_name)
* @method Smarty_Internal_TemplateBase setDefaultModifier(mixed $modifiers) * @method Smarty_Internal_TemplateBase setDefaultModifier(mixed $modifiers)
* @method Smarty_Internal_TemplateBase addDefaultModifier(mixed $modifiers) * @method Smarty_Internal_TemplateBase unloadFilter(string $type, string $name)
* @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) * @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 Smarty_Internal_TemplateBase unregisterObject(string $object_name)
* @method object getRegisteredObject(string $object_name) * @method Smarty_Internal_TemplateBase unregisterPlugin(string $type, string $name)
* @method Smarty_Internal_TemplateBase registerClass(string $class_name, string $class_impl) * @method Smarty_Internal_TemplateBase unregisterFilter(string $type, mixed $callback)
* @method Smarty_Internal_TemplateBase createData(Smarty_Internal_Data $parent = null, string $name = null) * @method Smarty_Internal_TemplateBase unregisterResource(string $name)
* @method array getTags(mixed $template = null)
*/ */
abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
{ {

View File

@@ -430,6 +430,7 @@ class Smarty_Internal_TestInstall
'smarty_internal_method_getconfigvars.php' => true, 'smarty_internal_method_getconfigvars.php' => true,
'smarty_internal_method_getdebugtemplate.php' => true, 'smarty_internal_method_getdebugtemplate.php' => true,
'smarty_internal_method_getdefaultmodifiers.php' => true, 'smarty_internal_method_getdefaultmodifiers.php' => true,
'smarty_internal_method_getglobal.php' => true,
'smarty_internal_method_getregisteredobject.php' => true, 'smarty_internal_method_getregisteredobject.php' => true,
'smarty_internal_method_getstreamvariable.php' => true, 'smarty_internal_method_getstreamvariable.php' => true,
'smarty_internal_method_gettags.php' => true, 'smarty_internal_method_gettags.php' => true,