Astra Starter Sites - Version 1.2.7

Version Description

Download this release

Release Info

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

Code changes from version 1.2.6 to 1.2.7

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.2.6
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.2.6' );
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.2.7
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.2.7' );
23
  }
24
 
25
  if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
inc/assets/css/admin.css CHANGED
@@ -460,4 +460,9 @@ body.loading-content .select-page-builder {
460
  -ms-transform: rotate(360deg);
461
  transform: rotate(360deg);
462
  }
 
 
 
 
 
463
  }
460
  -ms-transform: rotate(360deg);
461
  transform: rotate(360deg);
462
  }
463
+ }
464
+
465
+ #astra-sites-filters {
466
+ display: inline-block;
467
+ width: 100%;
468
  }
inc/assets/js/render-grid.js CHANGED
@@ -188,14 +188,11 @@
188
  var selected_category_id = jQuery('.filter-links.astra-site-category').find('.current').data('group') || '';
189
  if( '' !== selected_category_id && 'all' !== selected_category_id ) {
190
  AstraRender._api_params['astra-site-category'] = selected_category_id;
191
- } else if( 'astra-site-category' in astraRenderGrid.settings ) {
192
-
193
- if( $.inArray('all', astraRenderGrid.settings['astra-site-category']) !== -1 ) {
194
- var storedCategories = astraRenderGrid.settings['astra-site-category'];
195
- storedCategories = jQuery.grep(storedCategories, function(value) {
196
- return value != 'all';
197
- });
198
- AstraRender._api_params['astra-site-category'] = storedCategories.join(',');
199
  }
200
  }
201
  },
@@ -205,13 +202,11 @@
205
  var selected_page_builder_id = jQuery('.filter-links.astra-site-page-builder').find('.current').data('group') || '';
206
  if( '' !== selected_page_builder_id && 'all' !== selected_page_builder_id ) {
207
  AstraRender._api_params['astra-site-page-builder'] = selected_page_builder_id;
208
- } else if( 'astra-site-page-builder' in astraRenderGrid.settings ) {
209
- if( $.inArray('all', astraRenderGrid.settings['astra-site-page-builder']) !== -1 ) {
210
- var storedBuilders = astraRenderGrid.settings['astra-site-page-builder'];
211
- storedBuilders = jQuery.grep(storedBuilders, function(value) {
212
- return value != 'all';
213
- });
214
- AstraRender._api_params['astra-site-page-builder'] = storedBuilders.join(',');
215
  }
216
  }
217
  },
@@ -287,17 +282,25 @@
287
  */
288
  _getPageBuilderParams: function()
289
  {
290
- var _category_params = {};
291
 
292
  if( astraRenderGrid.sites && astraRenderGrid.sites.purchase_key ) {
293
- _category_params['purchase_key'] = astraRenderGrid.sites.purchase_key;
294
  }
295
 
296
  if( astraRenderGrid.sites && astraRenderGrid.sites.site_url ) {
297
- _category_params['site_url'] = astraRenderGrid.sites.site_url;
 
 
 
 
 
 
 
 
298
  }
299
 
300
- return '/?' + decodeURIComponent( $.param( _category_params ) );
301
  },
302
 
303
  /**
@@ -308,20 +311,17 @@
308
  */
309
  _getCategoryParams: function( category_slug ) {
310
 
311
- // Has category?
312
- if( category_slug in astraRenderGrid.settings ) {
313
-
314
- var storedBuilders = astraRenderGrid.settings[ category_slug ];
315
-
316
- // Remove `all` from stored list?
317
- storedBuilders = jQuery.grep(storedBuilders, function(value) {
318
- return value != 'all';
319
- });
320
 
321
- return '?include='+storedBuilders.join(',');
 
 
 
 
 
322
  }
323
 
324
- return '';
325
  },
326
 
327
  /**
@@ -389,6 +389,8 @@
389
  $('#astra-sites-admin').append( wp.template( 'astra-site-select-page-builder' ) );
390
  }
391
  }
 
 
392
  }
393
 
394
  },
@@ -545,6 +547,11 @@
545
  jQuery('body').attr('data-astra-demo-search', '');
546
  jQuery('body').attr('data-scrolling', false);
547
 
 
 
 
 
 
548
  }
549
 
550
  };
188
  var selected_category_id = jQuery('.filter-links.astra-site-category').find('.current').data('group') || '';
189
  if( '' !== selected_category_id && 'all' !== selected_category_id ) {
190
  AstraRender._api_params['astra-site-category'] = selected_category_id;
191
+ } else if( astraRenderGrid.sites && astraRenderGrid['categories'].include ) {
192
+ if( AstraRender._isArray( astraRenderGrid['categories'].include ) ) {
193
+ AstraRender._api_params['astra-site-category'] = astraRenderGrid['categories'].include.join(',');
194
+ } else {
195
+ AstraRender._api_params['astra-site-category'] = astraRenderGrid['categories'].include;
 
 
 
196
  }
197
  }
198
  },
202
  var selected_page_builder_id = jQuery('.filter-links.astra-site-page-builder').find('.current').data('group') || '';
203
  if( '' !== selected_page_builder_id && 'all' !== selected_page_builder_id ) {
204
  AstraRender._api_params['astra-site-page-builder'] = selected_page_builder_id;
205
+ } else if( astraRenderGrid.sites && astraRenderGrid['page-builders'].include ) {
206
+ if( AstraRender._isArray( astraRenderGrid['page-builders'].include ) ) {
207
+ AstraRender._api_params['astra-site-page-builder'] = astraRenderGrid['page-builders'].include.join(',');
208
+ } else {
209
+ AstraRender._api_params['astra-site-page-builder'] = astraRenderGrid['page-builders'].include;
 
 
210
  }
211
  }
212
  },
282
  */
283
  _getPageBuilderParams: function()
284
  {
285
+ var _params = {};
286
 
287
  if( astraRenderGrid.sites && astraRenderGrid.sites.purchase_key ) {
288
+ _params['purchase_key'] = astraRenderGrid.sites.purchase_key;
289
  }
290
 
291
  if( astraRenderGrid.sites && astraRenderGrid.sites.site_url ) {
292
+ _params['site_url'] = astraRenderGrid.sites.site_url;
293
+ }
294
+
295
+ if( astraRenderGrid.sites && astraRenderGrid['page-builders'].include ) {
296
+ if( AstraRender._isArray( astraRenderGrid['page-builders'].include ) ) {
297
+ _params['include'] = astraRenderGrid['page-builders'].include.join(',');
298
+ } else {
299
+ _params['include'] = astraRenderGrid['page-builders'].include;
300
+ }
301
  }
302
 
303
+ return '/?' + decodeURIComponent( $.param( _params ) );
304
  },
305
 
306
  /**
311
  */
312
  _getCategoryParams: function( category_slug ) {
313
 
314
+ var _params = {};
 
 
 
 
 
 
 
 
315
 
316
+ if( astraRenderGrid.sites && astraRenderGrid['categories'].include ) {
317
+ if( AstraRender._isArray( astraRenderGrid['categories'].include ) ) {
318
+ _params['include'] = astraRenderGrid['categories'].include.join(',');
319
+ } else {
320
+ _params['include'] = astraRenderGrid['categories'].include;
321
+ }
322
  }
323
 
324
+ return '/?' + decodeURIComponent( $.param( _params ) );
325
  },
326
 
327
  /**
389
  $('#astra-sites-admin').append( wp.template( 'astra-site-select-page-builder' ) );
390
  }
391
  }
392
+ } else {
393
+ AstraRender._showSites();
394
  }
395
 
396
  },
547
  jQuery('body').attr('data-astra-demo-search', '');
548
  jQuery('body').attr('data-scrolling', false);
549
 
550
+ },
551
+
552
+ // Returns if a value is an array
553
+ _isArray: function(value) {
554
+ return value && typeof value === 'object' && value.constructor === Array;
555
  }
556
 
557
  };
inc/classes/class-astra-sites.php CHANGED
@@ -1,455 +1,457 @@
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
- }
69
-
70
- /**
71
- * Add Admin Notice.
72
- */
73
- function add_notice() {
74
-
75
- Astra_Sites_Notices::add_notice(
76
- array(
77
- 'id' => 'astra-theme-activation-nag',
78
- 'type' => 'error',
79
- 'show_if' => ( ! defined( 'ASTRA_THEME_SETTINGS' ) ) ? true : false,
80
- /* translators: 1: theme.php file*/
81
- 'message' => sprintf( __( 'Astra Theme needs to be active for you to use currently installed "%1$s" plugin. <a href="%2$s">Install & Activate Now</a>', 'astra-sites' ), ASTRA_SITES_NAME, esc_url( admin_url( 'themes.php?theme=astra' ) ) ),
82
- 'dismissible' => true,
83
- 'dismissible-time' => WEEK_IN_SECONDS,
84
- )
85
- );
86
-
87
- }
88
-
89
- /**
90
- * Loads textdomain for the plugin.
91
- *
92
- * @since 1.0.1
93
- */
94
- function load_textdomain() {
95
- load_plugin_textdomain( 'astra-sites' );
96
- }
97
-
98
- /**
99
- * Admin Notices
100
- *
101
- * @since 1.0.5
102
- * @return void
103
- */
104
- function admin_notices() {
105
-
106
- if ( ! defined( 'ASTRA_THEME_SETTINGS' ) ) {
107
- return;
108
- }
109
-
110
- add_action( 'plugin_action_links_' . ASTRA_SITES_BASE, array( $this, 'action_links' ) );
111
- }
112
-
113
- /**
114
- * Show action links on the plugin screen.
115
- *
116
- * @param mixed $links Plugin Action links.
117
- * @return array
118
- */
119
- function action_links( $links ) {
120
- $action_links = array(
121
- '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>',
122
- );
123
-
124
- return array_merge( $action_links, $links );
125
- }
126
-
127
- /**
128
- * Setter for $api_url
129
- *
130
- * @since 1.0.0
131
- */
132
- public static function set_api_url() {
133
-
134
- self::$api_url = apply_filters( 'astra_sites_api_url', 'https://websitedemos.net/wp-json/wp/v2/' );
135
-
136
- }
137
-
138
- /**
139
- * Enqueue admin scripts.
140
- *
141
- * @since 1.0.5 Added 'getUpgradeText' and 'getUpgradeURL' localize variables.
142
- *
143
- * @since 1.0.0
144
- *
145
- * @param string $hook Current hook name.
146
- * @return void
147
- */
148
- public function admin_enqueue( $hook = '' ) {
149
-
150
- if ( 'appearance_page_astra-sites' !== $hook ) {
151
- return;
152
- }
153
-
154
- global $is_IE, $is_edge;
155
-
156
- if ( $is_IE || $is_edge ) {
157
- wp_enqueue_script( 'astra-sites-eventsource', ASTRA_SITES_URI . 'inc/assets/js/eventsource.min.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_SITES_VER, true );
158
- }
159
-
160
- // API.
161
- wp_register_script( 'astra-sites-api', ASTRA_SITES_URI . 'inc/assets/js/astra-sites-api.js', array( 'jquery' ), ASTRA_SITES_VER, true );
162
-
163
- // Admin Page.
164
- wp_enqueue_style( 'astra-sites-admin', ASTRA_SITES_URI . 'inc/assets/css/admin.css', ASTRA_SITES_VER, true );
165
- 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 );
166
- 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 );
167
-
168
- $data = array(
169
- 'ApiURL' => self::$api_url,
170
- 'filters' => array(
171
- 'page_builder' => array(
172
- 'title' => __( 'Page Builder', 'astra-sites' ),
173
- 'slug' => 'astra-site-page-builder',
174
- 'trigger' => 'astra-api-category-loaded',
175
- ),
176
- 'categories' => array(
177
- 'title' => __( 'Categories', 'astra-sites' ),
178
- 'slug' => 'astra-site-category',
179
- 'trigger' => 'astra-api-category-loaded',
180
- ),
181
- ),
182
- );
183
- wp_localize_script( 'astra-sites-api', 'astraSitesApi', $data );
184
-
185
- // Use this for premium demos.
186
- $request_params = apply_filters(
187
- 'astra_sites_api_params', array(
188
- 'purchase_key' => '',
189
- 'site_url' => '',
190
- 'par-page' => 15,
191
- )
192
- );
193
-
194
- $data = apply_filters(
195
- 'astra_sites_localize_vars',
196
- array(
197
- 'sites' => $request_params,
198
- 'settings' => array(),
199
- )
200
- );
201
-
202
- wp_localize_script( 'astra-sites-render-grid', 'astraRenderGrid', $data );
203
-
204
- $data = apply_filters(
205
- 'astra_sites_localize_vars',
206
- array(
207
- 'debug' => ( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || isset( $_GET['debug'] ) ) ? true : false,
208
- 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
209
- 'siteURL' => site_url(),
210
- 'getProText' => __( 'Purchase', 'astra-sites' ),
211
- 'getProURL' => esc_url( 'https://wpastra.com/agency/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=wp-dashboard' ),
212
- 'getUpgradeText' => __( 'Upgrade', 'astra-sites' ),
213
- 'getUpgradeURL' => esc_url( 'https://wpastra.com/agency/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=wp-dashboard' ),
214
- '_ajax_nonce' => wp_create_nonce( 'astra-sites' ),
215
- 'requiredPlugins' => array(),
216
- 'strings' => array(
217
- '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' ),
218
- 'importFailedBtnSmall' => __( 'Error!', 'astra-sites' ),
219
- 'importFailedBtnLarge' => __( 'Error! Read Possibilities.', 'astra-sites' ),
220
- 'importFailedURL' => esc_url( 'https://wpastra.com/docs/?p=1314&utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=import-failed' ),
221
- 'viewSite' => __( 'Done! View Site', 'astra-sites' ),
222
- 'btnActivating' => __( 'Activating', 'astra-sites' ) . '&hellip;',
223
- 'btnActive' => __( 'Active', 'astra-sites' ),
224
- 'importFailBtn' => __( 'Import failed.', 'astra-sites' ),
225
- 'importFailBtnLarge' => __( 'Import failed. See error log.', 'astra-sites' ),
226
- 'importDemo' => __( 'Import This Site', 'astra-sites' ),
227
- 'importingDemo' => __( 'Importing..', 'astra-sites' ),
228
- 'DescExpand' => __( 'Read more', 'astra-sites' ) . '&hellip;',
229
- 'DescCollapse' => __( 'Hide', 'astra-sites' ),
230
- 'responseError' => __( 'There was a problem receiving a response from server.', 'astra-sites' ),
231
- 'searchNoFound' => __( 'No Demos found, Try a different search.', 'astra-sites' ),
232
- 'importWarning' => __( "Executing Demo Import will make your site similar as ours. Please bear in mind -\n\n1. It is recommended to run import on a fresh WordPress installation.\n\n2. Importing site does not delete any pages or posts. However, it can overwrite your existing content.\n\n3. Copyrighted media will not be imported. Instead it will be replaced with placeholders.", 'astra-sites' ),
233
- ),
234
- 'log' => array(
235
- 'installingPlugin' => __( 'Installing plugin ', 'astra-sites' ),
236
- 'installed' => __( 'Successfully plugin installed!', 'astra-sites' ),
237
- 'activating' => __( 'Activating plugin ', 'astra-sites' ),
238
- 'activated' => __( 'Successfully plugin activated ', 'astra-sites' ),
239
- 'bulkActivation' => __( 'Bulk plugin activation...', 'astra-sites' ),
240
- 'activate' => __( 'Successfully plugin activate - ', 'astra-sites' ),
241
- 'activationError' => __( 'Error! While activating plugin - ', 'astra-sites' ),
242
- 'bulkInstall' => __( 'Bulk plugin installation...', 'astra-sites' ),
243
- 'api' => __( 'Site API ', 'astra-sites' ),
244
- 'importing' => __( 'Importing..', 'astra-sites' ),
245
- 'processingRequest' => __( 'Processing requests...', 'astra-sites' ),
246
- 'importCustomizer' => __( '1) Importing "Customizer Settings"...', 'astra-sites' ),
247
- 'importCustomizerSuccess' => __( 'Successfully imported customizer settings!', 'astra-sites' ),
248
- 'importXMLPrepare' => __( '2) Preparing "XML" Data...', 'astra-sites' ),
249
- 'importXMLPrepareSuccess' => __( 'Successfully set XML data!', 'astra-sites' ),
250
- 'importXML' => __( '3) Importing "XML"...', 'astra-sites' ),
251
- 'importXMLSuccess' => __( 'Successfully imported XML!', 'astra-sites' ),
252
- 'importOptions' => __( '4) Importing "Options"...', 'astra-sites' ),
253
- 'importOptionsSuccess' => __( 'Successfully imported Options!', 'astra-sites' ),
254
- 'importWidgets' => __( '5) Importing "Widgets"...', 'astra-sites' ),
255
- 'importWidgetsSuccess' => __( 'Successfully imported Widgets!', 'astra-sites' ),
256
- 'serverConfiguration' => esc_url( 'https://wpastra.com/docs/?p=1314&utm_source=demo-import-panel&utm_campaign=import-error&utm_medium=wp-dashboard' ),
257
- 'success' => __( 'Site imported successfully! visit : ', 'astra-sites' ),
258
- 'gettingData' => __( 'Getting Site Information..', 'astra-sites' ),
259
- 'importingCustomizer' => __( 'Importing Customizer Settings..', 'astra-sites' ),
260
- 'importXMLPreparing' => __( 'Setting up import data..', 'astra-sites' ),
261
- 'importingXML' => __( 'Importing Pages, Posts & Media..', 'astra-sites' ),
262
- 'importingOptions' => __( 'Importing Site Options..', 'astra-sites' ),
263
- 'importingWidgets' => __( 'Importing Widgets..', 'astra-sites' ),
264
- 'importComplete' => __( 'Import Complete..', 'astra-sites' ),
265
- 'preview' => __( 'Previewing ', 'astra-sites' ),
266
- 'importLogText' => __( 'See Error Log &rarr;', 'astra-sites' ),
267
- ),
268
- )
269
- );
270
-
271
- wp_localize_script( 'astra-sites-admin-page', 'astraSitesAdmin', $data );
272
-
273
- }
274
-
275
- /**
276
- * Load all the required files in the importer.
277
- *
278
- * @since 1.0.0
279
- */
280
- private function includes() {
281
-
282
- require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-notices.php';
283
- require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-page.php';
284
- require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/class-astra-sites-compatibility.php';
285
- require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-white-label.php';
286
- require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-importer.php';
287
-
288
- }
289
-
290
- /**
291
- * Required Plugin Activate
292
- *
293
- * @since 1.0.0
294
- */
295
- public function required_plugin_activate() {
296
-
297
- if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! $_POST['init'] ) {
298
- wp_send_json_error(
299
- array(
300
- 'success' => false,
301
- 'message' => __( 'No plugin specified', 'astra-sites' ),
302
- )
303
- );
304
- }
305
-
306
- $data = array();
307
- $plugin_init = ( isset( $_POST['init'] ) ) ? esc_attr( $_POST['init'] ) : '';
308
- $astra_site_options = ( isset( $_POST['options'] ) ) ? json_decode( stripslashes( $_POST['options'] ) ) : '';
309
- $enabled_extensions = ( isset( $_POST['enabledExtensions'] ) ) ? json_decode( stripslashes( $_POST['enabledExtensions'] ) ) : '';
310
-
311
- $data['astra_site_options'] = $astra_site_options;
312
- $data['enabled_extensions'] = $enabled_extensions;
313
-
314
- $activate = activate_plugin( $plugin_init, '', false, true );
315
-
316
- if ( is_wp_error( $activate ) ) {
317
- wp_send_json_error(
318
- array(
319
- 'success' => false,
320
- 'message' => $activate->get_error_message(),
321
- )
322
- );
323
- }
324
-
325
- do_action( 'astra_sites_after_plugin_activation', $plugin_init, $data );
326
-
327
- wp_send_json_success(
328
- array(
329
- 'success' => true,
330
- 'message' => __( 'Plugin Successfully Activated', 'astra-sites' ),
331
- )
332
- );
333
-
334
- }
335
-
336
- /**
337
- * Required Plugin
338
- *
339
- * @since 1.0.0
340
- * @return void
341
- */
342
- public function required_plugin() {
343
-
344
- // Verify Nonce.
345
- check_ajax_referer( 'astra-sites', '_ajax_nonce' );
346
-
347
- $response = array(
348
- 'active' => array(),
349
- 'inactive' => array(),
350
- 'notinstalled' => array(),
351
- );
352
-
353
- if ( ! current_user_can( 'customize' ) ) {
354
- wp_send_json_error( $response );
355
- }
356
-
357
- $required_plugins = ( isset( $_POST['required_plugins'] ) ) ? $_POST['required_plugins'] : array();
358
-
359
- if ( count( $required_plugins ) > 0 ) {
360
- foreach ( $required_plugins as $key => $plugin ) {
361
-
362
- /**
363
- * Has Pro Version Support?
364
- * And
365
- * Is Pro Version Installed?
366
- */
367
- $plugin_pro = self::pro_plugin_exist( $plugin['init'] );
368
- if ( $plugin_pro ) {
369
-
370
- // Pro - Active.
371
- if ( is_plugin_active( $plugin_pro['init'] ) ) {
372
- $response['active'][] = $plugin_pro;
373
-
374
- // Pro - Inactive.
375
- } else {
376
- $response['inactive'][] = $plugin_pro;
377
- }
378
- } else {
379
-
380
- // Lite - Installed but Inactive.
381
- if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin['init'] ) && is_plugin_inactive( $plugin['init'] ) ) {
382
-
383
- $response['inactive'][] = $plugin;
384
-
385
- // Lite - Not Installed.
386
- } elseif ( ! file_exists( WP_PLUGIN_DIR . '/' . $plugin['init'] ) ) {
387
-
388
- $response['notinstalled'][] = $plugin;
389
-
390
- // Lite - Active.
391
- } else {
392
- $response['active'][] = $plugin;
393
- }
394
- }
395
- }
396
- }
397
-
398
- // Send response.
399
- wp_send_json_success( $response );
400
- }
401
-
402
- /**
403
- * Has Pro Version Support?
404
- * And
405
- * Is Pro Version Installed?
406
- *
407
- * Check Pro plugin version exist of requested plugin lite version.
408
- *
409
- * Eg. If plugin 'BB Lite Version' required to import demo. Then we check the 'BB Agency Version' is exist?
410
- * If yes then we only 'Activate' Agency Version. [We couldn't install agency version.]
411
- * Else we 'Activate' or 'Install' Lite Version.
412
- *
413
- * @since 1.0.1
414
- *
415
- * @param string $lite_version Lite version init file.
416
- * @return mixed Return false if not installed or not supported by us
417
- * else return 'Pro' version details.
418
- */
419
- public static function pro_plugin_exist( $lite_version = '' ) {
420
-
421
- // Lite init => Pro init.
422
- $plugins = apply_filters(
423
- 'astra_sites_pro_plugin_exist', array(
424
- 'beaver-builder-lite-version/fl-builder.php' => array(
425
- 'slug' => 'bb-plugin',
426
- 'init' => 'bb-plugin/fl-builder.php',
427
- 'name' => 'Beaver Builder Plugin',
428
- ),
429
- 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' => array(
430
- 'slug' => 'bb-ultimate-addon',
431
- 'init' => 'bb-ultimate-addon/bb-ultimate-addon.php',
432
- 'name' => 'Ultimate Addon for Beaver Builder',
433
- ),
434
- ), $lite_version
435
- );
436
-
437
- if ( isset( $plugins[ $lite_version ] ) ) {
438
-
439
- // Pro plugin directory exist?
440
- if ( file_exists( WP_PLUGIN_DIR . '/' . $plugins[ $lite_version ]['init'] ) ) {
441
- return $plugins[ $lite_version ];
442
- }
443
- }
444
-
445
- return false;
446
- }
447
-
448
- }
449
-
450
- /**
451
- * Kicking this off by calling 'get_instance()' method
452
- */
453
- Astra_Sites::get_instance();
454
-
455
- 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
+ }
69
+
70
+ /**
71
+ * Add Admin Notice.
72
+ */
73
+ function add_notice() {
74
+
75
+ Astra_Sites_Notices::add_notice(
76
+ array(
77
+ 'id' => 'astra-theme-activation-nag',
78
+ 'type' => 'error',
79
+ 'show_if' => ( ! defined( 'ASTRA_THEME_SETTINGS' ) ) ? true : false,
80
+ /* translators: 1: theme.php file*/
81
+ 'message' => sprintf( __( 'Astra Theme needs to be active for you to use currently installed "%1$s" plugin. <a href="%2$s">Install & Activate Now</a>', 'astra-sites' ), ASTRA_SITES_NAME, esc_url( admin_url( 'themes.php?theme=astra' ) ) ),
82
+ 'dismissible' => true,
83
+ 'dismissible-time' => WEEK_IN_SECONDS,
84
+ )
85
+ );
86
+
87
+ }
88
+
89
+ /**
90
+ * Loads textdomain for the plugin.
91
+ *
92
+ * @since 1.0.1
93
+ */
94
+ function load_textdomain() {
95
+ load_plugin_textdomain( 'astra-sites' );
96
+ }
97
+
98
+ /**
99
+ * Admin Notices
100
+ *
101
+ * @since 1.0.5
102
+ * @return void
103
+ */
104
+ function admin_notices() {
105
+
106
+ if ( ! defined( 'ASTRA_THEME_SETTINGS' ) ) {
107
+ return;
108
+ }
109
+
110
+ add_action( 'plugin_action_links_' . ASTRA_SITES_BASE, array( $this, 'action_links' ) );
111
+ }
112
+
113
+ /**
114
+ * Show action links on the plugin screen.
115
+ *
116
+ * @param mixed $links Plugin Action links.
117
+ * @return array
118
+ */
119
+ function action_links( $links ) {
120
+ $action_links = array(
121
+ '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>',
122
+ );
123
+
124
+ return array_merge( $action_links, $links );
125
+ }
126
+
127
+ /**
128
+ * Setter for $api_url
129
+ *
130
+ * @since 1.0.0
131
+ */
132
+ public static function set_api_url() {
133
+
134
+ self::$api_url = apply_filters( 'astra_sites_api_url', 'https://websitedemos.net/wp-json/wp/v2/' );
135
+
136
+ }
137
+
138
+ /**
139
+ * Enqueue admin scripts.
140
+ *
141
+ * @since 1.0.5 Added 'getUpgradeText' and 'getUpgradeURL' localize variables.
142
+ *
143
+ * @since 1.0.0
144
+ *
145
+ * @param string $hook Current hook name.
146
+ * @return void
147
+ */
148
+ public function admin_enqueue( $hook = '' ) {
149
+
150
+ if ( 'appearance_page_astra-sites' !== $hook ) {
151
+ return;
152
+ }
153
+
154
+ global $is_IE, $is_edge;
155
+
156
+ if ( $is_IE || $is_edge ) {
157
+ wp_enqueue_script( 'astra-sites-eventsource', ASTRA_SITES_URI . 'inc/assets/js/eventsource.min.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_SITES_VER, true );
158
+ }
159
+
160
+ // API.
161
+ wp_register_script( 'astra-sites-api', ASTRA_SITES_URI . 'inc/assets/js/astra-sites-api.js', array( 'jquery' ), ASTRA_SITES_VER, true );
162
+
163
+ // Admin Page.
164
+ wp_enqueue_style( 'astra-sites-admin', ASTRA_SITES_URI . 'inc/assets/css/admin.css', ASTRA_SITES_VER, true );
165
+ 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 );
166
+ 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 );
167
+
168
+ $data = array(
169
+ 'ApiURL' => self::$api_url,
170
+ 'filters' => array(
171
+ 'page_builder' => array(
172
+ 'title' => __( 'Page Builder', 'astra-sites' ),
173
+ 'slug' => 'astra-site-page-builder',
174
+ 'trigger' => 'astra-api-category-loaded',
175
+ ),
176
+ 'categories' => array(
177
+ 'title' => __( 'Categories', 'astra-sites' ),
178
+ 'slug' => 'astra-site-category',
179
+ 'trigger' => 'astra-api-category-loaded',
180
+ ),
181
+ ),
182
+ );
183
+ wp_localize_script( 'astra-sites-api', 'astraSitesApi', $data );
184
+
185
+ // Use this for premium demos.
186
+ $request_params = apply_filters(
187
+ 'astra_sites_api_params', array(
188
+ 'purchase_key' => '',
189
+ 'site_url' => '',
190
+ 'par-page' => 15,
191
+ )
192
+ );
193
+
194
+ $data = apply_filters(
195
+ 'astra_sites_render_localize_vars',
196
+ array(
197
+ 'sites' => $request_params,
198
+ 'page-builders' => array(),
199
+ 'categories' => array(),
200
+ 'settings' => array(),
201
+ )
202
+ );
203
+
204
+ wp_localize_script( 'astra-sites-render-grid', 'astraRenderGrid', $data );
205
+
206
+ $data = apply_filters(
207
+ 'astra_sites_localize_vars',
208
+ array(
209
+ 'debug' => ( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || isset( $_GET['debug'] ) ) ? true : false,
210
+ 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
211
+ 'siteURL' => site_url(),
212
+ 'getProText' => __( 'Purchase', 'astra-sites' ),
213
+ 'getProURL' => esc_url( 'https://wpastra.com/agency/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=wp-dashboard' ),
214
+ 'getUpgradeText' => __( 'Upgrade', 'astra-sites' ),
215
+ 'getUpgradeURL' => esc_url( 'https://wpastra.com/agency/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=wp-dashboard' ),
216
+ '_ajax_nonce' => wp_create_nonce( 'astra-sites' ),
217
+ 'requiredPlugins' => array(),
218
+ 'strings' => array(
219
+ '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' ),
220
+ 'importFailedBtnSmall' => __( 'Error!', 'astra-sites' ),
221
+ 'importFailedBtnLarge' => __( 'Error! Read Possibilities.', 'astra-sites' ),
222
+ 'importFailedURL' => esc_url( 'https://wpastra.com/docs/?p=1314&utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=import-failed' ),
223
+ 'viewSite' => __( 'Done! View Site', 'astra-sites' ),
224
+ 'btnActivating' => __( 'Activating', 'astra-sites' ) . '&hellip;',
225
+ 'btnActive' => __( 'Active', 'astra-sites' ),
226
+ 'importFailBtn' => __( 'Import failed.', 'astra-sites' ),
227
+ 'importFailBtnLarge' => __( 'Import failed. See error log.', 'astra-sites' ),
228
+ 'importDemo' => __( 'Import This Site', 'astra-sites' ),
229
+ 'importingDemo' => __( 'Importing..', 'astra-sites' ),
230
+ 'DescExpand' => __( 'Read more', 'astra-sites' ) . '&hellip;',
231
+ 'DescCollapse' => __( 'Hide', 'astra-sites' ),
232
+ 'responseError' => __( 'There was a problem receiving a response from server.', 'astra-sites' ),
233
+ 'searchNoFound' => __( 'No Demos found, Try a different search.', 'astra-sites' ),
234
+ 'importWarning' => __( "Executing Demo Import will make your site similar as ours. Please bear in mind -\n\n1. It is recommended to run import on a fresh WordPress installation.\n\n2. Importing site does not delete any pages or posts. However, it can overwrite your existing content.\n\n3. Copyrighted media will not be imported. Instead it will be replaced with placeholders.", 'astra-sites' ),
235
+ ),
236
+ 'log' => array(
237
+ 'installingPlugin' => __( 'Installing plugin ', 'astra-sites' ),
238
+ 'installed' => __( 'Successfully plugin installed!', 'astra-sites' ),
239
+ 'activating' => __( 'Activating plugin ', 'astra-sites' ),
240
+ 'activated' => __( 'Successfully plugin activated ', 'astra-sites' ),
241
+ 'bulkActivation' => __( 'Bulk plugin activation...', 'astra-sites' ),
242
+ 'activate' => __( 'Successfully plugin activate - ', 'astra-sites' ),
243
+ 'activationError' => __( 'Error! While activating plugin - ', 'astra-sites' ),
244
+ 'bulkInstall' => __( 'Bulk plugin installation...', 'astra-sites' ),
245
+ 'api' => __( 'Site API ', 'astra-sites' ),
246
+ 'importing' => __( 'Importing..', 'astra-sites' ),
247
+ 'processingRequest' => __( 'Processing requests...', 'astra-sites' ),
248
+ 'importCustomizer' => __( '1) Importing "Customizer Settings"...', 'astra-sites' ),
249
+ 'importCustomizerSuccess' => __( 'Successfully imported customizer settings!', 'astra-sites' ),
250
+ 'importXMLPrepare' => __( '2) Preparing "XML" Data...', 'astra-sites' ),
251
+ 'importXMLPrepareSuccess' => __( 'Successfully set XML data!', 'astra-sites' ),
252
+ 'importXML' => __( '3) Importing "XML"...', 'astra-sites' ),
253
+ 'importXMLSuccess' => __( 'Successfully imported XML!', 'astra-sites' ),
254
+ 'importOptions' => __( '4) Importing "Options"...', 'astra-sites' ),
255
+ 'importOptionsSuccess' => __( 'Successfully imported Options!', 'astra-sites' ),
256
+ 'importWidgets' => __( '5) Importing "Widgets"...', 'astra-sites' ),
257
+ 'importWidgetsSuccess' => __( 'Successfully imported Widgets!', 'astra-sites' ),
258
+ 'serverConfiguration' => esc_url( 'https://wpastra.com/docs/?p=1314&utm_source=demo-import-panel&utm_campaign=import-error&utm_medium=wp-dashboard' ),
259
+ 'success' => __( 'Site imported successfully! visit : ', 'astra-sites' ),
260
+ 'gettingData' => __( 'Getting Site Information..', 'astra-sites' ),
261
+ 'importingCustomizer' => __( 'Importing Customizer Settings..', 'astra-sites' ),
262
+ 'importXMLPreparing' => __( 'Setting up import data..', 'astra-sites' ),
263
+ 'importingXML' => __( 'Importing Pages, Posts & Media..', 'astra-sites' ),
264
+ 'importingOptions' => __( 'Importing Site Options..', 'astra-sites' ),
265
+ 'importingWidgets' => __( 'Importing Widgets..', 'astra-sites' ),
266
+ 'importComplete' => __( 'Import Complete..', 'astra-sites' ),
267
+ 'preview' => __( 'Previewing ', 'astra-sites' ),
268
+ 'importLogText' => __( 'See Error Log &rarr;', 'astra-sites' ),
269
+ ),
270
+ )
271
+ );
272
+
273
+ wp_localize_script( 'astra-sites-admin-page', 'astraSitesAdmin', $data );
274
+
275
+ }
276
+
277
+ /**
278
+ * Load all the required files in the importer.
279
+ *
280
+ * @since 1.0.0
281
+ */
282
+ private function includes() {
283
+
284
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-notices.php';
285
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-page.php';
286
+ require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/class-astra-sites-compatibility.php';
287
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-white-label.php';
288
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-importer.php';
289
+
290
+ }
291
+
292
+ /**
293
+ * Required Plugin Activate
294
+ *
295
+ * @since 1.0.0
296
+ */
297
+ public function required_plugin_activate() {
298
+
299
+ if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! $_POST['init'] ) {
300
+ wp_send_json_error(
301
+ array(
302
+ 'success' => false,
303
+ 'message' => __( 'No plugin specified', 'astra-sites' ),
304
+ )
305
+ );
306
+ }
307
+
308
+ $data = array();
309
+ $plugin_init = ( isset( $_POST['init'] ) ) ? esc_attr( $_POST['init'] ) : '';
310
+ $astra_site_options = ( isset( $_POST['options'] ) ) ? json_decode( stripslashes( $_POST['options'] ) ) : '';
311
+ $enabled_extensions = ( isset( $_POST['enabledExtensions'] ) ) ? json_decode( stripslashes( $_POST['enabledExtensions'] ) ) : '';
312
+
313
+ $data['astra_site_options'] = $astra_site_options;
314
+ $data['enabled_extensions'] = $enabled_extensions;
315
+
316
+ $activate = activate_plugin( $plugin_init, '', false, true );
317
+
318
+ if ( is_wp_error( $activate ) ) {
319
+ wp_send_json_error(
320
+ array(
321
+ 'success' => false,
322
+ 'message' => $activate->get_error_message(),
323
+ )
324
+ );
325
+ }
326
+
327
+ do_action( 'astra_sites_after_plugin_activation', $plugin_init, $data );
328
+
329
+ wp_send_json_success(
330
+ array(
331
+ 'success' => true,
332
+ 'message' => __( 'Plugin Successfully Activated', 'astra-sites' ),
333
+ )
334
+ );
335
+
336
+ }
337
+
338
+ /**
339
+ * Required Plugin
340
+ *
341
+ * @since 1.0.0
342
+ * @return void
343
+ */
344
+ public function required_plugin() {
345
+
346
+ // Verify Nonce.
347
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
348
+
349
+ $response = array(
350
+ 'active' => array(),
351
+ 'inactive' => array(),
352
+ 'notinstalled' => array(),
353
+ );
354
+
355
+ if ( ! current_user_can( 'customize' ) ) {
356
+ wp_send_json_error( $response );
357
+ }
358
+
359
+ $required_plugins = ( isset( $_POST['required_plugins'] ) ) ? $_POST['required_plugins'] : array();
360
+
361
+ if ( count( $required_plugins ) > 0 ) {
362
+ foreach ( $required_plugins as $key => $plugin ) {
363
+
364
+ /**
365
+ * Has Pro Version Support?
366
+ * And
367
+ * Is Pro Version Installed?
368
+ */
369
+ $plugin_pro = self::pro_plugin_exist( $plugin['init'] );
370
+ if ( $plugin_pro ) {
371
+
372
+ // Pro - Active.
373
+ if ( is_plugin_active( $plugin_pro['init'] ) ) {
374
+ $response['active'][] = $plugin_pro;
375
+
376
+ // Pro - Inactive.
377
+ } else {
378
+ $response['inactive'][] = $plugin_pro;
379
+ }
380
+ } else {
381
+
382
+ // Lite - Installed but Inactive.
383
+ if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin['init'] ) && is_plugin_inactive( $plugin['init'] ) ) {
384
+
385
+ $response['inactive'][] = $plugin;
386
+
387
+ // Lite - Not Installed.
388
+ } elseif ( ! file_exists( WP_PLUGIN_DIR . '/' . $plugin['init'] ) ) {
389
+
390
+ $response['notinstalled'][] = $plugin;
391
+
392
+ // Lite - Active.
393
+ } else {
394
+ $response['active'][] = $plugin;
395
+ }
396
+ }
397
+ }
398
+ }
399
+
400
+ // Send response.
401
+ wp_send_json_success( $response );
402
+ }
403
+
404
+ /**
405
+ * Has Pro Version Support?
406
+ * And
407
+ * Is Pro Version Installed?
408
+ *
409
+ * Check Pro plugin version exist of requested plugin lite version.
410
+ *
411
+ * Eg. If plugin 'BB Lite Version' required to import demo. Then we check the 'BB Agency Version' is exist?
412
+ * If yes then we only 'Activate' Agency Version. [We couldn't install agency version.]
413
+ * Else we 'Activate' or 'Install' Lite Version.
414
+ *
415
+ * @since 1.0.1
416
+ *
417
+ * @param string $lite_version Lite version init file.
418
+ * @return mixed Return false if not installed or not supported by us
419
+ * else return 'Pro' version details.
420
+ */
421
+ public static function pro_plugin_exist( $lite_version = '' ) {
422
+
423
+ // Lite init => Pro init.
424
+ $plugins = apply_filters(
425
+ 'astra_sites_pro_plugin_exist', array(
426
+ 'beaver-builder-lite-version/fl-builder.php' => array(
427
+ 'slug' => 'bb-plugin',
428
+ 'init' => 'bb-plugin/fl-builder.php',
429
+ 'name' => 'Beaver Builder Plugin',
430
+ ),
431
+ 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' => array(
432
+ 'slug' => 'bb-ultimate-addon',
433
+ 'init' => 'bb-ultimate-addon/bb-ultimate-addon.php',
434
+ 'name' => 'Ultimate Addon for Beaver Builder',
435
+ ),
436
+ ), $lite_version
437
+ );
438
+
439
+ if ( isset( $plugins[ $lite_version ] ) ) {
440
+
441
+ // Pro plugin directory exist?
442
+ if ( file_exists( WP_PLUGIN_DIR . '/' . $plugins[ $lite_version ]['init'] ) ) {
443
+ return $plugins[ $lite_version ];
444
+ }
445
+ }
446
+
447
+ return false;
448
+ }
449
+
450
+ }
451
+
452
+ /**
453
+ * Kicking this off by calling 'get_instance()' method
454
+ */
455
+ Astra_Sites::get_instance();
456
+
457
+ endif;
inc/importers/wxr-importer/class-astra-wxr-importer.php CHANGED
@@ -1,332 +1,332 @@
1
- <?php
2
- /**
3
- * Class Astra WXR Importer
4
- *
5
- * @since 1.0.0
6
- * @package Astra Addon
7
- */
8
-
9
- defined( 'ABSPATH' ) or exit;
10
-
11
- /**
12
- * Class Astra WXR Importer
13
- *
14
- * @since 1.0.0
15
- */
16
- class Astra_WXR_Importer {
17
-
18
- /**
19
- * Instance of Astra_WXR_Importer
20
- *
21
- * @since 1.0.0
22
- * @var Astra_WXR_Importer
23
- */
24
- private static $_instance = null;
25
-
26
- /**
27
- * Instantiate Astra_WXR_Importer
28
- *
29
- * @since 1.0.0
30
- * @return (Object) Astra_WXR_Importer.
31
- */
32
- public static function instance() {
33
- if ( ! isset( self::$_instance ) ) {
34
- self::$_instance = new self();
35
- }
36
-
37
- return self::$_instance;
38
- }
39
-
40
- /**
41
- * Constructor.
42
- *
43
- * @since 1.0.0
44
- */
45
- private function __construct() {
46
-
47
- if ( ! class_exists( 'WP_Importer' ) ) {
48
- defined( 'WP_LOAD_IMPORTERS' ) || define( 'WP_LOAD_IMPORTERS', true );
49
- require ABSPATH . '/wp-admin/includes/class-wp-importer.php';
50
- }
51
-
52
- if ( ! class_exists( 'WP_Importer_Logger' ) ) {
53
- require_once ASTRA_SITES_DIR . 'inc/importers/wxr-importer/class-logger.php';
54
- }
55
-
56
- if ( ! class_exists( 'WP_Importer_Logger_ServerSentEvents' ) ) {
57
- require_once ASTRA_SITES_DIR . 'inc/importers/wxr-importer/class-wp-importer-logger-serversentevents.php';
58
- }
59
-
60
- if ( ! class_exists( 'WXR_Importer' ) ) {
61
- require_once ASTRA_SITES_DIR . 'inc/importers/wxr-importer/class-wxr-importer.php';
62
- }
63
-
64
- if ( ! class_exists( 'WXR_Import_Info' ) ) {
65
- require_once ASTRA_SITES_DIR . 'inc/importers/wxr-importer/class-wxr-import-info.php';
66
- }
67
-
68
- add_filter( 'upload_mimes', array( $this, 'custom_upload_mimes' ) );
69
- add_action( 'wp_ajax_astra-wxr-import', array( $this, 'sse_import' ) );
70
- add_filter( 'wxr_importer.pre_process.user', '__return_null' );
71
-
72
- }
73
-
74
- /**
75
- * Constructor.
76
- *
77
- * @since 1.1.0
78
- */
79
- function sse_import() {
80
-
81
- // Start the event stream.
82
- header( 'Content-Type: text/event-stream' );
83
-
84
- // Turn off PHP output compression.
85
- $previous = error_reporting( error_reporting() ^ E_WARNING );
86
- ini_set( 'output_buffering', 'off' );
87
- ini_set( 'zlib.output_compression', false );
88
- error_reporting( $previous );
89
-
90
- if ( $GLOBALS['is_nginx'] ) {
91
- // Setting this header instructs Nginx to disable fastcgi_buffering
92
- // and disable gzip for this request.
93
- header( 'X-Accel-Buffering: no' );
94
- header( 'Content-Encoding: none' );
95
- }
96
-
97
- $xml_url = urldecode( $_REQUEST['xml_url'] );
98
- if ( empty( $xml_url ) ) {
99
- exit;
100
- }
101
-
102
- // 2KB padding for IE
103
- echo ':' . str_repeat( ' ', 2048 ) . "\n\n";
104
-
105
- // Time to run the import!
106
- set_time_limit( 0 );
107
-
108
- // Ensure we're not buffered.
109
- wp_ob_end_flush_all();
110
- flush();
111
-
112
- // Are we allowed to create users?
113
- add_filter( 'wxr_importer.pre_process.user', '__return_null' );
114
-
115
- // Keep track of our progress.
116
- add_action( 'wxr_importer.processed.post', array( $this, 'imported_post' ), 10, 2 );
117
- add_action( 'wxr_importer.process_failed.post', array( $this, 'imported_post' ), 10, 2 );
118
- add_action( 'wxr_importer.process_already_imported.post', array( $this, 'already_imported_post' ), 10, 2 );
119
- add_action( 'wxr_importer.process_skipped.post', array( $this, 'already_imported_post' ), 10, 2 );
120
- add_action( 'wxr_importer.processed.comment', array( $this, 'imported_comment' ) );
121
- add_action( 'wxr_importer.process_already_imported.comment', array( $this, 'imported_comment' ) );
122
- add_action( 'wxr_importer.processed.term', array( $this, 'imported_term' ) );
123
- add_action( 'wxr_importer.process_failed.term', array( $this, 'imported_term' ) );
124
- add_action( 'wxr_importer.process_already_imported.term', array( $this, 'imported_term' ) );
125
- add_action( 'wxr_importer.processed.user', array( $this, 'imported_user' ) );
126
- add_action( 'wxr_importer.process_failed.user', array( $this, 'imported_user' ) );
127
- // Flush once more.
128
- flush();
129
-
130
- $importer = $this->get_importer();
131
- $response = $importer->import( $xml_url );
132
-
133
- // Let the browser know we're done.
134
- $complete = array(
135
- 'action' => 'complete',
136
- 'error' => false,
137
- );
138
- if ( is_wp_error( $response ) ) {
139
- $complete['error'] = $response->get_error_message();
140
- }
141
-
142
- $this->emit_sse_message( $complete );
143
- exit;
144
- }
145
-
146
- /**
147
- * Add .xml files as supported format in the uploader.
148
- *
149
- * @since 1.1.5 Added SVG file support.
150
- *
151
- * @since 1.0.0
152
- *
153
- * @param array $mimes Already supported mime types.
154
- */
155
- public function custom_upload_mimes( $mimes ) {
156
-
157
- // Allow SVG files.
158
- $mimes['svg'] = 'image/svg+xml';
159
- $mimes['svgz'] = 'image/svg+xml';
160
-
161
- // Allow XML files.
162
- $mimes['xml'] = 'application/xml';
163
-
164
- return $mimes;
165
- }
166
-
167
- /**
168
- * Start the xml import.
169
- *
170
- * @since 1.0.0
171
- *
172
- * @param (String) $path Absolute path to the XML file.
173
- */
174
- public function get_xml_data( $path ) {
175
-
176
- $args = array(
177
- 'action' => 'astra-wxr-import',
178
- 'id' => '1',
179
- 'xml_url' => $path,
180
- );
181
- $url = add_query_arg( urlencode_deep( $args ), admin_url( 'admin-ajax.php' ) );
182
-
183
- $data = $this->get_data( $path );
184
-
185
- return array(
186
- 'count' => array(
187
- 'posts' => $data->post_count,
188
- 'media' => $data->media_count,
189
- 'users' => count( $data->users ),
190
- 'comments' => $data->comment_count,
191
- 'terms' => $data->term_count,
192
- ),
193
- 'url' => $url,
194
- 'strings' => array(
195
- 'complete' => __( 'Import complete!', 'astra-sites' ),
196
- ),
197
- );
198
- }
199
-
200
- /**
201
- * Get XML data.
202
- *
203
- * @since 1.1.0
204
- * @param string $url Downloaded XML file absolute URL.
205
- * @return array XML file data.
206
- */
207
- function get_data( $url ) {
208
- $importer = $this->get_importer();
209
- $data = $importer->get_preliminary_information( $url );
210
- if ( is_wp_error( $data ) ) {
211
- return $data;
212
- }
213
- return $data;
214
- }
215
-
216
- /**
217
- * Get Importer
218
- *
219
- * @since 1.1.0
220
- * @return object Importer object.
221
- */
222
- public function get_importer() {
223
- $options = apply_filters(
224
- 'astra_sites_xml_import_options', array(
225
- 'fetch_attachments' => true,
226
- 'default_author' => get_current_user_id(),
227
- )
228
- );
229
- $importer = new WXR_Importer( $options );
230
- $logger = new WP_Importer_Logger_ServerSentEvents();
231
-
232
- $importer->set_logger( $logger );
233
- return $importer;
234
- }
235
-
236
- /**
237
- * Send message when a post has been imported.
238
- *
239
- * @since 1.1.0
240
- * @param int $id Post ID.
241
- * @param array $data Post data saved to the DB.
242
- */
243
- public function imported_post( $id, $data ) {
244
- $this->emit_sse_message(
245
- array(
246
- 'action' => 'updateDelta',
247
- 'type' => ( 'attachment' === $data['post_type'] ) ? 'media' : 'posts',
248
- 'delta' => 1,
249
- )
250
- );
251
- }
252
-
253
- /**
254
- * Send message when a post is marked as already imported.
255
- *
256
- * @since 1.1.0
257
- * @param array $data Post data saved to the DB.
258
- */
259
- public function already_imported_post( $data ) {
260
- $this->emit_sse_message(
261
- array(
262
- 'action' => 'updateDelta',
263
- 'type' => ( 'attachment' === $data['post_type'] ) ? 'media' : 'posts',
264
- 'delta' => 1,
265
- )
266
- );
267
- }
268
-
269
- /**
270
- * Send message when a comment has been imported.
271
- *
272
- * @since 1.1.0
273
- */
274
- public function imported_comment() {
275
- $this->emit_sse_message(
276
- array(
277
- 'action' => 'updateDelta',
278
- 'type' => 'comments',
279
- 'delta' => 1,
280
- )
281
- );
282
- }
283
-
284
- /**
285
- * Send message when a term has been imported.
286
- *
287
- * @since 1.1.0
288
- */
289
- public function imported_term() {
290
- $this->emit_sse_message(
291
- array(
292
- 'action' => 'updateDelta',
293
- 'type' => 'terms',
294
- 'delta' => 1,
295
- )
296
- );
297
- }
298
-
299
- /**
300
- * Send message when a user has been imported.
301
- *
302
- * @since 1.1.0
303
- */
304
- public function imported_user() {
305
- $this->emit_sse_message(
306
- array(
307
- 'action' => 'updateDelta',
308
- 'type' => 'users',
309
- 'delta' => 1,
310
- )
311
- );
312
- }
313
-
314
- /**
315
- * Emit a Server-Sent Events message.
316
- *
317
- * @since 1.1.0
318
- * @param mixed $data Data to be JSON-encoded and sent in the message.
319
- */
320
- public function emit_sse_message( $data ) {
321
- echo "event: message\n";
322
- echo 'data: ' . wp_json_encode( $data ) . "\n\n";
323
-
324
- // Extra padding.
325
- echo ':' . str_repeat( ' ', 2048 ) . "\n\n";
326
-
327
- flush();
328
- }
329
-
330
- }
331
-
332
- Astra_WXR_Importer::instance();
1
+ <?php
2
+ /**
3
+ * Class Astra WXR Importer
4
+ *
5
+ * @since 1.0.0
6
+ * @package Astra Addon
7
+ */
8
+
9
+ defined( 'ABSPATH' ) or exit;
10
+
11
+ /**
12
+ * Class Astra WXR Importer
13
+ *
14
+ * @since 1.0.0
15
+ */
16
+ class Astra_WXR_Importer {
17
+
18
+ /**
19
+ * Instance of Astra_WXR_Importer
20
+ *
21
+ * @since 1.0.0
22
+ * @var Astra_WXR_Importer
23
+ */
24
+ private static $_instance = null;
25
+
26
+ /**
27
+ * Instantiate Astra_WXR_Importer
28
+ *
29
+ * @since 1.0.0
30
+ * @return (Object) Astra_WXR_Importer.
31
+ */
32
+ public static function instance() {
33
+ if ( ! isset( self::$_instance ) ) {
34
+ self::$_instance = new self();
35
+ }
36
+
37
+ return self::$_instance;
38
+ }
39
+
40
+ /**
41
+ * Constructor.
42
+ *
43
+ * @since 1.0.0
44
+ */
45
+ private function __construct() {
46
+
47
+ if ( ! class_exists( 'WP_Importer' ) ) {
48
+ defined( 'WP_LOAD_IMPORTERS' ) || define( 'WP_LOAD_IMPORTERS', true );
49
+ require ABSPATH . '/wp-admin/includes/class-wp-importer.php';
50
+ }
51
+
52
+ if ( ! class_exists( 'WP_Importer_Logger' ) ) {
53
+ require_once ASTRA_SITES_DIR . 'inc/importers/wxr-importer/class-logger.php';
54
+ }
55
+
56
+ if ( ! class_exists( 'WP_Importer_Logger_ServerSentEvents' ) ) {
57
+ require_once ASTRA_SITES_DIR . 'inc/importers/wxr-importer/class-wp-importer-logger-serversentevents.php';
58
+ }
59
+
60
+ if ( ! class_exists( 'WXR_Importer' ) ) {
61
+ require_once ASTRA_SITES_DIR . 'inc/importers/wxr-importer/class-wxr-importer.php';
62
+ }
63
+
64
+ if ( ! class_exists( 'WXR_Import_Info' ) ) {
65
+ require_once ASTRA_SITES_DIR . 'inc/importers/wxr-importer/class-wxr-import-info.php';
66
+ }
67
+
68
+ add_filter( 'upload_mimes', array( $this, 'custom_upload_mimes' ) );
69
+ add_action( 'wp_ajax_astra-wxr-import', array( $this, 'sse_import' ) );
70
+ add_filter( 'wxr_importer.pre_process.user', '__return_null' );
71
+
72
+ }
73
+
74
+ /**
75
+ * Constructor.
76
+ *
77
+ * @since 1.1.0
78
+ */
79
+ function sse_import() {
80
+
81
+ // Start the event stream.
82
+ header( 'Content-Type: text/event-stream' );
83
+
84
+ // Turn off PHP output compression.
85
+ $previous = error_reporting( error_reporting() ^ E_WARNING );
86
+ ini_set( 'output_buffering', 'off' );
87
+ ini_set( 'zlib.output_compression', false );
88
+ error_reporting( $previous );
89
+
90
+ if ( $GLOBALS['is_nginx'] ) {
91
+ // Setting this header instructs Nginx to disable fastcgi_buffering
92
+ // and disable gzip for this request.
93
+ header( 'X-Accel-Buffering: no' );
94
+ header( 'Content-Encoding: none' );
95
+ }
96
+
97
+ $xml_url = urldecode( $_REQUEST['xml_url'] );
98
+ if ( empty( $xml_url ) ) {
99
+ exit;
100
+ }
101
+
102
+ // 2KB padding for IE
103
+ echo ':' . str_repeat( ' ', 2048 ) . "\n\n";
104
+
105
+ // Time to run the import!
106
+ set_time_limit( 0 );
107
+
108
+ // Ensure we're not buffered.
109
+ wp_ob_end_flush_all();
110
+ flush();
111
+
112
+ // Are we allowed to create users?
113
+ add_filter( 'wxr_importer.pre_process.user', '__return_null' );
114
+
115
+ // Keep track of our progress.
116
+ add_action( 'wxr_importer.processed.post', array( $this, 'imported_post' ), 10, 2 );
117
+ add_action( 'wxr_importer.process_failed.post', array( $this, 'imported_post' ), 10, 2 );
118
+ add_action( 'wxr_importer.process_already_imported.post', array( $this, 'already_imported_post' ), 10, 2 );
119
+ add_action( 'wxr_importer.process_skipped.post', array( $this, 'already_imported_post' ), 10, 2 );
120
+ add_action( 'wxr_importer.processed.comment', array( $this, 'imported_comment' ) );
121
+ add_action( 'wxr_importer.process_already_imported.comment', array( $this, 'imported_comment' ) );
122
+ add_action( 'wxr_importer.processed.term', array( $this, 'imported_term' ) );
123
+ add_action( 'wxr_importer.process_failed.term', array( $this, 'imported_term' ) );
124
+ add_action( 'wxr_importer.process_already_imported.term', array( $this, 'imported_term' ) );
125
+ add_action( 'wxr_importer.processed.user', array( $this, 'imported_user' ) );
126
+ add_action( 'wxr_importer.process_failed.user', array( $this, 'imported_user' ) );
127
+ // Flush once more.
128
+ flush();
129
+
130
+ $importer = $this->get_importer();
131
+ $response = $importer->import( $xml_url );
132
+
133
+ // Let the browser know we're done.
134
+ $complete = array(
135
+ 'action' => 'complete',
136
+ 'error' => false,
137
+ );
138
+ if ( is_wp_error( $response ) ) {
139
+ $complete['error'] = $response->get_error_message();
140
+ }
141
+
142
+ $this->emit_sse_message( $complete );
143
+ exit;
144
+ }
145
+
146
+ /**
147
+ * Add .xml files as supported format in the uploader.
148
+ *
149
+ * @since 1.1.5 Added SVG file support.
150
+ *
151
+ * @since 1.0.0
152
+ *
153
+ * @param array $mimes Already supported mime types.
154
+ */
155
+ public function custom_upload_mimes( $mimes ) {
156
+
157
+ // Allow SVG files.
158
+ $mimes['svg'] = 'image/svg+xml';
159
+ $mimes['svgz'] = 'image/svg+xml';
160
+
161
+ // Allow XML files.
162
+ $mimes['xml'] = 'application/xml';
163
+
164
+ return $mimes;
165
+ }
166
+
167
+ /**
168
+ * Start the xml import.
169
+ *
170
+ * @since 1.0.0
171
+ *
172
+ * @param (String) $path Absolute path to the XML file.
173
+ */
174
+ public function get_xml_data( $path ) {
175
+
176
+ $args = array(
177
+ 'action' => 'astra-wxr-import',
178
+ 'id' => '1',
179
+ 'xml_url' => $path,
180
+ );
181
+ $url = add_query_arg( urlencode_deep( $args ), admin_url( 'admin-ajax.php' ) );
182
+
183
+ $data = $this->get_data( $path );
184
+
185
+ return array(
186
+ 'count' => array(
187
+ 'posts' => $data->post_count,
188
+ 'media' => $data->media_count,
189
+ 'users' => count( $data->users ),
190
+ 'comments' => $data->comment_count,
191
+ 'terms' => $data->term_count,
192
+ ),
193
+ 'url' => $url,
194
+ 'strings' => array(
195
+ 'complete' => __( 'Import complete!', 'astra-sites' ),
196
+ ),
197
+ );
198
+ }
199
+
200
+ /**
201
+ * Get XML data.
202
+ *
203
+ * @since 1.1.0
204
+ * @param string $url Downloaded XML file absolute URL.
205
+ * @return array XML file data.
206
+ */
207
+ function get_data( $url ) {
208
+ $importer = $this->get_importer();
209
+ $data = $importer->get_preliminary_information( $url );
210
+ if ( is_wp_error( $data ) ) {
211
+ return $data;
212
+ }
213
+ return $data;
214
+ }
215
+
216
+ /**
217
+ * Get Importer
218
+ *
219
+ * @since 1.1.0
220
+ * @return object Importer object.
221
+ */
222
+ public function get_importer() {
223
+ $options = apply_filters(
224
+ 'astra_sites_xml_import_options', array(
225
+ 'fetch_attachments' => true,
226
+ 'default_author' => get_current_user_id(),
227
+ )
228
+ );
229
+ $importer = new WXR_Importer( $options );
230
+ $logger = new WP_Importer_Logger_ServerSentEvents();
231
+
232
+ $importer->set_logger( $logger );
233
+ return $importer;
234
+ }
235
+
236
+ /**
237
+ * Send message when a post has been imported.
238
+ *
239
+ * @since 1.1.0
240
+ * @param int $id Post ID.
241
+ * @param array $data Post data saved to the DB.
242
+ */
243
+ public function imported_post( $id, $data ) {
244
+ $this->emit_sse_message(
245
+ array(
246
+ 'action' => 'updateDelta',
247
+ 'type' => ( 'attachment' === $data['post_type'] ) ? 'media' : 'posts',
248
+ 'delta' => 1,
249
+ )
250
+ );
251
+ }
252
+
253
+ /**
254
+ * Send message when a post is marked as already imported.
255
+ *
256
+ * @since 1.1.0
257
+ * @param array $data Post data saved to the DB.
258
+ */
259
+ public function already_imported_post( $data ) {
260
+ $this->emit_sse_message(
261
+ array(
262
+ 'action' => 'updateDelta',
263
+ 'type' => ( 'attachment' === $data['post_type'] ) ? 'media' : 'posts',
264
+ 'delta' => 1,
265
+ )
266
+ );
267
+ }
268
+
269
+ /**
270
+ * Send message when a comment has been imported.
271
+ *
272
+ * @since 1.1.0
273
+ */
274
+ public function imported_comment() {
275
+ $this->emit_sse_message(
276
+ array(
277
+ 'action' => 'updateDelta',
278
+ 'type' => 'comments',
279
+ 'delta' => 1,
280
+ )
281
+ );
282
+ }
283
+
284
+ /**
285
+ * Send message when a term has been imported.
286
+ *
287
+ * @since 1.1.0
288
+ */
289
+ public function imported_term() {
290
+ $this->emit_sse_message(
291
+ array(
292
+ 'action' => 'updateDelta',
293
+ 'type' => 'terms',
294
+ 'delta' => 1,
295
+ )
296
+ );
297
+ }
298
+
299
+ /**
300
+ * Send message when a user has been imported.
301
+ *
302
+ * @since 1.1.0
303
+ */
304
+ public function imported_user() {
305
+ $this->emit_sse_message(
306
+ array(
307
+ 'action' => 'updateDelta',
308
+ 'type' => 'users',
309
+ 'delta' => 1,
310
+ )
311
+ );
312
+ }
313
+
314
+ /**
315
+ * Emit a Server-Sent Events message.
316
+ *
317
+ * @since 1.1.0
318
+ * @param mixed $data Data to be JSON-encoded and sent in the message.
319
+ */
320
+ public function emit_sse_message( $data ) {
321
+ echo "event: message\n";
322
+ echo 'data: ' . wp_json_encode( $data ) . "\n\n";
323
+
324
+ // Extra padding.
325
+ echo ':' . str_repeat( ' ', 2048 ) . "\n\n";
326
+
327
+ flush();
328
+ }
329
+
330
+ }
331
+
332
+ Astra_WXR_Importer::instance();
inc/includes/admin-page.php CHANGED
@@ -1,295 +1,299 @@
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
-
18
- <div class="wrap" id="astra-sites-admin">
19
-
20
- <div id="astra-sites-filters" class="wp-filter hide-if-no-js">
21
-
22
- <div class="section-left">
23
-
24
- <!-- All Filters -->
25
- <div class="filter-count">
26
- <span class="count"></span>
27
- </div>
28
- <div class="filters-wrap">
29
- <div id="astra-site-page-builder"></div>
30
- </div>
31
-
32
- </div>
33
-
34
- <div class="section-right">
35
-
36
- <div class="filters-wrap">
37
- <div id="astra-site-category"></div>
38
- </div>
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
-
47
- </div>
48
-
49
- <?php do_action( 'astra_sites_before_site_grid' ); ?>
50
-
51
- <div class="theme-browser rendered">
52
- <div id="astra-sites" class="themes wp-clearfix"></div>
53
- </div>
54
-
55
- <div class="spinner-wrap">
56
- <span class="spinner"></span>
57
- </div>
58
-
59
- <?php do_action( 'astra_sites_after_site_grid' ); ?>
60
-
61
- </div>
62
-
63
- <?php
64
- /**
65
- * TMPL - Single Demo Preview
66
- */
67
- ?>
68
- <script type="text/template" id="tmpl-astra-site-select-page-builder">
69
- <div class="select-page-builder">
70
- <div class="note-wrap">
71
- <h3>
72
- <span class="up-arrow dashicons dashicons-editor-break"></span>
73
- <div class="note"><?php _e( 'Select Your Favorite Page Builder', 'astra-sites' ); ?></div>
74
- </h3>
75
- </div>
76
- <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' ); ?>" />
77
- </div>
78
- </script>
79
-
80
- <?php
81
- /**
82
- * TMPL - Single Demo Preview
83
- */
84
- ?>
85
- <script type="text/template" id="tmpl-astra-site-preview">
86
- <div class="astra-sites-preview theme-install-overlay wp-full-overlay expanded">
87
- <div class="wp-full-overlay-sidebar">
88
- <div class="wp-full-overlay-header"
89
- data-demo-id="{{{data.id}}}"
90
- data-demo-type="{{{data.astra_demo_type}}}"
91
- data-demo-url="{{{data.astra_demo_url}}}"
92
- data-demo-api="{{{data.demo_api}}}"
93
- data-demo-name="{{{data.demo_name}}}"
94
- data-demo-slug="{{{data.slug}}}"
95
- data-screenshot="{{{data.screenshot}}}"
96
- data-content="{{{data.content}}}"
97
- data-required-plugins="{{data.required_plugins}}">
98
- <input type="hidden" class="astra-site-options" value="{{data.astra_site_options}}" >
99
- <input type="hidden" class="astra-enabled-extensions" value="{{data.astra_enabled_extensions}}" >
100
- <button class="close-full-overlay"><span class="screen-reader-text"><?php esc_html_e( 'Close', 'astra-sites' ); ?></span></button>
101
- <button class="previous-theme"><span class="screen-reader-text"><?php esc_html_e( 'Previous', 'astra-sites' ); ?></span></button>
102
- <button class="next-theme"><span class="screen-reader-text"><?php esc_html_e( 'Next', 'astra-sites' ); ?></span></button>
103
- <a class="button hide-if-no-customize astra-demo-import" href="#" data-import="disabled"><?php esc_html_e( 'Install Plugins', 'astra-sites' ); ?></a>
104
-
105
- </div>
106
- <div class="wp-full-overlay-sidebar-content">
107
- <div class="install-theme-info">
108
-
109
- <span class="site-type {{{data.astra_demo_type}}}">{{{data.astra_demo_type}}}</span>
110
- <h3 class="theme-name">{{{data.demo_name}}}</h3>
111
-
112
- <# if ( data.screenshot.length ) { #>
113
- <img class="theme-screenshot" src="{{{data.screenshot}}}" alt="">
114
- <# } #>
115
-
116
- <div class="theme-details">
117
- {{{data.content}}}
118
- </div>
119
- <a href="#" class="theme-details-read-more"><?php _e( 'Read more', 'astra-sites' ); ?> &hellip;</a>
120
-
121
- <div class="required-plugins-wrap">
122
- <h4><?php _e( 'Required Plugins', 'astra-sites' ); ?> </h4>
123
- <div class="required-plugins"></div>
124
- </div>
125
- </div>
126
- </div>
127
-
128
- <div class="wp-full-overlay-footer">
129
- <div class="footer-import-button-wrap">
130
- <a class="button button-hero hide-if-no-customize astra-demo-import" href="#" data-import="disabled">
131
- <?php esc_html_e( 'Install Plugins', 'astra-sites' ); ?>
132
- </a>
133
- </div>
134
- <button type="button" class="collapse-sidebar button" aria-expanded="true"
135
- aria-label="Collapse Sidebar">
136
- <span class="collapse-sidebar-arrow"></span>
137
- <span class="collapse-sidebar-label"><?php esc_html_e( 'Collapse', 'astra-sites' ); ?></span>
138
- </button>
139
-
140
- <div class="devices-wrapper">
141
- <div class="devices">
142
- <button type="button" class="preview-desktop active" aria-pressed="true" data-device="desktop">
143
- <span class="screen-reader-text"><?php _e( 'Enter desktop preview mode', 'astra-sites' ); ?></span>
144
- </button>
145
- <button type="button" class="preview-tablet" aria-pressed="false" data-device="tablet">
146
- <span class="screen-reader-text"><?php _e( 'Enter tablet preview mode', 'astra-sites' ); ?></span>
147
- </button>
148
- <button type="button" class="preview-mobile" aria-pressed="false" data-device="mobile">
149
- <span class="screen-reader-text"><?php _e( 'Enter mobile preview mode', 'astra-sites' ); ?></span>
150
- </button>
151
- </div>
152
- </div>
153
-
154
- </div>
155
- </div>
156
- <div class="wp-full-overlay-main">
157
- <iframe src="{{{data.astra_demo_url}}}" title="<?php esc_attr_e( 'Preview', 'astra-sites' ); ?>"></iframe>
158
- </div>
159
- </div>
160
- </script>
161
-
162
- <?php
163
- /**
164
- * TMPL - No more demos
165
- */
166
- ?>
167
- <script type="text/template" id="tmpl-astra-site-api-request-failed">
168
- <div class="no-themes">
169
- <?php
170
-
171
- /* translators: %1$s & %2$s are a Demo API URL */
172
- 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 ) );
173
-
174
- _e( '<p class="left-margin"> 1. Sometimes, simple page reload fixes any temporary issues. No kidding!</p>', 'astra-sites' );
175
-
176
- _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' );
177
-
178
- /* translators: %1$s is a support link */
179
- 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' ) );
180
- ?>
181
- </div>
182
- </script>
183
-
184
- <?php
185
- /**
186
- * TMPL - Filters
187
- */
188
- ?>
189
- <script type="text/template" id="tmpl-astra-site-filters">
190
-
191
- <# if ( data ) { #>
192
-
193
- <ul class="{{ data.args.wrapper_class }} {{ data.args.class }}">
194
-
195
- <# if ( data.args.show_all ) { #>
196
- <li>
197
- <a href="#" data-group="all"> All </a>
198
- </li>
199
- <# } #>
200
-
201
- <# for ( key in data.items ) { #>
202
- <# if ( data.items[ key ].count ) { #>
203
- <li>
204
- <a href="#" data-group='{{ data.items[ key ].id }}' class="{{ data.items[ key ].name }}">
205
- {{ data.items[ key ].name }}
206
- </a>
207
- </li>
208
- <# } #>
209
- <# } #>
210
-
211
- </ul>
212
- <# } #>
213
- </script>
214
-
215
- <?php
216
- /**
217
- * TMPL - List
218
- */
219
- ?>
220
- <script type="text/template" id="tmpl-astra-sites-list">
221
-
222
- <# if ( data.items.length ) { #>
223
- <# for ( key in data.items ) { #>
224
-
225
- <div class="theme astra-theme site-single {{ data.items[ key ].status }}" tabindex="0" aria-describedby="astra-theme-action astra-theme-name"
226
- data-demo-id="{{{ data.items[ key ].id }}}"
227
- data-demo-type="{{{ data.items[ key ]['astra-site-type'] }}}"
228
- data-demo-url="{{{ data.items[ key ]['astra-site-url'] }}}"
229
- data-demo-api="{{{ data.items[ key ]['_links']['self'][0]['href'] }}}"
230
- data-demo-name="{{{ data.items[ key ].title.rendered }}}"
231
- data-demo-slug="{{{ data.items[ key ].slug }}}"
232
- data-screenshot="{{{ data.items[ key ]['featured-image-url'] }}}"
233
- data-content="{{{ data.items[ key ].content.rendered }}}"
234
- data-required-plugins="{{ JSON.stringify( data.items[ key ]['required-plugins'] ) }}"
235
- data-groups=["{{ data.items[ key ].tags }}"]>
236
- <input type="hidden" class="astra-site-options" value="{{ JSON.stringify(data.items[ key ]['astra-site-options-data'] ) }}" />
237
- <input type="hidden" class="astra-enabled-extensions" value="{{ JSON.stringify(data.items[ key ]['astra-enabled-extensions'] ) }}" />
238
-
239
- <div class="inner">
240
- <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 }}">
241
- <div class="theme-screenshot">
242
- <# if( '' !== data.items[ key ]['featured-image-url'] ) { #>
243
- <img src="{{ data.items[ key ]['featured-image-url'] }}" />
244
- <# } #>
245
- </div>
246
- </span>
247
- <span class="more-details"> <?php esc_html_e( 'Details &amp; Preview', 'astra-sites' ); ?> </span>
248
- <# if ( data.items[ key ]['astra-site-type'] ) { #>
249
- <# var type = ( data.items[ key ]['astra-site-type'] !== 'premium' ) ? ( data.items[ key ]['astra-site-type'] ) : 'agency'; #>
250
- <span class="site-type {{data.items[ key ]['astra-site-type']}}">{{ type }}</span>
251
- <# } #>
252
- <# if ( data.items[ key ].status ) { #>
253
- <span class="status {{data.items[ key ].status}}">{{data.items[ key ].status}}</span>
254
- <# } #>
255
- <div class="theme-id-container">
256
- <h3 class="theme-name" id="astra-theme-name"> {{{ data.items[ key ].title.rendered }}} </h3>
257
- <div class="theme-actions">
258
- <button class="button preview install-theme-preview"><?php esc_html_e( 'Preview', 'astra-sites' ); ?></button>
259
- </div>
260
- </div>
261
- </div>
262
- </div>
263
- <# } #>
264
- <# } else { #>
265
- <p class="no-themes" style="display:block;">
266
- <?php _e( 'No Demos found, Try a different search.', 'astra-sites' ); ?>
267
- <span class="description">
268
- <?php
269
- /* translators: %1$s External Link */
270
- 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' ) );
271
- ?>
272
- </span>
273
- </p>
274
- <# } #>
275
- </script>
276
-
277
- <?php
278
- /**
279
- * TMPL - List
280
- */
281
- ?>
282
- <script type="text/template" id="tmpl-astra-sites-suggestions">
283
- <div class="theme astra-theme site-single astra-sites-suggestions">
284
- <div class="inner">
285
- <p>
286
- <?php
287
- /* translators: %1$s External Link */
288
- 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' ) );
289
- ?>
290
- </p>
291
- </div>
292
- </div>
293
- </script>
294
- <?php
295
- 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
+
18
+ <div class="wrap" id="astra-sites-admin">
19
+
20
+ <div id="astra-sites-filters">
21
+
22
+ <?php if ( apply_filters( 'astra_sites_show_filters', true ) ) { ?>
23
+ <div class="wp-filter hide-if-no-js">
24
+ <div class="section-left">
25
+
26
+ <!-- All Filters -->
27
+ <div class="filter-count">
28
+ <span class="count"></span>
29
+ </div>
30
+ <div class="filters-wrap">
31
+ <div id="astra-site-page-builder"></div>
32
+ </div>
33
+
34
+ </div>
35
+
36
+ <div class="section-right">
37
+
38
+ <div class="filters-wrap">
39
+ <div id="astra-site-category"></div>
40
+ </div>
41
+
42
+ <div class="search-form">
43
+ <label class="screen-reader-text" for="wp-filter-search-input"><?php _e( 'Search Sites', 'astra-sites' ); ?> </label>
44
+ <input placeholder="<?php _e( 'Search Sites...', 'astra-sites' ); ?>" type="search" aria-describedby="live-search-desc" id="wp-filter-search-input" class="wp-filter-search">
45
+ </div>
46
+
47
+ </div>
48
+ </div>
49
+ <?php } ?>
50
+
51
+ </div>
52
+
53
+ <?php do_action( 'astra_sites_before_site_grid' ); ?>
54
+
55
+ <div class="theme-browser rendered">
56
+ <div id="astra-sites" class="themes wp-clearfix"></div>
57
+ </div>
58
+
59
+ <div class="spinner-wrap">
60
+ <span class="spinner"></span>
61
+ </div>
62
+
63
+ <?php do_action( 'astra_sites_after_site_grid' ); ?>
64
+
65
+ </div>
66
+
67
+ <?php
68
+ /**
69
+ * TMPL - Single Demo Preview
70
+ */
71
+ ?>
72
+ <script type="text/template" id="tmpl-astra-site-select-page-builder">
73
+ <div class="select-page-builder">
74
+ <div class="note-wrap">
75
+ <h3>
76
+ <span class="up-arrow dashicons dashicons-editor-break"></span>
77
+ <div class="note"><?php _e( 'Select Your Favorite Page Builder', 'astra-sites' ); ?></div>
78
+ </h3>
79
+ </div>
80
+ <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' ); ?>" />
81
+ </div>
82
+ </script>
83
+
84
+ <?php
85
+ /**
86
+ * TMPL - Single Demo Preview
87
+ */
88
+ ?>
89
+ <script type="text/template" id="tmpl-astra-site-preview">
90
+ <div class="astra-sites-preview theme-install-overlay wp-full-overlay expanded">
91
+ <div class="wp-full-overlay-sidebar">
92
+ <div class="wp-full-overlay-header"
93
+ data-demo-id="{{{data.id}}}"
94
+ data-demo-type="{{{data.astra_demo_type}}}"
95
+ data-demo-url="{{{data.astra_demo_url}}}"
96
+ data-demo-api="{{{data.demo_api}}}"
97
+ data-demo-name="{{{data.demo_name}}}"
98
+ data-demo-slug="{{{data.slug}}}"
99
+ data-screenshot="{{{data.screenshot}}}"
100
+ data-content="{{{data.content}}}"
101
+ data-required-plugins="{{data.required_plugins}}">
102
+ <input type="hidden" class="astra-site-options" value="{{data.astra_site_options}}" >
103
+ <input type="hidden" class="astra-enabled-extensions" value="{{data.astra_enabled_extensions}}" >
104
+ <button class="close-full-overlay"><span class="screen-reader-text"><?php esc_html_e( 'Close', 'astra-sites' ); ?></span></button>
105
+ <button class="previous-theme"><span class="screen-reader-text"><?php esc_html_e( 'Previous', 'astra-sites' ); ?></span></button>
106
+ <button class="next-theme"><span class="screen-reader-text"><?php esc_html_e( 'Next', 'astra-sites' ); ?></span></button>
107
+ <a class="button hide-if-no-customize astra-demo-import" href="#" data-import="disabled"><?php esc_html_e( 'Install Plugins', 'astra-sites' ); ?></a>
108
+
109
+ </div>
110
+ <div class="wp-full-overlay-sidebar-content">
111
+ <div class="install-theme-info">
112
+
113
+ <span class="site-type {{{data.astra_demo_type}}}">{{{data.astra_demo_type}}}</span>
114
+ <h3 class="theme-name">{{{data.demo_name}}}</h3>
115
+
116
+ <# if ( data.screenshot.length ) { #>
117
+ <img class="theme-screenshot" src="{{{data.screenshot}}}" alt="">
118
+ <# } #>
119
+
120
+ <div class="theme-details">
121
+ {{{data.content}}}
122
+ </div>
123
+ <a href="#" class="theme-details-read-more"><?php _e( 'Read more', 'astra-sites' ); ?> &hellip;</a>
124
+
125
+ <div class="required-plugins-wrap">
126
+ <h4><?php _e( 'Required Plugins', 'astra-sites' ); ?> </h4>
127
+ <div class="required-plugins"></div>
128
+ </div>
129
+ </div>
130
+ </div>
131
+
132
+ <div class="wp-full-overlay-footer">
133
+ <div class="footer-import-button-wrap">
134
+ <a class="button button-hero hide-if-no-customize astra-demo-import" href="#" data-import="disabled">
135
+ <?php esc_html_e( 'Install Plugins', 'astra-sites' ); ?>
136
+ </a>
137
+ </div>
138
+ <button type="button" class="collapse-sidebar button" aria-expanded="true"
139
+ aria-label="Collapse Sidebar">
140
+ <span class="collapse-sidebar-arrow"></span>
141
+ <span class="collapse-sidebar-label"><?php esc_html_e( 'Collapse', 'astra-sites' ); ?></span>
142
+ </button>
143
+
144
+ <div class="devices-wrapper">
145
+ <div class="devices">
146
+ <button type="button" class="preview-desktop active" aria-pressed="true" data-device="desktop">
147
+ <span class="screen-reader-text"><?php _e( 'Enter desktop preview mode', 'astra-sites' ); ?></span>
148
+ </button>
149
+ <button type="button" class="preview-tablet" aria-pressed="false" data-device="tablet">
150
+ <span class="screen-reader-text"><?php _e( 'Enter tablet preview mode', 'astra-sites' ); ?></span>
151
+ </button>
152
+ <button type="button" class="preview-mobile" aria-pressed="false" data-device="mobile">
153
+ <span class="screen-reader-text"><?php _e( 'Enter mobile preview mode', 'astra-sites' ); ?></span>
154
+ </button>
155
+ </div>
156
+ </div>
157
+
158
+ </div>
159
+ </div>
160
+ <div class="wp-full-overlay-main">
161
+ <iframe src="{{{data.astra_demo_url}}}" title="<?php esc_attr_e( 'Preview', 'astra-sites' ); ?>"></iframe>
162
+ </div>
163
+ </div>
164
+ </script>
165
+
166
+ <?php
167
+ /**
168
+ * TMPL - No more demos
169
+ */
170
+ ?>
171
+ <script type="text/template" id="tmpl-astra-site-api-request-failed">
172
+ <div class="no-themes">
173
+ <?php
174
+
175
+ /* translators: %1$s & %2$s are a Demo API URL */
176
+ 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 ) );
177
+
178
+ _e( '<p class="left-margin"> 1. Sometimes, simple page reload fixes any temporary issues. No kidding!</p>', 'astra-sites' );
179
+
180
+ _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' );
181
+
182
+ /* translators: %1$s is a support link */
183
+ 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' ) );
184
+ ?>
185
+ </div>
186
+ </script>
187
+
188
+ <?php
189
+ /**
190
+ * TMPL - Filters
191
+ */
192
+ ?>
193
+ <script type="text/template" id="tmpl-astra-site-filters">
194
+
195
+ <# if ( data ) { #>
196
+
197
+ <ul class="{{ data.args.wrapper_class }} {{ data.args.class }}">
198
+
199
+ <# if ( data.args.show_all ) { #>
200
+ <li>
201
+ <a href="#" data-group="all"> All </a>
202
+ </li>
203
+ <# } #>
204
+
205
+ <# for ( key in data.items ) { #>
206
+ <# if ( data.items[ key ].count ) { #>
207
+ <li>
208
+ <a href="#" data-group='{{ data.items[ key ].id }}' class="{{ data.items[ key ].name }}">
209
+ {{ data.items[ key ].name }}
210
+ </a>
211
+ </li>
212
+ <# } #>
213
+ <# } #>
214
+
215
+ </ul>
216
+ <# } #>
217
+ </script>
218
+
219
+ <?php
220
+ /**
221
+ * TMPL - List
222
+ */
223
+ ?>
224
+ <script type="text/template" id="tmpl-astra-sites-list">
225
+
226
+ <# if ( data.items.length ) { #>
227
+ <# for ( key in data.items ) { #>
228
+
229
+ <div class="theme astra-theme site-single {{ data.items[ key ].status }}" tabindex="0" aria-describedby="astra-theme-action astra-theme-name"
230
+ data-demo-id="{{{ data.items[ key ].id }}}"
231
+ data-demo-type="{{{ data.items[ key ]['astra-site-type'] }}}"
232
+ data-demo-url="{{{ data.items[ key ]['astra-site-url'] }}}"
233
+ data-demo-api="{{{ data.items[ key ]['_links']['self'][0]['href'] }}}"
234
+ data-demo-name="{{{ data.items[ key ].title.rendered }}}"
235
+ data-demo-slug="{{{ data.items[ key ].slug }}}"
236
+ data-screenshot="{{{ data.items[ key ]['featured-image-url'] }}}"
237
+ data-content="{{{ data.items[ key ].content.rendered }}}"
238
+ data-required-plugins="{{ JSON.stringify( data.items[ key ]['required-plugins'] ) }}"
239
+ data-groups=["{{ data.items[ key ].tags }}"]>
240
+ <input type="hidden" class="astra-site-options" value="{{ JSON.stringify(data.items[ key ]['astra-site-options-data'] ) }}" />
241
+ <input type="hidden" class="astra-enabled-extensions" value="{{ JSON.stringify(data.items[ key ]['astra-enabled-extensions'] ) }}" />
242
+
243
+ <div class="inner">
244
+ <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 }}">
245
+ <div class="theme-screenshot">
246
+ <# if( '' !== data.items[ key ]['featured-image-url'] ) { #>
247
+ <img src="{{ data.items[ key ]['featured-image-url'] }}" />
248
+ <# } #>
249
+ </div>
250
+ </span>
251
+ <span class="more-details"> <?php esc_html_e( 'Details &amp; Preview', 'astra-sites' ); ?> </span>
252
+ <# if ( data.items[ key ]['astra-site-type'] ) { #>
253
+ <# var type = ( data.items[ key ]['astra-site-type'] !== 'premium' ) ? ( data.items[ key ]['astra-site-type'] ) : 'agency'; #>
254
+ <span class="site-type {{data.items[ key ]['astra-site-type']}}">{{ type }}</span>
255
+ <# } #>
256
+ <# if ( data.items[ key ].status ) { #>
257
+ <span class="status {{data.items[ key ].status}}">{{data.items[ key ].status}}</span>
258
+ <# } #>
259
+ <div class="theme-id-container">
260
+ <h3 class="theme-name" id="astra-theme-name"> {{{ data.items[ key ].title.rendered }}} </h3>
261
+ <div class="theme-actions">
262
+ <button class="button preview install-theme-preview"><?php esc_html_e( 'Preview', 'astra-sites' ); ?></button>
263
+ </div>
264
+ </div>
265
+ </div>
266
+ </div>
267
+ <# } #>
268
+ <# } else { #>
269
+ <p class="no-themes" style="display:block;">
270
+ <?php _e( 'No Demos found, Try a different search.', 'astra-sites' ); ?>
271
+ <span class="description">
272
+ <?php
273
+ /* translators: %1$s External Link */
274
+ 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' ) );
275
+ ?>
276
+ </span>
277
+ </p>
278
+ <# } #>
279
+ </script>
280
+
281
+ <?php
282
+ /**
283
+ * TMPL - List
284
+ */
285
+ ?>
286
+ <script type="text/template" id="tmpl-astra-sites-suggestions">
287
+ <div class="theme astra-theme site-single astra-sites-suggestions">
288
+ <div class="inner">
289
+ <p>
290
+ <?php
291
+ /* translators: %1$s External Link */
292
+ 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' ) );
293
+ ?>
294
+ </p>
295
+ </div>
296
+ </div>
297
+ </script>
298
+ <?php
299
+ 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.2.6\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/astra-sites\n"
7
- "POT-Creation-Date: 2018-07-09 11:10:11+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -100,73 +100,73 @@ msgstr ""
100
  msgid "Categories"
101
  msgstr ""
102
 
103
- #: inc/classes/class-astra-sites.php:210
104
  msgid "Purchase"
105
  msgstr ""
106
 
107
- #: inc/classes/class-astra-sites.php:212
108
  msgid "Upgrade"
109
  msgstr ""
110
 
111
- #: inc/classes/class-astra-sites.php:217
112
  msgid ""
113
  "Warning! Astra Site Import process is not complete. Don't close the window "
114
  "until import process complete. Do you still want to leave the window?"
115
  msgstr ""
116
 
117
- #: inc/classes/class-astra-sites.php:218
118
  msgid "Error!"
119
  msgstr ""
120
 
121
- #: inc/classes/class-astra-sites.php:219
122
  msgid "Error! Read Possibilities."
123
  msgstr ""
124
 
125
- #: inc/classes/class-astra-sites.php:221
126
  msgid "Done! View Site"
127
  msgstr ""
128
 
129
- #: inc/classes/class-astra-sites.php:222
130
  msgid "Activating"
131
  msgstr ""
132
 
133
- #: inc/classes/class-astra-sites.php:223
134
  msgid "Active"
135
  msgstr ""
136
 
137
- #: inc/classes/class-astra-sites.php:224
138
  msgid "Import failed."
139
  msgstr ""
140
 
141
- #: inc/classes/class-astra-sites.php:225
142
  msgid "Import failed. See error log."
143
  msgstr ""
144
 
145
- #: inc/classes/class-astra-sites.php:226
146
  msgid "Import This Site"
147
  msgstr ""
148
 
149
- #: inc/classes/class-astra-sites.php:227 inc/classes/class-astra-sites.php:244
150
  msgid "Importing.."
151
  msgstr ""
152
 
153
- #: inc/classes/class-astra-sites.php:228 inc/includes/admin-page.php:119
154
  msgid "Read more"
155
  msgstr ""
156
 
157
- #: inc/classes/class-astra-sites.php:229
158
  msgid "Hide"
159
  msgstr ""
160
 
161
- #: inc/classes/class-astra-sites.php:230
162
  msgid "There was a problem receiving a response from server."
163
  msgstr ""
164
 
165
- #: inc/classes/class-astra-sites.php:231 inc/includes/admin-page.php:266
166
  msgid "No Demos found, Try a different search."
167
  msgstr ""
168
 
169
- #: inc/classes/class-astra-sites.php:232
170
  msgid ""
171
  "Executing Demo Import will make your site similar as ours. Please bear in "
172
  "mind -\n"
@@ -180,131 +180,131 @@ msgid ""
180
  "placeholders."
181
  msgstr ""
182
 
183
- #: inc/classes/class-astra-sites.php:235
184
  msgid "Installing plugin "
185
  msgstr ""
186
 
187
- #: inc/classes/class-astra-sites.php:236
188
  msgid "Successfully plugin installed!"
189
  msgstr ""
190
 
191
- #: inc/classes/class-astra-sites.php:237
192
  msgid "Activating plugin "
193
  msgstr ""
194
 
195
- #: inc/classes/class-astra-sites.php:238
196
  msgid "Successfully plugin activated "
197
  msgstr ""
198
 
199
- #: inc/classes/class-astra-sites.php:239
200
  msgid "Bulk plugin activation..."
201
  msgstr ""
202
 
203
- #: inc/classes/class-astra-sites.php:240
204
  msgid "Successfully plugin activate - "
205
  msgstr ""
206
 
207
- #: inc/classes/class-astra-sites.php:241
208
  msgid "Error! While activating plugin - "
209
  msgstr ""
210
 
211
- #: inc/classes/class-astra-sites.php:242
212
  msgid "Bulk plugin installation..."
213
  msgstr ""
214
 
215
- #: inc/classes/class-astra-sites.php:243
216
  msgid "Site API "
217
  msgstr ""
218
 
219
- #: inc/classes/class-astra-sites.php:245
220
  msgid "Processing requests..."
221
  msgstr ""
222
 
223
- #: inc/classes/class-astra-sites.php:246
224
  msgid "1) Importing \"Customizer Settings\"..."
225
  msgstr ""
226
 
227
- #: inc/classes/class-astra-sites.php:247
228
  msgid "Successfully imported customizer settings!"
229
  msgstr ""
230
 
231
- #: inc/classes/class-astra-sites.php:248
232
  msgid "2) Preparing \"XML\" Data..."
233
  msgstr ""
234
 
235
- #: inc/classes/class-astra-sites.php:249
236
  msgid "Successfully set XML data!"
237
  msgstr ""
238
 
239
- #: inc/classes/class-astra-sites.php:250
240
  msgid "3) Importing \"XML\"..."
241
  msgstr ""
242
 
243
- #: inc/classes/class-astra-sites.php:251
244
  msgid "Successfully imported XML!"
245
  msgstr ""
246
 
247
- #: inc/classes/class-astra-sites.php:252
248
  msgid "4) Importing \"Options\"..."
249
  msgstr ""
250
 
251
- #: inc/classes/class-astra-sites.php:253
252
  msgid "Successfully imported Options!"
253
  msgstr ""
254
 
255
- #: inc/classes/class-astra-sites.php:254
256
  msgid "5) Importing \"Widgets\"..."
257
  msgstr ""
258
 
259
- #: inc/classes/class-astra-sites.php:255
260
  msgid "Successfully imported Widgets!"
261
  msgstr ""
262
 
263
- #: inc/classes/class-astra-sites.php:257
264
  msgid "Site imported successfully! visit : "
265
  msgstr ""
266
 
267
- #: inc/classes/class-astra-sites.php:258
268
  msgid "Getting Site Information.."
269
  msgstr ""
270
 
271
- #: inc/classes/class-astra-sites.php:259
272
  msgid "Importing Customizer Settings.."
273
  msgstr ""
274
 
275
- #: inc/classes/class-astra-sites.php:260
276
  msgid "Setting up import data.."
277
  msgstr ""
278
 
279
- #: inc/classes/class-astra-sites.php:261
280
  msgid "Importing Pages, Posts & Media.."
281
  msgstr ""
282
 
283
- #: inc/classes/class-astra-sites.php:262
284
  msgid "Importing Site Options.."
285
  msgstr ""
286
 
287
- #: inc/classes/class-astra-sites.php:263
288
  msgid "Importing Widgets.."
289
  msgstr ""
290
 
291
- #: inc/classes/class-astra-sites.php:264
292
  msgid "Import Complete.."
293
  msgstr ""
294
 
295
- #: inc/classes/class-astra-sites.php:265
296
  msgid "Previewing "
297
  msgstr ""
298
 
299
- #: inc/classes/class-astra-sites.php:266
300
  msgid "See Error Log &rarr;"
301
  msgstr ""
302
 
303
- #: inc/classes/class-astra-sites.php:301
304
  msgid "No plugin specified"
305
  msgstr ""
306
 
307
- #: inc/classes/class-astra-sites.php:330
308
  msgid "Plugin Successfully Activated"
309
  msgstr ""
310
 
@@ -496,83 +496,83 @@ msgstr ""
496
  msgid "Could not update comment #%d with mapped data"
497
  msgstr ""
498
 
499
- #: inc/includes/admin-page.php:41
500
  msgid "Search Sites"
501
  msgstr ""
502
 
503
- #: inc/includes/admin-page.php:42
504
  msgid "Search Sites..."
505
  msgstr ""
506
 
507
- #: inc/includes/admin-page.php:73
508
  msgid "Select Your Favorite Page Builder"
509
  msgstr ""
510
 
511
- #: inc/includes/admin-page.php:76
512
  msgid "Sites List.."
513
  msgstr ""
514
 
515
- #: inc/includes/admin-page.php:100
516
  msgid "Close"
517
  msgstr ""
518
 
519
- #: inc/includes/admin-page.php:101
520
  msgid "Previous"
521
  msgstr ""
522
 
523
- #: inc/includes/admin-page.php:102
524
  msgid "Next"
525
  msgstr ""
526
 
527
- #: inc/includes/admin-page.php:103 inc/includes/admin-page.php:131
528
  msgid "Install Plugins"
529
  msgstr ""
530
 
531
- #: inc/includes/admin-page.php:122
532
  msgid "Required Plugins"
533
  msgstr ""
534
 
535
- #: inc/includes/admin-page.php:137
536
  msgid "Collapse"
537
  msgstr ""
538
 
539
- #: inc/includes/admin-page.php:143
540
  msgid "Enter desktop preview mode"
541
  msgstr ""
542
 
543
- #: inc/includes/admin-page.php:146
544
  msgid "Enter tablet preview mode"
545
  msgstr ""
546
 
547
- #: inc/includes/admin-page.php:149
548
  msgid "Enter mobile preview mode"
549
  msgstr ""
550
 
551
- #: inc/includes/admin-page.php:157 inc/includes/admin-page.php:258
552
  msgid "Preview"
553
  msgstr ""
554
 
555
- #: inc/includes/admin-page.php:172
556
  #. translators: %1$s & %2$s are a Demo API URL
557
  msgid ""
558
  "<p> It seems the demo data server, <i><a href=\"%1$s\">%2$s</a></i> is "
559
  "unreachable from your site.</p>"
560
  msgstr ""
561
 
562
- #: inc/includes/admin-page.php:174
563
  msgid ""
564
  "<p class=\"left-margin\"> 1. Sometimes, simple page reload fixes any "
565
  "temporary issues. No kidding!</p>"
566
  msgstr ""
567
 
568
- #: inc/includes/admin-page.php:176
569
  msgid ""
570
  "<p class=\"left-margin\"> 2. If that does not work, you will need to talk "
571
  "to your server administrator and check if demo server is being blocked by "
572
  "the firewall!</p>"
573
  msgstr ""
574
 
575
- #: inc/includes/admin-page.php:179
576
  #. translators: %1$s is a support link
577
  msgid ""
578
  "<p>If that does not help, please open up a <a href=\"%1$s\" "
@@ -580,11 +580,11 @@ msgid ""
580
  "for you.</p>"
581
  msgstr ""
582
 
583
- #: inc/includes/admin-page.php:247
584
  msgid "Details &amp; Preview"
585
  msgstr ""
586
 
587
- #: inc/includes/admin-page.php:270 inc/includes/admin-page.php:288
588
  #. translators: %1$s External Link
589
  msgid ""
590
  "Don't see a site that you would like to import?<br><a target=\"_blank\" "
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.2.7\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/astra-sites\n"
7
+ "POT-Creation-Date: 2018-07-12 09:29:35+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
100
  msgid "Categories"
101
  msgstr ""
102
 
103
+ #: inc/classes/class-astra-sites.php:212
104
  msgid "Purchase"
105
  msgstr ""
106
 
107
+ #: inc/classes/class-astra-sites.php:214
108
  msgid "Upgrade"
109
  msgstr ""
110
 
111
+ #: inc/classes/class-astra-sites.php:219
112
  msgid ""
113
  "Warning! Astra Site Import process is not complete. Don't close the window "
114
  "until import process complete. Do you still want to leave the window?"
115
  msgstr ""
116
 
117
+ #: inc/classes/class-astra-sites.php:220
118
  msgid "Error!"
119
  msgstr ""
120
 
121
+ #: inc/classes/class-astra-sites.php:221
122
  msgid "Error! Read Possibilities."
123
  msgstr ""
124
 
125
+ #: inc/classes/class-astra-sites.php:223
126
  msgid "Done! View Site"
127
  msgstr ""
128
 
129
+ #: inc/classes/class-astra-sites.php:224
130
  msgid "Activating"
131
  msgstr ""
132
 
133
+ #: inc/classes/class-astra-sites.php:225
134
  msgid "Active"
135
  msgstr ""
136
 
137
+ #: inc/classes/class-astra-sites.php:226
138
  msgid "Import failed."
139
  msgstr ""
140
 
141
+ #: inc/classes/class-astra-sites.php:227
142
  msgid "Import failed. See error log."
143
  msgstr ""
144
 
145
+ #: inc/classes/class-astra-sites.php:228
146
  msgid "Import This Site"
147
  msgstr ""
148
 
149
+ #: inc/classes/class-astra-sites.php:229 inc/classes/class-astra-sites.php:246
150
  msgid "Importing.."
151
  msgstr ""
152
 
153
+ #: inc/classes/class-astra-sites.php:230 inc/includes/admin-page.php:123
154
  msgid "Read more"
155
  msgstr ""
156
 
157
+ #: inc/classes/class-astra-sites.php:231
158
  msgid "Hide"
159
  msgstr ""
160
 
161
+ #: inc/classes/class-astra-sites.php:232
162
  msgid "There was a problem receiving a response from server."
163
  msgstr ""