Make WordPress Core

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

File class-wp-posts-list-table.2.diff, 7.3 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 on post and media list tables.
     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                                 * The filter name is dependent on whether the current post type is
     663                                 * hierarchical (page_row_actions) or not (post_row_actions).
     664                                 *
     665                                 * @since 3.0.2
     666                                 *
     667                                 * @param array $actions The array of actions.
     668                                 * @param object $post The post object for the row.
     669                                 */
    615670                                $actions = apply_filters( is_post_type_hierarchical( $post->post_type ) ? 'page_row_actions' : 'post_row_actions', $actions, $post );
    616671                                echo $this->row_actions( $actions );
    617672
     
    637692                                }
    638693
    639694                                echo '<td ' . $attributes . '>';
    640                                 if ( 'excerpt' == $mode )
     695                                if ( 'excerpt' == $mode ) {
     696                                        /**
     697                                         * Filter the published time of the post.
     698                                         *
     699                                         * @since 3.0.2
     700                                         *
     701                                         * @param array $t_time                 The published time.
     702                                         * @param object $post                  The post object.
     703                                         * @param string $column_name   The column name.
     704                                         * @param string $mode                  The list display mode ( 'excerpt' or 'list' ).
     705                                         */
    641706                                        echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode );
    642                                 else
     707                                } else {
     708                                        /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
    643709                                        echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '</abbr>';
     710                                }
    644711                                echo '<br />';
    645712                                if ( 'publish' == $post->post_status ) {
    646713                                        _e( 'Published' );
     
    719786                                }
    720787                        ?>
    721788                        <td <?php echo $attributes ?>><?php
    722                                 if ( is_post_type_hierarchical( $post->post_type ) )
     789                                if ( is_post_type_hierarchical( $post->post_type ) ) {
     790                                        /**
     791                                         * Fires for each row in the list table.
     792                                         *
     793                                         * @since 3.0.2
     794                                         *
     795                                         * @param string $column_name   The name of the column to display.
     796                                         * @param int $post_id                  The ID of the current post.
     797                                         */
    723798                                        do_action( 'manage_pages_custom_column', $column_name, $post->ID );
    724                                 else
     799                                } else {
     800                                        /**
     801                                         * Fires for each row in the list table.
     802                                         *
     803                                         * @since 3.0.2
     804                                         *
     805                                         * @param string $column_name   The name of the column to display.
     806                                         * @param int $post_id                  The ID of the current post.
     807                                         */
    725808                                        do_action( 'manage_posts_custom_column', $column_name, $post->ID );
     809                                }
     810                                /**
     811                                 * Fires for each row in the list table.
     812                                 *
     813                                 * The dynamic portion of the hook name, $post->post_type, refers to post type.
     814                                 *
     815                                 * @since 3.0.2
     816                                 *
     817                                 * @param string $column_name   The name of the column to display.
     818                                 * @param int $post_id                  The ID of the current post.
     819                                 */
    726820                                do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
    727821                        ?></td>
    728822                        <?php
     
    9061000
    9071001                if ( $bulk )
    9081002                        $dropdown_args['show_option_no_change'] =  __( '&mdash; No Change &mdash;' );
     1003                /**
     1004                 * Filter the array of args in the quick edit dropdown.
     1005                 *
     1006                 * @since 3.0.2
     1007                 *
     1008                 * @see wp_dropdown_pages().
     1009                 *
     1010                 * @param array $dropdown_args The array of args.
     1011                 */
    9091012                $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args );
    9101013                wp_dropdown_pages( $dropdown_args );
    9111014        ?>
     
    10791182                foreach ( $columns as $column_name => $column_display_name ) {
    10801183                        if ( isset( $core_columns[$column_name] ) )
    10811184                                continue;
     1185                        /**x
     1186                         * Fires one time for each custom column.
     1187                         *
     1188                         * The action name is dependent on whether bulk editing (bulk_edit_custom_box)
     1189                         * or quick editing (quick_edit_custom_box) is being performed.
     1190                         *
     1191                         * @since 3.0.2
     1192                         *
     1193                         * @param string $column_name   The name of the column to edit.
     1194                         * @param object $post_type     The type of the posts.
     1195                         */
    10821196                        do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type );
    10831197                }
    10841198        ?>