Merge crazyhorse management pages. see #7552
git-svn-id: http://svn.automattic.com/wordpress/trunk@8682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
18459850ef
commit
56fe88e88f
|
@ -10,11 +10,10 @@
|
|||
require_once('admin.php');
|
||||
|
||||
$title = __('Categories');
|
||||
$parent_file = 'edit.php';
|
||||
|
||||
wp_reset_vars(array('action', 'cat'));
|
||||
|
||||
if ( isset($_GET['deleteit']) && isset($_GET['delete']) )
|
||||
if ( $_GET['action'] == 'delete' && isset($_GET['delete']) )
|
||||
$action = 'bulk-delete';
|
||||
|
||||
switch($action) {
|
||||
|
@ -127,11 +126,7 @@ endif; ?>
|
|||
|
||||
<div class="wrap">
|
||||
<form id="posts-filter" action="" method="get">
|
||||
<?php if ( current_user_can('manage_categories') ) : ?>
|
||||
<h2><?php printf(__('Manage Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2>
|
||||
<?php else : ?>
|
||||
<h2><?php _e('Manage Categories') ?> </h2>
|
||||
<?php endif; ?>
|
||||
<h2><?php printf( current_user_can('manage_categories') ? __('Categories (<a href="%s">Add New</a>)') : __('Manage Tags'), '#addcat' ); ?></h2>
|
||||
|
||||
<p id="post-search">
|
||||
<label class="hidden" for="post-search-input"><?php _e('Search Categories'); ?>:</label>
|
||||
|
@ -162,7 +157,11 @@ if ( $page_links )
|
|||
?>
|
||||
|
||||
<div class="alignleft">
|
||||
<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
|
||||
<select name="action">
|
||||
<option value="" selected><?php _e('Actions'); ?></option>
|
||||
<option value="delete"><?php _e('Delete'); ?></option>
|
||||
</select>
|
||||
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
||||
<?php wp_nonce_field('bulk-categories'); ?>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -50,13 +50,22 @@ foreach($posts_columns as $column_name=>$column_display_name) {
|
|||
|
||||
case 'cb':
|
||||
?>
|
||||
<th scope="row" class="check-column"><input type="checkbox" name="delete[]" value="<?php the_ID(); ?>" /></th>
|
||||
<th scope="row" class="check-column"><input type="checkbox" name="media[]" value="<?php the_ID(); ?>" /></th>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'icon':
|
||||
?>
|
||||
<td class="media-icon"><?php echo wp_get_attachment_link($post->ID, array(80, 60), false, true); ?></td>
|
||||
<td class="media-icon"><?php
|
||||
if ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) {
|
||||
?>
|
||||
|
||||
<a href="media.php?action=edit&attachment_id=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>">
|
||||
<?php echo $thumb; ?>
|
||||
</a>
|
||||
|
||||
<?php }
|
||||
?></td>
|
||||
<?php
|
||||
// TODO
|
||||
break;
|
||||
|
@ -65,11 +74,32 @@ foreach($posts_columns as $column_name=>$column_display_name) {
|
|||
?>
|
||||
<td><strong><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
|
||||
<?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
|
||||
<p>
|
||||
<a href="media.php?action=edit&attachment_id=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php _e('Edit'); ?></a> |
|
||||
<a href="<?php the_permalink(); ?>"><?php _e('Get permalink'); ?></a> |
|
||||
<a href="#" class="delete"><?php _e('Delete'); ?></a>
|
||||
</p>
|
||||
<?php do_action('manage_media_media_column', $post->ID); ?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'tags':
|
||||
?>
|
||||
<td><?php
|
||||
$tags = get_the_tags();
|
||||
if ( !empty( $tags ) ) {
|
||||
$out = array();
|
||||
foreach ( $tags as $c )
|
||||
$out[] = "<a href='edit.php?tag=$c->slug'> " . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
|
||||
echo join( ', ', $out );
|
||||
} else {
|
||||
_e('No Tags');
|
||||
}
|
||||
?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'desc':
|
||||
?>
|
||||
<td><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td>
|
||||
|
@ -106,7 +136,7 @@ foreach($posts_columns as $column_name=>$column_display_name) {
|
|||
$title = $parent_title;
|
||||
}
|
||||
?>
|
||||
<td><strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>"><?php echo $title ?></a></strong></td>
|
||||
<td><strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>"><?php echo $title ?></a></strong>, <?php echo get_the_time(__('Y/m/d')); ?></td>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
@ -132,9 +162,12 @@ foreach($posts_columns as $column_name=>$column_display_name) {
|
|||
<?php
|
||||
break;
|
||||
|
||||
case 'location':
|
||||
case 'actions':
|
||||
?>
|
||||
<td><a href="<?php the_permalink(); ?>"><?php _e('Permalink'); ?></a></td>
|
||||
<td>
|
||||
<a href="media.php?action=edit&attachment_id=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php _e('Edit'); ?></a> |
|
||||
<a href="<?php the_permalink(); ?>"><?php _e('Get permalink'); ?></a>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
|
|
|
@ -10,11 +10,10 @@
|
|||
require_once('admin.php');
|
||||
|
||||
$title = __('Edit Comments');
|
||||
$parent_file = 'edit-comments.php';
|
||||
wp_enqueue_script( 'admin-comments' );
|
||||
wp_enqueue_script('admin-forms');
|
||||
|
||||
if ( !empty( $_REQUEST['delete_comments'] ) ) {
|
||||
if ( !empty( $_REQUEST['delete_comments'] ) && isset($_REQUEST['action']) ) {
|
||||
check_admin_referer('bulk-comments');
|
||||
|
||||
$comments_deleted = $comments_approved = $comments_unapproved = $comments_spammed = 0;
|
||||
|
@ -23,16 +22,16 @@ if ( !empty( $_REQUEST['delete_comments'] ) ) {
|
|||
$post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment) );
|
||||
if ( !current_user_can('edit_post', $post_id) )
|
||||
continue;
|
||||
if ( !empty( $_REQUEST['spamit'] ) ) {
|
||||
if ( $_REQUEST['action'] == 'markspam' ) {
|
||||
wp_set_comment_status($comment, 'spam');
|
||||
$comments_spammed++;
|
||||
} elseif ( !empty( $_REQUEST['deleteit'] ) ) {
|
||||
} elseif ( $_REQUEST['action'] == 'delete' ) {
|
||||
wp_set_comment_status($comment, 'delete');
|
||||
$comments_deleted++;
|
||||
} elseif ( !empty( $_REQUEST['approveit'] ) ) {
|
||||
} elseif ( $_REQUEST['action'] == 'approve' ) {
|
||||
wp_set_comment_status($comment, 'approve');
|
||||
$comments_approved++;
|
||||
} elseif ( !empty( $_REQUEST['unapproveit'] ) ) {
|
||||
} elseif ( $_REQUEST['action'] == 'unapprove' ) {
|
||||
wp_set_comment_status($comment, 'hold');
|
||||
$comments_unapproved++;
|
||||
}
|
||||
|
@ -106,7 +105,11 @@ if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['sp
|
|||
<?php
|
||||
$status_links = array();
|
||||
$num_comments = wp_count_comments();
|
||||
$stati = array('moderated' => sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"), 'approved' => _c('Approved|plural'));
|
||||
$stati = array(
|
||||
'moderated' => sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
|
||||
'approved' => _c('Approved|plural'),
|
||||
'spam' => sprintf(__ngettext('Spam (%s)', 'Spam (%s)', number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
|
||||
);
|
||||
$class = ( '' === $comment_status ) ? ' class="current"' : '';
|
||||
$status_links[] = "<li><a href=\"edit-comments.php\"$class>".__('Show All Comments')."</a>";
|
||||
foreach ( $stati as $status => $label ) {
|
||||
|
@ -115,7 +118,8 @@ foreach ( $stati as $status => $label ) {
|
|||
if ( $status == $comment_status )
|
||||
$class = ' class="current"';
|
||||
|
||||
$status_links[] = "<li><a href=\"edit-comments.php?comment_status=$status\"$class>" . $label . '</a>';
|
||||
|
||||
$status_links[] = "<li class='$status'><a href=\"edit-comments.php?comment_status=$status\"$class>$label</a>";
|
||||
}
|
||||
|
||||
$status_links = apply_filters( 'comment_status_links', $status_links );
|
||||
|
@ -135,10 +139,12 @@ unset($status_links);
|
|||
<input type="hidden" name="comment_status" value="<?php echo $comment_status; ?>" />
|
||||
</form>
|
||||
|
||||
<!-- crazyhorse
|
||||
<ul class="view-switch">
|
||||
<li <?php if ( 'detail' == $mode ) echo "class='current'" ?>><a href="<?php echo clean_url(add_query_arg('mode', 'detail', $_SERVER['REQUEST_URI'])) ?>"><?php _e('Detail View') ?></a></li>
|
||||
<li <?php if ( 'list' == $mode ) echo "class='current'" ?>><a href="<?php echo clean_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>"><?php _e('List View') ?></a></li>
|
||||
</ul>
|
||||
-->
|
||||
|
||||
<?php
|
||||
|
||||
|
@ -175,16 +181,21 @@ if ( $page_links )
|
|||
?>
|
||||
|
||||
<div class="alignleft">
|
||||
<?php if ( 'approved' != $comment_status ): ?>
|
||||
<input type="submit" value="<?php _e('Approve'); ?>" name="approveit" class="button-secondary" />
|
||||
<select name="action">
|
||||
<option value="" selected>Actions</option>
|
||||
<?php if ( 'approved' == $comment_status ): ?>
|
||||
<option value="unapprove"><?php _e('Unapprove'); ?></option>
|
||||
<?php else : ?>
|
||||
<option value="approve"><?php _e('Approve'); ?>
|
||||
<?php endif; ?>
|
||||
<input type="submit" value="<?php _e('Mark as Spam'); ?>" name="spamit" class="button-secondary" />
|
||||
<?php if ( 'moderated' != $comment_status ): ?>
|
||||
<input type="submit" value="<?php _e('Unapprove'); ?>" name="unapproveit" class="button-secondary" />
|
||||
<?php if ( 'spam' != $comment_status ): ?>
|
||||
<option value="markspam"><?php _e('Mark as Spam'); ?></option>
|
||||
<?php endif; ?>
|
||||
<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
|
||||
<option value="delete"><?php _e('Delete'); ?></option>
|
||||
</select>
|
||||
<?php do_action('manage_comments_nav', $comment_status); ?>
|
||||
<?php wp_nonce_field('bulk-comments'); ?>
|
||||
<input type="submit" name="doaction" value="Apply" class="button-secondary apply" />
|
||||
<?php if ( isset($_GET['apage']) ) { ?>
|
||||
<input type="hidden" name="apage" value="<?php echo absint( $_GET['apage'] ); ?>" />
|
||||
<?php } ?>
|
||||
|
@ -202,9 +213,10 @@ if ($comments) {
|
|||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
||||
<th scope="col"><?php _e('Comment') ?></th>
|
||||
<th scope="col"><?php _e('Date') ?></th>
|
||||
<th scope="col" class="action-links"><?php _e('Actions') ?></th>
|
||||
<th scope="col" class="comment-column"><?php _e('Comment') ?></th>
|
||||
<th scope="col" class="author-column"><?php _e('Author') ?></th>
|
||||
<th scope="col" class="date-column"><?php _e('Comment Submitted') ?></th>
|
||||
<th scope="col" class="response-column"><?php _e('In Response To This Post') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="the-comment-list" class="list:comment">
|
||||
|
|
|
@ -9,40 +9,41 @@
|
|||
/** WordPress Administration Bootstrap */
|
||||
require_once('admin.php');
|
||||
|
||||
// Handle bulk deletes
|
||||
if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
|
||||
// Handle bulk actions
|
||||
if ( isset($_GET['action']) && isset($_GET['delete']) ) {
|
||||
check_admin_referer('bulk-link-categories');
|
||||
|
||||
if ( !current_user_can('manage_categories') )
|
||||
wp_die(__('Cheatin’ uh?'));
|
||||
|
||||
if ( $_GET['action'] == 'delete' ) {
|
||||
foreach( (array) $_GET['delete'] as $cat_ID ) {
|
||||
$cat_name = get_term_field('name', $cat_ID, 'link_category');
|
||||
$default_cat_id = get_option('default_link_category');
|
||||
|
||||
foreach( (array) $_GET['delete'] as $cat_ID ) {
|
||||
$cat_name = get_term_field('name', $cat_ID, 'link_category');
|
||||
$default_cat_id = get_option('default_link_category');
|
||||
// Don't delete the default cats.
|
||||
if ( $cat_ID == $default_cat_id )
|
||||
wp_die(sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
|
||||
|
||||
// Don't delete the default cats.
|
||||
if ( $cat_ID == $default_cat_id )
|
||||
wp_die(sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
|
||||
wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));
|
||||
}
|
||||
|
||||
wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));
|
||||
$location = 'edit-link-categories.php';
|
||||
if ( $referer = wp_get_referer() ) {
|
||||
if ( false !== strpos($referer, 'edit-link-categories.php') )
|
||||
$location = $referer;
|
||||
}
|
||||
|
||||
$location = add_query_arg('message', 6, $location);
|
||||
wp_redirect($location);
|
||||
exit();
|
||||
}
|
||||
|
||||
$location = 'edit-link-categories.php';
|
||||
if ( $referer = wp_get_referer() ) {
|
||||
if ( false !== strpos($referer, 'edit-link-categories.php') )
|
||||
$location = $referer;
|
||||
}
|
||||
|
||||
$location = add_query_arg('message', 6, $location);
|
||||
wp_redirect($location);
|
||||
exit();
|
||||
} elseif ( !empty($_GET['_wp_http_referer']) ) {
|
||||
wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
|
||||
exit;
|
||||
}
|
||||
|
||||
$title = __('Link Categories');
|
||||
$parent_file = 'edit.php';
|
||||
|
||||
wp_enqueue_script( 'admin-categories' );
|
||||
wp_enqueue_script('admin-forms');
|
||||
|
@ -64,11 +65,7 @@ endif; ?>
|
|||
<div class="wrap">
|
||||
|
||||
<form id="posts-filter" action="" method="get">
|
||||
<?php if ( current_user_can('manage_categories') ) : ?>
|
||||
<h2><?php printf(__('Manage Link Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2>
|
||||
<?php else : ?>
|
||||
<h2><?php _e('Manage Link Categories') ?> </h2>
|
||||
<?php endif; ?>
|
||||
<h2><?php printf( current_user_can('manage_categories') ? __('Link Categories (<a href="%s">Add New</a>)') : __('Manage Tags'), '#addcat' ); ?></h2>
|
||||
|
||||
<p id="post-search">
|
||||
<label class="hidden" for="post-search-input"><?php _e( 'Search Categories' ); ?>:</label>
|
||||
|
@ -99,7 +96,11 @@ if ( $page_links )
|
|||
?>
|
||||
|
||||
<div class="alignleft">
|
||||
<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
|
||||
<select name="action">
|
||||
<option value="" selected><?php _e('Actions'); ?></option>
|
||||
<option value="delete"><?php _e('Delete'); ?></option>
|
||||
</select>
|
||||
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
||||
<?php wp_nonce_field('bulk-link-categories'); ?>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -10,30 +10,32 @@
|
|||
require_once('admin.php');
|
||||
|
||||
// Handle bulk deletes
|
||||
if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
|
||||
if ( isset($_GET['action']) && isset($_GET['delete']) ) {
|
||||
check_admin_referer('bulk-pages');
|
||||
foreach( (array) $_GET['delete'] as $post_id_del ) {
|
||||
$post_del = & get_post($post_id_del);
|
||||
if ( $_GET['action'] == 'delete' ) {
|
||||
foreach( (array) $_GET['delete'] as $post_id_del ) {
|
||||
$post_del = & get_post($post_id_del);
|
||||
|
||||
if ( !current_user_can('delete_page', $post_id_del) )
|
||||
wp_die( __('You are not allowed to delete this page.') );
|
||||
if ( !current_user_can('delete_page', $post_id_del) )
|
||||
wp_die( __('You are not allowed to delete this page.') );
|
||||
|
||||
if ( $post_del->post_type == 'attachment' ) {
|
||||
if ( ! wp_delete_attachment($post_id_del) )
|
||||
wp_die( __('Error in deleting...') );
|
||||
} else {
|
||||
if ( !wp_delete_post($post_id_del) )
|
||||
wp_die( __('Error in deleting...') );
|
||||
if ( $post_del->post_type == 'attachment' ) {
|
||||
if ( ! wp_delete_attachment($post_id_del) )
|
||||
wp_die( __('Error in deleting...') );
|
||||
} else {
|
||||
if ( !wp_delete_post($post_id_del) )
|
||||
wp_die( __('Error in deleting...') );
|
||||
}
|
||||
}
|
||||
|
||||
$sendback = wp_get_referer();
|
||||
if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
|
||||
elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
|
||||
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
|
||||
|
||||
wp_redirect($sendback);
|
||||
exit();
|
||||
}
|
||||
|
||||
$sendback = wp_get_referer();
|
||||
if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
|
||||
elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
|
||||
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
|
||||
|
||||
wp_redirect($sendback);
|
||||
exit();
|
||||
} elseif ( !empty($_GET['_wp_http_referer']) ) {
|
||||
wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
|
||||
exit;
|
||||
|
@ -51,7 +53,7 @@ $post_stati = array( // array( adj, noun )
|
|||
'private' => array(__('Private'), __('Private pages'), __ngettext_noop('Private (%s)', 'Private (%s)'))
|
||||
);
|
||||
|
||||
$post_status_label = __('Manage Pages');
|
||||
$post_status_label = __('Pages');
|
||||
$post_status_q = '';
|
||||
if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {
|
||||
$post_status_label = $post_stati[$_GET['post_status']][1];
|
||||
|
@ -79,7 +81,7 @@ if ( isset($_GET['author']) && $_GET['author'] ) {
|
|||
$author_user = get_userdata( (int) $_GET['author'] );
|
||||
$h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name ));
|
||||
}
|
||||
printf( _c( '%1$s%2$s%3$s|You can reorder these: 1: Pages, 2: by {s}, 3: matching {s}' ), $post_status_label, $h2_author, $h2_search );
|
||||
printf( _c( '%1$s%2$s%3$s (<a href="%4$s">Add New</a>)|You can reorder these: 1: Pages, 2: by {s}, 3: matching {s}' ), $post_status_label, $h2_author, $h2_search, 'page-new.php' );
|
||||
?></h2>
|
||||
|
||||
<ul class="subsubsub">
|
||||
|
@ -146,7 +148,11 @@ if ( $page_links )
|
|||
?>
|
||||
|
||||
<div class="alignleft">
|
||||
<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
|
||||
<select name="action">
|
||||
<option value="" selected><?php _e('Actions'); ?></option>
|
||||
<option value="delete"><?php _e('Delete'); ?></option>
|
||||
</select>
|
||||
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
||||
<?php wp_nonce_field('bulk-pages'); ?>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ foreach($posts_columns as $column_name=>$column_display_name) {
|
|||
|
||||
case 'cb':
|
||||
?>
|
||||
<th scope="row" class="check-column"><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><input type="checkbox" name="delete[]" value="<?php the_ID(); ?>" /><?php } ?></th>
|
||||
<th scope="row" class="check-column"><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>
|
||||
<?php
|
||||
break;
|
||||
case 'modified':
|
||||
|
@ -84,14 +84,34 @@ foreach($posts_columns as $column_name=>$column_display_name) {
|
|||
$h_time = mysql2date(__('Y/m/d'), $m_time);
|
||||
}
|
||||
}
|
||||
?>
|
||||
<td><abbr title="<?php echo $t_time ?>"><?php echo apply_filters('post_date_column_time', $h_time, $post, $column_name) ?></abbr></td>
|
||||
<?php
|
||||
|
||||
if ( 'excerpt' == $mode ) : ?>
|
||||
<td><?php echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode) ?></td>
|
||||
<?php else : ?>
|
||||
<td><abbr title="<?php echo $t_time ?>"><?php echo apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) ?></abbr></td>
|
||||
<?php endif;
|
||||
break;
|
||||
case 'title':
|
||||
?>
|
||||
<td><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; } ?></strong>
|
||||
<?php if ( !empty($post->post_password) ) { _e(' — <strong>Protected</strong>'); } elseif ('private' == $post->post_status) { _e(' — <strong>Private</strong>'); } ?></td>
|
||||
<td class="post-title"><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; } ?></strong>
|
||||
<?php
|
||||
if ( !empty($post->post_password) ) { _e(' — <strong>Protected</strong>'); } elseif ('private' == $post->post_status) { _e(' — <strong>Private</strong>'); }
|
||||
|
||||
if ( 'excerpt' == $mode )
|
||||
the_excerpt();
|
||||
|
||||
$actions = array();
|
||||
$actions['edit'] = '<a href="post.php?action=edit&post=' . $post->ID . '">' . __('Edit') . '</a>';
|
||||
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_' . $post_ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
|
||||
$action_count = count($actions);
|
||||
$i = 0;
|
||||
foreach ( $actions as $action => $link ) {
|
||||
++$i;
|
||||
( $i == $action_count ) ? $sep = '' : $sep = ' | ';
|
||||
echo "<span class='$action'>$link$sep</span>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
|
|
|
@ -10,11 +10,10 @@
|
|||
require_once('admin.php');
|
||||
|
||||
$title = __('Tags');
|
||||
$parent_file = 'edit.php';
|
||||
|
||||
wp_reset_vars(array('action', 'tag'));
|
||||
|
||||
if ( isset($_GET['deleteit']) && isset($_GET['delete_tags']) )
|
||||
if ( $_GET['action'] == 'delete' && isset($_GET['delete_tags']) )
|
||||
$action = 'bulk-delete';
|
||||
|
||||
switch($action) {
|
||||
|
@ -134,11 +133,7 @@ endif; ?>
|
|||
<div class="wrap">
|
||||
|
||||
<form id="posts-filter" action="" method="get">
|
||||
<?php if ( current_user_can('manage_categories') ) : ?>
|
||||
<h2><?php printf(__('Manage Tags (<a href="%s">add new</a>)'), '#addtag') ?> </h2>
|
||||
<?php else : ?>
|
||||
<h2><?php _e('Manage Tags') ?> </h2>
|
||||
<?php endif; ?>
|
||||
<h2><?php printf( current_user_can('manage_categories') ? __('Tags (<a href="%s">Add New</a>)') : __('Manage Tags'), '#addtag' ); ?></h2>
|
||||
|
||||
<p id="post-search">
|
||||
<label class="hidden" for="post-search-input"><?php _e( 'Search Tags' ); ?>:</label>
|
||||
|
@ -169,7 +164,11 @@ if ( $page_links )
|
|||
?>
|
||||
|
||||
<div class="alignleft">
|
||||
<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
|
||||
<select name="action">
|
||||
<option value="" selected><?php _e('Actions'); ?></option>
|
||||
<option value="delete"><?php _e('Delete'); ?></option>
|
||||
</select>
|
||||
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
||||
<?php wp_nonce_field('bulk-tags'); ?>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -9,24 +9,32 @@
|
|||
/** WordPress Administration Bootstrap */
|
||||
require_once('admin.php');
|
||||
|
||||
// Handle bulk deletes
|
||||
if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
|
||||
check_admin_referer('bulk-posts');
|
||||
foreach( (array) $_GET['delete'] as $post_id_del ) {
|
||||
$post_del = & get_post($post_id_del);
|
||||
// Handle bulk actions
|
||||
if ( isset($_GET['action']) && $_GET['action'] != 'Actions' ) {
|
||||
switch ( $_GET['action'] ) {
|
||||
case 'delete':
|
||||
if ( isset($_GET['post']) ) {
|
||||
check_admin_referer('bulk-posts');
|
||||
foreach( (array) $_GET['post'] as $post_id_del ) {
|
||||
$post_del = & get_post($post_id_del);
|
||||
|
||||
if ( !current_user_can('delete_post', $post_id_del) )
|
||||
wp_die( __('You are not allowed to delete this post.') );
|
||||
if ( !current_user_can('delete_post', $post_id_del) )
|
||||
wp_die( __('You are not allowed to delete this post.') );
|
||||
|
||||
if ( $post_del->post_type == 'attachment' ) {
|
||||
if ( ! wp_delete_attachment($post_id_del) )
|
||||
wp_die( __('Error in deleting...') );
|
||||
} else {
|
||||
if ( !wp_delete_post($post_id_del) )
|
||||
wp_die( __('Error in deleting...') );
|
||||
}
|
||||
if ( $post_del->post_type == 'attachment' ) {
|
||||
if ( ! wp_delete_attachment($post_id_del) )
|
||||
wp_die( __('Error in deleting...') );
|
||||
} else {
|
||||
if ( !wp_delete_post($post_id_del) )
|
||||
wp_die( __('Error in deleting...') );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'edit':
|
||||
// TODO: Decide what to do here - add bulk edit feature, or just disallow if >1 post selected
|
||||
break;
|
||||
}
|
||||
|
||||
$sendback = wp_get_referer();
|
||||
if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php');
|
||||
elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
|
||||
|
@ -52,6 +60,10 @@ require_once('admin-header.php');
|
|||
if ( !isset( $_GET['paged'] ) )
|
||||
$_GET['paged'] = 1;
|
||||
|
||||
if ( empty($_GET['mode']) )
|
||||
$mode = 'list';
|
||||
else
|
||||
$mode = attribute_escape($_GET['mode']);
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
|
@ -61,7 +73,7 @@ if ( !isset( $_GET['paged'] ) )
|
|||
if ( is_single() ) {
|
||||
printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title));
|
||||
} else {
|
||||
$post_status_label = _c('Manage Posts|manage posts header');
|
||||
$post_status_label = _c('Posts|manage posts header');
|
||||
if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) )
|
||||
$post_status_label = $post_stati[$_GET['post_status']][1];
|
||||
//if ( $post_listing_pageable && !is_archive() && !is_search() ) //Unreachable code: $post_listing_pageable is undefined, Similar code in upload.php
|
||||
|
@ -83,7 +95,7 @@ if ( is_single() ) {
|
|||
$h2_cat = isset($_GET['cat']) && $_GET['cat'] ? ' ' . sprintf( __('in “%s”'), single_cat_title('', false) ) : '';
|
||||
$h2_tag = isset($_GET['tag']) && $_GET['tag'] ? ' ' . sprintf( __('tagged with “%s”'), single_tag_title('', false) ) : '';
|
||||
$h2_month = isset($_GET['m']) && $_GET['m'] ? ' ' . sprintf( __('during %s'), single_month_title(' ', false) ) : '';
|
||||
printf( _c( '%1$s%2$s%3$s%4$s%5$s%6$s|You can reorder these: 1: Posts, 2: by {s}, 3: matching {s}, 4: in {s}, 5: tagged with {s}, 6: during {s}' ), $h2_noun, $h2_author, $h2_search, $h2_cat, $h2_tag, $h2_month );
|
||||
printf( _c( '%1$s%2$s%3$s%4$s%5$s%6$s (<a href="%7$s">Add New</a>)|You can reorder these: 1: Posts, 2: by {s}, 3: matching {s}, 4: in {s}, 5: tagged with {s}, 6: during {s}' ), $h2_noun, $h2_author, $h2_search, $h2_cat, $h2_tag, $h2_month, 'post-new.php' );
|
||||
}
|
||||
?></h2>
|
||||
|
||||
|
@ -129,6 +141,13 @@ endif;
|
|||
<input type="submit" value="<?php _e( 'Search Posts' ); ?>" class="button" />
|
||||
</p>
|
||||
|
||||
<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
|
||||
|
||||
<ul class="view-switch">
|
||||
<li <?php if ( 'list' == $mode ) echo "class='current'" ?>><a href="<?php echo clean_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>"><?php _e('List View') ?></a></li>
|
||||
<li <?php if ( 'excerpt' == $mode ) echo "class='current'" ?>><a href="<?php echo clean_url(add_query_arg('mode', 'excerpt', $_SERVER['REQUEST_URI'])) ?>"><?php _e('Excerpt View') ?></a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tablenav">
|
||||
|
||||
<?php
|
||||
|
@ -144,7 +163,12 @@ if ( $page_links )
|
|||
?>
|
||||
|
||||
<div class="alignleft">
|
||||
<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
|
||||
<select name="action">
|
||||
<option value="" selected><?php _e('Actions'); ?></option>
|
||||
<option value="delete"><?php _e('Delete'); ?></option>
|
||||
<option value="edit"><?php _e('Edit'); ?></option>
|
||||
</select>
|
||||
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
||||
<?php wp_nonce_field('bulk-posts'); ?>
|
||||
<?php
|
||||
if ( !is_singular() ) {
|
||||
|
@ -230,14 +254,13 @@ if ( 1 == count($posts) && is_singular() ) :
|
|||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e('Comment') ?></th>
|
||||
<th scope="col"><?php _e('Date') ?></th>
|
||||
<th scope="col"><?php _e('Actions') ?></th>
|
||||
<th scope="col"><?php _e('Submitted') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="the-comment-list" class="list:comment">
|
||||
<?php
|
||||
foreach ($comments as $comment)
|
||||
_wp_comment_row( $comment->comment_ID, 'detail', false, false );
|
||||
_wp_comment_row( $comment->comment_ID, 'single', false, false );
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -343,14 +343,14 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
|
|||
function wp_manage_posts_columns() {
|
||||
$posts_columns = array();
|
||||
$posts_columns['cb'] = '<input type="checkbox" />';
|
||||
$posts_columns['title'] = __('Title');
|
||||
if ( isset($_GET['post_status']) && 'draft' === $_GET['post_status'] )
|
||||
$posts_columns['modified'] = __('Modified');
|
||||
elseif ( isset($_GET['post_status']) && 'pending' === $_GET['post_status'] )
|
||||
$posts_columns['modified'] = __('Submitted');
|
||||
else
|
||||
$posts_columns['date'] = __('Date');
|
||||
$posts_columns['title'] = __('Title');
|
||||
$posts_columns['author'] = __('Author');
|
||||
//$posts_columns['author'] = __('Author');
|
||||
$posts_columns['categories'] = __('Categories');
|
||||
$posts_columns['tags'] = __('Tags');
|
||||
if ( !isset($_GET['post_status']) || !in_array($_GET['post_status'], array('pending', 'draft', 'future')) )
|
||||
|
@ -367,11 +367,12 @@ function wp_manage_media_columns() {
|
|||
$posts_columns['cb'] = '<input type="checkbox" />';
|
||||
$posts_columns['icon'] = '';
|
||||
$posts_columns['media'] = _c('Media|media column header');
|
||||
$posts_columns['desc'] = _c('Description|media column header');
|
||||
$posts_columns['tags'] = _c('Tags|media column header');
|
||||
// $posts_columns['desc'] = _c('Description|media column header');
|
||||
$posts_columns['date'] = _c('Date Added|media column header');
|
||||
$posts_columns['parent'] = _c('Appears with|media column header');
|
||||
$posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
|
||||
$posts_columns['location'] = _c('Location|media column header');
|
||||
// $posts_columns['actions'] = _c('Actions|media column header');
|
||||
$posts_columns = apply_filters('manage_media_columns', $posts_columns);
|
||||
|
||||
return $posts_columns;
|
||||
|
@ -741,18 +742,12 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
|
|||
$post = get_post($comment->comment_post_ID);
|
||||
$authordata = get_userdata($post->post_author);
|
||||
$the_comment_status = wp_get_comment_status($comment->comment_ID);
|
||||
$class = ('unapproved' == $the_comment_status) ? 'unapproved' : '';
|
||||
|
||||
if ( current_user_can( 'edit_post', $post->ID ) ) {
|
||||
$post_link = "<a href='" . get_comment_link() . "'>";
|
||||
|
||||
$post_link .= get_the_title($comment->comment_post_ID) . '</a>';
|
||||
|
||||
$edit_link_start = "<a class='row-title' href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . __('Edit comment') . "'>";
|
||||
$edit_link_end = '</a>';
|
||||
} else {
|
||||
$post_link = get_the_title($comment->comment_post_ID);
|
||||
$edit_link_start = $edit_link_end ='';
|
||||
}
|
||||
|
||||
$author_url = get_comment_author_url();
|
||||
|
@ -774,52 +769,63 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
|
|||
$spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
|
||||
|
||||
?>
|
||||
<tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $class; ?>'>
|
||||
<tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $the_comment_status; ?>'>
|
||||
<?php if ( $checkbox ) : ?>
|
||||
<td class="check-column"><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
|
||||
<?php endif; ?>
|
||||
<td class="comment">
|
||||
<p class="comment-author"><strong><?php echo $edit_link_start; comment_author(); echo $edit_link_end; ?></strong><br />
|
||||
<?php if ( !empty($author_url) ) : ?>
|
||||
<a href="<?php echo $author_url ?>"><?php echo $author_url_display; ?></a> |
|
||||
<?php endif; ?>
|
||||
<?php if ( current_user_can( 'edit_post', $post->ID ) ) : ?>
|
||||
<?php if ( !empty($comment->comment_author_email) ): ?>
|
||||
<?php comment_author_email_link() ?> |
|
||||
<?php endif; ?>
|
||||
<a href="edit-comments.php?s=<?php comment_author_IP() ?>&mode=detail"><?php comment_author_IP() ?></a>
|
||||
<?php endif; //current_user_can?>
|
||||
</p>
|
||||
<?php if ( 'detail' == $mode ) comment_text(); ?>
|
||||
<p><?php printf(__('From %1$s, %2$s'), $post_link, $ptime) ?></p>
|
||||
</td>
|
||||
<td><?php comment_date(__('Y/m/d')); ?></td>
|
||||
<td class="action-links">
|
||||
<td class="comment-column">
|
||||
<?php if ( 'detail' == $mode || 'single' == $mode ) comment_text(); ?>
|
||||
|
||||
<?php
|
||||
|
||||
$actions = array();
|
||||
|
||||
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
|
||||
$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
|
||||
$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
|
||||
|
||||
// we're looking at list of only approved or only unapproved comments
|
||||
if ( 'moderated' == $comment_status ) {
|
||||
$actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=approved' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
|
||||
unset($actions['unapprove']);
|
||||
} elseif ( 'approved' == $comment_status ) {
|
||||
$actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=unapproved' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
|
||||
unset($actions['approve']);
|
||||
}
|
||||
|
||||
$actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a> | ';
|
||||
$actions['flag'] = "<a href='#' class='no-crazy'>Flag for Follow-up</a> | ";
|
||||
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | ';
|
||||
$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete'>" . __('Delete') . '</a>';
|
||||
|
||||
if ( $comment_status ) { // not looking at all comments
|
||||
if ( 'approved' == $the_comment_status ) {
|
||||
$actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
|
||||
unset($actions['approve']);
|
||||
} else {
|
||||
$actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
|
||||
unset($actions['unapprove']);
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'spam' == $the_comment_status )
|
||||
unset($actions['spam']);
|
||||
|
||||
$actions = apply_filters( 'comment_row_actions', $actions, $comment );
|
||||
|
||||
foreach ( $actions as $action => $link )
|
||||
echo "<span class='$action'>$link</span>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="author-column">
|
||||
<strong><?php comment_author(); ?></strong><br />
|
||||
<?php if ( !empty($author_url) ) : ?>
|
||||
<a href="<?php echo $author_url ?>"><?php echo $author_url_display; ?></a><br />
|
||||
<?php endif; ?>
|
||||
<?php if ( current_user_can( 'edit_post', $post->ID ) ) : ?>
|
||||
<?php if ( !empty($comment->comment_author_email) ): ?>
|
||||
<?php comment_author_email_link() ?><br />
|
||||
<?php endif; ?>
|
||||
<a href="edit-comments.php?s=<?php comment_author_IP() ?>&mode=detail"><?php comment_author_IP() ?></a>
|
||||
<?php endif; //current_user_can?>
|
||||
</td>
|
||||
<td class="date-column"><?php comment_date(__('Y/m/d \a\t g:ia')); ?></td>
|
||||
<?php if ( 'single' !== $mode ) : ?>
|
||||
<td class="response-column">
|
||||
"<?php echo $post_link ?>" <?php echo sprintf('(%s comments)', $post->comment_count); ?><br/>
|
||||
<?php echo get_the_time(__('Y/m/d \a\t g:ia')); ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
@ -989,13 +995,16 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0 ) {
|
|||
$year = '<input type="text" id="aa" name="aa" value="' . $aa . '" size="4" maxlength="5"' . $tab_index_attribute . ' autocomplete="off" />';
|
||||
$hour = '<input type="text" id="hh" name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
|
||||
$minute = '<input type="text" id="mn" name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
|
||||
printf(_c('%1$s%2$s, %3$s <br />@ %4$s : %5$s|1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input'), $month, $day, $year, $hour, $minute);
|
||||
printf(_c('%1$s%2$s, %3$s @ %4$s : %5$s|1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input'), $month, $day, $year, $hour, $minute);
|
||||
echo "\n\n";
|
||||
foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit )
|
||||
echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $$timeunit . '" />' . "\n";
|
||||
?>
|
||||
|
||||
<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" />
|
||||
|
||||
<a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e('OK'); ?></a>
|
||||
<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><?php _e('Cancel'); ?></a>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
@ -1172,7 +1181,6 @@ function wp_remember_old_slug() {
|
|||
function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default') {
|
||||
global $wp_meta_boxes;
|
||||
|
||||
|
||||
if ( !isset($wp_meta_boxes) )
|
||||
$wp_meta_boxes = array();
|
||||
if ( !isset($wp_meta_boxes[$page]) )
|
||||
|
@ -1180,31 +1188,39 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $pri
|
|||
if ( !isset($wp_meta_boxes[$page][$context]) )
|
||||
$wp_meta_boxes[$page][$context] = array();
|
||||
|
||||
foreach ( array_keys($wp_meta_boxes[$page]) as $a_context ) {
|
||||
foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
|
||||
if ( !isset($wp_meta_boxes[$page][$context][$a_priority][$id]) )
|
||||
if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
|
||||
continue;
|
||||
|
||||
// If a core box was previously added or removed by a plugin, don't add.
|
||||
if ( 'core' == $priority ) {
|
||||
// If core box previously deleted, don't add
|
||||
if ( false === $wp_meta_boxes[$page][$context][$a_priority][$id] )
|
||||
if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
|
||||
return;
|
||||
// If box was added with default priority, give it core priority to maintain sort order
|
||||
if ( 'default' == $a_priority ) {
|
||||
$wp_meta_boxes[$page][$context]['core'][$id] = $wp_meta_boxes[$page][$context]['default'][$id];
|
||||
unset($wp_meta_boxes[$page][$context]['default'][$id]);
|
||||
$wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
|
||||
unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// If no priority given and id already present, use existing priority
|
||||
if ( empty($priority) )
|
||||
if ( empty($priority) ) {
|
||||
$priority = $a_priority;
|
||||
// An id can be in only one priority
|
||||
if ( $priority != $a_priority )
|
||||
unset($wp_meta_boxes[$page][$context][$a_priority][$id]);
|
||||
// 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.
|
||||
} elseif ( 'sorted' == $priority ) {
|
||||
$title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
|
||||
$callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
|
||||
}
|
||||
// An id can be in only one priority and one context
|
||||
if ( $priority != $a_priority || $context != $a_context )
|
||||
unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty($priority) )
|
||||
$priority = low;
|
||||
$priority = 'low';
|
||||
|
||||
if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
|
||||
$wp_meta_boxes[$page][$context][$priority] = array();
|
||||
|
@ -1212,29 +1228,49 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $pri
|
|||
$wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
|
||||
}
|
||||
|
||||
// crazyhorse - this can be made simpler
|
||||
function do_meta_boxes($page, $context, $object) {
|
||||
global $wp_meta_boxes;
|
||||
static $already_sorted = false;
|
||||
|
||||
do_action('do_meta_boxes', $page, $context, $object);
|
||||
|
||||
if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
|
||||
return;
|
||||
echo "<div id='$context-sortables' class='meta-box-sortables'>\n";
|
||||
|
||||
foreach ( array('high', 'core', 'default', 'low') as $priority ) {
|
||||
if ( ! isset( $wp_meta_boxes[$page][$context][$priority] ) )
|
||||
continue;
|
||||
|
||||
foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) {
|
||||
if ( false === $box )
|
||||
continue;
|
||||
echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '">' . "\n";
|
||||
echo "<h3>{$box['title']}</h3>\n";
|
||||
echo '<div class="inside">' . "\n";
|
||||
call_user_func($box['callback'], $object, $box);
|
||||
echo "</div>\n";
|
||||
echo "</div>\n";
|
||||
$i = 0;
|
||||
do {
|
||||
// Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
|
||||
if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) {
|
||||
foreach ( $sorted as $box_context => $ids )
|
||||
foreach ( explode(',', $ids) as $id )
|
||||
if ( $id )
|
||||
add_meta_box( $id, null, null, $page, $box_context, 'sorted' );
|
||||
}
|
||||
}
|
||||
$already_sorted = true;
|
||||
|
||||
if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
|
||||
break;
|
||||
|
||||
|
||||
foreach ( array('high', 'sorted', 'core', 'default', 'low') as $priority ) {
|
||||
foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) {
|
||||
if ( false == $box || ! $box['title'] )
|
||||
continue;
|
||||
$i++;
|
||||
echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '">' . "\n";
|
||||
echo "<h3><span class='hndle'>{$box['title']}</span></h3>\n";
|
||||
echo '<div class="inside">' . "\n";
|
||||
call_user_func($box['callback'], $object, $box);
|
||||
echo "</div>\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
}
|
||||
} while(0);
|
||||
|
||||
echo "</div>";
|
||||
|
||||
return $i;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,22 +10,24 @@
|
|||
require_once ('admin.php');
|
||||
|
||||
// Handle bulk deletes
|
||||
if ( isset($_GET['deleteit']) && isset($_GET['linkcheck']) ) {
|
||||
if ( isset($_GET['action']) && isset($_GET['linkcheck']) ) {
|
||||
check_admin_referer('bulk-bookmarks');
|
||||
|
||||
if ( ! current_user_can('manage_links') )
|
||||
wp_die( __('You do not have sufficient permissions to edit the links for this blog.') );
|
||||
|
||||
if ( $_GET['action'] == 'delete' ) {
|
||||
foreach ( (array) $_GET['linkcheck'] as $link_id) {
|
||||
$link_id = (int) $link_id;
|
||||
|
||||
foreach ( (array) $_GET['linkcheck'] as $link_id) {
|
||||
$link_id = (int) $link_id;
|
||||
wp_delete_link($link_id);
|
||||
}
|
||||
|
||||
wp_delete_link($link_id);
|
||||
$sendback = wp_get_referer();
|
||||
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
|
||||
wp_redirect($sendback);
|
||||
exit;
|
||||
}
|
||||
|
||||
$sendback = wp_get_referer();
|
||||
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
|
||||
wp_redirect($sendback);
|
||||
exit;
|
||||
} elseif ( !empty($_GET['_wp_http_referer']) ) {
|
||||
wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
|
||||
exit;
|
||||
|
@ -82,7 +84,7 @@ if ( isset($_GET['deleted']) ) {
|
|||
<div class="wrap">
|
||||
|
||||
<form id="posts-filter" action="" method="get">
|
||||
<h2><?php printf( __( 'Manage Links (<a href="%s">add new</a>)' ), 'link-add.php' ); ?></h2>
|
||||
<h2><?php printf( __('Links (<a href="%s">Add New</a>)' ), 'link-add.php' ); ?></h2>
|
||||
|
||||
<p id="post-search">
|
||||
<label class="hidden" for="post-search-input"><?php _e( 'Search Links' ); ?>:</label>
|
||||
|
@ -95,7 +97,11 @@ if ( isset($_GET['deleted']) ) {
|
|||
<div class="tablenav">
|
||||
|
||||
<div class="alignleft">
|
||||
<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
|
||||
<select name="action">
|
||||
<option value="" selected><?php _e('Actions'); ?></option>
|
||||
<option value="delete"><?php _e('Delete'); ?></option>
|
||||
</select>
|
||||
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
||||
<?php
|
||||
$categories = get_terms('link_category', "hide_empty=1");
|
||||
$select_cat = "<select name=\"cat_id\">\n";
|
||||
|
|
|
@ -8,34 +8,38 @@
|
|||
|
||||
/** WordPress Administration Bootstrap */
|
||||
require_once('admin.php');
|
||||
add_thickbox();
|
||||
wp_enqueue_script('media-upload');
|
||||
|
||||
if (!current_user_can('upload_files'))
|
||||
wp_die(__('You do not have permission to upload files.'));
|
||||
|
||||
// Handle bulk deletes
|
||||
if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
|
||||
if ( isset($_GET['action']) && isset($_GET['media']) ) {
|
||||
check_admin_referer('bulk-media');
|
||||
foreach( (array) $_GET['delete'] as $post_id_del ) {
|
||||
$post_del = & get_post($post_id_del);
|
||||
if ( $_GET['action'] == 'delete' ) {
|
||||
foreach( (array) $_GET['media'] as $post_id_del ) {
|
||||
$post_del = & get_post($post_id_del);
|
||||
|
||||
if ( !current_user_can('delete_post', $post_id_del) )
|
||||
wp_die( __('You are not allowed to delete this post.') );
|
||||
if ( !current_user_can('delete_post', $post_id_del) )
|
||||
wp_die( __('You are not allowed to delete this post.') );
|
||||
|
||||
if ( $post_del->post_type == 'attachment' )
|
||||
if ( ! wp_delete_attachment($post_id_del) )
|
||||
wp_die( __('Error in deleting...') );
|
||||
if ( $post_del->post_type == 'attachment' )
|
||||
if ( ! wp_delete_attachment($post_id_del) )
|
||||
wp_die( __('Error in deleting...') );
|
||||
}
|
||||
|
||||
$location = 'upload.php';
|
||||
if ( $referer = wp_get_referer() ) {
|
||||
if ( false !== strpos($referer, 'upload.php') )
|
||||
$location = $referer;
|
||||
}
|
||||
|
||||
$location = add_query_arg('message', 2, $location);
|
||||
$location = remove_query_arg('posted', $location);
|
||||
wp_redirect($location);
|
||||
exit;
|
||||
}
|
||||
|
||||
$location = 'upload.php';
|
||||
if ( $referer = wp_get_referer() ) {
|
||||
if ( false !== strpos($referer, 'upload.php') )
|
||||
$location = $referer;
|
||||
}
|
||||
|
||||
$location = add_query_arg('message', 2, $location);
|
||||
$location = remove_query_arg('posted', $location);
|
||||
wp_redirect($location);
|
||||
exit;
|
||||
} elseif ( !empty($_GET['_wp_http_referer']) ) {
|
||||
wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
|
||||
exit;
|
||||
|
@ -64,7 +68,7 @@ if ( !isset( $_GET['paged'] ) )
|
|||
if ( is_singular() ) {
|
||||
printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title));
|
||||
} else {
|
||||
$post_mime_type_label = _c('Manage Media|manage media header');
|
||||
$post_mime_type_label = _c('Media|manage media header');
|
||||
if ( isset($_GET['post_mime_type']) && in_array( $_GET['post_mime_type'], array_keys($post_mime_types) ) )
|
||||
$post_mime_type_label = $post_mime_types[$_GET['post_mime_type']][1];
|
||||
if ( $post_listing_pageable && !is_archive() && !is_search() )
|
||||
|
@ -86,7 +90,7 @@ if ( is_singular() ) {
|
|||
$h2_cat = isset($_GET['cat']) && $_GET['cat'] ? ' ' . sprintf( __('in “%s”'), single_cat_title('', false) ) : '';
|
||||
$h2_tag = isset($_GET['tag']) && $_GET['tag'] ? ' ' . sprintf( __('tagged with “%s”'), single_tag_title('', false) ) : '';
|
||||
$h2_month = isset($_GET['m']) && $_GET['m'] ? ' ' . sprintf( __('during %s'), single_month_title(' ', false) ) : '';
|
||||
printf( _c( '%1$s%2$s%3$s%4$s%5$s%6$s|You can reorder these: 1: Posts, 2: by {s}, 3: matching {s}, 4: in {s}, 5: tagged with {s}, 6: during {s}' ), $h2_noun, $h2_author, $h2_search, $h2_cat, $h2_tag, $h2_month );
|
||||
printf( _c( '%1$s%2$s%3$s%4$s%5$s%6$s (<a href="%7$s" class="thickbox">Add New</a>)|You can reorder these: 1: Posts, 2: by {s}, 3: matching {s}, 4: in {s}, 5: tagged with {s}, 6: during {s}' ), $h2_noun, $h2_author, $h2_search, $h2_cat, $h2_tag, $h2_month, 'media-upload.php?library=false&TB_iframe=true' );
|
||||
}
|
||||
?></h2>
|
||||
|
||||
|
@ -155,7 +159,11 @@ if ( $page_links )
|
|||
?>
|
||||
|
||||
<div class="alignleft">
|
||||
<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
|
||||
<select name="action">
|
||||
<option value="" selected><?php _e('Actions'); ?></option>
|
||||
<option value="delete"><?php _e('Delete'); ?></option>
|
||||
</select>
|
||||
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
||||
<?php wp_nonce_field('bulk-media'); ?>
|
||||
<?php
|
||||
|
||||
|
|
|
@ -1384,6 +1384,17 @@ p#post-search {
|
|||
border-bottom-style: solid;
|
||||
}
|
||||
|
||||
/* Edit posts */
|
||||
|
||||
td.post-title strong {
|
||||
display: block;
|
||||
margin-bottom: .2em;
|
||||
}
|
||||
|
||||
td.post-title p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Global classes */
|
||||
.wp-hidden-children .wp-hidden-child { display: none; }
|
||||
.wp-no-js-hidden { display: none; }
|
||||
|
|
Loading…
Reference in New Issue