Make WordPress Core


Ignore:
Timestamp:
08/11/2010 09:54:51 PM (16 years ago)
Author:
scribu
Message:

Ajaxify list-type screens in the admin. See #14579

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/template.php

    r15489 r15491  
    99 */
    1010
    11 /**
    12  * {@internal Missing Short Description}}
    13  *
    14  * @since 2.7
    15  *
    16  * Outputs the HTML for the hidden table rows used in Categories, Link Categories and Tags quick edit.
    17  *
    18  * @param string $type "edit-tags", "categoried" or "edit-link-categories"
    19  * @param string $taxonomy The taxonomy of the row.
    20  * @return
    21  */
    22 function inline_edit_term_row($type, $taxonomy) {
    23 
    24         $tax = get_taxonomy($taxonomy);
    25         if ( ! current_user_can( $tax->cap->edit_terms ) )
    26                 return;
    27 
    28         $columns = get_column_headers($type);
    29         $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($type) ) );
    30         $col_count = count($columns) - count($hidden);
    31         ?>
    32 
    33 <form method="get" action=""><table style="display: none"><tbody id="inlineedit">
    34         <tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php echo $col_count; ?>">
    35 
    36                 <fieldset><div class="inline-edit-col">
    37                         <h4><?php _e( 'Quick Edit' ); ?></h4>
    38 
    39                         <label>
    40                                 <span class="title"><?php _e( 'Name' ); ?></span>
    41                                 <span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span>
    42                         </label>
    43 <?php if ( !is_multisite() ) { ?>
    44                         <label>
    45                                 <span class="title"><?php _e( 'Slug' ); ?></span>
    46                                 <span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span>
    47                         </label>
    48 <?php } ?>
    49 
    50                 </div></fieldset>
    51 
    52 <?php
    53 
    54         $core_columns = array( 'cb' => true, 'description' => true, 'name' => true, 'slug' => true, 'posts' => true );
    55 
    56         foreach ( $columns as $column_name => $column_display_name ) {
    57                 if ( isset( $core_columns[$column_name] ) )
    58                         continue;
    59                 do_action( 'quick_edit_custom_box', $column_name, $type, $taxonomy );
    60         }
    61 
    62 ?>
    63 
    64         <p class="inline-edit-save submit">
    65                 <a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="cancel button-secondary alignleft"><?php _e('Cancel'); ?></a>
    66                 <?php $update_text = $tax->labels->update_item; ?>
    67                 <a accesskey="s" href="#inline-edit" title="<?php echo esc_attr( $update_text ); ?>" class="save button-primary alignright"><?php echo $update_text; ?></a>
    68                 <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
    69                 <span class="error" style="display:none;"></span>
    70                 <?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
    71                 <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $tax->name ); ?>" />
    72                 <br class="clear" />
    73         </p>
    74         </td></tr>
    75         </tbody></table></form>
    76 <?php
    77 }
    78 
    79 /**
    80  * {@internal Missing Short Description}}
    81  *
    82  * @since unknown
    83  *
    84  * @param unknown_type $category
    85  * @param unknown_type $name_override
    86  * @return unknown
    87  */
    88 function link_cat_row( $category, $name_override = false ) {
    89         static $row_class = '';
    90 
    91         if ( !$category = get_term( $category, 'link_category', OBJECT, 'display' ) )
    92                 return false;
    93         if ( is_wp_error( $category ) )
    94                 return $category;
    95 
    96         $default_cat_id = (int) get_option( 'default_link_category' );
    97         $name = ( $name_override ? $name_override : $category->name );
    98         $edit_link = "link-category.php?action=edit&amp;cat_ID=$category->term_id";
    99         if ( current_user_can( 'manage_categories' ) ) {
    100                 $edit = "<a class='row-title' href='$edit_link' title='" . esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $category->name)) . "'>$name</a><br />";
    101                 $actions = array();
    102                 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
    103                 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
    104                 if ( $default_cat_id != $category->term_id )
    105                         $actions['delete'] = "<a class='delete:the-list:link-cat-$category->term_id submitdelete' href='" . wp_nonce_url("link-category.php?action=delete&amp;cat_ID=$category->term_id", 'delete-link-category_' . $category->term_id) . "'>" . __('Delete') . '</a>';
    106                 $actions = apply_filters('link_cat_row_actions', $actions, $category);
    107                 $action_count = count($actions);
    108                 $i = 0;
    109                 $edit .= '<div class="row-actions">';
    110                 foreach ( $actions as $action => $link ) {
    111                         ++$i;
    112                         ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
    113                         $edit .= "<span class='$action'>$link$sep</span>";
    114                 }
    115                 $edit .= '</div>';
    116         } else {
    117                 $edit = $name;
    118         }
    119 
    120         $row_class = 'alternate' == $row_class ? '' : 'alternate';
    121         $qe_data = get_term_to_edit($category->term_id, 'link_category');
    122 
    123         $category->count = number_format_i18n( $category->count );
    124         $count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;
    125         $output = "<tr id='link-cat-$category->term_id' class='iedit $row_class'>";
    126         $columns = get_column_headers('edit-link-categories');
    127         $hidden = get_hidden_columns('edit-link-categories');
    128         foreach ( $columns as $column_name => $column_display_name ) {
    129                 $class = "class=\"$column_name column-$column_name\"";
    130 
    131                 $style = '';
    132                 if ( in_array($column_name, $hidden) )
    133                         $style = ' style="display:none;"';
    134 
    135                 $attributes = "$class$style";
    136 
    137                 switch ($column_name) {
    138                         case 'cb':
    139                                 $output .= "<th scope='row' class='check-column'>";
    140                                 if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) {
    141                                         $output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
    142                                 } else {
    143                                         $output .= "&nbsp;";
    144                                 }
    145                                 $output .= "</th>";
    146                                 break;
    147                         case 'name':
    148                                 $output .= "<td $attributes>$edit";
    149                                 $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
    150                                 $output .= '<div class="name">' . $qe_data->name . '</div>';
    151                                 $output .= '<div class="slug">' . apply_filters('editable_slug', $qe_data->slug) . '</div>';
    152                                 $output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>';
    153                                 break;
    154                         case 'description':
    155                                 $output .= "<td $attributes>$category->description</td>";
    156                                 break;
    157                         case 'slug':
    158                                 $output .= "<td $attributes>" . apply_filters('editable_slug', $category->slug) . '</td>';
    159                                 break;
    160                         case 'links':
    161                                 $attributes = 'class="links column-links num"' . $style;
    162                                 $output .= "<td $attributes>$count</td>";
    163                                 break;
    164                         default:
    165                                 $output .= "<td $attributes>";
    166                                 $output .= apply_filters('manage_link_categories_custom_column', '', $column_name, $category->term_id);
    167                                 $output .= "</td>";
    168                 }
    169         }
    170         $output .= '</tr>';
    171 
    172         return $output;
    173 }
    17411
    17512//
     
    23471                        'walker' => $walker,
    23572                        'checked_ontop' => $checked_ontop
    236         ));
     73  ));
    23774}
    23875
     
    289126                $keys = array_keys( $categories );
    290127
    291                 foreach ( $keys as $k ) {
     128                foreach( $keys as $k ) {
    292129                        if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) {
    293130                                $checked_categories[] = $categories[$k];
     
    341178                <li id="<?php echo $id; ?>" class="popular-category">
    342179                        <label class="selectit">
    343                         <input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" <?php echo $disabled; ?>/>
     180                        <input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" <?php echo $disabled ?>/>
    344181                                <?php echo esc_html( apply_filters( 'the_category', $term->name ) ); ?>
    345182                        </label>
     
    381218                echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', $checked, '/> ', $name, "</label></li>";
    382219        }
    383 }
    384 
    385 // Tag stuff
    386 
    387 // Returns a single tag row (see tag_rows below)
    388 // Note: this is also used in admin-ajax.php!
    389 /**
    390  * {@internal Missing Short Description}}
    391  *
    392  * @since unknown
    393  *
    394  * @param unknown_type $tag
    395  * @param unknown_type $class
    396  * @return unknown
    397  */
    398 function _tag_row( $tag, $level, $taxonomy = 'post_tag' ) {
    399                 global $post_type, $current_screen;
    400                 static $row_class = '';
    401                 $row_class = ($row_class == '' ? ' class="alternate"' : '');
    402 
    403                 $count = number_format_i18n( $tag->count );
    404                 $tax = get_taxonomy($taxonomy);
    405 
    406                 if ( 'post_tag' == $taxonomy ) {
    407                         $tagsel = 'tag';
    408                 } elseif ( 'category' == $taxonomy ) {
    409                         $tagsel = 'category_name';
    410                 } elseif ( ! empty($tax->query_var) ) {
    411                         $tagsel = $tax->query_var;
    412                 } else {
    413                         $tagsel = $taxonomy;
    414                 }
    415 
    416                 $pad = str_repeat( '&#8212; ', max(0, $level) );
    417                 $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag );
    418                 $qe_data = get_term($tag->term_id, $taxonomy, object, 'edit');
    419                 $edit_link = "edit-tags.php?action=edit&amp;taxonomy=$taxonomy&amp;post_type=$post_type&amp;tag_ID=$tag->term_id";
    420 
    421                 $out = '';
    422                 $out .= '<tr id="tag-' . $tag->term_id . '"' . $row_class . '>';
    423 
    424 
    425                 $columns = get_column_headers($current_screen);
    426                 $hidden = get_hidden_columns($current_screen);
    427                 $default_term = get_option('default_' . $taxonomy);
    428                 foreach ( $columns as $column_name => $column_display_name ) {
    429                         $class = "class=\"$column_name column-$column_name\"";
    430 
    431                         $style = '';
    432                         if ( in_array($column_name, $hidden) )
    433                                 $style = ' style="display:none;"';
    434 
    435                         $attributes = "$class$style";
    436 
    437                         switch ($column_name) {
    438                                 case 'cb':
    439                                         if ( current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term )
    440                                                 $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';
    441                                         else
    442                                                 $out .= '<th scope="row" class="check-column">&nbsp;</th>';
    443                                         break;
    444                                 case 'name':
    445                                         $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $name)) . '">' . $name . '</a></strong><br />';
    446                                         $actions = array();
    447                                         if ( current_user_can($tax->cap->edit_terms) ) {
    448                                                 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
    449                                                 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
    450                                         }
    451                                         if ( current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term )
    452                                                 $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "'>" . __('Delete') . '</a>';
    453 
    454                                         $actions = apply_filters('tag_row_actions', $actions, $tag);
    455                                         $actions = apply_filters("${taxonomy}_row_actions", $actions, $tag);
    456 
    457                                         $action_count = count($actions);
    458                                         $i = 0;
    459                                         $out .= '<div class="row-actions">';
    460                                         foreach ( $actions as $action => $link ) {
    461                                                 ++$i;
    462                                                 ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
    463                                                 $out .= "<span class='$action'>$link$sep</span>";
    464                                         }
    465                                         $out .= '</div>';
    466                                         $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
    467                                         $out .= '<div class="name">' . $qe_data->name . '</div>';
    468                                         $out .= '<div class="slug">' . apply_filters('editable_slug', $qe_data->slug) . '</div>';
    469                                         $out .= '<div class="parent">' . $qe_data->parent . '</div></div></td>';
    470                                         break;
    471                                 case 'description':
    472                                         $out .= "<td $attributes>$tag->description</td>";
    473                                         break;
    474                                 case 'slug':
    475                                         $out .= "<td $attributes>" . apply_filters('editable_slug', $tag->slug) . '</td>';
    476                                         break;
    477                                 case 'posts':
    478                                         $attributes = 'class="posts column-posts num"' . $style;
    479                                         $out .= "<td $attributes><a href='edit.php?$tagsel=$tag->slug&amp;post_type=$post_type'>$count</a></td>";
    480                                         break;
    481                                 default:
    482                                         $out .= "<td $attributes>";
    483                                         $out .= apply_filters("manage_${taxonomy}_custom_column", '', $column_name, $tag->term_id);
    484                                         $out .= "</td>";
    485                         }
    486                 }
    487 
    488                 $out .= "</tr>\n";
    489 
    490                 return $out;
    491 }
    492 
    493 // Outputs appropriate rows for the Nth page of the Tag Management screen,
    494 // assuming M tags displayed at a time on the page
    495 // Returns the number of tags displayed
    496 /**
    497  * {@internal Missing Short Description}}
    498  *
    499  * @since unknown
    500  *
    501  * @param unknown_type $page
    502  * @param unknown_type $pagesize
    503  * @param unknown_type $searchterms
    504  * @return unknown
    505  */
    506 function tag_rows( $page = 1, $pagesize = 20, $searchterms = '', $taxonomy = 'post_tag' ) {
    507 
    508         // Get a page worth of tags
    509         $start = ($page - 1) * $pagesize;
    510 
    511         $args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0);
    512 
    513         if ( !empty( $searchterms ) )
    514                 $args['search'] = $searchterms;
    515 
    516         // convert it to table rows
    517         $out = '';
    518         $count = 0;
    519         if ( is_taxonomy_hierarchical($taxonomy) ) {
    520                 // We'll need the full set of terms then.
    521                 $args['number'] = $args['offset'] = 0;
    522 
    523                 $terms = get_terms( $taxonomy, $args );
    524                 if ( !empty( $searchterms ) ) // Ignore children on searches.
    525                         $children = array();
    526                 else
    527                         $children = _get_term_hierarchy($taxonomy);
    528 
    529                 // Some funky recursion to get the job done(Paging & parents mainly) is contained within, Skip it for non-hierarchical taxonomies for performance sake
    530                 $out .= _term_rows($taxonomy, $terms, $children, $page, $pagesize, $count);
    531         } else {
    532                 $terms = get_terms( $taxonomy, $args );
    533                 foreach ( $terms as $term )
    534                         $out .= _tag_row( $term, 0, $taxonomy );
    535                 $count = $pagesize; // Only displaying a single page.
    536         }
    537 
    538         echo $out;
    539         return $count;
    540 }
    541 
    542 function _term_rows( $taxonomy, $terms, &$children, $page = 1, $per_page = 20, &$count, $parent = 0, $level = 0 ) {
    543 
    544         $start = ($page - 1) * $per_page;
    545         $end = $start + $per_page;
    546 
    547         $output = '';
    548         foreach ( $terms as $key => $term ) {
    549 
    550                 if ( $count >= $end )
    551                         break;
    552 
    553                 if ( $term->parent != $parent && empty($_GET['s']) )
    554                         continue;
    555 
    556                 // If the page starts in a subtree, print the parents.
    557                 if ( $count == $start && $term->parent > 0 && empty($_GET['s']) ) {
    558                         $my_parents = $parent_ids = array();
    559                         $p = $term->parent;
    560                         while ( $p ) {
    561                                 $my_parent = get_term( $p, $taxonomy );
    562                                 $my_parents[] = $my_parent;
    563                                 $p = $my_parent->parent;
    564                                 if ( in_array($p, $parent_ids) ) // Prevent parent loops.
    565                                         break;
    566                                 $parent_ids[] = $p;
    567                         }
    568                         unset($parent_ids);
    569 
    570                         $num_parents = count($my_parents);
    571                         while ( $my_parent = array_pop($my_parents) ) {
    572                                 $output .= "\t" . _tag_row( $my_parent, $level - $num_parents, $taxonomy );
    573                                 $num_parents--;
    574                         }
    575                 }
    576 
    577                 if ( $count >= $start )
    578                         $output .= "\t" . _tag_row( $term, $level, $taxonomy );
    579 
    580                 ++$count;
    581 
    582                 unset($terms[$key]);
    583 
    584                 if ( isset($children[$term->term_id]) && empty($_GET['s']) )
    585                         $output .= _term_rows( $taxonomy, $terms, $children, $page, $per_page, $count, $term->term_id, $level + 1 );
    586         }
    587 
    588         return $output;
    589 }
    590 
    591 // define the columns to display, the syntax is 'internal name' => 'display name'
    592 /**
    593  * {@internal Missing Short Description}}
    594  *
    595  * @since unknown
    596  *
    597  * @return unknown
    598  */
    599 function wp_manage_posts_columns( $screen = '') {
    600         if ( empty($screen) )
    601                 $post_type = 'post';
    602         else
    603                 $post_type = $screen->post_type;
    604 
    605         $posts_columns = array();
    606         $posts_columns['cb'] = '<input type="checkbox" />';
    607         /* translators: manage posts column name */
    608         $posts_columns['title'] = _x('Title', 'column name');
    609         $posts_columns['author'] = __('Author');
    610         if ( empty($post_type) || is_object_in_taxonomy($post_type, 'category') )
    611                 $posts_columns['categories'] = __('Categories');
    612         if ( empty($post_type) || is_object_in_taxonomy($post_type, 'post_tag') )
    613                 $posts_columns['tags'] = __('Tags');
    614         $post_status = !empty($_REQUEST['post_status']) ? $_REQUEST['post_status'] : 'all';
    615         if ( !in_array( $post_status, array('pending', 'draft', 'future') ) && ( empty($post_type) || post_type_supports($post_type, 'comments') ) )
    616                 $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="' . esc_url( admin_url( 'images/comment-grey-bubble.png' ) ) . '" /></div>';
    617         $posts_columns['date'] = __('Date');
    618 
    619         if ( 'page' == $post_type )
    620                 $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns );
    621         else
    622                 $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
    623         $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
    624 
    625         return $posts_columns;
    626 }
    627 
    628 // define the columns to display, the syntax is 'internal name' => 'display name'
    629 /**
    630  * {@internal Missing Short Description}}
    631  *
    632  * @since unknown
    633  *
    634  * @return unknown
    635  */
    636 function wp_manage_media_columns() {
    637         $posts_columns = array();
    638         $posts_columns['cb'] = '<input type="checkbox" />';
    639         $posts_columns['icon'] = '';
    640         /* translators: column name */
    641         $posts_columns['media'] = _x('File', 'column name');
    642         $posts_columns['author'] = __('Author');
    643         //$posts_columns['tags'] = _x('Tags', 'column name');
    644         /* translators: column name */
    645         $posts_columns['parent'] = _x('Attached to', 'column name');
    646         $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="' . esc_url( admin_url( 'images/comment-grey-bubble.png' ) ) . '" /></div>';
    647         //$posts_columns['comments'] = __('Comments');
    648         /* translators: column name */
    649         $posts_columns['date'] = _x('Date', 'column name');
    650         $posts_columns = apply_filters('manage_media_columns', $posts_columns);
    651 
    652         return $posts_columns;
    653 }
    654 
    655 /**
    656  * {@internal Missing Short Description}}
    657  *
    658  * @since unknown
    659  *
    660  * @return unknown
    661  */
    662 function wp_manage_pages_columns() {
    663         return wp_manage_posts_columns();
    664 }
    665 
    666 /**
    667  * Get the column headers for a screen
    668  *
    669  * @since unknown
    670  *
    671  * @param string|object $screen The screen you want the headers for
    672  * @return array Containing the headers in the format id => UI String
    673  */
    674 function get_column_headers($screen) {
    675         global $_wp_column_headers;
    676 
    677         if ( !isset($_wp_column_headers) )
    678                 $_wp_column_headers = array();
    679 
    680         if ( is_string($screen) )
    681                 $screen = convert_to_screen($screen);
    682 
    683         // Store in static to avoid running filters on each call
    684         if ( isset($_wp_column_headers[$screen->id]) )
    685                 return $_wp_column_headers[$screen->id];
    686 
    687         switch ($screen->base) {
    688                 case 'edit':
    689                          $_wp_column_headers[$screen->id] = wp_manage_posts_columns( $screen );
    690                          break;
    691                 case 'edit-comments':
    692                         $_wp_column_headers[$screen->id] = array(
    693                                 'cb' => '<input type="checkbox" />',
    694                                 'author' => __('Author'),
    695                                 /* translators: column name */
    696                                 'comment' => _x('Comment', 'column name'),
    697                                 //'date' => __('Submitted'),
    698                                 'response' => __('In Response To')
    699                         );
    700 
    701                         break;
    702                 case 'link-manager':
    703                         $_wp_column_headers[$screen->id] = array(
    704                                 'cb' => '<input type="checkbox" />',
    705                                 'name' => __('Name'),
    706                                 'url' => __('URL'),
    707                                 'categories' => __('Categories'),
    708                                 'rel' => __('Relationship'),
    709                                 'visible' => __('Visible'),
    710                                 'rating' => __('Rating')
    711                         );
    712 
    713                         break;
    714                 case 'upload':
    715                         $_wp_column_headers[$screen->id] = wp_manage_media_columns();
    716                         break;
    717                 case 'categories':
    718                         $_wp_column_headers[$screen->id] = array(
    719                                 'cb' => '<input type="checkbox" />',
    720                                 'name' => __('Name'),
    721                                 'description' => __('Description'),
    722                                 'slug' => __('Slug'),
    723                                 'posts' => __('Posts')
    724                         );
    725 
    726                         break;
    727                 case 'edit-link-categories':
    728                         $_wp_column_headers[$screen->id] = array(
    729                                 'cb' => '<input type="checkbox" />',
    730                                 'name' => __('Name'),
    731                                 'description' => __('Description'),
    732                                 'slug' => __('Slug'),
    733                                 'links' => __('Links')
    734                         );
    735 
    736                         break;
    737                 case 'edit-tags':
    738                         $_wp_column_headers[$screen->id] = array(
    739                                 'cb' => '<input type="checkbox" />',
    740                                 'name' => __('Name'),
    741                                 'description' => __('Description'),
    742                                 'slug' => __('Slug'),
    743                                 'posts' => __('Posts')
    744                         );
    745 
    746                         break;
    747                 case 'users':
    748                         $_wp_column_headers[$screen->id] = array(
    749                                 'cb' => '<input type="checkbox" />',
    750                                 'username' => __('Username'),
    751                                 'name' => __('Name'),
    752                                 'email' => __('E-mail'),
    753                                 'role' => __('Role'),
    754                                 'posts' => __('Posts')
    755                         );
    756                         break;
    757                 default :
    758                         $_wp_column_headers[$screen->id] = array();
    759         }
    760 
    761         $_wp_column_headers[$screen->id] = apply_filters('manage_' . $screen->id . '_columns', $_wp_column_headers[$screen->id]);
    762         return $_wp_column_headers[$screen->id];
    763 }
    764 
    765 /**
    766  * {@internal Missing Short Description}}
    767  *
    768  * @since unknown
    769  *
    770  * @param unknown_type $screen
    771  * @param unknown_type $id
    772  */
    773 function print_column_headers( $screen, $id = true ) {
    774         if ( is_string($screen) )
    775                 $screen = convert_to_screen($screen);
    776 
    777         $columns = get_column_headers( $screen );
    778         $hidden = get_hidden_columns($screen);
    779         $styles = array();
    780 
    781         foreach ( $columns as $column_key => $column_display_name ) {
    782                 $class = ' class="manage-column';
    783 
    784                 $class .= " column-$column_key";
    785 
    786                 if ( 'cb' == $column_key )
    787                         $class .= ' check-column';
    788                 elseif ( in_array($column_key, array('posts', 'comments', 'links')) )
    789                         $class .= ' num';
    790 
    791                 $class .= '"';
    792 
    793                 $style = '';
    794                 if ( in_array($column_key, $hidden) )
    795                         $style = 'display:none;';
    796 
    797                 if ( isset($styles[$screen->id]) && isset($styles[$screen->id][$column_key]) )
    798                         $style .= ' ' . $styles[$screen>id][$column_key];
    799                 $style = ' style="' . $style . '"';
    800 ?>
    801         <th scope="col" <?php echo $id ? "id=\"$column_key\"" : ""; echo $class; echo $style; ?>><?php echo $column_display_name; ?></th>
    802 <?php }
    803 }
    804 
    805 /**
    806  * Register column headers for a particular screen. The header names will be listed in the Screen Options.
    807  *
    808  * @since 2.7.0
    809  *
    810  * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
    811  * @param array $columns An array of columns with column IDs as the keys and translated column names as the values
    812  * @see get_column_headers(), print_column_headers(), get_hidden_columns()
    813  */
    814 function register_column_headers($screen, $columns) {
    815         global $_wp_column_headers;
    816 
    817         if ( is_string($screen) )
    818                 $screen = convert_to_screen($screen);
    819 
    820         if ( !isset($_wp_column_headers) )
    821                 $_wp_column_headers = array();
    822 
    823         $_wp_column_headers[$screen->id] = $columns;
    824 }
    825 
    826 /**
    827  * {@internal Missing Short Description}}
    828  *
    829  * @since unknown
    830  *
    831  * @param unknown_type $screen
    832  */
    833 function get_hidden_columns($screen) {
    834         if ( is_string($screen) )
    835                 $screen = convert_to_screen($screen);
    836 
    837         return (array) get_user_option( 'manage' . $screen->id. 'columnshidden' );
    838 }
    839 
    840 /**
    841  * {@internal Missing Short Description}}
    842  *
    843  * Outputs the quick edit and bulk edit table rows for posts and pages
    844  *
    845  * @since 2.7
    846  *
    847  * @param string $screen
    848  */
    849 function inline_edit_row( $screen ) {
    850         global $mode;
    851 
    852         if ( is_string($screen) ) {
    853                 $screen = array('id' => 'edit-' . $screen, 'base' => 'edit', 'post_type' => $screen );
    854                 $screen = (object) $screen;
    855         }
    856 
    857         $post = get_default_post_to_edit( $screen->post_type );
    858         $post_type_object = get_post_type_object( $screen->post_type );
    859 
    860         $taxonomy_names = get_object_taxonomies( $screen->post_type );
    861         $hierarchical_taxonomies = array();
    862         $flat_taxonomies = array();
    863         foreach ( $taxonomy_names as $taxonomy_name ) {
    864                 $taxonomy = get_taxonomy( $taxonomy_name);
    865 
    866                 if ( !$taxonomy->show_ui )
    867                         continue;
    868 
    869                 if ( $taxonomy->hierarchical )
    870                         $hierarchical_taxonomies[] = $taxonomy;
    871                 else
    872                         $flat_taxonomies[] = $taxonomy;
    873         }
    874 
    875         $columns = wp_manage_posts_columns($screen);
    876         $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($screen) ) );
    877         $col_count = count($columns) - count($hidden);
    878         $m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
    879         $can_publish = current_user_can($post_type_object->cap->publish_posts);
    880         $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );
    881 
    882 ?>
    883 
    884 <form method="get" action=""><table style="display: none"><tbody id="inlineedit">
    885         <?php
    886         $hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page';
    887         $bulk = 0;
    888         while ( $bulk < 2 ) { ?>
    889 
    890         <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-$screen->post_type ";
    891                 echo $bulk ? "bulk-edit-row bulk-edit-row-$hclass bulk-edit-$screen->post_type" : "quick-edit-row quick-edit-row-$hclass inline-edit-$screen->post_type";
    892         ?>" style="display: none"><td colspan="<?php echo $col_count; ?>">
    893 
    894         <fieldset class="inline-edit-col-left"><div class="inline-edit-col">
    895                 <h4><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></h4>
    896 
    897 
    898 <?php
    899 
    900 if ( post_type_supports( $screen->post_type, 'title' ) ) :
    901         if ( $bulk ) : ?>
    902                 <div id="bulk-title-div">
    903                         <div id="bulk-titles"></div>
    904                 </div>
    905 
    906 <?php else : // $bulk ?>
    907 
    908                 <label>
    909                         <span class="title"><?php _e( 'Title' ); ?></span>
    910                         <span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
    911                 </label>
    912 
    913                 <label>
    914                         <span class="title"><?php _e( 'Slug' ); ?></span>
    915                         <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
    916                 </label>
    917 
    918 <?php endif; // $bulk
    919 endif; // post_type_supports title ?>
    920 
    921 <?php if ( !$bulk ) : ?>
    922                 <label><span class="title"><?php _e( 'Date' ); ?></span></label>
    923                 <div class="inline-edit-date">
    924                         <?php touch_time(1, 1, 4, 1); ?>
    925                 </div>
    926                 <br class="clear" />
    927 
    928 <?php endif; // $bulk
    929 
    930         if ( post_type_supports( $screen->post_type, 'author' ) ) :
    931                 $authors = get_editable_user_ids( get_current_user_id(), true, $screen->post_type ); // TODO: ROLE SYSTEM
    932                 $authors_dropdown = '';
    933                 if ( $authors && count( $authors ) > 1 ) :
    934                         $users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1, 'echo' => 0);
    935                         if ( $bulk )
    936                                 $users_opt['show_option_none'] = __('&mdash; No Change &mdash;');
    937                         $authors_dropdown  = '<label>';
    938                         $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
    939                         $authors_dropdown .= wp_dropdown_users( $users_opt );
    940                         $authors_dropdown .= '</label>';
    941 
    942                 endif; // authors
    943                 if ( !$bulk ) // On bulk views, this is used further down
    944                         echo $authors_dropdown;
    945         endif; // post_type_supports author
    946 
    947 if ( !$bulk ) :
    948 ?>
    949 
    950                 <div class="inline-edit-group">
    951                         <label class="alignleft">
    952                                 <span class="title"><?php _e( 'Password' ); ?></span>
    953                                 <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
    954                         </label>
    955 
    956                         <em style="margin:5px 10px 0 0" class="alignleft">
    957                                 <?php
    958                                 /* translators: Between password field and private checkbox on post quick edit interface */
    959                                 echo __( '&ndash;OR&ndash;' );
    960                                 ?>
    961                         </em>
    962                         <label class="alignleft inline-edit-private">
    963                                 <input type="checkbox" name="keep_private" value="private" />
    964                                 <span class="checkbox-title"><?php echo __('Private'); ?></span>
    965                         </label>
    966                 </div>
    967 
    968 <?php endif; ?>
    969 
    970         </div></fieldset>
    971 
    972 <?php if ( count($hierarchical_taxonomies) && !$bulk ) : ?>
    973 
    974         <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
    975 
    976 <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
    977 
    978                 <span class="title inline-edit-categories-label"><?php echo esc_html($taxonomy->labels->name); ?>
    979                         <span class="catshow"><?php _e('[more]'); ?></span>
    980                         <span class="cathide" style="display:none;"><?php _e('[less]'); ?></span>
    981                 </span>
    982                 <input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr($taxonomy->name) . '][]'; ?>" value="0" />
    983                 <ul class="cat-checklist <?php echo esc_attr($taxonomy->name)?>-checklist">
    984                         <?php wp_terms_checklist(null, array('taxonomy' => $taxonomy->name)); ?>
    985                 </ul>
    986 
    987 <?php endforeach; //$hierarchical_taxonomies as $taxonomy ?>
    988 
    989         </div></fieldset>
    990 
    991 <?php endif; // count($hierarchical_taxonomies) && !$bulk ?>
    992 
    993         <fieldset class="inline-edit-col-right"><div class="inline-edit-col">
    994 
    995 <?php
    996         if ( post_type_supports( $screen->post_type, 'author' ) && $bulk )
    997                 echo $authors_dropdown;
    998 ?>
    999 
    1000 <?php if ( $post_type_object->hierarchical ) : ?>
    1001 
    1002                 <label>
    1003                         <span class="title"><?php _e( 'Parent' ); ?></span>
    1004 <?php
    1005         $dropdown_args = array('post_type' => $post_type_object->name, 'selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __('Main Page (no parent)'), 'option_none_value' => 0, 'sort_column'=> 'menu_order, post_title');
    1006         if ( $bulk )
    1007                 $dropdown_args['show_option_no_change'] = __('&mdash; No Change &mdash;');
    1008         $dropdown_args = apply_filters('quick_edit_dropdown_pages_args', $dropdown_args);
    1009         wp_dropdown_pages($dropdown_args);
    1010 ?>
    1011                 </label>
    1012 
    1013 <?php if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) :
    1014                 if ( !$bulk ) : ?>
    1015 
    1016                 <label>
    1017                         <span class="title"><?php _e( 'Order' ); ?></span>
    1018                         <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order; ?>" /></span>
    1019                 </label>
    1020 
    1021 <?php   endif; // !$bulk ?>
    1022 
    1023                 <label>
    1024                         <span class="title"><?php _e( 'Template' ); ?></span>
    1025                         <select name="page_template">
    1026 <?php   if ( $bulk ) : ?>
    1027                                 <option value="-1"><?php _e('&mdash; No Change &mdash;'); ?></option>
    1028 <?php   endif; // $bulk ?>
    1029                                 <option value="default"><?php _e( 'Default Template' ); ?></option>
    1030                                 <?php page_template_dropdown(); ?>
    1031                         </select>
    1032                 </label>
    1033 
    1034 <?php
    1035         endif; // post_type_supports page-attributes
    1036 endif; // $post_type_object->hierarchical ?>
    1037 
    1038 <?php if ( count($flat_taxonomies) && !$bulk ) : ?>
    1039 
    1040 <?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
    1041 
    1042                 <label class="inline-edit-tags">
    1043                         <span class="title"><?php echo esc_html($taxonomy->labels->name); ?></span>
    1044                         <textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr($taxonomy->name); ?>]" class="tax_input_<?php echo esc_attr($taxonomy->name); ?>"></textarea>
    1045                 </label>
    1046 
    1047 <?php endforeach; //$flat_taxonomies as $taxonomy ?>
    1048 
    1049 <?php endif; // count($flat_taxonomies) && !$bulk ?>
    1050 
    1051 <?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) :
    1052         if ( $bulk ) : ?>
    1053 
    1054                 <div class="inline-edit-group">
    1055         <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
    1056                 <label class="alignleft">
    1057                         <span class="title"><?php _e( 'Comments' ); ?></span>
    1058                         <select name="comment_status">
    1059                                 <option value=""><?php _e('&mdash; No Change &mdash;'); ?></option>
    1060                                 <option value="open"><?php _e('Allow'); ?></option>
    1061                                 <option value="closed"><?php _e('Do not allow'); ?></option>
    1062                         </select>
    1063                 </label>
    1064         <?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
    1065                 <label class="alignright">
    1066                         <span class="title"><?php _e( 'Pings' ); ?></span>
    1067                         <select name="ping_status">
    1068                                 <option value=""><?php _e('&mdash; No Change &mdash;'); ?></option>
    1069                                 <option value="open"><?php _e('Allow'); ?></option>
    1070                                 <option value="closed"><?php _e('Do not allow'); ?></option>
    1071                         </select>
    1072                 </label>
    1073         <?php endif; ?>
    1074                 </div>
    1075 
    1076 <?php else : // $bulk ?>
    1077 
    1078                 <div class="inline-edit-group">
    1079                 <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
    1080                         <label class="alignleft">
    1081                                 <input type="checkbox" name="comment_status" value="open" />
    1082                                 <span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
    1083                         </label>
    1084                 <?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
    1085                         <label class="alignleft">
    1086                                 <input type="checkbox" name="ping_status" value="open" />
    1087                                 <span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
    1088                         </label>
    1089                 <?php endif; ?>
    1090                 </div>
    1091 
    1092 <?php endif; // $bulk
    1093 endif; // post_type_supports comments or pings ?>
    1094 
    1095                 <div class="inline-edit-group">
    1096                         <label class="inline-edit-status alignleft">
    1097                                 <span class="title"><?php _e( 'Status' ); ?></span>
    1098                                 <select name="_status">
    1099 <?php if ( $bulk ) : ?>
    1100                                         <option value="-1"><?php _e('&mdash; No Change &mdash;'); ?></option>
    1101 <?php endif; // $bulk ?>
    1102                                 <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>
    1103                                         <option value="publish"><?php _e( 'Published' ); ?></option>
    1104                                         <option value="future"><?php _e( 'Scheduled' ); ?></option>
    1105 <?php if ( $bulk ) : ?>
    1106                                         <option value="private"><?php _e('Private'); ?></option>
    1107 <?php endif; // $bulk ?>
    1108                                 <?php endif; ?>
    1109                                         <option value="pending"><?php _e( 'Pending Review' ); ?></option>
    1110                                         <option value="draft"><?php _e( 'Draft' ); ?></option>
    1111                                 </select>
    1112                         </label>
    1113 
    1114 <?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>
    1115 
    1116 <?php   if ( $bulk ) : ?>
    1117 
    1118                         <label class="alignright">
    1119                                 <span class="title"><?php _e( 'Sticky' ); ?></span>
    1120                                 <select name="sticky">
    1121                                         <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
    1122                                         <option value="sticky"><?php _e( 'Sticky' ); ?></option>
    1123                                         <option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>
    1124                                 </select>
    1125                         </label>
    1126 
    1127 <?php   else : // $bulk ?>
    1128 
    1129                         <label class="alignleft">
    1130                                 <input type="checkbox" name="sticky" value="sticky" />
    1131                                 <span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>
    1132                         </label>
    1133 
    1134 <?php   endif; // $bulk ?>
    1135 
    1136 <?php endif; // !$is_page && $can_publish && current_user_can( 'edit_others_cap' ) ?>
    1137 
    1138                 </div>
    1139 
    1140         </div></fieldset>
    1141 
    1142 <?php
    1143         foreach ( $columns as $column_name => $column_display_name ) {
    1144                 if ( isset( $core_columns[$column_name] ) )
    1145                         continue;
    1146                 do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type );
    1147         }
    1148 ?>
    1149         <p class="submit inline-edit-save">
    1150                 <a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="button-secondary cancel alignleft"><?php _e('Cancel'); ?></a>
    1151                 <?php if ( ! $bulk ) {
    1152                         wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
    1153                         $update_text = __( 'Update' );
    1154                         ?>
    1155                         <a accesskey="s" href="#inline-edit" title="<?php _e('Update'); ?>" class="button-primary save alignright"><?php echo esc_attr( $update_text ); ?></a>
    1156                         <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
    1157                 <?php } else {
    1158                         $update_text = __( 'Update' );
    1159                 ?>
    1160                         <input accesskey="s" class="button-primary alignright" type="submit" name="bulk_edit" value="<?php echo esc_attr( $update_text ); ?>" />
    1161                 <?php } ?>
    1162                 <input type="hidden" name="post_view" value="<?php echo esc_attr($m); ?>" />
    1163                 <input type="hidden" name="screen" value="<?php echo esc_attr($screen->id); ?>" />
    1164                 <br class="clear" />
    1165         </p>
    1166         </td></tr>
    1167 <?php
    1168         $bulk++;
    1169         } ?>
    1170         </tbody></table></form>
    1171 <?php
    1172220}
    1173221
     
    1233281 * @since unknown
    1234282 *
    1235  * @param unknown_type $posts
    1236  */
    1237 function post_rows( $posts = array() ) {
    1238         global $wp_query, $post, $mode;
    1239 
    1240         add_filter('the_title','esc_html');
    1241 
    1242         // Create array of post IDs.
    1243         $post_ids = array();
    1244 
    1245         if ( empty($posts) )
    1246                 $posts = &$wp_query->posts;
    1247 
    1248         foreach ( $posts as $a_post )
    1249                 $post_ids[] = $a_post->ID;
    1250 
    1251         $comment_pending_count = get_pending_comments_num($post_ids);
    1252 
    1253         foreach ( $posts as $post ) {
    1254                 if ( empty($comment_pending_count[$post->ID]) )
    1255                         $comment_pending_count[$post->ID] = 0;
    1256 
    1257                 _post_row($post, $comment_pending_count[$post->ID], $mode);
    1258         }
    1259 }
    1260 
    1261 /**
    1262  * {@internal Missing Short Description}}
    1263  *
    1264  * @since unknown
    1265  *
    1266  * @param unknown_type $a_post
    1267  * @param unknown_type $pending_comments
    1268  * @param unknown_type $mode
    1269  */
    1270 function _post_row($a_post, $pending_comments, $mode) {
    1271         global $post, $current_screen;
    1272         static $rowclass;
    1273 
    1274         $global_post = $post;
    1275         $post = $a_post;
    1276         setup_postdata($post);
    1277 
    1278         $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
    1279         $post_owner = ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
    1280         $edit_link = get_edit_post_link( $post->ID );
    1281         $title = _draft_or_post_title();
    1282         $post_type_object = get_post_type_object($post->post_type);
    1283 ?>
    1284         <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status ); ?> iedit' valign="top">
    1285 <?php
    1286         $posts_columns = get_column_headers( $current_screen );
    1287         $hidden = get_hidden_columns( $current_screen );
    1288         foreach ( $posts_columns as $column_name=>$column_display_name ) {
    1289                 $class = "class=\"$column_name column-$column_name\"";
    1290 
    1291                 $style = '';
    1292                 if ( in_array($column_name, $hidden) )
    1293                         $style = ' style="display:none;"';
    1294 
    1295                 $attributes = "$class$style";
    1296 
    1297                 switch ($column_name) {
    1298 
    1299                 case 'cb':
    1300                 ?>
    1301                 <th scope="row" class="check-column"><?php if ( current_user_can( $post_type_object->cap->edit_post, $post->ID ) ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>
    1302                 <?php
    1303                 break;
    1304 
    1305                 case 'date':
    1306                         if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
    1307                                 $t_time = $h_time = __('Unpublished');
    1308                                 $time_diff = 0;
    1309                         } else {
    1310                                 $t_time = get_the_time(__('Y/m/d g:i:s A'));
    1311                                 $m_time = $post->post_date;
    1312                                 $time = get_post_time('G', true, $post);
    1313 
    1314                                 $time_diff = time() - $time;
    1315 
    1316                                 if ( $time_diff > 0 && $time_diff < 24*60*60 )
    1317                                         $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
    1318                                 else
    1319                                         $h_time = mysql2date(__('Y/m/d'), $m_time);
    1320                         }
    1321 
    1322                         echo '<td ' . $attributes . '>';
    1323                         if ( 'excerpt' == $mode )
    1324                                 echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode);
    1325                         else
    1326                                 echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>';
    1327                         echo '<br />';
    1328                         if ( 'publish' == $post->post_status ) {
    1329                                 _e('Published');
    1330                         } elseif ( 'future' == $post->post_status ) {
    1331                                 if ( $time_diff > 0 )
    1332                                         echo '<strong class="attention">' . __('Missed schedule') . '</strong>';
    1333                                 else
    1334                                         _e('Scheduled');
    1335                         } else {
    1336                                 _e('Last Modified');
    1337                         }
    1338                         echo '</td>';
    1339                 break;
    1340 
    1341                 case 'title':
    1342                         $attributes = 'class="post-title column-title"' . $style;
    1343                 ?>
    1344                 <td <?php echo $attributes; ?>><strong><?php if ( current_user_can($post_type_object->cap->edit_post, $post->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $title; ?></a><?php } else { echo $title; }; _post_states($post); ?></strong>
    1345                 <?php
    1346                         if ( 'excerpt' == $mode )
    1347                                 the_excerpt();
    1348 
    1349                         $actions = array();
    1350                         if ( current_user_can($post_type_object->cap->edit_post, $post->ID) && 'trash' != $post->post_status ) {
    1351                                 $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this item')) . '">' . __('Edit') . '</a>';
    1352                                 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this item inline')) . '">' . __('Quick&nbsp;Edit') . '</a>';
    1353                         }
    1354                         if ( current_user_can($post_type_object->cap->delete_post, $post->ID) ) {
    1355                                 if ( 'trash' == $post->post_status )
    1356                                         $actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash')) . "' href='" . wp_nonce_url( admin_url( sprintf($post_type_object->_edit_link . '&amp;action=untrash', $post->ID) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __('Restore') . '</a>';
    1357                                 elseif ( EMPTY_TRASH_DAYS )
    1358                                         $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . '</a>';
    1359                                 if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
    1360                                         $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently')) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently') . '</a>';
    1361                         }
    1362                         if ( in_array($post->post_status, array('pending', 'draft')) ) {
    1363                                 if ( current_user_can($post_type_object->cap->edit_post, $post->ID) )
    1364                                         $actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink($post->ID) ) ) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
    1365                         } elseif ( 'trash' != $post->post_status ) {
    1366                                 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
    1367                         }
    1368                         $actions = apply_filters('post_row_actions', $actions, $post);
    1369                         $action_count = count($actions);
    1370                         $i = 0;
    1371                         echo '<div class="row-actions">';
    1372                         foreach ( $actions as $action => $link ) {
    1373                                 ++$i;
    1374                                 ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
    1375                                 echo "<span class='$action'>$link$sep</span>";
    1376                         }
    1377                         echo '</div>';
    1378 
    1379                         get_inline_data($post);
    1380                 ?>
    1381                 </td>
    1382                 <?php
    1383                 break;
    1384 
    1385                 case 'categories':
    1386                 ?>
    1387                 <td <?php echo $attributes; ?>><?php
    1388                         $categories = get_the_category();
    1389                         if ( !empty( $categories ) ) {
    1390                                 $out = array();
    1391                                 foreach ( $categories as $c )
    1392                                         $out[] = "<a href='edit.php?post_type={$post->post_type}&amp;category_name={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . '</a>';
    1393                                         echo join( ', ', $out );
    1394                         } else {
    1395                                 _e('Uncategorized');
    1396                         }
    1397                 ?></td>
    1398                 <?php
    1399                 break;
    1400 
    1401                 case 'tags':
    1402                 ?>
    1403                 <td <?php echo $attributes; ?>><?php
    1404                         $tags = get_the_tags($post->ID);
    1405                         if ( !empty( $tags ) ) {
    1406                                 $out = array();
    1407                                 foreach ( $tags as $c )
    1408                                         $out[] = "<a href='edit.php?post_type={$post->post_type}&amp;tag={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . '</a>';
    1409                                 echo join( ', ', $out );
    1410                         } else {
    1411                                 _e('No Tags');
    1412                         }
    1413                 ?></td>
    1414                 <?php
    1415                 break;
    1416 
    1417                 case 'comments':
    1418                 ?>
    1419                 <td <?php echo $attributes; ?>><div class="post-com-count-wrapper">
    1420                 <?php
    1421                         $pending_phrase = sprintf( __('%s pending'), number_format( $pending_comments ) );
    1422                         if ( $pending_comments )
    1423                                 echo '<strong>';
    1424                                 comments_number("<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('0', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('1', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link: % will be substituted by comment count */ _x('%', 'comment count') . '</span></a>');
    1425                                 if ( $pending_comments )
    1426                                 echo '</strong>';
    1427                 ?>
    1428                 </div></td>
    1429                 <?php
    1430                 break;
    1431 
    1432                 case 'author':
    1433                 ?>
    1434                 <td <?php echo $attributes; ?>><a href="edit.php?post_type=<?php echo $post->post_type; ?>&amp;author=<?php the_author_meta('ID'); ?>"><?php the_author(); ?></a></td>
    1435                 <?php
    1436                 break;
    1437 
    1438                 case 'control_view':
    1439                 ?>
    1440                 <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></td>
    1441                 <?php
    1442                 break;
    1443 
    1444                 case 'control_edit':
    1445                 ?>
    1446                 <td><?php if ( current_user_can($post_type_object->cap->edit_post, $post->ID) ) { echo "<a href='$edit_link' class='edit'>" . __('Edit') . '</a>'; } ?></td>
    1447                 <?php
    1448                 break;
    1449 
    1450                 case 'control_delete':
    1451                 ?>
    1452                 <td><?php if ( current_user_can($post_type_object->cap->delete_post, $post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . '</a>'; } ?></td>
    1453                 <?php
    1454                 break;
    1455 
    1456                 default:
    1457                 ?>
    1458                 <td <?php echo $attributes; ?>><?php do_action('manage_posts_custom_column', $column_name, $post->ID); ?></td>
    1459                 <?php
    1460                 break;
    1461         }
    1462 }
    1463 ?>
    1464         </tr>
    1465 <?php
    1466         $post = $global_post;
    1467 }
    1468 
    1469 /*
    1470  * display one row if the page doesn't have any children
    1471  * otherwise, display the row and its children in subsequent rows
    1472  */
    1473 /**
    1474  * {@internal Missing Short Description}}
    1475  *
    1476  * @since unknown
    1477  *
    1478  * @param unknown_type $page
    1479  * @param unknown_type $level
    1480  */
    1481 function display_page_row( $page, $level = 0 ) {
    1482         global $post, $current_screen;
    1483         static $rowclass;
    1484 
    1485         $post = $page;
    1486         setup_postdata($page);
    1487 
    1488         if ( 0 == $level && (int)$page->post_parent > 0 ) {
    1489                 //sent level 0 by accident, by default, or because we don't know the actual level
    1490                 $find_main_page = (int)$page->post_parent;
    1491                 while ( $find_main_page > 0 ) {
    1492                         $parent = get_page($find_main_page);
    1493 
    1494                         if ( is_null($parent) )
    1495                                 break;
    1496 
    1497                         $level++;
    1498                         $find_main_page = (int)$parent->post_parent;
    1499 
    1500                         if ( !isset($parent_name) )
    1501                                 $parent_name = $parent->post_title;
    1502                 }
    1503         }
    1504 
    1505         $page->post_title = esc_html( $page->post_title );
    1506         $pad = str_repeat( '&#8212; ', $level );
    1507         $id = (int) $page->ID;
    1508         $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
    1509         $posts_columns = get_column_headers( $current_screen );
    1510         $hidden = get_hidden_columns( $current_screen );
    1511         $title = _draft_or_post_title();
    1512         $post_type = $page->post_type;
    1513         $post_type_object = get_post_type_object($post_type);
    1514 ?>
    1515 <tr id="page-<?php echo $id; ?>" class="<?php echo $rowclass; ?> iedit">
    1516 <?php
    1517 
    1518 foreach ( $posts_columns as $column_name => $column_display_name ) {
    1519         $class = "class=\"$column_name column-$column_name\"";
    1520 
    1521         $style = '';
    1522         if ( in_array($column_name, $hidden) )
    1523                 $style = ' style="display:none;"';
    1524 
    1525         $attributes = "$class$style";
    1526 
    1527         switch ($column_name) {
    1528 
    1529         case 'cb':
    1530                 ?>
    1531                 <th scope="row" class="check-column"><?php if ( current_user_can( $post_type_object->cap->edit_post, $page->ID ) ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>
    1532                 <?php
    1533                 break;
    1534         case 'date':
    1535                 if ( '0000-00-00 00:00:00' == $page->post_date && 'date' == $column_name ) {
    1536                         $t_time = $h_time = __('Unpublished');
    1537                         $time_diff = 0;
    1538                 } else {
    1539                         $t_time = get_the_time(__('Y/m/d g:i:s A'));
    1540                         $m_time = $page->post_date;
    1541                         $time = get_post_time('G', true);
    1542 
    1543                         $time_diff = time() - $time;
    1544 
    1545                         if ( $time_diff > 0 && $time_diff < 24*60*60 )
    1546                                 $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
    1547                         else
    1548                                 $h_time = mysql2date(__('Y/m/d'), $m_time);
    1549                 }
    1550                 echo '<td ' . $attributes . '>';
    1551                 echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $page, $column_name, '') . '</abbr>';
    1552                 echo '<br />';
    1553                 if ( 'publish' == $page->post_status ) {
    1554                         _e('Published');
    1555                 } elseif ( 'future' == $page->post_status ) {
    1556                         if ( $time_diff > 0 )
    1557                                 echo '<strong class="attention">' . __('Missed schedule') . '</strong>';
    1558                         else
    1559                                 _e('Scheduled');
    1560                 } else {
    1561                         _e('Last Modified');
    1562                 }
    1563                 echo '</td>';
    1564                 break;
    1565         case 'title':
    1566                 $attributes = 'class="post-title page-title column-title"' . $style;
    1567                 $edit_link = get_edit_post_link( $page->ID );
    1568                 ?>
    1569                 <td <?php echo $attributes; ?>><strong><?php if ( current_user_can($post_type_object->cap->edit_post, $page->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $pad; echo $title; ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html($parent_name) : ''; ?></strong>
    1570                 <?php
    1571                 $actions = array();
    1572                 if ( current_user_can($post_type_object->cap->edit_post, $page->ID) && $post->post_status != 'trash' ) {
    1573                         $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>';
    1574                         $actions['inline'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
    1575                 }
    1576                 if ( current_user_can($post_type_object->cap->delete_post, $page->ID) ) {
    1577                         if ( $post->post_status == 'trash' )
    1578                                 $actions['untrash'] = "<a title='" . esc_attr(__('Remove this page from the Trash')) . "' href='" . wp_nonce_url("post.php?post_type=$post_type&amp;action=untrash&amp;post=$page->ID", 'untrash-' . $post->post_type . '_' . $page->ID) . "'>" . __('Restore') . '</a>';
    1579                         elseif ( EMPTY_TRASH_DAYS )
    1580                                 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this page to the Trash')) . "' href='" . get_delete_post_link($page->ID) . "'>" . __('Trash') . '</a>';
    1581                         if ( $post->post_status == 'trash' || !EMPTY_TRASH_DAYS )
    1582                                 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("post.php?post_type=$post_type&amp;action=delete&amp;post=$page->ID", 'delete-' . $post->post_type . '_' . $page->ID) . "'>" . __('Delete Permanently') . '</a>';
    1583                 }
    1584                 if ( in_array($post->post_status, array('pending', 'draft')) ) {
    1585                         if ( current_user_can($post_type_object->cap->edit_post, $page->ID) )
    1586                                 $actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink($page->ID) ) ) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
    1587                 } elseif ( $post->post_status != 'trash' ) {
    1588                         $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
    1589                 }
    1590                 $actions = apply_filters('page_row_actions', $actions, $page);
    1591                 $action_count = count($actions);
    1592 
    1593                 $i = 0;
    1594                 echo '<div class="row-actions">';
    1595                 foreach ( $actions as $action => $link ) {
    1596                         ++$i;
    1597                         ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
    1598                         echo "<span class='$action'>$link$sep</span>";
    1599                 }
    1600                 echo '</div>';
    1601 
    1602                 get_inline_data($post);
    1603                 echo '</td>';
    1604                 break;
    1605 
    1606         case 'comments':
    1607                 ?>
    1608                 <td <?php echo $attributes; ?>><div class="post-com-count-wrapper">
    1609                 <?php
    1610                 $left = get_pending_comments_num( $page->ID );
    1611                 $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
    1612                 if ( $left )
    1613                         echo '<strong>';
    1614                 comments_number("<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('0', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('1', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link: % will be substituted by comment count */ _x('%', 'comment count') . '</span></a>');
    1615                 if ( $left )
    1616                         echo '</strong>';
    1617                 ?>
    1618                 </div></td>
    1619                 <?php
    1620                 break;
    1621 
    1622         case 'author':
    1623                 ?>
    1624                 <td <?php echo $attributes; ?>><a href="edit.php?post_type=<?php echo $post_type; ?>&amp;author=<?php the_author_meta('ID'); ?>"><?php the_author(); ?></a></td>
    1625                 <?php
    1626                 break;
    1627 
    1628         default:
    1629                 ?>
    1630                 <td <?php echo $attributes; ?>><?php do_action('manage_pages_custom_column', $column_name, $id); ?></td>
    1631                 <?php
    1632                 break;
    1633         }
    1634 }
    1635 ?>
    1636 
    1637 </tr>
    1638 
    1639 <?php
    1640 }
    1641 
    1642 /*
    1643  * displays pages in hierarchical order with paging support
    1644  */
    1645 /**
    1646  * {@internal Missing Short Description}}
    1647  *
    1648  * @since unknown
    1649  *
    1650  * @param unknown_type $pages
    1651  * @param unknown_type $pagenum
    1652  * @param unknown_type $per_page
    1653  * @return unknown
    1654  */
    1655 function page_rows($pages, $pagenum = 1, $per_page = 20) {
    1656         global $wpdb;
    1657 
    1658         $level = 0;
    1659 
    1660         if ( ! $pages ) {
    1661                 $pages = get_pages( array('sort_column' => 'menu_order') );
    1662 
    1663                 if ( ! $pages )
    1664                         return false;
    1665         }
    1666 
    1667         /*
    1668          * arrange pages into two parts: top level pages and children_pages
    1669          * children_pages is two dimensional array, eg.
    1670          * children_pages[10][] contains all sub-pages whose parent is 10.
    1671          * It only takes O(N) to arrange this and it takes O(1) for subsequent lookup operations
    1672          * If searching, ignore hierarchy and treat everything as top level
    1673          */
    1674         if ( empty($_GET['s']) ) {
    1675 
    1676                 $top_level_pages = array();
    1677                 $children_pages = array();
    1678 
    1679                 foreach ( $pages as $page ) {
    1680 
    1681                         // catch and repair bad pages
    1682                         if ( $page->post_parent == $page->ID ) {
    1683                                 $page->post_parent = 0;
    1684                                 $wpdb->update($wpdb->posts, array('post_parent' => 0), array('ID' => $page->ID));
    1685                                 clean_page_cache( $page->ID );
    1686                         }
    1687 
    1688                         if ( 0 == $page->post_parent )
    1689                                 $top_level_pages[] = $page;
    1690                         else
    1691                                 $children_pages[ $page->post_parent ][] = $page;
    1692                 }
    1693 
    1694                 $pages = &$top_level_pages;
    1695         }
    1696 
    1697         $count = 0;
    1698         $start = ($pagenum - 1) * $per_page;
    1699         $end = $start + $per_page;
    1700 
    1701         foreach ( $pages as $page ) {
    1702                 if ( $count >= $end )
    1703                         break;
    1704 
    1705                 if ( $count >= $start )
    1706                         echo "\t" . display_page_row( $page, $level );
    1707 
    1708                 $count++;
    1709 
    1710                 if ( isset($children_pages) )
    1711                         _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
    1712         }
    1713 
    1714         // if it is the last pagenum and there are orphaned pages, display them with paging as well
    1715         if ( isset($children_pages) && $count < $end ) {
    1716                 foreach ( $children_pages as $orphans ) {
    1717                         foreach ( $orphans as $op ) {
    1718                                 if ( $count >= $end )
    1719                                         break;
    1720                                 if ( $count >= $start )
    1721                                         echo "\t" . display_page_row( $op, 0 );
    1722                                 $count++;
    1723                         }
    1724                 }
    1725         }
    1726 }
    1727 
    1728 /**
    1729  * Given a top level page ID, display the nested hierarchy of sub-pages
    1730  * together with paging support
    1731  *
    1732  * @since unknown
    1733  *
    1734  * @param unknown_type $children_pages
    1735  * @param unknown_type $count
    1736  * @param unknown_type $parent
    1737  * @param unknown_type $level
    1738  * @param unknown_type $pagenum
    1739  * @param unknown_type $per_page
    1740  */
    1741 function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
    1742 
    1743         if ( ! isset( $children_pages[$parent] ) )
    1744                 return;
    1745 
    1746         $start = ($pagenum - 1) * $per_page;
    1747         $end = $start + $per_page;
    1748 
    1749         foreach ( $children_pages[$parent] as $page ) {
    1750 
    1751                 if ( $count >= $end )
    1752                         break;
    1753 
    1754                 // If the page starts in a subtree, print the parents.
    1755                 if ( $count == $start && $page->post_parent > 0 ) {
    1756                         $my_parents = array();
    1757                         $my_parent = $page->post_parent;
    1758                         while ( $my_parent) {
    1759                                 $my_parent = get_post($my_parent);
    1760                                 $my_parents[] = $my_parent;
    1761                                 if ( !$my_parent->post_parent )
    1762                                         break;
    1763                                 $my_parent = $my_parent->post_parent;
    1764                         }
    1765                         $num_parents = count($my_parents);
    1766                         while ( $my_parent = array_pop($my_parents) ) {
    1767                                 echo "\t" . display_page_row( $my_parent, $level - $num_parents );
    1768                                 $num_parents--;
    1769                         }
    1770                 }
    1771 
    1772                 if ( $count >= $start )
    1773                         echo "\t" . display_page_row( $page, $level );
    1774 
    1775                 $count++;
    1776 
    1777                 _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
    1778         }
    1779 
    1780         unset( $children_pages[$parent] ); //required in order to keep track of orphans
    1781 }
    1782 
    1783 /**
    1784  * Generate HTML for a single row on the users.php admin panel.
    1785  *
    1786  * @since 2.1.0
    1787  *
    1788  * @param object $user_object
    1789  * @param string $style Optional. Attributes added to the TR element. Must be sanitized.
    1790  * @param string $role Key for the $wp_roles array.
    1791  * @param int $numposts Optional. Post count to display for this user. Defaults to zero, as in, a new user has made zero posts.
    1792  * @return string
    1793  */
    1794 function user_row( $user_object, $style = '', $role = '', $numposts = 0 ) {
    1795         global $wp_roles;
    1796 
    1797         if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) )
    1798                 $user_object = new WP_User( (int) $user_object );
    1799         $user_object = sanitize_user_object($user_object, 'display');
    1800         $email = $user_object->user_email;
    1801         $url = $user_object->user_url;
    1802         $short_url = str_replace( 'http://', '', $url );
    1803         $short_url = str_replace( 'www.', '', $short_url );
    1804         if ('/' == substr( $short_url, -1 ))
    1805                 $short_url = substr( $short_url, 0, -1 );
    1806         if ( strlen( $short_url ) > 35 )
    1807                 $short_url = substr( $short_url, 0, 32 ).'...';
    1808         $checkbox = '';
    1809         // Check if the user for this row is editable
    1810         if ( current_user_can( 'list_users' ) ) {
    1811                 // Set up the user editing link
    1812                 // TODO: make profile/user-edit determination a separate function
    1813                 if ( get_current_user_id() == $user_object->ID) {
    1814                         $edit_link = 'profile.php';
    1815                 } else {
    1816                         $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" ) );
    1817                 }
    1818                 $edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
    1819 
    1820                 // Set up the hover actions for this user
    1821                 $actions = array();
    1822 
    1823                 if ( current_user_can('edit_user', $user_object->ID) ) {
    1824                         $edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
    1825                         $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
    1826                 } else {
    1827                         $edit = "<strong>$user_object->user_login</strong><br />";
    1828                 }
    1829 
    1830                 if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('delete_user', $user_object->ID) )
    1831                         $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&amp;user=$user_object->ID", 'bulk-users') . "'>" . __('Delete') . '</a>';
    1832                 if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('remove_user', $user_object->ID) )
    1833                         $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=remove&amp;user=$user_object->ID", 'bulk-users') . "'>" . __('Remove') . '</a>';
    1834                 $actions = apply_filters('user_row_actions', $actions, $user_object);
    1835                 $action_count = count($actions);
    1836                 $i = 0;
    1837                 $edit .= '<div class="row-actions">';
    1838                 foreach ( $actions as $action => $link ) {
    1839                         ++$i;
    1840                         ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
    1841                         $edit .= "<span class='$action'>$link$sep</span>";
    1842                 }
    1843                 $edit .= '</div>';
    1844 
    1845                 // Set up the checkbox (because the user is editable, otherwise its empty)
    1846                 $checkbox = "<input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' />";
    1847 
    1848         } else {
    1849                 $edit = '<strong>' . $user_object->user_login . '</strong>';
    1850         }
    1851         $role_name = isset($wp_roles->role_names[$role]) ? translate_user_role($wp_roles->role_names[$role] ) : __('None');
    1852         $r = "<tr id='user-$user_object->ID'$style>";
    1853         $columns = get_column_headers('users');
    1854         $hidden = get_hidden_columns('users');
    1855         $avatar = get_avatar( $user_object->ID, 32 );
    1856         foreach ( $columns as $column_name => $column_display_name ) {
    1857                 $class = "class=\"$column_name column-$column_name\"";
    1858 
    1859                 $style = '';
    1860                 if ( in_array($column_name, $hidden) )
    1861                         $style = ' style="display:none;"';
    1862 
    1863                 $attributes = "$class$style";
    1864 
    1865                 switch ($column_name) {
    1866                         case 'cb':
    1867                                 $r .= "<th scope='row' class='check-column'>$checkbox</th>";
    1868                                 break;
    1869                         case 'username':
    1870                                 $r .= "<td $attributes>$avatar $edit</td>";
    1871                                 break;
    1872                         case 'name':
    1873                                 $r .= "<td $attributes>$user_object->first_name $user_object->last_name</td>";
    1874                                 break;
    1875                         case 'email':
    1876                                 $r .= "<td $attributes><a href='mailto:$email' title='" . sprintf( __('E-mail: %s' ), $email ) . "'>$email</a></td>";
    1877                                 break;
    1878                         case 'role':
    1879                                 $r .= "<td $attributes>$role_name</td>";
    1880                                 break;
    1881                         case 'posts':
    1882                                 $attributes = 'class="posts column-posts num"' . $style;
    1883                                 $r .= "<td $attributes>";
    1884                                 if ( $numposts > 0 ) {
    1885                                         $r .= "<a href='edit.php?author=$user_object->ID' title='" . __( 'View posts by this author' ) . "' class='edit'>";
    1886                                         $r .= $numposts;
    1887                                         $r .= '</a>';
    1888                                 } else {
    1889                                         $r .= 0;
    1890                                 }
    1891                                 $r .= "</td>";
    1892                                 break;
    1893                         default:
    1894                                 $r .= "<td $attributes>";
    1895                                 $r .= apply_filters('manage_users_custom_column', '', $column_name, $user_object->ID);
    1896                                 $r .= "</td>";
    1897                 }
    1898         }
    1899         $r .= '</tr>';
    1900 
    1901         return $r;
    1902 }
    1903 
    1904 /**
    1905  * {@internal Missing Short Description}}
    1906  *
    1907  * @since unknown
    1908  *
    1909  * @param string $status Comment status (approved, spam, trash, etc)
    1910  * @param string $s Term to search for
    1911  * @param int $start Offset to start at for pagination
    1912  * @param int $num Maximum number of comments to return
    1913  * @param int $post Post ID or 0 to return all comments
    1914  * @param string $type Comment type (comment, trackback, pingback, etc)
    1915  * @return array [0] contains the comments and [1] contains the total number of comments that match (ignoring $start and $num)
    1916  */
    1917 function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0, $type = '' ) {
    1918         global $wpdb;
    1919 
    1920         $start = abs( (int) $start );
    1921         $num = (int) $num;
    1922         $post = (int) $post;
    1923         $count = wp_count_comments();
    1924         $index = '';
    1925 
    1926         if ( 'moderated' == $status ) {
    1927                 $approved = "c.comment_approved = '0'";
    1928                 $total = $count->moderated;
    1929         } elseif ( 'approved' == $status ) {
    1930                 $approved = "c.comment_approved = '1'";
    1931                 $total = $count->approved;
    1932         } elseif ( 'spam' == $status ) {
    1933                 $approved = "c.comment_approved = 'spam'";
    1934                 $total = $count->spam;
    1935         } elseif ( 'trash' == $status ) {
    1936                 $approved = "c.comment_approved = 'trash'";
    1937                 $total = $count->trash;
    1938         } else {
    1939                 $approved = "( c.comment_approved = '0' OR c.comment_approved = '1' )";
    1940                 $total = $count->moderated + $count->approved;
    1941                 $index = 'USE INDEX (c.comment_date_gmt)';
    1942         }
    1943 
    1944         if ( $post ) {
    1945                 $total = '';
    1946                 $post = " AND c.comment_post_ID = '$post'";
    1947         } else {
    1948                 $post = '';
    1949         }
    1950 
    1951         $orderby = "ORDER BY c.comment_date_gmt DESC LIMIT $start, $num";
    1952 
    1953         if ( 'comment' == $type )
    1954                 $typesql = "AND c.comment_type = ''";
    1955         elseif ( 'pings' == $type )
    1956                 $typesql = "AND ( c.comment_type = 'pingback' OR c.comment_type = 'trackback' )";
    1957         elseif ( 'all' == $type )
    1958                 $typesql = '';
    1959         elseif ( !empty($type) )
    1960                 $typesql = $wpdb->prepare("AND c.comment_type = %s", $type);
    1961         else
    1962                 $typesql = '';
    1963 
    1964         if ( !empty($type) )
    1965                 $total = '';
    1966 
    1967         $query = "FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ";
    1968         if ( $s ) {
    1969                 $total = '';
    1970                 $s = $wpdb->escape($s);
    1971                 $query .= "AND
    1972                         (c.comment_author LIKE '%$s%' OR
    1973                         c.comment_author_email LIKE '%$s%' OR
    1974                         c.comment_author_url LIKE ('%$s%') OR
    1975                         c.comment_author_IP LIKE ('%$s%') OR
    1976                         c.comment_content LIKE ('%$s%') ) AND
    1977                         $approved
    1978                         $typesql";
    1979         } else {
    1980                 $query .= "AND $approved $post $typesql";
    1981         }
    1982 
    1983         $comments = $wpdb->get_results("SELECT * $query $orderby");
    1984         if ( '' === $total )
    1985                 $total = $wpdb->get_var("SELECT COUNT(c.comment_ID) $query");
    1986 
    1987         update_comment_cache($comments);
    1988 
    1989         return array($comments, $total);
    1990 }
    1991 
    1992 /**
    1993  * {@internal Missing Short Description}}
    1994  *
    1995  * @since unknown
    1996  *
    1997  * @param unknown_type $comment_id
    1998  * @param unknown_type $mode
    1999  * @param unknown_type $comment_status
    2000  * @param unknown_type $checkbox
    2001  */
    2002 function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true, $from_ajax = false ) {
    2003         global $comment, $post, $_comment_pending_count;
    2004         $comment = get_comment( $comment_id );
    2005         $post = get_post($comment->comment_post_ID);
    2006         $the_comment_status = wp_get_comment_status($comment->comment_ID);
    2007         $post_type_object = get_post_type_object($post->post_type);
    2008         $user_can = current_user_can($post_type_object->cap->edit_post, $post->ID);
    2009 
    2010         $comment_url = esc_url(get_comment_link($comment->comment_ID));
    2011         $author_url = get_comment_author_url();
    2012         if ( 'http://' == $author_url )
    2013                 $author_url = '';
    2014         $author_url_display = preg_replace('|http://(www\.)?|i', '', $author_url);
    2015         if ( strlen($author_url_display) > 50 )
    2016                 $author_url_display = substr($author_url_display, 0, 49) . '...';
    2017 
    2018         $ptime = date('G', strtotime( $comment->comment_date ) );
    2019         if ( ( abs(time() - $ptime) ) < 86400 )
    2020                 $ptime = sprintf( __('%s ago'), human_time_diff( $ptime ) );
    2021         else
    2022                 $ptime = mysql2date(__('Y/m/d \a\t g:i A'), $comment->comment_date );
    2023 
    2024         if ( $user_can ) {
    2025                 $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
    2026                 $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
    2027 
    2028                 $approve_url = esc_url( "comment.php?action=approvecomment&p=$post->ID&c=$comment->comment_ID&$approve_nonce" );
    2029                 $unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$post->ID&c=$comment->comment_ID&$approve_nonce" );
    2030                 $spam_url = esc_url( "comment.php?action=spamcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" );
    2031                 $unspam_url = esc_url( "comment.php?action=unspamcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" );
    2032                 $trash_url = esc_url( "comment.php?action=trashcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" );
    2033                 $untrash_url = esc_url( "comment.php?action=untrashcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" );
    2034                 $delete_url = esc_url( "comment.php?action=deletecomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" );
    2035         }
    2036 
    2037         echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>";
    2038         $columns = get_column_headers('edit-comments');
    2039         $hidden = get_hidden_columns('edit-comments');
    2040         foreach ( $columns as $column_name => $column_display_name ) {
    2041                 $class = "class=\"$column_name column-$column_name\"";
    2042 
    2043                 $style = '';
    2044                 if ( in_array($column_name, $hidden) )
    2045                         $style = ' style="display:none;"';
    2046 
    2047                 $attributes = "$class$style";
    2048 
    2049                 switch ($column_name) {
    2050                         case 'cb':
    2051                                 if ( !$checkbox ) break;
    2052                                 echo '<th scope="row" class="check-column">';
    2053                                 if ( $user_can ) echo "<input type='checkbox' name='delete_comments[]' value='$comment->comment_ID' />";
    2054                                 echo '</th>';
    2055                                 break;
    2056                         case 'comment':
    2057                                 echo "<td $attributes>";
    2058                                 echo '<div id="submitted-on">';
    2059                                 /* translators: 2: comment date, 3: comment time */
    2060                                 printf( __( '<a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
    2061                                         /* translators: comment date format. See http://php.net/date */ get_comment_date( __('Y/m/d') ),
    2062                                         /* translators: comment time format. See http://php.net/date */ get_comment_date( get_option( 'time_format' ) ) );
    2063 
    2064                                 if ( $comment->comment_parent ) {
    2065                                         $parent = get_comment( $comment->comment_parent );
    2066                                         $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
    2067                                         $name = apply_filters( 'get_comment_author', $parent->comment_author ); // there's no API function for this
    2068                                         printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
    2069                                 }
    2070 
    2071                                 echo '</div>';
    2072                                 comment_text();
    2073                                 if ( $user_can ) { ?>
    2074                                 <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
    2075                                 <textarea class="comment" rows="1" cols="1"><?php echo htmlspecialchars( apply_filters('comment_edit_pre', $comment->comment_content), ENT_QUOTES ); ?></textarea>
    2076                                 <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div>
    2077                                 <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div>
    2078                                 <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
    2079                                 <div class="comment_status"><?php echo $comment->comment_approved; ?></div>
    2080                                 </div>
    2081                                 <?php
    2082                                 }
    2083 
    2084                                 if ( $user_can ) {
    2085                                         // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash
    2086                                         $actions = array(
    2087                                                 'approve' => '', 'unapprove' => '',
    2088                                                 'reply' => '',
    2089                                                 'quickedit' => '',
    2090                                                 'edit' => '',
    2091                                                 'spam' => '', 'unspam' => '',
    2092                                                 'trash' => '', 'untrash' => '', 'delete' => ''
    2093                                         );
    2094 
    2095                                         if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments
    2096                                                 if ( 'approved' == $the_comment_status )
    2097                                                         $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
    2098                                                 else if ( 'unapproved' == $the_comment_status )
    2099                                                         $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=approved vim-a vim-destructive' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
    2100                                         } else {
    2101                                                 $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
    2102                                                 $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
    2103                                         }
    2104 
    2105                                         if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
    2106                                                 $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
    2107                                         } elseif ( 'spam' == $the_comment_status ) {
    2108                                                 $actions['unspam'] = "<a href='$unspam_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1 vim-z vim-destructive'>" . _x( 'Not Spam', 'comment' ) . '</a>';
    2109                                         } elseif ( 'trash' == $the_comment_status ) {
    2110                                                 $actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1 vim-z vim-destructive'>" . __( 'Restore' ) . '</a>';
    2111                                         }
    2112 
    2113                                         if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) {
    2114                                                 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::delete=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
    2115                                         } else {
    2116                                                 $actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>';
    2117                                         }
    2118 
    2119                                         if ( 'trash' != $the_comment_status ) {
    2120                                                 $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__('Edit comment') . "'>". __('Edit') . '</a>';
    2121                                                 $actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\');return false;" class="vim-q" title="'.esc_attr__('Quick Edit').'" href="#">' . __('Quick&nbsp;Edit') . '</a>';
    2122                                                 if ( 'spam' != $the_comment_status )
    2123                                                         $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\');return false;" class="vim-r" title="'.esc_attr__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
    2124                                         }
    2125 
    2126                                         $actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment );
    2127 
    2128                                         $i = 0;
    2129                                         echo '<div class="row-actions">';
    2130                                         foreach ( $actions as $action => $link ) {
    2131                                                 ++$i;
    2132                                                 ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
    2133 
    2134                                                 // Reply and quickedit need a hide-if-no-js span when not added with ajax
    2135                                                 if ( ('reply' == $action || 'quickedit' == $action) && ! $from_ajax )
    2136                                                         $action .= ' hide-if-no-js';
    2137                                                 elseif ( ($action == 'untrash' && $the_comment_status == 'trash') || ($action == 'unspam' && $the_comment_status == 'spam') ) {
    2138                                                         if ('1' == get_comment_meta($comment_id, '_wp_trash_meta_status', true))
    2139                                                                 $action .= ' approve';
    2140                                                         else
    2141                                                                 $action .= ' unapprove';
    2142                                                 }
    2143 
    2144                                                 echo "<span class='$action'>$sep$link</span>";
    2145                                         }
    2146                                         echo '</div>';
    2147                                 }
    2148 
    2149                                 echo '</td>';
    2150                                 break;
    2151                         case 'author':
    2152                                 echo "<td $attributes><strong>"; comment_author(); echo '</strong><br />';
    2153                                 if ( !empty($author_url) )
    2154                                         echo "<a title='$author_url' href='$author_url'>$author_url_display</a><br />";
    2155                                 if ( $user_can ) {
    2156                                         if ( !empty($comment->comment_author_email) ) {
    2157                                                 comment_author_email_link();
    2158                                                 echo '<br />';
    2159                                         }
    2160                                         echo '<a href="edit-comments.php?s=';
    2161                                         comment_author_IP();
    2162                                         echo '&amp;mode=detail';
    2163                                         if ( 'spam' == $comment_status )
    2164                                                 echo '&amp;comment_status=spam';
    2165                                         echo '">';
    2166                                         comment_author_IP();
    2167                                         echo '</a>';
    2168                                 } //current_user_can
    2169                                 echo '</td>';
    2170                                 break;
    2171                         case 'date':
    2172                                 echo "<td $attributes>" . get_comment_date(__('Y/m/d \a\t g:ia')) . '</td>';
    2173                                 break;
    2174                         case 'response':
    2175                                 if ( 'single' !== $mode ) {
    2176                                         if ( isset( $_comment_pending_count[$post->ID] ) ) {
    2177                                                 $pending_comments = $_comment_pending_count[$post->ID];
    2178                                         } else {
    2179                                                 $_comment_pending_count_temp = get_pending_comments_num( array( $post->ID ) );
    2180                                                 $pending_comments = $_comment_pending_count[$post->ID] = $_comment_pending_count_temp[$post->ID];
    2181                                         }
    2182                                         if ( $user_can ) {
    2183                                                 $post_link = "<a href='" . get_edit_post_link($post->ID) . "'>";
    2184                                                 $post_link .= get_the_title($post->ID) . '</a>';
    2185                                         } else {
    2186                                                 $post_link = get_the_title($post->ID);
    2187                                         }
    2188                                         echo "<td $attributes>\n";
    2189                                         echo '<div class="response-links"><span class="post-com-count-wrapper">';
    2190                                         echo $post_link . '<br />';
    2191                                         $pending_phrase = esc_attr(sprintf( __('%s pending'), number_format( $pending_comments ) ));
    2192                                         if ( $pending_comments )
    2193                                                 echo '<strong>';
    2194                                         comments_number("<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('0', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('1', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link: % will be substituted by comment count */ _x('%', 'comment count') . '</span></a>');
    2195                                         if ( $pending_comments )
    2196                                                 echo '</strong>';
    2197                                         echo '</span> ';
    2198                                         echo "<a href='" . get_permalink( $post->ID ) . "'>#</a>";
    2199                                         echo '</div>';
    2200                                         if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) )
    2201                                                 echo $thumb;
    2202                                         echo '</td>';
    2203                                 }
    2204                                 break;
    2205                         default:
    2206                                 echo "<td $attributes>\n";
    2207                                 do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID );
    2208                                 echo "</td>\n";
    2209                                 break;
    2210                 }
    2211         }
    2212         echo "</tr>\n";
    2213 }
    2214 
    2215 /**
    2216  * {@internal Missing Short Description}}
    2217  *
    2218  * @since unknown
    2219  *
    2220283 * @param unknown_type $position
    2221284 * @param unknown_type $checkbox
     
    2231294        }
    2232295
    2233         $columns = get_column_headers('edit-comments');
    2234         $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns('edit-comments') ) );
     296        require_once( './includes/default-list-tables.php' );
     297        $table = new WP_Comments_Table( 'reply' );
     298
     299        $columns = $table->get_column_headers();
     300        $hidden = array_intersect( array_keys( $columns ), array_filter( $table->get_hidden_columns() ) );
    2235301        $col_count = count($columns) - count($hidden);
    2236302
     
    2246312        <div id="edithead" style="display:none;">
    2247313                <div class="inside">
    2248                 <label for="author"><?php _e('Name'); ?></label>
     314                <label for="author"><?php _e('Name') ?></label>
    2249315                <input type="text" name="newcomment_author" size="50" value="" tabindex="101" id="author" />
    2250316                </div>
    2251317
    2252318                <div class="inside">
    2253                 <label for="author-email"><?php _e('E-mail'); ?></label>
     319                <label for="author-email"><?php _e('E-mail') ?></label>
    2254320                <input type="text" name="newcomment_author_email" size="50" value="" tabindex="102" id="author-email" />
    2255321                </div>
    2256322
    2257323                <div class="inside">
    2258                 <label for="author-url"><?php _e('URL'); ?></label>
     324                <label for="author-url"><?php _e('URL') ?></label>
    2259325                <input type="text" id="author-url" name="newcomment_author_url" size="103" value="" tabindex="103" />
    2260326                </div>
     
    2338404        <thead>
    2339405        <tr>
    2340                 <th class="left"><?php _e( 'Name' ); ?></th>
    2341                 <th><?php _e( 'Value' ); ?></th>
     406                <th class="left"><?php _e( 'Name' ) ?></th>
     407                <th><?php _e( 'Value' ) ?></th>
    2342408        </tr>
    2343409        </thead>
     
    2423489                natcasesort($keys);
    2424490?>
    2425 <p><strong><?php _e( 'Add New Custom Field:' ); ?></strong></p>
     491<p><strong><?php _e( 'Add New Custom Field:' ) ?></strong></p>
    2426492<table id="newmeta">
    2427493<thead>
    2428494<tr>
    2429 <th class="left"><label for="metakeyselect"><?php _e( 'Name' ); ?></label></th>
    2430 <th><label for="metavalue"><?php _e( 'Value' ); ?></label></th>
     495<th class="left"><label for="metakeyselect"><?php _e( 'Name' ) ?></label></th>
     496<th><label for="metavalue"><?php _e( 'Value' ) ?></label></th>
    2431497</tr>
    2432498</thead>
     
    2441507
    2442508        foreach ( $keys as $key ) {
    2443                 echo "\n<option value='" . esc_attr($key) . "'>" . esc_html($key) . '</option>';
     509                echo "\n<option value='" . esc_attr($key) . "'>" . esc_html($key) . "</option>";
    2444510        }
    2445511?>
     
    2457523
    2458524<tr><td colspan="2" class="submit">
    2459 <input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta" tabindex="9" value="<?php esc_attr_e( 'Add Custom Field' ); ?>" />
     525<input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta" tabindex="9" value="<?php esc_attr_e( 'Add Custom Field' ) ?>" />
    2460526<?php wp_nonce_field( 'add-meta', '_ajax_nonce-add-meta', false ); ?>
    2461527</td></tr>
     
    2587653                                $current = '';
    2588654
    2589                         echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . '</option>';
     655                        echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
    2590656                        parent_dropdown( $default, $item->ID, $level +1 );
    2591657                }
     
    2619685        <col class="widefat" />
    2620686        <tr>
    2621                 <th scope="row"><?php _e( 'URL' ); ?></th>
     687                <th scope="row"><?php _e( 'URL' ) ?></th>
    2622688                <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><?php echo wp_get_attachment_url(); ?></textarea></td>
    2623689        </tr>
     
    2625691        <tr>
    2626692                <th scope="row"><?php $thumb ? _e( 'Thumbnail linked to file' ) : _e( 'Image linked to file' ); ?></th>
    2627                 <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo wp_get_attachment_url(); ?>"><?php echo $icon; ?></a></textarea></td>
     693                <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo wp_get_attachment_url(); ?>"><?php echo $icon ?></a></textarea></td>
    2628694        </tr>
    2629695        <tr>
    2630696                <th scope="row"><?php $thumb ? _e( 'Thumbnail linked to page' ) : _e( 'Image linked to page' ); ?></th>
    2631                 <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link( $post->ID ); ?>" rel="attachment wp-att-<?php echo $post->ID; ?>"><?php echo $icon; ?></a></textarea></td>
     697                <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link( $post->ID ) ?>" rel="attachment wp-att-<?php echo $post->ID; ?>"><?php echo $icon ?></a></textarea></td>
    2632698        </tr>
    2633699<?php else : ?>
    2634700        <tr>
    2635                 <th scope="row"><?php _e( 'Link to file' ); ?></th>
     701                <th scope="row"><?php _e( 'Link to file' ) ?></th>
    2636702                <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo wp_get_attachment_url(); ?>" class="attachmentlink"><?php echo basename( wp_get_attachment_url() ); ?></a></textarea></td>
    2637703        </tr>
    2638704        <tr>
    2639                 <th scope="row"><?php _e( 'Link to page' ); ?></th>
    2640                 <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link( $post->ID ); ?>" rel="attachment wp-att-<?php echo $post->ID; ?>"><?php the_title(); ?></a></textarea></td>
     705                <th scope="row"><?php _e( 'Link to page' ) ?></th>
     706                <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link( $post->ID ) ?>" rel="attachment wp-att-<?php echo $post->ID ?>"><?php the_title(); ?></a></textarea></td>
    2641707        </tr>
    2642708<?php endif; ?>
     
    2777843
    2778844        foreach ( array_keys($wp_meta_boxes[$page]) as $a_context ) {
    2779                 foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
    2780                         if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
    2781                                 continue;
    2782        
    2783                         // If a core box was previously added or removed by a plugin, don't add.
    2784                         if ( 'core' == $priority ) {
    2785                                 // If core box previously deleted, don't add
    2786                                 if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
    2787                                         return;
    2788                                 // If box was added with default priority, give it core priority to maintain sort order
    2789                                 if ( 'default' == $a_priority ) {
    2790                                         $wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
    2791                                         unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
    2792                                 }
     845        foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
     846                if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
     847                        continue;
     848
     849                // If a core box was previously added or removed by a plugin, don't add.
     850                if ( 'core' == $priority ) {
     851                        // If core box previously deleted, don't add
     852                        if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
    2793853                                return;
     854                        // If box was added with default priority, give it core priority to maintain sort order
     855                        if ( 'default' == $a_priority ) {
     856                                $wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
     857                                unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
    2794858                        }
    2795                         // If no priority given and id already present, use existing priority
    2796                         if ( empty($priority) ) {
    2797                                 $priority = $a_priority;
    2798                         // else if we're adding to the sorted priortiy, we don't know the title or callback. Glab them from the previously added context/priority.
    2799                         } elseif ( 'sorted' == $priority ) {
    2800                                 $title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
    2801                                 $callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
    2802                                 $callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args'];
    2803                         }
    2804                         // An id can be in only one priority and one context
    2805                         if ( $priority != $a_priority || $context != $a_context )
    2806                                 unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
     859                        return;
    2807860                }
     861                // If no priority given and id already present, use existing priority
     862                if ( empty($priority) ) {
     863                        $priority = $a_priority;
     864                // else if we're adding to the sorted priortiy, we don't know the title or callback. Glab them from the previously added context/priority.
     865                } elseif ( 'sorted' == $priority ) {
     866                        $title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
     867                        $callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
     868                        $callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args'];
     869                }
     870                // An id can be in only one priority and one context
     871                if ( $priority != $a_priority || $context != $a_context )
     872                        unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
     873        }
    2808874        }
    2809875
     
    2869935        } while(0);
    2870936
    2871         echo '</div>';
     937        echo "</div>";
    2872938
    2873939        return $i;
     
    31501216 * @return array Array of settings errors
    31511217 */
    3152 function get_settings_errors( $setting = '', $sanitize = false ) {
     1218function get_settings_errors( $setting = '', $sanitize = FALSE ) {
    31531219        global $wp_settings_errors;
    31541220
     
    32011267 * @return <type>
    32021268 */
    3203 function settings_errors( $setting = '', $sanitize = false, $hide_on_update = false ) {
    3204 
    3205         if ( $hide_on_update && !empty($_GET['updated']) )
    3206                 return;
     1269function settings_errors ( $setting = '', $sanitize = FALSE, $hide_on_update = FALSE ) {
     1270
     1271        if ($hide_on_update AND $_GET['updated']) return;
    32071272
    32081273        $settings_errors = get_settings_errors( $setting, $sanitize );
    32091274
    3210         if ( !is_array($settings_errors) )
    3211                 return;
    3212 
     1275        if ( !is_array($settings_errors) ) return;
     1276
     1277        $output = '';
    32131278        foreach ( $settings_errors as $key => $details ) {
    32141279                $css_id = 'setting-error-' . $details['code'];
    32151280                $css_class = $details['type'] . ' settings-error';
    3216                 echo "<div id='$css_id' class='$css_class'>\n";
    3217                 echo "<p><strong>{$details['message']}</strong></p>";
    3218                 echo "</div>\n";
    3219         }
     1281                $output .= "<div id='$css_id' class='$css_class'> \n";
     1282                $output .= "<p><strong>{$details['message']}</strong></p>";
     1283                $output .= "</div> \n";
     1284        }
     1285        echo $output;
    32201286}
    32211287
     
    32281294 */
    32291295function manage_columns_prefs( $page ) {
    3230         $columns = get_column_headers( $page );
    3231         $hidden  = get_hidden_columns( $page );
     1296        global $table;
     1297
     1298        list( $columns, $hidden ) = $table->get_column_headers();
     1299
    32321300        $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username');
    32331301
    32341302        foreach ( $columns as $column => $title ) {
    3235                 // Can't hide these or they are special
     1303                // Can't hide these for they are special
    32361304                if ( in_array( $column, $special ) )
    32371305                        continue;
     
    32771345                                                continue;
    32781346                                ?>
    3279                                 <input type="radio" name="find-posts-what" id="find-posts-<?php echo esc_attr($post->name); ?>" value="<?php echo esc_attr($post->name); ?>" <?php checked($post->name, 'post'); ?> />
     1347                                <input type="radio" name="find-posts-what" id="find-posts-<?php echo esc_attr($post->name); ?>" value="<?php echo esc_attr($post->name); ?>" <?php checked($post->name,  'post'); ?> />
    32801348                                <label for="find-posts-<?php echo esc_attr($post->name); ?>"><?php echo $post->label; ?></label>
    32811349                                <?php
     
    33031371function the_post_password() {
    33041372        global $post;
    3305         if ( isset( $post->post_password ) )
    3306                 echo esc_attr( $post->post_password );
     1373        if ( isset( $post->post_password ) ) echo esc_attr( $post->post_password );
    33071374}
    33081375
     
    34081475        array_shift($allowed_actions);
    34091476
    3410         foreach ( $allowed_actions as $action => $label ) {
     1477        foreach ( $allowed_actions as $action => $label) {
    34111478                echo "<div class='favorite-action'><a href='$action'>";
    34121479                echo $label;
     
    34441511 */
    34451512function _admin_search_query() {
    3446         if ( isset($_GET['s']) )
    3447                 echo esc_attr( stripslashes( $_GET['s'] ) );
     1513        echo isset($_GET['s']) ? esc_attr( stripslashes( $_GET['s'] ) ) : '';
    34481514}
    34491515
     
    34571523 */
    34581524function iframe_header( $title = '', $limit_styles = false ) {
    3459         global $hook_suffix;
    3460 ?>
    3461 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     1525global $hook_suffix;
     1526?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    34621527<html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
    34631528<head>
    34641529<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
    3465 <title><?php bloginfo('name'); ?> &rsaquo; <?php echo $title; ?> &#8212; <?php _e('WordPress'); ?></title>
     1530<title><?php bloginfo('name') ?> &rsaquo; <?php echo $title ?> &#8212; <?php _e('WordPress'); ?></title>
    34661531<?php
    3467         wp_enqueue_style( 'global' );
    3468         if ( ! $limit_styles )
    3469                 wp_enqueue_style( 'wp-admin' );
    3470         wp_enqueue_style( 'colors' );
     1532wp_enqueue_style( 'global' );
     1533if ( ! $limit_styles )
     1534        wp_enqueue_style( 'wp-admin' );
     1535wp_enqueue_style( 'colors' );
    34711536?>
    34721537<script type="text/javascript">
     
    34771542</script>
    34781543<?php
    3479         do_action('admin_print_styles');
    3480         do_action('admin_print_scripts');
    3481         do_action('admin_head');
    3482        
    3483         $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
     1544do_action('admin_print_styles');
     1545do_action('admin_print_scripts');
     1546do_action('admin_head');
     1547
     1548$admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
    34841549?>
    34851550</head>
    3486 <body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="no-js <?php echo $admin_body_class; ?>">
     1551<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?>  class="no-js <?php echo $admin_body_class; ?>">
    34871552<script type="text/javascript">
    34881553//<![CDATA[
     
    35651630
    35661631function screen_meta($screen) {
    3567         global $wp_meta_boxes, $_wp_contextual_help, $title;
     1632        global $wp_meta_boxes, $_wp_contextual_help, $title, $table;
    35681633
    35691634        if ( is_string($screen) )
    35701635                $screen = convert_to_screen($screen);
    35711636
    3572         $column_screens = get_column_headers($screen);
     1637        if ( is_object($table) )
     1638                list( $screen_columns ) = $table->get_column_headers();
    35731639        $meta_screens = array('index' => 'dashboard');
    35741640
     
    35791645
    35801646        $show_screen = false;
    3581         if ( !empty($wp_meta_boxes[$screen->id]) || !empty($column_screens) )
     1647        if ( !empty($wp_meta_boxes[$screen->id]) || !empty($screen_columns) )
    35821648                $show_screen = true;
    35831649
     
    35971663                        break;
    35981664        }
    3599         if ( ! empty( $settings ) )
     1665        if( ! empty( $settings ) )
    36001666                $show_screen = true;
     1667
    36011668?>
    36021669<div id="screen-meta">
     
    36051672        <form id="adv-settings" action="" method="post">
    36061673        <?php if ( isset($wp_meta_boxes[$screen->id]) ) : ?>
    3607                 <h5><?php _ex('Show on screen', 'Metaboxes'); ?></h5>
     1674                <h5><?php _ex('Show on screen', 'Metaboxes') ?></h5>
    36081675                <div class="metabox-prefs">
    36091676                        <?php meta_box_prefs($screen); ?>
     
    36111678                </div>
    36121679                <?php endif;
    3613                 if ( ! empty($column_screens) ) : ?>
    3614                 <h5><?php echo ( isset( $column_screens['_title'] ) ? $column_screens['_title'] : _x('Show on screen', 'Columns') ); ?></h5>
     1680                if ( ! empty($screen_columns) ) : ?>
     1681                <h5><?php echo ( isset( $screen_columns['_title'] ) ?  $screen_columns['_title'] :  _x('Show on screen', 'Columns') ) ?></h5>
    36151682                <div class="metabox-prefs">
    36161683                        <?php manage_columns_prefs($screen); ?>
     
    36221689        if ( !empty( $screen_options ) ) {
    36231690                ?>
    3624                 <h5><?php _ex('Show on screen', 'Screen Options'); ?></h5>
     1691                <h5><?php _ex('Show on screen', 'Screen Options') ?></h5>
    36251692                <?php
    36261693        }
     
    36561723<div id="screen-meta-links">
    36571724<div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle">
    3658 <a href="#contextual-help" id="contextual-help-link" class="show-settings"><?php _e('Help'); ?></a>
     1725<a href="#contextual-help" id="contextual-help-link" class="show-settings"><?php _e('Help') ?></a>
    36591726</div>
    36601727<?php if ( $show_screen ) { ?>
    36611728<div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle">
    3662 <a href="#screen-options" id="show-settings-link" class="show-settings"><?php _e('Screen Options'); ?></a>
     1729<a href="#screen-options" id="show-settings-link" class="show-settings"><?php _e('Screen Options') ?></a>
    36631730</div>
    36641731<?php } ?>
     
    36731740 * @since 2.7.0
    36741741 *
    3675  * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
     1742 * @param string $screen The handle for the screen to add help to.  This is usually the hook name returned by the add_*_page() functions.
    36761743 * @param string $help Arbitrary help text
    36771744 */
     
    37281795
    37291796        if ( ! $screen_layout_columns )
    3730                 $screen_layout_columns = 2;
     1797                        $screen_layout_columns = 2;
    37311798
    37321799        $i = 1;
     
    37481815                case 'edit-pages':
    37491816                        $post_type = 'post';
    3750                         if ( isset($_GET['post_type']) && in_array( $_GET['post_type'], get_post_types( array('show_ui' => true ) ) ) )
     1817                        if ( isset($_GET['post_type']) && in_array( $_GET['post_type'], get_post_types( array('public' => true ) ) ) )
    37511818                                $post_type = $_GET['post_type'];
    37521819                        $post_type_object = get_post_type_object($post_type);
     
    37561823                        $per_page_label = _x( 'Sites', 'sites per page (screen options)' );
    37571824                        break;
     1825                case 'users':
    37581826                case 'ms-users':
    37591827                        $per_page_label = _x( 'Users', 'users per page (screen options)' );
     
    39051973 * @param string $id Screen id, optional.
    39061974 */
    3907 function set_current_screen( $id = '' ) {
     1975function set_current_screen( $id =  '' ) {
    39081976        global $current_screen, $hook_suffix, $typenow, $taxnow;
    39091977
     
    39632031}
    39642032
    3965 ?>
Note: See TracChangeset for help on using the changeset viewer.