You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

smarty_internal_compile_debug.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Smarty Internal Plugin Compile Debug
  4. * Compiles the {debug} tag.
  5. * It opens a window the the Smarty Debugging Console.
  6. *
  7. * @package Smarty
  8. * @subpackage Compiler
  9. * @author Uwe Tews
  10. */
  11. /**
  12. * Smarty Internal Plugin Compile Debug Class
  13. *
  14. * @package Smarty
  15. * @subpackage Compiler
  16. */
  17. class Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase
  18. {
  19. /**
  20. * Compiles code for the {debug} tag
  21. *
  22. * @param array $args array with attributes from parser
  23. * @param object $compiler compiler object
  24. *
  25. * @return string compiled code
  26. */
  27. public function compile($args, $compiler)
  28. {
  29. // check and get attributes
  30. $_attr = $this->getAttributes($compiler, $args);
  31. // compile always as nocache
  32. $compiler->tag_nocache = true;
  33. // display debug template
  34. $_output =
  35. "<?php \$_smarty_debug = new Smarty_Internal_Debug;\n \$_smarty_debug->display_debug(\$_smarty_tpl);\n";
  36. $_output .= "unset(\$_smarty_debug);\n?>";
  37. return $_output;
  38. }
  39. }