/**
  * Returns entry content
  *
  * @param   io.archive.zip.ZipEntry entry
  * @return  string
  */
 protected function entryContent(ZipEntry $entry)
 {
     if ($entry->isDirectory()) {
         return NULL;
     } else {
         return (string) Streams::readAll($entry->getInputStream());
     }
 }
예제 #2
0
 function open()
 {
     if (!$this->_fp) {
         // Load zip
         if (!file_exists($this->_path)) {
             return;
         }
         $this->_fp = @fopen($this->_path, "rb");
         if ($this->_fp) {
             // Parse local file headers
             while ($header = $this->readLocalFileHeader()) {
                 /*echo "Local file header:\n";
                 		var_dump($header);*/
                 $entry = new ZipEntry($this, $header);
                 $this->_entries[] =& $entry;
                 $this->_entryLookup[$entry->getPath()] =& $entry;
             }
             // Parse central dir headers
             while ($header = $this->readCentralDirHeader()) {
                 /*echo "Central dir header:\n";
                 		var_dump($header);*/
                 // Append to existing headers
                 for ($i = 0; $i < count($this->_entries); $i++) {
                     $entry =& $this->_entries[$i];
                     if ($entry->getPath() == $header['filename']) {
                         $entry->addHeader($header);
                     }
                 }
             }
             // Parse central dir end header
             if ($header = $this->readCentralDirEnd()) {
                 /*echo "Central dir end:\n";
                 		var_dump($header);*/
                 $this->setHeader($header);
             }
         }
     }
 }