Forums

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

  1. prometh
    Member
    Posted 2 months 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. prometh
    Member
    Posted 2 months 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. prometh
    Member
    Posted 2 months 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 1 month ago #

    Fixed in version 1.2. Thanks for the help.

Reply

You must log in to post.

About this Topic