Forums

[resolved] [Plugin: Auto XFN-ify] Doesn't work if link has an ID (4 posts)

  1. Steven Vachon
    Blocked
    Posted 2 years ago #

    link

    The above will not work because the id conflicts with the regex pattern search.

    http://wordpress.org/extend/plugins/auto-xfn-ify/

  2. Steven Vachon
    Blocked
    Posted 2 years ago #

    Replace this:

    $linkPattern = "/(<\s?a\shref\s?=[\s\"\'])($blogroll\/?)([\s\"\']{1,3})([^>]+)?(>)([^<]+)(<\/a>)/i";

    with this:

    $linkPattern = "/(<\s*?a\b[^>]*?\bhref\s*?=[\s\"\'])($blogroll\/?)([\s\"\']{1,3})([^>]+)?(>)([^<]+)(<\/a>)/i";

    and it'll work

  3. Steven Vachon
    Blocked
    Posted 2 years ago #

    By the way, the problem wasn't outlined properly in my first post because I'd forgotten to place the code within WordPress' backticks.

    Basically, the problem was that if you had any attributes—like an id—the regex pattern would not match.

    So, this would work:

    <a href="asdf.html" id="something">link</a>

    …but this would not:

    <a id="something" href="asdf.html">link</a>

  4. DavidMeade
    Member
    Posted 2 years ago #

    Fixed in version 1.2. Thanks for the help.

Topic Closed

This topic has been closed to new replies.

About this Topic