document a few more plugin hooks

This commit is contained in:
Andrew Dolgov 2021-11-17 18:30:32 +03:00
parent 3e273ea527
commit aeb4137cbd
1 changed files with 23 additions and 21 deletions

View File

@ -263,7 +263,7 @@ abstract class Plugin {
return []; return [];
} }
/** Allows adding new UI elements to tt-rss main toolbar /** Allows adding new UI elements to tt-rss main toolbar (to the right, before Actions... dropdown)
* @return string * @return string
* @see PluginHost::HOOK_TOOLBAR_BUTTON * @see PluginHost::HOOK_TOOLBAR_BUTTON
*/ */
@ -385,7 +385,7 @@ abstract class Plugin {
return []; return [];
} }
/** /** Invoked when enclosures are rendered to HTML (when article itself is rendered)
* @param string $enclosures_formatted * @param string $enclosures_formatted
* @param array<int, array<string, mixed>> $enclosures * @param array<int, array<string, mixed>> $enclosures
* @param int $article_id * @param int $article_id
@ -401,7 +401,7 @@ abstract class Plugin {
return ""; return "";
} }
/** /** Invoked during feed subscription (after data has been fetched)
* @param string $contents * @param string $contents
* @param string $url * @param string $url
* @param string $auth_login * @param string $auth_login
@ -467,7 +467,7 @@ abstract class Plugin {
return []; return [];
} }
/** /** Allows adding custom buttons to tt-rss main toolbar (left side)
* @return void * @return void
* @see PluginHost::HOOK_MAIN_TOOLBAR_BUTTON * @see PluginHost::HOOK_MAIN_TOOLBAR_BUTTON
*/ */
@ -475,7 +475,7 @@ abstract class Plugin {
user_error("Dummy method invoked.", E_USER_ERROR); user_error("Dummy method invoked.", E_USER_ERROR);
} }
/** /** Invoked for every enclosure entry as article is being rendered
* @param array<string,string> $entry * @param array<string,string> $entry
* @param int $id * @param int $id
* @param array{'formatted': string, 'entries': array<int, array<string, mixed>>} $rv * @param array{'formatted': string, 'entries': array<int, array<string, mixed>>} $rv
@ -488,7 +488,7 @@ abstract class Plugin {
return []; return [];
} }
/** /** Share plugins run this when article is being rendered as HTML for sharing
* @param string $html * @param string $html
* @param array<string,mixed> $row * @param array<string,mixed> $row
* @return string ($html) * @return string ($html)
@ -500,7 +500,7 @@ abstract class Plugin {
return ""; return "";
} }
/** /** Invoked when basic feed information (title, site_url) is being collected, useful to override default if feed doesn't provide anything (or feed itself is synthesized)
* @param array{"title": string, "site_url": string} $basic_info * @param array{"title": string, "site_url": string} $basic_info
* @param string $fetch_url * @param string $fetch_url
* @param int $owner_uid * @param int $owner_uid
@ -516,7 +516,8 @@ abstract class Plugin {
return $basic_info; return $basic_info;
} }
/** /** Invoked when file (e.g. cache entry, static data) is being sent to client, may override default mechanism
* using faster httpd-specific implementation (see nginx_xaccel)
* @param string $filename * @param string $filename
* @return bool * @return bool
* @see PluginHost::HOOK_SEND_LOCAL_FILE * @see PluginHost::HOOK_SEND_LOCAL_FILE
@ -527,7 +528,7 @@ abstract class Plugin {
return false; return false;
} }
/** /** Invoked when user tries to unsubscribe from a feed, returning true would prevent any further default actions
* @param int $feed_id * @param int $feed_id
* @param int $owner_uid * @param int $owner_uid
* @return bool * @return bool
@ -539,7 +540,7 @@ abstract class Plugin {
return false; return false;
} }
/** /** Invoked when mail is being sent (if no hooks are registered, tt-rss uses PHP mail() as a fallback)
* @param Mailer $mailer * @param Mailer $mailer
* @param array<string,mixed> $params * @param array<string,mixed> $params
* @return int * @return int
@ -551,7 +552,8 @@ abstract class Plugin {
return -1; return -1;
} }
/** NOTE: $article_filters should be renamed $filter_actions because that's what this is /** Invoked when filter is triggered on an article, may be used to implement logging for filters
* NOTE: $article_filters should be renamed $filter_actions because that's what this is
* @param int $feed_id * @param int $feed_id
* @param int $owner_uid * @param int $owner_uid
* @param array<string,mixed> $article * @param array<string,mixed> $article
@ -565,7 +567,7 @@ abstract class Plugin {
user_error("Dummy method invoked.", E_USER_ERROR); user_error("Dummy method invoked.", E_USER_ERROR);
} }
/** /** Plugins may provide this to allow getting full article text (af_readbility implements this)
* @param string $url * @param string $url
* @return string|false * @return string|false
* @see PluginHost::HOOK_GET_FULL_TEXT * @see PluginHost::HOOK_GET_FULL_TEXT
@ -576,7 +578,7 @@ abstract class Plugin {
return ""; return "";
} }
/** /** Invoked when article flavor image is being determined, allows overriding default selection logic
* @param array<string,string> $enclosures * @param array<string,string> $enclosures
* @param string $content * @param string $content
* @param string $site_url * @param string $site_url
@ -590,8 +592,8 @@ abstract class Plugin {
return ""; return "";
} }
/** /** Allows adding arbitrary elements before feed tree
* @return string * @return string HTML
* @see PluginHost::HOOK_FEED_TREE * @see PluginHost::HOOK_FEED_TREE
* */ * */
function hook_feed_tree() { function hook_feed_tree() {
@ -600,7 +602,7 @@ abstract class Plugin {
return ""; return "";
} }
/** /** Invoked for every iframe to determine if it is allowed to be displayed
* @param string $url * @param string $url
* @return bool * @return bool
* @see PluginHost::HOOK_IFRAME_WHITELISTED * @see PluginHost::HOOK_IFRAME_WHITELISTED
@ -623,7 +625,7 @@ abstract class Plugin {
return $enclosure; return $enclosure;
} }
/** /** Allows adding custom elements to headline sort dropdown (name -> caption)
* @return array<string,string> * @return array<string,string>
* @see PluginHost::HOOK_HEADLINES_CUSTOM_SORT_MAP * @see PluginHost::HOOK_HEADLINES_CUSTOM_SORT_MAP
*/ */
@ -633,9 +635,9 @@ abstract class Plugin {
return ["" => ""]; return ["" => ""];
} }
/** /** Allows overriding headline sorting (or provide custom sort methods)
* @param string $order * @param string $order
* @return array<int, string|bool> -- query, skip_first_id * @return array<int, string|bool> -- (query, skip_first_id)
* @see PluginHost::HOOK_HEADLINES_CUSTOM_SORT_OVERRIDE * @see PluginHost::HOOK_HEADLINES_CUSTOM_SORT_OVERRIDE
*/ */
function hook_headlines_custom_sort_override($order) { function hook_headlines_custom_sort_override($order) {
@ -644,7 +646,7 @@ abstract class Plugin {
return ["", false]; return ["", false];
} }
/** /** Allows adding custom elements to headlines Select... dropdown
* @param int $feed_id * @param int $feed_id
* @param int $is_cat * @param int $is_cat
* @return string * @return string
@ -656,7 +658,7 @@ abstract class Plugin {
return ""; return "";
} }
/** /** Invoked when user tries to subscribe to feed, may override information (i.e. feed URL) used afterwards
* @param string $url * @param string $url
* @param string $auth_login * @param string $auth_login
* @param string $auth_pass * @param string $auth_pass