From 641c632b0c9fde4e094b217f50749984ca43a2fa Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 9 Feb 2020 16:55:09 +0000 Subject: [PATCH] Coding Standards: Use Yoda conditions where appropriate. See #49222. Built from https://develop.svn.wordpress.org/trunk@47219 git-svn-id: http://core.svn.wordpress.org/trunk@47019 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-header.php | 2 +- wp-admin/comment.php | 4 +- wp-admin/edit-comments.php | 2 +- wp-admin/edit-form-advanced.php | 4 +- wp-admin/includes/ajax-actions.php | 40 ++++++------ wp-admin/includes/class-core-upgrader.php | 2 +- .../includes/class-custom-image-header.php | 2 +- .../includes/class-plugin-installer-skin.php | 6 +- .../includes/class-theme-installer-skin.php | 2 +- wp-admin/includes/class-theme-upgrader.php | 8 +-- .../class-walker-category-checklist.php | 2 +- .../includes/class-wp-automatic-updater.php | 16 ++--- .../includes/class-wp-comments-list-table.php | 2 +- .../includes/class-wp-filesystem-direct.php | 4 +- .../includes/class-wp-filesystem-ftpext.php | 8 +-- .../class-wp-filesystem-ftpsockets.php | 2 +- .../includes/class-wp-filesystem-ssh2.php | 4 +- wp-admin/includes/class-wp-importer.php | 2 +- wp-admin/includes/class-wp-list-table.php | 8 +-- .../includes/class-wp-media-list-table.php | 4 +- .../includes/class-wp-ms-sites-list-table.php | 16 ++--- .../class-wp-ms-themes-list-table.php | 6 +- .../includes/class-wp-ms-users-list-table.php | 18 +++--- .../class-wp-plugin-install-list-table.php | 4 +- .../includes/class-wp-posts-list-table.php | 12 ++-- wp-admin/includes/class-wp-screen.php | 4 +- wp-admin/includes/dashboard.php | 2 +- wp-admin/includes/export.php | 6 +- wp-admin/includes/file.php | 4 +- wp-admin/includes/image-edit.php | 8 +-- wp-admin/includes/image.php | 4 +- wp-admin/includes/import.php | 2 +- wp-admin/includes/media.php | 50 +++++++-------- wp-admin/includes/meta-boxes.php | 18 +++--- wp-admin/includes/misc.php | 6 +- wp-admin/includes/ms.php | 20 +++--- wp-admin/includes/nav-menu.php | 2 +- wp-admin/includes/plugin.php | 16 ++--- wp-admin/includes/post.php | 10 +-- wp-admin/includes/privacy-tools.php | 2 +- wp-admin/includes/template.php | 14 ++-- wp-admin/includes/update.php | 6 +- wp-admin/includes/upgrade.php | 40 ++++++------ wp-admin/includes/user.php | 6 +- wp-admin/install-helper.php | 10 +-- wp-admin/menu.php | 2 +- wp-admin/my-sites.php | 2 +- wp-admin/network/settings.php | 4 +- wp-admin/network/site-settings.php | 4 +- wp-admin/network/sites.php | 8 +-- wp-admin/network/users.php | 10 +-- wp-admin/options-general.php | 4 +- wp-admin/post-new.php | 2 +- wp-admin/tools.php | 8 +-- wp-content/themes/twentyeleven/functions.php | 4 +- .../twentyfourteen/inc/custom-header.php | 4 +- .../twentythirteen/inc/custom-header.php | 4 +- .../themes/twentytwelve/inc/custom-header.php | 2 +- wp-includes/bookmark-template.php | 2 +- wp-includes/bookmark.php | 8 +-- wp-includes/capabilities.php | 4 +- wp-includes/category-template.php | 2 +- wp-includes/category.php | 4 +- wp-includes/class-http.php | 2 +- wp-includes/class-walker-page.php | 2 +- wp-includes/class-wp-admin-bar.php | 20 +++--- wp-includes/class-wp-comment-query.php | 6 +- wp-includes/class-wp-customize-widgets.php | 4 +- wp-includes/class-wp-editor.php | 4 +- wp-includes/class-wp-hook.php | 2 +- wp-includes/class-wp-http-curl.php | 4 +- wp-includes/class-wp-http-ixr-client.php | 4 +- wp-includes/class-wp-http-proxy.php | 2 +- wp-includes/class-wp-http-streams.php | 6 +- wp-includes/class-wp-image-editor-imagick.php | 2 +- wp-includes/class-wp-image-editor.php | 2 +- wp-includes/class-wp-network-query.php | 4 +- wp-includes/class-wp-query.php | 34 +++++----- wp-includes/class-wp-rewrite.php | 6 +- wp-includes/class-wp-roles.php | 2 +- .../class-wp-simplepie-sanitize-kses.php | 2 +- wp-includes/class-wp-theme.php | 2 +- wp-includes/class-wp-user.php | 4 +- wp-includes/class-wp-walker.php | 4 +- wp-includes/class-wp-xmlrpc-server.php | 64 +++++++++---------- wp-includes/class.wp-scripts.php | 4 +- wp-includes/class.wp-styles.php | 2 +- wp-includes/comment-template.php | 10 +-- wp-includes/comment.php | 28 ++++---- wp-includes/compat.php | 4 +- ...ass-wp-customize-nav-menu-item-setting.php | 6 +- .../class-wp-customize-nav-menu-setting.php | 6 +- wp-includes/embed.php | 2 +- wp-includes/feed-atom-comments.php | 2 +- wp-includes/feed.php | 4 +- wp-includes/formatting.php | 28 ++++---- wp-includes/functions.php | 38 +++++------ wp-includes/general-template.php | 24 +++---- wp-includes/http.php | 2 +- wp-includes/kses.php | 24 +++---- wp-includes/l10n.php | 8 +-- wp-includes/link-template.php | 32 +++++----- wp-includes/media.php | 20 +++--- wp-includes/ms-files.php | 2 +- wp-includes/ms-functions.php | 40 ++++++------ wp-includes/ms-load.php | 2 +- wp-includes/nav-menu-template.php | 2 +- wp-includes/option.php | 2 +- wp-includes/pluggable.php | 12 ++-- wp-includes/pomo/mo.php | 2 +- wp-includes/pomo/plural-forms.php | 12 ++-- wp-includes/pomo/po.php | 20 +++--- wp-includes/post-template.php | 4 +- wp-includes/post.php | 20 +++--- wp-includes/rest-api.php | 2 +- wp-includes/revision.php | 6 +- wp-includes/rewrite.php | 2 +- wp-includes/script-loader.php | 4 +- wp-includes/shortcodes.php | 4 +- wp-includes/taxonomy.php | 12 ++-- wp-includes/theme.php | 8 +-- wp-includes/user.php | 12 ++-- wp-includes/version.php | 2 +- wp-includes/wp-db.php | 22 +++---- wp-login.php | 4 +- 125 files changed, 555 insertions(+), 555 deletions(-) diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 43652039f1..40ac51cf29 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -288,6 +288,6 @@ if ( is_network_admin() ) { */ do_action( 'all_admin_notices' ); -if ( $parent_file == 'options-general.php' ) { +if ( 'options-general.php' === $parent_file ) { require ABSPATH . 'wp-admin/options-head.php'; } diff --git a/wp-admin/comment.php b/wp-admin/comment.php index ecf56917ff..3f20c3cc2e 100644 --- a/wp-admin/comment.php +++ b/wp-admin/comment.php @@ -101,7 +101,7 @@ switch ( $action ) { } // No need to re-approve/re-trash/re-spam a comment. - if ( $action == str_replace( '1', 'approve', $comment->comment_approved ) ) { + if ( str_replace( '1', 'approve', $comment->comment_approved ) == $action ) { wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) ); die(); } @@ -137,7 +137,7 @@ switch ( $action ) { break; } - if ( $comment->comment_approved != '0' ) { // If not unapproved. + if ( '0' != $comment->comment_approved ) { // If not unapproved. $message = ''; switch ( $comment->comment_approved ) { case '1': diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index 8aface7e45..d74fd62e20 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -31,7 +31,7 @@ if ( $doaction ) { $doaction = 'delete'; } elseif ( isset( $_REQUEST['delete_comments'] ) ) { $comment_ids = $_REQUEST['delete_comments']; - $doaction = ( $_REQUEST['action'] != -1 ) ? $_REQUEST['action'] : $_REQUEST['action2']; + $doaction = ( -1 != $_REQUEST['action'] ) ? $_REQUEST['action'] : $_REQUEST['action2']; } elseif ( isset( $_REQUEST['ids'] ) ) { $comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) ); } elseif ( wp_get_referer() ) { diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index a061e9b899..60d920729d 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -76,7 +76,7 @@ $post_ID = isset( $post_ID ) ? (int) $post_ID : 0; $user_ID = isset( $user_ID ) ? (int) $user_ID : 0; $action = isset( $action ) ? $action : ''; -if ( $post_ID == get_option( 'page_for_posts' ) && empty( $post->post_content ) ) { +if ( get_option( 'page_for_posts' ) == $post_ID && empty( $post->post_content ) ) { add_action( 'edit_form_after_title', '_wp_posts_page_notice' ); remove_post_type_support( $post_type, 'editor' ); } @@ -534,7 +534,7 @@ do_action( 'edit_form_top', $post ); if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) { $shortlink = wp_get_shortlink( $post->ID, 'post' ); - if ( ! empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url( '?page_id=' . $post->ID ) ) { + if ( ! empty( $shortlink ) && $shortlink !== $permalink && home_url( '?page_id=' . $post->ID ) !== $permalink ) { $sample_permalink_html .= ''; } } diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index a0fa7cbf88..aa68c95f59 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -149,7 +149,7 @@ function wp_ajax_ajax_tag_search() { * Require $term_search_min_chars chars for matching (default: 2) * ensure it's a non-negative, non-zero integer. */ - if ( ( $term_search_min_chars == 0 ) || ( strlen( $s ) < $term_search_min_chars ) ) { + if ( ( 0 == $term_search_min_chars ) || ( strlen( $s ) < $term_search_min_chars ) ) { wp_die(); } @@ -295,14 +295,14 @@ function wp_ajax_autocomplete_user() { $id = get_current_blog_id(); } - $include_blog_users = ( $type == 'search' ? get_users( + $include_blog_users = ( 'search' === $type ? get_users( array( 'blog_id' => $id, 'fields' => 'ID', ) ) : array() ); - $exclude_blog_users = ( $type == 'add' ? get_users( + $exclude_blog_users = ( 'add' === $type ? get_users( array( 'blog_id' => $id, 'fields' => 'ID', @@ -391,7 +391,7 @@ function wp_ajax_dashboard_widgets() { require_once ABSPATH . 'wp-admin/includes/dashboard.php'; $pagenow = $_GET['pagenow']; - if ( $pagenow === 'dashboard-user' || $pagenow === 'dashboard-network' || $pagenow === 'dashboard' ) { + if ( 'dashboard-user' === $pagenow || 'dashboard-network' === $pagenow || 'dashboard' === $pagenow ) { set_current_screen( $pagenow ); } @@ -573,7 +573,7 @@ function _wp_ajax_add_hierarchical_term() { $parent = 0; } - if ( $taxonomy->name == 'category' ) { + if ( 'category' === $taxonomy->name ) { $post_category = isset( $_POST['post_category'] ) ? (array) $_POST['post_category'] : array(); } else { $post_category = ( isset( $_POST['tax_input'] ) && isset( $_POST['tax_input'][ $taxonomy->name ] ) ) ? (array) $_POST['tax_input'][ $taxonomy->name ] : array(); @@ -717,7 +717,7 @@ function wp_ajax_delete_comment() { $r = wp_untrash_comment( $comment ); // Undo trash, not in trash. - if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'trash' ) { + if ( ! isset( $_POST['comment_status'] ) || 'trash' !== $_POST['comment_status'] ) { $delta = 1; } } elseif ( isset( $_POST['spam'] ) && 1 == $_POST['spam'] ) { @@ -734,7 +734,7 @@ function wp_ajax_delete_comment() { $r = wp_unspam_comment( $comment ); // Undo spam, not in spam. - if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'spam' ) { + if ( ! isset( $_POST['comment_status'] ) || 'spam' !== $_POST['comment_status'] ) { $delta = 1; } } elseif ( isset( $_POST['delete'] ) && 1 == $_POST['delete'] ) { @@ -1318,7 +1318,7 @@ function wp_ajax_replyto_comment( $action ) { if ( ! empty( $_POST['approve_parent'] ) ) { $parent = get_comment( $comment_parent ); - if ( $parent && $parent->comment_approved === '0' && $parent->comment_post_ID == $comment_post_ID ) { + if ( $parent && '0' === $parent->comment_approved && $parent->comment_post_ID == $comment_post_ID ) { if ( ! current_user_can( 'edit_comment', $parent->comment_ID ) ) { wp_die( -1 ); } @@ -1549,7 +1549,7 @@ function wp_ajax_add_meta() { } // If the post is an autodraft, save the post as a draft and then attempt to save the meta. - if ( $post->post_status == 'auto-draft' ) { + if ( 'auto-draft' === $post->post_status ) { $post_data = array(); $post_data['action'] = 'draft'; // Warning fix. $post_data['post_ID'] = $pid; @@ -1720,7 +1720,7 @@ function wp_ajax_closed_postboxes() { $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; - if ( $page != sanitize_key( $page ) ) { + if ( sanitize_key( $page ) != $page ) { wp_die( 0 ); } @@ -1751,7 +1751,7 @@ function wp_ajax_hidden_columns() { check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' ); $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; - if ( $page != sanitize_key( $page ) ) { + if ( sanitize_key( $page ) != $page ) { wp_die( 0 ); } @@ -1900,13 +1900,13 @@ function wp_ajax_meta_box_order() { $order = isset( $_POST['order'] ) ? (array) $_POST['order'] : false; $page_columns = isset( $_POST['page_columns'] ) ? $_POST['page_columns'] : 'auto'; - if ( $page_columns != 'auto' ) { + if ( 'auto' !== $page_columns ) { $page_columns = (int) $page_columns; } $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; - if ( $page != sanitize_key( $page ) ) { + if ( sanitize_key( $page ) != $page ) { wp_die( 0 ); } @@ -2003,7 +2003,7 @@ function wp_ajax_inline_save() { /* translators: %s: User's display name. */ $msg_template = __( 'Saving is disabled: %s is currently editing this post.' ); - if ( $_POST['post_type'] == 'page' ) { + if ( 'page' === $_POST['post_type'] ) { /* translators: %s: User's display name. */ $msg_template = __( 'Saving is disabled: %s is currently editing this page.' ); } @@ -2067,7 +2067,7 @@ function wp_ajax_inline_save() { $wp_list_table = _get_list_table( 'WP_Posts_List_Table', array( 'screen' => $_POST['screen'] ) ); - $mode = $_POST['post_view'] === 'excerpt' ? 'excerpt' : 'list'; + $mode = 'excerpt' === $_POST['post_view'] ? 'excerpt' : 'list'; $level = 0; if ( is_post_type_hierarchical( $wp_list_table->screen->post_type ) ) { @@ -2639,7 +2639,7 @@ function wp_ajax_set_post_thumbnail() { check_ajax_referer( "set_post_thumbnail-$post_ID" ); } - if ( $thumbnail_id == '-1' ) { + if ( '-1' == $thumbnail_id ) { if ( delete_post_thumbnail( $post_ID ) ) { $return = _wp_post_thumbnail_html( null, $post_ID ); $json ? wp_send_json_success( $return ) : wp_die( $return ); @@ -2819,7 +2819,7 @@ function wp_ajax_wp_remove_post_lock() { $active_lock = array_map( 'absint', explode( ':', $_POST['active_post_lock'] ) ); - if ( $active_lock[1] != get_current_user_id() ) { + if ( get_current_user_id() != $active_lock[1] ) { wp_die( 0 ); } @@ -2844,7 +2844,7 @@ function wp_ajax_wp_remove_post_lock() { function wp_ajax_dismiss_wp_pointer() { $pointer = $_POST['pointer']; - if ( $pointer != sanitize_key( $pointer ) ) { + if ( sanitize_key( $pointer ) != $pointer ) { wp_die( 0 ); } @@ -3022,7 +3022,7 @@ function wp_ajax_save_attachment() { if ( isset( $changes['alt'] ) ) { $alt = wp_unslash( $changes['alt'] ); - if ( $alt != get_post_meta( $id, '_wp_attachment_image_alt', true ) ) { + if ( get_post_meta( $id, '_wp_attachment_image_alt', true ) !== $alt ) { $alt = wp_strip_all_tags( $alt, true ); update_post_meta( $id, '_wp_attachment_image_alt', wp_slash( $alt ) ); } @@ -3816,7 +3816,7 @@ function wp_ajax_destroy_sessions() { $sessions = WP_Session_Tokens::get_instance( $user->ID ); - if ( $user->ID === get_current_user_id() ) { + if ( get_current_user_id() === $user->ID ) { $sessions->destroy_others( wp_get_session_token() ); $message = __( 'You are now logged out everywhere else.' ); } else { diff --git a/wp-admin/includes/class-core-upgrader.php b/wp-admin/includes/class-core-upgrader.php index 95c6c82f76..2073ebd4e6 100644 --- a/wp-admin/includes/class-core-upgrader.php +++ b/wp-admin/includes/class-core-upgrader.php @@ -78,7 +78,7 @@ class Core_Upgrader extends WP_Upgrader { $this->upgrade_strings(); // Is an update available? - if ( ! isset( $current->response ) || $current->response == 'latest' ) { + if ( ! isset( $current->response ) || 'latest' === $current->response ) { return new WP_Error( 'up_to_date', $this->strings['up_to_date'] ); } diff --git a/wp-admin/includes/class-custom-image-header.php b/wp-admin/includes/class-custom-image-header.php index 4f3eb75786..8f005b164b 100644 --- a/wp-admin/includes/class-custom-image-header.php +++ b/wp-admin/includes/class-custom-image-header.php @@ -812,7 +812,7 @@ endif; // If flexible height isn't supported and the image is the exact right size. if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) - && $width == get_theme_support( 'custom-header', 'width' ) && $height == get_theme_support( 'custom-header', 'height' ) ) { + && get_theme_support( 'custom-header', 'width' ) == $width && get_theme_support( 'custom-header', 'height' ) == $height ) { // Add the metadata. if ( file_exists( $file ) ) { wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); diff --git a/wp-admin/includes/class-plugin-installer-skin.php b/wp-admin/includes/class-plugin-installer-skin.php index bfbfe3b533..9ee23be90b 100644 --- a/wp-admin/includes/class-plugin-installer-skin.php +++ b/wp-admin/includes/class-plugin-installer-skin.php @@ -89,19 +89,19 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin { unset( $install_actions['activate_plugin'] ); } - if ( 'import' == $from ) { + if ( 'import' === $from ) { $install_actions['importers_page'] = sprintf( '%s', admin_url( 'import.php' ), __( 'Return to Importers' ) ); - } elseif ( $this->type == 'web' ) { + } elseif ( 'web' === $this->type ) { $install_actions['plugins_page'] = sprintf( '%s', self_admin_url( 'plugin-install.php' ), __( 'Return to Plugin Installer' ) ); - } elseif ( 'upload' == $this->type && 'plugins' == $from ) { + } elseif ( 'upload' === $this->type && 'plugins' === $from ) { $install_actions['plugins_page'] = sprintf( '%s', self_admin_url( 'plugin-install.php' ), diff --git a/wp-admin/includes/class-theme-installer-skin.php b/wp-admin/includes/class-theme-installer-skin.php index 9be44bc614..f568766086 100644 --- a/wp-admin/includes/class-theme-installer-skin.php +++ b/wp-admin/includes/class-theme-installer-skin.php @@ -114,7 +114,7 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin { ); } - if ( $this->type == 'web' ) { + if ( 'web' === $this->type ) { $install_actions['themes_page'] = sprintf( '%s', self_admin_url( 'theme-install.php' ), diff --git a/wp-admin/includes/class-theme-upgrader.php b/wp-admin/includes/class-theme-upgrader.php index ec177a249e..261987401e 100644 --- a/wp-admin/includes/class-theme-upgrader.php +++ b/wp-admin/includes/class-theme-upgrader.php @@ -367,7 +367,7 @@ class Theme_Upgrader extends WP_Upgrader { */ $maintenance = ( is_multisite() && ! empty( $themes ) ); foreach ( $themes as $theme ) { - $maintenance = $maintenance || $theme == get_stylesheet() || $theme == get_template(); + $maintenance = $maintenance || get_stylesheet() === $theme || get_template() === $theme; } if ( $maintenance ) { $this->maintenance_mode( true ); @@ -539,7 +539,7 @@ class Theme_Upgrader extends WP_Upgrader { $theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; - if ( $theme != get_stylesheet() ) { // If not current. + if ( get_stylesheet() !== $theme ) { // If not current. return $return; } @@ -570,12 +570,12 @@ class Theme_Upgrader extends WP_Upgrader { $theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; - if ( $theme != get_stylesheet() ) { // If not current. + if ( get_stylesheet() !== $theme ) { // If not current. return $return; } // Ensure stylesheet name hasn't changed after the upgrade: - if ( $theme == get_stylesheet() && $theme != $this->result['destination_name'] ) { + if ( get_stylesheet() === $theme && $theme != $this->result['destination_name'] ) { wp_clean_themes_cache(); $stylesheet = $this->result['destination_name']; switch_theme( $stylesheet ); diff --git a/wp-admin/includes/class-walker-category-checklist.php b/wp-admin/includes/class-walker-category-checklist.php index 553494d165..488d34d134 100644 --- a/wp-admin/includes/class-walker-category-checklist.php +++ b/wp-admin/includes/class-walker-category-checklist.php @@ -75,7 +75,7 @@ class Walker_Category_Checklist extends Walker { $taxonomy = $args['taxonomy']; } - if ( $taxonomy == 'category' ) { + if ( 'category' === $taxonomy ) { $name = 'post_category'; } else { $name = 'tax_input[' . $taxonomy . ']'; diff --git a/wp-admin/includes/class-wp-automatic-updater.php b/wp-admin/includes/class-wp-automatic-updater.php index cf37ca0e4a..d6ec70e85b 100644 --- a/wp-admin/includes/class-wp-automatic-updater.php +++ b/wp-admin/includes/class-wp-automatic-updater.php @@ -73,7 +73,7 @@ class WP_Automatic_Updater { */ public function is_vcs_checkout( $context ) { $context_dirs = array( untrailingslashit( $context ) ); - if ( $context !== ABSPATH ) { + if ( ABSPATH !== $context ) { $context_dirs[] = untrailingslashit( ABSPATH ); } @@ -86,7 +86,7 @@ class WP_Automatic_Updater { $check_dirs[] = $context_dir; // Once we've hit '/' or 'C:\', we need to stop. dirname will keep returning the input here. - if ( $context_dir == dirname( $context_dir ) ) { + if ( dirname( $context_dir ) === $context_dir ) { break; } @@ -227,7 +227,7 @@ class WP_Automatic_Updater { $notified = get_site_option( 'auto_core_update_notified' ); // Don't notify if we've already notified the same email address of the same version. - if ( $notified && $notified['email'] == get_site_option( 'admin_email' ) && $notified['version'] == $item->current ) { + if ( $notified && get_site_option( 'admin_email' ) === $notified['email'] && $notified['version'] == $item->current ) { return false; } @@ -536,9 +536,9 @@ class WP_Automatic_Updater { // Any of these WP_Error codes are critical failures, as in they occurred after we started to copy core files. // We should not try to perform a background update again until there is a successful one-click update performed by the user. $critical = false; - if ( $error_code === 'disk_full' || false !== strpos( $error_code, '__copy_dir' ) ) { + if ( 'disk_full' === $error_code || false !== strpos( $error_code, '__copy_dir' ) ) { $critical = true; - } elseif ( $error_code === 'rollback_was_required' && is_wp_error( $result->get_error_data()->rollback ) ) { + } elseif ( 'rollback_was_required' === $error_code && is_wp_error( $result->get_error_data()->rollback ) ) { // A rollback is only critical if it failed too. $critical = true; $rollback_result = $result->get_error_data()->rollback; @@ -584,7 +584,7 @@ class WP_Automatic_Updater { $n = get_site_option( 'auto_core_update_notified' ); // Don't notify if we've already notified the same email address of the same version of the same notification type. - if ( $n && 'fail' == $n['type'] && $n['email'] == get_site_option( 'admin_email' ) && $n['version'] == $core_update->current ) { + if ( $n && 'fail' === $n['type'] && get_site_option( 'admin_email' ) === $n['email'] && $n['version'] == $core_update->current ) { $send = false; } @@ -762,7 +762,7 @@ class WP_Automatic_Updater { } // Updates are important! - if ( $type != 'success' || $newer_version_available ) { + if ( 'success' !== $type || $newer_version_available ) { $body .= "\n\n" . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' ); } @@ -771,7 +771,7 @@ class WP_Automatic_Updater { } // If things are successful and we're now on the latest, mention plugins and themes if any are out of date. - if ( $type == 'success' && ! $newer_version_available && ( get_plugin_updates() || get_theme_updates() ) ) { + if ( 'success' === $type && ! $newer_version_available && ( get_plugin_updates() || get_theme_updates() ) ) { $body .= "\n\n" . __( 'You also have some plugins or themes with updates available. Update them now:' ); $body .= "\n" . network_admin_url(); } diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php index b0ad3494f4..f3e1fdf3aa 100644 --- a/wp-admin/includes/class-wp-comments-list-table.php +++ b/wp-admin/includes/class-wp-comments-list-table.php @@ -749,7 +749,7 @@ class WP_Comments_List_Table extends WP_List_Table { // Reply and quickedit need a hide-if-no-js span when not added with ajax. if ( ( 'reply' === $action || 'quickedit' === $action ) && ! wp_doing_ajax() ) { $action .= ' hide-if-no-js'; - } elseif ( ( $action === 'untrash' && $the_comment_status === 'trash' ) || ( $action === 'unspam' && $the_comment_status === 'spam' ) ) { + } elseif ( ( 'untrash' === $action && 'trash' === $the_comment_status ) || ( 'unspam' === $action && 'spam' === $the_comment_status ) ) { if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) ) { $action .= ' approve'; } else { diff --git a/wp-admin/includes/class-wp-filesystem-direct.php b/wp-admin/includes/class-wp-filesystem-direct.php index 11999a4e70..1676a55658 100644 --- a/wp-admin/includes/class-wp-filesystem-direct.php +++ b/wp-admin/includes/class-wp-filesystem-direct.php @@ -471,10 +471,10 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base { * @return bool True on success, false on failure. */ public function touch( $file, $time = 0, $atime = 0 ) { - if ( $time == 0 ) { + if ( 0 == $time ) { $time = time(); } - if ( $atime == 0 ) { + if ( 0 == $atime ) { $atime = time(); } return touch( $file, $time, $atime ); diff --git a/wp-admin/includes/class-wp-filesystem-ftpext.php b/wp-admin/includes/class-wp-filesystem-ftpext.php index ac897046be..241621e852 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpext.php +++ b/wp-admin/includes/class-wp-filesystem-ftpext.php @@ -574,7 +574,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { } else { $lucifer[3] += 1900; // 4-digit year fix. } - $b['isdir'] = ( $lucifer[7] == '' ); + $b['isdir'] = ( '' === $lucifer[7] ); if ( $b['isdir'] ) { $b['type'] = 'd'; } else { @@ -598,8 +598,8 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { return ''; } $b = array(); - $b['isdir'] = $lucifer[0][0] === 'd'; - $b['islink'] = $lucifer[0][0] === 'l'; + $b['isdir'] = 'd' === $lucifer[0][0]; + $b['islink'] = 'l' === $lucifer[0][0]; if ( $b['isdir'] ) { $b['type'] = 'd'; } elseif ( $b['islink'] ) { @@ -613,7 +613,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { $b['owner'] = $lucifer[2]; $b['group'] = $lucifer[3]; $b['size'] = $lucifer[4]; - if ( $lcount == 8 ) { + if ( 8 == $lcount ) { sscanf( $lucifer[5], '%d-%d-%d', $b['year'], $b['month'], $b['day'] ); sscanf( $lucifer[6], '%d:%d', $b['hour'], $b['minute'] ); $b['time'] = mktime( $b['hour'], $b['minute'], 0, $b['month'], $b['day'], $b['year'] ); diff --git a/wp-admin/includes/class-wp-filesystem-ftpsockets.php b/wp-admin/includes/class-wp-filesystem-ftpsockets.php index e78b467473..26ee71c0d5 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpsockets.php +++ b/wp-admin/includes/class-wp-filesystem-ftpsockets.php @@ -202,7 +202,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base { mbstring_binary_safe_encoding(); $bytes_written = fwrite( $temphandle, $contents ); - if ( false === $bytes_written || $bytes_written != strlen( $contents ) ) { + if ( false === $bytes_written || strlen( $contents ) != $bytes_written ) { fclose( $temphandle ); unlink( $temp ); diff --git a/wp-admin/includes/class-wp-filesystem-ssh2.php b/wp-admin/includes/class-wp-filesystem-ssh2.php index 51a0dff86c..41642443d9 100644 --- a/wp-admin/includes/class-wp-filesystem-ssh2.php +++ b/wp-admin/includes/class-wp-filesystem-ssh2.php @@ -238,7 +238,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base { fclose( $stream ); if ( $returnbool ) { - return ( $data === false ) ? false : '' != trim( $data ); + return ( false === $data ) ? false : '' != trim( $data ); } else { return $data; } @@ -285,7 +285,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base { public function put_contents( $file, $contents, $mode = false ) { $ret = file_put_contents( $this->sftp_path( $file ), $contents ); - if ( $ret !== strlen( $contents ) ) { + if ( strlen( $contents ) !== $ret ) { return false; } diff --git a/wp-admin/includes/class-wp-importer.php b/wp-admin/includes/class-wp-importer.php index 5639f1eb36..d2b85c783d 100644 --- a/wp-admin/includes/class-wp-importer.php +++ b/wp-admin/includes/class-wp-importer.php @@ -312,7 +312,7 @@ function get_cli_args( $param, $required = false ) { } $last_arg = $key; - } elseif ( $last_arg !== null ) { + } elseif ( null !== $last_arg ) { $out[ $last_arg ] = $args[ $i ]; } } diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php index 95ae32c5e6..c423eebbca 100644 --- a/wp-admin/includes/class-wp-list-table.php +++ b/wp-admin/includes/class-wp-list-table.php @@ -830,18 +830,18 @@ class WP_List_Table { $disable_prev = false; $disable_next = false; - if ( $current == 1 ) { + if ( 1 == $current ) { $disable_first = true; $disable_prev = true; } - if ( $current == 2 ) { + if ( 2 == $current ) { $disable_first = true; } - if ( $current == $total_pages ) { + if ( $total_pages == $current ) { $disable_last = true; $disable_next = true; } - if ( $current == $total_pages - 1 ) { + if ( $total_pages - 1 == $current ) { $disable_last = true; } diff --git a/wp-admin/includes/class-wp-media-list-table.php b/wp-admin/includes/class-wp-media-list-table.php index f0f3ca8a37..f233f745ad 100644 --- a/wp-admin/includes/class-wp-media-list-table.php +++ b/wp-admin/includes/class-wp-media-list-table.php @@ -626,8 +626,8 @@ class WP_Media_List_Table extends WP_List_Table { while ( have_posts() ) : the_post(); if ( - ( $this->is_trash && $post->post_status != 'trash' ) - || ( ! $this->is_trash && $post->post_status === 'trash' ) + ( $this->is_trash && 'trash' !== $post->post_status ) + || ( ! $this->is_trash && 'trash' === $post->post_status ) ) { continue; } diff --git a/wp-admin/includes/class-wp-ms-sites-list-table.php b/wp-admin/includes/class-wp-ms-sites-list-table.php index 8188844913..995a733823 100644 --- a/wp-admin/includes/class-wp-ms-sites-list-table.php +++ b/wp-admin/includes/class-wp-ms-sites-list-table.php @@ -70,7 +70,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table { global $s, $mode, $wpdb; if ( ! empty( $_REQUEST['mode'] ) ) { - $mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list'; + $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; set_user_setting( 'sites_list_mode', $mode ); } else { $mode = get_user_setting( 'sites_list_mode', 'list' ); @@ -263,7 +263,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table { $url = 'sites.php'; foreach ( $statuses as $status => $label_count ) { - $current_link_attributes = $requested_status === $status || ( $requested_status === '' && 'all' === $status ) + $current_link_attributes = $requested_status === $status || ( '' === $requested_status && 'all' === $status ) ? ' class="current" aria-current="page"' : ''; if ( (int) $counts[ $status ] > 0 ) { @@ -476,7 +476,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table { $date = __( 'Y/m/d g:i:s a' ); } - echo ( $blog['last_updated'] === '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); + echo ( '0000-00-00 00:00:00' === $blog['last_updated'] ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); } /** @@ -497,7 +497,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table { $date = __( 'Y/m/d g:i:s a' ); } - if ( $blog['registered'] === '0000-00-00 00:00:00' ) { + if ( '0000-00-00 00:00:00' === $blog['registered'] ) { echo '—'; } else { echo mysql2date( $date, $blog['registered'] ); @@ -585,7 +585,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table { reset( $this->status_list ); foreach ( $this->status_list as $status => $col ) { - if ( $blog[ $status ] == 1 ) { + if ( 1 == $blog[ $status ] ) { $class = " class='{$col[0]}'"; } } @@ -693,19 +693,19 @@ class WP_MS_Sites_List_Table extends WP_List_Table { $actions['edit'] = '' . __( 'Edit' ) . ''; $actions['backend'] = "" . __( 'Dashboard' ) . ''; if ( get_network()->site_id != $blog['blog_id'] ) { - if ( $blog['deleted'] == '1' ) { + if ( '1' == $blog['deleted'] ) { $actions['activate'] = '' . __( 'Activate' ) . ''; } else { $actions['deactivate'] = '' . __( 'Deactivate' ) . ''; } - if ( $blog['archived'] == '1' ) { + if ( '1' == $blog['archived'] ) { $actions['unarchive'] = '' . __( 'Unarchive' ) . ''; } else { $actions['archive'] = '' . _x( 'Archive', 'verb; site' ) . ''; } - if ( $blog['spam'] == '1' ) { + if ( '1' == $blog['spam'] ) { $actions['unspam'] = '' . _x( 'Not Spam', 'site' ) . ''; } else { $actions['spam'] = '' . _x( 'Spam', 'site' ) . ''; diff --git a/wp-admin/includes/class-wp-ms-themes-list-table.php b/wp-admin/includes/class-wp-ms-themes-list-table.php index 96e17efe58..6cce71439e 100644 --- a/wp-admin/includes/class-wp-ms-themes-list-table.php +++ b/wp-admin/includes/class-wp-ms-themes-list-table.php @@ -166,7 +166,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table { $orderby = ucfirst( $orderby ); $order = strtoupper( $order ); - if ( $orderby === 'Name' ) { + if ( 'Name' === $orderby ) { if ( 'ASC' === $order ) { $this->items = array_reverse( $this->items ); } @@ -502,7 +502,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table { ); } - if ( ! $allowed && current_user_can( 'delete_themes' ) && ! $this->is_site_themes && $stylesheet != get_option( 'stylesheet' ) && $stylesheet != get_option( 'template' ) ) { + if ( ! $allowed && current_user_can( 'delete_themes' ) && ! $this->is_site_themes && get_option( 'stylesheet' ) !== $stylesheet && get_option( 'template' ) !== $stylesheet ) { $url = add_query_arg( array( 'action' => 'delete-selected', @@ -580,7 +580,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table { public function column_description( $theme ) { global $status, $totals; if ( $theme->errors() ) { - $pre = $status === 'broken' ? __( 'Broken Theme:' ) . ' ' : ''; + $pre = 'broken' === $status ? __( 'Broken Theme:' ) . ' ' : ''; echo '

' . $pre . $theme->errors()->get_error_message() . '

'; } diff --git a/wp-admin/includes/class-wp-ms-users-list-table.php b/wp-admin/includes/class-wp-ms-users-list-table.php index de9caf7d9d..1a66738d47 100644 --- a/wp-admin/includes/class-wp-ms-users-list-table.php +++ b/wp-admin/includes/class-wp-ms-users-list-table.php @@ -54,7 +54,7 @@ class WP_MS_Users_List_Table extends WP_List_Table { $args['search'] = '*' . $args['search'] . '*'; } - if ( $role === 'super' ) { + if ( 'super' === $role ) { $args['login__in'] = get_super_admins(); } @@ -84,7 +84,7 @@ class WP_MS_Users_List_Table extends WP_List_Table { } if ( ! empty( $_REQUEST['mode'] ) ) { - $mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list'; + $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; set_user_setting( 'network_users_list_mode', $mode ); } else { $mode = get_user_setting( 'network_users_list_mode', 'list' ); @@ -137,7 +137,7 @@ class WP_MS_Users_List_Table extends WP_List_Table { $super_admins = get_super_admins(); $total_admins = count( $super_admins ); - $current_link_attributes = $role !== 'super' ? ' class="current" aria-current="page"' : ''; + $current_link_attributes = 'super' !== $role ? ' class="current" aria-current="page"' : ''; $role_links = array(); $role_links['all'] = sprintf( '%s', @@ -154,7 +154,7 @@ class WP_MS_Users_List_Table extends WP_List_Table { number_format_i18n( $total_users ) ) ); - $current_link_attributes = $role === 'super' ? ' class="current" aria-current="page"' : ''; + $current_link_attributes = 'super' === $role ? ' class="current" aria-current="page"' : ''; $role_links['super'] = sprintf( '%s', network_admin_url( 'users.php?role=super' ), @@ -371,7 +371,7 @@ class WP_MS_Users_List_Table extends WP_List_Table { continue; } - $path = ( $val->path === '/' ) ? '' : $val->path; + $path = ( '/' === $val->path ) ? '' : $val->path; $site_classes = array( 'site-' . $val->site_id ); /** * Filters the span class for a site listing on the mulisite user list table. @@ -396,16 +396,16 @@ class WP_MS_Users_List_Table extends WP_List_Table { $actions['edit'] = '' . __( 'Edit' ) . ''; $class = ''; - if ( $val->spam == 1 ) { + if ( 1 == $val->spam ) { $class .= 'site-spammed '; } - if ( $val->mature == 1 ) { + if ( 1 == $val->mature ) { $class .= 'site-mature '; } - if ( $val->deleted == 1 ) { + if ( 1 == $val->deleted ) { $class .= 'site-deleted '; } - if ( $val->archived == 1 ) { + if ( 1 == $val->archived ) { $class .= 'site-archived '; } diff --git a/wp-admin/includes/class-wp-plugin-install-list-table.php b/wp-admin/includes/class-wp-plugin-install-list-table.php index fe3f6af9f0..e2f3b1a9be 100644 --- a/wp-admin/includes/class-wp-plugin-install-list-table.php +++ b/wp-admin/includes/class-wp-plugin-install-list-table.php @@ -101,7 +101,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table { if ( 'search' === $tab ) { $tabs['search'] = __( 'Search Results' ); } - if ( $tab === 'beta' || false !== strpos( get_bloginfo( 'version' ), '-' ) ) { + if ( 'beta' === $tab || false !== strpos( get_bloginfo( 'version' ), '-' ) ) { $tabs['beta'] = _x( 'Beta Testing', 'Plugin Installer' ); } $tabs['featured'] = _x( 'Featured', 'Plugin Installer' ); @@ -369,7 +369,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table { * @param string $which */ protected function display_tablenav( $which ) { - if ( $GLOBALS['tab'] === 'featured' ) { + if ( 'featured' === $GLOBALS['tab'] ) { return; } diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index a0f6740e3a..d36cce08fe 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/wp-admin/includes/class-wp-posts-list-table.php @@ -165,7 +165,7 @@ class WP_Posts_List_Table extends WP_List_Table { $total_items = $post_counts[ $_REQUEST['post_status'] ]; } elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) { $total_items = $this->sticky_posts_count; - } elseif ( isset( $_GET['author'] ) && $_GET['author'] == get_current_user_id() ) { + } elseif ( isset( $_GET['author'] ) && get_current_user_id() == $_GET['author'] ) { $total_items = $this->user_posts_count; } else { $total_items = array_sum( $post_counts ); @@ -178,13 +178,13 @@ class WP_Posts_List_Table extends WP_List_Table { } if ( ! empty( $_REQUEST['mode'] ) ) { - $mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list'; + $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; set_user_setting( 'posts_list_mode', $mode ); } else { $mode = get_user_setting( 'posts_list_mode', 'list' ); } - $this->is_trash = isset( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] === 'trash'; + $this->is_trash = isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status']; $this->set_pagination_args( array( @@ -993,7 +993,7 @@ class WP_Posts_List_Table extends WP_List_Table { $can_edit_post = current_user_can( 'edit_post', $post->ID ); - if ( $can_edit_post && $post->post_status != 'trash' ) { + if ( $can_edit_post && 'trash' !== $post->post_status ) { $lock_holder = wp_check_post_lock( $post->ID ); if ( $lock_holder ) { @@ -1014,7 +1014,7 @@ class WP_Posts_List_Table extends WP_List_Table { $title = _draft_or_post_title(); - if ( $can_edit_post && $post->post_status != 'trash' ) { + if ( $can_edit_post && 'trash' !== $post->post_status ) { printf( '%s%s', get_edit_post_link( $post->ID ), @@ -1633,7 +1633,7 @@ class WP_Posts_List_Table extends WP_List_Table { labels->name ); ?> - +
    $taxonomy->name ) ); ?>
diff --git a/wp-admin/includes/class-wp-screen.php b/wp-admin/includes/class-wp-screen.php index e694e6a06a..3a06e3a34a 100644 --- a/wp-admin/includes/class-wp-screen.php +++ b/wp-admin/includes/class-wp-screen.php @@ -373,7 +373,7 @@ final class WP_Screen { if ( isset( self::$_registry[ $id ] ) ) { $screen = self::$_registry[ $id ]; - if ( $screen === get_current_screen() ) { + if ( get_current_screen() === $screen ) { return $screen; } } else { @@ -454,7 +454,7 @@ final class WP_Screen { * @return bool True if the block editor is being loaded, false otherwise. */ public function is_block_editor( $set = null ) { - if ( $set !== null ) { + if ( null !== $set ) { $this->is_block_editor = (bool) $set; } diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 25005d0c92..e64897a8a6 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -509,7 +509,7 @@ function wp_dashboard_quick_press( $error_msg = false ) { $last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID. if ( $last_post_id ) { $post = get_post( $last_post_id ); - if ( empty( $post ) || $post->post_status != 'auto-draft' ) { // auto-draft doesn't exists anymore. + if ( empty( $post ) || 'auto-draft' !== $post->post_status ) { // auto-draft doesn't exist anymore. $post = get_default_post_to_edit( 'post', true ); update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID. } else { diff --git a/wp-admin/includes/export.php b/wp-admin/includes/export.php index 1e510326e3..057e59f3dd 100644 --- a/wp-admin/includes/export.php +++ b/wp-admin/includes/export.php @@ -168,7 +168,7 @@ function export_wp( $args = array() ) { // Put categories in order with no child going before its parent. while ( $cat = array_shift( $categories ) ) { - if ( $cat->parent == 0 || isset( $cats[ $cat->parent ] ) ) { + if ( 0 == $cat->parent || isset( $cats[ $cat->parent ] ) ) { $cats[ $cat->term_id ] = $cat; } else { $categories[] = $cat; @@ -177,7 +177,7 @@ function export_wp( $args = array() ) { // Put terms in order with no child going before its parent. while ( $t = array_shift( $custom_terms ) ) { - if ( $t->parent == 0 || isset( $terms[ $t->parent ] ) ) { + if ( 0 == $t->parent || isset( $terms[ $t->parent ] ) ) { $terms[ $t->term_id ] = $t; } else { $custom_terms[] = $t; @@ -585,7 +585,7 @@ function export_wp( $args = array() ) { post_type ); ?> post_password ); ?> - post_type == 'attachment' ) : ?> + post_type ) : ?> ID ) ); ?> diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index f9603ba35f..b30b2c2083 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -1886,7 +1886,7 @@ function get_filesystem_method( $args = array(), $context = '', $allow_relaxed_f $temp_file_owner = @fileowner( $temp_file_name ); } - if ( $wp_file_owner !== false && $wp_file_owner === $temp_file_owner ) { + if ( false !== $wp_file_owner && $wp_file_owner === $temp_file_owner ) { /* * WordPress is creating files as the same owner as the WordPress files, * this means it's safe to modify & create new files via PHP. @@ -2234,7 +2234,7 @@ function wp_print_request_filesystem_credentials_modal() { ob_start(); $filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() ); ob_end_clean(); - $request_filesystem_credentials = ( $filesystem_method != 'direct' && ! $filesystem_credentials_are_stored ); + $request_filesystem_credentials = ( 'direct' !== $filesystem_method && ! $filesystem_credentials_are_stored ); if ( ! $request_filesystem_credentials ) { return; } diff --git a/wp-admin/includes/image-edit.php b/wp-admin/includes/image-edit.php index 72f4256333..1f75c64abf 100644 --- a/wp-admin/includes/image-edit.php +++ b/wp-admin/includes/image-edit.php @@ -33,7 +33,7 @@ function wp_image_editor( $post_id, $msg = false ) { $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true ); $can_restore = false; if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) ) { - $can_restore = $backup_sizes['full-orig']['file'] != wp_basename( $meta['file'] ); + $can_restore = wp_basename( $meta['file'] ) !== $backup_sizes['full-orig']['file']; } if ( $msg ) { @@ -576,7 +576,7 @@ function image_edit_apply_changes( $image, $changes ) { foreach ( $changes as $operation ) { switch ( $operation->type ) { case 'rotate': - if ( $operation->angle != 0 ) { + if ( 0 != $operation->angle ) { if ( $image instanceof WP_Image_Editor ) { $image->rotate( $operation->angle ); } else { @@ -585,7 +585,7 @@ function image_edit_apply_changes( $image, $changes ) { } break; case 'flip': - if ( $operation->axis != 0 ) { + if ( 0 != $operation->axis ) { if ( $image instanceof WP_Image_Editor ) { $image->flip( ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 ); } else { @@ -954,7 +954,7 @@ function wp_save_image( $post_id ) { wp_update_attachment_metadata( $post_id, $meta ); update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes ); - if ( $target == 'thumbnail' || $target == 'all' || $target == 'full' ) { + if ( 'thumbnail' === $target || 'all' === $target || 'full' === $target ) { // Check if it's an image edit from attachment edit screen. if ( ! empty( $_REQUEST['context'] ) && 'edit-attachment' == $_REQUEST['context'] ) { $thumb_url = wp_get_attachment_image_src( $post_id, array( 900, 600 ), true ); diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index 5d1a8d7bc3..2ebcad1d86 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -247,7 +247,7 @@ function wp_create_image_subsizes( $file, $attachment_id ) { } // Do not scale (large) PNG images. May result in sub-sizes that have greater file size than the original. See #48736. - if ( $imagesize['mime'] !== 'image/png' ) { + if ( 'image/png' !== $imagesize['mime'] ) { /** * Filters the "BIG image" threshold value. @@ -310,7 +310,7 @@ function wp_create_image_subsizes( $file, $attachment_id ) { } else { // TODO: Log errors. } - } elseif ( ! empty( $exif_meta['orientation'] ) && (int) $exif_meta['orientation'] !== 1 ) { + } elseif ( ! empty( $exif_meta['orientation'] ) && 1 !== (int) $exif_meta['orientation'] ) { // Rotate the whole original image if there is EXIF data and "orientation" is not 1. $editor = wp_get_image_editor( $file ); diff --git a/wp-admin/includes/import.php b/wp-admin/includes/import.php index e15faef1d2..a91477db55 100644 --- a/wp-admin/includes/import.php +++ b/wp-admin/includes/import.php @@ -176,7 +176,7 @@ function wp_get_popular_importers() { foreach ( $popular_importers['importers'] as &$importer ) { // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText $importer['description'] = translate( $importer['description'] ); - if ( $importer['name'] != 'WordPress' ) { + if ( 'WordPress' !== $importer['name'] ) { // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText $importer['name'] = translate( $importer['name'] ); } diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 8b73bae036..6d1b085c2a 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -635,7 +635,7 @@ function media_buttons( $editor_id = 'content' ) { $img = ' '; - $id_attribute = $instance === 1 ? ' id="insert-media-button"' : ''; + $id_attribute = 1 === $instance ? ' id="insert-media-button"' : ''; printf( '', @@ -767,7 +767,7 @@ function media_upload_form_handler() { if ( isset( $attachment['image_alt'] ) ) { $image_alt = wp_unslash( $attachment['image_alt'] ); - if ( $image_alt != get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) { + if ( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) !== $image_alt ) { $image_alt = wp_strip_all_tags( $image_alt, true ); // update_post_meta() expects slashed. @@ -947,7 +947,7 @@ function wp_media_upload_handler() { } } - if ( isset( $_GET['tab'] ) && $_GET['tab'] == 'type_url' ) { + if ( isset( $_GET['tab'] ) && 'type_url' === $_GET['tab'] ) { $type = 'image'; if ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'video', 'audio', 'file' ) ) ) { @@ -1003,7 +1003,7 @@ function media_sideload_image( $file, $post_id = 0, $desc = null, $return = 'htm @unlink( $file_array['tmp_name'] ); return $id; // If attachment id was requested, return it early. - } elseif ( $return === 'id' ) { + } elseif ( 'id' === $return ) { return $id; } @@ -1012,7 +1012,7 @@ function media_sideload_image( $file, $post_id = 0, $desc = null, $return = 'htm // Finally, check to make sure the file has been saved, then return the HTML. if ( ! empty( $src ) ) { - if ( $return === 'src' ) { + if ( 'src' === $return ) { return $src; } @@ -1211,9 +1211,9 @@ function image_link_input_fields( $post, $url_type = '' ) { $url = ''; - if ( $url_type == 'file' ) { + if ( 'file' === $url_type ) { $url = $file; - } elseif ( $url_type == 'post' ) { + } elseif ( 'post' === $url_type ) { $url = $link; } @@ -1324,7 +1324,7 @@ function image_media_send_to_editor( $html, $attachment_id, $attachment ) { $align = ! empty( $attachment['align'] ) ? $attachment['align'] : 'none'; $size = ! empty( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium'; $alt = ! empty( $attachment['image_alt'] ) ? $attachment['image_alt'] : ''; - $rel = ( strpos( $url, 'attachment_id' ) || $url === get_attachment_link( $attachment_id ) ); + $rel = ( strpos( $url, 'attachment_id' ) || get_attachment_link( $attachment_id ) === $url ); return get_image_send_to_editor( $attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size, $alt ); } @@ -1491,7 +1491,7 @@ function get_media_items( $post_id, $errors ) { if ( $post_id ) { $post = get_post( $post_id ); - if ( $post && $post->post_type == 'attachment' ) { + if ( $post && 'attachment' === $post->post_type ) { $attachments = array( $post->ID => $post ); } else { $attachments = get_children( @@ -1513,7 +1513,7 @@ function get_media_items( $post_id, $errors ) { $output = ''; foreach ( (array) $attachments as $id => $attachment ) { - if ( $attachment->post_status == 'trash' ) { + if ( 'trash' === $attachment->post_status ) { continue; } @@ -1735,7 +1735,7 @@ function get_media_item( $attachment_id, $args = null ) { $hidden_fields = array(); foreach ( $form_fields as $id => $field ) { - if ( $id[0] == '_' ) { + if ( '_' === $id[0] ) { continue; } @@ -1747,7 +1747,7 @@ function get_media_item( $attachment_id, $args = null ) { $field = array_merge( $defaults, $field ); $name = "attachments[$attachment_id][$id]"; - if ( $field['input'] == 'hidden' ) { + if ( 'hidden' === $field['input'] ) { $hidden_fields[ $name ] = $field['value']; continue; } @@ -1761,7 +1761,7 @@ function get_media_item( $attachment_id, $args = null ) { if ( ! empty( $field[ $field['input'] ] ) ) { $item .= $field[ $field['input'] ]; - } elseif ( $field['input'] == 'textarea' ) { + } elseif ( 'textarea' === $field['input'] ) { if ( 'post_content' == $id && user_can_richedit() ) { // Sanitize_post() skips the post_content when user_can_richedit. $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES ); @@ -1919,7 +1919,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) { $item = ''; foreach ( $form_fields as $id => $field ) { - if ( $id[0] == '_' ) { + if ( '_' === $id[0] ) { continue; } @@ -1937,7 +1937,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) { continue; } - if ( $field['input'] == 'hidden' ) { + if ( 'hidden' === $field['input'] ) { $hidden_fields[ $name ] = $field['value']; continue; } @@ -1954,7 +1954,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) { if ( ! empty( $field[ $field['input'] ] ) ) { $item .= $field[ $field['input'] ]; - } elseif ( $field['input'] == 'textarea' ) { + } elseif ( 'textarea' === $field['input'] ) { if ( 'post_content' == $id && user_can_richedit() ) { // sanitize_post() skips the post_content when user_can_richedit. $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES ); @@ -2716,7 +2716,7 @@ function media_upload_library_form( $errors ) { $_GET['post_mime_type'] = $type; list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query(); } - if ( empty( $_GET['post_mime_type'] ) || $_GET['post_mime_type'] == 'all' ) { + if ( empty( $_GET['post_mime_type'] ) || 'all' === $_GET['post_mime_type'] ) { $class = ' class="current"'; } else { $class = ''; @@ -2800,7 +2800,7 @@ function media_upload_library_form( $errors ) { yyear == 0 ) { + if ( 0 == $arc_row->yyear ) { continue; } @@ -2926,13 +2926,13 @@ function wp_media_insert_url_form( $default_view = 'image' ) {

- + - + - + - + @@ -3272,8 +3272,8 @@ function attachment_submitbox_metadata() { if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $post->ID ), $matches ) ) { echo esc_html( strtoupper( $matches[1] ) ); list( $mime_type ) = explode( '/', $post->post_mime_type ); - if ( $mime_type !== 'image' && ! empty( $meta['mime_type'] ) ) { - if ( $meta['mime_type'] !== "$mime_type/" . strtolower( $matches[1] ) ) { + if ( 'image' !== $mime_type && ! empty( $meta['mime_type'] ) ) { + if ( "$mime_type/" . strtolower( $matches[1] ) !== $meta['mime_type'] ) { echo ' (' . $meta['mime_type'] . ')'; } } @@ -3535,7 +3535,7 @@ function wp_read_video_metadata( $file ) { if ( empty( $metadata['created_timestamp'] ) ) { $created_timestamp = wp_get_media_creation_timestamp( $data ); - if ( $created_timestamp !== false ) { + if ( false !== $created_timestamp ) { $metadata['created_timestamp'] = $created_timestamp; } } diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index 7316a1a65b..b171496f03 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -157,14 +157,14 @@ function post_submit_meta_box( $post, $args = array() ) { post_status ) { + if ( 'private' === $post->post_status ) { $post->post_password = ''; $visibility = 'private'; $visibility_trans = __( 'Private' ); } elseif ( ! empty( $post->post_password ) ) { $visibility = 'password'; $visibility_trans = __( 'Password protected' ); - } elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) { + } elseif ( 'post' === $post_type && is_sticky( $post->ID ) ) { $visibility = 'public'; $visibility_trans = __( 'Public, Sticky' ); } else { @@ -180,12 +180,12 @@ function post_submit_meta_box( $post, $args = array() ) {
- + ID ) ); ?> /> />
- + ID ) ); ?> />
/>
@@ -263,7 +263,7 @@ endif;
- +
@@ -598,7 +598,7 @@ function post_categories_meta_box( $post, $box ) {
"; ?> @@ -1148,13 +1148,13 @@ function link_target_meta_box( $link ) { ?>

diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index e965efa35e..736dba8f3e 100644 --- a/wp-admin/includes/misc.php +++ b/wp-admin/includes/misc.php @@ -649,7 +649,7 @@ function set_screen_options() { $option = $_POST['wp_screen_options']['option']; $value = $_POST['wp_screen_options']['value']; - if ( $option != sanitize_key( $option ) ) { + if ( sanitize_key( $option ) != $option ) { return; } @@ -744,7 +744,7 @@ function iis7_rewrite_rule_exists( $filename ) { } $xpath = new DOMXPath( $doc ); $rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' ); - if ( $rules->length == 0 ) { + if ( 0 == $rules->length ) { return false; } else { return true; @@ -1289,7 +1289,7 @@ function wp_page_reload_on_back_button_js() { * @param string $value The proposed new site admin email address. */ function update_option_new_admin_email( $old_value, $value ) { - if ( $value == get_option( 'admin_email' ) || ! is_email( $value ) ) { + if ( get_option( 'admin_email' ) === $value || ! is_email( $value ) ) { return; } diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php index fc6e6f2d00..d66433a2e5 100644 --- a/wp-admin/includes/ms.php +++ b/wp-admin/includes/ms.php @@ -20,7 +20,7 @@ function check_upload_size( $file ) { return $file; } - if ( $file['error'] != '0' ) { // There's already an error. + if ( '0' != $file['error'] ) { // There's already an error. return $file; } @@ -45,7 +45,7 @@ function check_upload_size( $file ) { $file['error'] = __( 'You have used your space quota. Please delete files before uploading.' ); } - if ( $file['error'] != '0' && ! isset( $_POST['html-upload'] ) && ! wp_doing_ajax() ) { + if ( '0' != $file['error'] && ! isset( $_POST['html-upload'] ) && ! wp_doing_ajax() ) { wp_die( $file['error'] . ' ' . __( 'Back' ) . '' ); } @@ -548,7 +548,7 @@ function format_code_lang( $code = '' ) { * if `$taxonomy` is 'category' or 'post_tag'. */ function sync_category_tag_slugs( $term, $taxonomy ) { - if ( global_terms_enabled() && ( $taxonomy == 'category' || $taxonomy == 'post_tag' ) ) { + if ( global_terms_enabled() && ( 'category' === $taxonomy || 'post_tag' === $taxonomy ) ) { if ( is_object( $term ) ) { $term->slug = sanitize_title( $term->name ); } else { @@ -644,11 +644,11 @@ function mu_dropdown_languages( $lang_files = array(), $current = '' ) { foreach ( (array) $lang_files as $val ) { $code_lang = basename( $val, '.mo' ); - if ( $code_lang == 'en_US' ) { // American English. + if ( 'en_US' === $code_lang ) { // American English. $flag = true; $ae = __( 'American English' ); $output[ $ae ] = ''; - } elseif ( $code_lang == 'en_GB' ) { // British English. + } elseif ( 'en_GB' === $code_lang ) { // British English. $flag = true; $be = __( 'British English' ); $output[ $be ] = ''; @@ -658,7 +658,7 @@ function mu_dropdown_languages( $lang_files = array(), $current = '' ) { } } - if ( $flag === false ) { // WordPress English. + if ( false === $flag ) { // WordPress English. $output[] = ''; } @@ -725,10 +725,10 @@ function avoid_blog_page_permalink_collision( $data, $postarr ) { if ( is_subdomain_install() ) { return $data; } - if ( $data['post_type'] != 'page' ) { + if ( 'page' !== $data['post_type'] ) { return $data; } - if ( ! isset( $data['post_name'] ) || $data['post_name'] == '' ) { + if ( ! isset( $data['post_name'] ) || '' === $data['post_name'] ) { return $data; } if ( ! is_main_site() ) { @@ -813,7 +813,7 @@ function choose_primary_blog() { * @return bool True if network can be edited, otherwise false. */ function can_edit_network( $network_id ) { - if ( $network_id == get_current_network_id() ) { + if ( get_current_network_id() == $network_id ) { $result = true; } else { $result = false; @@ -873,7 +873,7 @@ function confirm_delete_users( $users ) { ID ) ) { diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php index 759c152fc0..be068c21eb 100644 --- a/wp-admin/includes/nav-menu.php +++ b/wp-admin/includes/nav-menu.php @@ -1266,7 +1266,7 @@ function _wp_expand_nav_menu_post_data() { // Build the new array value from leaf to trunk. for ( $i = count( $array_bits ) - 1; $i >= 0; $i-- ) { - if ( $i == count( $array_bits ) - 1 ) { + if ( count( $array_bits ) - 1 == $i ) { $new_post_data[ $array_bits[ $i ] ] = wp_slash( $post_input_data->value ); } else { $new_post_data = array( $array_bits[ $i ] => $new_post_data ); diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 9cd11e7a3b..2de370c64d 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -1834,7 +1834,7 @@ function get_admin_page_parent( $parent = '' ) { return $parent; } - if ( $pagenow == 'admin.php' && isset( $plugin_page ) ) { + if ( 'admin.php' === $pagenow && isset( $plugin_page ) ) { foreach ( (array) $menu as $parent_menu ) { if ( $parent_menu[2] == $plugin_page ) { $parent_file = $plugin_page; @@ -1866,7 +1866,7 @@ function get_admin_page_parent( $parent = '' ) { if ( isset( $_wp_real_parent_file[ $parent ] ) ) { $parent = $_wp_real_parent_file[ $parent ]; } - if ( ! empty( $typenow ) && ( $submenu_array[2] == "$pagenow?post_type=$typenow" ) ) { + if ( ! empty( $typenow ) && ( "$pagenow?post_type=$typenow" === $submenu_array[2] ) ) { $parent_file = $parent; return $parent; } elseif ( $submenu_array[2] == $pagenow && empty( $typenow ) && ( empty( $parent_file ) || false === strpos( $parent_file, '?' ) ) ) { @@ -1935,7 +1935,7 @@ function get_admin_page_title() { ( $parent == $pagenow ) || ( $parent == $plugin_page ) || ( $plugin_page == $hook ) || - ( $pagenow == 'admin.php' && $parent1 != $submenu_array[2] ) || + ( 'admin.php' === $pagenow && $parent1 != $submenu_array[2] ) || ( ! empty( $typenow ) && $parent == $pagenow . '?post_type=' . $typenow ) ) ) { @@ -1960,7 +1960,7 @@ function get_admin_page_title() { foreach ( $menu as $menu_array ) { if ( isset( $plugin_page ) && ( $plugin_page == $menu_array[2] ) && - ( $pagenow == 'admin.php' ) && + ( 'admin.php' === $pagenow ) && ( $parent1 == $menu_array[2] ) ) { $title = $menu_array[3]; return $menu_array[3]; @@ -2156,7 +2156,7 @@ function option_update_filter( $options ) { * @return array */ function add_option_whitelist( $new_options, $options = '' ) { - if ( $options == '' ) { + if ( '' == $options ) { global $whitelist_options; } else { $whitelist_options = $options; @@ -2169,7 +2169,7 @@ function add_option_whitelist( $new_options, $options = '' ) { $whitelist_options[ $page ][] = $key; } else { $pos = array_search( $key, $whitelist_options[ $page ] ); - if ( $pos === false ) { + if ( false === $pos ) { $whitelist_options[ $page ][] = $key; } } @@ -2191,7 +2191,7 @@ function add_option_whitelist( $new_options, $options = '' ) { * @return array */ function remove_option_whitelist( $del_options, $options = '' ) { - if ( $options == '' ) { + if ( '' == $options ) { global $whitelist_options; } else { $whitelist_options = $options; @@ -2201,7 +2201,7 @@ function remove_option_whitelist( $del_options, $options = '' ) { foreach ( $keys as $key ) { if ( isset( $whitelist_options[ $page ] ) && is_array( $whitelist_options[ $page ] ) ) { $pos = array_search( $key, $whitelist_options[ $page ] ); - if ( $pos !== false ) { + if ( false !== $pos ) { unset( $whitelist_options[ $page ][ $pos ] ); } } diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index d204f09e05..1e8b20e668 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -109,7 +109,7 @@ function _wp_translate_postdata( $update = false, $post_data = null ) { if ( isset( $post_data['saveasprivate'] ) && '' != $post_data['saveasprivate'] ) { $post_data['post_status'] = 'private'; } - if ( isset( $post_data['publish'] ) && ( '' != $post_data['publish'] ) && ( ! isset( $post_data['post_status'] ) || $post_data['post_status'] != 'private' ) ) { + if ( isset( $post_data['publish'] ) && ( '' != $post_data['publish'] ) && ( ! isset( $post_data['post_status'] ) || 'private' !== $post_data['post_status'] ) ) { $post_data['post_status'] = 'publish'; } if ( isset( $post_data['advanced'] ) && '' != $post_data['advanced'] ) { @@ -377,7 +377,7 @@ function edit_post( $post_data = null ) { if ( isset( $post_data['_wp_attachment_image_alt'] ) ) { $image_alt = wp_unslash( $post_data['_wp_attachment_image_alt'] ); - if ( $image_alt != get_post_meta( $post_ID, '_wp_attachment_image_alt', true ) ) { + if ( get_post_meta( $post_ID, '_wp_attachment_image_alt', true ) !== $image_alt ) { $image_alt = wp_strip_all_tags( $image_alt, true ); // update_post_meta() expects slashed. @@ -1452,7 +1452,7 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { } // Encourage a pretty permalink setting. - if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && ! ( 'page' == get_option( 'show_on_front' ) && $id == get_option( 'page_on_front' ) ) ) { + if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && ! ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $id ) ) { $return .= '' . __( 'Change Permalinks' ) . "\n"; } } else { @@ -1596,7 +1596,7 @@ function wp_check_post_lock( $post_id ) { /** This filter is documented in wp-admin/includes/ajax-actions.php */ $time_window = apply_filters( 'wp_check_post_lock_window', 150 ); - if ( $time && $time > time() - $time_window && $user != get_current_user_id() ) { + if ( $time && $time > time() - $time_window && get_current_user_id() != $user ) { return $user; } @@ -1951,7 +1951,7 @@ function wp_autosave( $post_data ) { $post_data['post_status'] = 'draft'; } - if ( $post_data['post_type'] != 'page' && ! empty( $post_data['catslist'] ) ) { + if ( 'page' !== $post_data['post_type'] && ! empty( $post_data['catslist'] ) ) { $post_data['post_category'] = explode( ',', $post_data['catslist'] ); } diff --git a/wp-admin/includes/privacy-tools.php b/wp-admin/includes/privacy-tools.php index c871a1a8e5..bb8a0be8a2 100644 --- a/wp-admin/includes/privacy-tools.php +++ b/wp-admin/includes/privacy-tools.php @@ -694,7 +694,7 @@ function wp_privacy_process_personal_data_export_page( $response, $exporter_inde // If we are not yet on the last page of the last exporter, return now. /** This filter is documented in wp-admin/includes/ajax-actions.php */ $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() ); - $is_last_exporter = $exporter_index === count( $exporters ); + $is_last_exporter = count( $exporters ) === $exporter_index; $exporter_done = $response['done']; if ( ! $is_last_exporter || ! $exporter_done ) { return $response; diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 49718e8bd0..5cf9246a67 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -432,7 +432,7 @@ function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $ } if ( ! $wp_list_table ) { - if ( $mode == 'single' ) { + if ( 'single' === $mode ) { $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' ); } else { $wp_list_table = _get_list_table( 'WP_Comments_List_Table' ); @@ -2195,12 +2195,12 @@ function _media_states( $post ) { $header_image = get_header_image(); // Display "Header Image" if the image was ever used as a header image. - if ( ! empty( $meta_header ) && $meta_header == $stylesheet && $header_image !== wp_get_attachment_url( $post->ID ) ) { + if ( ! empty( $meta_header ) && $meta_header === $stylesheet && wp_get_attachment_url( $post->ID ) !== $header_image ) { $media_states[] = __( 'Header Image' ); } // Display "Current Header Image" if the image is currently the header image. - if ( $header_image && $header_image == wp_get_attachment_url( $post->ID ) ) { + if ( $header_image && wp_get_attachment_url( $post->ID ) === $header_image ) { $media_states[] = __( 'Current Header Image' ); } } @@ -2209,21 +2209,21 @@ function _media_states( $post ) { if ( current_theme_supports( 'custom-background' ) ) { $meta_background = get_post_meta( $post->ID, '_wp_attachment_is_custom_background', true ); - if ( ! empty( $meta_background ) && $meta_background == $stylesheet ) { + if ( ! empty( $meta_background ) && $meta_background === $stylesheet ) { $media_states[] = __( 'Background Image' ); $background_image = get_background_image(); - if ( $background_image && $background_image == wp_get_attachment_url( $post->ID ) ) { + if ( $background_image && wp_get_attachment_url( $post->ID ) === $background_image ) { $media_states[] = __( 'Current Background Image' ); } } } - if ( $post->ID == get_option( 'site_icon' ) ) { + if ( get_option( 'site_icon' ) == $post->ID ) { $media_states[] = __( 'Site Icon' ); } - if ( $post->ID == get_theme_mod( 'custom_logo' ) ) { + if ( get_theme_mod( 'custom_logo' ) == $post->ID ) { $media_states[] = __( 'Logo' ); } diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php index f5aad434ab..464ae93d22 100644 --- a/wp-admin/includes/update.php +++ b/wp-admin/includes/update.php @@ -56,7 +56,7 @@ function get_core_updates( $options = array() ) { $updates = $from_api->updates; $result = array(); foreach ( $updates as $update ) { - if ( $update->response == 'autoupdate' ) { + if ( 'autoupdate' === $update->response ) { continue; } @@ -291,7 +291,7 @@ function update_nag() { $cur = get_preferred_from_update_core(); - if ( ! isset( $cur->response ) || $cur->response != 'upgrade' ) { + if ( ! isset( $cur->response ) || 'upgrade' !== $cur->response ) { return false; } @@ -337,7 +337,7 @@ function update_right_now_message() { if ( current_user_can( 'update_core' ) ) { $cur = get_preferred_from_update_core(); - if ( isset( $cur->response ) && $cur->response == 'upgrade' ) { + if ( isset( $cur->response ) && 'upgrade' === $cur->response ) { $msg .= sprintf( '%s ', network_admin_url( 'update-core.php' ), diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 03aadb13fa..26614c9634 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -161,7 +161,7 @@ if ( ! function_exists( 'wp_install_defaults' ) ) : if ( global_terms_enabled() ) { $cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) ); - if ( $cat_id == null ) { + if ( null == $cat_id ) { $wpdb->insert( $wpdb->sitecategories, array( @@ -495,7 +495,7 @@ Commenter avatars come from Gravatar.' // Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) // TODO: Get previous_blog_id. - if ( ! is_super_admin( $user_id ) && $user_id != 1 ) { + if ( ! is_super_admin( $user_id ) && 1 != $user_id ) { $wpdb->delete( $wpdb->usermeta, array( @@ -566,7 +566,7 @@ function wp_install_maybe_enable_pretty_permalinks() { */ $response = wp_remote_get( $test_url, array( 'timeout' => 5 ) ); $x_pingback_header = wp_remote_retrieve_header( $response, 'x-pingback' ); - $pretty_permalinks = $x_pingback_header && $x_pingback_header === get_bloginfo( 'pingback_url' ); + $pretty_permalinks = $x_pingback_header && get_bloginfo( 'pingback_url' ) === $x_pingback_header; if ( $pretty_permalinks ) { return true; @@ -1127,22 +1127,22 @@ function upgrade_160() { if ( isset( $user->user_idmode ) ) : $idmode = $user->user_idmode; - if ( $idmode == 'nickname' ) { + if ( 'nickname' === $idmode ) { $id = $user->user_nickname; } - if ( $idmode == 'login' ) { + if ( 'login' === $idmode ) { $id = $user->user_login; } - if ( $idmode == 'firstname' ) { + if ( 'firstname' === $idmode ) { $id = $user->user_firstname; } - if ( $idmode == 'lastname' ) { + if ( 'lastname' === $idmode ) { $id = $user->user_lastname; } - if ( $idmode == 'namefl' ) { + if ( 'namefl' === $idmode ) { $id = $user->user_firstname . ' ' . $user->user_lastname; } - if ( $idmode == 'namelf' ) { + if ( 'namelf' === $idmode ) { $id = $user->user_lastname . ' ' . $user->user_firstname; } if ( ! $idmode ) { @@ -2249,7 +2249,7 @@ function upgrade_network() { } // 4.2 - if ( $wp_current_db_version < 31351 && $wpdb->charset === 'utf8mb4' ) { + if ( $wp_current_db_version < 31351 && 'utf8mb4' === $wpdb->charset ) { if ( wp_should_upgrade_global_tables() ) { $wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" ); $wpdb->query( "ALTER TABLE $wpdb->site DROP INDEX domain, ADD INDEX domain(domain(140),path(51))" ); @@ -2499,21 +2499,21 @@ function get_alloptions_110() { function __get_option( $setting ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore global $wpdb; - if ( $setting == 'home' && defined( 'WP_HOME' ) ) { + if ( 'home' === $setting && defined( 'WP_HOME' ) ) { return untrailingslashit( WP_HOME ); } - if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) ) { + if ( 'siteurl' === $setting && defined( 'WP_SITEURL' ) ) { return untrailingslashit( WP_SITEURL ); } $option = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting ) ); - if ( 'home' == $setting && '' == $option ) { + if ( 'home' === $setting && '' == $option ) { return __get_option( 'siteurl' ); } - if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting || 'tag_base' == $setting ) { + if ( 'siteurl' === $setting || 'home' === $setting || 'category_base' === $setting || 'tag_base' === $setting ) { $option = untrailingslashit( $option ); } @@ -2861,7 +2861,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N 'fieldname' => $tableindex->Column_name, 'subpart' => $tableindex->Sub_part, ); - $index_ary[ $keyname ]['unique'] = ( $tableindex->Non_unique == 0 ) ? true : false; + $index_ary[ $keyname ]['unique'] = ( 0 == $tableindex->Non_unique ) ? true : false; $index_ary[ $keyname ]['index_type'] = $tableindex->Index_type; } @@ -2870,7 +2870,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N // Build a create string to compare to the query. $index_string = ''; - if ( $index_name == 'primary' ) { + if ( 'primary' === $index_name ) { $index_string .= 'PRIMARY '; } elseif ( $index_data['unique'] ) { $index_string .= 'UNIQUE '; @@ -2889,7 +2889,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N // For each column in the index. foreach ( $index_data['columns'] as $column_data ) { - if ( $index_columns != '' ) { + if ( '' != $index_columns ) { $index_columns .= ','; } @@ -3000,14 +3000,14 @@ function make_site_theme_from_oldschool( $theme_name, $template ) { ); foreach ( $files as $oldfile => $newfile ) { - if ( $oldfile == 'index.php' ) { + if ( 'index.php' === $oldfile ) { $oldpath = $home_path; } else { $oldpath = ABSPATH; } // Check to make sure it's not a new index. - if ( $oldfile == 'index.php' ) { + if ( 'index.php' === $oldfile ) { $index = implode( '', file( "$oldpath/$oldfile" ) ); if ( strpos( $index, 'WP_USE_THEMES' ) !== false ) { if ( ! copy( WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME . '/index.php', "$site_dir/$newfile" ) ) { @@ -3183,7 +3183,7 @@ function make_site_theme() { // Make the new site theme active. $current_template = __get_option( 'template' ); - if ( $current_template == WP_DEFAULT_THEME ) { + if ( WP_DEFAULT_THEME == $current_template ) { update_option( 'template', $template ); update_option( 'stylesheet', $template ); } diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index d37da01327..4411880768 100644 --- a/wp-admin/includes/user.php +++ b/wp-admin/includes/user.php @@ -70,7 +70,7 @@ function edit_user( $user_id = 0 ) { */ if ( ( is_multisite() && current_user_can( 'manage_network_users' ) ) || - $user_id !== get_current_user_id() || + get_current_user_id() !== $user_id || ( $potential_role && $potential_role->has_cap( 'promote_users' ) ) ) { $user->role = $new_role; @@ -81,7 +81,7 @@ function edit_user( $user_id = 0 ) { $user->user_email = sanitize_text_field( wp_unslash( $_POST['email'] ) ); } if ( isset( $_POST['url'] ) ) { - if ( empty( $_POST['url'] ) || $_POST['url'] == 'http://' ) { + if ( empty( $_POST['url'] ) || 'http://' === $_POST['url'] ) { $user->user_url = ''; } else { $user->user_url = esc_url_raw( $_POST['url'] ); @@ -143,7 +143,7 @@ function edit_user( $user_id = 0 ) { $errors = new WP_Error(); /* checking that username has been typed */ - if ( $user->user_login == '' ) { + if ( '' == $user->user_login ) { $errors->add( 'user_login', __( 'Error: Please enter a username.' ) ); } diff --git a/wp-admin/install-helper.php b/wp-admin/install-helper.php index 185bba9544..b97370d791 100644 --- a/wp-admin/install-helper.php +++ b/wp-admin/install-helper.php @@ -175,19 +175,19 @@ function check_column( $table_name, $col_name, $col_type, $is_null = null, $key if ( $row->Field == $col_name ) { // Got our column, check the params. - if ( ( $col_type != null ) && ( $row->Type != $col_type ) ) { + if ( ( null != $col_type ) && ( $row->Type != $col_type ) ) { ++$diffs; } - if ( ( $is_null != null ) && ( $row->Null != $is_null ) ) { + if ( ( null != $is_null ) && ( $row->Null != $is_null ) ) { ++$diffs; } - if ( ( $key != null ) && ( $row->Key != $key ) ) { + if ( ( null != $key ) && ( $row->Key != $key ) ) { ++$diffs; } - if ( ( $default != null ) && ( $row->Default != $default ) ) { + if ( ( null != $default ) && ( $row->Default != $default ) ) { ++$diffs; } - if ( ( $extra != null ) && ( $row->Extra != $extra ) ) { + if ( ( null != $extra ) && ( $row->Extra != $extra ) ) { ++$diffs; } if ( $diffs > 0 ) { diff --git a/wp-admin/menu.php b/wp-admin/menu.php index 1dae7c23c6..77cf7d68bd 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -120,7 +120,7 @@ $builtin = array( 'post', 'page' ); foreach ( array_merge( $builtin, $types ) as $ptype ) { $ptype_obj = get_post_type_object( $ptype ); // Check if it should be a submenu. - if ( $ptype_obj->show_in_menu !== true ) { + if ( true !== $ptype_obj->show_in_menu ) { continue; } $ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : ++$_wp_last_object_menu; // If we're to use $_wp_last_object_menu, increment it first. diff --git a/wp-admin/my-sites.php b/wp-admin/my-sites.php index 6ee48eac55..888cb12360 100644 --- a/wp-admin/my-sites.php +++ b/wp-admin/my-sites.php @@ -107,7 +107,7 @@ else : * @param string $context Context of the setting (global or site-specific). Default 'global'. */ $settings_html = apply_filters( 'myblogs_options', '', 'global' ); - if ( $settings_html != '' ) { + if ( '' != $settings_html ) { echo '

' . __( 'Global Settings' ) . '

'; echo $settings_html; } diff --git a/wp-admin/network/settings.php b/wp-admin/network/settings.php index 8aaaa3353b..2a26b48ab5 100644 --- a/wp-admin/network/settings.php +++ b/wp-admin/network/settings.php @@ -165,7 +165,7 @@ if ( isset( $_GET['updated'] ) ) {

@@ -257,7 +257,7 @@ if ( isset( $_GET['updated'] ) ) { $limited_email_domains = str_replace( ' ', "\n", $limited_email_domains ); ?> +

diff --git a/wp-admin/network/site-settings.php b/wp-admin/network/site-settings.php index 0e2597f82a..fdbcb3add7 100644 --- a/wp-admin/network/site-settings.php +++ b/wp-admin/network/site-settings.php @@ -43,7 +43,7 @@ if ( isset( $_REQUEST['action'] ) && 'update-site' == $_REQUEST['action'] && is_ foreach ( (array) $_POST['option'] as $key => $val ) { $key = wp_unslash( $key ); $val = wp_unslash( $val ); - if ( $key === 0 || is_array( $val ) || in_array( $key, $skip_options ) ) { + if ( 0 === $key || is_array( $val ) || in_array( $key, $skip_options ) ) { continue; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options. } update_option( $key, $val ); @@ -124,7 +124,7 @@ if ( ! empty( $messages ) ) { ); $options = $wpdb->get_results( $query ); foreach ( $options as $option ) { - if ( $option->option_name == 'default_role' ) { + if ( 'default_role' === $option->option_name ) { $editblog_default_role = $option->option_value; } $disabled = false; diff --git a/wp-admin/network/sites.php b/wp-admin/network/sites.php index a4a7a2beb3..a82cdc9ffc 100644 --- a/wp-admin/network/sites.php +++ b/wp-admin/network/sites.php @@ -141,7 +141,7 @@ if ( isset( $_GET['action'] ) ) { } $updated_action = 'not_deleted'; - if ( $id != '0' && $id != get_network()->site_id && current_user_can( 'delete_site', $id ) ) { + if ( '0' != $id && get_network()->site_id != $id && current_user_can( 'delete_site', $id ) ) { wpmu_delete_blog( $id, true ); $updated_action = 'delete'; } @@ -153,7 +153,7 @@ if ( isset( $_GET['action'] ) ) { foreach ( (array) $_POST['site_ids'] as $site_id ) { $site_id = (int) $site_id; - if ( $site_id == get_network()->site_id ) { + if ( get_network()->site_id == $site_id ) { continue; } @@ -178,10 +178,10 @@ if ( isset( $_GET['action'] ) ) { case 'allblogs': if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allblogs'] ) ) { - $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; + $doaction = -1 != $_POST['action'] ? $_POST['action'] : $_POST['action2']; foreach ( (array) $_POST['allblogs'] as $key => $val ) { - if ( $val != '0' && $val != get_network()->site_id ) { + if ( '0' != $val && get_network()->site_id != $val ) { switch ( $doaction ) { case 'delete': require_once ABSPATH . 'wp-admin/admin-header.php'; diff --git a/wp-admin/network/users.php b/wp-admin/network/users.php index b096fe945c..263ae57709 100644 --- a/wp-admin/network/users.php +++ b/wp-admin/network/users.php @@ -27,7 +27,7 @@ if ( isset( $_GET['action'] ) ) { check_admin_referer( 'deleteuser' ); $id = intval( $_GET['id'] ); - if ( $id != '0' && $id != '1' ) { + if ( '0' != $id && '1' != $id ) { $_POST['allusers'] = array( $id ); // confirm_delete_users() can only handle arrays. $title = __( 'Users' ); $parent_file = 'users.php'; @@ -49,7 +49,7 @@ if ( isset( $_GET['action'] ) ) { if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allusers'] ) ) { check_admin_referer( 'bulk-users-network' ); - $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; + $doaction = -1 != $_POST['action'] ? $_POST['action'] : $_POST['action2']; $userfunction = ''; foreach ( (array) $_POST['allusers'] as $user_id ) { @@ -84,7 +84,7 @@ if ( isset( $_GET['action'] ) ) { $blogs = get_blogs_of_user( $user_id, true ); foreach ( (array) $blogs as $details ) { - if ( $details->userblog_id != get_network()->site_id ) { // Main blog is not a spam! + if ( get_network()->site_id != $details->userblog_id ) { // Main blog is not a spam! update_blog_status( $details->userblog_id, 'spam', '1' ); } } @@ -176,7 +176,7 @@ if ( isset( $_GET['action'] ) ) { } } - if ( $i == 1 ) { + if ( 1 == $i ) { $deletefunction = 'delete'; } else { $deletefunction = 'all_delete'; @@ -239,7 +239,7 @@ get_current_screen()->set_screen_reader_content( require_once ABSPATH . 'wp-admin/admin-header.php'; -if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty( $_REQUEST['action'] ) ) { +if ( isset( $_REQUEST['updated'] ) && 'true' == $_REQUEST['updated'] && ! empty( $_REQUEST['action'] ) ) { ?>

The new address will not become active until confirmed.' ); ?>

@@ -183,7 +183,7 @@ if ( ! empty( $languages ) || ! empty( $translations ) ) { ); // Add note about deprecated WPLANG constant. - if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && $locale !== WPLANG ) { + if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && WPLANG !== $locale ) { _deprecated_argument( 'define()', '4.0.0', diff --git a/wp-admin/post-new.php b/wp-admin/post-new.php index 234dd39de6..6052efc65e 100644 --- a/wp-admin/post-new.php +++ b/wp-admin/post-new.php @@ -34,7 +34,7 @@ if ( 'post' == $post_type ) { } } else { $submenu_file = "post-new.php?post_type=$post_type"; - if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) { + if ( isset( $post_type_object ) && $post_type_object->show_in_menu && true !== $post_type_object->show_in_menu ) { $parent_file = $post_type_object->show_in_menu; // What if there isn't a post-new.php item for this post type? if ( ! isset( $_registered_pages[ get_plugin_page_hookname( "post-new.php?post_type=$post_type", $post_type_object->show_in_menu ) ] ) ) { diff --git a/wp-admin/tools.php b/wp-admin/tools.php index f74362a172..76f2a85ab7 100644 --- a/wp-admin/tools.php +++ b/wp-admin/tools.php @@ -9,10 +9,10 @@ if ( isset( $_GET['page'] ) && ! empty( $_POST ) ) { // Ensure POST-ing to `tools.php?page=export_personal_data` and `tools.php?page=remove_personal_data` // continues to work after creating the new files for exporting and erasing of personal data. - if ( $_GET['page'] === 'export_personal_data' ) { + if ( 'export_personal_data' === $_GET['page'] ) { require_once ABSPATH . 'wp-admin/export-personal-data.php'; return; - } elseif ( $_GET['page'] === 'remove_personal_data' ) { + } elseif ( 'remove_personal_data' === $_GET['page'] ) { require_once ABSPATH . 'wp-admin/erase-personal-data.php'; return; } @@ -27,10 +27,10 @@ if ( isset( $_GET['wp-privacy-policy-guide'] ) ) { exit; } elseif ( isset( $_GET['page'] ) ) { // These were also moved to files in WP 5.3. - if ( $_GET['page'] === 'export_personal_data' ) { + if ( 'export_personal_data' === $_GET['page'] ) { wp_redirect( admin_url( 'export-personal-data.php' ), 301 ); exit; - } elseif ( $_GET['page'] === 'remove_personal_data' ) { + } elseif ( 'remove_personal_data' === $_GET['page'] ) { wp_redirect( admin_url( 'erase-personal-data.php' ), 301 ); exit; } diff --git a/wp-content/themes/twentyeleven/functions.php b/wp-content/themes/twentyeleven/functions.php index 2e5215e7a3..6fdb4459fd 100644 --- a/wp-content/themes/twentyeleven/functions.php +++ b/wp-content/themes/twentyeleven/functions.php @@ -319,7 +319,7 @@ if ( ! function_exists( 'twentyeleven_header_style' ) ) : $text_color = get_header_textcolor(); // If no custom options for text are set, let's bail. - if ( $text_color == HEADER_TEXTCOLOR ) { + if ( HEADER_TEXTCOLOR == $text_color ) { return; } @@ -416,7 +416,7 @@ if ( ! function_exists( 'twentyeleven_admin_header_image' ) ) : $color = get_header_textcolor(); $image = get_header_image(); $style = 'display: none;'; - if ( $color && $color != 'blank' ) { + if ( $color && 'blank' !== $color ) { $style = 'color: #' . $color . ';'; } ?> diff --git a/wp-content/themes/twentyfourteen/inc/custom-header.php b/wp-content/themes/twentyfourteen/inc/custom-header.php index a459c0b003..49ee8ac278 100644 --- a/wp-content/themes/twentyfourteen/inc/custom-header.php +++ b/wp-content/themes/twentyfourteen/inc/custom-header.php @@ -63,7 +63,7 @@ if ( ! function_exists( 'twentyfourteen_header_style' ) ) : $text_color = get_header_textcolor(); // If no custom color for text is set, let's bail. - if ( display_header_text() && $text_color === get_theme_support( 'custom-header', 'default-text-color' ) ) { + if ( display_header_text() && get_theme_support( 'custom-header', 'default-text-color' ) === $text_color ) { return; } @@ -82,7 +82,7 @@ if ( ! function_exists( 'twentyfourteen_header_style' ) ) : } .site-title a { color: #; diff --git a/wp-content/themes/twentythirteen/inc/custom-header.php b/wp-content/themes/twentythirteen/inc/custom-header.php index 29a98f3f52..7bbb50ec35 100644 --- a/wp-content/themes/twentythirteen/inc/custom-header.php +++ b/wp-content/themes/twentythirteen/inc/custom-header.php @@ -90,7 +90,7 @@ function twentythirteen_header_style() { $text_color = get_header_textcolor(); // If no custom options for text are set, let's bail. - if ( empty( $header_image ) && $text_color == get_theme_support( 'custom-header', 'default-text-color' ) ) { + if ( empty( $header_image ) && get_theme_support( 'custom-header', 'default-text-color' ) == $text_color ) { return; } @@ -136,7 +136,7 @@ function twentythirteen_header_style() { endif; // If the user has set a custom color for the text, use that. - elseif ( $text_color != get_theme_support( 'custom-header', 'default-text-color' ) ) : + elseif ( get_theme_support( 'custom-header', 'default-text-color' ) != $text_color ) : ?> .site-title, .site-description { diff --git a/wp-content/themes/twentytwelve/inc/custom-header.php b/wp-content/themes/twentytwelve/inc/custom-header.php index c985246f8b..693883ca7a 100644 --- a/wp-content/themes/twentytwelve/inc/custom-header.php +++ b/wp-content/themes/twentytwelve/inc/custom-header.php @@ -71,7 +71,7 @@ function twentytwelve_header_style() { $text_color = get_header_textcolor(); // If no custom options for text are set, let's bail. - if ( $text_color == get_theme_support( 'custom-header', 'default-text-color' ) ) { + if ( get_theme_support( 'custom-header', 'default-text-color' ) == $text_color ) { return; } diff --git a/wp-includes/bookmark-template.php b/wp-includes/bookmark-template.php index 604034d82f..9385a36982 100644 --- a/wp-includes/bookmark-template.php +++ b/wp-includes/bookmark-template.php @@ -113,7 +113,7 @@ function _walk_bookmarks( $bookmarks, $args = '' ) { $output .= $parsed_args['link_before']; - if ( $bookmark->link_image != null && $parsed_args['show_images'] ) { + if ( null != $bookmark->link_image && $parsed_args['show_images'] ) { if ( strpos( $bookmark->link_image, 'http' ) === 0 ) { $output .= "link_image\" $alt $title />"; } else { // If it's a relative path. diff --git a/wp-includes/bookmark.php b/wp-includes/bookmark.php index 529d493311..ef0f11aac5 100644 --- a/wp-includes/bookmark.php +++ b/wp-includes/bookmark.php @@ -52,11 +52,11 @@ function get_bookmark( $bookmark, $output = OBJECT, $filter = 'raw' ) { $_bookmark = sanitize_bookmark( $_bookmark, $filter ); - if ( $output == OBJECT ) { + if ( OBJECT == $output ) { return $_bookmark; - } elseif ( $output == ARRAY_A ) { + } elseif ( ARRAY_A == $output ) { return get_object_vars( $_bookmark ); - } elseif ( $output == ARRAY_N ) { + } elseif ( ARRAY_N == $output ) { return array_values( get_object_vars( $_bookmark ) ); } else { return $_bookmark; @@ -305,7 +305,7 @@ function get_bookmarks( $args = '' ) { $query = "SELECT * $length $recently_updated_test $get_updated FROM $wpdb->links $join WHERE 1=1 $visible $category_query"; $query .= " $exclusions $inclusions $search"; $query .= " ORDER BY $orderby $order"; - if ( $parsed_args['limit'] != -1 ) { + if ( -1 != $parsed_args['limit'] ) { $query .= ' LIMIT ' . $parsed_args['limit']; } diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index f05c504cc1..f48cb58968 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -534,7 +534,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) { break; } - if ( 'delete_term' === $cap && ( $term->term_id == get_option( 'default_' . $term->taxonomy ) ) ) { + if ( 'delete_term' === $cap && ( get_option( 'default_' . $term->taxonomy ) == $term->term_id ) ) { $caps[] = 'do_not_allow'; break; } @@ -867,7 +867,7 @@ function get_super_admins() { * @return bool True if the user is a site admin. */ function is_super_admin( $user_id = false ) { - if ( ! $user_id || $user_id == get_current_user_id() ) { + if ( ! $user_id || get_current_user_id() == $user_id ) { $user = wp_get_current_user(); } else { $user = get_userdata( $user_id ); diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index 4374359780..edd5db6ecd 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -836,7 +836,7 @@ function wp_generate_tag_cloud( $tags, $args = '' ) { $translate_nooped_plural = $args['topic_count_text']; } elseif ( ! empty( $args['topic_count_text_callback'] ) ) { // Look for the alternative callback style. Ignore the previous default. - if ( $args['topic_count_text_callback'] === 'default_topic_count_text' ) { + if ( 'default_topic_count_text' === $args['topic_count_text_callback'] ) { /* translators: %s: Number of items (tags). */ $translate_nooped_plural = _n_noop( '%s item', '%s items' ); } else { diff --git a/wp-includes/category.php b/wp-includes/category.php index a0fe2b48e1..3f5cb1929b 100644 --- a/wp-includes/category.php +++ b/wp-includes/category.php @@ -127,7 +127,7 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ $category_paths = explode( '/', $category_paths ); $full_path = ''; foreach ( (array) $category_paths as $pathdir ) { - $full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title( $pathdir ); + $full_path .= ( '' != $pathdir ? '/' : '' ) . sanitize_title( $pathdir ); } $categories = get_terms( array( @@ -144,7 +144,7 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ foreach ( $categories as $category ) { $path = '/' . $leaf_path; $curcategory = $category; - while ( ( $curcategory->parent != 0 ) && ( $curcategory->parent != $curcategory->term_id ) ) { + while ( ( 0 != $curcategory->parent ) && ( $curcategory->parent != $curcategory->term_id ) ) { $curcategory = get_term( $curcategory->parent, 'category' ); if ( is_wp_error( $curcategory ) ) { return $curcategory; diff --git a/wp-includes/class-http.php b/wp-includes/class-http.php index 3db499f6c7..f839af1df6 100644 --- a/wp-includes/class-http.php +++ b/wp-includes/class-http.php @@ -485,7 +485,7 @@ class WP_Http { */ public static function browser_redirect_compatibility( $location, $headers, $data, &$options, $original ) { // Browser compatibility. - if ( $original->status_code === 302 ) { + if ( 302 === $original->status_code ) { $options['type'] = Requests::GET; } } diff --git a/wp-includes/class-walker-page.php b/wp-includes/class-walker-page.php index eac5a4f9fd..0b77c422bf 100644 --- a/wp-includes/class-walker-page.php +++ b/wp-includes/class-walker-page.php @@ -130,7 +130,7 @@ class Walker_Page extends Walker { } elseif ( $_current_page && $page->ID == $_current_page->post_parent ) { $css_class[] = 'current_page_parent'; } - } elseif ( $page->ID == get_option( 'page_for_posts' ) ) { + } elseif ( get_option( 'page_for_posts' ) == $page->ID ) { $css_class[] = 'current_page_parent'; } diff --git a/wp-includes/class-wp-admin-bar.php b/wp-includes/class-wp-admin-bar.php index 519f382544..063aa32a39 100644 --- a/wp-includes/class-wp-admin-bar.php +++ b/wp-includes/class-wp-admin-bar.php @@ -318,7 +318,7 @@ class WP_Admin_Bar { } foreach ( $this->_get_nodes() as $node ) { - if ( 'root' == $node->id ) { + if ( 'root' === $node->id ) { continue; } @@ -329,9 +329,9 @@ class WP_Admin_Bar { } // Generate the group class (we distinguish between top level and other level groups). - $group_class = ( $node->parent == 'root' ) ? 'ab-top-menu' : 'ab-submenu'; + $group_class = ( 'root' === $node->parent ) ? 'ab-top-menu' : 'ab-submenu'; - if ( $node->type == 'group' ) { + if ( 'group' === $node->type ) { if ( empty( $node->meta['class'] ) ) { $node->meta['class'] = $group_class; } else { @@ -340,7 +340,7 @@ class WP_Admin_Bar { } // Items in items aren't allowed. Wrap nested items in 'default' groups. - if ( $parent->type == 'item' && $node->type == 'item' ) { + if ( 'item' === $parent->type && 'item' === $node->type ) { $default_id = $parent->id . '-default'; $default = $this->_get_node( $default_id ); @@ -369,7 +369,7 @@ class WP_Admin_Bar { // Groups in groups aren't allowed. Add a special 'container' node. // The container will invisibly wrap both groups. - } elseif ( $parent->type == 'group' && $node->type == 'group' ) { + } elseif ( 'group' === $parent->type && 'group' === $node->type ) { $container_id = $parent->id . '-container'; $container = $this->_get_node( $container_id ); @@ -398,7 +398,7 @@ class WP_Admin_Bar { $container->parent = $grandparent->id; $index = array_search( $parent, $grandparent->children, true ); - if ( $index === false ) { + if ( false === $index ) { $grandparent->children[] = $container; } else { array_splice( $grandparent->children, $index, 1, array( $container ) ); @@ -469,7 +469,7 @@ class WP_Admin_Bar { * @param object $node */ final protected function _render_container( $node ) { - if ( $node->type != 'container' || empty( $node->children ) ) { + if ( 'container' !== $node->type || empty( $node->children ) ) { return; } @@ -484,11 +484,11 @@ class WP_Admin_Bar { * @param object $node */ final protected function _render_group( $node ) { - if ( $node->type == 'container' ) { + if ( 'container' === $node->type ) { $this->_render_container( $node ); return; } - if ( $node->type != 'group' || empty( $node->children ) ) { + if ( 'group' !== $node->type || empty( $node->children ) ) { return; } @@ -509,7 +509,7 @@ class WP_Admin_Bar { * @param object $node */ final protected function _render_item( $node ) { - if ( $node->type != 'item' ) { + if ( 'item' !== $node->type ) { return; } diff --git a/wp-includes/class-wp-comment-query.php b/wp-includes/class-wp-comment-query.php index 44def385cc..8d788a3ec3 100644 --- a/wp-includes/class-wp-comment-query.php +++ b/wp-includes/class-wp-comment-query.php @@ -1138,11 +1138,11 @@ class WP_Comment_Query { } $parsed = false; - if ( $orderby == $this->query_vars['meta_key'] || $orderby == 'meta_value' ) { + if ( $this->query_vars['meta_key'] === $orderby || 'meta_value' === $orderby ) { $parsed = "$wpdb->commentmeta.meta_value"; - } elseif ( $orderby == 'meta_value_num' ) { + } elseif ( 'meta_value_num' === $orderby ) { $parsed = "$wpdb->commentmeta.meta_value+0"; - } elseif ( $orderby == 'comment__in' ) { + } elseif ( 'comment__in' === $orderby ) { $comment__in = implode( ',', array_map( 'absint', $this->query_vars['comment__in'] ) ); $parsed = "FIELD( {$wpdb->comments}.comment_ID, $comment__in )"; } elseif ( in_array( $orderby, $allowed_keys ) ) { diff --git a/wp-includes/class-wp-customize-widgets.php b/wp-includes/class-wp-customize-widgets.php index f1e6817d41..42953fe033 100644 --- a/wp-includes/class-wp-customize-widgets.php +++ b/wp-includes/class-wp-customize-widgets.php @@ -1007,7 +1007,7 @@ final class WP_Customize_Widgets { 'temp_id' => isset( $args['_temp_id'] ) ? $args['_temp_id'] : null, 'is_multi' => $is_multi_widget, 'control_tpl' => $control_tpl, - 'multi_number' => ( $args['_add'] === 'multi' ) ? $args['_multi_num'] : false, + 'multi_number' => ( 'multi' === $args['_add'] ) ? $args['_multi_num'] : false, 'is_disabled' => $is_disabled, 'id_base' => $id_base, 'transport' => $this->is_widget_selective_refreshable( $id_base ) ? 'postMessage' : 'refresh', @@ -1313,7 +1313,7 @@ final class WP_Customize_Widgets { * @return array|void Sanitized widget instance. */ public function sanitize_widget_instance( $value ) { - if ( $value === array() ) { + if ( array() === $value ) { return $value; } diff --git a/wp-includes/class-wp-editor.php b/wp-includes/class-wp-editor.php index ce375bcf61..4dcdd8505f 100644 --- a/wp-includes/class-wp-editor.php +++ b/wp-includes/class-wp-editor.php @@ -243,7 +243,7 @@ final class _WP_Editors { $quicktags_toolbar = ''; if ( self::$this_quicktags ) { - if ( 'content' === $editor_id && ! empty( $GLOBALS['current_screen'] ) && $GLOBALS['current_screen']->base === 'post' ) { + if ( 'content' === $editor_id && ! empty( $GLOBALS['current_screen'] ) && 'post' === $GLOBALS['current_screen']->base ) { $toolbar_id = 'ed_toolbar'; } else { $toolbar_id = 'qt_' . $editor_id_attr . '_toolbar'; @@ -743,7 +743,7 @@ final class _WP_Editors { $page_template = get_page_template_slug( $post ); - if ( $page_template !== false ) { + if ( false !== $page_template ) { $page_template = empty( $page_template ) ? 'default' : str_replace( '.', '-', basename( $page_template, '.php' ) ); $body_class .= ' page-template-' . sanitize_html_class( $page_template ); } diff --git a/wp-includes/class-wp-hook.php b/wp-includes/class-wp-hook.php index b8a936b0fd..f7446222b1 100644 --- a/wp-includes/class-wp-hook.php +++ b/wp-includes/class-wp-hook.php @@ -281,7 +281,7 @@ final class WP_Hook implements Iterator, ArrayAccess { } // Avoid the array_slice() if possible. - if ( $the_['accepted_args'] == 0 ) { + if ( 0 == $the_['accepted_args'] ) { $value = call_user_func( $the_['function'] ); } elseif ( $the_['accepted_args'] >= $num_args ) { $value = call_user_func_array( $the_['function'], $args ); diff --git a/wp-includes/class-wp-http-curl.php b/wp-includes/class-wp-http-curl.php index 878f02c996..8225a290f4 100644 --- a/wp-includes/class-wp-http-curl.php +++ b/wp-includes/class-wp-http-curl.php @@ -129,7 +129,7 @@ class WP_Http_Curl { curl_setopt( $handle, CURLOPT_URL, $url ); curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true ); - curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, ( $ssl_verify === true ) ? 2 : false ); + curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, ( true === $ssl_verify ) ? 2 : false ); curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify ); if ( $ssl_verify ) { @@ -209,7 +209,7 @@ class WP_Http_Curl { curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers ); } - if ( $parsed_args['httpversion'] == '1.0' ) { + if ( '1.0' === $parsed_args['httpversion'] ) { curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 ); } else { curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 ); diff --git a/wp-includes/class-wp-http-ixr-client.php b/wp-includes/class-wp-http-ixr-client.php index 40fb7c47c1..f873e8f728 100644 --- a/wp-includes/class-wp-http-ixr-client.php +++ b/wp-includes/class-wp-http-ixr-client.php @@ -76,7 +76,7 @@ class WP_HTTP_IXR_Client extends IXR_Client { */ $args['headers'] = apply_filters( 'wp_http_ixr_client_headers', $args['headers'] ); - if ( $this->timeout !== false ) { + if ( false !== $this->timeout ) { $args['timeout'] = $this->timeout; } @@ -112,7 +112,7 @@ class WP_HTTP_IXR_Client extends IXR_Client { } // Is the message a fault? - if ( $this->message->messageType == 'fault' ) { + if ( 'fault' === $this->message->messageType ) { $this->error = new IXR_Error( $this->message->faultCode, $this->message->faultString ); return false; } diff --git a/wp-includes/class-wp-http-proxy.php b/wp-includes/class-wp-http-proxy.php index 63a1186012..f8d89ef65c 100644 --- a/wp-includes/class-wp-http-proxy.php +++ b/wp-includes/class-wp-http-proxy.php @@ -174,7 +174,7 @@ class WP_HTTP_Proxy { $check = @parse_url( $uri ); // Malformed URL, can not process, but this could mean ssl, so let through anyway. - if ( $check === false ) { + if ( false === $check ) { return true; } diff --git a/wp-includes/class-wp-http-streams.php b/wp-includes/class-wp-http-streams.php index ddab16e295..f50053cf31 100644 --- a/wp-includes/class-wp-http-streams.php +++ b/wp-includes/class-wp-http-streams.php @@ -55,9 +55,9 @@ class WP_Http_Streams { $connect_host = $arrURL['host']; - $secure_transport = ( $arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https' ); + $secure_transport = ( 'ssl' === $arrURL['scheme'] || 'https' === $arrURL['scheme'] ); if ( ! isset( $arrURL['port'] ) ) { - if ( $arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https' ) { + if ( 'ssl' === $arrURL['scheme'] || 'https' === $arrURL['scheme'] ) { $arrURL['port'] = 443; $secure_transport = true; } else { @@ -390,7 +390,7 @@ class WP_Http_Streams { $match_against = preg_split( '/,\s*/', $cert['extensions']['subjectAltName'] ); foreach ( $match_against as $match ) { list( $match_type, $match_host ) = explode( ':', $match ); - if ( $host_type == strtolower( trim( $match_type ) ) ) { // IP: or DNS: + if ( strtolower( trim( $match_type ) ) === $host_type ) { // IP: or DNS: $certificate_hostnames[] = strtolower( trim( $match_host ) ); } } diff --git a/wp-includes/class-wp-image-editor-imagick.php b/wp-includes/class-wp-image-editor-imagick.php index 820288ea79..ea2c48eb4d 100644 --- a/wp-includes/class-wp-image-editor-imagick.php +++ b/wp-includes/class-wp-image-editor-imagick.php @@ -103,7 +103,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { // setIteratorIndex is optional unless mime is an animated format. // Here, we just say no if you are missing it and aren't loading a jpeg. - if ( ! method_exists( 'Imagick', 'setIteratorIndex' ) && $mime_type !== 'image/jpeg' ) { + if ( ! method_exists( 'Imagick', 'setIteratorIndex' ) && 'image/jpeg' !== $mime_type ) { return false; } diff --git a/wp-includes/class-wp-image-editor.php b/wp-includes/class-wp-image-editor.php index 8cacb9c7ba..82afc9cce7 100644 --- a/wp-includes/class-wp-image-editor.php +++ b/wp-includes/class-wp-image-editor.php @@ -418,7 +418,7 @@ abstract class WP_Image_Editor { */ $orientation = apply_filters( 'wp_image_maybe_exif_rotate', $orientation, $this->file ); - if ( ! $orientation || $orientation === 1 ) { + if ( ! $orientation || 1 === $orientation ) { return false; } diff --git a/wp-includes/class-wp-network-query.php b/wp-includes/class-wp-network-query.php index 4df608c767..0bd06e3982 100644 --- a/wp-includes/class-wp-network-query.php +++ b/wp-includes/class-wp-network-query.php @@ -545,10 +545,10 @@ class WP_Network_Query { ); $parsed = false; - if ( $orderby == 'network__in' ) { + if ( 'network__in' === $orderby ) { $network__in = implode( ',', array_map( 'absint', $this->query_vars['network__in'] ) ); $parsed = "FIELD( {$wpdb->site}.id, $network__in )"; - } elseif ( $orderby == 'domain_length' || $orderby == 'path_length' ) { + } elseif ( 'domain_length' === $orderby || 'path_length' === $orderby ) { $field = substr( $orderby, 0, -7 ); $parsed = "CHAR_LENGTH($wpdb->site.$field)"; } elseif ( in_array( $orderby, $allowed_keys ) ) { diff --git a/wp-includes/class-wp-query.php b/wp-includes/class-wp-query.php index 38df928f08..6d6c294478 100644 --- a/wp-includes/class-wp-query.php +++ b/wp-includes/class-wp-query.php @@ -910,7 +910,7 @@ class WP_Query { } unset( $tax_query ); - if ( empty( $qv['author'] ) || ( $qv['author'] == '0' ) ) { + if ( empty( $qv['author'] ) || ( '0' == $qv['author'] ) ) { $this->is_author = false; } else { $this->is_author = true; @@ -1017,25 +1017,25 @@ class WP_Query { unset( $this->queried_object ); } - if ( 'page' == get_option( 'show_on_front' ) && isset( $this->queried_object_id ) && $this->queried_object_id == get_option( 'page_for_posts' ) ) { + if ( 'page' === get_option( 'show_on_front' ) && isset( $this->queried_object_id ) && get_option( 'page_for_posts' ) == $this->queried_object_id ) { $this->is_page = false; $this->is_home = true; $this->is_posts_page = true; } - if ( isset( $this->queried_object_id ) && $this->queried_object_id == get_option( 'wp_page_for_privacy_policy' ) ) { + if ( isset( $this->queried_object_id ) && get_option( 'wp_page_for_privacy_policy' ) == $this->queried_object_id ) { $this->is_privacy_policy = true; } } if ( $qv['page_id'] ) { - if ( 'page' == get_option( 'show_on_front' ) && $qv['page_id'] == get_option( 'page_for_posts' ) ) { + if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == $qv['page_id'] ) { $this->is_page = false; $this->is_home = true; $this->is_posts_page = true; } - if ( $qv['page_id'] == get_option( 'wp_page_for_privacy_policy' ) ) { + if ( get_option( 'wp_page_for_privacy_policy' ) == $qv['page_id'] ) { $this->is_privacy_policy = true; } } @@ -1377,7 +1377,7 @@ class WP_Query { foreach ( $q['search_terms'] as $term ) { // If there is an $exclusion_prefix, terms prefixed with it should be excluded. - $exclude = $exclusion_prefix && ( $exclusion_prefix === substr( $term, 0, 1 ) ); + $exclude = $exclusion_prefix && ( substr( $term, 0, 1 ) === $exclusion_prefix ); if ( $exclude ) { $like_op = 'NOT LIKE'; $andor_op = 'AND'; @@ -1861,11 +1861,11 @@ class WP_Query { $q['showposts'] = (int) $q['showposts']; $q['posts_per_page'] = $q['showposts']; } - if ( ( isset( $q['posts_per_archive_page'] ) && $q['posts_per_archive_page'] != 0 ) && ( $this->is_archive || $this->is_search ) ) { + if ( ( isset( $q['posts_per_archive_page'] ) && 0 != $q['posts_per_archive_page'] ) && ( $this->is_archive || $this->is_search ) ) { $q['posts_per_page'] = $q['posts_per_archive_page']; } if ( ! isset( $q['nopaging'] ) ) { - if ( $q['posts_per_page'] == -1 ) { + if ( -1 == $q['posts_per_page'] ) { $q['nopaging'] = true; } else { $q['nopaging'] = false; @@ -1884,15 +1884,15 @@ class WP_Query { $q['posts_per_page'] = (int) $q['posts_per_page']; if ( $q['posts_per_page'] < -1 ) { $q['posts_per_page'] = abs( $q['posts_per_page'] ); - } elseif ( $q['posts_per_page'] == 0 ) { + } elseif ( 0 == $q['posts_per_page'] ) { $q['posts_per_page'] = 1; } - if ( ! isset( $q['comments_per_page'] ) || $q['comments_per_page'] == 0 ) { + if ( ! isset( $q['comments_per_page'] ) || 0 == $q['comments_per_page'] ) { $q['comments_per_page'] = get_option( 'comments_per_page' ); } - if ( $this->is_home && ( empty( $this->query ) || $q['preview'] == 'true' ) && ( 'page' == get_option( 'show_on_front' ) ) && get_option( 'page_on_front' ) ) { + if ( $this->is_home && ( empty( $this->query ) || 'true' === $q['preview'] ) && ( 'page' === get_option( 'show_on_front' ) ) && get_option( 'page_on_front' ) ) { $this->is_page = true; $this->is_home = false; $q['page_id'] = get_option( 'page_on_front' ); @@ -2096,7 +2096,7 @@ class WP_Query { } if ( $q['page_id'] ) { - if ( ( 'page' != get_option( 'show_on_front' ) ) || ( $q['page_id'] != get_option( 'page_for_posts' ) ) ) { + if ( ( 'page' !== get_option( 'show_on_front' ) ) || ( get_option( 'page_for_posts' ) != $q['page_id'] ) ) { $q['p'] = $q['page_id']; $where = " AND {$wpdb->posts}.ID = " . $q['page_id']; } @@ -2135,7 +2135,7 @@ class WP_Query { $post_type = array(); $taxonomies = array_keys( $this->tax_query->queried_terms ); foreach ( get_post_types( array( 'exclude_from_search' => false ) ) as $pt ) { - $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies( $pt ); + $object_taxonomies = 'attachment' === $pt ? get_taxonomies_for_attachments() : get_object_taxonomies( $pt ); if ( array_intersect( $taxonomies, $object_taxonomies ) ) { $post_type[] = $pt; } @@ -2214,7 +2214,7 @@ class WP_Query { // Author/user stuff. - if ( ! empty( $q['author'] ) && $q['author'] != '0' ) { + if ( ! empty( $q['author'] ) && '0' != $q['author'] ) { $q['author'] = addslashes_gpc( '' . urldecode( $q['author'] ) ); $authors = array_unique( array_map( 'intval', preg_split( '/[,\s]+/', $q['author'] ) ) ); foreach ( $authors as $author ) { @@ -3290,7 +3290,7 @@ class WP_Query { global $post; $this->in_the_loop = true; - if ( $this->current_post == -1 ) { // Loop has just started. + if ( -1 == $this->current_post ) { // Loop has just started. /** * Fires once the loop is started. * @@ -3380,7 +3380,7 @@ class WP_Query { $comment = $this->next_comment(); - if ( $this->current_comment == 0 ) { + if ( 0 == $this->current_comment ) { /** * Fires once the comment loop is started. * @@ -4300,7 +4300,7 @@ class WP_Query { * Force full post content when viewing the permalink for the $post, * or when on an RSS feed. Otherwise respect the 'more' tag. */ - if ( $post->ID === get_queried_object_id() && ( $this->is_page() || $this->is_single() ) ) { + if ( get_queried_object_id() === $post->ID && ( $this->is_page() || $this->is_single() ) ) { $more = 1; } elseif ( $this->is_feed() ) { $more = 1; diff --git a/wp-includes/class-wp-rewrite.php b/wp-includes/class-wp-rewrite.php index 45a9fae6a4..9ac02d7b54 100644 --- a/wp-includes/class-wp-rewrite.php +++ b/wp-includes/class-wp-rewrite.php @@ -920,7 +920,7 @@ class WP_Rewrite { // Get the structure, minus any cruft (stuff that isn't tags) at the front. $structure = $permalink_structure; - if ( $front != '/' ) { + if ( '/' !== $front ) { $structure = str_replace( $front, '', $structure ); } @@ -1909,7 +1909,7 @@ class WP_Rewrite { * @param string $category_base Category permalink structure base. */ public function set_category_base( $category_base ) { - if ( $category_base != get_option( 'category_base' ) ) { + if ( get_option( 'category_base' ) !== $category_base ) { update_option( 'category_base', $category_base ); $this->init(); } @@ -1927,7 +1927,7 @@ class WP_Rewrite { * @param string $tag_base Tag permalink structure base. */ public function set_tag_base( $tag_base ) { - if ( $tag_base != get_option( 'tag_base' ) ) { + if ( get_option( 'tag_base' ) !== $tag_base ) { update_option( 'tag_base', $tag_base ); $this->init(); } diff --git a/wp-includes/class-wp-roles.php b/wp-includes/class-wp-roles.php index 28c3895cc7..769a5b38f3 100644 --- a/wp-includes/class-wp-roles.php +++ b/wp-includes/class-wp-roles.php @@ -356,7 +356,7 @@ class WP_Roles { return $wp_user_roles; } - if ( is_multisite() && $this->site_id != get_current_blog_id() ) { + if ( is_multisite() && get_current_blog_id() != $this->site_id ) { remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 ); $roles = get_blog_option( $this->site_id, $this->role_key, array() ); diff --git a/wp-includes/class-wp-simplepie-sanitize-kses.php b/wp-includes/class-wp-simplepie-sanitize-kses.php index 2aba304259..4a4fed6739 100644 --- a/wp-includes/class-wp-simplepie-sanitize-kses.php +++ b/wp-includes/class-wp-simplepie-sanitize-kses.php @@ -46,7 +46,7 @@ class WP_SimplePie_Sanitize_KSES extends SimplePie_Sanitize { } if ( $type & ( SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML ) ) { $data = wp_kses_post( $data ); - if ( $this->output_encoding !== 'UTF-8' ) { + if ( 'UTF-8' !== $this->output_encoding ) { $data = $this->registry->call( 'Misc', 'change_encoding', array( $data, 'UTF-8', $this->output_encoding ) ); } return $data; diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php index 80419b9786..9a6c932322 100644 --- a/wp-includes/class-wp-theme.php +++ b/wp-includes/class-wp-theme.php @@ -1516,7 +1516,7 @@ final class WP_Theme implements ArrayAccess { return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id ); } - $current = $blog_id == get_current_blog_id(); + $current = get_current_blog_id() == $blog_id; if ( $current ) { $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' ); diff --git a/wp-includes/class-wp-user.php b/wp-includes/class-wp-user.php index b78a958579..a064c1f999 100644 --- a/wp-includes/class-wp-user.php +++ b/wp-includes/class-wp-user.php @@ -493,7 +493,7 @@ class WP_User { */ public function get_role_caps() { $switch_site = false; - if ( is_multisite() && $this->site_id != get_current_blog_id() ) { + if ( is_multisite() && get_current_blog_id() != $this->site_id ) { $switch_site = true; switch_to_blog( $this->site_id ); @@ -590,7 +590,7 @@ class WP_User { * @param string $role Role name. */ public function set_role( $role ) { - if ( 1 == count( $this->roles ) && $role == current( $this->roles ) ) { + if ( 1 == count( $this->roles ) && current( $this->roles ) == $role ) { return; } diff --git a/wp-includes/class-wp-walker.php b/wp-includes/class-wp-walker.php index 56bd0480c5..52deb2bbe2 100644 --- a/wp-includes/class-wp-walker.php +++ b/wp-includes/class-wp-walker.php @@ -144,7 +144,7 @@ class Walker { $this->start_el( $output, $element, $depth, ...array_values( $args ) ); // Descend only when the depth is right and there are childrens for this element. - if ( ( $max_depth == 0 || $max_depth > $depth + 1 ) && isset( $children_elements[ $id ] ) ) { + if ( ( 0 == $max_depth || $max_depth > $depth + 1 ) && isset( $children_elements[ $id ] ) ) { foreach ( $children_elements[ $id ] as $child ) { @@ -248,7 +248,7 @@ class Walker { * If we are displaying all levels, and remaining children_elements is not empty, * then we got orphans, which should be displayed regardless. */ - if ( ( $max_depth == 0 ) && count( $children_elements ) > 0 ) { + if ( ( 0 == $max_depth ) && count( $children_elements ) > 0 ) { $empty_array = array(); foreach ( $children_elements as $orphans ) { foreach ( $orphans as $op ) { diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index ac7189699d..1177923133 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -696,7 +696,7 @@ class wp_xmlrpc_server extends IXR_Server { foreach ( $blogs as $blog ) { // Don't include blogs that aren't hosted at this site. - if ( $blog->site_id != get_current_network_id() ) { + if ( get_current_network_id() != $blog->site_id ) { continue; } @@ -827,7 +827,7 @@ class wp_xmlrpc_server extends IXR_Server { * @return IXR_Date IXR_Date object. */ protected function _convert_date( $date ) { - if ( $date === '0000-00-00 00:00:00' ) { + if ( '0000-00-00 00:00:00' === $date ) { return new IXR_Date( '00000000T00:00:00Z' ); } return new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date, false ) ); @@ -841,7 +841,7 @@ class wp_xmlrpc_server extends IXR_Server { * @return IXR_Date IXR_Date object. */ protected function _convert_date_gmt( $date_gmt, $date ) { - if ( $date !== '0000-00-00 00:00:00' && $date_gmt === '0000-00-00 00:00:00' ) { + if ( '0000-00-00 00:00:00' !== $date && '0000-00-00 00:00:00' === $date_gmt ) { return new IXR_Date( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $date, false ), 'Ymd\TH:i:s' ) ); } return $this->_convert_date( $date_gmt ); @@ -879,7 +879,7 @@ class wp_xmlrpc_server extends IXR_Server { 'menu_order' => intval( $post['menu_order'] ), 'comment_status' => $post['comment_status'], 'ping_status' => $post['ping_status'], - 'sticky' => ( $post['post_type'] === 'post' && is_sticky( $post['ID'] ) ), + 'sticky' => ( 'post' === $post['post_type'] && is_sticky( $post['ID'] ) ), ); // Thumbnail. @@ -891,7 +891,7 @@ class wp_xmlrpc_server extends IXR_Server { } // Consider future posts as published. - if ( $post_fields['post_status'] === 'future' ) { + if ( 'future' === $post_fields['post_status'] ) { $post_fields['post_status'] = 'publish'; } @@ -1286,7 +1286,7 @@ class wp_xmlrpc_server extends IXR_Server { * since _insert_post() will ignore the non-GMT date if the GMT date is set. */ if ( isset( $content_struct['post_date_gmt'] ) && ! ( $content_struct['post_date_gmt'] instanceof IXR_Date ) ) { - if ( $content_struct['post_date_gmt'] == '0000-00-00 00:00:00' || isset( $content_struct['post_date'] ) ) { + if ( '0000-00-00 00:00:00' === $content_struct['post_date_gmt'] || isset( $content_struct['post_date'] ) ) { unset( $content_struct['post_date_gmt'] ); } else { $content_struct['post_date_gmt'] = $this->_convert_date( $content_struct['post_date_gmt'] ); @@ -1401,7 +1401,7 @@ class wp_xmlrpc_server extends IXR_Server { if ( ! current_user_can( 'edit_post', $post_data['ID'] ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } - if ( $post_data['post_type'] != get_post_type( $post_data['ID'] ) ) { + if ( get_post_type( $post_data['ID'] ) !== $post_data['post_type'] ) { return new IXR_Error( 401, __( 'The post type may not be changed.' ) ); } } else { @@ -1451,11 +1451,11 @@ class wp_xmlrpc_server extends IXR_Server { $post_data['post_author'] = $user->ID; } - if ( isset( $post_data['comment_status'] ) && $post_data['comment_status'] != 'open' && $post_data['comment_status'] != 'closed' ) { + if ( isset( $post_data['comment_status'] ) && 'open' !== $post_data['comment_status'] && 'closed' !== $post_data['comment_status'] ) { unset( $post_data['comment_status'] ); } - if ( isset( $post_data['ping_status'] ) && $post_data['ping_status'] != 'open' && $post_data['ping_status'] != 'closed' ) { + if ( isset( $post_data['ping_status'] ) && 'open' !== $post_data['ping_status'] && 'closed' !== $post_data['ping_status'] ) { unset( $post_data['ping_status'] ); } @@ -1483,7 +1483,7 @@ class wp_xmlrpc_server extends IXR_Server { } $post_ID = $post_data['ID']; - if ( $post_data['post_type'] == 'post' ) { + if ( 'post' === $post_data['post_type'] ) { $error = $this->_toggle_sticky( $post_data, $update ); if ( $error ) { return $error; @@ -1708,7 +1708,7 @@ class wp_xmlrpc_server extends IXR_Server { * Ignore the existing GMT date if it is empty or a non-GMT date was supplied in $content_struct, * since _insert_post() will ignore the non-GMT date if the GMT date is set. */ - if ( $post['post_date_gmt'] == '0000-00-00 00:00:00' || isset( $content_struct['post_date'] ) ) { + if ( '0000-00-00 00:00:00' === $post['post_date_gmt'] || isset( $content_struct['post_date'] ) ) { unset( $post['post_date_gmt'] ); } else { $post['post_date_gmt'] = $this->_convert_date( $post['post_date_gmt'] ); @@ -2929,7 +2929,7 @@ class wp_xmlrpc_server extends IXR_Server { do_action( 'xmlrpc_call', 'wp.getPage' ); // If we found the page then format the data. - if ( $page->ID && ( $page->post_type == 'page' ) ) { + if ( $page->ID && ( 'page' === $page->post_type ) ) { return $this->_prepare_page( $page ); } else { // If the page doesn't exist, indicate that. @@ -3066,7 +3066,7 @@ class wp_xmlrpc_server extends IXR_Server { // Get the current page based on the 'page_id' and // make sure it is a page and not a post. $actual_page = get_post( $page_id, ARRAY_A ); - if ( ! $actual_page || ( $actual_page['post_type'] != 'page' ) ) { + if ( ! $actual_page || ( 'page' !== $actual_page['post_type'] ) ) { return new IXR_Error( 404, __( 'Sorry, no such page.' ) ); } @@ -3132,7 +3132,7 @@ class wp_xmlrpc_server extends IXR_Server { // Get the page data and make sure it is a page. $actual_page = get_post( $page_id, ARRAY_A ); - if ( ! $actual_page || ( $actual_page['post_type'] != 'page' ) ) { + if ( ! $actual_page || ( 'page' !== $actual_page['post_type'] ) ) { return new IXR_Error( 404, __( 'Sorry, no such page.' ) ); } @@ -4238,7 +4238,7 @@ class wp_xmlrpc_server extends IXR_Server { continue; } - if ( $this->blog_options[ $o_name ]['readonly'] == true ) { + if ( true == $this->blog_options[ $o_name ]['readonly'] ) { continue; } @@ -5114,7 +5114,7 @@ class wp_xmlrpc_server extends IXR_Server { $actual_post = get_post( $post_ID, ARRAY_A ); - if ( ! $actual_post || $actual_post['post_type'] != 'post' ) { + if ( ! $actual_post || 'post' !== $actual_post['post_type'] ) { return new IXR_Error( 404, __( 'Sorry, no such post.' ) ); } @@ -5123,7 +5123,7 @@ class wp_xmlrpc_server extends IXR_Server { if ( ! current_user_can( 'edit_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } - if ( 'publish' == $actual_post['post_status'] && ! current_user_can( 'publish_posts' ) ) { + if ( 'publish' === $actual_post['post_status'] && ! current_user_can( 'publish_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this post.' ) ); } @@ -5188,7 +5188,7 @@ class wp_xmlrpc_server extends IXR_Server { $actual_post = get_post( $post_ID, ARRAY_A ); - if ( ! $actual_post || $actual_post['post_type'] != 'post' ) { + if ( ! $actual_post || 'post' !== $actual_post['post_type'] ) { return new IXR_Error( 404, __( 'Sorry, no such post.' ) ); } @@ -5276,10 +5276,10 @@ class wp_xmlrpc_server extends IXR_Server { $page_template = ''; if ( ! empty( $content_struct['post_type'] ) ) { - if ( $content_struct['post_type'] == 'page' ) { + if ( 'page' === $content_struct['post_type'] ) { if ( $publish ) { $cap = 'publish_pages'; - } elseif ( isset( $content_struct['page_status'] ) && 'publish' == $content_struct['page_status'] ) { + } elseif ( isset( $content_struct['page_status'] ) && 'publish' === $content_struct['page_status'] ) { $cap = 'publish_pages'; } else { $cap = 'edit_pages'; @@ -5289,10 +5289,10 @@ class wp_xmlrpc_server extends IXR_Server { if ( ! empty( $content_struct['wp_page_template'] ) ) { $page_template = $content_struct['wp_page_template']; } - } elseif ( $content_struct['post_type'] == 'post' ) { + } elseif ( 'post' === $content_struct['post_type'] ) { if ( $publish ) { $cap = 'publish_posts'; - } elseif ( isset( $content_struct['post_status'] ) && 'publish' == $content_struct['post_status'] ) { + } elseif ( isset( $content_struct['post_status'] ) && 'publish' === $content_struct['post_status'] ) { $cap = 'publish_posts'; } else { $cap = 'edit_posts'; @@ -5306,7 +5306,7 @@ class wp_xmlrpc_server extends IXR_Server { } else { if ( $publish ) { $cap = 'publish_posts'; - } elseif ( isset( $content_struct['post_status'] ) && 'publish' == $content_struct['post_status'] ) { + } elseif ( isset( $content_struct['post_status'] ) && 'publish' === $content_struct['post_status'] ) { $cap = 'publish_posts'; } else { $cap = 'edit_posts'; @@ -5513,7 +5513,7 @@ class wp_xmlrpc_server extends IXR_Server { $postdata['ID'] = $post_ID; // Only posts can be sticky. - if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) { + if ( 'post' === $post_type && isset( $content_struct['sticky'] ) ) { $data = $postdata; $data['sticky'] = $content_struct['sticky']; $error = $this->_toggle_sticky( $data ); @@ -5846,7 +5846,7 @@ class wp_xmlrpc_server extends IXR_Server { $tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : null; - if ( 'publish' == $post_status || 'private' == $post_status ) { + if ( 'publish' === $post_status || 'private' === $post_status ) { if ( 'page' == $post_type && ! current_user_can( 'publish_pages' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this page.' ) ); } elseif ( ! current_user_can( 'publish_posts' ) ) { @@ -5901,7 +5901,7 @@ class wp_xmlrpc_server extends IXR_Server { } // Only posts can be sticky. - if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) { + if ( 'post' === $post_type && isset( $content_struct['sticky'] ) ) { $data = $newpost; $data['sticky'] = $content_struct['sticky']; $data['post_type'] = 'post'; @@ -5991,7 +5991,7 @@ class wp_xmlrpc_server extends IXR_Server { /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ do_action( 'xmlrpc_call', 'metaWeblog.getPost' ); - if ( $postdata['post_date'] != '' ) { + if ( '' != $postdata['post_date'] ) { $post_date = $this->_convert_date( $postdata['post_date'] ); $post_date_gmt = $this->_convert_date_gmt( $postdata['post_date_gmt'], $postdata['post_date'] ); $post_modified = $this->_convert_date( $postdata['post_modified'] ); @@ -6024,7 +6024,7 @@ class wp_xmlrpc_server extends IXR_Server { $allow_pings = ( 'open' == $postdata['ping_status'] ) ? 1 : 0; // Consider future posts as published. - if ( $postdata['post_status'] === 'future' ) { + if ( 'future' === $postdata['post_status'] ) { $postdata['post_status'] = 'publish'; } @@ -6041,7 +6041,7 @@ class wp_xmlrpc_server extends IXR_Server { $enclosure = array(); foreach ( (array) get_post_custom( $post_ID ) as $key => $val ) { - if ( $key == 'enclosure' ) { + if ( 'enclosure' === $key ) { foreach ( (array) $val as $enc ) { $encdata = explode( "\n", $enc ); $enclosure['url'] = trim( htmlspecialchars( $encdata[0] ) ); @@ -6176,7 +6176,7 @@ class wp_xmlrpc_server extends IXR_Server { $allow_pings = ( 'open' == $entry['ping_status'] ) ? 1 : 0; // Consider future posts as published. - if ( $entry['post_status'] === 'future' ) { + if ( 'future' === $entry['post_status'] ) { $entry['post_status'] = 'publish'; } @@ -6213,7 +6213,7 @@ class wp_xmlrpc_server extends IXR_Server { 'wp_post_format' => $post_format, 'date_modified' => $post_modified, 'date_modified_gmt' => $post_modified_gmt, - 'sticky' => ( $entry['post_type'] === 'post' && is_sticky( $entry['ID'] ) ), + 'sticky' => ( 'post' === $entry['post_type'] && is_sticky( $entry['ID'] ) ), 'wp_post_thumbnail' => get_post_thumbnail_id( $entry['ID'] ), ); } @@ -6839,7 +6839,7 @@ class wp_xmlrpc_server extends IXR_Server { return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.' ) ); } - if ( $post_ID == url_to_postid( $pagelinkedfrom ) ) { + if ( url_to_postid( $pagelinkedfrom ) == $post_ID ) { return $this->pingback_error( 0, __( 'The source URL and the target URL cannot both point to the same resource.' ) ); } diff --git a/wp-includes/class.wp-scripts.php b/wp-includes/class.wp-scripts.php index ff4fc76805..cc88455bc1 100644 --- a/wp-includes/class.wp-scripts.php +++ b/wp-includes/class.wp-scripts.php @@ -475,7 +475,7 @@ class WP_Scripts extends WP_Dependencies { * @return bool True on success, false on failure. */ public function localize( $handle, $object_name, $l10n ) { - if ( $handle === 'jquery' ) { + if ( 'jquery' === $handle ) { $handle = 'jquery-core'; } @@ -521,7 +521,7 @@ class WP_Scripts extends WP_Dependencies { * @return bool Not already in the group or a lower group. */ public function set_group( $handle, $recursion, $group = false ) { - if ( isset( $this->registered[ $handle ]->args ) && $this->registered[ $handle ]->args === 1 ) { + if ( isset( $this->registered[ $handle ]->args ) && 1 === $this->registered[ $handle ]->args ) { $grp = 1; } else { $grp = (int) $this->get_data( $handle, 'group' ); diff --git a/wp-includes/class.wp-styles.php b/wp-includes/class.wp-styles.php index 98232e6f11..a84efb278f 100644 --- a/wp-includes/class.wp-styles.php +++ b/wp-includes/class.wp-styles.php @@ -268,7 +268,7 @@ class WP_Styles extends WP_Dependencies { /** This filter is documented in wp-includes/class.wp-styles.php */ $rtl_tag = apply_filters( 'style_loader_tag', $rtl_tag, $handle, $rtl_href, $media ); - if ( $obj->extra['rtl'] === 'replace' ) { + if ( 'replace' === $obj->extra['rtl'] ) { $tag = $rtl_tag; } else { $tag .= $rtl_tag; diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index bb148478ce..a22cce4d84 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -192,8 +192,8 @@ function get_comment_author_email_link( $linktext = '', $before = '', $after = ' */ $email = apply_filters( 'comment_email', $comment->comment_author_email, $comment ); - if ( ( ! empty( $email ) ) && ( $email != '@' ) ) { - $display = ( $linktext != '' ) ? $linktext : $email; + if ( ( ! empty( $email ) ) && ( '@' !== $email ) ) { + $display = ( '' != $linktext ) ? $linktext : $email; $return = $before; $return .= sprintf( '%2$s', esc_url( 'mailto:' . $email ), esc_html( $display ) ); $return .= $after; @@ -376,7 +376,7 @@ function comment_author_url( $comment_ID = 0 ) { */ function get_comment_author_url_link( $linktext = '', $before = '', $after = '', $comment = 0 ) { $url = get_comment_author_url( $comment ); - $display = ( $linktext != '' ) ? $linktext : $url; + $display = ( '' != $linktext ) ? $linktext : $url; $display = str_replace( 'http://www.', '', $display ); $display = str_replace( 'http://', '', $display ); @@ -925,7 +925,7 @@ function get_comments_number_text( $zero = false, $one = false, $more = false ) $output = str_replace( '%', number_format_i18n( $number ), $more ); } - } elseif ( $number == 0 ) { + } elseif ( 0 == $number ) { $output = ( false === $zero ) ? __( 'No Comments' ) : $zero; } else { // Must be one. $output = ( false === $one ) ? __( '1 Comment' ) : $one; @@ -2138,7 +2138,7 @@ function wp_list_comments( $args = array(), $comments = null ) { * When first page shows oldest comments, post permalink is the same as * the comment permalink. */ - } elseif ( $cpage == 1 ) { + } elseif ( 1 == $cpage ) { $parsed_args['cpage'] = ''; } else { $parsed_args['cpage'] = $cpage; diff --git a/wp-includes/comment.php b/wp-includes/comment.php index a493802fe6..8e9dc80952 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -127,7 +127,7 @@ function check_comment( $author, $email, $url, $comment, $user_ip, $user_agent, * email address. If both checks pass, return true. Otherwise, return false. */ if ( 1 == get_option( 'comment_whitelist' ) ) { - if ( 'trackback' != $comment_type && 'pingback' != $comment_type && $author != '' && $email != '' ) { + if ( 'trackback' !== $comment_type && 'pingback' !== $comment_type && '' != $author && '' != $email ) { $comment_user = get_user_by( 'email', wp_unslash( $email ) ); if ( ! empty( $comment_user->ID ) ) { $ok_to_comment = $wpdb->get_var( $wpdb->prepare( "SELECT comment_approved FROM $wpdb->comments WHERE user_id = %d AND comment_approved = '1' LIMIT 1", $comment_user->ID ) ); @@ -217,11 +217,11 @@ function get_comment( &$comment = null, $output = OBJECT ) { */ $_comment = apply_filters( 'get_comment', $_comment ); - if ( $output == OBJECT ) { + if ( OBJECT == $output ) { return $_comment; - } elseif ( $output == ARRAY_A ) { + } elseif ( ARRAY_A == $output ) { return $_comment->to_array(); - } elseif ( $output == ARRAY_N ) { + } elseif ( ARRAY_N == $output ) { return array_values( $_comment->to_array() ); } return $_comment; @@ -1429,7 +1429,7 @@ function wp_delete_comment( $comment_id, $force_delete = false ) { do_action( 'deleted_comment', $comment->comment_ID, $comment ); $post_id = $comment->comment_post_ID; - if ( $post_id && $comment->comment_approved == 1 ) { + if ( $post_id && 1 == $comment->comment_approved ) { wp_update_comment_count( $post_id ); } @@ -1655,15 +1655,15 @@ function wp_get_comment_status( $comment_id ) { $approved = $comment->comment_approved; - if ( $approved == null ) { + if ( null == $approved ) { return false; - } elseif ( $approved == '1' ) { + } elseif ( '1' == $approved ) { return 'approved'; - } elseif ( $approved == '0' ) { + } elseif ( '0' == $approved ) { return 'unapproved'; - } elseif ( $approved == 'spam' ) { + } elseif ( 'spam' == $approved ) { return 'spam'; - } elseif ( $approved == 'trash' ) { + } elseif ( 'trash' == $approved ) { return 'trash'; } else { return false; @@ -1913,7 +1913,7 @@ function wp_insert_comment( $commentdata ) { $id = (int) $wpdb->insert_id; - if ( $comment_approved == 1 ) { + if ( 1 == $comment_approved ) { wp_update_comment_count( $comment_post_ID ); foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) { @@ -2632,7 +2632,7 @@ function discover_pingback_server_uri( $url, $deprecated = '' ) { $pingback_link_offset_squote = strpos( $contents, $pingback_str_squote ); if ( $pingback_link_offset_dquote || $pingback_link_offset_squote ) { $quote = ( $pingback_link_offset_dquote ) ? '"' : '\''; - $pingback_link_offset = ( $quote == '"' ) ? $pingback_link_offset_dquote : $pingback_link_offset_squote; + $pingback_link_offset = ( '"' === $quote ) ? $pingback_link_offset_dquote : $pingback_link_offset_squote; $pingback_href_pos = strpos( $contents, 'href=', $pingback_link_offset ); $pingback_href_start = $pingback_href_pos + 6; $pingback_href_end = strpos( $contents, $quote, $pingback_href_start ); @@ -2843,7 +2843,7 @@ function pingback( $content, $post_id ) { if ( $test ) { if ( isset( $test['query'] ) ) { $post_links[] = $link_test; - } elseif ( isset( $test['path'] ) && ( $test['path'] != '/' ) && ( $test['path'] != '' ) ) { + } elseif ( isset( $test['path'] ) && ( '/' !== $test['path'] ) && ( '' !== $test['path'] ) ) { $post_links[] = $link_test; } } @@ -3005,7 +3005,7 @@ function pingback_ping_source_uri( $source_uri ) { * @return IXR_Error */ function xmlrpc_pingback_error( $ixr_error ) { - if ( $ixr_error->code === 48 ) { + if ( 48 === $ixr_error->code ) { return $ixr_error; } return new IXR_Error( 0, '' ); diff --git a/wp-includes/compat.php b/wp-includes/compat.php index c0675403b4..2e258a88ea 100644 --- a/wp-includes/compat.php +++ b/wp-includes/compat.php @@ -312,7 +312,7 @@ if ( ! function_exists( 'hash_equals' ) ) : */ function hash_equals( $a, $b ) { $a_length = strlen( $a ); - if ( $a_length !== strlen( $b ) ) { + if ( strlen( $b ) !== $a_length ) { return false; } $result = 0; @@ -322,7 +322,7 @@ if ( ! function_exists( 'hash_equals' ) ) : $result |= ord( $a[ $i ] ) ^ ord( $b[ $i ] ); } - return $result === 0; + return 0 === $result; } endif; diff --git a/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php b/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php index 5a23086496..76908bf786 100644 --- a/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php +++ b/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php @@ -211,7 +211,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting { * @return array|false Instance data array, or false if the item is marked for deletion. */ public function value() { - if ( $this->is_previewed && $this->_previewed_blog_id === get_current_blog_id() ) { + if ( $this->is_previewed && get_current_blog_id() === $this->_previewed_blog_id ) { $undefined = new stdClass(); // Symbol. $post_value = $this->post_value( $undefined ); @@ -798,7 +798,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting { return; } - if ( $nav_menu_setting->previous_term_id !== intval( $value['nav_menu_term_id'] ) ) { + if ( intval( $value['nav_menu_term_id'] ) !== $nav_menu_setting->previous_term_id ) { $this->update_status = 'error'; $this->update_error = new WP_Error( 'unexpected_previous_term_id' ); return; @@ -824,7 +824,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting { return; } - if ( $parent_nav_menu_item_setting->previous_post_id !== intval( $value['menu_item_parent'] ) ) { + if ( intval( $value['menu_item_parent'] ) !== $parent_nav_menu_item_setting->previous_post_id ) { $this->update_status = 'error'; $this->update_error = new WP_Error( 'unexpected_previous_post_id' ); return; diff --git a/wp-includes/customize/class-wp-customize-nav-menu-setting.php b/wp-includes/customize/class-wp-customize-nav-menu-setting.php index d033602b93..8c4f98d0aa 100644 --- a/wp-includes/customize/class-wp-customize-nav-menu-setting.php +++ b/wp-includes/customize/class-wp-customize-nav-menu-setting.php @@ -156,7 +156,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting { * @return array Instance data. */ public function value() { - if ( $this->is_previewed && $this->_previewed_blog_id === get_current_blog_id() ) { + if ( $this->is_previewed && get_current_blog_id() === $this->_previewed_blog_id ) { $undefined = new stdClass(); // Symbol. $post_value = $this->post_value( $undefined ); @@ -384,7 +384,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting { * @return array (Maybe) modified nav menu options. */ public function filter_nav_menu_options( $nav_menu_options ) { - if ( $this->_previewed_blog_id !== get_current_blog_id() ) { + if ( get_current_blog_id() !== $this->_previewed_blog_id ) { return $nav_menu_options; } @@ -555,7 +555,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting { } $post_value = $setting->post_value( null ); - if ( ! is_null( $post_value ) && $this->previous_term_id === intval( $post_value ) ) { + if ( ! is_null( $post_value ) && intval( $post_value ) === $this->previous_term_id ) { $this->manager->set_post_value( $setting->id, $this->term_id ); $setting->save(); } diff --git a/wp-includes/embed.php b/wp-includes/embed.php index 34b6d29914..71a2eb5e88 100644 --- a/wp-includes/embed.php +++ b/wp-includes/embed.php @@ -614,7 +614,7 @@ function get_oembed_response_data_for_url( $url, $args ) { $sites = get_sites( $qv ); $site = reset( $sites ); - if ( $site && (int) $site->blog_id !== get_current_blog_id() ) { + if ( $site && get_current_blog_id() !== (int) $site->blog_id ) { switch_to_blog( $site->blog_id ); $switched_blog = true; } diff --git a/wp-includes/feed-atom-comments.php b/wp-includes/feed-atom-comments.php index 20f3ee8f6d..b43f8d4eb1 100644 --- a/wp-includes/feed-atom-comments.php +++ b/wp-includes/feed-atom-comments.php @@ -110,7 +110,7 @@ while ( have_comments() ) : comment_parent == 0 ) : // This comment is top-level. + if ( 0 == $comment->comment_parent ) : // This comment is top-level. ?> $val ) { - if ( $key == 'enclosure' ) { + if ( 'enclosure' === $key ) { foreach ( (array) $val as $enc ) { $enclosure = explode( "\n", $enc ); @@ -511,7 +511,7 @@ function atom_enclosure() { } foreach ( (array) get_post_custom() as $key => $val ) { - if ( $key == 'enclosure' ) { + if ( 'enclosure' === $key ) { foreach ( (array) $val as $enc ) { $enclosure = explode( "\n", $enc ); /** diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 890bfdd607..1545cac45b 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -479,7 +479,7 @@ function wpautop( $pee, $br = true ) { $start = strpos( $pee_part, ' '&', ); - if ( $quote_style === ENT_QUOTES ) { + if ( ENT_QUOTES === $quote_style ) { $translation = array_merge( $single, $double, $others ); $translation_preg = array_merge( $single_preg, $double_preg, $others_preg ); - } elseif ( $quote_style === ENT_COMPAT || $quote_style === 'double' ) { + } elseif ( ENT_COMPAT === $quote_style || 'double' === $quote_style ) { $translation = array_merge( $double, $others ); $translation_preg = array_merge( $double_preg, $others_preg ); - } elseif ( $quote_style === 'single' ) { + } elseif ( 'single' === $quote_style ) { $translation = array_merge( $single, $others ); $translation_preg = array_merge( $single_preg, $others_preg ); - } elseif ( $quote_style === ENT_NOQUOTES ) { + } elseif ( ENT_NOQUOTES === $quote_style ) { $translation = $others; $translation_preg = $others_preg; } @@ -2793,11 +2793,11 @@ function antispambot( $email_address, $hex_encoding = 0 ) { $email_no_spam_address = ''; for ( $i = 0, $len = strlen( $email_address ); $i < $len; $i++ ) { $j = rand( 0, 1 + $hex_encoding ); - if ( $j == 0 ) { + if ( 0 == $j ) { $email_no_spam_address .= '&#' . ord( $email_address[ $i ] ) . ';'; - } elseif ( $j == 1 ) { + } elseif ( 1 == $j ) { $email_no_spam_address .= $email_address[ $i ]; - } elseif ( $j == 2 ) { + } elseif ( 2 == $j ) { $email_no_spam_address .= '%' . zeroise( dechex( ord( $email_address[ $i ] ) ), 2 ); } } @@ -2938,7 +2938,7 @@ function make_clickable( $text ) { $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; } @@ -3552,7 +3552,7 @@ function get_date_from_gmt( $string, $format = 'Y-m-d H:i:s' ) { */ function iso8601_timezone_to_offset( $timezone ) { // $timezone is either 'Z' or '[+|-]hhmm'. - if ( $timezone == 'Z' ) { + if ( 'Z' === $timezone ) { $offset = 0; } else { $sign = ( substr( $timezone, 0, 1 ) == '+' ) ? 1 : -1; @@ -4626,7 +4626,7 @@ function sanitize_option( $option, $value ) { case 'default_ping_status': case 'default_comment_status': // Options that if not there have 0 value but need to be something like "closed". - if ( $value == '0' || $value == '' ) { + if ( '0' == $value || '' == $value ) { $value = 'closed'; } break; @@ -4972,7 +4972,7 @@ function wp_sprintf( $pattern, ...$args ) { $fragment = substr( $pattern, $start, $end - $start ); // Fragment has a specifier. - if ( $pattern[ $start ] == '%' ) { + if ( '%' === $pattern[ $start ] ) { // Find numbered arguments or take the next one in order. if ( preg_match( '/^%(\d+)\$/', $fragment, $matches ) ) { $index = $matches[1] - 1; // 0-based array vs 1-based sprintf() arguments. diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 1a53c12eda..10e8ad49fe 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -686,7 +686,7 @@ function is_serialized_string( $data ) { return false; } elseif ( ';' !== substr( $data, -1 ) ) { return false; - } elseif ( $data[0] !== 's' ) { + } elseif ( 's' !== $data[0] ) { return false; } elseif ( '"' !== substr( $data, -2, 1 ) ) { return false; @@ -1013,15 +1013,15 @@ function _http_build_query( $data, $prefix = null, $sep = null, $key = '', $urle if ( $urlencode ) { $k = urlencode( $k ); } - if ( is_int( $k ) && $prefix != null ) { + if ( is_int( $k ) && null != $prefix ) { $k = $prefix . $k; } if ( ! empty( $key ) ) { $k = $key . '%5B' . $k . '%5D'; } - if ( $v === null ) { + if ( null === $v ) { continue; - } elseif ( $v === false ) { + } elseif ( false === $v ) { $v = '0'; } @@ -1132,7 +1132,7 @@ function add_query_arg( ...$args ) { } foreach ( $qs as $k => $v ) { - if ( $v === false ) { + if ( false === $v ) { unset( $qs[ $k ] ); } } @@ -1539,7 +1539,7 @@ function do_feed() { // Remove the pad, if present. $feed = preg_replace( '/^_+/', '', $feed ); - if ( $feed == '' || $feed == 'feed' ) { + if ( '' == $feed || 'feed' === $feed ) { $feed = get_default_feed(); } @@ -1885,7 +1885,7 @@ function wp_get_referer() { $ref = wp_get_raw_referer(); - if ( $ref && $ref !== wp_unslash( $_SERVER['REQUEST_URI'] ) && $ref !== home_url() . wp_unslash( $_SERVER['REQUEST_URI'] ) ) { + if ( $ref && wp_unslash( $_SERVER['REQUEST_URI'] ) !== $ref && home_url() . wp_unslash( $_SERVER['REQUEST_URI'] ) !== $ref ) { return wp_validate_redirect( $ref, false ); } @@ -1947,7 +1947,7 @@ function wp_mkdir_p( $target ) { $target = str_replace( '//', '/', $target ); // Put the wrapper back on the target. - if ( $wrapper !== null ) { + if ( null !== $wrapper ) { $target = $wrapper . '://' . $target; } @@ -1989,7 +1989,7 @@ function wp_mkdir_p( $target ) { * If a umask is set that modifies $dir_perms, we'll have to re-set * the $dir_perms correctly with chmod() */ - if ( $dir_perms != ( $dir_perms & ~umask() ) ) { + if ( ( $dir_perms & ~umask() ) != $dir_perms ) { $folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) ); for ( $i = 1, $c = count( $folder_parts ); $i <= $c; $i++ ) { chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms ); @@ -2029,7 +2029,7 @@ function path_is_absolute( $path ) { return true; } - if ( strlen( $path ) == 0 || $path[0] == '.' ) { + if ( strlen( $path ) == 0 || '.' === $path[0] ) { return false; } @@ -2039,7 +2039,7 @@ function path_is_absolute( $path ) { } // A path starting with / or \ is absolute; anything else is relative. - return ( $path[0] == '/' || $path[0] == '\\' ); + return ( '/' === $path[0] || '\\' === $path[0] ); } /** @@ -2185,7 +2185,7 @@ function wp_is_writable( $path ) { * @return bool Whether the path is writable. */ function win_is_writable( $path ) { - if ( $path[ strlen( $path ) - 1 ] == '/' ) { + if ( '/' === $path[ strlen( $path ) - 1 ] ) { // If it looks like a directory, check a random file within the directory. return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp' ); } elseif ( is_dir( $path ) ) { @@ -2197,7 +2197,7 @@ function win_is_writable( $path ) { $should_delete_tmp_file = ! file_exists( $path ); $f = @fopen( $path, 'a' ); - if ( $f === false ) { + if ( false === $f ) { return false; } fclose( $f ); @@ -2633,7 +2633,7 @@ function wp_upload_bits( $name, $deprecated, $bits, $time = null ) { $upload = wp_upload_dir( $time ); - if ( $upload['error'] !== false ) { + if ( false !== $upload['error'] ) { return $upload; } @@ -4321,7 +4321,7 @@ function smilies_init() { // New subpattern? if ( $firstchar != $subchar ) { - if ( $subchar != '' ) { + if ( '' != $subchar ) { $wp_smiliessearch .= ')(?=' . $spaces . '|$)'; // End previous "subpattern". $wp_smiliessearch .= '|(?<=' . $spaces . '|^)'; // Begin another "subpattern". } @@ -5461,7 +5461,7 @@ function is_main_site( $site_id = null, $network_id = null ) { $site_id = (int) $site_id; - return $site_id === get_main_site_id( $network_id ); + return get_main_site_id( $network_id ) === $site_id; } /** @@ -5505,7 +5505,7 @@ function is_main_network( $network_id = null ) { $network_id = (int) $network_id; - return ( $network_id === get_main_network_id() ); + return ( get_main_network_id() === $network_id ); } /** @@ -7513,7 +7513,7 @@ function recurse_dirsize( $directory, $exclude = null, $max_execution_time = nul return false; } - if ( $max_execution_time === null ) { + if ( null === $max_execution_time ) { // Keep the previous behavior but attempt to prevent fatal errors from timeout if possible. if ( function_exists( 'ini_get' ) ) { $max_execution_time = ini_get( 'max_execution_time' ); @@ -7532,7 +7532,7 @@ function recurse_dirsize( $directory, $exclude = null, $max_execution_time = nul if ( $handle ) { while ( ( $file = readdir( $handle ) ) !== false ) { $path = $directory . '/' . $file; - if ( $file != '.' && $file != '..' ) { + if ( '.' !== $file && '..' !== $file ) { if ( is_file( $path ) ) { $size += filesize( $path ); } elseif ( is_dir( $path ) ) { diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 4f48de5322..54c7483089 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -856,7 +856,7 @@ function get_bloginfo( $show = '', $filter = 'raw' ) { function get_site_icon_url( $size = 512, $url = '', $blog_id = 0 ) { $switched_blog = false; - if ( is_multisite() && ! empty( $blog_id ) && (int) $blog_id !== get_current_blog_id() ) { + if ( is_multisite() && ! empty( $blog_id ) && get_current_blog_id() !== (int) $blog_id ) { switch_to_blog( $blog_id ); $switched_blog = true; } @@ -924,7 +924,7 @@ function has_site_icon( $blog_id = 0 ) { function has_custom_logo( $blog_id = 0 ) { $switched_blog = false; - if ( is_multisite() && ! empty( $blog_id ) && (int) $blog_id !== get_current_blog_id() ) { + if ( is_multisite() && ! empty( $blog_id ) && get_current_blog_id() !== (int) $blog_id ) { switch_to_blog( $blog_id ); $switched_blog = true; } @@ -950,7 +950,7 @@ function get_custom_logo( $blog_id = 0 ) { $html = ''; $switched_blog = false; - if ( is_multisite() && ! empty( $blog_id ) && (int) $blog_id !== get_current_blog_id() ) { + if ( is_multisite() && ! empty( $blog_id ) && get_current_blog_id() !== (int) $blog_id ) { switch_to_blog( $blog_id ); $switched_blog = true; } @@ -1846,7 +1846,7 @@ function wp_get_archives( $args = '' ) { } $order = strtoupper( $parsed_args['order'] ); - if ( $order !== 'ASC' ) { + if ( 'ASC' !== $order ) { $order = 'DESC'; } @@ -2006,7 +2006,7 @@ function wp_get_archives( $args = '' ) { } if ( $results ) { foreach ( (array) $results as $result ) { - if ( $result->post_date != '0000-00-00 00:00:00' ) { + if ( '0000-00-00 00:00:00' !== $result->post_date ) { $url = get_permalink( $result ); if ( $result->post_title ) { /** This filter is documented in wp-includes/post-template.php */ @@ -2014,7 +2014,7 @@ function wp_get_archives( $args = '' ) { } else { $text = $result->ID; } - $selected = $result->ID === get_the_ID(); + $selected = get_the_ID() === $result->ID; $output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected ); } } @@ -2227,9 +2227,9 @@ function get_calendar( $initial = true, $echo = true ) { } $newrow = false; - if ( $day == current_time( 'j' ) && - $thismonth == current_time( 'm' ) && - $thisyear == current_time( 'Y' ) ) { + if ( current_time( 'j' ) == $day && + current_time( 'm' ) == $thismonth && + current_time( 'Y' ) == $thisyear ) { $calendar_output .= ''; } else { $calendar_output .= ''; @@ -2257,7 +2257,7 @@ function get_calendar( $initial = true, $echo = true ) { } $pad = 7 - calendar_week_mod( gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ); - if ( $pad != 0 && $pad != 7 ) { + if ( 0 != $pad && 7 != $pad ) { $calendar_output .= "\n\t\t" . ' '; } $calendar_output .= "\n\t\n\t\n\t"; @@ -3960,11 +3960,11 @@ function get_language_attributes( $doctype = 'html' ) { $lang = get_bloginfo( 'language' ); if ( $lang ) { - if ( get_option( 'html_type' ) == 'text/html' || $doctype == 'html' ) { + if ( 'text/html' === get_option( 'html_type' ) || 'html' === $doctype ) { $attributes[] = 'lang="' . esc_attr( $lang ) . '"'; } - if ( get_option( 'html_type' ) != 'text/html' || $doctype == 'xhtml' ) { + if ( 'text/html' !== get_option( 'html_type' ) || 'xhtml' === $doctype ) { $attributes[] = 'xml:lang="' . esc_attr( $lang ) . '"'; } } diff --git a/wp-includes/http.php b/wp-includes/http.php index 0a91418e45..d2213d9e1e 100644 --- a/wp-includes/http.php +++ b/wp-includes/http.php @@ -632,7 +632,7 @@ function ms_allowed_http_request_hosts( $is_external, $host ) { if ( $is_external ) { return $is_external; } - if ( $host === get_network()->domain ) { + if ( get_network()->domain === $host ) { return true; } if ( isset( $queried[ $host ] ) ) { diff --git a/wp-includes/kses.php b/wp-includes/kses.php index 32a5a04f2a..d84fb6f837 100644 --- a/wp-includes/kses.php +++ b/wp-includes/kses.php @@ -1046,10 +1046,10 @@ function wp_kses_split2( $string, $allowed_html, $allowed_protocols ) { // Allow HTML comments. if ( '' ), '', $string ); - while ( $string != ( $newstring = wp_kses( $string, $allowed_html, $allowed_protocols ) ) ) { + while ( ( $newstring = wp_kses( $string, $allowed_html, $allowed_protocols ) ) != $string ) { $string = $newstring; } - if ( $string == '' ) { + if ( '' == $string ) { return ''; } // Prevent multiple dashes in comments. @@ -1078,7 +1078,7 @@ function wp_kses_split2( $string, $allowed_html, $allowed_protocols ) { } // No attributes are allowed for closing elements. - if ( $slash != '' ) { + if ( '' != $slash ) { return ""; } @@ -1348,13 +1348,13 @@ function wp_kses_hair( $attr, $allowed_protocols ) { break; } // End switch. - if ( $working == 0 ) { // Not well-formed, remove and try again. + if ( 0 == $working ) { // Not well-formed, remove and try again. $attr = wp_kses_html_error( $attr ); $mode = 0; } } // End while. - if ( $mode == 1 && false === array_key_exists( $attrname, $attrarr ) ) { + if ( 1 == $mode && false === array_key_exists( $attrname, $attrarr ) ) { // Special case, for when the attribute list ends with a valueless // attribute like "selected". $attrarr[ $attrname ] = array( @@ -1845,10 +1845,10 @@ function wp_kses_normalize_entities3( $matches ) { * @return bool Whether or not the codepoint is a valid Unicode codepoint. */ function valid_unicode( $i ) { - return ( $i == 0x9 || $i == 0xa || $i == 0xd || - ( $i >= 0x20 && $i <= 0xd7ff ) || - ( $i >= 0xe000 && $i <= 0xfffd ) || - ( $i >= 0x10000 && $i <= 0x10ffff ) ); + return ( 0x9 == $i || 0xa == $i || 0xd == $i || + ( 0x20 <= $i && $i <= 0xd7ff ) || + ( 0xe000 <= $i && $i <= 0xfffd ) || + ( 0x10000 <= $i && $i <= 0x10ffff ) ); } /** @@ -2244,7 +2244,7 @@ function safecss_filter_attr( $css, $deprecated = '' ) { $css = ''; foreach ( $css_array as $css_item ) { - if ( $css_item == '' ) { + if ( '' == $css_item ) { continue; } @@ -2282,7 +2282,7 @@ function safecss_filter_attr( $css, $deprecated = '' ) { $url = trim( $url_pieces[2] ); - if ( empty( $url ) || $url !== wp_kses_bad_protocol( $url, $allowed_protocols ) ) { + if ( empty( $url ) || wp_kses_bad_protocol( $url, $allowed_protocols ) !== $url ) { $found = false; break; } else { @@ -2302,7 +2302,7 @@ function safecss_filter_attr( $css, $deprecated = '' ) { // Remove any CSS containing containing \ ( & } = or comments, except for url() useage checked above. if ( $found && ! preg_match( '%[\\\(&=}]|/\*%', $css_test_string ) ) { - if ( $css != '' ) { + if ( '' != $css ) { $css .= ';'; } diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index ef7c4b34e6..922eb027c8 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -62,12 +62,12 @@ function get_locale() { } } - if ( $ms_locale !== false ) { + if ( false !== $ms_locale ) { $locale = $ms_locale; } } else { $db_locale = get_option( 'WPLANG' ); - if ( $db_locale !== false ) { + if ( false !== $db_locale ) { $locale = $db_locale; } } @@ -940,7 +940,7 @@ function load_script_textdomain( $handle, $domain = 'default', $path = null ) { $locale = determine_locale(); // If a path was given and the handle file exists simply return it. - $file_base = $domain === 'default' ? $locale : $domain . '-' . $locale; + $file_base = 'default' === $domain ? $locale : $domain . '-' . $locale; $handle_filename = $file_base . '-' . $handle . '.json'; if ( $path ) { @@ -1335,7 +1335,7 @@ function get_available_languages( $dir = null ) { * @return array Array of language data. */ function wp_get_installed_translations( $type ) { - if ( $type !== 'themes' && $type !== 'plugins' && $type !== 'core' ) { + if ( 'themes' !== $type && 'plugins' !== $type && 'core' !== $type ) { return array(); } diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 27dfd9ca5e..7e4b29dea1 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -142,9 +142,9 @@ function get_permalink( $post = 0, $leavename = false ) { return false; } - if ( $post->post_type == 'page' ) { + if ( 'page' === $post->post_type ) { return get_page_link( $post, $leavename, $sample ); - } elseif ( $post->post_type == 'attachment' ) { + } elseif ( 'attachment' === $post->post_type ) { return get_attachment_link( $post, $leavename ); } elseif ( in_array( $post->post_type, get_post_types( array( '_builtin' => false ) ) ) ) { return get_post_permalink( $post, $leavename, $sample ); @@ -332,7 +332,7 @@ function get_post_permalink( $id = 0, $leavename = false, $sample = false ) { function get_page_link( $post = false, $leavename = false, $sample = false ) { $post = get_post( $post ); - if ( 'page' == get_option( 'show_on_front' ) && $post->ID == get_option( 'page_on_front' ) ) { + if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID ) { $link = home_url( '/' ); } else { $link = _get_page_link( $post, $leavename, $sample ); @@ -422,7 +422,7 @@ function get_attachment_link( $post = null, $leavename = false ) { } if ( $wp_rewrite->using_permalinks() && $parent ) { - if ( 'page' == $parent->post_type ) { + if ( 'page' === $parent->post_type ) { $parentlink = _get_page_link( $post->post_parent ); // Ignores page_on_front. } else { $parentlink = get_permalink( $post->post_parent ); @@ -682,7 +682,7 @@ function get_post_comments_feed_link( $post_id = 0, $feed = '' ) { $unattached = 'attachment' === $post->post_type && 0 === (int) $post->post_parent; if ( '' != get_option( 'permalink_structure' ) ) { - if ( 'page' == get_option( 'show_on_front' ) && $post_id == get_option( 'page_on_front' ) ) { + if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post_id ) { $url = _get_page_link( $post_id ); } else { $url = get_permalink( $post_id ); @@ -690,13 +690,13 @@ function get_post_comments_feed_link( $post_id = 0, $feed = '' ) { if ( $unattached ) { $url = home_url( '/feed/' ); - if ( $feed !== get_default_feed() ) { + if ( get_default_feed() !== $feed ) { $url .= "$feed/"; } $url = add_query_arg( 'attachment_id', $post_id, $url ); } else { $url = trailingslashit( $url ) . 'feed'; - if ( $feed != get_default_feed() ) { + if ( get_default_feed() != $feed ) { $url .= "/$feed"; } $url = user_trailingslashit( $url, 'single_feed' ); @@ -710,7 +710,7 @@ function get_post_comments_feed_link( $post_id = 0, $feed = '' ) { ), home_url( '/' ) ); - } elseif ( 'page' == $post->post_type ) { + } elseif ( 'page' === $post->post_type ) { $url = add_query_arg( array( 'feed' => $feed, @@ -798,7 +798,7 @@ function get_author_feed_link( $author_id, $feed = '' ) { $link = home_url( "?feed=$feed&author=" . $author_id ); } else { $link = get_author_posts_url( $author_id ); - if ( $feed == get_default_feed() ) { + if ( get_default_feed() == $feed ) { $feed_link = 'feed'; } else { $feed_link = "feed/$feed"; @@ -877,7 +877,7 @@ function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) { } } else { $link = get_term_link( $term_id, $term->taxonomy ); - if ( $feed == get_default_feed() ) { + if ( get_default_feed() == $feed ) { $feed_link = 'feed'; } else { $feed_link = "feed/$feed"; @@ -1222,7 +1222,7 @@ function get_post_type_archive_link( $post_type ) { $show_on_front = get_option( 'show_on_front' ); $page_for_posts = get_option( 'page_for_posts' ); - if ( 'page' == $show_on_front && $page_for_posts ) { + if ( 'page' === $show_on_front && $page_for_posts ) { $link = get_permalink( $page_for_posts ); } else { $link = get_home_url(); @@ -3634,9 +3634,9 @@ function set_url_scheme( $url, $scheme = null ) { if ( ! $scheme ) { $scheme = is_ssl() ? 'https' : 'http'; - } elseif ( $scheme === 'admin' || $scheme === 'login' || $scheme === 'login_post' || $scheme === 'rpc' ) { + } elseif ( 'admin' === $scheme || 'login' === $scheme || 'login_post' === $scheme || 'rpc' === $scheme ) { $scheme = is_ssl() || force_ssl_admin() ? 'https' : 'http'; - } elseif ( $scheme !== 'http' && $scheme !== 'https' && $scheme !== 'relative' ) { + } elseif ( 'http' !== $scheme && 'https' !== $scheme && 'relative' !== $scheme ) { $scheme = is_ssl() ? 'https' : 'http'; } @@ -3647,7 +3647,7 @@ function set_url_scheme( $url, $scheme = null ) { if ( 'relative' == $scheme ) { $url = ltrim( preg_replace( '#^\w+://[^/]*#', '', $url ) ); - if ( $url !== '' && $url[0] === '/' ) { + if ( '' !== $url && '/' === $url[0] ) { $url = '/' . ltrim( $url, "/ \t\n\r\0\x0B" ); } } else { @@ -3779,7 +3779,7 @@ function wp_get_canonical_url( $post = null ) { $canonical_url = get_permalink( $post ); // If a canonical is being generated for the current page, make sure it has pagination if needed. - if ( $post->ID === get_queried_object_id() ) { + if ( get_queried_object_id() === $post->ID ) { $page = get_query_var( 'page', 0 ); if ( $page >= 2 ) { if ( '' == get_option( 'permalink_structure' ) ) { @@ -3887,7 +3887,7 @@ function wp_get_shortlink( $id = 0, $context = 'post', $allow_slugs = true ) { if ( ! empty( $post_id ) ) { $post_type = get_post_type_object( $post->post_type ); - if ( 'page' === $post->post_type && $post->ID == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) ) { + if ( 'page' === $post->post_type && get_option( 'page_on_front' ) == $post->ID && 'page' === get_option( 'show_on_front' ) ) { $shortlink = home_url( '/' ); } elseif ( $post_type->public ) { $shortlink = home_url( '?p=' . $post_id ); diff --git a/wp-includes/media.php b/wp-includes/media.php index 1996bbdccd..54179b9013 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -70,7 +70,7 @@ function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co if ( is_array( $size ) ) { $max_width = $size[0]; $max_height = $size[1]; - } elseif ( $size === 'thumb' || $size === 'thumbnail' ) { + } elseif ( 'thumb' === $size || 'thumbnail' === $size ) { $max_width = intval( get_option( 'thumbnail_size_w' ) ); $max_height = intval( get_option( 'thumbnail_size_h' ) ); // Last chance thumbnail size defaults. @@ -78,18 +78,18 @@ function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co $max_width = 128; $max_height = 96; } - } elseif ( $size === 'medium' ) { + } elseif ( 'medium' === $size ) { $max_width = intval( get_option( 'medium_size_w' ) ); $max_height = intval( get_option( 'medium_size_h' ) ); - } elseif ( $size === 'medium_large' ) { + } elseif ( 'medium_large' === $size ) { $max_width = intval( get_option( 'medium_large_size_w' ) ); $max_height = intval( get_option( 'medium_large_size_h' ) ); if ( intval( $content_width ) > 0 ) { $max_width = min( intval( $content_width ), $max_width ); } - } elseif ( $size === 'large' ) { + } elseif ( 'large' === $size ) { /* * We're inserting a large size image into the editor. If it's a really * big image we'll scale it down to fit reasonably within the editor @@ -238,7 +238,7 @@ function image_downsize( $id, $size = 'medium' ) { $width = $intermediate['width']; $height = $intermediate['height']; $is_intermediate = true; - } elseif ( $size === 'thumbnail' ) { + } elseif ( 'thumbnail' === $size ) { // Fall back to the old thumbnail. $thumb_file = wp_get_attachment_thumb_file( $id ); $info = null; @@ -1116,7 +1116,7 @@ function _wp_get_attachment_relative_path( $file ) { * @return array|bool The image meta data as returned by `wp_get_attachment_metadata()`. */ function _wp_get_image_size_from_meta( $size_name, $image_meta ) { - if ( $size_name === 'full' ) { + if ( 'full' === $size_name ) { return array( absint( $image_meta['width'] ), absint( $image_meta['height'] ), @@ -1554,7 +1554,7 @@ function wp_image_add_srcset_and_sizes( $image, $image_meta, $attachment_id ) { */ $image_filename = wp_basename( $image_src ); - if ( $image_filename === wp_basename( $image_meta['file'] ) ) { + if ( wp_basename( $image_meta['file'] ) === $image_filename ) { $width = (int) $image_meta['width']; $height = (int) $image_meta['height']; } else { @@ -2054,12 +2054,12 @@ function gallery_shortcode( $attr ) { $output .= ""; - if ( ! $html5 && $columns > 0 && ++$i % $columns === 0 ) { + if ( ! $html5 && $columns > 0 && 0 === ++$i % $columns ) { $output .= '
'; } } - if ( ! $html5 && $columns > 0 && $i % $columns !== 0 ) { + if ( ! $html5 && $columns > 0 && 0 !== $i % $columns ) { $output .= "
"; } @@ -2226,7 +2226,7 @@ function wp_playlist_shortcode( $attr ) { $id = intval( $atts['id'] ); - if ( $atts['type'] !== 'audio' ) { + if ( 'audio' !== $atts['type'] ) { $atts['type'] = 'video'; } diff --git a/wp-includes/ms-files.php b/wp-includes/ms-files.php index fa41af5e31..03af0843f7 100644 --- a/wp-includes/ms-files.php +++ b/wp-includes/ms-files.php @@ -19,7 +19,7 @@ ms_file_constants(); error_reporting( 0 ); -if ( $current_blog->archived == '1' || $current_blog->spam == '1' || $current_blog->deleted == '1' ) { +if ( '1' == $current_blog->archived || '1' == $current_blog->spam || '1' == $current_blog->deleted ) { status_header( 404 ); die( '404 — File not found.' ); } diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index ffd46dabfe..0b4e453c3b 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -71,16 +71,16 @@ function get_active_blog_for_user( $user_id ) { } } - if ( ( ! is_object( $primary ) ) || ( $primary->archived == 1 || $primary->spam == 1 || $primary->deleted == 1 ) ) { + if ( ( ! is_object( $primary ) ) || ( 1 == $primary->archived || 1 == $primary->spam || 1 == $primary->deleted ) ) { $blogs = get_blogs_of_user( $user_id, true ); // If a user's primary blog is shut down, check their other blogs. $ret = false; if ( is_array( $blogs ) && count( $blogs ) > 0 ) { foreach ( (array) $blogs as $blog_id => $blog ) { - if ( $blog->site_id != get_current_network_id() ) { + if ( get_current_network_id() != $blog->site_id ) { continue; } $details = get_site( $blog_id ); - if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) { + if ( is_object( $details ) && 0 == $details->archived && 0 == $details->spam && 0 == $details->deleted ) { $ret = $details; if ( get_user_meta( $user_id, 'primary_blog', true ) != $blog_id ) { update_user_meta( $user_id, 'primary_blog', $blog_id ); @@ -351,7 +351,7 @@ function get_blog_id_from_url( $domain, $path = '/' ) { $path = strtolower( $path ); $id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' ); - if ( $id == -1 ) { // Blog does not exist. + if ( -1 == $id ) { // Blog does not exist. return 0; } elseif ( $id ) { return (int) $id; @@ -419,7 +419,7 @@ function is_email_address_unsafe( $user_email ) { } $dotted_domain = ".$banned_domain"; - if ( $dotted_domain === substr( $normalized_email, -strlen( $dotted_domain ) ) ) { + if ( substr( $normalized_email, -strlen( $dotted_domain ) ) === $dotted_domain ) { $is_email_address_unsafe = true; break; } @@ -539,7 +539,7 @@ function wpmu_validate_user_signup( $user_name, $user_email ) { // Has someone already signed up for this username? $signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE user_login = %s", $user_name ) ); - if ( $signup != null ) { + if ( null != $signup ) { $registered_at = mysql2date( 'U', $signup->registered ); $now = time(); $diff = $now - $registered_at; @@ -552,7 +552,7 @@ function wpmu_validate_user_signup( $user_name, $user_email ) { } $signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE user_email = %s", $user_email ) ); - if ( $signup != null ) { + if ( null != $signup ) { $diff = time() - mysql2date( 'U', $signup->registered ); // If registered more than two days ago, cancel registration and let this signup go through. if ( $diff > 2 * DAY_IN_SECONDS ) { @@ -632,7 +632,7 @@ function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) { $errors = new WP_Error(); $illegal_names = get_site_option( 'illegal_names' ); - if ( $illegal_names == false ) { + if ( false == $illegal_names ) { $illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' ); add_site_option( 'illegal_names', $illegal_names ); } @@ -945,7 +945,7 @@ function wpmu_signup_blog_notification( $domain, $path, $title, $user_login, $us $activate_url = esc_url( $activate_url ); $admin_email = get_site_option( 'admin_email' ); - if ( $admin_email == '' ) { + if ( '' == $admin_email ) { $admin_email = 'support@' . $_SERVER['SERVER_NAME']; } $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) ); @@ -1070,7 +1070,7 @@ function wpmu_signup_user_notification( $user_login, $user_email, $key, $meta = // Send email with activation link. $admin_email = get_site_option( 'admin_email' ); - if ( $admin_email == '' ) { + if ( '' == $admin_email ) { $admin_email = 'support@' . $_SERVER['SERVER_NAME']; } $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) ); @@ -1589,7 +1589,7 @@ function wpmu_welcome_notification( $blog_id, $user_id, $password, $title, $meta $switched_locale = switch_to_locale( get_user_locale( $user ) ); $welcome_email = get_site_option( 'welcome_email' ); - if ( $welcome_email == false ) { + if ( false == $welcome_email ) { /* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */ $welcome_email = __( 'Howdy USERNAME, @@ -1634,7 +1634,7 @@ We hope you enjoy your new site. Thanks! $welcome_email = apply_filters( 'update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta ); $admin_email = get_site_option( 'admin_email' ); - if ( $admin_email == '' ) { + if ( '' == $admin_email ) { $admin_email = 'support@' . $_SERVER['SERVER_NAME']; } @@ -1726,7 +1726,7 @@ function wpmu_welcome_user_notification( $user_id, $password, $meta = array() ) $admin_email = get_site_option( 'admin_email' ); - if ( $admin_email == '' ) { + if ( '' == $admin_email ) { $admin_email = 'support@' . $_SERVER['SERVER_NAME']; } @@ -1849,7 +1849,7 @@ function check_upload_mimes( $mimes ) { $site_mimes = array(); foreach ( $site_exts as $ext ) { foreach ( $mimes as $ext_pattern => $mime ) { - if ( $ext != '' && strpos( $ext_pattern, $ext ) !== false ) { + if ( '' != $ext && false !== strpos( $ext_pattern, $ext ) ) { $site_mimes[ $ext_pattern ] = $mime; } } @@ -1936,7 +1936,7 @@ function global_terms( $term_id, $deprecated = '' ) { // Prevent a race condition. $recurse_start = false; - if ( $global_terms_recurse === null ) { + if ( null === $global_terms_recurse ) { $recurse_start = true; $global_terms_recurse = 1; } elseif ( 10 < $global_terms_recurse++ ) { @@ -1947,7 +1947,7 @@ function global_terms( $term_id, $deprecated = '' ) { $c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->terms WHERE term_id = %d", $term_id ) ); $global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE category_nicename = %s", $c->slug ) ); - if ( $global_id == null ) { + if ( null == $global_id ) { $used_global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE cat_ID = %d", $c->term_id ) ); if ( null == $used_global_id ) { $wpdb->insert( @@ -2093,7 +2093,7 @@ function maybe_redirect_404() { */ $destination = apply_filters( 'blog_redirect_404', NOBLOGREDIRECT ); if ( $destination ) { - if ( $destination == '%siteurl%' ) { + if ( '%siteurl%' === $destination ) { $destination = network_home_url(); } wp_redirect( $destination ); @@ -2119,7 +2119,7 @@ function maybe_add_existing_user_to_blog() { $parts = explode( '/', $_SERVER['REQUEST_URI'] ); $key = array_pop( $parts ); - if ( $key == '' ) { + if ( '' == $key ) { $key = array_pop( $parts ); } @@ -2261,7 +2261,7 @@ function update_blog_public( $old_value, $value ) { */ function users_can_register_signup_filter() { $registration = get_site_option( 'registration' ); - return ( $registration == 'all' || $registration == 'user' ); + return ( 'all' === $registration || 'user' === $registration ); } /** @@ -2659,7 +2659,7 @@ function get_subdirectory_reserved_names() { * @param string $value The proposed new network admin email address. */ function update_network_option_new_admin_email( $old_value, $value ) { - if ( $value == get_site_option( 'admin_email' ) || ! is_email( $value ) ) { + if ( get_site_option( 'admin_email' ) === $value || ! is_email( $value ) ) { return; } diff --git a/wp-includes/ms-load.php b/wp-includes/ms-load.php index 4750a420a8..0e369101ae 100644 --- a/wp-includes/ms-load.php +++ b/wp-includes/ms-load.php @@ -115,7 +115,7 @@ function ms_site_check() { } } - if ( $blog->archived == '1' || $blog->spam == '1' ) { + if ( '1' == $blog->archived || '1' == $blog->spam ) { if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) { return WP_CONTENT_DIR . '/blog-suspended.php'; } else { diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php index 369e2b99dc..e23ec69b22 100644 --- a/wp-includes/nav-menu-template.php +++ b/wp-includes/nav-menu-template.php @@ -28,7 +28,7 @@ require_once ABSPATH . WPINC . '/class-walker-nav-menu.php'; * @type string $container Whether to wrap the ul, and what to wrap it with. Default 'div'. * @type string $container_class Class that is applied to the container. Default 'menu-{menu slug}-container'. * @type string $container_id The ID that is applied to the container. Default empty. - * @type callable|bool $fallback_cb If the menu doesn't exists, a callback function will fire. + * @type callable|bool $fallback_cb If the menu doesn't exist, a callback function will fire. * Default is 'wp_page_menu'. Set to false for no fallback. * @type string $before Text before the link markup. Default empty. * @type string $after Text after the link markup. Default empty. diff --git a/wp-includes/option.php b/wp-includes/option.php index 087d1517a9..3efdcb20cb 100644 --- a/wp-includes/option.php +++ b/wp-includes/option.php @@ -2227,7 +2227,7 @@ function unregister_setting( $option_group, $option_name, $deprecated = '' ) { } $pos = array_search( $option_name, (array) $new_whitelist_options[ $option_group ] ); - if ( $pos !== false ) { + if ( false !== $pos ) { unset( $new_whitelist_options[ $option_group ][ $pos ] ); } if ( '' !== $deprecated ) { diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 81db29542b..d8ed6fa53f 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -255,7 +255,7 @@ if ( ! function_exists( 'wp_mail' ) ) : // Mainly for legacy -- process a "From:" header if it's there. case 'from': $bracket_pos = strpos( $content, '<' ); - if ( $bracket_pos !== false ) { + if ( false !== $bracket_pos ) { // Text before the bracketed email is the "From" name. if ( $bracket_pos > 0 ) { $from_name = substr( $content, 0, $bracket_pos - 1 ); @@ -538,7 +538,7 @@ if ( ! function_exists( 'wp_authenticate' ) ) : */ $user = apply_filters( 'authenticate', null, $username, $password ); - if ( $user == null ) { + if ( null == $user ) { // TODO: What should the error message be? (Or would these even happen?) // Only needed if all authentication handlers fail to return anything. $user = new WP_Error( 'authentication_failed', __( 'Error: Invalid username, email address or incorrect password.' ) ); @@ -1465,7 +1465,7 @@ if ( ! function_exists( 'wp_validate_redirect' ) ) : */ $allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array( $wpp['host'] ), isset( $lp['host'] ) ? $lp['host'] : '' ); - if ( isset( $lp['host'] ) && ( ! in_array( $lp['host'], $allowed_hosts ) && $lp['host'] != strtolower( $wpp['host'] ) ) ) { + if ( isset( $lp['host'] ) && ( ! in_array( $lp['host'], $allowed_hosts ) && strtolower( $wpp['host'] ) !== $lp['host'] ) ) { $location = $default; } @@ -1544,7 +1544,7 @@ if ( ! function_exists( 'wp_notify_postauthor' ) ) : } // The author moderated a comment on their own post. - if ( $author && ! $notify_author && $post->post_author == get_current_user_id() ) { + if ( $author && ! $notify_author && get_current_user_id() == $post->post_author ) { unset( $emails[ $author->user_email ] ); } @@ -1957,7 +1957,7 @@ if ( ! function_exists( 'wp_new_user_notification' ) ) : * string (admin only), 'user', or 'both' (admin and user). Default empty. */ function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) { - if ( $deprecated !== null ) { + if ( null !== $deprecated ) { _deprecated_argument( __FUNCTION__, '4.3.1' ); } @@ -2527,7 +2527,7 @@ if ( ! function_exists( 'wp_rand' ) ) : $value = abs( hexdec( $value ) ); // Reduce the value to be within the min - max range. - if ( $max != 0 ) { + if ( 0 != $max ) { $value = $min + ( $max - $min + 1 ) * $value / ( $max_random_number + 1 ); } diff --git a/wp-includes/pomo/mo.php b/wp-includes/pomo/mo.php index ed02d0aa0d..b37c09b6af 100644 --- a/wp-includes/pomo/mo.php +++ b/wp-includes/pomo/mo.php @@ -235,7 +235,7 @@ if ( ! class_exists( 'MO', false ) ) : } // Support revision 0 of MO format specs, only. - if ( $header['revision'] != 0 ) { + if ( 0 != $header['revision'] ) { return false; } diff --git a/wp-includes/pomo/plural-forms.php b/wp-includes/pomo/plural-forms.php index 34efc11f41..f25a84188d 100644 --- a/wp-includes/pomo/plural-forms.php +++ b/wp-includes/pomo/plural-forms.php @@ -125,7 +125,7 @@ class Plural_Forms { $found = false; while ( ! empty( $stack ) ) { $o2 = $stack[ count( $stack ) - 1 ]; - if ( $o2 !== '(' ) { + if ( '(' !== $o2 ) { $output[] = array( 'op', array_pop( $stack ) ); continue; } @@ -162,7 +162,7 @@ class Plural_Forms { $o2 = $stack[ count( $stack ) - 1 ]; // Ternary is right-associative in C. - if ( $operator === '?:' || $operator === '?' ) { + if ( '?:' === $operator || '?' === $operator ) { if ( self::$op_precedence[ $operator ] >= self::$op_precedence[ $o2 ] ) { break; } @@ -183,7 +183,7 @@ class Plural_Forms { $s_pos = count( $stack ) - 1; while ( $s_pos >= 0 ) { $o2 = $stack[ $s_pos ]; - if ( $o2 !== '?' ) { + if ( '?' !== $o2 ) { $output[] = array( 'op', array_pop( $stack ) ); $s_pos--; continue; @@ -216,7 +216,7 @@ class Plural_Forms { while ( ! empty( $stack ) ) { $o2 = array_pop( $stack ); - if ( $o2 === '(' || $o2 === ')' ) { + if ( '(' === $o2 || ')' === $o2 ) { throw new Exception( 'Mismatched parentheses' ); } @@ -259,10 +259,10 @@ class Plural_Forms { while ( $i < $total ) { $next = $this->tokens[ $i ]; $i++; - if ( $next[0] === 'var' ) { + if ( 'var' === $next[0] ) { $stack[] = $n; continue; - } elseif ( $next[0] === 'value' ) { + } elseif ( 'value' === $next[0] ) { $stack[] = $next[1]; continue; } diff --git a/wp-includes/pomo/po.php b/wp-includes/pomo/po.php index bcc4ee2860..238573d041 100644 --- a/wp-includes/pomo/po.php +++ b/wp-includes/pomo/po.php @@ -119,7 +119,7 @@ if ( ! class_exists( 'PO', false ) ) : $po = $quote . implode( "${slash}n$quote$newline$quote", explode( $newline, $string ) ) . $quote; // Add empty string on first line for readbility. if ( false !== strpos( $string, $newline ) && - ( substr_count( $string, $newline ) > 1 || ! ( $newline === substr( $string, -strlen( $newline ) ) ) ) ) { + ( substr_count( $string, $newline ) > 1 || substr( $string, -strlen( $newline ) ) !== $newline ) ) { $po = "$quote$quote$newline$po"; } // Remove empty strings. @@ -294,7 +294,7 @@ if ( ! class_exists( 'PO', false ) ) : if ( ! $res ) { break; } - if ( $res['entry']->singular == '' ) { + if ( '' == $res['entry']->singular ) { $this->set_headers( $this->make_headers( $res['entry']->translations[0] ) ); } else { $this->add_entry( $res['entry'] ); @@ -317,7 +317,7 @@ if ( ! class_exists( 'PO', false ) ) : * @return bool */ protected static function is_final( $context ) { - return ( $context === 'msgstr' ) || ( $context === 'msgstr_plural' ); + return ( 'msgstr' === $context ) || ( 'msgstr_plural' === $context ); } /** @@ -347,7 +347,7 @@ if ( ! class_exists( 'PO', false ) ) : return false; } } - if ( $line == "\n" ) { + if ( "\n" === $line ) { continue; } $line = trim( $line ); @@ -359,7 +359,7 @@ if ( ! class_exists( 'PO', false ) ) : break; } // Comments have to be at the beginning. - if ( $context && $context != 'comment' ) { + if ( $context && 'comment' !== $context ) { return false; } // Add comment. @@ -370,7 +370,7 @@ if ( ! class_exists( 'PO', false ) ) : $lineno--; break; } - if ( $context && $context != 'comment' ) { + if ( $context && 'comment' !== $context ) { return false; } $context = 'msgctxt'; @@ -381,26 +381,26 @@ if ( ! class_exists( 'PO', false ) ) : $lineno--; break; } - if ( $context && $context != 'msgctxt' && $context != 'comment' ) { + if ( $context && 'msgctxt' !== $context && 'comment' !== $context ) { return false; } $context = 'msgid'; $entry->singular .= PO::unpoify( $m[1] ); } elseif ( preg_match( '/^msgid_plural\s+(".*")/', $line, $m ) ) { - if ( $context != 'msgid' ) { + if ( 'msgid' !== $context ) { return false; } $context = 'msgid_plural'; $entry->is_plural = true; $entry->plural .= PO::unpoify( $m[1] ); } elseif ( preg_match( '/^msgstr\s+(".*")/', $line, $m ) ) { - if ( $context != 'msgid' ) { + if ( 'msgid' !== $context ) { return false; } $context = 'msgstr'; $entry->translations = array( PO::unpoify( $m[1] ) ); } elseif ( preg_match( '/^msgstr\[(\d+)\]\s+(".*")/', $line, $m ) ) { - if ( $context != 'msgid_plural' && $context != 'msgstr_plural' ) { + if ( 'msgid_plural' !== $context && 'msgstr_plural' !== $context ) { return false; } $context = 'msgstr_plural'; diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index c7f8177c10..8b57568c40 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -338,7 +338,7 @@ function get_the_content( $more_link_text = null, $strip_teaser = false, $post = $content = array( $content ); } - if ( false !== strpos( $_post->post_content, '' ) && ( ! $elements['multipage'] || $elements['page'] == 1 ) ) { + if ( false !== strpos( $_post->post_content, '' ) && ( ! $elements['multipage'] || 1 == $elements['page'] ) ) { $strip_teaser = true; } @@ -1654,7 +1654,7 @@ function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = fals function prepend_attachment( $content ) { $post = get_post(); - if ( empty( $post->post_type ) || $post->post_type != 'attachment' ) { + if ( empty( $post->post_type ) || 'attachment' !== $post->post_type ) { return $content; } diff --git a/wp-includes/post.php b/wp-includes/post.php index 982c7dc752..357a6b67c7 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -676,15 +676,15 @@ function get_children( $args = '', $output = OBJECT ) { $kids[ $child->ID ] = $children[ $key ]; } - if ( $output == OBJECT ) { + if ( OBJECT == $output ) { return $kids; - } elseif ( $output == ARRAY_A ) { + } elseif ( ARRAY_A == $output ) { $weeuns = array(); foreach ( (array) $kids as $kid ) { $weeuns[ $kid->ID ] = get_object_vars( $kids[ $kid->ID ] ); } return $weeuns; - } elseif ( $output == ARRAY_N ) { + } elseif ( ARRAY_N == $output ) { $babes = array(); foreach ( (array) $kids as $kid ) { $babes[ $kid->ID ] = array_values( get_object_vars( $kids[ $kid->ID ] ) ); @@ -784,9 +784,9 @@ function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) { $_post = $_post->filter( $filter ); - if ( $output == ARRAY_A ) { + if ( ARRAY_A == $output ) { return $_post->to_array(); - } elseif ( $output == ARRAY_N ) { + } elseif ( ARRAY_N == $output ) { return array_values( $_post->to_array() ); } @@ -1806,7 +1806,7 @@ function _add_post_type_submenus() { foreach ( get_post_types( array( 'show_ui' => true ) ) as $ptype ) { $ptype_obj = get_post_type_object( $ptype ); // Sub-menus only. - if ( ! $ptype_obj->show_in_menu || $ptype_obj->show_in_menu === true ) { + if ( ! $ptype_obj->show_in_menu || true === $ptype_obj->show_in_menu ) { continue; } add_submenu_page( $ptype_obj->show_in_menu, $ptype_obj->labels->name, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype" ); @@ -4213,7 +4213,7 @@ function wp_update_post( $postarr = array(), $wp_error = false ) { $postarr['post_date_gmt'] = ''; } - if ( $postarr['post_type'] == 'attachment' ) { + if ( 'attachment' === $postarr['post_type'] ) { return wp_insert_attachment( $postarr, false, 0, $wp_error ); } @@ -4959,7 +4959,7 @@ function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) { * Loop through the given path parts from right to left, * ensuring each matches the post ancestry. */ - while ( $p->post_parent != 0 && isset( $pages[ $p->post_parent ] ) ) { + while ( 0 != $p->post_parent && isset( $pages[ $p->post_parent ] ) ) { $count++; $parent = $pages[ $p->post_parent ]; if ( ! isset( $revparts[ $count ] ) || $parent->post_name != $revparts[ $count ] ) { @@ -4968,7 +4968,7 @@ function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) { $p = $parent; } - if ( $p->post_parent == 0 && $count + 1 == count( $revparts ) && $p->post_name == $revparts[ $count ] ) { + if ( 0 == $p->post_parent && count( $revparts ) == $count + 1 && $p->post_name == $revparts[ $count ] ) { $foundid = $page->ID; if ( $page->post_type == $post_type ) { break; @@ -6747,7 +6747,7 @@ function clean_attachment_cache( $id, $clean_terms = false ) { function _transition_post_status( $new_status, $old_status, $post ) { global $wpdb; - if ( $old_status != 'publish' && $new_status == 'publish' ) { + if ( 'publish' !== $old_status && 'publish' === $new_status ) { // Reset GUID if transitioning to publish and it is empty. if ( '' == get_the_guid( $post->ID ) ) { $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) ); diff --git a/wp-includes/rest-api.php b/wp-includes/rest-api.php index 93fef86042..bad90ae336 100644 --- a/wp-includes/rest-api.php +++ b/wp-includes/rest-api.php @@ -372,7 +372,7 @@ function get_rest_url( $blog_id = null, $path = '/', $scheme = 'rest' ) { if ( is_ssl() && isset( $_SERVER['SERVER_NAME'] ) ) { // If the current host is the same as the REST URL host, force the REST URL scheme to HTTPS. - if ( $_SERVER['SERVER_NAME'] === parse_url( get_home_url( $blog_id ), PHP_URL_HOST ) ) { + if ( parse_url( get_home_url( $blog_id ), PHP_URL_HOST ) === $_SERVER['SERVER_NAME'] ) { $url = set_url_scheme( $url, 'https' ); } } diff --git a/wp-includes/revision.php b/wp-includes/revision.php index 77fd8e98ac..00e58fa179 100644 --- a/wp-includes/revision.php +++ b/wp-includes/revision.php @@ -354,12 +354,12 @@ function wp_get_post_revision( &$post, $output = OBJECT, $filter = 'raw' ) { return null; } - if ( $output == OBJECT ) { + if ( OBJECT == $output ) { return $revision; - } elseif ( $output == ARRAY_A ) { + } elseif ( ARRAY_A == $output ) { $_revision = get_object_vars( $revision ); return $_revision; - } elseif ( $output == ARRAY_N ) { + } elseif ( ARRAY_N == $output ) { $_revision = array_values( get_object_vars( $revision ) ); return $_revision; } diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index aa7d22371b..f0791e030b 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -158,7 +158,7 @@ function add_rewrite_rule( $regex, $query, $after = 'bottom' ) { */ function add_rewrite_tag( $tag, $regex, $query = '' ) { // Validate the tag's name. - if ( strlen( $tag ) < 3 || $tag[0] != '%' || $tag[ strlen( $tag ) - 1 ] != '%' ) { + if ( strlen( $tag ) < 3 || '%' !== $tag[0] || '%' !== $tag[ strlen( $tag ) - 1 ] ) { return; } diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 9edc8be35b..f56142be00 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -596,7 +596,7 @@ function wp_default_packages( &$scripts ) { function wp_scripts_get_suffix( $type = '' ) { static $suffixes; - if ( $suffixes === null ) { + if ( null === $suffixes ) { // Include an unmodified $wp_version. require ABSPATH . WPINC . '/version.php'; @@ -614,7 +614,7 @@ function wp_scripts_get_suffix( $type = '' ) { ); } - if ( $type === 'dev' ) { + if ( 'dev' === $type ) { return $suffixes['dev_suffix']; } diff --git a/wp-includes/shortcodes.php b/wp-includes/shortcodes.php index 3b3ef23615..6d784f701a 100644 --- a/wp-includes/shortcodes.php +++ b/wp-includes/shortcodes.php @@ -306,7 +306,7 @@ function do_shortcode_tag( $m ) { global $shortcode_tags; // Allow [[foo]] syntax for escaping a tag. - if ( $m[1] == '[' && $m[6] == ']' ) { + if ( '[' === $m[1] && ']' === $m[6] ) { return substr( $m[0], 1, -1 ); } @@ -663,7 +663,7 @@ function strip_shortcodes( $content ) { */ function strip_shortcode_tag( $m ) { // Allow [[foo]] syntax for escaping a tag. - if ( $m[1] == '[' && $m[6] == ']' ) { + if ( '[' === $m[1] && ']' === $m[6] ) { return substr( $m[0], 1, -1 ); } diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 1e3eefd03a..370cb46ad5 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -223,7 +223,7 @@ function get_object_taxonomies( $object, $output = 'names' ) { global $wp_taxonomies; if ( is_object( $object ) ) { - if ( $object->post_type === 'attachment' ) { + if ( 'attachment' === $object->post_type ) { return get_attachment_taxonomies( $object, $output ); } $object = $object->post_type; @@ -880,9 +880,9 @@ function get_term( $term, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) { // Sanitize term, according to the specified filter. $_term->filter( $filter ); - if ( $output === ARRAY_A ) { + if ( ARRAY_A === $output ) { return $_term->to_array(); - } elseif ( $output === ARRAY_N ) { + } elseif ( ARRAY_N === $output ) { return array_values( $_term->to_array() ); } @@ -2011,7 +2011,7 @@ function wp_get_object_terms( $object_ids, $taxonomies, $args = array() ) { if ( count( $taxonomies ) > 1 ) { foreach ( $taxonomies as $index => $taxonomy ) { $t = get_taxonomy( $taxonomy ); - if ( isset( $t->args ) && is_array( $t->args ) && $args != array_merge( $args, $t->args ) ) { + if ( isset( $t->args ) && is_array( $t->args ) && array_merge( $args, $t->args ) != $args ) { unset( $taxonomies[ $index ] ); $terms = array_merge( $terms, wp_get_object_terms( $object_ids, $taxonomy, array_merge( $args, $t->args ) ) ); } @@ -3150,7 +3150,7 @@ function wp_update_term_count_now( $terms, $taxonomy ) { } } - if ( $object_types == array_filter( $object_types, 'post_type_exists' ) ) { + if ( array_filter( $object_types, 'post_type_exists' ) == $object_types ) { // Only post types are attached to this taxonomy. _update_post_term_count( $terms, $taxonomy ); } else { @@ -4035,7 +4035,7 @@ function _wp_check_split_default_terms( $term_id, $new_term_id, $term_taxonomy_i } foreach ( array( 'default_category', 'default_link_category', 'default_email_category' ) as $option ) { - if ( $term_id === (int) get_option( $option, -1 ) ) { + if ( (int) get_option( $option, -1 ) === $term_id ) { update_option( $option, $new_term_id ); } } diff --git a/wp-includes/theme.php b/wp-includes/theme.php index dc18db9913..c158b51969 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -500,7 +500,7 @@ function search_theme_directories( $force = false ) { continue; } foreach ( $dirs as $dir ) { - if ( ! is_dir( $theme_root . '/' . $dir ) || $dir[0] == '.' || $dir == 'CVS' ) { + if ( ! is_dir( $theme_root . '/' . $dir ) || '.' === $dir[0] || 'CVS' === $dir ) { continue; } if ( file_exists( $theme_root . '/' . $dir . '/style.css' ) ) { @@ -520,7 +520,7 @@ function search_theme_directories( $force = false ) { continue; } foreach ( $sub_dirs as $sub_dir ) { - if ( ! is_dir( $theme_root . '/' . $dir . '/' . $sub_dir ) || $dir[0] == '.' || $dir == 'CVS' ) { + if ( ! is_dir( $theme_root . '/' . $dir . '/' . $sub_dir ) || '.' === $dir[0] || 'CVS' === $dir ) { continue; } if ( ! file_exists( $theme_root . '/' . $dir . '/' . $sub_dir . '/style.css' ) ) { @@ -553,7 +553,7 @@ function search_theme_directories( $force = false ) { $theme_roots[ $theme_dir ] = $relative_theme_roots[ $theme_data['theme_root'] ]; // Convert absolute to relative. } - if ( $theme_roots != get_site_transient( 'theme_roots' ) ) { + if ( get_site_transient( 'theme_roots' ) != $theme_roots ) { set_site_transient( 'theme_roots', $theme_roots, $cache_expiration ); } @@ -1648,7 +1648,7 @@ function _custom_background_cb() { // A default has to be specified in style.css. It will not be printed here. $color = get_background_color(); - if ( $color === get_theme_support( 'custom-background', 'default-color' ) ) { + if ( get_theme_support( 'custom-background', 'default-color' ) === $color ) { $color = false; } diff --git a/wp-includes/user.php b/wp-includes/user.php index 73968ef77e..3d6e63630b 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -768,7 +768,7 @@ function is_user_member_of_blog( $user_id = 0, $blog_id = 0 ) { $base_capabilities_key = $wpdb->base_prefix . 'capabilities'; $site_capabilities_key = $wpdb->base_prefix . $blog_id . '_capabilities'; - if ( isset( $keys[ $base_capabilities_key ] ) && $blog_id == 1 ) { + if ( isset( $keys[ $base_capabilities_key ] ) && 1 == $blog_id ) { return true; } @@ -902,7 +902,7 @@ function count_users( $strategy = 'time', $site_id = null ) { $result = array(); if ( 'time' == $strategy ) { - if ( is_multisite() && $site_id != get_current_blog_id() ) { + if ( is_multisite() && get_current_blog_id() != $site_id ) { switch_to_blog( $site_id ); $avail_roles = wp_roles()->get_names(); restore_current_blog(); @@ -1872,7 +1872,7 @@ function wp_insert_user( $userdata ) { do_action( 'profile_update', $user_id, $old_user_data ); if ( isset( $userdata['spam'] ) && $userdata['spam'] != $old_user_data->spam ) { - if ( $userdata['spam'] == 1 ) { + if ( 1 == $userdata['spam'] ) { /** * Fires after the user is marked as a SPAM user. * @@ -2493,7 +2493,7 @@ function register_new_user( $user_login, $user_email ) { $user_email = apply_filters( 'user_registration_email', $user_email ); // Check the username. - if ( $sanitized_user_login == '' ) { + if ( '' == $sanitized_user_login ) { $errors->add( 'empty_username', __( 'Error: Please enter a username.' ) ); } elseif ( ! validate_username( $user_login ) ) { $errors->add( 'invalid_username', __( 'Error: This username is invalid because it uses illegal characters. Please enter a valid username.' ) ); @@ -2510,7 +2510,7 @@ function register_new_user( $user_login, $user_email ) { } // Check the email address. - if ( $user_email == '' ) { + if ( '' == $user_email ) { $errors->add( 'empty_email', __( 'Error: Please type your email address.' ) ); } elseif ( ! is_email( $user_email ) ) { $errors->add( 'invalid_email', __( 'Error: The email address isn’t correct.' ) ); @@ -2677,7 +2677,7 @@ function wp_get_users_with_no_role( $site_id = null ) { $prefix = $wpdb->get_blog_prefix( $site_id ); - if ( is_multisite() && $site_id != get_current_blog_id() ) { + if ( is_multisite() && get_current_blog_id() != $site_id ) { switch_to_blog( $site_id ); $role_names = wp_roles()->get_names(); restore_current_blog(); diff --git a/wp-includes/version.php b/wp-includes/version.php index b3ac54fbf4..26c318621d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-47218'; +$wp_version = '5.4-alpha-47219'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 400888e61e..797403c34e 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -1735,7 +1735,7 @@ class wpdb { // First peel off the socket parameter from the right, if it exists. $socket_pos = strpos( $host, ':/' ); - if ( $socket_pos !== false ) { + if ( false !== $socket_pos ) { $socket = substr( $host, $socket_pos + 1 ); $host = substr( $host, 0, $socket_pos ); } @@ -2536,7 +2536,7 @@ class wpdb { } // If there is a value return it else return null. - return ( isset( $values[ $x ] ) && $values[ $x ] !== '' ) ? $values[ $x ] : null; + return ( isset( $values[ $x ] ) && '' !== $values[ $x ] ) ? $values[ $x ] : null; } /** @@ -2569,13 +2569,13 @@ class wpdb { return null; } - if ( $output == OBJECT ) { + if ( OBJECT == $output ) { return $this->last_result[ $y ] ? $this->last_result[ $y ] : null; - } elseif ( $output == ARRAY_A ) { + } elseif ( ARRAY_A == $output ) { return $this->last_result[ $y ] ? get_object_vars( $this->last_result[ $y ] ) : null; - } elseif ( $output == ARRAY_N ) { + } elseif ( ARRAY_N == $output ) { return $this->last_result[ $y ] ? array_values( get_object_vars( $this->last_result[ $y ] ) ) : null; - } elseif ( strtoupper( $output ) === OBJECT ) { + } elseif ( OBJECT === strtoupper( $output ) ) { // Back compat for OBJECT being previously case-insensitive. return $this->last_result[ $y ] ? $this->last_result[ $y ] : null; } else { @@ -2644,10 +2644,10 @@ class wpdb { } $new_array = array(); - if ( $output == OBJECT ) { + if ( OBJECT == $output ) { // Return an integer-keyed array of row objects. return $this->last_result; - } elseif ( $output == OBJECT_K ) { + } elseif ( OBJECT_K == $output ) { // Return an array of row objects with keys from column 1. // (Duplicates are discarded.) if ( $this->last_result ) { @@ -2660,11 +2660,11 @@ class wpdb { } } return $new_array; - } elseif ( $output == ARRAY_A || $output == ARRAY_N ) { + } elseif ( ARRAY_A == $output || ARRAY_N == $output ) { // Return an integer-keyed array of... if ( $this->last_result ) { foreach ( (array) $this->last_result as $row ) { - if ( $output == ARRAY_N ) { + if ( ARRAY_N == $output ) { // ...integer-keyed row arrays. $new_array[] = array_values( get_object_vars( $row ) ); } else { @@ -3373,7 +3373,7 @@ class wpdb { $this->load_col_info(); if ( $this->col_info ) { - if ( $col_offset == -1 ) { + if ( -1 == $col_offset ) { $i = 0; $new_array = array(); foreach ( (array) $this->col_info as $col ) { diff --git a/wp-login.php b/wp-login.php index 597725e11d..55e310a216 100644 --- a/wp-login.php +++ b/wp-login.php @@ -514,7 +514,7 @@ if ( defined( 'RELOCATE' ) && RELOCATE ) { // Move flag is set. $url = dirname( set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) ); - if ( $url !== get_option( 'siteurl' ) ) { + if ( get_option( 'siteurl' ) !== $url ) { update_option( 'siteurl', $url ); } } @@ -1282,7 +1282,7 @@ switch ( $action ) { } } - if ( ( empty( $redirect_to ) || $redirect_to === 'wp-admin/' || $redirect_to === admin_url() ) ) { + if ( ( empty( $redirect_to ) || 'wp-admin/' === $redirect_to || admin_url() === $redirect_to ) ) { // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile. if ( is_multisite() && ! get_active_blog_for_user( $user->ID ) && ! is_super_admin( $user->ID ) ) { $redirect_to = user_admin_url();