diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 46f6286cad..8aa16ac7a3 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -1739,6 +1739,7 @@ function upgrade_330() { $_sidebars_widgets[ $index ][ $i ] = $id; continue; } + $id = sanitize_title( $name ); if ( isset( $wp_registered_widgets[ $id ] ) ) { $_sidebars_widgets[ $index ][ $i ] = $id; @@ -1748,13 +1749,15 @@ function upgrade_330() { $found = false; 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']; - $found = true; + + $found = true; break; - } elseif ( sanitize_title( $widget['name'] ) == sanitize_title( $name ) ) { + } elseif ( sanitize_title( $widget['name'] ) === sanitize_title( $name ) ) { $_sidebars_widgets[ $index ][ $i ] = $widget['id']; - $found = true; + + $found = true; break; } } diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index ccf728236a..8240adcc82 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -3029,13 +3029,26 @@ function make_clickable( $text ) { $nested_code_pre = 0; // Keep track of how many levels link is nested inside
or .
foreach ( $textarr as $piece ) {
- if ( preg_match( '|^]|i', $piece ) || preg_match( '|^]|i', $piece ) || preg_match( '|^' === strtolower( $piece ) || '' === strtolower( $piece ) ) ) {
+ } elseif ( $nested_code_pre
+ && ( '
' === strtolower( $piece )
+ || '
' === strtolower( $piece )
+ || '' === strtolower( $piece )
+ || '' === strtolower( $piece )
+ )
+ ) {
$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;
continue;
}
@@ -4463,7 +4476,7 @@ function esc_url( $url, $protocols = null, $_context = 'display' ) {
$protocols = wp_allowed_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 '';
}
}
diff --git a/wp-includes/kses.php b/wp-includes/kses.php
index f85f0b1366..eef6632487 100644
--- a/wp-includes/kses.php
+++ b/wp-includes/kses.php
@@ -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 ( strtolower( $checkvalue ) != $vless ) {
+ if ( strtolower( $checkvalue ) !== $vless ) {
$ok = false;
}
break;
@@ -1846,7 +1846,7 @@ function wp_kses_bad_protocol_once2( $scheme, $allowed_protocols ) {
$allowed = false;
foreach ( (array) $allowed_protocols as $one_protocol ) {
- if ( strtolower( $one_protocol ) == $scheme ) {
+ if ( strtolower( $one_protocol ) === $scheme ) {
$allowed = true;
break;
}
diff --git a/wp-includes/post.php b/wp-includes/post.php
index 3c1af397a3..84c513cb82 100644
--- a/wp-includes/post.php
+++ b/wp-includes/post.php
@@ -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.
$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;
} else { // New post, or slug has changed.
$post_name = sanitize_title( $post_name );
diff --git a/wp-includes/theme.php b/wp-includes/theme.php
index c1623f4058..8cda0f14af 100644
--- a/wp-includes/theme.php
+++ b/wp-includes/theme.php
@@ -3625,7 +3625,7 @@ function _wp_customize_changeset_filter_insert_post_data( $post_data, $supplied_
function _wp_customize_loader_settings() {
$admin_origin = parse_url( admin_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(
'mobile' => wp_is_mobile(),
@@ -3690,7 +3690,7 @@ function wp_customize_url( $stylesheet = '' ) {
function wp_customize_support_script() {
$admin_origin = parse_url( admin_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"';
?>