| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
if (!defined('CUSTOM_TAGS')) |
|---|
| 17 |
define('CUSTOM_TAGS', false); |
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
if (!CUSTOM_TAGS) { |
|---|
| 21 |
$allowedposttags = array ('address' => array (), 'a' => array ('href' => array (), 'title' => array (), 'rel' => array (), 'rev' => array (), 'name' => array ()), 'abbr' => array ('title' => array ()), 'acronym' => array ('title' => array ()), 'b' => array (), 'big' => array (), 'blockquote' => array ('cite' => array ()), 'br' => array (), 'button' => array ('disabled' => array (), 'name' => array (), 'type' => array (), 'value' => array ()), 'caption' => array ('align' => array ()), 'code' => array (), 'col' => array ('align' => array (), 'char' => array (), 'charoff' => array (), 'span' => array (), 'valign' => array (), 'width' => array ()), 'del' => array ('datetime' => array ()), 'dd' => array (), 'div' => array ('align' => array ()), 'dl' => array (), 'dt' => array (), 'em' => array (), 'fieldset' => array (), 'font' => array ('color' => array (), 'face' => array (), 'size' => array ()), 'form' => array ('action' => array (), 'accept' => array (), 'accept-charset' => array (), 'enctype' => array (), 'method' => array (), 'name' => array (), 'target' => array ()), 'h1' => array ('align' => array ()), 'h2' => array ('align' => array ()), 'h3' => array ('align' => array ()), 'h4' => array ('align' => array ()), 'h5' => array ('align' => array ()), 'h6' => array ('align' => array ()), 'hr' => array ('align' => array (), 'noshade' => array (), 'size' => array (), 'width' => array ()), 'i' => array (), 'img' => array ('alt' => array (), 'align' => array (), 'border' => array (), 'height' => array (), 'hspace' => array (), 'longdesc' => array (), 'vspace' => array (), 'src' => array (), 'width' => array ()), 'ins' => array ('datetime' => array (), 'cite' => array ()), 'kbd' => array (), 'label' => array ('for' => array ()), 'legend' => array ('align' => array ()), 'li' => array (), 'p' => array ('align' => array ()), 'pre' => array ('width' => array ()), 'q' => array ('cite' => array ()), 's' => array (), 'strike' => array (), 'strong' => array (), 'sub' => array (), 'sup' => array (), 'table' => array ('align' => array (), 'bgcolor' => array (), 'border' => array (), 'cellpadding' => array (), 'cellspacing' => array (), 'rules' => array (), 'summary' => array (), 'width' => array ()), 'tbody' => array ('align' => array (), 'char' => array (), 'charoff' => array (), 'valign' => array ()), 'td' => array ('abbr' => array (), 'align' => array (), 'axis' => array (), 'bgcolor' => array (), 'char' => array (), 'charoff' => array (), 'colspan' => array (), 'headers' => array (), 'height' => array (), 'nowrap' => array (), 'rowspan' => array (), 'scope' => array (), 'valign' => array (), 'width' => array ()), 'textarea' => array ('cols' => array (), 'rows' => array (), 'disabled' => array (), 'name' => array (), 'readonly' => array ()), 'tfoot' => array ('align' => array (), 'char' => array (), 'charoff' => array (), 'valign' => array ()), 'th' => array ('abbr' => array (), 'align' => array (), 'axis' => array (), 'bgcolor' => array (), 'char' => array (), 'charoff' => array (), 'colspan' => array (), 'headers' => array (), 'height' => array (), 'nowrap' => array (), 'rowspan' => array (), 'scope' => array (), 'valign' => array (), 'width' => array ()), 'thead' => array ('align' => array (), 'char' => array (), 'charoff' => array (), 'valign' => array ()), 'title' => array (), 'tr' => array ('align' => array (), 'bgcolor' => array (), 'char' => array (), 'charoff' => array (), 'valign' => array ()), 'tt' => array (), 'u' => array (), 'ul' => array (), 'ol' => array (), 'var' => array () ); |
|---|
| 22 |
$allowedtags = array ('a' => array ('href' => array (), 'title' => array ()), 'abbr' => array ('title' => array ()), 'acronym' => array ('title' => array ()), 'b' => array (), 'blockquote' => array ('cite' => array ()), |
|---|
| 23 |
|
|---|
| 24 |
'code' => array (), |
|---|
| 25 |
|
|---|
| 26 |
// 'dd' => array(), |
|---|
| 27 |
// 'dl' => array(), |
|---|
| 28 |
// 'dt' => array(), |
|---|
| 29 |
'em' => array (), 'i' => array (), |
|---|
| 30 |
|
|---|
| 31 |
// 'li' => array(), |
|---|
| 32 |
// 'ol' => array(), |
|---|
| 33 |
// 'p' => array(), |
|---|
| 34 |
// 'q' => array(), |
|---|
| 35 |
'strike' => array (), 'strong' => array (), |
|---|
| 36 |
|
|---|
| 37 |
// 'sup' => array(), |
|---|
| 38 |
// 'u' => array(), |
|---|
| 39 |
// 'ul' => array(), |
|---|
| 40 |
); |
|---|
| 41 |
} |
|---|
| 42 |
function wp_kses($string, $allowed_html, $allowed_protocols = array ('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'feed', 'gopher', 'mailto')) |
|---|
| 43 |
|
|---|
| 44 |
# This function makes sure that only the allowed HTML element names, attribute |
|---|
| 45 |
# names and attribute values plus only sane HTML entities will occur in |
|---|
| 46 |
# $string. You have to remove any slashes from PHP's magic quotes before you |
|---|
| 47 |
# call this function. |
|---|
| 48 |
############################################################################### |
|---|
| 49 |
{ |
|---|
| 50 |
$string = wp_kses_no_null($string); |
|---|
| 51 |
$string = wp_kses_js_entities($string); |
|---|
| 52 |
$string = wp_kses_normalize_entities($string); |
|---|
| 53 |
$string = wp_kses_hook($string); |
|---|
| 54 |
$allowed_html_fixed = wp_kses_array_lc($allowed_html); |
|---|
| 55 |
return wp_kses_split($string, $allowed_html_fixed, $allowed_protocols); |
|---|
| 56 |
} |
|---|
| 57 |
|
|---|
| 58 |
function wp_kses_hook($string) |
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
{ |
|---|
| 63 |
return $string; |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
function wp_kses_version() |
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
{ |
|---|
| 71 |
return '0.2.2'; |
|---|
| 72 |
} |
|---|
| 73 |
|
|---|
| 74 |
function wp_kses_split($string, $allowed_html, $allowed_protocols) |
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
{ |
|---|
| 80 |
return preg_replace('%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%e', |
|---|
| 81 |
"wp_kses_split2('\\1', \$allowed_html, ".'$allowed_protocols)', $string); |
|---|
| 82 |
} |
|---|
| 83 |
|
|---|
| 84 |
function wp_kses_split2($string, $allowed_html, $allowed_protocols) |
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
{ |
|---|
| 92 |
$string = wp_kses_stripslashes($string); |
|---|
| 93 |
|
|---|
| 94 |
if (substr($string, 0, 1) != '<') |
|---|
| 95 |
return '>'; |
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
if (preg_match('%^<!--(.*?)(-->)?$%', $string, $matches)) { |
|---|
| 99 |
$string = str_replace(array('<!--', '-->'), '', $matches[1]); |
|---|
| 100 |
while ( $string != $newstring = wp_kses($string, $allowed_html, $allowed_protocols) ) |
|---|
| 101 |
$string = $newstring; |
|---|
| 102 |
if ( $string == '' ) |
|---|
| 103 |
return ''; |
|---|
| 104 |
return "<!--{$string}-->"; |
|---|
| 105 |
} |
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches)) |
|---|
| 109 |
return ''; |
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 |
$slash = trim($matches[1]); |
|---|
| 113 |
$elem = $matches[2]; |
|---|
| 114 |
$attrlist = $matches[3]; |
|---|
| 115 |
|
|---|
| 116 |
if (!@isset($allowed_html[strtolower($elem)])) |
|---|
| 117 |
return ''; |
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 |
if ($slash != '') |
|---|
| 121 |
return "<$slash$elem>"; |
|---|
| 122 |
|
|---|
| 123 |
|
|---|
| 124 |
return wp_kses_attr("$slash$elem", $attrlist, $allowed_html, $allowed_protocols); |
|---|
| 125 |
} |
|---|
| 126 |
|
|---|
| 127 |
function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) |
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 |
{ |
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
$xhtml_slash = ''; |
|---|
| 140 |
if (preg_match('%\s/\s*$%', $attr)) |
|---|
| 141 |
$xhtml_slash = ' /'; |
|---|
| 142 |
|
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 |
if (@ count($allowed_html[strtolower($element)]) == 0) |
|---|
| 146 |
return "<$element$xhtml_slash>"; |
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 |
|
|---|
| 150 |
$attrarr = wp_kses_hair($attr, $allowed_protocols); |
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 |
# in $attr2 |
|---|
| 154 |
|
|---|
| 155 |
$attr2 = ''; |
|---|
| 156 |
|
|---|
| 157 |
foreach ($attrarr as $arreach) { |
|---|
| 158 |
if (!@ isset ($allowed_html[strtolower($element)][strtolower($arreach['name'])])) |
|---|
| 159 |
continue; |
|---|
| 160 |
|
|---|
| 161 |
$current = $allowed_html[strtolower($element)][strtolower($arreach['name'])]; |
|---|
| 162 |
if ($current == '') |
|---|
| 163 |
continue; |
|---|
| 164 |
|
|---|
| 165 |
if (!is_array($current)) |
|---|
| 166 |
$attr2 .= ' '.$arreach['whole']; |
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
else { |
|---|
| 170 |
|
|---|
| 171 |
$ok = true; |
|---|
| 172 |
foreach ($current as $currkey => $currval) |
|---|
| 173 |
if (!wp_kses_check_attr_val($arreach['value'], $arreach['vless'], $currkey, $currval)) { |
|---|
| 174 |
$ok = false; |
|---|
| 175 |
break; |
|---|
| 176 |
} |
|---|
| 177 |
|
|---|
| 178 |
if ($ok) |
|---|
| 179 |
$attr2 .= ' '.$arreach['whole']; |
|---|
| 180 |
} |
|---|
| 181 |
} |
|---|
| 182 |
|
|---|
| 183 |
# Remove any "<" or ">" characters |
|---|
| 184 |
|
|---|
| 185 |
$attr2 = preg_replace('/[<>]/', '', $attr2); |
|---|
| 186 |
|
|---|
| 187 |
return "<$element$attr2$xhtml_slash>"; |
|---|
| 188 |
} |
|---|
| 189 |
|
|---|
| 190 |
function wp_kses_hair($attr, $allowed_protocols) |
|---|
| 191 |
|
|---|
| 192 |
|
|---|
| 193 |
|
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 |
{ |
|---|
| 200 |
$attrarr = array (); |
|---|
| 201 |
$mode = 0; |
|---|
| 202 |
$attrname = ''; |
|---|
| 203 |
|
|---|
| 204 |
|
|---|
| 205 |
|
|---|
| 206 |
while (strlen($attr) != 0) { |
|---|
| 207 |
$working = 0; |
|---|
| 208 |
|
|---|
| 209 |
switch ($mode) { |
|---|
| 210 |
case 0 : |
|---|
| 211 |
|
|---|
| 212 |
if (preg_match('/^([-a-zA-Z]+)/', $attr, $match)) { |
|---|
| 213 |
$attrname = $match[1]; |
|---|
| 214 |
$working = $mode = 1; |
|---|
| 215 |
$attr = preg_replace('/^[-a-zA-Z]+/', '', $attr); |
|---|
| 216 |
} |
|---|
| 217 |
|
|---|
| 218 |
break; |
|---|
| 219 |
|
|---|
| 220 |
case 1 : |
|---|
| 221 |
|
|---|
| 222 |
if (preg_match('/^\s*=\s*/', $attr)) |
|---|
| 223 |
{ |
|---|
| 224 |
$working = 1; |
|---|
| 225 |
$mode = 2; |
|---|
| 226 |
$attr = preg_replace('/^\s*=\s*/', '', $attr); |
|---|
| 227 |
break; |
|---|
| 228 |
} |
|---|
| 229 |
|
|---|
| 230 |
if (preg_match('/^\s+/', $attr)) |
|---|
| 231 |
{ |
|---|
| 232 |
$working = 1; |
|---|
| 233 |
$mode = 0; |
|---|
| 234 |
$attrarr[] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); |
|---|
| 235 |
$attr = preg_replace('/^\s+/', '', $attr); |
|---|
| 236 |
} |
|---|
| 237 |
|
|---|
| 238 |
break; |
|---|
| 239 |
|
|---|
| 240 |
case 2 : |
|---|
| 241 |
|
|---|
| 242 |
if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match)) |
|---|
| 243 |
|
|---|
| 244 |
{ |
|---|
| 245 |
$thisval = wp_kses_bad_protocol($match[1], $allowed_protocols); |
|---|
| 246 |
|
|---|
| 247 |
$attrarr[] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); |
|---|
| 248 |
$working = 1; |
|---|
| 249 |
$mode = 0; |
|---|
| 250 |
$attr = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr); |
|---|
| 251 |
break; |
|---|
| 252 |
} |
|---|
| 253 |
|
|---|
| 254 |
if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match)) |
|---|
| 255 |
|
|---|
| 256 |
{ |
|---|
| 257 |
$thisval = wp_kses_bad_protocol($match[1], $allowed_protocols); |
|---|
| 258 |
|
|---|
| 259 |
$attrarr[] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n'); |
|---|
| 260 |
$working = 1; |
|---|
| 261 |
$mode = 0; |
|---|
| 262 |
$attr = preg_replace("/^'[^']*'(\s+|$)/", '', $attr); |
|---|
| 263 |
break; |
|---|
| 264 |
} |
|---|
| 265 |
|
|---|
| 266 |
if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match)) |
|---|
| 267 |
|
|---|
| 268 |
{ |
|---|
| 269 |
$thisval = wp_kses_bad_protocol($match[1], $allowed_protocols); |
|---|
| 270 |
|
|---|
| 271 |
$attrarr[] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); |
|---|
| 272 |
|
|---|
| 273 |
$working = 1; |
|---|
| 274 |
$mode = 0; |
|---|
| 275 |
$attr = preg_replace("%^[^\s\"']+(\s+|$)%", '', $attr); |
|---|
| 276 |
} |
|---|
| 277 |
|
|---|
| 278 |
break; |
|---|
| 279 |
} |
|---|
| 280 |
|
|---|
| 281 |
if ($working == 0) |
|---|
| 282 |
{ |
|---|
| 283 |
$attr = wp_kses_html_error($attr); |
|---|
| 284 |
$mode = 0; |
|---|
| 285 |
} |
|---|
| 286 |
} |
|---|
| 287 |
|
|---|
| 288 |
if ($mode == 1) |
|---|
| 289 |
|
|---|
| 290 |
# attribute like "selected" |
|---|
| 291 |
$attrarr[] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); |
|---|
| 292 |
|
|---|
| 293 |
return $attrarr; |
|---|
| 294 |
} |
|---|
| 295 |
|
|---|
| 296 |
function wp_kses_check_attr_val($value, $vless, $checkname, $checkvalue) |
|---|
| 297 |
|
|---|
| 298 |
|
|---|
| 299 |
|
|---|
| 300 |
|
|---|
| 301 |
|
|---|
| 302 |
{ |
|---|
| 303 |
$ok = true; |
|---|
| 304 |
|
|---|
| 305 |
switch (strtolower($checkname)) { |
|---|
| 306 |
case 'maxlen' : |
|---|
| 307 |
|
|---|
| 308 |
# greater than the given value. This can be used to avoid Buffer Overflows |
|---|
| 309 |
# in WWW clients and various Internet servers. |
|---|
| 310 |
|
|---|
| 311 |
if (strlen($value) > $checkvalue) |
|---|
| 312 |
$ok = false; |
|---|
| 313 |
break; |
|---|
| 314 |
|
|---|
| 315 |
case 'minlen' : |
|---|
| 316 |
|
|---|
| 317 |
# smaller than the given value. |
|---|
| 318 |
|
|---|
| 319 |
if (strlen($value) < $checkvalue) |
|---|
| 320 |
$ok = false; |
|---|
| 321 |
break; |
|---|
| 322 |
|
|---|
| 323 |
case 'maxval' : |
|---|
| 324 |
|
|---|
| 325 |
# an integer from 0 and up, without an excessive amount of zeroes or |
|---|
| 326 |
# whitespace (to avoid Buffer Overflows). It also checks that the attribute |
|---|
| 327 |
# value is not greater than the given value. |
|---|
| 328 |
# This check can be used to avoid Denial of Service attacks. |
|---|
| 329 |
|
|---|
| 330 |
if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value)) |
|---|
| 331 |
$ok = false; |
|---|
| 332 |
if ($value > $checkvalue) |
|---|
| 333 |
$ok = false; |
|---|
| 334 |
break; |
|---|
| 335 |
|
|---|
| 336 |
case 'minval' : |
|---|
| 337 |
|
|---|
| 338 |
# and that it is not smaller than the given value. |
|---|
| 339 |
|
|---|
| 340 |
if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value)) |
|---|
| 341 |
$ok = false; |
|---|
| 342 |
if ($value < $checkvalue) |
|---|
| 343 |
$ok = false; |
|---|
| 344 |
break; |
|---|
| 345 |
|
|---|
| 346 |
case 'valueless' : |
|---|
| 347 |
|
|---|
| 348 |
# (like <a href="blah">) or not (<option selected>). If the given value |
|---|
| 349 |
# is a "y" or a "Y", the attribute must not have a value. |
|---|
| 350 |
# If the given value is an "n" or an "N", the attribute must have one. |
|---|
| 351 |
|
|---|
| 352 |
if (strtolower($checkvalue) != $vless) |
|---|
| 353 |
$ok = false; |
|---|
| 354 |
break; |
|---|
| 355 |
} |
|---|
| 356 |
|
|---|
| 357 |
return $ok; |
|---|
| 358 |
} |
|---|
| 359 |
|
|---|
| 360 |
function wp_kses_bad_protocol($string, $allowed_protocols) |
|---|
| 361 |
|
|---|
| 362 |
|
|---|
| 363 |
|
|---|
| 364 |
|
|---|
| 365 |
|
|---|
| 366 |
|
|---|
| 367 |
{ |
|---|
| 368 |
$string = wp_kses_no_null($string); |
|---|
| 369 |
$string = preg_replace('/\xad+/', '', $string); |
|---|
| 370 |
$string2 = $string.'a'; |
|---|
| 371 |
|
|---|
| 372 |
while ($string != $string2) { |
|---|
| 373 |
$string2 = $string; |
|---|
| 374 |
$string = wp_kses_bad_protocol_once($string, $allowed_protocols); |
|---|
| 375 |
} |
|---|
| 376 |
|
|---|
| 377 |
return $string; |
|---|
| 378 |
} |
|---|
| 379 |
|
|---|
| 380 |
function wp_kses_no_null($string) |
|---|
| 381 |
|
|---|
| 382 |
|
|---|
| 383 |
|
|---|
| 384 |
{ |
|---|
| 385 |
$string = preg_replace('/\0+/', '', $string); |
|---|
| 386 |
$string = preg_replace('/(\\\\0)+/', '', $string); |
|---|
| 387 |
|
|---|
| 388 |
return $string; |
|---|
| 389 |
} |
|---|
| 390 |
|
|---|
| 391 |
function wp_kses_stripslashes($string) |
|---|
| 392 |
|
|---|
| 393 |
|
|---|
| 394 |
|
|---|
| 395 |
|
|---|
| 396 |
|
|---|
| 397 |
{ |
|---|
| 398 |
return preg_replace('%\\\\"%', '"', $string); |
|---|
| 399 |
} |
|---|
| 400 |
|
|---|
| 401 |
function wp_kses_array_lc($inarray) |
|---|
| 402 |
|
|---|
| 403 |
|
|---|
| 404 |
|
|---|
| 405 |
{ |
|---|
| 406 |
$outarray = array (); |
|---|
| 407 |
|
|---|
| 408 |
foreach ($inarray as $inkey => $inval) { |
|---|
| 409 |
$outkey = strtolower($inkey); |
|---|
| 410 |
$outarray[$outkey] = array (); |
|---|
| 411 |
|
|---|
| 412 |
foreach ($inval as $inkey2 => $inval2) { |
|---|
| 413 |
$outkey2 = strtolower($inkey2); |
|---|
| 414 |
$outarray[$outkey][$outkey2] = $inval2; |
|---|
| 415 |
} |
|---|
| 416 |
} |
|---|
| 417 |
|
|---|
| 418 |
return $outarray; |
|---|
| 419 |
} |
|---|
| 420 |
|
|---|
| 421 |
function wp_kses_js_entities($string) |
|---|
| 422 |
|
|---|
| 423 |
|
|---|
| 424 |
|
|---|
| 425 |
|
|---|
| 426 |
{ |
|---|
| 427 |
return preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string); |
|---|
| 428 |
} |
|---|
| 429 |
|
|---|
| 430 |
function wp_kses_html_error($string) |
|---|
| 431 |
|
|---|
| 432 |
|
|---|
| 433 |
|
|---|
| 434 |
|
|---|
| 435 |
|
|---|
| 436 |
{ |
|---|
| 437 |
return preg_replace('/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string); |
|---|
| 438 |
} |
|---|
| 439 |
|
|---|
| 440 |
function wp_kses_bad_protocol_once($string, $allowed_protocols) |
|---|
| 441 |
|
|---|
| 442 |
|
|---|
| 443 |
|
|---|
| 444 |
|
|---|
| 445 |
{ |
|---|
| 446 |
return preg_replace('/^((&[^;]*;|[\sA-Za-z0-9])*)'.'(:|:|&#[Xx]3[Aa];)\s*/e', 'wp_kses_bad_protocol_once2("\\1", $allowed_protocols)', $string); |
|---|
| 447 |
} |
|---|
| 448 |
|
|---|
| 449 |
function wp_kses_bad_protocol_once2($string, $allowed_protocols) |
|---|
| 450 |
|
|---|
| 451 |
|
|---|
| 452 |
|
|---|
| 453 |
|
|---|
| 454 |
{ |
|---|
| 455 |
$string2 = wp_kses_decode_entities($string); |
|---|
| 456 |
$string2 = preg_replace('/\s/', '', $string2); |
|---|
| 457 |
$string2 = wp_kses_no_null($string2); |
|---|
| 458 |
$string2 = preg_replace('/\xad+/', '', $string2); |
|---|
| 459 |
|
|---|
| 460 |
$string2 = strtolower($string2); |
|---|
| 461 |
|
|---|
| 462 |
$allowed = false; |
|---|
| 463 |
foreach ($allowed_protocols as $one_protocol) |
|---|
| 464 |
if (strtolower($one_protocol) == $string2) { |
|---|
| 465 |
$allowed = true; |
|---|
| 466 |
break; |
|---|
| 467 |
} |
|---|
| 468 |
|
|---|
| 469 |
if ($allowed) |
|---|
| 470 |
return "$string2:"; |
|---|
| 471 |
else |
|---|
| 472 |
return ''; |
|---|
| 473 |
} |
|---|
| 474 |
|
|---|
| 475 |
function wp_kses_normalize_entities($string) |
|---|
| 476 |
|
|---|
| 477 |
|
|---|
| 478 |
|
|---|
| 479 |
|
|---|
| 480 |
{ |
|---|
| 481 |
|
|---|
| 482 |
|
|---|
| 483 |
$string |
|---|