From 5deee712731bfedff8796ff5232444ed883240f0 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 16 Jan 2015 21:18:52 +0000 Subject: [PATCH] Remove unused local vars in `delete_plugins()`, `delete_theme()`, `WP_Date_Query->validate_date_values()`, `global_terms()`, and `WP_Text_Diff_Renderer_Table->_changed()`. This will clear out the "Unused Code" label in the next Scrutinizer report. See #30799. git-svn-id: https://develop.svn.wordpress.org/trunk@31217 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/plugin.php | 3 --- src/wp-admin/includes/theme.php | 3 --- src/wp-includes/date.php | 1 - src/wp-includes/ms-functions.php | 8 +++++--- src/wp-includes/wp-diff.php | 2 +- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php index c0d44ff6fc..bb16117fb7 100644 --- a/src/wp-admin/includes/plugin.php +++ b/src/wp-admin/includes/plugin.php @@ -805,9 +805,6 @@ function delete_plugins( $plugins, $deprecated = '' ) { $plugins_dir = trailingslashit( $plugins_dir ); - $translations_dir = $wp_filesystem->wp_lang_dir(); - $translations_dir = trailingslashit( $translations_dir ); - $plugin_translations = wp_get_installed_translations( 'plugins' ); $errors = array(); diff --git a/src/wp-admin/includes/theme.php b/src/wp-admin/includes/theme.php index a6b9fb031a..2c3a8276d6 100644 --- a/src/wp-admin/includes/theme.php +++ b/src/wp-admin/includes/theme.php @@ -69,9 +69,6 @@ function delete_theme($stylesheet, $redirect = '') { return new WP_Error( 'could_not_remove_theme', sprintf( __( 'Could not fully remove the theme %s.' ), $stylesheet ) ); } - $translations_dir = $wp_filesystem->wp_lang_dir(); - $translations_dir = trailingslashit( $translations_dir ); - $theme_translations = wp_get_installed_translations( 'themes' ); // Remove language files, silently. diff --git a/src/wp-includes/date.php b/src/wp-includes/date.php index d2c8f6971d..58071d3d3a 100644 --- a/src/wp-includes/date.php +++ b/src/wp-includes/date.php @@ -391,7 +391,6 @@ class WP_Date_Query { } // Throw a notice for each failing value. - $is_between = true; foreach ( (array) $date_query[ $key ] as $_value ) { $is_between = $_value >= $check['min'] && $_value <= $check['max']; diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php index 92af129c04..f2df7e327c 100644 --- a/src/wp-includes/ms-functions.php +++ b/src/wp-includes/ms-functions.php @@ -1805,10 +1805,12 @@ function global_terms( $term_id, $deprecated = '' ) { } } elseif ( $global_id != $term_id ) { $local_id = $wpdb->get_row( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms WHERE term_id = %d", $global_id ) ); - if ( null != $local_id ) - $local_id = global_terms( $local_id ); - if ( 10 < $global_terms_recurse ) + if ( null != $local_id ) { + global_terms( $local_id ); + if ( 10 < $global_terms_recurse ) { $global_id = $term_id; + } + } } if ( $global_id != $term_id ) { diff --git a/src/wp-includes/wp-diff.php b/src/wp-includes/wp-diff.php index aa6ada8c35..95fa9dcf87 100644 --- a/src/wp-includes/wp-diff.php +++ b/src/wp-includes/wp-diff.php @@ -273,7 +273,7 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer { $diff = $renderer->render( $text_diff ); // If they're too different, don't include any or - if ( $diff_count = preg_match_all( '!(.*?|.*?)!', $diff, $diff_matches ) ) { + if ( preg_match_all( '!(.*?|.*?)!', $diff, $diff_matches ) ) { // length of all text between or $stripped_matches = strlen(strip_tags( join(' ', $diff_matches[0]) )); // since we count lengith of text between or (instead of picking just one),