3 * StatusNet - the distributed open-source microblogging tool
4 * Copyright (C) 2010, StatusNet, Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 if (!defined('GNUSOCIAL')) { exit(1); }
23 * Some UI extras for now...
25 * @package ModPlusPlugin
26 * @maintainer Brion Vibber <brion@status.net>
28 class ModPlusPlugin extends Plugin
30 const PLUGIN_VERSION = '2.0.0';
32 function onPluginVersion(array &$versions)
34 $versions[] = array('name' => 'ModPlus',
35 'version' => self::PLUGIN_VERSION,
36 'author' => 'Brion Vibber',
37 'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/ModPlus',
39 // TRANS: Plugin description.
40 _m('UI extension for profile moderation actions.'));
48 * @param Action $action
49 * @return boolean hook result
51 function onEndShowScripts(Action $action)
53 $action->script($this->path('js/modplus.js'));
57 public function onEndShowStylesheets(Action $action) {
58 $action->cssLink($this->path('css/modplus.css'));
63 * Add per-profile info popup menu for author on notice lists.
65 * @param NoticeListItem $item
66 * @return boolean hook value
68 function onEndShowNoticeItemAuthor(Profile $profile, HTMLOutputter $out)
70 $this->showProfileOptions($out, $profile);
75 * Add per-profile info popup menu on profile lists.
77 * @param ProfileListItem $item
79 function onStartProfileListItemProfile($item)
81 $this->showProfileOptions($item->out, $item->profile->getProfile());
86 * Build common remote-profile options structure.
87 * Currently only adds output for remote profiles, nothing for local users.
89 * @param HTMLOutputter $out
90 * @param Profile $profile
92 protected function showProfileOptions(HTMLOutputter $out, Profile $profile)
94 if (!$profile->isGroup() && !$profile->isLocal()) {
95 $target = common_local_url('userbyid', array('id' => $profile->getID()));
96 // TRANS: Label for access to remote profile options.
97 $label = _m('Remote profile options...');
98 $out->elementStart('div', 'remote-profile-options');
99 $out->element('a', array('href' => $target), $label);
100 $out->elementEnd('div');