cvs: phpdoc-de /reference/zip reference.xml

From: Date: Mon, 26 Mar 2007 12:38:15 +0000
Subject: cvs: phpdoc-de /reference/zip reference.xml
Groups: php.doc.de 
Request: Send a blank email to doc-de+get-2100@lists.php.net to get a copy of this message
hholzgra Mon Mar 26 12:38:15 2007 UTC Modified files: /phpdoc-de/reference/zip reference.xml Log: translation update http://cvs.php.net/viewvc.cgi/phpdoc-de/reference/zip/reference.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc-de/reference/zip/reference.xml diff -u phpdoc-de/reference/zip/reference.xml:1.4 phpdoc-de/reference/zip/reference.xml:1.5 --- phpdoc-de/reference/zip/reference.xml:1.4 Wed Jan 24 20:12:04 2007 +++ phpdoc-de/reference/zip/reference.xml Mon Mar 26 12:38:15 2007 @@ -1,56 +1,154 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> -<!-- EN-Revision: 1.1 Maintainer: mk Status: unknown --> +<!-- $Revision: 1.5 $ --> +<!-- EN-Revision: 1.14 Maintainer: hholzgra Status: ready --> +<!-- Purpose: compression --> +<!-- Membership: bundled, pecl --> + <reference id="ref.zip"> - <title>ZIP Funktionen (Lesezugriff)</title> + <title>Zip File Functionen</title> <titleabbrev>Zip</titleabbrev> - - <partintro> - <para> - Dieses Modul benutzt die Funktionen der <ulink - url="&url.zziplib;">ZZIPlib</ulink> Bibliothek von Guido Draheim - um ZIP komprimierte Archive und die darin enthaltenen Dateien zu - lesen. - </para> - <para> - Zu beachten ist, dass ZZIPlib nur eine Untermenge der Funktionen - zur Verfügung stellt, die in einer vollständigen Implementation - des ZIP Algorithmus vorhanden sind. Zur Erstellung eines ZIP - Archivs muss man sich eines der üblichen ZIP Programme bedienen. - </para> + + <partintro> + <section id="zip.intro"> + &reftitle.intro; <para> - Die ZIP Unterstützung ist standardmäßig nicht aktiviert. Um die - ZIP Funktionen nutzen zu können, muss PHP mit der option <link - linkend="install.configure.with-zip">--with-zip</link> kompiliert - werden. Das ZIP Modul benötigt ZZIPlib version &gt;= 0.10.6. + Diese Extension ermöglicht den transparenten Lese- und Schreibzugriff + auf ZIP-komprimierte Archive und die darin enthaltenen Dateien. </para> - <note> + </section> + + <section id="zip.requirements"> + &reftitle.required; + <section id="zip.requirements.old"> + <title>PHP 4</title> <para> - Zip Unterstützung für PHP vor Version 4.1.0 ist als experimentell - anzusehen. Dieser Abschnitt beschreibt die ZIP Unterstützung, - wie sie für PHP ab Version 4.1.0 existiert. + Die mit PHP 4 ausgelieferte Version der Extension benötigt die + <ulink url="&url.zziplib;">ZZIPlib</ulink> Bibliothek von + Guido Draheim ab Version 0.10.6 </para> - </note> + </section> - <section id="zip-example"> - <title>Beispiel zur Verwendung</title> + <section id="zip.requirements.new"> + <title>PHP 5.2.0 und später</title> <para> - Dieses Beispiel öffnet ein ein ZIP Archiv, liest jede Datei - innerhalb des Archivs und gibt den Inhalt zurück. Das - <filename>test2.zip</filename> Archiv, das in diesem Beispiel - benutzt wird, wird mit der Original Distribution der ZZIPlib - Bibliothek mitgeliefert. + Die Extension nutzt nun Funktionalität der + <ulink url="&url.zlib;">zlib</ulink> + von Jean-loup Gailly und Mark Adler. </para> - <example> - <title>Beispiel zur Verwendung der Zip Funktion</title> - <programlisting role="php"> -<![CDATA[ + </section> + </section> + + &reference.zip.configure; + + <section id="zip.configuration"> + &reftitle.runtime; + &no.config; + </section> + + <section id="zip.resources"> + &reftitle.resources; + <para> + Die Zip Extension benutzt zwei Resourcetypen, einen für + Verzeichnisse innerhalb eines Zip-Archivs und einen für + die eigentlichen Dateieinträge innerhalb des Archivs. + </para> + </section> + + &reference.zip.constants; + + <section id="zip.examples"> + &reftitle.examples; + <example> + <title>Erstellen eines Zip-Archivs</title> + <programlisting role="php"> +<![CDATA[ +<?php + +$zip = new ZipArchive(); +$filename = "./test112.zip"; + +if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) { + exit("cannot open <$filename>\n"); +} + +$zip->addFromString("testfilephp.txt" . time(), "#1 This is a test string added as testfilephp.txt.\n"); +$zip->addFromString("testfilephp2.txt" . time(), "#2 This is a test string added as testfilephp2.txt.\n"); +$zip->addFile($thisdir . "/too.php","/testfromfile.php"); +echo "numfiles: " . $zip->numFiles . "\n"; +echo "status:" . $zip->status . "\n"; +$zip->close(); +?> +]]> + </programlisting> + </example> + <example> + <title>Ausgabe eines detailierten Archivlistings</title> + <programlisting role="php"> +<![CDATA[ +<?php +$za = new ZipArchive(); + +$za->open('test_with_comment.zip'); +print_r($za); +var_dump($za); +echo "numFiles: " . $za->numFiles . "\n"; +echo "status: " . $za->status . "\n"; +echo "statusSys: " . $za->statusSys . "\n"; +echo "filename: " . $za->filename . "\n"; +echo "comment: " . $za->comment . "\n"; + +for ($i=0; $i<$za->numFiles;$i++) { + echo "index: $i\n"; + print_r($za->statIndex($i)); +} +echo "numFile:" . $za->numFiles . "\n"; +?> +]]> + </programlisting> + </example> + <example> + <title>Zip Stream Wrapper, Auslesen von OpenOffice Metainformationen</title> + <programlisting role="php"> +<![CDATA[ +<?php +$reader = new XMLReader(); + +$reader->open('zip://' . dirname(__FILE__) . '/test.odt#meta.xml'); +$odt_meta = array(); +while ($reader->read()) { + if ($reader->nodeType == XMLREADER::ELEMENT) { + $elm = $reader->name; + } else { + if ($reader->nodeType == XMLREADER::END_ELEMENT && $reader->name == 'office:meta') { + break; + } + if (!trim($reader->value)) { + continue; + } + $odt_meta[$elm] = $reader->value; + } +} +print_r($odt_meta); +?> +]]> + </programlisting> + </example> + <para> + Das folgende Beispiel benutzt das alte PHP 4 API, es öffnet + eine Zip-Datei, liest jede einzelne Datei im Archiv und + gibt deren Inhalt aus. Die in diesem Beispiel genutzte + <filename>test2.zip</filename> Datei ist Teil des Testarchivs + des ZZIPlib Quellcodes. + </para> + <example> + <title>Zip Beispiel</title> + <programlisting role="php"> +<![CDATA[ <?php $zip = zip_open("/tmp/test2.zip"); if ($zip) { - while ($zip_entry = zip_read($zip)) { echo "Name: " . zip_entry_name($zip_entry) . "\n"; echo "Actual Filesize: " . zip_entry_filesize($zip_entry) . "\n"; @@ -71,15 +169,14 @@ zip_close($zip); } - ?> ]]> - </programlisting> - </example> - </section> - </partintro> - -&reference.zip.functions; + </programlisting> + </example> + </section> + </partintro> + + &reference.zip.functions; </reference> <!-- Keep this comment at the end of the file @@ -102,4 +199,3 @@ vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> -

« previous php.doc.de (#2100) next »