- Timestamp:
- 05/29/2015 02:40:52 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-posts-list-table.php
r32642 r32644 685 685 <?php 686 686 687 list( $columns, $hidden ) = $this->get_column_info();687 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 688 688 689 689 foreach ( $columns as $column_name => $column_display_name ) { 690 $class = "class=\"$column_name column-$column_name\""; 690 $classes = "$column_name column-$column_name"; 691 if ( $primary === $column_name ) { 692 $classes .= ' has-row-actions column-primary'; 693 } 691 694 692 695 $style = ''; 693 if ( in_array( $column_name, $hidden ) ) 696 if ( in_array( $column_name, $hidden ) ) { 694 697 $style = ' style="display:none;"'; 695 696 $attributes = "$class$style"; 698 } 699 700 $attributes = "class='$classes'$style"; 697 701 698 702 switch ( $column_name ) { … … 716 720 717 721 case 'title': 718 $attributes = 'class="post-title page-title column-title"' . $style; 722 $classes .= ' page-title'; // Special addition for title column 723 $attributes = "class='$classes'$style"; 719 724 if ( $this->hierarchical_display ) { 720 725 if ( 0 == $level && (int) $post->post_parent > 0 ) { … … 773 778 the_excerpt(); 774 779 775 $actions = array(); 776 if ( $can_edit_post && 'trash' != $post->post_status ) { 777 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '" title="' . esc_attr__( 'Edit this item' ) . '">' . __( 'Edit' ) . '</a>'; 778 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__( 'Edit this item inline' ) . '">' . __( 'Quick Edit' ) . '</a>'; 779 } 780 if ( current_user_can( 'delete_post', $post->ID ) ) { 781 if ( 'trash' == $post->post_status ) 782 $actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash' ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>"; 783 elseif ( EMPTY_TRASH_DAYS ) 784 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash' ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; 785 if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) 786 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; 787 } 788 if ( $post_type_object->public ) { 789 if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { 790 if ( $can_edit_post ) { 791 $preview_link = set_url_scheme( get_permalink( $post->ID ) ); 792 /** This filter is documented in wp-admin/includes/meta-boxes.php */ 793 $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ); 794 $actions['view'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>'; 795 } 796 } elseif ( 'trash' != $post->post_status ) { 797 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; 798 } 799 } 800 801 if ( is_post_type_hierarchical( $post->post_type ) ) { 802 803 /** 804 * Filter the array of row action links on the Pages list table. 805 * 806 * The filter is evaluated only for hierarchical post types. 807 * 808 * @since 2.8.0 809 * 810 * @param array $actions An array of row action links. Defaults are 811 * 'Edit', 'Quick Edit', 'Restore, 'Trash', 812 * 'Delete Permanently', 'Preview', and 'View'. 813 * @param WP_Post $post The post object. 814 */ 815 $actions = apply_filters( 'page_row_actions', $actions, $post ); 816 } else { 817 818 /** 819 * Filter the array of row action links on the Posts list table. 820 * 821 * The filter is evaluated only for non-hierarchical post types. 822 * 823 * @since 2.8.0 824 * 825 * @param array $actions An array of row action links. Defaults are 826 * 'Edit', 'Quick Edit', 'Restore, 'Trash', 827 * 'Delete Permanently', 'Preview', and 'View'. 828 * @param WP_Post $post The post object. 829 */ 830 $actions = apply_filters( 'post_row_actions', $actions, $post ); 831 } 832 833 echo $this->row_actions( $actions ); 780 echo $this->handle_row_actions( $post, $column_name, $primary ); 834 781 835 782 get_inline_data( $post ); … … 888 835 _e( 'Last Modified' ); 889 836 } 837 echo $this->handle_row_actions( $post, $column_name, $primary ); 890 838 echo '</td>'; 891 839 break; … … 899 847 $this->comments_bubble( $post->ID, $pending_comments ); 900 848 ?> 901 </div>< /td>849 </div><?php echo $this->handle_row_actions( $post, $column_name, $primary ); ?></td> 902 850 <?php 903 851 break; … … 910 858 get_the_author() 911 859 ); 860 echo $this->handle_row_actions( $post, $column_name, $primary ); 912 861 ?></td> 913 862 <?php … … 950 899 echo '—'; 951 900 } 901 echo $this->handle_row_actions( $post, $column_name, $primary ); 952 902 echo '</td>'; 953 903 break; … … 996 946 */ 997 947 do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID ); 948 echo $this->handle_row_actions( $post, $column_name, $primary ); 998 949 ?></td> 999 950 <?php … … 1005 956 <?php 1006 957 $GLOBALS['post'] = $global_post; 958 } 959 960 /** 961 * Get name of default primary column 962 * 963 * @since 4.3.0 964 * @access protected 965 * 966 * @return string 967 */ 968 protected function get_default_primary_column_name() { 969 return( 'title' ); 970 } 971 972 /** 973 * Generate and display row actions links 974 * 975 * @since 4.3.0 976 * @access protected 977 * 978 * @param object $post Post being acted upon 979 * @param string $column_name Current column name 980 * @param string $primary Primary column name 981 * 982 * @return string 983 */ 984 protected function handle_row_actions( $post, $column_name, $primary ) { 985 $title = _draft_or_post_title(); 986 987 if ( $primary === $column_name ) { 988 $post_type_object = get_post_type_object( $post->post_type ); 989 $can_edit_post = current_user_can( 'edit_post', $post->ID ); 990 $actions = array(); 991 992 if ( $can_edit_post && 'trash' != $post->post_status ) { 993 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '" title="' . esc_attr__( 'Edit this item' ) . '">' . __( 'Edit' ) . '</a>'; 994 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__( 'Edit this item inline' ) . '">' . __( 'Quick Edit' ) . '</a>'; 995 } 996 997 if ( current_user_can( 'delete_post', $post->ID ) ) { 998 if ( 'trash' == $post->post_status ) 999 $actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash' ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>"; 1000 elseif ( EMPTY_TRASH_DAYS ) 1001 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash' ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; 1002 if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) 1003 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; 1004 } 1005 1006 if ( $post_type_object->public ) { 1007 if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { 1008 if ( $can_edit_post ) { 1009 $preview_link = set_url_scheme( get_permalink( $post->ID ) ); 1010 /** This filter is documented in wp-admin/includes/meta-boxes.php */ 1011 $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ); 1012 $actions['view'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>'; 1013 } 1014 } elseif ( 'trash' != $post->post_status ) { 1015 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; 1016 } 1017 } 1018 1019 if ( is_post_type_hierarchical( $post->post_type ) ) { 1020 1021 /** 1022 * Filter the array of row action links on the Pages list table. 1023 * 1024 * The filter is evaluated only for hierarchical post types. 1025 * 1026 * @since 2.8.0 1027 * 1028 * @param array $actions An array of row action links. Defaults are 1029 * 'Edit', 'Quick Edit', 'Restore, 'Trash', 1030 * 'Delete Permanently', 'Preview', and 'View'. 1031 * @param WP_Post $post The post object. 1032 */ 1033 $actions = apply_filters( 'page_row_actions', $actions, $post ); 1034 } else { 1035 1036 /** 1037 * Filter the array of row action links on the Posts list table. 1038 * 1039 * The filter is evaluated only for non-hierarchical post types. 1040 * 1041 * @since 2.8.0 1042 * 1043 * @param array $actions An array of row action links. Defaults are 1044 * 'Edit', 'Quick Edit', 'Restore, 'Trash', 1045 * 'Delete Permanently', 'Preview', and 'View'. 1046 * @param WP_Post $post The post object. 1047 */ 1048 $actions = apply_filters( 'post_row_actions', $actions, $post ); 1049 } 1050 1051 return $this->row_actions( $actions ); 1052 } 1007 1053 } 1008 1054
Note: See TracChangeset
for help on using the changeset viewer.