mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-05 06:41:39 +01:00
41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Smarty method Register_Resource
|
||
|
|
*
|
||
|
|
* Registers a Smarty template resource
|
||
|
|
*
|
||
|
|
* @package Smarty
|
||
|
|
* @subpackage SmartyMethod
|
||
|
|
* @author Uwe Tews
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Smarty class Register_Resource
|
||
|
|
*
|
||
|
|
* Register a a Smarty template resource
|
||
|
|
*/
|
||
|
|
|
||
|
|
class Smarty_Method_Register_Resource extends Smarty_Internal_Base {
|
||
|
|
/**
|
||
|
|
* Registers a resource to fetch a template
|
||
|
|
*
|
||
|
|
* @param string $type name of resource
|
||
|
|
* @param array $functions array of functions to handle resource
|
||
|
|
*/
|
||
|
|
public function execute($type, $functions)
|
||
|
|
{
|
||
|
|
if (count($functions) == 4) {
|
||
|
|
$this->_plugins['resource'][$type] =
|
||
|
|
array($functions, false);
|
||
|
|
} elseif (count($functions) == 5) {
|
||
|
|
$this->smarty->plugins['resource'][$type] =
|
||
|
|
array(array(array(&$functions[0], $functions[1]) , array(&$functions[0], $functions[2]) , array(&$functions[0], $functions[3]) , array(&$functions[0], $functions[4])) , false);
|
||
|
|
} else {
|
||
|
|
throw new Exception("malformed function-list for '$type' in register_resource");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
?>
|