Coding Standards: Use strict comparison where `strtolower()` is involved.
Follow-up to [649], [7736], [18821], [19444], [20886], [20893], [23303], [55642], [55652], [55653], [55654]. Props aristath, poena, afercia, SergeyBiryukov. See #57839. Built from https://develop.svn.wordpress.org/trunk@55677 git-svn-id: http://core.svn.wordpress.org/trunk@55189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ead3a2ec81
commit
0c5a04d541
|
@ -1739,6 +1739,7 @@ function upgrade_330() {
|
||||||
$_sidebars_widgets[ $index ][ $i ] = $id;
|
$_sidebars_widgets[ $index ][ $i ] = $id;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = sanitize_title( $name );
|
$id = sanitize_title( $name );
|
||||||
if ( isset( $wp_registered_widgets[ $id ] ) ) {
|
if ( isset( $wp_registered_widgets[ $id ] ) ) {
|
||||||
$_sidebars_widgets[ $index ][ $i ] = $id;
|
$_sidebars_widgets[ $index ][ $i ] = $id;
|
||||||
|
@ -1748,12 +1749,14 @@ function upgrade_330() {
|
||||||
$found = false;
|
$found = false;
|
||||||
|
|
||||||
foreach ( $wp_registered_widgets as $widget_id => $widget ) {
|
foreach ( $wp_registered_widgets as $widget_id => $widget ) {
|
||||||
if ( strtolower( $widget['name'] ) == strtolower( $name ) ) {
|
if ( strtolower( $widget['name'] ) === strtolower( $name ) ) {
|
||||||
$_sidebars_widgets[ $index ][ $i ] = $widget['id'];
|
$_sidebars_widgets[ $index ][ $i ] = $widget['id'];
|
||||||
|
|
||||||
$found = true;
|
$found = true;
|
||||||
break;
|
break;
|
||||||
} elseif ( sanitize_title( $widget['name'] ) == sanitize_title( $name ) ) {
|
} elseif ( sanitize_title( $widget['name'] ) === sanitize_title( $name ) ) {
|
||||||
$_sidebars_widgets[ $index ][ $i ] = $widget['id'];
|
$_sidebars_widgets[ $index ][ $i ] = $widget['id'];
|
||||||
|
|
||||||
$found = true;
|
$found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3029,13 +3029,26 @@ function make_clickable( $text ) {
|
||||||
$nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>.
|
$nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>.
|
||||||
foreach ( $textarr as $piece ) {
|
foreach ( $textarr as $piece ) {
|
||||||
|
|
||||||
if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) || preg_match( '|^<script[\s>]|i', $piece ) || preg_match( '|^<style[\s>]|i', $piece ) ) {
|
if ( preg_match( '|^<code[\s>]|i', $piece )
|
||||||
|
|| preg_match( '|^<pre[\s>]|i', $piece )
|
||||||
|
|| 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 ) || '</script>' === strtolower( $piece ) || '</style>' === strtolower( $piece ) ) ) {
|
} elseif ( $nested_code_pre
|
||||||
|
&& ( '</code>' === strtolower( $piece )
|
||||||
|
|| '</pre>' === strtolower( $piece )
|
||||||
|
|| '</script>' === strtolower( $piece )
|
||||||
|
|| '</style>' === strtolower( $piece )
|
||||||
|
)
|
||||||
|
) {
|
||||||
$nested_code_pre--;
|
$nested_code_pre--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $nested_code_pre || empty( $piece ) || ( '<' === $piece[0] && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
|
if ( $nested_code_pre
|
||||||
|
|| empty( $piece )
|
||||||
|
|| ( '<' === $piece[0] && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) )
|
||||||
|
) {
|
||||||
$r .= $piece;
|
$r .= $piece;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -4463,7 +4476,7 @@ function esc_url( $url, $protocols = null, $_context = 'display' ) {
|
||||||
$protocols = wp_allowed_protocols();
|
$protocols = wp_allowed_protocols();
|
||||||
}
|
}
|
||||||
$good_protocol_url = wp_kses_bad_protocol( $url, $protocols );
|
$good_protocol_url = wp_kses_bad_protocol( $url, $protocols );
|
||||||
if ( strtolower( $good_protocol_url ) != strtolower( $url ) ) {
|
if ( strtolower( $good_protocol_url ) !== strtolower( $url ) ) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1640,7 +1640,7 @@ function wp_kses_check_attr_val( $value, $vless, $checkname, $checkvalue ) {
|
||||||
* If the given value is an "n" or an "N", the attribute must have a value.
|
* If the given value is an "n" or an "N", the attribute must have a value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( strtolower( $checkvalue ) != $vless ) {
|
if ( strtolower( $checkvalue ) !== $vless ) {
|
||||||
$ok = false;
|
$ok = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1846,7 +1846,7 @@ function wp_kses_bad_protocol_once2( $scheme, $allowed_protocols ) {
|
||||||
|
|
||||||
$allowed = false;
|
$allowed = false;
|
||||||
foreach ( (array) $allowed_protocols as $one_protocol ) {
|
foreach ( (array) $allowed_protocols as $one_protocol ) {
|
||||||
if ( strtolower( $one_protocol ) == $scheme ) {
|
if ( strtolower( $one_protocol ) === $scheme ) {
|
||||||
$allowed = true;
|
$allowed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4194,7 +4194,10 @@ function wp_insert_post( $postarr, $wp_error = false, $fire_after_hooks = true )
|
||||||
// On updates, we need to check to see if it's using the old, fixed sanitization context.
|
// On updates, we need to check to see if it's using the old, fixed sanitization context.
|
||||||
$check_name = sanitize_title( $post_name, '', 'old-save' );
|
$check_name = sanitize_title( $post_name, '', 'old-save' );
|
||||||
|
|
||||||
if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $post_id ) == $check_name ) {
|
if ( $update
|
||||||
|
&& strtolower( urlencode( $post_name ) ) === $check_name
|
||||||
|
&& get_post_field( 'post_name', $post_id ) === $check_name
|
||||||
|
) {
|
||||||
$post_name = $check_name;
|
$post_name = $check_name;
|
||||||
} else { // New post, or slug has changed.
|
} else { // New post, or slug has changed.
|
||||||
$post_name = sanitize_title( $post_name );
|
$post_name = sanitize_title( $post_name );
|
||||||
|
|
|
@ -3625,7 +3625,7 @@ function _wp_customize_changeset_filter_insert_post_data( $post_data, $supplied_
|
||||||
function _wp_customize_loader_settings() {
|
function _wp_customize_loader_settings() {
|
||||||
$admin_origin = parse_url( admin_url() );
|
$admin_origin = parse_url( admin_url() );
|
||||||
$home_origin = parse_url( home_url() );
|
$home_origin = parse_url( home_url() );
|
||||||
$cross_domain = ( strtolower( $admin_origin['host'] ) != strtolower( $home_origin['host'] ) );
|
$cross_domain = ( strtolower( $admin_origin['host'] ) !== strtolower( $home_origin['host'] ) );
|
||||||
|
|
||||||
$browser = array(
|
$browser = array(
|
||||||
'mobile' => wp_is_mobile(),
|
'mobile' => wp_is_mobile(),
|
||||||
|
@ -3690,7 +3690,7 @@ function wp_customize_url( $stylesheet = '' ) {
|
||||||
function wp_customize_support_script() {
|
function wp_customize_support_script() {
|
||||||
$admin_origin = parse_url( admin_url() );
|
$admin_origin = parse_url( admin_url() );
|
||||||
$home_origin = parse_url( home_url() );
|
$home_origin = parse_url( home_url() );
|
||||||
$cross_domain = ( strtolower( $admin_origin['host'] ) != strtolower( $home_origin['host'] ) );
|
$cross_domain = ( strtolower( $admin_origin['host'] ) !== strtolower( $home_origin['host'] ) );
|
||||||
$type_attr = current_theme_supports( 'html5', 'script' ) ? '' : ' type="text/javascript"';
|
$type_attr = current_theme_supports( 'html5', 'script' ) ? '' : ' type="text/javascript"';
|
||||||
?>
|
?>
|
||||||
<script<?php echo $type_attr; ?>>
|
<script<?php echo $type_attr; ?>>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.3-alpha-55676';
|
$wp_version = '6.3-alpha-55677';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue