- <label class="selectit">
- <input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" <?php echo $disabled ?>/>
- <?php echo esc_html( apply_filters( 'the_category', $term->name ) ); ?>
- </label>
- </li>
-
- <?php
- }
- return $popular_ids;
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $link_id
- */
-function wp_link_category_checklist( $link_id = 0 ) {
- $default = 1;
-
- if ( $link_id ) {
- $checked_categories = wp_get_link_cats( $link_id );
- // No selected categories, strange
- if ( ! count( $checked_categories ) )
- $checked_categories[] = $default;
- } else {
- $checked_categories[] = $default;
- }
-
- $categories = get_terms( 'link_category', array( 'orderby' => 'name', 'hide_empty' => 0 ) );
-
- if ( empty( $categories ) )
- return;
-
- foreach ( $categories as $category ) {
- $cat_id = $category->term_id;
- $name = esc_html( apply_filters( 'the_category', $category->name ) );
- $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
- 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>";
- }
-}
-
-// Tag stuff
-
-// Returns a single tag row (see tag_rows below)
-// Note: this is also used in admin-ajax.php!
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $tag
- * @param unknown_type $class
- * @return unknown
- */
-function _tag_row( $tag, $level, $taxonomy = 'post_tag' ) {
- global $post_type, $current_screen;
- static $row_class = '';
- $row_class = ($row_class == '' ? ' class="alternate"' : '');
-
- $count = number_format_i18n( $tag->count );
- $tax = get_taxonomy($taxonomy);
-
- if ( 'post_tag' == $taxonomy ) {
- $tagsel = 'tag';
- } elseif ( 'category' == $taxonomy ) {
- $tagsel = 'category_name';
- } elseif ( ! empty($tax->query_var) ) {
- $tagsel = $tax->query_var;
- } else {
- $tagsel = $taxonomy;
- }
-
- $pad = str_repeat( '— ', max(0, $level) );
- $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag );
- $qe_data = get_term($tag->term_id, $taxonomy, object, 'edit');
- $edit_link = "edit-tags.php?action=edit&taxonomy=$taxonomy&post_type=$post_type&tag_ID=$tag->term_id";
-
- $out = '';
- $out .= '<tr id="tag-' . $tag->term_id . '"' . $row_class . '>';
-
-
- $columns = get_column_headers($current_screen);
- $hidden = get_hidden_columns($current_screen);
- $default_term = get_option('default_' . $taxonomy);
- foreach ( $columns as $column_name => $column_display_name ) {
- $class = "class=\"$column_name column-$column_name\"";
-
- $style = '';
- if ( in_array($column_name, $hidden) )
- $style = ' style="display:none;"';
-
- $attributes = "$class$style";
-
- switch ($column_name) {
- case 'cb':
- if ( current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term )
- $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';
- else
- $out .= '<th scope="row" class="check-column"> </th>';
- break;
- case 'name':
- $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit “%s”'), $name)) . '">' . $name . '</a></strong><br />';
- $actions = array();
- if ( current_user_can($tax->cap->edit_terms) ) {
- $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
- $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>';
- }
- if ( current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term )
- $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url("edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "'>" . __('Delete') . "</a>";
-
- $actions = apply_filters('tag_row_actions', $actions, $tag);
- $actions = apply_filters("${taxonomy}_row_actions", $actions, $tag);
-
- $action_count = count($actions);
- $i = 0;
- $out .= '<div class="row-actions">';
- foreach ( $actions as $action => $link ) {
- ++$i;
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
- $out .= "<span class='$action'>$link$sep</span>";
- }
- $out .= '</div>';
- $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
- $out .= '<div class="name">' . $qe_data->name . '</div>';
- $out .= '<div class="slug">' . apply_filters('editable_slug', $qe_data->slug) . '</div>';
- $out .= '<div class="parent">' . $qe_data->parent . '</div></div></td>';
- break;
- case 'description':
- $out .= "<td $attributes>$tag->description</td>";
- break;
- case 'slug':
- $out .= "<td $attributes>" . apply_filters('editable_slug', $tag->slug) . "</td>";
- break;
- case 'posts':
- $attributes = 'class="posts column-posts num"' . $style;
- $out .= "<td $attributes><a href='edit.php?$tagsel=$tag->slug&post_type=$post_type'>$count</a></td>";
- break;
- default:
- $out .= "<td $attributes>";
- $out .= apply_filters("manage_${taxonomy}_custom_column", '', $column_name, $tag->term_id);
- $out .= "</td>";
- }
- }
-
- $out .= "</tr>\n";
-
- return $out;
-}
-
-// Outputs appropriate rows for the Nth page of the Tag Management screen,
-// assuming M tags displayed at a time on the page
-// Returns the number of tags displayed
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $page
- * @param unknown_type $pagesize
- * @param unknown_type $searchterms
- * @return unknown
- */
-function tag_rows( $page = 1, $pagesize = 20, $searchterms = '', $taxonomy = 'post_tag' ) {
-
- // Get a page worth of tags
- $start = ($page - 1) * $pagesize;
-
- $args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0);
-
- if ( !empty( $searchterms ) )
- $args['search'] = $searchterms;
-
- // convert it to table rows
- $out = '';
- $count = 0;
- if ( is_taxonomy_hierarchical($taxonomy) ) {
- // We'll need the full set of terms then.
- $args['number'] = $args['offset'] = 0;
-
- $terms = get_terms( $taxonomy, $args );
- if ( !empty( $searchterms ) ) // Ignore children on searches.
- $children = array();
- else
- $children = _get_term_hierarchy($taxonomy);
-
- // Some funky recursion to get the job done(Paging & parents mainly) is contained within, Skip it for non-hierarchical taxonomies for performance sake
- $out .= _term_rows($taxonomy, $terms, $children, $page, $pagesize, $count);
- } else {
- $terms = get_terms( $taxonomy, $args );
- foreach( $terms as $term )
- $out .= _tag_row( $term, 0, $taxonomy );
- $count = $pagesize; // Only displaying a single page.
- }
-
- echo $out;
- return $count;
-}
-
-function _term_rows( $taxonomy, $terms, &$children, $page = 1, $per_page = 20, &$count, $parent = 0, $level = 0 ) {
-
- $start = ($page - 1) * $per_page;
- $end = $start + $per_page;
-
- $output = '';
- foreach ( $terms as $key => $term ) {
-
- if ( $count >= $end )
- break;
-
- if ( $term->parent != $parent && empty($_GET['s']) )
- continue;
-
- // If the page starts in a subtree, print the parents.
- if ( $count == $start && $term->parent > 0 && empty($_GET['s']) ) {
- $my_parents = $parent_ids = array();
- $p = $term->parent;
- while ( $p ) {
- $my_parent = get_term( $p, $taxonomy );
- $my_parents[] = $my_parent;
- $p = $my_parent->parent;
- if ( in_array($p, $parent_ids) ) // Prevent parent loops.
- break;
- $parent_ids[] = $p;
- }
- unset($parent_ids);
-
- $num_parents = count($my_parents);
- while ( $my_parent = array_pop($my_parents) ) {
- $output .= "\t" . _tag_row( $my_parent, $level - $num_parents, $taxonomy );
- $num_parents--;
- }
- }
-
- if ( $count >= $start )
- $output .= "\t" . _tag_row( $term, $level, $taxonomy );
-
- ++$count;
-
- unset($terms[$key]);
-
- if ( isset($children[$term->term_id]) && empty($_GET['s']) )
- $output .= _term_rows( $taxonomy, $terms, $children, $page, $per_page, $count, $term->term_id, $level + 1 );
- }
-
- return $output;
-}
-
-// define the columns to display, the syntax is 'internal name' => 'display name'
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @return unknown
- */
-function wp_manage_posts_columns( $screen = '') {
- if ( empty($screen) )
- $post_type = 'post';
- else
- $post_type = $screen->post_type;
-
- $posts_columns = array();
- $posts_columns['cb'] = '<input type="checkbox" />';
- /* translators: manage posts column name */
- $posts_columns['title'] = _x('Title', 'column name');
- $posts_columns['author'] = __('Author');
- if ( empty($post_type) || is_object_in_taxonomy($post_type, 'category') )
- $posts_columns['categories'] = __('Categories');
- if ( empty($post_type) || is_object_in_taxonomy($post_type, 'post_tag') )
- $posts_columns['tags'] = __('Tags');
- $post_status = !empty($_REQUEST['post_status']) ? $_REQUEST['post_status'] : 'all';
- if ( !in_array( $post_status, array('pending', 'draft', 'future') ) && ( empty($post_type) || post_type_supports($post_type, 'comments') ) )
- $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="' . esc_url( admin_url( 'images/comment-grey-bubble.png' ) ) . '" /></div>';
- $posts_columns['date'] = __('Date');
-
- if ( 'page' == $post_type )
- $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns );
- else
- $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
- $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
-
- return $posts_columns;
-}
-
-// define the columns to display, the syntax is 'internal name' => 'display name'
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @return unknown
- */
-function wp_manage_media_columns() {
- $posts_columns = array();
- $posts_columns['cb'] = '<input type="checkbox" />';
- $posts_columns['icon'] = '';
- /* translators: column name */
- $posts_columns['media'] = _x('File', 'column name');
- $posts_columns['author'] = __('Author');
- //$posts_columns['tags'] = _x('Tags', 'column name');
- /* translators: column name */
- $posts_columns['parent'] = _x('Attached to', 'column name');
- $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="' . esc_url( admin_url( 'images/comment-grey-bubble.png' ) ) . '" /></div>';
- //$posts_columns['comments'] = __('Comments');
- /* translators: column name */
- $posts_columns['date'] = _x('Date', 'column name');
- $posts_columns = apply_filters('manage_media_columns', $posts_columns);
-
- return $posts_columns;
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @return unknown
- */
-function wp_manage_pages_columns() {
- return wp_manage_posts_columns();
-}
-
-/**
- * Get the column headers for a screen
- *
- * @since unknown
- *
- * @param string|object $screen The screen you want the headers for
- * @return array Containing the headers in the format id => UI String
- */
-function get_column_headers($screen) {
- global $_wp_column_headers;
-
- if ( !isset($_wp_column_headers) )
- $_wp_column_headers = array();
-
- if ( is_string($screen) )
- $screen = convert_to_screen($screen);
-
- // Store in static to avoid running filters on each call
- if ( isset($_wp_column_headers[$screen->id]) )
- return $_wp_column_headers[$screen->id];
-
- switch ($screen->base) {
- case 'edit':
- $_wp_column_headers[$screen->id] = wp_manage_posts_columns( $screen );
- break;
- case 'edit-comments':
- $_wp_column_headers[$screen->id] = array(
- 'cb' => '<input type="checkbox" />',
- 'author' => __('Author'),
- /* translators: column name */
- 'comment' => _x('Comment', 'column name'),
- //'date' => __('Submitted'),
- 'response' => __('In Response To')
- );
-
- break;
- case 'link-manager':
- $_wp_column_headers[$screen->id] = array(
- 'cb' => '<input type="checkbox" />',
- 'name' => __('Name'),
- 'url' => __('URL'),
- 'categories' => __('Categories'),
- 'rel' => __('Relationship'),
- 'visible' => __('Visible'),
- 'rating' => __('Rating')
- );
-
- break;
- case 'upload':
- $_wp_column_headers[$screen->id] = wp_manage_media_columns();
- break;
- case 'categories':
- $_wp_column_headers[$screen->id] = array(
- 'cb' => '<input type="checkbox" />',
- 'name' => __('Name'),
- 'description' => __('Description'),
- 'slug' => __('Slug'),
- 'posts' => __('Posts')
- );
-
- break;
- case 'edit-link-categories':
- $_wp_column_headers[$screen->id] = array(
- 'cb' => '<input type="checkbox" />',
- 'name' => __('Name'),
- 'description' => __('Description'),
- 'slug' => __('Slug'),
- 'links' => __('Links')
- );
-
- break;
- case 'edit-tags':
- $_wp_column_headers[$screen->id] = array(
- 'cb' => '<input type="checkbox" />',
- 'name' => __('Name'),
- 'description' => __('Description'),
- 'slug' => __('Slug'),
- 'posts' => __('Posts')
- );
-
- break;
- case 'users':
- $_wp_column_headers[$screen->id] = array(
- 'cb' => '<input type="checkbox" />',
- 'username' => __('Username'),
- 'name' => __('Name'),
- 'email' => __('E-mail'),
- 'role' => __('Role'),
- 'posts' => __('Posts')
- );
- break;
- default :
- $_wp_column_headers[$screen->id] = array();
- }
-
- $_wp_column_headers[$screen->id] = apply_filters('manage_' . $screen->id . '_columns', $_wp_column_headers[$screen->id]);
- return $_wp_column_headers[$screen->id];
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $screen
- * @param unknown_type $id
- */
-function print_column_headers( $screen, $id = true ) {
- if ( is_string($screen) )
- $screen = convert_to_screen($screen);
-
- $columns = get_column_headers( $screen );
- $hidden = get_hidden_columns($screen);
- $styles = array();
-
- foreach ( $columns as $column_key => $column_display_name ) {
- $class = ' class="manage-column';
-
- $class .= " column-$column_key";
-
- if ( 'cb' == $column_key )
- $class .= ' check-column';
- elseif ( in_array($column_key, array('posts', 'comments', 'links')) )
- $class .= ' num';
-
- $class .= '"';
-
- $style = '';
- if ( in_array($column_key, $hidden) )
- $style = 'display:none;';
-
- if ( isset($styles[$screen->id]) && isset($styles[$screen->id][$column_key]) )
- $style .= ' ' . $styles[$screen>id][$column_key];
- $style = ' style="' . $style . '"';
-?>
- <th scope="col" <?php echo $id ? "id=\"$column_key\"" : ""; echo $class; echo $style; ?>><?php echo $column_display_name; ?></th>
-<?php }
-}
-
-/**
- * Register column headers for a particular screen. The header names will be listed in the Screen Options.
- *
- * @since 2.7.0
- *
- * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
- * @param array $columns An array of columns with column IDs as the keys and translated column names as the values
- * @see get_column_headers(), print_column_headers(), get_hidden_columns()
- */
-function register_column_headers($screen, $columns) {
- global $_wp_column_headers;
-
- if ( is_string($screen) )
- $screen = convert_to_screen($screen);
-
- if ( !isset($_wp_column_headers) )
- $_wp_column_headers = array();
-
- $_wp_column_headers[$screen->id] = $columns;
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $screen
- */
-function get_hidden_columns($screen) {
- if ( is_string($screen) )
- $screen = convert_to_screen($screen);
-
- return (array) get_user_option( 'manage' . $screen->id. 'columnshidden' );
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * Outputs the quick edit and bulk edit table rows for posts and pages
- *
- * @since 2.7
- *
- * @param string $screen
- */
-function inline_edit_row( $screen ) {
- global $current_user, $mode;
-
- if ( is_string($screen) ) {
- $screen = array('id' => 'edit-' . $screen, 'base' => 'edit', 'post_type' => $screen );
- $screen = (object) $screen;
- }
-
- $post = get_default_post_to_edit( $screen->post_type );
- $post_type_object = get_post_type_object( $screen->post_type );
-
- $taxonomy_names = get_object_taxonomies( $screen->post_type );
- $hierarchical_taxonomies = array();
- $flat_taxonomies = array();
- foreach ( $taxonomy_names as $taxonomy_name ) {
- $taxonomy = get_taxonomy( $taxonomy_name);
-
- if ( !$taxonomy->show_ui )
- continue;
-
- if ( $taxonomy->hierarchical )
- $hierarchical_taxonomies[] = $taxonomy;
- else
- $flat_taxonomies[] = $taxonomy;
- }
-
- $columns = wp_manage_posts_columns($screen);
- $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($screen) ) );
- $col_count = count($columns) - count($hidden);
- $m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
- $can_publish = current_user_can($post_type_object->cap->publish_posts);
- $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );
-
-?>
-
-<form method="get" action=""><table style="display: none"><tbody id="inlineedit">
- <?php
- $hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page';
- $bulk = 0;
- while ( $bulk < 2 ) { ?>
-
- <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-$screen->post_type ";
- 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";
- ?>" style="display: none"><td colspan="<?php echo $col_count; ?>">
-
- <fieldset class="inline-edit-col-left"><div class="inline-edit-col">
- <h4><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></h4>
-
-
-<?php
-
-if ( post_type_supports( $screen->post_type, 'title' ) ) :
- if ( $bulk ) : ?>
- <div id="bulk-title-div">
- <div id="bulk-titles"></div>
- </div>
-
-<?php else : // $bulk ?>
-
- <label>
- <span class="title"><?php _e( 'Title' ); ?></span>
- <span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
- </label>
-
- <label>
- <span class="title"><?php _e( 'Slug' ); ?></span>
- <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
- </label>
-
-<?php endif; // $bulk
-endif; // post_type_supports title ?>
-
-<?php if ( !$bulk ) : ?>
- <label><span class="title"><?php _e( 'Date' ); ?></span></label>
- <div class="inline-edit-date">
- <?php touch_time(1, 1, 4, 1); ?>
- </div>
- <br class="clear" />
-
-<?php endif; // $bulk
-
- if ( post_type_supports( $screen->post_type, 'author' ) ) :
- $authors = get_editable_user_ids( $current_user->id, true, $screen->post_type ); // TODO: ROLE SYSTEM
- $authors_dropdown = '';
- if ( $authors && count( $authors ) > 1 ) :
- $users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1, 'echo' => 0);
- if ( $bulk )
- $users_opt['show_option_none'] = __('— No Change —');
- $authors_dropdown = '<label>';
- $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
- $authors_dropdown .= wp_dropdown_users( $users_opt );
- $authors_dropdown .= '</label>';
-
- endif; // authors
-?>
-
-<?php if ( !$bulk ) echo $authors_dropdown;
-endif; // post_type_supports author
-
-if ( !$bulk ) :
-?>
-
- <div class="inline-edit-group">
- <label class="alignleft">
- <span class="title"><?php _e( 'Password' ); ?></span>
- <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
- </label>
-
- <em style="margin:5px 10px 0 0" class="alignleft">
- <?php
- /* translators: Between password field and private checkbox on post quick edit interface */
- echo __( '–OR–' );
- ?>
- </em>
- <label class="alignleft inline-edit-private">
- <input type="checkbox" name="keep_private" value="private" />
- <span class="checkbox-title"><?php echo __('Private'); ?></span>
- </label>
- </div>
-
-<?php endif; ?>
-
- </div></fieldset>
-
-<?php if ( count($hierarchical_taxonomies) && !$bulk ) : ?>
-
- <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
-
-<?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
-
- <span class="title inline-edit-categories-label"><?php echo esc_html($taxonomy->labels->name) ?>
- <span class="catshow"><?php _e('[more]'); ?></span>
- <span class="cathide" style="display:none;"><?php _e('[less]'); ?></span>
- </span>
- <input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr($taxonomy->name) . '][]'; ?>" value="0" />
- <ul class="cat-checklist <?php echo esc_attr($taxonomy->name)?>-checklist">
- <?php wp_terms_checklist(null, array('taxonomy' => $taxonomy->name)) ?>
- </ul>
-
-<?php endforeach; //$hierarchical_taxonomies as $taxonomy ?>
-
- </div></fieldset>
-
-<?php endif; // count($hierarchical_taxonomies) && !$bulk ?>
-
- <fieldset class="inline-edit-col-right"><div class="inline-edit-col">
-
-<?php
- if ( post_type_supports( $screen->post_type, 'author' ) && $bulk )
- echo $authors_dropdown;
-?>
-
-<?php if ( $post_type_object->hierarchical ) : ?>
-
- <label>
- <span class="title"><?php _e( 'Parent' ); ?></span>
-<?php
- $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');
- if ( $bulk )
- $dropdown_args['show_option_no_change'] = __('— No Change —');
- $dropdown_args = apply_filters('quick_edit_dropdown_pages_args', $dropdown_args);
- wp_dropdown_pages($dropdown_args);
-?>
- </label>
-
-<?php if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) :
- if ( !$bulk ) : ?>
-
- <label>
- <span class="title"><?php _e( 'Order' ); ?></span>
- <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span>
- </label>
-
-<?php endif; // !$bulk ?>
-
- <label>
- <span class="title"><?php _e( 'Template' ); ?></span>
- <select name="page_template">
-<?php if ( $bulk ) : ?>
- <option value="-1"><?php _e('— No Change —'); ?></option>
-<?php endif; // $bulk ?>
- <option value="default"><?php _e( 'Default Template' ); ?></option>
- <?php page_template_dropdown() ?>
- </select>
- </label>
-
-<?php
- endif; // post_type_supports page-attributes
-endif; // $post_type_object->hierarchical ?>
-
-<?php if ( count($flat_taxonomies) && !$bulk ) : ?>
-
-<?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
-
- <label class="inline-edit-tags">
- <span class="title"><?php echo esc_html($taxonomy->labels->name) ?></span>
- <textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr($taxonomy->name)?>]" class="tax_input_<?php echo esc_attr($taxonomy->name)?>"></textarea>
- </label>
-
-<?php endforeach; //$flat_taxonomies as $taxonomy ?>
-
-<?php endif; // count($flat_taxonomies) && !$bulk ?>
-
-<?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) :
- if ( $bulk ) : ?>
-
- <div class="inline-edit-group">
- <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
- <label class="alignleft">
- <span class="title"><?php _e( 'Comments' ); ?></span>
- <select name="comment_status">
- <option value=""><?php _e('— No Change —'); ?></option>
- <option value="open"><?php _e('Allow'); ?></option>
- <option value="closed"><?php _e('Do not allow'); ?></option>
- </select>
- </label>
- <?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
- <label class="alignright">
- <span class="title"><?php _e( 'Pings' ); ?></span>
- <select name="ping_status">
- <option value=""><?php _e('— No Change —'); ?></option>
- <option value="open"><?php _e('Allow'); ?></option>
- <option value="closed"><?php _e('Do not allow'); ?></option>
- </select>
- </label>
- <?php endif; ?>
- </div>
-
-<?php else : // $bulk ?>
-
- <div class="inline-edit-group">
- <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
- <label class="alignleft">
- <input type="checkbox" name="comment_status" value="open" />
- <span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
- </label>
- <?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
- <label class="alignleft">
- <input type="checkbox" name="ping_status" value="open" />
- <span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
- </label>
- <?php endif; ?>
- </div>
-
-<?php endif; // $bulk
-endif; // post_type_supports comments or pings ?>
-
- <div class="inline-edit-group">
- <label class="inline-edit-status alignleft">
- <span class="title"><?php _e( 'Status' ); ?></span>
- <select name="_status">
-<?php if ( $bulk ) : ?>
- <option value="-1"><?php _e('— No Change —'); ?></option>
-<?php endif; // $bulk ?>
- <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>
- <option value="publish"><?php _e( 'Published' ); ?></option>
- <option value="future"><?php _e( 'Scheduled' ); ?></option>
-<?php if ( $bulk ) : ?>
- <option value="private"><?php _e('Private') ?></option>
-<?php endif; // $bulk ?>
- <?php endif; ?>
- <option value="pending"><?php _e( 'Pending Review' ); ?></option>
- <option value="draft"><?php _e( 'Draft' ); ?></option>
- </select>
- </label>
-
-<?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>
-
-<?php if ( $bulk ) : ?>
-
- <label class="alignright">
- <span class="title"><?php _e( 'Sticky' ); ?></span>
- <select name="sticky">
- <option value="-1"><?php _e( '— No Change —' ); ?></option>
- <option value="sticky"><?php _e( 'Sticky' ); ?></option>
- <option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>
- </select>
- </label>
-
-<?php else : // $bulk ?>
-
- <label class="alignleft">
- <input type="checkbox" name="sticky" value="sticky" />
- <span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>
- </label>
-
-<?php endif; // $bulk ?>
-
-<?php endif; // !$is_page && $can_publish && current_user_can( 'edit_others_cap' ) ?>
-
- </div>
-
- </div></fieldset>
-
-<?php
- foreach ( $columns as $column_name => $column_display_name ) {
- if ( isset( $core_columns[$column_name] ) )
- continue;
- do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type );
- }
-?>
- <p class="submit inline-edit-save">
- <a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="button-secondary cancel alignleft"><?php _e('Cancel'); ?></a>
- <?php if ( ! $bulk ) {
- wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
- $update_text = __( 'Update' );
- ?>
- <a accesskey="s" href="#inline-edit" title="<?php _e('Update'); ?>" class="button-primary save alignright"><?php echo esc_attr( $update_text ); ?></a>
- <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
- <?php } else {
- $update_text = __( 'Update' );
- ?>
- <input accesskey="s" class="button-primary alignright" type="submit" name="bulk_edit" value="<?php echo esc_attr( $update_text ); ?>" />
- <?php } ?>
- <input type="hidden" name="post_view" value="<?php echo esc_attr($m); ?>" />
- <input type="hidden" name="screen" value="<?php echo esc_attr($screen->id); ?>" />
- <br class="clear" />
- </p>
- </td></tr>
-<?php
- $bulk++;
- } ?>
- </tbody></table></form>
-<?php
-}
-
-// adds hidden fields with the data for use in the inline editor for posts and pages
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $post
- */
-function get_inline_data($post) {
- $post_type_object = get_post_type_object($post->post_type);
- if ( ! current_user_can($post_type_object->cap->edit_post, $post->ID) )
- return;
-
- $title = esc_attr( get_the_title( $post->ID ) );
-
- echo '
-<div class="hidden" id="inline_' . $post->ID . '">
- <div class="post_title">' . $title . '</div>
- <div class="post_name">' . apply_filters('editable_slug', $post->post_name) . '</div>
- <div class="post_author">' . $post->post_author . '</div>
- <div class="comment_status">' . $post->comment_status . '</div>
- <div class="ping_status">' . $post->ping_status . '</div>
- <div class="_status">' . $post->post_status . '</div>
- <div class="jj">' . mysql2date( 'd', $post->post_date, false ) . '</div>
- <div class="mm">' . mysql2date( 'm', $post->post_date, false ) . '</div>
- <div class="aa">' . mysql2date( 'Y', $post->post_date, false ) . '</div>
- <div class="hh">' . mysql2date( 'H', $post->post_date, false ) . '</div>
- <div class="mn">' . mysql2date( 'i', $post->post_date, false ) . '</div>
- <div class="ss">' . mysql2date( 's', $post->post_date, false ) . '</div>
- <div class="post_password">' . esc_html( $post->post_password ) . '</div>';
-
- if ( $post_type_object->hierarchical )
- echo '<div class="post_parent">' . $post->post_parent . '</div>';
-
- if ( $post->post_type == 'page' )
- echo '<div class="page_template">' . esc_html( get_post_meta( $post->ID, '_wp_page_template', true ) ) . '</div>';
-
- if ( $post_type_object->hierarchical )
- echo '<div class="menu_order">' . $post->menu_order . '</div>';
-
- $taxonomy_names = get_object_taxonomies( $post->post_type );
- foreach ( $taxonomy_names as $taxonomy_name) {
- $taxonomy = get_taxonomy( $taxonomy_name );
-
- if ( $taxonomy->hierarchical && $taxonomy->show_ui )
- echo '<div class="post_category" id="'.$taxonomy_name.'_'.$post->ID.'">' . implode( ',', wp_get_object_terms( $post->ID, $taxonomy_name, array('fields'=>'ids')) ) . '</div>';
- elseif ( $taxonomy->show_ui )
- echo '<div class="tags_input" id="'.$taxonomy_name.'_'.$post->ID.'">' . esc_html( str_replace( ',', ', ', get_terms_to_edit($post->ID, $taxonomy_name) ) ) . '</div>';
- }
-
- if ( !$post_type_object->hierarchical )
- echo '<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
-
- echo '</div>';
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $posts
- */
-function post_rows( $posts = array() ) {
- global $wp_query, $post, $mode;
-
- add_filter('the_title','esc_html');
-
- // Create array of post IDs.
- $post_ids = array();
-
- if ( empty($posts) )
- $posts = &$wp_query->posts;
-
- foreach ( $posts as $a_post )
- $post_ids[] = $a_post->ID;
-
- $comment_pending_count = get_pending_comments_num($post_ids);
-
- foreach ( $posts as $post ) {
- if ( empty($comment_pending_count[$post->ID]) )
- $comment_pending_count[$post->ID] = 0;
-
- _post_row($post, $comment_pending_count[$post->ID], $mode);
- }
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $a_post
- * @param unknown_type $pending_comments
- * @param unknown_type $mode
- */
-function _post_row($a_post, $pending_comments, $mode) {
- global $post, $current_user, $current_screen;
- static $rowclass;
-
- $global_post = $post;
- $post = $a_post;
- setup_postdata($post);
-
- $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
- $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
- $edit_link = get_edit_post_link( $post->ID );
- $title = _draft_or_post_title();
- $post_type_object = get_post_type_object($post->post_type);
-?>
- <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status ); ?> iedit' valign="top">
-<?php
- $posts_columns = get_column_headers( $current_screen );
- $hidden = get_hidden_columns( $current_screen );
- foreach ( $posts_columns as $column_name=>$column_display_name ) {
- $class = "class=\"$column_name column-$column_name\"";
-
- $style = '';
- if ( in_array($column_name, $hidden) )
- $style = ' style="display:none;"';
-
- $attributes = "$class$style";
-
- switch ($column_name) {
-
- case 'cb':
- ?>
- <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>
- <?php
- break;
-
- case 'date':
- if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
- $t_time = $h_time = __('Unpublished');
- $time_diff = 0;
- } else {
- $t_time = get_the_time(__('Y/m/d g:i:s A'));
- $m_time = $post->post_date;
- $time = get_post_time('G', true, $post);
-
- $time_diff = time() - $time;
-
- if ( $time_diff > 0 && $time_diff < 24*60*60 )
- $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
- else
- $h_time = mysql2date(__('Y/m/d'), $m_time);
- }
-
- echo '<td ' . $attributes . '>';
- if ( 'excerpt' == $mode )
- echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode);
- else
- echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>';
- echo '<br />';
- if ( 'publish' == $post->post_status ) {
- _e('Published');
- } elseif ( 'future' == $post->post_status ) {
- if ( $time_diff > 0 )
- echo '<strong class="attention">' . __('Missed schedule') . '</strong>';
- else
- _e('Scheduled');
- } else {
- _e('Last Modified');
- }
- echo '</td>';
- break;
-
- case 'title':
- $attributes = 'class="post-title column-title"' . $style;
- ?>
- <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 “%s”'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong>
- <?php
- if ( 'excerpt' == $mode )
- the_excerpt();
-
- $actions = array();
- if ( current_user_can($post_type_object->cap->edit_post, $post->ID) && 'trash' != $post->post_status ) {
- $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this item')) . '">' . __('Edit') . '</a>';
- $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this item inline')) . '">' . __('Quick Edit') . '</a>';
- }
- if ( current_user_can($post_type_object->cap->delete_post, $post->ID) ) {
- if ( 'trash' == $post->post_status )
- $actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash')) . "' href='" . wp_nonce_url( admin_url( sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __('Restore') . "</a>";
- elseif ( EMPTY_TRASH_DAYS )
- $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>";
- if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
- $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently')) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently') . "</a>";
- }
- if ( in_array($post->post_status, array('pending', 'draft')) ) {
- if ( current_user_can($post_type_object->cap->edit_post, $post->ID) )
- $actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink($post->ID) ) ) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
- } elseif ( 'trash' != $post->post_status ) {
- $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>';
- }
- $actions = apply_filters('post_row_actions', $actions, $post);
- $action_count = count($actions);
- $i = 0;
- echo '<div class="row-actions">';
- foreach ( $actions as $action => $link ) {
- ++$i;
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
- echo "<span class='$action'>$link$sep</span>";
- }
- echo '</div>';
-
- get_inline_data($post);
- ?>
- </td>
- <?php
- break;
-
- case 'categories':
- ?>
- <td <?php echo $attributes ?>><?php
- $categories = get_the_category();
- if ( !empty( $categories ) ) {
- $out = array();
- foreach ( $categories as $c )
- $out[] = "<a href='edit.php?category_name=$c->slug'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . "</a>";
- echo join( ', ', $out );
- } else {
- _e('Uncategorized');
- }
- ?></td>
- <?php
- break;
-
- case 'tags':
- ?>
- <td <?php echo $attributes ?>><?php
- $tags = get_the_tags($post->ID);
- if ( !empty( $tags ) ) {
- $out = array();
- foreach ( $tags as $c )
- $out[] = "<a href='edit.php?tag=$c->slug'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
- echo join( ', ', $out );
- } else {
- _e('No Tags');
- }
- ?></td>
- <?php
- break;
-
- case 'comments':
- ?>
- <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
- <?php
- $pending_phrase = sprintf( __('%s pending'), number_format( $pending_comments ) );
- if ( $pending_comments )
- echo '<strong>';
- 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>');
- if ( $pending_comments )
- echo '</strong>';
- ?>
- </div></td>
- <?php
- break;
-
- case 'author':
- ?>
- <td <?php echo $attributes ?>><a href="edit.php?post_type=<?php echo $post->post_type; ?>&author=<?php the_author_meta('ID'); ?>"><?php the_author() ?></a></td>
- <?php
- break;
-
- case 'control_view':
- ?>
- <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></td>
- <?php
- break;
-
- case 'control_edit':
- ?>
- <td><?php if ( current_user_can($post_type_object->cap->edit_post, $post->ID) ) { echo "<a href='$edit_link' class='edit'>" . __('Edit') . "</a>"; } ?></td>
- <?php
- break;
-
- case 'control_delete':
- ?>
- <td><?php if ( current_user_can($post_type_object->cap->delete_post, $post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>"; } ?></td>
- <?php
- break;
-
- default:
- ?>
- <td <?php echo $attributes ?>><?php do_action('manage_posts_custom_column', $column_name, $post->ID); ?></td>
- <?php
- break;
- }
-}
-?>
- </tr>
-<?php
- $post = $global_post;
-}
-
-/*
- * display one row if the page doesn't have any children
- * otherwise, display the row and its children in subsequent rows
- */
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $page
- * @param unknown_type $level
- */
-function display_page_row( $page, $level = 0 ) {
- global $post, $current_screen;
- static $rowclass;
-
- $post = $page;
- setup_postdata($page);
-
- if ( 0 == $level && (int)$page->post_parent > 0 ) {
- //sent level 0 by accident, by default, or because we don't know the actual level
- $find_main_page = (int)$page->post_parent;
- while ( $find_main_page > 0 ) {
- $parent = get_page($find_main_page);
-
- if ( is_null($parent) )
- break;
-
- $level++;
- $find_main_page = (int)$parent->post_parent;
-
- if ( !isset($parent_name) )
- $parent_name = $parent->post_title;
- }
- }
-
- $page->post_title = esc_html( $page->post_title );
- $pad = str_repeat( '— ', $level );
- $id = (int) $page->ID;
- $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
- $posts_columns = get_column_headers( $current_screen );
- $hidden = get_hidden_columns( $current_screen );
- $title = _draft_or_post_title();
- $post_type = $page->post_type;
- $post_type_object = get_post_type_object($post_type);
-?>
-<tr id="page-<?php echo $id; ?>" class="<?php echo $rowclass; ?> iedit">
-<?php
-
-foreach ( $posts_columns as $column_name => $column_display_name ) {
- $class = "class=\"$column_name column-$column_name\"";
-
- $style = '';
- if ( in_array($column_name, $hidden) )
- $style = ' style="display:none;"';
-
- $attributes = "$class$style";
-
- switch ($column_name) {
-
- case 'cb':
- ?>
- <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>
- <?php
- break;
- case 'date':
- if ( '0000-00-00 00:00:00' == $page->post_date && 'date' == $column_name ) {
- $t_time = $h_time = __('Unpublished');
- $time_diff = 0;
- } else {
- $t_time = get_the_time(__('Y/m/d g:i:s A'));
- $m_time = $page->post_date;
- $time = get_post_time('G', true);
-
- $time_diff = time() - $time;
-
- if ( $time_diff > 0 && $time_diff < 24*60*60 )
- $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
- else
- $h_time = mysql2date(__('Y/m/d'), $m_time);
- }
- echo '<td ' . $attributes . '>';
- echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $page, $column_name, '') . '</abbr>';
- echo '<br />';
- if ( 'publish' == $page->post_status ) {
- _e('Published');
- } elseif ( 'future' == $page->post_status ) {
- if ( $time_diff > 0 )
- echo '<strong class="attention">' . __('Missed schedule') . '</strong>';
- else
- _e('Scheduled');
- } else {
- _e('Last Modified');
- }
- echo '</td>';
- break;
- case 'title':
- $attributes = 'class="post-title page-title column-title"' . $style;
- $edit_link = get_edit_post_link( $page->ID );
- ?>
- <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 “%s”'), $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>
- <?php
- $actions = array();
- if ( current_user_can($post_type_object->cap->edit_post, $page->ID) && $post->post_status != 'trash' ) {
- $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>';
- $actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>';
- }
- if ( current_user_can($post_type_object->cap->delete_post, $page->ID) ) {
- if ( $post->post_status == 'trash' )
- $actions['untrash'] = "<a title='" . esc_attr(__('Remove this page from the Trash')) . "' href='" . wp_nonce_url("post.php?post_type=$post_type&action=untrash&post=$page->ID", 'untrash-' . $post->post_type . '_' . $page->ID) . "'>" . __('Restore') . "</a>";
- elseif ( EMPTY_TRASH_DAYS )
- $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this page to the Trash')) . "' href='" . get_delete_post_link($page->ID) . "'>" . __('Trash') . "</a>";
- if ( $post->post_status == 'trash' || !EMPTY_TRASH_DAYS )
- $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("post.php?post_type=$post_type&action=delete&post=$page->ID", 'delete-' . $post->post_type . '_' . $page->ID) . "'>" . __('Delete Permanently') . "</a>";
- }
- if ( in_array($post->post_status, array('pending', 'draft')) ) {
- if ( current_user_can($post_type_object->cap->edit_post, $page->ID) )
- $actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink($page->ID) ) ) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
- } elseif ( $post->post_status != 'trash' ) {
- $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>';
- }
- $actions = apply_filters('page_row_actions', $actions, $page);
- $action_count = count($actions);
-
- $i = 0;
- echo '<div class="row-actions">';
- foreach ( $actions as $action => $link ) {
- ++$i;
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
- echo "<span class='$action'>$link$sep</span>";
- }
- echo '</div>';
-
- get_inline_data($post);
- echo '</td>';
- break;
-
- case 'comments':
- ?>
- <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
- <?php
- $left = get_pending_comments_num( $page->ID );
- $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
- if ( $left )
- echo '<strong>';
- 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>');
- if ( $left )
- echo '</strong>';
- ?>
- </div></td>
- <?php
- break;
-
- case 'author':
- ?>
- <td <?php echo $attributes ?>><a href="edit.php?post_type=<?php echo $post_type; ?>&author=<?php the_author_meta('ID'); ?>"><?php the_author() ?></a></td>
- <?php
- break;
-
- default:
- ?>
- <td <?php echo $attributes ?>><?php do_action('manage_pages_custom_column', $column_name, $id); ?></td>
- <?php
- break;
- }
-}
-?>
-
-</tr>
-
-<?php
-}
-
-/*
- * displays pages in hierarchical order with paging support
- */
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $pages
- * @param unknown_type $pagenum
- * @param unknown_type $per_page
- * @return unknown
- */
-function page_rows($pages, $pagenum = 1, $per_page = 20) {
- global $wpdb;
-
- $level = 0;
-
- if ( ! $pages ) {
- $pages = get_pages( array('sort_column' => 'menu_order') );
-
- if ( ! $pages )
- return false;
- }
-
- /*
- * arrange pages into two parts: top level pages and children_pages
- * children_pages is two dimensional array, eg.
- * children_pages[10][] contains all sub-pages whose parent is 10.
- * It only takes O(N) to arrange this and it takes O(1) for subsequent lookup operations
- * If searching, ignore hierarchy and treat everything as top level
- */
- if ( empty($_GET['s']) ) {
-
- $top_level_pages = array();
- $children_pages = array();
-
- foreach ( $pages as $page ) {
-
- // catch and repair bad pages
- if ( $page->post_parent == $page->ID ) {
- $page->post_parent = 0;
- $wpdb->update($wpdb->posts, array('post_parent' => 0), array('ID' => $page->ID));
- clean_page_cache( $page->ID );
- }
-
- if ( 0 == $page->post_parent )
- $top_level_pages[] = $page;
- else
- $children_pages[ $page->post_parent ][] = $page;
- }
-
- $pages = &$top_level_pages;
- }
-
- $count = 0;
- $start = ($pagenum - 1) * $per_page;
- $end = $start + $per_page;
-
- foreach ( $pages as $page ) {
- if ( $count >= $end )
- break;
-
- if ( $count >= $start )
- echo "\t" . display_page_row( $page, $level );
-
- $count++;
-
- if ( isset($children_pages) )
- _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
- }
-
- // if it is the last pagenum and there are orphaned pages, display them with paging as well
- if ( isset($children_pages) && $count < $end ){
- foreach( $children_pages as $orphans ){
- foreach ( $orphans as $op ) {
- if ( $count >= $end )
- break;
- if ( $count >= $start )
- echo "\t" . display_page_row( $op, 0 );
- $count++;
- }
- }
- }
-}
-
-/**
- * Given a top level page ID, display the nested hierarchy of sub-pages
- * together with paging support
- *
- * @since unknown
- *
- * @param unknown_type $children_pages
- * @param unknown_type $count
- * @param unknown_type $parent
- * @param unknown_type $level
- * @param unknown_type $pagenum
- * @param unknown_type $per_page
- */
-function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
-
- if ( ! isset( $children_pages[$parent] ) )
- return;
-
- $start = ($pagenum - 1) * $per_page;
- $end = $start + $per_page;
-
- foreach ( $children_pages[$parent] as $page ) {
-
- if ( $count >= $end )
- break;
-
- // If the page starts in a subtree, print the parents.
- if ( $count == $start && $page->post_parent > 0 ) {
- $my_parents = array();
- $my_parent = $page->post_parent;
- while ( $my_parent) {
- $my_parent = get_post($my_parent);
- $my_parents[] = $my_parent;
- if ( !$my_parent->post_parent )
- break;
- $my_parent = $my_parent->post_parent;
- }
- $num_parents = count($my_parents);
- while( $my_parent = array_pop($my_parents) ) {
- echo "\t" . display_page_row( $my_parent, $level - $num_parents );
- $num_parents--;
- }
- }
-
- if ( $count >= $start )
- echo "\t" . display_page_row( $page, $level );
-
- $count++;
-
- _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
- }
-
- unset( $children_pages[$parent] ); //required in order to keep track of orphans
-}
-
-/**
- * Generate HTML for a single row on the users.php admin panel.
- *
- * @since 2.1.0
- *
- * @param object $user_object
- * @param string $style Optional. Attributes added to the TR element. Must be sanitized.
- * @param string $role Key for the $wp_roles array.
- * @param int $numposts Optional. Post count to display for this user. Defaults to zero, as in, a new user has made zero posts.
- * @return string
- */
-function user_row( $user_object, $style = '', $role = '', $numposts = 0 ) {
- global $wp_roles;
-
- $current_user = wp_get_current_user();
-
- if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) )
- $user_object = new WP_User( (int) $user_object );
- $user_object = sanitize_user_object($user_object, 'display');
- $email = $user_object->user_email;
- $url = $user_object->user_url;
- $short_url = str_replace( 'http://', '', $url );
- $short_url = str_replace( 'www.', '', $short_url );
- if ('/' == substr( $short_url, -1 ))
- $short_url = substr( $short_url, 0, -1 );
- if ( strlen( $short_url ) > 35 )
- $short_url = substr( $short_url, 0, 32 ).'...';
- $checkbox = '';
- // Check if the user for this row is editable
- if ( current_user_can( 'list_users' ) ) {
- // Set up the user editing link
- // TODO: make profile/user-edit determination a separate function
- if ($current_user->ID == $user_object->ID) {
- $edit_link = 'profile.php';
- } else {
- $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" ) );
- }
- $edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
-
- // Set up the hover actions for this user
- $actions = array();
-
- if ( current_user_can('edit_user', $user_object->ID) ) {
- $edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
- $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
- } else {
- $edit = "<strong>$user_object->user_login</strong><br />";
- }
-
- if ( !is_multisite() && $current_user->ID != $user_object->ID && current_user_can('delete_user', $user_object->ID) )
- $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&user=$user_object->ID", 'bulk-users') . "'>" . __('Delete') . "</a>";
- if ( is_multisite() && $current_user->ID != $user_object->ID && current_user_can('remove_user', $user_object->ID) )
- $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=remove&user=$user_object->ID", 'bulk-users') . "'>" . __('Remove') . "</a>";
- $actions = apply_filters('user_row_actions', $actions, $user_object);
- $action_count = count($actions);
- $i = 0;
- $edit .= '<div class="row-actions">';
- foreach ( $actions as $action => $link ) {
- ++$i;
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
- $edit .= "<span class='$action'>$link$sep</span>";
- }
- $edit .= '</div>';
-
- // Set up the checkbox (because the user is editable, otherwise its empty)
- $checkbox = "<input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' />";