diff options
author | millette <millette@controlyourself.ca> | 2008-11-07 15:19:26 -0500 |
---|---|---|
committer | millette <millette@controlyourself.ca> | 2008-11-07 15:19:26 -0500 |
commit | 397177243274f3a44ab05005a8290c37b9c7907e (patch) | |
tree | dd9d34e872925ff723c267b969e7dd296a5e91fd | |
parent | 4eecefb54808019a6181482288dcbdb095f39649 (diff) |
trac31 added bit.ly support
darcs-hash:20081107201926-099f7-bee53da36841b7dc048591ed91ea35d3e3522d34.gz
-rw-r--r-- | actions/othersettings.php | 1 | ||||
-rw-r--r-- | lib/util.php | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/actions/othersettings.php b/actions/othersettings.php index 4e28a94f8..d4a27db20 100644 --- a/actions/othersettings.php +++ b/actions/othersettings.php @@ -45,6 +45,7 @@ class OthersettingsAction extends SettingsAction { 'ur1.ca' => 'ur1.ca (free)', '2tu.ru' => '2tu.ru (free)', 'ptiturl.com' => 'ptiturl.com', + 'bit.ly' => 'bit.ly', 'tinyurl.com' => 'tinyurl.com', 'is.gd' => 'is.gd', 'snipr.com' => 'snipr.com', diff --git a/lib/util.php b/lib/util.php index 634140fef..4f93d572e 100644 --- a/lib/util.php +++ b/lib/util.php @@ -777,7 +777,12 @@ function common_shorten_link($long_url) { $short_url_service = new PtitUrl; $short_url = $short_url_service->shorten($long_url); break; - + + case 'bit.ly': + curl_setopt($curlh, CURLOPT_URL, 'http://bit.ly/api?method=shorten&long_url='.urlencode($long_url)); + $short_url = current(json_decode(curl_exec($curlh))->results)->hashUrl; + break; + case 'is.gd': curl_setopt($curlh, CURLOPT_URL, 'http://is.gd/api.php?longurl='.urlencode($long_url)); $short_url = curl_exec($curlh); |