summaryrefslogtreecommitdiff
path: root/plugins/SimpleUrl
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-11-17 08:04:14 -0500
committerEvan Prodromou <evan@status.net>2009-11-17 08:04:14 -0500
commitbac2d80c919a78d5cafd57f712872a90cda04847 (patch)
treed2df10a582edc0bf9e043f1c764953a290927678 /plugins/SimpleUrl
parent9a1a83e8ebe5ad39838e6363f1537a1a5232b9cb (diff)
parent6a1afda259c5223449f679a64f932e36df5ebe39 (diff)
Merge branch '0.9.x' into adminpanel
Conflicts: classes/User.php
Diffstat (limited to 'plugins/SimpleUrl')
-rw-r--r--plugins/SimpleUrl/SimpleUrlPlugin.php41
1 files changed, 11 insertions, 30 deletions
diff --git a/plugins/SimpleUrl/SimpleUrlPlugin.php b/plugins/SimpleUrl/SimpleUrlPlugin.php
index d59d63e47..45b745b07 100644
--- a/plugins/SimpleUrl/SimpleUrlPlugin.php
+++ b/plugins/SimpleUrl/SimpleUrlPlugin.php
@@ -31,40 +31,21 @@ if (!defined('STATUSNET')) {
exit(1);
}
-class SimpleUrlPlugin extends Plugin
+require_once INSTALLDIR.'/plugins/UrlShortener/UrlShortenerPlugin.php';
+
+class SimpleUrlPlugin extends UrlShortenerPlugin
{
- function __construct()
- {
- parent::__construct();
- }
+ public $serviceUrl;
function onInitializePlugin(){
- $this->registerUrlShortener(
- 'is.gd',
- array(),
- array('SimpleUrl',array('http://is.gd/api.php?longurl='))
- );
- $this->registerUrlShortener(
- 'snipr.com',
- array(),
- array('SimpleUrl',array('http://snipr.com/site/snip?r=simple&link='))
- );
- $this->registerUrlShortener(
- 'metamark.net',
- array(),
- array('SimpleUrl',array('http://metamark.net/api/rest/simple?long_url='))
- );
- $this->registerUrlShortener(
- 'tinyurl.com',
- array(),
- array('SimpleUrl',array('http://tinyurl.com/api-create.php?url='))
- );
+ parent::onInitializePlugin();
+ if(!isset($this->serviceUrl)){
+ throw new Exception("must specify a serviceUrl");
+ }
}
-}
-class SimpleUrl extends ShortUrlApi
-{
- protected function shorten_imp($url) {
- return $this->http_get($url);
+ protected function shorten($url) {
+ return $this->http_get(sprintf($this->serviceUrl,urlencode($url)));
}
}
+