Code

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