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_method_mustcompile.php 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Smarty Method UnloadFilter
  4. *
  5. * Smarty_Internal_Template::mustCompile() method
  6. *
  7. * @package Smarty
  8. * @subpackage PluginsInternal
  9. * @author Uwe Tews
  10. */
  11. class Smarty_Internal_Method_MustCompile
  12. {
  13. /**
  14. * Valid for template object
  15. *
  16. * @var int
  17. */
  18. public $objMap = 2;
  19. /**
  20. * Returns if the current template must be compiled by the Smarty compiler
  21. * It does compare the timestamps of template source and the compiled templates and checks the force compile
  22. * configuration
  23. *
  24. * @param \Smarty_Internal_Template $_template
  25. *
  26. * @return bool
  27. * @throws \SmartyException
  28. */
  29. public function mustCompile(Smarty_Internal_Template $_template)
  30. {
  31. if (!$_template->source->exists) {
  32. if (isset($_template->parent) && $_template->parent->_objType == 2) {
  33. $parent_resource = " in '$_template->parent->template_resource}'";
  34. } else {
  35. $parent_resource = '';
  36. }
  37. throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}");
  38. }
  39. if ($_template->mustCompile === null) {
  40. $_template->mustCompile = (!$_template->source->handler->uncompiled &&
  41. ($_template->smarty->force_compile || $_template->source->handler->recompiled || !$_template->compiled->exists ||
  42. ($_template->smarty->compile_check && $_template->compiled->getTimeStamp() < $_template->source->getTimeStamp())));
  43. }
  44. return $_template->mustCompile;
  45. }
  46. }