1: <?php
2: 3: 4: 5: 6:
7:
8: 9: 10: 11: 12:
13:
14:
15:
16: function smarty_core_load_resource_plugin($params, &$smarty)
17: {
18: 19: 20: 21: 22: 23:
24:
25: $_plugin = &$smarty->_plugins['resource'][$params['type']];
26: if (isset($_plugin)) {
27: if (!$_plugin[1] && count($_plugin[0])) {
28: $_plugin[1] = true;
29: foreach ($_plugin[0] as $_plugin_func) {
30: if (!is_callable($_plugin_func)) {
31: $_plugin[1] = false;
32: break;
33: }
34: }
35: }
36:
37: if (!$_plugin[1]) {
38: $smarty->_trigger_fatal_error("[plugin] resource '" . $params['type'] . "' is not implemented", null, null, __FILE__, __LINE__);
39: }
40:
41: return;
42: }
43:
44: $_plugin_file = $smarty->_get_plugin_filepath('resource', $params['type']);
45: $_found = ($_plugin_file != false);
46:
47: if ($_found) { 48: 49: 50:
51: include_once($_plugin_file);
52:
53: 54: 55:
56: $_resource_ops = array('source', 'timestamp', 'secure', 'trusted');
57: $_resource_funcs = array();
58: foreach ($_resource_ops as $_op) {
59: $_plugin_func = 'smarty_resource_' . $params['type'] . '_' . $_op;
60: if (!function_exists($_plugin_func)) {
61: $smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", null, null, __FILE__, __LINE__);
62: return;
63: } else {
64: $_resource_funcs[] = $_plugin_func;
65: }
66: }
67:
68: $smarty->_plugins['resource'][$params['type']] = array($_resource_funcs, true);
69: }
70: }
71:
72:
73:
74: ?>
75: