Chris PeBenito 696b41
Chris PeBenito 696b41
/**
Chris PeBenito 696b41
 * Smarty plugin
Chris PeBenito 696b41
 * @package Smarty
Chris PeBenito 696b41
 * @subpackage plugins
Chris PeBenito 696b41
 */
Chris PeBenito 696b41
Chris PeBenito 696b41
/**
Chris PeBenito 696b41
 * Get path to file from include_path
Chris PeBenito 696b41
 *
Chris PeBenito 696b41
 * @param string $file_path
Chris PeBenito 696b41
 * @param string $new_file_path
Chris PeBenito 696b41
 * @return boolean
Chris PeBenito 696b41
 * @staticvar array|null
Chris PeBenito 696b41
 */
Chris PeBenito 696b41
Chris PeBenito 696b41
//  $file_path, &$new_file_path
Chris PeBenito 696b41
Chris PeBenito 696b41
function smarty_core_get_include_path(&$params, &$smarty)
Chris PeBenito 696b41
{
Chris PeBenito 696b41
    static $_path_array = null;
Chris PeBenito 696b41
Chris PeBenito 696b41
    if(!isset($_path_array)) {
Chris PeBenito 696b41
        $_ini_include_path = ini_get('include_path');
Chris PeBenito 696b41
Chris PeBenito 696b41
        if(strstr($_ini_include_path,';')) {
Chris PeBenito 696b41
            // windows pathnames
Chris PeBenito 696b41
            $_path_array = explode(';',$_ini_include_path);
Chris PeBenito 696b41
        } else {
Chris PeBenito 696b41
            $_path_array = explode(':',$_ini_include_path);
Chris PeBenito 696b41
        }
Chris PeBenito 696b41
    }
Chris PeBenito 696b41
    foreach ($_path_array as $_include_path) {
Chris PeBenito 696b41
        if (@is_readable($_include_path . DIRECTORY_SEPARATOR . $params['file_path'])) {
Chris PeBenito 696b41
               $params['new_file_path'] = $_include_path . DIRECTORY_SEPARATOR . $params['file_path'];
Chris PeBenito 696b41
            return true;
Chris PeBenito 696b41
        }
Chris PeBenito 696b41
    }
Chris PeBenito 696b41
    return false;
Chris PeBenito 696b41
}
Chris PeBenito 696b41
Chris PeBenito 696b41
/* vim: set expandtab: */
Chris PeBenito 696b41
Chris PeBenito 696b41
?>