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


PHP DirectoryIterator::getBasename方法代碼示例

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


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

示例1: find_plugins

 /**
  * Find all plugins defined in your Kohana codebase
  */
 public function find_plugins()
 {
     $paths = Kohana::include_paths();
     foreach ($paths as $path) {
         $dir = $path . self::$plugins_dir;
         //if there's no plugin dir skip to the next path
         if (!file_exists($dir)) {
             continue;
         }
         // Instantiate a new directory iterator object
         $directory = new DirectoryIterator($dir);
         if ($directory->isDir()) {
             foreach ($directory as $plugin) {
                 // Is directory?
                 if ($plugin->isDir() && !$plugin->isDot()) {
                     // if there's no plugin.php in this folder, ignore it
                     if (!file_exists($plugin->getPath() . DIRECTORY_SEPARATOR . $directory->getBasename() . DIRECTORY_SEPARATOR . 'plugin.php')) {
                         continue;
                     }
                     // Store plugin in our pool
                     self::$plugins_pool[$plugin->getFilename()]['plugin'] = ucfirst($plugin->getFilename());
                     self::$plugins_pool[$plugin->getFilename()]['path'] = $plugin->getPath() . DIRECTORY_SEPARATOR . $directory->getBasename();
                 }
             }
         }
     }
     return $this;
 }
開發者ID:vheissu,項目名稱:kohana-plugin-system,代碼行數:31,代碼來源:Plugins.php

示例2: key

 /**
  * Returns the identifier of the current cache entry pointed to by the cache
  * entry iterator.
  *
  * @return string
  * @api
  */
 public function key()
 {
     if ($this->cacheFilesIterator === null) {
         $this->rewind();
     }
     return $this->cacheFilesIterator->getBasename($this->cacheEntryFileExtension);
 }
開發者ID:kszyma,項目名稱:flow-development-collection,代碼行數:14,代碼來源:SimpleFileBackend.php

示例3: compileFile

 private function compileFile(\DirectoryIterator $file)
 {
     $tag = file_get_contents($file->getPathname());
     $tagName = $file->getBasename('.html');
     $jsFunc = $this->extractJsFunction($tag, $tagName);
     $tagHtml = $this->removeJsFromTag($tag, $tagName);
     $tagHtml = str_replace('"', '\\"', $tagHtml);
     $tagHtml = preg_replace("/\r|\n/", "", $tagHtml);
     return 'riot.tag("' . $tagName . '", "' . $tagHtml . '", ' . $jsFunc . ');';
 }
開發者ID:josecelano,項目名稱:php-ddd-cargo-sample,代碼行數:10,代碼來源:RiotCompiler.php

示例4: 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

示例5: getBaseFiles

 /**
  * {@inheritDoc}
  */
 protected function getBaseFiles()
 {
     $iterator = new \DirectoryIterator($this->getLanguageBasePath() . DIRECTORY_SEPARATOR . $this->baselanguage);
     $files = array();
     while ($iterator->valid()) {
         if (!$iterator->isDot() && $iterator->isFile() && $this->isValidSourceFile($iterator->getPathname()) && $this->isNotFileToSkip($iterator->getBasename())) {
             $files[] = $iterator->getFilename();
         }
         $iterator->next();
     }
     $this->baseFiles = $files;
 }
開發者ID:cyberspectrum,項目名稱:contao-toolbox,代碼行數:15,代碼來源:ConvertBase.php

示例6: getTemplateNames

 /**
  * Returns a list of all template names.
  *
  * @return string[]
  */
 protected function getTemplateNames()
 {
     /** @var \RecursiveDirectoryIterator $files */
     $files = new \DirectoryIterator(dirname(__FILE__) . '/../../../../data/templates');
     $template_names = array();
     while ($files->valid()) {
         $name = $files->getBasename();
         // skip abstract files
         if (!$files->isDir() || in_array($name, array('.', '..'))) {
             $files->next();
             continue;
         }
         $template_names[] = $name;
         $files->next();
     }
     return $template_names;
 }
開發者ID:laiello,項目名稱:lion-framework,代碼行數:22,代碼來源:ListCommand.php

示例7: getAllNames

 /**
  * Returns a list of all template names.
  *
  * @return string[]
  */
 public function getAllNames()
 {
     /** @var \RecursiveDirectoryIterator $files */
     $files = new \DirectoryIterator($this->getTemplatePath());
     $template_names = array();
     while ($files->valid()) {
         $name = $files->getBasename();
         // skip abstract files
         if (!$files->isDir() || in_array($name, array('.', '..'))) {
             $files->next();
             continue;
         }
         $template_names[] = $name;
         $files->next();
     }
     return $template_names;
 }
開發者ID:crazycodr,項目名稱:phpDocumentor2,代碼行數:22,代碼來源:Factory.php

示例8: execute

 /**
  * Executes the transformation process.
  *
  * @throws Zend_Console_Getopt_Exception
  *
  * @return void
  */
 public function execute()
 {
     if ($this->getQuiet()) {
         return;
     }
     echo 'Available themes:' . PHP_EOL;
     /** @var RecursiveDirectoryIterator $files */
     $files = new DirectoryIterator(dirname(__FILE__) . '/../../../../data/themes');
     while ($files->valid()) {
         $name = $files->getBasename();
         // skip abstract files
         if (!$files->isDir() || in_array($name, array('.', '..'))) {
             $files->next();
             continue;
         }
         echo '* ' . $name . PHP_EOL;
         $files->next();
     }
     echo PHP_EOL;
 }
開發者ID:rvanvelzen,項目名稱:phpDocumentor2,代碼行數:27,代碼來源:List.php

示例9: getTemplateNames

 /**
  * Returns a list of all template names.
  *
  * @return string[]
  */
 protected function getTemplateNames()
 {
     // TODO: this directory needs to come from the parameter set in the DIC in the ServiceProvider
     $template_dir = dirname(__FILE__) . '/../../../../data/templates';
     if (!file_exists($template_dir)) {
         //Vendored installation
         $template_dir = dirname(__FILE__) . '/../../../../../../templates';
     }
     /** @var \RecursiveDirectoryIterator $files */
     $files = new \DirectoryIterator($template_dir);
     $template_names = array();
     while ($files->valid()) {
         $name = $files->getBasename();
         // skip abstract files
         if (!$files->isDir() || in_array($name, array('.', '..'))) {
             $files->next();
             continue;
         }
         $template_names[] = $name;
         $files->next();
     }
     return $template_names;
 }
開發者ID:michaelyin1,項目名稱:Modern-Toolkit,代碼行數:28,代碼來源:ListCommand.php

示例10: copyHooksDir

 /**
  * @param string $src_dir
  * @param string $dst_dir
  *
  * @throws \Exception
  */
 protected static function copyHooksDir($src_dir, $dst_dir)
 {
     $fs = new Filesystem();
     $fs->mirror($src_dir, $dst_dir, null, ['override' => true]);
     $file = new \DirectoryIterator($src_dir);
     $mask = umask();
     while ($file->valid()) {
         if ($file->isFile() && is_executable($file->getPathname())) {
             $fs->chmod("{$dst_dir}/" . $file->getBasename(), 0777, $mask);
         }
         $file->next();
     }
 }
開發者ID:cheppers,項目名稱:git-hooks,代碼行數:19,代碼來源:Main.php

示例11: DirectoryIterator

<?php

$targetDir = __DIR__ . DIRECTORY_SEPARATOR . md5('directoryIterator::getbasename2');
mkdir($targetDir);
touch($targetDir . DIRECTORY_SEPARATOR . 'getBasename_test.txt');
$dir = new DirectoryIterator($targetDir . DIRECTORY_SEPARATOR);
while (!$dir->isFile()) {
    $dir->next();
}
echo $dir->getBasename(array());
$targetDir = __DIR__ . DIRECTORY_SEPARATOR . md5('directoryIterator::getbasename2');
unlink($targetDir . DIRECTORY_SEPARATOR . 'getBasename_test.txt');
rmdir($targetDir);
開發者ID:alphaxxl,項目名稱:hhvm,代碼行數:13,代碼來源:DirectoryIterator_getBasename_pass_array.php

示例12: isValidDir

 /**
  * @param \DirectoryIterator $fileInfo
  *
  * @return bool
  */
 private function isValidDir(\DirectoryIterator $fileInfo)
 {
     return $fileInfo->isDir() && !$fileInfo->isDot() && stripos($fileInfo->getBasename(), '.') !== 0;
 }
開發者ID:shobcheye,項目名稱:sw-cli-tools,代碼行數:9,代碼來源:DirectoryFilterIterator.php

示例13: collectGarbage

 /**
  * Does garbage collection
  *
  * @return void
  * @api
  */
 public function collectGarbage()
 {
     if ($this->frozen === TRUE) {
         return;
     }
     for ($directoryIterator = new \DirectoryIterator($this->cacheDirectory); $directoryIterator->valid(); $directoryIterator->next()) {
         if ($directoryIterator->isDot()) {
             continue;
         }
         if ($this->isCacheFileExpired($directoryIterator->getPathname())) {
             $this->remove($directoryIterator->getBasename($this->cacheEntryFileExtension));
         }
     }
 }
開發者ID:sengkimlong,項目名稱:Flow3-Authentification,代碼行數:20,代碼來源:FileBackend.php

示例14: DirectoryIterator

<?php

$targetDir = __DIR__ . DIRECTORY_SEPARATOR . md5('directoryIterator::getbasename1');
mkdir($targetDir);
touch($targetDir . DIRECTORY_SEPARATOR . 'getBasename_test.txt');
$dir = new DirectoryIterator($targetDir . DIRECTORY_SEPARATOR);
while (!$dir->isFile()) {
    $dir->next();
}
echo $dir->getBasename('.txt');
$targetDir = __DIR__ . DIRECTORY_SEPARATOR . md5('directoryIterator::getbasename1');
unlink($targetDir . DIRECTORY_SEPARATOR . 'getBasename_test.txt');
rmdir($targetDir);
開發者ID:alphaxxl,項目名稱:hhvm,代碼行數:13,代碼來源:DirectoryIterator_getBasename_basic_test.php

示例15: getBasename

 /**
  * Get basename of file (without extension
  * @return string
  */
 public function getBasename()
 {
     return parent::getBasename('.' . $this->getExtension());
 }
開發者ID:jasmun,項目名稱:Noco100,代碼行數:8,代碼來源:Iterator.php


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