当前位置: 首页>>代码示例>>PHP>>正文


PHP Smarty_Internal_Get_Include_Path::_has_stream_include方法代码示例

本文整理汇总了PHP中Smarty_Internal_Get_Include_Path::_has_stream_include方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty_Internal_Get_Include_Path::_has_stream_include方法的具体用法?PHP Smarty_Internal_Get_Include_Path::_has_stream_include怎么用?PHP Smarty_Internal_Get_Include_Path::_has_stream_include使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Smarty_Internal_Get_Include_Path的用法示例。


在下文中一共展示了Smarty_Internal_Get_Include_Path::_has_stream_include方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isNewIncludePath

 /**
  * Check if include path was updated
  *
  * @return bool
  *
  */
 public static function isNewIncludePath(Smarty $smarty)
 {
     if (!isset(self::$_has_stream_include)) {
         self::$_has_stream_include = $smarty->use_include_path === 2 && function_exists('stream_resolve_include_path');
     }
     $_i_path = get_include_path();
     if (self::$_include_path != $_i_path) {
         self::$_include_dirs = array();
         self::$_include_path = $_i_path;
         $_dirs = (array) explode(PATH_SEPARATOR, $_i_path);
         foreach ($_dirs as $_path) {
             if ($_path[0] != '/' && isset($dir[1]) && $dir[1] != ':') {
                 $_path = $smarty->_realpath($_path . DS, true);
             }
             if (is_dir($_path)) {
                 self::$_include_dirs[] = $smarty->_realpath($_path . DS, true);
             }
         }
         return true;
     }
     return false;
 }
开发者ID:redaxle,项目名称:smarty,代码行数:28,代码来源:smarty_internal_get_include_path.php

示例2: getIncludePath

 /**
  * Return full file path from PHP include_path
  *
  * @param  string[] $dirs
  * @param  string   $file
  * @param \Smarty   $smarty
  *
  * @return bool|string full filepath or false
  *
  */
 public static function getIncludePath($dirs, $file, Smarty $smarty)
 {
     if (!(isset(self::$_has_stream_include) ? self::$_has_stream_include : (self::$_has_stream_include = function_exists('stream_resolve_include_path')))) {
         self::isNewIncludePath($smarty);
     }
     // try PHP include_path
     foreach ($dirs as $dir) {
         $dir_n = isset(self::$number[$dir]) ? self::$number[$dir] : (self::$number[$dir] = self::$counter++);
         if (isset(self::$isFile[$dir_n][$file])) {
             if (self::$isFile[$dir_n][$file]) {
                 return self::$isFile[$dir_n][$file];
             } else {
                 continue;
             }
         }
         if (isset(self::$_user_dirs[$dir_n])) {
             if (false === self::$_user_dirs[$dir_n]) {
                 continue;
             } else {
                 $dir = self::$_user_dirs[$dir_n];
             }
         } else {
             if ($dir[0] == '/' || $dir[1] == ':') {
                 $dir = str_ireplace(getcwd(), '.', $dir);
                 if ($dir[0] == '/' || $dir[1] == ':') {
                     self::$_user_dirs[$dir_n] = false;
                     continue;
                 }
             }
             $dir = substr($dir, 2);
             self::$_user_dirs[$dir_n] = $dir;
         }
         if (self::$_has_stream_include) {
             $path = stream_resolve_include_path($dir . (isset($file) ? $file : ''));
             if ($path) {
                 return self::$isFile[$dir_n][$file] = $path;
             }
         } else {
             foreach (self::$_include_dirs as $key => $_i_path) {
                 $path = isset(self::$isPath[$key][$dir_n]) ? self::$isPath[$key][$dir_n] : (self::$isPath[$key][$dir_n] = is_dir($_dir_path = $_i_path . $dir) ? $_dir_path : false);
                 if ($path === false) {
                     continue;
                 }
                 if (isset($file)) {
                     $_file = self::$isFile[$dir_n][$file] = is_file($path . $file) ? $path . $file : false;
                     if ($_file) {
                         return $_file;
                     }
                 } else {
                     // no file was given return directory path
                     return $path;
                 }
             }
         }
     }
     return false;
 }
开发者ID:smart-com,项目名称:bike-cms,代码行数:67,代码来源:smarty_internal_get_include_path.php


注:本文中的Smarty_Internal_Get_Include_Path::_has_stream_include方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。