* Writes the last 0 filled block for end of archive.
*/
protected function writeFooter() {
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
- $format = 'Z512';
- }
- else {
- $format = 'a512';
- }
-
- $this->file->write(pack($format, ''));
+ $this->file->write(pack('a512', ''));
}
/**
return false;
}
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
- $format = 'Z512';
- }
- else {
- $format = 'a512';
- }
-
$i = 0;
while (($buffer = substr($string, (($i++) * 512), 512)) != '') {
- $this->file->write(pack($format, $buffer));
+ $this->file->write(pack('a512', $buffer));
}
return true;
}
// write file content
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
- $format = 'Z512';
- }
- else {
- $format = 'a512';
- }
-
while (($buffer = $file->read(512)) != '') {
- $this->file->write(pack($format, $buffer));
+ $this->file->write(pack('a512', $buffer));
}
// close file
$permissions = sprintf("%6s ", decOct($permissions));
$mtime = sprintf("%11s", decOct($mtime));
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
- $format = 'Z100Z8Z8Z8Z12A12';
- }
- else {
- $format = 'a100a8a8a8a12A12';
- }
-
- $binaryDataFirst = pack($format, $filename, $permissions, $uid, $gid, $size, $mtime);
-
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
- $format = 'Z1Z100Z6Z2Z32Z32Z8Z8Z155Z12';
- }
- else {
- $format = 'a1a100a6a2a32a32a8a8a155a12';
- }
-
- $binaryDataLast = pack($format, $typeFlag, '', '', '', '', '', '', '', '', '');
+ $binaryDataFirst = pack('a100a8a8a8a12A12', $filename, $permissions, $uid, $gid, $size, $mtime);
+ $binaryDataLast = pack('a1a100a6a2a32a32a8a8a155a12', $typeFlag, '', '', '', '', '', '', '', '', '');
// calculate the checksum
$checksum = 0;
$checksum += ord(substr($binaryDataLast, $j, 1));
}
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
- $format = 'Z8';
- }
- else {
- $format = 'a8';
- }
-
$this->file->write($binaryDataFirst, 148);
- $this->file->write(pack($format, sprintf("%6s ", decOct($checksum))), 8); // write the checksum
+ $this->file->write(pack('a8', sprintf("%6s ", decOct($checksum))), 8); // write the checksum
$this->file->write($binaryDataLast, 356);
return true;
$size = sprintf("%11s ", decOct(strlen($filename)));
$typeFlag = 'L';
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
- $format = 'Z100Z8Z8Z8Z12A12';
- }
- else {
- $format = 'a100a8a8a8a12A12';
- }
-
- $binaryDataFirst = pack($format, '././@LongLink', 0, 0, 0, $size, 0);
-
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
- $format = 'Z1Z100Z6Z2Z32Z32Z8Z8Z155Z12';
- }
- else {
- $format = 'a1a100a6a2a32a32a8a8a155a12';
- }
-
- $binaryDataLast = pack($format, $typeFlag, '', '', '', '', '', '', '', '', '');
+ $binaryDataFirst = pack('a100a8a8a8a12A12', '././@LongLink', 0, 0, 0, $size, 0);
+ $binaryDataLast = pack('a1a100a6a2a32a32a8a8a155a12', $typeFlag, '', '', '', '', '', '', '', '', '');
// calculate the checksum
$checksum = 0;
}
$this->file->write($binaryDataFirst, 148);
-
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
- $format = 'Z8';
- }
- else {
- $format = 'a8';
- }
-
- $this->file->write(pack($format, sprintf("%6s ", decOct($checksum))), 8); // write the checksum
+ $this->file->write(pack('a8', sprintf("%6s ", decOct($checksum))), 8); // write the checksum
$this->file->write($binaryDataLast, 356);
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
- $format = 'Z512';
- }
- else {
- $format = 'a512';
- }
-
$i = 0;
while (($buffer = substr($filename, (($i++) * 512), 512)) != '') {
- $this->file->write(pack($format, $buffer));
+ $this->file->write(pack('a512', $buffer));
}
return true;