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

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

00001 <?php
00015 function smarty_core_assemble_plugin_filepath($params, &$smarty)
00016 {
00017     static $_filepaths_cache = array();
00018 
00019     $_plugin_filename = $params['type'] . '.' . $params['name'] . '.php';
00020     if (isset($_filepaths_cache[$_plugin_filename])) {
00021         return $_filepaths_cache[$_plugin_filename];
00022     }
00023     $_return = false;
00024 
00025     foreach ((array)$smarty->plugins_dir as $_plugin_dir) {
00026 
00027         $_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename;
00028 
00029         // see if path is relative
00030         if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) {
00031             $_relative_paths[] = $_plugin_dir;
00032             // relative path, see if it is in the SMARTY_DIR
00033             if (@is_readable(SMARTY_DIR . $_plugin_filepath)) {
00034                 $_return = SMARTY_DIR . $_plugin_filepath;
00035                 break;
00036             }
00037         }
00038         // try relative to cwd (or absolute)
00039         if (@is_readable($_plugin_filepath)) {
00040             $_return = $_plugin_filepath;
00041             break;
00042         }
00043     }
00044 
00045     if($_return === false) {
00046         // still not found, try PHP include_path
00047         if(isset($_relative_paths)) {
00048             foreach ((array)$_relative_paths as $_plugin_dir) {
00049 
00050                 $_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename;
00051 
00052                 $_params = array('file_path' => $_plugin_filepath);
00053                 require_once(SMARTY_CORE_DIR . 'core.get_include_path.php');
00054                 if(smarty_core_get_include_path($_params, $smarty)) {
00055                     $_return = $_params['new_file_path'];
00056                     break;
00057                 }
00058             }
00059         }
00060     }
00061     $_filepaths_cache[$_plugin_filename] = $_return;
00062     return $_return;
00063 }
00064 
00065 /* vim: set expandtab: */
00066 
00067 ?>

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