cvs: smarty /libs Smarty.class.php Smarty_Compiler.class.php /libs/plugins core.assign_smarty_interface.php core.display_debug_console.php
function.display_debug_console.php

From: Date: Wed, 07 May 2003 18:54:41 +0000
Subject: cvs: smarty /libs Smarty.class.php Smarty_Compiler.class.php /libs/plugins core.assign_smarty_interface.php core.display_debug_console.php
function.display_debug_console.php
Groups: php.smarty.cvs 
Request: Send a blank email to php-smarty-cvs+get-591@lists.php.net to get a copy of this message
mohrt Wed May 7 14:54:41 2003 EDT Added files: /smarty/libs/plugins core.assign_smarty_interface.php core.display_debug_console.php Removed files: /smarty/libs/plugins function.display_debug_console.php Modified files: /smarty/libs Smarty.class.php Smarty_Compiler.class.php Log: abstracted display_debug_console and assign_smarty_interface to plugin dir as a test Index: smarty/libs/Smarty.class.php diff -u smarty/libs/Smarty.class.php:1.393 smarty/libs/Smarty.class.php:1.394 --- smarty/libs/Smarty.class.php:1.393 Wed May 7 12:37:07 2003 +++ smarty/libs/Smarty.class.php Wed May 7 14:54:41 2003 @@ -42,7 +42,7 @@ * @version 2.5.0 */ -/* $Id: Smarty.class.php,v 1.393 2003/05/07 16:37:07 mohrt Exp $ */ +/* $Id: Smarty.class.php,v 1.394 2003/05/07 18:54:41 mohrt Exp $ */ /** * DIR_SEP isn't used anymore, but third party apps might @@ -1136,7 +1136,7 @@ // capture time for debugging info $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = $this->_get_microtime() - $_debug_start_time; - $_smarty_results .= $this->_display_debug_console(); + $_smarty_results .= $this->_execute_core_function('display_debug_console'); } if ($this->cache_modified_check) { $_last_modified_date = substr($GLOBALS['HTTP_SERVER_VARS']['HTTP_IF_MODIFIED_SINCE'], 0, strpos($GLOBALS['HTTP_SERVER_VARS']['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3); @@ -1209,7 +1209,7 @@ // capture time for debugging info $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = ($this->_get_microtime() - $_debug_start_time); - echo $this->_display_debug_console(); + echo $this->_execute_core_function('display_debug_console'); } error_reporting($_smarty_old_error_level); return; @@ -1219,45 +1219,15 @@ } } - - /** - * assign $smarty interface variable - */ - function _assign_smarty_interface() - { - if (isset($this->_smarty_vars) && isset($this->_smarty_vars['request'])) { - return; - } - - $_globals_map = array('g' => 'HTTP_GET_VARS', - 'p' => 'HTTP_POST_VARS', - 'c' => 'HTTP_COOKIE_VARS', - 's' => 'HTTP_SERVER_VARS', - 'e' => 'HTTP_ENV_VARS'); - - $_smarty_vars_request = array(); - - foreach (preg_split('!!', strtolower($this->request_vars_order)) as $c) { - if (isset($_globals_map[$c])) { - $_smarty_vars_request = array_merge($_smarty_vars_request, $GLOBALS[$_globals_map[$c]]); - } - } - $_smarty_vars_request = @array_merge($_smarty_vars_request, $GLOBALS['HTTP_SESSION_VARS']); - - $this->_smarty_vars['request'] = $_smarty_vars_request; - - } - - /** - * display debug console - * @return string debug.tpl template output - * @uses $debug_tpl debug template, used to display debugging output + * execute core function + * @return mixed value of function return */ - function _display_debug_console() + function _execute_core_function($funcname, $params=null) { - require_once($this->_get_plugin_filepath('function', 'display_debug_console')); - return smarty_function_display_debug_console(null, $this); + require_once($this->_get_plugin_filepath('core', $funcname)); + $_core_funcname = 'smarty_core_' . $funcname; + return $_core_funcname($params, $this); } /** Index: smarty/libs/Smarty_Compiler.class.php diff -u smarty/libs/Smarty_Compiler.class.php:1.224 smarty/libs/Smarty_Compiler.class.php:1.225 --- smarty/libs/Smarty_Compiler.class.php:1.224 Mon May 5 14:36:11 2003 +++ smarty/libs/Smarty_Compiler.class.php Wed May 7 14:54:41 2003 @@ -39,7 +39,7 @@ * @package Smarty */ -/* $Id: Smarty_Compiler.class.php,v 1.224 2003/05/05 18:36:11 mohrt Exp $ */ +/* $Id: Smarty_Compiler.class.php,v 1.225 2003/05/07 18:54:41 mohrt Exp $ */ /** * Template compiling class * @package Smarty @@ -352,7 +352,7 @@ } if ($this->_init_smarty_vars) { - $template_header .= "<?php \$this->_assign_smarty_interface(); ?>\n"; + $template_header .= "<?php \$this->_execute_core_function('assign_smarty_interface'); ?>\n"; $this->_init_smarty_vars = false; } Index: smarty/libs/plugins/core.assign_smarty_interface.php +++ smarty/libs/plugins/core.assign_smarty_interface.php <?php /** * Smarty plugin * @package Smarty * @subpackage plugins */ /* * Smarty assign_smarty_interface core plugin * * Type: core<br> * Name: assign_smarty_interface<br> * Purpose: assign the $smarty interface variable * @param array Format: null * @param Smarty */ function smarty_core_assign_smarty_interface($params, &$this) { if (isset($this->_smarty_vars) && isset($this->_smarty_vars['request'])) { return; } $_globals_map = array('g' => 'HTTP_GET_VARS', 'p' => 'HTTP_POST_VARS', 'c' => 'HTTP_COOKIE_VARS', 's' => 'HTTP_SERVER_VARS', 'e' => 'HTTP_ENV_VARS'); $_smarty_vars_request = array(); foreach (preg_split('!!', strtolower($this->request_vars_order)) as $_c) { if (isset($_globals_map[$_c])) { $_smarty_vars_request = array_merge($_smarty_vars_request, $GLOBALS[$_globals_map[$_c]]); } } $_smarty_vars_request = @array_merge($_smarty_vars_request, $GLOBALS['HTTP_SESSION_VARS']); $this->_smarty_vars['request'] = $_smarty_vars_request; } /* vim: set expandtab: */ ?> Index: smarty/libs/plugins/core.display_debug_console.php +++ smarty/libs/plugins/core.display_debug_console.php <?php /** * Smarty plugin * @package Smarty * @subpackage plugins */ /* * Smarty debug_console function plugin * * Type: core<br> * Name: display_debug_console<br> * Purpose: display the javascript debug console window * @param array Format: null * @param Smarty */ function smarty_core_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: */ ?>

« previous php.smarty.cvs (#591) next »