Changeset 53220
- Timestamp:
- 04/19/2022 03:11:22 PM (3 years ago)
- Location:
- trunk/src/wp-admin/includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/nav-menu.php
r53207 r53220 326 326 * @global int|string $nav_menu_selected_id 327 327 * 328 * @param string $ item_object Not used.328 * @param string $data_object Not used. 329 329 * @param array $box { 330 330 * Post type menu item meta box arguments. … … 336 336 * } 337 337 */ 338 function wp_nav_menu_item_post_type_meta_box( $ item_object, $box ) {338 function wp_nav_menu_item_post_type_meta_box( $data_object, $box ) { 339 339 global $_nav_menu_placeholder, $nav_menu_selected_id; 340 340 … … 690 690 * @global int|string $nav_menu_selected_id 691 691 * 692 * @param string $ item_object Not used.692 * @param string $data_object Not used. 693 693 * @param array $box { 694 694 * Taxonomy menu item meta box arguments. … … 700 700 * } 701 701 */ 702 function wp_nav_menu_item_taxonomy_meta_box( $ item_object, $box ) {702 function wp_nav_menu_item_taxonomy_meta_box( $data_object, $box ) { 703 703 global $nav_menu_selected_id; 704 704 … … 990 990 * @access private 991 991 * 992 * @param object $ item_object The post type or taxonomy meta-object.992 * @param object $data_object The post type or taxonomy meta-object. 993 993 * @return object The post type or taxonomy object. 994 994 */ 995 995 function _wp_nav_menu_meta_box_object( $item_object = null ) { 996 if ( isset( $ item_object->name ) ) {997 998 if ( 'page' === $ item_object->name ) {999 $ item_object->_default_query = array(996 if ( isset( $data_object->name ) ) { 997 998 if ( 'page' === $data_object->name ) { 999 $data_object->_default_query = array( 1000 1000 'orderby' => 'menu_order title', 1001 1001 'post_status' => 'publish', … … 1003 1003 1004 1004 // Posts should show only published items. 1005 } elseif ( 'post' === $ item_object->name ) {1006 $ item_object->_default_query = array(1005 } elseif ( 'post' === $data_object->name ) { 1006 $data_object->_default_query = array( 1007 1007 'post_status' => 'publish', 1008 1008 ); 1009 1009 1010 1010 // Categories should be in reverse chronological order. 1011 } elseif ( 'category' === $ item_object->name ) {1012 $ item_object->_default_query = array(1011 } elseif ( 'category' === $data_object->name ) { 1012 $data_object->_default_query = array( 1013 1013 'orderby' => 'id', 1014 1014 'order' => 'DESC', … … 1017 1017 // Custom post types should show only published items. 1018 1018 } else { 1019 $ item_object->_default_query = array(1019 $data_object->_default_query = array( 1020 1020 'post_status' => 'publish', 1021 1021 ); … … 1023 1023 } 1024 1024 1025 return $ item_object;1025 return $data_object; 1026 1026 } 1027 1027 -
trunk/src/wp-admin/includes/template.php
r52999 r53220 194 194 * Retrieves a list of the most popular terms from the specified taxonomy. 195 195 * 196 * If the $echoargument is true then the elements for a list of checkbox196 * If the `$display` argument is true then the elements for a list of checkbox 197 197 * `<input>` elements labelled with the names of the selected terms is output. 198 * If the $post_IDglobal is not empty then the terms associated with that198 * If the `$post_ID` global is not empty then the terms associated with that 199 199 * post will be marked as checked. 200 200 * 201 201 * @since 2.5.0 202 202 * 203 * @param string $taxonomy Taxonomy to retrieve terms from.204 * @param int $default 205 * @param int $number Number of terms to retrieve. Defaults to10.206 * @param bool $ echo Optionally output the list as well. Defaults totrue.203 * @param string $taxonomy Taxonomy to retrieve terms from. 204 * @param int $default_term Optional. Not used. 205 * @param int $number Optional. Number of terms to retrieve. Default 10. 206 * @param bool $display Optional. Whether to display the list as well. Default true. 207 207 * @return int[] Array of popular term IDs. 208 208 */ 209 function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo= true ) {209 function wp_popular_terms_checklist( $taxonomy, $default_term = 0, $number = 10, $display = true ) { 210 210 $post = get_post(); 211 211 … … 232 232 foreach ( (array) $terms as $term ) { 233 233 $popular_ids[] = $term->term_id; 234 if ( ! $echo ) { // Hack for Ajax use. 234 235 if ( ! $display ) { // Hack for Ajax use. 235 236 continue; 236 237 } 238 237 239 $id = "popular-$taxonomy-$term->term_id"; 238 240 $checked = in_array( $term->term_id, $checked_terms, true ) ? 'checked="checked"' : ''; … … 875 877 * @since 4.7.0 Added the `$post_type` parameter. 876 878 * 877 * @param string $default 878 * @param string $post_type Optional. Post type to get templates for. Default 'post'.879 */ 880 function page_template_dropdown( $default = '', $post_type = 'page' ) {879 * @param string $default_template Optional. The template file name. Default empty. 880 * @param string $post_type Optional. Post type to get templates for. Default 'post'. 881 */ 882 function page_template_dropdown( $default_template = '', $post_type = 'page' ) { 881 883 $templates = get_page_templates( null, $post_type ); 882 884 … … 884 886 885 887 foreach ( array_keys( $templates ) as $template ) { 886 $selected = selected( $default , $templates[ $template ], false );888 $selected = selected( $default_template, $templates[ $template ], false ); 887 889 echo "\n\t<option value='" . esc_attr( $templates[ $template ] ) . "' $selected>" . esc_html( $template ) . '</option>'; 888 890 } … … 897 899 * @global wpdb $wpdb WordPress database abstraction object. 898 900 * 899 * @param int $default Optional. The default page ID to be pre-selected. Default 0.900 * @param int $parent Optional. The parent page ID. Default 0.901 * @param int $level Optional. Page depth level. Default 0.902 * @param int|WP_Post $post Post ID or WP_Post object.901 * @param int $default_page Optional. The default page ID to be pre-selected. Default 0. 902 * @param int $parent Optional. The parent page ID. Default 0. 903 * @param int $level Optional. Page depth level. Default 0. 904 * @param int|WP_Post $post Post ID or WP_Post object. 903 905 * @return void|false Void on success, false if the page has no children. 904 906 */ 905 function parent_dropdown( $default = 0, $parent = 0, $level = 0, $post = null ) {907 function parent_dropdown( $default_page = 0, $parent = 0, $level = 0, $post = null ) { 906 908 global $wpdb; 907 909 … … 917 919 918 920 $pad = str_repeat( ' ', $level * 3 ); 919 $selected = selected( $default , $item->ID, false );921 $selected = selected( $default_page, $item->ID, false ); 920 922 921 923 echo "\n\t<option class='level-$level' value='$item->ID' $selected>$pad " . esc_html( $item->post_title ) . '</option>'; 922 parent_dropdown( $default , $item->ID, $level + 1 );924 parent_dropdown( $default_page, $item->ID, $level + 1 ); 923 925 } 924 926 } else { … … 1129 1131 * @since 5.0.0 1130 1132 * 1131 * @param mixed $ object The data object being rendered on this screen.1132 * @param array $box {1133 * @param mixed $data_object The data object being rendered on this screen. 1134 * @param array $box { 1133 1135 * Custom formats meta box arguments. 1134 1136 * … … 1139 1141 * } 1140 1142 */ 1141 function do_block_editor_incompatible_meta_box( $ object, $box ) {1143 function do_block_editor_incompatible_meta_box( $data_object, $box ) { 1142 1144 $plugin = _get_plugin_from_callback( $box['old_callback'] ); 1143 1145 $plugins = get_plugins(); … … 1175 1177 echo '</p>'; 1176 1178 } 1177 } elseif ( $ object instanceof WP_Post ) {1179 } elseif ( $data_object instanceof WP_Post ) { 1178 1180 $edit_url = add_query_arg( 1179 1181 array( … … 1181 1183 'classic-editor__forget' => '', 1182 1184 ), 1183 get_edit_post_link( $ object )1185 get_edit_post_link( $data_object ) 1184 1186 ); 1185 1187 echo '<p>'; … … 1245 1247 * @global array $wp_meta_boxes 1246 1248 * 1247 * @param string|WP_Screen $screen The screen identifier. If you have used add_menu_page() or1248 * add_submenu_page() to create a new screen (and hence screen_id)1249 * make sure your menu slug conforms to the limits of sanitize_key()1250 * otherwise the 'screen' menu may not correctly render on your page.1251 * @param string $context The screen context for which to display meta boxes.1252 * @param mixed $ objectGets passed to the meta box callback function as the first parameter.1253 * Often this is the object that's the focus of the current screen, for1254 * example a `WP_Post` or `WP_Comment` object.1249 * @param string|WP_Screen $screen The screen identifier. If you have used add_menu_page() or 1250 * add_submenu_page() to create a new screen (and hence screen_id) 1251 * make sure your menu slug conforms to the limits of sanitize_key() 1252 * otherwise the 'screen' menu may not correctly render on your page. 1253 * @param string $context The screen context for which to display meta boxes. 1254 * @param mixed $data_object Gets passed to the meta box callback function as the first parameter. 1255 * Often this is the object that's the focus of the current screen, 1256 * for example a `WP_Post` or `WP_Comment` object. 1255 1257 * @return int Number of meta_boxes. 1256 1258 */ 1257 function do_meta_boxes( $screen, $context, $ object ) {1259 function do_meta_boxes( $screen, $context, $data_object ) { 1258 1260 global $wp_meta_boxes; 1259 1261 static $already_sorted = false; … … 1397 1399 } 1398 1400 1399 call_user_func( $box['callback'], $ object, $box );1401 call_user_func( $box['callback'], $data_object, $box ); 1400 1402 echo "</div>\n"; 1401 1403 echo "</div>\n"; … … 1474 1476 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes. 1475 1477 * 1476 * @param string|object $screen The screen identifier.1477 * @param string $context The screen context for which to display accordion sections.1478 * @param mixed $ objectGets passed to the section callback function as the first parameter.1478 * @param string|object $screen The screen identifier. 1479 * @param string $context The screen context for which to display accordion sections. 1480 * @param mixed $data_object Gets passed to the section callback function as the first parameter. 1479 1481 * @return int Number of meta boxes as accordion sections. 1480 1482 */ 1481 function do_accordion_sections( $screen, $context, $ object ) {1483 function do_accordion_sections( $screen, $context, $data_object ) { 1482 1484 global $wp_meta_boxes; 1483 1485 … … 1524 1526 <div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>"> 1525 1527 <div class="inside"> 1526 <?php call_user_func( $box['callback'], $ object, $box ); ?>1528 <?php call_user_func( $box['callback'], $data_object, $box ); ?> 1527 1529 </div><!-- .inside --> 1528 1530 </div><!-- .accordion-section-content --> … … 2136 2138 * 2137 2139 * @since 2.7.0 2138 * @since 5.3.0 Added the `$ echo` parameter and a return value.2140 * @since 5.3.0 Added the `$display` parameter and a return value. 2139 2141 * 2140 2142 * @see get_post_states() 2141 2143 * 2142 * @param WP_Post $post The post to retrieve states for. 2143 * @param bool $echo Optional. Whether to echo the post states as an HTML string. Default true. 2144 * @param WP_Post $post The post to retrieve states for. 2145 * @param bool $display Optional. Whether to display the post states as an HTML string. 2146 * Default true. 2144 2147 * @return string Post states string. 2145 2148 */ 2146 function _post_states( $post, $ echo= true ) {2149 function _post_states( $post, $display = true ) { 2147 2150 $post_states = get_post_states( $post ); 2148 2151 $post_states_string = ''; … … 2164 2167 } 2165 2168 2166 if ( $ echo) {2169 if ( $display ) { 2167 2170 echo $post_states_string; 2168 2171 } … … 2251 2254 * 2252 2255 * @since 3.2.0 2253 * @since 5.6.0 Added the `$echo` parameter and a return value. 2254 * 2255 * @param WP_Post $post The attachment post to retrieve states for. 2256 * @param bool $echo Optional. Whether to echo the post states as an HTML string. Default true. 2256 * @since 5.6.0 Added the `$display` parameter and a return value. 2257 * 2258 * @param WP_Post $post The attachment post to retrieve states for. 2259 * @param bool $display Optional. Whether to display the post states as an HTML string. 2260 * Default true. 2257 2261 * @return string Media states string. 2258 2262 */ 2259 function _media_states( $post, $ echo= true ) {2263 function _media_states( $post, $display = true ) { 2260 2264 $media_states = get_media_states( $post ); 2261 2265 $media_states_string = ''; … … 2277 2281 } 2278 2282 2279 if ( $ echo) {2283 if ( $display ) { 2280 2284 echo $media_states_string; 2281 2285 }
Note: See TracChangeset
for help on using the changeset viewer.