Astra Starter Sites - Version 1.1.5

Version Description

Download this release

Release Info

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

Code changes from version 1.1.4 to 1.1.5

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.1.4
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.1.4' );
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.1.5
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.1.5' );
23
}
24
25
if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
inc/importers/class-astra-sites-helper.php CHANGED
@@ -44,6 +44,72 @@ if ( ! class_exists( 'Astra_Sites_Helper' ) ) :
44
*/
45
public function __construct() {
46
add_filter( 'wie_import_data', array( $this, 'custom_menu_widget' ) );
47
}
48
49
/**
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
/**
inc/importers/wxr-importer/class-astra-wxr-importer.php CHANGED
@@ -134,14 +134,20 @@ class Astra_WXR_Importer {
134
/**
135
* Add .xml files as supported format in the uploader.
136
*
137
* @param array $mimes Already supported mime types.
138
*/
139
public function custom_upload_mimes( $mimes ) {
140
- $mimes = array_merge(
141
- $mimes, array(
142
- 'xml' => 'application/xml',
143
- )
144
- );
145
146
return $mimes;
147
}
134
/**
135
* Add .xml files as supported format in the uploader.
136
*
137
+ * @since 1.1.5 Added SVG file support.
138
+ *
139
+ * @since 1.0.0
140
+ *
141
* @param array $mimes Already supported mime types.
142
*/
143
public function custom_upload_mimes( $mimes ) {
144
+
145
+ // Allow SVG files.
146
+ $mimes['svg'] = 'image/svg+xml';
147
+ $mimes['svgz'] = 'image/svg+xml';
148
+
149
+ // Allow XML files.
150
+ $mimes['xml'] = 'application/xml';
151
152
return $mimes;
153
}
languages/astra-sites.pot CHANGED
@@ -1,14 +1,14 @@
1
- # Copyright (C) 2017 Brainstorm Force
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.1.4\n"
6
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/astra-sites\n"
7
- "POT-Creation-Date: 2017-12-28 08:58: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"
11
- "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
12
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
"Language-Team: LANGUAGE <LL@li.org>\n"
14
"Language: en\n"
@@ -338,7 +338,7 @@ msgstr ""
338
msgid "No Title"
339
msgstr ""
340
341
- #: inc/importers/wxr-importer/class-astra-wxr-importer.php:177
342
msgid "Import complete!"
343
msgstr ""
344
1
+ # Copyright (C) 2018 Brainstorm Force
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.1.5\n"
6
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/astra-sites\n"
7
+ "POT-Creation-Date: 2018-01-11 06:38:47+00:00\n"
8
"MIME-Version: 1.0\n"
9
"Content-Type: text/plain; charset=utf-8\n"
10
"Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
12
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
"Language-Team: LANGUAGE <LL@li.org>\n"
14
"Language: en\n"
338
msgid "No Title"
339
msgstr ""
340
341
+ #: inc/importers/wxr-importer/class-astra-wxr-importer.php:183
342
msgid "Import complete!"
343
msgstr ""
344
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.9.1
7
- Stable tag: 1.1.4
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -56,6 +56,9 @@ https://wpastra.com/sites-suggestions/
56
57
== Changelog ==
58
59
v1.1.4 - 28-Dec-2017
60
* Improvement: Importing WooCommerce product category images.
61
* Improvement: Retain WooCommerce cart, checkout & my account pages when importing the ready WooCommerce sites.
4
Tags: demo, theme demos, one click import
5
Requires at least: 4.4
6
Tested up to: 4.9.1
7
+ Stable tag: 1.1.5
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
56
57
== Changelog ==
58
59
+ v1.1.5 - 11-January-2018
60
+ * New: Added SVG file support for importing the SVG images.
61
+
62
v1.1.4 - 28-Dec-2017
63
* Improvement: Importing WooCommerce product category images.
64
* Improvement: Retain WooCommerce cart, checkout & my account pages when importing the ready WooCommerce sites.