Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/worker/src/Symfony/Filesyst...
File: FilesystemIterator.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Poor man's PHP 5.2 port of FilesystemIterator from PHP 5.3.
[3] Fix | Delete
*
[4] Fix | Delete
* WARNING: Do not use this one in PHP >=5.3, use native FilesystemIterator instead.
[5] Fix | Delete
*
[6] Fix | Delete
* @see http://php.net/manual/en/class.filesystemiterator.php
[7] Fix | Delete
* @see https://github.com/php/php-src/blob/master/ext/spl/spl_directory.c
[8] Fix | Delete
*/
[9] Fix | Delete
class Symfony_Filesystem_FilesystemIterator extends DirectoryIterator implements SeekableIterator
[10] Fix | Delete
{
[11] Fix | Delete
const CURRENT_AS_PATHNAME = 32;
[12] Fix | Delete
const CURRENT_AS_FILEINFO = 0;
[13] Fix | Delete
const CURRENT_AS_SELF = 16;
[14] Fix | Delete
const CURRENT_MODE_MASK = 240;
[15] Fix | Delete
const KEY_AS_PATHNAME = 0;
[16] Fix | Delete
const KEY_AS_FILENAME = 256;
[17] Fix | Delete
const FOLLOW_SYMLINKS = 512;
[18] Fix | Delete
const KEY_MODE_MASK = 3840;
[19] Fix | Delete
const NEW_CURRENT_AND_KEY = 256;
[20] Fix | Delete
const SKIP_DOTS = 4096;
[21] Fix | Delete
const UNIX_PATHS = 8192;
[22] Fix | Delete
[23] Fix | Delete
private $flags;
[24] Fix | Delete
[25] Fix | Delete
/**
[26] Fix | Delete
* @param string $path
[27] Fix | Delete
* @param int $flags
[28] Fix | Delete
*/
[29] Fix | Delete
public function __construct($path, $flags = null)
[30] Fix | Delete
{
[31] Fix | Delete
if ($flags === null) {
[32] Fix | Delete
$flags = self::KEY_AS_PATHNAME | self::CURRENT_AS_FILEINFO | self::SKIP_DOTS;
[33] Fix | Delete
}
[34] Fix | Delete
$this->flags = $flags;
[35] Fix | Delete
parent::__construct($path);
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
/**
[39] Fix | Delete
* @return mixed
[40] Fix | Delete
*/
[41] Fix | Delete
public function current()
[42] Fix | Delete
{
[43] Fix | Delete
if ($this->flags & self::CURRENT_AS_PATHNAME) {
[44] Fix | Delete
return $this->getPathname();
[45] Fix | Delete
} elseif ($this->flags & self::CURRENT_AS_SELF) {
[46] Fix | Delete
return $this;
[47] Fix | Delete
} else {
[48] Fix | Delete
return $this->getFileInfo();
[49] Fix | Delete
}
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
/**
[53] Fix | Delete
* @return string
[54] Fix | Delete
*/
[55] Fix | Delete
public function key()
[56] Fix | Delete
{
[57] Fix | Delete
if ($this->flags & self::KEY_AS_FILENAME) {
[58] Fix | Delete
return $this->getFilename();
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
return $this->getPathname();
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
/**
[65] Fix | Delete
*/
[66] Fix | Delete
public function next()
[67] Fix | Delete
{
[68] Fix | Delete
do {
[69] Fix | Delete
parent::next();
[70] Fix | Delete
} while ($this->isDot());
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
/**
[74] Fix | Delete
*/
[75] Fix | Delete
public function rewind()
[76] Fix | Delete
{
[77] Fix | Delete
parent::rewind();
[78] Fix | Delete
while ($this->isDot()) {
[79] Fix | Delete
$this->next();
[80] Fix | Delete
}
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
/**
[84] Fix | Delete
* @param int $flags
[85] Fix | Delete
*/
[86] Fix | Delete
public function setFlags($flags)
[87] Fix | Delete
{
[88] Fix | Delete
$this->flags = $flags;
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
/**
[92] Fix | Delete
* @return int
[93] Fix | Delete
*/
[94] Fix | Delete
public function getFlags()
[95] Fix | Delete
{
[96] Fix | Delete
return $this->flags;
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
/**
[100] Fix | Delete
* Overridden to not crash PHP 5.2, because DirectoryIterator::seek was added in 5.3.
[101] Fix | Delete
*
[102] Fix | Delete
* @link http://lxr.php.net/xref/PHP_5_3/ext/spl/spl_directory.c#807
[103] Fix | Delete
*/
[104] Fix | Delete
public function seek($position)
[105] Fix | Delete
{
[106] Fix | Delete
if (is_callable(array('parent', 'seek'))) {
[107] Fix | Delete
parent::seek($position);
[108] Fix | Delete
[109] Fix | Delete
return;
[110] Fix | Delete
}
[111] Fix | Delete
[112] Fix | Delete
if ($this->key() > $position) {
[113] Fix | Delete
$this->rewind();
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
while ($this->key() < $position) {
[117] Fix | Delete
if (!$this->valid()) {
[118] Fix | Delete
return;
[119] Fix | Delete
}
[120] Fix | Delete
$this->next();
[121] Fix | Delete
}
[122] Fix | Delete
}
[123] Fix | Delete
}
[124] Fix | Delete
[125] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function