SVG Support - Version 2.3.6

Version Description

  • New: Added polyfill to make svgs-inline.js work with older browsers.
  • New: Section to leave reviews on settings page.
  • Removed: Redundant one time upgrade activate code.
  • Fix: Errors reported on activation and on the settings page - Related Support Thread.
Download this release

Release Info

Developer Benbodhi
Plugin Icon 128x128 SVG Support
Version 2.3.6
Comparing to
See all releases

Code changes from version 2.3.5 to 2.3.6

admin/plugin-action-meta-links.php CHANGED
@@ -28,7 +28,7 @@ function bodhi_svgs_plugin_meta_links( $links, $file ) {
28
  return array_merge(
29
  $links,
30
  array(
31
- '<a target="_blank" href="http://wordpress.org/support/plugin/svg-support">' . __( 'Get Support', 'svg-support') . '</a>',
32
  '<a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z9R7JERS82EQQ">' . __( 'Donate to author', 'svg-support') . '</a>',
33
  '<a target="_blank" href="https://secure.gowebben.com/cart.php?promocode=SVGSUPPORT">' . __( '$25 Free Credit from GoWebben', 'svg-support') . '</a>'
34
  )
28
  return array_merge(
29
  $links,
30
  array(
31
+ '<a target="_blank" href="https://wordpress.org/support/plugin/svg-support">' . __( 'Get Support', 'svg-support') . '</a>',
32
  '<a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z9R7JERS82EQQ">' . __( 'Donate to author', 'svg-support') . '</a>',
33
  '<a target="_blank" href="https://secure.gowebben.com/cart.php?promocode=SVGSUPPORT">' . __( '$25 Free Credit from GoWebben', 'svg-support') . '</a>'
34
  )
admin/svgs-settings-page.php CHANGED
@@ -36,7 +36,6 @@
36
  <div class="inside">
37
 
38
  <form name="bodhi_svgs_settings_form" method="post" action="options.php">
39
- <!-- <input type="hidden" name="bodhi_svgs_settings_form_submitted" value="Y"> -->
40
 
41
  <?php settings_fields('bodhi_svgs_settings_group'); ?>
42
 
@@ -88,11 +87,12 @@
88
  </td>
89
  </tr>
90
  <tr valign="top" class="svgs-advanced">
 
91
  <th scope="row">
92
  <label for="bodhi_svgs_settings[css_target]"><strong><?php _e( 'CSS Class to target', 'svg-support' ); ?></strong></label>
93
  </th>
94
  <td>
95
- <input id="bodhi_svgs_settings[css_target]" class="all-options code" name="bodhi_svgs_settings[css_target]" type="text" value="<?php echo $bodhi_svgs_options['css_target']; ?>"><br><small class="description"><?php _e( 'The default target class is <code>style-svg</code>. You can change it to your own class such as <code>my-class</code> by typing it here.<br />Leave blank to use the default class.', 'svg-support' ); ?></small>
96
  </td>
97
  </tr>
98
 
@@ -157,6 +157,16 @@
157
 
158
  <div class="meta-box-sortables">
159
 
 
 
 
 
 
 
 
 
 
 
160
  <div class="postbox">
161
 
162
  <h3><span><?php _e( 'Plugin Features', 'svg-support' ); ?></span></h3>
36
  <div class="inside">
37
 
38
  <form name="bodhi_svgs_settings_form" method="post" action="options.php">
 
39
 
40
  <?php settings_fields('bodhi_svgs_settings_group'); ?>
41
 
87
  </td>
88
  </tr>
89
  <tr valign="top" class="svgs-advanced">
90
+ <!-- Custom CSS target field so users can set their own class to target -->
91
  <th scope="row">
92
  <label for="bodhi_svgs_settings[css_target]"><strong><?php _e( 'CSS Class to target', 'svg-support' ); ?></strong></label>
93
  </th>
94
  <td>
95
+ <input id="bodhi_svgs_settings[css_target]" class="all-options code" name="bodhi_svgs_settings[css_target]" type="text" value="<?php if( isset( $bodhi_svgs_options['css_target'] ) ) echo $bodhi_svgs_options['css_target']; ?>"><br /><small class="description"><?php _e( 'The default target class is <code>style-svg</code>. You can change it to your own class such as <code>my-class</code> by typing it here.<br />Leave blank to use the default class.', 'svg-support' ); ?></small>
96
  </td>
97
  </tr>
98
 
157
 
158
  <div class="meta-box-sortables">
159
 
160
+ <div class="postbox">
161
+
162
+ <h3><span><?php _e( 'Ratings & Reviews', 'svg-support' ); ?></span></h3>
163
+ <div class="inside">
164
+ <p><?php _e( 'If you like <strong>SVG Support</strong> please consider leaving a', 'svg-support' ); ?> <a href="https://wordpress.org/support/view/plugin-reviews/svg-support?filter=5#postform" target="_blank" class="svgs-rating-link">&#9733;&#9733;&#9733;&#9733;&#9733;</a> <?php _e( 'rating.', 'svg-support' ); ?><br><?php _e( 'A huge thanks in advance!', 'svg-support' ); ?></p>
165
+ <p><a href="https://wordpress.org/support/view/plugin-reviews/svg-support?filter=5#postform" target="_blank" class="button-primary">Leave a rating</a></p>
166
+ </div> <!-- .inside -->
167
+
168
+ </div> <!-- .postbox -->
169
+
170
  <div class="postbox">
171
 
172
  <h3><span><?php _e( 'Plugin Features', 'svg-support' ); ?></span></h3>
js/min/svgs-inline-min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function($){var e="img."!==cssTarget?cssTarget:"img.style-svg";$(e).each(function(e){var t=jQuery(this),r=t.attr("id"),a=t.attr("class"),d=t.attr("src");d.endsWith("svg")&&$.get(d,function(d){var s=$(d).find("svg"),i=s.attr("id");"undefined"==typeof r?"undefined"==typeof i?(r="svg-replaced-"+e,s=s.attr("id",r)):r=i:s=s.attr("id",r),"undefined"!=typeof a&&(s=s.attr("class",a+" replaced-svg svg-replaced-"+e)),s=s.removeAttr("xmlns:a"),t.replaceWith(s),$(document).trigger("svg.loaded",[r])},"xml")})});
1
+ jQuery(document).ready(function($){String.prototype.endsWith||(String.prototype.endsWith=function(t,e){var r=this.toString();("number"!=typeof e||!isFinite(e)||Math.floor(e)!==e||e>r.length)&&(e=r.length),e-=t.length;var n=r.lastIndexOf(t,e);return n!==-1&&n===e});var t="img."!==cssTarget?cssTarget:"img.style-svg";$(t).each(function(t){var e=jQuery(this),r=e.attr("id"),n=e.attr("class"),i=e.attr("src");i.endsWith("svg")&&$.get(i,function(i){var a=$(i).find("svg"),s=a.attr("id");"undefined"==typeof r?"undefined"==typeof s?(r="svg-replaced-"+t,a=a.attr("id",r)):r=s:a=a.attr("id",r),"undefined"!=typeof n&&(a=a.attr("class",n+" replaced-svg svg-replaced-"+t)),a=a.removeAttr("xmlns:a"),e.replaceWith(a),$(document).trigger("svg.loaded",[r])},"xml")})});
js/svgs-inline.js CHANGED
@@ -1,5 +1,19 @@
1
  jQuery(document).ready(function ($) {
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  // Check to see if user set alternate class
4
  var target = ( cssTarget !== 'img.' ? cssTarget : 'img.style-svg' );
5
 
1
  jQuery(document).ready(function ($) {
2
 
3
+ // Polyfill to support all ye old browsers
4
+ // delete when not needed in the future
5
+ if (!String.prototype.endsWith) {
6
+ String.prototype.endsWith = function(searchString, position) {
7
+ var subjectString = this.toString();
8
+ if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
9
+ position = subjectString.length;
10
+ }
11
+ position -= searchString.length;
12
+ var lastIndex = subjectString.lastIndexOf(searchString, position);
13
+ return lastIndex !== -1 && lastIndex === position;
14
+ };
15
+ } // end polyfill
16
+
17
  // Check to see if user set alternate class
18
  var target = ( cssTarget !== 'img.' ? cssTarget : 'img.style-svg' );
19
 
one-time-upgrade-activate.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- /**
3
- * One time function to make sure new "Advanced Mode" setting is activated
4
- */
5
- if ( ! defined( 'ABSPATH' ) ) {
6
- exit; // Exit if accessed directly
7
- }
8
- /**
9
- * Update plugin settings on activate/update
10
- */
11
- function bodhi_svgs_plugin_update() {
12
-
13
- $new_option = array( 'advanced_mode' => 'on' );
14
- $existing_settings = get_option( 'bodhi_svgs_settings' );
15
- $new_settings = array_merge( $new_option, $existing_settings );
16
-
17
- update_option( 'bodhi_svgs_settings', $new_settings );
18
-
19
- }
20
- register_activation_hook( BODHI_SVGS_PLUGIN_PATH . 'svg-support.php', 'bodhi_svgs_plugin_update' );
21
- add_action( 'upgrader_process_complete', 'bodhi_svgs_plugin_update', 10, 2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Benbodhi
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z9R7JERS82EQQ
4
  Tags: svg, vector, css, style, mime, mime type, embed, img, inline, animation
5
  Requires at least: 4.0
6
- Tested up to: 4.8-alpha-39923
7
- Stable tag: 2.3.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -138,6 +138,13 @@ If you are using SVG Support with Visual Composer or any other page builders, yo
138
 
139
  == Changelog ==
140
 
 
 
 
 
 
 
 
141
  = 2.3.5 =
142
 
143
  * Revision and modification of the thumbnail display code.
@@ -180,11 +187,11 @@ If you are using SVG Support with Visual Composer or any other page builders, yo
180
 
181
  * FIX: Added function to temporarily fix an issue with uploading in WP 4.7.1
182
 
183
- = 2.2.3.2 =
184
 
185
  * Changed text domain to match plugin slug for localization.
186
 
187
- = 2.2.3.1 =
188
 
189
  * Attempt to fix ability to translate
190
 
@@ -268,6 +275,10 @@ If you are using SVG Support with Visual Composer or any other page builders, yo
268
 
269
  == Upgrade Notice ==
270
 
 
 
 
 
271
  = 2.3.5 =
272
 
273
  * Modifications to thumbnail display code to prevent output buffer clash with another plugin.
@@ -300,11 +311,11 @@ IMPORTANT, MAJOR CHANGES, BACKUP BEFORE UPDATING: Users that are inlining SVG wi
300
 
301
  * IMPORTANT: Fixes upload ability in WP 4.7.1
302
 
303
- = 2.2.3.2 =
304
 
305
  * Changed text domain to match plugin slug for localization.
306
 
307
- = 2.2.3.1 =
308
 
309
  * This release attempts to fix translation issues.
310
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z9R7JERS82EQQ
4
  Tags: svg, vector, css, style, mime, mime type, embed, img, inline, animation
5
  Requires at least: 4.0
6
+ Tested up to: 4.8-alpha-39948
7
+ Stable tag: 2.3.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
138
 
139
  == Changelog ==
140
 
141
+ = 2.3.6 =
142
+
143
+ * New: Added polyfill to make svgs-inline.js work with older browsers.
144
+ * New: Section to leave reviews on settings page.
145
+ * Removed: Redundant one time upgrade activate code.
146
+ * Fix: Errors reported on activation and on the settings page - [Related Support Thread](https://wordpress.org/support/topic/error-on-plugin-settings-page/).
147
+
148
  = 2.3.5 =
149
 
150
  * Revision and modification of the thumbnail display code.
187
 
188
  * FIX: Added function to temporarily fix an issue with uploading in WP 4.7.1
189
 
190
+ = 2.2.32 =
191
 
192
  * Changed text domain to match plugin slug for localization.
193
 
194
+ = 2.2.31 =
195
 
196
  * Attempt to fix ability to translate
197
 
275
 
276
  == Upgrade Notice ==
277
 
278
+ = 2.3.6 =
279
+
280
+ * Adds support for older browsers, fixes a couple of seemingly isolated errors reported, removes some redundant code.
281
+
282
  = 2.3.5 =
283
 
284
  * Modifications to thumbnail display code to prevent output buffer clash with another plugin.
311
 
312
  * IMPORTANT: Fixes upload ability in WP 4.7.1
313
 
314
+ = 2.2.32 =
315
 
316
  * Changed text domain to match plugin slug for localization.
317
 
318
+ = 2.2.31 =
319
 
320
  * This release attempts to fix translation issues.
321
 
scss/.sass-cache/19f648ba9a479ff856a119e87d48b4db48146d8c/svgs-admin-simple-mode.scssc DELETED
Binary file
scss/.sass-cache/19f648ba9a479ff856a119e87d48b4db48146d8c/svgs-admin.scssc DELETED
Binary file
scss/.sass-cache/19f648ba9a479ff856a119e87d48b4db48146d8c/svgs-attachment.scssc DELETED
Binary file
svg-support.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: SVG Support
4
  Plugin URI: http://wordpress.org/plugins/svg-support/
5
  Description: Allow SVG file uploads using the WordPress Media Library uploader plus the ability to inline SVG files for direct targeting of SVG elements for CSS and JS.
6
- Version: 2.3.5
7
  Author: Benbodhi
8
  Author URI: http://benbodhi.com
9
  Text Domain: svg-support
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
22
  /**
23
  * Global variables
24
  */
25
- $svgs_plugin_version = '2.3.5'; // for use on admin pages
26
  $plugin_file = plugin_basename(__FILE__); // plugin file for reference
27
  define( 'BODHI_SVGS_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); // define the absolute plugin path for includes
28
  define( 'BODHI_SVGS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); // define the plugin url for use in enqueue
@@ -42,27 +42,11 @@ include( BODHI_SVGS_PLUGIN_PATH . 'functions/localization.php' ); // setup loc
42
  include( BODHI_SVGS_PLUGIN_PATH . 'functions/attribute-control.php' ); // auto set SVG class & remove dimensions during insertion
43
  include( BODHI_SVGS_PLUGIN_PATH . 'functions/featured-image.php' ); // allow inline SVG for featured images
44
 
45
- /**
46
- * TEMP FIX FOR 4.7.1
47
- * Issue should be fixed in 4.7.2 in which case this will be deleted.
48
- */
49
- function bodhi_svgs_disable_real_mime_check( $data, $file, $filename, $mimes ) {
50
- $wp_filetype = wp_check_filetype( $filename, $mimes );
51
-
52
- $ext = $wp_filetype['ext'];
53
- $type = $wp_filetype['type'];
54
- $proper_filename = $data['proper_filename'];
55
-
56
- return compact( 'ext', 'type', 'proper_filename' );
57
- }
58
- add_filter( 'wp_check_filetype_and_ext', 'bodhi_svgs_disable_real_mime_check', 10, 4 );
59
-
60
  /**
61
  * Version based conditional / Check for stored plugin version
62
  *
63
  * Versions prior to 2.3 did not store the version number,
64
- * these older versions need to have the "Advanced Mode" switched on to retain inline functionality if upgrading to 2.3 or higher.
65
- * If no version number is stored, load the one-time-upgrade-activate.php file and store current plugin version number.
66
  * If there is a version number stored, update it with the new version number.
67
  */
68
  // get the stored plugin version
@@ -70,9 +54,6 @@ $svgs_plugin_version_stored = get_option( 'bodhi_svgs_plugin_version' );
70
  // only run this if there is no stored version number (have never stored the number in previous versions)
71
  if ( empty( $svgs_plugin_version_stored ) ) {
72
 
73
- // include the one time script to activate the new "Advanced Mode" setting
74
- include( BODHI_SVGS_PLUGIN_PATH . 'one-time-upgrade-activate.php');
75
-
76
  // add plugin version number to options table
77
  update_option( 'bodhi_svgs_plugin_version', $svgs_plugin_version );
78
 
@@ -81,4 +62,19 @@ if ( empty( $svgs_plugin_version_stored ) ) {
81
  // update plugin version number in options table
82
  update_option( 'bodhi_svgs_plugin_version', $svgs_plugin_version );
83
 
84
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  Plugin Name: SVG Support
4
  Plugin URI: http://wordpress.org/plugins/svg-support/
5
  Description: Allow SVG file uploads using the WordPress Media Library uploader plus the ability to inline SVG files for direct targeting of SVG elements for CSS and JS.
6
+ Version: 2.3.6
7
  Author: Benbodhi
8
  Author URI: http://benbodhi.com
9
  Text Domain: svg-support
22
  /**
23
  * Global variables
24
  */
25
+ $svgs_plugin_version = '2.3.6'; // for use on admin pages
26
  $plugin_file = plugin_basename(__FILE__); // plugin file for reference
27
  define( 'BODHI_SVGS_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); // define the absolute plugin path for includes
28
  define( 'BODHI_SVGS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); // define the plugin url for use in enqueue
42
  include( BODHI_SVGS_PLUGIN_PATH . 'functions/attribute-control.php' ); // auto set SVG class & remove dimensions during insertion
43
  include( BODHI_SVGS_PLUGIN_PATH . 'functions/featured-image.php' ); // allow inline SVG for featured images
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  /**
46
  * Version based conditional / Check for stored plugin version
47
  *
48
  * Versions prior to 2.3 did not store the version number,
49
+ * If no version number is stored, store current plugin version number.
 
50
  * If there is a version number stored, update it with the new version number.
51
  */
52
  // get the stored plugin version
54
  // only run this if there is no stored version number (have never stored the number in previous versions)
55
  if ( empty( $svgs_plugin_version_stored ) ) {
56
 
 
 
 
57
  // add plugin version number to options table
58
  update_option( 'bodhi_svgs_plugin_version', $svgs_plugin_version );
59
 
62
  // update plugin version number in options table
63
  update_option( 'bodhi_svgs_plugin_version', $svgs_plugin_version );
64
 
65
+ }
66
+
67
+ /**
68
+ * TEMP FIX FOR 4.7.1
69
+ * Issue should be fixed in 4.7.2 in which case this will be deleted.
70
+ */
71
+ function bodhi_svgs_disable_real_mime_check( $data, $file, $filename, $mimes ) {
72
+ $wp_filetype = wp_check_filetype( $filename, $mimes );
73
+
74
+ $ext = $wp_filetype['ext'];
75
+ $type = $wp_filetype['type'];
76
+ $proper_filename = $data['proper_filename'];
77
+
78
+ return compact( 'ext', 'type', 'proper_filename' );
79
+ }
80
+ add_filter( 'wp_check_filetype_and_ext', 'bodhi_svgs_disable_real_mime_check', 10, 4 );