2009-03-22 16:09:05 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Smarty method Register_Resource
|
|
|
|
|
*
|
|
|
|
|
* Registers a Smarty template resource
|
|
|
|
|
*
|
|
|
|
|
* @package Smarty
|
|
|
|
|
* @subpackage SmartyMethod
|
|
|
|
|
* @author Uwe Tews
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2009-08-08 17:28:23 +00:00
|
|
|
* Registers a resource to fetch a template
|
2009-03-22 16:09:05 +00:00
|
|
|
*
|
2009-08-08 17:28:23 +00:00
|
|
|
* @param object $smarty
|
|
|
|
|
* @param string $type name of resource
|
|
|
|
|
* @param array $functions array of functions to handle resource
|
2009-03-22 16:09:05 +00:00
|
|
|
*/
|
2009-11-03 20:38:38 +00:00
|
|
|
function Smarty_Method_Register_Resource($smarty, $type, $functions)
|
2009-08-08 17:28:23 +00:00
|
|
|
{
|
|
|
|
|
if (count($functions) == 4) {
|
|
|
|
|
$smarty->_plugins['resource'][$type] =
|
|
|
|
|
array($functions, false);
|
|
|
|
|
} elseif (count($functions) == 5) {
|
2009-10-27 16:25:15 +00:00
|
|
|
$smarty->_plugins['resource'][$type] =
|
2009-08-08 17:28:23 +00:00
|
|
|
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");
|
2009-03-22 16:09:05 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|