예제 #1
0
 /**
  * Opens a window for the Smarty Debugging Consol and display the data
  *
  * @param Smarty_Internal_Template|Smarty $obj object to debug
  */
 public static function display_debug($obj, $full = false)
 {
     // prepare information of assigned variables
     $ptr = self::get_debug_vars($obj);
     if ($obj instanceof Smarty) {
         $smarty = clone $obj;
     } else {
         $smarty = clone $obj->smarty;
     }
     $_assigned_vars = $ptr->tpl_vars;
     ksort($_assigned_vars);
     $_config_vars = $ptr->config_vars;
     ksort($_config_vars);
     $smarty->registered_filters = array();
     $smarty->autoload_filters = array();
     $smarty->default_modifiers = array();
     $smarty->force_compile = false;
     $smarty->left_delimiter = '{';
     $smarty->right_delimiter = '}';
     $smarty->debugging = false;
     $smarty->debugging_ctrl = 'NONE';
     $smarty->force_compile = false;
     $_template = new Smarty_Internal_Template($smarty->debug_tpl, $smarty);
     $_template->caching = false;
     $_template->disableSecurity();
     $_template->cache_id = null;
     $_template->compile_id = null;
     if ($obj instanceof Smarty_Internal_Template) {
         $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name);
     }
     if ($obj instanceof Smarty || $full) {
         $_template->assign('template_data', self::$template_data);
     } else {
         $_template->assign('template_data', null);
     }
     $_template->assign('assigned_vars', $_assigned_vars);
     $_template->assign('config_vars', $_config_vars);
     $_template->assign('execution_time', microtime(true) - $smarty->start_time);
     $_template->assign('display_mode', $smarty->debugging == 2 || !$full);
     echo $_template->fetch();
     if ($full) {
         self::$ignore_uid = array();
         self::$template_data = array();
     }
 }