Initial repo created
[timetracker.git] / WEB-INF / lib / smarty / sysplugins / smarty_internal_get_include_path.php
1 <?php
2
3 /**
4  * Smarty read include path plugin
5  * 
6  * @package Smarty
7  * @subpackage PluginsInternal
8  * @author Monte Ohrt 
9  */
10
11 /**
12  * Smarty Internal Read Include Path Class
13  */
14 class Smarty_Internal_Get_Include_Path {
15     /**
16      * Return full file path from PHP include_path
17      * 
18      * @param string $filepath filepath
19      * @return mixed full filepath or false
20      */
21     public static function getIncludePath($filepath)
22     {
23     static $_path_array = null;
24
25     if(!isset($_path_array)) {
26         $_ini_include_path = ini_get('include_path');
27
28         if(strstr($_ini_include_path,';')) {
29             // windows pathnames
30             $_path_array = explode(';',$_ini_include_path);
31         } else {
32             $_path_array = explode(':',$_ini_include_path);
33         }
34     }
35     foreach ($_path_array as $_include_path) {
36         if (file_exists($_include_path . DS . $filepath)) {
37             return $_include_path . DS . $filepath;
38         }
39     }
40     return false;
41     } 
42
43
44 ?>