Make WordPress Core

Ticket #29881: 29881.diff

File 29881.diff, 20.6 KB (added by wonderboymusic, 10 years ago)
  • src/wp-admin/includes/class-wp-posts-list-table.php

     
    4747
    4848        private $is_trash;
    4949
     50        private $current_level = 0;
     51
    5052        /**
    5153         * Constructor.
    5254         *
     
    671673        }
    672674
    673675        /**
    674          * @global string  $mode
    675          * @global WP_Post $post
     676         * @since 4.3.0
    676677         *
    677          * @param int|WP_Post $post
    678          * @param int         $level
     678         * @param WP_Post $post
    679679         */
    680         public function single_row( $post, $level = 0 ) {
     680        public function column_cb( $post ) {
     681                $can_edit_post = current_user_can( 'edit_post', $post->ID );
     682                $title = _draft_or_post_title();
     683                ?>
     684                <th scope="row" class="check-column">
     685                <?php if ( $can_edit_post ) { ?>
     686                        <label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"><?php printf( __( 'Select %s' ), $title ); ?></label>
     687                        <input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
     688                        <div class="locked-indicator"></div>
     689                <?php } ?>
     690                </th>
     691                <?php
     692        }
     693
     694        /**
     695         * @since 4.3.0
     696         *
     697         * @global string $mode
     698         *
     699         * @param WP_Post $post
     700         */
     701        public function column_title( $post ) {
    681702                global $mode;
    682703
    683                 $global_post = get_post();
     704                if ( $this->hierarchical_display ) {
     705                        if ( 0 === $this->current_level && (int) $post->post_parent > 0 ) {
     706                                // Sent level 0 by accident, by default, or because we don't know the actual level.
     707                                $find_main_page = (int) $post->post_parent;
     708                                while ( $find_main_page > 0 ) {
     709                                        $parent = get_post( $find_main_page );
    684710
    685                 $post = get_post( $post );
     711                                        if ( is_null( $parent ) ) {
     712                                                break;
     713                                        }
    686714
    687                 $GLOBALS['post'] = $post;
    688                 setup_postdata( $post );
     715                                        $this->current_level++;
     716                                        $find_main_page = (int) $parent->post_parent;
    689717
    690                 $edit_link = get_edit_post_link( $post->ID );
    691                 $title = _draft_or_post_title();
    692                 $post_type_object = get_post_type_object( $post->post_type );
    693                 $can_edit_post = current_user_can( 'edit_post', $post->ID );
     718                                        if ( ! isset( $parent_name ) ) {
     719                                                /** This filter is documented in wp-includes/post-template.php */
     720                                                $parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID );
     721                                        }
     722                                }
     723                        }
     724                }
    694725
    695                 $classes = 'iedit author-' . ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
     726                $pad = str_repeat( '&#8212; ', $this->current_level );
     727                echo "<strong>";
    696728
    697                 $lock_holder = wp_check_post_lock( $post->ID );
    698                 if ( $lock_holder ) {
    699                         $classes .= ' wp-locked';
    700                         $lock_holder = get_userdata( $lock_holder );
     729                $format = get_post_format( $post->ID );
     730                if ( $format ) {
     731                        $label = get_post_format_string( $format );
     732
     733                        echo '<a href="' . esc_url( add_query_arg( array( 'post_format' => $format, 'post_type' => $post->post_type ), 'edit.php' ) ) . '" class="post-state-format post-format-icon post-format-' . $format . '" title="' . $label . '">' . $label . ":</a> ";
    701734                }
    702735
    703                 if ( $post->post_parent ) {
    704                     $count = count( get_post_ancestors( $post->ID ) );
    705                     $classes .= ' level-'. $count;
     736                $can_edit_post = current_user_can( 'edit_post', $post->ID );
     737                $title = _draft_or_post_title();
     738
     739                if ( $can_edit_post && $post->post_status != 'trash' ) {
     740                        $edit_link = get_edit_post_link( $post->ID );
     741                        echo '<a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ) . '">' . $pad . $title . '</a>';
    706742                } else {
    707                     $classes .= ' level-0';
     743                        echo $pad . $title;
    708744                }
    709         ?>
    710                 <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>">
    711         <?php
     745                _post_states( $post );
    712746
    713                 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
     747                if ( isset( $parent_name ) ) {
     748                        $post_type_object = get_post_type_object( $post->post_type );
     749                        echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name );
     750                }
     751                echo "</strong>\n";
    714752
    715                 foreach ( $columns as $column_name => $column_display_name ) {
    716                         $classes = "$column_name column-$column_name";
    717                         if ( $primary === $column_name ) {
    718                                 $classes .= ' has-row-actions column-primary';
    719                         }
     753                if ( $can_edit_post && $post->post_status != 'trash' ) {
     754                        $lock_holder = wp_check_post_lock( $post->ID );
    720755
    721                         if ( 'title' === $column_name ) {
    722                                 $classes .= ' page-title'; // Special addition for title column
     756                        if ( $lock_holder ) {
     757                                $lock_holder = get_userdata( $lock_holder );
     758                                $locked_avatar = get_avatar( $lock_holder->ID, 18 );
     759                                $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
     760                        } else {
     761                                $locked_avatar = $locked_text = '';
    723762                        }
    724763
    725                         if ( in_array( $column_name, $hidden ) ) {
    726                                 $classes .= ' hidden';
    727                         }
     764                        echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
     765                }
    728766
    729                         $attributes = "class='$classes'";
     767                if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) ) {
     768                        the_excerpt();
     769                }
    730770
    731                         if ( 'cb' === $column_name ) {
    732                                 ?>
    733                                 <th scope="row" class="check-column">
    734                                 <?php if ( $can_edit_post ) { ?>
    735                                         <label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"><?php printf( __( 'Select %s' ), $title ); ?></label>
    736                                         <input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
    737                                         <div class="locked-indicator"></div>
    738                                 <?php } ?>
    739                                 </th>
    740                                 <?php
    741                         } else {
    742                                 echo "<td $attributes>";
     771                get_inline_data( $post );
     772        }
    743773
    744                                 switch ( $column_name ) {
     774        /**
     775         * @since 4.3.0
     776         *
     777         * @global string $mode
     778         *
     779         * @param WP_Post $post
     780         */
     781        public function column_date( $post ) {
     782                global $mode;
    745783
    746                                 case 'title':
    747                                         if ( $this->hierarchical_display ) {
    748                                                 if ( 0 == $level && (int) $post->post_parent > 0 ) {
    749                                                         // Sent level 0 by accident, by default, or because we don't know the actual level.
    750                                                         $find_main_page = (int) $post->post_parent;
    751                                                         while ( $find_main_page > 0 ) {
    752                                                                 $parent = get_post( $find_main_page );
     784                if ( '0000-00-00 00:00:00' == $post->post_date ) {
     785                        $t_time = $h_time = __( 'Unpublished' );
     786                        $time_diff = 0;
     787                } else {
     788                        $t_time = get_the_time( __( 'Y/m/d g:i:s a' ) );
     789                        $m_time = $post->post_date;
     790                        $time = get_post_time( 'G', true, $post );
    753791
    754                                                                 if ( is_null( $parent ) )
    755                                                                         break;
     792                        $time_diff = time() - $time;
    756793
    757                                                                 $level++;
    758                                                                 $find_main_page = (int) $parent->post_parent;
     794                        if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) {
     795                                $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
     796                        } else {
     797                                $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
     798                        }
     799                }
    759800
    760                                                                 if ( !isset( $parent_name ) ) {
    761                                                                         /** This filter is documented in wp-includes/post-template.php */
    762                                                                         $parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID );
    763                                                                 }
    764                                                         }
    765                                                 }
    766                                         }
     801                if ( 'excerpt' == $mode ) {
     802                        /**
     803                         * Filter the published time of the post.
     804                         *
     805                         * If $mode equals 'excerpt', the published time and date are both displayed.
     806                         * If $mode equals 'list' (default), the publish date is displayed, with the
     807                         * time and date together available as an abbreviation definition.
     808                         *
     809                         * @since 2.5.1
     810                         *
     811                         * @param array   $t_time      The published time.
     812                         * @param WP_Post $post        Post object.
     813                         * @param string  $column_name The column name.
     814                         * @param string  $mode        The list display mode ('excerpt' or 'list').
     815                         */
     816                        echo apply_filters( 'post_date_column_time', $t_time, $post, 'date', $mode );
     817                } else {
    767818
    768                                         $pad = str_repeat( '&#8212; ', $level );
    769                                         echo "<strong>";
     819                        /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
     820                        echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, 'date', $mode ) . '</abbr>';
     821                }
     822                echo '<br />';
     823                if ( 'publish' == $post->post_status ) {
     824                        _e( 'Published' );
     825                } elseif ( 'future' == $post->post_status ) {
     826                        if ( $time_diff > 0 ) {
     827                                echo '<strong class="attention">' . __( 'Missed schedule' ) . '</strong>';
     828                        } else {
     829                                _e( 'Scheduled' );
     830                        }
     831                } else {
     832                        _e( 'Last Modified' );
     833                }
     834        }
    770835
    771                                         if ( $format = get_post_format( $post->ID ) ) {
    772                                                 $label = get_post_format_string( $format );
     836        /**
     837         * @since 4.3.0
     838         *
     839         * @param WP_Post $post
     840         */
     841        public function column_comments( $post ) {
     842                ?>
     843                <div class="post-com-count-wrapper">
     844                <?php
     845                        $pending_comments = isset( $this->comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0;
    773846
    774                                                 echo '<a href="' . esc_url( add_query_arg( array( 'post_format' => $format, 'post_type' => $post->post_type ), 'edit.php' ) ) . '" class="post-state-format post-format-icon post-format-' . $format . '" title="' . $label . '">' . $label . ":</a> ";
     847                        $this->comments_bubble( $post->ID, $pending_comments );
     848                ?>
     849                </div>
     850                <?php
     851        }
     852
     853        /**
     854         * @since 4.3.0
     855         *
     856         * @param WP_Post $post
     857         */
     858        public function column_author( $post ) {
     859                printf( '<a href="%s">%s</a>',
     860                        esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )),
     861                        get_the_author()
     862                );
     863        }
     864
     865        /**
     866         * @since 4.3.0
     867         *
     868         * @param WP_Post $post
     869         * @param string  $column_name
     870         */
     871        public function column_default( $post, $column_name ) {
     872                if ( 'categories' == $column_name ) {
     873                        $taxonomy = 'category';
     874                } elseif ( 'tags' == $column_name ) {
     875                        $taxonomy = 'post_tag';
     876                } elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) {
     877                        $taxonomy = substr( $column_name, 9 );
     878                } else {
     879                        $taxonomy = false;
     880                }
     881                if ( $taxonomy ) {
     882                        $taxonomy_object = get_taxonomy( $taxonomy );
     883                        $terms = get_the_terms( $post->ID, $taxonomy );
     884                        if ( is_array( $terms ) ) {
     885                                $out = array();
     886                                foreach ( $terms as $t ) {
     887                                        $posts_in_term_qv = array();
     888                                        if ( 'post' != $post->post_type ) {
     889                                                $posts_in_term_qv['post_type'] = $post->post_type;
    775890                                        }
    776 
    777                                         if ( $can_edit_post && $post->post_status != 'trash' ) {
    778                                                 echo '<a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ) . '">' . $pad . $title . '</a>';
     891                                        if ( $taxonomy_object->query_var ) {
     892                                                $posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug;
    779893                                        } else {
    780                                                 echo $pad . $title;
     894                                                $posts_in_term_qv['taxonomy'] = $taxonomy;
     895                                                $posts_in_term_qv['term'] = $t->slug;
    781896                                        }
    782                                         _post_states( $post );
    783897
    784                                         if ( isset( $parent_name ) )
    785                                                 echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name );
     898                                        $out[] = sprintf( '<a href="%s">%s</a>',
     899                                                esc_url( add_query_arg( $posts_in_term_qv, 'edit.php' ) ),
     900                                                esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) )
     901                                        );
     902                                }
     903                                /* translators: used between list items, there is a space after the comma */
     904                                echo join( __( ', ' ), $out );
     905                        } else {
     906                                echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . $taxonomy_object->labels->not_found . '</span>';
     907                        }
     908                        return;
     909                }
    786910
    787                                         echo "</strong>\n";
     911                if ( is_post_type_hierarchical( $post->post_type ) ) {
    788912
    789                                         if ( $can_edit_post && $post->post_status != 'trash' ) {
    790                                                 if ( $lock_holder ) {
    791                                                         $locked_avatar = get_avatar( $lock_holder->ID, 18 );
    792                                                         $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
    793                                                 } else {
    794                                                         $locked_avatar = $locked_text = '';
    795                                                 }
     913                        /**
     914                         * Fires in each custom column on the Posts list table.
     915                         *
     916                         * This hook only fires if the current post type is hierarchical,
     917                         * such as pages.
     918                         *
     919                         * @since 2.5.0
     920                         *
     921                         * @param string $column_name The name of the column to display.
     922                         * @param int    $post_id     The current post ID.
     923                         */
     924                        do_action( 'manage_pages_custom_column', $column_name, $post->ID );
     925                } else {
    796926
    797                                                 echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
    798                                         }
     927                        /**
     928                         * Fires in each custom column in the Posts list table.
     929                         *
     930                         * This hook only fires if the current post type is non-hierarchical,
     931                         * such as posts.
     932                         *
     933                         * @since 1.5.0
     934                         *
     935                         * @param string $column_name The name of the column to display.
     936                         * @param int    $post_id     The current post ID.
     937                         */
     938                        do_action( 'manage_posts_custom_column', $column_name, $post->ID );
     939                }
    799940
    800                                         if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) )
    801                                                         the_excerpt();
     941                /**
     942                 * Fires for each custom column of a specific post type in the Posts list table.
     943                 *
     944                 * The dynamic portion of the hook name, `$post->post_type`, refers to the post type.
     945                 *
     946                 * @since 3.1.0
     947                 *
     948                 * @param string $column_name The name of the column to display.
     949                 * @param int    $post_id     The current post ID.
     950                 */
     951                do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
     952        }
    802953
    803                                         get_inline_data( $post );
    804                                 break;
     954        /**
     955         * @since 4.3.0
     956         *
     957         * @param WP_Post $post
     958         */
     959        public function single_row_columns( $item ) {
     960                list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
    805961
    806                                 case 'date':
    807                                         if ( '0000-00-00 00:00:00' == $post->post_date ) {
    808                                                 $t_time = $h_time = __( 'Unpublished' );
    809                                                 $time_diff = 0;
    810                                         } else {
    811                                                 $t_time = get_the_time( __( 'Y/m/d g:i:s a' ) );
    812                                                 $m_time = $post->post_date;
    813                                                 $time = get_post_time( 'G', true, $post );
     962                foreach ( $columns as $column_name => $column_display_name ) {
     963                        $classes = "$column_name column-$column_name";
     964                        if ( $primary === $column_name ) {
     965                                $classes .= ' has-row-actions column-primary';
     966                        }
    814967
    815                                                 $time_diff = time() - $time;
     968                        if ( 'title' === $column_name ) {
     969                                $classes .= ' page-title'; // Special addition for title column
     970                        }
    816971
    817                                                 if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS )
    818                                                         $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
    819                                                 else
    820                                                         $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
    821                                         }
     972                        if ( in_array( $column_name, $hidden ) ) {
     973                                $classes .= ' hidden';
     974                        }
    822975
    823                                         if ( 'excerpt' == $mode ) {
     976                        $attributes = "class='$classes'";
    824977
    825                                                 /**
    826                                                  * Filter the published time of the post.
    827                                                  *
    828                                                  * If $mode equals 'excerpt', the published time and date are both displayed.
    829                                                  * If $mode equals 'list' (default), the publish date is displayed, with the
    830                                                  * time and date together available as an abbreviation definition.
    831                                                  *
    832                                                  * @since 2.5.1
    833                                                  *
    834                                                  * @param array   $t_time      The published time.
    835                                                  * @param WP_Post $post        Post object.
    836                                                  * @param string  $column_name The column name.
    837                                                  * @param string  $mode        The list display mode ('excerpt' or 'list').
    838                                                  */
    839                                                 echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode );
    840                                         } else {
     978                        if ( 'cb' === $column_name ) {
     979                                $this->column_cb( $item );
     980                        } else {
     981                                echo "<td $attributes>";
    841982
    842                                                 /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
    843                                                 echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '</abbr>';
    844                                         }
    845                                         echo '<br />';
    846                                         if ( 'publish' == $post->post_status ) {
    847                                                 _e( 'Published' );
    848                                         } elseif ( 'future' == $post->post_status ) {
    849                                                 if ( $time_diff > 0 )
    850                                                         echo '<strong class="attention">' . __( 'Missed schedule' ) . '</strong>';
    851                                                 else
    852                                                         _e( 'Scheduled' );
    853                                         } else {
    854                                                 _e( 'Last Modified' );
    855                                         }
    856                                 break;
     983                                if ( method_exists( $this, 'column_' . $column_name ) ) {
     984                                        call_user_func( array( $this, 'column_' . $column_name ), $item );
     985                                } else {
     986                                        $this->column_default( $item, $column_name );
     987                                }
    857988
    858                                 case 'comments':
    859                                 ?>
    860                                 <div class="post-com-count-wrapper">
    861                                 <?php
    862                                         $pending_comments = isset( $this->comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0;
     989                                echo $this->handle_row_actions( $item, $column_name, $primary );
     990                                echo '</td>';
     991                        }
     992                }
     993        }
    863994
    864                                         $this->comments_bubble( $post->ID, $pending_comments );
    865                                 ?>
    866                                 </div>
    867                                 <?php
    868                                 break;
     995        /**
     996         * @global WP_Post $post
     997         *
     998         * @param int|WP_Post $post
     999         * @param int         $level
     1000         */
     1001        public function single_row( $post, $level = 0 ) {
     1002                $global_post = get_post();
    8691003
    870                                 case 'author':
    871                                         printf( '<a href="%s">%s</a>',
    872                                                 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )),
    873                                                 get_the_author()
    874                                         );
    875                                 break;
     1004                $post = get_post( $post );
     1005                $this->current_level = $level;
    8761006
    877                                 default:
    878                                         if ( 'categories' == $column_name )
    879                                                 $taxonomy = 'category';
    880                                         elseif ( 'tags' == $column_name )
    881                                                 $taxonomy = 'post_tag';
    882                                         elseif ( 0 === strpos( $column_name, 'taxonomy-' ) )
    883                                                 $taxonomy = substr( $column_name, 9 );
    884                                         else
    885                                                 $taxonomy = false;
     1007                $GLOBALS['post'] = $post;
     1008                setup_postdata( $post );
    8861009
    887                                         if ( $taxonomy ) {
    888                                                 $taxonomy_object = get_taxonomy( $taxonomy );
    889                                                 $terms = get_the_terms( $post->ID, $taxonomy );
    890                                                 if ( is_array( $terms ) ) {
    891                                                         $out = array();
    892                                                         foreach ( $terms as $t ) {
    893                                                                 $posts_in_term_qv = array();
    894                                                                 if ( 'post' != $post->post_type )
    895                                                                         $posts_in_term_qv['post_type'] = $post->post_type;
    896                                                                 if ( $taxonomy_object->query_var ) {
    897                                                                         $posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug;
    898                                                                 } else {
    899                                                                         $posts_in_term_qv['taxonomy'] = $taxonomy;
    900                                                                         $posts_in_term_qv['term'] = $t->slug;
    901                                                                 }
     1010                $classes = 'iedit author-' . ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
    9021011
    903                                                                 $out[] = sprintf( '<a href="%s">%s</a>',
    904                                                                         esc_url( add_query_arg( $posts_in_term_qv, 'edit.php' ) ),
    905                                                                         esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) )
    906                                                                 );
    907                                                         }
    908                                                         /* translators: used between list items, there is a space after the comma */
    909                                                         echo join( __( ', ' ), $out );
    910                                                 } else {
    911                                                         echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . $taxonomy_object->labels->not_found . '</span>';
    912                                                 }
    913                                                 break;
    914                                         }
     1012                $lock_holder = wp_check_post_lock( $post->ID );
     1013                if ( $lock_holder ) {
     1014                        $classes .= ' wp-locked';
     1015                        $lock_holder = get_userdata( $lock_holder );
     1016                }
    9151017
    916                                         if ( is_post_type_hierarchical( $post->post_type ) ) {
    917 
    918                                                 /**
    919                                                  * Fires in each custom column on the Posts list table.
    920                                                  *
    921                                                  * This hook only fires if the current post type is hierarchical,
    922                                                  * such as pages.
    923                                                  *
    924                                                  * @since 2.5.0
    925                                                  *
    926                                                  * @param string $column_name The name of the column to display.
    927                                                  * @param int    $post_id     The current post ID.
    928                                                  */
    929                                                 do_action( 'manage_pages_custom_column', $column_name, $post->ID );
    930                                         } else {
    931 
    932                                                 /**
    933                                                  * Fires in each custom column in the Posts list table.
    934                                                  *
    935                                                  * This hook only fires if the current post type is non-hierarchical,
    936                                                  * such as posts.
    937                                                  *
    938                                                  * @since 1.5.0
    939                                                  *
    940                                                  * @param string $column_name The name of the column to display.
    941                                                  * @param int    $post_id     The current post ID.
    942                                                  */
    943                                                 do_action( 'manage_posts_custom_column', $column_name, $post->ID );
    944                                         }
    945 
    946                                         /**
    947                                          * Fires for each custom column of a specific post type in the Posts list table.
    948                                          *
    949                                          * The dynamic portion of the hook name, `$post->post_type`, refers to the post type.
    950                                          *
    951                                          * @since 3.1.0
    952                                          *
    953                                          * @param string $column_name The name of the column to display.
    954                                          * @param int    $post_id     The current post ID.
    955                                          */
    956                                         do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
    957                                 break;
    958                                 }
    959 
    960                                 echo $this->handle_row_actions( $post, $column_name, $primary );
    961                                 echo '</td>';
    962                         }
     1018                if ( $post->post_parent ) {
     1019                    $count = count( get_post_ancestors( $post->ID ) );
     1020                    $classes .= ' level-'. $count;
     1021                } else {
     1022                    $classes .= ' level-0';
    9631023                }
    9641024        ?>
     1025                <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>">
     1026                        <?php $this->single_row_columns( $post ); ?>
    9651027                </tr>
    9661028        <?php
    9671029                $GLOBALS['post'] = $global_post;