mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 11:54:26 +02:00
- removed all internal calls of Smarty::instance()
- fixed code in double quoted strings
This commit is contained in:
@@ -1,3 +1,26 @@
|
||||
08/08/2009
|
||||
- removed all internal calls of Smarty::instance()
|
||||
- fixed code in double quoted strings
|
||||
|
||||
08/05/2009
|
||||
- bugfix mb_string support
|
||||
- bugfix of \n.\t etc in double quoted strings
|
||||
|
||||
07/29/2009
|
||||
- added syntax for variable config vars like #$foo#
|
||||
|
||||
07/28/2009
|
||||
- fixed parsing of $smarty.session vars containing objects
|
||||
|
||||
07/22/2009
|
||||
- fix of "$" handling in double quoted strings
|
||||
|
||||
07/21/2009
|
||||
- fix that {$smarty.current_dir} return correct value within {block} tags.
|
||||
|
||||
07/20/2009
|
||||
- drop error message on unmatched {block} {/block} pairs
|
||||
|
||||
07/01/2009
|
||||
- fixed smarty_function_html_options call in plugin function.html_select_date.php (missing ,)
|
||||
|
||||
|
@@ -59,8 +59,7 @@ define('SMARTY_CACHING_LIVETIME_SAVED', 2);
|
||||
*/
|
||||
if (!defined('SMARTY_EXCEPTION_HANDLER')) {
|
||||
define('SMARTY_EXCEPTION_HANDLER', 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* load required base class for creation of the smarty object
|
||||
@@ -71,6 +70,8 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sysplugins' . DIRECTORY_
|
||||
* This is the main Smarty class
|
||||
*/
|
||||
class Smarty extends Smarty_Internal_TemplateBase {
|
||||
// smarty instances
|
||||
private static $instance = array();
|
||||
// smarty version
|
||||
public static $_version = 'Smarty3Alpha';
|
||||
// class used for templates
|
||||
@@ -119,13 +120,13 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
public $debugging = false;
|
||||
public $debugging_ctrl = 'URL';
|
||||
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.
|
||||
public $error_reporting = null;
|
||||
// config var settings
|
||||
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_read_hidden = true; //Controls whether hidden config sections/vars are read from the file.
|
||||
public $config_read_hidden = true; //Controls whether hidden config sections/vars are read from the file.
|
||||
// config vars
|
||||
public $config_vars = array();
|
||||
// assigned tpl vars
|
||||
@@ -187,11 +188,10 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
/**
|
||||
* Class constructor, initializes basic smarty properties
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct($name = 'default')
|
||||
{
|
||||
// set instance object
|
||||
self::instance($this);
|
||||
|
||||
Smarty::$instance[$name] = $this;
|
||||
if (is_callable('mb_internal_encoding')) {
|
||||
$this->has_mb = true;
|
||||
mb_internal_encoding($this->resource_char_set);
|
||||
@@ -216,9 +216,9 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
$this->loadPlugin('Smarty_Internal_PluginBase');
|
||||
$this->loadPlugin($this->template_class);
|
||||
$this->loadPlugin('Smarty_Internal_Plugin_Handler');
|
||||
$this->plugin_handler = new Smarty_Internal_Plugin_Handler;
|
||||
$this->plugin_handler = new Smarty_Internal_Plugin_Handler($this);
|
||||
$this->loadPlugin('Smarty_Internal_Run_Filter');
|
||||
$this->filter_handler = new Smarty_Internal_Run_Filter;
|
||||
$this->filter_handler = new Smarty_Internal_Run_Filter($this);
|
||||
if (!$this->debugging && $this->debugging_ctrl == 'URL') {
|
||||
if (isset($_SERVER['QUERY_STRING'])) {
|
||||
$_query_string = $_SERVER['QUERY_STRING'];
|
||||
@@ -258,16 +258,17 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
|
||||
/**
|
||||
* Sets a static instance of the smarty object. Retrieve with:
|
||||
* $smarty = Smarty::instance();
|
||||
* $smarty = Smarty::instance($name);
|
||||
*
|
||||
* @return object reference to Smarty object
|
||||
*/
|
||||
public static function &instance($new_instance = null)
|
||||
public static function &instance($name = 'default')
|
||||
{
|
||||
static $instance = null;
|
||||
if (isset($new_instance) && is_object($new_instance))
|
||||
$instance = $new_instance;
|
||||
return $instance;
|
||||
if (isset(Smarty::$instance[$name])) {
|
||||
return Smarty::$instance[$name];
|
||||
} else {
|
||||
throw new Exception("Smarty instance $name is not existing");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -349,9 +350,9 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
if (!class_exists('Smarty_Security_Policy')) {
|
||||
throw new Exception("Security policy must define class 'Smarty_Security_Policy'");
|
||||
}
|
||||
$this->security_policy = new Smarty_Security_Policy();
|
||||
$this->security_policy = new Smarty_Security_Policy;
|
||||
$this->loadPlugin('Smarty_Internal_Security_Handler');
|
||||
$this->security_handler = new Smarty_Internal_Security_Handler();
|
||||
$this->security_handler = new Smarty_Internal_Security_Handler($this);
|
||||
$this->security = true;
|
||||
} else {
|
||||
throw new Exception("Security policy {$security_policy_file} not found");
|
||||
@@ -454,7 +455,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
}
|
||||
// loop through plugin dirs and find the plugin
|
||||
foreach((array)$this->plugins_dir as $_plugin_dir) {
|
||||
if (strpos('/\\',substr($_plugin_dir, -1)) === false) {
|
||||
if (strpos('/\\', substr($_plugin_dir, -1)) === false) {
|
||||
$_plugin_dir .= DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
@@ -489,19 +490,17 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
*/
|
||||
public function __call($name, $args)
|
||||
{
|
||||
$_class_name = "Smarty_Method_{$name}";
|
||||
if (!class_exists($_class_name, false)) {
|
||||
if (!is_callable($name)) {
|
||||
$_plugin_filename = strtolower('method.' . $name . $this->php_ext);
|
||||
if (!file_exists($this->sysplugins_dir . $_plugin_filename)) {
|
||||
throw new Exception("Sysplugin file " . $_plugin_filename . " does not exist");
|
||||
}
|
||||
require_once($this->sysplugins_dir . $_plugin_filename);
|
||||
if (!class_exists($_class_name, false)) {
|
||||
throw new Exception ("Sysplugin file " . $_plugin_filename . " does not define class " . $_class_name);
|
||||
if (!is_callable($name)) {
|
||||
throw new Exception ("Sysplugin file " . $_plugin_filename . " does not define function " . $name);
|
||||
}
|
||||
}
|
||||
$_method_object = new $_class_name;
|
||||
return call_user_func_array(array($_method_object, 'execute'), $args);
|
||||
return call_user_func_array($name, array_merge(array($this), $args));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,6 +518,7 @@ class SmartyException {
|
||||
echo "Code: " . $e->getCode() . "<br />Error: " . htmlentities($e->getMessage()) . "<br />"
|
||||
. "File: " . $e->getFile() . "<br />"
|
||||
. "Line: " . $e->getLine() . "<br />"
|
||||
// . "Trace" . $e->getTraceAsString() . "<br />"
|
||||
. "\n";
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
* @param integer $
|
||||
* @return string
|
||||
*/
|
||||
class Smarty_Modifier_Debug_Print_Var extends Smarty_Internal_PluginBase {
|
||||
class Smarty_Modifier_Debug_Print_Var {
|
||||
static function execute ($var, $depth = 0, $length = 40)
|
||||
{
|
||||
$_replace = array("\n" => '<i>\n</i>',
|
||||
|
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty Internal Base
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsInternal
|
||||
* @author Monte Ohrt
|
||||
*/
|
||||
/**
|
||||
/**
|
||||
* Smarty Internal Base Class
|
||||
*/
|
||||
abstract class Smarty_Internal_Base {
|
||||
/**
|
||||
* Set up instance of Smarty object
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->smarty = Smarty::instance();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -15,7 +15,12 @@
|
||||
/**
|
||||
* Smarty Internal Plugin Cacher InlineCode Class
|
||||
*/
|
||||
class Smarty_Internal_Cacher_InlineCode extends Smarty_Internal_PluginBase {
|
||||
class Smarty_Internal_Cacher_InlineCode {
|
||||
function __construct($smarty)
|
||||
{
|
||||
$this->smarty = $smarty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inject inline code for nocache template sections
|
||||
*
|
||||
@@ -30,7 +35,7 @@ class Smarty_Internal_Cacher_InlineCode extends Smarty_Internal_PluginBase {
|
||||
* @return string content
|
||||
*/
|
||||
public function processNocacheCode ($content, $compiler, $tag_nocache, $is_code)
|
||||
{
|
||||
{
|
||||
// If the template is not evaluated and we have a nocache section and or a nocache tag
|
||||
if ($is_code) {
|
||||
// generate replacement code
|
||||
|
@@ -14,7 +14,11 @@
|
||||
/**
|
||||
* This class does contain all necessary methods for the HTML cache on file system
|
||||
*/
|
||||
class Smarty_Internal_CacheResource_File extends Smarty_Internal_PluginBase {
|
||||
class Smarty_Internal_CacheResource_File {
|
||||
function __construct($smarty)
|
||||
{
|
||||
$this->smarty = $smarty;
|
||||
}
|
||||
/**
|
||||
* Returns the filepath of the cached template output
|
||||
*
|
||||
|
@@ -44,7 +44,7 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
// create config object
|
||||
$_output = "<?php \$_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Config');";
|
||||
$_output .= "\$_config = new Smarty_Internal_Config($conf_file);";
|
||||
$_output .= "\$_config = new Smarty_Internal_Config($conf_file, \$_smarty_tpl->smarty);";
|
||||
$_output .= "\$_config->loadConfigVars($section, $scope); ?>";
|
||||
return $_output;
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
|
||||
// create template object
|
||||
$_output = "\$_template = new Smarty_Template ('string:'.".$_attr['var'].", \$_smarty_tpl);";
|
||||
$_output = "\$_template = new Smarty_Template ('string:'.".$_attr['var'].", \$_smarty_tpl->smarty, \$_smarty_tpl);";
|
||||
//was there an assign attribute?
|
||||
if (isset($_assign)) {
|
||||
$_output .= "\$_smarty_tpl->assign($_assign,\$_smarty_tpl->smarty->fetch(\$_template));";
|
||||
|
@@ -30,7 +30,7 @@ class Smarty_Internal_Compile_Extend extends Smarty_Internal_CompileBase {
|
||||
// $include_file = '';
|
||||
eval('$include_file = ' . $_attr['file'] . ';');
|
||||
// create template object
|
||||
$_template = new Smarty_Template ($include_file, $compiler->template);
|
||||
$_template = new Smarty_Template ($include_file, $this->compiler->smarty, $compiler->template);
|
||||
// save file dependency
|
||||
$compiler->template->properties['file_dependency'][] = array($_template->getTemplateFilepath(), $_template->getTemplateTimestamp());
|
||||
// $_old_source = preg_replace ('/' . $this->smarty->left_delimiter . 'extend\s+(?:file=)?\s*(\S+?|(["\']).+?\2)' . $this->smarty->right_delimiter . '/i', '' , $compiler->template->template_source, 1);
|
||||
|
@@ -70,7 +70,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
}
|
||||
// create template object
|
||||
$_output = "<?php \$_template = new Smarty_Template ($include_file, \$_smarty_tpl, \$_smarty_tpl->cache_id, \$_smarty_tpl->compile_id);";
|
||||
$_output = "<?php \$_template = new Smarty_Template ($include_file, \$_smarty_tpl->smarty, \$_smarty_tpl, \$_smarty_tpl->cache_id, \$_smarty_tpl->compile_id);";
|
||||
// delete {include} standard attributes
|
||||
unset($_attr['file'], $_attr['assign'], $_attr['caching_lifetime'], $_attr['nocache'], $_attr['caching'], $_attr['scope']);
|
||||
// remaining attributes must be assigned as smarty variable
|
||||
|
@@ -34,7 +34,7 @@ class Smarty_Internal_Compile_Internal_Function_Call extends Smarty_Internal_Com
|
||||
}
|
||||
$_name = trim($_attr['name'], "'");
|
||||
// create template object
|
||||
$_output = "<?php \$_template = new Smarty_Template ('string:', \$_smarty_tpl);\n";
|
||||
$_output = "<?php \$_template = new Smarty_Template ('string:', \$_smarty_tpl->smarty, \$_smarty_tpl);\n";
|
||||
// assign default paramter
|
||||
if (isset($this->smarty->template_functions[$_name]['parameter'])) {
|
||||
// function is already compiled
|
||||
|
@@ -9,15 +9,12 @@
|
||||
* @subpackage Config
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
class Smarty_Internal_Config extends Smarty_Internal_Base {
|
||||
class Smarty_Internal_Config {
|
||||
static $config_objects = array();
|
||||
|
||||
public function __construct($config_resource)
|
||||
public function __construct($config_resource, $smarty)
|
||||
{
|
||||
parent::__construct();
|
||||
// set instance object
|
||||
// self::instance($this);
|
||||
// initianlize
|
||||
$this->smarty = $smarty;
|
||||
$this->config_resource = $config_resource;
|
||||
$this->config_resource_type = null;
|
||||
$this->config_resource_name = null;
|
||||
@@ -77,7 +74,7 @@ class Smarty_Internal_Config extends Smarty_Internal_Base {
|
||||
public function buildConfigFilepath ()
|
||||
{
|
||||
foreach((array)$this->smarty->config_dir as $_config_dir) {
|
||||
if (strpos('/\\',substr($_config_dir, -1)) === false) {
|
||||
if (strpos('/\\', substr($_config_dir, -1)) === false) {
|
||||
$_config_dir .= DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
@@ -134,7 +131,7 @@ class Smarty_Internal_Config extends Smarty_Internal_Base {
|
||||
}
|
||||
public function buildCompiledFilepath()
|
||||
{
|
||||
$_filepath = (string)abs(crc32($this->config_resource_name));
|
||||
$_filepath = (string)abs(crc32($this->config_resource_name));
|
||||
// if use_sub_dirs, break file into directories
|
||||
if ($this->smarty->use_sub_dirs) {
|
||||
$_filepath = substr($_filepath, 0, 3) . DIRECTORY_SEPARATOR
|
||||
@@ -201,7 +198,7 @@ class Smarty_Internal_Config extends Smarty_Internal_Base {
|
||||
if (!is_object($this->compiler_object)) {
|
||||
// load compiler
|
||||
$this->smarty->loadPlugin('Smarty_Internal_Config_File_Compiler');
|
||||
$this->compiler_object = new Smarty_Internal_Config_File_Compiler;
|
||||
$this->compiler_object = new Smarty_Internal_Config_File_Compiler($this->smarty);
|
||||
}
|
||||
if (!is_object($this->smarty->write_file_object)) {
|
||||
$this->smarty->loadPlugin("Smarty_Internal_Write_File");
|
||||
@@ -229,8 +226,8 @@ class Smarty_Internal_Config extends Smarty_Internal_Base {
|
||||
*/
|
||||
public function loadConfigVars ($sections = null, $scope)
|
||||
{
|
||||
$config_data = unserialize($this->getCompiledConfig());
|
||||
// var_dump($config_data);
|
||||
$config_data = unserialize($this->getCompiledConfig());
|
||||
// var_dump($config_data);
|
||||
// copy global config vars
|
||||
foreach ($config_data['vars'] as $variable => $value) {
|
||||
$scope->config_vars[$variable] = $value;
|
||||
|
@@ -13,14 +13,14 @@
|
||||
/**
|
||||
* Main config file compiler class
|
||||
*/
|
||||
class Smarty_Internal_Config_File_Compiler extends Smarty_Internal_Base {
|
||||
class Smarty_Internal_Config_File_Compiler {
|
||||
public $compile_error= false;
|
||||
/**
|
||||
* Initialize compiler
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct($smarty)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->smarty = $smarty;
|
||||
// get required plugins
|
||||
$this->smarty->loadPlugin('Smarty_Internal_Configfilelexer');
|
||||
$this->smarty->loadPlugin('Smarty_Internal_Configfileparser');
|
||||
@@ -47,7 +47,7 @@ class Smarty_Internal_Config_File_Compiler extends Smarty_Internal_Base {
|
||||
return true;
|
||||
}
|
||||
// init the lexer/parser to compile the config file
|
||||
$lex = new Smarty_Internal_Configfilelexer($_content);
|
||||
$lex = new Smarty_Internal_Configfilelexer($_content, $this->smarty);
|
||||
$parser = new Smarty_Internal_Configfileparser($lex, $this);
|
||||
// $parser->PrintTrace();
|
||||
// get tokens from lexer and parse them
|
||||
|
@@ -24,14 +24,14 @@ class Smarty_Internal_Configfilelexer
|
||||
);
|
||||
|
||||
|
||||
function __construct($data)
|
||||
function __construct($data, $smarty)
|
||||
{
|
||||
// set instance object
|
||||
self::instance($this);
|
||||
$this->data = $data;
|
||||
$this->counter = 0;
|
||||
$this->line = 1;
|
||||
$this->smarty = Smarty::instance();
|
||||
$this->smarty = $smarty;
|
||||
}
|
||||
public static function &instance($new_instance = null)
|
||||
{
|
||||
|
@@ -120,7 +120,7 @@ class Smarty_Internal_Configfileparser#line 109 "internal.configfileparser.php"
|
||||
// set instance object
|
||||
self::instance($this);
|
||||
$this->lex = $lex;
|
||||
$this->smarty = Smarty::instance();
|
||||
$this->smarty = $compiler->smarty;
|
||||
$this->compiler = $compiler;
|
||||
$this->current_section = null;
|
||||
$this->hidden_section = false;
|
||||
|
@@ -48,7 +48,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_TemplateBase {
|
||||
ksort($_assigned_vars);
|
||||
$_config_vars = $smarty->config_vars;
|
||||
ksort($_config_vars);
|
||||
$_template = new Smarty_Template ($smarty->debug_tpl);
|
||||
$_template = new Smarty_Template ($smarty->debug_tpl, $smarty);
|
||||
$_template->caching = false;
|
||||
$_template->force_compile = false;
|
||||
$_template->security = false;
|
||||
|
@@ -10,7 +10,11 @@
|
||||
/**
|
||||
* Smarty Internal Plugin Handler Class
|
||||
*/
|
||||
class Smarty_Internal_Plugin_Handler extends Smarty_Internal_Base {
|
||||
class Smarty_Internal_Plugin_Handler {
|
||||
function __construct($smarty)
|
||||
{
|
||||
$this->smarty = $smarty;
|
||||
}
|
||||
/**
|
||||
* Call a Smarty plugin
|
||||
*
|
||||
|
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty Internal Plugin Base
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsInternal
|
||||
* @author Monte Ohrt
|
||||
*/
|
||||
/**
|
||||
* Smarty Internal PluginBase Class
|
||||
*/
|
||||
class Smarty_Internal_PluginBase extends Smarty_Internal_Base {
|
||||
}
|
||||
|
||||
?>
|
@@ -12,7 +12,11 @@
|
||||
/**
|
||||
* Smarty Internal Plugin Resource File
|
||||
*/
|
||||
class Smarty_Internal_Resource_File extends Smarty_Internal_Base {
|
||||
class Smarty_Internal_Resource_File {
|
||||
public function __construct($smarty)
|
||||
{
|
||||
$this->smarty = $smarty;
|
||||
}
|
||||
// classes used for compiling Smarty templates from file resource
|
||||
public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler';
|
||||
public $template_lexer_class = 'Smarty_Internal_Templatelexer';
|
||||
@@ -92,8 +96,8 @@ class Smarty_Internal_Resource_File extends Smarty_Internal_Base {
|
||||
*/
|
||||
public function getCompiledFilepath($_template)
|
||||
{
|
||||
// $_filepath = md5($_template->resource_name);
|
||||
$_filepath = (string)abs(crc32($_template->resource_name));
|
||||
// $_filepath = md5($_template->resource_name);
|
||||
$_filepath = (string)abs(crc32($_template->resource_name));
|
||||
// if use_sub_dirs, break file into directories
|
||||
if ($_template->smarty->use_sub_dirs) {
|
||||
$_filepath = substr($_filepath, 0, 3) . DIRECTORY_SEPARATOR
|
||||
@@ -111,7 +115,7 @@ class Smarty_Internal_Resource_File extends Smarty_Internal_Base {
|
||||
$_cache = '';
|
||||
}
|
||||
$_compile_dir = $_template->smarty->compile_dir;
|
||||
if (strpos('/\\',substr($_compile_dir, -1)) === false) {
|
||||
if (strpos('/\\', substr($_compile_dir, -1)) === false) {
|
||||
$_compile_dir .= DIRECTORY_SEPARATOR;
|
||||
}
|
||||
return $_compile_dir . $_filepath . '.' . basename($_template->resource_name) . $_cache . $_template->smarty->php_ext;
|
||||
|
@@ -12,12 +12,13 @@
|
||||
/**
|
||||
* Smarty Internal Plugin Resource PHP
|
||||
*/
|
||||
class Smarty_Internal_Resource_PHP extends Smarty_Internal_Base {
|
||||
class Smarty_Internal_Resource_PHP {
|
||||
/**
|
||||
* Class constructor, enable short open tags
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct($smarty)
|
||||
{
|
||||
$this->smarty = $smarty;
|
||||
ini_set('short_open_tag', '1');
|
||||
}
|
||||
/**
|
||||
|
@@ -13,7 +13,11 @@
|
||||
* Smarty Internal Plugin Resource Stream
|
||||
*/
|
||||
|
||||
class Smarty_Internal_Resource_Stream extends Smarty_Internal_Base {
|
||||
class Smarty_Internal_Resource_Stream {
|
||||
public function __construct($smarty)
|
||||
{
|
||||
$this->smarty = $smarty;
|
||||
}
|
||||
// classes used for compiling Smarty templates from file resource
|
||||
public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler';
|
||||
public $template_lexer_class = 'Smarty_Internal_Templatelexer';
|
||||
|
@@ -12,7 +12,11 @@
|
||||
* Smarty Internal Plugin Resource String
|
||||
*/
|
||||
|
||||
class Smarty_Internal_Resource_String extends Smarty_Internal_Base {
|
||||
class Smarty_Internal_Resource_String {
|
||||
public function __construct($smarty)
|
||||
{
|
||||
$this->smarty = $smarty;
|
||||
}
|
||||
// classes used for compiling Smarty templates from file resource
|
||||
public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler';
|
||||
public $template_lexer_class = 'Smarty_Internal_Templatelexer';
|
||||
|
@@ -13,7 +13,11 @@
|
||||
/**
|
||||
* Class for filter processing
|
||||
*/
|
||||
class Smarty_Internal_Run_Filter extends Smarty_Internal_Base {
|
||||
class Smarty_Internal_Run_Filter {
|
||||
function __construct($smarty)
|
||||
{
|
||||
$this->smarty = $smarty;
|
||||
}
|
||||
/**
|
||||
* Run filters over content
|
||||
*
|
||||
|
@@ -9,7 +9,11 @@
|
||||
/**
|
||||
* This class contains all methods for security checking
|
||||
*/
|
||||
class Smarty_Internal_Security_Handler extends Smarty_Internal_Base {
|
||||
class Smarty_Internal_Security_Handler {
|
||||
function __construct($smarty)
|
||||
{
|
||||
$this->smarty = $smarty;
|
||||
}
|
||||
/**
|
||||
* Check if PHP function is trusted.
|
||||
*
|
||||
|
@@ -16,8 +16,9 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom
|
||||
/**
|
||||
* Initialize compiler
|
||||
*/
|
||||
public function __construct($lexer_class, $parser_class)
|
||||
public function __construct($lexer_class, $parser_class, $smarty)
|
||||
{
|
||||
$this->smarty = $smarty;
|
||||
parent::__construct();
|
||||
// get required plugins
|
||||
$this->smarty->loadPlugin($lexer_class);
|
||||
@@ -38,7 +39,7 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom
|
||||
tags in the templates are replaces with PHP code,
|
||||
then written to compiled files. */
|
||||
// init the lexer/parser to compile the template
|
||||
$lex = new $this->lexer_class($_content);
|
||||
$lex = new $this->lexer_class($_content,$this->smarty);
|
||||
$parser = new $this->parser_class($lex, $this);
|
||||
// $parser->PrintTrace();
|
||||
// get tokens from lexer and parse them
|
||||
|
@@ -76,9 +76,9 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
* @param mixed $_cache_id cache id or null
|
||||
* @param mixed $_compile_id compile id or null
|
||||
*/
|
||||
public function __construct($template_resource, $_parent = null, $_cache_id = null, $_compile_id = null)
|
||||
public function __construct($template_resource, $smarty, $_parent = null, $_cache_id = null, $_compile_id = null)
|
||||
{
|
||||
$this->smarty = Smarty::instance();
|
||||
$this->smarty = $smarty;
|
||||
// Smarty parameter
|
||||
$this->cache_id = $_cache_id === null ? $this->smarty->cache_id : $_cache_id;
|
||||
$this->compile_id = $_compile_id === null ? $this->smarty->compile_id : $_compile_id;
|
||||
@@ -102,12 +102,12 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
// load cacher
|
||||
if ($this->caching) {
|
||||
$this->smarty->loadPlugin($this->cacher_class);
|
||||
$this->cacher_object = new $this->cacher_class;
|
||||
$this->cacher_object = new $this->cacher_class($this->smarty);
|
||||
}
|
||||
// load cache resource
|
||||
if (!$this->isEvaluated() && $this->caching && !isset($this->smarty->cache_resource_objects[$this->caching_type])) {
|
||||
$this->smarty->loadPlugin($this->cache_resource_class);
|
||||
$this->smarty->cache_resource_objects[$this->caching_type] = new $this->cache_resource_class;
|
||||
$this->smarty->cache_resource_objects[$this->caching_type] = new $this->cache_resource_class($this->smarty);
|
||||
}
|
||||
if ($this->smarty->direct_access_security) {
|
||||
$this->dir_acc_sec_string = "<?php if(!defined('SMARTY_DIR')) exit('no direct access allowed'); ?>\n";
|
||||
@@ -296,7 +296,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
$this->smarty->loadPlugin('Smarty_Internal_CompileBase');
|
||||
$this->smarty->loadPlugin('Smarty_Internal_TemplateCompilerBase');
|
||||
$this->smarty->loadPlugin($this->resource_objects[$this->resource_type]->compiler_class);
|
||||
$this->compiler_object = new $this->resource_objects[$this->resource_type]->compiler_class($this->resource_objects[$this->resource_type]->template_lexer_class, $this->resource_objects[$this->resource_type]->template_parser_class);
|
||||
$this->compiler_object = new $this->resource_objects[$this->resource_type]->compiler_class($this->resource_objects[$this->resource_type]->template_lexer_class, $this->resource_objects[$this->resource_type]->template_parser_class, $this->smarty);
|
||||
}
|
||||
if (!is_object($this->smarty->write_file_object)) {
|
||||
$this->smarty->loadPlugin("Smarty_Internal_Write_File");
|
||||
@@ -548,12 +548,12 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
// try sysplugins dir first
|
||||
$_resource_class = "Smarty_Internal_Resource_{$this->resource_type}";
|
||||
if ($this->smarty->loadPlugin($_resource_class)) {
|
||||
$this->resource_objects[$this->resource_type] = new $_resource_class;
|
||||
$this->resource_objects[$this->resource_type] = new $_resource_class($this->smarty);
|
||||
} else {
|
||||
// try plugins dir
|
||||
$_resource_class = "Smarty_Resource_{$this->resource_type}";
|
||||
if ($this->smarty->loadPlugin($_resource_class)) {
|
||||
$this->resource_objects[$this->resource_type] = new $_resource_class;
|
||||
$this->resource_objects[$this->resource_type] = new $_resource_class($this->smarty);
|
||||
} else {
|
||||
// try streams
|
||||
$_known_stream = stream_get_wrappers();
|
||||
@@ -564,7 +564,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
}
|
||||
if (!isset($this->resource_objects['stream'])) {
|
||||
$this->smarty->loadPlugin('Smarty_Internal_Resource_Stream');
|
||||
$this->resource_objects['stream'] = new Smarty_Internal_Resource_Stream;
|
||||
$this->resource_objects['stream'] = new Smarty_Internal_Resource_Stream($this->smarty);
|
||||
}
|
||||
$this->resource_type = 'stream';
|
||||
$this->resource_name = str_replace(':', '://', $template_resource);
|
||||
@@ -577,7 +577,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
// cache template object under a unique ID
|
||||
// do not cache string resources
|
||||
if ($this->resource_type != 'string') {
|
||||
$this->smarty->template_objects[$this->buildTemplateId ($this->template_resource, $this->cache_id, $this->compile_id)] = $this;
|
||||
$this->smarty->template_objects[$this->buildTemplateId ($this->template_resource, $this->cache_id, $this->compile_id)] = $this;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -311,16 +311,15 @@ class Smarty_Internal_TemplateBase {
|
||||
public function createTemplate($template, $parent = null, $cache_id = null, $compile_id = null)
|
||||
{
|
||||
if (!is_object($template)) {
|
||||
$_smarty = Smarty::instance();
|
||||
// we got a template resource
|
||||
$_templateId = $this->buildTemplateId ($template, $cache_id, $compile_id);
|
||||
// already in template cache?
|
||||
if (isset($_smarty->template_objects[$_templateId])) {
|
||||
if (isset($this->template_objects[$_templateId])) {
|
||||
// return cached template object
|
||||
return $_smarty->template_objects[$_templateId];
|
||||
return $this->template_objects[$_templateId];
|
||||
} else {
|
||||
// create and cache new template object
|
||||
return new Smarty_Internal_Template ($template, $parent, $cache_id, $compile_id);
|
||||
return new Smarty_Internal_Template ($template, $this, $parent, $cache_id, $compile_id);
|
||||
}
|
||||
} else {
|
||||
// just return a copy of template class
|
||||
@@ -336,7 +335,7 @@ class Smarty_Internal_TemplateBase {
|
||||
* @param mixed $_compile_id compile id to be used with this template
|
||||
* @returns string a unique template id
|
||||
*/
|
||||
public function buildTemplateId ($_resource, $_cache_id, $_compile_id)
|
||||
function buildTemplateId ($_resource, $_cache_id, $_compile_id)
|
||||
{
|
||||
// return md5($_resource . md5($_cache_id) . md5($_compile_id));
|
||||
return crc32($_resource . $_cache_id . $_compile_id);
|
||||
|
@@ -11,7 +11,7 @@
|
||||
/**
|
||||
* Main compiler class
|
||||
*/
|
||||
class Smarty_Internal_TemplateCompilerBase extends Smarty_Internal_Base {
|
||||
class Smarty_Internal_TemplateCompilerBase {
|
||||
// compile tag objects
|
||||
static $_tag_objects = array();
|
||||
// tag stack
|
||||
@@ -24,7 +24,6 @@ class Smarty_Internal_TemplateCompilerBase extends Smarty_Internal_Base {
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
// get required plugins
|
||||
if (!is_object($this->smarty->filter_handler) && (isset($this->smarty->autoload_filters['pre']) || isset($this->smarty->registered_filters['pre']) || isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post']))) {
|
||||
$this->smarty->loadPlugin('Smarty_Internal_Run_Filter');
|
||||
@@ -45,7 +44,7 @@ class Smarty_Internal_TemplateCompilerBase extends Smarty_Internal_Base {
|
||||
then written to compiled files. */
|
||||
if (!is_object($template->cacher_object)) {
|
||||
$this->smarty->loadPlugin($template->cacher_class);
|
||||
$template->cacher_object = new $template->cacher_class;
|
||||
$template->cacher_object = new $template->cacher_class($this->smarty);
|
||||
}
|
||||
// flag for nochache sections
|
||||
$this->nocache = false;
|
||||
|
@@ -71,14 +71,14 @@ class Smarty_Internal_Templatelexer
|
||||
);
|
||||
|
||||
|
||||
function __construct($data)
|
||||
function __construct($data,$smarty)
|
||||
{
|
||||
// set instance object
|
||||
self::instance($this);
|
||||
$this->data = $data;
|
||||
$this->counter = 0;
|
||||
$this->line = 1;
|
||||
$this->smarty = Smarty::instance();
|
||||
$this->smarty = $smarty;
|
||||
$this->ldel = preg_quote($this->smarty->left_delimiter);
|
||||
$this->rdel = preg_quote($this->smarty->right_delimiter);
|
||||
}
|
||||
|
@@ -120,8 +120,8 @@ class Smarty_Internal_Templateparser#line 109 "internal.templateparser.php"
|
||||
// set instance object
|
||||
self::instance($this);
|
||||
$this->lex = $lex;
|
||||
$this->smarty = Smarty::instance();
|
||||
$this->compiler = $compiler;
|
||||
$this->smarty = $this->compiler->smarty;
|
||||
$this->template = $this->compiler->template;
|
||||
$this->cacher = $this->template->cacher_object;
|
||||
$this->nocache = false;
|
||||
@@ -2059,102 +2059,102 @@ static public $yy_action = array(
|
||||
#line 277 "internal.templateparser.y"
|
||||
function yy_r54(){ $this->_retvalue = "''"; }
|
||||
#line 2066 "internal.templateparser.php"
|
||||
#line 280 "internal.templateparser.y"
|
||||
#line 279 "internal.templateparser.y"
|
||||
function yy_r55(){ $this->_retvalue = '"'.$this->yystack[$this->yyidx + -1]->minor.'"'; }
|
||||
#line 2069 "internal.templateparser.php"
|
||||
#line 284 "internal.templateparser.y"
|
||||
#line 283 "internal.templateparser.y"
|
||||
function yy_r57(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'::'.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2072 "internal.templateparser.php"
|
||||
#line 285 "internal.templateparser.y"
|
||||
#line 284 "internal.templateparser.y"
|
||||
function yy_r58(){ $this->prefix_number++; $this->prefix_code[] = '<?php $_tmp'.$this->prefix_number.'=$_smarty_tpl->getVariable(\''. $this->yystack[$this->yyidx + -3]->minor .'\')->value;?>'; $this->_retvalue = $this->yystack[$this->yyidx + -6]->minor.'::$_tmp'.$this->prefix_number.'('. $this->yystack[$this->yyidx + -1]->minor .')'; }
|
||||
#line 2075 "internal.templateparser.php"
|
||||
#line 287 "internal.templateparser.y"
|
||||
#line 286 "internal.templateparser.y"
|
||||
function yy_r59(){ $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor.'::'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2078 "internal.templateparser.php"
|
||||
#line 288 "internal.templateparser.y"
|
||||
#line 287 "internal.templateparser.y"
|
||||
function yy_r60(){ $this->prefix_number++; $this->prefix_code[] = '<?php $_tmp'.$this->prefix_number.'=$_smarty_tpl->getVariable(\''. $this->yystack[$this->yyidx + -4]->minor .'\')->value;?>'; $this->_retvalue = $this->yystack[$this->yyidx + -7]->minor.'::$_tmp'.$this->prefix_number.'('. $this->yystack[$this->yyidx + -2]->minor .')'.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2081 "internal.templateparser.php"
|
||||
#line 290 "internal.templateparser.y"
|
||||
#line 289 "internal.templateparser.y"
|
||||
function yy_r61(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'::'.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2084 "internal.templateparser.php"
|
||||
#line 292 "internal.templateparser.y"
|
||||
#line 291 "internal.templateparser.y"
|
||||
function yy_r62(){ $this->_retvalue = $this->yystack[$this->yyidx + -4]->minor.'::$'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2087 "internal.templateparser.php"
|
||||
#line 294 "internal.templateparser.y"
|
||||
#line 293 "internal.templateparser.y"
|
||||
function yy_r63(){ $this->_retvalue = $this->yystack[$this->yyidx + -5]->minor.'::$'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2090 "internal.templateparser.php"
|
||||
#line 301 "internal.templateparser.y"
|
||||
#line 300 "internal.templateparser.y"
|
||||
function yy_r64(){if ($this->yystack[$this->yyidx + 0]->minor['var'] == '\'smarty\'') { $this->_retvalue = $this->compiler->compileTag('internal_smarty_var',$this->yystack[$this->yyidx + 0]->minor['index']);} else {
|
||||
$this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + 0]->minor['var'] .')->value'.$this->yystack[$this->yyidx + 0]->minor['index']; $this->nocache=$this->template->getVariable(trim($this->yystack[$this->yyidx + 0]->minor['var'],"'"))->nocache;} }
|
||||
#line 2094 "internal.templateparser.php"
|
||||
#line 304 "internal.templateparser.y"
|
||||
#line 303 "internal.templateparser.y"
|
||||
function yy_r65(){ $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -2]->minor .')->'.$this->yystack[$this->yyidx + 0]->minor; $this->nocache=$this->template->getVariable(trim($this->yystack[$this->yyidx + -2]->minor,"'"))->nocache; }
|
||||
#line 2097 "internal.templateparser.php"
|
||||
#line 308 "internal.templateparser.y"
|
||||
#line 307 "internal.templateparser.y"
|
||||
function yy_r67(){$this->_retvalue = '$_smarty_tpl->getConfigVariable(\''. $this->yystack[$this->yyidx + -1]->minor .'\')'; }
|
||||
#line 2100 "internal.templateparser.php"
|
||||
#line 309 "internal.templateparser.y"
|
||||
#line 308 "internal.templateparser.y"
|
||||
function yy_r68(){$this->_retvalue = '$_smarty_tpl->getConfigVariable('. $this->yystack[$this->yyidx + -1]->minor .')'; }
|
||||
#line 2103 "internal.templateparser.php"
|
||||
#line 312 "internal.templateparser.y"
|
||||
#line 311 "internal.templateparser.y"
|
||||
function yy_r69(){$this->_retvalue = array('var'=>$this->yystack[$this->yyidx + -1]->minor, 'index'=>$this->yystack[$this->yyidx + 0]->minor); }
|
||||
#line 2106 "internal.templateparser.php"
|
||||
#line 320 "internal.templateparser.y"
|
||||
#line 319 "internal.templateparser.y"
|
||||
function yy_r71(){return; }
|
||||
#line 2109 "internal.templateparser.php"
|
||||
#line 324 "internal.templateparser.y"
|
||||
#line 323 "internal.templateparser.y"
|
||||
function yy_r72(){ $this->_retvalue = "['". $this->yystack[$this->yyidx + 0]->minor ."']"; }
|
||||
#line 2112 "internal.templateparser.php"
|
||||
#line 325 "internal.templateparser.y"
|
||||
#line 324 "internal.templateparser.y"
|
||||
function yy_r73(){ $this->_retvalue = "[". $this->yystack[$this->yyidx + 0]->minor ."]"; }
|
||||
#line 2115 "internal.templateparser.php"
|
||||
#line 326 "internal.templateparser.y"
|
||||
#line 325 "internal.templateparser.y"
|
||||
function yy_r74(){ $this->_retvalue = "[".$this->yystack[$this->yyidx + 0]->minor."]"; }
|
||||
#line 2118 "internal.templateparser.php"
|
||||
#line 327 "internal.templateparser.y"
|
||||
#line 326 "internal.templateparser.y"
|
||||
function yy_r75(){ $this->_retvalue = "[". $this->yystack[$this->yyidx + -1]->minor ."]"; }
|
||||
#line 2121 "internal.templateparser.php"
|
||||
#line 329 "internal.templateparser.y"
|
||||
#line 328 "internal.templateparser.y"
|
||||
function yy_r76(){ $this->_retvalue = '['.$this->compiler->compileTag('internal_smarty_var','[\'section\'][\''.$this->yystack[$this->yyidx + -1]->minor.'\'][\'index\']').']'; }
|
||||
#line 2124 "internal.templateparser.php"
|
||||
#line 333 "internal.templateparser.y"
|
||||
#line 332 "internal.templateparser.y"
|
||||
function yy_r78(){$this->_retvalue = ''; }
|
||||
#line 2127 "internal.templateparser.php"
|
||||
#line 341 "internal.templateparser.y"
|
||||
#line 340 "internal.templateparser.y"
|
||||
function yy_r80(){$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.'.'.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2130 "internal.templateparser.php"
|
||||
#line 343 "internal.templateparser.y"
|
||||
#line 342 "internal.templateparser.y"
|
||||
function yy_r81(){$this->_retvalue = '\''.$this->yystack[$this->yyidx + 0]->minor.'\''; }
|
||||
#line 2133 "internal.templateparser.php"
|
||||
#line 345 "internal.templateparser.y"
|
||||
#line 344 "internal.templateparser.y"
|
||||
function yy_r82(){$this->_retvalue = '('.$this->yystack[$this->yyidx + -1]->minor.')'; }
|
||||
#line 2136 "internal.templateparser.php"
|
||||
#line 350 "internal.templateparser.y"
|
||||
#line 349 "internal.templateparser.y"
|
||||
function yy_r83(){ if ($this->yystack[$this->yyidx + -1]->minor['var'] == '\'smarty\'') { $this->_retvalue = $this->compiler->compileTag('internal_smarty_var',$this->yystack[$this->yyidx + -1]->minor['index']).$this->yystack[$this->yyidx + 0]->minor;} else {
|
||||
$this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -1]->minor['var'] .')->value'.$this->yystack[$this->yyidx + -1]->minor['index'].$this->yystack[$this->yyidx + 0]->minor; $this->nocache=$this->template->getVariable(trim($this->yystack[$this->yyidx + -1]->minor['var'],"'"))->nocache;} }
|
||||
#line 2140 "internal.templateparser.php"
|
||||
#line 354 "internal.templateparser.y"
|
||||
#line 353 "internal.templateparser.y"
|
||||
function yy_r84(){$this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2143 "internal.templateparser.php"
|
||||
#line 356 "internal.templateparser.y"
|
||||
#line 355 "internal.templateparser.y"
|
||||
function yy_r85(){$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2146 "internal.templateparser.php"
|
||||
#line 358 "internal.templateparser.y"
|
||||
#line 357 "internal.templateparser.y"
|
||||
function yy_r86(){ $this->_retvalue = '->'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2149 "internal.templateparser.php"
|
||||
#line 359 "internal.templateparser.y"
|
||||
#line 358 "internal.templateparser.y"
|
||||
function yy_r87(){ $this->_retvalue = '->{'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor.'}'; }
|
||||
#line 2152 "internal.templateparser.php"
|
||||
#line 360 "internal.templateparser.y"
|
||||
#line 359 "internal.templateparser.y"
|
||||
function yy_r88(){ $this->_retvalue = '->{'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}'; }
|
||||
#line 2155 "internal.templateparser.php"
|
||||
#line 361 "internal.templateparser.y"
|
||||
#line 360 "internal.templateparser.y"
|
||||
function yy_r89(){ $this->_retvalue = '->{\''.$this->yystack[$this->yyidx + -4]->minor.'\'.'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}'; }
|
||||
#line 2158 "internal.templateparser.php"
|
||||
#line 363 "internal.templateparser.y"
|
||||
#line 362 "internal.templateparser.y"
|
||||
function yy_r90(){ $this->_retvalue = '->'.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2161 "internal.templateparser.php"
|
||||
#line 369 "internal.templateparser.y"
|
||||
#line 368 "internal.templateparser.y"
|
||||
function yy_r91(){if (!$this->template->security || $this->smarty->security_handler->isTrustedPhpFunction($this->yystack[$this->yyidx + -3]->minor, $this->compiler)) {
|
||||
if ($this->yystack[$this->yyidx + -3]->minor == 'isset' || $this->yystack[$this->yyidx + -3]->minor == 'empty' || $this->yystack[$this->yyidx + -3]->minor == 'array' || is_callable($this->yystack[$this->yyidx + -3]->minor)) {
|
||||
$this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . "(". $this->yystack[$this->yyidx + -1]->minor .")";
|
||||
@@ -2163,127 +2163,127 @@ static public $yy_action = array(
|
||||
}
|
||||
} }
|
||||
#line 2170 "internal.templateparser.php"
|
||||
#line 380 "internal.templateparser.y"
|
||||
#line 379 "internal.templateparser.y"
|
||||
function yy_r92(){ $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . "(". $this->yystack[$this->yyidx + -1]->minor .")"; }
|
||||
#line 2173 "internal.templateparser.php"
|
||||
#line 384 "internal.templateparser.y"
|
||||
#line 383 "internal.templateparser.y"
|
||||
function yy_r93(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.",".$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2176 "internal.templateparser.php"
|
||||
#line 388 "internal.templateparser.y"
|
||||
#line 387 "internal.templateparser.y"
|
||||
function yy_r95(){ return; }
|
||||
#line 2179 "internal.templateparser.php"
|
||||
#line 393 "internal.templateparser.y"
|
||||
#line 392 "internal.templateparser.y"
|
||||
function yy_r96(){ $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor,true); }
|
||||
#line 2182 "internal.templateparser.php"
|
||||
#line 394 "internal.templateparser.y"
|
||||
#line 393 "internal.templateparser.y"
|
||||
function yy_r97(){ $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor,false); }
|
||||
#line 2185 "internal.templateparser.php"
|
||||
#line 401 "internal.templateparser.y"
|
||||
#line 400 "internal.templateparser.y"
|
||||
function yy_r98(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2188 "internal.templateparser.php"
|
||||
#line 405 "internal.templateparser.y"
|
||||
#line 404 "internal.templateparser.y"
|
||||
function yy_r100(){$this->_retvalue = ','.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2191 "internal.templateparser.php"
|
||||
#line 406 "internal.templateparser.y"
|
||||
#line 405 "internal.templateparser.y"
|
||||
function yy_r101(){$this->_retvalue = ',\''.$this->yystack[$this->yyidx + 0]->minor.'\''; }
|
||||
#line 2194 "internal.templateparser.php"
|
||||
#line 413 "internal.templateparser.y"
|
||||
#line 412 "internal.templateparser.y"
|
||||
function yy_r103(){$this->_retvalue = '!'.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2197 "internal.templateparser.php"
|
||||
#line 418 "internal.templateparser.y"
|
||||
#line 417 "internal.templateparser.y"
|
||||
function yy_r105(){$this->_retvalue =$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2200 "internal.templateparser.php"
|
||||
#line 419 "internal.templateparser.y"
|
||||
#line 418 "internal.templateparser.y"
|
||||
function yy_r106(){$this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2203 "internal.templateparser.php"
|
||||
#line 420 "internal.templateparser.y"
|
||||
#line 419 "internal.templateparser.y"
|
||||
function yy_r107(){$this->_retvalue = 'in_array('.$this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor.')'; }
|
||||
#line 2206 "internal.templateparser.php"
|
||||
#line 421 "internal.templateparser.y"
|
||||
#line 420 "internal.templateparser.y"
|
||||
function yy_r108(){$this->_retvalue = 'in_array('.$this->yystack[$this->yyidx + -2]->minor.',(array)'.$this->yystack[$this->yyidx + 0]->minor.')'; }
|
||||
#line 2209 "internal.templateparser.php"
|
||||
#line 423 "internal.templateparser.y"
|
||||
#line 422 "internal.templateparser.y"
|
||||
function yy_r110(){$this->_retvalue = '!('.$this->yystack[$this->yyidx + -2]->minor.' % '.$this->yystack[$this->yyidx + 0]->minor.')'; }
|
||||
#line 2212 "internal.templateparser.php"
|
||||
#line 424 "internal.templateparser.y"
|
||||
#line 423 "internal.templateparser.y"
|
||||
function yy_r111(){$this->_retvalue = '('.$this->yystack[$this->yyidx + -2]->minor.' % '.$this->yystack[$this->yyidx + 0]->minor.')'; }
|
||||
#line 2215 "internal.templateparser.php"
|
||||
#line 425 "internal.templateparser.y"
|
||||
#line 424 "internal.templateparser.y"
|
||||
function yy_r112(){$this->_retvalue = '!(1 & '.$this->yystack[$this->yyidx + -1]->minor.')'; }
|
||||
#line 2218 "internal.templateparser.php"
|
||||
#line 426 "internal.templateparser.y"
|
||||
#line 425 "internal.templateparser.y"
|
||||
function yy_r113(){$this->_retvalue = '(1 & '.$this->yystack[$this->yyidx + -1]->minor.')'; }
|
||||
#line 2221 "internal.templateparser.php"
|
||||
#line 427 "internal.templateparser.y"
|
||||
#line 426 "internal.templateparser.y"
|
||||
function yy_r114(){$this->_retvalue = '!(1 & '.$this->yystack[$this->yyidx + -2]->minor.' / '.$this->yystack[$this->yyidx + 0]->minor.')'; }
|
||||
#line 2224 "internal.templateparser.php"
|
||||
#line 428 "internal.templateparser.y"
|
||||
#line 427 "internal.templateparser.y"
|
||||
function yy_r115(){$this->_retvalue = '(1 & '.$this->yystack[$this->yyidx + -2]->minor.' / '.$this->yystack[$this->yyidx + 0]->minor.')'; }
|
||||
#line 2227 "internal.templateparser.php"
|
||||
#line 434 "internal.templateparser.y"
|
||||
#line 433 "internal.templateparser.y"
|
||||
function yy_r120(){$this->_retvalue = '=='; }
|
||||
#line 2230 "internal.templateparser.php"
|
||||
#line 435 "internal.templateparser.y"
|
||||
#line 434 "internal.templateparser.y"
|
||||
function yy_r121(){$this->_retvalue = '!='; }
|
||||
#line 2233 "internal.templateparser.php"
|
||||
#line 436 "internal.templateparser.y"
|
||||
#line 435 "internal.templateparser.y"
|
||||
function yy_r122(){$this->_retvalue = '>'; }
|
||||
#line 2236 "internal.templateparser.php"
|
||||
#line 437 "internal.templateparser.y"
|
||||
#line 436 "internal.templateparser.y"
|
||||
function yy_r123(){$this->_retvalue = '<'; }
|
||||
#line 2239 "internal.templateparser.php"
|
||||
#line 438 "internal.templateparser.y"
|
||||
#line 437 "internal.templateparser.y"
|
||||
function yy_r124(){$this->_retvalue = '>='; }
|
||||
#line 2242 "internal.templateparser.php"
|
||||
#line 439 "internal.templateparser.y"
|
||||
#line 438 "internal.templateparser.y"
|
||||
function yy_r125(){$this->_retvalue = '<='; }
|
||||
#line 2245 "internal.templateparser.php"
|
||||
#line 440 "internal.templateparser.y"
|
||||
#line 439 "internal.templateparser.y"
|
||||
function yy_r126(){$this->_retvalue = '==='; }
|
||||
#line 2248 "internal.templateparser.php"
|
||||
#line 441 "internal.templateparser.y"
|
||||
#line 440 "internal.templateparser.y"
|
||||
function yy_r127(){$this->_retvalue = '!=='; }
|
||||
#line 2251 "internal.templateparser.php"
|
||||
#line 443 "internal.templateparser.y"
|
||||
#line 442 "internal.templateparser.y"
|
||||
function yy_r128(){$this->_retvalue = '&&'; }
|
||||
#line 2254 "internal.templateparser.php"
|
||||
#line 444 "internal.templateparser.y"
|
||||
#line 443 "internal.templateparser.y"
|
||||
function yy_r129(){$this->_retvalue = '||'; }
|
||||
#line 2257 "internal.templateparser.php"
|
||||
#line 449 "internal.templateparser.y"
|
||||
#line 448 "internal.templateparser.y"
|
||||
function yy_r130(){ $this->_retvalue = 'array('.$this->yystack[$this->yyidx + -1]->minor.')'; }
|
||||
#line 2260 "internal.templateparser.php"
|
||||
#line 451 "internal.templateparser.y"
|
||||
#line 450 "internal.templateparser.y"
|
||||
function yy_r132(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2263 "internal.templateparser.php"
|
||||
#line 452 "internal.templateparser.y"
|
||||
#line 451 "internal.templateparser.y"
|
||||
function yy_r133(){ return; }
|
||||
#line 2266 "internal.templateparser.php"
|
||||
#line 454 "internal.templateparser.y"
|
||||
#line 453 "internal.templateparser.y"
|
||||
function yy_r135(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'=>'.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2269 "internal.templateparser.php"
|
||||
#line 455 "internal.templateparser.y"
|
||||
#line 454 "internal.templateparser.y"
|
||||
function yy_r136(){ $this->_retvalue = '\''.$this->yystack[$this->yyidx + -2]->minor.'\'=>'.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2272 "internal.templateparser.php"
|
||||
#line 462 "internal.templateparser.y"
|
||||
#line 461 "internal.templateparser.y"
|
||||
function yy_r139(){$this->_retvalue = "`".$this->yystack[$this->yyidx + -1]->minor."`"; }
|
||||
#line 2275 "internal.templateparser.php"
|
||||
#line 463 "internal.templateparser.y"
|
||||
function yy_r140(){$this->_retvalue = "'.".$this->yystack[$this->yyidx + -1]->minor.".'"; }
|
||||
#line 462 "internal.templateparser.y"
|
||||
function yy_r140(){$this->_retvalue = '".'.$this->yystack[$this->yyidx + -1]->minor.'."'; }
|
||||
#line 2278 "internal.templateparser.php"
|
||||
#line 464 "internal.templateparser.y"
|
||||
function yy_r141(){$this->_retvalue = "'.".'$_smarty_tpl->getVariable(\''. $this->yystack[$this->yyidx + 0]->minor .'\')->value'.".'"; $this->nocache=$this->template->getVariable(trim($this->yystack[$this->yyidx + 0]->minor,"'"))->nocache; }
|
||||
#line 463 "internal.templateparser.y"
|
||||
function yy_r141(){$this->_retvalue = '".'.'$_smarty_tpl->getVariable(\''. $this->yystack[$this->yyidx + 0]->minor .'\')->value'.'."'; $this->nocache=$this->template->getVariable(trim($this->yystack[$this->yyidx + 0]->minor,"'"))->nocache; }
|
||||
#line 2281 "internal.templateparser.php"
|
||||
#line 465 "internal.templateparser.y"
|
||||
function yy_r142(){$this->_retvalue = "'.(".$this->yystack[$this->yyidx + -1]->minor.").'"; }
|
||||
#line 464 "internal.templateparser.y"
|
||||
function yy_r142(){$this->_retvalue = '".('.$this->yystack[$this->yyidx + -1]->minor.')."'; }
|
||||
#line 2284 "internal.templateparser.php"
|
||||
#line 470 "internal.templateparser.y"
|
||||
#line 465 "internal.templateparser.y"
|
||||
function yy_r143(){$this->_retvalue = '$'.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2287 "internal.templateparser.php"
|
||||
#line 471 "internal.templateparser.y"
|
||||
#line 466 "internal.templateparser.y"
|
||||
function yy_r144(){$this->_retvalue = '{'.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2290 "internal.templateparser.php"
|
||||
#line 472 "internal.templateparser.y"
|
||||
#line 467 "internal.templateparser.y"
|
||||
function yy_r145(){$this->_retvalue = '`'.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 2293 "internal.templateparser.php"
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
/**
|
||||
* Smarty Internal Write File Class
|
||||
*/
|
||||
class Smarty_Internal_Write_File extends Smarty_Internal_Base {
|
||||
class Smarty_Internal_Write_File {
|
||||
/**
|
||||
* Writes file in a save way to disk
|
||||
*
|
||||
|
@@ -11,24 +11,17 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class addPluginsDir
|
||||
*
|
||||
* Adds directory of plugin files
|
||||
*
|
||||
* @param object $smarty
|
||||
* @param string $ |array $ plugins folder
|
||||
* @return
|
||||
*/
|
||||
|
||||
class Smarty_Method_AddPluginsDir extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Adds directory of plugin files
|
||||
*
|
||||
* @param string|array $ plugins folder
|
||||
* @return
|
||||
*/
|
||||
public function execute($plugins_dir)
|
||||
{
|
||||
$this->smarty->plugins_dir = array_merge((array)$this->smarty->plugins_dir, (array)$plugins_dir);
|
||||
$this->smarty->plugins_dir = array_unique($this->smarty->plugins_dir);
|
||||
return;
|
||||
}
|
||||
function AddPluginsDir($smarty, $plugins_dir)
|
||||
{
|
||||
$smarty->plugins_dir = array_merge((array)$smarty->plugins_dir, (array)$plugins_dir);
|
||||
$smarty->plugins_dir = array_unique($smarty->plugins_dir);
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,25 +11,19 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Clear_All_Assign
|
||||
* Delete Smarty variables
|
||||
*
|
||||
* Delete Smarty variables at current level
|
||||
* @param object $smarty
|
||||
* @param object $data_object object which holds tpl_vars
|
||||
*/
|
||||
|
||||
class Smarty_Method_Clear_All_Assign extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Delete Smarty variables
|
||||
* @param object $data_object object which holds tpl_vars
|
||||
*/
|
||||
public function execute($data_object = null)
|
||||
{
|
||||
if (isset($data_object)) {
|
||||
$ptr = $data_object;
|
||||
} else {
|
||||
$ptr = $this->smarty;
|
||||
}
|
||||
$ptr->tpl_vars = array();
|
||||
function clear_all_assign($smarty, $data_object = null)
|
||||
{
|
||||
if (isset($data_object)) {
|
||||
$ptr = $data_object;
|
||||
} else {
|
||||
$ptr = $smarty;
|
||||
}
|
||||
$ptr->tpl_vars = array();
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,31 +11,25 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Clear_All_Cache
|
||||
* Empty cache folder
|
||||
*
|
||||
* Empties the cache folder
|
||||
* @param object $smarty
|
||||
* @param integer $exp_time expiration time
|
||||
* @param string $type resource type
|
||||
* @return integer number of cache files deleted
|
||||
*/
|
||||
|
||||
class Smarty_Method_Clear_All_Cache extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Empty cache folder
|
||||
*
|
||||
* @param integer $exp_time expiration time
|
||||
* @param string $type resource type
|
||||
* @return integer number of cache files deleted
|
||||
*/
|
||||
public function execute($exp_time = null, $type = 'file')
|
||||
{
|
||||
// load cache resource
|
||||
if (!isset($this->smarty->cache_resource_objects[$type])) {
|
||||
$_cache_resource_class = 'Smarty_Internal_CacheResource_' . $type;
|
||||
if (!$this->smarty->loadPlugin($_cache_resource_class)) {
|
||||
throw new Exception("Undefined cache resource type {$type}");
|
||||
}
|
||||
$this->smarty->cache_resource_objects[$type] = new $_cache_resource_class;
|
||||
function clear_all_cache($smarty, $exp_time = null, $type = 'file')
|
||||
{
|
||||
// load cache resource
|
||||
if (!isset($smarty->cache_resource_objects[$type])) {
|
||||
$_cache_resource_class = 'Smarty_Internal_CacheResource_' . $type;
|
||||
if (!$smarty->loadPlugin($_cache_resource_class)) {
|
||||
throw new Exception("Undefined cache resource type {$type}");
|
||||
}
|
||||
|
||||
return $this->smarty->cache_resource_objects[$type]->clearAll($exp_time);
|
||||
$smarty->cache_resource_objects[$type] = new $_cache_resource_class($smarty);
|
||||
}
|
||||
|
||||
return $smarty->cache_resource_objects[$type]->clearAll($exp_time);
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,34 +11,27 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Clear_Assign
|
||||
* Delete a Smarty variable or array of variables
|
||||
*
|
||||
* Delete a Smarty variable or array of variables at current and outer levels
|
||||
* @param object $smarty
|
||||
* @param string $ |array $varname variable name or array of variable names
|
||||
* @param object $data_object object which holds tpl_vars
|
||||
*/
|
||||
|
||||
class Smarty_Method_Clear_Assign extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Delete a Smarty variable or array of variables
|
||||
*
|
||||
* @param string|array $varname variable name or array of variable names
|
||||
* @param object $data_object object which holds tpl_vars
|
||||
*/
|
||||
public function execute($varname, $data_object = null)
|
||||
{
|
||||
foreach ((array)$varname as $variable) {
|
||||
if (isset($data_object)) {
|
||||
$ptr = $data_object;
|
||||
} else {
|
||||
$ptr = $this->smarty;
|
||||
} while ($ptr != null) {
|
||||
if (isset($ptr->tpl_vars[$variable])) {
|
||||
unset($ptr->tpl_vars[$variable]);
|
||||
}
|
||||
$ptr = $ptr->parent;
|
||||
function clear_assign($smarty, $varname, $data_object = null)
|
||||
{
|
||||
foreach ((array)$varname as $variable) {
|
||||
if (isset($data_object)) {
|
||||
$ptr = $data_object;
|
||||
} else {
|
||||
$ptr = $smarty;
|
||||
} while ($ptr != null) {
|
||||
if (isset($ptr->tpl_vars[$variable])) {
|
||||
unset($ptr->tpl_vars[$variable]);
|
||||
}
|
||||
$ptr = $ptr->parent;
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,34 +11,28 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Clear_Cache
|
||||
* Empty cache for a specific template
|
||||
*
|
||||
* Empties the cache for a specific template
|
||||
* @param object $smarty
|
||||
* @param string $template_name template name
|
||||
* @param string $cache_id cache id
|
||||
* @param string $compile_id compile id
|
||||
* @param integer $exp_time expiration time
|
||||
* @param string $type resource type
|
||||
* @return integer number of cache files deleted
|
||||
*/
|
||||
|
||||
class Smarty_Method_Clear_Cache extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Empty cache for a specific template
|
||||
*
|
||||
* @param string $template_name template name
|
||||
* @param string $cache_id cache id
|
||||
* @param string $compile_id compile id
|
||||
* @param integer $exp_time expiration time
|
||||
* @param string $type resource type
|
||||
* @return integer number of cache files deleted
|
||||
*/
|
||||
public function execute($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = 'file')
|
||||
{
|
||||
// load cache resource
|
||||
if (!isset($this->smarty->cache_resource_objects[$type])) {
|
||||
$_cache_resource_class = 'Smarty_Internal_CacheResource_' . $type;
|
||||
if (!$this->smarty->loadPlugin($_cache_resource_class)) {
|
||||
throw new Exception("Undefined cache resource type {$type}");
|
||||
}
|
||||
$this->smarty->cache_resource_objects[$type] = new $_cache_resource_class;
|
||||
function clear_cache($smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = 'file')
|
||||
{
|
||||
// load cache resource
|
||||
if (!isset($smarty->cache_resource_objects[$type])) {
|
||||
$_cache_resource_class = 'Smarty_Internal_CacheResource_' . $type;
|
||||
if (!$smarty->loadPlugin($_cache_resource_class)) {
|
||||
throw new Exception("Undefined cache resource type {$type}");
|
||||
}
|
||||
|
||||
return $this->smarty->cache_resource_objects[$type]->clear($template_name, $cache_id, $compile_id, $exp_time);
|
||||
$smarty->cache_resource_objects[$type] = new $_cache_resource_class($smarty);
|
||||
}
|
||||
|
||||
return $smarty->cache_resource_objects[$type]->clear($template_name, $cache_id, $compile_id, $exp_time);
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,62 +11,54 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Clear_Compiled_Tpl
|
||||
* Delete compiled template file
|
||||
*
|
||||
* Deletes compiled template files
|
||||
* @param string $resource_name template name
|
||||
* @param string $compile_id compile id
|
||||
* @param integer $exp_time expiration time
|
||||
* @return integer number of template files deleted
|
||||
*/
|
||||
|
||||
class Smarty_Method_Clear_Compiled_Tpl extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Delete compiled template file
|
||||
*
|
||||
* @param string $resource_name template name
|
||||
* @param string $compile_id compile id
|
||||
* @param integer $exp_time expiration time
|
||||
* @return integer number of template files deleted
|
||||
*/
|
||||
public function execute($resource_name = null, $compile_id = null, $exp_time = null)
|
||||
{
|
||||
$_dir_sep = $this->smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
|
||||
if (isset($resource_name)) {
|
||||
$_resource_part_1 = $resource_name . $this->smarty->php_ext;
|
||||
$_resource_part_2 = $resource_name . '.cache' . $this->smarty->php_ext;
|
||||
function clear_compiled_tpl($smarty, $resource_name = null, $compile_id = null, $exp_time = null)
|
||||
{
|
||||
$_dir_sep = $smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
|
||||
if (isset($resource_name)) {
|
||||
$_resource_part_1 = $resource_name . $smarty->php_ext;
|
||||
$_resource_part_2 = $resource_name . '.cache' . $smarty->php_ext;
|
||||
} 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 {
|
||||
$_resource_part = '';
|
||||
}
|
||||
$_dir = $this->smarty->compile_dir;
|
||||
if ($this->smarty->use_sub_dirs && isset($compile_id)) {
|
||||
$_dir .= $compile_id . $_dir_sep;
|
||||
}
|
||||
if (isset($compile_id)) {
|
||||
$_compile_id_part = $this->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) || substr_compare((string)$_file, $_compile_id_part, 0, strlen($_compile_id_part)) == 0) &&
|
||||
(!isset($resource_name) || substr_compare((string)$_file, $_resource_part_1, - strlen($_resource_part_1), strlen($_resource_part_1)) == 0 ||
|
||||
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 {
|
||||
if ((!isset($compile_id) || substr_compare((string)$_file, $_compile_id_part, 0, strlen($_compile_id_part)) == 0) &&
|
||||
(!isset($resource_name) || substr_compare((string)$_file, $_resource_part_1, - strlen($_resource_part_1), strlen($_resource_part_1)) == 0 ||
|
||||
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;
|
||||
}
|
||||
return $_count;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,26 +11,19 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Clear_Config
|
||||
* Deassigns a single or all global config variables
|
||||
*
|
||||
* Deassigns a single or all global config variables
|
||||
* @param object $smarty
|
||||
* @param string $varname variable name or null
|
||||
*/
|
||||
|
||||
class Smarty_Method_Clear_Config extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Deassigns a single or all global config variables
|
||||
*
|
||||
* @param string $varname variable name or null
|
||||
*/
|
||||
public function execute($varname = null)
|
||||
{
|
||||
if (isset($varname)) {
|
||||
unset($this->smarty->config_vars[$varname]);
|
||||
return;
|
||||
} else {
|
||||
$this->smarty->config_vars = array();
|
||||
return;
|
||||
}
|
||||
function clear_config($smarty, $varname = null)
|
||||
{
|
||||
if (isset($varname)) {
|
||||
unset($smarty->config_vars[$varname]);
|
||||
return;
|
||||
} else {
|
||||
$smarty->config_vars = array();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -11,25 +11,18 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Config_Load
|
||||
* load a config file optionally load just selected sections
|
||||
*
|
||||
* Load config file
|
||||
* @param object $smarty
|
||||
* @param string $config_file filename
|
||||
* @param mixed $sections array of section names, single section or null
|
||||
*/
|
||||
|
||||
class Smarty_Method_Config_Load extends Smarty_Internal_Base {
|
||||
/**
|
||||
* load a config file optionally load just selected sections
|
||||
*
|
||||
* @param string $config_file filename
|
||||
* @param mixed $sections array of section names, single section or null
|
||||
*/
|
||||
function execute($config_file, $sections = null)
|
||||
{
|
||||
// load Config class
|
||||
$this->smarty->loadPlugin('Smarty_Internal_Config');
|
||||
$config = new Smarty_Internal_Config($config_file);
|
||||
$config->loadConfigVars($sections, $this->smarty);
|
||||
}
|
||||
function config_load($smarty, $config_file, $sections = null)
|
||||
{
|
||||
// load Config class
|
||||
$smarty->loadPlugin('Smarty_Internal_Config');
|
||||
$config = new Smarty_Internal_Config($config_file, $smarty);
|
||||
$config->loadConfigVars($sections, $smarty);
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,13 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class disableCacheModifyCheck
|
||||
*
|
||||
* Disable cache modify check
|
||||
*/
|
||||
class Smarty_Method_disableCacheModifyCheck extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
function disableCacheModifyCheck($smarty)
|
||||
{
|
||||
$this->smarty->cache_modified_check = false;
|
||||
$smarty->cache_modified_check = false;
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class disableCaching
|
||||
*
|
||||
* Disable caching
|
||||
*/
|
||||
class Smarty_Method_DisableCaching extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->caching = false;
|
||||
return;
|
||||
}
|
||||
function DisableCaching()
|
||||
{
|
||||
$this->smarty->caching = false;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,14 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class disableCompileCheck
|
||||
*
|
||||
* Disable compile checking
|
||||
*
|
||||
* @param object $smarty
|
||||
*/
|
||||
class Smarty_Method_DisableCompileCheck extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->compile_check = false;
|
||||
return;
|
||||
}
|
||||
function DisableCompileCheck($smarty)
|
||||
{
|
||||
$smarty->compile_check = false;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class disableConfigBooleanize
|
||||
*
|
||||
* Disable config booleanize mode
|
||||
*/
|
||||
class Smarty_Method_disableConfigBooleanize extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->config_booleanize = false;
|
||||
return;
|
||||
}
|
||||
function disableConfigBooleanize($smarty)
|
||||
{
|
||||
$this->smarty->config_booleanize = false;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class disableConfigOverwrite
|
||||
*
|
||||
* Disable config overwrite mode
|
||||
*/
|
||||
class Smarty_Method_disableConfigOverwrite extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->config_overwrite = false;
|
||||
return ;
|
||||
}
|
||||
function disableConfigOverwrite($smarty)
|
||||
{
|
||||
$smarty->config_overwrite = false;
|
||||
return ;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class disableConfigReadHidden
|
||||
*
|
||||
* Disable config read hidden mode
|
||||
*/
|
||||
class Smarty_Method_disableConfigReadHidden extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->config_read_hidden = false;
|
||||
return;
|
||||
}
|
||||
function disableConfigReadHidden ($smarty)
|
||||
{
|
||||
$this->smarty->config_read_hidden = false;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class disableDebugging
|
||||
*
|
||||
* Disable debugging
|
||||
*/
|
||||
class Smarty_Method_DisableDebugging extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->debugging = false;
|
||||
return;
|
||||
}
|
||||
function disableDebugging($smarty)
|
||||
{
|
||||
$smarty->debugging = false;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class disableDebuggingUrlCtrl
|
||||
*
|
||||
* Disable possibility to Disable debugging by SMARTY_DEBUG attribute
|
||||
*/
|
||||
class Smarty_Method_disableDebuggingUrlCtrl extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
function disableDebuggingUrlCtrl($smarty)
|
||||
{
|
||||
$this->smarty->debugging_ctrl = 'none';
|
||||
$smarty->debugging_ctrl = 'none';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class disableDefaultTimezone
|
||||
*
|
||||
* Disable setting of default timezone
|
||||
*/
|
||||
class Smarty_Method_disableDefaultTimezone extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->set_timezone = false;
|
||||
return;
|
||||
}
|
||||
function disableDefaultTimezone($smarty)
|
||||
{
|
||||
$smarty->set_timezone = false;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class disableForceCompile
|
||||
*
|
||||
* Disable forced compiling
|
||||
*/
|
||||
class Smarty_Method_DisableForceCompile extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->force_compile = false;
|
||||
return;
|
||||
}
|
||||
function disableForceCompile($smarty)
|
||||
{
|
||||
$smarty->force_compile = false;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class disableVariableFilter
|
||||
*
|
||||
* Disable filter on variable output
|
||||
*/
|
||||
class Smarty_Method_disableVariableFilter extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->variable_filter = false;
|
||||
return;
|
||||
}
|
||||
function disableVariableFilter($smarty)
|
||||
{
|
||||
$smarty->variable_filter = false;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class enableCacheModifyCheck
|
||||
*
|
||||
* Enable cache modify check
|
||||
*/
|
||||
class Smarty_Method_enableCacheModifyCheck extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->cache_modified_check = true;
|
||||
return;
|
||||
}
|
||||
function enableCacheModifyCheck($smarty)
|
||||
{
|
||||
$smarty->cache_modified_check = true;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class enableCompileCheck
|
||||
*
|
||||
* Enable compile checking
|
||||
*/
|
||||
class Smarty_Method_EnableCompileCheck extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->compile_check = true;
|
||||
return;
|
||||
}
|
||||
function enableCompileCheck($smarty)
|
||||
{
|
||||
$smarty->compile_check = true;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class enableConfigBooleanize
|
||||
*
|
||||
* Enable config booleanize mode
|
||||
*/
|
||||
class Smarty_Method_enableConfigBooleanize extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->config_booleanize = true;
|
||||
return;
|
||||
}
|
||||
function enableConfigBooleanize($smarty)
|
||||
{
|
||||
$smarty->config_booleanize = true;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class enableConfigOverwrite
|
||||
*
|
||||
* Enable config overwrite mode
|
||||
*/
|
||||
class Smarty_Method_enableConfigOverwrite extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->config_overwrite = true;
|
||||
return;
|
||||
}
|
||||
public function enableConfigOverwrite($smarty)
|
||||
{
|
||||
$smarty->config_overwrite = true;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class enableConfigReadHidden
|
||||
*
|
||||
* Enable config read hidden mode
|
||||
*/
|
||||
class Smarty_Method_enableConfigReadHidden extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->config_read_hidden = true;
|
||||
return;
|
||||
}
|
||||
function enableConfigReadHidden($smarty)
|
||||
{
|
||||
$this->smarty->config_read_hidden = true;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class enableDebugging
|
||||
*
|
||||
* Enable debugging
|
||||
*/
|
||||
class Smarty_Method_EnableDebugging extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->debugging = true;
|
||||
return;
|
||||
}
|
||||
public function enableDebugging($smarty)
|
||||
{
|
||||
$this->smarty->debugging = true;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class enableDebuggingUrlCtrl
|
||||
*
|
||||
* Enable possibility to enable debugging by SMARTY_DEBUG attribute
|
||||
*/
|
||||
class Smarty_Method_EnableDebuggingUrlCtrl extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->debugging_ctrl = 'URL';
|
||||
return;
|
||||
}
|
||||
function enableDebuggingUrlCtrl($smarty)
|
||||
{
|
||||
$smarty->debugging_ctrl = 'URL';
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class enableDefaultTimezone
|
||||
*
|
||||
* Enable setting of default timezone
|
||||
*/
|
||||
class Smarty_Method_enableDefaultTimezone extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->set_timezone = true;
|
||||
return;
|
||||
}
|
||||
function enableDefaultTimezone($smarty)
|
||||
{
|
||||
$this->smarty->set_timezone = true;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class enableForceCompile
|
||||
*
|
||||
* Enable forced compiling
|
||||
*/
|
||||
class Smarty_Method_enableForceCompile extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->force_compile = true;
|
||||
return;
|
||||
}
|
||||
public function enableForceCompile($smarty)
|
||||
{
|
||||
$smarty->force_compile = true;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class enableVariableFilter
|
||||
*
|
||||
* Enable filter on variable output
|
||||
*/
|
||||
class Smarty_Method_enableVariableFilter extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
$this->smarty->variable_filter = true;
|
||||
return;
|
||||
}
|
||||
function enableVariableFilter($smarty)
|
||||
{
|
||||
$smarty->variable_filter = true;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,29 +11,25 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Get_Config_Vars
|
||||
*
|
||||
* Returns a single or all global config variables
|
||||
*/
|
||||
|
||||
class Smarty_Method_Get_Config_Vars extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Returns a single or all global config variables
|
||||
*
|
||||
* @param string $varname variable name or null
|
||||
* @return string variable value or or array of variables
|
||||
*/
|
||||
public function execute($varname = null)
|
||||
{
|
||||
if (isset($varname)) {
|
||||
if (isset($this->smarty->config_vars[$varname])) {
|
||||
return $this->smarty->config_vars[$varname];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
/**
|
||||
* Returns a single or all global config variables
|
||||
*
|
||||
* @param string $varname variable name or null
|
||||
* @return string variable value or or array of variables
|
||||
*/
|
||||
function Get_Config_Vars($smarty, $varname = null)
|
||||
{
|
||||
if (isset($varname)) {
|
||||
if (isset($smarty->config_vars[$varname])) {
|
||||
return $smarty->config_vars[$varname];
|
||||
} else {
|
||||
return $this->smarty->config_vars;
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return $smarty->config_vars;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -11,33 +11,26 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Get_Global
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
class Smarty_Method_Get_Global extends Smarty_Internal_Base {
|
||||
/**
|
||||
* 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 execute($varname = null)
|
||||
{
|
||||
if (isset($varname)) {
|
||||
if (isset($this->smarty->global_tpl_vars[$varname])) {
|
||||
return $this->smarty->global_tpl_vars[$varname]->value;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
function get_global($smarty, $varname = null)
|
||||
{
|
||||
if (isset($varname)) {
|
||||
if (isset($smarty->global_tpl_vars[$varname])) {
|
||||
return $smarty->global_tpl_vars[$varname]->value;
|
||||
} else {
|
||||
$_result = array();
|
||||
foreach ($this->smarty->global_tpl_vars AS $key => $var) {
|
||||
$_result[$key] = $var->value;
|
||||
}
|
||||
return $_result;
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
$_result = array();
|
||||
foreach ($smarty->global_tpl_vars AS $key => $var) {
|
||||
$_result[$key] = $var->value;
|
||||
}
|
||||
return $_result;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -11,27 +11,24 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Get_Registered_Object
|
||||
*
|
||||
* Returns a reference to a registered object
|
||||
*/
|
||||
|
||||
class Smarty_Method_Get_Registered_Object extends Smarty_Internal_Base {
|
||||
/**
|
||||
* return a reference to a registered object
|
||||
*
|
||||
* @param string $name
|
||||
* @return object
|
||||
*/
|
||||
public function execute($name) {
|
||||
if (!isset($this->smarty->registered_objects[$name]))
|
||||
/**
|
||||
* return a reference to a registered object
|
||||
*
|
||||
* @param string $name
|
||||
* @return object
|
||||
*/
|
||||
function get_registered_object($smarty, $name)
|
||||
{
|
||||
if (!isset($smarty->registered_objects[$name]))
|
||||
throw new Exception("'$name' is not a registered object");
|
||||
|
||||
if (!is_object($this->smarty->registered_objects[$name][0]))
|
||||
if (!is_object($smarty->registered_objects[$name][0]))
|
||||
throw new Exception("registered '$name' is not an object");
|
||||
|
||||
return $this->smarty->registered_objects[$name][0];
|
||||
}
|
||||
return $smarty->registered_objects[$name][0];
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,49 +11,45 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Get_Template_Vars
|
||||
*
|
||||
* Returns a single or all template variables
|
||||
*/
|
||||
|
||||
class Smarty_Method_Get_Template_Vars extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Returns a single or all template variables
|
||||
*
|
||||
* @param string $varname variable name or null
|
||||
* @return string variable value or or array of variables
|
||||
*/
|
||||
public function execute($varname = null, $_ptr = null, $search_parents = true)
|
||||
{
|
||||
if (isset($varname)) {
|
||||
$_var = $this->smarty->getVariable($varname, $_ptr, $search_parents);
|
||||
if (is_object($_var)) {
|
||||
return $_var->value;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Returns a single or all template variables
|
||||
*
|
||||
* @param string $varname variable name or null
|
||||
* @return string variable value or or array of variables
|
||||
*/
|
||||
function get_template_vars($smarty, $varname = null, $_ptr = null, $search_parents = true)
|
||||
{
|
||||
if (isset($varname)) {
|
||||
$_var = $smarty->getVariable($varname, $_ptr, $search_parents);
|
||||
if (is_object($_var)) {
|
||||
return $_var->value;
|
||||
} else {
|
||||
$_result = array();
|
||||
if ($_ptr === null) {
|
||||
$_ptr = $this->smarty;
|
||||
} while ($_ptr !== null) {
|
||||
foreach ($_ptr->tpl_vars AS $key => $var) {
|
||||
$_result[$key] = $var->value;
|
||||
}
|
||||
// not found, try at parent
|
||||
if ($search_parents) {
|
||||
$_ptr = $_ptr->parent;
|
||||
} else {
|
||||
$_ptr = null;
|
||||
}
|
||||
}
|
||||
if ($search_parents) {
|
||||
foreach ($this->smarty->global_tpl_vars AS $key => $var) {
|
||||
$_result[$key] = $var->value;
|
||||
}
|
||||
}
|
||||
return $_result;
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
$_result = array();
|
||||
if ($_ptr === null) {
|
||||
$_ptr = $smarty;
|
||||
} while ($_ptr !== null) {
|
||||
foreach ($_ptr->tpl_vars AS $key => $var) {
|
||||
$_result[$key] = $var->value;
|
||||
}
|
||||
// not found, try at parent
|
||||
if ($search_parents) {
|
||||
$_ptr = $_ptr->parent;
|
||||
} else {
|
||||
$_ptr = null;
|
||||
}
|
||||
}
|
||||
if ($search_parents) {
|
||||
foreach ($smarty->global_tpl_vars AS $key => $var) {
|
||||
$_result[$key] = $var->value;
|
||||
}
|
||||
}
|
||||
return $_result;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -11,21 +11,17 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class getCacheDir
|
||||
*
|
||||
* Returns directory of cache files
|
||||
*/
|
||||
|
||||
class Smarty_Method_GetCacheDir extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Returns directory of cache files
|
||||
*
|
||||
* @return array cache folder
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->cache_dir;
|
||||
}
|
||||
/**
|
||||
* Returns directory of cache files
|
||||
*
|
||||
* @return array cache folder
|
||||
*/
|
||||
public function getCacheDir($smarty)
|
||||
{
|
||||
return $this->smarty->cache_dir;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -15,16 +15,14 @@
|
||||
*
|
||||
* Returns lifetime of cache files
|
||||
*/
|
||||
class Smarty_Method_GetCacheLifetime extends Smarty_Internal_Base {
|
||||
/**
|
||||
/**
|
||||
* Returns lifetime of cache files
|
||||
*
|
||||
* @return integer cache file lifetime
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->cache_lifetime;
|
||||
}
|
||||
*
|
||||
* @return integer cache file lifetime
|
||||
*/
|
||||
function getCacheLifetime($smarty)
|
||||
{
|
||||
return $smarty->cache_lifetime;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,21 +11,17 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class getCompileDir
|
||||
*
|
||||
* Returns directory of compiled templates
|
||||
*/
|
||||
|
||||
class Smarty_Method_GetCompileDir extends Smarty_Internal_Base {
|
||||
/**
|
||||
/**
|
||||
* Returns directory of compiled templates
|
||||
*
|
||||
* @return array compiled template folder
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->compile_dir;
|
||||
}
|
||||
*
|
||||
* @return array compiled template folder
|
||||
*/
|
||||
function GetCompileDir($smarty)
|
||||
{
|
||||
return $this->smarty->compile_dir;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,21 +11,17 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class getConfigDir
|
||||
*
|
||||
* Returns directory of config files
|
||||
*/
|
||||
|
||||
class Smarty_Method_GetConfigDir extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Returns directory of config files
|
||||
*
|
||||
* @return array config folder
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->config_dir;
|
||||
}
|
||||
/**
|
||||
* Returns directory of config files
|
||||
*
|
||||
* @return array config folder
|
||||
*/
|
||||
function getConfigDir($smarty)
|
||||
{
|
||||
return $smarty->config_dir;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,21 +11,17 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class getDebugTemplate
|
||||
*
|
||||
* Returns debug template filepath
|
||||
*/
|
||||
|
||||
class Smarty_Method_GetDebugTemplate extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Returns directory of cache files
|
||||
*
|
||||
* @return string debug template filepath
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->debug_tpl;
|
||||
}
|
||||
/**
|
||||
* Returns directory of cache files
|
||||
*
|
||||
* @return string debug template filepath
|
||||
*/
|
||||
function GetDebugTemplate($smarty)
|
||||
{
|
||||
return $smarty->debug_tpl;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,21 +11,17 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class getPluginsDir
|
||||
*
|
||||
* Returns directory of plugins
|
||||
*/
|
||||
|
||||
class Smarty_Method_GetPluginsDir extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Returns directory of plugins
|
||||
*
|
||||
* @return array plugins folder
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->plugins_dir;
|
||||
}
|
||||
/**
|
||||
* Returns directory of plugins
|
||||
*
|
||||
* @return array plugins folder
|
||||
*/
|
||||
function getPluginsDir($smarty)
|
||||
{
|
||||
return $smarty->plugins_dir;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,21 +11,17 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class getTemplate_dir
|
||||
*
|
||||
* Returns template directory
|
||||
*/
|
||||
|
||||
class Smarty_Method_GetTemplateDir extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Returns template directory
|
||||
*
|
||||
* @return array template folders
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->template_dir;
|
||||
}
|
||||
/**
|
||||
* Returns template directory
|
||||
*
|
||||
* @return array template folders
|
||||
*/
|
||||
function getTemplateDir($smarty)
|
||||
{
|
||||
return $smarty->template_dir;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -15,11 +15,9 @@
|
||||
*
|
||||
* get status of filter on variable output
|
||||
*/
|
||||
class Smarty_Method_getVariableFilter extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->variable_filter;
|
||||
}
|
||||
function getVariableFilter($smarty)
|
||||
{
|
||||
return $smarty->variable_filter;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,15 +11,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class isCacheModifyCheck
|
||||
*
|
||||
* is cache modify check
|
||||
*/
|
||||
class Smarty_Method_isCacheModifyCheck extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->cache_modified_check;
|
||||
}
|
||||
function isCacheModifyCheck()
|
||||
{
|
||||
return $smarty->cache_modified_check;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,15 +11,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class isCaching
|
||||
*
|
||||
* is caching
|
||||
*/
|
||||
class Smarty_Method_isCaching extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->caching;
|
||||
}
|
||||
function isCaching($smarty)
|
||||
{
|
||||
return $smarty->caching;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,15 +11,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class isCompileCheck
|
||||
*
|
||||
* is compile checking
|
||||
*/
|
||||
class Smarty_Method_isCompileCheck extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->compile_check;
|
||||
}
|
||||
function isCompileCheck($smarty)
|
||||
{
|
||||
return $smarty->compile_check;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,15 +11,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class isConfigBooleanize
|
||||
*
|
||||
* is config booleanize mode
|
||||
*/
|
||||
class Smarty_Method_isConfigBooleanize extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->config_booleanize;
|
||||
}
|
||||
public function isConfigBooleanize($smarty)
|
||||
{
|
||||
return $smarty->config_booleanize;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,16 +11,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class isConfigOverwrite
|
||||
*
|
||||
* is config overwrite mode
|
||||
*/
|
||||
class Smarty_Method_isConfigOverwrite extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->config_overwrite;
|
||||
|
||||
}
|
||||
function isConfigOverwrite($smarty)
|
||||
{
|
||||
return $smarty->config_overwrite;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,15 +11,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class isConfigReadHidden
|
||||
*
|
||||
* is config read hidden mode
|
||||
*/
|
||||
class Smarty_Method_isConfigReadHidden extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
function isConfigReadHidden($smarty)
|
||||
{
|
||||
return $this->smarty->config_read_hidden;
|
||||
return $smarty->config_read_hidden;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,15 +11,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class isDebugging
|
||||
*
|
||||
* is debugging
|
||||
*/
|
||||
class Smarty_Method_isDebugging extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->debugging;
|
||||
}
|
||||
function isDebugging($smarty)
|
||||
{
|
||||
return $smarty->debugging;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,15 +11,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class isDebuggingUrlCtrl
|
||||
*
|
||||
* is possibility to is debugging by SMARTY_DEBUG attribute
|
||||
*/
|
||||
class Smarty_Method_isDebuggingUrlCtrl extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->debugging_ctrl != 'none';
|
||||
}
|
||||
function isDebuggingUrlCtrl($smarty)
|
||||
{
|
||||
return $smarty->debugging_ctrl != 'none';
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,15 +11,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class isDefaultTimezone
|
||||
*
|
||||
* is setting of default timezone
|
||||
*/
|
||||
class Smarty_Method_isDefaultTimezone extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->set_timezone = false;
|
||||
}
|
||||
function isDefaultTimezone($smarty)
|
||||
{
|
||||
return $smarty->set_timezone = false;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,15 +11,13 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class isForceCompile
|
||||
*
|
||||
* is forced compiling
|
||||
*/
|
||||
class Smarty_Method_isForceCompile extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
function isForceCompile($smarty)
|
||||
{
|
||||
return $this->smarty->force_compile;
|
||||
return $smarty->force_compile;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
@@ -11,33 +11,25 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Load_Filter
|
||||
* load a filter of specified type and name
|
||||
*
|
||||
* Load filter plugin
|
||||
* @param string $type filter type
|
||||
* @param string $name filter name
|
||||
*/
|
||||
|
||||
class Smarty_Method_Load_Filter extends Smarty_Internal_Base {
|
||||
/**
|
||||
* load a filter of specified type and name
|
||||
*
|
||||
* @param string $type filter type
|
||||
* @param string $name filter name
|
||||
*/
|
||||
function execute($type, $name)
|
||||
{
|
||||
$_plugin = "smarty_{$type}filter_{$name}";
|
||||
$_filter_name = $_plugin;
|
||||
if ($this->smarty->loadPlugin($_plugin)) {
|
||||
if (class_exists($_plugin, false)) {
|
||||
$_plugin = array($_plugin, 'execute');
|
||||
}
|
||||
if (is_callable($_plugin)) {
|
||||
$this->smarty->registered_filters[$type][$_filter_name] = $_plugin;
|
||||
return;
|
||||
}
|
||||
function load_filter($smarty, $type, $name)
|
||||
{
|
||||
$_plugin = "smarty_{$type}filter_{$name}";
|
||||
$_filter_name = $_plugin;
|
||||
if ($smarty->loadPlugin($_plugin)) {
|
||||
if (class_exists($_plugin, false)) {
|
||||
$_plugin = array($_plugin, 'execute');
|
||||
}
|
||||
if (is_callable($_plugin)) {
|
||||
$smarty->registered_filters[$type][$_filter_name] = $_plugin;
|
||||
return;
|
||||
}
|
||||
throw new Exception("{$type}filter \"{$name}\" not callable");
|
||||
}
|
||||
throw new Exception("{$type}filter \"{$name}\" not callable");
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,29 +11,25 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Register_Block
|
||||
*
|
||||
* Register a PHP function as Smarty block function plugin
|
||||
*/
|
||||
|
||||
class Smarty_Method_Register_Block extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Registers block function to be used in templates
|
||||
*
|
||||
* @param string $block_tag name of template block
|
||||
* @param string $block_impl PHP function to register
|
||||
* @param boolean $cacheable if true (default) this fuction is cachable
|
||||
*/
|
||||
public function execute($block_tag, $block_impl, $cacheable = true)
|
||||
{
|
||||
if (isset($this->smarty->registered_plugins[$block_tag])) {
|
||||
throw new Exception("Plugin tag \"{$block_tag}\" already registered");
|
||||
} elseif (!is_callable($block_impl)) {
|
||||
throw new Exception("Plugin \"{$block_tag}\" not callable");
|
||||
} else {
|
||||
$this->smarty->registered_plugins[$block_tag] =
|
||||
array('block', $block_impl, $cacheable);
|
||||
}
|
||||
/**
|
||||
* Registers block function to be used in templates
|
||||
*
|
||||
* @param string $block_tag name of template block
|
||||
* @param string $block_impl PHP function to register
|
||||
* @param boolean $cacheable if true (default) this fuction is cachable
|
||||
*/
|
||||
function register_block($smarty, $block_tag, $block_impl, $cacheable = true)
|
||||
{
|
||||
if (isset($smarty->registered_plugins[$block_tag])) {
|
||||
throw new Exception("Plugin tag \"{$block_tag}\" already registered");
|
||||
} elseif (!is_callable($block_impl)) {
|
||||
throw new Exception("Plugin \"{$block_tag}\" not callable");
|
||||
} else {
|
||||
$smarty->registered_plugins[$block_tag] =
|
||||
array('block', $block_impl, $cacheable);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -11,28 +11,24 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Register_Compiler_Function
|
||||
*
|
||||
* Register a PHP function as Smarty compiler function plugin
|
||||
*/
|
||||
|
||||
class Smarty_Method_Register_Compiler_Function extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Registers compiler function
|
||||
*
|
||||
* @param string $compiler_tag of template function
|
||||
* @param string $compiler_impl name of PHP function to register
|
||||
*/
|
||||
public function execute($compiler_tag, $compiler_impl, $cacheable = true)
|
||||
{
|
||||
if (isset($this->smarty->registered_plugins[$compiler_tag])) {
|
||||
throw new Exception("Plugin tag \"{$compiler_tag}\" already registered");
|
||||
} elseif (!is_callable($compiler_impl)) {
|
||||
throw new Exception("Plugin \"{$compiler_tag}\" not callable");
|
||||
} else {
|
||||
$this->smarty->registered_plugins[$compiler_tag] =
|
||||
array('compiler', $compiler_impl, $cacheable);
|
||||
}
|
||||
/**
|
||||
* Registers compiler function
|
||||
*
|
||||
* @param string $compiler_tag of template function
|
||||
* @param string $compiler_impl name of PHP function to register
|
||||
*/
|
||||
function register_compiler_function($smarty, $compiler_tag, $compiler_impl, $cacheable = true)
|
||||
{
|
||||
if (isset($smarty->registered_plugins[$compiler_tag])) {
|
||||
throw new Exception("Plugin tag \"{$compiler_tag}\" already registered");
|
||||
} elseif (!is_callable($compiler_impl)) {
|
||||
throw new Exception("Plugin \"{$compiler_tag}\" not callable");
|
||||
} else {
|
||||
$smarty->registered_plugins[$compiler_tag] =
|
||||
array('compiler', $compiler_impl, $cacheable);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -11,29 +11,23 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Register_Function
|
||||
* Registers custom function to be used in templates
|
||||
*
|
||||
* Register a PHP function as Smarty function plugin
|
||||
* @param object $smarty
|
||||
* @param string $function_tag the name of the template function
|
||||
* @param string $function_impl the name of the PHP function to register
|
||||
* @param boolean $cacheable if true (default) this fuction is cachable
|
||||
*/
|
||||
|
||||
class Smarty_Method_Register_Function extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Registers custom function to be used in templates
|
||||
*
|
||||
* @param string $function_tag the name of the template function
|
||||
* @param string $function_impl the name of the PHP function to register
|
||||
* @param boolean $cacheable if true (default) this fuction is cachable
|
||||
*/
|
||||
public function execute($function_tag, $function_impl, $cacheable = true)
|
||||
{
|
||||
if (isset($this->smarty->registered_plugins[$function_tag])) {
|
||||
throw new Exception("Plugin tag \"{$function_tag}\" already registered");
|
||||
} elseif (!is_callable($function_impl)) {
|
||||
throw new Exception("Plugin \"{$function_tag}\" not callable");
|
||||
} else {
|
||||
$this->smarty->registered_plugins[$function_tag] =
|
||||
array('function', $function_impl, $cacheable);
|
||||
}
|
||||
function register_function($smarty, $function_tag, $function_impl, $cacheable = true)
|
||||
{
|
||||
if (isset($smarty->registered_plugins[$function_tag])) {
|
||||
throw new Exception("Plugin tag \"{$function_tag}\" already registered");
|
||||
} elseif (!is_callable($function_impl)) {
|
||||
throw new Exception("Plugin \"{$function_tag}\" not callable");
|
||||
} else {
|
||||
$smarty->registered_plugins[$function_tag] =
|
||||
array('function', $function_impl, $cacheable);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,29 +11,21 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Register_Modifier
|
||||
* Registers modifier to be used in templates
|
||||
*
|
||||
* Register a PHP function as Smarty modifier plugin
|
||||
* @param object $smarty
|
||||
* @param string $modifier name of template modifier
|
||||
* @param string $modifier_impl name of PHP function to register
|
||||
*/
|
||||
|
||||
class Smarty_Method_Register_Modifier extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Registers modifier to be used in templates
|
||||
*
|
||||
* @param string $modifier name of template modifier
|
||||
* @param string $modifier_impl name of PHP function to register
|
||||
*/
|
||||
public function execute($modifier, $modifier_impl)
|
||||
{
|
||||
if (isset($this->smarty->registered_plugins[$modifier])) {
|
||||
throw new Exception("Plugin \"{$modifier}\" already registered");
|
||||
} elseif (!is_callable($modifier_impl)) {
|
||||
throw new Exception("Plugin \"{$modifier}\" not callable");
|
||||
} else {
|
||||
$this->smarty->registered_plugins[$modifier] =
|
||||
array('modifier', $modifier_impl);
|
||||
}
|
||||
function register_modifier($smarty, $modifier, $modifier_impl)
|
||||
{
|
||||
if (isset($smarty->registered_plugins[$modifier])) {
|
||||
throw new Exception("Plugin \"{$modifier}\" already registered");
|
||||
} elseif (!is_callable($modifier_impl)) {
|
||||
throw new Exception("Plugin \"{$modifier}\" not callable");
|
||||
} else {
|
||||
$smarty->registered_plugins[$modifier] =
|
||||
array('modifier', $modifier_impl);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,43 +11,36 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Register_Object
|
||||
* Registers object to be used in templates
|
||||
*
|
||||
* Register a PHP object
|
||||
* @param object $smarty
|
||||
* @param string $object name of template object
|
||||
* @param object $ &$object_impl the referenced PHP object to register
|
||||
* @param null $ |array $allowed list of allowed methods (empty = all)
|
||||
* @param boolean $smarty_args smarty argument format, else traditional
|
||||
* @param null $ |array $block_functs list of methods that are block format
|
||||
*/
|
||||
|
||||
class Smarty_Method_Register_Object extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Registers object to be used in templates
|
||||
*
|
||||
* @param string $object name of template object
|
||||
* @param object $ &$object_impl the referenced PHP object to register
|
||||
* @param null $ |array $allowed list of allowed methods (empty = all)
|
||||
* @param boolean $smarty_args smarty argument format, else traditional
|
||||
* @param null $ |array $block_functs list of methods that are block format
|
||||
*/
|
||||
public function execute($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
|
||||
{
|
||||
// test if allowed methodes callable
|
||||
if (!empty($allowed)) {
|
||||
foreach ((array)$allowed as $methode) {
|
||||
if (!is_callable(array($object_impl, $methode))) {
|
||||
throw new Exception("Undefined methode '$methode' in registered object");
|
||||
}
|
||||
function register_object($smarty, $object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
|
||||
{
|
||||
// test if allowed methodes callable
|
||||
if (!empty($allowed)) {
|
||||
foreach ((array)$allowed as $methode) {
|
||||
if (!is_callable(array($object_impl, $methode))) {
|
||||
throw new Exception("Undefined methode '$methode' in registered object");
|
||||
}
|
||||
}
|
||||
// test if block methodes callable
|
||||
if (!empty($block_methods)) {
|
||||
foreach ((array)$block_methods as $methode) {
|
||||
if (!is_callable(array($object_impl, $methode))) {
|
||||
throw new Exception("Undefined methode '$methode' in registered object");
|
||||
}
|
||||
}
|
||||
}
|
||||
// register the object
|
||||
$this->smarty->registered_objects[$object] =
|
||||
array($object_impl, (array)$allowed, (boolean)$smarty_args, (array)$block_methods);
|
||||
}
|
||||
// test if block methodes callable
|
||||
if (!empty($block_methods)) {
|
||||
foreach ((array)$block_methods as $methode) {
|
||||
if (!is_callable(array($object_impl, $methode))) {
|
||||
throw new Exception("Undefined methode '$methode' in registered object");
|
||||
}
|
||||
}
|
||||
}
|
||||
// register the object
|
||||
$smarty->registered_objects[$object] =
|
||||
array($object_impl, (array)$allowed, (boolean)$smarty_args, (array)$block_methods);
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,22 +11,16 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Register_Outputfilter
|
||||
* Registers an output filter function to apply
|
||||
* to a template output
|
||||
*
|
||||
* Register a PHP function as outputfilter
|
||||
* @param object $smarty
|
||||
* @param callback $function
|
||||
*/
|
||||
|
||||
class Smarty_Method_Register_Outputfilter extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Registers an output filter function to apply
|
||||
* to a template output
|
||||
*
|
||||
* @param callback $function
|
||||
*/
|
||||
public function execute($function)
|
||||
{
|
||||
$_name = (is_array($function)) ? $function[0] : $function;
|
||||
$this->smarty->registered_filters['output'][$_name] = $function;
|
||||
}
|
||||
function register_outputfilter($smarty, $function)
|
||||
{
|
||||
$_name = (is_array($function)) ? $function[0] : $function;
|
||||
$smarty->registered_filters['output'][$_name] = $function;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,22 +11,16 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Register_Postfilter
|
||||
* Registers a postfilter function to apply
|
||||
* to a compiled template after compilation
|
||||
*
|
||||
* Register a PHP function as postfilter
|
||||
* @param object $smarty
|
||||
* @param callback $function
|
||||
*/
|
||||
|
||||
class Smarty_Method_Register_Postfilter extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Registers a postfilter function to apply
|
||||
* to a compiled template after compilation
|
||||
*
|
||||
* @param callback $function
|
||||
*/
|
||||
public function execute($function)
|
||||
{
|
||||
$_name = (is_array($function)) ? $function[0] : $function;
|
||||
$this->smarty->registered_filters['post'][$_name] = $function;
|
||||
}
|
||||
function register_postfilter($smarty, $function)
|
||||
{
|
||||
$_name = (is_array($function)) ? $function[0] : $function;
|
||||
$smarty->registered_filters['post'][$_name] = $function;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,23 +11,16 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Register_Prefilter
|
||||
* Registers a prefilter function to apply
|
||||
* to a template before compiling
|
||||
*
|
||||
* Register a PHP function as prefilter
|
||||
* @param object $smarty
|
||||
* @param callback $function
|
||||
*/
|
||||
|
||||
class Smarty_Method_Register_Prefilter extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Registers a prefilter function to apply
|
||||
* to a template before compiling
|
||||
*
|
||||
* @param callback $function
|
||||
*/
|
||||
public function execute($function)
|
||||
{
|
||||
$_name = (is_array($function)) ? $function[0] : $function;
|
||||
$this->smarty->registered_filters['pre'][$_name] = $function;
|
||||
}
|
||||
function register_prefilter($smarty, $function)
|
||||
{
|
||||
$_name = (is_array($function)) ? $function[0] : $function;
|
||||
$smarty->registered_filters['pre'][$_name] = $function;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,29 +11,22 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Register_Resource
|
||||
* Registers a resource to fetch a template
|
||||
*
|
||||
* Register a a Smarty template resource
|
||||
* @param object $smarty
|
||||
* @param string $type name of resource
|
||||
* @param array $functions array of functions to handle resource
|
||||
*/
|
||||
|
||||
class Smarty_Method_Register_Resource extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Registers a resource to fetch a template
|
||||
*
|
||||
* @param string $type name of resource
|
||||
* @param array $functions array of functions to handle resource
|
||||
*/
|
||||
public function execute($type, $functions)
|
||||
{
|
||||
if (count($functions) == 4) {
|
||||
$this->_plugins['resource'][$type] =
|
||||
array($functions, false);
|
||||
} elseif (count($functions) == 5) {
|
||||
$this->smarty->plugins['resource'][$type] =
|
||||
array(array(array(&$functions[0], $functions[1]) , array(&$functions[0], $functions[2]) , array(&$functions[0], $functions[3]) , array(&$functions[0], $functions[4])) , false);
|
||||
} else {
|
||||
throw new Exception("malformed function-list for '$type' in register_resource");
|
||||
}
|
||||
function register_resource($smarty, $type, $functions)
|
||||
{
|
||||
if (count($functions) == 4) {
|
||||
$smarty->_plugins['resource'][$type] =
|
||||
array($functions, false);
|
||||
} elseif (count($functions) == 5) {
|
||||
$smarty->plugins['resource'][$type] =
|
||||
array(array(array(&$functions[0], $functions[1]) , array(&$functions[0], $functions[2]) , array(&$functions[0], $functions[3]) , array(&$functions[0], $functions[4])) , false);
|
||||
} else {
|
||||
throw new Exception("malformed function-list for '$type' in register_resource");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -11,23 +11,16 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Register_Variablefilter
|
||||
* Registers an output filter function which
|
||||
* runs over any variable output
|
||||
*
|
||||
* Register a PHP function as variablefilter
|
||||
* @param object $smarty
|
||||
* @param callback $function
|
||||
*/
|
||||
|
||||
class Smarty_Method_Register_Variablefilter extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Registers an output filter function which
|
||||
* runs over any variable output
|
||||
*
|
||||
* @param callback $function
|
||||
*/
|
||||
public function execute($function)
|
||||
{
|
||||
$_name = (is_array($function)) ? $function[0] : $function;
|
||||
$this->smarty->registered_filters['variable'][$_name] = $function;
|
||||
}
|
||||
function register_variablefilter($smarty, $function)
|
||||
{
|
||||
$_name = (is_array($function)) ? $function[0] : $function;
|
||||
$smarty->registered_filters['variable'][$_name] = $function;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,24 +11,17 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class registerDefaultPluginHandler
|
||||
* Registers a default plugin handler
|
||||
*
|
||||
* Registers a default plugin handler
|
||||
* @param object $smarty
|
||||
* @param string $ |array $plugin class/methode name
|
||||
*/
|
||||
|
||||
class Smarty_Method_registerDefaultPluginHandler extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Registers a default plugin handler
|
||||
*
|
||||
* @param string $ |array $plugin class/methode name
|
||||
*/
|
||||
public function execute($plugin)
|
||||
{
|
||||
if (is_callable($plugin)) {
|
||||
$this->smarty->default_plugin_handler_func = $plugin;
|
||||
} else {
|
||||
throw new Exception('Default plugin handler "'.$plugin.'" not callable');
|
||||
}
|
||||
function registerDefaultPluginHandler($smarty, $plugin)
|
||||
{
|
||||
if (is_callable($plugin)) {
|
||||
$smarty->default_plugin_handler_func = $plugin;
|
||||
} else {
|
||||
throw new Exception('Default plugin handler "' . $plugin . '" not callable');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -11,24 +11,17 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class registerDefaultTemplateHandler
|
||||
*
|
||||
* Registers a default template handler
|
||||
*
|
||||
* @param object $smarty
|
||||
* @param string $ |array $function class/methode name
|
||||
*/
|
||||
|
||||
class Smarty_Method_registerDefaultTemplateHandler extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Registers a default template handler
|
||||
*
|
||||
* @param string $ |array $function class/methode name
|
||||
*/
|
||||
public function execute($function)
|
||||
{
|
||||
if (is_callable($function)) {
|
||||
$this->smarty->default_template_handler_func = $function;
|
||||
} else {
|
||||
throw new Exception('Default template handler "'.$function.'" not callable');
|
||||
}
|
||||
function registerDefaultTemplateHandler($smarty, $function)
|
||||
{
|
||||
if (is_callable($function)) {
|
||||
$smarty->default_template_handler_func = $function;
|
||||
} else {
|
||||
throw new Exception('Default template handler "' . $function . '" not callable');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -11,23 +11,16 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class setConfigDir
|
||||
*
|
||||
* Sets directory of config files
|
||||
*
|
||||
* @param object $smarty
|
||||
* @param string $ config folder
|
||||
* @return
|
||||
*/
|
||||
|
||||
class Smarty_Method_SetConfigDir extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Sets directory of config files
|
||||
*
|
||||
* @param string $ config folder
|
||||
* @return
|
||||
*/
|
||||
public function execute($config_dir)
|
||||
{
|
||||
$this->smarty->config_dir = $config_dir;
|
||||
return;
|
||||
}
|
||||
function SetConfigDir($smarty, $config_dir)
|
||||
{
|
||||
$this->smarty->config_dir = $config_dir;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,22 +11,18 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class setDebugTemplate
|
||||
*
|
||||
* Sets debug template filepath
|
||||
*/
|
||||
|
||||
class Smarty_Method_SetDebugTemplate extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Sets debug template filepath
|
||||
*
|
||||
* @param string $ array debug template filepath
|
||||
*/
|
||||
public function execute($debug_tpl)
|
||||
{
|
||||
$this->smarty->debug_tpl = $debug_tpl;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Sets debug template filepath
|
||||
*
|
||||
* @param string $ array debug template filepath
|
||||
*/
|
||||
function SetDebugTemplate(smarty, $debug_tpl)
|
||||
{
|
||||
$smarty->debug_tpl = $debug_tpl;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,23 +11,19 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class setPluginsDir
|
||||
*
|
||||
* Sets directory of plugin files
|
||||
*/
|
||||
|
||||
class Smarty_Method_SetPluginsDir extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Sets directory of plugin files
|
||||
*
|
||||
* @param string $ plugins folder
|
||||
* @return
|
||||
*/
|
||||
public function execute($plugins_dir)
|
||||
{
|
||||
$this->smarty->plugins_dir = (array)$plugins_dir;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Sets directory of plugin files
|
||||
*
|
||||
* @param string $ plugins folder
|
||||
* @return
|
||||
*/
|
||||
function SetPluginsDir($smarty, $plugins_dir)
|
||||
{
|
||||
$smarty->plugins_dir = (array)$plugins_dir;
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -11,29 +11,25 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class Template_Exists
|
||||
*
|
||||
* Checks if a template resource exists
|
||||
*/
|
||||
|
||||
class Smarty_Method_Template_Exists extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Check if a template resource exists
|
||||
*
|
||||
* @param string $resource_name template name
|
||||
* @return boolean status
|
||||
*/
|
||||
public function execute($resource_name)
|
||||
{
|
||||
foreach((array)$this->smarty->template_dir as $_template_dir) {
|
||||
$_filepath = $_template_dir . $resource_name;
|
||||
if (file_exists($_filepath))
|
||||
return true;
|
||||
}
|
||||
if (file_exists($resource_name)) return true;
|
||||
// no tpl file found
|
||||
return false;
|
||||
/**
|
||||
* Check if a template resource exists
|
||||
*
|
||||
* @param string $resource_name template name
|
||||
* @return boolean status
|
||||
*/
|
||||
function template_exists($smarty, $resource_name)
|
||||
{
|
||||
foreach((array)$smarty->template_dir as $_template_dir) {
|
||||
$_filepath = $_template_dir . $resource_name;
|
||||
if (file_exists($_filepath))
|
||||
return true;
|
||||
}
|
||||
if (file_exists($resource_name)) return true;
|
||||
// no tpl file found
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -1,93 +1,86 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty plugin
|
||||
* Smarty plugin
|
||||
*
|
||||
* @ignore
|
||||
* @package Smarty
|
||||
* @subpackage plugins
|
||||
*/
|
||||
|
||||
class Smarty_Method_Test extends Smarty_Internal_Base {
|
||||
|
||||
public function execute() {
|
||||
* @package Smarty
|
||||
* @subpackage plugins
|
||||
*/
|
||||
|
||||
function test($smarty)
|
||||
{
|
||||
echo "<PRE>\n";
|
||||
|
||||
|
||||
echo "Smarty Installation test...\n";
|
||||
|
||||
|
||||
echo "Testing template directory...\n";
|
||||
|
||||
foreach((array)$this->smarty->template_dir as $template_dir)
|
||||
{
|
||||
if(!is_dir($template_dir))
|
||||
echo "FAILED: $template_dir is not a directory.\n";
|
||||
elseif(!is_readable($template_dir))
|
||||
echo "FAILED: $template_dir is not readable.\n";
|
||||
else
|
||||
echo "$template_dir is OK.\n";
|
||||
}
|
||||
|
||||
foreach((array)$smarty->template_dir as $template_dir) {
|
||||
if (!is_dir($template_dir))
|
||||
echo "FAILED: $template_dir is not a directory.\n";
|
||||
elseif (!is_readable($template_dir))
|
||||
echo "FAILED: $template_dir is not readable.\n";
|
||||
else
|
||||
echo "$template_dir is OK.\n";
|
||||
}
|
||||
|
||||
echo "Testing compile directory...\n";
|
||||
|
||||
if(!is_dir($this->smarty->compile_dir))
|
||||
echo "FAILED: $compile_dir is not a directory.\n";
|
||||
elseif(!is_readable($this->smarty->compile_dir))
|
||||
echo "FAILED: $compile_dir is not readable.\n";
|
||||
elseif(!is_writable($this->smarty->compile_dir))
|
||||
echo "FAILED: $compile_dir is not writable.\n";
|
||||
else
|
||||
echo "{$this->smarty->compile_dir} is OK.\n";
|
||||
|
||||
if (!is_dir($smarty->compile_dir))
|
||||
echo "FAILED: $smarty->compile_dir is not a directory.\n";
|
||||
elseif (!is_readable($smarty->compile_dir))
|
||||
echo "FAILED: $smarty->compile_dir is not readable.\n";
|
||||
elseif (!is_writable($smarty->compile_dir))
|
||||
echo "FAILED: $smarty->compile_dir is not writable.\n";
|
||||
else
|
||||
echo "{$smarty->compile_dir} is OK.\n";
|
||||
|
||||
echo "Testing sysplugins directory...\n";
|
||||
|
||||
if(!is_dir($this->smarty->sysplugins_dir))
|
||||
echo "FAILED: $sysplugins_dir is not a directory.\n";
|
||||
elseif(!is_readable($this->smarty->sysplugins_dir))
|
||||
echo "FAILED: $sysplugins_dir is not readable.\n";
|
||||
|
||||
if (!is_dir($smarty->sysplugins_dir))
|
||||
echo "FAILED: $smarty->sysplugins_dir is not a directory.\n";
|
||||
elseif (!is_readable($smarty->sysplugins_dir))
|
||||
echo "FAILED: $smarty->sysplugins_dir is not readable.\n";
|
||||
else
|
||||
echo "{$this->smarty->sysplugins_dir} is OK.\n";
|
||||
|
||||
echo "{$smarty->sysplugins_dir} is OK.\n";
|
||||
|
||||
echo "Testing plugins directory...\n";
|
||||
|
||||
foreach((array)$this->smarty->plugins_dir as $plugin_dir)
|
||||
{
|
||||
if(!is_dir($plugin_dir))
|
||||
echo "FAILED: $plugin_dir is not a directory.\n";
|
||||
elseif(!is_readable($plugin_dir))
|
||||
echo "FAILED: $plugin_dir is not readable.\n";
|
||||
else
|
||||
echo "$plugin_dir is OK.\n";
|
||||
}
|
||||
|
||||
|
||||
foreach((array)$smarty->plugins_dir as $plugin_dir) {
|
||||
if (!is_dir($plugin_dir))
|
||||
echo "FAILED: $plugin_dir is not a directory.\n";
|
||||
elseif (!is_readable($plugin_dir))
|
||||
echo "FAILED: $plugin_dir is not readable.\n";
|
||||
else
|
||||
echo "$plugin_dir is OK.\n";
|
||||
}
|
||||
|
||||
echo "Testing cache directory...\n";
|
||||
|
||||
if(!is_dir($this->smarty->cache_dir))
|
||||
echo "FAILED: $cache_dir is not a directory.\n";
|
||||
elseif(!is_readable($this->smarty->cache_dir))
|
||||
echo "FAILED: $cache_dir is not readable.\n";
|
||||
elseif(!is_writable($this->smarty->cache_dir))
|
||||
echo "FAILED: $cache_dir is not writable.\n";
|
||||
|
||||
if (!is_dir($smarty->cache_dir))
|
||||
echo "FAILED: $smarty->cache_dir is not a directory.\n";
|
||||
elseif (!is_readable($smarty->cache_dir))
|
||||
echo "FAILED: $smarty->cache_dir is not readable.\n";
|
||||
elseif (!is_writable($smarty->cache_dir))
|
||||
echo "FAILED: $smarty->cache_dir is not writable.\n";
|
||||
else
|
||||
echo "{$this->smarty->cache_dir} is OK.\n";
|
||||
|
||||
echo "{$smarty->cache_dir} is OK.\n";
|
||||
|
||||
echo "Testing configs directory...\n";
|
||||
|
||||
if(!is_dir($this->smarty->config_dir))
|
||||
echo "FAILED: $config_dir is not a directory.\n";
|
||||
elseif(!is_readable($this->smarty->config_dir))
|
||||
echo "FAILED: $config_dir is not readable.\n";
|
||||
|
||||
if (!is_dir($smarty->config_dir))
|
||||
echo "FAILED: $smarty->config_dir is not a directory.\n";
|
||||
elseif (!is_readable($smarty->config_dir))
|
||||
echo "FAILED: $smarty->config_dir is not readable.\n";
|
||||
else
|
||||
echo "{$this->smarty->config_dir} is OK.\n";
|
||||
|
||||
echo "{$smarty->config_dir} is OK.\n";
|
||||
|
||||
echo "Tests complete.\n";
|
||||
|
||||
|
||||
echo "</PRE>\n";
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user