]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
trac31 added bit.ly support
authormillette <millette@controlyourself.ca>
Fri, 7 Nov 2008 20:19:26 +0000 (15:19 -0500)
committermillette <millette@controlyourself.ca>
Fri, 7 Nov 2008 20:19:26 +0000 (15:19 -0500)
darcs-hash:20081107201926-099f7-bee53da36841b7dc048591ed91ea35d3e3522d34.gz

actions/othersettings.php
lib/util.php

index 4e28a94f80df74a9283d503ba6c3944bb9aed5ac..d4a27db200c230945dc612f837a619973d7f7b1c 100644 (file)
@@ -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',
index 634140fef5bb9b3e407b6f86f8baf904e80834d0..4f93d572e48c47820eef1f35e45d2a3c51443d32 100644 (file)
@@ -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);