Astra Starter Sites - Version 1.3.0

Version Description

Download this release

Release Info

Developer Nikschavan
Plugin Icon Astra Starter Sites
Version 1.3.0
Comparing to
See all releases

Code changes from version 1.2.15 to 1.3.0

Files changed (36) hide show
  1. astra-sites.php +54 -54
  2. inc/assets/css/admin.css +637 -475
  3. inc/assets/js/admin-page.js +1814 -1438
  4. inc/assets/js/astra-sites-api.js +64 -56
  5. inc/assets/js/astra-sites-notices.js +20 -20
  6. inc/assets/js/eventsource.js +673 -673
  7. inc/assets/js/eventsource.min.js +5 -5
  8. inc/assets/js/render-grid.js +596 -591
  9. inc/classes/class-astra-sites-importer-log.php +601 -510
  10. inc/classes/class-astra-sites-importer.php +573 -407
  11. inc/classes/class-astra-sites-page.php +360 -294
  12. inc/classes/class-astra-sites-white-label.php +239 -238
  13. inc/classes/class-astra-sites.php +518 -471
  14. inc/classes/compatibility/astra-pro/class-astra-sites-compatibility-astra-pro.php +299 -302
  15. inc/importers/batch-processing/class-astra-sites-batch-processing-beaver-builder.php +261 -263
  16. inc/importers/batch-processing/class-astra-sites-batch-processing-brizy.php +125 -126
  17. inc/importers/batch-processing/class-astra-sites-batch-processing-elementor.php +111 -113
  18. inc/importers/batch-processing/class-astra-sites-batch-processing-misc.php +137 -139
  19. inc/importers/batch-processing/class-astra-sites-batch-processing-widgets.php +97 -98
  20. inc/importers/batch-processing/class-astra-sites-batch-processing.php +209 -209
  21. inc/importers/batch-processing/helpers/class-astra-sites-image-importer.php +263 -280
  22. inc/importers/batch-processing/helpers/class-wp-async-request.php +164 -164
  23. inc/importers/batch-processing/helpers/class-wp-background-process-astra.php +65 -67
  24. inc/importers/batch-processing/helpers/class-wp-background-process.php +513 -513
  25. inc/importers/class-astra-customizer-import.php +88 -88
  26. inc/importers/class-astra-site-options-import.php +289 -287
  27. inc/importers/class-astra-sites-helper.php +311 -311
  28. inc/importers/class-widgets-importer.php +278 -278
  29. inc/importers/wxr-importer/class-astra-wxr-importer.php +441 -416
  30. inc/importers/wxr-importer/class-logger.php +139 -142
  31. inc/importers/wxr-importer/class-wp-importer-logger-serversentevents.php +43 -46
  32. inc/importers/wxr-importer/class-wxr-import-info.php +20 -20
  33. inc/importers/wxr-importer/class-wxr-importer.php +2300 -2300
  34. inc/includes/admin-page.php +401 -348
  35. languages/astra-sites.pot +774 -720
  36. readme.txt +295 -288
astra-sites.php CHANGED
@@ -1,54 +1,54 @@
1
- <?php
2
- /**
3
- * Plugin Name: Astra Starter Sites – Elementor, Beaver Builder & Gutenberg Templates
4
- * Plugin URI: http://www.wpastra.com/pro/
5
- * Description: Import free sites build with Astra theme.
6
- * Version: 1.2.15
7
- * Author: Brainstorm Force
8
- * Author URI: http://www.brainstormforce.com
9
- * Text Domain: astra-sites
10
- *
11
- * @package Astra Sites
12
- */
13
-
14
- /**
15
- * Set constants.
16
- */
17
- if ( ! defined( 'ASTRA_SITES_NAME' ) ) {
18
- define( 'ASTRA_SITES_NAME', __( 'Astra Sites', 'astra-sites' ) );
19
- }
20
-
21
- if ( ! defined( 'ASTRA_SITES_VER' ) ) {
22
- define( 'ASTRA_SITES_VER', '1.2.15' );
23
- }
24
-
25
- if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
26
- define( 'ASTRA_SITES_FILE', __FILE__ );
27
- }
28
-
29
- if ( ! defined( 'ASTRA_SITES_BASE' ) ) {
30
- define( 'ASTRA_SITES_BASE', plugin_basename( ASTRA_SITES_FILE ) );
31
- }
32
-
33
- if ( ! defined( 'ASTRA_SITES_DIR' ) ) {
34
- define( 'ASTRA_SITES_DIR', plugin_dir_path( ASTRA_SITES_FILE ) );
35
- }
36
-
37
- if ( ! defined( 'ASTRA_SITES_URI' ) ) {
38
- define( 'ASTRA_SITES_URI', plugins_url( '/', ASTRA_SITES_FILE ) );
39
- }
40
-
41
- if ( ! function_exists( 'astra_sites_setup' ) ) :
42
-
43
- /**
44
- * Astra Sites Setup
45
- *
46
- * @since 1.0.5
47
- */
48
- function astra_sites_setup() {
49
- require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites.php';
50
- }
51
-
52
- add_action( 'plugins_loaded', 'astra_sites_setup' );
53
-
54
- endif;
1
+ <?php
2
+ /**
3
+ * Plugin Name: Astra Starter Sites – Elementor, Beaver Builder & Gutenberg Templates
4
+ * Plugin URI: http://www.wpastra.com/pro/
5
+ * Description: Import free sites build with Astra theme.
6
+ * Version: 1.3.0
7
+ * Author: Brainstorm Force
8
+ * Author URI: http://www.brainstormforce.com
9
+ * Text Domain: astra-sites
10
+ *
11
+ * @package Astra Sites
12
+ */
13
+
14
+ /**
15
+ * Set constants.
16
+ */
17
+ if ( ! defined( 'ASTRA_SITES_NAME' ) ) {
18
+ define( 'ASTRA_SITES_NAME', __( 'Astra Sites', 'astra-sites' ) );
19
+ }
20
+
21
+ if ( ! defined( 'ASTRA_SITES_VER' ) ) {
22
+ define( 'ASTRA_SITES_VER', '1.3.0' );
23
+ }
24
+
25
+ if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
26
+ define( 'ASTRA_SITES_FILE', __FILE__ );
27
+ }
28
+
29
+ if ( ! defined( 'ASTRA_SITES_BASE' ) ) {
30
+ define( 'ASTRA_SITES_BASE', plugin_basename( ASTRA_SITES_FILE ) );
31
+ }
32
+
33
+ if ( ! defined( 'ASTRA_SITES_DIR' ) ) {
34
+ define( 'ASTRA_SITES_DIR', plugin_dir_path( ASTRA_SITES_FILE ) );
35
+ }
36
+
37
+ if ( ! defined( 'ASTRA_SITES_URI' ) ) {
38
+ define( 'ASTRA_SITES_URI', plugins_url( '/', ASTRA_SITES_FILE ) );
39
+ }
40
+
41
+ if ( ! function_exists( 'astra_sites_setup' ) ) :
42
+
43
+ /**
44
+ * Astra Sites Setup
45
+ *
46
+ * @since 1.0.5
47
+ */
48
+ function astra_sites_setup() {
49
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites.php';
50
+ }
51
+
52
+ add_action( 'plugins_loaded', 'astra_sites_setup' );
53
+
54
+ endif;
inc/assets/css/admin.css CHANGED
@@ -1,476 +1,638 @@
1
- .wrap .status,
2
- .wrap .site-type {
3
- position: absolute;
4
- z-index: 1;
5
- color: #fff;
6
- padding: 0.5em 1em;
7
- top: -0.5em;
8
- text-transform: uppercase;
9
- }
10
- .wrap .status,
11
- .wrap .site-type.premium {
12
- background: #0073aa;
13
- }
14
- .wrap .status {
15
- left: -0.5em;
16
- }
17
- .wrap .site-type.premium {
18
- right: -0.5em;
19
- }
20
-
21
- .wrap .status.publish,
22
- .wrap .site-type.free {
23
- display: none;
24
- }
25
-
26
- .install-theme-info .site-type {
27
- display: none;
28
- }
29
-
30
- .theme {
31
- position: relative;
32
- }
33
- .wrap .astra-sites-preview .site-type.premium {
34
- display: block;
35
- display: none;
36
- position: relative;
37
- margin: 0.5em 0em 1em 0em;
38
- top: 0;
39
- left: 0;
40
- text-align: center;
41
- }
42
-
43
- .theme-details-read-more.open {
44
- margin: 0.5em 0 0 0;
45
- }
46
-
47
- .astra-sites-preview .theme-screenshot {
48
- width: 100%;
49
- }
50
-
51
- .install-theme-info .site-type.premium {
52
- display: none;
53
- }
54
-
55
- /**
56
- * Required Plugins
57
- */
58
- .required-plugins.loading {
59
- text-align: center;
60
- }
61
- .required-plugins button {
62
- float: right;
63
- }
64
- .required-plugins .plugin-card {
65
- float: none;
66
- width: 100%;
67
- border: none;
68
- margin: 0 0 0.8em 0;
69
- display: flex;
70
- justify-content: space-between;
71
- align-items: center;
72
- transition: background ease 0.8s;
73
- }
74
- .required-plugins .plugin-card.plugin-card-update-failed {
75
- flex-wrap: wrap;
76
- }
77
- .required-plugins .spinner {
78
- float: none;
79
- margin: 0;
80
- }
81
-
82
- .expanded .wp-full-overlay-footer {
83
- height: 111px;
84
- }
85
-
86
- .wp-full-overlay-footer .view-site,
87
- .wp-full-overlay-footer .go-pro,
88
- .wp-full-overlay-footer .astra-demo-import {
89
- width: 100%;
90
- text-align: center;
91
- }
92
-
93
- .wp-core-ui .wp-full-overlay-footer .button.button-hero,
94
- .wp-core-ui .wp-full-overlay-footer .button-group.button-hero .button {
95
- padding: 0 10px 1px;
96
- }
97
-
98
- .wp-full-overlay-footer .installing:before {
99
- vertical-align: text-bottom;
100
- }
101
-
102
- .required-plugins-wrap h4 {
103
- margin: 1em 0 0.5em 0;
104
- padding: 0.5em 0;
105
- transition: all ease 0.3s;
106
- }
107
-
108
- /**
109
- * Read more link
110
- */
111
- .wp-core-ui .theme-details-read-more:focus,
112
- .wp-core-ui .theme-details-read-more:hover {
113
- outline: none;
114
- box-shadow: none;
115
- }
116
- .wp-core-ui .theme-details-read-more {
117
- margin: 10px 0;
118
- display: none;
119
- text-decoration: none;
120
- }
121
-
122
- /**
123
- * Go pro.
124
- */
125
- .wp-core-ui .go-pro.button[disabled] {
126
- background-color: #fcb92c !important;
127
- color: white !important;
128
- box-shadow: 1px 0 #eab23a !important;
129
- text-shadow: 1px 0 #6b4e13 !important;
130
- border-color: #e2a932 !important;
131
- cursor: pointer;
132
- }
133
- .wp-core-ui .view-site .dashicons,
134
- .wp-core-ui .go-pro .dashicons {
135
- font-size: 1rem;
136
- vertical-align: middle;
137
- }
138
-
139
- /**
140
- * Errors
141
- */
142
- .plugin-card-update-failed .notice {
143
- margin-top: 1.5em;
144
- }
145
-
146
- .no-themes {
147
- margin-top: 40px;
148
- }
149
-
150
- .no-themes p {
151
- font-size: 15px;
152
- }
153
-
154
- .no-themes .left-margin {
155
- margin-left: 30px;
156
- }
157
-
158
- /**
159
- *
160
- */
161
- .astra-sites-preview .wp-full-overlay-sidebar-content {
162
- bottom: 100px;
163
- }
164
-
165
- .footer-import-button-wrap {
166
- padding: 10px 20px;
167
- }
168
-
169
- .footer-import-button-wrap .button {
170
- margin: 0;
171
- }
172
-
173
- .astra-sites-preview.expanded .wp-full-overlay-footer {
174
- left: initial;
175
- }
176
-
177
- /**
178
- * Menu Page
179
- */
180
- .astra-sites-title {
181
- float: left;
182
- font-size: 23px;
183
- font-weight: 400;
184
- margin: 0 0 6px 0px;
185
- padding: 0;
186
- line-height: 29px;
187
- }
188
-
189
- #astra-sites-menu-page {
190
- margin-top: 10px;
191
- }
192
-
193
- /**
194
- * API Error
195
- */
196
- .astra-api-error {
197
- margin: 0 0 0.5em 0;
198
- }
199
-
200
- /**
201
- * Grid
202
- */
203
- .wp-filter .search-form {
204
- margin-left: 1em;
205
- }
206
- .wp-filter .search-form input[type="search"] {
207
- width: 200px;
208
- font-size: 13px;
209
- padding: 5px 10px;
210
- }
211
- .section-left {
212
- display: inline-block;
213
- }
214
- .section-right {
215
- float: right;
216
- }
217
- .filter-count {
218
- min-width: 3em;
219
- }
220
- .astra-site-preview-on {
221
- overflow: hidden;
222
- }
223
-
224
- .appearance_page_astra-sites .notice {
225
- margin-left: 0;
226
- width: auto;
227
- float: none;
228
- }
229
- .filters-wrap {
230
- display: inline-block;
231
- }
232
- .spinner-wrap {
233
- text-align: center;
234
- }
235
- .spinner-wrap .spinner {
236
- float: none;
237
- }
238
- .hide-me {
239
- display: none !important;
240
- }
241
- #astra-sites-admin {
242
- height: 100vh;
243
- }
244
- .install-theme-info > .notice {
245
- margin: 5px 0 10px 0;
246
- }
247
-
248
- .astra-sites-suggestions:before {
249
- border: 5px dashed #ccc;
250
- position: absolute;
251
- left: 0;
252
- right: 0;
253
- top: 0;
254
- bottom: 0px;
255
- }
256
-
257
- .astra-sites-suggestions {
258
- min-height: 280px;
259
- border: none !important;
260
- }
261
-
262
- .astra-sites-suggestions a {
263
- border: none;
264
- outline: none;
265
- }
266
-
267
- .astra-sites-suggestions .inner {
268
- border: 6px solid #24282e !important;
269
- padding: 27% 10% 50% 10%;
270
- text-align: center;
271
- position: absolute;
272
- left: 0;
273
- right: 0;
274
- top: 0;
275
- background: #33383d;
276
- bottom: 0;
277
- color: #eee;
278
- cursor: auto;
279
- }
280
-
281
- .astra-sites-suggestions .inner a {
282
- color: #00b9eb;
283
- }
284
-
285
- .astra-sites-suggestions p {
286
- font-size: 1rem;
287
- margin: 0;
288
- }
289
-
290
- .astra-notice {
291
- margin: 2em 2em 0em 0em;
292
- }
293
-
294
- .no-themes .description {
295
- display: block;
296
- }
297
-
298
- /**
299
- * Responsive Button UI
300
- */
301
- .astra-sites-preview .wp-full-overlay-footer .devices button.active:before,
302
- .astra-sites-preview .wp-full-overlay-footer .devices button:hover:before {
303
- color: #0073aa;
304
- }
305
- .astra-sites-preview .wp-full-overlay-footer .devices button:before {
306
- color: #c1c1c1;
307
- }
308
- .astra-sites-preview .wp-full-overlay-footer .devices button:hover {
309
- background-color: transparent;
310
- }
311
- .astra-sites-preview .wp-full-overlay-footer .devices button {
312
- border: none;
313
- }
314
- .astra-sites-preview .wp-full-overlay-footer .devices button:focus,
315
- .astra-sites-preview .wp-full-overlay-footer .devices button.active:hover {
316
- border-bottom-color: transparent;
317
- background-color: transparent;
318
- }
319
- .not-click-able {
320
- pointer-events: none !important;
321
- }
322
- body.page-builder-selected .select-page-builder,
323
- body.loading-content .select-page-builder {
324
- display: none;
325
- }
326
- .select-page-builder .up-arrow {
327
- -webkit-transform: rotate(90deg);
328
- -moz-transform: rotate(90deg);
329
- -ms-transform: rotate(90deg);
330
- transform: rotate(90deg);
331
- display: inline-block;
332
- font-size: 1.5em;
333
- color: #797979;
334
- vertical-align: middle;
335
- margin-right: 10px;
336
- -webkit-transition: all linear 0.6s;
337
- -moz-transition: all linear 0.6s;
338
- -ms-transition: all linear 0.6s;
339
- transition: all linear 0.6s;
340
- -webkit-animation-duration: 1s;
341
- animation-duration: 1s;
342
- -webkit-animation-fill-mode: both;
343
- animation-fill-mode: both;
344
- -webkit-animation-timing-function: ease-in-out;
345
- animation-timing-function: ease-in-out;
346
- animation-iteration-count: infinite;
347
- -webkit-animation-iteration-count: infinite;
348
- animation-name: bounce;
349
- -moz-animation-name: bounce;
350
- }
351
- .select-page-builder {
352
- margin-left: 6em;
353
- }
354
-
355
- .select-page-builder img {
356
- max-width: 100%;
357
- }
358
-
359
- .select-page-builder .note-wrap {
360
- position: absolute;
361
- padding: 40px 0;
362
- margin-left: 170px;
363
- right: 0;
364
- left: 0;
365
- }
366
-
367
- .select-page-builder h3 {
368
- margin: 0;
369
- font-size: 2em;
370
- }
371
- .select-page-builder {
372
- margin: -20px 0 0 -5px;
373
- position: absolute;
374
- }
375
- .select-page-builder .note {
376
- margin-left: 1.5em;
377
- }
378
-
379
- @keyframes bounce {
380
- 0%,
381
- 100%,
382
- 20%,
383
- 50%,
384
- 80% {
385
- -webkit-transform: translateY(-0px) rotate(90deg);
386
- -moz-transform: translateY(-0px) rotate(90deg);
387
- -ms-transform: translateY(-0px) rotate(90deg);
388
- transform: translateY(-0px) rotate(90deg);
389
- }
390
- 40% {
391
- -webkit-transform: translateY(-2px) rotate(90deg);
392
- -moz-transform: translateY(-2px) rotate(90deg);
393
- -ms-transform: translateY(-2px) rotate(90deg);
394
- transform: translateY(-2px) rotate(90deg);
395
- }
396
- 60% {
397
- -webkit-transform: translateY(-1px) rotate(90deg);
398
- -moz-transform: translateY(-1px) rotate(90deg);
399
- -ms-transform: translateY(-1px) rotate(90deg);
400
- transform: translateY(-1px) rotate(90deg);
401
- }
402
- }
403
-
404
- /**
405
- * Processing Animation
406
- */
407
- .astra-demo-import.disabled {
408
- pointer-events: none;
409
- }
410
- .astra-demo-import.button.updating-message:before,
411
- .astra-demo-import.button.installing:before {
412
- -webkit-animation: cssAnimation .72s ease infinite;
413
- -moz-animation: cssAnimation .72s ease infinite;
414
- -o-animation: cssAnimation .72s ease infinite;
415
- -ms-animation: cssAnimation .72s ease infinite;
416
- animation: cssAnimation .72s ease infinite;
417
- }
418
-
419
- @-webkit-keyframes cssAnimation {
420
- from {
421
- -webkit-transform: rotate(0);
422
- -moz-transform: rotate(0);
423
- -o-transform: rotate(0);
424
- -ms-transform: rotate(0);
425
- transform: rotate(0);
426
- }
427
- to {
428
- -webkit-transform: rotate(360deg);
429
- -moz-transform: rotate(360deg);
430
- -o-transform: rotate(360deg);
431
- -ms-transform: rotate(360deg);
432
- transform: rotate(360deg);
433
- }
434
- }
435
- @-moz-keyframes cssAnimation {
436
- from {
437
- -webkit-transform: rotate(0);
438
- -moz-transform: rotate(0);
439
- -o-transform: rotate(0);
440
- -ms-transform: rotate(0);
441
- transform: rotate(0);
442
- }
443
- to {
444
- -webkit-transform: rotate(360deg);
445
- -moz-transform: rotate(360deg);
446
- -o-transform: rotate(360deg);
447
- -ms-transform: rotate(360deg);
448
- transform: rotate(360deg);
449
- }
450
- }
451
- @-o-keyframes cssAnimation {
452
- from {
453
- -webkit-transform: rotate(0);
454
- -moz-transform: rotate(0);
455
- -o-transform: rotate(0);
456
- -ms-transform: rotate(0);
457
- transform: rotate(0);
458
- }
459
- to {
460
- -webkit-transform: rotate(360deg);
461
- -moz-transform: rotate(360deg);
462
- -o-transform: rotate(360deg);
463
- -ms-transform: rotate(360deg);
464
- transform: rotate(360deg);
465
- }
466
- }
467
-
468
- #astra-sites-filters {
469
- display: inline-block;
470
- width: 100%;
471
- }
472
-
473
- .astra-site-down {
474
- padding: 1em 2em;
475
- margin-top: 1em;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476
  }
1
+ .wrap .status,
2
+ .wrap .site-type {
3
+ position: absolute;
4
+ z-index: 1;
5
+ color: #fff;
6
+ padding: 0.5em 1em;
7
+ top: -0.5em;
8
+ text-transform: uppercase;
9
+ }
10
+ .wrap .status,
11
+ .wrap .site-type.premium {
12
+ background: #0073aa;
13
+ }
14
+ .wrap .status {
15
+ left: -0.5em;
16
+ }
17
+ .wrap .site-type.premium {
18
+ right: -0.5em;
19
+ }
20
+
21
+ .wrap .status.publish,
22
+ .wrap .site-type.free {
23
+ display: none;
24
+ }
25
+
26
+ .install-theme-info .site-type {
27
+ display: none;
28
+ }
29
+
30
+ .theme {
31
+ position: relative;
32
+ }
33
+ .wrap .astra-sites-preview .site-type.premium {
34
+ display: block;
35
+ display: none;
36
+ position: relative;
37
+ margin: 0.5em 0em 1em 0em;
38
+ top: 0;
39
+ left: 0;
40
+ text-align: center;
41
+ }
42
+
43
+ .theme-details-read-more.open {
44
+ margin: 0.5em 0 0 0;
45
+ }
46
+
47
+ .astra-sites-preview .theme-screenshot {
48
+ width: 100%;
49
+ }
50
+
51
+ .install-theme-info .site-type.premium {
52
+ display: none;
53
+ }
54
+
55
+ /**
56
+ * Required Plugins
57
+ */
58
+ .required-plugins.loading {
59
+ text-align: center;
60
+ }
61
+ .required-plugins button {
62
+ float: right;
63
+ }
64
+ .required-plugins .plugin-card {
65
+ float: none;
66
+ width: 100%;
67
+ border: none;
68
+ margin: 0 0 0.8em 0;
69
+ display: flex;
70
+ justify-content: space-between;
71
+ align-items: center;
72
+ transition: background ease 0.8s;
73
+ }
74
+ .required-plugins .plugin-card.plugin-card-update-failed {
75
+ flex-wrap: wrap;
76
+ }
77
+ .required-plugins .spinner {
78
+ float: none;
79
+ margin: 0;
80
+ }
81
+
82
+ .expanded .wp-full-overlay-footer {
83
+ height: 111px;
84
+ }
85
+
86
+ .wp-full-overlay-footer .view-site,
87
+ .wp-full-overlay-footer .go-pro,
88
+ .wp-full-overlay-footer .astra-demo-import {
89
+ width: 100%;
90
+ text-align: center;
91
+ }
92
+
93
+ .wp-core-ui .wp-full-overlay-footer .button.button-hero,
94
+ .wp-core-ui .wp-full-overlay-footer .button-group.button-hero .button {
95
+ padding: 0 10px 1px;
96
+ }
97
+
98
+ .wp-full-overlay-footer .installing:before {
99
+ vertical-align: text-bottom;
100
+ }
101
+
102
+ .astra-sites-advanced-options-wrap h4 {
103
+ margin: 1em 0 0.5em 0;
104
+ padding: 0.5em 0;
105
+ transition: all ease 0.3s;
106
+ }
107
+
108
+ /**
109
+ * Read more link
110
+ */
111
+ .wp-core-ui .theme-details-read-more:focus,
112
+ .wp-core-ui .theme-details-read-more:hover {
113
+ outline: none;
114
+ box-shadow: none;
115
+ }
116
+ .wp-core-ui .theme-details-read-more {
117
+ margin: 10px 0;
118
+ display: none;
119
+ text-decoration: none;
120
+ }
121
+
122
+ /**
123
+ * Go pro.
124
+ */
125
+ .wp-core-ui .go-pro.button[disabled] {
126
+ background-color: #fcb92c !important;
127
+ color: white !important;
128
+ box-shadow: 1px 0 #eab23a !important;
129
+ text-shadow: 1px 0 #6b4e13 !important;
130
+ border-color: #e2a932 !important;
131
+ cursor: pointer;
132
+ }
133
+ .wp-core-ui .view-site .dashicons,
134
+ .wp-core-ui .go-pro .dashicons {
135
+ font-size: 1rem;
136
+ vertical-align: middle;
137
+ }
138
+
139
+ /**
140
+ * Errors
141
+ */
142
+ .plugin-card-update-failed .notice {
143
+ margin-top: 1.5em;
144
+ }
145
+
146
+ .no-themes {
147
+ margin-top: 40px;
148
+ }
149
+
150
+ .no-themes p {
151
+ font-size: 15px;
152
+ }
153
+
154
+ .no-themes .left-margin {
155
+ margin-left: 30px;
156
+ }
157
+
158
+ /**
159
+ *
160
+ */
161
+ .astra-sites-preview .wp-full-overlay-sidebar-content {
162
+ bottom: 100px;
163
+ }
164
+
165
+ .footer-import-button-wrap {
166
+ padding: 10px 20px;
167
+ }
168
+
169
+ .footer-import-button-wrap .button {
170
+ margin: 0;
171
+ }
172
+
173
+ .astra-sites-preview.expanded .wp-full-overlay-footer {
174
+ left: initial;
175
+ }
176
+
177
+ /**
178
+ * Menu Page
179
+ */
180
+ .astra-sites-title {
181
+ float: left;
182
+ font-size: 23px;
183
+ font-weight: 400;
184
+ margin: 0 0 6px 0px;
185
+ padding: 0;
186
+ line-height: 29px;
187
+ }
188
+
189
+ #astra-sites-menu-page {
190
+ margin-top: 10px;
191
+ }
192
+
193
+ /**
194
+ * API Error
195
+ */
196
+ .astra-api-error {
197
+ margin: 0 0 0.5em 0;
198
+ }
199
+
200
+ /**
201
+ * Grid
202
+ */
203
+ .wp-filter .search-form {
204
+ margin-left: 1em;
205
+ }
206
+ .wp-filter .search-form input[type="search"] {
207
+ width: 200px;
208
+ font-size: 13px;
209
+ padding: 5px 10px;
210
+ }
211
+ .section-left {
212
+ display: inline-block;
213
+ }
214
+ .section-right {
215
+ float: right;
216
+ }
217
+ .filter-count {
218
+ min-width: 3em;
219
+ }
220
+ .astra-site-preview-on {
221
+ overflow: hidden;
222
+ }
223
+
224
+ .appearance_page_astra-sites .notice {
225
+ margin-left: 0;
226
+ width: auto;
227
+ float: none;
228
+ }
229
+ .filters-wrap {
230
+ display: inline-block;
231
+ }
232
+ .spinner-wrap {
233
+ text-align: center;
234
+ }
235
+ .spinner-wrap .spinner {
236
+ float: none;
237
+ }
238
+ .hide-me {
239
+ display: none !important;
240
+ }
241
+ #astra-sites-admin {
242
+ height: 100vh;
243
+ }
244
+ .install-theme-info > .notice {
245
+ margin: 5px 0 10px 0;
246
+ }
247
+
248
+ .astra-sites-suggestions:before {
249
+ border: 5px dashed #ccc;
250
+ position: absolute;
251
+ left: 0;
252
+ right: 0;
253
+ top: 0;
254
+ bottom: 0px;
255
+ }
256
+
257
+ .astra-sites-suggestions {
258
+ min-height: 280px;
259
+ border: none !important;
260
+ }
261
+
262
+ .astra-sites-suggestions a {
263
+ border: none;
264
+ outline: none;
265
+ }
266
+
267
+ .astra-sites-suggestions .inner {
268
+ border: 6px solid #24282e !important;
269
+ padding: 27% 10% 50% 10%;
270
+ text-align: center;
271
+ position: absolute;
272
+ left: 0;
273
+ right: 0;
274
+ top: 0;
275
+ background: #33383d;
276
+ bottom: 0;
277
+ color: #eee;
278
+ cursor: auto;
279
+ }
280
+
281
+ .astra-sites-suggestions .inner a {
282
+ color: #00b9eb;
283
+ }
284
+
285
+ .astra-sites-suggestions p {
286
+ font-size: 1rem;
287
+ margin: 0;
288
+ }
289
+
290
+ .astra-notice {
291
+ margin: 2em 2em 0em 0em;
292
+ }
293
+
294
+ .no-themes .description {
295
+ display: block;
296
+ }
297
+
298
+ /**
299
+ * Responsive Button UI
300
+ */
301
+ .astra-sites-preview .wp-full-overlay-footer .devices button.active:before,
302
+ .astra-sites-preview .wp-full-overlay-footer .devices button:hover:before {
303
+ color: #0073aa;
304
+ }
305
+ .astra-sites-preview .wp-full-overlay-footer .devices button:before {
306
+ color: #c1c1c1;
307
+ }
308
+ .astra-sites-preview .wp-full-overlay-footer .devices button:hover {
309
+ background-color: transparent;
310
+ }
311
+ .astra-sites-preview .wp-full-overlay-footer .devices button {
312
+ border: none;
313
+ }
314
+ .astra-sites-preview .wp-full-overlay-footer .devices button:focus,
315
+ .astra-sites-preview .wp-full-overlay-footer .devices button.active:hover {
316
+ border-bottom-color: transparent;
317
+ background-color: transparent;
318
+ }
319
+ .not-click-able {
320
+ pointer-events: none !important;
321
+ }
322
+ body.page-builder-selected .select-page-builder,
323
+ body.loading-content .select-page-builder {
324
+ display: none;
325
+ }
326
+ .select-page-builder .up-arrow {
327
+ -webkit-transform: rotate(90deg);
328
+ -moz-transform: rotate(90deg);
329
+ -ms-transform: rotate(90deg);
330
+ transform: rotate(90deg);
331
+ display: inline-block;
332
+ font-size: 1.5em;
333
+ color: #797979;
334
+ vertical-align: middle;
335
+ margin-right: 10px;
336
+ -webkit-transition: all linear 0.6s;
337
+ -moz-transition: all linear 0.6s;
338
+ -ms-transition: all linear 0.6s;
339
+ transition: all linear 0.6s;
340
+ -webkit-animation-duration: 1s;
341
+ animation-duration: 1s;
342
+ -webkit-animation-fill-mode: both;
343
+ animation-fill-mode: both;
344
+ -webkit-animation-timing-function: ease-in-out;
345
+ animation-timing-function: ease-in-out;
346
+ animation-iteration-count: infinite;
347
+ -webkit-animation-iteration-count: infinite;
348
+ animation-name: bounce;
349
+ -moz-animation-name: bounce;
350
+ }
351
+ .select-page-builder {
352
+ margin-left: 6em;
353
+ }
354
+
355
+ .select-page-builder img {
356
+ max-width: 100%;
357
+ }
358
+
359
+ .select-page-builder .note-wrap {
360
+ position: absolute;
361
+ padding: 40px 0;
362
+ margin-left: 170px;
363
+ right: 0;
364
+ left: 0;
365
+ }
366
+
367
+ .select-page-builder h3 {
368
+ margin: 0;
369
+ font-size: 2em;
370
+ }
371
+ .select-page-builder {
372
+ margin: -20px 0 0 -5px;
373
+ position: absolute;
374
+ }
375
+ .select-page-builder .note {
376
+ margin-left: 1.5em;
377
+ }
378
+
379
+ @keyframes bounce {
380
+ 0%,
381
+ 100%,
382
+ 20%,
383
+ 50%,
384
+ 80% {
385
+ -webkit-transform: translateY(-0px) rotate(90deg);
386
+ -moz-transform: translateY(-0px) rotate(90deg);
387
+ -ms-transform: translateY(-0px) rotate(90deg);
388
+ transform: translateY(-0px) rotate(90deg);
389
+ }
390
+ 40% {
391
+ -webkit-transform: translateY(-2px) rotate(90deg);
392
+ -moz-transform: translateY(-2px) rotate(90deg);
393
+ -ms-transform: translateY(-2px) rotate(90deg);
394
+ transform: translateY(-2px) rotate(90deg);
395
+ }
396
+ 60% {
397
+ -webkit-transform: translateY(-1px) rotate(90deg);
398
+ -moz-transform: translateY(-1px) rotate(90deg);
399
+ -ms-transform: translateY(-1px) rotate(90deg);
400
+ transform: translateY(-1px) rotate(90deg);
401
+ }
402
+ }
403
+
404
+ /**
405
+ * Processing Animation
406
+ */
407
+ .astra-demo-import.disabled {
408
+ pointer-events: none;
409
+ }
410
+ .astra-demo-import.button.updating-message:before,
411
+ .astra-demo-import.button.installing:before {
412
+ -webkit-animation: cssAnimation .72s ease infinite;
413
+ -moz-animation: cssAnimation .72s ease infinite;
414
+ -o-animation: cssAnimation .72s ease infinite;
415
+ -ms-animation: cssAnimation .72s ease infinite;
416
+ animation: cssAnimation .72s ease infinite;
417
+ }
418
+
419
+ @-webkit-keyframes cssAnimation {
420
+ from {
421
+ -webkit-transform: rotate(0);
422
+ -moz-transform: rotate(0);
423
+ -o-transform: rotate(0);
424
+ -ms-transform: rotate(0);
425
+ transform: rotate(0);
426
+ }
427
+ to {
428
+ -webkit-transform: rotate(360deg);
429
+ -moz-transform: rotate(360deg);
430
+ -o-transform: rotate(360deg);
431
+ -ms-transform: rotate(360deg);
432
+ transform: rotate(360deg);
433
+ }
434
+ }
435
+ @-moz-keyframes cssAnimation {
436
+ from {
437
+ -webkit-transform: rotate(0);
438
+ -moz-transform: rotate(0);
439
+ -o-transform: rotate(0);
440
+ -ms-transform: rotate(0);
441
+ transform: rotate(0);
442
+ }
443
+ to {
444
+ -webkit-transform: rotate(360deg);
445
+ -moz-transform: rotate(360deg);
446
+ -o-transform: rotate(360deg);
447
+ -ms-transform: rotate(360deg);
448
+ transform: rotate(360deg);
449
+ }
450
+ }
451
+ @-o-keyframes cssAnimation {
452
+ from {
453
+ -webkit-transform: rotate(0);
454
+ -moz-transform: rotate(0);
455
+ -o-transform: rotate(0);
456
+ -ms-transform: rotate(0);
457
+ transform: rotate(0);
458
+ }
459
+ to {
460
+ -webkit-transform: rotate(360deg);
461
+ -moz-transform: rotate(360deg);
462
+ -o-transform: rotate(360deg);
463
+ -ms-transform: rotate(360deg);
464
+ transform: rotate(360deg);
465
+ }
466
+ }
467
+
468
+ #astra-sites-filters {
469
+ display: inline-block;
470
+ width: 100%;
471
+ }
472
+
473
+ .astra-site-down {
474
+ padding: 1em 2em;
475
+ margin-top: 1em;
476
+ }
477
+
478
+ #astra-sites-menu-page .nav-tab-wrapper {
479
+ border: none;
480
+ }
481
+
482
+ #astra-sites-filters .wp-filter {
483
+ margin-top: 0;
484
+ }
485
+
486
+ /**
487
+ * Welcome Screen
488
+ */
489
+ .astra-sites-welcome {
490
+ padding: 10em 0;
491
+ text-align: center;
492
+ }
493
+ .astra-sites-welcome .inner {
494
+ margin: 0 auto;
495
+ display: inline-block;
496
+ max-width: 700px;
497
+ background: #fff;
498
+ padding: 3em;
499
+ }
500
+
501
+ .astra-sites-welcome h1 {
502
+ font-size: 2.5em;
503
+ margin-bottom: 1em;
504
+ }
505
+
506
+ .astra-sites-welcome p.description {
507
+ font-size: 1rem;
508
+ margin-bottom: 2em;
509
+ }
510
+
511
+ .astra-sites-welcome select {
512
+ padding: 5px;
513
+ height: 100%;
514
+ }
515
+
516
+ .astra-sites-welcome p.submit {
517
+ text-align: center;
518
+ margin: 0;
519
+ padding: 0;
520
+ margin-left: .5em;
521
+ }
522
+
523
+ .astra-sites-welcome .fields {
524
+ display: flex;
525
+ vertical-align: middle;
526
+ align-items: center;
527
+ justify-content: center;
528
+ }
529
+
530
+ .astra-sites-welcome #submit {
531
+ line-height: 1;
532
+ padding: .5rem 1rem;
533
+ height: auto;
534
+ }
535
+
536
+ .astra-site-page-builder {
537
+ opacity: 0;
538
+ visibility: hidden;
539
+ }
540
+
541
+ .required-plugins-list {
542
+ margin-left: 2em;
543
+ margin-top: .5em;
544
+ margin-bottom: .5em;
545
+ list-style-type: disc;
546
+ }
547
+
548
+ .required-plugins-list .plugin-card {
549
+ background: transparent;
550
+ border: none;
551
+ margin: 0;
552
+ line-height: 2;
553
+ float: none;
554
+ width: 100%;
555
+ }
556
+
557
+ .required-plugins-list .spinner {
558
+ float: none;
559
+ margin: 0;
560
+ }
561
+
562
+ #astra-site-import-process-wrap {
563
+ display: flex;
564
+ align-items: center;
565
+ margin-top: -2px;
566
+ z-index: 999999;
567
+ position: relative;
568
+ border-radius: 3px;
569
+ overflow: hidden;
570
+ }
571
+ #astra-site-import-process-wrap progress {
572
+ padding: 0px;
573
+ border: 0 none;
574
+ background: #0085bd;
575
+ border-radius: 5px;
576
+ height: 4px;
577
+ flex: 1;
578
+ }
579
+
580
+ #astra-site-import-process-wrap progress::-webkit-progress-value {
581
+ background: #00679b;
582
+ }
583
+ #astra-site-import-process-wrap progress::-webkit-progress-bar {
584
+ background: transparent;
585
+ }
586
+
587
+ .theme-browser .theme .site-preview > .theme-screenshot {
588
+ transition: all linear .7s;
589
+ background-position: center top;
590
+ background-size: cover;
591
+ background-repeat: no-repeat;
592
+ }
593
+ .theme-browser .theme .site-preview > .theme-screenshot:hover {
594
+ background-position: center bottom;
595
+ background-size: cover;
596
+ }
597
+
598
+ .astra-sites-tooltip-icon {
599
+ cursor: pointer;
600
+ }
601
+
602
+ .astra-sites-tooltip-icon .dashicons {
603
+ color: #5d5d5d;
604
+ font-size: 18px;
605
+ }
606
+
607
+ #astra-sites-welcome-form-inline {
608
+ position: absolute;
609
+ right: 1em;
610
+ top: 0;
611
+ border-radius: 0;
612
+ line-height: 1.7;
613
+ padding: 0px 5px 2px 5px;
614
+ outline: 2px solid transparent;
615
+ outline-offset: 0;
616
+ background: #fafafa;
617
+ border: 1px solid #ccc;
618
+ color: #72777c;
619
+ font-weight: normal;
620
+ font-size: 10px;
621
+ font-size: 13px;
622
+ line-height: 26px;
623
+ height: 28px;
624
+ cursor: pointer;
625
+ }
626
+
627
+ #astra-sites-welcome-form-inline select,
628
+ #astra-sites-welcome-form-inline select:focus {
629
+ border: none;
630
+ outline: none;
631
+ box-shadow: none;
632
+ color: #72777c;
633
+ }
634
+
635
+ #astra-sites-menu-page .wp-full-overlay-main:before {
636
+ content: '';
637
+ display: none;
638
  }
inc/assets/js/admin-page.js CHANGED
@@ -1,1439 +1,1815 @@
1
- /**
2
- * AJAX Request Queue
3
- *
4
- * - add()
5
- * - remove()
6
- * - run()
7
- * - stop()
8
- *
9
- * @since 1.0.0
10
- */
11
- var AstraSitesAjaxQueue = (function() {
12
-
13
- var requests = [];
14
-
15
- return {
16
-
17
- /**
18
- * Add AJAX request
19
- *
20
- * @since 1.0.0
21
- */
22
- add: function(opt) {
23
- requests.push(opt);
24
- },
25
-
26
- /**
27
- * Remove AJAX request
28
- *
29
- * @since 1.0.0
30
- */
31
- remove: function(opt) {
32
- if( jQuery.inArray(opt, requests) > -1 )
33
- requests.splice($.inArray(opt, requests), 1);
34
- },
35
-
36
- /**
37
- * Run / Process AJAX request
38
- *
39
- * @since 1.0.0
40
- */
41
- run: function() {
42
- var self = this,
43
- oriSuc;
44
-
45
- if( requests.length ) {
46
- oriSuc = requests[0].complete;
47
-
48
- requests[0].complete = function() {
49
- if( typeof(oriSuc) === 'function' ) oriSuc();
50
- requests.shift();
51
- self.run.apply(self, []);
52
- };
53
-
54
- jQuery.ajax(requests[0]);
55
-
56
- } else {
57
-
58
- self.tid = setTimeout(function() {
59
- self.run.apply(self, []);
60
- }, 1000);
61
- }
62
- },
63
-
64
- /**
65
- * Stop AJAX request
66
- *
67
- * @since 1.0.0
68
- */
69
- stop: function() {
70
-
71
- requests = [];
72
- clearTimeout(this.tid);
73
- }
74
- };
75
-
76
- }());
77
-
78
- (function($){
79
-
80
- var AstraSSEImport = {
81
- complete: {
82
- posts: 0,
83
- media: 0,
84
- users: 0,
85
- comments: 0,
86
- terms: 0,
87
- },
88
-
89
- updateDelta: function (type, delta) {
90
- this.complete[ type ] += delta;
91
-
92
- var self = this;
93
- requestAnimationFrame(function () {
94
- self.render();
95
- });
96
- },
97
- updateProgress: function ( type, complete, total ) {
98
- var text = complete + '/' + total;
99
-
100
- if( 'undefined' !== type && 'undefined' !== text ) {
101
- total = parseInt( total, 10 );
102
- if ( 0 === total || isNaN( total ) ) {
103
- total = 1;
104
- }
105
- var percent = parseInt( complete, 10 ) / total;
106
- var progress = Math.round( percent * 100 ) + '%';
107
- var progress_bar = percent * 100;
108
- }
109
- },
110
- render: function () {
111
- var types = Object.keys( this.complete );
112
- var complete = 0;
113
- var total = 0;
114
-
115
- for (var i = types.length - 1; i >= 0; i--) {
116
- var type = types[i];
117
- this.updateProgress( type, this.complete[ type ], this.data.count[ type ] );
118
-
119
- complete += this.complete[ type ];
120
- total += this.data.count[ type ];
121
- }
122
-
123
- this.updateProgress( 'total', complete, total );
124
- }
125
- };
126
-
127
- AstraSitesAdmin = {
128
-
129
- log_file : '',
130
- customizer_data : '',
131
- wxr_url : '',
132
- wpforms_url : '',
133
- options_data : '',
134
- widgets_data : '',
135
-
136
- init: function()
137
- {
138
- this._resetPagedCount();
139
- this._bind();
140
- },
141
-
142
- /**
143
- * Debugging.
144
- *
145
- * @param {mixed} data Mixed data.
146
- */
147
- _log: function( data ) {
148
-
149
- if( astraSitesAdmin.debug ) {
150
-
151
- var date = new Date();
152
- var time = date.toLocaleTimeString();
153
-
154
- if (typeof data == 'object') {
155
- console.log('%c ' + JSON.stringify( data ) + ' ' + time, 'background: #ededed; color: #444');
156
- } else {
157
- console.log('%c ' + data + ' ' + time, 'background: #ededed; color: #444');
158
- }
159
-
160
-
161
- }
162
- },
163
-
164
- /**
165
- * Binds events for the Astra Sites.
166
- *
167
- * @since 1.0.0
168
- * @access private
169
- * @method _bind
170
- */
171
- _bind: function()
172
- {
173
- $( document ).on('click' , '.devices button', AstraSitesAdmin._previewDevice);
174
- $( document ).on('click' , '.theme-browser .theme-screenshot, .theme-browser .more-details, .theme-browser .install-theme-preview', AstraSitesAdmin._preview);
175
- $( document ).on('click' , '.next-theme', AstraSitesAdmin._nextTheme);
176
- $( document ).on('click' , '.previous-theme', AstraSitesAdmin._previousTheme);
177
- $( document ).on('click' , '.collapse-sidebar', AstraSitesAdmin._collapse);
178
- $( document ).on('click' , '.astra-demo-import', AstraSitesAdmin._importDemo);
179
- $( document ).on('click' , '.install-now', AstraSitesAdmin._installNow);
180
- $( document ).on('click' , '.close-full-overlay', AstraSitesAdmin._fullOverlay);
181
- $( document ).on('click' , '.activate-now', AstraSitesAdmin._activateNow);
182
- $( document ).on('wp-plugin-installing' , AstraSitesAdmin._pluginInstalling);
183
- $( document ).on('wp-plugin-install-error' , AstraSitesAdmin._installError);
184
- $( document ).on('wp-plugin-install-success' , AstraSitesAdmin._installSuccess);
185
-
186
- $( document ).on('astra-sites-import-set-site-data-done' , AstraSitesAdmin._importWPForms );
187
- $( document ).on('astra-sites-import-wpforms-done' , AstraSitesAdmin._importCustomizerSettings );
188
- $( document ).on('astra-sites-import-customizer-settings-done' , AstraSitesAdmin._importPrepareXML );
189
- $( document ).on('astra-sites-import-xml-done' , AstraSitesAdmin._importSiteOptions );
190
- $( document ).on('astra-sites-import-options-done' , AstraSitesAdmin._importWidgets );
191
- $( document ).on('astra-sites-import-widgets-done' , AstraSitesAdmin._importEnd );
192
- },
193
-
194
- /**
195
- * 5. Import Complete.
196
- */
197
- _importEnd: function( event ) {
198
-
199
- $.ajax({
200
- url : astraSitesAdmin.ajaxurl,
201
- type : 'POST',
202
- dataType: 'json',
203
- data : {
204
- action : 'astra-sites-import-end',
205
- },
206
- beforeSend: function() {
207
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importComplete );
208
- }
209
- })
210
- .fail(function( jqXHR ){
211
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
212
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
213
- })
214
- .done(function ( data ) {
215
-
216
- // 5. Fail - Import Complete.
217
- if( false === data.success ) {
218
- AstraSitesAdmin._importFailMessage( data.data );
219
- AstraSitesAdmin._log( data.data );
220
- } else {
221
-
222
- $('body').removeClass('importing-site');
223
- $('.previous-theme, .next-theme').removeClass('disabled');
224
-
225
- // 5. Pass - Import Complete.
226
- AstraSitesAdmin._importSuccessMessage();
227
- AstraSitesAdmin._log( astraSitesAdmin.log.success + ' ' + astraSitesAdmin.siteURL );
228
- }
229
- });
230
- },
231
-
232
- /**
233
- * 4. Import Widgets.
234
- */
235
- _importWidgets: function( event ) {
236
-
237
- $.ajax({
238
- url : astraSitesAdmin.ajaxurl,
239
- type : 'POST',
240
- dataType: 'json',
241
- data : {
242
- action : 'astra-sites-import-widgets',
243
- widgets_data : AstraSitesAdmin.widgets_data,
244
- },
245
- beforeSend: function() {
246
- AstraSitesAdmin._log( astraSitesAdmin.log.importWidgets );
247
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingWidgets );
248
- },
249
- })
250
- .fail(function( jqXHR ){
251
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
252
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
253
- })
254
- .done(function ( widgets_data ) {
255
-
256
- // 4. Fail - Import Widgets.
257
- if( false === widgets_data.success ) {
258
- AstraSitesAdmin._importFailMessage( widgets_data.data );
259
- AstraSitesAdmin._log( widgets_data.data );
260
-
261
- } else {
262
-
263
- // 4. Pass - Import Widgets.
264
- AstraSitesAdmin._log( astraSitesAdmin.log.importWidgetsSuccess );
265
- $(document).trigger( 'astra-sites-import-widgets-done' );
266
- }
267
- });
268
- },
269
-
270
- /**
271
- * 3. Import Site Options.
272
- */
273
- _importSiteOptions: function( event ) {
274
-
275
- $.ajax({
276
- url : astraSitesAdmin.ajaxurl,
277
- type : 'POST',
278
- dataType: 'json',
279
- data : {
280
- action : 'astra-sites-import-options',
281
- options_data : AstraSitesAdmin.options_data,
282
- },
283
- beforeSend: function() {
284
- AstraSitesAdmin._log( astraSitesAdmin.log.importOptions );
285
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingOptions );
286
- },
287
- })
288
- .fail(function( jqXHR ){
289
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
290
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
291
- })
292
- .done(function ( options_data ) {
293
-
294
- // 3. Fail - Import Site Options.
295
- if( false === options_data.success ) {
296
- AstraSitesAdmin._log( options_data );
297
- AstraSitesAdmin._importFailMessage( options_data.data );
298
- AstraSitesAdmin._log( options_data.data );
299
-
300
- } else {
301
-
302
- // 3. Pass - Import Site Options.
303
- AstraSitesAdmin._log( astraSitesAdmin.log.importOptionsSuccess );
304
- $(document).trigger( 'astra-sites-import-options-done' );
305
- }
306
- });
307
- },
308
-
309
- /**
310
- * 2. Prepare XML Data.
311
- */
312
- _importPrepareXML: function( event ) {
313
-
314
- $.ajax({
315
- url : astraSitesAdmin.ajaxurl,
316
- type : 'POST',
317
- dataType: 'json',
318
- data : {
319
- action : 'astra-sites-import-prepare-xml',
320
- wxr_url : AstraSitesAdmin.wxr_url,
321
- },
322
- beforeSend: function() {
323
- AstraSitesAdmin._log( astraSitesAdmin.log.importXMLPrepare );
324
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importXMLPreparing );
325
- },
326
- })
327
- .fail(function( jqXHR ){
328
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
329
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
330
- })
331
- .done(function ( xml_data ) {
332
-
333
- // 2. Fail - Prepare XML Data.
334
- if( false === xml_data.success ) {
335
- AstraSitesAdmin._log( xml_data );
336
- var error_msg = xml_data.data.error || xml_data.data;
337
- AstraSitesAdmin._importFailMessage( error_msg );
338
- AstraSitesAdmin._log( error_msg );
339
-
340
- } else {
341
-
342
- // 2. Pass - Prepare XML Data.
343
- AstraSitesAdmin._log( astraSitesAdmin.log.importXMLPrepareSuccess );
344
-
345
- // Import XML though Event Source.
346
- AstraSSEImport.data = xml_data.data;
347
- AstraSSEImport.render();
348
-
349
- AstraSitesAdmin._log( astraSitesAdmin.log.importXML );
350
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingXML );
351
-
352
- var evtSource = new EventSource( AstraSSEImport.data.url );
353
- evtSource.onmessage = function ( message ) {
354
- var data = JSON.parse( message.data );
355
- switch ( data.action ) {
356
- case 'updateDelta':
357
- AstraSSEImport.updateDelta( data.type, data.delta );
358
- break;
359
-
360
- case 'complete':
361
- evtSource.close();
362
-
363
- // 2. Pass - Import XML though "Source Event".
364
- AstraSitesAdmin._log( astraSitesAdmin.log.importXMLSuccess );
365
- AstraSitesAdmin._log( '----- SSE - XML import Complete -----' );
366
-
367
- $(document).trigger( 'astra-sites-import-xml-done' );
368
-
369
- break;
370
- }
371
- };
372
- evtSource.addEventListener( 'log', function ( message ) {
373
- var data = JSON.parse( message.data );
374
- AstraSitesAdmin._log( data.level + ' ' + data.message );
375
- });
376
- }
377
- });
378
- },
379
-
380
- /**
381
- * 1. Import WPForms Options.
382
- */
383
- _importWPForms: function( event ) {
384
-
385
- $.ajax({
386
- url : astraSitesAdmin.ajaxurl,
387
- type : 'POST',
388
- dataType: 'json',
389
- data : {
390
- action : 'astra-sites-import-wpforms',
391
- wpforms_url : AstraSitesAdmin.wpforms_url,
392
- },
393
- beforeSend: function() {
394
- AstraSitesAdmin._log( astraSitesAdmin.log.importWPForms );
395
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingWPForms );
396
- },
397
- })
398
- .fail(function( jqXHR ){
399
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
400
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
401
- })
402
- .done(function ( forms ) {
403
-
404
- // 1. Fail - Import WPForms Options.
405
- if( false === forms.success ) {
406
- AstraSitesAdmin._importFailMessage( forms.data );
407
- AstraSitesAdmin._log( forms.data );
408
- } else {
409
-
410
- // 1. Pass - Import Customizer Options.
411
- AstraSitesAdmin._log( astraSitesAdmin.log.importWPFormsSuccess );
412
-
413
- $(document).trigger( 'astra-sites-import-wpforms-done' );
414
- }
415
- });
416
- },
417
-
418
- /**
419
- * 1. Import Customizer Options.
420
- */
421
- _importCustomizerSettings: function( event ) {
422
-
423
- $.ajax({
424
- url : astraSitesAdmin.ajaxurl,
425
- type : 'POST',
426
- dataType: 'json',
427
- data : {
428
- action : 'astra-sites-import-customizer-settings',
429
- customizer_data : AstraSitesAdmin.customizer_data,
430
- },
431
- beforeSend: function() {
432
- AstraSitesAdmin._log( astraSitesAdmin.log.importCustomizer );
433
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingCustomizer );
434
- },
435
- })
436
- .fail(function( jqXHR ){
437
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
438
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
439
- })
440
- .done(function ( customizer_data ) {
441
-
442
- // 1. Fail - Import Customizer Options.
443
- if( false === customizer_data.success ) {
444
- AstraSitesAdmin._importFailMessage( customizer_data.data );
445
- AstraSitesAdmin._log( customizer_data.data );
446
- } else {
447
-
448
- // 1. Pass - Import Customizer Options.
449
- AstraSitesAdmin._log( astraSitesAdmin.log.importCustomizerSuccess );
450
-
451
- $(document).trigger( 'astra-sites-import-customizer-settings-done' );
452
- }
453
- });
454
- },
455
-
456
- /**
457
- * Import Success Button.
458
- *
459
- * @param {string} data Error message.
460
- */
461
- _importSuccessMessage: function() {
462
-
463
- $('.astra-demo-import').removeClass('updating-message installing')
464
- .removeAttr('data-import')
465
- .addClass('view-site')
466
- .removeClass('astra-demo-import')
467
- .text( astraSitesAdmin.strings.viewSite )
468
- .attr('target', '_blank')
469
- .append('<i class="dashicons dashicons-external"></i>')
470
- .attr('href', astraSitesAdmin.siteURL );
471
- },
472
-
473
- /**
474
- * Preview Device
475
- */
476
- _previewDevice: function( event ) {
477
- var device = $( event.currentTarget ).data( 'device' );
478
-
479
- $('.theme-install-overlay')
480
- .removeClass( 'preview-desktop preview-tablet preview-mobile' )
481
- .addClass( 'preview-' + device )
482
- .data( 'current-preview-device', device );
483
-
484
- AstraSitesAdmin._tooglePreviewDeviceButtons( device );
485
- },
486
-
487
- /**
488
- * Toggle Preview Buttons
489
- */
490
- _tooglePreviewDeviceButtons: function( newDevice ) {
491
- var $devices = $( '.wp-full-overlay-footer .devices' );
492
-
493
- $devices.find( 'button' )
494
- .removeClass( 'active' )
495
- .attr( 'aria-pressed', false );
496
-
497
- $devices.find( 'button.preview-' + newDevice )
498
- .addClass( 'active' )
499
- .attr( 'aria-pressed', true );
500
- },
501
-
502
- /**
503
- * Import Error Button.
504
- *
505
- * @param {string} data Error message.
506
- */
507
- _importFailMessage: function( message, from ) {
508
-
509
- $('.astra-demo-import')
510
- .addClass('go-pro button-primary')
511
- .removeClass('updating-message installing')
512
- .removeAttr('data-import')
513
- .attr('target', '_blank')
514
- .append('<i class="dashicons dashicons-external"></i>')
515
- .removeClass('astra-demo-import');
516
-
517
- // Add the doc link due to import log file not generated.
518
- if( 'undefined' === from ) {
519
-
520
- $('.wp-full-overlay-header .go-pro').text( astraSitesAdmin.strings.importFailedBtnSmall );
521
- $('.wp-full-overlay-footer .go-pro').text( astraSitesAdmin.strings.importFailedBtnLarge );
522
- $('.go-pro').attr('href', astraSitesAdmin.log.serverConfiguration );
523
-
524
- // Add the import log file link.
525
- } else {
526
-
527
- $('.wp-full-overlay-header .go-pro').text( astraSitesAdmin.strings.importFailBtn );
528
- $('.wp-full-overlay-footer .go-pro').text( astraSitesAdmin.strings.importFailBtnLarge )
529
-
530
- // Add the import log file link.
531
- if( 'undefined' !== AstraSitesAdmin.log_file_url ) {
532
- $('.go-pro').attr('href', AstraSitesAdmin.log_file_url );
533
- } else {
534
- $('.go-pro').attr('href', astraSitesAdmin.log.serverConfiguration );
535
- }
536
- }
537
-
538
- var output = '<div class="astra-api-error notice notice-error notice-alt is-dismissible">';
539
- output += ' <p>'+message+'</p>';
540
- output += ' <button type="button" class="notice-dismiss">';
541
- output += ' <span class="screen-reader-text">'+commonL10n.dismiss+'</span>';
542
- output += ' </button>';
543
- output += '</div>';
544
-
545
- // Fail Notice.
546
- $('.install-theme-info').append( output );
547
-
548
-
549
- // !important to add trigger.
550
- // Which reinitialize the dismiss error message events.
551
- $(document).trigger('wp-updates-notice-added');
552
- },
553
-
554
-
555
- /**
556
- * Install Now
557
- */
558
- _installNow: function(event)
559
- {
560
- event.preventDefault();
561
-
562
- var $button = jQuery( event.target ),
563
- $document = jQuery(document);
564
-
565
- if ( $button.hasClass( 'updating-message' ) || $button.hasClass( 'button-disabled' ) ) {
566
- return;
567
- }
568
-
569
- if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) {
570
- wp.updates.requestFilesystemCredentials( event );
571
-
572
- $document.on( 'credential-modal-cancel', function() {
573
- var $message = $( '.install-now.updating-message' );
574
-
575
- $message
576
- .removeClass( 'updating-message' )
577
- .text( wp.updates.l10n.installNow );
578
-
579
- wp.a11y.speak( wp.updates.l10n.updateCancel, 'polite' );
580
- } );
581
- }
582
-
583
- AstraSitesAdmin._log( astraSitesAdmin.log.installingPlugin + ' ' + $button.data( 'slug' ) );
584
-
585
- wp.updates.installPlugin( {
586
- slug: $button.data( 'slug' )
587
- } );
588
- },
589
-
590
- /**
591
- * Install Success
592
- */
593
- _installSuccess: function( event, response ) {
594
-
595
- event.preventDefault();
596
-
597
- AstraSitesAdmin._log( astraSitesAdmin.log.installed + ' ' + response.slug );
598
-
599
- var $message = jQuery( '.plugin-card-' + response.slug ).find( '.button' );
600
- var $siteOptions = jQuery( '.wp-full-overlay-header').find('.astra-site-options').val();
601
- var $enabledExtensions = jQuery( '.wp-full-overlay-header').find('.astra-enabled-extensions').val();
602
-
603
- // Transform the 'Install' button into an 'Activate' button.
604
- var $init = $message.data('init');
605
-
606
- $message.removeClass( 'install-now installed button-disabled updated-message' )
607
- .addClass('updating-message')
608
- .html( astraSitesAdmin.strings.btnActivating );
609
-
610
- // Reset not installed plugins list.
611
- var pluginsList = astraSitesAdmin.requiredPlugins.notinstalled;
612
- astraSitesAdmin.requiredPlugins.notinstalled = AstraSitesAdmin._removePluginFromQueue( response.slug, pluginsList );
613
-
614
- // WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that.
615
- setTimeout( function() {
616
-
617
- $.ajax({
618
- url: astraSitesAdmin.ajaxurl,
619
- type: 'POST',
620
- data: {
621
- 'action' : 'astra-required-plugin-activate',
622
- 'init' : $init,
623
- 'options' : $siteOptions,
624
- 'enabledExtensions' : $enabledExtensions,
625
- },
626
- })
627
- .done(function (result) {
628
-
629
- if( result.success ) {
630
-
631
- var pluginsList = astraSitesAdmin.requiredPlugins.inactive;
632
-
633
- // Reset not installed plugins list.
634
- astraSitesAdmin.requiredPlugins.inactive = AstraSitesAdmin._removePluginFromQueue( response.slug, pluginsList );
635
-
636
- $message.removeClass( 'button-primary install-now activate-now updating-message' )
637
- .attr('disabled', 'disabled')
638
- .addClass('disabled')
639
- .text( astraSitesAdmin.strings.btnActive );
640
-
641
- // Enable Demo Import Button
642
- AstraSitesAdmin._enable_demo_import_button();
643
-
644
- } else {
645
-
646
- $message.removeClass( 'updating-message' );
647
-
648
- }
649
-
650
- });
651
-
652
- }, 1200 );
653
-
654
- },
655
-
656
- /**
657
- * Plugin Installation Error.
658
- */
659
- _installError: function( event, response ) {
660
-
661
- var $card = jQuery( '.plugin-card-' + response.slug );
662
-
663
- AstraSitesAdmin._log( response.errorMessage + ' ' + response.slug );
664
-
665
- $card
666
- .removeClass( 'button-primary' )
667
- .addClass( 'disabled' )
668
- .html( wp.updates.l10n.installFailedShort );
669
-
670
- AstraSitesAdmin._importFailMessage( response.errorMessage );
671
- },
672
-
673
- /**
674
- * Installing Plugin
675
- */
676
- _pluginInstalling: function(event, args) {
677
- event.preventDefault();
678
-
679
- var $card = jQuery( '.plugin-card-' + args.slug );
680
- var $button = $card.find( '.button' );
681
-
682
- AstraSitesAdmin._log( astraSitesAdmin.log.installingPlugin + ' ' + args.slug );
683
-
684
- $card.addClass('updating-message');
685
- $button.addClass('already-started');
686
-
687
- },
688
-
689
- /**
690
- * Render Demo Preview
691
- */
692
- _activateNow: function( eventn ) {
693
-
694
- event.preventDefault();
695
-
696
- var $button = jQuery( event.target ),
697
- $init = $button.data( 'init' ),
698
- $slug = $button.data( 'slug' );
699
-
700
- if ( $button.hasClass( 'updating-message' ) || $button.hasClass( 'button-disabled' ) ) {
701
- return;
702
- }
703
-
704
- AstraSitesAdmin._log( astraSitesAdmin.log.activating + ' ' + $slug );
705
-
706
- $button.addClass('updating-message button-primary')
707
- .html( astraSitesAdmin.strings.btnActivating );
708
-
709
- var $siteOptions = jQuery( '.wp-full-overlay-header').find('.astra-site-options').val();
710
- var $enabledExtensions = jQuery( '.wp-full-overlay-header').find('.astra-enabled-extensions').val();
711
-
712
- $.ajax({
713
- url: astraSitesAdmin.ajaxurl,
714
- type: 'POST',
715
- data: {
716
- 'action' : 'astra-required-plugin-activate',
717
- 'init' : $init,
718
- 'options' : $siteOptions,
719
- 'enabledExtensions' : $enabledExtensions,
720
- },
721
- })
722
- .done(function (result) {
723
-
724
- if( result.success ) {
725
-
726
- AstraSitesAdmin._log( astraSitesAdmin.log.activated + ' ' + $slug );
727
-
728
- var pluginsList = astraSitesAdmin.requiredPlugins.inactive;
729
-
730
- // Reset not installed plugins list.
731
- astraSitesAdmin.requiredPlugins.inactive = AstraSitesAdmin._removePluginFromQueue( $slug, pluginsList );
732
-
733
- $button.removeClass( 'button-primary install-now activate-now updating-message' )
734
- .attr('disabled', 'disabled')
735
- .addClass('disabled')
736
- .text( astraSitesAdmin.strings.btnActive );
737
-
738
- // Enable Demo Import Button
739
- AstraSitesAdmin._enable_demo_import_button();
740
-
741
- }
742
-
743
- })
744
- .fail(function () {
745
- });
746
-
747
- },
748
-
749
- /**
750
- * Full Overlay
751
- */
752
- _fullOverlay: function (event) {
753
- event.preventDefault();
754
-
755
- // Import process is started?
756
- // And Closing the window? Then showing the warning confirm message.
757
- if( $('body').hasClass('importing-site') && ! confirm( astraSitesAdmin.strings.warningBeforeCloseWindow ) ) {
758
- return;
759
- }
760
-
761
- $('body').removeClass('importing-site');
762
- $('.previous-theme, .next-theme').removeClass('disabled');
763
- $('.theme-install-overlay').css('display', 'none');
764
- $('.theme-install-overlay').remove();
765
- $('.theme-preview-on').removeClass('theme-preview-on');
766
- $('html').removeClass('astra-site-preview-on');
767
- },
768
-
769
- /**
770
- * Bulk Plugin Active & Install
771
- */
772
- _bulkPluginInstallActivate: function()
773
- {
774
- if( 0 === astraSitesAdmin.requiredPlugins.length ) {
775
- return;
776
- }
777
-
778
- jQuery('.required-plugins')
779
- .find('.install-now')
780
- .addClass( 'updating-message' )
781
- .removeClass( 'install-now' )
782
- .text( wp.updates.l10n.installing );
783
-
784
- jQuery('.required-plugins')
785
- .find('.activate-now')
786
- .addClass('updating-message')
787
- .removeClass( 'activate-now' )
788
- .html( astraSitesAdmin.strings.btnActivating );
789
-
790
- var not_installed = astraSitesAdmin.requiredPlugins.notinstalled || '';
791
- var activate_plugins = astraSitesAdmin.requiredPlugins.inactive || '';
792
-
793
- // First Install Bulk.
794
- if( not_installed.length > 0 ) {
795
- AstraSitesAdmin._installAllPlugins( not_installed );
796
- }
797
-
798
- // Second Activate Bulk.
799
- if( activate_plugins.length > 0 ) {
800
- AstraSitesAdmin._activateAllPlugins( activate_plugins );
801
- }
802
-
803
- },
804
-
805
- /**
806
- * Activate All Plugins.
807
- */
808
- _activateAllPlugins: function( activate_plugins ) {
809
-
810
- // Activate ALl Plugins.
811
- AstraSitesAjaxQueue.stop();
812
- AstraSitesAjaxQueue.run();
813
-
814
- AstraSitesAdmin._log( astraSitesAdmin.log.bulkActivation );
815
-
816
- $.each( activate_plugins, function(index, single_plugin) {
817
-
818
- var $card = jQuery( '.plugin-card-' + single_plugin.slug ),
819
- $button = $card.find('.button'),
820
- $siteOptions = jQuery( '.wp-full-overlay-header').find('.astra-site-options').val(),
821
- $enabledExtensions = jQuery( '.wp-full-overlay-header').find('.astra-enabled-extensions').val();
822
-
823
- $button.addClass('updating-message');
824
-
825
- AstraSitesAjaxQueue.add({
826
- url: astraSitesAdmin.ajaxurl,
827
- type: 'POST',
828
- data: {
829
- 'action' : 'astra-required-plugin-activate',
830
- 'init' : single_plugin.init,
831
- 'options' : $siteOptions,
832
- 'enabledExtensions' : $enabledExtensions,
833
- },
834
- success: function( result ){
835
-
836
- if( result.success ) {
837
-
838
- AstraSitesAdmin._log( astraSitesAdmin.log.activate + ' ' + single_plugin.slug );
839
-
840
- var $card = jQuery( '.plugin-card-' + single_plugin.slug );
841
- var $button = $card.find( '.button' );
842
- if( ! $button.hasClass('already-started') ) {
843
- var pluginsList = astraSitesAdmin.requiredPlugins.inactive;
844
-
845
- // Reset not installed plugins list.
846
- astraSitesAdmin.requiredPlugins.inactive = AstraSitesAdmin._removePluginFromQueue( single_plugin.slug, pluginsList );
847
- }
848
-
849
- $button.removeClass( 'button-primary install-now activate-now updating-message' )
850
- .attr('disabled', 'disabled')
851
- .addClass('disabled')
852
- .text( astraSitesAdmin.strings.btnActive );
853
-
854
- // Enable Demo Import Button
855
- AstraSitesAdmin._enable_demo_import_button();
856
- } else {
857
- AstraSitesAdmin._log( astraSitesAdmin.log.activationError + ' - ' + single_plugin.slug );
858
- }
859
- }
860
- });
861
- });
862
- },
863
-
864
- /**
865
- * Install All Plugins.
866
- */
867
- _installAllPlugins: function( not_installed ) {
868
-
869
- AstraSitesAdmin._log( astraSitesAdmin.log.bulkInstall );
870
-
871
- $.each( not_installed, function(index, single_plugin) {
872
-
873
- var $card = jQuery( '.plugin-card-' + single_plugin.slug ),
874
- $button = $card.find('.button');
875
-
876
- if( ! $button.hasClass('already-started') ) {
877
-
878
- // Add each plugin activate request in Ajax queue.
879
- // @see wp-admin/js/updates.js
880
- wp.updates.queue.push( {
881
- action: 'install-plugin', // Required action.
882
- data: {
883
- slug: single_plugin.slug
884
- }
885
- } );
886
- }
887
- });
888
-
889
- // Required to set queue.
890
- wp.updates.queueChecker();
891
- },
892
-
893
- /**
894
- * Fires when a nav item is clicked.
895
- *
896
- * @since 1.0
897
- * @access private
898
- * @method _importDemo
899
- */
900
- _importDemo: function()
901
- {
902
- var $this = jQuery(this),
903
- $theme = $this.closest('.astra-sites-preview').find('.wp-full-overlay-header'),
904
- apiURL = $theme.data('demo-api') || '',
905
- plugins = $theme.data('required-plugins');
906
-
907
- var disabled = $this.attr('data-import');
908
-
909
- if ( typeof disabled !== 'undefined' && disabled === 'disabled' || $this.hasClass('disabled') ) {
910
-
911
- $('.astra-demo-import').addClass('updating-message installing')
912
- .text( wp.updates.l10n.installing );
913
-
914
- /**
915
- * Process Bulk Plugin Install & Activate
916
- */
917
- AstraSitesAdmin._bulkPluginInstallActivate();
918
-
919
- return;
920
- }
921
-
922
- // Proceed?
923
- if( ! confirm( astraSitesAdmin.strings.importWarning ) ) {
924
- return;
925
- }
926
-
927
- $('body').addClass('importing-site');
928
- $('.previous-theme, .next-theme').addClass('disabled');
929
-
930
- // Remove all notices before import start.
931
- $('.install-theme-info > .notice').remove();
932
-
933
- $('.astra-demo-import').attr('data-import', 'disabled')
934
- .addClass('updating-message installing')
935
- .text( astraSitesAdmin.strings.importingDemo );
936
-
937
- $this.closest('.theme').focus();
938
-
939
- var $theme = $this.closest('.astra-sites-preview').find('.wp-full-overlay-header');
940
-
941
- var apiURL = $theme.data('demo-api') || '';
942
-
943
- // Site Import by API URL.
944
- if( apiURL ) {
945
- AstraSitesAdmin._importSite( apiURL );
946
- }
947
-
948
- },
949
-
950
- /**
951
- * Start Import Process by API URL.
952
- *
953
- * @param {string} apiURL Site API URL.
954
- */
955
- _importSite: function( apiURL ) {
956
-
957
- AstraSitesAdmin._log( astraSitesAdmin.log.api + ' : ' + apiURL );
958
- AstraSitesAdmin._log( astraSitesAdmin.log.importing );
959
-
960
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.gettingData );
961
-
962
- // 1. Request Site Import
963
- $.ajax({
964
- url : astraSitesAdmin.ajaxurl,
965
- type : 'POST',
966
- dataType: 'json',
967
- data : {
968
- 'action' : 'astra-sites-import-set-site-data',
969
- 'api_url' : apiURL,
970
- },
971
- })
972
- .fail(function( jqXHR ){
973
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
974
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
975
- })
976
- .done(function ( demo_data ) {
977
-
978
- // 1. Fail - Request Site Import
979
- if( false === demo_data.success ) {
980
-
981
- AstraSitesAdmin._importFailMessage( demo_data.data );
982
-
983
- } else {
984
-
985
- // Set log file URL.
986
- if( 'log_file' in demo_data.data ){
987
- AstraSitesAdmin.log_file_url = decodeURIComponent( demo_data.data.log_file ) || '';
988
- }
989
-
990
- // 1. Pass - Request Site Import
991
- AstraSitesAdmin._log( astraSitesAdmin.log.processingRequest );
992
-
993
- AstraSitesAdmin.customizer_data = JSON.stringify( demo_data.data['astra-site-customizer-data'] ) || '';
994
- AstraSitesAdmin.wxr_url = encodeURI( demo_data.data['astra-site-wxr-path'] ) || '';
995
- AstraSitesAdmin.wpforms_url = encodeURI( demo_data.data['astra-site-wpforms-path'] ) || '';
996
- AstraSitesAdmin.options_data = JSON.stringify( demo_data.data['astra-site-options-data'] ) || '';
997
- AstraSitesAdmin.widgets_data = JSON.stringify( demo_data.data['astra-site-widgets-data'] ) || '';
998
-
999
- $(document).trigger( 'astra-sites-import-set-site-data-done' );
1000
- }
1001
-
1002
- });
1003
-
1004
- },
1005
-
1006
- /**
1007
- * Collapse Sidebar.
1008
- */
1009
- _collapse: function() {
1010
- event.preventDefault();
1011
-
1012
- overlay = jQuery('.wp-full-overlay');
1013
-
1014
- if (overlay.hasClass('expanded')) {
1015
- overlay.removeClass('expanded');
1016
- overlay.addClass('collapsed');
1017
- return;
1018
- }
1019
-
1020
- if (overlay.hasClass('collapsed')) {
1021
- overlay.removeClass('collapsed');
1022
- overlay.addClass('expanded');
1023
- return;
1024
- }
1025
- },
1026
-
1027
- /**
1028
- * Previous Theme.
1029
- */
1030
- _previousTheme: function (event) {
1031
- event.preventDefault();
1032
-
1033
- currentDemo = jQuery('.theme-preview-on');
1034
- currentDemo.removeClass('theme-preview-on');
1035
- prevDemo = currentDemo.prev('.theme');
1036
- prevDemo.addClass('theme-preview-on');
1037
-
1038
- AstraSitesAdmin._renderDemoPreview(prevDemo);
1039
- },
1040
-
1041
- /**
1042
- * Next Theme.
1043
- */
1044
- _nextTheme: function (event) {
1045
- event.preventDefault();
1046
- currentDemo = jQuery('.theme-preview-on')
1047
- currentDemo.removeClass('theme-preview-on');
1048
- nextDemo = currentDemo.next('.theme');
1049
- nextDemo.addClass('theme-preview-on');
1050
-
1051
- AstraSitesAdmin._renderDemoPreview( nextDemo );
1052
- },
1053
-
1054
- /**
1055
- * Individual Site Preview
1056
- *
1057
- * On click on image, more link & preview button.
1058
- */
1059
- _preview: function( event ) {
1060
-
1061
- event.preventDefault();
1062
-
1063
- var self = jQuery(this).parents('.theme');
1064
- self.addClass('theme-preview-on');
1065
-
1066
- jQuery('html').addClass('astra-site-preview-on');
1067
-
1068
- AstraSitesAdmin._renderDemoPreview( self );
1069
- },
1070
-
1071
- /**
1072
- * Check Next Previous Buttons.
1073
- */
1074
- _checkNextPrevButtons: function() {
1075
- currentDemo = jQuery('.theme-preview-on');
1076
- nextDemo = currentDemo.nextAll('.theme').length;
1077
- prevDemo = currentDemo.prevAll('.theme').length;
1078
-
1079
- if (nextDemo == 0) {
1080
- jQuery('.next-theme').addClass('disabled');
1081
- } else if (nextDemo != 0) {
1082
- jQuery('.next-theme').removeClass('disabled');
1083
- }
1084
-
1085
- if (prevDemo == 0) {
1086
- jQuery('.previous-theme').addClass('disabled');
1087
- } else if (prevDemo != 0) {
1088
- jQuery('.previous-theme').removeClass('disabled');
1089
- }
1090
-
1091
- return;
1092
- },
1093
-
1094
- /**
1095
- * Render Demo Preview
1096
- */
1097
- _renderDemoPreview: function(anchor) {
1098
-
1099
- var demoId = anchor.data('id') || '',
1100
- apiURL = anchor.data('demo-api') || '',
1101
- demoType = anchor.data('demo-type') || '',
1102
- demoURL = anchor.data('demo-url') || '',
1103
- screenshot = anchor.data('screenshot') || '',
1104
- demo_name = anchor.data('demo-name') || '',
1105
- demo_slug = anchor.data('demo-slug') || '',
1106
- content = anchor.data('content') || '',
1107
- requiredPlugins = anchor.data('required-plugins') || '',
1108
- astraSiteOptions = anchor.find('.astra-site-options').val() || '';
1109
- astraEnabledExtensions = anchor.find('.astra-enabled-extensions').val() || '';
1110
-
1111
- AstraSitesAdmin._log( astraSitesAdmin.log.preview + ' "' + demo_name + '" URL : ' + demoURL );
1112
-
1113
- var template = wp.template('astra-site-preview');
1114
-
1115
- templateData = [{
1116
- id : demoId,
1117
- astra_demo_type : demoType,
1118
- astra_demo_url : demoURL,
1119
- demo_api : apiURL,
1120
- screenshot : screenshot,
1121
- demo_name : demo_name,
1122
- slug : demo_slug,
1123
- content : content,
1124
- required_plugins : JSON.stringify(requiredPlugins),
1125
- astra_site_options : astraSiteOptions,
1126
- astra_enabled_extensions : astraEnabledExtensions,
1127
- }];
1128
-
1129
- // delete any earlier fullscreen preview before we render new one.
1130
- jQuery('.theme-install-overlay').remove();
1131
-
1132
- jQuery('#astra-sites-menu-page').append(template(templateData[0]));
1133
- jQuery('.theme-install-overlay').css('display', 'block');
1134
- AstraSitesAdmin._checkNextPrevButtons();
1135
-
1136
- var desc = jQuery('.theme-details');
1137
- var descHeight = parseInt( desc.outerHeight() );
1138
- var descBtn = jQuery('.theme-details-read-more');
1139
-
1140
- if( $.isArray( requiredPlugins ) ) {
1141
-
1142
- if( descHeight >= 55 ) {
1143
-
1144
- // Show button.
1145
- descBtn.css( 'display', 'inline-block' );
1146
-
1147
- // Set height upto 3 line.
1148
- desc.css( 'height', 57 );
1149
-
1150
- // Button Click.
1151
- descBtn.click(function(event) {
1152
-
1153
- if( descBtn.hasClass('open') ) {
1154
- desc.animate({ height: 57 },
1155
- 300, function() {
1156
- descBtn.removeClass('open');
1157
- descBtn.html( astraSitesAdmin.strings.DescExpand );
1158
- });
1159
- } else {
1160
- desc.animate({ height: descHeight },
1161
- 300, function() {
1162
- descBtn.addClass('open');
1163
- descBtn.html( astraSitesAdmin.strings.DescCollapse );
1164
- });
1165
- }
1166
-
1167
- });
1168
- }
1169
-
1170
- // or
1171
- var $pluginsFilter = jQuery( '#plugin-filter' ),
1172
- data = {
1173
- action : 'astra-required-plugins',
1174
- _ajax_nonce : astraSitesAdmin._ajax_nonce,
1175
- required_plugins : requiredPlugins
1176
- };
1177
-
1178
- // Add disabled class from import button.
1179
- $('.astra-demo-import')
1180
- .addClass('disabled not-click-able')
1181
- .removeAttr('data-import');
1182
-
1183
- $('.required-plugins').addClass('loading').html('<span class="spinner is-active"></span>');
1184
-
1185
- // Required Required.
1186
- $.ajax({
1187
- url : astraSitesAdmin.ajaxurl,
1188
- type : 'POST',
1189
- data : data,
1190
- })
1191
- .fail(function( jqXHR ){
1192
-
1193
- // Remove loader.
1194
- jQuery('.required-plugins').removeClass('loading').html('');
1195
-
1196
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText, 'plugins' );
1197
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText );
1198
- })
1199
- .done(function ( response ) {
1200
-
1201
- // Release disabled class from import button.
1202
- $('.astra-demo-import')
1203
- .removeClass('disabled not-click-able')
1204
- .attr('data-import', 'disabled');
1205
-
1206
- // Remove loader.
1207
- $('.required-plugins').removeClass('loading').html('');
1208
-
1209
- /**
1210
- * Count remaining plugins.
1211
- * @type number
1212
- */
1213
- var remaining_plugins = 0;
1214
-
1215
- /**
1216
- * Not Installed
1217
- *
1218
- * List of not installed required plugins.
1219
- */
1220
- if ( typeof response.data.notinstalled !== 'undefined' ) {
1221
-
1222
- // Add not have installed plugins count.
1223
- remaining_plugins += parseInt( response.data.notinstalled.length );
1224
-
1225
- jQuery( response.data.notinstalled ).each(function( index, plugin ) {
1226
-
1227
- var output = '<div class="plugin-card ';
1228
- output += ' plugin-card-'+plugin.slug+'"';
1229
- output += ' data-slug="'+plugin.slug+'"';
1230
- output += ' data-init="'+plugin.init+'">';
1231
- output += ' <span class="title">'+plugin.name+'</span>';
1232
- output += ' <button class="button install-now"';
1233
- output += ' data-init="' + plugin.init + '"';
1234
- output += ' data-slug="' + plugin.slug + '"';
1235
- output += ' data-name="' + plugin.name + '">';
1236
- output += wp.updates.l10n.installNow;
1237
- output += ' </button>';
1238
- // output += ' <span class="dashicons-no dashicons"></span>';
1239
- output += '</div>';
1240
-
1241
- jQuery('.required-plugins').append(output);
1242
-
1243
- });
1244
- }
1245
-
1246
- /**
1247
- * Inactive
1248
- *
1249
- * List of not inactive required plugins.
1250
- */
1251
- if ( typeof response.data.inactive !== 'undefined' ) {
1252
-
1253
- // Add inactive plugins count.
1254
- remaining_plugins += parseInt( response.data.inactive.length );
1255
-
1256
- jQuery( response.data.inactive ).each(function( index, plugin ) {
1257
-
1258
- var output = '<div class="plugin-card ';
1259
- output += ' plugin-card-'+plugin.slug+'"';
1260
- output += ' data-slug="'+plugin.slug+'"';
1261
- output += ' data-init="'+plugin.init+'">';
1262
- output += ' <span class="title">'+plugin.name+'</span>';
1263
- output += ' <button class="button activate-now button-primary"';
1264
- output += ' data-init="' + plugin.init + '"';
1265
- output += ' data-slug="' + plugin.slug + '"';
1266
- output += ' data-name="' + plugin.name + '">';
1267
- output += wp.updates.l10n.activatePlugin;
1268
- output += ' </button>';
1269
- // output += ' <span class="dashicons-no dashicons"></span>';
1270
- output += '</div>';
1271
-
1272
- jQuery('.required-plugins').append(output);
1273
-
1274
- });
1275
- }
1276
-
1277
- /**
1278
- * Active
1279
- *
1280
- * List of not active required plugins.
1281
- */
1282
- if ( typeof response.data.active !== 'undefined' ) {
1283
-
1284
- jQuery( response.data.active ).each(function( index, plugin ) {
1285
-
1286
- var output = '<div class="plugin-card ';
1287
- output += ' plugin-card-'+plugin.slug+'"';
1288
- output += ' data-slug="'+plugin.slug+'"';
1289
- output += ' data-init="'+plugin.init+'">';
1290
- output += ' <span class="title">'+plugin.name+'</span>';
1291
- output += ' <button class="button disabled"';
1292
- output += ' data-slug="' + plugin.slug + '"';
1293
- output += ' data-name="' + plugin.name + '">';
1294
- output += astraSitesAdmin.strings.btnActive;
1295
- output += ' </button>';
1296
- // output += ' <span class="dashicons-yes dashicons"></span>';
1297
- output += '</div>';
1298
-
1299
- jQuery('.required-plugins').append(output);
1300
-
1301
- });
1302
- }
1303
-
1304
- /**
1305
- * Enable Demo Import Button
1306
- * @type number
1307
- */
1308
- astraSitesAdmin.requiredPlugins = response.data;
1309
- AstraSitesAdmin._enable_demo_import_button();
1310
-
1311
- });
1312
-
1313
- } else {
1314
-
1315
- // Enable Demo Import Button
1316
- AstraSitesAdmin._enable_demo_import_button( demoType );
1317
- jQuery('.required-plugins-wrap').remove();
1318
- }
1319
-
1320
- return;
1321
- },
1322
-
1323
- /**
1324
- * Enable Demo Import Button.
1325
- */
1326
- _enable_demo_import_button: function( type ) {
1327
-
1328
- type = ( undefined !== type ) ? type : 'free';
1329
-
1330
- $('.install-theme-info .theme-details .site-description').remove();
1331
-
1332
- switch( type ) {
1333
-
1334
- case 'free':
1335
- var all_buttons = parseInt( jQuery( '.plugin-card .button' ).length ) || 0,
1336
- disabled_buttons = parseInt( jQuery( '.plugin-card .button.disabled' ).length ) || 0;
1337
-
1338
- if( all_buttons === disabled_buttons ) {
1339
-
1340
- // XML reader not available notice.
1341
- if( astraSitesAdmin.XMLReaderDisabled ) {
1342
- if( ! $('.install-theme-info .astra-sites-xml-notice').length ) {
1343
- $('.install-theme-info').prepend( astraSitesAdmin.strings.warningXMLReader );
1344
- }
1345
- $('.astra-demo-import')
1346
- .removeClass('installing updating-message')
1347
- .addClass('disabled')
1348
- .text( astraSitesAdmin.strings.importDemo );
1349
- } else {
1350
- $('.astra-demo-import')
1351
- .removeAttr('data-import')
1352
- .removeClass('installing updating-message')
1353
- .addClass('button-primary')
1354
- .text( astraSitesAdmin.strings.importDemo );
1355
- }
1356
- }
1357
-
1358
- break;
1359
-
1360
- case 'upgrade':
1361
- var demo_slug = jQuery('.wp-full-overlay-header').attr('data-demo-slug');
1362
-
1363
- jQuery('.astra-demo-import')
1364
- .addClass('go-pro button-primary')
1365
- .removeClass('astra-demo-import')
1366
- .attr('target', '_blank')
1367
- .attr('href', astraSitesAdmin.getUpgradeURL + demo_slug )
1368
- .text( astraSitesAdmin.getUpgradeText )
1369
- .append('<i class="dashicons dashicons-external"></i>');
1370
-
1371
- break;
1372
-
1373
- default:
1374
- var demo_slug = jQuery('.wp-full-overlay-header').attr('data-demo-slug');
1375
-
1376
- jQuery('.astra-demo-import')
1377
- .addClass('go-pro button-primary')
1378
- .removeClass('astra-demo-import')
1379
- .attr('target', '_blank')
1380
- .attr('href', astraSitesAdmin.getProURL )
1381
- .text( astraSitesAdmin.getProText )
1382
- .append('<i class="dashicons dashicons-external"></i>');
1383
-
1384
- if( false == astraSitesAdmin.isWhiteLabeled ) {
1385
- if( astraSitesAdmin.isPro ) {
1386
- $('.install-theme-info .theme-details').prepend( wp.template('astra-sites-pro-inactive-site-description') );
1387
- } else {
1388
- $('.install-theme-info .theme-details').prepend( wp.template('astra-sites-pro-site-description') );
1389
- }
1390
- }
1391
-
1392
- break;
1393
- }
1394
-
1395
- },
1396
-
1397
- /**
1398
- * Update Page Count.
1399
- */
1400
- _updatedPagedCount: function() {
1401
- paged = parseInt(jQuery('body').attr('data-astra-demo-paged'));
1402
- jQuery('body').attr('data-astra-demo-paged', paged + 1);
1403
- window.setTimeout(function () {
1404
- jQuery('body').data('scrolling', false);
1405
- }, 800);
1406
- },