From a43c10582fd0c0e1a9afe1949efc9b7a0503d475 Mon Sep 17 00:00:00 2001 From: Diogo Cordeiro Date: Sun, 11 Aug 2019 04:21:26 +0100 Subject: [PATCH] [TagCloud] Add Readme --- plugins/TagCloud/README | 11 +++++ plugins/TagCloud/TagCloudPlugin.php | 70 ++++++++++++++++++----------- 2 files changed, 54 insertions(+), 27 deletions(-) create mode 100644 plugins/TagCloud/README diff --git a/plugins/TagCloud/README b/plugins/TagCloud/README new file mode 100644 index 0000000000..fd4d6064ab --- /dev/null +++ b/plugins/TagCloud/README @@ -0,0 +1,11 @@ +Add "tag clouds" in the UI + +Installation +============ +add "addModule('TagCloud');" +to the bottom of your config.php + +Settings +======== +No settings. + diff --git a/plugins/TagCloud/TagCloudPlugin.php b/plugins/TagCloud/TagCloudPlugin.php index d896b00ca8..ab75f5d980 100644 --- a/plugins/TagCloud/TagCloudPlugin.php +++ b/plugins/TagCloud/TagCloudPlugin.php @@ -1,16 +1,30 @@ . + /** * GNU social plugin for "tag clouds" in the UI * * @category UI * @package GNUsocial * @author Mikael Nordfeldth - * @copyright 2016 Free Software Foundation, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 - * @link http://gnu.io/social/ + * @copyright 2016 Free Software Foundation, Inc http://www.fsf.org + * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ -if (!defined('GNUSOCIAL')) { exit(1); } +defined('GNUSOCIAL') || die(); class TagCloudPlugin extends Plugin { const PLUGIN_VERSION = '2.0.0'; @@ -27,8 +41,8 @@ class TagCloudPlugin extends Plugin { { // TRANS: Menu item in search group navigation panel. $menu->out->menuItem(common_local_url('publictagcloud'), _m('MENU','Recent tags'), - // TRANS: Menu item title in search group navigation panel. - _('Recent tags'), $menu->actionName === 'publictagcloud', 'nav_recent-tags'); + // TRANS: Menu item title in search group navigation panel. + _('Recent tags'), $menu->actionName === 'publictagcloud', 'nav_recent-tags'); } public function onEndShowSections(Action $action) @@ -36,20 +50,20 @@ class TagCloudPlugin extends Plugin { $cloud = null; switch (true) { - case $action instanceof AllAction: - $cloud = new InboxTagCloudSection($action, $action->getTarget()); - break; - case $action instanceof AttachmentAction: - $cloud = new AttachmentTagCloudSection($action); - break; - case $action instanceof PublicAction: - $cloud = new PublicTagCloudSection($action); - break; - case $action instanceof ShowstreamAction: - $cloud = new PersonalTagCloudSection($action, $action->getTarget()); - break; - case $action instanceof GroupAction: - $cloud = new GroupTagCloudSection($action, $action->getGroup()); + case $action instanceof AllAction: + $cloud = new InboxTagCloudSection($action, $action->getTarget()); + break; + case $action instanceof AttachmentAction: + $cloud = new AttachmentTagCloudSection($action); + break; + case $action instanceof PublicAction: + $cloud = new PublicTagCloudSection($action); + break; + case $action instanceof ShowstreamAction: + $cloud = new PersonalTagCloudSection($action, $action->getTarget()); + break; + case $action instanceof GroupAction: + $cloud = new GroupTagCloudSection($action, $action->getGroup()); } if (!is_null($cloud)) { @@ -59,13 +73,15 @@ class TagCloudPlugin extends Plugin { public function onPluginVersion(array &$versions): bool { - $versions[] = array('name' => 'TagCloud', - 'version' => self::PLUGIN_VERSION, - 'author' => 'Mikael Nordfeldth', - 'homepage' => 'https://gnu.io/social', - 'description' => - // TRANS: Plugin description. - _m('Adds tag clouds to stream pages')); + $versions[] = [ + 'name' => 'TagCloud', + 'version' => self::PLUGIN_VERSION, + 'author' => 'Mikael Nordfeldth', + 'homepage' => 'https://gnu.io/social', + 'description' => + // TRANS: Module description. + _m('Adds tag clouds to stream pages') + ]; return true; } }