Cezz
Well-known member
If so don't do it quite yet.. as posted over at http://xenfans.com/threads/soon-shorturl-helper-library.144/ we will soon be releasing a Helper API for shortening URL's meaning you will not have to code your own functions into your addon's.
We see a number of benefits for this to both the application developer and the end users.
Developer
or you could get more complex and define a custom method E.G. bit.ly you can do
Though we do suggest you make some sanity checks IE
will tell you if there is such a method installed... and
will give you some extra information about the method.. IE long name, descripton, version, author, and if it is #1 installed #2 available (I.E. all required options are entered).
There is a little more we are planning to add to this but it should be released soon, what we could do with for now is a realistic idea on extra things you the devs want added to this and also an idea if you would use this in a future project.
We see a number of benefits for this to both the application developer and the end users.
Developer
- No need to write your own classes/functions
- Gives end user multiple choices for which shorten API to use.
- Easy to add your one class if needs be and make it available to all.
- Will only need to supply their API keys etc once instead of having to redefine them for every mod that shortens URL's.
PHP:
if(!XenForo_Application::get('options')->suEnabled) {
}[php]
If so then shortening your url is as simple as
[php]$shortURL = Shorten_URL::shorten($url); //shorten using default method
or you could get more complex and define a custom method E.G. bit.ly you can do
PHP:
$shortURL = Shorten_URL::shorten($url,'bitly'); //shorten using bit.ly method
Though we do suggest you make some sanity checks IE
PHP:
Shorten_URL::check('bitly');
will tell you if there is such a method installed... and
PHP:
Shorten_URL_bitly::about();
will give you some extra information about the method.. IE long name, descripton, version, author, and if it is #1 installed #2 available (I.E. all required options are entered).
There is a little more we are planning to add to this but it should be released soon, what we could do with for now is a realistic idea on extra things you the devs want added to this and also an idea if you would use this in a future project.