Categories
Package/plugin/module WordPress

Auto-hyperlink URLs v3.0

I’d like to announce the official release of the updated Auto-hyperlink URLs plugin (v3.0).

Automatically hyperlink text URLs and email addresses that appear in plaintext in post content and comments.

The plugin’s official homepage is located at :
coffee2code.com/wp-plugins/auto-hyperlink-urls.

Highlights

This release introduces an admin options page for the plugin to configure various options. You can now add additional TLDs via the options page. There have also been various bug fixes and coding improvements. The release also brings with it full compatibility with WordPress 2.3+ and 2.5 (with continued support for 2.0+, 2.1+ and 2.2+).

This update is part of coffee2code’s 14 Days of Plugins (updated plugin #3).

Comments welcome on this post for this version of the plugin. Comments will be closed once this release has been superseded by another.

Read on for a detailed ChangeLog of the release.

Detailed ChangeLog

These are the detailed changes, which may or may not make sense to you depending on your familiarity with the previous features and internals of the plugin.

  • Overhauled and added a bunch of new code
  • Encapsulated a majority of functionality in a class
  • Added admin options page for the plugin, under Options -> Autohyperlink (or in WP 2.5: Settings -> Autohyperlink)
  • Added options so that default auto-hyperlinking can be easily configured
  • Added option to allow for user-specified TLDs
  • Added TLDs of mil, mobi, and cc
  • Added option to conditionally auto-hyperlink comments
  • Renamed existing functions
  • “~” is a valid URL character
  • Added class of “autohyperlink” to all links created by the plugin
  • Removed the A-Z from regexp since they are case-insensitive
  • Recoded some of the core functionality so as to execute only one preg_replace() call for everything (by passing patterns and replacements as arrays)
  • Added a note about the known issue of the plugin linking URLs that appear within a longer string in a tag attribute’s value
  • trim() text before return instead of doing a substr()
  • Added nofollow support
  • Moved Class B domain preg to after explicitly protocoled links
  • Tweaked description and installation instructions
  • Updated copyright date and version to 3.0
  • Added readme.txt and screenshot image to distribution zip
  • Tested compatibility with WP 2.3+ and 2.5

6 replies on “Auto-hyperlink URLs v3.0”

I believe I made the executive decision to not show the protocol for http (“http://”) in the auto-links for this release. While it is my preference for that behavior, I understand others may not agree, so in the next release I’ll make it an option. Check back again soon for the update.

Is it possible to add_filter for meta info, such as that returned by custom fields? I use a few extra custom fields, and display the input text like this in my template:

[code]


        <?php if (get_post_meta($post->ID, 'interviewtext')) { 
            echo "<div class='smrsections' id='interviewtext'>";
            echo get_post_meta($post->ID, 'interviewtext', $single=true);
            echo "</div>";

          } ?>


[/code]

So i’d like your plugin to work on the echo’d info.

Please email if this is something that’s possible and I’d be happy to donate (again) for your time.

Hi Tom, I appreciate the donation!

Depending on your situation, you can do a few different things.

1. You can just directly call hyperlink_url() in the above code, so you’ll change the one line to be:

echo hyperlink_urls(get_post_meta($post->ID, 'interviewtext', $single=true));

But you’ll have to do that sort thing everywhere you want it.

2. You can use my Get Custom Field Values in conjunction with the Auto-hyperlink URLs plugin. If you do, you can replace your whole code example with:

<?php echo c2c_get_custom('interviewtext', "<div class='smrsections' id='interviewtext'>", "</div>"); ?>

(That replaces all the code you have shown above. Nothing appears if the post doesn’t have an ‘interviewtext’ custom field, and if it does, it appears with the div.)

That plugin also allows you to filter meta data via an add_filter. So, for example, in your theme’s functions.php file, you could add the line:

add_filter('the_meta_interviewtext', 'hyperlink_urls');

To hyperlink interviewtext meta values wherever they may appear.

Hope that helps!

Scott, that’s solved it.

After a slighthiccup (using Flutter for Write Panel management and they’ve used/Abused some of your code which caused conflicts) I went with the c2c_get_custom method.

Thanks very much, this has just made my life a lot easier.

More beer money coming your way as soon as my cheque clears. I appreciate the help.

Comments are closed.