Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Agnes

    (@agneslesagegmailcom)

    The strange thing is I get this on some searches but not all…

    Thread Starter Agnes

    (@agneslesagegmailcom)

    I uinderstoofd then it has to do with what it finds in my results and how it transforms it.

    So I removed the reference to the tithe in the lines:

    // $pattern = "/<a href='(.*?).(jpg|jpeg|png|gif|bmp|ico|svg)' title='" . $attachment->post_title . "'><img(.*?)class=\"attachment-thumbnail\"(.*?)\/><\/a>/i";

    for

    $pattern = "/<a href='(.*?).(jpg|jpeg|png|gif|bmp|ico|svg)'><img(.*?)class=\"attachment-thumbnail\"(.*?)\/><\/a>/i";

    And also

    //$replace = '<a href="${1}.${2}" rel="prettyPhoto[post-' . $id . ']" title="' . $caption . '"><img${3}class="attachment-thumbnail"${4}/></a>';

    for

    $replace = '<a href="${1}.${2}" rel="prettyPhoto[post-' . $id . ']"><img${3}class="attachment-thumbnail"${4}/></a>';

    If someone knows better, I’d do!

    Plugin Author DefProc

    (@defproc)

    Hmmm… The most likely thing is the title content is breaking the regexes. Version 0.4 doesn’t use regexes to do the page parsing, so it might be more robust.

    If you send a copy of the page content that causes the error, I’ll take a look and see what’s causing the problem. You can email it to me at (contact [at] def-proc.co.uk) if you’d rather not post it publically here.

    Thread Starter Agnes

    (@agneslesagegmailcom)

    Hi DefProc,
    It was on a prod site here
    http://www.morija.co.ls/morija/?s=hat&post_type=objects
    (demo/demo)
    I have just restored the unmodified file of the plugin so you can seee the error. Please tell me what you think!
    Thanks,
    Agnes

    Thread Starter Agnes

    (@agneslesagegmailcom)

    When the error is on on the page above, the re is no excerpt for the 1st item “basotho hat”
    On my local version with a modified version of the plugin where I dont get the error, I get the excerpt and that is:

    Basotho Hat
    It is a beautiful hat that is made from various types of grasses. Basotho wore these ha…

    So it seems something in this text is causing the replace function to fail… Is it that the last word (“hat”) is cut?

    Plugin Author DefProc

    (@defproc)

    Yep, from a quick look, my best guess is that it’s the lack of the precision in the gallery regex. I can’t be sure without seeing the page content without add-rel-lightbox activated, to see if it has changed anything, but the gallery regex *shouldn’t* match for this page.

    I think that instead of matching:

    <a […]><img […]></a>

    it’s actually matching:

    <a […]></a>
    […]
    <img […]>
    […]
    <a […]></a>

    and because the extra content has some unescaped /s in it, it’s breaking the /(pattern)/i and adding a /c inside the pattern. This is an example of why regexes are bad for parsing HTML and why the plugin hasn’t reached version 1 yet.

    I’ve changed to DOM parsing in version 0.4, so the see if an upgrade sorts it out.

    Thread Starter Agnes

    (@agneslesagegmailcom)

    I can’t really follow you that far!
    But I’ll now revert the version with my above fix (and by the way that lets you see the page without that mistake)
    It is still here:
    http://www.morija.co.ls/morija/?s=hat&post_type=objects
    The stragne thing is, the same code for the “zoom” where the rel lightbox is used works also here:
    http://www.morija.co.ls/morija/museum/collections/
    I dont get why with the serach function (I guess because of highlighting the search terms) it does not sometimes… This is using Relevanssi by the way.
    Also, I am passing a number of HTML colde in the zoom link, may be then it gets wild…
    A1nyhow.. the fox does for me.
    Thanks!
    Agnes

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: add-rel-lightbox] Warning preg_replace’ is closed to new replies.