Changeset 55988 for trunk/src/wp-includes/formatting.php
- Timestamp:
- 06/22/2023 02:34:56 PM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r55875 r55988 273 273 $curl = str_replace( $static_characters, $static_replacements, $curl ); 274 274 275 if ( false !== strpos( $curl, "'" ) ) {275 if ( str_contains( $curl, "'" ) ) { 276 276 $curl = preg_replace( $dynamic_characters['apos'], $dynamic_replacements['apos'], $curl ); 277 277 $curl = wptexturize_primes( $curl, "'", $prime, $open_sq_flag, $closing_single_quote ); … … 279 279 $curl = str_replace( $open_sq_flag, $opening_single_quote, $curl ); 280 280 } 281 if ( false !== strpos( $curl, '"' ) ) {281 if ( str_contains( $curl, '"' ) ) { 282 282 $curl = preg_replace( $dynamic_characters['quote'], $dynamic_replacements['quote'], $curl ); 283 283 $curl = wptexturize_primes( $curl, '"', $double_prime, $open_q_flag, $closing_quote ); 284 284 $curl = str_replace( $open_q_flag, $opening_quote, $curl ); 285 285 } 286 if ( false !== strpos( $curl, '-' ) ) {286 if ( str_contains( $curl, '-' ) ) { 287 287 $curl = preg_replace( $dynamic_characters['dash'], $dynamic_replacements['dash'], $curl ); 288 288 } … … 327 327 328 328 foreach ( $sentences as $key => &$sentence ) { 329 if ( false === strpos( $sentence, $needle ) ) {329 if ( ! str_contains( $sentence, $needle ) ) { 330 330 continue; 331 331 } elseif ( 0 !== $key && 0 === substr_count( $sentence, $close_quote ) ) { … … 363 363 $sentence = preg_replace( $quote_pattern, $close_quote, $sentence ); 364 364 } 365 if ( '"' === $needle && false !== strpos( $sentence, '"' ) ) {365 if ( '"' === $needle && str_contains( $sentence, '"' ) ) { 366 366 $sentence = str_replace( '"', $close_quote, $sentence ); 367 367 } … … 454 454 * Replace pre tags with placeholders and bring them back after autop. 455 455 */ 456 if ( str pos( $text, '<pre' ) !== false) {456 if ( str_contains( $text, '<pre' ) ) { 457 457 $text_parts = explode( '</pre>', $text ); 458 458 $last_part = array_pop( $text_parts ); … … 499 499 500 500 // Collapse line breaks before and after <option> elements so they don't get autop'd. 501 if ( str pos( $text, '<option' ) !== false) {501 if ( str_contains( $text, '<option' ) ) { 502 502 $text = preg_replace( '|\s*<option|', '<option', $text ); 503 503 $text = preg_replace( '|</option>\s*|', '</option>', $text ); … … 508 508 * so they don't get autop'd. 509 509 */ 510 if ( str pos( $text, '</object>' ) !== false) {510 if ( str_contains( $text, '</object>' ) ) { 511 511 $text = preg_replace( '|(<object[^>]*>)\s*|', '$1', $text ); 512 512 $text = preg_replace( '|\s*</object>|', '</object>', $text ); … … 518 518 * before and after <source> and <track> elements. 519 519 */ 520 if ( str pos( $text, '<source' ) !== false || strpos( $text, '<track' ) !== false) {520 if ( str_contains( $text, '<source' ) || str_contains( $text, '<track' ) ) { 521 521 $text = preg_replace( '%([<\[](?:audio|video)[^>\]]*[>\]])\s*%', '$1', $text ); 522 522 $text = preg_replace( '%\s*([<\[]/(?:audio|video)[>\]])%', '$1', $text ); … … 525 525 526 526 // Collapse line breaks before and after <figcaption> elements. 527 if ( str pos( $text, '<figcaption' ) !== false) {527 if ( str_contains( $text, '<figcaption' ) ) { 528 528 $text = preg_replace( '|\s*(<figcaption[^>]*>)|', '$1', $text ); 529 529 $text = preg_replace( '|</figcaption>\s*|', '</figcaption>', $text ); … … 594 594 595 595 // Restore newlines in all elements. 596 if ( false !== strpos( $text, '<!-- wpnl -->' ) ) {596 if ( str_contains( $text, '<!-- wpnl -->' ) ) { 597 597 $text = str_replace( array( ' <!-- wpnl --> ', '<!-- wpnl -->' ), "\n", $text ); 598 598 } … … 764 764 // Loop through delimiters (elements) only. 765 765 for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) { 766 if ( false !== strpos( $textarr[ $i ], $needle ) ) {766 if ( str_contains( $textarr[ $i ], $needle ) ) { 767 767 $textarr[ $i ] = str_replace( $needle, $replace, $textarr[ $i ] ); 768 768 $changed = true; … … 776 776 for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) { 777 777 foreach ( $needles as $needle ) { 778 if ( false !== strpos( $textarr[ $i ], $needle ) ) {778 if ( str_contains( $textarr[ $i ], $needle ) ) { 779 779 $textarr[ $i ] = strtr( $textarr[ $i ], $replace_pairs ); 780 780 $changed = true; … … 2056 2056 $filename = trim( $filename, '.-_' ); 2057 2057 2058 if ( false === strpos( $filename, '.' ) ) {2058 if ( ! str_contains( $filename, '.' ) ) { 2059 2059 $mime_types = wp_get_mime_types(); 2060 2060 $filetype = wp_check_filetype( 'test.' . $filename, $mime_types ); … … 4476 4476 } 4477 4477 4478 if ( ( false !== strpos( $url, '[' ) ) || ( false !== strpos( $url, ']' ) ) ) {4478 if ( ( str_contains( $url, '[' ) ) || ( str_contains( $url, ']' ) ) ) { 4479 4479 4480 4480 $parsed = wp_parse_url( $url ); … … 5144 5144 */ 5145 5145 function wp_pre_kses_less_than_callback( $matches ) { 5146 if ( false === strpos( $matches[0], '>' ) ) {5146 if ( ! str_contains( $matches[0], '>' ) ) { 5147 5147 return esc_html( $matches[0] ); 5148 5148 } … … 5933 5933 foreach ( $emoji as $emojum ) { 5934 5934 $emoji_char = html_entity_decode( $emojum ); 5935 if ( false !== strpos( $content, $emoji_char ) ) {5935 if ( str_contains( $content, $emoji_char ) ) { 5936 5936 $content = preg_replace( "/$emoji_char/", $emojum, $content ); 5937 5937 } … … 5950 5950 */ 5951 5951 function wp_staticize_emoji( $text ) { 5952 if ( false === strpos( $text, '&#x' ) ) {5952 if ( ! str_contains( $text, '&#x' ) ) { 5953 5953 if ( ( function_exists( 'mb_check_encoding' ) && mb_check_encoding( $text, 'ASCII' ) ) || ! preg_match( '/[^\x00-\x7F]/', $text ) ) { 5954 5954 // The text doesn't contain anything that might be emoji, so we can return early. … … 5969 5969 $possible_emoji = array(); 5970 5970 foreach ( $emoji as $emojum ) { 5971 if ( false !== strpos( $text, $emojum ) ) {5971 if ( str_contains( $text, $emojum ) ) { 5972 5972 $possible_emoji[ $emojum ] = html_entity_decode( $emojum ); 5973 5973 } … … 6007 6007 6008 6008 // If it's not a tag and not in ignore block. 6009 if ( '' === $ignore_block_element && strlen( $content ) > 0 && '<' !== $content[0] && false !== strpos( $content, '&#x' ) ) {6009 if ( '' === $ignore_block_element && strlen( $content ) > 0 && '<' !== $content[0] && str_contains( $content, '&#x' ) ) { 6010 6010 foreach ( $possible_emoji as $emojum => $emoji_char ) { 6011 if ( false === strpos( $content, $emojum ) ) {6011 if ( ! str_contains( $content, $emojum ) ) { 6012 6012 continue; 6013 6013 }
Note: See TracChangeset
for help on using the changeset viewer.