diff --git a/wp-admin/import/btt.php b/wp-admin/import/btt.php new file mode 100644 index 0000000000..76a02c32d9 --- /dev/null +++ b/wp-admin/import/btt.php @@ -0,0 +1,115 @@ +'; + echo '

'.__('Import Bunny’s Technorati Tags').'

'; + echo '

'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'

'; + } + + function footer() { + echo ''; + } + + function greet() { + echo '
'; + echo '

'.__('Howdy! This imports tags from an existing Bunny’s Technorati Tags installation into this blog using the new WordPress native tagging structure.').'

'; + echo '

'.__('This is suitable for Bunny’s Technorati Tags version 0.6.').'

'; + echo '

'.__('All existing Bunny’s Technorati Tags will be removed after import.').'

'; + echo '

'.__('Don’t be stupid - backup your database before proceeding!').'

'; + echo '
'; + wp_nonce_field('import-btt'); + echo '

'; + echo '
'; + echo '
'; + } + + function dispatch() { + if ( empty($_GET['step']) ) + $step = 0; + else + $step = abs(intval($_GET['step'])); + + // load the header + $this->header(); + + switch ( $step ) { + case 0 : + $this->greet(); + break; + case 1 : + check_admin_referer('import-btt'); + $this->check_post_keyword( true ); + break; + case 2 : + check_admin_referer('import-btt'); + $this->check_post_keyword( false ); + break; + case 3: + $this->done(); + break; + } + + // load the footer + $this->footer(); + } + + function check_post_keyword($precheck = true) { + global $wpdb; + + echo '
'; + echo '

'.__('Reading Bunny’s Technorati Tags…').'

'; + + // import Bunny's Keywords tags + $metakeys = $wpdb->get_results("SELECT post_id, meta_id, meta_key, meta_value FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key = 'tags'"); + if ( !is_array($metakeys)) { + echo '

' . __('No Tags Found!') . '

'; + return false; + } else { + $count = count($metakeys); + echo '

' . sprintf( __('Done! %s posts with tags were read.'), $count ) . '

'; + echo ''; + } + + echo '
'; + wp_nonce_field('import-btt'); + echo '

'; + echo '
'; + echo '
'; + } + + function done() { + echo '
'; + echo '

'.__('Import Complete!').'

'; + echo '
'; + } + + function BunnyTags_Import() { + } + +} + +// create the import object +$btt_import = new BunnyTags_Import(); + +// add it to the import page! +register_importer('btt', 'Bunny’s Technorati Tags', __('Import Bunny’s Technorati Tags into the new native tagging structure.'), array($btt_import, 'dispatch')); + +?>