add descriptions for some plugin hooks

This commit is contained in:
Andrew Dolgov 2021-11-17 15:56:58 +03:00
parent 34f294414f
commit 3e273ea527
1 changed files with 32 additions and 26 deletions

View File

@ -98,10 +98,11 @@ abstract class Plugin {
/* GLOBAL hooks are invoked in global context, only available to system plugins (loaded via .env for all users) */ /* GLOBAL hooks are invoked in global context, only available to system plugins (loaded via .env for all users) */
/** /** Adds buttons for article (on the right) - e.g. mail, share, add note.
* @param array<string,mixed> $line * @param array<string,mixed> $line
* @return string * @return string
* @see PluginHost::HOOK_ARTICLE_BUTTON * @see PluginHost::HOOK_ARTICLE_BUTTON
* @see Plugin::hook_article_left_button()
*/ */
function hook_article_button($line) { function hook_article_button($line) {
user_error("Dummy method invoked.", E_USER_ERROR); user_error("Dummy method invoked.", E_USER_ERROR);
@ -109,7 +110,7 @@ abstract class Plugin {
return ""; return "";
} }
/** /** Allows plugins to alter article data as gathered from feed XML, i.e. embed images, get full text content, etc.
* @param array<string,mixed> $article * @param array<string,mixed> $article
* @return array<string,mixed> * @return array<string,mixed>
* @see PluginHost::HOOK_ARTICLE_FILTER * @see PluginHost::HOOK_ARTICLE_FILTER
@ -120,7 +121,7 @@ abstract class Plugin {
return []; return [];
} }
/** /** Allow adding new UI elements (e.g. accordion panes) to (top) tab contents in Preferences
* @param string $tab * @param string $tab
* @return void * @return void
* @see PluginHost::HOOK_PREFS_TAB * @see PluginHost::HOOK_PREFS_TAB
@ -129,7 +130,7 @@ abstract class Plugin {
user_error("Dummy method invoked.", E_USER_ERROR); user_error("Dummy method invoked.", E_USER_ERROR);
} }
/** /** Allow adding new content to various sections of preferences UI (i.e. OPML import/export pane)
* @param string $section * @param string $section
* @return void * @return void
* @see PluginHost::HOOK_PREFS_TAB_SECTION * @see PluginHost::HOOK_PREFS_TAB_SECTION
@ -138,14 +139,15 @@ abstract class Plugin {
user_error("Dummy method invoked.", E_USER_ERROR); user_error("Dummy method invoked.", E_USER_ERROR);
} }
/** @return void /** Allows adding new (top) tabs in preferences UI
* @return void
* @see PluginHost::HOOK_PREFS_TABS * @see PluginHost::HOOK_PREFS_TABS
*/ */
function hook_prefs_tabs() { function hook_prefs_tabs() {
user_error("Dummy method invoked.", E_USER_ERROR); user_error("Dummy method invoked.", E_USER_ERROR);
} }
/** /** Invoked when feed XML is processed by FeedParser class
* @param FeedParser $parser * @param FeedParser $parser
* @param int $feed_id * @param int $feed_id
* @return void * @return void
@ -155,7 +157,7 @@ abstract class Plugin {
user_error("Dummy method invoked.", E_USER_ERROR); user_error("Dummy method invoked.", E_USER_ERROR);
} }
/** GLOBAL /** GLOBAL: Invoked when a feed update task finishes
* @param array<string,string> $cli_options * @param array<string,string> $cli_options
* @return void * @return void
* @see PluginHost::HOOK_UPDATE_TASK * @see PluginHost::HOOK_UPDATE_TASK
@ -164,7 +166,7 @@ abstract class Plugin {
user_error("Dummy method invoked.", E_USER_ERROR); user_error("Dummy method invoked.", E_USER_ERROR);
} }
/** this is a pluginhost compatibility wrapper that invokes $this->authenticate(...$args) (Auth_Base) /** This is a pluginhost compatibility wrapper that invokes $this->authenticate(...$args) (Auth_Base)
* @param string $login * @param string $login
* @param string $password * @param string $password
* @param string $service * @param string $service
@ -187,10 +189,11 @@ abstract class Plugin {
return false; return false;
} }
/** /** Allows plugins to modify global hotkey map (hotkey sequence -> action)
* @param array<string, string> $hotkeys * @param array<string, string> $hotkeys
* @return array<string, string> * @return array<string, string>
* @see PluginHost::HOOK_HOTKEY_MAP * @see PluginHost::HOOK_HOTKEY_MAP
* @see Plugin::hook_hotkey_info()
*/ */
function hook_hotkey_map($hotkeys) { function hook_hotkey_map($hotkeys) {
user_error("Dummy method invoked.", E_USER_ERROR); user_error("Dummy method invoked.", E_USER_ERROR);
@ -198,7 +201,7 @@ abstract class Plugin {
return []; return [];
} }
/** /** Invoked when article is rendered by backend (before it gets passed to frontent JS code) - three panel mode
* @param array<string, mixed> $article * @param array<string, mixed> $article
* @return array<string, mixed> * @return array<string, mixed>
* @see PluginHost::HOOK_RENDER_ARTICLE * @see PluginHost::HOOK_RENDER_ARTICLE
@ -209,7 +212,7 @@ abstract class Plugin {
return []; return [];
} }
/** /** Invoked when article is rendered by backend (before it gets passed to frontent JS code) - combined mode
* @param array<string, mixed> $article * @param array<string, mixed> $article
* @return array<string, mixed> * @return array<string, mixed>
* @see PluginHost::HOOK_RENDER_ARTICLE_CDM * @see PluginHost::HOOK_RENDER_ARTICLE_CDM
@ -220,7 +223,7 @@ abstract class Plugin {
return []; return [];
} }
/** /** Invoked when raw feed XML data has been successfully downloaded (but not parsed yet)
* @param string $feed_data * @param string $feed_data
* @param string $fetch_url * @param string $fetch_url
* @param int $owner_uid * @param int $owner_uid
@ -234,7 +237,7 @@ abstract class Plugin {
return ""; return "";
} }
/** /** Invoked on article content when it is sanitized (i.e. potentially harmful tags removed)
* @param DOMDocument $doc * @param DOMDocument $doc
* @param string $site_url * @param string $site_url
* @param array<string> $allowed_elements * @param array<string> $allowed_elements
@ -249,7 +252,7 @@ abstract class Plugin {
return $doc; return $doc;
} }
/** /** Invoked when article is rendered by backend (before it gets passed to frontent JS code) - exclusive to API clients
* @param array{'article': array<string,mixed>|null, 'headline': array<string,mixed>|null} $params * @param array{'article': array<string,mixed>|null, 'headline': array<string,mixed>|null} $params
* @return array<string, string> * @return array<string, string>
* @see PluginHost::HOOK_RENDER_ARTICLE_API * @see PluginHost::HOOK_RENDER_ARTICLE_API
@ -260,7 +263,7 @@ abstract class Plugin {
return []; return [];
} }
/** /** Allows adding new UI elements to tt-rss main toolbar
* @return string * @return string
* @see PluginHost::HOOK_TOOLBAR_BUTTON * @see PluginHost::HOOK_TOOLBAR_BUTTON
*/ */
@ -270,7 +273,7 @@ abstract class Plugin {
return ""; return "";
} }
/** /** Allows adding new items to tt-rss main Actions... dropdown menu
* @return string * @return string
* @see PluginHost::HOOK_ACTION_ITEM * @see PluginHost::HOOK_ACTION_ITEM
*/ */
@ -280,7 +283,7 @@ abstract class Plugin {
return ""; return "";
} }
/** /** Allows adding new UI elements to the toolbar area related to currently loaded feed headlines
* @param int $feed_id * @param int $feed_id
* @param bool $is_cat * @param bool $is_cat
* @return string * @return string
@ -292,10 +295,11 @@ abstract class Plugin {
return ""; return "";
} }
/** /** Allows adding new hotkey action names and descriptions
* @param array<string, array<string, string>> $hotkeys * @param array<string, array<string, string>> $hotkeys
* @return array<string, array<string, string>> * @return array<string, array<string, string>>
* @see PluginHost::HOOK_HOTKEY_INFO * @see PluginHost::HOOK_HOTKEY_INFO
* @see Plugin::hook_hotkey_map()
*/ */
function hook_hotkey_info($hotkeys) { function hook_hotkey_info($hotkeys) {
user_error("Dummy method invoked.", E_USER_ERROR); user_error("Dummy method invoked.", E_USER_ERROR);
@ -303,10 +307,11 @@ abstract class Plugin {
return []; return [];
} }
/** /** Adds per-article buttons on the left side
* @param array<string,mixed> $row * @param array<string,mixed> $row
* @return string * @return string
* @see PluginHost::HOOK_ARTICLE_LEFT_BUTTON * @see PluginHost::HOOK_ARTICLE_LEFT_BUTTON
* @see Plugin::hook_article_button()
*/ */
function hook_article_left_button($row) { function hook_article_left_button($row) {
user_error("Dummy method invoked.", E_USER_ERROR); user_error("Dummy method invoked.", E_USER_ERROR);
@ -314,7 +319,7 @@ abstract class Plugin {
return ""; return "";
} }
/** /** Allows adding new UI elements to the "Plugins" tab of the feed editor UI
* @param int $feed_id * @param int $feed_id
* @return void * @return void
* @see PluginHost::HOOK_PREFS_EDIT_FEED * @see PluginHost::HOOK_PREFS_EDIT_FEED
@ -323,7 +328,7 @@ abstract class Plugin {
user_error("Dummy method invoked.", E_USER_ERROR); user_error("Dummy method invoked.", E_USER_ERROR);
} }
/** /** Invoked when data is saved in the feed editor
* @param int $feed_id * @param int $feed_id
* @return void * @return void
* @see PluginHost::HOOK_PREFS_SAVE_FEED * @see PluginHost::HOOK_PREFS_SAVE_FEED
@ -332,7 +337,8 @@ abstract class Plugin {
user_error("Dummy method invoked.", E_USER_ERROR); user_error("Dummy method invoked.", E_USER_ERROR);
} }
/** /** Allows overriding built-in fetching mechanism for feeds, substituting received data if necessary
* (i.e. origin site doesn't actually provide any RSS feeds), or XML is invalid
* @param string $feed_data * @param string $feed_data
* @param string $fetch_url * @param string $fetch_url
* @param int $owner_uid * @param int $owner_uid
@ -349,7 +355,7 @@ abstract class Plugin {
return ""; return "";
} }
/** /** Invoked when headlines data ($row) has been retrieved from the database
* @param array<string,mixed> $row * @param array<string,mixed> $row
* @param int $excerpt_length * @param int $excerpt_length
* @return array<string,mixed> * @return array<string,mixed>
@ -361,16 +367,16 @@ abstract class Plugin {
return []; return [];
} }
/** GLOBAL /** GLOBAL: This is run periodically by the update daemon when idle
* @return void * @return void
* @see PluginHost::HOOK_HOUSE_KEEPING */ * @see PluginHost::HOOK_HOUSE_KEEPING */
function hook_house_keeping() { function hook_house_keeping() {
user_error("Dummy method invoked.", E_USER_ERROR); user_error("Dummy method invoked.", E_USER_ERROR);
} }
/** /** Allows overriding built-in article search
* @param string $query * @param string $query
* @return array<int, string|array<string>> * @return array<int, string|array<string>> - list(SQL search query, highlight keywords)
* @see PluginHost::HOOK_SEARCH * @see PluginHost::HOOK_SEARCH
*/ */
function hook_search($query) { function hook_search($query) {