mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
- update external methods
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
{
|
||||
@@ -731,31 +734,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
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
|
||||
*
|
||||
@@ -1339,14 +1317,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
Smarty_Internal_TestInstall::testInstall($this, $errors);
|
||||
}
|
||||
|
||||
/**
|
||||
* Class destructor
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
$i = 0;// intentionally left blank
|
||||
}
|
||||
|
||||
/**
|
||||
* <<magic>> Generic getter.
|
||||
* Calls the appropriate getter function.
|
||||
@@ -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,7 +1407,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 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())) {
|
||||
|
@@ -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
|
||||
{
|
||||
|
46
libs/sysplugins/smarty_internal_method_getglobal.php
Normal file
46
libs/sysplugins/smarty_internal_method_getglobal.php
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty Method UnloadFilter
|
||||
* Smarty Method MustCompile
|
||||
*
|
||||
* Smarty_Internal_Template::mustCompile() method
|
||||
*
|
||||
|
@@ -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
|
||||
|
@@ -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 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 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 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
|
||||
{
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user