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


PHP RecursiveIteratorIterator::getPath方法代码示例

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


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

示例1: execute

 protected function execute($arguments = array(), $options = array())
 {
     switch (strtolower($arguments['scm'])) {
         case 'git':
             $ignoreFileName = '.gitignore';
             $forceAddIgnoreFileCommand = "git add -f ";
             break;
         case 'cvs':
             $ignoreFileName = '.cvsignore';
             $forceAddIgnoreFileCommand = "cvs add  ";
             break;
         default:
             echo "Not a support SCM.  Only GIT and CVS are currently supported.";
             exit(1);
     }
     // config folder ignores
     $currentIgnore = 'config/' . $ignoreFileName;
     $ignoreFiles = "ProjectConfiguration.class.php\ndatabases.yml\n";
     $this->writeIgnore($currentIgnore, $ignoreFiles, $options['add-ignores'], $forceAddIgnoreFileCommand);
     // Cache folder
     $currentIgnore = 'cache/' . $ignoreFileName;
     $ignoreFiles = "*\n";
     $this->writeIgnore($currentIgnore, $ignoreFiles, $options['add-ignores'], $forceAddIgnoreFileCommand);
     // Log folder
     $currentIgnore = 'log/' . $ignoreFileName;
     $ignoreFiles = "*\n";
     $this->writeIgnore($currentIgnore, $ignoreFiles, $options['add-ignores'], $forceAddIgnoreFileCommand);
     // Begin the looping through
     $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(sfConfig::get('sf_root_dir')));
     $ignorePathArray = array();
     while ($it->valid()) {
         // Does it match a model/om, model/map, form/base, filter/base
         $path = str_replace(DIRECTORY_SEPARATOR, '/', $it->getPath());
         if (strpos($path, 'model/om') || strpos($path, 'model/map') || strpos($path, 'form/base') || strpos($path, 'filter/base') || strpos($path, 'doctrine/base') || strpos($path, 'Plugin/base')) {
             // Since we currently go through every file we only want to get the path once so use it as the key.
             $ignorePathArray[$it->getPath()] = true;
         }
         $it->next();
     }
     // Write the actual ignores to all the found paths
     foreach ($ignorePathArray as $path => $value) {
         $currentIgnore = $path . '/' . $ignoreFileName;
         $ignoreFiles = "*\n";
         $this->writeIgnore($currentIgnore, $ignoreFiles, $options['add-ignores'], $forceAddIgnoreFileCommand);
     }
     if ($options['add-ignores']) {
         echo "All set, ignores created and added!\n";
     } else {
         echo "All set, ignores created!\n";
     }
 }
开发者ID:jmwohl,项目名称:greight,代码行数:51,代码来源:generateIgnoresTask.class.php

示例2: get_folders

 public function get_folders($directory)
 {
     $rows = array();
     $iter = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory), true);
     foreach ($iter as $file) {
         if ($iter->hasChildren() && !strstr($iter->getPath() . "/" . $file, "/.")) {
             $row['name'] = str_repeat('  ', $iter->getDepth()) . ucfirst(basename($file));
             $row['path'] = $iter->getPath() . "/" . basename($file);
             $rows[] = $row;
             unset($row);
         }
     }
     return $rows;
 }
开发者ID:phpwax,项目名称:wildfire,代码行数:14,代码来源:CmsFile.php

示例3: buildIndex

 public function buildIndex()
 {
     $iterator = new RecursiveIteratorIterator(new contentTreeRecursiveIterator($this->toc), RecursiveIteratorIterator::SELF_FIRST);
     foreach ($iterator as $topic) {
         $path = ltrim($iterator->getPath() . '/' . $topic['href'], '\\/');
         $this->indexPage($path, $topic['title']);
     }
 }
开发者ID:googlecode-mirror,项目名称:bulldoc,代码行数:8,代码来源:index_builder.php

示例4: rsearch

function rsearch($folder, $pattern)
{
    $dir = new RecursiveDirectoryIterator($folder);
    $iterator = new RecursiveIteratorIterator($dir);
    $files = new RegexIterator($iterator, $pattern, RegexIterator::GET_MATCH);
    $fileList = array();
    foreach ($files as $file) {
        $fileList[] = array('file' => $file, 'path' => $iterator->getPath());
    }
    // return only the first result
    return $fileList[0];
}
开发者ID:hirasso,项目名称:wordpress-shariff-wrapper,代码行数:12,代码来源:index.php

示例5: testRecursiveTreeItarator

 function testRecursiveTreeItarator()
 {
     $structHolder = $this->getTestStructure();
     $pathBuilder = new pathBuilder('/index.html');
     $sectionData = $structHolder->getPageSection($pathBuilder, 'current');
     $section = $sectionData['curSection'];
     $level = $sectionData['level'];
     $iterator = new RecursiveIteratorIterator(new contentTreeRecursiveIterator($section), RecursiveIteratorIterator::SELF_FIRST);
     $tocItems = array();
     foreach ($iterator as $topic) {
         if ($level != -1 && $iterator->getDepth() > $level - 1) {
             continue;
         }
         $topic['href'] = ltrim($iterator->getPath() . '/' . $topic['href'], '\\/');
         $topic['level'] = $iterator->getDepth();
         $tocItems[] = $topic;
     }
     $this->assertEqual($tocItems, array(array('href' => 'introduction.html', 'title' => 'Введение', 'level' => 0), array('href' => 'installation.html', 'title' => 'Установка', 'level' => 0), array('href' => 'quickstart.html', 'title' => 'Простой пример', 'level' => 0), array('href' => 'content/index.html', 'title' => 'Книга', 'level' => 0), array('href' => 'content/bookshelf.html', 'title' => 'Книжная полка', 'level' => 1), array('href' => 'content/toc.html', 'title' => 'Структура', 'level' => 1), array('href' => 'content/text.html', 'title' => 'Текст', 'level' => 1), array('href' => 'layout/index.html', 'title' => 'Оформление', 'level' => 0), array('href' => 'layout/theme.html', 'title' => 'Темы', 'level' => 1), array('href' => 'layout/system_settings.html', 'title' => 'Системные настройки', 'level' => 1), array('href' => 'export.html', 'title' => 'Экспорт', 'level' => 0), array('href' => 'appendix/index.html', 'title' => 'Приложения', 'level' => 0), array('href' => 'appendix/topic_index.html', 'title' => 'Предметный указатель', 'level' => 1), array('href' => 'appendix/authors.html', 'title' => 'Авторы', 'level' => 1), array('href' => 'appendix/license.html', 'title' => 'Лицензия', 'level' => 1), array('href' => 'appendix/similar.html', 'title' => 'Аналоги', 'level' => 1), array('href' => 'appendix/roadmap.html', 'title' => 'Планы по развитию', 'level' => 1)), 'Correct data obtained');
 }
开发者ID:googlecode-mirror,项目名称:bulldoc,代码行数:19,代码来源:structure_iterators_test.php

示例6: buildTOC

    public function buildTOC()
    {
        $pathBuilder = new pathBuilder('/');
        $sectionData = $this->structureHolder->getPageSection($pathBuilder, 'current');
        $section = $sectionData['curSection'];
        $level = 0;
        $iterator = new RecursiveIteratorIterator(new contentTreeRecursiveIterator($section), RecursiveIteratorIterator::SELF_FIRST);
        $file_list = '';
        $html = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">
<!-- Sitemap 1.0 -->
</HEAD><BODY><UL><LI><OBJECT type="text/sitemap">
		                <param name="Name" value="ќбложка">
		                <param name="Local" value="index.html">
		               </OBJECT>';
        foreach ($iterator as $topic) {
            $href = ltrim($iterator->getPath() . '/' . $topic['href'], '\\/');
            $file_list .= "{$href}\n";
            $title = $topic['title'];
            if ($iterator->getDepth() > $level) {
                $html .= '<UL>';
                $level = $iterator->getDepth();
            }
            if ($iterator->getDepth() < $level) {
                $html .= '</UL>';
                $level = $iterator->getDepth();
            }
            $icon = basename($href) == 'index.html' ? '' : '<param name="ImageNumber" value="11">';
            $html .= '<LI> <OBJECT type="text/sitemap">
		                <param name="Name" value="' . $title . '">
		                <param name="Local" value="' . $href . '">
                    ' . $icon . '
		               </OBJECT>';
        }
        $html = $html . '</UL></BODY></HTML>';
        $file_list = "[OPTIONS]\nCompatibility=1.1 or later\nCompiled file={$this->bookKey}.chm\nContents file={$this->bookKey}.hhc\nDefault Font=Verdana,8,204\nDefault topic=index.html\nDisplay compile progress=No\nIndex file={$this->bookKey}.hhk\nLanguage=" . colesoApplication::getMessage('bulldoc', 'chm_encoding') . "\nTitle={$this->bookTitle}\n\n\n[FILES]\n{$file_list}\n\n[INFOTYPES]\n\n";
        return array($html, $file_list);
    }
开发者ID:googlecode-mirror,项目名称:bulldoc,代码行数:40,代码来源:chm_generator.php

示例7: all_available

 /**
  * Retrieves a list of all available extensions on the filesystem
  *
  * @return array An array with extension names as keys and paths to the
  *               extension as values
  */
 public function all_available()
 {
     $available = array();
     if (!is_dir($this->phpbb_root_path . 'ext/')) {
         return $available;
     }
     $iterator = new \RecursiveIteratorIterator(new \phpbb\recursive_dot_prefix_filter_iterator(new \RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/', \FilesystemIterator::NEW_CURRENT_AND_KEY | \FilesystemIterator::FOLLOW_SYMLINKS)), \RecursiveIteratorIterator::SELF_FIRST);
     $iterator->setMaxDepth(2);
     foreach ($iterator as $file_info) {
         if ($file_info->isFile() && $file_info->getFilename() == 'composer.json') {
             $ext_name = $iterator->getInnerIterator()->getSubPath();
             $composer_file = $iterator->getPath() . '/composer.json';
             // Ignore the extension if there is no composer.json.
             if (!is_readable($composer_file) || !($ext_info = file_get_contents($composer_file))) {
                 continue;
             }
             $ext_info = json_decode($ext_info, true);
             $ext_name = str_replace(DIRECTORY_SEPARATOR, '/', $ext_name);
             // Ignore the extension if directory depth is not correct or if the directory structure
             // does not match the name value specified in composer.json.
             if (substr_count($ext_name, '/') !== 1 || !isset($ext_info['name']) || $ext_name != $ext_info['name']) {
                 continue;
             }
             $available[$ext_name] = $this->phpbb_root_path . 'ext/' . $ext_name . '/';
         }
     }
     ksort($available);
     return $available;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:35,代码来源:manager.php

示例8: buildIndex

 private function buildIndex($pathBuilder)
 {
     $basePath = dirname((string) $pathBuilder);
     if ($basePath == '.') {
         $basePath = '';
     } else {
         $basePath .= '/';
     }
     $sectionData = $this->structureHolder->getPageSection($pathBuilder, 'current');
     $section = $sectionData['curSection'];
     $level = $sectionData['level'];
     $iterator = new RecursiveIteratorIterator(new contentTreeRecursiveIterator($section), RecursiveIteratorIterator::SELF_FIRST);
     $html = '';
     foreach ($iterator as $topic) {
         if ($level != -1 && $iterator->getDepth() > $level - 1) {
             continue;
         }
         $topic['href'] = ltrim($iterator->getPath() . '/' . $topic['href'], '\\/');
         $topic['level'] = $iterator->getDepth();
         $topic['path'] = $basePath . $topic['href'];
         $html .= $this->navTemplate->parseItem('toc_topic', $topic);
     }
     return $html;
 }
开发者ID:googlecode-mirror,项目名称:bulldoc,代码行数:24,代码来源:page_builder.php


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