From ab8c90f89ea21999496b9bf2c3214b44e7fdbdd1 Mon Sep 17 00:00:00 2001 From: rob1n Date: Sat, 7 Apr 2007 04:58:28 +0000 Subject: [PATCH] Add initial category to tag importing. see #4107 git-svn-id: https://develop.svn.wordpress.org/trunk@5201 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/import/wp-cat2tag.php | 145 +++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 wp-admin/import/wp-cat2tag.php diff --git a/wp-admin/import/wp-cat2tag.php b/wp-admin/import/wp-cat2tag.php new file mode 100644 index 0000000000..b10edb439e --- /dev/null +++ b/wp-admin/import/wp-cat2tag.php @@ -0,0 +1,145 @@ +'; + print '

' . __('Convert Categories to Tags') . '

'; + } + + function footer() { + print ''; + } + + function populate_all_categories() { + $this->all_categories =& get_categories('hide_empty=0&hierarchal=0'); + } + + function welcome() { + print '
'; + print '

' . __('Howdy! This converter allows you to selectively convert existing categories to tags. To get started, check the checkboxes of the categories you wish to be converted, then click the Convert button.') . '

'; + print '

' . __('Keep in mind that if you convert a category with child categories, those child categories get their parent setting removed, so they\'re in the root.') . '

'; + + $this->categories_form(); + + print '
'; + } + + function categories_form() { + $this->populate_all_categories(); + + print '
'; + print ''; + print '

'; + print '
'; + } + + function _category_children($parent, $hier) { + print ''; + } + + function convert_them() { + global $wpdb; + + if (!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) { + print '
'; + print '

' . sprintf(__('Uh, oh. Something didn\'t work. Please try again.'), 'admin.php?import=wp-cat2tag') . '

'; + print '
'; + } + + $this->categories_to_convert = $_POST['cats_to_convert']; + $hier = _get_category_hierarchy(); + + print ''; + } + + function init() { + if (!isset($_GET['step'])) { + $step = 1; + } else { + $step = (int) $_GET['step']; + } + + $this->header(); + + switch ($step) { + case 1: + $this->welcome(); + break; + case 2: + $this->convert_them(); + break; + } + + $this->footer(); + } +} + +$wp_cat2tag_importer = new WP_Categories_to_Tags; + +register_importer('wp-cat2tag', __('Categories to Tags Converter'), __('Convert existing categories to tags, selectively.'), array(&$wp_cat2tag_importer, 'init')); + +?> \ No newline at end of file