Make WordPress Core

Ticket #26397: class-wp-posts-list-table.diff

File class-wp-posts-list-table.diff, 6.9 KB (added by nicole@…, 11 years ago)
  • 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                /** This filter is documented in wp-admin/includes/post.php */
    9293                $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
    9394
    9495                if ( $this->hierarchical_display )
     
    215216                                );
    216217                                wp_dropdown_categories( $dropdown_options );
    217218                        }
     219                        /**
     220                         * Fires before 'Filter' button in list table top navigation.
     221                         *
     222                         * @since 3.0.2
     223                         */
    218224                        do_action( 'restrict_manage_posts' );
    219225                        submit_button( __( 'Filter' ), 'button', false, false, array( 'id' => 'post-query-submit' ) );
    220226                }
     
    265271                $taxonomies = get_object_taxonomies( $post_type, 'objects' );
    266272                $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' );
    267273
     274                /**
     275                 * Filter the taxonomy columns on post and custom post type list tables
     276                 *
     277                 * The dynamic portion of the hook name, $post_type, refers to the post type slug.
     278                 *
     279                 * @since 3.5.0
     280                 *
     281                 * @param array $taxonomies The array of taxonomy names to show as a column
     282                 * @param string $post_type The post type.
     283                 */
    268284                $taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type );
    269285                $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' );
    270286
     
    285301
    286302                $posts_columns['date'] = __( 'Date' );
    287303
    288                 if ( 'page' == $post_type )
     304                if ( 'page' == $post_type ) {
     305                        /**
     306                         * Filter the columns on pages list table.
     307                         *
     308                         * @since 3.0.2
     309                         *
     310                         * @param array $post_columns The array of column names.
     311                         */
    289312                        $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns );
    290                 else
     313                } else {
     314                        /**
     315                         * Filter the columns on posts list table.
     316                         *
     317                         * @since 3.0.2
     318                         *
     319                         * @param array $posts_columns  The array of column names.
     320                         * @param string $post_type     The post type
     321                         */
    291322                        $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
     323                }
     324                /**
     325                 * Filter the columns on custom post types list table.
     326                 *
     327                 * The dynamic portion of the hook name, $post_type, refers to the post_type.
     328                 *
     329                 *  @since 3.0.2
     330                 *
     331                 * @param array $post_columns The array of column names.
     332                 * @param string $post_type The post type of the list table.
     333                 */
    292334                $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
    293335
    294336                return $posts_columns;
     
    605647                                }
    606648                                if ( $post_type_object->public ) {
    607649                                        if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
    608                                                 if ( $can_edit_post )
     650                                                if ( $can_edit_post ) {
     651                                                        /** This filter is documented in wp-admin/includes/meta-boxes.php */
    609652                                                        $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>';
     653                                                }
    610654                                        } elseif ( 'trash' != $post->post_status ) {
    611655                                                $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
    612656                                        }
    613657                                }
    614658
     659                                /**
     660                                 * Filter the array of post/page row actions.
     661                                 *
     662                                 * @since 3.0.2
     663                                 *
     664                                 * @param array $actions The array of actions.
     665                                 */
    615666                                $actions = apply_filters( is_post_type_hierarchical( $post->post_type ) ? 'page_row_actions' : 'post_row_actions', $actions, $post );
    616667                                echo $this->row_actions( $actions );
    617668
     
    637688                                }
    638689
    639690                                echo '<td ' . $attributes . '>';
    640                                 if ( 'excerpt' == $mode )
     691                                if ( 'excerpt' == $mode ) {
     692                                        /**
     693                                         * Filter the array of taxonomies to be added as a column .
     694                                         *
     695                                         * @since 3.0.2
     696                                         *
     697                                         * @param array $taxonomies     The array of taxonomy names.
     698                                         * @param object $post                  The post object.
     699                                         * @param string $column_name   The column name.
     700                                         * @param string $mode                  The list display mode ( 'excerpt' or 'list' ).
     701                                         */
    641702                                        echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode );
    642                                 else
     703                                } else {
     704                                        /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
    643705                                        echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '</abbr>';
     706                                }
    644707                                echo '<br />';
    645708                                if ( 'publish' == $post->post_status ) {
    646709                                        _e( 'Published' );
     
    719782                                }
    720783                        ?>
    721784                        <td <?php echo $attributes ?>><?php
    722                                 if ( is_post_type_hierarchical( $post->post_type ) )
     785                                if ( is_post_type_hierarchical( $post->post_type ) ) {
     786                                        /**
     787                                         * Fires for each row in the list table.
     788                                         *
     789                                         * @since 3.0.2
     790                                         *
     791                                         * @param string $column_name   The name of the column to display.
     792                                         * @param int $post->ID                 The ID of the current post.
     793                                         */
    723794                                        do_action( 'manage_pages_custom_column', $column_name, $post->ID );
    724                                 else
     795                                } else {
     796                                        /**
     797                                         * Fires for each row in the list table.
     798                                         *
     799                                         * @since 3.0.2
     800                                         *
     801                                         * @param string $column_name   The name of the column to display.
     802                                         * @param int $post->ID                 The ID of the current post.
     803                                         */
    725804                                        do_action( 'manage_posts_custom_column', $column_name, $post->ID );
     805                                }
     806                                /**
     807                                 * Fires for each row in the list table.
     808                                 *
     809                                 * The dynamic portion of the hook name, $post->post_type, refers to post type.
     810                                 *
     811                                 * @since 3.0.2
     812                                 *
     813                                 * @param string $column_name   The name of the column to display.
     814                                 * @param int $post->ID                 The ID of the current post.
     815                                 */
    726816                                do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
    727817                        ?></td>
    728818                        <?php
     
    906996
    907997                if ( $bulk )
    908998                        $dropdown_args['show_option_no_change'] =  __( '&mdash; No Change &mdash;' );
     999                /**
     1000                 * Filter the array of args in the quick edit dropdown.
     1001                 *
     1002                 * @since 3.0.2
     1003                 *
     1004                 * @param array $dropdown_args The array of args.
     1005                 */
    9091006                $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args );
    9101007                wp_dropdown_pages( $dropdown_args );
    9111008        ?>
     
    10791176                foreach ( $columns as $column_name => $column_display_name ) {
    10801177                        if ( isset( $core_columns[$column_name] ) )
    10811178                                continue;
     1179                        /**
     1180                         * Fires one time for each custom column.
     1181                         *
     1182                         * @since 3.0.2
     1183                         *
     1184                         * @param string $column_name           The name of the column to edit.
     1185                         * @param object $screen->post_type The type of the posts.
     1186                         */
    10821187                        do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type );
    10831188                }
    10841189        ?>