当前位置: 首页>>代码示例>>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;未经允许,请勿转载。