Version Description
- 2022-11-11 =
- Updated : Tested up WordPress 6.1
- Fixed : Minor changes
Download this release
Release Info
Developer | addonspress |
Plugin | Advanced Import : One Click Import for WordPress or Theme Demo Data |
Version | 1.3.8 |
Comparing to | |
See all releases |
Code changes from version 1.3.7 to 1.3.8
- admin/class-advanced-import-admin.php +17 -12
- admin/class-elementor-import.php +1 -1
- advanced-import.php +2 -2
- assets/js/advanced-import-admin.min.js +1 -1
- readme.txt +7 -2
admin/class-advanced-import-admin.php
CHANGED
@@ -1183,6 +1183,8 @@ class Advanced_Import_Admin {
|
|
1183 |
public function import_content() {
|
1184 |
|
1185 |
/*check for security*/
|
|
|
|
|
1186 |
if ( ! current_user_can( 'upload_files' ) ) {
|
1187 |
wp_send_json_error(
|
1188 |
array(
|
@@ -1468,10 +1470,10 @@ class Advanced_Import_Admin {
|
|
1468 |
}
|
1469 |
}
|
1470 |
|
1471 |
-
|
1472 |
|
1473 |
-
|
1474 |
-
|
1475 |
/*don't use post_exists because it will dupe up on media with same name but different slug*/
|
1476 |
if ( ! empty( $post_data['post_title'] ) && ! empty( $post_data['post_name'] ) ) {
|
1477 |
global $wpdb;
|
@@ -1599,7 +1601,7 @@ class Advanced_Import_Admin {
|
|
1599 |
}
|
1600 |
break;
|
1601 |
|
1602 |
-
|
1603 |
case 'elementor_library':
|
1604 |
if ( empty( $elementor_library_id ) ) {
|
1605 |
break;
|
@@ -1776,14 +1778,13 @@ class Advanced_Import_Admin {
|
|
1776 |
|
1777 |
/*finally insert post data*/
|
1778 |
|
1779 |
-
if( $foundid > 0 ){
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
}
|
1787 |
if ( ! is_wp_error( $post_id ) ) {
|
1788 |
|
1789 |
/*set id on imported_post_id*/
|
@@ -2395,6 +2396,8 @@ class Advanced_Import_Admin {
|
|
2395 |
public function complete_screen() {
|
2396 |
|
2397 |
/*check for security*/
|
|
|
|
|
2398 |
if ( ! current_user_can( 'upload_files' ) ) {
|
2399 |
wp_send_json_error(
|
2400 |
array(
|
@@ -2435,6 +2438,8 @@ class Advanced_Import_Admin {
|
|
2435 |
function install_plugin() {
|
2436 |
|
2437 |
/*check for security*/
|
|
|
|
|
2438 |
if ( ! current_user_can( 'install_plugins' ) ) {
|
2439 |
$status['errorMessage'] = __( 'Sorry, you are not allowed to install plugins on this site.', 'advanced-import' );
|
2440 |
wp_send_json_error( $status );
|
1183 |
public function import_content() {
|
1184 |
|
1185 |
/*check for security*/
|
1186 |
+
check_admin_referer( 'advanced_import_nonce' );
|
1187 |
+
|
1188 |
if ( ! current_user_can( 'upload_files' ) ) {
|
1189 |
wp_send_json_error(
|
1190 |
array(
|
1470 |
}
|
1471 |
}
|
1472 |
|
1473 |
+
$foundid = 0;
|
1474 |
|
1475 |
+
/*
|
1476 |
+
check if already exists by post_name and post_title*/
|
1477 |
/*don't use post_exists because it will dupe up on media with same name but different slug*/
|
1478 |
if ( ! empty( $post_data['post_title'] ) && ! empty( $post_data['post_name'] ) ) {
|
1479 |
global $wpdb;
|
1601 |
}
|
1602 |
break;
|
1603 |
|
1604 |
+
/*TODO*/
|
1605 |
case 'elementor_library':
|
1606 |
if ( empty( $elementor_library_id ) ) {
|
1607 |
break;
|
1778 |
|
1779 |
/*finally insert post data*/
|
1780 |
|
1781 |
+
if ( $foundid > 0 ) {
|
1782 |
+
$post_data['ID'] = $foundid;
|
1783 |
+
/*finally insert post data*/
|
1784 |
+
$post_id = wp_update_post( $post_data, true );
|
1785 |
+
} else {
|
1786 |
+
$post_id = wp_insert_post( $post_data, true );
|
1787 |
+
}
|
|
|
1788 |
if ( ! is_wp_error( $post_id ) ) {
|
1789 |
|
1790 |
/*set id on imported_post_id*/
|
2396 |
public function complete_screen() {
|
2397 |
|
2398 |
/*check for security*/
|
2399 |
+
check_admin_referer( 'advanced_import_nonce' );
|
2400 |
+
|
2401 |
if ( ! current_user_can( 'upload_files' ) ) {
|
2402 |
wp_send_json_error(
|
2403 |
array(
|
2438 |
function install_plugin() {
|
2439 |
|
2440 |
/*check for security*/
|
2441 |
+
check_admin_referer( 'advanced-import' );
|
2442 |
+
|
2443 |
if ( ! current_user_can( 'install_plugins' ) ) {
|
2444 |
$status['errorMessage'] = __( 'Sorry, you are not allowed to install plugins on this site.', 'advanced-import' );
|
2445 |
wp_send_json_error( $status );
|
admin/class-elementor-import.php
CHANGED
@@ -166,7 +166,7 @@ if ( ! class_exists( 'Advanced_Import_Elementor' ) ) {
|
|
166 |
if ( ! empty( $el_data['elements'] ) ) {
|
167 |
foreach ( $el_data['elements'] as $el_child_key => $child_el_data ) {
|
168 |
if ( 'widget' === $child_el_data['elType'] ) {
|
169 |
-
$settings = $child_el_data['settings']
|
170 |
|
171 |
if ( ! empty( $settings ) ) {
|
172 |
foreach ( $settings as $el_set_key => $el_set_data ) {
|
166 |
if ( ! empty( $el_data['elements'] ) ) {
|
167 |
foreach ( $el_data['elements'] as $el_child_key => $child_el_data ) {
|
168 |
if ( 'widget' === $child_el_data['elType'] ) {
|
169 |
+
$settings = isset( $child_el_data['settings'] ) ? $child_el_data['settings'] : array();
|
170 |
|
171 |
if ( ! empty( $settings ) ) {
|
172 |
foreach ( $settings as $el_set_key => $el_set_data ) {
|
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.8
|
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.8' );
|
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,i
|
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()):p(e.data.message)},p=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()},u=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()):p(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",_wpnonce:advanced_import_object.wpnonce}}).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 p(e.data.errorMessage?e.data.errorMessage:e.data.message)}).fail(function(t,e,n){return p("",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{let e="";t.data.errorMessage&&(e=t.data.errorMessage+"<br/>",e+=advanced_import_object.text.failedImport.pluginError+"<br/>",t.data.plugin&&(e+=advanced_import_object.text.failedImport.plugin+t.data.plugin+"<br/>"),t.data.slug&&(e+=advanced_import_object.text.failedImport.slug+t.data.slug+"<br/>")),p(e||t.data.message)}else setTimeout(a(o),1e3)}).fail(function(t,e,n){return p("",t,e,n),!1})}(t(this)),!1})}).fail(function(t,e,n){return p("",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(),p(r.html()),!1;r.hide(),u();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):(p(t.data.message),!1)}).fail(function(t,e,n){return p("",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&&(u(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):(p(t.data.errorMessage?t.data.errorMessage:t.data.message,jqXHR,textStatus,errorThrown),!1)}).fail(function(t,e,n){return p("",t,e,n),!1})}(c,l))})}),i.on("click",".ai-wp-reset",function(e){e.preventDefault();let n=t(this);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&&t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:{action:"advanced_import_before_reset",_wpnonce:n.siblings("input[name=advanced-import-reset]").val(),_wp_http_referer:n.siblings("input[name=_wp_http_referer]").val()},beforeSend:function(t){s.fire({type:"info",html:advanced_import_object.text.confirmReset.resetting}),s.showLoading()}}).done(function(e){if(!e.success)return p(e.data.message),!1;window.location.href=t(".ai-wp-reset").attr("href")}).fail(function(t,e,n){p("",t,e,n)})})}),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,d,f={};setTimeout(function(){let e=t(".ai-filter-content-wrapper").isotope({itemSelector:".ai-item",filter:function(){let e=t(this),n=!d||e.text().match(d),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"),f[o]=a.attr("data-filter"),c=function(t){let e="";for(let n in t)e+=t[n];return e}(f),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(){d=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: 6.
|
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,7 +224,12 @@ Yes, many themes are using this plugin, for an example, you can look on [CosmosW
|
|
224 |
|
225 |
== Changelog ==
|
226 |
|
|
|
|
|
|
|
|
|
227 |
= 1.3.7 - 2022-05-26 =
|
|
|
228 |
* Updated : Tested up WordPress 6
|
229 |
* Fixed : Elementor imports in some cases
|
230 |
|
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: 6.1
|
8 |
Requires PHP: 5.6.20
|
9 |
+
Stable tag: 1.3.8
|
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.8 - 2022-11-11 =
|
228 |
+
* Updated : Tested up WordPress 6.1
|
229 |
+
* Fixed : Minor changes
|
230 |
+
|
231 |
= 1.3.7 - 2022-05-26 =
|
232 |
+
* Added : Cron job
|
233 |
* Updated : Tested up WordPress 6
|
234 |
* Fixed : Elementor imports in some cases
|
235 |
|