2010-09-30 23:56:38 +01:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* StatusNet - the distributed open-source microblogging tool
|
|
|
|
* Copyright (C) 2010, StatusNet, Inc.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @package GroupFavoritedPlugin
|
|
|
|
* @maintainer Brion Vibber <brion@status.net>
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!defined('STATUSNET')) { exit(1); }
|
|
|
|
|
|
|
|
class GroupFavoritedPlugin extends Plugin
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Hook for RouterInitialized event.
|
|
|
|
*
|
2014-11-07 14:24:05 +00:00
|
|
|
* @param URLMapper $m path-to-action mapper
|
2010-09-30 23:56:38 +01:00
|
|
|
* @return boolean hook return
|
|
|
|
*/
|
2014-11-07 14:24:05 +00:00
|
|
|
function onRouterInitialized(URLMapper $m)
|
2010-09-30 23:56:38 +01:00
|
|
|
{
|
|
|
|
$m->connect('group/:nickname/favorited',
|
|
|
|
array('action' => 'groupfavorited'),
|
|
|
|
array('nickname' => '[a-zA-Z0-9]+'));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-12 20:13:01 +01:00
|
|
|
function onEndGroupGroupNav(Menu $nav)
|
2010-09-30 23:56:38 +01:00
|
|
|
{
|
|
|
|
$action_name = $nav->action->trimmed('action');
|
|
|
|
$nickname = $nav->group->nickname;
|
|
|
|
$nav->out->menuItem(common_local_url('groupfavorited', array('nickname' =>
|
|
|
|
$nickname)),
|
|
|
|
// TRANS: Menu item in the group navigation page.
|
|
|
|
_m('MENU', 'Popular'),
|
|
|
|
// TRANS: Tooltip for menu item in the group navigation page.
|
|
|
|
// TRANS: %s is the nickname of the group.
|
|
|
|
sprintf(_m('TOOLTIP','Popular notices in %s group'), $nickname),
|
|
|
|
$action_name == 'groupfavorited',
|
|
|
|
'nav_group_group');
|
|
|
|
}
|
2010-10-01 21:01:18 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Provide plugin version information.
|
|
|
|
*
|
|
|
|
* This data is used when showing the version page.
|
|
|
|
*
|
|
|
|
* @param array &$versions array of version data arrays; see EVENTS.txt
|
|
|
|
*
|
|
|
|
* @return boolean hook value
|
|
|
|
*/
|
2014-09-12 20:13:01 +01:00
|
|
|
function onPluginVersion(array &$versions)
|
2010-10-01 21:01:18 +01:00
|
|
|
{
|
2016-01-22 16:38:42 +00:00
|
|
|
$url = 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/GroupFavorited';
|
2010-10-01 21:01:18 +01:00
|
|
|
|
|
|
|
$versions[] = array('name' => 'GroupFavorited',
|
2013-11-01 12:51:41 +00:00
|
|
|
'version' => GNUSOCIAL_VERSION,
|
2010-10-01 21:01:18 +01:00
|
|
|
'author' => 'Brion Vibber',
|
|
|
|
'homepage' => $url,
|
|
|
|
'rawdescription' =>
|
|
|
|
// TRANS: Plugin description.
|
|
|
|
_m('This plugin adds a menu item for popular notices in groups.'));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2010-09-30 23:56:38 +01:00
|
|
|
}
|