+++ /dev/null
-<?php\r
-/**\r
- * Smarty plugin\r
- * @package Smarty\r
- * @subpackage plugins\r
- */\r
-\r
-/**\r
- * load a resource plugin\r
- *\r
- * @param string $type\r
- */\r
-\r
-// $type\r
-\r
-function smarty_core_load_resource_plugin($params, &$smarty)\r
-{\r
- /*\r
- * Resource plugins are not quite like the other ones, so they are\r
- * handled differently. The first element of plugin info is the array of\r
- * functions provided by the plugin, the second one indicates whether\r
- * all of them exist or not.\r
- */\r
-\r
- $_plugin = &$smarty->_plugins['resource'][$params['type']];\r
- if (isset($_plugin)) {\r
- if (!$_plugin[1] && count($_plugin[0])) {\r
- $_plugin[1] = true;\r
- foreach ($_plugin[0] as $_plugin_func) {\r
- if (!is_callable($_plugin_func)) {\r
- $_plugin[1] = false;\r
- break;\r
- }\r
- }\r
- }\r
-\r
- if (!$_plugin[1]) {\r
- $smarty->_trigger_fatal_error("[plugin] resource '" . $params['type'] . "' is not implemented", null, null, __FILE__, __LINE__);\r
- }\r
-\r
- return;\r
- }\r
-\r
- $_plugin_file = $smarty->_get_plugin_filepath('resource', $params['type']);\r
- $_found = ($_plugin_file != false);\r
-\r
- if ($_found) { /*\r
- * If the plugin file is found, it -must- provide the properly named\r
- * plugin functions.\r
- */\r
- include_once($_plugin_file);\r
-\r
- /*\r
- * Locate functions that we require the plugin to provide.\r
- */\r
- $_resource_ops = array('source', 'timestamp', 'secure', 'trusted');\r
- $_resource_funcs = array();\r
- foreach ($_resource_ops as $_op) {\r
- $_plugin_func = 'smarty_resource_' . $params['type'] . '_' . $_op;\r
- if (!function_exists($_plugin_func)) {\r
- $smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", null, null, __FILE__, __LINE__);\r
- return;\r
- } else {\r
- $_resource_funcs[] = $_plugin_func;\r
- }\r
- }\r
-\r
- $smarty->_plugins['resource'][$params['type']] = array($_resource_funcs, true);\r
- }\r
-}\r
-\r
-/* vim: set expandtab: */\r
-\r
-?>\r