mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
- improvement of the debugging console. Read NEW_FEATURES.txt
This commit is contained in:
@@ -64,11 +64,23 @@ Smarty 3.1.22
|
|||||||
|
|
||||||
Compiled Templates
|
Compiled Templates
|
||||||
==================
|
==================
|
||||||
Smarty does now automatically detect a change of the $merge_compiled_includes and $escape_html
|
Smarty does now automatically detects a change of the $merge_compiled_includes and $escape_html
|
||||||
property and create different compiled templates files depending on the setting.
|
property and creates different compiled templates files depending on the setting.
|
||||||
|
|
||||||
Same applies to config files and the $config_overwrite, $config_booleanize and
|
Same applies to config files and the $config_overwrite, $config_booleanize and
|
||||||
$config_read_hidden properties.
|
$config_read_hidden properties.
|
||||||
|
|
||||||
|
Debugging
|
||||||
|
=========
|
||||||
|
The layout of the debug window has been changed for better readability
|
||||||
|
|
||||||
|
New class constants
|
||||||
|
Smarty::DEBUG_OFF
|
||||||
|
Smarty::DEBUG_ON
|
||||||
|
Smarty::DEBUG_INDIVIDUAL
|
||||||
|
have been introduced for setting the $debugging property.
|
||||||
|
|
||||||
|
Smarty::DEBUG_INDIVIDUAL will create for each display() and fetch() call an individual gebug window.
|
||||||
|
|
||||||
|
.
|
||||||
|
|
@@ -1,4 +1,7 @@
|
|||||||
===== 3.1.22-dev ===== (xx.xx.2015)
|
===== 3.1.22-dev ===== (xx.xx.2015)
|
||||||
|
07.05.2015
|
||||||
|
- improvement of the debugging console. Read NEW_FEATURES.txt
|
||||||
|
|
||||||
06.05.2015
|
06.05.2015
|
||||||
- bugfix in 3.1.22-dev cache resource must not be loaded for subtemplates
|
- bugfix in 3.1.22-dev cache resource must not be loaded for subtemplates
|
||||||
- bugfix/improvement in 3.1.22-dev cache locking did not work as expected
|
- bugfix/improvement in 3.1.22-dev cache locking did not work as expected
|
||||||
|
@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '3.1.22-dev/28';
|
const SMARTY_VERSION = '3.1.22-dev/29';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
@@ -137,6 +137,13 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
const COMPILECHECK_OFF = 0;
|
const COMPILECHECK_OFF = 0;
|
||||||
const COMPILECHECK_ON = 1;
|
const COMPILECHECK_ON = 1;
|
||||||
const COMPILECHECK_CACHEMISS = 2;
|
const COMPILECHECK_CACHEMISS = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* define debug modes
|
||||||
|
*/
|
||||||
|
const DEBUG_OFF = 0;
|
||||||
|
const DEBUG_ON = 1;
|
||||||
|
const DEBUG_INDIVIDUAL = 2;
|
||||||
/**
|
/**
|
||||||
* modes for handling of "<?php ... ?>" tags in templates.
|
* modes for handling of "<?php ... ?>" tags in templates.
|
||||||
*/
|
*/
|
||||||
|
@@ -153,8 +153,8 @@
|
|||||||
{/capture}
|
{/capture}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
{$id = ''}
|
{$id = ''}
|
||||||
{if $display_mode}{$id = $template_name|md5}{/if}
|
{if $display_mode}{$id = "$offset$template_name"|md5}{/if}
|
||||||
_smarty_console = window.open("", "console{$id}", "width=680,height=600,resizable,scrollbars=yes");
|
_smarty_console = window.open("", "console{$id}", "width=680,height=600,left={$offset},top={$offset},resizable,scrollbars=yes");
|
||||||
_smarty_console.document.write("{$debug_output|escape:'javascript' nofilter}");
|
_smarty_console.document.write("{$debug_output|escape:'javascript' nofilter}");
|
||||||
_smarty_console.document.close();
|
_smarty_console.document.close();
|
||||||
</script>
|
</script>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Smarty Internal Plugin Debug
|
* Smarty Internal Plugin Debug
|
||||||
* Class to collect data for the Smarty Debugging Consol
|
* Class to collect data for the Smarty Debugging Console
|
||||||
*
|
*
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage Debug
|
* @subpackage Debug
|
||||||
@@ -31,38 +31,67 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
|||||||
public static $ignore_uid = array();
|
public static $ignore_uid = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ignore template
|
* Index of display() and fetch() calls
|
||||||
*
|
*
|
||||||
* @param object $template
|
* @var int
|
||||||
*/
|
*/
|
||||||
public static function ignore($template)
|
public static $index = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Counter for window offset
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public static $offset = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start logging template
|
||||||
|
*
|
||||||
|
* @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)
|
||||||
{
|
{
|
||||||
// calculate Uid if not already done
|
if (isset($mode)) {
|
||||||
if ($template->source->uid == '') {
|
self::$index ++;
|
||||||
$template->source->filepath;
|
self::$offset ++;
|
||||||
|
self::$template_data[self::$index] = null;
|
||||||
}
|
}
|
||||||
self::$ignore_uid[$template->source->uid] = true;
|
$key = self::get_key($template);
|
||||||
|
self::$template_data[self::$index][$key]['start_template_time'] = microtime(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* End logging of cache time
|
||||||
|
*
|
||||||
|
* @param \Smarty_Internal_Template $template cached template
|
||||||
|
*/
|
||||||
|
public static 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start logging of compile time
|
* Start logging of compile time
|
||||||
*
|
*
|
||||||
* @param object $template
|
* @param \Smarty_Internal_Template $template
|
||||||
*/
|
*/
|
||||||
public static function start_compile($template)
|
public static function start_compile(Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
static $_is_stringy = array('string' => true, 'eval' => true);
|
static $_is_stringy = array('string' => true, 'eval' => true);
|
||||||
if (!empty($template->compiler->trace_uid)) {
|
if (!empty($template->compiler->trace_uid)) {
|
||||||
$key = $template->compiler->trace_uid;
|
$key = $template->compiler->trace_uid;
|
||||||
if (!isset(self::$template_data[$key])) {
|
if (!isset(self::$template_data[self::$index][$key])) {
|
||||||
if (isset($_is_stringy[$template->source->type])) {
|
if (isset($_is_stringy[$template->source->type])) {
|
||||||
self::$template_data[$key]['name'] = '\'' . substr($template->source->name, 0, 25) . '...\'';
|
self::$template_data[self::$index][$key]['name'] = '\'' . substr($template->source->name, 0, 25) . '...\'';
|
||||||
} else {
|
} else {
|
||||||
self::$template_data[$key]['name'] = $template->source->filepath;
|
self::$template_data[self::$index][$key]['name'] = $template->source->filepath;
|
||||||
}
|
}
|
||||||
self::$template_data[$key]['compile_time'] = 0;
|
self::$template_data[self::$index][$key]['compile_time'] = 0;
|
||||||
self::$template_data[$key]['render_time'] = 0;
|
self::$template_data[self::$index][$key]['render_time'] = 0;
|
||||||
self::$template_data[$key]['cache_time'] = 0;
|
self::$template_data[self::$index][$key]['cache_time'] = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isset(self::$ignore_uid[$template->source->uid])) {
|
if (isset(self::$ignore_uid[$template->source->uid])) {
|
||||||
@@ -70,15 +99,15 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
|||||||
}
|
}
|
||||||
$key = self::get_key($template);
|
$key = self::get_key($template);
|
||||||
}
|
}
|
||||||
self::$template_data[$key]['start_time'] = microtime(true);
|
self::$template_data[self::$index][$key]['start_time'] = microtime(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End logging of compile time
|
* End logging of compile time
|
||||||
*
|
*
|
||||||
* @param object $template
|
* @param \Smarty_Internal_Template $template
|
||||||
*/
|
*/
|
||||||
public static function end_compile($template)
|
public static function end_compile(Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
if (!empty($template->compiler->trace_uid)) {
|
if (!empty($template->compiler->trace_uid)) {
|
||||||
$key = $template->compiler->trace_uid;
|
$key = $template->compiler->trace_uid;
|
||||||
@@ -89,102 +118,84 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
|||||||
|
|
||||||
$key = self::get_key($template);
|
$key = self::get_key($template);
|
||||||
}
|
}
|
||||||
self::$template_data[$key]['compile_time'] += microtime(true) - self::$template_data[$key]['start_time'];
|
self::$template_data[self::$index][$key]['compile_time'] += microtime(true) - self::$template_data[self::$index][$key]['start_time'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start logging of render time
|
* Start logging of render time
|
||||||
*
|
*
|
||||||
* @param object $template
|
* @param \Smarty_Internal_Template $template
|
||||||
*/
|
*/
|
||||||
public static function start_render($template)
|
public static function start_render(Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
$key = self::get_key($template);
|
$key = self::get_key($template);
|
||||||
self::$template_data[$key]['start_time'] = microtime(true);
|
self::$template_data[self::$index][$key]['start_time'] = microtime(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End logging of compile time
|
* End logging of compile time
|
||||||
*
|
*
|
||||||
* @param object $template
|
* @param \Smarty_Internal_Template $template
|
||||||
*/
|
*/
|
||||||
public static function end_render($template)
|
public static function end_render(Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
$key = self::get_key($template);
|
$key = self::get_key($template);
|
||||||
self::$template_data[$key]['render_time'] += microtime(true) - self::$template_data[$key]['start_time'];
|
self::$template_data[self::$index][$key]['render_time'] += microtime(true) - self::$template_data[self::$index][$key]['start_time'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start logging of cache time
|
* Start logging of cache time
|
||||||
*
|
*
|
||||||
* @param object $template cached template
|
* @param \Smarty_Internal_Template $template cached template
|
||||||
*/
|
*/
|
||||||
public static function start_cache($template)
|
public static function start_cache(Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
$key = self::get_key($template);
|
$key = self::get_key($template);
|
||||||
self::$template_data[$key]['start_time'] = microtime(true);
|
self::$template_data[self::$index][$key]['start_time'] = microtime(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End logging of cache time
|
* End logging of cache time
|
||||||
*
|
*
|
||||||
* @param object $template cached template
|
* @param o\Smarty_Internal_Template $template cached template
|
||||||
*/
|
*/
|
||||||
public static function end_cache($template)
|
public static function end_cache(Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
$key = self::get_key($template);
|
$key = self::get_key($template);
|
||||||
self::$template_data[$key]['cache_time'] += microtime(true) - self::$template_data[$key]['start_time'];
|
self::$template_data[self::$index][$key]['cache_time'] += microtime(true) - self::$template_data[self::$index][$key]['start_time'];
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start logging of cache time
|
|
||||||
*
|
|
||||||
* @param object $template cached template
|
|
||||||
*/
|
|
||||||
public static function start_template($template)
|
|
||||||
{
|
|
||||||
$key = self::get_key($template);
|
|
||||||
self::$template_data[$key]['start_template_time'] = microtime(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* End logging of cache time
|
|
||||||
*
|
|
||||||
* @param object $template cached template
|
|
||||||
*/
|
|
||||||
public static function end_template($template)
|
|
||||||
{
|
|
||||||
$key = self::get_key($template);
|
|
||||||
self::$template_data[$key]['total_time'] += microtime(true) - self::$template_data[$key]['start_template_time'];
|
|
||||||
self::$template_data[$key]['properties'] = $template->properties;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register template object
|
* Register template object
|
||||||
*
|
*
|
||||||
* @param object $template cached template
|
* @param \Smarty_Internal_Template $template cached template
|
||||||
*/
|
*/
|
||||||
public static function register_template($template)
|
public static function register_template(Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register data object
|
* Register data object
|
||||||
*
|
*
|
||||||
* @param object $data data object
|
* @param \Smarty_Data $data data object
|
||||||
*/
|
*/
|
||||||
public static function register_data($data)
|
public static function register_data(Smarty_Data $data)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a window for the Smarty Debugging Consol and display the data
|
* Opens a window for the Smarty Debugging Console and display the data
|
||||||
*
|
*
|
||||||
* @param Smarty_Internal_Template|Smarty $obj object to debug
|
* @param Smarty_Internal_Template|Smarty $obj object to debug
|
||||||
|
* @param bool $full
|
||||||
*/
|
*/
|
||||||
public static function display_debug($obj, $full = false)
|
public static function display_debug($obj, $full = false)
|
||||||
{
|
{
|
||||||
|
if (!$full) {
|
||||||
|
self::$offset ++;
|
||||||
|
$savedIndex = self::$index;
|
||||||
|
self::$index = 9999;
|
||||||
|
}
|
||||||
// prepare information of assigned variables
|
// prepare information of assigned variables
|
||||||
$ptr = self::get_debug_vars($obj);
|
$ptr = self::get_debug_vars($obj);
|
||||||
if ($obj instanceof Smarty) {
|
if ($obj instanceof Smarty) {
|
||||||
@@ -192,6 +203,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
|||||||
} else {
|
} else {
|
||||||
$smarty = clone $obj->smarty;
|
$smarty = clone $obj->smarty;
|
||||||
}
|
}
|
||||||
|
$debugging = $smarty->debugging;
|
||||||
$_assigned_vars = $ptr->tpl_vars;
|
$_assigned_vars = $ptr->tpl_vars;
|
||||||
ksort($_assigned_vars);
|
ksort($_assigned_vars);
|
||||||
$_config_vars = $ptr->config_vars;
|
$_config_vars = $ptr->config_vars;
|
||||||
@@ -207,25 +219,28 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
|||||||
$smarty->force_compile = false;
|
$smarty->force_compile = false;
|
||||||
$_template = new Smarty_Internal_Template($smarty->debug_tpl, $smarty);
|
$_template = new Smarty_Internal_Template($smarty->debug_tpl, $smarty);
|
||||||
$_template->caching = false;
|
$_template->caching = false;
|
||||||
$_template->disableSecurity();
|
$_template->smarty->disableSecurity();
|
||||||
$_template->cache_id = null;
|
$_template->cache_id = null;
|
||||||
$_template->compile_id = null;
|
$_template->compile_id = null;
|
||||||
if ($obj instanceof Smarty_Internal_Template) {
|
if ($obj instanceof Smarty_Internal_Template) {
|
||||||
$_template->assign('template_name', $obj->source->type . ':' . $obj->source->name);
|
$_template->assign('template_name', $obj->source->type . ':' . $obj->source->name);
|
||||||
}
|
}
|
||||||
if ($obj instanceof Smarty || $full) {
|
if ($obj instanceof Smarty || $full) {
|
||||||
$_template->assign('template_data', self::$template_data);
|
$_template->assign('template_data', self::$template_data[self::$index]);
|
||||||
} else {
|
} else {
|
||||||
$_template->assign('template_data', null);
|
$_template->assign('template_data', null);
|
||||||
}
|
}
|
||||||
$_template->assign('assigned_vars', $_assigned_vars);
|
$_template->assign('assigned_vars', $_assigned_vars);
|
||||||
$_template->assign('config_vars', $_config_vars);
|
$_template->assign('config_vars', $_config_vars);
|
||||||
$_template->assign('execution_time', microtime(true) - $smarty->start_time);
|
$_template->assign('execution_time', microtime(true) - $smarty->start_time);
|
||||||
$_template->assign('display_mode', $smarty->debugging == 2 || !$full);
|
$_template->assign('display_mode', $debugging == 2 || !$full);
|
||||||
|
$_template->assign('offset', self::$offset * 50);
|
||||||
echo $_template->fetch();
|
echo $_template->fetch();
|
||||||
if ($full) {
|
if (isset($full)) {
|
||||||
self::$ignore_uid = array();
|
self::$index --;
|
||||||
self::$template_data = array();
|
}
|
||||||
|
if (!$full) {
|
||||||
|
self::$index = $savedIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,13 +269,16 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
|||||||
foreach ($var as $varkey => $varvalue) {
|
foreach ($var as $varkey => $varvalue) {
|
||||||
if ($varkey == 'value') {
|
if ($varkey == 'value') {
|
||||||
$tpl_vars[$key][$varkey] = $varvalue;
|
$tpl_vars[$key][$varkey] = $varvalue;
|
||||||
} else if ($varkey == 'nocache') {
|
|
||||||
if ($varvalue == true) {
|
|
||||||
$tpl_vars[$key][$varkey] = $varvalue;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ($varkey != 'scope' || $varvalue !== 0)
|
if ($varkey == 'nocache') {
|
||||||
$tpl_vars[$key]['attributes'][$varkey] = $varvalue;
|
if ($varvalue == true) {
|
||||||
|
$tpl_vars[$key][$varkey] = $varvalue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($varkey != 'scope' || $varvalue !== 0) {
|
||||||
|
$tpl_vars[$key]['attributes'][$varkey] = $varvalue;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($obj instanceof Smarty_Internal_Template) {
|
if ($obj instanceof Smarty_Internal_Template) {
|
||||||
@@ -274,14 +292,14 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
|||||||
|
|
||||||
if (isset($obj->parent)) {
|
if (isset($obj->parent)) {
|
||||||
$parent = self::get_debug_vars($obj->parent);
|
$parent = self::get_debug_vars($obj->parent);
|
||||||
foreach($parent->tpl_vars as $name => $pvar){
|
foreach ($parent->tpl_vars as $name => $pvar) {
|
||||||
if (isset($tpl_vars[$name]) && $tpl_vars[$name]['value'] === $pvar['value']) {
|
if (isset($tpl_vars[$name]) && $tpl_vars[$name]['value'] === $pvar['value']) {
|
||||||
$tpl_vars[$name]['scope'] = $pvar['scope'];
|
$tpl_vars[$name]['scope'] = $pvar['scope'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$tpl_vars = array_merge($parent->tpl_vars, $tpl_vars);
|
$tpl_vars = array_merge($parent->tpl_vars, $tpl_vars);
|
||||||
|
|
||||||
foreach($parent->config_vars as $name => $pvar){
|
foreach ($parent->config_vars as $name => $pvar) {
|
||||||
if (isset($config_vars[$name]) && $config_vars[$name]['value'] === $pvar['value']) {
|
if (isset($config_vars[$name]) && $config_vars[$name]['value'] === $pvar['value']) {
|
||||||
$config_vars[$name]['scope'] = $pvar['scope'];
|
$config_vars[$name]['scope'] = $pvar['scope'];
|
||||||
}
|
}
|
||||||
@@ -316,11 +334,11 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
|||||||
/**
|
/**
|
||||||
* Return key into $template_data for template
|
* Return key into $template_data for template
|
||||||
*
|
*
|
||||||
* @param object $template template object
|
* @param \Smarty_Internal_Template $template template object
|
||||||
*
|
*
|
||||||
* @return string key into $template_data
|
* @return string key into $template_data
|
||||||
*/
|
*/
|
||||||
private static function get_key($template)
|
private static function get_key(Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
static $_is_stringy = array('string' => true, 'eval' => true);
|
static $_is_stringy = array('string' => true, 'eval' => true);
|
||||||
// calculate Uid if not already done
|
// calculate Uid if not already done
|
||||||
@@ -328,29 +346,44 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
|||||||
$template->source->filepath;
|
$template->source->filepath;
|
||||||
}
|
}
|
||||||
$key = $template->source->uid;
|
$key = $template->source->uid;
|
||||||
if (isset(self::$template_data[$key])) {
|
if (isset(self::$template_data[self::$index][$key])) {
|
||||||
return $key;
|
return $key;
|
||||||
} else {
|
} else {
|
||||||
if (isset($_is_stringy[$template->source->type])) {
|
if (isset($_is_stringy[$template->source->type])) {
|
||||||
self::$template_data[$key]['name'] = '\'' . substr($template->source->name, 0, 25) . '...\'';
|
self::$template_data[self::$index][$key]['name'] = '\'' . substr($template->source->name, 0, 25) . '...\'';
|
||||||
} else {
|
} else {
|
||||||
self::$template_data[$key]['name'] = $template->source->filepath;
|
self::$template_data[self::$index][$key]['name'] = $template->source->filepath;
|
||||||
}
|
}
|
||||||
self::$template_data[$key]['compile_time'] = 0;
|
self::$template_data[self::$index][$key]['compile_time'] = 0;
|
||||||
self::$template_data[$key]['render_time'] = 0;
|
self::$template_data[self::$index][$key]['render_time'] = 0;
|
||||||
self::$template_data[$key]['cache_time'] = 0;
|
self::$template_data[self::$index][$key]['cache_time'] = 0;
|
||||||
self::$template_data[$key]['total_time'] = 0;
|
self::$template_data[self::$index][$key]['total_time'] = 0;
|
||||||
|
|
||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ignore template
|
||||||
|
*
|
||||||
|
* @param \Smarty_Internal_Template $template
|
||||||
|
*/
|
||||||
|
public static 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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* handle 'URL' debugging mode
|
* handle 'URL' debugging mode
|
||||||
*
|
*
|
||||||
* @param Smarty_Internal_Template $_template
|
* @param Smarty_Internal_Template $_template
|
||||||
*/
|
*/
|
||||||
public static function debugUrl(Smarty_Internal_Template $_template) {
|
public static function debugUrl(Smarty_Internal_Template $_template)
|
||||||
|
{
|
||||||
if (isset($_SERVER['QUERY_STRING'])) {
|
if (isset($_SERVER['QUERY_STRING'])) {
|
||||||
$_query_string = $_SERVER['QUERY_STRING'];
|
$_query_string = $_SERVER['QUERY_STRING'];
|
||||||
} else {
|
} else {
|
||||||
|
@@ -139,7 +139,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
*/
|
*/
|
||||||
public function fetch()
|
public function fetch()
|
||||||
{
|
{
|
||||||
return $this->render(true, false);
|
return $this->render(true, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -155,17 +155,17 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
*
|
*
|
||||||
* @param bool $merge_tpl_vars if true parent template variables merged in to local scope
|
* @param bool $merge_tpl_vars if true parent template variables merged in to local scope
|
||||||
* @param bool $no_output_filter if true do not run output filter
|
* @param bool $no_output_filter if true do not run output filter
|
||||||
* @param bool $display true: display, false: fetch
|
* @param bool $display true: display, false: fetch null: subtemplate
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @throws SmartyException
|
* @throws SmartyException
|
||||||
* @return string rendered template output
|
* @return string rendered template output
|
||||||
*/
|
*/
|
||||||
public function render($merge_tpl_vars = false, $no_output_filter = true, $display = false)
|
public function render($merge_tpl_vars = false, $no_output_filter = true, $display = null)
|
||||||
{
|
{
|
||||||
$parentIsTpl = $this->parent instanceof Smarty_Internal_Template;
|
$parentIsTpl = $this->parent instanceof Smarty_Internal_Template;
|
||||||
if ($this->smarty->debugging) {
|
if ($this->smarty->debugging) {
|
||||||
Smarty_Internal_Debug::start_template($this);
|
Smarty_Internal_Debug::start_template($this, $display);
|
||||||
}
|
}
|
||||||
$save_tpl_vars = null;
|
$save_tpl_vars = null;
|
||||||
$save_config_vars = null;
|
$save_config_vars = null;
|
||||||
@@ -306,7 +306,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
echo $content;
|
echo $content;
|
||||||
}
|
}
|
||||||
if ($this->smarty->debugging) {
|
if ($this->smarty->debugging) {
|
||||||
Smarty_Internal_Debug::end_template($this);
|
Smarty_Internal_Debug::end_template($this, $display);
|
||||||
}
|
}
|
||||||
// debug output
|
// debug output
|
||||||
if ($this->smarty->debugging) {
|
if ($this->smarty->debugging) {
|
||||||
@@ -325,7 +325,12 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
$this->config_vars = $save_config_vars;
|
$this->config_vars = $save_config_vars;
|
||||||
}
|
}
|
||||||
if ($this->smarty->debugging) {
|
if ($this->smarty->debugging) {
|
||||||
Smarty_Internal_Debug::end_template($this);
|
Smarty_Internal_Debug::end_template($this, $display);
|
||||||
|
}
|
||||||
|
if ($this->smarty->debugging == 2 and $display === false) {
|
||||||
|
if ($this->smarty->debugging) {
|
||||||
|
Smarty_Internal_Debug::display_debug($this, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($parentIsTpl) {
|
if ($parentIsTpl) {
|
||||||
$this->parent->properties['tpl_function'] = array_merge($this->parent->properties['tpl_function'], $this->properties['tpl_function']);
|
$this->parent->properties['tpl_function'] = array_merge($this->parent->properties['tpl_function'], $this->properties['tpl_function']);
|
||||||
|
Reference in New Issue
Block a user