Compare commits

..

No commits in common. "111d495155b68ad3c783f19b4dd7acc9ceb6373c" and "45ea1216dca0ed5a7e623e3f4982c209df88631f" have entirely different histories.

8 changed files with 93 additions and 119 deletions

View File

@ -1,76 +1,58 @@
topWriter 1.3 - 2023.08.13 dev
=========================================================== - [ ] literal rank of writer depending of num of com
* Require Dotclear 2.27
* Require PHP 7.4
* Upgrade to Dotclear 2.27
* Move third party repository
* Use Dotclear style for CHANGELOG
topWriter 1.2 - 2023.04.23 1.2 - 2023.04.23
=========================================================== - require dotclear 2.26
* require dotclear 2.26 - use latest dotclear namespace
* use latest dotclear namespace - use sql statement
* use sql statement - fix plural translations
* fix plural translations - fix nullsafe warnings
* fix nullsafe warnings
topWriter 1.1 - 2023.03.21 1.1 - 2023.03.21
=========================================================== - require Dotclear 2.25
* require Dotclear 2.25 - use namespace
* use namespace
topWriter 1.0 - 2022.12.23 1.0 - 2022.12.23
=========================================================== - use dotclear methods for widgets
* use dotclear methods for widgets - fix permissions
* fix permissions
topWriter 0.10 - 2022.11.20 0.10 - 2022.11.20
=========================================================== - fix compatibility with Dotclear 2.24 (required)
* fix compatibility with Dotclear 2.24 (required)
topWriter 0.9 - 2021.11.06 0.9 - 2021.11.06
=========================================================== - add dashboard module
* add dashboard module - update translations
* update translations - update to PSR12
* update to PSR12
topWriter 0.8.1 - 2021.09.17 0.8.1 - 2021.09.17
=========================================================== - fix plurals and better translation
* fix plurals and better translation - update readme file
* update readme file
topWriter 0.8 - 2021.08.27 0.8 - 2021.08.27
=========================================================== - clean up (PSR2, short array, ...)
* clean up (PSR2, short array, ...) - update widget class
* update widget class - fix translations
* fix translations - update license
* update license
topWriter 0.7 - 25-04-2015 - Pierre Van Glabeke 0.7 - 25-04-2015 - Pierre Van Glabeke
=========================================================== - Modification url support
* Modification url support
topWriter 0.6 - 23-01-2015 - Pierre Van Glabeke 0.6 - 23-01-2015 - Pierre Van Glabeke
=========================================================== - Modifications locales pour widget
* Modifications locales pour widget
topWriter 0.5 - 19-01-2015 - Pierre Van Glabeke 0.5 - 19-01-2015 - Pierre Van Glabeke
=========================================================== - Compatibilité dc2.7
* Compatibilité dc2.7
topWriter 0.4 - 2013-11-12 0.4 - 2013-11-12
=========================================================== - Switch to Dotclear 2.6
* Switch to Dotclear 2.6 - Add widget options
* Add widget options - Use plural forms
* Use plural forms
topWriter 0.3 - 2010-10-06 0.3 - 2010-10-06
=========================================================== - Switched to DC 2.2
* Switched to DC 2.2 - Fixed list order (thanks to Atv')
* Fixed list order (thanks to Atv')
topWriter 0.2 - 2009-08-10 0.2 - 2009-08-10
=========================================================== - Fixed php 5.3 compatibility
* Fixed php 5.3 compatibility - Fixed PostGreSQL compatibility
* Fixed PostGreSQL compatibility - Added option to exclude post authors from comment list
* Added option to exclude post authors from comment list

View File

@ -1,10 +1,11 @@
# README # README
[![Release](https://img.shields.io/badge/release-1.3-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/topWriter/releases) [![Release](https://img.shields.io/github/v/release/JcDenis/topWriter)](https://github.com/JcDenis/topWriter/releases)
[![Date](https://img.shields.io/badge/date-2023.08.13-c44d58.svg)](https://git.dotclear.watch/JcDenis/topWriter/releases) [![Date](https://img.shields.io/github/release-date/JcDenis/topWriter)](https://github.com/JcDenis/topWriter/releases)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download) [![Issues](https://img.shields.io/github/issues/JcDenis/topWriter)](https://github.com/JcDenis/topWriter/issues)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/topWriter) [![Dotclear](https://img.shields.io/badge/dotclear-v2.26-blue.svg)](https://fr.dotclear.org/download)
[![License](https://img.shields.io/github/license/JcDenis/topWriter)](https://git.dotclear.watch/JcDenis/topWriter/blob/master/LICENSE) [![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/topWriter)
[![License](https://img.shields.io/github/license/JcDenis/topWriter)](https://github.com/JcDenis/topWriter/blob/master/LICENSE)
## WHAT IS TOPWRITER ? ## WHAT IS TOPWRITER ?
@ -18,8 +19,7 @@ Show most active contributor on a widget.
_topWriter_ requires: _topWriter_ requires:
* permissions to manage widgets * permissions to manage widgets
* Dotclear 2.27 * Dotclear 2.26
* PHP 7.4
## USAGE ## USAGE
@ -28,18 +28,17 @@ Dotaddict repository. (See Dotclear's documentation to know how do this)
Add and configure _Top writer_ from widgets manager. Add and configure _Top writer_ from widgets manager.
There are two widget: entries and comments. There are two widget: entries and comments.
Or add contents to the backend dashboard from your preferences.
## LINKS ## LINKS
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html) * License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/topWriter) or [GitHub Page](https://github.com/JcDenis/topWriter) * Source & contribution : [GitHub Page](https://github.com/JcDenis/topWriter)
* Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/topWriter/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/topWriter) * Packages & details : [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/topWriter)
* Discuss and help : [Dotclear Forum](http://forum.dotclear.org/viewtopic.php?pid=333002#p333002) * Discuss and help : [Dotclear Forum](http://forum.dotclear.org/viewtopic.php?pid=333002#p333002)
## CONTRIBUTORS ## CONTRIBUTORS
* Jean-Christian Denis (author) * Jean-Christian Denis
* Pierre Van Glabeke * Pierre Van Glabeke
You are welcome to contribute to this code. You are welcome to contribute to this code.

View File

@ -10,7 +10,7 @@
* @copyright Jean-Christian Denis * @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
if (!defined('DC_RC_PATH')) { if (!defined('DC_RC_PATH') || is_null(dcCore::app()->auth)) {
return null; return null;
} }
@ -18,15 +18,15 @@ $this->registerModule(
'Top writer', 'Top writer',
'Ranking of the most prolific writers and/or commentators', 'Ranking of the most prolific writers and/or commentators',
'Jean-Christian Denis, Pierre Van Glabeke', 'Jean-Christian Denis, Pierre Van Glabeke',
'1.3', '1.2',
[ [
'requires' => [['core', '2.27']], 'requires' => [['core', '2.26']],
'permissions' => dcCore::app()->auth->makePermissions([ 'permissions' => dcCore::app()->auth->makePermissions([
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN, dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
]), ]),
'type' => 'plugin', 'type' => 'plugin',
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues', 'support' => 'http://forum.dotclear.org/viewtopic.php?pid=333002#p333002',
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md', 'details' => 'http://plugins.dotaddict.org/dc2/details/topWriter',
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml', 'repository' => 'https://raw.githubusercontent.com/JcDenis/topWriter/master/dcstore.xml',
] ]
); );

View File

@ -2,12 +2,12 @@
<modules xmlns:da="http://dotaddict.org/da/"> <modules xmlns:da="http://dotaddict.org/da/">
<module id="topWriter"> <module id="topWriter">
<name>Top writer</name> <name>Top writer</name>
<version>1.3</version> <version>1.2</version>
<author>Jean-Christian Denis, Pierre Van Glabeke</author> <author>Jean-Christian Denis, Pierre Van Glabeke</author>
<desc>Ranking of the most prolific writers and/or commentators</desc> <desc>Ranking of the most prolific writers and/or commentators</desc>
<file>https://git.dotclear.watch/JcDenis/topWriter/releases/download/v1.3/plugin-topWriter.zip</file> <file>https://github.com/JcDenis/topWriter/releases/download/v1.2/plugin-topWriter.zip</file>
<da:dcmin>2.27</da:dcmin> <da:dcmin>2.26</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/topWriter/src/branch/master/README.md</da:details> <da:details>http://plugins.dotaddict.org/dc2/details/topWriter</da:details>
<da:support>https://git.dotclear.watch/JcDenis/topWriter/issues</da:support> <da:support>http://forum.dotclear.org/viewtopic.php?pid=333002#p333002</da:support>
</module> </module>
</modules> </modules>

View File

@ -15,18 +15,20 @@ declare(strict_types=1);
namespace Dotclear\Plugin\topWriter; namespace Dotclear\Plugin\topWriter;
use dcCore; use dcCore;
use Dotclear\Core\Process; use dcNsProcess;
class Backend extends Process class Backend extends dcNsProcess
{ {
public static function init(): bool public static function init(): bool
{ {
return self::status(My::checkContext(My::BACKEND)); static::$init = defined('DC_CONTEXT_ADMIN');
return static::$init;
} }
public static function process(): bool public static function process(): bool
{ {
if (!self::status()) { if (!static::$init) {
return false; return false;
} }

View File

@ -114,6 +114,11 @@ class BackendBehaviors
public static function adminAfterDashboardOptionsUpdate(?string $user_id): void public static function adminAfterDashboardOptionsUpdate(?string $user_id): void
{ {
// nullsafe
if (is_null(dcCore::app()->auth) || is_null(dcCore::app()->auth->user_prefs)) {
return;
}
dcCore::app()->auth->user_prefs->get('dashboard')->put( dcCore::app()->auth->user_prefs->get('dashboard')->put(
'topWriterPostsItems', 'topWriterPostsItems',
!empty($_POST['topWriterPostsItems']), !empty($_POST['topWriterPostsItems']),
@ -149,6 +154,11 @@ class BackendBehaviors
private static function setDefaultPref(): array private static function setDefaultPref(): array
{ {
// nullsafe
if (is_null(dcCore::app()->auth) || is_null(dcCore::app()->auth->user_prefs)) {
return [];
}
if (!dcCore::app()->auth->user_prefs->get('dashboard')->prefExists('topWriterPostsItems')) { if (!dcCore::app()->auth->user_prefs->get('dashboard')->prefExists('topWriterPostsItems')) {
dcCore::app()->auth->user_prefs->get('dashboard')->put( dcCore::app()->auth->user_prefs->get('dashboard')->put(
'topWriterPostsItems', 'topWriterPostsItems',

View File

@ -15,18 +15,20 @@ declare(strict_types=1);
namespace Dotclear\Plugin\topWriter; namespace Dotclear\Plugin\topWriter;
use dcCore; use dcCore;
use Dotclear\Core\Process; use dcNsProcess;
class Frontend extends Process class Frontend extends dcNsProcess
{ {
public static function init(): bool public static function init(): bool
{ {
return self::status(My::checkContext(My::FRONTEND)); static::$init = true;
return static::$init;
} }
public static function process(): bool public static function process(): bool
{ {
if (!self::status()) { if (!static::$init) {
return false; return false;
} }

View File

@ -1,21 +0,0 @@
<?php
/**
* @brief topWriter, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis, Pierre Van Glabeke
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1);
namespace Dotclear\Plugin\topWriter;
use Dotclear\Module\MyPlugin;
class My extends MyPlugin
{
}