summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruwetews <uwe.tews@googlemail.com>2016-09-19 16:39:19 +0200
committeruwetews <uwe.tews@googlemail.com>2016-09-19 16:39:19 +0200
commitd9a69384732559b674c29f5899b3ccc3310e4829 (patch)
tree3291b48ed568fd13efa67dd238b0cde7ae46a4f6
parenta9e7e8881e36ef59b8cf9a948a54a1a15e2b794c (diff)
downloadsmarty-d9a69384732559b674c29f5899b3ccc3310e4829.tar.gz
smarty-d9a69384732559b674c29f5899b3ccc3310e4829.tar.bz2
smarty-d9a69384732559b674c29f5899b3ccc3310e4829.zip
- cleanup convert cache resource file method clear into runtime extension
-rw-r--r--change_log.txt1
-rw-r--r--libs/Smarty.class.php2
-rw-r--r--libs/sysplugins/smarty_internal_cacheresource_file.php4
-rw-r--r--libs/sysplugins/smarty_internal_extension_handler.php50
-rw-r--r--libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php (renamed from libs/sysplugins/smarty_internal_extension_clear.php)15
-rw-r--r--libs/sysplugins/smarty_internal_testinstall.php2
6 files changed, 41 insertions, 33 deletions
diff --git a/change_log.txt b/change_log.txt
index c44480e7..ac3b2fdf 100644
--- a/change_log.txt
+++ b/change_log.txt
@@ -1,6 +1,7 @@
===== 3.1.31-dev ===== (xx.xx.xx)
19.09.2016
- optimization clear compiled and cached folder completely on detected version change
+ - cleanup convert cache resource file method clear into runtime extension
15.09.2016
- bugfix assigning a variable in if condition by function like {if $value = array_shift($array)} the function got called twice https://github.com/smarty-php/smarty/issues/291
diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php
index 7529fead..c8680417 100644
--- a/libs/Smarty.class.php
+++ b/libs/Smarty.class.php
@@ -114,7 +114,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
- const SMARTY_VERSION = '3.1.31-dev/24';
+ const SMARTY_VERSION = '3.1.31-dev/25';
/**
* define variable scopes
diff --git a/libs/sysplugins/smarty_internal_cacheresource_file.php b/libs/sysplugins/smarty_internal_cacheresource_file.php
index 03650835..7df4ddff 100644
--- a/libs/sysplugins/smarty_internal_cacheresource_file.php
+++ b/libs/sysplugins/smarty_internal_cacheresource_file.php
@@ -148,7 +148,7 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
*/
public function clearAll(Smarty $smarty, $exp_time = null)
{
- return Smarty_Internal_Extension_Clear::clear($smarty, null, null, null, $exp_time);
+ return $smarty->ext->_cacheResourceFile->clear($smarty, null, null, null, $exp_time);
}
/**
@@ -164,7 +164,7 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
*/
public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
{
- return Smarty_Internal_Extension_Clear::clear($smarty, $resource_name, $cache_id, $compile_id, $exp_time);
+ return $smarty->ext->_cacheResourceFile->clear($smarty, $resource_name, $cache_id, $compile_id, $exp_time);
}
/**
diff --git a/libs/sysplugins/smarty_internal_extension_handler.php b/libs/sysplugins/smarty_internal_extension_handler.php
index 9215f2db..340e6dee 100644
--- a/libs/sysplugins/smarty_internal_extension_handler.php
+++ b/libs/sysplugins/smarty_internal_extension_handler.php
@@ -11,29 +11,30 @@
* @author Uwe Tews
*
* Runtime extensions
- * @property Smarty_Internal_Runtime_CacheModify $_cacheModify
- * @property Smarty_Internal_Runtime_Capture $_capture
- * @property Smarty_Internal_Runtime_CodeFrame $_codeFrame
- * @property Smarty_Internal_Runtime_FilterHandler $_filterHandler
- * @property Smarty_Internal_Runtime_Foreach $_foreach
- * @property Smarty_Internal_Runtime_GetIncludePath $_getIncludePath
- * @property Smarty_Internal_Runtime_Make_Nocache $_make_nocache
- * @property Smarty_Internal_Runtime_UpdateCache $_updateCache
- * @property Smarty_Internal_Runtime_UpdateScope $_updateScope
- * @property Smarty_Internal_Runtime_TplFunction $_tplFunction
- * @property Smarty_Internal_Runtime_WriteFile $_writeFile
+ * @property Smarty_Internal_Runtime_CacheModify $_cacheModify
+ * @property Smarty_Internal_Runtime_CacheResourceFile $_cacheResourceFile
+ * @property Smarty_Internal_Runtime_Capture $_capture
+ * @property Smarty_Internal_Runtime_CodeFrame $_codeFrame
+ * @property Smarty_Internal_Runtime_FilterHandler $_filterHandler
+ * @property Smarty_Internal_Runtime_Foreach $_foreach
+ * @property Smarty_Internal_Runtime_GetIncludePath $_getIncludePath
+ * @property Smarty_Internal_Runtime_Make_Nocache $_make_nocache
+ * @property Smarty_Internal_Runtime_UpdateCache $_updateCache
+ * @property Smarty_Internal_Runtime_UpdateScope $_updateScope
+ * @property Smarty_Internal_Runtime_TplFunction $_tplFunction
+ * @property Smarty_Internal_Runtime_WriteFile $_writeFile
*
* Method extensions
- * @property Smarty_Internal_Method_GetTemplateVars $getTemplateVars
- * @property Smarty_Internal_Method_Append $append
- * @property Smarty_Internal_Method_AppendByRef $appendByRef
- * @property Smarty_Internal_Method_AssignGlobal $assignGlobal
- * @property Smarty_Internal_Method_AssignByRef $assignByRef
- * @property Smarty_Internal_Method_LoadFilter $loadFilter
- * @property Smarty_Internal_Method_LoadPlugin $loadPlugin
- * @property Smarty_Internal_Method_RegisterFilter $registerFilter
- * @property Smarty_Internal_Method_RegisterObject $registerObject
- * @property Smarty_Internal_Method_RegisterPlugin $registerPlugin
+ * @property Smarty_Internal_Method_GetTemplateVars $getTemplateVars
+ * @property Smarty_Internal_Method_Append $append
+ * @property Smarty_Internal_Method_AppendByRef $appendByRef
+ * @property Smarty_Internal_Method_AssignGlobal $assignGlobal
+ * @property Smarty_Internal_Method_AssignByRef $assignByRef
+ * @property Smarty_Internal_Method_LoadFilter $loadFilter
+ * @property Smarty_Internal_Method_LoadPlugin $loadPlugin
+ * @property Smarty_Internal_Method_RegisterFilter $registerFilter
+ * @property Smarty_Internal_Method_RegisterObject $registerObject
+ * @property Smarty_Internal_Method_RegisterPlugin $registerPlugin
*/
class Smarty_Internal_Extension_Handler
{
@@ -76,8 +77,8 @@ class Smarty_Internal_Extension_Handler
preg_split('/([A-Z][^A-Z]*)/', $prop,
- 1, PREG_SPLIT_NO_EMPTY |
PREG_SPLIT_DELIM_CAPTURE)));
- $this->_property_info[ $prop ] = property_exists($data, $pn) ? 1 :
- ($data->_isTplObj() && property_exists($smarty, $pn) ? 2 : 0);
+ $this->_property_info[ $prop ] =
+ property_exists($data, $pn) ? 1 : ($data->_isTplObj() && property_exists($smarty, $pn) ? 2 : 0);
}
if ($this->_property_info[ $prop ]) {
$pn = $this->resolvedProperties[ $prop ];
@@ -111,7 +112,8 @@ class Smarty_Internal_Extension_Handler
*
* @return string
*/
- public function upperCase($name) {
+ public function upperCase($name)
+ {
$_name = explode('_', $name);
$_name = array_map('ucfirst', $_name);
return implode('_', $_name);
diff --git a/libs/sysplugins/smarty_internal_extension_clear.php b/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php
index 96a62d71..7b7a9f68 100644
--- a/libs/sysplugins/smarty_internal_extension_clear.php
+++ b/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php
@@ -1,15 +1,20 @@
<?php
/**
- * Smarty Extension Clear
- *
- * $smarty->clear() method file cache file resource
+ * Smarty cache resource file clear method
*
* @package Smarty
* @subpackage PluginsInternal
* @author Uwe Tews
*/
-class Smarty_Internal_Extension_Clear
+
+/**
+ * Smarty Internal Runtime Cache Resource File Class
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ */
+class Smarty_Internal_Runtime_CacheResourceFile
{
/**
* Empty cache for a specific template
@@ -22,7 +27,7 @@ class Smarty_Internal_Extension_Clear
*
* @return integer number of cache files deleted
*/
- public static function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
+ public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
{
$_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null;
$_compile_id = isset($compile_id) ? preg_replace('![^\w]+!', '_', $compile_id) : null;
diff --git a/libs/sysplugins/smarty_internal_testinstall.php b/libs/sysplugins/smarty_internal_testinstall.php
index 45bd6a91..2f1c3de0 100644
--- a/libs/sysplugins/smarty_internal_testinstall.php
+++ b/libs/sysplugins/smarty_internal_testinstall.php
@@ -406,7 +406,6 @@ class Smarty_Internal_TestInstall
'smarty_internal_configfileparser.php' => true,
'smarty_internal_config_file_compiler.php' => true,
'smarty_internal_data.php' => true, 'smarty_internal_debug.php' => true,
- 'smarty_internal_extension_clear.php' => true,
'smarty_internal_extension_handler.php' => true,
'smarty_internal_method_addautoloadfilters.php' => true,
'smarty_internal_method_adddefaultmodifiers.php' => true,
@@ -471,6 +470,7 @@ class Smarty_Internal_TestInstall
'smarty_internal_resource_stream.php' => true,
'smarty_internal_resource_string.php' => true,
'smarty_internal_runtime_cachemodify.php' => true,
+ 'smarty_internal_runtime_cacheresourcefile.php' => true,
'smarty_internal_runtime_capture.php' => true,
'smarty_internal_runtime_codeframe.php' => true,
'smarty_internal_runtime_filterhandler.php' => true,