X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/wordpress.git/blobdiff_plain/7c1a4aea7aeb083c7424823d11f24401edcba439..699231ae09f7057a4d0000cdf32e50a3df6a04ca:/wp-admin/import/stp.php diff --git a/wp-admin/import/stp.php b/wp-admin/import/stp.php deleted file mode 100644 index 4568428c..00000000 --- a/wp-admin/import/stp.php +++ /dev/null @@ -1,170 +0,0 @@ -'; - screen_icon(); - echo '

'.__('Import Simple Tagging').'

'; - 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 Simple Tagging 1.6.2 into WordPress tags.').'

'; - echo '

'.__('This has not been tested on any other versions of Simple Tagging. Mileage may vary.').'

'; - echo '

'.__('To accommodate larger databases for those tag-crazy authors out there, we have made this into an easy 4-step program to help you kick that nasty Simple Tagging habit. Just keep clicking along and we will let you know when you are in the clear!').'

'; - echo '

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

'; - echo '
'; - wp_nonce_field('import-stp'); - echo '

'; - echo '
'; - echo '
'; - } - - function dispatch () { - if ( empty( $_GET['step'] ) ) { - $step = 0; - } else { - $step = (int) $_GET['step']; - } - // load the header - $this->header(); - switch ( $step ) { - case 0 : - $this->greet(); - break; - case 1 : - check_admin_referer('import-stp'); - $this->import_posts(); - break; - case 2: - check_admin_referer('import-stp'); - $this->import_t2p(); - break; - case 3: - check_admin_referer('import-stp'); - $this->cleanup_import(); - break; - } - // load the footer - $this->footer(); - } - - - function import_posts ( ) { - echo '
'; - echo '

'.__('Reading STP Post Tags…').'

'; - - // read in all the STP tag -> post settings - $posts = $this->get_stp_posts(); - - // if we didn't get any tags back, that's all there is folks! - if ( !is_array($posts) ) { - echo '

' . __('No posts were found to have tags!') . '

'; - return false; - } - else { - // if there's an existing entry, delete it - if ( get_option('stpimp_posts') ) { - delete_option('stpimp_posts'); - } - - add_option('stpimp_posts', $posts); - $count = count($posts); - echo '

' . sprintf( _n('Done! %s tag to post relationships were read.', 'Done! %s tags to post relationships were read.', $count), $count ) . '

'; - } - - echo '
'; - wp_nonce_field('import-stp'); - echo '

'; - echo '
'; - echo '
'; - } - - - function import_t2p ( ) { - echo '
'; - echo '

'.__('Adding Tags to Posts…').'

'; - - // run that funky magic! - $tags_added = $this->tag2post(); - - echo '

' . sprintf( _n('Done! %s tag was added!', 'Done! %s tags were added!', $tags_added), $tags_added ) . '

'; - echo '
'; - wp_nonce_field('import-stp'); - echo '

'; - echo '
'; - echo '
'; - } - - function get_stp_posts ( ) { - global $wpdb; - // read in all the posts from the STP post->tag table: should be wp_post2tag - $posts_query = "SELECT post_id, tag_name FROM " . $wpdb->prefix . "stp_tags"; - $posts = $wpdb->get_results($posts_query); - return $posts; - } - - function tag2post ( ) { - global $wpdb; - - // get the tags and posts we imported in the last 2 steps - $posts = get_option('stpimp_posts'); - - // null out our results - $tags_added = 0; - - // loop through each post and add its tags to the db - foreach ( $posts as $this_post ) { - $the_post = (int) $this_post->post_id; - $the_tag = $wpdb->escape($this_post->tag_name); - // try to add the tag - wp_add_post_tags($the_post, $the_tag); - $tags_added++; - } - - // that's it, all posts should be linked to their tags properly, pending any errors we just spit out! - return $tags_added; - } - - function cleanup_import ( ) { - delete_option('stpimp_posts'); - $this->done(); - } - - function done ( ) { - echo '
'; - echo '

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

'; - echo '

' . __('OK, so we lied about this being a 4-step program! You’re done!') . '

'; - echo '

' . __('Now wasn’t that easy?') . '

'; - echo '
'; - } - - function STP_Import ( ) { - // Nothing. - } -} - -// create the import object -$stp_import = new STP_Import(); - -// add it to the import page! -register_importer('stp', 'Simple Tagging', __('Import Simple Tagging tags into WordPress tags.'), array($stp_import, 'dispatch')); -?>