Astra Starter Sites - Version 1.0.10

Version Description

Download this release

Release Info

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

Code changes from version 1.0.9 to 1.0.10

astra-sites.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: Astra Sites - Lite
4
* Plugin URI: http://www.wpastra.com/pro/
5
* Description: Import free sites build with Astra theme.
6
- * Version: 1.0.9
7
* Author: Brainstorm Force
8
* Author URI: http://www.brainstormforce.com
9
* Text Domain: astra-sites
@@ -15,7 +15,7 @@
15
* Set constants.
16
*/
17
if ( ! defined( 'ASTRA_SITES_VER' ) ) {
18
- define( 'ASTRA_SITES_VER', '1.0.9' );
19
}
20
21
if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
3
* Plugin Name: Astra Sites - Lite
4
* Plugin URI: http://www.wpastra.com/pro/
5
* Description: Import free sites build with Astra theme.
6
+ * Version: 1.0.10
7
* Author: Brainstorm Force
8
* Author URI: http://www.brainstormforce.com
9
* Text Domain: astra-sites
15
* Set constants.
16
*/
17
if ( ! defined( 'ASTRA_SITES_VER' ) ) {
18
+ define( 'ASTRA_SITES_VER', '1.0.10' );
19
}
20
21
if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
inc/admin/class-astra-sites-page.php CHANGED
@@ -82,7 +82,7 @@ if ( ! class_exists( 'Astra_Sites_Page' ) ) {
82
*/
83
static public function init_admin_settings() {
84
85
- self::$menu_page_title = apply_filters( 'astra_sites_menu_page_title', __( 'Astra Sites - Lite' , 'astra-sites' ) );
86
87
if ( isset( $_REQUEST['page'] ) && strpos( $_REQUEST['page'], self::$plugin_slug ) !== false ) {
88
82
*/
83
static public function init_admin_settings() {
84
85
+ self::$menu_page_title = apply_filters( 'astra_sites_menu_page_title', __( 'Astra Sites' , 'astra-sites' ) );
86
87
if ( isset( $_REQUEST['page'] ) && strpos( $_REQUEST['page'], self::$plugin_slug ) !== false ) {
88
inc/assets/css/admin.css CHANGED
@@ -222,4 +222,7 @@
222
}
223
.filter-count {
224
min-width: 3em;
225
}
222
}
223
.filter-count {
224
min-width: 3em;
225
+ }
226
+ .astra-site-preview-on {
227
+ overflow: hidden;
228
}
inc/assets/js/admin.js CHANGED
@@ -170,6 +170,8 @@ jQuery(document).on('click', '.theme-browser .theme-screenshot, .theme-browser .
170
$this = jQuery(this).parents('.theme');
171
$this.addClass('theme-preview-on');
172
173
renderDemoPreview($this);
174
});
175
@@ -179,6 +181,7 @@ jQuery(document).on('click', '.close-full-overlay', function (event) {
179
jQuery('.theme-install-overlay').css('display', 'none');
180
jQuery('.theme-install-overlay').remove();
181
jQuery('.theme-preview-on').removeClass('theme-preview-on');
182
});
183
184
jQuery(document).on('click', '.next-theme', function (event) {
170
$this = jQuery(this).parents('.theme');
171
$this.addClass('theme-preview-on');
172
173
+ jQuery('html').addClass('astra-site-preview-on');
174
+
175
renderDemoPreview($this);
176
});
177
181
jQuery('.theme-install-overlay').css('display', 'none');
182
jQuery('.theme-install-overlay').remove();
183
jQuery('.theme-preview-on').removeClass('theme-preview-on');
184
+ jQuery('html').removeClass('astra-site-preview-on');
185
});
186
187
jQuery(document).on('click', '.next-theme', function (event) {
inc/classes/class-astra-sites.php CHANGED
@@ -237,9 +237,9 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
237
'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
238
'siteURL' => site_url(),
239
'getProText' => __( 'Purchase', 'astra-sites' ),
240
- 'getProURL' => esc_url( 'https://wpastra.com/pro/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=' ),
241
'getUpgradeText' => __( 'Upgrade', 'astra-sites' ),
242
- 'getUpgradeURL' => esc_url( 'https://wpastra.com/pro/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=' ),
243
'_ajax_nonce' => wp_create_nonce( 'astra-sites' ),
244
'requiredPluginsCount' => 0,
245
'strings' => array(
237
'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
238
'siteURL' => site_url(),
239
'getProText' => __( 'Purchase', 'astra-sites' ),
240
+ 'getProURL' => esc_url( 'https://wpastra.com/agency/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=wp-dashboard' ),
241
'getUpgradeText' => __( 'Upgrade', 'astra-sites' ),
242
+ 'getUpgradeURL' => esc_url( 'https://wpastra.com/agency/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=wp-dashboard' ),
243
'_ajax_nonce' => wp_create_nonce( 'astra-sites' ),
244
'requiredPluginsCount' => 0,
245
'strings' => array(
inc/importers/class-astra-customizer-import.php CHANGED
@@ -49,7 +49,7 @@ class Astra_Customizer_Import {
49
50
// Update Astra Theme customizer settings.
51
if ( isset( $options['astra-settings'] ) ) {
52
- update_option( 'astra-settings', $options['astra-settings'] );
53
}
54
55
// Add Custom CSS.
@@ -58,4 +58,31 @@ class Astra_Customizer_Import {
58
}
59
60
}
61
}
49
50
// Update Astra Theme customizer settings.
51
if ( isset( $options['astra-settings'] ) ) {
52
+ self::_import_settings( $options['astra-settings'] );
53
}
54
55
// Add Custom CSS.
58
}
59
60
}
61
+
62
+ /**
63
+ * Import Astra Setting's
64
+ *
65
+ * Download & Import images from Astra Customizer Settings.
66
+ *
67
+ * @since 1.0.10
68
+ *
69
+ * @param array $options Astra Customizer setting array.
70
+ * @return void
71
+ */
72
+ static public function _import_settings( $options = array() ) {
73
+ foreach ( $options as $key => $val ) {
74
+
75
+ if ( Astra_Sites_Helper::_is_image_url( $val ) ) {
76
+
77
+ $data = Astra_Sites_Helper::_sideload_image( $val );
78
+
79
+ if ( ! is_wp_error( $data ) ) {
80
+ $options[ $key ] = $data->url;
81
+ }
82
+ }
83
+ }
84
+
85
+ // Updated settings.
86
+ update_option( 'astra-settings', $options );
87
+ }
88
}
inc/importers/class-astra-site-options-import.php CHANGED
@@ -188,25 +188,13 @@ class Astra_Site_Options_Import {
188
*/
189
private function insert_logo( $image_url = '' ) {
190
191
- // Download Site Logo Image.
192
- $response = Astra_Sites_Helper::download_file( $image_url );
193
194
- // Is Success?
195
- if ( $response['success'] ) {
196
197
- // Set attachment data.
198
- $attachment = array(
199
- 'post_mime_type' => $response['data']['type'],
200
- 'post_title' => sanitize_file_name( basename( $image_url ) ),
201
- 'post_content' => '',
202
- 'post_status' => 'inherit',
203
- );
204
205
- // Create the attachment.
206
- $attach_id = wp_insert_attachment( $attachment, $response['data']['file'] );
207
-
208
- set_theme_mod( 'custom_logo', $attach_id );
209
}
210
-
211
}
212
}
188
*/
189
private function insert_logo( $image_url = '' ) {
190
191
+ $data = Astra_Sites_Helper::_sideload_image( $image_url );
192
193
+ if ( ! is_wp_error( $data ) ) {
194
195
+ set_theme_mod( 'custom_logo', $data->attachment_id );
196
197
}
198
}
199
+
200
}
inc/importers/class-astra-sites-helper.php CHANGED
@@ -156,6 +156,81 @@ if ( ! class_exists( 'Astra_Sites_Helper' ) ) :
156
);
157
}
158
159
}
160
161
/**
156
);
157
}
158
159
+ /**
160
+ * Downloads an image from the specified URL.
161
+ *
162
+ * Taken from the core media_sideload_image() function and
163
+ * modified to return an array of data instead of html.
164
+ *
165
+ * @since 1.0.10
166
+ *
167
+ * @param string $file The image file path.
168
+ * @return array An array of image data.
169
+ */
170
+ static public function _sideload_image( $file ) {
171
+ $data = new stdClass();
172
+
173
+ if ( ! function_exists( 'media_handle_sideload' ) ) {
174
+ require_once( ABSPATH . 'wp-admin/includes/media.php' );
175
+ require_once( ABSPATH . 'wp-admin/includes/file.php' );
176
+ require_once( ABSPATH . 'wp-admin/includes/image.php' );
177
+ }
178
+
179
+ if ( ! empty( $file ) ) {
180
+
181
+ // Set variables for storage, fix file filename for query strings.
182
+ preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches );
183
+ $file_array = array();
184
+ $file_array['name'] = basename( $matches[0] );
185
+
186
+ // Download file to temp location.
187
+ $file_array['tmp_name'] = download_url( $file );
188
+
189
+ // If error storing temporarily, return the error.
190
+ if ( is_wp_error( $file_array['tmp_name'] ) ) {
191
+ return $file_array['tmp_name'];
192
+ }
193
+
194
+ // Do the validation and storage stuff.
195
+ $id = media_handle_sideload( $file_array, 0 );
196
+
197
+ // If error storing permanently, unlink.
198
+ if ( is_wp_error( $id ) ) {
199
+ unlink( $file_array['tmp_name'] );
200
+ return $id;
201
+ }
202
+
203
+ // Build the object to return.
204
+ $meta = wp_get_attachment_metadata( $id );
205
+ $data->attachment_id = $id;
206
+ $data->url = wp_get_attachment_url( $id );
207
+ $data->thumbnail_url = wp_get_attachment_thumb_url( $id );
208
+ $data->height = $meta['height'];
209
+ $data->width = $meta['width'];
210
+ }
211
+
212
+ return $data;
213
+ }
214
+
215
+ /**
216
+ * Checks to see whether a string is an image url or not.
217
+ *
218
+ * @since 1.0.10
219
+ *
220
+ * @param string $string The string to check.
221
+ * @return bool Whether the string is an image url or not.
222
+ */
223
+ static public function _is_image_url( $string = '' ) {
224
+ if ( is_string( $string ) ) {
225
+
226
+ if ( preg_match( '/\.(jpg|jpeg|png|gif)/i', $string ) ) {
227
+ return true;
228
+ }
229
+ }
230
+
231
+ return false;
232
+ }
233
+
234
}
235
236
/**
languages/astra-sites.pot CHANGED
@@ -2,9 +2,9 @@
2
# This file is distributed under the same license as the Astra Sites - Lite package.
3
msgid ""
4
msgstr ""
5
- "Project-Id-Version: Astra Sites - Lite 1.0.9\n"
6
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/astra-sites\n"
7
- "POT-Creation-Date: 2017-09-08 10:19: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"
2
# This file is distributed under the same license as the Astra Sites - Lite package.
3
msgid ""
4
msgstr ""
5
+ "Project-Id-Version: Astra Sites - Lite 1.0.10\n"
6
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/astra-sites\n"
7
+ "POT-Creation-Date: 2017-09-11 09:24:17+00:00\n"
8
"MIME-Version: 1.0\n"
9
"Content-Type: text/plain; charset=utf-8\n"
10
"Content-Transfer-Encoding: 8bit\n"
readme.txt CHANGED
@@ -1,14 +1,14 @@
1
- === Astra Free Sites ===
2
Contributors: brainstormforce
3
Donate link: https://wpastra.com/pro/
4
Tags: demo, theme demos, one click import
5
Requires at least: 4.4
6
Tested up to: 4.8.1
7
- Stable tag: 1.0.9
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
11
- Import Astra Free Sites with just one click.
12
13
== Description ==
14
@@ -46,6 +46,11 @@ https://sites.wpastra.com/law-free/
46
47
== Changelog ==
48
49
v1.0.9 - 8-Sept-2017
50
* New: Added page builder categories for listing sites as per page builder.
51
1
+ === Astra Sites - Lite ===
2
Contributors: brainstormforce
3
Donate link: https://wpastra.com/pro/
4
Tags: demo, theme demos, one click import
5
Requires at least: 4.4
6
Tested up to: 4.8.1
7
+ Stable tag: 1.0.10
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
11
+ Import Astra Sites - Lite with just one click.
12
13
== Description ==
14
46
47
== Changelog ==
48
49
+ v1.0.10 - 11-Sept-2017
50
+ * Improvement: Added support for retina logo import.
51
+ * Fix: Site logo image not displayed in customizer.
52
+ * Fix: Updated `Astra Agency` purchase link.
53
+
54
v1.0.9 - 8-Sept-2017
55
* New: Added page builder categories for listing sites as per page builder.
56