Astra Starter Sites - Version 1.2.13

Version Description

Download this release

Release Info

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

Code changes from version 1.2.12 to 1.2.13

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