Well, someone was asking in the WordPress IRC channel, and it seemed like a simple mod of my acronym replacer … and the rest is source code.
This plugin basically lets you create a list of text that you always want to have linked. So for instance, you can put the World Wide Web Consortium’s acronym in there, and the W3C acronym will always be linked to their website. Or, someone like me can put in a link for (fingers crossed) the Geo Docs site (the doc’s for GeoShell) and have them linked automatically. It’s the perfect solution for lazy people!
You might want to consider altering it so that it only works when the text is within [square brackets], so I put that in as an alternative, look for // SAFER ALTERNATIVE and uncomment the line below, and comment out the two lines above. Hope someone can think of a use for this ;-p
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 links. The new version also includes another fix: to allow auto-links to work on the first word.
Edit: May 5, 2006
Even better … get ubernyms and you can build links and acronyms with one plugin
Similar Posts:
- None Found
[...] [...]
[...] [...]
[...] [...]
In viewing my site yesterday, I realized that the links were broken. A simple fix though. in this line
$text = preg_replace("|\[$match\]|msU" , "<a href="$url">$match</a>" , $text);$url was still in as $description
switch that and it works like a charm. This only applies to the safer option which requires the brackets.
Thanks again for the help.
Good catch morydd, thanks. I fixed my local copy, even though it’s commented out
hi, thanks for the script.
But line 65 should be commented, or it cannot go. And it wonders me: To comment the line 65, one cannot use // but only /* */. Why??
So I was looking at this and I noticed that it would be nice to allow a title tag, now I think you can do something like this:
$autolinker_array = array(
“my site” => array(“http://www.HuddledMasses.org/” => “The site that made this plugin”),
Then when you make the link do something like this:
0“ title=”$aurl1“>$match
donner: well, I’ve been running that on my site without problems as-is, and I can’t imagine how commenting out that preg_replace would help anything. In fact, that line is a fix for a problem that came up with the autolinker text showing up inside a link. (eg: nested <a..> tags).
chuck:
)
Yes, have a look at my current plugin project (heck, have a look at what it’s doing to “my site” in every comment y’all make
I would to install your plugin, but become an bug as:
Warning: Cannot modify header information – headers already sent by (output started at …/wp-content/plugins/autolinker.php:80) in …/wp-admin/post.php on line 342
What is for a problem? Did the original file use for plugin?
You left some whitespace in the bottom or top of the file when you copied it over. The line with the <?php and ?> tags have to be the last line in the file, because of where they get included from in WordPress.
ere il meglio da due plugin giA esistenti ed adatti allo scopo: TextLinker di B. Surkin e Autolinker di J.Bennet. Il tutto funziona piuttosto bene su WP 1.5, [...]
[...] just testing this plugin see if it works XHTML works wonderful in Firefox Source: autolinker No Comments [...]
[...] n a yadda, yadda, yadda…yeah I know, bad joke. //EDIT// Let’s alost test the Autolinker Plugin too…. Firefox, Thunderbird, my site….. [...]
Joel,
I was having a small problem with the autolinker when the target word ended up somewhere as a link parameter (specifically when linking to a firefox plugin).
So I updated the “default” regex to this:
$text = preg_replace(”’(?!]*?>)‘si” , “$1$match$2” , $text);
and it seems to be working perfectly now no matter where the word pops up inside any html tag.
Here is an example of a url that was breaking:
https://addons.update.mozilla.org/extensions/moreinfo.php?application=firefox&category=Developer%20Tools&numpg=10&id=60
it broke while doing an autolink on the word “firefox”
thanks for the handy plugin.
[...] 6”> Oppdatert Det finnes allerede en glitrende god ting som gjor dette. Denne kalles AutoLinker og kan brukes i stedet. [...]
Great little plugin and just what I was looking for! I run it under WP 1.5 and it works just as advertised. I have one question though: what should I modify in autolinker.php so that the links always open in a new window? I’m sure there is an easy solution but I know absolutely nothing about php.
/Anders
PS. my site
Hi,
fine little plugin. But is there either a way to tell him, that he has only to link “standalone” words, that means no words with brackets or inside a longer word for example: the-google-mod. I am using textile and if there is for example a link with google somewhere in the URL he breaks the link because he makes a link of the word google. Is this easy to implement so that I could do this by my own? I saw the code but this is black magic for me. I see only brackets and signs but I dont understand whats is what there.
Or is it possible to extend the plugin so that when I write posts in the admin area he shows me what links I have put in the autolinkers php. If this would be possible, the I could easily use the safer version with brackets. With a long list it is hard to remember what I have put it and what not.
[...] It works!!! Thanks to my friend in the computer, Carrie, for whatever voodoo she worked on Autolinker to make it work! I bow to her WP genius. [...]
Superb plugin, but I do wish you could “opt out” keywords by wrapping them in dollar signs — which I believe is possible with the acronym plugin. “Opting in” (using the square brackets) is a much more involved process requiring the user to make decisions in every single post. It’s very rare that I want to opt-out for example, but when I do, boy I do!
Oh er, the acronym plugin provided a very useful code hint. I placed this before the loop closing brace in your code:
$text = preg_replace(”|\[$match\]|imsU” , “$match” , $text);
That unwraps the anchor element from matched text in brackets ([]).
Aaaah! I keep hitting problems. For some reason, about 3 out of 75 links “double wrap” (surrounded by two lots of tags). This screws up page validation. I’ve tried resolving it a trillion different ways, but to no avail. I always F*** up something else.
Gotta reluctantly abandon it now.
I just wish there was an alternative “autolinker” somewhere. I desperately need one.
Lee: can you show me an example?
I can certainly implement a few more restrictions …
[...] All this blogging work has given me an idea of what would be useful features in blogging software. Fortunately, no sooner had I thought of the features I wanted, I had found them. Basically I wanted a quick way to mark up common abbreviations and links. The following two WordPress plugins do the trick: acronym plugin and autolinker plugin. [...]
Well, I fully agree with your comment.
BTW: I visited your blog earlier today and I just wanted to congratulate you on a well presented, and informative resource .
It’s not often that I come across a web site that offers a wealth of quality.
I’ve finally gotten around to adding a “download” link to my source script. All of my plugins should be simple and easy to download now, just click through to the source and hit the download link.
Hopefully that will solve all the download problems people have had.