From 5f70e4111889ddf4b97a257abd81f94cac7bac8a Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 1 May 2025 22:36:33 +0300 Subject: add plugin hooks invoked when articles get un/marked or un/published --- classes/RPC.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'classes/RPC.php') diff --git a/classes/RPC.php b/classes/RPC.php index 031bef509..6b6f3e909 100644 --- a/classes/RPC.php +++ b/classes/RPC.php @@ -69,6 +69,8 @@ class RPC extends Handler_Protected { $sth->execute([$mark, $id, $_SESSION['uid']]); + PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_MARKED, [$id]); + print json_encode(array("message" => "UPDATE_COUNTERS")); } @@ -95,6 +97,8 @@ class RPC extends Handler_Protected { $sth->execute([$pub, $id, $_SESSION['uid']]); + PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_PUBLISHED, [$id]); + print json_encode(array("message" => "UPDATE_COUNTERS")); } @@ -345,6 +349,8 @@ class RPC extends Handler_Protected { } $sth->execute([...$ids, $_SESSION['uid']]); + + PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_MARKED, $ids); } /** @@ -369,6 +375,8 @@ class RPC extends Handler_Protected { } $sth->execute([...$ids, $_SESSION['uid']]); + + PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_PUBLISHED, $ids); } function log(): void { -- cgit v1.2.3-54-g00ecf