Version Description
- Created End User styles to allow for the front of the site to display SVG files properly.
Download this release
Release Info
Developer | sterlo |
Plugin | Scalable Vector Graphics (SVG) |
Version | 3.2 |
Comparing to | |
See all releases |
Code changes from version 3.1 to 3.2
- readme.txt +4 -0
- scalable-vector-graphics.php +15 -4
readme.txt
CHANGED
@@ -44,6 +44,10 @@ Resources for understanding security risks:
|
|
44 |
|
45 |
== Changelog ==
|
46 |
|
|
|
|
|
|
|
|
|
47 |
= 3.0 =
|
48 |
* Removed the sanitizer. This plugin isn't about security. It's about letting you use SVG files easily.
|
49 |
* Added more styling to improve Media Manager, including adjustments Grid View and Listing View
|
44 |
|
45 |
== Changelog ==
|
46 |
|
47 |
+
= 3.2 =
|
48 |
+
* Created End User styles to allow for the front of the site to display SVG files properly.
|
49 |
+
= 3.1 =
|
50 |
+
* Fix mime-type issues. Changed too much too quickly. BAD DEVELOPER.
|
51 |
= 3.0 =
|
52 |
* Removed the sanitizer. This plugin isn't about security. It's about letting you use SVG files easily.
|
53 |
* Added more styling to improve Media Manager, including adjustments Grid View and Listing View
|
scalable-vector-graphics.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Scalable Vector Graphics (SVG)
|
4 |
* Plugin URI: http://www.sterlinghamilton.com/projects/scalable-vector-graphics/
|
5 |
* Description: Scalable Vector Graphics are two-dimensional vector graphics, that can be both static and dynamic. This plugin allows your to easily use them on your site.
|
6 |
-
* Version: 3.
|
7 |
* Author: Sterling Hamilton
|
8 |
* Author URI: http://www.sterlinghamilton.com/
|
9 |
* License: GPLv2 or later
|
@@ -72,21 +72,32 @@ function adjust_response_for_svg( $response, $attachment, $meta ) {
|
|
72 |
// WordPress specifically defines width/height as "0" if it cannot figure it out.
|
73 |
// Thus the below is needed.
|
74 |
//
|
75 |
-
// Consider this the "client side" fix for dimensions.
|
76 |
//
|
77 |
// WordPress requires inline administration styles to be wrapped in an actionable function.
|
78 |
// These styles specifically address the Media Listing styling and Featured Image
|
79 |
// styling so that the images show up in the Administration area.
|
80 |
-
function
|
81 |
// Media Listing Fix
|
82 |
wp_add_inline_style( 'wp-admin', ".media .media-icon img[src$='.svg'] { width: auto; height: auto; }" );
|
83 |
// Featured Image Fix
|
84 |
wp_add_inline_style( 'wp-admin', "#postimagediv .inside img[src$='.svg'] { width: 100%; height: auto; }" );
|
85 |
}
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
// Do work son.
|
88 |
add_filter( 'upload_mimes', __NAMESPACE__ . '\\allow_svg_uploads' );
|
89 |
add_filter( 'wp_prepare_attachment_for_js', __NAMESPACE__ . '\\adjust_response_for_svg', 10, 3 );
|
90 |
-
add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\\
|
|
|
91 |
|
92 |
?>
|
3 |
* Plugin Name: Scalable Vector Graphics (SVG)
|
4 |
* Plugin URI: http://www.sterlinghamilton.com/projects/scalable-vector-graphics/
|
5 |
* Description: Scalable Vector Graphics are two-dimensional vector graphics, that can be both static and dynamic. This plugin allows your to easily use them on your site.
|
6 |
+
* Version: 3.2
|
7 |
* Author: Sterling Hamilton
|
8 |
* Author URI: http://www.sterlinghamilton.com/
|
9 |
* License: GPLv2 or later
|
72 |
// WordPress specifically defines width/height as "0" if it cannot figure it out.
|
73 |
// Thus the below is needed.
|
74 |
//
|
75 |
+
// Consider this the "client side" fix for dimensions. But only for the Administration.
|
76 |
//
|
77 |
// WordPress requires inline administration styles to be wrapped in an actionable function.
|
78 |
// These styles specifically address the Media Listing styling and Featured Image
|
79 |
// styling so that the images show up in the Administration area.
|
80 |
+
function administration_styles() {
|
81 |
// Media Listing Fix
|
82 |
wp_add_inline_style( 'wp-admin', ".media .media-icon img[src$='.svg'] { width: auto; height: auto; }" );
|
83 |
// Featured Image Fix
|
84 |
wp_add_inline_style( 'wp-admin', "#postimagediv .inside img[src$='.svg'] { width: 100%; height: auto; }" );
|
85 |
}
|
86 |
|
87 |
+
// Browsers may or may not show SVG files properly without a height/width.
|
88 |
+
// WordPress specifically defines width/height as "0" if it cannot figure it out.
|
89 |
+
// Thus the below is needed.
|
90 |
+
//
|
91 |
+
// Consider this the "client side" fix for dimensions. But only for the End User.
|
92 |
+
function public_styles() {
|
93 |
+
// Featured Image Fix
|
94 |
+
echo "<style>.post-thumbnail img[src$='.svg'] { width: 100%; height: auto; }</style>";
|
95 |
+
}
|
96 |
+
|
97 |
// Do work son.
|
98 |
add_filter( 'upload_mimes', __NAMESPACE__ . '\\allow_svg_uploads' );
|
99 |
add_filter( 'wp_prepare_attachment_for_js', __NAMESPACE__ . '\\adjust_response_for_svg', 10, 3 );
|
100 |
+
add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\\administration_styles' );
|
101 |
+
add_action( 'wp_head', __NAMESPACE__ . '\\public_styles' );
|
102 |
|
103 |
?>
|