| @@ 338-347 (lines=10) @@ | ||
| 335 | * |
|
| 336 | * @throws Exception |
|
| 337 | */ |
|
| 338 | public function register_function($name, $callback, $cacheable = true, $cache_attrs = null) |
|
| 339 | { |
|
| 340 | if (isset($this->plugins[$name]) && $this->plugins[$name][0] !== self::SMARTY_FUNCTION) { |
|
| 341 | throw new Exception('Multiple plugins of different types can not share the same name'); |
|
| 342 | } |
|
| 343 | $this->plugins[$name] = array( |
|
| 344 | 'type' => self::SMARTY_FUNCTION, |
|
| 345 | 'callback' => $callback |
|
| 346 | ); |
|
| 347 | } |
|
| 348 | ||
| 349 | /** |
|
| 350 | * @param $name |
|
| @@ 365-374 (lines=10) @@ | ||
| 362 | * |
|
| 363 | * @throws Exception |
|
| 364 | */ |
|
| 365 | public function register_block($name, $callback, $cacheable = true, $cache_attrs = null) |
|
| 366 | { |
|
| 367 | if (isset($this->plugins[$name]) && $this->plugins[$name][0] !== self::SMARTY_BLOCK) { |
|
| 368 | throw new Exception('Multiple plugins of different types can not share the same name'); |
|
| 369 | } |
|
| 370 | $this->plugins[$name] = array( |
|
| 371 | 'type' => self::SMARTY_BLOCK, |
|
| 372 | 'callback' => $callback |
|
| 373 | ); |
|
| 374 | } |
|
| 375 | ||
| 376 | /** |
|
| 377 | * @param $name |
|
| @@ 390-399 (lines=10) @@ | ||
| 387 | * |
|
| 388 | * @throws Exception |
|
| 389 | */ |
|
| 390 | public function register_modifier($name, $callback) |
|
| 391 | { |
|
| 392 | if (isset($this->plugins[$name]) && $this->plugins[$name][0] !== self::SMARTY_MODIFIER) { |
|
| 393 | throw new Exception('Multiple plugins of different types can not share the same name'); |
|
| 394 | } |
|
| 395 | $this->plugins[$name] = array( |
|
| 396 | 'type' => self::SMARTY_MODIFIER, |
|
| 397 | 'callback' => $callback |
|
| 398 | ); |
|
| 399 | } |
|
| 400 | ||
| 401 | /** |
|
| 402 | * @param $name |
|