modified: statusnet.tgz First url shortener is a custom YourLS url shortener, if it is configured.

modified:   statusnet/statusnet.php First url shortener is a custom YourLS url �shortener, if it is configured.
	modified:   twitter.tgz First url shortener is a custom YourLS url �shortener, if it is configured.
	modified:   twitter/twitter.php First url shortener is a custom YourLS url �shortener, if it is configured.
	new file:   yourls.tgz sets up the config for a custom YourLS url shortener.
	new file:   yourls/README sets up the config for a custom YourLS url shortener.
	new file:   yourls/yourls.css sets up the config for a custom YourLS url shortener.
	new file:   yourls/yourls.php sets up the config for a custom YourLS url shortener.
This commit is contained in:
Keith Fernie 2012-02-09 21:15:41 +00:00
parent fbc44b2135
commit 5c426e3fa2
8 changed files with 161 additions and 9 deletions

View file

@ -407,10 +407,24 @@ function statusnet_post_hook(&$a,&$b) {
$shortlink = "";
require_once('library/slinky.php');
$slinky = new Slinky( $b['plink'] );
// setup a cascade of shortening services
// try to get a short link from these services
// in the order ur1.ca, trim, id.gd, tinyurl
$slinky->set_cascade( array( new Slinky_UR1ca(), new Slinky_Trim(), new Slinky_IsGd(), new Slinky_TinyURL() ) );
$yourls_url = get_config('yourls','url1');
if ($yourls_url) {
$yourls_username = get_config('yourls','username1');
$yourls_password = get_config('yourls', 'password1');
$yourls_ssl = get_config('yourls', 'ssl1');
$yourls = new Slinky_YourLS();
$yourls->set( 'username', $yourls_username );
$yourls->set( 'password', $yourls_password );
$yourls->set( 'ssl', $yourls_ssl );
$yourls->set( 'yourls-url', $yourls_url );
$slinky->set_cascade( array( $yourls, new Slinky_UR1ca(), new Slinky_Trim(), new Slinky_IsGd(), new Slinky_TinyURL() ) );
}
else {
// setup a cascade of shortening services
// try to get a short link from these services
// in the order ur1.ca, trim, id.gd, tinyurl
$slinky->set_cascade( array( new Slinky_UR1ca(), new Slinky_Trim(), new Slinky_IsGd(), new Slinky_TinyURL() ) );
}
$shortlink = $slinky->short();
// the new message will be shortened such that "... $shortlink"
// will fit into the character limit