123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- defined('GNUSOCIAL') || die();
- class GroupFavoritedPlugin extends Plugin
- {
- const PLUGIN_VERSION = '2.0.1';
-
- public function onRouterInitialized(URLMapper $m)
- {
- $m->connect(
- 'group/:nickname/favorited',
- ['action' => 'groupfavorited'],
- ['nickname' => '[a-zA-Z0-9]+']
- );
- return true;
- }
- public function onEndGroupActionsList(GroupProfileBlock $nav, User_group $group)
- {
- $nav->out->elementStart('li', 'entity_popular');
- $nav->out->element(
- 'a',
- [
- 'href' => common_local_url(
- 'groupfavorited',
- ['nickname' => $group->nickname]
- ),
-
-
- 'title' => sprintf(_m('TOOLTIP', 'Popular notices in %s group'), $group->nickname)
- ],
-
- _m('MENU', 'Popular')
- );
- $nav->out->elementEnd('li');
- }
-
- public function onPluginVersion(array &$versions): bool
- {
- $url = GNUSOCIAL_ENGINE_REPO_URL . 'tree/master/plugins/GroupFavorited';
- $versions[] = ['name' => 'GroupFavorited',
- 'version' => self::PLUGIN_VERSION,
- 'author' => 'Brion Vibber',
- 'homepage' => $url,
- 'rawdescription' =>
-
- _m('This plugin adds a menu item for popular notices in groups.')
- ];
- return true;
- }
- }
|