Automatically exported from code.google.com/p/planningalerts
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

function.assign_debug_info.php 1.1 KiB

17 anos atrás
12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * Smarty plugin
  4. * @package Smarty
  5. * @subpackage plugins
  6. */
  7. /**
  8. * Smarty {assign_debug_info} function plugin
  9. *
  10. * Type: function<br>
  11. * Name: assign_debug_info<br>
  12. * Purpose: assign debug info to the template<br>
  13. * @author Monte Ohrt <monte at ohrt dot com>
  14. * @param array unused in this plugin, this plugin uses {@link Smarty::$_config},
  15. * {@link Smarty::$_tpl_vars} and {@link Smarty::$_smarty_debug_info}
  16. * @param Smarty
  17. */
  18. function smarty_function_assign_debug_info($params, &$smarty)
  19. {
  20. $assigned_vars = $smarty->_tpl_vars;
  21. ksort($assigned_vars);
  22. if (@is_array($smarty->_config[0])) {
  23. $config_vars = $smarty->_config[0];
  24. ksort($config_vars);
  25. $smarty->assign("_debug_config_keys", array_keys($config_vars));
  26. $smarty->assign("_debug_config_vals", array_values($config_vars));
  27. }
  28. $included_templates = $smarty->_smarty_debug_info;
  29. $smarty->assign("_debug_keys", array_keys($assigned_vars));
  30. $smarty->assign("_debug_vals", array_values($assigned_vars));
  31. $smarty->assign("_debug_tpls", $included_templates);
  32. }
  33. /* vim: set expandtab: */
  34. ?>