Chris PeBenito 696b41
Chris PeBenito 696b41
/**
Chris PeBenito 696b41
 * Smarty plugin
Chris PeBenito 696b41
 * @package Smarty
Chris PeBenito 696b41
 * @subpackage plugins
Chris PeBenito 696b41
 */
Chris PeBenito 696b41
Chris PeBenito 696b41
/**
Chris PeBenito 696b41
 * Smarty debug_console function plugin
Chris PeBenito 696b41
 *
Chris PeBenito 696b41
 * Type:     core
Chris PeBenito 696b41
 * Name:     display_debug_console
Chris PeBenito 696b41
 * Purpose:  display the javascript debug console window
Chris PeBenito 696b41
 * @param array Format: null
Chris PeBenito 696b41
 * @param Smarty
Chris PeBenito 696b41
 */
Chris PeBenito 696b41
function smarty_core_display_debug_console($params, &$smarty)
Chris PeBenito 696b41
{
Chris PeBenito 696b41
    // we must force compile the debug template in case the environment
Chris PeBenito 696b41
    // changed between separate applications.
Chris PeBenito 696b41
Chris PeBenito 696b41
    if(empty($smarty->debug_tpl)) {
Chris PeBenito 696b41
        // set path to debug template from SMARTY_DIR
Chris PeBenito 696b41
        $smarty->debug_tpl = SMARTY_DIR . 'debug.tpl';
Chris PeBenito 696b41
        if($smarty->security && is_file($smarty->debug_tpl)) {
Chris PeBenito 696b41
            $smarty->secure_dir[] = dirname(realpath($smarty->debug_tpl));
Chris PeBenito 696b41
        }
Chris PeBenito 696b41
        $smarty->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl';
Chris PeBenito 696b41
    }
Chris PeBenito 696b41
Chris PeBenito 696b41
    $_ldelim_orig = $smarty->left_delimiter;
Chris PeBenito 696b41
    $_rdelim_orig = $smarty->right_delimiter;
Chris PeBenito 696b41
Chris PeBenito 696b41
    $smarty->left_delimiter = '{';
Chris PeBenito 696b41
    $smarty->right_delimiter = '}';
Chris PeBenito 696b41
Chris PeBenito 696b41
    $_compile_id_orig = $smarty->_compile_id;
Chris PeBenito 696b41
    $smarty->_compile_id = null;
Chris PeBenito 696b41
Chris PeBenito 696b41
    $_compile_path = $smarty->_get_compile_path($smarty->debug_tpl);
Chris PeBenito 696b41
    if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path))
Chris PeBenito 696b41
    {
Chris PeBenito 696b41
        ob_start();
Chris PeBenito 696b41
        $smarty->_include($_compile_path);
Chris PeBenito 696b41
        $_results = ob_get_contents();
Chris PeBenito 696b41
        ob_end_clean();
Chris PeBenito 696b41
    } else {
Chris PeBenito 696b41
        $_results = '';
Chris PeBenito 696b41
    }
Chris PeBenito 696b41
Chris PeBenito 696b41
    $smarty->_compile_id = $_compile_id_orig;
Chris PeBenito 696b41
Chris PeBenito 696b41
    $smarty->left_delimiter = $_ldelim_orig;
Chris PeBenito 696b41
    $smarty->right_delimiter = $_rdelim_orig;
Chris PeBenito 696b41
Chris PeBenito 696b41
    return $_results;
Chris PeBenito 696b41
}
Chris PeBenito 696b41
Chris PeBenito 696b41
/* vim: set expandtab: */
Chris PeBenito 696b41
Chris PeBenito 696b41
?>