Merged in feature/81-dev-dev01 (pull request #5)
auto-patch 81-dev-dev01-2023-12-05T22_45_26 * auto-patch 81-dev-dev01-2023-12-05T22_45_26
This commit is contained in:
@@ -354,7 +354,7 @@ function wptexturize_primes( $haystack, $needle, $prime, $open_quote, $close_quo
|
||||
$sentence = preg_replace( $prime_pattern, $prime, $sentence );
|
||||
$sentence = preg_replace( $flag_after_digit, $prime, $sentence );
|
||||
$sentence = str_replace( $flag, $close_quote, $sentence );
|
||||
} elseif ( 1 == $count ) {
|
||||
} elseif ( 1 === $count ) {
|
||||
// Found only one closing quote candidate, so give it priority over primes.
|
||||
$sentence = str_replace( $flag, $close_quote, $sentence );
|
||||
$sentence = preg_replace( $prime_pattern, $prime, $sentence );
|
||||
@@ -422,7 +422,7 @@ function _wptexturize_pushpop_element( $text, &$stack, $disabled_elements ) {
|
||||
*/
|
||||
|
||||
array_push( $stack, $tag );
|
||||
} elseif ( end( $stack ) == $tag ) {
|
||||
} elseif ( end( $stack ) === $tag ) {
|
||||
array_pop( $stack );
|
||||
}
|
||||
}
|
||||
@@ -476,7 +476,7 @@ function wpautop( $text, $br = true ) {
|
||||
$pre_tags[ $name ] = substr( $text_part, $start ) . '</pre>';
|
||||
|
||||
$text .= substr( $text_part, 0, $start ) . $name;
|
||||
$i++;
|
||||
++$i;
|
||||
}
|
||||
|
||||
$text .= $last_part;
|
||||
@@ -831,7 +831,7 @@ function shortcode_unautop( $text ) {
|
||||
$tagregexp = implode( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) );
|
||||
$spaces = wp_spaces_regexp();
|
||||
|
||||
// phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound,WordPress.WhiteSpace.PrecisionAlignment.Found -- don't remove regex indentation
|
||||
// phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound,Universal.WhiteSpace.PrecisionAlignment.Found -- don't remove regex indentation
|
||||
$pattern =
|
||||
'/'
|
||||
. '<p>' // Opening paragraph.
|
||||
@@ -884,29 +884,33 @@ function seems_utf8( $str ) {
|
||||
mbstring_binary_safe_encoding();
|
||||
$length = strlen( $str );
|
||||
reset_mbstring_encoding();
|
||||
|
||||
for ( $i = 0; $i < $length; $i++ ) {
|
||||
$c = ord( $str[ $i ] );
|
||||
|
||||
if ( $c < 0x80 ) {
|
||||
$n = 0; // 0bbbbbbb
|
||||
} elseif ( ( $c & 0xE0 ) == 0xC0 ) {
|
||||
} elseif ( ( $c & 0xE0 ) === 0xC0 ) {
|
||||
$n = 1; // 110bbbbb
|
||||
} elseif ( ( $c & 0xF0 ) == 0xE0 ) {
|
||||
} elseif ( ( $c & 0xF0 ) === 0xE0 ) {
|
||||
$n = 2; // 1110bbbb
|
||||
} elseif ( ( $c & 0xF8 ) == 0xF0 ) {
|
||||
} elseif ( ( $c & 0xF8 ) === 0xF0 ) {
|
||||
$n = 3; // 11110bbb
|
||||
} elseif ( ( $c & 0xFC ) == 0xF8 ) {
|
||||
} elseif ( ( $c & 0xFC ) === 0xF8 ) {
|
||||
$n = 4; // 111110bb
|
||||
} elseif ( ( $c & 0xFE ) == 0xFC ) {
|
||||
} elseif ( ( $c & 0xFE ) === 0xFC ) {
|
||||
$n = 5; // 1111110b
|
||||
} else {
|
||||
return false; // Does not match any model.
|
||||
}
|
||||
|
||||
for ( $j = 0; $j < $n; $j++ ) { // n bytes matching 10bbbbbb follow ?
|
||||
if ( ( ++$i === $length ) || ( ( ord( $str[ $i ] ) & 0xC0 ) != 0x80 ) ) {
|
||||
if ( ( ++$i === $length ) || ( ( ord( $str[ $i ] ) & 0xC0 ) !== 0x80 ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2653,14 +2657,14 @@ function force_balance_tags( $text ) {
|
||||
} elseif ( $tagstack[ $stacksize - 1 ] === $tag ) { // Found closing tag.
|
||||
$tag = '</' . $tag . '>'; // Close tag.
|
||||
array_pop( $tagstack );
|
||||
$stacksize--;
|
||||
--$stacksize;
|
||||
} else { // Closing tag not at top, search for it.
|
||||
for ( $j = $stacksize - 1; $j >= 0; $j-- ) {
|
||||
if ( $tagstack[ $j ] === $tag ) {
|
||||
// Add tag to tagqueue.
|
||||
for ( $k = $stacksize - 1; $k >= $j; $k-- ) {
|
||||
$tagqueue .= '</' . array_pop( $tagstack ) . '>';
|
||||
$stacksize--;
|
||||
--$stacksize;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2688,7 +2692,7 @@ function force_balance_tags( $text ) {
|
||||
*/
|
||||
if ( $stacksize > 0 && ! in_array( $tag, $nestable_tags, true ) && $tagstack[ $stacksize - 1 ] === $tag ) {
|
||||
$tagqueue = '</' . array_pop( $tagstack ) . '>';
|
||||
$stacksize--;
|
||||
--$stacksize;
|
||||
}
|
||||
$stacksize = array_push( $tagstack, $tag );
|
||||
}
|
||||
@@ -2910,13 +2914,15 @@ function urldecode_deep( $value ) {
|
||||
*/
|
||||
function antispambot( $email_address, $hex_encoding = 0 ) {
|
||||
$email_no_spam_address = '';
|
||||
|
||||
for ( $i = 0, $len = strlen( $email_address ); $i < $len; $i++ ) {
|
||||
$j = rand( 0, 1 + $hex_encoding );
|
||||
if ( 0 == $j ) {
|
||||
|
||||
if ( 0 === $j ) {
|
||||
$email_no_spam_address .= '&#' . ord( $email_address[ $i ] ) . ';';
|
||||
} elseif ( 1 == $j ) {
|
||||
} elseif ( 1 === $j ) {
|
||||
$email_no_spam_address .= $email_address[ $i ];
|
||||
} elseif ( 2 == $j ) {
|
||||
} elseif ( 2 === $j ) {
|
||||
$email_no_spam_address .= '%' . zeroise( dechex( ord( $email_address[ $i ] ) ), 2 );
|
||||
}
|
||||
}
|
||||
@@ -3077,7 +3083,7 @@ function make_clickable( $text ) {
|
||||
|| preg_match( '|^<script[\s>]|i', $piece )
|
||||
|| preg_match( '|^<style[\s>]|i', $piece )
|
||||
) {
|
||||
$nested_code_pre++;
|
||||
++$nested_code_pre;
|
||||
} elseif ( $nested_code_pre
|
||||
&& ( '</code>' === strtolower( $piece )
|
||||
|| '</pre>' === strtolower( $piece )
|
||||
@@ -3085,7 +3091,7 @@ function make_clickable( $text ) {
|
||||
|| '</style>' === strtolower( $piece )
|
||||
)
|
||||
) {
|
||||
$nested_code_pre--;
|
||||
--$nested_code_pre;
|
||||
}
|
||||
|
||||
if ( $nested_code_pre
|
||||
@@ -3253,7 +3259,7 @@ function wp_rel_nofollow( $text ) {
|
||||
$text = stripslashes( $text );
|
||||
$text = preg_replace_callback(
|
||||
'|<a (.+?)>|i',
|
||||
static function( $matches ) {
|
||||
static function ( $matches ) {
|
||||
return wp_rel_callback( $matches, 'nofollow' );
|
||||
},
|
||||
$text
|
||||
@@ -3287,7 +3293,7 @@ function wp_rel_ugc( $text ) {
|
||||
$text = stripslashes( $text );
|
||||
$text = preg_replace_callback(
|
||||
'|<a (.+?)>|i',
|
||||
static function( $matches ) {
|
||||
static function ( $matches ) {
|
||||
return wp_rel_callback( $matches, 'nofollow ugc' );
|
||||
},
|
||||
$text
|
||||
@@ -3974,19 +3980,30 @@ function wp_trim_excerpt( $text = '', $post = null ) {
|
||||
* within the excerpt are stripped out. Modifying the tags here
|
||||
* is wasteful and can lead to bugs in the image counting logic.
|
||||
*/
|
||||
$filter_removed = remove_filter( 'the_content', 'wp_filter_content_tags' );
|
||||
$filter_image_removed = remove_filter( 'the_content', 'wp_filter_content_tags', 12 );
|
||||
|
||||
/*
|
||||
* Temporarily unhook do_blocks() since excerpt_remove_blocks( $text )
|
||||
* handles block rendering needed for excerpt.
|
||||
*/
|
||||
$filter_block_removed = remove_filter( 'the_content', 'do_blocks', 9 );
|
||||
|
||||
/** This filter is documented in wp-includes/post-template.php */
|
||||
$text = apply_filters( 'the_content', $text );
|
||||
$text = str_replace( ']]>', ']]>', $text );
|
||||
|
||||
/**
|
||||
// Restore the original filter if removed.
|
||||
if ( $filter_block_removed ) {
|
||||
add_filter( 'the_content', 'do_blocks', 9 );
|
||||
}
|
||||
|
||||
/*
|
||||
* Only restore the filter callback if it was removed above. The logic
|
||||
* to unhook and restore only applies on the default priority of 10,
|
||||
* which is generally used for the filter callback in WordPress core.
|
||||
*/
|
||||
if ( $filter_removed ) {
|
||||
add_filter( 'the_content', 'wp_filter_content_tags' );
|
||||
if ( $filter_image_removed ) {
|
||||
add_filter( 'the_content', 'wp_filter_content_tags', 12 );
|
||||
}
|
||||
|
||||
/* translators: Maximum number of words used in a post excerpt. */
|
||||
@@ -4505,7 +4522,7 @@ function esc_url( $url, $protocols = null, $_context = 'display' ) {
|
||||
$url = str_replace( "'", ''', $url );
|
||||
}
|
||||
|
||||
if ( ( str_contains( $url, '[' ) ) || ( str_contains( $url, ']' ) ) ) {
|
||||
if ( str_contains( $url, '[' ) || str_contains( $url, ']' ) ) {
|
||||
|
||||
$parsed = wp_parse_url( $url );
|
||||
$front = '';
|
||||
@@ -4750,7 +4767,7 @@ EOF;
|
||||
|
||||
$safe_text = (string) preg_replace_callback(
|
||||
$regex,
|
||||
static function( $matches ) {
|
||||
static function ( $matches ) {
|
||||
if ( ! isset( $matches[0] ) ) {
|
||||
return '';
|
||||
}
|
||||
@@ -4892,7 +4909,7 @@ function sanitize_option( $option, $value ) {
|
||||
case 'default_ping_status':
|
||||
case 'default_comment_status':
|
||||
// Options that if not there have 0 value but need to be something like "closed".
|
||||
if ( '0' == $value || '' === $value ) {
|
||||
if ( '0' === (string) $value || '' === $value ) {
|
||||
$value = 'closed';
|
||||
}
|
||||
break;
|
||||
@@ -5230,6 +5247,7 @@ function wp_sprintf( $pattern, ...$args ) {
|
||||
$start = 0;
|
||||
$result = '';
|
||||
$arg_index = 0;
|
||||
|
||||
while ( $len > $start ) {
|
||||
// Last character: append and break.
|
||||
if ( strlen( $pattern ) - 1 === $start ) {
|
||||
@@ -5274,7 +5292,8 @@ function wp_sprintf( $pattern, ...$args ) {
|
||||
* @param string $arg The argument.
|
||||
*/
|
||||
$_fragment = apply_filters( 'wp_sprintf', $fragment, $arg );
|
||||
if ( $_fragment != $fragment ) {
|
||||
|
||||
if ( $_fragment !== $fragment ) {
|
||||
$fragment = $_fragment;
|
||||
} else {
|
||||
$fragment = sprintf( $fragment, (string) $arg );
|
||||
@@ -5346,7 +5365,7 @@ function wp_sprintf_l( $pattern, $args ) {
|
||||
$i = count( $args );
|
||||
while ( $i ) {
|
||||
$arg = array_shift( $args );
|
||||
$i--;
|
||||
--$i;
|
||||
if ( 0 === $i ) {
|
||||
$result .= $l['between_last_two'] . $arg;
|
||||
} else {
|
||||
@@ -5381,7 +5400,8 @@ function wp_html_excerpt( $str, $count, $more = null ) {
|
||||
|
||||
// Remove part of an entity at the end.
|
||||
$excerpt = preg_replace( '/&[^;\s]{0,6}$/', '', $excerpt );
|
||||
if ( $str != $excerpt ) {
|
||||
|
||||
if ( $str !== $excerpt ) {
|
||||
$excerpt = trim( $excerpt ) . $more;
|
||||
}
|
||||
|
||||
@@ -5663,7 +5683,7 @@ function wp_basename( $path, $suffix = '' ) {
|
||||
return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) );
|
||||
}
|
||||
|
||||
// phpcs:disable WordPress.WP.CapitalPDangit.Misspelled, WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid -- 8-)
|
||||
// phpcs:disable WordPress.WP.CapitalPDangit.MisspelledInComment,WordPress.WP.CapitalPDangit.MisspelledInText,WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid -- 8-)
|
||||
/**
|
||||
* Forever eliminate "Wordpress" from the planet (or at least the little bit we can influence).
|
||||
*
|
||||
@@ -5838,36 +5858,34 @@ function wp_spaces_regexp() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the important emoji-related styles.
|
||||
* Enqueues the important emoji-related styles.
|
||||
*
|
||||
* @since 4.2.0
|
||||
* @since 6.4.0
|
||||
*/
|
||||
function print_emoji_styles() {
|
||||
static $printed = false;
|
||||
|
||||
if ( $printed ) {
|
||||
function wp_enqueue_emoji_styles() {
|
||||
// Back-compat for plugins that disable functionality by unhooking this action.
|
||||
$action = is_admin() ? 'admin_print_styles' : 'wp_print_styles';
|
||||
if ( ! has_action( $action, 'print_emoji_styles' ) ) {
|
||||
return;
|
||||
}
|
||||
remove_action( $action, 'print_emoji_styles' );
|
||||
|
||||
$printed = true;
|
||||
|
||||
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
|
||||
?>
|
||||
<style<?php echo $type_attr; ?>>
|
||||
img.wp-smiley,
|
||||
img.emoji {
|
||||
display: inline !important;
|
||||
border: none !important;
|
||||
box-shadow: none !important;
|
||||
height: 1em !important;
|
||||
width: 1em !important;
|
||||
margin: 0 0.07em !important;
|
||||
vertical-align: -0.1em !important;
|
||||
background: none !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
$emoji_styles = '
|
||||
img.wp-smiley, img.emoji {
|
||||
display: inline !important;
|
||||
border: none !important;
|
||||
box-shadow: none !important;
|
||||
height: 1em !important;
|
||||
width: 1em !important;
|
||||
margin: 0 0.07em !important;
|
||||
vertical-align: -0.1em !important;
|
||||
background: none !important;
|
||||
padding: 0 !important;
|
||||
}';
|
||||
$handle = 'wp-emoji-styles';
|
||||
wp_register_style( $handle, false );
|
||||
wp_add_inline_style( $handle, $emoji_styles );
|
||||
wp_enqueue_style( $handle );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user