Changeset 2887267
- Timestamp:
- 03/27/2023 01:58:25 AM (3 years ago)
- Location:
- importer-for-crocoblock-jetengine
- Files:
-
- 2 added
- 10 edited
- 1 copied
-
tags/1.2 (copied) (copied from importer-for-crocoblock-jetengine/trunk)
-
tags/1.2/filters/ifcj_special_notice.php (added)
-
tags/1.2/importer-for-crocoblock-jetengine.php (modified) (5 diffs)
-
tags/1.2/readme.txt (modified) (1 diff)
-
tags/1.2/src/FieldFactory/Builder.php (modified) (2 diffs)
-
tags/1.2/src/Parsers/ParseJetEngineData.php (modified) (1 diff)
-
tags/1.2/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/filters/ifcj_special_notice.php (added)
-
trunk/importer-for-crocoblock-jetengine.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/src/FieldFactory/Builder.php (modified) (2 diffs)
-
trunk/src/Parsers/ParseJetEngineData.php (modified) (1 diff)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
importer-for-crocoblock-jetengine/tags/1.2/importer-for-crocoblock-jetengine.php
r2864701 r2887267 3 3 Plugin Name: Coding Chicken - JetEngine Importer 4 4 Description: A handy importer for JetEngine Meta Box fields - Requires WP All Import and JetEngine 5 Version: 1. 15 Version: 1.2 6 6 Author: Coding Chicken 7 7 Author URI: https://codingchicken.com … … 28 28 const IMPORTER_JETENGINE_PREFIX = 'cc_jetengine_importer_'; 29 29 30 const IMPORTER_JETENGINE_VERSION = '1. 1';30 const IMPORTER_JETENGINE_VERSION = '1.2'; 31 31 32 32 // Require Composer autoloader. … … 169 169 //$this->constants(); 170 170 $this->includes(); 171 172 // Check for any other notices and display them if needed. 173 $special_notice = apply_filters('ifcj_special_notice', ''); 174 175 if( !empty($special_notice) ){ 176 $this->notices = [$special_notice]; 177 178 add_action( 'admin_notices', array($this, 'display_admin_message')); 179 } 171 180 172 181 //add_action( 'admin_enqueue_scripts', [ $this, 'cc_importer_jetengine_admin_scripts' ] ); … … 228 237 $priority = 10; 229 238 } 239 230 240 add_filter( $actionName, self::PREFIX . str_replace( '-', '_', $function ), $priority, 99 ); // since we don't know at this point how many parameters each plugin expects, we make sure they will be provided with all of them (it's unlikely any developer will specify more than 99 parameters in a function) 231 241 … … 289 299 } 290 300 301 public function display_admin_message(){ 302 foreach($this->notices as $notice_text) { 303 304 $unique_notice_id = sanitize_key(md5(self::$slug . $notice_text)); 305 306 307 if ( ! get_option( $unique_notice_id . '_notice_ignore' ) ) { 308 309 ?> 310 311 <div class="notice-info notice is-dismissible wpallimport-dismissible" style="margin-top: 10px;" 312 rel="<?php echo esc_attr($unique_notice_id); ?>"> 313 <p><?php _e( 314 sprintf( 315 $notice_text, 316 '?' . $unique_notice_id . '_ignore=0' 317 ), 318 'rapid_addon_' . self::$slug 319 ); ?></p> 320 </div> 321 322 <?php 323 324 } 325 } 326 } 327 291 328 /** 292 329 * @param $hook -
importer-for-crocoblock-jetengine/tags/1.2/readme.txt
r2864701 r2887267 66 66 67 67 == Changelog == 68 = 1.2 = 69 * bug fix: resolve issue where some JetEngine objects may not appear in the import configuration 70 68 71 = 1.1 = 69 72 * improvement: add support for [Pro Pack](https://codingchicken.com/downloads/crocoblock-jetengine-importer-pro-pack/) -
importer-for-crocoblock-jetengine/tags/1.2/src/FieldFactory/Builder.php
r2864701 r2887267 16 16 static private $meta_title_shown = false; 17 17 18 static private $relations_title_shown = false; 19 18 20 public function __construct() { 19 21 self::$add_on = \CodingChicken\Importer\JetEngine\IMPORTER_JETENGINE_Plugin::getAddon(); … … 154 156 self::$add_on->add_title('Meta fields'); 155 157 self::$meta_title_shown = true; 158 }elseif(!self::$relations_title_shown && empty($field['is_cct']) && !empty($field['is_relation'])){ 159 // Provide a subheading. 160 self::$add_on->add_title( 'Relations'); 161 self::$relations_title_shown = true; 156 162 } 157 163 -
importer-for-crocoblock-jetengine/tags/1.2/src/Parsers/ParseJetEngineData.php
r2864701 r2887267 43 43 } 44 44 45 // Check if import is for a CCT. 46 $id = $this->cctParser->getCctId($this->post_type); 47 45 48 // Only proceed if there are fields to process. 46 if( !empty($this->fields) ) {49 if( !empty($this->fields) || $id !== false) { 47 50 48 51 // Indicate current fields are not cct. 49 $this->fields = array_map( function($x){52 $this->fields = array_map( function ( $x ) { 50 53 $x['is_cct'] = false; 54 51 55 return $x; 52 }, $this->fields );56 }, $this->fields ); 53 57 54 // Check if import is for a CCT. 55 $id = $this->cctParser->getCctId($this->post_type); 56 57 if($id){ 58 if ( $id ) { 58 59 // Retrieve CCT fields to add to list. 59 $cct_fields = $this->cctParser->getMetaFields( $id);60 $cct_fields = $this->cctParser->getMetaFields( $id ); 60 61 // Mark CCT fields so we can identify them later. 61 $cct_fields = array_map( function($x){62 $cct_fields = array_map( function ( $x ) { 62 63 $x['is_cct'] = true; 63 64 64 65 // Mark the repeater sub-fields as ccts also. 65 if (isset($x['repeater-fields'])){66 $x['repeater-fields'] = array_map( function($y){66 if ( isset( $x['repeater-fields'] ) ) { 67 $x['repeater-fields'] = array_map( function ( $y ) { 67 68 $y['is_cct'] = true; 68 69 69 70 return $y; 70 }, $x['repeater-fields'] );71 }, $x['repeater-fields'] ); 71 72 } 72 73 73 74 return $x; 74 }, $cct_fields );75 }, $cct_fields ); 75 76 76 77 // If it's a CCT merge the fields from it. 77 $this->fields = array_merge( $cct_fields, $this->fields);78 $this->fields = array_merge( $cct_fields, $this->fields ); 78 79 79 80 } 81 } 80 82 83 // Allow modifications of fields. 84 $this->fields = apply_filters('cc_jetengine_importer_fields_list', $this->fields); 85 86 if( !empty($this->fields)){ 81 87 // Process glossary references in fields. 82 88 $this->parseGlossaries(); -
importer-for-crocoblock-jetengine/tags/1.2/vendor/composer/installed.php
r2824714 r2887267 6 6 'install_path' => __DIR__ . '/../../', 7 7 'aliases' => array(), 8 'reference' => ' db3fcff23dc78b884eebd14434f14819f704e979',8 'reference' => 'e9a6e95a74220b1bf0d161d73c10946a3bb1eaca', 9 9 'name' => 'coding-chicken/importer-for-crocoblock-jetengine', 10 10 'dev' => true, … … 17 17 'install_path' => __DIR__ . '/../../', 18 18 'aliases' => array(), 19 'reference' => ' db3fcff23dc78b884eebd14434f14819f704e979',19 'reference' => 'e9a6e95a74220b1bf0d161d73c10946a3bb1eaca', 20 20 'dev_requirement' => false, 21 21 ), -
importer-for-crocoblock-jetengine/trunk/importer-for-crocoblock-jetengine.php
r2864701 r2887267 3 3 Plugin Name: Coding Chicken - JetEngine Importer 4 4 Description: A handy importer for JetEngine Meta Box fields - Requires WP All Import and JetEngine 5 Version: 1. 15 Version: 1.2 6 6 Author: Coding Chicken 7 7 Author URI: https://codingchicken.com … … 28 28 const IMPORTER_JETENGINE_PREFIX = 'cc_jetengine_importer_'; 29 29 30 const IMPORTER_JETENGINE_VERSION = '1. 1';30 const IMPORTER_JETENGINE_VERSION = '1.2'; 31 31 32 32 // Require Composer autoloader. … … 169 169 //$this->constants(); 170 170 $this->includes(); 171 172 // Check for any other notices and display them if needed. 173 $special_notice = apply_filters('ifcj_special_notice', ''); 174 175 if( !empty($special_notice) ){ 176 $this->notices = [$special_notice]; 177 178 add_action( 'admin_notices', array($this, 'display_admin_message')); 179 } 171 180 172 181 //add_action( 'admin_enqueue_scripts', [ $this, 'cc_importer_jetengine_admin_scripts' ] ); … … 228 237 $priority = 10; 229 238 } 239 230 240 add_filter( $actionName, self::PREFIX . str_replace( '-', '_', $function ), $priority, 99 ); // since we don't know at this point how many parameters each plugin expects, we make sure they will be provided with all of them (it's unlikely any developer will specify more than 99 parameters in a function) 231 241 … … 289 299 } 290 300 301 public function display_admin_message(){ 302 foreach($this->notices as $notice_text) { 303 304 $unique_notice_id = sanitize_key(md5(self::$slug . $notice_text)); 305 306 307 if ( ! get_option( $unique_notice_id . '_notice_ignore' ) ) { 308 309 ?> 310 311 <div class="notice-info notice is-dismissible wpallimport-dismissible" style="margin-top: 10px;" 312 rel="<?php echo esc_attr($unique_notice_id); ?>"> 313 <p><?php _e( 314 sprintf( 315 $notice_text, 316 '?' . $unique_notice_id . '_ignore=0' 317 ), 318 'rapid_addon_' . self::$slug 319 ); ?></p> 320 </div> 321 322 <?php 323 324 } 325 } 326 } 327 291 328 /** 292 329 * @param $hook -
importer-for-crocoblock-jetengine/trunk/readme.txt
r2864701 r2887267 66 66 67 67 == Changelog == 68 = 1.2 = 69 * bug fix: resolve issue where some JetEngine objects may not appear in the import configuration 70 68 71 = 1.1 = 69 72 * improvement: add support for [Pro Pack](https://codingchicken.com/downloads/crocoblock-jetengine-importer-pro-pack/) -
importer-for-crocoblock-jetengine/trunk/src/FieldFactory/Builder.php
r2864701 r2887267 16 16 static private $meta_title_shown = false; 17 17 18 static private $relations_title_shown = false; 19 18 20 public function __construct() { 19 21 self::$add_on = \CodingChicken\Importer\JetEngine\IMPORTER_JETENGINE_Plugin::getAddon(); … … 154 156 self::$add_on->add_title('Meta fields'); 155 157 self::$meta_title_shown = true; 158 }elseif(!self::$relations_title_shown && empty($field['is_cct']) && !empty($field['is_relation'])){ 159 // Provide a subheading. 160 self::$add_on->add_title( 'Relations'); 161 self::$relations_title_shown = true; 156 162 } 157 163 -
importer-for-crocoblock-jetengine/trunk/src/Parsers/ParseJetEngineData.php
r2864701 r2887267 43 43 } 44 44 45 // Check if import is for a CCT. 46 $id = $this->cctParser->getCctId($this->post_type); 47 45 48 // Only proceed if there are fields to process. 46 if( !empty($this->fields) ) {49 if( !empty($this->fields) || $id !== false) { 47 50 48 51 // Indicate current fields are not cct. 49 $this->fields = array_map( function($x){52 $this->fields = array_map( function ( $x ) { 50 53 $x['is_cct'] = false; 54 51 55 return $x; 52 }, $this->fields );56 }, $this->fields ); 53 57 54 // Check if import is for a CCT. 55 $id = $this->cctParser->getCctId($this->post_type); 56 57 if($id){ 58 if ( $id ) { 58 59 // Retrieve CCT fields to add to list. 59 $cct_fields = $this->cctParser->getMetaFields( $id);60 $cct_fields = $this->cctParser->getMetaFields( $id ); 60 61 // Mark CCT fields so we can identify them later. 61 $cct_fields = array_map( function($x){62 $cct_fields = array_map( function ( $x ) { 62 63 $x['is_cct'] = true; 63 64 64 65 // Mark the repeater sub-fields as ccts also. 65 if (isset($x['repeater-fields'])){66 $x['repeater-fields'] = array_map( function($y){66 if ( isset( $x['repeater-fields'] ) ) { 67 $x['repeater-fields'] = array_map( function ( $y ) { 67 68 $y['is_cct'] = true; 68 69 69 70 return $y; 70 }, $x['repeater-fields'] );71 }, $x['repeater-fields'] ); 71 72 } 72 73 73 74 return $x; 74 }, $cct_fields );75 }, $cct_fields ); 75 76 76 77 // If it's a CCT merge the fields from it. 77 $this->fields = array_merge( $cct_fields, $this->fields);78 $this->fields = array_merge( $cct_fields, $this->fields ); 78 79 79 80 } 81 } 80 82 83 // Allow modifications of fields. 84 $this->fields = apply_filters('cc_jetengine_importer_fields_list', $this->fields); 85 86 if( !empty($this->fields)){ 81 87 // Process glossary references in fields. 82 88 $this->parseGlossaries(); -
importer-for-crocoblock-jetengine/trunk/vendor/composer/installed.php
r2824714 r2887267 6 6 'install_path' => __DIR__ . '/../../', 7 7 'aliases' => array(), 8 'reference' => ' db3fcff23dc78b884eebd14434f14819f704e979',8 'reference' => 'e9a6e95a74220b1bf0d161d73c10946a3bb1eaca', 9 9 'name' => 'coding-chicken/importer-for-crocoblock-jetengine', 10 10 'dev' => true, … … 17 17 'install_path' => __DIR__ . '/../../', 18 18 'aliases' => array(), 19 'reference' => ' db3fcff23dc78b884eebd14434f14819f704e979',19 'reference' => 'e9a6e95a74220b1bf0d161d73c10946a3bb1eaca', 20 20 'dev_requirement' => false, 21 21 ),
Note: See TracChangeset
for help on using the changeset viewer.