Changeset 47557 for trunk/src/wp-admin/includes/template.php
- Timestamp:
- 04/09/2020 03:41:04 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 ) ) );
Note: See TracChangeset
for help on using the changeset viewer.