Astra Starter Sites - Version 1.3.13

Version Description

Download this release

Release Info

Developer vrundakansara
Plugin Icon Astra Starter Sites
Version 1.3.13
Comparing to
See all releases

Code changes from version 1.3.11 to 1.3.13

astra-sites.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Astra Starter Sites
4
  * Plugin URI: http://www.wpastra.com/pro/
5
  * Description: Import free sites build with Astra theme.
6
- * Version: 1.3.11
7
  * Author: Brainstorm Force
8
  * Author URI: http://www.brainstormforce.com
9
  * Text Domain: astra-sites
@@ -19,7 +19,7 @@ if ( ! defined( 'ASTRA_SITES_NAME' ) ) {
19
  }
20
 
21
  if ( ! defined( 'ASTRA_SITES_VER' ) ) {
22
- define( 'ASTRA_SITES_VER', '1.3.11' );
23
  }
24
 
25
  if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
3
  * Plugin Name: Astra Starter Sites
4
  * Plugin URI: http://www.wpastra.com/pro/
5
  * Description: Import free sites build with Astra theme.
6
+ * Version: 1.3.13
7
  * Author: Brainstorm Force
8
  * Author URI: http://www.brainstormforce.com
9
  * Text Domain: astra-sites
19
  }
20
 
21
  if ( ! defined( 'ASTRA_SITES_VER' ) ) {
22
+ define( 'ASTRA_SITES_VER', '1.3.13' );
23
  }
24
 
25
  if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
inc/assets/js/admin-page.js CHANGED
@@ -1670,7 +1670,7 @@ var AstraSitesAjaxQueue = (function() {
1670
 
1671
  $('.astra-sites-third-party-required-plugins-wrap').remove();
1672
  var template = wp.template('astra-sites-third-party-required-plugins');
1673
- $('.astra-sites-advanced-options-wrap').append( template( response.data['third_party_required_plugins'] ) );
1674
  } else {
1675
  // Release disabled class from import button.
1676
  $('.astra-demo-import')
1670
 
1671
  $('.astra-sites-third-party-required-plugins-wrap').remove();
1672
  var template = wp.template('astra-sites-third-party-required-plugins');
1673
+ $('.astra-sites-advanced-options-wrap').html( template( response.data['third_party_required_plugins'] ) );
1674
  } else {
1675
  // Release disabled class from import button.
1676
  $('.astra-demo-import')
inc/classes/class-astra-sites.php CHANGED
@@ -498,10 +498,12 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
498
  'learndash-course-grid' => array(
499
  'init' => 'learndash-course-grid/learndash_course_grid.php',
500
  'name' => 'LearnDash Course Grid',
 
501
  ),
502
  'sfwd-lms' => array(
503
  'init' => 'sfwd-lms/sfwd_lms.php',
504
  'name' => 'LearnDash LMS',
 
505
  ),
506
  );
507
 
@@ -538,7 +540,7 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
538
 
539
  // Added premium plugins which need to install first.
540
  if ( array_key_exists( $plugin['slug'], $third_party_plugins ) ) {
541
- $third_party_required_plugins[] = $plugin;
542
  }
543
 
544
  // Lite - Active.
498
  'learndash-course-grid' => array(
499
  'init' => 'learndash-course-grid/learndash_course_grid.php',
500
  'name' => 'LearnDash Course Grid',
501
+ 'link' => 'https://www.learndash.com/add-on/course-grid/',
502
  ),
503
  'sfwd-lms' => array(
504
  'init' => 'sfwd-lms/sfwd_lms.php',
505
  'name' => 'LearnDash LMS',
506
+ 'link' => 'https://www.learndash.com/',
507
  ),
508
  );
509
 
540
 
541
  // Added premium plugins which need to install first.
542
  if ( array_key_exists( $plugin['slug'], $third_party_plugins ) ) {
543
+ $third_party_required_plugins[] = $third_party_plugins[ $plugin['slug'] ];
544
  }
545
 
546
  // Lite - Active.
inc/classes/compatibility/class-astra-sites-compatibility.php CHANGED
@@ -52,6 +52,9 @@ if ( ! class_exists( 'Astra_Sites_Compatibility' ) ) :
52
 
53
  // Plugin - WooCommerce.
54
  require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/woocommerce/class-astra-sites-compatibility-woocommerce.php';
 
 
 
55
  }
56
 
57
  }
52
 
53
  // Plugin - WooCommerce.
54
  require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/woocommerce/class-astra-sites-compatibility-woocommerce.php';
55
+
56
+ // Plugin - LearnDash LMS.
57
+ require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/sfwd-lms/class-astra-sites-compatibility-sfwd-lms.php';
58
  }
59
 
60
  }
inc/classes/compatibility/sfwd-lms/class-astra-sites-compatibility-sfwd-lms.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Astra Sites Compatibility for 'LearnDash LMS'
4
+ *
5
+ * @see https://www.learndash.com/
6
+ *
7
+ * @package Astra Sites
8
+ * @since 1.3.13
9
+ */
10
+
11
+ if ( ! class_exists( 'Astra_Sites_Compatibility_SFWD_LMS' ) ) :
12
+
13
+ /**
14
+ * Astra_Sites_Compatibility_SFWD_LMS
15
+ *
16
+ * @since 1.3.13
17
+ */
18
+ class Astra_Sites_Compatibility_SFWD_LMS {
19
+
20
+ /**
21
+ * Instance
22
+ *
23
+ * @access private
24
+ * @var object Class object.
25
+ * @since 1.3.13
26
+ */
27
+ private static $instance;
28
+
29
+ /**
30
+ * Initiator
31
+ *
32
+ * @since 1.3.13
33
+ * @return object initialized object of class.
34
+ */
35
+ public static function get_instance() {
36
+ if ( ! isset( self::$instance ) ) {
37
+ self::$instance = new self;
38
+ }
39
+ return self::$instance;
40
+ }
41
+
42
+ /**
43
+ * Constructor
44
+ *
45
+ * @since 1.3.13
46
+ */
47
+ public function __construct() {
48
+ add_filter( 'astra_sites_gutenberg_batch_process_post_types', array( $this, 'set_post_types' ) );
49
+ }
50
+
51
+ /**
52
+ * Add post types
53
+ *
54
+ * @since 1.3.13
55
+ * @return array Post types.
56
+ */
57
+
58
+ /**
59
+ * Set post types
60
+ *
61
+ * @since 1.3.13
62
+ *
63
+ * @param array $post_types Post types.
64
+ */
65
+ function set_post_types( $post_types = array() ) {
66
+ return array_merge( $post_types, array( 'sfwd-courses', 'sfwd-lessons', 'sfwd-topic', 'sfwd-quiz', 'sfwd-certificates', 'sfwd-assignment' ) );
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Kicking this off by calling 'get_instance()' method
72
+ */
73
+ Astra_Sites_Compatibility_SFWD_LMS::get_instance();
74
+
75
+ endif;
inc/importers/batch-processing/class-astra-sites-batch-processing-gutenberg.php CHANGED
@@ -87,7 +87,9 @@ if ( ! class_exists( 'Astra_Sites_Batch_Processing_Gutenberg' ) ) :
87
 
88
  Astra_Sites_Importer_Log::add( '---- Processing WordPress Posts / Pages - for "Gutenberg" ----' );
89
 
90
- $post_ids = Astra_Sites_Batch_Processing::get_pages( array( 'page' ) );
 
 
91
  if ( empty( $post_ids ) && ! is_array( $post_ids ) ) {
92
  return;
93
  }
87
 
88
  Astra_Sites_Importer_Log::add( '---- Processing WordPress Posts / Pages - for "Gutenberg" ----' );
89
 
90
+ $post_types = apply_filters( 'astra_sites_gutenberg_batch_process_post_types', array( 'page' ) );
91
+
92
+ $post_ids = Astra_Sites_Batch_Processing::get_pages( $post_types );
93
  if ( empty( $post_ids ) && ! is_array( $post_ids ) ) {
94
  return;
95
  }
inc/importers/batch-processing/class-astra-sites-batch-processing.php CHANGED
@@ -83,28 +83,6 @@ if ( ! class_exists( 'Astra_Sites_Batch_Processing' ) ) :
83
  // Start image importing after site import complete.
84
  add_filter( 'astra_sites_image_importer_skip_image', array( $this, 'skip_image' ), 10, 2 );
85
  add_action( 'astra_sites_import_complete', array( $this, 'start_process' ) );
86
- add_filter( 'http_request_timeout', array( $this, 'set_http_timeout' ), 10, 2 );
87
- }
88
-
89
- /**
90
- * Set the timeout for the HTTP request for the images which serve from domain `websitedemos.net`.
91
- *
92
- * @since 1.3.10
93
- *
94
- * @param int $default Time in seconds until a request times out. Default 5.
95
- * @param string $url The request URL.
96
- */
97
- function set_http_timeout( $default, $url ) {
98
-
99
- if ( strpos( $url, 'websitedemos.net' ) === false ) {
100
- return $default;
101
- }
102
-
103
- if ( Astra_Sites_Image_Importer::get_instance()->is_image_url( $url ) ) {
104
- $default = 30;
105
- }
106
-
107
- return $default;
108
  }
109
 
110
  /**
83
  // Start image importing after site import complete.
84
  add_filter( 'astra_sites_image_importer_skip_image', array( $this, 'skip_image' ), 10, 2 );
85
  add_action( 'astra_sites_import_complete', array( $this, 'start_process' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  }
87
 
88
  /**
inc/importers/class-astra-site-options-import.php CHANGED
@@ -1,289 +1,309 @@
1
- <?php
2
- /**
3
- * Customizer Site options importer class.
4
- *
5
- * @since 1.0.0
6
- * @package Astra Addon
7
- */
8
-
9
- defined( 'ABSPATH' ) or exit;
10
-
11
- /**
12
- * Customizer Site options importer class.
13
- *
14
- * @since 1.0.0
15
- */
16
- class Astra_Site_Options_Import {
17
-
18
- /**
19
- * Instance of Astra_Site_Options_Importer
20
- *
21
- * @since 1.0.0
22
- * @var (Object) Astra_Site_Options_Importer
23
- */
24
- private static $_instance = null;
25
-
26
- /**
27
- * Instanciate Astra_Site_Options_Importer
28
- *
29
- * @since 1.0.0
30
- * @return (Object) Astra_Site_Options_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
- * Site Options
42
- *
43
- * @since 1.0.2
44
- *
45
- * @return array List of defined array.
46
- */
47
- private static function site_options() {
48
- return array(
49
- 'custom_logo',
50
- 'nav_menu_locations',
51
- 'show_on_front',
52
- 'page_on_front',
53
- 'page_for_posts',
54
-
55
- // Plugin: SiteOrigin Widgets Bundle.
56
- 'siteorigin_widgets_active',
57
-
58
- // Plugin: Elementor.
59
- 'elementor_container_width',
60
- 'elementor_cpt_support',
61
- 'elementor_css_print_method',
62
- 'elementor_default_generic_fonts',
63
- 'elementor_disable_color_schemes',
64
- 'elementor_disable_typography_schemes',
65
- 'elementor_editor_break_lines',
66
- 'elementor_exclude_user_roles',
67
- 'elementor_global_image_lightbox',
68
- 'elementor_page_title_selector',
69
- 'elementor_scheme_color',
70
- 'elementor_scheme_color-picker',
71
- 'elementor_scheme_typography',
72
- 'elementor_space_between_widgets',
73
- 'elementor_stretched_section_container',
74
-
75
- // Plugin: Beaver Builder.
76
- '_fl_builder_enabled_icons',
77
- '_fl_builder_enabled_modules',
78
- '_fl_builder_post_types',
79
- '_fl_builder_color_presets',
80
- '_fl_builder_services',
81
- '_fl_builder_settings',
82
- '_fl_builder_user_access',
83
- '_fl_builder_enabled_templates',
84
-
85
- // Plugin: WooCommerce.
86
- // Pages.
87
- 'woocommerce_shop_page_title',
88
- 'woocommerce_cart_page_title',
89
- 'woocommerce_checkout_page_title',
90
- 'woocommerce_myaccount_page_title',
91
- 'woocommerce_edit_address_page_title',
92
- 'woocommerce_view_order_page_title',
93
- 'woocommerce_change_password_page_title',
94
- 'woocommerce_logout_page_title',
95
-
96
- // Account & Privacy.
97
- 'woocommerce_enable_guest_checkout',
98
- 'woocommerce_enable_checkout_login_reminder',
99
- 'woocommerce_enable_signup_and_login_from_checkout',
100
- 'woocommerce_enable_myaccount_registration',
101
- 'woocommerce_registration_generate_username',
102
-
103
- // Plugin: WPForms.
104
- 'wpforms_settings',
105
-
106
- // Categories.
107
- 'woocommerce_product_cat',
108
- );
109
- }
110
-
111
- /**
112
- * Import site options.
113
- *
114
- * @since 1.0.2 Updated option if exist in defined option array 'site_options()'.
115
- *
116
- * @since 1.0.0
117
- *
118
- * @param (Array) $options Array of site options to be imported from the demo.
119
- */
120
- public function import_options( $options = array() ) {
121
-
122
- if ( ! isset( $options ) ) {
123
- return;
124
- }
125
-
126
- foreach ( $options as $option_name => $option_value ) {
127
-
128
- // Is option exist in defined array site_options()?
129
- if ( null !== $option_value ) {
130
-
131
- // Is option exist in defined array site_options()?
132
- if ( in_array( $option_name, self::site_options(), true ) ) {
133
-
134
- switch ( $option_name ) {
135
-
136
- // Set WooCommerce page ID by page Title.
137
- case 'woocommerce_shop_page_title':
138
- case 'woocommerce_cart_page_title':
139
- case 'woocommerce_checkout_page_title':
140
- case 'woocommerce_myaccount_page_title':
141
- case 'woocommerce_edit_address_page_title':
142
- case 'woocommerce_view_order_page_title':
143
- case 'woocommerce_change_password_page_title':
144
- case 'woocommerce_logout_page_title':
145
- $this->update_woocommerce_page_id_by_option_value( $option_name, $option_value );
146
- break;
147
-
148
- case 'page_for_posts':
149
- case 'page_on_front':
150
- $this->update_page_id_by_option_value( $option_name, $option_value );
151
- break;
152
-
153
- // nav menu locations.
154
- case 'nav_menu_locations':
155
- $this->set_nav_menu_locations( $option_value );
156
- break;
157
-
158
- // import WooCommerce category images.
159
- case 'woocommerce_product_cat':
160
- $this->set_woocommerce_product_cat( $option_value );
161
- break;
162
-
163
- // insert logo.
164
- case 'custom_logo':
165
- $this->insert_logo( $option_value );
166
- break;
167
-
168
- default:
169
- update_option( $option_name, $option_value );
170
- break;
171
- }
172
- }
173
- }
174
- }
175
- }
176
-
177
- /**
178
- * Update post option
179
- *
180
- * @since 1.0.2
181
- *
182
- * @param string $option_name Option name.
183
- * @param mixed $option_value Option value.
184
- * @return void
185
- */
186
- private function update_page_id_by_option_value( $option_name, $option_value ) {
187
- $page = get_page_by_title( $option_value );
188
- if ( is_object( $page ) ) {
189
- update_option( $option_name, $page->ID );
190
- }
191
- }
192
-
193
- /**
194
- * Update WooCommerce page ids.
195
- *
196
- * @since 1.1.6
197
- *
198
- * @param string $option_name Option name.
199
- * @param mixed $option_value Option value.
200
- * @return void
201
- */
202
- private function update_woocommerce_page_id_by_option_value( $option_name, $option_value ) {
203
- $option_name = str_replace( '_title', '_id', $option_name );
204
- $this->update_page_id_by_option_value( $option_name, $option_value );
205
- }
206
-
207
- /**
208
- * In WP nav menu is stored as ( 'menu_location' => 'menu_id' );
209
- * In export we send 'menu_slug' like ( 'menu_location' => 'menu_slug' );
210
- * In import we set 'menu_id' from menu slug like ( 'menu_location' => 'menu_id' );
211
- *
212
- * @since 1.0.0
213
- * @param array $nav_menu_locations Array of nav menu locations.
214
- */
215
- private function set_nav_menu_locations( $nav_menu_locations = array() ) {
216
-
217
- $menu_locations = array();
218
-
219
- // Update menu locations.
220
- if ( isset( $nav_menu_locations ) ) {
221
-
222
- foreach ( $nav_menu_locations as $menu => $value ) {
223
-
224
- $term = get_term_by( 'slug', $value, 'nav_menu' );
225
-
226
- if ( is_object( $term ) ) {
227
- $menu_locations[ $menu ] = $term->term_id;
228
- }
229
- }
230
-
231
- set_theme_mod( 'nav_menu_locations', $menu_locations );
232
- }
233
- }
234
-
235
- /**
236
- * Set WooCommerce category images.
237
- *
238
- * @since 1.1.4
239
- *
240
- * @param array $cats Array of categories.
241
- */
242
- private function set_woocommerce_product_cat( $cats = array() ) {
243
-
244
- $menu_locations = array();
245
-
246
- if ( isset( $cats ) ) {
247
-
248
- foreach ( $cats as $key => $cat ) {
249
-
250
- if ( ! empty( $cat['slug'] ) && ! empty( $cat['thumbnail_src'] ) ) {
251
-
252
- $image = (object) Astra_Sites_Helper::_sideload_image( $cat['thumbnail_src'] );
253
-
254
- if ( ! is_wp_error( $image ) ) {
255
-
256
- if ( isset( $image->attachment_id ) && ! empty( $image->attachment_id ) ) {
257
-
258
- $term = get_term_by( 'slug', $cat['slug'], 'product_cat' );
259
-
260
- if ( is_object( $term ) ) {
261
- update_term_meta( $term->term_id, 'thumbnail_id', $image->attachment_id );
262
- }
263
- }
264
- }
265
- }
266
- }
267
- }
268
- }
269
-
270
- /**
271
- * Insert Logo By URL
272
- *
273
- * @since 1.0.0
274
- * @param string $image_url Logo URL.
275
- * @return void
276
- */
277
- private function insert_logo( $image_url = '' ) {
278
-
279
- $data = (object) Astra_Sites_Helper::_sideload_image( $image_url );
280
-
281
- if ( ! is_wp_error( $data ) ) {
282
-
283
- if ( isset( $data->attachment_id ) && ! empty( $data->attachment_id ) ) {
284
- set_theme_mod( 'custom_logo', $data->attachment_id );
285
- }
286
- }
287
- }
288
-
289
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Customizer Site options importer class.
4
+ *
5
+ * @since 1.0.0
6
+ * @package Astra Addon
7
+ */
8
+
9
+ defined( 'ABSPATH' ) or exit;
10
+
11
+ /**
12
+ * Customizer Site options importer class.
13
+ *
14
+ * @since 1.0.0
15
+ */
16
+ class Astra_Site_Options_Import {
17
+
18
+ /**
19
+ * Instance of Astra_Site_Options_Importer
20
+ *
21
+ * @since 1.0.0
22
+ * @var (Object) Astra_Site_Options_Importer
23
+ */
24
+ private static $_instance = null;
25
+
26
+ /**
27
+ * Instanciate Astra_Site_Options_Importer
28
+ *
29
+ * @since 1.0.0
30
+ * @return (Object) Astra_Site_Options_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
+ * Site Options
42
+ *
43
+ * @since 1.0.2
44
+ *
45
+ * @return array List of defined array.
46
+ */
47
+ private static function site_options() {
48
+ return array(
49
+ 'custom_logo',
50
+ 'nav_menu_locations',
51
+ 'show_on_front',
52
+ 'page_on_front',
53
+ 'page_for_posts',
54
+
55
+ // Plugin: SiteOrigin Widgets Bundle.
56
+ 'siteorigin_widgets_active',
57
+
58
+ // Plugin: Elementor.
59
+ 'elementor_container_width',
60
+ 'elementor_cpt_support',
61
+ 'elementor_css_print_method',
62
+ 'elementor_default_generic_fonts',
63
+ 'elementor_disable_color_schemes',
64
+ 'elementor_disable_typography_schemes',
65
+ 'elementor_editor_break_lines',
66
+ 'elementor_exclude_user_roles',
67
+ 'elementor_global_image_lightbox',
68
+ 'elementor_page_title_selector',
69
+ 'elementor_scheme_color',
70
+ 'elementor_scheme_color-picker',
71
+ 'elementor_scheme_typography',
72
+ 'elementor_space_between_widgets',
73
+ 'elementor_stretched_section_container',
74
+
75
+ // Plugin: Beaver Builder.
76
+ '_fl_builder_enabled_icons',
77
+ '_fl_builder_enabled_modules',
78
+ '_fl_builder_post_types',
79
+ '_fl_builder_color_presets',
80
+ '_fl_builder_services',
81
+ '_fl_builder_settings',
82
+ '_fl_builder_user_access',
83
+ '_fl_builder_enabled_templates',
84
+
85
+ // Plugin: WooCommerce.
86
+ // Pages.
87
+ 'woocommerce_shop_page_title',
88
+ 'woocommerce_cart_page_title',
89
+ 'woocommerce_checkout_page_title',
90
+ 'woocommerce_myaccount_page_title',
91
+ 'woocommerce_edit_address_page_title',
92
+ 'woocommerce_view_order_page_title',
93
+ 'woocommerce_change_password_page_title',
94
+ 'woocommerce_logout_page_title',
95
+
96
+ // Account & Privacy.
97
+ 'woocommerce_enable_guest_checkout',
98
+ 'woocommerce_enable_checkout_login_reminder',
99
+ 'woocommerce_enable_signup_and_login_from_checkout',
100
+ 'woocommerce_enable_myaccount_registration',
101
+ 'woocommerce_registration_generate_username',
102
+
103
+ // Plugin: WPForms.
104
+ 'wpforms_settings',
105
+
106
+ // Categories.
107
+ 'woocommerce_product_cat',
108
+
109
+ // Plugin: LearnDash LMS.
110
+ 'learndash_settings_theme_ld30',
111
+ 'learndash_settings_courses_themes',
112
+
113
+ );
114
+ }
115
+
116
+ /**
117
+ * Import site options.
118
+ *
119
+ * @since 1.0.2 Updated option if exist in defined option array 'site_options()'.
120
+ *
121
+ * @since 1.0.0
122
+ *
123
+ * @param (Array) $options Array of site options to be imported from the demo.
124
+ */
125
+ public function import_options( $options = array() ) {
126
+
127
+ if ( ! isset( $options ) ) {
128
+ return;
129
+ }
130
+
131
+ foreach ( $options as $option_name => $option_value ) {
132
+
133
+ // Is option exist in defined array site_options()?
134
+ if ( null !== $option_value ) {
135
+
136
+ // Is option exist in defined array site_options()?
137
+ if ( in_array( $option_name, self::site_options(), true ) ) {
138
+
139
+ switch ( $option_name ) {
140
+
141
+ // Set WooCommerce page ID by page Title.
142
+ case 'woocommerce_shop_page_title':
143
+ case 'woocommerce_cart_page_title':
144
+ case 'woocommerce_checkout_page_title':
145
+ case 'woocommerce_myaccount_page_title':
146
+ case 'woocommerce_edit_address_page_title':
147
+ case 'woocommerce_view_order_page_title':
148
+ case 'woocommerce_change_password_page_title':
149
+ case 'woocommerce_logout_page_title':
150
+ $this->update_woocommerce_page_id_by_option_value( $option_name, $option_value );
151
+ break;
152
+
153
+ case 'page_for_posts':
154
+ case 'page_on_front':
155
+ $this->update_page_id_by_option_value( $option_name, $option_value );
156
+ break;
157
+
158
+ // nav menu locations.
159
+ case 'nav_menu_locations':
160
+ $this->set_nav_menu_locations( $option_value );
161
+ break;
162
+
163
+ // import WooCommerce category images.
164
+ case 'woocommerce_product_cat':
165
+ $this->set_woocommerce_product_cat( $option_value );
166
+ break;
167
+
168
+ // insert logo.
169
+ case 'custom_logo':
170
+ $this->insert_logo( $option_value );
171
+ break;
172
+
173
+ default:
174
+ update_option( $option_name, $option_value );
175
+ break;
176
+ }
177
+ }
178
+ }
179
+ }
180
+ }
181
+
182
+ /**
183
+ * Update post option
184
+ *
185
+ * @since 1.0.2
186
+ *
187
+ * @param string $option_name Option name.
188
+ * @param mixed $option_value Option value.
189
+ * @return void
190
+ */
191
+ private function update_page_id_by_option_value( $option_name, $option_value ) {
192
+ $page = get_page_by_title( $option_value );
193
+ if ( is_object( $page ) ) {
194
+ update_option( $option_name, $page->ID );
195
+ }
196
+ }
197
+
198
+ /**
199
+ * Update WooCommerce page ids.
200
+ *
201
+ * @since 1.1.6
202
+ *
203
+ * @param string $option_name Option name.
204
+ * @param mixed $option_value Option value.
205
+ * @return void
206
+ */
207
+ private function update_woocommerce_page_id_by_option_value( $option_name, $option_value ) {
208
+ $option_name = str_replace( '_title', '_id', $option_name );
209
+ $this->update_page_id_by_option_value( $option_name, $option_value );
210
+ }
211
+
212
+ /**
213
+ * In WP nav menu is stored as ( 'menu_location' => 'menu_id' );
214
+ * In export we send 'menu_slug' like ( 'menu_location' => 'menu_slug' );
215
+ * In import we set 'menu_id' from menu slug like ( 'menu_location' => 'menu_id' );
216
+ *
217
+ * @since 1.0.0
218
+ * @param array $nav_menu_locations Array of nav menu locations.
219
+ */
220
+ private function set_nav_menu_locations( $nav_menu_locations = array() ) {
221
+
222
+ $menu_locations = array();
223
+
224
+ // Update menu locations.
225
+ if ( isset( $nav_menu_locations ) ) {
226
+
227
+ foreach ( $nav_menu_locations as $menu => $value ) {
228
+
229
+ $term = get_term_by( 'slug', $value, 'nav_menu' );
230
+
231
+ if ( is_object( $term ) ) {
232
+ $menu_locations[ $menu ] = $term->term_id;
233
+ }
234
+ }
235
+
236
+ set_theme_mod( 'nav_menu_locations', $menu_locations );
237
+ }
238
+ }
239
+
240
+ /**
241
+ * Set WooCommerce category images.
242
+ *
243
+ * @since 1.1.4
244
+ *
245
+ * @param array $cats Array of categories.
246
+ */
247
+ private function set_woocommerce_product_cat( $cats = array() ) {
248
+
249
+ $menu_locations = array();
250
+
251
+ if ( isset( $cats ) ) {
252
+
253
+ foreach ( $cats as $key => $cat ) {
254
+
255
+ if ( ! empty( $cat['slug'] ) && ! empty( $cat['thumbnail_src'] ) ) {
256
+
257
+ $image = (object) Astra_Sites_Helper::_sideload_image( $cat['thumbnail_src'] );
258
+
259
+ if ( ! is_wp_error( $image ) ) {
260
+
261
+ if ( isset( $image->attachment_id ) && ! empty( $image->attachment_id ) ) {
262
+
263
+ $term = get_term_by( 'slug', $cat['slug'], 'product_cat' );
264
+
265
+ if ( is_object( $term ) ) {
266
+ update_term_meta( $term->term_id, 'thumbnail_id', $image->attachment_id );
267
+ }
268
+ }
269
+ }
270
+ }
271
+ }
272
+ }
273
+ }
274
+
275
+ /**
276
+ * Insert Logo By URL
277
+ *
278
+ * @since 1.0.0
279
+ * @param string $image_url Logo URL.
280
+ * @return void
281
+ */
282
+ private function insert_logo( $image_url = '' ) {
283
+ $attachment_id = $this->download_image( $image_url );
284
+ if ( $attachment_id ) {
285
+ set_theme_mod( 'custom_logo', $attachment_id );
286
+ }
287
+ }
288
+
289
+ /**
290
+ * Download image by URL
291
+ *
292
+ * @since 1.3.13
293
+ *
294
+ * @param string $image_url Logo URL.
295
+ * @return mixed false|Attachment ID
296
+ */
297
+ private function download_image( $image_url = '' ) {
298
+ $data = (object) Astra_Sites_Helper::_sideload_image( $image_url );
299
+
300
+ if ( ! is_wp_error( $data ) ) {
301
+ if ( isset( $data->attachment_id ) && ! empty( $data->attachment_id ) ) {
302
+ return $data->attachment_id;
303
+ }
304
+ }
305
+
306
+ return false;
307
+ }
308
+
309
+ }
inc/importers/class-astra-sites-helper.php CHANGED
@@ -1,311 +1,311 @@
1
- <?php
2
- /**
3
- * Astra Site Helper
4
- *
5
- * @since 1.0.0
6
- * @package Astra Sites
7
- */
8
-
9
- if ( ! class_exists( 'Astra_Sites_Helper' ) ) :
10
-
11
- /**
12
- * Astra_Sites_Helper
13
- *
14
- * @since 1.0.0
15
- */
16
- class Astra_Sites_Helper {
17
-
18
- /**
19
- * Instance
20
- *
21
- * @access private
22
- * @var object Instance
23
- * @since 1.0.0
24
- */
25
- private static $instance;
26
-
27
- /**
28
- * Initiator
29
- *
30
- * @since 1.0.0
31
- * @return object initialized object of class.
32
- */
33
- public static function get_instance() {
34
- if ( ! isset( self::$instance ) ) {
35
- self::$instance = new self;
36
- }
37
- return self::$instance;
38
- }
39
-
40
- /**
41
- * Constructor
42
- *
43
- * @since 1.0.0
44
- */
45
- public function __construct() {
46
- add_filter( 'wie_import_data', array( $this, 'custom_menu_widget' ) );
47
- add_filter( 'wp_prepare_attachment_for_js', array( $this, 'add_svg_image_support' ), 10, 3 );
48
- }
49
-
50
- /**
51
- * Add svg image support
52
- *
53
- * @since 1.1.5
54
- *
55
- * @param array $response Attachment response.
56
- * @param object $attachment Attachment object.
57
- * @param array $meta Attachment meta data.
58
- */
59
- function add_svg_image_support( $response, $attachment, $meta ) {
60
- if ( ! function_exists( 'simplexml_load_file' ) ) {
61
- return $response;
62
- }
63
-
64
- if ( ! empty( $response['sizes'] ) ) {
65
- return $response;
66
- }
67
-
68
- if ( 'image/svg+xml' !== $response['mime'] ) {
69
- return $response;
70
- }
71
-
72
- $svg_path = get_attached_file( $attachment->ID );
73
-
74
- $dimensions = self::get_svg_dimensions( $svg_path );
75
-
76
- $response['sizes'] = array(
77
- 'full' => array(
78
- 'url' => $response['url'],
79
- 'width' => $dimensions->width,
80
- 'height' => $dimensions->height,
81
- 'orientation' => $dimensions->width > $dimensions->height ? 'landscape' : 'portrait',
82
- ),
83
- );
84
-
85
- return $response;
86
- }
87
-
88
- /**
89
- * Get SVG Dimensions
90
- *
91
- * @since 1.1.5
92
- *
93
- * @param string $svg SVG file path.
94
- * @return array Return SVG file height & width for valid SVG file.
95
- */
96
- public static function get_svg_dimensions( $svg ) {
97
-
98
- $svg = simplexml_load_file( $svg );
99
-
100
- if ( false === $svg ) {
101
- $width = '0';
102
- $height = '0';
103
- } else {
104
- $attributes = $svg->attributes();
105
- $width = (string) $attributes->width;
106
- $height = (string) $attributes->height;
107
- }
108
-
109
- return (object) array(
110
- 'width' => $width,
111
- 'height' => $height,
112
- );
113
- }
114
-
115
- /**
116
- * Custom Menu Widget
117
- *
118
- * In widget export we set the nav menu slug instead of ID.
119
- * So, In import process we check get menu id by slug and set
120
- * it in import widget process.
121
- *
122
- * @since 1.0.7
123
- *
124
- * @param object $all_sidebars Widget data.
125
- * @return object Set custom menu id by slug.
126
- */
127
- function custom_menu_widget( $all_sidebars ) {
128
-
129
- // Get current menu ID & Slugs.
130
- $menu_locations = array();
131
- $nav_menus = (object) wp_get_nav_menus();
132
- if ( isset( $nav_menus ) ) {
133
- foreach ( $nav_menus as $menu_key => $menu ) {
134
- if ( is_object( $menu ) ) {
135
- $menu_locations[ $menu->term_id ] = $menu->slug;
136
- }
137
- }
138
- }
139
-
140
- // Import widget data.
141
- $all_sidebars = (object) $all_sidebars;
142
- foreach ( $all_sidebars as $widgets_key => $widgets ) {
143
- foreach ( $widgets as $widget_key => $widget ) {
144
-
145
- // Found slug in current menu list.
146
- if ( isset( $widget->nav_menu ) ) {
147
- $menu_id = array_search( $widget->nav_menu, $menu_locations, true );
148
- if ( ! empty( $menu_id ) ) {
149
- $all_sidebars->$widgets_key->$widget_key->nav_menu = $menu_id;
150
- }
151
- }
152
- }
153
- }
154
-
155
- return $all_sidebars;
156
- }
157
-
158
- /**
159
- * Download File Into Uploads Directory
160
- *
161
- * @param string $file Download File URL.
162
- * @return array Downloaded file data.
163
- */
164
- public static function download_file( $file = '' ) {
165
-
166
- // Gives us access to the download_url() and wp_handle_sideload() functions.
167
- require_once( ABSPATH . 'wp-admin/includes/file.php' );
168
-
169
- $timeout_seconds = 5;
170
-
171
- // Download file to temp dir.
172
- $temp_file = download_url( $file, $timeout_seconds );
173
-
174
- // WP Error.
175
- if ( is_wp_error( $temp_file ) ) {
176
- return array(
177
- 'success' => false,
178
- 'data' => $temp_file->get_error_message(),
179
- );
180
- }
181
-
182
- // Array based on $_FILE as seen in PHP file uploads.
183
- $file_args = array(
184
- 'name' => basename( $file ),
185
- 'tmp_name' => $temp_file,
186
- 'error' => 0,
187
- 'size' => filesize( $temp_file ),
188
- );
189
-
190
- $overrides = array(
191
-
192
- // Tells WordPress to not look for the POST form
193
- // fields that would normally be present as
194
- // we downloaded the file from a remote server, so there
195
- // will be no form fields
196
- // Default is true.
197
- 'test_form' => false,
198
-
199
- // Setting this to false lets WordPress allow empty files, not recommended.
200
- // Default is true.
201
- 'test_size' => true,
202
-
203
- // A properly uploaded file will pass this test. There should be no reason to override this one.
204
- 'test_upload' => true,
205
-
206
- 'mimes' => array(
207
- 'xml' => 'text/xml',
208
- 'json' => 'text/plain',
209
- ),
210
- );
211
-
212
- // Move the temporary file into the uploads directory.
213
- $results = wp_handle_sideload( $file_args, $overrides );
214
-
215
- if ( isset( $results['error'] ) ) {
216
- return array(
217
- 'success' => false,
218
- 'data' => $results,
219
- );
220
- }
221
-
222
- // Success.
223
- return array(
224
- 'success' => true,
225
- 'data' => $results,
226
- );
227
- }
228
-
229
- /**
230
- * Downloads an image from the specified URL.
231
- *
232
- * Taken from the core media_sideload_image() function and
233
- * modified to return an array of data instead of html.
234
- *
235
- * @since 1.0.10
236
- *
237
- * @param string $file The image file path.
238
- * @return array An array of image data.
239
- */
240
- static public function _sideload_image( $file ) {
241
- $data = new stdClass();
242
-
243
- if ( ! function_exists( 'media_handle_sideload' ) ) {
244
- require_once( ABSPATH . 'wp-admin/includes/media.php' );
245
- require_once( ABSPATH . 'wp-admin/includes/file.php' );
246
- require_once( ABSPATH . 'wp-admin/includes/image.php' );
247
- }
248
-
249
- if ( ! empty( $file ) ) {
250
-
251
- // Set variables for storage, fix file filename for query strings.
252
- preg_match( '/[^\?]+\.(jpe?g|jpe|svg|gif|png)\b/i', $file, $matches );
253
- $file_array = array();
254
- $file_array['name'] = basename( $matches[0] );
255
-
256
- // Download file to temp location.
257
- $file_array['tmp_name'] = download_url( $file );
258
-
259
- // If error storing temporarily, return the error.
260
- if ( is_wp_error( $file_array['tmp_name'] ) ) {
261
- return $file_array['tmp_name'];
262
- }
263
-
264
- // Do the validation and storage stuff.
265
- $id = media_handle_sideload( $file_array, 0 );
266
-
267
- // If error storing permanently, unlink.
268
- if ( is_wp_error( $id ) ) {
269
- unlink( $file_array['tmp_name'] );
270
- return $id;
271
- }
272
-
273
- // Build the object to return.
274
- $meta = wp_get_attachment_metadata( $id );
275
- $data->attachment_id = $id;
276
- $data->url = wp_get_attachment_url( $id );
277
- $data->thumbnail_url = wp_get_attachment_thumb_url( $id );
278
- $data->height = $meta['height'];
279
- $data->width = $meta['width'];
280
- }
281
-
282
- return $data;
283
- }
284
-
285
- /**
286
- * Checks to see whether a string is an image url or not.
287
- *
288
- * @since 1.0.10
289
- *
290
- * @param string $string The string to check.
291
- * @return bool Whether the string is an image url or not.
292
- */
293
- static public function _is_image_url( $string = '' ) {
294
- if ( is_string( $string ) ) {
295
-
296
- if ( preg_match( '/\.(jpg|jpeg|svg|png|gif)/i', $string ) ) {
297
- return true;
298
- }
299
- }
300
-
301
- return false;
302
- }
303
-
304
- }
305
-
306
- /**
307
- * Kicking this off by calling 'get_instance()' method
308
- */
309
- Astra_Sites_Helper::get_instance();
310
-
311
- endif;
1
+ <?php
2
+ /**
3
+ * Astra Site Helper
4
+ *
5
+ * @since 1.0.0
6
+ * @package Astra Sites
7
+ */
8
+
9
+ if ( ! class_exists( 'Astra_Sites_Helper' ) ) :
10
+
11
+ /**
12
+ * Astra_Sites_Helper
13
+ *
14
+ * @since 1.0.0
15
+ */
16
+ class Astra_Sites_Helper {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @access private
22
+ * @var object Instance
23
+ * @since 1.0.0
24
+ */
25
+ private static $instance;
26
+
27
+ /**
28
+ * Initiator
29
+ *
30
+ * @since 1.0.0
31
+ * @return object initialized object of class.
32
+ */
33
+ public static function get_instance() {
34
+ if ( ! isset( self::$instance ) ) {
35
+ self::$instance = new self;
36
+ }
37
+ return self::$instance;
38
+ }
39
+
40
+ /**
41
+ * Constructor
42
+ *
43
+ * @since 1.0.0
44
+ */
45
+ public function __construct() {
46
+ add_filter( 'wie_import_data', array( $this, 'custom_menu_widget' ) );
47
+ add_filter( 'wp_prepare_attachment_for_js', array( $this, 'add_svg_image_support' ), 10, 3 );
48
+ }
49
+
50
+ /**
51
+ * Add svg image support
52
+ *
53
+ * @since 1.1.5
54
+ *
55
+ * @param array $response Attachment response.
56
+ * @param object $attachment Attachment object.
57
+ * @param array $meta Attachment meta data.
58
+ */
59
+ function add_svg_image_support( $response, $attachment, $meta ) {
60
+ if ( ! function_exists( 'simplexml_load_file' ) ) {
61
+ return $response;
62
+ }
63
+
64
+ if ( ! empty( $response['sizes'] ) ) {
65
+ return $response;
66
+ }
67
+
68
+ if ( 'image/svg+xml' !== $response['mime'] ) {
69
+ return $response;
70
+ }
71
+
72
+ $svg_path = get_attached_file( $attachment->ID );
73
+
74
+ $dimensions = self::get_svg_dimensions( $svg_path );
75
+
76
+ $response['sizes'] = array(
77
+ 'full' => array(
78
+ 'url' => $response['url'],
79
+ 'width' => $dimensions->width,
80
+ 'height' => $dimensions->height,
81
+ 'orientation' => $dimensions->width > $dimensions->height ? 'landscape' : 'portrait',
82
+ ),
83
+ );
84
+
85
+ return $response;
86
+ }
87
+
88
+ /**
89
+ * Get SVG Dimensions
90
+ *
91
+ * @since 1.1.5
92
+ *
93
+ * @param string $svg SVG file path.
94
+ * @return array Return SVG file height & width for valid SVG file.
95
+ */
96
+ public static function get_svg_dimensions( $svg ) {
97
+
98
+ $svg = simplexml_load_file( $svg );
99
+
100
+ if ( false === $svg ) {
101
+ $width = '0';
102
+ $height = '0';
103
+ } else {
104
+ $attributes = $svg->attributes();
105
+ $width = (string) $attributes->width;
106
+ $height = (string) $attributes->height;
107
+ }
108
+
109
+ return (object) array(
110
+ 'width' => $width,
111
+ 'height' => $height,
112
+ );
113
+ }
114
+
115
+ /**
116
+ * Custom Menu Widget
117
+ *
118
+ * In widget export we set the nav menu slug instead of ID.
119
+ * So, In import process we check get menu id by slug and set
120
+ * it in import widget process.
121
+ *
122
+ * @since 1.0.7
123
+ *
124
+ * @param object $all_sidebars Widget data.
125
+ * @return object Set custom menu id by slug.
126
+ */
127
+ function custom_menu_widget( $all_sidebars ) {
128
+
129
+ // Get current menu ID & Slugs.
130
+ $menu_locations = array();
131
+ $nav_menus = (object) wp_get_nav_menus();
132
+ if ( isset( $nav_menus ) ) {
133
+ foreach ( $nav_menus as $menu_key => $menu ) {
134
+ if ( is_object( $menu ) ) {
135
+ $menu_locations[ $menu->term_id ] = $menu->slug;
136
+ }
137
+ }
138
+ }
139
+
140
+ // Import widget data.
141
+ $all_sidebars = (object) $all_sidebars;
142
+ foreach ( $all_sidebars as $widgets_key => $widgets ) {
143
+ foreach ( $widgets as $widget_key => $widget ) {
144
+
145
+ // Found slug in current menu list.
146
+ if ( isset( $widget->nav_menu ) ) {
147
+ $menu_id = array_search( $widget->nav_menu, $menu_locations, true );
148
+ if ( ! empty( $menu_id ) ) {
149
+ $all_sidebars->$widgets_key->$widget_key->nav_menu = $menu_id;
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
+ return $all_sidebars;
156
+ }
157
+
158
+ /**
159
+ * Download File Into Uploads Directory
160
+ *
161
+ * @param string $file Download File URL.
162
+ * @return array Downloaded file data.
163
+ */
164
+ public static function download_file( $file = '' ) {
165
+
166
+ // Gives us access to the download_url() and wp_handle_sideload() functions.
167
+ require_once( ABSPATH . 'wp-admin/includes/file.php' );
168
+
169
+ $timeout_seconds = 5;
170
+
171
+ // Download file to temp dir.
172
+ $temp_file = download_url( $file, $timeout_seconds );
173
+
174
+ // WP Error.
175
+ if ( is_wp_error( $temp_file ) ) {
176
+ return array(
177
+ 'success' => false,
178
+ 'data' => $temp_file->get_error_message(),
179
+ );
180
+ }
181
+
182
+ // Array based on $_FILE as seen in PHP file uploads.
183
+ $file_args = array(
184
+ 'name' => basename( $file ),
185
+ 'tmp_name' => $temp_file,
186
+ 'error' => 0,
187
+ 'size' => filesize( $temp_file ),
188
+ );
189
+
190
+ $overrides = array(
191
+
192
+ // Tells WordPress to not look for the POST form
193
+ // fields that would normally be present as
194
+ // we downloaded the file from a remote server, so there
195
+ // will be no form fields
196
+ // Default is true.
197
+ 'test_form' => false,
198
+
199
+ // Setting this to false lets WordPress allow empty files, not recommended.
200
+ // Default is true.
201
+ 'test_size' => true,
202
+
203
+ // A properly uploaded file will pass this test. There should be no reason to override this one.
204
+ 'test_upload' => true,
205
+
206
+ 'mimes' => array(
207
+ 'xml' => 'text/xml',
208
+ 'json' => 'text/plain',
209
+ ),
210
+ );
211
+
212
+ // Move the temporary file into the uploads directory.
213
+ $results = wp_handle_sideload( $file_args, $overrides );
214
+
215
+ if ( isset( $results['error'] ) ) {
216
+ return array(
217
+ 'success' => false,
218
+ 'data' => $results,
219
+ );
220
+ }
221
+
222
+ // Success.
223
+ return array(
224
+ 'success' => true,
225
+ 'data' => $results,
226
+ );
227
+ }
228
+
229
+ /**
230
+ * Downloads an image from the specified URL.
231
+ *
232
+ * Taken from the core media_sideload_image() function and
233
+ * modified to return an array of data instead of html.
234
+ *
235
+ * @since 1.0.10
236
+ *
237
+ * @param string $file The image file path.
238
+ * @return array An array of image data.
239
+ */
240
+ static public function _sideload_image( $file ) {
241
+ $data = new stdClass();
242
+
243
+ if ( ! function_exists( 'media_handle_sideload' ) ) {
244
+ require_once( ABSPATH . 'wp-admin/includes/media.php' );
245
+ require_once( ABSPATH . 'wp-admin/includes/file.php' );
246
+ require_once( ABSPATH . 'wp-admin/includes/image.php' );
247
+ }
248
+
249
+ if ( ! empty( $file ) ) {
250
+
251
+ // Set variables for storage, fix file filename for query strings.
252
+ preg_match( '/[^\?]+\.(jpe?g|jpe|svg|gif|png)\b/i', $file, $matches );
253
+ $file_array = array();
254
+ $file_array['name'] = basename( $matches[0] );
255
+
256
+ // Download file to temp location.
257
+ $file_array['tmp_name'] = download_url( $file );
258
+
259
+ // If error storing temporarily, return the error.
260
+ if ( is_wp_error( $file_array['tmp_name'] ) ) {
261
+ return $file_array['tmp_name'];
262
+ }
263
+
264
+ // Do the validation and storage stuff.
265
+ $id = media_handle_sideload( $file_array, 0 );
266
+
267
+ // If error storing permanently, unlink.
268
+ if ( is_wp_error( $id ) ) {
269
+ unlink( $file_array['tmp_name'] );
270
+ return $id;
271
+ }
272
+
273
+ // Build the object to return.
274
+ $meta = wp_get_attachment_metadata( $id );
275
+ $data->attachment_id = $id;
276
+ $data->url = wp_get_attachment_url( $id );
277
+ $data->thumbnail_url = wp_get_attachment_thumb_url( $id );
278
+ $data->height = $meta['height'];
279
+ $data->width = $meta['width'];
280
+ }
281
+
282
+ return $data;
283
+ }
284
+
285
+ /**
286
+ * Checks to see whether a string is an image url or not.
287
+ *
288
+ * @since 1.0.10
289
+ *
290
+ * @param string $string The string to check.
291
+ * @return bool Whether the string is an image url or not.
292
+ */
293
+ static public function _is_image_url( $string = '' ) {
294
+ if ( is_string( $string ) ) {
295
+
296
+ if ( preg_match( '/\.(jpg|jpeg|svg|png|gif)/i', $string ) ) {
297
+ return true;
298
+ }
299
+ }
300
+
301
+ return false;
302
+ }
303
+
304
+ }
305
+
306
+ /**
307
+ * Kicking this off by calling 'get_instance()' method
308
+ */
309
+ Astra_Sites_Helper::get_instance();
310
+
311
+ endif;
inc/includes/admin-page.php CHANGED
@@ -106,12 +106,11 @@ defined( 'ABSPATH' ) or exit;
106
  ?>
107
  <script type="text/template" id="tmpl-astra-sites-third-party-required-plugins">
108
  <div class="astra-sites-third-party-required-plugins-wrap">
109
- <div class="notice notice-warning">
110
- <p>To import this website, You need to install below plugins!</p>
111
- </div>
112
  <ul class="astra-sites-third-party-required-plugins">
113
  <# for ( key in data ) { #>
114
- <li class="plugin-card plugin-card-{{data[ key ].slug}}'" data-slug="{{data[ key ].slug }}" data-init="{{data[ key ].init}}" data-name="{{data[ key ].name}}">{{data[ key ].name}}</li>
115
  <# } #>
116
  </ul>
117
  </div>
106
  ?>
107
  <script type="text/template" id="tmpl-astra-sites-third-party-required-plugins">
108
  <div class="astra-sites-third-party-required-plugins-wrap">
109
+ <h3 class="theme-name"><?php esc_html_e( 'Required Plugin Missing', 'astra-sites' ); ?></h3>
110
+ <p><?php esc_html_e( 'This starter site requires premium plugins. As these are third party premium plugins, you\'ll need to purchase, install and activate them first.', 'astra-sites' ); ?></p>
 
111
  <ul class="astra-sites-third-party-required-plugins">
112
  <# for ( key in data ) { #>
113
+ <li class="plugin-card plugin-card-{{data[ key ].slug}}'" data-slug="{{data[ key ].slug }}" data-init="{{data[ key ].init}}" data-name="{{data[ key ].name}}"><a href="{{data[ key ].link}}" target="_blank">{{data[ key ].name}}</a></li>
114
  <# } #>
115
  </ul>
116
  </div>
languages/astra-sites.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Astra Starter Sites package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Astra Starter Sites 1.3.11\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/astra-sites\n"
7
- "POT-Creation-Date: 2019-05-13 09:46:15+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -139,7 +139,7 @@ msgstr ""
139
  msgid "Please select your favorite page builder to continue.."
140
  msgstr ""
141
 
142
- #: inc/classes/class-astra-sites-page.php:313 inc/includes/admin-page.php:159
143
  msgid "Next"
144
  msgstr ""
145
 
@@ -259,7 +259,7 @@ msgstr ""
259
  msgid "Importing.."
260
  msgstr ""
261
 
262
- #: inc/classes/class-astra-sites.php:365 inc/includes/admin-page.php:179
263
  msgid "Read more"
264
  msgstr ""
265
 
@@ -271,7 +271,7 @@ msgstr ""
271
  msgid "There was a problem receiving a response from server."
272
  msgstr ""
273
 
274
- #: inc/classes/class-astra-sites.php:368 inc/includes/admin-page.php:409
275
  msgid "No Demos found, Try a different search."
276
  msgstr ""
277
 
@@ -641,121 +641,131 @@ msgid ""
641
  "of the Astra Premium Sites plugin."
642
  msgstr ""
643
 
644
- #: inc/includes/admin-page.php:130
 
 
 
 
 
 
 
 
 
 
645
  msgid "Select Your Favorite Page Builder"
646
  msgstr ""
647
 
648
- #: inc/includes/admin-page.php:133
649
  msgid "Sites List.."
650
  msgstr ""
651
 
652
- #: inc/includes/admin-page.php:157
653
  msgid "Close"
654
  msgstr ""
655
 
656
- #: inc/includes/admin-page.php:158
657
  msgid "Previous"
658
  msgstr ""
659
 
660
- #: inc/includes/admin-page.php:160 inc/includes/admin-page.php:161
661
- #: inc/includes/admin-page.php:246 inc/includes/admin-page.php:253
662
  msgid "Import Site"
663
  msgstr ""
664
 
665
- #: inc/includes/admin-page.php:188
666
  msgid "Install Required Plugins"
667
  msgstr ""
668
 
669
- #: inc/includes/admin-page.php:200
670
  msgid ""
671
  "Customizer is what gives a design to the website; and selecting this option "
672
  "replaces your current design with a new one."
673
  msgstr ""
674
 
675
- #: inc/includes/admin-page.php:201
676
  msgid ""
677
  "Backup of current customizer settings will be stored in "
678
  "\"wp-content/astra-sites\" directory, just in case if you want to restore "
679
  "it later."
680
  msgstr ""
681
 
682
- #: inc/includes/admin-page.php:211
683
  msgid ""
684
  "Selecting this option will import dummy pages, posts, images and menus. If "
685
  "you do not want to import dummy content, please uncheck this option."
686
  msgstr ""
687
 
688
- #: inc/includes/admin-page.php:227
689
  msgid ""
690
  "WARNING: Selecting this option will delete data from your current website. "
691
  "Choose this option only if this is intended."
692
  msgstr ""
693
 
694
- #: inc/includes/admin-page.php:232
695
  msgid "Advanced Options"
696
  msgstr ""
697
 
698
- #: inc/includes/admin-page.php:237
699
  msgid "Required Plugins"
700
  msgstr ""
701
 
702
- #: inc/includes/admin-page.php:259
703
  msgid "Collapse"
704
  msgstr ""
705
 
706
- #: inc/includes/admin-page.php:265
707
  msgid "Enter desktop preview mode"
708
  msgstr ""
709
 
710
- #: inc/includes/admin-page.php:268
711
  msgid "Enter tablet preview mode"
712
  msgstr ""
713
 
714
- #: inc/includes/admin-page.php:271
715
  msgid "Enter mobile preview mode"
716
  msgstr ""
717
 
718
- #: inc/includes/admin-page.php:279 inc/includes/admin-page.php:401
719
  msgid "Preview"
720
  msgstr ""
721
 
722
- #: inc/includes/admin-page.php:282
723
  msgid "We're importing your website."
724
  msgstr ""
725
 
726
- #: inc/includes/admin-page.php:283
727
  msgid ""
728
  "The process can take anywhere between 2 to 10 minutes depending on the size "
729
  "of the website and speed of connection."
730
  msgstr ""
731
 
732
- #: inc/includes/admin-page.php:284
733
  msgid ""
734
  "Please do not close this browser window until the site is imported "
735
  "completely."
736
  msgstr ""
737
 
738
- #: inc/includes/admin-page.php:307
739
  #. translators: %1$s & %2$s are a Demo API URL
740
  msgid ""
741
  "<p> It seems the demo data server, <i><a href=\"%1$s\">%2$s</a></i> is "
742
  "unreachable from your site.</p>"
743
  msgstr ""
744
 
745
- #: inc/includes/admin-page.php:309
746
  msgid ""
747
  "<p class=\"left-margin\"> 1. Sometimes, simple page reload fixes any "
748
  "temporary issues. No kidding!</p>"
749
  msgstr ""
750
 
751
- #: inc/includes/admin-page.php:311
752
  msgid ""
753
  "<p class=\"left-margin\"> 2. If that does not work, you will need to talk "
754
  "to your server administrator and check if demo server is being blocked by "
755
  "the firewall!</p>"
756
  msgstr ""
757
 
758
- #: inc/includes/admin-page.php:314
759
  #. translators: %1$s is a support link
760
  msgid ""
761
  "<p>If that does not help, please open up a <a href=\"%1$s\" "
@@ -763,24 +773,24 @@ msgid ""
763
  "for you.</p>"
764
  msgstr ""
765
 
766
- #: inc/includes/admin-page.php:326
767
  msgid "Under Maintenance.."
768
  msgstr ""
769
 
770
- #: inc/includes/admin-page.php:327
771
  msgid ""
772
  "If you are seeing this message, most likely our servers are under routine "
773
  "maintenance and we will be back shortly. "
774
  msgstr ""
775
 
776
- #: inc/includes/admin-page.php:328
777
  msgid ""
778
  "In rare case, it is possible your website is having trouble connecting with "
779
  "ours. If you need help, please feel free to get in touch with us from our "
780
  "website."
781
  msgstr ""
782
 
783
- #: inc/includes/admin-page.php:413 inc/includes/admin-page.php:431
784
  #. translators: %1$s External Link
785
  msgid ""
786
  "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.3.13\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/astra-sites\n"
7
+ "POT-Creation-Date: 2019-06-04 10:21:28+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
139
  msgid "Please select your favorite page builder to continue.."
140
  msgstr ""
141
 
142
+ #: inc/classes/class-astra-sites-page.php:313 inc/includes/admin-page.php:158
143
  msgid "Next"
144
  msgstr ""
145
 
259
  msgid "Importing.."
260
  msgstr ""
261
 
262
+ #: inc/classes/class-astra-sites.php:365 inc/includes/admin-page.php:178
263
  msgid "Read more"
264
  msgstr ""
265
 
271
  msgid "There was a problem receiving a response from server."
272
  msgstr ""
273
 
274
+ #: inc/classes/class-astra-sites.php:368 inc/includes/admin-page.php:408
275
  msgid "No Demos found, Try a different search."
276
  msgstr ""
277
 
641
  "of the Astra Premium Sites plugin."
642
  msgstr ""
643
 
644
+ #: inc/includes/admin-page.php:109
645
+ msgid "Required Plugin Missing"
646
+ msgstr ""
647
+
648
+ #: inc/includes/admin-page.php:110
649
+ msgid ""
650
+ "This starter site requires premium plugins. As these are third party "
651
+ "premium plugins, you'll need to purchase, install and activate them first."
652
+ msgstr ""
653
+
654
+ #: inc/includes/admin-page.php:129
655
  msgid "Select Your Favorite Page Builder"
656
  msgstr ""
657
 
658
+ #: inc/includes/admin-page.php:132
659
  msgid "Sites List.."
660
  msgstr ""
661
 
662
+ #: inc/includes/admin-page.php:156
663
  msgid "Close"
664
  msgstr ""
665
 
666
+ #: inc/includes/admin-page.php:157
667
  msgid "Previous"
668
  msgstr ""
669
 
670
+ #: inc/includes/admin-page.php:159 inc/includes/admin-page.php:160
671
+ #: inc/includes/admin-page.php:245 inc/includes/admin-page.php:252
672
  msgid "Import Site"
673
  msgstr ""
674
 
675
+ #: inc/includes/admin-page.php:187
676
  msgid "Install Required Plugins"
677
  msgstr ""
678
 
679
+ #: inc/includes/admin-page.php:199
680
  msgid ""
681
  "Customizer is what gives a design to the website; and selecting this option "
682
  "replaces your current design with a new one."
683
  msgstr ""
684
 
685
+ #: inc/includes/admin-page.php:200
686
  msgid ""
687
  "Backup of current customizer settings will be stored in "
688
  "\"wp-content/astra-sites\" directory, just in case if you want to restore "
689
  "it later."
690
  msgstr ""
691
 
692
+ #: inc/includes/admin-page.php:210
693
  msgid ""
694
  "Selecting this option will import dummy pages, posts, images and menus. If "
695
  "you do not want to import dummy content, please uncheck this option."
696
  msgstr ""
697
 
698
+ #: inc/includes/admin-page.php:226
699
  msgid ""
700
  "WARNING: Selecting this option will delete data from your current website. "
701
  "Choose this option only if this is intended."
702
  msgstr ""
703
 
704
+ #: inc/includes/admin-page.php:231
705
  msgid "Advanced Options"
706
  msgstr ""
707
 
708
+ #: inc/includes/admin-page.php:236
709
  msgid "Required Plugins"
710
  msgstr ""
711
 
712
+ #: inc/includes/admin-page.php:258
713
  msgid "Collapse"
714
  msgstr ""
715
 
716
+ #: inc/includes/admin-page.php:264
717
  msgid "Enter desktop preview mode"
718
  msgstr ""
719
 
720
+ #: inc/includes/admin-page.php:267
721
  msgid "Enter tablet preview mode"
722
  msgstr ""
723
 
724
+ #: inc/includes/admin-page.php:270
725
  msgid "Enter mobile preview mode"
726
  msgstr ""
727
 
728
+ #: inc/includes/admin-page.php:278 inc/includes/admin-page.php:400
729
  msgid "Preview"
730
  msgstr ""
731
 
732
+ #: inc/includes/admin-page.php:281
733
  msgid "We're importing your website."
734
  msgstr ""
735
 
736
+ #: inc/includes/admin-page.php:282
737
  msgid ""
738
  "The process can take anywhere between 2 to 10 minutes depending on the size "
739
  "of the website and speed of connection."
740
  msgstr ""
741
 
742
+ #: inc/includes/admin-page.php:283
743
  msgid ""
744
  "Please do not close this browser window until the site is imported "
745
  "completely."
746
  msgstr ""
747
 
748
+ #: inc/includes/admin-page.php:306
749
  #. translators: %1$s & %2$s are a Demo API URL
750
  msgid ""
751
  "<p> It seems the demo data server, <i><a href=\"%1$s\">%2$s</a></i> is "
752
  "unreachable from your site.</p>"
753
  msgstr ""
754
 
755
+ #: inc/includes/admin-page.php:308
756
  msgid ""
757
  "<p class=\"left-margin\"> 1. Sometimes, simple page reload fixes any "
758
  "temporary issues. No kidding!</p>"
759
  msgstr ""
760
 
761
+ #: inc/includes/admin-page.php:310
762
  msgid ""
763
  "<p class=\"left-margin\"> 2. If that does not work, you will need to talk "
764
  "to your server administrator and check if demo server is being blocked by "
765
  "the firewall!</p>"
766
  msgstr ""
767
 
768
+ #: inc/includes/admin-page.php:313
769
  #. translators: %1$s is a support link
770
  msgid ""
771
  "<p>If that does not help, please open up a <a href=\"%1$s\" "
773
  "for you.</p>"
774
  msgstr ""
775
 
776
+ #: inc/includes/admin-page.php:325
777
  msgid "Under Maintenance.."
778
  msgstr ""
779
 
780
+ #: inc/includes/admin-page.php:326
781
  msgid ""
782
  "If you are seeing this message, most likely our servers are under routine "
783
  "maintenance and we will be back shortly. "
784
  msgstr ""
785
 
786
+ #: inc/includes/admin-page.php:327
787
  msgid ""
788
  "In rare case, it is possible your website is having trouble connecting with "
789
  "ours. If you need help, please feel free to get in touch with us from our "
790
  "website."
791
  msgstr ""
792
 
793
+ #: inc/includes/admin-page.php:412 inc/includes/admin-page.php:430
794
  #. translators: %1$s External Link
795
  msgid ""
796
  "Don't see a site that you would like to import?<br><a target=\"_blank\" "
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: https://wpastra.com/pro/
4
  Tags: Elementor,Beaver Builder,Templates,Gutenberg,Astra Starter Sites
5
  Requires at least: 4.4
6
  Requires PHP: 5.3
7
- Tested up to: 5.2
8
- Stable tag: 1.3.11
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -117,6 +117,12 @@ We are open to suggestions and would love to work on topics that our users are l
117
 
118
  == Changelog ==
119
 
 
 
 
 
 
 
120
  v1.3.11 - 13-May-2019
121
  - Improvement: Added compatibility to WordPress 5.2.
122
 
4
  Tags: Elementor,Beaver Builder,Templates,Gutenberg,Astra Starter Sites
5
  Requires at least: 4.4
6
  Requires PHP: 5.3
7
+ Tested up to: 5.2.1
8
+ Stable tag: 1.3.13
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
117
 
118
  == Changelog ==
119
 
120
+ v1.3.13 - 5-June-2019
121
+ - New: Added LearnDash plugin support for the LearnDash demo sites.
122
+
123
+ v1.3.12 - 14-May-2019
124
+ - Improvement: Added compatibility for below WordPress 5.1.
125
+
126
  v1.3.11 - 13-May-2019
127
  - Improvement: Added compatibility to WordPress 5.2.
128