Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

smarty_internal_compile_shared_inheritance.php 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Smarty Internal Plugin Compile Shared Inheritance
  4. * Shared methods for {extends} and {block} tags
  5. *
  6. * @package Smarty
  7. * @subpackage Compiler
  8. * @author Uwe Tews
  9. */
  10. /**
  11. * Smarty Internal Plugin Compile Shared Inheritance Class
  12. *
  13. * @package Smarty
  14. * @subpackage Compiler
  15. */
  16. class Smarty_Internal_Compile_Shared_Inheritance extends Smarty_Internal_CompileBase
  17. {
  18. /**
  19. * Register post compile callback to compile inheritance initialization code
  20. *
  21. * @param \Smarty_Internal_TemplateCompilerBase $compiler
  22. * @param bool|false $initChildSequence if true force child template
  23. */
  24. public function registerInit(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false)
  25. {
  26. if ($initChildSequence || !isset($compiler->_cache['inheritanceInit'])) {
  27. $compiler->registerPostCompileCallback(array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'),
  28. array($initChildSequence), 'inheritanceInit', $initChildSequence);
  29. $compiler->_cache['inheritanceInit'] = true;
  30. }
  31. }
  32. /**
  33. * Compile inheritance initialization code as prefix
  34. *
  35. * @param \Smarty_Internal_TemplateCompilerBase $compiler
  36. * @param bool|false $initChildSequence if true force child template
  37. */
  38. static function postCompile(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false)
  39. {
  40. $compiler->prefixCompiledCode .= "<?php \$_smarty_tpl->ext->_inheritance->init(\$_smarty_tpl, " .
  41. var_export($initChildSequence, true) . ");\n?>\n";
  42. }
  43. }