Ticket #26397: 26397.diff
File 26397.diff, 9.4 KB (added by , 10 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 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 */ 92 101 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); 93 102 94 103 if ( $this->hierarchical_display ) … … 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' ); 237 219 238 submit_button( __( 'Filter' ), 'button', false, false, array( 'id' => 'post-query-submit' ) ); 220 239 } 221 240 … … 265 284 $taxonomies = get_object_taxonomies( $post_type, 'objects' ); 266 285 $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' ); 267 286 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 */ 268 298 $taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type ); 269 299 $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); 270 300 … … 285 315 286 316 $posts_columns['date'] = __( 'Date' ); 287 317 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 */ 289 327 $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 */ 291 338 $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 */ 292 350 $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns ); 293 351 294 352 return $posts_columns; … … 346 404 } 347 405 348 406 /* 349 * arrange pages into two parts: top level pages and children_pages407 * Arrange pages into two parts: top level pages and children_pages 350 408 * children_pages is two dimensional array, eg. 351 409 * children_pages[10][] contains all sub-pages whose parent is 10. 352 410 * It only takes O( N ) to arrange this and it takes O( 1 ) for subsequent lookup operations … … 605 663 } 606 664 if ( $post_type_object->public ) { 607 665 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 */ 609 669 $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>'; 670 } 610 671 } elseif ( 'trash' != $post->post_status ) { 611 672 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; 612 673 } 613 674 } 614 675 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 616 708 echo $this->row_actions( $actions ); 617 709 618 710 get_inline_data( $post ); … … 637 729 } 638 730 639 731 echo '<td ' . $attributes . '>'; 640 if ( 'excerpt' == $mode ) 732 if ( 'excerpt' == $mode ) { 733 734 /** 735 * Filter the published time of the post. 736 * 737 * @since 2.5.1 738 * 739 * @param array $t_time The published time. 740 * @param WP_Post $post Post object. 741 * @param string $column_name The column name. 742 * @param string $mode The list display mode ('excerpt' or 'list'). 743 */ 641 744 echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode ); 642 else 745 } else { 746 747 /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */ 643 748 echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '</abbr>'; 749 } 644 750 echo '<br />'; 645 751 if ( 'publish' == $post->post_status ) { 646 752 _e( 'Published' ); … … 719 825 } 720 826 ?> 721 827 <td <?php echo $attributes ?>><?php 722 if ( is_post_type_hierarchical( $post->post_type ) ) 828 if ( is_post_type_hierarchical( $post->post_type ) ) { 829 830 /** 831 * Fires for each row on the Pages list table. 832 * 833 * Fires only for hierarchical post types. 834 * 835 * @since 2.5.0 836 * 837 * @param string $column_name The name of the column to display. 838 * @param int $post_id The current post ID. 839 */ 723 840 do_action( 'manage_pages_custom_column', $column_name, $post->ID ); 724 else 841 } else { 842 843 /** 844 * Fires for each row on the Posts list table. 845 * 846 * Fires only for non-hierarchical post types. 847 * 848 * @since 1.5.0 849 * 850 * @param string $column_name The name of the column to display. 851 * @param int $post_id The current post ID. 852 */ 725 853 do_action( 'manage_posts_custom_column', $column_name, $post->ID ); 854 } 855 856 /** 857 * Fires for each row on the custom post types list table. 858 * 859 * The dynamic portion of the hook name, $post->post_type, 860 * refers to the post type. 861 * 862 * @since 3.1.0 863 * 864 * @param string $column_name The name of the column to display. 865 * @param int $post_id The current post ID. 866 */ 726 867 do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID ); 727 868 ?></td> 728 869 <?php … … 906 1047 907 1048 if ( $bulk ) 908 1049 $dropdown_args['show_option_no_change'] = __( '— No Change —' ); 1050 1051 /** 1052 * Filter the arguments used to generate the Quick Edit page parent drop-down. 1053 * 1054 * @since 2.7.0 1055 * 1056 * @see wp_dropdown_pages() 1057 * 1058 * @param array $dropdown_args An array of arguments. 1059 */ 909 1060 $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args ); 1061 910 1062 wp_dropdown_pages( $dropdown_args ); 911 1063 ?> 912 1064 </label> … … 1079 1231 foreach ( $columns as $column_name => $column_display_name ) { 1080 1232 if ( isset( $core_columns[$column_name] ) ) 1081 1233 continue; 1082 do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type ); 1234 1235 if ( $bulk ) { 1236 1237 /** 1238 * Fires once for each custom column in Bulk Edit mode. 1239 * 1240 * @since 2.7.0 1241 * 1242 * @param string $column_name Name of the column to edit. 1243 * @param WP_Post $post_type The post type slug. 1244 */ 1245 do_action( 'bulk_edit_custom_box', $column_name, $screen->post_type ); 1246 } else { 1247 1248 /** 1249 * Fires once for each custom column in Quick Edit mode. 1250 * 1251 * @since 2.7.0 1252 * 1253 * @param string $column_name Name of the column to edit. 1254 * @param WP_Post $post_type The post type slug. 1255 */ 1256 do_action( 'quick_edit_custom_box', $column_name, $screen->post_type ); 1257 } 1258 1083 1259 } 1084 1260 ?> 1085 1261 <p class="submit inline-edit-save">