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


PHP DirectoryIterator::isDir方法代码示例

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


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

示例1: index

 public function index($args)
 {
     $t = Registry::getInstance()->twig->loadTemplate('form/filepicker.tpl');
     $c = array();
     $localpath = Functions::nz($args['path'], '');
     $mediapath = SITE_PATH . '/media/';
     $dir = new \DirectoryIterator($mediapath . $localpath);
     $picformats = array('png', 'jpg', 'gif');
     $files = array();
     foreach ($dir as $file) {
         if (!$dir->isDot()) {
             $path = URL_PATH . '/media/' . $localpath . $file;
             $f = new \stdClass();
             if (strlen($file) > 4 && in_array(substr($file, -3), $picformats)) {
                 $picture = $path;
             } elseif ($dir->isDir()) {
                 $picture = TEMPLATE_PATH . 'form/pics/folder.png';
             } else {
                 $picture = TEMPLATE_PATH . 'form/pics/file.png';
             }
             $f->path = $localpath;
             $f->picture = $picture;
             $f->name = (string) $file;
             $f->type = $dir->isDir() ? 'dir' : 'file';
             $files[] = $f;
         }
     }
     $c['files'] = $files;
     $t->display($c);
 }
开发者ID:johsbk,项目名称:penguin,代码行数:30,代码来源:Filepicker.php

示例2: collectSchema

 /**
  * Collect schema from wordpress active theme
  * 
  * @return boolean true on success false if color schema folder is not exists
  *                 in the active theme folder
  */
 public function collectSchema()
 {
     $options = $this->getOptions();
     $path = get_template_directory() . $options['path'];
     // make sure that the color schema folder exsists
     if (!file_exists($path) || !is_dir($path)) {
         return;
         // just ignore
     }
     // register the new color schema
     $contents = new \DirectoryIterator($path);
     foreach ($contents as $content) {
         if ($contents->isDot()) {
             continue;
         }
         if ($contents->isDir()) {
             $name = $content->getFilename();
             $init = parse_ini_file($content->getPathname() . '/schema.ini');
             if (!is_array($init)) {
                 trigger_error('Unbale Admin Color Schema Config File', E_USER_ERROR);
             }
             $suffix = is_rtl() ? '-rtl' : '';
             $url = get_template_directory_uri() . $options['path'] . '/' . $name . "/colors{$suffix}.css";
             wp_admin_css_color($name, __(isset($init['name']) && !empty($init['name']) ? $init['name'] : $name, isset($init['domain']) && !empty($init['domain']) ? $init['domain'] : 'default'), $url, isset($init['colors']) && is_array($init['colors']) ? $init['colors'] : array(), isset($init['icons']) && is_array($init['icons']) ? $init['icons'] : array());
         }
     }
 }
开发者ID:hyyan,项目名称:admin-color-schema,代码行数:33,代码来源:HyyanAdminColorSchema.php

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

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

示例5: valid

 public function valid()
 {
     if (parent::valid()) {
         if (!parent::isDir()) {
             parent::next();
             return $this->valid();
         }
         return TRUE;
     }
     return FALSE;
 }
开发者ID:Birjemin,项目名称:Study,代码行数:11,代码来源:demo8.php

示例6: valid

 /**
  * valid 
  * 
  * @access public
  * @return bool
  */
 public function valid()
 {
     if (parent::valid()) {
         if (parent::isDir()) {
             parent::next();
             return $this->valid();
         }
         return true;
     }
     return false;
 }
开发者ID:nmred,项目名称:study_test,代码行数:17,代码来源:sw_directory_iterator.php

示例7: valid

 public function valid()
 {
     if (parent::valid()) {
         if ($this->dirsOnly && !parent::isDir() || parent::isDot() || parent::getFileName() == '.svn') {
             parent::next();
             return $this->valid();
         }
         return true;
     }
     return false;
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:11,代码来源:VersionedDirectoryIterator.php

示例8: getTestDirs

function getTestDirs($dir = './')
{
    $file = new DirectoryIterator($dir);
    $res = array();
    while ($file->valid()) {
        if ($file->isDir() && !$file->isDot()) {
            $res[] = $file->getPathName();
        }
        $file->next();
    }
    return $res;
}
开发者ID:burbuja,项目名称:pluf,代码行数:12,代码来源:testrunner.php

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

示例10: getPlugins

 public function getPlugins()
 {
     $output = array();
     $it = new DirectoryIterator(BASE . 'plugins/');
     while ($it->valid()) {
         $xml_path = $it->getPath() . $it->getFilename() . '/';
         $xml_file = $xml_path . "plugin.xml";
         if ($it->isReadable() && $it->isDir() && file_exists($xml_file)) {
             $output[] = new PapyrinePlugin($xml_path);
         }
         $it->next();
     }
     return $output;
 }
开发者ID:BackupTheBerlios,项目名称:papyrine-svn,代码行数:14,代码来源:Papyrine.php

示例11: indexAction

 public function indexAction()
 {
     // Get path
     $this->view->path = $path = $this->_getPath();
     $this->view->relPath = $relPath = $this->_getRelPath($path);
     // List files
     $files = array();
     $dirs = array();
     $contents = array();
     $it = new DirectoryIterator($path);
     foreach ($it as $key => $file) {
         $filename = $file->getFilename();
         if ($it->isDot() && $this->_basePath == $path || $filename == '.' || $filename != '..' && $filename[0] == '.') {
             continue;
         }
         $relPath = trim(str_replace($this->_basePath, '', realpath($file->getPathname())), '/\\');
         $ext = strtolower(ltrim(strrchr($file->getFilename(), '.'), '.'));
         if ($file->isDir()) {
             $ext = null;
         }
         $type = 'generic';
         switch (true) {
             case in_array($ext, array('jpg', 'png', 'gif', 'jpeg', 'bmp', 'tif', 'svg')):
                 $type = 'image';
                 break;
             case in_array($ext, array('txt', 'log', 'js')):
                 $type = 'text';
                 break;
             case in_array($ext, array('html', 'htm')):
                 $type = 'markup';
                 break;
         }
         $dat = array('name' => $file->getFilename(), 'path' => $file->getPathname(), 'info' => $file->getPathInfo(), 'rel' => $relPath, 'ext' => $ext, 'type' => $type, 'is_dir' => $file->isDir(), 'is_file' => $file->isFile(), 'is_image' => $type == 'image', 'is_text' => $type == 'text', 'is_markup' => $type == 'markup');
         if ($it->isDir()) {
             $dirs[$relPath] = $dat;
         } else {
             if ($it->isFile()) {
                 $files[$relPath] = $dat;
             }
         }
         $contents[$relPath] = $dat;
     }
     ksort($contents);
     $this->view->paginator = $paginator = Zend_Paginator::factory($contents);
     $paginator->setItemCountPerPage(20);
     $paginator->setCurrentPageNumber($this->_getParam('page', 1));
     $this->view->files = $files;
     $this->view->dirs = $dirs;
     $this->view->contents = $contents;
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:50,代码来源:AdminFilesController.php

示例12: load_plugin

 private static function load_plugin(ContextManager $context, DirectoryIterator $plugin_path)
 {
     $plugin_load_file = $plugin_path->getPathname() . DIRECTORY_SEPARATOR . 'init.php';
     if ($plugin_path->isDir() && is_file($plugin_load_file) && (require $plugin_load_file)) {
         $class = Plugins::plugin_class_name($plugin_path);
         try {
             $klass = new ReflectionClass($class);
             Plugins::add($klass->newInstance($context));
             $context->logger()->debugf('%s --> %s', str_replace(MEDICK_PATH, '${' . $context->config()->application_name() . '}', $plugin_load_file), $class);
         } catch (ReflectionException $rfEx) {
             $context->logger()->warn('failed to load plugin `' . $plugin_path->getFilename() . '`: ' . $rfEx->getMessage());
         }
     }
 }
开发者ID:aurelian,项目名称:medick2,代码行数:14,代码来源:Plugins.php

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

示例14: getAvailableLanguages

 /**
  * Returns the available languages for this documentation format
  *
  * @return array Array of string language codes
  * @api
  */
 public function getAvailableLanguages()
 {
     $languages = array();
     $languagesDirectoryIterator = new \DirectoryIterator($this->formatPath);
     $languagesDirectoryIterator->rewind();
     while ($languagesDirectoryIterator->valid()) {
         $filename = $languagesDirectoryIterator->getFilename();
         if ($filename[0] != '.' && $languagesDirectoryIterator->isDir()) {
             $language = $filename;
             $languages[] = $language;
         }
         $languagesDirectoryIterator->next();
     }
     return $languages;
 }
开发者ID:nxpthx,项目名称:FLOW3,代码行数:21,代码来源:Format.php

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


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