mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Switch to new documentation style
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@277593 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
4898a1cf10
commit
65d4ed89fb
47 changed files with 2890 additions and 1201 deletions
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.19 $ -->
|
||||
<!-- $Revision: 1.20 $ -->
|
||||
<refentry xml:id="function.stream-filter-append" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_filter_append</refname>
|
||||
<refpurpose>Attach a filter to a stream</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>stream_filter_append</methodname>
|
||||
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
|
||||
|
@ -16,33 +16,99 @@
|
|||
</methodsynopsis>
|
||||
<para>
|
||||
Adds <parameter>filtername</parameter> to the list of filters
|
||||
attached to <parameter>stream</parameter>. This filter will be
|
||||
added with the specified <parameter>params</parameter>
|
||||
to the <emphasis>end</emphasis> of the list and
|
||||
will therefore be called last during stream operations. To
|
||||
add a filter to the beginning of the list, use
|
||||
<function>stream_filter_prepend</function>.
|
||||
attached to <parameter>stream</parameter>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
By default, <function>stream_filter_append</function> will
|
||||
attach the filter to the <literal>read filter chain</literal>
|
||||
if the file was opened for reading (i.e. File Mode:
|
||||
<literal>r</literal>, and/or <literal>+</literal>). The filter
|
||||
will also be attached to the <literal>write filter chain</literal>
|
||||
if the file was opened for writing (i.e. File Mode:
|
||||
<literal>w</literal>, <literal>a</literal>, and/or <literal>+</literal>).
|
||||
<constant>STREAM_FILTER_READ</constant>,
|
||||
<constant>STREAM_FILTER_WRITE</constant>, and/or
|
||||
<constant>STREAM_FILTER_ALL</constant> can also be passed to the
|
||||
<parameter>read_write</parameter> parameter to override this behavior.
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>stream</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The target stream.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>filtername</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The filter name.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>read_write</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
By default, <function>stream_filter_append</function> will
|
||||
attach the filter to the <literal>read filter chain</literal>
|
||||
if the file was opened for reading (i.e. File Mode:
|
||||
<literal>r</literal>, and/or <literal>+</literal>). The filter
|
||||
will also be attached to the <literal>write filter chain</literal>
|
||||
if the file was opened for writing (i.e. File Mode:
|
||||
<literal>w</literal>, <literal>a</literal>, and/or <literal>+</literal>).
|
||||
<constant>STREAM_FILTER_READ</constant>,
|
||||
<constant>STREAM_FILTER_WRITE</constant>, and/or
|
||||
<constant>STREAM_FILTER_ALL</constant> can also be passed to the
|
||||
<parameter>read_write</parameter> parameter to override this behavior.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>params</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This filter will be added with the specified
|
||||
<parameter>params</parameter> to the <emphasis>end</emphasis> of
|
||||
the list and will therefore be called last during stream operations.
|
||||
To add a filter to the beginning of the list, use
|
||||
<function>stream_filter_prepend</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
As of PHP 5.1.0, this function returns a resource which
|
||||
can be used to refer to this filter instance during a call
|
||||
to <function>stream_filter_remove</function>.
|
||||
Prior to PHP 5.1.0, this function returns &true; on success
|
||||
or &false; on failure.
|
||||
Returns a resource which can be used to refer to this filter
|
||||
instance during a call to <function>stream_filter_remove</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="changelog">
|
||||
&reftitle.changelog;
|
||||
<para>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>&Version;</entry>
|
||||
<entry>&Description;</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>5.1.0</entry>
|
||||
<entry>
|
||||
Prior to PHP 5.1.0, this function returns &true; on success
|
||||
or &false; on failure.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Controlling where filters are applied</title>
|
||||
|
@ -84,6 +150,10 @@ Guvf vf n grfg
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<title>When using custom (user) filters</title>
|
||||
<simpara>
|
||||
|
@ -108,12 +178,15 @@ Guvf vf n grfg
|
|||
<constant>STREAM_FILTER_WRITE</constant> to get both filter resources.
|
||||
</simpara>
|
||||
</note>
|
||||
<simpara>
|
||||
See also
|
||||
<function>stream_filter_register</function>,
|
||||
<function>stream_filter_prepend</function>, and
|
||||
<function>stream_get_filters</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>stream_filter_register</function></member>
|
||||
<member><function>stream_filter_prepend</function></member>
|
||||
<member><function>stream_get_filters</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.14 $ -->
|
||||
<!-- $Revision: 1.15 $ -->
|
||||
<refentry xml:id="function.stream-filter-prepend" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_filter_prepend</refname>
|
||||
<refpurpose>Attach a filter to a stream</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>stream_filter_prepend</methodname>
|
||||
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
|
||||
|
@ -16,35 +16,100 @@
|
|||
</methodsynopsis>
|
||||
<para>
|
||||
Adds <parameter>filtername</parameter> to the list of filters
|
||||
attached to <parameter>stream</parameter>. This filter will be
|
||||
added with the specified <parameter>params</parameter>
|
||||
to the <emphasis>beginning</emphasis> of the list and
|
||||
will therefore be called first during stream operations. To
|
||||
add a filter to the end of the list, use
|
||||
<function>stream_filter_append</function>.
|
||||
attached to <parameter>stream</parameter>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
By default, <function>stream_filter_prepend</function> will
|
||||
attach the filter to the <literal>read filter chain</literal>
|
||||
if the file was opened for reading (i.e. File Mode:
|
||||
<literal>r</literal>, and/or <literal>+</literal>). The filter
|
||||
will also be attached to the <literal>write filter chain</literal>
|
||||
if the file was opened for writing (i.e. File Mode:
|
||||
<literal>w</literal>, <literal>a</literal>, and/or <literal>+</literal>).
|
||||
<constant>STREAM_FILTER_READ</constant>,
|
||||
<constant>STREAM_FILTER_WRITE</constant>, and/or
|
||||
<constant>STREAM_FILTER_ALL</constant> can also be passed to the
|
||||
<parameter>read_write</parameter> parameter to override this behavior.
|
||||
See <function>stream_filter_append</function> for an example of
|
||||
using this parameter.
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>stream</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The target stream.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>filtername</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The filter name.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>read_write</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
By default, <function>stream_filter_prepend</function> will
|
||||
attach the filter to the <literal>read filter chain</literal>
|
||||
if the file was opened for reading (i.e. File Mode:
|
||||
<literal>r</literal>, and/or <literal>+</literal>). The filter
|
||||
will also be attached to the <literal>write filter chain</literal>
|
||||
if the file was opened for writing (i.e. File Mode:
|
||||
<literal>w</literal>, <literal>a</literal>, and/or <literal>+</literal>).
|
||||
<constant>STREAM_FILTER_READ</constant>,
|
||||
<constant>STREAM_FILTER_WRITE</constant>, and/or
|
||||
<constant>STREAM_FILTER_ALL</constant> can also be passed to the
|
||||
<parameter>read_write</parameter> parameter to override this behavior.
|
||||
See <function>stream_filter_append</function> for an example of
|
||||
using this parameter.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>params</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This filter will be added with the specified <parameter>params</parameter>
|
||||
to the <emphasis>beginning</emphasis> of the list and will therefore be
|
||||
called first during stream operations. To add a filter to the end of the
|
||||
list, use <function>stream_filter_append</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
As of PHP 5.1.0, this function returns a resource which
|
||||
can be used to refer to this filter instance during a call
|
||||
to <function>stream_filter_remove</function>.
|
||||
Prior to PHP 5.1.0, this function returns &true; on success
|
||||
or &false; on failure.
|
||||
Returns a resource which can be used to refer to this filter
|
||||
instance during a call to <function>stream_filter_remove</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="changelog">
|
||||
&reftitle.changelog;
|
||||
<para>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>&Version;</entry>
|
||||
<entry>&Description;</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>5.1.0</entry>
|
||||
<entry>
|
||||
Prior to PHP 5.1.0, this function returns &true; on success
|
||||
or &false; on failure.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<title>When using custom (user) filters</title>
|
||||
<simpara>
|
||||
|
@ -71,11 +136,14 @@
|
|||
<constant>STREAM_FILTER_WRITE</constant> to get both filter resources.
|
||||
</simpara>
|
||||
</note>
|
||||
<simpara>
|
||||
See also
|
||||
<function>stream_filter_register</function>, and
|
||||
<function>stream_filter_append</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>stream_filter_register</function></member>
|
||||
<member><function>stream_filter_append</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.14 $ -->
|
||||
<!-- $Revision: 1.15 $ -->
|
||||
<refentry xml:id="function.stream-filter-register" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_filter_register</refname>
|
||||
<refpurpose>Register a stream filter implemented as a PHP class derived from <literal>php_user_filter</literal></refpurpose>
|
||||
<refpurpose>Register a user defined stream filter</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>stream_filter_register</methodname>
|
||||
<methodparam><type>string</type><parameter>filtername</parameter></methodparam>
|
||||
|
@ -18,139 +18,171 @@
|
|||
filesystem functions (such as <function>fopen</function>,
|
||||
<function>fread</function> etc.).
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
To implement a filter, you need to define a class as an extension of
|
||||
<literal>php_user_filter</literal> with a number of member functions
|
||||
as defined below. When performing read/write operations on the stream
|
||||
to which your filter is attached, PHP will pass the data through your
|
||||
filter (and any other filters attached to that stream) so that the
|
||||
data may be modified as desired. You must implement the methods
|
||||
exactly as described below - doing otherwise will lead to undefined
|
||||
behaviour.
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>filtername</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The filter name to be registered.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>classname</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
To implement a filter, you need to define a class as an extension of
|
||||
<literal>php_user_filter</literal> with a number of member functions
|
||||
as defined below. When performing read/write operations on the stream
|
||||
to which your filter is attached, PHP will pass the data through your
|
||||
filter (and any other filters attached to that stream) so that the
|
||||
data may be modified as desired. You must implement the methods
|
||||
exactly as described below - doing otherwise will lead to undefined
|
||||
behaviour.
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>filter</methodname>
|
||||
<methodparam><type>resource</type><parameter>in</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>out</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter role="reference">consumed</parameter></methodparam>
|
||||
<methodparam><type>bool</type><parameter>closing</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called whenever data is read from or written to
|
||||
the attached stream (such as with <function>fread</function> or <function>fwrite</function>).
|
||||
<parameter>in</parameter> is a resource pointing to a <literal>bucket brigade</literal>
|
||||
which contains one or more <literal>bucket</literal> objects containing data to be filtered.
|
||||
<parameter>out</parameter> is a resource pointing to a second <literal>bucket brigade</literal>
|
||||
into which your modified buckets should be placed.
|
||||
<parameter>consumed</parameter>, which must <emphasis>always</emphasis>
|
||||
be declared by reference, should be incremented by the length of the data
|
||||
which your filter reads in and alters. In most cases this means you will
|
||||
increment <parameter>consumed</parameter> by $bucket->datalen for each $bucket.
|
||||
If the stream is in the process of closing (and therefore this is the last pass
|
||||
through the filterchain), the <parameter>closing</parameter> parameter will be
|
||||
set to &true; The <methodname>filter</methodname> method must return one of
|
||||
three values upon completion.
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Return Value</entry>
|
||||
<entry>Meaning</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><constant>PSFS_PASS_ON</constant></entry>
|
||||
<entry>
|
||||
Filter processed successfully with data available in the
|
||||
<parameter>out</parameter> <literal>bucket brigade</literal>.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>PSFS_FEED_ME</constant></entry>
|
||||
<entry>
|
||||
Filter processed successfully, however no data was available to
|
||||
return. More data is required from the stream or prior filter.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>PSFS_ERR_FATAL</constant> (default)</entry>
|
||||
<entry>
|
||||
The filter experienced an unrecoverable error and cannot continue.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>onCreate</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<simpara>
|
||||
This method is called during instantiation of the filter class
|
||||
object. If your filter allocates or initializes any other resources
|
||||
(such as a buffer), this is the place to do it. Your implementation of
|
||||
this method should return &false; on failure, or &true; on success.
|
||||
</simpara>
|
||||
<simpara>
|
||||
When your filter is first instantiated, and
|
||||
<literal>yourfilter->onCreate()</literal> is called, a number of properties
|
||||
will be available as shown in the table below.
|
||||
</simpara>
|
||||
<para>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Property</entry>
|
||||
<entry>Contents</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><literal>FilterClass->filtername</literal></entry>
|
||||
<entry>
|
||||
A string containing the name the filter was instantiated with.
|
||||
Filters may be registered under multiple names or under wildcards.
|
||||
Use this property to determine which name was used.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>FilterClass->params</literal></entry>
|
||||
<entry>
|
||||
The contents of the <parameter>params</parameter> parameter passed
|
||||
to <function>stream_filter_append</function>
|
||||
or <function>stream_filter_prepend</function>.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>onClose</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called upon filter shutdown (typically, this is also
|
||||
during stream shutdown), and is executed <emphasis>after</emphasis>
|
||||
the <literal>flush</literal> method is called. If any resources
|
||||
were allocated or initialzed during <literal>onCreate</literal>
|
||||
this would be the time to destroy or dispose of them.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
<para>
|
||||
<function>stream_filter_register</function> will return &false; if the
|
||||
<parameter>filtername</parameter> is already defined.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>filter</methodname>
|
||||
<methodparam><type>resource</type><parameter>in</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>out</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter role="reference">consumed</parameter></methodparam>
|
||||
<methodparam><type>bool</type><parameter>closing</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
This method is called whenever data is read from or written to
|
||||
the attached stream (such as with <function>fread</function> or <function>fwrite</function>).
|
||||
<parameter>in</parameter> is a resource pointing to a <literal>bucket brigade</literal>
|
||||
which contains one or more <literal>bucket</literal> objects containing data to be filtered.
|
||||
<parameter>out</parameter> is a resource pointing to a second <literal>bucket brigade</literal>
|
||||
into which your modified buckets should be placed.
|
||||
<parameter>consumed</parameter>, which must <emphasis>always</emphasis>
|
||||
be declared by reference, should be incremented by the length of the data
|
||||
which your filter reads in and alters. In most cases this means you will
|
||||
increment <parameter>consumed</parameter> by $bucket->datalen for each $bucket.
|
||||
If the stream is in the process of closing (and therefore this is the last pass
|
||||
through the filterchain), the <parameter>closing</parameter> parameter will be
|
||||
set to &true; The <methodname>filter</methodname> method must return one of
|
||||
three values upon completion.
|
||||
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Return Value</entry>
|
||||
<entry>Meaning</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><constant>PSFS_PASS_ON</constant></entry>
|
||||
<entry>
|
||||
Filter processed successfully with data available in the
|
||||
<parameter>out</parameter> <literal>bucket brigade</literal>.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>PSFS_FEED_ME</constant></entry>
|
||||
<entry>
|
||||
Filter processed successfully, however no data was available to
|
||||
return. More data is required from the stream or prior filter.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>PSFS_ERR_FATAL</constant> (default)</entry>
|
||||
<entry>
|
||||
The filter experienced an unrecoverable error and cannot continue.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>onCreate</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<simpara>
|
||||
This method is called during instantiation of the filter class
|
||||
object. If your filter allocates or initializes any other resources
|
||||
(such as a buffer), this is the place to do it. Your implementation of
|
||||
this method should return &false; on failure, or &true; on success.
|
||||
</simpara>
|
||||
<simpara>
|
||||
When your filter is first instantiated, and
|
||||
<literal>yourfilter->onCreate()</literal> is called, a number of properties
|
||||
will be available as shown in the table below.
|
||||
</simpara>
|
||||
<para>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Property</entry>
|
||||
<entry>Contents</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><literal>FilterClass->filtername</literal></entry>
|
||||
<entry>A string containing the name the filter was instantiated with.
|
||||
Filters may be registered under multiple names or under wildcards.
|
||||
Use this property to determine which name was used.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>FilterClass->params</literal></entry>
|
||||
<entry>The contents of the <parameter>params</parameter> parameter passed
|
||||
to <function>stream_filter_append</function>
|
||||
or <function>stream_filter_prepend</function>.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>onClose</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called upon filter shutdown (typically, this is also
|
||||
during stream shutdown), and is executed <emphasis>after</emphasis>
|
||||
the <literal>flush</literal> method is called. If any resources
|
||||
were allocated or initialzed during <literal>onCreate</literal>
|
||||
this would be the time to destroy or dispose of them.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The example below implements a filter named <literal>strtoupper</literal>
|
||||
on the <literal>foo-bar.txt</literal> stream which will capitalize
|
||||
all letter characters written to/read from that stream.
|
||||
|
||||
<example>
|
||||
<title>Filter for capitalizing characters on foo-bar.txt stream</title>
|
||||
<para>
|
||||
The example below implements a filter named <literal>strtoupper</literal>
|
||||
on the <literal>foo-bar.txt</literal> stream which will capitalize
|
||||
all letter characters written to/read from that stream.
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
@ -274,13 +306,17 @@ EASY AS 123
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<simpara>
|
||||
See also
|
||||
<function>stream_wrapper_register</function>,
|
||||
<function>stream_filter_prepend</function>, and
|
||||
<function>stream_filter_append</function>.
|
||||
</simpara>
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>stream_wrapper_register</function></member>
|
||||
<member><function>stream_filter_append</function></member>
|
||||
<member><function>stream_filter_prepend</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,23 +1,50 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry xml:id="function.stream-filter-remove" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_filter_remove</refname>
|
||||
<refpurpose>Remove a filter from a stream</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>stream_filter_remove</methodname>
|
||||
<methodparam><type>resource</type><parameter>stream_filter</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<simpara>
|
||||
Removes a stream filter previously added to a stream
|
||||
with <function>stream_filter_prepend</function> or
|
||||
<function>stream_filter_append</function>. Any data
|
||||
remaining in the filter's internal buffer will be flushed
|
||||
through to the next filter before removing it.
|
||||
</simpara>
|
||||
<para>
|
||||
Removes a stream filter previously added to a stream with
|
||||
<function>stream_filter_prepend</function> or
|
||||
<function>stream_filter_append</function>. Any data remaining in the
|
||||
filter's internal buffer will be flushed through to the next filter before
|
||||
removing it.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>stream_filter</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The stream filter to be removed.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Dynamicly refiltering a stream</title>
|
||||
|
@ -36,23 +63,29 @@ rewind($fp);
|
|||
fpassthru($fp);
|
||||
fclose($fp);
|
||||
|
||||
/* Expected Output
|
||||
---------------
|
||||
|
||||
Guvf vf a test
|
||||
|
||||
*/
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Guvf vf a test
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>stream_filter_register</function></member>
|
||||
<member><function>stream_filter_append</function></member>
|
||||
<member><function>stream_filter_prepend</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
<simpara>
|
||||
See also
|
||||
<function>stream_filter_register</function>,
|
||||
<function>stream_filter_append</function>, and
|
||||
<function>stream_filter_prepend</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry xml:id="function.stream-get-contents" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_get_contents</refname>
|
||||
<refpurpose>Reads remainder of a stream into a string</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>stream_get_contents</methodname>
|
||||
<methodparam><type>resource</type><parameter>handle</parameter></methodparam>
|
||||
|
@ -47,7 +47,7 @@
|
|||
<term><parameter>offset</parameter> (<type>integer</type>)</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Seek to the specified offset before reading. Added in PHP 5.1.0.
|
||||
Seek to the specified offset before reading.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -62,6 +62,30 @@
|
|||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="changelog">
|
||||
&reftitle.changelog;
|
||||
<para>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>&Version;</entry>
|
||||
<entry>&Description;</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>5.1.0</entry>
|
||||
<entry>
|
||||
The <parameter>offset</parameter> was added.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
|
@ -93,6 +117,11 @@ if ($stream = fopen('http://www.example.net', 'r')) {
|
|||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.bin-safe;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
@ -102,7 +131,6 @@ if ($stream = fopen('http://www.example.net', 'r')) {
|
|||
<member><function>fpassthru</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
¬e.bin-safe;
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,20 +1,31 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry xml:id="function.stream-get-filters" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_get_filters</refname>
|
||||
<refpurpose>Retrieve list of registered filters</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>stream_get_filters</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<simpara>
|
||||
Returns an indexed array containing the name of all stream filters
|
||||
available on the running system.
|
||||
Retrieve the list of registered filters on the running system.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns an indexed array containing the name of all stream filters
|
||||
available.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Using <function>stream_get_filters</function></title>
|
||||
|
@ -26,10 +37,7 @@ print_r($streamlist);
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Output will be similar to the following.
|
||||
Note: there may be more or fewer filters in your version of PHP.
|
||||
</para>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array (
|
||||
|
@ -43,12 +51,16 @@ Array (
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also
|
||||
<function>stream_filter_register</function>, and
|
||||
<function>stream_get_wrappers</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>stream_filter_register</function></member>
|
||||
<member><function>stream_get_wrappers</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,40 +1,86 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<refentry xml:id="function.stream-get-line" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_get_line</refname>
|
||||
<refpurpose>Gets line from stream resource up to a given delimiter</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>stream_get_line</methodname>
|
||||
<methodparam><type>resource</type><parameter>handle</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>length</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>ending</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Gets a line from the given handle.
|
||||
</para>
|
||||
<para>
|
||||
Reading ends when <parameter>length</parameter> bytes have been read, when
|
||||
the string specified by <parameter>ending</parameter> is found (which is
|
||||
<emphasis>not</emphasis> included in the return value), or on EOF
|
||||
(whichever comes first).
|
||||
</para>
|
||||
<para>
|
||||
This function is nearly identical to <function>fgets</function> except in
|
||||
that it allows end of line delimiters other than the standard \n, \r, and
|
||||
\r\n, and does <emphasis>not</emphasis> return the delimiter itself.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>handle</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
A valid file handle.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>length</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The number of bytes to read from the handle.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>ending</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
An optional string delimiter.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a string of up to <parameter>length</parameter> bytes read from the file
|
||||
pointed to by <parameter>handle</parameter>. Reading ends when
|
||||
<parameter>length</parameter> bytes have been read, when the string specified by
|
||||
<parameter>ending</parameter> is found (which is <emphasis>not</emphasis> included
|
||||
in the return value), or on EOF (whichever comes first).
|
||||
pointed to by <parameter>handle</parameter>.
|
||||
</para>
|
||||
<para>
|
||||
If an error occurs, returns &false;.
|
||||
</para>
|
||||
<simpara>
|
||||
This function is nearly identical to <function>fgets</function>
|
||||
except in that it allows end of line delimiters other than the
|
||||
standard \n, \r, and \r\n, and does <emphasis>not</emphasis>
|
||||
return the delimiter itself.
|
||||
</simpara>
|
||||
<para>
|
||||
See also <function>fread</function>,
|
||||
<function>fgets</function>, and
|
||||
<function>fgetc</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>fread</function></member>
|
||||
<member><function>fgets</function></member>
|
||||
<member><function>fgetc</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,48 +1,69 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<refentry xml:id="function.stream-get-meta-data" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_get_meta_data</refname>
|
||||
<refpurpose>Retrieves header/meta data from streams/file pointers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>stream_get_meta_data</methodname>
|
||||
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<simpara>
|
||||
<para>
|
||||
Returns information about an existing <parameter>stream</parameter>.
|
||||
The stream can be any stream created by <function>fopen</function>,
|
||||
<function>fsockopen</function> and <function>pfsockopen</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>stream</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The stream can be any stream created by <function>fopen</function>,
|
||||
<function>fsockopen</function> and <function>pfsockopen</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
The result array contains the following items:
|
||||
</simpara>
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<parameter>timed_out</parameter> (bool) - &true; if the stream
|
||||
<literal>timed_out</literal> (bool) - &true; if the stream
|
||||
timed out while waiting for data on the last call to
|
||||
<function>fread</function> or <function>fgets</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<parameter>blocked</parameter> (bool) - &true; if the stream is
|
||||
<literal>blocked</literal> (bool) - &true; if the stream is
|
||||
in blocking IO mode. See <function>stream_set_blocking</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<parameter>eof</parameter> (bool) - &true; if the stream has reached
|
||||
<literal>eof</literal> (bool) - &true; if the stream has reached
|
||||
end-of-file. Note that for socket streams this member can be &true;
|
||||
even when <parameter>unread_bytes</parameter> is non-zero. To
|
||||
even when <literal>unread_bytes</literal> is non-zero. To
|
||||
determine if there is more data to be read, use
|
||||
<function>feof</function> instead of reading this item.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<parameter>unread_bytes</parameter> (int) - the number of bytes
|
||||
<literal>unread_bytes</literal> (int) - the number of bytes
|
||||
currently contained in the PHP's own internal buffer.
|
||||
</para>
|
||||
<note>
|
||||
|
@ -51,81 +72,107 @@
|
|||
</simpara>
|
||||
</note>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<simpara>
|
||||
The following items were added in PHP 4.3.0:
|
||||
</simpara>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<parameter>stream_type</parameter> (string) - a label describing
|
||||
<literal>stream_type</literal> (string) - a label describing
|
||||
the underlying implementation of the stream.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<parameter>wrapper_type</parameter> (string) - a label describing
|
||||
<literal>wrapper_type</literal> (string) - a label describing
|
||||
the protocol wrapper implementation layered over the stream.
|
||||
See <xref linkend="wrappers"/> for more information about wrappers.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<parameter>wrapper_data</parameter> (mixed) - wrapper specific
|
||||
<literal>wrapper_data</literal> (mixed) - wrapper specific
|
||||
data attached to this stream. See <xref linkend="wrappers"/> for
|
||||
more information about wrappers and their wrapper data.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<parameter>filters</parameter> (array) - and array containing
|
||||
<literal>filters</literal> (array) - and array containing
|
||||
the names of any filters that have been stacked onto this stream.
|
||||
Documentation on filters can be found in the
|
||||
<link linkend="filters">Filters appendix</link>.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<note>
|
||||
<para>
|
||||
This function was introduced in PHP 4.3.0, but prior to this version,
|
||||
<function>socket_get_status</function> could be used to retrieve
|
||||
the first four items, for <emphasis>socket based streams only</emphasis>.
|
||||
</para>
|
||||
<para>
|
||||
In PHP 4.3.0 and later,
|
||||
<function>socket_get_status</function> is an alias for this function.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<simpara>This function does NOT work on sockets created by the <link
|
||||
linkend="ref.sockets">Socket extension</link>.
|
||||
</simpara>
|
||||
</note>
|
||||
<simpara>
|
||||
The following items were added in PHP 5.0.0:
|
||||
</simpara>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<parameter>mode</parameter> (string) - the type of access required for
|
||||
<literal>mode</literal> (string) - the type of access required for
|
||||
this stream (see Table 1 of the <link
|
||||
linkend="function.fopen">fopen()</link> reference)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<parameter>seekable</parameter> (bool) - whether the current stream can
|
||||
<literal>seekable</literal> (bool) - whether the current stream can
|
||||
be seeked.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<parameter>uri</parameter> (string) - the URI/filename associated with this
|
||||
<literal>uri</literal> (string) - the URI/filename associated with this
|
||||
stream.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="changelog">
|
||||
&reftitle.changelog;
|
||||
<para>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>&Version;</entry>
|
||||
<entry>&Description;</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>5.0.0</entry>
|
||||
<entry>
|
||||
The following entries were added in the returned array:
|
||||
<literal>mode</literal>, <literal>seekable</literal>,
|
||||
and <literal>uri</literal>.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>4.3.0</entry>
|
||||
<entry>
|
||||
The following entries were added in the returned array:
|
||||
<literal>stream_type</literal>, <literal>wrapper_type</literal>,
|
||||
<literal>wrapper_data</literal>, and <literal>filters</literal>.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>4.3.0</entry>
|
||||
<entry>
|
||||
<function>socket_get_status</function> is an alias for this function.
|
||||
Prior to PHP 4.3.0, it was used to retrieve the first four items, for
|
||||
<emphasis>socket based streams only</emphasis>.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>This function does NOT work on sockets created by the <link
|
||||
linkend="ref.sockets">Socket extension</link>.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<refentry xml:id="function.stream-get-transports" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_get_transports</refname>
|
||||
<refpurpose>Retrieve list of registered socket transports</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>stream_get_transports</methodname>
|
||||
<void/>
|
||||
|
@ -15,6 +15,17 @@
|
|||
Returns an indexed array containing the name of all socket transports
|
||||
available on the running system.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns an indexed array of socket transports names.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Using <function>stream_get_transports</function></title>
|
||||
|
@ -26,10 +37,7 @@ print_r($xportlist);
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Output will be similar to the following.
|
||||
Note: there may be more or fewer transports in your version of PHP.
|
||||
</para>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array (
|
||||
|
@ -42,11 +50,14 @@ Array (
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also
|
||||
<function>stream_get_filters</function>, and
|
||||
<function>stream_get_wrappers</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>stream_get_filters</function></member>
|
||||
<member><function>stream_get_wrappers</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,20 +1,31 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<refentry xml:id="function.stream-get-wrappers" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_get_wrappers</refname>
|
||||
<refpurpose>Retrieve list of registered streams</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>stream_get_wrappers</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Retrieve list of registered streams available on the running system.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns an indexed array containing the name of all stream wrappers
|
||||
available on the running system.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>stream_get_wrappers</function> example</title>
|
||||
|
@ -58,10 +69,13 @@ if (in_array('compress.bzip2', stream_get_wrappers())) {
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also
|
||||
<function>stream_wrapper_register</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>stream_wrapper_register</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.16 $ -->
|
||||
<!-- $Revision: 1.17 $ -->
|
||||
<refentry xml:id="function.stream-select" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_select</refname>
|
||||
<refpurpose>Runs the equivalent of the select() system call on the given
|
||||
arrays of streams with a timeout specified by tv_sec and tv_usec </refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>stream_select</methodname>
|
||||
<methodparam><type>array</type><parameter role="reference">read</parameter></methodparam>
|
||||
|
@ -16,89 +16,138 @@
|
|||
<methodparam><type>int</type><parameter>tv_sec</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>tv_usec</parameter><initializer>0</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<simpara>
|
||||
<para>
|
||||
The <function>stream_select</function> function accepts arrays of streams and
|
||||
waits for them to change status. Its operation is equivalent to that of
|
||||
the <function>socket_select</function> function except in that it acts on streams.
|
||||
</simpara>
|
||||
<simpara>
|
||||
The streams listed in the <parameter>read</parameter> array will be watched to
|
||||
see if characters become available for reading (more precisely, to see if
|
||||
a read will not block - in particular, a stream resource is also ready on
|
||||
end-of-file, in which case an <function>fread</function> will return
|
||||
a zero length string).
|
||||
</simpara>
|
||||
<simpara>
|
||||
The streams listed in the <parameter>write</parameter> array will be
|
||||
watched to see if a write will not block.
|
||||
</simpara>
|
||||
<simpara>
|
||||
The streams listed in the <parameter>except</parameter> array will be
|
||||
watched for high priority exceptional ("out-of-band") data arriving.
|
||||
</simpara>
|
||||
<note>
|
||||
<para>
|
||||
When <function>stream_select</function> returns, the arrays
|
||||
<parameter>read</parameter>, <parameter>write</parameter> and
|
||||
<parameter>except</parameter> are modified to indicate which stream
|
||||
resource(s) actually changed status.
|
||||
</para>
|
||||
</note>
|
||||
<simpara>
|
||||
The <parameter>tv_sec</parameter> and <parameter>tv_usec</parameter>
|
||||
together form the <emphasis>timeout</emphasis> parameter,
|
||||
<parameter>tv_sec</parameter> specifies the number of seconds while
|
||||
<parameter>tv_usec</parameter> the number of microseconds.
|
||||
The <emphasis>timeout</emphasis> is an upper bound on the amount of time
|
||||
that <function>stream_select</function> will wait before it returns.
|
||||
If <parameter>tv_sec</parameter> and <parameter>tv_usec</parameter> are
|
||||
both set to <literal>0</literal>, <function>stream_select</function> will
|
||||
not wait for data - instead it will return immediately, indicating the
|
||||
current status of the streams.
|
||||
If <parameter>tv_sec</parameter> is &null; <function>stream_select</function>
|
||||
can block indefinitely, returning only when an event on one of the
|
||||
watched streams occurs (or if a signal interrupts the system call).
|
||||
</simpara>
|
||||
<simpara>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>read</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The streams listed in the <parameter>read</parameter> array will be watched to
|
||||
see if characters become available for reading (more precisely, to see if
|
||||
a read will not block - in particular, a stream resource is also ready on
|
||||
end-of-file, in which case an <function>fread</function> will return
|
||||
a zero length string).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>write</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The streams listed in the <parameter>write</parameter> array will be
|
||||
watched to see if a write will not block.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>except</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The streams listed in the <parameter>except</parameter> array will be
|
||||
watched for high priority exceptional ("out-of-band") data arriving.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
When <function>stream_select</function> returns, the arrays
|
||||
<parameter>read</parameter>, <parameter>write</parameter> and
|
||||
<parameter>except</parameter> are modified to indicate which stream
|
||||
resource(s) actually changed status.
|
||||
</para>
|
||||
</note>
|
||||
<simpara>
|
||||
You do not need to pass every array to
|
||||
<function>stream_select</function>. You can leave it out and use an
|
||||
empty array or &null; instead. Also do not forget that those arrays are
|
||||
passed <emphasis>by reference</emphasis> and will be modified after
|
||||
<function>stream_select</function> returns.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>tv_sec</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The <parameter>tv_sec</parameter> and <parameter>tv_usec</parameter>
|
||||
together form the <emphasis>timeout</emphasis> parameter,
|
||||
<parameter>tv_sec</parameter> specifies the number of seconds while
|
||||
<parameter>tv_usec</parameter> the number of microseconds.
|
||||
The <emphasis>timeout</emphasis> is an upper bound on the amount of time
|
||||
that <function>stream_select</function> will wait before it returns.
|
||||
If <parameter>tv_sec</parameter> and <parameter>tv_usec</parameter> are
|
||||
both set to <literal>0</literal>, <function>stream_select</function> will
|
||||
not wait for data - instead it will return immediately, indicating the
|
||||
current status of the streams.
|
||||
</para>
|
||||
<para>
|
||||
If <parameter>tv_sec</parameter> is &null; <function>stream_select</function>
|
||||
can block indefinitely, returning only when an event on one of the
|
||||
watched streams occurs (or if a signal interrupts the system call).
|
||||
</para>
|
||||
<warning>
|
||||
<para>
|
||||
Using a timeout value of <literal>0</literal> allows you to
|
||||
instantaneously poll the status of the streams, however, it is NOT a
|
||||
good idea to use a <literal>0</literal> timeout value in a loop as it
|
||||
will cause your script to consume too much CPU time.
|
||||
</para>
|
||||
<para>
|
||||
It is much better to specify a timeout value of a few seconds, although
|
||||
if you need to be checking and running other code concurrently, using a
|
||||
timeout value of at least <literal>200000</literal> microseconds will
|
||||
help reduce the CPU usage of your script.
|
||||
</para>
|
||||
<para>
|
||||
Remember that the timeout value is the maximum time that will elapse;
|
||||
<function>stream_select</function> will return as soon as the
|
||||
requested streams are ready for use.
|
||||
</para>
|
||||
</warning>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>tv_usec</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
See <parameter>tv_sec</parameter> description.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
On success <function>stream_select</function> returns the number of
|
||||
stream resources contained in the modified arrays, which may be zero if
|
||||
the timeout expires before anything interesting happens. On error &false;
|
||||
is returned and a warning raised (this can happen if the system call is
|
||||
interrupted by an incoming signal).
|
||||
</simpara>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<warning>
|
||||
<para>
|
||||
Using a timeout value of <literal>0</literal> allows you to
|
||||
instantaneously poll the status of the streams, however, it is NOT a
|
||||
good idea to use a <literal>0</literal> timeout value in a loop as it
|
||||
will cause your script to consume too much CPU time.
|
||||
</para>
|
||||
<para>
|
||||
It is much better to specify a timeout value of a few seconds, although
|
||||
if you need to be checking and running other code concurrently, using a
|
||||
timeout value of at least <literal>200000</literal> microseconds will
|
||||
help reduce the CPU usage of your script.
|
||||
</para>
|
||||
<para>
|
||||
Remember that the timeout value is the
|
||||
maximum time that will elapse; <function>stream_select</function> will
|
||||
return as soon as the requested streams are ready for use.
|
||||
</para>
|
||||
</warning>
|
||||
<simpara>
|
||||
You do not need to pass every array to
|
||||
<function>stream_select</function>. You can leave it out and use an
|
||||
empty array or &null; instead. Also do not forget that those arrays are
|
||||
passed <emphasis>by reference</emphasis> and will be modified after
|
||||
<function>stream_select</function> returns.
|
||||
</simpara>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
This example checks to see if data has arrived for reading on either
|
||||
<parameter>$stream1</parameter> or <parameter>$stream2</parameter>.
|
||||
Since the timeout value is <literal>0</literal> it will return
|
||||
immediately:
|
||||
<programlisting role="php">
|
||||
<example>
|
||||
<title><function>stream_select</function> Example</title>
|
||||
<para>
|
||||
This example checks to see if data has arrived for reading on either
|
||||
<parameter>$stream1</parameter> or <parameter>$stream2</parameter>.
|
||||
Since the timeout value is <literal>0</literal> it will return
|
||||
immediately:
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Prepare the read array */
|
||||
|
@ -112,8 +161,13 @@ if (false === ($num_changed_streams = stream_select($read, $write, $except, 0)))
|
|||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
Due to a limitation in the current Zend Engine it is not possible to pass a
|
||||
|
@ -168,10 +222,13 @@ if (false === stream_select($r, $w, $e, 0)) {
|
|||
and return &false; under Windows.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
See also
|
||||
<function>stream_set_blocking</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>stream_set_blocking</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,47 +1,105 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- splitted from ./en/functions/network.xml, last change in rev 1.2 -->
|
||||
<refentry xml:id="function.stream-set-blocking" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_set_blocking</refname>
|
||||
<refpurpose>Set blocking/non-blocking mode on a stream</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>stream_set_blocking</methodname>
|
||||
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>mode</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
If <parameter>mode</parameter> is 0, the given stream
|
||||
will be switched to non-blocking mode, and if 1, it
|
||||
will be switched to blocking mode. This affects calls like
|
||||
<function>fgets</function> and <function>fread</function>
|
||||
that read from the stream. In non-blocking mode an
|
||||
<function>fgets</function> call will always return right away
|
||||
while in blocking mode it will wait for data to become available
|
||||
on the stream.
|
||||
Sets blocking or non-blocking mode on a <parameter>stream</parameter>.
|
||||
</para>
|
||||
<para>
|
||||
This function works for any stream that supports non-blocking mode
|
||||
(currently, regular files and socket streams).
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>stream</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The stream.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>mode</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
If <parameter>mode</parameter> is 0, the given stream
|
||||
will be switched to non-blocking mode, and if 1, it
|
||||
will be switched to blocking mode. This affects calls like
|
||||
<function>fgets</function> and <function>fread</function>
|
||||
that read from the stream. In non-blocking mode an
|
||||
<function>fgets</function> call will always return right away
|
||||
while in blocking mode it will wait for data to become available
|
||||
on the stream.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="changelog">
|
||||
&reftitle.changelog;
|
||||
<para>
|
||||
This function was previously called as
|
||||
<function>set_socket_blocking</function> and later
|
||||
<function>socket_set_blocking</function> but this usage is deprecated.
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>&Version;</entry>
|
||||
<entry>&Description;</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>4.3.0</entry>
|
||||
<entry>
|
||||
Prior to PHP 4.3.0, this function only worked on socket based streams.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<simpara>
|
||||
Prior to PHP 4.3, this function only worked on socket based streams.
|
||||
Since PHP 4.3, this function works for any stream that supports
|
||||
non-blocking mode (currently, regular files and socket streams).
|
||||
</simpara>
|
||||
<para>
|
||||
This function was previously called as
|
||||
<function>set_socket_blocking</function> and later
|
||||
<function>socket_set_blocking</function> but this usage is deprecated.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
See also
|
||||
<function>stream_select</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>stream_select</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- $Revision: 1.13 $ -->
|
||||
<!-- splitted from ./en/functions/network.xml, last change in rev 1.18 -->
|
||||
<refentry xml:id="function.stream-set-timeout" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_set_timeout</refname>
|
||||
<refpurpose>Set timeout period on a stream</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>stream_set_timeout</methodname>
|
||||
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
|
||||
|
@ -17,13 +17,83 @@
|
|||
<para>
|
||||
Sets the timeout value on <parameter>stream</parameter>,
|
||||
expressed in the sum of <parameter>seconds</parameter> and
|
||||
<parameter>microseconds</parameter>. &return.success;
|
||||
<parameter>microseconds</parameter>.
|
||||
</para>
|
||||
<para>
|
||||
When the stream times out, the 'timed_out' key of the array returned by
|
||||
<function>stream_get_meta_data</function> is set to &true;, although no
|
||||
error/warning is generated.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>stream</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The target stream.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>seconds</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The seconds part of the timeout to be set.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>microseconds</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The microseconds part of the timeout to be set.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="changelog">
|
||||
&reftitle.changelog;
|
||||
<para>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>&Version;</entry>
|
||||
<entry>&Description;</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>4.3.0</entry>
|
||||
<entry>
|
||||
As of PHP 4.3, this function can (potentially) work on any kind of
|
||||
stream. In PHP 4.3, socket based streams are still the only kind
|
||||
supported in the PHP core, although streams from other extensions
|
||||
may support this function.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>stream_set_timeout</function> example</title>
|
||||
|
@ -54,14 +124,10 @@ if (!$fp) {
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<note>
|
||||
<simpara>
|
||||
As of PHP 4.3, this function can (potentially) work on any kind of
|
||||
stream. In PHP 4.3, socket based streams are still the only kind
|
||||
supported in the PHP core, although streams from other extensions
|
||||
may support this function.
|
||||
</simpara>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
This function doesn't work with advanced operations like
|
||||
|
@ -74,11 +140,14 @@ if (!$fp) {
|
|||
<function>set_socket_timeout</function> and later
|
||||
<function>socket_set_timeout</function> but this usage is deprecated.
|
||||
</para>
|
||||
<para>
|
||||
See also
|
||||
<function>fsockopen</function> and
|
||||
<function>fopen</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>fsockopen</function></member>
|
||||
<member><function>fopen</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,40 +1,73 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 -->
|
||||
<refentry xml:id="function.stream-set-write-buffer" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_set_write_buffer</refname>
|
||||
<refpurpose>Sets file buffering on the given stream</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>stream_set_write_buffer</methodname>
|
||||
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>buffer</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Sets the buffering for write operations on the given <parameter>stream</parameter>
|
||||
to <parameter>buffer</parameter> bytes.
|
||||
</para>
|
||||
<simpara>
|
||||
Output using <function>fwrite</function> is normally buffered at
|
||||
8K. This means that if there are two processes wanting to write
|
||||
to the same output stream (a file), each is paused after 8K of
|
||||
data to allow the other to write.
|
||||
<function>stream_set_write_buffer</function>
|
||||
sets the buffering for write operations on the given filepointer
|
||||
<parameter>stream</parameter> to <parameter>buffer</parameter> bytes.
|
||||
If <parameter>buffer</parameter> is 0 then write operations are
|
||||
unbuffered. This ensures that all writes with
|
||||
<function>fwrite</function> are completed before other processes
|
||||
are allowed to write to that output stream.
|
||||
</simpara>
|
||||
<simpara>
|
||||
The function returns 0 on success, or EOF if the request cannot
|
||||
be honored.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>stream</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The file pointer.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>buffer</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The number of bytes to buffer. If <parameter>buffer</parameter>
|
||||
is 0 then write operations are unbuffered. This ensures that all writes
|
||||
with <function>fwrite</function> are completed before other processes are
|
||||
allowed to write to that output stream.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns 0 on success, or EOF if the request cannot be honored.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
The following example demonstrates how to use
|
||||
<function>stream_set_write_buffer</function> to create an unbuffered stream.
|
||||
<example>
|
||||
<title><function>stream_set_write_buffer</function> example</title>
|
||||
<para>
|
||||
The following example demonstrates how to use
|
||||
<function>stream_set_write_buffer</function> to create an unbuffered stream.
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
@ -49,13 +82,16 @@ if ($fp) {
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
|
||||
<simpara>
|
||||
See also
|
||||
<function>fopen</function> and
|
||||
<function>fwrite</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>fopen</function></member>
|
||||
<member><function>fwrite</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<refentry xml:id="function.stream-socket-recvfrom" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_socket_recvfrom</refname>
|
||||
<refpurpose>Receives data from a socket, connected or not </refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>stream_socket_recvfrom</methodname>
|
||||
<methodparam><type>resource</type><parameter>socket</parameter></methodparam>
|
||||
|
@ -17,38 +17,86 @@
|
|||
<para>
|
||||
<function>stream_socket_recvfrom</function> accepts
|
||||
data from a remote socket up to <parameter>length</parameter> bytes.
|
||||
If <parameter>address</parameter> is provided it will be populated with
|
||||
the address of the remote socket.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
The value of <parameter>flags</parameter> can be any combination
|
||||
of the following:
|
||||
<table>
|
||||
<title>Possible values for <parameter>flags</parameter></title>
|
||||
<tgroup cols="2">
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><constant>STREAM_OOB</constant></entry>
|
||||
<entry>
|
||||
Process OOB (<literal>out-of-band</literal>) data.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>STREAM_PEEK</constant></entry>
|
||||
<entry>
|
||||
Retrieve data from the socket, but do not consume the buffer.
|
||||
Subsequent calls to <function>fread</function> or
|
||||
<function>stream_socket_recvfrom</function> will see
|
||||
the same data.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>socket</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The remote socket.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>length</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The number of bytes to receive from the <parameter>socket</parameter>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>flags</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The value of <parameter>flags</parameter> can be any combination
|
||||
of the following:
|
||||
<table>
|
||||
<title>Possible values for <parameter>flags</parameter></title>
|
||||
<tgroup cols="2">
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><constant>STREAM_OOB</constant></entry>
|
||||
<entry>
|
||||
Process OOB (<literal>out-of-band</literal>) data.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>STREAM_PEEK</constant></entry>
|
||||
<entry>
|
||||
Retrieve data from the socket, but do not consume the buffer.
|
||||
Subsequent calls to <function>fread</function> or
|
||||
<function>stream_socket_recvfrom</function> will see
|
||||
the same data.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>address</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
If <parameter>address</parameter> is provided it will be populated with
|
||||
the address of the remote socket.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
<example>
|
||||
<title><function>stream_socket_recvfrom</function> example</title>
|
||||
<programlisting role="php">
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the read data, as a string
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>stream_socket_recvfrom</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Open a server socket to port 1234 on localhost */
|
||||
|
@ -71,8 +119,13 @@ fclose($socket);
|
|||
fclose($server);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
If a message received is longer than the <parameter>length</parameter>
|
||||
|
@ -88,13 +141,17 @@ fclose($server);
|
|||
data directly from the socket and bypass the stream buffer.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
See also
|
||||
<function>stream_socket_sendto</function>,
|
||||
<function>stream_socket_client</function>, and
|
||||
<function>stream_socket_server</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>stream_socket_sendto</function></member>
|
||||
<member><function>stream_socket_client</function></member>
|
||||
<member><function>stream_socket_server</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<refentry xml:id="function.stream-socket-sendto" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_socket_sendto</refname>
|
||||
<refpurpose>Sends a message to a socket, whether it is connected or not </refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>stream_socket_sendto</methodname>
|
||||
<methodparam><type>resource</type><parameter>socket</parameter></methodparam>
|
||||
|
@ -15,32 +15,82 @@
|
|||
<methodparam choice="opt"><type>string</type><parameter>address</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
The function <function>stream_socket_sendto</function> sends
|
||||
the data specified by <parameter>data</parameter> through the
|
||||
socket specified by <parameter>socket</parameter>. The address
|
||||
specified when the socket stream was created will be used unless
|
||||
an alternate address is specified in <parameter>address</parameter>.
|
||||
Sends the specified <parameter>data</parameter> through the
|
||||
<parameter>socket</parameter>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
The value of <parameter>flags</parameter> can be any combination
|
||||
of the following:
|
||||
<table>
|
||||
<title>possible values for <parameter>flags</parameter></title>
|
||||
<tgroup cols="2">
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><constant>STREAM_OOB</constant></entry>
|
||||
<entry>
|
||||
Process OOB (out-of-band) data.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>socket</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The socket to send <parameter>data</parameter> to.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>data</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The data to be sent.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>flags</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The value of <parameter>flags</parameter> can be any combination
|
||||
of the following:
|
||||
<table>
|
||||
<title>possible values for <parameter>flags</parameter></title>
|
||||
<tgroup cols="2">
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><constant>STREAM_OOB</constant></entry>
|
||||
<entry>
|
||||
Process OOB (out-of-band) data.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>address</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The address specified when the socket stream was created will be used
|
||||
unless an alternate address is specified in <parameter>address</parameter>.
|
||||
</para>
|
||||
<para>
|
||||
If specified, it must be in dotted quad (or [ipv6]) format.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
<example>
|
||||
<title><function>stream_socket_sendto</function> Example</title>
|
||||
<programlisting role="php">
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a result code, as an integer.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>stream_socket_sendto</function> Example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Open a socket to port 1234 on localhost */
|
||||
|
@ -56,15 +106,19 @@ stream_socket_sendto($socket, "Out of Band data.", STREAM_OOB);
|
|||
fclose($socket);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<function>stream_socket_recvfrom</function>,
|
||||
<function>stream_socket_client</function>, and
|
||||
<function>stream_socket_server</function>.
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>stream_socket_recvfrom</function></member>
|
||||
<member><function>stream_socket_client</function></member>
|
||||
<member><function>stream_socket_server</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.20 $ -->
|
||||
<!-- $Revision: 1.21 $ -->
|
||||
<refentry xml:id="function.stream-socket-server" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_socket_server</refname>
|
||||
<refpurpose>Create an Internet or Unix domain server socket</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>stream_socket_server</methodname>
|
||||
<methodparam><type>string</type><parameter>local_socket</parameter></methodparam>
|
||||
|
@ -17,50 +17,102 @@
|
|||
</methodsynopsis>
|
||||
<para>
|
||||
Creates a stream or datagram socket on the specified
|
||||
<parameter>local_socket</parameter>. The type of socket created
|
||||
is determined by the transport specified using standard URL formatting:
|
||||
<literal>transport://target</literal>. For Internet Domain sockets
|
||||
(AF_INET) such as TCP and UDP, the <literal>target</literal> portion
|
||||
of the <parameter>remote_socket</parameter> parameter should consist of
|
||||
a hostname or IP address followed by a colon and a port number. For Unix
|
||||
domain sockets, the <parameter>target</parameter> portion should point
|
||||
to the socket file on the filesystem.
|
||||
|
||||
<parameter>flags</parameter> is a bitmask field which may be set to any
|
||||
combination of socket creation flags. The default value of flags is
|
||||
<constant>STREAM_SERVER_BIND</constant> | <constant>STREAM_SERVER_LISTEN</constant>.
|
||||
<parameter>local_socket</parameter>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
For UDP sockets, you must use <constant>STREAM_SERVER_BIND</constant> as
|
||||
the <parameter>flags</parameter> parameter.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
This function only creates a socket, to begin accepting connections
|
||||
use <function>stream_socket_accept</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
If the call fails, it will return &false; and if the optional
|
||||
<parameter>errno</parameter> and <parameter>errstr</parameter>
|
||||
arguments are present they will be set to indicate the actual
|
||||
system level error that occurred in the system-level
|
||||
<literal>socket()</literal>, <literal>bind()</literal>, and
|
||||
<literal>listen()</literal> calls. If the value returned in
|
||||
<parameter>errno</parameter> is <literal>0</literal> and the
|
||||
function returned &false;, it is an indication that the error
|
||||
occurred before the <literal>bind()</literal> call. This is
|
||||
most likely due to a problem initializing the socket. Note that
|
||||
the <parameter>errno</parameter> and
|
||||
<parameter>errstr</parameter> arguments will always be passed by
|
||||
reference.
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>local_socket</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The type of socket created is determined by the transport specified
|
||||
using standard URL formatting: <literal>transport://target</literal>.
|
||||
</para>
|
||||
<para>
|
||||
For Internet Domain sockets (AF_INET) such as TCP and UDP, the
|
||||
<literal>target</literal> portion of the
|
||||
<parameter>remote_socket</parameter> parameter should consist of a
|
||||
hostname or IP address followed by a colon and a port number. For
|
||||
Unix domain sockets, the <literal>target</literal> portion should
|
||||
point to the socket file on the filesystem.
|
||||
</para>
|
||||
<para>
|
||||
Depending on the environment, Unix domain sockets may not be available.
|
||||
A list of available transports can be retrieved using
|
||||
<function>stream_get_transports</function>. See
|
||||
<xref linkend="transports"/> for a list of bulitin transports.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>errno</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
If the optional <parameter>errno</parameter> and <parameter>errstr</parameter>
|
||||
arguments are present they will be set to indicate the actual system
|
||||
level error that occurred in the system-level <literal>socket()</literal>,
|
||||
<literal>bind()</literal>, and <literal>listen()</literal> calls. If
|
||||
the value returned in <parameter>errno</parameter> is
|
||||
<literal>0</literal> and the function returned &false;, it is an
|
||||
indication that the error occurred before the <literal>bind()</literal>
|
||||
call. This is most likely due to a problem initializing the socket.
|
||||
Note that the <parameter>errno</parameter> and
|
||||
<parameter>errstr</parameter> arguments will always be passed by reference.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>errstr</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
See <parameter>errno</parameter> description.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>flags</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
A bitmask field which may be set to any combination of socket creation
|
||||
flags. The default value of flags is <constant>STREAM_SERVER_BIND</constant>
|
||||
| <constant>STREAM_SERVER_LISTEN</constant>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
For UDP sockets, you must use <constant>STREAM_SERVER_BIND</constant> as
|
||||
the <parameter>flags</parameter> parameter.
|
||||
</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>context</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Depending on the environment, Unix domain sockets may not be available.
|
||||
A list of available transports can be retrieved using
|
||||
<function>stream_get_transports</function>. See
|
||||
<xref linkend="transports"/> for a list of bulitin transports.
|
||||
Returns the created stream, or &false; on error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Using TCP server sockets</title>
|
||||
|
@ -113,16 +165,26 @@ do {
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
&ipv6.brackets;
|
||||
<para>
|
||||
See also <function>stream_socket_client</function>,
|
||||
<function>stream_set_blocking</function>,
|
||||
<function>stream_set_timeout</function>,
|
||||
<function>fgets</function>,
|
||||
<function>fgetss</function>, <function>fwrite</function>,
|
||||
<function>fclose</function>, <function>feof</function>, and
|
||||
the <link linkend="ref.curl">Curl extension</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>stream_socket_client</function></member>
|
||||
<member><function>stream_set_blocking</function></member>
|
||||
<member><function>stream_set_timeout</function></member>
|
||||
<member><function>fgets</function></member>
|
||||
<member><function>fgetss</function></member>
|
||||
<member><function>fwrite</function></member>
|
||||
<member><function>fclose</function></member>
|
||||
<member><function>feof</function></member>
|
||||
<member><link linkend="ref.curl">Curl extension</link></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,459 +1,483 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.16 $ -->
|
||||
<!-- $Revision: 1.17 $ -->
|
||||
<refentry xml:id="function.stream-wrapper-register" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>stream_wrapper_register</refname>
|
||||
<refpurpose>Register a URL wrapper implemented as a PHP class</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>stream_wrapper_register</methodname>
|
||||
<methodparam><type>string</type><parameter>protocol</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>classname</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>stream_wrapper_register</function> allows you to implement
|
||||
your own protocol handlers and streams for use with all the other
|
||||
filesystem functions (such as <function>fopen</function>,
|
||||
Allows you to implement your own protocol handlers and streams for use
|
||||
with all the other filesystem functions (such as <function>fopen</function>,
|
||||
<function>fread</function> etc.).
|
||||
</para>
|
||||
</refsect1><!-- }}} -->
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
To implement a wrapper, you need to define a class with a number of
|
||||
member functions, as defined below. When someone fopens your stream,
|
||||
PHP will create an instance of <parameter>classname</parameter> and
|
||||
then call methods on that instance. You must implement the methods
|
||||
exactly as described below - doing otherwise will lead to undefined
|
||||
behaviour.
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>protocol</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The wrapper name to be registered.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>classname</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
To implement a wrapper, you need to define a class with a number of
|
||||
member functions, as defined below. When someone fopens your stream,
|
||||
PHP will create an instance of <parameter>classname</parameter> and
|
||||
then call methods on that instance. You must implement the methods
|
||||
exactly as described below - doing otherwise will lead to undefined
|
||||
behaviour.
|
||||
</para>
|
||||
<para>
|
||||
The instance of <parameter>classname</parameter> will be populated
|
||||
with a <parameter>context</parameter> property referencing a
|
||||
<literal>Context Resource</literal> which may be accessed with
|
||||
<function>stream_context_get_options</function>.
|
||||
If no context was passed to the stream creation function,
|
||||
<parameter>context</parameter> will be set to &null;.
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>stream_open</methodname>
|
||||
<methodparam><type>string</type><parameter>path</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>mode</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>options</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>opened_path</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called immediately after your stream object is
|
||||
created. <parameter>path</parameter> specifies the URL that was
|
||||
passed to <function>fopen</function> and that this object is
|
||||
expected to retrieve. You can use <function>parse_url</function>
|
||||
to break it apart.
|
||||
</para>
|
||||
<para>
|
||||
<parameter>mode</parameter> is the mode used to open the file,
|
||||
as detailed for <function>fopen</function>. You are responsible
|
||||
for checking that <parameter>mode</parameter> is valid for the
|
||||
<parameter>path</parameter> requested.
|
||||
</para>
|
||||
<para>
|
||||
<parameter>options</parameter> holds additional flags set
|
||||
by the streams API. It can hold one or more of the following
|
||||
values OR'd together.
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Flag</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>STREAM_USE_PATH</entry>
|
||||
<entry>If <parameter>path</parameter> is relative, search
|
||||
for the resource using the include_path.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>STREAM_REPORT_ERRORS</entry>
|
||||
<entry>If this flag is set, you are responsible for raising
|
||||
errors using <function>trigger_error</function> during
|
||||
opening of the stream. If this flag is not set, you
|
||||
should not raise any errors.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
<para>
|
||||
If the <parameter>path</parameter> is opened successfully,
|
||||
and STREAM_USE_PATH is set in <parameter>options</parameter>,
|
||||
you should set <parameter>opened_path</parameter> to the full
|
||||
path of the file/resource that was actually opened.
|
||||
</para>
|
||||
<para>
|
||||
If the requested resource was opened successfully, you should
|
||||
return &true;, otherwise you should return &false;
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>stream_close</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called when the stream is closed, using
|
||||
<function>fclose</function>. You must release any resources
|
||||
that were locked or allocated by the stream.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>stream_read</methodname>
|
||||
<methodparam><type>int</type><parameter>count</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>fread</function>
|
||||
and <function>fgets</function> calls on the stream. You
|
||||
must return up-to <parameter>count</parameter> bytes of data
|
||||
from the current read/write position as a string.
|
||||
If there are less than <parameter>count</parameter>
|
||||
bytes available, return as many as are available. If no
|
||||
more data is available, return either &false; or an
|
||||
empty string.
|
||||
You must also update the read/write position of the stream
|
||||
by the number of bytes that were successfully read.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>stream_write</methodname>
|
||||
<methodparam><type>string</type><parameter>data</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>fwrite</function>
|
||||
calls on the stream. You should store <parameter>data</parameter>
|
||||
into the underlying storage used by your stream. If there is not
|
||||
enough room, try to store as many bytes as possible.
|
||||
You should return the number of bytes that were successfully
|
||||
stored in the stream, or 0 if none could be stored.
|
||||
You must also update the read/write position of the stream
|
||||
by the number of bytes that were successfully written.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>stream_eof</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>feof</function>
|
||||
calls on the stream. You should return &true; if the read/write
|
||||
position is at the end of the stream and if no more data is available
|
||||
to be read, or &false; otherwise.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>stream_tell</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>ftell</function>
|
||||
calls on the stream. You should return the current read/write
|
||||
position of the stream.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>stream_seek</methodname>
|
||||
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>whence</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>fseek</function>
|
||||
calls on the stream. You should update the read/write position
|
||||
of the stream according to <parameter>offset</parameter> and
|
||||
<parameter>whence</parameter>. See <function>fseek</function>
|
||||
for more information about these parameters.
|
||||
Return &true; if the position was updated, &false; otherwise.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>stream_flush</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>fflush</function>
|
||||
calls on the stream. If you have cached data in your stream
|
||||
but not yet stored it into the underlying storage, you should
|
||||
do so now.
|
||||
Return &true; if the cached data was successfully stored (or
|
||||
if there was no data to store), or &false; if the data could
|
||||
not be stored.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>stream_stat</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>fstat</function>
|
||||
calls on the stream and should return an array containing the same
|
||||
values as appropriate for the stream.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>stream_cast</methodname>
|
||||
<methodparam><type>int</type><parameter>cast_as</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>stream_select</function>
|
||||
calls on the stream and should return the underlying stream resource used
|
||||
by the wrapper, or &false;. The
|
||||
<parameter>cast_as</parameter> parameter can be
|
||||
<constant>STREAM_CAST_FOR_SELECT</constant> when
|
||||
<function>stream_select</function> is calling
|
||||
<function>stream_cast</function> or
|
||||
<constant>STREAM_CAST_AS_STREAM</constant> when
|
||||
<function>stream_cast</function> is called for other uses.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>stream_set_option</methodname>
|
||||
<methodparam><type>int</type><parameter>option</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>arg1</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>arg2</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called to set options on the stream. Possible values
|
||||
for <parameter>option</parameter> are:
|
||||
<simplelist>
|
||||
<member><constant>STREAM_OPTION_BLOCKING</constant>: The method is called
|
||||
in response to <function>stream_set_blocking</function>.
|
||||
<parameter>arg1</parameter> is the requested blocking mode.</member>
|
||||
<member><constant>STREAM_OPTION_READ_TIMEOUT</constant>: The method is
|
||||
called in response to <function>stream_set_timeout</function>.
|
||||
<parameter>arg1</parameter> is the timeout in seconds, and
|
||||
<parameter>arg2</parameter> is the timeout in microseconds.</member>
|
||||
<member><constant>STREAM_OPTION_WRITE_BUFFER</constant>: The method is
|
||||
called in response to <function>stream_set_write_buffer</function>.
|
||||
<parameter>arg1</parameter> is the buffer mode
|
||||
(<constant>STREAM_BUFFER_NONE</constant> or
|
||||
<constant>STREAM_BUFFER_FULL</constant>) and <parameter>arg2</parameter>
|
||||
is the requested buffer size.</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
<para>
|
||||
<function>stream_set_option</function> should return &false; on failure or
|
||||
if the <parameter>option</parameter> is not implemented, &true; otherwise.
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>unlink</methodname>
|
||||
<methodparam><type>string</type><parameter>path</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>unlink</function>
|
||||
calls on URL paths associated with the wrapper and should attempt
|
||||
to delete the item specified by <parameter>path</parameter>.
|
||||
It should return &true; on success or &false; on failure.
|
||||
In order for the appropriate error message to be returned,
|
||||
do not define this method if your wrapper does not support unlinking.
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>rename</methodname>
|
||||
<methodparam><type>string</type><parameter>path_from</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>path_to</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>rename</function>
|
||||
calls on URL paths associated with the wrapper and should attempt
|
||||
to rename the item specified by <parameter>path_from</parameter>
|
||||
to the specification given by <parameter>path_to</parameter>.
|
||||
It should return &true; on success or &false; on failure.
|
||||
In order for the appropriate error message to be returned,
|
||||
do not define this method if your wrapper does not support renaming.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>mkdir</methodname>
|
||||
<methodparam><type>string</type><parameter>path</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>mode</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>options</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>mkdir</function>
|
||||
calls on URL paths associated with the wrapper and should attempt
|
||||
to create the directory specified by <parameter>path</parameter>.
|
||||
It should return &true; on success or &false; on failure.
|
||||
In order for the appropriate error message to be returned,
|
||||
do not define this method if your wrapper does not support
|
||||
creating directories. Posible values for <parameter>options</parameter>
|
||||
include <constant>STREAM_REPORT_ERRORS</constant> and
|
||||
<constant>STREAM_MKDIR_RECURSIVE</constant>.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>rmdir</methodname>
|
||||
<methodparam><type>string</type><parameter>path</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>options</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>rmdir</function>
|
||||
calls on URL paths associated with the wrapper and should attempt
|
||||
to remove the directory specified by <parameter>path</parameter>.
|
||||
It should return &true; on success or &false; on failure.
|
||||
In order for the appropriate error message to be returned,
|
||||
do not define this method if your wrapper does not support
|
||||
removing directories. Possible values for <parameter>options</parameter>
|
||||
include <constant>STREAM_REPORT_ERRORS</constant>.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>dir_opendir</methodname>
|
||||
<methodparam><type>string</type><parameter>path</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>options</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called immediately when your stream object is created for
|
||||
examining directory contents with <function>opendir</function>.
|
||||
<parameter>path</parameter> specifies the URL that was
|
||||
passed to <function>opendir</function> and that this object is
|
||||
expected to explore. You can use <function>parse_url</function>
|
||||
to break it apart.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>url_stat</methodname>
|
||||
<methodparam><type>string</type><parameter>path</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>flags</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>stat</function>
|
||||
calls on the URL paths associated with the wrapper and should
|
||||
return as many elements in common with the system function as
|
||||
possible. Unknown or unavailable values should be set to a
|
||||
rational value (usually <constant>0</constant>).
|
||||
</para>
|
||||
<para>
|
||||
<parameter>flags</parameter> holds additional flags set
|
||||
by the streams API. It can hold one or more of the following
|
||||
values OR'd together.
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Flag</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>STREAM_URL_STAT_LINK</entry>
|
||||
<entry>
|
||||
For resources with the ability to link to other resource
|
||||
(such as an HTTP Location: forward, or a filesystem
|
||||
symlink). This flag specified that only information
|
||||
about the link itself should be returned, not the
|
||||
resource pointed to by the link. This flag is set in
|
||||
response to calls to <function>lstat</function>,
|
||||
<function>is_link</function>, or <function>filetype</function>.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>STREAM_URL_STAT_QUIET</entry>
|
||||
<entry>If this flag is set, your wrapper should not raise any
|
||||
errors. If this flag is not set, you are responsible for
|
||||
reporting errors using the <function>trigger_error</function>
|
||||
function during stating of the path.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>dir_readdir</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>readdir</function>
|
||||
and should return a string representing the next filename in the
|
||||
location opened by <function>dir_opendir</function>.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>dir_rewinddir</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>rewinddir</function>
|
||||
and should reset the output generated by <function>dir_readdir</function>.
|
||||
i.e.: The next call to <function>dir_readdir</function> should return
|
||||
the first entry in the location returned by <function>dir_opendir</function>.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>dir_closedir</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>closedir</function>.
|
||||
You should release any resources which were locked or allocated during
|
||||
the opening and use of the directory stream.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
<note>
|
||||
<simpara>
|
||||
As of PHP 5.0.0 the instance of
|
||||
<parameter>classname</parameter> will be populated with a
|
||||
<parameter>context</parameter> property referencing a
|
||||
<literal>Context Resource</literal> which may be accessed
|
||||
with <function>stream_context_get_options</function>.
|
||||
If no context was passed to the stream creation function,
|
||||
<parameter>context</parameter> will be set to &null;.
|
||||
</simpara>
|
||||
</note>
|
||||
<para>
|
||||
<function>stream_wrapper_register</function> will return &false; if the
|
||||
<parameter>protocol</parameter> already has a handler.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>stream_open</methodname>
|
||||
<methodparam><type>string</type><parameter>path</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>mode</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>options</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>opened_path</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<refsect1 role="changelog">
|
||||
&reftitle.changelog;
|
||||
<para>
|
||||
This method is called immediately after your stream object is
|
||||
created. <parameter>path</parameter> specifies the URL that was
|
||||
passed to <function>fopen</function> and that this object is
|
||||
expected to retrieve. You can use <function>parse_url</function>
|
||||
to break it apart.
|
||||
</para>
|
||||
<para>
|
||||
<parameter>mode</parameter> is the mode used to open the file,
|
||||
as detailed for <function>fopen</function>. You are responsible
|
||||
for checking that <parameter>mode</parameter> is valid for the
|
||||
<parameter>path</parameter> requested.
|
||||
</para>
|
||||
<para>
|
||||
<parameter>options</parameter> holds additional flags set
|
||||
by the streams API. It can hold one or more of the following
|
||||
values OR'd together.
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Flag</entry>
|
||||
<entry>Description</entry>
|
||||
<entry>&Version;</entry>
|
||||
<entry>&Description;</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>STREAM_USE_PATH</entry>
|
||||
<entry>If <parameter>path</parameter> is relative, search
|
||||
for the resource using the include_path.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>STREAM_REPORT_ERRORS</entry>
|
||||
<entry>If this flag is set, you are responsible for raising
|
||||
errors using <function>trigger_error</function> during
|
||||
opening of the stream. If this flag is not set, you
|
||||
should not raise any errors.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
<para>
|
||||
If the <parameter>path</parameter> is opened successfully,
|
||||
and STREAM_USE_PATH is set in <parameter>options</parameter>,
|
||||
you should set <parameter>opened_path</parameter> to the full
|
||||
path of the file/resource that was actually opened.
|
||||
</para>
|
||||
<para>
|
||||
If the requested resource was opened successfully, you should
|
||||
return &true;, otherwise you should return &false;
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>stream_close</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called when the stream is closed, using
|
||||
<function>fclose</function>. You must release any resources
|
||||
that were locked or allocated by the stream.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>stream_read</methodname>
|
||||
<methodparam><type>int</type><parameter>count</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>fread</function>
|
||||
and <function>fgets</function> calls on the stream. You
|
||||
must return up-to <parameter>count</parameter> bytes of data
|
||||
from the current read/write position as a string.
|
||||
If there are less than <parameter>count</parameter>
|
||||
bytes available, return as many as are available. If no
|
||||
more data is available, return either &false; or an
|
||||
empty string.
|
||||
You must also update the read/write position of the stream
|
||||
by the number of bytes that were successfully read.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>stream_write</methodname>
|
||||
<methodparam><type>string</type><parameter>data</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>fwrite</function>
|
||||
calls on the stream. You should store <parameter>data</parameter>
|
||||
into the underlying storage used by your stream. If there is not
|
||||
enough room, try to store as many bytes as possible.
|
||||
You should return the number of bytes that were successfully
|
||||
stored in the stream, or 0 if none could be stored.
|
||||
You must also update the read/write position of the stream
|
||||
by the number of bytes that were successfully written.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>stream_eof</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>feof</function>
|
||||
calls on the stream. You should return &true; if the read/write
|
||||
position is at the end of the stream and if no more data is available
|
||||
to be read, or &false; otherwise.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>stream_tell</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>ftell</function>
|
||||
calls on the stream. You should return the current read/write
|
||||
position of the stream.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>stream_seek</methodname>
|
||||
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>whence</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>fseek</function>
|
||||
calls on the stream. You should update the read/write position
|
||||
of the stream according to <parameter>offset</parameter> and
|
||||
<parameter>whence</parameter>. See <function>fseek</function>
|
||||
for more information about these parameters.
|
||||
Return &true; if the position was updated, &false; otherwise.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>stream_flush</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>fflush</function>
|
||||
calls on the stream. If you have cached data in your stream
|
||||
but not yet stored it into the underlying storage, you should
|
||||
do so now.
|
||||
Return &true; if the cached data was successfully stored (or
|
||||
if there was no data to store), or &false; if the data could
|
||||
not be stored.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>stream_stat</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>fstat</function>
|
||||
calls on the stream and should return an array containing the same
|
||||
values as appropriate for the stream.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>stream_cast</methodname>
|
||||
<methodparam><type>int</type><parameter>cast_as</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>stream_select</function>
|
||||
calls on the stream and should return the underlying stream resource used
|
||||
by the wrapper, or &false;. The
|
||||
<parameter>cast_as</parameter> parameter can be
|
||||
<constant>STREAM_CAST_FOR_SELECT</constant> when
|
||||
<function>stream_select</function> is calling
|
||||
<function>stream_cast</function> or
|
||||
<constant>STREAM_CAST_AS_STREAM</constant> when
|
||||
<function>stream_cast</function> is called for other uses.
|
||||
</para>
|
||||
<note>
|
||||
<simpara>
|
||||
Userspace wrapper stream_cast method is not supported prior to
|
||||
PHP 5.3.0.
|
||||
</simpara>
|
||||
</note>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>stream_set_option</methodname>
|
||||
<methodparam><type>int</type><parameter>option</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>arg1</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>arg2</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called to set options on the stream. Possible values
|
||||
for <parameter>option</parameter> are:
|
||||
<simplelist>
|
||||
<member><constant>STREAM_OPTION_BLOCKING</constant>: The method is called
|
||||
in response to <function>stream_set_blocking</function>.
|
||||
<parameter>arg1</parameter> is the requested blocking mode.</member>
|
||||
<member><constant>STREAM_OPTION_READ_TIMEOUT</constant>: The method is
|
||||
called in response to <function>stream_set_timeout</function>.
|
||||
<parameter>arg1</parameter> is the timeout in seconds, and
|
||||
<parameter>arg2</parameter> is the timeout in microseconds.</member>
|
||||
<member><constant>STREAM_OPTION_WRITE_BUFFER</constant>: The method is
|
||||
called in response to <function>stream_set_write_buffer</function>.
|
||||
<parameter>arg1</parameter> is the buffer mode
|
||||
(<constant>STREAM_BUFFER_NONE</constant> or
|
||||
<constant>STREAM_BUFFER_FULL</constant>) and <parameter>arg2</parameter>
|
||||
is the requested buffer size.</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
<para>
|
||||
<function>stream_set_option</function> should return &false; on failure or
|
||||
if the <parameter>option</parameter> is not implemented, &true; otherwise.
|
||||
</para>
|
||||
<note>
|
||||
<simpara>
|
||||
Userspace wrapper stream_set_option method is not supported prior to
|
||||
PHP 5.3.0.
|
||||
</simpara>
|
||||
</note>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>unlink</methodname>
|
||||
<methodparam><type>string</type><parameter>path</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>unlink</function>
|
||||
calls on URL paths associated with the wrapper and should attempt
|
||||
to delete the item specified by <parameter>path</parameter>.
|
||||
It should return &true; on success or &false; on failure.
|
||||
In order for the appropriate error message to be returned,
|
||||
do not define this method if your wrapper does not support unlinking.
|
||||
</para>
|
||||
<note>
|
||||
<simpara>
|
||||
Userspace wrapper unlink method is not supported prior to
|
||||
PHP 5.0.0.
|
||||
</simpara>
|
||||
</note>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>rename</methodname>
|
||||
<methodparam><type>string</type><parameter>path_from</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>path_to</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>rename</function>
|
||||
calls on URL paths associated with the wrapper and should attempt
|
||||
to rename the item specified by <parameter>path_from</parameter>
|
||||
to the specification given by <parameter>path_to</parameter>.
|
||||
It should return &true; on success or &false; on failure.
|
||||
In order for the appropriate error message to be returned,
|
||||
do not define this method if your wrapper does not support renaming.
|
||||
</para>
|
||||
<note>
|
||||
<simpara>
|
||||
Userspace wrapper rename method is not supported prior to
|
||||
PHP 5.0.0.
|
||||
</simpara>
|
||||
</note>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>mkdir</methodname>
|
||||
<methodparam><type>string</type><parameter>path</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>mode</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>options</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>mkdir</function>
|
||||
calls on URL paths associated with the wrapper and should attempt
|
||||
to create the directory specified by <parameter>path</parameter>.
|
||||
It should return &true; on success or &false; on failure.
|
||||
In order for the appropriate error message to be returned,
|
||||
do not define this method if your wrapper does not support
|
||||
creating directories. Posible values for <parameter>options</parameter>
|
||||
include <constant>STREAM_REPORT_ERRORS</constant> and
|
||||
<constant>STREAM_MKDIR_RECURSIVE</constant>.
|
||||
</para>
|
||||
<note>
|
||||
<simpara>
|
||||
Userspace wrapper mkdir method is not supported prior to
|
||||
PHP 5.0.0.
|
||||
</simpara>
|
||||
</note>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>rmdir</methodname>
|
||||
<methodparam><type>string</type><parameter>path</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>options</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>rmdir</function>
|
||||
calls on URL paths associated with the wrapper and should attempt
|
||||
to remove the directory specified by <parameter>path</parameter>.
|
||||
It should return &true; on success or &false; on failure.
|
||||
In order for the appropriate error message to be returned,
|
||||
do not define this method if your wrapper does not support
|
||||
removing directories. Possible values for <parameter>options</parameter>
|
||||
include <constant>STREAM_REPORT_ERRORS</constant>.
|
||||
</para>
|
||||
<note>
|
||||
<simpara>
|
||||
Userspace wrapper rmdir method is not supported prior to
|
||||
PHP 5.0.0.
|
||||
</simpara>
|
||||
</note>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>dir_opendir</methodname>
|
||||
<methodparam><type>string</type><parameter>path</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>options</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called immediately when your stream object is created for
|
||||
examining directory contents with <function>opendir</function>.
|
||||
<parameter>path</parameter> specifies the URL that was
|
||||
passed to <function>opendir</function> and that this object is
|
||||
expected to explore. You can use <function>parse_url</function>
|
||||
to break it apart.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>url_stat</methodname>
|
||||
<methodparam><type>string</type><parameter>path</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>flags</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>stat</function>
|
||||
calls on the URL paths associated with the wrapper and should
|
||||
return as many elements in common with the system function as
|
||||
possible. Unknown or unavailable values should be set to a
|
||||
rational value (usually <constant>0</constant>).
|
||||
</para>
|
||||
<para>
|
||||
<parameter>flags</parameter> holds additional flags set
|
||||
by the streams API. It can hold one or more of the following
|
||||
values OR'd together.
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Flag</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>STREAM_URL_STAT_LINK</entry>
|
||||
<entry>5.3.0</entry>
|
||||
<entry>
|
||||
For resources with the ability to link to other resource
|
||||
(such as an HTTP Location: forward, or a filesystem
|
||||
symlink). This flag specified that only information
|
||||
about the link itself should be returned, not the
|
||||
resource pointed to by the link. This flag is set in
|
||||
response to calls to <function>lstat</function>,
|
||||
<function>is_link</function>, or <function>filetype</function>.
|
||||
Added the following userspace wrappers: stream_set_option, stream_cast.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>STREAM_URL_STAT_QUIET</entry>
|
||||
<entry>If this flag is set, your wrapper should not raise any
|
||||
errors. If this flag is not set, you are responsible for
|
||||
reporting errors using the <function>trigger_error</function>
|
||||
function during stating of the path.
|
||||
<entry>5.0.0</entry>
|
||||
<entry>
|
||||
Added the following userspace wrappers: rmdir, mkdir, rename, unlink.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>5.0.0</entry>
|
||||
<entry>
|
||||
Added the <literal>context</literal> property.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>dir_readdir</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<refsect1 role="examples"><!-- {{{ -->
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
This method is called in response to <function>readdir</function>
|
||||
and should return a string representing the next filename in the
|
||||
location opened by <function>dir_opendir</function>.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>dir_rewinddir</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>rewinddir</function>
|
||||
and should reset the output generated by <function>dir_readdir</function>.
|
||||
i.e.: The next call to <function>dir_readdir</function> should return
|
||||
the first entry in the location returned by <function>dir_opendir</function>.
|
||||
</para>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>dir_closedir</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This method is called in response to <function>closedir</function>.
|
||||
You should release any resources which were locked or allocated during
|
||||
the opening and use of the directory stream.
|
||||
</para>
|
||||
|
||||
|
||||
<para>
|
||||
The example below implements a var:// protocol handler that
|
||||
allows read/write access to a named global variable using
|
||||
standard filesystem stream functions such as <function>fread</function>.
|
||||
The var:// protocol implemented below, given the URL
|
||||
"var://foo" will read/write data to/from $GLOBALS["foo"].
|
||||
|
||||
<example>
|
||||
<title>A Stream for reading/writing global variables</title>
|
||||
<para>
|
||||
The example below implements a var:// protocol handler that allows
|
||||
read/write access to a named global variable using standard filesystem
|
||||
stream functions such as <function>fread</function>. The var:// protocol
|
||||
implemented below, given the URL "var://foo" will read/write data
|
||||
to/from $GLOBALS["foo"].
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
@ -557,7 +581,7 @@ var_dump($myvar);
|
|||
</example>
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refsect1><!-- }}} -->
|
||||
|
||||
<refsect1 role="changelog"><!-- {{{ -->
|
||||
&reftitle.changelog;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<refentry xml:id="function.tidy-clean-repair" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_clean_repair</refname>
|
||||
<refpurpose>Execute configured cleanup and repair operations on parsed markup</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidy_clean_repair</methodname>
|
||||
|
@ -21,6 +21,33 @@
|
|||
This function cleans and repairs the given tidy
|
||||
<parameter>object</parameter>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>object</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_clean_repair</function> example</title>
|
||||
|
@ -52,10 +79,14 @@ echo $tidy;
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>tidy_repair_file</function> and
|
||||
<function>tidy_repair_string</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>tidy_repair_file</function></member>
|
||||
<member><function>tidy_repair_string</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,21 +1,47 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<refentry xml:id="function.tidy-config-count" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_config_count</refname>
|
||||
<refpurpose>Returns the Number of Tidy configuration errors encountered for specified document</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>tidy_config_count</methodname>
|
||||
<methodparam><type>tidy</type><parameter>object</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>tidy_config_count</function> returns the number of errors
|
||||
encountered in the configuration of the specified tidy
|
||||
<parameter>object</parameter>.
|
||||
Returns the number of errors encountered in the configuration of the
|
||||
specified tidy <parameter>object</parameter>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>object</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the number of errors.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_config_count</function> example</title>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<refentry xml:id="function.tidy-construct" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy::__construct</refname>
|
||||
<refpurpose>Constructs a new tidy object</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>tidy</type><methodname>tidy::__construct</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>filename</parameter></methodparam>
|
||||
|
@ -17,12 +17,69 @@
|
|||
<para>
|
||||
<function>tidy::__construct</function> constructs a new tidy object.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
If the <parameter>filename</parameter> parameter is given, this function
|
||||
will also read that file and initialize the object with the file,
|
||||
acting like <function>tidy_parse_file</function>.
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>filename</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
If the <parameter>filename</parameter> parameter is given, this function
|
||||
will also read that file and initialize the object with the file,
|
||||
acting like <function>tidy_parse_file</function>.
|
||||
</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: ascii,
|
||||
latin0, latin1, raw, utf8, iso2022, mac, win1252, ibm858, utf16,
|
||||
utf16le, utf16be, big5 and shiftjis.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>use_include_path</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Search for the file in the <link linkend="ini.include-path">include_path</link>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
&tidy.conf-enc;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the new <classname>tidy</classname> instance.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy::__construct</function> example</title>
|
||||
|
@ -67,11 +124,16 @@ line 8 column 14 - Warning: discarding unexpected <bt>
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>tidy_parse_file</function> and
|
||||
<function>tidy_parse_string</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>tidy_parse_file</function></member>
|
||||
<member><function>tidy_parse_string</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry xml:id="function.tidy-diagnose" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_diagnose</refname>
|
||||
<refpurpose>Run configured diagnostics on parsed and repaired markup</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidy_diagnose</methodname>
|
||||
|
@ -18,13 +18,36 @@
|
|||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>tidy_diagnose</function> runs diagnostic tests on the given
|
||||
tidy <parameter>object</parameter>, adding some more information about
|
||||
the document in the error buffer.
|
||||
Runs diagnostic tests on the given tidy <parameter>object</parameter>,
|
||||
adding some more information about the document in the error buffer.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
&return.success;
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>object</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_diagnose</function> example</title>
|
||||
|
@ -66,10 +89,15 @@ Info: Document content looks like XHTML 1.0 Strict
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>tidy_get_error_buffer</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>tidy_get_error_buffer</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,20 +1,46 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry xml:id="function.tidy-error-count" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_error_count</refname>
|
||||
<refpurpose>Returns the Number of Tidy errors encountered for specified document</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>tidy_error_count</methodname>
|
||||
<methodparam><type>tidy</type><parameter>object</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>tidy_error_count</function> returns the number of Tidy errors
|
||||
encountered for the specified document.
|
||||
Returns the number of Tidy errors encountered for the specified document.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>object</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the number of errors.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_error_count</function> example</title>
|
||||
|
@ -46,10 +72,14 @@ line 1 column 1 - Warning: inserting missing 'title' element
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>tidy_access_count</function> and
|
||||
<function>tidy_warning_count</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>tidy_access_count</function></member>
|
||||
<member><function>tidy_warning_count</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<refentry xml:id="function.tidy-get-body" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_get_body</refname>
|
||||
<refpurpose>Returns a tidyNode Object starting from the <body> tag of the tidy parse tree</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>tidyNode</type><methodname>tidy_get_body</methodname>
|
||||
|
@ -21,6 +21,39 @@
|
|||
This function returns a tidyNode object starting from the <body>
|
||||
tag of the tidy parse tree.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>object</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the detected HTML version.
|
||||
</para>
|
||||
<warning>
|
||||
<para>
|
||||
This function is not yet implemented in the Tidylib itself, so it always
|
||||
return <literal>0</literal>.
|
||||
</para>
|
||||
</warning>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_get_body</function> example</title>
|
||||
|
@ -54,12 +87,21 @@ echo $body->value;
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
¬e.tidy.ze2;
|
||||
<para>
|
||||
See also <function>tidy_get_head</function> and
|
||||
<function>tidy_get_html</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.tidy.ze2;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>tidy_get_head</function></member>
|
||||
<member><function>tidy_get_html</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry xml:id="function.tidy-get-config" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>tidy_get_config</refname>
|
||||
<refpurpose>Get current Tidy configuration</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>tidy_get_config</methodname>
|
||||
|
@ -18,14 +18,44 @@
|
|||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>tidy_get_config</function> returns an array with the
|
||||
configuration options in use by the given tidy
|
||||
Gets the list of the configuration options in use by the given tidy
|
||||
<parameter>object</parameter>.
|
||||
</para>
|
||||
<para>
|
||||
For an explanation about each option, visit <link
|
||||
xlink:href="&url.tidy.conf;">&url.tidy.conf;</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>object</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns an array of configuration options.
|
||||
</para>
|
||||
<para>
|
||||
For an explanation about each option, visit <link
|
||||
xlink:href="&url.tidy.conf;">&url.tidy.conf;</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_get_config</function> example</title>
|
||||
|
@ -135,11 +165,16 @@ Array
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>tidy_reset_config</function> and
|
||||
<function>tidy_save_config</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>tidy_reset_config</function></member>
|
||||
<member><function>tidy_save_config</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry xml:id="function.tidy-get-error-buffer" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_get_error_buffer</refname>
|
||||
<refpurpose>Return warnings and errors which occurred parsing the specified document</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>tidy_get_error_buffer</methodname>
|
||||
|
@ -21,6 +21,33 @@
|
|||
<function>tidy_get_error_buffer</function> returns warnings and errors
|
||||
which occurred parsing the specified document.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>object</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the error buffer as a string.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_get_error_buffer</function> example</title>
|
||||
|
@ -46,11 +73,15 @@ line 1 column 1 - Warning: inserting missing 'title' element
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>tidy_access_count</function>,
|
||||
<function>tidy_error_count</function> and
|
||||
<function>tidy_warning_count</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>tidy_access_count</function></member>
|
||||
<member><function>tidy_error_count</function></member>
|
||||
<member><function>tidy_warning_count</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<refentry xml:id="function.tidy-get-head" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_get_head</refname>
|
||||
<refpurpose>Returns a tidyNode Object starting from the <head> tag of the tidy parse tree</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>tidyNode</type><methodname>tidy_get_head</methodname>
|
||||
|
@ -21,6 +21,33 @@
|
|||
This function returns a tidyNode object starting from the <head>
|
||||
tag of the tidy parse tree.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>object</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the <classname>tidyNode</classname> object.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_get_head</function> example</title>
|
||||
|
@ -54,12 +81,21 @@ echo $head->value;
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
¬e.tidy.ze2;
|
||||
<para>
|
||||
See also <function>tidy_get_body</function> and
|
||||
<function>tidy_get_html</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.tidy.ze2;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>tidy_get_body</function></member>
|
||||
<member><function>tidy_get_html</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry xml:id="function.tidy-get-html-ver" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_get_html_ver</refname>
|
||||
<refpurpose>Get the Detected HTML version for the specified document</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>tidy_get_html_ver</methodname>
|
||||
|
@ -18,8 +18,31 @@
|
|||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>tidy_get_html_ver</function> returns the detected HTML version
|
||||
for the specified tidy <parameter>object</parameter>.
|
||||
Returns the detected HTML version for the specified tidy
|
||||
<parameter>object</parameter>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>object</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the detected HTML version.
|
||||
</para>
|
||||
<warning>
|
||||
<para>
|
||||
|
@ -28,6 +51,7 @@
|
|||
</para>
|
||||
</warning>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<refentry xml:id="function.tidy-get-html" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_get_html</refname>
|
||||
<refpurpose>Returns a tidyNode Object starting from the <html> tag of the tidy parse tree</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>tidyNode</type><methodname>tidy_get_html</methodname>
|
||||
|
@ -21,6 +21,33 @@
|
|||
This function returns a tidyNode object starting from the <html>
|
||||
tag of the tidy parse tree.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>object</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the <classname>tidyNode</classname> object.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_get_html</function> example</title>
|
||||
|
@ -59,11 +86,19 @@ echo $html->value;
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
¬e.tidy.ze2;
|
||||
<para>
|
||||
See also <function>tidy_get_body</function> and
|
||||
<function>tidy_get_head</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.tidy.ze2;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>tidy_get_body</function></member>
|
||||
<member><function>tidy_get_head</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry xml:id="function.tidy-get-root" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_get_root</refname>
|
||||
<refpurpose>Returns a tidyNode object representing the root of the tidy parse tree</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>tidyNode</type><methodname>tidy_get_root</methodname>
|
||||
|
@ -20,6 +20,33 @@
|
|||
<para>
|
||||
Returns a tidyNode object representing the root of the tidy parse tree.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>object</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the <classname>tidyNode</classname> object.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>dump nodes</title>
|
||||
|
@ -67,7 +94,10 @@ function dump_nodes($node, $indent) {
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.tidy.ze2;
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry xml:id="function.tidy-get-status" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_get_status</refname>
|
||||
<refpurpose>Get status of specified document</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>tidy_get_status</methodname>
|
||||
|
@ -18,10 +18,36 @@
|
|||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>tidy_get_status</function> returns the status for the specified
|
||||
tidy <parameter>object</parameter>. It returns 0 if no error/warning
|
||||
was raised, 1 for warnings or accessibility errors, or 2 for errors.
|
||||
Returns the status for the specified tidy <parameter>object</parameter>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>object</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns 0 if no error/warning was raised, 1 for warnings or accessibility
|
||||
errors, or 2 for errors.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_get_status</function> example</title>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<refentry xml:id="function.tidy-getopt" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>tidy_getopt</refname>
|
||||
<refpurpose>Returns the value of the specified configuration option for the tidy document</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>tidy_getopt</methodname>
|
||||
|
@ -19,13 +19,46 @@
|
|||
<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 tidy
|
||||
<parameter>object</parameter>. 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: <link
|
||||
xlink:href="&url.tidy.conf;">&url.tidy.conf;</link>.
|
||||
Returns the value of the specified <parameter>option</parameter> for the
|
||||
specified tidy <parameter>object</parameter>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>object</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>option</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
You will find a list with each configuration option and their types
|
||||
at: <link xlink:href="&url.tidy.conf;">&url.tidy.conf;</link>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the value of the specified <parameter>option</parameter>.
|
||||
The return type depends on the type of the specified one.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_getopt</function> example</title>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry xml:id="function.tidy-is-xhtml" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_is_xhtml</refname>
|
||||
<refpurpose>Indicates if the document is a XHTML document</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidy_is_xhtml</methodname>
|
||||
|
@ -17,6 +17,29 @@
|
|||
<type>bool</type><methodname>tidy->isXhtml</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Tells if the document is a XHTML document.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>object</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
This function returns &true; if the specified tidy
|
||||
<parameter>object</parameter> is a XHTML document, or &false; otherwise.
|
||||
|
@ -28,6 +51,7 @@
|
|||
</para>
|
||||
</warning>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<refentry xml:id="function.tidy-is-xml" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_is_xml</refname>
|
||||
<refpurpose>Indicates if the document is a generic (non HTML/XHTML) XML document</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidy_is_xml</methodname>
|
||||
|
@ -17,6 +17,29 @@
|
|||
<type>bool</type><methodname>tidy->isXml</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Tells if the document is a generic (non HTML/XHTML) XML document.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>object</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
This function returns &true; if the specified tidy
|
||||
<parameter>object</parameter> is a generic XML document (non HTML/XHTML),
|
||||
|
@ -29,6 +52,7 @@
|
|||
</para>
|
||||
</warning>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<refentry xml:id="function.tidy-parse-file" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_parse_file</refname>
|
||||
<refpurpose>Parse markup in file or URI</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>tidy</type><methodname>tidy_parse_file</methodname>
|
||||
|
@ -26,7 +26,62 @@
|
|||
<para>
|
||||
This function parses the given file.
|
||||
</para>
|
||||
&tidy.conf-enc;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>filename</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
If the <parameter>filename</parameter> parameter is given, this function
|
||||
will also read that file and initialize the object with the file,
|
||||
acting like <function>tidy_parse_file</function>.
|
||||
</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: ascii,
|
||||
latin0, latin1, raw, utf8, iso2022, mac, win1252, ibm858, utf16,
|
||||
utf16le, utf16be, big5 and shiftjis.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>use_include_path</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="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_parse_file</function> example</title>
|
||||
|
@ -46,13 +101,22 @@ if(!empty($tidy->errorBuffer)) {
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
¬e.tidy.2only;
|
||||
<para>
|
||||
See also <function>tidy_parse_string</function>,
|
||||
<function>tidy_repair_file</function> and
|
||||
<function>tidy_repair_string</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.tidy.2only;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>tidy_parse_string</function></member>
|
||||
<member><function>tidy_repair_file</function></member>
|
||||
<member><function>tidy_repair_string</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<refentry xml:id="function.tidy-parse-string" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_parse_string</refname>
|
||||
<refpurpose>Parse a document stored in a string</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>tidy</type><methodname>tidy_parse_string</methodname>
|
||||
|
@ -22,10 +22,61 @@
|
|||
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>tidy_parse_string</function> parses a document stored in a
|
||||
string.
|
||||
Parses a document stored in a string.
|
||||
</para>
|
||||
&tidy.conf-enc;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>input</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The data to be parsed.
|
||||
</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: ascii,
|
||||
latin0, latin1, raw, utf8, iso2022, mac, win1252, ibm858, utf16,
|
||||
utf16le, utf16be, big5 and shiftjis.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a new <classname>tidy</classname> instance.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_parse_string</function> example</title>
|
||||
|
@ -80,13 +131,22 @@ echo $tidy;
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
¬e.tidy.2only;
|
||||
<para>
|
||||
See also <function>tidy_parse_file</function>,
|
||||
<function>tidy_repair_file</function> and
|
||||
<function>tidy_repair_string</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.tidy.2only;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>tidy_parse_file</function></member>
|
||||
<member><function>tidy_repair_file</function></member>
|
||||
<member><function>tidy_repair_string</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry xml:id="function.tidy-repair-file" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_repair_file</refname>
|
||||
<refpurpose>Repair a file and return it as a string</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>tidy_repair_file</methodname>
|
||||
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
||||
|
@ -15,9 +15,69 @@
|
|||
<methodparam choice="opt"><type>bool</type><parameter>use_include_path</parameter><initializer>false</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function repairs the given file and returns it as a string.
|
||||
Repairs the given file and returns it as a string.
|
||||
</para>
|
||||
&tidy.conf-enc;
|
||||
</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: ascii,
|
||||
latin0, latin1, raw, utf8, iso2022, mac, win1252, ibm858, utf16,
|
||||
utf16le, utf16be, big5 and shiftjis.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>use_include_path</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.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_repair_file</function> example</title>
|
||||
|
@ -35,13 +95,22 @@ file_put_contents($file, $repaired);
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
¬e.tidy.2only;
|
||||
<para>
|
||||
See also <function>tidy_parse_file</function>,
|
||||
<function>tidy_parse_string</function> and
|
||||
<function>tidy_repair_string</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.tidy.2only;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>tidy_parse_file</function></member>
|
||||
<member><function>tidy_parse_string</function></member>
|
||||
<member><function>tidy_repair_string</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<refentry xml:id="function.tidy-repair-string" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidy_repair_string</refname>
|
||||
<refpurpose>Repair a string using an optionally provided configuration file</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>tidy_repair_string</methodname>
|
||||
<methodparam><type>string</type><parameter>data</parameter></methodparam>
|
||||
|
@ -16,7 +16,59 @@
|
|||
<para>
|
||||
This function repairs the given string.
|
||||
</para>
|
||||
&tidy.conf-enc;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>data</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The data 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: ascii,
|
||||
latin0, latin1, raw, utf8, iso2022, mac, win1252, ibm858, utf16,
|
||||
utf16le, utf16be, big5 and shiftjis.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the repaired string.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_repair_string</function> example</title>
|
||||
|
@ -60,12 +112,20 @@ echo $tidy;
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
¬e.tidy.2only;
|
||||
<para>
|
||||
See also <function>tidy_parse_file</function>,
|
||||
<function>tidy_parse_string</function> and
|
||||
<function>tidy_repair_file</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.tidy.2only;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>tidy_parse_file</function></member>
|
||||
<member><function>tidy_parse_string</function></member>
|
||||
<member><function>tidy_repair_file</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry xml:id="function.tidy-setopt" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>tidy_setopt</refname>
|
||||
<refpurpose>Updates the configuration settings for the specified tidy document</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidy_setopt</methodname>
|
||||
<methodparam><type>string</type><parameter>option</parameter></methodparam>
|
||||
|
@ -15,9 +15,43 @@
|
|||
<para>
|
||||
<function>tidy_setopt</function> updates the specified
|
||||
<parameter>option</parameter> with a new <parameter>value</parameter>.
|
||||
You will find a list with each configuration option at: <link
|
||||
xlink:href="&url.tidy.conf;">&url.tidy.conf;</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>option</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy option name. A list of available configuration options may
|
||||
be found at: <link xlink:href="&url.tidy.conf;">&url.tidy.conf;</link>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>value</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tidy option name.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>tidy_setopt</function> example</title>
|
||||
|
@ -34,14 +68,23 @@ tidy_setopt('indent', FALSE);
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>tidy_getopt</function>,
|
||||
<function>tidy_get_config</function>,
|
||||
<function>tidy_reset_config</function> and
|
||||
<function>tidy_save_config</function>.
|
||||
</para>
|
||||
¬e.tidy.1only;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.tidy.1only;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>tidy_getopt</function></member>
|
||||
<member><function>tidy_get_config</function></member>
|
||||
<member><function>tidy_reset_config</function></member>
|
||||
<member><function>tidy_save_config</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,19 +1,30 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry xml:id="function.tidynode-haschildren" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidyNode->hasChildren</refname>
|
||||
<refpurpose>Returns true if this node has children</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidyNode->hasChildren</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Tells if the current node has children.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns &true; if the node has children, &false; otherwise.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
&warn.undocumented.func;
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
This function was named <function>tidy_node->has_children</function> in
|
||||
|
|
|
@ -1,19 +1,30 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry xml:id="function.tidynode-hassiblings" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidyNode->hasSiblings</refname>
|
||||
<refpurpose>Returns true if this node has siblings</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidyNode->hasSiblings</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Tells if the current node has siblings.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns &true; if the node has siblings, &false; otherwise.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
&warn.undocumented.func;
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
This function was named <function>tidy_node->has_siblings</function> in
|
||||
|
|
|
@ -1,20 +1,30 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry xml:id="function.tidynode-isasp" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidyNode->isAsp</refname>
|
||||
<refpurpose>Returns true if this node is ASP</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidyNode->isAsp</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This functions returns &true; if the current node is ASP, or &false;
|
||||
otherwise.
|
||||
Tells wether the current node is ASP.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns &true; if the node is ASP, &false; otherwise.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
This function was named <function>tidy_node->is_asp</function> in
|
||||
|
|
|
@ -1,19 +1,30 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry xml:id="function.tidynode-iscomment" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidyNode->isComment</refname>
|
||||
<refpurpose>Returns true if this node represents a comment</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidyNode->isComment</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Tells if the current node is a comment.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns &true; if the node is a comment, &false; otherwise.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
&warn.undocumented.func;
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
This function was named <function>tidy_node->is_comment</function> in
|
||||
|
|
|
@ -1,19 +1,30 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry xml:id="function.tidynode-ishtml" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidyNode->isHtml</refname>
|
||||
<refpurpose>Returns true if this node is part of a HTML document</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidyNode->isHtml</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Tells if the current node is part of HTML document.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns &true; if the node is part of a HTML document, &false; otherwise.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
&warn.undocumented.func;
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
This function was named <function>tidy_node->is_html</function> in
|
||||
|
|
|
@ -1,19 +1,30 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry xml:id="function.tidynode-isjste" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidyNode->isJste</refname>
|
||||
<refpurpose>Returns true if this node is JSTE</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidyNode->isJste</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Tells if the current node is JSTE.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns &true; if the node is JSTE, &false; otherwise.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
&warn.undocumented.func;
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
This function was named <function>tidy_node->is_jste</function> in
|
||||
|
|
|
@ -1,19 +1,30 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry xml:id="function.tidynode-isphp" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidyNode->isPhp</refname>
|
||||
<refpurpose>Returns true if this node is PHP</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidyNode->isPhp</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Tells if the current node is PHP.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns &true; if the current node is PHP code, &false; otherwise.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>get the PHP code from a mixed HTML/PHP document</title>
|
||||
|
@ -74,6 +85,10 @@ echo 'hello world!';
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
This function was named <function>tidy_node->is_php</function> in
|
||||
|
|
|
@ -1,19 +1,30 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry xml:id="function.tidynode-istext" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>tidyNode->isText</refname>
|
||||
<refpurpose>Returns true if this node represents text (no markup)</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>tidyNode->isText</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Tells if the node represents a text (no markup).
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns &true; if the node represent a text, &false; otherwise.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
&warn.undocumented.func;
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
This function was named <function>tidy_node->is_text</function> in
|
||||
|
|
Loading…
Reference in a new issue