Rev | Line | |
---|
[23384] | 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 | /** |
---|
| 19 | * Return full file path from PHP include_path |
---|
| 20 | * |
---|
| 21 | * @param string $filepath filepath |
---|
| 22 | * @return string|boolean full filepath or false |
---|
| 23 | */ |
---|
| 24 | public static function getIncludePath($filepath) |
---|
| 25 | { |
---|
| 26 | static $_include_path = null; |
---|
| 27 | |
---|
| 28 | if (function_exists('stream_resolve_include_path')) { |
---|
| 29 | // available since PHP 5.3.2 |
---|
| 30 | return stream_resolve_include_path($filepath); |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | if ($_include_path === null) { |
---|
| 34 | $_include_path = explode(PATH_SEPARATOR, get_include_path()); |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | foreach ($_include_path as $_path) { |
---|
| 38 | if (file_exists($_path . DS . $filepath)) { |
---|
| 39 | return $_path . DS . $filepath; |
---|
| 40 | } |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | return false; |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.