Plugin Directory

Changeset 2887267


Ignore:
Timestamp:
03/27/2023 01:58:25 AM (3 years ago)
Author:
codingchicken
Message:

Update to version 1.2 from GitHub

Location:
importer-for-crocoblock-jetengine
Files:
2 added
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • importer-for-crocoblock-jetengine/tags/1.2/importer-for-crocoblock-jetengine.php

    r2864701 r2887267  
    33Plugin Name: Coding Chicken - JetEngine Importer
    44Description: A handy importer for JetEngine Meta Box fields - Requires WP All Import and JetEngine
    5 Version: 1.1
     5Version: 1.2
    66Author: Coding Chicken
    77Author URI: https://codingchicken.com
     
    2828const IMPORTER_JETENGINE_PREFIX = 'cc_jetengine_importer_';
    2929
    30 const IMPORTER_JETENGINE_VERSION = '1.1';
     30const IMPORTER_JETENGINE_VERSION = '1.2';
    3131
    3232// Require Composer autoloader.
     
    169169            //$this->constants();
    170170            $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            }
    171180           
    172181            //add_action( 'admin_enqueue_scripts', [ $this, 'cc_importer_jetengine_admin_scripts' ] );
     
    228237                    $priority = 10;
    229238                }
     239
    230240                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)
    231241
     
    289299    }
    290300
     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
    291328    /**
    292329     * @param $hook
  • importer-for-crocoblock-jetengine/tags/1.2/readme.txt

    r2864701 r2887267  
    6666
    6767== Changelog ==
     68= 1.2 =
     69* bug fix: resolve issue where some JetEngine objects may not appear in the import configuration
     70
    6871= 1.1 =
    6972* 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  
    1616        static private $meta_title_shown = false;
    1717
     18        static private $relations_title_shown = false;
     19
    1820        public function __construct() {
    1921            self::$add_on = \CodingChicken\Importer\JetEngine\IMPORTER_JETENGINE_Plugin::getAddon();
     
    154156                self::$add_on->add_title('Meta fields');
    155157                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;
    156162            }
    157163
  • importer-for-crocoblock-jetengine/tags/1.2/src/Parsers/ParseJetEngineData.php

    r2864701 r2887267  
    4343                }
    4444
     45                // Check if import is for a CCT.
     46                $id = $this->cctParser->getCctId($this->post_type);
     47
    4548                // Only proceed if there are fields to process.
    46                 if( !empty($this->fields)) {
     49                if( !empty($this->fields) || $id !== false) {
    4750
    4851                    // Indicate current fields are not cct.
    49                     $this->fields = array_map(function($x){
     52                    $this->fields = array_map( function ( $x ) {
    5053                        $x['is_cct'] = false;
     54
    5155                        return $x;
    52                     }, $this->fields);
     56                    }, $this->fields );
    5357
    54                     // Check if import is for a CCT.
    55                     $id = $this->cctParser->getCctId($this->post_type);
    56 
    57                     if($id){
     58                    if ( $id ) {
    5859                        // Retrieve CCT fields to add to list.
    59                         $cct_fields = $this->cctParser->getMetaFields($id);
     60                        $cct_fields = $this->cctParser->getMetaFields( $id );
    6061                        // Mark CCT fields so we can identify them later.
    61                         $cct_fields = array_map(function($x){
     62                        $cct_fields = array_map( function ( $x ) {
    6263                            $x['is_cct'] = true;
    6364
    6465                            // 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 ) {
    6768                                    $y['is_cct'] = true;
    6869
    6970                                    return $y;
    70                                 }, $x['repeater-fields']);
     71                                }, $x['repeater-fields'] );
    7172                            }
    7273
    7374                            return $x;
    74                         }, $cct_fields);
     75                        }, $cct_fields );
    7576
    7677                        // 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 );
    7879
    7980                    }
     81                }
    8082
     83                // Allow modifications of fields.
     84                $this->fields = apply_filters('cc_jetengine_importer_fields_list', $this->fields);
     85
     86                if( !empty($this->fields)){
    8187                    // Process glossary references in fields.
    8288                    $this->parseGlossaries();
  • importer-for-crocoblock-jetengine/tags/1.2/vendor/composer/installed.php

    r2824714 r2887267  
    66        'install_path' => __DIR__ . '/../../',
    77        'aliases' => array(),
    8         'reference' => 'db3fcff23dc78b884eebd14434f14819f704e979',
     8        'reference' => 'e9a6e95a74220b1bf0d161d73c10946a3bb1eaca',
    99        'name' => 'coding-chicken/importer-for-crocoblock-jetengine',
    1010        'dev' => true,
     
    1717            'install_path' => __DIR__ . '/../../',
    1818            'aliases' => array(),
    19             'reference' => 'db3fcff23dc78b884eebd14434f14819f704e979',
     19            'reference' => 'e9a6e95a74220b1bf0d161d73c10946a3bb1eaca',
    2020            'dev_requirement' => false,
    2121        ),
  • importer-for-crocoblock-jetengine/trunk/importer-for-crocoblock-jetengine.php

    r2864701 r2887267  
    33Plugin Name: Coding Chicken - JetEngine Importer
    44Description: A handy importer for JetEngine Meta Box fields - Requires WP All Import and JetEngine
    5 Version: 1.1
     5Version: 1.2
    66Author: Coding Chicken
    77Author URI: https://codingchicken.com
     
    2828const IMPORTER_JETENGINE_PREFIX = 'cc_jetengine_importer_';
    2929
    30 const IMPORTER_JETENGINE_VERSION = '1.1';
     30const IMPORTER_JETENGINE_VERSION = '1.2';
    3131
    3232// Require Composer autoloader.
     
    169169            //$this->constants();
    170170            $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            }
    171180           
    172181            //add_action( 'admin_enqueue_scripts', [ $this, 'cc_importer_jetengine_admin_scripts' ] );
     
    228237                    $priority = 10;
    229238                }
     239
    230240                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)
    231241
     
    289299    }
    290300
     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
    291328    /**
    292329     * @param $hook
  • importer-for-crocoblock-jetengine/trunk/readme.txt

    r2864701 r2887267  
    6666
    6767== Changelog ==
     68= 1.2 =
     69* bug fix: resolve issue where some JetEngine objects may not appear in the import configuration
     70
    6871= 1.1 =
    6972* 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  
    1616        static private $meta_title_shown = false;
    1717
     18        static private $relations_title_shown = false;
     19
    1820        public function __construct() {
    1921            self::$add_on = \CodingChicken\Importer\JetEngine\IMPORTER_JETENGINE_Plugin::getAddon();
     
    154156                self::$add_on->add_title('Meta fields');
    155157                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;
    156162            }
    157163
  • importer-for-crocoblock-jetengine/trunk/src/Parsers/ParseJetEngineData.php

    r2864701 r2887267  
    4343                }
    4444
     45                // Check if import is for a CCT.
     46                $id = $this->cctParser->getCctId($this->post_type);
     47
    4548                // Only proceed if there are fields to process.
    46                 if( !empty($this->fields)) {
     49                if( !empty($this->fields) || $id !== false) {
    4750
    4851                    // Indicate current fields are not cct.
    49                     $this->fields = array_map(function($x){
     52                    $this->fields = array_map( function ( $x ) {
    5053                        $x['is_cct'] = false;
     54
    5155                        return $x;
    52                     }, $this->fields);
     56                    }, $this->fields );
    5357
    54                     // Check if import is for a CCT.
    55                     $id = $this->cctParser->getCctId($this->post_type);
    56 
    57                     if($id){
     58                    if ( $id ) {
    5859                        // Retrieve CCT fields to add to list.
    59                         $cct_fields = $this->cctParser->getMetaFields($id);
     60                        $cct_fields = $this->cctParser->getMetaFields( $id );
    6061                        // Mark CCT fields so we can identify them later.
    61                         $cct_fields = array_map(function($x){
     62                        $cct_fields = array_map( function ( $x ) {
    6263                            $x['is_cct'] = true;
    6364
    6465                            // 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 ) {
    6768                                    $y['is_cct'] = true;
    6869
    6970                                    return $y;
    70                                 }, $x['repeater-fields']);
     71                                }, $x['repeater-fields'] );
    7172                            }
    7273
    7374                            return $x;
    74                         }, $cct_fields);
     75                        }, $cct_fields );
    7576
    7677                        // 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 );
    7879
    7980                    }
     81                }
    8082
     83                // Allow modifications of fields.
     84                $this->fields = apply_filters('cc_jetengine_importer_fields_list', $this->fields);
     85
     86                if( !empty($this->fields)){
    8187                    // Process glossary references in fields.
    8288                    $this->parseGlossaries();
  • importer-for-crocoblock-jetengine/trunk/vendor/composer/installed.php

    r2824714 r2887267  
    66        'install_path' => __DIR__ . '/../../',
    77        'aliases' => array(),
    8         'reference' => 'db3fcff23dc78b884eebd14434f14819f704e979',
     8        'reference' => 'e9a6e95a74220b1bf0d161d73c10946a3bb1eaca',
    99        'name' => 'coding-chicken/importer-for-crocoblock-jetengine',
    1010        'dev' => true,
     
    1717            'install_path' => __DIR__ . '/../../',
    1818            'aliases' => array(),
    19             'reference' => 'db3fcff23dc78b884eebd14434f14819f704e979',
     19            'reference' => 'e9a6e95a74220b1bf0d161d73c10946a3bb1eaca',
    2020            'dev_requirement' => false,
    2121        ),
Note: See TracChangeset for help on using the changeset viewer.