Files
smarty/libs/sysplugins/smarty_internal_get_include_path.php
uwe.tews@googlemail.com c352723ec9 - bugfix typo in Smarty_Internal_Get_IncludePath did cause runtime overhead (Issue 74)
- improvment remove unneeded assigments (Issue 75 and 76)
2012-01-20 14:47:01 +00:00

43 lines
910 B
PHP

<?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 ($_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;
}
}
?>