Plugin Directory

Changeset 2073147


Ignore:
Timestamp:
04/23/2019 12:07:44 PM (7 years ago)
Author:
nir0ma
Message:

v1.1.0 Released : Taxonomy support fixed !

Location:
category-import-reloaded/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • category-import-reloaded/trunk/README.txt

    r1894062 r2073147  
    44Donate link: https://www.niroma.net
    55Requires at least: 3.0.1
    6 Tested up to: 4.9.6
     6Tested up to: 5.1.1
    77Requires PHP: 5.6.0
    88Stable tag: 1.1.4
     
    6868* Now support multiple sub categories with the same name (example : Level0/Level1, Level1/Level1).
    6969* Now support taxonomies.
     70
     71= 1.1.0 =
     72* Taxonomies support fixed (Was not working in v1.0.0)
  • category-import-reloaded/trunk/category-import-reloaded.php

    r1859595 r2073147  
    1616 * Plugin URI:        http://wordpress.org/extend/plugins/category-import-reloaded/
    1717 * Description:       This plug-in allows user to bulk create categories and taxonomies with a custom input format. This plugin is an update of the no more maintained "Category Import" plugin originally developped by Jiayu (James) Ji.
    18  * Version:           1.0.0
     18 * Version:           1.1.0
    1919 * Author:            Niroma
    2020 * Author URI:        https://www.niroma.net/
     
    4040define( NS . 'PLUGIN_NAME', 'category-import-reloaded' );
    4141
    42 define( NS . 'PLUGIN_VERSION', '1.0.0' );
     42define( NS . 'PLUGIN_VERSION', '1.1.0' );
    4343
    4444define( NS . 'PLUGIN_NAME_DIR', plugin_dir_path( __FILE__ ) );
  • category-import-reloaded/trunk/inc/admin/class-admin.php

    r1859595 r2073147  
    138138                $admin_notice = '';
    139139                $messageLog = '';
    140                 $taxonomyActive = $_POST[$this->plugin_name.'-taxonomy'];
     140                $taxonomyActive = $_POST[$this->plugin_name.'-taxonomy'] ? $_POST[$this->plugin_name.'-taxonomy'] : 'category';
    141141                $delimiter = ( strlen(sanitize_text_field(trim($_POST[$this->plugin_name.'-delimiter']))) != 0 ) ? $_POST[$this->plugin_name.'-delimiter']:"$";
    142142                if ( strlen($delimiter) > 2 ) $delimiter = "$";
     
    146146                $parent_id = '';
    147147                $rootCategories = array();
    148                 $rootTerms = get_terms( array( 'taxonomy' => 'category', 'parent' => 0, 'hide_empty' => false ) );
     148                $rootTerms = get_terms( array( 'taxonomy' => $taxonomyActive, 'parent' => 0, 'hide_empty' => false ) );
    149149                foreach ($rootTerms as $rootTerm) {
    150150                    $rootCategories[] = array('id' => $rootTerm->term_id, 'name' => $rootTerm->name);
     
    175175                                $countErrors++;
    176176                            } else {
    177                                 $result = wp_insert_term( $cat_name, 'category', array('slug' => $cat_slug) );
     177                                $result = wp_insert_term( $cat_name, $taxonomyActive, array('slug' => $cat_slug) );
    178178                                if ( ! is_wp_error( $result ) ) {
    179179                                    $parent_id = isset( $result['term_id'] ) ? $result['term_id'] : '';
     
    185185                            if (!empty($parent_id)) {
    186186                                $siblingsCategories = array();
    187                                 $parentChildren = get_terms( array('taxonomy' => 'category', 'parent' => $parent_id, 'hide_empty' => false ) );
     187                                $parentChildren = get_terms( array('taxonomy' => $taxonomyActive, 'parent' => $parent_id, 'hide_empty' => false ) );
    188188                                foreach ($parentChildren as $child) {
    189189                                    $siblingsCategories[] = array('id' => $child->term_id, 'name' => $child->name);
     
    193193                                    $countErrors++;
    194194                                } else {
    195                                     $result = wp_insert_term( $cat_name, 'category', array('parent' => $parent_id, 'slug' => $cat_slug) );
     195                                    $result = wp_insert_term( $cat_name, $taxonomyActive, array('parent' => $parent_id, 'slug' => $cat_slug) );
    196196                                    if ( ! is_wp_error( $result ) ) {
    197197                                        $parent_id = isset( $result['term_id'] ) ? $result['term_id'] : '';
Note: See TracChangeset for help on using the changeset viewer.