tularis         Sun May  6 19:45:58 2007 UTC

  Modified files:              
    /phpdoc/en/reference/fileinfo/functions     finfo-open.xml 
  Log:
  added example, cleaned up description, clarified parameters
  
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/fileinfo/functions/finfo-open.xml?r1=1.1&r2=1.2&diff_format=u
Index: phpdoc/en/reference/fileinfo/functions/finfo-open.xml
diff -u phpdoc/en/reference/fileinfo/functions/finfo-open.xml:1.1 
phpdoc/en/reference/fileinfo/functions/finfo-open.xml:1.2
--- phpdoc/en/reference/fileinfo/functions/finfo-open.xml:1.1   Thu Mar  9 
14:15:41 2006
+++ phpdoc/en/reference/fileinfo/functions/finfo-open.xml       Sun May  6 
19:45:58 2007
@@ -1,18 +1,21 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.1 $ -->
-<!-- Generated by xml_proto.php v2.3. Found in /scripts directory of phpdoc. 
-->
+<!-- $Revision: 1.2 $ -->
 <refentry id="function.finfo-open">
  <refnamediv>
   <refname>finfo_open</refname>
+  <refname>finfo->__construct()</refname>
   <refpurpose>Create a new fileinfo resource</refpurpose>
  </refnamediv>
+
  <refsect1 role="description">
   &reftitle.description;
+  <para>Procedural style</para>
   <methodsynopsis>
    <type>resource</type><methodname>finfo_open</methodname>
    <methodparam 
choice="opt"><type>int</type><parameter>options</parameter></methodparam>
    <methodparam 
choice="opt"><type>string</type><parameter>arg</parameter></methodparam>
   </methodsynopsis>
+  <para>Object oriented style (constructor):</para>
   <classsynopsis>
    <ooclass><classname>finfo</classname></ooclass>
    <constructorsynopsis>
@@ -21,12 +24,11 @@
     <methodparam 
choice="opt"><type>string</type><parameter>magic_file</parameter></methodparam>
    </constructorsynopsis>
   </classsynopsis>
-
   <para>
    This function opens a magic database and returns its resource.
   </para>
-
  </refsect1>
+
  <refsect1 role="parameters">
   &reftitle.parameters;
   <para>
@@ -46,16 +48,17 @@
       <para>
        Name of a magic database file, usually something like
        <filename>/path/to/magic.mime</filename>. If not specified,
-       <literal>MAGIC</literal> environment variable is used. If this variable
-       is not set neither, <filename>/usr/share/misc/magic</filename> is used.
-       <literal>.mime</literal> and/or <literal>.mgc</literal> is added if
-       appropriate.
+       the <literal>MAGIC</literal> environment variable is used. If this 
variable
+       is not set either, <filename>/usr/share/misc/magic</filename> is used 
by default.
+       A <literal>.mime</literal> and/or <literal>.mgc</literal> suffix is 
added if
+       needed.
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
   </para>
  </refsect1>
+
  <refsect1 role="returnvalues">
   &reftitle.returnvalues;
   <para>
@@ -63,6 +66,60 @@
   </para>
  </refsect1>
 
+ <refsect1 role="examples">
+  &reftitle.examples;
+  <example>
+   <title>Object oriented style</title>
+   <programlisting role="php">
+<![CDATA[
+<?php
+$finfo = new finfo(FILEINFO_MIME, "/usr/share/misc/magic"); // return mime 
type ala mimetype extension
+
+if (!$finfo) {
+    echo "Opening fileinfo database failed";
+    exit();
+}
+
+/* get mime-type for a specific file */
+$filename = "/usr/local/something.txt";
+echo $finfo->file($filename);
+
+/* close connection */
+$finfo->close();
+?>
+]]>
+  </programlisting>
+  </example>
+  <example>
+   <title>Procedural style</title>
+   <programlisting role="php">
+<![CDATA[
+<?php
+$finfo = finfo_open(FILEINFO_MIME, "/usr/share/misc/magic"); // return mime 
type ala mimetype extension
+
+if (!$finfo) {
+    echo "Opening fileinfo database failed";
+    exit();
+}
+
+/* get mime-type for a specific file */
+$filename = "/usr/local/something.txt";
+echo finfo_file($finfo, $filename);
+
+/* close connection */
+finfo_close($finfo);
+?>
+]]>
+   </programlisting>
+  </example>
+  &example.outputs;
+  <screen>
+<![CDATA[
+text/plain
+]]>
+  </screen>
+ </refsect1>
+
  <refsect1 role="seealso">
   &reftitle.seealso;
   <para>

Reply via email to