upgrade plugin activityReport
This commit is contained in:
parent
3ffacaeb98
commit
3973df3fca
@ -1,3 +1,9 @@
|
||||
cinecturlink2 2.2 - 2023.10.18
|
||||
===========================================================
|
||||
* Require Dotclear 2.28
|
||||
* Require PHP 8.1
|
||||
* Upgrade plugin activityReport
|
||||
|
||||
cinecturlink2 2.1 - 2023.10.15
|
||||
===========================================================
|
||||
* Require Dotclear 2.28
|
||||
|
@ -1,8 +1,8 @@
|
||||
# README
|
||||
|
||||
[![Release](https://img.shields.io/badge/release-2.0-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/cinecturlink2/releases)
|
||||
![Date](https://img.shields.io/badge/date-2023.08.24-c44d58.svg)]
|
||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download)
|
||||
[![Release](https://img.shields.io/badge/release-2.2-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/cinecturlink2/releases)
|
||||
![Date](https://img.shields.io/badge/date-2023.10.18-c44d58.svg)]
|
||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
|
||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/cinecturlink2)
|
||||
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/cinecturlink2/src/branch/master/LICENSE)
|
||||
|
||||
|
@ -21,7 +21,7 @@ $this->registerModule(
|
||||
'Cinecturlink 2',
|
||||
'Widgets and pages about books, musics, films, blogs you are interested in',
|
||||
'Jean-Christian Denis and Contributors',
|
||||
'2.1',
|
||||
'2.2',
|
||||
[
|
||||
'requires' => [['core', '2.28']],
|
||||
'settings' => ['blog' => '#params.' . basename(__DIR__) . '_params'],
|
||||
|
@ -5,51 +5,67 @@ declare(strict_types=1);
|
||||
namespace Dotclear\Plugin\cinecturlink2;
|
||||
|
||||
use Dotclear\App;
|
||||
use Dotclear\Plugin\activityReport\ActivityReport;
|
||||
use Dotclear\Core\Process;
|
||||
use Dotclear\Database\Cursor;
|
||||
use Dotclear\Plugin\activityReport\{
|
||||
Action,
|
||||
ActivityReport,
|
||||
Group
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief cinecturlink2 activityReport class.
|
||||
* @brief cinecturlink2 plugin activityReport class.
|
||||
* @ingroup cinecturlink2
|
||||
*
|
||||
* @author Jean-Christian Denis (author)
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
class PluginActivityReport
|
||||
class ActivityReportAction extends Process
|
||||
{
|
||||
public static function add()
|
||||
public static function init(): bool
|
||||
{
|
||||
ActivityReport::instance()->addGroup('cinecturlink2', __('Plugin cinecturlink2'));
|
||||
return self::status(true);
|
||||
}
|
||||
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!self::status()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$group = new Group(My::id(), My::name());
|
||||
|
||||
// from BEHAVIOR cinecturlink2AfterAddLink in cinecturlink2/inc/class.cinecturlink2.php
|
||||
ActivityReport::instance()->addAction(
|
||||
'cinecturlink2',
|
||||
'create',
|
||||
$group->add(new Action(
|
||||
'cinecturlink2Create',
|
||||
__('link creation'),
|
||||
__('A new cineturlink named "%s" was added by "%s"'),
|
||||
'cinecturlink2AfterAddLink',
|
||||
self::addLink(...)
|
||||
);
|
||||
));
|
||||
// from BEHAVIOR cinecturlink2AfterUpdLink in cinecturlink2/inc/class.cinecturlink2.php
|
||||
ActivityReport::instance()->addAction(
|
||||
'cinecturlink2',
|
||||
'update',
|
||||
$group->add(new Action(
|
||||
'cinecturlink2Update',
|
||||
__('updating link'),
|
||||
__('Cinecturlink named "%s" has been updated by "%s"'),
|
||||
'cinecturlink2AfterUpdLink',
|
||||
self::updLink(...)
|
||||
);
|
||||
));
|
||||
// from BEHAVIOR cinecturlink2BeforeDelLink in cinecturlink2/inc/class.cinecturlink2.php
|
||||
ActivityReport::instance()->addAction(
|
||||
'cinecturlink2',
|
||||
'delete',
|
||||
$group->add(new Action(
|
||||
'cinecturlink2Delete',
|
||||
__('link deletion'),
|
||||
__('Cinecturlink named "%s" has been deleted by "%s"'),
|
||||
'cinecturlink2BeforeDelLink',
|
||||
self::delLink(...)
|
||||
);
|
||||
));
|
||||
|
||||
ActivityReport::instance()->groups->add($group);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function addLink($cur)
|
||||
public static function addLink(Cursor $cur)
|
||||
{
|
||||
$logs = [
|
||||
$cur->link_title,
|
||||
@ -58,7 +74,7 @@ class PluginActivityReport
|
||||
ActivityReport::instance()->addLog('cinecturlink2', 'create', $logs);
|
||||
}
|
||||
|
||||
public static function updLink($cur, $id)
|
||||
public static function updLink(Cursor $cur, int $id)
|
||||
{
|
||||
$C2 = new Utils();
|
||||
$rs = $C2->getLinks(['link_id' => $id]);
|
||||
@ -70,7 +86,7 @@ class PluginActivityReport
|
||||
ActivityReport::instance()->addLog('cinecturlink2', 'update', $logs);
|
||||
}
|
||||
|
||||
public static function delLink($id)
|
||||
public static function delLink(int $id)
|
||||
{
|
||||
$C2 = new Utils();
|
||||
$rs = $C2->getLinks(['link_id' => $id]);
|
@ -6,7 +6,6 @@ namespace Dotclear\Plugin\cinecturlink2;
|
||||
|
||||
use ArrayObject;
|
||||
use Dotclear\App;
|
||||
use Dotclear\Core\BlogSettings;
|
||||
use Dotclear\Core\Backend\Favorites;
|
||||
use Dotclear\Core\Process;
|
||||
use Dotclear\Helper\Html\Form\{
|
||||
@ -21,6 +20,7 @@ use Dotclear\Helper\Html\Form\{
|
||||
Text
|
||||
};
|
||||
use Dotclear\Helper\File\Files;
|
||||
use Dotclear\Interface\Core\BlogSettingsInterface;
|
||||
|
||||
/**
|
||||
* @brief cinecturlink2 backend class.
|
||||
@ -88,7 +88,7 @@ class Backend extends Process
|
||||
]);
|
||||
},
|
||||
|
||||
'adminBlogPreferencesFormV2' => function (BlogSettings $blog_settings): void {
|
||||
'adminBlogPreferencesFormV2' => function (BlogSettingsInterface $blog_settings): void {
|
||||
$s = $blog_settings->get(My::id());
|
||||
$url = App::blog()->url() . App::url()->getBase(My::id());
|
||||
$public_nbrpp = (int) $s->get('public_nbrpp');
|
||||
@ -197,7 +197,7 @@ class Backend extends Process
|
||||
->render();
|
||||
},
|
||||
|
||||
'adminBeforeBlogSettingsUpdate' => function (BlogSettings $blog_settings): void {
|
||||
'adminBeforeBlogSettingsUpdate' => function (BlogSettingsInterface $blog_settings): void {
|
||||
$s = $blog_settings->get(My::id());
|
||||
$active = !empty($_POST[My::id() . 'active']);
|
||||
$widthmax = abs((int) $_POST[My::id() . 'widthmax']);
|
||||
|
@ -39,10 +39,6 @@ class Prepend extends Process
|
||||
'sitemapsURLsCollect' => PluginSitemaps::sitemapsURLsCollect(...),
|
||||
]);
|
||||
|
||||
if (defined('ACTIVITY_REPORT_V2')) {
|
||||
PluginActivityReport::add();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user