author | Anthony Ly <anthonyly.com@gmail.com> |
Wed, 19 Dec 2012 17:50:20 -0800 | |
changeset 205 | a4f7897e21a9 |
parent 204 | 09a1c134465b |
permissions | -rw-r--r-- |
136 | 1 |
<?php |
2 |
/** |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
3 |
* kses 0.2.2 - HTML/XHTML filter that only allows some elements and attributes |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
4 |
* Copyright (C) 2002, 2003, 2005 Ulf Harnhammar |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
5 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
6 |
* This program is free software and open source software; you can redistribute |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
7 |
* it and/or modify it under the terms of the GNU General Public License as |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
8 |
* published by the Free Software Foundation; either version 2 of the License, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
9 |
* or (at your option) any later version. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
10 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
14 |
* more details. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
15 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
16 |
* You should have received a copy of the GNU General Public License along |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
17 |
* with this program; if not, write to the Free Software Foundation, Inc., |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
18 |
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
19 |
* http://www.gnu.org/licenses/gpl.html |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
20 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
21 |
* [kses strips evil scripts!] |
136 | 22 |
* |
23 |
* Added wp_ prefix to avoid conflicts with existing kses users |
|
24 |
* |
|
25 |
* @version 0.2.2 |
|
26 |
* @copyright (C) 2002, 2003, 2005 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
27 |
* @author Ulf Harnhammar <http://advogato.org/person/metaur/> |
136 | 28 |
* |
29 |
* @package External |
|
30 |
* @subpackage KSES |
|
31 |
* |
|
32 |
*/ |
|
33 |
||
34 |
/** |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
35 |
* You can override this in a plugin. |
136 | 36 |
* |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
37 |
* The wp_kses_allowed_html filter is more powerful and supplies context. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
38 |
* CUSTOM_TAGS is not recommended and should be considered deprecated. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
39 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
40 |
* @see wp_kses_allowed_html() |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
41 |
* |
136 | 42 |
* @since 1.2.0 |
43 |
*/ |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
44 |
if ( ! defined( 'CUSTOM_TAGS' ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
45 |
define( 'CUSTOM_TAGS', false ); |
136 | 46 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
47 |
if ( ! CUSTOM_TAGS ) { |
136 | 48 |
/** |
49 |
* Kses global for default allowable HTML tags. |
|
50 |
* |
|
51 |
* Can be override by using CUSTOM_TAGS constant. |
|
52 |
* |
|
53 |
* @global array $allowedposttags |
|
54 |
* @since 2.0.0 |
|
55 |
*/ |
|
56 |
$allowedposttags = array( |
|
57 |
'address' => array(), |
|
58 |
'a' => array( |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
59 |
'href' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
60 |
'rel' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
61 |
'rev' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
62 |
'name' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
63 |
'target' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
64 |
), |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
65 |
'abbr' => array(), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
66 |
'acronym' => array(), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
67 |
'area' => array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
68 |
'alt' => true, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
69 |
'coords' => true, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
70 |
'href' => true, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
71 |
'nohref' => true, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
72 |
'shape' => true, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
73 |
'target' => true, |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
74 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
75 |
'article' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
76 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
77 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
78 |
'lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
79 |
'xml:lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
80 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
81 |
'aside' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
82 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
83 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
84 |
'lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
85 |
'xml:lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
86 |
), |
136 | 87 |
'b' => array(), |
88 |
'big' => array(), |
|
89 |
'blockquote' => array( |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
90 |
'cite' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
91 |
'lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
92 |
'xml:lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
93 |
), |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
94 |
'br' => array(), |
136 | 95 |
'button' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
96 |
'disabled' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
97 |
'name' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
98 |
'type' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
99 |
'value' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
100 |
), |
136 | 101 |
'caption' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
102 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
103 |
), |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
104 |
'cite' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
105 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
106 |
'lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
107 |
), |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
108 |
'code' => array(), |
136 | 109 |
'col' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
110 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
111 |
'char' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
112 |
'charoff' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
113 |
'span' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
114 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
115 |
'valign' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
116 |
'width' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
117 |
), |
136 | 118 |
'del' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
119 |
'datetime' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
120 |
), |
136 | 121 |
'dd' => array(), |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
122 |
'details' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
123 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
124 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
125 |
'lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
126 |
'open' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
127 |
'xml:lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
128 |
), |
136 | 129 |
'div' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
130 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
131 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
132 |
'lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
133 |
'xml:lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
134 |
), |
136 | 135 |
'dl' => array(), |
136 |
'dt' => array(), |
|
137 |
'em' => array(), |
|
138 |
'fieldset' => array(), |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
139 |
'figure' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
140 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
141 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
142 |
'lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
143 |
'xml:lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
144 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
145 |
'figcaption' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
146 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
147 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
148 |
'lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
149 |
'xml:lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
150 |
), |
136 | 151 |
'font' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
152 |
'color' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
153 |
'face' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
154 |
'size' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
155 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
156 |
'footer' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
157 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
158 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
159 |
'lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
160 |
'xml:lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
161 |
), |
136 | 162 |
'form' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
163 |
'action' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
164 |
'accept' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
165 |
'accept-charset' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
166 |
'enctype' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
167 |
'method' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
168 |
'name' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
169 |
'target' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
170 |
), |
136 | 171 |
'h1' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
172 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
173 |
), |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
174 |
'h2' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
175 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
176 |
), |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
177 |
'h3' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
178 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
179 |
), |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
180 |
'h4' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
181 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
182 |
), |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
183 |
'h5' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
184 |
'align' => true, |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
185 |
), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
186 |
'h6' => array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
187 |
'align' => true, |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
188 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
189 |
'header' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
190 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
191 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
192 |
'lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
193 |
'xml:lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
194 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
195 |
'hgroup' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
196 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
197 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
198 |
'lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
199 |
'xml:lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
200 |
), |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
201 |
'hr' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
202 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
203 |
'noshade' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
204 |
'size' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
205 |
'width' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
206 |
), |
136 | 207 |
'i' => array(), |
208 |
'img' => array( |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
209 |
'alt' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
210 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
211 |
'border' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
212 |
'height' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
213 |
'hspace' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
214 |
'longdesc' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
215 |
'vspace' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
216 |
'src' => true, |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
217 |
'usemap' => true, |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
218 |
'width' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
219 |
), |
136 | 220 |
'ins' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
221 |
'datetime' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
222 |
'cite' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
223 |
), |
136 | 224 |
'kbd' => array(), |
225 |
'label' => array( |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
226 |
'for' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
227 |
), |
136 | 228 |
'legend' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
229 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
230 |
), |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
231 |
'li' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
232 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
233 |
), |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
234 |
'map' => array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
235 |
'name' => true, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
236 |
), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
237 |
'menu' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
238 |
'type' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
239 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
240 |
'nav' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
241 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
242 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
243 |
'lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
244 |
'xml:lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
245 |
), |
136 | 246 |
'p' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
247 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
248 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
249 |
'lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
250 |
'xml:lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
251 |
), |
136 | 252 |
'pre' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
253 |
'width' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
254 |
), |
136 | 255 |
'q' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
256 |
'cite' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
257 |
), |
136 | 258 |
's' => array(), |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
259 |
'span' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
260 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
261 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
262 |
'lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
263 |
'xml:lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
264 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
265 |
'section' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
266 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
267 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
268 |
'lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
269 |
'xml:lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
270 |
), |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
271 |
'small' => array(), |
136 | 272 |
'strike' => array(), |
273 |
'strong' => array(), |
|
274 |
'sub' => array(), |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
275 |
'summary' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
276 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
277 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
278 |
'lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
279 |
'xml:lang' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
280 |
), |
136 | 281 |
'sup' => array(), |
282 |
'table' => array( |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
283 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
284 |
'bgcolor' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
285 |
'border' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
286 |
'cellpadding' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
287 |
'cellspacing' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
288 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
289 |
'rules' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
290 |
'summary' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
291 |
'width' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
292 |
), |
136 | 293 |
'tbody' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
294 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
295 |
'char' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
296 |
'charoff' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
297 |
'valign' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
298 |
), |
136 | 299 |
'td' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
300 |
'abbr' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
301 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
302 |
'axis' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
303 |
'bgcolor' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
304 |
'char' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
305 |
'charoff' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
306 |
'colspan' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
307 |
'dir' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
308 |
'headers' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
309 |
'height' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
310 |
'nowrap' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
311 |
'rowspan' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
312 |
'scope' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
313 |
'valign' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
314 |
'width' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
315 |
), |
136 | 316 |
'textarea' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
317 |
'cols' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
318 |
'rows' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
319 |
'disabled' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
320 |
'name' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
321 |
'readonly' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
322 |
), |
136 | 323 |
'tfoot' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
324 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
325 |
'char' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
326 |
'charoff' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
327 |
'valign' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
328 |
), |
136 | 329 |
'th' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
330 |
'abbr' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
331 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
332 |
'axis' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
333 |
'bgcolor' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
334 |
'char' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
335 |
'charoff' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
336 |
'colspan' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
337 |
'headers' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
338 |
'height' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
339 |
'nowrap' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
340 |
'rowspan' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
341 |
'scope' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
342 |
'valign' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
343 |
'width' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
344 |
), |
136 | 345 |
'thead' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
346 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
347 |
'char' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
348 |
'charoff' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
349 |
'valign' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
350 |
), |
136 | 351 |
'title' => array(), |
352 |
'tr' => array( |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
353 |
'align' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
354 |
'bgcolor' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
355 |
'char' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
356 |
'charoff' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
357 |
'valign' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
358 |
), |
136 | 359 |
'tt' => array(), |
360 |
'u' => array(), |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
361 |
'ul' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
362 |
'type' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
363 |
), |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
364 |
'ol' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
365 |
'start' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
366 |
'type' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
367 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
368 |
'var' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
369 |
); |
136 | 370 |
|
371 |
/** |
|
372 |
* Kses allowed HTML elements. |
|
373 |
* |
|
374 |
* @global array $allowedtags |
|
375 |
* @since 1.0.0 |
|
376 |
*/ |
|
377 |
$allowedtags = array( |
|
378 |
'a' => array( |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
379 |
'href' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
380 |
'title' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
381 |
), |
136 | 382 |
'abbr' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
383 |
'title' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
384 |
), |
136 | 385 |
'acronym' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
386 |
'title' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
387 |
), |
136 | 388 |
'b' => array(), |
389 |
'blockquote' => array( |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
390 |
'cite' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
391 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
392 |
'cite' => array(), |
136 | 393 |
'code' => array(), |
394 |
'del' => array( |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
395 |
'datetime' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
396 |
), |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
397 |
'em' => array(), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
398 |
'i' => array(), |
136 | 399 |
'q' => array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
400 |
'cite' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
401 |
), |
136 | 402 |
'strike' => array(), |
403 |
'strong' => array(), |
|
404 |
); |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
405 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
406 |
$allowedentitynames = array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
407 |
'nbsp', 'iexcl', 'cent', 'pound', 'curren', 'yen', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
408 |
'brvbar', 'sect', 'uml', 'copy', 'ordf', 'laquo', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
409 |
'not', 'shy', 'reg', 'macr', 'deg', 'plusmn', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
410 |
'acute', 'micro', 'para', 'middot', 'cedil', 'ordm', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
411 |
'raquo', 'iquest', 'Agrave', 'Aacute', 'Acirc', 'Atilde', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
412 |
'Auml', 'Aring', 'AElig', 'Ccedil', 'Egrave', 'Eacute', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
413 |
'Ecirc', 'Euml', 'Igrave', 'Iacute', 'Icirc', 'Iuml', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
414 |
'ETH', 'Ntilde', 'Ograve', 'Oacute', 'Ocirc', 'Otilde', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
415 |
'Ouml', 'times', 'Oslash', 'Ugrave', 'Uacute', 'Ucirc', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
416 |
'Uuml', 'Yacute', 'THORN', 'szlig', 'agrave', 'aacute', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
417 |
'acirc', 'atilde', 'auml', 'aring', 'aelig', 'ccedil', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
418 |
'egrave', 'eacute', 'ecirc', 'euml', 'igrave', 'iacute', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
419 |
'icirc', 'iuml', 'eth', 'ntilde', 'ograve', 'oacute', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
420 |
'ocirc', 'otilde', 'ouml', 'divide', 'oslash', 'ugrave', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
421 |
'uacute', 'ucirc', 'uuml', 'yacute', 'thorn', 'yuml', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
422 |
'quot', 'amp', 'lt', 'gt', 'apos', 'OElig', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
423 |
'oelig', 'Scaron', 'scaron', 'Yuml', 'circ', 'tilde', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
424 |
'ensp', 'emsp', 'thinsp', 'zwnj', 'zwj', 'lrm', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
425 |
'rlm', 'ndash', 'mdash', 'lsquo', 'rsquo', 'sbquo', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
426 |
'ldquo', 'rdquo', 'bdquo', 'dagger', 'Dagger', 'permil', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
427 |
'lsaquo', 'rsaquo', 'euro', 'fnof', 'Alpha', 'Beta', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
428 |
'Gamma', 'Delta', 'Epsilon', 'Zeta', 'Eta', 'Theta', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
429 |
'Iota', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Xi', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
430 |
'Omicron', 'Pi', 'Rho', 'Sigma', 'Tau', 'Upsilon', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
431 |
'Phi', 'Chi', 'Psi', 'Omega', 'alpha', 'beta', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
432 |
'gamma', 'delta', 'epsilon', 'zeta', 'eta', 'theta', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
433 |
'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
434 |
'omicron', 'pi', 'rho', 'sigmaf', 'sigma', 'tau', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
435 |
'upsilon', 'phi', 'chi', 'psi', 'omega', 'thetasym', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
436 |
'upsih', 'piv', 'bull', 'hellip', 'prime', 'Prime', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
437 |
'oline', 'frasl', 'weierp', 'image', 'real', 'trade', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
438 |
'alefsym', 'larr', 'uarr', 'rarr', 'darr', 'harr', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
439 |
'crarr', 'lArr', 'uArr', 'rArr', 'dArr', 'hArr', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
440 |
'forall', 'part', 'exist', 'empty', 'nabla', 'isin', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
441 |
'notin', 'ni', 'prod', 'sum', 'minus', 'lowast', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
442 |
'radic', 'prop', 'infin', 'ang', 'and', 'or', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
443 |
'cap', 'cup', 'int', 'sim', 'cong', 'asymp', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
444 |
'ne', 'equiv', 'le', 'ge', 'sub', 'sup', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
445 |
'nsub', 'sube', 'supe', 'oplus', 'otimes', 'perp', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
446 |
'sdot', 'lceil', 'rceil', 'lfloor', 'rfloor', 'lang', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
447 |
'rang', 'loz', 'spades', 'clubs', 'hearts', 'diams', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
448 |
); |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
449 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
450 |
$allowedposttags = array_map( '_wp_add_global_attributes', $allowedposttags ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
451 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
452 |
$allowedtags = wp_kses_array_lc( $allowedtags ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
453 |
$allowedposttags = wp_kses_array_lc( $allowedposttags ); |
136 | 454 |
} |
455 |
||
456 |
/** |
|
457 |
* Filters content and keeps only allowable HTML elements. |
|
458 |
* |
|
459 |
* This function makes sure that only the allowed HTML element names, attribute |
|
460 |
* names and attribute values plus only sane HTML entities will occur in |
|
461 |
* $string. You have to remove any slashes from PHP's magic quotes before you |
|
462 |
* call this function. |
|
463 |
* |
|
464 |
* The default allowed protocols are 'http', 'https', 'ftp', 'mailto', 'news', |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
465 |
* 'irc', 'gopher', 'nntp', 'feed', 'telnet, 'mms', 'rtsp' and 'svn'. This |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
466 |
* covers all common link protocols, except for 'javascript' which should not |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
467 |
* be allowed for untrusted users. |
136 | 468 |
* |
469 |
* @since 1.0.0 |
|
470 |
* |
|
471 |
* @param string $string Content to filter through kses |
|
472 |
* @param array $allowed_html List of allowed HTML elements |
|
473 |
* @param array $allowed_protocols Optional. Allowed protocol in links. |
|
474 |
* @return string Filtered content with only allowed HTML elements |
|
475 |
*/ |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
476 |
function wp_kses( $string, $allowed_html, $allowed_protocols = array() ) { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
477 |
if ( empty( $allowed_protocols ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
478 |
$allowed_protocols = wp_allowed_protocols(); |
136 | 479 |
$string = wp_kses_no_null($string); |
480 |
$string = wp_kses_js_entities($string); |
|
481 |
$string = wp_kses_normalize_entities($string); |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
482 |
$string = wp_kses_hook($string, $allowed_html, $allowed_protocols); // WP changed the order of these funcs and added args to wp_kses_hook |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
483 |
return wp_kses_split($string, $allowed_html, $allowed_protocols); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
484 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
485 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
486 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
487 |
* Return a list of allowed tags and attributes for a given context. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
488 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
489 |
* @since 3.5.0 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
490 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
491 |
* @param string $context The context for which to retrieve tags. Allowed values are |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
492 |
* post | strip | data | entities or the name of a field filter such as pre_user_description. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
493 |
* @return array List of allowed tags and their allowed attributes. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
494 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
495 |
function wp_kses_allowed_html( $context = '' ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
496 |
global $allowedposttags, $allowedtags, $allowedentitynames; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
497 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
498 |
if ( is_array( $context ) ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
499 |
return apply_filters( 'wp_kses_allowed_html', $context, 'explicit' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
500 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
501 |
switch ( $context ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
502 |
case 'post': |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
503 |
return apply_filters( 'wp_kses_allowed_html', $allowedposttags, $context ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
504 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
505 |
case 'user_description': |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
506 |
case 'pre_user_description': |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
507 |
$tags = $allowedtags; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
508 |
$tags['a']['rel'] = true; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
509 |
return apply_filters( 'wp_kses_allowed_html', $tags, $context ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
510 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
511 |
case 'strip': |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
512 |
return apply_filters( 'wp_kses_allowed_html', array(), $context ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
513 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
514 |
case 'entities': |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
515 |
return apply_filters( 'wp_kses_allowed_html', $allowedentitynames, $context); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
516 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
517 |
case 'data': |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
518 |
default: |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
519 |
return apply_filters( 'wp_kses_allowed_html', $allowedtags, $context ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
520 |
} |
136 | 521 |
} |
522 |
||
523 |
/** |
|
524 |
* You add any kses hooks here. |
|
525 |
* |
|
526 |
* There is currently only one kses WordPress hook and it is called here. All |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
527 |
* parameters are passed to the hooks and expected to receive a string. |
136 | 528 |
* |
529 |
* @since 1.0.0 |
|
530 |
* |
|
531 |
* @param string $string Content to filter through kses |
|
532 |
* @param array $allowed_html List of allowed HTML elements |
|
533 |
* @param array $allowed_protocols Allowed protocol in links |
|
534 |
* @return string Filtered content through 'pre_kses' hook |
|
535 |
*/ |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
536 |
function wp_kses_hook( $string, $allowed_html, $allowed_protocols ) { |
136 | 537 |
$string = apply_filters('pre_kses', $string, $allowed_html, $allowed_protocols); |
538 |
return $string; |
|
539 |
} |
|
540 |
||
541 |
/** |
|
542 |
* This function returns kses' version number. |
|
543 |
* |
|
544 |
* @since 1.0.0 |
|
545 |
* |
|
546 |
* @return string KSES Version Number |
|
547 |
*/ |
|
548 |
function wp_kses_version() { |
|
549 |
return '0.2.2'; |
|
550 |
} |
|
551 |
||
552 |
/** |
|
553 |
* Searches for HTML tags, no matter how malformed. |
|
554 |
* |
|
555 |
* It also matches stray ">" characters. |
|
556 |
* |
|
557 |
* @since 1.0.0 |
|
558 |
* |
|
559 |
* @param string $string Content to filter |
|
560 |
* @param array $allowed_html Allowed HTML elements |
|
561 |
* @param array $allowed_protocols Allowed protocols to keep |
|
562 |
* @return string Content with fixed HTML tags |
|
563 |
*/ |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
564 |
function wp_kses_split( $string, $allowed_html, $allowed_protocols ) { |
136 | 565 |
global $pass_allowed_html, $pass_allowed_protocols; |
566 |
$pass_allowed_html = $allowed_html; |
|
567 |
$pass_allowed_protocols = $allowed_protocols; |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
568 |
return preg_replace_callback( '%(<!--.*?(-->|$))|(<[^>]*(>|$)|>)%', '_wp_kses_split_callback', $string ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
569 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
570 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
571 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
572 |
* Callback for wp_kses_split. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
573 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
574 |
* @since 3.1.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
575 |
* @access private |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
576 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
577 |
function _wp_kses_split_callback( $match ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
578 |
global $pass_allowed_html, $pass_allowed_protocols; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
579 |
return wp_kses_split2( $match[0], $pass_allowed_html, $pass_allowed_protocols ); |
136 | 580 |
} |
581 |
||
582 |
/** |
|
583 |
* Callback for wp_kses_split for fixing malformed HTML tags. |
|
584 |
* |
|
585 |
* This function does a lot of work. It rejects some very malformed things like |
|
586 |
* <:::>. It returns an empty string, if the element isn't allowed (look ma, no |
|
587 |
* strip_tags()!). Otherwise it splits the tag into an element and an attribute |
|
588 |
* list. |
|
589 |
* |
|
590 |
* After the tag is split into an element and an attribute list, it is run |
|
591 |
* through another filter which will remove illegal attributes and once that is |
|
592 |
* completed, will be returned. |
|
593 |
* |
|
594 |
* @access private |
|
595 |
* @since 1.0.0 |
|
596 |
* @uses wp_kses_attr() |
|
597 |
* |
|
598 |
* @param string $string Content to filter |
|
599 |
* @param array $allowed_html Allowed HTML elements |
|
600 |
* @param array $allowed_protocols Allowed protocols to keep |
|
601 |
* @return string Fixed HTML element |
|
602 |
*/ |
|
603 |
function wp_kses_split2($string, $allowed_html, $allowed_protocols) { |
|
604 |
$string = wp_kses_stripslashes($string); |
|
605 |
||
606 |
if (substr($string, 0, 1) != '<') |
|
607 |
return '>'; |
|
608 |
# It matched a ">" character |
|
609 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
610 |
if ( '<!--' == substr( $string, 0, 4 ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
611 |
$string = str_replace( array('<!--', '-->'), '', $string ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
612 |
while ( $string != ($newstring = wp_kses($string, $allowed_html, $allowed_protocols)) ) |
136 | 613 |
$string = $newstring; |
614 |
if ( $string == '' ) |
|
615 |
return ''; |
|
616 |
// prevent multiple dashes in comments |
|
617 |
$string = preg_replace('/--+/', '-', $string); |
|
618 |
// prevent three dashes closing a comment |
|
619 |
$string = preg_replace('/-$/', '', $string); |
|
620 |
return "<!--{$string}-->"; |
|
621 |
} |
|
622 |
# Allow HTML comments |
|
623 |
||
624 |
if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches)) |
|
625 |
return ''; |
|
626 |
# It's seriously malformed |
|
627 |
||
628 |
$slash = trim($matches[1]); |
|
629 |
$elem = $matches[2]; |
|
630 |
$attrlist = $matches[3]; |
|
631 |
||
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
632 |
if ( ! is_array( $allowed_html ) ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
633 |
$allowed_html = wp_kses_allowed_html( $allowed_html ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
634 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
635 |
if ( ! isset($allowed_html[strtolower($elem)]) ) |
136 | 636 |
return ''; |
637 |
# They are using a not allowed HTML element |
|
638 |
||
639 |
if ($slash != '') |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
640 |
return "</$elem>"; |
136 | 641 |
# No attributes are allowed for closing elements |
642 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
643 |
return wp_kses_attr( $elem, $attrlist, $allowed_html, $allowed_protocols ); |
136 | 644 |
} |
645 |
||
646 |
/** |
|
647 |
* Removes all attributes, if none are allowed for this element. |
|
648 |
* |
|
649 |
* If some are allowed it calls wp_kses_hair() to split them further, and then |
|
650 |
* it builds up new HTML code from the data that kses_hair() returns. It also |
|
651 |
* removes "<" and ">" characters, if there are any left. One more thing it does |
|
652 |
* is to check if the tag has a closing XHTML slash, and if it does, it puts one |
|
653 |
* in the returned code as well. |
|
654 |
* |
|
655 |
* @since 1.0.0 |
|
656 |
* |
|
657 |
* @param string $element HTML element/tag |
|
658 |
* @param string $attr HTML attributes from HTML element to closing HTML element tag |
|
659 |
* @param array $allowed_html Allowed HTML elements |
|
660 |
* @param array $allowed_protocols Allowed protocols to keep |
|
661 |
* @return string Sanitized HTML element |
|
662 |
*/ |
|
663 |
function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) { |
|
664 |
# Is there a closing XHTML slash at the end of the attributes? |
|
665 |
||
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
666 |
if ( ! is_array( $allowed_html ) ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
667 |
$allowed_html = wp_kses_allowed_html( $allowed_html ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
668 |
|
136 | 669 |
$xhtml_slash = ''; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
670 |
if (preg_match('%\s*/\s*$%', $attr)) |
136 | 671 |
$xhtml_slash = ' /'; |
672 |
||
673 |
# Are any attributes allowed at all for this element? |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
674 |
if ( ! isset($allowed_html[strtolower($element)]) || count($allowed_html[strtolower($element)]) == 0 ) |
136 | 675 |
return "<$element$xhtml_slash>"; |
676 |
||
677 |
# Split it |
|
678 |
$attrarr = wp_kses_hair($attr, $allowed_protocols); |
|
679 |
||
680 |
# Go through $attrarr, and save the allowed attributes for this element |
|
681 |
# in $attr2 |
|
682 |
$attr2 = ''; |
|
683 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
684 |
$allowed_attr = $allowed_html[strtolower($element)]; |
136 | 685 |
foreach ($attrarr as $arreach) { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
686 |
if ( ! isset( $allowed_attr[strtolower($arreach['name'])] ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
687 |
continue; # the attribute is not allowed |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
688 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
689 |
$current = $allowed_attr[strtolower($arreach['name'])]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
690 |
if ( $current == '' ) |
136 | 691 |
continue; # the attribute is not allowed |
692 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
693 |
if ( strtolower( $arreach['name'] ) == 'style' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
694 |
$orig_value = $arreach['value']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
695 |
$value = safecss_filter_attr( $orig_value ); |
136 | 696 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
697 |
if ( empty( $value ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
698 |
continue; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
699 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
700 |
$arreach['value'] = $value; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
701 |
$arreach['whole'] = str_replace( $orig_value, $value, $arreach['whole'] ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
702 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
703 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
704 |
if ( ! is_array($current) ) { |
136 | 705 |
$attr2 .= ' '.$arreach['whole']; |
706 |
# there are no checks |
|
707 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
708 |
} else { |
136 | 709 |
# there are some checks |
710 |
$ok = true; |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
711 |
foreach ($current as $currkey => $currval) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
712 |
if ( ! wp_kses_check_attr_val($arreach['value'], $arreach['vless'], $currkey, $currval) ) { |
136 | 713 |
$ok = false; |
714 |
break; |
|
715 |
} |
|
716 |
} |
|
717 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
718 |
if ( $ok ) |
136 | 719 |
$attr2 .= ' '.$arreach['whole']; # it passed them |
720 |
} # if !is_array($current) |
|
721 |
} # foreach |
|
722 |
||
723 |
# Remove any "<" or ">" characters |
|
724 |
$attr2 = preg_replace('/[<>]/', '', $attr2); |
|
725 |
||
726 |
return "<$element$attr2$xhtml_slash>"; |
|
727 |
} |
|
728 |
||
729 |
/** |
|
730 |
* Builds an attribute list from string containing attributes. |
|
731 |
* |
|
732 |
* This function does a lot of work. It parses an attribute list into an array |
|
733 |
* with attribute data, and tries to do the right thing even if it gets weird |
|
734 |
* input. It will add quotes around attribute values that don't have any quotes |
|
735 |
* or apostrophes around them, to make it easier to produce HTML code that will |
|
736 |
* conform to W3C's HTML specification. It will also remove bad URL protocols |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
737 |
* from attribute values. It also reduces duplicate attributes by using the |
136 | 738 |
* attribute defined first (foo='bar' foo='baz' will result in foo='bar'). |
739 |
* |
|
740 |
* @since 1.0.0 |
|
741 |
* |
|
742 |
* @param string $attr Attribute list from HTML element to closing HTML element tag |
|
743 |
* @param array $allowed_protocols Allowed protocols to keep |
|
744 |
* @return array List of attributes after parsing |
|
745 |
*/ |
|
746 |
function wp_kses_hair($attr, $allowed_protocols) { |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
747 |
$attrarr = array(); |
136 | 748 |
$mode = 0; |
749 |
$attrname = ''; |
|
750 |
$uris = array('xmlns', 'profile', 'href', 'src', 'cite', 'classid', 'codebase', 'data', 'usemap', 'longdesc', 'action'); |
|
751 |
||
752 |
# Loop through the whole attribute list |
|
753 |
||
754 |
while (strlen($attr) != 0) { |
|
755 |
$working = 0; # Was the last operation successful? |
|
756 |
||
757 |
switch ($mode) { |
|
758 |
case 0 : # attribute name, href for instance |
|
759 |
||
760 |
if (preg_match('/^([-a-zA-Z]+)/', $attr, $match)) { |
|
761 |
$attrname = $match[1]; |
|
762 |
$working = $mode = 1; |
|
763 |
$attr = preg_replace('/^[-a-zA-Z]+/', '', $attr); |
|
764 |
} |
|
765 |
||
766 |
break; |
|
767 |
||
768 |
case 1 : # equals sign or valueless ("selected") |
|
769 |
||
770 |
if (preg_match('/^\s*=\s*/', $attr)) # equals sign |
|
771 |
{ |
|
772 |
$working = 1; |
|
773 |
$mode = 2; |
|
774 |
$attr = preg_replace('/^\s*=\s*/', '', $attr); |
|
775 |
break; |
|
776 |
} |
|
777 |
||
778 |
if (preg_match('/^\s+/', $attr)) # valueless |
|
779 |
{ |
|
780 |
$working = 1; |
|
781 |
$mode = 0; |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
782 |
if(false === array_key_exists($attrname, $attrarr)) { |
136 | 783 |
$attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); |
784 |
} |
|
785 |
$attr = preg_replace('/^\s+/', '', $attr); |
|
786 |
} |
|
787 |
||
788 |
break; |
|
789 |
||
790 |
case 2 : # attribute value, a URL after href= for instance |
|
791 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
792 |
if (preg_match('%^"([^"]*)"(\s+|/?$)%', $attr, $match)) |
136 | 793 |
# "value" |
794 |
{ |
|
795 |
$thisval = $match[1]; |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
796 |
if ( in_array(strtolower($attrname), $uris) ) |
136 | 797 |
$thisval = wp_kses_bad_protocol($thisval, $allowed_protocols); |
798 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
799 |
if(false === array_key_exists($attrname, $attrarr)) { |
136 | 800 |
$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); |
801 |
} |
|
802 |
$working = 1; |
|
803 |
$mode = 0; |
|
804 |
$attr = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr); |
|
805 |
break; |
|
806 |
} |
|
807 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
808 |
if (preg_match("%^'([^']*)'(\s+|/?$)%", $attr, $match)) |
136 | 809 |
# 'value' |
810 |
{ |
|
811 |
$thisval = $match[1]; |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
812 |
if ( in_array(strtolower($attrname), $uris) ) |
136 | 813 |
$thisval = wp_kses_bad_protocol($thisval, $allowed_protocols); |
814 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
815 |
if(false === array_key_exists($attrname, $attrarr)) { |
136 | 816 |
$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n'); |
817 |
} |
|
818 |
$working = 1; |
|
819 |
$mode = 0; |
|
820 |
$attr = preg_replace("/^'[^']*'(\s+|$)/", '', $attr); |
|
821 |
break; |
|
822 |
} |
|
823 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
824 |
if (preg_match("%^([^\s\"']+)(\s+|/?$)%", $attr, $match)) |
136 | 825 |
# value |
826 |
{ |
|
827 |
$thisval = $match[1]; |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
828 |
if ( in_array(strtolower($attrname), $uris) ) |
136 | 829 |
$thisval = wp_kses_bad_protocol($thisval, $allowed_protocols); |
830 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
831 |
if(false === array_key_exists($attrname, $attrarr)) { |
136 | 832 |
$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); |
833 |
} |
|
834 |
# We add quotes to conform to W3C's HTML spec. |
|
835 |
$working = 1; |
|
836 |
$mode = 0; |
|
837 |
$attr = preg_replace("%^[^\s\"']+(\s+|$)%", '', $attr); |
|
838 |
} |
|
839 |
||
840 |
break; |
|
841 |
} # switch |
|
842 |
||
843 |
if ($working == 0) # not well formed, remove and try again |
|
844 |
{ |
|
845 |
$attr = wp_kses_html_error($attr); |
|
846 |
$mode = 0; |
|
847 |
} |
|
848 |
} # while |
|
849 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
850 |
if ($mode == 1 && false === array_key_exists($attrname, $attrarr)) |
136 | 851 |
# special case, for when the attribute list ends with a valueless |
852 |
# attribute like "selected" |
|
853 |
$attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); |
|
854 |
||
855 |
return $attrarr; |
|
856 |
} |
|
857 |
||
858 |
/** |
|
859 |
* Performs different checks for attribute values. |
|
860 |
* |
|
861 |
* The currently implemented checks are "maxlen", "minlen", "maxval", "minval" |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
862 |
* and "valueless". |
136 | 863 |
* |
864 |
* @since 1.0.0 |
|
865 |
* |
|
866 |
* @param string $value Attribute value |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
867 |
* @param string $vless Whether the value is valueless. Use 'y' or 'n' |
136 | 868 |
* @param string $checkname What $checkvalue is checking for. |
869 |
* @param mixed $checkvalue What constraint the value should pass |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
870 |
* @return bool Whether check passes |
136 | 871 |
*/ |
872 |
function wp_kses_check_attr_val($value, $vless, $checkname, $checkvalue) { |
|
873 |
$ok = true; |
|
874 |
||
875 |
switch (strtolower($checkname)) { |
|
876 |
case 'maxlen' : |
|
877 |
# The maxlen check makes sure that the attribute value has a length not |
|
878 |
# greater than the given value. This can be used to avoid Buffer Overflows |
|
879 |
# in WWW clients and various Internet servers. |
|
880 |
||
881 |
if (strlen($value) > $checkvalue) |
|
882 |
$ok = false; |
|
883 |
break; |
|
884 |
||
885 |
case 'minlen' : |
|
886 |
# The minlen check makes sure that the attribute value has a length not |
|
887 |
# smaller than the given value. |
|
888 |
||
889 |
if (strlen($value) < $checkvalue) |
|
890 |
$ok = false; |
|
891 |
break; |
|
892 |
||
893 |
case 'maxval' : |
|
894 |
# The maxval check does two things: it checks that the attribute value is |
|
895 |
# an integer from 0 and up, without an excessive amount of zeroes or |
|
896 |
# whitespace (to avoid Buffer Overflows). It also checks that the attribute |
|
897 |
# value is not greater than the given value. |
|
898 |
# This check can be used to avoid Denial of Service attacks. |
|
899 |
||
900 |
if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value)) |
|
901 |
$ok = false; |
|
902 |
if ($value > $checkvalue) |
|
903 |
$ok = false; |
|
904 |
break; |
|
905 |
||
906 |
case 'minval' : |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
907 |
# The minval check makes sure that the attribute value is a positive integer, |
136 | 908 |
# and that it is not smaller than the given value. |
909 |
||
910 |
if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value)) |
|
911 |
$ok = false; |
|
912 |
if ($value < $checkvalue) |
|
913 |
$ok = false; |
|
914 |
break; |
|
915 |
||
916 |
case 'valueless' : |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
917 |
# The valueless check makes sure if the attribute has a value |
136 | 918 |
# (like <a href="blah">) or not (<option selected>). If the given value |
919 |
# is a "y" or a "Y", the attribute must not have a value. |
|
920 |
# If the given value is an "n" or an "N", the attribute must have one. |
|
921 |
||
922 |
if (strtolower($checkvalue) != $vless) |
|
923 |
$ok = false; |
|
924 |
break; |
|
925 |
} # switch |
|
926 |
||
927 |
return $ok; |
|
928 |
} |
|
929 |
||
930 |
/** |
|
931 |
* Sanitize string from bad protocols. |
|
932 |
* |
|
933 |
* This function removes all non-allowed protocols from the beginning of |
|
934 |
* $string. It ignores whitespace and the case of the letters, and it does |
|
935 |
* understand HTML entities. It does its work in a while loop, so it won't be |
|
936 |
* fooled by a string like "javascript:javascript:alert(57)". |
|
937 |
* |
|
938 |
* @since 1.0.0 |
|
939 |
* |
|
940 |
* @param string $string Content to filter bad protocols from |
|
941 |
* @param array $allowed_protocols Allowed protocols to keep |
|
942 |
* @return string Filtered content |
|
943 |
*/ |
|
944 |
function wp_kses_bad_protocol($string, $allowed_protocols) { |
|
945 |
$string = wp_kses_no_null($string); |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
946 |
$iterations = 0; |
136 | 947 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
948 |
do { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
949 |
$original_string = $string; |
136 | 950 |
$string = wp_kses_bad_protocol_once($string, $allowed_protocols); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
951 |
} while ( $original_string != $string && ++$iterations < 6 ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
952 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
953 |
if ( $original_string != $string ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
954 |
return ''; |
136 | 955 |
|
956 |
return $string; |
|
957 |
} |
|
958 |
||
959 |
/** |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
960 |
* Removes any null characters in $string. |
136 | 961 |
* |
962 |
* @since 1.0.0 |
|
963 |
* |
|
964 |
* @param string $string |
|
965 |
* @return string |
|
966 |
*/ |
|
967 |
function wp_kses_no_null($string) { |
|
968 |
$string = preg_replace('/\0+/', '', $string); |
|
969 |
$string = preg_replace('/(\\\\0)+/', '', $string); |
|
970 |
||
971 |
return $string; |
|
972 |
} |
|
973 |
||
974 |
/** |
|
975 |
* Strips slashes from in front of quotes. |
|
976 |
* |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
977 |
* This function changes the character sequence \" to just ". It leaves all |
136 | 978 |
* other slashes alone. It's really weird, but the quoting from |
979 |
* preg_replace(//e) seems to require this. |
|
980 |
* |
|
981 |
* @since 1.0.0 |
|
982 |
* |
|
983 |
* @param string $string String to strip slashes |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
984 |
* @return string Fixed string with quoted slashes |
136 | 985 |
*/ |
986 |
function wp_kses_stripslashes($string) { |
|
987 |
return preg_replace('%\\\\"%', '"', $string); |
|
988 |
} |
|
989 |
||
990 |
/** |
|
991 |
* Goes through an array and changes the keys to all lower case. |
|
992 |
* |
|
993 |
* @since 1.0.0 |
|
994 |
* |
|
995 |
* @param array $inarray Unfiltered array |
|
996 |
* @return array Fixed array with all lowercase keys |
|
997 |
*/ |
|
998 |
function wp_kses_array_lc($inarray) { |
|
999 |
$outarray = array (); |
|
1000 |
||
1001 |
foreach ( (array) $inarray as $inkey => $inval) { |
|
1002 |
$outkey = strtolower($inkey); |
|
1003 |
$outarray[$outkey] = array (); |
|
1004 |
||
1005 |
foreach ( (array) $inval as $inkey2 => $inval2) { |
|
1006 |
$outkey2 = strtolower($inkey2); |
|
1007 |
$outarray[$outkey][$outkey2] = $inval2; |
|
1008 |
} # foreach $inval |
|
1009 |
} # foreach $inarray |
|
1010 |
||
1011 |
return $outarray; |
|
1012 |
} |
|
1013 |
||
1014 |
/** |
|
1015 |
* Removes the HTML JavaScript entities found in early versions of Netscape 4. |
|
1016 |
* |
|
1017 |
* @since 1.0.0 |
|
1018 |
* |
|
1019 |
* @param string $string |
|
1020 |
* @return string |
|
1021 |
*/ |
|
1022 |
function wp_kses_js_entities($string) { |
|
1023 |
return preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string); |
|
1024 |
} |
|
1025 |
||
1026 |
/** |
|
1027 |
* Handles parsing errors in wp_kses_hair(). |
|
1028 |
* |
|
1029 |
* The general plan is to remove everything to and including some whitespace, |
|
1030 |
* but it deals with quotes and apostrophes as well. |
|
1031 |
* |
|
1032 |
* @since 1.0.0 |
|
1033 |
* |
|
1034 |
* @param string $string |
|
1035 |
* @return string |
|
1036 |
*/ |
|
1037 |
function wp_kses_html_error($string) { |
|
1038 |
return preg_replace('/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string); |
|
1039 |
} |
|
1040 |
||
1041 |
/** |
|
1042 |
* Sanitizes content from bad protocols and other characters. |
|
1043 |
* |
|
1044 |
* This function searches for URL protocols at the beginning of $string, while |
|
1045 |
* handling whitespace and HTML entities. |
|
1046 |
* |
|
1047 |
* @since 1.0.0 |
|
1048 |
* |
|
1049 |
* @param string $string Content to check for bad protocols |
|
1050 |
* @param string $allowed_protocols Allowed protocols |
|
1051 |
* @return string Sanitized content |
|
1052 |
*/ |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1053 |
function wp_kses_bad_protocol_once($string, $allowed_protocols, $count = 1 ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1054 |
$string2 = preg_split( '/:|�*58;|�*3a;/i', $string, 2 ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1055 |
if ( isset($string2[1]) && ! preg_match('%/\?%', $string2[0]) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1056 |
$string = trim( $string2[1] ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1057 |
$protocol = wp_kses_bad_protocol_once2( $string2[0], $allowed_protocols ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1058 |
if ( 'feed:' == $protocol ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1059 |
if ( $count > 2 ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1060 |
return ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1061 |
$string = wp_kses_bad_protocol_once( $string, $allowed_protocols, ++$count ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1062 |
if ( empty( $string ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1063 |
return $string; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1064 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1065 |
$string = $protocol . $string; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1066 |
} |
136 | 1067 |
|
1068 |
return $string; |
|
1069 |
} |
|
1070 |
||
1071 |
/** |
|
1072 |
* Callback for wp_kses_bad_protocol_once() regular expression. |
|
1073 |
* |
|
1074 |
* This function processes URL protocols, checks to see if they're in the |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1075 |
* whitelist or not, and returns different data depending on the answer. |
136 | 1076 |
* |
1077 |
* @access private |
|
1078 |
* @since 1.0.0 |
|
1079 |
* |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1080 |
* @param string $string URI scheme to check against the whitelist |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1081 |
* @param string $allowed_protocols Allowed protocols |
136 | 1082 |
* @return string Sanitized content |
1083 |
*/ |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1084 |
function wp_kses_bad_protocol_once2( $string, $allowed_protocols ) { |
136 | 1085 |
$string2 = wp_kses_decode_entities($string); |
1086 |
$string2 = preg_replace('/\s/', '', $string2); |
|
1087 |
$string2 = wp_kses_no_null($string2); |
|
1088 |
$string2 = strtolower($string2); |
|
1089 |
||
1090 |
$allowed = false; |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1091 |
foreach ( (array) $allowed_protocols as $one_protocol ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1092 |
if ( strtolower($one_protocol) == $string2 ) { |
136 | 1093 |
$allowed = true; |
1094 |
break; |
|
1095 |
} |
|
1096 |
||
1097 |
if ($allowed) |
|
1098 |
return "$string2:"; |
|
1099 |
else |
|
1100 |
return ''; |
|
1101 |
} |
|
1102 |
||
1103 |
/** |
|
1104 |
* Converts and fixes HTML entities. |
|
1105 |
* |
|
1106 |
* This function normalizes HTML entities. It will convert "AT&T" to the correct |
|
1107 |
* "AT&T", ":" to ":", "&#XYZZY;" to "&#XYZZY;" and so on. |
|
1108 |
* |
|
1109 |
* @since 1.0.0 |
|
1110 |
* |
|
1111 |
* @param string $string Content to normalize entities |
|
1112 |
* @return string Content with normalized entities |
|
1113 |
*/ |
|
1114 |
function wp_kses_normalize_entities($string) { |
|
1115 |
# Disarm all entities by converting & to & |
|
1116 |
||
1117 |
$string = str_replace('&', '&', $string); |
|
1118 |
||
1119 |
# Change back the allowed entities in our entity whitelist |
|
1120 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1121 |
$string = preg_replace_callback('/&([A-Za-z]{2,8});/', 'wp_kses_named_entities', $string); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1122 |
$string = preg_replace_callback('/&#(0*[0-9]{1,7});/', 'wp_kses_normalize_entities2', $string); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1123 |
$string = preg_replace_callback('/&#[Xx](0*[0-9A-Fa-f]{1,6});/', 'wp_kses_normalize_entities3', $string); |
136 | 1124 |
|
1125 |
return $string; |
|
1126 |
} |
|
1127 |
||
1128 |
/** |
|
1129 |
* Callback for wp_kses_normalize_entities() regular expression. |
|
1130 |
* |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1131 |
* This function only accepts valid named entity references, which are finite, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1132 |
* case-sensitive, and highly scrutinized by HTML and XML validators. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1133 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1134 |
* @since 3.0.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1135 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1136 |
* @param array $matches preg_replace_callback() matches array |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1137 |
* @return string Correctly encoded entity |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1138 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1139 |
function wp_kses_named_entities($matches) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1140 |
global $allowedentitynames; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1141 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1142 |
if ( empty($matches[1]) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1143 |
return ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1144 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1145 |
$i = $matches[1]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1146 |
return ( ( ! in_array($i, $allowedentitynames) ) ? "&$i;" : "&$i;" ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1147 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1148 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1149 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1150 |
* Callback for wp_kses_normalize_entities() regular expression. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1151 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1152 |
* This function helps wp_kses_normalize_entities() to only accept 16-bit values |
136 | 1153 |
* and nothing more for &#number; entities. |
1154 |
* |
|
1155 |
* @access private |
|
1156 |
* @since 1.0.0 |
|
1157 |
* |
|
1158 |
* @param array $matches preg_replace_callback() matches array |
|
1159 |
* @return string Correctly encoded entity |
|
1160 |
*/ |
|
1161 |
function wp_kses_normalize_entities2($matches) { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1162 |
if ( empty($matches[1]) ) |
136 | 1163 |
return ''; |
1164 |
||
1165 |
$i = $matches[1]; |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1166 |
if (valid_unicode($i)) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1167 |
$i = str_pad(ltrim($i,'0'), 3, '0', STR_PAD_LEFT); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1168 |
$i = "&#$i;"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1169 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1170 |
$i = "&#$i;"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1171 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1172 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1173 |
return $i; |
136 | 1174 |
} |
1175 |
||
1176 |
/** |
|
1177 |
* Callback for wp_kses_normalize_entities() for regular expression. |
|
1178 |
* |
|
1179 |
* This function helps wp_kses_normalize_entities() to only accept valid Unicode |
|
1180 |
* numeric entities in hex form. |
|
1181 |
* |
|
1182 |
* @access private |
|
1183 |
* |
|
1184 |
* @param array $matches preg_replace_callback() matches array |
|
1185 |
* @return string Correctly encoded entity |
|
1186 |
*/ |
|
1187 |
function wp_kses_normalize_entities3($matches) { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1188 |
if ( empty($matches[1]) ) |
136 | 1189 |
return ''; |
1190 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1191 |
$hexchars = $matches[1]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1192 |
return ( ( ! valid_unicode(hexdec($hexchars)) ) ? "&#x$hexchars;" : '&#x'.ltrim($hexchars,'0').';' ); |
136 | 1193 |
} |
1194 |
||
1195 |
/** |
|
1196 |
* Helper function to determine if a Unicode value is valid. |
|
1197 |
* |
|
1198 |
* @param int $i Unicode value |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1199 |
* @return bool True if the value was a valid Unicode number |
136 | 1200 |
*/ |
1201 |
function valid_unicode($i) { |
|
1202 |
return ( $i == 0x9 || $i == 0xa || $i == 0xd || |
|
1203 |
($i >= 0x20 && $i <= 0xd7ff) || |
|
1204 |
($i >= 0xe000 && $i <= 0xfffd) || |
|
1205 |
($i >= 0x10000 && $i <= 0x10ffff) ); |
|
1206 |
} |
|
1207 |
||
1208 |
/** |
|
1209 |
* Convert all entities to their character counterparts. |
|
1210 |
* |
|
1211 |
* This function decodes numeric HTML entities (A and A). It doesn't do |
|
1212 |
* anything with other entities like ä, but we don't need them in the URL |
|
1213 |
* protocol whitelisting system anyway. |
|
1214 |
* |
|
1215 |
* @since 1.0.0 |
|
1216 |
* |
|
1217 |
* @param string $string Content to change entities |
|
1218 |
* @return string Content after decoded entities |
|
1219 |
*/ |
|
1220 |
function wp_kses_decode_entities($string) { |
|
1221 |
$string = preg_replace_callback('/&#([0-9]+);/', '_wp_kses_decode_entities_chr', $string); |
|
1222 |
$string = preg_replace_callback('/&#[Xx]([0-9A-Fa-f]+);/', '_wp_kses_decode_entities_chr_hexdec', $string); |
|
1223 |
||
1224 |
return $string; |
|
1225 |
} |
|
1226 |
||
1227 |
/** |
|
1228 |
* Regex callback for wp_kses_decode_entities() |
|
1229 |
* |
|
1230 |
* @param array $match preg match |
|
1231 |
* @return string |
|
1232 |
*/ |
|
1233 |
function _wp_kses_decode_entities_chr( $match ) { |
|
1234 |
return chr( $match[1] ); |
|
1235 |
} |
|
1236 |
||
1237 |
/** |
|
1238 |
* Regex callback for wp_kses_decode_entities() |
|
1239 |
* |
|
1240 |
* @param array $match preg match |
|
1241 |
* @return string |
|
1242 |
*/ |
|
1243 |
function _wp_kses_decode_entities_chr_hexdec( $match ) { |
|
1244 |
return chr( hexdec( $match[1] ) ); |
|
1245 |
} |
|
1246 |
||
1247 |
/** |
|
1248 |
* Sanitize content with allowed HTML Kses rules. |
|
1249 |
* |
|
1250 |
* @since 1.0.0 |
|
1251 |
* @uses $allowedtags |
|
1252 |
* |
|
1253 |
* @param string $data Content to filter, expected to be escaped with slashes |
|
1254 |
* @return string Filtered content |
|
1255 |
*/ |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1256 |
function wp_filter_kses( $data ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1257 |
return addslashes( wp_kses( stripslashes( $data ), current_filter() ) ); |
136 | 1258 |
} |
1259 |
||
1260 |
/** |
|
1261 |
* Sanitize content with allowed HTML Kses rules. |
|
1262 |
* |
|
1263 |
* @since 2.9.0 |
|
1264 |
* @uses $allowedtags |
|
1265 |
* |
|
1266 |
* @param string $data Content to filter, expected to not be escaped |
|
1267 |
* @return string Filtered content |
|
1268 |
*/ |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1269 |
function wp_kses_data( $data ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1270 |
return wp_kses( $data , current_filter() ); |
136 | 1271 |
} |
1272 |
||
1273 |
/** |
|
1274 |
* Sanitize content for allowed HTML tags for post content. |
|
1275 |
* |
|
1276 |
* Post content refers to the page contents of the 'post' type and not $_POST |
|
1277 |
* data from forms. |
|
1278 |
* |
|
1279 |
* @since 2.0.0 |
|
1280 |
* |
|
1281 |
* @param string $data Post content to filter, expected to be escaped with slashes |
|
1282 |
* @return string Filtered post content with allowed HTML tags and attributes intact. |
|
1283 |
*/ |
|
1284 |
function wp_filter_post_kses($data) { |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1285 |
return addslashes ( wp_kses( stripslashes( $data ), 'post' ) ); |
136 | 1286 |
} |
1287 |
||
1288 |
/** |
|
1289 |
* Sanitize content for allowed HTML tags for post content. |
|
1290 |
* |
|
1291 |
* Post content refers to the page contents of the 'post' type and not $_POST |
|
1292 |
* data from forms. |
|
1293 |
* |
|
1294 |
* @since 2.9.0 |
|
1295 |
* |
|
1296 |
* @param string $data Post content to filter |
|
1297 |
* @return string Filtered post content with allowed HTML tags and attributes intact. |
|
1298 |
*/ |
|
1299 |
function wp_kses_post($data) { |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1300 |
return wp_kses( $data , 'post' ); |
136 | 1301 |
} |
1302 |
||
1303 |
/** |
|
1304 |
* Strips all of the HTML in the content. |
|
1305 |
* |
|
1306 |
* @since 2.1.0 |
|
1307 |
* |
|
1308 |
* @param string $data Content to strip all HTML from |
|
1309 |
* @return string Filtered content without any HTML |
|
1310 |
*/ |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1311 |
function wp_filter_nohtml_kses( $data ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1312 |
return addslashes ( wp_kses( stripslashes( $data ), 'strip' ) ); |
136 | 1313 |
} |
1314 |
||
1315 |
/** |
|
1316 |
* Adds all Kses input form content filters. |
|
1317 |
* |
|
1318 |
* All hooks have default priority. The wp_filter_kses() function is added to |
|
1319 |
* the 'pre_comment_content' and 'title_save_pre' hooks. |
|
1320 |
* |
|
1321 |
* The wp_filter_post_kses() function is added to the 'content_save_pre', |
|
1322 |
* 'excerpt_save_pre', and 'content_filtered_save_pre' hooks. |
|
1323 |
* |
|
1324 |
* @since 2.0.0 |
|
1325 |
* @uses add_filter() See description for what functions are added to what hooks. |
|
1326 |
*/ |
|
1327 |
function kses_init_filters() { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1328 |
// Normal filtering |
136 | 1329 |
add_filter('title_save_pre', 'wp_filter_kses'); |
1330 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1331 |
// Comment filtering |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1332 |
if ( current_user_can( 'unfiltered_html' ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1333 |
add_filter( 'pre_comment_content', 'wp_filter_post_kses' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1334 |
else |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1335 |
add_filter( 'pre_comment_content', 'wp_filter_kses' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1336 |
|
136 | 1337 |
// Post filtering |
1338 |
add_filter('content_save_pre', 'wp_filter_post_kses'); |
|
1339 |
add_filter('excerpt_save_pre', 'wp_filter_post_kses'); |
|
1340 |
add_filter('content_filtered_save_pre', 'wp_filter_post_kses'); |
|
1341 |
} |
|
1342 |
||
1343 |
/** |
|
1344 |
* Removes all Kses input form content filters. |
|
1345 |
* |
|
1346 |
* A quick procedural method to removing all of the filters that kses uses for |
|
1347 |
* content in WordPress Loop. |
|
1348 |
* |
|
1349 |
* Does not remove the kses_init() function from 'init' hook (priority is |
|
1350 |
* default). Also does not remove kses_init() function from 'set_current_user' |
|
1351 |
* hook (priority is also default). |
|
1352 |
* |
|
1353 |
* @since 2.0.6 |
|
1354 |
*/ |
|
1355 |
function kses_remove_filters() { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1356 |
// Normal filtering |
136 | 1357 |
remove_filter('title_save_pre', 'wp_filter_kses'); |
1358 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1359 |
// Comment filtering |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1360 |
remove_filter( 'pre_comment_content', 'wp_filter_post_kses' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1361 |
remove_filter( 'pre_comment_content', 'wp_filter_kses' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1362 |
|
136 | 1363 |
// Post filtering |
1364 |
remove_filter('content_save_pre', 'wp_filter_post_kses'); |
|
1365 |
remove_filter('excerpt_save_pre', 'wp_filter_post_kses'); |
|
1366 |
remove_filter('content_filtered_save_pre', 'wp_filter_post_kses'); |
|
1367 |
} |
|
1368 |
||
1369 |
/** |
|
1370 |
* Sets up most of the Kses filters for input form content. |
|
1371 |
* |
|
1372 |
* If you remove the kses_init() function from 'init' hook and |
|
1373 |
* 'set_current_user' (priority is default), then none of the Kses filter hooks |
|
1374 |
* will be added. |
|
1375 |
* |
|
1376 |
* First removes all of the Kses filters in case the current user does not need |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1377 |
* to have Kses filter the content. If the user does not have unfiltered_html |
136 | 1378 |
* capability, then Kses filters are added. |
1379 |
* |
|
1380 |
* @uses kses_remove_filters() Removes the Kses filters |
|
1381 |
* @uses kses_init_filters() Adds the Kses filters back if the user |
|
1382 |
* does not have unfiltered HTML capability. |
|
1383 |
* @since 2.0.0 |
|
1384 |
*/ |
|
1385 |
function kses_init() { |
|
1386 |
kses_remove_filters(); |
|
1387 |
||
1388 |
if (current_user_can('unfiltered_html') == false) |
|
1389 |
kses_init_filters(); |
|
1390 |
} |
|
1391 |
||
1392 |
add_action('init', 'kses_init'); |
|
1393 |
add_action('set_current_user', 'kses_init'); |
|
1394 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1395 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1396 |
* Inline CSS filter |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1397 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1398 |
* @since 2.8.1 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1399 |
*/ |
136 | 1400 |
function safecss_filter_attr( $css, $deprecated = '' ) { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1401 |
if ( !empty( $deprecated ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1402 |
_deprecated_argument( __FUNCTION__, '2.8.1' ); // Never implemented |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1403 |
|
136 | 1404 |
$css = wp_kses_no_null($css); |
1405 |
$css = str_replace(array("\n","\r","\t"), '', $css); |
|
1406 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1407 |
if ( preg_match( '%[\\(&=}]|/\*%', $css ) ) // remove any inline css containing \ ( & } = or comments |
136 | 1408 |
return ''; |
1409 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1410 |
$css_array = explode( ';', trim( $css ) ); |
136 | 1411 |
$allowed_attr = apply_filters( 'safe_style_css', array( 'text-align', 'margin', 'color', 'float', |
1412 |
'border', 'background', 'background-color', 'border-bottom', 'border-bottom-color', |
|
1413 |
'border-bottom-style', 'border-bottom-width', 'border-collapse', 'border-color', 'border-left', |
|
1414 |
'border-left-color', 'border-left-style', 'border-left-width', 'border-right', 'border-right-color', |
|
1415 |
'border-right-style', 'border-right-width', 'border-spacing', 'border-style', 'border-top', |
|
1416 |
'border-top-color', 'border-top-style', 'border-top-width', 'border-width', 'caption-side', |
|
1417 |
'clear', 'cursor', 'direction', 'font', 'font-family', 'font-size', 'font-style', |
|
1418 |
'font-variant', 'font-weight', 'height', 'letter-spacing', 'line-height', 'margin-bottom', |
|
1419 |
'margin-left', 'margin-right', 'margin-top', 'overflow', 'padding', 'padding-bottom', |
|
1420 |
'padding-left', 'padding-right', 'padding-top', 'text-decoration', 'text-indent', 'vertical-align', |
|
1421 |
'width' ) ); |
|
1422 |
||
1423 |
if ( empty($allowed_attr) ) |
|
1424 |
return $css; |
|
1425 |
||
1426 |
$css = ''; |
|
1427 |
foreach ( $css_array as $css_item ) { |
|
1428 |
if ( $css_item == '' ) |
|
1429 |
continue; |
|
1430 |
$css_item = trim( $css_item ); |
|
1431 |
$found = false; |
|
1432 |
if ( strpos( $css_item, ':' ) === false ) { |
|
1433 |
$found = true; |
|
1434 |
} else { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1435 |
$parts = explode( ':', $css_item ); |
136 | 1436 |
if ( in_array( trim( $parts[0] ), $allowed_attr ) ) |
1437 |
$found = true; |
|
1438 |
} |
|
1439 |
if ( $found ) { |
|
1440 |
if( $css != '' ) |
|
1441 |
$css .= ';'; |
|
1442 |
$css .= $css_item; |
|
1443 |
} |
|
1444 |
} |
|
1445 |
||
1446 |
return $css; |
|
1447 |
} |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1448 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1449 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1450 |
* Helper function to add global attributes to a tag in the allowed html list. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1451 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1452 |
* @since 3.5.0 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1453 |
* @access private |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1454 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1455 |
* @param array $value An array of attributes. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1456 |
* @return array The array of attributes with global attributes added. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1457 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1458 |
function _wp_add_global_attributes( $value ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1459 |
$global_attributes = array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1460 |
'class' => true, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1461 |
'id' => true, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1462 |
'style' => true, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1463 |
'title' => true, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1464 |
); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1465 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1466 |
if ( true === $value ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1467 |
$value = array(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1468 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1469 |
if ( is_array( $value ) ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1470 |
return array_merge( $value, $global_attributes ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1471 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1472 |
return $value; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1473 |
} |