Version Description
- 6th July 2020 =
- Feature - Single Page Importer
Download this release
Release Info
Developer | cyberchimps |
Plugin | Responsive Add Ons |
Version | 2.4.0 |
Comparing to | |
See all releases |
Code changes from version 2.3.1 to 2.4.0
- admin/css/responsive-ready-sites-admin.css +144 -1
- admin/js/responsive-ready-sites-admin.js +1028 -816
- admin/partials/responsive-ready-sites-admin-display.php +228 -56
- includes/class-responsive-add-ons.php +8 -7
- includes/importers/batch-processing/class-responsive-ready-sites-batch-processing-elementor.php +20 -2
- includes/importers/batch-processing/class-responsive-ready-sites-batch-processing-gutenberg.php +87 -0
- includes/importers/batch-processing/class-responsive-ready-sites-batch-processing.php +50 -4
- includes/importers/batch-processing/helpers/class-responsive-ready-sites-image-importer.php +252 -0
- includes/importers/batch-processing/helpers/class-wp-background-process-responsive-single.php +69 -0
- includes/importers/class-responsive-ready-sites-importer.php +101 -0
- readme.txt +6 -3
- responsive-add-ons.php +3 -3
admin/css/responsive-ready-sites-admin.css
CHANGED
@@ -74,7 +74,12 @@
|
|
74 |
.wp-full-overlay-header .button.responsive-addons{
|
75 |
float: none;
|
76 |
}
|
77 |
-
.wp-full-overlay-header .button.responsive-demo-import-options-free{
|
|
|
|
|
|
|
|
|
|
|
78 |
margin: 20px 20px 20px 20px;
|
79 |
font-size: 14px;
|
80 |
height: 30px;
|
@@ -282,6 +287,17 @@ responsive-ready-site-import-free.button.installing:before {
|
|
282 |
text-transform: uppercase;
|
283 |
box-shadow: -2px 2px 5px rgba(0,0,0,0.1);
|
284 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
.demo-type.free{
|
286 |
display:none;
|
287 |
}
|
@@ -403,6 +419,132 @@ responsive-ready-site-import-free.button.installing:before {
|
|
403 |
padding: 0px;
|
404 |
margin: 0px;
|
405 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
.responsive-add-ons-getting-started {
|
407 |
max-width: 900px;
|
408 |
padding: 2.5em 0;
|
@@ -555,3 +697,4 @@ responsive-ready-site-import-free.button.installing:before {
|
|
555 |
text-align: center;
|
556 |
}
|
557 |
}
|
|
74 |
.wp-full-overlay-header .button.responsive-addons{
|
75 |
float: none;
|
76 |
}
|
77 |
+
.wp-full-overlay-header .button.responsive-demo-import-options-free, .wp-full-overlay-header .button.responsive-page-import-options-template-free {
|
78 |
+
margin: 20px 20px 20px 20px;
|
79 |
+
font-size: 14px;
|
80 |
+
height: 30px;
|
81 |
+
}
|
82 |
+
.wp-full-overlay-header .button.responsive-page-import-options-free{
|
83 |
margin: 20px 20px 20px 20px;
|
84 |
font-size: 14px;
|
85 |
height: 30px;
|
287 |
text-transform: uppercase;
|
288 |
box-shadow: -2px 2px 5px rgba(0,0,0,0.1);
|
289 |
}
|
290 |
+
.current_active_site{
|
291 |
+
position: absolute;
|
292 |
+
left: 0;
|
293 |
+
top: 0;
|
294 |
+
background: #ff793f;
|
295 |
+
z-index: 1;
|
296 |
+
color: #fff;
|
297 |
+
padding: 0.5em 1em;
|
298 |
+
text-transform: uppercase;
|
299 |
+
box-shadow: -2px 2px 5px rgba(0,0,0,0.1);
|
300 |
+
}
|
301 |
.demo-type.free{
|
302 |
display:none;
|
303 |
}
|
419 |
padding: 0px;
|
420 |
margin: 0px;
|
421 |
}
|
422 |
+
.single-site {
|
423 |
+
display: flex;
|
424 |
+
}
|
425 |
+
.single-site-preview-wrap {
|
426 |
+
width: 55%
|
427 |
+
}
|
428 |
+
.single-site-pages-wrap {
|
429 |
+
width: 45%;
|
430 |
+
}
|
431 |
+
.single-site-pages-header {
|
432 |
+
display: flex;
|
433 |
+
justify-content: space-between;
|
434 |
+
align-items: center;
|
435 |
+
margin: 0 0 32px 0;
|
436 |
+
}
|
437 |
+
.single-site-preview {
|
438 |
+
margin-right: 4em;
|
439 |
+
max-height: calc(100vh - 280px);
|
440 |
+
height: 100vh;
|
441 |
+
overflow-y: auto;
|
442 |
+
border-radius: 2px;
|
443 |
+
box-shadow: 0 0 16px 0 rgba(0, 0, 0, 0.12);
|
444 |
+
margin-left: 5%;
|
445 |
+
}
|
446 |
+
.single-site-pages {
|
447 |
+
overflow-y: auto;
|
448 |
+
height: 100vh;
|
449 |
+
max-height: calc(100vh - 280px);
|
450 |
+
}
|
451 |
+
.single-site-preview img {
|
452 |
+
width: 100%;
|
453 |
+
vertical-align: middle;
|
454 |
+
}
|
455 |
+
.single-site-footer {
|
456 |
+
position: fixed;
|
457 |
+
padding: 15px 50px 15px 35px;
|
458 |
+
bottom: 0;
|
459 |
+
background: #fff;
|
460 |
+
right: 0;
|
461 |
+
left: 0;
|
462 |
+
z-index: 88;
|
463 |
+
box-shadow: 0 -2px 8px rgba( 0, 0, 0, 0.05);
|
464 |
+
}
|
465 |
+
.site-action-buttons-wrap {
|
466 |
+
display: flex;
|
467 |
+
justify-content: space-between;
|
468 |
+
}
|
469 |
+
.site-action-buttons-wrap .dashicons {
|
470 |
+
vertical-align: sub;
|
471 |
+
font-size: 1rem;
|
472 |
+
margin-left: .2em;
|
473 |
+
}
|
474 |
+
.single-site-pages {
|
475 |
+
overflow-y: auto;
|
476 |
+
height: 100vh;
|
477 |
+
max-height: calc(100vh - 280px);
|
478 |
+
}
|
479 |
+
|
480 |
+
.single-site-pages::-webkit-scrollbar {
|
481 |
+
width: 5px;
|
482 |
+
background-color: #f1f1f1;
|
483 |
+
}
|
484 |
+
|
485 |
+
.single-site-pages::-webkit-scrollbar-thumb {
|
486 |
+
border-radius: 0;
|
487 |
+
background-color: #d8d8d8;
|
488 |
+
}
|
489 |
+
|
490 |
+
.single-site-pages::-webkit-scrollbar-track {
|
491 |
+
-webkit-box-shadow: inset 0 0 0 rgba(0,0,0,.3);
|
492 |
+
width: 20px;
|
493 |
+
}
|
494 |
+
.theme-browser .theme .theme-screenshot {
|
495 |
+
filter: blur(0);
|
496 |
+
transition: filter 400ms linear;
|
497 |
+
}
|
498 |
+
.theme-browser .theme .site-preview > .theme-screenshot {
|
499 |
+
background-position: center top;
|
500 |
+
background-size: 100%;
|
501 |
+
background-repeat: no-repeat;
|
502 |
+
border-top-left-radius: 2px;
|
503 |
+
border-top-right-radius: 2px;
|
504 |
+
overflow: hidden;
|
505 |
+
background-color: #e5e5e5;
|
506 |
+
}
|
507 |
+
#single-pages .theme {
|
508 |
+
margin: 0 3.4% 3.4% 0;
|
509 |
+
border-radius: 2px;
|
510 |
+
border: none;
|
511 |
+
box-shadow: none;
|
512 |
+
}
|
513 |
+
.responsive-pages-title-wrap {
|
514 |
+
margin: 0 0 30px 0;
|
515 |
+
display: flex;
|
516 |
+
justify-content: space-between;
|
517 |
+
}
|
518 |
+
.responsive-pages-title {
|
519 |
+
position: relative;
|
520 |
+
}
|
521 |
+
#site-pages {
|
522 |
+
position: fixed;
|
523 |
+
left: 0;
|
524 |
+
right: 0;
|
525 |
+
margin: 50px 20px 0 25px;
|
526 |
+
z-index: 10;
|
527 |
+
}
|
528 |
+
#site-pages .theme-id-container {
|
529 |
+
background: #f1f1f1;
|
530 |
+
border: none;
|
531 |
+
display: flex;
|
532 |
+
align-items: center;
|
533 |
+
justify-content: center;
|
534 |
+
border-bottom-left-radius: 2px;
|
535 |
+
border-bottom-right-radius: 2px;
|
536 |
+
border-top: 1px solid #eeeeee;
|
537 |
+
}
|
538 |
+
.theme-browser #site-pages .theme .theme-name {
|
539 |
+
background: #f1f1f1;
|
540 |
+
box-shadow: none;
|
541 |
+
}
|
542 |
+
#site-pages .button.updating-message:before {
|
543 |
+
margin:12px 5px 0 -2px;
|
544 |
+
}
|
545 |
+
.responsive-ready-sites-import-button-wrap .button.updating-message:before {
|
546 |
+
margin: 11px 5px 0 -2px;
|
547 |
+
}
|
548 |
.responsive-add-ons-getting-started {
|
549 |
max-width: 900px;
|
550 |
padding: 2.5em 0;
|
697 |
text-align: center;
|
698 |
}
|
699 |
}
|
700 |
+
|
admin/js/responsive-ready-sites-admin.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
/**
|
2 |
* Responsive Ready Sites importer events
|
3 |
*
|
4 |
-
* @since 1.0.0
|
5 |
* @package Responsive Ready Sites
|
6 |
*/
|
7 |
|
@@ -12,8 +11,6 @@
|
|
12 |
* - remove()
|
13 |
* - run()
|
14 |
* - stop()
|
15 |
-
*
|
16 |
-
* @since 1.0.0
|
17 |
*/
|
18 |
var ResponsiveSitesAjaxQueue = (function() {
|
19 |
|
@@ -23,8 +20,6 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
23 |
|
24 |
/**
|
25 |
* Add AJAX request
|
26 |
-
*
|
27 |
-
* @since 1.0.0
|
28 |
*/
|
29 |
add: function(opt) {
|
30 |
requests.push( opt );
|
@@ -32,8 +27,6 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
32 |
|
33 |
/**
|
34 |
* Remove AJAX request
|
35 |
-
*
|
36 |
-
* @since 1.0.0
|
37 |
*/
|
38 |
remove: function(opt) {
|
39 |
if ( jQuery.inArray( opt, requests ) > -1 ) {
|
@@ -43,8 +36,6 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
43 |
|
44 |
/**
|
45 |
* Run / Process AJAX request
|
46 |
-
*
|
47 |
-
* @since 1.0.0
|
48 |
*/
|
49 |
run: function() {
|
50 |
var self = this,
|
@@ -76,8 +67,6 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
76 |
|
77 |
/**
|
78 |
* Stop AJAX request
|
79 |
-
*
|
80 |
-
* @since 1.0.0
|
81 |
*/
|
82 |
stop: function() {
|
83 |
|
@@ -90,6 +79,13 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
90 |
|
91 |
(function( $ ) {
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
var wxrImport = {
|
94 |
complete: {
|
95 |
posts: 0,
|
@@ -147,6 +143,60 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
147 |
}
|
148 |
};
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
ResponsiveSitesAdmin = {
|
151 |
|
152 |
reset_remaining_posts: 0,
|
@@ -176,6 +226,9 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
176 |
import_start_time : '',
|
177 |
import_end_time : '',
|
178 |
|
|
|
|
|
|
|
179 |
init: function()
|
180 |
{
|
181 |
this._resetPagedCount();
|
@@ -184,41 +237,57 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
184 |
|
185 |
/**
|
186 |
* Binds events for the Responsive Ready Sites.
|
187 |
-
*
|
188 |
-
* @since 1.0.0
|
189 |
-
* @access private
|
190 |
-
* @method _bind
|
191 |
*/
|
192 |
_bind: function()
|
193 |
{
|
|
|
194 |
$( document ).on( 'click' , '.import-demo-data, .responsive-ready-site-import-free', ResponsiveSitesAdmin._importDemo );
|
195 |
$( document ).on( 'click' , '.theme-browser .inactive.ra-site-single .theme-screenshot, .theme-browser .inactive.ra-site-single .more-details, .theme-browser .inactive.ra-site-single .install-theme-preview', ResponsiveSitesAdmin._preview );
|
196 |
$( document ).on( 'click' , '.theme-browser .active.ra-site-single .theme-screenshot, .theme-browser .active.ra-site-single .more-details, .theme-browser .active.ra-site-single .install-theme-preview', ResponsiveSitesAdmin._doNothing );
|
197 |
$( document ).on( 'click' , '.close-full-overlay', ResponsiveSitesAdmin._closeFullOverlay );
|
198 |
$( document ).on( 'click', '.responsive-demo-import-options-free', ResponsiveSitesAdmin._importSiteOptionsScreen );
|
199 |
$( document ).on( 'click', '.responsive-ready-sites-tooltip-icon', ResponsiveSitesAdmin._toggle_tooltip );
|
200 |
-
|
201 |
$( document ).on( 'responsive-get-active-theme' , ResponsiveSitesAdmin._is_responsive_theme_active );
|
202 |
$( document ).on( 'responsive-ready-sites-install-start' , ResponsiveSitesAdmin._process_import );
|
203 |
-
|
204 |
$( document ).on( 'responsive-ready-sites-import-set-site-data-done' , ResponsiveSitesAdmin._installRequiredPlugins );
|
205 |
$( document ).on( 'responsive-ready-sites-install-and-activate-required-plugins-done', ResponsiveSitesAdmin._resetData );
|
206 |
-
$( document ).on( 'responsive-ready-sites-reset-data' , ResponsiveSitesAdmin.
|
207 |
$( document ).on( 'responsive-ready-sites-backup-settings-before-reset-done' , ResponsiveSitesAdmin._reset_customizer_data );
|
208 |
$( document ).on( 'responsive-ready-sites-reset-customizer-data-done' , ResponsiveSitesAdmin._reset_site_options );
|
209 |
$( document ).on( 'responsive-ready-sites-reset-site-options-done' , ResponsiveSitesAdmin._reset_widgets_data );
|
210 |
$( document ).on( 'responsive-ready-sites-reset-widgets-data-done' , ResponsiveSitesAdmin._reset_terms );
|
211 |
$( document ).on( 'responsive-ready-sites-delete-terms-done' , ResponsiveSitesAdmin._reset_wp_forms );
|
212 |
$( document ).on( 'responsive-ready-sites-delete-wp-forms-done' , ResponsiveSitesAdmin._reset_posts );
|
213 |
-
|
214 |
$( document ).on( 'responsive-ready-sites-reset-data-done' , ResponsiveSitesAdmin._importWPForms );
|
215 |
$( document ).on( 'responsive-ready-sites-import-wpforms-done' , ResponsiveSitesAdmin._importXML );
|
216 |
$( document ).on( 'responsive-ready-sites-import-xml-done' , ResponsiveSitesAdmin._importCustomizerSettings );
|
217 |
$( document ).on( 'responsive-ready-sites-import-customizer-settings-done' , ResponsiveSitesAdmin._importWidgets );
|
218 |
$( document ).on( 'responsive-ready-sites-import-widgets-done' , ResponsiveSitesAdmin._importSiteOptions );
|
219 |
-
$( document ).on( 'responsive-ready-sites-import-options-done' , ResponsiveSitesAdmin.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
$( document ).on( 'wp-plugin-installing' , ResponsiveSitesAdmin._pluginInstalling );
|
221 |
-
$( document ).on( 'wp-plugin-install-success' , ResponsiveSitesAdmin.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
},
|
223 |
|
224 |
/**
|
@@ -229,55 +298,35 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
229 |
},
|
230 |
|
231 |
/**
|
232 |
-
*
|
233 |
*/
|
234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
title: ResponsiveSitesAdmin.active_site_title,
|
245 |
-
featured_image_url: ResponsiveSitesAdmin.active_site_featured_image_url,
|
246 |
-
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
247 |
-
}
|
248 |
}
|
249 |
-
|
250 |
-
|
251 |
-
function ( data ) {
|
252 |
-
|
253 |
-
// Fail - Import In-Complete.
|
254 |
-
if ( false === data.success ) {
|
255 |
-
// log.
|
256 |
-
} else {
|
257 |
-
|
258 |
-
var output = '<h2>Responsive Ready Site import complete.</h2>';
|
259 |
-
output += '<p><a class="button button-primary button-hero" href="' + responsiveSitesAdmin.siteURL + '" target="_blank">Launch Site</a></p>';
|
260 |
-
|
261 |
-
$( '.site-import-options' ).hide();
|
262 |
-
$( '.result_preview' ).html( '' ).show();
|
263 |
-
$( '.result_preview' ).html( output );
|
264 |
-
|
265 |
-
// Pass - Import Complete.
|
266 |
-
}
|
267 |
-
}
|
268 |
-
);
|
269 |
},
|
270 |
|
271 |
/**
|
272 |
-
*
|
273 |
*/
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
$( 'body' ).attr( 'data-responsive-demo-last-request', '1' );
|
278 |
-
$( 'body' ).attr( 'data-responsive-demo-paged', '1' );
|
279 |
-
$( 'body' ).attr( 'data-scrolling', false );
|
280 |
-
|
281 |
},
|
282 |
|
283 |
/**
|
@@ -297,10 +346,12 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
297 |
var demoId = self.data( 'demo-id' ) || '',
|
298 |
apiURL = self.data( 'demo-api' ) || '',
|
299 |
demoType = self.data( 'demo-type' ) || '',
|
|
|
300 |
check_plugins_installed = self.data( 'check_plugins_installed' ) || '',
|
301 |
demoURL = self.data( 'demo-url' ) || '',
|
302 |
screenshot = self.data( 'screenshot' ) || '',
|
303 |
demo_name = self.data( 'demo-name' ) || '',
|
|
|
304 |
demo_slug = self.data( 'demo-slug' ) || '',
|
305 |
requiredPlugins = self.data( 'required-plugins' ) || '',
|
306 |
responsiveSiteOptions = self.find( '.responsive-site-options' ).val() || '';
|
@@ -312,12 +363,14 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
312 |
demo_type: demoType,
|
313 |
check_plugins_installed: check_plugins_installed,
|
314 |
demo_url: demoURL,
|
|
|
315 |
demo_api: apiURL,
|
316 |
screenshot: screenshot,
|
317 |
name: demo_name,
|
318 |
slug: demo_slug,
|
319 |
required_plugins: JSON.stringify( requiredPlugins ),
|
320 |
responsive_site_options: responsiveSiteOptions,
|
|
|
321 |
}];
|
322 |
$( '#responsive-ready-sites-import-options' ).append( template( templateData[0] ) );
|
323 |
$( '.theme-install-overlay' ).css( 'display', 'block' );
|
@@ -434,207 +487,114 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
434 |
}
|
435 |
},
|
436 |
|
437 |
-
|
|
|
|
|
|
|
438 |
event.preventDefault();
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
443 |
},
|
444 |
|
445 |
/**
|
446 |
-
*
|
447 |
*/
|
448 |
-
|
449 |
-
|
450 |
$.ajax(
|
451 |
{
|
452 |
-
url
|
453 |
-
type
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
wpforms_path : ResponsiveSitesAdmin.wpforms_path,
|
458 |
-
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
459 |
},
|
460 |
}
|
461 |
)
|
462 |
-
.fail(
|
463 |
-
function( jqXHR ){
|
464 |
-
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
465 |
-
}
|
466 |
-
)
|
467 |
.done(
|
468 |
-
function (
|
469 |
-
if (
|
470 |
-
|
471 |
} else {
|
472 |
-
|
473 |
}
|
474 |
}
|
475 |
-
)
|
476 |
-
},
|
477 |
-
|
478 |
-
/**
|
479 |
-
* Import Customizer Setting
|
480 |
-
*/
|
481 |
-
_importCustomizerSettings: function() {
|
482 |
-
$.ajax(
|
483 |
-
{
|
484 |
-
url: responsiveSitesAdmin.ajaxurl,
|
485 |
-
type: 'POST',
|
486 |
-
dataType: 'json',
|
487 |
-
data: {
|
488 |
-
action: 'responsive-ready-sites-import-customizer-settings',
|
489 |
-
site_customizer_data: ResponsiveSitesAdmin.site_customizer_data,
|
490 |
-
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
491 |
-
},
|
492 |
-
beforeSend: function () {
|
493 |
-
$( '.responsive-ready-sites-import-customizer .responsive-ready-sites-tooltip-icon' ).addClass( 'processing-import' );
|
494 |
-
},
|
495 |
-
}
|
496 |
-
)
|
497 |
-
.fail(
|
498 |
-
function( jqXHR ){
|
499 |
-
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
500 |
-
}
|
501 |
-
)
|
502 |
-
.done(
|
503 |
-
function (forms) {
|
504 |
-
if (false === forms.success) {
|
505 |
-
// log.
|
506 |
-
} else {
|
507 |
-
$( '.responsive-ready-sites-import-customizer .responsive-ready-sites-tooltip-icon' ).removeClass( 'processing-import' );
|
508 |
-
$( '.responsive-ready-sites-import-customizer .responsive-ready-sites-tooltip-icon' ).addClass( 'processed-import' );
|
509 |
-
$( document ).trigger( 'responsive-ready-sites-import-customizer-settings-done' );
|
510 |
-
}
|
511 |
-
}
|
512 |
-
)
|
513 |
},
|
514 |
|
515 |
/**
|
516 |
-
*
|
517 |
*/
|
518 |
-
|
519 |
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
data : {
|
526 |
-
action : 'responsive-ready-sites-import-options',
|
527 |
-
options_data : ResponsiveSitesAdmin.site_options_data,
|
528 |
-
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
529 |
-
},
|
530 |
-
}
|
531 |
-
)
|
532 |
-
.fail(
|
533 |
-
function( jqXHR ){
|
534 |
-
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
535 |
-
}
|
536 |
-
)
|
537 |
-
.done(
|
538 |
-
function ( options_data ) {
|
539 |
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
|
|
544 |
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
|
|
550 |
},
|
551 |
|
552 |
/**
|
553 |
-
*
|
554 |
*/
|
555 |
-
|
|
|
556 |
$.ajax(
|
557 |
{
|
558 |
-
url
|
|
|
559 |
type : 'POST',
|
560 |
dataType: 'json',
|
561 |
-
data
|
562 |
-
action
|
563 |
-
|
564 |
-
|
565 |
-
},
|
566 |
}
|
567 |
)
|
568 |
-
.fail(
|
569 |
-
function( jqXHR ){
|
570 |
-
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
571 |
-
}
|
572 |
-
)
|
573 |
.done(
|
574 |
-
function (
|
575 |
-
|
576 |
-
if ( false === widgets_data.success ) {
|
577 |
-
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
578 |
-
|
579 |
-
} else {
|
580 |
-
|
581 |
-
$( document ).trigger( 'responsive-ready-sites-import-widgets-done' );
|
582 |
-
}
|
583 |
}
|
584 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
585 |
},
|
586 |
|
587 |
/**
|
588 |
-
*
|
589 |
-
|
590 |
-
|
591 |
-
{
|
592 |
-
if ( 0 === responsiveSitesAdmin.required_plugins.length ) {
|
593 |
-
return;
|
594 |
-
}
|
595 |
-
|
596 |
-
var not_installed = responsiveSitesAdmin.required_plugins.notinstalled || '';
|
597 |
-
var activate_plugins = responsiveSitesAdmin.required_plugins.inactive || '';
|
598 |
-
|
599 |
-
// Install wordpress.org plugins.
|
600 |
-
if ( not_installed.length > 0 ) {
|
601 |
-
ResponsiveSitesAdmin._installAllPlugins( not_installed );
|
602 |
-
}
|
603 |
-
|
604 |
-
// Activate wordpress.org plugins.
|
605 |
-
if ( activate_plugins.length > 0 ) {
|
606 |
-
ResponsiveSitesAdmin._activateAllPlugins( activate_plugins );
|
607 |
-
}
|
608 |
-
|
609 |
-
if ( activate_plugins.length <= 0 && not_installed.length <= 0 ) {
|
610 |
-
ResponsiveSitesAdmin._ready_for_import_site();
|
611 |
-
}
|
612 |
-
|
613 |
-
},
|
614 |
-
|
615 |
-
_ready_for_import_site: function () {
|
616 |
-
var notinstalled = responsiveSitesAdmin.required_plugins.notinstalled || 0;
|
617 |
-
var inactive = responsiveSitesAdmin.required_plugins.inactive || 0;
|
618 |
-
|
619 |
-
if ( ResponsiveSitesAdmin._areEqual( notinstalled.length, inactive.length ) ) {
|
620 |
-
$( document ).trigger( 'responsive-ready-sites-install-and-activate-required-plugins-done' );
|
621 |
-
}
|
622 |
-
},
|
623 |
-
|
624 |
-
_areEqual:function () {
|
625 |
-
var len = arguments.length;
|
626 |
-
for (var i = 1; i < len; i++) {
|
627 |
-
if (arguments[i] === null || arguments[i] !== arguments[i - 1]) {
|
628 |
-
return false;
|
629 |
-
}
|
630 |
-
}
|
631 |
-
return true;
|
632 |
-
},
|
633 |
-
|
634 |
-
/**
|
635 |
-
* Individual Site Preview
|
636 |
-
*
|
637 |
-
* On click on image, more link & preview button.
|
638 |
*/
|
639 |
_preview: function( event ) {
|
640 |
|
@@ -661,132 +621,169 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
661 |
*/
|
662 |
_renderDemoPreview: function(anchor) {
|
663 |
|
664 |
-
var demoId
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
demo_slug
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
|
|
|
|
676 |
|
677 |
var template = wp.template( 'responsive-ready-site-preview' );
|
678 |
|
679 |
templateData = [{
|
680 |
id: demoId,
|
681 |
demo_url: demoURL + '/?utm_source=free-to-pro&utm_medium=responsive-ready-site-importer&utm_campaign=responsive-pro&utm_content=preview',
|
682 |
-
demo_api:
|
683 |
screenshot: screenshot,
|
684 |
name: demo_name,
|
|
|
|
|
685 |
slug: demo_slug,
|
686 |
required_plugins: JSON.stringify( requiredPlugins ),
|
687 |
responsive_site_options: responsiveSiteOptions,
|
688 |
demo_type: demo_type,
|
689 |
check_plugins_installed: check_plugins_installed,
|
690 |
is_responsive_addons_pro_installed: isResponsiveAddonsProInstalled,
|
|
|
|
|
691 |
}];
|
|
|
692 |
$( '#responsive-ready-site-preview' ).append( template( templateData[0] ) );
|
693 |
$( '.theme-install-overlay' ).css( 'display', 'block' );
|
694 |
|
695 |
},
|
696 |
|
697 |
/**
|
698 |
-
*
|
699 |
*/
|
700 |
-
|
701 |
-
|
|
|
|
|
|
|
|
|
702 |
$.ajax(
|
703 |
{
|
704 |
-
url: responsiveSitesAdmin.ajaxurl,
|
705 |
-
async: false,
|
706 |
type : 'POST',
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
}
|
712 |
}
|
713 |
)
|
714 |
.done(
|
715 |
function ( response ) {
|
716 |
-
|
|
|
|
|
717 |
}
|
718 |
);
|
719 |
|
720 |
-
if (
|
721 |
-
|
722 |
-
} else {
|
723 |
-
return false;
|
724 |
}
|
|
|
725 |
},
|
726 |
|
727 |
-
|
728 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
729 |
$.ajax(
|
730 |
{
|
731 |
-
url: responsiveSitesAdmin.ajaxurl,
|
732 |
-
async: false,
|
733 |
type : 'POST',
|
734 |
dataType: 'json',
|
735 |
-
data: {
|
736 |
-
'action': '
|
|
|
737 |
'_ajax_nonce' : responsiveSitesAdmin._ajax_nonce,
|
738 |
-
}
|
739 |
}
|
740 |
)
|
|
|
|
|
|
|
|
|
|
|
741 |
.done(
|
742 |
-
function (
|
743 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
744 |
}
|
745 |
);
|
746 |
-
|
747 |
-
if (is_pro_installed.success) {
|
748 |
-
return true;
|
749 |
-
} else {
|
750 |
-
return false;
|
751 |
-
}
|
752 |
},
|
753 |
|
754 |
/**
|
755 |
-
*
|
756 |
*/
|
757 |
-
|
758 |
-
|
759 |
-
$.each(
|
760 |
-
activate_plugins,
|
761 |
-
function(index, single_plugin) {
|
762 |
-
|
763 |
-
ResponsiveSitesAjaxQueue.add(
|
764 |
-
{
|
765 |
-
url: responsiveSitesAdmin.ajaxurl,
|
766 |
-
type: 'POST',
|
767 |
-
data: {
|
768 |
-
'action' : 'responsive-ready-sites-required-plugin-activate',
|
769 |
-
'init' : single_plugin.init,
|
770 |
-
'_ajax_nonce' : responsiveSitesAdmin._ajax_nonce,
|
771 |
-
},
|
772 |
-
success: function( result ){
|
773 |
-
|
774 |
-
if ( result.success ) {
|
775 |
|
776 |
-
|
777 |
|
778 |
-
|
779 |
-
responsiveSitesAdmin.required_plugins.inactive = ResponsiveSitesAdmin._removePluginFromQueue( single_plugin.slug, pluginsList );
|
780 |
|
781 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
782 |
|
783 |
-
|
784 |
-
|
785 |
}
|
786 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
787 |
}
|
788 |
-
|
789 |
-
ResponsiveSitesAjaxQueue.run();
|
790 |
},
|
791 |
|
792 |
/**
|
@@ -801,6 +798,38 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
801 |
);
|
802 |
},
|
803 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
804 |
/**
|
805 |
* Install All Plugins.
|
806 |
*/
|
@@ -828,194 +857,195 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
828 |
},
|
829 |
|
830 |
/**
|
831 |
-
*
|
832 |
*/
|
833 |
-
|
|
|
|
|
834 |
|
835 |
-
|
836 |
-
{
|
837 |
-
url: responsiveSitesAdmin.ajaxurl,
|
838 |
-
type: 'POST',
|
839 |
-
dataType: 'json',
|
840 |
-
data: {
|
841 |
-
action: 'responsive-ready-sites-import-xml',
|
842 |
-
xml_path: ResponsiveSitesAdmin.xml_path,
|
843 |
-
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
844 |
-
},
|
845 |
-
beforeSend: function () {
|
846 |
-
$( '.responsive-ready-sites-import-process-wrap' ).show();
|
847 |
-
},
|
848 |
-
}
|
849 |
-
)
|
850 |
-
.fail(
|
851 |
-
function( jqXHR ){
|
852 |
-
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
853 |
-
}
|
854 |
-
)
|
855 |
-
.done(
|
856 |
-
function (xml_data) {
|
857 |
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
|
863 |
-
|
|
|
864 |
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
|
869 |
-
|
|
|
|
|
870 |
|
871 |
-
|
872 |
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
878 |
|
879 |
-
|
880 |
-
|
881 |
|
882 |
-
|
883 |
-
|
884 |
|
885 |
-
|
886 |
-
$( '.cybershimps-sites-import-process-wrap' ).hide();
|
887 |
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
}
|
893 |
-
};
|
894 |
-
evtSource.addEventListener(
|
895 |
-
'log',
|
896 |
-
function (message) {
|
897 |
-
var data = JSON.parse( message.data );
|
898 |
-
var message = data.message || '';
|
899 |
-
if (message && 'info' === data.level) {
|
900 |
-
message = message.replace(
|
901 |
-
/"/g,
|
902 |
-
function (letter) {
|
903 |
-
return '';
|
904 |
-
}
|
905 |
-
);
|
906 |
-
// log message on screen.
|
907 |
}
|
908 |
}
|
909 |
-
|
910 |
-
|
911 |
-
}
|
912 |
-
);
|
913 |
|
|
|
|
|
|
|
|
|
914 |
},
|
915 |
|
916 |
/**
|
917 |
-
*
|
918 |
-
*
|
919 |
-
* @since 1.0.0
|
920 |
-
* @access private
|
921 |
-
* @method _importDemo
|
922 |
*/
|
923 |
-
|
924 |
-
event.preventDefault();
|
925 |
|
926 |
-
|
|
|
|
|
927 |
|
928 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
929 |
|
930 |
-
|
931 |
|
932 |
-
|
933 |
-
$( '.responsive-ready-site-import-free' ).addClass( 'updating-message installing' )
|
934 |
-
.text( "Importing.." );
|
935 |
-
$( '.responsive-ready-site-import-free' ).addClass( 'disabled not-click-able' );
|
936 |
|
937 |
-
|
938 |
-
|
939 |
|
940 |
-
|
|
|
|
|
|
|
|
|
941 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
942 |
},
|
943 |
|
944 |
-
|
|
|
|
|
|
|
|
|
|
|
945 |
|
946 |
-
|
947 |
-
|
948 |
-
if (typeof data == 'object' ) {
|
949 |
-
var markup = '<p>' + JSON.stringify( data ) + '</p>';
|
950 |
}
|
|
|
951 |
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
|
|
|
|
|
|
957 |
|
958 |
-
|
959 |
-
.
|
960 |
-
|
961 |
-
$( '.responsive-ready-sites-tooltip-icon' ).removeClass( 'processed-import' );
|
962 |
-
$( '.responsive-ready-sites-tooltip-icon' ).removeClass( 'processing-import' );
|
963 |
-
$( '.responsive-ready-sites-import-process-wrap' ).hide();
|
964 |
},
|
965 |
|
966 |
/**
|
967 |
-
*
|
968 |
-
*
|
969 |
-
* @since 1.0.0
|
970 |
-
* @method _process_import
|
971 |
*/
|
972 |
-
|
|
|
973 |
|
974 |
-
|
|
|
|
|
975 |
|
976 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
977 |
|
|
|
|
|
|
|
|
|
978 |
$.ajax(
|
979 |
{
|
980 |
url : responsiveSitesAdmin.ajaxurl,
|
981 |
type : 'POST',
|
982 |
data : {
|
983 |
-
action : 'responsive-ready-sites-
|
984 |
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
|
|
985 |
},
|
986 |
}
|
987 |
)
|
|
|
|
|
|
|
|
|
|
|
988 |
.done(
|
989 |
-
function (
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
}
|
994 |
);
|
995 |
-
|
996 |
-
if ( apiURL ) {
|
997 |
-
ResponsiveSitesAdmin._importSite( apiURL );
|
998 |
-
}
|
999 |
-
|
1000 |
},
|
1001 |
|
1002 |
/**
|
1003 |
-
*
|
1004 |
-
*
|
1005 |
-
* @param {string} apiURL Site API URL.
|
1006 |
*/
|
1007 |
-
|
1008 |
-
|
1009 |
-
// Request Site Import.
|
1010 |
$.ajax(
|
1011 |
{
|
1012 |
url : responsiveSitesAdmin.ajaxurl,
|
1013 |
type : 'POST',
|
1014 |
-
dataType: 'json',
|
1015 |
data : {
|
1016 |
-
|
1017 |
-
|
1018 |
-
'_ajax_nonce' : responsiveSitesAdmin._ajax_nonce,
|
1019 |
},
|
1020 |
}
|
1021 |
)
|
@@ -1025,298 +1055,94 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
1025 |
}
|
1026 |
)
|
1027 |
.done(
|
1028 |
-
function (
|
1029 |
-
|
1030 |
-
// Check is site imported recently and set flag.
|
1031 |
-
|
1032 |
-
// 1. Fail - Request Site Import.
|
1033 |
-
if ( false === demo_data.success ) {
|
1034 |
-
ResponsiveSitesAdmin._log_error( demo_data.data, true );
|
1035 |
-
} else {
|
1036 |
-
|
1037 |
-
ResponsiveSitesAdmin.xml_path = encodeURI( demo_data.data['xml_path'] ) || '';
|
1038 |
-
ResponsiveSitesAdmin.wpforms_path = encodeURI( demo_data.data['wpforms_path'] ) || '';
|
1039 |
-
ResponsiveSitesAdmin.active_site_slug = demo_data.data['slug'] || '';
|
1040 |
-
ResponsiveSitesAdmin.active_site_title = demo_data.data['title'];
|
1041 |
-
ResponsiveSitesAdmin.active_site_featured_image_url = demo_data.data['featured_image_url'];
|
1042 |
-
ResponsiveSitesAdmin.site_customizer_data = JSON.stringify( demo_data.data['site_customizer_data'] ) || '';
|
1043 |
-
ResponsiveSitesAdmin.required_plugins = JSON.stringify( demo_data.data['required_plugins'] ) || '';
|
1044 |
-
ResponsiveSitesAdmin.required_pro_plugins = JSON.stringify( demo_data.data['required_pro_plugins'] || '' );
|
1045 |
-
ResponsiveSitesAdmin.widgets_data = JSON.stringify( demo_data.data['site_widgets_data'] ) || '';
|
1046 |
-
ResponsiveSitesAdmin.site_options_data = JSON.stringify( demo_data.data['site_options_data'] ) || '';
|
1047 |
-
|
1048 |
-
$( document ).trigger( 'responsive-ready-sites-import-set-site-data-done' );
|
1049 |
-
}
|
1050 |
}
|
1051 |
);
|
1052 |
},
|
1053 |
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
|
|
|
|
1070 |
}
|
1071 |
)
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
ResponsiveSitesAdmin._bulkPluginInstallActivate();
|
1078 |
-
}
|
1079 |
-
);
|
1080 |
-
|
1081 |
-
} else {
|
1082 |
-
$( document ).trigger( 'responsive-ready-sites-install-and-activate-required-plugins-done' );
|
1083 |
-
}
|
1084 |
},
|
1085 |
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1091 |
},
|
1092 |
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
|
1098 |
-
|
1099 |
-
|
1100 |
-
function(letter) {
|
1101 |
-
return letter.toUpperCase();
|
1102 |
-
}
|
1103 |
-
);
|
1104 |
-
|
1105 |
-
str = str.replace(
|
1106 |
-
/-/g,
|
1107 |
-
function(letter) {
|
1108 |
-
return ' ';
|
1109 |
-
}
|
1110 |
-
);
|
1111 |
-
|
1112 |
-
return str;
|
1113 |
-
},
|
1114 |
-
|
1115 |
-
/**
|
1116 |
-
* Install Success
|
1117 |
-
*/
|
1118 |
-
_installSuccess: function( event, response ) {
|
1119 |
-
|
1120 |
-
if ( typeof responsiveSitesAdmin.required_plugins.notinstalled !== 'undefined' && responsiveSitesAdmin.required_plugins.notinstalled ) {
|
1121 |
-
event.preventDefault();
|
1122 |
-
|
1123 |
-
// Reset not installed plugins list.
|
1124 |
-
var pluginsList = responsiveSitesAdmin.required_plugins.notinstalled;
|
1125 |
-
responsiveSitesAdmin.required_plugins.notinstalled = ResponsiveSitesAdmin._removePluginFromQueue( response.slug, pluginsList );
|
1126 |
-
|
1127 |
-
// WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that.
|
1128 |
-
setTimeout(
|
1129 |
-
function () {
|
1130 |
-
|
1131 |
-
var $init = $( '.plugin-card-' + response.slug ).data( 'init' );
|
1132 |
-
|
1133 |
-
$.ajax(
|
1134 |
-
{
|
1135 |
-
url: responsiveSitesAdmin.ajaxurl,
|
1136 |
-
type: 'POST',
|
1137 |
-
data: {
|
1138 |
-
'action': 'responsive-ready-sites-required-plugin-activate',
|
1139 |
-
'init': $init,
|
1140 |
-
'_ajax_nonce' : responsiveSitesAdmin._ajax_nonce,
|
1141 |
-
},
|
1142 |
-
}
|
1143 |
-
)
|
1144 |
-
.done(
|
1145 |
-
function (result) {
|
1146 |
-
|
1147 |
-
if (result.success) {
|
1148 |
-
var pluginsList = responsiveSitesAdmin.required_plugins.inactive;
|
1149 |
-
|
1150 |
-
// Reset not installed plugins list.
|
1151 |
-
responsiveSitesAdmin.required_plugins.inactive = ResponsiveSitesAdmin._removePluginFromQueue( response.slug, pluginsList );
|
1152 |
-
|
1153 |
-
$( '.responsive-ready-sites-import-plugins .responsive-ready-sites-tooltip-icon' ).addClass( 'processed-import' );
|
1154 |
-
ResponsiveSitesAdmin._ready_for_import_site();
|
1155 |
-
}
|
1156 |
-
}
|
1157 |
-
);
|
1158 |
-
|
1159 |
-
},
|
1160 |
-
1200
|
1161 |
-
);
|
1162 |
-
}
|
1163 |
-
},
|
1164 |
-
|
1165 |
-
_backup_before_rest_options: function() {
|
1166 |
-
ResponsiveSitesAdmin._backupOptions( 'responsive-ready-sites-backup-settings-before-reset-done' );
|
1167 |
-
ResponsiveSitesAdmin.backup_taken = true;
|
1168 |
-
},
|
1169 |
-
|
1170 |
-
_recheck_backup_options: function() {
|
1171 |
-
ResponsiveSitesAdmin._backupOptions( 'responsive-ready-sites-backup-settings-done' );
|
1172 |
-
ResponsiveSitesAdmin.backup_taken = true;
|
1173 |
-
},
|
1174 |
-
|
1175 |
-
_backupOptions: function( trigger_name ) {
|
1176 |
-
$.ajax(
|
1177 |
-
{
|
1178 |
-
url : responsiveSitesAdmin.ajaxurl,
|
1179 |
-
type : 'POST',
|
1180 |
-
data : {
|
1181 |
-
action : 'responsive-ready-sites-backup-settings',
|
1182 |
-
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1183 |
-
|
1184 |
-
},
|
1185 |
-
}
|
1186 |
-
)
|
1187 |
-
.fail(
|
1188 |
-
function( jqXHR ){
|
1189 |
-
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
1190 |
-
}
|
1191 |
-
)
|
1192 |
-
.done(
|
1193 |
-
function ( data ) {
|
1194 |
-
|
1195 |
-
// Custom trigger.
|
1196 |
-
$( document ).trigger( trigger_name );
|
1197 |
-
}
|
1198 |
-
);
|
1199 |
-
},
|
1200 |
-
|
1201 |
-
/**
|
1202 |
-
* Installing Plugin
|
1203 |
-
*/
|
1204 |
-
_pluginInstalling: function(event, args) {
|
1205 |
-
event.preventDefault();
|
1206 |
-
$( '.responsive-ready-sites-import-plugins .responsive-ready-sites-tooltip-icon' ).addClass( 'processing-import' );
|
1207 |
-
|
1208 |
-
},
|
1209 |
-
|
1210 |
-
_reset_customizer_data: function() {
|
1211 |
-
$.ajax(
|
1212 |
-
{
|
1213 |
-
url : responsiveSitesAdmin.ajaxurl,
|
1214 |
-
type : 'POST',
|
1215 |
-
data : {
|
1216 |
-
action : 'responsive-ready-sites-reset-customizer-data',
|
1217 |
-
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1218 |
-
},
|
1219 |
-
}
|
1220 |
-
)
|
1221 |
-
.fail(
|
1222 |
-
function( jqXHR ){
|
1223 |
-
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
1224 |
-
}
|
1225 |
-
)
|
1226 |
-
.done(
|
1227 |
-
function ( data ) {
|
1228 |
-
$( document ).trigger( 'responsive-ready-sites-reset-customizer-data-done' );
|
1229 |
-
}
|
1230 |
-
);
|
1231 |
-
},
|
1232 |
-
|
1233 |
-
_reset_site_options: function() {
|
1234 |
-
// Site Options.
|
1235 |
-
$.ajax(
|
1236 |
-
{
|
1237 |
-
url : responsiveSitesAdmin.ajaxurl,
|
1238 |
-
type : 'POST',
|
1239 |
-
data : {
|
1240 |
-
action : 'responsive-ready-sites-reset-site-options',
|
1241 |
-
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1242 |
-
},
|
1243 |
-
}
|
1244 |
-
)
|
1245 |
-
.fail(
|
1246 |
-
function( jqXHR ){
|
1247 |
-
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
1248 |
-
}
|
1249 |
-
)
|
1250 |
-
.done(
|
1251 |
-
function ( data ) {
|
1252 |
-
$( document ).trigger( 'responsive-ready-sites-reset-site-options-done' );
|
1253 |
-
}
|
1254 |
-
);
|
1255 |
-
},
|
1256 |
-
|
1257 |
-
_reset_widgets_data: function() {
|
1258 |
-
// Widgets.
|
1259 |
-
$.ajax(
|
1260 |
-
{
|
1261 |
-
url : responsiveSitesAdmin.ajaxurl,
|
1262 |
-
type : 'POST',
|
1263 |
-
data : {
|
1264 |
-
action : 'responsive-ready-sites-reset-widgets-data',
|
1265 |
-
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1266 |
-
},
|
1267 |
-
}
|
1268 |
-
)
|
1269 |
-
.fail(
|
1270 |
-
function( jqXHR ){
|
1271 |
-
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
1272 |
-
}
|
1273 |
-
)
|
1274 |
-
.done(
|
1275 |
-
function ( data ) {
|
1276 |
-
$( document ).trigger( 'responsive-ready-sites-reset-widgets-data-done' );
|
1277 |
-
}
|
1278 |
-
);
|
1279 |
-
},
|
1280 |
-
|
1281 |
-
/**
|
1282 |
-
* Full Overlay
|
1283 |
-
*/
|
1284 |
-
_closeFullOverlay: function (event) {
|
1285 |
-
event.preventDefault();
|
1286 |
-
location.reload();
|
1287 |
-
},
|
1288 |
-
|
1289 |
-
_reset_posts: function() {
|
1290 |
-
|
1291 |
-
if ( ResponsiveSitesAdmin.site_imported_data['reset_posts'].length ) {
|
1292 |
-
|
1293 |
-
ResponsiveSitesAdmin.reset_remaining_posts = ResponsiveSitesAdmin.site_imported_data['reset_posts'].length;
|
1294 |
|
1295 |
$.each(
|
1296 |
-
ResponsiveSitesAdmin.site_imported_data['
|
1297 |
-
function(index,
|
1298 |
-
|
1299 |
ResponsiveSitesAjaxQueue.add(
|
1300 |
{
|
1301 |
url: responsiveSitesAdmin.ajaxurl,
|
1302 |
type: 'POST',
|
1303 |
data: {
|
1304 |
-
action : 'responsive-ready-sites-delete-
|
1305 |
-
|
1306 |
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1307 |
},
|
1308 |
success: function( result ){
|
1309 |
-
|
1310 |
-
|
1311 |
-
ResponsiveSitesAdmin.reset_processed_posts += 1;
|
1312 |
}
|
1313 |
|
1314 |
-
ResponsiveSitesAdmin.
|
1315 |
-
if ( 0 == ResponsiveSitesAdmin.
|
1316 |
-
$( document ).trigger( 'responsive-ready-sites-delete-
|
1317 |
-
$( '.responsive-ready-sites-reset-data .responsive-ready-sites-tooltip-icon' ).removeClass( 'processing-import' );
|
1318 |
-
$( '.responsive-ready-sites-reset-data .responsive-ready-sites-tooltip-icon' ).addClass( 'processed-import' );
|
1319 |
-
$( document ).trigger( 'responsive-ready-sites-reset-data-done' );
|
1320 |
}
|
1321 |
}
|
1322 |
}
|
@@ -1326,12 +1152,13 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
1326 |
ResponsiveSitesAjaxQueue.run();
|
1327 |
|
1328 |
} else {
|
1329 |
-
$( document ).trigger( 'responsive-ready-sites-delete-
|
1330 |
-
$( '.responsive-ready-sites-reset-data .responsive-ready-sites-tooltip-icon' ).addClass( 'processed-import' );
|
1331 |
-
$( document ).trigger( 'responsive-ready-sites-reset-data-done' );
|
1332 |
}
|
1333 |
},
|
1334 |
|
|
|
|
|
|
|
1335 |
_reset_wp_forms: function() {
|
1336 |
|
1337 |
if ( ResponsiveSitesAdmin.site_imported_data['reset_wp_forms'].length ) {
|
@@ -1372,31 +1199,39 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
1372 |
|
1373 |
},
|
1374 |
|
1375 |
-
|
|
|
|
|
|
|
1376 |
|
1377 |
-
if ( ResponsiveSitesAdmin.site_imported_data['
|
1378 |
-
|
|
|
1379 |
|
1380 |
$.each(
|
1381 |
-
ResponsiveSitesAdmin.site_imported_data['
|
1382 |
-
function(index,
|
|
|
1383 |
ResponsiveSitesAjaxQueue.add(
|
1384 |
{
|
1385 |
url: responsiveSitesAdmin.ajaxurl,
|
1386 |
type: 'POST',
|
1387 |
data: {
|
1388 |
-
action : 'responsive-ready-sites-delete-
|
1389 |
-
|
1390 |
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1391 |
},
|
1392 |
success: function( result ){
|
1393 |
-
|
1394 |
-
|
|
|
1395 |
}
|
1396 |
|
1397 |
-
ResponsiveSitesAdmin.
|
1398 |
-
if ( 0 == ResponsiveSitesAdmin.
|
1399 |
-
$(
|
|
|
|
|
1400 |
}
|
1401 |
}
|
1402 |
}
|
@@ -1406,198 +1241,575 @@ var ResponsiveSitesAjaxQueue = (function() {
|
|
1406 |
ResponsiveSitesAjaxQueue.run();
|
1407 |
|
1408 |
} else {
|
1409 |
-
$(
|
|
|
1410 |
}
|
1411 |
},
|
1412 |
|
1413 |
-
|
|
|
|
|
|
|
1414 |
|
1415 |
-
// reset customizer data.
|
1416 |
$.ajax(
|
1417 |
{
|
1418 |
url : responsiveSitesAdmin.ajaxurl,
|
1419 |
type : 'POST',
|
|
|
1420 |
data : {
|
1421 |
-
action
|
|
|
1422 |
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1423 |
-
|
1424 |
},
|
1425 |
}
|
1426 |
)
|
1427 |
.fail(
|
1428 |
function( jqXHR ){
|
1429 |
-
|
1430 |
}
|
1431 |
)
|
1432 |
.done(
|
1433 |
-
function (
|
1434 |
-
|
1435 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1436 |
);
|
1437 |
|
1438 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1439 |
$.ajax(
|
1440 |
{
|
1441 |
url : responsiveSitesAdmin.ajaxurl,
|
1442 |
type : 'POST',
|
|
|
1443 |
data : {
|
1444 |
-
action
|
|
|
1445 |
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1446 |
},
|
1447 |
}
|
1448 |
)
|
1449 |
.fail(
|
1450 |
function( jqXHR ){
|
1451 |
-
|
1452 |
}
|
1453 |
)
|
1454 |
.done(
|
1455 |
-
function (
|
1456 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1457 |
}
|
1458 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
1459 |
|
1460 |
-
// Widgets.
|
1461 |
$.ajax(
|
1462 |
{
|
1463 |
url : responsiveSitesAdmin.ajaxurl,
|
1464 |
type : 'POST',
|
|
|
1465 |
data : {
|
1466 |
-
action
|
|
|
1467 |
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1468 |
},
|
1469 |
}
|
1470 |
)
|
1471 |
.fail(
|
1472 |
function( jqXHR ){
|
1473 |
-
|
1474 |
}
|
1475 |
)
|
1476 |
.done(
|
1477 |
-
function (
|
1478 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1479 |
}
|
1480 |
);
|
|
|
1481 |
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1490 |
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
data: {
|
1496 |
-
action : 'responsive-ready-sites-delete-posts',
|
1497 |
-
post_id : post_id,
|
1498 |
-
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1499 |
-
},
|
1500 |
-
success: function( result ){
|
1501 |
|
1502 |
-
|
1503 |
-
|
1504 |
-
}
|
1505 |
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
}
|
1511 |
);
|
1512 |
-
|
1513 |
|
1514 |
-
|
|
|
|
|
|
|
|
|
1515 |
|
1516 |
-
|
1517 |
-
if ( ResponsiveSitesAdmin.site_imported_data['reset_wp_forms'].length ) {
|
1518 |
-
ResponsiveSitesAdmin.reset_remaining_wp_forms = ResponsiveSitesAdmin.site_imported_data['reset_wp_forms'].length;
|
1519 |
|
1520 |
-
|
1521 |
-
ResponsiveSitesAdmin.site_imported_data['reset_wp_forms'],
|
1522 |
-
function(index, post_id) {
|
1523 |
-
ResponsiveSitesAjaxQueue.add(
|
1524 |
-
{
|
1525 |
-
url: responsiveSitesAdmin.ajaxurl,
|
1526 |
-
type: 'POST',
|
1527 |
-
data: {
|
1528 |
-
action : 'responsive-ready-sites-delete-wp-forms',
|
1529 |
-
post_id : post_id,
|
1530 |
-
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1531 |
-
},
|
1532 |
-
success: function( result ){
|
1533 |
|
1534 |
-
|
1535 |
-
ResponsiveSitesAdmin.reset_processed_wp_forms += 1;
|
1536 |
-
}
|
1537 |
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
)
|
1544 |
-
|
|
|
1545 |
|
1546 |
-
|
1547 |
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1551 |
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
url: responsiveSitesAdmin.ajaxurl,
|
1558 |
-
type: 'POST',
|
1559 |
-
data: {
|
1560 |
-
action : 'responsive-ready-sites-delete-terms',
|
1561 |
-
term_id : term_id,
|
1562 |
-
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1563 |
-
},
|
1564 |
-
success: function( result ){
|
1565 |
-
if ( ResponsiveSitesAdmin.reset_processed_terms < ResponsiveSitesAdmin.site_imported_data['reset_terms'].length ) {
|
1566 |
-
ResponsiveSitesAdmin.reset_processed_terms += 1;
|
1567 |
-
}
|
1568 |
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1574 |
);
|
1575 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1576 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1577 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1578 |
},
|
1579 |
|
1580 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1581 |
$.ajax(
|
1582 |
{
|
1583 |
-
url: responsiveSitesAdmin.ajaxurl,
|
1584 |
-
type: 'POST',
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
|
|
|
|
1588 |
},
|
1589 |
}
|
1590 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
1591 |
.done(
|
1592 |
-
function (
|
1593 |
-
|
1594 |
-
|
|
|
|
|
1595 |
} else {
|
1596 |
-
|
|
|
|
|
1597 |
}
|
1598 |
}
|
1599 |
);
|
1600 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1601 |
};
|
1602 |
|
1603 |
/**
|
1 |
/**
|
2 |
* Responsive Ready Sites importer events
|
3 |
*
|
|
|
4 |
* @package Responsive Ready Sites
|
5 |
*/
|
6 |
|
11 |
* - remove()
|
12 |
* - run()
|
13 |
* - stop()
|
|
|
|
|
14 |
*/
|
15 |
var ResponsiveSitesAjaxQueue = (function() {
|
16 |
|
20 |
|
21 |
/**
|
22 |
* Add AJAX request
|
|
|
|
|
23 |
*/
|
24 |
add: function(opt) {
|
25 |
requests.push( opt );
|
27 |
|
28 |
/**
|
29 |
* Remove AJAX request
|
|
|
|
|
30 |
*/
|
31 |
remove: function(opt) {
|
32 |
if ( jQuery.inArray( opt, requests ) > -1 ) {
|
36 |
|
37 |
/**
|
38 |
* Run / Process AJAX request
|
|
|
|
|
39 |
*/
|
40 |
run: function() {
|
41 |
var self = this,
|
67 |
|
68 |
/**
|
69 |
* Stop AJAX request
|
|
|
|
|
70 |
*/
|
71 |
stop: function() {
|
72 |
|
79 |
|
80 |
(function( $ ) {
|
81 |
|
82 |
+
/**
|
83 |
+
* WXR Import
|
84 |
+
*
|
85 |
+
* - updateDelta()
|
86 |
+
* - updateProgress()
|
87 |
+
* - render()
|
88 |
+
*/
|
89 |
var wxrImport = {
|
90 |
complete: {
|
91 |
posts: 0,
|
143 |
}
|
144 |
};
|
145 |
|
146 |
+
/**
|
147 |
+
* Responsive Sites Admin
|
148 |
+
*
|
149 |
+
* - init()
|
150 |
+
* - _bind()
|
151 |
+
* - _resetPagedCount()
|
152 |
+
* - _doNothing()
|
153 |
+
* - _toggle_tooltip()
|
154 |
+
* - _areEqual()
|
155 |
+
* - _closeFullOverlay()
|
156 |
+
* - _importSiteOptionsScreen()
|
157 |
+
* - _importDemo()
|
158 |
+
* - _is_responsive_theme_active()
|
159 |
+
* - _log_error()
|
160 |
+
* - _checkResponsiveAddonsProInstalled()
|
161 |
+
* - _preview()
|
162 |
+
* - _renderDemoPreview()
|
163 |
+
* - _process_import()
|
164 |
+
* - _importSite()
|
165 |
+
* - _installRequiredPlugins()
|
166 |
+
* - _removePluginFromQueue()
|
167 |
+
* - _bulkPluginInstallActivate()
|
168 |
+
* - _installAllPlugins()
|
169 |
+
* - _pluginInstalling()
|
170 |
+
* - _pluginInstallSuccess()
|
171 |
+
* - _activateAllPlugins()
|
172 |
+
* - _ready_for_import_site()
|
173 |
+
* - _ready_for_import_template()
|
174 |
+
* - _resetData()
|
175 |
+
* - _backup_before_reset_options()
|
176 |
+
* - _backupOptions()
|
177 |
+
* - _reset_customizer_data()
|
178 |
+
* - _reset_site_options()
|
179 |
+
* - _reset_widgets_data()
|
180 |
+
* - _reset_terms()
|
181 |
+
* - _reset_wp_forms()
|
182 |
+
* - _reset_posts()
|
183 |
+
* - _importWPForms()
|
184 |
+
* - _importXML()
|
185 |
+
* - _importCustomizerSettings()
|
186 |
+
* - _importWidgets()
|
187 |
+
* - _importCustomizerSettings()
|
188 |
+
* - _importSiteOptions()
|
189 |
+
* - _importSiteEnd()
|
190 |
+
* - _importPagePreviewScreen()
|
191 |
+
* - _change_site_preview_screenshot()
|
192 |
+
* - _set_preview_screenshot_by_page()
|
193 |
+
* - _importSinglePageOptions()
|
194 |
+
* - _importSinglePage()
|
195 |
+
* - _get_id()
|
196 |
+
* - _import_wpform()
|
197 |
+
* - _importPage()
|
198 |
+
* - ucwords()
|
199 |
+
*/
|
200 |
ResponsiveSitesAdmin = {
|
201 |
|
202 |
reset_remaining_posts: 0,
|
226 |
import_start_time : '',
|
227 |
import_end_time : '',
|
228 |
|
229 |
+
current_page_id : '',
|
230 |
+
processing_single_template: false,
|
231 |
+
|
232 |
init: function()
|
233 |
{
|
234 |
this._resetPagedCount();
|
237 |
|
238 |
/**
|
239 |
* Binds events for the Responsive Ready Sites.
|
|
|
|
|
|
|
|
|
240 |
*/
|
241 |
_bind: function()
|
242 |
{
|
243 |
+
// Site Import events.
|
244 |
$( document ).on( 'click' , '.import-demo-data, .responsive-ready-site-import-free', ResponsiveSitesAdmin._importDemo );
|
245 |
$( document ).on( 'click' , '.theme-browser .inactive.ra-site-single .theme-screenshot, .theme-browser .inactive.ra-site-single .more-details, .theme-browser .inactive.ra-site-single .install-theme-preview', ResponsiveSitesAdmin._preview );
|
246 |
$( document ).on( 'click' , '.theme-browser .active.ra-site-single .theme-screenshot, .theme-browser .active.ra-site-single .more-details, .theme-browser .active.ra-site-single .install-theme-preview', ResponsiveSitesAdmin._doNothing );
|
247 |
$( document ).on( 'click' , '.close-full-overlay', ResponsiveSitesAdmin._closeFullOverlay );
|
248 |
$( document ).on( 'click', '.responsive-demo-import-options-free', ResponsiveSitesAdmin._importSiteOptionsScreen );
|
249 |
$( document ).on( 'click', '.responsive-ready-sites-tooltip-icon', ResponsiveSitesAdmin._toggle_tooltip );
|
|
|
250 |
$( document ).on( 'responsive-get-active-theme' , ResponsiveSitesAdmin._is_responsive_theme_active );
|
251 |
$( document ).on( 'responsive-ready-sites-install-start' , ResponsiveSitesAdmin._process_import );
|
|
|
252 |
$( document ).on( 'responsive-ready-sites-import-set-site-data-done' , ResponsiveSitesAdmin._installRequiredPlugins );
|
253 |
$( document ).on( 'responsive-ready-sites-install-and-activate-required-plugins-done', ResponsiveSitesAdmin._resetData );
|
254 |
+
$( document ).on( 'responsive-ready-sites-reset-data' , ResponsiveSitesAdmin._backup_before_reset_options );
|
255 |
$( document ).on( 'responsive-ready-sites-backup-settings-before-reset-done' , ResponsiveSitesAdmin._reset_customizer_data );
|
256 |
$( document ).on( 'responsive-ready-sites-reset-customizer-data-done' , ResponsiveSitesAdmin._reset_site_options );
|
257 |
$( document ).on( 'responsive-ready-sites-reset-site-options-done' , ResponsiveSitesAdmin._reset_widgets_data );
|
258 |
$( document ).on( 'responsive-ready-sites-reset-widgets-data-done' , ResponsiveSitesAdmin._reset_terms );
|
259 |
$( document ).on( 'responsive-ready-sites-delete-terms-done' , ResponsiveSitesAdmin._reset_wp_forms );
|
260 |
$( document ).on( 'responsive-ready-sites-delete-wp-forms-done' , ResponsiveSitesAdmin._reset_posts );
|
|
|
261 |
$( document ).on( 'responsive-ready-sites-reset-data-done' , ResponsiveSitesAdmin._importWPForms );
|
262 |
$( document ).on( 'responsive-ready-sites-import-wpforms-done' , ResponsiveSitesAdmin._importXML );
|
263 |
$( document ).on( 'responsive-ready-sites-import-xml-done' , ResponsiveSitesAdmin._importCustomizerSettings );
|
264 |
$( document ).on( 'responsive-ready-sites-import-customizer-settings-done' , ResponsiveSitesAdmin._importWidgets );
|
265 |
$( document ).on( 'responsive-ready-sites-import-widgets-done' , ResponsiveSitesAdmin._importSiteOptions );
|
266 |
+
$( document ).on( 'responsive-ready-sites-import-options-done' , ResponsiveSitesAdmin._importSiteEnd );
|
267 |
+
|
268 |
+
// Single Page Import events.
|
269 |
+
$( document ).on( 'click' , '.single-page-import-button-free', ResponsiveSitesAdmin._importSinglePageOptions );
|
270 |
+
$( document ).on( 'click' , '.responsive-ready-page-import-free', ResponsiveSitesAdmin._importSinglePage );
|
271 |
+
$( document ).on( 'click', '.responsive-page-import-options-free', ResponsiveSitesAdmin._importPagePreviewScreen );
|
272 |
+
$( document ).on( 'click' , '#single-pages .site-single', ResponsiveSitesAdmin._change_site_preview_screenshot );
|
273 |
+
$( document ).on( 'responsive-ready-page-install-and-activate-required-plugins-done' , ResponsiveSitesAdmin._importPage );
|
274 |
+
$( document ).on( 'responsive-ready-sites-import-page-free-start' , ResponsiveSitesAdmin._installRequiredPlugins );
|
275 |
+
|
276 |
+
// Wordpress Plugin install events.
|
277 |
$( document ).on( 'wp-plugin-installing' , ResponsiveSitesAdmin._pluginInstalling );
|
278 |
+
$( document ).on( 'wp-plugin-install-success' , ResponsiveSitesAdmin._pluginInstallSuccess );
|
279 |
+
},
|
280 |
+
|
281 |
+
/**
|
282 |
+
* Reset Page Count.
|
283 |
+
*/
|
284 |
+
_resetPagedCount: function() {
|
285 |
+
|
286 |
+
$( 'body' ).addClass( 'loading-content' );
|
287 |
+
$( 'body' ).attr( 'data-responsive-demo-last-request', '1' );
|
288 |
+
$( 'body' ).attr( 'data-responsive-demo-paged', '1' );
|
289 |
+
$( 'body' ).attr( 'data-scrolling', false );
|
290 |
+
|
291 |
},
|
292 |
|
293 |
/**
|
298 |
},
|
299 |
|
300 |
/**
|
301 |
+
* toggle tooltip
|
302 |
*/
|
303 |
+
_toggle_tooltip: function( event ) {
|
304 |
+
event.preventDefault();
|
305 |
+
var tip_id = $( this ).data( 'tip-id' ) || '';
|
306 |
+
if ( tip_id && $( '#' + tip_id ).length ) {
|
307 |
+
$( '#' + tip_id ).toggle();
|
308 |
+
}
|
309 |
+
},
|
310 |
|
311 |
+
/**
|
312 |
+
* Check if arrays are equal
|
313 |
+
*/
|
314 |
+
_areEqual:function () {
|
315 |
+
var len = arguments.length;
|
316 |
+
for (var i = 1; i < len; i++) {
|
317 |
+
if (arguments[i] === null || arguments[i] !== arguments[i - 1]) {
|
318 |
+
return false;
|
|
|
|
|
|
|
|
|
319 |
}
|
320 |
+
}
|
321 |
+
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
},
|
323 |
|
324 |
/**
|
325 |
+
* Close Full Overlay
|
326 |
*/
|
327 |
+
_closeFullOverlay: function (event) {
|
328 |
+
event.preventDefault();
|
329 |
+
location.reload();
|
|
|
|
|
|
|
|
|
330 |
},
|
331 |
|
332 |
/**
|
346 |
var demoId = self.data( 'demo-id' ) || '',
|
347 |
apiURL = self.data( 'demo-api' ) || '',
|
348 |
demoType = self.data( 'demo-type' ) || '',
|
349 |
+
active_site = self.data( 'active-site' ) || '',
|
350 |
check_plugins_installed = self.data( 'check_plugins_installed' ) || '',
|
351 |
demoURL = self.data( 'demo-url' ) || '',
|
352 |
screenshot = self.data( 'screenshot' ) || '',
|
353 |
demo_name = self.data( 'demo-name' ) || '',
|
354 |
+
pages = self.data( 'pages' ) || '',
|
355 |
demo_slug = self.data( 'demo-slug' ) || '',
|
356 |
requiredPlugins = self.data( 'required-plugins' ) || '',
|
357 |
responsiveSiteOptions = self.find( '.responsive-site-options' ).val() || '';
|
363 |
demo_type: demoType,
|
364 |
check_plugins_installed: check_plugins_installed,
|
365 |
demo_url: demoURL,
|
366 |
+
active_site: active_site,
|
367 |
demo_api: apiURL,
|
368 |
screenshot: screenshot,
|
369 |
name: demo_name,
|
370 |
slug: demo_slug,
|
371 |
required_plugins: JSON.stringify( requiredPlugins ),
|
372 |
responsive_site_options: responsiveSiteOptions,
|
373 |
+
pages: JSON.stringify( pages ),
|
374 |
}];
|
375 |
$( '#responsive-ready-sites-import-options' ).append( template( templateData[0] ) );
|
376 |
$( '.theme-install-overlay' ).css( 'display', 'block' );
|
487 |
}
|
488 |
},
|
489 |
|
490 |
+
/**
|
491 |
+
* Fires when a nav item is clicked.
|
492 |
+
*/
|
493 |
+
_importDemo: function(event) {
|
494 |
event.preventDefault();
|
495 |
+
|
496 |
+
var date = new Date();
|
497 |
+
|
498 |
+
ResponsiveSitesAdmin.import_start_time = new Date();
|
499 |
+
|
500 |
+
$( '.sites-import-process-errors .current-importing-status-error-title' ).html( '' );
|
501 |
+
|
502 |
+
$( '.sites-import-process-errors' ).hide();
|
503 |
+
$( '.responsive-ready-site-import-free' ).addClass( 'updating-message installing' )
|
504 |
+
.text( "Importing.." );
|
505 |
+
$( '.responsive-ready-site-import-free' ).addClass( 'disabled not-click-able' );
|
506 |
+
|
507 |
+
var output = '<div class="current-importing-status-title"></div><div class="current-importing-status-description"></div>';
|
508 |
+
$( '.current-importing-status' ).html( output );
|
509 |
+
|
510 |
+
$( document ).trigger( 'responsive-get-active-theme' );
|
511 |
+
|
512 |
},
|
513 |
|
514 |
/**
|
515 |
+
* Check if Responsive theme is active
|
516 |
*/
|
517 |
+
_is_responsive_theme_active: function() {
|
|
|
518 |
$.ajax(
|
519 |
{
|
520 |
+
url: responsiveSitesAdmin.ajaxurl,
|
521 |
+
type: 'POST',
|
522 |
+
data: {
|
523 |
+
'action': 'responsive-is-theme-active',
|
524 |
+
'_ajax_nonce' : responsiveSitesAdmin._ajax_nonce,
|
|
|
|
|
525 |
},
|
526 |
}
|
527 |
)
|
|
|
|
|
|
|
|
|
|
|
528 |
.done(
|
529 |
+
function (result) {
|
530 |
+
if (result.success) {
|
531 |
+
$( document ).trigger( 'responsive-ready-sites-install-start' );
|
532 |
} else {
|
533 |
+
ResponsiveSitesAdmin._log_error( 'Responsive Ready Sites Importer plugin requires the Responsive theme. Please ensures that the Responsive theme is active.', true );
|
534 |
}
|
535 |
}
|
536 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
537 |
},
|
538 |
|
539 |
/**
|
540 |
+
* Log error
|
541 |
*/
|
542 |
+
_log_error: function( data, append ) {
|
543 |
|
544 |
+
$( '.sites-import-process-errors' ).css( 'display', 'block' );
|
545 |
+
var markup = '<p>' + data + '</p>';
|
546 |
+
if (typeof data == 'object' ) {
|
547 |
+
var markup = '<p>' + JSON.stringify( data ) + '</p>';
|
548 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
549 |
|
550 |
+
if ( append ) {
|
551 |
+
$( '.current-importing-status-error-title' ).append( markup );
|
552 |
+
} else {
|
553 |
+
$( '.current-importing-status-error-title' ).html( markup );
|
554 |
+
}
|
555 |
|
556 |
+
$( '.responsive-ready-site-import-free' ).removeClass( 'updating-message installing' )
|
557 |
+
.text( "Import Site" );
|
558 |
+
$( '.responsive-ready-site-import-free' ).removeClass( 'disabled not-click-able' );
|
559 |
+
$( '.responsive-ready-sites-tooltip-icon' ).removeClass( 'processed-import' );
|
560 |
+
$( '.responsive-ready-sites-tooltip-icon' ).removeClass( 'processing-import' );
|
561 |
+
$( '.responsive-ready-sites-import-process-wrap' ).hide();
|
562 |
},
|
563 |
|
564 |
/**
|
565 |
+
* Check if Responsive pro is installed
|
566 |
*/
|
567 |
+
_checkResponsiveAddonsProInstalled: function() {
|
568 |
+
var is_pro_installed;
|
569 |
$.ajax(
|
570 |
{
|
571 |
+
url: responsiveSitesAdmin.ajaxurl,
|
572 |
+
async: false,
|
573 |
type : 'POST',
|
574 |
dataType: 'json',
|
575 |
+
data: {
|
576 |
+
'action': 'check-responsive-add-ons-pro-installed',
|
577 |
+
'_ajax_nonce' : responsiveSitesAdmin._ajax_nonce,
|
578 |
+
}
|
|
|
579 |
}
|
580 |
)
|
|
|
|
|
|
|
|
|
|
|
581 |
.done(
|
582 |
+
function ( response ) {
|
583 |
+
is_pro_installed = response;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
584 |
}
|
585 |
);
|
586 |
+
|
587 |
+
if (is_pro_installed.success) {
|
588 |
+
return true;
|
589 |
+
} else {
|
590 |
+
return false;
|
591 |
+
}
|
592 |
},
|
593 |
|
594 |
/**
|
595 |
+
* Individual Site Preview
|
596 |
+
*
|
597 |
+
* On click on image, more link & preview button.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
598 |
*/
|
599 |
_preview: function( event ) {
|
600 |
|
621 |
*/
|
622 |
_renderDemoPreview: function(anchor) {
|
623 |
|
624 |
+
var demoId = anchor.data( 'demo-id' ) || '',
|
625 |
+
demoURL = anchor.data( 'demo-url' ) || '',
|
626 |
+
screenshot = anchor.data( 'screenshot' ) || '',
|
627 |
+
demo_name = anchor.data( 'demo-name' ) || '',
|
628 |
+
active_site = anchor.data( 'active-site' ) || '',
|
629 |
+
demo_slug = anchor.data( 'demo-slug' ) || '',
|
630 |
+
wpforms_path = anchor.data( 'wpforms-path' ) || '',
|
631 |
+
requiredPlugins = anchor.data( 'required-plugins' ) || '',
|
632 |
+
allow_pages = anchor.data( 'allow-pages' ) || false,
|
633 |
+
pages = anchor.data( 'pages' ) || '',
|
634 |
+
check_plugins_installed = anchor.data( 'check_plugins_installed' ) || '',
|
635 |
+
responsiveSiteOptions = anchor.find( '.responsive-site-options' ).val() || '',
|
636 |
+
demo_type = anchor.data( 'demo-type' ) || '',
|
637 |
+
isResponsiveAddonsProInstalled = ResponsiveSitesAdmin._checkResponsiveAddonsProInstalled();
|
638 |
|
639 |
var template = wp.template( 'responsive-ready-site-preview' );
|
640 |
|
641 |
templateData = [{
|
642 |
id: demoId,
|
643 |
demo_url: demoURL + '/?utm_source=free-to-pro&utm_medium=responsive-ready-site-importer&utm_campaign=responsive-pro&utm_content=preview',
|
644 |
+
demo_api: demoURL,
|
645 |
screenshot: screenshot,
|
646 |
name: demo_name,
|
647 |
+
active_site: active_site,
|
648 |
+
wpforms_path: wpforms_path,
|
649 |
slug: demo_slug,
|
650 |
required_plugins: JSON.stringify( requiredPlugins ),
|
651 |
responsive_site_options: responsiveSiteOptions,
|
652 |
demo_type: demo_type,
|
653 |
check_plugins_installed: check_plugins_installed,
|
654 |
is_responsive_addons_pro_installed: isResponsiveAddonsProInstalled,
|
655 |
+
allow_pages: allow_pages,
|
656 |
+
pages: JSON.stringify( pages ),
|
657 |
}];
|
658 |
+
|
659 |
$( '#responsive-ready-site-preview' ).append( template( templateData[0] ) );
|
660 |
$( '.theme-install-overlay' ).css( 'display', 'block' );
|
661 |
|
662 |
},
|
663 |
|
664 |
/**
|
665 |
+
* Import Process Starts
|
666 |
*/
|
667 |
+
_process_import: function() {
|
668 |
+
|
669 |
+
var site_id = $( '.responsive-ready-sites-advanced-options-wrap' ).find( '.demo_site_id' ).val();
|
670 |
+
|
671 |
+
var apiURL = responsiveSitesAdmin.ApiURL + 'cyberchimps-sites/' + site_id;
|
672 |
+
|
673 |
$.ajax(
|
674 |
{
|
675 |
+
url : responsiveSitesAdmin.ajaxurl,
|
|
|
676 |
type : 'POST',
|
677 |
+
data : {
|
678 |
+
action : 'responsive-ready-sites-set-reset-data',
|
679 |
+
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
680 |
+
},
|
|
|
681 |
}
|
682 |
)
|
683 |
.done(
|
684 |
function ( response ) {
|
685 |
+
if ( response.success ) {
|
686 |
+
ResponsiveSitesAdmin.site_imported_data = response.data;
|
687 |
+
}
|
688 |
}
|
689 |
);
|
690 |
|
691 |
+
if ( apiURL ) {
|
692 |
+
ResponsiveSitesAdmin._importSite( apiURL );
|
|
|
|
|
693 |
}
|
694 |
+
|
695 |
},
|
696 |
|
697 |
+
/**
|
698 |
+
* Start Import Process by API URL.
|
699 |
+
*
|
700 |
+
* @param {string} apiURL Site API URL.
|
701 |
+
*/
|
702 |
+
_importSite: function( apiURL ) {
|
703 |
+
|
704 |
+
// Request Site Import.
|
705 |
$.ajax(
|
706 |
{
|
707 |
+
url : responsiveSitesAdmin.ajaxurl,
|
|
|
708 |
type : 'POST',
|
709 |
dataType: 'json',
|
710 |
+
data : {
|
711 |
+
'action' : 'responsive-ready-sites-import-set-site-data-free',
|
712 |
+
'api_url' : apiURL,
|
713 |
'_ajax_nonce' : responsiveSitesAdmin._ajax_nonce,
|
714 |
+
},
|
715 |
}
|
716 |
)
|
717 |
+
.fail(
|
718 |
+
function( jqXHR ){
|
719 |
+
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
720 |
+
}
|
721 |
+
)
|
722 |
.done(
|
723 |
+
function ( demo_data ) {
|
724 |
+
|
725 |
+
// Check is site imported recently and set flag.
|
726 |
+
|
727 |
+
// 1. Fail - Request Site Import.
|
728 |
+
if ( false === demo_data.success ) {
|
729 |
+
ResponsiveSitesAdmin._log_error( demo_data.data, true );
|
730 |
+
} else {
|
731 |
+
|
732 |
+
ResponsiveSitesAdmin.xml_path = encodeURI( demo_data.data['xml_path'] ) || '';
|
733 |
+
ResponsiveSitesAdmin.wpforms_path = encodeURI( demo_data.data['wpforms_path'] ) || '';
|
734 |
+
ResponsiveSitesAdmin.active_site_slug = demo_data.data['slug'] || '';
|
735 |
+
ResponsiveSitesAdmin.active_site_title = demo_data.data['title'];
|
736 |
+
ResponsiveSitesAdmin.active_site_featured_image_url = demo_data.data['featured_image_url'];
|
737 |
+
ResponsiveSitesAdmin.site_customizer_data = JSON.stringify( demo_data.data['site_customizer_data'] ) || '';
|
738 |
+
ResponsiveSitesAdmin.required_plugins = JSON.stringify( demo_data.data['required_plugins'] ) || '';
|
739 |
+
ResponsiveSitesAdmin.required_pro_plugins = JSON.stringify( demo_data.data['required_pro_plugins'] || '' );
|
740 |
+
ResponsiveSitesAdmin.widgets_data = JSON.stringify( demo_data.data['site_widgets_data'] ) || '';
|
741 |
+
ResponsiveSitesAdmin.site_options_data = JSON.stringify( demo_data.data['site_options_data'] ) || '';
|
742 |
+
ResponsiveSitesAdmin.pages = JSON.stringify( demo_data.data['pages'] ) || '';
|
743 |
+
|
744 |
+
$( document ).trigger( 'responsive-ready-sites-import-set-site-data-done' );
|
745 |
+
}
|
746 |
}
|
747 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
748 |
},
|
749 |
|
750 |
/**
|
751 |
+
* Install required plugins
|
752 |
*/
|
753 |
+
_installRequiredPlugins: function( event ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
754 |
|
755 |
+
var requiredPlugins = JSON.parse( ResponsiveSitesAdmin.required_plugins );
|
756 |
|
757 |
+
if ( $.isArray( requiredPlugins ) ) {
|
|
|
758 |
|
759 |
+
// Required Required.
|
760 |
+
$.ajax(
|
761 |
+
{
|
762 |
+
url : responsiveSitesAdmin.ajaxurl,
|
763 |
+
type : 'POST',
|
764 |
+
data : {
|
765 |
+
action : 'responsive-ready-sites-required-plugins',
|
766 |
+
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
767 |
+
required_plugins : requiredPlugins
|
768 |
+
},
|
769 |
+
}
|
770 |
+
)
|
771 |
+
.done(
|
772 |
+
function ( response ) {
|
773 |
+
var required_plugins = response.data['required_plugins'] || '';
|
774 |
|
775 |
+
responsiveSitesAdmin.required_plugins = required_plugins;
|
776 |
+
ResponsiveSitesAdmin._bulkPluginInstallActivate();
|
777 |
}
|
778 |
);
|
779 |
+
|
780 |
+
} else {
|
781 |
+
if ( ResponsiveSitesAdmin.processing_single_template ) {
|
782 |
+
$( document ).trigger( 'responsive-ready-page-install-and-activate-required-plugins-done' );
|
783 |
+
} else {
|
784 |
+
$( document ).trigger( 'responsive-ready-sites-install-and-activate-required-plugins-done' );
|
785 |
}
|
786 |
+
}
|
|
|
787 |
},
|
788 |
|
789 |
/**
|
798 |
);
|
799 |
},
|
800 |
|
801 |
+
/**
|
802 |
+
* Bulk Plugin Active & Install
|
803 |
+
*/
|
804 |
+
_bulkPluginInstallActivate: function()
|
805 |
+
{
|
806 |
+
if ( 0 === responsiveSitesAdmin.required_plugins.length ) {
|
807 |
+
return;
|
808 |
+
}
|
809 |
+
|
810 |
+
var not_installed = responsiveSitesAdmin.required_plugins.notinstalled || '';
|
811 |
+
var activate_plugins = responsiveSitesAdmin.required_plugins.inactive || '';
|
812 |
+
|
813 |
+
// Install wordpress.org plugins.
|
814 |
+
if ( not_installed.length > 0 ) {
|
815 |
+
ResponsiveSitesAdmin._installAllPlugins( not_installed );
|
816 |
+
}
|
817 |
+
|
818 |
+
// Activate wordpress.org plugins.
|
819 |
+
if ( activate_plugins.length > 0 ) {
|
820 |
+
ResponsiveSitesAdmin._activateAllPlugins( activate_plugins );
|
821 |
+
}
|
822 |
+
|
823 |
+
if ( activate_plugins.length <= 0 && not_installed.length <= 0 ) {
|
824 |
+
if ( ResponsiveSitesAdmin.processing_single_template ) {
|
825 |
+
ResponsiveSitesAdmin._ready_for_import_template();
|
826 |
+
} else {
|
827 |
+
ResponsiveSitesAdmin._ready_for_import_site();
|
828 |
+
}
|
829 |
+
}
|
830 |
+
|
831 |
+
},
|
832 |
+
|
833 |
/**
|
834 |
* Install All Plugins.
|
835 |
*/
|
857 |
},
|
858 |
|
859 |
/**
|
860 |
+
* Installing Plugin
|
861 |
*/
|
862 |
+
_pluginInstalling: function(event, args) {
|
863 |
+
event.preventDefault();
|
864 |
+
$( '.responsive-ready-sites-import-plugins .responsive-ready-sites-tooltip-icon' ).addClass( 'processing-import' );
|
865 |
|
866 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
867 |
|
868 |
+
/**
|
869 |
+
* Install plugin success
|
870 |
+
*/
|
871 |
+
_pluginInstallSuccess: function( event, response ) {
|
872 |
|
873 |
+
if ( typeof responsiveSitesAdmin.required_plugins.notinstalled !== 'undefined' && responsiveSitesAdmin.required_plugins.notinstalled ) {
|
874 |
+
event.preventDefault();
|
875 |
|
876 |
+
// Reset not installed plugins list.
|
877 |
+
var pluginsList = responsiveSitesAdmin.required_plugins.notinstalled;
|
878 |
+
responsiveSitesAdmin.required_plugins.notinstalled = ResponsiveSitesAdmin._removePluginFromQueue( response.slug, pluginsList );
|
879 |
|
880 |
+
// WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that.
|
881 |
+
setTimeout(
|
882 |
+
function () {
|
883 |
|
884 |
+
var $init = $( '.plugin-card-' + response.slug ).data( 'init' );
|
885 |
|
886 |
+
$.ajax(
|
887 |
+
{
|
888 |
+
url: responsiveSitesAdmin.ajaxurl,
|
889 |
+
type: 'POST',
|
890 |
+
data: {
|
891 |
+
'action': 'responsive-ready-sites-required-plugin-activate',
|
892 |
+
'init': $init,
|
893 |
+
'_ajax_nonce' : responsiveSitesAdmin._ajax_nonce,
|
894 |
+
},
|
895 |
+
}
|
896 |
+
)
|
897 |
+
.done(
|
898 |
+
function (result) {
|
899 |
|
900 |
+
if (result.success) {
|
901 |
+
var pluginsList = responsiveSitesAdmin.required_plugins.inactive;
|
902 |
|
903 |
+
// Reset not installed plugins list.
|
904 |
+
responsiveSitesAdmin.required_plugins.inactive = ResponsiveSitesAdmin._removePluginFromQueue( response.slug, pluginsList );
|
905 |
|
906 |
+
$( '.responsive-ready-sites-import-plugins .responsive-ready-sites-tooltip-icon' ).addClass( 'processed-import' );
|
|
|
907 |
|
908 |
+
if ( ResponsiveSitesAdmin.processing_single_template ) {
|
909 |
+
ResponsiveSitesAdmin._ready_for_import_template();
|
910 |
+
} else {
|
911 |
+
ResponsiveSitesAdmin._ready_for_import_site();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
912 |
}
|
913 |
}
|
914 |
+
}
|
915 |
+
);
|
|
|
|
|
916 |
|
917 |
+
},
|
918 |
+
1200
|
919 |
+
);
|
920 |
+
}
|
921 |
},
|
922 |
|
923 |
/**
|
924 |
+
* Activate All Plugins.
|
|
|
|
|
|
|
|
|
925 |
*/
|
926 |
+
_activateAllPlugins: function( activate_plugins ) {
|
|
|
927 |
|
928 |
+
$.each(
|
929 |
+
activate_plugins,
|
930 |
+
function(index, single_plugin) {
|
931 |
|
932 |
+
ResponsiveSitesAjaxQueue.add(
|
933 |
+
{
|
934 |
+
url: responsiveSitesAdmin.ajaxurl,
|
935 |
+
type: 'POST',
|
936 |
+
data: {
|
937 |
+
'action' : 'responsive-ready-sites-required-plugin-activate',
|
938 |
+
'init' : single_plugin.init,
|
939 |
+
'_ajax_nonce' : responsiveSitesAdmin._ajax_nonce,
|
940 |
+
},
|
941 |
+
success: function( result ){
|
942 |
|
943 |
+
if ( result.success ) {
|
944 |
|
945 |
+
var pluginsList = responsiveSitesAdmin.required_plugins.inactive;
|
|
|
|
|
|
|
946 |
|
947 |
+
// Reset not installed plugins list.
|
948 |
+
responsiveSitesAdmin.required_plugins.inactive = ResponsiveSitesAdmin._removePluginFromQueue( single_plugin.slug, pluginsList );
|
949 |
|
950 |
+
if ( ResponsiveSitesAdmin.processing_single_template ) {
|
951 |
+
ResponsiveSitesAdmin._ready_for_import_template();
|
952 |
+
} else {
|
953 |
+
ResponsiveSitesAdmin._ready_for_import_site();
|
954 |
+
}
|
955 |
|
956 |
+
}
|
957 |
+
}
|
958 |
+
}
|
959 |
+
);
|
960 |
+
}
|
961 |
+
);
|
962 |
+
ResponsiveSitesAjaxQueue.run();
|
963 |
},
|
964 |
|
965 |
+
/**
|
966 |
+
* Ready for site import
|
967 |
+
*/
|
968 |
+
_ready_for_import_site: function () {
|
969 |
+
var notinstalled = responsiveSitesAdmin.required_plugins.notinstalled || 0;
|
970 |
+
var inactive = responsiveSitesAdmin.required_plugins.inactive || 0;
|
971 |
|
972 |
+
if ( ResponsiveSitesAdmin._areEqual( notinstalled.length, inactive.length ) ) {
|
973 |
+
$( document ).trigger( 'responsive-ready-sites-install-and-activate-required-plugins-done' );
|
|
|
|
|
974 |
}
|
975 |
+
},
|
976 |
|
977 |
+
/**
|
978 |
+
* Ready for template import
|
979 |
+
*
|
980 |
+
* @private
|
981 |
+
*/
|
982 |
+
_ready_for_import_template: function () {
|
983 |
+
var notinstalled = responsiveSitesAdmin.required_plugins.notinstalled || 0;
|
984 |
+
var inactive = responsiveSitesAdmin.required_plugins.inactive || 0;
|
985 |
|
986 |
+
if ( ResponsiveSitesAdmin._areEqual( notinstalled.length, inactive.length ) ) {
|
987 |
+
$( document ).trigger( 'responsive-ready-page-install-and-activate-required-plugins-done' );
|
988 |
+
}
|
|
|
|
|
|
|
989 |
},
|
990 |
|
991 |
/**
|
992 |
+
* Trigger reset data event
|
|
|
|
|
|
|
993 |
*/
|
994 |
+
_resetData: function( event ) {
|
995 |
+
event.preventDefault();
|
996 |
|
997 |
+
$( '.responsive-ready-sites-reset-data .responsive-ready-sites-tooltip-icon' ).addClass( 'processing-import' );
|
998 |
+
$( document ).trigger( 'responsive-ready-sites-reset-data' );
|
999 |
+
},
|
1000 |
|
1001 |
+
/**
|
1002 |
+
* Backup before reset settings
|
1003 |
+
*/
|
1004 |
+
_backup_before_reset_options: function() {
|
1005 |
+
ResponsiveSitesAdmin._backupOptions( 'responsive-ready-sites-backup-settings-before-reset-done' );
|
1006 |
+
ResponsiveSitesAdmin.backup_taken = true;
|
1007 |
+
},
|
1008 |
|
1009 |
+
/**
|
1010 |
+
* Backup settings
|
1011 |
+
*/
|
1012 |
+
_backupOptions: function( trigger_name ) {
|
1013 |
$.ajax(
|
1014 |
{
|
1015 |
url : responsiveSitesAdmin.ajaxurl,
|
1016 |
type : 'POST',
|
1017 |
data : {
|
1018 |
+
action : 'responsive-ready-sites-backup-settings',
|
1019 |
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1020 |
+
|
1021 |
},
|
1022 |
}
|
1023 |
)
|
1024 |
+
.fail(
|
1025 |
+
function( jqXHR ){
|
1026 |
+
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
1027 |
+
}
|
1028 |
+
)
|
1029 |
.done(
|
1030 |
+
function ( data ) {
|
1031 |
+
|
1032 |
+
// Custom trigger.
|
1033 |
+
$( document ).trigger( trigger_name );
|
1034 |
}
|
1035 |
);
|
|
|
|
|
|
|
|
|
|
|
1036 |
},
|
1037 |
|
1038 |
/**
|
1039 |
+
* Reset customizer data
|
|
|
|
|
1040 |
*/
|
1041 |
+
_reset_customizer_data: function() {
|
|
|
|
|
1042 |
$.ajax(
|
1043 |
{
|
1044 |
url : responsiveSitesAdmin.ajaxurl,
|
1045 |
type : 'POST',
|
|
|
1046 |
data : {
|
1047 |
+
action : 'responsive-ready-sites-reset-customizer-data',
|
1048 |
+
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
|
|
1049 |
},
|
1050 |
}
|
1051 |
)
|
1055 |
}
|
1056 |
)
|
1057 |
.done(
|
1058 |
+
function ( data ) {
|
1059 |
+
$( document ).trigger( 'responsive-ready-sites-reset-customizer-data-done' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1060 |
}
|
1061 |
);
|
1062 |
},
|
1063 |
|
1064 |
+
/**
|
1065 |
+
* Reset site options
|
1066 |
+
*/
|
1067 |
+
_reset_site_options: function() {
|
1068 |
+
// Site Options.
|
1069 |
+
$.ajax(
|
1070 |
+
{
|
1071 |
+
url : responsiveSitesAdmin.ajaxurl,
|
1072 |
+
type : 'POST',
|
1073 |
+
data : {
|
1074 |
+
action : 'responsive-ready-sites-reset-site-options',
|
1075 |
+
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1076 |
+
},
|
1077 |
+
}
|
1078 |
+
)
|
1079 |
+
.fail(
|
1080 |
+
function( jqXHR ){
|
1081 |
+
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
1082 |
}
|
1083 |
)
|
1084 |
+
.done(
|
1085 |
+
function ( data ) {
|
1086 |
+
$( document ).trigger( 'responsive-ready-sites-reset-site-options-done' );
|
1087 |
+
}
|
1088 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1089 |
},
|
1090 |
|
1091 |
+
/**
|
1092 |
+
* Reset widgets data
|
1093 |
+
*/
|
1094 |
+
_reset_widgets_data: function() {
|
1095 |
+
// Widgets.
|
1096 |
+
$.ajax(
|
1097 |
+
{
|
1098 |
+
url : responsiveSitesAdmin.ajaxurl,
|
1099 |
+
type : 'POST',
|
1100 |
+
data : {
|
1101 |
+
action : 'responsive-ready-sites-reset-widgets-data',
|
1102 |
+
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1103 |
+
},
|
1104 |
+
}
|
1105 |
+
)
|
1106 |
+
.fail(
|
1107 |
+
function( jqXHR ){
|
1108 |
+
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
1109 |
+
}
|
1110 |
+
)
|
1111 |
+
.done(
|
1112 |
+
function ( data ) {
|
1113 |
+
$( document ).trigger( 'responsive-ready-sites-reset-widgets-data-done' );
|
1114 |
+
}
|
1115 |
+
);
|
1116 |
},
|
1117 |
|
1118 |
+
/**
|
1119 |
+
* Reset terms
|
1120 |
+
*/
|
1121 |
+
_reset_terms: function() {
|
1122 |
|
1123 |
+
if ( ResponsiveSitesAdmin.site_imported_data['reset_terms'].length ) {
|
1124 |
+
ResponsiveSitesAdmin.reset_remaining_terms = ResponsiveSitesAdmin.site_imported_data['reset_terms'].length;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1125 |
|
1126 |
$.each(
|
1127 |
+
ResponsiveSitesAdmin.site_imported_data['reset_terms'],
|
1128 |
+
function(index, term_id) {
|
|
|
1129 |
ResponsiveSitesAjaxQueue.add(
|
1130 |
{
|
1131 |
url: responsiveSitesAdmin.ajaxurl,
|
1132 |
type: 'POST',
|
1133 |
data: {
|
1134 |
+
action : 'responsive-ready-sites-delete-terms',
|
1135 |
+
term_id : term_id,
|
1136 |
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1137 |
},
|
1138 |
success: function( result ){
|
1139 |
+
if ( ResponsiveSitesAdmin.reset_processed_terms < ResponsiveSitesAdmin.site_imported_data['reset_terms'].length ) {
|
1140 |
+
ResponsiveSitesAdmin.reset_processed_terms += 1;
|
|
|
1141 |
}
|
1142 |
|
1143 |
+
ResponsiveSitesAdmin.reset_remaining_terms -= 1;
|
1144 |
+
if ( 0 == ResponsiveSitesAdmin.reset_remaining_terms ) {
|
1145 |
+
$( document ).trigger( 'responsive-ready-sites-delete-terms-done' );
|
|
|
|
|
|
|
1146 |
}
|
1147 |
}
|
1148 |
}
|
1152 |
ResponsiveSitesAjaxQueue.run();
|
1153 |
|
1154 |
} else {
|
1155 |
+
$( document ).trigger( 'responsive-ready-sites-delete-terms-done' );
|
|
|
|
|
1156 |
}
|
1157 |
},
|
1158 |
|
1159 |
+
/**
|
1160 |
+
* Reset wp forms
|
1161 |
+
*/
|
1162 |
_reset_wp_forms: function() {
|
1163 |
|
1164 |
if ( ResponsiveSitesAdmin.site_imported_data['reset_wp_forms'].length ) {
|
1199 |
|
1200 |
},
|
1201 |
|
1202 |
+
/**
|
1203 |
+
* Reset Posts
|
1204 |
+
*/
|
1205 |
+
_reset_posts: function() {
|
1206 |
|
1207 |
+
if ( ResponsiveSitesAdmin.site_imported_data['reset_posts'].length ) {
|
1208 |
+
|
1209 |
+
ResponsiveSitesAdmin.reset_remaining_posts = ResponsiveSitesAdmin.site_imported_data['reset_posts'].length;
|
1210 |
|
1211 |
$.each(
|
1212 |
+
ResponsiveSitesAdmin.site_imported_data['reset_posts'],
|
1213 |
+
function(index, post_id) {
|
1214 |
+
|
1215 |
ResponsiveSitesAjaxQueue.add(
|
1216 |
{
|
1217 |
url: responsiveSitesAdmin.ajaxurl,
|
1218 |
type: 'POST',
|
1219 |
data: {
|
1220 |
+
action : 'responsive-ready-sites-delete-posts',
|
1221 |
+
post_id : post_id,
|
1222 |
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1223 |
},
|
1224 |
success: function( result ){
|
1225 |
+
|
1226 |
+
if ( ResponsiveSitesAdmin.reset_processed_posts < ResponsiveSitesAdmin.site_imported_data['reset_posts'].length ) {
|
1227 |
+
ResponsiveSitesAdmin.reset_processed_posts += 1;
|
1228 |
}
|
1229 |
|
1230 |
+
ResponsiveSitesAdmin.reset_remaining_posts -= 1;
|
1231 |
+
if ( 0 == ResponsiveSitesAdmin.reset_remaining_posts ) {
|
1232 |
+
$( '.responsive-ready-sites-reset-data .responsive-ready-sites-tooltip-icon' ).removeClass( 'processing-import' );
|
1233 |
+
$( '.responsive-ready-sites-reset-data .responsive-ready-sites-tooltip-icon' ).addClass( 'processed-import' );
|
1234 |
+
$( document ).trigger( 'responsive-ready-sites-reset-data-done' );
|
1235 |
}
|
1236 |
}
|
1237 |
}
|
1241 |
ResponsiveSitesAjaxQueue.run();
|
1242 |
|
1243 |
} else {
|
1244 |
+
$( '.responsive-ready-sites-reset-data .responsive-ready-sites-tooltip-icon' ).addClass( 'processed-import' );
|
1245 |
+
$( document ).trigger( 'responsive-ready-sites-reset-data-done' );
|
1246 |
}
|
1247 |
},
|
1248 |
|
1249 |
+
/**
|
1250 |
+
* Import WpForms
|
1251 |
+
*/
|
1252 |
+
_importWPForms: function() {
|
1253 |
|
|
|
1254 |
$.ajax(
|
1255 |
{
|
1256 |
url : responsiveSitesAdmin.ajaxurl,
|
1257 |
type : 'POST',
|
1258 |
+
dataType: 'json',
|
1259 |
data : {
|
1260 |
+
action : 'responsive-ready-sites-import-wpforms',
|
1261 |
+
wpforms_path : ResponsiveSitesAdmin.wpforms_path,
|
1262 |
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
|
|
1263 |
},
|
1264 |
}
|
1265 |
)
|
1266 |
.fail(
|
1267 |
function( jqXHR ){
|
1268 |
+
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
1269 |
}
|
1270 |
)
|
1271 |
.done(
|
1272 |
+
function ( forms){
|
1273 |
+
if (false === forms.success) {
|
1274 |
+
// log.
|
1275 |
+
} else {
|
1276 |
+
$( document ).trigger( 'responsive-ready-sites-import-wpforms-done' );
|
1277 |
+
}
|
1278 |
+
}
|
1279 |
+
)
|
1280 |
+
},
|
1281 |
+
|
1282 |
+
/**
|
1283 |
+
* Import XML Data.
|
1284 |
+
*/
|
1285 |
+
_importXML: function() {
|
1286 |
+
|
1287 |
+
$.ajax(
|
1288 |
+
{
|
1289 |
+
url: responsiveSitesAdmin.ajaxurl,
|
1290 |
+
type: 'POST',
|
1291 |
+
dataType: 'json',
|
1292 |
+
data: {
|
1293 |
+
action: 'responsive-ready-sites-import-xml',
|
1294 |
+
xml_path: ResponsiveSitesAdmin.xml_path,
|
1295 |
+
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1296 |
+
},
|
1297 |
+
beforeSend: function () {
|
1298 |
+
$( '.responsive-ready-sites-import-process-wrap' ).show();
|
1299 |
+
},
|
1300 |
+
}
|
1301 |
+
)
|
1302 |
+
.fail(
|
1303 |
+
function( jqXHR ){
|
1304 |
+
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
1305 |
+
}
|
1306 |
+
)
|
1307 |
+
.done(
|
1308 |
+
function (xml_data) {
|
1309 |
+
|
1310 |
+
// 2. Fail - Import XML Data.
|
1311 |
+
if (false === xml_data.success) {
|
1312 |
+
// log.
|
1313 |
+
} else {
|
1314 |
+
|
1315 |
+
// 2. Pass - Import XML Data.
|
1316 |
+
|
1317 |
+
// Import XML though Event Source.
|
1318 |
+
wxrImport.data = xml_data.data;
|
1319 |
+
wxrImport.render();
|
1320 |
+
|
1321 |
+
$( '.current-importing-status-description' ).html( '' ).show();
|
1322 |
+
|
1323 |
+
$( '.responsive-ready-sites-import-xml .inner' ).append( '<div class="responsive-ready-sites-import-process-wrap"><progress class="responsive-ready-sites-import-process" max="100" value="0"></progress></div>' );
|
1324 |
+
|
1325 |
+
var evtSource = new EventSource( wxrImport.data.url );
|
1326 |
+
evtSource.onmessage = function (message) {
|
1327 |
+
var data = JSON.parse( message.data );
|
1328 |
+
switch (data.action) {
|
1329 |
+
case 'updateDelta':
|
1330 |
+
|
1331 |
+
wxrImport.updateDelta( data.type, data.delta );
|
1332 |
+
break;
|
1333 |
+
|
1334 |
+
case 'complete':
|
1335 |
+
evtSource.close();
|
1336 |
+
|
1337 |
+
document.getElementsByClassName( "cybershimps-sites-import-process" ).value = '100';
|
1338 |
+
$( '.cybershimps-sites-import-process-wrap' ).hide();
|
1339 |
+
|
1340 |
+
$( '.responsive-ready-sites-import-xml .responsive-ready-sites-tooltip-icon' ).addClass( 'processed-import' );
|
1341 |
+
$( document ).trigger( 'responsive-ready-sites-import-xml-done' );
|
1342 |
+
|
1343 |
+
break;
|
1344 |
+
}
|
1345 |
+
};
|
1346 |
+
evtSource.addEventListener(
|
1347 |
+
'log',
|
1348 |
+
function (message) {
|
1349 |
+
var data = JSON.parse( message.data );
|
1350 |
+
var message = data.message || '';
|
1351 |
+
if (message && 'info' === data.level) {
|
1352 |
+
message = message.replace(
|
1353 |
+
/"/g,
|
1354 |
+
function (letter) {
|
1355 |
+
return '';
|
1356 |
+
}
|
1357 |
+
);
|
1358 |
+
// log message on screen.
|
1359 |
+
}
|
1360 |
+
}
|
1361 |
+
);
|
1362 |
+
}
|
1363 |
+
}
|
1364 |
);
|
1365 |
|
1366 |
+
},
|
1367 |
+
|
1368 |
+
/**
|
1369 |
+
* Import Customizer Setting
|
1370 |
+
*/
|
1371 |
+
_importCustomizerSettings: function() {
|
1372 |
+
$.ajax(
|
1373 |
+
{
|
1374 |
+
url: responsiveSitesAdmin.ajaxurl,
|
1375 |
+
type: 'POST',
|
1376 |
+
dataType: 'json',
|
1377 |
+
data: {
|
1378 |
+
action: 'responsive-ready-sites-import-customizer-settings',
|
1379 |
+
site_customizer_data: ResponsiveSitesAdmin.site_customizer_data,
|
1380 |
+
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1381 |
+
},
|
1382 |
+
beforeSend: function () {
|
1383 |
+
$( '.responsive-ready-sites-import-customizer .responsive-ready-sites-tooltip-icon' ).addClass( 'processing-import' );
|
1384 |
+
},
|
1385 |
+
}
|
1386 |
+
)
|
1387 |
+
.fail(
|
1388 |
+
function( jqXHR ){
|
1389 |
+
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
1390 |
+
}
|
1391 |
+
)
|
1392 |
+
.done(
|
1393 |
+
function (forms) {
|
1394 |
+
if (false === forms.success) {
|
1395 |
+
// log.
|
1396 |
+
} else {
|
1397 |
+
$( '.responsive-ready-sites-import-customizer .responsive-ready-sites-tooltip-icon' ).removeClass( 'processing-import' );
|
1398 |
+
$( '.responsive-ready-sites-import-customizer .responsive-ready-sites-tooltip-icon' ).addClass( 'processed-import' );
|
1399 |
+
$( document ).trigger( 'responsive-ready-sites-import-customizer-settings-done' );
|
1400 |
+
}
|
1401 |
+
}
|
1402 |
+
)
|
1403 |
+
},
|
1404 |
+
|
1405 |
+
/**
|
1406 |
+
* Import Widgets.
|
1407 |
+
*/
|
1408 |
+
_importWidgets: function( event ) {
|
1409 |
$.ajax(
|
1410 |
{
|
1411 |
url : responsiveSitesAdmin.ajaxurl,
|
1412 |
type : 'POST',
|
1413 |
+
dataType: 'json',
|
1414 |
data : {
|
1415 |
+
action : 'responsive-ready-sites-import-widgets',
|
1416 |
+
widgets_data : ResponsiveSitesAdmin.widgets_data,
|
1417 |
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1418 |
},
|
1419 |
}
|
1420 |
)
|
1421 |
.fail(
|
1422 |
function( jqXHR ){
|
1423 |
+
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
1424 |
}
|
1425 |
)
|
1426 |
.done(
|
1427 |
+
function ( widgets_data ) {
|
1428 |
+
|
1429 |
+
if ( false === widgets_data.success ) {
|
1430 |
+
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
1431 |
+
|
1432 |
+
} else {
|
1433 |
+
|
1434 |
+
$( document ).trigger( 'responsive-ready-sites-import-widgets-done' );
|
1435 |
+
}
|
1436 |
}
|
1437 |
);
|
1438 |
+
},
|
1439 |
+
|
1440 |
+
/**
|
1441 |
+
* Import Site Options.
|
1442 |
+
*/
|
1443 |
+
_importSiteOptions: function( event ) {
|
1444 |
|
|
|
1445 |
$.ajax(
|
1446 |
{
|
1447 |
url : responsiveSitesAdmin.ajaxurl,
|
1448 |
type : 'POST',
|
1449 |
+
dataType: 'json',
|
1450 |
data : {
|
1451 |
+
action : 'responsive-ready-sites-import-options',
|
1452 |
+
options_data : ResponsiveSitesAdmin.site_options_data,
|
1453 |
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1454 |
},
|
1455 |
}
|
1456 |
)
|
1457 |
.fail(
|
1458 |
function( jqXHR ){
|
1459 |
+
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
1460 |
}
|
1461 |
)
|
1462 |
.done(
|
1463 |
+
function ( options_data ) {
|
1464 |
+
|
1465 |
+
// Fail - Import Site Options.
|
1466 |
+
if ( false === options_data.success ) {
|
1467 |
+
ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
|
1468 |
+
} else {
|
1469 |
+
|
1470 |
+
// 3. Pass - Import Site Options.
|
1471 |
+
$( document ).trigger( 'responsive-ready-sites-import-options-done' );
|
1472 |
+
}
|
1473 |
}
|
1474 |
);
|
1475 |
+
},
|
1476 |
|
1477 |
+
/**
|
1478 |
+
* Import Site Complete.
|
1479 |
+
*/
|
1480 |
+
_importSiteEnd: function( event ) {
|
1481 |
|
1482 |
+
$.ajax(
|
1483 |
+
{
|
1484 |
+
url : responsiveSitesAdmin.ajaxurl,
|
1485 |
+
type : 'POST',
|
1486 |
+
dataType: 'json',
|
1487 |
+
data : {
|
1488 |
+
action : 'responsive-ready-sites-import-end',
|
1489 |
+
slug: ResponsiveSitesAdmin.active_site_slug,
|
1490 |
+
title: ResponsiveSitesAdmin.active_site_title,
|
1491 |
+
featured_image_url: ResponsiveSitesAdmin.active_site_featured_image_url,
|
1492 |
+
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1493 |
+
}
|
1494 |
+
}
|
1495 |
+
)
|
1496 |
+
.done(
|
1497 |
+
function ( data ) {
|
1498 |
|
1499 |
+
// Fail - Import In-Complete.
|
1500 |
+
if ( false === data.success ) {
|
1501 |
+
// log.
|
1502 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
1503 |
|
1504 |
+
var output = '<h2>Responsive Ready Site import complete.</h2>';
|
1505 |
+
output += '<p><a class="button button-primary button-hero" href="' + responsiveSitesAdmin.siteURL + '" target="_blank">Launch Site</a></p>';
|
|
|
1506 |
|
1507 |
+
$( '.site-import-options' ).hide();
|
1508 |
+
$( '.result_preview' ).html( '' ).show();
|
1509 |
+
$( '.result_preview' ).html( output );
|
1510 |
+
}
|
1511 |
}
|
1512 |
);
|
1513 |
+
},
|
1514 |
|
1515 |
+
/**
|
1516 |
+
* Import Single Page Preview Screen
|
1517 |
+
*/
|
1518 |
+
_importPagePreviewScreen: function(event) {
|
1519 |
+
event.preventDefault();
|
1520 |
|
1521 |
+
var self = $( this ).parents( '.responsive-ready-site-preview' );
|
|
|
|
|
1522 |
|
1523 |
+
$( '#responsive-ready-site-preview' ).hide();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1524 |
|
1525 |
+
$( '#responsive-ready-sites-import-options' ).show();
|
|
|
|
|
1526 |
|
1527 |
+
var apiURL = self.data( 'demo-api' ) || '',
|
1528 |
+
demoType = self.data( 'demo-type' ) || '',
|
1529 |
+
demo_name = self.data( 'demo-name' ) || '',
|
1530 |
+
wpforms_path = self.data( 'wpforms-path' ) || '',
|
1531 |
+
screenshot = self.data( 'screenshot' ) || '',
|
1532 |
+
requiredPlugins = self.data( 'required-plugins' ) || '',
|
1533 |
+
pages = self.data( 'pages' ) || '',
|
1534 |
+
responsiveSiteOptions = self.find( '.responsive-site-options' ).val() || '';
|
1535 |
|
1536 |
+
var template = wp.template( 'responsive-ready-sites-import-page-preview-page' );
|
1537 |
|
1538 |
+
templateData = [{
|
1539 |
+
demo_type: demoType,
|
1540 |
+
demo_api: apiURL,
|
1541 |
+
name: demo_name,
|
1542 |
+
wpforms_path: wpforms_path,
|
1543 |
+
required_plugins: JSON.stringify( requiredPlugins ),
|
1544 |
+
responsive_site_options: responsiveSiteOptions,
|
1545 |
+
pages: pages,
|
1546 |
+
screenshot: screenshot
|
1547 |
+
}];
|
1548 |
+
$( '#responsive-ready-sites-import-options' ).append( template( templateData[0] ) )
|
1549 |
+
$( '.theme-install-overlay' ).css( 'display', 'block' );
|
1550 |
+
},
|
1551 |
|
1552 |
+
/**
|
1553 |
+
* Preview Templates for the Site
|
1554 |
+
*/
|
1555 |
+
_change_site_preview_screenshot: function( event ) {
|
1556 |
+
event.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1557 |
|
1558 |
+
var item = $( this );
|
1559 |
+
|
1560 |
+
ResponsiveSitesAdmin._set_preview_screenshot_by_page( item );
|
1561 |
+
},
|
1562 |
+
|
1563 |
+
/**
|
1564 |
+
* Set Preview Image for the Page
|
1565 |
+
*/
|
1566 |
+
_set_preview_screenshot_by_page: function( element ) {
|
1567 |
+
var large_img_url = $( element ).find( '.theme-screenshot' ).attr( 'data-featured-src' ) || '';
|
1568 |
+
var url = $( element ).find( '.theme-screenshot' ).attr( 'data-src' ) || '';
|
1569 |
+
var page_name = $( element ).find( '.theme-name' ).text() || '';
|
1570 |
+
var demo_type = $( element ).find( '.theme-screenshot' ).attr( 'data-demo-type' ) || '';
|
1571 |
+
|
1572 |
+
$( element ).siblings().removeClass( 'current_page' );
|
1573 |
+
$( element ).addClass( 'current_page' );
|
1574 |
+
|
1575 |
+
$( '.single-page-import-button-' + demo_type ).removeClass( 'disabled' );
|
1576 |
+
if ( page_name ) {
|
1577 |
+
var title = responsiveSitesAdmin.importSingleTemplateButtonTitle.replace( '%s', page_name.trim() );
|
1578 |
+
$( '.single-page-import-button-' + demo_type ).text( title );
|
1579 |
+
}
|
1580 |
+
|
1581 |
+
if ( url ) {
|
1582 |
+
$( '.single-site-preview' ).animate(
|
1583 |
+
{
|
1584 |
+
scrollTop: 0
|
1585 |
+
},
|
1586 |
+
0
|
1587 |
);
|
1588 |
+
$( '.single-site-preview img' ).addClass( 'loading' ).attr( 'src', url );
|
1589 |
+
var imgLarge = new Image();
|
1590 |
+
imgLarge.src = large_img_url;
|
1591 |
+
imgLarge.onload = function () {
|
1592 |
+
$( '.single-site-preview img' ).removeClass( 'loading' );
|
1593 |
+
$( '.single-site-preview img' ).attr( 'src', imgLarge.src );
|
1594 |
+
};
|
1595 |
+
}
|
1596 |
+
},
|
1597 |
+
|
1598 |
+
/**
|
1599 |
+
* Import Single Page options Screen
|
1600 |
+
*/
|
1601 |
+
_importSinglePageOptions: function(event) {
|
1602 |
+
event.preventDefault();
|
1603 |
+
|
1604 |
+
var self = $( this ).parents( '.responsive-ready-sites-advanced-options-wrap' );
|
1605 |
|
1606 |
+
var demo_api = self.data( 'demo-api' ) || '',
|
1607 |
+
wpforms_path = self.data( 'wpforms-path' ) || '',
|
1608 |
+
demo_type = self.data( 'demo-type' ) || '';
|
1609 |
+
|
1610 |
+
var page_id = ResponsiveSitesAdmin._get_id( $( '#single-pages' ).find( '.current_page' ).attr( 'data-page-id' ) ) || '';
|
1611 |
+
|
1612 |
+
var required_plugins = JSON.parse( $( '#single-pages' ).find( '.current_page' ).attr( 'data-required-plugins' ) ) || '';
|
1613 |
+
|
1614 |
+
var includes_wp_forms = JSON.parse( $( '#single-pages' ).find( '.current_page' ).attr( 'data-includes-wp-forms' ) ) || false;
|
1615 |
+
|
1616 |
+
$( '#site-pages' ).hide();
|
1617 |
+
|
1618 |
+
$( '#responsive-ready-sites-import-options' ).show();
|
1619 |
+
|
1620 |
+
var template = wp.template( 'responsive-ready-sites-import-single-page-options-page' );
|
1621 |
+
|
1622 |
+
templateData = [{
|
1623 |
+
page_id: page_id,
|
1624 |
+
demo_api: demo_api,
|
1625 |
+
required_plugins: required_plugins,
|
1626 |
+
wpforms_path: wpforms_path,
|
1627 |
+
includes_wp_forms: includes_wp_forms,
|
1628 |
+
demo_type: demo_type,
|
1629 |
+
}];
|
1630 |
+
$( '#responsive-ready-sites-import-options' ).append( template( templateData[0] ) );
|
1631 |
+
$( '.theme-install-overlay' ).css( 'display', 'block' );
|
1632 |
+
|
1633 |
+
$( '.required-plugins' ).removeClass( 'loading' ).html( '' );
|
1634 |
+
$( '.required-plugins-list' ).html( '' );
|
1635 |
+
$( required_plugins ).each(
|
1636 |
+
function( index, plugin ) {
|
1637 |
+
$( '.required-plugins-list' ).append( '<li class="plugin-card plugin-card-' + plugin.slug + '" data-slug="' + plugin.slug + '" data-init="' + plugin.init + '" data-name="' + plugin.name + '">' + plugin.name + '</li>' );
|
1638 |
+
}
|
1639 |
+
);
|
1640 |
+
},
|
1641 |
+
|
1642 |
+
/**
|
1643 |
+
* Import single page.
|
1644 |
+
*/
|
1645 |
+
_importSinglePage: function(event) {
|
1646 |
+
event.preventDefault();
|
1647 |
+
|
1648 |
+
var date = new Date();
|
1649 |
+
|
1650 |
+
var self = $( this ).parents( '.responsive-ready-sites-advanced-options-wrap.single-page-import-options-page' );
|
1651 |
+
|
1652 |
+
var required_plugins = self.data( 'required-plugins' ) || '',
|
1653 |
+
includes_wp_forms = self.data( 'includes-wp-forms' ) || false,
|
1654 |
+
wpforms_path = self.data( 'wpforms-path' ) || '';
|
1655 |
+
|
1656 |
+
ResponsiveSitesAdmin.current_page_id = self.data( 'page-id' ) || '';
|
1657 |
+
ResponsiveSitesAdmin.current_page_api = self.data( 'demo-api' ) || '';
|
1658 |
+
ResponsiveSitesAdmin.required_plugins = JSON.stringify( required_plugins );
|
1659 |
+
|
1660 |
+
if ( includes_wp_forms ) {
|
1661 |
+
ResponsiveSitesAdmin.wpforms_path = wpforms_path;
|
1662 |
+
} else {
|
1663 |
+
ResponsiveSitesAdmin.wpforms_path = '';
|
1664 |
}
|
1665 |
+
|
1666 |
+
ResponsiveSitesAdmin.import_start_time = new Date();
|
1667 |
+
|
1668 |
+
$( '.sites-import-process-errors .current-importing-status-error-title' ).html( '' );
|
1669 |
+
|
1670 |
+
$( '.sites-import-process-errors' ).hide();
|
1671 |
+
$( '.responsive-ready-page-import-free' ).addClass( 'updating-message installing' )
|
1672 |
+
.text( "Importing.." );
|
1673 |
+
$( '.responsive-ready-page-import-free' ).addClass( 'disabled not-click-able' );
|
1674 |
+
|
1675 |
+
ResponsiveSitesAdmin.processing_single_template = true;
|
1676 |
+
|
1677 |
+
$( document ).trigger( 'responsive-ready-sites-import-page-free-start' );
|
1678 |
},
|
1679 |
|
1680 |
+
/**
|
1681 |
+
* Get Page id from attribute
|
1682 |
+
*/
|
1683 |
+
_get_id: function( site_id ) {
|
1684 |
+
return site_id.replace( 'id-', '' );
|
1685 |
+
},
|
1686 |
+
|
1687 |
+
/**
|
1688 |
+
* Import WP Forms
|
1689 |
+
*/
|
1690 |
+
_import_wpform: function( wpforms_path, callback ) {
|
1691 |
+
|
1692 |
+
if ( '' == wpforms_path ) {
|
1693 |
+
if ( callback && typeof callback == "function") {
|
1694 |
+
callback( '' );
|
1695 |
+
}
|
1696 |
+
return;
|
1697 |
+
}
|
1698 |
+
|
1699 |
$.ajax(
|
1700 |
{
|
1701 |
+
url : responsiveSitesAdmin.ajaxurl,
|
1702 |
+
type : 'POST',
|
1703 |
+
dataType: 'json',
|
1704 |
+
data : {
|
1705 |
+
action : 'responsive-ready-sites-import-wpforms',
|
1706 |
+
wpforms_path : wpforms_path,
|
1707 |
+
_ajax_nonce : responsiveSitesAdmin._ajax_nonce,
|
1708 |
},
|
1709 |
}
|
1710 |
)
|
1711 |
+
.fail(
|
1712 |
+
function( jqXHR ){
|
1713 |
+
ResponsiveSitesAdmin._log_error( jqXHR );
|
1714 |
+
ResponsiveSitesAdmin._log_error( jqXHR.status + jqXHR.statusText, 'Import WP Forms Failed!', jqXHR );
|
1715 |
+
}
|
1716 |
+
)
|
1717 |
.done(
|
1718 |
+
function ( response ) {
|
1719 |
+
|
1720 |
+
// 1. Fail - Import WPForms Options.
|
1721 |
+
if ( false === response.success ) {
|
1722 |
+
ResponsiveSitesAdmin._log_error( response.data, 'Import WP Forms Failed!' );
|
1723 |
} else {
|
1724 |
+
if ( callback && typeof callback == "function") {
|
1725 |
+
callback( response );
|
1726 |
+
}
|
1727 |
}
|
1728 |
}
|
1729 |
);
|
1730 |
},
|
1731 |
+
|
1732 |
+
/**
|
1733 |
+
* Import page.
|
1734 |
+
*/
|
1735 |
+
_importPage: function() {
|
1736 |
+
|
1737 |
+
$( '.responsive-ready-sites-import-xml .responsive-ready-sites-tooltip-icon' ).addClass( 'processing-import' );
|
1738 |
+
|
1739 |
+
ResponsiveSitesAdmin._import_wpform(
|
1740 |
+
ResponsiveSitesAdmin.wpforms_path,
|
1741 |
+
function( form_response ) {
|
1742 |
+
|
1743 |
+
page_api_url = ResponsiveSitesAdmin.current_page_api + '/wp-json/wp/v2/pages/' + ResponsiveSitesAdmin.current_page_id;
|
1744 |
+
|
1745 |
+
fetch( page_api_url ).then(
|
1746 |
+
response => {
|
1747 |
+
return response.json();
|
1748 |
+
}
|
1749 |
+
).then(
|
1750 |
+
data => {
|
1751 |
+
// Import Single Page.
|
1752 |
+
$.ajax(
|
1753 |
+
{
|
1754 |
+
url: responsiveSitesAdmin.ajaxurl,
|
1755 |
+
type: 'POST',
|
1756 |
+
dataType: 'json',
|
1757 |
+
data: {
|
1758 |
+
'action': 'responsive-sites-create-page',
|
1759 |
+
'_ajax_nonce': responsiveSitesAdmin._ajax_nonce,
|
1760 |
+
'data': data,
|
1761 |
+
'current_page_api': ResponsiveSitesAdmin.current_page_api,
|
1762 |
+
},
|
1763 |
+
success: function (response) {
|
1764 |
+
if (response.success) {
|
1765 |
+
$( 'body' ).removeClass( 'importing-site' );
|
1766 |
+
$( '.site-import-options' ).hide();
|
1767 |
+
$( '.rotating,.current-importing-status-wrap,.notice-warning' ).remove();
|
1768 |
+
|
1769 |
+
var output = '<h2>Responsive Ready Site import Page complete.</h2>';
|
1770 |
+
output += '<p><a class="button button-primary button-hero" href="' + response.data['link'] + '" target="_blank">View Template</a></p>';
|
1771 |
+
|
1772 |
+
$( '.single-site-wrap' ).hide();
|
1773 |
+
$( '.result_preview' ).html( '' ).show();
|
1774 |
+
$( '.result_preview' ).html( output );
|
1775 |
+
} else {
|
1776 |
+
ResponsiveSitesAdmin._log_error( 'Page Rest API Request Failed!', true );
|
1777 |
+
}
|
1778 |
+
}
|
1779 |
+
}
|
1780 |
+
);
|
1781 |
+
}
|
1782 |
+
).catch(
|
1783 |
+
err => {
|
1784 |
+
ResponsiveSitesAdmin._log_error( 'Page Rest API Request Failed!', true );
|
1785 |
+
}
|
1786 |
+
);
|
1787 |
+
}
|
1788 |
+
);
|
1789 |
+
},
|
1790 |
+
|
1791 |
+
ucwords: function( str ) {
|
1792 |
+
if ( ! str ) {
|
1793 |
+
return '';
|
1794 |
+
}
|
1795 |
+
|
1796 |
+
str = str.toLowerCase().replace(
|
1797 |
+
/\b[a-z]/g,
|
1798 |
+
function(letter) {
|
1799 |
+
return letter.toUpperCase();
|
1800 |
+
}
|
1801 |
+
);
|
1802 |
+
|
1803 |
+
str = str.replace(
|
1804 |
+
/-/g,
|
1805 |
+
function(letter) {
|
1806 |
+
return ' ';
|
1807 |
+
}
|
1808 |
+
);
|
1809 |
+
|
1810 |
+
return str;
|
1811 |
+
},
|
1812 |
+
|
1813 |
};
|
1814 |
|
1815 |
/**
|
admin/partials/responsive-ready-sites-admin-display.php
CHANGED
@@ -17,8 +17,8 @@
|
|
17 |
<div id="responsive-ready-sites-import-options"></div>
|
18 |
<div id="responsive-ready-sites-admin-page">
|
19 |
<div class="responsive-sites-header">
|
20 |
-
<span class="ready-site-list-title"
|
21 |
-
<p class="ready-site-list-intro"
|
22 |
</div>
|
23 |
<div class="theme-browser rendered">
|
24 |
<div id="responsive-sites" class="themes wp-clearfix"></div>
|
@@ -38,34 +38,21 @@
|
|
38 |
<script type="text/template" id="tmpl-responsive-sites-list">
|
39 |
|
40 |
<# if ( data.items.length ) { #>
|
41 |
-
|
42 |
-
<# if ( data.active_site_data !== "" ) {#>
|
43 |
-
<div class="theme active ra-site-single" tabindex="0" aria-describedby="responsive-theme-action responsive-theme-name">
|
44 |
-
<div class="inner">
|
45 |
-
<span class="site-preview">
|
46 |
-
<div class="theme-screenshot" style="background-image: url('{{ data.active_site_data.featured_image_url }}');"></div>
|
47 |
-
</span>
|
48 |
-
<div class="theme-id-container">
|
49 |
-
<h3 class="theme-name" id="responsive-theme-name">Active : {{{ data.active_site_data.title }}}</h3>
|
50 |
-
</div>
|
51 |
-
</div>
|
52 |
-
</div>
|
53 |
-
<# } #>
|
54 |
<# for ( key in data.items ) { #>
|
55 |
-
|
56 |
-
<# if (data.items[ key ].slug === data.active_site ) { #>
|
57 |
-
<# continue; #>
|
58 |
-
<# } #>
|
59 |
-
|
60 |
<div class="theme inactive ra-site-single {{ data.items[ key ].status }}" tabindex="0" aria-describedby="responsive-theme-action responsive-theme-name"
|
61 |
data-demo-id="{{{ data.items[ key ].id }}}"
|
62 |
data-demo-url="{{{ data.items[ key ]['site_url'] }}}"
|
63 |
data-demo-slug="{{{ data.items[ key ].slug }}}"
|
64 |
data-demo-name="{{{ data.items[ key ].title.rendered }}}"
|
|
|
65 |
data-demo-type="{{{ data.items[ key ].demo_type }}}"
|
|
|
|
|
66 |
data-check_plugins_installed="{{{ data.items[ key ].check_plugins_installed }}}"
|
67 |
data-screenshot="{{{ data.items[ key ]['featured_image_url'] }}}"
|
68 |
data-required-plugins="{{ JSON.stringify(data.items[ key ]['required_plugins']) }}"
|
|
|
69 |
data-required-pro-plugins="{{ JSON.stringify(data.items[ key ]['required_pro_plugins']) }}">
|
70 |
<input type="hidden" class="site_options_data" value="{{ JSON.stringify(data.items[ key ][ 'site_options_data' ]) }}">
|
71 |
<div class="inner">
|
@@ -73,6 +60,9 @@
|
|
73 |
<div class="theme-screenshot" style="background-image: url('{{ data.items[ key ]['featured_image_url'] }}');"></div>
|
74 |
</span>
|
75 |
<span class="demo-type {{{ data.items[ key ].demo_type }}}">{{{ data.items[ key ].demo_type }}}</span>
|
|
|
|
|
|
|
76 |
<div class="theme-id-container">
|
77 |
<h3 class="theme-name" id="responsive-theme-name">{{{ data.items[ key ].title.rendered }}}</h3>
|
78 |
<div class="theme-actions">
|
@@ -84,11 +74,11 @@
|
|
84 |
<# } #>
|
85 |
<# } else { #>
|
86 |
<p class="no-themes" style="display:block;">
|
87 |
-
<?php
|
88 |
<span class="description">
|
89 |
<?php
|
90 |
/* translators: %1$s External Link */
|
91 |
-
printf(
|
92 |
?>
|
93 |
</span>
|
94 |
</p>
|
@@ -119,12 +109,15 @@
|
|
119 |
data-demo-url="{{{data.demo_url}}}"
|
120 |
data-demo-api="{{{data.demo_api}}}"
|
121 |
data-demo-name="{{{data.name}}}"
|
|
|
122 |
data-demo-type="{{{data.demo_type}}}"
|
|
|
123 |
data-check_plugins_installed="{{{data.check_plugins_installed}}}"
|
124 |
data-demo-slug="{{{data.slug}}}"
|
125 |
data-screenshot="{{{data.screenshot}}}"
|
126 |
data-required-plugins="{{data.required_plugins}}"
|
127 |
-
data-required-pro-plugins="{{data.required_pro_plugins}}"
|
|
|
128 |
<input type="hidden" class="responsive-site-options" value="{{data.site_options_data}}" >
|
129 |
<div class="wp-full-overlay-header">
|
130 |
<div>
|
@@ -133,6 +126,11 @@
|
|
133 |
|
134 |
<a class="button button-primary responsive-addons responsive-demo-import-options-{{{data.demo_type}}}" href="#"><?php esc_html_e( 'Import Site', 'responsive-addons' ); ?></a>
|
135 |
|
|
|
|
|
|
|
|
|
|
|
136 |
<# } else { #>
|
137 |
|
138 |
<a class="button button-primary responsive-addons responsive-buy-pro" href="https://cyberchimps.com/responsive-go-pro/?utm_source=free-to-pro&utm_medium=responsive-add-ons&utm_campaign=responsive-pro&utm_content=preview-ready-site" target="_blank"><?php esc_html_e( 'Buy Responsive Pro', 'responsive-addons' ); ?></a>
|
@@ -151,18 +149,210 @@
|
|
151 |
/** Theme Import Options Page */
|
152 |
?>
|
153 |
<script type="text/template" id="tmpl-responsive-ready-sites-import-options-page">
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
data-demo-api="{{{data.demo_api}}}"
|
158 |
data-demo-name="{{{data.name}}}"
|
159 |
-
data-demo-type="{{{data.demo_type}}}"
|
160 |
-
data-demo-slug="{{{data.slug}}}"
|
161 |
data-screenshot="{{{data.screenshot}}}"
|
|
|
|
|
162 |
data-required-plugins="{{data.required_plugins}}"
|
163 |
data-required-pro-plugins="{{data.required_pro_plugins}}">
|
164 |
-
<
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
<div class="wp-full-overlay-header">
|
167 |
<div>
|
168 |
<span class="responsive-site-demo-name">{{data.name}}</span>
|
@@ -179,7 +369,7 @@
|
|
179 |
<div class="site-import-options">
|
180 |
<div class="responsive-ready-sites-advanced-options">
|
181 |
<h2>Importing {{data.demo_name}}</h2>
|
182 |
-
<p
|
183 |
<ul class="responsive-ready-site-contents">
|
184 |
<li class="responsive-ready-sites-import-plugins">
|
185 |
<span class="responsive-ready-sites-install-plugins-title"><strong><?php _e( 'Install Required Plugins', 'responsive-addons' ); ?></strong></span>
|
@@ -188,44 +378,23 @@
|
|
188 |
<ul class="required-plugins-list"><span class="spinner is-active"></span></ul>
|
189 |
</div>
|
190 |
</li>
|
191 |
-
<li class="responsive-ready-sites-reset-data">
|
192 |
-
<label>
|
193 |
-
<strong>Delete Previous Import</strong>
|
194 |
-
</label>
|
195 |
-
<span class="responsive-ready-sites-tooltip-icon" data-tip-id="responsive-ready-sites-tooltip-reset-data"><span class="dashicons dashicons-editor-help"></span></span>
|
196 |
-
<div class="responsive-ready-sites-tooltip-message" id="responsive-ready-sites-tooltip-reset-data" style="display: none;">
|
197 |
-
<p><?php _e( 'Deletes previous import including customizer settings and content. Plugins are not deleted.', 'responsive-addons' ); ?></p>
|
198 |
-
</div>
|
199 |
-
</li>
|
200 |
<li class="responsive-ready-sites-import-xml">
|
201 |
<label>
|
202 |
-
<strong
|
203 |
</label>
|
204 |
<span class="responsive-ready-sites-tooltip-icon" data-tip-id="responsive-ready-sites-tooltip-site-content"><span class="dashicons dashicons-editor-help"></span></span>
|
205 |
<div class="responsive-ready-sites-tooltip-message" id="responsive-ready-sites-tooltip-site-content" style="display: none;">
|
206 |
-
<p><?php
|
207 |
</div>
|
208 |
<div class="responsive-ready-sites-import-process-wrap" style="display: none;">
|
209 |
<progress class="responsive-ready-sites-import-process" max="100" value="0"></progress>
|
210 |
</div>
|
211 |
</li>
|
212 |
-
<li class="responsive-ready-sites-import-customizer">
|
213 |
-
<label>
|
214 |
-
<strong>Import Customizer Settings</strong>
|
215 |
-
</label>
|
216 |
-
<span class="responsive-ready-sites-tooltip-icon" data-tip-id="responsive-ready-sites-tooltip-customizer-settings"><span class="dashicons dashicons-editor-help"></span></span>
|
217 |
-
<div class="responsive-ready-sites-tooltip-message" id="responsive-ready-sites-tooltip-customizer-settings" style="display: none;">
|
218 |
-
<p><?php _e( 'Imports sample customizer settings including site identity, typography, colors and other theme options.', 'responsive-addons' ); ?></p>
|
219 |
-
</div>
|
220 |
-
<div class="responsive-ready-sites-import-customizer-process-wrap" style="display: none;">
|
221 |
-
<progress class="responsive-ready-sites-import-customizer-process" max="100" value="0"></progress>
|
222 |
-
</div>
|
223 |
-
</li>
|
224 |
</ul>
|
225 |
</div>
|
226 |
<div class="responsive-ready-sites-import-button-wrap">
|
227 |
-
<a class="button button-hero button-primary responsive-ready-
|
228 |
-
|
229 |
</a>
|
230 |
</div>
|
231 |
</div>
|
@@ -234,3 +403,6 @@
|
|
234 |
</div>
|
235 |
</div>
|
236 |
</script>
|
|
|
|
|
|
17 |
<div id="responsive-ready-sites-import-options"></div>
|
18 |
<div id="responsive-ready-sites-admin-page">
|
19 |
<div class="responsive-sites-header">
|
20 |
+
<span class="ready-site-list-title"><?php esc_html_e( 'Responsive Ready Websites', 'responsive-addons' ); ?></span>
|
21 |
+
<p class="ready-site-list-intro"><?php esc_html_e( 'Build your Responsive website in 3 simple steps - import a ready website, change content and launch.', 'responsive-addons' ); ?></p>
|
22 |
</div>
|
23 |
<div class="theme-browser rendered">
|
24 |
<div id="responsive-sites" class="themes wp-clearfix"></div>
|
38 |
<script type="text/template" id="tmpl-responsive-sites-list">
|
39 |
|
40 |
<# if ( data.items.length ) { #>
|
41 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
<# for ( key in data.items ) { #>
|
|
|
|
|
|
|
|
|
|
|
43 |
<div class="theme inactive ra-site-single {{ data.items[ key ].status }}" tabindex="0" aria-describedby="responsive-theme-action responsive-theme-name"
|
44 |
data-demo-id="{{{ data.items[ key ].id }}}"
|
45 |
data-demo-url="{{{ data.items[ key ]['site_url'] }}}"
|
46 |
data-demo-slug="{{{ data.items[ key ].slug }}}"
|
47 |
data-demo-name="{{{ data.items[ key ].title.rendered }}}"
|
48 |
+
data-active-site="{{{ data.active_site }}}"
|
49 |
data-demo-type="{{{ data.items[ key ].demo_type }}}"
|
50 |
+
data-wpforms-path="{{{ data.items[ key ].wpforms_path }}}"
|
51 |
+
data-allow-pages="{{{ data.items[ key ].allow_pages }}}"
|
52 |
data-check_plugins_installed="{{{ data.items[ key ].check_plugins_installed }}}"
|
53 |
data-screenshot="{{{ data.items[ key ]['featured_image_url'] }}}"
|
54 |
data-required-plugins="{{ JSON.stringify(data.items[ key ]['required_plugins']) }}"
|
55 |
+
data-pages="{{ JSON.stringify(data.items[ key ]['pages'] )}}"
|
56 |
data-required-pro-plugins="{{ JSON.stringify(data.items[ key ]['required_pro_plugins']) }}">
|
57 |
<input type="hidden" class="site_options_data" value="{{ JSON.stringify(data.items[ key ][ 'site_options_data' ]) }}">
|
58 |
<div class="inner">
|
60 |
<div class="theme-screenshot" style="background-image: url('{{ data.items[ key ]['featured_image_url'] }}');"></div>
|
61 |
</span>
|
62 |
<span class="demo-type {{{ data.items[ key ].demo_type }}}">{{{ data.items[ key ].demo_type }}}</span>
|
63 |
+
<# if (data.items[ key ].slug === data.active_site ) { #>
|
64 |
+
<span class="current_active_site"><?php esc_html_e( 'Currently Active', 'responsive-addons' ); ?></span>
|
65 |
+
<# } #>
|
66 |
<div class="theme-id-container">
|
67 |
<h3 class="theme-name" id="responsive-theme-name">{{{ data.items[ key ].title.rendered }}}</h3>
|
68 |
<div class="theme-actions">
|
74 |
<# } #>
|
75 |
<# } else { #>
|
76 |
<p class="no-themes" style="display:block;">
|
77 |
+
<?php esc_html_e( 'No Demos found', 'responsive-addons' ); ?>
|
78 |
<span class="description">
|
79 |
<?php
|
80 |
/* translators: %1$s External Link */
|
81 |
+
printf( esc_html__( 'No More Sites', 'responsive-addons' ) );
|
82 |
?>
|
83 |
</span>
|
84 |
</p>
|
109 |
data-demo-url="{{{data.demo_url}}}"
|
110 |
data-demo-api="{{{data.demo_api}}}"
|
111 |
data-demo-name="{{{data.name}}}"
|
112 |
+
data-active-site="{{{data.active_site}}}"
|
113 |
data-demo-type="{{{data.demo_type}}}"
|
114 |
+
data-wpforms-path="{{{data.wpforms_path}}}"
|
115 |
data-check_plugins_installed="{{{data.check_plugins_installed}}}"
|
116 |
data-demo-slug="{{{data.slug}}}"
|
117 |
data-screenshot="{{{data.screenshot}}}"
|
118 |
data-required-plugins="{{data.required_plugins}}"
|
119 |
+
data-required-pro-plugins="{{data.required_pro_plugins}}"
|
120 |
+
data-pages="{{data.pages}}">
|
121 |
<input type="hidden" class="responsive-site-options" value="{{data.site_options_data}}" >
|
122 |
<div class="wp-full-overlay-header">
|
123 |
<div>
|
126 |
|
127 |
<a class="button button-primary responsive-addons responsive-demo-import-options-{{{data.demo_type}}}" href="#"><?php esc_html_e( 'Import Site', 'responsive-addons' ); ?></a>
|
128 |
|
129 |
+
<# if ( data.allow_pages ) { #>
|
130 |
+
|
131 |
+
<a class="button button-primary responsive-addons responsive-page-import-options-{{{data.demo_type}}}" href="#"><?php esc_html_e( 'Import Template', 'responsive-addons' ); ?></a>
|
132 |
+
|
133 |
+
<# } #>
|
134 |
<# } else { #>
|
135 |
|
136 |
<a class="button button-primary responsive-addons responsive-buy-pro" href="https://cyberchimps.com/responsive-go-pro/?utm_source=free-to-pro&utm_medium=responsive-add-ons&utm_campaign=responsive-pro&utm_content=preview-ready-site" target="_blank"><?php esc_html_e( 'Buy Responsive Pro', 'responsive-addons' ); ?></a>
|
149 |
/** Theme Import Options Page */
|
150 |
?>
|
151 |
<script type="text/template" id="tmpl-responsive-ready-sites-import-options-page">
|
152 |
+
<div class="responsive-ready-sites-advanced-options-wrap wp-full-overlay collapsed"
|
153 |
+
data-demo-id="{{{data.id}}}"
|
154 |
+
data-demo-url="{{{data.demo_url}}}"
|
155 |
+
data-demo-api="{{{data.demo_api}}}"
|
156 |
+
data-demo-name="{{{data.name}}}"
|
157 |
+
data-demo-type="{{{data.demo_type}}}"
|
158 |
+
data-demo-slug="{{{data.slug}}}"
|
159 |
+
data-screenshot="{{{data.screenshot}}}"
|
160 |
+
data-required-plugins="{{data.required_plugins}}"
|
161 |
+
data-pages="{{data.pages}}"
|
162 |
+
data-required-pro-plugins="{{data.required_pro_plugins}}">
|
163 |
+
<input type="hidden" class="responsive-site-options" value="{{data.site_options_data}}" >
|
164 |
+
<input type="hidden" class="demo_site_id" value="{{{ data.id }}}">
|
165 |
+
<div class="wp-full-overlay-header">
|
166 |
+
<div>
|
167 |
+
<span class="responsive-site-demo-name">{{data.name}}</span>
|
168 |
+
<button class="close-full-overlay responsive-addons"><span class="screen-reader-text"><?php esc_html_e( 'Close', 'responsive-addons' ); ?></span></button>
|
169 |
+
</div>
|
170 |
+
</div>
|
171 |
+
<div class="wp-full-overlay-main">
|
172 |
+
<div class="sites-import-process-errors" style="display: none">
|
173 |
+
<div class="import-process-error">
|
174 |
+
<div class="current-importing-status-error-title"></div>
|
175 |
+
</div>
|
176 |
+
</div>
|
177 |
+
|
178 |
+
<div class="site-import-options">
|
179 |
+
<div class="responsive-ready-sites-advanced-options">
|
180 |
+
<h2>Importing {{data.demo_name}}</h2>
|
181 |
+
<p><?php esc_html_e( 'Importing this ready site will …', 'responsive-addons' ); ?></p>
|
182 |
+
<# if ( data.slug === data.active_site ) { #>
|
183 |
+
<p><?php esc_html_e( 'This will delete previously imported site', 'responsive-addons' ); ?></p>
|
184 |
+
<# } #>
|
185 |
+
<ul class="responsive-ready-site-contents">
|
186 |
+
<li class="responsive-ready-sites-import-plugins">
|
187 |
+
<strong><?php esc_html_e( 'Install Required Plugins', 'responsive-addons' ); ?></strong>
|
188 |
+
<span class="responsive-ready-sites-tooltip-icon" data-tip-id="responsive-ready-sites-tooltip-plugins-settings"><span class="dashicons dashicons-editor-help"></span></span>
|
189 |
+
<div class="responsive-ready-sites-tooltip-message" id="responsive-ready-sites-tooltip-plugins-settings" style="display: none;">
|
190 |
+
<ul class="required-plugins-list"><span class="spinner is-active"></span></ul>
|
191 |
+
</div>
|
192 |
+
</li>
|
193 |
+
<li class="responsive-ready-sites-reset-data">
|
194 |
+
<label>
|
195 |
+
<strong><?php esc_html_e( 'Delete Previous Import', 'responsive-addons' ); ?></strong>
|
196 |
+
</label>
|
197 |
+
<span class="responsive-ready-sites-tooltip-icon" data-tip-id="responsive-ready-sites-tooltip-reset-data"><span class="dashicons dashicons-editor-help"></span></span>
|
198 |
+
<div class="responsive-ready-sites-tooltip-message" id="responsive-ready-sites-tooltip-reset-data" style="display: none;">
|
199 |
+
<p><?php esc_html_e( 'Deletes previous import including customizer settings and content. Plugins are not deleted.', 'responsive-addons' ); ?></p>
|
200 |
+
</div>
|
201 |
+
</li>
|
202 |
+
<li class="responsive-ready-sites-import-xml">
|
203 |
+
<label>
|
204 |
+
<strong><?php esc_html_e( 'Import Content', 'responsive-addons' ); ?></strong>
|
205 |
+
</label>
|
206 |
+
<span class="responsive-ready-sites-tooltip-icon" data-tip-id="responsive-ready-sites-tooltip-site-content"><span class="dashicons dashicons-editor-help"></span></span>
|
207 |
+
<div class="responsive-ready-sites-tooltip-message" id="responsive-ready-sites-tooltip-site-content" style="display: none;">
|
208 |
+
<p><?php esc_html_e( 'Imports sample pages, posts, images and menus. Depending on your internet speed this may take 2-10 minutes.', 'responsive-addons' ); ?></p>
|
209 |
+
</div>
|
210 |
+
<div class="responsive-ready-sites-import-process-wrap" style="display: none;">
|
211 |
+
<progress class="responsive-ready-sites-import-process" max="100" value="0"></progress>
|
212 |
+
</div>
|
213 |
+
</li>
|
214 |
+
<li class="responsive-ready-sites-import-customizer">
|
215 |
+
<label>
|
216 |
+
<strong><?php esc_html_e( 'Import Customizer Settings', 'responsive-addons' ); ?></strong>
|
217 |
+
</label>
|
218 |
+
<span class="responsive-ready-sites-tooltip-icon" data-tip-id="responsive-ready-sites-tooltip-customizer-settings"><span class="dashicons dashicons-editor-help"></span></span>
|
219 |
+
<div class="responsive-ready-sites-tooltip-message" id="responsive-ready-sites-tooltip-customizer-settings" style="display: none;">
|
220 |
+
<p><?php esc_html_e( 'Imports sample customizer settings including site identity, typography, colors and other theme options.', 'responsive-addons' ); ?></p>
|
221 |
+
</div>
|
222 |
+
<div class="responsive-ready-sites-import-customizer-process-wrap" style="display: none;">
|
223 |
+
<progress class="responsive-ready-sites-import-customizer-process" max="100" value="0"></progress>
|
224 |
+
</div>
|
225 |
+
</li>
|
226 |
+
</ul>
|
227 |
+
</div>
|
228 |
+
<div class="responsive-ready-sites-import-button-wrap">
|
229 |
+
<a class="button button-hero button-primary responsive-ready-site-import-{{{data.demo_type}}}" href="#">
|
230 |
+
<?php esc_html_e( 'Import Site', 'responsive-addons' ); ?>
|
231 |
+
</a>
|
232 |
+
</div>
|
233 |
+
</div>
|
234 |
+
<div class="result_preview" style="display: none">
|
235 |
+
</div>
|
236 |
+
</div>
|
237 |
+
</div>
|
238 |
+
</script>
|
239 |
+
|
240 |
+
<?php
|
241 |
+
/** Template Import Options Page */
|
242 |
+
?>
|
243 |
+
<script type="text/template" id="tmpl-responsive-ready-sites-import-page-preview-page">
|
244 |
+
<div class="responsive-ready-sites-advanced-options-wrap template-preview-page wp-full-overlay collapsed"
|
245 |
data-demo-api="{{{data.demo_api}}}"
|
246 |
data-demo-name="{{{data.name}}}"
|
|
|
|
|
247 |
data-screenshot="{{{data.screenshot}}}"
|
248 |
+
data-demo-type="{{{data.demo_type}}}"
|
249 |
+
data-wpforms-path="{{{data.wpforms_path}}}"
|
250 |
data-required-plugins="{{data.required_plugins}}"
|
251 |
data-required-pro-plugins="{{data.required_pro_plugins}}">
|
252 |
+
<div class="wp-full-overlay-header">
|
253 |
+
<div>
|
254 |
+
<span class="responsive-site-demo-name">{{data.name}}</span>
|
255 |
+
<button class="close-full-overlay responsive-addons"><span class="screen-reader-text"><?php esc_html_e( 'Close', 'responsive-addons' ); ?></span></button>
|
256 |
+
</div>
|
257 |
+
</div>
|
258 |
+
<div class="wp-full-overlay-main">
|
259 |
+
<div class="sites-import-process-errors" style="display: none">
|
260 |
+
<div class="import-process-error">
|
261 |
+
<div class="current-importing-status-error-title"></div>
|
262 |
+
</div>
|
263 |
+
</div>
|
264 |
+
|
265 |
+
<div class="theme-browser rendered">
|
266 |
+
<div id="site-pages" class="themes wp-clearfix">
|
267 |
+
<div class="single-site-wrap">
|
268 |
+
<div class="single-site">
|
269 |
+
<div class="single-site-preview-wrap">
|
270 |
+
<div class="single-site-preview">
|
271 |
+
<img class="theme-screenshot" data-src="" src="{{data.screenshot}}" />
|
272 |
+
</div>
|
273 |
+
</div>
|
274 |
+
<div class="single-site-pages-wrap">
|
275 |
+
<div class="responsive-pages-title-wrap">
|
276 |
+
<span class="responsive-pages-title"><?php esc_html_e( 'Page Templates', 'responsive-addons' ); ?></span>
|
277 |
+
</div>
|
278 |
+
<div class="single-site-pages">
|
279 |
+
<div id="single-pages">
|
280 |
+
<# for (page_id in data.pages) { #>
|
281 |
+
<#
|
282 |
+
var required_plugins = [];
|
283 |
+
for( id in data.pages[page_id]['free_plugins']) {
|
284 |
+
JSON.parse( data.required_plugins ).forEach( function( single_plugin ) {
|
285 |
+
if ( data.pages[page_id]['free_plugins'][id] == single_plugin.slug ) {
|
286 |
+
required_plugins.push( single_plugin );
|
287 |
+
}
|
288 |
+
}
|
289 |
+
);
|
290 |
+
}
|
291 |
+
var required_pro_plugins = [];
|
292 |
+
for( id in data.pages[page_id]['pro_plugins']) {
|
293 |
+
JSON.parse( data.required_pro_plugins ).forEach( function( single_plugin ) {
|
294 |
+
if ( data.pages[page_id]['pro_plugins'][id] == single_plugin.slug ) {
|
295 |
+
required_pro_plugins.push( single_plugin );
|
296 |
+
}
|
297 |
+
}
|
298 |
+
);
|
299 |
+
}
|
300 |
+
#>
|
301 |
+
<div class="theme responsive-theme site-single" data-page-id="{{data.pages[page_id]['page_id']}}" data-required-pro-plugins="{{ JSON.stringify( required_pro_plugins )}}" data-required-plugins="{{ JSON.stringify( required_plugins )}}" data-includes-wp-forms="{{ data.pages[page_id]['includes_wp_forms'] }}" >
|
302 |
+
<div class="inner">
|
303 |
+
<#
|
304 |
+
var featured_image_class = '';
|
305 |
+
var featured_image = data.pages[page_id]['featured_image'] || '';
|
306 |
+
if( '' === featured_image ) {
|
307 |
+
featured_image = '<?php echo esc_url( RESPONSIVE_ADDONS_DIR . 'inc/assets/images/placeholder.png' ); ?>';
|
308 |
+
featured_image_class = ' no-featured-image ';
|
309 |
+
}
|
310 |
+
|
311 |
+
var thumbnail_image = data.pages[page_id]['thumbnail-image-url'] || '';
|
312 |
+
if( '' === thumbnail_image ) {
|
313 |
+
thumbnail_image = featured_image;
|
314 |
+
}
|
315 |
+
#>
|
316 |
+
<span class="site-preview" data-title="{{ data.pages[page_id]['page_title'] }}">
|
317 |
+
<div class="theme-screenshot one loading {{ featured_image_class }}" data-src="{{ featured_image }}" data-featured-src="{{ featured_image }}" data-demo-type="{{ data.demo_type }}" style="background-image: url('{{ featured_image }}');"></div>
|
318 |
+
</span>
|
319 |
+
<div class="theme-id-container">
|
320 |
+
<h3 class="theme-name">
|
321 |
+
{{{ data.pages[page_id]['page_title'] }}}
|
322 |
+
</h3>
|
323 |
+
</div>
|
324 |
+
</div>
|
325 |
+
</div>
|
326 |
+
<# } #>
|
327 |
+
</div>
|
328 |
+
</div>
|
329 |
+
</div>
|
330 |
+
<div class="single-site-footer">
|
331 |
+
<div class="site-action-buttons-wrap">
|
332 |
+
<a href="#" class="button button-hero site-preview-button" target="_blank">Preview "{{data.name}}" Site <i class="dashicons dashicons-external"></i></a>
|
333 |
+
<div class="site-action-buttons-right">
|
334 |
+
<div style="margin-left: 5px;" class="button button-hero button-primary single-page-import-button-{{{ data.demo_type }}} disabled"><?php esc_html_e( 'Select Template', 'responsive-addons' ); ?></div>
|
335 |
+
</div>
|
336 |
+
</div>
|
337 |
+
</div>
|
338 |
+
</div>
|
339 |
+
</div>
|
340 |
+
</div>
|
341 |
+
</div>
|
342 |
+
<div class="result_preview" style="display: none">
|
343 |
+
</div>
|
344 |
+
</div>
|
345 |
+
</div>
|
346 |
+
</script>
|
347 |
+
|
348 |
+
<script type="text/template" id="tmpl-responsive-ready-sites-import-single-page-options-page">
|
349 |
+
<div class="responsive-ready-sites-advanced-options-wrap single-page-import-options-page wp-full-overlay collapsed"
|
350 |
+
data-page-id="{{{data.page_id}}}"
|
351 |
+
data-demo-api="{{{data.demo_api}}}"
|
352 |
+
data-includes-wp-forms="{{{data.includes_wp_forms}}}"
|
353 |
+
data-wpforms-path="{{{data.wpforms_path}}}"
|
354 |
+
data-required-plugins="{{ JSON.stringify( data.required_plugins )}}"
|
355 |
+
data-required-pro-plugins="{{ JSON.stringify( data.required_pro_plugins )}}">
|
356 |
<div class="wp-full-overlay-header">
|
357 |
<div>
|
358 |
<span class="responsive-site-demo-name">{{data.name}}</span>
|
369 |
<div class="site-import-options">
|
370 |
<div class="responsive-ready-sites-advanced-options">
|
371 |
<h2>Importing {{data.demo_name}}</h2>
|
372 |
+
<p><?php esc_html_e( 'Importing this ready template will …', 'responsive-addons' ); ?></p>
|
373 |
<ul class="responsive-ready-site-contents">
|
374 |
<li class="responsive-ready-sites-import-plugins">
|
375 |
<span class="responsive-ready-sites-install-plugins-title"><strong><?php _e( 'Install Required Plugins', 'responsive-addons' ); ?></strong></span>
|
378 |
<ul class="required-plugins-list"><span class="spinner is-active"></span></ul>
|
379 |
</div>
|
380 |
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
<li class="responsive-ready-sites-import-xml">
|
382 |
<label>
|
383 |
+
<strong><?php esc_html_e( 'Import Content', 'responsive-addons' ); ?></strong>
|
384 |
</label>
|
385 |
<span class="responsive-ready-sites-tooltip-icon" data-tip-id="responsive-ready-sites-tooltip-site-content"><span class="dashicons dashicons-editor-help"></span></span>
|
386 |
<div class="responsive-ready-sites-tooltip-message" id="responsive-ready-sites-tooltip-site-content" style="display: none;">
|
387 |
+
<p><?php esc_html_e( 'Imports ready template content. Depending on your internet speed this may take 1-3 minutes.', 'responsive-addons' ); ?></p>
|
388 |
</div>
|
389 |
<div class="responsive-ready-sites-import-process-wrap" style="display: none;">
|
390 |
<progress class="responsive-ready-sites-import-process" max="100" value="0"></progress>
|
391 |
</div>
|
392 |
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
</ul>
|
394 |
</div>
|
395 |
<div class="responsive-ready-sites-import-button-wrap">
|
396 |
+
<a class="button button-hero button-primary responsive-ready-page-import-{{{ data.demo_type }}}" href="#">
|
397 |
+
<?php esc_html_e( 'Import Template', 'responsive-addons' ); ?>
|
398 |
</a>
|
399 |
</div>
|
400 |
</div>
|
403 |
</div>
|
404 |
</div>
|
405 |
</script>
|
406 |
+
|
407 |
+
|
408 |
+
|
includes/class-responsive-add-ons.php
CHANGED
@@ -425,12 +425,13 @@ class Responsive_Add_Ons {
|
|
425 |
'responsive_sites_localize_vars',
|
426 |
array(
|
427 |
'debug' => ((defined('WP_DEBUG') && WP_DEBUG) || isset($_GET['debug'])) ? true : false, //phpcs:ignore
|
428 |
-
'ajaxurl'
|
429 |
-
'siteURL'
|
430 |
-
'_ajax_nonce'
|
431 |
-
'XMLReaderDisabled'
|
432 |
-
'required_plugins'
|
433 |
-
'ApiURL'
|
|
|
434 |
)
|
435 |
);
|
436 |
|
@@ -837,7 +838,7 @@ class Responsive_Add_Ons {
|
|
837 |
add_submenu_page(
|
838 |
'responsive_add_ons',
|
839 |
'Responsive Ready Sites Importer',
|
840 |
-
__( '
|
841 |
'manage_options',
|
842 |
'responsive-add-ons',
|
843 |
array( $this, 'responsive_add_ons_templates' ),
|
425 |
'responsive_sites_localize_vars',
|
426 |
array(
|
427 |
'debug' => ((defined('WP_DEBUG') && WP_DEBUG) || isset($_GET['debug'])) ? true : false, //phpcs:ignore
|
428 |
+
'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
|
429 |
+
'siteURL' => site_url(),
|
430 |
+
'_ajax_nonce' => wp_create_nonce( 'responsive-addons' ),
|
431 |
+
'XMLReaderDisabled' => ! class_exists( 'XMLReader' ) ? true : false,
|
432 |
+
'required_plugins' => array(),
|
433 |
+
'ApiURL' => self::$api_url,
|
434 |
+
'importSingleTemplateButtonTitle' => __( 'Import "%s" Template', 'responsive-addons' ),
|
435 |
)
|
436 |
);
|
437 |
|
838 |
add_submenu_page(
|
839 |
'responsive_add_ons',
|
840 |
'Responsive Ready Sites Importer',
|
841 |
+
__( 'Ready Sites', 'responsive-addons' ),
|
842 |
'manage_options',
|
843 |
'responsive-add-ons',
|
844 |
array( $this, 'responsive_add_ons_templates' ),
|
includes/importers/batch-processing/class-responsive-ready-sites-batch-processing-elementor.php
CHANGED
@@ -89,12 +89,30 @@ class Responsive_Ready_Sites_Batch_Processing_Elementor extends Source_Local {
|
|
89 |
}
|
90 |
}
|
91 |
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
// Import the data.
|
96 |
$data = $this->process_export_import_content( $data, 'on_import' );
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
// Update processed meta.
|
99 |
update_metadata( 'post', $post_id, '_elementor_data', $data );
|
100 |
update_metadata( 'post', $post_id, '_responsive_sites_hotlink_imported', true );
|
89 |
}
|
90 |
}
|
91 |
|
92 |
+
if ( ! is_array( $data ) ) {
|
93 |
+
$data = json_decode( $data, true );
|
94 |
+
}
|
95 |
+
|
96 |
+
$document = Plugin::$instance->documents->get( $post_id );
|
97 |
+
if ( $document ) {
|
98 |
+
$data = $document->get_elements_raw_data( $data, true );
|
99 |
+
}
|
100 |
|
101 |
// Import the data.
|
102 |
$data = $this->process_export_import_content( $data, 'on_import' );
|
103 |
|
104 |
+
$current_page_api = get_option( 'current_page_api' );
|
105 |
+
if ( isset( $current_page_api ) ) {
|
106 |
+
$data = wp_json_encode( $data, true );
|
107 |
+
if ( ! empty( $data ) ) {
|
108 |
+
$site_url = get_site_url();
|
109 |
+
$site_url = str_replace( '/', '\/', $site_url );
|
110 |
+
$current_page_api = str_replace( '/', '\/', $current_page_api );
|
111 |
+
$data = str_replace( $current_page_api, $site_url, $data );
|
112 |
+
$data = json_decode( $data, true );
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
// Update processed meta.
|
117 |
update_metadata( 'post', $post_id, '_elementor_data', $data );
|
118 |
update_metadata( 'post', $post_id, '_responsive_sites_hotlink_imported', true );
|
includes/importers/batch-processing/class-responsive-ready-sites-batch-processing-gutenberg.php
CHANGED
@@ -104,6 +104,13 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Batch_Processing_Gutenberg' ) ) :
|
|
104 |
*/
|
105 |
public function import_single_post( $post_id = 0 ) {
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
$ids_mapping = get_option( 'responsive_sites_wpforms_ids_mapping', array() );
|
108 |
|
109 |
// Post content.
|
@@ -116,6 +123,8 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Batch_Processing_Gutenberg' ) ) :
|
|
116 |
}
|
117 |
}
|
118 |
|
|
|
|
|
119 |
// Update content.
|
120 |
wp_update_post(
|
121 |
array(
|
@@ -125,6 +134,84 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Batch_Processing_Gutenberg' ) ) :
|
|
125 |
);
|
126 |
}
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
|
130 |
/**
|
104 |
*/
|
105 |
public function import_single_post( $post_id = 0 ) {
|
106 |
|
107 |
+
$is_elementor_page = get_post_meta( $post_id, '_elementor_version', true );
|
108 |
+
|
109 |
+
// If page contain Elementor meta then skip this page.
|
110 |
+
if ( $is_elementor_page ) {
|
111 |
+
return;
|
112 |
+
}
|
113 |
+
|
114 |
$ids_mapping = get_option( 'responsive_sites_wpforms_ids_mapping', array() );
|
115 |
|
116 |
// Post content.
|
123 |
}
|
124 |
}
|
125 |
|
126 |
+
$content = $this->get_content( $content );
|
127 |
+
|
128 |
// Update content.
|
129 |
wp_update_post(
|
130 |
array(
|
134 |
);
|
135 |
}
|
136 |
|
137 |
+
/**
|
138 |
+
* Download and Replace images
|
139 |
+
*
|
140 |
+
* @since 2.2.8
|
141 |
+
*
|
142 |
+
* @param string $content Mixed post content.
|
143 |
+
* @return array Hotlink image array.
|
144 |
+
*/
|
145 |
+
public function get_content( $content = '' ) {
|
146 |
+
|
147 |
+
$content = stripslashes( $content );
|
148 |
+
|
149 |
+
// Extract all links.
|
150 |
+
preg_match_all( '#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $content, $match );
|
151 |
+
|
152 |
+
$all_links = array_unique( $match[0] );
|
153 |
+
|
154 |
+
// Not have any link.
|
155 |
+
if ( empty( $all_links ) ) {
|
156 |
+
return $content;
|
157 |
+
}
|
158 |
+
|
159 |
+
$link_mapping = array();
|
160 |
+
$image_links = array();
|
161 |
+
$other_links = array();
|
162 |
+
|
163 |
+
foreach ( $all_links as $key => $link ) {
|
164 |
+
if ( preg_match( '/^((https?:\/\/)|(www\.))([a-z0-9-].?)+(:[0-9]+)?\/[\w\-]+\.(jpg|png|gif|jpeg)\/?$/i', $link ) ) {
|
165 |
+
|
166 |
+
// Get all image links except *-150x, *-300x and *-1024x.
|
167 |
+
if (
|
168 |
+
false === strpos( $link, '-150x' ) &&
|
169 |
+
false === strpos( $link, '-300x' ) &&
|
170 |
+
false === strpos( $link, '-1024x' )
|
171 |
+
) {
|
172 |
+
$image_links[] = $link;
|
173 |
+
}
|
174 |
+
} else {
|
175 |
+
|
176 |
+
// other links.
|
177 |
+
$other_links[] = $link;
|
178 |
+
}
|
179 |
+
}
|
180 |
+
|
181 |
+
if ( ! empty( $image_links ) ) {
|
182 |
+
foreach ( $image_links as $key => $image_url ) {
|
183 |
+
// Download remote image.
|
184 |
+
$image = array(
|
185 |
+
'url' => $image_url,
|
186 |
+
'id' => 0,
|
187 |
+
);
|
188 |
+
$downloaded_image = Responsive_Ready_Sites_Image_Importer::get_instance()->import( $image );
|
189 |
+
|
190 |
+
// Old and New image mapping links.
|
191 |
+
$link_mapping[ $image_url ] = $downloaded_image['url'];
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
$current_page_api = get_option( 'current_page_api' );
|
196 |
+
if ( isset( $current_page_api ) ) {
|
197 |
+
$site_url = get_site_url();
|
198 |
+
foreach ( $other_links as $key => $link ) {
|
199 |
+
$link_mapping[ $link ] = str_replace( $current_page_api, $site_url, $link );
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
foreach ( $link_mapping as $old_url => $new_url ) {
|
204 |
+
$content = str_replace( $old_url, $new_url, $content );
|
205 |
+
|
206 |
+
// Replace the slashed URLs if any exist.
|
207 |
+
$old_url = str_replace( '/', '/\\', $old_url );
|
208 |
+
$new_url = str_replace( '/', '/\\', $new_url );
|
209 |
+
$content = str_replace( $old_url, $new_url, $content );
|
210 |
+
}
|
211 |
+
|
212 |
+
return $content;
|
213 |
+
}
|
214 |
+
|
215 |
}
|
216 |
|
217 |
/**
|
includes/importers/batch-processing/class-responsive-ready-sites-batch-processing.php
CHANGED
@@ -33,6 +33,15 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Batch_Processing' ) ) :
|
|
33 |
*/
|
34 |
public static $process_all;
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
/**
|
37 |
* Initiator
|
38 |
*
|
@@ -54,16 +63,17 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Batch_Processing' ) ) :
|
|
54 |
public function __construct() {
|
55 |
|
56 |
// Core Helpers - Image.
|
57 |
-
// @todo This file is required for Elementor.
|
58 |
-
// Once we implement our logic for updating elementor data then we'll delete this file.
|
59 |
require_once ABSPATH . 'wp-admin/includes/image.php';
|
60 |
|
61 |
$responsive_ready_sites_batch_processing = plugin_dir_path( __FILE__ );
|
62 |
|
|
|
|
|
63 |
// Core Helpers - Batch Processing.
|
64 |
require_once $responsive_ready_sites_batch_processing . 'helpers/class-wp-async-request.php';
|
65 |
require_once $responsive_ready_sites_batch_processing . 'helpers/class-wp-background-process.php';
|
66 |
require_once $responsive_ready_sites_batch_processing . 'helpers/class-wp-background-process-responsive.php';
|
|
|
67 |
|
68 |
// Prepare Page Builders.
|
69 |
require_once $responsive_ready_sites_batch_processing . 'class-responsive-ready-sites-batch-processing-elementor.php';
|
@@ -72,10 +82,13 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Batch_Processing' ) ) :
|
|
72 |
// Menu fix.
|
73 |
require_once $responsive_ready_sites_batch_processing . 'class-responsive-ready-sites-batch-processing-menu.php';
|
74 |
|
75 |
-
self::$process_all
|
|
|
76 |
|
77 |
// Start image importing after site import complete.
|
78 |
add_action( 'responsive_ready_sites_import_complete', array( $this, 'start_process' ) );
|
|
|
|
|
79 |
}
|
80 |
|
81 |
/**
|
@@ -89,7 +102,7 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Batch_Processing' ) ) :
|
|
89 |
|
90 |
Responsive_Ready_Sites_Importer_Log::add( 'Batch Process Started!' );
|
91 |
|
92 |
-
// Add "gutenberg" in import
|
93 |
self::$process_all->push_to_queue( Responsive_Ready_Sites_Batch_Processing_Gutenberg::get_instance() );
|
94 |
|
95 |
// Add "elementor" in import [queue].
|
@@ -108,6 +121,39 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Batch_Processing' ) ) :
|
|
108 |
self::$process_all->save()->dispatch();
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
/**
|
112 |
* Get all post id's
|
113 |
*
|
33 |
*/
|
34 |
public static $process_all;
|
35 |
|
36 |
+
/**
|
37 |
+
* Process Single Page
|
38 |
+
*
|
39 |
+
* @since 2.0.8
|
40 |
+
* @var object Class object.
|
41 |
+
* @access public
|
42 |
+
*/
|
43 |
+
public static $process_single;
|
44 |
+
|
45 |
/**
|
46 |
* Initiator
|
47 |
*
|
63 |
public function __construct() {
|
64 |
|
65 |
// Core Helpers - Image.
|
|
|
|
|
66 |
require_once ABSPATH . 'wp-admin/includes/image.php';
|
67 |
|
68 |
$responsive_ready_sites_batch_processing = plugin_dir_path( __FILE__ );
|
69 |
|
70 |
+
require_once $responsive_ready_sites_batch_processing . 'helpers/class-responsive-ready-sites-image-importer.php';
|
71 |
+
|
72 |
// Core Helpers - Batch Processing.
|
73 |
require_once $responsive_ready_sites_batch_processing . 'helpers/class-wp-async-request.php';
|
74 |
require_once $responsive_ready_sites_batch_processing . 'helpers/class-wp-background-process.php';
|
75 |
require_once $responsive_ready_sites_batch_processing . 'helpers/class-wp-background-process-responsive.php';
|
76 |
+
require_once $responsive_ready_sites_batch_processing . 'helpers/class-wp-background-process-responsive-single.php';
|
77 |
|
78 |
// Prepare Page Builders.
|
79 |
require_once $responsive_ready_sites_batch_processing . 'class-responsive-ready-sites-batch-processing-elementor.php';
|
82 |
// Menu fix.
|
83 |
require_once $responsive_ready_sites_batch_processing . 'class-responsive-ready-sites-batch-processing-menu.php';
|
84 |
|
85 |
+
self::$process_all = new WP_Background_Process_Responsive();
|
86 |
+
self::$process_single = new WP_Background_Process_Responsive_Single();
|
87 |
|
88 |
// Start image importing after site import complete.
|
89 |
add_action( 'responsive_ready_sites_import_complete', array( $this, 'start_process' ) );
|
90 |
+
|
91 |
+
add_action( 'responsive_ready_sites_process_template', array( $this, 'start_process_page' ) );
|
92 |
}
|
93 |
|
94 |
/**
|
102 |
|
103 |
Responsive_Ready_Sites_Importer_Log::add( 'Batch Process Started!' );
|
104 |
|
105 |
+
// Add "gutenberg" in import queue.
|
106 |
self::$process_all->push_to_queue( Responsive_Ready_Sites_Batch_Processing_Gutenberg::get_instance() );
|
107 |
|
108 |
// Add "elementor" in import [queue].
|
121 |
self::$process_all->save()->dispatch();
|
122 |
}
|
123 |
|
124 |
+
/**
|
125 |
+
* Start Single Page Import
|
126 |
+
*
|
127 |
+
* @param int $page_id Page ID .
|
128 |
+
* @since 2.0.8
|
129 |
+
* @return void
|
130 |
+
*/
|
131 |
+
public function start_process_page( $page_id ) {
|
132 |
+
|
133 |
+
// Add "gutenberg" in import queue.
|
134 |
+
self::$process_single->push_to_queue(
|
135 |
+
array(
|
136 |
+
'page_id' => $page_id,
|
137 |
+
'instance' => Responsive_Ready_Sites_Batch_Processing_Gutenberg::get_instance(),
|
138 |
+
)
|
139 |
+
);
|
140 |
+
|
141 |
+
if ( is_plugin_active( 'elementor/elementor.php' ) ) {
|
142 |
+
\Elementor\Plugin::$instance->posts_css_manager->clear_cache();
|
143 |
+
|
144 |
+
$import = new \Elementor\TemplateLibrary\Responsive_Ready_Sites_Batch_Processing_Elementor();
|
145 |
+
self::$process_single->push_to_queue(
|
146 |
+
array(
|
147 |
+
'page_id' => $page_id,
|
148 |
+
'instance' => $import,
|
149 |
+
)
|
150 |
+
);
|
151 |
+
}
|
152 |
+
|
153 |
+
// Dispatch Queue.
|
154 |
+
self::$process_single->save()->dispatch();
|
155 |
+
}
|
156 |
+
|
157 |
/**
|
158 |
* Get all post id's
|
159 |
*
|
includes/importers/batch-processing/helpers/class-responsive-ready-sites-image-importer.php
ADDED
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Image Importer
|
4 |
+
*
|
5 |
+
* @package Responsive Addons
|
6 |
+
* @since 2.2.8
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! class_exists( 'Responsive_Ready_Sites_Image_Importer' ) ) :
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Responsive Ready Sites Image Importer
|
13 |
+
*
|
14 |
+
* @since 2.2.8
|
15 |
+
*/
|
16 |
+
class Responsive_Ready_Sites_Image_Importer {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Instance
|
20 |
+
*
|
21 |
+
* @since 2.2.8
|
22 |
+
* @var object Class object.
|
23 |
+
* @access private
|
24 |
+
*/
|
25 |
+
private static $instance;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Images IDs
|
29 |
+
*
|
30 |
+
* @var array The Array of already image IDs.
|
31 |
+
* @since 2.2.8
|
32 |
+
*/
|
33 |
+
private $already_imported_ids = array();
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Initiator
|
37 |
+
*
|
38 |
+
* @since 2.2.8
|
39 |
+
* @return object initialized object of class.
|
40 |
+
*/
|
41 |
+
public static function get_instance() {
|
42 |
+
if ( ! isset( self::$instance ) ) {
|
43 |
+
self::$instance = new self();
|
44 |
+
}
|
45 |
+
return self::$instance;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Constructor
|
50 |
+
*
|
51 |
+
* @since 2.2.8
|
52 |
+
*/
|
53 |
+
public function __construct() {
|
54 |
+
|
55 |
+
if ( ! function_exists( 'WP_Filesystem' ) ) {
|
56 |
+
require_once ABSPATH . 'wp-admin/includes/file.php';
|
57 |
+
}
|
58 |
+
|
59 |
+
WP_Filesystem();
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Process Image Download
|
64 |
+
*
|
65 |
+
* @since 2.2.8
|
66 |
+
* @param array $attachments Attachment array.
|
67 |
+
* @return array Attachment array.
|
68 |
+
*/
|
69 |
+
public function process( $attachments ) {
|
70 |
+
|
71 |
+
$downloaded_images = array();
|
72 |
+
|
73 |
+
foreach ( $attachments as $key => $attachment ) {
|
74 |
+
$downloaded_images[] = $this->import( $attachment );
|
75 |
+
}
|
76 |
+
|
77 |
+
return $downloaded_images;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Get Hash Image.
|
82 |
+
*
|
83 |
+
* @since 2.2.8
|
84 |
+
* @param string $attachment_url Attachment URL.
|
85 |
+
* @return string Hash string.
|
86 |
+
*/
|
87 |
+
public function get_hash_image( $attachment_url ) {
|
88 |
+
return sha1( $attachment_url );
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Get Saved Image.
|
93 |
+
*
|
94 |
+
* @since 2.2.8
|
95 |
+
* @param string $attachment Attachment Data.
|
96 |
+
* @return string Hash string.
|
97 |
+
*/
|
98 |
+
private function get_saved_image( $attachment ) {
|
99 |
+
|
100 |
+
if ( apply_filters( 'responsive_ready_sites_image_importer_skip_image', false, $attachment ) ) {
|
101 |
+
return array(
|
102 |
+
'status' => true,
|
103 |
+
'attachment' => $attachment,
|
104 |
+
);
|
105 |
+
}
|
106 |
+
|
107 |
+
global $wpdb;
|
108 |
+
|
109 |
+
$post_id = $wpdb->get_var(
|
110 |
+
$wpdb->prepare(
|
111 |
+
'SELECT `post_id` FROM `' . $wpdb->postmeta . '`
|
112 |
+
WHERE `meta_key` = \'_responsive_ready_sites_image_hash\'
|
113 |
+
AND `meta_value` = %s
|
114 |
+
;',
|
115 |
+
$this->get_hash_image( $attachment['url'] )
|
116 |
+
)
|
117 |
+
);
|
118 |
+
|
119 |
+
if ( empty( $post_id ) ) {
|
120 |
+
|
121 |
+
// check it exist in attachment.
|
122 |
+
$filename = basename( $attachment['url'] );
|
123 |
+
|
124 |
+
$post_id = $wpdb->get_var(
|
125 |
+
$wpdb->prepare(
|
126 |
+
"SELECT post_id FROM {$wpdb->postmeta}
|
127 |
+
WHERE meta_key = '_wp_attached_file'
|
128 |
+
AND meta_value LIKE %s",
|
129 |
+
'%/' . $filename . '%'
|
130 |
+
)
|
131 |
+
);
|
132 |
+
|
133 |
+
Responsive_Ready_Sites_Importer_Log::add( 'BATCH - SKIP Image {already imported from xml} - ' . $attachment['url'] );
|
134 |
+
}
|
135 |
+
|
136 |
+
if ( $post_id ) {
|
137 |
+
$new_attachment = array(
|
138 |
+
'id' => $post_id,
|
139 |
+
'url' => wp_get_attachment_url( $post_id ),
|
140 |
+
);
|
141 |
+
$this->already_imported_ids[] = $post_id;
|
142 |
+
|
143 |
+
return array(
|
144 |
+
'status' => true,
|
145 |
+
'attachment' => $new_attachment,
|
146 |
+
);
|
147 |
+
}
|
148 |
+
|
149 |
+
return array(
|
150 |
+
'status' => false,
|
151 |
+
'attachment' => $attachment,
|
152 |
+
);
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Import Image
|
157 |
+
*
|
158 |
+
* @since 2.2.8
|
159 |
+
* @param array $attachment Attachment array.
|
160 |
+
* @return array Attachment array.
|
161 |
+
*/
|
162 |
+
public function import( $attachment ) {
|
163 |
+
|
164 |
+
$saved_image = $this->get_saved_image( $attachment );
|
165 |
+
|
166 |
+
if ( $saved_image['status'] ) {
|
167 |
+
return $saved_image['attachment'];
|
168 |
+
}
|
169 |
+
|
170 |
+
$file_content = wp_remote_retrieve_body(
|
171 |
+
wp_safe_remote_get(
|
172 |
+
$attachment['url'],
|
173 |
+
array(
|
174 |
+
'timeout' => '60',
|
175 |
+
'sslverify' => false,
|
176 |
+
)
|
177 |
+
)
|
178 |
+
);
|
179 |
+
|
180 |
+
// Empty file content?
|
181 |
+
if ( empty( $file_content ) ) {
|
182 |
+
|
183 |
+
return $attachment;
|
184 |
+
}
|
185 |
+
|
186 |
+
$filename = basename( $attachment['url'] );
|
187 |
+
|
188 |
+
$upload = wp_upload_bits(
|
189 |
+
$filename,
|
190 |
+
null,
|
191 |
+
$file_content
|
192 |
+
);
|
193 |
+
|
194 |
+
$post = array(
|
195 |
+
'post_title' => $filename,
|
196 |
+
'guid' => $upload['url'],
|
197 |
+
);
|
198 |
+
|
199 |
+
$info = wp_check_filetype( $upload['file'] );
|
200 |
+
if ( $info ) {
|
201 |
+
$post['post_mime_type'] = $info['type'];
|
202 |
+
} else {
|
203 |
+
return $attachment;
|
204 |
+
}
|
205 |
+
|
206 |
+
$post_id = wp_insert_attachment( $post, $upload['file'] );
|
207 |
+
wp_update_attachment_metadata(
|
208 |
+
$post_id,
|
209 |
+
wp_generate_attachment_metadata( $post_id, $upload['file'] )
|
210 |
+
);
|
211 |
+
update_post_meta( $post_id, '_responsive_ready_sites_image_hash', $this->get_hash_image( $attachment['url'] ) );
|
212 |
+
|
213 |
+
Responsive_Ready_Sites_WXR_Importer::instance()->track_post( $post_id );
|
214 |
+
|
215 |
+
$new_attachment = array(
|
216 |
+
'id' => $post_id,
|
217 |
+
'url' => $upload['url'],
|
218 |
+
);
|
219 |
+
|
220 |
+
$this->already_imported_ids[] = $post_id;
|
221 |
+
|
222 |
+
return $new_attachment;
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Is Image URL
|
227 |
+
*
|
228 |
+
* @since 2.2.8
|
229 |
+
*
|
230 |
+
* @param string $url URL.
|
231 |
+
* @return boolean
|
232 |
+
*/
|
233 |
+
public function is_image_url( $url = '' ) {
|
234 |
+
if ( empty( $url ) ) {
|
235 |
+
return false;
|
236 |
+
}
|
237 |
+
|
238 |
+
if ( preg_match( '/^((https?:\/\/)|(www\.))([a-z0-9-].?)+(:[0-9]+)?\/[\w\-]+\.(jpg|png|svg|gif|jpeg)\/?$/i', $url ) ) {
|
239 |
+
return true;
|
240 |
+
}
|
241 |
+
|
242 |
+
return false;
|
243 |
+
}
|
244 |
+
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* creating object by calling get_instance
|
249 |
+
*/
|
250 |
+
Responsive_Ready_Sites_Importer_Log::get_instance();
|
251 |
+
|
252 |
+
endif;
|
includes/importers/batch-processing/helpers/class-wp-background-process-responsive-single.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Single Page Background Process
|
4 |
+
*
|
5 |
+
* @package Responsive Addons
|
6 |
+
* @since 2.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( class_exists( 'WP_Background_Process' ) ) :
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Image Background Process
|
13 |
+
*
|
14 |
+
* @since 2.0.0
|
15 |
+
*/
|
16 |
+
class WP_Background_Process_Responsive_Single extends WP_Background_Process {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Image Process
|
20 |
+
*
|
21 |
+
* @var string
|
22 |
+
*/
|
23 |
+
protected $action = 'responsive_ready_sites_single_page';
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Task
|
27 |
+
*
|
28 |
+
* Override this method to perform any actions required on each
|
29 |
+
* queue item. Return the modified item for further processing
|
30 |
+
* in the next pass through. Or, return false to remove the
|
31 |
+
* item from the queue.
|
32 |
+
*
|
33 |
+
* @since 2.0.0
|
34 |
+
*
|
35 |
+
* @param object $object Queue item object.
|
36 |
+
* @return mixed
|
37 |
+
*/
|
38 |
+
protected function task( $object ) {
|
39 |
+
|
40 |
+
$page_id = $object['page_id'];
|
41 |
+
|
42 |
+
$process = $object['instance'];
|
43 |
+
|
44 |
+
if ( method_exists( $process, 'import_single_post' ) ) {
|
45 |
+
$process->import_single_post( $page_id );
|
46 |
+
}
|
47 |
+
|
48 |
+
return false;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Complete
|
53 |
+
*
|
54 |
+
* Override if applicable, but ensure that the below actions are
|
55 |
+
* performed, or, call parent::complete().
|
56 |
+
*
|
57 |
+
* @since 2.0.0
|
58 |
+
*/
|
59 |
+
protected function complete() {
|
60 |
+
|
61 |
+
parent::complete();
|
62 |
+
|
63 |
+
do_action( 'responsive_ready_sites_image_import_complete' );
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
endif;
|
includes/importers/class-responsive-ready-sites-importer.php
CHANGED
@@ -72,6 +72,9 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Importer' ) ) :
|
|
72 |
add_action( 'wp_ajax_responsive-ready-sites-delete-posts', array( $this, 'delete_imported_posts' ) );
|
73 |
add_action( 'wp_ajax_responsive-ready-sites-delete-wp-forms', array( $this, 'delete_imported_wp_forms' ) );
|
74 |
add_action( 'wp_ajax_responsive-ready-sites-delete-terms', array( $this, 'delete_imported_terms' ) );
|
|
|
|
|
|
|
75 |
}
|
76 |
|
77 |
add_action( 'responsive_ready_sites_import_complete', array( $this, 'clear_cache' ) );
|
@@ -560,6 +563,7 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Importer' ) ) :
|
|
560 |
'site_widgets_data' => '',
|
561 |
'slug' => '',
|
562 |
'site_options_data' => '',
|
|
|
563 |
);
|
564 |
|
565 |
$api_args = apply_filters(
|
@@ -603,6 +607,7 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Importer' ) ) :
|
|
603 |
$remote_args['wpforms_path'] = $data['wpforms_path'];
|
604 |
$remote_args['site_customizer_data'] = $data['site_customizer_data'];
|
605 |
$remote_args['required_plugins'] = $data['required_plugins'];
|
|
|
606 |
$remote_args['site_widgets_data'] = json_decode( $data['site_widgets_data'] );
|
607 |
$remote_args['site_options_data'] = $data['site_options_data'];
|
608 |
$remote_args['slug'] = $data['slug'];
|
@@ -793,6 +798,102 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Importer' ) ) :
|
|
793 |
/* translators: %s is the term ID */
|
794 |
wp_send_json_success( $message );
|
795 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
796 |
}
|
797 |
|
798 |
/**
|
72 |
add_action( 'wp_ajax_responsive-ready-sites-delete-posts', array( $this, 'delete_imported_posts' ) );
|
73 |
add_action( 'wp_ajax_responsive-ready-sites-delete-wp-forms', array( $this, 'delete_imported_wp_forms' ) );
|
74 |
add_action( 'wp_ajax_responsive-ready-sites-delete-terms', array( $this, 'delete_imported_terms' ) );
|
75 |
+
|
76 |
+
// Import single page
|
77 |
+
add_action( 'wp_ajax_responsive-sites-create-page', array( $this, 'import_single_page' ) );
|
78 |
}
|
79 |
|
80 |
add_action( 'responsive_ready_sites_import_complete', array( $this, 'clear_cache' ) );
|
563 |
'site_widgets_data' => '',
|
564 |
'slug' => '',
|
565 |
'site_options_data' => '',
|
566 |
+
'pages' => '',
|
567 |
);
|
568 |
|
569 |
$api_args = apply_filters(
|
607 |
$remote_args['wpforms_path'] = $data['wpforms_path'];
|
608 |
$remote_args['site_customizer_data'] = $data['site_customizer_data'];
|
609 |
$remote_args['required_plugins'] = $data['required_plugins'];
|
610 |
+
$remote_args['pages'] = $data['pages'];
|
611 |
$remote_args['site_widgets_data'] = json_decode( $data['site_widgets_data'] );
|
612 |
$remote_args['site_options_data'] = $data['site_options_data'];
|
613 |
$remote_args['slug'] = $data['slug'];
|
798 |
/* translators: %s is the term ID */
|
799 |
wp_send_json_success( $message );
|
800 |
}
|
801 |
+
|
802 |
+
/**
|
803 |
+
* Import Single Page.
|
804 |
+
*
|
805 |
+
* @since 2.3.0
|
806 |
+
*/
|
807 |
+
public function import_single_page() {
|
808 |
+
|
809 |
+
// Verify Nonce.
|
810 |
+
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
811 |
+
|
812 |
+
if ( ! current_user_can( 'install_plugins' ) ) {
|
813 |
+
wp_send_json_error( __( 'You are not allowed to perform this action', 'responsive-addons' ) );
|
814 |
+
}
|
815 |
+
|
816 |
+
$data = isset( $_POST['data'] ) ? $_POST['data'] : array();
|
817 |
+
|
818 |
+
if ( empty( $data ) ) {
|
819 |
+
wp_send_json_error( 'Page Data is empty.' );
|
820 |
+
}
|
821 |
+
|
822 |
+
$current_page_api = isset( $_POST['current_page_api'] ) ? $_POST['current_page_api'] : '';
|
823 |
+
update_option( 'current_page_api', $current_page_api );
|
824 |
+
|
825 |
+
$page_id = isset( $_POST['data']['id'] ) ? $_POST['data']['id'] : '';
|
826 |
+
$title = isset( $_POST['data']['title']['rendered'] ) ? $_POST['data']['title']['rendered'] : '';
|
827 |
+
$excerpt = isset( $_POST['data']['excerpt']['rendered'] ) ? $_POST['data']['excerpt']['rendered'] : '';
|
828 |
+
$content = isset( $_POST['data']['original_content'] ) ? $_POST['data']['original_content'] : ( isset( $_POST['data']['content']['rendered'] ) ? $_POST['data']['content']['rendered'] : '' );
|
829 |
+
|
830 |
+
$post_args = array(
|
831 |
+
'post_type' => 'page',
|
832 |
+
'post_status' => 'draft',
|
833 |
+
'post_title' => $title,
|
834 |
+
'post_content' => $content,
|
835 |
+
'post_excerpt' => $excerpt,
|
836 |
+
);
|
837 |
+
|
838 |
+
$new_page_id = wp_insert_post( $post_args );
|
839 |
+
$post_meta = isset( $_POST['data']['post-meta'] ) ? $_POST['data']['post-meta'] : array();
|
840 |
+
|
841 |
+
if ( ! empty( $post_meta ) ) {
|
842 |
+
$this->import_post_meta( $new_page_id, $post_meta );
|
843 |
+
}
|
844 |
+
|
845 |
+
do_action( 'responsive_ready_sites_process_template', $new_page_id );
|
846 |
+
|
847 |
+
wp_send_json_success(
|
848 |
+
array(
|
849 |
+
'remove-page-id' => $page_id,
|
850 |
+
'id' => $new_page_id,
|
851 |
+
'link' => get_permalink( $new_page_id ),
|
852 |
+
)
|
853 |
+
);
|
854 |
+
}
|
855 |
+
|
856 |
+
/**
|
857 |
+
* Import Post Meta
|
858 |
+
*
|
859 |
+
* @since 2.3.0
|
860 |
+
*
|
861 |
+
* @param integer $post_id Post ID.
|
862 |
+
* @param array $metadata Post meta.
|
863 |
+
* @return void
|
864 |
+
*/
|
865 |
+
public function import_post_meta( $post_id, $metadata ) {
|
866 |
+
|
867 |
+
$metadata = (array) $metadata;
|
868 |
+
|
869 |
+
foreach ( $metadata as $meta_key => $meta_value ) {
|
870 |
+
|
871 |
+
if ( $meta_value ) {
|
872 |
+
|
873 |
+
if ( '_elementor_data' === $meta_key ) {
|
874 |
+
|
875 |
+
$raw_data = json_decode( stripslashes( $meta_value ), true );
|
876 |
+
|
877 |
+
if ( is_array( $raw_data ) ) {
|
878 |
+
$raw_data = wp_slash( wp_json_encode( $raw_data ) );
|
879 |
+
} else {
|
880 |
+
$raw_data = wp_slash( $raw_data );
|
881 |
+
}
|
882 |
+
} else {
|
883 |
+
|
884 |
+
if ( is_serialized( $meta_value, true ) ) {
|
885 |
+
$raw_data = maybe_unserialize( stripslashes( $meta_value ) );
|
886 |
+
} elseif ( is_array( $meta_value ) ) {
|
887 |
+
$raw_data = json_decode( stripslashes( $meta_value ), true );
|
888 |
+
} else {
|
889 |
+
$raw_data = $meta_value;
|
890 |
+
}
|
891 |
+
}
|
892 |
+
|
893 |
+
update_post_meta( $post_id, $meta_key, $raw_data );
|
894 |
+
}
|
895 |
+
}
|
896 |
+
}
|
897 |
}
|
898 |
|
899 |
/**
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: cyberchimps
|
|
3 |
Donate Link: https://cyberchimps.com
|
4 |
Tags: one click demo import, gutenberg, elementor, templates
|
5 |
Requires at least: 5.0
|
6 |
-
Tested up to: 5.
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 2.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -106,6 +106,9 @@ Absolutely not! Once you install the plugin, it will take care of all other depe
|
|
106 |
4. Your website is ready
|
107 |
|
108 |
== Changelog ==
|
|
|
|
|
|
|
109 |
= 2.3.1 - 23rd June 2020 =
|
110 |
* Fix - Minor bug
|
111 |
|
@@ -236,4 +239,4 @@ Absolutely not! Once you install the plugin, it will take care of all other depe
|
|
236 |
* Bug fixes
|
237 |
|
238 |
= 1.0.0 =
|
239 |
-
* Initial set up and release
|
3 |
Donate Link: https://cyberchimps.com
|
4 |
Tags: one click demo import, gutenberg, elementor, templates
|
5 |
Requires at least: 5.0
|
6 |
+
Tested up to: 5.5
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 2.4.0
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
106 |
4. Your website is ready
|
107 |
|
108 |
== Changelog ==
|
109 |
+
= 2.4.0 - 6th July 2020 =
|
110 |
+
* Feature - Single Page Importer
|
111 |
+
|
112 |
= 2.3.1 - 23rd June 2020 =
|
113 |
* Fix - Minor bug
|
114 |
|
239 |
* Bug fixes
|
240 |
|
241 |
= 1.0.0 =
|
242 |
+
* Initial set up and release
|
responsive-add-ons.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Responsive Ready Sites Importer
|
4 |
* Plugin URI: http://wordpress.org/plugins/responsive-add-ons/
|
5 |
* Description: Import Responsive Ready Sites that help you launch your website quickly. Just import, update & hit the launch button.
|
6 |
-
* Version: 2.
|
7 |
* Author: CyberChimps
|
8 |
* License: GPL2
|
9 |
*
|
@@ -45,7 +45,7 @@ if ( ! defined( 'RESPONSIVE_ADDONS_URI' ) ) {
|
|
45 |
}
|
46 |
|
47 |
if ( ! defined( 'RESPONSIVE_ADDONS_VER' ) ) {
|
48 |
-
define( 'RESPONSIVE_ADDONS_VER', '2.
|
49 |
}
|
50 |
|
51 |
if ( ! function_exists( 'ra_fs' ) ) {
|
@@ -65,7 +65,7 @@ if ( ! function_exists( 'ra_fs' ) ) {
|
|
65 |
'slug' => 'responsive-add-ons',
|
66 |
'product_name' => 'Responsive Ready Sites Importer',
|
67 |
'module_type' => 'plugin',
|
68 |
-
'version' => '2.
|
69 |
'plugin_basename' => 'responsive-add-ons/responsive-add-ons.php',
|
70 |
'plugin_url' => RESPONSIVE_ADDONS_DIR_URL,
|
71 |
)
|
3 |
* Plugin Name: Responsive Ready Sites Importer
|
4 |
* Plugin URI: http://wordpress.org/plugins/responsive-add-ons/
|
5 |
* Description: Import Responsive Ready Sites that help you launch your website quickly. Just import, update & hit the launch button.
|
6 |
+
* Version: 2.4.0
|
7 |
* Author: CyberChimps
|
8 |
* License: GPL2
|
9 |
*
|
45 |
}
|
46 |
|
47 |
if ( ! defined( 'RESPONSIVE_ADDONS_VER' ) ) {
|
48 |
+
define( 'RESPONSIVE_ADDONS_VER', '2.4.0' );
|
49 |
}
|
50 |
|
51 |
if ( ! function_exists( 'ra_fs' ) ) {
|
65 |
'slug' => 'responsive-add-ons',
|
66 |
'product_name' => 'Responsive Ready Sites Importer',
|
67 |
'module_type' => 'plugin',
|
68 |
+
'version' => '2.4.0',
|
69 |
'plugin_basename' => 'responsive-add-ons/responsive-add-ons.php',
|
70 |
'plugin_url' => RESPONSIVE_ADDONS_DIR_URL,
|
71 |
)
|