コード例 #1
0
 /**
  * @param string $name
  * @param object $obj
  */
 public function __construct($name, $obj)
 {
     parent::__construct($name);
     $this->_obj = $obj;
 }
コード例 #2
0
 /**
  * Execute the 'file_callback' for each file entry.
  * The zip file is automatically closed when complete (the iterator returned by PHP is one-way).
  * @param WEBCORE_CALLBACK $file_callback Function prototype: function ({@link COMPRESSED_FILE} $archive, {@link COMPRESSED_FILE_ENTRY} $entry, {@link CALLBACK} $error_callback = null)
  * @param WEBCORE_CALLBACK $error_callback Function prototype: function ({@link COMPRESSED_FILE} $archive, string $msg, {@link COMPRESSED_FILE_ENTRY} $entry)
  */
 protected function _for_each($file_callback, $error_callback = null)
 {
     $opts = global_file_options();
     $file_num = 0;
     while ($zip_entry = zip_read($this->_handle)) {
         $size = zip_entry_filesize($zip_entry);
         if ($size > 0) {
             $file_num += 1;
             $entry = new ZIP_ENTRY($this, $this->_handle, $zip_entry, $opts);
             $entry->name = zip_entry_name($zip_entry);
             $entry->normalized_name = normalize_path($entry->name, $opts);
             $entry->number = $file_num;
             $entry->size = $size;
             $entry->compressed_size = zip_entry_compressedsize($zip_entry);
             $file_callback->execute(array($this, $entry, $error_callback));
         }
     }
     $this->close();
 }