Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
FilePathsIterator.php
001 <?php
002
003 /*
004 * This file is part of the Symfony package.
005 *
006 * (c) Fabien Potencier <fabien@symfony.com>
007 *
008 * For the full copyright and license information, please view the LICENSE
009 * file that was distributed with this source code.
010 */
011
012 namespace Symfony\Component\Finder\Iterator;
013
014 @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
015
016 use Symfony\Component\Finder\SplFileInfo;
017
018 /**
019 * Iterate over shell command result.
020 *
021 * @author Jean-François Simon <contact@jfsimon.fr>
022 *
023 * @deprecated since 2.8, to be removed in 3.0.
024 */
025 class FilePathsIterator extends \ArrayIterator
026 {
027 /**
028 * @var string
029 */
030 private $baseDir;
031
032 /**
033 * @var int
034 */
035 private $baseDirLength;
036
037 /**
038 * @var string
039 */
040 private $subPath;
041
042 /**
043 * @var string
044 */
045 private $subPathname;
046
047 /**
048 * @var SplFileInfo
049 */
050 private $current;
051
052 /**
053 * @param array $paths List of paths returned by shell command
054 * @param string $baseDir Base dir for relative path building
055 */
056 public function __construct(array $paths, $baseDir)
057 {
058 $this->baseDir = $baseDir;
059 $this->baseDirLength = strlen($baseDir);
060
061 parent::__construct($paths);
062 }
063
064 /**
065 * @param string $name
066 * @param array $arguments
067 *
068 * @return mixed
069 */
070 public function __call($name, array $arguments)
071 {
072 return call_user_func_array(array($this->current(), $name), $arguments);
073 }
074
075 /**
076 * Return an instance of SplFileInfo with support for relative paths.
077 *
078 * @return SplFileInfo File information
079 */
080 public function current()
081 {
082 return $this->current;
083 }
084
085 /**
086 * @return string
087 */
088 public function key()
089 {
090 return $this->current->getPathname();
091 }
092
093 public function next()
094 {
095 parent::next();
096 $this->buildProperties();
097 }
098
099 public function rewind()
100 {
101 parent::rewind();
102 $this->buildProperties();
103 }
104
105 /**
106 * @return string
107 */
108 public function getSubPath()
109 {
110 return $this->subPath;
111 }
112
113 /**
114 * @return string
115 */
116 public function getSubPathname()
117 {
118 return $this->subPathname;
119 }
120
121 private function buildProperties()
122 {
123 $absolutePath = parent::current();
124
125 if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
126 $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
127 $dir = dirname($this->subPathname);
128 $this->subPath = '.' === $dir ? '' : $dir;
129 } else {
130 $this->subPath = $this->subPathname = '';
131 }
132
133 $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
134 }
135 }
136