. * * @category Plugin * @package StatusNet * @author Craig Andrews * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ if (!defined('STATUSNET')) { exit(1); } class SimpleUrlPlugin extends UrlShortenerPlugin { const PLUGIN_VERSION = '2.0.0'; public $serviceUrl; function onInitializePlugin(){ parent::onInitializePlugin(); if(!isset($this->serviceUrl)){ // TRANS: Exception thrown when the SimpleUrl plugin has been configured incorrectly. throw new Exception(_m('You must specify a serviceUrl.')); } } protected function shorten($url) { return $this->http_get(sprintf($this->serviceUrl,urlencode($url))); } public function onPluginVersion(array &$versions): bool { $versions[] = array('name' => sprintf('SimpleUrl (%s)', $this->shortenerName), 'version' => self::PLUGIN_VERSION, 'author' => 'Craig Andrews', 'homepage' => GNUSOCIAL_ENGINE_REPO_URL . 'tree/master/plugins/SimpleUrl', 'rawdescription' => // TRANS: Plugin description. sprintf(_m('Uses %1$s URL-shortener service.'), $this->shortenerName)); return true; } }