Version Description
- 2022-01-04 =
- Added : Elementor global site settings
Download this release
Release Info
Developer | addonspress |
Plugin | Advanced Import : One Click Import for WordPress or Theme Demo Data |
Version | 1.3.4 |
Comparing to | |
See all releases |
Code changes from version 1.3.3 to 1.3.4
- admin/class-advanced-import-admin.php +66 -3
- advanced-import.php +2 -2
- assets/js/advanced-import-admin.min.js +1 -1
- readme.txt +5 -2
admin/class-advanced-import-admin.php
CHANGED
@@ -387,7 +387,7 @@ class Advanced_Import_Admin {
|
|
387 |
public function import_menu() {
|
388 |
$this->hook_suffix[] = add_theme_page( esc_html__( 'Demo Import ', 'advanced-import' ), esc_html__( 'Demo Import' ), 'manage_options', 'advanced-import', array( $this, 'demo_import_screen' ) );
|
389 |
$this->hook_suffix[] = add_management_page( esc_html__( 'Advanced Import', 'advanced-import' ), esc_html__( 'Advanced Import', 'advanced-import' ), 'manage_options', 'advanced-import-tool', array( $this, 'demo_import_screen' ) );
|
390 |
-
$this->hook_suffix
|
391 |
}
|
392 |
|
393 |
/**
|
@@ -904,7 +904,7 @@ class Advanced_Import_Admin {
|
|
904 |
$this->is_pro_active = apply_filters( 'advanced_import_is_pro_active', $this->is_pro_active );
|
905 |
$demo_lists = $this->demo_lists;
|
906 |
|
907 |
-
$total_demo = count( $demo_lists );
|
908 |
if ( $total_demo >= 1 ) {
|
909 |
$this->demo_list( $demo_lists, $total_demo );
|
910 |
}
|
@@ -1532,10 +1532,14 @@ class Advanced_Import_Admin {
|
|
1532 |
}
|
1533 |
|
1534 |
/*if we have found id by post_name and post_title, imported_post_id and return*/
|
1535 |
-
|
|
|
1536 |
$this->imported_post_id( $post_data['post_id'], $foundid );
|
1537 |
return true;
|
1538 |
}
|
|
|
|
|
|
|
1539 |
}
|
1540 |
|
1541 |
/*
|
@@ -1636,6 +1640,65 @@ class Advanced_Import_Admin {
|
|
1636 |
}
|
1637 |
break;
|
1638 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1639 |
default:
|
1640 |
/*Process Post Meta*/
|
1641 |
if ( ! empty( $post_data['meta'] ) && is_array( $post_data['meta'] ) ) {
|
387 |
public function import_menu() {
|
388 |
$this->hook_suffix[] = add_theme_page( esc_html__( 'Demo Import ', 'advanced-import' ), esc_html__( 'Demo Import' ), 'manage_options', 'advanced-import', array( $this, 'demo_import_screen' ) );
|
389 |
$this->hook_suffix[] = add_management_page( esc_html__( 'Advanced Import', 'advanced-import' ), esc_html__( 'Advanced Import', 'advanced-import' ), 'manage_options', 'advanced-import-tool', array( $this, 'demo_import_screen' ) );
|
390 |
+
$this->hook_suffix = apply_filters( 'advanced_import_menu_hook_suffix', $this->hook_suffix );
|
391 |
}
|
392 |
|
393 |
/**
|
904 |
$this->is_pro_active = apply_filters( 'advanced_import_is_pro_active', $this->is_pro_active );
|
905 |
$demo_lists = $this->demo_lists;
|
906 |
|
907 |
+
$total_demo = is_array( $demo_lists ) ? count( $demo_lists ) : 0;
|
908 |
if ( $total_demo >= 1 ) {
|
909 |
$this->demo_list( $demo_lists, $total_demo );
|
910 |
}
|
1532 |
}
|
1533 |
|
1534 |
/*if we have found id by post_name and post_title, imported_post_id and return*/
|
1535 |
+
$elementor_library_id = '';
|
1536 |
+
if ( $foundid && 'elementor_library' != $post_type ) {
|
1537 |
$this->imported_post_id( $post_data['post_id'], $foundid );
|
1538 |
return true;
|
1539 |
}
|
1540 |
+
if ( $foundid && 'elementor_library' == $post_type ) {
|
1541 |
+
$elementor_library_id = $foundid;
|
1542 |
+
}
|
1543 |
}
|
1544 |
|
1545 |
/*
|
1640 |
}
|
1641 |
break;
|
1642 |
|
1643 |
+
case 'elementor_library':
|
1644 |
+
if ( empty( $elementor_library_id ) ) {
|
1645 |
+
break;
|
1646 |
+
}
|
1647 |
+
if ( ! empty( $post_data['meta'] ) && is_array( $post_data['meta'] ) ) {
|
1648 |
+
|
1649 |
+
/*fix for double json encoded stuff*/
|
1650 |
+
foreach ( $post_data['meta'] as $meta_key => $meta_val ) {
|
1651 |
+
if ( is_string( $meta_val ) && strlen( $meta_val ) && $meta_val[0] == '[' ) {
|
1652 |
+
$test_json = @json_decode( $meta_val, true );
|
1653 |
+
if ( is_array( $test_json ) ) {
|
1654 |
+
$post_data['meta'][ $meta_key ] = $test_json;
|
1655 |
+
}
|
1656 |
+
}
|
1657 |
+
}
|
1658 |
+
|
1659 |
+
array_walk_recursive( $post_data['meta'], array(
|
1660 |
+
advanced_import_elementor(),
|
1661 |
+
'elementor_id_import'
|
1662 |
+
) );
|
1663 |
+
}
|
1664 |
+
/*do further filter if you need*/
|
1665 |
+
$post_data['post_id'] = apply_filters( 'advanced_import_post_data', $post_data );
|
1666 |
+
$post_data['ID'] = $elementor_library_id;
|
1667 |
+
|
1668 |
+
/*finally insert post data*/
|
1669 |
+
$post_id = wp_update_post( $post_data, true );
|
1670 |
+
if ( ! is_wp_error( $post_id ) ) {
|
1671 |
+
|
1672 |
+
/*set id on imported_post_id*/
|
1673 |
+
$this->imported_post_id( $post_data['post_id'], $post_id );
|
1674 |
+
|
1675 |
+
/*add/update post meta*/
|
1676 |
+
if ( ! empty( $post_data['meta'] ) ) {
|
1677 |
+
foreach ( $post_data['meta'] as $meta_key => $meta_val ) {
|
1678 |
+
/*if the post has a featured image, take note of this in case of remap*/
|
1679 |
+
if ( '_thumbnail_id' == $meta_key ) {
|
1680 |
+
/*find this inserted id and use that instead.*/
|
1681 |
+
$inserted_id = $this->imported_post_id( intval( $meta_val ) );
|
1682 |
+
if ( $inserted_id ) {
|
1683 |
+
$meta_val = $inserted_id;
|
1684 |
+
}
|
1685 |
+
}
|
1686 |
+
/*update meta*/
|
1687 |
+
update_post_meta( $post_id, $meta_key, $meta_val );
|
1688 |
+
}
|
1689 |
+
}
|
1690 |
+
}
|
1691 |
+
//not needed
|
1692 |
+
//update_option('elementor_active_kit', $post_id);
|
1693 |
+
if (
|
1694 |
+
defined( 'ELEMENTOR_VERSION' )
|
1695 |
+
||
|
1696 |
+
defined( 'ELEMENTOR_PRO_VERSION' )
|
1697 |
+
) {
|
1698 |
+
\Elementor\Plugin::$instance->files_manager->clear_cache();
|
1699 |
+
}
|
1700 |
+
break;
|
1701 |
+
|
1702 |
default:
|
1703 |
/*Process Post Meta*/
|
1704 |
if ( ! empty( $post_data['meta'] ) && is_array( $post_data['meta'] ) ) {
|
advanced-import.php
CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
14 |
* Plugin Name: Advanced Import
|
15 |
* Plugin URI: https://addonspress.com/item/advanced-import
|
16 |
* Description: Easily import demo data starter site packages or Migrate your site data
|
17 |
-
* Version: 1.3.
|
18 |
* Author: AddonsPress
|
19 |
* Author URI: https://addonspress.com/
|
20 |
* License: GPL-2.0+
|
@@ -24,7 +24,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
24 |
*/
|
25 |
|
26 |
/*Define Constants for this plugin*/
|
27 |
-
define( 'ADVANCED_IMPORT_VERSION', '1.3.
|
28 |
define( 'ADVANCED_IMPORT_PLUGIN_NAME', 'advanced-import' );
|
29 |
define( 'ADVANCED_IMPORT_PATH', plugin_dir_path( __FILE__ ) );
|
30 |
define( 'ADVANCED_IMPORT_URL', plugin_dir_url( __FILE__ ) );
|
14 |
* Plugin Name: Advanced Import
|
15 |
* Plugin URI: https://addonspress.com/item/advanced-import
|
16 |
* Description: Easily import demo data starter site packages or Migrate your site data
|
17 |
+
* Version: 1.3.4
|
18 |
* Author: AddonsPress
|
19 |
* Author URI: https://addonspress.com/
|
20 |
* License: GPL-2.0+
|
24 |
*/
|
25 |
|
26 |
/*Define Constants for this plugin*/
|
27 |
+
define( 'ADVANCED_IMPORT_VERSION', '1.3.4' );
|
28 |
define( 'ADVANCED_IMPORT_PLUGIN_NAME', 'advanced-import' );
|
29 |
define( 'ADVANCED_IMPORT_PATH', plugin_dir_path( __FILE__ ) );
|
30 |
define( 'ADVANCED_IMPORT_URL', plugin_dir_url( __FILE__ ) );
|
assets/js/advanced-import-admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){let e,n,a,o,i=t(document),r=!1,c=!1;const l=function(t){let e,n,a=window.location.search.substring(1).split("&");for(n=0;n<a.length;n++)if((e=a[n].split("="))[0]===t)return void 0===e[1]||decodeURIComponent(e[1])},s=Swal.mixin({position:"bottom-end",showConfirmButton:!1,allowOutsideClick:!1,allowEscapeKey:!1,toast:!0}),
|
1 |
+
!function(t){let e,n,a,o,i=t(document),r=!1,c=!1;const l=function(t){let e,n,a=window.location.search.substring(1).split("&");for(n=0;n<a.length;n++)if((e=a[n].split("="))[0]===t)return void 0===e[1]||decodeURIComponent(e[1])},s=Swal.mixin({position:"bottom-end",showConfirmButton:!1,allowOutsideClick:!1,allowEscapeKey:!1,toast:!0}),d=function(e){"object"!=typeof e||null===e||e.success?(t("#ai-demo-popup").html(e),s.fire({type:"info",html:t("#ai-demo-popup .ai-notification-title").html()}),s.showLoading()):u(e.data.message)},u=function(t=null,e=null,n=null,a=null){let o=advanced_import_object.text.failedImport.text;o+=t||e||n||a?"<br/>"+advanced_import_object.text.failedImport.code:"",o+=t||"",o+=e||"",o+=n||"",o+=a||"",s.fire({type:"error",html:o}),f()},p=function(e=!1){s.fire({type:"info",html:t(".ai-notification-title").html()}),s.showLoading(),r=!0,m(e)},f=function(){r=!1,_()},m=function(t){return!!t&&(!c&&((c=t).append('<span class="ai-update dashicons dashicons-update"></span>'),c.attr("disabled",!0),void c.closest(".ai-item").addClass("ai-action-importing")))},_=function(){if(!c)return!1;c.children(".ai-update").remove(),c.attr("disabled",!1),c.closest(".ai-item").removeClass("ai-action-importing"),c=!1};function h(){return t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:{action:"content_screen",_wpnonce:e.val(),_wp_http_referer:n.val(),template_url:o,template_type:a}}).done(function(e){if("object"!=typeof e||null===e||e.success){d(e),(new function(){let e,n=0,i="",r="";function c(n){"object"==typeof n&&void 0!==n.message?(e.find("span").text(n.message),void 0!==n.url?n.hash===r?(e.find("span").text(advanced_import_object.text.failed),l()):(r=n.hash,t.ajax({type:"POST",url:n.url,data:n}).done(c).fail(c)):(n.done,l())):"object"!=typeof n||null===n||n.success?(e.find("span").text(advanced_import_object.text.error),l()):u(n.data.errorMessage?n.data.errorMessage:n.data.message)}function l(){e&&(e.data("done-item")||(n++,e.attr("data-done-item",1)),e.find(".spinner").remove());let r=!1,s=t("tr.ai-available-content");s.each(function(){let n=t(this);""===i||r?(i=n.data("content"),e=n,function(){if(i){let n=e.find("input:checkbox");n.is(":checked")?t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:{action:"import_content",wpnonce:advanced_import_object.wpnonce,content:i,template_url:o,template_type:a}}).done(c).fail(c):(e.find("span").text(advanced_import_object.text.skip),setTimeout(l,300))}}(),r=!1):n.data("content")===i&&(r=!0)}),n>=s.length&&complete()}return{init:function(){let e=t(".ai-pages");e.addClass("installing"),e.find("input").prop("disabled",!0),complete=function(){return t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:{action:"complete_screen"}}).done(function(e){return t("#ai-demo-popup").html(e),Swal.fire({title:"Success",html:t("#ai-demo-popup .ai-notification-title").html(),type:"success",allowOutsideClick:!1,showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:advanced_import_object.text.successImport.confirmButtonText,cancelButtonText:advanced_import_object.text.successImport.cancelButtonText}).then(e=>{e.value&&window.open(t("#ai-demo-popup .ai-actions-buttons a").attr("href"),"_blank")}),f(),!1}).fail(function(t,e,n){console.log(t+" :: "+e+" :: "+n)}),!1},l()}}}).init()}else u(e.data.errorMessage?e.data.errorMessage:e.data.message)}).fail(function(t,e,n){return u("",t,e,n),!1}),!1}function v(a){return t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:{action:"plugin_screen",_wpnonce:e.val(),_wp_http_referer:n.val(),recommendedPlugins:a}}).done(function(a){d(a),s.showLoading(),t("#ai-demo-popup .ai-plugins-wrap").find("li").each(function(){return function a(o){if("ai-no-recommended-plugins"===o.attr("id"))return h(),!1;t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:{action:"install_plugin",_wpnonce:e.val(),_wp_http_referer:n.val(),slug:o.data("slug"),plugin:o.data("slug")+"/"+o.data("main_file")}}).done(function(t){if("object"==typeof t&&void 0!==t.success)if(t.success){if(o.attr("data-completed",1),!o.next("li").length)return h(),!1;setTimeout(a(o.next("li")),1e3)}else u(t.data.errorMessage?t.data.errorMessage:t.data.message);else setTimeout(a(o),1e3)}).fail(function(t,e,n){return u("",t,e,n),!1})}(t(this)),!1})}).fail(function(t,e,n){return u("",t,e,n),!1}),!1}i.ready(function(){i.on("submit","#ai-upload-zip-form",function(a){if(a.preventDefault(),r)return!1;!function(a){if(void 0===window.FormData)return!0;let o=new FormData,i=a.find("#ai-upload-zip-archive"),r=t("#ai-empty-file");if(!i.val())return r.show(),u(r.html()),!1;r.hide(),p();let c=i[0].files[0];e=a.find("input[name=_wpnonce]"),n=a.find("input[name=_wp_http_referer]"),o.append("ai-upload-zip-archive",c),o.append("action","advanced_import_ajax_setup"),o.append("_wpnonce",e.val()),o.append("_wp_http_referer",n.val()),i.val(""),t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:o,cache:!1,contentType:!1,processData:!1}).done(function(t){return"object"!=typeof t&&(t=JSON.parse(t)),t.success?(h(),!1):(u(t.data.message),!1)}).fail(function(t,e,n){return u("",t,e,n),!1})}(t(this))}),i.on("click",".ai-item .ai-demo-import",function(i){if(i.preventDefault(),r)return!1;let c=t(this),l=t(this).data("plugins"),s="",d=advanced_import_object.text.confirmImport.html;l?(l.forEach(function(t,e){t.name&&(s+=" "+t.name,e<l.length-1&&(s+=","))}),d=d.replace("ai_replace_plugins",s)):d=d.replace("ai_replace_plugins",advanced_import_object.text.confirmImport.no_plugins),Swal.fire({title:advanced_import_object.text.confirmImport.title,html:d,width:"64rem",customClass:{content:"ai-confirm-import-content"},allowOutsideClick:!1,showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:advanced_import_object.text.confirmImport.confirmButtonText,cancelButtonText:advanced_import_object.text.confirmImport.cancelButtonText}).then(i=>{i.value&&(p(c),function(i,r){let c=i.closest(".ai-item");a=c.data("template_type"),o=c.data("template_url"),e=c.find("input[name=_wpnonce]"),n=c.find("input[name=_wp_http_referer]"),"array"===a?v(r):t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:{action:"demo_download_and_unzip",_wpnonce:e.val(),_wp_http_referer:n.val(),demo_file:o,demo_file_type:a}}).done(function(t){return t.success?(v(r),!1):(u(t.data.errorMessage?t.data.errorMessage:t.data.message,jqXHR,textStatus,errorThrown),!1)}).fail(function(t,e,n){return u("",t,e,n),!1})}(c,l))})}),i.on("click",".ai-wp-reset",function(e){e.preventDefault(),Swal.fire({title:advanced_import_object.text.confirmReset.title,text:advanced_import_object.text.confirmReset.text,type:"warning",allowOutsideClick:!1,showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:advanced_import_object.text.confirmReset.confirmButtonText,cancelButtonText:advanced_import_object.text.confirmReset.cancelButtonText}).then(e=>{e.value&&(window.location.href=t(".ai-wp-reset").attr("href"))})}),i.on("click",".ai-filter-tabs li",function(e){if(e.preventDefault(),r)return!1;t(this).hasClass("ai-form-file-import")?(t(".ai-filter-content").addClass("hidden"),t(".ai-form").removeClass("hidden")):(t(".ai-form").addClass("hidden"),t(".ai-filter-content").removeClass("hidden"))});let c,s,d={};setTimeout(function(){let e=t(".ai-filter-content-wrapper").isotope({itemSelector:".ai-item",filter:function(){let e=t(this),n=!s||e.text().match(s),a=!c||e.is(c);return n&&a}});function n(){let n=e.isotope("getFilteredItemElements"),a=t(n);t(".ai-filter-btn").each(function(e,n){let o=t(n),i=o.attr("data-filter");if(!i)return;let r=a.filter(i).length;o.find(".ai-count").text(r)})}e.imagesLoaded().progress(function(){e.isotope("layout")}),n(),t(".ai-filter-group").on("click",".ai-filter-btn",function(){let a=t(this),o=a.parents(".ai-filter-group").attr("data-filter-group");a.siblings().removeClass("ai-filter-btn-active"),a.addClass("ai-filter-btn-active"),d[o]=a.attr("data-filter"),c=function(t){let e="";for(let n in t)e+=t[n];return e}(d),setTimeout(function(){e.isotope(),(a.hasClass("ai-fp-filter")||a.hasClass("ai-type-filter"))&&n()},300)});let a=t(".ai-search-filter").keyup(function(t,e){let n;return e=e||100,function(){clearTimeout(n);let a=arguments,o=this;n=setTimeout(function(){t.apply(o,a)},e)}}(function(){s=new RegExp(a.val(),"gi"),e.isotope(),n()}))},1),function(){let t=l("reset"),e=l("from");"true"===t&&"ai-reset-wp"===e&&Swal.fire({title:advanced_import_object.text.resetSuccess.title,type:"success",allowOutsideClick:!1,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:advanced_import_object.text.resetSuccess.confirmButtonText})}()}),setTimeout(function(){let t=window.location.href;if(new RegExp("[?|&]reset=[0-9a-zA-Z_+-|.,;]*").test(t)){let t=new URL(location);t.searchParams.delete("reset"),t.searchParams.delete("from"),history.replaceState(null,null,t)}},1500)}(jQuery);
|
readme.txt
CHANGED
@@ -4,9 +4,9 @@ Contributors: addonspress, codersantosh, acmeit
|
|
4 |
Donate link: https://addonspress.com/
|
5 |
Tags: import, advanced import, demo import, theme import, widget import, customizer import
|
6 |
Requires at least: 5.0
|
7 |
-
Tested up to: 5.
|
8 |
Requires PHP: 5.6.20
|
9 |
-
Stable tag: 1.3.
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
@@ -224,6 +224,9 @@ Yes, many themes are using this plugin, for an example, you can look on [CosmosW
|
|
224 |
|
225 |
== Changelog ==
|
226 |
|
|
|
|
|
|
|
227 |
= 1.3.3 - 2021-06-15 =
|
228 |
* Added : Plugin info user consent
|
229 |
* Added : 4 new hooks: advanced_import_update_option_['option-name'], advanced_import_update_value_['option-name'] , advanced_import_menu_hook_suffix and advanced_import_current_url
|
4 |
Donate link: https://addonspress.com/
|
5 |
Tags: import, advanced import, demo import, theme import, widget import, customizer import
|
6 |
Requires at least: 5.0
|
7 |
+
Tested up to: 5.8.2
|
8 |
Requires PHP: 5.6.20
|
9 |
+
Stable tag: 1.3.4
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
224 |
|
225 |
== Changelog ==
|
226 |
|
227 |
+
= 1.3.4 - 2022-01-04 =
|
228 |
+
* Added : [Elementor global site settings](https://wordpress.org/support/topic/plugin-update-to-process-elementor-global-site-settings/)
|
229 |
+
|
230 |
= 1.3.3 - 2021-06-15 =
|
231 |
* Added : Plugin info user consent
|
232 |
* Added : 4 new hooks: advanced_import_update_option_['option-name'], advanced_import_update_value_['option-name'] , advanced_import_menu_hook_suffix and advanced_import_current_url
|