@ 2016-11-09T12:36:12Z <?php
function wp_kses_split( $string, $allowed_html, $allowed_protocols ) {
return preg_replace_callback( '%(<!--.*?(-->|$))|(<[^>]*(>|$)|>)%', function( $match ) use ($allowed_html, $allowed_protocols) {
return wp_kses_split2( $match[0], $allowed_html, $allowed_protocols );
}, $string );
}
function wp_kses_split2($string, $allowed_html, $allowed_protocols) {
$string = str_replace( '\\"', '"', $string );
if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches)) {
return '';
}
$slash = trim($matches[1]);
$elem = $matches[2];
$attrlist = $matches[3];
if ($slash != '')
return "</$elem>";
return wp_kses_attr( $elem, $attrlist, $allowed_html, $allowed_protocols );
}
function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) {
$attrarr = array( array( 'name' => 'style', 'value' => '', 'whole' => "name=''", 'vless' => 'style' ) );
// Go through $attrarr, and save the allowed attributes for this element
// in $attr2
$attr2 = '';
foreach ( $attrarr as $arreach ) {
if ( wp_kses_attr_check( $arreach['name'], $arreach['value'], $arreach['whole'], $arreach['vless'], $element, $allowed_html ) ) {
$attr2 .= ' '.$arreach['whole'];
}
}
return "<$element$attr2>";
}
function wp_kses_attr_check( &$name, &$value, &$whole, $vless, $element, $allowed_html ) {
$allowed_attr = $allowed_html[strtolower( $element )];
$name_low = strtolower( $name );
if ( ! isset( $allowed_attr[$name_low] ) || '' == $allowed_attr[$name_low] ) {
$name = $value = $whole = '';
return false;
}
if ( 'style' == $name_low ) {
$new_value = safecss_filter_attr( $value );
if ( empty( $new_value ) ) {
$name = $value = $whole = '';
return false;
}
$whole = str_replace( $value, $new_value, $whole );
$value = $new_value;
}
return true;
}
function safecss_filter_attr( $css, $element = 'div' ) {
$css = $element . ' {' . $css . '}';
$css = wp_kses_split( $css, array(), array() );
$old = @setlocale(LC_ALL, 0);
@setlocale(LC_ALL, 'C');
preg_match( "/[^\s\r\n\t\f]/", $css{0} );
@setlocale(LC_ALL, $old);
return '';
}
var_dump(PCRE_VERSION);
$content = '<p style="">hola</p><p style="">hola</p>';
var_dump( wp_kses_split( addslashes( $content ), array('p'=>array('style' => array())), array() ) );
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.4.1 - 8.4.12 Parse error: syntax error, unexpected token "{", expecting ")" in /in/4IVgb on line 57
Process exited with code 255 . Output for 8.0.0 - 8.0.30 , 8.1.0 - 8.1.33 , 8.2.0 - 8.2.29 , 8.3.0 - 8.3.25 Fatal error: Array and string offset access syntax with curly braces is no longer supported in /in/4IVgb on line 57
Process exited with code 255 . Output for 7.4.12 - 7.4.33 Deprecated: Array and string offset access syntax with curly braces is deprecated in /in/4IVgb on line 57
string(16) "10.35 2020-05-09"
string(22) "<p>hola</p><p>hola</p>"
Output for 7.4.6 - 7.4.11 Deprecated: Array and string offset access syntax with curly braces is deprecated in /in/4IVgb on line 57
string(16) "10.34 2019-11-21"
string(22) "<p>hola</p><p>hola</p>"
Output for 7.4.0 - 7.4.5 Deprecated: Array and string offset access syntax with curly braces is deprecated in /in/4IVgb on line 57
string(16) "10.33 2019-04-16"
string(22) "<p>hola</p><p>hola</p>"
Output for 7.3.0 - 7.3.33 string(16) "10.32 2018-09-10"
string(22) "<p>hola</p><p>hola</p>"
Output for 7.2.0 - 7.2.33 string(15) "8.41 2017-07-05"
string(22) "<p>hola</p><p>hola</p>"
Output for 5.6.18 - 5.6.40 , 7.0.3 - 7.0.33 , 7.1.0 - 7.1.33 string(15) "8.38 2015-11-23"
string(22) "<p>hola</p><p>hola</p>"
Output for 5.6.11 - 5.6.17 , 7.0.0 - 7.0.2 string(15) "8.37 2015-04-28"
string(22) "<p>hola</p><p>hola</p>"
Output for 5.6.9 - 5.6.10 string(15) "8.36 2014-09-26"
string(22) "<p>hola</p><p>hola</p>"
Output for 5.6.0 - 5.6.8 string(15) "8.34 2013-12-15"
string(22) "<p>hola</p><p>hola</p>"
preferences:dark mode live preview ace vim emacs key bindings
140.97 ms | 419 KiB | 5 Q