Compare commits

..

6 Commits
v1.4 ... master

Author SHA1 Message Date
9e1c801a66
code review 2023-10-24 21:27:03 +02:00
3f3f0c0521
oups 2023-10-24 00:11:17 +02:00
c403444100
fix repo URL 2023-10-24 00:08:13 +02:00
cb9d370ed4
fix maxlength typo 2023-10-24 00:07:48 +02:00
8da1d0fbc6
oups 2023-10-16 23:12:29 +02:00
ed0ca29b7c
upgrade to Dotclear 2.28 2023-10-16 23:09:29 +02:00
13 changed files with 249 additions and 290 deletions

View File

@ -1,3 +1,15 @@
fac 1.5.1 - 2023.10.24
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1+
* Code review
fac 1.5 - 2023.10.16
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1+
* Upgrade to Dotclear 2.28
fac 1.4 - 2023.08.12 fac 1.4 - 2023.08.12
=========================================================== ===========================================================
* Require Dotclear 2.27 * Require Dotclear 2.27

View File

@ -1,29 +1,25 @@
# README # README
[![Release](https://img.shields.io/badge/release-1.4-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/fac/releases) [![Release](https://img.shields.io/badge/release-1.5.1-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/fac/releases)
[![Date](https://img.shields.io/badge/date-2023.08.12-c44d58.svg)](https://git.dotclear.watch/JcDenis/fac/releases) ![Date](https://img.shields.io/badge/date-2023.10.24-c44d58.svg)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download) [![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/fac) [![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/fac)
[![License](https://img.shields.io/github/license/JcDenis/fac)](https://git.dotclear.watch/JcDenis/fac/blob/master/LICENSE) [![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/fac/src/branch/master/LICENSE)
## WHAT IS FAC ? ## ABOUT
_fac_ "Feed After Content" is a plugin for the open-source _fac_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
web publishing software called Dotclear.
It add options to the sidebar of post edition page > Add options to the sidebar of post edition page to link en extenal feed to the bottom of an entry.
to link en extenal feed to the bottom of an entry.
## REQUIREMENTS ## REQUIREMENTS
_fac_ requires: * Dotclear 2.28
* PHP 8.1+
* superadmin to configure feeds formats
* admin permissions to configure plugin
* usage,contentadmin permissions to link feeds
* Dotclear 2.27
* PHP 7.4+
* A theme that contents behavior publicEntryAfterContent * A theme that contents behavior publicEntryAfterContent
* Dotclear superadmin to configure feeds formats
* Dotclear admin permissions to configure plugin
* Dotclear usage or contentadmin permissions to link feeds
## USAGE ## USAGE
@ -41,12 +37,13 @@ This plugins also supports pages from plugin "muppet".
## LINKS ## LINKS
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html) * [License](https://git.dotclear.watch/JcDenis/fac/src/branch/master/LICENSE)
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/fac) or [GitHub Page](https://github.com/JcDenis/fac) * [Packages & details](https://git.dotclear.watch/JcDenis/fac/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/fac))
* Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/fac/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/fac) * [Sources & contributions](https://git.dotclear.watch/JcDenis/fac) (or on [GitHub](https://github.com/JcDenis/fac))
* [Issues & security](https://git.dotclear.watch/JcDenis/fac/issues) (or on [GitHub](https://github.com/JcDenis/fac/issues))
## CONTRIBUTORS ## CONTRIBUTORS
* Jean-Christian Denis * Jean-Christian Denis (author)
You are welcome to contribute to this code. You are welcome to contribute to this code.

View File

@ -1,33 +1,27 @@
<?php <?php
/** /**
* @brief fac, a plugin for Dotclear 2 * @file
* @brief The plugin fac definition
* @ingroup fac
* *
* @package Dotclear * @defgroup fac Plugin fac.
* @subpackage Plugin
* *
* @author Jean-Christian Denis and Contributors * Add RSS/Atom feeds after entries content.
* *
* @copyright Jean-Christian Denis * @author Jean-Christian Denis (author)
* @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')) { declare(strict_types=1);
return null;
}
$this->registerModule( $this->registerModule(
'Feed after content', 'Feed after content',
'Add RSS/Atom feeds after entries content', 'Add RSS/Atom feeds after entries content',
'Jean-Christian Denis and Contributors', 'Jean-Christian Denis and Contributors',
'1.4', '1.5.1',
[ [
'requires' => [['core', '2.27']], 'requires' => [['core', '2.28']],
'permissions' => dcCore::app()->auth->makePermissions([ 'permissions' => 'My',
dcAuth::PERMISSION_USAGE, 'settings' => ['blog' => '#params.' . basename(__DIR__) . '_params'],
dcAuth::PERMISSION_CONTENT_ADMIN,
]),
'settings' => [
'blog' => '#params.' . basename(__DIR__) . '_params',
],
'type' => 'plugin', 'type' => 'plugin',
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues', 'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md', 'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',

View File

@ -2,11 +2,11 @@
<modules xmlns:da="http://dotaddict.org/da/"> <modules xmlns:da="http://dotaddict.org/da/">
<module id="fac"> <module id="fac">
<name>Feed after content</name> <name>Feed after content</name>
<version>1.4</version> <version>1.5.1</version>
<author>Jean-Christian Denis and Contributors</author> <author>Jean-Christian Denis and Contributors</author>
<desc>Add RSS/Atom feeds after entries content</desc> <desc>Add RSS/Atom feeds after entries content</desc>
<file>https://git.dotclear.watch/JcDenis/fac/releases/download/v1.4/plugin-fac.zip</file> <file>https://git.dotclear.watch/JcDenis/fac/releases/download/v1.5.1/plugin-fac.zip</file>
<da:dcmin>2.27</da:dcmin> <da:dcmin>2.28</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/fac/src/branch/master/README.md</da:details> <da:details>https://git.dotclear.watch/JcDenis/fac/src/branch/master/README.md</da:details>
<da:support>https://git.dotclear.watch/JcDenis/fac/issues</da:support> <da:support>https://git.dotclear.watch/JcDenis/fac/issues</da:support>
</module> </module>

View File

@ -1,17 +1,10 @@
<?php <?php
/** /**
* @brief fac, a plugin for Dotclear 2 * @file
* @brief The plugin fac resources
* @ingroup fac
* *
* @package Dotclear * @author Jean-Christian Denis
* @subpackage Plugin
*
* @author Jean-Christian Denis and Contributors
*
* @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')) { \Dotclear\App::backend()->resources()->set('help', 'fac', __DIR__ . '/help/fac.html');
return;
}
dcCore::app()->resources['help']['fac'] = __DIR__ . '/help/fac.html';

View File

@ -1,17 +1,10 @@
<?php <?php
/** /**
* @brief fac, a plugin for Dotclear 2 * @file
* @brief The plugin fac resources
* @ingroup fac
* *
* @package Dotclear * @author Jean-Christian Denis
* @subpackage Plugin
*
* @author Jean-Christian Denis and Contributors
*
* @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')) { \Dotclear\App::backend()->resources()->set('help', 'fac', __DIR__ . '/help/fac.html');
return;
}
dcCore::app()->resources['help']['fac'] = __DIR__ . '/help/fac.html';

View File

@ -1,22 +1,19 @@
<?php <?php
/**
* @brief fac, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and Contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1); declare(strict_types=1);
namespace Dotclear\Plugin\fac; namespace Dotclear\Plugin\fac;
use dcCore; use Dotclear\App;
use Dotclear\Core\Process; use Dotclear\Core\Process;
/**
* @brief fac backend class.
* @ingroup fac
*
* @author Jean-Christian Denis (author)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Backend extends Process class Backend extends Process
{ {
public static function init(): bool public static function init(): bool
@ -26,21 +23,19 @@ class Backend extends Process
public static function process(): bool public static function process(): bool
{ {
if (!self::status()) { if (self::status()) {
return false; App::behavior()->addBehaviors([
} 'adminBlogPreferencesFormV2' => BackendBehaviors::adminBlogPreferencesFormV2(...),
'adminBeforeBlogSettingsUpdate' => BackendBehaviors::adminBeforeBlogSettingsUpdate(...),
dcCore::app()->addBehaviors([ 'adminPostHeaders' => BackendBehaviors::adminPostHeaders(...),
'adminBlogPreferencesFormV2' => [BackendBehaviors::class, 'adminBlogPreferencesFormV2'], 'adminPostFormItems' => BackendBehaviors::adminPostFormItems(...),
'adminBeforeBlogSettingsUpdate' => [BackendBehaviors::class, 'adminBeforeBlogSettingsUpdate'], 'adminAfterPostCreate' => BackendBehaviors::adminAfterPostSave(...),
'adminPostHeaders' => [BackendBehaviors::class, 'adminPostHeaders'], 'adminAfterPostUpdate' => BackendBehaviors::adminAfterPostSave(...),
'adminPostFormItems' => [BackendBehaviors::class, 'adminPostFormItems'], 'adminBeforePostDelete' => BackendBehaviors::adminBeforePostDelete(...),
'adminAfterPostCreate' => [BackendBehaviors::class, 'adminAfterPostSave'], 'adminPostsActions' => BackendBehaviors::adminPostsActions(...),
'adminAfterPostUpdate' => [BackendBehaviors::class, 'adminAfterPostSave'],
'adminBeforePostDelete' => [BackendBehaviors::class, 'adminBeforePostDelete'],
'adminPostsActions' => [BackendBehaviors::class, 'adminPostsActions'],
]); ]);
}
return true; return self::status();
} }
} }

View File

@ -1,22 +1,11 @@
<?php <?php
/**
* @brief fac, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and Contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1); declare(strict_types=1);
namespace Dotclear\Plugin\fac; namespace Dotclear\Plugin\fac;
use ArrayObject; use ArrayObject;
use dcCore; use Dotclear\App;
use dcSettings;
use Dotclear\Core\Backend\{ use Dotclear\Core\Backend\{
Notices, Notices,
Page Page
@ -40,19 +29,22 @@ use Dotclear\Helper\Html\Form\{
Submit, Submit,
Text Text
}; };
use Dotclear\Interface\Core\BlogSettingsInterface;
use Exception; use Exception;
/** /**
* @ingroup DC_PLUGIN_FAC * @brief fac backend behaviors class.
* @brief Linked feed to entries - admin methods. * @ingroup fac
* @since 2.6 *
* @author Jean-Christian Denis (author)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
class BackendBehaviors class BackendBehaviors
{ {
/** /**
* Get combos of types of supported public pages * Get combos of types of supported public pages.
* *
* @return array List of post type and name * @return array<string, string> List of post type and name
*/ */
public static function getPostsTypes(): array public static function getPostsTypes(): array
{ {
@ -64,12 +56,12 @@ class BackendBehaviors
__('category pages') => 'category', __('category pages') => 'category',
__('entries feed') => 'feed', __('entries feed') => 'feed',
]; ];
if (dcCore::app()->plugins->getDefine('muppet')->isDefined() && class_exists('\muppet')) { if (App::plugins()->getDefine('muppet')->isDefined() && class_exists('\muppet')) {
foreach (\muppet::getPostTypes() as $k => $v) { foreach (\muppet::getPostTypes() as $k => $v) {
$types[sprintf( $types[sprintf(
__('"%s" pages from extension muppet'), __('"%s" pages from extension muppet'),
$v['name'] $v['name']
)] = $k; )] = (string) $k;
} }
} }
@ -77,11 +69,11 @@ class BackendBehaviors
} }
/** /**
* Add settings to blog preference * Add settings to blog preference.
* *
* @param dcSettings $blog_settings dcSettings instance * @param BlogSettingsInterface $blog_settings Blog settings instance
*/ */
public static function adminBlogPreferencesFormV2(dcSettings $blog_settings): void public static function adminBlogPreferencesFormV2(BlogSettingsInterface $blog_settings): void
{ {
$lines = ''; $lines = '';
$fac_public_tpltypes = json_decode($blog_settings->get(My::id())->get('public_tpltypes'), true); $fac_public_tpltypes = json_decode($blog_settings->get(My::id())->get('public_tpltypes'), true);
@ -100,11 +92,11 @@ class BackendBehaviors
'<p class="form-note">' . '<p class="form-note">' .
__('To add feed to an entry edit this entry and put in sidebar the url of the feed and select a format.') . __('To add feed to an entry edit this entry and put in sidebar the url of the feed and select a format.') .
'</p>'; '</p>';
if (dcCore::app()->auth->isSuperAdmin()) { if (App::auth()->isSuperAdmin()) {
echo '<p><a href="' . dcCore::app()->admin->url->get('admin.plugins', [ echo '<p><a href="' . App::backend()->url()->get('admin.plugins', [
'module' => My::id(), 'module' => My::id(),
'conf' => 1, 'conf' => 1,
'redir' => dcCore::app()->admin->url->get('admin.blog.pref') . '#params.' . My::id() . '_params', 'redir' => App::backend()->url()->get('admin.blog.pref') . '#params.' . My::id() . '_params',
]) . '">' . __('Configure formats') . '</a></p>'; ]) . '">' . __('Configure formats') . '</a></p>';
} }
@ -122,7 +114,7 @@ class BackendBehaviors
// defaultfeedtitle // defaultfeedtitle
(new Para())->items([ (new Para())->items([
(new Label(__('Default title')))->for('fac_defaultfeedtitle'), (new Label(__('Default title')))->for('fac_defaultfeedtitle'),
(new Input('fac_defaultfeedtitle'))->size(70)->maxlenght(255)->value((string) $blog_settings->get(My::id())->get('defaultfeedtitle')), (new Input('fac_defaultfeedtitle'))->size(70)->maxlength(255)->value((string) $blog_settings->get(My::id())->get('defaultfeedtitle')),
]), ]),
(new Note())->text(__('Use %T to insert title of feed.'))->class('form-note'), (new Note())->text(__('Use %T to insert title of feed.'))->class('form-note'),
// showfeeddesc // showfeeddesc
@ -141,11 +133,11 @@ class BackendBehaviors
} }
/** /**
* Save blog settings * Save blog settings.
* *
* @param dcSettings $blog_settings dcSettings instance * @param BlogSettingsInterface $blog_settings Blog settings instance
*/ */
public static function adminBeforeBlogSettingsUpdate(dcSettings $blog_settings): void public static function adminBeforeBlogSettingsUpdate(BlogSettingsInterface $blog_settings): void
{ {
$blog_settings->get(My::id())->put('active', !empty($_POST['fac_active'])); $blog_settings->get(My::id())->put('active', !empty($_POST['fac_active']));
$blog_settings->get(My::id())->put('public_tpltypes', json_encode($_POST['fac_public_tpltypes'])); $blog_settings->get(My::id())->put('public_tpltypes', json_encode($_POST['fac_public_tpltypes']));
@ -154,7 +146,7 @@ class BackendBehaviors
} }
/** /**
* Add javascript (toggle) * Add javascript (toggle).
* *
* @return string HTML head * @return string HTML head
*/ */
@ -164,29 +156,29 @@ class BackendBehaviors
} }
/** /**
* Add form to post sidebar * Add form to post sidebar.
* *
* @param ArrayObject $main_items Main items * @param ArrayObject<string, string> $main_items Main items
* @param ArrayObject $sidebar_items Sidebar items * @param ArrayObject<string, array<string, mixed>> $sidebar_items Sidebar items
* @param null|MetaRecord $post Post record or null * @param null|MetaRecord $post Post record or null
*/ */
public static function adminPostFormItems(ArrayObject $main_items, ArrayObject $sidebar_items, ?MetaRecord $post): void public static function adminPostFormItems(ArrayObject $main_items, ArrayObject $sidebar_items, ?MetaRecord $post): void
{ {
if (is_null(dcCore::app()->blog) || !My::settings()->get('active')) { if (!App::blog()->isDefined() || !My::settings()->get('active')) {
return; return;
} }
# Get existing linked feed # Get existing linked feed
$fac_url = $fac_format = ''; $fac_url = $fac_format = '';
if ($post) { if ($post) {
$rs = dcCore::app()->meta->getMetadata([ $rs = App::meta()->getMetadata([
'meta_type' => 'fac', 'meta_type' => 'fac',
'post_id' => $post->f('post_id'), 'post_id' => $post->f('post_id'),
'limit' => 1, 'limit' => 1,
]); ]);
$fac_url = $rs->isEmpty() ? '' : $rs->f('meta_id'); $fac_url = $rs->isEmpty() ? '' : $rs->f('meta_id');
$rs = dcCore::app()->meta->getMetadata([ $rs = App::meta()->getMetadata([
'meta_type' => 'facformat', 'meta_type' => 'facformat',
'post_id' => $post->f('post_id'), 'post_id' => $post->f('post_id'),
'limit' => 1, 'limit' => 1,
@ -199,10 +191,10 @@ class BackendBehaviors
} }
/** /**
* Save linked feed * Save linked feed.
* *
* @param Cursor $cur Current post Cursor * @param Cursor $cur Current post Cursor
* @param integer $post_id Post id * @param int $post_id Post id
*/ */
public static function adminAfterPostSave(Cursor $cur, int $post_id): void public static function adminAfterPostSave(Cursor $cur, int $post_id): void
{ {
@ -219,9 +211,9 @@ class BackendBehaviors
} }
/** /**
* Delete linked feed on post edition * Delete linked feed on post edition.
* *
* @param integer $post_id Post id * @param int $post_id Post id
*/ */
public static function adminBeforePostDelete(int $post_id): void public static function adminBeforePostDelete(int $post_id): void
{ {
@ -229,42 +221,42 @@ class BackendBehaviors
} }
/** /**
* Add actions to posts page combo * Add actions to posts page combo.
* *
* @param ActionsPosts $pa ActionsPostsPage instance * @param ActionsPosts $pa ActionsPostsPage instance
*/ */
public static function adminPostsActions(ActionsPosts $pa): void public static function adminPostsActions(ActionsPosts $pa): void
{ {
if (is_null(dcCore::app()->blog) || !My::settings()->get('active')) { if (!App::blog()->isDefined() || !My::settings()->get('active')) {
return; return;
} }
$pa->addAction( $pa->addAction(
[__('Linked feed') => [__('Add feed') => 'fac_add']], [__('Linked feed') => [__('Add feed') => 'fac_add']],
[self::class, 'callbackAdd'] self::callbackAdd(...)
); );
if (!dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([ if (!App::auth()->check(App::auth()->makePermissions([
dcCore::app()->auth::PERMISSION_DELETE, App::auth()::PERMISSION_DELETE,
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN, App::auth()::PERMISSION_CONTENT_ADMIN,
]), dcCore::app()->blog->id)) { ]), App::blog()->id())) {
return; return;
} }
$pa->addAction( $pa->addAction(
[__('Linked feed') => [__('Remove feed') => 'fac_remove']], [__('Linked feed') => [__('Remove feed') => 'fac_remove']],
[self::class, 'callbackRemove'] self::callbackRemove(...)
); );
} }
/** /**
* Posts actions callback to remove linked feed * Posts actions callback to remove linked feed.
* *
* @param ActionsPosts $pa ActionsPosts instance * @param ActionsPosts $pa ActionsPosts instance
* @param ArrayObject $post _POST actions * @param ArrayObject<string, mixed> $post _POST actions
*/ */
public static function callbackRemove(ActionsPosts $pa, ArrayObject $post): void public static function callbackRemove(ActionsPosts $pa, ArrayObject $post): void
{ {
if (is_null(dcCore::app()->blog)) { if (!App::blog()->isDefined()) {
return; return;
} }
# No entry # No entry
@ -274,16 +266,16 @@ class BackendBehaviors
} }
# No right # No right
if (!dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([ if (!App::auth()->check(App::auth()->makePermissions([
dcCore::app()->auth::PERMISSION_DELETE, App::auth()::PERMISSION_DELETE,
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN, App::auth()::PERMISSION_CONTENT_ADMIN,
]), dcCore::app()->blog->id)) { ]), App::blog()->id())) {
throw new Exception(__('No enough right')); throw new Exception(__('No enough right'));
} }
# Delete unused feed # Delete unused feed
foreach ($posts_ids as $post_id) { foreach ($posts_ids as $post_id) {
self::delFeed($post_id); self::delFeed((int) $post_id);
} }
Notices::addSuccessNotice(__('Linked feed deleted.')); Notices::addSuccessNotice(__('Linked feed deleted.'));
@ -291,14 +283,14 @@ class BackendBehaviors
} }
/** /**
* Posts actions callback to add linked feed * Posts actions callback to add linked feed.
* *
* @param ActionsPosts $pa ActionsPosts instance * @param ActionsPosts $pa ActionsPosts instance
* @param ArrayObject $post _POST actions * @param ArrayObject<string, mixed> $post _POST actions
*/ */
public static function callbackAdd(ActionsPosts $pa, ArrayObject $post): void public static function callbackAdd(ActionsPosts $pa, ArrayObject $post): void
{ {
if (is_null(dcCore::app()->blog)) { if (!App::blog()->isDefined()) {
return; return;
} }
# No entry # No entry
@ -311,8 +303,8 @@ class BackendBehaviors
if (!empty($post['fac_url']) if (!empty($post['fac_url'])
&& !empty($post['fac_format'])) { && !empty($post['fac_format'])) {
foreach ($posts_ids as $post_id) { foreach ($posts_ids as $post_id) {
self::delFeed($post_id); self::delFeed((int) $post_id);
self::addFeed($post_id, $post); self::addFeed((int) $post_id, $post);
} }
Notices::addSuccessNotice(__('Linked feed added.')); Notices::addSuccessNotice(__('Linked feed added.'));
@ -322,7 +314,7 @@ class BackendBehaviors
} else { } else {
$pa->beginPage( $pa->beginPage(
Page::breadcrumb([ Page::breadcrumb([
Html::escapeHTML(dcCore::app()->blog->name) => '', Html::escapeHTML(App::blog()->name()) => '',
$pa->getCallerTitle() => $pa->getRedirection(true), $pa->getCallerTitle() => $pa->getRedirection(true),
__('Linked feed to this selection') => '', __('Linked feed to this selection') => '',
]) ])
@ -332,7 +324,8 @@ class BackendBehaviors
(new Form('fac_form'))->action($pa->getURI())->method('post')->fields([ (new Form('fac_form'))->action($pa->getURI())->method('post')->fields([
(new Text('', $pa->getCheckboxes() . self::formFeed())), (new Text('', $pa->getCheckboxes() . self::formFeed())),
(new Para())->items([ (new Para())->items([
(new Text('', dcCore::app()->formNonce() . $pa->getHiddenFields())), App::nonce()->formNonce(),
... $pa->hiddenFields(),
(new Hidden(['action'], 'fac_add')), (new Hidden(['action'], 'fac_add')),
(new Submit(['save']))->value(__('Save')), (new Submit(['save']))->value(__('Save')),
]), ]),
@ -343,15 +336,16 @@ class BackendBehaviors
} }
/** /**
* Linked feed form field * Linked feed form field.
* *
* @param string $url Feed URL * @param string $url Feed URL
* @param string $format Feed format * @param string $format Feed format
*
* @return string Feed form content * @return string Feed form content
*/ */
protected static function formFeed(string $url = '', string $format = ''): string protected static function formFeed(string $url = '', string $format = ''): string
{ {
if (is_null(dcCore::app()->blog) || !My::settings()->get('active')) { if (!App::blog()->isDefined() || !My::settings()->get('active')) {
return ''; return '';
} }
@ -361,7 +355,7 @@ class BackendBehaviors
// fac_url // fac_url
(new Para())->items([ (new Para())->items([
(new Label(__('Feed URL:')))->for('fac_url')->class('required'), (new Label(__('Feed URL:')))->for('fac_url')->class('required'),
(new Input('fac_url'))->size(60)->maxlenght(255)->value($url), (new Input('fac_url'))->size(60)->maxlength(255)->value($url),
]), ]),
// fac_format // fac_format
(new Para())->items([ (new Para())->items([
@ -373,13 +367,13 @@ class BackendBehaviors
} }
/** /**
* List of fac formats * List of fac formats.
* *
* @return array List of fac formats * @return array<string, string> List of fac formats
*/ */
protected static function comboFac(): array protected static function comboFac(): array
{ {
if (is_null(dcCore::app()->blog)) { if (!App::blog()->isDefined()) {
return []; return [];
} }
$formats = json_decode((string) My::settings()->get('formats'), true); $formats = json_decode((string) My::settings()->get('formats'), true);
@ -389,29 +383,29 @@ class BackendBehaviors
$res = []; $res = [];
foreach ($formats as $uid => $f) { foreach ($formats as $uid => $f) {
$res[$f['name']] = $uid; $res[(string) $f['name']] = (string) $uid;
} }
return $res; return $res;
} }
/** /**
* Delete linked feed * Delete linked feed.
* *
* @param integer $post_id Post id * @param int $post_id Post id
*/ */
protected static function delFeed(int $post_id): void protected static function delFeed(int $post_id): void
{ {
$post_id = (int) $post_id; $post_id = (int) $post_id;
dcCore::app()->meta->delPostMeta($post_id, 'fac'); App::meta()->delPostMeta($post_id, 'fac');
dcCore::app()->meta->delPostMeta($post_id, 'facformat'); App::meta()->delPostMeta($post_id, 'facformat');
} }
/** /**
* Add linked feed * Add linked feed.
* *
* @param integer $post_id Post id * @param int $post_id Post id
* @param array|ArrayObject $options Feed options * @param array<string, mixed>|ArrayObject<string, mixed> $options Feed options
*/ */
protected static function addFeed(int $post_id, $options): void protected static function addFeed(int $post_id, $options): void
{ {
@ -422,12 +416,12 @@ class BackendBehaviors
$post_id = (int) $post_id; $post_id = (int) $post_id;
dcCore::app()->meta->setPostMeta( App::meta()->setPostMeta(
$post_id, $post_id,
'fac', 'fac',
$options['fac_url'] $options['fac_url']
); );
dcCore::app()->meta->setPostMeta( App::meta()->setPostMeta(
$post_id, $post_id,
'facformat', 'facformat',
$options['fac_format'] $options['fac_format']

View File

@ -1,20 +1,10 @@
<?php <?php
/**
* @brief fac, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and Contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1); declare(strict_types=1);
namespace Dotclear\Plugin\fac; namespace Dotclear\Plugin\fac;
use dcCore; use Dotclear\App;
use Dotclear\Core\Process; use Dotclear\Core\Process;
use Dotclear\Core\Backend\{ use Dotclear\Core\Backend\{
Notices, Notices,
@ -33,6 +23,13 @@ use Dotclear\Helper\Html\Form\{
}; };
use Exception; use Exception;
/**
* @brief fac configuration class.
* @ingroup fac
*
* @author Jean-Christian Denis (author)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Config extends Process class Config extends Process
{ {
public static function init(): bool public static function init(): bool
@ -46,13 +43,12 @@ class Config extends Process
return false; return false;
} }
//nullsafe if (!App::blog()->isDefined()) {
if (is_null(dcCore::app()->blog)) {
return false; return false;
} }
$redir = empty($_REQUEST['redir']) ? $redir = empty($_REQUEST['redir']) ?
dcCore::app()->admin->__get('list')->getURL() . '#plugins' : $_REQUEST['redir']; App::backend()->__get('list')->getURL() . '#plugins' : $_REQUEST['redir'];
# -- Get settings -- # -- Get settings --
$s = My::settings(); $s = My::settings();
@ -85,17 +81,17 @@ class Config extends Process
true true
); );
dcCore::app()->blog->triggerBlog(); App::blog()->triggerBlog();
Notices::addSuccessNotice( Notices::addSuccessNotice(
__('Configuration successfully updated.') __('Configuration successfully updated.')
); );
dcCore::app()->admin->url->redirect( App::backend()->url()->redirect(
'admin.plugins', 'admin.plugins',
['module' => My::id(), 'conf' => 1, 'redir' => dcCore::app()->admin->__get('list')->getRedir()] ['module' => My::id(), 'conf' => 1, 'redir' => App::backend()->__get('list')->getRedir()]
); );
} catch (Exception $e) { } catch (Exception $e) {
dcCore::app()->error->add($e->getMessage()); App::error()->add($e->getMessage());
} }
} }
@ -173,6 +169,9 @@ class Config extends Process
Page::helpBlock('fac'); Page::helpBlock('fac');
} }
/**
* @param array<string, string> $format
*/
private static function displayFacFormat(string $title, string $uid, array $format): void private static function displayFacFormat(string $title, string $uid, array $format): void
{ {
echo echo
@ -186,7 +185,7 @@ class Config extends Process
(new Input([ (new Input([
'fac_formats[' . $uid . '][name]', 'fac_formats[' . $uid . '][name]',
'fac_formats_' . $uid . '_name', 'fac_formats_' . $uid . '_name',
]))->value(empty($format['name']) ? '' : $format['name'])->size(20)->maxlenght(255)->class('maximal'), ]))->value(empty($format['name']) ? '' : $format['name'])->size(20)->maxlength(255)->class('maximal'),
]), ]),
(new Note())->text(__('In order to remove a format, leave its name empty.'))->class('form-note'), (new Note())->text(__('In order to remove a format, leave its name empty.'))->class('form-note'),
// dateformat // dateformat
@ -195,7 +194,7 @@ class Config extends Process
(new Input([ (new Input([
'fac_formats[' . $uid . '][dateformat]', 'fac_formats[' . $uid . '][dateformat]',
'fac_formats_' . $uid . '_dateformat', 'fac_formats_' . $uid . '_dateformat',
]))->value(empty($format['dateformat']) ? '' : $format['dateformat'])->size(20)->maxlenght(255)->class('maximal'), ]))->value(empty($format['dateformat']) ? '' : $format['dateformat'])->size(20)->maxlength(255)->class('maximal'),
]), ]),
(new Note())->text(__('Use date format of Dotclear or leave empty to use default date format of blog.'))->class('form-note'), (new Note())->text(__('Use date format of Dotclear or leave empty to use default date format of blog.'))->class('form-note'),
// dateformat //todo: use Number // dateformat //todo: use Number
@ -204,7 +203,7 @@ class Config extends Process
(new Input([ (new Input([
'fac_formats[' . $uid . '][lineslimit]', 'fac_formats[' . $uid . '][lineslimit]',
'fac_formats_' . $uid . '_lineslimit', 'fac_formats_' . $uid . '_lineslimit',
]))->value(empty($format['lineslimit']) ? '' : $format['lineslimit'])->size(4)->maxlenght(5), ]))->value(empty($format['lineslimit']) ? '' : $format['lineslimit'])->size(4)->maxlength(5),
]), ]),
(new Note())->text(__('Leave lengh empty for no limit.'))->class('form-note'), (new Note())->text(__('Leave lengh empty for no limit.'))->class('form-note'),
]), ]),
@ -216,7 +215,7 @@ class Config extends Process
(new Input([ (new Input([
'fac_formats[' . $uid . '][linestitletext]', 'fac_formats[' . $uid . '][linestitletext]',
'fac_formats_' . $uid . '_linestitletext', 'fac_formats_' . $uid . '_linestitletext',
]))->value(empty($format['linestitletext']) ? '' : $format['linestitletext'])->size(20)->maxlenght(255)->class('maximal'), ]))->value(empty($format['linestitletext']) ? '' : $format['linestitletext'])->size(20)->maxlength(255)->class('maximal'),
]), ]),
(new Note())->text( (new Note())->text(
__('Format can be:') . __('Format can be:') .
@ -232,7 +231,7 @@ class Config extends Process
(new Input([ (new Input([
'fac_formats[' . $uid . '][linestitleover]', 'fac_formats[' . $uid . '][linestitleover]',
'fac_formats_' . $uid . '_linestitleover', 'fac_formats_' . $uid . '_linestitleover',
]))->value(empty($format['linestitleover']) ? '' : $format['linestitleover'])->size(20)->maxlenght(255)->class('maximal'), ]))->value(empty($format['linestitleover']) ? '' : $format['linestitleover'])->size(20)->maxlength(255)->class('maximal'),
]), ]),
(new Note())->text( (new Note())->text(
__('Format can be:') . __('Format can be:') .
@ -248,7 +247,7 @@ class Config extends Process
(new Input([ (new Input([
'fac_formats[' . $uid . '][linestitlelength]', 'fac_formats[' . $uid . '][linestitlelength]',
'fac_formats_' . $uid . '_linestitlelength', 'fac_formats_' . $uid . '_linestitlelength',
]))->value(empty($format['linestitlelength']) ? '' : $format['linestitlelength'])->size(4)->maxlenght(5), ]))->value(empty($format['linestitlelength']) ? '' : $format['linestitlelength'])->size(4)->maxlength(5),
]), ]),
(new Note())->text(__('Leave lengh empty for no limit.'))->class('form-note'), (new Note())->text(__('Leave lengh empty for no limit.'))->class('form-note'),
]), ]),
@ -276,7 +275,7 @@ class Config extends Process
(new Input([ (new Input([
'fac_formats[' . $uid . '][linesdescriptionlength]', 'fac_formats[' . $uid . '][linesdescriptionlength]',
'fac_formats_' . $uid . '_linesdescriptionlength', 'fac_formats_' . $uid . '_linesdescriptionlength',
]))->value(empty($format['linesdescriptionlength']) ? '' : $format['linesdescriptionlength'])->size(4)->maxlenght(5), ]))->value(empty($format['linesdescriptionlength']) ? '' : $format['linesdescriptionlength'])->size(4)->maxlength(5),
]), ]),
(new Note())->text(__('Leave lengh empty for no limit.'))->class('form-note'), (new Note())->text(__('Leave lengh empty for no limit.'))->class('form-note'),
]), ]),
@ -304,7 +303,7 @@ class Config extends Process
(new Input([ (new Input([
'fac_formats[' . $uid . '][linescontentlength]', 'fac_formats[' . $uid . '][linescontentlength]',
'fac_formats_' . $uid . '_linescontentlength', 'fac_formats_' . $uid . '_linescontentlength',
]))->value(empty($format['linescontentlength']) ? '' : $format['linescontentlength'])->size(4)->maxlenght(5), ]))->value(empty($format['linescontentlength']) ? '' : $format['linescontentlength'])->size(4)->maxlength(5),
]), ]),
(new Note())->text(__('Leave lengh empty for no limit.'))->class('form-note'), (new Note())->text(__('Leave lengh empty for no limit.'))->class('form-note'),
]), ]),

View File

@ -1,27 +1,23 @@
<?php <?php
/**
* @brief fac, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and Contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1); declare(strict_types=1);
namespace Dotclear\Plugin\fac; namespace Dotclear\Plugin\fac;
use context; use Dotclear\App;
use dcCore;
use Dotclear\Core\Process; use Dotclear\Core\Process;
use Dotclear\Helper\Date; use Dotclear\Helper\Date;
use Dotclear\Helper\Html\Html; use Dotclear\Helper\Html\Html;
use Dotclear\Helper\Network\Feed\Reader; use Dotclear\Helper\Network\Feed\Reader;
use Exception; use Exception;
/**
* @brief fac frontend class.
* @ingroup fac
*
* @author Jean-Christian Denis (author)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Frontend extends Process class Frontend extends Process
{ {
public static function init(): bool public static function init(): bool
@ -31,32 +27,31 @@ class Frontend extends Process
public static function process(): bool public static function process(): bool
{ {
if (!self::status() || is_null(dcCore::app()->blog) || !My::settings()->get('active')) { if (!self::status() || !App::blog()->isDefined() || !My::settings()->get('active')) {
return false; return false;
} }
dcCore::app()->addBehavior('publicEntryAfterContent', function (dcCore $core, context $_ctx): void { App::behavior()->addBehavior('publicEntryAfterContent', function ($___, $_____): void {
//nullsafe if (!App::blog()->isDefined()) {
if (is_null(dcCore::app()->blog) || is_null(dcCore::app()->ctx)) {
return; return;
} }
// Not a post // Not a post
if (!dcCore::app()->ctx->exists('posts')) { if (!App::frontend()->context()->exists('posts')) {
return; return;
} }
// Not in page to show // Not in page to show
$types = json_decode((string) My::settings()->get('public_tpltypes'), true); $types = json_decode((string) My::settings()->get('public_tpltypes'), true);
if (!is_array($types) if (!is_array($types)
|| !in_array(dcCore::app()->url->type, $types)) { || !in_array(App::url()->type, $types)) {
return; return;
} }
// Get related feed // Get related feed
$fac_url = dcCore::app()->meta->getMetadata([ $fac_url = App::meta()->getMetadata([
'meta_type' => 'fac', 'meta_type' => 'fac',
'post_id' => dcCore::app()->ctx->__get('posts')->f('post_id'), 'post_id' => App::frontend()->context()->__get('posts')->f('post_id'),
'limit' => 1, 'limit' => 1,
]); ]);
if ($fac_url->isEmpty()) { if ($fac_url->isEmpty()) {
@ -64,9 +59,9 @@ class Frontend extends Process
} }
// Get related format // Get related format
$fac_format = dcCore::app()->meta->getMetadata([ $fac_format = App::meta()->getMetadata([
'meta_type' => 'facformat', 'meta_type' => 'facformat',
'post_id' => dcCore::app()->ctx->__get('posts')->f('post_id'), 'post_id' => App::frontend()->context()->__get('posts')->f('post_id'),
'limit' => 1, 'limit' => 1,
]); ]);
if ($fac_format->isEmpty()) { if ($fac_format->isEmpty()) {
@ -102,7 +97,7 @@ class Frontend extends Process
} }
// Read feed url // Read feed url
$cache = is_dir(DC_TPL_CACHE . '/fac') ? DC_TPL_CACHE . '/fac' : null; $cache = is_dir(App::config()->cacheRoot() . '/fac') ? App::config()->cacheRoot() . '/fac' : null;
try { try {
$feed = Reader::quickParse($fac_url->f('meta_id'), $cache); $feed = Reader::quickParse($fac_url->f('meta_id'), $cache);
@ -137,7 +132,7 @@ class Frontend extends Process
$feeddesc = ''; $feeddesc = '';
if (My::settings()->get('showfeeddesc') if (My::settings()->get('showfeeddesc')
&& '' != $feed->description) { && '' != $feed->description) {
$feeddesc = '<p>' . context::global_filters( $feeddesc = '<p>' . App::frontend()->context()->global_filters(
$feed->description, $feed->description,
['encode_xml', 'remove_html'] ['encode_xml', 'remove_html']
) . '</p>'; ) . '</p>';
@ -146,7 +141,7 @@ class Frontend extends Process
// Date format // Date format
$dateformat = '' != $format['dateformat'] ? $dateformat = '' != $format['dateformat'] ?
$format['dateformat'] : $format['dateformat'] :
dcCore::app()->blog->settings->get('system')->get('date_format') . ',' . dcCore::app()->blog->settings->get('system')->get('time_format'); App::blog()->settings()->get('system')->get('date_format') . ',' . App::blog()->settings()->get('system')->get('time_format');
// Enrties limit // Enrties limit
$entrieslimit = abs((int) $format['lineslimit']); $entrieslimit = abs((int) $format['lineslimit']);
@ -163,7 +158,7 @@ class Frontend extends Process
$date = Date::dt2str($dateformat, $item->pubdate); $date = Date::dt2str($dateformat, $item->pubdate);
// Entries title // Entries title
$title = context::global_filters( $title = App::frontend()->context()->global_filters(
str_replace( str_replace(
[ [
'%D', '%D',
@ -179,13 +174,13 @@ class Frontend extends Process
$item->description, $item->description,
$item->content, $item->content,
], ],
$format['linestitletext'] (string) $format['linestitletext']
), ),
['remove_html', 'cut_string' => abs((int) $format['linestitlelength'])], ['remove_html', 'cut_string' => abs((int) $format['linestitlelength'])],
); );
// Entries over title // Entries over title
$overtitle = context::global_filters( $overtitle = App::frontend()->context()->global_filters(
str_replace( str_replace(
[ [
'%D', '%D',
@ -201,7 +196,7 @@ class Frontend extends Process
$item->description, $item->description,
$item->content, $item->content,
], ],
$format['linestitleover'] (string) $format['linestitleover']
), ),
['remove_html', 'cut_string' => 350], ['remove_html', 'cut_string' => 350],
); );
@ -211,7 +206,7 @@ class Frontend extends Process
if ($format['showlinesdescription'] if ($format['showlinesdescription']
&& '' != $item->description) { && '' != $item->description) {
$description = '<dd>' . $description = '<dd>' .
context::global_filters( App::frontend()->context()->global_filters(
$item->description, $item->description,
['remove_html' => (int) $format['linesdescriptionnohtml'], 'cut_string' => abs((int) $format['linesdescriptionlength'])] ['remove_html' => (int) $format['linesdescriptionnohtml'], 'cut_string' => abs((int) $format['linesdescriptionlength'])]
) . '</dd>'; ) . '</dd>';
@ -222,7 +217,7 @@ class Frontend extends Process
if ($format['showlinescontent'] if ($format['showlinescontent']
&& '' != $item->content) { && '' != $item->content) {
$content = '<dd>' . $content = '<dd>' .
context::global_filters( App::frontend()->context()->global_filters(
$item->content, $item->content,
['remove_html' => (int) $format['linescontentnohtml'], 'cut_string' => abs((int) $format['linescontentlength'])] ['remove_html' => (int) $format['linescontentnohtml'], 'cut_string' => abs((int) $format['linescontentlength'])]
) . '</dd>'; ) . '</dd>';

View File

@ -1,24 +1,20 @@
<?php <?php
/**
* @brief fac, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and Contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1); declare(strict_types=1);
namespace Dotclear\Plugin\fac; namespace Dotclear\Plugin\fac;
use dcCore; use Dotclear\App;
use dcNamespace;
use Dotclear\Core\Process; use Dotclear\Core\Process;
use Exception; use Exception;
/**
* @brief fac installation class.
* @ingroup fac
*
* @author Jean-Christian Denis (author)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Install extends Process class Install extends Process
{ {
public static function init(): bool public static function init(): bool
@ -113,7 +109,7 @@ class Install extends Process
); );
} }
} catch (Exception $e) { } catch (Exception $e) {
dcCore::app()->error->add($e->getMessage()); App::error()->add($e->getMessage());
} }
return true; return true;
@ -122,15 +118,15 @@ class Install extends Process
private static function growUp(): void private static function growUp(): void
{ {
// version < 1.0 : upgrade settings id and ns and array // version < 1.0 : upgrade settings id and ns and array
$current = dcCore::app()->getVersion(My::id()); $current = App::version()->getVersion(My::id());
if ($current && version_compare($current, '1.0', '<')) { if ($current && version_compare($current, '1.0', '<')) {
$record = dcCore::app()->con->select( $record = App::con()->select(
'SELECT * FROM ' . dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME . ' ' . 'SELECT * FROM ' . App::con()->prefix() . App::blogWorkspace()::NS_TABLE_NAME . ' ' .
"WHERE setting_ns = 'fac' " "WHERE setting_ns = 'fac' "
); );
while ($record->fetch()) { while ($record->fetch()) {
if (preg_match('/^fac_(.*?)$/', $record->f('setting_id'), $match)) { if (preg_match('/^fac_(.*?)$/', $record->f('setting_id'), $match)) {
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME); $cur = App::blogWorkspace()->openBlogWorkspaceCursor();
if (in_array($record->f('setting_id'), ['fac_public_tpltypes', 'fac_formats'])) { if (in_array($record->f('setting_id'), ['fac_public_tpltypes', 'fac_formats'])) {
$cur->setField('setting_value', json_encode(@unserialize($record->f('setting_value')))); $cur->setField('setting_value', json_encode(@unserialize($record->f('setting_value'))));
} }
@ -138,7 +134,7 @@ class Install extends Process
$cur->SetField('setting_ns', My::id()); $cur->SetField('setting_ns', My::id());
$cur->update( $cur->update(
"WHERE setting_id = '" . $record->f('setting_id') . "' and setting_ns = 'fac' " . "WHERE setting_id = '" . $record->f('setting_id') . "' and setting_ns = 'fac' " .
'AND blog_id ' . (null === $record->f('blog_id') ? 'IS NULL ' : ("= '" . dcCore::app()->con->escapeStr($record->f('blog_id')) . "' ")) 'AND blog_id ' . (null === $record->f('blog_id') ? 'IS NULL ' : ("= '" . App::con()->escapeStr($record->f('blog_id')) . "' "))
); );
} }
} }

View File

@ -1,15 +1,5 @@
<?php <?php
/**
* @brief fac, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and Contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1); declare(strict_types=1);
namespace Dotclear\Plugin\fac; namespace Dotclear\Plugin\fac;
@ -17,8 +7,13 @@ namespace Dotclear\Plugin\fac;
use Dotclear\Module\MyPlugin; use Dotclear\Module\MyPlugin;
/** /**
* This module definitions. * @brief fac My helper.
* @ingroup fac
*
* @author Jean-Christian Denis (author)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
class My extends MyPlugin class My extends MyPlugin
{ {
// Use default permissions
} }

View File

@ -1,23 +1,19 @@
<?php <?php
/**
* @brief fac, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and Contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1); declare(strict_types=1);
namespace Dotclear\Plugin\fac; namespace Dotclear\Plugin\fac;
use dcCore;
use Dotclear\Core\Process; use Dotclear\Core\Process;
use Dotclear\Plugin\Uninstaller\Uninstaller; use Dotclear\Plugin\Uninstaller\Uninstaller;
/**
* @brief fac uninstall class.
* @ingroup fac
*
* @author Jean-Christian Denis (author)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Uninstall extends Process class Uninstall extends Process
{ {
public static function init(): bool public static function init(): bool
@ -27,7 +23,7 @@ class Uninstall extends Process
public static function process(): bool public static function process(): bool
{ {
if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) { if (!self::status()) {
return false; return false;
} }