WordPress.org

Make WordPress Core

Ticket #26089: 26089.2.diff

File 26089.2.diff, 10.4 KB (added by shelob9, 6 years ago)

Inline docs for all filters and hooks in admin/includes/template.php

  • wp-admin/includes/template.php

    diff --git wp-admin/includes/template.php wp-admin/includes/template.php
    index 5d43a25..f64a53f 100644
    class Walker_Category_Checklist extends Walker { 
    8080                        $name = 'tax_input['.$taxonomy.']';
    8181
    8282                $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
    83                 $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . checked( in_array( $category->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
     83
     84        /**
     85         * Filter category name in category checkbox.
     86         *
     87         * @since 1.2.1
     88         *
     89         */
     90        $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . checked( in_array( $category->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
    8491        }
    8592
    8693        /**
    function wp_terms_checklist($post_id = 0, $args = array()) { 
    143150                'taxonomy' => 'category',
    144151                'checked_ontop' => true
    145152        );
    146         $args = apply_filters( 'wp_terms_checklist_args', $args, $post_id );
     153    /**
     154     * Filters arguments for wp_terms_checklist()
     155     *
     156     * @since 3.4
     157     *
     158     * @param array $args {
     159     *     The args for wp_terms checklist
     160     *
     161     *     @type bool $descendants_and_self Display only categories that apply to this post and their children or display all categories.
     162     *     @type bool|array $selected_cats Default (false) no categories. Or an array of category ids specify which categories should be selected by default in the list..
     163     *     @type bool|array $popular_cats Default (false) top 10 categories by count. Or an array of categories specify which categories should be shown in the popular categories list.
     164     *     @type object $walker Walker class to render the list with.
     165     *     @type string $taxonomy Taxonomy to return. Default category. Any registered taxonomy can be returned.
     166     *     @type bool $checked_ontop Display checked categories at the top of the terms list or not.
     167     * }
     168     *
     169     * @param int $post_id Post ID
     170     */
     171    $args = apply_filters( 'wp_terms_checklist_args', $args, $post_id );
    147172
    148173        extract( wp_parse_args($args, $defaults), EXTR_SKIP );
    149174
    function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech 
    231256                        continue;
    232257                $id = "popular-$taxonomy-$term->term_id";
    233258                $checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';
     259
     260        /**
     261         * Filter terms names in category checkbox.
     262         *
     263         * @since unknown
     264         *
     265         */
    234266                ?>
    235267
    236268                <li id="<?php echo $id; ?>" class="popular-category">
    function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech 
    246278}
    247279
    248280/**
    249  * {@internal Missing Short Description}}
     281 * Outputs link category checklist in admin template.
    250282 *
    251283 * @since 2.5.1
    252284 *
    253  * @param unknown_type $link_id
     285 * @param int $link_id
    254286 */
    255287function wp_link_category_checklist( $link_id = 0 ) {
    256288        $default = 1;
    function wp_link_category_checklist( $link_id = 0 ) { 
    271303
    272304        foreach ( $categories as $category ) {
    273305                $cat_id = $category->term_id;
    274                 $name = esc_html( apply_filters( 'the_category', $category->name ) );
     306        /**
     307         * Filters link category names
     308         *
     309         * @since unknown
     310         */
     311        $name = esc_html( apply_filters( 'the_category', $category->name ) );
    275312                $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
    276313                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>";
    277314        }
    278315}
    279316
    280 // adds hidden fields with the data for use in the inline editor for posts and pages
    281317/**
    282  * {@internal Missing Short Description}}
     318 * Hidden fields for inline editor.
     319 *
     320 * Adds hidden fields with the data for use in the inline editor for posts and pages.
    283321 *
    284322 * @since 2.7.0
    285323 *
    286  * @param unknown_type $post
     324 * @param id $post Post id
    287325 */
    288326function get_inline_data($post) {
    289327        $post_type_object = get_post_type_object($post->post_type);
    function get_inline_data($post) { 
    292330
    293331        $title = esc_textarea( trim( $post->post_title ) );
    294332
    295         echo '
     333    /**
     334     * Filter for post name in inline editor.
     335     *
     336     * Applies editable slug filter to post name field for hidden field for inline post/page editor.
     337     *
     338     * @since 2.9.0
     339     */
     340    echo '
    296341<div class="hidden" id="inline_' . $post->ID . '">
    297342        <div class="post_title">' . $title . '</div>
    298343        <div class="post_name">' . apply_filters('editable_slug', $post->post_name) . '</div>
    function get_inline_data($post) { 
    340385}
    341386
    342387/**
    343  * {@internal Missing Short Description}}
     388 * Display comments reply post or page.
    344389 *
    345390 * @since 2.7.0
    346391 *
    347  * @param unknown_type $position
    348  * @param unknown_type $checkbox
    349  * @param unknown_type $mode
     392 * @param int $position
     393 * @param bool $checkbox
     394 * @param string $mode
     395 * @param bool $table_row
    350396 */
    351397function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', $table_row = true) {
    352         // allow plugin to replace the popup content
     398        /**
     399     * Filter to allow plugin to replace the popup content
     400     *
     401     * Filter to replace the comment reply popup content via a plugin
     402     *
     403     * @see wp_comment_reply
     404     *
     405     * @since 2.7.0
     406     */
    353407        $content = apply_filters( 'wp_comment_reply', '', array('position' => $position, 'checkbox' => $checkbox, 'mode' => $mode) );
    354408
    355409        if ( ! empty($content) ) {
    function _list_meta_row( $entry, &$count ) { 
    556610function meta_form( $post = null ) {
    557611        global $wpdb;
    558612        $post = get_post( $post );
    559         $limit = (int) apply_filters( 'postmeta_form_limit', 30 );
     613    /**
     614     * Filters the number of post-meta information items shown on the post edit screen.
     615     *
     616     * @since 2.1.0
     617     */
     618    $limit = (int) apply_filters( 'postmeta_form_limit', 30 );
    560619        $keys = $wpdb->get_col( "
    561620                SELECT meta_key
    562621                FROM $wpdb->postmeta
    function wp_dropdown_roles( $selected = false ) { 
    776835 * @param string $action The action attribute for the form.
    777836 */
    778837function wp_import_upload_form( $action ) {
     838    /**
     839     * Filter the maximum allowed upload size.
     840     *
     841     * @since 2.3.0
     842     *
     843     * @uses wp_max_upload_size()
     844     */
    779845        $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
    780846        $size = size_format( $bytes );
    781847        $upload_dir = wp_upload_dir();
    var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', 
    14261492//]]>
    14271493</script>
    14281494<?php
     1495/**#@+ This action is documented in wp-admin/admin-header.php */
    14291496do_action('admin_enqueue_scripts', $hook_suffix);
    14301497do_action("admin_print_styles-$hook_suffix");
    14311498do_action('admin_print_styles');
    do_action("admin_print_scripts-$hook_suffix"); 
    14331500do_action('admin_print_scripts');
    14341501do_action("admin_head-$hook_suffix");
    14351502do_action('admin_head');
    1436 
     1503/**#@-*/
    14371504$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
    14381505
    14391506if ( is_rtl() )
    14401507        $admin_body_class .= ' rtl';
    14411508
    1442 ?>
     1509    /**
     1510     * Filter the body class for admin.
     1511     *
     1512     * @since 3.3.0
     1513     */
     1514    ?>
    14431515</head>
    14441516<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-admin wp-core-ui no-js iframe <?php echo apply_filters( 'admin_body_class', '' ) . ' ' . $admin_body_class; ?>">
    14451517<script type="text/javascript">
    function iframe_footer() { 
    14641536        //We're going to hide any footer output on iframe pages, but run the hooks anyway since they output Javascript or other needed content. ?>
    14651537        <div class="hidden">
    14661538<?php
     1539    /**#@+ This action is documented in wp-admin/admin-footer.php */
    14671540        do_action('admin_footer', '');
    1468         do_action('admin_print_footer_scripts'); ?>
     1541        do_action('admin_print_footer_scripts');
     1542    /**#@-*/
     1543?>
    14691544        </div>
    14701545<script type="text/javascript">if(typeof wpOnload=="function")wpOnload();</script>
    14711546</body>
    function _post_states($post) { 
    14911566                $post_states['pending'] = _x('Pending', 'post state');
    14921567        if ( is_sticky($post->ID) )
    14931568                $post_states['sticky'] = __('Sticky');
    1494 
    1495         $post_states = apply_filters( 'display_post_states', $post_states, $post );
     1569    /**
     1570     * Filters the output of _posts_states().
     1571     *
     1572     * @param string $post_states The current post status
     1573     * @param int $post The post id.
     1574     *
     1575     * @since 2.8.0
     1576     */
     1577    $post_states = apply_filters( 'display_post_states', $post_states, $post );
    14961578
    14971579        if ( ! empty($post_states) ) {
    14981580                $state_count = count($post_states);
    function _media_states( $post ) { 
    15221604                if ( ! empty( $meta_background ) && $meta_background == $stylesheet )
    15231605                        $media_states[] = __( 'Background Image' );
    15241606        }
    1525 
    1526         $media_states = apply_filters( 'display_media_states', $media_states );
     1607    /**
     1608     * Filter what custom header of background image is labeled as.
     1609     *
     1610     * Allows for changing what custom-header and custom-background are labeled as in their admin editors.
     1611     *
     1612     * @param string $media_states The
     1613     *
     1614     * @since 3.2.0
     1615     */
     1616    $media_states = apply_filters( 'display_media_states', $media_states );
    15271617
    15281618        if ( ! empty( $media_states ) ) {
    15291619                $state_count = count( $media_states );
    function _wp_admin_html_begin() { 
    16921782        if ( $is_IE )
    16931783                @header('X-UA-Compatible: IE=edge');
    16941784
     1785/**
     1786 * Outputs xmlns attribute for admin.
     1787 *
     1788 * Outputs, the xmlns in admin header, which specifies the xml namespace for a document.
     1789 *
     1790 * @since 2.2.0
     1791 *
     1792**/
    16951793?>
    16961794<!DOCTYPE html>
    16971795<!--[if IE 8]>
    final class WP_Internal_Pointers { 
    17571855                                                continue 2;
    17581856                                }
    17591857                        }
    1760 
    1761                         // Bind pointer print function
    17621858                        add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) );
    17631859                        $got_pointers = true;
    17641860                }