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/>.
21 * @package GroupFavoritedPlugin
22 * @maintainer Brion Vibber <brion@status.net>
25 if (!defined('STATUSNET')) { exit(1); }
27 class GroupFavoritedPlugin extends Plugin
29 const PLUGIN_VERSION = '2.0.0';
32 * Hook for RouterInitialized event.
34 * @param URLMapper $m path-to-action mapper
35 * @return boolean hook return
37 function onRouterInitialized(URLMapper $m)
39 $m->connect('group/:nickname/favorited',
40 array('action' => 'groupfavorited'),
41 array('nickname' => '[a-zA-Z0-9]+'));
46 function onEndGroupGroupNav(Menu $nav)
48 $action_name = $nav->action->trimmed('action');
49 $nickname = $nav->group->nickname;
50 $nav->out->menuItem(common_local_url('groupfavorited', array('nickname' =>
52 // TRANS: Menu item in the group navigation page.
53 _m('MENU', 'Popular'),
54 // TRANS: Tooltip for menu item in the group navigation page.
55 // TRANS: %s is the nickname of the group.
56 sprintf(_m('TOOLTIP','Popular notices in %s group'), $nickname),
57 $action_name == 'groupfavorited',
62 * Provide plugin version information.
64 * This data is used when showing the version page.
66 * @param array &$versions array of version data arrays; see EVENTS.txt
68 * @return boolean hook value
70 function onPluginVersion(array &$versions)
72 $url = 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/GroupFavorited';
74 $versions[] = array('name' => 'GroupFavorited',
75 'version' => self::PLUGIN_VERSION,
76 'author' => 'Brion Vibber',
79 // TRANS: Plugin description.
80 _m('This plugin adds a menu item for popular notices in groups.'));