Changeset 47775
- Timestamp:
- 05/08/2020 04:34:50 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/template.php
r47771 r47775 692 692 */ 693 693 $limit = apply_filters( 'postmeta_form_limit', 30 ); 694 $sql = "SELECT DISTINCT meta_key 695 FROM $wpdb->postmeta 696 WHERE meta_key NOT BETWEEN '_' AND '_z' 697 HAVING meta_key NOT LIKE %s 698 ORDER BY meta_key 699 LIMIT %d"; 700 $keys = $wpdb->get_col( $wpdb->prepare( $sql, $wpdb->esc_like( '_' ) . '%', $limit ) ); 694 695 $keys = $wpdb->get_col( 696 $wpdb->prepare( 697 "SELECT DISTINCT meta_key 698 FROM $wpdb->postmeta 699 WHERE meta_key NOT BETWEEN '_' AND '_z' 700 HAVING meta_key NOT LIKE %s 701 ORDER BY meta_key 702 LIMIT %d", 703 $wpdb->esc_like( '_' ) . '%', 704 $limit 705 ) 706 ); 701 707 } 702 708 … … 785 791 786 792 if ( $for_post ) { 787 $edit = ! ( in_array( $post->post_status, array( 'draft', 'pending' ), true ) && ( ! $post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );793 $edit = ! ( in_array( $post->post_status, array( 'draft', 'pending' ), true ) && ( ! $post->post_date_gmt || '0000-00-00 00:00:00' === $post->post_date_gmt ) ); 788 794 } 789 795 … … 897 903 function parent_dropdown( $default = 0, $parent = 0, $level = 0, $post = null ) { 898 904 global $wpdb; 905 899 906 $post = get_post( $post ); 900 907 $items = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent ) ); … … 903 910 foreach ( $items as $item ) { 904 911 // A page cannot be its own parent. 905 if ( $post && $post->ID && $item->ID== $post->ID ) {912 if ( $post && $post->ID && (int) $item->ID === $post->ID ) { 906 913 continue; 907 914 } … … 933 940 $name = translate_user_role( $details['name'] ); 934 941 // Preselect specified role. 935 if ( $selected == $role ) {942 if ( $selected === $role ) { 936 943 $r .= "\n\t<option selected='selected' value='" . esc_attr( $role ) . "'>$name</option>"; 937 944 } else { … … 1058 1065 1059 1066 // If a core box was previously added or removed by a plugin, don't add. 1060 if ( 'core' == $priority ) {1067 if ( 'core' === $priority ) { 1061 1068 // If core box previously deleted, don't add. 1062 1069 if ( false === $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ) { … … 1068 1075 * maintain sort order. 1069 1076 */ 1070 if ( 'default' == $a_priority ) {1077 if ( 'default' === $a_priority ) { 1071 1078 $wp_meta_boxes[ $page ][ $a_context ]['core'][ $id ] = $wp_meta_boxes[ $page ][ $a_context ]['default'][ $id ]; 1072 1079 unset( $wp_meta_boxes[ $page ][ $a_context ]['default'][ $id ] ); … … 1081 1088 * or callback. Grab them from the previously added context/priority. 1082 1089 */ 1083 } elseif ( 'sorted' == $priority ) {1090 } elseif ( 'sorted' === $priority ) { 1084 1091 $title = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['title']; 1085 1092 $callback = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['callback']; 1086 1093 $callback_args = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['args']; 1087 1094 } 1095 1088 1096 // An ID can be in only one priority and one context. 1089 if ( $priority != $a_priority || $context != $a_context ) {1097 if ( $priority !== $a_priority || $context !== $a_context ) { 1090 1098 unset( $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ); 1091 1099 } … … 1228 1236 * @staticvar bool $already_sorted 1229 1237 * 1230 * @param string|WP_Screen $screen Screen identifier. If you have used add_menu_page() or1238 * @param string|WP_Screen $screen The screen identifier. If you have used add_menu_page() or 1231 1239 * add_submenu_page() to create a new screen (and hence screen_id) 1232 1240 * make sure your menu slug conforms to the limits of sanitize_key() 1233 1241 * otherwise the 'screen' menu may not correctly render on your page. 1234 1242 * @param string $context The screen context for which to display meta boxes. 1235 * @param mixed $object Gets passed to the first parameter of the meta box callback function.1243 * @param mixed $object Gets passed to the meta box callback function as the first parameter. 1236 1244 * Often this is the object that's the focus of the current screen, for 1237 1245 * example a `WP_Post` or `WP_Comment` object. 1238 * @return int number of meta_boxes1246 * @return int Number of meta_boxes. 1239 1247 */ 1240 1248 function do_meta_boxes( $screen, $context, $object ) { … … 1276 1284 if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { 1277 1285 foreach ( (array) $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { 1278 if ( false == $box || ! $box['title'] ) {1286 if ( false === $box || ! $box['title'] ) { 1279 1287 continue; 1280 1288 } … … 1308 1316 $hidden_class = ( ! $screen->is_block_editor() && in_array( $box['id'], $hidden, true ) ) ? ' hide-if-js' : ''; 1309 1317 echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes( $box['id'], $page ) . $hidden_class . '" ' . '>' . "\n"; 1310 if ( 'dashboard_browser_nag' != $box['id'] ) {1318 if ( 'dashboard_browser_nag' !== $box['id'] ) { 1311 1319 $widget_title = $box['title']; 1312 1320 … … 1429 1437 * 1430 1438 * @param string|object $screen The screen identifier. 1431 * @param string $context The meta box context.1432 * @param mixed $object gets passed to the section callback function asfirst parameter.1433 * @return int number of meta boxes as accordion sections.1439 * @param string $context The screen context for which to display accordion sections. 1440 * @param mixed $object Gets passed to the section callback function as the first parameter. 1441 * @return int Number of meta boxes as accordion sections. 1434 1442 */ 1435 1443 function do_accordion_sections( $screen, $context, $object ) { … … 1458 1466 if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { 1459 1467 foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { 1460 if ( false == $box || ! $box['title'] ) {1468 if ( false === $box || ! $box['title'] ) { 1461 1469 continue; 1462 1470 } 1471 1463 1472 $i++; 1464 1473 $hidden_class = in_array( $box['id'], $hidden, true ) ? 'hide-if-js' : ''; … … 1518 1527 global $wp_settings_sections; 1519 1528 1520 if ( 'misc' == $page ) {1529 if ( 'misc' === $page ) { 1521 1530 _deprecated_argument( 1522 1531 __FUNCTION__, … … 1531 1540 } 1532 1541 1533 if ( 'privacy' == $page ) {1542 if ( 'privacy' === $page ) { 1534 1543 _deprecated_argument( 1535 1544 __FUNCTION__, … … 1589 1598 global $wp_settings_fields; 1590 1599 1591 if ( 'misc' == $page ) {1600 if ( 'misc' === $page ) { 1592 1601 _deprecated_argument( 1593 1602 __FUNCTION__, … … 1602 1611 } 1603 1612 1604 if ( 'privacy' == $page ) {1613 if ( 'privacy' === $page ) { 1605 1614 _deprecated_argument( 1606 1615 __FUNCTION__, … … 1791 1800 1792 1801 foreach ( (array) $wp_settings_errors as $key => $details ) { 1793 if ( $setting == $details['setting'] ) {1802 if ( $setting === $details['setting'] ) { 1794 1803 $setting_errors[] = $wp_settings_errors[ $key ]; 1795 1804 } … … 2099 2108 2100 2109 foreach ( $post_states as $state ) { 2101 ++$i;2102 ( $i == $state_count ) ? $sep = '' : $sep = ', '; 2103 $post_states_string 2110 $sep = ( ++$i === $state_count ) ? '' : ', '; 2111 2112 $post_states_string .= "<span class='post-state'>$state$sep</span>"; 2104 2113 } 2105 2114 } … … 2132 2141 } 2133 2142 2134 if ( 'private' == $post->post_status && 'private' != $post_status ) {2143 if ( 'private' === $post->post_status && 'private' !== $post_status ) { 2135 2144 $post_states['private'] = _x( 'Private', 'post status' ); 2136 2145 } … … 2146 2155 } 2147 2156 2148 if ( 'pending' == $post->post_status && 'pending' != $post_status ) {2157 if ( 'pending' === $post->post_status && 'pending' !== $post_status ) { 2149 2158 $post_states['pending'] = _x( 'Pending', 'post status' ); 2150 2159 } … … 2202 2211 $header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' ); 2203 2212 2204 if ( $meta_header == $stylesheet && in_array( $post->ID, $header_images, true ) ) {2213 if ( $meta_header === $stylesheet && in_array( $post->ID, $header_images, true ) ) { 2205 2214 $media_states[] = __( 'Header Image' ); 2206 2215 } … … 2233 2242 } 2234 2243 2235 if ( get_option( 'site_icon' )== $post->ID ) {2244 if ( (int) get_option( 'site_icon' ) === $post->ID ) { 2236 2245 $media_states[] = __( 'Site Icon' ); 2237 2246 } 2238 2247 2239 if ( get_theme_mod( 'custom_logo' )== $post->ID ) {2248 if ( (int) get_theme_mod( 'custom_logo' ) === $post->ID ) { 2240 2249 $media_states[] = __( 'Logo' ); 2241 2250 } … … 2260 2269 2261 2270 foreach ( $media_states as $state ) { 2262 ++$i;2263 ( $i == $state_count ) ? $sep = '' : $sep = ', '; 2271 $sep = ( ++$i === $state_count ) ? '' : ', '; 2272 2264 2273 echo "<span class='post-state'>$state$sep</span>"; 2265 2274 }
Note: See TracChangeset
for help on using the changeset viewer.