Changeset 2073147
- Timestamp:
- 04/23/2019 12:07:44 PM (7 years ago)
- Location:
- category-import-reloaded/trunk
- Files:
-
- 3 edited
-
README.txt (modified) (2 diffs)
-
category-import-reloaded.php (modified) (2 diffs)
-
inc/admin/class-admin.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
category-import-reloaded/trunk/README.txt
r1894062 r2073147 4 4 Donate link: https://www.niroma.net 5 5 Requires at least: 3.0.1 6 Tested up to: 4.9.66 Tested up to: 5.1.1 7 7 Requires PHP: 5.6.0 8 8 Stable tag: 1.1.4 … … 68 68 * Now support multiple sub categories with the same name (example : Level0/Level1, Level1/Level1). 69 69 * 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 16 16 * Plugin URI: http://wordpress.org/extend/plugins/category-import-reloaded/ 17 17 * 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.018 * Version: 1.1.0 19 19 * Author: Niroma 20 20 * Author URI: https://www.niroma.net/ … … 40 40 define( NS . 'PLUGIN_NAME', 'category-import-reloaded' ); 41 41 42 define( NS . 'PLUGIN_VERSION', '1. 0.0' );42 define( NS . 'PLUGIN_VERSION', '1.1.0' ); 43 43 44 44 define( NS . 'PLUGIN_NAME_DIR', plugin_dir_path( __FILE__ ) ); -
category-import-reloaded/trunk/inc/admin/class-admin.php
r1859595 r2073147 138 138 $admin_notice = ''; 139 139 $messageLog = ''; 140 $taxonomyActive = $_POST[$this->plugin_name.'-taxonomy'] ;140 $taxonomyActive = $_POST[$this->plugin_name.'-taxonomy'] ? $_POST[$this->plugin_name.'-taxonomy'] : 'category'; 141 141 $delimiter = ( strlen(sanitize_text_field(trim($_POST[$this->plugin_name.'-delimiter']))) != 0 ) ? $_POST[$this->plugin_name.'-delimiter']:"$"; 142 142 if ( strlen($delimiter) > 2 ) $delimiter = "$"; … … 146 146 $parent_id = ''; 147 147 $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 ) ); 149 149 foreach ($rootTerms as $rootTerm) { 150 150 $rootCategories[] = array('id' => $rootTerm->term_id, 'name' => $rootTerm->name); … … 175 175 $countErrors++; 176 176 } 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) ); 178 178 if ( ! is_wp_error( $result ) ) { 179 179 $parent_id = isset( $result['term_id'] ) ? $result['term_id'] : ''; … … 185 185 if (!empty($parent_id)) { 186 186 $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 ) ); 188 188 foreach ($parentChildren as $child) { 189 189 $siblingsCategories[] = array('id' => $child->term_id, 'name' => $child->name); … … 193 193 $countErrors++; 194 194 } 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) ); 196 196 if ( ! is_wp_error( $result ) ) { 197 197 $parent_id = isset( $result['term_id'] ) ? $result['term_id'] : '';
Note: See TracChangeset
for help on using the changeset viewer.