Wrong regex for “search for image links”
-
Hi
This regex is incorrect:
preg_match_all( '/<a(.*?)href=(?:\'|")([^<]*?)\.(bmp|gif|jpeg|jpg|png|webp)(?:\'|")(.*?)>/is', $content, $links );
(https://plugins.trac.wordpress.org/browser/responsive-lightbox/tags/2.0.5/includes/class-frontend.php#L94)
Because it does not mark the links correctly, which in an extreme case leads to creating a gallery for a regular link.This regex should look like:
preg_match_all( '/<a([^<]*?)href=(?:\'|")([^<]*?)\.(bmp|gif|jpeg|jpg|png|webp)(?:\'|")(.*?)>/is', $content, $links );
I hope you update your plugin.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Wrong regex for “search for image links”’ is closed to new replies.