SVG Support - Version 2.3.5

Version Description

  • Revision and modification of the thumbnail display code.
Download this release

Release Info

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

Code changes from version 2.3.4 to 2.3.5

Files changed (3) hide show
  1. functions/thumbnail-display.php +25 -31
  2. readme.txt +10 -2
  3. svg-support.php +2 -2
functions/thumbnail-display.php CHANGED
@@ -9,48 +9,42 @@ if ( ! defined( 'ABSPATH' ) ) {
9
  add_action( 'admin_init', 'bodhi_svgs_display_thumbs' );
10
  function bodhi_svgs_display_thumbs() {
11
 
12
- ob_start();
13
 
14
- add_action( 'shutdown', 'bodhi_svgs_thumbs_filter', 0 );
15
- function bodhi_svgs_thumbs_filter() {
16
 
17
- $final = '';
18
- $ob_levels = count( ob_get_level() );
19
 
20
- for ( $i = 0; $i < $ob_levels; $i++ ) {
21
 
22
- $final .= ob_get_clean();
23
 
24
- }
 
25
 
26
- echo apply_filters( 'final_output', $final );
 
 
 
 
27
 
28
- }
29
-
30
- add_filter( 'final_output', 'bodhi_svgs_final_output' );
31
- function bodhi_svgs_final_output( $content ) {
32
-
33
- $content = str_replace(
34
- '<# } else if ( \'image\' === data.type && data.sizes && data.sizes.full ) { #>',
35
- '<# } else if ( \'svg+xml\' === data.subtype ) { #>
36
- <img class="details-image" src="{{ data.url }}" draggable="false" />
37
- <# } else if ( \'image\' === data.type && data.sizes && data.sizes.full ) { #>',
38
 
39
- $content
40
- );
 
 
 
 
 
41
 
42
- $content = str_replace(
43
- '<# } else if ( \'image\' === data.type && data.sizes ) { #>',
44
- '<# } else if ( \'svg+xml\' === data.subtype ) { #>
45
- <div class="centered">
46
- <img src="{{ data.url }}" class="thumbnail" draggable="false" />
47
- </div>
48
- <# } else if ( \'image\' === data.type && data.sizes ) { #>',
49
 
50
- $content
51
- );
52
 
53
- return $content;
54
 
55
  }
56
 
9
  add_action( 'admin_init', 'bodhi_svgs_display_thumbs' );
10
  function bodhi_svgs_display_thumbs() {
11
 
12
+ if ( bodhi_svgs_specific_pages_media_library() ) {
13
 
14
+ function bodhi_svgs_thumbs_filter( $content ) {
 
15
 
16
+ return apply_filters( 'final_output', $content );
 
17
 
18
+ }
19
 
20
+ ob_start( 'bodhi_svgs_thumbs_filter' );
21
 
22
+ add_filter( 'final_output', 'bodhi_svgs_final_output' );
23
+ function bodhi_svgs_final_output( $content ) {
24
 
25
+ $content = str_replace(
26
+ '<# } else if ( \'image\' === data.type && data.sizes && data.sizes.full ) { #>',
27
+ '<# } else if ( \'svg+xml\' === data.subtype ) { #>
28
+ <img class="details-image" src="{{ data.url }}" draggable="false" />
29
+ <# } else if ( \'image\' === data.type && data.sizes && data.sizes.full ) { #>',
30
 
31
+ $content
32
+ );
 
 
 
 
 
 
 
 
33
 
34
+ $content = str_replace(
35
+ '<# } else if ( \'image\' === data.type && data.sizes ) { #>',
36
+ '<# } else if ( \'svg+xml\' === data.subtype ) { #>
37
+ <div class="centered">
38
+ <img src="{{ data.url }}" class="thumbnail" draggable="false" />
39
+ </div>
40
+ <# } else if ( \'image\' === data.type && data.sizes ) { #>',
41
 
42
+ $content
43
+ );
 
 
 
 
 
44
 
45
+ return $content;
 
46
 
47
+ }
48
 
49
  }
50
 
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-39901
7
- Stable tag: 2.3.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -138,6 +138,10 @@ If you are using SVG Support with Visual Composer or any other page builders, yo
138
 
139
  == Changelog ==
140
 
 
 
 
 
141
  = 2.3.4 =
142
 
143
  * Fix: Fatal error for some because a function wasn't prefixed.
@@ -264,6 +268,10 @@ If you are using SVG Support with Visual Composer or any other page builders, yo
264
 
265
  == Upgrade Notice ==
266
 
 
 
 
 
267
  = 2.3.4 =
268
 
269
  * Fixes fatal error for some because a function wasn't prefixed.
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
 
139
  == Changelog ==
140
 
141
+ = 2.3.5 =
142
+
143
+ * Revision and modification of the thumbnail display code.
144
+
145
  = 2.3.4 =
146
 
147
  * Fix: Fatal error for some because a function wasn't prefixed.
268
 
269
  == Upgrade Notice ==
270
 
271
+ = 2.3.5 =
272
+
273
+ * Modifications to thumbnail display code to prevent output buffer clash with another plugin.
274
+
275
  = 2.3.4 =
276
 
277
  * Fixes fatal error for some because a function wasn't prefixed.
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.4
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.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
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
  /**
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