2010-10-01 07:56:38 +09: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
|
|
|
|
{
|
2019-06-03 09:56:52 +09:00
|
|
|
const PLUGIN_VERSION = '2.0.0';
|
|
|
|
|
2010-10-01 07:56:38 +09:00
|
|
|
/**
|
|
|
|
* Hook for RouterInitialized event.
|
|
|
|
*
|
2014-11-07 23:24:05 +09:00
|
|
|
* @param URLMapper $m path-to-action mapper
|
2010-10-01 07:56:38 +09:00
|
|
|
* @return boolean hook return
|
|
|
|
*/
|
2014-11-07 23:24:05 +09:00
|
|
|
function onRouterInitialized(URLMapper $m)
|
2010-10-01 07:56:38 +09:00
|
|
|
{
|
|
|
|
$m->connect('group/:nickname/favorited',
|
|
|
|
array('action' => 'groupfavorited'),
|
|
|
|
array('nickname' => '[a-zA-Z0-9]+'));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-13 04:13:01 +09:00
|
|
|
function onEndGroupGroupNav(Menu $nav)
|
2010-10-01 07:56:38 +09: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-02 05:01:18 +09: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-13 04:13:01 +09:00
|
|
|
function onPluginVersion(array &$versions)
|
2010-10-02 05:01:18 +09:00
|
|
|
{
|
2016-01-23 01:38:42 +09:00
|
|
|
$url = 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/GroupFavorited';
|
2010-10-02 05:01:18 +09:00
|
|
|
|
|
|
|
$versions[] = array('name' => 'GroupFavorited',
|
2019-06-03 09:56:52 +09:00
|
|
|
'version' => self::PLUGIN_VERSION,
|
2010-10-02 05:01:18 +09: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-10-01 07:56:38 +09:00
|
|
|
}
|