diff --git a/wp-admin/edit-tag-form.php b/wp-admin/edit-tag-form.php
index f50595e3c3..95f198884c 100644
--- a/wp-admin/edit-tag-form.php
+++ b/wp-admin/edit-tag-form.php
@@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
// Back compat hooks.
-if ( 'category' == $taxonomy ) {
+if ( 'category' === $taxonomy ) {
/**
* Fires before the Edit Category form.
*
@@ -22,7 +22,7 @@ if ( 'category' == $taxonomy ) {
* @param WP_Term $tag Current category term object.
*/
do_action_deprecated( 'edit_category_form_pre', array( $tag ), '3.0.0', '{$taxonomy}_pre_edit_form' );
-} elseif ( 'link_category' == $taxonomy ) {
+} elseif ( 'link_category' === $taxonomy ) {
/**
* Fires before the Edit Link Category form.
*
@@ -177,7 +177,7 @@ if ( isset( $tag->name ) ) {
$dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' );
wp_dropdown_categories( $dropdown_args );
?>
-
+
@@ -192,7 +192,7 @@ if ( isset( $tag->name ) ) {
name ) ) {
* @param WP_Term $tag Current category term object.
*/
do_action_deprecated( 'edit_category_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' );
- } elseif ( 'link_category' == $taxonomy ) {
+ } elseif ( 'link_category' === $taxonomy ) {
/**
* Fires after the Edit Link Category form fields are displayed.
*
@@ -239,10 +239,10 @@ if ( isset( $tag->name ) ) {
_n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ),
- 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) :
+ 'locked' => ( 1 === $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) :
/* translators: %s: Number of posts. */
_n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ),
/* translators: %s: Number of posts. */
@@ -345,7 +345,7 @@ $bulk_messages['post'] = array(
$bulk_messages['page'] = array(
/* translators: %s: Number of pages. */
'updated' => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ),
- 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) :
+ 'locked' => ( 1 === $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) :
/* translators: %s: Number of pages. */
_n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ),
/* translators: %s: Number of pages. */
@@ -358,7 +358,7 @@ $bulk_messages['page'] = array(
$bulk_messages['wp_block'] = array(
/* translators: %s: Number of blocks. */
'updated' => _n( '%s block updated.', '%s blocks updated.', $bulk_counts['updated'] ),
- 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 block not updated, somebody is editing it.' ) :
+ 'locked' => ( 1 === $bulk_counts['locked'] ) ? __( '1 block not updated, somebody is editing it.' ) :
/* translators: %s: Number of blocks. */
_n( '%s block not updated, somebody is editing it.', '%s blocks not updated, somebody is editing them.', $bulk_counts['locked'] ),
/* translators: %s: Number of blocks. */
diff --git a/wp-admin/export.php b/wp-admin/export.php
index 72219728e0..a0c76a35b4 100644
--- a/wp-admin/export.php
+++ b/wp-admin/export.php
@@ -62,9 +62,9 @@ get_current_screen()->set_help_sidebar(
if ( isset( $_GET['download'] ) ) {
$args = array();
- if ( ! isset( $_GET['content'] ) || 'all' == $_GET['content'] ) {
+ if ( ! isset( $_GET['content'] ) || 'all' === $_GET['content'] ) {
$args['content'] = 'all';
- } elseif ( 'posts' == $_GET['content'] ) {
+ } elseif ( 'posts' === $_GET['content'] ) {
$args['content'] = 'post';
if ( $_GET['cat'] ) {
@@ -83,7 +83,7 @@ if ( isset( $_GET['download'] ) ) {
if ( $_GET['post_status'] ) {
$args['status'] = $_GET['post_status'];
}
- } elseif ( 'pages' == $_GET['content'] ) {
+ } elseif ( 'pages' === $_GET['content'] ) {
$args['content'] = 'page';
if ( $_GET['page_author'] ) {
@@ -98,7 +98,7 @@ if ( isset( $_GET['download'] ) ) {
if ( $_GET['page_status'] ) {
$args['status'] = $_GET['page_status'];
}
- } elseif ( 'attachment' == $_GET['content'] ) {
+ } elseif ( 'attachment' === $_GET['content'] ) {
$args['content'] = 'attachment';
if ( $_GET['attachment_start_date'] || $_GET['attachment_end_date'] ) {
@@ -144,18 +144,18 @@ function export_date_options( $post_type = 'post' ) {
FROM $wpdb->posts
WHERE post_type = %s AND post_status != 'auto-draft'
ORDER BY post_date DESC
- ",
+ ",
$post_type
)
);
$month_count = count( $months );
- if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) {
+ if ( ! $month_count || ( 1 === $month_count && 0 === (int) $months[0]->month ) ) {
return;
}
foreach ( $months as $date ) {
- if ( 0 == $date->year ) {
+ if ( 0 === (int) $date->year ) {
continue;
}
diff --git a/wp-admin/import.php b/wp-admin/import.php
index b5d09a1c76..7326f185c1 100644
--- a/wp-admin/import.php
+++ b/wp-admin/import.php
@@ -42,7 +42,7 @@ if ( current_user_can( 'install_plugins' ) ) {
// Detect and redirect invalid importers like 'movabletype', which is registered as 'mt'.
if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) {
$importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id'];
- if ( $importer_id != $_GET['invalid'] ) { // Prevent redirect loops.
+ if ( $importer_id !== $_GET['invalid'] ) { // Prevent redirect loops.
wp_redirect( admin_url( 'admin.php?import=' . $importer_id ) );
exit;
}
diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php
index 7bb6452ff0..b1ea309810 100644
--- a/wp-admin/includes/upgrade.php
+++ b/wp-admin/includes/upgrade.php
@@ -2346,7 +2346,7 @@ function maybe_create_table( $table_name, $create_ddl ) {
$query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $table_name ) );
- if ( $wpdb->get_var( $query ) == $table_name ) {
+ if ( $wpdb->get_var( $query ) === $table_name ) {
return true;
}
@@ -2354,9 +2354,10 @@ function maybe_create_table( $table_name, $create_ddl ) {
$wpdb->query( $create_ddl );
// We cannot directly tell that whether this succeeded!
- if ( $wpdb->get_var( $query ) == $table_name ) {
+ if ( $wpdb->get_var( $query ) === $table_name ) {
return true;
}
+
return false;
}
@@ -2373,13 +2374,18 @@ function maybe_create_table( $table_name, $create_ddl ) {
*/
function drop_index( $table, $index ) {
global $wpdb;
+
$wpdb->hide_errors();
+
$wpdb->query( "ALTER TABLE `$table` DROP INDEX `$index`" );
+
// Now we need to take out all the extra ones we may have created.
for ( $i = 0; $i < 25; $i++ ) {
$wpdb->query( "ALTER TABLE `$table` DROP INDEX `{$index}_$i`" );
}
+
$wpdb->show_errors();
+
return true;
}
@@ -2396,8 +2402,10 @@ function drop_index( $table, $index ) {
*/
function add_clean_index( $table, $index ) {
global $wpdb;
+
drop_index( $table, $index );
$wpdb->query( "ALTER TABLE `$table` ADD INDEX ( `$index` )" );
+
return true;
}
@@ -2415,8 +2423,9 @@ function add_clean_index( $table, $index ) {
*/
function maybe_add_column( $table_name, $column_name, $create_ddl ) {
global $wpdb;
+
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
- if ( $column == $column_name ) {
+ if ( $column === $column_name ) {
return true;
}
}
@@ -2426,10 +2435,11 @@ function maybe_add_column( $table_name, $column_name, $create_ddl ) {
// We cannot directly tell that whether this succeeded!
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
- if ( $column == $column_name ) {
+ if ( $column === $column_name ) {
return true;
}
}
+
return false;
}
diff --git a/wp-admin/install-helper.php b/wp-admin/install-helper.php
index b97370d791..1c76f18bb7 100644
--- a/wp-admin/install-helper.php
+++ b/wp-admin/install-helper.php
@@ -51,20 +51,23 @@ if ( ! function_exists( 'maybe_create_table' ) ) :
*/
function maybe_create_table( $table_name, $create_ddl ) {
global $wpdb;
+
foreach ( $wpdb->get_col( 'SHOW TABLES', 0 ) as $table ) {
- if ( $table == $table_name ) {
+ if ( $table === $table_name ) {
return true;
}
}
+
// Didn't find it, so try to create it.
$wpdb->query( $create_ddl );
// We cannot directly tell that whether this succeeded!
foreach ( $wpdb->get_col( 'SHOW TABLES', 0 ) as $table ) {
- if ( $table == $table_name ) {
+ if ( $table === $table_name ) {
return true;
}
}
+
return false;
}
endif;
@@ -84,9 +87,9 @@ if ( ! function_exists( 'maybe_add_column' ) ) :
*/
function maybe_add_column( $table_name, $column_name, $create_ddl ) {
global $wpdb;
- foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
- if ( $column == $column_name ) {
+ foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
+ if ( $column === $column_name ) {
return true;
}
}
@@ -96,10 +99,11 @@ if ( ! function_exists( 'maybe_add_column' ) ) :
// We cannot directly tell that whether this succeeded!
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
- if ( $column == $column_name ) {
+ if ( $column === $column_name ) {
return true;
}
}
+
return false;
}
endif;
@@ -118,20 +122,22 @@ endif;
*/
function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
global $wpdb;
+
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
- if ( $column == $column_name ) {
+ if ( $column === $column_name ) {
// Found it, so try to drop it.
$wpdb->query( $drop_ddl );
// We cannot directly tell that whether this succeeded!
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
- if ( $column == $column_name ) {
+ if ( $column === $column_name ) {
return false;
}
}
}
}
+
// Else didn't find it.
return true;
}
@@ -167,34 +173,38 @@ function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
*/
function check_column( $table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null ) {
global $wpdb;
+
$diffs = 0;
$results = $wpdb->get_results( "DESC $table_name" );
foreach ( $results as $row ) {
- if ( $row->Field == $col_name ) {
+ if ( $row->Field === $col_name ) {
// Got our column, check the params.
- if ( ( null != $col_type ) && ( $row->Type != $col_type ) ) {
+ if ( ( null !== $col_type ) && ( $row->Type !== $col_type ) ) {
++$diffs;
}
- if ( ( null != $is_null ) && ( $row->Null != $is_null ) ) {
+ if ( ( null !== $is_null ) && ( $row->Null !== $is_null ) ) {
++$diffs;
}
- if ( ( null != $key ) && ( $row->Key != $key ) ) {
+ if ( ( null !== $key ) && ( $row->Key !== $key ) ) {
++$diffs;
}
- if ( ( null != $default ) && ( $row->Default != $default ) ) {
+ if ( ( null !== $default ) && ( $row->Default !== $default ) ) {
++$diffs;
}
- if ( ( null != $extra ) && ( $row->Extra != $extra ) ) {
+ if ( ( null !== $extra ) && ( $row->Extra !== $extra ) ) {
++$diffs;
}
+
if ( $diffs > 0 ) {
return false;
}
+
return true;
} // End if found our column.
}
+
return false;
}
diff --git a/wp-admin/install.php b/wp-admin/install.php
index fa0c31724a..51e389eeb6 100644
--- a/wp-admin/install.php
+++ b/wp-admin/install.php
@@ -91,8 +91,7 @@ function display_header( $body_classes = '' ) {
function display_setup_form( $error = null ) {
global $wpdb;
- $sql = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->users ) );
- $user_table = ( $wpdb->get_var( $sql ) != null );
+ $user_table = ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->users ) ) ) !== null );
// Ensure that sites appear in search engines by default.
$blog_public = 1;
@@ -369,10 +368,10 @@ switch ( $step ) {
// TODO: Poka-yoke.
display_setup_form( __( 'Please provide a valid username.' ) );
$error = true;
- } elseif ( sanitize_user( $user_name, true ) != $user_name ) {
+ } elseif ( sanitize_user( $user_name, true ) !== $user_name ) {
display_setup_form( __( 'The username you provided has invalid characters.' ) );
$error = true;
- } elseif ( $admin_password != $admin_password_check ) {
+ } elseif ( $admin_password !== $admin_password_check ) {
// TODO: Poka-yoke.
display_setup_form( __( 'Your passwords do not match. Please try again.' ) );
$error = true;
diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php
index 25ae721b74..de57d2cf0d 100644
--- a/wp-admin/link-manager.php
+++ b/wp-admin/link-manager.php
@@ -23,7 +23,7 @@ if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) {
$redirect_to = admin_url( 'link-manager.php' );
$bulklinks = (array) $_REQUEST['linkcheck'];
- if ( 'delete' == $doaction ) {
+ if ( 'delete' === $doaction ) {
foreach ( $bulklinks as $link_id ) {
$link_id = (int) $link_id;
diff --git a/wp-admin/link-parse-opml.php b/wp-admin/link-parse-opml.php
index ad53d07d24..7a2ad3a1b8 100644
--- a/wp-admin/link-parse-opml.php
+++ b/wp-admin/link-parse-opml.php
@@ -27,14 +27,14 @@ global $opml;
* @global array $descriptions
* @global array $feeds
*
- * @param resource $parser XML Parser resource.
- * @param string $tagName XML element name.
- * @param array $attrs XML element attributes.
+ * @param resource $parser XML Parser resource.
+ * @param string $tag_name XML element name.
+ * @param array $attrs XML element attributes.
*/
-function startElement( $parser, $tagName, $attrs ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
+function startElement( $parser, $tag_name, $attrs ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
global $names, $urls, $targets, $descriptions, $feeds;
- if ( 'OUTLINE' === $tagName ) {
+ if ( 'OUTLINE' === $tag_name ) {
$name = '';
if ( isset( $attrs['TEXT'] ) ) {
$name = $attrs['TEXT'];
@@ -65,10 +65,10 @@ function startElement( $parser, $tagName, $attrs ) { // phpcs:ignore WordPress.N
* @since 0.71
* @access private
*
- * @param resource $parser XML Parser resource.
- * @param string $tagName XML tag name.
+ * @param resource $parser XML Parser resource.
+ * @param string $tag_name XML tag name.
*/
-function endElement( $parser, $tagName ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
+function endElement( $parser, $tag_name ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
// Nothing to do.
}
diff --git a/wp-admin/link.php b/wp-admin/link.php
index df46e61c3e..1824f80144 100644
--- a/wp-admin/link.php
+++ b/wp-admin/link.php
@@ -35,7 +35,7 @@ switch ( $action ) {
check_admin_referer( 'bulk-bookmarks' );
// For each link id (in $linkcheck[]) change category to selected value.
- if ( count( $linkcheck ) == 0 ) {
+ if ( count( $linkcheck ) === 0 ) {
wp_redirect( $this_file );
exit;
}
@@ -56,7 +56,7 @@ switch ( $action ) {
check_admin_referer( 'bulk-bookmarks' );
// For each link id (in $linkcheck[]) change category to selected value.
- if ( count( $linkcheck ) == 0 ) {
+ if ( count( $linkcheck ) === 0 ) {
wp_redirect( $this_file );
exit;
}
diff --git a/wp-admin/load-styles.php b/wp-admin/load-styles.php
index 7c3d083878..df0cf1809a 100644
--- a/wp-admin/load-styles.php
+++ b/wp-admin/load-styles.php
@@ -37,7 +37,7 @@ if ( empty( $load ) ) {
exit;
}
-$rtl = ( isset( $_GET['dir'] ) && 'rtl' == $_GET['dir'] );
+$rtl = ( isset( $_GET['dir'] ) && 'rtl' === $_GET['dir'] );
$expires_offset = 31536000; // 1 year.
$out = '';
diff --git a/wp-admin/media-upload.php b/wp-admin/media-upload.php
index 7035f28b88..22764ce49f 100644
--- a/wp-admin/media-upload.php
+++ b/wp-admin/media-upload.php
@@ -29,11 +29,11 @@ wp_enqueue_script( 'media-gallery' );
header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
// IDs should be integers.
-$ID = isset( $ID ) ? (int) $ID : 0;
+$ID = isset( $ID ) ? (int) $ID : 0; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
$post_id = isset( $post_id ) ? (int) $post_id : 0;
// Require an ID for the edit screen.
-if ( isset( $action ) && 'edit' == $action && ! $ID ) {
+if ( isset( $action ) && 'edit' === $action && ! $ID ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
wp_die(
'
' . __( 'Something went wrong.' ) . ' ' .
'
' . __( 'Invalid item ID.' ) . '
',
@@ -81,7 +81,7 @@ if ( isset( $_GET['tab'] ) ) {
$body_id = 'media-upload';
// Let the action code decide how to handle the request.
-if ( 'type' == $tab || 'type_url' == $tab || ! array_key_exists( $tab, media_upload_tabs() ) ) {
+if ( 'type' === $tab || 'type_url' === $tab || ! array_key_exists( $tab, media_upload_tabs() ) ) {
/**
* Fires inside specific upload-type views in the legacy (pre-3.5.0)
* media popup based on the current tab.
diff --git a/wp-admin/media.php b/wp-admin/media.php
index 83b35e9448..4e325a7e3c 100644
--- a/wp-admin/media.php
+++ b/wp-admin/media.php
@@ -29,7 +29,7 @@ switch ( $action ) {
$location = 'media.php';
$referer = wp_get_original_referer();
if ( $referer ) {
- if ( false !== strpos( $referer, 'upload.php' ) || ( url_to_postid( $referer ) == $attachment_id ) ) {
+ if ( false !== strpos( $referer, 'upload.php' ) || ( url_to_postid( $referer ) === $attachment_id ) ) {
$location = $referer;
}
}
@@ -69,7 +69,7 @@ switch ( $action ) {
if ( 'attachment' !== $att->post_type ) {
wp_die( __( 'You attempted to edit an item that isn’t an attachment. Please go back and try again.' ) );
}
- if ( 'trash' == $att->post_status ) {
+ if ( 'trash' === $att->post_status ) {
wp_die( __( 'You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.' ) );
}
diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php
index 175a365d6b..5bcffe2bd4 100644
--- a/wp-admin/menu-header.php
+++ b/wp-admin/menu-header.php
@@ -88,7 +88,7 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$submenu_items = $submenu[ $item[2] ];
}
- if ( ( $parent_file && $item[2] == $parent_file ) || ( empty( $typenow ) && $self == $item[2] ) ) {
+ if ( ( $parent_file && $item[2] === $parent_file ) || ( empty( $typenow ) && $self === $item[2] ) ) {
if ( ! empty( $submenu_items ) ) {
$class[] = 'wp-has-current-submenu wp-menu-open';
} else {
@@ -154,10 +154,16 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$menu_hook = get_plugin_page_hook( $submenu_items[0][2], $item[2] );
$menu_file = $submenu_items[0][2];
$pos = strpos( $menu_file, '?' );
+
if ( false !== $pos ) {
$menu_file = substr( $menu_file, 0, $pos );
}
- if ( ! empty( $menu_hook ) || ( ( 'index.php' != $submenu_items[0][2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) {
+
+ if ( ! empty( $menu_hook )
+ || ( ( 'index.php' !== $submenu_items[0][2] )
+ && file_exists( WP_PLUGIN_DIR . "/$menu_file" )
+ && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) )
+ ) {
$admin_is_parent = true;
echo "
$arrow ";
} else {
@@ -167,10 +173,16 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$menu_hook = get_plugin_page_hook( $item[2], 'admin.php' );
$menu_file = $item[2];
$pos = strpos( $menu_file, '?' );
+
if ( false !== $pos ) {
$menu_file = substr( $menu_file, 0, $pos );
}
- if ( ! empty( $menu_hook ) || ( ( 'index.php' != $item[2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) {
+
+ if ( ! empty( $menu_hook )
+ || ( ( 'index.php' !== $item[2] )
+ && file_exists( WP_PLUGIN_DIR . "/$menu_file" )
+ && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) )
+ ) {
$admin_is_parent = true;
echo "\n\t
$arrow ";
} else {
@@ -192,14 +204,15 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$class = array();
$aria_attributes = '';
+
if ( $first ) {
$class[] = 'wp-first-item';
$first = false;
}
$menu_file = $item[2];
+ $pos = strpos( $menu_file, '?' );
- $pos = strpos( $menu_file, '?' );
if ( false !== $pos ) {
$menu_file = substr( $menu_file, 0, $pos );
}
@@ -208,15 +221,16 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$self_type = ! empty( $typenow ) ? $self . '?post_type=' . $typenow : 'nothing';
if ( isset( $submenu_file ) ) {
- if ( $submenu_file == $sub_item[2] ) {
+ if ( $submenu_file === $sub_item[2] ) {
$class[] = 'current';
$aria_attributes .= ' aria-current="page"';
}
// If plugin_page is set the parent must either match the current page or not physically exist.
// This allows plugin pages with the same hook to exist under different parents.
} elseif (
- ( ! isset( $plugin_page ) && $self == $sub_item[2] ) ||
- ( isset( $plugin_page ) && $plugin_page == $sub_item[2] && ( $item[2] == $self_type || $item[2] == $self || file_exists( $menu_file ) === false ) )
+ ( ! isset( $plugin_page ) && $self === $sub_item[2] )
+ || ( isset( $plugin_page ) && $plugin_page === $sub_item[2]
+ && ( $item[2] === $self_type || $item[2] === $self || file_exists( $menu_file ) === false ) )
) {
$class[] = 'current';
$aria_attributes .= ' aria-current="page"';
@@ -237,7 +251,11 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$title = wptexturize( $sub_item[0] );
- if ( ! empty( $menu_hook ) || ( ( 'index.php' != $sub_item[2] ) && file_exists( WP_PLUGIN_DIR . "/$sub_file" ) && ! file_exists( ABSPATH . "/wp-admin/$sub_file" ) ) ) {
+ if ( ! empty( $menu_hook )
+ || ( ( 'index.php' !== $sub_item[2] )
+ && file_exists( WP_PLUGIN_DIR . "/$sub_file" )
+ && ! file_exists( ABSPATH . "/wp-admin/$sub_file" ) )
+ ) {
// If admin.php is the current page or if the parent exists as a file in the plugins or admin directory.
if ( ( ! $admin_is_parent && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! is_dir( WP_PLUGIN_DIR . "/{$item[2]}" ) ) || file_exists( $menu_file ) ) {
$sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), $item[2] );
diff --git a/wp-admin/ms-delete-site.php b/wp-admin/ms-delete-site.php
index 28868384c2..817ff93560 100644
--- a/wp-admin/ms-delete-site.php
+++ b/wp-admin/ms-delete-site.php
@@ -17,7 +17,7 @@ if ( ! current_user_can( 'delete_site' ) ) {
wp_die( __( 'Sorry, you are not allowed to delete this site.' ) );
}
-if ( isset( $_GET['h'] ) && '' != $_GET['h'] && false != get_option( 'delete_blog_hash' ) ) {
+if ( isset( $_GET['h'] ) && '' !== $_GET['h'] && false !== get_option( 'delete_blog_hash' ) ) {
if ( hash_equals( get_option( 'delete_blog_hash' ), $_GET['h'] ) ) {
wpmu_delete_blog( get_current_blog_id() );
wp_die(
@@ -42,7 +42,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
echo '
';
echo '
' . esc_html( $title ) . ' ';
-if ( isset( $_POST['action'] ) && 'deleteblog' == $_POST['action'] && isset( $_POST['confirmdelete'] ) && '1' == $_POST['confirmdelete'] ) {
+if ( isset( $_POST['action'] ) && 'deleteblog' === $_POST['action'] && isset( $_POST['confirmdelete'] ) && '1' === $_POST['confirmdelete'] ) {
check_admin_referer( 'delete-blog' );
$hash = wp_generate_password( 20, false );
diff --git a/wp-admin/my-sites.php b/wp-admin/my-sites.php
index 154e591c9a..afbe798cdc 100644
--- a/wp-admin/my-sites.php
+++ b/wp-admin/my-sites.php
@@ -22,7 +22,7 @@ $action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash';
$blogs = get_blogs_of_user( $current_user->ID );
$updated = false;
-if ( 'updateblogsettings' == $action && isset( $_POST['primary_blog'] ) ) {
+if ( 'updateblogsettings' === $action && isset( $_POST['primary_blog'] ) ) {
check_admin_referer( 'update-my-sites' );
$blog = get_site( (int) $_POST['primary_blog'] );
@@ -107,10 +107,12 @@ else :
* @param string $context Context of the setting (global or site-specific). Default 'global'.
*/
$settings_html = apply_filters( 'myblogs_options', '', 'global' );
- if ( '' != $settings_html ) {
+
+ if ( $settings_html ) {
echo '
' . __( 'Global Settings' ) . ' ';
echo $settings_html;
}
+
reset( $blogs );
foreach ( $blogs as $user_blog ) {
@@ -134,10 +136,12 @@ else :
* @param object $user_blog An object containing the site data.
*/
$actions = apply_filters( 'myblogs_blog_actions', $actions, $user_blog );
+
echo "
" . $actions . '
';
/** This filter is documented in wp-admin/my-sites.php */
echo apply_filters( 'myblogs_options', '', $user_blog );
+
echo '';
restore_current_blog();
diff --git a/wp-includes/version.php b/wp-includes/version.php
index bcc1004c99..59511888a2 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
-$wp_version = '5.5-alpha-47784';
+$wp_version = '5.5-alpha-47785';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.