Plugin Directory

Changeset 2732013


Ignore:
Timestamp:
05/26/2022 03:42:58 PM (4 years ago)
Author:
addonspress
Message:

1.3.7

Location:
advanced-import
Files:
40 added
6 edited

Legend:

Unmodified
Added
Removed
  • advanced-import/trunk/admin/class-advanced-import-admin.php

    r2715268 r2732013  
    14691469        }
    14701470
    1471         /*check if already exists by post_name*/
    1472         if ( empty( $post_data['post_title'] ) && ! empty( $post_data['post_name'] ) ) {
    1473             global $wpdb;
    1474             $sql   = "
    1475                     SELECT ID, post_name, post_parent, post_type
    1476                     FROM $wpdb->posts
    1477                     WHERE post_name = %s
    1478                     AND post_type = %s
    1479                 ";
    1480             $pages = $wpdb->get_results(
    1481                 $wpdb->prepare(
    1482                     $sql,
    1483                     array(
    1484                         $post_data['post_name'],
    1485                         $post_type,
    1486                     )
    1487                 ),
    1488                 OBJECT_K
    1489             );
    1490 
    1491             $foundid = 0;
    1492             foreach ( (array) $pages as $page ) {
    1493                 if ( $page->post_name == $post_data['post_name'] && empty( $page->post_title ) ) {
    1494                     $foundid = $page->ID;
    1495                 }
    1496             }
    1497 
    1498             /*if we have found id by post_name, imported_post_id and return*/
    1499             if ( $foundid ) {
    1500                 $this->imported_post_id( $post_data['post_id'], $foundid );
    1501                 return true;
    1502             }
    1503         }
    1504 
    1505         /*
    1506         check if already exists by post_name and post_title*/
     1471        $foundid = 0;
     1472
     1473        /*
     1474        check if already exists by post_name and post_title*/
    15071475        /*don't use post_exists because it will dupe up on media with same name but different slug*/
    15081476        if ( ! empty( $post_data['post_title'] ) && ! empty( $post_data['post_name'] ) ) {
     
    15271495            );
    15281496
    1529             $foundid = 0;
    15301497            foreach ( (array) $pages as $page ) {
    15311498                if ( $page->post_name == $post_data['post_name'] ) {
    15321499                    $foundid = $page->ID;
    15331500                }
    1534             }
    1535 
    1536             /*if we have found id by post_name and post_title, imported_post_id and return*/
    1537             $elementor_library_id = '';
    1538             if ( $foundid && 'elementor_library' != $post_type ) {
    1539                 $this->imported_post_id( $post_data['post_id'], $foundid );
    1540                 return true;
    1541             }
    1542             if ( $foundid && 'elementor_library' == $post_type ) {
    1543                 $elementor_library_id = $foundid;
    15441501            }
    15451502        }
     
    16431600                break;
    16441601
     1602            /*TODO*/
    16451603            case 'elementor_library':
    16461604                if ( empty( $elementor_library_id ) ) {
     
    18181776
    18191777                /*finally insert post data*/
    1820                 $post_id = wp_insert_post( $post_data, true );
     1778
     1779                if( $foundid > 0 ){
     1780                    $post_data['ID']      = $foundid;
     1781                    /*finally insert post data*/
     1782                    $post_id = wp_update_post( $post_data, true );
     1783                }
     1784                else{
     1785                    $post_id = wp_insert_post( $post_data, true );
     1786                }
    18211787                if ( ! is_wp_error( $post_id ) ) {
    18221788
  • advanced-import/trunk/admin/class-elementor-import.php

    r2715268 r2732013  
    119119         * @param array $item    current array of demo list.
    120120         * @param string $key
    121          * @return string
     121         * @return array
    122122         */
    123123        public function elementor_data( $elementor_data ) {
     
    208208            }
    209209
    210             return wp_json_encode( $elementor_data );
     210            return $elementor_data;
    211211        }
    212212
     
    216216         * @param array $item    current array of demo list.
    217217         * @param string $key
    218          * @return string
     218         * @return void
    219219         */
    220220        public function process_elementor_posts() {
  • advanced-import/trunk/advanced-import.php

    r2715268 r2732013  
    1515 * Plugin URI:        https://addonspress.com/item/advanced-import
    1616 * Description:       Easily import demo data starter site packages or Migrate your site data
    17  * Version:           1.3.6
     17 * Version:           1.3.7
    1818 * Author:            AddonsPress
    1919 * Author URI:        https://addonspress.com/
     
    2525
    2626/*Define Constants for this plugin*/
    27 define( 'ADVANCED_IMPORT_VERSION', '1.3.6' );
     27define( 'ADVANCED_IMPORT_VERSION', '1.3.7' );
    2828define( 'ADVANCED_IMPORT_PLUGIN_NAME', 'advanced-import' );
    2929define( 'ADVANCED_IMPORT_PATH', plugin_dir_path( __FILE__ ) );
  • advanced-import/trunk/includes/class-advanced-import.php

    r2715268 r2732013  
    176176         */
    177177        require_once ADVANCED_IMPORT_PATH . 'includes/functions-advanced-import.php';
     178        require_once ADVANCED_IMPORT_PATH . 'includes/class-advanced-import-cron.php';
    178179
    179180        /**
  • advanced-import/trunk/includes/functions-advanced-import.php

    r2715268 r2732013  
    4646    }
    4747}
     48
     49function advanced_import_add_log( $entry, $file = 'advanced-import.log', $mode = 'default' ) {
     50    // Get WordPress uploads directory.
     51    $upload_dir = wp_upload_dir();
     52    $upload_dir = $upload_dir['basedir'];
     53    // If the entry is array, json_encode.
     54    if ( is_array( $entry ) ) {
     55        $entry = json_encode( $entry );
     56    }
     57    // Write the log file.
     58    $file = $upload_dir . '/' . $file;
     59    if ( 'default' === $mode ) {
     60        if ( file_exists( $file ) ) {
     61            $mode = 'a';
     62        } else {
     63            $mode = 'w';
     64        }
     65    }
     66
     67    $file  = fopen( $file, $mode );
     68    $bytes = fwrite( $file, $entry . "\n" );
     69    fclose( $file );
     70    return $bytes;
     71}
  • advanced-import/trunk/readme.txt

    r2715268 r2732013  
    55Tags: import, advanced import, demo import, theme import, widget import, customizer import
    66Requires at least: 5.0
    7 Tested up to: 5.9
     7Tested up to: 6.0
    88Requires PHP: 5.6.20
    9 Stable tag: 1.3.6
     9Stable tag: 1.3.7
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    225225== Changelog ==
    226226
     227= 1.3.7 - 2022-05-26 =
     228* Updated : Tested up WordPress 6
     229* Fixed : Elementor imports in some cases
     230
    227231= 1.3.6 - 2022-04-27 =
    228232* Updated : Reset plugin via ajax
Note: See TracChangeset for help on using the changeset viewer.