Cezz
OMG Member
- Joined
- Sep 24, 2010
- Messages
- 581
I am starting this discussion as a split from http://xenfans.com/threads/soon-xentweet-auto-tweet-threads.119/ more specifically about the helper library now.
This has been a joint effort between both KingKovifor and myself and we believe the library is almost ready to be released as a first alpha.
So what does this do / What is it?
This is a Helper library, on its own it wont to much but it will mean that shortURL settings can be set once and then all the other modification can then use the library, making it easier for other mod authors to shorten URLs.
How would a mod author use it?
To actually call the default shorten URL method is as simple as.
This will either return the URL or false.
More complex structure and allowing you to select the method you want can be formatted with two extra variables $method and $timeout.
EG.
Will do a number of checks, first it will make sure that bitly method exists if it does then it will load Shorten_URL_bitly:
horten($url), this will then return the URL or false, if the method doesn't exist it will return false.
We recommend that you use Shorten_URL::check($method); if you get a false return from a customized method.
So for example
Is there more?
Yes there is a lot more to this including a simple way to add new methods and also install required options E.G. to request API Key's Username's Etc.
We will keep this thread updated until the mod is released.
This has been a joint effort between both KingKovifor and myself and we believe the library is almost ready to be released as a first alpha.
So what does this do / What is it?
This is a Helper library, on its own it wont to much but it will mean that shortURL settings can be set once and then all the other modification can then use the library, making it easier for other mod authors to shorten URLs.
How would a mod author use it?
To actually call the default shorten URL method is as simple as.
PHP:
Shorten_URL::shorten($url);
This will either return the URL or false.
More complex structure and allowing you to select the method you want can be formatted with two extra variables $method and $timeout.
EG.
PHP:
Shorten_URL::shorten('http://xenfans.com/','bitly');
Will do a number of checks, first it will make sure that bitly method exists if it does then it will load Shorten_URL_bitly:

We recommend that you use Shorten_URL::check($method); if you get a false return from a customized method.
So for example
PHP:
private function bitly($url)
{
$shortURL = Shorten_URL::shorten($url,'bitly'); //shorten using bitly method
if($shortURL != false) return $shortURL; // if it was successful then just return the URL
if(Shorten_URL::check('bitly') == false) return = Shorten_URL::shorten($url); //bitly doesn't exist try using the default method
return false; //short URL failed
}
Is there more?
Yes there is a lot more to this including a simple way to add new methods and also install required options E.G. to request API Key's Username's Etc.
We will keep this thread updated until the mod is released.