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


PHP Zend_Loader::explodeIncludePath方法代码示例

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


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

示例1: _getFiles

 /**
  * _getFiles()
  *
  * @return array Array of files to load
  */
 protected function _getFiles()
 {
     // require_once 'Zend/Loader.php';
     $paths = Zend_Loader::explodeIncludePath();
     // used for checking similarly named files
     $relativeItems = array();
     $files = array();
     $isZendTraversed = false;
     foreach ($paths as $path) {
         // default patterns to use
         $filterDenyDirectoryPattern = '.*(/|\\\\).svn';
         $filterAcceptFilePattern = '.*(?:Manifest|Provider)\\.php$';
         if (!file_exists($path) || $path[0] == '.') {
             continue;
         }
         $realIncludePath = realpath($path);
         // ensure that we only traverse a single version of Zend Framework on all include paths
         if (file_exists($realIncludePath . '/Zend/Tool/Framework/Loader/IncludePathLoader.php')) {
             if ($isZendTraversed === false) {
                 $isZendTraversed = true;
             } else {
                 // use the deny directory pattern that includes the path to 'Zend', it will not be accepted
                 $filterDenyDirectoryPattern = '.*((/|\\\\).svn|' . preg_quote($realIncludePath . DIRECTORY_SEPARATOR) . 'Zend)';
             }
         }
         // create recursive directory iterator
         $rdi = new RecursiveDirectoryIterator($path);
         // pass in the RecursiveDirectoryIterator & the patterns
         $filter = new Zend_Tool_Framework_Loader_IncludePathLoader_RecursiveFilterIterator($rdi, $filterDenyDirectoryPattern, $filterAcceptFilePattern);
         // build the rii with the filter
         $iterator = new RecursiveIteratorIterator($filter);
         // iterate over the accepted items
         foreach ($iterator as $item) {
             $file = (string) $item;
             if ($this->_fileIsBlacklisted($file)) {
                 continue;
             }
             // ensure that the same named file from separate include_paths is not loaded
             $relativeItem = preg_replace('#^' . preg_quote($realIncludePath . DIRECTORY_SEPARATOR, '#') . '#', '', $item->getRealPath());
             // no links allowed here for now
             if ($item->isLink()) {
                 continue;
             }
             // no items that are relavitely the same are allowed
             if (in_array($relativeItem, $relativeItems)) {
                 continue;
             }
             $relativeItems[] = $relativeItem;
             $files[] = $item->getRealPath();
         }
     }
     return $files;
 }
开发者ID:JaroslavRamba,项目名称:ex-facebook-bundle,代码行数:58,代码来源:IncludePathLoader.php

示例2: _getZfPath

 /**
  * _getZfPath()
  *
  * @return string|false
  */
 protected function _getZfPath()
 {
     foreach (Zend_Loader::explodeIncludePath() as $includePath) {
         if (!file_exists($includePath) || $includePath[0] == '.') {
             continue;
         }
         if (realpath($checkedPath = rtrim($includePath, '\\/') . '/Zend/Loader.php') !== false && file_exists($checkedPath)) {
             return dirname($checkedPath);
         }
     }
     return false;
 }
开发者ID:hjr3,项目名称:zf2,代码行数:17,代码来源:ZfStandardLibraryDirectory.php

示例3: _getZfPath

 /**
  * _getZfPath()
  *
  * @return string|false
  */
 protected function _getZfPath()
 {
     require_once PHP_LIBRARY_PATH . 'Zend/Loader.php';
     foreach (Zend_Loader::explodeIncludePath() as $includePath) {
         if (!file_exists($includePath) || $includePath[0] == '.') {
             continue;
         }
         if (cleanPath($checkedPath = rtrim($includePath, '\\/') . '/Zend/Loader.php') !== false && file_exists($checkedPath)) {
             return dirname($checkedPath);
         }
     }
     return false;
 }
开发者ID:netixx,项目名称:Stock,代码行数:18,代码来源:ZfStandardLibraryDirectory.php

示例4: findRealpathInIncludePath

 /**
  * Find realpath of file based on include_path
  *
  * @param  string $fileName
  * @return string
  */
 public static function findRealpathInIncludePath($fileName)
 {
     require_once 'Zend/Loader.php';
     $includePaths = Zend_Loader::explodeIncludePath();
     while (count($includePaths) > 0) {
         $filePath = array_shift($includePaths) . DIRECTORY_SEPARATOR . $fileName;
         if (($foundRealpath = realpath($filePath)) !== false) {
             break;
         }
     }
     return $foundRealpath;
 }
开发者ID:brianbui171,项目名称:website_zend_1.11,代码行数:18,代码来源:File.php

示例5: testExplodeIncludePathProperlyIdentifiesStreamSchemes

 /**
  * @group ZF-7271
  */
 public function testExplodeIncludePathProperlyIdentifiesStreamSchemes()
 {
     if (PATH_SEPARATOR != ':') {
         $this->markTestSkipped();
     }
     $path = 'phar://zlt.phar:/var/www:.:filter://[a-z]:glob://*';
     $paths = Zend_Loader::explodeIncludePath($path);
     $this->assertSame(array('phar://zlt.phar', '/var/www', '.', 'filter://[a-z]', 'glob://*'), $paths);
 }
开发者ID:netvlies,项目名称:zf,代码行数:12,代码来源:LoaderTest.php

示例6: getAbsolutePaths

 /**
  * Add existing include path directories to subdirectory (if not absolute)
  *
  * @staticvar string $includePaths Array containing exploded and checked include path
  * @param string $path
  * @return array Can be empty if none of the options exist
  */
 public static function getAbsolutePaths($path)
 {
     static $includePaths;
     if ($path) {
         // Try to see if the path is an absolute path. Some exotic absolute paths can fail this test,
         // but it is more error prone to test for them here than to loop through them afterwards.
         if (self::isAbsolutePath($path)) {
             if ($real = realpath($path)) {
                 return array($real);
             } else {
                 return array();
             }
         }
     }
     if (!is_array($includePaths)) {
         // Make sure the include path are loaded
         foreach (\Zend_Loader::explodeIncludePath() as $include) {
             // Current path will be checked, for each file
             // but check the other paths for exiistence
             if ('.' != $include && ($real = realpath($include))) {
                 $includePaths[] = $real . DIRECTORY_SEPARATOR;
             }
         }
     }
     // Check path name
     $results = array();
     if ($real = realpath($path)) {
         $results[] = $real;
     }
     // Check simple concatenation
     foreach ($includePaths as $include) {
         if ($real = realpath($include . $path)) {
             $results[] = $real;
         }
     }
     // Reverse the result as that is the order this loader handles the directories
     return array_reverse($results);
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:45,代码来源:PluginLoader.php

示例7: _loadIncludePath

 /**
  * Initialize the _includeDirs variable
  */
 protected function _loadIncludePath()
 {
     $dirs = \Zend_Loader::explodeIncludePath();
     foreach ($dirs as $dir) {
         if ('.' != $dir && is_dir($dir)) {
             $this->_includeDirs[] = realpath($dir) . DIRECTORY_SEPARATOR;
         }
     }
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:12,代码来源:CachedLoader.php


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