mirror of
https://github.com/smarty-php/smarty.git
synced 2026-05-05 12:14:12 +02:00
commit 3.1 into the trunk
This commit is contained in:
@@ -1,44 +1,43 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty read include path plugin
|
||||
*
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsInternal
|
||||
* @author Monte Ohrt
|
||||
* @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 mixed full filepath or false
|
||||
* @return string|boolean full filepath or false
|
||||
*/
|
||||
public static function getIncludePath($filepath)
|
||||
{
|
||||
static $_path_array = null;
|
||||
static $_include_path = null;
|
||||
|
||||
if(!isset($_path_array)) {
|
||||
$_ini_include_path = ini_get('include_path');
|
||||
if ($_path_array === null) {
|
||||
$_include_path = explode(PATH_SEPARATOR, get_include_path());
|
||||
}
|
||||
|
||||
if(strstr($_ini_include_path,';')) {
|
||||
// windows pathnames
|
||||
$_path_array = explode(';',$_ini_include_path);
|
||||
} else {
|
||||
$_path_array = explode(':',$_ini_include_path);
|
||||
foreach ($_include_path as $_path) {
|
||||
if (file_exists($_path . DS . $filepath)) {
|
||||
return $_path . DS . $filepath;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
foreach ($_path_array as $_include_path) {
|
||||
if (file_exists($_include_path . DS . $filepath)) {
|
||||
return $_include_path . DS . $filepath;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user