SVG Support - Version 2.4.1

Version Description

  • Fixed issue causing WP-CLI to break.
Download this release

Release Info

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

Code changes from version 2.4 to 2.4.1

Files changed (3) hide show
  1. functions/attachment.php +4 -13
  2. readme.txt +6 -1
  3. svg-support.php +8 -7
functions/attachment.php CHANGED
@@ -156,6 +156,9 @@ function bodhi_svgs_sanitize( $file ){
156
 
157
  global $sanitizer;
158
 
 
 
 
159
  $dirty = file_get_contents( $file );
160
 
161
  // try to decode if gzipped is enabled
@@ -238,18 +241,6 @@ function bodhi_svgs_sanitize_svg( $file ){
238
  // sanizite svg if user has enabled option
239
  add_filter( 'wp_handle_upload_prefilter', 'bodhi_svgs_sanitize_svg' );
240
 
241
- // add filters to allow developers to create their own whitelist xml attributes and tags for sanitization
242
- function bodhi_svgs_apply_filters(){
243
-
244
- global $sanitizer;
245
-
246
- $sanitizer->setAllowedTags( new bodhi_svg_tags() );
247
- $sanitizer->setAllowedAttrs( new bodhi_svg_attributes() );
248
-
249
- }
250
-
251
- add_action('after_setup_theme', 'bodhi_svgs_apply_filters');
252
-
253
  // Fix image widget PHP warnings
254
  function bodhi_svgs_get_attachment_metadata( $data ) {
255
 
@@ -310,4 +301,4 @@ function bodhi_svgs_dimension_fallback( $image, $attachment_id, $size, $icon ){
310
 
311
  }
312
 
313
- add_filter( 'wp_get_attachment_image_src', 'bodhi_svgs_dimension_fallback', 10, 4 );
156
 
157
  global $sanitizer;
158
 
159
+ $sanitizer->setAllowedTags( new bodhi_svg_tags() );
160
+ $sanitizer->setAllowedAttrs( new bodhi_svg_attributes() );
161
+
162
  $dirty = file_get_contents( $file );
163
 
164
  // try to decode if gzipped is enabled
241
  // sanizite svg if user has enabled option
242
  add_filter( 'wp_handle_upload_prefilter', 'bodhi_svgs_sanitize_svg' );
243
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  // Fix image widget PHP warnings
245
  function bodhi_svgs_get_attachment_metadata( $data ) {
246
 
301
 
302
  }
303
 
304
+ add_filter( 'wp_get_attachment_image_src', 'bodhi_svgs_dimension_fallback', 10, 4 );
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: svg, vector, safesvg, safe svg, sanitization, sanitisation, sanitizer, san
5
  Requires at least: 4.8
6
  Tested up to: 6.0
7
  Requires PHP: 5.3
8
- Stable tag: 2.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -160,6 +160,8 @@ You need to add the mime type for svg and svgz to: "MLA Settings > Media Library
160
 
161
 
162
  == Changelog ==
 
 
163
 
164
  = 2.4 =
165
  * NEW FEATURE: Added optional SVG sanitization.
@@ -361,6 +363,9 @@ You need to add the mime type for svg and svgz to: "MLA Settings > Media Library
361
 
362
  == Upgrade Notice ==
363
 
 
 
 
364
  = 2.4 =
365
  Now featuring optional SVG sanitization and ability to target nested SVGs! This update contains a lot, please BACKUP YOUR DATABASE AND FILES BEFORE UPDATING!
366
 
5
  Requires at least: 4.8
6
  Tested up to: 6.0
7
  Requires PHP: 5.3
8
+ Stable tag: 2.4.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
160
 
161
 
162
  == Changelog ==
163
+ = 2.4.1 =
164
+ * Fixed issue causing WP-CLI to break.
165
 
166
  = 2.4 =
167
  * NEW FEATURE: Added optional SVG sanitization.
363
 
364
  == Upgrade Notice ==
365
 
366
+ = 2.4.1 =
367
+ 2.4.1 fixes broken WP-CLI. Now featuring optional SVG sanitization and ability to target nested SVGs! This update contains a lot, please BACKUP YOUR DATABASE AND FILES BEFORE UPDATING!
368
+
369
  = 2.4 =
370
  Now featuring optional SVG sanitization and ability to target nested SVGs! This update contains a lot, please BACKUP YOUR DATABASE AND FILES BEFORE UPDATING!
371
 
svg-support.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: SVG Support
4
  Plugin URI: http://wordpress.org/plugins/svg-support/
5
  Description: Upload SVG files to the Media Library and render SVG files inline for direct styling/animation of an SVG's internal elements using CSS/JS.
6
- Version: 2.4
7
  Author: Benbodhi
8
  Author URI: https://benbodhi.com
9
  Text Domain: svg-support
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
22
  /**
23
  * Global variables
24
  */
25
- $svgs_plugin_version = '2.4'; // 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
@@ -32,6 +32,11 @@ $bodhi_svgs_options = get_option('bodhi_svgs_settings'); // retrieve our plugi
32
  * SVG Sanitizer class
33
  */
34
  include( BODHI_SVGS_PLUGIN_PATH . 'vendor/autoload.php' ); // svg sanitizer
 
 
 
 
 
35
  use enshrined\svgSanitize\Sanitizer; // init svg sanitizer for usage
36
  $sanitizer = new Sanitizer(); // initialize if enabled
37
 
@@ -48,10 +53,6 @@ include( BODHI_SVGS_PLUGIN_PATH . 'functions/localization.php' ); // setup loc
48
  include( BODHI_SVGS_PLUGIN_PATH . 'functions/attribute-control.php' ); // auto set SVG class & remove dimensions during insertion
49
  include( BODHI_SVGS_PLUGIN_PATH . 'functions/featured-image.php' ); // allow inline SVG for featured images
50
 
51
- // interfaces to enable custom whitelisting of svg tags and attributes
52
- include( BODHI_SVGS_PLUGIN_PATH . 'includes/svg-tags.php' );
53
- include( BODHI_SVGS_PLUGIN_PATH . 'includes/svg-attributes.php' );
54
-
55
  /**
56
  * Version based conditional / Check for stored plugin version
57
  *
@@ -72,4 +73,4 @@ if ( empty( $svgs_plugin_version_stored ) ) {
72
  // update plugin version number in options table
73
  update_option( 'bodhi_svgs_plugin_version', $svgs_plugin_version );
74
 
75
- }
3
  Plugin Name: SVG Support
4
  Plugin URI: http://wordpress.org/plugins/svg-support/
5
  Description: Upload SVG files to the Media Library and render SVG files inline for direct styling/animation of an SVG's internal elements using CSS/JS.
6
+ Version: 2.4.1
7
  Author: Benbodhi
8
  Author URI: https://benbodhi.com
9
  Text Domain: svg-support
22
  /**
23
  * Global variables
24
  */
25
+ $svgs_plugin_version = '2.4.1'; // 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
32
  * SVG Sanitizer class
33
  */
34
  include( BODHI_SVGS_PLUGIN_PATH . 'vendor/autoload.php' ); // svg sanitizer
35
+
36
+ // interfaces to enable custom whitelisting of svg tags and attributes
37
+ include( BODHI_SVGS_PLUGIN_PATH . 'includes/svg-tags.php' );
38
+ include( BODHI_SVGS_PLUGIN_PATH . 'includes/svg-attributes.php' );
39
+
40
  use enshrined\svgSanitize\Sanitizer; // init svg sanitizer for usage
41
  $sanitizer = new Sanitizer(); // initialize if enabled
42
 
53
  include( BODHI_SVGS_PLUGIN_PATH . 'functions/attribute-control.php' ); // auto set SVG class & remove dimensions during insertion
54
  include( BODHI_SVGS_PLUGIN_PATH . 'functions/featured-image.php' ); // allow inline SVG for featured images
55
 
 
 
 
 
56
  /**
57
  * Version based conditional / Check for stored plugin version
58
  *
73
  // update plugin version number in options table
74
  update_option( 'bodhi_svgs_plugin_version', $svgs_plugin_version );
75
 
76
+ }