1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
- }
- class ClientSideShortenPlugin extends Plugin
- {
- const PLUGIN_VERSION = '2.0.0';
- function __construct()
- {
- parent::__construct();
- }
- function onEndShowScripts($action){
- if (common_logged_in()) {
- $user = common_current_user();
- $action->inlineScript('var maxNoticeLength = ' . User_urlshortener_prefs::maxNoticeLength($user));
- $action->inlineScript('var maxUrlLength = ' . User_urlshortener_prefs::maxUrlLength($user));
- $action->script($this->path('shorten.js'));
- }
- }
- function onRouterInitialized($m)
- {
- if (common_logged_in()) {
- $m->connect('plugins/ClientSideShorten/shorten',
- ['action'=>'shorten']);
- }
- }
- public function onPluginVersion(array &$versions): bool
- {
- $versions[] = array('name' => 'Shorten',
- 'version' => self::PLUGIN_VERSION,
- 'author' => 'Craig Andrews',
- 'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/ClientSideShorten',
- 'rawdescription' =>
-
- _m('ClientSideShorten causes the web interface\'s notice form to automatically shorten URLs as they entered, and before the notice is submitted.'));
- return true;
- }
- }
|