For clarity, initialize some arrays that previously were only assigned via short circuit in loops.

See #30799.

Built from https://develop.svn.wordpress.org/trunk@30982


git-svn-id: http://core.svn.wordpress.org/trunk@30968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor
2014-12-20 22:47:22 +00:00
parent 2dbd0d0a8f
commit 5eb5afac34
15 changed files with 56 additions and 25 deletions

View File

@@ -1252,7 +1252,7 @@ add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items');
*/
function wp_nav_menu_update_menu_items ( $nav_menu_selected_id, $nav_menu_selected_title ) {
$unsorted_menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID', 'post_status' => 'draft,publish' ) );
$messages = array();
$menu_items = array();
// Index menu items by db ID
foreach ( $unsorted_menu_items as $_item )

View File

@@ -301,11 +301,14 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech
function wp_link_category_checklist( $link_id = 0 ) {
$default = 1;
$checked_categories = array();
if ( $link_id ) {
$checked_categories = wp_get_link_cats( $link_id );
// No selected categories, strange
if ( ! count( $checked_categories ) )
if ( ! count( $checked_categories ) ) {
$checked_categories[] = $default;
}
} else {
$checked_categories[] = $default;
}

View File

@@ -430,6 +430,9 @@ function wp_prepare_themes_for_js( $themes = null ) {
}
WP_Theme::sort_by_name( $themes );
$parents = array();
foreach ( $themes as $theme ) {
$slug = $theme->get_stylesheet();
$encoded_slug = urlencode( $slug );
@@ -469,7 +472,7 @@ function wp_prepare_themes_for_js( $themes = null ) {
}
// Remove 'delete' action if theme has an active child
if ( isset( $parents ) && array_key_exists( $current_theme, $parents ) ) {
if ( ! empty( $parents ) && array_key_exists( $current_theme, $parents ) ) {
unset( $prepared_themes[ $parents[ $current_theme ] ]['actions']['delete'] );
}

View File

@@ -1786,7 +1786,7 @@ function dbDelta( $queries = '', $execute = true ) {
if ($tableindices) {
// Clear the index array.
unset($index_ary);
$index_ary = array();
// For every index in the table.
foreach ($tableindices as $tableindex) {