3 * GNU social plugin for "tag clouds" in the UI
7 * @author Mikael Nordfeldth <mmn@hethane.se>
8 * @copyright 2016 Free Software Foundation, Inc.
9 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
10 * @link http://gnu.io/social/
13 if (!defined('GNUSOCIAL')) { exit(1); }
15 class TagCloudPlugin extends Plugin {
17 public function onRouterInitialized(URLMapper $m)
19 $m->connect('tags/', array('action' => 'publictagcloud'));
20 $m->connect('tag/', array('action' => 'publictagcloud'));
21 $m->connect('tags', array('action' => 'publictagcloud'));
22 $m->connect('tag', array('action' => 'publictagcloud'));
25 public function onEndPublicGroupNav(Menu $menu)
27 // TRANS: Menu item in search group navigation panel.
28 $menu->out->menuItem(common_local_url('publictagcloud'), _m('MENU','Recent tags'),
29 // TRANS: Menu item title in search group navigation panel.
30 _('Recent tags'), $menu->actionName === 'publictagcloud', 'nav_recent-tags');
33 public function onEndShowSections(Action $action)
38 case $action instanceof AllAction:
39 $cloud = new InboxTagCloudSection($action, $action->getTarget());
41 case $action instanceof AttachmentAction:
42 $cloud = new AttachmentTagCloudSection($action);
44 case $action instanceof PublicAction:
45 $cloud = new PublicTagCloudSection($action);
47 case $action instanceof ShowstreamAction:
48 $cloud = new PersonalTagCloudSection($action, $action->getTarget());
50 case $action instanceof GroupAction:
51 $cloud = new GroupTagCloudSection($action, $action->getGroup());
54 if (!is_null($cloud)) {
59 public function onPluginVersion(array &$versions)
61 $versions[] = array('name' => 'TagCloud',
62 'version' => GNUSOCIAL_VERSION,
63 'author' => 'Mikael Nordfeldth',
64 'homepage' => 'https://gnu.io/social',
66 // TRANS: Plugin description.
67 _m('Adds tag clouds to stream pages'));