Changeset 57056 for trunk/src/wp-includes/kses.php
- Timestamp:
- 11/03/2023 03:31:51 PM (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/kses.php
r56617 r57056 1537 1537 } 1538 1538 1539 // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation1540 1539 $regex = 1541 '(?: '1542 . '[_a-zA-Z][-_a-zA-Z0-9:.]*' //Attribute name.1543 . '|'1544 . '\[\[?[^\[\]]+\]\]?' //Shortcode in the name position implies unfiltered_html.1545 . ')'1546 . '(?:' //Attribute value.1547 . '\s*=\s*' // All values begin with '='.1548 . '(?:'1549 . '"[^"]*"' //Double-quoted.1550 . '|'1551 . "'[^']*'" //Single-quoted.1552 . '|'1553 . '[^\s"\']+' //Non-quoted.1554 . '(?:\s|$)' //Must have a space.1555 . ')'1556 . '|'1557 . '(?:\s|$)' //If attribute has no value, space is required.1558 . ')'1559 . '\s*'; //Trailing space is optional except as mentioned above.1560 // phpcs:enable1540 '(?: 1541 [_a-zA-Z][-_a-zA-Z0-9:.]* # Attribute name. 1542 | 1543 \[\[?[^\[\]]+\]\]? # Shortcode in the name position implies unfiltered_html. 1544 ) 1545 (?: # Attribute value. 1546 \s*=\s* # All values begin with "=". 1547 (?: 1548 "[^"]*" # Double-quoted. 1549 | 1550 \'[^\']*\' # Single-quoted. 1551 | 1552 [^\s"\']+ # Non-quoted. 1553 (?:\s|$) # Must have a space. 1554 ) 1555 | 1556 (?:\s|$) # If attribute has no value, space is required. 1557 ) 1558 \s* # Trailing space is optional except as mentioned above. 1559 '; 1561 1560 1562 1561 /* 1563 1562 * Although it is possible to reduce this procedure to a single regexp, 1564 1563 * we must run that regexp twice to get exactly the expected result. 1564 * 1565 * Note: do NOT remove the `x` modifiers as they are essential for the above regex! 1565 1566 */ 1566 1567 1567 $validation = "%^($regex)+$% ";1568 $extraction = "%$regex% ";1568 $validation = "%^($regex)+$%x"; 1569 $extraction = "%$regex%x"; 1569 1570 1570 1571 if ( 1 === preg_match( $validation, $attr ) ) {
Note: See TracChangeset
for help on using the changeset viewer.