2010-12-13 22:05:27 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Smarty read include path plugin
|
2011-09-16 14:19:56 +00:00
|
|
|
*
|
2010-12-13 22:05:27 +00:00
|
|
|
* @package Smarty
|
|
|
|
* @subpackage PluginsInternal
|
2011-09-16 14:19:56 +00:00
|
|
|
* @author Monte Ohrt
|
2010-12-13 22:05:27 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Smarty Internal Read Include Path Class
|
2011-09-16 14:19:56 +00:00
|
|
|
*
|
|
|
|
* @package Smarty
|
|
|
|
* @subpackage PluginsInternal
|
2010-12-13 22:05:27 +00:00
|
|
|
*/
|
|
|
|
class Smarty_Internal_Get_Include_Path {
|
2011-09-16 14:19:56 +00:00
|
|
|
|
2010-12-13 22:05:27 +00:00
|
|
|
/**
|
|
|
|
* Return full file path from PHP include_path
|
2011-09-16 14:19:56 +00:00
|
|
|
*
|
2010-12-13 22:05:27 +00:00
|
|
|
* @param string $filepath filepath
|
2011-09-16 14:19:56 +00:00
|
|
|
* @return string|boolean full filepath or false
|
2010-12-13 22:05:27 +00:00
|
|
|
*/
|
|
|
|
public static function getIncludePath($filepath)
|
|
|
|
{
|
2011-09-16 14:19:56 +00:00
|
|
|
static $_include_path = null;
|
2012-02-06 20:17:32 +00:00
|
|
|
|
|
|
|
if (function_exists('stream_resolve_include_path')) {
|
|
|
|
// available since PHP 5.3.2
|
|
|
|
return stream_resolve_include_path($filepath);
|
|
|
|
}
|
2010-12-13 22:05:27 +00:00
|
|
|
|
2012-01-20 14:47:01 +00:00
|
|
|
if ($_include_path === null) {
|
2011-09-16 14:19:56 +00:00
|
|
|
$_include_path = explode(PATH_SEPARATOR, get_include_path());
|
2010-12-13 22:05:27 +00:00
|
|
|
}
|
2011-09-16 14:19:56 +00:00
|
|
|
|
|
|
|
foreach ($_include_path as $_path) {
|
|
|
|
if (file_exists($_path . DS . $filepath)) {
|
|
|
|
return $_path . DS . $filepath;
|
|
|
|
}
|
2010-12-13 22:05:27 +00:00
|
|
|
}
|
2012-01-20 14:47:01 +00:00
|
|
|
|
2011-09-16 14:19:56 +00:00
|
|
|
return false;
|
2010-12-13 22:05:27 +00:00
|
|
|
}
|
2011-09-16 14:19:56 +00:00
|
|
|
|
|
|
|
}
|
2010-12-13 22:05:27 +00:00
|
|
|
|
|
|
|
?>
|