Version Description
- Resolve fatal errors for people who have the core php libraries for xml uninstalled, or have invalid xml files.
Download this release
Release Info
Developer | sterlo |
Plugin | Scalable Vector Graphics (SVG) |
Version | 3.4 |
Comparing to | |
See all releases |
Code changes from version 3.3 to 3.4
- readme.txt +5 -3
- scalable-vector-graphics.php +20 -4
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Scalable Vector Graphics (SVG) ===
|
2 |
Contributors: sterlo
|
3 |
-
Donate link:
|
4 |
Tags: svg, scalable, vector, mime, type, image, graphic, file, upload, media
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 4.
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -14,7 +14,7 @@ SVG files are two-dimensional vector graphics, that can be both static and dynam
|
|
14 |
|
15 |
SVG files are two-dimensional vector graphics, that can be both static and dynamic. This plugin allows you to easily use them on your site.
|
16 |
|
17 |
-
The main project page is located here: [
|
18 |
|
19 |
Warning: Understanding that uploading any file to the system is a potential security risk, it is strongly recommended to only let trusted users to have upload privileges.
|
20 |
|
@@ -44,6 +44,8 @@ Resources for understanding security risks:
|
|
44 |
|
45 |
== Changelog ==
|
46 |
|
|
|
|
|
47 |
= 3.3 =
|
48 |
* Add a patch for core bug introduced in 4.7.1
|
49 |
= 3.2 =
|
1 |
=== Scalable Vector Graphics (SVG) ===
|
2 |
Contributors: sterlo
|
3 |
+
Donate link: https://sterlinghamilton.com/projects/scalable-vector-graphics/
|
4 |
Tags: svg, scalable, vector, mime, type, image, graphic, file, upload, media
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 4.8.1
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
14 |
|
15 |
SVG files are two-dimensional vector graphics, that can be both static and dynamic. This plugin allows you to easily use them on your site.
|
16 |
|
17 |
+
The main project page is located here: [https://sterlinghamilton.com/projects/scalable-vector-graphics/](https://sterlinghamilton.com/projects/scalable-vector-graphics/ "Scalable Vector Graphics (SVG) | Sterling Hamilton")
|
18 |
|
19 |
Warning: Understanding that uploading any file to the system is a potential security risk, it is strongly recommended to only let trusted users to have upload privileges.
|
20 |
|
44 |
|
45 |
== Changelog ==
|
46 |
|
47 |
+
= 3.4 =
|
48 |
+
* Resolve fatal errors for people who have the core php libraries for xml uninstalled, or have invalid xml files.
|
49 |
= 3.3 =
|
50 |
* Add a patch for core bug introduced in 4.7.1
|
51 |
= 3.2 =
|
scalable-vector-graphics.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
* Plugin Name: Scalable Vector Graphics (SVG)
|
4 |
-
* Plugin URI:
|
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:
|
9 |
* License: GPLv2 or later
|
10 |
|
11 |
* This program is free software; you can redistribute it and/or
|
@@ -39,8 +39,24 @@ function allow_svg_uploads( $existing_mime_types = array() ) {
|
|
39 |
// I believe this to be a reasonable dependency and should be common enough to
|
40 |
// not cause problems.
|
41 |
function get_dimensions( $svg ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
$svg = simplexml_load_file( $svg );
|
43 |
-
$attributes = $svg->attributes();
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
$width = (string) $attributes->width;
|
45 |
$height = (string) $attributes->height;
|
46 |
|
1 |
<?php
|
2 |
/*
|
3 |
* Plugin Name: Scalable Vector Graphics (SVG)
|
4 |
+
* Plugin URI: https://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.4
|
7 |
* Author: Sterling Hamilton
|
8 |
+
* Author URI: https://sterlinghamilton.com/
|
9 |
* License: GPLv2 or later
|
10 |
|
11 |
* This program is free software; you can redistribute it and/or
|
39 |
// I believe this to be a reasonable dependency and should be common enough to
|
40 |
// not cause problems.
|
41 |
function get_dimensions( $svg ) {
|
42 |
+
// Sometimes, for whatever reason, we still cannot get the attributes.
|
43 |
+
// If that happens, we will just go back to not knowing the dimensions,
|
44 |
+
// rather than breaking the site.
|
45 |
+
$fail = (object) array( 'width' => 0, 'height' => 0 );
|
46 |
+
|
47 |
+
// Welp, nothing we can do here...
|
48 |
+
if ( ! function_exists( 'simplexml_load_file' ) ) {
|
49 |
+
return $fail;
|
50 |
+
}
|
51 |
+
|
52 |
$svg = simplexml_load_file( $svg );
|
53 |
+
$attributes = $svg ? $svg->attributes() : false;
|
54 |
+
|
55 |
+
// Probably an invalid XML file?
|
56 |
+
if( ! $attributes ) {
|
57 |
+
return $fail;
|
58 |
+
}
|
59 |
+
|
60 |
$width = (string) $attributes->width;
|
61 |
$height = (string) $attributes->height;
|
62 |
|