Changeset 47557
- Timestamp:
- 04/09/2020 03:41:04 PM (5 years ago)
- Location:
- trunk/src
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-walker-category-checklist.php
r47550 r47557 84 84 $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats']; 85 85 86 $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';86 $class = in_array( $category->term_id, $args['popular_cats'], true ) ? ' class="popular-category"' : ''; 87 87 88 88 $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats']; … … 92 92 $inner_class = 'category'; 93 93 94 if ( in_array( $category->term_id, $args['selected_cats'] ) ) {94 if ( in_array( $category->term_id, $args['selected_cats'], true ) ) { 95 95 $inner_class .= ' selected'; 96 96 $aria_checked = 'true'; … … 103 103 esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</div>'; 104 104 } else { 105 $is_selected = in_array( $category->term_id, $args['selected_cats'], true ); 106 $is_disabled = ! empty( $args['disabled'] ); 107 105 108 $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . 106 109 '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' . 107 checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) .108 disabled( empty( $args['disabled'] ), false, false ) . ' /> ' .110 checked( $is_selected, true, false ) . 111 disabled( $is_disabled, true, false ) . ' /> ' . 109 112 /** This filter is documented in wp-includes/category-template.php */ 110 113 esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</label>'; -
trunk/src/wp-admin/includes/class-wp-filesystem-base.php
r47122 r47557 402 402 403 403 for ( $i = 0, $c = count( $attarray ); $i < $c; $i++ ) { 404 $key = array_search( $attarray[ $i ], $legal );404 $key = array_search( $attarray[ $i ], $legal, true ); 405 405 if ( $key ) { 406 406 $realmode .= $legal[ $key ]; -
trunk/src/wp-admin/includes/class-wp-ms-users-list-table.php
r47550 r47557 506 506 } 507 507 508 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) {508 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins, true ) ) { 509 509 $actions['delete'] = '<a href="' . esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>'; 510 510 } -
trunk/src/wp-admin/includes/class-wp-terms-list-table.php
r47550 r47557 301 301 $my_parents[] = $my_parent; 302 302 $p = $my_parent->parent; 303 if ( in_array( $p, $parent_ids ) ) { // Prevent parent loops.303 if ( in_array( $p, $parent_ids, true ) ) { // Prevent parent loops. 304 304 break; 305 305 } -
trunk/src/wp-admin/includes/dashboard.php
r47550 r47557 520 520 $user_id = get_current_user_id(); 521 521 // Don't create an option if this is a super admin who does not belong to this site. 522 if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) {522 if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ), true ) ) { 523 523 update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID. 524 524 } -
trunk/src/wp-admin/includes/ms.php
r47550 r47557 923 923 ) 924 924 ); 925 925 926 if ( is_array( $blog_users ) && ! empty( $blog_users ) ) { 926 927 $user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>"; … … 928 929 $user_dropdown .= "<select name='blog[$user_id][$key]' id='reassign_user'>"; 929 930 $user_list = ''; 931 930 932 foreach ( $blog_users as $user ) { 931 if ( ! in_array( $user->ID, $allusers) ) {933 if ( ! in_array( (int) $user->ID, $allusers, true ) ) { 932 934 $user_list .= "<option value='{$user->ID}'>{$user->user_login}</option>"; 933 935 } 934 936 } 937 935 938 if ( '' == $user_list ) { 936 939 $user_list = $admin_out; 937 940 } 941 938 942 $user_dropdown .= $user_list; 939 943 $user_dropdown .= "</select>\n"; -
trunk/src/wp-admin/includes/nav-menu.php
r47550 r47557 1150 1150 ) 1151 1151 ); 1152 $messages = array(); 1153 $menu_items = array(); 1152 1153 $messages = array(); 1154 $menu_items = array(); 1155 1154 1156 // Index menu items by DB ID. 1155 1157 foreach ( $unsorted_menu_items as $_item ) { … … 1174 1176 1175 1177 wp_defer_term_counting( true ); 1178 1176 1179 // Loop through all the menu items' POST variables. 1177 1180 if ( ! empty( $_POST['menu-item-db-id'] ) ) { … … 1210 1213 $auto_add = ! empty( $_POST['auto-add-pages'] ); 1211 1214 $nav_menu_option = (array) get_option( 'nav_menu_options' ); 1215 1212 1216 if ( ! isset( $nav_menu_option['auto_add'] ) ) { 1213 1217 $nav_menu_option['auto_add'] = array(); 1214 1218 } 1219 1215 1220 if ( $auto_add ) { 1216 if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) {1221 if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'], true ) ) { 1217 1222 $nav_menu_option['auto_add'][] = $nav_menu_selected_id; 1218 1223 } 1219 1224 } else { 1220 $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] );1225 $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'], true ); 1221 1226 if ( false !== $key ) { 1222 1227 unset( $nav_menu_option['auto_add'][ $key ] ); 1223 1228 } 1224 1229 } 1230 1225 1231 // Remove non-existent/deleted menus. 1226 1232 $nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) ); -
trunk/src/wp-admin/includes/plugin.php
r47550 r47557 2171 2171 $whitelist_options[ $page ][] = $key; 2172 2172 } else { 2173 $pos = array_search( $key, $whitelist_options[ $page ] );2173 $pos = array_search( $key, $whitelist_options[ $page ], true ); 2174 2174 if ( false === $pos ) { 2175 2175 $whitelist_options[ $page ][] = $key; … … 2203 2203 foreach ( $keys as $key ) { 2204 2204 if ( isset( $whitelist_options[ $page ] ) && is_array( $whitelist_options[ $page ] ) ) { 2205 $pos = array_search( $key, $whitelist_options[ $page ] );2205 $pos = array_search( $key, $whitelist_options[ $page ], true ); 2206 2206 if ( false !== $pos ) { 2207 2207 unset( $whitelist_options[ $page ][ $pos ] ); -
trunk/src/wp-admin/includes/post.php
r47550 r47557 549 549 550 550 foreach ( $pages as $page ) { 551 if ( $page->ID== $parent ) {552 $parent = $page->post_parent;551 if ( (int) $page->ID === $parent ) { 552 $parent = (int) $page->post_parent; 553 553 break; 554 554 } … … 569 569 570 570 if ( ! isset( $post_type_object ) 571 || ( isset( $children ) && in_array( $post_ID, $children ) )571 || ( isset( $children ) && in_array( $post_ID, $children, true ) ) 572 572 || ! current_user_can( 'edit_post', $post_ID ) 573 573 ) { -
trunk/src/wp-admin/includes/revision.php
r47122 r47557 315 315 $compare_two_mode = is_numeric( $from ); 316 316 if ( ! $compare_two_mode ) { 317 $found = array_search( $selected_revision_id, array_keys( $revisions ) );317 $found = array_search( $selected_revision_id, array_keys( $revisions ), true ); 318 318 if ( $found ) { 319 319 $from = array_keys( array_slice( $revisions, $found - 1, 1, true ) ); -
trunk/src/wp-admin/includes/screen.php
r47550 r47557 129 129 } 130 130 131 $is_hidden = in_array( $box['id'], $hidden, true ); 132 131 133 printf( 132 134 '<label for="%1$s-hide"><input class="hide-postbox-tog" name="%1$s-hide" type="checkbox" id="%1$s-hide" value="%1$s" %2$s />%3$s</label>', 133 135 esc_attr( $box['id'] ), 134 checked( in_array( $box['id'], $hidden, true ), false, false ),136 checked( $is_hidden, false, false ), 135 137 $widget_title 136 138 ); -
trunk/src/wp-admin/includes/template.php
r47550 r47557 172 172 173 173 foreach ( $keys as $k ) { 174 if ( in_array( $categories[ $k ]->term_id, $args['selected_cats'] ) ) {174 if ( in_array( $categories[ $k ]->term_id, $args['selected_cats'], true ) ) { 175 175 $checked_categories[] = $categories[ $k ]; 176 176 unset( $categories[ $k ] ); … … 229 229 230 230 $popular_ids = array(); 231 231 232 foreach ( (array) $terms as $term ) { 232 233 $popular_ids[] = $term->term_id; … … 235 236 } 236 237 $id = "popular-$taxonomy-$term->term_id"; 237 $checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';238 $checked = in_array( $term->term_id, $checked_terms, true ) ? 'checked="checked"' : ''; 238 239 ?> 239 240 … … 292 293 /** This filter is documented in wp-includes/category-template.php */ 293 294 $name = esc_html( apply_filters( 'the_category', $category->name, '', '' ) ); 294 $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';295 $checked = in_array( $cat_id, $checked_categories, true ) ? ' checked="checked"' : ''; 295 296 echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', $checked, '/> ', $name, '</label></li>'; 296 297 } … … 340 341 341 342 $taxonomy_names = get_object_taxonomies( $post->post_type ); 343 342 344 foreach ( $taxonomy_names as $taxonomy_name ) { 343 345 $taxonomy = get_taxonomy( $taxonomy_name ); … … 722 724 <option value="#NONE#"><?php _e( '— Select —' ); ?></option> 723 725 <?php 724 725 726 foreach ( $keys as $key ) { 726 727 if ( is_protected_meta( $key, 'post' ) || ! current_user_can( 'add_post_meta', $post->ID, $key ) ) { … … 835 836 836 837 echo "\n\n"; 838 837 839 $map = array( 838 840 'mm' => array( $mm, $cur_mm ), … … 842 844 'mn' => array( $mn, $cur_mn ), 843 845 ); 846 844 847 foreach ( $map as $timeunit => $value ) { 845 848 list( $unit, $curr ) = $value; … … 869 872 function page_template_dropdown( $default = '', $post_type = 'page' ) { 870 873 $templates = get_page_templates( null, $post_type ); 874 871 875 ksort( $templates ); 876 872 877 foreach ( array_keys( $templates ) as $template ) { 873 878 $selected = selected( $default, $templates[ $template ], false ); … … 1196 1201 $filename = wp_normalize_path( $reflection->getFileName() ); 1197 1202 $plugin_dir = wp_normalize_path( WP_PLUGIN_DIR ); 1203 1198 1204 if ( strpos( $filename, $plugin_dir ) === 0 ) { 1199 1205 $filename = str_replace( $plugin_dir, '', $filename ); … … 1201 1207 1202 1208 $plugins = get_plugins(); 1209 1203 1210 foreach ( $plugins as $name => $plugin ) { 1204 1211 if ( strpos( $name, $filename ) === 0 ) { … … 1250 1257 // Pull them out of their previous context/priority and into the one the user chose. 1251 1258 $sorted = get_user_option( "meta-box-order_$page" ); 1259 1252 1260 if ( ! $already_sorted && $sorted ) { 1253 1261 foreach ( $sorted as $box_context => $ids ) { … … 1781 1789 if ( $setting ) { 1782 1790 $setting_errors = array(); 1791 1783 1792 foreach ( (array) $wp_settings_errors as $key => $details ) { 1784 1793 if ( $setting == $details['setting'] ) { … … 1786 1795 } 1787 1796 } 1797 1788 1798 return $setting_errors; 1789 1799 } … … 1834 1844 1835 1845 $output = ''; 1846 1836 1847 foreach ( $settings_errors as $key => $details ) { 1837 1848 if ( 'updated' === $details['type'] ) { … … 1856 1867 $output .= "</div> \n"; 1857 1868 } 1869 1858 1870 echo $output; 1859 1871 } … … 2085 2097 2086 2098 $post_states_string .= ' — '; 2099 2087 2100 foreach ( $post_states as $state ) { 2088 2101 ++$i; … … 2189 2202 $header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' ); 2190 2203 2191 if ( $meta_header == $stylesheet && in_array( $post->ID, $header_images ) ) {2204 if ( $meta_header == $stylesheet && in_array( $post->ID, $header_images, true ) ) { 2192 2205 $media_states[] = __( 'Header Image' ); 2193 2206 } … … 2243 2256 $state_count = count( $media_states ); 2244 2257 $i = 0; 2258 2245 2259 echo ' — '; 2260 2246 2261 foreach ( $media_states as $state ) { 2247 2262 ++$i; … … 2370 2385 $button_shorthand = array( 'primary', 'small', 'large' ); 2371 2386 $classes = array( 'button' ); 2387 2372 2388 foreach ( $type as $t ) { 2373 2389 if ( 'secondary' === $t || 'button-secondary' === $t ) { 2374 2390 continue; 2375 2391 } 2392 2376 2393 $classes[] = in_array( $t, $button_shorthand, true ) ? 'button-' . $t : $t; 2377 2394 } 2395 2378 2396 // Remove empty items, remove duplicate items, and finally build a string. 2379 2397 $class = implode( ' ', array_unique( array_filter( $classes ) ) ); -
trunk/src/wp-admin/nav-menus.php
r47198 r47557 105 105 ) 106 106 ) { 107 108 $parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0; 107 if ( in_array( (int) $menu_item_data['menu_item_parent'], $orders_to_dbids, true ) ) { 108 $parent_db_id = (int) $menu_item_data['menu_item_parent']; 109 } else { 110 $parent_db_id = 0; 111 } 109 112 110 113 $parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) ); … … 132 135 } elseif ( 133 136 ! empty( $menu_item_data['menu_item_parent'] ) && 134 in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids)137 in_array( (int) $menu_item_data['menu_item_parent'], $orders_to_dbids, true ) 135 138 ) { 136 139 $menu_item_data['menu_item_parent'] = (int) get_post_meta( $menu_item_data['menu_item_parent'], '_menu_item_menu_item_parent', true ); … … 169 172 if ( 170 173 ! empty( $menu_item_data['menu_item_parent'] ) && 171 in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders )) &&174 in_array( (int) $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ), true ) && 172 175 isset( $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] ) && 173 176 ( $menu_item_data['menu_item_parent'] == $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] ) 174 177 ) { 175 $parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0; 178 if ( in_array( (int) $menu_item_data['menu_item_parent'], $orders_to_dbids, true ) ) { 179 $parent_db_id = (int) $menu_item_data['menu_item_parent']; 180 } else { 181 $parent_db_id = 0; 182 } 183 176 184 $parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) ); 177 185 … … 199 207 ) { 200 208 $_possible_parent_id = (int) get_post_meta( $orders_to_dbids[ $dbids_to_orders[ $parent_db_id ] - 1 ], '_menu_item_menu_item_parent', true ); 201 if ( in_array( $_possible_parent_id, array_keys( $dbids_to_orders ) ) ) {209 if ( in_array( $_possible_parent_id, array_keys( $dbids_to_orders ), true ) ) { 202 210 $menu_item_data['menu_item_parent'] = $_possible_parent_id; 203 211 } else { … … 226 234 empty( $menu_item_data['menu_order'] ) || 227 235 empty( $menu_item_data['menu_item_parent'] ) || 228 ! in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders )) ||236 ! in_array( (int) $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ), true ) || 229 237 empty( $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] ) || 230 238 $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] != $menu_item_data['menu_item_parent'] … … 801 809 echo esc_html( $_nav_menu->truncated_name ); 802 810 803 if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) {811 if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations, true ) ) { 804 812 $locations_assigned_to_this_menu = array(); 805 foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) { 813 814 foreach ( array_keys( $menu_locations, $_nav_menu->term_id, true ) as $menu_location_key ) { 806 815 if ( isset( $locations[ $menu_location_key ] ) ) { 807 816 $locations_assigned_to_this_menu[] = $locations[ $menu_location_key ]; … … 816 825 * @param int $locations Number of menu locations to list. Default 3. 817 826 */ 818 $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) ); 827 $locations_listed_per_menu = absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ); 828 829 $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, $locations_listed_per_menu ); 819 830 820 831 // Adds ellipses following the number of locations defined in $assigned_locations. … … 957 968 if ( ! isset( $auto_add ) ) { 958 969 $auto_add = get_option( 'nav_menu_options' ); 970 959 971 if ( ! isset( $auto_add['auto_add'] ) ) { 960 972 $auto_add = false; 961 } elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'] ) ) {973 } elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'], true ) ) { 962 974 $auto_add = true; 963 975 } else { -
trunk/src/wp-admin/network/site-info.php
r47198 r47557 73 73 $existing_details = get_site( $id ); 74 74 $blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' ); 75 75 76 foreach ( $blog_data_checkboxes as $c ) { 76 if ( ! in_array( $existing_details->$c, array( 0, 1 )) ) {77 if ( ! in_array( (int) $existing_details->$c, array( 0, 1 ), true ) ) { 77 78 $blog_data[ $c ] = $existing_details->$c; 78 79 } else { … … 195 196 <legend class="screen-reader-text"><?php _e( 'Set site attributes' ); ?></legend> 196 197 <?php foreach ( $attribute_fields as $field_key => $field_label ) : ?> 197 <label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked( (bool) $details->$field_key, true ); ?> <?php disabled( ! in_array( $details->$field_key, array( 0, 1 )) ); ?> />198 <label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked( (bool) $details->$field_key, true ); ?> <?php disabled( ! in_array( (int) $details->$field_key, array( 0, 1 ), true ) ); ?> /> 198 199 <?php echo $field_label; ?></label><br/> 199 200 <?php endforeach; ?> -
trunk/src/wp-admin/users.php
r47198 r47557 238 238 $all_userids = $userids; 239 239 240 if ( in_array( $current_user->ID, $userids ) ) {240 if ( in_array( $current_user->ID, $userids, true ) ) { 241 241 $userids = array_diff( $userids, array( $current_user->ID ) ); 242 242 } -
trunk/src/wp-includes/class-http.php
r47550 r47557 1042 1042 // POST requests should not POST to a redirected location. 1043 1043 if ( 'POST' == $args['method'] ) { 1044 if ( in_array( $response['response']['code'], array( 302, 303 ) ) ) {1044 if ( in_array( $response['response']['code'], array( 302, 303 ), true ) ) { 1045 1045 $args['method'] = 'GET'; 1046 1046 } -
trunk/src/wp-includes/class-walker-page.php
r47219 r47557 123 123 if ( ! empty( $current_page ) ) { 124 124 $_current_page = get_post( $current_page ); 125 if ( $_current_page && in_array( $page->ID, $_current_page->ancestors ) ) { 125 126 if ( $_current_page && in_array( $page->ID, $_current_page->ancestors, true ) ) { 126 127 $css_class[] = 'current_page_ancestor'; 127 128 } 129 128 130 if ( $page->ID == $current_page ) { 129 131 $css_class[] = 'current_page_item'; 130 } elseif ( $_current_page && $page->ID == $_current_page->post_parent ) {132 } elseif ( $_current_page && $page->ID === $_current_page->post_parent ) { 131 133 $css_class[] = 'current_page_parent'; 132 134 } -
trunk/src/wp-includes/class-wp-http-cookie.php
r45748 r47557 193 193 194 194 // Port - supports "port-lists" in the format: "80,8000,8080". 195 if ( ! empty( $port ) && ! in_array( $url['port'], explode( ',', $port )) ) {195 if ( ! empty( $port ) && ! in_array( $url['port'], array_map( 'intval', explode( ',', $port ) ), true ) ) { 196 196 return false; 197 197 } -
trunk/src/wp-includes/class-wp-http-curl.php
r47219 r47557 239 239 return new WP_Error( 'http_request_failed', $curl_error ); 240 240 } 241 if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ) ) ) {241 if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ), true ) ) { 242 242 curl_close( $handle ); 243 243 return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) ); … … 287 287 } 288 288 } 289 if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ) ) ) {289 if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ), true ) ) { 290 290 curl_close( $handle ); 291 291 return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) ); -
trunk/src/wp-includes/class-wp-query.php
r47550 r47557 3138 3138 // Loop over posts and relocate stickies to the front. 3139 3139 for ( $i = 0; $i < $num_posts; $i++ ) { 3140 if ( in_array( $this->posts[ $i ]->ID, $sticky_posts ) ) {3140 if ( in_array( $this->posts[ $i ]->ID, $sticky_posts, true ) ) { 3141 3141 $sticky_post = $this->posts[ $i ]; 3142 3142 // Remove sticky from current position. … … 3147 3147 $sticky_offset++; 3148 3148 // Remove post from sticky posts array. 3149 $offset = array_search( $sticky_post->ID, $sticky_posts );3149 $offset = array_search( $sticky_post->ID, $sticky_posts, true ); 3150 3150 unset( $sticky_posts[ $offset ] ); 3151 3151 } -
trunk/src/wp-includes/class-wp-theme.php
r47550 r47557 277 277 // Default themes always trump their pretenders. 278 278 // Properly identify default themes that are inside a directory within wp-content/themes. 279 $default_theme_slug = array_search( $this->headers['Name'], self::$default_themes );279 $default_theme_slug = array_search( $this->headers['Name'], self::$default_themes, true ); 280 280 if ( $default_theme_slug ) { 281 281 if ( basename( $this->stylesheet ) != $default_theme_slug ) { -
trunk/src/wp-includes/customize/class-wp-customize-nav-menu-setting.php
r47428 r47557 180 180 181 181 if ( isset( $nav_menu_options['auto_add'] ) && is_array( $nav_menu_options['auto_add'] ) ) { 182 $value['auto_add'] = in_array( $term->term_id, $nav_menu_options['auto_add'] );182 $value['auto_add'] = in_array( $term->term_id, $nav_menu_options['auto_add'], true ); 183 183 } 184 184 } … … 189 189 } 190 190 } 191 191 192 return $value; 192 193 } … … 603 604 } 604 605 605 $i = array_search( $menu_id, $nav_menu_options['auto_add'] ); 606 $i = array_search( $menu_id, $nav_menu_options['auto_add'], true ); 607 606 608 if ( $auto_add && false === $i ) { 607 609 array_push( $nav_menu_options['auto_add'], $this->term_id ); -
trunk/src/wp-includes/general-template.php
r47550 r47557 2181 2181 ARRAY_N 2182 2182 ); 2183 2183 2184 if ( $dayswithposts ) { 2184 2185 foreach ( (array) $dayswithposts as $daywith ) { 2185 $daywithpost[] = $daywith[0];2186 $daywithpost[] = (int) $daywith[0]; 2186 2187 } 2187 2188 } … … 2210 2211 } 2211 2212 2212 if ( in_array( $day, $daywithpost ) ) {2213 if ( in_array( $day, $daywithpost, true ) ) { 2213 2214 // Any posts today? 2214 2215 $date_format = gmdate( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) ); … … 2224 2225 $calendar_output .= $day; 2225 2226 } 2227 2226 2228 $calendar_output .= '</td>'; 2227 2229 … … 2235 2237 $calendar_output .= "\n\t\t" . '<td class="pad" colspan="' . esc_attr( $pad ) . '"> </td>'; 2236 2238 } 2239 2237 2240 $calendar_output .= "\n\t</tr>\n\t</tbody>"; 2238 2241 -
trunk/src/wp-includes/link-template.php
r47550 r47557 3688 3688 3689 3689 $blogs = get_blogs_of_user( $user_id ); 3690 3690 3691 if ( is_multisite() && ! user_can( $user_id, 'manage_network' ) && empty( $blogs ) ) { 3691 3692 $url = user_admin_url( $path, $scheme ); … … 3694 3695 } else { 3695 3696 $current_blog = get_current_blog_id(); 3696 if ( $current_blog && ( user_can( $user_id, 'manage_network' ) || in_array( $current_blog, array_keys( $blogs ) ) ) ) { 3697 3698 if ( $current_blog && ( user_can( $user_id, 'manage_network' ) || in_array( $current_blog, array_keys( $blogs ), true ) ) ) { 3697 3699 $url = admin_url( $path, $scheme ); 3698 3700 } else { -
trunk/src/wp-includes/nav-menu-template.php
r47550 r47557 393 393 394 394 // If the menu item corresponds to a taxonomy term for the currently queried non-hierarchical post object. 395 if ( $wp_query->is_singular && 'taxonomy' == $menu_item->type && in_array( $menu_item->object_id, $possible_object_parents ) ) { 395 if ( $wp_query->is_singular && 'taxonomy' == $menu_item->type 396 && in_array( (int) $menu_item->object_id, $possible_object_parents, true ) 397 ) { 396 398 $active_parent_object_ids[] = (int) $menu_item->object_id; 397 399 $active_parent_item_ids[] = (int) $menu_item->db_id; … … 405 407 || ( 'post_type' == $menu_item->type && $wp_query->is_singular ) 406 408 || ( 'taxonomy' == $menu_item->type 407 && ( $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax ) && $queried_object->taxonomy == $menu_item->object ) 409 && ( $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax ) 410 && $queried_object->taxonomy == $menu_item->object ) 408 411 ) 409 412 ) { … … 526 529 && ! empty( $queried_object->post_type ) 527 530 && is_post_type_hierarchical( $queried_object->post_type ) 528 && in_array( $parent_item->object_id, $queried_object->ancestors)531 && in_array( (int) $parent_item->object_id, $queried_object->ancestors, true ) 529 532 && $parent_item->object != $queried_object->ID 530 533 ) || … … 534 537 'taxonomy' == $parent_item->type 535 538 && isset( $possible_taxonomy_ancestors[ $parent_item->object ] ) 536 && in_array( $parent_item->object_id, $possible_taxonomy_ancestors[ $parent_item->object ])539 && in_array( (int) $parent_item->object_id, $possible_taxonomy_ancestors[ $parent_item->object ], true ) 537 540 && ( 538 541 ! isset( $queried_object->term_id ) || -
trunk/src/wp-includes/post.php
r47550 r47557 2285 2285 $stickies = get_option( 'sticky_posts' ); 2286 2286 2287 $is_sticky = is_array( $stickies ) && in_array( $post_id, $stickies ); 2287 if ( is_array( $stickies ) ) { 2288 $stickies = array_map( 'intval', $stickies ); 2289 $is_sticky = in_array( $post_id, $stickies, true ); 2290 } else { 2291 $is_sticky = false; 2292 } 2288 2293 2289 2294 /** … … 2512 2517 */ 2513 2518 function stick_post( $post_id ) { 2519 $post_id = (int) $post_id; 2514 2520 $stickies = get_option( 'sticky_posts' ); 2515 2521 2516 2522 if ( ! is_array( $stickies ) ) { 2517 $stickies = array( $post_id ); 2518 } 2519 2520 if ( ! in_array( $post_id, $stickies ) ) { 2523 $stickies = array(); 2524 } 2525 2526 $stickies = array_map( 'intval', $stickies ); 2527 2528 if ( ! in_array( $post_id, $stickies, true ) ) { 2521 2529 $stickies[] = $post_id; 2522 2530 } … … 2546 2554 */ 2547 2555 function unstick_post( $post_id ) { 2556 $post_id = (int) $post_id; 2548 2557 $stickies = get_option( 'sticky_posts' ); 2549 2558 … … 2552 2561 } 2553 2562 2554 if ( ! in_array( $post_id, $stickies ) ) { 2563 $stickies = array_map( 'intval', $stickies ); 2564 2565 if ( ! in_array( $post_id, $stickies, true ) ) { 2555 2566 return; 2556 2567 } 2557 2568 2558 $offset = array_search( $post_id, $stickies );2569 $offset = array_search( $post_id, $stickies, true ); 2559 2570 if ( false === $offset ) { 2560 2571 return; … … 2842 2853 $mimes = array_map( 'trim', explode( ',', $type ) ); 2843 2854 foreach ( $mimes as $mime ) { 2844 $regex = str_replace( '__wildcard__', $wild, preg_quote( str_replace( '*', '__wildcard__', $mime ) ) ); 2855 $regex = str_replace( '__wildcard__', $wild, preg_quote( str_replace( '*', '__wildcard__', $mime ) ) ); 2856 2845 2857 $patternses[][ $type ] = "^$regex$"; 2858 2846 2859 if ( false === strpos( $mime, '/' ) ) { 2847 2860 $patternses[][ $type ] = "^$regex/"; … … 2855 2868 foreach ( $patterns as $type => $pattern ) { 2856 2869 foreach ( (array) $real_mime_types as $real ) { 2857 if ( preg_match( "#$pattern#", $real ) && ( empty( $matches[ $type ] ) || false === array_search( $real, $matches[ $type ] ) ) ) { 2870 if ( preg_match( "#$pattern#", $real ) 2871 && ( empty( $matches[ $type ] ) || false === array_search( $real, $matches[ $type ], true ) ) 2872 ) { 2858 2873 $matches[ $type ][] = $real; 2859 2874 } … … 2861 2876 } 2862 2877 } 2878 2863 2879 return $matches; 2864 2880 } … … 2915 2931 } 2916 2932 } 2933 2917 2934 if ( ! empty( $wheres ) ) { 2918 2935 $where = ' AND (' . join( ' OR ', $wheres ) . ') '; 2919 2936 } 2937 2920 2938 return $where; 2921 2939 } … … 4437 4455 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) ); 4438 4456 4457 $post = get_post( $post_ID ); 4458 4439 4459 // Prevent new post slugs that could result in URLs that conflict with date archives. 4440 $post = get_post( $post_ID );4441 4460 $conflicts_with_date_archive = false; 4442 4461 if ( 'post' === $post_type && ( ! $post || $post->post_name !== $slug ) && preg_match( '/^[0-9]+$/', $slug ) ) { … … 4445 4464 if ( $slug_num ) { 4446 4465 $permastructs = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) ); 4447 $postname_index = array_search( '%postname%', $permastructs );4466 $postname_index = array_search( '%postname%', $permastructs, true ); 4448 4467 4449 4468 /* … … 5501 5520 $num_pages = count( $pages ); 5502 5521 for ( $i = 0; $i < $num_pages; $i++ ) { 5503 if ( in_array( $pages[ $i ]->ID, $exclude ) ) {5522 if ( in_array( $pages[ $i ]->ID, $exclude, true ) ) { 5504 5523 unset( $pages[ $i ] ); 5505 5524 } … … 5812 5831 function wp_get_attachment_metadata( $attachment_id = 0, $unfiltered = false ) { 5813 5832 $attachment_id = (int) $attachment_id; 5814 $post = get_post( $attachment_id ); 5833 5834 $post = get_post( $attachment_id ); 5815 5835 if ( ! $post ) { 5816 5836 return false; … … 5846 5866 function wp_update_attachment_metadata( $attachment_id, $data ) { 5847 5867 $attachment_id = (int) $attachment_id; 5848 $post = get_post( $attachment_id ); 5868 5869 $post = get_post( $attachment_id ); 5849 5870 if ( ! $post ) { 5850 5871 return false; … … 5879 5900 function wp_get_attachment_url( $attachment_id = 0 ) { 5880 5901 $attachment_id = (int) $attachment_id; 5881 $post = get_post( $attachment_id ); 5902 5903 $post = get_post( $attachment_id ); 5882 5904 if ( ! $post ) { 5883 5905 return false; -
trunk/src/wp-includes/rewrite.php
r47550 r47557 597 597 $query = array(); 598 598 foreach ( (array) $query_vars as $key => $value ) { 599 if ( in_array( $key, $wp->public_query_vars, true ) ) {599 if ( in_array( (string) $key, $wp->public_query_vars, true ) ) { 600 600 $query[ $key ] = $value; 601 601 if ( isset( $post_type_query_vars[ $key ] ) ) { -
trunk/src/wp-includes/taxonomy.php
r47550 r47557 2469 2469 2470 2470 $term_info = term_exists( $term, $taxonomy ); 2471 2471 2472 if ( ! $term_info ) { 2472 2473 // Skip if a non-existent term ID is passed. … … 2474 2475 continue; 2475 2476 } 2477 2476 2478 $term_info = wp_insert_term( $term, $taxonomy ); 2477 2479 } 2480 2478 2481 if ( is_wp_error( $term_info ) ) { 2479 2482 return $term_info; 2480 2483 } 2484 2481 2485 $term_ids[] = $term_info['term_id']; 2482 2486 $tt_id = $term_info['term_taxonomy_id']; … … 2498 2502 */ 2499 2503 do_action( 'add_term_relationship', $object_id, $tt_id, $taxonomy ); 2504 2500 2505 $wpdb->insert( 2501 2506 $wpdb->term_relationships, … … 2517 2522 */ 2518 2523 do_action( 'added_term_relationship', $object_id, $tt_id, $taxonomy ); 2524 2519 2525 $new_tt_ids[] = $tt_id; 2520 2526 } … … 2540 2546 2541 2547 $t = get_taxonomy( $taxonomy ); 2548 2542 2549 if ( ! $append && isset( $t->sort ) && $t->sort ) { 2543 $values = array(); 2544 $term_order = 0; 2550 $values = array(); 2551 $term_order = 0; 2552 2545 2553 $final_tt_ids = wp_get_object_terms( 2546 2554 $object_id, … … 2551 2559 ) 2552 2560 ); 2561 2553 2562 foreach ( $tt_ids as $tt_id ) { 2554 if ( in_array( $tt_id, $final_tt_ids) ) {2563 if ( in_array( (int) $tt_id, $final_tt_ids, true ) ) { 2555 2564 $values[] = $wpdb->prepare( '(%d, %d, %d)', $object_id, $tt_id, ++$term_order ); 2556 2565 } 2557 2566 } 2567 2558 2568 if ( $values ) { 2559 2569 if ( false === $wpdb->query( "INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join( ',', $values ) . ' ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)' ) ) { … … 2579 2589 */ 2580 2590 do_action( 'set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids ); 2591 2581 2592 return $tt_ids; 2582 2593 } … … 3617 3628 $object_types = esc_sql( $tax_obj->object_type ); 3618 3629 $results = $wpdb->get_results( "SELECT object_id, term_taxonomy_id FROM $wpdb->term_relationships INNER JOIN $wpdb->posts ON object_id = ID WHERE term_taxonomy_id IN (" . implode( ',', array_keys( $term_ids ) ) . ") AND post_type IN ('" . implode( "', '", $object_types ) . "') AND post_status = 'publish'" ); 3630 3619 3631 foreach ( $results as $row ) { 3620 $id = $term_ids[ $row->term_taxonomy_id ]; 3632 $id = $term_ids[ $row->term_taxonomy_id ]; 3633 3621 3634 $term_items[ $id ][ $row->object_id ] = isset( $term_items[ $id ][ $row->object_id ] ) ? ++$term_items[ $id ][ $row->object_id ] : 1; 3622 3635 } … … 3628 3641 while ( ! empty( $terms_by_id[ $child ] ) && $parent = $terms_by_id[ $child ]->parent ) { 3629 3642 $ancestors[] = $child; 3643 3630 3644 if ( ! empty( $term_items[ $term_id ] ) ) { 3631 3645 foreach ( $term_items[ $term_id ] as $item_id => $touches ) { … … 3633 3647 } 3634 3648 } 3649 3635 3650 $child = $parent; 3636 3651 3637 if ( in_array( $parent, $ancestors ) ) {3652 if ( in_array( $parent, $ancestors, true ) ) { 3638 3653 break; 3639 3654 } … … 4523 4538 if ( 'taxonomy' === $resource_type ) { 4524 4539 $term = get_term( $object_id, $object_type ); 4525 while ( ! is_wp_error( $term ) && ! empty( $term->parent ) && ! in_array( $term->parent, $ancestors ) ) {4540 while ( ! is_wp_error( $term ) && ! empty( $term->parent ) && ! in_array( $term->parent, $ancestors, true ) ) { 4526 4541 $ancestors[] = (int) $term->parent; 4527 4542 $term = get_term( $term->parent, $object_type );
Note: See TracChangeset
for help on using the changeset viewer.