Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../public_h.../wp-inclu...
File: kses.php
[1000] Fix | Delete
/**
[1001] Fix | Delete
* Returns an array of HTML attribute names whose value contains a URL.
[1002] Fix | Delete
*
[1003] Fix | Delete
* This function returns a list of all HTML attributes that must contain
[1004] Fix | Delete
* a URL according to the HTML specification.
[1005] Fix | Delete
*
[1006] Fix | Delete
* This list includes URI attributes both allowed and disallowed by KSES.
[1007] Fix | Delete
*
[1008] Fix | Delete
* @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
[1009] Fix | Delete
*
[1010] Fix | Delete
* @since 5.0.1
[1011] Fix | Delete
*
[1012] Fix | Delete
* @return string[] HTML attribute names whose value contains a URL.
[1013] Fix | Delete
*/
[1014] Fix | Delete
function wp_kses_uri_attributes() {
[1015] Fix | Delete
$uri_attributes = array(
[1016] Fix | Delete
'action',
[1017] Fix | Delete
'archive',
[1018] Fix | Delete
'background',
[1019] Fix | Delete
'cite',
[1020] Fix | Delete
'classid',
[1021] Fix | Delete
'codebase',
[1022] Fix | Delete
'data',
[1023] Fix | Delete
'formaction',
[1024] Fix | Delete
'href',
[1025] Fix | Delete
'icon',
[1026] Fix | Delete
'longdesc',
[1027] Fix | Delete
'manifest',
[1028] Fix | Delete
'poster',
[1029] Fix | Delete
'profile',
[1030] Fix | Delete
'src',
[1031] Fix | Delete
'usemap',
[1032] Fix | Delete
'xmlns',
[1033] Fix | Delete
);
[1034] Fix | Delete
[1035] Fix | Delete
/**
[1036] Fix | Delete
* Filters the list of attributes that are required to contain a URL.
[1037] Fix | Delete
*
[1038] Fix | Delete
* Use this filter to add any `data-` attributes that are required to be
[1039] Fix | Delete
* validated as a URL.
[1040] Fix | Delete
*
[1041] Fix | Delete
* @since 5.0.1
[1042] Fix | Delete
*
[1043] Fix | Delete
* @param string[] $uri_attributes HTML attribute names whose value contains a URL.
[1044] Fix | Delete
*/
[1045] Fix | Delete
$uri_attributes = apply_filters( 'wp_kses_uri_attributes', $uri_attributes );
[1046] Fix | Delete
[1047] Fix | Delete
return $uri_attributes;
[1048] Fix | Delete
}
[1049] Fix | Delete
[1050] Fix | Delete
/**
[1051] Fix | Delete
* Callback for `wp_kses_split()`.
[1052] Fix | Delete
*
[1053] Fix | Delete
* @since 3.1.0
[1054] Fix | Delete
* @access private
[1055] Fix | Delete
* @ignore
[1056] Fix | Delete
*
[1057] Fix | Delete
* @global array[]|string $pass_allowed_html An array of allowed HTML elements and attributes,
[1058] Fix | Delete
* or a context name such as 'post'.
[1059] Fix | Delete
* @global string[] $pass_allowed_protocols Array of allowed URL protocols.
[1060] Fix | Delete
*
[1061] Fix | Delete
* @param array $matches preg_replace regexp matches
[1062] Fix | Delete
* @return string
[1063] Fix | Delete
*/
[1064] Fix | Delete
function _wp_kses_split_callback( $matches ) {
[1065] Fix | Delete
global $pass_allowed_html, $pass_allowed_protocols;
[1066] Fix | Delete
[1067] Fix | Delete
return wp_kses_split2( $matches[0], $pass_allowed_html, $pass_allowed_protocols );
[1068] Fix | Delete
}
[1069] Fix | Delete
[1070] Fix | Delete
/**
[1071] Fix | Delete
* Callback for `wp_kses_split()` for fixing malformed HTML tags.
[1072] Fix | Delete
*
[1073] Fix | Delete
* This function does a lot of work. It rejects some very malformed things like
[1074] Fix | Delete
* `<:::>`. It returns an empty string, if the element isn't allowed (look ma, no
[1075] Fix | Delete
* `strip_tags()`!). Otherwise it splits the tag into an element and an attribute
[1076] Fix | Delete
* list.
[1077] Fix | Delete
*
[1078] Fix | Delete
* After the tag is split into an element and an attribute list, it is run
[1079] Fix | Delete
* through another filter which will remove illegal attributes and once that is
[1080] Fix | Delete
* completed, will be returned.
[1081] Fix | Delete
*
[1082] Fix | Delete
* @access private
[1083] Fix | Delete
* @ignore
[1084] Fix | Delete
* @since 1.0.0
[1085] Fix | Delete
* @since 6.6.0 Recognize additional forms of invalid HTML which convert into comments.
[1086] Fix | Delete
*
[1087] Fix | Delete
* @param string $content Content to filter.
[1088] Fix | Delete
* @param array[]|string $allowed_html An array of allowed HTML elements and attributes,
[1089] Fix | Delete
* or a context name such as 'post'. See wp_kses_allowed_html()
[1090] Fix | Delete
* for the list of accepted context names.
[1091] Fix | Delete
* @param string[] $allowed_protocols Array of allowed URL protocols.
[1092] Fix | Delete
*
[1093] Fix | Delete
* @return string Fixed HTML element
[1094] Fix | Delete
*/
[1095] Fix | Delete
function wp_kses_split2( $content, $allowed_html, $allowed_protocols ) {
[1096] Fix | Delete
$content = wp_kses_stripslashes( $content );
[1097] Fix | Delete
[1098] Fix | Delete
/*
[1099] Fix | Delete
* The regex pattern used to split HTML into chunks attempts
[1100] Fix | Delete
* to split on HTML token boundaries. This function should
[1101] Fix | Delete
* thus receive chunks that _either_ start with meaningful
[1102] Fix | Delete
* syntax tokens, like a tag `<div>` or a comment `<!-- ... -->`.
[1103] Fix | Delete
*
[1104] Fix | Delete
* If the first character of the `$content` chunk _isn't_ one
[1105] Fix | Delete
* of these syntax elements, which always starts with `<`, then
[1106] Fix | Delete
* the match had to be for the final alternation of `>`. In such
[1107] Fix | Delete
* case, it's probably standing on its own and could be encoded
[1108] Fix | Delete
* with a character reference to remove ambiguity.
[1109] Fix | Delete
*
[1110] Fix | Delete
* In other words, if this chunk isn't from a match of a syntax
[1111] Fix | Delete
* token, it's just a plaintext greater-than (`>`) sign.
[1112] Fix | Delete
*/
[1113] Fix | Delete
if ( ! str_starts_with( $content, '<' ) ) {
[1114] Fix | Delete
return '&gt;';
[1115] Fix | Delete
}
[1116] Fix | Delete
[1117] Fix | Delete
/*
[1118] Fix | Delete
* When certain invalid syntax constructs appear, the HTML parser
[1119] Fix | Delete
* shifts into what's called the "bogus comment state." This is a
[1120] Fix | Delete
* plaintext state that consumes everything until the nearest `>`
[1121] Fix | Delete
* and then transforms the entire span into an HTML comment.
[1122] Fix | Delete
*
[1123] Fix | Delete
* Preserve these comments and do not treat them like tags.
[1124] Fix | Delete
*
[1125] Fix | Delete
* @see https://html.spec.whatwg.org/#bogus-comment-state
[1126] Fix | Delete
*/
[1127] Fix | Delete
if ( 1 === preg_match( '~^(?:</[^a-zA-Z][^>]*>|<![a-z][^>]*>)$~', $content ) ) {
[1128] Fix | Delete
/**
[1129] Fix | Delete
* Since the pattern matches `</…>` and also `<!…>`, this will
[1130] Fix | Delete
* preserve the type of the cleaned-up token in the output.
[1131] Fix | Delete
*/
[1132] Fix | Delete
$opener = $content[1];
[1133] Fix | Delete
$content = substr( $content, 2, -1 );
[1134] Fix | Delete
[1135] Fix | Delete
do {
[1136] Fix | Delete
$prev = $content;
[1137] Fix | Delete
$content = wp_kses( $content, $allowed_html, $allowed_protocols );
[1138] Fix | Delete
} while ( $prev !== $content );
[1139] Fix | Delete
[1140] Fix | Delete
// Recombine the modified inner content with the original token structure.
[1141] Fix | Delete
return "<{$opener}{$content}>";
[1142] Fix | Delete
}
[1143] Fix | Delete
[1144] Fix | Delete
/*
[1145] Fix | Delete
* Normative HTML comments should be handled separately as their
[1146] Fix | Delete
* parsing rules differ from those for tags and text nodes.
[1147] Fix | Delete
*/
[1148] Fix | Delete
if ( str_starts_with( $content, '<!--' ) ) {
[1149] Fix | Delete
$content = str_replace( array( '<!--', '-->' ), '', $content );
[1150] Fix | Delete
[1151] Fix | Delete
while ( ( $newstring = wp_kses( $content, $allowed_html, $allowed_protocols ) ) !== $content ) {
[1152] Fix | Delete
$content = $newstring;
[1153] Fix | Delete
}
[1154] Fix | Delete
[1155] Fix | Delete
if ( '' === $content ) {
[1156] Fix | Delete
return '';
[1157] Fix | Delete
}
[1158] Fix | Delete
[1159] Fix | Delete
// Prevent multiple dashes in comments.
[1160] Fix | Delete
$content = preg_replace( '/--+/', '-', $content );
[1161] Fix | Delete
// Prevent three dashes closing a comment.
[1162] Fix | Delete
$content = preg_replace( '/-$/', '', $content );
[1163] Fix | Delete
[1164] Fix | Delete
return "<!--{$content}-->";
[1165] Fix | Delete
}
[1166] Fix | Delete
[1167] Fix | Delete
// It's seriously malformed.
[1168] Fix | Delete
if ( ! preg_match( '%^<\s*(/\s*)?([a-zA-Z0-9-]+)([^>]*)>?$%', $content, $matches ) ) {
[1169] Fix | Delete
return '';
[1170] Fix | Delete
}
[1171] Fix | Delete
[1172] Fix | Delete
$slash = trim( $matches[1] );
[1173] Fix | Delete
$elem = $matches[2];
[1174] Fix | Delete
$attrlist = $matches[3];
[1175] Fix | Delete
[1176] Fix | Delete
if ( ! is_array( $allowed_html ) ) {
[1177] Fix | Delete
$allowed_html = wp_kses_allowed_html( $allowed_html );
[1178] Fix | Delete
}
[1179] Fix | Delete
[1180] Fix | Delete
// They are using a not allowed HTML element.
[1181] Fix | Delete
if ( ! isset( $allowed_html[ strtolower( $elem ) ] ) ) {
[1182] Fix | Delete
return '';
[1183] Fix | Delete
}
[1184] Fix | Delete
[1185] Fix | Delete
// No attributes are allowed for closing elements.
[1186] Fix | Delete
if ( '' !== $slash ) {
[1187] Fix | Delete
return "</$elem>";
[1188] Fix | Delete
}
[1189] Fix | Delete
[1190] Fix | Delete
return wp_kses_attr( $elem, $attrlist, $allowed_html, $allowed_protocols );
[1191] Fix | Delete
}
[1192] Fix | Delete
[1193] Fix | Delete
/**
[1194] Fix | Delete
* Removes all attributes, if none are allowed for this element.
[1195] Fix | Delete
*
[1196] Fix | Delete
* If some are allowed it calls `wp_kses_hair()` to split them further, and then
[1197] Fix | Delete
* it builds up new HTML code from the data that `wp_kses_hair()` returns. It also
[1198] Fix | Delete
* removes `<` and `>` characters, if there are any left. One more thing it does
[1199] Fix | Delete
* is to check if the tag has a closing XHTML slash, and if it does, it puts one
[1200] Fix | Delete
* in the returned code as well.
[1201] Fix | Delete
*
[1202] Fix | Delete
* An array of allowed values can be defined for attributes. If the attribute value
[1203] Fix | Delete
* doesn't fall into the list, the attribute will be removed from the tag.
[1204] Fix | Delete
*
[1205] Fix | Delete
* Attributes can be marked as required. If a required attribute is not present,
[1206] Fix | Delete
* KSES will remove all attributes from the tag. As KSES doesn't match opening and
[1207] Fix | Delete
* closing tags, it's not possible to safely remove the tag itself, the safest
[1208] Fix | Delete
* fallback is to strip all attributes from the tag, instead.
[1209] Fix | Delete
*
[1210] Fix | Delete
* @since 1.0.0
[1211] Fix | Delete
* @since 5.9.0 Added support for an array of allowed values for attributes.
[1212] Fix | Delete
* Added support for required attributes.
[1213] Fix | Delete
*
[1214] Fix | Delete
* @param string $element HTML element/tag.
[1215] Fix | Delete
* @param string $attr HTML attributes from HTML element to closing HTML element tag.
[1216] Fix | Delete
* @param array[]|string $allowed_html An array of allowed HTML elements and attributes,
[1217] Fix | Delete
* or a context name such as 'post'. See wp_kses_allowed_html()
[1218] Fix | Delete
* for the list of accepted context names.
[1219] Fix | Delete
* @param string[] $allowed_protocols Array of allowed URL protocols.
[1220] Fix | Delete
* @return string Sanitized HTML element.
[1221] Fix | Delete
*/
[1222] Fix | Delete
function wp_kses_attr( $element, $attr, $allowed_html, $allowed_protocols ) {
[1223] Fix | Delete
if ( ! is_array( $allowed_html ) ) {
[1224] Fix | Delete
$allowed_html = wp_kses_allowed_html( $allowed_html );
[1225] Fix | Delete
}
[1226] Fix | Delete
[1227] Fix | Delete
// Is there a closing XHTML slash at the end of the attributes?
[1228] Fix | Delete
$xhtml_slash = '';
[1229] Fix | Delete
if ( preg_match( '%\s*/\s*$%', $attr ) ) {
[1230] Fix | Delete
$xhtml_slash = ' /';
[1231] Fix | Delete
}
[1232] Fix | Delete
[1233] Fix | Delete
// Are any attributes allowed at all for this element?
[1234] Fix | Delete
$element_low = strtolower( $element );
[1235] Fix | Delete
if ( empty( $allowed_html[ $element_low ] ) || true === $allowed_html[ $element_low ] ) {
[1236] Fix | Delete
return "<$element$xhtml_slash>";
[1237] Fix | Delete
}
[1238] Fix | Delete
[1239] Fix | Delete
// Split it.
[1240] Fix | Delete
$attrarr = wp_kses_hair( $attr, $allowed_protocols );
[1241] Fix | Delete
[1242] Fix | Delete
// Check if there are attributes that are required.
[1243] Fix | Delete
$required_attrs = array_filter(
[1244] Fix | Delete
$allowed_html[ $element_low ],
[1245] Fix | Delete
static function ( $required_attr_limits ) {
[1246] Fix | Delete
return isset( $required_attr_limits['required'] ) && true === $required_attr_limits['required'];
[1247] Fix | Delete
}
[1248] Fix | Delete
);
[1249] Fix | Delete
[1250] Fix | Delete
/*
[1251] Fix | Delete
* If a required attribute check fails, we can return nothing for a self-closing tag,
[1252] Fix | Delete
* but for a non-self-closing tag the best option is to return the element with attributes,
[1253] Fix | Delete
* as KSES doesn't handle matching the relevant closing tag.
[1254] Fix | Delete
*/
[1255] Fix | Delete
$stripped_tag = '';
[1256] Fix | Delete
if ( empty( $xhtml_slash ) ) {
[1257] Fix | Delete
$stripped_tag = "<$element>";
[1258] Fix | Delete
}
[1259] Fix | Delete
[1260] Fix | Delete
// Go through $attrarr, and save the allowed attributes for this element in $attr2.
[1261] Fix | Delete
$attr2 = '';
[1262] Fix | Delete
foreach ( $attrarr as $arreach ) {
[1263] Fix | Delete
// Check if this attribute is required.
[1264] Fix | Delete
$required = isset( $required_attrs[ strtolower( $arreach['name'] ) ] );
[1265] Fix | Delete
[1266] Fix | Delete
if ( wp_kses_attr_check( $arreach['name'], $arreach['value'], $arreach['whole'], $arreach['vless'], $element, $allowed_html ) ) {
[1267] Fix | Delete
$attr2 .= ' ' . $arreach['whole'];
[1268] Fix | Delete
[1269] Fix | Delete
// If this was a required attribute, we can mark it as found.
[1270] Fix | Delete
if ( $required ) {
[1271] Fix | Delete
unset( $required_attrs[ strtolower( $arreach['name'] ) ] );
[1272] Fix | Delete
}
[1273] Fix | Delete
} elseif ( $required ) {
[1274] Fix | Delete
// This attribute was required, but didn't pass the check. The entire tag is not allowed.
[1275] Fix | Delete
return $stripped_tag;
[1276] Fix | Delete
}
[1277] Fix | Delete
}
[1278] Fix | Delete
[1279] Fix | Delete
// If some required attributes weren't set, the entire tag is not allowed.
[1280] Fix | Delete
if ( ! empty( $required_attrs ) ) {
[1281] Fix | Delete
return $stripped_tag;
[1282] Fix | Delete
}
[1283] Fix | Delete
[1284] Fix | Delete
// Remove any "<" or ">" characters.
[1285] Fix | Delete
$attr2 = preg_replace( '/[<>]/', '', $attr2 );
[1286] Fix | Delete
[1287] Fix | Delete
return "<$element$attr2$xhtml_slash>";
[1288] Fix | Delete
}
[1289] Fix | Delete
[1290] Fix | Delete
/**
[1291] Fix | Delete
* Determines whether an attribute is allowed.
[1292] Fix | Delete
*
[1293] Fix | Delete
* @since 4.2.3
[1294] Fix | Delete
* @since 5.0.0 Added support for `data-*` wildcard attributes.
[1295] Fix | Delete
*
[1296] Fix | Delete
* @param string $name The attribute name. Passed by reference. Returns empty string when not allowed.
[1297] Fix | Delete
* @param string $value The attribute value. Passed by reference. Returns a filtered value.
[1298] Fix | Delete
* @param string $whole The `name=value` input. Passed by reference. Returns filtered input.
[1299] Fix | Delete
* @param string $vless Whether the attribute is valueless. Use 'y' or 'n'.
[1300] Fix | Delete
* @param string $element The name of the element to which this attribute belongs.
[1301] Fix | Delete
* @param array $allowed_html The full list of allowed elements and attributes.
[1302] Fix | Delete
* @return bool Whether or not the attribute is allowed.
[1303] Fix | Delete
*/
[1304] Fix | Delete
function wp_kses_attr_check( &$name, &$value, &$whole, $vless, $element, $allowed_html ) {
[1305] Fix | Delete
$name_low = strtolower( $name );
[1306] Fix | Delete
$element_low = strtolower( $element );
[1307] Fix | Delete
[1308] Fix | Delete
if ( ! isset( $allowed_html[ $element_low ] ) ) {
[1309] Fix | Delete
$name = '';
[1310] Fix | Delete
$value = '';
[1311] Fix | Delete
$whole = '';
[1312] Fix | Delete
return false;
[1313] Fix | Delete
}
[1314] Fix | Delete
[1315] Fix | Delete
$allowed_attr = $allowed_html[ $element_low ];
[1316] Fix | Delete
[1317] Fix | Delete
if ( ! isset( $allowed_attr[ $name_low ] ) || '' === $allowed_attr[ $name_low ] ) {
[1318] Fix | Delete
/*
[1319] Fix | Delete
* Allow `data-*` attributes.
[1320] Fix | Delete
*
[1321] Fix | Delete
* When specifying `$allowed_html`, the attribute name should be set as
[1322] Fix | Delete
* `data-*` (not to be mixed with the HTML 4.0 `data` attribute, see
[1323] Fix | Delete
* https://www.w3.org/TR/html40/struct/objects.html#adef-data).
[1324] Fix | Delete
*
[1325] Fix | Delete
* Note: the attribute name should only contain `A-Za-z0-9_-` chars.
[1326] Fix | Delete
*/
[1327] Fix | Delete
if ( str_starts_with( $name_low, 'data-' ) && ! empty( $allowed_attr['data-*'] )
[1328] Fix | Delete
&& preg_match( '/^data-[a-z0-9_-]+$/', $name_low, $match )
[1329] Fix | Delete
) {
[1330] Fix | Delete
/*
[1331] Fix | Delete
* Add the whole attribute name to the allowed attributes and set any restrictions
[1332] Fix | Delete
* for the `data-*` attribute values for the current element.
[1333] Fix | Delete
*/
[1334] Fix | Delete
$allowed_attr[ $match[0] ] = $allowed_attr['data-*'];
[1335] Fix | Delete
} else {
[1336] Fix | Delete
$name = '';
[1337] Fix | Delete
$value = '';
[1338] Fix | Delete
$whole = '';
[1339] Fix | Delete
return false;
[1340] Fix | Delete
}
[1341] Fix | Delete
}
[1342] Fix | Delete
[1343] Fix | Delete
if ( 'style' === $name_low ) {
[1344] Fix | Delete
$new_value = safecss_filter_attr( $value );
[1345] Fix | Delete
[1346] Fix | Delete
if ( empty( $new_value ) ) {
[1347] Fix | Delete
$name = '';
[1348] Fix | Delete
$value = '';
[1349] Fix | Delete
$whole = '';
[1350] Fix | Delete
return false;
[1351] Fix | Delete
}
[1352] Fix | Delete
[1353] Fix | Delete
$whole = str_replace( $value, $new_value, $whole );
[1354] Fix | Delete
$value = $new_value;
[1355] Fix | Delete
}
[1356] Fix | Delete
[1357] Fix | Delete
if ( is_array( $allowed_attr[ $name_low ] ) ) {
[1358] Fix | Delete
// There are some checks.
[1359] Fix | Delete
foreach ( $allowed_attr[ $name_low ] as $currkey => $currval ) {
[1360] Fix | Delete
if ( ! wp_kses_check_attr_val( $value, $vless, $currkey, $currval ) ) {
[1361] Fix | Delete
$name = '';
[1362] Fix | Delete
$value = '';
[1363] Fix | Delete
$whole = '';
[1364] Fix | Delete
return false;
[1365] Fix | Delete
}
[1366] Fix | Delete
}
[1367] Fix | Delete
}
[1368] Fix | Delete
[1369] Fix | Delete
return true;
[1370] Fix | Delete
}
[1371] Fix | Delete
[1372] Fix | Delete
/**
[1373] Fix | Delete
* Builds an attribute list from string containing attributes.
[1374] Fix | Delete
*
[1375] Fix | Delete
* This function does a lot of work. It parses an attribute list into an array
[1376] Fix | Delete
* with attribute data, and tries to do the right thing even if it gets weird
[1377] Fix | Delete
* input. It will add quotes around attribute values that don't have any quotes
[1378] Fix | Delete
* or apostrophes around them, to make it easier to produce HTML code that will
[1379] Fix | Delete
* conform to W3C's HTML specification. It will also remove bad URL protocols
[1380] Fix | Delete
* from attribute values. It also reduces duplicate attributes by using the
[1381] Fix | Delete
* attribute defined first (`foo='bar' foo='baz'` will result in `foo='bar'`).
[1382] Fix | Delete
*
[1383] Fix | Delete
* @since 1.0.0
[1384] Fix | Delete
*
[1385] Fix | Delete
* @param string $attr Attribute list from HTML element to closing HTML element tag.
[1386] Fix | Delete
* @param string[] $allowed_protocols Array of allowed URL protocols.
[1387] Fix | Delete
* @return array[] Array of attribute information after parsing.
[1388] Fix | Delete
*/
[1389] Fix | Delete
function wp_kses_hair( $attr, $allowed_protocols ) {
[1390] Fix | Delete
$attrarr = array();
[1391] Fix | Delete
$mode = 0;
[1392] Fix | Delete
$attrname = '';
[1393] Fix | Delete
$uris = wp_kses_uri_attributes();
[1394] Fix | Delete
[1395] Fix | Delete
// Loop through the whole attribute list.
[1396] Fix | Delete
[1397] Fix | Delete
while ( strlen( $attr ) !== 0 ) {
[1398] Fix | Delete
$working = 0; // Was the last operation successful?
[1399] Fix | Delete
[1400] Fix | Delete
switch ( $mode ) {
[1401] Fix | Delete
case 0:
[1402] Fix | Delete
if ( preg_match( '/^([_a-zA-Z][-_a-zA-Z0-9:.]*)/', $attr, $match ) ) {
[1403] Fix | Delete
$attrname = $match[1];
[1404] Fix | Delete
$working = 1;
[1405] Fix | Delete
$mode = 1;
[1406] Fix | Delete
$attr = preg_replace( '/^[_a-zA-Z][-_a-zA-Z0-9:.]*/', '', $attr );
[1407] Fix | Delete
}
[1408] Fix | Delete
[1409] Fix | Delete
break;
[1410] Fix | Delete
[1411] Fix | Delete
case 1:
[1412] Fix | Delete
if ( preg_match( '/^\s*=\s*/', $attr ) ) { // Equals sign.
[1413] Fix | Delete
$working = 1;
[1414] Fix | Delete
$mode = 2;
[1415] Fix | Delete
$attr = preg_replace( '/^\s*=\s*/', '', $attr );
[1416] Fix | Delete
break;
[1417] Fix | Delete
}
[1418] Fix | Delete
[1419] Fix | Delete
if ( preg_match( '/^\s+/', $attr ) ) { // Valueless.
[1420] Fix | Delete
$working = 1;
[1421] Fix | Delete
$mode = 0;
[1422] Fix | Delete
[1423] Fix | Delete
if ( false === array_key_exists( $attrname, $attrarr ) ) {
[1424] Fix | Delete
$attrarr[ $attrname ] = array(
[1425] Fix | Delete
'name' => $attrname,
[1426] Fix | Delete
'value' => '',
[1427] Fix | Delete
'whole' => $attrname,
[1428] Fix | Delete
'vless' => 'y',
[1429] Fix | Delete
);
[1430] Fix | Delete
}
[1431] Fix | Delete
[1432] Fix | Delete
$attr = preg_replace( '/^\s+/', '', $attr );
[1433] Fix | Delete
}
[1434] Fix | Delete
[1435] Fix | Delete
break;
[1436] Fix | Delete
[1437] Fix | Delete
case 2:
[1438] Fix | Delete
if ( preg_match( '%^"([^"]*)"(\s+|/?$)%', $attr, $match ) ) {
[1439] Fix | Delete
// "value"
[1440] Fix | Delete
$thisval = $match[1];
[1441] Fix | Delete
if ( in_array( strtolower( $attrname ), $uris, true ) ) {
[1442] Fix | Delete
$thisval = wp_kses_bad_protocol( $thisval, $allowed_protocols );
[1443] Fix | Delete
}
[1444] Fix | Delete
[1445] Fix | Delete
if ( false === array_key_exists( $attrname, $attrarr ) ) {
[1446] Fix | Delete
$attrarr[ $attrname ] = array(
[1447] Fix | Delete
'name' => $attrname,
[1448] Fix | Delete
'value' => $thisval,
[1449] Fix | Delete
'whole' => "$attrname=\"$thisval\"",
[1450] Fix | Delete
'vless' => 'n',
[1451] Fix | Delete
);
[1452] Fix | Delete
}
[1453] Fix | Delete
[1454] Fix | Delete
$working = 1;
[1455] Fix | Delete
$mode = 0;
[1456] Fix | Delete
$attr = preg_replace( '/^"[^"]*"(\s+|$)/', '', $attr );
[1457] Fix | Delete
break;
[1458] Fix | Delete
}
[1459] Fix | Delete
[1460] Fix | Delete
if ( preg_match( "%^'([^']*)'(\s+|/?$)%", $attr, $match ) ) {
[1461] Fix | Delete
// 'value'
[1462] Fix | Delete
$thisval = $match[1];
[1463] Fix | Delete
if ( in_array( strtolower( $attrname ), $uris, true ) ) {
[1464] Fix | Delete
$thisval = wp_kses_bad_protocol( $thisval, $allowed_protocols );
[1465] Fix | Delete
}
[1466] Fix | Delete
[1467] Fix | Delete
if ( false === array_key_exists( $attrname, $attrarr ) ) {
[1468] Fix | Delete
$attrarr[ $attrname ] = array(
[1469] Fix | Delete
'name' => $attrname,
[1470] Fix | Delete
'value' => $thisval,
[1471] Fix | Delete
'whole' => "$attrname='$thisval'",
[1472] Fix | Delete
'vless' => 'n',
[1473] Fix | Delete
);
[1474] Fix | Delete
}
[1475] Fix | Delete
[1476] Fix | Delete
$working = 1;
[1477] Fix | Delete
$mode = 0;
[1478] Fix | Delete
$attr = preg_replace( "/^'[^']*'(\s+|$)/", '', $attr );
[1479] Fix | Delete
break;
[1480] Fix | Delete
}
[1481] Fix | Delete
[1482] Fix | Delete
if ( preg_match( "%^([^\s\"']+)(\s+|/?$)%", $attr, $match ) ) {
[1483] Fix | Delete
// value
[1484] Fix | Delete
$thisval = $match[1];
[1485] Fix | Delete
if ( in_array( strtolower( $attrname ), $uris, true ) ) {
[1486] Fix | Delete
$thisval = wp_kses_bad_protocol( $thisval, $allowed_protocols );
[1487] Fix | Delete
}
[1488] Fix | Delete
[1489] Fix | Delete
if ( false === array_key_exists( $attrname, $attrarr ) ) {
[1490] Fix | Delete
$attrarr[ $attrname ] = array(
[1491] Fix | Delete
'name' => $attrname,
[1492] Fix | Delete
'value' => $thisval,
[1493] Fix | Delete
'whole' => "$attrname=\"$thisval\"",
[1494] Fix | Delete
'vless' => 'n',
[1495] Fix | Delete
);
[1496] Fix | Delete
}
[1497] Fix | Delete
[1498] Fix | Delete
// We add quotes to conform to W3C's HTML spec.
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function