' . __( 'Note:' ) . ' ';
/* translators: %s: mod_rewrite */
printf(
diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php
index 4bce5eb6b8..8e2d61f486 100644
--- a/wp-admin/includes/plugin-install.php
+++ b/wp-admin/includes/plugin-install.php
@@ -160,7 +160,8 @@ function plugins_api( $action, $args = array() ) {
);
$http_url = $url;
- if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
+ $ssl = wp_http_supports( array( 'ssl' ) );
+ if ( $ssl ) {
$url = set_url_scheme( $url, 'https' );
}
@@ -238,8 +239,9 @@ function plugins_api( $action, $args = array() ) {
* @return array
*/
function install_popular_tags( $args = array() ) {
- $key = md5( serialize( $args ) );
- if ( false !== ( $tags = get_site_transient( 'poptags_' . $key ) ) ) {
+ $key = md5( serialize( $args ) );
+ $tags = get_site_transient( 'poptags_' . $key );
+ if ( false !== $tags ) {
return $tags;
}
diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php
index 84faa068da..3b8e545b7f 100644
--- a/wp-admin/includes/plugin.php
+++ b/wp-admin/includes/plugin.php
@@ -152,7 +152,8 @@ function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup
// Translate fields
if ( $translate ) {
- if ( $textdomain = $plugin_data['TextDomain'] ) {
+ $textdomain = $plugin_data['TextDomain'];
+ if ( $textdomain ) {
if ( ! is_textdomain_loaded( $textdomain ) ) {
if ( $plugin_data['DomainPath'] ) {
load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) . $plugin_data['DomainPath'] );
@@ -364,7 +365,8 @@ function get_mu_plugins() {
if ( ! is_dir( WPMU_PLUGIN_DIR ) ) {
return $wp_plugins;
}
- if ( $plugins_dir = @ opendir( WPMU_PLUGIN_DIR ) ) {
+ $plugins_dir = @opendir( WPMU_PLUGIN_DIR );
+ if ( $plugins_dir ) {
while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
if ( substr( $file, -4 ) == '.php' ) {
$plugin_files[] = $file;
@@ -431,7 +433,8 @@ function get_dropins() {
$_dropins = _get_dropins();
// These exist in the wp-content directory
- if ( $plugins_dir = @ opendir( WP_CONTENT_DIR ) ) {
+ $plugins_dir = @opendir( WP_CONTENT_DIR );
+ if ( $plugins_dir ) {
while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
if ( isset( $_dropins[ $file ] ) ) {
$plugin_files[] = $file;
@@ -733,8 +736,9 @@ function deactivate_plugins( $plugins, $silent = false, $network_wide = null ) {
if ( is_multisite() ) {
$network_current = get_site_option( 'active_sitewide_plugins', array() );
}
- $current = get_option( 'active_plugins', array() );
- $do_blog = $do_network = false;
+ $current = get_option( 'active_plugins', array() );
+ $do_blog = false;
+ $do_network = false;
foreach ( (array) $plugins as $plugin ) {
$plugin = plugin_basename( trim( $plugin ) );
@@ -992,7 +996,8 @@ function delete_plugins( $plugins, $deprecated = '' ) {
}
// Remove deleted plugins from the plugin updates list.
- if ( $current = get_site_transient( 'update_plugins' ) ) {
+ $current = get_site_transient( 'update_plugins' );
+ if ( $current ) {
// Don't remove the plugins that weren't deleted.
$deleted = array_diff( $plugins, $errors );
@@ -1819,7 +1824,8 @@ function get_admin_page_title() {
$hook = get_plugin_page_hook( $plugin_page, $pagenow );
- $parent = $parent1 = get_admin_page_parent();
+ $parent = get_admin_page_parent();
+ $parent1 = $parent;
if ( empty( $parent ) ) {
foreach ( (array) $menu as $menu_array ) {
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index 8e31335944..6d884e1681 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -339,7 +339,8 @@ function edit_post( $post_data = null ) {
// Meta Stuff
if ( isset( $post_data['meta'] ) && $post_data['meta'] ) {
foreach ( $post_data['meta'] as $key => $value ) {
- if ( ! $meta = get_post_meta_by_id( $key ) ) {
+ $meta = get_post_meta_by_id( $key );
+ if ( ! $meta ) {
continue;
}
if ( $meta->post_id != $post_ID ) {
@@ -357,7 +358,8 @@ function edit_post( $post_data = null ) {
if ( isset( $post_data['deletemeta'] ) && $post_data['deletemeta'] ) {
foreach ( $post_data['deletemeta'] as $key => $value ) {
- if ( ! $meta = get_post_meta_by_id( $key ) ) {
+ $meta = get_post_meta_by_id( $key );
+ if ( ! $meta ) {
continue;
}
if ( $meta->post_id != $post_ID ) {
@@ -531,7 +533,8 @@ function bulk_edit_posts( $post_data = null ) {
}
}
- if ( isset( $post_data['post_parent'] ) && ( $parent = (int) $post_data['post_parent'] ) ) {
+ if ( isset( $post_data['post_parent'] ) && (int) $post_data['post_parent'] ) {
+ $parent = (int) $post_data['post_parent'];
$pages = $wpdb->get_results( "SELECT ID, post_parent FROM $wpdb->posts WHERE post_type = 'page'" );
$children = array();
@@ -547,7 +550,9 @@ function bulk_edit_posts( $post_data = null ) {
}
}
- $updated = $skipped = $locked = array();
+ $updated = array();
+ $skipped = array();
+ $locked = array();
$shared_post_data = $post_data;
foreach ( $post_IDs as $post_ID ) {
@@ -1281,7 +1286,8 @@ function wp_edit_attachments_query( $q = false ) {
function postbox_classes( $box_id, $screen_id ) {
if ( isset( $_GET['edit'] ) && $_GET['edit'] == $box_id ) {
$classes = array( '' );
- } elseif ( $closed = get_user_option( 'closedpostboxes_' . $screen_id ) ) {
+ } elseif ( get_user_option( 'closedpostboxes_' . $screen_id ) ) {
+ $closed = get_user_option( 'closedpostboxes_' . $screen_id );
if ( ! is_array( $closed ) ) {
$classes = array( '' );
} else {
@@ -1556,11 +1562,13 @@ function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) {
* the user with lock does not exist, or the post is locked by current user.
*/
function wp_check_post_lock( $post_id ) {
- if ( ! $post = get_post( $post_id ) ) {
+ $post = get_post( $post_id );
+ if ( ! $post ) {
return false;
}
- if ( ! $lock = get_post_meta( $post->ID, '_edit_lock', true ) ) {
+ $lock = get_post_meta( $post->ID, '_edit_lock', true );
+ if ( ! $lock ) {
return false;
}
@@ -1592,11 +1600,13 @@ function wp_check_post_lock( $post_id ) {
* there is no current user.
*/
function wp_set_post_lock( $post_id ) {
- if ( ! $post = get_post( $post_id ) ) {
+ $post = get_post( $post_id );
+ if ( ! $post ) {
return false;
}
- if ( 0 == ( $user_id = get_current_user_id() ) ) {
+ $user_id = get_current_user_id();
+ if ( 0 == $user_id ) {
return false;
}
@@ -1615,12 +1625,14 @@ function wp_set_post_lock( $post_id ) {
* @return none
*/
function _admin_notice_post_locked() {
- if ( ! $post = get_post() ) {
+ $post = get_post();
+ if ( ! $post ) {
return;
}
- $user = null;
- if ( $user_id = wp_check_post_lock( $post->ID ) ) {
+ $user = null;
+ $user_id = wp_check_post_lock( $post->ID );
+ if ( $user_id ) {
$user = get_userdata( $user_id );
}
@@ -1646,8 +1658,8 @@ function _admin_notice_post_locked() {
$locked = false;
}
- if ( $locked && ( $sendback = wp_get_referer() ) &&
- false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) {
+ $sendback = wp_get_referer();
+ if ( $locked && $sendback && false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) {
$sendback_text = __( 'Go back' );
} else {
@@ -1793,7 +1805,8 @@ function wp_create_post_autosave( $post_data ) {
$post_author = get_current_user_id();
// Store one autosave per author. If there is already an autosave, overwrite it.
- if ( $old_autosave = wp_get_post_autosave( $post_id, $post_author ) ) {
+ $old_autosave = wp_get_post_autosave( $post_id, $post_author );
+ if ( $old_autosave ) {
$new_autosave = _wp_post_revision_data( $post_data, true );
$new_autosave['ID'] = $old_autosave->ID;
$new_autosave['post_author'] = $post_author;
@@ -1844,7 +1857,8 @@ function post_preview() {
$post_ID = (int) $_POST['post_ID'];
$_POST['ID'] = $post_ID;
- if ( ! $post = get_post( $post_ID ) ) {
+ $post = get_post( $post_ID );
+ if ( ! $post ) {
wp_die( __( 'Sorry, you are not allowed to edit this post.' ) );
}
@@ -1905,8 +1919,9 @@ function wp_autosave( $post_data ) {
define( 'DOING_AUTOSAVE', true );
}
- $post_id = (int) $post_data['post_id'];
- $post_data['ID'] = $post_data['post_ID'] = $post_id;
+ $post_id = (int) $post_data['post_id'];
+ $post_data['ID'] = $post_id;
+ $post_data['post_ID'] = $post_id;
if ( false === wp_verify_nonce( $post_data['_wpnonce'], 'update-post_' . $post_id ) ) {
return new WP_Error( 'invalid_nonce', __( 'Error while saving.' ) );
diff --git a/wp-admin/includes/revision.php b/wp-admin/includes/revision.php
index 1f03ae7108..6569128270 100644
--- a/wp-admin/includes/revision.php
+++ b/wp-admin/includes/revision.php
@@ -20,12 +20,14 @@
* Or, false on failure.
*/
function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
- if ( ! $post = get_post( $post ) ) {
+ $post = get_post( $post );
+ if ( ! $post ) {
return false;
}
if ( $compare_from ) {
- if ( ! $compare_from = get_post( $compare_from ) ) {
+ $compare_from = get_post( $compare_from );
+ if ( ! $compare_from ) {
return false;
}
} else {
@@ -33,7 +35,8 @@ function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
$compare_from = false;
}
- if ( ! $compare_to = get_post( $compare_to ) ) {
+ $compare_to = get_post( $compare_to );
+ if ( ! $compare_to ) {
return false;
}
diff --git a/wp-admin/includes/taxonomy.php b/wp-admin/includes/taxonomy.php
index 62988c3b99..182231b683 100644
--- a/wp-admin/includes/taxonomy.php
+++ b/wp-admin/includes/taxonomy.php
@@ -53,7 +53,8 @@ function get_category_to_edit( $id ) {
* @return int|WP_Error
*/
function wp_create_category( $cat_name, $parent = 0 ) {
- if ( $id = category_exists( $cat_name, $parent ) ) {
+ $id = category_exists( $cat_name, $parent );
+ if ( $id ) {
return $id;
}
@@ -77,10 +78,14 @@ function wp_create_category( $cat_name, $parent = 0 ) {
function wp_create_categories( $categories, $post_id = '' ) {
$cat_ids = array();
foreach ( $categories as $category ) {
- if ( $id = category_exists( $category ) ) {
- $cat_ids[] = $id;
- } elseif ( $id = wp_create_category( $category ) ) {
+ $id = category_exists( $category );
+ if ( $id ) {
$cat_ids[] = $id;
+ } else {
+ $id = wp_create_category( $category );
+ if ( $id ) {
+ $cat_ids[] = $id;
+ }
}
}
@@ -300,7 +305,8 @@ function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
* @return array|WP_Error
*/
function wp_create_term( $tag_name, $taxonomy = 'post_tag' ) {
- if ( $id = term_exists( $tag_name, $taxonomy ) ) {
+ $id = term_exists( $tag_name, $taxonomy );
+ if ( $id ) {
return $id;
}
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index d8c23ccec4..c9b9b6f155 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -1212,7 +1212,8 @@ function do_meta_boxes( $screen, $context, $object ) {
printf( '
', esc_attr( $context ) );
// Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
- if ( ! $already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) {
+ $sorted = get_user_option( "meta-box-order_$page" );
+ if ( ! $already_sorted && $sorted ) {
foreach ( $sorted as $box_context => $ids ) {
foreach ( explode( ',', $ids ) as $id ) {
if ( $id && 'dashboard_browser_nag' !== $id ) {
diff --git a/wp-admin/includes/theme-install.php b/wp-admin/includes/theme-install.php
index 219295f976..267ae26a94 100644
--- a/wp-admin/includes/theme-install.php
+++ b/wp-admin/includes/theme-install.php
@@ -62,7 +62,8 @@ $theme_field_defaults = array(
function install_themes_feature_list() {
_deprecated_function( __FUNCTION__, '3.1.0', 'get_theme_feature_list()' );
- if ( ! $cache = get_transient( 'wporg_theme_feature_list' ) ) {
+ $cache = get_transient( 'wporg_theme_feature_list' );
+ if ( ! $cache ) {
set_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS );
}
diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php
index 5be1b9f6dc..97a02fd25e 100644
--- a/wp-admin/includes/theme.php
+++ b/wp-admin/includes/theme.php
@@ -303,7 +303,8 @@ function get_theme_feature_list( $api = true ) {
return $features;
}
- if ( ! $feature_list = get_site_transient( 'wporg_theme_feature_list' ) ) {
+ $feature_list = get_site_transient( 'wporg_theme_feature_list' );
+ if ( ! $feature_list ) {
set_site_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS );
}
@@ -490,7 +491,8 @@ function themes_api( $action, $args = array() ) {
);
$http_url = $url;
- if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
+ $ssl = wp_http_supports( array( 'ssl' ) );
+ if ( $ssl ) {
$url = set_url_scheme( $url, 'https' );
}
diff --git a/wp-admin/includes/translation-install.php b/wp-admin/includes/translation-install.php
index 6e8f4b698e..a7b834a27f 100644
--- a/wp-admin/includes/translation-install.php
+++ b/wp-admin/includes/translation-install.php
@@ -35,8 +35,10 @@ function translations_api( $type, $args = null ) {
$res = apply_filters( 'translations_api', false, $type, $args );
if ( false === $res ) {
- $url = $http_url = 'http://api.wordpress.org/translations/' . $type . '/1.0/';
- if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
+ $url = 'http://api.wordpress.org/translations/' . $type . '/1.0/';
+ $http_url = $url;
+ $ssl = wp_http_supports( array( 'ssl' ) );
+ if ( $ssl ) {
$url = set_url_scheme( $url, 'https' );
}
@@ -117,8 +119,11 @@ function translations_api( $type, $args = null ) {
* in an error, an empty array will be returned.
*/
function wp_get_available_translations() {
- if ( ! wp_installing() && false !== ( $translations = get_site_transient( 'available_translations' ) ) ) {
- return $translations;
+ if ( ! wp_installing() ) {
+ $translations = get_site_transient( 'available_translations' );
+ if ( false !== $translations ) {
+ return $translations;
+ }
}
include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php
index 03c98733cb..cb24378ba7 100644
--- a/wp-admin/includes/update.php
+++ b/wp-admin/includes/update.php
@@ -116,9 +116,11 @@ function find_core_auto_update() {
* @return bool|array False on failure. An array of checksums on success.
*/
function get_core_checksums( $version, $locale ) {
- $url = $http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), null, '&' );
+ $http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), null, '&' );
+ $url = $http_url;
- if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
+ $ssl = wp_http_supports( array( 'ssl' ) );
+ if ( $ssl ) {
$url = set_url_scheme( $url, 'https' );
}
diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php
index d150ed3644..6b9a351a94 100644
--- a/wp-admin/includes/upgrade.php
+++ b/wp-admin/includes/upgrade.php
@@ -1260,7 +1260,8 @@ function upgrade_230() {
$term_group = 0;
// Associate terms with the same slug in a term group and make slugs unique.
- if ( $exists = $wpdb->get_results( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug ) ) ) {
+ $exists = $wpdb->get_results( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug ) );
+ if ( $exists ) {
$term_group = $exists[0]->term_group;
$id = $exists[0]->term_id;
$num = 2;
@@ -1365,7 +1366,8 @@ function upgrade_230() {
$term_group = 0;
// Associate terms with the same slug in a term group and make slugs unique.
- if ( $exists = $wpdb->get_results( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug ) ) ) {
+ $exists = $wpdb->get_results( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug ) );
+ if ( $exists ) {
$term_group = $exists[0]->term_group;
$term_id = $exists[0]->term_id;
}
@@ -1823,8 +1825,11 @@ function upgrade_350() {
}
}
- if ( $wp_current_db_version < 22422 && $term = get_term_by( 'slug', 'post-format-standard', 'post_format' ) ) {
- wp_delete_term( $term->term_id, 'post_format' );
+ if ( $wp_current_db_version < 22422 ) {
+ $term = get_term_by( 'slug', 'post-format-standard', 'post_format' );
+ if ( $term ) {
+ wp_delete_term( $term->term_id, 'post_format' );
+ }
}
}
@@ -2430,7 +2435,8 @@ function maybe_convert_table_to_utf8mb4( $table ) {
function get_alloptions_110() {
global $wpdb;
$all_options = new stdClass;
- if ( $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ) ) {
+ $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
+ if ( $options ) {
foreach ( $options as $option ) {
if ( 'siteurl' == $option->option_name || 'home' == $option->option_name || 'category_base' == $option->option_name ) {
$option->option_value = untrailingslashit( $option->option_value );
@@ -2607,7 +2613,9 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
}
// Clear the field and index arrays.
- $cfields = $indices = $indices_without_subparts = array();
+ $cfields = array();
+ $indices = array();
+ $indices_without_subparts = array();
// Get all of the field names in the query from between the parentheses.
preg_match( '|\((.*)\)|ms', $qry, $match2 );
@@ -2682,7 +2690,8 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
$index_name = ( 'PRIMARY KEY' === $index_type ) ? '' : '`' . strtolower( $index_matches['index_name'] ) . '`';
// Parse the columns. Multiple columns are separated by a comma.
- $index_columns = $index_columns_without_subparts = array_map( 'trim', explode( ',', $index_matches['index_columns'] ) );
+ $index_columns = array_map( 'trim', explode( ',', $index_matches['index_columns'] ) );
+ $index_columns_without_subparts = $index_columns;
// Normalize columns.
foreach ( $index_columns as $id => &$index_column ) {
@@ -2852,7 +2861,8 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
$index_string .= " ($index_columns)";
// Check if the index definition exists, ignoring subparts.
- if ( ! ( ( $aindex = array_search( $index_string, $indices_without_subparts ) ) === false ) ) {
+ $aindex = array_search( $index_string, $indices_without_subparts );
+ if ( false !== $aindex ) {
// If the index already exists (even with different subparts), we don't need to create it.
unset( $indices_without_subparts[ $aindex ] );
unset( $indices[ $aindex ] );
diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php
index e4b5534c3e..94590c3b98 100644
--- a/wp-admin/includes/user.php
+++ b/wp-admin/includes/user.php
@@ -44,7 +44,8 @@ function edit_user( $user_id = 0 ) {
$user->user_login = sanitize_user( $_POST['user_login'], true );
}
- $pass1 = $pass2 = '';
+ $pass1 = '';
+ $pass2 = '';
if ( isset( $_POST['pass1'] ) ) {
$pass1 = $_POST['pass1'];
}
@@ -201,8 +202,11 @@ function edit_user( $user_id = 0 ) {
$errors->add( 'empty_email', __( 'ERROR: Please enter an email address.' ), array( 'form-field' => 'email' ) );
} elseif ( ! is_email( $user->user_email ) ) {
$errors->add( 'invalid_email', __( 'ERROR: The email address isn’t correct.' ), array( 'form-field' => 'email' ) );
- } elseif ( ( $owner_id = email_exists( $user->user_email ) ) && ( ! $update || ( $owner_id != $user->ID ) ) ) {
- $errors->add( 'email_exists', __( 'ERROR: This email is already registered, please choose another one.' ), array( 'form-field' => 'email' ) );
+ } else {
+ $owner_id = email_exists( $user->user_email );
+ if ( $owner_id && ( ! $update || ( $owner_id != $user->ID ) ) ) {
+ $errors->add( 'email_exists', __( 'ERROR: This email is already registered, please choose another one.' ), array( 'form-field' => 'email' ) );
+ }
}
/**
diff --git a/wp-admin/includes/widgets.php b/wp-admin/includes/widgets.php
index e16d459cb1..f3ad9fd303 100644
--- a/wp-admin/includes/widgets.php
+++ b/wp-admin/includes/widgets.php
@@ -299,7 +299,10 @@ function wp_widget_control( $sidebar_args ) {
-
+
';
- wp_install_language_form( $languages );
- echo '';
- break;
+ if ( wp_can_install_language_pack() && empty( $language ) ) {
+ $languages = wp_get_available_translations();
+ if ( $languages ) {
+ $scripts_to_print[] = 'language-chooser';
+ display_header( 'language-chooser' );
+ echo '
';
+ break;
+ }
}
// Deliberately fall through if we can't reach the translations API.
diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php
index fb0f881753..51ae234b1b 100644
--- a/wp-admin/link-manager.php
+++ b/wp-admin/link-manager.php
@@ -44,8 +44,9 @@ if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) {
$wp_list_table->prepare_items();
-$title = __( 'Links' );
-$this_file = $parent_file = 'link-manager.php';
+$title = __( 'Links' );
+$this_file = 'link-manager.php';
+$parent_file = $this_file;
get_current_screen()->add_help_tab(
array(
diff --git a/wp-admin/link.php b/wp-admin/link.php
index ed293bc80b..ef5b26a515 100644
--- a/wp-admin/link.php
+++ b/wp-admin/link.php
@@ -112,7 +112,8 @@ switch ( $action ) {
$link_id = (int) $_GET['link_id'];
- if ( ! $link = get_link_to_edit( $link_id ) ) {
+ $link = get_link_to_edit( $link_id );
+ if ( ! $link ) {
wp_die( __( 'Link not found.' ) );
}
diff --git a/wp-admin/media.php b/wp-admin/media.php
index 1984b51d66..b02d37f441 100644
--- a/wp-admin/media.php
+++ b/wp-admin/media.php
@@ -27,7 +27,8 @@ switch ( $action ) {
if ( empty( $errors ) ) {
$location = 'media.php';
- if ( $referer = wp_get_original_referer() ) {
+ $referer = wp_get_original_referer();
+ if ( $referer ) {
if ( false !== strpos( $referer, 'upload.php' ) || ( url_to_postid( $referer ) == $attachment_id ) ) {
$location = $referer;
}
diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php
index fee5d3dbe0..6efd0994c8 100644
--- a/wp-admin/menu-header.php
+++ b/wp-admin/menu-header.php
@@ -108,7 +108,8 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
$id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : '';
- $img = $img_style = '';
+ $img = '';
+ $img_style = '';
$img_class = ' dashicons-before';
if ( false !== strpos( $class, 'wp-menu-separator' ) ) {
@@ -152,7 +153,8 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$submenu_items = array_values( $submenu_items ); // Re-index.
$menu_hook = get_plugin_page_hook( $submenu_items[0][2], $item[2] );
$menu_file = $submenu_items[0][2];
- if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) {
+ $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" ) ) ) {
@@ -164,7 +166,8 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
} elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) {
$menu_hook = get_plugin_page_hook( $item[2], 'admin.php' );
$menu_file = $item[2];
- if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) {
+ $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" ) ) ) {
@@ -196,7 +199,8 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$menu_file = $item[2];
- if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) {
+ $pos = strpos( $menu_file, '?' );
+ if ( false !== $pos ) {
$menu_file = substr( $menu_file, 0, $pos );
}
@@ -226,7 +230,8 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$menu_hook = get_plugin_page_hook( $sub_item[2], $item[2] );
$sub_file = $sub_item[2];
- if ( false !== ( $pos = strpos( $sub_file, '?' ) ) ) {
+ $pos = strpos( $sub_file, '?' );
+ if ( false !== $pos ) {
$sub_file = substr( $sub_file, 0, $pos );
}
diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php
index ff50e6fbd4..93ebb71164 100644
--- a/wp-admin/options-general.php
+++ b/wp-admin/options-general.php
@@ -73,7 +73,8 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
array(
'blogname',
'blogdescription',
@@ -146,7 +146,9 @@ $whitelist_options = array(
'default_post_format',
),
);
-$whitelist_options['misc'] = $whitelist_options['options'] = $whitelist_options['privacy'] = array();
+$whitelist_options['misc'] = array();
+$whitelist_options['options'] = array();
+$whitelist_options['privacy'] = array();
$mail_options = array( 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass' );
diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php
index c888cddaf3..02555a3516 100644
--- a/wp-admin/plugins.php
+++ b/wp-admin/plugins.php
@@ -291,7 +291,8 @@ if ( $action ) {
$plugin_slug = dirname( $plugin );
if ( '.' == $plugin_slug ) {
- if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) {
+ $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
+ if ( $data ) {
$plugin_info[ $plugin ] = $data;
$plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
if ( ! $plugin_info[ $plugin ]['Network'] ) {
@@ -300,7 +301,8 @@ if ( $action ) {
}
} else {
// Get plugins list from that folder.
- if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) {
+ $folder_plugins = get_plugins( '/' . $plugin_slug );
+ if ( $folder_plugins ) {
foreach ( $folder_plugins as $plugin_file => $data ) {
$plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data );
$plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
diff --git a/wp-admin/post.php b/wp-admin/post.php
index 22624dfce2..640a3c36da 100644
--- a/wp-admin/post.php
+++ b/wp-admin/post.php
@@ -19,12 +19,13 @@ wp_reset_vars( array( 'action' ) );
if ( isset( $_GET['post'] ) && isset( $_POST['post_ID'] ) && (int) $_GET['post'] !== (int) $_POST['post_ID'] ) {
wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
} elseif ( isset( $_GET['post'] ) ) {
- $post_id = $post_ID = (int) $_GET['post'];
+ $post_id = (int) $_GET['post'];
} elseif ( isset( $_POST['post_ID'] ) ) {
- $post_id = $post_ID = (int) $_POST['post_ID'];
+ $post_id = (int) $_POST['post_ID'];
} else {
- $post_id = $post_ID = 0;
+ $post_id = 0;
}
+$post_ID = $post_id;
/**
* @global string $post_type
@@ -241,7 +242,8 @@ switch ( $action ) {
wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
}
- if ( $user_id = wp_check_post_lock( $post_id ) ) {
+ $user_id = wp_check_post_lock( $post_id );
+ if ( $user_id ) {
$user = get_userdata( $user_id );
wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
}
diff --git a/wp-admin/revision.php b/wp-admin/revision.php
index 79338d6359..c5cece4cc6 100644
--- a/wp-admin/revision.php
+++ b/wp-admin/revision.php
@@ -33,7 +33,8 @@ $redirect = 'edit.php';
switch ( $action ) {
case 'restore':
- if ( ! $revision = wp_get_post_revision( $revision_id ) ) {
+ $revision = wp_get_post_revision( $revision_id );
+ if ( ! $revision ) {
break;
}
@@ -41,7 +42,8 @@ switch ( $action ) {
break;
}
- if ( ! $post = get_post( $revision->post_parent ) ) {
+ $post = get_post( $revision->post_parent );
+ if ( ! $post ) {
break;
}
@@ -70,10 +72,13 @@ switch ( $action ) {
case 'view':
case 'edit':
default:
- if ( ! $revision = wp_get_post_revision( $revision_id ) ) {
+ $revision = wp_get_post_revision( $revision_id );
+ if ( ! $revision ) {
break;
}
- if ( ! $post = get_post( $revision->post_parent ) ) {
+
+ $post = get_post( $revision->post_parent );
+ if ( ! $post ) {
break;
}
@@ -110,10 +115,11 @@ if ( ! empty( $redirect ) ) {
// This is so that the correct "Edit" menu item is selected.
if ( ! empty( $post->post_type ) && 'post' != $post->post_type ) {
- $parent_file = $submenu_file = 'edit.php?post_type=' . $post->post_type;
+ $parent_file = 'edit.php?post_type=' . $post->post_type;
} else {
- $parent_file = $submenu_file = 'edit.php';
+ $parent_file = 'edit.php';
}
+$submenu_file = $parent_file;
wp_enqueue_script( 'revisions' );
wp_localize_script( 'revisions', '_wpRevisionsSettings', wp_prepare_revisions_for_js( $post, $revision_id, $from ) );
diff --git a/wp-admin/setup-config.php b/wp-admin/setup-config.php
index cab6ab8101..226b551ffb 100644
--- a/wp-admin/setup-config.php
+++ b/wp-admin/setup-config.php
@@ -126,13 +126,16 @@ if ( ! empty( $_REQUEST['language'] ) ) {
switch ( $step ) {
case -1:
- if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
- setup_config_display_header( 'language-chooser' );
- echo '
Select a default language
';
- echo '
';
- break;
+ if ( wp_can_install_language_pack() && empty( $language ) ) {
+ $languages = wp_get_available_translations();
+ if ( $languages ) {
+ setup_config_display_header( 'language-chooser' );
+ echo '
Select a default language
';
+ echo '
';
+ break;
+ }
}
// Deliberately fall through if we can't reach the translations API.
diff --git a/wp-admin/theme-editor.php b/wp-admin/theme-editor.php
index f845f5eed8..186d54fbbe 100644
--- a/wp-admin/theme-editor.php
+++ b/wp-admin/theme-editor.php
@@ -73,7 +73,8 @@ if ( $theme->errors() && 'theme_no_stylesheet' == $theme->errors()->get_error_co
wp_die( __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() );
}
-$allowed_files = $style_files = array();
+$allowed_files = array();
+$style_files = array();
$has_templates = false;
$file_types = wp_get_theme_file_editable_extensions( $theme );
diff --git a/wp-admin/themes.php b/wp-admin/themes.php
index 9561cfe602..ec85f3ed4e 100644
--- a/wp-admin/themes.php
+++ b/wp-admin/themes.php
@@ -268,7 +268,8 @@ if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) {
}
}
- if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) {
+ $pos = strpos( $menu_file, '?' );
+ if ( false !== $pos ) {
$menu_file = substr( $menu_file, 0, $pos );
}
@@ -368,7 +369,8 @@ foreach ( $themes as $theme ) :
true ) ) ) {
+$broken_themes = wp_get_themes( array( 'errors' => true ) );
+if ( ! is_multisite() && current_user_can( 'edit_themes' ) && $broken_themes ) {
?>
diff --git a/wp-admin/update-core.php b/wp-admin/update-core.php
index 779398429f..d88f1376a7 100644
--- a/wp-admin/update-core.php
+++ b/wp-admin/update-core.php
@@ -35,15 +35,17 @@ function list_core_update( $update ) {
global $wp_local_package, $wpdb;
static $first_pass = true;
- $wp_version = get_bloginfo( 'version' );
+ $wp_version = get_bloginfo( 'version' );
+ $version_string = sprintf( '%s–%s', $update->current, $update->locale );
if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) {
$version_string = $update->current;
- } elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) {
- // If the only available update is a partial builds, it doesn't need a language-specific version string.
- $version_string = $update->current;
- } else {
- $version_string = sprintf( '%s–%s', $update->current, $update->locale );
+ } elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version ) {
+ $updates = get_core_updates();
+ if ( $updates && 1 == count( $updates ) ) {
+ // If the only available update is a partial builds, it doesn't need a language-specific version string.
+ $version_string = $update->current;
+ }
}
$current = false;
@@ -537,7 +539,8 @@ function do_core_upgrade( $reinstall = false ) {
';
return;
}
diff --git a/wp-admin/upload.php b/wp-admin/upload.php
index c2c59c7f13..6f998ef4a6 100644
--- a/wp-admin/upload.php
+++ b/wp-admin/upload.php
@@ -130,7 +130,8 @@ if ( $doaction ) {
}
$location = 'upload.php';
- if ( $referer = wp_get_referer() ) {
+ $referer = wp_get_referer();
+ if ( $referer ) {
if ( false !== strpos( $referer, 'upload.php' ) ) {
$location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer );
}
@@ -286,7 +287,8 @@ if ( ! empty( $_GET['posted'] ) ) {
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'posted' ), $_SERVER['REQUEST_URI'] );
}
-if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) {
+if ( ! empty( $_GET['attached'] ) && absint( $_GET['attached'] ) ) {
+ $attached = absint( $_GET['attached'] );
if ( 1 == $attached ) {
$message = __( 'Media file attached.' );
} else {
@@ -297,7 +299,8 @@ if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) {
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
}
-if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) {
+if ( ! empty( $_GET['detach'] ) && absint( $_GET['detach'] ) ) {
+ $detached = absint( $_GET['detach'] );
if ( 1 == $detached ) {
$message = __( 'Media file detached.' );
} else {
@@ -308,7 +311,8 @@ if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) {
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
}
-if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) {
+if ( ! empty( $_GET['deleted'] ) && absint( $_GET['deleted'] ) ) {
+ $deleted = absint( $_GET['deleted'] );
if ( 1 == $deleted ) {
$message = __( 'Media file permanently deleted.' );
} else {
@@ -319,7 +323,8 @@ if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) {
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER['REQUEST_URI'] );
}
-if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) {
+if ( ! empty( $_GET['trashed'] ) && absint( $_GET['trashed'] ) ) {
+ $trashed = absint( $_GET['trashed'] );
if ( 1 == $trashed ) {
$message = __( 'Media file moved to the trash.' );
} else {
@@ -331,7 +336,8 @@ if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) {
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'trashed' ), $_SERVER['REQUEST_URI'] );
}
-if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) {
+if ( ! empty( $_GET['untrashed'] ) && absint( $_GET['untrashed'] ) ) {
+ $untrashed = absint( $_GET['untrashed'] );
if ( 1 == $untrashed ) {
$message = __( 'Media file restored from the trash.' );
} else {
diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php
index c7d728cda1..8fe3af379d 100644
--- a/wp-admin/user-edit.php
+++ b/wp-admin/user-edit.php
@@ -602,7 +602,8 @@ endif; //!IS_PROFILE_PAGE
* @param bool $show Whether to show the password fields. Default true.
* @param WP_User $profileuser User object for the current user to edit.
*/
- if ( $show_password_fields = apply_filters( 'show_password_fields', true, $profileuser ) ) :
+ $show_password_fields = apply_filters( 'show_password_fields', true, $profileuser );
+ if ( $show_password_fields ) :
?>