mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- convert debug console processing to object
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
- introduce Smarty::$resource_cache_mode and cache template object of {include} inside loop
|
||||
- load seldom used Smarty API methods dynamically to reduce memory footprint
|
||||
- cache template object of {include} if same template is included several times
|
||||
- convert debug console processing to object
|
||||
|
||||
06.08.2015
|
||||
- avoid possible circular object references caused by parser/lexer objects
|
||||
|
@@ -741,6 +741,13 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
*/
|
||||
public $_objType = 1;
|
||||
|
||||
/**
|
||||
* Debug object
|
||||
*
|
||||
* @var Smarty_Internal_Debug
|
||||
*/
|
||||
public $_debug = null;
|
||||
|
||||
/**
|
||||
* removed properties
|
||||
*
|
||||
@@ -1190,6 +1197,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
} else {
|
||||
$data = null;
|
||||
}
|
||||
/* var Smarty $tpl */
|
||||
$tpl = new $this->template_class($template, $this, $parent, $cache_id, $compile_id);
|
||||
if ($do_clone) {
|
||||
$tpl->smarty = clone $tpl->smarty;
|
||||
@@ -1202,7 +1210,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
}
|
||||
}
|
||||
if ($this->debugging) {
|
||||
Smarty_Internal_Debug::register_template($tpl);
|
||||
$tpl->smarty->_debug = new Smarty_Internal_Debug();
|
||||
}
|
||||
return $tpl;
|
||||
}
|
||||
|
@@ -160,7 +160,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase
|
||||
$_tpl = new Smarty_Internal_template('string:' .
|
||||
$compiler->template->block_data[$_name]['source'], $compiler->smarty, $compiler->template, $compiler->template->cache_id, $compiler->template->compile_id, $compiler->template->caching, $compiler->template->cache_lifetime);
|
||||
if ($compiler->smarty->debugging) {
|
||||
Smarty_Internal_Debug::ignore($_tpl);
|
||||
$compiler->smarty->_debug->ignore($_tpl);
|
||||
}
|
||||
$_tpl->tpl_vars = $compiler->template->tpl_vars;
|
||||
$_tpl->variable_filters = $compiler->template->variable_filters;
|
||||
|
@@ -34,8 +34,8 @@ class Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase
|
||||
$compiler->tag_nocache = true;
|
||||
|
||||
// display debug template
|
||||
$_output = "<?php \$_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug(\$_smarty_tpl); ?>";
|
||||
|
||||
$_output = "<?php \$_smarty_debug = new Smarty_Internal_Debug;\n \$_smarty_debug->display_debug(\$_smarty_tpl);\n";
|
||||
$_output .= "unset(\$_smarty_debug);\n?>";
|
||||
return $_output;
|
||||
}
|
||||
}
|
||||
|
@@ -105,7 +105,7 @@ class Smarty_Internal_Config_File_Compiler
|
||||
$this->template->source->getTimeStamp(),
|
||||
$this->template->source->type);
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::start_compile($this->template);
|
||||
$this->smarty->_debug->start_compile($this->template);
|
||||
}
|
||||
// init the lexer/parser to compile the config file
|
||||
$lex = new $this->lexer_class(str_replace(array("\r\n", "\r"), "\n", $template->source->getContent()) .
|
||||
@@ -136,7 +136,7 @@ class Smarty_Internal_Config_File_Compiler
|
||||
mb_internal_encoding($mbEncoding);
|
||||
}
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::end_compile($this->template);
|
||||
$this->smarty->_debug->end_compile($this->template);
|
||||
}
|
||||
// template header code
|
||||
$template_header = "<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " .
|
||||
|
@@ -21,28 +21,32 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $template_data = array();
|
||||
public $template_data = array();
|
||||
|
||||
/**
|
||||
* List of uid's which shall be ignored
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $ignore_uid = array();
|
||||
public $ignore_uid = array();
|
||||
|
||||
/**
|
||||
* Index of display() and fetch() calls
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public static $index = 0;
|
||||
public $index = 0;
|
||||
|
||||
/**
|
||||
* Counter for window offset
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public static $offset = 0;
|
||||
public $offset = 0;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Start logging template
|
||||
@@ -50,15 +54,15 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
* @param \Smarty_Internal_Template $template template
|
||||
* @param null $mode true: display false: fetch null: subtemolate
|
||||
*/
|
||||
public static function start_template(Smarty_Internal_Template $template, $mode = null)
|
||||
public function start_template(Smarty_Internal_Template $template, $mode = null)
|
||||
{
|
||||
if (isset($mode)) {
|
||||
self::$index ++;
|
||||
self::$offset ++;
|
||||
self::$template_data[self::$index] = null;
|
||||
$this->index ++;
|
||||
$this->offset ++;
|
||||
$this->template_data[$this->index] = null;
|
||||
}
|
||||
$key = self::get_key($template);
|
||||
self::$template_data[self::$index][$key]['start_template_time'] = microtime(true);
|
||||
$key = $this->get_key($template);
|
||||
$this->template_data[$this->index][$key]['start_template_time'] = microtime(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,11 +70,11 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
*
|
||||
* @param \Smarty_Internal_Template $template cached template
|
||||
*/
|
||||
public static function end_template(Smarty_Internal_Template $template)
|
||||
public function end_template(Smarty_Internal_Template $template)
|
||||
{
|
||||
$key = self::get_key($template);
|
||||
self::$template_data[self::$index][$key]['total_time'] += microtime(true) - self::$template_data[self::$index][$key]['start_template_time'];
|
||||
//self::$template_data[self::$index][$key]['properties'] = $template->properties;
|
||||
$key = $this->get_key($template);
|
||||
$this->template_data[$this->index][$key]['total_time'] += microtime(true) - $this->template_data[$this->index][$key]['start_template_time'];
|
||||
//$this->template_data[$this->index][$key]['properties'] = $template->properties;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,28 +82,28 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
*
|
||||
* @param \Smarty_Internal_Template $template
|
||||
*/
|
||||
public static function start_compile(Smarty_Internal_Template $template)
|
||||
public function start_compile(Smarty_Internal_Template $template)
|
||||
{
|
||||
static $_is_stringy = array('string' => true, 'eval' => true);
|
||||
if (!empty($template->compiler->trace_uid)) {
|
||||
$key = $template->compiler->trace_uid;
|
||||
if (!isset(self::$template_data[self::$index][$key])) {
|
||||
if (!isset($this->template_data[$this->index][$key])) {
|
||||
if (isset($_is_stringy[$template->source->type])) {
|
||||
self::$template_data[self::$index][$key]['name'] = '\'' . substr($template->source->name, 0, 25) . '...\'';
|
||||
$this->template_data[$this->index][$key]['name'] = '\'' . substr($template->source->name, 0, 25) . '...\'';
|
||||
} else {
|
||||
self::$template_data[self::$index][$key]['name'] = $template->source->filepath;
|
||||
$this->template_data[$this->index][$key]['name'] = $template->source->filepath;
|
||||
}
|
||||
self::$template_data[self::$index][$key]['compile_time'] = 0;
|
||||
self::$template_data[self::$index][$key]['render_time'] = 0;
|
||||
self::$template_data[self::$index][$key]['cache_time'] = 0;
|
||||
$this->template_data[$this->index][$key]['compile_time'] = 0;
|
||||
$this->template_data[$this->index][$key]['render_time'] = 0;
|
||||
$this->template_data[$this->index][$key]['cache_time'] = 0;
|
||||
}
|
||||
} else {
|
||||
if (isset(self::$ignore_uid[$template->source->uid])) {
|
||||
if (isset($this->ignore_uid[$template->source->uid])) {
|
||||
return;
|
||||
}
|
||||
$key = self::get_key($template);
|
||||
$key = $this->get_key($template);
|
||||
}
|
||||
self::$template_data[self::$index][$key]['start_time'] = microtime(true);
|
||||
$this->template_data[$this->index][$key]['start_time'] = microtime(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,18 +111,18 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
*
|
||||
* @param \Smarty_Internal_Template $template
|
||||
*/
|
||||
public static function end_compile(Smarty_Internal_Template $template)
|
||||
public function end_compile(Smarty_Internal_Template $template)
|
||||
{
|
||||
if (!empty($template->compiler->trace_uid)) {
|
||||
$key = $template->compiler->trace_uid;
|
||||
} else {
|
||||
if (isset(self::$ignore_uid[$template->source->uid])) {
|
||||
if (isset($this->ignore_uid[$template->source->uid])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$key = self::get_key($template);
|
||||
$key = $this->get_key($template);
|
||||
}
|
||||
self::$template_data[self::$index][$key]['compile_time'] += microtime(true) - self::$template_data[self::$index][$key]['start_time'];
|
||||
$this->template_data[$this->index][$key]['compile_time'] += microtime(true) - $this->template_data[$this->index][$key]['start_time'];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,10 +130,10 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
*
|
||||
* @param \Smarty_Internal_Template $template
|
||||
*/
|
||||
public static function start_render(Smarty_Internal_Template $template)
|
||||
public function start_render(Smarty_Internal_Template $template)
|
||||
{
|
||||
$key = self::get_key($template);
|
||||
self::$template_data[self::$index][$key]['start_time'] = microtime(true);
|
||||
$key = $this->get_key($template);
|
||||
$this->template_data[$this->index][$key]['start_time'] = microtime(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,10 +141,10 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
*
|
||||
* @param \Smarty_Internal_Template $template
|
||||
*/
|
||||
public static function end_render(Smarty_Internal_Template $template)
|
||||
public function end_render(Smarty_Internal_Template $template)
|
||||
{
|
||||
$key = self::get_key($template);
|
||||
self::$template_data[self::$index][$key]['render_time'] += microtime(true) - self::$template_data[self::$index][$key]['start_time'];
|
||||
$key = $this->get_key($template);
|
||||
$this->template_data[$this->index][$key]['render_time'] += microtime(true) - $this->template_data[$this->index][$key]['start_time'];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,10 +152,10 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
*
|
||||
* @param \Smarty_Internal_Template $template cached template
|
||||
*/
|
||||
public static function start_cache(Smarty_Internal_Template $template)
|
||||
public function start_cache(Smarty_Internal_Template $template)
|
||||
{
|
||||
$key = self::get_key($template);
|
||||
self::$template_data[self::$index][$key]['start_time'] = microtime(true);
|
||||
$key = $this->get_key($template);
|
||||
$this->template_data[$this->index][$key]['start_time'] = microtime(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,10 +163,10 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
*
|
||||
* @param \Smarty_Internal_Template $template cached template
|
||||
*/
|
||||
public static function end_cache(Smarty_Internal_Template $template)
|
||||
public function end_cache(Smarty_Internal_Template $template)
|
||||
{
|
||||
$key = self::get_key($template);
|
||||
self::$template_data[self::$index][$key]['cache_time'] += microtime(true) - self::$template_data[self::$index][$key]['start_time'];
|
||||
$key = $this->get_key($template);
|
||||
$this->template_data[$this->index][$key]['cache_time'] += microtime(true) - $this->template_data[$this->index][$key]['start_time'];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,7 +174,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
*
|
||||
* @param \Smarty_Internal_Template $template cached template
|
||||
*/
|
||||
public static function register_template(Smarty_Internal_Template $template)
|
||||
public function register_template(Smarty_Internal_Template $template)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -189,12 +193,12 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
* @param Smarty_Internal_Template|Smarty $obj object to debug
|
||||
* @param bool $full
|
||||
*/
|
||||
public static function display_debug($obj, $full = false)
|
||||
public function display_debug($obj, $full = false)
|
||||
{
|
||||
if (!$full) {
|
||||
self::$offset ++;
|
||||
$savedIndex = self::$index;
|
||||
self::$index = 9999;
|
||||
$this->offset ++;
|
||||
$savedIndex = $this->index;
|
||||
$this->index = 9999;
|
||||
}
|
||||
if ($obj instanceof Smarty) {
|
||||
$smarty = $obj;
|
||||
@@ -227,7 +231,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
$debObj->compile_id = null;
|
||||
$debObj->cache_id = null;
|
||||
// prepare information of assigned variables
|
||||
$ptr = self::get_debug_vars($obj);
|
||||
$ptr = $this->get_debug_vars($obj);
|
||||
$_assigned_vars = $ptr->tpl_vars;
|
||||
ksort($_assigned_vars);
|
||||
$_config_vars = $ptr->config_vars;
|
||||
@@ -239,7 +243,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
$_template->assign('template_name', $obj->source->type . ':' . $obj->source->name);
|
||||
}
|
||||
if ($obj instanceof Smarty || $full) {
|
||||
$_template->assign('template_data', self::$template_data[self::$index]);
|
||||
$_template->assign('template_data', $this->template_data[$this->index]);
|
||||
} else {
|
||||
$_template->assign('template_data', null);
|
||||
}
|
||||
@@ -247,13 +251,13 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
$_template->assign('config_vars', $_config_vars);
|
||||
$_template->assign('execution_time', microtime(true) - $smarty->start_time);
|
||||
$_template->assign('display_mode', $debugging == 2 || !$full);
|
||||
$_template->assign('offset', self::$offset * 50);
|
||||
$_template->assign('offset', $this->offset * 50);
|
||||
echo $_template->fetch();
|
||||
if (isset($full)) {
|
||||
self::$index --;
|
||||
$this->index --;
|
||||
}
|
||||
if (!$full) {
|
||||
self::$index = $savedIndex;
|
||||
$this->index = $savedIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +268,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
*
|
||||
* @return StdClass
|
||||
*/
|
||||
public static function get_debug_vars($obj)
|
||||
public function get_debug_vars($obj)
|
||||
{
|
||||
$config_vars = array();
|
||||
foreach ($obj->config_vars as $key => $var) {
|
||||
@@ -304,7 +308,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
}
|
||||
|
||||
if (isset($obj->parent)) {
|
||||
$parent = self::get_debug_vars($obj->parent);
|
||||
$parent = $this->get_debug_vars($obj->parent);
|
||||
foreach ($parent->tpl_vars as $name => $pvar) {
|
||||
if (isset($tpl_vars[$name]) && $tpl_vars[$name]['value'] === $pvar['value']) {
|
||||
$tpl_vars[$name]['scope'] = $pvar['scope'];
|
||||
@@ -351,7 +355,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
*
|
||||
* @return string key into $template_data
|
||||
*/
|
||||
private static function get_key(Smarty_Internal_Template $template)
|
||||
private function get_key(Smarty_Internal_Template $template)
|
||||
{
|
||||
static $_is_stringy = array('string' => true, 'eval' => true);
|
||||
// calculate Uid if not already done
|
||||
@@ -359,18 +363,18 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
$template->source->filepath;
|
||||
}
|
||||
$key = $template->source->uid;
|
||||
if (isset(self::$template_data[self::$index][$key])) {
|
||||
if (isset($this->template_data[$this->index][$key])) {
|
||||
return $key;
|
||||
} else {
|
||||
if (isset($_is_stringy[$template->source->type])) {
|
||||
self::$template_data[self::$index][$key]['name'] = '\'' . substr($template->source->name, 0, 25) . '...\'';
|
||||
$this->template_data[$this->index][$key]['name'] = '\'' . substr($template->source->name, 0, 25) . '...\'';
|
||||
} else {
|
||||
self::$template_data[self::$index][$key]['name'] = $template->source->filepath;
|
||||
$this->template_data[$this->index][$key]['name'] = $template->source->filepath;
|
||||
}
|
||||
self::$template_data[self::$index][$key]['compile_time'] = 0;
|
||||
self::$template_data[self::$index][$key]['render_time'] = 0;
|
||||
self::$template_data[self::$index][$key]['cache_time'] = 0;
|
||||
self::$template_data[self::$index][$key]['total_time'] = 0;
|
||||
$this->template_data[$this->index][$key]['compile_time'] = 0;
|
||||
$this->template_data[$this->index][$key]['render_time'] = 0;
|
||||
$this->template_data[$this->index][$key]['cache_time'] = 0;
|
||||
$this->template_data[$this->index][$key]['total_time'] = 0;
|
||||
|
||||
return $key;
|
||||
}
|
||||
@@ -381,13 +385,13 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
*
|
||||
* @param \Smarty_Internal_Template $template
|
||||
*/
|
||||
public static function ignore(Smarty_Internal_Template $template)
|
||||
public function ignore(Smarty_Internal_Template $template)
|
||||
{
|
||||
// calculate Uid if not already done
|
||||
if ($template->source->uid == '') {
|
||||
$template->source->filepath;
|
||||
}
|
||||
self::$ignore_uid[$template->source->uid] = true;
|
||||
$this->ignore_uid[$template->source->uid] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -395,7 +399,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
*
|
||||
* @param Smarty_Internal_Template $_template
|
||||
*/
|
||||
public static function debugUrl(Smarty_Internal_Template $_template)
|
||||
public function debugUrl(Smarty_Internal_Template $_template)
|
||||
{
|
||||
if (isset($_SERVER['QUERY_STRING'])) {
|
||||
$_query_string = $_SERVER['QUERY_STRING'];
|
||||
|
@@ -46,11 +46,11 @@ class Smarty_Internal_Method_ConfigLoad
|
||||
$confObj->source->scope = $scope;
|
||||
$confObj->compiled = Smarty_Template_Compiled::load($confObj);
|
||||
if ($confObj->smarty->debugging) {
|
||||
Smarty_Internal_Debug::start_render($confObj);
|
||||
$confObj->smarty->_debug->start_render($confObj);
|
||||
}
|
||||
$confObj->compiled->render($confObj);
|
||||
if ($confObj->smarty->debugging) {
|
||||
Smarty_Internal_Debug::end_render($confObj);
|
||||
$confObj->smarty->_debug->end_render($confObj);
|
||||
}
|
||||
if ($data instanceof Smarty_Internal_Template) {
|
||||
$data->compiled->file_dependency[$confObj->source->uid] = array($confObj->source->filepath,
|
||||
|
@@ -173,7 +173,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
||||
*/
|
||||
public function display($template = null, $cache_id = null, $compile_id = null, $parent = null)
|
||||
{
|
||||
return isset($template) ? $this->smarty->fetch($template, $cache_id, $compile_id, $parent, true) : $this->render(true, false, true);
|
||||
$this->fetch($template, $cache_id, $compile_id, $parent, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,7 +191,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
||||
{
|
||||
$parentIsTpl = $this->parent instanceof Smarty_Internal_Template;
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::start_template($this, $display);
|
||||
$this->smarty->_debug->start_template($this, $display);
|
||||
}
|
||||
// checks if template exists
|
||||
if (!$this->source->exists) {
|
||||
@@ -233,9 +233,9 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
||||
$this->config_vars = $config_vars;
|
||||
}
|
||||
$_smarty_old_error_level = isset($this->smarty->error_reporting) ? error_reporting($this->smarty->error_reporting) : null;
|
||||
// check URL debugging control
|
||||
// check URL debugging control
|
||||
if (!$this->smarty->debugging && $this->smarty->debugging_ctrl == 'URL') {
|
||||
Smarty_Internal_Debug::debugUrl($this);
|
||||
$this->smarty->_debug->debugUrl($this);
|
||||
}
|
||||
// disable caching for evaluated code
|
||||
if ($this->source->recompiled) {
|
||||
@@ -253,7 +253,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
||||
if (!($isCacheTpl) || !$this->cached->valid) {
|
||||
// render template (not loaded and not in cache)
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::start_render($this);
|
||||
$this->smarty->_debug->start_render($this);
|
||||
}
|
||||
if (!$this->source->uncompiled) {
|
||||
// render compiled code
|
||||
@@ -268,12 +268,12 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
||||
$this->parent->tpl_function = array_merge($this->parent->tpl_function, $this->tpl_function);
|
||||
}
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::end_render($this);
|
||||
$this->smarty->_debug->end_render($this);
|
||||
}
|
||||
// write to cache when necessary
|
||||
if (!$this->source->recompiled && $isCacheTpl) {
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::start_cache($this);
|
||||
$this->smarty->_debug->start_cache($this);
|
||||
}
|
||||
$this->cached->updateCache($this, $content, $no_output_filter);
|
||||
$compile_check = $this->smarty->compile_check;
|
||||
@@ -287,7 +287,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
||||
$this->smarty->compile_check = $compile_check;
|
||||
$content = $this->getRenderedTemplateCode($this->cached->unifunc);
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::end_cache($this);
|
||||
$this->smarty->_debug->end_cache($this);
|
||||
}
|
||||
} else {
|
||||
if ($this->parent instanceof Smarty_Internal_Template && !empty($this->compiled->nocache_hash) &&
|
||||
@@ -301,11 +301,11 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
||||
}
|
||||
} else {
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::start_cache($this);
|
||||
$this->smarty->_debug->start_cache($this);
|
||||
}
|
||||
$content = $this->cached->render($this);
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::end_cache($this);
|
||||
$this->smarty->_debug->end_cache($this);
|
||||
}
|
||||
}
|
||||
if ((!$this->caching || $this->cached->has_nocache_code || $this->source->recompiled) && !$no_output_filter &&
|
||||
@@ -324,11 +324,11 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
||||
echo $content;
|
||||
}
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::end_template($this);
|
||||
$this->smarty->_debug->end_template($this);
|
||||
}
|
||||
// debug output
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::display_debug($this, true);
|
||||
$this->smarty->_debug->display_debug($this, true);
|
||||
}
|
||||
if ($merge_tpl_vars) {
|
||||
// restore local variables
|
||||
@@ -343,11 +343,11 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
||||
$this->config_vars = $save_config_vars;
|
||||
}
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::end_template($this);
|
||||
$this->smarty->_debug->end_template($this);
|
||||
}
|
||||
if ($this->smarty->debugging == 2 and $display === false) {
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::display_debug($this, true);
|
||||
$this->smarty->_debug->display_debug($this, true);
|
||||
}
|
||||
}
|
||||
if ($parentIsTpl) {
|
||||
@@ -491,6 +491,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
||||
{
|
||||
$_templateId = $this->getTemplateId($template, $cache_id, $compile_id);
|
||||
// already in template cache?
|
||||
/* @var Smarty_Internal_Template $tpl */
|
||||
if (isset($this->smarty->template_objects[$_templateId])) {
|
||||
// clone cached template object because of possible recursive call
|
||||
$tpl = clone $this->smarty->template_objects[$_templateId];
|
||||
@@ -559,13 +560,13 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
||||
$tpl->compiled = $this->compiled;
|
||||
}
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::start_template($tpl);
|
||||
Smarty_Internal_Debug::start_render($tpl);
|
||||
$this->smarty->_debug->start_template($tpl);
|
||||
$this->smarty->_debug->start_render($tpl);
|
||||
}
|
||||
$output = $tpl->getRenderedTemplateCode($content_func);
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::end_template($tpl);
|
||||
Smarty_Internal_Debug::end_render($tpl);
|
||||
$this->smarty->_debug->end_template($tpl);
|
||||
$this->smarty->_debug->end_render($tpl);
|
||||
}
|
||||
return str_replace($tpl->compiled->nocache_hash, $this->compiled->nocache_hash, $output);
|
||||
}
|
||||
@@ -660,7 +661,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
||||
} else {
|
||||
$this->mustCompile = !$is_valid;
|
||||
$resource = $this->compiled;
|
||||
$resource->includes = $properties['includes'];
|
||||
$resource->includes = isset($properties['includes']) ? $properties['includes'] : array();
|
||||
}
|
||||
if ($is_valid) {
|
||||
$resource->unifunc = $properties['unifunc'];
|
||||
|
@@ -399,7 +399,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
while ($this->template->source = array_shift($this->sources)) {
|
||||
$this->smarty->_current_file = $this->template->source->filepath;
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::start_compile($this->template);
|
||||
$this->smarty->_debug->start_compile($this->template);
|
||||
}
|
||||
$no_sources = count($this->sources);
|
||||
$this->parent_compiler->template->compiled->file_dependency[$this->template->source->uid] = array($this->template->source->filepath,
|
||||
@@ -431,7 +431,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
$_compiled_code = $this->doCompile($_content, true);
|
||||
}
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::end_compile($this->template);
|
||||
$this->smarty->_debug->end_compile($this->template);
|
||||
}
|
||||
// free memory
|
||||
$this->parser = null;
|
||||
@@ -1067,7 +1067,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
public function pushTrace($file, $uid, $line, $debug = true)
|
||||
{
|
||||
if ($this->smarty->debugging && $debug) {
|
||||
Smarty_Internal_Debug::end_compile($this->template);
|
||||
$this->smarty->_debug->end_compile($this->template);
|
||||
}
|
||||
array_push($this->trace_stack, array($this->smarty->_current_file, $this->trace_filepath, $this->trace_uid,
|
||||
$this->trace_line_offset));
|
||||
@@ -1075,7 +1075,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
$this->trace_uid = $uid;
|
||||
$this->trace_line_offset = $line;
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::start_compile($this->template);
|
||||
$this->smarty->_debug->start_compile($this->template);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1085,7 +1085,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
public function popTrace()
|
||||
{
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::end_compile($this->template);
|
||||
$this->smarty->_debug->end_compile($this->template);
|
||||
}
|
||||
$r = array_pop($this->trace_stack);
|
||||
$this->smarty->_current_file = $r[0];
|
||||
@@ -1093,7 +1093,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
$this->trace_uid = $r[2];
|
||||
$this->trace_line_offset = $r[3];
|
||||
if ($this->smarty->debugging) {
|
||||
Smarty_Internal_Debug::start_compile($this->template);
|
||||
$this->smarty->_debug->start_compile($this->template);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -142,7 +142,7 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base
|
||||
if (!$_template->smarty->cache_locking || $this->handler->locked($_template->smarty, $this) === null) {
|
||||
// load cache file for the following checks
|
||||
if ($_template->smarty->debugging) {
|
||||
Smarty_Internal_Debug::start_cache($_template);
|
||||
$_template->smarty->_debug->start_cache($_template);
|
||||
}
|
||||
if ($this->handler->process($_template, $this) === false) {
|
||||
$this->valid = false;
|
||||
@@ -150,7 +150,7 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base
|
||||
$this->processed = true;
|
||||
}
|
||||
if ($_template->smarty->debugging) {
|
||||
Smarty_Internal_Debug::end_cache($_template);
|
||||
$_template->smarty->_debug->end_cache($_template);
|
||||
}
|
||||
} else {
|
||||
$this->is_locked = true;
|
||||
|
Reference in New Issue
Block a user