Make WordPress Core

Changeset 27669


Ignore:
Timestamp:
03/24/2014 02:20:33 AM (11 years ago)
Author:
DrewAPicture
Message:

Inline documentation for hooks in wp-admin/includes/dashboard.php.

Props mauryaratan. Props kpdesign for some minor cleanup.
Fixes #25752.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/dashboard.php

    r27613 r27669  
    5757    wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress News' ), 'wp_dashboard_primary' );
    5858
    59     // Hook to register new widgets
    60     // Filter widget order
    6159    if ( is_network_admin() ) {
     60
     61        /**
     62         * Fires after core widgets for the Network Admin dashboard have been registered.
     63         *
     64         * @since 3.1.0
     65         */
    6266        do_action( 'wp_network_dashboard_setup' );
     67
     68        /**
     69         * Filter the list of widgets to load for the Network Admin dashboard.
     70         *
     71         * @since 3.1.0
     72         *
     73         * @param array $dashboard_widgets An array of dashboard widgets.
     74         */
    6375        $dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() );
    6476    } elseif ( is_user_admin() ) {
     77
     78        /**
     79         * Fires after core widgets for the User Admin dashboard have been registered.
     80         *
     81         * @since 3.1.0
     82         */
    6583        do_action( 'wp_user_dashboard_setup' );
     84
     85        /**
     86         * Filter the list of widgets to load for the User Admin dashboard.
     87         *
     88         * @since 3.1.0
     89         *
     90         * @param array $dashboard_widgets An array of dashboard widgets.
     91         */
    6692        $dashboard_widgets = apply_filters( 'wp_user_dashboard_widgets', array() );
    6793    } else {
     94
     95        /**
     96         * Fires after core widgets for the admin dashboard have been registered.
     97         *
     98         * @since 2.5.0
     99         */
    68100        do_action( 'wp_dashboard_setup' );
     101
     102        /**
     103         * Filter the list of widgets to load for the admin dashboard.
     104         *
     105         * @since 2.5.0
     106         *
     107         * @param array $dashboard_widgets An array of dashboard widgets.
     108         */
    69109        $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
    70110    }
     
    88128
    89129    /** This action is documented in wp-admin/edit-form-advanced.php */
    90     do_action('do_meta_boxes', $screen->id, 'normal', '');
     130    do_action( 'do_meta_boxes', $screen->id, 'normal', '' );
     131
    91132    /** This action is documented in wp-admin/edit-form-advanced.php */
    92     do_action('do_meta_boxes', $screen->id, 'side', '');
     133    do_action( 'do_meta_boxes', $screen->id, 'side', '' );
    93134}
    94135
     
    166207}
    167208
    168 /* Dashboard Widgets */
     209//
     210// Dashboard Widgets
     211//
    169212
    170213/**
     
    221264
    222265    /**
    223      * Include additional elements in the 'At a Glance' dashboard widget.
    224      * This widget was previously 'Right Now'.
     266     * Filter the array of extra elements to list in the 'At a Glance'
     267     * dashboard widget.
     268     *
     269     * Prior to 3.8.0, the widget was named 'Right Now'. Each element
     270     * is wrapped in list-item tags on output.
    225271     *
    226272     * @since 3.8.0
    227      * @param array $items Array of items.
     273     *
     274     * @param array $items Array of extra 'At a Glance' widget items.
    228275     */
    229276    $elements = apply_filters( 'dashboard_glance_items', array() );
     277
    230278    if ( $elements ) {
    231279        echo '<li>' . implode( "</li>\n<li>", $elements ) . "</li>\n";
     
    241289
    242290        /**
    243          * Filter the title attribute for the link displayed in Site Content metabox when search engines are discouraged from indexing the site.
     291         * Filter the link title attribute for the 'Search Engines Discouraged'
     292         * message displayed in the 'At a Glance' dashboard widget.
     293         *
     294         * Prior to 3.8.0, the widget was named 'Right Now'.
    244295         *
    245296         * @since 3.0.0
    246297         *
    247          * @param string Default attribute text.
     298         * @param string $title Default attribute text.
    248299         */
    249300        $title = apply_filters( 'privacy_on_link_title', __( 'Your site is asking search engines not to index its content' ) );
    250301
    251302        /**
    252          * Filter the text for the link displayed in Site Content metabox when search engines are discouraged from indexing the site.
     303         * Filter the link label for the 'Search Engines Discouraged' message
     304         * displayed in the 'At a Glance' dashboard widget.
     305         *
     306         * Prior to 3.8.0, the widget was named 'Right Now'.
    253307         *
    254308         * @since 3.0.0
    255309         *
    256          * @param string Default text.
     310         * @param string $content Default text.
    257311         */
    258312        $content = apply_filters( 'privacy_on_link_text' , __( 'Search Engines Discouraged' ) );
     
    263317    </div>
    264318    <?php
    265     // activity_box_end has a core action, but only prints content when multisite.
    266     // Using an output buffer is the only way to really check if anything's displayed here.
     319    /*
     320     * activity_box_end has a core action, but only prints content when multisite.
     321     * Using an output buffer is the only way to really check if anything's displayed here.
     322     */
    267323    ob_start();
     324
     325    /**
     326     * Fires at the end of the 'At a Glance' dashboard widget.
     327     *
     328     * Prior to 3.8.0, the widget was named 'Right Now'.
     329     *
     330     * @since 2.5.0
     331     */
    268332    do_action( 'rightnow_end' );
     333
     334    /**
     335     * Fires at the end of the 'At a Glance' dashboard widget.
     336     *
     337     * Prior to 3.8.0, the widget was named 'Right Now'.
     338     *
     339     * @since 2.0.0
     340     */
    269341    do_action( 'activity_box_end' );
     342
    270343    $actions = ob_get_clean();
    271344
     
    304377
    305378    <p class="youhave"><?php echo $sentence; ?></p>
    306     <?php do_action( 'wpmuadminresult', '' ); ?>
     379
     380
     381    <?php
     382        /**
     383         * Fires in the Network Admin 'Right Now' dashboard widget
     384         * just before the user and site search form fields.
     385         *
     386         * @since MU
     387         *
     388         * @param null $unused
     389         */
     390        do_action( 'wpmuadminresult', '' );
     391    ?>
    307392
    308393    <form action="<?php echo network_admin_url('users.php'); ?>" method="get">
     
    320405    </form>
    321406<?php
     407    /**
     408     * Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
     409     *
     410     * @since MU
     411     */
    322412    do_action( 'mu_rightnow_end' );
     413
     414    /**
     415     * Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
     416     *
     417     * @since MU
     418     */
    323419    do_action( 'mu_activity_box_end' );
    324420}
     
    362458
    363459        <div class="input-text-wrap" id="title-wrap">
    364             <label class="screen-reader-text prompt" for="title" id="title-prompt-text"><?php echo apply_filters( 'enter_title_here', __( 'Title' ), $post ); ?></label>
     460            <label class="screen-reader-text prompt" for="title" id="title-prompt-text">
     461
     462                <?php
     463                /** This filter is documented in wp-admin/edit-form-advanced.php */
     464                echo apply_filters( 'enter_title_here', __( 'Title' ), $post );
     465                ?>
     466            </label>
    365467            <input type="text" name="post_title" id="title" autocomplete="off" />
    366468        </div>
     
    471573            $actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>';
    472574
     575        /**
     576         * Filter the action links displayed for each comment in the 'Recent Comments'
     577         * dashboard widget.
     578         *
     579         * @since 2.6.0
     580         *
     581         * @param array  $actions An array of comment actions. Default actions include:
     582         *                        'Approve', 'Unapprove', 'Edit', 'Reply', 'Spam',
     583         *                        'Delete', and 'Trash'.
     584         * @param object $comment The comment object.
     585         */
    473586        $actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment );
    474587
     
    831944function wp_dashboard_primary() {
    832945    $feeds = array(
    833         'news'   => array(
    834             'link'         => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/news/' ) ),
    835             'url'          => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ),
     946        'news' => array(
     947
     948            /**
     949             * Filter the primary link URL for the 'WordPress News' dashboard widget.
     950             *
     951             * @since 2.5.0
     952             *
     953             * @param string $link The widget's primary link URL.
     954             */
     955            'link' => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/news/' ) ),
     956
     957            /**
     958             * Filter the primary feed URL for the 'WordPress News' dashboard widget.
     959             *
     960             * @since 2.3.0
     961             *
     962             * @param string $url The widget's primary feed URL.
     963             */
     964            'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ),
     965
     966            /**
     967             * Filter the primary link title for the 'WordPress News' dashboard widget.
     968             *
     969             * @since 2.3.0
     970             *
     971             * @param string $title Title attribute for the widget's primary link.
     972             */
    836973            'title'        => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ),
    837974            'items'        => 1,
     
    841978        ),
    842979        'planet' => array(
    843             'link'         => apply_filters( 'dashboard_secondary_link', __( 'http://planet.wordpress.org/' ) ),
    844             'url'          => apply_filters( 'dashboard_secondary_feed', __( 'http://planet.wordpress.org/feed/' ) ),
     980
     981            /**
     982             * Filter the secondary link URL for the 'WordPress News' dashboard widget.
     983             *
     984             * @since 2.3.0
     985             *
     986             * @param string $link The widget's secondary link URL.
     987             */
     988            'link' => apply_filters( 'dashboard_secondary_link', __( 'http://planet.wordpress.org/' ) ),
     989
     990            /**
     991             * Filter the secondary feed URL for the 'WordPress News' dashboard widget.
     992             *
     993             * @since 2.3.0
     994             *
     995             * @param string $url The widget's secondary feed URL.
     996             */
     997            'url' => apply_filters( 'dashboard_secondary_feed', __( 'http://planet.wordpress.org/feed/' ) ),
     998
     999            /**
     1000             * Filter the secondary link title for the 'WordPress News' dashboard widget.
     1001             *
     1002             * @since 2.3.0
     1003             *
     1004             * @param string $title Title attribute for the widget's secondary link.
     1005             */
    8451006            'title'        => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ),
    8461007            'items'        => 3,
     
    10581219    }
    10591220
     1221    /**
     1222    * Filter the notice output for the 'Browse Happy' nag meta box.
     1223    *
     1224    * @since 3.2.0
     1225    *
     1226    * @param string $notice   The notice content.
     1227    * @param array  $response An array containing web browser information.
     1228    */
    10601229    echo apply_filters( 'browse-happy-notice', $notice, $response );
    10611230}
Note: See TracChangeset for help on using the changeset viewer.