parent
3f3f0c0521
commit
9e1c801a66
|
@ -1,3 +1,9 @@
|
|||
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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# README
|
||||
|
||||
[![Release](https://img.shields.io/badge/release-1.5-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/fac/releases)
|
||||
![Date](https://img.shields.io/badge/date-2023.10.16-c44d58.svg)
|
||||
[![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.10.24-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/fac)
|
||||
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/fac/src/branch/master/LICENSE)
|
||||
|
|
|
@ -17,7 +17,7 @@ $this->registerModule(
|
|||
'Feed after content',
|
||||
'Add RSS/Atom feeds after entries content',
|
||||
'Jean-Christian Denis and Contributors',
|
||||
'1.5',
|
||||
'1.5.1',
|
||||
[
|
||||
'requires' => [['core', '2.28']],
|
||||
'permissions' => 'My',
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
<modules xmlns:da="http://dotaddict.org/da/">
|
||||
<module id="fac">
|
||||
<name>Feed after content</name>
|
||||
<version>1.5</version>
|
||||
<version>1.5.1</version>
|
||||
<author>Jean-Christian Denis and Contributors</author>
|
||||
<desc>Add RSS/Atom feeds after entries content</desc>
|
||||
<file>https://git.dotclear.watch/JcDenis/fac/releases/download/v1.5/plugin-fac.zip</file>
|
||||
<file>https://git.dotclear.watch/JcDenis/fac/releases/download/v1.5.1/plugin-fac.zip</file>
|
||||
<da:dcmin>2.28</da:dcmin>
|
||||
<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>
|
||||
|
|
|
@ -23,10 +23,7 @@ class Backend extends Process
|
|||
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!self::status()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (self::status()) {
|
||||
App::behavior()->addBehaviors([
|
||||
'adminBlogPreferencesFormV2' => BackendBehaviors::adminBlogPreferencesFormV2(...),
|
||||
'adminBeforeBlogSettingsUpdate' => BackendBehaviors::adminBeforeBlogSettingsUpdate(...),
|
||||
|
@ -37,7 +34,8 @@ class Backend extends Process
|
|||
'adminBeforePostDelete' => BackendBehaviors::adminBeforePostDelete(...),
|
||||
'adminPostsActions' => BackendBehaviors::adminPostsActions(...),
|
||||
]);
|
||||
}
|
||||
|
||||
return true;
|
||||
return self::status();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,9 +42,9 @@ use Exception;
|
|||
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
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ class BackendBehaviors
|
|||
$types[sprintf(
|
||||
__('"%s" pages from extension muppet'),
|
||||
$v['name']
|
||||
)] = $k;
|
||||
)] = (string) $k;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,9 +69,9 @@ 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(BlogSettingsInterface $blog_settings): void
|
||||
{
|
||||
|
@ -133,9 +133,9 @@ 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(BlogSettingsInterface $blog_settings): void
|
||||
{
|
||||
|
@ -146,7 +146,7 @@ class BackendBehaviors
|
|||
}
|
||||
|
||||
/**
|
||||
* Add javascript (toggle)
|
||||
* Add javascript (toggle).
|
||||
*
|
||||
* @return string HTML head
|
||||
*/
|
||||
|
@ -156,10 +156,10 @@ class BackendBehaviors
|
|||
}
|
||||
|
||||
/**
|
||||
* Add form to post sidebar
|
||||
* Add form to post sidebar.
|
||||
*
|
||||
* @param ArrayObject $main_items Main items
|
||||
* @param ArrayObject $sidebar_items Sidebar items
|
||||
* @param ArrayObject<string, string> $main_items Main items
|
||||
* @param ArrayObject<string, array<string, mixed>> $sidebar_items Sidebar items
|
||||
* @param null|MetaRecord $post Post record or null
|
||||
*/
|
||||
public static function adminPostFormItems(ArrayObject $main_items, ArrayObject $sidebar_items, ?MetaRecord $post): void
|
||||
|
@ -191,10 +191,10 @@ class BackendBehaviors
|
|||
}
|
||||
|
||||
/**
|
||||
* Save linked feed
|
||||
* Save linked feed.
|
||||
*
|
||||
* @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
|
||||
{
|
||||
|
@ -211,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
|
||||
{
|
||||
|
@ -221,7 +221,7 @@ class BackendBehaviors
|
|||
}
|
||||
|
||||
/**
|
||||
* Add actions to posts page combo
|
||||
* Add actions to posts page combo.
|
||||
*
|
||||
* @param ActionsPosts $pa ActionsPostsPage instance
|
||||
*/
|
||||
|
@ -249,10 +249,10 @@ class BackendBehaviors
|
|||
}
|
||||
|
||||
/**
|
||||
* Posts actions callback to remove linked feed
|
||||
* Posts actions callback to remove linked feed.
|
||||
*
|
||||
* @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
|
||||
{
|
||||
|
@ -275,7 +275,7 @@ class BackendBehaviors
|
|||
|
||||
# Delete unused feed
|
||||
foreach ($posts_ids as $post_id) {
|
||||
self::delFeed($post_id);
|
||||
self::delFeed((int) $post_id);
|
||||
}
|
||||
|
||||
Notices::addSuccessNotice(__('Linked feed deleted.'));
|
||||
|
@ -283,10 +283,10 @@ class BackendBehaviors
|
|||
}
|
||||
|
||||
/**
|
||||
* Posts actions callback to add linked feed
|
||||
* Posts actions callback to add linked feed.
|
||||
*
|
||||
* @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
|
||||
{
|
||||
|
@ -303,8 +303,8 @@ class BackendBehaviors
|
|||
if (!empty($post['fac_url'])
|
||||
&& !empty($post['fac_format'])) {
|
||||
foreach ($posts_ids as $post_id) {
|
||||
self::delFeed($post_id);
|
||||
self::addFeed($post_id, $post);
|
||||
self::delFeed((int) $post_id);
|
||||
self::addFeed((int) $post_id, $post);
|
||||
}
|
||||
|
||||
Notices::addSuccessNotice(__('Linked feed added.'));
|
||||
|
@ -325,7 +325,7 @@ class BackendBehaviors
|
|||
(new Text('', $pa->getCheckboxes() . self::formFeed())),
|
||||
(new Para())->items([
|
||||
App::nonce()->formNonce(),
|
||||
... $pa->giddenFields(),
|
||||
... $pa->hiddenFields(),
|
||||
(new Hidden(['action'], 'fac_add')),
|
||||
(new Submit(['save']))->value(__('Save')),
|
||||
]),
|
||||
|
@ -336,10 +336,11 @@ class BackendBehaviors
|
|||
}
|
||||
|
||||
/**
|
||||
* Linked feed form field
|
||||
* Linked feed form field.
|
||||
*
|
||||
* @param string $url Feed URL
|
||||
* @param string $format Feed format
|
||||
*
|
||||
* @return string Feed form content
|
||||
*/
|
||||
protected static function formFeed(string $url = '', string $format = ''): string
|
||||
|
@ -366,9 +367,9 @@ 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
|
||||
{
|
||||
|
@ -382,16 +383,16 @@ class BackendBehaviors
|
|||
|
||||
$res = [];
|
||||
foreach ($formats as $uid => $f) {
|
||||
$res[$f['name']] = $uid;
|
||||
$res[(string) $f['name']] = (string) $uid;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
@ -401,10 +402,10 @@ class BackendBehaviors
|
|||
}
|
||||
|
||||
/**
|
||||
* Add linked feed
|
||||
* Add linked feed.
|
||||
*
|
||||
* @param integer $post_id Post id
|
||||
* @param array|ArrayObject $options Feed options
|
||||
* @param int $post_id Post id
|
||||
* @param array<string, mixed>|ArrayObject<string, mixed> $options Feed options
|
||||
*/
|
||||
protected static function addFeed(int $post_id, $options): void
|
||||
{
|
||||
|
|
|
@ -169,6 +169,9 @@ class Config extends Process
|
|||
Page::helpBlock('fac');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $format
|
||||
*/
|
||||
private static function displayFacFormat(string $title, string $uid, array $format): void
|
||||
{
|
||||
echo
|
||||
|
|
|
@ -5,7 +5,6 @@ declare(strict_types=1);
|
|||
namespace Dotclear\Plugin\fac;
|
||||
|
||||
use Dotclear\App;
|
||||
use Dotclear\Core\Frontend\Ctx;
|
||||
use Dotclear\Core\Process;
|
||||
use Dotclear\Helper\Date;
|
||||
use Dotclear\Helper\Html\Html;
|
||||
|
@ -32,7 +31,7 @@ class Frontend extends Process
|
|||
return false;
|
||||
}
|
||||
|
||||
App::behavior()->addBehavior('publicEntryAfterContent', function ($___, Ctx $_ctx): void {
|
||||
App::behavior()->addBehavior('publicEntryAfterContent', function ($___, $_____): void {
|
||||
if (!App::blog()->isDefined()) {
|
||||
return;
|
||||
}
|
||||
|
@ -133,7 +132,7 @@ class Frontend extends Process
|
|||
$feeddesc = '';
|
||||
if (My::settings()->get('showfeeddesc')
|
||||
&& '' != $feed->description) {
|
||||
$feeddesc = '<p>' . $_ctx::global_filters(
|
||||
$feeddesc = '<p>' . App::frontend()->context()->global_filters(
|
||||
$feed->description,
|
||||
['encode_xml', 'remove_html']
|
||||
) . '</p>';
|
||||
|
@ -159,7 +158,7 @@ class Frontend extends Process
|
|||
$date = Date::dt2str($dateformat, $item->pubdate);
|
||||
|
||||
// Entries title
|
||||
$title = $_ctx::global_filters(
|
||||
$title = App::frontend()->context()->global_filters(
|
||||
str_replace(
|
||||
[
|
||||
'%D',
|
||||
|
@ -175,13 +174,13 @@ class Frontend extends Process
|
|||
$item->description,
|
||||
$item->content,
|
||||
],
|
||||
$format['linestitletext']
|
||||
(string) $format['linestitletext']
|
||||
),
|
||||
['remove_html', 'cut_string' => abs((int) $format['linestitlelength'])],
|
||||
);
|
||||
|
||||
// Entries over title
|
||||
$overtitle = $_ctx::global_filters(
|
||||
$overtitle = App::frontend()->context()->global_filters(
|
||||
str_replace(
|
||||
[
|
||||
'%D',
|
||||
|
@ -197,7 +196,7 @@ class Frontend extends Process
|
|||
$item->description,
|
||||
$item->content,
|
||||
],
|
||||
$format['linestitleover']
|
||||
(string) $format['linestitleover']
|
||||
),
|
||||
['remove_html', 'cut_string' => 350],
|
||||
);
|
||||
|
@ -207,7 +206,7 @@ class Frontend extends Process
|
|||
if ($format['showlinesdescription']
|
||||
&& '' != $item->description) {
|
||||
$description = '<dd>' .
|
||||
$_ctx::global_filters(
|
||||
App::frontend()->context()->global_filters(
|
||||
$item->description,
|
||||
['remove_html' => (int) $format['linesdescriptionnohtml'], 'cut_string' => abs((int) $format['linesdescriptionlength'])]
|
||||
) . '</dd>';
|
||||
|
@ -218,7 +217,7 @@ class Frontend extends Process
|
|||
if ($format['showlinescontent']
|
||||
&& '' != $item->content) {
|
||||
$content = '<dd>' .
|
||||
$_ctx::global_filters(
|
||||
App::frontend()->context()->global_filters(
|
||||
$item->content,
|
||||
['remove_html' => (int) $format['linescontentnohtml'], 'cut_string' => abs((int) $format['linescontentlength'])]
|
||||
) . '</dd>';
|
||||
|
|
Loading…
Reference in New Issue