2006-03-11 21:19:27 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2007-12-10 17:06:11 +00:00
|
|
|
<!-- $Revision: 1.14 $ -->
|
2006-03-11 21:19:27 +00:00
|
|
|
<!-- Purpose: basic.vartype -->
|
|
|
|
<!-- Membership: pecl -->
|
|
|
|
<!-- Generated by xml_proto.php v2.4. Found in /scripts directory of phpdoc. -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<reference xml:id="ref.filter" xmlns="http://docbook.org/ns/docbook">
|
2006-03-11 21:19:27 +00:00
|
|
|
<title>Filter Functions</title>
|
|
|
|
<titleabbrev>Filter</titleabbrev>
|
|
|
|
|
|
|
|
<partintro>
|
2007-06-20 22:25:43 +00:00
|
|
|
<section xml:id="filter.intro">
|
2006-03-11 21:19:27 +00:00
|
|
|
&reftitle.intro;
|
|
|
|
<para>
|
2007-06-17 11:55:54 +00:00
|
|
|
This extension serves to validate and filter data coming from some insecure
|
|
|
|
source, such as user input.
|
2006-03-11 21:19:27 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2007-06-17 11:55:54 +00:00
|
|
|
The following filters currently exist; be sure to read the
|
2006-08-31 16:02:23 +00:00
|
|
|
<link linkend="filter.constants">Filter Constants</link> section
|
|
|
|
for information that describes the behavior of each constant:
|
2006-03-11 21:19:27 +00:00
|
|
|
<table>
|
|
|
|
<title>Existing filters</title>
|
2007-06-17 11:55:54 +00:00
|
|
|
<tgroup cols="5">
|
2006-03-11 21:19:27 +00:00
|
|
|
<thead>
|
|
|
|
<row>
|
|
|
|
<entry>ID</entry>
|
|
|
|
<entry>Name</entry>
|
|
|
|
<entry>Options</entry>
|
|
|
|
<entry>Flags</entry>
|
|
|
|
<entry>Description</entry>
|
|
|
|
</row>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_VALIDATE_INT</constant></entry>
|
|
|
|
<entry>"int"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry>
|
|
|
|
<parameter>min_range</parameter>,
|
|
|
|
<parameter>max_range</parameter>
|
|
|
|
</entry>
|
|
|
|
<entry>
|
|
|
|
<constant>FILTER_FLAG_ALLOW_OCTAL</constant>,
|
|
|
|
<constant>FILTER_FLAG_ALLOW_HEX</constant>
|
|
|
|
</entry>
|
|
|
|
<entry>Validates value as integer, optionally from the specified range.</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_VALIDATE_BOOLEAN</constant></entry>
|
|
|
|
<entry>"boolean"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry></entry>
|
|
|
|
<entry>
|
2007-06-17 11:55:54 +00:00
|
|
|
<constant>FILTER_NULL_ON_FAILURE</constant>
|
|
|
|
</entry>
|
|
|
|
<entry>
|
|
|
|
<para>
|
|
|
|
Returns &true; for "1", "true", "on" and "yes".
|
|
|
|
Returns &false; otherwise.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
If <constant>FILTER_NULL_ON_FAILURE</constant> is set, &false; is
|
|
|
|
returned only for "0", "false", "off", "no", and "", and
|
|
|
|
&null; is returned for all non-boolean values.
|
|
|
|
</para>
|
2006-03-11 21:19:27 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_VALIDATE_FLOAT</constant></entry>
|
|
|
|
<entry>"float"</entry>
|
2007-06-14 08:03:47 +00:00
|
|
|
<entry>
|
|
|
|
<parameter>decimal</parameter>
|
|
|
|
</entry>
|
|
|
|
<entry>
|
|
|
|
<constant>FILTER_FLAG_ALLOW_THOUSAND</constant>
|
|
|
|
</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry>Validates value as float.</entry>
|
|
|
|
</row>
|
|
|
|
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_VALIDATE_REGEXP</constant></entry>
|
|
|
|
<entry>"validate_regexp"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry>
|
|
|
|
<parameter>regexp</parameter>
|
|
|
|
</entry>
|
|
|
|
<entry></entry>
|
2006-05-09 03:37:24 +00:00
|
|
|
<entry>
|
|
|
|
Validates value against <parameter>regexp</parameter>, a
|
|
|
|
<link linkend="ref.pcre">Perl-compatible</link> regular expression.
|
|
|
|
</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
</row>
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_VALIDATE_URL</constant></entry>
|
|
|
|
<entry>"validate_url"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry></entry>
|
|
|
|
<entry>
|
|
|
|
<constant>FILTER_FLAG_PATH_REQUIRED</constant>,
|
|
|
|
<constant>FILTER_FLAG_QUERY_REQUIRED</constant>
|
|
|
|
</entry>
|
|
|
|
<entry>Validates value as URL, optionally with required components.</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_VALIDATE_EMAIL</constant></entry>
|
|
|
|
<entry>"validate_email"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry></entry>
|
|
|
|
<entry></entry>
|
|
|
|
<entry>Validates value as e-mail.</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_VALIDATE_IP</constant></entry>
|
|
|
|
<entry>"validate_ip"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry></entry>
|
|
|
|
<entry>
|
|
|
|
<constant>FILTER_FLAG_IPV4</constant>,
|
|
|
|
<constant>FILTER_FLAG_IPV6</constant>,
|
|
|
|
<constant>FILTER_FLAG_NO_PRIV_RANGE</constant>,
|
|
|
|
<constant>FILTER_FLAG_NO_RES_RANGE</constant>
|
|
|
|
</entry>
|
|
|
|
<entry>
|
|
|
|
Validates value as IP address, optionally only IPv4 or IPv6 or not
|
|
|
|
from private or reserved ranges.
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_SANITIZE_STRING</constant></entry>
|
|
|
|
<entry>"string"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry></entry>
|
|
|
|
<entry>
|
|
|
|
<constant>FILTER_FLAG_NO_ENCODE_QUOTES</constant>,
|
|
|
|
<constant>FILTER_FLAG_STRIP_LOW</constant>,
|
|
|
|
<constant>FILTER_FLAG_STRIP_HIGH</constant>,
|
|
|
|
<constant>FILTER_FLAG_ENCODE_LOW</constant>,
|
|
|
|
<constant>FILTER_FLAG_ENCODE_HIGH</constant>,
|
|
|
|
<constant>FILTER_FLAG_ENCODE_AMP</constant>
|
|
|
|
</entry>
|
|
|
|
<entry>Strip tags, optionally strip or encode special characters.</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_SANITIZE_STRIPPED</constant></entry>
|
|
|
|
<entry>"stripped"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry></entry>
|
|
|
|
<entry></entry>
|
|
|
|
<entry>Alias of "string" filter.</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_SANITIZE_ENCODED</constant></entry>
|
|
|
|
<entry>"encoded"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry></entry>
|
|
|
|
<entry>
|
|
|
|
<constant>FILTER_FLAG_STRIP_LOW</constant>,
|
|
|
|
<constant>FILTER_FLAG_STRIP_HIGH</constant>,
|
|
|
|
<constant>FILTER_FLAG_ENCODE_LOW</constant>,
|
|
|
|
<constant>FILTER_FLAG_ENCODE_HIGH</constant>
|
|
|
|
</entry>
|
|
|
|
<entry>URL-encode string, optionally strip or encode special characters.</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_SANITIZE_SPECIAL_CHARS</constant></entry>
|
|
|
|
<entry>"special_chars"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry></entry>
|
|
|
|
<entry>
|
|
|
|
<constant>FILTER_FLAG_STRIP_LOW</constant>,
|
|
|
|
<constant>FILTER_FLAG_STRIP_HIGH</constant>,
|
|
|
|
<constant>FILTER_FLAG_ENCODE_HIGH</constant>
|
|
|
|
</entry>
|
|
|
|
<entry>
|
|
|
|
HTML-escape <literal>'"<>&</literal> and characters with
|
|
|
|
ASCII value less than 32, optionally strip or encode other special
|
|
|
|
characters.
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_UNSAFE_RAW</constant></entry>
|
|
|
|
<entry>"unsafe_raw"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry></entry>
|
|
|
|
<entry>
|
|
|
|
<constant>FILTER_FLAG_STRIP_LOW</constant>,
|
|
|
|
<constant>FILTER_FLAG_STRIP_HIGH</constant>,
|
|
|
|
<constant>FILTER_FLAG_ENCODE_LOW</constant>,
|
|
|
|
<constant>FILTER_FLAG_ENCODE_HIGH</constant>,
|
|
|
|
<constant>FILTER_FLAG_ENCODE_AMP</constant>
|
|
|
|
</entry>
|
|
|
|
<entry>Do nothing, optionally strip or encode special characters.</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_SANITIZE_EMAIL</constant></entry>
|
|
|
|
<entry>"email"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry></entry>
|
|
|
|
<entry></entry>
|
|
|
|
<entry>
|
|
|
|
Remove all characters except letters, digits and
|
|
|
|
<literal>!#$%&'*+-/=?^_`{|}~@.[]</literal>.
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_SANITIZE_URL</constant></entry>
|
|
|
|
<entry>"url"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry></entry>
|
|
|
|
<entry></entry>
|
|
|
|
<entry>
|
2006-03-12 01:36:27 +00:00
|
|
|
Remove all characters except letters, digits and
|
2006-03-11 21:19:27 +00:00
|
|
|
<literal>$-_.+!*'(),{}|\\^~[]`<>#%";/?:@&=</literal>.
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_SANITIZE_NUMBER_INT</constant></entry>
|
|
|
|
<entry>"number_int"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry></entry>
|
|
|
|
<entry></entry>
|
|
|
|
<entry>
|
2007-11-21 14:30:37 +00:00
|
|
|
Remove all characters except digits, plus and minus sign.
|
2006-03-11 21:19:27 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_SANITIZE_NUMBER_FLOAT</constant></entry>
|
|
|
|
<entry>"number_float"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry></entry>
|
2006-03-13 10:02:41 +00:00
|
|
|
<entry>
|
|
|
|
<constant>FILTER_FLAG_ALLOW_FRACTION</constant>,
|
|
|
|
<constant>FILTER_FLAG_ALLOW_THOUSAND</constant>,
|
|
|
|
<constant>FILTER_FLAG_ALLOW_SCIENTIFIC</constant>
|
|
|
|
</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry>
|
|
|
|
Remove all characters except digits, <literal>+-</literal> and
|
|
|
|
optionally <literal>.,eE</literal>.
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_SANITIZE_MAGIC_QUOTES</constant></entry>
|
|
|
|
<entry>"magic_quotes"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry></entry>
|
|
|
|
<entry></entry>
|
|
|
|
<entry>Apply <function>addslashes</function>.</entry>
|
|
|
|
</row>
|
|
|
|
|
|
|
|
<row>
|
2006-03-12 09:19:09 +00:00
|
|
|
<entry><constant>FILTER_CALLBACK</constant></entry>
|
|
|
|
<entry>"callback"</entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry><type>callback</type> function or method</entry>
|
2007-05-06 00:36:44 +00:00
|
|
|
<entry></entry>
|
2006-03-11 21:19:27 +00:00
|
|
|
<entry>Call user-defined function to filter data.</entry>
|
|
|
|
</row>
|
|
|
|
</tbody>
|
|
|
|
</tgroup>
|
|
|
|
</table>
|
|
|
|
</para>
|
|
|
|
</section>
|
2007-06-20 22:25:43 +00:00
|
|
|
<section xml:id="filter.requirements">
|
2006-03-11 21:19:27 +00:00
|
|
|
&reftitle.required;
|
|
|
|
&no.requirement;
|
|
|
|
</section>
|
|
|
|
|
|
|
|
&reference.filter.configure;
|
|
|
|
&reference.filter.ini;
|
|
|
|
|
2007-06-20 22:25:43 +00:00
|
|
|
<section xml:id="filter.resources">
|
2006-03-11 21:19:27 +00:00
|
|
|
&reftitle.resources;
|
|
|
|
&no.resource;
|
|
|
|
</section>
|
|
|
|
&reference.filter.constants;
|
|
|
|
</partintro>
|
2007-12-10 17:06:11 +00:00
|
|
|
&reference.filter.entities.functions;
|
2006-03-11 21:19:27 +00:00
|
|
|
</reference>
|
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
sgml-parent-document:nil
|
|
|
|
sgml-default-dtd-file:"../../../manual.ced"
|
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
|
|
|
-->
|