Astra Starter Sites - Version 1.2.4

Version Description

Download this release

Release Info

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

Code changes from version 1.2.3 to 1.2.4

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