Make WordPress Core

Ticket #26397: 26397.3.diff

File 26397.3.diff, 8.8 KB (added by kpdesign, 11 years ago)

Third pass

  • src/wp-admin/includes/class-wp-posts-list-table.php

     
    8989
    9090                $post_type = $this->screen->post_type;
    9191                $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );
    92                 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
    9392
     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 obj $post_type The post type.
     100                 */
     101                $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
     102
    94103                if ( $this->hierarchical_display )
    95104                        $total_pages = ceil( $total_items / $per_page );
    96105                else
     
    215224                                );
    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' );
    219237                        submit_button( __( 'Filter' ), 'button', false, false, array( 'id' => 'post-query-submit' ) );
    220238                }
     
    265283                $taxonomies = get_object_taxonomies( $post_type, 'objects' );
    266284                $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' );
    267285
     286                /**
     287                 * Filter the taxonomy columns on the post and custom post type list tables.
     288                 *
     289                 * The dynamic portion of the hook name, $post_type, refers to the post
     290                 * type slug.
     291                 *
     292                 * @since 3.5.0
     293                 *
     294                 * @param array  $taxonomies The array of taxonomy names to show as a column.
     295                 * @param string $post_type  The post type.
     296                 */
    268297                $taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type );
    269298                $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' );
    270299
     
    285314
    286315                $posts_columns['date'] = __( 'Date' );
    287316
    288                 if ( 'page' == $post_type )
     317                if ( 'page' == $post_type ) {
     318                        /**
     319                         * Filter the displayed columns on the Pages list table.
     320                         *
     321                         * @since 2.5.0
     322                         *
     323                         * @param array $post_columns An array of column names.
     324                         */
    289325                        $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns );
    290                 else
     326                } else {
     327                        /**
     328                         * Filter the displayed columns on the Posts list table.
     329                         *
     330                         * @since 1.5.0
     331                         *
     332                         * @param array  $posts_columns An array of column names.
     333                         * @param string $post_type     The post type.
     334                         */
    291335                        $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
     336                }
     337
     338                /**
     339                 * Filter the displayed columns on the post types list table.
     340                 *
     341                 * The dynamic portion of the hook name, $post_type, refers to the post type.
     342                 *
     343                 * @since 3.0.0
     344                 *
     345                 * @param array  $post_columns An array of column names.
     346                 */
    292347                $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
    293348
    294349                return $posts_columns;
     
    605660                                }
    606661                                if ( $post_type_object->public ) {
    607662                                        if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
    608                                                 if ( $can_edit_post )
     663                                                if ( $can_edit_post ) {
     664                                                        /** This filter is documented in wp-admin/includes/meta-boxes.php */
    609665                                                        $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>';
     666                                                }
    610667                                        } elseif ( 'trash' != $post->post_status ) {
    611668                                                $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
    612669                                        }
    613670                                }
    614671
    615                                 $actions = apply_filters( is_post_type_hierarchical( $post->post_type ) ? 'page_row_actions' : 'post_row_actions', $actions, $post );
     672                                if ( is_post_type_hierarchical( $post->post_type ) ) {
     673                                        /**
     674                                         * Filter the array of row action links on the Pages list table.
     675                                         *
     676                                         * @since 2.8.0
     677                                         *
     678                                         * @param array $actions An array of row action links. Defaults are
     679                                         *                       'Edit', 'Quick Edit', 'Restore, 'Trash',
     680                                         *                       'Delete Permanently', 'Preview', and 'View'.
     681                                         * @param obj   $post    The post object.
     682                                         */
     683                                        $actions = apply_filters( 'page_row_actions', $actions, $post );
     684                                } else {
     685                                        /**
     686                                         * Filter the array of row action links on the Posts list table.
     687                                         *
     688                                         * @since 2.8.0
     689                                         *
     690                                         * @param array $actions An array of row action links. Defaults are
     691                                         *                       'Edit', 'Quick Edit', 'Restore, 'Trash',
     692                                         *                       'Delete Permanently', 'Preview', and 'View'.
     693                                         * @param obj   $post    The post object.
     694                                         */
     695                                        $actions = apply_filters( 'post_row_actions', $actions, $post );
     696                                }
     697
    616698                                echo $this->row_actions( $actions );
    617699
    618700                                get_inline_data( $post );
     
    637719                                }
    638720
    639721                                echo '<td ' . $attributes . '>';
    640                                 if ( 'excerpt' == $mode )
     722                                if ( 'excerpt' == $mode ) {
     723                                        /**
     724                                         * Filter the published time of the post.
     725                                         *
     726                                         * @since 2.6.0
     727                                         *
     728                                         * @param array  $t_time      The published time.
     729                                         * @param obj    $post        The post object.
     730                                         * @param string $column_name The column name.
     731                                         * @param string $mode        The list display mode ('excerpt' or 'list').
     732                                         */
    641733                                        echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode );
    642                                 else
     734                                } else {
     735                                        /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
    643736                                        echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '</abbr>';
     737                                }
    644738                                echo '<br />';
    645739                                if ( 'publish' == $post->post_status ) {
    646740                                        _e( 'Published' );
     
    719813                                }
    720814                        ?>
    721815                        <td <?php echo $attributes ?>><?php
    722                                 if ( is_post_type_hierarchical( $post->post_type ) )
     816                                if ( is_post_type_hierarchical( $post->post_type ) ) {
     817                                        /**
     818                                         * Fires for each row on the Pages list table.
     819                                         *
     820                                         * @since 2.5.0
     821                                         *
     822                                         * @param string $column_name The name of the column to display.
     823                                         * @param int    $post_id     The current post ID.
     824                                         */
    723825                                        do_action( 'manage_pages_custom_column', $column_name, $post->ID );
    724                                 else
     826                                } else {
     827                                        /**
     828                                         * Fires for each row on the Posts list table.
     829                                         *
     830                                         * @since 1.5.0
     831                                         *
     832                                         * @param string $column_name The name of the column to display.
     833                                         * @param int    $post_id     The current post ID.
     834                                         */
    725835                                        do_action( 'manage_posts_custom_column', $column_name, $post->ID );
     836                                }
     837
     838                                /**
     839                                 * Fires for each row on the custom post types list table.
     840                                 *
     841                                 * The dynamic portion of the hook name, $post->post_type,
     842                                 * refers to the post type.
     843                                 *
     844                                 * @since 3.1.0
     845                                 *
     846                                 * @param string $column_name The name of the column to display.
     847                                 * @param int    $post_id     The current post ID.
     848                                 */
    726849                                do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
    727850                        ?></td>
    728851                        <?php
     
    9061029
    9071030                if ( $bulk )
    9081031                        $dropdown_args['show_option_no_change'] =  __( '&mdash; No Change &mdash;' );
     1032                /**
     1033                 * Filter the array of args in the Quick Edit drop down.
     1034                 *
     1035                 * @since 2.7.0
     1036                 *
     1037                 * @see wp_dropdown_pages()
     1038                 *
     1039                 * @param array $dropdown_args An array of args.
     1040                 */
    9091041                $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args );
    9101042                wp_dropdown_pages( $dropdown_args );
    9111043        ?>
     
    10791211                foreach ( $columns as $column_name => $column_display_name ) {
    10801212                        if ( isset( $core_columns[$column_name] ) )
    10811213                                continue;
    1082                         do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type );
     1214
     1215                        if ( $bulk ) {
     1216                                /**
     1217                                 * Fires once for each custom column in Bulk Edit mode.
     1218                                 *
     1219                                 * @since 2.7.0
     1220                                 *
     1221                                 * @param string $column_name The name of the column to edit.
     1222                                 * @param obj    $post_type   The post type.
     1223                                 */
     1224                                do_action( 'bulk_edit_custom_box', $column_name, $screen->post_type );
     1225                        } else {
     1226                                /**
     1227                                 * Fires once for each custom column in Quick Edit mode.
     1228                                 *
     1229                                 * @since 2.7.0
     1230                                 *
     1231                                 * @param string $column_name The name of the column to edit.
     1232                                 * @param obj    $post_type   The post type.
     1233                                 */
     1234                                do_action( 'quick_edit_custom_box', $column_name, $screen->post_type );
     1235                        }
     1236
    10831237                }
    10841238        ?>
    10851239                <p class="submit inline-edit-save">