00001 <?php
00014
00015
00016 function smarty_core_load_resource_plugin($params, &$smarty)
00017 {
00018
00019
00020
00021
00022
00023
00024
00025 $_plugin = &$smarty->_plugins['resource'][$params['type']];
00026 if (isset($_plugin)) {
00027 if (!$_plugin[1] && count($_plugin[0])) {
00028 $_plugin[1] = true;
00029 foreach ($_plugin[0] as $_plugin_func) {
00030 if (!is_callable($_plugin_func)) {
00031 $_plugin[1] = false;
00032 break;
00033 }
00034 }
00035 }
00036
00037 if (!$_plugin[1]) {
00038 $smarty->_trigger_fatal_error("[plugin] resource '" . $params['type'] . "' is not implemented", null, null, __FILE__, __LINE__);
00039 }
00040
00041 return;
00042 }
00043
00044 $_plugin_file = $smarty->_get_plugin_filepath('resource', $params['type']);
00045 $_found = ($_plugin_file != false);
00046
00047 if ($_found) {
00048
00049
00050
00051 include_once($_plugin_file);
00052
00053
00054
00055
00056 $_resource_ops = array('source', 'timestamp', 'secure', 'trusted');
00057 $_resource_funcs = array();
00058 foreach ($_resource_ops as $_op) {
00059 $_plugin_func = 'smarty_resource_' . $params['type'] . '_' . $_op;
00060 if (!function_exists($_plugin_func)) {
00061 $smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", null, null, __FILE__, __LINE__);
00062 return;
00063 } else {
00064 $_resource_funcs[] = $_plugin_func;
00065 }
00066 }
00067
00068 $smarty->_plugins['resource'][$params['type']] = array($_resource_funcs, true);
00069 }
00070 }
00071
00072
00073
00074 ?>