- removed all internal calls of Smarty::instance()

- fixed code in double quoted strings
This commit is contained in:
Uwe.Tews
2009-08-08 17:28:23 +00:00
parent fc9b7eef10
commit d2d8c8925b
111 changed files with 952 additions and 1313 deletions

View File

@@ -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 07/01/2009
- fixed smarty_function_html_options call in plugin function.html_select_date.php (missing ,) - fixed smarty_function_html_options call in plugin function.html_select_date.php (missing ,)

View File

@@ -61,7 +61,6 @@ if (!defined('SMARTY_EXCEPTION_HANDLER')) {
define('SMARTY_EXCEPTION_HANDLER', 1); define('SMARTY_EXCEPTION_HANDLER', 1);
} }
/** /**
* load required base class for creation of the smarty object * 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 * This is the main Smarty class
*/ */
class Smarty extends Smarty_Internal_TemplateBase { class Smarty extends Smarty_Internal_TemplateBase {
// smarty instances
private static $instance = array();
// smarty version // smarty version
public static $_version = 'Smarty3Alpha'; public static $_version = 'Smarty3Alpha';
// class used for templates // class used for templates
@@ -187,11 +188,10 @@ class Smarty extends Smarty_Internal_TemplateBase {
/** /**
* Class constructor, initializes basic smarty properties * Class constructor, initializes basic smarty properties
*/ */
public function __construct() public function __construct($name = 'default')
{ {
// set instance object // set instance object
self::instance($this); Smarty::$instance[$name] = $this;
if (is_callable('mb_internal_encoding')) { if (is_callable('mb_internal_encoding')) {
$this->has_mb = true; $this->has_mb = true;
mb_internal_encoding($this->resource_char_set); mb_internal_encoding($this->resource_char_set);
@@ -216,9 +216,9 @@ class Smarty extends Smarty_Internal_TemplateBase {
$this->loadPlugin('Smarty_Internal_PluginBase'); $this->loadPlugin('Smarty_Internal_PluginBase');
$this->loadPlugin($this->template_class); $this->loadPlugin($this->template_class);
$this->loadPlugin('Smarty_Internal_Plugin_Handler'); $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->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 (!$this->debugging && $this->debugging_ctrl == 'URL') {
if (isset($_SERVER['QUERY_STRING'])) { if (isset($_SERVER['QUERY_STRING'])) {
$_query_string = $_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: * Sets a static instance of the smarty object. Retrieve with:
* $smarty = Smarty::instance(); * $smarty = Smarty::instance($name);
* *
* @return object reference to Smarty object * @return object reference to Smarty object
*/ */
public static function &instance($new_instance = null) public static function &instance($name = 'default')
{ {
static $instance = null; if (isset(Smarty::$instance[$name])) {
if (isset($new_instance) && is_object($new_instance)) return Smarty::$instance[$name];
$instance = $new_instance; } else {
return $instance; 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')) { if (!class_exists('Smarty_Security_Policy')) {
throw new Exception("Security policy must define class '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->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; $this->security = true;
} else { } else {
throw new Exception("Security policy {$security_policy_file} not found"); 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 // loop through plugin dirs and find the plugin
foreach((array)$this->plugins_dir as $_plugin_dir) { foreach((array)$this->plugins_dir as $_plugin_dir) {
if (strpos('/\\',substr($_plugin_dir, -1)) === false) { if (strpos('/\\', substr($_plugin_dir, -1)) === false) {
$_plugin_dir .= DIRECTORY_SEPARATOR; $_plugin_dir .= DIRECTORY_SEPARATOR;
} }
@@ -489,19 +490,17 @@ class Smarty extends Smarty_Internal_TemplateBase {
*/ */
public function __call($name, $args) public function __call($name, $args)
{ {
$_class_name = "Smarty_Method_{$name}"; if (!is_callable($name)) {
if (!class_exists($_class_name, false)) {
$_plugin_filename = strtolower('method.' . $name . $this->php_ext); $_plugin_filename = strtolower('method.' . $name . $this->php_ext);
if (!file_exists($this->sysplugins_dir . $_plugin_filename)) { if (!file_exists($this->sysplugins_dir . $_plugin_filename)) {
throw new Exception("Sysplugin file " . $_plugin_filename . " does not exist"); throw new Exception("Sysplugin file " . $_plugin_filename . " does not exist");
} }
require_once($this->sysplugins_dir . $_plugin_filename); require_once($this->sysplugins_dir . $_plugin_filename);
if (!class_exists($_class_name, false)) { if (!is_callable($name)) {
throw new Exception ("Sysplugin file " . $_plugin_filename . " does not define class " . $_class_name); throw new Exception ("Sysplugin file " . $_plugin_filename . " does not define function " . $name);
} }
} }
$_method_object = new $_class_name; return call_user_func_array($name, array_merge(array($this), $args));
return call_user_func_array(array($_method_object, 'execute'), $args);
} }
} }
@@ -519,6 +518,7 @@ class SmartyException {
echo "Code: " . $e->getCode() . "<br />Error: " . htmlentities($e->getMessage()) . "<br />" echo "Code: " . $e->getCode() . "<br />Error: " . htmlentities($e->getMessage()) . "<br />"
. "File: " . $e->getFile() . "<br />" . "File: " . $e->getFile() . "<br />"
. "Line: " . $e->getLine() . "<br />" . "Line: " . $e->getLine() . "<br />"
// . "Trace" . $e->getTraceAsString() . "<br />"
. "\n"; . "\n";
} }

View File

@@ -20,7 +20,7 @@
* @param integer $ * @param integer $
* @return string * @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) static function execute ($var, $depth = 0, $length = 40)
{ {
$_replace = array("\n" => '<i>\n</i>', $_replace = array("\n" => '<i>\n</i>',

View File

@@ -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();
}
}
?>

View File

@@ -15,7 +15,12 @@
/** /**
* Smarty Internal Plugin Cacher InlineCode Class * 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 * Inject inline code for nocache template sections
* *

View File

@@ -14,7 +14,11 @@
/** /**
* This class does contain all necessary methods for the HTML cache on file system * 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 * Returns the filepath of the cached template output
* *

View File

@@ -44,7 +44,7 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase {
} }
// create config object // create config object
$_output = "<?php \$_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Config');"; $_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); ?>"; $_output .= "\$_config->loadConfigVars($section, $scope); ?>";
return $_output; return $_output;
} }

View File

@@ -32,7 +32,7 @@ class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase {
} }
// create template object // 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? //was there an assign attribute?
if (isset($_assign)) { if (isset($_assign)) {
$_output .= "\$_smarty_tpl->assign($_assign,\$_smarty_tpl->smarty->fetch(\$_template));"; $_output .= "\$_smarty_tpl->assign($_assign,\$_smarty_tpl->smarty->fetch(\$_template));";

View File

@@ -30,7 +30,7 @@ class Smarty_Internal_Compile_Extend extends Smarty_Internal_CompileBase {
// $include_file = ''; // $include_file = '';
eval('$include_file = ' . $_attr['file'] . ';'); eval('$include_file = ' . $_attr['file'] . ';');
// create template object // 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 // save file dependency
$compiler->template->properties['file_dependency'][] = array($_template->getTemplateFilepath(), $_template->getTemplateTimestamp()); $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); // $_old_source = preg_replace ('/' . $this->smarty->left_delimiter . 'extend\s+(?:file=)?\s*(\S+?|(["\']).+?\2)' . $this->smarty->right_delimiter . '/i', '' , $compiler->template->template_source, 1);

View File

@@ -70,7 +70,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
} }
} }
// create template object // 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 // delete {include} standard attributes
unset($_attr['file'], $_attr['assign'], $_attr['caching_lifetime'], $_attr['nocache'], $_attr['caching'], $_attr['scope']); unset($_attr['file'], $_attr['assign'], $_attr['caching_lifetime'], $_attr['nocache'], $_attr['caching'], $_attr['scope']);
// remaining attributes must be assigned as smarty variable // remaining attributes must be assigned as smarty variable

View File

@@ -34,7 +34,7 @@ class Smarty_Internal_Compile_Internal_Function_Call extends Smarty_Internal_Com
} }
$_name = trim($_attr['name'], "'"); $_name = trim($_attr['name'], "'");
// create template object // 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 // assign default paramter
if (isset($this->smarty->template_functions[$_name]['parameter'])) { if (isset($this->smarty->template_functions[$_name]['parameter'])) {
// function is already compiled // function is already compiled

View File

@@ -9,15 +9,12 @@
* @subpackage Config * @subpackage Config
* @author Uwe Tews * @author Uwe Tews
*/ */
class Smarty_Internal_Config extends Smarty_Internal_Base { class Smarty_Internal_Config {
static $config_objects = array(); static $config_objects = array();
public function __construct($config_resource) public function __construct($config_resource, $smarty)
{ {
parent::__construct(); $this->smarty = $smarty;
// set instance object
// self::instance($this);
// initianlize
$this->config_resource = $config_resource; $this->config_resource = $config_resource;
$this->config_resource_type = null; $this->config_resource_type = null;
$this->config_resource_name = null; $this->config_resource_name = null;
@@ -77,7 +74,7 @@ class Smarty_Internal_Config extends Smarty_Internal_Base {
public function buildConfigFilepath () public function buildConfigFilepath ()
{ {
foreach((array)$this->smarty->config_dir as $_config_dir) { 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; $_config_dir .= DIRECTORY_SEPARATOR;
} }
@@ -201,7 +198,7 @@ class Smarty_Internal_Config extends Smarty_Internal_Base {
if (!is_object($this->compiler_object)) { if (!is_object($this->compiler_object)) {
// load compiler // load compiler
$this->smarty->loadPlugin('Smarty_Internal_Config_File_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)) { if (!is_object($this->smarty->write_file_object)) {
$this->smarty->loadPlugin("Smarty_Internal_Write_File"); $this->smarty->loadPlugin("Smarty_Internal_Write_File");

View File

@@ -13,14 +13,14 @@
/** /**
* Main config file compiler class * 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; public $compile_error= false;
/** /**
* Initialize compiler * Initialize compiler
*/ */
public function __construct() public function __construct($smarty)
{ {
parent::__construct(); $this->smarty = $smarty;
// get required plugins // get required plugins
$this->smarty->loadPlugin('Smarty_Internal_Configfilelexer'); $this->smarty->loadPlugin('Smarty_Internal_Configfilelexer');
$this->smarty->loadPlugin('Smarty_Internal_Configfileparser'); $this->smarty->loadPlugin('Smarty_Internal_Configfileparser');
@@ -47,7 +47,7 @@ class Smarty_Internal_Config_File_Compiler extends Smarty_Internal_Base {
return true; return true;
} }
// init the lexer/parser to compile the config file // 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 = new Smarty_Internal_Configfileparser($lex, $this);
// $parser->PrintTrace(); // $parser->PrintTrace();
// get tokens from lexer and parse them // get tokens from lexer and parse them

View File

@@ -24,14 +24,14 @@ class Smarty_Internal_Configfilelexer
); );
function __construct($data) function __construct($data, $smarty)
{ {
// set instance object // set instance object
self::instance($this); self::instance($this);
$this->data = $data; $this->data = $data;
$this->counter = 0; $this->counter = 0;
$this->line = 1; $this->line = 1;
$this->smarty = Smarty::instance(); $this->smarty = $smarty;
} }
public static function &instance($new_instance = null) public static function &instance($new_instance = null)
{ {

View File

@@ -120,7 +120,7 @@ class Smarty_Internal_Configfileparser#line 109 "internal.configfileparser.php"
// set instance object // set instance object
self::instance($this); self::instance($this);
$this->lex = $lex; $this->lex = $lex;
$this->smarty = Smarty::instance(); $this->smarty = $compiler->smarty;
$this->compiler = $compiler; $this->compiler = $compiler;
$this->current_section = null; $this->current_section = null;
$this->hidden_section = false; $this->hidden_section = false;

View File

@@ -48,7 +48,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_TemplateBase {
ksort($_assigned_vars); ksort($_assigned_vars);
$_config_vars = $smarty->config_vars; $_config_vars = $smarty->config_vars;
ksort($_config_vars); ksort($_config_vars);
$_template = new Smarty_Template ($smarty->debug_tpl); $_template = new Smarty_Template ($smarty->debug_tpl, $smarty);
$_template->caching = false; $_template->caching = false;
$_template->force_compile = false; $_template->force_compile = false;
$_template->security = false; $_template->security = false;

View File

@@ -10,7 +10,11 @@
/** /**
* Smarty Internal Plugin Handler Class * 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 * Call a Smarty plugin
* *

View File

@@ -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 {
}
?>

View File

@@ -12,7 +12,11 @@
/** /**
* Smarty Internal Plugin Resource File * 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 // classes used for compiling Smarty templates from file resource
public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler'; public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler';
public $template_lexer_class = 'Smarty_Internal_Templatelexer'; public $template_lexer_class = 'Smarty_Internal_Templatelexer';
@@ -92,7 +96,7 @@ class Smarty_Internal_Resource_File extends Smarty_Internal_Base {
*/ */
public function getCompiledFilepath($_template) public function getCompiledFilepath($_template)
{ {
// $_filepath = md5($_template->resource_name); // $_filepath = md5($_template->resource_name);
$_filepath = (string)abs(crc32($_template->resource_name)); $_filepath = (string)abs(crc32($_template->resource_name));
// if use_sub_dirs, break file into directories // if use_sub_dirs, break file into directories
if ($_template->smarty->use_sub_dirs) { if ($_template->smarty->use_sub_dirs) {
@@ -111,7 +115,7 @@ class Smarty_Internal_Resource_File extends Smarty_Internal_Base {
$_cache = ''; $_cache = '';
} }
$_compile_dir = $_template->smarty->compile_dir; $_compile_dir = $_template->smarty->compile_dir;
if (strpos('/\\',substr($_compile_dir, -1)) === false) { if (strpos('/\\', substr($_compile_dir, -1)) === false) {
$_compile_dir .= DIRECTORY_SEPARATOR; $_compile_dir .= DIRECTORY_SEPARATOR;
} }
return $_compile_dir . $_filepath . '.' . basename($_template->resource_name) . $_cache . $_template->smarty->php_ext; return $_compile_dir . $_filepath . '.' . basename($_template->resource_name) . $_cache . $_template->smarty->php_ext;

View File

@@ -12,12 +12,13 @@
/** /**
* Smarty Internal Plugin Resource PHP * 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 * Class constructor, enable short open tags
*/ */
public function __construct() public function __construct($smarty)
{ {
$this->smarty = $smarty;
ini_set('short_open_tag', '1'); ini_set('short_open_tag', '1');
} }
/** /**

View File

@@ -13,7 +13,11 @@
* Smarty Internal Plugin Resource Stream * 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 // classes used for compiling Smarty templates from file resource
public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler'; public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler';
public $template_lexer_class = 'Smarty_Internal_Templatelexer'; public $template_lexer_class = 'Smarty_Internal_Templatelexer';

View File

@@ -12,7 +12,11 @@
* Smarty Internal Plugin Resource String * 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 // classes used for compiling Smarty templates from file resource
public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler'; public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler';
public $template_lexer_class = 'Smarty_Internal_Templatelexer'; public $template_lexer_class = 'Smarty_Internal_Templatelexer';

View File

@@ -13,7 +13,11 @@
/** /**
* Class for filter processing * 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 * Run filters over content
* *

View File

@@ -9,7 +9,11 @@
/** /**
* This class contains all methods for security checking * 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. * Check if PHP function is trusted.
* *

View File

@@ -16,8 +16,9 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom
/** /**
* Initialize compiler * Initialize compiler
*/ */
public function __construct($lexer_class, $parser_class) public function __construct($lexer_class, $parser_class, $smarty)
{ {
$this->smarty = $smarty;
parent::__construct(); parent::__construct();
// get required plugins // get required plugins
$this->smarty->loadPlugin($lexer_class); $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, tags in the templates are replaces with PHP code,
then written to compiled files. */ then written to compiled files. */
// init the lexer/parser to compile the template // 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 = new $this->parser_class($lex, $this);
// $parser->PrintTrace(); // $parser->PrintTrace();
// get tokens from lexer and parse them // get tokens from lexer and parse them

View File

@@ -76,9 +76,9 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
* @param mixed $_cache_id cache id or null * @param mixed $_cache_id cache id or null
* @param mixed $_compile_id compile 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 // Smarty parameter
$this->cache_id = $_cache_id === null ? $this->smarty->cache_id : $_cache_id; $this->cache_id = $_cache_id === null ? $this->smarty->cache_id : $_cache_id;
$this->compile_id = $_compile_id === null ? $this->smarty->compile_id : $_compile_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 // load cacher
if ($this->caching) { if ($this->caching) {
$this->smarty->loadPlugin($this->cacher_class); $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 // load cache resource
if (!$this->isEvaluated() && $this->caching && !isset($this->smarty->cache_resource_objects[$this->caching_type])) { if (!$this->isEvaluated() && $this->caching && !isset($this->smarty->cache_resource_objects[$this->caching_type])) {
$this->smarty->loadPlugin($this->cache_resource_class); $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) { if ($this->smarty->direct_access_security) {
$this->dir_acc_sec_string = "<?php if(!defined('SMARTY_DIR')) exit('no direct access allowed'); ?>\n"; $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_CompileBase');
$this->smarty->loadPlugin('Smarty_Internal_TemplateCompilerBase'); $this->smarty->loadPlugin('Smarty_Internal_TemplateCompilerBase');
$this->smarty->loadPlugin($this->resource_objects[$this->resource_type]->compiler_class); $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)) { if (!is_object($this->smarty->write_file_object)) {
$this->smarty->loadPlugin("Smarty_Internal_Write_File"); $this->smarty->loadPlugin("Smarty_Internal_Write_File");
@@ -548,12 +548,12 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
// try sysplugins dir first // try sysplugins dir first
$_resource_class = "Smarty_Internal_Resource_{$this->resource_type}"; $_resource_class = "Smarty_Internal_Resource_{$this->resource_type}";
if ($this->smarty->loadPlugin($_resource_class)) { 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 { } else {
// try plugins dir // try plugins dir
$_resource_class = "Smarty_Resource_{$this->resource_type}"; $_resource_class = "Smarty_Resource_{$this->resource_type}";
if ($this->smarty->loadPlugin($_resource_class)) { 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 { } else {
// try streams // try streams
$_known_stream = stream_get_wrappers(); $_known_stream = stream_get_wrappers();
@@ -564,7 +564,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
} }
if (!isset($this->resource_objects['stream'])) { if (!isset($this->resource_objects['stream'])) {
$this->smarty->loadPlugin('Smarty_Internal_Resource_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_type = 'stream';
$this->resource_name = str_replace(':', '://', $template_resource); $this->resource_name = str_replace(':', '://', $template_resource);

View File

@@ -311,16 +311,15 @@ class Smarty_Internal_TemplateBase {
public function createTemplate($template, $parent = null, $cache_id = null, $compile_id = null) public function createTemplate($template, $parent = null, $cache_id = null, $compile_id = null)
{ {
if (!is_object($template)) { if (!is_object($template)) {
$_smarty = Smarty::instance();
// we got a template resource // we got a template resource
$_templateId = $this->buildTemplateId ($template, $cache_id, $compile_id); $_templateId = $this->buildTemplateId ($template, $cache_id, $compile_id);
// already in template cache? // already in template cache?
if (isset($_smarty->template_objects[$_templateId])) { if (isset($this->template_objects[$_templateId])) {
// return cached template object // return cached template object
return $_smarty->template_objects[$_templateId]; return $this->template_objects[$_templateId];
} else { } else {
// create and cache new template object // 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 { } else {
// just return a copy of template class // 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 * @param mixed $_compile_id compile id to be used with this template
* @returns string a unique template id * @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 md5($_resource . md5($_cache_id) . md5($_compile_id));
return crc32($_resource . $_cache_id . $_compile_id); return crc32($_resource . $_cache_id . $_compile_id);

View File

@@ -11,7 +11,7 @@
/** /**
* Main compiler class * Main compiler class
*/ */
class Smarty_Internal_TemplateCompilerBase extends Smarty_Internal_Base { class Smarty_Internal_TemplateCompilerBase {
// compile tag objects // compile tag objects
static $_tag_objects = array(); static $_tag_objects = array();
// tag stack // tag stack
@@ -24,7 +24,6 @@ class Smarty_Internal_TemplateCompilerBase extends Smarty_Internal_Base {
*/ */
public function __construct() public function __construct()
{ {
parent::__construct();
// get required plugins // 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']))) { 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'); $this->smarty->loadPlugin('Smarty_Internal_Run_Filter');
@@ -45,7 +44,7 @@ class Smarty_Internal_TemplateCompilerBase extends Smarty_Internal_Base {
then written to compiled files. */ then written to compiled files. */
if (!is_object($template->cacher_object)) { if (!is_object($template->cacher_object)) {
$this->smarty->loadPlugin($template->cacher_class); $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 // flag for nochache sections
$this->nocache = false; $this->nocache = false;

View File

@@ -71,14 +71,14 @@ class Smarty_Internal_Templatelexer
); );
function __construct($data) function __construct($data,$smarty)
{ {
// set instance object // set instance object
self::instance($this); self::instance($this);
$this->data = $data; $this->data = $data;
$this->counter = 0; $this->counter = 0;
$this->line = 1; $this->line = 1;
$this->smarty = Smarty::instance(); $this->smarty = $smarty;
$this->ldel = preg_quote($this->smarty->left_delimiter); $this->ldel = preg_quote($this->smarty->left_delimiter);
$this->rdel = preg_quote($this->smarty->right_delimiter); $this->rdel = preg_quote($this->smarty->right_delimiter);
} }

View File

@@ -120,8 +120,8 @@ class Smarty_Internal_Templateparser#line 109 "internal.templateparser.php"
// set instance object // set instance object
self::instance($this); self::instance($this);
$this->lex = $lex; $this->lex = $lex;
$this->smarty = Smarty::instance();
$this->compiler = $compiler; $this->compiler = $compiler;
$this->smarty = $this->compiler->smarty;
$this->template = $this->compiler->template; $this->template = $this->compiler->template;
$this->cacher = $this->template->cacher_object; $this->cacher = $this->template->cacher_object;
$this->nocache = false; $this->nocache = false;
@@ -2059,102 +2059,102 @@ static public $yy_action = array(
#line 277 "internal.templateparser.y" #line 277 "internal.templateparser.y"
function yy_r54(){ $this->_retvalue = "''"; } function yy_r54(){ $this->_retvalue = "''"; }
#line 2066 "internal.templateparser.php" #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.'"'; } function yy_r55(){ $this->_retvalue = '"'.$this->yystack[$this->yyidx + -1]->minor.'"'; }
#line 2069 "internal.templateparser.php" #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; } function yy_r57(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'::'.$this->yystack[$this->yyidx + 0]->minor; }
#line 2072 "internal.templateparser.php" #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 .')'; } 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 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; } 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 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; } 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 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; } function yy_r61(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'::'.$this->yystack[$this->yyidx + 0]->minor; }
#line 2084 "internal.templateparser.php" #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; } 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 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; } 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 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 { 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;} } $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 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; } 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 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 .'\')'; } function yy_r67(){$this->_retvalue = '$_smarty_tpl->getConfigVariable(\''. $this->yystack[$this->yyidx + -1]->minor .'\')'; }
#line 2100 "internal.templateparser.php" #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 .')'; } function yy_r68(){$this->_retvalue = '$_smarty_tpl->getConfigVariable('. $this->yystack[$this->yyidx + -1]->minor .')'; }
#line 2103 "internal.templateparser.php" #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); } 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 2106 "internal.templateparser.php"
#line 320 "internal.templateparser.y" #line 319 "internal.templateparser.y"
function yy_r71(){return; } function yy_r71(){return; }
#line 2109 "internal.templateparser.php" #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 ."']"; } function yy_r72(){ $this->_retvalue = "['". $this->yystack[$this->yyidx + 0]->minor ."']"; }
#line 2112 "internal.templateparser.php" #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 ."]"; } function yy_r73(){ $this->_retvalue = "[". $this->yystack[$this->yyidx + 0]->minor ."]"; }
#line 2115 "internal.templateparser.php" #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."]"; } function yy_r74(){ $this->_retvalue = "[".$this->yystack[$this->yyidx + 0]->minor."]"; }
#line 2118 "internal.templateparser.php" #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 ."]"; } function yy_r75(){ $this->_retvalue = "[". $this->yystack[$this->yyidx + -1]->minor ."]"; }
#line 2121 "internal.templateparser.php" #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\']').']'; } 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 2124 "internal.templateparser.php"
#line 333 "internal.templateparser.y" #line 332 "internal.templateparser.y"
function yy_r78(){$this->_retvalue = ''; } function yy_r78(){$this->_retvalue = ''; }
#line 2127 "internal.templateparser.php" #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; } function yy_r80(){$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.'.'.$this->yystack[$this->yyidx + 0]->minor; }
#line 2130 "internal.templateparser.php" #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.'\''; } function yy_r81(){$this->_retvalue = '\''.$this->yystack[$this->yyidx + 0]->minor.'\''; }
#line 2133 "internal.templateparser.php" #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.')'; } function yy_r82(){$this->_retvalue = '('.$this->yystack[$this->yyidx + -1]->minor.')'; }
#line 2136 "internal.templateparser.php" #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 { 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;} } $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 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; } function yy_r84(){$this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; }
#line 2143 "internal.templateparser.php" #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; } function yy_r85(){$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; }
#line 2146 "internal.templateparser.php" #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; } function yy_r86(){ $this->_retvalue = '->'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; }
#line 2149 "internal.templateparser.php" #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.'}'; } function yy_r87(){ $this->_retvalue = '->{'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor.'}'; }
#line 2152 "internal.templateparser.php" #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.'}'; } function yy_r88(){ $this->_retvalue = '->{'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}'; }
#line 2155 "internal.templateparser.php" #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.'}'; } 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 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; } function yy_r90(){ $this->_retvalue = '->'.$this->yystack[$this->yyidx + 0]->minor; }
#line 2161 "internal.templateparser.php" #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)) { 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)) { 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 .")"; $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 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 .")"; } function yy_r92(){ $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . "(". $this->yystack[$this->yyidx + -1]->minor .")"; }
#line 2173 "internal.templateparser.php" #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; } function yy_r93(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.",".$this->yystack[$this->yyidx + 0]->minor; }
#line 2176 "internal.templateparser.php" #line 2176 "internal.templateparser.php"
#line 388 "internal.templateparser.y" #line 387 "internal.templateparser.y"
function yy_r95(){ return; } function yy_r95(){ return; }
#line 2179 "internal.templateparser.php" #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); } function yy_r96(){ $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor,true); }
#line 2182 "internal.templateparser.php" #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); } function yy_r97(){ $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor,false); }
#line 2185 "internal.templateparser.php" #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; } function yy_r98(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; }
#line 2188 "internal.templateparser.php" #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; } function yy_r100(){$this->_retvalue = ','.$this->yystack[$this->yyidx + 0]->minor; }
#line 2191 "internal.templateparser.php" #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.'\''; } function yy_r101(){$this->_retvalue = ',\''.$this->yystack[$this->yyidx + 0]->minor.'\''; }
#line 2194 "internal.templateparser.php" #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; } function yy_r103(){$this->_retvalue = '!'.$this->yystack[$this->yyidx + 0]->minor; }
#line 2197 "internal.templateparser.php" #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; } function yy_r105(){$this->_retvalue =$this->yystack[$this->yyidx + 0]->minor; }
#line 2200 "internal.templateparser.php" #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; } 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 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.')'; } 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 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.')'; } 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 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.')'; } function yy_r110(){$this->_retvalue = '!('.$this->yystack[$this->yyidx + -2]->minor.' % '.$this->yystack[$this->yyidx + 0]->minor.')'; }
#line 2212 "internal.templateparser.php" #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.')'; } function yy_r111(){$this->_retvalue = '('.$this->yystack[$this->yyidx + -2]->minor.' % '.$this->yystack[$this->yyidx + 0]->minor.')'; }
#line 2215 "internal.templateparser.php" #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.')'; } function yy_r112(){$this->_retvalue = '!(1 & '.$this->yystack[$this->yyidx + -1]->minor.')'; }
#line 2218 "internal.templateparser.php" #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.')'; } function yy_r113(){$this->_retvalue = '(1 & '.$this->yystack[$this->yyidx + -1]->minor.')'; }
#line 2221 "internal.templateparser.php" #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.')'; } function yy_r114(){$this->_retvalue = '!(1 & '.$this->yystack[$this->yyidx + -2]->minor.' / '.$this->yystack[$this->yyidx + 0]->minor.')'; }
#line 2224 "internal.templateparser.php" #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.')'; } function yy_r115(){$this->_retvalue = '(1 & '.$this->yystack[$this->yyidx + -2]->minor.' / '.$this->yystack[$this->yyidx + 0]->minor.')'; }
#line 2227 "internal.templateparser.php" #line 2227 "internal.templateparser.php"
#line 434 "internal.templateparser.y" #line 433 "internal.templateparser.y"
function yy_r120(){$this->_retvalue = '=='; } function yy_r120(){$this->_retvalue = '=='; }
#line 2230 "internal.templateparser.php" #line 2230 "internal.templateparser.php"
#line 435 "internal.templateparser.y" #line 434 "internal.templateparser.y"
function yy_r121(){$this->_retvalue = '!='; } function yy_r121(){$this->_retvalue = '!='; }
#line 2233 "internal.templateparser.php" #line 2233 "internal.templateparser.php"
#line 436 "internal.templateparser.y" #line 435 "internal.templateparser.y"
function yy_r122(){$this->_retvalue = '>'; } function yy_r122(){$this->_retvalue = '>'; }
#line 2236 "internal.templateparser.php" #line 2236 "internal.templateparser.php"
#line 437 "internal.templateparser.y" #line 436 "internal.templateparser.y"
function yy_r123(){$this->_retvalue = '<'; } function yy_r123(){$this->_retvalue = '<'; }
#line 2239 "internal.templateparser.php" #line 2239 "internal.templateparser.php"
#line 438 "internal.templateparser.y" #line 437 "internal.templateparser.y"
function yy_r124(){$this->_retvalue = '>='; } function yy_r124(){$this->_retvalue = '>='; }
#line 2242 "internal.templateparser.php" #line 2242 "internal.templateparser.php"
#line 439 "internal.templateparser.y" #line 438 "internal.templateparser.y"
function yy_r125(){$this->_retvalue = '<='; } function yy_r125(){$this->_retvalue = '<='; }
#line 2245 "internal.templateparser.php" #line 2245 "internal.templateparser.php"
#line 440 "internal.templateparser.y" #line 439 "internal.templateparser.y"
function yy_r126(){$this->_retvalue = '==='; } function yy_r126(){$this->_retvalue = '==='; }
#line 2248 "internal.templateparser.php" #line 2248 "internal.templateparser.php"
#line 441 "internal.templateparser.y" #line 440 "internal.templateparser.y"
function yy_r127(){$this->_retvalue = '!=='; } function yy_r127(){$this->_retvalue = '!=='; }
#line 2251 "internal.templateparser.php" #line 2251 "internal.templateparser.php"
#line 443 "internal.templateparser.y" #line 442 "internal.templateparser.y"
function yy_r128(){$this->_retvalue = '&&'; } function yy_r128(){$this->_retvalue = '&&'; }
#line 2254 "internal.templateparser.php" #line 2254 "internal.templateparser.php"
#line 444 "internal.templateparser.y" #line 443 "internal.templateparser.y"
function yy_r129(){$this->_retvalue = '||'; } function yy_r129(){$this->_retvalue = '||'; }
#line 2257 "internal.templateparser.php" #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.')'; } function yy_r130(){ $this->_retvalue = 'array('.$this->yystack[$this->yyidx + -1]->minor.')'; }
#line 2260 "internal.templateparser.php" #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; } function yy_r132(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor; }
#line 2263 "internal.templateparser.php" #line 2263 "internal.templateparser.php"
#line 452 "internal.templateparser.y" #line 451 "internal.templateparser.y"
function yy_r133(){ return; } function yy_r133(){ return; }
#line 2266 "internal.templateparser.php" #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; } function yy_r135(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'=>'.$this->yystack[$this->yyidx + 0]->minor; }
#line 2269 "internal.templateparser.php" #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; } function yy_r136(){ $this->_retvalue = '\''.$this->yystack[$this->yyidx + -2]->minor.'\'=>'.$this->yystack[$this->yyidx + 0]->minor; }
#line 2272 "internal.templateparser.php" #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."`"; } function yy_r139(){$this->_retvalue = "`".$this->yystack[$this->yyidx + -1]->minor."`"; }
#line 2275 "internal.templateparser.php" #line 2275 "internal.templateparser.php"
#line 463 "internal.templateparser.y" #line 462 "internal.templateparser.y"
function yy_r140(){$this->_retvalue = "'.".$this->yystack[$this->yyidx + -1]->minor.".'"; } function yy_r140(){$this->_retvalue = '".'.$this->yystack[$this->yyidx + -1]->minor.'."'; }
#line 2278 "internal.templateparser.php" #line 2278 "internal.templateparser.php"
#line 464 "internal.templateparser.y" #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; } 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 2281 "internal.templateparser.php"
#line 465 "internal.templateparser.y" #line 464 "internal.templateparser.y"
function yy_r142(){$this->_retvalue = "'.(".$this->yystack[$this->yyidx + -1]->minor.").'"; } function yy_r142(){$this->_retvalue = '".('.$this->yystack[$this->yyidx + -1]->minor.')."'; }
#line 2284 "internal.templateparser.php" #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; } function yy_r143(){$this->_retvalue = '$'.$this->yystack[$this->yyidx + 0]->minor; }
#line 2287 "internal.templateparser.php" #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; } function yy_r144(){$this->_retvalue = '{'.$this->yystack[$this->yyidx + 0]->minor; }
#line 2290 "internal.templateparser.php" #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; } function yy_r145(){$this->_retvalue = '`'.$this->yystack[$this->yyidx + 0]->minor; }
#line 2293 "internal.templateparser.php" #line 2293 "internal.templateparser.php"

View File

@@ -10,7 +10,7 @@
/** /**
* Smarty Internal Write File Class * 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 * Writes file in a save way to disk
* *

View File

@@ -11,24 +11,17 @@
*/ */
/** /**
* Smarty class addPluginsDir
*
* Adds directory of plugin files * Adds directory of plugin files
*
* @param object $smarty
* @param string $ |array $ plugins folder
* @return
*/ */
function AddPluginsDir($smarty, $plugins_dir)
class Smarty_Method_AddPluginsDir extends Smarty_Internal_Base { {
/** $smarty->plugins_dir = array_merge((array)$smarty->plugins_dir, (array)$plugins_dir);
* Adds directory of plugin files $smarty->plugins_dir = array_unique($smarty->plugins_dir);
*
* @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; return;
}
} }
?> ?>

View File

@@ -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
*/ */
function clear_all_assign($smarty, $data_object = null)
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)) { if (isset($data_object)) {
$ptr = $data_object; $ptr = $data_object;
} else { } else {
$ptr = $this->smarty; $ptr = $smarty;
} }
$ptr->tpl_vars = array(); $ptr->tpl_vars = array();
}
} }
?> ?>

View File

@@ -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
*/ */
function clear_all_cache($smarty, $exp_time = null, $type = 'file')
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 // load cache resource
if (!isset($this->smarty->cache_resource_objects[$type])) { if (!isset($smarty->cache_resource_objects[$type])) {
$_cache_resource_class = 'Smarty_Internal_CacheResource_' . $type; $_cache_resource_class = 'Smarty_Internal_CacheResource_' . $type;
if (!$this->smarty->loadPlugin($_cache_resource_class)) { if (!$smarty->loadPlugin($_cache_resource_class)) {
throw new Exception("Undefined cache resource type {$type}"); throw new Exception("Undefined cache resource type {$type}");
} }
$this->smarty->cache_resource_objects[$type] = new $_cache_resource_class; $smarty->cache_resource_objects[$type] = new $_cache_resource_class($smarty);
} }
return $this->smarty->cache_resource_objects[$type]->clearAll($exp_time); return $smarty->cache_resource_objects[$type]->clearAll($exp_time);
}
} }
?> ?>

View File

@@ -11,25 +11,19 @@
*/ */
/** /**
* 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
*/ */
function clear_assign($smarty, $varname, $data_object = null)
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) { foreach ((array)$varname as $variable) {
if (isset($data_object)) { if (isset($data_object)) {
$ptr = $data_object; $ptr = $data_object;
} else { } else {
$ptr = $this->smarty; $ptr = $smarty;
} while ($ptr != null) { } while ($ptr != null) {
if (isset($ptr->tpl_vars[$variable])) { if (isset($ptr->tpl_vars[$variable])) {
unset($ptr->tpl_vars[$variable]); unset($ptr->tpl_vars[$variable]);
@@ -38,7 +32,6 @@ class Smarty_Method_Clear_Assign extends Smarty_Internal_Base {
} }
} }
return; return;
}
} }
?> ?>

View File

@@ -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
*/ */
function clear_cache($smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = 'file')
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 // load cache resource
if (!isset($this->smarty->cache_resource_objects[$type])) { if (!isset($smarty->cache_resource_objects[$type])) {
$_cache_resource_class = 'Smarty_Internal_CacheResource_' . $type; $_cache_resource_class = 'Smarty_Internal_CacheResource_' . $type;
if (!$this->smarty->loadPlugin($_cache_resource_class)) { if (!$smarty->loadPlugin($_cache_resource_class)) {
throw new Exception("Undefined cache resource type {$type}"); throw new Exception("Undefined cache resource type {$type}");
} }
$this->smarty->cache_resource_objects[$type] = new $_cache_resource_class; $smarty->cache_resource_objects[$type] = new $_cache_resource_class($smarty);
} }
return $this->smarty->cache_resource_objects[$type]->clear($template_name, $cache_id, $compile_id, $exp_time); return $smarty->cache_resource_objects[$type]->clear($template_name, $cache_id, $compile_id, $exp_time);
}
} }
?> ?>

View File

@@ -11,41 +11,34 @@
*/ */
/** /**
* 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
*/ */
function clear_compiled_tpl($smarty, $resource_name = null, $compile_id = null, $exp_time = null)
class Smarty_Method_Clear_Compiled_Tpl extends Smarty_Internal_Base { {
/** $_dir_sep = $smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
* 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)) { if (isset($resource_name)) {
$_resource_part_1 = $resource_name . $this->smarty->php_ext; $_resource_part_1 = $resource_name . $smarty->php_ext;
$_resource_part_2 = $resource_name . '.cache' . $this->smarty->php_ext; $_resource_part_2 = $resource_name . '.cache' . $smarty->php_ext;
} else { } else {
$_resource_part = ''; $_resource_part = '';
} }
$_dir = $this->smarty->compile_dir; $_dir = $smarty->compile_dir;
if ($this->smarty->use_sub_dirs && isset($compile_id)) { if ($smarty->use_sub_dirs && isset($compile_id)) {
$_dir .= $compile_id . $_dir_sep; $_dir .= $compile_id . $_dir_sep;
} }
if (isset($compile_id)) { if (isset($compile_id)) {
$_compile_id_part = $this->smarty->compile_dir . $compile_id . $_dir_sep; $_compile_id_part = $smarty->compile_dir . $compile_id . $_dir_sep;
} }
$_count = 0; $_count = 0;
$_compileDirs = new RecursiveDirectoryIterator($_dir); $_compileDirs = new RecursiveDirectoryIterator($_dir);
$_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST); $_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST);
foreach ($_compile as $_file) { foreach ($_compile as $_file) {
if (strpos($_file,'.svn') !== false) continue; if (strpos($_file, '.svn') !== false) continue;
if ($_file->isDir()) { if ($_file->isDir()) {
if (!$_compile->isDot()) { if (!$_compile->isDot()) {
// delete folder if empty // delete folder if empty
@@ -66,7 +59,6 @@ class Smarty_Method_Clear_Compiled_Tpl extends Smarty_Internal_Base {
} }
} }
return $_count; return $_count;
}
} }
?> ?>

View File

@@ -11,27 +11,20 @@
*/ */
/** /**
* 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
*/ */
function clear_config($smarty, $varname = 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)) { if (isset($varname)) {
unset($this->smarty->config_vars[$varname]); unset($smarty->config_vars[$varname]);
return; return;
} else { } else {
$this->smarty->config_vars = array(); $smarty->config_vars = array();
return; return;
} }
}
} }
?> ?>

View File

@@ -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
*/ */
function config_load($smarty, $config_file, $sections = 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 // load Config class
$this->smarty->loadPlugin('Smarty_Internal_Config'); $smarty->loadPlugin('Smarty_Internal_Config');
$config = new Smarty_Internal_Config($config_file); $config = new Smarty_Internal_Config($config_file, $smarty);
$config->loadConfigVars($sections, $this->smarty); $config->loadConfigVars($sections, $smarty);
}
} }
?> ?>

View File

@@ -11,16 +11,13 @@
*/ */
/** /**
* Smarty class disableCacheModifyCheck
* *
* Disable cache modify check * Disable cache modify check
*/ */
class Smarty_Method_disableCacheModifyCheck extends Smarty_Internal_Base { function disableCacheModifyCheck($smarty)
public function execute()
{ {
$this->smarty->cache_modified_check = false; $smarty->cache_modified_check = false;
return ; return ;
} }
}
?> ?>

View File

@@ -11,16 +11,12 @@
*/ */
/** /**
* Smarty class disableCaching
*
* Disable caching * Disable caching
*/ */
class Smarty_Method_DisableCaching extends Smarty_Internal_Base { function DisableCaching()
public function execute() {
{
$this->smarty->caching = false; $this->smarty->caching = false;
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,14 @@
*/ */
/** /**
* Smarty class disableCompileCheck
*
* Disable compile checking * Disable compile checking
*
* @param object $smarty
*/ */
class Smarty_Method_DisableCompileCheck extends Smarty_Internal_Base { function DisableCompileCheck($smarty)
public function execute() {
{ $smarty->compile_check = false;
$this->smarty->compile_check = false;
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,12 @@
*/ */
/** /**
* Smarty class disableConfigBooleanize
*
* Disable config booleanize mode * Disable config booleanize mode
*/ */
class Smarty_Method_disableConfigBooleanize extends Smarty_Internal_Base { function disableConfigBooleanize($smarty)
public function execute() {
{
$this->smarty->config_booleanize = false; $this->smarty->config_booleanize = false;
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,11 @@
*/ */
/** /**
* Smarty class disableConfigOverwrite
*
* Disable config overwrite mode * Disable config overwrite mode
*/ */
class Smarty_Method_disableConfigOverwrite extends Smarty_Internal_Base { function disableConfigOverwrite($smarty)
public function execute() {
{ $smarty->config_overwrite = false;
$this->smarty->config_overwrite = false;
return ; return ;
}
} }
?> ?>

View File

@@ -11,16 +11,11 @@
*/ */
/** /**
* Smarty class disableConfigReadHidden
*
* Disable config read hidden mode * Disable config read hidden mode
*/ */
class Smarty_Method_disableConfigReadHidden extends Smarty_Internal_Base { function disableConfigReadHidden ($smarty)
public function execute() {
{
$this->smarty->config_read_hidden = false; $this->smarty->config_read_hidden = false;
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,11 @@
*/ */
/** /**
* Smarty class disableDebugging
*
* Disable debugging * Disable debugging
*/ */
class Smarty_Method_DisableDebugging extends Smarty_Internal_Base { function disableDebugging($smarty)
public function execute() {
{ $smarty->debugging = false;
$this->smarty->debugging = false;
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,12 @@
*/ */
/** /**
* Smarty class disableDebuggingUrlCtrl
*
* Disable possibility to Disable debugging by SMARTY_DEBUG attribute * Disable possibility to Disable debugging by SMARTY_DEBUG attribute
*/ */
class Smarty_Method_disableDebuggingUrlCtrl extends Smarty_Internal_Base { function disableDebuggingUrlCtrl($smarty)
public function execute()
{ {
$this->smarty->debugging_ctrl = 'none'; $smarty->debugging_ctrl = 'none';
return; return;
} }
}
?> ?>

View File

@@ -11,16 +11,12 @@
*/ */
/** /**
* Smarty class disableDefaultTimezone
*
* Disable setting of default timezone * Disable setting of default timezone
*/ */
class Smarty_Method_disableDefaultTimezone extends Smarty_Internal_Base { function disableDefaultTimezone($smarty)
public function execute() {
{ $smarty->set_timezone = false;
$this->smarty->set_timezone = false;
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,12 @@
*/ */
/** /**
* Smarty class disableForceCompile
*
* Disable forced compiling * Disable forced compiling
*/ */
class Smarty_Method_DisableForceCompile extends Smarty_Internal_Base { function disableForceCompile($smarty)
public function execute() {
{ $smarty->force_compile = false;
$this->smarty->force_compile = false;
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,12 @@
*/ */
/** /**
* Smarty class disableVariableFilter
*
* Disable filter on variable output * Disable filter on variable output
*/ */
class Smarty_Method_disableVariableFilter extends Smarty_Internal_Base { function disableVariableFilter($smarty)
public function execute() {
{ $smarty->variable_filter = false;
$this->smarty->variable_filter = false;
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,12 @@
*/ */
/** /**
* Smarty class enableCacheModifyCheck
*
* Enable cache modify check * Enable cache modify check
*/ */
class Smarty_Method_enableCacheModifyCheck extends Smarty_Internal_Base { function enableCacheModifyCheck($smarty)
public function execute() {
{ $smarty->cache_modified_check = true;
$this->smarty->cache_modified_check = true;
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,12 @@
*/ */
/** /**
* Smarty class enableCompileCheck
*
* Enable compile checking * Enable compile checking
*/ */
class Smarty_Method_EnableCompileCheck extends Smarty_Internal_Base { function enableCompileCheck($smarty)
public function execute() {
{ $smarty->compile_check = true;
$this->smarty->compile_check = true;
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,12 @@
*/ */
/** /**
* Smarty class enableConfigBooleanize
*
* Enable config booleanize mode * Enable config booleanize mode
*/ */
class Smarty_Method_enableConfigBooleanize extends Smarty_Internal_Base { function enableConfigBooleanize($smarty)
public function execute() {
{ $smarty->config_booleanize = true;
$this->smarty->config_booleanize = true;
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,12 @@
*/ */
/** /**
* Smarty class enableConfigOverwrite
*
* Enable config overwrite mode * Enable config overwrite mode
*/ */
class Smarty_Method_enableConfigOverwrite extends Smarty_Internal_Base { public function enableConfigOverwrite($smarty)
public function execute() {
{ $smarty->config_overwrite = true;
$this->smarty->config_overwrite = true;
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,12 @@
*/ */
/** /**
* Smarty class enableConfigReadHidden
*
* Enable config read hidden mode * Enable config read hidden mode
*/ */
class Smarty_Method_enableConfigReadHidden extends Smarty_Internal_Base { function enableConfigReadHidden($smarty)
public function execute() {
{
$this->smarty->config_read_hidden = true; $this->smarty->config_read_hidden = true;
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,12 @@
*/ */
/** /**
* Smarty class enableDebugging
*
* Enable debugging * Enable debugging
*/ */
class Smarty_Method_EnableDebugging extends Smarty_Internal_Base { public function enableDebugging($smarty)
public function execute() {
{
$this->smarty->debugging = true; $this->smarty->debugging = true;
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,12 @@
*/ */
/** /**
* Smarty class enableDebuggingUrlCtrl
*
* Enable possibility to enable debugging by SMARTY_DEBUG attribute * Enable possibility to enable debugging by SMARTY_DEBUG attribute
*/ */
class Smarty_Method_EnableDebuggingUrlCtrl extends Smarty_Internal_Base { function enableDebuggingUrlCtrl($smarty)
public function execute() {
{ $smarty->debugging_ctrl = 'URL';
$this->smarty->debugging_ctrl = 'URL';
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,12 @@
*/ */
/** /**
* Smarty class enableDefaultTimezone
*
* Enable setting of default timezone * Enable setting of default timezone
*/ */
class Smarty_Method_enableDefaultTimezone extends Smarty_Internal_Base { function enableDefaultTimezone($smarty)
public function execute() {
{
$this->smarty->set_timezone = true; $this->smarty->set_timezone = true;
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,12 @@
*/ */
/** /**
* Smarty class enableForceCompile
*
* Enable forced compiling * Enable forced compiling
*/ */
class Smarty_Method_enableForceCompile extends Smarty_Internal_Base { public function enableForceCompile($smarty)
public function execute() {
{ $smarty->force_compile = true;
$this->smarty->force_compile = true;
return; return;
}
} }
?> ?>

View File

@@ -11,16 +11,12 @@
*/ */
/** /**
* Smarty class enableVariableFilter
*
* Enable filter on variable output * Enable filter on variable output
*/ */
class Smarty_Method_enableVariableFilter extends Smarty_Internal_Base { function enableVariableFilter($smarty)
public function execute() {
{ $smarty->variable_filter = true;
$this->smarty->variable_filter = true;
return; return;
}
} }
?> ?>

View File

@@ -11,29 +11,25 @@
*/ */
/** /**
* Smarty class Get_Config_Vars
*
* Returns a single or all global config variables * 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
* Returns a single or all global config variables *
* * @param string $varname variable name or null
* @param string $varname variable name or null * @return string variable value or or array of variables
* @return string variable value or or array of variables */
*/ function Get_Config_Vars($smarty, $varname = null)
public function execute($varname = null) {
{
if (isset($varname)) { if (isset($varname)) {
if (isset($this->smarty->config_vars[$varname])) { if (isset($smarty->config_vars[$varname])) {
return $this->smarty->config_vars[$varname]; return $smarty->config_vars[$varname];
} else { } else {
return ''; return '';
} }
} else { } else {
return $this->smarty->config_vars; return $smarty->config_vars;
}
} }
} }

View File

@@ -11,34 +11,27 @@
*/ */
/** /**
* Smarty class Get_Global
*
* Returns a single or all global variables * Returns a single or all global variables
*
* @param object $smarty
* @param string $varname variable name or null
* @return string variable value or or array of variables
*/ */
function get_global($smarty, $varname = null)
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($varname)) {
if (isset($this->smarty->global_tpl_vars[$varname])) { if (isset($smarty->global_tpl_vars[$varname])) {
return $this->smarty->global_tpl_vars[$varname]->value; return $smarty->global_tpl_vars[$varname]->value;
} else { } else {
return ''; return '';
} }
} else { } else {
$_result = array(); $_result = array();
foreach ($this->smarty->global_tpl_vars AS $key => $var) { foreach ($smarty->global_tpl_vars AS $key => $var) {
$_result[$key] = $var->value; $_result[$key] = $var->value;
} }
return $_result; return $_result;
} }
}
} }
?> ?>

View File

@@ -11,27 +11,24 @@
*/ */
/** /**
* Smarty class Get_Registered_Object
*
* Returns a reference to a 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
* return a reference to a registered object *
* * @param string $name
* @param string $name * @return object
* @return object */
*/ function get_registered_object($smarty, $name)
public function execute($name) { {
if (!isset($this->smarty->registered_objects[$name])) if (!isset($smarty->registered_objects[$name]))
throw new Exception("'$name' is not a registered object"); 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"); throw new Exception("registered '$name' is not an object");
return $this->smarty->registered_objects[$name][0]; return $smarty->registered_objects[$name][0];
}
} }
?> ?>

View File

@@ -11,22 +11,19 @@
*/ */
/** /**
* Smarty class Get_Template_Vars
*
* Returns a single or all template variables * Returns a single or all template variables
*/ */
class Smarty_Method_Get_Template_Vars extends Smarty_Internal_Base { /**
/** * Returns a single or all template variables
* Returns a single or all template variables *
* * @param string $varname variable name or null
* @param string $varname variable name or null * @return string variable value or or array of variables
* @return string variable value or or array of variables */
*/ function get_template_vars($smarty, $varname = null, $_ptr = null, $search_parents = true)
public function execute($varname = null, $_ptr = null, $search_parents = true) {
{
if (isset($varname)) { if (isset($varname)) {
$_var = $this->smarty->getVariable($varname, $_ptr, $search_parents); $_var = $smarty->getVariable($varname, $_ptr, $search_parents);
if (is_object($_var)) { if (is_object($_var)) {
return $_var->value; return $_var->value;
} else { } else {
@@ -35,7 +32,7 @@ class Smarty_Method_Get_Template_Vars extends Smarty_Internal_Base {
} else { } else {
$_result = array(); $_result = array();
if ($_ptr === null) { if ($_ptr === null) {
$_ptr = $this->smarty; $_ptr = $smarty;
} while ($_ptr !== null) { } while ($_ptr !== null) {
foreach ($_ptr->tpl_vars AS $key => $var) { foreach ($_ptr->tpl_vars AS $key => $var) {
$_result[$key] = $var->value; $_result[$key] = $var->value;
@@ -48,13 +45,12 @@ class Smarty_Method_Get_Template_Vars extends Smarty_Internal_Base {
} }
} }
if ($search_parents) { if ($search_parents) {
foreach ($this->smarty->global_tpl_vars AS $key => $var) { foreach ($smarty->global_tpl_vars AS $key => $var) {
$_result[$key] = $var->value; $_result[$key] = $var->value;
} }
} }
return $_result; return $_result;
} }
}
} }
?> ?>

View File

@@ -11,21 +11,17 @@
*/ */
/** /**
* Smarty class getCacheDir
*
* Returns directory of cache files * Returns directory of cache files
*/ */
class Smarty_Method_GetCacheDir extends Smarty_Internal_Base { /**
/** * Returns directory of cache files
* Returns directory of cache files *
* * @return array cache folder
* @return array cache folder */
*/ public function getCacheDir($smarty)
public function execute() {
{
return $this->smarty->cache_dir; return $this->smarty->cache_dir;
}
} }
?> ?>

View File

@@ -15,16 +15,14 @@
* *
* Returns lifetime of cache files * Returns lifetime of cache files
*/ */
class Smarty_Method_GetCacheLifetime extends Smarty_Internal_Base { /**
/**
* Returns lifetime of cache files * Returns lifetime of cache files
* *
* @return integer cache file lifetime * @return integer cache file lifetime
*/ */
public function execute() function getCacheLifetime($smarty)
{ {
return $this->smarty->cache_lifetime; return $smarty->cache_lifetime;
}
} }
?> ?>

View File

@@ -11,21 +11,17 @@
*/ */
/** /**
* Smarty class getCompileDir
*
* Returns directory of compiled templates * Returns directory of compiled templates
*/ */
class Smarty_Method_GetCompileDir extends Smarty_Internal_Base { /**
/**
* Returns directory of compiled templates * Returns directory of compiled templates
* *
* @return array compiled template folder * @return array compiled template folder
*/ */
public function execute() function GetCompileDir($smarty)
{ {
return $this->smarty->compile_dir; return $this->smarty->compile_dir;
}
} }
?> ?>

View File

@@ -11,21 +11,17 @@
*/ */
/** /**
* Smarty class getConfigDir
*
* Returns directory of config files * Returns directory of config files
*/ */
class Smarty_Method_GetConfigDir extends Smarty_Internal_Base { /**
/** * Returns directory of config files
* Returns directory of config files *
* * @return array config folder
* @return array config folder */
*/ function getConfigDir($smarty)
public function execute() {
{ return $smarty->config_dir;
return $this->smarty->config_dir;
}
} }
?> ?>

View File

@@ -11,21 +11,17 @@
*/ */
/** /**
* Smarty class getDebugTemplate
*
* Returns debug template filepath * Returns debug template filepath
*/ */
class Smarty_Method_GetDebugTemplate extends Smarty_Internal_Base { /**
/** * Returns directory of cache files
* Returns directory of cache files *
* * @return string debug template filepath
* @return string debug template filepath */
*/ function GetDebugTemplate($smarty)
public function execute() {
{ return $smarty->debug_tpl;
return $this->smarty->debug_tpl;
}
} }
?> ?>

View File

@@ -11,21 +11,17 @@
*/ */
/** /**
* Smarty class getPluginsDir
*
* Returns directory of plugins * Returns directory of plugins
*/ */
class Smarty_Method_GetPluginsDir extends Smarty_Internal_Base { /**
/** * Returns directory of plugins
* Returns directory of plugins *
* * @return array plugins folder
* @return array plugins folder */
*/ function getPluginsDir($smarty)
public function execute() {
{ return $smarty->plugins_dir;
return $this->smarty->plugins_dir;
}
} }
?> ?>

View File

@@ -11,21 +11,17 @@
*/ */
/** /**
* Smarty class getTemplate_dir
*
* Returns template directory * Returns template directory
*/ */
class Smarty_Method_GetTemplateDir extends Smarty_Internal_Base { /**
/** * Returns template directory
* Returns template directory *
* * @return array template folders
* @return array template folders */
*/ function getTemplateDir($smarty)
public function execute() {
{ return $smarty->template_dir;
return $this->smarty->template_dir;
}
} }
?> ?>

View File

@@ -15,11 +15,9 @@
* *
* get status of filter on variable output * get status of filter on variable output
*/ */
class Smarty_Method_getVariableFilter extends Smarty_Internal_Base { function getVariableFilter($smarty)
public function execute() {
{ return $smarty->variable_filter;
return $this->smarty->variable_filter;
}
} }
?> ?>

View File

@@ -11,15 +11,11 @@
*/ */
/** /**
* Smarty class isCacheModifyCheck
*
* is cache modify check * is cache modify check
*/ */
class Smarty_Method_isCacheModifyCheck extends Smarty_Internal_Base { function isCacheModifyCheck()
public function execute() {
{ return $smarty->cache_modified_check;
return $this->smarty->cache_modified_check;
}
} }
?> ?>

View File

@@ -11,15 +11,11 @@
*/ */
/** /**
* Smarty class isCaching
*
* is caching * is caching
*/ */
class Smarty_Method_isCaching extends Smarty_Internal_Base { function isCaching($smarty)
public function execute() {
{ return $smarty->caching;
return $this->smarty->caching;
}
} }
?> ?>

View File

@@ -11,15 +11,11 @@
*/ */
/** /**
* Smarty class isCompileCheck
*
* is compile checking * is compile checking
*/ */
class Smarty_Method_isCompileCheck extends Smarty_Internal_Base { function isCompileCheck($smarty)
public function execute() {
{ return $smarty->compile_check;
return $this->smarty->compile_check;
}
} }
?> ?>

View File

@@ -11,15 +11,11 @@
*/ */
/** /**
* Smarty class isConfigBooleanize
*
* is config booleanize mode * is config booleanize mode
*/ */
class Smarty_Method_isConfigBooleanize extends Smarty_Internal_Base { public function isConfigBooleanize($smarty)
public function execute() {
{ return $smarty->config_booleanize;
return $this->smarty->config_booleanize;
}
} }
?> ?>

View File

@@ -11,16 +11,11 @@
*/ */
/** /**
* Smarty class isConfigOverwrite
*
* is config overwrite mode * is config overwrite mode
*/ */
class Smarty_Method_isConfigOverwrite extends Smarty_Internal_Base { function isConfigOverwrite($smarty)
public function execute() {
{ return $smarty->config_overwrite;
return $this->smarty->config_overwrite;
}
} }
?> ?>

View File

@@ -11,15 +11,11 @@
*/ */
/** /**
* Smarty class isConfigReadHidden
* *
* is config read hidden mode * is config read hidden mode
*/ */
class Smarty_Method_isConfigReadHidden extends Smarty_Internal_Base { function isConfigReadHidden($smarty)
public function execute()
{ {
return $this->smarty->config_read_hidden; return $smarty->config_read_hidden;
} }
}
?> ?>

View File

@@ -11,15 +11,11 @@
*/ */
/** /**
* Smarty class isDebugging
*
* is debugging * is debugging
*/ */
class Smarty_Method_isDebugging extends Smarty_Internal_Base { function isDebugging($smarty)
public function execute() {
{ return $smarty->debugging;
return $this->smarty->debugging;
}
} }
?> ?>

View File

@@ -11,15 +11,11 @@
*/ */
/** /**
* Smarty class isDebuggingUrlCtrl
*
* is possibility to is debugging by SMARTY_DEBUG attribute * is possibility to is debugging by SMARTY_DEBUG attribute
*/ */
class Smarty_Method_isDebuggingUrlCtrl extends Smarty_Internal_Base { function isDebuggingUrlCtrl($smarty)
public function execute() {
{ return $smarty->debugging_ctrl != 'none';
return $this->smarty->debugging_ctrl != 'none';
}
} }
?> ?>

View File

@@ -11,15 +11,11 @@
*/ */
/** /**
* Smarty class isDefaultTimezone
*
* is setting of default timezone * is setting of default timezone
*/ */
class Smarty_Method_isDefaultTimezone extends Smarty_Internal_Base { function isDefaultTimezone($smarty)
public function execute() {
{ return $smarty->set_timezone = false;
return $this->smarty->set_timezone = false;
}
} }
?> ?>

View File

@@ -11,15 +11,13 @@
*/ */
/** /**
* Smarty class isForceCompile
* *
* is forced compiling * is forced compiling
*/ */
class Smarty_Method_isForceCompile extends Smarty_Internal_Base { function isForceCompile($smarty)
public function execute()
{ {
return $this->smarty->force_compile; return $smarty->force_compile;
} }
}
?> ?>

View File

@@ -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
*/ */
function load_filter($smarty, $type, $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}"; $_plugin = "smarty_{$type}filter_{$name}";
$_filter_name = $_plugin; $_filter_name = $_plugin;
if ($this->smarty->loadPlugin($_plugin)) { if ($smarty->loadPlugin($_plugin)) {
if (class_exists($_plugin, false)) { if (class_exists($_plugin, false)) {
$_plugin = array($_plugin, 'execute'); $_plugin = array($_plugin, 'execute');
} }
if (is_callable($_plugin)) { if (is_callable($_plugin)) {
$this->smarty->registered_filters[$type][$_filter_name] = $_plugin; $smarty->registered_filters[$type][$_filter_name] = $_plugin;
return; return;
} }
} }
throw new Exception("{$type}filter \"{$name}\" not callable"); throw new Exception("{$type}filter \"{$name}\" not callable");
}
} }
?> ?>

View File

@@ -11,30 +11,26 @@
*/ */
/** /**
* Smarty class Register_Block
*
* Register a PHP function as Smarty block function plugin * 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
* Registers block function to be used in templates *
* * @param string $block_tag name of template block
* @param string $block_tag name of template block * @param string $block_impl PHP function to register
* @param string $block_impl PHP function to register * @param boolean $cacheable if true (default) this fuction is cachable
* @param boolean $cacheable if true (default) this fuction is cachable */
*/ function register_block($smarty, $block_tag, $block_impl, $cacheable = true)
public function execute($block_tag, $block_impl, $cacheable = true) {
{ if (isset($smarty->registered_plugins[$block_tag])) {
if (isset($this->smarty->registered_plugins[$block_tag])) {
throw new Exception("Plugin tag \"{$block_tag}\" already registered"); throw new Exception("Plugin tag \"{$block_tag}\" already registered");
} elseif (!is_callable($block_impl)) { } elseif (!is_callable($block_impl)) {
throw new Exception("Plugin \"{$block_tag}\" not callable"); throw new Exception("Plugin \"{$block_tag}\" not callable");
} else { } else {
$this->smarty->registered_plugins[$block_tag] = $smarty->registered_plugins[$block_tag] =
array('block', $block_impl, $cacheable); array('block', $block_impl, $cacheable);
} }
}
} }
?> ?>

View File

@@ -11,29 +11,25 @@
*/ */
/** /**
* Smarty class Register_Compiler_Function
*
* Register a PHP function as Smarty compiler function plugin * Register a PHP function as Smarty compiler function plugin
*/ */
class Smarty_Method_Register_Compiler_Function extends Smarty_Internal_Base { /**
/** * Registers compiler function
* Registers compiler function *
* * @param string $compiler_tag of template function
* @param string $compiler_tag of template function * @param string $compiler_impl name of PHP function to register
* @param string $compiler_impl name of PHP function to register */
*/ function register_compiler_function($smarty, $compiler_tag, $compiler_impl, $cacheable = true)
public function execute($compiler_tag, $compiler_impl, $cacheable = true) {
{ if (isset($smarty->registered_plugins[$compiler_tag])) {
if (isset($this->smarty->registered_plugins[$compiler_tag])) {
throw new Exception("Plugin tag \"{$compiler_tag}\" already registered"); throw new Exception("Plugin tag \"{$compiler_tag}\" already registered");
} elseif (!is_callable($compiler_impl)) { } elseif (!is_callable($compiler_impl)) {
throw new Exception("Plugin \"{$compiler_tag}\" not callable"); throw new Exception("Plugin \"{$compiler_tag}\" not callable");
} else { } else {
$this->smarty->registered_plugins[$compiler_tag] = $smarty->registered_plugins[$compiler_tag] =
array('compiler', $compiler_impl, $cacheable); array('compiler', $compiler_impl, $cacheable);
} }
}
} }
?> ?>

View File

@@ -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
*/ */
function register_function($smarty, $function_tag, $function_impl, $cacheable = true)
class Smarty_Method_Register_Function extends Smarty_Internal_Base { {
/** if (isset($smarty->registered_plugins[$function_tag])) {
* 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"); throw new Exception("Plugin tag \"{$function_tag}\" already registered");
} elseif (!is_callable($function_impl)) { } elseif (!is_callable($function_impl)) {
throw new Exception("Plugin \"{$function_tag}\" not callable"); throw new Exception("Plugin \"{$function_tag}\" not callable");
} else { } else {
$this->smarty->registered_plugins[$function_tag] = $smarty->registered_plugins[$function_tag] =
array('function', $function_impl, $cacheable); array('function', $function_impl, $cacheable);
} }
}
} }
?> ?>

View File

@@ -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
*/ */
function register_modifier($smarty, $modifier, $modifier_impl)
class Smarty_Method_Register_Modifier extends Smarty_Internal_Base { {
/** if (isset($smarty->registered_plugins[$modifier])) {
* 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"); throw new Exception("Plugin \"{$modifier}\" already registered");
} elseif (!is_callable($modifier_impl)) { } elseif (!is_callable($modifier_impl)) {
throw new Exception("Plugin \"{$modifier}\" not callable"); throw new Exception("Plugin \"{$modifier}\" not callable");
} else { } else {
$this->smarty->registered_plugins[$modifier] = $smarty->registered_plugins[$modifier] =
array('modifier', $modifier_impl); array('modifier', $modifier_impl);
} }
}
} }
?> ?>

View File

@@ -11,23 +11,17 @@
*/ */
/** /**
* 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
*/ */
function register_object($smarty, $object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
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 // test if allowed methodes callable
if (!empty($allowed)) { if (!empty($allowed)) {
foreach ((array)$allowed as $methode) { foreach ((array)$allowed as $methode) {
@@ -45,9 +39,8 @@ class Smarty_Method_Register_Object extends Smarty_Internal_Base {
} }
} }
// register the object // register the object
$this->smarty->registered_objects[$object] = $smarty->registered_objects[$object] =
array($object_impl, (array)$allowed, (boolean)$smarty_args, (array)$block_methods); array($object_impl, (array)$allowed, (boolean)$smarty_args, (array)$block_methods);
}
} }
?> ?>

View File

@@ -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
*/ */
function register_outputfilter($smarty, $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; $_name = (is_array($function)) ? $function[0] : $function;
$this->smarty->registered_filters['output'][$_name] = $function; $smarty->registered_filters['output'][$_name] = $function;
}
} }
?> ?>

View File

@@ -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
*/ */
function register_postfilter($smarty, $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; $_name = (is_array($function)) ? $function[0] : $function;
$this->smarty->registered_filters['post'][$_name] = $function; $smarty->registered_filters['post'][$_name] = $function;
}
} }
?> ?>

View File

@@ -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
*/ */
function register_prefilter($smarty, $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; $_name = (is_array($function)) ? $function[0] : $function;
$this->smarty->registered_filters['pre'][$_name] = $function; $smarty->registered_filters['pre'][$_name] = $function;
}
} }
?> ?>

View File

@@ -11,30 +11,23 @@
*/ */
/** /**
* 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
*/ */
function register_resource($smarty, $type, $functions)
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) { if (count($functions) == 4) {
$this->_plugins['resource'][$type] = $smarty->_plugins['resource'][$type] =
array($functions, false); array($functions, false);
} elseif (count($functions) == 5) { } elseif (count($functions) == 5) {
$this->smarty->plugins['resource'][$type] = $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); array(array(array(&$functions[0], $functions[1]) , array(&$functions[0], $functions[2]) , array(&$functions[0], $functions[3]) , array(&$functions[0], $functions[4])) , false);
} else { } else {
throw new Exception("malformed function-list for '$type' in register_resource"); throw new Exception("malformed function-list for '$type' in register_resource");
} }
}
} }
?> ?>

View File

@@ -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
*/ */
function register_variablefilter($smarty, $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; $_name = (is_array($function)) ? $function[0] : $function;
$this->smarty->registered_filters['variable'][$_name] = $function; $smarty->registered_filters['variable'][$_name] = $function;
}
} }
?> ?>

View File

@@ -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
*/ */
function registerDefaultPluginHandler($smarty, $plugin)
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)) { if (is_callable($plugin)) {
$this->smarty->default_plugin_handler_func = $plugin; $smarty->default_plugin_handler_func = $plugin;
} else { } else {
throw new Exception('Default plugin handler "'.$plugin.'" not callable'); throw new Exception('Default plugin handler "' . $plugin . '" not callable');
}
} }
} }

View File

@@ -11,24 +11,17 @@
*/ */
/** /**
* Smarty class registerDefaultTemplateHandler
*
* Registers a default template handler * Registers a default template handler
*
* @param object $smarty
* @param string $ |array $function class/methode name
*/ */
function registerDefaultTemplateHandler($smarty, $function)
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)) { if (is_callable($function)) {
$this->smarty->default_template_handler_func = $function; $smarty->default_template_handler_func = $function;
} else { } else {
throw new Exception('Default template handler "'.$function.'" not callable'); throw new Exception('Default template handler "' . $function . '" not callable');
}
} }
} }

View File

@@ -11,23 +11,16 @@
*/ */
/** /**
* Smarty class setConfigDir
*
* Sets directory of config files * Sets directory of config files
*
* @param object $smarty
* @param string $ config folder
* @return
*/ */
function SetConfigDir($smarty, $config_dir)
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; $this->smarty->config_dir = $config_dir;
return; return;
}
} }
?> ?>

View File

@@ -11,22 +11,18 @@
*/ */
/** /**
* Smarty class setDebugTemplate
*
* Sets debug template filepath * Sets debug template filepath
*/ */
class Smarty_Method_SetDebugTemplate extends Smarty_Internal_Base { /**
/** * Sets debug template filepath
* Sets debug template filepath *
* * @param string $ array debug template filepath
* @param string $ array debug template filepath */
*/ function SetDebugTemplate(smarty, $debug_tpl)
public function execute($debug_tpl) {
{ $smarty->debug_tpl = $debug_tpl;
$this->smarty->debug_tpl = $debug_tpl;
return; return;
}
} }
?> ?>

View File

@@ -11,23 +11,19 @@
*/ */
/** /**
* Smarty class setPluginsDir
*
* Sets directory of plugin files * Sets directory of plugin files
*/ */
class Smarty_Method_SetPluginsDir extends Smarty_Internal_Base { /**
/** * Sets directory of plugin files
* Sets directory of plugin files *
* * @param string $ plugins folder
* @param string $ plugins folder * @return
* @return */
*/ function SetPluginsDir($smarty, $plugins_dir)
public function execute($plugins_dir) {
{ $smarty->plugins_dir = (array)$plugins_dir;
$this->smarty->plugins_dir = (array)$plugins_dir;
return; return;
}
} }
?> ?>

View File

@@ -11,21 +11,18 @@
*/ */
/** /**
* Smarty class Template_Exists
*
* Checks if a template resource exists * Checks if a template resource exists
*/ */
class Smarty_Method_Template_Exists extends Smarty_Internal_Base { /**
/** * Check if a template resource exists
* Check if a template resource exists *
* * @param string $resource_name template name
* @param string $resource_name template name * @return boolean status
* @return boolean status */
*/ function template_exists($smarty, $resource_name)
public function execute($resource_name) {
{ foreach((array)$smarty->template_dir as $_template_dir) {
foreach((array)$this->smarty->template_dir as $_template_dir) {
$_filepath = $_template_dir . $resource_name; $_filepath = $_template_dir . $resource_name;
if (file_exists($_filepath)) if (file_exists($_filepath))
return true; return true;
@@ -33,7 +30,6 @@ class Smarty_Method_Template_Exists extends Smarty_Internal_Base {
if (file_exists($resource_name)) return true; if (file_exists($resource_name)) return true;
// no tpl file found // no tpl file found
return false; return false;
}
} }
?> ?>

View File

@@ -1,27 +1,25 @@
<?php <?php
/** /**
* Smarty plugin * Smarty plugin
*
* @ignore * @ignore
* @package Smarty * @package Smarty
* @subpackage plugins * @subpackage plugins
*/ */
class Smarty_Method_Test extends Smarty_Internal_Base {
public function execute() {
function test($smarty)
{
echo "<PRE>\n"; echo "<PRE>\n";
echo "Smarty Installation test...\n"; echo "Smarty Installation test...\n";
echo "Testing template directory...\n"; echo "Testing template directory...\n";
foreach((array)$this->smarty->template_dir as $template_dir) foreach((array)$smarty->template_dir as $template_dir) {
{ if (!is_dir($template_dir))
if(!is_dir($template_dir))
echo "FAILED: $template_dir is not a directory.\n"; echo "FAILED: $template_dir is not a directory.\n";
elseif(!is_readable($template_dir)) elseif (!is_readable($template_dir))
echo "FAILED: $template_dir is not readable.\n"; echo "FAILED: $template_dir is not readable.\n";
else else
echo "$template_dir is OK.\n"; echo "$template_dir is OK.\n";
@@ -29,32 +27,30 @@ class Smarty_Method_Test extends Smarty_Internal_Base {
echo "Testing compile directory...\n"; echo "Testing compile directory...\n";
if(!is_dir($this->smarty->compile_dir)) if (!is_dir($smarty->compile_dir))
echo "FAILED: $compile_dir is not a directory.\n"; echo "FAILED: $smarty->compile_dir is not a directory.\n";
elseif(!is_readable($this->smarty->compile_dir)) elseif (!is_readable($smarty->compile_dir))
echo "FAILED: $compile_dir is not readable.\n"; echo "FAILED: $smarty->compile_dir is not readable.\n";
elseif(!is_writable($this->smarty->compile_dir)) elseif (!is_writable($smarty->compile_dir))
echo "FAILED: $compile_dir is not writable.\n"; echo "FAILED: $smarty->compile_dir is not writable.\n";
else else
echo "{$this->smarty->compile_dir} is OK.\n"; echo "{$smarty->compile_dir} is OK.\n";
echo "Testing sysplugins directory...\n"; echo "Testing sysplugins directory...\n";
if(!is_dir($this->smarty->sysplugins_dir)) if (!is_dir($smarty->sysplugins_dir))
echo "FAILED: $sysplugins_dir is not a directory.\n"; echo "FAILED: $smarty->sysplugins_dir is not a directory.\n";
elseif(!is_readable($this->smarty->sysplugins_dir)) elseif (!is_readable($smarty->sysplugins_dir))
echo "FAILED: $sysplugins_dir is not readable.\n"; echo "FAILED: $smarty->sysplugins_dir is not readable.\n";
else else
echo "{$this->smarty->sysplugins_dir} is OK.\n"; echo "{$smarty->sysplugins_dir} is OK.\n";
echo "Testing plugins directory...\n"; echo "Testing plugins directory...\n";
foreach((array)$this->smarty->plugins_dir as $plugin_dir) foreach((array)$smarty->plugins_dir as $plugin_dir) {
{ if (!is_dir($plugin_dir))
if(!is_dir($plugin_dir))
echo "FAILED: $plugin_dir is not a directory.\n"; echo "FAILED: $plugin_dir is not a directory.\n";
elseif(!is_readable($plugin_dir)) elseif (!is_readable($plugin_dir))
echo "FAILED: $plugin_dir is not readable.\n"; echo "FAILED: $plugin_dir is not readable.\n";
else else
echo "$plugin_dir is OK.\n"; echo "$plugin_dir is OK.\n";
@@ -62,32 +58,29 @@ class Smarty_Method_Test extends Smarty_Internal_Base {
echo "Testing cache directory...\n"; echo "Testing cache directory...\n";
if(!is_dir($this->smarty->cache_dir)) if (!is_dir($smarty->cache_dir))
echo "FAILED: $cache_dir is not a directory.\n"; echo "FAILED: $smarty->cache_dir is not a directory.\n";
elseif(!is_readable($this->smarty->cache_dir)) elseif (!is_readable($smarty->cache_dir))
echo "FAILED: $cache_dir is not readable.\n"; echo "FAILED: $smarty->cache_dir is not readable.\n";
elseif(!is_writable($this->smarty->cache_dir)) elseif (!is_writable($smarty->cache_dir))
echo "FAILED: $cache_dir is not writable.\n"; echo "FAILED: $smarty->cache_dir is not writable.\n";
else else
echo "{$this->smarty->cache_dir} is OK.\n"; echo "{$smarty->cache_dir} is OK.\n";
echo "Testing configs directory...\n"; echo "Testing configs directory...\n";
if(!is_dir($this->smarty->config_dir)) if (!is_dir($smarty->config_dir))
echo "FAILED: $config_dir is not a directory.\n"; echo "FAILED: $smarty->config_dir is not a directory.\n";
elseif(!is_readable($this->smarty->config_dir)) elseif (!is_readable($smarty->config_dir))
echo "FAILED: $config_dir is not readable.\n"; echo "FAILED: $smarty->config_dir is not readable.\n";
else else
echo "{$this->smarty->config_dir} is OK.\n"; echo "{$smarty->config_dir} is OK.\n";
echo "Tests complete.\n"; echo "Tests complete.\n";
echo "</PRE>\n"; echo "</PRE>\n";
return true; return true;
}
} }
?> ?>

Some files were not shown because too many files have changed in this diff Show More