mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 11:24:27 +02:00
- workaround for PHP 5.2.13 bug in method_exists()
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
===== SVN trunk =====
|
===== SVN trunk =====
|
||||||
22/04/2011
|
22/04/2011
|
||||||
- bugfix allow only fixed string as file attribute at {extends} tag
|
- bugfix allow only fixed string as file attribute at {extends} tag
|
||||||
|
- workaround for PHP 5.2.13 bug in method_exists()
|
||||||
|
|
||||||
01/04/2011
|
01/04/2011
|
||||||
- bugfix do not run filters and default modifier when displaying the debug template
|
- bugfix do not run filters and default modifier when displaying the debug template
|
||||||
|
@@ -4,29 +4,29 @@
|
|||||||
* Project: Smarty: the PHP compiling template engine
|
* Project: Smarty: the PHP compiling template engine
|
||||||
* File: Smarty.class.php
|
* File: Smarty.class.php
|
||||||
* SVN: $Id$
|
* SVN: $Id$
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
* For questions, help, comments, discussion, etc., please join the
|
* For questions, help, comments, discussion, etc., please join the
|
||||||
* Smarty mailing list. Send a blank e-mail to
|
* Smarty mailing list. Send a blank e-mail to
|
||||||
* smarty-discussion-subscribe@googlegroups.com
|
* smarty-discussion-subscribe@googlegroups.com
|
||||||
*
|
*
|
||||||
* @link http://www.smarty.net/
|
* @link http://www.smarty.net/
|
||||||
* @copyright 2008 New Digital Group, Inc.
|
* @copyright 2008 New Digital Group, Inc.
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @version 3-SVN$Rev: 3286 $
|
* @version 3-SVN$Rev: 3286 $
|
||||||
*/
|
*/
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
*/
|
*/
|
||||||
if (!defined('DS')) {
|
if (!defined('DS')) {
|
||||||
define('DS', DIRECTORY_SEPARATOR);
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set SMARTY_DIR to absolute path to Smarty library files.
|
* set SMARTY_DIR to absolute path to Smarty library files.
|
||||||
@@ -44,7 +44,7 @@ if (!defined('DS')) {
|
|||||||
*/
|
*/
|
||||||
if (!defined('SMARTY_DIR')) {
|
if (!defined('SMARTY_DIR')) {
|
||||||
define('SMARTY_DIR', dirname(__FILE__) . DS);
|
define('SMARTY_DIR', dirname(__FILE__) . DS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set SMARTY_SYSPLUGINS_DIR to absolute path to Smarty internal plugins.
|
* set SMARTY_SYSPLUGINS_DIR to absolute path to Smarty internal plugins.
|
||||||
@@ -52,32 +52,32 @@ if (!defined('SMARTY_DIR')) {
|
|||||||
*/
|
*/
|
||||||
if (!defined('SMARTY_SYSPLUGINS_DIR')) {
|
if (!defined('SMARTY_SYSPLUGINS_DIR')) {
|
||||||
define('SMARTY_SYSPLUGINS_DIR', SMARTY_DIR . 'sysplugins' . DS);
|
define('SMARTY_SYSPLUGINS_DIR', SMARTY_DIR . 'sysplugins' . DS);
|
||||||
}
|
}
|
||||||
if (!defined('SMARTY_PLUGINS_DIR')) {
|
if (!defined('SMARTY_PLUGINS_DIR')) {
|
||||||
define('SMARTY_PLUGINS_DIR', SMARTY_DIR . 'plugins' . DS);
|
define('SMARTY_PLUGINS_DIR', SMARTY_DIR . 'plugins' . DS);
|
||||||
}
|
}
|
||||||
if (!defined('SMARTY_RESOURCE_CHAR_SET')) {
|
if (!defined('SMARTY_RESOURCE_CHAR_SET')) {
|
||||||
define('SMARTY_RESOURCE_CHAR_SET', 'UTF-8');
|
define('SMARTY_RESOURCE_CHAR_SET', 'UTF-8');
|
||||||
}
|
}
|
||||||
if (!defined('SMARTY_RESOURCE_DATE_FORMAT')) {
|
if (!defined('SMARTY_RESOURCE_DATE_FORMAT')) {
|
||||||
define('SMARTY_RESOURCE_DATE_FORMAT', '%b %e, %Y');
|
define('SMARTY_RESOURCE_DATE_FORMAT', '%b %e, %Y');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* register the class autoloader
|
* register the class autoloader
|
||||||
*/
|
*/
|
||||||
if (!defined('SMARTY_SPL_AUTOLOAD')) {
|
if (!defined('SMARTY_SPL_AUTOLOAD')) {
|
||||||
define('SMARTY_SPL_AUTOLOAD', 0);
|
define('SMARTY_SPL_AUTOLOAD', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SMARTY_SPL_AUTOLOAD && set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false) {
|
if (SMARTY_SPL_AUTOLOAD && set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false) {
|
||||||
$registeredAutoLoadFunctions = spl_autoload_functions();
|
$registeredAutoLoadFunctions = spl_autoload_functions();
|
||||||
if (!isset($registeredAutoLoadFunctions['spl_autoload'])) {
|
if (!isset($registeredAutoLoadFunctions['spl_autoload'])) {
|
||||||
spl_autoload_register();
|
spl_autoload_register();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
spl_autoload_register('smartyAutoload');
|
spl_autoload_register('smartyAutoload');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the main Smarty class
|
* This is the main Smarty class
|
||||||
@@ -87,7 +87,7 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
* constant definitions
|
* constant definitions
|
||||||
*/
|
*/
|
||||||
// smarty version
|
// smarty version
|
||||||
const SMARTY_VERSION = 'Smarty3-SVN$Rev: 3286 $';
|
const SMARTY_VERSION = 'Smarty3-SVN$Rev: 3286 $';
|
||||||
//define variable scopes
|
//define variable scopes
|
||||||
const SCOPE_LOCAL = 0;
|
const SCOPE_LOCAL = 0;
|
||||||
const SCOPE_PARENT = 1;
|
const SCOPE_PARENT = 1;
|
||||||
@@ -117,121 +117,121 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
* static variables
|
* static variables
|
||||||
*/
|
*/
|
||||||
// assigned global tpl vars
|
// assigned global tpl vars
|
||||||
static $global_tpl_vars = array();
|
static $global_tpl_vars = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* variables
|
* variables
|
||||||
*/
|
*/
|
||||||
// auto literal on delimiters with whitspace
|
// auto literal on delimiters with whitspace
|
||||||
public $auto_literal = true;
|
public $auto_literal = true;
|
||||||
// display error on not assigned variables
|
// display error on not assigned variables
|
||||||
public $error_unassigned = false;
|
public $error_unassigned = false;
|
||||||
// template directory
|
// template directory
|
||||||
public $template_dir = null;
|
public $template_dir = null;
|
||||||
// default template handler
|
// default template handler
|
||||||
public $default_template_handler_func = null;
|
public $default_template_handler_func = null;
|
||||||
// compile directory
|
// compile directory
|
||||||
public $compile_dir = null;
|
public $compile_dir = null;
|
||||||
// plugins directory
|
// plugins directory
|
||||||
public $plugins_dir = null;
|
public $plugins_dir = null;
|
||||||
// cache directory
|
// cache directory
|
||||||
public $cache_dir = null;
|
public $cache_dir = null;
|
||||||
// config directory
|
// config directory
|
||||||
public $config_dir = null;
|
public $config_dir = null;
|
||||||
// force template compiling?
|
// force template compiling?
|
||||||
public $force_compile = false;
|
public $force_compile = false;
|
||||||
// check template for modifications?
|
// check template for modifications?
|
||||||
public $compile_check = true;
|
public $compile_check = true;
|
||||||
// locking concurrent compiles
|
// locking concurrent compiles
|
||||||
public $compile_locking = true;
|
public $compile_locking = true;
|
||||||
// use sub dirs for compiled/cached files?
|
// use sub dirs for compiled/cached files?
|
||||||
public $use_sub_dirs = false;
|
public $use_sub_dirs = false;
|
||||||
// compile_error?
|
// compile_error?
|
||||||
public $compile_error = false;
|
public $compile_error = false;
|
||||||
// caching enabled
|
// caching enabled
|
||||||
public $caching = false;
|
public $caching = false;
|
||||||
// merge compiled includes
|
// merge compiled includes
|
||||||
public $merge_compiled_includes = false;
|
public $merge_compiled_includes = false;
|
||||||
// cache lifetime
|
// cache lifetime
|
||||||
public $cache_lifetime = 3600;
|
public $cache_lifetime = 3600;
|
||||||
// force cache file creation
|
// force cache file creation
|
||||||
public $force_cache = false;
|
public $force_cache = false;
|
||||||
// cache_id
|
// cache_id
|
||||||
public $cache_id = null;
|
public $cache_id = null;
|
||||||
// compile_id
|
// compile_id
|
||||||
public $compile_id = null;
|
public $compile_id = null;
|
||||||
// template delimiters
|
// template delimiters
|
||||||
public $left_delimiter = "{";
|
public $left_delimiter = "{";
|
||||||
public $right_delimiter = "}";
|
public $right_delimiter = "}";
|
||||||
// security
|
// security
|
||||||
public $security_class = 'Smarty_Security';
|
public $security_class = 'Smarty_Security';
|
||||||
public $security_policy = null;
|
public $security_policy = null;
|
||||||
public $php_handling = self::PHP_PASSTHRU;
|
public $php_handling = self::PHP_PASSTHRU;
|
||||||
public $allow_php_tag = false;
|
public $allow_php_tag = false;
|
||||||
public $allow_php_templates = false;
|
public $allow_php_templates = false;
|
||||||
public $direct_access_security = true;
|
public $direct_access_security = true;
|
||||||
public $trusted_dir = array();
|
public $trusted_dir = array();
|
||||||
// debug mode
|
// debug mode
|
||||||
public $debugging = false;
|
public $debugging = false;
|
||||||
public $debugging_ctrl = 'NONE';
|
public $debugging_ctrl = 'NONE';
|
||||||
public $smarty_debug_id = 'SMARTY_DEBUG';
|
public $smarty_debug_id = 'SMARTY_DEBUG';
|
||||||
public $debug_tpl = null;
|
public $debug_tpl = null;
|
||||||
// When set, smarty does uses this value as error_reporting-level.
|
// When set, smarty does uses this value as error_reporting-level.
|
||||||
public $error_reporting = null;
|
public $error_reporting = null;
|
||||||
// config var settings
|
// config var settings
|
||||||
public $config_overwrite = true; //Controls whether variables with the same name overwrite each other.
|
public $config_overwrite = true; //Controls whether variables with the same name overwrite each other.
|
||||||
public $config_booleanize = true; //Controls whether config values of on/true/yes and off/false/no get converted to boolean
|
public $config_booleanize = true; //Controls whether config values of on/true/yes and off/false/no get converted to boolean
|
||||||
public $config_read_hidden = false; //Controls whether hidden config sections/vars are read from the file.
|
public $config_read_hidden = false; //Controls whether hidden config sections/vars are read from the file.
|
||||||
// config vars
|
// config vars
|
||||||
public $config_vars = array();
|
public $config_vars = array();
|
||||||
// assigned tpl vars
|
// assigned tpl vars
|
||||||
public $tpl_vars = array();
|
public $tpl_vars = array();
|
||||||
// dummy parent object
|
// dummy parent object
|
||||||
public $parent = null;
|
public $parent = null;
|
||||||
// global template functions
|
// global template functions
|
||||||
public $template_functions = array();
|
public $template_functions = array();
|
||||||
// resource type used if none given
|
// resource type used if none given
|
||||||
public $default_resource_type = 'file';
|
public $default_resource_type = 'file';
|
||||||
// caching type
|
// caching type
|
||||||
public $caching_type = 'file';
|
public $caching_type = 'file';
|
||||||
// internal cache resource types
|
// internal cache resource types
|
||||||
public $cache_resource_types = array('file');
|
public $cache_resource_types = array('file');
|
||||||
// internal config properties
|
// internal config properties
|
||||||
public $properties = array();
|
public $properties = array();
|
||||||
// config type
|
// config type
|
||||||
public $default_config_type = 'file';
|
public $default_config_type = 'file';
|
||||||
// cached template objects
|
// cached template objects
|
||||||
public $template_objects = null;
|
public $template_objects = null;
|
||||||
// check If-Modified-Since headers
|
// check If-Modified-Since headers
|
||||||
public $cache_modified_check = false;
|
public $cache_modified_check = false;
|
||||||
// registered plugins
|
// registered plugins
|
||||||
public $registered_plugins = array();
|
public $registered_plugins = array();
|
||||||
// plugin search order
|
// plugin search order
|
||||||
public $plugin_search_order = array('function', 'block', 'compiler', 'class');
|
public $plugin_search_order = array('function', 'block', 'compiler', 'class');
|
||||||
// registered objects
|
// registered objects
|
||||||
public $registered_objects = array();
|
public $registered_objects = array();
|
||||||
// registered classes
|
// registered classes
|
||||||
public $registered_classes = array();
|
public $registered_classes = array();
|
||||||
// registered filters
|
// registered filters
|
||||||
public $registered_filters = array();
|
public $registered_filters = array();
|
||||||
// registered resources
|
// registered resources
|
||||||
public $registered_resources = array();
|
public $registered_resources = array();
|
||||||
// autoload filter
|
// autoload filter
|
||||||
public $autoload_filters = array();
|
public $autoload_filters = array();
|
||||||
// status of filter on variable output
|
// status of filter on variable output
|
||||||
public $variable_filter = true;
|
public $variable_filter = true;
|
||||||
// default modifier
|
// default modifier
|
||||||
public $default_modifiers = array();
|
public $default_modifiers = array();
|
||||||
// global internal smarty vars
|
// global internal smarty vars
|
||||||
static $_smarty_vars = array();
|
static $_smarty_vars = array();
|
||||||
// start time for execution time calculation
|
// start time for execution time calculation
|
||||||
public $start_time = 0;
|
public $start_time = 0;
|
||||||
// default file permissions
|
// default file permissions
|
||||||
public $_file_perms = 0644;
|
public $_file_perms = 0644;
|
||||||
// default dir permissions
|
// default dir permissions
|
||||||
public $_dir_perms = 0771;
|
public $_dir_perms = 0771;
|
||||||
// block tag hierarchy
|
// block tag hierarchy
|
||||||
public $_tag_stack = array();
|
public $_tag_stack = array();
|
||||||
// flag if {block} tag is compiled for template inheritance
|
// flag if {block} tag is compiled for template inheritance
|
||||||
public $inheritance = false;
|
public $inheritance = false;
|
||||||
// generate deprecated function call notices?
|
// generate deprecated function call notices?
|
||||||
@@ -245,13 +245,13 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
* Class constructor, initializes basic smarty properties
|
* Class constructor, initializes basic smarty properties
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// selfpointer need by some other class methods
|
// selfpointer need by some other class methods
|
||||||
$this->smarty = $this;
|
$this->smarty = $this;
|
||||||
if (is_callable('mb_internal_encoding')) {
|
if (is_callable('mb_internal_encoding')) {
|
||||||
mb_internal_encoding(SMARTY_RESOURCE_CHAR_SET);
|
mb_internal_encoding(SMARTY_RESOURCE_CHAR_SET);
|
||||||
}
|
}
|
||||||
$this->start_time = microtime(true);
|
$this->start_time = microtime(true);
|
||||||
// set default dirs
|
// set default dirs
|
||||||
$this->template_dir = array('.' . DS . 'templates' . DS);
|
$this->template_dir = array('.' . DS . 'templates' . DS);
|
||||||
$this->compile_dir = '.' . DS . 'templates_c' . DS;
|
$this->compile_dir = '.' . DS . 'templates_c' . DS;
|
||||||
@@ -261,19 +261,19 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
$this->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl';
|
$this->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl';
|
||||||
if (isset($_SERVER['SCRIPT_NAME'])) {
|
if (isset($_SERVER['SCRIPT_NAME'])) {
|
||||||
$this->assignGlobal('SCRIPT_NAME', $_SERVER['SCRIPT_NAME']);
|
$this->assignGlobal('SCRIPT_NAME', $_SERVER['SCRIPT_NAME']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class destructor
|
* Class destructor
|
||||||
*/
|
*/
|
||||||
public function __destruct()
|
public function __destruct()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fetches a rendered Smarty template
|
* fetches a rendered Smarty template
|
||||||
*
|
*
|
||||||
* @param string $template the resource handle of the template file or template object
|
* @param string $template the resource handle of the template file or template object
|
||||||
* @param mixed $cache_id cache id to be used with this template
|
* @param mixed $cache_id cache id to be used with this template
|
||||||
* @param mixed $compile_id compile id to be used with this template
|
* @param mixed $compile_id compile id to be used with this template
|
||||||
@@ -285,11 +285,11 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
if (!empty($cache_id) && is_object($cache_id)) {
|
if (!empty($cache_id) && is_object($cache_id)) {
|
||||||
$parent = $cache_id;
|
$parent = $cache_id;
|
||||||
$cache_id = null;
|
$cache_id = null;
|
||||||
}
|
}
|
||||||
if ($parent === null) {
|
if ($parent === null) {
|
||||||
// get default Smarty data object
|
// get default Smarty data object
|
||||||
$parent = $this;
|
$parent = $this;
|
||||||
}
|
}
|
||||||
// create template object if necessary
|
// create template object if necessary
|
||||||
($template instanceof $this->template_class)? $_template = $template :
|
($template instanceof $this->template_class)? $_template = $template :
|
||||||
$_template = $this->createTemplate ($template, $cache_id, $compile_id, $parent, false);
|
$_template = $this->createTemplate ($template, $cache_id, $compile_id, $parent, false);
|
||||||
@@ -302,7 +302,7 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
$_query_string = $_SERVER['QUERY_STRING'];
|
$_query_string = $_SERVER['QUERY_STRING'];
|
||||||
} else {
|
} else {
|
||||||
$_query_string = '';
|
$_query_string = '';
|
||||||
}
|
}
|
||||||
if (false !== strpos($_query_string, $this->smarty_debug_id)) {
|
if (false !== strpos($_query_string, $this->smarty_debug_id)) {
|
||||||
if (false !== strpos($_query_string, $this->smarty_debug_id . '=on')) {
|
if (false !== strpos($_query_string, $this->smarty_debug_id . '=on')) {
|
||||||
// enable debugging for this browser session
|
// enable debugging for this browser session
|
||||||
@@ -315,13 +315,13 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
} else {
|
} else {
|
||||||
// enable debugging for this page
|
// enable debugging for this page
|
||||||
$this->debugging = true;
|
$this->debugging = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isset($_COOKIE['SMARTY_DEBUG'])) {
|
if (isset($_COOKIE['SMARTY_DEBUG'])) {
|
||||||
$this->debugging = true;
|
$this->debugging = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// obtain data for cache modified check
|
// obtain data for cache modified check
|
||||||
if ($this->cache_modified_check && $this->caching && $display) {
|
if ($this->cache_modified_check && $this->caching && $display) {
|
||||||
$_isCached = $_template->isCached() && !$_template->has_nocache_code;
|
$_isCached = $_template->isCached() && !$_template->has_nocache_code;
|
||||||
@@ -329,18 +329,18 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
$_gmt_mtime = gmdate('D, d M Y H:i:s', $_template->getCachedTimestamp()) . ' GMT';
|
$_gmt_mtime = gmdate('D, d M Y H:i:s', $_template->getCachedTimestamp()) . ' GMT';
|
||||||
} else {
|
} else {
|
||||||
$_gmt_mtime = '';
|
$_gmt_mtime = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// return rendered template
|
// return rendered template
|
||||||
if ((!$this->caching || $_template->resource_object->isEvaluated) && (isset($this->autoload_filters['output']) || isset($this->registered_filters['output']))) {
|
if ((!$this->caching || $_template->resource_object->isEvaluated) && (isset($this->autoload_filters['output']) || isset($this->registered_filters['output']))) {
|
||||||
$_output = Smarty_Internal_Filter_Handler::runFilter('output', $_template->getRenderedTemplate(), $_template);
|
$_output = Smarty_Internal_Filter_Handler::runFilter('output', $_template->getRenderedTemplate(), $_template);
|
||||||
} else {
|
} else {
|
||||||
$_output = $_template->getRenderedTemplate();
|
$_output = $_template->getRenderedTemplate();
|
||||||
}
|
}
|
||||||
$_template->rendered_content = null;
|
$_template->rendered_content = null;
|
||||||
if (isset($this->error_reporting)) {
|
if (isset($this->error_reporting)) {
|
||||||
error_reporting($_smarty_old_error_level);
|
error_reporting($_smarty_old_error_level);
|
||||||
}
|
}
|
||||||
// display or fetch
|
// display or fetch
|
||||||
if ($display) {
|
if ($display) {
|
||||||
if ($this->caching && $this->cache_modified_check) {
|
if ($this->caching && $this->cache_modified_check) {
|
||||||
@@ -353,38 +353,38 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
} else {
|
} else {
|
||||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->getCachedTimestamp()) . ' GMT');
|
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->getCachedTimestamp()) . ' GMT');
|
||||||
echo $_output;
|
echo $_output;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo $_output;
|
echo $_output;
|
||||||
}
|
}
|
||||||
// debug output
|
// debug output
|
||||||
if ($this->debugging) {
|
if ($this->debugging) {
|
||||||
Smarty_Internal_Debug::display_debug($this);
|
Smarty_Internal_Debug::display_debug($this);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// return fetched content
|
// return fetched content
|
||||||
return $_output;
|
return $_output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* displays a Smarty template
|
* displays a Smarty template
|
||||||
*
|
*
|
||||||
* @param string $ |object $template the resource handle of the template file or template object
|
* @param string $ |object $template the resource handle of the template file or template object
|
||||||
* @param mixed $cache_id cache id to be used with this template
|
* @param mixed $cache_id cache id to be used with this template
|
||||||
* @param mixed $compile_id compile id to be used with this template
|
* @param mixed $compile_id compile id to be used with this template
|
||||||
* @param object $parent next higher level of Smarty variables
|
* @param object $parent next higher level of Smarty variables
|
||||||
*/
|
*/
|
||||||
public function display($template, $cache_id = null, $compile_id = null, $parent = null)
|
public function display($template, $cache_id = null, $compile_id = null, $parent = null)
|
||||||
{
|
{
|
||||||
// display template
|
// display template
|
||||||
$this->fetch ($template, $cache_id, $compile_id, $parent, true);
|
$this->fetch ($template, $cache_id, $compile_id, $parent, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test if cache i valid
|
* test if cache i valid
|
||||||
*
|
*
|
||||||
* @param string $ |object $template the resource handle of the template file or template object
|
* @param string $ |object $template the resource handle of the template file or template object
|
||||||
* @param mixed $cache_id cache id to be used with this template
|
* @param mixed $cache_id cache id to be used with this template
|
||||||
* @param mixed $compile_id compile id to be used with this template
|
* @param mixed $compile_id compile id to be used with this template
|
||||||
@@ -398,25 +398,25 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
}
|
}
|
||||||
if (!($template instanceof $this->template_class)) {
|
if (!($template instanceof $this->template_class)) {
|
||||||
$template = $this->createTemplate ($template, $cache_id, $compile_id, $parent, false);
|
$template = $this->createTemplate ($template, $cache_id, $compile_id, $parent, false);
|
||||||
}
|
}
|
||||||
// return cache status of template
|
// return cache status of template
|
||||||
return $template->isCached();
|
return $template->isCached();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* creates a data object
|
* creates a data object
|
||||||
*
|
*
|
||||||
* @param object $parent next higher level of Smarty variables
|
* @param object $parent next higher level of Smarty variables
|
||||||
* @returns object data object
|
* @returns object data object
|
||||||
*/
|
*/
|
||||||
public function createData($parent = null)
|
public function createData($parent = null)
|
||||||
{
|
{
|
||||||
return new Smarty_Data($parent, $this);
|
return new Smarty_Data($parent, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* creates a template object
|
* creates a template object
|
||||||
*
|
*
|
||||||
* @param string $template the resource handle of the template file
|
* @param string $template the resource handle of the template file
|
||||||
* @param mixed $cache_id cache id to be used with this template
|
* @param mixed $cache_id cache id to be used with this template
|
||||||
* @param mixed $compile_id compile id to be used with this template
|
* @param mixed $compile_id compile id to be used with this template
|
||||||
@@ -429,13 +429,13 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
if (!empty($cache_id) && (is_object($cache_id) || is_array($cache_id))) {
|
if (!empty($cache_id) && (is_object($cache_id) || is_array($cache_id))) {
|
||||||
$parent = $cache_id;
|
$parent = $cache_id;
|
||||||
$cache_id = null;
|
$cache_id = null;
|
||||||
}
|
}
|
||||||
if (!empty($parent) && is_array($parent)) {
|
if (!empty($parent) && is_array($parent)) {
|
||||||
$data = $parent;
|
$data = $parent;
|
||||||
$parent = null;
|
$parent = null;
|
||||||
} else {
|
} else {
|
||||||
$data = null;
|
$data = null;
|
||||||
}
|
}
|
||||||
if (!is_object($template)) {
|
if (!is_object($template)) {
|
||||||
// we got a template resource
|
// we got a template resource
|
||||||
// already in template cache?
|
// already in template cache?
|
||||||
@@ -450,44 +450,44 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
} else {
|
} else {
|
||||||
$tpl = new $this->template_class($template, $this, $parent, $cache_id, $compile_id);
|
$tpl = new $this->template_class($template, $this, $parent, $cache_id, $compile_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// just return a copy of template class
|
// just return a copy of template class
|
||||||
$tpl = $template;
|
$tpl = $template;
|
||||||
}
|
}
|
||||||
// fill data if present
|
// fill data if present
|
||||||
if (!empty($data) && is_array($data)) {
|
if (!empty($data) && is_array($data)) {
|
||||||
// set up variable values
|
// set up variable values
|
||||||
foreach ($data as $_key => $_val) {
|
foreach ($data as $_key => $_val) {
|
||||||
$tpl->tpl_vars[$_key] = new Smarty_variable($_val);
|
$tpl->tpl_vars[$_key] = new Smarty_variable($_val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $tpl;
|
return $tpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a template resource exists
|
* Check if a template resource exists
|
||||||
*
|
*
|
||||||
* @param string $resource_name template name
|
* @param string $resource_name template name
|
||||||
* @return boolean status
|
* @return boolean status
|
||||||
*/
|
*/
|
||||||
function templateExists($resource_name)
|
function templateExists($resource_name)
|
||||||
{
|
{
|
||||||
// create template object
|
// create template object
|
||||||
$save = $this->template_objects;
|
$save = $this->template_objects;
|
||||||
$tpl = new $this->template_class($resource_name, $this);
|
$tpl = new $this->template_class($resource_name, $this);
|
||||||
// check if it does exists
|
// check if it does exists
|
||||||
$result = $tpl->isExisting();
|
$result = $tpl->isExisting();
|
||||||
$this->template_objects = $save;
|
$this->template_objects = $save;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a single or all global variables
|
* Returns a single or all global variables
|
||||||
*
|
*
|
||||||
* @param object $smarty
|
* @param object $smarty
|
||||||
* @param string $varname variable name or null
|
* @param string $varname variable name or null
|
||||||
* @return string variable value or or array of variables
|
* @return string variable value or or array of variables
|
||||||
*/
|
*/
|
||||||
@@ -498,32 +498,32 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
return self::$global_tpl_vars[$varname]->value;
|
return self::$global_tpl_vars[$varname]->value;
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$_result = array();
|
$_result = array();
|
||||||
foreach (self::$global_tpl_vars AS $key => $var) {
|
foreach (self::$global_tpl_vars AS $key => $var) {
|
||||||
$_result[$key] = $var->value;
|
$_result[$key] = $var->value;
|
||||||
}
|
}
|
||||||
return $_result;
|
return $_result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty cache folder
|
* Empty cache folder
|
||||||
*
|
*
|
||||||
* @param integer $exp_time expiration time
|
* @param integer $exp_time expiration time
|
||||||
* @param string $type resource type
|
* @param string $type resource type
|
||||||
* @return integer number of cache files deleted
|
* @return integer number of cache files deleted
|
||||||
*/
|
*/
|
||||||
function clearAllCache($exp_time = null, $type = null)
|
function clearAllCache($exp_time = null, $type = null)
|
||||||
{
|
{
|
||||||
// load cache resource and call clearAll
|
// load cache resource and call clearAll
|
||||||
return $this->loadCacheResource($type)->clearAll($exp_time);
|
return $this->loadCacheResource($type)->clearAll($exp_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty cache for a specific template
|
* Empty cache for a specific template
|
||||||
*
|
*
|
||||||
* @param string $template_name template name
|
* @param string $template_name template name
|
||||||
* @param string $cache_id cache id
|
* @param string $cache_id cache id
|
||||||
* @param string $compile_id compile id
|
* @param string $compile_id compile id
|
||||||
@@ -532,7 +532,7 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
* @return integer number of cache files deleted
|
* @return integer number of cache files deleted
|
||||||
*/
|
*/
|
||||||
function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
|
function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
|
||||||
{
|
{
|
||||||
// load cache resource and call clear
|
// load cache resource and call clear
|
||||||
return $this->loadCacheResource($type)->clear($template_name, $cache_id, $compile_id, $exp_time);
|
return $this->loadCacheResource($type)->clear($template_name, $cache_id, $compile_id, $exp_time);
|
||||||
}
|
}
|
||||||
@@ -553,8 +553,8 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
$this->security_policy = new $security_class($this);
|
$this->security_policy = new $security_class($this);
|
||||||
} else {
|
} else {
|
||||||
throw new SmartyException("Security class '$security_class' is not defined");
|
throw new SmartyException("Security class '$security_class' is not defined");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable security
|
* Disable security
|
||||||
@@ -562,76 +562,76 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
public function disableSecurity()
|
public function disableSecurity()
|
||||||
{
|
{
|
||||||
$this->security_policy = null;
|
$this->security_policy = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads cache resource.
|
* Loads cache resource.
|
||||||
*
|
*
|
||||||
* @param string $type cache resource type
|
* @param string $type cache resource type
|
||||||
* @return object of cache resource
|
* @return object of cache resource
|
||||||
*/
|
*/
|
||||||
public function loadCacheResource($type = null) {
|
public function loadCacheResource($type = null) {
|
||||||
if (!isset($type)) {
|
if (!isset($type)) {
|
||||||
$type = $this->caching_type;
|
$type = $this->caching_type;
|
||||||
}
|
}
|
||||||
if (in_array($type, $this->cache_resource_types)) {
|
if (in_array($type, $this->cache_resource_types)) {
|
||||||
$cache_resource_class = 'Smarty_Internal_CacheResource_' . ucfirst($type);
|
$cache_resource_class = 'Smarty_Internal_CacheResource_' . ucfirst($type);
|
||||||
return new $cache_resource_class($this);
|
return new $cache_resource_class($this);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// try plugins dir
|
// try plugins dir
|
||||||
$cache_resource_class = 'Smarty_CacheResource_' . ucfirst($type);
|
$cache_resource_class = 'Smarty_CacheResource_' . ucfirst($type);
|
||||||
if ($this->loadPlugin($cache_resource_class)) {
|
if ($this->loadPlugin($cache_resource_class)) {
|
||||||
return new $cache_resource_class($this);
|
return new $cache_resource_class($this);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new SmartyException("Unable to load cache resource '{$type}'");
|
throw new SmartyException("Unable to load cache resource '{$type}'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set template directory
|
* Set template directory
|
||||||
*
|
*
|
||||||
* @param string $ |array $template_dir folder(s) of template sorces
|
* @param string $ |array $template_dir folder(s) of template sorces
|
||||||
*/
|
*/
|
||||||
public function setTemplateDir($template_dir)
|
public function setTemplateDir($template_dir)
|
||||||
{
|
{
|
||||||
$this->template_dir = (array)$template_dir;
|
$this->template_dir = (array)$template_dir;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds template directory(s) to existing ones
|
* Adds template directory(s) to existing ones
|
||||||
*
|
*
|
||||||
* @param string $ |array $template_dir folder(s) of template sources
|
* @param string $ |array $template_dir folder(s) of template sources
|
||||||
*/
|
*/
|
||||||
public function addTemplateDir($template_dir)
|
public function addTemplateDir($template_dir)
|
||||||
{
|
{
|
||||||
$this->template_dir = array_unique(array_merge((array)$this->template_dir, (array)$template_dir));
|
$this->template_dir = array_unique(array_merge((array)$this->template_dir, (array)$template_dir));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds directory of plugin files
|
* Adds directory of plugin files
|
||||||
*
|
*
|
||||||
* @param object $smarty
|
* @param object $smarty
|
||||||
* @param string $ |array $ plugins folder
|
* @param string $ |array $ plugins folder
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
function addPluginsDir($plugins_dir)
|
function addPluginsDir($plugins_dir)
|
||||||
{
|
{
|
||||||
$this->plugins_dir = array_unique(array_merge((array)$this->plugins_dir, (array)$plugins_dir));
|
$this->plugins_dir = array_unique(array_merge((array)$this->plugins_dir, (array)$plugins_dir));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return a reference to a registered object
|
* return a reference to a registered object
|
||||||
*
|
*
|
||||||
* @param string $name object name
|
* @param string $name object name
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
function getRegisteredObject($name)
|
function getRegisteredObject($name)
|
||||||
{
|
{
|
||||||
@@ -642,51 +642,51 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
throw new SmartyException("registered '$name' is not an object");
|
throw new SmartyException("registered '$name' is not an object");
|
||||||
|
|
||||||
return $this->registered_objects[$name][0];
|
return $this->registered_objects[$name][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return name of debugging template
|
* return name of debugging template
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getDebugTemplate()
|
function getDebugTemplate()
|
||||||
{
|
{
|
||||||
return $this->debug_tpl;
|
return $this->debug_tpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the debug template
|
* set the debug template
|
||||||
*
|
*
|
||||||
* @param string $tpl_name
|
* @param string $tpl_name
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function setDebugTemplate($tpl_name)
|
function setDebugTemplate($tpl_name)
|
||||||
{
|
{
|
||||||
return $this->debug_tpl = $tpl_name;
|
return $this->debug_tpl = $tpl_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes unknown classes and loads plugin files for them
|
* Takes unknown classes and loads plugin files for them
|
||||||
* class name format: Smarty_PluginType_PluginName
|
* class name format: Smarty_PluginType_PluginName
|
||||||
* plugin filename format: plugintype.pluginname.php
|
* plugin filename format: plugintype.pluginname.php
|
||||||
*
|
*
|
||||||
* @param string $plugin_name class plugin name to load
|
* @param string $plugin_name class plugin name to load
|
||||||
* @return string |boolean filepath of loaded file or false
|
* @return string |boolean filepath of loaded file or false
|
||||||
*/
|
*/
|
||||||
public function loadPlugin($plugin_name, $check = true)
|
public function loadPlugin($plugin_name, $check = true)
|
||||||
{
|
{
|
||||||
// if function or class exists, exit silently (already loaded)
|
// if function or class exists, exit silently (already loaded)
|
||||||
if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false)))
|
if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false)))
|
||||||
return true;
|
return true;
|
||||||
// Plugin name is expected to be: Smarty_[Type]_[Name]
|
// Plugin name is expected to be: Smarty_[Type]_[Name]
|
||||||
$_plugin_name = strtolower($plugin_name);
|
$_plugin_name = strtolower($plugin_name);
|
||||||
$_name_parts = explode('_', $_plugin_name, 3);
|
$_name_parts = explode('_', $_plugin_name, 3);
|
||||||
// class name must have three parts to be valid plugin
|
// class name must have three parts to be valid plugin
|
||||||
if (count($_name_parts) < 3 || $_name_parts[0] !== 'smarty') {
|
if (count($_name_parts) < 3 || $_name_parts[0] !== 'smarty') {
|
||||||
throw new SmartyException("plugin {$plugin_name} is not a valid name format");
|
throw new SmartyException("plugin {$plugin_name} is not a valid name format");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// if type is "internal", get plugin from sysplugins
|
// if type is "internal", get plugin from sysplugins
|
||||||
if ($_name_parts[1] == 'internal') {
|
if ($_name_parts[1] == 'internal') {
|
||||||
$file = SMARTY_SYSPLUGINS_DIR . $_plugin_name . '.php';
|
$file = SMARTY_SYSPLUGINS_DIR . $_plugin_name . '.php';
|
||||||
@@ -695,24 +695,24 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
return $file;
|
return $file;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// plugin filename is expected to be: [type].[name].php
|
// plugin filename is expected to be: [type].[name].php
|
||||||
$_plugin_filename = "{$_name_parts[1]}.{$_name_parts[2]}.php";
|
$_plugin_filename = "{$_name_parts[1]}.{$_name_parts[2]}.php";
|
||||||
// loop through plugin dirs and find the plugin
|
// loop through plugin dirs and find the plugin
|
||||||
foreach((array)$this->plugins_dir as $_plugin_dir) {
|
foreach((array)$this->plugins_dir as $_plugin_dir) {
|
||||||
if (strpos('/\\', substr($_plugin_dir, -1)) === false) {
|
if (strpos('/\\', substr($_plugin_dir, -1)) === false) {
|
||||||
$_plugin_dir .= DS;
|
$_plugin_dir .= DS;
|
||||||
}
|
}
|
||||||
$file = $_plugin_dir . $_plugin_filename;
|
$file = $_plugin_dir . $_plugin_filename;
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
require_once($file);
|
require_once($file);
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// no plugin loaded
|
// no plugin loaded
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clean up properties on cloned object
|
* clean up properties on cloned object
|
||||||
@@ -720,12 +720,12 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
public function __clone()
|
public function __clone()
|
||||||
{
|
{
|
||||||
// clear config vars
|
// clear config vars
|
||||||
$this->config_vars = array();
|
$this->config_vars = array();
|
||||||
// clear assigned tpl vars
|
// clear assigned tpl vars
|
||||||
$this->tpl_vars = array();
|
$this->tpl_vars = array();
|
||||||
// clear objects for external methods
|
// clear objects for external methods
|
||||||
unset($this->register);
|
unset($this->register);
|
||||||
unset($this->filter);
|
unset($this->filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -739,19 +739,19 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
{
|
{
|
||||||
static $camel_func;
|
static $camel_func;
|
||||||
if (!isset($camel_func))
|
if (!isset($camel_func))
|
||||||
$camel_func = create_function('$c', 'return "_" . strtolower($c[1]);');
|
$camel_func = create_function('$c', 'return "_" . strtolower($c[1]);');
|
||||||
// see if this is a set/get for a property
|
// see if this is a set/get for a property
|
||||||
$first3 = strtolower(substr($name, 0, 3));
|
$first3 = strtolower(substr($name, 0, 3));
|
||||||
if (in_array($first3, array('set', 'get')) && substr($name, 3, 1) !== '_') {
|
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
|
// try to keep case correct for future PHP 6.0 case-sensitive class methods
|
||||||
// lcfirst() not available < PHP 5.3.0, so improvise
|
// lcfirst() not available < PHP 5.3.0, so improvise
|
||||||
$property_name = strtolower(substr($name, 3, 1)) . substr($name, 4);
|
$property_name = strtolower(substr($name, 3, 1)) . substr($name, 4);
|
||||||
// convert camel case to underscored name
|
// convert camel case to underscored name
|
||||||
$property_name = preg_replace_callback('/([A-Z])/', $camel_func, $property_name);
|
$property_name = preg_replace_callback('/([A-Z])/', $camel_func, $property_name);
|
||||||
if (!property_exists($this, $property_name)) {
|
if (!property_exists($this, $property_name)) {
|
||||||
throw new SmartyException("property '$property_name' does not exist.");
|
throw new SmartyException("property '$property_name' does not exist.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($first3 == 'get')
|
if ($first3 == 'get')
|
||||||
return $this->$property_name;
|
return $this->$property_name;
|
||||||
else
|
else
|
||||||
@@ -761,33 +761,33 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
if (strpos($name,'_') !== false) {
|
if (strpos($name,'_') !== false) {
|
||||||
if (!isset($this->wrapper)) {
|
if (!isset($this->wrapper)) {
|
||||||
$this->wrapper = new Smarty_Internal_Wrapper($this);
|
$this->wrapper = new Smarty_Internal_Wrapper($this);
|
||||||
}
|
}
|
||||||
return $this->wrapper->convert($name, $args);
|
return $this->wrapper->convert($name, $args);
|
||||||
}
|
}
|
||||||
// external Smarty methods ?
|
// external Smarty methods ?
|
||||||
foreach(array('filter','register') as $external) {
|
foreach(array('Filter','Register') as $external) {
|
||||||
if (method_exists("Smarty_Internal_{$external}",$name)) {
|
if (class_exists("Smarty_Internal_{$external}") && method_exists("Smarty_Internal_{$external}",$name)) {
|
||||||
if (!isset($this->$external)) {
|
if (!isset($this->$external)) {
|
||||||
$class = "Smarty_Internal_{$external}";
|
$class = "Smarty_Internal_{$external}";
|
||||||
$this->$external = new $class($this);
|
$this->$external = new $class($this);
|
||||||
}
|
}
|
||||||
return call_user_func_array(array($this->$external,$name), $args);
|
return call_user_func_array(array($this->$external,$name), $args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (in_array($name,array('clearCompiledTemplate','compileAllTemplates','compileAllConfig','testInstall','getTags'))) {
|
if (in_array($name,array('clearCompiledTemplate','compileAllTemplates','compileAllConfig','testInstall','getTags'))) {
|
||||||
if (!isset($this->utility)) {
|
if (!isset($this->utility)) {
|
||||||
$this->utility = new Smarty_Internal_Utility($this);
|
$this->utility = new Smarty_Internal_Utility($this);
|
||||||
}
|
}
|
||||||
return call_user_func_array(array($this->utility,$name), $args);
|
return call_user_func_array(array($this->utility,$name), $args);
|
||||||
}
|
}
|
||||||
// PHP4 call to constructor?
|
// PHP4 call to constructor?
|
||||||
if (strtolower($name) == 'smarty') {
|
if (strtolower($name) == 'smarty') {
|
||||||
throw new SmartyException('Please use parent::__construct() to call parent constuctor');
|
throw new SmartyException('Please use parent::__construct() to call parent constuctor');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
throw new SmartyException("Call of unknown function '$name'.");
|
throw new SmartyException("Call of unknown function '$name'.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autoloader
|
* Autoloader
|
||||||
@@ -797,8 +797,8 @@ function smartyAutoload($class)
|
|||||||
$_class = strtolower($class);
|
$_class = strtolower($class);
|
||||||
if (substr($_class, 0, 16) === 'smarty_internal_' || $_class == 'smarty_security') {
|
if (substr($_class, 0, 16) === 'smarty_internal_' || $_class == 'smarty_security') {
|
||||||
include SMARTY_SYSPLUGINS_DIR . $_class . '.php';
|
include SMARTY_SYSPLUGINS_DIR . $_class . '.php';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty exception class
|
* Smarty exception class
|
||||||
|
Reference in New Issue
Block a user