OpenDocument
[ class tree: OpenDocument ] [ index: OpenDocument ] [ all elements ]

Source for file ZipWrapper.php

Documentation is available at ZipWrapper.php

  1. <?php
  2. class ZipWrapper
  3. {
  4.     public static function read($archive$filename)
  5.     {
  6.         $zip = new Zip;
  7.         if (file_exists($archive)) {
  8.             if ($zip->open(realpath($archive))) {
  9.                 if ($zip->locateName($filename!== false{
  10.                     return $zip->getFromName($filename);
  11.                 }
  12.             }
  13.         }
  14.         return false;
  15.     }
  16.  
  17.     public static function write($archive$filename$content)
  18.     {
  19.         $zip = new Zip;
  20.         if (file_exists($archive)) {
  21.             $zip->open(realpath($archive));
  22.         else {
  23.             $zip->open(getcwd('/' .  $archiveZipArchive::CREATE);
  24.         }
  25.  
  26.         if ($zip->locateName($filename!== false{
  27.             $zip->deleteName($filename);
  28.         }
  29.         $error $zip->addFromString($filename$content);
  30.  
  31.         return $error;
  32.     }
  33. }
  34. ?>

Documentation generated on Mon, 11 Mar 2019 15:06:45 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.