From dd1332fdaf31b66d4a8c903ae804460d95495b27 Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Mon, 10 Sep 2007 20:30:55 +0000 Subject: [PATCH] Add importer for Bunny's Technorati Tags plugin. Fixes #4931 git-svn-id: https://develop.svn.wordpress.org/trunk@6072 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/import/btt.php | 115 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 wp-admin/import/btt.php 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')); + +?>