diff --git a/README b/README
index beb9c0a4..a8a732ee 100644
--- a/README
+++ b/README
@@ -5,7 +5,103 @@ Author: Uwe Tews
AN INTRODUCTION TO SMARTY 3 BETA
-The file structure is similar to Smarty 2:
+NOTICE for BETA 8:
+
+The Smarty 3 API (as of beta 8) has been refactored to a syntax geared
+for consistency and modularity. The Smarty 2 API syntax is still supported, but
+will throw a deprecation notice. You can disable the notices, but it is highly
+recommended to adjust your syntax to Smarty 3, as the Smarty 2 syntax must run
+through an extra rerouting wrapper.
+
+Basically, all Smarty methods now follow the "fooBarBaz" camel case syntax. Also,
+all Smarty properties now have getters and setters. So for example, the property
+$smarty->cache_dir can be set with $smarty->setCacheDir('foo/') and can be
+retrieved with $smarty->getCacheDir().
+
+Some of the Smarty 3 APIs have been revoked such as the "is*" methods that were
+just duplicate functions of the now available "get*" methods.
+
+Here is a rundown of the Smarty 3 API:
+
+$smarty->fetch($template, $cache_id = null, $compile_id = null, $parent = null)
+$smarty->display($template, $cache_id = null, $compile_id = null, $parent = null)
+$smarty->isCached($template, $cache_id = null, $compile_id = null)
+$smarty->createData($parent = null)
+$smarty->createTemplate($template, $cache_id = null, $compile_id = null, $parent = null)
+$smarty->enableSecurity()
+$smarty->setTemplateDir($template_dir)
+$smarty->addTemplateDir($template_dir)
+$smarty->enableCaching()
+$smarty->templateExists($resource_name)
+$smarty->loadPlugin($plugin_name, $check = true)
+$smarty->loadFilter($type, $name)
+$smarty->setExceptionHandler($handler)
+$smarty->addPluginsDir($plugins_dir)
+$smarty->getGlobal($varname = null)
+$smarty->getRegisteredObject($name)
+$smarty->getDebugTemplate()
+$smarty->setDebugTemplate($tpl_name)
+$smarty->assign($tpl_var, $value = null, $nocache = false, $scope = SMARTY_LOCAL_SCOPE)
+$smarty->assignGlobal($varname, $value = null, $nocache = false)
+$smarty->assignByRef($tpl_var, &$value, $nocache = false, $scope = SMARTY_LOCAL_SCOPE)
+$smarty->append($tpl_var, $value = null, $merge = false, $nocache = false, $scope = SMARTY_LOCAL_SCOPE)
+$smarty->appendByRef($tpl_var, &$value, $merge = false)
+$smarty->clearAssign($tpl_var)
+$smarty->clearAllAssign()
+$smarty->configLoad($config_file, $sections = null)
+$smarty->getVariable($variable, $_ptr = null, $search_parents = true, $error_enable = true)
+$smarty->getConfigVariable($variable)
+$smarty->getStreamVariable($variable)
+$smarty->getConfigVars($varname = null)
+$smarty->clearConfig($varname = null)
+
+// some API calls are moved into their own objects:
+
+$smarty->cache->loadResource($type = null)
+$smarty->cache->clearAll($exp_time = null, $type = null)
+$smarty->cache->clear($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
+
+$smarty->register->block($block_tag, $block_impl, $cacheable = true, $cache_attr = array())
+$smarty->register->compilerFunction($compiler_tag, $compiler_impl, $cacheable = true)
+$smarty->register->templateFunction($function_tag, $function_impl, $cacheable = true, $cache_attr = array())
+$smarty->register->modifier($modifier_name, $modifier_impl)
+$smarty->register->templateObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
+$smarty->register->outputFilter($function_name)
+$smarty->register->postFilter($function_name)
+$smarty->register->preFilter($function_name)
+$smarty->register->resource($resource_type, $function_names)
+$smarty->register->variableFilter($function_name)
+$smarty->register->defaultPluginHandler($function_name)
+$smarty->register->defaultTemplateHandler($function_name)
+
+$smarty->unregister->block($block_tag)
+$smarty->unregister->compilerFunction($compiler_tag)
+$smarty->unregister->templateFunction($function_tag)
+$smarty->unregister->modifier($modifier)
+$smarty->unregister->templateObject($object_name)
+$smarty->unregister->outputFilter($function_name)
+$smarty->unregister->postFilter($function_name)
+$smarty->unregister->preFilter($function_name)
+$smarty->unregister->resource($resource_type)
+$smarty->unregister->variableFilter($function_name)
+
+$smarty->utility->compileAllTemplates($extention = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
+$smarty->utility->clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null)
+$smarty->utility->getTemplateVars($varname = null, $_ptr = null, $search_parents = true)
+$smarty->utility->testInstall()
+
+// then all the getters/setters, available for all properties. Here are a few:
+
+$caching = $smarty->getCaching(); // get $smarty->caching
+$smarty->setCaching(true); // set $smarty->caching
+$smarty->setDeprecationNotices(false); // set $smarty->deprecation_notices
+$smarty->setCacheId($id); // set $smarty->cache_id
+$debugging = $smarty->getDebugging(); // get $smarty->debugging
+
+
+FILE STRUCTURE
+
+The Smarty 3 file structure is similar to Smarty 2:
/libs/
Smarty.class.php
diff --git a/SMARTY2_BC_NOTES b/SMARTY2_BC_NOTES
index 52c10bf6..282c64fa 100644
--- a/SMARTY2_BC_NOTES
+++ b/SMARTY2_BC_NOTES
@@ -1,76 +1,82 @@
-= Known incompatibilities with Smarty 2 =
-== PHP Version ==
-Smarty 3 is PHP 5 only. It will not work with PHP 4.
-
-== {php} Tag ==
-The {php} tag is disabled by default. The use of {php} tags is
-deprecated. It can be enabled with $smarty->allow_php_tag=true.
-
-But if you scatter PHP code which belongs together into several
-{php} tags it may not work any longer.
-
-== Delimiters and whitespace ==
-Delimiters surrounded by whitespace are no longer treated as Smarty tags.
-Therefore, { foo } will not compile as a tag, you must use {foo}. This change
-Makes Javascript/CSS easier to work with, eliminating the need for {literal}.
-This can be disabled by setting $smarty->auto_literal = false;
-
-== Unquoted Strings ==
-Smarty 2 was a bit more forgiving (and ambiguous) when it comes to unquoted strings
-in parameters. Smarty3 is more restrictive. You can still pass strings without quotes
-so long as they contain no special characters. (anything outside of A-Za-z0-9_)
-
-For example filename strings must be quoted
-
-{include file='path/foo.tpl'}
-
-
-== Extending the Smarty class ==
-Smarty 3 makes use of the __construct method for initialization. If you are extending
-the Smarty class, its constructor is not called implicitly if the your child class defines
-its own constructor. In order to run Smarty's constructor, a call to parent::__construct()
-within your child constructor is required.
-
-
-class MySmarty extends Smarty {
- function __construct() {
- parent::__construct();
-
- // your initialization code goes here
-
- }
-}
-
-
-== Autoloader ==
-Smarty 3 does register its own autoloader with spl_autoload_register. If your code has
-an existing __autoload function then this function must be explicitly registered on
-the __autoload stack. See http://us3.php.net/manual/en/function.spl-autoload-register.php
-for further details.
-
-== Plugin Filenames ==
-Smarty 3 optionally supports the PHP spl_autoloader. The autoloader requires filenames
-to be lower case. Because of this, Smarty plugin file names must also be lowercase.
-In Smarty 2, mixed case file names did work.
-
-== Scope of Special Smarty Variables ==
-In Smarty 2 the special Smarty variables $smarty.section... and $smarty.foreach...
-had global scope. If you had loops with the same name in subtemplates you could accidentally
-overwrite values of parent template.
-
-In Smarty 3 these special Smarty variable have only local scope in the template which
-is defining the loop. If you need their value in a subtemplate you have to pass them
-as parameter.
-
-{include file='path/foo.tpl' index=$smarty.section.foo.index}
-
-
-== SMARTY_RESOURCE_CHAR_SET ==
-Smarty 3 sets the constant SMARTY_RESOURCE_CHAR_SET to utf-8 as default template charset.
-This is now used also on modifiers like escape as default charset. If your templates use
-other charsets make sure that you define the constant accordingly. Otherwise you may not
-get any output.
-
-== newline at {if} tags ==
-A \n was added to the compiled code of the {if},{else},{elseif},{/if} tags to get output of newlines as expected by the template source.
-If one of the {if} tags is at the line end you will now get a newline in the HTML output.
+= Known incompatibilities with Smarty 2 =
+
+== Syntax ==
+
+Smarty 3 API has a new syntax. Much of the Smarty 2 syntax is supported but
+deprecated. See the README that comes with Smarty 3 for more information.
+
+== PHP Version ==
+Smarty 3 is PHP 5 only. It will not work with PHP 4.
+
+== {php} Tag ==
+The {php} tag is disabled by default. The use of {php} tags is
+deprecated. It can be enabled with $smarty->allow_php_tag=true.
+
+But if you scatter PHP code which belongs together into several
+{php} tags it may not work any longer.
+
+== Delimiters and whitespace ==
+Delimiters surrounded by whitespace are no longer treated as Smarty tags.
+Therefore, { foo } will not compile as a tag, you must use {foo}. This change
+Makes Javascript/CSS easier to work with, eliminating the need for {literal}.
+This can be disabled by setting $smarty->auto_literal = false;
+
+== Unquoted Strings ==
+Smarty 2 was a bit more forgiving (and ambiguous) when it comes to unquoted strings
+in parameters. Smarty3 is more restrictive. You can still pass strings without quotes
+so long as they contain no special characters. (anything outside of A-Za-z0-9_)
+
+For example filename strings must be quoted
+
+{include file='path/foo.tpl'}
+
+
+== Extending the Smarty class ==
+Smarty 3 makes use of the __construct method for initialization. If you are extending
+the Smarty class, its constructor is not called implicitly if the your child class defines
+its own constructor. In order to run Smarty's constructor, a call to parent::__construct()
+within your child constructor is required.
+
+
+class MySmarty extends Smarty {
+ function __construct() {
+ parent::__construct();
+
+ // your initialization code goes here
+
+ }
+}
+
+
+== Autoloader ==
+Smarty 3 does register its own autoloader with spl_autoload_register. If your code has
+an existing __autoload function then this function must be explicitly registered on
+the __autoload stack. See http://us3.php.net/manual/en/function.spl-autoload-register.php
+for further details.
+
+== Plugin Filenames ==
+Smarty 3 optionally supports the PHP spl_autoloader. The autoloader requires filenames
+to be lower case. Because of this, Smarty plugin file names must also be lowercase.
+In Smarty 2, mixed case file names did work.
+
+== Scope of Special Smarty Variables ==
+In Smarty 2 the special Smarty variables $smarty.section... and $smarty.foreach...
+had global scope. If you had loops with the same name in subtemplates you could accidentally
+overwrite values of parent template.
+
+In Smarty 3 these special Smarty variable have only local scope in the template which
+is defining the loop. If you need their value in a subtemplate you have to pass them
+as parameter.
+
+{include file='path/foo.tpl' index=$smarty.section.foo.index}
+
+
+== SMARTY_RESOURCE_CHAR_SET ==
+Smarty 3 sets the constant SMARTY_RESOURCE_CHAR_SET to utf-8 as default template charset.
+This is now used also on modifiers like escape as default charset. If your templates use
+other charsets make sure that you define the constant accordingly. Otherwise you may not
+get any output.
+
+== newline at {if} tags ==
+A \n was added to the compiled code of the {if},{else},{elseif},{/if} tags to get output of newlines as expected by the template source.
+If one of the {if} tags is at the line end you will now get a newline in the HTML output.
diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php
index dc81770e..063d3d19 100644
--- a/libs/Smarty.class.php
+++ b/libs/Smarty.class.php
@@ -184,6 +184,10 @@ class Smarty extends Smarty_Internal_Data {
public $caching_type = 'file';
// internal cache resource types
public $cache_resource_types = array('file');
+ // internal cache resource objects
+ public $cache_resource_objects = array();
+ // internal config properties
+ public $properties = array();
// config type
public $default_config_type = 'file';
// exception handler: array('ExceptionClass','ExceptionMethod');
@@ -216,6 +220,8 @@ class Smarty extends Smarty_Internal_Data {
public $_dir_perms = 0771;
// smarty object reference
public $smarty = null;
+ // generate deprecated function call notices?
+ public $deprecation_notices = true;
/**
* Class constructor, initializes basic smarty properties
@@ -268,7 +274,7 @@ class Smarty extends Smarty_Internal_Data {
}
}
if (isset($_SERVER['SCRIPT_NAME'])) {
- $this->assign_global('SCRIPT_NAME', $_SERVER['SCRIPT_NAME']);
+ $this->assignGlobal('SCRIPT_NAME', $_SERVER['SCRIPT_NAME']);
}
}
@@ -342,13 +348,13 @@ class Smarty extends Smarty_Internal_Data {
* @param mixed $compile_id compile id to be used with this template
* @return boolean cache status
*/
- public function is_cached($template, $cache_id = null, $compile_id = null) {
+ public function isCached($template, $cache_id = null, $compile_id = null) {
if (!($template instanceof $this->template_class)) {
$template = $this->createTemplate ($template, $cache_id, $compile_id, $this);
}
// return cache status of template
return $template->isCached();
- }
+ }
/**
* creates a data object
@@ -431,6 +437,7 @@ class Smarty extends Smarty_Internal_Data {
$this->template_dir = (array)$template_dir;
return;
}
+
/**
* Adds template directory(s) to existing ones
*
@@ -441,40 +448,29 @@ class Smarty extends Smarty_Internal_Data {
$this->template_dir = array_unique($this->template_dir);
return;
}
- /**
- * Set compile directory
- *
- * @param string $compile_dir folder of compiled template sources
- */
- public function setCompileDir($compile_dir) {
- $this->compile_dir = $compile_dir;
- return;
- }
- /**
- * Set cache directory
- *
- * @param string $cache_dir folder of cache files
- */
- public function setCacheDir($cache_dir) {
- $this->cache_dir = $cache_dir;
- return;
- }
+
/**
* Enable Caching
*/
public function enableCaching() {
$this->caching = SMARTY_CACHING_LIFETIME_CURRENT;
return;
- }
+ }
+
/**
- * Set caching life time
+ * Check if a template resource exists
*
- * @param integer $lifetime lifetime of cached file in seconds
+ * @param string $resource_name template name
+ * @return boolean status
*/
- public function setCacheLifetime($lifetime) {
- $this->cache_lifetime = $lifetime;
- return;
- }
+ function templateExists($resource_name)
+ {
+ // create template object
+ $tpl = new $this->template_class($resource_name, $this);
+ // check if it does exists
+ return $tpl->isExisting();
+ }
+
/**
* Takes unknown classes and loads plugin files for them
* class name format: Smarty_PluginType_PluginName
@@ -523,6 +519,29 @@ class Smarty extends Smarty_Internal_Data {
return false;
}
+ /**
+ * load a filter of specified type and name
+ *
+ * @param string $type filter type
+ * @param string $name filter name
+ * @return bool
+ */
+ function loadFilter($type, $name)
+ {
+ $_plugin = "smarty_{$type}filter_{$name}";
+ $_filter_name = $_plugin;
+ if ($this->loadPlugin($_plugin)) {
+ if (class_exists($_plugin, false)) {
+ $_plugin = array($_plugin, 'execute');
+ }
+ if (is_callable($_plugin)) {
+ return $this->registered_filters[$type][$_filter_name] = $_plugin;
+ }
+ }
+ throw new Exception("{$type}filter \"{$name}\" not callable");
+ return false;
+ }
+
/**
* Sets the exception handler for Smarty.
*
@@ -534,35 +553,6 @@ class Smarty extends Smarty_Internal_Data {
return set_exception_handler($handler);
}
- /**
- * Loads cache resource.
- *
- * @return object of cache resource
- */
- public function loadCacheResource($type = null) {
- if (!isset($type)) {
- $type = $this->caching_type;
- }
- // already loaded?
- if (isset($this->cache_resource_objects[$type])) {
- return $this->cache_resource_objects[$type];
- }
- if (in_array($type, $this->cache_resource_types)) {
- $cache_resource_class = 'Smarty_Internal_CacheResource_' . ucfirst($type);
- return $this->cache_resource_objects[$type] = new $cache_resource_class($this);
- }
- else {
- // try plugins dir
- $cache_resource_class = 'Smarty_CacheResource_' . ucfirst($type);
- if ($this->loadPlugin($cache_resource_class)) {
- return $this->cache_resource_objects[$type] = new $cache_resource_class($this);
- }
- else {
- throw new Exception("Unable to load cache resource '{$type}'");
- }
- }
- }
-
/**
* trigger Smarty error
*
@@ -573,6 +563,112 @@ class Smarty extends Smarty_Internal_Data {
throw new Exception("Smarty error: $error_msg");
}
+ /**
+ * Return internal filter name
+ *
+ * @param callback $function_name
+ */
+ public function _get_filter_name($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];
+ }
+ else {
+ return $function_name;
+ }
+ }
+
+ /**
+ * Adds directory of plugin files
+ *
+ * @param object $smarty
+ * @param string $ |array $ plugins folder
+ * @return
+ */
+ function addPluginsDir($plugins_dir)
+ {
+ $this->plugins_dir = array_merge((array)$this->plugins_dir, (array)$plugins_dir);
+ $this->plugins_dir = array_unique($this->plugins_dir);
+ return;
+ }
+
+ /**
+ * Returns a single or all global variables
+ *
+ * @param object $smarty
+ * @param string $varname variable name or null
+ * @return string variable value or or array of variables
+ */
+ function getGlobal($varname = null)
+ {
+ if (isset($varname)) {
+ if (isset($this->global_tpl_vars[$varname])) {
+ return $this->global_tpl_vars[$varname]->value;
+ } else {
+ return '';
+ }
+ } else {
+ $_result = array();
+ foreach ($this->global_tpl_vars AS $key => $var) {
+ $_result[$key] = $var->value;
+ }
+ return $_result;
+ }
+ }
+
+ /**
+ * return a reference to a registered object
+ *
+ * @param string $name object name
+ * @return object
+ */
+ function getRegisteredObject($name)
+ {
+ if (!isset($this->registered_objects[$name]))
+ throw new Exception("'$name' is not a registered object");
+
+ if (!is_object($this->registered_objects[$name][0]))
+ throw new Exception("registered '$name' is not an object");
+
+ return $this->registered_objects[$name][0];
+ }
+
+ /**
+ * return name of debugging template
+ *
+ * @return string
+ */
+ function getDebugTemplate()
+ {
+ return $this->debug_tpl;
+ }
+
+ /**
+ * set the debug template
+ *
+ * @param string $tpl_name
+ * @return bool
+ */
+ function setDebugTemplate($tpl_name)
+ {
+ return $this->debug_tpl = $tpl_name;
+ }
+
+ /**
+ * lazy loads (valid) property objects
+ *
+ * @param string $name property name
+ */
+ public function __get($name) {
+ if(in_array($name,array('register','unregister','utility','cache'))) {
+ $class = "Smarty_Internal_".ucfirst($name);
+ return new $class($this);
+ }
+ return false;
+ }
+
/**
* Takes unknown class methods and lazy loads sysplugin files for them
* class name format: Smarty_Method_MethodName
@@ -582,6 +678,40 @@ class Smarty extends Smarty_Internal_Data {
* @param array $args aurgument array
*/
public function __call($name, $args) {
+ static $camel_func;
+ if(!isset($camel_func))
+ $camel_func = create_function('$c', 'return "_" . strtolower($c[1]);');
+ // PHP4 call to constructor?
+ if (strtolower($name) == 'smarty') {
+ throw new Exception('Please use parent::__construct() to call parent constuctor');
+ return false;
+ }
+
+ // see if this is a set/get for a property
+ $first3 = strtolower(substr($name,0,3));
+ if(in_array($first3,array('set','get')) && substr($name,3,1) !== '_') {
+ // 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])/', $camel_func, $property_name);
+ if(!property_exists($this,$property_name)) {
+ throw new Exception("property '$property_name' does not exist.");
+ return false;
+ }
+ if($first3 == 'get')
+ return $this->$property_name;
+ else
+ return $this->$property_name = $args[0];
+ }
+
+ // Smarty Backward Compatible wrapper
+ if(!isset($this->wrapper)) {
+ $this->wrapper = new Smarty_Internal_Wrapper($this);
+ }
+ return $this->wrapper->convert($name, $args);
+
+ /*
$name = strtolower($name);
if ($name == 'smarty') {
throw new Exception('Please use parent::__construct() to call parent constuctor');
@@ -594,6 +724,7 @@ class Smarty extends Smarty_Internal_Data {
require_once(SMARTY_SYSPLUGINS_DIR . $function_name . '.php');
}
return call_user_func_array($function_name, array_merge(array($this), $args));
+ */
}
}
diff --git a/libs/sysplugins/smarty_internal_data.php b/libs/sysplugins/smarty_internal_data.php
index 3727a22f..2a2eff1d 100644
--- a/libs/sysplugins/smarty_internal_data.php
+++ b/libs/sysplugins/smarty_internal_data.php
@@ -46,7 +46,7 @@ class Smarty_Internal_Data {
* @param mixed $value the value to assign
* @param boolean $nocache if true any output of this variable will be not cached
*/
- public function assign_global($varname, $value = null, $nocache = false)
+ public function assignGlobal($varname, $value = null, $nocache = false)
{
if ($varname != '') {
$this->smarty->global_tpl_vars[$varname] = new Smarty_variable($value, $nocache);
@@ -60,7 +60,7 @@ class Smarty_Internal_Data {
* @param boolean $nocache if true any output of this variable will be not cached
* @param boolean $scope the scope the variable will have (local,parent or root)
*/
- public function assign_by_ref($tpl_var, &$value, $nocache = false, $scope = SMARTY_LOCAL_SCOPE)
+ public function assignByRef($tpl_var, &$value, $nocache = false, $scope = SMARTY_LOCAL_SCOPE)
{
if ($tpl_var != '') {
$this->tpl_vars[$tpl_var] = new Smarty_variable(null, $nocache, $scope);
@@ -139,7 +139,7 @@ class Smarty_Internal_Data {
* @param mixed $ &$value the referenced value to append
* @param boolean $merge flag if array elements shall be merged
*/
- public function append_by_ref($tpl_var, &$value, $merge = false)
+ public function appendByRef($tpl_var, &$value, $merge = false)
{
if ($tpl_var != '' && isset($value)) {
if (!isset($this->tpl_vars[$tpl_var])) {
@@ -163,7 +163,7 @@ class Smarty_Internal_Data {
*
* @param string $ |array $tpl_var the template variable(s) to clear
*/
- public function clear_assign($tpl_var)
+ public function clearAssign($tpl_var)
{
if (is_array($tpl_var)) {
foreach ($tpl_var as $curr_var) {
@@ -177,7 +177,7 @@ class Smarty_Internal_Data {
/**
* clear all the assigned template variables.
*/
- public function clear_all_assign()
+ public function clearAllAssign()
{
$this->tpl_vars = array();
}
@@ -188,7 +188,7 @@ class Smarty_Internal_Data {
* @param string $config_file filename
* @param mixed $sections array of section names, single section or null
*/
- public function config_load($config_file, $sections = null)
+ public function configLoad($config_file, $sections = null)
{
// load Config class
$config = new Smarty_Internal_Config($config_file, $this->smarty);
@@ -282,7 +282,7 @@ class Smarty_Internal_Data {
* @param string $varname variable name or null
* @return string variable value or or array of variables
*/
- function get_config_vars($varname = null)
+ function getConfigVars($varname = null)
{
if (isset($varname)) {
if (isset($this->config_vars[$varname])) {
@@ -300,7 +300,7 @@ class Smarty_Internal_Data {
*
* @param string $varname variable name or null
*/
- function clear_config($varname = null)
+ function clearConfig($varname = null)
{
if (isset($varname)) {
unset($this->config_vars[$varname]);
diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php
index 18c0e5f2..a4c3a91b 100644
--- a/libs/sysplugins/smarty_internal_template.php
+++ b/libs/sysplugins/smarty_internal_template.php
@@ -104,7 +104,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
}
// load cache resource
if (!$this->resource_object->isEvaluated && ($this->caching == SMARTY_CACHING_LIFETIME_CURRENT || $this->caching == SMARTY_CACHING_LIFETIME_SAVED)) {
- $this->cache_resource_object = $this->smarty->loadCacheResource();
+ $this->cache_resource_object = $this->smarty->cache->loadResource();
}
}
diff --git a/libs/sysplugins/smarty_method__get_filter_name.php b/libs/sysplugins/smarty_method__get_filter_name.php
deleted file mode 100644
index 9bc18fbc..00000000
--- a/libs/sysplugins/smarty_method__get_filter_name.php
+++ /dev/null
@@ -1,31 +0,0 @@
-
diff --git a/libs/sysplugins/smarty_method_addpluginsdir.php b/libs/sysplugins/smarty_method_addpluginsdir.php
deleted file mode 100644
index 24eb1137..00000000
--- a/libs/sysplugins/smarty_method_addpluginsdir.php
+++ /dev/null
@@ -1,27 +0,0 @@
-plugins_dir = array_merge((array)$smarty->plugins_dir, (array)$plugins_dir);
- $smarty->plugins_dir = array_unique($smarty->plugins_dir);
- return;
-}
-
-?>
diff --git a/libs/sysplugins/smarty_method_clear_all_assign.php b/libs/sysplugins/smarty_method_clear_all_assign.php
deleted file mode 100644
index 9809f03e..00000000
--- a/libs/sysplugins/smarty_method_clear_all_assign.php
+++ /dev/null
@@ -1,29 +0,0 @@
-tpl_vars = array();
-}
-
-?>
diff --git a/libs/sysplugins/smarty_method_clear_all_cache.php b/libs/sysplugins/smarty_method_clear_all_cache.php
deleted file mode 100644
index 2d263156..00000000
--- a/libs/sysplugins/smarty_method_clear_all_cache.php
+++ /dev/null
@@ -1,29 +0,0 @@
-loadCacheResource($type);
-
- return $cacheResource->clearAll($exp_time);
-}
-
-?>
diff --git a/libs/sysplugins/smarty_method_clear_assign.php b/libs/sysplugins/smarty_method_clear_assign.php
deleted file mode 100644
index 1f1fe0bd..00000000
--- a/libs/sysplugins/smarty_method_clear_assign.php
+++ /dev/null
@@ -1,37 +0,0 @@
-tpl_vars[$variable])) {
- unset($ptr->tpl_vars[$variable]);
- }
- $ptr = $ptr->parent;
- }
- }
- return;
-}
-
-?>
diff --git a/libs/sysplugins/smarty_method_clear_cache.php b/libs/sysplugins/smarty_method_clear_cache.php
deleted file mode 100644
index 59b79d77..00000000
--- a/libs/sysplugins/smarty_method_clear_cache.php
+++ /dev/null
@@ -1,32 +0,0 @@
-loadCacheResource($type);
-
- return $cacheResource->clear($template_name, $cache_id, $compile_id, $exp_time);
-}
-
-?>
diff --git a/libs/sysplugins/smarty_method_clear_compiled_tpl.php b/libs/sysplugins/smarty_method_clear_compiled_tpl.php
deleted file mode 100644
index f57f985e..00000000
--- a/libs/sysplugins/smarty_method_clear_compiled_tpl.php
+++ /dev/null
@@ -1,65 +0,0 @@
-use_sub_dirs ? DS : '^';
- if (isset($resource_name)) {
- $_resource_part_1 = $resource_name . '.php';
- $_resource_part_2 = $resource_name . '.cache' . '.php';
- } else {
- $_resource_part = '';
- }
- $_dir = $smarty->compile_dir;
- if ($smarty->use_sub_dirs && isset($_compile_id)) {
- $_dir .= $_compile_id . $_dir_sep;
- }
- if (isset($_compile_id)) {
- $_compile_id_part = $smarty->compile_dir . $_compile_id . $_dir_sep;
- }
- $_count = 0;
- $_compileDirs = new RecursiveDirectoryIterator($_dir);
- $_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST);
- foreach ($_compile as $_file) {
- if (strpos($_file, '.svn') !== false) continue;
- if ($_file->isDir()) {
- if (!$_compile->isDot()) {
- // delete folder if empty
- @rmdir($_file->getPathname());
- }
- } else {
- if ((!isset($_compile_id) || (strlen((string)$_file) > strlen($_compile_id_part) && substr_compare((string)$_file, $_compile_id_part, 0, strlen($_compile_id_part)) == 0)) &&
- (!isset($resource_name) || (strlen((string)$_file) > strlen($_resource_part_1) && substr_compare((string)$_file, $_resource_part_1, - strlen($_resource_part_1), strlen($_resource_part_1)) == 0) ||
- (strlen((string)$_file) > strlen($_resource_part_2) && substr_compare((string)$_file, $_resource_part_2, - strlen($_resource_part_2), strlen($_resource_part_2)) == 0))) {
- if (isset($exp_time)) {
- if (time() - @filemtime($_file) >= $exp_time) {
- $_count += @unlink((string) $_file) ? 1 : 0;
- }
- } else {
- $_count += @unlink((string) $_file) ? 1 : 0;
- }
- }
- }
- }
- return $_count;
-}
-
-?>
diff --git a/libs/sysplugins/smarty_method_compile_directory.php b/libs/sysplugins/smarty_method_compile_directory.php
deleted file mode 100644
index 48ffff75..00000000
--- a/libs/sysplugins/smarty_method_compile_directory.php
+++ /dev/null
@@ -1,72 +0,0 @@
-template_dir;
- }
- // switch off time limit
- if (function_exists('set_time_limit')) {
- @set_time_limit($time_limit);
- }
- $smarty->force_compile = $force_compile;
- $_count = 0;
- $_error_count = 0;
- // loop over array of template directories
- foreach((array)$smarty->template_dir as $_dir) {
- $_compileDirs = new RecursiveDirectoryIterator($_dir);
- $_compile = new RecursiveIteratorIterator($_compileDirs);
- foreach ($_compile as $_fileinfo) {
- if (strpos($_fileinfo, '.svn') !== false) continue;
- $_file = $_fileinfo->getFilename();
- if (!substr_compare($_file, $extention, - strlen($extention)) == 0) continue;
- if ($_fileinfo->getPath() == substr($_dir, 0, -1)) {
- $_template_file = $_file;
- } else {
- $_template_file = substr($_fileinfo->getPath(), strlen($_dir)) . '\\' . $_file;
- }
- echo ' ', $_dir, '---', $_template_file;
- flush();
- $_start_time = _get_time();
- try {
- $_tpl = $smarty->createTemplate($_template_file);
- $_tpl->getCompiledTemplate();
- }
- catch (Exception $e) {
- echo 'Error: ', $e->getMessage(), "