mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-03 05:41:37 +01:00
correct misc varnames, abstract debug console display to plugin function
This commit is contained in:
61
libs/plugins/function.display_debug_console.php
Normal file
61
libs/plugins/function.display_debug_console.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
* @package Smarty
|
||||
* @subpackage plugins
|
||||
*/
|
||||
|
||||
/*
|
||||
* Smarty debug_console function plugin
|
||||
*
|
||||
* Type: function<br>
|
||||
* Name: display_debug_console<br>
|
||||
* Purpose: display the javascript debug console window
|
||||
* @param array Format: null
|
||||
* @param Smarty
|
||||
*/
|
||||
function smarty_function_display_debug_console($params, &$this)
|
||||
{
|
||||
// we must force compile the debug template in case the environment
|
||||
// changed between separate applications.
|
||||
|
||||
if(empty($this->debug_tpl)) {
|
||||
// set path to debug template from SMARTY_DIR
|
||||
$this->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl';
|
||||
if($this->security && is_file($this->debug_tpl)) {
|
||||
$secure_dir[] = $this->debug_tpl;
|
||||
}
|
||||
}
|
||||
|
||||
$_ldelim_orig = $this->left_delimiter;
|
||||
$_rdelim_orig = $this->right_delimiter;
|
||||
|
||||
$this->left_delimiter = '{';
|
||||
$this->right_delimiter = '}';
|
||||
|
||||
$_force_compile_orig = $this->force_compile;
|
||||
$this->force_compile = true;
|
||||
$_compile_id_orig = $this->_compile_id;
|
||||
$this->_compile_id = null;
|
||||
|
||||
$_compile_path = $this->_get_compile_path($this->debug_tpl);
|
||||
if ($this->_process_template($this->debug_tpl, $_compile_path))
|
||||
{
|
||||
ob_start();
|
||||
include($_compile_path);
|
||||
$_results = ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
$this->force_compile = $_force_compile_orig;
|
||||
$this->_compile_id = $_compile_id_orig;
|
||||
|
||||
$this->left_delimiter = $_ldelim_orig;
|
||||
$this->right_delimiter = $_rdelim_orig;
|
||||
|
||||
return $_results;
|
||||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user