mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
more tidy docs and examples. also some OO protos
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@162599 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
207206a637
commit
c62f44bd5d
13 changed files with 184 additions and 17 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.tidy-access-count">
|
||||
<refnamediv>
|
||||
<refname>tidy_access_count</refname>
|
||||
|
@ -13,9 +13,56 @@
|
|||
<type>int</type><methodname>tidy_access_count</methodname>
|
||||
<methodparam><type>resource</type><parameter>tidy</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>tidy_access_count</function> returns the number of
|
||||
accessibility warnings found for the specified document.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Due to the design of the TidyLib, you must call
|
||||
<function>tidy_diagnose</function> before
|
||||
<function>tidy_access_count</function> or it will return always
|
||||
<literal>0</literal>. You must also need to enable the
|
||||
<literal>accessibility-check</literal> option.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_access_count</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
&warn.undocumented.func;
|
||||
$html ='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||||
<html><head><title>Title</title></head>
|
||||
<body>
|
||||
|
||||
<p><img src="img.png"></p>
|
||||
|
||||
</body></html>';
|
||||
|
||||
|
||||
// select the accessibility check level: 1, 2 or 3
|
||||
$config = array('accessibility-check' => 3);
|
||||
|
||||
$tidy = new tidy();
|
||||
$tidy->parseString($html, $config);
|
||||
$tidy->CleanRepair();
|
||||
|
||||
/* Never forget to call this! */
|
||||
$tidy->diagnose();
|
||||
|
||||
echo tidy_access_count($tidy); //5
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>tidy_error_count</function> and
|
||||
<function>tidy_warning_count</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<refentry id="function.tidy-clean-repair">
|
||||
<refnamediv>
|
||||
<refname>tidy_clean_repair</refname>
|
||||
|
@ -9,10 +9,16 @@
|
|||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidy_clean_repair</methodname>
|
||||
<methodparam><type>resource</type><parameter>tidy</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style:</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidy->cleanRepair</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function cleans and repairs the given <parameter>tidy</parameter>
|
||||
resource.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry id="function.tidy-diagnose">
|
||||
<refnamediv>
|
||||
<refname>tidy_diagnose</refname>
|
||||
|
@ -9,10 +9,16 @@
|
|||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidy_diagnose</methodname>
|
||||
<methodparam><type>resource</type><parameter>tidy</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style:</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidy->diagnose</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>tidy_diagnose</function> runs diagnostic tests on the given
|
||||
resource.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<refentry id="function.tidy-get-body">
|
||||
<refnamediv>
|
||||
<refname>tidy_get_body</refname>
|
||||
|
@ -9,10 +9,16 @@
|
|||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>object</type><methodname>tidy_get_body</methodname>
|
||||
<methodparam><type>resource</type><parameter>tidy</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style:</para>
|
||||
<methodsynopsis>
|
||||
<type>object</type><methodname>tidy->body</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns a TidyNode object starting from the <body>
|
||||
tag of the tidy parse tree.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<refentry id="function.tidy-get-config">
|
||||
<refnamediv>
|
||||
<refname>tidy_get_config</refname>
|
||||
|
@ -9,10 +9,16 @@
|
|||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>tidy_get_config</methodname>
|
||||
<methodparam><type>resource</type><parameter>tidy</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style:</para>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>tidy->getConfig</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>tidy_get_config</function> returns an array with the
|
||||
configuration options in use by the given resource.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry id="function.tidy-get-error-buffer">
|
||||
<refnamediv>
|
||||
<refname>tidy_get_error_buffer</refname>
|
||||
|
@ -13,6 +13,11 @@
|
|||
<type>string</type><methodname>tidy_get_error_buffer</methodname>
|
||||
<methodparam><type>resource</type><parameter>tidy</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>tidy</classname></ooclass>
|
||||
<fieldsynopsis><type>string</type><varname>errorBuffer</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>tidy_get_error_buffer</function> returns warnings and errors
|
||||
which occurred parsing the specified document.
|
||||
|
@ -26,7 +31,10 @@
|
|||
$html = '<p>paragraph</p>';
|
||||
|
||||
$tidy = tidy_parse_string($html);
|
||||
|
||||
echo tidy_get_error_buffer($tidy);
|
||||
/* or in OO: */
|
||||
echo $tidy->errorBuffer;
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<refentry id="function.tidy-get-head">
|
||||
<refnamediv>
|
||||
<refname>tidy_get_head</refname>
|
||||
|
@ -9,10 +9,16 @@
|
|||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>object</type><methodname>tidy_get_head</methodname>
|
||||
<methodparam><type>resource</type><parameter>tidy</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style:</para>
|
||||
<methodsynopsis>
|
||||
<type>object</type><methodname>tidy->head</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns a TidyNode object starting from the <head>
|
||||
tag of the tidy parse tree.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<refentry id="function.tidy-get-html-ver">
|
||||
<refnamediv>
|
||||
<refname>tidy_get_html_ver</refname>
|
||||
|
@ -9,10 +9,16 @@
|
|||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>tidy_get_html_ver</methodname>
|
||||
<methodparam><type>resource</type><parameter>tidy</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style:</para>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>tidy->getHtmlVer</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>tidy_get_html_ver</function> returns the detected HTML version
|
||||
for the specified <parameter>tidy</parameter> resource.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<refentry id="function.tidy-get-html">
|
||||
<refnamediv>
|
||||
<refname>tidy_get_html</refname>
|
||||
|
@ -9,10 +9,16 @@
|
|||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>object</type><methodname>tidy_get_html</methodname>
|
||||
<methodparam><type>resource</type><parameter>tidy</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style:</para>
|
||||
<methodsynopsis>
|
||||
<type>object</type><methodname>tidy->html</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns a TidyNode object starting from the <html>
|
||||
tag of the tidy parse tree.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.tidy-get-release">
|
||||
<refnamediv>
|
||||
<refname>tidy_get_release</refname>
|
||||
|
@ -9,10 +9,16 @@
|
|||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>tidy_get_release</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style:</para>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>tidy->getRelease</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns a string with the release date of the Tidy library.
|
||||
</para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- Generated by xml_proto.php v2.0. Found in /scripts directory of phpdoc. -->
|
||||
<refentry id="function.tidy-get-root">
|
||||
<refnamediv>
|
||||
|
@ -10,9 +10,15 @@
|
|||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>object</type><methodname>tidy_get_root</methodname>
|
||||
<void/>
|
||||
<methodparam><type>resource</type><parameter>tidy</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style:</para>
|
||||
<methodsynopsis>
|
||||
<type>object</type><methodname>tidy->root</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
|
||||
&warn.undocumented.func;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry id="function.tidy-get-status">
|
||||
<refnamediv>
|
||||
<refname>tidy_get_status</refname>
|
||||
|
@ -9,10 +9,16 @@
|
|||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>tidy_get_status</methodname>
|
||||
<methodparam><type>resource</type><parameter>tidy</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style:</para>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>tidy->getStatus</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>tidy_get_status</function> returns the status for the specified
|
||||
<parameter>tidy</parameter> resource. It returns 0 if no error/warning
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- Generated by xml_proto.php v2.0. Found in /scripts directory of phpdoc. -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.tidy-getopt">
|
||||
<refnamediv>
|
||||
<refname>tidy_getopt</refname>
|
||||
|
@ -10,13 +9,66 @@
|
|||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>tidy_getopt</methodname>
|
||||
<methodparam><type>resource</type><parameter>tidy</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>option</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style:</para>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>tidy->getOpt</methodname>
|
||||
<methodparam><type>string</type><parameter>option</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>tidy_getopt</function> returns the value of the specified
|
||||
<parameter>option</parameter> for the specified
|
||||
<parameter>tidy</parameter> document. The return type depends on the type
|
||||
of the specified <parameter>option</parameter>. You will find a list with
|
||||
each configuration option and their types at: <ulink
|
||||
url="&url.tidy.conf;">&url.tidy.conf;</ulink>.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_getopt</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
&warn.undocumented.func;
|
||||
$html ='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||||
<html><head><title>Title</title></head>
|
||||
<body>
|
||||
|
||||
<p><img src="img.png"></p>
|
||||
|
||||
</body></html>';
|
||||
|
||||
$config = array('accessibility-check' => 3,
|
||||
'alt-text' => 'some text');
|
||||
|
||||
$tidy = new tidy();
|
||||
$tidy->parseString($html, $config);
|
||||
|
||||
|
||||
var_dump($tidy->getOpt('accessibility-check')); //integer
|
||||
var_dump($tidy->getOpt('lower-literals')); //boolean
|
||||
var_dump($tidy->getOpt('alt-text')); //string
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The above example will output:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
int(3)
|
||||
bool(true)
|
||||
string(9) "some text"
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
Loading…
Reference in a new issue