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 {