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_registerdefaultconfighandler.php 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Smarty Method RegisterDefaultConfigHandler
  4. *
  5. * Smarty::registerDefaultConfigHandler() method
  6. *
  7. * @package Smarty
  8. * @subpackage PluginsInternal
  9. * @author Uwe Tews
  10. */
  11. class Smarty_Internal_Method_RegisterDefaultConfigHandler
  12. {
  13. /**
  14. * Valid for Smarty and template object
  15. *
  16. * @var int
  17. */
  18. public $objMap = 3;
  19. /**
  20. * Register config default handler
  21. *
  22. * @api Smarty::registerDefaultConfigHandler()
  23. *
  24. * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
  25. * @param callable $callback class/method name
  26. *
  27. * @return \Smarty|\Smarty_Internal_Template
  28. * @throws SmartyException if $callback is not callable
  29. */
  30. public function registerDefaultConfigHandler(Smarty_Internal_TemplateBase $obj, $callback)
  31. {
  32. $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
  33. if (is_callable($callback)) {
  34. $smarty->default_config_handler_func = $callback;
  35. } else {
  36. throw new SmartyException("Default config handler not callable");
  37. }
  38. return $obj;
  39. }
  40. }