• Resolved Brandon Olivares

    (@cocreation)


    I just tried out the plugin.

    However, for keywords where there was already a link around them, it created yet another link.

    My link was like this:

    <a href="..."><em>Title</em></a>

    And it does this:

    <a href="..."><em><a class="aalmanual" target="_blank" rel="nofollow" href="...">Title</a></em></a>

    I figured it would already check to make sure it wasn’t already linked?

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

    (@cocreation)

    I’ve tracked this down to the regular expression used.

    Line 148 of aal_engine.php

    $reg = '/(?!(?:[^<\[]+[>\]]|[^>\]]+<\/a>|[^>\]]+<\/h.>|[^>\]]+<\/script*>))\b($name)\b/ims'. $langsupport .'U';

    It needs to also search for any closing tag prior to the </a> tag, and I think this would help. Here’s my modification, which has worked for me:

    $reg = '/(?!(?:[^<\[]+[>\]]|[^>]+<\/[^>]+><\/a>|[^>\]]+<\/a>|[^>\]]+<\/h.>|[^>\]]+<\/script*>))\b($name)\b/ims'. $langsupport .'U';

    Also, I’m not sure the purpose of the $reg_post variable. It isn’t used anywhere else in the code as far as I can tell.

    This is on the latest version, 5.3.2.3.

    Edit: I think it could be simplified like this:

    $reg = '/(?!(?:[^<\[]+[>\]]|[^>\]]+(?:<\/[^>]+>)?<\/a>|[^>\]]+<\/h.>|[^>\]]+<\/script*>))\b($name)\b/ims'. $langsupport .'U';

    Plugin Author Lucian Apostol

    (@thedark)

    Hello.

    Thank you for the support and help. I will test your code on my test sites and if it is working as expected I will update it.

    Many thanks for the help.

    Plugin Author Lucian Apostol

    (@thedark)

    Hello.

    Thank you for the help you’be give. I added your code into the plugin and I think it should work right now.

    Thread Starter Brandon Olivares

    (@cocreation)

    Thanks so much.

    Something else I noticed, not sure if you already fixed this or not, but if I have a link like:

    <a href="https://example.com/"><em>Book Title</em> by [author]</a>

    If the Book Title is one of my auto-links, then it’ll double link it as well. Hope that makes sense.

    Plugin Author Lucian Apostol

    (@thedark)

    Please update to the latest version and see if it is working well right now.

    Thread Starter Brandon Olivares

    (@cocreation)

    Just did, and you can see the results here.

    It still double links it.

    Plugin Author Lucian Apostol

    (@thedark)

    Hello.

    I’ve used the code you provided. Will check to see if I can make this work right.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Creates Link Even Though Keyword Is Inside Link’ is closed to new replies.