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
30 * Hook for RouterInitialized event.
32 * @param URLMapper $m path-to-action mapper
33 * @return boolean hook return
35 function onRouterInitialized(URLMapper $m)
37 $m->connect('group/:nickname/favorited',
38 array('action' => 'groupfavorited'),
39 array('nickname' => '[a-zA-Z0-9]+'));
44 function onEndGroupGroupNav(Menu $nav)
46 $action_name = $nav->action->trimmed('action');
47 $nickname = $nav->group->nickname;
48 $nav->out->menuItem(common_local_url('groupfavorited', array('nickname' =>
50 // TRANS: Menu item in the group navigation page.
51 _m('MENU', 'Popular'),
52 // TRANS: Tooltip for menu item in the group navigation page.
53 // TRANS: %s is the nickname of the group.
54 sprintf(_m('TOOLTIP','Popular notices in %s group'), $nickname),
55 $action_name == 'groupfavorited',
60 * Provide plugin version information.
62 * This data is used when showing the version page.
64 * @param array &$versions array of version data arrays; see EVENTS.txt
66 * @return boolean hook value
68 function onPluginVersion(array &$versions)
70 $url = 'http://status.net/wiki/Plugin:GroupFavorited';
72 $versions[] = array('name' => 'GroupFavorited',
73 'version' => GNUSOCIAL_VERSION,
74 'author' => 'Brion Vibber',
77 // TRANS: Plugin description.
78 _m('This plugin adds a menu item for popular notices in groups.'));