From 1db606bc1b6cf25d9b9c4bef362acdb964ce1e8a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 5 Jul 2023 11:00:26 +0200 Subject: New extension hook entry_auto_read (#5505) * New extension hook entry_auto_read For extensions to be notified of articles being automatically marked as read for various reasons * Documentation + entry_auto_unread --- docs/en/developers/03_Backend/05_Extensions.md | 10 ++++++---- docs/fr/developers/03_Backend/05_Extensions.md | 12 ++++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'docs') diff --git a/docs/en/developers/03_Backend/05_Extensions.md b/docs/en/developers/03_Backend/05_Extensions.md index e86d73bfa..644420440 100644 --- a/docs/en/developers/03_Backend/05_Extensions.md +++ b/docs/en/developers/03_Backend/05_Extensions.md @@ -131,13 +131,13 @@ The `Minz_Extension` abstract class defines another set of methods that should n You can register at the FreshRSS event system in an extensions `init()` method, to manipulate data when some of the core functions are executed. -```html +```php class HelloWorldExtension extends Minz_Extension { - public function init() { - $this->registerHook('entry_before_display', array($this, 'renderEntry')); + public function init(): void { + $this->registerHook('entry_before_display', [$this, 'renderEntry']); } - public function renderEntry($entry) { + public function renderEntry(FreshRSS_Entry $entry): FreshRSS_Entry { $entry->_content('

Hello World

' . $entry->content()); return $entry; } @@ -147,6 +147,8 @@ class HelloWorldExtension extends Minz_Extension The following events are available: * `check_url_before_add` (`function($url) -> Url | null`): will be executed every time a URL is added. The URL itself will be passed as parameter. This way a website known to have feeds which doesn’t advertise it in the header can still be automatically supported. +* `entry_auto_read` (`function(FreshRSS_Entry $entry, string $why): void`): Triggered when an entry is automatically marked as read. The *why* parameter supports the rules {`filter`, `upon_reception`, `same_title_in_feed`}. +* `entry_auto_unread` (`function(FreshRSS_Entry $entry, string $why): void`): Triggered when an entry is automatically marked as unread. The *why* parameter supports the rules {`updated_article`}. * `entry_before_display` (`function($entry) -> Entry | null`): will be executed every time an entry is rendered. The entry itself (instance of FreshRSS\_Entry) will be passed as parameter. * `entry_before_insert` (`function($entry) -> Entry | null`): will be executed when a feed is refreshed and new entries will be imported into the database. The new entry (instance of FreshRSS\_Entry) will be passed as parameter. * `feed_before_actualize` (`function($feed) -> Feed | null`): will be executed when a feed is updated. The feed (instance of FreshRSS\_Feed) will be passed as parameter. diff --git a/docs/fr/developers/03_Backend/05_Extensions.md b/docs/fr/developers/03_Backend/05_Extensions.md index 548aebf4f..14a774704 100644 --- a/docs/fr/developers/03_Backend/05_Extensions.md +++ b/docs/fr/developers/03_Backend/05_Extensions.md @@ -187,13 +187,13 @@ Your class will benefit from four methods to redefine: You can register at the FreshRSS event system in an extensions `init()` method, to manipulate data when some of the core functions are executed. -```html +```php class HelloWorldExtension extends Minz_Extension { - public function init() { - $this->registerHook('entry_before_display', array($this, 'renderEntry')); + public function init(): void { + $this->registerHook('entry_before_display', [$this, 'renderEntry']); } - public function renderEntry($entry) { + public function renderEntry(FreshRSS_Entry $entry): FreshRSS_Entry { $entry->_content('

Hello World

' . $entry->content()); return $entry; } @@ -206,6 +206,10 @@ The following events are available: every time a URL is added. The URL itself will be passed as parameter. This way a website known to have feeds which doesn’t advertise it in the header can still be automatically supported. +* `entry_auto_read` (`function(FreshRSS_Entry $entry, string $why): void`): + Appelé lorsqu’une entrée est automatiquement marquée comme lue. Le paramètre *why* supporte les règles {`filter`, `upon_reception`, `same_title_in_feed`}. +* `entry_auto_unread` (`function(FreshRSS_Entry $entry, string $why): void`): + Appelé lorsqu’une entrée est automatiquement marquée comme non-lue. Le paramètre *why* supporte les règles {`updated_article`}. * `entry_before_display` (`function($entry) -> Entry | null`): will be executed every time an entry is rendered. The entry itself (instance of FreshRSS\_Entry) will be passed as parameter. -- cgit v1.2.3