12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- if (!defined('STATUSNET')) {
- exit(1);
- }
- class SimpleUrlPlugin extends UrlShortenerPlugin
- {
- public $serviceUrl;
- function onInitializePlugin(){
- parent::onInitializePlugin();
- if(!isset($this->serviceUrl)){
-
- throw new Exception(_m('You must specify a serviceUrl.'));
- }
- }
- protected function shorten($url) {
- return $this->http_get(sprintf($this->serviceUrl,urlencode($url)));
- }
- function onPluginVersion(&$versions)
- {
- $versions[] = array('name' => sprintf('SimpleUrl (%s)', $this->shortenerName),
- 'version' => GNUSOCIAL_VERSION,
- 'author' => 'Craig Andrews',
- 'homepage' => 'http://status.net/wiki/Plugin:SimpleUrl',
- 'rawdescription' =>
-
- sprintf(_m('Uses <a href="http://%1$s/">%1$s</a> URL-shortener service.'),
- $this->shortenerName));
- return true;
- }
- }
|