mirror of
https://github.com/smarty-php/smarty.git
synced 2026-05-05 12:14:12 +02:00
- update for PHP 5.4 compatibility
- reformat source to PSR-2 standard
This commit is contained in:
@@ -15,21 +15,21 @@
|
||||
* @package Smarty
|
||||
* @subpackage Debug
|
||||
*/
|
||||
class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
||||
|
||||
class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
{
|
||||
/**
|
||||
* template data
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $template_data = array();
|
||||
static $template_data = array();
|
||||
|
||||
/**
|
||||
* Start logging of compile time
|
||||
*
|
||||
* @param object $template
|
||||
*/
|
||||
public static function start_compile($template)
|
||||
static function start_compile($template)
|
||||
{
|
||||
$key = self::get_key($template);
|
||||
self::$template_data[$key]['start_time'] = microtime(true);
|
||||
@@ -40,7 +40,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
||||
*
|
||||
* @param object $template
|
||||
*/
|
||||
public static function end_compile($template)
|
||||
static function end_compile($template)
|
||||
{
|
||||
$key = self::get_key($template);
|
||||
self::$template_data[$key]['compile_time'] += microtime(true) - self::$template_data[$key]['start_time'];
|
||||
@@ -51,7 +51,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
||||
*
|
||||
* @param object $template
|
||||
*/
|
||||
public static function start_render($template)
|
||||
static function start_render($template)
|
||||
{
|
||||
$key = self::get_key($template);
|
||||
self::$template_data[$key]['start_time'] = microtime(true);
|
||||
@@ -62,7 +62,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
||||
*
|
||||
* @param object $template
|
||||
*/
|
||||
public static function end_render($template)
|
||||
static function end_render($template)
|
||||
{
|
||||
$key = self::get_key($template);
|
||||
self::$template_data[$key]['render_time'] += microtime(true) - self::$template_data[$key]['start_time'];
|
||||
@@ -73,7 +73,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
||||
*
|
||||
* @param object $template cached template
|
||||
*/
|
||||
public static function start_cache($template)
|
||||
static function start_cache($template)
|
||||
{
|
||||
$key = self::get_key($template);
|
||||
self::$template_data[$key]['start_time'] = microtime(true);
|
||||
@@ -84,7 +84,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
||||
*
|
||||
* @param object $template cached template
|
||||
*/
|
||||
public static function end_cache($template)
|
||||
static function end_cache($template)
|
||||
{
|
||||
$key = self::get_key($template);
|
||||
self::$template_data[$key]['cache_time'] += microtime(true) - self::$template_data[$key]['start_time'];
|
||||
@@ -95,7 +95,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
||||
*
|
||||
* @param Smarty_Internal_Template|Smarty $obj object to debug
|
||||
*/
|
||||
public static function display_debug($obj)
|
||||
static function display_debug($obj)
|
||||
{
|
||||
// prepare information of assigned variables
|
||||
$ptr = self::get_debug_vars($obj);
|
||||
@@ -138,10 +138,10 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
||||
/**
|
||||
* Recursively gets variables from all template/data scopes
|
||||
*
|
||||
* @param Smarty_Internal_Template|Smarty_Data $obj object to debug
|
||||
* @param Smarty_Internal_Template|Smarty_Data $obj object to debug
|
||||
* @return StdClass
|
||||
*/
|
||||
public static function get_debug_vars($obj)
|
||||
static function get_debug_vars($obj)
|
||||
{
|
||||
$config_vars = $obj->config_vars;
|
||||
$tpl_vars = array();
|
||||
@@ -169,14 +169,15 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (object) array('tpl_vars' => $tpl_vars, 'config_vars' => $config_vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return key into $template_data for template
|
||||
*
|
||||
* @param object $template template object
|
||||
* @return string key into $template_data
|
||||
* @param object $template template object
|
||||
* @return string key into $template_data
|
||||
*/
|
||||
private static function get_key($template)
|
||||
{
|
||||
@@ -197,10 +198,9 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
||||
self::$template_data[$key]['compile_time'] = 0;
|
||||
self::$template_data[$key]['render_time'] = 0;
|
||||
self::$template_data[$key]['cache_time'] = 0;
|
||||
|
||||
return $key;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user