class BitlyUrlPlugin extends UrlShortenerPlugin
{
+ const PLUGIN_VERSION = '2.0.0';
+
public $shortenerName = 'bit.ly';
public $serviceUrl = 'http://api.bit.ly/v3/shorten?longUrl=%s';
public $login; // To set a site-default when admins or users don't override it.
*/
protected function query($url)
{
- // http://code.google.com/p/bitly-api/wiki/ApiDocumentation#/shorten
$params = http_build_query(array(
'login' => $this->getLogin(),
'apiKey' => $this->getApiKey()), '', '&');
return null;
}
- function onPluginVersion(&$versions)
+ function onPluginVersion(array &$versions)
{
$versions[] = array('name' => sprintf('BitlyUrl (%s)', $this->shortenerName),
- 'version' => STATUSNET_VERSION,
+ 'version' => self::PLUGIN_VERSION,
'author' => 'Craig Andrews, Brion Vibber',
- 'homepage' => 'http://status.net/wiki/Plugin:BitlyUrl',
+ 'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/BitlyUrl',
'rawdescription' =>
// TRANS: Plugin description. %1$s is the URL shortening service base URL (for example "bit.ly").
sprintf(_m('Uses <a href="http://%1$s/">%1$s</a> URL-shortener service.'),
/**
* Hook for RouterInitialized event.
*
- * @param Net_URL_Mapper $m path-to-action mapper
+ * @param URLMapper $m path-to-action mapper
* @return boolean hook return
*/
- function onRouterInitialized($m)
+ public function onRouterInitialized(URLMapper $m)
{
$m->connect('panel/bitly',
- array('action' => 'bitlyadminpanel'));
+ ['action' => 'bitlyadminpanel']);
return true;
}
return true;
}
- /**
- * Automatically load the actions and libraries used by the plugin
- *
- * @param Class $cls the class
- *
- * @return boolean hook return
- *
- */
- function onAutoload($cls)
- {
- $base = dirname(__FILE__);
- $lower = strtolower($cls);
- switch ($lower) {
- case 'bitlyadminpanelaction':
- require_once "$base/$lower.php";
- return false;
- default:
- return true;
- }
- }
-
/**
* Internal hook point to check the default global credentials so
* the admin form knows if we have a fallback or not.