Astra Starter Sites - Version 1.3.17

Version Description

Download this release

Release Info

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

Code changes from version 1.3.16 to 1.3.17

astra-sites.php CHANGED
@@ -3,7 +3,7 @@
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.3.16
7
  * Author: Brainstorm Force
8
  * Author URI: http://www.brainstormforce.com
9
  * Text Domain: astra-sites
@@ -19,7 +19,7 @@ if ( ! defined( 'ASTRA_SITES_NAME' ) ) {
19
  }
20
 
21
  if ( ! defined( 'ASTRA_SITES_VER' ) ) {
22
- define( 'ASTRA_SITES_VER', '1.3.16' );
23
  }
24
 
25
  if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
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.3.17
7
  * Author: Brainstorm Force
8
  * Author URI: http://www.brainstormforce.com
9
  * Text Domain: astra-sites
19
  }
20
 
21
  if ( ! defined( 'ASTRA_SITES_VER' ) ) {
22
+ define( 'ASTRA_SITES_VER', '1.3.17' );
23
  }
24
 
25
  if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
inc/classes/class-astra-sites.php CHANGED
@@ -1,628 +1,628 @@
1
- <?php
2
- /**
3
- * Astra Sites
4
- *
5
- * @since 1.0.0
6
- * @package Astra Sites
7
- */
8
-
9
- defined( 'ABSPATH' ) or exit;
10
-
11
- if ( ! class_exists( 'Astra_Sites' ) ) :
12
-
13
- /**
14
- * Astra_Sites
15
- */
16
- class Astra_Sites {
17
-
18
- /**
19
- * API URL which is used to get the response from.
20
- *
21
- * @since 1.0.0
22
- * @var (String) URL
23
- */
24
- public static $api_url;
25
-
26
- /**
27
- * Instance of Astra_Sites
28
- *
29
- * @since 1.0.0
30
- * @var (Object) Astra_Sites
31
- */
32
- private static $_instance = null;
33
-
34
- /**
35
- * Instance of Astra_Sites.
36
- *
37
- * @since 1.0.0
38
- *
39
- * @return object Class object.
40
- */
41
- public static function get_instance() {
42
- if ( ! isset( self::$_instance ) ) {
43
- self::$_instance = new self;
44
- }
45
-
46
- return self::$_instance;
47
- }
48
-
49
- /**
50
- * Constructor.
51
- *
52
- * @since 1.0.0
53
- */
54
- private function __construct() {
55
-
56
- self::set_api_url();
57
-
58
- $this->includes();
59
-
60
- add_action( 'admin_notices', array( $this, 'add_notice' ), 1 );
61
- add_action( 'admin_notices', array( $this, 'admin_notices' ) );
62
- add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
63
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue' ) );
64
-
65
- // AJAX.
66
- add_action( 'wp_ajax_astra-required-plugins', array( $this, 'required_plugin' ) );
67
- add_action( 'wp_ajax_astra-required-plugin-activate', array( $this, 'required_plugin_activate' ) );
68
- add_action( 'wp_ajax_astra-sites-backup-settings', array( $this, 'backup_settings' ) );
69
- add_action( 'wp_ajax_astra-sites-set-reset-data', array( $this, 'set_reset_data' ) );
70
- add_action( 'wp_ajax_astra-sites-activate-theme', array( $this, 'activate_theme' ) );
71
- add_action( 'wp_ajax_astra-sites-getting-started-notice', array( $this, 'getting_started_notice' ) );
72
- }
73
-
74
- /**
75
- * Close getting started notice for current user
76
- *
77
- * @since 1.3.5
78
- * @return void
79
- */
80
- function getting_started_notice() {
81
- update_user_meta( get_current_user_id(), '_astra_sites_gettings_started', true );
82
- wp_send_json_success();
83
- }
84
-
85
- /**
86
- * Activate theme
87
- *
88
- * @since 1.3.2
89
- * @return void
90
- */
91
- function activate_theme() {
92
-
93
- switch_theme( 'astra' );
94
-
95
- wp_send_json_success(
96
- array(
97
- 'success' => true,
98
- 'message' => __( 'Theme Activated', 'astra-sites' ),
99
- )
100
- );
101
- }
102
-
103
- /**
104
- * Set reset data
105
- */
106
- function set_reset_data() {
107
- if ( ! current_user_can( 'manage_options' ) ) {
108
- return;
109
- }
110
-
111
- global $wpdb;
112
-
113
- $post_ids = $wpdb->get_col( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_astra_sites_imported_post'" );
114
- $form_ids = $wpdb->get_col( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_astra_sites_imported_wp_forms'" );
115
- $term_ids = $wpdb->get_col( "SELECT term_id FROM {$wpdb->termmeta} WHERE meta_key='_astra_sites_imported_term'" );
116
-
117
- wp_send_json_success(
118
- array(
119
- 'reset_posts' => $post_ids,
120
- 'reset_wp_forms' => $form_ids,
121
- 'reset_terms' => $term_ids,
122
- )
123
- );
124
- }
125
-
126
- /**
127
- * Backup our existing settings.
128
- */
129
- function backup_settings() {
130
- if ( ! current_user_can( 'manage_options' ) ) {
131
- return;
132
- }
133
-
134
- $file_name = 'astra-sites-backup-' . date( 'd-M-Y-h-i-s' ) . '.json';
135
- $old_settings = get_option( 'astra-settings', array() );
136
- $upload_dir = Astra_Sites_Importer_Log::get_instance()->log_dir();
137
- $upload_path = trailingslashit( $upload_dir['path'] );
138
- $log_file = $upload_path . $file_name;
139
- $file_system = Astra_Sites_Importer_Log::get_instance()->get_filesystem();
140
-
141
- // If file system fails? Then take a backup in site option.
142
- if ( false === $file_system->put_contents( $log_file, json_encode( $old_settings ), FS_CHMOD_FILE ) ) {
143
- update_option( 'astra_sites_' . $file_name, $old_settings );
144
- }
145
-
146
- wp_send_json_success();
147
- }
148
-
149
- /**
150
- * Add Admin Notice.
151
- */
152
- function add_notice() {
153
-
154
- $theme_status = 'astra-sites-theme-' . $this->get_theme_status();
155
-
156
- Astra_Notices::add_notice(
157
- array(
158
- 'id' => 'astra-theme-activation-nag',
159
- 'type' => 'error',
160
- 'show_if' => ( ! defined( 'ASTRA_THEME_SETTINGS' ) ) ? true : false,
161
- /* translators: 1: theme.php file*/
162
- 'message' => sprintf( __( '<p>Astra Theme needs to be active for you to use currently installed "%1$s" plugin. <a href="#" class="%3$s" data-theme-slug="astra">Install & Activate Now</a></p>', 'astra-sites' ), ASTRA_SITES_NAME, esc_url( admin_url( 'themes.php?theme=astra' ) ), $theme_status ),
163
- 'dismissible' => true,
164
- 'dismissible-time' => WEEK_IN_SECONDS,
165
- )
166
- );
167
- }
168
-
169
- /**
170
- * Get theme install, active or inactive status.
171
- *
172
- * @since 1.3.2
173
- *
174
- * @return string Theme status
175
- */
176
- function get_theme_status() {
177
-
178
- $theme = wp_get_theme();
179
-
180
- // Theme installed and activate.
181
- if ( 'Astra' === $theme->name || 'Astra' === $theme->parent_theme ) {
182
- return 'installed-and-active';
183
- }
184
-
185
- // Theme installed but not activate.
186
- foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
187
- if ( 'Astra' === $theme->name || 'Astra' === $theme->parent_theme ) {
188
- return 'installed-but-inactive';
189
- }
190
- }
191
-
192
- return 'not-installed';
193
- }
194
-
195
- /**
196
- * Loads textdomain for the plugin.
197
- *
198
- * @since 1.0.1
199
- */
200
- function load_textdomain() {
201
- load_plugin_textdomain( 'astra-sites' );
202
- }
203
-
204
- /**
205
- * Admin Notices
206
- *
207
- * @since 1.0.5
208
- * @return void
209
- */
210
- function admin_notices() {
211
-
212
- if ( ! defined( 'ASTRA_THEME_SETTINGS' ) ) {
213
- return;
214
- }
215
-
216
- add_action( 'plugin_action_links_' . ASTRA_SITES_BASE, array( $this, 'action_links' ) );
217
- }
218
-
219
- /**
220
- * Show action links on the plugin screen.
221
- *
222
- * @param mixed $links Plugin Action links.
223
- * @return array
224
- */
225
- function action_links( $links ) {
226
- $action_links = array(
227
- 'settings' => '<a href="' . admin_url( 'themes.php?page=astra-sites' ) . '" aria-label="' . esc_attr__( 'See Library', 'astra-sites' ) . '">' . esc_html__( 'See Library', 'astra-sites' ) . '</a>',
228
- );
229
-
230
- return array_merge( $action_links, $links );
231
- }
232
-
233
- /**
234
- * Setter for $api_url
235
- *
236
- * @since 1.0.0
237
- */
238
- public static function set_api_url() {
239
- self::$api_url = apply_filters( 'astra_sites_api_url', 'https://websitedemos.net/wp-json/wp/v2/' );
240
-
241
- }
242
-
243
- /**
244
- * Enqueue admin scripts.
245
- *
246
- * @since 1.3.2 Added 'install-theme.js' to install and activate theme.
247
- * @since 1.0.5 Added 'getUpgradeText' and 'getUpgradeURL' localize variables.
248
- *
249
- * @since 1.0.0
250
- *
251
- * @param string $hook Current hook name.
252
- * @return void
253
- */
254
- public function admin_enqueue( $hook = '' ) {
255
-
256
- wp_enqueue_script( 'astra-sites-install-theme', ASTRA_SITES_URI . 'inc/assets/js/install-theme.js', array( 'jquery', 'updates' ), ASTRA_SITES_VER, true );
257
- wp_enqueue_style( 'astra-sites-install-theme', ASTRA_SITES_URI . 'inc/assets/css/install-theme.css', null, ASTRA_SITES_VER, 'all' );
258
-
259
- $data = apply_filters(
260
- 'astra_sites_install_theme_localize_vars',
261
- array(
262
- 'installed' => __( 'Installed! Activating..', 'astra-sites' ),
263
- 'activating' => __( 'Activating..', 'astra-sites' ),
264
- 'activated' => __( 'Activated! Reloading..', 'astra-sites' ),
265
- 'installing' => __( 'Installing..', 'astra-sites' ),
266
- 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
267
- )
268
- );
269
- wp_localize_script( 'astra-sites-install-theme', 'AstraSitesInstallThemeVars', $data );
270
-
271
- if ( 'appearance_page_astra-sites' !== $hook ) {
272
- return;
273
- }
274
-
275
- global $is_IE, $is_edge;
276
-
277
- if ( $is_IE || $is_edge ) {
278
- wp_enqueue_script( 'astra-sites-eventsource', ASTRA_SITES_URI . 'inc/assets/js/eventsource.min.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_SITES_VER, true );
279
- }
280
-
281
- // Fetch.
282
- wp_register_script( 'astra-sites-fetch', ASTRA_SITES_URI . 'inc/assets/js/fetch.umd.js', array( 'jquery' ), ASTRA_SITES_VER, true );
283
-
284
- // API.
285
- wp_register_script( 'astra-sites-api', ASTRA_SITES_URI . 'inc/assets/js/astra-sites-api.js', array( 'jquery', 'astra-sites-fetch' ), ASTRA_SITES_VER, true );
286
-
287
- // Admin Page.
288
- wp_enqueue_style( 'astra-sites-admin', ASTRA_SITES_URI . 'inc/assets/css/admin.css', ASTRA_SITES_VER, true );
289
- wp_enqueue_script( 'astra-sites-admin-page', ASTRA_SITES_URI . 'inc/assets/js/admin-page.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_SITES_VER, true );
290
- wp_enqueue_script( 'astra-sites-render-grid', ASTRA_SITES_URI . 'inc/assets/js/render-grid.js', array( 'wp-util', 'astra-sites-api', 'imagesloaded', 'jquery' ), ASTRA_SITES_VER, true );
291
-
292
- $data = apply_filters(
293
- 'astra_sites_localize_vars',
294
- array(
295
- 'ApiURL' => self::$api_url,
296
- 'filters' => array(
297
- 'page_builder' => array(
298
- 'title' => __( 'Page Builder', 'astra-sites' ),
299
- 'slug' => 'astra-site-page-builder',
300
- 'trigger' => 'astra-api-category-loaded',
301
- ),
302
- 'categories' => array(
303
- 'title' => __( 'Categories', 'astra-sites' ),
304
- 'slug' => 'astra-site-category',
305
- 'trigger' => 'astra-api-category-loaded',
306
- ),
307
- ),
308
- )
309
- );
310
- wp_localize_script( 'astra-sites-api', 'astraSitesApi', $data );
311
-
312
- // Use this for premium demos.
313
- $request_params = apply_filters(
314
- 'astra_sites_api_params',
315
- array(
316
- 'purchase_key' => '',
317
- 'site_url' => '',
318
- 'par-page' => 30,
319
- )
320
- );
321
-
322
- $data = apply_filters(
323
- 'astra_sites_render_localize_vars',
324
- array(
325
- 'sites' => $request_params,
326
- 'page-builders' => array(),
327
- 'categories' => array(),
328
- 'settings' => array(),
329
- 'default_page_builder' => Astra_Sites_Page::get_instance()->get_setting( 'page_builder' ),
330
- )
331
- );
332
-
333
- wp_localize_script( 'astra-sites-render-grid', 'astraRenderGrid', $data );
334
-
335
- $data = apply_filters(
336
- 'astra_sites_localize_vars',
337
- array(
338
- 'debug' => ( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || isset( $_GET['debug'] ) ) ? true : false,
339
- 'isPro' => defined( 'ASTRA_PRO_SITES_NAME' ) ? true : false,
340
- 'isWhiteLabeled' => Astra_Sites_White_Label::get_instance()->is_white_labeled(),
341
- 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
342
- 'siteURL' => site_url(),
343
- 'docUrl' => 'https://wpastra.com/',
344
- 'getProText' => __( 'Get Agency Bundle', 'astra-sites' ),
345
- 'getProURL' => esc_url( 'https://wpastra.com/agency/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=wp-dashboard' ),
346
- 'getUpgradeText' => __( 'Upgrade', 'astra-sites' ),
347
- 'getUpgradeURL' => esc_url( 'https://wpastra.com/agency/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=wp-dashboard' ),
348
- '_ajax_nonce' => wp_create_nonce( 'astra-sites' ),
349
- 'requiredPlugins' => array(),
350
- 'XMLReaderDisabled' => ! class_exists( 'XMLReader' ) ? true : false,
351
- 'strings' => array(
352
- /* translators: %s are HTML tags. */
353
- 'warningXMLReader' => sprintf( __( '%1$sRequired XMLReader PHP extension is missing on your server!%2$sAstra Sites import requires XMLReader extension to be installed. Please contact your web hosting provider and ask them to install and activate the XMLReader PHP extension.', 'astra-sites' ), '<div class="notice astra-sites-xml-notice notice-error"><p><b>', '</b></p><p>', '</p></div>' ),
354
- 'warningBeforeCloseWindow' => __( 'Warning! Astra Site Import process is not complete. Don\'t close the window until import process complete. Do you still want to leave the window?', 'astra-sites' ),
355
- 'importFailedBtnSmall' => __( 'Error!', 'astra-sites' ),
356
- 'importFailedBtnLarge' => __( 'Error! Read Possibilities.', 'astra-sites' ),
357
- 'importFailedURL' => esc_url( 'https://wpastra.com/docs/?p=1314&utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=import-failed' ),
358
- 'viewSite' => __( 'Done! View Site', 'astra-sites' ),
359
- 'btnActivating' => __( 'Activating', 'astra-sites' ) . '&hellip;',
360
- 'btnActive' => __( 'Active', 'astra-sites' ),
361
- 'importFailBtn' => __( 'Import failed.', 'astra-sites' ),
362
- 'importFailBtnLarge' => __( 'Import failed. See error log.', 'astra-sites' ),
363
- 'importDemo' => __( 'Import This Site', 'astra-sites' ),
364
- 'importingDemo' => __( 'Importing..', 'astra-sites' ),
365
- 'DescExpand' => __( 'Read more', 'astra-sites' ) . '&hellip;',
366
- 'DescCollapse' => __( 'Hide', 'astra-sites' ),
367
- 'responseError' => __( 'There was a problem receiving a response from server.', 'astra-sites' ),
368
- 'searchNoFound' => __( 'No Demos found, Try a different search.', 'astra-sites' ),
369
- ),
370
- 'log' => array(
371
- 'installingPlugin' => __( 'Installing plugin ', 'astra-sites' ),
372
- 'installed' => __( 'Plugin installed!', 'astra-sites' ),
373
- 'activating' => __( 'Activating plugin ', 'astra-sites' ),
374
- 'activated' => __( 'Plugin activated ', 'astra-sites' ),
375
- 'bulkActivation' => __( 'Bulk plugin activation...', 'astra-sites' ),
376
- 'activate' => __( 'Plugin activate - ', 'astra-sites' ),
377
- 'activationError' => __( 'Error! While activating plugin - ', 'astra-sites' ),
378
- 'bulkInstall' => __( 'Bulk plugin installation...', 'astra-sites' ),
379
- 'api' => __( 'Site API ', 'astra-sites' ),
380
- 'importing' => __( 'Importing..', 'astra-sites' ),
381
- 'processingRequest' => __( 'Processing requests...', 'astra-sites' ),
382
- 'importCustomizer' => __( 'Importing "Customizer Settings"...', 'astra-sites' ),
383
- 'importCustomizerSuccess' => __( 'Imported customizer settings!', 'astra-sites' ),
384
- 'importWPForms' => __( 'Importing "Contact Forms"...', 'astra-sites' ),
385
- 'importWPFormsSuccess' => __( 'Imported Contact Forms!', 'astra-sites' ),
386
- 'importXMLPrepare' => __( 'Preparing "XML" Data...', 'astra-sites' ),
387
- 'importXMLPrepareSuccess' => __( 'Set XML data!', 'astra-sites' ),
388
- 'importXML' => __( 'Importing "XML"...', 'astra-sites' ),
389
- 'importXMLSuccess' => __( 'Imported XML!', 'astra-sites' ),
390
- 'importOptions' => __( 'Importing "Options"...', 'astra-sites' ),
391
- 'importOptionsSuccess' => __( 'Imported Options!', 'astra-sites' ),
392
- 'importWidgets' => __( 'Importing "Widgets"...', 'astra-sites' ),
393
- 'importWidgetsSuccess' => __( 'Imported Widgets!', 'astra-sites' ),
394
- 'serverConfiguration' => esc_url( 'https://wpastra.com/docs/?p=1314&utm_source=demo-import-panel&utm_campaign=import-error&utm_medium=wp-dashboard' ),
395
- 'success' => __( 'View site: ', 'astra-sites' ),
396
- 'gettingData' => __( 'Getting Site Information..', 'astra-sites' ),
397
- 'importingCustomizer' => __( 'Importing Customizer Settings..', 'astra-sites' ),
398
- 'importingWPForms' => __( 'Importing Contact Forms..', 'astra-sites' ),
399
- 'importXMLPreparing' => __( 'Setting up import data..', 'astra-sites' ),
400
- 'importingXML' => __( 'Importing Content..', 'astra-sites' ),
401
- 'importingOptions' => __( 'Importing Site Options..', 'astra-sites' ),
402
- 'importingWidgets' => __( 'Importing Widgets..', 'astra-sites' ),
403
- 'importComplete' => __( 'Import Complete..', 'astra-sites' ),
404
- 'preview' => __( 'Previewing ', 'astra-sites' ),
405
- 'importLogText' => __( 'See Error Log &rarr;', 'astra-sites' ),
406
- ),
407
- )
408
- );
409
-
410
- wp_localize_script( 'astra-sites-admin-page', 'astraSitesAdmin', $data );
411
-
412
- }
413
-
414
- /**
415
- * Load all the required files in the importer.
416
- *
417
- * @since 1.0.0
418
- */
419
- private function includes() {
420
-
421
- require_once ASTRA_SITES_DIR . 'inc/lib/astra-notices/class-astra-notices.php';
422
- require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-white-label.php';
423
- require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-page.php';
424
- require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/class-astra-sites-compatibility.php';
425
- require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-importer.php';
426
- }
427
-
428
- /**
429
- * Required Plugin Activate
430
- *
431
- * @since 1.0.0
432
- */
433
- public function required_plugin_activate() {
434
-
435
- if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! $_POST['init'] ) {
436
- wp_send_json_error(
437
- array(
438
- 'success' => false,
439
- 'message' => __( 'No plugin specified', 'astra-sites' ),
440
- )
441
- );
442
- }
443
-
444
- $data = array();
445
- $plugin_init = ( isset( $_POST['init'] ) ) ? esc_attr( $_POST['init'] ) : '';
446
- $astra_site_options = ( isset( $_POST['options'] ) ) ? json_decode( stripslashes( $_POST['options'] ) ) : '';
447
- $enabled_extensions = ( isset( $_POST['enabledExtensions'] ) ) ? json_decode( stripslashes( $_POST['enabledExtensions'] ) ) : '';
448
-
449
- $data['astra_site_options'] = $astra_site_options;
450
- $data['enabled_extensions'] = $enabled_extensions;
451
-
452
- $activate = activate_plugin( $plugin_init, '', false, true );
453
-
454
- if ( is_wp_error( $activate ) ) {
455
- wp_send_json_error(
456
- array(
457
- 'success' => false,
458
- 'message' => $activate->get_error_message(),
459
- )
460
- );
461
- }
462
-
463
- do_action( 'astra_sites_after_plugin_activation', $plugin_init, $data );
464
-
465
- wp_send_json_success(
466
- array(
467
- 'success' => true,
468
- 'message' => __( 'Plugin Activated', 'astra-sites' ),
469
- )
470
- );
471
-
472
- }
473
-
474
- /**
475
- * Required Plugin
476
- *
477
- * @since 1.0.0
478
- * @return void
479
- */
480
- public function required_plugin() {
481
-
482
- // Verify Nonce.
483
- check_ajax_referer( 'astra-sites', '_ajax_nonce' );
484
-
485
- $response = array(
486
- 'active' => array(),
487
- 'inactive' => array(),
488
- 'notinstalled' => array(),
489
- );
490
-
491
- if ( ! current_user_can( 'customize' ) ) {
492
- wp_send_json_error( $response );
493
- }
494
-
495
- $required_plugins = ( isset( $_POST['required_plugins'] ) ) ? $_POST['required_plugins'] : array();
496
- $third_party_required_plugins = array();
497
- $third_party_plugins = array(
498
- 'learndash-course-grid' => array(
499
- 'init' => 'learndash-course-grid/learndash_course_grid.php',
500
- 'name' => 'LearnDash Course Grid',
501
- 'link' => 'https://www.learndash.com/add-on/course-grid/',
502
- ),
503
- 'sfwd-lms' => array(
504
- 'init' => 'sfwd-lms/sfwd_lms.php',
505
- 'name' => 'LearnDash LMS',
506
- 'link' => 'https://www.learndash.com/',
507
- ),
508
- 'learndash-woocommerce' => array(
509
- 'init' => 'learndash-woocommerce/learndash_woocommerce.php',
510
- 'name' => 'LearnDash WooCommerce Integration',
511
- 'link' => 'https://www.learndash.com/add-on/woocommerce/',
512
- ),
513
- );
514
-
515
- if ( count( $required_plugins ) > 0 ) {
516
- foreach ( $required_plugins as $key => $plugin ) {
517
-
518
- /**
519
- * Has Pro Version Support?
520
- * And
521
- * Is Pro Version Installed?
522
- */
523
- $plugin_pro = self::pro_plugin_exist( $plugin['init'] );
524
- if ( $plugin_pro ) {
525
-
526
- // Pro - Active.
527
- if ( is_plugin_active( $plugin_pro['init'] ) ) {
528
- $response['active'][] = $plugin_pro;
529
-
530
- // Pro - Inactive.
531
- } else {
532
- $response['inactive'][] = $plugin_pro;
533
- }
534
- } else {
535
-
536
- // Lite - Installed but Inactive.
537
- if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin['init'] ) && is_plugin_inactive( $plugin['init'] ) ) {
538
-
539
- $response['inactive'][] = $plugin;
540
-
541
- // Lite - Not Installed.
542
- } elseif ( ! file_exists( WP_PLUGIN_DIR . '/' . $plugin['init'] ) ) {
543
-
544
- $response['notinstalled'][] = $plugin;
545
-
546
- // Added premium plugins which need to install first.
547
- if ( array_key_exists( $plugin['slug'], $third_party_plugins ) ) {
548
- $third_party_required_plugins[] = $third_party_plugins[ $plugin['slug'] ];
549
- }
550
-
551
- // Lite - Active.
552
- } else {
553
- $response['active'][] = $plugin;
554
- }
555
- }
556
- }
557
- }
558
-
559
- // Send response.
560
- wp_send_json_success(
561
- array(
562
- 'required_plugins' => $response,
563
- 'third_party_required_plugins' => $third_party_required_plugins,
564
- )
565
- );
566
- }
567
-
568
- /**
569
- * Has Pro Version Support?
570
- * And
571
- * Is Pro Version Installed?
572
- *
573
- * Check Pro plugin version exist of requested plugin lite version.
574
- *
575
- * Eg. If plugin 'BB Lite Version' required to import demo. Then we check the 'BB Agency Version' is exist?
576
- * If yes then we only 'Activate' Agency Version. [We couldn't install agency version.]
577
- * Else we 'Activate' or 'Install' Lite Version.
578
- *
579
- * @since 1.0.1
580
- *
581
- * @param string $lite_version Lite version init file.
582
- * @return mixed Return false if not installed or not supported by us
583
- * else return 'Pro' version details.
584
- */
585
- public static function pro_plugin_exist( $lite_version = '' ) {
586
-
587
- // Lite init => Pro init.
588
- $plugins = apply_filters(
589
- 'astra_sites_pro_plugin_exist',
590
- array(
591
- 'beaver-builder-lite-version/fl-builder.php' => array(
592
- 'slug' => 'bb-plugin',
593
- 'init' => 'bb-plugin/fl-builder.php',
594
- 'name' => 'Beaver Builder Plugin',
595
- ),
596
- 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' => array(
597
- 'slug' => 'bb-ultimate-addon',
598
- 'init' => 'bb-ultimate-addon/bb-ultimate-addon.php',
599
- 'name' => 'Ultimate Addon for Beaver Builder',
600
- ),
601
- 'wpforms-lite/wpforms.php' => array(
602
- 'slug' => 'wpforms',
603
- 'init' => 'wpforms/wpforms.php',
604
- 'name' => 'WPForms',
605
- ),
606
- ),
607
- $lite_version
608
- );
609
-
610
- if ( isset( $plugins[ $lite_version ] ) ) {
611
-
612
- // Pro plugin directory exist?
613
- if ( file_exists( WP_PLUGIN_DIR . '/' . $plugins[ $lite_version ]['init'] ) ) {
614
- return $plugins[ $lite_version ];
615
- }
616
- }
617
-
618
- return false;
619
- }
620
-
621
- }
622
-
623
- /**
624
- * Kicking this off by calling 'get_instance()' method
625
- */
626
- Astra_Sites::get_instance();
627
-
628
- endif;
1
+ <?php
2
+ /**
3
+ * Astra Sites
4
+ *
5
+ * @since 1.0.0
6
+ * @package Astra Sites
7
+ */
8
+
9
+ defined( 'ABSPATH' ) or exit;
10
+
11
+ if ( ! class_exists( 'Astra_Sites' ) ) :
12
+
13
+ /**
14
+ * Astra_Sites
15
+ */
16
+ class Astra_Sites {
17
+
18
+ /**
19
+ * API URL which is used to get the response from.
20
+ *
21
+ * @since 1.0.0
22
+ * @var (String) URL
23
+ */
24
+ public static $api_url;
25
+
26
+ /**
27
+ * Instance of Astra_Sites
28
+ *
29
+ * @since 1.0.0
30
+ * @var (Object) Astra_Sites
31
+ */
32
+ private static $_instance = null;
33
+
34
+ /**
35
+ * Instance of Astra_Sites.
36
+ *
37
+ * @since 1.0.0
38
+ *
39
+ * @return object Class object.
40
+ */
41
+ public static function get_instance() {
42
+ if ( ! isset( self::$_instance ) ) {
43
+ self::$_instance = new self;
44
+ }
45
+
46
+ return self::$_instance;
47
+ }
48
+
49
+ /**
50
+ * Constructor.
51
+ *
52
+ * @since 1.0.0
53
+ */
54
+ private function __construct() {
55
+
56
+ self::set_api_url();
57
+
58
+ $this->includes();
59
+
60
+ add_action( 'admin_notices', array( $this, 'add_notice' ), 1 );
61
+ add_action( 'admin_notices', array( $this, 'admin_notices' ) );
62
+ add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
63
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue' ) );
64
+
65
+ // AJAX.
66
+ add_action( 'wp_ajax_astra-required-plugins', array( $this, 'required_plugin' ) );
67
+ add_action( 'wp_ajax_astra-required-plugin-activate', array( $this, 'required_plugin_activate' ) );
68
+ add_action( 'wp_ajax_astra-sites-backup-settings', array( $this, 'backup_settings' ) );
69
+ add_action( 'wp_ajax_astra-sites-set-reset-data', array( $this, 'set_reset_data' ) );
70
+ add_action( 'wp_ajax_astra-sites-activate-theme', array( $this, 'activate_theme' ) );
71
+ add_action( 'wp_ajax_astra-sites-getting-started-notice', array( $this, 'getting_started_notice' ) );
72
+ }
73
+
74
+ /**
75
+ * Close getting started notice for current user
76
+ *
77
+ * @since 1.3.5
78
+ * @return void
79
+ */
80
+ function getting_started_notice() {
81
+ update_user_meta( get_current_user_id(), '_astra_sites_gettings_started', true );
82
+ wp_send_json_success();
83
+ }
84
+
85
+ /**
86
+ * Activate theme
87
+ *
88
+ * @since 1.3.2
89
+ * @return void
90
+ */
91
+ function activate_theme() {
92
+
93
+ switch_theme( 'astra' );
94
+
95
+ wp_send_json_success(
96
+ array(
97
+ 'success' => true,
98
+ 'message' => __( 'Theme Activated', 'astra-sites' ),
99
+ )
100
+ );
101
+ }
102
+
103
+ /**
104
+ * Set reset data
105
+ */
106
+ function set_reset_data() {
107
+ if ( ! current_user_can( 'manage_options' ) ) {
108
+ return;
109
+ }
110
+
111
+ global $wpdb;
112
+
113
+ $post_ids = $wpdb->get_col( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_astra_sites_imported_post'" );
114
+ $form_ids = $wpdb->get_col( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_astra_sites_imported_wp_forms'" );
115
+ $term_ids = $wpdb->get_col( "SELECT term_id FROM {$wpdb->termmeta} WHERE meta_key='_astra_sites_imported_term'" );
116
+
117
+ wp_send_json_success(
118
+ array(
119
+ 'reset_posts' => $post_ids,
120
+ 'reset_wp_forms' => $form_ids,
121
+ 'reset_terms' => $term_ids,
122
+ )
123
+ );
124
+ }
125
+
126
+ /**
127
+ * Backup our existing settings.
128
+ */
129
+ function backup_settings() {
130
+ if ( ! current_user_can( 'manage_options' ) ) {
131
+ return;
132
+ }
133
+
134
+ $file_name = 'astra-sites-backup-' . date( 'd-M-Y-h-i-s' ) . '.json';
135
+ $old_settings = get_option( 'astra-settings', array() );
136
+ $upload_dir = Astra_Sites_Importer_Log::get_instance()->log_dir();
137
+ $upload_path = trailingslashit( $upload_dir['path'] );
138
+ $log_file = $upload_path . $file_name;
139
+ $file_system = Astra_Sites_Importer_Log::get_instance()->get_filesystem();
140
+
141
+ // If file system fails? Then take a backup in site option.
142
+ if ( false === $file_system->put_contents( $log_file, json_encode( $old_settings ), FS_CHMOD_FILE ) ) {
143
+ update_option( 'astra_sites_' . $file_name, $old_settings );
144
+ }
145
+
146
+ wp_send_json_success();
147
+ }
148
+
149
+ /**
150
+ * Add Admin Notice.
151
+ */
152
+ function add_notice() {
153
+
154
+ $theme_status = 'astra-sites-theme-' . $this->get_theme_status();
155
+
156
+ Astra_Notices::add_notice(
157
+ array(
158
+ 'id' => 'astra-theme-activation-nag',
159
+ 'type' => 'error',
160
+ 'show_if' => ( ! defined( 'ASTRA_THEME_SETTINGS' ) ) ? true : false,
161
+ /* translators: 1: theme.php file*/
162
+ 'message' => sprintf( __( '<p>Astra Theme needs to be active for you to use currently installed "%1$s" plugin. <a href="#" class="%3$s" data-theme-slug="astra">Install & Activate Now</a></p>', 'astra-sites' ), ASTRA_SITES_NAME, esc_url( admin_url( 'themes.php?theme=astra' ) ), $theme_status ),
163
+ 'dismissible' => true,
164
+ 'dismissible-time' => WEEK_IN_SECONDS,
165
+ )
166
+ );
167
+ }
168
+
169
+ /**
170
+ * Get theme install, active or inactive status.
171
+ *
172
+ * @since 1.3.2
173
+ *
174
+ * @return string Theme status
175
+ */
176
+ function get_theme_status() {
177
+
178
+ $theme = wp_get_theme();
179
+
180
+ // Theme installed and activate.
181
+ if ( 'Astra' === $theme->name || 'Astra' === $theme->parent_theme ) {
182
+ return 'installed-and-active';
183
+ }
184
+
185
+ // Theme installed but not activate.
186
+ foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
187
+ if ( 'Astra' === $theme->name || 'Astra' === $theme->parent_theme ) {
188
+ return 'installed-but-inactive';
189
+ }
190
+ }
191
+
192
+ return 'not-installed';
193
+ }
194
+
195
+ /**
196
+ * Loads textdomain for the plugin.
197
+ *
198
+ * @since 1.0.1
199
+ */
200
+ function load_textdomain() {
201
+ load_plugin_textdomain( 'astra-sites' );
202
+ }
203
+
204
+ /**
205
+ * Admin Notices
206
+ *
207
+ * @since 1.0.5
208
+ * @return void
209
+ */
210
+ function admin_notices() {
211
+
212
+ if ( ! defined( 'ASTRA_THEME_SETTINGS' ) ) {
213
+ return;
214
+ }
215
+
216
+ add_action( 'plugin_action_links_' . ASTRA_SITES_BASE, array( $this, 'action_links' ) );
217
+ }
218
+
219
+ /**
220
+ * Show action links on the plugin screen.
221
+ *
222
+ * @param mixed $links Plugin Action links.
223
+ * @return array
224
+ */
225
+ function action_links( $links ) {
226
+ $action_links = array(
227
+ 'settings' => '<a href="' . admin_url( 'themes.php?page=astra-sites' ) . '" aria-label="' . esc_attr__( 'See Library', 'astra-sites' ) . '">' . esc_html__( 'See Library', 'astra-sites' ) . '</a>',
228
+ );
229
+
230
+ return array_merge( $action_links, $links );
231
+ }
232
+
233
+ /**
234
+ * Setter for $api_url
235
+ *
236
+ * @since 1.0.0
237
+ */
238
+ public static function set_api_url() {
239
+ self::$api_url = apply_filters( 'astra_sites_api_url', 'https://websitedemos.net/wp-json/wp/v2/' );
240
+
241
+ }
242
+
243
+ /**
244
+ * Enqueue admin scripts.
245
+ *
246
+ * @since 1.3.2 Added 'install-theme.js' to install and activate theme.
247
+ * @since 1.0.5 Added 'getUpgradeText' and 'getUpgradeURL' localize variables.
248
+ *
249
+ * @since 1.0.0
250
+ *
251
+ * @param string $hook Current hook name.
252
+ * @return void
253
+ */
254
+ public function admin_enqueue( $hook = '' ) {
255
+
256
+ wp_enqueue_script( 'astra-sites-install-theme', ASTRA_SITES_URI . 'inc/assets/js/install-theme.js', array( 'jquery', 'updates' ), ASTRA_SITES_VER, true );
257
+ wp_enqueue_style( 'astra-sites-install-theme', ASTRA_SITES_URI . 'inc/assets/css/install-theme.css', null, ASTRA_SITES_VER, 'all' );
258
+
259
+ $data = apply_filters(
260
+ 'astra_sites_install_theme_localize_vars',
261
+ array(
262
+ 'installed' => __( 'Installed! Activating..', 'astra-sites' ),
263
+ 'activating' => __( 'Activating..', 'astra-sites' ),
264
+ 'activated' => __( 'Activated! Reloading..', 'astra-sites' ),
265
+ 'installing' => __( 'Installing..', 'astra-sites' ),
266
+ 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
267
+ )
268
+ );
269
+ wp_localize_script( 'astra-sites-install-theme', 'AstraSitesInstallThemeVars', $data );
270
+
271
+ if ( 'appearance_page_astra-sites' !== $hook ) {
272
+ return;
273
+ }
274
+
275
+ global $is_IE, $is_edge;
276
+
277
+ if ( $is_IE || $is_edge ) {
278
+ wp_enqueue_script( 'astra-sites-eventsource', ASTRA_SITES_URI . 'inc/assets/js/eventsource.min.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_SITES_VER, true );
279
+ }
280
+
281
+ // Fetch.
282
+ wp_register_script( 'astra-sites-fetch', ASTRA_SITES_URI . 'inc/assets/js/fetch.umd.js', array( 'jquery' ), ASTRA_SITES_VER, true );
283
+
284
+ // API.
285
+ wp_register_script( 'astra-sites-api', ASTRA_SITES_URI . 'inc/assets/js/astra-sites-api.js', array( 'jquery', 'astra-sites-fetch' ), ASTRA_SITES_VER, true );
286
+
287
+ // Admin Page.
288
+ wp_enqueue_style( 'astra-sites-admin', ASTRA_SITES_URI . 'inc/assets/css/admin.css', ASTRA_SITES_VER, true );
289
+ wp_enqueue_script( 'astra-sites-admin-page', ASTRA_SITES_URI . 'inc/assets/js/admin-page.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_SITES_VER, true );
290
+ wp_enqueue_script( 'astra-sites-render-grid', ASTRA_SITES_URI . 'inc/assets/js/render-grid.js', array( 'wp-util', 'astra-sites-api', 'imagesloaded', 'jquery' ), ASTRA_SITES_VER, true );
291
+
292
+ $data = apply_filters(
293
+ 'astra_sites_localize_vars',
294
+ array(
295
+ 'ApiURL' => self::$api_url,
296
+ 'filters' => array(
297
+ 'page_builder' => array(
298
+ 'title' => __( 'Page Builder', 'astra-sites' ),
299
+ 'slug' => 'astra-site-page-builder',
300
+ 'trigger' => 'astra-api-category-loaded',
301
+ ),
302
+ 'categories' => array(
303
+ 'title' => __( 'Categories', 'astra-sites' ),
304
+ 'slug' => 'astra-site-category',
305
+ 'trigger' => 'astra-api-category-loaded',
306
+ ),
307
+ ),
308
+ )
309
+ );
310
+ wp_localize_script( 'astra-sites-api', 'astraSitesApi', $data );
311
+
312
+ // Use this for premium demos.
313
+ $request_params = apply_filters(
314
+ 'astra_sites_api_params',
315
+ array(
316
+ 'purchase_key' => '',
317
+ 'site_url' => '',
318
+ 'par-page' => 30,
319
+ )
320
+ );
321
+
322
+ $data = apply_filters(
323
+ 'astra_sites_render_localize_vars',
324
+ array(
325
+ 'sites' => $request_params,
326
+ 'page-builders' => array(),
327
+ 'categories' => array(),
328
+ 'settings' => array(),
329
+ 'default_page_builder' => Astra_Sites_Page::get_instance()->get_setting( 'page_builder' ),
330
+ )
331
+ );
332
+
333
+ wp_localize_script( 'astra-sites-render-grid', 'astraRenderGrid', $data );
334
+
335
+ $data = apply_filters(
336
+ 'astra_sites_localize_vars',
337
+ array(
338
+ 'debug' => ( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || isset( $_GET['debug'] ) ) ? true : false,
339
+ 'isPro' => defined( 'ASTRA_PRO_SITES_NAME' ) ? true : false,
340
+ 'isWhiteLabeled' => Astra_Sites_White_Label::get_instance()->is_white_labeled(),
341
+ 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
342
+ 'siteURL' => site_url(),
343
+ 'docUrl' => 'https://wpastra.com/',
344
+ 'getProText' => __( 'Get Agency Bundle', 'astra-sites' ),
345
+ 'getProURL' => esc_url( 'https://wpastra.com/agency/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=wp-dashboard' ),
346
+ 'getUpgradeText' => __( 'Upgrade', 'astra-sites' ),
347
+ 'getUpgradeURL' => esc_url( 'https://wpastra.com/agency/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=wp-dashboard' ),
348
+ '_ajax_nonce' => wp_create_nonce( 'astra-sites' ),
349
+ 'requiredPlugins' => array(),
350
+ 'XMLReaderDisabled' => ! class_exists( 'XMLReader' ) ? true : false,
351
+ 'strings' => array(
352
+ /* translators: %s are HTML tags. */
353
+ 'warningXMLReader' => sprintf( __( '%1$sRequired XMLReader PHP extension is missing on your server!%2$sAstra Sites import requires XMLReader extension to be installed. Please contact your web hosting provider and ask them to install and activate the XMLReader PHP extension.', 'astra-sites' ), '<div class="notice astra-sites-xml-notice notice-error"><p><b>', '</b></p><p>', '</p></div>' ),
354
+ 'warningBeforeCloseWindow' => __( 'Warning! Astra Site Import process is not complete. Don\'t close the window until import process complete. Do you still want to leave the window?', 'astra-sites' ),
355
+ 'importFailedBtnSmall' => __( 'Error!', 'astra-sites' ),
356
+ 'importFailedBtnLarge' => __( 'Error! Read Possibilities.', 'astra-sites' ),
357
+ 'importFailedURL' => esc_url( 'https://wpastra.com/docs/?p=1314&utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=import-failed' ),
358
+ 'viewSite' => __( 'Done! View Site', 'astra-sites' ),
359
+ 'btnActivating' => __( 'Activating', 'astra-sites' ) . '&hellip;',
360
+ 'btnActive' => __( 'Active', 'astra-sites' ),
361
+ 'importFailBtn' => __( 'Import failed.', 'astra-sites' ),
362
+ 'importFailBtnLarge' => __( 'Import failed. See error log.', 'astra-sites' ),
363
+ 'importDemo' => __( 'Import This Site', 'astra-sites' ),
364
+ 'importingDemo' => __( 'Importing..', 'astra-sites' ),
365
+ 'DescExpand' => __( 'Read more', 'astra-sites' ) . '&hellip;',
366
+ 'DescCollapse' => __( 'Hide', 'astra-sites' ),
367
+ 'responseError' => __( 'There was a problem receiving a response from server.', 'astra-sites' ),
368
+ 'searchNoFound' => __( 'No Demos found, Try a different search.', 'astra-sites' ),
369
+ ),
370
+ 'log' => array(
371
+ 'installingPlugin' => __( 'Installing plugin ', 'astra-sites' ),
372
+ 'installed' => __( 'Plugin installed!', 'astra-sites' ),
373
+ 'activating' => __( 'Activating plugin ', 'astra-sites' ),
374
+ 'activated' => __( 'Plugin activated ', 'astra-sites' ),
375
+ 'bulkActivation' => __( 'Bulk plugin activation...', 'astra-sites' ),
376
+ 'activate' => __( 'Plugin activate - ', 'astra-sites' ),
377
+ 'activationError' => __( 'Error! While activating plugin - ', 'astra-sites' ),
378
+ 'bulkInstall' => __( 'Bulk plugin installation...', 'astra-sites' ),
379
+ 'api' => __( 'Site API ', 'astra-sites' ),
380
+ 'importing' => __( 'Importing..', 'astra-sites' ),
381
+ 'processingRequest' => __( 'Processing requests...', 'astra-sites' ),
382
+ 'importCustomizer' => __( 'Importing "Customizer Settings"...', 'astra-sites' ),
383
+ 'importCustomizerSuccess' => __( 'Imported customizer settings!', 'astra-sites' ),
384
+ 'importWPForms' => __( 'Importing "Contact Forms"...', 'astra-sites' ),
385
+ 'importWPFormsSuccess' => __( 'Imported Contact Forms!', 'astra-sites' ),
386
+ 'importXMLPrepare' => __( 'Preparing "XML" Data...', 'astra-sites' ),
387
+ 'importXMLPrepareSuccess' => __( 'Set XML data!', 'astra-sites' ),
388
+ 'importXML' => __( 'Importing "XML"...', 'astra-sites' ),
389
+ 'importXMLSuccess' => __( 'Imported XML!', 'astra-sites' ),
390
+ 'importOptions' => __( 'Importing "Options"...', 'astra-sites' ),
391
+ 'importOptionsSuccess' => __( 'Imported Options!', 'astra-sites' ),
392
+ 'importWidgets' => __( 'Importing "Widgets"...', 'astra-sites' ),
393
+ 'importWidgetsSuccess' => __( 'Imported Widgets!', 'astra-sites' ),
394
+ 'serverConfiguration' => esc_url( 'https://wpastra.com/docs/?p=1314&utm_source=demo-import-panel&utm_campaign=import-error&utm_medium=wp-dashboard' ),
395
+ 'success' => __( 'View site: ', 'astra-sites' ),
396
+ 'gettingData' => __( 'Getting Site Information..', 'astra-sites' ),
397
+ 'importingCustomizer' => __( 'Importing Customizer Settings..', 'astra-sites' ),
398
+ 'importingWPForms' => __( 'Importing Contact Forms..', 'astra-sites' ),
399
+ 'importXMLPreparing' => __( 'Setting up import data..', 'astra-sites' ),
400
+ 'importingXML' => __( 'Importing Content..', 'astra-sites' ),
401
+ 'importingOptions' => __( 'Importing Site Options..', 'astra-sites' ),
402
+ 'importingWidgets' => __( 'Importing Widgets..', 'astra-sites' ),
403
+ 'importComplete' => __( 'Import Complete..', 'astra-sites' ),
404
+ 'preview' => __( 'Previewing ', 'astra-sites' ),
405
+ 'importLogText' => __( 'See Error Log &rarr;', 'astra-sites' ),
406
+ ),
407
+ )
408
+ );
409
+
410
+ wp_localize_script( 'astra-sites-admin-page', 'astraSitesAdmin', $data );
411
+
412
+ }
413
+
414
+ /**
415
+ * Load all the required files in the importer.
416
+ *
417
+ * @since 1.0.0
418
+ */
419
+ private function includes() {
420
+
421
+ require_once ASTRA_SITES_DIR . 'inc/lib/astra-notices/class-astra-notices.php';
422
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-white-label.php';
423
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-page.php';
424
+ require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/class-astra-sites-compatibility.php';
425
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-importer.php';
426
+ }
427
+
428
+ /**
429
+ * Required Plugin Activate
430
+ *
431
+ * @since 1.0.0
432
+ */
433
+ public function required_plugin_activate() {
434
+
435
+ if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! $_POST['init'] ) {
436
+ wp_send_json_error(
437
+ array(
438
+ 'success' => false,
439
+ 'message' => __( 'No plugin specified', 'astra-sites' ),
440
+ )
441
+ );
442
+ }
443
+
444
+ $data = array();
445
+ $plugin_init = ( isset( $_POST['init'] ) ) ? esc_attr( $_POST['init'] ) : '';
446
+ $astra_site_options = ( isset( $_POST['options'] ) ) ? json_decode( stripslashes( $_POST['options'] ) ) : '';
447
+ $enabled_extensions = ( isset( $_POST['enabledExtensions'] ) ) ? json_decode( stripslashes( $_POST['enabledExtensions'] ) ) : '';
448
+
449
+ $data['astra_site_options'] = $astra_site_options;
450
+ $data['enabled_extensions'] = $enabled_extensions;
451
+
452
+ $activate = activate_plugin( $plugin_init, '', false, true );
453
+
454
+ if ( is_wp_error( $activate ) ) {
455
+ wp_send_json_error(
456
+ array(
457
+ 'success' => false,
458
+ 'message' => $activate->get_error_message(),
459
+ )
460
+ );
461
+ }
462
+
463
+ do_action( 'astra_sites_after_plugin_activation', $plugin_init, $data );
464
+
465
+ wp_send_json_success(
466
+ array(
467
+ 'success' => true,
468
+ 'message' => __( 'Plugin Activated', 'astra-sites' ),
469
+ )
470
+ );
471
+
472
+ }
473
+
474
+ /**
475
+ * Required Plugin
476
+ *
477
+ * @since 1.0.0
478
+ * @return void
479
+ */
480
+ public function required_plugin() {
481
+
482
+ // Verify Nonce.
483
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
484
+
485
+ $response = array(
486
+ 'active' => array(),
487
+ 'inactive' => array(),
488
+ 'notinstalled' => array(),
489
+ );
490
+
491
+ if ( ! current_user_can( 'customize' ) ) {
492
+ wp_send_json_error( $response );
493
+ }
494
+
495
+ $required_plugins = ( isset( $_POST['required_plugins'] ) ) ? $_POST['required_plugins'] : array();
496
+ $third_party_required_plugins = array();
497
+ $third_party_plugins = array(
498
+ 'learndash-course-grid' => array(
499
+ 'init' => 'learndash-course-grid/learndash_course_grid.php',
500
+ 'name' => 'LearnDash Course Grid',
501
+ 'link' => 'https://www.brainstormforce.com/go/learndash-course-grid/',
502
+ ),
503
+ 'sfwd-lms' => array(
504
+ 'init' => 'sfwd-lms/sfwd_lms.php',
505
+ 'name' => 'LearnDash LMS',
506
+ 'link' => 'https://brainstormforce.com/go/learndash/',
507
+ ),
508
+ 'learndash-woocommerce' => array(
509
+ 'init' => 'learndash-woocommerce/learndash_woocommerce.php',
510
+ 'name' => 'LearnDash WooCommerce Integration',
511
+ 'link' => 'https://www.brainstormforce.com/go/learndash-woocommerce/',
512
+ ),
513
+ );
514
+
515
+ if ( count( $required_plugins ) > 0 ) {
516
+ foreach ( $required_plugins as $key => $plugin ) {
517
+
518
+ /**
519
+ * Has Pro Version Support?
520
+ * And
521
+ * Is Pro Version Installed?
522
+ */
523
+ $plugin_pro = self::pro_plugin_exist( $plugin['init'] );
524
+ if ( $plugin_pro ) {
525
+
526
+ // Pro - Active.
527
+ if ( is_plugin_active( $plugin_pro['init'] ) ) {
528
+ $response['active'][] = $plugin_pro;
529
+
530
+ // Pro - Inactive.
531
+ } else {
532
+ $response['inactive'][] = $plugin_pro;
533
+ }
534
+ } else {
535
+
536
+ // Lite - Installed but Inactive.
537
+ if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin['init'] ) && is_plugin_inactive( $plugin['init'] ) ) {
538
+
539
+ $response['inactive'][] = $plugin;
540
+
541
+ // Lite - Not Installed.
542
+ } elseif ( ! file_exists( WP_PLUGIN_DIR . '/' . $plugin['init'] ) ) {
543
+
544
+ $response['notinstalled'][] = $plugin;
545
+
546
+ // Added premium plugins which need to install first.
547
+ if ( array_key_exists( $plugin['slug'], $third_party_plugins ) ) {
548
+ $third_party_required_plugins[] = $third_party_plugins[ $plugin['slug'] ];
549
+ }
550
+
551
+ // Lite - Active.
552
+ } else {
553
+ $response['active'][] = $plugin;
554
+ }
555
+ }
556
+ }
557
+ }
558
+
559
+ // Send response.
560
+ wp_send_json_success(
561
+ array(
562
+ 'required_plugins' => $response,
563
+ 'third_party_required_plugins' => $third_party_required_plugins,
564
+ )
565
+ );
566
+ }
567
+
568
+ /**
569
+ * Has Pro Version Support?
570
+ * And
571
+ * Is Pro Version Installed?
572
+ *
573
+ * Check Pro plugin version exist of requested plugin lite version.
574
+ *
575
+ * Eg. If plugin 'BB Lite Version' required to import demo. Then we check the 'BB Agency Version' is exist?
576
+ * If yes then we only 'Activate' Agency Version. [We couldn't install agency version.]
577
+ * Else we 'Activate' or 'Install' Lite Version.
578
+ *
579
+ * @since 1.0.1
580
+ *
581
+ * @param string $lite_version Lite version init file.
582
+ * @return mixed Return false if not installed or not supported by us
583
+ * else return 'Pro' version details.
584
+ */
585
+ public static function pro_plugin_exist( $lite_version = '' ) {
586
+
587
+ // Lite init => Pro init.
588
+ $plugins = apply_filters(
589
+ 'astra_sites_pro_plugin_exist',
590
+ array(
591
+ 'beaver-builder-lite-version/fl-builder.php' => array(
592
+ 'slug' => 'bb-plugin',
593
+ 'init' => 'bb-plugin/fl-builder.php',
594
+ 'name' => 'Beaver Builder Plugin',
595
+ ),
596
+ 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' => array(
597
+ 'slug' => 'bb-ultimate-addon',
598
+ 'init' => 'bb-ultimate-addon/bb-ultimate-addon.php',
599
+ 'name' => 'Ultimate Addon for Beaver Builder',
600
+ ),
601
+ 'wpforms-lite/wpforms.php' => array(
602
+ 'slug' => 'wpforms',
603
+ 'init' => 'wpforms/wpforms.php',
604
+ 'name' => 'WPForms',
605
+ ),
606
+ ),
607
+ $lite_version
608
+ );
609
+
610
+ if ( isset( $plugins[ $lite_version ] ) ) {
611
+
612
+ // Pro plugin directory exist?
613
+ if ( file_exists( WP_PLUGIN_DIR . '/' . $plugins[ $lite_version ]['init'] ) ) {
614
+ return $plugins[ $lite_version ];
615
+ }
616
+ }
617
+
618
+ return false;
619
+ }
620
+
621
+ }
622
+
623
+ /**
624
+ * Kicking this off by calling 'get_instance()' method
625
+ */
626
+ Astra_Sites::get_instance();
627
+
628
+ endif;
inc/classes/compatibility/woocommerce/class-astra-sites-compatibility-woocommerce.php CHANGED
@@ -1,84 +1,84 @@
1
- <?php
2
- /**
3
- * Astra Sites Compatibility for 'WooCommerce'
4
- *
5
- * @see https://wordpress.org/plugins/woocommerce/
6
- *
7
- * @package Astra Sites
8
- * @since 1.1.4
9
- */
10
-
11
- if ( ! class_exists( 'Astra_Sites_Compatibility_WooCommerce' ) ) :
12
-
13
- /**
14
- * WooCommerce Compatibility
15
- *
16
- * @since 1.1.4
17
- */
18
- class Astra_Sites_Compatibility_WooCommerce {
19
-
20
- /**
21
- * Instance
22
- *
23
- * @access private
24
- * @var object Class object.
25
- * @since 1.1.4
26
- */
27
- private static $instance;
28
-
29
- /**
30
- * Initiator
31
- *
32
- * @since 1.1.4
33
- * @return object initialized object of class.
34
- */
35
- public static function instance() {
36
- if ( ! isset( self::$instance ) ) {
37
- self::$instance = new self;
38
- }
39
- return self::$instance;
40
- }
41
-
42
- /**
43
- * Constructor
44
- *
45
- * @since 1.1.4
46
- */
47
- public function __construct() {
48
- add_action( 'astra_sites_import_start', array( $this, 'add_attributes' ), 10, 2 );
49
- }
50
-
51
- /**
52
- * Add product attributes.
53
- *
54
- * @since 1.1.4
55
- *
56
- * @param string $demo_data Import data.
57
- * @param array $demo_api_uri Demo site URL.
58
- * @return void
59
- */
60
- function add_attributes( $demo_data = array(), $demo_api_uri = '' ) {
61
- $attributes = ( isset( $demo_data['astra-site-options-data']['woocommerce_product_attributes'] ) ) ? $demo_data['astra-site-options-data']['woocommerce_product_attributes'] : array();
62
-
63
- if ( ! empty( $attributes ) && function_exists( 'wc_create_attribute' ) ) {
64
- foreach ( $attributes as $key => $attribute ) {
65
- $args = array(
66
- 'name' => $attribute['attribute_label'],
67
- 'slug' => $attribute['attribute_name'],
68
- 'type' => $attribute['attribute_type'],
69
- 'order_by' => $attribute['attribute_orderby'],
70
- 'has_archives' => $attribute['attribute_public'],
71
- );
72
-
73
- $id = wc_create_attribute( $args );
74
- }
75
- }
76
- }
77
- }
78
-
79
- /**
80
- * Kicking this off by calling 'instance()' method
81
- */
82
- Astra_Sites_Compatibility_WooCommerce::instance();
83
-
84
- endif;
1
+ <?php
2
+ /**
3
+ * Astra Sites Compatibility for 'WooCommerce'
4
+ *
5
+ * @see https://wordpress.org/plugins/woocommerce/
6
+ *
7
+ * @package Astra Sites
8
+ * @since 1.1.4
9
+ */
10
+
11
+ if ( ! class_exists( 'Astra_Sites_Compatibility_WooCommerce' ) ) :
12
+
13
+ /**
14
+ * WooCommerce Compatibility
15
+ *
16
+ * @since 1.1.4
17
+ */
18
+ class Astra_Sites_Compatibility_WooCommerce {
19
+
20
+ /**
21
+ * Instance
22
+ *
23
+ * @access private
24
+ * @var object Class object.
25
+ * @since 1.1.4
26
+ */
27
+ private static $instance;
28
+
29
+ /**
30
+ * Initiator
31
+ *
32
+ * @since 1.1.4
33
+ * @return object initialized object of class.
34
+ */
35
+ public static function instance() {
36
+ if ( ! isset( self::$instance ) ) {
37
+ self::$instance = new self;
38
+ }
39
+ return self::$instance;
40
+ }
41
+
42
+ /**
43
+ * Constructor
44
+ *
45
+ * @since 1.1.4
46
+ */
47
+ public function __construct() {
48
+ add_action( 'astra_sites_import_start', array( $this, 'add_attributes' ), 10, 2 );
49
+ }
50
+
51
+ /**
52
+ * Add product attributes.
53
+ *
54
+ * @since 1.1.4
55
+ *
56
+ * @param string $demo_data Import data.
57
+ * @param array $demo_api_uri Demo site URL.
58
+ * @return void
59
+ */
60
+ function add_attributes( $demo_data = array(), $demo_api_uri = '' ) {
61
+ $attributes = ( isset( $demo_data['astra-site-options-data']['woocommerce_product_attributes'] ) ) ? $demo_data['astra-site-options-data']['woocommerce_product_attributes'] : array();
62
+
63
+ if ( ! empty( $attributes ) && function_exists( 'wc_create_attribute' ) ) {
64
+ foreach ( $attributes as $key => $attribute ) {
65
+ $args = array(
66
+ 'name' => $attribute['attribute_label'],
67
+ 'slug' => $attribute['attribute_name'],
68
+ 'type' => $attribute['attribute_type'],
69
+ 'order_by' => $attribute['attribute_orderby'],
70
+ 'has_archives' => $attribute['attribute_public'],
71
+ );
72
+
73
+ $id = wc_create_attribute( $args );
74
+ }
75
+ }
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Kicking this off by calling 'instance()' method
81
+ */
82
+ Astra_Sites_Compatibility_WooCommerce::instance();
83
+
84
+ endif;
inc/includes/admin-page.php CHANGED
@@ -1,437 +1,437 @@
1
- <?php
2
- /**
3
- * Shortcode Markup
4
- *
5
- * TMPL - Single Demo Preview
6
- * TMPL - No more demos
7
- * TMPL - Filters
8
- * TMPL - List
9
- *
10
- * @package Astra Sites
11
- * @since 1.0.0
12
- */
13
-
14
- defined( 'ABSPATH' ) or exit;
15
- ?>
16
-
17
- <div class="wrap" id="astra-sites-admin">
18
-
19
- <div id="astra-sites-filters">
20
-
21
- <?php if ( apply_filters( 'astra_sites_show_filters', true ) ) { ?>
22
- <div class="wp-filter hide-if-no-js">
23
- <div class="section-left">
24
-
25
- <!-- All Filters -->
26
- <div class="filter-count">
27
- <span class="count"></span>
28
- </div>
29
- <div class="filters-wrap" style="display: none;">
30
- <div id="astra-site-page-builder"></div>
31
- </div>
32
- <div class="filters-wrap">
33
- <div id="astra-site-category"></div>
34
- </div>
35
-
36
- </div>
37
-
38
- <div class="section-right">
39
-
40
- <div class="search-form">
41
- <label class="screen-reader-text" for="wp-filter-search-input"><?php _e( 'Search Sites', 'astra-sites' ); ?> </label>
42
- <input placeholder="<?php _e( 'Search Sites...', 'astra-sites' ); ?>" type="search" aria-describedby="live-search-desc" id="wp-filter-search-input" class="wp-filter-search">
43
- </div>
44
-
45
- </div>
46
- </div>
47
- <?php } ?>
48
-
49
- </div>
50
-
51
- <?php do_action( 'astra_sites_before_site_grid' ); ?>
52
-
53
- <div class="theme-browser rendered">
54
- <div id="astra-sites" class="themes wp-clearfix"></div>
55
- </div>
56
-
57
- <div class="spinner-wrap">
58
- <span class="spinner"></span>
59
- </div>
60
-
61
- <?php do_action( 'astra_sites_after_site_grid' ); ?>
62
-
63
- </div>
64
-
65
- <?php
66
- /**
67
- * TMPL - Pro Site Description
68
- */
69
- ?>
70
- <script type="text/template" id="tmpl-astra-sites-pro-site-description">
71
- <p><?php _e( 'Liked this demo?', 'astra-sites' ); ?></p>
72
- <p>
73
- <?php
74
- /* translators: %s is pricing page link */
75
- printf( __( 'It is a premium website demo which is available only with the Agency Bundles <a href="%s" target="_blank">Buy Now!</a>', 'astra-sites' ), 'https://wpastra.com/pricing/' );
76
- ?>
77
- </p>
78
- <p>
79
- <?php
80
- /* translators: %s is article link */
81
- printf( __( 'Already own an Agency Bundle? Read an article to know how you can <a href="%s" target="_blank">import a premium website demo</a>.', 'astra-sites' ), 'https://wpastra.com/docs/import-astra-agency-website-demos/' );
82
- ?>
83
- </p>
84
- </script>
85
-
86
- <?php
87
- /**
88
- * TMPL - Pro Site Description for Inactive license
89
- */
90
- ?>
91
- <script type="text/template" id="tmpl-astra-sites-pro-inactive-site-description">
92
- <p><?php _e( 'You are just 2 minutes away from importing this demo!', 'astra-sites' ); ?></p>
93
- <p><?php _e( 'It is a premium website demo and you need to activate the license to access it.', 'astra-sites' ); ?></p>
94
- <p>
95
- <?php
96
- /* translators: %s is article link */
97
- printf( __( 'Learn how you can <a href="%s" target="_blank">activate the license</a> of the Astra Premium Sites plugin.', 'astra-sites' ), 'https://wpastra.com/docs/activate-license-for-astra-premium-sites-plugin/' );
98
- ?>
99
- </p>
100
- </script>
101
-
102
- <?php
103
- /**
104
- * TMPL - Third Party Required Plugins
105
- */
106
- ?>
107
- <script type="text/template" id="tmpl-astra-sites-third-party-required-plugins">
108
- <div class="astra-sites-third-party-required-plugins-wrap">
109
- <h3 class="theme-name"><?php esc_html_e( 'Required Plugin Missing', 'astra-sites' ); ?></h3>
110
- <p><?php esc_html_e( 'This starter site requires premium plugins. As these are third party premium plugins, you\'ll need to purchase, install and activate them first.', 'astra-sites' ); ?></p>
111
- <ul class="astra-sites-third-party-required-plugins">
112
- <# for ( key in data ) { #>
113
- <li class="plugin-card plugin-card-{{data[ key ].slug}}'" data-slug="{{data[ key ].slug }}" data-init="{{data[ key ].init}}" data-name="{{data[ key ].name}}"><a href="{{data[ key ].link}}" target="_blank">{{data[ key ].name}}</a></li>
114
- <# } #>
115
- </ul>
116
- </div>
117
- </script>
118
-
119
- <?php
120
- /**
121
- * TMPL - Single Demo Preview
122
- */
123
- ?>
124
- <script type="text/template" id="tmpl-astra-site-select-page-builder">
125
- <div class="select-page-builder">
126
- <div class="note-wrap">
127
- <h3>
128
- <span class="up-arrow dashicons dashicons-editor-break"></span>
129
- <div class="note"><?php _e( 'Select Your Favorite Page Builder', 'astra-sites' ); ?></div>
130
- </h3>
131
- </div>
132
- <img src="<?php echo esc_url( ASTRA_SITES_URI . 'inc/assets/images/sites-screenshot.jpg' ); ?>" alt="<?php _e( 'Sites List..', 'astra-sites' ); ?>" title="<?php _e( 'Sites List..', 'astra-sites' ); ?>" />
133
- </div>
134
- </script>
135
-
136
- <?php
137
- /**
138
- * TMPL - Single Demo Preview
139
- */
140
- ?>
141
- <script type="text/template" id="tmpl-astra-site-preview">
142
- <div class="astra-sites-preview theme-install-overlay wp-full-overlay expanded">
143
- <div class="wp-full-overlay-sidebar">
144
- <div class="wp-full-overlay-header"
145
- data-demo-id="{{{data.id}}}"
146
- data-demo-type="{{{data.astra_demo_type}}}"
147
- data-demo-url="{{{data.astra_demo_url}}}"
148
- data-demo-api="{{{data.demo_api}}}"
149
- data-demo-name="{{{data.demo_name}}}"
150
- data-demo-slug="{{{data.slug}}}"
151
- data-screenshot="{{{data.screenshot}}}"
152
- data-content="{{{data.content}}}"
153
- data-required-plugins="{{data.required_plugins}}">
154
- <input type="hidden" class="astra-site-options" value="{{data.astra_site_options}}" >
155
- <input type="hidden" class="astra-enabled-extensions" value="{{data.astra_enabled_extensions}}" >
156
- <button class="close-full-overlay"><span class="screen-reader-text"><?php esc_html_e( 'Close', 'astra-sites' ); ?></span></button>
157
- <button class="previous-theme"><span class="screen-reader-text"><?php esc_html_e( 'Previous', 'astra-sites' ); ?></span></button>
158
- <button class="next-theme"><span class="screen-reader-text"><?php esc_html_e( 'Next', 'astra-sites' ); ?></span></button>
159
- <!-- <a class="button hide-if-no-customize astra-site-import" href="#" data-import="disabled"><?php esc_html_e( 'Import Site', 'astra-sites' ); ?></a> -->
160
- <a class="button hide-if-no-customize button-primary astra-demo-import" href="#" data-import="disabled"><?php esc_html_e( 'Import Site', 'astra-sites' ); ?></a>
161
-
162
- </div>
163
- <div class="wp-full-overlay-sidebar-content">
164
- <div class="install-theme-info">
165
-
166
- <span class="site-type {{{data.astra_demo_type}}}">{{{data.astra_demo_type}}}</span>
167
- <h3 class="theme-name">{{{data.demo_name}}}</h3>
168
-
169
- <# if ( data.screenshot.length ) { #>
170
- <div class="theme-screenshot-wrap">
171
- <img class="theme-screenshot" src="{{{data.screenshot}}}" alt="">
172
- </div>
173
- <# } #>
174
-
175
- <div class="theme-details">
176
- {{{data.content}}}
177
- </div>
178
- <a href="#" class="theme-details-read-more"><?php _e( 'Read more', 'astra-sites' ); ?> &hellip;</a>
179
-
180
- <div class="astra-sites-advanced-options-wrap">
181
-
182
- <div class="astra-sites-advanced-options">
183
-
184
- <ul class="astra-site-contents">
185
- <li class="astra-sites-import-plugins">
186
- <input type="checkbox" name="plugins" checked="checked" class="disabled checkbox" readonly>
187
- <strong><?php _e( 'Install Required Plugins', 'astra-sites' ); ?></strong>
188
- <span class="astra-sites-tooltip-icon" data-tip-id="astra-sites-tooltip-plugins-settings"><span class="dashicons dashicons-editor-help"></span></span>
189
- <div class="astra-sites-tooltip-message" id="astra-sites-tooltip-plugins-settings" style="display: none;">
190
- <ul class="required-plugins-list"><span class="spinner is-active"></span></ul>
191
- </div>
192
- </li>
193
- <li class="astra-sites-import-customizer">
194
- <label>
195
- <input type="checkbox" name="customizer" checked="checked" class="checkbox">
196
- <strong>Import Customizer Settings</strong>
197
- <span class="astra-sites-tooltip-icon" data-tip-id="astra-sites-tooltip-customizer-settings"><span class="dashicons dashicons-editor-help"></span></span>
198
- <div class="astra-sites-tooltip-message" id="astra-sites-tooltip-customizer-settings" style="display: none;">
199
- <p><?php _e( 'Customizer is what gives a design to the website; and selecting this option replaces your current design with a new one.', 'astra-sites' ); ?></p>
200
- <p><?php _e( 'Backup of current customizer settings will be stored in "wp-content/astra-sites" directory, just in case if you want to restore it later.', 'astra-sites' ); ?></p>
201
- </div>
202
- </label>
203
- </li>
204
- <li class="astra-sites-import-xml">
205
- <label>
206
- <input type="checkbox" name="xml" checked="checked" class="checkbox">
207
- <strong>Import Content</strong>
208
- </label>
209
- <span class="astra-sites-tooltip-icon" data-tip-id="astra-sites-tooltip-site-content"><span class="dashicons dashicons-editor-help"></span></span>
210
- <div class="astra-sites-tooltip-message" id="astra-sites-tooltip-site-content" style="display: none;"><p><?php _e( 'Selecting this option will import dummy pages, posts, images and menus. If you do not want to import dummy content, please uncheck this option.', 'astra-sites' ); ?></p></div>
211
- </li>
212
- <li class="astra-sites-import-widgets">
213
- <label>
214
- <input type="checkbox" name="widgets" checked="checked" class="checkbox">
215
- <strong>Import Widgets</strong>
216
- </label>
217
- </li>
218
- </ul>
219
- </div>
220
-
221
- <ul>
222
- <li class="astra-sites-reset-data">
223
- <label>
224
- <input type="checkbox" name="reset" class="checkbox">
225
- <strong>Delete Previously Imported Site</strong>
226
- <div class="astra-sites-tooltip-message" id="astra-sites-tooltip-reset-data" style="display: none;"><p><?php _e( 'WARNING: Selecting this option will delete data from your current website. Choose this option only if this is intended.', 'astra-sites' ); ?></p></div>
227
- </label>
228
- </li>
229
- </ul>
230
-
231
- <!-- <p><a href="#" class="astra-sites-advanced-options-button"><?php _e( 'Advanced Options', 'astra-sites' ); ?></a></p> -->
232
-
233
- </div>
234
-
235
- <!-- <div class="astra-sites-advanced-options">
236
- <h4><?php _e( 'Required Plugins', 'astra-sites' ); ?> </h4>
237
- <div class="required-plugins"></div>
238
- </div> -->
239
- </div>
240
- </div>
241
-
242
- <div class="wp-full-overlay-footer">
243
- <div class="footer-import-button-wrap">
244
- <a class="button button-hero hide-if-no-customize button-primary astra-demo-import" href="#" data-import="disabled">
245
- <?php esc_html_e( 'Import Site', 'astra-sites' ); ?>
246
- <span class="percent"></span>
247
- </a>
248
- <div class="astra-site-import-process-wrap" style="display: none;">
249
- <progress class="astra-site-import-process" max="100" value="0"></progress>
250
- </div>
251
- <!-- <a class="button button-hero hide-if-no-customize astra-site-import" href="#">
252
- <?php esc_html_e( 'Import Site', 'astra-sites' ); ?>
253
- </a> -->
254
- </div>
255
- <button type="button" class="collapse-sidebar button" aria-expanded="true"
256
- aria-label="Collapse Sidebar">
257
- <span class="collapse-sidebar-arrow"></span>
258
- <span class="collapse-sidebar-label"><?php esc_html_e( 'Collapse', 'astra-sites' ); ?></span>
259
- </button>
260
-
261
- <div class="devices-wrapper">
262
- <div class="devices">
263
- <button type="button" class="preview-desktop active" aria-pressed="true" data-device="desktop">
264
- <span class="screen-reader-text"><?php _e( 'Enter desktop preview mode', 'astra-sites' ); ?></span>
265
- </button>
266
- <button type="button" class="preview-tablet" aria-pressed="false" data-device="tablet">
267
- <span class="screen-reader-text"><?php _e( 'Enter tablet preview mode', 'astra-sites' ); ?></span>
268
- </button>
269
- <button type="button" class="preview-mobile" aria-pressed="false" data-device="mobile">
270
- <span class="screen-reader-text"><?php _e( 'Enter mobile preview mode', 'astra-sites' ); ?></span>
271
- </button>
272
- </div>
273
- </div>
274
-
275
- </div>
276
- </div>
277
- <div class="wp-full-overlay-main">
278
- <iframe src="{{{data.astra_demo_url}}}" title="<?php esc_attr_e( 'Preview', 'astra-sites' ); ?>"></iframe>
279
- <div class="astra-sites-result-preview" style="display: none;">
280
- <div class="inner">
281
- <h2><?php _e( 'We\'re importing your website.', 'astra-sites' ); ?></h2>
282
- <p><?php _e( 'The process can take anywhere between 2 to 10 minutes depending on the size of the website and speed of connection.', 'astra-sites' ); ?></p>
283
- <p><?php _e( 'Please do not close this browser window until the site is imported completely.', 'astra-sites' ); ?></p>
284
- <div class="current-importing-status-wrap">
285
- <div class="current-importing-status">
286
- <div class="current-importing-status-title"></div>
287
- <div class="current-importing-status-description"></div>
288
- </div>
289
- </div>
290
- </div>
291
- </div>
292
- </div>
293
- </div>
294
- </script>
295
-
296
- <?php
297
- /**
298
- * TMPL - No more demos
299
- */
300
- ?>
301
- <script type="text/template" id="tmpl-astra-site-api-request-failed">
302
- <div class="no-themes">
303
- <?php
304
-
305
- /* translators: %1$s & %2$s are a Demo API URL */
306
- printf( __( '<p> It seems the demo data server, <i><a href="%1$s">%2$s</a></i> is unreachable from your site.</p>', 'astra-sites' ), esc_url( Astra_Sites::$api_url ), esc_url( Astra_Sites::$api_url ) );
307
-
308
- _e( '<p class="left-margin"> 1. Sometimes, simple page reload fixes any temporary issues. No kidding!</p>', 'astra-sites' );
309
-
310
- _e( '<p class="left-margin"> 2. If that does not work, you will need to talk to your server administrator and check if demo server is being blocked by the firewall!</p>', 'astra-sites' );
311
-
312
- /* translators: %1$s is a support link */
313
- printf( __( '<p>If that does not help, please open up a <a href="%1$s" target="_blank">Support Ticket</a> and we will be glad take a closer look for you.</p>', 'astra-sites' ), esc_url( 'https://wpastra.com/support/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=api-request-failed' ) );
314
- ?>
315
- </div>
316
- </script>
317
-
318
- <?php
319
- /**
320
- * TMPL - Site Down
321
- */
322
- ?>
323
- <script type="text/template" id="tmpl-astra-site-down">
324
- <div class="postbox astra-site-down">
325
- <h2><?php _e( 'Under Maintenance..', 'astra-sites' ); ?></h2>
326
- <p><?php _e( 'If you are seeing this message, most likely our servers are under routine maintenance and we will be back shortly. ', 'astra-sites' ); ?></p>
327
- <p><?php _e( 'In rare case, it is possible your website is having trouble connecting with ours. If you need help, please feel free to get in touch with us from our website.', 'astra-sites' ); ?></p>
328
- </div>
329
- </script>
330
-
331
- <?php
332
- /**
333
- * TMPL - Filters
334
- */
335
- ?>
336
- <script type="text/template" id="tmpl-astra-site-filters">
337
-
338
- <# if ( data ) { #>
339
-
340
- <ul class="{{ data.args.wrapper_class }} {{ data.args.class }}">
341
-
342
- <# if ( data.args.show_all ) { #>
343
- <li>
344
- <a href="#" data-group="all"> All </a>
345
- </li>
346
- <# } #>
347
-
348
- <# for ( key in data.items ) { #>
349
- <# if ( data.items[ key ].count ) { #>
350
- <li>
351
- <a href="#" data-group='{{ data.items[ key ].id }}' class="{{ data.items[ key ].name }}">
352
- {{ data.items[ key ].name }}
353
- </a>
354
- </li>
355
- <# } #>
356
- <# } #>
357
-
358
- </ul>
359
- <# } #>
360
- </script>
361
-
362
- <?php
363
- /**
364
- * TMPL - List
365
- */
366
- ?>
367
- <script type="text/template" id="tmpl-astra-sites-list">
368
-
369
- <# if ( data.items.length ) { #>
370
- <# for ( key in data.items ) { #>
371
-
372
- <div class="theme astra-theme site-single {{ data.items[ key ].status }}" tabindex="0" aria-describedby="astra-theme-action astra-theme-name"
373
- data-demo-id="{{{ data.items[ key ].id }}}"
374
- data-demo-type="{{{ data.items[ key ]['astra-site-type'] }}}"
375
- data-demo-url="{{{ data.items[ key ]['astra-site-url'] }}}"
376
- data-demo-api="{{{ data.items[ key ]['_links']['self'][0]['href'] }}}"
377
- data-demo-name="{{{ data.items[ key ].title.rendered }}}"
378
- data-demo-slug="{{{ data.items[ key ].slug }}}"
379
- data-screenshot="{{{ data.items[ key ]['featured-image-url'] }}}"
380
- data-content="{{{ data.items[ key ].content.rendered }}}"
381
- data-required-plugins="{{ JSON.stringify( data.items[ key ]['required-plugins'] ) }}"
382
- data-groups=["{{ data.items[ key ].tags }}"]>
383
- <input type="hidden" class="astra-site-options" value="{{ JSON.stringify(data.items[ key ]['astra-site-options-data'] ) }}" />
384
- <input type="hidden" class="astra-enabled-extensions" value="{{ JSON.stringify(data.items[ key ]['astra-enabled-extensions'] ) }}" />
385
-
386
- <div class="inner">
387
- <span class="site-preview" data-href="{{ data.items[ key ]['astra-site-url'] }}?TB_iframe=true&width=600&height=550" data-title="{{ data.items[ key ].title.rendered }}">
388
- <div class="theme-screenshot" style="background-image: url('{{ data.items[ key ]['featured-image-url'] }}');"></div>
389
- </span>
390
- <# if ( data.items[ key ]['astra-site-type'] ) { #>
391
- <# var type = ( data.items[ key ]['astra-site-type'] !== 'premium' ) ? ( data.items[ key ]['astra-site-type'] ) : 'agency'; #>
392
- <span class="site-type {{data.items[ key ]['astra-site-type']}}">{{ type }}</span>
393
- <# } #>
394
- <# if ( data.items[ key ].status ) { #>
395
- <span class="status {{data.items[ key ].status}}">{{data.items[ key ].status}}</span>
396
- <# } #>
397
- <div class="theme-id-container">
398
- <h3 class="theme-name" id="astra-theme-name"> {{{ data.items[ key ].title.rendered }}} </h3>
399
- <div class="theme-actions">
400
- <button class="button-primary button preview install-theme-preview"><?php esc_html_e( 'Preview', 'astra-sites' ); ?></button>
401
- </div>
402
- </div>
403
- </div>
404
- </div>
405
- <# } #>
406
- <# } else { #>
407
- <p class="no-themes" style="display:block;">
408
- <?php _e( 'No Demos found, Try a different search.', 'astra-sites' ); ?>
409
- <span class="description">
410
- <?php
411
- /* translators: %1$s External Link */
412
- printf( __( 'Don\'t see a site that you would like to import?<br><a target="_blank" href="%1$s">Please suggest us!</a>', 'astra-sites' ), esc_url( 'https://wpastra.com/sites-suggestions/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=suggestions' ) );
413
- ?>
414
- </span>
415
- </p>
416
- <# } #>
417
- </script>
418
-
419
- <?php
420
- /**
421
- * TMPL - List
422
- */
423
- ?>
424
- <script type="text/template" id="tmpl-astra-sites-suggestions">
425
- <div class="theme astra-theme site-single astra-sites-suggestions">
426
- <div class="inner">
427
- <p>
428
- <?php
429
- /* translators: %1$s External Link */
430
- printf( __( 'Don\'t see a site that you would like to import?<br><a target="_blank" href="%1$s">Please suggest us!</a>', 'astra-sites' ), esc_url( 'https://wpastra.com/sites-suggestions/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=suggestions' ) );
431
- ?>
432
- </p>
433
- </div>
434
- </div>
435
- </script>
436
- <?php
437
- wp_print_admin_notice_templates();
1
+ <?php
2
+ /**
3
+ * Shortcode Markup
4
+ *
5
+ * TMPL - Single Demo Preview
6
+ * TMPL - No more demos
7
+ * TMPL - Filters
8
+ * TMPL - List
9
+ *
10
+ * @package Astra Sites
11
+ * @since 1.0.0
12
+ */
13
+
14
+ defined( 'ABSPATH' ) or exit;
15
+ ?>
16
+
17
+ <div class="wrap" id="astra-sites-admin">
18
+
19
+ <div id="astra-sites-filters">
20
+
21
+ <?php if ( apply_filters( 'astra_sites_show_filters', true ) ) { ?>
22
+ <div class="wp-filter hide-if-no-js">
23
+ <div class="section-left">
24
+
25
+ <!-- All Filters -->
26
+ <div class="filter-count">
27
+ <span class="count"></span>
28
+ </div>
29
+ <div class="filters-wrap" style="display: none;">
30
+ <div id="astra-site-page-builder"></div>
31
+ </div>
32
+ <div class="filters-wrap">
33
+ <div id="astra-site-category"></div>
34
+ </div>
35
+
36
+ </div>
37
+
38
+ <div class="section-right">
39
+
40
+ <div class="search-form">
41
+ <label class="screen-reader-text" for="wp-filter-search-input"><?php _e( 'Search Sites', 'astra-sites' ); ?> </label>
42
+ <input placeholder="<?php _e( 'Search Sites...', 'astra-sites' ); ?>" type="search" aria-describedby="live-search-desc" id="wp-filter-search-input" class="wp-filter-search">
43
+ </div>
44
+
45
+ </div>
46
+ </div>
47
+ <?php } ?>
48
+
49
+ </div>
50
+
51
+ <?php do_action( 'astra_sites_before_site_grid' ); ?>
52
+
53
+ <div class="theme-browser rendered">
54
+ <div id="astra-sites" class="themes wp-clearfix"></div>
55
+ </div>
56
+
57
+ <div class="spinner-wrap">
58
+ <span class="spinner"></span>
59
+ </div>
60
+
61
+ <?php do_action( 'astra_sites_after_site_grid' ); ?>
62
+
63
+ </div>
64
+
65
+ <?php
66
+ /**
67
+ * TMPL - Pro Site Description
68
+ */
69
+ ?>
70
+ <script type="text/template" id="tmpl-astra-sites-pro-site-description">
71
+ <p><?php _e( 'Liked this demo?', 'astra-sites' ); ?></p>
72
+ <p>
73
+ <?php
74
+ /* translators: %s is pricing page link */
75
+ printf( __( 'It is a premium website demo which is available only with the Agency Bundles <a href="%s" target="_blank">Buy Now!</a>', 'astra-sites' ), 'https://wpastra.com/pricing/' );
76
+ ?>
77
+ </p>
78
+ <p>
79
+ <?php
80
+ /* translators: %s is article link */
81
+ printf( __( 'Already own an Agency Bundle? Read an article to know how you can <a href="%s" target="_blank">import a premium website demo</a>.', 'astra-sites' ), 'https://wpastra.com/docs/import-astra-agency-website-demos/' );
82
+ ?>
83
+ </p>
84
+ </script>
85
+
86
+ <?php
87
+ /**
88
+ * TMPL - Pro Site Description for Inactive license
89
+ */
90
+ ?>
91
+ <script type="text/template" id="tmpl-astra-sites-pro-inactive-site-description">
92
+ <p><?php _e( 'You are just 2 minutes away from importing this demo!', 'astra-sites' ); ?></p>
93
+ <p><?php _e( 'It is a premium website demo and you need to activate the license to access it.', 'astra-sites' ); ?></p>
94
+ <p>
95
+ <?php
96
+ /* translators: %s is article link */
97
+ printf( __( 'Learn how you can <a href="%s" target="_blank">activate the license</a> of the Astra Premium Sites plugin.', 'astra-sites' ), 'https://wpastra.com/docs/activate-license-for-astra-premium-sites-plugin/' );
98
+ ?>
99
+ </p>
100
+ </script>
101
+
102
+ <?php
103
+ /**
104
+ * TMPL - Third Party Required Plugins
105
+ */
106
+ ?>
107
+ <script type="text/template" id="tmpl-astra-sites-third-party-required-plugins">
108
+ <div class="astra-sites-third-party-required-plugins-wrap">
109
+ <h3 class="theme-name"><?php esc_html_e( 'Required Plugins Missing', 'astra-sites' ); ?></h3>
110
+ <p><?php esc_html_e( 'This starter site requires premium plugins. As these are third party premium plugins, you\'ll need to purchase, install and activate them first.', 'astra-sites' ); ?></p>
111
+ <ul class="astra-sites-third-party-required-plugins">
112
+ <# for ( key in data ) { #>
113
+ <li class="plugin-card plugin-card-{{data[ key ].slug}}'" data-slug="{{data[ key ].slug }}" data-init="{{data[ key ].init}}" data-name="{{data[ key ].name}}"><a href="{{data[ key ].link}}" target="_blank">{{data[ key ].name}}</a></li>
114
+ <# } #>
115
+ </ul>
116
+ </div>
117
+ </script>
118
+
119
+ <?php
120
+ /**
121
+ * TMPL - Single Demo Preview
122
+ */
123
+ ?>
124
+ <script type="text/template" id="tmpl-astra-site-select-page-builder">
125
+ <div class="select-page-builder">
126
+ <div class="note-wrap">
127
+ <h3>
128
+ <span class="up-arrow dashicons dashicons-editor-break"></span>
129
+ <div class="note"><?php _e( 'Select Your Favorite Page Builder', 'astra-sites' ); ?></div>
130
+ </h3>
131
+ </div>
132
+ <img src="<?php echo esc_url( ASTRA_SITES_URI . 'inc/assets/images/sites-screenshot.jpg' ); ?>" alt="<?php _e( 'Sites List..', 'astra-sites' ); ?>" title="<?php _e( 'Sites List..', 'astra-sites' ); ?>" />
133
+ </div>
134
+ </script>
135
+
136
+ <?php
137
+ /**
138
+ * TMPL - Single Demo Preview
139
+ */
140
+ ?>
141
+ <script type="text/template" id="tmpl-astra-site-preview">
142
+ <div class="astra-sites-preview theme-install-overlay wp-full-overlay expanded">
143
+ <div class="wp-full-overlay-sidebar">
144
+ <div class="wp-full-overlay-header"
145
+ data-demo-id="{{{data.id}}}"
146
+ data-demo-type="{{{data.astra_demo_type}}}"
147
+ data-demo-url="{{{data.astra_demo_url}}}"
148
+ data-demo-api="{{{data.demo_api}}}"
149
+ data-demo-name="{{{data.demo_name}}}"
150
+ data-demo-slug="{{{data.slug}}}"
151
+ data-screenshot="{{{data.screenshot}}}"
152
+ data-content="{{{data.content}}}"
153
+ data-required-plugins="{{data.required_plugins}}">
154
+ <input type="hidden" class="astra-site-options" value="{{data.astra_site_options}}" >
155
+ <input type="hidden" class="astra-enabled-extensions" value="{{data.astra_enabled_extensions}}" >
156
+ <button class="close-full-overlay"><span class="screen-reader-text"><?php esc_html_e( 'Close', 'astra-sites' ); ?></span></button>
157
+ <button class="previous-theme"><span class="screen-reader-text"><?php esc_html_e( 'Previous', 'astra-sites' ); ?></span></button>
158
+ <button class="next-theme"><span class="screen-reader-text"><?php esc_html_e( 'Next', 'astra-sites' ); ?></span></button>
159
+ <!-- <a class="button hide-if-no-customize astra-site-import" href="#" data-import="disabled"><?php esc_html_e( 'Import Site', 'astra-sites' ); ?></a> -->
160
+ <a class="button hide-if-no-customize button-primary astra-demo-import" href="#" data-import="disabled"><?php esc_html_e( 'Import Site', 'astra-sites' ); ?></a>
161
+
162
+ </div>
163
+ <div class="wp-full-overlay-sidebar-content">
164
+ <div class="install-theme-info">
165
+
166
+ <span class="site-type {{{data.astra_demo_type}}}">{{{data.astra_demo_type}}}</span>
167
+ <h3 class="theme-name">{{{data.demo_name}}}</h3>
168
+
169
+ <# if ( data.screenshot.length ) { #>
170
+ <div class="theme-screenshot-wrap">
171
+ <img class="theme-screenshot" src="{{{data.screenshot}}}" alt="">
172
+ </div>
173
+ <# } #>
174
+
175
+ <div class="theme-details">
176
+ {{{data.content}}}
177
+ </div>
178
+ <a href="#" class="theme-details-read-more"><?php _e( 'Read more', 'astra-sites' ); ?> &hellip;</a>
179
+
180
+ <div class="astra-sites-advanced-options-wrap">
181
+
182
+ <div class="astra-sites-advanced-options">
183
+
184
+ <ul class="astra-site-contents">
185
+ <li class="astra-sites-import-plugins">
186
+ <input type="checkbox" name="plugins" checked="checked" class="disabled checkbox" readonly>
187
+ <strong><?php _e( 'Install Required Plugins', 'astra-sites' ); ?></strong>
188
+ <span class="astra-sites-tooltip-icon" data-tip-id="astra-sites-tooltip-plugins-settings"><span class="dashicons dashicons-editor-help"></span></span>
189
+ <div class="astra-sites-tooltip-message" id="astra-sites-tooltip-plugins-settings" style="display: none;">
190
+ <ul class="required-plugins-list"><span class="spinner is-active"></span></ul>
191
+ </div>
192
+ </li>
193
+ <li class="astra-sites-import-customizer">
194
+ <label>
195
+ <input type="checkbox" name="customizer" checked="checked" class="checkbox">
196
+ <strong>Import Customizer Settings</strong>
197
+ <span class="astra-sites-tooltip-icon" data-tip-id="astra-sites-tooltip-customizer-settings"><span class="dashicons dashicons-editor-help"></span></span>
198
+ <div class="astra-sites-tooltip-message" id="astra-sites-tooltip-customizer-settings" style="display: none;">
199
+ <p><?php _e( 'Customizer is what gives a design to the website; and selecting this option replaces your current design with a new one.', 'astra-sites' ); ?></p>
200
+ <p><?php _e( 'Backup of current customizer settings will be stored in "wp-content/astra-sites" directory, just in case if you want to restore it later.', 'astra-sites' ); ?></p>
201
+ </div>
202
+ </label>
203
+ </li>
204
+ <li class="astra-sites-import-xml">
205
+ <label>
206
+ <input type="checkbox" name="xml" checked="checked" class="checkbox">
207
+ <strong>Import Content</strong>
208
+ </label>
209
+ <span class="astra-sites-tooltip-icon" data-tip-id="astra-sites-tooltip-site-content"><span class="dashicons dashicons-editor-help"></span></span>
210
+ <div class="astra-sites-tooltip-message" id="astra-sites-tooltip-site-content" style="display: none;"><p><?php _e( 'Selecting this option will import dummy pages, posts, images and menus. If you do not want to import dummy content, please uncheck this option.', 'astra-sites' ); ?></p></div>
211
+ </li>
212
+ <li class="astra-sites-import-widgets">
213
+ <label>
214
+ <input type="checkbox" name="widgets" checked="checked" class="checkbox">
215
+ <strong>Import Widgets</strong>
216
+ </label>
217
+ </li>
218
+ </ul>
219
+ </div>
220
+
221
+ <ul>
222
+ <li class="astra-sites-reset-data">
223
+ <label>
224
+ <input type="checkbox" name="reset" class="checkbox">
225
+ <strong>Delete Previously Imported Site</strong>
226
+ <div class="astra-sites-tooltip-message" id="astra-sites-tooltip-reset-data" style="display: none;"><p><?php _e( 'WARNING: Selecting this option will delete data from your current website. Choose this option only if this is intended.', 'astra-sites' ); ?></p></div>
227
+ </label>
228
+ </li>
229
+ </ul>
230
+
231
+ <!-- <p><a href="#" class="astra-sites-advanced-options-button"><?php _e( 'Advanced Options', 'astra-sites' ); ?></a></p> -->
232
+
233
+ </div>
234
+
235
+ <!-- <div class="astra-sites-advanced-options">
236
+ <h4><?php _e( 'Required Plugins', 'astra-sites' ); ?> </h4>
237
+ <div class="required-plugins"></div>
238
+ </div> -->
239
+ </div>
240
+ </div>
241
+
242
+ <div class="wp-full-overlay-footer">
243
+ <div class="footer-import-button-wrap">
244
+ <a class="button button-hero hide-if-no-customize button-primary astra-demo-import" href="#" data-import="disabled">
245
+ <?php esc_html_e( 'Import Site', 'astra-sites' ); ?>
246
+ <span class="percent"></span>
247
+ </a>
248
+ <div class="astra-site-import-process-wrap" style="display: none;">
249
+ <progress class="astra-site-import-process" max="100" value="0"></progress>
250
+ </div>
251
+ <!-- <a class="button button-hero hide-if-no-customize astra-site-import" href="#">
252
+ <?php esc_html_e( 'Import Site', 'astra-sites' ); ?>
253
+ </a> -->
254
+ </div>
255
+ <button type="button" class="collapse-sidebar button" aria-expanded="true"
256
+ aria-label="Collapse Sidebar">
257
+ <span class="collapse-sidebar-arrow"></span>
258
+ <span class="collapse-sidebar-label"><?php esc_html_e( 'Collapse', 'astra-sites' ); ?></span>
259
+ </button>
260
+
261
+ <div class="devices-wrapper">
262
+ <div class="devices">
263
+ <button type="button" class="preview-desktop active" aria-pressed="true" data-device="desktop">
264
+ <span class="screen-reader-text"><?php _e( 'Enter desktop preview mode', 'astra-sites' ); ?></span>
265
+ </button>
266
+ <button type="button" class="preview-tablet" aria-pressed="false" data-device="tablet">
267
+ <span class="screen-reader-text"><?php _e( 'Enter tablet preview mode', 'astra-sites' ); ?></span>
268
+ </button>
269
+ <button type="button" class="preview-mobile" aria-pressed="false" data-device="mobile">
270
+ <span class="screen-reader-text"><?php _e( 'Enter mobile preview mode', 'astra-sites' ); ?></span>
271
+ </button>
272
+ </div>
273
+ </div>
274
+
275
+ </div>
276
+ </div>
277
+ <div class="wp-full-overlay-main">
278
+ <iframe src="{{{data.astra_demo_url}}}" title="<?php esc_attr_e( 'Preview', 'astra-sites' ); ?>"></iframe>
279
+ <div class="astra-sites-result-preview" style="display: none;">
280
+ <div class="inner">
281
+ <h2><?php _e( 'We\'re importing your website.', 'astra-sites' ); ?></h2>
282
+ <p><?php _e( 'The process can take anywhere between 2 to 10 minutes depending on the size of the website and speed of connection.', 'astra-sites' ); ?></p>
283
+ <p><?php _e( 'Please do not close this browser window until the site is imported completely.', 'astra-sites' ); ?></p>
284
+ <div class="current-importing-status-wrap">
285
+ <div class="current-importing-status">
286
+ <div class="current-importing-status-title"></div>
287
+ <div class="current-importing-status-description"></div>
288
+ </div>
289
+ </div>
290
+ </div>
291
+ </div>
292
+ </div>
293
+ </div>
294
+ </script>
295
+
296
+ <?php
297
+ /**
298
+ * TMPL - No more demos
299
+ */
300
+ ?>
301
+ <script type="text/template" id="tmpl-astra-site-api-request-failed">
302
+ <div class="no-themes">
303
+ <?php
304
+
305
+ /* translators: %1$s & %2$s are a Demo API URL */
306
+ printf( __( '<p> It seems the demo data server, <i><a href="%1$s">%2$s</a></i> is unreachable from your site.</p>', 'astra-sites' ), esc_url( Astra_Sites::$api_url ), esc_url( Astra_Sites::$api_url ) );
307
+
308
+ _e( '<p class="left-margin"> 1. Sometimes, simple page reload fixes any temporary issues. No kidding!</p>', 'astra-sites' );
309
+
310
+ _e( '<p class="left-margin"> 2. If that does not work, you will need to talk to your server administrator and check if demo server is being blocked by the firewall!</p>', 'astra-sites' );
311
+
312
+ /* translators: %1$s is a support link */
313
+ printf( __( '<p>If that does not help, please open up a <a href="%1$s" target="_blank">Support Ticket</a> and we will be glad take a closer look for you.</p>', 'astra-sites' ), esc_url( 'https://wpastra.com/support/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=api-request-failed' ) );
314
+ ?>
315
+ </div>
316
+ </script>
317
+
318
+ <?php
319
+ /**
320
+ * TMPL - Site Down
321
+ */
322
+ ?>
323
+ <script type="text/template" id="tmpl-astra-site-down">
324
+ <div class="postbox astra-site-down">
325
+ <h2><?php _e( 'Under Maintenance..', 'astra-sites' ); ?></h2>
326
+ <p><?php _e( 'If you are seeing this message, most likely our servers are under routine maintenance and we will be back shortly. ', 'astra-sites' ); ?></p>
327
+ <p><?php _e( 'In rare case, it is possible your website is having trouble connecting with ours. If you need help, please feel free to get in touch with us from our website.', 'astra-sites' ); ?></p>
328
+ </div>
329
+ </script>
330
+
331
+ <?php
332
+ /**
333
+ * TMPL - Filters
334
+ */
335
+ ?>
336
+ <script type="text/template" id="tmpl-astra-site-filters">
337
+
338
+ <# if ( data ) { #>
339
+
340
+ <ul class="{{ data.args.wrapper_class }} {{ data.args.class }}">
341
+
342
+ <# if ( data.args.show_all ) { #>
343
+ <li>
344
+ <a href="#" data-group="all"> All </a>
345
+ </li>
346
+ <# } #>
347
+
348
+ <# for ( key in data.items ) { #>
349
+ <# if ( data.items[ key ].count ) { #>
350
+ <li>
351
+ <a href="#" data-group='{{ data.items[ key ].id }}' class="{{ data.items[ key ].name }}">
352
+ {{ data.items[ key ].name }}
353
+ </a>
354
+ </li>
355
+ <# } #>
356
+ <# } #>
357
+
358
+ </ul>
359
+ <# } #>
360
+ </script>
361
+
362
+ <?php
363
+ /**
364
+ * TMPL - List
365
+ */
366
+ ?>
367
+ <script type="text/template" id="tmpl-astra-sites-list">
368
+
369
+ <# if ( data.items.length ) { #>
370
+ <# for ( key in data.items ) { #>
371
+
372
+ <div class="theme astra-theme site-single {{ data.items[ key ].status }}" tabindex="0" aria-describedby="astra-theme-action astra-theme-name"
373
+ data-demo-id="{{{ data.items[ key ].id }}}"
374
+ data-demo-type="{{{ data.items[ key ]['astra-site-type'] }}}"
375
+ data-demo-url="{{{ data.items[ key ]['astra-site-url'] }}}"
376
+ data-demo-api="{{{ data.items[ key ]['_links']['self'][0]['href'] }}}"
377
+ data-demo-name="{{{ data.items[ key ].title.rendered }}}"
378
+ data-demo-slug="{{{ data.items[ key ].slug }}}"
379
+ data-screenshot="{{{ data.items[ key ]['featured-image-url'] }}}"
380
+ data-content="{{{ data.items[ key ].content.rendered }}}"
381
+ data-required-plugins="{{ JSON.stringify( data.items[ key ]['required-plugins'] ) }}"
382
+ data-groups=["{{ data.items[ key ].tags }}"]>
383
+ <input type="hidden" class="astra-site-options" value="{{ JSON.stringify(data.items[ key ]['astra-site-options-data'] ) }}" />
384
+ <input type="hidden" class="astra-enabled-extensions" value="{{ JSON.stringify(data.items[ key ]['astra-enabled-extensions'] ) }}" />
385
+
386
+ <div class="inner">
387
+ <span class="site-preview" data-href="{{ data.items[ key ]['astra-site-url'] }}?TB_iframe=true&width=600&height=550" data-title="{{ data.items[ key ].title.rendered }}">
388
+ <div class="theme-screenshot" style="background-image: url('{{ data.items[ key ]['featured-image-url'] }}');"></div>
389
+ </span>
390
+ <# if ( data.items[ key ]['astra-site-type'] ) { #>
391
+ <# var type = ( data.items[ key ]['astra-site-type'] !== 'premium' ) ? ( data.items[ key ]['astra-site-type'] ) : 'agency'; #>
392
+ <span class="site-type {{data.items[ key ]['astra-site-type']}}">{{ type }}</span>
393
+ <# } #>
394
+ <# if ( data.items[ key ].status ) { #>
395
+ <span class="status {{data.items[ key ].status}}">{{data.items[ key ].status}}</span>
396
+ <# } #>
397
+ <div class="theme-id-container">
398
+ <h3 class="theme-name" id="astra-theme-name"> {{{ data.items[ key ].title.rendered }}} </h3>
399
+ <div class="theme-actions">
400
+ <button class="button-primary button preview install-theme-preview"><?php esc_html_e( 'Preview', 'astra-sites' ); ?></button>
401
+ </div>
402
+ </div>
403
+ </div>
404
+ </div>
405
+ <# } #>
406
+ <# } else { #>
407
+ <p class="no-themes" style="display:block;">
408
+ <?php _e( 'No Demos found, Try a different search.', 'astra-sites' ); ?>
409
+ <span class="description">
410
+ <?php
411
+ /* translators: %1$s External Link */
412
+ printf( __( 'Don\'t see a site that you would like to import?<br><a target="_blank" href="%1$s">Please suggest us!</a>', 'astra-sites' ), esc_url( 'https://wpastra.com/sites-suggestions/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=suggestions' ) );
413
+ ?>
414
+ </span>
415
+ </p>
416
+ <# } #>
417
+ </script>
418
+
419
+ <?php
420
+ /**
421
+ * TMPL - List
422
+ */
423
+ ?>
424
+ <script type="text/template" id="tmpl-astra-sites-suggestions">
425
+ <div class="theme astra-theme site-single astra-sites-suggestions">
426
+ <div class="inner">
427
+ <p>
428
+ <?php
429
+ /* translators: %1$s External Link */
430
+ printf( __( 'Don\'t see a site that you would like to import?<br><a target="_blank" href="%1$s">Please suggest us!</a>', 'astra-sites' ), esc_url( 'https://wpastra.com/sites-suggestions/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=suggestions' ) );
431
+ ?>
432
+ </p>
433
+ </div>
434
+ </div>
435
+ </script>
436
+ <?php
437
+ wp_print_admin_notice_templates();
languages/astra-sites.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Astra Starter Sites package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Astra Starter Sites 1.3.16\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/astra-sites\n"
7
- "POT-Creation-Date: 2019-06-21 08:51:03+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -642,7 +642,7 @@ msgid ""
642
  msgstr ""
643
 
644
  #: inc/includes/admin-page.php:109
645
- msgid "Required Plugin Missing"
646
  msgstr ""
647
 
648
  #: inc/includes/admin-page.php:110
2
  # This file is distributed under the same license as the Astra Starter Sites package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Astra Starter Sites 1.3.17\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/astra-sites\n"
7
+ "POT-Creation-Date: 2019-06-28 10:54:05+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
642
  msgstr ""
643
 
644
  #: inc/includes/admin-page.php:109
645
+ msgid "Required Plugins Missing"
646
  msgstr ""
647
 
648
  #: inc/includes/admin-page.php:110
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: Elementor,Beaver Builder,Templates,Gutenberg,Astra Starter Sites
5
  Requires at least: 4.4
6
  Requires PHP: 5.3
7
  Tested up to: 5.2
8
- Stable tag: 1.3.16
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -46,7 +46,7 @@ You can extend this library with premium ready-to-use website demos by purchasin
46
 
47
  = WHY PEOPLE LOVE THE ASTRA THEME? =
48
 
49
- Over 200,000+ users are empowering their websites with Astra! From beginners to industry experts, everyone is loving Astra for its performance and ease of use.
50
 
51
  = Here are a few reasons why they love Astra - =
52
 
@@ -54,10 +54,14 @@ Over 200,000+ users are empowering their websites with Astra! From beginners to
54
 
55
  **Easy Customization** - With all the settings managed through the customizer, Astra keeps it simple and gives you lots of options to customize everything with a few clicks.
56
 
57
- **Pixel Perfect Design** - Astra reduces your design time by giving you pixel-perfect FREE ready-to-use websites demos within a huge library of starter sites.
 
 
58
 
59
  **Deeper Integrations** - Astra works seamlessly with all WooCommerce plugins, LifterLMS, LearnDash etc. This means that you can create and beautify eCommerce websites and those that offer online courses in minutes.
60
 
 
 
61
  Fetch the website, tweak images and content and go live!
62
 
63
  Use this imported site as a base for your project and don't waste time starting from scratch!
@@ -117,6 +121,9 @@ We are open to suggestions and would love to work on topics that our users are l
117
 
118
  == Changelog ==
119
 
 
 
 
120
  v1.3.16 - 21-June-2019
121
  - Fix: WooCommerce onboarding setup blocked issue fixed.
122
 
5
  Requires at least: 4.4
6
  Requires PHP: 5.3
7
  Tested up to: 5.2
8
+ Stable tag: 1.3.17
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
46
 
47
  = WHY PEOPLE LOVE THE ASTRA THEME? =
48
 
49
+ Over 300,000+ users are empowering their websites with Astra! From beginners to industry experts, everyone is loving Astra for its performance and ease of use.
50
 
51
  = Here are a few reasons why they love Astra - =
52
 
54
 
55
  **Easy Customization** - With all the settings managed through the customizer, Astra keeps it simple and gives you lots of options to customize everything with a few clicks.
56
 
57
+ **Compatibility with Page Builders** - Astra is built to work great with all major page builders like Elementor, Beaver Builder, Brizy, Divi, etc. With support for custom layouts and templates, it has soon become a favorite <a href="https://wpastra.com/theme-for-elementor/?utm_source=wp-repo&utm_medium=astra_desc&utm_campaign=starter_sites">theme for Elementor</a>, Beaver Builder and all the others
58
+
59
+ **Pixel Perfect Design** - Astra reduces your design time by giving you pixel-perfect FREE ready-to-use website demos within a huge library of starter sites.
60
 
61
  **Deeper Integrations** - Astra works seamlessly with all WooCommerce plugins, LifterLMS, LearnDash etc. This means that you can create and beautify eCommerce websites and those that offer online courses in minutes.
62
 
63
+ **Ready-to-use complete website demos** - You get the above collection of ready-to-use free starter sites that can be imported and used with the Astra theme.
64
+
65
  Fetch the website, tweak images and content and go live!
66
 
67
  Use this imported site as a base for your project and don't waste time starting from scratch!
121
 
122
  == Changelog ==
123
 
124
+ v1.3.17 - 28-June-2019
125
+ - Minor changes in Links
126
+
127
  v1.3.16 - 21-June-2019
128
  - Fix: WooCommerce onboarding setup blocked issue fixed.
129