Changeset 56191 for trunk/src/wp-includes/formatting.php
- Timestamp:
- 07/10/2023 10:36:06 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r56132 r56191 137 137 $static_replacements = array_merge( array( '…', $opening_quote, $closing_quote, ' ™' ), $cockneyreplace ); 138 138 139 // Pattern-based replacements of characters. 140 // Sort the remaining patterns into several arrays for performance tuning. 139 /* 140 * Pattern-based replacements of characters. 141 * Sort the remaining patterns into several arrays for performance tuning. 142 */ 141 143 $dynamic_characters = array( 142 144 'apos' => array(), … … 341 343 $pos = strrpos( $sentence, "$flag." ); 342 344 } else { 343 // When all else fails, make the rightmost candidate a closing quote. 344 // This is most likely to be problematic in the context of bug #18549. 345 /* 346 * When all else fails, make the rightmost candidate a closing quote. 347 * This is most likely to be problematic in the context of bug #18549. 348 */ 345 349 $pos = strrpos( $sentence, $flag ); 346 350 } … … 977 981 978 982 if ( ! $double_encode ) { 979 // Guarantee every &entity; is valid, convert &garbage; into &garbage; 980 // This is required for PHP < 5.4.0 because ENT_HTML401 flag is unavailable. 983 /* 984 * Guarantee every &entity; is valid, convert &garbage; into &garbage; 985 * This is required for PHP < 5.4.0 because ENT_HTML401 flag is unavailable. 986 */ 981 987 $text = wp_kses_normalize_entities( $text, ( $quote_style & ENT_XML1 ) ? 'xml' : 'html' ); 982 988 } … … 1602 1608 if ( seems_utf8( $text ) ) { 1603 1609 1604 // Unicode sequence normalization from NFD (Normalization Form Decomposed) 1605 // to NFC (Normalization Form [Pre]Composed), the encoding used in this function. 1610 /* 1611 * Unicode sequence normalization from NFD (Normalization Form Decomposed) 1612 * to NFC (Normalization Form [Pre]Composed), the encoding used in this function. 1613 */ 1606 1614 if ( function_exists( 'normalizer_is_normalized' ) 1607 1615 && function_exists( 'normalizer_normalize' ) … … 1818 1826 // GBP (Pound) sign. 1819 1827 '£' => '', 1820 // Vowels with diacritic (Vietnamese). 1821 // Unmarked. 1828 // Vowels with diacritic (Vietnamese). Unmarked. 1822 1829 'Ơ' => 'O', 1823 1830 'ơ' => 'o', … … 2662 2669 } 2663 2670 } else { // Begin tag. 2664 if ( $has_self_closer ) { // If it presents itself as a self-closing tag... 2665 // ...but it isn't a known single-entity self-closing tag, then don't let it be treated as such 2666 // and immediately close it with a closing tag (the tag will encapsulate no text as a result). 2671 if ( $has_self_closer ) { 2672 /* 2673 * If it presents itself as a self-closing tag, but it isn't a known single-entity self-closing tag, 2674 * then don't let it be treated as such and immediately close it with a closing tag. 2675 * The tag will encapsulate no text as a result. 2676 */ 2667 2677 if ( ! $is_single_tag ) { 2668 2678 $attributes = trim( substr( $attributes, 0, -1 ) ) . "></$tag"; 2669 2679 } 2670 } elseif ( $is_single_tag ) { // Else if it's a known single-entity tag but it doesn't close itself, do so. 2680 } elseif ( $is_single_tag ) { 2681 // Else if it's a known single-entity tag but it doesn't close itself, do so. 2671 2682 $pre_attribute_ws = ' '; 2672 2683 $attributes .= '/'; 2673 } else { // It's not a single-entity tag. 2674 // If the top of the stack is the same as the tag we want to push, close previous tag. 2684 } else { 2685 /* 2686 * It's not a single-entity tag. 2687 * If the top of the stack is the same as the tag we want to push, close previous tag. 2688 */ 2675 2689 if ( $stacksize > 0 && ! in_array( $tag, $nestable_tags, true ) && $tagstack[ $stacksize - 1 ] === $tag ) { 2676 2690 $tagqueue = '</' . array_pop( $tagstack ) . '>'; … … 2926 2940 2927 2941 if ( ')' === $matches[3] && strpos( $url, '(' ) ) { 2928 // If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it, 2929 // add the closing parenthesis to the URL. Then we can let the parenthesis balancer do its thing below. 2942 /* 2943 * If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it, 2944 * add the closing parenthesis to the URL. Then we can let the parenthesis balancer do its thing below. 2945 */ 2930 2946 $url .= $matches[3]; 2931 2947 $suffix = ''; … … 3107 3123 (\)?) # 3: Trailing closing parenthesis (for parethesis balancing post processing). 3108 3124 ~xS'; 3109 // The regex is a non-anchored pattern and does not have a single fixed starting character. 3110 // Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times. 3125 /* 3126 * The regex is a non-anchored pattern and does not have a single fixed starting character. 3127 * Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times. 3128 */ 3111 3129 3112 3130 $ret = preg_replace_callback( $url_clickable, '_make_url_clickable_cb', $ret ); … … 3557 3575 list( $local, $domain ) = explode( '@', $email, 2 ); 3558 3576 3559 // LOCAL PART 3560 // Test for invalid characters. 3577 /* 3578 * LOCAL PART 3579 * Test for invalid characters. 3580 */ 3561 3581 if ( ! preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) { 3562 3582 /** This filter is documented in wp-includes/formatting.php */ … … 3564 3584 } 3565 3585 3566 // DOMAIN PART 3567 // Test for sequences of periods. 3586 /* 3587 * DOMAIN PART 3588 * Test for sequences of periods. 3589 */ 3568 3590 if ( preg_match( '/\.{2,}/', $domain ) ) { 3569 3591 /** This filter is documented in wp-includes/formatting.php */ … … 3767 3789 list( $local, $domain ) = explode( '@', $email, 2 ); 3768 3790 3769 // LOCAL PART 3770 // Test for invalid characters. 3791 /* 3792 * LOCAL PART 3793 * Test for invalid characters. 3794 */ 3771 3795 $local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local ); 3772 3796 if ( '' === $local ) { … … 3775 3799 } 3776 3800 3777 // DOMAIN PART 3778 // Test for sequences of periods. 3801 /* 3802 * DOMAIN PART 3803 * Test for sequences of periods. 3804 */ 3779 3805 $domain = preg_replace( '/\.{2,}/', '', $domain ); 3780 3806 if ( '' === $domain ) {
Note: See TracChangeset
for help on using the changeset viewer.