Make WordPress Core

Changeset 27255


Ignore:
Timestamp:
02/25/2014 06:11:32 AM (13 years ago)
Author:
DrewAPicture
Message:

Inline documentation for hooks in wp-admin/includes/class-wp-posts-list-table.php.

Props nicolealleyinteractivecom, kpdesign.
Fixes #26397.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r27037 r27255  
    9090                $post_type = $this->screen->post_type;
    9191                $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );
     92
     93                /**
     94                 * Filter the number of posts displayed per page on the Posts list table.
     95                 *
     96                 * @since 2.8.0
     97                 *
     98                 * @param int    $per_page  Number of posts to be displayed. Default 20.
     99                 * @param string $post_type The post type.
     100                 */
    92101                $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
    93102
    … …  
    216225                                wp_dropdown_categories( $dropdown_options );
    217226                        }
     227
     228                        /**
     229                         * Fires before the Filter button on the Posts and Pages list tables.
     230                         *
     231                         * The Filter button allows sorting by date and/or category on the
     232                         * Posts list table, and sorting by date on the Pages list table.
     233                         *
     234                         * @since 2.1.0
     235                         */
    218236                        do_action( 'restrict_manage_posts' );
     237
    219238                        submit_button( __( 'Filter' ), 'button', false, false, array( 'id' => 'post-query-submit' ) );
    220239                }
    … …  
    266285                $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' );
    267286
     287                /**
     288                 * Filter the taxonomy columns in the Posts list table.
     289                 *
     290                 * The dynamic portion of the hook name, $post_type, refers to the post
     291                 * type slug.
     292                 *
     293                 * @since 3.5.0
     294                 *
     295                 * @param array  $taxonomies Array of taxonomies to show columns for.
     296                 * @param string $post_type  The post type.
     297                 */
    268298                $taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type );
    269299                $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' );
    … …  
    286316                $posts_columns['date'] = __( 'Date' );
    287317
    288                 if ( 'page' == $post_type )
     318                if ( 'page' == $post_type ) {
     319
     320                        /**
     321                         * Filter the columns displayed in the Pages list table.
     322                         *
     323                         * @since 2.5.0
     324                         *
     325                         * @param array $post_columns An array of column names.
     326                         */
    289327                        $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns );
    290                 else
     328                } else {
     329
     330                        /**
     331                         * Filter the columns displayed in the Posts list table.
     332                         *
     333                         * @since 1.5.0
     334                         *
     335                         * @param array  $posts_columns An array of column names.
     336                         * @param string $post_type     The post type slug.
     337                         */
    291338                        $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
     339                }
     340
     341                /**
     342                 * Filter the columns displayed in the Posts list table for a specific post type.
     343                 *
     344                 * The dynamic portion of the hook name, $post_type, refers to the post type slug.
     345                 *
     346                 * @since 3.0.0
     347                 *
     348                 * @param array $post_columns An array of column names.
     349                 */
    292350                $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
    293351
    … …  
    347405
    348406                /*
    349                  * arrange pages into two parts: top level pages and children_pages
     407                 * Arrange pages into two parts: top level pages and children_pages
    350408                 * children_pages is two dimensional array, eg.
    351409                 * children_pages[10][] contains all sub-pages whose parent is 10.
    … …  
    606664                                if ( $post_type_object->public ) {
    607665                                        if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
    608                                                 if ( $can_edit_post )
     666                                                if ( $can_edit_post ) {
     667
     668                                                        /** This filter is documented in wp-admin/includes/meta-boxes.php */
    609669                                                        $actions['view'] = '<a href="' . esc_url( apply_filters( 'preview_post_link', set_url_scheme( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
     670                                                }
    610671                                        } elseif ( 'trash' != $post->post_status ) {
    611672                                                $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
    … …  
    613674                                }
    614675
    615                                 $actions = apply_filters( is_post_type_hierarchical( $post->post_type ) ? 'page_row_actions' : 'post_row_actions', $actions, $post );
     676                                if ( is_post_type_hierarchical( $post->post_type ) ) {
     677
     678                                        /**
     679                                         * Filter the array of row action links on the Pages list table.
     680                                         *
     681                                         * The filter is evaluated only for hierarchical post types.
     682                                         *
     683                                         * @since 2.8.0
     684                                         *
     685                                         * @param array   $actions An array of row action links. Defaults are
     686                                         *                         'Edit', 'Quick Edit', 'Restore, 'Trash',
     687                                         *                         'Delete Permanently', 'Preview', and 'View'.
     688                                         * @param WP_Post $post    The post object.
     689                                         */
     690                                        $actions = apply_filters( 'page_row_actions', $actions, $post );
     691                                } else {
     692
     693                                        /**
     694                                         * Filter the array of row action links on the Posts list table.
     695                                         *
     696                                         * The filter is evaluated only for non-hierarchical post types.
     697                                         *
     698                                         * @since 2.8.0
     699                                         *
     700                                         * @param array   $actions An array of row action links. Defaults are
     701                                         *                         'Edit', 'Quick Edit', 'Restore, 'Trash',
     702                                         *                         'Delete Permanently', 'Preview', and 'View'.
     703                                         * @param WP_Post $post    The post object.
     704                                         */
     705                                        $actions = apply_filters( 'post_row_actions', $actions, $post );
     706                                }
     707
    616708                                echo $this->row_actions( $actions );
    617709
    … …  
    638730
    639731                                echo '<td ' . $attributes . '>';
    640                                 if ( 'excerpt' == $mode )
     732                                if ( 'excerpt' == $mode ) {
     733
     734                                        /**
     735                                         * Filter the published time of the post.
     736                                         *
     737                                         * If $mode equals 'excerpt', the published time and date are both displayed.
     738                                         * If $mode equals 'list' (default), the publish date is displayed, with the
     739                                         * time and date together available as an abbreviation definition.
     740                                         *
     741                                         * @since 2.5.1
     742                                         *
     743                                         * @param array   $t_time      The published time.
     744                                         * @param WP_Post $post        Post object.
     745                                         * @param string  $column_name The column name.
     746                                         * @param string  $mode        The list display mode ('excerpt' or 'list').
     747                                         */
    641748                                        echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode );
    642                                 else
     749                                } else {
     750
     751                                        /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
    643752                                        echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '</abbr>';
     753                                }
    644754                                echo '<br />';
    645755                                if ( 'publish' == $post->post_status ) {
    … …  
    720830                        ?>
    721831                        <td <?php echo $attributes ?>><?php
    722                                 if ( is_post_type_hierarchical( $post->post_type ) )
     832                                if ( is_post_type_hierarchical( $post->post_type ) ) {
     833
     834                                        /**
     835                                         * Fires in each custom column on the Posts list table.
     836                                         *
     837                                         * This hook only fires if the current post type is hierarchical,
     838                                         * such as pages.
     839                                         *
     840                                         * @since 2.5.0
     841                                         *
     842                                         * @param string $column_name The name of the column to display.
     843                                         * @param int    $post_id     The current post ID.
     844                                         */
    723845                                        do_action( 'manage_pages_custom_column', $column_name, $post->ID );
    724                                 else
     846                                } else {
     847
     848                                        /**
     849                                         * Fires in each custom column in the Posts list table.
     850                                         *
     851                                         * This hook only fires if the current post type is non-hierarchical,
     852                                         * such as posts.
     853                                         *
     854                                         * @since 1.5.0
     855                                         *
     856                                         * @param string $column_name The name of the column to display.
     857                                         * @param int    $post_id     The current post ID.
     858                                         */
    725859                                        do_action( 'manage_posts_custom_column', $column_name, $post->ID );
     860                                }
     861
     862                                /**
     863                                 * Fires for each custom column of a specific post type in the Posts list table.
     864                                 *
     865                                 * The dynamic portion of the hook name, $post->post_type, refers to the post type.
     866                                 *
     867                                 * @since 3.1.0
     868                                 *
     869                                 * @param string $column_name The name of the column to display.
     870                                 * @param int    $post_id     The current post ID.
     871                                 */
    726872                                do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
    727873                        ?></td>
    … …  
    9071053                if ( $bulk )
    9081054                        $dropdown_args['show_option_no_change'] =  __( '&mdash; No Change &mdash;' );
     1055
     1056                /**
     1057                 * Filter the arguments used to generate the Quick Edit page-parent drop-down.
     1058                 *
     1059                 * @since 2.7.0
     1060                 *
     1061                 * @see wp_dropdown_pages()
     1062                 *
     1063                 * @param array $dropdown_args An array of arguments.
     1064                 */
    9091065                $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args );
     1066
    9101067                wp_dropdown_pages( $dropdown_args );
    9111068        ?>
    … …  
    10801237                        if ( isset( $core_columns[$column_name] ) )
    10811238                                continue;
    1082                         do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type );
     1239
     1240                        if ( $bulk ) {
     1241
     1242                                /**
     1243                                 * Fires once for each column in Bulk Edit mode.
     1244                                 *
     1245                                 * @since 2.7.0
     1246                                 *
     1247                                 * @param string  $column_name Name of the column to edit.
     1248                                 * @param WP_Post $post_type   The post type slug.
     1249                                 */
     1250                                do_action( 'bulk_edit_custom_box', $column_name, $screen->post_type );
     1251                        } else {
     1252
     1253                                /**
     1254                                 * Fires once for each column in Quick Edit mode.
     1255                                 *
     1256                                 * @since 2.7.0
     1257                                 *
     1258                                 * @param string  $column_name Name of the column to edit.
     1259                                 * @param WP_Post $post_type   The post type slug.
     1260                                 */
     1261                                do_action( 'quick_edit_custom_box', $column_name, $screen->post_type );
     1262                        }
     1263
    10831264                }
    10841265        ?>
Note: See TracChangeset for help on using the changeset viewer.