- Author:Scott Reilly
- Version:3.0
- Last update:02 April 2008
- Compatibility:WP 2.0+, 2.1+, 2.2+, 2.3+, and 2.5+
- Comments:go here
- Download:[ zip ]
- Description:
Automatically hyperlink text URLs and email addresses that appear in plaintext in post content and comments.
-
Extended Description
This plugin seeks to address certain shortcomings with WordPress’s default auto-hyperlinking function. 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 text URLs to only show the hostname
– If you want text URLs truncated after N characters
– If you want auto-hyperlinked URLs to open in new browser window or not
– The text to come before and after the link text for truncated links
– If you want nofollow to be supported
– If you wish to support additional domain extensions not already configured into the pluginThis 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“, not just domains prepended with “www.”) as valid links (i.e. “wordpress.org” would now get auto-hyperlinked) -
Screenshot
A screenshot of the plugin’s admin options page.
-
Installation
- Download the file autohyperlink-urls.zip and unzip it into your wp-content/plugins/ directory.
- Activate the plugin through the ‘Plugins’ admin menu in WordPress.
- (optional) Modify any configuration options for the plugin by going to its admin configuration page at
Options -> Autohyperlink (or in WP 2.5: Settings -> Autohyperlink)
-
Tips & Examples
(Assuming default configuration)
wordpress.org
=><a href="http://wordpress.org" title="http://wordpress.org" target="_blank" class="autohyperlink">wordpress.org</a>
http://www.cnn.com
=><a href="http://www.cnn.com" title"http://www.cnn.com" target="_blank" class="autohyperlink">www.cnn.com</a>
person@example.com
=><a href="mailto:person@example.com" title="mailto:person@example.com" class="autohyperlink">person@example.com</a>
To better illustrate what results you might get using the various settings above, here are examples.
For the following, assume the following URL is appearing as plaintext in a post:
www.somelonghost.com/with/some/long/URL/that/might/mess/up/your/theme/and/is/unsightly.php
And unless explicitly stated, the results are using default values (nofollow is false, hyperlink emails is true, Hyperlink Mode is 0)
- By default:
<a href="http://www.somelonghost.com/with/some/long/URL/that/might/mess/up/your/theme/and/is/unsightly.php" title="http://www.somelonghost.com/with/some/long/URL/that/might/mess/up/your/theme/and/is/unsightly.php" class="autohyperlink" target="_blank">www.somelonghost.com/with/some/long/URL/that/might/mess/up/your/theme/and/is/unsightly.php</a>
- With Hyperlink Mode set to 1
<a href="http://www.somelonghost.com/with/some/long/URL/that/might/mess/up/your/theme/and/is/unsightly.php" title="http://www.somelonghost.com/with/some/long/URL/that/might/mess/up/your/theme/and/is/unsightly.php" class="autohyperlink" target="_blank">www.somelonghost.com</a>
- With Hyperlink Mode set to 15
<a href="http://www.somelonghost.com/with/some/long/URL/that/might/mess/up/your/theme/and/is/unsightly.php" title="http://www.somelonghost.com/with/some/long/URL/that/might/mess/up/your/theme/and/is/unsightly.php" class="autohyperlink" target="_blank">www.somelonghos...</a>
- With Hyperlink Mode set to 15, nofollow set to true, open in new window set to false, truncation before of “[“, truncation after of “…]”
<a href="http://www.somelonghost.com/with/some/long/URL/that/might/mess/up/your/theme/and/is/unsightly.php" title="http://www.somelonghost.com/with/some/long/URL/that/might/mess/up/your/theme/and/is/unsightly.php" class="autohyperlink" rel="nofollow">[www.somelonghos...]</a>
-
Known Issues
-
Currently the plugin hyperlinks URLs that appear embedded within the middle of a longer string used as tag attribute value.
i.e.
<a href="http://example.com" title="I go to http://example.com often">example.com</a>
comes out as:
<a href="http://example.com" title="I go to <a href="http://example.com" class="autohyperlink">http://example.com</a> often">example.com</a>
- It will also not hyperlink URLs that are immediately single- or double-quoted, i.e. ‘http://example.com’ or “http://example.com”
-
Currently the plugin hyperlinks URLs that appear embedded within the middle of a longer string used as tag attribute value.
-
Release Log
- 02 Apr 2008 : v3.0 — Release notes
- NOTE: Versions prior to v3.0 were documented and discussed here
- 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 & Disclaimer
Copyright © 2004-2008 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.
-
Acknowledgements
Thanks to all those who have contributed feedback and support!
6 replies on “Auto-hyperlink URLs”
[…] Auto-Hyperlink URLs, it changers URL into hyperlinks automatically, Great if posting via […]
[…] WordPress Auto-hyperlink URLs – Automatically hyperlink text URLs and email addresses that appear in plaintext in post content and comments. […]
[…] einem Plugin wie coffee2code.com/wp-plugins/auto-hyperlink-urls/ habe ich schon lange gesucht – es wird mir künftig die Arbeit deutlich […]
[…] Auto-hyperlink URLs – Provee de varias opciones para convertir las direcciones directamente en links. […]
[…] ????????????…????????????????????? “Auto-hyperlink URLs” […]
[…] ????? coffee2code.com/wp-plugins/auto-hyperlink-urls/ […]