本文整理汇总了PHP中Smarty_Internal_Debug::index方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty_Internal_Debug::index方法的具体用法?PHP Smarty_Internal_Debug::index怎么用?PHP Smarty_Internal_Debug::index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smarty_Internal_Debug
的用法示例。
在下文中一共展示了Smarty_Internal_Debug::index方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_debug
/**
* Opens a window for the Smarty Debugging Console and display the data
*
* @param Smarty_Internal_Template|Smarty $obj object to debug
* @param bool $full
*/
public static function display_debug($obj, $full = false)
{
if (!$full) {
self::$offset++;
$savedIndex = self::$index;
self::$index = 9999;
}
// prepare information of assigned variables
$ptr = self::get_debug_vars($obj);
if ($obj instanceof Smarty) {
$smarty = clone $obj;
} else {
$smarty = clone $obj->smarty;
}
$debugging = $smarty->debugging;
$_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->smarty->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[self::$index]);
} 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', $debugging == 2 || !$full);
$_template->assign('offset', self::$offset * 50);
echo $_template->fetch();
if (isset($full)) {
self::$index--;
}
if (!$full) {
self::$index = $savedIndex;
}
}
示例2: display_debug
/**
* Opens a window for the Smarty Debugging Console and display the data
* @param Smarty_Internal_Template|Smarty $obj object to debug
* @param bool $full
*/
public static function display_debug($obj, $full = FALSE)
{
if (!$full) {
self::$offset++;
$savedIndex = self::$index;
self::$index = 9999;
}
if ($obj instanceof Smarty) {
$smarty = $obj;
} else {
$smarty = $obj->smarty;
}
// create fresh instance of smarty for displaying the debug console
// to avoid problems if the application did overload the Smarty class
$debObj = new Smarty();
// copy the working dirs from application
$debObj->setCompileDir($smarty->getCompileDir());
// init properties by hand as user may have edited the original Smarty class
$debObj->setPluginsDir(is_dir(__DIR__ . '/../plugins') ? __DIR__ . '/../plugins' : $smarty->getPluginsDir());
$debObj->force_compile = FALSE;
$debObj->compile_check = TRUE;
$debObj->left_delimiter = '{';
$debObj->right_delimiter = '}';
$debObj->security_policy = NULL;
$debObj->debugging = FALSE;
$debObj->debugging_ctrl = 'NONE';
$debObj->error_reporting = E_ALL & ~E_NOTICE;
$debObj->debug_tpl = isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . __DIR__ . '/../debug.tpl';
$debObj->registered_plugins = [];
$debObj->registered_resources = [];
$debObj->registered_filters = [];
$debObj->autoload_filters = [];
$debObj->default_modifiers = [];
$debObj->escape_html = TRUE;
$debObj->caching = FALSE;
$debObj->compile_id = NULL;
$debObj->cache_id = NULL;
// prepare information of assigned variables
$ptr = self::get_debug_vars($obj);
$_assigned_vars = $ptr->tpl_vars;
ksort($_assigned_vars);
$_config_vars = $ptr->config_vars;
ksort($_config_vars);
$debugging = $smarty->debugging;
$_template = new Smarty_Internal_Template($debObj->debug_tpl, $debObj);
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[self::$index]);
} 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', $debugging == 2 || !$full);
$_template->assign('offset', self::$offset * 50);
echo $_template->fetch();
if (isset($full)) {
self::$index--;
}
if (!$full) {
self::$index = $savedIndex;
}
}