1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-23 23:32:18 +01:00

filter: fix XML to remove useless wrapping para tags via automatic script

This commit is contained in:
Gina Peter Banyard
2026-01-16 06:59:27 +00:00
parent 5b30308eb8
commit 627f933cfe
6 changed files with 90 additions and 112 deletions

View File

@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="filter.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="filter.examples">
&reftitle.examples;
<section xml:id="filter.examples.validation">
<title>Validation</title>
<para>
<example>
<title>Validating email addresses with <function>filter_var</function></title>
<programlisting role="php" xml:id="filter.examples.validation.email">
<example>
<title>Validating email addresses with <function>filter_var</function></title>
<programlisting role="php" xml:id="filter.examples.validation.email">
<![CDATA[
<?php
$email_a = 'joe@example.com';
@@ -25,21 +23,19 @@ if (filter_var($email_b, FILTER_VALIDATE_EMAIL)) {
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Email address 'joe@example.com' is considered valid.
Email address 'bogus' is considered invalid.
]]>
</screen>
</example>
</para>
</screen>
</example>
<para>
<example>
<title>Validating IP addresses with <function>filter_var</function></title>
<programlisting role="php" xml:id="filter.examples.validation.ip">
<example>
<title>Validating IP addresses with <function>filter_var</function></title>
<programlisting role="php" xml:id="filter.examples.validation.ip">
<![CDATA[
<?php
$ip_a = '127.0.0.1';
@@ -53,20 +49,18 @@ if (filter_var($ip_b, FILTER_VALIDATE_IP)) {
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
IP address '127.0.0.1' is considered valid.
]]>
</screen>
</example>
</para>
</screen>
</example>
<para>
<example>
<title>Passing options to <function>filter_var</function></title>
<programlisting role="php" xml:id="filter.examples.validation.options">
<example>
<title>Passing options to <function>filter_var</function></title>
<programlisting role="php" xml:id="filter.examples.validation.options">
<![CDATA[
<?php
$int_a = '1';
@@ -94,16 +88,15 @@ if (($int_c = filter_var($int_c, FILTER_VALIDATE_INT, $options)) !== FALSE) {
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Integer A '1' is considered valid (between 0 and 3).
Integer C '1' is considered valid (between 0 and 3).
]]>
</screen>
</example>
</para>
</screen>
</example>
</section>
<section xml:id="filter.examples.sanitization">
@@ -134,7 +127,7 @@ $sanitized_c = filter_var($c, FILTER_SANITIZE_EMAIL);
if (filter_var($sanitized_c, FILTER_VALIDATE_EMAIL)) {
echo "This (c) sanitized email address is considered valid.\n";
echo "Before: $c\n";
echo "After: $sanitized_c\n";
echo "After: $sanitized_c\n";
}
?>
]]>
@@ -154,7 +147,6 @@ After: bogus@example.org
</section>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -175,4 +167,3 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- Generated by xml_proto.php v2.4. Found in /scripts directory of phpdoc. -->
<refentry xml:id="function.filter-has-var" xmlns="http://docbook.org/ns/docbook">
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.filter-has-var">
<refnamediv>
<refname>filter_has_var</refname>
<refpurpose>Checks if a variable of the specified type exists</refpurpose>
@@ -17,28 +17,26 @@
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>input_type</parameter></term>
<listitem>
<para>
One of <constant>INPUT_GET</constant>, <constant>INPUT_POST</constant>,
<constant>INPUT_COOKIE</constant>, <constant>INPUT_SERVER</constant>, or
<constant>INPUT_ENV</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>var_name</parameter></term>
<listitem>
<para>
Name of a variable to check.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<variablelist>
<varlistentry>
<term><parameter>input_type</parameter></term>
<listitem>
<para>
One of <constant>INPUT_GET</constant>, <constant>INPUT_POST</constant>,
<constant>INPUT_COOKIE</constant>, <constant>INPUT_SERVER</constant>, or
<constant>INPUT_ENV</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>var_name</parameter></term>
<listitem>
<para>
Name of a variable to check.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- Generated by xml_proto.php v2.4. Found in /scripts directory of phpdoc. -->
<refentry xml:id="function.filter-id" xmlns="http://docbook.org/ns/docbook">
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.filter-id">
<refnamediv>
<refname>filter_id</refname>
<refpurpose>Returns the filter ID belonging to a named filter</refpurpose>
@@ -16,18 +16,16 @@
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>
Name of a filter to get.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>
Name of a filter to get.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
@@ -38,11 +36,9 @@
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>filter_list</function></member>
</simplelist>
</para>
<simplelist>
<member><function>filter_list</function></member>
</simplelist>
</refsect1>
</refentry>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.filter-input" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="function.filter-input">
<refnamediv>
<refname>filter_input</refname>
<refpurpose>Gets a specific external variable by name and optionally filters it</refpurpose>
@@ -67,10 +67,9 @@
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>filter_input</function> example</title>
<programlisting role="php">
<example>
<title>A <function>filter_input</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$search_html = filter_input(INPUT_GET, 'search', FILTER_SANITIZE_SPECIAL_CHARS);
@@ -79,16 +78,15 @@ echo "You have searched for $search_html.\n";
echo "<a href='?search=$search_url'>Search again.</a>";
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
You have searched for Me &#38; son.
<a href='?search=Me%20%26%20son'>Search again.</a>
]]>
</screen>
</example>
</para>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- Generated by xml_proto.php v2.4. Found in /scripts directory of phpdoc. -->
<refentry xml:id="function.filter-list" xmlns="http://docbook.org/ns/docbook">
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.filter-list">
<refnamediv>
<refname>filter_list</refname>
<refpurpose>Returns a list of all supported filters</refpurpose>
@@ -31,18 +31,17 @@
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>filter_list</function> example</title>
<programlisting role="php">
<example>
<title>A <function>filter_list</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
print_r(filter_list());
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Array
(
@@ -66,13 +65,11 @@ Array
[17] => callback
)
]]>
</screen>
</example>
</para>
</screen>
</example>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.filter-var-array" xmlns="http://docbook.org/ns/docbook">
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.filter-var-array">
<refnamediv>
<refname>filter_var_array</refname>
<refpurpose>Gets multiple variables and optionally filters them</refpurpose>
@@ -82,18 +82,17 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
An array containing the values of the requested variables on success, or &false;
on failure. An array value will be &false; if the filter fails, or &null; if
An array containing the values of the requested variables on success, or &false;
on failure. An array value will be &false; if the filter fails, or &null; if
the variable is not set.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>filter_var_array</function> example</title>
<programlisting role="php">
<example>
<title>A <function>filter_var_array</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
@@ -133,9 +132,9 @@ var_dump(filter_var_array($data, $filters));
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(6) {
["product_id"]=>
@@ -158,9 +157,8 @@ array(6) {
NULL
}
]]>
</screen>
</example>
</para>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">