public function rewind()
 {
     if (false === $this->isRewindable()) {
         return;
     }
     parent::next();
     parent::rewind();
 }
 /**
  * Do nothing for non rewindable stream
  */
 public function rewind()
 {
     if (false === $this->isRewindable()) {
         return;
     }
     // @see https://bugs.php.net/bug.php?id=49104
     parent::next();
     parent::rewind();
 }
Ejemplo n.º 3
0
 public function rewind()
 {
     if (false === $this->isRewindable()) {
         return;
     }
     if (PHP_VERSION_ID < 50523 || PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50607) {
         parent::next();
     }
     parent::rewind();
 }
Ejemplo n.º 4
0
<?php

$it1 = new RecursiveDirectoryIterator(dirname(__FILE__), FileSystemIterator::CURRENT_AS_PATHNAME);
$it1->rewind();
echo gettype($it1->current()) . "\n";
$it2 = new RecursiveDirectoryIterator(dirname(__FILE__));
$it2->rewind();
echo gettype($it2->current()) . "\n";
Ejemplo n.º 5
0
 /**
  * @inheritdoc
  */
 public function addFolder($path, $parent = '')
 {
     /**
      * @var \SplFileInfo $item
      */
     if (file_exists($path)) {
         $parent = $parent === null ? '' : $parent . DIRECTORY_SEPARATOR;
         $innerPath = $parent . basename($path);
         $dir = new \RecursiveDirectoryIterator($path);
         $dir->rewind();
         while ($dir->valid()) {
             $item = $dir->current();
             if ($item->isDir()) {
                 if (!in_array($item->getFilename(), array('.', '..'))) {
                     $this->addFolder($item->getRealPath(), $innerPath);
                 }
             } else {
                 $this->addFile($item->getRealPath(), $innerPath . DIRECTORY_SEPARATOR . $item->getFilename(), true);
             }
             $dir->next();
         }
     }
     return $this->updateArchive();
 }
 /**
  * Do nothing for non rewindable stream.
  */
 public function rewind()
 {
     if (false === $this->isRewindable()) {
         return;
     }
     // @see https://bugs.php.net/68557
     if (PHP_VERSION_ID < 50523 || PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50607) {
         parent::next();
     }
     parent::rewind();
 }
 public function rewind()
 {
     parent::rewind();
     // Skip current and parent directory
     $this->skipdots();
 }
Ejemplo n.º 8
0
 function rewind()
 {
     echo __FUNCTION__ . "\n";
     return parent::rewind();
 }
Ejemplo n.º 9
0
 /**
  * 
  * Recursively iterates through a directory looking for class files.
  * 
  * Skips CVS directories, and all files and dirs not starting with
  * a capital letter (such as dot-files).
  * 
  * @param RecursiveDirectoryIterator $iter Directory iterator.
  * 
  * @return void
  * 
  */
 protected function _fetch(RecursiveDirectoryIterator $iter)
 {
     for ($iter->rewind(); $iter->valid(); $iter->next()) {
         // preliminaries
         $path = $iter->current()->getPathname();
         $file = basename($path);
         $capital = ctype_alpha($file[0]) && $file == ucfirst($file);
         $phpfile = strripos($file, '.php');
         // check for valid class files
         if ($iter->isDot() || !$capital) {
             // skip dot-files (including dot-file directories), as
             // well as files/dirs not starting with a capital letter
             continue;
         } elseif ($iter->isDir() && $file == 'CVS') {
             // skip CVS directories
             continue;
         } elseif ($iter->isDir() && $iter->hasChildren()) {
             // descend into child directories
             $this->_fetch($iter->getChildren());
         } elseif ($iter->isFile() && $phpfile) {
             // map the .php file to a class name
             $len = strlen($this->_base);
             $class = substr($path, $len, -4);
             // drops .php
             $class = str_replace(DIRECTORY_SEPARATOR, '_', $class);
             $this->_map[$class] = $path;
         }
     }
 }
Ejemplo n.º 10
0
 /**
  * @private
  *
  * 1. Mimics tmp directory
  * 2. Find latest cache if $hash is null
  * 3. Return directory if $hash is '*'
  */
 private static function resolve($key, $hash = null)
 {
     $target = sys_get_temp_dir();
     if (strrpos($target, DIRECTORY_SEPARATOR) !== strlen($target) - 1) {
         $target .= DIRECTORY_SEPARATOR;
     }
     $target .= md5($key);
     if (!file_exists($target)) {
         if ($hash !== '*') {
             return null;
         } elseif (mkdir($target) === false) {
             throw new FrameworkException('Error creating cache folder "' . $target . '", please check folder permissions.');
         }
     } else {
         if (is_file($target)) {
             throw new FrameworkException($target . ' is already a file, please specify another path.');
         }
     }
     $target .= DIRECTORY_SEPARATOR;
     if ($hash === '*') {
         return new \RecursiveDirectoryIterator($target, \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS);
     }
     if ($hash !== null) {
         $target = "{$target}{$hash}";
         if (!is_file($target)) {
             throw new FrameworkException('Target revision is not a file.');
         }
         return new \SplFileInfo($target);
     } else {
         $res = new \RecursiveDirectoryIterator($target, \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS);
         $res->next();
         $res->rewind();
         $lfile = null;
         foreach ($res as $file) {
             if ($file->isFile() && strlen($file->getFilename()) == 32 && ($lfile == null || $lfile->getMTime() < $file->getMTime())) {
                 $lfile = $file;
             }
         }
         if ($lfile === null) {
             return null;
         }
         if (!$lfile->isReadable() || !$lfile->isWritable()) {
             throw new FrameworkException('Cache cannot be read or written, please check file permission to PHP user.');
         }
         return $lfile;
     }
 }
 public function rewind()
 {
     parent::rewind();
     $this->skipdots();
 }
Ejemplo n.º 12
0
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

<!--стили сайта-->
<?php 
Yii::app()->bootstrap->init();
$assets = Yii::app()->getModule('docs')->assetsUrl();
Yii::app()->clientScript->registerCssFile($assets . '/css/styles.css');
?>

</head>
<body>
<?php 
$items = array();
$i = new RecursiveDirectoryIterator(Yii::getPathOfAlias('docs.views.documentation'));
for ($i->rewind(); $i->valid(); $i->next()) {
    $item = $i->current();
    if (!$i->hasChildren()) {
        continue;
    }
    $folder_name = t($item->getFileName());
    $active_folder = false;
    $tmp = array();
    foreach ($i->getChildren() as $child) {
        list($file) = explode('.', $child->getFileName());
        $active = isset($_GET['alias']) && $_GET['alias'] == $file ? true : false;
        $active_folder = $active_folder || $active;
        $tmp[] = array('label' => t($file), 'itemOptions' => array(), 'active' => $active, 'url' => Yii::app()->createUrl('/docs/documentation/index', array('alias' => $file, 'folder' => $item->getFileName())));
    }
    if ($active_folder) {
        $items[] = array('label' => $folder_name, 'itemOptions' => array('class' => 'nav-header'));