From 65796ba03ba4cd0470a1e9790d2234c8b42d6cba Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 21 Apr 2010 17:14:54 -0400 Subject: add ClientSideShortenPlugin see plugins/ClientSideShorten/README --- .../ClientSideShorten/ClientSideShortenPlugin.php | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 plugins/ClientSideShorten/ClientSideShortenPlugin.php (limited to 'plugins/ClientSideShorten/ClientSideShortenPlugin.php') diff --git a/plugins/ClientSideShorten/ClientSideShortenPlugin.php b/plugins/ClientSideShorten/ClientSideShortenPlugin.php new file mode 100644 index 000000000..21763d5b7 --- /dev/null +++ b/plugins/ClientSideShorten/ClientSideShortenPlugin.php @@ -0,0 +1,78 @@ +. + * + * @category Plugin + * @package StatusNet + * @author Craig Andrews + * @copyright 2009 Craig Andrews http://candrews.integralblue.com + * @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') && !defined('LACONICA')) { + exit(1); +} + +require_once(INSTALLDIR.'/plugins/ClientSideShorten/shorten.php'); + +class ClientSideShortenPlugin extends Plugin +{ + function __construct() + { + parent::__construct(); + } + + function onAutoload($cls) + { + switch ($cls) + { + case 'ShortenAction': + require_once(INSTALLDIR.'/plugins/ClientSideShorten/shorten.php'); + return false; + } + } + + function onEndShowScripts($action){ + if (common_logged_in()) { + $action->script('plugins/ClientSideShorten/shorten.js'); + } + } + + function onRouterInitialized($m) + { + if (common_logged_in()) { + $m->connect('plugins/ClientSideShorten/shorten', array('action'=>'shorten')); + } + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'Shorten', + 'version' => STATUSNET_VERSION, + 'author' => 'Craig Andrews', + 'homepage' => 'http://status.net/wiki/Plugin: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; + } + +} + -- cgit v1.2.3-54-g00ecf