SVG Support - Version 2.3.13

Version Description

  • Fixed: PHP warnings and notices from the image widget when using SVG files and wp_debug was on.
  • Modified: Better front end CSS for displaying SVG attachments, both as images and inline.
  • Removed: DB entry for deprecated admin notice.
Download this release

Release Info

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

Code changes from version 2.3.12 to 2.3.13

admin/admin-notice.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  /**
3
  * Display admin notice to users who upgraded from less than 2.3
4
  * Allow for dismissal by storing an option in the DB via AJAX
1
  <?php
2
+ /***************************
3
+ * NOT ACTIVE SINCE 2.3.12 *
4
+ ***************************/
5
+
6
  /**
7
  * Display admin notice to users who upgraded from less than 2.3
8
  * Allow for dismissal by storing an option in the DB via AJAX
css/svgs-attachment.css CHANGED
@@ -1 +1 @@
1
- .attachment img[src$=".svg"]{width:100%}
1
+ .attachment img[src$=".svg"],.widget_media_image img[src$=".svg"]{width:100%}.attachment img[src$=".svg"],.widget_media_image img[src$=".svg"]{width:100%}.attachment svg,.widget_media_image svg{max-width:100%;height:auto}
functions/attachment-modal.php CHANGED
@@ -20,7 +20,7 @@ function bodhi_svgs_response_for_svg( $response, $attachment, $meta ) {
20
  $dimensions = bodhi_svgs_get_dimensions( $svg_path );
21
 
22
  $response[ 'sizes' ] = array(
23
- 'full' => array(
24
  'url' => $response[ 'url' ],
25
  'width' => $dimensions->width,
26
  'height' => $dimensions->height,
20
  $dimensions = bodhi_svgs_get_dimensions( $svg_path );
21
 
22
  $response[ 'sizes' ] = array(
23
+ 'custom' => array(
24
  'url' => $response[ 'url' ],
25
  'width' => $dimensions->width,
26
  'height' => $dimensions->height,
functions/enqueue.php CHANGED
@@ -40,14 +40,12 @@ function bodhi_svgs_admin_css() {
40
  add_action( 'admin_enqueue_scripts', 'bodhi_svgs_admin_css' );
41
 
42
  /**
43
- * Enqueue front end CSS for attachment pages
44
  */
45
  function bodhi_svgs_frontend_css() {
46
 
47
- // check if user is on attachment page
48
- if ( is_attachment() ) {
49
- wp_enqueue_style( 'bodhi-svgs-attachment', BODHI_SVGS_PLUGIN_URL . 'css/svgs-attachment.css' );
50
- }
51
 
52
  }
53
  add_action( 'wp_enqueue_scripts', 'bodhi_svgs_frontend_css' );
40
  add_action( 'admin_enqueue_scripts', 'bodhi_svgs_admin_css' );
41
 
42
  /**
43
+ * Enqueue front end CSS
44
  */
45
  function bodhi_svgs_frontend_css() {
46
 
47
+ // enqueue attachment CSS
48
+ wp_enqueue_style( 'bodhi-svgs-attachment', BODHI_SVGS_PLUGIN_URL . 'css/svgs-attachment.css' );
 
 
49
 
50
  }
51
  add_action( 'wp_enqueue_scripts', 'bodhi_svgs_frontend_css' );
readme.txt CHANGED
@@ -3,9 +3,9 @@ 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, animate, js
5
  Requires at least: 4.8
6
- Tested up to: 5.0-alpha-42984
7
  Requires PHP: 5.2
8
- Stable tag: 2.3.12
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -19,19 +19,20 @@ When using SVG images on your WordPress site, it can be hard to style elements w
19
  Scalable Vector Graphics (SVG) are becoming common place in modern web design, allowing you to embed images with small file sizes that are scalable to any visual size without loss of quality.
20
 
21
  This plugin not only provides SVG Support like the name says, it also allows you to easily embed your full SVG file's code using a simple IMG tag.<br />
22
- By adding the class `"style-svg"` to your IMG elements, this plugin dynamically replaces any IMG elements containing the `"style-svg"` class with your complete SVG.
23
 
24
- The main purpose of this is to allow styling of SVG elements. Usually your styling options are restricted when using `embed`, `object` or `img` tags alone.
25
 
26
  = Features =
27
  * SVG Support for your media library
28
  * Inline your SVG code
29
  * Works with the new Image Widget (WordPress 4.8+)
30
  * Style SVG elements directly using CSS
 
31
  * Super easy settings page with instructions
32
  * Restrict SVG upload ability to Administrators only
33
  * Set custom css target class
34
- * **Extremely Simple To Use**
35
 
36
 
37
  == Usage ==
@@ -44,7 +45,7 @@ As an administrator, you can go to the admin settings page 'Settings' > 'SVG Sup
44
 
45
  If you only need to upload SVG files to use as images, you don't need to enable "Advanced Mode”. Leaving it disabled ensures the frontend script is not enqueued and the unnecessary settings stay hidden.
46
 
47
- **For advanced users:** Enable the "Advanced Mode" under Settings > SVG Support.
48
 
49
  With advanced mode enabled, you can embed your SVG images just like you would a standard image with the addition of adding (in text view) the class `"style-svg"` (or the custom class you defined) to your IMG tags that you want this plugin to swap out with your actual SVG code.
50
 
@@ -79,7 +80,7 @@ As with allowing uploads of any files, there is potential risks involved. Only a
79
  == Feedback ==
80
 
81
  * I'm open to your [suggestions and feedback](mailto:wp@benbodhi.com) - Thanks for using SVG Support!
82
- * Tag me [@benbodhi](https://twitter.com/benbodhi) on Twitter
83
 
84
  *Note:* I hope you like this plugin! Please take a moment to rate it and click 'works' under compatibility with your version of WordPress.
85
 
@@ -92,7 +93,7 @@ New to Translating WordPress? Read through the [Translator Handbook](https://mak
92
 
93
  == Credits ==
94
 
95
- Plugin by [Benbodhi](https://benbodhi.com/) [@benbodhi](https://twitter.com/benbodhi) from [GoWebben](http://gowebben.com/) [@GoWebben](https://twitter.com/gowebben)
96
 
97
  Thanks to [ipokkel](https://wordpress.org/support/users/ipokkel/) for his suggestions and code contributions.
98
  Thanks to [laurosello](https://wordpress.org/support/users/laurosollero) for his code contribution.
@@ -134,16 +135,21 @@ You need to add the mime type for svg and svgz to: "MLA Settings > Media Library
134
  3. Featured Image checkbox to render SVG inline
135
  4. SVG used in WP native Image Widget (since 4.9)
136
  5. Inline SVG in the front end markup
137
- 61. Help tab - Overview
138
- 62. Help tab - The Settings
139
- 63. Help tab - Standard Usage
140
- 64. Help tab - Render SVG Inline (advanced usage)
141
- 65. Help tab - Featured Images
142
- 66. Help tab - Animation
143
 
144
 
145
  == Changelog ==
146
 
 
 
 
 
 
147
  = 2.3.12 =
148
  * New: Native "Help" tab on the SVG Support settings page.
149
  * New: Wrapped the inline JS in a function so you can call it at will using `bodhisvgsInlineSupport();`.
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, animate, js
5
  Requires at least: 4.8
6
+ Tested up to: 5.0-alpha-42985
7
  Requires PHP: 5.2
8
+ Stable tag: 2.3.13
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
19
  Scalable Vector Graphics (SVG) are becoming common place in modern web design, allowing you to embed images with small file sizes that are scalable to any visual size without loss of quality.
20
 
21
  This plugin not only provides SVG Support like the name says, it also allows you to easily embed your full SVG file's code using a simple IMG tag.<br />
22
+ By adding the class `"style-svg"` to your IMG elements, this plugin dynamically replaces any IMG elements containing the `"style-svg"` class with your complete SVG code, rendering it inline.
23
 
24
+ The main purpose of this is to allow styling and animation of your SVG elements. Usually your styling options are restricted when using `embed`, `object` or `img` tags alone.
25
 
26
  = Features =
27
  * SVG Support for your media library
28
  * Inline your SVG code
29
  * Works with the new Image Widget (WordPress 4.8+)
30
  * Style SVG elements directly using CSS
31
+ * Animate SVG elements using CSS and JS
32
  * Super easy settings page with instructions
33
  * Restrict SVG upload ability to Administrators only
34
  * Set custom css target class
35
+ * **Extremely Simple To Use - Simplifies complex usage of SVG files**
36
 
37
 
38
  == Usage ==
45
 
46
  If you only need to upload SVG files to use as images, you don't need to enable "Advanced Mode”. Leaving it disabled ensures the frontend script is not enqueued and the unnecessary settings stay hidden.
47
 
48
+ **For advanced use:** Enable the "Advanced Mode" under Settings > SVG Support.
49
 
50
  With advanced mode enabled, you can embed your SVG images just like you would a standard image with the addition of adding (in text view) the class `"style-svg"` (or the custom class you defined) to your IMG tags that you want this plugin to swap out with your actual SVG code.
51
 
80
  == Feedback ==
81
 
82
  * I'm open to your [suggestions and feedback](mailto:wp@benbodhi.com) - Thanks for using SVG Support!
83
+ * Tag me [@benbodhi](https://twitter.com/benbodhi) on Twitter #svgsupport
84
 
85
  *Note:* I hope you like this plugin! Please take a moment to rate it and click 'works' under compatibility with your version of WordPress.
86
 
93
 
94
  == Credits ==
95
 
96
+ Plugin by [Benbodhi](https://benbodhi.com/) [@benbodhi](https://twitter.com/benbodhi)
97
 
98
  Thanks to [ipokkel](https://wordpress.org/support/users/ipokkel/) for his suggestions and code contributions.
99
  Thanks to [laurosello](https://wordpress.org/support/users/laurosollero) for his code contribution.
135
  3. Featured Image checkbox to render SVG inline
136
  4. SVG used in WP native Image Widget (since 4.9)
137
  5. Inline SVG in the front end markup
138
+ 6. Help tab - Overview
139
+ 7. Help tab - The Settings
140
+ 8. Help tab - Standard Usage
141
+ 9. Help tab - Render SVG Inline (advanced usage)
142
+ 91. Help tab - Featured Images
143
+ 92. Help tab - Animation
144
 
145
 
146
  == Changelog ==
147
 
148
+ = 2.3.13 =
149
+ * Fixed: PHP warnings and notices from the image widget when using SVG files and wp_debug was on.
150
+ * Modified: Better front end CSS for displaying SVG attachments, both as images and inline.
151
+ * Removed: DB entry for deprecated admin notice.
152
+
153
  = 2.3.12 =
154
  * New: Native "Help" tab on the SVG Support settings page.
155
  * New: Wrapped the inline JS in a function so you can call it at will using `bodhisvgsInlineSupport();`.
scss/svgs-attachment.scss CHANGED
@@ -1,3 +1,17 @@
1
- .attachment img[src$=".svg"] {
 
2
  width: 100%;
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  }
1
+ .attachment img[src$=".svg"],
2
+ .widget_media_image img[src$=".svg"] {
3
  width: 100%;
4
+ }
5
+
6
+ .attachment,
7
+ .widget_media_image {
8
+
9
+ img[src$=".svg"] {
10
+ width: 100%;
11
+ }
12
+
13
+ svg {
14
+ max-width: 100%;
15
+ height: auto;
16
+ }
17
  }
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.3.12
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.12'; // 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
@@ -33,7 +33,6 @@ $bodhi_svgs_options = get_option('bodhi_svgs_settings'); // retrieve our plugi
33
  */
34
  include( BODHI_SVGS_PLUGIN_PATH . 'admin/admin-init.php' ); // initialize admin menu & settings page
35
  include( BODHI_SVGS_PLUGIN_PATH . 'admin/plugin-action-meta-links.php' ); // add links to the plugin on the plugins page
36
- // include( BODHI_SVGS_PLUGIN_PATH . 'admin/admin-notice.php' ); // dismissable admin notice to warn users to update settings
37
  include( BODHI_SVGS_PLUGIN_PATH . 'functions/mime-types.php' ); // setup mime types support for SVG (with fix for WP 4.7.1 - 4.7.2)
38
  include( BODHI_SVGS_PLUGIN_PATH . 'functions/thumbnail-display.php' ); // make SVG thumbnails display correctly in media library
39
  include( BODHI_SVGS_PLUGIN_PATH . 'functions/attachment-modal.php' ); // make SVG thumbnails display correctly in attachment modals
@@ -42,6 +41,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
  * Version based conditional / Check for stored plugin version
47
  *
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.3.13
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.13'; // 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
33
  */
34
  include( BODHI_SVGS_PLUGIN_PATH . 'admin/admin-init.php' ); // initialize admin menu & settings page
35
  include( BODHI_SVGS_PLUGIN_PATH . 'admin/plugin-action-meta-links.php' ); // add links to the plugin on the plugins page
 
36
  include( BODHI_SVGS_PLUGIN_PATH . 'functions/mime-types.php' ); // setup mime types support for SVG (with fix for WP 4.7.1 - 4.7.2)
37
  include( BODHI_SVGS_PLUGIN_PATH . 'functions/thumbnail-display.php' ); // make SVG thumbnails display correctly in media library
38
  include( BODHI_SVGS_PLUGIN_PATH . 'functions/attachment-modal.php' ); // make SVG thumbnails display correctly in attachment modals
41
  include( BODHI_SVGS_PLUGIN_PATH . 'functions/attribute-control.php' ); // auto set SVG class & remove dimensions during insertion
42
  include( BODHI_SVGS_PLUGIN_PATH . 'functions/featured-image.php' ); // allow inline SVG for featured images
43
 
44
+ // include( BODHI_SVGS_PLUGIN_PATH . 'admin/admin-notice.php' ); // dismissable admin notice to warn users to update settings
45
+ if ( ! empty( get_option( 'bodhi_svgs_admin_notice_dismissed' ) ) ) { // remove the old admin notice db entry
46
+ delete_option( 'bodhi_svgs_admin_notice_dismissed' );
47
+ }
48
+
49
  /**
50
  * Version based conditional / Check for stored plugin version
51
  *