Version Description
- 2022-02-04 =
- Added : Plugin Errors Details
- Updated : Latest version test
- Fixed : Reset errors with some plugins
Download this release
Release Info
Developer | addonspress |
Plugin | Advanced Import : One Click Import for WordPress or Theme Demo Data |
Version | 1.3.5 |
Comparing to | |
See all releases |
Code changes from version 1.3.4 to 1.3.5
- admin/class-advanced-import-admin.php +13 -7
- admin/class-reset.php +41 -2
- 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
@@ -342,8 +342,11 @@ class Advanced_Import_Admin {
|
|
342 |
'confirmButtonText' => esc_html__( 'Ok', 'advanced-import' ),
|
343 |
),
|
344 |
'failedImport' => array(
|
345 |
-
'code'
|
346 |
-
'text'
|
|
|
|
|
|
|
347 |
),
|
348 |
'successImport' => array(
|
349 |
'confirmButtonText' => esc_html__( 'Visit My Site', 'advanced-import' ),
|
@@ -1656,14 +1659,17 @@ class Advanced_Import_Admin {
|
|
1656 |
}
|
1657 |
}
|
1658 |
|
1659 |
-
array_walk_recursive(
|
1660 |
-
|
1661 |
-
|
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']
|
1667 |
|
1668 |
/*finally insert post data*/
|
1669 |
$post_id = wp_update_post( $post_data, true );
|
342 |
'confirmButtonText' => esc_html__( 'Ok', 'advanced-import' ),
|
343 |
),
|
344 |
'failedImport' => array(
|
345 |
+
'code' => __( 'Error Code:', 'advanced-import' ),
|
346 |
+
'text' => __( 'Contact theme author or try again', 'advanced-import' ),
|
347 |
+
'pluginError' => __( 'Your WordPress could not install the plugin correctly. You have to install the following plugin manually:', 'advanced-import' ),
|
348 |
+
'plugin' => __( 'Plugin:', 'advanced-import' ),
|
349 |
+
'slug' => __( 'Slug:', 'advanced-import' ),
|
350 |
),
|
351 |
'successImport' => array(
|
352 |
'confirmButtonText' => esc_html__( 'Visit My Site', 'advanced-import' ),
|
1659 |
}
|
1660 |
}
|
1661 |
|
1662 |
+
array_walk_recursive(
|
1663 |
+
$post_data['meta'],
|
1664 |
+
array(
|
1665 |
+
advanced_import_elementor(),
|
1666 |
+
'elementor_id_import',
|
1667 |
+
)
|
1668 |
+
);
|
1669 |
}
|
1670 |
/*do further filter if you need*/
|
1671 |
$post_data['post_id'] = apply_filters( 'advanced_import_post_data', $post_data );
|
1672 |
+
$post_data['ID'] = $elementor_library_id;
|
1673 |
|
1674 |
/*finally insert post data*/
|
1675 |
$post_id = wp_update_post( $post_data, true );
|
admin/class-reset.php
CHANGED
@@ -49,6 +49,41 @@ class Advanced_Import_Reset_WordPress {
|
|
49 |
return $instance;
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
/**
|
53 |
* Hide a notice if the GET variable is set.
|
54 |
*/
|
@@ -66,9 +101,13 @@ class Advanced_Import_Reset_WordPress {
|
|
66 |
$hide_notice = sanitize_text_field( $_GET['advanced-import-hide-notice'] );
|
67 |
|
68 |
if ( ! empty( $hide_notice ) && 'reset_notice' == $hide_notice ) {
|
69 |
-
|
70 |
}
|
71 |
}
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
|
74 |
/**
|
@@ -77,7 +116,7 @@ class Advanced_Import_Reset_WordPress {
|
|
77 |
public function reset_wizard_actions() {
|
78 |
global $wpdb, $current_user;
|
79 |
|
80 |
-
if ( ! empty( $_GET['ai_reset_wordpress'] ) && ! empty( $_GET['ai_reset_wordpress_nonce'] ) ) {
|
81 |
/*Security*/
|
82 |
if ( ! wp_verify_nonce( wp_unslash( $_GET['ai_reset_wordpress_nonce'] ), 'ai_reset_wordpress' ) ) { // WPCS: input var ok, sanitization ok.
|
83 |
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'advanced-import' ) );
|
49 |
return $instance;
|
50 |
}
|
51 |
|
52 |
+
/**
|
53 |
+
* Check if user can reset
|
54 |
+
*/
|
55 |
+
private function can_reset() {
|
56 |
+
if ( ! empty( $_GET['ai_reset_wordpress'] ) && ! empty( $_GET['ai_reset_wordpress_nonce'] ) ) {
|
57 |
+
/*Security*/
|
58 |
+
if ( ! wp_verify_nonce( wp_unslash( $_GET['ai_reset_wordpress_nonce'] ), 'ai_reset_wordpress' ) ) { // WPCS: input var ok, sanitization ok.
|
59 |
+
return false;
|
60 |
+
}
|
61 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
62 |
+
return false;
|
63 |
+
}
|
64 |
+
return true;
|
65 |
+
}
|
66 |
+
return false;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Attempt to deactivate the plugins which gives errors while reseting.
|
71 |
+
* We may add other plugins after testing/reported
|
72 |
+
*/
|
73 |
+
private function deactivate_plugins() {
|
74 |
+
if ( $this->can_reset() ) {
|
75 |
+
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
76 |
+
if ( ! function_exists( 'deactivate_plugins' ) ) {
|
77 |
+
return;
|
78 |
+
}
|
79 |
+
|
80 |
+
if ( is_plugin_active( 'elementor/elementor.php' ) ) {
|
81 |
+
deactivate_plugins( 'elementor/elementor.php' );
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
/**
|
88 |
* Hide a notice if the GET variable is set.
|
89 |
*/
|
101 |
$hide_notice = sanitize_text_field( $_GET['advanced-import-hide-notice'] );
|
102 |
|
103 |
if ( ! empty( $hide_notice ) && 'reset_notice' == $hide_notice ) {
|
104 |
+
advanced_import_update_option( 'advanced_import_reset_notice', 1 );
|
105 |
}
|
106 |
}
|
107 |
+
/*Deactivate troubleshoot plugins before reset*/
|
108 |
+
if ( $this->can_reset() ) {
|
109 |
+
$this->deactivate_plugins();
|
110 |
+
}
|
111 |
}
|
112 |
|
113 |
/**
|
116 |
public function reset_wizard_actions() {
|
117 |
global $wpdb, $current_user;
|
118 |
|
119 |
+
if ( ! empty( $_GET['ai_reset_wordpress'] ) && ! empty( $_GET['ai_reset_wordpress_nonce'] ) && $this->can_reset() ) {
|
120 |
/*Security*/
|
121 |
if ( ! wp_verify_nonce( wp_unslash( $_GET['ai_reset_wordpress_nonce'] ), 'ai_reset_wordpress' ) ) { // WPCS: input var ok, sanitization ok.
|
122 |
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'advanced-import' ) );
|
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.5
|
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.5' );
|
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,
|
1 |
+
!function(t){let e,a,n,o,i=t(document),r=!1,c=!1;const l=function(t){let e,a,n=window.location.search.substring(1).split("&");for(a=0;a<n.length;a++)if((e=n[a].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,a=null,n=null){let o=advanced_import_object.text.failedImport.text;o+=t||e||a||n?"<br/>"+advanced_import_object.text.failedImport.code:"",o+=t||"",o+=e||"",o+=a||"",o+=n||"",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:a.val(),template_url:o,template_type:n}}).done(function(e){if("object"!=typeof e||null===e||e.success){d(e),(new function(){let e,a=0,i="",r="";function c(a){"object"==typeof a&&void 0!==a.message?(e.find("span").text(a.message),void 0!==a.url?a.hash===r?(e.find("span").text(advanced_import_object.text.failed),l()):(r=a.hash,t.ajax({type:"POST",url:a.url,data:a}).done(c).fail(c)):(a.done,l())):"object"!=typeof a||null===a||a.success?(e.find("span").text(advanced_import_object.text.error),l()):u(a.data.errorMessage?a.data.errorMessage:a.data.message)}function l(){e&&(e.data("done-item")||(a++,e.attr("data-done-item",1)),e.find(".spinner").remove());let r=!1,s=t("tr.ai-available-content");s.each(function(){let a=t(this);""===i||r?(i=a.data("content"),e=a,function(){if(i){let a=e.find("input:checkbox");a.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:n}}).done(c).fail(c):(e.find("span").text(advanced_import_object.text.skip),setTimeout(l,300))}}(),r=!1):a.data("content")===i&&(r=!0)}),a>=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,a){console.log(t+" :: "+e+" :: "+a)}),!1},l()}}}).init()}else u(e.data.errorMessage?e.data.errorMessage:e.data.message)}).fail(function(t,e,a){return u("",t,e,a),!1}),!1}function v(n){return t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:{action:"plugin_screen",_wpnonce:e.val(),_wp_http_referer:a.val(),recommendedPlugins:n}}).done(function(n){d(n),s.showLoading(),t("#ai-demo-popup .ai-plugins-wrap").find("li").each(function(){return function n(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:a.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(n(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/>")),u(e||t.data.message)}else setTimeout(n(o),1e3)}).fail(function(t,e,a){return u("",t,e,a),!1})}(t(this)),!1})}).fail(function(t,e,a){return u("",t,e,a),!1}),!1}i.ready(function(){i.on("submit","#ai-upload-zip-form",function(n){if(n.preventDefault(),r)return!1;!function(n){if(void 0===window.FormData)return!0;let o=new FormData,i=n.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=n.find("input[name=_wpnonce]"),a=n.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",a.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,a){return u("",t,e,a),!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");n=c.data("template_type"),o=c.data("template_url"),e=c.find("input[name=_wpnonce]"),a=c.find("input[name=_wp_http_referer]"),"array"===n?v(r):t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:{action:"demo_download_and_unzip",_wpnonce:e.val(),_wp_http_referer:a.val(),demo_file:o,demo_file_type:n}}).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,a){return u("",t,e,a),!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),a=!s||e.text().match(s),n=!c||e.is(c);return a&&n}});function a(){let a=e.isotope("getFilteredItemElements"),n=t(a);t(".ai-filter-btn").each(function(e,a){let o=t(a),i=o.attr("data-filter");if(!i)return;let r=n.filter(i).length;o.find(".ai-count").text(r)})}e.imagesLoaded().progress(function(){e.isotope("layout")}),a(),t(".ai-filter-group").on("click",".ai-filter-btn",function(){let n=t(this),o=n.parents(".ai-filter-group").attr("data-filter-group");n.siblings().removeClass("ai-filter-btn-active"),n.addClass("ai-filter-btn-active"),d[o]=n.attr("data-filter"),c=function(t){let e="";for(let a in t)e+=t[a];return e}(d),setTimeout(function(){e.isotope(),(n.hasClass("ai-fp-filter")||n.hasClass("ai-type-filter"))&&a()},300)});let n=t(".ai-search-filter").keyup(function(t,e){let a;return e=e||100,function(){clearTimeout(a);let n=arguments,o=this;a=setTimeout(function(){t.apply(o,n)},e)}}(function(){s=new RegExp(n.val(),"gi"),e.isotope(),a()}))},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,11 @@ Yes, many themes are using this plugin, for an example, you can look on [CosmosW
|
|
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 |
|
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.9
|
8 |
Requires PHP: 5.6.20
|
9 |
+
Stable tag: 1.3.5
|
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.5 - 2022-02-04 =
|
228 |
+
* Added : Plugin Errors Details
|
229 |
+
* Updated : Latest version test
|
230 |
+
* Fixed : Reset errors with some plugins
|
231 |
+
|
232 |
= 1.3.4 - 2022-01-04 =
|
233 |
* Added : [Elementor global site settings](https://wordpress.org/support/topic/plugin-update-to-process-elementor-global-site-settings/)
|
234 |
|