58 self::$template_data[self::$index] = null;
60 $key = self::get_key($template);
61 self::$template_data[self::$index][$key][
'start_template_time'] = microtime(
true);
71 $key = self::get_key($template);
72 self::$template_data[self::$index][$key][
'total_time'] += microtime(
true) - self::$template_data[self::$index][$key][
'start_template_time'];
73 self::$template_data[self::$index][$key][
'properties'] = $template->properties;
83 static $_is_stringy = array(
'string' =>
true,
'eval' =>
true);
84 if (!empty($template->compiler->trace_uid)) {
85 $key = $template->compiler->trace_uid;
86 if (!isset(self::$template_data[self::$index][$key])) {
87 if (isset($_is_stringy[$template->source->type])) {
88 self::$template_data[self::$index][$key][
'name'] =
'\'' . substr($template->source->name, 0, 25) .
'...\'';
90 self::$template_data[self::$index][$key][
'name'] = $template->source->filepath;
92 self::$template_data[self::$index][$key][
'compile_time'] = 0;
93 self::$template_data[self::$index][$key][
'render_time'] = 0;
94 self::$template_data[self::$index][$key][
'cache_time'] = 0;
97 if (isset(self::$ignore_uid[$template->source->uid])) {
100 $key = self::get_key($template);
102 self::$template_data[self::$index][$key][
'start_time'] = microtime(
true);
112 if (!empty($template->compiler->trace_uid)) {
113 $key = $template->compiler->trace_uid;
115 if (isset(self::$ignore_uid[$template->source->uid])) {
119 $key = self::get_key($template);
121 self::$template_data[self::$index][$key][
'compile_time'] += microtime(
true) - self::$template_data[self::$index][$key][
'start_time'];
131 $key = self::get_key($template);
132 self::$template_data[self::$index][$key][
'start_time'] = microtime(
true);
142 $key = self::get_key($template);
143 self::$template_data[self::$index][$key][
'render_time'] += microtime(
true) - self::$template_data[self::$index][$key][
'start_time'];
153 $key = self::get_key($template);
154 self::$template_data[self::$index][$key][
'start_time'] = microtime(
true);
164 $key = self::get_key($template);
165 self::$template_data[self::$index][$key][
'cache_time'] += microtime(
true) - self::$template_data[self::$index][$key][
'start_time'];
196 $savedIndex = self::$index;
199 if ($obj instanceof
Smarty) {
202 $smarty = $obj->smarty;
206 $debObj =
new Smarty();
208 $debObj->setCompileDir($smarty->getCompileDir());
210 $debObj->setPluginsDir(is_dir(__DIR__ .
'/../plugins') ? __DIR__ .
'/../plugins' : $smarty->getPluginsDir());
211 $debObj->force_compile =
false;
212 $debObj->compile_check =
true;
213 $debObj->left_delimiter =
'{';
214 $debObj->right_delimiter =
'}';
215 $debObj->security_policy = null;
216 $debObj->debugging =
false;
217 $debObj->debugging_ctrl =
'NONE';
218 $debObj->error_reporting = E_ALL & ~E_NOTICE;
219 $debObj->debug_tpl = isset($smarty->debug_tpl) ? $smarty->debug_tpl :
'file:' . __DIR__ .
'/../debug.tpl';
220 $debObj->registered_plugins = array();
221 $debObj->registered_resources = array();
222 $debObj->registered_filters = array();
223 $debObj->autoload_filters = array();
224 $debObj->default_modifiers = array();
225 $debObj->escape_html =
true;
226 $debObj->caching =
false;
227 $debObj->compile_id = null;
228 $debObj->cache_id = null;
230 $ptr = self::get_debug_vars($obj);
231 $_assigned_vars = $ptr->tpl_vars;
232 ksort($_assigned_vars);
233 $_config_vars = $ptr->config_vars;
234 ksort($_config_vars);
235 $debugging = $smarty->debugging;
239 $_template->assign(
'template_name', $obj->source->type .
':' . $obj->source->name);
241 if ($obj instanceof Smarty || $full) {
242 $_template->assign(
'template_data', self::$template_data[self::$index]);
244 $_template->assign(
'template_data', null);
246 $_template->assign(
'assigned_vars', $_assigned_vars);
247 $_template->assign(
'config_vars', $_config_vars);
248 $_template->assign(
'execution_time', microtime(
true) - $smarty->start_time);
249 $_template->assign(
'display_mode', $debugging == 2 || !$full);
250 $_template->assign(
'offset', self::$offset * 50);
251 echo $_template->fetch();
256 self::$index = $savedIndex;
270 foreach ($obj->config_vars as $key => $var) {
273 $config_vars[$key][
'scope'] = $obj->source->type .
':' . $obj->source->name;
275 $tpl_vars[$key][
'scope'] = $obj->dataObjectName;
281 foreach ($obj->tpl_vars as $key => $var) {
282 foreach ($var as $varkey => $varvalue) {
283 if ($varkey ==
'value') {
286 if ($varkey ==
'nocache') {
287 if ($varvalue ==
true) {
291 if ($varkey !=
'scope' || $varvalue !== 0) {
292 $tpl_vars[$key][
'attributes'][$varkey] = $varvalue;
298 $tpl_vars[$key][
'scope'] = $obj->source->type .
':' . $obj->source->name;
300 $tpl_vars[$key][
'scope'] = $obj->dataObjectName;
302 $tpl_vars[$key][
'scope'] =
'Smarty object';
306 if (isset($obj->parent)) {
307 $parent = self::get_debug_vars($obj->parent);
308 foreach (
$parent->tpl_vars as $name => $pvar) {
310 $tpl_vars[$name][
'scope'] = $pvar[
'scope'];
315 foreach (
$parent->config_vars as $name => $pvar) {
323 if (!array_key_exists($key,
$tpl_vars)) {
324 foreach ($var as $varkey => $varvalue) {
325 if ($varkey ==
'value') {
328 if ($varkey ==
'nocache') {
329 if ($varvalue ==
true) {
333 if ($varkey !=
'scope' || $varvalue !== 0) {
334 $tpl_vars[$key][
'attributes'][$varkey] = $varvalue;
356 static $_is_stringy = array(
'string' =>
true,
'eval' =>
true);
358 if ($template->source->uid ==
'') {
359 $template->source->filepath;
361 $key = $template->source->uid;
362 if (isset(self::$template_data[self::$index][$key])) {
365 if (isset($_is_stringy[$template->source->type])) {
366 self::$template_data[self::$index][$key][
'name'] =
'\'' . substr($template->source->name, 0, 25) .
'...\'';
368 self::$template_data[self::$index][$key][
'name'] = $template->source->filepath;
370 self::$template_data[self::$index][$key][
'compile_time'] = 0;
371 self::$template_data[self::$index][$key][
'render_time'] = 0;
372 self::$template_data[self::$index][$key][
'cache_time'] = 0;
373 self::$template_data[self::$index][$key][
'total_time'] = 0;
387 if ($template->source->uid ==
'') {
388 $template->source->filepath;
390 self::$ignore_uid[$template->source->uid] =
true;
400 if (isset($_SERVER[
'QUERY_STRING'])) {
401 $_query_string = $_SERVER[
'QUERY_STRING'];
405 if (
false !== strpos($_query_string, $_template->smarty->smarty_debug_id)) {
406 if (
false !== strpos($_query_string, $_template->smarty->smarty_debug_id .
'=on')) {
408 setcookie(
'SMARTY_DEBUG',
true);
409 $_template->smarty->debugging =
true;
410 } elseif (
false !== strpos($_query_string, $_template->smarty->smarty_debug_id .
'=off')) {
412 setcookie(
'SMARTY_DEBUG',
false);
413 $_template->smarty->debugging =
false;
416 $_template->smarty->debugging =
true;
419 if (isset($_COOKIE[
'SMARTY_DEBUG'])) {
420 $_template->smarty->debugging =
true;