coffee2code.com/wp-plugins/auto-hyperlink-urls
Auto-hyperlink text URLs in post content and comment text to the URL they reference. Does NOT try to hyperlink already hyperlinked URLs. Improves upon WordPress’s default make_clickable function, along with adding some configuration options (such as link truncation).
This plugin seeks to address certain shortcomings with WordPress’s default auto-hyperlinking function (make_clickable()) (which itself was borrowed from phpBB). This tweaks the pattern matching expressions to prevent inappropriate adjacent characters from becoming part of the link (such as a trailing period when a link ends a sentence, links that are parenthesized or braced, comma-separated, etc) and it prevents invalid text from becoming a mailto: link (i.e. smart@ss) or for invalid URIs (i.e. blah) from becoming links. In addition, this plugin adds configurability to the auto-hyperlinker such that you can configure:
– If you want auto-hyperlinked text URLs to only show the hostname
– If you want auto-hyperlinked text URLs truncated after N characters
– If you want auto-hyperlinked text URLs to open in new browser window or not
– Text to come before and after the link text for truncated links
This plugin will recognize any protocol-specified URI (http|https|ftp|news)://, etc, as well as e-mail addresses. It also adds the new ability to recognize Class B domain references (i.e. “somesite.net” where not just those prepended with “www.”) as valid links (i.e. “wordpress.org” would now get auto-hyperlinked)
- Download the file autohyperlink-urls.zip and unzip it into your /wp-content/plugins/ directory.
-OR-
Copy and paste the the code ( autohyperlink-urls.phps ) into a file called autohyperlink-urls.php, and put that file into your /wp-content/plugins/ directory. - Optional: Modify any configuration options (presented as defaults for the arguments to the function hyperlink_urls())
- Activate the plugin from your WordPress admin ‘Plugins’ page.
function c2c_hyperlink_urls ($text, $mode='0', $trunc_before='', $trunc_after='...', $open_in_new_window=true)
- $text : The text to search for plain-text URLs which should be hyperlinked
- $mode : How the text part of the newly created hyperlinks should appear. Assume as an example “http://wordpress.org/support/10”
- 0 = The full text of the URL (ie. “http://wordpress.org/support/10”)
- 1 = Host-only (ie. “http://wordpress.org”)
- 11+ = (Any number greater than 11 will result in only that many characters appearing in the link.)
- $trunc_before : Text/HTML to appear before each link created when $mode is 0 or 11+ and truncation occurs
- $trunc_after : Text/HTML to appear after each link created when $mode is 0 or 11+ and truncation occurs
- $open_in_new_window : Boolean value (either ‘true’ or ‘false’) to determine whether all created hyperlinks should open a new window when the link is clicked by a visitor; default is ‘true’.
Example:
“wordpress.org”, appearing un-hyperlinked in post text or comment text, becomes:
<a href=”http://wordpress.org” title=”http://wordpress.org” target=”_blank”>wordpress.org</a>
Assume the following text appears in a post/comment: “http://www.somesite.org/with/a/very/long/url/that/may/break/your/sites/layout”
$mode = 0
=> www.somesite.org/with/a/very/long/url/that/may/break/your/sites/layout
$mode = 1, $trunc_before='[‘, $trunc_after=’]’
=> [http://www.somesite.org]
$mode=25
=> www.somesite.org/w…
- WordPress Support Forum announcement for Auto-hyperlink URLs
- 10 Oct 2004 : v2.01 — Fix to once again prevent linking already hyperlinked URL
- 27 Sep 2004 : v2.0 —
- Plaintext URLs can now begin, end, or be all of the post and it will get auto-hyperlinked
- Incorporated some WP1.3 regular expression changes to
make_clickable()
- Added “gov” and “edu” to the list of common domain extensions (for Class B domain support)
- No longer displays the protocol (the “http://” part) in the displayed link text
- Dropped support for auto-linking aim: and icq:
- Prepended function names with “c2c_” to avoid potential future conflict with other plugins or the WordPress core
- Changed license from BSD-new to MIT
- 13 Jul 2004 : v1.01 — Slight tweak to prevent blah from becoming a link
- 13 Jul 2004: v1.0 — Complete rewrite
- 08 Jul 2004 : v0.9 — Released to the public
Copyright (c) 2004 by Scott Reilly (aka coffee2code)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
136 replies on “Plugin: Auto-hyperlink URLs”
[…] 11. Auto-hyperlink URLs Auto-hyperlink text URLs in post content and comment text to the URL they reference. Does NOT try to hyperlink already hyperlinked URLs. Improves upon WordPress’s default make_clickable function, along with adding some configuration options (such as link truncation). […]
[…] 11. Auto-hyperlink URLs Auto-hyperlink text URLs in post content and comment text to the URL they reference. Does NOT try to hyperlink already hyperlinked URLs. Improves upon WordPress’s default make_clickable function, along with adding some configuration options (such as link truncation). […]
[…] Auto Hyperlink URL’s – Will automatically make URL’s that you put into your posts “clickable”. www.coffee2code.com/archives/2004/07/08/plugin-auto-hyperlink-urls […]
I found a conflict between this plugin and the quoter plugin from www.damagedgoods.it/wp-plugins/quoter/. When both plugins are enabled links that are autolinked inside of quotes made using the “Quote selected text” function break something, it causes the next comment to end up in the spot where the quote should have been.
After much trial and error I was able to remedy this problem by changing the priorities of both plugins so that autohyperlink goes before quoter.
The last line of autohyperlink-urls.php becomes:
add_filter('comment_text', 'c2c_hyperlink_urls', 1);
and line 129 of quoter.php becomes:
add_filter('comment_text', 'quoter_addquote', 2);
Regrettably, I have no idea what caused this to happen, but the above did fix it for me.
Thanks for the great plugin 🙂
[…] I searched at wp-plugins.net and found some good stuff. Now all written URL autohyperlink to the link´s destination. The plugin is here www.coffee2code.com/archives/2004/07/08/plugin-auto-hyperlink-urls/ […]
Hi, thank you for this plugin 🙂
Auto-hyperlink URLs plugin is just what I was looking for. Thanks a bunch!
[…] Visit […]
[…] Auto-hyperlink URLs – Gives you several options for having URLs automatically turn in to hyperlinks. […]
[…] Auto-hyperlink URLs – Gives you several options for having URLs automatically turn in to hyperlinks. […]
[…] Auto-hyperlink URLs – Gives you several options for having URLs automatically turn in to hyperlinks. […]
[…] Auto-hyperlink URLs – Provides you with several options for automatically turning URLs in to hyperlinks. […]
[…] Auto-hyperlink URLs: convierte las direcciones en links. […]
This is a great plug-in, I am sick of going in and fixing urls.
[…] Auto-hyperlink URLs: converts addresses into links . […]
[…] Auto-hyperlink URLs – Fournit différentes options pour transformer vos URL en hyperliens. […]
[…] URLs www.coffee2code.com/archives/2004/07/08/plugin-auto-hyperlink-urls/ Auto-hyperlink text URLs in post content and comment text to the URL they reference. Does NOT try […]
[…] can automate making your links in blog posts clickable with the auto-hyperlink URL […]
a ***VERY**** useful plugin. Especially for my blog where the text needs to be converted to links and truncated so that the links do not jump out of the post area into the sidebar ..
thanks 🙂
Definitely a good plugin that save you some work. The bad thing is when you discover it late and that you’ve already formatted your post in some way.
[…] of the admin area.Ajax Spell Checker – Uses a variety of dictionaries to spell check your posts.Auto-hyperlink URLs – Provides you with several options for automatically turning URLs in to hyperlinks.AWSOM […]
Plugin results in a duplicate:
www.doncullen.net/?p=27
If you go there and look at comment, you’ll see two links in a comment. Both are displayed as duplicates when they aren’t — if you hover the mouse over each link, you can see they go to different addresses. It seems to be taking the first link, and duplicating that as the name for all following links…
You can ignore this. I found the problem of the duplicity, and it wasn’t the plugin. If you took the time to read the previous comment, I apologize for the confusion, and thanks for taking the time to read it! 🙂
[…] Auto-hyperlink URLs: convierte las direcciones en links. […]
[…] Auto-hyperlink URLs: convierte las direcciones en links. […]
[…] Auto-hyperlink URLs: convierte las direcciones en links. […]
[…] Auto-hyperlink URLs: convierte las direcciones en links. […]
[…] Auto-hyperlink URLs: convierte las direcciones en links. […]
[…] Auto-hyperlink URLs – 自动将URL转æ¢ä¸ºé“¾æŽ¥ã€‚ […]
[…] Auto-Hyperlink URLs – If I forget to assign a formal hyperlink to an internet address, this plug-in tries to help. […]
120+ WordPress Plugins…
Running your WordPress blog can feel like a full-time job sometimes. We have compiled an A-Z list of more than 120 plugins to help you streamline everything you need to do out back.
AJAX-Powered WordPress Plugins
The WordPress blogging platform has tho…
[…] Auto-hyperlink URLs: convierte las direcciones en links. […]
[…] Auto-hyperlink URLs – Provides you with several options for automatically turning URLs in to hyperlinks. […]
[…] Auto-hyperlink URLs – Provides you with several options for automatically turning URLs in to hyperlinks. […]
[…] Auto-hyperlink URLs – This tool gives you several options for converting your URLs automatically in to hyperlinks. […]
[…] Auto-hyperlink URLs – ???URL?????? […]