smarty_internal_compile_debug.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Smarty Internal Plugin Compile Debug
  4. *
  5. * Compiles the {debug} tag.
  6. * It opens a window the the Smarty Debugging Console.
  7. *
  8. * @package Smarty
  9. * @subpackage Compiler
  10. * @author Uwe Tews
  11. */
  12. /**
  13. * Smarty Internal Plugin Compile Debug Class
  14. *
  15. * @package Smarty
  16. * @subpackage Compiler
  17. */
  18. class Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase {
  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. * @return string compiled code
  25. */
  26. public function compile($args, $compiler)
  27. {
  28. // check and get attributes
  29. $_attr = $this->getAttributes($compiler, $args);
  30. // compile always as nocache
  31. $compiler->tag_nocache = true;
  32. // display debug template
  33. $_output = "<?php \$_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug(\$_smarty_tpl); ?>";
  34. return $_output;
  35. }
  36. }
  37. ?>