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