55Description: Convert existing categories to tags or tags to categories, selectively.
66Author: wordpressdotorg
77Author URI: http://wordpress.org/
8- Version: 0.5.2
8+ Version: 0.6
99License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
1010*/
1111
@@ -54,7 +54,11 @@ function header( $current_tab ) {
5454 $ tabs ['formats ' ] = array ( 'label ' => __ ( 'Formats ' , 'wpcat2tag-importer ' ), 'url ' => admin_url ( 'admin.php?import=wpcat2tag&tab=formats ' ) ); ?>
5555
5656 <div class="wrap">
57- <?php screen_icon (); ?>
57+ <?php
58+ if ( version_compare ( get_bloginfo ( 'version ' ), '3.8.0 ' , '< ' ) ) {
59+ screen_icon ();
60+ }
61+ ?>
5862 <h2><?php _e ( 'Categories, Tags and Formats Converter ' , 'wpcat2tag-importer ' ); ?> </h2>
5963 <h3 class="nav-tab-wrapper">
6064 <?php foreach ( $ tabs as $ tab => $ info ) :
@@ -248,7 +252,7 @@ function convert_formats() {
248252 $ convert_to = 'tag ' == $ _POST ['convert_to ' ] ? 'post_tag ' : 'category ' ;
249253 if ( ! $ term_info = term_exists ( $ _POST ['convert_to_slug ' ], $ convert_to ) )
250254 $ term_info = wp_insert_term ( $ _POST ['convert_to_slug ' ], $ convert_to );
251-
255+
252256 if ( is_wp_error ($ term_info ) ) {
253257 echo '<p> ' . $ term_info ->get_error_message () . ' ' ;
254258 printf ( __ ( 'Please <a href="%s">try again</a>. ' , 'wpcat2tag-importer ' ), 'admin.php?import=wpcat2tag&tab=cats ' ) . "</p> \n" ;
@@ -307,7 +311,7 @@ function convert_categories() {
307311 echo '</div> ' ;
308312 return ;
309313 }
310-
314+
311315 $ default = get_option ( 'default_category ' );
312316
313317 if ( ! isset ($ _POST ['convert_to ' ]) || 'format ' != $ _POST ['convert_to ' ] ) {
@@ -337,7 +341,7 @@ function convert_categories() {
337341 if ( 'post_tag ' == $ convert_to ) {
338342 if ( ! $ term_info = term_exists ( $ category ->slug , 'post_tag ' ) )
339343 $ term_info = wp_insert_term ( $ category ->name , 'post_tag ' , array ( 'description ' => $ category ->description ) );
340-
344+
341345 if ( is_wp_error ($ term_info ) ) {
342346 echo $ term_info ->get_error_message () . "</li> \n" ;
343347 continue ;
@@ -351,7 +355,7 @@ function convert_categories() {
351355 $ values [] = $ wpdb ->prepare ( "(%d, %d, 0) " , $ post , $ term_info ['term_taxonomy_id ' ] );
352356 clean_post_cache ( $ post );
353357 }
354-
358+
355359 $ wpdb ->query ( "INSERT INTO {$ wpdb ->term_relationships } (object_id, term_taxonomy_id, term_order) VALUES " . join (', ' , $ values ) );
356360 $ wpdb ->update ( $ wpdb ->term_taxonomy , array ( 'count ' => $ category ->count ), array ( 'term_id ' => $ term_info ['term_id ' ], 'taxonomy ' => $ convert_to ) );
357361 // otherwise just convert it
@@ -404,7 +408,7 @@ function convert_tags() {
404408 if ( 'category ' == $ convert_to ) {
405409 if ( ! $ term_info = term_exists ( $ tag ->slug , 'category ' ) )
406410 $ term_info = wp_insert_term ( $ tag ->name , 'category ' , array ( 'description ' => $ tag ->description ) );
407-
411+
408412 if ( is_wp_error ($ term_info ) ) {
409413 echo $ term_info ->get_error_message () . "</li> \n" ;
410414 continue ;
0 commit comments