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

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Smarty Method RegisterResource
  4. *
  5. * Smarty::registerResource() method
  6. *
  7. * @package Smarty
  8. * @subpackage PluginsInternal
  9. * @author Uwe Tews
  10. */
  11. class Smarty_Internal_Method_RegisterResource
  12. {
  13. /**
  14. * Valid for Smarty and template object
  15. *
  16. * @var int
  17. */
  18. public $objMap = 3;
  19. /**
  20. * Registers a resource to fetch a template
  21. *
  22. * @api Smarty::registerResource()
  23. * @link http://www.smarty.net/docs/en/api.register.resource.tpl
  24. *
  25. * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
  26. * @param string $name name of resource type
  27. * @param Smarty_Resource|array $resource_handler or instance of
  28. * Smarty_Resource, or
  29. * array of callbacks to
  30. * handle resource
  31. * (deprecated)
  32. *
  33. * @return \Smarty|\Smarty_Internal_Template
  34. */
  35. public function registerResource(Smarty_Internal_TemplateBase $obj, $name, $resource_handler)
  36. {
  37. $smarty = $obj->_getSmartyObj();
  38. $smarty->registered_resources[ $name ] =
  39. $resource_handler instanceof Smarty_Resource ? $resource_handler : array($resource_handler, false);
  40. return $obj;
  41. }
  42. }