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 {
16 const PLUGIN_VERSION = '2.0.0';
18 public function onRouterInitialized(URLMapper $m)
20 $m->connect('tags/', ['action' => 'publictagcloud']);
21 $m->connect('tag/', ['action' => 'publictagcloud']);
22 $m->connect('tags', ['action' => 'publictagcloud']);
23 $m->connect('tag', ['action' => 'publictagcloud']);
26 public function onEndPublicGroupNav(Menu $menu)
28 // TRANS: Menu item in search group navigation panel.
29 $menu->out->menuItem(common_local_url('publictagcloud'), _m('MENU','Recent tags'),
30 // TRANS: Menu item title in search group navigation panel.
31 _('Recent tags'), $menu->actionName === 'publictagcloud', 'nav_recent-tags');
34 public function onEndShowSections(Action $action)
39 case $action instanceof AllAction:
40 $cloud = new InboxTagCloudSection($action, $action->getTarget());
42 case $action instanceof AttachmentAction:
43 $cloud = new AttachmentTagCloudSection($action);
45 case $action instanceof PublicAction:
46 $cloud = new PublicTagCloudSection($action);
48 case $action instanceof ShowstreamAction:
49 $cloud = new PersonalTagCloudSection($action, $action->getTarget());
51 case $action instanceof GroupAction:
52 $cloud = new GroupTagCloudSection($action, $action->getGroup());
55 if (!is_null($cloud)) {
60 public function onPluginVersion(array &$versions)
62 $versions[] = array('name' => 'TagCloud',
63 'version' => self::PLUGIN_VERSION,
64 'author' => 'Mikael Nordfeldth',
65 'homepage' => 'https://gnu.io/social',
67 // TRANS: Plugin description.
68 _m('Adds tag clouds to stream pages'));