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