get_previous_comments_link() and get_next_comments_link(). Props Viper007Bond. fixes #8058 for trunk

git-svn-id: http://svn.automattic.com/wordpress/trunk@10239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2008-12-22 19:33:09 +00:00
parent c55feaddbf
commit 22a1c35cea
4 changed files with 53 additions and 29 deletions

View File

@@ -21,6 +21,7 @@ do_action('edit_tag_form_pre', $tag); ?>
<form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate">
<input type="hidden" name="action" value="editedtag" />
<input type="hidden" name="tag_ID" value="<?php echo $tag->term_id ?>" />
<input type="hidden" name="taxonomy" value="<?php echo attribute_escape($taxonomy) ?>" />
<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?>
<table class="form-table">
<tr class="form-field form-required">

View File

@@ -11,7 +11,10 @@ require_once('admin.php');
$title = __('Tags');
wp_reset_vars( array('action', 'tag') );
wp_reset_vars( array('action', 'tag', 'taxonomy') );
if ( empty($taxonomy) )
$taxonomy = 'post_tag';
if ( isset( $_GET['action'] ) && isset($_GET['delete_tags']) && ( 'delete' == $_GET['action'] || 'delete' == $_GET['action2'] ) )
$action = 'bulk-delete';
@@ -25,7 +28,7 @@ case 'addtag':
if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin&#8217; uh?'));
$ret = wp_insert_term($_POST['name'], 'post_tag', $_POST);
$ret = wp_insert_term($_POST['name'], $taxonomy, $_POST);
if ( $ret && !is_wp_error( $ret ) ) {
wp_redirect('edit-tags.php?message=1#addtag');
} else {
@@ -41,7 +44,7 @@ case 'delete':
if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin&#8217; uh?'));
wp_delete_term( $tag_ID, 'post_tag');
wp_delete_term( $tag_ID, $taxonomy);
wp_redirect('edit-tags.php?message=2');
exit;
@@ -56,7 +59,7 @@ case 'bulk-delete':
$tags = $_GET['delete_tags'];
foreach( (array) $tags as $tag_ID ) {
wp_delete_term( $tag_ID, 'post_tag');
wp_delete_term( $tag_ID, $taxonomy);
}
$location = 'edit-tags.php';
@@ -77,7 +80,7 @@ case 'edit':
require_once ('admin-header.php');
$tag_ID = (int) $_GET['tag_ID'];
$tag = get_term($tag_ID, 'post_tag', OBJECT, 'edit');
$tag = get_term($tag_ID, $taxonomy, OBJECT, 'edit');
include('edit-tag-form.php');
break;
@@ -89,7 +92,7 @@ case 'editedtag':
if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin&#8217; uh?'));
$ret = wp_update_term($tag_ID, 'post_tag', $_POST);
$ret = wp_update_term($tag_ID, $taxonomy, $_POST);
$location = 'edit-tags.php';
if ( $referer = wp_get_original_referer() ) {
@@ -167,7 +170,7 @@ $page_links = paginate_links( array(
'format' => '',
'prev_text' => __('&laquo;'),
'next_text' => __('&raquo;'),
'total' => ceil(wp_count_terms('post_tag') / $tagsperpage),
'total' => ceil(wp_count_terms($taxonomy) / $tagsperpage),
'current' => $pagenum
));
@@ -207,7 +210,7 @@ if ( $page_links )
$searchterms = isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '';
$count = tag_rows( $pagenum, $tagsperpage, $searchterms );
$count = tag_rows( $pagenum, $tagsperpage, $searchterms, $taxonomy );
?>
</tbody>
</table>

View File

@@ -581,13 +581,13 @@ function wp_link_category_checklist( $link_id = 0 ) {
* @param unknown_type $class
* @return unknown
*/
function _tag_row( $tag, $class = '' ) {
function _tag_row( $tag, $class = '', $taxonomy = 'post_tag' ) {
$count = number_format_i18n( $tag->count );
$count = ( $count > 0 ) ? "<a href='edit.php?tag=$tag->slug'>$count</a>" : $count;
$name = apply_filters( 'term_name', $tag->name );
$qe_data = get_term($tag->term_id, 'post_tag', object, 'edit');
$edit_link = "edit-tags.php?action=edit&amp;tag_ID=$tag->term_id";
$qe_data = get_term($tag->term_id, $taxonomy, object, 'edit');
$edit_link = "edit-tags.php?action=edit&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id";
$out = '';
$out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>';
$columns = get_column_headers('edit-tags');
@@ -610,7 +610,7 @@ function _tag_row( $tag, $class = '' ) {
$actions = array();
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this tag '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this tag '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
$action_count = count($actions);
$i = 0;
$out .= '<div class="row-actions">';
@@ -652,7 +652,7 @@ function _tag_row( $tag, $class = '' ) {
* @param unknown_type $searchterms
* @return unknown
*/
function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
function tag_rows( $page = 1, $pagesize = 20, $searchterms = '', $taxonomy = 'post_tag' ) {
// Get a page worth of tags
$start = ($page - 1) * $pagesize;
@@ -663,13 +663,13 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
$args['search'] = $searchterms;
}
$tags = get_terms( 'post_tag', $args );
$tags = get_terms( $taxonomy, $args );
// convert it to table rows
$out = '';
$count = 0;
foreach( $tags as $tag )
$out .= _tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"' );
$out .= _tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"', $taxonomy );
// filter and send to screen
echo $out;