Skip to content

Commit

Permalink
Fix missing support for SVG in some cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
arnowelzel committed Jan 17, 2024
1 parent d79f1c4 commit 9fc9050
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lightbox-photoswipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Lightbox with PhotoSwipe
Plugin URI: https://wordpress.org/plugins/lightbox-photoswipe/
Description: Lightbox with PhotoSwipe
Version: 5.1.5
Version: 5.1.6
Author: Arno Welzel
Author URI: http://arnowelzel.de
Text Domain: lightbox-photoswipe
Expand Down
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Contributors: awelzel
Tags: attachments, images, gallery, lightbox, fancybox, photoswipe
Requires at least: 5.3
Tested up to: 6.4
Stable tag: 5.1.5
Stable tag: 5.1.6
Donate link: https://paypal.me/ArnoWelzel
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -219,6 +219,11 @@ If you change any of the stylesheets or frontend scripts in `src/js` or `src/lib

== Changelog ==

= 5.1.6 =

* Make sure, that displaying SVG images in the lightbox is supported even if WordPress does not report it as allowed
file type for upload (for example when not logged in as administrator).

= 5.1.5 =

* Fixed handling of tabindex attribute in image links with Bricks image slider: if image links contain a tabindex
Expand Down
8 changes: 6 additions & 2 deletions src/LightboxPhotoSwipe/LightboxPhotoSwipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class LightboxPhotoSwipe
{
const VERSION = '5.1.5';
const VERSION = '5.1.6';
const SLUG = 'lightbox-photoswipe';
const META_VERSION = '14';
const CACHE_EXPIRE_IMG_DETAILS = 86400;
Expand Down Expand Up @@ -316,7 +316,11 @@ public function callbackProperties(array $matches)
$file = $this->getHomeUrl() . $file;
}

$type = wp_check_filetype($file);
$mimeTypes = get_allowed_mime_types();
if (!in_array('svg', $mimeTypes)) {
$mimeTypes['svg'] = 'image/svg+xml';
}
$type = wp_check_filetype($file, $mimeTypes);
$extension = strtolower($type['ext']);
$captionCaption = '';
$captionDescription = '';
Expand Down

0 comments on commit 9fc9050

Please sign in to comment.