/** * Smarty debug_print_var modifier plugin * * Type: modifier<br> * Name: debug_print_var<br> * Purpose: formats variable contents for display in the console * @link http://smarty.php.net/manual/en/language.modifier.debug.print.var.php * debug_print_var (Smarty online manual) * @author Monte Ohrt <monte at ohrt dot com> * @param array|object * @param integer * @param integer * @return string */ function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40) { $_replace = array("\n" => '<i>\\n</i>', "\r" => '<i>\\r</i>', "\t" => '<i>\\t</i>'); switch (gettype($var)) { case 'array': $results = '<b>Array (' . count($var) . ')</b>'; foreach ($var as $curr_key => $curr_val) { $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b>' . strtr($curr_key, $_replace) . '</b> => ' . smarty_modifier_debug_print_var($curr_val, ++$depth, $length); $depth--; } break; case 'object': $object_vars = get_object_vars($var); $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>'; foreach ($object_vars as $curr_key => $curr_val) { $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b> ->' . strtr($curr_key, $_replace) . '</b> = ' . smarty_modifier_debug_print_var($curr_val, ++$depth, $length); $depth--; } break; case 'boolean': case 'NULL': case 'resource': if (true === $var) { $results = 'true'; } elseif (false === $var) { $results = 'false'; } elseif (null === $var) { $results = 'null'; } else { //$results = htmlspecialchars((string) $var); $results = encode_htmlspecialchars((string) $var); // web28 2013-01-11 - use encode_htmlentities (PHP5.4 ready) } $results = '<i>' . $results . '</i>'; break; case 'integer': case 'float': $results = htmlspecialchars((string) $var); break; case 'string': $results = strtr($var, $_replace); if (strlen($var) > $length) { $results = substr($var, 0, $length - 3) . '...'; } //$results = htmlspecialchars('"' . $results . '"'); $results = encode_htmlspecialchars('"' . $results . '"'); // web28 2013-01-11 - use encode_htmlentities (PHP5.4 ready) break; case 'unknown type': default: $results = strtr((string) $var, $_replace); if (strlen($results) > $length) { $results = substr($results, 0, $length - 3) . '...'; } //$results = htmlspecialchars($results); $results = encode_htmlspecialchars($results); // web28 2013-01-11 - use encode_htmlentities (PHP5.4 ready) } return $results; }
function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40) { if (is_array($var)) { $results = "<b>Array (" . count($var) . ")</b>"; foreach ($var as $curr_key => $curr_val) { $return = smarty_modifier_debug_print_var($curr_val, $depth + 1); $results .= '<br>\\r' . str_repeat(' ', $depth * 2) . "<b>{$curr_key}</b> => {$return}"; } return $results; } else { if (is_object($var)) { $object_vars = get_object_vars($var); $results = "<b>" . get_class($var) . " Object (" . count($object_vars) . ")</b>"; foreach ($object_vars as $curr_key => $curr_val) { $return = smarty_modifier_debug_print_var($curr_val, $depth + 1); $results .= '<br>\\r' . str_repeat(' ', $depth * 2) . "<b>{$curr_key}</b> => {$return}"; } return $results; } else { if (empty($var) && $var != "0") { return '<i>empty</i>'; } if (strlen($var) > $length) { $results = substr($var, 0, $length - 3) . '...'; } else { $results = $var; } $results = preg_replace("![\r\t\n]!", " ", $results); $results = htmlspecialchars($results); return $results; } } }
/** * Smarty debug_print_var modifier plugin * * Modified version of the default smarty plug-in that prevents endless looping when dealing with assigned * objects * * * * Type: modifier<br> * Name: debug_print_var<br> * Purpose: formats variable contents for display in the console * @link http://smarty.php.net/manual/en/language.modifier.debug.print.var.php * debug_print_var (Smarty online manual) * @param array|object * @param integer * @param integer * @return string */ function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40) { $_replace = array("\n" => '<i>\n</i>', "\r" => '<i>\r</i>', "\t" => '<i>\t</i>'); if (is_array($var)) { $results = '<b>Array (' . count($var) . ')</b>'; foreach ($var as $curr_key => $curr_val) { $return = smarty_modifier_debug_print_var($curr_val, $depth + 1, $length); $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b>' . strtr($curr_key, $_replace) . "</b> => {$return}"; } } elseif (is_object($var)) { $object_vars = get_object_vars($var); $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>'; foreach ($object_vars as $curr_key => $curr_val) { if (is_object($curr_val)) { $return = '[object ' . get_class($curr_val) . ']'; } else { $return = smarty_modifier_debug_print_var($curr_val, $depth + 1, $length); } $results .= '<br>' . str_repeat(' ', $depth * 2) . "<b>{$curr_key}</b> => {$return}"; } } elseif (is_resource($var)) { $results = '<i>' . (string) $var . '</i>'; } elseif (empty($var) && $var != '0') { $results = '<i>empty</i>'; } else { if (strlen($var) > $length) { $results = substr($var, 0, $length - 3) . '...'; } else { $results = $var; } $results = htmlspecialchars($results); $results = strtr($results, $_replace); } return $results; }
/** * Formats variable contents for display in the console. * * @param array|object $var What is being modified. * @param integer $depth Depth to print arrays. * @param integer $length Max length. * * @link http://smarty.php.net/manual/en/language.modifier.debug.print.var.php * * @return string */ function smarty_modifier_zdebug_print_var($var, $depth = 0, $length = 40) { $_replace = array("\n" => '<i>\\n</i>', "\r" => '<i>\\r</i>', "\t" => '<i>\\t</i>'); if ($var instanceof Doctrine_Record || $var instanceof Doctrine_Collection) { $varname = get_class($var); $var = $var->toArray(); } switch (gettype($var)) { case 'array': $results = '<b>' . (isset($varname) ? "{$varname} Object" : 'Array') . ' (' . count($var) . ')</b>'; foreach ($var as $curr_key => $curr_val) { $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b>' . strtr($curr_key, $_replace) . '</b> => ' . smarty_modifier_debug_print_var($curr_val, ++$depth, $length); $depth--; } break; case 'object': $object_vars = get_object_vars($var); $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>'; foreach ($object_vars as $curr_key => $curr_val) { $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b> ->' . strtr($curr_key, $_replace) . '</b> = ' . smarty_modifier_debug_print_var($curr_val, ++$depth, $length); $depth--; } break; case 'boolean': case 'NULL': case 'resource': if (true === $var) { $results = 'true'; } elseif (false === $var) { $results = 'false'; } elseif (null === $var) { $results = 'null'; } else { $results = htmlspecialchars((string) $var); } $results = '<i>' . $results . '</i>'; break; case 'integer': case 'float': $results = htmlspecialchars((string) $var); break; case 'string': $results = strtr($var, $_replace); if (strlen($var) > $length) { $results = substr($var, 0, $length - 3) . '...'; } $results = htmlspecialchars('"' . $results . '"'); break; case 'unknown type': default: $results = strtr((string) $var, $_replace); if (strlen($results) > $length) { $results = substr($results, 0, $length - 3) . '...'; } $results = htmlspecialchars($results); } return $results; }
/** * Smarty debug_print_var modifier plugin * * Gallery modification: Filter all (hashed) passwords in smarty's debug output. * * Type: modifier<br> * Name: debug_print_var<br> * Purpose: formats variable contents for display in the console * @link http://smarty.php.net/manual/en/language.modifier.debug.print.var.php * debug_print_var (Smarty online manual) * @author Monte Ohrt <monte at ohrt dot com> * @param array|object * @param integer * @param integer * @param string * @return string */ function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40, $parentKey = '') { $_replace = array("\n" => '<i>\\n</i>', "\r" => '<i>\\r</i>', "\t" => '<i>\\t</i>'); if (!is_array($var) && !is_object($var) && stristr($parentKey, 'password') !== false) { $var = '[Not shown in debug output]'; } switch (gettype($var)) { case 'array': $results = '<b>Array (' . count($var) . ')</b>'; foreach ($var as $curr_key => $curr_val) { $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b>' . strtr($curr_key, $_replace) . '</b> => ' . smarty_modifier_debug_print_var($curr_val, ++$depth, $length, $curr_key); $depth--; } break; case 'object': $object_vars = get_object_vars($var); $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>'; foreach ($object_vars as $curr_key => $curr_val) { $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b> ->' . strtr($curr_key, $_replace) . '</b> = ' . smarty_modifier_debug_print_var($curr_val, ++$depth, $length, $curr_key); $depth--; } break; case 'boolean': case 'NULL': case 'resource': if (true === $var) { $results = 'true'; } elseif (false === $var) { $results = 'false'; } elseif (null === $var) { $results = 'null'; } else { $results = htmlspecialchars((string) $var); } $results = '<i>' . $results . '</i>'; break; case 'integer': case 'float': $results = htmlspecialchars((string) $var); break; case 'string': $results = strtr($var, $_replace); if (strlen($var) > $length) { $results = substr($var, 0, $length - 3) . '...'; } $results = htmlspecialchars('"' . $results . '"'); break; case 'unknown type': default: $results = strtr((string) $var, $_replace); if (strlen($results) > $length) { $results = substr($results, 0, $length - 3) . '...'; } $results = htmlspecialchars($results); } return $results; }
/** * Smarty debug_print_var modifier plugin * * Type: modifier<br/> * Name: debug_print_var<br/> * Purpose: formats variable contents for display in the console * @link http://smarty.php.net/manual/en/language.modifier.debug.print.var.php * debug_print_var (Smarty online manual) * @author Monte Ohrt <monte at ohrt dot com> * @param array|object * @param integer * @param integer * @return string */ function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40) { $_replace = array(NEW_LINE => '<i>\n</i>', "\r" => '<i>\r</i>', "\t" => '<i>\t</i>'); if (is_array($var)) { $results = "<b>Array (" . count($var) . ")</b>"; foreach ($var as $curr_key => $curr_val) { $return = smarty_modifier_debug_print_var($curr_val, $depth + 1, $length); $results .= HTML_BR . str_repeat(HTML_NBSP, $depth * 2) . HTML_B_START . strtr($curr_key, $_replace) . "</b> => {$return}"; } } else { if (is_object($var)) { $object_vars = get_object_vars($var); $results = HTML_B_START . get_class($var) . " Object (" . count($object_vars) . ")</b>"; foreach ($object_vars as $curr_key => $curr_val) { $return = smarty_modifier_debug_print_var($curr_val, $depth + 1, $length); $results .= HTML_BR . str_repeat(HTML_NBSP, $depth * 2) . "<b>{$curr_key}</b> => {$return}"; } } else { if (is_resource($var)) { $results = '<i>' . (string) $var . '</i>'; } else { if (empty($var) && $var != "0") { $results = '<i>empty</i>'; } else { if (strlen($var) > $length) { $results = substr($var, 0, $length - 3) . '...'; } else { $results = $var; } $results = htmlspecialchars($results); $results = strtr($results, $_replace); } } } } return $results; }
function content_52a091bf149fe7_42771250($_smarty_tpl) { if (!is_callable('smarty_modifier_debug_print_var')) { include 'C:\\inetpub\\wwwroot\\idrc\\admin\\config\\Smarty\\libs\\plugins\\modifier.debug_print_var.php'; } $_smarty_tpl->_capture_stack[0][] = array('_smarty_debug', 'debug_output', null); ob_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Smarty Debug Console</title> <style type="text/css"> body, h1, h2, td, th, p { font-family: sans-serif; font-weight: normal; font-size: 0.9em; margin: 1px; padding: 0; } h1 { margin: 0; text-align: left; padding: 2px; background-color: #f0c040; color: black; font-weight: bold; font-size: 1.2em; } h2 { background-color: #9B410E; color: white; text-align: left; font-weight: bold; padding: 2px; border-top: 1px solid black; } body { background: black; } p, table, div { background: #f0ead8; } p { margin: 0; font-style: italic; text-align: center; } table { width: 100%; } th, td { font-family: monospace; vertical-align: top; text-align: left; width: 50%; } td { color: green; } .odd { background-color: #eeeeee; } .even { background-color: #fafafa; } .exectime { font-size: 0.8em; font-style: italic; } #table_assigned_vars th { color: blue; } #table_config_vars th { color: maroon; } </style> </head> <body> <h1>Smarty Debug Console - <?php if (isset($_smarty_tpl->tpl_vars['template_name']->value)) { echo smarty_modifier_debug_print_var($_smarty_tpl->tpl_vars['template_name']->value); } else { ?> Total Time <?php echo sprintf("%.5f", $_smarty_tpl->tpl_vars['execution_time']->value); } ?> </h1> <?php if (!empty($_smarty_tpl->tpl_vars['template_data']->value)) { ?> <h2>included templates & config files (load time in seconds)</h2> <div> <?php $_smarty_tpl->tpl_vars['template'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['template']->_loop = false; $_from = $_smarty_tpl->tpl_vars['template_data']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['template']->key => $_smarty_tpl->tpl_vars['template']->value) { $_smarty_tpl->tpl_vars['template']->_loop = true; ?> <font color=brown><?php echo $_smarty_tpl->tpl_vars['template']->value['name']; ?> </font> <span class="exectime"> (compile <?php echo sprintf("%.5f", $_smarty_tpl->tpl_vars['template']->value['compile_time']); ?> ) (render <?php echo sprintf("%.5f", $_smarty_tpl->tpl_vars['template']->value['render_time']); ?> ) (cache <?php echo sprintf("%.5f", $_smarty_tpl->tpl_vars['template']->value['cache_time']); ?> ) </span> <br> <?php } ?> </div> <?php } ?> <h2>assigned template variables</h2> <table id="table_assigned_vars"> <?php $_smarty_tpl->tpl_vars['vars'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['vars']->_loop = false; $_from = $_smarty_tpl->tpl_vars['assigned_vars']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $_smarty_tpl->tpl_vars['vars']->iteration = 0; foreach ($_from as $_smarty_tpl->tpl_vars['vars']->key => $_smarty_tpl->tpl_vars['vars']->value) { $_smarty_tpl->tpl_vars['vars']->_loop = true; $_smarty_tpl->tpl_vars['vars']->iteration++; ?> <tr class="<?php if ($_smarty_tpl->tpl_vars['vars']->iteration % 2 == 0) { ?> odd<?php } else { ?> even<?php } ?> "> <th>$<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['vars']->key, ENT_QUOTES, 'UTF-8', true); ?> </th> <td><?php echo smarty_modifier_debug_print_var($_smarty_tpl->tpl_vars['vars']->value); ?> </td></tr> <?php } ?> </table> <h2>assigned config file variables (outer template scope)</h2> <table id="table_config_vars"> <?php $_smarty_tpl->tpl_vars['vars'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['vars']->_loop = false; $_from = $_smarty_tpl->tpl_vars['config_vars']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $_smarty_tpl->tpl_vars['vars']->iteration = 0; foreach ($_from as $_smarty_tpl->tpl_vars['vars']->key => $_smarty_tpl->tpl_vars['vars']->value) { $_smarty_tpl->tpl_vars['vars']->_loop = true; $_smarty_tpl->tpl_vars['vars']->iteration++; ?> <tr class="<?php if ($_smarty_tpl->tpl_vars['vars']->iteration % 2 == 0) { ?> odd<?php } else { ?> even<?php } ?> "> <th><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['vars']->key, ENT_QUOTES, 'UTF-8', true); ?> </th> <td><?php echo smarty_modifier_debug_print_var($_smarty_tpl->tpl_vars['vars']->value); ?> </td></tr> <?php } ?> </table> </body> </html> <?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]); if (!empty($_capture_buffer)) { if (isset($_capture_assign)) { $_smarty_tpl->assign($_capture_assign, ob_get_contents()); } if (isset($_capture_append)) { $_smarty_tpl->append($_capture_append, ob_get_contents()); } Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean(); } else { $_smarty_tpl->capture_error(); } ?> <script type="text/javascript"> <?php $_smarty_tpl->tpl_vars['id'] = new Smarty_variable(md5(($tmp = @$_smarty_tpl->tpl_vars['template_name']->value) === null || $tmp === '' ? '' : $tmp), null, 0); ?> _smarty_console = window.open("","console<?php echo $_smarty_tpl->tpl_vars['id']->value; ?> ","width=680,height=600,resizable,scrollbars=yes"); _smarty_console.document.write("<?php echo strtr($_smarty_tpl->tpl_vars['debug_output']->value, array("\\" => "\\\\", "'" => "\\'", "\"" => "\\\"", "\r" => "\\r", "\n" => "\\n", "</" => "<\\/")); ?> "); _smarty_console.document.close(); </script> <?php }
$this->_sections['config_vars']['last'] = $this->_sections['config_vars']['iteration'] == $this->_sections['config_vars']['total']; ?> _smarty_console.document.write("<tr bgcolor=<?php if (!(1 & $this->_sections['config_vars']['index'])) { ?> #eeeeee<?php } else { ?> #fafafa<?php } ?> ><td valign=top><tt><font color=maroon>{#<?php echo $this->_tpl_vars['_debug_config_keys'][$this->_sections['config_vars']['index']]; ?> #}</font></tt></td><td><tt><font color=green><?php echo is_array($_tmp = smarty_modifier_debug_print_var($this->_tpl_vars['_debug_config_vals'][$this->_sections['config_vars']['index']])) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript'); ?> </font></tt></td></tr>"); <?php } } else { ?> _smarty_console.document.write("<tr bgcolor=#eeeeee><td colspan=2><tt><i>no config vars assigned</i></tt></td></tr>"); <?php } ?> _smarty_console.document.write("</table>"); _smarty_console.document.write("</BODY></HTML>"); _smarty_console.document.close(); </SCRIPT> <?php
<tr class="<?php if ($_smarty_tpl->getVariable('vars')->iteration % 2 == 0) { ?> odd<?php } else { ?> even<?php } ?> "> <th><?php echo smarty_modifier_escape($_smarty_tpl->getVariable('vars')->key, 'html'); ?> </th> <td><?php echo smarty_modifier_debug_print_var($_smarty_tpl->getVariable('vars')->value); ?> </td></tr> <?php } } ?> </table> </body> </html> <?php $_smarty_tpl->assign('debug_output', ob_get_contents()); $_smarty_tpl->smarty->_smarty_vars['capture']['default'] = ob_get_clean(); ?> <script type="text/javascript">
$this->_sections['config_vars']['rownum'] = $this->_sections['config_vars']['iteration']; $this->_sections['config_vars']['index_prev'] = $this->_sections['config_vars']['index'] - $this->_sections['config_vars']['step']; $this->_sections['config_vars']['index_next'] = $this->_sections['config_vars']['index'] + $this->_sections['config_vars']['step']; $this->_sections['config_vars']['first'] = $this->_sections['config_vars']['iteration'] == 1; $this->_sections['config_vars']['last'] = $this->_sections['config_vars']['iteration'] == $this->_sections['config_vars']['total']; ?> <tr class="<?php echo smarty_function_cycle(array('values' => "odd,even"), $this); ?> "> <th>{#<?php echo is_array($_tmp = $this->_tpl_vars['_debug_config_keys'][$this->_sections['config_vars']['index']]) ? $this->_run_mod_handler('escape', true, $_tmp, 'html') : smarty_modifier_escape($_tmp, 'html'); ?> #}</th> <td><?php echo smarty_modifier_debug_print_var($this->_tpl_vars['_debug_config_vals'][$this->_sections['config_vars']['index']]); ?> </td></tr> <?php } } else { ?> <tr><td><p>no config vars assigned</p></td></tr> <?php } ?> </table> </body> </html> <?php $this->_smarty_vars['capture']['default'] = ob_get_contents();
/** * Smarty debug_print_var modifier plugin * * Type: modifier<br> * Name: debug_print_var<br> * Purpose: formats variable contents for display in the console * @link http://smarty.php.net/manual/en/language.modifier.debug.print.var.php * debug_print_var (Smarty online manual) * @author Monte Ohrt <monte at ohrt dot com> * @param array|object * @param integer * @param integer * @return string */ function smarty_modifier_print_array($var, $depth = 0, $length = 40) { require_once 'modifier.debug_print_var.php'; switch (gettype($var)) { case 'array': $results = "array(\n"; foreach ($var as $curr_key => $curr_val) { $depth++; $results .= str_repeat(' ', $depth + 1) . "'" . $curr_key . "' => " . smarty_modifier_print_array($curr_val, $depth, $length) . ",\n"; $depth--; } $results .= str_repeat(' ', $depth + 1) . ")"; break; case 'object': $object_vars = get_object_vars($var); $results = get_class($var) . ' Object (' . count($object_vars) . ')'; foreach ($object_vars as $curr_key => $curr_val) { $depth++; $results .= str_repeat('', $depth + 1) . '->' . $curr_key . ' = ' . smarty_modifier_debug_print_var($curr_val, $depth, $length); $depth--; } break; case 'boolean': case 'NULL': case 'resource': if (true === $var) { $results .= 'TRUE'; } elseif (false === $var) { $results .= 'FALSE'; } elseif (null === $var) { $results .= ''; } else { $results = $var; } $results = $results; break; case 'integer': case 'float': $results = $var; break; case 'string': if (strlen($var) > $length) { $results = substr($var, 0, $length - 3) . '...'; } $results = "'" . $var . "'"; break; case 'unknown type': default: if (strlen($results) > $length) { $results = substr($results, 0, $length - 3) . '...'; } $results = "'" . $var . "'"; } if (empty($var)) { if (is_array($var)) { $results = "array()"; } elseif ($var === '0' || $var === 0) { $results = 0; } else { $results = "''"; } } return $results; }
public function smarty($file, $vars = array(), $testing = false) { global $bp, $ci, $page; $debug = !$testing && is_admin(2) && $ci->session->enable_profiler ? true : false; if ($debug) { $memory = memory_get_usage(); $start = microtime(true); $time = $start - $ci->benchmark->marker['total_execution_time_start']; } static $smarty = null; if (is_null($smarty)) { $functions = array('preg_replace', 'number_format', 'implode', 'explode', 'array_keys', 'array_values', 'array_flip', 'array_reverse', 'array_shift', 'array_unshift', 'array_pop', 'array_push', 'array_combine', 'array_merge'); if ($testing || $this->controller == '#post#') { $functions = array_merge(array('is_user', 'is_admin', 'in_group'), $functions); } $smarty = $page->plugin('Smarty', 'class'); $smarty->setCompileDir($smarty->getCompileDir() . $page->get('domain')); $smarty->assign(array('bp' => new BootstrapClone($bp), 'page' => new PageClone($page, $this->controller == '#post#' ? 'post' : 'blog'))); $security = new Smarty_Security($smarty); $security->php_functions = array_merge(array('isset', 'empty', 'count', 'in_array', 'is_array', 'time', 'nl2br'), $functions); // Smarty defaults $security->allow_super_globals = false; $security->allow_constants = false; $smarty->enableSecurity($security); } unset($vars['bp'], $vars['page']); $vars['blog'] = $this->blog; $smarty->assign($vars); $smarty->setTemplateDir(dirname($file) . '/'); try { $html = $smarty->fetch(basename($file)); if ($debug) { $smarty->loadPlugin('Smarty_Internal_Debug'); $debug = Smarty_Internal_Debug::display_debug($smarty); if (!is_callable('smarty_modifier_debug_print_var')) { include SMARTY_PLUGINS_DIR . 'modifier.debug_print_var.php'; } foreach ($debug['vars'] as $key => $obj) { if (strtolower($obj->scope) == 'global') { unset($debug['vars'][$key]); } else { $debug['vars'][$key] = smarty_modifier_debug_print_var($obj->value, 0, 80); } } $page->save('Smarty', array('memory' => $memory, 'file' => $file, 'start' => $time, 'time' => microtime(true) - $start, 'vars' => $debug['vars'])); } if (!empty($vars)) { $smarty->clearAssign(array_keys($vars)); } } catch (Exception $e) { $error = $e->getMessage(); if ($testing) { return htmlspecialchars_decode($error); } $html = '<p>' . $error . '</p>'; } return $testing ? true : $html; }
/** * Smarty debug_print_var modifier plugin * * Type: modifier<br> * Name: debug_print_var<br> * Purpose: formats variable contents for display in the console * * @author Monte Ohrt <monte at ohrt dot com> * @param array|object $var variable to be formatted * @param integer $depth maximum recursion depth if $var is an array * @param integer $length maximum string length if $var is a string * @return string */ function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40, &$history = array()) { foreach ($history as $h) { if ((is_object($var) || is_array($var)) && $var === $h) { return "RECURSION"; } } $history[] =& $var; $_replace = array("\n" => '<i>\\n</i>', "\r" => '<i>\\r</i>', "\t" => '<i>\\t</i>'); switch (gettype($var)) { case 'array': $results = '<b>Array (' . count($var) . ')</b>'; foreach ($var as $curr_key => $curr_val) { $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b>' . strtr($curr_key, $_replace) . '</b> => ' . smarty_modifier_debug_print_var($curr_val, ++$depth, $length, $history); $depth--; } break; case 'object': $object_vars = get_object_vars($var); $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>'; foreach ($object_vars as $curr_key => $curr_val) { $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b> ->' . strtr($curr_key, $_replace) . '</b> = ' . smarty_modifier_debug_print_var($curr_val, ++$depth, $length, $history); $depth--; } break; case 'boolean': case 'NULL': case 'resource': if (true === $var) { $results = 'true'; } elseif (false === $var) { $results = 'false'; } elseif (null === $var) { $results = 'null'; } else { $results = htmlspecialchars((string) $var); } $results = '<i>' . $results . '</i>'; break; case 'integer': case 'float': $results = htmlspecialchars((string) $var); break; case 'string': $results = strtr($var, $_replace); if (Smarty::$_MBSTRING) { if (mb_strlen($var, Smarty::$_CHARSET) > $length) { $results = mb_substr($var, 0, $length - 3, Smarty::$_CHARSET) . '...'; } } else { if (isset($var[$length])) { $results = substr($var, 0, $length - 3) . '...'; } } $results = htmlspecialchars('"' . $results . '"'); break; case 'unknown type': default: $results = strtr((string) $var, $_replace); if (Smarty::$_MBSTRING) { if (mb_strlen($results, Smarty::$_CHARSET) > $length) { $results = mb_substr($results, 0, $length - 3, Smarty::$_CHARSET) . '...'; } } else { if (strlen($results) > $length) { $results = substr($results, 0, $length - 3) . '...'; } } $results = htmlspecialchars($results); } return $results; }
public function displayDebug() { global $start_time; $this->display(); $this->_memory['display'] = memory_get_usage(); $this->_mempeak['display'] = memory_get_peak_usage(); $this->_time['display'] = microtime(true); if (!$this->ini_get_display_errors()) { return; } $memory_peak_usage = memory_get_peak_usage(); $hr = '<hr style="color:#F5F5F5;margin:2px" />'; $totalSize = 0; foreach (get_included_files() as $file) { $totalSize += filesize($file); } $totalQueryTime = 0; foreach (Db::getInstance()->queries as $data) { $totalQueryTime += $data['time']; } $hooktime = Hook::getHookTime(); arsort($hooktime); $totalHookTime = 0; foreach ($hooktime as $time) { $totalHookTime += $time; } $hookMemoryUsage = Hook::getHookMemoryUsage(); arsort($hookMemoryUsage); $totalHookMemoryUsage = 0; foreach ($hookMemoryUsage as $usage) { $totalHookMemoryUsage += $usage; } $globalSize = array(); $totalGlobalSize = 0; foreach ($GLOBALS as $key => $value) { if ($key != 'GLOBALS') { $totalGlobalSize += $size = $this->sizeofvar($value); if ($size > 1024) { $globalSize[$key] = round($size / 1024, 1); } } } arsort($globalSize); $cache = Cache::retrieveAll(); $totalCacheSize = $this->sizeofvar($cache); $output = ''; $output .= '<link href="' . Tools::getShopDomain(true) . '/modules/debugtoolbar/views/assets/css/debugtoolbar.css" rel="stylesheet" type="text/css" media="all">'; $output .= ' <div class="debugtoolbar"> <div class="debugtoolbar-window"> <div class="debugtoolbar-content-area"> '; /* LOAD TIME */ $output .= ' <div class="debugtoolbar-tab-pane debugtoolbar-table debugtoolbar-load-times">'; $output .= ' <table> <tr> <th>Name</th> <th>Running Time (ms)</th> </tr> <tr> <td class="debugtoolbar-table-first">Global Application</td> <td>' . $this->displayLoadTimeColor($this->_time['display'] - $start_time, true) . '</td> </tr> '; $last_time = $start_time; foreach ($this->_time as $k => $time) { $output .= ' <tr> <td class="debugtoolbar-table-first">' . ucfirst($k) . '</td> <td>' . $this->displayLoadTimeColor($time - $last_time, true) . '</td> </tr> '; $last_time = $time; } $output .= ' </table> '; $output .= ' </div>'; /* /LOAD TIME */ /* HOOK PROCESSING */ $output .= ' <div class="debugtoolbar-tab-pane debugtoolbar-table debugtoolbar-hook-processing">'; $output .= ' <table> <tr> <th>Name</th> <th>Running Time (ms) / Memory Usage</th> </tr> <tr> <td class="debugtoolbar-table-first">Global Hook</td> <td><pre>' . $this->displayLoadTimeColor($totalHookTime) . ' / ' . $this->displayMemoryColor($totalHookMemoryUsage) . '</pre></td> </tr> '; foreach ($hooktime as $hook => $time) { $output .= ' <tr> <td class="debugtoolbar-table-first">' . ucfirst($hook) . '</td> <td><pre>' . $this->displayLoadTimeColor($time) . ' / ' . $this->displayMemoryColor($hookMemoryUsage[$hook]) . '</pre></td> </tr> '; } $output .= ' </table> '; $output .= ' </div>'; /* /HOOK PROCESSING */ /* MEMORY PEAK USAGE */ $output .= ' <div class="debugtoolbar-tab-pane debugtoolbar-table debugtoolbar-memory-peak-usage">'; $output .= ' <table> <tr> <th>Name</th> <th>Memory Usage (Global)</th> </tr> <tr> <td class="debugtoolbar-table-first">Global Memory</td> <td><pre>' . $this->displayPeakMemoryColor($memory_peak_usage) . '</pre></td> </tr> '; foreach ($this->_memory as $k => $memory) { $last_memory = 0; $output .= ' <tr> <td class="debugtoolbar-table-first">' . ucfirst($k) . '</td> <td><pre>' . $this->displayMemoryColor($memory - $last_memory) . ' (' . $this->displayPeakMemoryColor($this->_mempeak[$k]) . ')</pre></td> </tr> '; $last_memory = $memory; } $output .= ' </table> '; $output .= ' </div>'; /* /MEMORY PEAK USAGE */ /* INCLUDED FILES */ $output .= ' <div class="debugtoolbar-tab-pane debugtoolbar-table debugtoolbar-included-files">'; $output .= ' <table> <tr> <th>#</th> <th>File</th> <th>Size</th> </tr> <tr> <td class="debugtoolbar-table-first">Size global files</td> <td><pre>' . $this->displayMemoryColor($totalSize) . '</pre></td> <td>-</td> </tr> '; $i = 1; foreach (get_included_files() as $file) { $f = ltrim(str_replace('\\', '/', str_replace(_PS_ROOT_DIR_, '', $file)), '/'); $f = dirname($file) . '/<span style="color: #0080b0">' . basename($file) . '</span>'; $output .= ' <tr> <td class="debugtoolbar-table-first">' . $i . '</td> <td><pre>' . $f . '</pre></td> <td>' . FileSizeConvert(@filesize($file)) . '</td> </tr> '; $i++; } $output .= ' </table> '; $output .= ' </div>'; /* /INCLUDED FILES */ /* SQL QUERIES */ $output .= ' <div class="debugtoolbar-tab-pane debugtoolbar-table debugtoolbar-sql-queries">'; $output .= ' <table> <tr> <th>Time</th> <th>Query</th> </tr> '; $array_queries = array(); $queries = Db::getInstance()->queries; uasort($queries, 'prestashop_querytime_sort'); foreach ($queries as $data) { $query_row = array('time' => $data['time'], 'query' => $data['query'], 'location' => $data['file'] . ':<span style="color:#0080b0">' . $data['line'] . '</span>', 'filesort' => false, 'rows' => 1, 'group_by' => false); if (preg_match('/^\\s*select\\s+/i', $data['query'])) { $explain = Db::getInstance()->executeS('explain ' . $data['query']); if (stristr($explain[0]['Extra'], 'filesort')) { $query_row['filesort'] = true; } foreach ($explain as $row) { $query_row['rows'] *= $row['rows']; } if (stristr($data['query'], 'group by') && !preg_match('/(avg|count|min|max|group_concat|sum)\\s*\\(/i', $data['query'])) { $query_row['group_by'] = true; } } $array_queries[] = $query_row; } foreach ($array_queries as $data) { $filestortGroup = ''; if (preg_match('/^\\s*select\\s+/i', $data['query'])) { if ($data['filesort']) { $filestortGroup .= '<b ' . $this->getTimeColor($data['time'] * 1000) . '>USING FILESORT</b> - '; } $filestortGroup .= $this->displayRowsBrowsed($data['rows']); if ($data['group_by']) { $filestortGroup .= ' - <b>Useless GROUP BY need to be removed</b>'; } } $output .= ' <tr> <td class="debugtoolbar-table-title" colspan="2"><strong>Query in : </strong>' . $data['location'] . ' - ' . $filestortGroup . '</td> </tr> <tr> <td class="debugtoolbar-table-first"><span ' . $this->getTimeColor($data['time'] * 1000) . '>' . round($data['time'] * 1000, 3) . ' ms</span></td> <td><pre>' . htmlspecialchars($data['query'], ENT_NOQUOTES, 'utf-8', false) . '</pre></td> </tr> '; } $output .= ' </table> '; $output .= ' </div>'; /* /SQL QUERIES */ /* TABLES */ $output .= ' <div class="debugtoolbar-tab-pane debugtoolbar-table debugtoolbar-sql-table">'; $output .= ' <table> <tr> <th>Nb call</th> <th>Table</th> </tr> '; $tables = Db::getInstance()->tables; arsort($tables); foreach ($tables as $table => $nb) { $output .= ' <tr> <td class="debugtoolbar-table-first"><b ' . $this->getTableColor($nb) . '>' . $nb . '</b></td> <td><pre>' . $table . '</pre></td> </tr> '; } $output .= ' </table> '; $output .= ' </div>'; /* /TABLES */ /* OBJECTMODEL */ if (isset(ObjectModel::$debug_list)) { $output .= ' <div class="debugtoolbar-tab-pane debugtoolbar-table debugtoolbar-objectmodel-instance">'; $output .= ' <table> <tr> <th>Nb call</th> <th>ObjectModel Instance</th> </tr> '; $list = ObjectModel::$debug_list; uasort($list, create_function('$a,$b', 'return (count($a) < count($b)) ? 1 : -1;')); $i = 0; foreach ($list as $class => $info) { echo ''; echo ''; $i++; $output .= ' <tr> <td class="debugtoolbar-table-first"><b ' . $this->getObjectModelColor(count($info)) . '>' . count($info) . '</b></td> <td><a href="#" onclick="$(\'#object_model_' . $i . '\').css(\'display\', $(\'#object_model_' . $i . '\').css(\'display\') == \'none\' ? \'block\' : \'none\'); return false" style="color:#0080b0">' . $class . '</a> <pre id="object_model_' . $i . '" style="display: none">'; foreach ($info as $trace) { $output .= ltrim(str_replace(array(_PS_ROOT_DIR_, '\\'), array('', '/'), $trace['file']), '/') . ' [' . $trace['line'] . ']<br />'; } $output .= '</pre></td> </tr> '; } $output .= ' </table> '; $output .= ' </div>'; } /* /OBJECTMODEL */ /* GETALLHEADERS */ $output .= ' <div class="debugtoolbar-tab-pane debugtoolbar-table debugtoolbar-getallheader">'; $output .= ' <table> <tr> <th>Name</th> <th>Value</th> </tr> '; $getallheaders = getallheaders(); foreach ($getallheaders as $name => $value) { $output .= ' <tr> <td class="debugtoolbar-table-first">' . $name . '</td> <td><pre>' . $value . '</pre></td> </tr> '; } stream_context_set_default(array('http' => array('method' => 'HEAD'))); $url = getUrl(); if ($get_headers = get_headers($url, 1)) { foreach ($get_headers as $name => $value) { $output .= ' <tr> <td class="debugtoolbar-table-first">' . $name . '</td> <td><pre>' . (is_array($value) ? $value[0] : $value) . '</pre></td> </tr> '; } } $output .= ' </table> '; $output .= ' </div>'; /* /GETALLHEADERS */ /* DATA */ $output .= ' <div class="debugtoolbar-tab-pane debugtoolbar-table debugtoolbar-getpost-data">'; $output .= ' <table> <tr> <th>Name</th> <th>Value</th> </tr> <tr> <td class="debugtoolbar-table-title" colspan="2">Post Data</td> </tr> '; $post = isset($_POST) ? $_POST : array(); if (!count($post)) { $output .= '<tr><td colspan="2">No POST Data Found</td></tr>'; } else { foreach ($post as $name => $value) { if (!is_array($value)) { $output .= ' <tr> <td class="debugtoolbar-table-first">' . $name . '</td> <td><pre>' . $value . '</pre></td> </tr> '; } else { $output .= ' <tr> <td class="debugtoolbar-table-first">' . $name . '</td> <td> '; foreach ($value as $k => $v) { $output .= ' <pre>' . $k . ' : ' . $v . '</pre> '; } $output .= ' </td> </tr> '; } } } $output .= ' <tr> <td class="debugtoolbar-table-title" colspan="2">Get Data</td> </tr> '; $get = isset($_GET) ? $_GET : array(); if (!count($get)) { $output .= '<tr><td colspan="2">No GET Data Found</td></tr>'; } else { foreach ($get as $name => $value) { $output .= ' <tr> <td class="debugtoolbar-table-first">' . $name . '</td> <td><pre>' . $value . '</pre></td> </tr> '; } } $output .= ' <tr> <td class="debugtoolbar-table-title" colspan="2">Server Data</td> </tr> '; $server = isset($_SERVER) ? $_SERVER : array(); if (!count($server)) { $output .= '<tr><td colspan="2">No SERVER Data Found</td></tr>'; } else { foreach ($server as $name => $value) { $output .= ' <tr> <td class="debugtoolbar-table-first">' . $name . '</td> <td><pre>' . $value . '</pre></td> </tr> '; } } $output .= ' </table> '; $output .= ' </div>'; /* /DATA */ /* DEBUG */ if (count($GLOBALS['debugtoolbar'])) { $output .= ' <div class="debugtoolbar-tab-pane debugtoolbar-table debugtoolbar-debug">'; $output .= ' <table> <tr> <th>Debug</th> </tr> '; $output .= ' <tr> <td colspan="2">' . $GLOBALS['debugtoolbar'] . '</td> </tr> '; $output .= ' </table> '; $output .= ' </div>'; } /* /DEBUG */ /* PS INFOS */ if (isset($this->context->employee->id)) { $ps_infos = array('version' => array('php' => phpversion(), 'server' => $_SERVER['SERVER_SOFTWARE'], 'memory_limit' => ini_get('memory_limit'), 'max_execution_time' => ini_get('max_execution_time')), 'database' => array('version' => Db::getInstance()->getVersion(), 'prefix' => _DB_PREFIX_, 'engine' => _MYSQL_ENGINE_), 'uname' => function_exists('php_uname') ? php_uname('s') . ' ' . php_uname('v') . ' ' . php_uname('m') : '', 'apache_instaweb' => Tools::apacheModExists('mod_instaweb'), 'shop' => array('ps' => _PS_VERSION_, 'url' => Tools::getHttpHost(true) . __PS_BASE_URI__, 'theme' => _THEME_NAME_), 'mail' => Configuration::get('PS_MAIL_METHOD') == 1, 'smtp' => array('server' => Configuration::get('PS_MAIL_SERVER'), 'user' => Configuration::get('PS_MAIL_USER'), 'password' => Configuration::get('PS_MAIL_PASSWD'), 'encryption' => Configuration::get('PS_MAIL_SMTP_ENCRYPTION'), 'port' => Configuration::get('PS_MAIL_SMTP_PORT')), 'user_agent' => $_SERVER['HTTP_USER_AGENT']); $tests = ConfigurationTest::getDefaultTests(); $tests_op = ConfigurationTest::getDefaultTestsOp(); $params_required_results = ConfigurationTest::check($tests); $params_optional_results = ConfigurationTest::check($tests_op); $tests_errors = array('phpversion' => 'Update your PHP version', 'upload' => 'Configure your server to allow file uploads', 'system' => 'Configure your server to allow the creation of directories and files with write permissions.', 'gd' => 'Enable the GD library on your server.', 'mysql_support' => 'Enable the MySQL support on your server.', 'config_dir' => 'Set write permissions for the "config" folder.', 'cache_dir' => 'Set write permissions for the "cache" folder.', 'sitemap' => 'Set write permissions for the "sitemap.xml" file.', 'img_dir' => 'Set write permissions for the "img" folder and subfolders.', 'log_dir' => 'Set write permissions for the "log" folder and subfolders.', 'mails_dir' => 'Set write permissions for the "mails" folder and subfolders.', 'module_dir' => 'Set write permissions for the "modules" folder and subfolders.', 'theme_lang_dir' => 'Set the write permissions for the "themes' . _THEME_NAME_ . '/lang/" folder and subfolders, recursively.', 'translations_dir' => 'Set write permissions for the "translations" folder and subfolders.', 'customizable_products_dir' => 'Set write permissions for the "upload" folder and subfolders.', 'virtual_products_dir' => 'Set write permissions for the "download" folder and subfolders.', 'fopen' => 'Allow the PHP fopen() function on your server', 'register_globals' => 'Set PHP "register_global" option to "Off"', 'gz' => 'Enable GZIP compression on your server.'); $output .= ' <div class="debugtoolbar-tab-pane debugtoolbar-table debugtoolbar-ps-info">'; $output .= "\r\n\t\t\t\t\t\t\t\t\t\t\t<script type=\"text/javascript\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\$(document).ready(function()\r\n\t\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\$.ajax({\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: 'GET',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\turl: '" . $this->context->link->getAdminLink('AdminInformation') . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata: {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'action': 'checkFiles',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'ajax': 1\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdataType: 'json',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsuccess: function(json)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar tab = {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'missing': 'Missing files',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'updated': 'Updated files'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t};\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (json.missing.length || json.updated.length)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$('#changedFilesDebugtoolbar').html('<div style=\"color:#ef8400;\">Changed/missing files have been detected.</div>');\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$('#changedFilesDebugtoolbar').html('<div style=\"color:#0080b0;\">No change has been detected in your files</div>');\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$.each(tab, function(key, lang)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (json[key].length)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar html = \$('<ul>').attr('id', key+'_files');\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$(json[key]).each(function(key, file)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thtml.append(\$('<li>').html(file))\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$('#changedFilesDebugtoolbar')\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.append(\$('<h3>').html(lang+' ('+json[key].length+')'))\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.append(html);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t\t\t</script>\r\n\t\t\t"; $output .= ' <table> <tr> <th>Name</th> <th>Value</th> </tr> '; $output .= ' <tr> <td class="debugtoolbar-table-title" colspan="2"><strong>Server Informations</strong></td> </tr> <tr> <td class="debugtoolbar-table-first">Server</td> <td><pre>' . htmlspecialchars($ps_infos['uname'], ENT_NOQUOTES, 'utf-8', false) . '</pre></td> </tr> <tr> <td class="debugtoolbar-table-first">Logiciel Serveur</td> <td><pre>' . htmlspecialchars($ps_infos['version']['server'], ENT_NOQUOTES, 'utf-8', false) . '</pre></td> </tr> <tr> <td class="debugtoolbar-table-first">PHP Version</td> <td><pre>' . htmlspecialchars($ps_infos['version']['php'], ENT_NOQUOTES, 'utf-8', false) . '</pre></td> </tr> <tr> <td class="debugtoolbar-table-first">Memory Limit</td> <td><pre>' . htmlspecialchars($ps_infos['version']['memory_limit'], ENT_NOQUOTES, 'utf-8', false) . '</pre></td> </tr> <tr> <td class="debugtoolbar-table-first">Max Execution Time</td> <td><pre>' . htmlspecialchars($ps_infos['version']['max_execution_time'], ENT_NOQUOTES, 'utf-8', false) . '</pre></td> </tr> '; $output .= ' <tr> <td class="debugtoolbar-table-title" colspan="2"><strong>Database Informations</strong></td> </tr> <tr> <td class="debugtoolbar-table-first">MySQL Version</td> <td><pre>' . htmlspecialchars($ps_infos['database']['version'], ENT_NOQUOTES, 'utf-8', false) . '</pre></td> </tr> <tr> <td class="debugtoolbar-table-first">MySQL Engine</td> <td><pre>' . htmlspecialchars($ps_infos['database']['engine'], ENT_NOQUOTES, 'utf-8', false) . '</pre></td> </tr> <tr> <td class="debugtoolbar-table-first">MySQL Prefix</td> <td><pre>' . htmlspecialchars($ps_infos['database']['prefix'], ENT_NOQUOTES, 'utf-8', false) . '</pre></td> </tr> '; $output .= ' <tr> <td class="debugtoolbar-table-title" colspan="2"><strong>Store Informations</strong></td> </tr> <tr> <td class="debugtoolbar-table-first">PrestaShop Version</td> <td><pre>' . htmlspecialchars($ps_infos['shop']['ps'], ENT_NOQUOTES, 'utf-8', false) . '</pre></td> </tr> <tr> <td class="debugtoolbar-table-first">Store Url</td> <td><pre>' . htmlspecialchars($ps_infos['shop']['url'], ENT_NOQUOTES, 'utf-8', false) . '</pre></td> </tr> <tr> <td class="debugtoolbar-table-first">Themes Use</td> <td><pre>' . htmlspecialchars($ps_infos['shop']['theme'], ENT_NOQUOTES, 'utf-8', false) . '</pre></td> </tr> '; if (!empty($ps_infos['mail'])) { $output .= ' <tr> <td class="debugtoolbar-table-title" colspan="2"><strong>Email Setting</strong></td> </tr> <tr> <td colspan="2"><pre>You are using the PHP mail function.</pre></td> </tr> '; } else { $output .= ' <tr> <td class="debugtoolbar-table-title" colspan="2"><strong>Email Setting</strong></td> </tr> <tr> <td class="debugtoolbar-table-first">SMTP Server</td> <td><pre>' . htmlspecialchars($ps_infos['smtp']['server'], ENT_NOQUOTES, 'utf-8', false) . '</pre></td> </tr> <tr> <td class="debugtoolbar-table-first">Cryptage</td> <td><pre>' . htmlspecialchars($ps_infos['smtp']['encryption'], ENT_NOQUOTES, 'utf-8', false) . '</pre></td> </tr> <tr> <td class="debugtoolbar-table-first">Port</td> <td><pre>' . htmlspecialchars($ps_infos['smtp']['port'], ENT_NOQUOTES, 'utf-8', false) . '</pre></td> </tr> <tr> <td class="debugtoolbar-table-first">Login</td> <td><pre>' . (!empty($ps_infos['smtp']['user']) ? '<span style="color:#90bd00;font-weight:bold;">OK</span>' : '<span style="color:#ff4141;font-weight:bold;">Not defined</span>') . '</pre></td> </tr> <tr> <td class="debugtoolbar-table-first">Password</td> <td><pre>' . (!empty($ps_infos['smtp']['password']) ? '<span style="color:#90bd00;font-weight:bold;">OK</span>' : '<span style="color:#ff4141;font-weight:bold;">Not defined</span>') . '</pre></td> </tr> '; } $output .= ' <tr> <td class="debugtoolbar-table-title" colspan="2"><strong>Your information</strong></td> </tr> <tr> <td class="debugtoolbar-table-first">Your web browser</td> <td><pre>' . htmlspecialchars($ps_infos['user_agent'], ENT_NOQUOTES, 'utf-8', false) . '</pre></td> </tr> '; $output .= ' <tr> <td class="debugtoolbar-table-title" colspan="2"><strong>Check your configuration</strong></td> </tr> '; $output .= ' <tr> <td class="debugtoolbar-table-first">Required parameters</td> '; if (!in_array('fail', $params_required_results)) { $output .= ' <td><pre><span style="color:#90bd00;font-weight:bold;">OK</span></pre></td> '; } else { $output .= ' <td> <pre><span style="color:#ff4141;font-weight:bold;">Please fix the following error(s)</span></pre> <ul> '; foreach ($params_required_results as $key => $value) { if ($value == 'fail') { $output .= ' <li>' . $tests_errors[$key] . '</li>'; } } $output .= ' </ul> </td> '; } $output .= ' </tr> '; $output .= ' <tr> <td class="debugtoolbar-table-first">Optional parameters</td> '; if (!in_array('fail', $params_optional_results)) { $output .= ' <td><pre><span style="color:#90bd00;font-weight:bold;">OK</span></pre></td> '; } else { $output .= ' <td> <pre><span style="color:#ff4141;font-weight:bold;">Please fix the following error(s)</span></pre> <ul> '; foreach ($params_optional_results as $key => $value) { if ($value == 'fail') { $output .= ' <li>' . $key . '</li>'; } } $output .= ' </ul> </td> '; } $output .= ' </tr> '; $output .= ' <tr> <td class="debugtoolbar-table-title" colspan="2"><strong>List of changed files</strong></td> </tr> '; $output .= ' <tr> <td colspan="2"><div id="changedFilesDebugtoolbar"><img src="../img/admin/ajax-loader.gif" /> Checking files...</div></td> </tr> '; $output .= ' </table> '; $output .= ' </div>'; } else { $output .= ' <div class="debugtoolbar-tab-pane debugtoolbar-table debugtoolbar-ps-info">'; $output .= ' <table> <tr> <td><pre><span style="color:#ff4141;font-weight:bold;">Not display in Front office</span></pre></td> </tr> </table> </div> '; } /* /PS INFOS */ /* SMARTY DEBUG */ $this->context->smarty->loadPlugin('Smarty_Internal_Debug'); // Smarty_Internal_Debug::display_debug($this->context->smarty); $SID = new Smarty_Internal_Debug(); $obj = $this->context->smarty; $ptr = $SID::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->force_compile = false; if ($obj instanceof Smarty_Internal_Template) { $template_name = $obj->source->type . ':' . $obj->source->name; } if ($obj instanceof Smarty) { $template_name = $SID::$template_data; } else { $template_name = null; } $execution_time = microtime(true) - $smarty->start_time; $assigned_vars = $_assigned_vars; $config_vars = $_config_vars; // echo 'assigned_vars<pre>'.print_r($assigned_vars['SCRIPT_NAME'], true).'</pre>';die; $output .= ' <div class="debugtoolbar-tab-pane debugtoolbar-table debugtoolbar-smarty-debug">'; $output .= ' <table> <tr> <th colspan="2">Smarty Debug Console - ' . (isset($template_name) && count($template_name) ? $template_name : 'Total Time ' . number_format($execution_time, 5, '.', '')) . '</th> </tr> '; if (isset($template_name) && count($template_name)) { foreach ($template_name as $template) { $output .= ' <tr> <td class="debugtoolbar-table-first"><font color=brown>' . $template['name'] . '</font></td> <td> <span style="font-size: 0.8em;font-style: italic;"> ' . number_format($template['compile_time'], 5, '.', '') . ' ' . number_format($template['render_time'], 5, '.', '') . ' ' . number_format($template['cache_time'], 5, '.', '') . ' </span> </td> </tr> '; } } $output .= ' <tr> <td class="debugtoolbar-table-title" colspan="2"><strong>Assigned template variables</strong></td> </tr> '; foreach ($assigned_vars as $key => $vars) { $output .= ' <tr> <td class="debugtoolbar-table-first">' . $key . '</td> <td><pre>' . smarty_modifier_debug_print_var($vars) . '</pre></td> </tr> '; } $output .= ' <tr> <td class="debugtoolbar-table-title" colspan="2"><trong>Assigned config file variables (outer template scope)</strong></td> </tr> '; foreach ($config_vars as $key => $vars) { $output .= ' <tr> <td class="debugtoolbar-table-first">' . $key . '</td> <td><pre>' . smarty_modifier_debug_print_var($vars) . '</pre></td> </tr> '; } $output .= ' </table> '; $output .= ' </div>'; /* SMARTY DEBUG */ /* ADMINER */ if (isset($this->context->employee->id)) { $output .= ' <div class="debugtoolbar-tab-pane debugtoolbar-table debugtoolbar-adminer">'; $output .= ' <table> <tr> <th>Adminer</th> </tr> '; $output .= ' <tr> <td colspan="2"> <iframe src="' . Tools::getShopDomain(true) . '/modules/debugtoolbar/tools/adminer/display.php?server=' . _DB_SERVER_ . '&username='******'&db=' . _DB_NAME_ . '" frameborder="0" height="880" width="100%" id="adminerFrame"></iframe> <script type="text/javascript"> $(\'#adminerFrame\').load(function(){ $self = $(this).contents(); $self.find("input[name=\'auth[server]\']").val("' . _DB_SERVER_ . '"); $self.find("input[name=\'auth[username]\']").val("' . _DB_USER_ . '"); $self.find("input[name=\'auth[password]\']").val("' . _DB_PASSWD_ . '"); $self.find("input[name=\'auth[db]\']").val("' . _DB_NAME_ . '"); }); </script> </td> </tr> '; $output .= ' </table> '; $output .= ' </div>'; } else { $output .= ' <div class="debugtoolbar-tab-pane debugtoolbar-table debugtoolbar-adminer">'; $output .= ' <table> <tr> <td><pre><span style="color:#ff4141;font-weight:bold;">Not display in Front office</span></pre></td> </tr> </table> </div> '; } /* /ADMINER */ $output .= ' </div> </div> <ul id="debugtoolbar-open-tabs" class="debugtoolbar-tabs"> <!-- LOAD TIME --> <li><a class="debugtoolbar-tab" data-debugtoolbar-tab="debugtoolbar-load-times">Time <span class="debugtoolbar-count">' . $this->displayLoadTimeColor($this->_time['display'] - $start_time) . '</span></a></li> <!-- /LOAD TIME --> <!-- HOOK PROCESSING --> <li><a class="debugtoolbar-tab" data-debugtoolbar-tab="debugtoolbar-hook-processing">Hook <span class="debugtoolbar-count">' . $this->displayLoadTimeColor($totalHookTime) . ' / ' . $this->displayMemoryColor($totalHookMemoryUsage) . '</span></a></li> <!-- /HOOK PROCESSING --> <!-- MEMORY PEAK USAGE --> <li><a class="debugtoolbar-tab" data-debugtoolbar-tab="debugtoolbar-memory-peak-usage">Memory <span class="debugtoolbar-count">' . $this->displayPeakMemoryColor($memory_peak_usage) . '</span></a></li> <!-- /MEMORY PEAK USAGE --> <!-- INCLUDED FILES --> <li><a class="debugtoolbar-tab" data-debugtoolbar-tab="debugtoolbar-included-files">Files <span class="debugtoolbar-count">' . sizeof(get_included_files()) . '</span></a></li> <!-- /INCLUDED FILES --> <!-- SQL QUERIES --> <li><a class="debugtoolbar-tab" data-debugtoolbar-tab="debugtoolbar-sql-queries">Sql <span class="debugtoolbar-count">' . $this->displaySQLQueries(count(Db::getInstance()->queries)) . '</span><span class="debugtoolbar-count">' . $this->displayLoadTimeColor($totalQueryTime) . '</span></a></li> <!-- /SQL QUERIES --> <!-- TABLE --> <li><a class="debugtoolbar-tab" data-debugtoolbar-tab="debugtoolbar-sql-table">Table</a></li> <!-- /TABLE --> <!-- OBJECTMODEL --> <li><a class="debugtoolbar-tab" data-debugtoolbar-tab="debugtoolbar-objectmodel-instance">ObjectModel</a></li> <!-- /OBJECTMODEL --> <!-- GETALLHEADERS --> <li><a class="debugtoolbar-tab" data-debugtoolbar-tab="debugtoolbar-getallheader">Header</a></li> <!-- /GETALLHEADERS --> <!-- DATA --> <li><a class="debugtoolbar-tab" data-debugtoolbar-tab="debugtoolbar-getpost-data">Data</a></li> <!-- /DATA --> <!-- PS INFOS --> <li><a class="debugtoolbar-tab" data-debugtoolbar-tab="debugtoolbar-ps-info">Infos</a></li> <!-- /PS INFOS --> <!-- SMARTY DEBUG --> <li><a class="debugtoolbar-tab" data-debugtoolbar-tab="debugtoolbar-smarty-debug">Smarty</a></li> <!-- /SMARTY DEBUG --> <!-- ADMINER --> <li><a class="debugtoolbar-tab" data-debugtoolbar-tab="debugtoolbar-adminer">Adminer</a></li> <!-- /ADMINER --> '; if (count($GLOBALS['debugtoolbar'])) { $output .= ' <!-- DEBUG --> <li><a class="debugtoolbar-tab" data-debugtoolbar-tab="debugtoolbar-debug">Debug</a></li> <!-- /DEBUG --> '; } $output .= ' <li class="debugtoolbar-tab-right"><a id="debugtoolbar-hide" href="#">↦</a></li> <li class="debugtoolbar-tab-right"><a id="debugtoolbar-close" href="#">×</a></li> <li class="debugtoolbar-tab-right"><a id="debugtoolbar-zoom" href="#">⇅</a></li> </ul> <ul id="debugtoolbar-closed-tabs" class="debugtoolbar-tabs"> <li><a id="debugtoolbar-show" href="#">↤</a></li> </ul> </div> '; $output .= '<script type="text/javascript" src="' . Tools::getShopDomain(true) . '/modules/debugtoolbar/views/assets/js/debugtoolbar.js"></script>'; echo $output; }
/** * Smarty debug_print_var modifier plugin * Type: modifier<br> * Name: debug_print_var<br> * Purpose: formats variable contents for display in the console * * @author Monte Ohrt <monte at ohrt dot com> * * @param array|object $var variable to be formatted * @param int $max maximum recursion depth if $var is an array or object * @param int $length maximum string length if $var is a string * @param int $depth actual recursion depth * @param array $objects processed objects in actual depth to prevent recursive object processing * * @return string */ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = 0, $objects = array()) { $_replace = array("\n" => '\\n', "\r" => '\\r', "\t" => '\\t'); switch (gettype($var)) { case 'array': $results = '<b>Array (' . count($var) . ')</b>'; if ($depth == $max) { break; } foreach ($var as $curr_key => $curr_val) { $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b>' . strtr($curr_key, $_replace) . '</b> => ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects); $depth--; } break; case 'object': $object_vars = get_object_vars($var); $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>'; if (in_array($var, $objects)) { $results .= ' called recursive'; break; } if ($depth == $max) { break; } $objects[] = $var; foreach ($object_vars as $curr_key => $curr_val) { $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b> ->' . strtr($curr_key, $_replace) . '</b> = ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects); $depth--; } break; case 'boolean': case 'NULL': case 'resource': if (true === $var) { $results = 'true'; } elseif (false === $var) { $results = 'false'; } elseif (null === $var) { $results = 'null'; } else { $results = htmlspecialchars((string) $var); } $results = '<i>' . $results . '</i>'; break; case 'integer': case 'float': $results = htmlspecialchars((string) $var); break; case 'string': $results = strtr($var, $_replace); if (Smarty::$_MBSTRING) { if (mb_strlen($var, Smarty::$_CHARSET) > $length) { $results = mb_substr($var, 0, $length - 3, Smarty::$_CHARSET) . '...'; } } else { if (isset($var[$length])) { $results = substr($var, 0, $length - 3) . '...'; } } $results = htmlspecialchars('"' . $results . '"', ENT_QUOTES, Smarty::$_CHARSET); break; case 'unknown type': default: $results = strtr((string) $var, $_replace); if (Smarty::$_MBSTRING) { if (mb_strlen($results, Smarty::$_CHARSET) > $length) { $results = mb_substr($results, 0, $length - 3, Smarty::$_CHARSET) . '...'; } } else { if (strlen($results) > $length) { $results = substr($results, 0, $length - 3) . '...'; } } $results = htmlspecialchars($results, ENT_QUOTES, Smarty::$_CHARSET); } return $results; }
function content_566e7c963704c6_87389114($_smarty_tpl) { if (!is_callable('smarty_modifier_debug_print_var')) { require_once 'C:\\Program Files (x86)\\Apache Software Foundation\\Apache2.2\\htdocs\\Smarty\\libs\\sysplugins/../plugins\\modifier.debug_print_var.php'; } $_smarty_tpl->properties['nocache_hash'] = '3852566e7c95e18872_90371982'; $_smarty_tpl->_capture_stack[0][] = array('_smarty_debug', 'debug_output', null); ob_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Smarty Debug Console</title> <style type="text/css"> body, h1, h2, h3, td, th, p { font-family: sans-serif; font-weight: normal; font-size: 0.9em; margin: 1px; padding: 0; } h1 { margin: 0; text-align: left; padding: 2px; background-color: #f0c040; color: black; font-weight: bold; font-size: 1.2em; } h2 { background-color: #9B410E; color: white; text-align: left; font-weight: bold; padding: 2px; border-top: 1px solid black; } h3 { text-align: left; font-weight: bold; color: black; font-size: 0.7em; padding: 2px; } body { background: black; } p, table, div { background: #f0ead8; } p { margin: 0; font-style: italic; text-align: center; } table { width: 100%; } th, td { font-family: monospace; vertical-align: top; text-align: left; } td { color: green; } .odd { background-color: #eeeeee; } .even { background-color: #fafafa; } .exectime { font-size: 0.8em; font-style: italic; } #bold div { color: black; font-weight: bold; } #blue h3 { color: blue; } #normal div { color: black; font-weight: normal; } #table_assigned_vars th { color: blue; font-weight: bold; } #table_config_vars th { color: maroon; } </style> </head> <body> <h1>Smarty <?php echo htmlspecialchars(Smarty::SMARTY_VERSION, ENT_QUOTES, 'UTF-8'); ?> Debug Console - <?php if (isset($_smarty_tpl->tpl_vars['template_name']->value)) { echo smarty_modifier_debug_print_var($_smarty_tpl->tpl_vars['template_name']->value); ?> <?php } if (!empty($_smarty_tpl->tpl_vars['template_data']->value)) { ?> Total Time <?php echo htmlspecialchars(sprintf("%.5f", $_smarty_tpl->tpl_vars['execution_time']->value), ENT_QUOTES, 'UTF-8'); } ?> </h1> <?php if (!empty($_smarty_tpl->tpl_vars['template_data']->value)) { ?> <h2>included templates & config files (load time in seconds)</h2> <div> <?php $_from = $_smarty_tpl->tpl_vars['template_data']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $_smarty_tpl->tpl_vars['template'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['template']->_loop = false; foreach ($_from as $_smarty_tpl->tpl_vars['template']->value) { $_smarty_tpl->tpl_vars['template']->_loop = true; $foreach_template_Sav = $_smarty_tpl->tpl_vars['template']; ?> <font color=brown><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['template']->value['name'], ENT_QUOTES, 'UTF-8'); ?> </font> <br> <span class="exectime"> (compile <?php echo htmlspecialchars(sprintf("%.5f", $_smarty_tpl->tpl_vars['template']->value['compile_time']), ENT_QUOTES, 'UTF-8'); ?> ) (render <?php echo htmlspecialchars(sprintf("%.5f", $_smarty_tpl->tpl_vars['template']->value['render_time']), ENT_QUOTES, 'UTF-8'); ?> ) (cache <?php echo htmlspecialchars(sprintf("%.5f", $_smarty_tpl->tpl_vars['template']->value['cache_time']), ENT_QUOTES, 'UTF-8'); ?> ) </span> <br> <?php $_smarty_tpl->tpl_vars['template'] = $foreach_template_Sav; } ?> </div> <?php } ?> <h2>assigned template variables</h2> <table id="table_assigned_vars"> <?php $_from = $_smarty_tpl->tpl_vars['assigned_vars']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $_smarty_tpl->tpl_vars['vars'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['vars']->_loop = false; $_smarty_tpl->tpl_vars['vars']->iteration = 0; foreach ($_from as $_smarty_tpl->tpl_vars['vars']->key => $_smarty_tpl->tpl_vars['vars']->value) { $_smarty_tpl->tpl_vars['vars']->_loop = true; $_smarty_tpl->tpl_vars['vars']->iteration++; $foreach_vars_Sav = $_smarty_tpl->tpl_vars['vars']; ?> <tr class="<?php if ($_smarty_tpl->tpl_vars['vars']->iteration % 2 == 0) { ?> odd<?php } else { ?> even<?php } ?> "> <td><h3><font color=blue>$<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['vars']->key, ENT_QUOTES, 'UTF-8'); ?> </font></h3> <?php if (isset($_smarty_tpl->tpl_vars['vars']->value['nocache'])) { ?> <b>Nocache</b></br><?php } ?> <?php if (isset($_smarty_tpl->tpl_vars['vars']->value['scope'])) { ?> <b>Origin:</b> <?php echo smarty_modifier_debug_print_var($_smarty_tpl->tpl_vars['vars']->value['scope'], 10, 80); } ?> </td> <td><h3>Value</h3><?php echo smarty_modifier_debug_print_var($_smarty_tpl->tpl_vars['vars']->value['value'], 10, 80); ?> </td> <td><?php if (isset($_smarty_tpl->tpl_vars['vars']->value['attributes'])) { ?> <h3>Attributes</h3><?php echo smarty_modifier_debug_print_var($_smarty_tpl->tpl_vars['vars']->value['attributes']); ?> <?php } ?> </td> <?php $_smarty_tpl->tpl_vars['vars'] = $foreach_vars_Sav; } ?> </table> <h2>assigned config file variables</h2> <table id="table_config_vars"> <?php $_from = $_smarty_tpl->tpl_vars['config_vars']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $_smarty_tpl->tpl_vars['vars'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['vars']->_loop = false; $_smarty_tpl->tpl_vars['vars']->iteration = 0; foreach ($_from as $_smarty_tpl->tpl_vars['vars']->key => $_smarty_tpl->tpl_vars['vars']->value) { $_smarty_tpl->tpl_vars['vars']->_loop = true; $_smarty_tpl->tpl_vars['vars']->iteration++; $foreach_vars_Sav = $_smarty_tpl->tpl_vars['vars']; ?> <tr class="<?php if ($_smarty_tpl->tpl_vars['vars']->iteration % 2 == 0) { ?> odd<?php } else { ?> even<?php } ?> "> <td><h3><font color=blue>#<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['vars']->key, ENT_QUOTES, 'UTF-8'); ?> #</font></h3> <?php if (isset($_smarty_tpl->tpl_vars['vars']->value['scope'])) { ?> <b>Origin:</b> <?php echo smarty_modifier_debug_print_var($_smarty_tpl->tpl_vars['vars']->value['scope'], 10, 80); } ?> </td> <td><?php echo smarty_modifier_debug_print_var($_smarty_tpl->tpl_vars['vars']->value['value'], 10, 80); ?> </td> </tr> <?php $_smarty_tpl->tpl_vars['vars'] = $foreach_vars_Sav; } ?> </table> </body> </html> <?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]); if (!empty($_capture_buffer)) { if (isset($_capture_assign)) { $_smarty_tpl->assign($_capture_assign, ob_get_contents()); } if (isset($_capture_append)) { $_smarty_tpl->append($_capture_append, ob_get_contents()); } Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean(); } else { $_smarty_tpl->capture_error(); } echo '<script'; ?> type="text/javascript"> <?php $_smarty_tpl->tpl_vars['id'] = new Smarty_Variable('', null, 0); ?> <?php if ($_smarty_tpl->tpl_vars['display_mode']->value) { $_smarty_tpl->tpl_vars['id'] = new Smarty_Variable(md5((string) $_smarty_tpl->tpl_vars['offset']->value . (string) $_smarty_tpl->tpl_vars['template_name']->value), null, 0); } ?> _smarty_console = window.open("", "console<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['id']->value, ENT_QUOTES, 'UTF-8'); ?> ", "width=680,height=600,left=<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['offset']->value, ENT_QUOTES, 'UTF-8'); ?> ,top=<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['offset']->value, ENT_QUOTES, 'UTF-8'); ?> ,resizable,scrollbars=yes"); _smarty_console.document.write("<?php echo strtr($_smarty_tpl->tpl_vars['debug_output']->value, array("\\" => "\\\\", "'" => "\\'", "\"" => "\\\"", "\r" => "\\r", "\n" => "\\n", "</" => "<\\/")); ?> "); _smarty_console.document.close(); <?php echo '</script'; ?> > <?php }
/** * Smarty debug_print_var modifier plugin * * Type: modifier<br> * Name: debug_print_var<br> * Purpose: formats variable contents for display in the console * * @author Monte Ohrt <monte at ohrt dot com> * @param array|object $var variable to be formatted * @param integer $depth maximum recursion depth if $var is an array * @param integer $length maximum string length if $var is a string * @return string */ function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40) { $_replace = array("\n" => '<i>\\n</i>', "\r" => '<i>\\r</i>', "\t" => '<i>\\t</i>'); switch (gettype($var)) { case 'array': $results = '<b>Array (' . count($var) . ')</b>'; foreach ($var as $curr_key => $curr_val) { $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b>' . strtr($curr_key, $_replace) . '</b> => ' . smarty_modifier_debug_print_var($curr_val, ++$depth, $length); $depth--; } break; case 'object': $object_vars = get_object_vars($var); $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>'; foreach ($object_vars as $curr_key => $curr_val) { $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b> ->' . strtr($curr_key, $_replace) . '</b> = ' . smarty_modifier_debug_print_var($curr_val, ++$depth, $length); $depth--; } break; case 'boolean': case 'NULL': case 'resource': if (true === $var) { $results = 'true'; } elseif (false === $var) { $results = 'false'; } elseif (null === $var) { $results = 'null'; } else { $results = htmlspecialchars((string) $var); } $results = '<i>' . $results . '</i>'; break; case 'integer': case 'float': $results = htmlspecialchars((string) $var); break; case 'string': $results = strtr($var, $_replace); if (SMARTY_MBSTRING && empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])) { if (mb_strlen($var, SMARTY_RESOURCE_CHAR_SET) > $length) { $results = mb_substr($var, 0, $length - 3, SMARTY_RESOURCE_CHAR_SET) . '...'; } } else { if (isset($var[$length])) { $results = substr($var, 0, $length - 3) . '...'; } } $results = htmlspecialchars('"' . $results . '"'); break; case 'unknown type': default: $results = strtr((string) $var, $_replace); if (SMARTY_MBSTRING && empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])) { if (mb_strlen($results, SMARTY_RESOURCE_CHAR_SET) > $length) { $results = mb_substr($results, 0, $length - 3, SMARTY_RESOURCE_CHAR_SET) . '...'; } } else { if (strlen($results) > $length) { $results = substr($results, 0, $length - 3) . '...'; } } $results = htmlspecialchars($results); } return $results; }
</table> <h2>assigned config file variables (outer template scope)</h2> <table id="table_config_vars"> <?php $_smarty_tpl->tpl_vars['vars'] = new Smarty_Variable; $_from = $_smarty_tpl->getVariable('config_vars')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');} $_smarty_tpl->tpl_vars['vars']->iteration=0; if ($_smarty_tpl->_count($_from) > 0){ foreach ($_from as $_smarty_tpl->tpl_vars['vars']->key => $_smarty_tpl->tpl_vars['vars']->value){ $_smarty_tpl->tpl_vars['vars']->iteration++; ?> <tr class="<?php if ($_smarty_tpl->tpl_vars['vars']->iteration%2==0){?>odd<?php }else{ ?>even<?php }?>"> <th><?php echo smarty_modifier_escape($_smarty_tpl->tpl_vars['vars']->key,'html');?> </th> <td><?php echo smarty_modifier_debug_print_var($_smarty_tpl->tpl_vars['vars']->value);?> </td></tr> <?php }} ?> </table> </body> </html> <?php $_smarty_tpl->assign('debug_output', ob_get_contents()); Smarty::$_smarty_vars['capture']['_smarty_debug']=ob_get_clean();?> <script type="text/javascript"> <?php $_smarty_tpl->tpl_vars['id'] = new Smarty_variable(md5((($tmp = @$_smarty_tpl->getVariable('template_name')->value)===null||$tmp==='' ? '' : $tmp)), null, null);?> _smarty_console = window.open("","console<?php echo $_smarty_tpl->getVariable('id')->value;?> ","width=680,height=600,resizable,scrollbars=yes"); _smarty_console.document.write("<?php echo smarty_modifier_escape($_smarty_tpl->getVariable('debug_output')->value,'javascript');?> "); _smarty_console.document.close(); </script>
<?php /* Smarty version 2.6.26, created on 2012-10-06 13:38:38 compiled from products/confirm.tpl */ require_once SMARTY_CORE_DIR . 'core.load_plugins.php'; smarty_core_load_plugins(array('plugins' => array(array('modifier', 'script_escape', 'products/confirm.tpl', 1, false), array('modifier', 'debug_print_var', 'products/confirm.tpl', 1, false), array('modifier', 'h', 'products/confirm.tpl', 33, false), array('modifier', 'sfTrim', 'products/confirm.tpl', 66, false), array('modifier', 'default', 'products/confirm.tpl', 159, false), array('modifier', 'nl2br', 'products/confirm.tpl', 189, false), array('modifier', 'nl2br_html', 'products/confirm.tpl', 201, false), array('modifier', 'function_exists', 'products/confirm.tpl', 233, false), array('modifier', 'strlen', 'products/confirm.tpl', 280, false), array('modifier', 'sfNoImageMainList', 'products/confirm.tpl', 281, false))), $this); echo smarty_modifier_debug_print_var(is_array($_tmp = $this->_tpl_vars['arrForm']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)); ?> <form name="form1" id="form1" method="post" action="?" enctype="multipart/form-data"> <input type="hidden" name="<?php echo is_array($_tmp = @TRANSACTION_ID_NAME) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp); ?> " value="<?php echo is_array($_tmp = $this->_tpl_vars['transactionid']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp); ?> " /> <input type="hidden" name="mode" value="complete" /> <?php $_from = is_array($_tmp = $this->_tpl_vars['arrSearchHidden']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp); if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } if (count($_from)) { foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['item']) { ?> <?php if (is_array(is_array($_tmp = $this->_tpl_vars['item']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp))) { ?>