[TagCloud] Add Readme

This commit is contained in:
Diogo Cordeiro 2019-08-11 04:21:26 +01:00
parent 49da433879
commit 2a82cfdb2a
2 changed files with 54 additions and 27 deletions

11
plugins/TagCloud/README Normal file
View File

@ -0,0 +1,11 @@
Add "tag clouds" in the UI
Installation
============
add "addModule('TagCloud');"
to the bottom of your config.php
Settings
========
No settings.

View File

@ -1,16 +1,30 @@
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/** /**
* GNU social plugin for "tag clouds" in the UI * GNU social plugin for "tag clouds" in the UI
* *
* @category UI * @category UI
* @package GNUsocial * @package GNUsocial
* @author Mikael Nordfeldth <mmn@hethane.se> * @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2016 Free Software Foundation, Inc. * @copyright 2016 Free Software Foundation, Inc http://www.fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
* @link http://gnu.io/social/
*/ */
if (!defined('GNUSOCIAL')) { exit(1); } defined('GNUSOCIAL') || die();
class TagCloudPlugin extends Plugin { class TagCloudPlugin extends Plugin {
const PLUGIN_VERSION = '2.0.0'; const PLUGIN_VERSION = '2.0.0';
@ -27,8 +41,8 @@ class TagCloudPlugin extends Plugin {
{ {
// TRANS: Menu item in search group navigation panel. // TRANS: Menu item in search group navigation panel.
$menu->out->menuItem(common_local_url('publictagcloud'), _m('MENU','Recent tags'), $menu->out->menuItem(common_local_url('publictagcloud'), _m('MENU','Recent tags'),
// TRANS: Menu item title in search group navigation panel. // TRANS: Menu item title in search group navigation panel.
_('Recent tags'), $menu->actionName === 'publictagcloud', 'nav_recent-tags'); _('Recent tags'), $menu->actionName === 'publictagcloud', 'nav_recent-tags');
} }
public function onEndShowSections(Action $action) public function onEndShowSections(Action $action)
@ -36,20 +50,20 @@ class TagCloudPlugin extends Plugin {
$cloud = null; $cloud = null;
switch (true) { switch (true) {
case $action instanceof AllAction: case $action instanceof AllAction:
$cloud = new InboxTagCloudSection($action, $action->getTarget()); $cloud = new InboxTagCloudSection($action, $action->getTarget());
break; break;
case $action instanceof AttachmentAction: case $action instanceof AttachmentAction:
$cloud = new AttachmentTagCloudSection($action); $cloud = new AttachmentTagCloudSection($action);
break; break;
case $action instanceof PublicAction: case $action instanceof PublicAction:
$cloud = new PublicTagCloudSection($action); $cloud = new PublicTagCloudSection($action);
break; break;
case $action instanceof ShowstreamAction: case $action instanceof ShowstreamAction:
$cloud = new PersonalTagCloudSection($action, $action->getTarget()); $cloud = new PersonalTagCloudSection($action, $action->getTarget());
break; break;
case $action instanceof GroupAction: case $action instanceof GroupAction:
$cloud = new GroupTagCloudSection($action, $action->getGroup()); $cloud = new GroupTagCloudSection($action, $action->getGroup());
} }
if (!is_null($cloud)) { if (!is_null($cloud)) {
@ -59,13 +73,15 @@ class TagCloudPlugin extends Plugin {
public function onPluginVersion(array &$versions): bool public function onPluginVersion(array &$versions): bool
{ {
$versions[] = array('name' => 'TagCloud', $versions[] = [
'version' => self::PLUGIN_VERSION, 'name' => 'TagCloud',
'author' => 'Mikael Nordfeldth', 'version' => self::PLUGIN_VERSION,
'homepage' => 'https://gnu.io/social', 'author' => 'Mikael Nordfeldth',
'description' => 'homepage' => 'https://gnu.io/social',
// TRANS: Plugin description. 'description' =>
_m('Adds tag clouds to stream pages')); // TRANS: Module description.
_m('Adds tag clouds to stream pages')
];
return true; return true;
} }
} }