URL Shortener Plugin for ExpressionEngine
About the Plug-in
URL Shortener Plugin creates short URL addresses using is.gd API for ExpressionEngine.
Installation
Download URL Shortener Plugin and unzip the package into your ExpressionEngine plug-ins folder.
Below is the actual code if you want to have a quick look.
<?php
/*
=========================================================
= Author: Cem Meric =
= http://webunder.com.au =
=========================================================
= File: pi.url_shortener.php =
=-------------------------------------------------------------------=
= Compatibility (tested): ExpressionEngine 1.6.7 =
=-------------------------------------------------------------------=
= Purpose: Creates short url addresses using =
= is.gd API =
=-------------------------------------------------------------------=
= Version History: =
= 1.0.0 - 07 July 2009 =
= plugin first built =
=========================================================
*/
$plugin_info = array(
'pi_name' => 'URL_Shortener',
'pi_version' => '1.0',
'pi_author' => 'Cem Meric',
'pi_author_url' => 'http://webunder.com.au',
'pi_description' => 'Creates short url addresses using is.gd API',
'pi_usage' => URL_Shortener::usage()
);
class URL_Shortener {
var $return_data = "";
/** ----------------------------------------
/** Constructor
/** ----------------------------------------*/
function URL_Shortener()
{
global $TMPL;
$url = $TMPL->tagdata;
$preview = $TMPL->fetch_param('preview');
$url = str_replace('/', '/', $url);
$urlShort = "http://is.gd/api.php?longurl=" . $url;
$urlShort = file_get_contents($urlShort);
if ($preview == 'true')
{
$this->return_data = $urlShort . "-";
} else {
$this->return_data = $urlShort;
}
}
/* FUNCTION END */
// ----------------------------------------
// Plugin Usage
// ----------------------------------------
// This function describes how the plugin is used.
// Make sure and use output buffering
function usage()
{
ob_start();
?>
Examples:
{exp:url_shortener}http://expressionengine.com/{/exp:url_shortener}
Result: http://is.gd/1oTO5
{exp:url_shortener preview="true"}http://expressionengine.com/{/exp:url_shortener}
Result: http://is.gd/1oTO5-
<?php
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}
/* END */
}
// END CLASS
?>
Examples
ExpressionEngine tag
{exp:url_shortener}http://expressionengine.com/{/exp:url_shortener}Output
Result: http://is.gd/1oTO5
License
Dynamic Select Plugin is licensed under a Creative Commons Attribution 3.0 License.

Wow! Its imposible… I’m realy shocked :/
said Clothing about 6 months ago