Acronym Replacer 2.0 wraps common acronyms with the acronym tag and a description. It’s pretty simple, just edit the list of acronyms to add your own, and put it in your plugins directory.
For example:
AOL => America Online,
API => Application Programming Interface,
CD => Compact Disk,
and when you later use “AOL” it will become: <acronym title="America Online">AOL</acronym> (as you can clearly see [ ])
Note: This is a plugin for WordPress 1.2 and up. Get it here
Edit: May 12, 2004
Version 2.4 is now more aggressive at replacing acronyms. However, it no longer replaces acronyms inside of HTML tags, so it should be safe to create links with defined acronyms in the link or it’s title, without breaking anything, like this: The W3C Standards Organization.
As an additional feature, there is a line in the plugin (near the bottom) which, if uncommented, will allow you to stop acronyms from being replaced by surrounding them with dollar signs ($) which will be removed in processing. I’ve disabled that option myself, since it sems like extra work to me, but if you uncomment it, something like this: “$AOL$” would end up as just plain “AOL” but without the acronym tags.
Edit: June 30, 2004
I just released another version which optimizes things by not re-defining the list each time the plugin is invoked. This should save you a ton of lines of code as you define more acronyms. The new version also includes another fix: to allow acronyms to work on the first word.
Edit: May 5, 2006
Happy cinco de Mayo. I’ve released ubernyms now, so if you’re looking for the best acronym replacer around, that’s the one you want, not this one.
[...] /2004 Acronym Replacer 2.0 Filed under: WordPress Plugins | 7:39 pm {} This plugin wraps user defined acronyms with the acronym tag. [...]
[...] [...]
[...] [...]
[...] [...]
[...] [...]
[...] [...]
[...] [...]
[...] [...]
[...] [...]
Acronym Replacer and Markdown in WordPress
Acronym Replacer and Markdown wouldn’t work together in WordPress 1.2Beta. Now they do. Here’s why.
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?
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 …
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?
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
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.
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 [
]
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)
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.
Well elfin: you certainly have a knack for testing.
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.
Looks like it is fixed now!
thanks for the time and effort
Is this the plugin you are using to insert images instead of smiles? Like this one:
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?? ,
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…
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.)
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?
[poof] Fixed.
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
so it’s upped a version point.
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…
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.
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?
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.
yep, that was basically it. There were two spaces after the closing php tag. crazy. thanks
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?
Never mind, I just enabled case sensitivity. Teach me to post without reading the code.
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" 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.
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.
All of that to say that basically, that is the way I want it to behave [
]. 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.
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!
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.
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
<?phpor after the?>at the beginning and end of the pho file. Check it and remove any whitespaces before or after. Great Plugins Joel!try that again. “whitespace before the \< ?php or after the ?\>“
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?
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
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.
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.
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…
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
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 <acronym title="Hypertext PreProcessor">PHP</acronym> 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 <acronym title="Hypertext PreProcessor"><acronym title="Hypertext PreProcessor">PHP</acronym></acronym> 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.
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:
"|&lt;acronym[^&gt;]*&gt;&lt;acronym title="$description"&gt;$acronym&lt;/acronym&gt;&lt;/acronym&gt;|imsU",
"&lt;acronym title="$description"&gt;$acronym&lt;/acronym&gt;" , $text);
That should do it [
] , but I haven’t really tested it …
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…
Gestor de acronimos
Nuestro colega NIcolas Fantino nos deleita con un Gestor de Acronimos excelente. Hoy nace a la vida una nueva generacion…
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 …