didou Sat Jan 6 20:45:34 2007 UTC
Added files:
/phpdoc/en/reference/net_gopher constants.xml
Modified files:
/phpdoc/en/reference/net_gopher reference.xml
/phpdoc/en/reference/net_gopher/functions gopher-parsedir.xml
Log:
Enhance the documentation of Net_Gopher
List available constants
Finish new doc style implementation
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/net_gopher/reference.xml?r1=1.2&r2=1.3&diff_format=u
Index: phpdoc/en/reference/net_gopher/reference.xml
diff -u phpdoc/en/reference/net_gopher/reference.xml:1.2
phpdoc/en/reference/net_gopher/reference.xml:1.3
--- phpdoc/en/reference/net_gopher/reference.xml:1.2 Sun Sep 4 19:39:20 2005
+++ phpdoc/en/reference/net_gopher/reference.xml Sat Jan 6 20:45:34 2007
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<!-- Purpose: remote.other -->
<!-- Membership: pecl -->
@@ -39,10 +39,7 @@
&no.resource;
</section>
- <section id="net-gopher.constants">
- &reftitle.constants;
- &no.constants;
- </section>
+ &reference.net-gopher.constants;
<section id="net-gopher.examples">
&reftitle.examples;
@@ -50,8 +47,6 @@
<programlisting role="php">
<![CDATA[
<?php
-dl("gopher.so");
-
readfile("gopher://gopher.example.com/somedocument");
?>
]]>
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/net_gopher/functions/gopher-parsedir.xml?r1=1.4&r2=1.5&diff_format=u
Index: phpdoc/en/reference/net_gopher/functions/gopher-parsedir.xml
diff -u phpdoc/en/reference/net_gopher/functions/gopher-parsedir.xml:1.4
phpdoc/en/reference/net_gopher/functions/gopher-parsedir.xml:1.5
--- phpdoc/en/reference/net_gopher/functions/gopher-parsedir.xml:1.4 Fri Jun
17 18:08:58 2005
+++ phpdoc/en/reference/net_gopher/functions/gopher-parsedir.xml Sat Jan
6 20:45:34 2007
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/net-gopher.xml, last change in rev -->
<refentry id="function.gopher-parsedir">
<refnamediv>
@@ -13,14 +13,75 @@
<type>array</type><methodname>gopher_parsedir</methodname>
<methodparam><type>string</type><parameter>dirent</parameter></methodparam>
</methodsynopsis>
- <simpara>
+ <para>
+ <function>gopher_parsedir</function> parses a gopher formatted directory
+ entry into an associative array.
+ </para>
+ <para>
While gopher returns <literal>text/plain</literal> documents for
actual document requests. A request to a directory (such as /) will
return specially encoded series of lines with each line being one
directory entry or information line.
- </simpara>
+ </para>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>dirent</parameter></term>
+ <listitem>
+ <para>
+ The directory entry.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
</refsect1>
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ Returns an associative array whose components are:
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ <structfield>type</structfield> - One of the
+ <literal>GOPHER_XXX</literal> constants.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <structfield>title</structfield> - The name of the resource.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <structfield>path</structfield> - The path of the resource.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <structfield>host</structfield> - The domain name of the host that has
+ this document (or directory).
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <structfield>port</structfield> - The port at which to connect on
+ <structfield>host</structfield>.
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ Upon failure, the additional <structfield>data</structfield> entry of the
+ returned array will hold the parsed line.
+ </para>
+ </refsect1>
+
<refsect1 role="examples">
&reftitle.examples;
<para>
@@ -41,7 +102,7 @@
</screen>
</example>
</para>
- <simpara>
+ <para>
In the example above, the root directory at gopher.example.com knows about
one <literal>DOCUMENT</literal> identified by <literal>0</literal> located
at
<literal>gopher://gopher.example.com:70/allabout.txt</literal>. It also
knows
@@ -50,29 +111,29 @@
<literal>gopher://gopher.ejemplo.co.es:70/</literal>.
In addition there is a binary file, a link to an HTTP url, and several
informative lines.
- </simpara>
- <simpara>
+ </para>
+ <para>
By passing each line of the directory listing into
<function>gopher_parsedir</function>, an associative array is formed
containing
a parsed out version of the data.
- </simpara>
+ </para>
<para>
<example>
<title>Using <function>gopher_parsedir</function></title>
<programlisting role="php">
<![CDATA[
<?php
-dl("gopher.so");
-
$directory = file("gopher://gopher.example.com");
foreach($directory as $dirent) {
print_r(gopher_parsedir($dirent));
}
-
-/* Expected Output
- ---------------
-
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
Array (
[type] => 0
[title] => All about my gopher site.
@@ -136,68 +197,10 @@
[host] => error.host
[port] => 1
)
-*/
-?>
]]>
- </programlisting>
+ </screen>
</example>
</para>
- <simpara>
- The values given by <parameter>type</parameter> are associated with
- the following constants.
- </simpara>
- <table>
- <title>Gopher Constants</title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>Constant</entry>
- <entry>Definition</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><constant>GOPHER_DOCUMENT</constant></entry>
- <entry>Standard <literal>text/plain</literal> document.</entry>
- </row>
- <row>
- <entry><constant>GOPHER_DIRECTORY</constant></entry>
- <entry>A resource containing a gopher formatted directory
listing.</entry>
- </row>
- <row>
- <entry><constant>GOPHER_BINHEX</constant></entry>
- <entry>A BinHex encoded binary file.</entry>
- </row>
- <row>
- <entry><constant>GOPHER_DOSBINARY</constant></entry>
- <entry>A DOS formatted binary archive.</entry>
- </row>
- <row>
- <entry><constant>GOPHER_UUENCODED</constant></entry>
- <entry>A UUEncoded file.</entry>
- </row>
- <row>
- <entry><constant>GOPHER_BINARY</constant></entry>
- <entry>A generic binary file.</entry>
- </row>
- <row>
- <entry><constant>GOPHER_INFO</constant></entry>
- <entry>An Informational entry</entry>
- </row>
- <row>
- <entry><constant>GOPHER_HTTP</constant></entry>
- <entry>A reference to an HTTP resource.</entry>
- </row>
- <row>
- <entry><constant>GOPHER_UNKNOWN</constant></entry>
- <entry>
- An unrecognized entry, the line will be returned
- in <parameter>data</parameter>.
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
</refsect1>
</refentry>
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/net_gopher/constants.xml?view=markup&rev=1.1
Index: phpdoc/en/reference/net_gopher/constants.xml
+++ phpdoc/en/reference/net_gopher/constants.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<section id="net-gopher.constants">
&reftitle.constants;
&extension.constants;
<table>
<title>Net_Gopher constants</title>
<tgroup cols="3">
<thead>
<row>
<entry>Constant</entry>
<entry>Value</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><constant>GOPHER_DOCUMENT</constant></entry>
<entry>0</entry>
<entry>Standard <literal>text/plain</literal> document.</entry>
</row>
<row>
<entry><constant>GOPHER_DIRECTORY</constant></entry>
<entry>1</entry>
<entry>A resource containing a gopher formatted directory listing.</entry>
</row>
<row>
<entry><constant>GOPHER_BINHEX</constant></entry>
<entry>4</entry>
<entry>A BinHex encoded binary file.</entry>
</row>
<row>
<entry><constant>GOPHER_DOSBINARY</constant></entry>
<entry>5</entry>
<entry>A DOS formatted binary archive.</entry>
</row>
<row>
<entry><constant>GOPHER_UUENCODED</constant></entry>
<entry>6</entry>
<entry>A UUEncoded file.</entry>
</row>
<row>
<entry><constant>GOPHER_BINARY</constant></entry>
<entry>9</entry>
<entry>A generic binary file.</entry>
</row>
<row>
<entry><constant>GOPHER_INFO</constant></entry>
<entry>255</entry>
<entry>An Informational entry</entry>
</row>
<row>
<entry><constant>GOPHER_HTTP</constant></entry>
<entry>254</entry>
<entry>A reference to an HTTP resource.</entry>
</row>
<row>
<entry><constant>GOPHER_UNKNOWN</constant></entry>
<entry>-1</entry>
<entry>
An unrecognized entry.
</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->