equal
deleted
inserted
replaced
|
1 <?php |
|
2 /** |
|
3 * Smarty read include path plugin |
|
4 * |
|
5 * @package Smarty |
|
6 * @subpackage PluginsInternal |
|
7 * @author Monte Ohrt |
|
8 */ |
|
9 |
|
10 /** |
|
11 * Smarty Internal Read Include Path Class |
|
12 * |
|
13 * @package Smarty |
|
14 * @subpackage PluginsInternal |
|
15 */ |
|
16 class Smarty_Internal_Get_Include_Path { |
|
17 /** |
|
18 * Return full file path from PHP include_path |
|
19 * |
|
20 * @param string $filepath filepath |
|
21 * |
|
22 * @return string|boolean full filepath or false |
|
23 */ |
|
24 public static function getIncludePath($filepath) { |
|
25 static $_include_path = null; |
|
26 |
|
27 if (function_exists('stream_resolve_include_path')) { |
|
28 // available since PHP 5.3.2 |
|
29 return stream_resolve_include_path($filepath); |
|
30 } |
|
31 |
|
32 if ($_include_path === null) { |
|
33 $_include_path = explode(PATH_SEPARATOR, get_include_path()); |
|
34 } |
|
35 |
|
36 foreach ($_include_path as $_path) { |
|
37 if (file_exists($_path . DS . $filepath)) { |
|
38 return $_path . DS . $filepath; |
|
39 } |
|
40 } |
|
41 |
|
42 return false; |
|
43 } |
|
44 } |