• Resolved ain

    (@ain)


    The bug causes SlimBox to add rel attributes to all image tags that appear inside an anchor. By doing so it also breaks the standard/validation of the XHTML document by removing the trailing slash from the image and leaving it open.

    The problem: regex in the slimbox_create function is incorrect since it also returns a match for those anchors that don’t link to the image file, but have an image wrapped in it, e.g.
    <a href="..html"><img ... /></a>

    The fix is to match the closure of the anchor:

    function slimbox_create($content){
    	return preg_replace('/<a(.*?)href=(.*?).(jpg|jpeg|png|gif|bmp|ico)"([.^>]*?)>/i', '<a$1href=$2.$3" rel="lightbox[roadtrip]" $4>', $content);
    }

    https://www.ads-software.com/extend/plugins/slimbox-plugin/

  • The topic ‘[Plugin: Slimbox Plugin] Fix to the regex bug breaking XHTML validation’ is closed to new replies.