commit f91abc6cb68bd92ed9abdb556aa507cbb9cbc0b4 parent 62f61126baceb5e9ea4a8af5d4cd865421e47d8c Author: Marcel <MTRNord@users.noreply.github.com> Date: Sat, 31 Oct 2015 17:42:48 +0100 Create smarty_internal_get_include_path.php Diffstat:
| A | libs/smarty/sysplugins/smarty_internal_get_include_path.php | | | 46 | ++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 46 insertions(+), 0 deletions(-)
diff --git a/libs/smarty/sysplugins/smarty_internal_get_include_path.php b/libs/smarty/sysplugins/smarty_internal_get_include_path.php @@ -0,0 +1,46 @@ +<?php +/** + * Smarty read include path plugin + * + * @package Smarty + * @subpackage PluginsInternal + * @author Monte Ohrt + */ + +/** + * Smarty Internal Read Include Path Class + * + * @package Smarty + * @subpackage PluginsInternal + */ +class Smarty_Internal_Get_Include_Path +{ + /** + * Return full file path from PHP include_path + * + * @param string $filepath filepath + * + * @return string|boolean full filepath or false + */ + public static function getIncludePath($filepath) + { + static $_include_path = null; + + if (function_exists('stream_resolve_include_path')) { + // available since PHP 5.3.2 + return stream_resolve_include_path($filepath); + } + + if ($_include_path === null) { + $_include_path = explode(PATH_SEPARATOR, get_include_path()); + } + + foreach ($_include_path as $_path) { + if (file_exists($_path . DS . $filepath)) { + return $_path . DS . $filepath; + } + } + + return false; + } +}