Coding Standards: Use strict comparison where substr() is involved.

Follow-up to [3606], [10738], [33359], [55642], [55652].

Props aristath, poena, afercia, SergeyBiryukov.
See #57839.
Built from https://develop.svn.wordpress.org/trunk@55653


git-svn-id: http://core.svn.wordpress.org/trunk@55165 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2023-04-16 10:48:22 +00:00
parent 4d6f46401f
commit 800b2b4261
4 changed files with 7 additions and 7 deletions

View File

@ -1365,7 +1365,7 @@ function wp_dashboard_plugins_output( $rss, $args = array() ) {
// Is this random plugin's slug already installed? If so, try again. // Is this random plugin's slug already installed? If so, try again.
reset( $plugin_slugs ); reset( $plugin_slugs );
foreach ( $plugin_slugs as $plugin_slug ) { foreach ( $plugin_slugs as $plugin_slug ) {
if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) { if ( $slug === substr( $plugin_slug, 0, strlen( $slug ) ) ) {
unset( $items[$item_key] ); unset( $items[$item_key] );
continue 2; continue 2;
} }

View File

@ -947,7 +947,7 @@ function get_links($category = -1, $before = '', $after = '<br />', $between = '
_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
$order = 'ASC'; $order = 'ASC';
if ( substr($orderby, 0, 1) == '_' ) { if ( substr($orderby, 0, 1) === '_' ) {
$order = 'DESC'; $order = 'DESC';
$orderby = substr($orderby, 1); $orderby = substr($orderby, 1);
} }
@ -980,7 +980,7 @@ function get_links($category = -1, $before = '', $after = '<br />', $between = '
$title = $desc; $title = $desc;
if ( $show_updated ) if ( $show_updated )
if (substr($row->link_updated_f, 0, 2) != '00') if (substr($row->link_updated_f, 0, 2) !== '00')
$title .= ' ('.__('Last updated') . ' ' . gmdate(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')'; $title .= ' ('.__('Last updated') . ' ' . gmdate(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')';
if ( '' != $title ) if ( '' != $title )
@ -1042,7 +1042,7 @@ function get_links_list($order = 'name') {
// Handle link category sorting. // Handle link category sorting.
$direction = 'ASC'; $direction = 'ASC';
if ( '_' == substr($order,0,1) ) { if ( '_' === substr($order,0,1) ) {
$direction = 'DESC'; $direction = 'DESC';
$order = substr($order,1); $order = substr($order,1);
} }
@ -1739,7 +1739,7 @@ function make_url_footnote( $content ) {
$link_url = $matches[2][$i]; $link_url = $matches[2][$i];
$link_text = $matches[4][$i]; $link_text = $matches[4][$i];
$content = str_replace( $link_match, $link_text . ' ' . $link_number, $content ); $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
$link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url; $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) !== 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) !== 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
$links_summary .= "\n" . $link_number . ' ' . $link_url; $links_summary .= "\n" . $link_number . ' ' . $link_url;
} }
$content = strip_tags( $content ); $content = strip_tags( $content );

View File

@ -799,7 +799,7 @@ function wp_kses_one_attr( $attr, $element ) {
$quote = $value[0]; $quote = $value[0];
} }
if ( '"' === $quote || "'" === $quote ) { if ( '"' === $quote || "'" === $quote ) {
if ( substr( $value, -1 ) != $quote ) { if ( substr( $value, -1 ) !== $quote ) {
return ''; return '';
} }
$value = substr( $value, 1, -1 ); $value = substr( $value, 1, -1 );

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.3-alpha-55652'; $wp_version = '6.3-alpha-55653';
/** /**
* 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.