Posted by Aaron on Thu 8 May 18:32 (modification of post by view diff)
report abuse | download | new post
- <?
- class Archive {
- function __construct($archive, $create = false) {
- $this->archive = new ZipArchive;
- }
- $this->archive->open($archive);
- } else {
- $this->archive->open($archive, ZipArchive::CREATE);
- }
- }
- public function read($filename) {
- if($this->archive->locateName($filename) !== false) {
- return $this->archive->getFromName($filename);
- }
- return false;
- }
- public function delete($filename) {
- if ($this->archive->locateName($filename) !== false) {
- $this->archive->deleteName($filename);
- }
- }
- public function write($filename, $content) {
- $this->delete($filename);
- return $this->archive->addFromString($filename, $content);
- }
- public function addFile($filename, $localname) {
- $this->delete($filename);
- }
- }
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.