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


PHP Loader::explodeIncludePath方法代码示例

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


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

示例1: _getFiles

 /**
  * _getFiles()
  *
  * @return array Array of files to load
  */
 protected function _getFiles()
 {
     $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 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:heiglandreas,项目名称:zf2,代码行数:57,代码来源: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:heiglandreas,项目名称:zf2,代码行数:17,代码来源:ZfStandardLibraryDirectory.php

示例3: testExplodeIncludePathProperlyIdentifiesStreamSchemes

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

示例4: findRealpathInIncludePath

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


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