• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List

E:/E/GEAMP/www/openbiz/openbiz/others/Smarty/libs/internals/core.load_resource_plugin.php

00001 <?php
00014 // $type
00015 
00016 function smarty_core_load_resource_plugin($params, &$smarty)
00017 {
00018     /*
00019      * Resource plugins are not quite like the other ones, so they are
00020      * handled differently. The first element of plugin info is the array of
00021      * functions provided by the plugin, the second one indicates whether
00022      * all of them exist or not.
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          * If the plugin file is found, it -must- provide the properly named
00049          * plugin functions.
00050          */
00051         include_once($_plugin_file);
00052 
00053         /*
00054          * Locate functions that we require the plugin to provide.
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 /* vim: set expandtab: */
00073 
00074 ?>

Generated on Thu Apr 19 2012 17:01:16 for openbiz by  doxygen 1.7.2