Skip to content

Commit

Permalink
Add content filter to avoid issues with dynamic page loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
arnowelzel committed Jan 14, 2024
1 parent ae49cdd commit a4e7781
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 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.2
Version: 5.1.3
Author: Arno Welzel
Author URI: http://arnowelzel.de
Text Domain: lightbox-photoswipe
Expand Down
6 changes: 5 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.3
Stable tag: 5.1.2
Stable tag: 5.1.3
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,10 @@ If you change any of the stylesheets or frontend scripts in `src/js` or `src/lib

== Changelog ==

= 5.1.3 =

* Additional handling of post content to avoid issues with dynamic page loading.

= 5.1.2 =

* Updated handling of EXIF data shutter speed for fractional values with more than 1s.
Expand Down
8 changes: 7 additions & 1 deletion 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.2';
const VERSION = '5.1.3';
const SLUG = 'lightbox-photoswipe';
const META_VERSION = '14';
const CACHE_EXPIRE_IMG_DETAILS = 86400;
Expand Down Expand Up @@ -60,6 +60,7 @@ public function __construct($pluginFile)
add_action('wp_enqueue_scripts', [$this, 'enqueueScripts']);
add_action('wp_footer', [$this, 'outputFooter']);
add_action('wp_head', [$this, 'bufferStart'], 2050);
add_filter('the_content', [$this, 'filterOutput']);
if ($this->optionsManager->getOption('separate_galleries')) {
remove_shortcode('gallery');
add_shortcode('gallery', [$this, 'shortcodeGallery'], 10, 1);
Expand Down Expand Up @@ -285,6 +286,11 @@ public function callbackProperties(array $matches)
{
global $wpdb;

// Avoid double replacement
if (strpos($matches[4], 'data-lbwps-width="') !== false) {
return $matches[1].$matches[2].$matches[3].$matches[4].$matches[5];
}

$use = true;
$attr = '';
$url = $matches[2];
Expand Down

0 comments on commit a4e7781

Please sign in to comment.