當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DirectoryIterator::getFilename方法代碼示例

本文整理匯總了PHP中DirectoryIterator::getFilename方法的典型用法代碼示例。如果您正苦於以下問題:PHP DirectoryIterator::getFilename方法的具體用法?PHP DirectoryIterator::getFilename怎麽用?PHP DirectoryIterator::getFilename使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DirectoryIterator的用法示例。


在下文中一共展示了DirectoryIterator::getFilename方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: findBy

 /**
  *
  * @param Criterio $filtro
  * @param string $order
  * @param integer $limitOffset
  * @param integer $limitCount
  * @param string $group
  * @return mixed Proyecto
  */
 function findBy($filtro = null, $order = null, $limitOffset = null, $limitCount = null, $group = null)
 {
     $dir = new DirectoryIterator(DIR_PROYECTOS);
     while ($dir->valid()) {
         if ($dir->isFile() && stripos($dir->getFilename(), '.json')) {
             $proyFilename = DIR_PROYECTOS . $dir->getFilename();
             $p = new Proyecto();
             $fp = fopen($proyFilename, 'r');
             $strJsonProy = fread($fp, filesize($proyFilename));
             fclose($fp);
             $jsonProy = json_decode($strJsonProy);
             $p->setNombre($jsonProy->nombre);
             $p->setRuta($jsonProy->ruta);
             $p->setTieneProyectoEcplipse(file_exists("{$jsonProy->ruta}/.project"));
             if ($p->getTieneProyectoEclipse()) {
                 $eclipseProy = simplexml_load_file("{$jsonProy->ruta}/.project");
                 $p->setNombre((string) $eclipseProy->name);
             }
             $p->setId($jsonProy->id);
             $p->setDbConfig($jsonProy->dbConfig);
             $lista[] = $p;
         }
         $dir->next();
     }
     return $lista;
 }
開發者ID:asivas,項目名稱:pasquino-tools,代碼行數:35,代碼來源:DaoProyecto.class.php

示例2: loadMigrations

 public function loadMigrations()
 {
     $result = array('mgrs' => array(), 'headers' => array(array('id' => 'id', 'content' => Loc::getMessage('MIGRATION_ID'), 'sort' => 'id', 'align' => 'left', 'default' => true), array('id' => 'status', 'content' => Loc::getMessage('MIGRATION_STATUS'), 'align' => 'right', 'default' => true), array('id' => 'date_c', 'content' => Loc::getMessage('MIGRATION_DATE_CHANGED'), 'align' => 'right', 'default' => true), array('id' => 'date_a', 'content' => Loc::getMessage('MIGRATION_DATE_ADDED'), 'align' => 'right', 'default' => true)));
     $db_mgrs = $this->loadDBMigrations();
     $mgr_path = Option::get(UM_BM_MODULE_NAME, 'migration_folder', UM_BM_MGR_PATH);
     $di = new \DirectoryIterator($_SERVER['DOCUMENT_ROOT'] . $mgr_path);
     while ($di->valid()) {
         if (!$di->isDot() && $this->hasProperFilename($di->getFilename())) {
             $filename = $di->getFilename();
             if (!array_key_exists($filename, $db_mgrs)) {
                 $mgr = new BixMigBase();
                 $mgr->setCode($filename)->setStatus('UNKNOWN')->setAddDate(date('d.m.Y H:i:s'))->setChangeDate()->add();
                 $result['mgrs'][] = $mgr;
             } else {
                 $result['mgrs'][] = $db_mgrs[$filename];
                 unset($db_mgrs[$filename]);
             }
         }
         $di->next();
     }
     if (!empty($db_mgrs)) {
         $this->deleteOrphans($db_mgrs);
     }
     return $result;
 }
開發者ID:u-mulder,項目名稱:bixmigs,代碼行數:25,代碼來源:bxmg_dispatcher.php

示例3: load

 /**
  * Carrega todos os arquivos do pacote especificado o carregamento considera o classpath atual da execusão
  *
  * @param string $package nome do pacote
  */
 public static function load($package)
 {
     self::getCurrentPath();
     if (substr($package, -1, 1) != "/") {
         $package .= "/";
     }
     foreach (self::$classPath as $path) {
         $dir = $path . $package;
         if (is_dir($dir)) {
             $d = new DirectoryIterator($dir);
             while ($d->valid()) {
                 if ($d->isFile()) {
                     $requireThis = false;
                     //testa a extensão
                     foreach (self::$filesExtensions as $ext) {
                         if (substr($d->getFilename(), strlen($ext) * -1, strlen($ext)) == $ext) {
                             $requireThis = true;
                             break;
                         }
                     }
                     if ($requireThis) {
                         require_once $package . $d->getFilename();
                     }
                 }
                 $d->next();
             }
         }
     }
 }
開發者ID:laiello,項目名稱:samusframework,代碼行數:34,代碼來源:Package.php

示例4: searchInDir

 /**
  * Método recursivo que busca o arquivo em todas as pastadas dentro do
  * diretorio específicado
  *
  * @param string $dir
  * @param string $file
  * @return boolean
  */
 public static function searchInDir($dir, $file)
 {
     if (is_file($dir . "/" . $file)) {
         require_once $dir . "/" . $file;
         self::$find = true;
         if (self::$sugests) {
             $fileName = $dir . "/" . $file;
             $fileName = str_replace(self::$currentPath, "", $fileName);
             echo "require_once '" . $fileName . "';<br>\n";
         }
         return true;
     }
     if (is_dir($dir)) {
         $d = new DirectoryIterator($dir);
         while (!self::$find && $d->valid()) {
             if (is_dir($d->getPath() . '/' . $d->getFilename())) {
                 //testa se o arquivo pode ser incluido
                 $inc = true;
                 foreach (self::$blockedDirs as $bDir) {
                     if ($d->getFilename() == $bDir) {
                         $inc = false;
                         break;
                     }
                 }
                 if (!$d->isDot() && $inc) {
                     self::searchInDir($d->getPath() . '/' . $d->getFilename(), $file);
                 }
             }
             $d->next();
         }
     }
     return self::$find;
 }
開發者ID:laiello,項目名稱:samusframework,代碼行數:41,代碼來源:AutoRequire.php

示例5: cleanDir

 /**
  * Compacta todos os arquivos .php de um diretório removendo comentários,
  * espaços e quebras de linhas desnecessárias.
  * motivos de desempenho e segurança esse método so interage em um diretório
  * de cada vez.
  *
  * @param string $directoryPath
  * @param string $newFilesDirectory
  * @param string $newFilesPrefix
  * @param string $newFilesSufix
  */
 public static function cleanDir($directoryPath, $newFilesDirectory = "packed", $newFilesPrefix = "", $newFilesSufix = "")
 {
     $dir = new DirectoryIterator($directoryPath);
     mkdir($directoryPath . "/{$newFilesDirectory}/");
     while ($dir->valid()) {
         if (!$dir->isDir() and !$dir->isDot() and substr($dir->getFilename(), -3, 3) == 'php') {
             $str = self::cleanFile($dir->getPathname());
             $fp = fopen($dir->getPath() . "/packed/" . $newFilesPrefix . $dir->getFilename() . $newFilesSufix, "w");
             fwrite($fp, $str);
             fclose($fp);
             echo $dir->getPathname() . ' - Renomeado com sucesso <br />';
         }
         $dir->next();
     }
 }
開發者ID:laiello,項目名稱:samusframework,代碼行數:26,代碼來源:PackFiles.php

示例6: getImgArray

 /**
  * Obtem um array de ImgObject com todos os arquivos de imagens dos 
  * diretórios especificados
  * 
  * @param int|null $limit
  * @return array
  */
 public function getImgArray($limit = null)
 {
     $imgArray = array();
     foreach ($this->getDir() as $diretorio) {
         $imgArray = array();
         $d = new DirectoryIterator($diretorio);
         while ($d->valid()) {
             if (!$d->isDot()) {
                 $fileName = $d->getFilename();
                 if ($this->validateFormat($fileName)) {
                     $imgObj = new ImgObject($fileName, $diretorio);
                     $imgArray[] = $imgObj;
                     ++$this->imgCount;
                     if ($limit != null) {
                         if ($this->imgCount >= $limit) {
                             break;
                         }
                     }
                 }
             }
             $d->next();
         }
     }
     return $imgArray;
 }
開發者ID:laiello,項目名稱:samusframework,代碼行數:32,代碼來源:ImgDir.php

示例7: logAction

 public function logAction()
 {
     $pageSize = 4096;
     $overlapSize = 128;
     $dir = APPLICATION_PATH . '/../data/logs/';
     $file = $this->_getParam('file', null);
     $this->view->page = $this->_getParam('page', 0);
     if ($file === null) {
         $file = sprintf('%s_application.log', Zend_Date::now()->toString('yyyy.MM.dd'));
     }
     $fp = fopen($dir . $file, 'r');
     fseek($fp, -$pageSize * ($this->view->page + 1) + $overlapSize, SEEK_END);
     $this->view->errorLog = fread($fp, $pageSize + $overlapSize * 2);
     fclose($fp);
     $iterator = new DirectoryIterator($dir);
     while ($iterator->valid()) {
         if (!$iterator->isDot()) {
             if ($iterator->isFile()) {
                 $files[$iterator->getFilename()] = $iterator->getPathName();
             }
         }
         $iterator->next();
     }
     $this->view->itemCountPerPage = $pageSize;
     $this->view->totalItemCount = filesize($dir . $file);
     $this->view->files = $files;
 }
開發者ID:netconstructor,項目名稱:Centurion,代碼行數:27,代碼來源:IndexController.php

示例8: executeDir

 function executeDir($directory)
 {
     $iterator = new DirectoryIterator($directory);
     while ($iterator->valid()) {
         $entry = $iterator->getFilename();
         $path = $directory . '/' . $entry;
         $iterator->next();
         if ($entry[0] == '.') {
             continue;
         }
         if (is_file($path)) {
             if (substr($entry, -4) != '.php') {
                 continue;
             }
             if (ctype_upper($entry[0])) {
                 $test = new DocTest($path);
                 if ($test->failed()) {
                     echo $test->toString();
                     $this->fail('Doc test failed.');
                 } else {
                     if ($test->numOfPassed()) {
                         echo ',';
                     } else {
                         echo ' ';
                     }
                 }
             }
         } elseif (is_dir($path)) {
             $this->executeDir($path);
         }
     }
 }
開發者ID:BackupTheBerlios,項目名稱:ubook-svn,代碼行數:32,代碼來源:DocumentationTest.php

示例9: scanFolder

 protected function scanFolder($folder, &$position, $forFolders = true, $threshold_key = 'dir', $threshold_default = 50)
 {
     $registry = AEFactory::getConfiguration();
     // Initialize variables
     $arr = array();
     $false = false;
     if (!is_dir($folder) && !is_dir($folder . '/')) {
         return $false;
     }
     try {
         $di = new DirectoryIterator($folder);
     } catch (Exception $e) {
         $this->setWarning('Unreadable directory ' . $folder);
         return $false;
     }
     if (!$di->valid()) {
         $this->setWarning('Unreadable directory ' . $folder);
         return $false;
     }
     if (!empty($position)) {
         $di->seek($position);
         if ($di->key() != $position) {
             $position = null;
             return $arr;
         }
     }
     $counter = 0;
     $maxCounter = $registry->get("engine.scan.large.{$threshold_key}_threshold", $threshold_default);
     while ($di->valid()) {
         if ($di->isDot()) {
             $di->next();
             continue;
         }
         if ($di->isDir() != $forFolders) {
             $di->next();
             continue;
         }
         $ds = $folder == '' || $folder == '/' || @substr($folder, -1) == '/' || @substr($folder, -1) == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR;
         $dir = $folder . $ds . $di->getFilename();
         $data = _AKEEBA_IS_WINDOWS ? AEUtilFilesystem::TranslateWinPath($dir) : $dir;
         if ($data) {
             $counter++;
             $arr[] = $data;
         }
         if ($counter == $maxCounter) {
             break;
         } else {
             $di->next();
         }
     }
     // Determine the new value for the position
     $di->next();
     if ($di->valid()) {
         $position = $di->key() - 1;
     } else {
         $position = null;
     }
     return $arr;
 }
開發者ID:WineWorld,項目名稱:joomlatrialcmbg,代碼行數:59,代碼來源:large.php

示例10: pushItem

 /**
  * Overwrite in children to parse files according to our style.
  * @param array $listing
  * @param DirectoryIterator $item
  */
 public function pushItem(&$listing, DirectoryIterator $entry)
 {
     if (substr($filename = $entry->getFilename(), -4) == '.css') {
         // a reset stylesheet, always used
         if (strpos($stylename = $entry->getBasename('.css'), 'tripoli') !== FALSE) {
         } else {
             array_push($listing, $stylename);
         }
     }
 }
開發者ID:radekstepan,項目名稱:Fireside,代碼行數:15,代碼來源:Layouts.php

示例11: rewind

 /**
  * Rewinds the cache entry iterator to the first element
  *
  * @return void
  * @api
  */
 public function rewind()
 {
     if ($this->cacheFilesIterator === null) {
         $this->cacheFilesIterator = new \DirectoryIterator($this->cacheDirectory);
     }
     $this->cacheFilesIterator->rewind();
     while (substr($this->cacheFilesIterator->getFilename(), 0, 1) === '.' && $this->cacheFilesIterator->valid()) {
         $this->cacheFilesIterator->next();
     }
 }
開發者ID:kszyma,項目名稱:flow-development-collection,代碼行數:16,代碼來源:SimpleFileBackend.php

示例12: addFromFile

 /**
  * @param DirectoryIterator $file
  */
 private function addFromFile(DirectoryIterator $file)
 {
     $match = preg_match('/([^.]+)-custom.definition.json/', $file->getFilename(), $matches);
     if (!$match) {
         return;
     }
     $dictionaryName = $matches[1];
     $translations = $this->loadTranslations($file->getPathname());
     foreach ($translations as $translationName => $translations) {
         $this->includeTranslation($dictionaryName, $translationName, $translations);
     }
 }
開發者ID:baszoetekouw,項目名稱:janus,代碼行數:15,代碼來源:CustomDictionaryLoader.php

示例13: pushItem

 public function pushItem(&$listing, DirectoryIterator $item)
 {
     // dot would be for morse code locale?
     if (!$item->isDot() && $item->isFile()) {
         // explode and extract name & type
         list($name, $type) = explode('.', $item->getFilename());
         assert('!empty($name) && !empty($type); // invalid locale files');
         // push name to stack
         if ($type == 'yml') {
             array_push($listing, $name);
         }
     }
 }
開發者ID:radekstepan,項目名稱:Clubhouse,代碼行數:13,代碼來源:ApplicationI18n.php

示例14: loadComponentsFromFileSystem

 /**
  * @desc Iterates the components directory and returns list of it subdirectories
  *
  * @return array
  */
 public static function loadComponentsFromFileSystem()
 {
     $componentsNames = [];
     $directory = new DirectoryIterator(\Wikia\UI\Factory::getComponentsDir());
     while ($directory->valid()) {
         if (!$directory->isDot() && $directory->isDir()) {
             $componentName = $directory->getFilename();
             $componentsNames[] = $componentName;
         }
         $directory->next();
     }
     return $componentsNames;
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:18,代碼來源:StyleguideComponents.class.php

示例15: getDirInfo

function getDirInfo($dir)
{
    $iterator = new DirectoryIterator($dir);
    #先輸出文件夾
    while ($iterator->valid()) {
        if ($iterator->isDir() && $iterator->getFilename() != '.' && $iterator->getFilename() != '..' && $iterator->getFilename() != '.git') {
            echo '<li class="flist filedir"><i class="fa fa-folder-open"></i> ' . $iterator->getFilename();
            echo '<ul class="dirlist">';
            getDirInfo($iterator->getPathname());
            echo '</ul></li>';
        }
        $iterator->next();
    }
    #再輸出文件
    $iterator->Rewind();
    while ($iterator->valid()) {
        if ($iterator->isFile()) {
            echo '<li class="flist file"><i class="fa fa-file-text"></i> ' . $iterator->getFilename() . '</li>';
        }
        $iterator->next();
    }
}
開發者ID:jjonline,項目名稱:php-library,代碼行數:22,代碼來源:demo.php


注:本文中的DirectoryIterator::getFilename方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。