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
This commit is contained in:
Sergey Biryukov 2020-02-09 16:55:09 +00:00
parent 5e6c949861
commit 641c632b0c
125 changed files with 555 additions and 555 deletions

View File

@ -288,6 +288,6 @@ if ( is_network_admin() ) {
*/ */
do_action( 'all_admin_notices' ); do_action( 'all_admin_notices' );
if ( $parent_file == 'options-general.php' ) { if ( 'options-general.php' === $parent_file ) {
require ABSPATH . 'wp-admin/options-head.php'; require ABSPATH . 'wp-admin/options-head.php';
} }

View File

@ -101,7 +101,7 @@ switch ( $action ) {
} }
// No need to re-approve/re-trash/re-spam a comment. // 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 ) ); wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) );
die(); die();
} }
@ -137,7 +137,7 @@ switch ( $action ) {
break; break;
} }
if ( $comment->comment_approved != '0' ) { // If not unapproved. if ( '0' != $comment->comment_approved ) { // If not unapproved.
$message = ''; $message = '';
switch ( $comment->comment_approved ) { switch ( $comment->comment_approved ) {
case '1': case '1':

View File

@ -31,7 +31,7 @@ if ( $doaction ) {
$doaction = 'delete'; $doaction = 'delete';
} elseif ( isset( $_REQUEST['delete_comments'] ) ) { } elseif ( isset( $_REQUEST['delete_comments'] ) ) {
$comment_ids = $_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'] ) ) { } elseif ( isset( $_REQUEST['ids'] ) ) {
$comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) ); $comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) );
} elseif ( wp_get_referer() ) { } elseif ( wp_get_referer() ) {

View File

@ -76,7 +76,7 @@ $post_ID = isset( $post_ID ) ? (int) $post_ID : 0;
$user_ID = isset( $user_ID ) ? (int) $user_ID : 0; $user_ID = isset( $user_ID ) ? (int) $user_ID : 0;
$action = isset( $action ) ? $action : ''; $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' ); add_action( 'edit_form_after_title', '_wp_posts_page_notice' );
remove_post_type_support( $post_type, 'editor' ); 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' ) ) { if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) {
$shortlink = wp_get_shortlink( $post->ID, 'post' ); $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 .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" /><button type="button" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val());">' . __( 'Get Shortlink' ) . '</button>'; $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" /><button type="button" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val());">' . __( 'Get Shortlink' ) . '</button>';
} }
} }

View File

@ -149,7 +149,7 @@ function wp_ajax_ajax_tag_search() {
* Require $term_search_min_chars chars for matching (default: 2) * Require $term_search_min_chars chars for matching (default: 2)
* ensure it's a non-negative, non-zero integer. * 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(); wp_die();
} }
@ -295,14 +295,14 @@ function wp_ajax_autocomplete_user() {
$id = get_current_blog_id(); $id = get_current_blog_id();
} }
$include_blog_users = ( $type == 'search' ? get_users( $include_blog_users = ( 'search' === $type ? get_users(
array( array(
'blog_id' => $id, 'blog_id' => $id,
'fields' => 'ID', 'fields' => 'ID',
) )
) : array() ); ) : array() );
$exclude_blog_users = ( $type == 'add' ? get_users( $exclude_blog_users = ( 'add' === $type ? get_users(
array( array(
'blog_id' => $id, 'blog_id' => $id,
'fields' => 'ID', 'fields' => 'ID',
@ -391,7 +391,7 @@ function wp_ajax_dashboard_widgets() {
require_once ABSPATH . 'wp-admin/includes/dashboard.php'; require_once ABSPATH . 'wp-admin/includes/dashboard.php';
$pagenow = $_GET['pagenow']; $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 ); set_current_screen( $pagenow );
} }
@ -573,7 +573,7 @@ function _wp_ajax_add_hierarchical_term() {
$parent = 0; $parent = 0;
} }
if ( $taxonomy->name == 'category' ) { if ( 'category' === $taxonomy->name ) {
$post_category = isset( $_POST['post_category'] ) ? (array) $_POST['post_category'] : array(); $post_category = isset( $_POST['post_category'] ) ? (array) $_POST['post_category'] : array();
} else { } else {
$post_category = ( isset( $_POST['tax_input'] ) && isset( $_POST['tax_input'][ $taxonomy->name ] ) ) ? (array) $_POST['tax_input'][ $taxonomy->name ] : array(); $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 ); $r = wp_untrash_comment( $comment );
// Undo trash, not in trash. // 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; $delta = 1;
} }
} elseif ( isset( $_POST['spam'] ) && 1 == $_POST['spam'] ) { } elseif ( isset( $_POST['spam'] ) && 1 == $_POST['spam'] ) {
@ -734,7 +734,7 @@ function wp_ajax_delete_comment() {
$r = wp_unspam_comment( $comment ); $r = wp_unspam_comment( $comment );
// Undo spam, not in spam. // 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; $delta = 1;
} }
} elseif ( isset( $_POST['delete'] ) && 1 == $_POST['delete'] ) { } elseif ( isset( $_POST['delete'] ) && 1 == $_POST['delete'] ) {
@ -1318,7 +1318,7 @@ function wp_ajax_replyto_comment( $action ) {
if ( ! empty( $_POST['approve_parent'] ) ) { if ( ! empty( $_POST['approve_parent'] ) ) {
$parent = get_comment( $comment_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 ) ) { if ( ! current_user_can( 'edit_comment', $parent->comment_ID ) ) {
wp_die( -1 ); 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 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 = array();
$post_data['action'] = 'draft'; // Warning fix. $post_data['action'] = 'draft'; // Warning fix.
$post_data['post_ID'] = $pid; $post_data['post_ID'] = $pid;
@ -1720,7 +1720,7 @@ function wp_ajax_closed_postboxes() {
$page = isset( $_POST['page'] ) ? $_POST['page'] : ''; $page = isset( $_POST['page'] ) ? $_POST['page'] : '';
if ( $page != sanitize_key( $page ) ) { if ( sanitize_key( $page ) != $page ) {
wp_die( 0 ); wp_die( 0 );
} }
@ -1751,7 +1751,7 @@ function wp_ajax_hidden_columns() {
check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' ); check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
$page = isset( $_POST['page'] ) ? $_POST['page'] : ''; $page = isset( $_POST['page'] ) ? $_POST['page'] : '';
if ( $page != sanitize_key( $page ) ) { if ( sanitize_key( $page ) != $page ) {
wp_die( 0 ); wp_die( 0 );
} }
@ -1900,13 +1900,13 @@ function wp_ajax_meta_box_order() {
$order = isset( $_POST['order'] ) ? (array) $_POST['order'] : false; $order = isset( $_POST['order'] ) ? (array) $_POST['order'] : false;
$page_columns = isset( $_POST['page_columns'] ) ? $_POST['page_columns'] : 'auto'; $page_columns = isset( $_POST['page_columns'] ) ? $_POST['page_columns'] : 'auto';
if ( $page_columns != 'auto' ) { if ( 'auto' !== $page_columns ) {
$page_columns = (int) $page_columns; $page_columns = (int) $page_columns;
} }
$page = isset( $_POST['page'] ) ? $_POST['page'] : ''; $page = isset( $_POST['page'] ) ? $_POST['page'] : '';
if ( $page != sanitize_key( $page ) ) { if ( sanitize_key( $page ) != $page ) {
wp_die( 0 ); wp_die( 0 );
} }
@ -2003,7 +2003,7 @@ function wp_ajax_inline_save() {
/* translators: %s: User's display name. */ /* translators: %s: User's display name. */
$msg_template = __( 'Saving is disabled: %s is currently editing this post.' ); $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. */ /* translators: %s: User's display name. */
$msg_template = __( 'Saving is disabled: %s is currently editing this page.' ); $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'] ) ); $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; $level = 0;
if ( is_post_type_hierarchical( $wp_list_table->screen->post_type ) ) { 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" ); check_ajax_referer( "set_post_thumbnail-$post_ID" );
} }
if ( $thumbnail_id == '-1' ) { if ( '-1' == $thumbnail_id ) {
if ( delete_post_thumbnail( $post_ID ) ) { if ( delete_post_thumbnail( $post_ID ) ) {
$return = _wp_post_thumbnail_html( null, $post_ID ); $return = _wp_post_thumbnail_html( null, $post_ID );
$json ? wp_send_json_success( $return ) : wp_die( $return ); $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'] ) ); $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 ); wp_die( 0 );
} }
@ -2844,7 +2844,7 @@ function wp_ajax_wp_remove_post_lock() {
function wp_ajax_dismiss_wp_pointer() { function wp_ajax_dismiss_wp_pointer() {
$pointer = $_POST['pointer']; $pointer = $_POST['pointer'];
if ( $pointer != sanitize_key( $pointer ) ) { if ( sanitize_key( $pointer ) != $pointer ) {
wp_die( 0 ); wp_die( 0 );
} }
@ -3022,7 +3022,7 @@ function wp_ajax_save_attachment() {
if ( isset( $changes['alt'] ) ) { if ( isset( $changes['alt'] ) ) {
$alt = wp_unslash( $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 ); $alt = wp_strip_all_tags( $alt, true );
update_post_meta( $id, '_wp_attachment_image_alt', wp_slash( $alt ) ); 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 ); $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() ); $sessions->destroy_others( wp_get_session_token() );
$message = __( 'You are now logged out everywhere else.' ); $message = __( 'You are now logged out everywhere else.' );
} else { } else {

View File

@ -78,7 +78,7 @@ class Core_Upgrader extends WP_Upgrader {
$this->upgrade_strings(); $this->upgrade_strings();
// Is an update available? // 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'] ); return new WP_Error( 'up_to_date', $this->strings['up_to_date'] );
} }

View File

@ -812,7 +812,7 @@ endif;
// If flexible height isn't supported and the image is the exact right size. // 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' ) 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. // Add the metadata.
if ( file_exists( $file ) ) { if ( file_exists( $file ) ) {
wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );

View File

@ -89,19 +89,19 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
unset( $install_actions['activate_plugin'] ); unset( $install_actions['activate_plugin'] );
} }
if ( 'import' == $from ) { if ( 'import' === $from ) {
$install_actions['importers_page'] = sprintf( $install_actions['importers_page'] = sprintf(
'<a href="%s" target="_parent">%s</a>', '<a href="%s" target="_parent">%s</a>',
admin_url( 'import.php' ), admin_url( 'import.php' ),
__( 'Return to Importers' ) __( 'Return to Importers' )
); );
} elseif ( $this->type == 'web' ) { } elseif ( 'web' === $this->type ) {
$install_actions['plugins_page'] = sprintf( $install_actions['plugins_page'] = sprintf(
'<a href="%s" target="_parent">%s</a>', '<a href="%s" target="_parent">%s</a>',
self_admin_url( 'plugin-install.php' ), self_admin_url( 'plugin-install.php' ),
__( 'Return to Plugin Installer' ) __( 'Return to Plugin Installer' )
); );
} elseif ( 'upload' == $this->type && 'plugins' == $from ) { } elseif ( 'upload' === $this->type && 'plugins' === $from ) {
$install_actions['plugins_page'] = sprintf( $install_actions['plugins_page'] = sprintf(
'<a href="%s">%s</a>', '<a href="%s">%s</a>',
self_admin_url( 'plugin-install.php' ), self_admin_url( 'plugin-install.php' ),

View File

@ -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( $install_actions['themes_page'] = sprintf(
'<a href="%s" target="_parent">%s</a>', '<a href="%s" target="_parent">%s</a>',
self_admin_url( 'theme-install.php' ), self_admin_url( 'theme-install.php' ),

View File

@ -367,7 +367,7 @@ class Theme_Upgrader extends WP_Upgrader {
*/ */
$maintenance = ( is_multisite() && ! empty( $themes ) ); $maintenance = ( is_multisite() && ! empty( $themes ) );
foreach ( $themes as $theme ) { foreach ( $themes as $theme ) {
$maintenance = $maintenance || $theme == get_stylesheet() || $theme == get_template(); $maintenance = $maintenance || get_stylesheet() === $theme || get_template() === $theme;
} }
if ( $maintenance ) { if ( $maintenance ) {
$this->maintenance_mode( true ); $this->maintenance_mode( true );
@ -539,7 +539,7 @@ class Theme_Upgrader extends WP_Upgrader {
$theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; $theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
if ( $theme != get_stylesheet() ) { // If not current. if ( get_stylesheet() !== $theme ) { // If not current.
return $return; return $return;
} }
@ -570,12 +570,12 @@ class Theme_Upgrader extends WP_Upgrader {
$theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; $theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
if ( $theme != get_stylesheet() ) { // If not current. if ( get_stylesheet() !== $theme ) { // If not current.
return $return; return $return;
} }
// Ensure stylesheet name hasn't changed after the upgrade: // 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(); wp_clean_themes_cache();
$stylesheet = $this->result['destination_name']; $stylesheet = $this->result['destination_name'];
switch_theme( $stylesheet ); switch_theme( $stylesheet );

View File

@ -75,7 +75,7 @@ class Walker_Category_Checklist extends Walker {
$taxonomy = $args['taxonomy']; $taxonomy = $args['taxonomy'];
} }
if ( $taxonomy == 'category' ) { if ( 'category' === $taxonomy ) {
$name = 'post_category'; $name = 'post_category';
} else { } else {
$name = 'tax_input[' . $taxonomy . ']'; $name = 'tax_input[' . $taxonomy . ']';

View File

@ -73,7 +73,7 @@ class WP_Automatic_Updater {
*/ */
public function is_vcs_checkout( $context ) { public function is_vcs_checkout( $context ) {
$context_dirs = array( untrailingslashit( $context ) ); $context_dirs = array( untrailingslashit( $context ) );
if ( $context !== ABSPATH ) { if ( ABSPATH !== $context ) {
$context_dirs[] = untrailingslashit( ABSPATH ); $context_dirs[] = untrailingslashit( ABSPATH );
} }
@ -86,7 +86,7 @@ class WP_Automatic_Updater {
$check_dirs[] = $context_dir; $check_dirs[] = $context_dir;
// Once we've hit '/' or 'C:\', we need to stop. dirname will keep returning the input here. // 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; break;
} }
@ -227,7 +227,7 @@ class WP_Automatic_Updater {
$notified = get_site_option( 'auto_core_update_notified' ); $notified = get_site_option( 'auto_core_update_notified' );
// Don't notify if we've already notified the same email address of the same version. // 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; 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. // 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. // We should not try to perform a background update again until there is a successful one-click update performed by the user.
$critical = false; $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; $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. // A rollback is only critical if it failed too.
$critical = true; $critical = true;
$rollback_result = $result->get_error_data()->rollback; $rollback_result = $result->get_error_data()->rollback;
@ -584,7 +584,7 @@ class WP_Automatic_Updater {
$n = get_site_option( 'auto_core_update_notified' ); $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. // 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; $send = false;
} }
@ -762,7 +762,7 @@ class WP_Automatic_Updater {
} }
// Updates are important! // 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.' ); $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 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\n" . __( 'You also have some plugins or themes with updates available. Update them now:' );
$body .= "\n" . network_admin_url(); $body .= "\n" . network_admin_url();
} }

View File

@ -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. // Reply and quickedit need a hide-if-no-js span when not added with ajax.
if ( ( 'reply' === $action || 'quickedit' === $action ) && ! wp_doing_ajax() ) { if ( ( 'reply' === $action || 'quickedit' === $action ) && ! wp_doing_ajax() ) {
$action .= ' hide-if-no-js'; $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 ) ) { if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) ) {
$action .= ' approve'; $action .= ' approve';
} else { } else {

View File

@ -471,10 +471,10 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
* @return bool True on success, false on failure. * @return bool True on success, false on failure.
*/ */
public function touch( $file, $time = 0, $atime = 0 ) { public function touch( $file, $time = 0, $atime = 0 ) {
if ( $time == 0 ) { if ( 0 == $time ) {
$time = time(); $time = time();
} }
if ( $atime == 0 ) { if ( 0 == $atime ) {
$atime = time(); $atime = time();
} }
return touch( $file, $time, $atime ); return touch( $file, $time, $atime );

View File

@ -574,7 +574,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
} else { } else {
$lucifer[3] += 1900; // 4-digit year fix. $lucifer[3] += 1900; // 4-digit year fix.
} }
$b['isdir'] = ( $lucifer[7] == '<DIR>' ); $b['isdir'] = ( '<DIR>' === $lucifer[7] );
if ( $b['isdir'] ) { if ( $b['isdir'] ) {
$b['type'] = 'd'; $b['type'] = 'd';
} else { } else {
@ -598,8 +598,8 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
return ''; return '';
} }
$b = array(); $b = array();
$b['isdir'] = $lucifer[0][0] === 'd'; $b['isdir'] = 'd' === $lucifer[0][0];
$b['islink'] = $lucifer[0][0] === 'l'; $b['islink'] = 'l' === $lucifer[0][0];
if ( $b['isdir'] ) { if ( $b['isdir'] ) {
$b['type'] = 'd'; $b['type'] = 'd';
} elseif ( $b['islink'] ) { } elseif ( $b['islink'] ) {
@ -613,7 +613,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
$b['owner'] = $lucifer[2]; $b['owner'] = $lucifer[2];
$b['group'] = $lucifer[3]; $b['group'] = $lucifer[3];
$b['size'] = $lucifer[4]; $b['size'] = $lucifer[4];
if ( $lcount == 8 ) { if ( 8 == $lcount ) {
sscanf( $lucifer[5], '%d-%d-%d', $b['year'], $b['month'], $b['day'] ); sscanf( $lucifer[5], '%d-%d-%d', $b['year'], $b['month'], $b['day'] );
sscanf( $lucifer[6], '%d:%d', $b['hour'], $b['minute'] ); sscanf( $lucifer[6], '%d:%d', $b['hour'], $b['minute'] );
$b['time'] = mktime( $b['hour'], $b['minute'], 0, $b['month'], $b['day'], $b['year'] ); $b['time'] = mktime( $b['hour'], $b['minute'], 0, $b['month'], $b['day'], $b['year'] );

View File

@ -202,7 +202,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
mbstring_binary_safe_encoding(); mbstring_binary_safe_encoding();
$bytes_written = fwrite( $temphandle, $contents ); $bytes_written = fwrite( $temphandle, $contents );
if ( false === $bytes_written || $bytes_written != strlen( $contents ) ) { if ( false === $bytes_written || strlen( $contents ) != $bytes_written ) {
fclose( $temphandle ); fclose( $temphandle );
unlink( $temp ); unlink( $temp );

View File

@ -238,7 +238,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
fclose( $stream ); fclose( $stream );
if ( $returnbool ) { if ( $returnbool ) {
return ( $data === false ) ? false : '' != trim( $data ); return ( false === $data ) ? false : '' != trim( $data );
} else { } else {
return $data; return $data;
} }
@ -285,7 +285,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
public function put_contents( $file, $contents, $mode = false ) { public function put_contents( $file, $contents, $mode = false ) {
$ret = file_put_contents( $this->sftp_path( $file ), $contents ); $ret = file_put_contents( $this->sftp_path( $file ), $contents );
if ( $ret !== strlen( $contents ) ) { if ( strlen( $contents ) !== $ret ) {
return false; return false;
} }

View File

@ -312,7 +312,7 @@ function get_cli_args( $param, $required = false ) {
} }
$last_arg = $key; $last_arg = $key;
} elseif ( $last_arg !== null ) { } elseif ( null !== $last_arg ) {
$out[ $last_arg ] = $args[ $i ]; $out[ $last_arg ] = $args[ $i ];
} }
} }

View File

@ -830,18 +830,18 @@ class WP_List_Table {
$disable_prev = false; $disable_prev = false;
$disable_next = false; $disable_next = false;
if ( $current == 1 ) { if ( 1 == $current ) {
$disable_first = true; $disable_first = true;
$disable_prev = true; $disable_prev = true;
} }
if ( $current == 2 ) { if ( 2 == $current ) {
$disable_first = true; $disable_first = true;
} }
if ( $current == $total_pages ) { if ( $total_pages == $current ) {
$disable_last = true; $disable_last = true;
$disable_next = true; $disable_next = true;
} }
if ( $current == $total_pages - 1 ) { if ( $total_pages - 1 == $current ) {
$disable_last = true; $disable_last = true;
} }

View File

@ -626,8 +626,8 @@ class WP_Media_List_Table extends WP_List_Table {
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
if ( if (
( $this->is_trash && $post->post_status != 'trash' ) ( $this->is_trash && 'trash' !== $post->post_status )
|| ( ! $this->is_trash && $post->post_status === 'trash' ) || ( ! $this->is_trash && 'trash' === $post->post_status )
) { ) {
continue; continue;
} }

View File

@ -70,7 +70,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
global $s, $mode, $wpdb; global $s, $mode, $wpdb;
if ( ! empty( $_REQUEST['mode'] ) ) { if ( ! empty( $_REQUEST['mode'] ) ) {
$mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list'; $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list';
set_user_setting( 'sites_list_mode', $mode ); set_user_setting( 'sites_list_mode', $mode );
} else { } else {
$mode = get_user_setting( 'sites_list_mode', 'list' ); $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'; $url = 'sites.php';
foreach ( $statuses as $status => $label_count ) { 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"' ? ' class="current" aria-current="page"'
: ''; : '';
if ( (int) $counts[ $status ] > 0 ) { 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' ); $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' ); $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 '&#x2014;'; echo '&#x2014;';
} else { } else {
echo mysql2date( $date, $blog['registered'] ); echo mysql2date( $date, $blog['registered'] );
@ -585,7 +585,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
reset( $this->status_list ); reset( $this->status_list );
foreach ( $this->status_list as $status => $col ) { foreach ( $this->status_list as $status => $col ) {
if ( $blog[ $status ] == 1 ) { if ( 1 == $blog[ $status ] ) {
$class = " class='{$col[0]}'"; $class = " class='{$col[0]}'";
} }
} }
@ -693,19 +693,19 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
$actions['edit'] = '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a>'; $actions['edit'] = '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a>';
$actions['backend'] = "<a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a>'; $actions['backend'] = "<a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a>';
if ( get_network()->site_id != $blog['blog_id'] ) { if ( get_network()->site_id != $blog['blog_id'] ) {
if ( $blog['deleted'] == '1' ) { if ( '1' == $blog['deleted'] ) {
$actions['activate'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=activateblog&amp;id=' . $blog['blog_id'] ), 'activateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Activate' ) . '</a>'; $actions['activate'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=activateblog&amp;id=' . $blog['blog_id'] ), 'activateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Activate' ) . '</a>';
} else { } else {
$actions['deactivate'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deactivateblog&amp;id=' . $blog['blog_id'] ), 'deactivateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Deactivate' ) . '</a>'; $actions['deactivate'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deactivateblog&amp;id=' . $blog['blog_id'] ), 'deactivateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Deactivate' ) . '</a>';
} }
if ( $blog['archived'] == '1' ) { if ( '1' == $blog['archived'] ) {
$actions['unarchive'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] ), 'unarchiveblog_' . $blog['blog_id'] ) ) . '">' . __( 'Unarchive' ) . '</a>'; $actions['unarchive'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] ), 'unarchiveblog_' . $blog['blog_id'] ) ) . '">' . __( 'Unarchive' ) . '</a>';
} else { } else {
$actions['archive'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] ), 'archiveblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a>'; $actions['archive'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] ), 'archiveblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a>';
} }
if ( $blog['spam'] == '1' ) { if ( '1' == $blog['spam'] ) {
$actions['unspam'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] ), 'unspamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a>'; $actions['unspam'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] ), 'unspamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a>';
} else { } else {
$actions['spam'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] ), 'spamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Spam', 'site' ) . '</a>'; $actions['spam'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] ), 'spamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Spam', 'site' ) . '</a>';

View File

@ -166,7 +166,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
$orderby = ucfirst( $orderby ); $orderby = ucfirst( $orderby );
$order = strtoupper( $order ); $order = strtoupper( $order );
if ( $orderby === 'Name' ) { if ( 'Name' === $orderby ) {
if ( 'ASC' === $order ) { if ( 'ASC' === $order ) {
$this->items = array_reverse( $this->items ); $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( $url = add_query_arg(
array( array(
'action' => 'delete-selected', 'action' => 'delete-selected',
@ -580,7 +580,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
public function column_description( $theme ) { public function column_description( $theme ) {
global $status, $totals; global $status, $totals;
if ( $theme->errors() ) { if ( $theme->errors() ) {
$pre = $status === 'broken' ? __( 'Broken Theme:' ) . ' ' : ''; $pre = 'broken' === $status ? __( 'Broken Theme:' ) . ' ' : '';
echo '<p><strong class="error-message">' . $pre . $theme->errors()->get_error_message() . '</strong></p>'; echo '<p><strong class="error-message">' . $pre . $theme->errors()->get_error_message() . '</strong></p>';
} }

View File

@ -54,7 +54,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
$args['search'] = '*' . $args['search'] . '*'; $args['search'] = '*' . $args['search'] . '*';
} }
if ( $role === 'super' ) { if ( 'super' === $role ) {
$args['login__in'] = get_super_admins(); $args['login__in'] = get_super_admins();
} }
@ -84,7 +84,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
} }
if ( ! empty( $_REQUEST['mode'] ) ) { if ( ! empty( $_REQUEST['mode'] ) ) {
$mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list'; $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list';
set_user_setting( 'network_users_list_mode', $mode ); set_user_setting( 'network_users_list_mode', $mode );
} else { } else {
$mode = get_user_setting( 'network_users_list_mode', 'list' ); $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(); $super_admins = get_super_admins();
$total_admins = count( $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 = array();
$role_links['all'] = sprintf( $role_links['all'] = sprintf(
'<a href="%s"%s>%s</a>', '<a href="%s"%s>%s</a>',
@ -154,7 +154,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
number_format_i18n( $total_users ) 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( $role_links['super'] = sprintf(
'<a href="%s"%s>%s</a>', '<a href="%s"%s>%s</a>',
network_admin_url( 'users.php?role=super' ), network_admin_url( 'users.php?role=super' ),
@ -371,7 +371,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
continue; continue;
} }
$path = ( $val->path === '/' ) ? '' : $val->path; $path = ( '/' === $val->path ) ? '' : $val->path;
$site_classes = array( 'site-' . $val->site_id ); $site_classes = array( 'site-' . $val->site_id );
/** /**
* Filters the span class for a site listing on the mulisite user list table. * 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'] = '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) . '">' . __( 'Edit' ) . '</a>'; $actions['edit'] = '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) . '">' . __( 'Edit' ) . '</a>';
$class = ''; $class = '';
if ( $val->spam == 1 ) { if ( 1 == $val->spam ) {
$class .= 'site-spammed '; $class .= 'site-spammed ';
} }
if ( $val->mature == 1 ) { if ( 1 == $val->mature ) {
$class .= 'site-mature '; $class .= 'site-mature ';
} }
if ( $val->deleted == 1 ) { if ( 1 == $val->deleted ) {
$class .= 'site-deleted '; $class .= 'site-deleted ';
} }
if ( $val->archived == 1 ) { if ( 1 == $val->archived ) {
$class .= 'site-archived '; $class .= 'site-archived ';
} }

View File

@ -101,7 +101,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
if ( 'search' === $tab ) { if ( 'search' === $tab ) {
$tabs['search'] = __( 'Search Results' ); $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['beta'] = _x( 'Beta Testing', 'Plugin Installer' );
} }
$tabs['featured'] = _x( 'Featured', '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 * @param string $which
*/ */
protected function display_tablenav( $which ) { protected function display_tablenav( $which ) {
if ( $GLOBALS['tab'] === 'featured' ) { if ( 'featured' === $GLOBALS['tab'] ) {
return; return;
} }

View File

@ -165,7 +165,7 @@ class WP_Posts_List_Table extends WP_List_Table {
$total_items = $post_counts[ $_REQUEST['post_status'] ]; $total_items = $post_counts[ $_REQUEST['post_status'] ];
} elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) { } elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) {
$total_items = $this->sticky_posts_count; $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; $total_items = $this->user_posts_count;
} else { } else {
$total_items = array_sum( $post_counts ); $total_items = array_sum( $post_counts );
@ -178,13 +178,13 @@ class WP_Posts_List_Table extends WP_List_Table {
} }
if ( ! empty( $_REQUEST['mode'] ) ) { if ( ! empty( $_REQUEST['mode'] ) ) {
$mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list'; $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list';
set_user_setting( 'posts_list_mode', $mode ); set_user_setting( 'posts_list_mode', $mode );
} else { } else {
$mode = get_user_setting( 'posts_list_mode', 'list' ); $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( $this->set_pagination_args(
array( array(
@ -993,7 +993,7 @@ class WP_Posts_List_Table extends WP_List_Table {
$can_edit_post = current_user_can( 'edit_post', $post->ID ); $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 ); $lock_holder = wp_check_post_lock( $post->ID );
if ( $lock_holder ) { if ( $lock_holder ) {
@ -1014,7 +1014,7 @@ class WP_Posts_List_Table extends WP_List_Table {
$title = _draft_or_post_title(); $title = _draft_or_post_title();
if ( $can_edit_post && $post->post_status != 'trash' ) { if ( $can_edit_post && 'trash' !== $post->post_status ) {
printf( printf(
'<a class="row-title" href="%s" aria-label="%s">%s%s</a>', '<a class="row-title" href="%s" aria-label="%s">%s%s</a>',
get_edit_post_link( $post->ID ), get_edit_post_link( $post->ID ),
@ -1633,7 +1633,7 @@ class WP_Posts_List_Table extends WP_List_Table {
<?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?> <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
<span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ); ?></span> <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ); ?></span>
<input type="hidden" name="<?php echo ( $taxonomy->name === 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" /> <input type="hidden" name="<?php echo ( 'category' === $taxonomy->name ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
<ul class="cat-checklist <?php echo esc_attr( $taxonomy->name ); ?>-checklist"> <ul class="cat-checklist <?php echo esc_attr( $taxonomy->name ); ?>-checklist">
<?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ); ?> <?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ); ?>
</ul> </ul>

View File

@ -373,7 +373,7 @@ final class WP_Screen {
if ( isset( self::$_registry[ $id ] ) ) { if ( isset( self::$_registry[ $id ] ) ) {
$screen = self::$_registry[ $id ]; $screen = self::$_registry[ $id ];
if ( $screen === get_current_screen() ) { if ( get_current_screen() === $screen ) {
return $screen; return $screen;
} }
} else { } else {
@ -454,7 +454,7 @@ final class WP_Screen {
* @return bool True if the block editor is being loaded, false otherwise. * @return bool True if the block editor is being loaded, false otherwise.
*/ */
public function is_block_editor( $set = null ) { public function is_block_editor( $set = null ) {
if ( $set !== null ) { if ( null !== $set ) {
$this->is_block_editor = (bool) $set; $this->is_block_editor = (bool) $set;
} }

View File

@ -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. $last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID.
if ( $last_post_id ) { if ( $last_post_id ) {
$post = get_post( $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 ); $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. update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID.
} else { } else {

View File

@ -168,7 +168,7 @@ function export_wp( $args = array() ) {
// Put categories in order with no child going before its parent. // Put categories in order with no child going before its parent.
while ( $cat = array_shift( $categories ) ) { 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; $cats[ $cat->term_id ] = $cat;
} else { } else {
$categories[] = $cat; $categories[] = $cat;
@ -177,7 +177,7 @@ function export_wp( $args = array() ) {
// Put terms in order with no child going before its parent. // Put terms in order with no child going before its parent.
while ( $t = array_shift( $custom_terms ) ) { 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; $terms[ $t->term_id ] = $t;
} else { } else {
$custom_terms[] = $t; $custom_terms[] = $t;
@ -585,7 +585,7 @@ function export_wp( $args = array() ) {
<wp:post_type><?php echo wxr_cdata( $post->post_type ); ?></wp:post_type> <wp:post_type><?php echo wxr_cdata( $post->post_type ); ?></wp:post_type>
<wp:post_password><?php echo wxr_cdata( $post->post_password ); ?></wp:post_password> <wp:post_password><?php echo wxr_cdata( $post->post_password ); ?></wp:post_password>
<wp:is_sticky><?php echo intval( $is_sticky ); ?></wp:is_sticky> <wp:is_sticky><?php echo intval( $is_sticky ); ?></wp:is_sticky>
<?php if ( $post->post_type == 'attachment' ) : ?> <?php if ( 'attachment' === $post->post_type ) : ?>
<wp:attachment_url><?php echo wxr_cdata( wp_get_attachment_url( $post->ID ) ); ?></wp:attachment_url> <wp:attachment_url><?php echo wxr_cdata( wp_get_attachment_url( $post->ID ) ); ?></wp:attachment_url>
<?php endif; ?> <?php endif; ?>
<?php wxr_post_taxonomy(); ?> <?php wxr_post_taxonomy(); ?>

View File

@ -1886,7 +1886,7 @@ function get_filesystem_method( $args = array(), $context = '', $allow_relaxed_f
$temp_file_owner = @fileowner( $temp_file_name ); $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, * WordPress is creating files as the same owner as the WordPress files,
* this means it's safe to modify & create new files via PHP. * 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(); ob_start();
$filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() ); $filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() );
ob_end_clean(); 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 ) { if ( ! $request_filesystem_credentials ) {
return; return;
} }

View File

@ -33,7 +33,7 @@ function wp_image_editor( $post_id, $msg = false ) {
$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true ); $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
$can_restore = false; $can_restore = false;
if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) ) { 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 ) { if ( $msg ) {
@ -576,7 +576,7 @@ function image_edit_apply_changes( $image, $changes ) {
foreach ( $changes as $operation ) { foreach ( $changes as $operation ) {
switch ( $operation->type ) { switch ( $operation->type ) {
case 'rotate': case 'rotate':
if ( $operation->angle != 0 ) { if ( 0 != $operation->angle ) {
if ( $image instanceof WP_Image_Editor ) { if ( $image instanceof WP_Image_Editor ) {
$image->rotate( $operation->angle ); $image->rotate( $operation->angle );
} else { } else {
@ -585,7 +585,7 @@ function image_edit_apply_changes( $image, $changes ) {
} }
break; break;
case 'flip': case 'flip':
if ( $operation->axis != 0 ) { if ( 0 != $operation->axis ) {
if ( $image instanceof WP_Image_Editor ) { if ( $image instanceof WP_Image_Editor ) {
$image->flip( ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 ); $image->flip( ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 );
} else { } else {
@ -954,7 +954,7 @@ function wp_save_image( $post_id ) {
wp_update_attachment_metadata( $post_id, $meta ); wp_update_attachment_metadata( $post_id, $meta );
update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes ); 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. // Check if it's an image edit from attachment edit screen.
if ( ! empty( $_REQUEST['context'] ) && 'edit-attachment' == $_REQUEST['context'] ) { if ( ! empty( $_REQUEST['context'] ) && 'edit-attachment' == $_REQUEST['context'] ) {
$thumb_url = wp_get_attachment_image_src( $post_id, array( 900, 600 ), true ); $thumb_url = wp_get_attachment_image_src( $post_id, array( 900, 600 ), true );

View File

@ -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. // 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. * Filters the "BIG image" threshold value.
@ -310,7 +310,7 @@ function wp_create_image_subsizes( $file, $attachment_id ) {
} else { } else {
// TODO: Log errors. // 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. // Rotate the whole original image if there is EXIF data and "orientation" is not 1.
$editor = wp_get_image_editor( $file ); $editor = wp_get_image_editor( $file );

View File

@ -176,7 +176,7 @@ function wp_get_popular_importers() {
foreach ( $popular_importers['importers'] as &$importer ) { foreach ( $popular_importers['importers'] as &$importer ) {
// phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText
$importer['description'] = translate( $importer['description'] ); $importer['description'] = translate( $importer['description'] );
if ( $importer['name'] != 'WordPress' ) { if ( 'WordPress' !== $importer['name'] ) {
// phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText
$importer['name'] = translate( $importer['name'] ); $importer['name'] = translate( $importer['name'] );
} }

View File

@ -635,7 +635,7 @@ function media_buttons( $editor_id = 'content' ) {
$img = '<span class="wp-media-buttons-icon"></span> '; $img = '<span class="wp-media-buttons-icon"></span> ';
$id_attribute = $instance === 1 ? ' id="insert-media-button"' : ''; $id_attribute = 1 === $instance ? ' id="insert-media-button"' : '';
printf( printf(
'<button type="button"%s class="button insert-media add_media" data-editor="%s">%s</button>', '<button type="button"%s class="button insert-media add_media" data-editor="%s">%s</button>',
@ -767,7 +767,7 @@ function media_upload_form_handler() {
if ( isset( $attachment['image_alt'] ) ) { if ( isset( $attachment['image_alt'] ) ) {
$image_alt = wp_unslash( $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 ); $image_alt = wp_strip_all_tags( $image_alt, true );
// update_post_meta() expects slashed. // 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'; $type = 'image';
if ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'video', 'audio', 'file' ) ) ) { 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'] ); @unlink( $file_array['tmp_name'] );
return $id; return $id;
// If attachment id was requested, return it early. // If attachment id was requested, return it early.
} elseif ( $return === 'id' ) { } elseif ( 'id' === $return ) {
return $id; 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. // Finally, check to make sure the file has been saved, then return the HTML.
if ( ! empty( $src ) ) { if ( ! empty( $src ) ) {
if ( $return === 'src' ) { if ( 'src' === $return ) {
return $src; return $src;
} }
@ -1211,9 +1211,9 @@ function image_link_input_fields( $post, $url_type = '' ) {
$url = ''; $url = '';
if ( $url_type == 'file' ) { if ( 'file' === $url_type ) {
$url = $file; $url = $file;
} elseif ( $url_type == 'post' ) { } elseif ( 'post' === $url_type ) {
$url = $link; $url = $link;
} }
@ -1324,7 +1324,7 @@ function image_media_send_to_editor( $html, $attachment_id, $attachment ) {
$align = ! empty( $attachment['align'] ) ? $attachment['align'] : 'none'; $align = ! empty( $attachment['align'] ) ? $attachment['align'] : 'none';
$size = ! empty( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium'; $size = ! empty( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium';
$alt = ! empty( $attachment['image_alt'] ) ? $attachment['image_alt'] : ''; $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 ); 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 ) { if ( $post_id ) {
$post = get_post( $post_id ); $post = get_post( $post_id );
if ( $post && $post->post_type == 'attachment' ) { if ( $post && 'attachment' === $post->post_type ) {
$attachments = array( $post->ID => $post ); $attachments = array( $post->ID => $post );
} else { } else {
$attachments = get_children( $attachments = get_children(
@ -1513,7 +1513,7 @@ function get_media_items( $post_id, $errors ) {
$output = ''; $output = '';
foreach ( (array) $attachments as $id => $attachment ) { foreach ( (array) $attachments as $id => $attachment ) {
if ( $attachment->post_status == 'trash' ) { if ( 'trash' === $attachment->post_status ) {
continue; continue;
} }
@ -1735,7 +1735,7 @@ function get_media_item( $attachment_id, $args = null ) {
$hidden_fields = array(); $hidden_fields = array();
foreach ( $form_fields as $id => $field ) { foreach ( $form_fields as $id => $field ) {
if ( $id[0] == '_' ) { if ( '_' === $id[0] ) {
continue; continue;
} }
@ -1747,7 +1747,7 @@ function get_media_item( $attachment_id, $args = null ) {
$field = array_merge( $defaults, $field ); $field = array_merge( $defaults, $field );
$name = "attachments[$attachment_id][$id]"; $name = "attachments[$attachment_id][$id]";
if ( $field['input'] == 'hidden' ) { if ( 'hidden' === $field['input'] ) {
$hidden_fields[ $name ] = $field['value']; $hidden_fields[ $name ] = $field['value'];
continue; continue;
} }
@ -1761,7 +1761,7 @@ function get_media_item( $attachment_id, $args = null ) {
if ( ! empty( $field[ $field['input'] ] ) ) { if ( ! empty( $field[ $field['input'] ] ) ) {
$item .= $field[ $field['input'] ]; $item .= $field[ $field['input'] ];
} elseif ( $field['input'] == 'textarea' ) { } elseif ( 'textarea' === $field['input'] ) {
if ( 'post_content' == $id && user_can_richedit() ) { if ( 'post_content' == $id && user_can_richedit() ) {
// Sanitize_post() skips the post_content when user_can_richedit. // Sanitize_post() skips the post_content when user_can_richedit.
$field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES ); $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
@ -1919,7 +1919,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) {
$item = ''; $item = '';
foreach ( $form_fields as $id => $field ) { foreach ( $form_fields as $id => $field ) {
if ( $id[0] == '_' ) { if ( '_' === $id[0] ) {
continue; continue;
} }
@ -1937,7 +1937,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) {
continue; continue;
} }
if ( $field['input'] == 'hidden' ) { if ( 'hidden' === $field['input'] ) {
$hidden_fields[ $name ] = $field['value']; $hidden_fields[ $name ] = $field['value'];
continue; continue;
} }
@ -1954,7 +1954,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) {
if ( ! empty( $field[ $field['input'] ] ) ) { if ( ! empty( $field[ $field['input'] ] ) ) {
$item .= $field[ $field['input'] ]; $item .= $field[ $field['input'] ];
} elseif ( $field['input'] == 'textarea' ) { } elseif ( 'textarea' === $field['input'] ) {
if ( 'post_content' == $id && user_can_richedit() ) { if ( 'post_content' == $id && user_can_richedit() ) {
// sanitize_post() skips the post_content when user_can_richedit. // sanitize_post() skips the post_content when user_can_richedit.
$field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES ); $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
@ -2716,7 +2716,7 @@ function media_upload_library_form( $errors ) {
$_GET['post_mime_type'] = $type; $_GET['post_mime_type'] = $type;
list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query(); 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"'; $class = ' class="current"';
} else { } else {
$class = ''; $class = '';
@ -2800,7 +2800,7 @@ function media_upload_library_form( $errors ) {
<?php <?php
foreach ( $arc_result as $arc_row ) { foreach ( $arc_result as $arc_row ) {
if ( $arc_row->yyear == 0 ) { if ( 0 == $arc_row->yyear ) {
continue; continue;
} }
@ -2926,13 +2926,13 @@ function wp_media_insert_url_form( $default_view = 'image' ) {
<tr class="align image-only"> <tr class="align image-only">
<th scope="row" class="label"><p><label for="align">' . __( 'Alignment' ) . '</label></p></th> <th scope="row" class="label"><p><label for="align">' . __( 'Alignment' ) . '</label></p></th>
<td class="field"> <td class="field">
<input name="align" id="align-none" value="none" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( $default_align == 'none' ? ' checked="checked"' : '' ) . ' /> <input name="align" id="align-none" value="none" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( 'none' === $default_align ? ' checked="checked"' : '' ) . ' />
<label for="align-none" class="align image-align-none-label">' . __( 'None' ) . '</label> <label for="align-none" class="align image-align-none-label">' . __( 'None' ) . '</label>
<input name="align" id="align-left" value="left" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( $default_align == 'left' ? ' checked="checked"' : '' ) . ' /> <input name="align" id="align-left" value="left" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( 'left' === $default_align ? ' checked="checked"' : '' ) . ' />
<label for="align-left" class="align image-align-left-label">' . __( 'Left' ) . '</label> <label for="align-left" class="align image-align-left-label">' . __( 'Left' ) . '</label>
<input name="align" id="align-center" value="center" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( $default_align == 'center' ? ' checked="checked"' : '' ) . ' /> <input name="align" id="align-center" value="center" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( 'center' === $default_align ? ' checked="checked"' : '' ) . ' />
<label for="align-center" class="align image-align-center-label">' . __( 'Center' ) . '</label> <label for="align-center" class="align image-align-center-label">' . __( 'Center' ) . '</label>
<input name="align" id="align-right" value="right" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( $default_align == 'right' ? ' checked="checked"' : '' ) . ' /> <input name="align" id="align-right" value="right" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( 'right' === $default_align ? ' checked="checked"' : '' ) . ' />
<label for="align-right" class="align image-align-right-label">' . __( 'Right' ) . '</label> <label for="align-right" class="align image-align-right-label">' . __( 'Right' ) . '</label>
</td> </td>
</tr> </tr>
@ -3272,8 +3272,8 @@ function attachment_submitbox_metadata() {
if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $post->ID ), $matches ) ) { if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $post->ID ), $matches ) ) {
echo esc_html( strtoupper( $matches[1] ) ); echo esc_html( strtoupper( $matches[1] ) );
list( $mime_type ) = explode( '/', $post->post_mime_type ); list( $mime_type ) = explode( '/', $post->post_mime_type );
if ( $mime_type !== 'image' && ! empty( $meta['mime_type'] ) ) { if ( 'image' !== $mime_type && ! empty( $meta['mime_type'] ) ) {
if ( $meta['mime_type'] !== "$mime_type/" . strtolower( $matches[1] ) ) { if ( "$mime_type/" . strtolower( $matches[1] ) !== $meta['mime_type'] ) {
echo ' (' . $meta['mime_type'] . ')'; echo ' (' . $meta['mime_type'] . ')';
} }
} }
@ -3535,7 +3535,7 @@ function wp_read_video_metadata( $file ) {
if ( empty( $metadata['created_timestamp'] ) ) { if ( empty( $metadata['created_timestamp'] ) ) {
$created_timestamp = wp_get_media_creation_timestamp( $data ); $created_timestamp = wp_get_media_creation_timestamp( $data );
if ( $created_timestamp !== false ) { if ( false !== $created_timestamp ) {
$metadata['created_timestamp'] = $created_timestamp; $metadata['created_timestamp'] = $created_timestamp;
} }
} }

View File

@ -157,14 +157,14 @@ function post_submit_meta_box( $post, $args = array() ) {
<?php _e( 'Visibility:' ); ?> <span id="post-visibility-display"> <?php _e( 'Visibility:' ); ?> <span id="post-visibility-display">
<?php <?php
if ( 'private' == $post->post_status ) { if ( 'private' === $post->post_status ) {
$post->post_password = ''; $post->post_password = '';
$visibility = 'private'; $visibility = 'private';
$visibility_trans = __( 'Private' ); $visibility_trans = __( 'Private' );
} elseif ( ! empty( $post->post_password ) ) { } elseif ( ! empty( $post->post_password ) ) {
$visibility = 'password'; $visibility = 'password';
$visibility_trans = __( 'Password protected' ); $visibility_trans = __( 'Password protected' );
} elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) { } elseif ( 'post' === $post_type && is_sticky( $post->ID ) ) {
$visibility = 'public'; $visibility = 'public';
$visibility_trans = __( 'Public, Sticky' ); $visibility_trans = __( 'Public, Sticky' );
} else { } else {
@ -180,12 +180,12 @@ function post_submit_meta_box( $post, $args = array() ) {
<div id="post-visibility-select" class="hide-if-js"> <div id="post-visibility-select" class="hide-if-js">
<input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr( $post->post_password ); ?>" /> <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr( $post->post_password ); ?>" />
<?php if ( $post_type == 'post' ) : ?> <?php if ( 'post' === $post_type ) : ?>
<input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> />
<?php endif; ?> <?php endif; ?>
<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" /> <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e( 'Public' ); ?></label><br /> <input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e( 'Public' ); ?></label><br />
<?php if ( $post_type == 'post' && current_user_can( 'edit_others_posts' ) ) : ?> <?php if ( 'post' === $post_type && current_user_can( 'edit_others_posts' ) ) : ?>
<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span> <span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span>
<?php endif; ?> <?php endif; ?>
<input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e( 'Password protected' ); ?></label><br /> <input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e( 'Password protected' ); ?></label><br />
@ -263,7 +263,7 @@ endif;
</a> </a>
<fieldset id="timestampdiv" class="hide-if-js"> <fieldset id="timestampdiv" class="hide-if-js">
<legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend> <legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
<?php touch_time( ( $action === 'edit' ), 1 ); ?> <?php touch_time( ( 'edit' === $action ), 1 ); ?>
</fieldset> </fieldset>
</div><?php // /misc-pub-section ?> </div><?php // /misc-pub-section ?>
<?php endif; ?> <?php endif; ?>
@ -598,7 +598,7 @@ function post_categories_meta_box( $post, $box ) {
<div id="<?php echo $tax_name; ?>-all" class="tabs-panel"> <div id="<?php echo $tax_name; ?>-all" class="tabs-panel">
<?php <?php
$name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']'; $name = ( 'category' === $tax_name ) ? 'post_category' : 'tax_input[' . $tax_name . ']';
// Allows for an empty term set to be sent. 0 is an invalid term ID and will be ignored by empty() checks. // Allows for an empty term set to be sent. 0 is an invalid term ID and will be ignored by empty() checks.
echo "<input type='hidden' name='{$name}[]' value='0' />"; echo "<input type='hidden' name='{$name}[]' value='0' />";
?> ?>
@ -1148,13 +1148,13 @@ function link_target_meta_box( $link ) {
?> ?>
<fieldset><legend class="screen-reader-text"><span><?php _e( 'Target' ); ?></span></legend> <fieldset><legend class="screen-reader-text"><span><?php _e( 'Target' ); ?></span></legend>
<p><label for="link_target_blank" class="selectit"> <p><label for="link_target_blank" class="selectit">
<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ( $link->link_target == '_blank' ) ? 'checked="checked"' : '' ); ?> /> <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ( '_blank' === $link->link_target ) ? 'checked="checked"' : '' ); ?> />
<?php _e( '<code>_blank</code> &mdash; new window or tab.' ); ?></label></p> <?php _e( '<code>_blank</code> &mdash; new window or tab.' ); ?></label></p>
<p><label for="link_target_top" class="selectit"> <p><label for="link_target_top" class="selectit">
<input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ( $link->link_target == '_top' ) ? 'checked="checked"' : '' ); ?> /> <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ( '_top' === $link->link_target ) ? 'checked="checked"' : '' ); ?> />
<?php _e( '<code>_top</code> &mdash; current window or tab, with no frames.' ); ?></label></p> <?php _e( '<code>_top</code> &mdash; current window or tab, with no frames.' ); ?></label></p>
<p><label for="link_target_none" class="selectit"> <p><label for="link_target_none" class="selectit">
<input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ( $link->link_target == '' ) ? 'checked="checked"' : '' ); ?> /> <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ( '' === $link->link_target ) ? 'checked="checked"' : '' ); ?> />
<?php _e( '<code>_none</code> &mdash; same window or tab.' ); ?></label></p> <?php _e( '<code>_none</code> &mdash; same window or tab.' ); ?></label></p>
</fieldset> </fieldset>
<p><?php _e( 'Choose the target frame for your link.' ); ?></p> <p><?php _e( 'Choose the target frame for your link.' ); ?></p>

View File

@ -649,7 +649,7 @@ function set_screen_options() {
$option = $_POST['wp_screen_options']['option']; $option = $_POST['wp_screen_options']['option'];
$value = $_POST['wp_screen_options']['value']; $value = $_POST['wp_screen_options']['value'];
if ( $option != sanitize_key( $option ) ) { if ( sanitize_key( $option ) != $option ) {
return; return;
} }
@ -744,7 +744,7 @@ function iis7_rewrite_rule_exists( $filename ) {
} }
$xpath = new DOMXPath( $doc ); $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\')]' ); $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; return false;
} else { } else {
return true; return true;
@ -1289,7 +1289,7 @@ function wp_page_reload_on_back_button_js() {
* @param string $value The proposed new site admin email address. * @param string $value The proposed new site admin email address.
*/ */
function update_option_new_admin_email( $old_value, $value ) { 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; return;
} }

View File

@ -20,7 +20,7 @@ function check_upload_size( $file ) {
return $file; return $file;
} }
if ( $file['error'] != '0' ) { // There's already an error. if ( '0' != $file['error'] ) { // There's already an error.
return $file; return $file;
} }
@ -45,7 +45,7 @@ function check_upload_size( $file ) {
$file['error'] = __( 'You have used your space quota. Please delete files before uploading.' ); $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'] . ' <a href="javascript:history.go(-1)">' . __( 'Back' ) . '</a>' ); wp_die( $file['error'] . ' <a href="javascript:history.go(-1)">' . __( 'Back' ) . '</a>' );
} }
@ -548,7 +548,7 @@ function format_code_lang( $code = '' ) {
* if `$taxonomy` is 'category' or 'post_tag'. * if `$taxonomy` is 'category' or 'post_tag'.
*/ */
function sync_category_tag_slugs( $term, $taxonomy ) { 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 ) ) { if ( is_object( $term ) ) {
$term->slug = sanitize_title( $term->name ); $term->slug = sanitize_title( $term->name );
} else { } else {
@ -644,11 +644,11 @@ function mu_dropdown_languages( $lang_files = array(), $current = '' ) {
foreach ( (array) $lang_files as $val ) { foreach ( (array) $lang_files as $val ) {
$code_lang = basename( $val, '.mo' ); $code_lang = basename( $val, '.mo' );
if ( $code_lang == 'en_US' ) { // American English. if ( 'en_US' === $code_lang ) { // American English.
$flag = true; $flag = true;
$ae = __( 'American English' ); $ae = __( 'American English' );
$output[ $ae ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $ae . '</option>'; $output[ $ae ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $ae . '</option>';
} elseif ( $code_lang == 'en_GB' ) { // British English. } elseif ( 'en_GB' === $code_lang ) { // British English.
$flag = true; $flag = true;
$be = __( 'British English' ); $be = __( 'British English' );
$output[ $be ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $be . '</option>'; $output[ $be ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $be . '</option>';
@ -658,7 +658,7 @@ function mu_dropdown_languages( $lang_files = array(), $current = '' ) {
} }
} }
if ( $flag === false ) { // WordPress English. if ( false === $flag ) { // WordPress English.
$output[] = '<option value=""' . selected( $current, '', false ) . '>' . __( 'English' ) . '</option>'; $output[] = '<option value=""' . selected( $current, '', false ) . '>' . __( 'English' ) . '</option>';
} }
@ -725,10 +725,10 @@ function avoid_blog_page_permalink_collision( $data, $postarr ) {
if ( is_subdomain_install() ) { if ( is_subdomain_install() ) {
return $data; return $data;
} }
if ( $data['post_type'] != 'page' ) { if ( 'page' !== $data['post_type'] ) {
return $data; return $data;
} }
if ( ! isset( $data['post_name'] ) || $data['post_name'] == '' ) { if ( ! isset( $data['post_name'] ) || '' === $data['post_name'] ) {
return $data; return $data;
} }
if ( ! is_main_site() ) { if ( ! is_main_site() ) {
@ -813,7 +813,7 @@ function choose_primary_blog() {
* @return bool True if network can be edited, otherwise false. * @return bool True if network can be edited, otherwise false.
*/ */
function can_edit_network( $network_id ) { function can_edit_network( $network_id ) {
if ( $network_id == get_current_network_id() ) { if ( get_current_network_id() == $network_id ) {
$result = true; $result = true;
} else { } else {
$result = false; $result = false;
@ -873,7 +873,7 @@ function confirm_delete_users( $users ) {
<?php <?php
$allusers = (array) $_POST['allusers']; $allusers = (array) $_POST['allusers'];
foreach ( $allusers as $user_id ) { foreach ( $allusers as $user_id ) {
if ( $user_id != '' && $user_id != '0' ) { if ( '' != $user_id && '0' != $user_id ) {
$delete_user = get_userdata( $user_id ); $delete_user = get_userdata( $user_id );
if ( ! current_user_can( 'delete_user', $delete_user->ID ) ) { if ( ! current_user_can( 'delete_user', $delete_user->ID ) ) {

View File

@ -1266,7 +1266,7 @@ function _wp_expand_nav_menu_post_data() {
// Build the new array value from leaf to trunk. // Build the new array value from leaf to trunk.
for ( $i = count( $array_bits ) - 1; $i >= 0; $i-- ) { 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 ); $new_post_data[ $array_bits[ $i ] ] = wp_slash( $post_input_data->value );
} else { } else {
$new_post_data = array( $array_bits[ $i ] => $new_post_data ); $new_post_data = array( $array_bits[ $i ] => $new_post_data );

View File

@ -1834,7 +1834,7 @@ function get_admin_page_parent( $parent = '' ) {
return $parent; return $parent;
} }
if ( $pagenow == 'admin.php' && isset( $plugin_page ) ) { if ( 'admin.php' === $pagenow && isset( $plugin_page ) ) {
foreach ( (array) $menu as $parent_menu ) { foreach ( (array) $menu as $parent_menu ) {
if ( $parent_menu[2] == $plugin_page ) { if ( $parent_menu[2] == $plugin_page ) {
$parent_file = $plugin_page; $parent_file = $plugin_page;
@ -1866,7 +1866,7 @@ function get_admin_page_parent( $parent = '' ) {
if ( isset( $_wp_real_parent_file[ $parent ] ) ) { if ( isset( $_wp_real_parent_file[ $parent ] ) ) {
$parent = $_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; $parent_file = $parent;
return $parent; return $parent;
} elseif ( $submenu_array[2] == $pagenow && empty( $typenow ) && ( empty( $parent_file ) || false === strpos( $parent_file, '?' ) ) ) { } 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 == $pagenow ) ||
( $parent == $plugin_page ) || ( $parent == $plugin_page ) ||
( $plugin_page == $hook ) || ( $plugin_page == $hook ) ||
( $pagenow == 'admin.php' && $parent1 != $submenu_array[2] ) || ( 'admin.php' === $pagenow && $parent1 != $submenu_array[2] ) ||
( ! empty( $typenow ) && $parent == $pagenow . '?post_type=' . $typenow ) ( ! empty( $typenow ) && $parent == $pagenow . '?post_type=' . $typenow )
) )
) { ) {
@ -1960,7 +1960,7 @@ function get_admin_page_title() {
foreach ( $menu as $menu_array ) { foreach ( $menu as $menu_array ) {
if ( isset( $plugin_page ) && if ( isset( $plugin_page ) &&
( $plugin_page == $menu_array[2] ) && ( $plugin_page == $menu_array[2] ) &&
( $pagenow == 'admin.php' ) && ( 'admin.php' === $pagenow ) &&
( $parent1 == $menu_array[2] ) ) { ( $parent1 == $menu_array[2] ) ) {
$title = $menu_array[3]; $title = $menu_array[3];
return $menu_array[3]; return $menu_array[3];
@ -2156,7 +2156,7 @@ function option_update_filter( $options ) {
* @return array * @return array
*/ */
function add_option_whitelist( $new_options, $options = '' ) { function add_option_whitelist( $new_options, $options = '' ) {
if ( $options == '' ) { if ( '' == $options ) {
global $whitelist_options; global $whitelist_options;
} else { } else {
$whitelist_options = $options; $whitelist_options = $options;
@ -2169,7 +2169,7 @@ function add_option_whitelist( $new_options, $options = '' ) {
$whitelist_options[ $page ][] = $key; $whitelist_options[ $page ][] = $key;
} else { } else {
$pos = array_search( $key, $whitelist_options[ $page ] ); $pos = array_search( $key, $whitelist_options[ $page ] );
if ( $pos === false ) { if ( false === $pos ) {
$whitelist_options[ $page ][] = $key; $whitelist_options[ $page ][] = $key;
} }
} }
@ -2191,7 +2191,7 @@ function add_option_whitelist( $new_options, $options = '' ) {
* @return array * @return array
*/ */
function remove_option_whitelist( $del_options, $options = '' ) { function remove_option_whitelist( $del_options, $options = '' ) {
if ( $options == '' ) { if ( '' == $options ) {
global $whitelist_options; global $whitelist_options;
} else { } else {
$whitelist_options = $options; $whitelist_options = $options;
@ -2201,7 +2201,7 @@ function remove_option_whitelist( $del_options, $options = '' ) {
foreach ( $keys as $key ) { foreach ( $keys as $key ) {
if ( isset( $whitelist_options[ $page ] ) && is_array( $whitelist_options[ $page ] ) ) { if ( isset( $whitelist_options[ $page ] ) && is_array( $whitelist_options[ $page ] ) ) {
$pos = array_search( $key, $whitelist_options[ $page ] ); $pos = array_search( $key, $whitelist_options[ $page ] );
if ( $pos !== false ) { if ( false !== $pos ) {
unset( $whitelist_options[ $page ][ $pos ] ); unset( $whitelist_options[ $page ][ $pos ] );
} }
} }

View File

@ -109,7 +109,7 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
if ( isset( $post_data['saveasprivate'] ) && '' != $post_data['saveasprivate'] ) { if ( isset( $post_data['saveasprivate'] ) && '' != $post_data['saveasprivate'] ) {
$post_data['post_status'] = 'private'; $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'; $post_data['post_status'] = 'publish';
} }
if ( isset( $post_data['advanced'] ) && '' != $post_data['advanced'] ) { 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'] ) ) { if ( isset( $post_data['_wp_attachment_image_alt'] ) ) {
$image_alt = wp_unslash( $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 ); $image_alt = wp_strip_all_tags( $image_alt, true );
// update_post_meta() expects slashed. // 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. // 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 .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __( 'Change Permalinks' ) . "</a></span>\n"; $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __( 'Change Permalinks' ) . "</a></span>\n";
} }
} else { } else {
@ -1596,7 +1596,7 @@ function wp_check_post_lock( $post_id ) {
/** This filter is documented in wp-admin/includes/ajax-actions.php */ /** This filter is documented in wp-admin/includes/ajax-actions.php */
$time_window = apply_filters( 'wp_check_post_lock_window', 150 ); $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; return $user;
} }
@ -1951,7 +1951,7 @@ function wp_autosave( $post_data ) {
$post_data['post_status'] = 'draft'; $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'] ); $post_data['post_category'] = explode( ',', $post_data['catslist'] );
} }

View File

@ -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. // 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 */ /** This filter is documented in wp-admin/includes/ajax-actions.php */
$exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() ); $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']; $exporter_done = $response['done'];
if ( ! $is_last_exporter || ! $exporter_done ) { if ( ! $is_last_exporter || ! $exporter_done ) {
return $response; return $response;

View File

@ -432,7 +432,7 @@ function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $
} }
if ( ! $wp_list_table ) { if ( ! $wp_list_table ) {
if ( $mode == 'single' ) { if ( 'single' === $mode ) {
$wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' ); $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' );
} else { } else {
$wp_list_table = _get_list_table( 'WP_Comments_List_Table' ); $wp_list_table = _get_list_table( 'WP_Comments_List_Table' );
@ -2195,12 +2195,12 @@ function _media_states( $post ) {
$header_image = get_header_image(); $header_image = get_header_image();
// Display "Header Image" if the image was ever used as a 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' ); $media_states[] = __( 'Header Image' );
} }
// Display "Current Header Image" if the image is currently the 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' ); $media_states[] = __( 'Current Header Image' );
} }
} }
@ -2209,21 +2209,21 @@ function _media_states( $post ) {
if ( current_theme_supports( 'custom-background' ) ) { if ( current_theme_supports( 'custom-background' ) ) {
$meta_background = get_post_meta( $post->ID, '_wp_attachment_is_custom_background', true ); $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' ); $media_states[] = __( 'Background Image' );
$background_image = get_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' ); $media_states[] = __( 'Current Background Image' );
} }
} }
} }
if ( $post->ID == get_option( 'site_icon' ) ) { if ( get_option( 'site_icon' ) == $post->ID ) {
$media_states[] = __( 'Site Icon' ); $media_states[] = __( 'Site Icon' );
} }
if ( $post->ID == get_theme_mod( 'custom_logo' ) ) { if ( get_theme_mod( 'custom_logo' ) == $post->ID ) {
$media_states[] = __( 'Logo' ); $media_states[] = __( 'Logo' );
} }

View File

@ -56,7 +56,7 @@ function get_core_updates( $options = array() ) {
$updates = $from_api->updates; $updates = $from_api->updates;
$result = array(); $result = array();
foreach ( $updates as $update ) { foreach ( $updates as $update ) {
if ( $update->response == 'autoupdate' ) { if ( 'autoupdate' === $update->response ) {
continue; continue;
} }
@ -291,7 +291,7 @@ function update_nag() {
$cur = get_preferred_from_update_core(); $cur = get_preferred_from_update_core();
if ( ! isset( $cur->response ) || $cur->response != 'upgrade' ) { if ( ! isset( $cur->response ) || 'upgrade' !== $cur->response ) {
return false; return false;
} }
@ -337,7 +337,7 @@ function update_right_now_message() {
if ( current_user_can( 'update_core' ) ) { if ( current_user_can( 'update_core' ) ) {
$cur = get_preferred_from_update_core(); $cur = get_preferred_from_update_core();
if ( isset( $cur->response ) && $cur->response == 'upgrade' ) { if ( isset( $cur->response ) && 'upgrade' === $cur->response ) {
$msg .= sprintf( $msg .= sprintf(
'<a href="%s" class="button" aria-describedby="wp-version">%s</a> ', '<a href="%s" class="button" aria-describedby="wp-version">%s</a> ',
network_admin_url( 'update-core.php' ), network_admin_url( 'update-core.php' ),

View File

@ -161,7 +161,7 @@ if ( ! function_exists( 'wp_install_defaults' ) ) :
if ( global_terms_enabled() ) { if ( global_terms_enabled() ) {
$cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) ); $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->insert(
$wpdb->sitecategories, $wpdb->sitecategories,
array( array(
@ -495,7 +495,7 @@ Commenter avatars come from <a href="https://gravatar.com">Gravatar</a>.'
// Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) // Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.)
// TODO: Get previous_blog_id. // 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->delete(
$wpdb->usermeta, $wpdb->usermeta,
array( array(
@ -566,7 +566,7 @@ function wp_install_maybe_enable_pretty_permalinks() {
*/ */
$response = wp_remote_get( $test_url, array( 'timeout' => 5 ) ); $response = wp_remote_get( $test_url, array( 'timeout' => 5 ) );
$x_pingback_header = wp_remote_retrieve_header( $response, 'x-pingback' ); $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 ) { if ( $pretty_permalinks ) {
return true; return true;
@ -1127,22 +1127,22 @@ function upgrade_160() {
if ( isset( $user->user_idmode ) ) : if ( isset( $user->user_idmode ) ) :
$idmode = $user->user_idmode; $idmode = $user->user_idmode;
if ( $idmode == 'nickname' ) { if ( 'nickname' === $idmode ) {
$id = $user->user_nickname; $id = $user->user_nickname;
} }
if ( $idmode == 'login' ) { if ( 'login' === $idmode ) {
$id = $user->user_login; $id = $user->user_login;
} }
if ( $idmode == 'firstname' ) { if ( 'firstname' === $idmode ) {
$id = $user->user_firstname; $id = $user->user_firstname;
} }
if ( $idmode == 'lastname' ) { if ( 'lastname' === $idmode ) {
$id = $user->user_lastname; $id = $user->user_lastname;
} }
if ( $idmode == 'namefl' ) { if ( 'namefl' === $idmode ) {
$id = $user->user_firstname . ' ' . $user->user_lastname; $id = $user->user_firstname . ' ' . $user->user_lastname;
} }
if ( $idmode == 'namelf' ) { if ( 'namelf' === $idmode ) {
$id = $user->user_lastname . ' ' . $user->user_firstname; $id = $user->user_lastname . ' ' . $user->user_firstname;
} }
if ( ! $idmode ) { if ( ! $idmode ) {
@ -2249,7 +2249,7 @@ function upgrade_network() {
} }
// 4.2 // 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() ) { 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->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))" ); $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 function __get_option( $setting ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
global $wpdb; global $wpdb;
if ( $setting == 'home' && defined( 'WP_HOME' ) ) { if ( 'home' === $setting && defined( 'WP_HOME' ) ) {
return untrailingslashit( WP_HOME ); return untrailingslashit( WP_HOME );
} }
if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) ) { if ( 'siteurl' === $setting && defined( 'WP_SITEURL' ) ) {
return untrailingslashit( WP_SITEURL ); return untrailingslashit( WP_SITEURL );
} }
$option = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting ) ); $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' ); 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 ); $option = untrailingslashit( $option );
} }
@ -2861,7 +2861,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
'fieldname' => $tableindex->Column_name, 'fieldname' => $tableindex->Column_name,
'subpart' => $tableindex->Sub_part, '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; $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. // Build a create string to compare to the query.
$index_string = ''; $index_string = '';
if ( $index_name == 'primary' ) { if ( 'primary' === $index_name ) {
$index_string .= 'PRIMARY '; $index_string .= 'PRIMARY ';
} elseif ( $index_data['unique'] ) { } elseif ( $index_data['unique'] ) {
$index_string .= 'UNIQUE '; $index_string .= 'UNIQUE ';
@ -2889,7 +2889,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
// For each column in the index. // For each column in the index.
foreach ( $index_data['columns'] as $column_data ) { foreach ( $index_data['columns'] as $column_data ) {
if ( $index_columns != '' ) { if ( '' != $index_columns ) {
$index_columns .= ','; $index_columns .= ',';
} }
@ -3000,14 +3000,14 @@ function make_site_theme_from_oldschool( $theme_name, $template ) {
); );
foreach ( $files as $oldfile => $newfile ) { foreach ( $files as $oldfile => $newfile ) {
if ( $oldfile == 'index.php' ) { if ( 'index.php' === $oldfile ) {
$oldpath = $home_path; $oldpath = $home_path;
} else { } else {
$oldpath = ABSPATH; $oldpath = ABSPATH;
} }
// Check to make sure it's not a new index. // Check to make sure it's not a new index.
if ( $oldfile == 'index.php' ) { if ( 'index.php' === $oldfile ) {
$index = implode( '', file( "$oldpath/$oldfile" ) ); $index = implode( '', file( "$oldpath/$oldfile" ) );
if ( strpos( $index, 'WP_USE_THEMES' ) !== false ) { if ( strpos( $index, 'WP_USE_THEMES' ) !== false ) {
if ( ! copy( WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME . '/index.php', "$site_dir/$newfile" ) ) { 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. // Make the new site theme active.
$current_template = __get_option( 'template' ); $current_template = __get_option( 'template' );
if ( $current_template == WP_DEFAULT_THEME ) { if ( WP_DEFAULT_THEME == $current_template ) {
update_option( 'template', $template ); update_option( 'template', $template );
update_option( 'stylesheet', $template ); update_option( 'stylesheet', $template );
} }

View File

@ -70,7 +70,7 @@ function edit_user( $user_id = 0 ) {
*/ */
if ( if (
( is_multisite() && current_user_can( 'manage_network_users' ) ) || ( 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' ) ) ( $potential_role && $potential_role->has_cap( 'promote_users' ) )
) { ) {
$user->role = $new_role; $user->role = $new_role;
@ -81,7 +81,7 @@ function edit_user( $user_id = 0 ) {
$user->user_email = sanitize_text_field( wp_unslash( $_POST['email'] ) ); $user->user_email = sanitize_text_field( wp_unslash( $_POST['email'] ) );
} }
if ( isset( $_POST['url'] ) ) { if ( isset( $_POST['url'] ) ) {
if ( empty( $_POST['url'] ) || $_POST['url'] == 'http://' ) { if ( empty( $_POST['url'] ) || 'http://' === $_POST['url'] ) {
$user->user_url = ''; $user->user_url = '';
} else { } else {
$user->user_url = esc_url_raw( $_POST['url'] ); $user->user_url = esc_url_raw( $_POST['url'] );
@ -143,7 +143,7 @@ function edit_user( $user_id = 0 ) {
$errors = new WP_Error(); $errors = new WP_Error();
/* checking that username has been typed */ /* checking that username has been typed */
if ( $user->user_login == '' ) { if ( '' == $user->user_login ) {
$errors->add( 'user_login', __( '<strong>Error</strong>: Please enter a username.' ) ); $errors->add( 'user_login', __( '<strong>Error</strong>: Please enter a username.' ) );
} }

View File

@ -175,19 +175,19 @@ function check_column( $table_name, $col_name, $col_type, $is_null = null, $key
if ( $row->Field == $col_name ) { if ( $row->Field == $col_name ) {
// Got our column, check the params. // Got our column, check the params.
if ( ( $col_type != null ) && ( $row->Type != $col_type ) ) { if ( ( null != $col_type ) && ( $row->Type != $col_type ) ) {
++$diffs; ++$diffs;
} }
if ( ( $is_null != null ) && ( $row->Null != $is_null ) ) { if ( ( null != $is_null ) && ( $row->Null != $is_null ) ) {
++$diffs; ++$diffs;
} }
if ( ( $key != null ) && ( $row->Key != $key ) ) { if ( ( null != $key ) && ( $row->Key != $key ) ) {
++$diffs; ++$diffs;
} }
if ( ( $default != null ) && ( $row->Default != $default ) ) { if ( ( null != $default ) && ( $row->Default != $default ) ) {
++$diffs; ++$diffs;
} }
if ( ( $extra != null ) && ( $row->Extra != $extra ) ) { if ( ( null != $extra ) && ( $row->Extra != $extra ) ) {
++$diffs; ++$diffs;
} }
if ( $diffs > 0 ) { if ( $diffs > 0 ) {

View File

@ -120,7 +120,7 @@ $builtin = array( 'post', 'page' );
foreach ( array_merge( $builtin, $types ) as $ptype ) { foreach ( array_merge( $builtin, $types ) as $ptype ) {
$ptype_obj = get_post_type_object( $ptype ); $ptype_obj = get_post_type_object( $ptype );
// Check if it should be a submenu. // Check if it should be a submenu.
if ( $ptype_obj->show_in_menu !== true ) { if ( true !== $ptype_obj->show_in_menu ) {
continue; 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. $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.

View File

@ -107,7 +107,7 @@ else :
* @param string $context Context of the setting (global or site-specific). Default 'global'. * @param string $context Context of the setting (global or site-specific). Default 'global'.
*/ */
$settings_html = apply_filters( 'myblogs_options', '', 'global' ); $settings_html = apply_filters( 'myblogs_options', '', 'global' );
if ( $settings_html != '' ) { if ( '' != $settings_html ) {
echo '<h3>' . __( 'Global Settings' ) . '</h3>'; echo '<h3>' . __( 'Global Settings' ) . '</h3>';
echo $settings_html; echo $settings_html;
} }

View File

@ -165,7 +165,7 @@ if ( isset( $_GET['updated'] ) ) {
</p> </p>
<?php <?php
$new_admin_email = get_site_option( 'new_admin_email' ); $new_admin_email = get_site_option( 'new_admin_email' );
if ( $new_admin_email && $new_admin_email != get_site_option( 'admin_email' ) ) : if ( $new_admin_email && get_site_option( 'admin_email' ) !== $new_admin_email ) :
?> ?>
<div class="updated inline"> <div class="updated inline">
<p> <p>
@ -257,7 +257,7 @@ if ( isset( $_GET['updated'] ) ) {
$limited_email_domains = str_replace( ' ', "\n", $limited_email_domains ); $limited_email_domains = str_replace( ' ', "\n", $limited_email_domains );
?> ?>
<textarea name="limited_email_domains" id="limited_email_domains" aria-describedby="limited-email-domains-desc" cols="45" rows="5"> <textarea name="limited_email_domains" id="limited_email_domains" aria-describedby="limited-email-domains-desc" cols="45" rows="5">
<?php echo esc_textarea( $limited_email_domains == '' ? '' : implode( "\n", (array) $limited_email_domains ) ); ?></textarea> <?php echo esc_textarea( '' == $limited_email_domains ? '' : implode( "\n", (array) $limited_email_domains ) ); ?></textarea>
<p class="description" id="limited-email-domains-desc"> <p class="description" id="limited-email-domains-desc">
<?php _e( 'If you want to limit site registrations to certain domains. One domain per line.' ); ?> <?php _e( 'If you want to limit site registrations to certain domains. One domain per line.' ); ?>
</p> </p>

View File

@ -43,7 +43,7 @@ if ( isset( $_REQUEST['action'] ) && 'update-site' == $_REQUEST['action'] && is_
foreach ( (array) $_POST['option'] as $key => $val ) { foreach ( (array) $_POST['option'] as $key => $val ) {
$key = wp_unslash( $key ); $key = wp_unslash( $key );
$val = wp_unslash( $val ); $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. continue; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options.
} }
update_option( $key, $val ); update_option( $key, $val );
@ -124,7 +124,7 @@ if ( ! empty( $messages ) ) {
); );
$options = $wpdb->get_results( $query ); $options = $wpdb->get_results( $query );
foreach ( $options as $option ) { foreach ( $options as $option ) {
if ( $option->option_name == 'default_role' ) { if ( 'default_role' === $option->option_name ) {
$editblog_default_role = $option->option_value; $editblog_default_role = $option->option_value;
} }
$disabled = false; $disabled = false;

View File

@ -141,7 +141,7 @@ if ( isset( $_GET['action'] ) ) {
} }
$updated_action = 'not_deleted'; $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 ); wpmu_delete_blog( $id, true );
$updated_action = 'delete'; $updated_action = 'delete';
} }
@ -153,7 +153,7 @@ if ( isset( $_GET['action'] ) ) {
foreach ( (array) $_POST['site_ids'] as $site_id ) { foreach ( (array) $_POST['site_ids'] as $site_id ) {
$site_id = (int) $site_id; $site_id = (int) $site_id;
if ( $site_id == get_network()->site_id ) { if ( get_network()->site_id == $site_id ) {
continue; continue;
} }
@ -178,10 +178,10 @@ if ( isset( $_GET['action'] ) ) {
case 'allblogs': case 'allblogs':
if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['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 ) { 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 ) { switch ( $doaction ) {
case 'delete': case 'delete':
require_once ABSPATH . 'wp-admin/admin-header.php'; require_once ABSPATH . 'wp-admin/admin-header.php';

View File

@ -27,7 +27,7 @@ if ( isset( $_GET['action'] ) ) {
check_admin_referer( 'deleteuser' ); check_admin_referer( 'deleteuser' );
$id = intval( $_GET['id'] ); $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. $_POST['allusers'] = array( $id ); // confirm_delete_users() can only handle arrays.
$title = __( 'Users' ); $title = __( 'Users' );
$parent_file = 'users.php'; $parent_file = 'users.php';
@ -49,7 +49,7 @@ if ( isset( $_GET['action'] ) ) {
if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allusers'] ) ) { if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allusers'] ) ) {
check_admin_referer( 'bulk-users-network' ); check_admin_referer( 'bulk-users-network' );
$doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; $doaction = -1 != $_POST['action'] ? $_POST['action'] : $_POST['action2'];
$userfunction = ''; $userfunction = '';
foreach ( (array) $_POST['allusers'] as $user_id ) { foreach ( (array) $_POST['allusers'] as $user_id ) {
@ -84,7 +84,7 @@ if ( isset( $_GET['action'] ) ) {
$blogs = get_blogs_of_user( $user_id, true ); $blogs = get_blogs_of_user( $user_id, true );
foreach ( (array) $blogs as $details ) { 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' ); update_blog_status( $details->userblog_id, 'spam', '1' );
} }
} }
@ -176,7 +176,7 @@ if ( isset( $_GET['action'] ) ) {
} }
} }
if ( $i == 1 ) { if ( 1 == $i ) {
$deletefunction = 'delete'; $deletefunction = 'delete';
} else { } else {
$deletefunction = 'all_delete'; $deletefunction = 'all_delete';
@ -239,7 +239,7 @@ get_current_screen()->set_screen_reader_content(
require_once ABSPATH . 'wp-admin/admin-header.php'; 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'] ) ) {
?> ?>
<div id="message" class="updated notice is-dismissible"><p> <div id="message" class="updated notice is-dismissible"><p>
<?php <?php

View File

@ -113,7 +113,7 @@ if ( ! is_multisite() ) {
<p class="description" id="new-admin-email-description"><?php _e( 'This address is used for admin purposes. If you change this, we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?></p> <p class="description" id="new-admin-email-description"><?php _e( 'This address is used for admin purposes. If you change this, we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?></p>
<?php <?php
$new_admin_email = get_option( 'new_admin_email' ); $new_admin_email = get_option( 'new_admin_email' );
if ( $new_admin_email && $new_admin_email != get_option( 'admin_email' ) ) : if ( $new_admin_email && get_option( 'admin_email' ) !== $new_admin_email ) :
?> ?>
<div class="updated inline"> <div class="updated inline">
<p> <p>
@ -183,7 +183,7 @@ if ( ! empty( $languages ) || ! empty( $translations ) ) {
); );
// Add note about deprecated WPLANG constant. // Add note about deprecated WPLANG constant.
if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && $locale !== WPLANG ) { if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && WPLANG !== $locale ) {
_deprecated_argument( _deprecated_argument(
'define()', 'define()',
'4.0.0', '4.0.0',

View File

@ -34,7 +34,7 @@ if ( 'post' == $post_type ) {
} }
} else { } else {
$submenu_file = "post-new.php?post_type=$post_type"; $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; $parent_file = $post_type_object->show_in_menu;
// What if there isn't a post-new.php item for this post type? // 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 ) ] ) ) { if ( ! isset( $_registered_pages[ get_plugin_page_hookname( "post-new.php?post_type=$post_type", $post_type_object->show_in_menu ) ] ) ) {

View File

@ -9,10 +9,10 @@
if ( isset( $_GET['page'] ) && ! empty( $_POST ) ) { if ( isset( $_GET['page'] ) && ! empty( $_POST ) ) {
// Ensure POST-ing to `tools.php?page=export_personal_data` and `tools.php?page=remove_personal_data` // 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. // 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'; require_once ABSPATH . 'wp-admin/export-personal-data.php';
return; return;
} elseif ( $_GET['page'] === 'remove_personal_data' ) { } elseif ( 'remove_personal_data' === $_GET['page'] ) {
require_once ABSPATH . 'wp-admin/erase-personal-data.php'; require_once ABSPATH . 'wp-admin/erase-personal-data.php';
return; return;
} }
@ -27,10 +27,10 @@ if ( isset( $_GET['wp-privacy-policy-guide'] ) ) {
exit; exit;
} elseif ( isset( $_GET['page'] ) ) { } elseif ( isset( $_GET['page'] ) ) {
// These were also moved to files in WP 5.3. // 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 ); wp_redirect( admin_url( 'export-personal-data.php' ), 301 );
exit; exit;
} elseif ( $_GET['page'] === 'remove_personal_data' ) { } elseif ( 'remove_personal_data' === $_GET['page'] ) {
wp_redirect( admin_url( 'erase-personal-data.php' ), 301 ); wp_redirect( admin_url( 'erase-personal-data.php' ), 301 );
exit; exit;
} }

View File

@ -319,7 +319,7 @@ if ( ! function_exists( 'twentyeleven_header_style' ) ) :
$text_color = get_header_textcolor(); $text_color = get_header_textcolor();
// If no custom options for text are set, let's bail. // If no custom options for text are set, let's bail.
if ( $text_color == HEADER_TEXTCOLOR ) { if ( HEADER_TEXTCOLOR == $text_color ) {
return; return;
} }
@ -416,7 +416,7 @@ if ( ! function_exists( 'twentyeleven_admin_header_image' ) ) :
$color = get_header_textcolor(); $color = get_header_textcolor();
$image = get_header_image(); $image = get_header_image();
$style = 'display: none;'; $style = 'display: none;';
if ( $color && $color != 'blank' ) { if ( $color && 'blank' !== $color ) {
$style = 'color: #' . $color . ';'; $style = 'color: #' . $color . ';';
} }
?> ?>

View File

@ -63,7 +63,7 @@ if ( ! function_exists( 'twentyfourteen_header_style' ) ) :
$text_color = get_header_textcolor(); $text_color = get_header_textcolor();
// If no custom color for text is set, let's bail. // 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; return;
} }
@ -82,7 +82,7 @@ if ( ! function_exists( 'twentyfourteen_header_style' ) ) :
} }
<?php <?php
// If the user has set a custom color for the text, use that. // 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 a { .site-title a {
color: #<?php echo esc_attr( $text_color ); ?>; color: #<?php echo esc_attr( $text_color ); ?>;

View File

@ -90,7 +90,7 @@ function twentythirteen_header_style() {
$text_color = get_header_textcolor(); $text_color = get_header_textcolor();
// If no custom options for text are set, let's bail. // 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; return;
} }
@ -136,7 +136,7 @@ function twentythirteen_header_style() {
endif; endif;
// If the user has set a custom color for the text, use that. // 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-title,
.site-description { .site-description {

View File

@ -71,7 +71,7 @@ function twentytwelve_header_style() {
$text_color = get_header_textcolor(); $text_color = get_header_textcolor();
// If no custom options for text are set, let's bail. // 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; return;
} }

View File

@ -113,7 +113,7 @@ function _walk_bookmarks( $bookmarks, $args = '' ) {
$output .= $parsed_args['link_before']; $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 ) { if ( strpos( $bookmark->link_image, 'http' ) === 0 ) {
$output .= "<img src=\"$bookmark->link_image\" $alt $title />"; $output .= "<img src=\"$bookmark->link_image\" $alt $title />";
} else { // If it's a relative path. } else { // If it's a relative path.

View File

@ -52,11 +52,11 @@ function get_bookmark( $bookmark, $output = OBJECT, $filter = 'raw' ) {
$_bookmark = sanitize_bookmark( $_bookmark, $filter ); $_bookmark = sanitize_bookmark( $_bookmark, $filter );
if ( $output == OBJECT ) { if ( OBJECT == $output ) {
return $_bookmark; return $_bookmark;
} elseif ( $output == ARRAY_A ) { } elseif ( ARRAY_A == $output ) {
return get_object_vars( $_bookmark ); return get_object_vars( $_bookmark );
} elseif ( $output == ARRAY_N ) { } elseif ( ARRAY_N == $output ) {
return array_values( get_object_vars( $_bookmark ) ); return array_values( get_object_vars( $_bookmark ) );
} else { } else {
return $_bookmark; 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 = "SELECT * $length $recently_updated_test $get_updated FROM $wpdb->links $join WHERE 1=1 $visible $category_query";
$query .= " $exclusions $inclusions $search"; $query .= " $exclusions $inclusions $search";
$query .= " ORDER BY $orderby $order"; $query .= " ORDER BY $orderby $order";
if ( $parsed_args['limit'] != -1 ) { if ( -1 != $parsed_args['limit'] ) {
$query .= ' LIMIT ' . $parsed_args['limit']; $query .= ' LIMIT ' . $parsed_args['limit'];
} }

View File

@ -534,7 +534,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
break; 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'; $caps[] = 'do_not_allow';
break; break;
} }
@ -867,7 +867,7 @@ function get_super_admins() {
* @return bool True if the user is a site admin. * @return bool True if the user is a site admin.
*/ */
function is_super_admin( $user_id = false ) { 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(); $user = wp_get_current_user();
} else { } else {
$user = get_userdata( $user_id ); $user = get_userdata( $user_id );

View File

@ -836,7 +836,7 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
$translate_nooped_plural = $args['topic_count_text']; $translate_nooped_plural = $args['topic_count_text'];
} elseif ( ! empty( $args['topic_count_text_callback'] ) ) { } elseif ( ! empty( $args['topic_count_text_callback'] ) ) {
// Look for the alternative callback style. Ignore the previous default. // 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). */ /* translators: %s: Number of items (tags). */
$translate_nooped_plural = _n_noop( '%s item', '%s items' ); $translate_nooped_plural = _n_noop( '%s item', '%s items' );
} else { } else {

View File

@ -127,7 +127,7 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ
$category_paths = explode( '/', $category_paths ); $category_paths = explode( '/', $category_paths );
$full_path = ''; $full_path = '';
foreach ( (array) $category_paths as $pathdir ) { foreach ( (array) $category_paths as $pathdir ) {
$full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title( $pathdir ); $full_path .= ( '' != $pathdir ? '/' : '' ) . sanitize_title( $pathdir );
} }
$categories = get_terms( $categories = get_terms(
array( array(
@ -144,7 +144,7 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ
foreach ( $categories as $category ) { foreach ( $categories as $category ) {
$path = '/' . $leaf_path; $path = '/' . $leaf_path;
$curcategory = $category; $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' ); $curcategory = get_term( $curcategory->parent, 'category' );
if ( is_wp_error( $curcategory ) ) { if ( is_wp_error( $curcategory ) ) {
return $curcategory; return $curcategory;

View File

@ -485,7 +485,7 @@ class WP_Http {
*/ */
public static function browser_redirect_compatibility( $location, $headers, $data, &$options, $original ) { public static function browser_redirect_compatibility( $location, $headers, $data, &$options, $original ) {
// Browser compatibility. // Browser compatibility.
if ( $original->status_code === 302 ) { if ( 302 === $original->status_code ) {
$options['type'] = Requests::GET; $options['type'] = Requests::GET;
} }
} }

View File

@ -130,7 +130,7 @@ class Walker_Page extends Walker {
} elseif ( $_current_page && $page->ID == $_current_page->post_parent ) { } elseif ( $_current_page && $page->ID == $_current_page->post_parent ) {
$css_class[] = 'current_page_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'; $css_class[] = 'current_page_parent';
} }

View File

@ -318,7 +318,7 @@ class WP_Admin_Bar {
} }
foreach ( $this->_get_nodes() as $node ) { foreach ( $this->_get_nodes() as $node ) {
if ( 'root' == $node->id ) { if ( 'root' === $node->id ) {
continue; continue;
} }
@ -329,9 +329,9 @@ class WP_Admin_Bar {
} }
// Generate the group class (we distinguish between top level and other level groups). // 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'] ) ) { if ( empty( $node->meta['class'] ) ) {
$node->meta['class'] = $group_class; $node->meta['class'] = $group_class;
} else { } else {
@ -340,7 +340,7 @@ class WP_Admin_Bar {
} }
// Items in items aren't allowed. Wrap nested items in 'default' groups. // 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_id = $parent->id . '-default';
$default = $this->_get_node( $default_id ); $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. // Groups in groups aren't allowed. Add a special 'container' node.
// The container will invisibly wrap both groups. // 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_id = $parent->id . '-container';
$container = $this->_get_node( $container_id ); $container = $this->_get_node( $container_id );
@ -398,7 +398,7 @@ class WP_Admin_Bar {
$container->parent = $grandparent->id; $container->parent = $grandparent->id;
$index = array_search( $parent, $grandparent->children, true ); $index = array_search( $parent, $grandparent->children, true );
if ( $index === false ) { if ( false === $index ) {
$grandparent->children[] = $container; $grandparent->children[] = $container;
} else { } else {
array_splice( $grandparent->children, $index, 1, array( $container ) ); array_splice( $grandparent->children, $index, 1, array( $container ) );
@ -469,7 +469,7 @@ class WP_Admin_Bar {
* @param object $node * @param object $node
*/ */
final protected function _render_container( $node ) { final protected function _render_container( $node ) {
if ( $node->type != 'container' || empty( $node->children ) ) { if ( 'container' !== $node->type || empty( $node->children ) ) {
return; return;
} }
@ -484,11 +484,11 @@ class WP_Admin_Bar {
* @param object $node * @param object $node
*/ */
final protected function _render_group( $node ) { final protected function _render_group( $node ) {
if ( $node->type == 'container' ) { if ( 'container' === $node->type ) {
$this->_render_container( $node ); $this->_render_container( $node );
return; return;
} }
if ( $node->type != 'group' || empty( $node->children ) ) { if ( 'group' !== $node->type || empty( $node->children ) ) {
return; return;
} }
@ -509,7 +509,7 @@ class WP_Admin_Bar {
* @param object $node * @param object $node
*/ */
final protected function _render_item( $node ) { final protected function _render_item( $node ) {
if ( $node->type != 'item' ) { if ( 'item' !== $node->type ) {
return; return;
} }

View File

@ -1138,11 +1138,11 @@ class WP_Comment_Query {
} }
$parsed = false; $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"; $parsed = "$wpdb->commentmeta.meta_value";
} elseif ( $orderby == 'meta_value_num' ) { } elseif ( 'meta_value_num' === $orderby ) {
$parsed = "$wpdb->commentmeta.meta_value+0"; $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'] ) ); $comment__in = implode( ',', array_map( 'absint', $this->query_vars['comment__in'] ) );
$parsed = "FIELD( {$wpdb->comments}.comment_ID, $comment__in )"; $parsed = "FIELD( {$wpdb->comments}.comment_ID, $comment__in )";
} elseif ( in_array( $orderby, $allowed_keys ) ) { } elseif ( in_array( $orderby, $allowed_keys ) ) {

View File

@ -1007,7 +1007,7 @@ final class WP_Customize_Widgets {
'temp_id' => isset( $args['_temp_id'] ) ? $args['_temp_id'] : null, 'temp_id' => isset( $args['_temp_id'] ) ? $args['_temp_id'] : null,
'is_multi' => $is_multi_widget, 'is_multi' => $is_multi_widget,
'control_tpl' => $control_tpl, '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, 'is_disabled' => $is_disabled,
'id_base' => $id_base, 'id_base' => $id_base,
'transport' => $this->is_widget_selective_refreshable( $id_base ) ? 'postMessage' : 'refresh', '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. * @return array|void Sanitized widget instance.
*/ */
public function sanitize_widget_instance( $value ) { public function sanitize_widget_instance( $value ) {
if ( $value === array() ) { if ( array() === $value ) {
return $value; return $value;
} }

View File

@ -243,7 +243,7 @@ final class _WP_Editors {
$quicktags_toolbar = ''; $quicktags_toolbar = '';
if ( self::$this_quicktags ) { 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'; $toolbar_id = 'ed_toolbar';
} else { } else {
$toolbar_id = 'qt_' . $editor_id_attr . '_toolbar'; $toolbar_id = 'qt_' . $editor_id_attr . '_toolbar';
@ -743,7 +743,7 @@ final class _WP_Editors {
$page_template = get_page_template_slug( $post ); $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' ) ); $page_template = empty( $page_template ) ? 'default' : str_replace( '.', '-', basename( $page_template, '.php' ) );
$body_class .= ' page-template-' . sanitize_html_class( $page_template ); $body_class .= ' page-template-' . sanitize_html_class( $page_template );
} }

View File

@ -281,7 +281,7 @@ final class WP_Hook implements Iterator, ArrayAccess {
} }
// Avoid the array_slice() if possible. // Avoid the array_slice() if possible.
if ( $the_['accepted_args'] == 0 ) { if ( 0 == $the_['accepted_args'] ) {
$value = call_user_func( $the_['function'] ); $value = call_user_func( $the_['function'] );
} elseif ( $the_['accepted_args'] >= $num_args ) { } elseif ( $the_['accepted_args'] >= $num_args ) {
$value = call_user_func_array( $the_['function'], $args ); $value = call_user_func_array( $the_['function'], $args );

View File

@ -129,7 +129,7 @@ class WP_Http_Curl {
curl_setopt( $handle, CURLOPT_URL, $url ); curl_setopt( $handle, CURLOPT_URL, $url );
curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true ); 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 ); curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify );
if ( $ssl_verify ) { if ( $ssl_verify ) {
@ -209,7 +209,7 @@ class WP_Http_Curl {
curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers ); 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 ); curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
} else { } else {
curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 ); curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );

View File

@ -76,7 +76,7 @@ class WP_HTTP_IXR_Client extends IXR_Client {
*/ */
$args['headers'] = apply_filters( 'wp_http_ixr_client_headers', $args['headers'] ); $args['headers'] = apply_filters( 'wp_http_ixr_client_headers', $args['headers'] );
if ( $this->timeout !== false ) { if ( false !== $this->timeout ) {
$args['timeout'] = $this->timeout; $args['timeout'] = $this->timeout;
} }
@ -112,7 +112,7 @@ class WP_HTTP_IXR_Client extends IXR_Client {
} }
// Is the message a fault? // 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 ); $this->error = new IXR_Error( $this->message->faultCode, $this->message->faultString );
return false; return false;
} }

View File

@ -174,7 +174,7 @@ class WP_HTTP_Proxy {
$check = @parse_url( $uri ); $check = @parse_url( $uri );
// Malformed URL, can not process, but this could mean ssl, so let through anyway. // Malformed URL, can not process, but this could mean ssl, so let through anyway.
if ( $check === false ) { if ( false === $check ) {
return true; return true;
} }

View File

@ -55,9 +55,9 @@ class WP_Http_Streams {
$connect_host = $arrURL['host']; $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 ( ! isset( $arrURL['port'] ) ) {
if ( $arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https' ) { if ( 'ssl' === $arrURL['scheme'] || 'https' === $arrURL['scheme'] ) {
$arrURL['port'] = 443; $arrURL['port'] = 443;
$secure_transport = true; $secure_transport = true;
} else { } else {
@ -390,7 +390,7 @@ class WP_Http_Streams {
$match_against = preg_split( '/,\s*/', $cert['extensions']['subjectAltName'] ); $match_against = preg_split( '/,\s*/', $cert['extensions']['subjectAltName'] );
foreach ( $match_against as $match ) { foreach ( $match_against as $match ) {
list( $match_type, $match_host ) = explode( ':', $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 ) ); $certificate_hostnames[] = strtolower( trim( $match_host ) );
} }
} }

View File

@ -103,7 +103,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
// setIteratorIndex is optional unless mime is an animated format. // 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. // 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; return false;
} }

View File

@ -418,7 +418,7 @@ abstract class WP_Image_Editor {
*/ */
$orientation = apply_filters( 'wp_image_maybe_exif_rotate', $orientation, $this->file ); $orientation = apply_filters( 'wp_image_maybe_exif_rotate', $orientation, $this->file );
if ( ! $orientation || $orientation === 1 ) { if ( ! $orientation || 1 === $orientation ) {
return false; return false;
} }

View File

@ -545,10 +545,10 @@ class WP_Network_Query {
); );
$parsed = false; $parsed = false;
if ( $orderby == 'network__in' ) { if ( 'network__in' === $orderby ) {
$network__in = implode( ',', array_map( 'absint', $this->query_vars['network__in'] ) ); $network__in = implode( ',', array_map( 'absint', $this->query_vars['network__in'] ) );
$parsed = "FIELD( {$wpdb->site}.id, $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 ); $field = substr( $orderby, 0, -7 );
$parsed = "CHAR_LENGTH($wpdb->site.$field)"; $parsed = "CHAR_LENGTH($wpdb->site.$field)";
} elseif ( in_array( $orderby, $allowed_keys ) ) { } elseif ( in_array( $orderby, $allowed_keys ) ) {

View File

@ -910,7 +910,7 @@ class WP_Query {
} }
unset( $tax_query ); unset( $tax_query );
if ( empty( $qv['author'] ) || ( $qv['author'] == '0' ) ) { if ( empty( $qv['author'] ) || ( '0' == $qv['author'] ) ) {
$this->is_author = false; $this->is_author = false;
} else { } else {
$this->is_author = true; $this->is_author = true;
@ -1017,25 +1017,25 @@ class WP_Query {
unset( $this->queried_object ); 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_page = false;
$this->is_home = true; $this->is_home = true;
$this->is_posts_page = 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; $this->is_privacy_policy = true;
} }
} }
if ( $qv['page_id'] ) { 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_page = false;
$this->is_home = true; $this->is_home = true;
$this->is_posts_page = 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; $this->is_privacy_policy = true;
} }
} }
@ -1377,7 +1377,7 @@ class WP_Query {
foreach ( $q['search_terms'] as $term ) { foreach ( $q['search_terms'] as $term ) {
// If there is an $exclusion_prefix, terms prefixed with it should be excluded. // 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 ) { if ( $exclude ) {
$like_op = 'NOT LIKE'; $like_op = 'NOT LIKE';
$andor_op = 'AND'; $andor_op = 'AND';
@ -1861,11 +1861,11 @@ class WP_Query {
$q['showposts'] = (int) $q['showposts']; $q['showposts'] = (int) $q['showposts'];
$q['posts_per_page'] = $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']; $q['posts_per_page'] = $q['posts_per_archive_page'];
} }
if ( ! isset( $q['nopaging'] ) ) { if ( ! isset( $q['nopaging'] ) ) {
if ( $q['posts_per_page'] == -1 ) { if ( -1 == $q['posts_per_page'] ) {
$q['nopaging'] = true; $q['nopaging'] = true;
} else { } else {
$q['nopaging'] = false; $q['nopaging'] = false;
@ -1884,15 +1884,15 @@ class WP_Query {
$q['posts_per_page'] = (int) $q['posts_per_page']; $q['posts_per_page'] = (int) $q['posts_per_page'];
if ( $q['posts_per_page'] < -1 ) { if ( $q['posts_per_page'] < -1 ) {
$q['posts_per_page'] = abs( $q['posts_per_page'] ); $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; $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' ); $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_page = true;
$this->is_home = false; $this->is_home = false;
$q['page_id'] = get_option( 'page_on_front' ); $q['page_id'] = get_option( 'page_on_front' );
@ -2096,7 +2096,7 @@ class WP_Query {
} }
if ( $q['page_id'] ) { 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']; $q['p'] = $q['page_id'];
$where = " AND {$wpdb->posts}.ID = " . $q['page_id']; $where = " AND {$wpdb->posts}.ID = " . $q['page_id'];
} }
@ -2135,7 +2135,7 @@ class WP_Query {
$post_type = array(); $post_type = array();
$taxonomies = array_keys( $this->tax_query->queried_terms ); $taxonomies = array_keys( $this->tax_query->queried_terms );
foreach ( get_post_types( array( 'exclude_from_search' => false ) ) as $pt ) { 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 ) ) { if ( array_intersect( $taxonomies, $object_taxonomies ) ) {
$post_type[] = $pt; $post_type[] = $pt;
} }
@ -2214,7 +2214,7 @@ class WP_Query {
// Author/user stuff. // Author/user stuff.
if ( ! empty( $q['author'] ) && $q['author'] != '0' ) { if ( ! empty( $q['author'] ) && '0' != $q['author'] ) {
$q['author'] = addslashes_gpc( '' . urldecode( $q['author'] ) ); $q['author'] = addslashes_gpc( '' . urldecode( $q['author'] ) );
$authors = array_unique( array_map( 'intval', preg_split( '/[,\s]+/', $q['author'] ) ) ); $authors = array_unique( array_map( 'intval', preg_split( '/[,\s]+/', $q['author'] ) ) );
foreach ( $authors as $author ) { foreach ( $authors as $author ) {
@ -3290,7 +3290,7 @@ class WP_Query {
global $post; global $post;
$this->in_the_loop = true; $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. * Fires once the loop is started.
* *
@ -3380,7 +3380,7 @@ class WP_Query {
$comment = $this->next_comment(); $comment = $this->next_comment();
if ( $this->current_comment == 0 ) { if ( 0 == $this->current_comment ) {
/** /**
* Fires once the comment loop is started. * 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, * Force full post content when viewing the permalink for the $post,
* or when on an RSS feed. Otherwise respect the 'more' tag. * 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; $more = 1;
} elseif ( $this->is_feed() ) { } elseif ( $this->is_feed() ) {
$more = 1; $more = 1;

View File

@ -920,7 +920,7 @@ class WP_Rewrite {
// Get the structure, minus any cruft (stuff that isn't tags) at the front. // Get the structure, minus any cruft (stuff that isn't tags) at the front.
$structure = $permalink_structure; $structure = $permalink_structure;
if ( $front != '/' ) { if ( '/' !== $front ) {
$structure = str_replace( $front, '', $structure ); $structure = str_replace( $front, '', $structure );
} }
@ -1909,7 +1909,7 @@ class WP_Rewrite {
* @param string $category_base Category permalink structure base. * @param string $category_base Category permalink structure base.
*/ */
public function set_category_base( $category_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 ); update_option( 'category_base', $category_base );
$this->init(); $this->init();
} }
@ -1927,7 +1927,7 @@ class WP_Rewrite {
* @param string $tag_base Tag permalink structure base. * @param string $tag_base Tag permalink structure base.
*/ */
public function set_tag_base( $tag_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 ); update_option( 'tag_base', $tag_base );
$this->init(); $this->init();
} }

View File

@ -356,7 +356,7 @@ class WP_Roles {
return $wp_user_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 ); remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 );
$roles = get_blog_option( $this->site_id, $this->role_key, array() ); $roles = get_blog_option( $this->site_id, $this->role_key, array() );

View File

@ -46,7 +46,7 @@ class WP_SimplePie_Sanitize_KSES extends SimplePie_Sanitize {
} }
if ( $type & ( SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML ) ) { if ( $type & ( SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML ) ) {
$data = wp_kses_post( $data ); $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 ) ); $data = $this->registry->call( 'Misc', 'change_encoding', array( $data, 'UTF-8', $this->output_encoding ) );
} }
return $data; return $data;

View File

@ -1516,7 +1516,7 @@ final class WP_Theme implements ArrayAccess {
return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id ); 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 ) { if ( $current ) {
$allowed_themes[ $blog_id ] = get_option( 'allowedthemes' ); $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );

View File

@ -493,7 +493,7 @@ class WP_User {
*/ */
public function get_role_caps() { public function get_role_caps() {
$switch_site = false; $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_site = true;
switch_to_blog( $this->site_id ); switch_to_blog( $this->site_id );
@ -590,7 +590,7 @@ class WP_User {
* @param string $role Role name. * @param string $role Role name.
*/ */
public function set_role( $role ) { public function set_role( $role ) {
if ( 1 == count( $this->roles ) && $role == current( $this->roles ) ) { if ( 1 == count( $this->roles ) && current( $this->roles ) == $role ) {
return; return;
} }

View File

@ -144,7 +144,7 @@ class Walker {
$this->start_el( $output, $element, $depth, ...array_values( $args ) ); $this->start_el( $output, $element, $depth, ...array_values( $args ) );
// Descend only when the depth is right and there are childrens for this element. // 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 ) { 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, * If we are displaying all levels, and remaining children_elements is not empty,
* then we got orphans, which should be displayed regardless. * 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(); $empty_array = array();
foreach ( $children_elements as $orphans ) { foreach ( $children_elements as $orphans ) {
foreach ( $orphans as $op ) { foreach ( $orphans as $op ) {

View File

@ -696,7 +696,7 @@ class wp_xmlrpc_server extends IXR_Server {
foreach ( $blogs as $blog ) { foreach ( $blogs as $blog ) {
// Don't include blogs that aren't hosted at this site. // 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; continue;
} }
@ -827,7 +827,7 @@ class wp_xmlrpc_server extends IXR_Server {
* @return IXR_Date IXR_Date object. * @return IXR_Date IXR_Date object.
*/ */
protected function _convert_date( $date ) { 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( '00000000T00:00:00Z' );
} }
return new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date, false ) ); 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. * @return IXR_Date IXR_Date object.
*/ */
protected function _convert_date_gmt( $date_gmt, $date ) { 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 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 ); return $this->_convert_date( $date_gmt );
@ -879,7 +879,7 @@ class wp_xmlrpc_server extends IXR_Server {
'menu_order' => intval( $post['menu_order'] ), 'menu_order' => intval( $post['menu_order'] ),
'comment_status' => $post['comment_status'], 'comment_status' => $post['comment_status'],
'ping_status' => $post['ping_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. // Thumbnail.
@ -891,7 +891,7 @@ class wp_xmlrpc_server extends IXR_Server {
} }
// Consider future posts as published. // Consider future posts as published.
if ( $post_fields['post_status'] === 'future' ) { if ( 'future' === $post_fields['post_status'] ) {
$post_fields['post_status'] = 'publish'; $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. * 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 ( 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'] ); unset( $content_struct['post_date_gmt'] );
} else { } else {
$content_struct['post_date_gmt'] = $this->_convert_date( $content_struct['post_date_gmt'] ); $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'] ) ) { if ( ! current_user_can( 'edit_post', $post_data['ID'] ) ) {
return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); 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.' ) ); return new IXR_Error( 401, __( 'The post type may not be changed.' ) );
} }
} else { } else {
@ -1451,11 +1451,11 @@ class wp_xmlrpc_server extends IXR_Server {
$post_data['post_author'] = $user->ID; $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'] ); 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'] ); unset( $post_data['ping_status'] );
} }
@ -1483,7 +1483,7 @@ class wp_xmlrpc_server extends IXR_Server {
} }
$post_ID = $post_data['ID']; $post_ID = $post_data['ID'];
if ( $post_data['post_type'] == 'post' ) { if ( 'post' === $post_data['post_type'] ) {
$error = $this->_toggle_sticky( $post_data, $update ); $error = $this->_toggle_sticky( $post_data, $update );
if ( $error ) { if ( $error ) {
return $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, * 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. * 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'] ); unset( $post['post_date_gmt'] );
} else { } else {
$post['post_date_gmt'] = $this->_convert_date( $post['post_date_gmt'] ); $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' ); do_action( 'xmlrpc_call', 'wp.getPage' );
// If we found the page then format the data. // 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 ); return $this->_prepare_page( $page );
} else { } else {
// If the page doesn't exist, indicate that. // 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 // Get the current page based on the 'page_id' and
// make sure it is a page and not a post. // make sure it is a page and not a post.
$actual_page = get_post( $page_id, ARRAY_A ); $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.' ) ); 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. // Get the page data and make sure it is a page.
$actual_page = get_post( $page_id, ARRAY_A ); $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.' ) ); return new IXR_Error( 404, __( 'Sorry, no such page.' ) );
} }
@ -4238,7 +4238,7 @@ class wp_xmlrpc_server extends IXR_Server {
continue; continue;
} }
if ( $this->blog_options[ $o_name ]['readonly'] == true ) { if ( true == $this->blog_options[ $o_name ]['readonly'] ) {
continue; continue;
} }
@ -5114,7 +5114,7 @@ class wp_xmlrpc_server extends IXR_Server {
$actual_post = get_post( $post_ID, ARRAY_A ); $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.' ) ); 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 ) ) { if ( ! current_user_can( 'edit_post', $post_ID ) ) {
return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); 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.' ) ); 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 ); $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.' ) ); return new IXR_Error( 404, __( 'Sorry, no such post.' ) );
} }
@ -5276,10 +5276,10 @@ class wp_xmlrpc_server extends IXR_Server {
$page_template = ''; $page_template = '';
if ( ! empty( $content_struct['post_type'] ) ) { if ( ! empty( $content_struct['post_type'] ) ) {
if ( $content_struct['post_type'] == 'page' ) { if ( 'page' === $content_struct['post_type'] ) {
if ( $publish ) { if ( $publish ) {
$cap = 'publish_pages'; $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'; $cap = 'publish_pages';
} else { } else {
$cap = 'edit_pages'; $cap = 'edit_pages';
@ -5289,10 +5289,10 @@ class wp_xmlrpc_server extends IXR_Server {
if ( ! empty( $content_struct['wp_page_template'] ) ) { if ( ! empty( $content_struct['wp_page_template'] ) ) {
$page_template = $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 ) { if ( $publish ) {
$cap = 'publish_posts'; $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'; $cap = 'publish_posts';
} else { } else {
$cap = 'edit_posts'; $cap = 'edit_posts';
@ -5306,7 +5306,7 @@ class wp_xmlrpc_server extends IXR_Server {
} else { } else {
if ( $publish ) { if ( $publish ) {
$cap = 'publish_posts'; $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'; $cap = 'publish_posts';
} else { } else {
$cap = 'edit_posts'; $cap = 'edit_posts';
@ -5513,7 +5513,7 @@ class wp_xmlrpc_server extends IXR_Server {
$postdata['ID'] = $post_ID; $postdata['ID'] = $post_ID;
// Only posts can be sticky. // Only posts can be sticky.
if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) { if ( 'post' === $post_type && isset( $content_struct['sticky'] ) ) {
$data = $postdata; $data = $postdata;
$data['sticky'] = $content_struct['sticky']; $data['sticky'] = $content_struct['sticky'];
$error = $this->_toggle_sticky( $data ); $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; $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' ) ) { if ( 'page' == $post_type && ! current_user_can( 'publish_pages' ) ) {
return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this page.' ) ); return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this page.' ) );
} elseif ( ! current_user_can( 'publish_posts' ) ) { } elseif ( ! current_user_can( 'publish_posts' ) ) {
@ -5901,7 +5901,7 @@ class wp_xmlrpc_server extends IXR_Server {
} }
// Only posts can be sticky. // Only posts can be sticky.
if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) { if ( 'post' === $post_type && isset( $content_struct['sticky'] ) ) {
$data = $newpost; $data = $newpost;
$data['sticky'] = $content_struct['sticky']; $data['sticky'] = $content_struct['sticky'];
$data['post_type'] = 'post'; $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 */ /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
do_action( 'xmlrpc_call', 'metaWeblog.getPost' ); do_action( 'xmlrpc_call', 'metaWeblog.getPost' );
if ( $postdata['post_date'] != '' ) { if ( '' != $postdata['post_date'] ) {
$post_date = $this->_convert_date( $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_date_gmt = $this->_convert_date_gmt( $postdata['post_date_gmt'], $postdata['post_date'] );
$post_modified = $this->_convert_date( $postdata['post_modified'] ); $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; $allow_pings = ( 'open' == $postdata['ping_status'] ) ? 1 : 0;
// Consider future posts as published. // Consider future posts as published.
if ( $postdata['post_status'] === 'future' ) { if ( 'future' === $postdata['post_status'] ) {
$postdata['post_status'] = 'publish'; $postdata['post_status'] = 'publish';
} }
@ -6041,7 +6041,7 @@ class wp_xmlrpc_server extends IXR_Server {
$enclosure = array(); $enclosure = array();
foreach ( (array) get_post_custom( $post_ID ) as $key => $val ) { foreach ( (array) get_post_custom( $post_ID ) as $key => $val ) {
if ( $key == 'enclosure' ) { if ( 'enclosure' === $key ) {
foreach ( (array) $val as $enc ) { foreach ( (array) $val as $enc ) {
$encdata = explode( "\n", $enc ); $encdata = explode( "\n", $enc );
$enclosure['url'] = trim( htmlspecialchars( $encdata[0] ) ); $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; $allow_pings = ( 'open' == $entry['ping_status'] ) ? 1 : 0;
// Consider future posts as published. // Consider future posts as published.
if ( $entry['post_status'] === 'future' ) { if ( 'future' === $entry['post_status'] ) {
$entry['post_status'] = 'publish'; $entry['post_status'] = 'publish';
} }
@ -6213,7 +6213,7 @@ class wp_xmlrpc_server extends IXR_Server {
'wp_post_format' => $post_format, 'wp_post_format' => $post_format,
'date_modified' => $post_modified, 'date_modified' => $post_modified,
'date_modified_gmt' => $post_modified_gmt, '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'] ), '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&#8217;t exist, or it is not a pingback-enabled resource.' ) ); return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either doesn&#8217;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.' ) ); return $this->pingback_error( 0, __( 'The source URL and the target URL cannot both point to the same resource.' ) );
} }

View File

@ -475,7 +475,7 @@ class WP_Scripts extends WP_Dependencies {
* @return bool True on success, false on failure. * @return bool True on success, false on failure.
*/ */
public function localize( $handle, $object_name, $l10n ) { public function localize( $handle, $object_name, $l10n ) {
if ( $handle === 'jquery' ) { if ( 'jquery' === $handle ) {
$handle = 'jquery-core'; $handle = 'jquery-core';
} }
@ -521,7 +521,7 @@ class WP_Scripts extends WP_Dependencies {
* @return bool Not already in the group or a lower group. * @return bool Not already in the group or a lower group.
*/ */
public function set_group( $handle, $recursion, $group = false ) { 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; $grp = 1;
} else { } else {
$grp = (int) $this->get_data( $handle, 'group' ); $grp = (int) $this->get_data( $handle, 'group' );

View File

@ -268,7 +268,7 @@ class WP_Styles extends WP_Dependencies {
/** This filter is documented in wp-includes/class.wp-styles.php */ /** This filter is documented in wp-includes/class.wp-styles.php */
$rtl_tag = apply_filters( 'style_loader_tag', $rtl_tag, $handle, $rtl_href, $media ); $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; $tag = $rtl_tag;
} else { } else {
$tag .= $rtl_tag; $tag .= $rtl_tag;

View File

@ -192,8 +192,8 @@ function get_comment_author_email_link( $linktext = '', $before = '', $after = '
*/ */
$email = apply_filters( 'comment_email', $comment->comment_author_email, $comment ); $email = apply_filters( 'comment_email', $comment->comment_author_email, $comment );
if ( ( ! empty( $email ) ) && ( $email != '@' ) ) { if ( ( ! empty( $email ) ) && ( '@' !== $email ) ) {
$display = ( $linktext != '' ) ? $linktext : $email; $display = ( '' != $linktext ) ? $linktext : $email;
$return = $before; $return = $before;
$return .= sprintf( '<a href="%1$s">%2$s</a>', esc_url( 'mailto:' . $email ), esc_html( $display ) ); $return .= sprintf( '<a href="%1$s">%2$s</a>', esc_url( 'mailto:' . $email ), esc_html( $display ) );
$return .= $after; $return .= $after;
@ -376,7 +376,7 @@ function comment_author_url( $comment_ID = 0 ) {
*/ */
function get_comment_author_url_link( $linktext = '', $before = '', $after = '', $comment = 0 ) { function get_comment_author_url_link( $linktext = '', $before = '', $after = '', $comment = 0 ) {
$url = get_comment_author_url( $comment ); $url = get_comment_author_url( $comment );
$display = ( $linktext != '' ) ? $linktext : $url; $display = ( '' != $linktext ) ? $linktext : $url;
$display = str_replace( 'http://www.', '', $display ); $display = str_replace( 'http://www.', '', $display );
$display = str_replace( 'http://', '', $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 ); $output = str_replace( '%', number_format_i18n( $number ), $more );
} }
} elseif ( $number == 0 ) { } elseif ( 0 == $number ) {
$output = ( false === $zero ) ? __( 'No Comments' ) : $zero; $output = ( false === $zero ) ? __( 'No Comments' ) : $zero;
} else { // Must be one. } else { // Must be one.
$output = ( false === $one ) ? __( '1 Comment' ) : $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 * When first page shows oldest comments, post permalink is the same as
* the comment permalink. * the comment permalink.
*/ */
} elseif ( $cpage == 1 ) { } elseif ( 1 == $cpage ) {
$parsed_args['cpage'] = ''; $parsed_args['cpage'] = '';
} else { } else {
$parsed_args['cpage'] = $cpage; $parsed_args['cpage'] = $cpage;

View File

@ -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. * email address. If both checks pass, return true. Otherwise, return false.
*/ */
if ( 1 == get_option( 'comment_whitelist' ) ) { 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 ) ); $comment_user = get_user_by( 'email', wp_unslash( $email ) );
if ( ! empty( $comment_user->ID ) ) { 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 ) ); $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 ); $_comment = apply_filters( 'get_comment', $_comment );
if ( $output == OBJECT ) { if ( OBJECT == $output ) {
return $_comment; return $_comment;
} elseif ( $output == ARRAY_A ) { } elseif ( ARRAY_A == $output ) {
return $_comment->to_array(); return $_comment->to_array();
} elseif ( $output == ARRAY_N ) { } elseif ( ARRAY_N == $output ) {
return array_values( $_comment->to_array() ); return array_values( $_comment->to_array() );
} }
return $_comment; return $_comment;
@ -1429,7 +1429,7 @@ function wp_delete_comment( $comment_id, $force_delete = false ) {
do_action( 'deleted_comment', $comment->comment_ID, $comment ); do_action( 'deleted_comment', $comment->comment_ID, $comment );
$post_id = $comment->comment_post_ID; $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 ); wp_update_comment_count( $post_id );
} }
@ -1655,15 +1655,15 @@ function wp_get_comment_status( $comment_id ) {
$approved = $comment->comment_approved; $approved = $comment->comment_approved;
if ( $approved == null ) { if ( null == $approved ) {
return false; return false;
} elseif ( $approved == '1' ) { } elseif ( '1' == $approved ) {
return 'approved'; return 'approved';
} elseif ( $approved == '0' ) { } elseif ( '0' == $approved ) {
return 'unapproved'; return 'unapproved';
} elseif ( $approved == 'spam' ) { } elseif ( 'spam' == $approved ) {
return 'spam'; return 'spam';
} elseif ( $approved == 'trash' ) { } elseif ( 'trash' == $approved ) {
return 'trash'; return 'trash';
} else { } else {
return false; return false;
@ -1913,7 +1913,7 @@ function wp_insert_comment( $commentdata ) {
$id = (int) $wpdb->insert_id; $id = (int) $wpdb->insert_id;
if ( $comment_approved == 1 ) { if ( 1 == $comment_approved ) {
wp_update_comment_count( $comment_post_ID ); wp_update_comment_count( $comment_post_ID );
foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) { 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 ); $pingback_link_offset_squote = strpos( $contents, $pingback_str_squote );
if ( $pingback_link_offset_dquote || $pingback_link_offset_squote ) { if ( $pingback_link_offset_dquote || $pingback_link_offset_squote ) {
$quote = ( $pingback_link_offset_dquote ) ? '"' : '\''; $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_pos = strpos( $contents, 'href=', $pingback_link_offset );
$pingback_href_start = $pingback_href_pos + 6; $pingback_href_start = $pingback_href_pos + 6;
$pingback_href_end = strpos( $contents, $quote, $pingback_href_start ); $pingback_href_end = strpos( $contents, $quote, $pingback_href_start );
@ -2843,7 +2843,7 @@ function pingback( $content, $post_id ) {
if ( $test ) { if ( $test ) {
if ( isset( $test['query'] ) ) { if ( isset( $test['query'] ) ) {
$post_links[] = $link_test; $post_links[] = $link_test;
} elseif ( isset( $test['path'] ) && ( $test['path'] != '/' ) && ( $test['path'] != '' ) ) { } elseif ( isset( $test['path'] ) && ( '/' !== $test['path'] ) && ( '' !== $test['path'] ) ) {
$post_links[] = $link_test; $post_links[] = $link_test;
} }
} }
@ -3005,7 +3005,7 @@ function pingback_ping_source_uri( $source_uri ) {
* @return IXR_Error * @return IXR_Error
*/ */
function xmlrpc_pingback_error( $ixr_error ) { function xmlrpc_pingback_error( $ixr_error ) {
if ( $ixr_error->code === 48 ) { if ( 48 === $ixr_error->code ) {
return $ixr_error; return $ixr_error;
} }
return new IXR_Error( 0, '' ); return new IXR_Error( 0, '' );

View File

@ -312,7 +312,7 @@ if ( ! function_exists( 'hash_equals' ) ) :
*/ */
function hash_equals( $a, $b ) { function hash_equals( $a, $b ) {
$a_length = strlen( $a ); $a_length = strlen( $a );
if ( $a_length !== strlen( $b ) ) { if ( strlen( $b ) !== $a_length ) {
return false; return false;
} }
$result = 0; $result = 0;
@ -322,7 +322,7 @@ if ( ! function_exists( 'hash_equals' ) ) :
$result |= ord( $a[ $i ] ) ^ ord( $b[ $i ] ); $result |= ord( $a[ $i ] ) ^ ord( $b[ $i ] );
} }
return $result === 0; return 0 === $result;
} }
endif; endif;

View File

@ -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. * @return array|false Instance data array, or false if the item is marked for deletion.
*/ */
public function value() { 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. $undefined = new stdClass(); // Symbol.
$post_value = $this->post_value( $undefined ); $post_value = $this->post_value( $undefined );
@ -798,7 +798,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
return; 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_status = 'error';
$this->update_error = new WP_Error( 'unexpected_previous_term_id' ); $this->update_error = new WP_Error( 'unexpected_previous_term_id' );
return; return;
@ -824,7 +824,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
return; 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_status = 'error';
$this->update_error = new WP_Error( 'unexpected_previous_post_id' ); $this->update_error = new WP_Error( 'unexpected_previous_post_id' );
return; return;

View File

@ -156,7 +156,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* @return array Instance data. * @return array Instance data.
*/ */
public function value() { 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. $undefined = new stdClass(); // Symbol.
$post_value = $this->post_value( $undefined ); $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. * @return array (Maybe) modified nav menu options.
*/ */
public function filter_nav_menu_options( $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; return $nav_menu_options;
} }
@ -555,7 +555,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
} }
$post_value = $setting->post_value( null ); $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 ); $this->manager->set_post_value( $setting->id, $this->term_id );
$setting->save(); $setting->save();
} }

View File

@ -614,7 +614,7 @@ function get_oembed_response_data_for_url( $url, $args ) {
$sites = get_sites( $qv ); $sites = get_sites( $qv );
$site = reset( $sites ); $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 ); switch_to_blog( $site->blog_id );
$switched_blog = true; $switched_blog = true;
} }

View File

@ -110,7 +110,7 @@ while ( have_comments() ) :
<?php <?php
// Return comment threading information (https://www.ietf.org/rfc/rfc4685.txt). // Return comment threading information (https://www.ietf.org/rfc/rfc4685.txt).
if ( $comment->comment_parent == 0 ) : // This comment is top-level. if ( 0 == $comment->comment_parent ) : // This comment is top-level.
?> ?>
<thr:in-reply-to ref="<?php the_guid(); ?>" href="<?php the_permalink_rss(); ?>" type="<?php bloginfo_rss( 'html_type' ); ?>" /> <thr:in-reply-to ref="<?php the_guid(); ?>" href="<?php the_permalink_rss(); ?>" type="<?php bloginfo_rss( 'html_type' ); ?>" />
<?php <?php

View File

@ -471,7 +471,7 @@ function rss_enclosure() {
} }
foreach ( (array) get_post_custom() as $key => $val ) { foreach ( (array) get_post_custom() as $key => $val ) {
if ( $key == 'enclosure' ) { if ( 'enclosure' === $key ) {
foreach ( (array) $val as $enc ) { foreach ( (array) $val as $enc ) {
$enclosure = explode( "\n", $enc ); $enclosure = explode( "\n", $enc );
@ -511,7 +511,7 @@ function atom_enclosure() {
} }
foreach ( (array) get_post_custom() as $key => $val ) { foreach ( (array) get_post_custom() as $key => $val ) {
if ( $key == 'enclosure' ) { if ( 'enclosure' === $key ) {
foreach ( (array) $val as $enc ) { foreach ( (array) $val as $enc ) {
$enclosure = explode( "\n", $enc ); $enclosure = explode( "\n", $enc );
/** /**

View File

@ -479,7 +479,7 @@ function wpautop( $pee, $br = true ) {
$start = strpos( $pee_part, '<pre' ); $start = strpos( $pee_part, '<pre' );
// Malformed HTML? // Malformed HTML?
if ( $start === false ) { if ( false === $start ) {
$pee .= $pee_part; $pee .= $pee_part;
continue; continue;
} }
@ -984,10 +984,10 @@ function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = fals
$_quote_style = $quote_style; $_quote_style = $quote_style;
if ( $quote_style === 'double' ) { if ( 'double' === $quote_style ) {
$quote_style = ENT_COMPAT; $quote_style = ENT_COMPAT;
$_quote_style = ENT_COMPAT; $_quote_style = ENT_COMPAT;
} elseif ( $quote_style === 'single' ) { } elseif ( 'single' === $quote_style ) {
$quote_style = ENT_NOQUOTES; $quote_style = ENT_NOQUOTES;
} }
@ -1080,16 +1080,16 @@ function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES ) {
'/&#x0*26;/i' => '&#x26;', '/&#x0*26;/i' => '&#x26;',
); );
if ( $quote_style === ENT_QUOTES ) { if ( ENT_QUOTES === $quote_style ) {
$translation = array_merge( $single, $double, $others ); $translation = array_merge( $single, $double, $others );
$translation_preg = array_merge( $single_preg, $double_preg, $others_preg ); $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 = array_merge( $double, $others );
$translation_preg = array_merge( $double_preg, $others_preg ); $translation_preg = array_merge( $double_preg, $others_preg );
} elseif ( $quote_style === 'single' ) { } elseif ( 'single' === $quote_style ) {
$translation = array_merge( $single, $others ); $translation = array_merge( $single, $others );
$translation_preg = array_merge( $single_preg, $others_preg ); $translation_preg = array_merge( $single_preg, $others_preg );
} elseif ( $quote_style === ENT_NOQUOTES ) { } elseif ( ENT_NOQUOTES === $quote_style ) {
$translation = $others; $translation = $others;
$translation_preg = $others_preg; $translation_preg = $others_preg;
} }
@ -2793,11 +2793,11 @@ function antispambot( $email_address, $hex_encoding = 0 ) {
$email_no_spam_address = ''; $email_no_spam_address = '';
for ( $i = 0, $len = strlen( $email_address ); $i < $len; $i++ ) { for ( $i = 0, $len = strlen( $email_address ); $i < $len; $i++ ) {
$j = rand( 0, 1 + $hex_encoding ); $j = rand( 0, 1 + $hex_encoding );
if ( $j == 0 ) { if ( 0 == $j ) {
$email_no_spam_address .= '&#' . ord( $email_address[ $i ] ) . ';'; $email_no_spam_address .= '&#' . ord( $email_address[ $i ] ) . ';';
} elseif ( $j == 1 ) { } elseif ( 1 == $j ) {
$email_no_spam_address .= $email_address[ $i ]; $email_no_spam_address .= $email_address[ $i ];
} elseif ( $j == 2 ) { } elseif ( 2 == $j ) {
$email_no_spam_address .= '%' . zeroise( dechex( ord( $email_address[ $i ] ) ), 2 ); $email_no_spam_address .= '%' . zeroise( dechex( ord( $email_address[ $i ] ) ), 2 );
} }
} }
@ -2938,7 +2938,7 @@ function make_clickable( $text ) {
$nested_code_pre--; $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; $r .= $piece;
continue; continue;
} }
@ -3552,7 +3552,7 @@ function get_date_from_gmt( $string, $format = 'Y-m-d H:i:s' ) {
*/ */
function iso8601_timezone_to_offset( $timezone ) { function iso8601_timezone_to_offset( $timezone ) {
// $timezone is either 'Z' or '[+|-]hhmm'. // $timezone is either 'Z' or '[+|-]hhmm'.
if ( $timezone == 'Z' ) { if ( 'Z' === $timezone ) {
$offset = 0; $offset = 0;
} else { } else {
$sign = ( substr( $timezone, 0, 1 ) == '+' ) ? 1 : -1; $sign = ( substr( $timezone, 0, 1 ) == '+' ) ? 1 : -1;
@ -4626,7 +4626,7 @@ function sanitize_option( $option, $value ) {
case 'default_ping_status': case 'default_ping_status':
case 'default_comment_status': case 'default_comment_status':
// Options that if not there have 0 value but need to be something like "closed". // 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'; $value = 'closed';
} }
break; break;
@ -4972,7 +4972,7 @@ function wp_sprintf( $pattern, ...$args ) {
$fragment = substr( $pattern, $start, $end - $start ); $fragment = substr( $pattern, $start, $end - $start );
// Fragment has a specifier. // Fragment has a specifier.
if ( $pattern[ $start ] == '%' ) { if ( '%' === $pattern[ $start ] ) {
// Find numbered arguments or take the next one in order. // Find numbered arguments or take the next one in order.
if ( preg_match( '/^%(\d+)\$/', $fragment, $matches ) ) { if ( preg_match( '/^%(\d+)\$/', $fragment, $matches ) ) {
$index = $matches[1] - 1; // 0-based array vs 1-based sprintf() arguments. $index = $matches[1] - 1; // 0-based array vs 1-based sprintf() arguments.

View File

@ -686,7 +686,7 @@ function is_serialized_string( $data ) {
return false; return false;
} elseif ( ';' !== substr( $data, -1 ) ) { } elseif ( ';' !== substr( $data, -1 ) ) {
return false; return false;
} elseif ( $data[0] !== 's' ) { } elseif ( 's' !== $data[0] ) {
return false; return false;
} elseif ( '"' !== substr( $data, -2, 1 ) ) { } elseif ( '"' !== substr( $data, -2, 1 ) ) {
return false; return false;
@ -1013,15 +1013,15 @@ function _http_build_query( $data, $prefix = null, $sep = null, $key = '', $urle
if ( $urlencode ) { if ( $urlencode ) {
$k = urlencode( $k ); $k = urlencode( $k );
} }
if ( is_int( $k ) && $prefix != null ) { if ( is_int( $k ) && null != $prefix ) {
$k = $prefix . $k; $k = $prefix . $k;
} }
if ( ! empty( $key ) ) { if ( ! empty( $key ) ) {
$k = $key . '%5B' . $k . '%5D'; $k = $key . '%5B' . $k . '%5D';
} }
if ( $v === null ) { if ( null === $v ) {
continue; continue;
} elseif ( $v === false ) { } elseif ( false === $v ) {
$v = '0'; $v = '0';
} }
@ -1132,7 +1132,7 @@ function add_query_arg( ...$args ) {
} }
foreach ( $qs as $k => $v ) { foreach ( $qs as $k => $v ) {
if ( $v === false ) { if ( false === $v ) {
unset( $qs[ $k ] ); unset( $qs[ $k ] );
} }
} }
@ -1539,7 +1539,7 @@ function do_feed() {
// Remove the pad, if present. // Remove the pad, if present.
$feed = preg_replace( '/^_+/', '', $feed ); $feed = preg_replace( '/^_+/', '', $feed );
if ( $feed == '' || $feed == 'feed' ) { if ( '' == $feed || 'feed' === $feed ) {
$feed = get_default_feed(); $feed = get_default_feed();
} }
@ -1885,7 +1885,7 @@ function wp_get_referer() {
$ref = wp_get_raw_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 ); return wp_validate_redirect( $ref, false );
} }
@ -1947,7 +1947,7 @@ function wp_mkdir_p( $target ) {
$target = str_replace( '//', '/', $target ); $target = str_replace( '//', '/', $target );
// Put the wrapper back on the target. // Put the wrapper back on the target.
if ( $wrapper !== null ) { if ( null !== $wrapper ) {
$target = $wrapper . '://' . $target; $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 * If a umask is set that modifies $dir_perms, we'll have to re-set
* the $dir_perms correctly with chmod() * 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 ) ); $folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) );
for ( $i = 1, $c = count( $folder_parts ); $i <= $c; $i++ ) { for ( $i = 1, $c = count( $folder_parts ); $i <= $c; $i++ ) {
chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms ); chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms );
@ -2029,7 +2029,7 @@ function path_is_absolute( $path ) {
return true; return true;
} }
if ( strlen( $path ) == 0 || $path[0] == '.' ) { if ( strlen( $path ) == 0 || '.' === $path[0] ) {
return false; return false;
} }
@ -2039,7 +2039,7 @@ function path_is_absolute( $path ) {
} }
// A path starting with / or \ is absolute; anything else is relative. // 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. * @return bool Whether the path is writable.
*/ */
function win_is_writable( $path ) { 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. // If it looks like a directory, check a random file within the directory.
return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp' ); return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp' );
} elseif ( is_dir( $path ) ) { } elseif ( is_dir( $path ) ) {
@ -2197,7 +2197,7 @@ function win_is_writable( $path ) {
$should_delete_tmp_file = ! file_exists( $path ); $should_delete_tmp_file = ! file_exists( $path );
$f = @fopen( $path, 'a' ); $f = @fopen( $path, 'a' );
if ( $f === false ) { if ( false === $f ) {
return false; return false;
} }
fclose( $f ); fclose( $f );
@ -2633,7 +2633,7 @@ function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
$upload = wp_upload_dir( $time ); $upload = wp_upload_dir( $time );
if ( $upload['error'] !== false ) { if ( false !== $upload['error'] ) {
return $upload; return $upload;
} }
@ -4321,7 +4321,7 @@ function smilies_init() {
// New subpattern? // New subpattern?
if ( $firstchar != $subchar ) { if ( $firstchar != $subchar ) {
if ( $subchar != '' ) { if ( '' != $subchar ) {
$wp_smiliessearch .= ')(?=' . $spaces . '|$)'; // End previous "subpattern". $wp_smiliessearch .= ')(?=' . $spaces . '|$)'; // End previous "subpattern".
$wp_smiliessearch .= '|(?<=' . $spaces . '|^)'; // Begin another "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; $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; $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; 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. // Keep the previous behavior but attempt to prevent fatal errors from timeout if possible.
if ( function_exists( 'ini_get' ) ) { if ( function_exists( 'ini_get' ) ) {
$max_execution_time = ini_get( 'max_execution_time' ); $max_execution_time = ini_get( 'max_execution_time' );
@ -7532,7 +7532,7 @@ function recurse_dirsize( $directory, $exclude = null, $max_execution_time = nul
if ( $handle ) { if ( $handle ) {
while ( ( $file = readdir( $handle ) ) !== false ) { while ( ( $file = readdir( $handle ) ) !== false ) {
$path = $directory . '/' . $file; $path = $directory . '/' . $file;
if ( $file != '.' && $file != '..' ) { if ( '.' !== $file && '..' !== $file ) {
if ( is_file( $path ) ) { if ( is_file( $path ) ) {
$size += filesize( $path ); $size += filesize( $path );
} elseif ( is_dir( $path ) ) { } elseif ( is_dir( $path ) ) {

View File

@ -856,7 +856,7 @@ function get_bloginfo( $show = '', $filter = 'raw' ) {
function get_site_icon_url( $size = 512, $url = '', $blog_id = 0 ) { function get_site_icon_url( $size = 512, $url = '', $blog_id = 0 ) {
$switched_blog = false; $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 ); switch_to_blog( $blog_id );
$switched_blog = true; $switched_blog = true;
} }
@ -924,7 +924,7 @@ function has_site_icon( $blog_id = 0 ) {
function has_custom_logo( $blog_id = 0 ) { function has_custom_logo( $blog_id = 0 ) {
$switched_blog = false; $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 ); switch_to_blog( $blog_id );
$switched_blog = true; $switched_blog = true;
} }
@ -950,7 +950,7 @@ function get_custom_logo( $blog_id = 0 ) {
$html = ''; $html = '';
$switched_blog = false; $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 ); switch_to_blog( $blog_id );
$switched_blog = true; $switched_blog = true;
} }
@ -1846,7 +1846,7 @@ function wp_get_archives( $args = '' ) {
} }
$order = strtoupper( $parsed_args['order'] ); $order = strtoupper( $parsed_args['order'] );
if ( $order !== 'ASC' ) { if ( 'ASC' !== $order ) {
$order = 'DESC'; $order = 'DESC';
} }
@ -2006,7 +2006,7 @@ function wp_get_archives( $args = '' ) {
} }
if ( $results ) { if ( $results ) {
foreach ( (array) $results as $result ) { 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 ); $url = get_permalink( $result );
if ( $result->post_title ) { if ( $result->post_title ) {
/** This filter is documented in wp-includes/post-template.php */ /** This filter is documented in wp-includes/post-template.php */
@ -2014,7 +2014,7 @@ function wp_get_archives( $args = '' ) {
} else { } else {
$text = $result->ID; $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 ); $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; $newrow = false;
if ( $day == current_time( 'j' ) && if ( current_time( 'j' ) == $day &&
$thismonth == current_time( 'm' ) && current_time( 'm' ) == $thismonth &&
$thisyear == current_time( 'Y' ) ) { current_time( 'Y' ) == $thisyear ) {
$calendar_output .= '<td id="today">'; $calendar_output .= '<td id="today">';
} else { } else {
$calendar_output .= '<td>'; $calendar_output .= '<td>';
@ -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 ); $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" . '<td class="pad" colspan="' . esc_attr( $pad ) . '">&nbsp;</td>'; $calendar_output .= "\n\t\t" . '<td class="pad" colspan="' . esc_attr( $pad ) . '">&nbsp;</td>';
} }
$calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>"; $calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>";
@ -3960,11 +3960,11 @@ function get_language_attributes( $doctype = 'html' ) {
$lang = get_bloginfo( 'language' ); $lang = get_bloginfo( 'language' );
if ( $lang ) { 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 ) . '"'; $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 ) . '"'; $attributes[] = 'xml:lang="' . esc_attr( $lang ) . '"';
} }
} }

View File

@ -632,7 +632,7 @@ function ms_allowed_http_request_hosts( $is_external, $host ) {
if ( $is_external ) { if ( $is_external ) {
return $is_external; return $is_external;
} }
if ( $host === get_network()->domain ) { if ( get_network()->domain === $host ) {
return true; return true;
} }
if ( isset( $queried[ $host ] ) ) { if ( isset( $queried[ $host ] ) ) {

View File

@ -1046,10 +1046,10 @@ function wp_kses_split2( $string, $allowed_html, $allowed_protocols ) {
// Allow HTML comments. // Allow HTML comments.
if ( '<!--' == substr( $string, 0, 4 ) ) { if ( '<!--' == substr( $string, 0, 4 ) ) {
$string = str_replace( array( '<!--', '-->' ), '', $string ); $string = str_replace( array( '<!--', '-->' ), '', $string );
while ( $string != ( $newstring = wp_kses( $string, $allowed_html, $allowed_protocols ) ) ) { while ( ( $newstring = wp_kses( $string, $allowed_html, $allowed_protocols ) ) != $string ) {
$string = $newstring; $string = $newstring;
} }
if ( $string == '' ) { if ( '' == $string ) {
return ''; return '';
} }
// Prevent multiple dashes in comments. // 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. // No attributes are allowed for closing elements.
if ( $slash != '' ) { if ( '' != $slash ) {
return "</$elem>"; return "</$elem>";
} }
@ -1348,13 +1348,13 @@ function wp_kses_hair( $attr, $allowed_protocols ) {
break; break;
} // End switch. } // 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 ); $attr = wp_kses_html_error( $attr );
$mode = 0; $mode = 0;
} }
} // End while. } // 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 // Special case, for when the attribute list ends with a valueless
// attribute like "selected". // attribute like "selected".
$attrarr[ $attrname ] = array( $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. * @return bool Whether or not the codepoint is a valid Unicode codepoint.
*/ */
function valid_unicode( $i ) { function valid_unicode( $i ) {
return ( $i == 0x9 || $i == 0xa || $i == 0xd || return ( 0x9 == $i || 0xa == $i || 0xd == $i ||
( $i >= 0x20 && $i <= 0xd7ff ) || ( 0x20 <= $i && $i <= 0xd7ff ) ||
( $i >= 0xe000 && $i <= 0xfffd ) || ( 0xe000 <= $i && $i <= 0xfffd ) ||
( $i >= 0x10000 && $i <= 0x10ffff ) ); ( 0x10000 <= $i && $i <= 0x10ffff ) );
} }
/** /**
@ -2244,7 +2244,7 @@ function safecss_filter_attr( $css, $deprecated = '' ) {
$css = ''; $css = '';
foreach ( $css_array as $css_item ) { foreach ( $css_array as $css_item ) {
if ( $css_item == '' ) { if ( '' == $css_item ) {
continue; continue;
} }
@ -2282,7 +2282,7 @@ function safecss_filter_attr( $css, $deprecated = '' ) {
$url = trim( $url_pieces[2] ); $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; $found = false;
break; break;
} else { } else {
@ -2302,7 +2302,7 @@ function safecss_filter_attr( $css, $deprecated = '' ) {
// Remove any CSS containing containing \ ( & } = or comments, except for url() useage checked above. // Remove any CSS containing containing \ ( & } = or comments, except for url() useage checked above.
if ( $found && ! preg_match( '%[\\\(&=}]|/\*%', $css_test_string ) ) { if ( $found && ! preg_match( '%[\\\(&=}]|/\*%', $css_test_string ) ) {
if ( $css != '' ) { if ( '' != $css ) {
$css .= ';'; $css .= ';';
} }

Some files were not shown because too many files have changed in this diff Show More