116 responses to “WordPress Plugin – Acronym Replacer”

  1. Blogging Pro - Blog News, Tools and Hacks » Acronym Replacer 2.0

    [...] /2004 Acronym Replacer 2.0 Filed under: WordPress Plugins | 7:39 pm {} This plugin wraps user defined acronyms with the acronym tag. [...]

  2. A Proletarium Blog   ›  Plugins para Wordpress

    [...] [...]

  3. mizzenblog » MovableType vs WordPress

    [...] [...]

  4. Organic Church » Acronyms

    [...] [...]

  5. hugophonic.com » Whoa - Page is Green!

    [...] [...]

  6. Organic Church » Acronyms

    [...] [...]

  7. Urban Design » URI Replacer

    [...] [...]

  8. Ups and Downs: Musings on Mood and other Miscellaneous Meanderings  Hidden Characters in Safari’s Copy-and-Paste Caused Site Errors

    [...] [...]

  9. Blog de Jaime Olmo: Print & Web Design » Acronym Replacer 2.0

    [...] [...]

  10. taking the red pill

    Acronym Replacer and Markdown in WordPress
    Acronym Replacer and Markdown wouldn’t work together in WordPress 1.2Beta. Now they do. Here’s why.

  11. elfin

    There is a bug in the script, or at least i think there is.

    I am still developing my WordPress, and it isn’t live yet but am currently testing offline.

    It appears that all instances of an abbr/acronym are being replaced even when they are within the ‘title’ attribute of a link.
    Is this a bug?

  12. Joel "Jaykul" Bennett

    Hmm. You’re right elfin. Honestly, I don’t think it’s that big of a deal (I usually avoid acronyms in html attributes anyway).

    However, I can see how it could be a problem, so I’ll try to see if I can tweak the regular expression to make it avoid those. It’s kind-of tricky, honestly, because it involves checking a LOT of extra text to be able to tell for SURE if we were in an attribute or not … which means the plugin will be a bit slower …

  13. elfin

    agreed, but maybe add a comment at the top of the script to warn people.
    I also had fun creating css buttons…
    Would a character infront of any that you don’t want to be processed be any use? Or would this still slow the script down?

  14. sastian

    the moment i activate this plugin, my page beaks with the following error…

    Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘)’ in /home/sastian/public_html/blog/wp-content/plugins/acronym.php on line 36

  15. David

    There is a problem with acronym, when the word is between parentesis i.e., (AOL) or between —, like —AOL—, perhaps even “AOL” (haven’t tested that one) it will not work.

  16. Joel "Jaykul" Bennett

    Sastian: Not sure what to say about that. Line 36 is supposed to be the first element in the array, so the only thing that occurs to me is the possibility that you edited it to add an item, and forgot the comma.

    David: That’s a good point … the regex was a fairly conservative one, I have rewritten it to be less-so. The reason for it being conservative is that I had real problems with acronym tags showing up on the extensions and protocols in URL’s [ ;) ] so I added those two cases as exceptions in the new regex.

    NOTE: I’ve left a couple of other versions of the regex in there, including one which is the same as the new one, but case sensitive!

    elfin: I’ve also added an extra replacement call, which allows you to undo the acronym if it was surrounded by dollar signs (of course it removes the dollar signs). Here’s an example: $AOL$ won’t be wrapped in acronym tags, replaced, but $AOL will be, and so will AOL$ ) Of course, you can change the character, but watch out for that, I can imagine it causing problems [ :p ]

  17. elfin

    XHTML is not parsed and this $XHTML$ doesn’t work.
    yes I am using version 2.4 with the relevant lines uncommentated.

    so a little further testing revelaed the following strange result:
    ok that didna??t work, how about an AOL XHTML CSS ?

    $XHTML$ CSS $CSS$

    CSS

    (if these don’t show properly here check my website)

  18. elfin

    apolgies, things weren’t working correctly, then they were..in part.

    enclosing with $ don’t appear to affect things, have I missed something ? and yes I doubled checked that the line was uncommented.

  19. Joel "Jaykul" Bennett

    Well elfin: you certainly have a knack for testing. [annoyed]
    The parentheses in the deffinition of an acronym cause problems with the regular expression that removes them. I’ve removed them from the deffinitions I listed by default, and added a note to that effect at the top.

  20. elfin

    :-)

    Looks like it is fixed now!

    thanks for the time and effort

  21. Johan Svedberg

    Is this the plugin you are using to insert images instead of smiles? Like this one: :-)

  22. Glenn WIens

    For some reason, all I get, using IE6 browser, when I hover over your example above (copied below) is a pointer with a question mark. Is there something wrong with my browser?

    For example:

    a??AOLa?? => a??America Onlinea?? ,
    a??APIa?? => a??Application Programming Interfacea?? ,
    a??CDa?? => a??Compact Diska?? ,

  23. Joel "Jaykul" Bennett

    Well Glenn, I think if you hover longer … you’ll see the pop up tooltip … otherwise, your tooltips must be disabled, either in IE, or globally in windows…

  24. waylman

    BTW, nice plugin, but I think I found another little bug. If an acronym is the very first thing in the post (or comment) it doesn’t work. (Yes I know BTW was not in the default list, but I did add it to mine, as I tend to use it alot.)

  25. waylman

    HTML
    Oh, I should add that simply adding a space before the first letter (as done here) solves the problem, but who’s gonna remember to do that?

  26. Joel "Jaykul" Bennett

    [poof] Fixed. :-D

    I actually put in an optimization while I was at it, to avoid redefining the acronym list every time the plugin is invoked. Can’t believe I didn’t think of that before [blush] so it’s upped a version point.

  27. mizzenblog

    MovableType vs WordPress
    Where has my inspiration gone? I’ve wanted to blog all day but I haven’t been able to think of anything to write about… until this comment, anyway :-)

    OK, for the sake of those who are wondering about the difference between MovableType and Word…

  28. Bill Rawlinson

    I just installed the acrynym plugin and notice an error that occurs in my wordpress admin (on the “links | manage links “) page.

    I have No links defined

    I get the following two errors:

    Warning: Cannot modify header information – headers already sent by (output started at /home/rawlinso/public_html/blog/wp-content/plugins/acronyms.php:149) in /home/rawlinso/public_html/blog/wp-admin/link-manager.php on line 563

    Warning: Cannot modify header information – headers already sent by (output started at /home/rawlinso/public_html/blog/wp-content/plugins/acronyms.php:149) in /home/rawlinso/public_html/blog/wp-admin/link-manager.php on line 564

    I quickly clicked through the rest of the WP admin screens and didn’t get the error to occur anywhere else. If I deactive the acronym plugin the errors go away.

  29. Bill Rawlinson

    sorry to double post – but those errors actually cause a small problem in that the rendering of the page when you add a link or delete a link is also messed up – those same two errors occur, but then no real content is drawn on the page. other than a link to the WP support forums. Maybe the ideal solution would to have this not even execute if your in the wp-admin pages?

  30. Joel "Jaykul" Bennett

    Sounds like you have an extra line in the php file. I.e.: white space, at the top or bottom of the file, that doesn’t belong there, and is being processed as plain html, and thus, sending a character or more of output.

  31. Bill Rawlinson

    yep, that was basically it. There were two spaces after the closing php tag. crazy. thanks

  32. David J. Weller-Fahy

    I’m using version 2.6, and noticed that it’s replacing lowercase acronyms in the href attribute of tags. Is this intentional? If so, how would I go about disabling that function?

  33. David J. Weller-Fahy

    Never mind, I just enabled case sensitivity. Teach me to post without reading the code. :(

  34. hugo

    Hi, Great Plugin. I am seeing a behavior I was wondering if you could address.
    Comment on my site
    with this code in it.
    <a href="http://MySQL.com&#34; title="MySQL Homepage">MySQL</a>
    It will show the acronym info for the MySQL and hide the title info in the href tag. I don’t know if this is the way you want it to behave or not.
    Also, any way that I could easily add support for “.” characters, for including acronym info country domain names for example. I don’t know REGEX. Thanks.

  35. Joel "Jaykul" Bennett

    For starters, quite frankly “MySQL” isn’t an acronym. It’s syntactically incorrect to put that in your acronym list. In fact, technically, even “SQL” isn’t an acronym, because the dictionary says an acronym is when you form a WORD by combining initial letters or parts of a series of words… So, “SQL” is technically just an abbreviation. Of course, since the <abbr> tag doesn’t really work in IE, most people just use acronym instead, but anyway. I’m off topic.

    If you make a link with NOTHING in it but an acronym, then yes, the acronym’s title is going to hide the link’s title, because it’s inner-most, and most browsers are smart enough to figure that it’s most important.

    • Personally, I think the title attribute on links is practically always unnecessary: it should be clear from the context (and from the URL, which appears in my status-bar) what the link is for, so a title is just redundant information which your reader’s will most likely not see.
    • Aside from my personal feelings about the link’s title tag, I’m also against the practice of one word links, in general, unless that one word is the name of a product, person or company. If that’s the case, then having the link’s title hidden by the acronyms title is almost certainly not a problem [ ;) ]

    All of that to say that basically, that is the way I want it to behave [ :P ]. See, for example, the link to the W3C in my article above: the W3C acronym title shows over “W3C” but not over the whole link…

    As far as country codes in URL’s … yes, you can do that, just delete the “.” from the first regex on line 132,

    That will work, but it will have the side effect of also making most of your file extensions into acronyms as well (like somepage.html or some image.gif).

    Lastly … I should probably figure out how to make the acronym plugin take effect when you write the article, instead of when it’s rendered, that would reduce the ammount of work drastically, without any major side-effects, I think.

  36. hugo

    thanks joel. Indeed I am not using the plugin only for acronyms. Just thought I would stretch it out a little bit. Making it take effect during writing would be great. I found one of the situations that was originally my concern. The masking of the link title isn’t really a problem. The problem link would be to WinSCP at sourceforge title would be “WinSCP at Sourceforge” and text “WinSCP”. causes a problem on my setup. Goes in the title tag and puts an acronym tag inside. it’s on my site on the post you commented on. I’m kind of limited figuring out how to type it exactly here. thanks for your help!

  37. Dave Winter

    Hi Joel, this looks like a great plugin! However, when I activated it (like I noticed someone else has had) I get the following error:

    Parse error: parse error, unexpected T_STRING in /home/blah/public_html/wp-content/plugins/acronyms-plugin.php on line 33

    I literally just copied it direct from your source file to my host. Didn’t change or modify anything :(

    But as soon as I activate it, it brings that error up on my blog.

  38. hugo

    Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/jaykul/joelbennett.net/wordpress/wp-content/plugins/geshi/geshi.php on line 1885

    Warning: Invalid argument supplied for foreach() in /home/jaykul/joelbennett.net/wordpress/wp-content/plugins/geshi/geshi.php on line 1885

    Warning: Invalid argument supplied for foreach() in /home/jaykul/joelbennett.net/wordpress/wp-content/plugins/geshi/geshi.php on line 2238

    Warning: Invalid argument supplied for foreach() in /home/jaykul/joelbennett.net/wordpress/wp-content/plugins/geshi/geshi.php on line 3187

    Warning: implode() [function.implode]: Argument must be an array in /home/jaykul/joelbennett.net/wordpress/wp-content/plugins/geshi/geshi.php on line 3239

    Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/jaykul/joelbennett.net/wordpress/wp-content/plugins/geshi/geshi.php on line 3270

    Warning: Invalid argument supplied for foreach() in /home/jaykul/joelbennett.net/wordpress/wp-content/plugins/geshi/geshi.php on line 3270

    Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/jaykul/joelbennett.net/wordpress/wp-content/plugins/geshi/geshi.php on line 3313

    Warning: Invalid argument supplied for foreach() in /home/jaykul/joelbennett.net/wordpress/wp-content/plugins/geshi/geshi.php on line 3313

    Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/jaykul/joelbennett.net/wordpress/wp-content/plugins/geshi/geshi.php on line 3458

    Warning: Invalid argument supplied for foreach() in /home/jaykul/joelbennett.net/wordpress/wp-content/plugins/geshi/geshi.php on line 3458

    Dave,
    I think the error you are having is very common with the current downloading mechanism on the blogs today. You probably have a whitespace before the <?php or after the ?> at the beginning and end of the pho file. Check it and remove any whitespaces before or after. Great Plugins Joel!

  39. hugo

    try that again. “whitespace before the \< ?php or after the ?\>“

  40. Dave Winter

    I checked that.

    There’s no white space before the <?php

    And there’s no white space after the ?>

    I asked someone on #wordpress if they could send me their plugin – and it worked fine. So it has to be a problem with me copying it from the source page.

    The other thing that occurred to me, is that maybe I wasn’t using Unix line breaks in BBEdit, but I checked and I was.

    I’m also using the Unicode character encoding.

    Still – neither of these things can be causing the problem. Can they?

    Joel, can you please post the plugin compressed in a zip file or something so that I can test it?

  41. Dave Winter

    Some guys on IRC helped me find the problem I was having, you can read about it here as it may come in handy for some others:

    http://www.forbiddenbyte.co.uk/archives/2004/08/22/gremlins-of-safari/

    However, the plugin is working fine, sort of – but I now get this error when either posting or deleting an entry:

    Warning: Cannot modify header information – headers already sent by (output started at /home/dave/public_html/wp-content/plugins/acronym.php:1) in /home/dave/public_html/wp-admin/post.php on line 474

    Not to sure what is wrong with that :(

  42. Joel "Jaykul" Bennett

    That’s weird… when posting!? I honestly don’t know how it could interfere in the admin panel.

    I’m working on a modification to the ‘view source’ file I’m using to let people download plugins easily.

  43. teli

    I get the same error:
    Warning: Cannot modify header information – headers already sent by (output started at /home/nailet/public_html/wp-content/plugins/text-replace.php:94) in /home/nailet/public_html/wp-admin/post.php on line 340

    If I disable acronyms, my post page works just fine.

    I also notice that my acronyms breaks my links when I use acronyms in the title. I copied the php code directly from the page here and pasted it into Dreamweaver and saved as acronyms.php. The acronyms work, but unfortunately, it causes the error in my post screen and template edit screen and it breaks in HTML title tags :( .

    If there’s a fix out there, I would surely like to use it, but for now I have to keep it deactivated.

  44. Rippleweb

    Acronym Plugin for ExpressionEngine
    When I was a MT and WordPress user, I grew quite fond of an "acronym plugin" that was available for those systems. The acronym plugin would highlight certain acronyms, like AOL, and put a little dotted underline beneath each acronym and prov…

  45. James

    I’m getting the same error, infact I can’t even get in to the admin area because of it (on my offline site, win xp based).

    Warning: Cannot add header information – headers already sent by (output started at w:\www\lostdays.info\wp-content\plugins\acronyms.php:150) in w:\www\lostdays.info\wp-admin\index.php on line 13

  46. Meitar

    I love the plugin. But I have a question: in my posts, I’ve already been properly tagging acronyms with the acronym tag. That means my source code for a post looks like

    One day it was raining, but using &lt;acronym title="Hypertext PreProcessor"&gt;PHP&lt;/acronym&gt; is great so I had a great day.

    rather than just having the letters PHP right in the middle there. The problem is that now that I’ve installed the acronym plugin, all of those old posts that have acronyms in them with acronym tags around them are now double-tagged! In other words, WordPress is outputting

    One day it was raining, but using &lt;acronym title="Hypertext PreProcessor"&gt;&lt;acronym title="Hypertext PreProcessor"&gt;PHP&lt;/acronym&gt;&lt;/acronym&gt; is great so I had a great day.

    which is a slight nuisance, though it doesn’t invalidate my page any and looks identical in visual browsers.

    I’m not a PHP expert, but I feel comfortable enough hacking the plugin to fix this for my own site, but was wondering if there was an easier way, perhaps through a more sophisticated regex I could use? If there’s a one-two-button-your-shoe fix to this, I’d really appreciate being let in on the secret.

    In either case, great plugin, and thanks for writing it. :)

  47. Joel "Jaykul" Bennett

    Well, yeah, should be possible… If you look in the code, you’ll see I cheat a little and use two regular expressions… The second regex is a ‘fix’ regex which removes acronym tags from within other tags. That is: the initial regex is too agressive so I fix it by checking for acronyms inside angle brackets. Anyway, you could fix your situation in a similar way with a third line:

    $text = preg_replace(
        "|&amp;lt;acronym[^&amp;gt;]*&amp;gt;&amp;lt;acronym title="$description"&amp;gt;$acronym&amp;lt;/acronym&amp;gt;&amp;lt;/acronym&amp;gt;|imsU",
        "&amp;lt;acronym title="$description"&amp;gt;$acronym&amp;lt;/acronym&amp;gt;" , $text);

    That should do it [ :) ] , but I haven’t really tested it …

  48. Nicolas Fantino (ala_747) - 100px Diseno Web

    Remplazador de Acronimos (la nueva generacion)
    Luego de darle muchas (muchas) vueltas al tema de los permalinks (planteado por Manu en su momento) he quedado trabado y no se hacia donde seguir. Por eso, decidi ponerme con otra cosa.

    Hoy nace a la vida una nueva generacion de plugins para acronim…

  49. Word Press en espanol

    Gestor de acronimos
    Nuestro colega NIcolas Fantino nos deleita con un Gestor de Acronimos excelente. Hoy nace a la vida una nueva generacion…

  50. xeophin

    Thanks for the Plugin, it works great – except for one thing: if it finds a string that’s listed in the plugin code in front of a German umlaut, it will wrap it into the <acronym>-Tags, even if it’s inside a word. Check out my blog, you’ll find plenty of examples over there. Maybe you know a quick fix for that, or can point me into the right direction to fix it.
    Thanks …

1 2 3