cvs: peardoc /en/package fileformats.xml /en/package/fileformats file-fortune.xml /en/package/fileformats/file-fortune example.xml intro.xml
/en/package/fileformats/file-fortune/file-fortune add.xml create.xml delete.xml getall.xml getdirectory.xml getfile.xml getheaderfile.xml
getrandom.xml save.xml setdirectory.xml setfile.xml setheaderfile.xml update.xml
| From: | Matthew Weier O'Phinney | Date: | Fri, 06 Jul 2007 11:38:20 +0000 |
| Subject: | cvs: peardoc /en/package fileformats.xml /en/package/fileformats file-fortune.xml /en/package/fileformats/file-fortune example.xml intro.xml /en/package/fileformats/file-fortune/file-fortune add.xml create.xml delete.xml getall.xml getdirectory.xml getfile.xml getheaderfile.xml getrandom.xml save.xml setdirectory.xml setfile.xml setheaderfile.xml update.xml |
||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-9870@lists.php.net to get a copy of this message | ||
weierophinney Fri Jul 6 11:38:20 2007 UTC
Added files:
/peardoc/en/package/fileformats file-fortune.xml
/peardoc/en/package/fileformats/file-fortune intro.xml example.xml
/peardoc/en/package/fileformats/file-fortune/file-fortune add.xml
create.xml
delete.xml
getall.xml
getdirectory.xml
getfile.xml
getheaderfile.xml
getrandom.xml
save.xml
setdirectory.xml
setfile.xml
setheaderfile.xml
update.xml
Modified files:
/peardoc/en/package fileformats.xml
Log:
* Initial File_Fortune end-user documentation
http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats.xml?r1=1.14&r2=1.15&diff_format=u Index: peardoc/en/package/fileformats.xml diff -u peardoc/en/package/fileformats.xml:1.14 peardoc/en/package/fileformats.xml:1.15 --- peardoc/en/package/fileformats.xml:1.14 Thu Feb 8 01:18:08 2007 +++ peardoc/en/package/fileformats.xml Fri Jul 6 11:38:20 2007 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.14 $ --> +<!-- $Revision: 1.15 $ --> <chapter id="package.fileformats"> <title>File Formats</title> @@ -13,6 +13,7 @@ &package.fileformats.contact-vcard-parse; &package.fileformats.file-archive; &package.fileformats.file-dicom; + &package.fileformats.file-fortune; &package.fileformats.file-fstab; &package.fileformats.file-marc; &package.fileformats.file-passwd; http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune.xml +++ peardoc/en/package/fileformats/file-fortune.xml <sect1 id="package.fileformats.file-fortune"> <title>File_Fortune</title> <refentry id="package.fileformats.file-fortune.file-fortune-summary"> <refnamediv> <refname> Class Summary <classname>File_Fortune</classname> </refname> <refpurpose>File_Fortune</refpurpose> </refnamediv> <refsect1> <title>File_Fortune</title> <para>File_Fortune: Interface to fortune cookie databases</para> <para>The <em>fortune</em> program is a small but important part of *nix culture, and this package aims to provide support for its "fortune cookie" databases to PHP programmers.</para> </refsect1> <refsect1> <title> Class Trees for <classname>File_Fortune</classname> </title> <para> <itemizedlist> <listitem> <para>File_Fortune</para> </listitem> <listitem> <para>File_Fortune_Exception</para> </listitem> </itemizedlist> </para> </refsect1> </refentry> &package.fileformats.file-fortune.intro; &package.fileformats.file-fortune.example; &package.fileformats.file-fortune.file-fortune.--construct; &package.fileformats.file-fortune.file-fortune.add; &package.fileformats.file-fortune.file-fortune.create; &package.fileformats.file-fortune.file-fortune.delete; &package.fileformats.file-fortune.file-fortune.getall; &package.fileformats.file-fortune.file-fortune.getdirectory; &package.fileformats.file-fortune.file-fortune.getfile; &package.fileformats.file-fortune.file-fortune.getheaderfile; &package.fileformats.file-fortune.file-fortune.getrandom; &package.fileformats.file-fortune.file-fortune.save; &package.fileformats.file-fortune.file-fortune.setdirectory; &package.fileformats.file-fortune.file-fortune.setfile; &package.fileformats.file-fortune.file-fortune.setheaderfile; &package.fileformats.file-fortune.file-fortune.update; </sect1> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/intro.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/intro.xml +++ peardoc/en/package/fileformats/file-fortune/intro.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <refentry id="package.fileformats.file-fortune.intro"> <refnamediv> <refname>Introduction</refname> <refpurpose> <classname>File_Fortune</classname> aims to provide a simple OOP and array-like interface to fortune files. To this end, it implements the SPL interfaces Iterator, Countable, and ArrayAccess. With it, you may easily create and maintain fortune databases, as well as fulfill their primary use case: getting a random fortune. </refpurpose> </refnamediv> <refsect1 id="package.fileformats.file-fortune.intro.authors"> <title>Authors</title> <para> <itemizedlist> <listitem><simpara>Greg Ward is the original author of the Perl "Fortune.pm", on which work this heavily derives.</simpara></listitem> <listitem><simpara>Matthew Weier O'Phinney is the author of this implementation.</simpara></listitem> </itemizedlist> </para> </refsect1> </refentry> <!-- 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 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 --> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/example.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/example.xml +++ peardoc/en/package/fileformats/file-fortune/example.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <refentry id="package.fileformats.file-fortune.example"> <refnamediv> <refname>Example</refname> <refpurpose> Below are some common use cases. </refpurpose> </refnamediv> <refsect1> <example> <title>Getting a random fortune</title> <programlisting role="php"> <![CDATA[ <?php require_once 'File/Fortune.php'; // Grab from a single fortune file: $fortunes = new File_Fortune('/path/to/fortune/file'); echo $fortunes->getRandom(); // Grab from a directory of fortune files: $fortunes = new File_Fortune('/path/to/fortune/files/'); echo $fortunes->getRandom(); ?> ]]> </programlisting> </example> <example> <title>Get all fortunes</title> <programlisting role="php"> <![CDATA[ <?php require_once 'File/Fortune.php'; $fortunes = new File_Fortune('/path/to/fortune/file'); $cached = $fortunes->getAll(); ?> ]]> </programlisting> </example> <example> <title>Counting fortunes</title> <programlisting role="php"> <![CDATA[ <?php require_once 'File/Fortune.php'; $fortunes = new File_Fortune('/path/to/fortune/file'); $count = count($fortunes); ?> ]]> </programlisting> </example> <example> <title>Looping through fortunes</title> <programlisting role="php"> <![CDATA[ <?php require_once 'File/Fortune.php'; $fortunes = new File_Fortune('/path/to/fortune/file'); foreach ($fortunes as $fortune) { echo $fortune; } ?> ]]> </programlisting> </example> <example> <title>Manipulating fortunes</title> <programlisting role="php"> <![CDATA[ <?php require_once 'File/Fortune.php'; $fortunes = new File_Fortune('/path/to/fortune/file'); // Delete a fortune: unset($fortunes[2]); // deletes fortune denoted at index 2 // Update a fortune: $fortune[2] = "I never liked this fortune"; // update fortune at index 2 ?> ]]> </programlisting> </example> <example> <title>Adding fortunes</title> <programlisting role="php"> <![CDATA[ <?php require_once 'File/Fortune.php'; $fortunes = new File_Fortune('/path/to/fortune/file'); $fortunes->add('Shiny, new fortune!'); ?> ]]> </programlisting> </example> <example> <title>Creating a new fortune file</title> <programlisting role="php"> <![CDATA[ <?php require_once 'File/Fortune.php'; $newFortunes = array( 'Fortune 1', 'Fortune 2', 'Fortune 3' ); $fortunes = new File_Fortune('/path/to/fortune/file'); $fortunes->create($newFortunes); ?> ]]> </programlisting> </example> </refsect1> </refentry> <!-- 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 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 --> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/add.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/add.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/add.xml <refentry id="package.fileformats.file-fortune.file-fortune.add"> <refnamediv> <refname> <function>File_Fortune::add</function> </refname> <refpurpose>Add a new fortune</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> <replaceable> <link linkend="package.fileformats.file-fortune.file-fortune-summary"> <classname>File_Fortune</classname> </link> </replaceable> <function>File_Fortune::add</function> </funcdef> <paramdef> string <parameter>$fortune</parameter> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.add.desc"> &title.desc; ¬documented; </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.add.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.string; <parameter>$fortune</parameter> </term> <listitem> <para>Fortune string to add to fortune file. Fortune will be appended to fortune file.</para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.add.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.add.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/create.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/create.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/create.xml <refentry id="package.fileformats.file-fortune.file-fortune.create"> <refnamediv> <refname> <function>File_Fortune::create</function> </refname> <refpurpose>Create a new fortune file from an array of fortunes</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> void <function>File_Fortune::create</function> </funcdef> <paramdef> <parameter>$fortunes</parameter> </paramdef> <paramdef> string <parameter> <optional>$file = &null;</optional> </parameter> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.create.desc"> &title.desc; ¬documented; </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.create.param"> &title.param; <para> <variablelist> <varlistentry> <term> <type /> <parameter>$fortunes</parameter> </term> <listitem> <para>Array of fortunes to use to seed the new fortune file.</para> </listitem> </varlistentry> </variablelist> <variablelist> <varlistentry> <term> &type.string; <parameter>$file</parameter> </term> <listitem> <para>Optional file name to use when creating new fortune file. If not provided, attempts to use the file set via <link xref="package.fileformats.file-fortune.file-fortune.set-file">setFile()</link></para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.create.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.create.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/delete.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/delete.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/delete.xml <refentry id="package.fileformats.file-fortune.file-fortune.delete"> <refnamediv> <refname> <function>File_Fortune::delete</function> </refname> <refpurpose>Delete an existing fortune</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> void <function>File_Fortune::delete</function> </funcdef> <paramdef> int <parameter>$index</parameter> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.delete.desc"> &title.desc; <para> <function>delete()</function> may be used to delete a fortune at a given index. However, the easier usage is to simply use unset with array notation: </para> <programlisting role="php"><![CDATA[ <?php unset($fortunes[$index]); ]]></programlisting> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.delete.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.int; <parameter>$index</parameter> </term> <listitem> <para/> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.delete.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.delete.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/getall.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/getall.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/getall.xml <refentry id="package.fileformats.file-fortune.file-fortune.getall"> <refnamediv> <refname> <function>File_Fortune::getAll</function> </refname> <refpurpose>Retrieve all fortunes from the current file</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> array <function>File_Fortune::getAll</function> </funcdef> <paramdef /> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.getall.desc"> &title.desc; <para> <function>getAll()</function> can be used to pull the entire fortune database into an array. Typically this is a bad idea as fortune files are often very large. If you wish to do some processing with each fortune, use the <classname>File_Fortune</classname> object as an iterator: </para> <programlisting role="php"><![CDATA[ <?php foreach ($fortunes as $fortune) { // do something with the fortune } ?> ]]></programlisting> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getall.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getall.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/getdirectory.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/getdirectory.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/getdirectory.xml <refentry id="package.fileformats.file-fortune.file-fortune.getdirectory"> <refnamediv> <refname> <function>File_Fortune::getDirectory</function> </refname> <refpurpose>Retrieve current directory of fortune files</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> string <function>File_Fortune::getDirectory</function> </funcdef> <paramdef /> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.getdirectory.desc"> &title.desc; <para> <function>getDirectory()</function> returns the currently registered fortune file directory, if any. </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getdirectory.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getdirectory.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/getfile.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/getfile.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/getfile.xml <refentry id="package.fileformats.file-fortune.file-fortune.getfile"> <refnamediv> <refname> <function>File_Fortune::getFile</function> </refname> <refpurpose>Retrieve current fortune file name</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> string <function>File_Fortune::getFile</function> </funcdef> <paramdef /> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.getfile.desc"> &title.desc; ¬documented; </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getfile.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getfile.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/getheaderfile.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/getheaderfile.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/getheaderfile.xml <refentry id="package.fileformats.file-fortune.file-fortune.getheaderfile"> <refnamediv> <refname> <function>File_Fortune::getHeaderFile</function> </refname> <refpurpose>Retrieve current header file name</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> string <function>File_Fortune::getHeaderFile</function> </funcdef> <paramdef /> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.getheaderfile.desc"> &title.desc; <para> Header files are explained in <link xref="package.fileformats.file-fortune.file-fortune.setheaderfile">the setHeaderFile() documentation</link>. This method returns the current header file name, if any. </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getheaderfile.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getheaderfile.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/getrandom.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/getrandom.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/getrandom.xml <refentry id="package.fileformats.file-fortune.file-fortune.getrandom"> <refnamediv> <refname> <function>File_Fortune::getRandom</function> </refname> <refpurpose>Retrieve random fortune</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> string <function>File_Fortune::getRandom</function> </funcdef> <paramdef /> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.getrandom.desc"> &title.desc; <para> <function>getRandom()</function> pulls a random fortune. If a fortune file has been explicitly specified, the fortune will be pulled from that file; if a directory has been specified, a random fortune file will first be selected. </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getrandom.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getrandom.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/save.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/save.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/save.xml <refentry id="package.fileformats.file-fortune.file-fortune.save"> <refnamediv> <refname> <function>File_Fortune::save</function> </refname> <refpurpose>Save changes</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> void <function>File_Fortune::save</function> </funcdef> <paramdef /> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.save.desc"> &title.desc; <para> In most cases, it will not be necessary to save changes; <function>__destruct()</function> will save changes when the object goes out of scope. However, if you wish to manually ensure that changes are set, you may call <function>save()</function>. </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.save.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.save.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/setdirectory.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/setdirectory.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/setdirectory.xml <refentry id="package.fileformats.file-fortune.file-fortune.setdirectory"> <refnamediv> <refname> <function>File_Fortune::setDirectory</function> </refname> <refpurpose>Set directory from which to randomly select a fortune file</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> <replaceable> <link linkend="package.fileformats.file-fortune.file-fortune-summary"> <classname>File_Fortune</classname> </link> </replaceable> <function>File_Fortune::setDirectory</function> </funcdef> <paramdef> string <parameter>$directory</parameter> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.setdirectory.desc"> &title.desc; ¬documented; </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setdirectory.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.string; <parameter>$directory</parameter> </term> <listitem> <para /> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setdirectory.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setdirectory.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/setfile.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/setfile.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/setfile.xml <refentry id="package.fileformats.file-fortune.file-fortune.setfile"> <refnamediv> <refname> <function>File_Fortune::setFile</function> </refname> <refpurpose>Set fortune file</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> <replaceable> <link linkend="package.fileformats.file-fortune.file-fortune-summary"> <classname>File_Fortune</classname> </link> </replaceable> <function>File_Fortune::setFile</function> </funcdef> <paramdef> string <parameter>$file</parameter> </paramdef> <paramdef> string <parameter> <optional>$headerFile = &null;</optional> </parameter> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.setfile.desc"> &title.desc; <para> <function>setFile()</function> may be used to explicitly set a fortune file to use or create. </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setfile.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.string; <parameter>$file</parameter> </term> <listitem> <para /> </listitem> </varlistentry> </variablelist> <variablelist> <varlistentry> <term> &type.string; <parameter>$headerFile</parameter> </term> <listitem> <para /> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setfile.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setfile.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/setheaderfile.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/setheaderfile.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/setheaderfile.xml <refentry id="package.fileformats.file-fortune.file-fortune.setheaderfile"> <refnamediv> <refname> <function>File_Fortune::setHeaderFile</function> </refname> <refpurpose>Set header file name</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> <replaceable> <link linkend="package.fileformats.file-fortune.file-fortune-summary"> <classname>File_Fortune</classname> </link> </replaceable> <function>File_Fortune::setHeaderFile</function> </funcdef> <paramdef> string <parameter>$headerFile</parameter> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.setheaderfile.desc"> &title.desc; <para> Fortune files consist of an ASCII file containing fortunes separated by a delimiter, and a binary header file that contains meta information such as the delimter used, number of fortunes, minimum and maximum length of fortunes contained in the file, and the offsets where each fortune exist in the file. </para> <para> In most cases, this file is simply the name of the fortune file plus the extension 'dat', and <classname>File_Fortune</classname> will automatically detect this. If this is not the case, however, you may explicitly set the header file name using this method. </para> </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setheaderfile.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.string; <parameter>$headerFile</parameter> </term> <listitem> <para /> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setheaderfile.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setheaderfile.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/update.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/update.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/update.xml <refentry id="package.fileformats.file-fortune.file-fortune.update"> <refnamediv> <refname> <function>File_Fortune::update</function> </refname> <refpurpose>Update an existing fortune</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> void <function>File_Fortune::update</function> </funcdef> <paramdef> int <parameter>$index</parameter> </paramdef> <paramdef> string <parameter>$fortune</parameter> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.update.desc"> &title.desc; <para> <function>update()</function> may be used to update fortunes. However, the recommended practice is to use array access: </para> <programlisting role="php"><![CDATA[ <?php $fortunes[2] = 'Updated fortunes are fun!'; ]]></programlisting> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.update.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.int; <parameter>$index</parameter> </term> <listitem> <para /> </listitem> </varlistentry> </variablelist> <variablelist> <varlistentry> <term> &type.string; <parameter>$fortune</parameter> </term> <listitem> <para /> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.update.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.update.note"> &title.note; ¬e.notstatic; </refsect1> </refentry>
http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats.xml?r1=1.14&r2=1.15&diff_format=u Index: peardoc/en/package/fileformats.xml diff -u peardoc/en/package/fileformats.xml:1.14 peardoc/en/package/fileformats.xml:1.15 --- peardoc/en/package/fileformats.xml:1.14 Thu Feb 8 01:18:08 2007 +++ peardoc/en/package/fileformats.xml Fri Jul 6 11:38:20 2007 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.14 $ --> +<!-- $Revision: 1.15 $ --> <chapter id="package.fileformats"> <title>File Formats</title> @@ -13,6 +13,7 @@ &package.fileformats.contact-vcard-parse; &package.fileformats.file-archive; &package.fileformats.file-dicom; + &package.fileformats.file-fortune; &package.fileformats.file-fstab; &package.fileformats.file-marc; &package.fileformats.file-passwd; http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune.xml +++ peardoc/en/package/fileformats/file-fortune.xml <sect1 id="package.fileformats.file-fortune"> <title>File_Fortune</title> <refentry id="package.fileformats.file-fortune.file-fortune-summary"> <refnamediv> <refname> Class Summary <classname>File_Fortune</classname> </refname> <refpurpose>File_Fortune</refpurpose> </refnamediv> <refsect1> <title>File_Fortune</title> <para>File_Fortune: Interface to fortune cookie databases</para> <para>The <em>fortune</em> program is a small but important part of *nix culture, and this package aims to provide support for its "fortune cookie" databases to PHP programmers.</para> </refsect1> <refsect1> <title> Class Trees for <classname>File_Fortune</classname> </title> <para> <itemizedlist> <listitem> <para>File_Fortune</para> </listitem> <listitem> <para>File_Fortune_Exception</para> </listitem> </itemizedlist> </para> </refsect1> </refentry> &package.fileformats.file-fortune.intro; &package.fileformats.file-fortune.example; &package.fileformats.file-fortune.file-fortune.--construct; &package.fileformats.file-fortune.file-fortune.add; &package.fileformats.file-fortune.file-fortune.create; &package.fileformats.file-fortune.file-fortune.delete; &package.fileformats.file-fortune.file-fortune.getall; &package.fileformats.file-fortune.file-fortune.getdirectory; &package.fileformats.file-fortune.file-fortune.getfile; &package.fileformats.file-fortune.file-fortune.getheaderfile; &package.fileformats.file-fortune.file-fortune.getrandom; &package.fileformats.file-fortune.file-fortune.save; &package.fileformats.file-fortune.file-fortune.setdirectory; &package.fileformats.file-fortune.file-fortune.setfile; &package.fileformats.file-fortune.file-fortune.setheaderfile; &package.fileformats.file-fortune.file-fortune.update; </sect1> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/intro.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/intro.xml +++ peardoc/en/package/fileformats/file-fortune/intro.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <refentry id="package.fileformats.file-fortune.intro"> <refnamediv> <refname>Introduction</refname> <refpurpose> <classname>File_Fortune</classname> aims to provide a simple OOP and array-like interface to fortune files. To this end, it implements the SPL interfaces Iterator, Countable, and ArrayAccess. With it, you may easily create and maintain fortune databases, as well as fulfill their primary use case: getting a random fortune. </refpurpose> </refnamediv> <refsect1 id="package.fileformats.file-fortune.intro.authors"> <title>Authors</title> <para> <itemizedlist> <listitem><simpara>Greg Ward is the original author of the Perl "Fortune.pm", on which work this heavily derives.</simpara></listitem> <listitem><simpara>Matthew Weier O'Phinney is the author of this implementation.</simpara></listitem> </itemizedlist> </para> </refsect1> </refentry> <!-- 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 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 --> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/example.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/example.xml +++ peardoc/en/package/fileformats/file-fortune/example.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <refentry id="package.fileformats.file-fortune.example"> <refnamediv> <refname>Example</refname> <refpurpose> Below are some common use cases. </refpurpose> </refnamediv> <refsect1> <example> <title>Getting a random fortune</title> <programlisting role="php"> <![CDATA[ <?php require_once 'File/Fortune.php'; // Grab from a single fortune file: $fortunes = new File_Fortune('/path/to/fortune/file'); echo $fortunes->getRandom(); // Grab from a directory of fortune files: $fortunes = new File_Fortune('/path/to/fortune/files/'); echo $fortunes->getRandom(); ?> ]]> </programlisting> </example> <example> <title>Get all fortunes</title> <programlisting role="php"> <![CDATA[ <?php require_once 'File/Fortune.php'; $fortunes = new File_Fortune('/path/to/fortune/file'); $cached = $fortunes->getAll(); ?> ]]> </programlisting> </example> <example> <title>Counting fortunes</title> <programlisting role="php"> <![CDATA[ <?php require_once 'File/Fortune.php'; $fortunes = new File_Fortune('/path/to/fortune/file'); $count = count($fortunes); ?> ]]> </programlisting> </example> <example> <title>Looping through fortunes</title> <programlisting role="php"> <![CDATA[ <?php require_once 'File/Fortune.php'; $fortunes = new File_Fortune('/path/to/fortune/file'); foreach ($fortunes as $fortune) { echo $fortune; } ?> ]]> </programlisting> </example> <example> <title>Manipulating fortunes</title> <programlisting role="php"> <![CDATA[ <?php require_once 'File/Fortune.php'; $fortunes = new File_Fortune('/path/to/fortune/file'); // Delete a fortune: unset($fortunes[2]); // deletes fortune denoted at index 2 // Update a fortune: $fortune[2] = "I never liked this fortune"; // update fortune at index 2 ?> ]]> </programlisting> </example> <example> <title>Adding fortunes</title> <programlisting role="php"> <![CDATA[ <?php require_once 'File/Fortune.php'; $fortunes = new File_Fortune('/path/to/fortune/file'); $fortunes->add('Shiny, new fortune!'); ?> ]]> </programlisting> </example> <example> <title>Creating a new fortune file</title> <programlisting role="php"> <![CDATA[ <?php require_once 'File/Fortune.php'; $newFortunes = array( 'Fortune 1', 'Fortune 2', 'Fortune 3' ); $fortunes = new File_Fortune('/path/to/fortune/file'); $fortunes->create($newFortunes); ?> ]]> </programlisting> </example> </refsect1> </refentry> <!-- 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 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 --> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/add.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/add.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/add.xml <refentry id="package.fileformats.file-fortune.file-fortune.add"> <refnamediv> <refname> <function>File_Fortune::add</function> </refname> <refpurpose>Add a new fortune</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> <replaceable> <link linkend="package.fileformats.file-fortune.file-fortune-summary"> <classname>File_Fortune</classname> </link> </replaceable> <function>File_Fortune::add</function> </funcdef> <paramdef> string <parameter>$fortune</parameter> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.add.desc"> &title.desc; ¬documented; </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.add.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.string; <parameter>$fortune</parameter> </term> <listitem> <para>Fortune string to add to fortune file. Fortune will be appended to fortune file.</para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.add.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.add.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/create.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/create.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/create.xml <refentry id="package.fileformats.file-fortune.file-fortune.create"> <refnamediv> <refname> <function>File_Fortune::create</function> </refname> <refpurpose>Create a new fortune file from an array of fortunes</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> void <function>File_Fortune::create</function> </funcdef> <paramdef> <parameter>$fortunes</parameter> </paramdef> <paramdef> string <parameter> <optional>$file = &null;</optional> </parameter> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.create.desc"> &title.desc; ¬documented; </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.create.param"> &title.param; <para> <variablelist> <varlistentry> <term> <type /> <parameter>$fortunes</parameter> </term> <listitem> <para>Array of fortunes to use to seed the new fortune file.</para> </listitem> </varlistentry> </variablelist> <variablelist> <varlistentry> <term> &type.string; <parameter>$file</parameter> </term> <listitem> <para>Optional file name to use when creating new fortune file. If not provided, attempts to use the file set via <link xref="package.fileformats.file-fortune.file-fortune.set-file">setFile()</link></para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.create.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.create.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/delete.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/delete.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/delete.xml <refentry id="package.fileformats.file-fortune.file-fortune.delete"> <refnamediv> <refname> <function>File_Fortune::delete</function> </refname> <refpurpose>Delete an existing fortune</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> void <function>File_Fortune::delete</function> </funcdef> <paramdef> int <parameter>$index</parameter> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.delete.desc"> &title.desc; <para> <function>delete()</function> may be used to delete a fortune at a given index. However, the easier usage is to simply use unset with array notation: </para> <programlisting role="php"><![CDATA[ <?php unset($fortunes[$index]); ]]></programlisting> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.delete.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.int; <parameter>$index</parameter> </term> <listitem> <para/> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.delete.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.delete.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/getall.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/getall.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/getall.xml <refentry id="package.fileformats.file-fortune.file-fortune.getall"> <refnamediv> <refname> <function>File_Fortune::getAll</function> </refname> <refpurpose>Retrieve all fortunes from the current file</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> array <function>File_Fortune::getAll</function> </funcdef> <paramdef /> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.getall.desc"> &title.desc; <para> <function>getAll()</function> can be used to pull the entire fortune database into an array. Typically this is a bad idea as fortune files are often very large. If you wish to do some processing with each fortune, use the <classname>File_Fortune</classname> object as an iterator: </para> <programlisting role="php"><![CDATA[ <?php foreach ($fortunes as $fortune) { // do something with the fortune } ?> ]]></programlisting> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getall.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getall.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/getdirectory.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/getdirectory.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/getdirectory.xml <refentry id="package.fileformats.file-fortune.file-fortune.getdirectory"> <refnamediv> <refname> <function>File_Fortune::getDirectory</function> </refname> <refpurpose>Retrieve current directory of fortune files</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> string <function>File_Fortune::getDirectory</function> </funcdef> <paramdef /> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.getdirectory.desc"> &title.desc; <para> <function>getDirectory()</function> returns the currently registered fortune file directory, if any. </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getdirectory.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getdirectory.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/getfile.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/getfile.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/getfile.xml <refentry id="package.fileformats.file-fortune.file-fortune.getfile"> <refnamediv> <refname> <function>File_Fortune::getFile</function> </refname> <refpurpose>Retrieve current fortune file name</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> string <function>File_Fortune::getFile</function> </funcdef> <paramdef /> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.getfile.desc"> &title.desc; ¬documented; </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getfile.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getfile.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/getheaderfile.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/getheaderfile.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/getheaderfile.xml <refentry id="package.fileformats.file-fortune.file-fortune.getheaderfile"> <refnamediv> <refname> <function>File_Fortune::getHeaderFile</function> </refname> <refpurpose>Retrieve current header file name</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> string <function>File_Fortune::getHeaderFile</function> </funcdef> <paramdef /> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.getheaderfile.desc"> &title.desc; <para> Header files are explained in <link xref="package.fileformats.file-fortune.file-fortune.setheaderfile">the setHeaderFile() documentation</link>. This method returns the current header file name, if any. </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getheaderfile.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getheaderfile.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/getrandom.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/getrandom.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/getrandom.xml <refentry id="package.fileformats.file-fortune.file-fortune.getrandom"> <refnamediv> <refname> <function>File_Fortune::getRandom</function> </refname> <refpurpose>Retrieve random fortune</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> string <function>File_Fortune::getRandom</function> </funcdef> <paramdef /> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.getrandom.desc"> &title.desc; <para> <function>getRandom()</function> pulls a random fortune. If a fortune file has been explicitly specified, the fortune will be pulled from that file; if a directory has been specified, a random fortune file will first be selected. </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getrandom.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.getrandom.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/save.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/save.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/save.xml <refentry id="package.fileformats.file-fortune.file-fortune.save"> <refnamediv> <refname> <function>File_Fortune::save</function> </refname> <refpurpose>Save changes</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> void <function>File_Fortune::save</function> </funcdef> <paramdef /> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.save.desc"> &title.desc; <para> In most cases, it will not be necessary to save changes; <function>__destruct()</function> will save changes when the object goes out of scope. However, if you wish to manually ensure that changes are set, you may call <function>save()</function>. </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.save.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.save.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/setdirectory.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/setdirectory.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/setdirectory.xml <refentry id="package.fileformats.file-fortune.file-fortune.setdirectory"> <refnamediv> <refname> <function>File_Fortune::setDirectory</function> </refname> <refpurpose>Set directory from which to randomly select a fortune file</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> <replaceable> <link linkend="package.fileformats.file-fortune.file-fortune-summary"> <classname>File_Fortune</classname> </link> </replaceable> <function>File_Fortune::setDirectory</function> </funcdef> <paramdef> string <parameter>$directory</parameter> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.setdirectory.desc"> &title.desc; ¬documented; </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setdirectory.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.string; <parameter>$directory</parameter> </term> <listitem> <para /> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setdirectory.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setdirectory.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/setfile.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/setfile.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/setfile.xml <refentry id="package.fileformats.file-fortune.file-fortune.setfile"> <refnamediv> <refname> <function>File_Fortune::setFile</function> </refname> <refpurpose>Set fortune file</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> <replaceable> <link linkend="package.fileformats.file-fortune.file-fortune-summary"> <classname>File_Fortune</classname> </link> </replaceable> <function>File_Fortune::setFile</function> </funcdef> <paramdef> string <parameter>$file</parameter> </paramdef> <paramdef> string <parameter> <optional>$headerFile = &null;</optional> </parameter> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.setfile.desc"> &title.desc; <para> <function>setFile()</function> may be used to explicitly set a fortune file to use or create. </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setfile.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.string; <parameter>$file</parameter> </term> <listitem> <para /> </listitem> </varlistentry> </variablelist> <variablelist> <varlistentry> <term> &type.string; <parameter>$headerFile</parameter> </term> <listitem> <para /> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setfile.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setfile.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/setheaderfile.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/setheaderfile.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/setheaderfile.xml <refentry id="package.fileformats.file-fortune.file-fortune.setheaderfile"> <refnamediv> <refname> <function>File_Fortune::setHeaderFile</function> </refname> <refpurpose>Set header file name</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> <replaceable> <link linkend="package.fileformats.file-fortune.file-fortune-summary"> <classname>File_Fortune</classname> </link> </replaceable> <function>File_Fortune::setHeaderFile</function> </funcdef> <paramdef> string <parameter>$headerFile</parameter> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.setheaderfile.desc"> &title.desc; <para> Fortune files consist of an ASCII file containing fortunes separated by a delimiter, and a binary header file that contains meta information such as the delimter used, number of fortunes, minimum and maximum length of fortunes contained in the file, and the offsets where each fortune exist in the file. </para> <para> In most cases, this file is simply the name of the fortune file plus the extension 'dat', and <classname>File_Fortune</classname> will automatically detect this. If this is not the case, however, you may explicitly set the header file name using this method. </para> </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setheaderfile.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.string; <parameter>$headerFile</parameter> </term> <listitem> <para /> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setheaderfile.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.setheaderfile.note"> &title.note; ¬e.notstatic; </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/file-fortune/file-fortune/update.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/file-fortune/file-fortune/update.xml +++ peardoc/en/package/fileformats/file-fortune/file-fortune/update.xml <refentry id="package.fileformats.file-fortune.file-fortune.update"> <refnamediv> <refname> <function>File_Fortune::update</function> </refname> <refpurpose>Update an existing fortune</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>require_once '/Fortune.php';</funcsynopsisinfo> <funcprototype> <funcdef> void <function>File_Fortune::update</function> </funcdef> <paramdef> int <parameter>$index</parameter> </paramdef> <paramdef> string <parameter>$fortune</parameter> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.fileformats.file-fortune.file-fortune.update.desc"> &title.desc; <para> <function>update()</function> may be used to update fortunes. However, the recommended practice is to use array access: </para> <programlisting role="php"><![CDATA[ <?php $fortunes[2] = 'Updated fortunes are fun!'; ]]></programlisting> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.update.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.int; <parameter>$index</parameter> </term> <listitem> <para /> </listitem> </varlistentry> </variablelist> <variablelist> <varlistentry> <term> &type.string; <parameter>$fortune</parameter> </term> <listitem> <para /> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.update.throws"> &title.throws; <para> <emphasis>throws</emphasis> no exceptions thrown </para> </refsect1> <refsect1 id="package.fileformats.file-fortune.file-fortune.update.note"> &title.note; ¬e.notstatic; </refsect1> </refentry>