Artiss URL Shortener will shorten a supplied URL using one of over 80 different shortening services
Description
Artiss URL Shortener is one of the most powerful URL shortening plugins available with over 80 shortening services instantly available. Maintaining a database of over 600 such services only those with compatible (and working) APIs are included.
If you are upgrading from a version previous to 2.0 then please read the Caching section in "Other Notes"
Features include...
- Access to over 80 URL shortening services
- Specific functionality for developers
- Efficient caching of results
- Administration screen allowing you to set default shortening values
- Fully internationalized ready for translations. If you would like to add a translation to his plugin then please contact me
The code to access Artiss URL Shortener can be put anywhere within your WordPress theme wherever you need to convert a long URL to a short one. Here is an example...
<?php echo url_shortener( 'http://www.artiss.co.uk', 'service=is.gd' ); ?>
This will display the is.gd shortened URL for http://www.artiss.co.uk.
The above should get you started - for more information and advanced options please read the "Other Notes" tab.
Parameters
There are 2 parameters when using the url_shortener function..
The first parameter is the URL that you wish to have shortened. If left blank it will use the URL of the current post/page.
The second parameter is a list of options. These are separated by an ampersand and can be any of the following...
- service= - Which shortening service do you wish to use?
- cache=reset - This is the only option for this parameter and, if specified, will reset the cache.
Additionally, some services require information such as keys and password to be specified. In which case, use one of the following to supply this...
- apikey=
- login=
- password=
- username=
- uid=
- token=
For example...
<?php echo url_shortener( 'http://www.artiss.co.uk', 'service=bit.ly+key&apikey=3003948393993&login=test' ); ?>
I've not used a valid API key in the above example - you will need to get one for yourself.
For a list of which services are available and which additional information they require, a screen within administration will list them. Within Administration, click on "Services" under the "URL Shortener" menu option.
Developers
It is envisaged that this plugin is probably more of use to developers who want to include it as part of a plugin or theme. In particular, this plugin can be called from another. For example, a social bookmarking plugin could use this to provide a number of possible URL shortening services.
To this end another routine is provided, validate_url_shortener, which can be used to validate whether a shortening service is valid.
This routine has two parameters. The first parameter is a line of text that you wish to have checked to see if it includes a validate shortening service.
The second, optional, parameter is a mask. Use the text {service} to indicate where in the mask the name of the service should appear.
If the shortening service was valid, the name of it will be returned.
Let's try some examples...
validate_url_shortener( 'is.gd' );
This will return is.gd if is.gd is, indeed, one of the shortening services that this plugin accepts. Otherwise a null will be returned.
validate_url_shortener( 'Is there a shortening service in this sentence is.gd' );
Again, this will return is.gd, as it was found within the first parameter.
validate_url_shortener( 'Start %is.gd% End', '%{service}%' );This time a mask has been specified showing that the service should appear within percent signs. As a valid service is found within the first parameter in this format, it will be valid and is.gd will once again be return.
In this example, a null will be specified as the mask condition was not met...
validate_url_shortener( 'Start is.gd End', '%{service}%' );Use this routine in conjunction with the actual shortener to validate passed services before then using them. However, if Artiss URL Shortener is passed a service that is not valid, it will simply return the original URL.
Caching
This plugin makes use of caching to improve performance. When a shortening services returns a short URL, theoretically that should never need to change. Therefore, this plugin will cache them indefinately. If, for whatever reason, you need it to be re-fetched you can do this by simply using the cache=reset parameter.
Caching is performed using WordPress Transients. Housekeeping of these is a known issue and I would highly recommend using another plugin of mine - Artiss Transient Cleaner. In particular, if you are upgrading from a version prior to 2.0 then all the old cache will remain indefinately (apologies for this, I didn't use a naming convention that would allow me to identify it at a later time) - this plugin will clear this down.
Licence
This WordPress plugin is licensed under the GPLv2 (or later).
Reviews & Mentions
Custom Short URLs in WordPress
Behind the Scenes - The Brooks Review
How to make a Twitter button with your choice of service URL
Installation
- Upload the entire
simple-url-shortenerfolder to your wp-content/plugins/ directory. - Alternatively, use the "Add Plugin" option and search for Artiss URL Shortener.
- Activate the plugin through the 'Plugins' menu in WordPress.
Frequently Asked Questions
You haven't included my favourite URL shortening service
Just let me know and I'll include it in a future release if it has a compatible API that this plugin can access.
Where's the list of Shortening Services?
I used to include them on this README but they change so often it's difficult to maintain. So, after version 2 an administration screen is included which lists all the services, as well as which additional parameters are required for them to work (e.g. API key, etc).
I only ever get the original URL returned from the plugin
The original, long URL is returned if the short URL could, for whatever reason, not be retrieved. Please ensure you have specified the service name correctly and supplied any additional information that the provider requires (e.g. API key).
Which version of PHP does this plugin work with?
It has been tested and been found valid from PHP 4 upwards.
Please note, however, that the minimum for WordPress is now PHP 5.2.4. Even though this plugin supports a lower version, I am not coding specifically to achieve this - therefore this minimum may change in the future.
Changelog
2.0
- Maintenance: Reviewed all URL shortening services - many broken sites removed with some new ones added
- Bug: Assorted code bugs fixed as part of site review
- Enhancement: Added internationalisation
- Enhancement: Added feature pointer upon activation
- Enhancement: Added uninstaller to remove any database options
- Enhancement: Completely re-written caching, which is now also cleared when the plugin is activated or deleted
- Enhancement: Administration screen added for default options
- Enhancement: Enhanced existing function to use default options if none are specified
- Enhancement: Services screen will list available URL shorteners and which parameters they require
1.7.1
- Bug: Not formatting the key used for the cache so cache may fail
- Maintenance: Removed tr.im
1.7
- Maintenance: Renamed to Artiss URL Shortener
- Maintenance: Brought code up to date
- Maintenance: Removed debug option
- Maintenance: Fixed bit.ly
- Maintenance: Re-written the instructions!
- Enhancement: Now using built-in WP caching - if you have WP Plugin Cache installed you can now remove it!
- Enhancement: Added adf.ly, goo.by, ity.im, lnk.co, lnk.co+key, lnk.co+banner and yvy.me
1.6.2
- Bug: Fixed file fetching bug
1.6.1
- Maintenance: Removed bit.ly (you can still use bit.ly+key though)
- Enhancenment: Added v.gd
1.6
- Maintenance: url.co.uk now requires an API key
- Maintenance: Confirmed WP 3.0 compatibility
- Bug: Fixed critical bug in file fetching routine
- Enhancement: Rewrite of main code, especially debugging data
- Enhancement: Using WP Plugin Cache for caching, instead of old internal routines
- Enhancement: Added extra Linkbee service for members
- Enhancement: Added ez.com and minify.us to list of services
1.5
- Enhancement: Added debugging facility
1.4
- Enhancement: Replaced str_ireplace with str_replace to ensure PHP 4 compatibility
1.3
- Enhancement: Added new services - 2Zeus, 9mp, BudURL, HURL, kl.am, Lnk.by, to.vg, url.co.uk
1.2
- Enhancement: Added 87 new shortening services. pic.gd removed.
- Enhancement: Ability to specify API key and/or login and password details for certain services
- Enhancement: Can now read XML and JSON return formats, not just plain text
- Enhancement: Failed shortening of URLs are no longer cached
1.1
- Maintenance: New versions of shared functions added in
- Enhancement: Now uses caching system to save shortened URLs
- Enhancement: Sub-parameter system added to allow for switching off of cache
1.0
- Initial release


I want to use this with bw.ly which I own I was going to upload WP to that – so do I understand this URL shortener I have to use one of the ones listed here? How can I use my own?
Hi Larry.
I’d put a facility in to define your own, but there are so many different ways that the API works, it would be difficult to do so.
If it’s one that’s not exclusively for yourself and has an API of some kind, then let me know the details and I’ll get it added.
Pingback: Wordpress : créer un bouton pour twitter (avec le choix du service) | NeoSting.net
We’ve been using simple twitter link (and URL shortener since 1.5) to put a twitter link on each of our posts, but it seems like with each update it becomes more and more difficult to have things display properly. Currently, instead of a twitter link, we’re showing an error message: Simple URL Shortener: Could not update cache file …/simple-url-shortener/cache/c2bb4c9e31be9949ac09e2104a3685b2a3aa60e0.suc
This started happening after the latest update of Simple URL shortener.
Before the last update, this code worked fine for providing a twitter link for us.
Is there something in the new update of Simple URL shortener that isn’t working with Simple Twitter Link? I can’t figure out what to do.
Any help is appreciated.
The first thing to do is to confirm the attributes on the cache folder – ensure it is fully writable.
If that doesn’t work the latest version of the plugin has an option to turn off the caching – that certainly should resolve the issue!
I had the same problem as Local Landing I think and resolved it by creating the cache folder manually since for some reason it didn’t exist after installing the plugin.
Works great now, thanks!
Is this compatible with the Shaun Inman “LESSN” personal URL shortener? It has an API ( which I use on my iPhone with Tweetie2).
LESSN is free URL Shortening service that you can install on your own domain. This means that there’s no fixed URL associated with it – currently, as this plugin stands, that’s not supported.
Besides, I’ve taken a quick look and API details are not obvious. I can see an API key is present and there’s a bookmarklet option available, but I can’t find any API documentation. As much as I’d love to have to install and work it out from scratch via the code… no, I won’t
Anyway you can add to the included shorteners?
I’ve taken a quick look and it uses a compatible API, so I’ll add it to the next release!
Can you update your plugin to make linkbee use login= and password= to shortner links to our member accounts?
I will look at doing this for the next release!
hey man! wonderful plugin, but it can not really install it in my wordpress..(sry my english) there only comes this window (screenshot) [url removed]
what do i wrong?
thanks for help
I’ve attempted to contacted you via email about this and have not had a response. The screenshot URL you provided is not valid.
Pingback: 「Simple URL Shortener」Twitterとの連携に便利なURL短縮サービスをテーマ内で使えるプラグイン | BLACKND
I have installed, removed, and reinstalled this plug-in three times now, but it is not showing up in my menu after activating it. I am using the latest WP version; are there compatibility issues? Or, am I just completely miss understanding how to install the plugin? hahah..
Thank you,
Dennis
The latter
No menu options appear when this is activated – it is called by PHP code that you have to add to your theme files.
Pingback: Behind the Scenes — The Brooks Review
Pingback: My Favourite Wordpress Plugins | babblative.com