|
3 | 3 | <chapter xml:id="filter.filters" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> |
4 | 4 | <title>Types of filters</title> |
5 | 5 |
|
6 | | - <!-- Sanitize filters: {{{--> |
7 | | - <section xml:id="filter.filters.sanitize"> |
8 | | - <title>Sanitize filters</title> |
9 | | - <para> |
10 | | - <table> |
11 | | - <title>List of filters for sanitization</title> |
12 | | - <tgroup cols="5"> |
13 | | - <thead> |
14 | | - <row> |
15 | | - <entry>ID</entry> |
16 | | - <entry>Name</entry> |
17 | | - <entry>Flags</entry> |
18 | | - <entry>Description</entry> |
19 | | - </row> |
20 | | - </thead> |
21 | | - <tbody> |
22 | | - <row> |
23 | | - <entry><constant>FILTER_SANITIZE_ENCODED</constant></entry> |
24 | | - <entry>"encoded"</entry> |
25 | | - <entry> |
26 | | - <constant>FILTER_FLAG_STRIP_LOW</constant>, |
27 | | - <constant>FILTER_FLAG_STRIP_HIGH</constant>, |
28 | | - <constant>FILTER_FLAG_STRIP_BACKTICK</constant>, |
29 | | - <constant>FILTER_FLAG_ENCODE_LOW</constant>, |
30 | | - <constant>FILTER_FLAG_ENCODE_HIGH</constant> |
31 | | - </entry> |
32 | | - <entry>URL-encode string, optionally strip or encode special characters.</entry> |
33 | | - </row> |
34 | | - <row> |
35 | | - <entry><constant>FILTER_SANITIZE_SPECIAL_CHARS</constant></entry> |
36 | | - <entry>"special_chars"</entry> |
37 | | - <entry> |
38 | | - <constant>FILTER_FLAG_STRIP_LOW</constant>, |
39 | | - <constant>FILTER_FLAG_STRIP_HIGH</constant>, |
40 | | - <constant>FILTER_FLAG_STRIP_BACKTICK</constant>, |
41 | | - <constant>FILTER_FLAG_ENCODE_HIGH</constant> |
42 | | - </entry> |
43 | | - <entry> |
44 | | - HTML-encode <literal>'"<>&</literal> and characters with |
45 | | - ASCII value less than 32, optionally strip or encode other special |
46 | | - characters. |
47 | | - </entry> |
48 | | - </row> |
49 | | - <row> |
50 | | - <entry><constant>FILTER_SANITIZE_FULL_SPECIAL_CHARS</constant></entry> |
51 | | - <entry>"full_special_chars"</entry> |
52 | | - <entry> |
53 | | - <constant>FILTER_FLAG_NO_ENCODE_QUOTES</constant> |
54 | | - </entry> |
55 | | - <entry> |
56 | | - Equivalent to calling <function>htmlspecialchars</function> with <constant>ENT_QUOTES</constant> set. Encoding quotes can |
57 | | - be disabled by setting <constant>FILTER_FLAG_NO_ENCODE_QUOTES</constant>. Like <function>htmlspecialchars</function>, this |
58 | | - filter is aware of the <link linkend="ini.default-charset">default_charset</link> and if a sequence of bytes is detected that |
59 | | - makes up an invalid character in the current character set then the entire string is rejected resulting in a 0-length string. |
60 | | - When using this filter as a default filter, see the warning below about setting the default flags to 0. |
61 | | - </entry> |
62 | | - </row> |
63 | | - <row> |
64 | | - <entry><constant>FILTER_SANITIZE_STRING</constant></entry> |
65 | | - <entry>"string"</entry> |
66 | | - <entry> |
67 | | - <constant>FILTER_FLAG_NO_ENCODE_QUOTES</constant>, |
68 | | - <constant>FILTER_FLAG_STRIP_LOW</constant>, |
69 | | - <constant>FILTER_FLAG_STRIP_HIGH</constant>, |
70 | | - <constant>FILTER_FLAG_STRIP_BACKTICK</constant>, |
71 | | - <constant>FILTER_FLAG_ENCODE_LOW</constant>, |
72 | | - <constant>FILTER_FLAG_ENCODE_HIGH</constant>, |
73 | | - <constant>FILTER_FLAG_ENCODE_AMP</constant> |
74 | | - </entry> |
75 | | - <entry> |
76 | | - Strip tags and HTML-encode double and single quotes, optionally strip |
77 | | - or encode special characters. Encoding quotes can be |
78 | | - disabled by setting <constant>FILTER_FLAG_NO_ENCODE_QUOTES</constant>. |
79 | | - (<emphasis>Deprecated</emphasis> as of PHP 8.1.0, |
80 | | - use <function>htmlspecialchars</function> instead.) |
81 | | - </entry> |
82 | | - </row> |
83 | | - <row> |
84 | | - <entry><constant>FILTER_UNSAFE_RAW</constant></entry> |
85 | | - <entry>"unsafe_raw"</entry> |
86 | | - <entry> |
87 | | - <constant>FILTER_FLAG_STRIP_LOW</constant>, |
88 | | - <constant>FILTER_FLAG_STRIP_HIGH</constant>, |
89 | | - <constant>FILTER_FLAG_STRIP_BACKTICK</constant>, |
90 | | - <constant>FILTER_FLAG_ENCODE_LOW</constant>, |
91 | | - <constant>FILTER_FLAG_ENCODE_HIGH</constant>, |
92 | | - <constant>FILTER_FLAG_ENCODE_AMP</constant> |
93 | | - </entry> |
94 | | - <entry> |
95 | | - Do nothing, optionally strip or encode special characters. This |
96 | | - filter is also aliased to <constant>FILTER_DEFAULT</constant>. |
97 | | - </entry> |
98 | | - </row> |
99 | | - </tbody> |
100 | | - </tgroup> |
101 | | - </table> |
102 | | - </para> |
103 | | - |
104 | | - <simplesect role="changelog"> |
105 | | - &reftitle.changelog; |
106 | | - <para> |
107 | | - <informaltable> |
108 | | - <tgroup cols="2"> |
109 | | - <thead> |
110 | | - <row> |
111 | | - <entry>&Version;</entry> |
112 | | - <entry>&Description;</entry> |
113 | | - </row> |
114 | | - </thead> |
115 | | - <tbody> |
116 | | - <row> |
117 | | - <entry>8.1.0</entry> |
118 | | - <entry> |
119 | | - <constant>FILTER_SANITIZE_STRING</constant> and |
120 | | - <constant>FILTER_SANITIZE_STRIPPED</constant> have been deprecated. |
121 | | - </entry> |
122 | | - </row> |
123 | | - </tbody> |
124 | | - </tgroup> |
125 | | - </informaltable> |
126 | | - </para> |
127 | | - </simplesect> |
128 | | - |
129 | | - </section> |
130 | | - <!--}}}--> |
131 | | - |
132 | 6 | <!-- Filter flags: {{{--> |
133 | 7 | <section xml:id="filter.filters.flags"> |
134 | 8 | <title>Filter flags</title> |
|
0 commit comments