archive = new $zipClass(); $this->archive->open($url['host']); $this->fileNameInArchive = $url['fragment']; $this->position = 0; $this->data = $this->archive->getFromName($this->fileNameInArchive); return true; } /** * Implements support for fstat(). * * @return string */ public function statName() { return $this->fileNameInArchive; } /** * Implements support for fstat(). * * @return string */ public function url_stat() // @codingStandardsIgnoreLine { return $this->statName(); } /** * Implements support for fstat(). * * @return bool */ public function stream_stat() // @codingStandardsIgnoreLine { return $this->archive->statName($this->fileNameInArchive); } /** * Implements support for fread(), fgets() etc. * * @param int $count maximum number of bytes to read * * @return string */ public function stream_read($count) // @codingStandardsIgnoreLine { $ret = substr($this->data, $this->position, $count); $this->position += strlen($ret); return $ret; } /** * Returns the position of the file pointer, i.e. its offset into the file * stream. Implements support for ftell(). * * @return int */ public function stream_tell() // @codingStandardsIgnoreLine { return $this->position; } /** * EOF stream. * * @return bool */ public function stream_eof() // @codingStandardsIgnoreLine { return $this->position >= strlen($this->data); } /** * Seek stream. * * @param int $offset byte offset * @param int $whence SEEK_SET, SEEK_CUR or SEEK_END * * @return bool */ public function stream_seek($offset, $whence) // @codingStandardsIgnoreLine { switch ($whence) { case SEEK_SET: if ($offset < strlen($this->data) && $offset >= 0) { $this->position = $offset; return true; } return false; case SEEK_CUR: if ($offset >= 0) { $this->position += $offset; return true; } return false; case SEEK_END: if (strlen($this->data) + $offset >= 0) { $this->position = strlen($this->data) + $offset; return true; } return false; default: return false; } } }