Plugin Directory

Changeset 2676428


Ignore:
Timestamp:
02/10/2022 02:51:38 PM (3 years ago)
Author:
soflyy
Message:

Release version 3.6.6

Location:
wp-all-import
Files:
637 added
4 edited

Legend:

Unmodified
Added
Removed
  • wp-all-import/trunk/models/import/record.php

    r2622630 r2676428  
    55    public static $cdata = array();
    66
    7     protected $errors; 
    8    
     7    protected $errors;
     8
    99    /**
    1010     * Some pre-processing logic, such as removing control characters from xml to prevent parsing errors
     
    1212     */
    1313    public static function preprocessXml( &$xml ) {
    14        
    15         if ( empty(PMXI_Plugin::$session->is_csv) and empty(PMXI_Plugin::$is_csv)){ 
    16        
    17             self::$cdata = array();                     
     14
     15        if ( empty(PMXI_Plugin::$session->is_csv) and empty(PMXI_Plugin::$is_csv)){
     16
     17            self::$cdata = array();
    1818
    1919            $is_preprocess_enabled = apply_filters('is_xml_preprocess_enabled', true);
     
    3030                  }
    3131                }
    32             }                               
    33         }       
     32            }
     33        }
    3434    }
    3535
     
    4444            $errors and $errors->add('form-validation', __('WP All Import can\'t read your file.<br/><br/>Probably, you are trying to import an invalid XML feed. Try opening the XML feed in a web browser (Google Chrome is recommended for opening XML files) to see if there is an error message.<br/>Alternatively, run the feed through a validator: http://validator.w3.org/<br/>99% of the time, the reason for this error is because your XML feed isn\'t valid.<br/>If you are 100% sure you are importing a valid XML feed, please contact WP All Import support.', 'wp_all_import_plugin'));
    4545        } else {
    46                        
    47             PMXI_Import_Record::preprocessXml($xml);                                                                                       
     46
     47            PMXI_Import_Record::preprocessXml($xml);
    4848
    4949            if ( function_exists('simplexml_load_string')){
     
    5151                libxml_clear_errors();
    5252                $_x = @simplexml_load_string($xml);
    53                 $xml_errors = libxml_get_errors();         
     53                $xml_errors = libxml_get_errors();
    5454                libxml_clear_errors();
    55                 if ($xml_errors) {                             
     55                if ($xml_errors) {
    5656                    $error_msg = '<strong>' . __('Invalid XML', 'wp_all_import_plugin') . '</strong><ul>';
    5757                    foreach($xml_errors as $error) {
     
    6464                    }
    6565                    $error_msg .= '</ul>';
    66                     $errors and $errors->add('form-validation', $error_msg);               
     66                    $errors and $errors->add('form-validation', $error_msg);
    6767                } else {
    6868                    return true;
     
    7070            }
    7171            else{
    72                 $errors and $errors->add('form-validation', __('Required PHP components are missing.', 'wp_all_import_plugin'));               
    73                 $errors and $errors->add('form-validation', __('WP All Import requires the SimpleXML PHP module to be installed. This is a standard feature of PHP, and is necessary for WP All Import to read the files you are trying to import.<br/>Please contact your web hosting provider and ask them to install and activate the SimpleXML PHP module.', 'wp_all_import_plugin'));             
     72                $errors and $errors->add('form-validation', __('Required PHP components are missing.', 'wp_all_import_plugin'));
     73                $errors and $errors->add('form-validation', __('WP All Import requires the SimpleXML PHP module to be installed. This is a standard feature of PHP, and is necessary for WP All Import to read the files you are trying to import.<br/>Please contact your web hosting provider and ask them to install and activate the SimpleXML PHP module.', 'wp_all_import_plugin'));
    7474            }
    7575        }
     
    674674        return $result;
    675675    }
    676    
     676
    677677    public $post_meta_to_insert = array();
    678678
     
    695695
    696696        $this->options += PMXI_Plugin::get_default_import_options(); // make sure all options are defined
    697        
     697
    698698        $avoid_pingbacks = PMXI_Plugin::getInstance()->getOption('pingbacks');
    699699
    700700        $cron_sleep = (int) PMXI_Plugin::getInstance()->getOption('cron_sleep');
    701        
     701
    702702        if ( $avoid_pingbacks and ! defined( 'WP_IMPORTING' ) ) define( 'WP_IMPORTING', true );
    703703
    704         $postRecord = new PMXI_Post_Record();       
    705        
     704        $postRecord = new PMXI_Post_Record();
     705
    706706        $tmp_files = array();
    707707        // compose records to import
     
    726726            $chunk == 1 and $logger and call_user_func($logger, __('Composing titles...', 'wp_all_import_plugin'));
    727727            if ( ! empty($this->options['title'])){
    728                 $titles = XmlImportParser::factory($xml, $cxpath, $this->options['title'], $file)->parse($records); $tmp_files[] = $file;                           
     728                $titles = XmlImportParser::factory($xml, $cxpath, $this->options['title'], $file)->parse($records); $tmp_files[] = $file;
    729729            }
    730730            else{
     
    772772
    773773            if ( "xpath" == $this->options['status'] ){
    774                 $chunk == 1 and $logger and call_user_func($logger, __('Composing statuses...', 'wp_all_import_plugin'));           
     774                $chunk == 1 and $logger and call_user_func($logger, __('Composing statuses...', 'wp_all_import_plugin'));
    775775                $post_status = array();
    776776                if ( ! empty($this->options['status_xpath']) && $this->is_parsing_required('is_update_status') ){
    777                     $post_status = XmlImportParser::factory($xml, $cxpath, $this->options['status_xpath'], $file)->parse($records); $tmp_files[] = $file;                   
     777                    $post_status = XmlImportParser::factory($xml, $cxpath, $this->options['status_xpath'], $file)->parse($records); $tmp_files[] = $file;
    778778                }
    779779                else{
     
    781781                }
    782782            }
    783            
     783
    784784            if ( "xpath" == $this->options['comment_status'] ){
    785                 $chunk == 1 and $logger and call_user_func($logger, __('Composing comment statuses...', 'wp_all_import_plugin'));           
     785                $chunk == 1 and $logger and call_user_func($logger, __('Composing comment statuses...', 'wp_all_import_plugin'));
    786786                $comment_status = array();
    787787                if (!empty($this->options['comment_status_xpath']) && $this->is_parsing_required('is_update_comment_status') ){
     
    794794
    795795            if ( "xpath" == $this->options['ping_status'] ){
    796                 $chunk == 1 and $logger and call_user_func($logger, __('Composing ping statuses...', 'wp_all_import_plugin'));         
     796                $chunk == 1 and $logger and call_user_func($logger, __('Composing ping statuses...', 'wp_all_import_plugin'));
    797797                $ping_status = array();
    798798                if (!empty($this->options['ping_status_xpath'])){
     
    805805
    806806            if ( "xpath" == $this->options['post_format'] ){
    807                 $chunk == 1 and $logger and call_user_func($logger, __('Composing post formats...', 'wp_all_import_plugin'));           
     807                $chunk == 1 and $logger and call_user_func($logger, __('Composing post formats...', 'wp_all_import_plugin'));
    808808                $post_format = array();
    809809                if (!empty($this->options['post_format_xpath'])){
     
    828828
    829829            if ( "no" == $this->options['is_multiple_page_template'] ){
    830                 $chunk == 1 and $logger and call_user_func($logger, __('Composing page templates...', 'wp_all_import_plugin'));         
     830                $chunk == 1 and $logger and call_user_func($logger, __('Composing page templates...', 'wp_all_import_plugin'));
    831831                $page_template = array();
    832832                if (!empty($this->options['single_page_template'])){
     
    836836                    count($titles) and $page_template = array_fill(0, count($titles), 'default');
    837837                }
    838             }           
     838            }
    839839
    840840            if ( $this->options['is_override_post_type'] and ! empty($this->options['post_type_xpath']) ){
     
    853853
    854854            if ( "no" == $this->options['is_multiple_page_parent'] ){
    855                 $chunk == 1 and $logger and call_user_func($logger, __('Composing page parent...', 'wp_all_import_plugin'));           
     855                $chunk == 1 and $logger and call_user_func($logger, __('Composing page parent...', 'wp_all_import_plugin'));
    856856                $page_parent = array();
    857857                if ( ! empty($this->options['single_page_parent']) && $this->is_parsing_required('is_update_parent') ){
     
    904904            }
    905905
    906             $chunk == 1 and $logger and call_user_func($logger, __('Composing slugs...', 'wp_all_import_plugin'));         
     906            $chunk == 1 and $logger and call_user_func($logger, __('Composing slugs...', 'wp_all_import_plugin'));
    907907            $post_slug = array();
    908908            if (!empty($this->options['post_slug']) && $this->is_parsing_required('is_update_slug') ){
     
    921921            }
    922922
    923             $chunk == 1 and $logger and call_user_func($logger, __('Composing menu order...', 'wp_all_import_plugin'));         
     923            $chunk == 1 and $logger and call_user_func($logger, __('Composing menu order...', 'wp_all_import_plugin'));
    924924            $menu_order = array();
    925925            if (!empty($this->options['order']) && $this->is_parsing_required('is_update_menu_order')){
     
    930930            }
    931931
    932             $chunk == 1 and $logger and call_user_func($logger, __('Composing contents...', 'wp_all_import_plugin'));                                   
     932            $chunk == 1 and $logger and call_user_func($logger, __('Composing contents...', 'wp_all_import_plugin'));
    933933            if (!empty($this->options['content']) && $this->is_parsing_required('is_update_content') ){
    934934                $contents = XmlImportParser::factory(
     
    937937                    $this->options['content'],
    938938                    $file)->parse($records
    939                 ); $tmp_files[] = $file;                       
     939                ); $tmp_files[] = $file;
    940940            }
    941941            else{
    942942                count($titles) and $contents = array_fill(0, count($titles), '');
    943943            }
    944                                        
     944
    945945            $chunk == 1 and $logger and call_user_func($logger, __('Composing dates...', 'wp_all_import_plugin'));
    946946            if ( $this->is_parsing_required('is_update_dates') ){
     
    982982                count($titles) and $dates = array_fill(0, count($titles), date('Y-m-d H:i:s', strtotime(current_time('mysql'))));
    983983            }
    984                        
     984
    985985            // [custom taxonomies]
    986986            require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
    987987
    988             $taxonomies = array();                     
     988            $taxonomies = array();
    989989            $exclude_taxonomies = apply_filters('pmxi_exclude_taxonomies', (class_exists('PMWI_Plugin')) ? array('post_format', 'product_type', 'product_shipping_class', 'product_visibility') : array('post_format'));
    990990            $post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($this->options['custom_type']), 'object'), array_flip($exclude_taxonomies));
     
    999999                            case 'single':
    10001000                                if ( isset($this->options['tax_single_xpath'][$tx_name]) && $this->options['tax_single_xpath'][$tx_name] !== "" ){
    1001                                     $txes = XmlImportParser::factory($xml, $cxpath, $this->options['tax_single_xpath'][$tx_name], $file)->parse($records); $tmp_files[] = $file;       
     1001                                    $txes = XmlImportParser::factory($xml, $cxpath, $this->options['tax_single_xpath'][$tx_name], $file)->parse($records); $tmp_files[] = $file;
    10021002                                    foreach ($txes as $i => $tx) {
    10031003                                        $taxonomies[$tx_name][$i][] = wp_all_import_ctx_mapping(array(
     
    10091009                                            'max_hierarchy_level' => 1
    10101010                                        ), $mapping_rules, $tx_name);
    1011                                     }                                   
     1011                                    }
    10121012                                }
    10131013                                break;
    10141014                            case 'multiple':
    10151015                                if ( ! empty($this->options['tax_multiple_xpath'][$tx_name]) ){
    1016                                     $txes = XmlImportParser::factory($xml, $cxpath, $this->options['tax_multiple_xpath'][$tx_name], $file)->parse($records); $tmp_files[] = $file;                                         
     1016                                    $txes = XmlImportParser::factory($xml, $cxpath, $this->options['tax_multiple_xpath'][$tx_name], $file)->parse($records); $tmp_files[] = $file;
    10171017                                    foreach ($txes as $i => $tx) {
    10181018                                        $_tx = $tx;
    10191019                                        // apply mapping rules before splitting via separator symbol
    1020                                         if ( ! empty($this->options['tax_enable_mapping'][$tx_name]) and ! empty($this->options['tax_logic_mapping'][$tx_name]) ){                                         
    1021                                             if ( ! empty( $mapping_rules) ){           
     1020                                        if ( ! empty($this->options['tax_enable_mapping'][$tx_name]) and ! empty($this->options['tax_logic_mapping'][$tx_name]) ){
     1021                                            if ( ! empty( $mapping_rules) ){
    10221022                                                foreach ($mapping_rules as $rule) {
    1023                                                     if ( ! empty($rule[trim($_tx)])){ 
     1023                                                    if ( ! empty($rule[trim($_tx)])){
    10241024                                                        $_tx = trim($rule[trim($_tx)]);
    10251025                                                        break;
     
    10271027                                                }
    10281028                                            }
    1029                                         }                                       
    1030                                         $delimeted_taxonomies = explode( ! empty($this->options['tax_multiple_delim'][$tx_name]) ? $this->options['tax_multiple_delim'][$tx_name] : ',', $_tx);                                     
     1029                                        }
     1030                                        $delimeted_taxonomies = explode( ! empty($this->options['tax_multiple_delim'][$tx_name]) ? $this->options['tax_multiple_delim'][$tx_name] : ',', $_tx);
    10311031                                        if ( ! empty($delimeted_taxonomies) ){
    1032                                             foreach ($delimeted_taxonomies as $cc) {                                               
     1032                                            foreach ($delimeted_taxonomies as $cc) {
    10331033                                                $taxonomies[$tx_name][$i][] = wp_all_import_ctx_mapping(array(
    10341034                                                    'name' => $cc,
     
    10401040                                                ), $mapping_rules, $tx_name);
    10411041                                            }
    1042                                         }                                       
     1042                                        }
    10431043                                    }
    10441044                                }
    10451045                                break;
    10461046                            case 'hierarchical':
    1047                                 if ( ! empty($this->options['tax_hierarchical_logic_entire'][$tx_name])){                                   
     1047                                if ( ! empty($this->options['tax_hierarchical_logic_entire'][$tx_name])){
    10481048                                    if (! empty($this->options['tax_hierarchical_xpath'][$tx_name]) and is_array($this->options['tax_hierarchical_xpath'][$tx_name])){
    10491049                                        count($titles) and $iterator = array_fill(0, count($titles), 0);
    10501050                                        $taxonomies_hierarchy_groups = array_fill(0, count($titles), array());
    1051                                        
     1051
    10521052                                        // separate hierarchy groups via symbol
    10531053                                        if ( ! empty($this->options['is_tax_hierarchical_group_delim'][$tx_name]) and ! empty($this->options['tax_hierarchical_group_delim'][$tx_name])){
    1054                                             foreach ($this->options['tax_hierarchical_xpath'][$tx_name] as $k => $tx_xpath) { 
     1054                                            foreach ($this->options['tax_hierarchical_xpath'][$tx_name] as $k => $tx_xpath) {
    10551055                                                if (empty($tx_xpath)) continue;
    1056                                                 $txes = XmlImportParser::factory($xml, $cxpath, $tx_xpath, $file)->parse($records); $tmp_files[] = $file;                   
     1056                                                $txes = XmlImportParser::factory($xml, $cxpath, $tx_xpath, $file)->parse($records); $tmp_files[] = $file;
    10571057                                                foreach ($txes as $i => $tx) {
    10581058                                                    $_tx = $tx;
    10591059                                                    // apply mapping rules before splitting via separator symbol
    1060                                                     if ( ! empty($this->options['tax_enable_mapping'][$tx_name]) and ! empty($this->options['tax_logic_mapping'][$tx_name]) ){                                         
    1061                                                         if ( ! empty( $mapping_rules) ){           
     1060                                                    if ( ! empty($this->options['tax_enable_mapping'][$tx_name]) and ! empty($this->options['tax_logic_mapping'][$tx_name]) ){
     1061                                                        if ( ! empty( $mapping_rules) ){
    10621062                                                            foreach ($mapping_rules as $rule) {
    1063                                                                 if ( ! empty($rule[trim($_tx)])){ 
     1063                                                                if ( ! empty($rule[trim($_tx)])){
    10641064                                                                    $_tx = trim($rule[trim($_tx)]);
    10651065                                                                    break;
     
    10741074                                                        }
    10751075                                                    }
    1076                                                 }                                               
     1076                                                }
    10771077                                            }
    10781078                                        }
     
    10801080                                            foreach ($this->options['tax_hierarchical_xpath'][$tx_name] as $k => $tx_xpath) {
    10811081                                                if (empty($tx_xpath)) continue;
    1082                                                 $txes = XmlImportParser::factory($xml, $cxpath, $tx_xpath, $file)->parse($records); $tmp_files[] = $file;                   
    1083                                                 foreach ($txes as $i => $tx) {                                                 
     1082                                                $txes = XmlImportParser::factory($xml, $cxpath, $tx_xpath, $file)->parse($records); $tmp_files[] = $file;
     1083                                                foreach ($txes as $i => $tx) {
    10841084                                                    array_push($taxonomies_hierarchy_groups[$i], $tx);
    10851085                                                }
    10861086                                            }
    10871087                                        }
    1088                                        
     1088
    10891089                                        foreach ($taxonomies_hierarchy_groups as $i => $groups) { if (empty($groups)) continue;
    1090                                             foreach ($groups as $kk => $tx) {                                                                                                                                           
     1090                                            foreach ($groups as $kk => $tx) {
    10911091                                                $_tx = $tx;
    10921092                                                // apply mapping rules before splitting via separator symbol
    1093                                                 if ( ! empty($this->options['tax_enable_mapping'][$tx_name]) and ! empty($this->options['tax_logic_mapping'][$tx_name]) ){                                         
    1094                                                     if ( ! empty( $mapping_rules) ){           
    1095                                                         foreach ($mapping_rules as $rule) {                                                         
    1096                                                             if ( ! empty($rule[trim($_tx)])){ 
     1093                                                if ( ! empty($this->options['tax_enable_mapping'][$tx_name]) and ! empty($this->options['tax_logic_mapping'][$tx_name]) ){
     1094                                                    if ( ! empty( $mapping_rules) ){
     1095                                                        foreach ($mapping_rules as $rule) {
     1096                                                            if ( ! empty($rule[trim($_tx)])){
    10971097                                                                $_tx = trim($rule[trim($_tx)]);
    10981098                                                                break;
     
    11021102                                                }
    11031103                                                $delimeted_taxonomies = array_filter(array_filter(explode( ! empty($this->options['tax_hierarchical_delim'][$tx_name]) ? $this->options['tax_hierarchical_delim'][$tx_name] : ',', $_tx)));
    1104                                                 if ( ! empty($delimeted_taxonomies) ){                                                         
    1105                                                     foreach ($delimeted_taxonomies as $j => $cc) {                                                                                                             
     1104                                                if ( ! empty($delimeted_taxonomies) ){
     1105                                                    foreach ($delimeted_taxonomies as $j => $cc) {
    11061106                                                        $is_assign_term = true;
    11071107                                                        if ( ! empty($this->options['tax_hierarchical_last_level_assign'][$tx_name]) ){
     
    11161116                                                            'max_hierarchy_level' => count($delimeted_taxonomies)
    11171117                                                        ), $mapping_rules, $tx_name);
    1118                                                         $iterator[$i]++;   
     1118                                                        $iterator[$i]++;
    11191119                                                    }
    1120                                                 }                                                   
     1120                                                }
    11211121                                            }
    1122                                         }                                       
     1122                                        }
    11231123                                    }
    11241124                                }
    1125                                 if ( ! empty($this->options['tax_hierarchical_logic_manual'][$tx_name])){                                   
     1125                                if ( ! empty($this->options['tax_hierarchical_logic_manual'][$tx_name])){
    11261126                                    if ( ! empty($this->options['post_taxonomies'][$tx_name]) ){
    11271127                                        $taxonomies_hierarchy = json_decode($this->options['post_taxonomies'][$tx_name], true);
    1128                                        
    1129                                         foreach ($taxonomies_hierarchy as $k => $taxonomy){ if ("" == $taxonomy['xpath']) continue;                             
    1130                                             $txes_raw =  XmlImportParser::factory($xml, $cxpath, $taxonomy['xpath'], $file)->parse($records); $tmp_files[] = $file;                     
     1128
     1129                                        foreach ($taxonomies_hierarchy as $k => $taxonomy){ if ("" == $taxonomy['xpath']) continue;
     1130                                            $txes_raw =  XmlImportParser::factory($xml, $cxpath, $taxonomy['xpath'], $file)->parse($records); $tmp_files[] = $file;
    11311131                                            $warned = array();
    1132                                            
     1132
    11331133                                            foreach ($txes_raw as $i => $cc) {
    11341134
    11351135                                                $_tx = $cc;
    11361136                                                // apply mapping rules before splitting via separator symbol
    1137                                                 if ( ! empty($this->options['tax_enable_mapping'][$tx_name]) and ! empty($this->options['tax_logic_mapping'][$tx_name]) ){                                         
    1138                                                     if ( ! empty( $mapping_rules) ){           
     1137                                                if ( ! empty($this->options['tax_enable_mapping'][$tx_name]) and ! empty($this->options['tax_logic_mapping'][$tx_name]) ){
     1138                                                    if ( ! empty( $mapping_rules) ){
    11391139                                                        foreach ($mapping_rules as $rule) {
    1140                                                             if ( ! empty($rule[trim($_tx)])){ 
     1140                                                            if ( ! empty($rule[trim($_tx)])){
    11411141                                                                $_tx = trim($rule[trim($_tx)]);
    11421142                                                                break;
     
    11451145                                                    }
    11461146                                                }
    1147                                                
     1147
    11481148                                                if ( ! empty($this->options['tax_manualhierarchy_delim'][$tx_name])){
    11491149                                                    $delimeted_taxonomies = explode($this->options['tax_manualhierarchy_delim'][$tx_name], $_tx);
    11501150                                                }
    1151                                                
     1151
    11521152                                                if ( empty($delimeted_taxonomies) ) continue;
    11531153
    11541154                                                if (empty($taxonomies_hierarchy[$k]['txn_names'][$i])) $taxonomies_hierarchy[$k]['txn_names'][$i] = array();
    11551155                                                if (empty($taxonomies[$tx_name][$i])) $taxonomies[$tx_name][$i] = array();
    1156                                                 $count_cats = count($taxonomies[$tx_name][$i]);                                                                                                         
    1157                                                
     1156                                                $count_cats = count($taxonomies[$tx_name][$i]);
     1157
    11581158                                                foreach ($delimeted_taxonomies as $j => $dc) {
    1159                                                    
    1160                                                     if (!empty($taxonomy['parent_id'])) {                                                                           
     1159
     1160                                                    if (!empty($taxonomy['parent_id'])) {
    11611161                                                        foreach ($taxonomies_hierarchy as $key => $value){
    1162                                                             if ($value['item_id'] == $taxonomy['parent_id'] and !empty($value['txn_names'][$i])){                                                   
    1163                                                                 foreach ($value['txn_names'][$i] as $parent) {                                                                         
     1162                                                            if ($value['item_id'] == $taxonomy['parent_id'] and !empty($value['txn_names'][$i])){
     1163                                                                foreach ($value['txn_names'][$i] as $parent) {
    11641164                                                                    $taxonomies[$tx_name][$i][] = wp_all_import_ctx_mapping(array(
    11651165                                                                        'name' => trim($dc),
     
    11721172
    11731173                                                                    $taxonomies_hierarchy[$k]['txn_names'][$i][] = $taxonomies[$tx_name][$i][count($taxonomies[$tx_name][$i]) - 1];
    1174                                                                 }                                                                                                               
     1174                                                                }
    11751175                                                            }
    1176                                                         }                                                           
     1176                                                        }
    11771177                                                    }
    1178                                                     else {                                                             
     1178                                                    else {
    11791179                                                        $taxonomies[$tx_name][$i][] = wp_all_import_ctx_mapping(array(
    11801180                                                            'name' => trim($dc),
     
    11881188                                                        $taxonomies_hierarchy[$k]['txn_names'][$i][] = $taxonomies[$tx_name][$i][count($taxonomies[$tx_name][$i]) - 1];
    11891189                                                    }
    1190                                                 }                                                                                                                       
     1190                                                }
    11911191                                            }
    11921192                                        }
    11931193                                    }
    1194                                 }                                                                                                           
     1194                                }
    11951195                                break;
    11961196
    11971197                            default:
    1198                                            
     1198
    11991199                                break;
    12001200                        }
    12011201                    }
    12021202                endforeach;
    1203             endif;         
     1203            endif;
    12041204            // [/custom taxonomies]
    12051205
    12061206            // Composing featured images
    1207             $image_sections = apply_filters('wp_all_import_image_sections', array( 
     1207            $image_sections = apply_filters('wp_all_import_image_sections', array(
    12081208                array(
    12091209                    'slug'  => '',
     
    12111211                    'type'  => 'images'
    12121212                )
    1213             )); 
     1213            ));
    12141214
    12151215            if ( ! (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
    12161216                $logger and call_user_func($logger, __('<b>WARNING</b>', 'wp_all_import_plugin') . ': ' . $uploads['error']);
    1217                 $logger and call_user_func($logger, __('<b>WARNING</b>: No featured images will be created. Uploads folder is not found.', 'wp_all_import_plugin'));               
    1218                 $logger and !$is_cron and PMXI_Plugin::$session->warnings++;               
     1217                $logger and call_user_func($logger, __('<b>WARNING</b>: No featured images will be created. Uploads folder is not found.', 'wp_all_import_plugin'));
     1218                $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
    12191219            } else {
    12201220                $images_bundle = array();
     
    13321332            // Composing attachments
    13331333            if ( ! (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
    1334                 $logger and call_user_func($logger, __('<b>WARNING</b>', 'wp_all_import_plugin') . ': ' . $uploads['error']);               
    1335                 $logger and call_user_func($logger, __('<b>WARNING</b>: No attachments will be created', 'wp_all_import_plugin'));             
     1334                $logger and call_user_func($logger, __('<b>WARNING</b>', 'wp_all_import_plugin') . ': ' . $uploads['error']);
     1335                $logger and call_user_func($logger, __('<b>WARNING</b>: No attachments will be created', 'wp_all_import_plugin'));
    13361336                $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
    13371337            } else {
     
    13471347                        if ($parse_multiple) {
    13481348                            foreach($atchs as $atch) {
    1349                                 $posts_attachments = XmlImportParser::factory($xml, $cxpath, trim($atch), $file)->parse($records); $tmp_files[] = $file;                                                               
    1350                                 foreach($posts_attachments as $i => $val) $attachments[$i][] = $val;                               
     1349                                $posts_attachments = XmlImportParser::factory($xml, $cxpath, trim($atch), $file)->parse($records); $tmp_files[] = $file;
     1350                                foreach($posts_attachments as $i => $val) $attachments[$i][] = $val;
    13511351                            }
    13521352                        }
    13531353                        else {
    1354                             $attachments = XmlImportParser::factory($xml, $cxpath, $this->options['attachments'], $file)->parse($records); $tmp_files[] = $file;                               
     1354                            $attachments = XmlImportParser::factory($xml, $cxpath, $this->options['attachments'], $file)->parse($records); $tmp_files[] = $file;
    13551355                        }
    13561356                    }
     
    13681368            }
    13691369
    1370             $chunk == 1 and $logger and call_user_func($logger, __('Processing posts...', 'wp_all_import_plugin'));                                                         
     1370            $chunk == 1 and $logger and call_user_func($logger, __('Processing posts...', 'wp_all_import_plugin'));
    13711371
    13721372            $addons = array();
     
    13811381                'logger' => $logger,
    13821382                'chunk'  => $chunk,
    1383                 'xpath_prefix' => $xpath_prefix             
     1383                'xpath_prefix' => $xpath_prefix
    13841384            );
    13851385            $parse_functions = apply_filters('wp_all_import_addon_parse', array());
    1386             foreach (PMXI_Admin_Addons::get_active_addons() as $class) {                           
    1387                 $model_class = str_replace("_Plugin", "_Import_Record", $class);   
    1388                 if (class_exists($model_class)){                       
     1386            foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
     1387                $model_class = str_replace("_Plugin", "_Import_Record", $class);
     1388                if (class_exists($model_class)){
    13891389                    $addons[$class] = new $model_class();
    1390                     $addons_data[$class] = ( method_exists($addons[$class], 'parse') ) ? $addons[$class]->parse($parsingData) : false;             
     1390                    $addons_data[$class] = ( method_exists($addons[$class], 'parse') ) ? $addons[$class]->parse($parsingData) : false;
    13911391                } else {
    13921392                    if ( ! empty($parse_functions[$class]) ){
    13931393                        if ( is_array($parse_functions[$class]) and is_callable($parse_functions[$class]) or ! is_array($parse_functions[$class]) and function_exists($parse_functions[$class])  ){
    1394                             $addons_data[$class] = call_user_func($parse_functions[$class], $parsingData);                 
     1394                            $addons_data[$class] = call_user_func($parse_functions[$class], $parsingData);
    13951395                        }
    13961396                    }
     
    13981398            }
    13991399
    1400             // save current import state to variables before import         
     1400            // save current import state to variables before import
    14011401            $created = $this->created;
    14021402            $updated = $this->updated;
    1403             $skipped = $this->skipped;         
    1404            
     1403            $skipped = $this->skipped;
     1404
    14051405            $specified_records = array();
    14061406
    14071407            $simpleXml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
    1408    
     1408
    14091409            $rootNodes = $simpleXml->xpath($cxpath);
    14101410
     
    14371437                }
    14381438
    1439                 if ($is_cron and $cron_sleep) sleep($cron_sleep);       
     1439                if ($is_cron and $cron_sleep) sleep($cron_sleep);
    14401440
    14411441                $logger and call_user_func($logger, __('---', 'wp_all_import_plugin'));
    14421442                $logger and call_user_func($logger, sprintf(__('Record #%s', 'wp_all_import_plugin'), $this->imported + $this->skipped + $i + 1));
    14431443
    1444                 if ( "manual" == $this->options['duplicate_matching'] 
    1445                         and ! empty($specified_records) 
     1444                if ( "manual" == $this->options['duplicate_matching']
     1445                        and ! empty($specified_records)
    14461446                            and ! in_array($created + $updated + $skipped + 1, $specified_records) )
    14471447                {
    1448                     $skipped++;                                         
     1448                    $skipped++;
    14491449                    $logger and call_user_func($logger, __('<b>SKIPPED</b>: by specified records option', 'wp_all_import_plugin'));
    1450                     $logger and !$is_cron and PMXI_Plugin::$session->warnings++;                   
     1450                    $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
    14511451                    $logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
    1452                     $logger and !$is_cron and PMXI_Plugin::$session->save_data();                               
    1453                     continue;                                                                       
     1452                    $logger and !$is_cron and PMXI_Plugin::$session->save_data();
     1453                    continue;
    14541454                }
    14551455
     
    14691469                        $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
    14701470                    }
    1471                 }               
     1471                }
    14721472
    14731473                switch ($this->options['custom_type']){
     
    15791579                        break;
    15801580                }
    1581                
     1581
    15821582                // Re-import Records Matching
    15831583                $post_to_update = false; $post_to_update_id = false;
    15841584
    15851585                // An array representation of current XML node
    1586                 $current_xml_node = wp_all_import_xml2array($rootNodes[$i]);               
     1586                $current_xml_node = wp_all_import_xml2array($rootNodes[$i]);
    15871587
    15881588                $check_for_duplicates = apply_filters('wp_all_import_is_check_duplicates', true, $this->id);
     
    15911591                    // if Auto Matching re-import option selected
    15921592                    if ( "manual" != $this->options['duplicate_matching'] ) {
    1593                         // find corresponding article among previously imported             
     1593                        // find corresponding article among previously imported
    15941594                        $logger and call_user_func($logger, sprintf(__('Find corresponding article among previously imported for post `%s`...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
    15951595                        $postList = new PMXI_Post_List();
     
    16231623                            $logger and call_user_func($logger, sprintf(__('Duplicate post wasn\'t found with unique key `%s`...', 'wp_all_import_plugin'), wp_all_import_clear_xss($unique_keys[$i])));
    16241624                        }
    1625                                                                    
     1625
    16261626                    // if Manual Matching re-import option seleted
    16271627                    } else {
    1628                                            
     1628
    16291629                        if ('custom field' == $this->options['duplicate_indicator']) {
    16301630                            $custom_duplicate_value = XmlImportParser::factory($xml, $cxpath, $this->options['custom_duplicate_value'], $file)->parse($records); $tmp_files[] = $file;
     
    16331633                            count($titles) and $custom_duplicate_name = $custom_duplicate_value = array_fill(0, count($titles), '');
    16341634                        }
    1635                        
     1635
    16361636                        $logger and call_user_func($logger, sprintf(__('Find corresponding article among database for post `%s`...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
    16371637
     
    16771677                        }
    16781678                    }
    1679                 }   
     1679                }
    16801680
    16811681                $is_post_to_skip = apply_filters('wp_all_import_is_post_to_skip', false, $this->id, $current_xml_node, $i, $post_to_update_id, $simpleXml);
     
    16861686                    }
    16871687                    $skipped++;
    1688                     $logger and !$is_cron and PMXI_Plugin::$session->warnings++;                   
     1688                    $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
    16891689                    $logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
    1690                     $logger and !$is_cron and PMXI_Plugin::$session->save_data();                       
    1691                     continue;                                                                       
    1692                 }           
     1690                    $logger and !$is_cron and PMXI_Plugin::$session->save_data();
     1691                    continue;
     1692                }
    16931693
    16941694                if ( ! empty($specified_records) ) {
     
    16971697                            $postRecord->set(array('iteration' => $this->iteration))->update();
    16981698                        }
    1699                         $skipped++;                                         
     1699                        $skipped++;
    17001700                        $logger and call_user_func($logger, __('<b>SKIPPED</b>: by specified records option', 'wp_all_import_plugin'));
    1701                         $logger and !$is_cron and PMXI_Plugin::$session->warnings++;                   
     1701                        $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
    17021702                        $logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
    1703                         $logger and !$is_cron and PMXI_Plugin::$session->save_data();                       
     1703                        $logger and !$is_cron and PMXI_Plugin::$session->save_data();
    17041704                        continue;
    1705                     }                                       
    1706                 }               
     1705                    }
     1706                }
    17071707
    17081708                $missing_images = array();
     
    17161716                    if ( ! $continue_import ){
    17171717
    1718                         if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update(); 
     1718                        if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update();
    17191719
    17201720                        $skipped++;
    17211721                        $logger and call_user_func($logger, sprintf(__('<b>SKIPPED</b>: By filter wp_all_import_is_post_to_update `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
    1722                         $logger and !$is_cron and PMXI_Plugin::$session->warnings++;                           
    1723                         $logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;   
    1724                         $logger and !$is_cron and PMXI_Plugin::$session->save_data();   
     1722                        $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
     1723                        $logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
     1724                        $logger and !$is_cron and PMXI_Plugin::$session->save_data();
    17251725                        do_action('wp_all_import_post_skipped', $post_to_update_id, $this->id, $current_xml_node);
    17261726                        continue;
     
    17301730
    17311731                    // Do not update already existing records option selected
    1732                     if ("yes" == $this->options['is_keep_former_posts']) { 
    1733 
    1734                         if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update(); 
     1732                    if ("yes" == $this->options['is_keep_former_posts']) {
     1733
     1734                        if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update();
    17351735
    17361736                        do_action('pmxi_do_not_update_existing', $post_to_update_id, $this->id, $this->iteration, $xml, $i);
     
    17381738                        $skipped++;
    17391739                        $logger and call_user_func($logger, sprintf(__('<b>SKIPPED</b>: Previously imported record found for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
    1740                         $logger and !$is_cron and PMXI_Plugin::$session->warnings++;                           
    1741                         $logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;   
    1742                         $logger and !$is_cron and PMXI_Plugin::$session->save_data();   
     1740                        $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
     1741                        $logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
     1742                        $logger and !$is_cron and PMXI_Plugin::$session->save_data();
    17431743                        do_action('wp_all_import_post_skipped', $post_to_update_id, $this->id, $current_xml_node);
    17441744                        continue;
     
    19641964                }
    19651965                elseif ( ! $postRecord->isEmpty() ){
    1966                    
     1966
    19671967                    // existing post not found though it's track was found... clear the leftover, plugin will continue to treat record as new
    19681968                    $postRecord->clear();
    1969                    
    1970                 }               
     1969
     1970                }
    19711971
    19721972                $logger and call_user_func($logger, sprintf(__('Applying filter `pmxi_article_data` for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
    19731973                $articleData = apply_filters('pmxi_article_data', $articleData, $this, $post_to_update, $current_xml_node);
    1974                
     1974
    19751975                // no new records are created. it will only update posts it finds matching duplicates for
    1976                 if (  ! $this->options['create_new_records'] and empty($articleData['ID']) ){ 
    1977                    
     1976                if (  ! $this->options['create_new_records'] and empty($articleData['ID']) ){
     1977
    19781978                    if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update();
    19791979
    19801980                    $logger and call_user_func($logger, __('<b>SKIPPED</b>: The option \'Create new posts from records newly present in your file\' is disabled in your import settings.', 'wp_all_import_plugin'));
    1981                     $logger and !$is_cron and PMXI_Plugin::$session->warnings++;                               
     1981                    $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
    19821982                    $logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
    1983                     $skipped++;     
    1984                     $logger and !$is_cron and PMXI_Plugin::$session->save_data();   
     1983                    $skipped++;
     1984                    $logger and !$is_cron and PMXI_Plugin::$session->save_data();
    19851985                    do_action('wp_all_import_post_skipped', 0, $this->id, $current_xml_node);
    19861986                    continue;
    19871987                }
    1988                
     1988
    19891989                // cloak urls with `WP Wizard Cloak` if corresponding option is set
    19901990                if ( ! empty($this->options['is_cloak']) and class_exists('PMLC_Plugin')) {
     
    20622062                        }
    20632063                    }
    2064                 }       
    2065 
    2066                 // insert article being imported                       
     2064                }
     2065
     2066                // insert article being imported
    20672067                if ($this->options['is_fast_mode']){
    20682068                    foreach (array('transition_post_status', 'save_post', 'pre_post_update', 'add_attachment', 'edit_attachment', 'edit_post', 'post_updated', 'wp_insert_post', 'save_post_' . $post_type[$i]) as $act) {
     
    20762076                    $continue_import = apply_filters('wp_all_import_is_post_to_create', $continue_import, $current_xml_node, $this->id);
    20772077
    2078                     if ( ! $continue_import ){                     
     2078                    if ( ! $continue_import ){
    20792079                        $skipped++;
    20802080                        $logger and call_user_func($logger, sprintf(__('<b>SKIPPED</b>: By filter wp_all_import_is_post_to_create `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
    2081                         $logger and !$is_cron and PMXI_Plugin::$session->warnings++;                           
    2082                         $logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;   
    2083                         $logger and !$is_cron and PMXI_Plugin::$session->save_data();   
     2081                        $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
     2082                        $logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
     2083                        $logger and !$is_cron and PMXI_Plugin::$session->save_data();
    20842084                        do_action('wp_all_import_post_skipped', 0, $this->id, $current_xml_node);
    20852085                        continue;
     
    22062206                        break;
    22072207                }
    2208                
     2208
    22092209                if (empty($pid)) {
    22102210                    $logger and call_user_func($logger, __('<b>ERROR</b>', 'wp_all_import_plugin') . ': something wrong, ID = 0 was generated.');
     
    22282228
    22292229                    if ("manual" != $this->options['duplicate_matching'] or empty($articleData['ID'])){
    2230                         // associate post with import                                               
     2230                        // associate post with import
    22312231                        $product_key = (($post_type[$i] == "product" and PMXI_Admin_Addons::get_addon('PMWI_Plugin')) ? $addons_data['PMWI_Plugin']['single_product_ID'][$i] : '');
    22322232                        if ($post_type[$i] == "taxonomies"){
     
    23142314                    foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
    23152315                        if (class_exists($class)) {
    2316                             if ( method_exists($addons[$class], 'import') ) $addons[$class]->import($importData);   
     2316                            if ( method_exists($addons[$class], 'import') ) $addons[$class]->import($importData);
    23172317                        } else {
    23182318                            if (!empty($import_functions[$class])) {
    23192319                                if (is_array($import_functions[$class]) and is_callable($import_functions[$class]) or ! is_array($import_functions[$class]) and function_exists($import_functions[$class]) ) {
    2320                                     call_user_func($import_functions[$class], $importData, $addons_data[$class]);           
    2321                                 }                           
     2320                                    call_user_func($import_functions[$class], $importData, $addons_data[$class]);
     2321                                }
    23222322                            }
    23232323                        }
     
    23312331                        update_post_meta($pid, '_wp_page_template', ("no" == $this->options['is_multiple_page_template']) ? $page_template[$i] : $this->options['page_template']);
    23322332                    }
    2333                    
     2333
    23342334                    // [featured image]
    23352335
     
    24422442                                }
    24432443
    2444                                 if (empty($image) || !preg_match('%^(http|ftp)s?://%i', $image)) continue;
     2444                                if (empty($image) || !preg_match('%\W(jpg|jpeg|png|gif|webp|svg)$%i', trim(basename($image)))) continue;
    24452445
    24462446                                $attid = false;
     
    25812581
    25822582                        if ( ! empty($images_bundle) ){
    2583                            
    2584                             require_once(ABSPATH . 'wp-admin/includes/image.php'); 
     2583
     2584                            require_once(ABSPATH . 'wp-admin/includes/image.php');
    25852585
    25862586                            $is_show_add_new_images = apply_filters('wp_all_import_is_show_add_new_images', true, $post_type[$i]);
     
    25912591
    25922592                                if ( ! $is_images_section_enabled && $slug == 'pmxi_gallery_image' ) continue;
    2593                                
     2593
    25942594                                $featured_images = $bundle_data['files'];
    25952595
    25962596                                $option_slug = ($slug == 'pmxi_gallery_image') ? '' : $slug;
    25972597
    2598                                 $gallery_attachment_ids = array(); 
     2598                                $gallery_attachment_ids = array();
    25992599
    26002600                                if ( ! empty($featured_images[$i]) ){
     
    26062606                                        $logger and call_user_func($logger, sprintf(__('<b>ERROR</b>: Target directory %s is not writable', 'wp_all_import_plugin'), $targetDir));
    26072607                                    }
    2608                                     else{                                                           
    2609                                        
    2610                                         $success_images = false;   
    2611                                                                                                            
     2608                                    else{
     2609
     2610                                        $success_images = false;
     2611
    26122612                                        $imgs = array();
    26132613
     
    26182618                                            case 'gallery':
    26192619                                                $featured_delim = $this->options[$option_slug . 'gallery_featured_delim'];
    2620                                                 break;                                         
     2620                                                break;
    26212621                                            default: // yes
    26222622                                                $featured_delim = $this->options[$option_slug . 'download_featured_delim'];
    26232623                                                break;
    2624                                         }                                       
     2624                                        }
    26252625
    26262626                                        $line_imgs = explode("\n", $featured_images[$i]);
    26272627                                        if ( ! empty($line_imgs) )
    26282628                                            foreach ($line_imgs as $line_img)
    2629                                                 $imgs = array_merge($imgs, ( ! empty($featured_delim) ) ? str_getcsv($line_img, $featured_delim) : array($line_img) );                             
     2629                                                $imgs = array_merge($imgs, ( ! empty($featured_delim) ) ? str_getcsv($line_img, $featured_delim) : array($line_img) );
    26302630
    26312631                                        // keep existing and add newest images
    26322632                                        if ( ! empty($articleData['ID']) and $this->options['is_update_images'] and $this->options['update_images_logic'] == "add_new" and $this->options['update_all_data'] == "no" and $is_show_add_new_images){
    2633                                            
     2633
    26342634                                            $logger and call_user_func($logger, __('- Keep existing and add newest images ...', 'wp_all_import_plugin'));
    26352635
    2636                                             $attachment_imgs = get_attached_media( 'image', $pid ); 
     2636                                            $attachment_imgs = get_attached_media( 'image', $pid );
    26372637
    26382638                                            if ( $post_type[$i] == "product" ){
     
    26402640                                            }
    26412641
    2642                                             if ( $attachment_imgs ) {   
    2643                                                 foreach ( $attachment_imgs as $attachment_img ) {                                                   
     2642                                            if ( $attachment_imgs ) {
     2643                                                foreach ( $attachment_imgs as $attachment_img ) {
    26442644                                                    $post_thumbnail_id = get_post_thumbnail_id( $pid );
    26452645                                                    if ( empty($post_thumbnail_id) and $this->options[$option_slug . 'is_featured'] ) {
     
    26472647                                                    }
    26482648                                                    elseif(!in_array($attachment_img->ID, $gallery_attachment_ids) and $post_thumbnail_id != $attachment_img->ID) {
    2649                                                         $gallery_attachment_ids[] = $attachment_img->ID;                                                   
    2650                                                     }                                                                                                                                   
    2651                                                 }       
    2652                                                 $success_images = true;                                     
    2653                                             }                                                               
     2649                                                        $gallery_attachment_ids[] = $attachment_img->ID;
     2650                                                    }
     2651                                                }
     2652                                                $success_images = true;
     2653                                            }
    26542654
    26552655                                            if ( ! empty($gallery_attachment_ids) ){
     
    26592659                                            }
    26602660                                        }
    2661                                                                
     2661
    26622662                                        if ( ! empty($imgs) ) {
    26632663
    2664                                             if ( $this->options[$option_slug . 'set_image_meta_title'] and !empty($image_meta_titles_bundle[$slug])){       
    2665                                                 $img_titles = array();                                 
     2664                                            if ( $this->options[$option_slug . 'set_image_meta_title'] and !empty($image_meta_titles_bundle[$slug])){
     2665                                                $img_titles = array();
    26662666                                                $line_img_titles = explode("\n", $image_meta_titles_bundle[$slug][$i]);
    26672667                                                if ( ! empty($line_img_titles) )
    26682668                                                    foreach ($line_img_titles as $line_img_title)
    26692669                                                        $img_titles = array_merge($img_titles, ( ! empty($this->options[$option_slug . 'image_meta_title_delim']) ) ? explode($this->options[$option_slug . 'image_meta_title_delim'], $line_img_title) : array($line_img_title) );
    2670                    
     2670
    26712671                                            }
    2672                                             if ( $this->options[$option_slug . 'set_image_meta_caption'] and !empty($image_meta_captions_bundle[$slug])){                               
    2673                                                 $img_captions = array();                                   
     2672                                            if ( $this->options[$option_slug . 'set_image_meta_caption'] and !empty($image_meta_captions_bundle[$slug])){
     2673                                                $img_captions = array();
    26742674                                                $line_img_captions = explode("\n", $image_meta_captions_bundle[$slug][$i]);
    26752675                                                if ( ! empty($line_img_captions) )
     
    26782678
    26792679                                            }
    2680                                             if ( $this->options[$option_slug . 'set_image_meta_alt'] and !empty($image_meta_alts_bundle[$slug])){                               
    2681                                                 $img_alts = array();                                   
     2680                                            if ( $this->options[$option_slug . 'set_image_meta_alt'] and !empty($image_meta_alts_bundle[$slug])){
     2681                                                $img_alts = array();
    26822682                                                $line_img_alts = explode("\n", $image_meta_alts_bundle[$slug][$i]);
    26832683                                                if ( ! empty($line_img_alts) )
     
    26862686
    26872687                                            }
    2688                                             if ( $this->options[$option_slug . 'set_image_meta_description'] and !empty($image_meta_descriptions_bundle[$slug])){                               
    2689                                                 $img_descriptions = array();                                   
     2688                                            if ( $this->options[$option_slug . 'set_image_meta_description'] and !empty($image_meta_descriptions_bundle[$slug])){
     2689                                                $img_descriptions = array();
    26902690                                                $line_img_descriptions = ($this->options[$option_slug . 'image_meta_description_delim_logic'] == 'line' or empty($this->options[$option_slug . 'image_meta_description_delim'])) ? explode("\n", $image_meta_descriptions_bundle[$slug][$i]) : array($image_meta_descriptions_bundle[$slug][$i]);
    26912691                                                if ( ! empty($line_img_descriptions) )
     
    26932693                                                        $img_descriptions = array_merge($img_descriptions, ($this->options[$option_slug . 'image_meta_description_delim_logic'] == 'separate' and ! empty($this->options[$option_slug . 'image_meta_description_delim']) ) ? explode($this->options[$option_slug . 'image_meta_description_delim'], $line_img_description) : array($line_img_description) );
    26942694
    2695                                             }                   
    2696 
    2697                                             $is_keep_existing_images = ( ! empty($articleData['ID']) and $this->options['is_update_images'] and $this->options['update_images_logic'] == "add_new" and $this->options['update_all_data'] == "no" and $is_show_add_new_images);                     
     2695                                            }
     2696
     2697                                            $is_keep_existing_images = ( ! empty($articleData['ID']) and $this->options['is_update_images'] and $this->options['update_images_logic'] == "add_new" and $this->options['update_all_data'] == "no" and $is_show_add_new_images);
    26982698
    26992699                                            foreach ($imgs as $k => $img_url) {
     
    27142714                                                }
    27152715
    2716                                                 $attid = false;     
    2717 
    2718                                                 $attch = null;                                                                                                     
     2716                                                $attid = false;
     2717
     2718                                                $attch = null;
    27192719
    27202720                                                // remove encoded quotes from url (&#34; and &#39;)
    27212721                                                $url = html_entity_decode(trim($img_url), ENT_QUOTES);
    27222722
    2723                                                 if (empty($url)) continue;                                     
     2723                                                if (empty($url)) continue;
    27242724
    27252725                                                $bn  = wp_all_import_sanitize_filename(urldecode(wp_all_import_basename($url)));
     
    27322732                                                    $img_ext = pmxi_getExtensionFromStr($url);
    27332733
    2734                                                     if ($img_ext == "") $img_ext = pmxi_get_remote_image_ext($url);     
     2734                                                    if ($img_ext == "") $img_ext = pmxi_get_remote_image_ext($url);
    27352735                                                }
    27362736
     
    27412741                                                $image_name = apply_filters("wp_all_import_image_filename", $image_name, empty($img_titles[$k]) ? '' : $img_titles[$k], empty($img_captions[$k]) ? '' : $img_captions[$k], empty($img_alts[$k]) ? '' : $img_alts[$k], $articleData, $this->id, $img_url);
    27422742
    2743                                                 // if wizard store image data to custom field                                   
     2743                                                // if wizard store image data to custom field
    27442744                                                $create_image   = false;
    27452745                                                $download_image = true;
    27462746                                                $wp_filetype    = false;
    27472747
    2748                                                 $is_base64_images_allowed = apply_filters("wp_all_import_is_base64_images_allowed", true, $url, $this->id);                                                 
    2749 
    2750                                                 if ( $bundle_data['type'] == 'images' and base64_encode(base64_decode($url)) == $url and $is_base64_images_allowed ){
     2748                                                $is_base64_images_allowed = apply_filters("wp_all_import_is_base64_images_allowed", true, $url, $this->id);
     2749
     2750                                                if ( $bundle_data['type'] == 'images' and wp_all_import_is_base64_encoded($url) and $is_base64_images_allowed ){
    27512751                                                    $image_name = empty($this->options[$option_slug . 'auto_rename_images']) ? md5($url) . '.jpg' : sanitize_file_name($auto_rename_images_bundle[$slug][$i]) . '.jpg';
    27522752                                                    $image_name = apply_filters("wp_all_import_image_filename", $image_name, empty($img_titles[$k]) ? '' : $img_titles[$k], empty($img_captions[$k]) ? '' : $img_captions[$k], empty($img_alts[$k]) ? '' : $img_alts[$k], $articleData, $this->id, $img_url);
     
    27892789                                                        }
    27902790                                                    }
    2791                                                 } 
    2792 
    2793                                                 if ( ! $create_image ) {
    2794                                                    
     2791                                                }
     2792
     2793                                                if ( ! $create_image && empty($attch) ) {
     2794
    27952795                                                    if ($this->options[$option_slug . 'auto_rename_images'] and !empty($auto_rename_images_bundle[$slug][$i])) {
    27962796                                                        if ($k) {
    27972797                                                            $image_name = str_replace('.' . pmxi_getExtension($image_name), '', $image_name) . '-' . $k . '.' . pmxi_getExtension($image_name);
    2798                                                         }                                                       
     2798                                                        }
    27992799                                                    }
    2800                                                    
     2800
    28012801                                                    $image_filename = wp_unique_filename($targetDir, $image_name);
    28022802                                                    $image_filepath = $targetDir . '/' . $image_filename;
     
    28042804                                                    // search existing attachment
    28052805                                                    if ($this->options[$option_slug . 'search_existing_images'] or "gallery" == $this->options[$option_slug . 'download_images']){
    2806                                                        
     2806
    28072807                                                        $image_filename = $image_name;
    28082808
     
    28542854                                                                    $imageRecord->set(array(
    28552855                                                                        'attachment_id' => $attid,
    2856                                                                         'image_url' => (base64_encode(base64_decode($url)) == $url && $is_base64_images_allowed) ? '' : $url,
     2856                                                                        'image_url' => (wp_all_import_is_base64_encoded($url) && $is_base64_images_allowed) ? '' : $url,
    28572857                                                                        'image_filename' => $image_name
    28582858                                                                    ))->insert();
     
    28642864                                                                            if (empty($imageRecord->image_url)){
    28652865                                                                                $imageRecord->set(array(
    2866                                                                                     'image_url' => (base64_encode(base64_decode($url)) == $url && $is_base64_images_allowed) ? '' : $url,
     2866                                                                                    'image_url' => (wp_all_import_is_base64_encoded($url) && $is_base64_images_allowed) ? '' : $url,
    28672867                                                                                ))->update();
    28682868                                                                            }
     
    28852885
    28862886                                                        // do not download images
    2887                                                         if ( "no" == $this->options[$option_slug . 'download_images'] ){                                                   
     2887                                                        if ( "no" == $this->options[$option_slug . 'download_images'] ){
    28882888
    28892889                                                            $image_filename = wp_unique_filename($targetDir, $image_name);
    2890                                                             $image_filepath = $targetDir . '/' . $image_filename;       
    2891                                                                
     2890                                                            $image_filepath = $targetDir . '/' . $image_filename;
     2891
    28922892                                                            $wpai_uploads = $uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::FILES_DIRECTORY . DIRECTORY_SEPARATOR;
    28932893                                                            $wpai_image_path = $wpai_uploads . str_replace('%20', ' ', $url);
     
    28962896
    28972897                                                            if ( @file_exists($wpai_image_path) and @copy( $wpai_image_path, $image_filepath )){
    2898                                                                 $download_image = false;       
     2898                                                                $download_image = false;
    28992899                                                                // validate import attachments
    29002900                                                                if ($bundle_data['type'] == 'files'){
     
    29052905                                                                    }
    29062906                                                                    else {
    2907                                                                         $create_image = true;                                           
     2907                                                                        $create_image = true;
    29082908                                                                        $logger and call_user_func($logger, sprintf(__('- File `%s` has been successfully found', 'wp_all_import_plugin'), $wpai_image_path));
    29092909                                                                    }
     
    29122912                                                                elseif($bundle_data['type'] == 'images'){
    29132913                                                                    if( preg_match('%\W(svg)$%i', wp_all_import_basename($image_filepath)) or $image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath) and in_array($image_info[2], wp_all_import_supported_image_types())) {
    2914                                                                         $create_image = true;                                           
     2914                                                                        $create_image = true;
    29152915                                                                        $logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully found', 'wp_all_import_plugin'), $wpai_image_path));
    29162916                                                                    }
     
    29202920                                                                        $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
    29212921                                                                        @unlink($image_filepath);
    2922                                                                     }                                                                   
     2922                                                                    }
    29232923                                                                }
    2924                                                             }                                                   
    2925                                                         }   
     2924                                                            }
     2925                                                        }
    29262926                                                        else {
    29272927                                                            $image_info = $this->downloadFile($url, $image_filepath, $is_cron, $logger, $bundle_data['type']);
     
    29362936                                                            }
    29372937                                                            $create_image = empty($image_info) ? false : true;
    2938                                                         }                                               
     2938                                                        }
    29392939                                                    }
    29402940                                                }
     
    29502950                                                        if ( ! empty($image_info) && is_array($image_info) ) {
    29512951                                                            $file_mime_type = image_type_to_mime_type($image_info[2]);
    2952                                                         }                                                       
     2952                                                        }
    29532953                                                        $file_mime_type = apply_filters('wp_all_import_image_mime_type', $file_mime_type, $image_filepath);
    29542954                                                    }
     
    29742974                                                            $imageRecord->set(array(
    29752975                                                                'attachment_id' => $attid,
    2976                                                                 'image_url' => (base64_encode(base64_decode($url)) == $url && $is_base64_images_allowed) ? '' : $url,
     2976                                                                'image_url' => (wp_all_import_is_base64_encoded($url) && $is_base64_images_allowed) ? '' : $url,
    29772977                                                                'image_filename' => $image_name
    29782978                                                            ))->insert();
     
    29852985                                                                    if (empty($imageRecord->image_url)){
    29862986                                                                        $imageRecord->set(array(
    2987                                                                             'image_url' => (base64_encode(base64_decode($url)) == $url && $is_base64_images_allowed) ? '' : $url
     2987                                                                            'image_url' => (wp_all_import_is_base64_encoded($url) && $is_base64_images_allowed) ? '' : $url
    29882988                                                                        ))->update();
    29892989                                                                    }
     
    30073007                                                        wp_update_post(
    30083008                                                            array(
    3009                                                                 'ID' => $attch->ID, 
     3009                                                                'ID' => $attch->ID,
    30103010                                                                'post_parent' => $pid
    30113011                                                            )
     
    30183018                                                    if ( $this->options[$option_slug . 'set_image_meta_description'] and ! empty($img_descriptions[$k]) ) $update_attachment_meta['post_content'] =  trim($img_descriptions[$k]);
    30193019                                                    if ( $this->options[$option_slug . 'set_image_meta_alt'] and ! empty($img_alts[$k]) ) update_post_meta($attid, '_wp_attachment_image_alt', trim($img_alts[$k]));
    3020                                                    
     3020
    30213021                                                    if ( !empty($update_attachment_meta)) {
    30223022                                                        $update_attachment_meta['ID'] = $attid;
     
    30273027                                                    }
    30283028
    3029                                                     $logger and call_user_func($logger, __('- <b>ACTION</b>: ' . $slug, 'wp_all_import_plugin'));                                                                                           
    3030                                                     do_action( $slug, $pid, $attid, ($handle_image) ? $handle_image['file'] : $image_filepath, $is_keep_existing_images ? 'add_images' : 'update_images'); 
     3029                                                    $logger and call_user_func($logger, __('- <b>ACTION</b>: ' . $slug, 'wp_all_import_plugin'));
     3030                                                    do_action( $slug, $pid, $attid, ($handle_image) ? $handle_image['file'] : $image_filepath, $is_keep_existing_images ? 'add_images' : 'update_images');
    30313031
    30323032                                                    $success_images = true;
     
    30483048                                                    if ($attch != null and empty($attch->post_parent)) {
    30493049                                                        $logger and call_user_func($logger, sprintf(__('- Attachment with ID: `%s` has been successfully updated for image `%s`', 'wp_all_import_plugin'), $attid, ($handle_image) ? $handle_image['url'] : $targetUrl . '/' . $image_filename));
    3050                                                     }                                                                                                       
     3050                                                    }
    30513051                                                    elseif(empty($attch)) {
    30523052                                                        $logger and call_user_func($logger, sprintf(__('- Attachment with ID: `%s` has been successfully created for image `%s`', 'wp_all_import_plugin'), $attid, ($handle_image) ? $handle_image['url'] : $targetUrl . '/' . $image_filename));
    30533053                                                    }
    3054                                                 }                                                                       
    3055                                             }                                   
     3054                                                }
     3055                                            }
    30563056                                        }
    3057                                        
     3057
    30583058                                        // Set product gallery images
    30593059                                        if ( $post_type[$i] == "product" ){
     
    30663066                                            $this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $pid) );
    30673067                                            $logger and call_user_func($logger, sprintf(__('- Post `%s` saved as Draft, because no images are downloaded successfully', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
    3068                                         }                                       
     3068                                        }
    30693069                                    }
    30703070                                }
    3071                                 else{                           
     3071                                else{
    30723072                                    // Create entry as Draft if no images are downloaded successfully
    3073                                     $final_post_type = get_post_type($pid);                                 
     3073                                    $final_post_type = get_post_type($pid);
    30743074                                    if ( "yes" == $this->options[$option_slug . 'create_draft'] and $final_post_type != 'product_variation' and ! in_array($post_type[$i], array('taxonomies', 'comments', 'woo_reviews'))){
    30753075                                        $this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $pid) );
     
    31223122                        $logger and call_user_func($logger, sprintf(__('Images import skipped for post `%s` according to \'pmxi_is_images_to_update\' filter...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
    31233123                    }
    3124                     // [/featured image]                   
     3124                    // [/featured image]
    31253125
    31263126                    // [attachments]
     
    33103310                    if ( ! empty($taxonomies) ){
    33113311
    3312                         $logger and call_user_func($logger, __('<b>TAXONOMIES:</b>', 'wp_all_import_plugin'));                         
    3313 
    3314                         foreach ($taxonomies as $tx_name => $txes) {                               
     3312                        $logger and call_user_func($logger, __('<b>TAXONOMIES:</b>', 'wp_all_import_plugin'));
     3313
     3314                        foreach ($taxonomies as $tx_name => $txes) {
    33153315
    33163316                            // Skip updating product attributes
     
    33183318
    33193319                            if ( empty($articleData['ID']) or $this->options['update_all_data'] == "yes" or ( $this->options['update_all_data'] == "no" and $this->options['is_update_categories'] )) {
    3320                                
    3321                                 $logger and call_user_func($logger, sprintf(__('- Importing taxonomy `%s` ...', 'wp_all_import_plugin'), $tx_name));   
     3320
     3321                                $logger and call_user_func($logger, sprintf(__('- Importing taxonomy `%s` ...', 'wp_all_import_plugin'), $tx_name));
    33223322
    33233323                                if ( ! empty($this->options['tax_logic'][$tx_name]) and $this->options['tax_logic'][$tx_name] == 'hierarchical' and ! empty($this->options['tax_hierarchical_logic'][$tx_name]) and $this->options['tax_hierarchical_logic'][$tx_name] == 'entire'){
     
    33263326
    33273327                                if (!empty($articleData['ID'])){
    3328                                     if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "all_except" and !empty($this->options['taxonomies_list']) 
    3329                                         and is_array($this->options['taxonomies_list']) and in_array($tx_name, $this->options['taxonomies_list'])){ 
     3328                                    if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "all_except" and !empty($this->options['taxonomies_list'])
     3329                                        and is_array($this->options['taxonomies_list']) and in_array($tx_name, $this->options['taxonomies_list'])){
    33303330                                            $logger and call_user_func($logger, sprintf(__('- %s %s has been skipped attempted to `Leave these taxonomies alone, update all others`...', 'wp_all_import_plugin'), $custom_type_details->labels->singular_name, $tx_name));
    33313331                                            continue;
    3332                                         }       
    3333                                     if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "only" and ((!empty($this->options['taxonomies_list']) 
    3334                                         and is_array($this->options['taxonomies_list']) and ! in_array($tx_name, $this->options['taxonomies_list'])) or empty($this->options['taxonomies_list']))){ 
     3332                                        }
     3333                                    if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "only" and ((!empty($this->options['taxonomies_list'])
     3334                                        and is_array($this->options['taxonomies_list']) and ! in_array($tx_name, $this->options['taxonomies_list'])) or empty($this->options['taxonomies_list']))){
    33353335                                            $logger and call_user_func($logger, sprintf(__('- %s %s has been skipped attempted to `Update only these taxonomies, leave the rest alone`...', 'wp_all_import_plugin'), $custom_type_details->labels->singular_name, $tx_name));
    33363336                                            continue;
    33373337                                        }
    3338                                 }                               
     3338                                }
    33393339
    33403340                                $assign_taxes = array();
    33413341
    33423342                                if ($this->options['update_categories_logic'] == "add_new" and !empty($existing_taxonomies[$tx_name][$i])){
    3343                                     $assign_taxes = $existing_taxonomies[$tx_name][$i]; 
     3343                                    $assign_taxes = $existing_taxonomies[$tx_name][$i];
    33443344                                    unset($existing_taxonomies[$tx_name][$i]);
    33453345                                }
     
    33853385                                                    }
    33863386                                                }
    3387                                             }                                           
    3388                                            
    3389                                             if ( is_wp_error($term) ){                                 
     3387                                            }
     3388
     3389                                            if ( is_wp_error($term) ){
    33903390                                                $logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: `%s`', 'wp_all_import_plugin'), $term->get_error_message()));
    33913391                                                $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
     
    34023402                                                            }
    34033403                                                        }
    3404                                                     }                                                   
    3405                                                     if (!in_array($term->term_taxonomy_id, $assign_taxes)) $assign_taxes[] = $term->term_taxonomy_id;       
    3406                                                     if (!$is_created_term){                                                     
    3407                                                         if ( empty($parent_id) ){                                                           
    3408                                                             $logger and call_user_func($logger, sprintf(__('- Attempted to create parent %s %s `%s`, duplicate detected. Importing %s to existing `%s` %s, ID %d, slug `%s` ...', 'wp_all_import_plugin'), $custom_type_details->labels->singular_name, $tx_name, $single_tax['name'], $custom_type_details->labels->singular_name, $term->name, $tx_name, $term->term_id, $term->slug));   
     3404                                                    }
     3405                                                    if (!in_array($term->term_taxonomy_id, $assign_taxes)) $assign_taxes[] = $term->term_taxonomy_id;
     3406                                                    if (!$is_created_term){
     3407                                                        if ( empty($parent_id) ){
     3408                                                            $logger and call_user_func($logger, sprintf(__('- Attempted to create parent %s %s `%s`, duplicate detected. Importing %s to existing `%s` %s, ID %d, slug `%s` ...', 'wp_all_import_plugin'), $custom_type_details->labels->singular_name, $tx_name, $single_tax['name'], $custom_type_details->labels->singular_name, $term->name, $tx_name, $term->term_id, $term->slug));
    34093409                                                        }
    3410                                                         else{                                                           
    3411                                                             $logger and call_user_func($logger, sprintf(__('- Attempted to create child %s %s `%s`, duplicate detected. Importing %s to existing `%s` %s, ID %d, slug `%s` ...', 'wp_all_import_plugin'), $custom_type_details->labels->singular_name, $tx_name, $single_tax['name'], $custom_type_details->labels->singular_name, $term->name, $tx_name, $term->term_id, $term->slug));   
    3412                                                         }   
     3410                                                        else{
     3411                                                            $logger and call_user_func($logger, sprintf(__('- Attempted to create child %s %s `%s`, duplicate detected. Importing %s to existing `%s` %s, ID %d, slug `%s` ...', 'wp_all_import_plugin'), $custom_type_details->labels->singular_name, $tx_name, $single_tax['name'], $custom_type_details->labels->singular_name, $term->name, $tx_name, $term->term_id, $term->slug));
     3412                                                        }
    34133413                                                    }
    3414                                                 }                                   
    3415                                             }                                   
     3414                                                }
     3415                                            }
    34163416                                        }
    3417                                     }               
     3417                                    }
    34183418                                endif;
    34193419                                $assign_taxes = apply_filters('wp_all_import_set_post_terms', $assign_taxes, $tx_name, $pid, $this->id);
    3420                                 // associate taxes with post                               
     3420                                // associate taxes with post
    34213421                                $this->associate_terms($pid, ( empty($assign_taxes) ? false : $assign_taxes ), $tx_name, $logger, $is_cron, $articleData['post_status']);
    34223422                            }
     
    34263426                        }
    34273427                        if ( $this->options['update_all_data'] == "no" and ( ($this->options['is_update_categories'] and $this->options['update_categories_logic'] != 'full_update') or ( ! $this->options['is_update_categories'] and ( is_object_in_taxonomy( $post_type[$i], 'category' ) or is_object_in_taxonomy( $post_type[$i], 'post_tag' ) ) ) ) ) {
    3428                            
     3428
    34293429                            if ( ! empty($existing_taxonomies) ){
    34303430                                foreach ($existing_taxonomies as $tx_name => $txes) {
     
    34323432                                    if ( PMXI_Admin_Addons::get_addon('PMWI_Plugin') and strpos($tx_name, "pa_") === 0 ) continue;
    34333433
    3434                                     if (!empty($txes[$i]))                                 
     3434                                    if (!empty($txes[$i]))
    34353435                                        $this->associate_terms($pid, $txes[$i], $tx_name, $logger, $is_cron, $articleData['post_status']);
    34363436                                }
    34373437                            }
    34383438                        }
    3439                     }                   
    3440                     // [/custom taxonomies]                                     
    3441 
    3442                     if (empty($articleData['ID'])) {                                                                                                               
     3439                    }
     3440                    // [/custom taxonomies]
     3441
     3442                    if (empty($articleData['ID'])) {
    34433443                        $logger and call_user_func($logger, sprintf(__('<b>CREATED</b> `%s` `%s` (ID: %s)', 'wp_all_import_plugin'), $this->getRecordTitle($articleData), $custom_type_details->labels->singular_name, $pid));
    3444                     } else {                       
     3444                    } else {
    34453445                        $logger and call_user_func($logger, sprintf(__('<b>UPDATED</b> `%s` `%s` (ID: %s)', 'wp_all_import_plugin'), $this->getRecordTitle($articleData), $custom_type_details->labels->singular_name, $pid));
    34463446                    }
     
    34623462                    // prepare data for import
    34633463                    $importData = array(
    3464                         'pid' => $pid,                     
    3465                         'import' => $this,                     
     3464                        'pid' => $pid,
     3465                        'import' => $this,
    34663466                        'logger' => $logger,
    3467                         'is_update' => $is_update                                           
     3467                        'is_update' => $is_update
    34683468                    );
    34693469
     
    34713471
    34723472                    // deligate operation to addons
    3473                     foreach (PMXI_Admin_Addons::get_active_addons() as $class){ 
     3473                    foreach (PMXI_Admin_Addons::get_active_addons() as $class){
    34743474                        if (class_exists($class)){
    3475                             if ( method_exists($addons[$class], 'saved_post') ) $addons[$class]->saved_post($importData);   
     3475                            if ( method_exists($addons[$class], 'saved_post') ) $addons[$class]->saved_post($importData);
    34763476                        } else {
    34773477                            if ( ! empty($saved_functions[$class]) ){
    34783478                                if ( is_array($saved_functions[$class]) and is_callable($saved_functions[$class]) or ! is_array($saved_functions[$class]) and function_exists($saved_functions[$class])  ){
    3479                                     call_user_func($saved_functions[$class], $importData);     
    3480                                 }                               
    3481                             }                                                       
     3479                                    call_user_func($saved_functions[$class], $importData);
     3480                                }
     3481                            }
    34823482                        }
    34833483                    }
    3484                    
    3485                     // [/addons import]                                     
     3484
     3485                    // [/addons import]
    34863486                    $logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_saved_post', 'wp_all_import_plugin'));
    34873487                    do_action( 'pmxi_saved_post', $pid, $rootNodes[$i], $is_update ); // hook that was triggered immediately after post saved
    3488                    
    3489                     if (empty($articleData['ID'])) $created++; else $updated++;                     
     3488
     3489                    if (empty($articleData['ID'])) $created++; else $updated++;
    34903490
    34913491                    if ( ! $is_cron and "default" == $this->options['import_processing'] ){
     
    34933493                        $logger and call_user_func($logger, sprintf(__('<span class="processing_info"><span class="created_count">%s</span><span class="updated_count">%s</span><span class="percents_count">%s</span></span>', 'wp_all_import_plugin'), $created, $updated, ceil(($processed_records/$this->count) * 100)));
    34943494                    }
    3495                                                                                    
    3496                 }               
     3495
     3496                }
    34973497                $logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_after_post_import', 'wp_all_import_plugin'));
    34983498                do_action('pmxi_after_post_import', $this->id);
     
    35033503            }
    35043504
    3505             $this->set(array(       
    3506                 'imported' => $created + $updated, 
     3505            $this->set(array(
     3506                'imported' => $created + $updated,
    35073507                'created'  => $created,
    35083508                'updated'  => $updated,
    35093509                'skipped'  => $skipped,
    3510                 'last_activity' => date('Y-m-d H:i:s')             
     3510                'last_activity' => date('Y-m-d H:i:s')
    35113511            ))->update();
    3512            
     3512
    35133513            if ( ! $is_cron ){
    35143514
    3515                 PMXI_Plugin::$session->save_data(); 
     3515                PMXI_Plugin::$session->save_data();
    35163516
    35173517                $records_count = $this->created + $this->updated + $this->skipped;
     
    35193519                $records_to_import = (empty($specified_records)) ? $this->count : $specified_records[count($specified_records) -1];
    35203520
    3521                 $is_import_complete = ($records_count == $records_to_import);                               
     3521                $is_import_complete = ($records_count == $records_to_import);
    35223522
    35233523                // Set out of stock status for missing records [Woocommerce add-on option]
     
    35273527                    $args = array('import_id' => $this->id, 'iteration !=' => $this->iteration);
    35283528                    if (!empty($this->options['is_import_specified'])) $args['specified'] = 1;
    3529                     $postList = new PMXI_Post_List();                                   
     3529                    $postList = new PMXI_Post_List();
    35303530                    $missingPosts = $postList->getBy($args);
    35313531                    if ( ! $missingPosts->isEmpty() ){
    3532                         foreach ($missingPosts as $missingPost) {                           
     3532                        foreach ($missingPosts as $missingPost) {
    35333533                            update_post_meta( $missingPost['post_id'], '_stock_status', 'outofstock' );
    35343534                            update_post_meta( $missingPost['post_id'], '_stock', 0 );
     
    35493549                        }
    35503550                    }
    3551                 }   
    3552             }       
    3553            
     3551                }
     3552            }
     3553
    35543554        } catch (XmlImportException $e) {
    35553555            $logger and call_user_func($logger, __('<b>ERROR</b>', 'wp_all_import_plugin') . ': ' . $e->getMessage());
    3556             $logger and !$is_cron and PMXI_Plugin::$session->errors++; 
    3557         }               
    3558        
     3556            $logger and !$is_cron and PMXI_Plugin::$session->errors++;
     3557        }
     3558
    35593559        $logger and $is_import_complete and call_user_func($logger, __('Cleaning temporary data...', 'wp_all_import_plugin'));
    35603560        foreach ($tmp_files as $file) { // remove all temporary files created
    35613561            @unlink($file);
    3562         }           
    3563        
     3562        }
     3563
    35643564        remove_filter('user_has_cap', array($this, '_filter_has_cap_unfiltered_html')); kses_init(); // return any filtering rules back if they has been disabled for import procedure
    3565        
     3565
    35663566        return $this;
    35673567    }
     
    36713671    public function delete_source($logger = false)
    36723672    {
    3673         if ($this->options['is_delete_source']) 
     3673        if ($this->options['is_delete_source'])
    36743674        {
    36753675            $uploads = wp_upload_dir();
    36763676
    3677             $logger and call_user_func($logger, __('Deleting source XML file...', 'wp_all_import_plugin'));         
     3677            $logger and call_user_func($logger, __('Deleting source XML file...', 'wp_all_import_plugin'));
    36783678
    36793679            // Delete chunks
    36803680            foreach (PMXI_Helper::safe_glob($uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::TEMP_DIRECTORY . DIRECTORY_SEPARATOR . 'pmxi_chunk_*', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
    36813681                $logger and call_user_func($logger, __('Deleting chunks files...', 'wp_all_import_plugin'));
    3682                 @file_exists($filePath) and wp_all_import_remove_source($filePath, false);     
     3682                @file_exists($filePath) and wp_all_import_remove_source($filePath, false);
    36833683            }
    36843684
     
    37003700            }
    37013701        }
    3702     }   
     3702    }
    37033703
    37043704    public function delete_missing_records($logger, $iteration)
    37053705    {
    3706         if ( ! empty($this->options['is_delete_missing']) and $this->options['duplicate_matching'] == 'auto') { 
     3706        if ( ! empty($this->options['is_delete_missing']) and $this->options['duplicate_matching'] == 'auto') {
    37073707
    37083708            empty($this->deleted) and $logger and call_user_func($logger, __('Removing previously imported posts which are no longer actual...', 'wp_all_import_plugin'));
    3709             $postList = new PMXI_Post_List();                                   
    3710 
    3711             $args = array('import_id' => $this->id, 'iteration !=' => $iteration);         
    3712             if ( ! empty($this->options['is_import_specified']) ) $args['specified'] = 1;           
     3709            $postList = new PMXI_Post_List();
     3710
     3711            $args = array('import_id' => $this->id, 'iteration !=' => $iteration);
     3712            if ( ! empty($this->options['is_import_specified']) ) $args['specified'] = 1;
    37133713
    37143714            $missing_ids = array();
    37153715            $missingPosts = $postList->getBy($args);
    37163716
    3717             if ( ! $missingPosts->isEmpty() ): 
    3718                
     3717            if ( ! $missingPosts->isEmpty() ):
     3718
    37193719                foreach ($missingPosts as $missingPost) {
    3720                
     3720
    37213721                    $missing_ids[] = $missingPost;
    3722                                                    
     3722
    37233723                }
    37243724
    3725             endif;                         
     3725            endif;
    37263726
    37273727            // Delete posts from database
    3728             if ( ! empty($missing_ids) && is_array($missing_ids) ){                                                                 
    3729                
    3730                 $logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_delete_post', 'wp_all_import_plugin'));                                                 
     3728            if ( ! empty($missing_ids) && is_array($missing_ids) ){
     3729
     3730                $logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_delete_post', 'wp_all_import_plugin'));
    37313731
    37323732                $logger and call_user_func($logger, __('Deleting posts from database', 'wp_all_import_plugin'));
     
    37413741
    37423742                        foreach ( $missingPostRecords as $k => $missingPostRecord ) {
    3743                            
     3743
    37443744                            $to_delete = true;
    3745                            
     3745
    37463746                            // Instead of deletion, set Custom Field
    37473747                            if ($this->options['is_update_missing_cf']){
     
    37653765                            }
    37663766
    3767                             // Instead of deletion, change post status to Draft                         
     3767                            // Instead of deletion, change post status to Draft
    37683768                            if ($this->options['set_missing_to_draft']){
    37693769                                if ($final_post_type = get_post_type($missingPostRecord['post_id']) and $final_post_type != 'product_variation' and 'draft' != get_post_status($missingPostRecord['post_id']))
     
    37723772                                    $this->recount_terms($missingPostRecord['post_id'], $final_post_type);
    37733773                                    $logger and call_user_func($logger, sprintf(__('Instead of deletion, change post with ID `%s` status to Draft', 'wp_all_import_plugin'), $missingPostRecord['post_id']));
    3774                                 }                               
     3774                                }
    37753775                                $to_delete = false;
    37763776                            }
    3777                            
     3777
    37783778                            $to_delete = apply_filters('wp_all_import_is_post_to_delete', $to_delete, $missingPostRecord['post_id'], $this);
    37793779
     
    37883788                                    wp_delete_object_term_relationships($missingPostRecord['post_id'], get_object_taxonomies('' != $this->options['custom_type'] ? $this->options['custom_type'] : 'post'));
    37893789                                }
    3790                             }   
     3790                            }
    37913791                            else {
    37923792                                $skipp_from_deletion[] = $missingPostRecord['post_id'];
     
    38113811                                do_action('pmxi_missing_post', $missingPostRecord['post_id']);
    38123812
    3813                                 unset($missingPostRecords[$k]);                         
     3813                                unset($missingPostRecords[$k]);
    38143814                            }
    38153815                        }
     
    38493849                                    break;
    38503850                            }
    3851                                
     3851
    38523852                            // Delete record form pmxi_posts
    38533853                            $sql = "DELETE FROM " . PMXI_Plugin::getInstance()->getTablePrefix() . "posts WHERE post_id IN (".implode(',', $ids).") AND import_id = %d";
    3854                             $this->wpdb->query( 
     3854                            $this->wpdb->query(
    38553855                                $this->wpdb->prepare($sql, $this->id)
    3856                             ); 
    3857 
    3858                             $this->set(array('deleted' => $this->deleted + count($ids)))->update(); 
     3856                            );
     3857
     3858                            $this->set(array('deleted' => $this->deleted + count($ids)))->update();
    38593859
    38603860                            $logger and call_user_func($logger, sprintf(__('%d Posts deleted from database. IDs (%s)', 'wp_all_import_plugin'), $this->deleted, implode(",", $ids)));
    38613861                        }
    3862                     }   
     3862                    }
    38633863
    38643864                    if ( PMXI_Plugin::is_ajax() ) break;
     
    38763876    protected function pushmeta($pid, $meta_key, $meta_value){
    38773877
    3878         if (empty($meta_key)) return;       
     3878        if (empty($meta_key)) return;
    38793879
    38803880        $this->post_meta_to_insert[] = array(
     
    38823882            'meta_value' => $meta_value,
    38833883            'pid' => $pid
    3884         );     
     3884        );
    38853885
    38863886    }
    38873887
    38883888    protected function executeSQL(){
    3889        
     3889
    38903890        $import_entry = ( in_array( $this->options['custom_type'], array('import_users', 'shop_customer') ) ) ? 'user' : 'post';
    38913891
    38923892        // prepare bulk SQL query
    38933893        $meta_table = _get_meta_table( $import_entry );
    3894        
    3895         if ( $this->post_meta_to_insert ){         
     3894
     3895        if ( $this->post_meta_to_insert ){
    38963896            $values = array();
    38973897            $already_added = array();
    3898            
     3898
    38993899            foreach (array_reverse($this->post_meta_to_insert) as $key => $value) {
    39003900                if ( ! empty($value['meta_key']) and ! in_array($value['pid'] . '-' . $value['meta_key'], $already_added) ){
    3901                     $already_added[] = $value['pid'] . '-' . $value['meta_key'];                       
    3902                     $values[] = '(' . $value['pid'] . ',"' . $value['meta_key'] . '",\'' . maybe_serialize($value['meta_value']) .'\')';                       
     3901                    $already_added[] = $value['pid'] . '-' . $value['meta_key'];
     3902                    $values[] = '(' . $value['pid'] . ',"' . $value['meta_key'] . '",\'' . maybe_serialize($value['meta_value']) .'\')';
    39033903                }
    39043904            }
    3905            
     3905
    39063906            $this->wpdb->query("INSERT INTO $meta_table (`" . $import_entry . "_id`, `meta_key`, `meta_value`) VALUES " . implode(',', $values));
    39073907            $this->post_meta_to_insert = array();
    3908         }   
     3908        }
    39093909    }
    3910    
     3910
    39113911    public function _filter_has_cap_unfiltered_html($caps)
    39123912    {
     
    39933993            $missing_ids = array();
    39943994            $sql = "SELECT post_id FROM " . PMXI_Plugin::getInstance()->getTablePrefix() . "posts WHERE import_id = %d";
    3995             $missingPosts = $this->wpdb->get_results( 
     3995            $missingPosts = $this->wpdb->get_results(
    39963996                $this->wpdb->prepare($sql, $this->id)
    39973997            );
     
    40094009                        // Delete record form pmxi_posts
    40104010                        $sql = "DELETE FROM " . PMXI_Plugin::getInstance()->getTablePrefix() . "posts WHERE post_id IN (".implode(',', $ids).") AND import_id = %d";
    4011                         $this->wpdb->query( 
     4011                        $this->wpdb->query(
    40124012                            $this->wpdb->prepare($sql, $this->id)
    40134013                        );
    4014                         $this->set(array('deleted' => $this->deleted + count($ids)))->update();                     
     4014                        $this->set(array('deleted' => $this->deleted + count($ids)))->update();
    40154015                    }
    40164016                    break;
    40174017                }
    40184018                return (count($missing_ids_arr) > 1) ? false : true;
    4019             }                               
     4019            }
    40204020        }
    40214021        return true;
     
    40294029     */
    40304030    public function deletePosts($keepPosts = TRUE, $is_deleted_images = 'auto', $is_delete_attachments = 'auto') {
    4031         $post = new PMXI_Post_List();       
    4032         if ( ! $keepPosts) {                               
     4031        $post = new PMXI_Post_List();
     4032        if ( ! $keepPosts) {
    40334033            $ids = array();
    4034             foreach ($post->getBy('import_id', $this->id)->convertRecords() as $p) {                               
     4034            foreach ($post->getBy('import_id', $this->id)->convertRecords() as $p) {
    40354035                $ids[] = $p->post_id;
    40364036            }
    40374037            if ( ! empty($ids) ){
    40384038                $this->deleteRecords($is_delete_attachments, $is_deleted_images, $ids);
    4039             }           
     4039            }
    40404040        }
    40414041        $this->wpdb->query($this->wpdb->prepare('DELETE FROM ' . $post->getTable() . ' WHERE import_id = %s', $this->id));
     
    41004100    public function deleteFiles() {
    41014101        $fileList = new PMXI_File_List();
    4102         foreach($fileList->getBy('import_id', $this->id)->convertRecords() as $f) {         
     4102        foreach($fileList->getBy('import_id', $this->id)->convertRecords() as $f) {
    41034103            $f->delete();
    41044104        }
     
    41104110     * @chainable
    41114111     */
    4112     public function deleteHistories(){     
     4112    public function deleteHistories(){
    41134113        $historyList = new PMXI_History_List();
    4114         foreach ($historyList->getBy('import_id', $this->id)->convertRecords() as $h) {         
     4114        foreach ($historyList->getBy('import_id', $this->id)->convertRecords() as $h) {
    41154115            $h->delete();
    41164116        }
     
    41284128        }
    41294129        return $this;
    4130     }   
     4130    }
    41314131    /**
    41324132     * @see parent::delete()
     
    41384138        {
    41394139            $this->deleteFiles()->deleteHistories()->deleteChildren($keepPosts);
    4140         }       
     4140        }
    41414141        $expired_sessions   = array();
    41424142        $expired_sessions[] = "_wpallimport_session_expires_" . $this->id . "_";
     
    41534153        return in_array($this->type, array('url', 'ftp', 'file'));
    41544154    }
    4155    
     4155
    41564156}
  • wp-all-import/trunk/plugin.php

    r2640889 r2676428  
    44Plugin URI: http://www.wpallimport.com/wordpress-xml-csv-import/?utm_source=import-plugin-free&utm_medium=wp-plugins-page&utm_campaign=upgrade-to-pro
    55Description: The most powerful solution for importing XML and CSV files to WordPress. Create Posts and Pages with content from any XML or CSV file. A paid upgrade to WP All Import Pro is available for support and additional features.
    6 Version: 3.6.5
     6Version: 3.6.6
    77Author: Soflyy
    88*/
     
    2626define('WP_ALL_IMPORT_PREFIX', 'pmxi_');
    2727
    28 define('PMXI_VERSION', '3.6.5');
     28define('PMXI_VERSION', '3.6.6');
    2929
    3030define('PMXI_EDITION', 'free');
  • wp-all-import/trunk/readme.txt

    r2640889 r2676428  
    22Contributors: soflyy, wpallimport
    33Requires at least: 4.1
    4 Tested up to: 5.8
    5 Stable tag: 3.6.5
     4Tested up to: 5.9
     5Stable tag: 3.6.6
    66Tags: wordpress csv import, wordpress xml import, xml, csv, datafeed, import, migrate, import csv to wordpress, import xml to wordpress, advanced xml import, advanced csv import, bulk csv import, bulk xml import, bulk data import, xml to custom post type, csv to custom post type, woocommerce csv import, woocommerce xml import, csv import, import csv, xml import, import xml, csv importer
    77
     
    105105
    106106== Changelog ==
     107
     108= 3.6.6 =
     109* bug fix: jQuery nestedSortable compatibility with WordPress 5.9
    107110
    108111= 3.6.5 =
  • wp-all-import/trunk/static/js/jquery/jquery.mjs.nestedSortable.js

    r1259687 r2676428  
    8787            }
    8888
     89            this.dragDirection = {
     90                vertical: this._getDragVerticalDirection(),
     91                horizontal: this._getDragHorizontalDirection()
     92            };
     93
    8994            //Regenerate the absolute position used for position checks
    9095            this.positionAbs = this._convertPositionTo("absolute");
     
    166171
    167172            this.beyondMaxLevels = 0;
    168            
     173
    169174            // If the item is moved to the left, send it to its parent's level unless there are siblings below it.
    170175            if (parentItem != null && nextItem == null &&
     
    333338                }
    334339
    335                 id = ($(item).attr(o.attribute || 'id')).match(o.expression || (/(.+)[-=_](.+)/));
     340                id = ($(item).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
    336341
    337342                if (depth === sDepth + 1) {
     
    344349                    pid = parentItem[2];
    345350                }
    346                
     351
    347352                if (id) {
    348353                    var pmxi_is_assign = $(item).find('input.assign_term:first').is(':checked');
     
    371376            if (this.options.listType) {
    372377                var list = item.closest(this.options.listType);
    373                 while (list && list.length > 0 && 
     378                while (list && list.length > 0 &&
    374379                        !list.is('.ui-sortable')) {
    375380                    level++;
Note: See TracChangeset for help on using the changeset viewer.