From 793219370873406823395e33051b6c7e8c27b2e2 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 16 May 2020 18:42:12 +0000 Subject: [PATCH] Coding Standards: Use strict comparison where static strings are involved. This reduces the number of `WordPress.PHP.StrictComparisons.LooseComparison` issues in half, from 1897 to 890. Includes minor code layout fixes for better readability. See #49542. Built from https://develop.svn.wordpress.org/trunk@47808 git-svn-id: http://core.svn.wordpress.org/trunk@47584 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-header.php | 2 +- wp-admin/edit-form-advanced.php | 2 +- wp-admin/includes/ajax-actions.php | 54 +++++------ wp-admin/includes/bookmark.php | 11 ++- wp-admin/includes/class-core-upgrader.php | 4 +- .../includes/class-custom-image-header.php | 4 +- .../includes/class-language-pack-upgrader.php | 10 +- .../includes/class-plugin-installer-skin.php | 4 +- .../class-walker-nav-menu-checklist.php | 2 +- .../includes/class-walker-nav-menu-edit.php | 12 +-- .../includes/class-wp-automatic-updater.php | 39 +++++--- .../includes/class-wp-comments-list-table.php | 4 +- .../includes/class-wp-filesystem-base.php | 8 +- .../includes/class-wp-filesystem-direct.php | 8 +- .../includes/class-wp-filesystem-ftpext.php | 10 +- .../class-wp-filesystem-ftpsockets.php | 8 +- .../includes/class-wp-filesystem-ssh2.php | 10 +- .../class-wp-ms-themes-list-table.php | 6 +- .../includes/class-wp-plugins-list-table.php | 10 +- .../includes/class-wp-posts-list-table.php | 6 +- .../class-wp-site-health-auto-updates.php | 4 +- .../includes/class-wp-terms-list-table.php | 2 +- wp-admin/includes/class-wp-upgrader.php | 8 +- wp-admin/includes/comment.php | 2 +- wp-admin/includes/dashboard.php | 22 +++-- wp-admin/includes/export.php | 14 +-- wp-admin/includes/file.php | 39 ++++---- wp-admin/includes/image-edit.php | 12 +-- wp-admin/includes/media.php | 35 +++---- wp-admin/includes/menu.php | 2 +- wp-admin/includes/meta-boxes.php | 53 ++++++----- wp-admin/includes/misc.php | 2 +- wp-admin/includes/ms.php | 6 +- wp-admin/includes/nav-menu.php | 68 ++++++------- wp-admin/includes/options.php | 11 ++- wp-admin/includes/plugin-install.php | 4 +- wp-admin/includes/plugin.php | 30 +++--- wp-admin/includes/post.php | 76 ++++++++------- wp-admin/includes/schema.php | 4 +- wp-admin/includes/screen.php | 6 +- wp-admin/includes/taxonomy.php | 2 +- wp-admin/includes/template.php | 2 +- wp-admin/includes/theme.php | 6 +- wp-admin/includes/update-core.php | 23 ++--- wp-admin/includes/update.php | 4 +- wp-admin/includes/upgrade.php | 30 +++--- wp-admin/includes/user.php | 10 +- wp-admin/includes/widgets.php | 2 +- wp-admin/maint/repair.php | 10 +- wp-admin/nav-menus.php | 4 +- wp-admin/network.php | 2 +- wp-admin/options-discussion.php | 8 +- wp-admin/options.php | 25 +++-- wp-admin/plugin-editor.php | 2 +- wp-admin/plugin-install.php | 2 +- wp-admin/plugins.php | 10 +- wp-admin/post-new.php | 4 +- wp-admin/post.php | 12 +-- wp-admin/setup-config.php | 2 +- wp-admin/theme-editor.php | 6 +- wp-admin/themes.php | 6 +- wp-admin/update-core.php | 16 ++-- wp-admin/update.php | 18 ++-- wp-admin/upload.php | 2 +- wp-admin/user-edit.php | 2 +- wp-admin/user-new.php | 6 +- .../themes/twentyeleven/content-featured.php | 26 ++--- .../themes/twentyeleven/content-single.php | 36 +++---- wp-content/themes/twentyeleven/content.php | 2 +- wp-content/themes/twentyeleven/functions.php | 35 +++---- wp-content/themes/twentyeleven/header.php | 2 +- .../themes/twentyeleven/inc/theme-options.php | 6 +- .../themes/twentyeleven/inc/widgets.php | 2 +- wp-content/themes/twentyeleven/showcase.php | 2 +- wp-content/themes/twentyeleven/sidebar.php | 2 +- .../themes/twentyfifteen/content-search.php | 2 +- wp-content/themes/twentyfifteen/functions.php | 12 +-- .../twentyfifteen/inc/template-tags.php | 2 +- .../twentyfourteen/content-featured-post.php | 2 +- wp-content/themes/twentyfourteen/content.php | 2 +- .../themes/twentyfourteen/functions.php | 4 +- .../twentyfourteen/inc/featured-content.php | 6 +- .../class-twentynineteen-svg-icons.php | 4 +- wp-content/themes/twentyten/loop.php | 6 +- .../themes/twentythirteen/functions.php | 4 +- .../twentythirteen/js/theme-customizer.js | 4 +- wp-content/themes/twentytwelve/functions.php | 6 +- .../twentytwelve/js/theme-customizer.js | 4 +- wp-includes/admin-bar.php | 19 ++-- wp-includes/author-template.php | 6 +- wp-includes/bookmark-template.php | 10 +- wp-includes/bookmark.php | 12 +-- wp-includes/capabilities.php | 22 ++--- wp-includes/category-template.php | 30 +++--- wp-includes/category.php | 6 +- wp-includes/class-http.php | 10 +- wp-includes/class-walker-category.php | 8 +- wp-includes/class-walker-comment.php | 12 +-- wp-includes/class-walker-page.php | 2 +- wp-includes/class-wp-comment-query.php | 6 +- wp-includes/class-wp-customize-nav-menus.php | 6 +- wp-includes/class-wp-editor.php | 8 +- wp-includes/class-wp-embed.php | 2 +- wp-includes/class-wp-http-cookie.php | 8 +- wp-includes/class-wp-http-encoding.php | 2 +- wp-includes/class-wp-http-streams.php | 12 ++- wp-includes/class-wp-image-editor.php | 2 +- wp-includes/class-wp-list-util.php | 6 +- wp-includes/class-wp-locale.php | 4 +- wp-includes/class-wp-meta-query.php | 4 +- wp-includes/class-wp-network-query.php | 2 +- wp-includes/class-wp-oembed.php | 4 +- wp-includes/class-wp-post-type.php | 4 +- wp-includes/class-wp-query.php | 78 +++++++-------- wp-includes/class-wp-rewrite.php | 14 +-- wp-includes/class-wp-site-query.php | 4 +- wp-includes/class-wp-tax-query.php | 8 +- wp-includes/class-wp-taxonomy.php | 4 +- wp-includes/class-wp-term-query.php | 39 ++++---- wp-includes/class-wp-theme.php | 15 +-- wp-includes/class-wp-user-query.php | 26 ++--- wp-includes/class-wp-user.php | 10 +- wp-includes/class-wp-xmlrpc-server.php | 24 ++--- wp-includes/class-wp.php | 2 +- wp-includes/comment-template.php | 41 ++++---- wp-includes/comment.php | 35 ++++--- wp-includes/feed.php | 13 +-- wp-includes/formatting.php | 39 ++++---- wp-includes/functions.php | 41 ++++---- wp-includes/general-template.php | 32 ++++--- wp-includes/http.php | 2 +- wp-includes/kses.php | 24 ++--- wp-includes/link-template.php | 45 ++++----- wp-includes/load.php | 12 +-- wp-includes/media-template.php | 6 +- wp-includes/meta.php | 32 ++++--- wp-includes/ms-blogs.php | 8 +- wp-includes/ms-default-constants.php | 6 +- wp-includes/ms-deprecated.php | 8 +- wp-includes/ms-functions.php | 42 ++++---- wp-includes/ms-load.php | 6 +- wp-includes/ms-settings.php | 4 +- wp-includes/nav-menu-template.php | 25 ++--- wp-includes/nav-menu.php | 40 ++++---- wp-includes/option.php | 14 +-- wp-includes/pluggable.php | 20 ++-- wp-includes/pomo/mo.php | 2 +- wp-includes/pomo/po.php | 20 ++-- wp-includes/pomo/streams.php | 4 +- wp-includes/pomo/translations.php | 2 +- wp-includes/post-formats.php | 8 +- wp-includes/post-template.php | 16 ++-- wp-includes/post.php | 95 ++++++++++--------- wp-includes/revision.php | 14 +-- wp-includes/rewrite.php | 2 +- wp-includes/shortcodes.php | 8 +- wp-includes/template.php | 2 +- wp-includes/theme-compat/comments.php | 2 +- wp-includes/theme.php | 28 ++++-- wp-includes/user.php | 20 ++-- wp-includes/version.php | 2 +- 161 files changed, 1144 insertions(+), 1008 deletions(-) diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 43f91483bc..9045620aa8 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -147,7 +147,7 @@ do_action( "admin_head-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConven */ do_action( 'admin_head' ); -if ( get_user_setting( 'mfold' ) === 'f' ) { +if ( 'f' === get_user_setting( 'mfold' ) ) { $admin_body_class .= ' folded'; } diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 20aea33a3f..390fe7d254 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -59,7 +59,7 @@ if ( post_type_supports( $post_type, 'editor' ) && ! wp_is_mobile() && wp_enqueue_script( 'editor-expand' ); $_content_editor_dfw = true; - $_wp_editor_expand = ( get_user_setting( 'editor_expand', 'on' ) === 'on' ); + $_wp_editor_expand = ( 'on' === get_user_setting( 'editor_expand', 'on' ) ); } if ( wp_is_mobile() ) { diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 3b551db6c0..8f0d1f8822 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -176,7 +176,7 @@ function wp_ajax_wp_compression_test() { wp_die( -1 ); } - if ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' == ini_get( 'output_handler' ) ) { + if ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' === ini_get( 'output_handler' ) ) { update_site_option( 'can_compress_scripts', 0 ); wp_die( 0 ); } @@ -209,10 +209,10 @@ function wp_ajax_wp_compression_test() { echo $out; wp_die(); - } elseif ( 'no' == $_GET['test'] ) { + } elseif ( 'no' === $_GET['test'] ) { check_ajax_referer( 'update_can_compress_scripts' ); update_site_option( 'can_compress_scripts', 0 ); - } elseif ( 'yes' == $_GET['test'] ) { + } elseif ( 'yes' === $_GET['test'] ) { check_ajax_referer( 'update_can_compress_scripts' ); update_site_option( 'can_compress_scripts', 1 ); } @@ -704,13 +704,13 @@ function wp_ajax_delete_comment() { $delta = -1; if ( isset( $_POST['trash'] ) && 1 == $_POST['trash'] ) { - if ( 'trash' == $status ) { + if ( 'trash' === $status ) { wp_die( time() ); } $r = wp_trash_comment( $comment ); } elseif ( isset( $_POST['untrash'] ) && 1 == $_POST['untrash'] ) { - if ( 'trash' != $status ) { + if ( 'trash' !== $status ) { wp_die( time() ); } @@ -721,13 +721,13 @@ function wp_ajax_delete_comment() { $delta = 1; } } elseif ( isset( $_POST['spam'] ) && 1 == $_POST['spam'] ) { - if ( 'spam' == $status ) { + if ( 'spam' === $status ) { wp_die( time() ); } $r = wp_spam_comment( $comment ); } elseif ( isset( $_POST['unspam'] ) && 1 == $_POST['unspam'] ) { - if ( 'spam' != $status ) { + if ( 'spam' !== $status ) { wp_die( time() ); } @@ -883,7 +883,7 @@ function wp_ajax_trash_post( $action ) { wp_die( 1 ); } - if ( 'trash-post' == $action ) { + if ( 'trash-post' === $action ) { $done = wp_trash_post( $id ); } else { $done = wp_untrash_post( $id ); @@ -1301,7 +1301,7 @@ function wp_ajax_replyto_comment( $action ) { wp_die( __( 'Sorry, you must be logged in to reply to a comment.' ) ); } - if ( '' == $comment_content ) { + if ( '' === $comment_content ) { wp_die( __( 'Error: Please type a comment.' ) ); } @@ -1344,11 +1344,11 @@ function wp_ajax_replyto_comment( $action ) { $position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1'; ob_start(); - if ( isset( $_REQUEST['mode'] ) && 'dashboard' == $_REQUEST['mode'] ) { + if ( isset( $_REQUEST['mode'] ) && 'dashboard' === $_REQUEST['mode'] ) { require_once ABSPATH . 'wp-admin/includes/dashboard.php'; _wp_dashboard_recent_comments_row( $comment ); } else { - if ( isset( $_REQUEST['mode'] ) && 'single' == $_REQUEST['mode'] ) { + if ( isset( $_REQUEST['mode'] ) && 'single' === $_REQUEST['mode'] ) { $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); } else { $wp_list_table = _get_list_table( 'WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); @@ -1403,7 +1403,7 @@ function wp_ajax_edit_comment() { wp_die( -1 ); } - if ( '' == $_POST['content'] ) { + if ( '' === $_POST['content'] ) { wp_die( __( 'Error: Please type a comment.' ) ); } @@ -1461,7 +1461,7 @@ function wp_ajax_add_menu_item() { foreach ( (array) $_POST['menu-item'] as $menu_item_data ) { if ( ! empty( $menu_item_data['menu-item-type'] ) && - 'custom' != $menu_item_data['menu-item-type'] && + 'custom' !== $menu_item_data['menu-item-type'] && ! empty( $menu_item_data['menu-item-object-id'] ) ) { switch ( $menu_item_data['menu-item-type'] ) { @@ -1544,7 +1544,7 @@ function wp_ajax_add_meta() { wp_die( -1 ); } - if ( isset( $_POST['metakeyselect'] ) && '#NONE#' == $_POST['metakeyselect'] && empty( $_POST['metakeyinput'] ) ) { + if ( isset( $_POST['metakeyselect'] ) && '#NONE#' === $_POST['metakeyselect'] && empty( $_POST['metakeyinput'] ) ) { wp_die( 1 ); } @@ -1604,7 +1604,7 @@ function wp_ajax_add_meta() { $key = wp_unslash( $_POST['meta'][ $mid ]['key'] ); $value = wp_unslash( $_POST['meta'][ $mid ]['value'] ); - if ( '' == trim( $key ) ) { + if ( '' === trim( $key ) ) { wp_die( __( 'Please provide a custom field name.' ) ); } @@ -1795,11 +1795,11 @@ function wp_ajax_menu_get_metabox() { require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; - if ( isset( $_POST['item-type'] ) && 'post_type' == $_POST['item-type'] ) { + if ( isset( $_POST['item-type'] ) && 'post_type' === $_POST['item-type'] ) { $type = 'posttype'; $callback = 'wp_nav_menu_item_post_type_meta_box'; $items = (array) get_post_types( array( 'show_in_nav_menus' => true ), 'object' ); - } elseif ( isset( $_POST['item-type'] ) && 'taxonomy' == $_POST['item-type'] ) { + } elseif ( isset( $_POST['item-type'] ) && 'taxonomy' === $_POST['item-type'] ) { $type = 'taxonomy'; $callback = 'wp_nav_menu_item_taxonomy_meta_box'; $items = (array) get_taxonomies( array( 'show_ui' => true ), 'object' ); @@ -1985,7 +1985,7 @@ function wp_ajax_inline_save() { $post_ID = (int) $_POST['post_ID']; - if ( 'page' == $_POST['post_type'] ) { + if ( 'page' === $_POST['post_type'] ) { if ( ! current_user_can( 'edit_page', $post_ID ) ) { wp_die( __( 'Sorry, you are not allowed to edit this page.' ) ); } @@ -2030,7 +2030,7 @@ function wp_ajax_inline_save() { } // Status. - if ( isset( $data['keep_private'] ) && 'private' == $data['keep_private'] ) { + if ( isset( $data['keep_private'] ) && 'private' === $data['keep_private'] ) { $data['visibility'] = 'private'; $data['post_status'] = 'private'; } else { @@ -2180,7 +2180,7 @@ function wp_ajax_find_posts() { $alt = ''; foreach ( $posts as $post ) { $title = trim( $post->post_title ) ? $post->post_title : __( '(no title)' ); - $alt = ( 'alternate' == $alt ) ? '' : 'alternate'; + $alt = ( 'alternate' === $alt ) ? '' : 'alternate'; switch ( $post->post_status ) { case 'publish': @@ -2198,7 +2198,7 @@ function wp_ajax_find_posts() { break; } - if ( '0000-00-00 00:00:00' == $post->post_date ) { + if ( '0000-00-00 00:00:00' === $post->post_date ) { $time = ''; } else { /* translators: Date format in table columns, see https://www.php.net/date */ @@ -2883,7 +2883,7 @@ function wp_ajax_get_attachment() { wp_send_json_error(); } - if ( 'attachment' != $post->post_type ) { + if ( 'attachment' !== $post->post_type ) { wp_send_json_error(); } @@ -2996,7 +2996,7 @@ function wp_ajax_save_attachment() { $changes = $_REQUEST['changes']; $post = get_post( $id, ARRAY_A ); - if ( 'attachment' != $post['post_type'] ) { + if ( 'attachment' !== $post['post_type'] ) { wp_send_json_error(); } @@ -3087,7 +3087,7 @@ function wp_ajax_save_attachment_compat() { $post = get_post( $id, ARRAY_A ); - if ( 'attachment' != $post['post_type'] ) { + if ( 'attachment' !== $post['post_type'] ) { wp_send_json_error(); } @@ -3154,7 +3154,7 @@ function wp_ajax_save_attachment_order() { continue; } - if ( 'attachment' != $attachment->post_type ) { + if ( 'attachment' !== $attachment->post_type ) { continue; } @@ -3190,7 +3190,7 @@ function wp_ajax_send_attachment_to_editor() { wp_send_json_error(); } - if ( 'attachment' != $post->post_type ) { + if ( 'attachment' !== $post->post_type ) { wp_send_json_error(); } @@ -3304,7 +3304,7 @@ function wp_ajax_send_link_to_editor() { $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ); if ( $ext ) { $ext_type = wp_ext2type( $ext ); - if ( 'audio' == $ext_type || 'video' == $ext_type ) { + if ( 'audio' === $ext_type || 'video' === $ext_type ) { $type = $ext_type; } } diff --git a/wp-admin/includes/bookmark.php b/wp-admin/includes/bookmark.php index ededc33fa4..124f9cf698 100644 --- a/wp-admin/includes/bookmark.php +++ b/wp-admin/includes/bookmark.php @@ -39,7 +39,7 @@ function edit_link( $link_id = 0 ) { $_POST['link_name'] = esc_html( $_POST['link_name'] ); $_POST['link_image'] = esc_html( $_POST['link_image'] ); $_POST['link_rss'] = esc_url( $_POST['link_rss'] ); - if ( ! isset( $_POST['link_visible'] ) || 'N' != $_POST['link_visible'] ) { + if ( ! isset( $_POST['link_visible'] ) || 'N' !== $_POST['link_visible'] ) { $_POST['link_visible'] = 'Y'; } @@ -174,15 +174,15 @@ function wp_insert_link( $linkdata, $wp_error = false ) { $update = true; } - if ( trim( $link_name ) == '' ) { - if ( trim( $link_url ) != '' ) { + if ( '' === trim( $link_name ) ) { + if ( '' !== trim( $link_url ) ) { $link_name = $link_url; } else { return 0; } } - if ( trim( $link_url ) == '' ) { + if ( '' === trim( $link_url ) ) { return 0; } @@ -309,7 +309,8 @@ function wp_update_link( $linkdata ) { */ function wp_link_manager_disabled_message() { global $pagenow; - if ( 'link-manager.php' != $pagenow && 'link-add.php' != $pagenow && 'link.php' != $pagenow ) { + + if ( ! in_array( $pagenow, array( 'link-manager.php', 'link-add.php', 'link.php' ), true ) ) { return; } diff --git a/wp-admin/includes/class-core-upgrader.php b/wp-admin/includes/class-core-upgrader.php index 7c782606d3..7ef49f1f1c 100644 --- a/wp-admin/includes/class-core-upgrader.php +++ b/wp-admin/includes/class-core-upgrader.php @@ -104,7 +104,7 @@ class Core_Upgrader extends WP_Upgrader { */ if ( $parsed_args['do_rollback'] && $current->packages->rollback ) { $to_download = 'rollback'; - } elseif ( $current->packages->partial && 'reinstall' != $current->response && $wp_version == $current->partial_version && $partial ) { + } elseif ( $current->packages->partial && 'reinstall' !== $current->response && $wp_version == $current->partial_version && $partial ) { $to_download = 'partial'; } elseif ( $current->packages->new_bundled && version_compare( $wp_version, $current->new_bundled, '<' ) && ( ! defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) { @@ -402,7 +402,7 @@ class Core_Upgrader extends WP_Upgrader { foreach ( $checksums as $file => $checksum ) { // Skip files which get updated. - if ( 'wp-content' == substr( $file, 0, 10 ) ) { + if ( 'wp-content' === substr( $file, 0, 10 ) ) { continue; } if ( ! file_exists( ABSPATH . $file ) || md5_file( ABSPATH . $file ) !== $checksum ) { diff --git a/wp-admin/includes/class-custom-image-header.php b/wp-admin/includes/class-custom-image-header.php index a8264d5bb7..fe0a2e5015 100644 --- a/wp-admin/includes/class-custom-image-header.php +++ b/wp-admin/includes/class-custom-image-header.php @@ -281,7 +281,7 @@ class Custom_Image_Header { * or 'uploaded' (for the Uploaded Images control). */ public function show_header_selector( $type = 'default' ) { - if ( 'default' == $type ) { + if ( 'default' === $type ) { $headers = $this->default_headers; } else { $headers = get_uploaded_header_images(); @@ -359,7 +359,7 @@ class Custom_Image_Header { if ( ! checked ) return; text_color = $('#text-color'); - if ( '' == text_color.val().replace('#', '') ) { + if ( '' === text_color.val().replace('#', '') ) { text_color.val( default_color ); pickColor( default_color ); } else { diff --git a/wp-admin/includes/class-language-pack-upgrader.php b/wp-admin/includes/class-language-pack-upgrader.php index 0ae18d9e50..e88db55848 100644 --- a/wp-admin/includes/class-language-pack-upgrader.php +++ b/wp-admin/includes/class-language-pack-upgrader.php @@ -188,7 +188,7 @@ class Language_Pack_Upgrader extends WP_Upgrader { return true; } - if ( 'upgrader_process_complete' == current_filter() ) { + if ( 'upgrader_process_complete' === current_filter() ) { $this->skin->feedback( 'starting_upgrade' ); } @@ -232,9 +232,9 @@ class Language_Pack_Upgrader extends WP_Upgrader { $this->skin->language_update = $language_update; $destination = WP_LANG_DIR; - if ( 'plugin' == $language_update->type ) { + if ( 'plugin' === $language_update->type ) { $destination .= '/plugins'; - } elseif ( 'theme' == $language_update->type ) { + } elseif ( 'theme' === $language_update->type ) { $destination .= '/themes'; } @@ -335,9 +335,9 @@ class Language_Pack_Upgrader extends WP_Upgrader { $po = false; $mo = false; foreach ( (array) $files as $file => $filedata ) { - if ( '.po' == substr( $file, -3 ) ) { + if ( '.po' === substr( $file, -3 ) ) { $po = true; - } elseif ( '.mo' == substr( $file, -3 ) ) { + } elseif ( '.mo' === substr( $file, -3 ) ) { $mo = true; } } diff --git a/wp-admin/includes/class-plugin-installer-skin.php b/wp-admin/includes/class-plugin-installer-skin.php index 9ee23be90b..cb44919c66 100644 --- a/wp-admin/includes/class-plugin-installer-skin.php +++ b/wp-admin/includes/class-plugin-installer-skin.php @@ -60,13 +60,13 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin { $from = isset( $_GET['from'] ) ? wp_unslash( $_GET['from'] ) : 'plugins'; - if ( 'import' == $from ) { + if ( 'import' === $from ) { $install_actions['activate_plugin'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=activate&from=import&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ), __( 'Activate Plugin & Run Importer' ) ); - } elseif ( 'press-this' == $from ) { + } elseif ( 'press-this' === $from ) { $install_actions['activate_plugin'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=activate&from=press-this&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ), diff --git a/wp-admin/includes/class-walker-nav-menu-checklist.php b/wp-admin/includes/class-walker-nav-menu-checklist.php index f166a8803d..11e78dd529 100644 --- a/wp-admin/includes/class-walker-nav-menu-checklist.php +++ b/wp-admin/includes/class-walker-nav-menu-checklist.php @@ -75,7 +75,7 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu { global $_nav_menu_placeholder, $nav_menu_selected_id; $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1; - $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder; + $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' === $item->post_type ? $item->object_id : $_nav_menu_placeholder; $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; diff --git a/wp-admin/includes/class-walker-nav-menu-edit.php b/wp-admin/includes/class-walker-nav-menu-edit.php index 183077aab7..fd5ea85219 100644 --- a/wp-admin/includes/class-walker-nav-menu-edit.php +++ b/wp-admin/includes/class-walker-nav-menu-edit.php @@ -72,17 +72,17 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu { $original_title = false; - if ( 'taxonomy' == $item->type ) { + if ( 'taxonomy' === $item->type ) { $original_object = get_term( (int) $item->object_id, $item->object ); if ( $original_object && ! is_wp_error( $original_title ) ) { $original_title = $original_object->name; } - } elseif ( 'post_type' == $item->type ) { + } elseif ( 'post_type' === $item->type ) { $original_object = get_post( $item->object_id ); if ( $original_object ) { $original_title = get_the_title( $original_object->ID ); } - } elseif ( 'post_type_archive' == $item->type ) { + } elseif ( 'post_type_archive' === $item->type ) { $original_object = get_post_type_object( $item->object ); if ( $original_object ) { $original_title = $original_object->labels->archives; @@ -101,13 +101,13 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu { $classes[] = 'menu-item-invalid'; /* translators: %s: Title of an invalid menu item. */ $title = sprintf( __( '%s (Invalid)' ), $item->title ); - } elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) { + } elseif ( isset( $item->post_status ) && 'draft' === $item->post_status ) { $classes[] = 'pending'; /* translators: %s: Title of a menu item in draft status. */ $title = sprintf( __( '%s (Pending)' ), $item->title ); } - $title = ( ! isset( $item->label ) || '' == $item->label ) ? $title : $item->label; + $title = ( ! isset( $item->label ) || '' === $item->label ) ? $title : $item->label; $submenu_text = ''; if ( 0 == $depth ) { @@ -181,7 +181,7 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {