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_undefined.php 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Smarty Internal Undefined
  4. *
  5. * Class to handle undefined method calls or calls to obsolete runtime extensions
  6. *
  7. * @package Smarty
  8. * @subpackage PluginsInternal
  9. * @author Uwe Tews
  10. */
  11. class Smarty_Internal_Undefined
  12. {
  13. /**
  14. * Name of undefined extension class
  15. *
  16. * @var string|null
  17. */
  18. public $class = null;
  19. /**
  20. * Smarty_Internal_Undefined constructor.
  21. *
  22. * @param null|string $class name of undefined extension class
  23. */
  24. public function __construct($class = null)
  25. {
  26. $this->class = $class;
  27. }
  28. /**
  29. * Wrapper for obsolete class Smarty_Internal_Runtime_ValidateCompiled
  30. *
  31. * @param \Smarty_Internal_Template $tpl
  32. * @param array $properties special template properties
  33. * @param bool $cache flag if called from cache file
  34. *
  35. * @return bool false
  36. */
  37. public function decodeProperties(Smarty_Internal_Template $tpl, $properties, $cache = false)
  38. {
  39. if ($cache) {
  40. $tpl->cached->valid = false;
  41. } else {
  42. $tpl->mustCompile = true;
  43. }
  44. return false;
  45. }
  46. /**
  47. * Call error handler for undefined method
  48. *
  49. * @param string $name unknown method-name
  50. * @param array $args argument array
  51. *
  52. * @return mixed
  53. * @throws SmartyException
  54. */
  55. public function __call($name, $args)
  56. {
  57. if (isset($this->class)) {
  58. throw new SmartyException("undefined extension class '{$this->class}'");
  59. } else {
  60. throw new SmartyException(get_class($args[ 0 ]) . "->{$name}() undefined method");
  61. }
  62. }
  63. }