Index: /trunk/src/wp-admin/includes/class-walker-category-checklist.php
===================================================================
--- /trunk/src/wp-admin/includes/class-walker-category-checklist.php (revision 47556)
+++ /trunk/src/wp-admin/includes/class-walker-category-checklist.php (revision 47557)
@@ -84,5 +84,5 @@
$args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
- $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
+ $class = in_array( $category->term_id, $args['popular_cats'], true ) ? ' class="popular-category"' : '';
$args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
@@ -92,5 +92,5 @@
$inner_class = 'category';
- if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
+ if ( in_array( $category->term_id, $args['selected_cats'], true ) ) {
$inner_class .= ' selected';
$aria_checked = 'true';
@@ -103,8 +103,11 @@
esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '';
} else {
+ $is_selected = in_array( $category->term_id, $args['selected_cats'], true );
+ $is_disabled = ! empty( $args['disabled'] );
+
$output .= "\n
" .
'';
Index: /trunk/src/wp-admin/includes/class-wp-filesystem-base.php
===================================================================
--- /trunk/src/wp-admin/includes/class-wp-filesystem-base.php (revision 47556)
+++ /trunk/src/wp-admin/includes/class-wp-filesystem-base.php (revision 47557)
@@ -402,5 +402,5 @@
for ( $i = 0, $c = count( $attarray ); $i < $c; $i++ ) {
- $key = array_search( $attarray[ $i ], $legal );
+ $key = array_search( $attarray[ $i ], $legal, true );
if ( $key ) {
$realmode .= $legal[ $key ];
Index: /trunk/src/wp-admin/includes/class-wp-ms-users-list-table.php
===================================================================
--- /trunk/src/wp-admin/includes/class-wp-ms-users-list-table.php (revision 47556)
+++ /trunk/src/wp-admin/includes/class-wp-ms-users-list-table.php (revision 47557)
@@ -506,5 +506,5 @@
}
- if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) {
+ if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins, true ) ) {
$actions['delete'] = '' . __( 'Delete' ) . '';
}
Index: /trunk/src/wp-admin/includes/class-wp-terms-list-table.php
===================================================================
--- /trunk/src/wp-admin/includes/class-wp-terms-list-table.php (revision 47556)
+++ /trunk/src/wp-admin/includes/class-wp-terms-list-table.php (revision 47557)
@@ -301,5 +301,5 @@
$my_parents[] = $my_parent;
$p = $my_parent->parent;
- if ( in_array( $p, $parent_ids ) ) { // Prevent parent loops.
+ if ( in_array( $p, $parent_ids, true ) ) { // Prevent parent loops.
break;
}
Index: /trunk/src/wp-admin/includes/dashboard.php
===================================================================
--- /trunk/src/wp-admin/includes/dashboard.php (revision 47556)
+++ /trunk/src/wp-admin/includes/dashboard.php (revision 47557)
@@ -520,5 +520,5 @@
$user_id = get_current_user_id();
// Don't create an option if this is a super admin who does not belong to this site.
- if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) {
+ if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ), true ) ) {
update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID.
}
Index: /trunk/src/wp-admin/includes/ms.php
===================================================================
--- /trunk/src/wp-admin/includes/ms.php (revision 47556)
+++ /trunk/src/wp-admin/includes/ms.php (revision 47557)
@@ -923,4 +923,5 @@
)
);
+
if ( is_array( $blog_users ) && ! empty( $blog_users ) ) {
$user_site = "{$details->blogname}";
@@ -928,12 +929,15 @@
$user_dropdown .= "\n";
Index: /trunk/src/wp-admin/includes/nav-menu.php
===================================================================
--- /trunk/src/wp-admin/includes/nav-menu.php (revision 47556)
+++ /trunk/src/wp-admin/includes/nav-menu.php (revision 47557)
@@ -1150,6 +1150,8 @@
)
);
- $messages = array();
- $menu_items = array();
+
+ $messages = array();
+ $menu_items = array();
+
// Index menu items by DB ID.
foreach ( $unsorted_menu_items as $_item ) {
@@ -1174,4 +1176,5 @@
wp_defer_term_counting( true );
+
// Loop through all the menu items' POST variables.
if ( ! empty( $_POST['menu-item-db-id'] ) ) {
@@ -1210,17 +1213,20 @@
$auto_add = ! empty( $_POST['auto-add-pages'] );
$nav_menu_option = (array) get_option( 'nav_menu_options' );
+
if ( ! isset( $nav_menu_option['auto_add'] ) ) {
$nav_menu_option['auto_add'] = array();
}
+
if ( $auto_add ) {
- if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) {
+ if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'], true ) ) {
$nav_menu_option['auto_add'][] = $nav_menu_selected_id;
}
} else {
- $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] );
+ $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'], true );
if ( false !== $key ) {
unset( $nav_menu_option['auto_add'][ $key ] );
}
}
+
// Remove non-existent/deleted menus.
$nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) );
Index: /trunk/src/wp-admin/includes/plugin.php
===================================================================
--- /trunk/src/wp-admin/includes/plugin.php (revision 47556)
+++ /trunk/src/wp-admin/includes/plugin.php (revision 47557)
@@ -2171,5 +2171,5 @@
$whitelist_options[ $page ][] = $key;
} else {
- $pos = array_search( $key, $whitelist_options[ $page ] );
+ $pos = array_search( $key, $whitelist_options[ $page ], true );
if ( false === $pos ) {
$whitelist_options[ $page ][] = $key;
@@ -2203,5 +2203,5 @@
foreach ( $keys as $key ) {
if ( isset( $whitelist_options[ $page ] ) && is_array( $whitelist_options[ $page ] ) ) {
- $pos = array_search( $key, $whitelist_options[ $page ] );
+ $pos = array_search( $key, $whitelist_options[ $page ], true );
if ( false !== $pos ) {
unset( $whitelist_options[ $page ][ $pos ] );
Index: /trunk/src/wp-admin/includes/post.php
===================================================================
--- /trunk/src/wp-admin/includes/post.php (revision 47556)
+++ /trunk/src/wp-admin/includes/post.php (revision 47557)
@@ -549,6 +549,6 @@
foreach ( $pages as $page ) {
- if ( $page->ID == $parent ) {
- $parent = $page->post_parent;
+ if ( (int) $page->ID === $parent ) {
+ $parent = (int) $page->post_parent;
break;
}
@@ -569,5 +569,5 @@
if ( ! isset( $post_type_object )
- || ( isset( $children ) && in_array( $post_ID, $children ) )
+ || ( isset( $children ) && in_array( $post_ID, $children, true ) )
|| ! current_user_can( 'edit_post', $post_ID )
) {
Index: /trunk/src/wp-admin/includes/revision.php
===================================================================
--- /trunk/src/wp-admin/includes/revision.php (revision 47556)
+++ /trunk/src/wp-admin/includes/revision.php (revision 47557)
@@ -315,5 +315,5 @@
$compare_two_mode = is_numeric( $from );
if ( ! $compare_two_mode ) {
- $found = array_search( $selected_revision_id, array_keys( $revisions ) );
+ $found = array_search( $selected_revision_id, array_keys( $revisions ), true );
if ( $found ) {
$from = array_keys( array_slice( $revisions, $found - 1, 1, true ) );
Index: /trunk/src/wp-admin/includes/screen.php
===================================================================
--- /trunk/src/wp-admin/includes/screen.php (revision 47556)
+++ /trunk/src/wp-admin/includes/screen.php (revision 47557)
@@ -129,8 +129,10 @@
}
+ $is_hidden = in_array( $box['id'], $hidden, true );
+
printf(
'',
esc_attr( $box['id'] ),
- checked( in_array( $box['id'], $hidden, true ), false, false ),
+ checked( $is_hidden, false, false ),
$widget_title
);
Index: /trunk/src/wp-admin/includes/template.php
===================================================================
--- /trunk/src/wp-admin/includes/template.php (revision 47556)
+++ /trunk/src/wp-admin/includes/template.php (revision 47557)
@@ -172,5 +172,5 @@
foreach ( $keys as $k ) {
- if ( in_array( $categories[ $k ]->term_id, $args['selected_cats'] ) ) {
+ if ( in_array( $categories[ $k ]->term_id, $args['selected_cats'], true ) ) {
$checked_categories[] = $categories[ $k ];
unset( $categories[ $k ] );
@@ -229,4 +229,5 @@
$popular_ids = array();
+
foreach ( (array) $terms as $term ) {
$popular_ids[] = $term->term_id;
@@ -235,5 +236,5 @@
}
$id = "popular-$taxonomy-$term->term_id";
- $checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';
+ $checked = in_array( $term->term_id, $checked_terms, true ) ? 'checked="checked"' : '';
?>
@@ -292,5 +293,5 @@
/** This filter is documented in wp-includes/category-template.php */
$name = esc_html( apply_filters( 'the_category', $category->name, '', '' ) );
- $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
+ $checked = in_array( $cat_id, $checked_categories, true ) ? ' checked="checked"' : '';
echo '';
}
@@ -340,4 +341,5 @@
$taxonomy_names = get_object_taxonomies( $post->post_type );
+
foreach ( $taxonomy_names as $taxonomy_name ) {
$taxonomy = get_taxonomy( $taxonomy_name );
@@ -722,5 +724,4 @@
ID, $key ) ) {
@@ -835,4 +836,5 @@
echo "\n\n";
+
$map = array(
'mm' => array( $mm, $cur_mm ),
@@ -842,4 +844,5 @@
'mn' => array( $mn, $cur_mn ),
);
+
foreach ( $map as $timeunit => $value ) {
list( $unit, $curr ) = $value;
@@ -869,5 +872,7 @@
function page_template_dropdown( $default = '', $post_type = 'page' ) {
$templates = get_page_templates( null, $post_type );
+
ksort( $templates );
+
foreach ( array_keys( $templates ) as $template ) {
$selected = selected( $default, $templates[ $template ], false );
@@ -1196,4 +1201,5 @@
$filename = wp_normalize_path( $reflection->getFileName() );
$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
+
if ( strpos( $filename, $plugin_dir ) === 0 ) {
$filename = str_replace( $plugin_dir, '', $filename );
@@ -1201,4 +1207,5 @@
$plugins = get_plugins();
+
foreach ( $plugins as $name => $plugin ) {
if ( strpos( $name, $filename ) === 0 ) {
@@ -1250,4 +1257,5 @@
// Pull them out of their previous context/priority and into the one the user chose.
$sorted = get_user_option( "meta-box-order_$page" );
+
if ( ! $already_sorted && $sorted ) {
foreach ( $sorted as $box_context => $ids ) {
@@ -1781,4 +1789,5 @@
if ( $setting ) {
$setting_errors = array();
+
foreach ( (array) $wp_settings_errors as $key => $details ) {
if ( $setting == $details['setting'] ) {
@@ -1786,4 +1795,5 @@
}
}
+
return $setting_errors;
}
@@ -1834,4 +1844,5 @@
$output = '';
+
foreach ( $settings_errors as $key => $details ) {
if ( 'updated' === $details['type'] ) {
@@ -1856,4 +1867,5 @@
$output .= " \n";
}
+
echo $output;
}
@@ -2085,4 +2097,5 @@
$post_states_string .= ' — ';
+
foreach ( $post_states as $state ) {
++$i;
@@ -2189,5 +2202,5 @@
$header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' );
- if ( $meta_header == $stylesheet && in_array( $post->ID, $header_images ) ) {
+ if ( $meta_header == $stylesheet && in_array( $post->ID, $header_images, true ) ) {
$media_states[] = __( 'Header Image' );
}
@@ -2243,5 +2256,7 @@
$state_count = count( $media_states );
$i = 0;
+
echo ' — ';
+
foreach ( $media_states as $state ) {
++$i;
@@ -2370,10 +2385,13 @@
$button_shorthand = array( 'primary', 'small', 'large' );
$classes = array( 'button' );
+
foreach ( $type as $t ) {
if ( 'secondary' === $t || 'button-secondary' === $t ) {
continue;
}
+
$classes[] = in_array( $t, $button_shorthand, true ) ? 'button-' . $t : $t;
}
+
// Remove empty items, remove duplicate items, and finally build a string.
$class = implode( ' ', array_unique( array_filter( $classes ) ) );
Index: /trunk/src/wp-admin/nav-menus.php
===================================================================
--- /trunk/src/wp-admin/nav-menus.php (revision 47556)
+++ /trunk/src/wp-admin/nav-menus.php (revision 47557)
@@ -105,6 +105,9 @@
)
) {
-
- $parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0;
+ if ( in_array( (int) $menu_item_data['menu_item_parent'], $orders_to_dbids, true ) ) {
+ $parent_db_id = (int) $menu_item_data['menu_item_parent'];
+ } else {
+ $parent_db_id = 0;
+ }
$parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) );
@@ -132,5 +135,5 @@
} elseif (
! empty( $menu_item_data['menu_item_parent'] ) &&
- in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids )
+ in_array( (int) $menu_item_data['menu_item_parent'], $orders_to_dbids, true )
) {
$menu_item_data['menu_item_parent'] = (int) get_post_meta( $menu_item_data['menu_item_parent'], '_menu_item_menu_item_parent', true );
@@ -169,9 +172,14 @@
if (
! empty( $menu_item_data['menu_item_parent'] ) &&
- in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ) ) &&
+ in_array( (int) $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ), true ) &&
isset( $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] ) &&
( $menu_item_data['menu_item_parent'] == $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] )
) {
- $parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0;
+ if ( in_array( (int) $menu_item_data['menu_item_parent'], $orders_to_dbids, true ) ) {
+ $parent_db_id = (int) $menu_item_data['menu_item_parent'];
+ } else {
+ $parent_db_id = 0;
+ }
+
$parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) );
@@ -199,5 +207,5 @@
) {
$_possible_parent_id = (int) get_post_meta( $orders_to_dbids[ $dbids_to_orders[ $parent_db_id ] - 1 ], '_menu_item_menu_item_parent', true );
- if ( in_array( $_possible_parent_id, array_keys( $dbids_to_orders ) ) ) {
+ if ( in_array( $_possible_parent_id, array_keys( $dbids_to_orders ), true ) ) {
$menu_item_data['menu_item_parent'] = $_possible_parent_id;
} else {
@@ -226,5 +234,5 @@
empty( $menu_item_data['menu_order'] ) ||
empty( $menu_item_data['menu_item_parent'] ) ||
- ! in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ) ) ||
+ ! in_array( (int) $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ), true ) ||
empty( $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] ) ||
$orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] != $menu_item_data['menu_item_parent']
@@ -801,7 +809,8 @@
echo esc_html( $_nav_menu->truncated_name );
- if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) {
+ if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations, true ) ) {
$locations_assigned_to_this_menu = array();
- foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) {
+
+ foreach ( array_keys( $menu_locations, $_nav_menu->term_id, true ) as $menu_location_key ) {
if ( isset( $locations[ $menu_location_key ] ) ) {
$locations_assigned_to_this_menu[] = $locations[ $menu_location_key ];
@@ -816,5 +825,7 @@
* @param int $locations Number of menu locations to list. Default 3.
*/
- $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) );
+ $locations_listed_per_menu = absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) );
+
+ $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, $locations_listed_per_menu );
// Adds ellipses following the number of locations defined in $assigned_locations.
@@ -957,7 +968,8 @@
if ( ! isset( $auto_add ) ) {
$auto_add = get_option( 'nav_menu_options' );
+
if ( ! isset( $auto_add['auto_add'] ) ) {
$auto_add = false;
- } elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'] ) ) {
+ } elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'], true ) ) {
$auto_add = true;
} else {
Index: /trunk/src/wp-admin/network/site-info.php
===================================================================
--- /trunk/src/wp-admin/network/site-info.php (revision 47556)
+++ /trunk/src/wp-admin/network/site-info.php (revision 47557)
@@ -73,6 +73,7 @@
$existing_details = get_site( $id );
$blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' );
+
foreach ( $blog_data_checkboxes as $c ) {
- if ( ! in_array( $existing_details->$c, array( 0, 1 ) ) ) {
+ if ( ! in_array( (int) $existing_details->$c, array( 0, 1 ), true ) ) {
$blog_data[ $c ] = $existing_details->$c;
} else {
@@ -195,5 +196,5 @@
$field_label ) : ?>
-