From c1291a5857e34d023653619cd7a6689f6c252a15 Mon Sep 17 00:00:00 2001 From: Grischa Brockhaus Date: Wed, 24 Oct 2012 12:11:47 +0200 Subject: [PATCH] plugin_twitter: Added pirat.ly as possible URL shortener. --- serendipity_plugin_twitter/ChangeLog | 7 +------ serendipity_plugin_twitter/classes/UrlShortener.php | 10 +++++++++- serendipity_plugin_twitter/plugin_version.inc.php | 2 +- .../serendipity_event_twitter.php | 1 + 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/serendipity_plugin_twitter/ChangeLog b/serendipity_plugin_twitter/ChangeLog index 6a9f7ef7..08a19563 100644 --- a/serendipity_plugin_twitter/ChangeLog +++ b/serendipity_plugin_twitter/ChangeLog @@ -1,11 +1,5 @@ TODO: -** IMPORTANT ** - -Migrate Twitter API 1 calls to 1.1. Now requires OAuth even for simple timeline requests. Blimey. - -**************** - * Collect all tweets of a day/week/whatever of the blog owner into one article and publish it dayly/weekly/whatever * "check tweetback" link should add new tweetbacks immediately @@ -20,6 +14,7 @@ Migrate Twitter API 1 calls to 1.1. Now requires OAuth even for simple timeline * Already implemented OAuth function will call API 1.1 instead of API 1.0 now. * Sitebar plugin, PHP version, optional uses Twitter API 1.1 with OAuth now. * Tweeter hides URL shortener functionality now if URL shortener is set to "uncompressed". + * Added new URL shortener: pirat.ly. 1.43 (brockhaus) -------------------------- diff --git a/serendipity_plugin_twitter/classes/UrlShortener.php b/serendipity_plugin_twitter/classes/UrlShortener.php index 03698f95..8de5db8b 100644 --- a/serendipity_plugin_twitter/classes/UrlShortener.php +++ b/serendipity_plugin_twitter/classes/UrlShortener.php @@ -71,6 +71,9 @@ class UrlShortener { case 'twurl': UrlShortener::shorten_via_twurl( $url, $shorturls ); break; + case 'piratly': + UrlShortener::shorten_via_piratly( $url, $shorturls ); + break; // old removed service case 'snipr': case 'tr.im': @@ -115,7 +118,12 @@ class UrlShortener { $url = urlencode($url); UrlShortener::shorten_via_simple($shorturls, '7ax.de', "http://7ax.de/api.php?url=$url"); } - + + function shorten_via_piratly( $url, &$shorturls ) { + $url = urlencode($url); + UrlShortener::shorten_via_simple($shorturls, 'piratly', "http://pirat.ly/shortener/createplain/0/?$url"); + } + // is.gd returns different short urls for same URL! How to handle this?! // works *sometimes* function shorten_via_isgd( $url, &$shorturls ) { diff --git a/serendipity_plugin_twitter/plugin_version.inc.php b/serendipity_plugin_twitter/plugin_version.inc.php index ceb8376c..4b03ea7d 100644 --- a/serendipity_plugin_twitter/plugin_version.inc.php +++ b/serendipity_plugin_twitter/plugin_version.inc.php @@ -1,4 +1,4 @@ "uncompressed", '7ax.de' => "7ax.de", 'bitly' => "bit.ly", + 'piratly' => "pirat.ly", 'jmp' => "j.mp", 'tinyurl' => "tinyurl.com", 'isgd' => "is.gd",