<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="tidy.repairfile" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>tidy::repairFile</refname>
  <refname>tidy_repair_file</refname>
  <refpurpose>Repair a file and return it as a string</refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <para>&style.oop;</para>
  <methodsynopsis role="tidy">
   <modifier>public</modifier> <modifier>static</modifier> <type class="union"><type>string</type><type>false</type></type><methodname>tidy::repairFile</methodname>
   <methodparam><type>string</type><parameter>filename</parameter></methodparam>
   <methodparam choice="opt"><type class="union"><type>array</type><type>string</type><type>null</type></type><parameter>config</parameter><initializer>&null;</initializer></methodparam>
   <methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>encoding</parameter><initializer>&null;</initializer></methodparam>
   <methodparam choice="opt"><type>bool</type><parameter>useIncludePath</parameter><initializer>&false;</initializer></methodparam>
  </methodsynopsis>
  <para>&style.procedural;</para>
  <methodsynopsis>
   <type class="union"><type>string</type><type>false</type></type><methodname>tidy_repair_file</methodname>
   <methodparam><type>string</type><parameter>filename</parameter></methodparam>
   <methodparam choice="opt"><type class="union"><type>array</type><type>string</type><type>null</type></type><parameter>config</parameter><initializer>&null;</initializer></methodparam>
   <methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>encoding</parameter><initializer>&null;</initializer></methodparam>
   <methodparam choice="opt"><type>bool</type><parameter>useIncludePath</parameter><initializer>&false;</initializer></methodparam>
  </methodsynopsis>

  <para>
   Repairs the given file and returns it as a string.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>filename</parameter></term>
     <listitem>
      <para>
       The file to be repaired.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>config</parameter></term>
     <listitem>
      <para>
       The config <parameter>config</parameter> can be passed either as an
       array or as a string. If a string is passed, it is interpreted as the
       name of the configuration file, otherwise, it is interpreted as the
       options themselves.
      </para>
      <para>
       Check http://tidy.sourceforge.net/docs/quickref.html for an
       explanation about each option.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>encoding</parameter></term>
     <listitem>
      <para>
       The <parameter>encoding</parameter> parameter sets the encoding for
       input/output documents. The possible values for encoding  are: 
       <literal>ascii</literal>, <literal>latin0</literal>, <literal>latin1</literal>,
       <literal>raw</literal>, <literal>utf8</literal>, <literal>iso2022</literal>,
       <literal>mac</literal>, <literal>win1252</literal>, <literal>ibm858</literal>,
       <literal>utf16</literal>, <literal>utf16le</literal>, <literal>utf16be</literal>,
       <literal>big5</literal>, and <literal>shiftjis</literal>.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>useIncludePath</parameter></term>
     <listitem>
      <para>
       Search for the file in the <link linkend="ini.include-path">include_path</link>.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   Returns the repaired contents as a string, &return.falseforfailure;.
  </para>
 </refsect1>

 <refsect1 role="changelog">
  &reftitle.changelog;
  <informaltable>
   <tgroup cols="2">
    <thead>
     <row>
      <entry>&Version;</entry>
      <entry>&Description;</entry>
     </row>
    </thead>
    <tbody>
     <row>
      <entry>8.0.0</entry>
      <entry>
       <methodname>tidy::repairFile</methodname> is a static method now.
      </entry>
     </row>
     <row>
      <entry>8.0.0</entry>
      <entry>
       <parameter>config</parameter> and <parameter>encoding</parameter> are nullable now.
      </entry>
     </row>
    </tbody>
   </tgroup>
  </informaltable>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title><function>tidy::repairFile</function> example</title>
    <programlisting role="php">
<![CDATA[
<?php
$file = 'file.html';

$tidy = new tidy();
$repaired = $tidy->repairfile($file);
rename($file, $file . '.bak');

file_put_contents($file, $repaired);
?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <simplelist>
   <member><function>tidy::parseFile</function></member>
   <member><function>tidy::parseString</function></member>
   <member><function>tidy::repairString</function></member>
  </simplelist>
 </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
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/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
-->
