diff -r be944660c56a -r 3d72ae0968f4 wp/wp-admin/includes/template.php --- a/wp/wp-admin/includes/template.php Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-admin/includes/template.php Tue Sep 27 16:37:53 2022 +0200 @@ -19,7 +19,7 @@ // /** - * Output an unordered list of checkbox input elements labeled with category names. + * Outputs an unordered list of checkbox input elements labeled with category names. * * @since 2.5.1 * @@ -52,7 +52,7 @@ } /** - * Output an unordered list of checkbox input elements labelled with term names. + * Outputs an unordered list of checkbox input elements labelled with term names. * * Taxonomy-independent version of wp_category_checklist(). * @@ -68,8 +68,8 @@ * @type int[] $selected_cats Array of category IDs to mark as checked. Default false. * @type int[] $popular_cats Array of category IDs to receive the "popular-category" class. * Default false. - * @type Walker $walker Walker object to use to build the output. - * Default is a Walker_Category_Checklist instance. + * @type Walker $walker Walker object to use to build the output. Default empty which + * results in a Walker_Category_Checklist instance being used. * @type string $taxonomy Taxonomy to generate the checklist for. Default 'category'. * @type bool $checked_ontop Whether to move checked items out of the hierarchy and to * the top of the list. Default true. @@ -96,8 +96,8 @@ * * @see wp_terms_checklist() * - * @param array $args An array of arguments. - * @param int $post_id The post ID. + * @param array|string $args An array or string of arguments. + * @param int $post_id The post ID. */ $params = apply_filters( 'wp_terms_checklist_args', $args, $post_id ); @@ -191,22 +191,22 @@ } /** - * Retrieve a list of the most popular terms from the specified taxonomy. + * Retrieves a list of the most popular terms from the specified taxonomy. * - * If the $echo argument is true then the elements for a list of checkbox + * If the `$display` argument is true then the elements for a list of checkbox * `` elements labelled with the names of the selected terms is output. - * If the $post_ID global isn't empty then the terms associated with that + * If the `$post_ID` global is not empty then the terms associated with that * post will be marked as checked. * * @since 2.5.0 * - * @param string $taxonomy Taxonomy to retrieve terms from. - * @param int $default Not used. - * @param int $number Number of terms to retrieve. Defaults to 10. - * @param bool $echo Optionally output the list as well. Defaults to true. + * @param string $taxonomy Taxonomy to retrieve terms from. + * @param int $default_term Optional. Not used. + * @param int $number Optional. Number of terms to retrieve. Default 10. + * @param bool $display Optional. Whether to display the list as well. Default true. * @return int[] Array of popular term IDs. */ -function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) { +function wp_popular_terms_checklist( $taxonomy, $default_term = 0, $number = 10, $display = true ) { $post = get_post(); if ( $post && $post->ID ) { @@ -231,9 +231,11 @@ foreach ( (array) $terms as $term ) { $popular_ids[] = $term->term_id; - if ( ! $echo ) { // Hack for Ajax use. + + if ( ! $display ) { // Hack for Ajax use. continue; } + $id = "popular-$taxonomy-$term->term_id"; $checked = in_array( $term->term_id, $checked_terms, true ) ? 'checked="checked"' : ''; ?> @@ -344,7 +346,11 @@ foreach ( $taxonomy_names as $taxonomy_name ) { $taxonomy = get_taxonomy( $taxonomy_name ); - if ( $taxonomy->hierarchical && $taxonomy->show_ui ) { + if ( ! $taxonomy->show_in_quick_edit ) { + continue; + } + + if ( $taxonomy->hierarchical ) { $terms = get_object_term_cache( $post->ID, $taxonomy_name ); if ( false === $terms ) { @@ -355,7 +361,7 @@ echo '
' . implode( ',', $term_ids ) . '
'; - } elseif ( $taxonomy->show_ui ) { + } else { $terms_to_edit = get_terms_to_edit( $post->ID, $taxonomy_name ); if ( ! is_string( $terms_to_edit ) ) { @@ -527,7 +533,7 @@ } /** - * Output 'undo move to Trash' text for comments + * Outputs 'undo move to Trash' text for comments. * * @since 2.9.0 */ @@ -770,7 +776,7 @@ } /** - * Print out HTML form date elements for editing post or comment publish date. + * Prints out HTML form date elements for editing post or comment publish date. * * @since 0.71 * @since 4.4.0 Converted to use get_comment() instead of the global `$comment`. @@ -865,40 +871,40 @@ } /** - * Print out option HTML elements for the page templates drop-down. + * Prints out option HTML elements for the page templates drop-down. * * @since 1.5.0 * @since 4.7.0 Added the `$post_type` parameter. * - * @param string $default Optional. The template file name. Default empty. - * @param string $post_type Optional. Post type to get templates for. Default 'post'. + * @param string $default_template Optional. The template file name. Default empty. + * @param string $post_type Optional. Post type to get templates for. Default 'post'. */ -function page_template_dropdown( $default = '', $post_type = 'page' ) { +function page_template_dropdown( $default_template = '', $post_type = 'page' ) { $templates = get_page_templates( null, $post_type ); ksort( $templates ); foreach ( array_keys( $templates ) as $template ) { - $selected = selected( $default, $templates[ $template ], false ); + $selected = selected( $default_template, $templates[ $template ], false ); echo "\n\t'; } } /** - * Print out option HTML elements for the page parents drop-down. + * Prints out option HTML elements for the page parents drop-down. * * @since 1.5.0 * @since 4.4.0 `$post` argument was added. * * @global wpdb $wpdb WordPress database abstraction object. * - * @param int $default Optional. The default page ID to be pre-selected. Default 0. - * @param int $parent Optional. The parent page ID. Default 0. - * @param int $level Optional. Page depth level. Default 0. - * @param int|WP_Post $post Post ID or WP_Post object. + * @param int $default_page Optional. The default page ID to be pre-selected. Default 0. + * @param int $parent Optional. The parent page ID. Default 0. + * @param int $level Optional. Page depth level. Default 0. + * @param int|WP_Post $post Post ID or WP_Post object. * @return void|false Void on success, false if the page has no children. */ -function parent_dropdown( $default = 0, $parent = 0, $level = 0, $post = null ) { +function parent_dropdown( $default_page = 0, $parent = 0, $level = 0, $post = null ) { global $wpdb; $post = get_post( $post ); @@ -912,10 +918,10 @@ } $pad = str_repeat( ' ', $level * 3 ); - $selected = selected( $default, $item->ID, false ); + $selected = selected( $default_page, $item->ID, false ); echo "\n\t'; - parent_dropdown( $default, $item->ID, $level + 1 ); + parent_dropdown( $default_page, $item->ID, $level + 1 ); } } else { return false; @@ -923,7 +929,7 @@ } /** - * Print out option HTML elements for role selectors. + * Prints out option HTML elements for role selectors. * * @since 2.1.0 * @@ -1119,13 +1125,13 @@ /** - * Function that renders a "fake" meta box with an information message, + * Renders a "fake" meta box with an information message, * shown on the block editor, when an incompatible meta box is found. * * @since 5.0.0 * - * @param mixed $object The data object being rendered on this screen. - * @param array $box { + * @param mixed $data_object The data object being rendered on this screen. + * @param array $box { * Custom formats meta box arguments. * * @type string $id Meta box 'id' attribute. @@ -1134,15 +1140,15 @@ * @type array $args Extra meta box arguments. * } */ -function do_block_editor_incompatible_meta_box( $object, $box ) { +function do_block_editor_incompatible_meta_box( $data_object, $box ) { $plugin = _get_plugin_from_callback( $box['old_callback'] ); $plugins = get_plugins(); echo '

'; if ( $plugin ) { /* translators: %s: The name of the plugin that generated this meta box. */ - printf( __( "This meta box, from the %s plugin, isn't compatible with the block editor." ), "{$plugin['Name']}" ); + printf( __( 'This meta box, from the %s plugin, is not compatible with the block editor.' ), "{$plugin['Name']}" ); } else { - _e( "This meta box isn't compatible with the block editor." ); + _e( 'This meta box is not compatible with the block editor.' ); } echo '

'; @@ -1170,13 +1176,13 @@ printf( __( 'Please activate the Classic Editor plugin to use this meta box.' ), esc_url( $activate_url ) ); echo '

'; } - } elseif ( $object instanceof WP_Post ) { + } elseif ( $data_object instanceof WP_Post ) { $edit_url = add_query_arg( array( 'classic-editor' => '', 'classic-editor__forget' => '', ), - get_edit_post_link( $object ) + get_edit_post_link( $data_object ) ); echo '

'; /* translators: %s: A link to use the Classic Editor plugin. */ @@ -1240,17 +1246,17 @@ * * @global array $wp_meta_boxes * - * @param string|WP_Screen $screen The screen identifier. If you have used add_menu_page() or - * add_submenu_page() to create a new screen (and hence screen_id) - * make sure your menu slug conforms to the limits of sanitize_key() - * otherwise the 'screen' menu may not correctly render on your page. - * @param string $context The screen context for which to display meta boxes. - * @param mixed $object Gets passed to the meta box callback function as the first parameter. - * Often this is the object that's the focus of the current screen, for - * example a `WP_Post` or `WP_Comment` object. + * @param string|WP_Screen $screen The screen identifier. If you have used add_menu_page() or + * add_submenu_page() to create a new screen (and hence screen_id) + * make sure your menu slug conforms to the limits of sanitize_key() + * otherwise the 'screen' menu may not correctly render on your page. + * @param string $context The screen context for which to display meta boxes. + * @param mixed $data_object Gets passed to the meta box callback function as the first parameter. + * Often this is the object that's the focus of the current screen, + * for example a `WP_Post` or `WP_Comment` object. * @return int Number of meta_boxes. */ -function do_meta_boxes( $screen, $context, $object ) { +function do_meta_boxes( $screen, $context, $data_object ) { global $wp_meta_boxes; static $already_sorted = false; @@ -1384,7 +1390,7 @@

{$plugin['Name']}" ); + printf( __( 'This meta box, from the %s plugin, is not compatible with the block editor.' ), "{$plugin['Name']}" ); ?>

@@ -1392,7 +1398,7 @@ } } - call_user_func( $box['callback'], $object, $box ); + call_user_func( $box['callback'], $data_object, $box ); echo "\n"; echo "\n"; } @@ -1469,12 +1475,12 @@ * * @uses global $wp_meta_boxes Used to retrieve registered meta boxes. * - * @param string|object $screen The screen identifier. - * @param string $context The screen context for which to display accordion sections. - * @param mixed $object Gets passed to the section callback function as the first parameter. + * @param string|object $screen The screen identifier. + * @param string $context The screen context for which to display accordion sections. + * @param mixed $data_object Gets passed to the section callback function as the first parameter. * @return int Number of meta boxes as accordion sections. */ -function do_accordion_sections( $screen, $context, $object ) { +function do_accordion_sections( $screen, $context, $data_object ) { global $wp_meta_boxes; wp_enqueue_script( 'accordion' ); @@ -1519,7 +1525,7 @@
- +
@@ -1536,7 +1542,7 @@ } /** - * Add a new section to a settings page. + * Adds a new section to a settings page. * * Part of the Settings API. Use this to define new settings sections for an admin page. * Show settings sections in your admin page callback function with do_settings_sections(). @@ -1594,7 +1600,7 @@ } /** - * Add a new field to a section of a settings page. + * Adds a new field to a section of a settings page. * * Part of the Settings API. Use this to define a settings field that will show * as part of a settings section inside a settings page. The fields are shown using @@ -1704,7 +1710,7 @@ } /** - * Print out the settings fields for a particular settings section. + * Prints out the settings fields for a particular settings section. * * Part of the Settings API. Use this in a settings page to output * a specific section. Should normally be called by do_settings_sections() @@ -1747,7 +1753,7 @@ } /** - * Register a settings error to be displayed to the user. + * Registers a settings error to be displayed to the user. * * Part of the Settings API. Use this to show messages to users about settings validation * problems, missing settings or anything else. @@ -1783,7 +1789,7 @@ } /** - * Fetch settings errors registered by add_settings_error(). + * Fetches settings errors registered by add_settings_error(). * * Checks the $wp_settings_errors array for any errors declared during the current * pageload and returns them. @@ -1854,7 +1860,7 @@ } /** - * Display settings errors registered by add_settings_error(). + * Displays settings errors registered by add_settings_error(). * * Part of the Settings API. Outputs a div for each error retrieved by * get_settings_errors(). @@ -1974,7 +1980,7 @@ } /** - * Get the post title. + * Gets the post title. * * The post title is fetched and if it is blank then a default string is * returned. @@ -2005,7 +2011,7 @@ } /** - * Generic Iframe header for use with Thickbox + * Generic Iframe header for use with Thickbox. * * @since 2.7.0 * @@ -2031,7 +2037,7 @@ wp_enqueue_style( 'colors' ); ?>