Ticket #26397: 26397.3.diff
File 26397.3.diff, 8.8 KB (added by , 11 years ago) |
---|
-
src/wp-admin/includes/class-wp-posts-list-table.php
89 89 90 90 $post_type = $this->screen->post_type; 91 91 $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 );93 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 obj $post_type The post type. 100 */ 101 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); 102 94 103 if ( $this->hierarchical_display ) 95 104 $total_pages = ceil( $total_items / $per_page ); 96 105 else … … 215 224 ); 216 225 wp_dropdown_categories( $dropdown_options ); 217 226 } 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 */ 218 236 do_action( 'restrict_manage_posts' ); 219 237 submit_button( __( 'Filter' ), 'button', false, false, array( 'id' => 'post-query-submit' ) ); 220 238 } … … 265 283 $taxonomies = get_object_taxonomies( $post_type, 'objects' ); 266 284 $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' ); 267 285 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 */ 268 297 $taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type ); 269 298 $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); 270 299 … … 285 314 286 315 $posts_columns['date'] = __( 'Date' ); 287 316 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 */ 289 325 $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 */ 291 335 $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 */ 292 347 $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns ); 293 348 294 349 return $posts_columns; … … 605 660 } 606 661 if ( $post_type_object->public ) { 607 662 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 */ 609 665 $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 “%s”' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>'; 666 } 610 667 } elseif ( 'trash' != $post->post_status ) { 611 668 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; 612 669 } 613 670 } 614 671 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 616 698 echo $this->row_actions( $actions ); 617 699 618 700 get_inline_data( $post ); … … 637 719 } 638 720 639 721 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 */ 641 733 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 */ 643 736 echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '</abbr>'; 737 } 644 738 echo '<br />'; 645 739 if ( 'publish' == $post->post_status ) { 646 740 _e( 'Published' ); … … 719 813 } 720 814 ?> 721 815 <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 */ 723 825 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 */ 725 835 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 */ 726 849 do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID ); 727 850 ?></td> 728 851 <?php … … 906 1029 907 1030 if ( $bulk ) 908 1031 $dropdown_args['show_option_no_change'] = __( '— No Change —' ); 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 */ 909 1041 $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args ); 910 1042 wp_dropdown_pages( $dropdown_args ); 911 1043 ?> … … 1079 1211 foreach ( $columns as $column_name => $column_display_name ) { 1080 1212 if ( isset( $core_columns[$column_name] ) ) 1081 1213 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 1083 1237 } 1084 1238 ?> 1085 1239 <p class="submit inline-edit-save">