X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/76aea3697c6043c1613370f172395b4f65ee71f0..d3b1ea255664edd2deef17f900a655613d20820d:/wp-admin/import/wp-cat2tag.php
diff --git a/wp-admin/import/wp-cat2tag.php b/wp-admin/import/wp-cat2tag.php
index ff6da0d5..b4312b61 100644
--- a/wp-admin/import/wp-cat2tag.php
+++ b/wp-admin/import/wp-cat2tag.php
@@ -1,5 +1,19 @@
';
if ( $cat_num > 0 ) {
- echo '
' . sprintf( __ngettext( 'Convert Category to Tag.', 'Convert Categories (%d) to Tags.', $cat_num ), $cat_num ) . '
';
+ screen_icon();
+ echo '' . sprintf( _n( 'Convert Category to Tag.', 'Convert Categories (%d) to Tags.', $cat_num ), $cat_num ) . '
';
echo '';
echo '
' . __('Hey there. Here you can selectively convert existing categories to tags. To get started, check the categories you wish to be converted, then click the Convert button.') . '
';
echo '
' . __('Keep in mind that if you convert a category with child categories, the children become top-level orphans.') . '
';
@@ -88,7 +103,7 @@ function check_all_rows() {
';
if ( $tags_num > 0 ) {
- echo '' . sprintf( __ngettext( 'Convert Tag to Category.', 'Convert Tags (%d) to Categories.', $tags_num ), $tags_num ) . '
';
+ screen_icon();
+ echo '' . sprintf( _n( 'Convert Tag to Category.', 'Convert Tags (%d) to Categories.', $tags_num ), $tags_num ) . '
';
echo '';
- echo '
' . __('Here you can selectively converts existing tags to categories. To get started, check the tags you wish to be converted, then click the Convert button.') . '
';
+ echo '
' . __('Here you can selectively convert existing tags to categories. To get started, check the tags you wish to be converted, then click the Convert button.') . '
';
echo '
' . __('The newly created categories will still be associated with the same posts.') . '
';
$this->tags_form();
@@ -163,12 +179,12 @@ function check_all_tagrows() {
_category_exists($cat_id) ) {
- echo '' . sprintf( __('Category %s doesn\'t exist!'), $cat_id ) . "\n";
+ echo '' . sprintf( __('Category %s doesn’t exist!'), $cat_id ) . "\n";
} else {
$category =& get_category($cat_id);
echo '' . sprintf(__('Converting category %s ... '), $category->name);
@@ -243,7 +259,7 @@ function check_all_tagrows() {
if ( ! ($id = is_term( $category->slug, 'post_tag' ) ) )
$id = wp_insert_term($category->name, 'post_tag', array('slug' => $category->slug));
-
+
$id = $id['term_taxonomy_id'];
$posts = get_objects_in_term($category->term_id, 'category');
$term_order = 0;
@@ -252,7 +268,7 @@ function check_all_tagrows() {
$values[] = $wpdb->prepare( "(%d, %d, %d)", $post, $id, $term_order);
clean_post_cache($post);
}
-
+
if ( $values ) {
$wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");
@@ -262,7 +278,7 @@ function check_all_tagrows() {
echo __('Converted successfully.') . "\n";
continue;
}
-
+
// if tag already exists, add it to all posts in the category
if ( $tag_ttid = $wpdb->get_var( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $category->term_id) ) ) {
$objects_ids = get_objects_in_term($category->term_id, 'category');
@@ -309,14 +325,12 @@ function check_all_tagrows() {
if ( ! empty($clean_term_cache) ) {
$clean_term_cache = array_unique(array_values($clean_term_cache));
- foreach ( $clean_term_cache as $id )
- wp_cache_delete($id, 'post_tag');
+ clean_term_cache($clean_term_cache, 'post_tag');
}
if ( ! empty($clean_cat_cache) ) {
$clean_cat_cache = array_unique(array_values($clean_cat_cache));
- foreach ( $clean_cat_cache as $id )
- wp_cache_delete($id, 'category');
+ clean_term_cache($clean_cat_cache, 'category');
}
if ( $clear_parents ) delete_option('category_children');
@@ -392,20 +406,18 @@ function check_all_tagrows() {
echo __('Converted successfully.') . "\n";
} else {
- printf( '' . __('Tag #%s doesn\'t exist!') . "\n", $tag_id );
+ printf( '' . __('Tag #%s doesn’t exist!') . "\n", $tag_id );
}
}
if ( ! empty($clean_term_cache) ) {
$clean_term_cache = array_unique(array_values($clean_term_cache));
- foreach ( $clean_term_cache as $id )
- wp_cache_delete($id, 'post_tag');
+ clean_term_cache($clean_term_cache, 'post_tag');
}
if ( ! empty($clean_cat_cache) ) {
$clean_cat_cache = array_unique(array_values($clean_cat_cache));
- foreach ( $clean_cat_cache as $id )
- wp_cache_delete($id, 'category');
+ clean_term_cache($clean_term_cache, 'category');
}
if ( $clear_parents ) delete_option('category_children');