function display_page_row($page, $level = 0)
 {
     global $post;
     $columns = array('dt', 'title', '/dt', 'dd', 'author', 'date', 'comments', '/dd');
     if ('trash' === $_GET['post_status'] && function_exists('wp_untrash_post')) {
         $columns = array_merge($columns, array('dd', 'actions', '/dd'));
     }
     $post = $page;
     setup_postdata($page);
     foreach ($columns as $column_name) {
         switch ($column_name) {
             case 'dt':
                 echo '<dt>';
                 break;
             case '/dt':
                 echo '</dt>';
                 break;
             case 'dd':
                 echo '<dd>';
                 break;
             case '/dd':
                 echo '</dd>';
                 break;
             case 'dd-small':
                 echo '<dd><small>';
                 break;
             case '/dd-small':
                 echo '</small></dd>';
                 break;
             case 'title':
                 $title = $this->admin->draft_or_post_title();
                 $pad = str_repeat('&#8212; ', $level);
                 if (current_user_can('edit_post', $page->ID) && $post->post_status != 'trash') {
                     $title = sprintf(__('<img localsrc="104" alt="" /><a href="%1$s">%2$s</a>', 'ktai_style'), get_edit_post_link($page->ID, 'url'), $title);
                 }
                 printf(_c('%1$5d:%2$s%3$s%4$s|page_row_title', 'ktai_style'), $post->ID, $pad, $title, $this->admin->get_post_states($page));
                 break;
             case 'date':
                 if ('draft' === $_GET['post_status'] || 'pending' === $_GET['post_status']) {
                     if ('0000-00-00 00:00:00' == $post->post_modified) {
                         $time = __('Never');
                     } else {
                         $time = ks_get_mod_time();
                     }
                 } else {
                     if ('0000-00-00 00:00:00' == $post->post_date) {
                         $time = __('Unpublished');
                     } else {
                         $time = ks_get_time();
                     }
                 }
                 printf(__('<img localsrc="46" alt=" at " />%s', 'ktai_style'), '<font color="' . ks_option('ks_date_color') . '">' . $time . '</font>');
                 break;
             case 'author':
                 printf(__('<img localsrc="68" alt="by " />%s', 'ktai_style'), get_the_author());
                 break;
             case 'comments':
                 $link = '<a href="edit-comments.php?p=' . $post->ID . '">';
                 echo ' <img localsrc="86" alt="[' . __('Comments') . '] " />';
                 if (function_exists('_x')) {
                     comments_number($comment_pending_count[$post->ID] ? $link . _x('0', 'comment count') . '</a>' : _x('0', 'comment count'), $link . _x('1', 'comment count') . '</a>', $link . _x('%', 'comment count') . '</a>');
                 } else {
                     comments_number($comment_pending_count[$post->ID] ? $link . __('0') . '</a>' : __('0'), $link . __('1') . '</a>', $link . __('%') . '</a>');
                 }
                 if ($comment_pending_count[$post->ID]) {
                     echo '<img localsrc="2" alt="[' . sprintf(__('%s pending'), number_format($comment_pending_count[$post->ID])) . ']" />';
                 }
                 break;
             case 'actions':
                 $delete_url = 'page.php?action=delete&post=' . $post->ID;
                 $untrash_url = 'page.php?action=untrash&post=' . $post->ID;
                 $untrash_url = wp_nonce_url($untrash_url, 'untrash-page_' . $post->ID);
                 $actions['restore'] = sprintf('<a href="%s"><font color="%s">%s</font></a>', $untrash_url, 'green', __('Restore'));
                 $actions['delete'] = sprintf('<a href="%s"><font color="%s">%s</font></a>', $delete_url, 'red', __('Delete'));
                 echo '[ ' . implode(' | ', $actions) . ' ]';
                 break;
         }
     }
 }
    public function post_rows()
    {
        global $wp_query, $post;
        $columns = array('dt', 'title', '/dt', 'dd', 'author', 'date', 'comments', '/dd', 'dd-small', 'categories', '/dd-small');
        $columns = array_merge($columns, array('dd-small', 'tags', '/dd-small'));
        if ('trash' === $_GET['post_status'] && function_exists('wp_untrash_post')) {
            $columns = array_merge($columns, array('dd', 'actions', '/dd'));
        }
        $post_ids = array();
        foreach ($wp_query->posts as $a_post) {
            $post_ids[] = $a_post->ID;
        }
        $comment_pending_count = get_pending_comments_num($post_ids);
        if (empty($comment_pending_count)) {
            $comment_pending_count = array();
        }
        ?>
<dl><?php 
        while (have_posts()) {
            the_post();
            foreach ($columns as $column_name) {
                switch ($column_name) {
                    case 'dt':
                        echo '<dt>';
                        break;
                    case '/dt':
                        echo '</dt>';
                        break;
                    case 'dd':
                        echo '<dd>';
                        break;
                    case '/dd':
                        echo '</dd>';
                        break;
                    case 'dd-small':
                        echo '<dd><small>';
                        break;
                    case '/dd-small':
                        echo '</small></dd>';
                        break;
                    case 'title':
                        $title = $this->admin->draft_or_post_title();
                        if (current_user_can('edit_post', $post->ID) && $post->post_status != 'trash') {
                            $title = sprintf(__('<img localsrc="104" alt="" /><a href="%1$s">%2$s</a>', 'ktai_style'), get_edit_post_link($post->ID, 'url'), $title);
                        }
                        printf(_c('%1$5d:%2$s%3$s|post_row_title', 'ktai_style'), $post->ID, $title, $this->admin->get_post_states($post));
                        break;
                    case 'date':
                        if ('draft' === $_GET['post_status'] || 'pending' === $_GET['post_status']) {
                            if ('0000-00-00 00:00:00' == $post->post_modified) {
                                $time = __('Never');
                            } else {
                                $time = ks_get_mod_time();
                            }
                        } else {
                            if ('0000-00-00 00:00:00' == $post->post_date) {
                                $time = __('Unpublished');
                            } else {
                                $time = ks_get_time();
                            }
                        }
                        printf(__('<img localsrc="46" alt=" at " />%s', 'ktai_style'), '<font color="' . ks_option('ks_date_color') . '">' . $time . '</font>');
                        break;
                    case 'author':
                        printf(__('<img localsrc="68" alt="by " />%s', 'ktai_style'), get_the_author());
                        break;
                    case 'categories':
                        $categories = get_the_category();
                        if (!empty($categories)) {
                            $cat_links = array();
                            foreach ($categories as $c) {
                                $cat_links[] = '<a href="' . basename(__FILE__) . '?cat=' . $c->cat_ID . '"><font color="gray">' . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . '</font></a>';
                            }
                            echo sprintf(__('<img localsrc="354" alt="%1$s" />%2$s', 'ktai_style'), __('Category:'), implode(', ', $cat_links));
                        }
                        break;
                    case 'tags':
                        $tags = get_the_tags($post->ID);
                        if (!empty($tags)) {
                            $tag_links = array();
                            foreach ($tags as $t) {
                                $tag_links[] = '<a href="' . basename(__FILE__) . '?tag=' . $t->slug . '"><font color="gray">' . wp_specialchars(sanitize_term_field('name', $t->name, $t->term_id, 'post_tag', 'display')) . '</font></a>';
                            }
                            echo sprintf(__('<img localsrc="77" alt="%1$s" />%2$s', 'ktai_style'), __('Tags:'), implode(', ', $tag_links));
                        }
                        break;
                    case 'comments':
                        $link = '<a href="edit-comments.php?p=' . $post->ID . '">';
                        echo ' <img localsrc="86" alt="[' . __('Comments') . '] " />';
                        if (function_exists('_x')) {
                            comments_number($comment_pending_count[$post->ID] ? $link . _x('0', 'comment count') . '</a>' : _x('0', 'comment count'), $link . _x('1', 'comment count') . '</a>', $link . _x('%', 'comment count') . '</a>');
                        } else {
                            comments_number($comment_pending_count[$post->ID] ? $link . __('0') . '</a>' : __('0'), $link . __('1') . '</a>', $link . __('%') . '</a>');
                        }
                        if ($comment_pending_count[$post->ID]) {
                            echo '<img localsrc="2" alt="[' . sprintf(__('%s pending'), number_format($comment_pending_count[$post->ID])) . ']" />';
                        }
                        break;
                    case 'actions':
                        $delete_url = 'post.php?action=delete&post=' . $post->ID;
                        $untrash_url = 'post.php?action=untrash&post=' . $post->ID;
                        $untrash_url = wp_nonce_url($untrash_url, 'untrash-post_' . $post->ID);
                        $actions['restore'] = sprintf('<a href="%s"><font color="%s">%s</font></a>', $untrash_url, 'green', __('Restore'));
                        $actions['delete'] = sprintf('<a href="%s"><font color="%s">%s</font></a>', $delete_url, 'red', __('Delete'));
                        echo '[ ' . implode(' | ', $actions) . ' ]';
                        break;
                }
            }
        }
        ?>
</dl><?php 
    }