Support » Plugins » [Plugin: Acronyms] Fix for Acronym plugin breaking BBCode

  • The Acronyms plugin is smart enough not to replace acronyms inside of HTML tags, but when I noticed that the plugin broke [caption] code in my posts, I discovered that it will replace acronyms inside of BBCode tags, thus breaking them. All that is needed to fix this is a slight modification of the regular expression it uses.

    If you replace the fourth line of the acronyms_replace function (line 377) with the following code, everything should work fine.
    $text = preg_replace( "|(?!<[^<>]*?)(?!\[[^\[\]]*?)(?<![?.&])\b$acronym\b(?!:)(?![^\[\]]*?\])(?![^<>]*?>)|msU", "<acronym title=\"$fulltext\">$acronym</acronym>" , $text );

    Hope that helps anyone who’s been having trouble with this plugin!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Spadija,

    You’re a magician!! I say that because anyone that can understand and write regex statements such as the one above certainly deserves more than medal.

    All jokes aside… I do use the Acronym plugin on a couple of my sites and although I have not noticed any issues I am keen to incorporate your fix “just in case”.

    Before I do so… I am curious whether the plugin author has any plans to include this fix in a future/upcoming version? As I would prefer to “upgrade” than to fiddle with the “code”.

    Thanks again and hopefully we will hear some further feedback,

    R

    Hey, both of you:

    I’m afraid I’m no longer using WordPress, and therefore no longer developing plugins or maintaining my existing WP plugins. The source code is all out there, of course, and you’re welcome to pick up the code and go with it. It’s open source, after all.

    Thanks for your continued interest in the plugin!

    Ketsugi,

    Sorry to see you leave the WP camp. Your contribution to WP through your plugin has been tremendous and much appreciated by those of us that use it.

    Personally I don’t have the PHP skills to take on the task of taking on the plugin so I’m hoping that someone else out there will it in their hearts to continue your excellent work.

    Good luck with all your future endeavours.

    R

    Hey guys,

    Ummm.

    I decided that I’ll devote some of my spare time to at least try to maintain the Acronyms plugin. I’ll be doing most of my development and testing on a fresh install of the latest WordPress since I no longer have an active working WP blog install, so please let me know if anything I release breaks another plugin or conflicts with something else.

    Anyway 1.6.2 has been released with Spadija’s regex correction.

    Could someone confirm that it’s working? I’ve tried it and it still seems to replace acronyms inside of BBcode.

    Onya Ketsugi!

    Will test the latest version when it appears on WP. I’m probably not in a position to test the bbCode thing as it’s not something I use.

    Thanks for continuing to support your plugin.

    Appreciated!!

    R

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Acronyms] Fix for Acronym plugin breaking BBCode’ is closed to new replies.