2012-12-23 11:29:16 +00:00
|
|
|
<?php
|
2017-05-23 18:16:30 +00:00
|
|
|
abstract class Plugin {
|
2013-04-19 13:26:22 +00:00
|
|
|
const API_VERSION_COMPAT = 1;
|
|
|
|
|
2021-03-02 09:15:42 +00:00
|
|
|
/** @var PDO $pdo */
|
2017-12-02 21:18:08 +00:00
|
|
|
protected $pdo;
|
|
|
|
|
2021-11-13 16:41:50 +00:00
|
|
|
/**
|
|
|
|
* @param PluginHost $host
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
* */
|
2021-11-13 16:36:24 +00:00
|
|
|
abstract function init($host);
|
2012-12-25 06:02:08 +00:00
|
|
|
|
2021-11-13 16:52:47 +00:00
|
|
|
/** @return array<null|float|string|bool> */
|
2021-11-13 16:36:24 +00:00
|
|
|
abstract function about();
|
2017-05-23 18:16:30 +00:00
|
|
|
// return array(1.0, "plugin", "No description", "No author", false);
|
2012-12-25 06:02:08 +00:00
|
|
|
|
2017-12-03 06:43:18 +00:00
|
|
|
function __construct() {
|
|
|
|
$this->pdo = Db::pdo();
|
|
|
|
}
|
|
|
|
|
2021-11-13 16:55:30 +00:00
|
|
|
/** @return array<string,bool> */
|
2021-11-13 16:36:24 +00:00
|
|
|
function flags() {
|
2016-01-26 08:45:47 +00:00
|
|
|
/* associative array, possible keys:
|
|
|
|
needs_curl = boolean
|
|
|
|
*/
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
2021-11-13 16:41:50 +00:00
|
|
|
/**
|
|
|
|
* @param string $method
|
|
|
|
*
|
|
|
|
* @return bool */
|
2021-11-13 16:36:24 +00:00
|
|
|
function is_public_method($method) {
|
2017-02-10 13:04:28 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-11-13 16:41:50 +00:00
|
|
|
/**
|
|
|
|
* @param string $method
|
|
|
|
*
|
|
|
|
* @return bool */
|
2021-11-13 16:36:24 +00:00
|
|
|
function csrf_ignore($method) {
|
2021-03-02 09:15:42 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-11-13 16:41:50 +00:00
|
|
|
/** @return string */
|
2021-11-13 16:36:24 +00:00
|
|
|
function get_js() {
|
2012-12-25 06:02:08 +00:00
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2021-11-13 16:52:47 +00:00
|
|
|
/** @return string */
|
|
|
|
function get_css() {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2021-11-13 16:41:50 +00:00
|
|
|
/** @return string */
|
2021-11-13 16:36:24 +00:00
|
|
|
function get_prefs_js() {
|
2012-12-25 06:02:08 +00:00
|
|
|
return "";
|
|
|
|
}
|
2013-04-19 13:26:22 +00:00
|
|
|
|
2021-11-13 16:41:50 +00:00
|
|
|
/** @return int */
|
2021-11-13 16:36:24 +00:00
|
|
|
function api_version() {
|
2013-04-19 13:26:22 +00:00
|
|
|
return Plugin::API_VERSION_COMPAT;
|
|
|
|
}
|
2019-03-05 07:26:23 +00:00
|
|
|
|
|
|
|
/* gettext-related helpers */
|
|
|
|
|
2021-11-13 16:41:50 +00:00
|
|
|
/**
|
|
|
|
* @param string $msgid
|
|
|
|
*
|
|
|
|
* @return string */
|
2021-11-13 16:36:24 +00:00
|
|
|
function __($msgid) {
|
2021-11-13 15:26:11 +00:00
|
|
|
/** @var Plugin $this -- this is a strictly template-related hack */
|
2019-03-05 07:26:23 +00:00
|
|
|
return _dgettext(PluginHost::object_to_domain($this), $msgid);
|
|
|
|
}
|
|
|
|
|
2021-11-13 16:41:50 +00:00
|
|
|
/**
|
|
|
|
* @param string $singular
|
|
|
|
* @param string $plural
|
|
|
|
* @param int $number
|
|
|
|
*
|
|
|
|
* @return string */
|
2021-11-13 16:36:24 +00:00
|
|
|
function _ngettext($singular, $plural, $number) {
|
2021-11-13 15:26:11 +00:00
|
|
|
/** @var Plugin $this -- this is a strictly template-related hack */
|
2019-03-05 07:26:23 +00:00
|
|
|
return _dngettext(PluginHost::object_to_domain($this), $singular, $plural, $number);
|
|
|
|
}
|
|
|
|
|
2021-11-13 16:41:50 +00:00
|
|
|
/** @return string */
|
2021-11-13 16:36:24 +00:00
|
|
|
function T_sprintf() {
|
2019-03-05 07:26:23 +00:00
|
|
|
$args = func_get_args();
|
|
|
|
$msgid = array_shift($args);
|
|
|
|
|
|
|
|
return vsprintf($this->__($msgid), $args);
|
|
|
|
}
|
2021-11-13 17:03:28 +00:00
|
|
|
|
|
|
|
/* plugin hook methods */
|
|
|
|
|
2021-11-16 13:31:40 +00:00
|
|
|
/* GLOBAL hooks are invoked in global context, only available to system plugins (loaded via .env for all users) */
|
|
|
|
|
2021-11-13 17:07:13 +00:00
|
|
|
/**
|
|
|
|
* @param array<string,mixed> $line
|
|
|
|
* @return string
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_ARTICLE_BUTTON
|
2021-11-13 17:07:13 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_article_button($line) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:07:47 +00:00
|
|
|
|
|
|
|
return "";
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-13 17:07:13 +00:00
|
|
|
/**
|
|
|
|
* @param array<string,mixed> $article
|
|
|
|
* @return array<string,mixed>
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_ARTICLE_FILTER
|
2021-11-13 17:07:13 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_article_filter($article) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:07:47 +00:00
|
|
|
|
|
|
|
return [];
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-13 17:07:13 +00:00
|
|
|
/**
|
|
|
|
* @param string $tab
|
|
|
|
* @return void
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_PREFS_TAB
|
2021-11-13 17:07:13 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_prefs_tab($tab) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
2021-11-13 17:07:13 +00:00
|
|
|
/**
|
|
|
|
* @param string $section
|
|
|
|
* @return void
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_PREFS_TAB_SECTION
|
2021-11-13 17:07:13 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_prefs_tab_section($section) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
2021-11-16 13:31:40 +00:00
|
|
|
/** @return void
|
|
|
|
* @see PluginHost::HOOK_PREFS_TABS
|
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_prefs_tabs() {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
2021-11-14 13:49:10 +00:00
|
|
|
/**
|
|
|
|
* @param FeedParser $parser
|
|
|
|
* @param int $feed_id
|
|
|
|
* @return void
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_FEED_PARSED
|
2021-11-14 13:49:10 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_feed_parsed($parser, $feed_id) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
2021-11-16 13:31:40 +00:00
|
|
|
/** GLOBAL
|
2021-11-14 13:49:10 +00:00
|
|
|
* @param array<string,string> $cli_options
|
|
|
|
* @return void
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_UPDATE_TASK
|
2021-11-14 13:49:10 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_update_task($cli_options) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
2021-11-14 07:48:32 +00:00
|
|
|
/** this is a pluginhost compatibility wrapper that invokes $this->authenticate(...$args) (Auth_Base)
|
2021-11-14 08:11:49 +00:00
|
|
|
* @param string $login
|
|
|
|
* @param string $password
|
|
|
|
* @param string $service
|
2021-11-14 07:48:32 +00:00
|
|
|
* @return int|false user_id
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_AUTH_USER
|
2021-11-14 07:48:32 +00:00
|
|
|
*/
|
2021-11-14 08:11:49 +00:00
|
|
|
function hook_auth_user($login, $password, $service = '') {
|
2021-11-13 17:03:28 +00:00
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 07:48:32 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** IAuthModule only
|
|
|
|
* @param string $login
|
|
|
|
* @param string $password
|
2021-11-14 08:11:49 +00:00
|
|
|
* @param string $service
|
2021-11-14 07:48:32 +00:00
|
|
|
* @return int|false user_id
|
|
|
|
*/
|
2021-11-14 08:11:49 +00:00
|
|
|
function authenticate($login, $password, $service = '') {
|
2021-11-14 07:48:32 +00:00
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
return false;
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 13:49:10 +00:00
|
|
|
/**
|
|
|
|
* @param array<string, string> $hotkeys
|
|
|
|
* @return array<string, string>
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_HOTKEY_MAP
|
2021-11-14 13:49:10 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_hotkey_map($hotkeys) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:07:47 +00:00
|
|
|
|
|
|
|
return [];
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 13:49:10 +00:00
|
|
|
/**
|
|
|
|
* @param array<string, mixed> $article
|
|
|
|
* @return array<string, mixed>
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_RENDER_ARTICLE
|
2021-11-14 13:49:10 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_render_article($article) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 13:49:10 +00:00
|
|
|
|
|
|
|
return [];
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 13:49:10 +00:00
|
|
|
/**
|
|
|
|
* @param array<string, mixed> $article
|
|
|
|
* @return array<string, mixed>
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_RENDER_ARTICLE_CDM
|
2021-11-14 13:49:10 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_render_article_cdm($article) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 13:49:10 +00:00
|
|
|
|
|
|
|
return [];
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 13:49:10 +00:00
|
|
|
/**
|
|
|
|
* @param string $feed_data
|
|
|
|
* @param string $fetch_url
|
|
|
|
* @param int $owner_uid
|
|
|
|
* @param int $feed
|
|
|
|
* @return string
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_FEED_FETCHED
|
2021-11-14 13:49:10 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_feed_fetched($feed_data, $fetch_url, $owner_uid, $feed) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 13:49:10 +00:00
|
|
|
|
|
|
|
return "";
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 14:19:35 +00:00
|
|
|
/**
|
|
|
|
* @param DOMDocument $doc
|
|
|
|
* @param string $site_url
|
|
|
|
* @param array<string> $allowed_elements
|
|
|
|
* @param array<string> $disallowed_attributes
|
|
|
|
* @param int $article_id
|
2021-11-14 17:19:12 +00:00
|
|
|
* @return DOMDocument|array<int,DOMDocument|array<string>>
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_SANITIZE
|
2021-11-14 14:19:35 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes, $article_id) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:19:35 +00:00
|
|
|
|
|
|
|
return $doc;
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 13:49:10 +00:00
|
|
|
/**
|
2021-11-14 15:05:31 +00:00
|
|
|
* @param array{'article': array<string,mixed>|null, 'headline': array<string,mixed>|null} $params
|
2021-11-14 13:49:10 +00:00
|
|
|
* @return array<string, string>
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_RENDER_ARTICLE_API
|
2021-11-14 13:49:10 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_render_article_api($params) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 13:49:10 +00:00
|
|
|
|
|
|
|
return [];
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-16 13:31:40 +00:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
* @see PluginHost::HOOK_TOOLBAR_BUTTON
|
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_toolbar_button() {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 13:49:10 +00:00
|
|
|
|
|
|
|
return "";
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-16 13:31:40 +00:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
* @see PluginHost::HOOK_ACTION_ITEM
|
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_action_item() {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 13:49:10 +00:00
|
|
|
|
|
|
|
return "";
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 13:49:10 +00:00
|
|
|
/**
|
|
|
|
* @param int $feed_id
|
|
|
|
* @param bool $is_cat
|
|
|
|
* @return string
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_HEADLINE_TOOLBAR_BUTTON
|
2021-11-14 13:49:10 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_headline_toolbar_button($feed_id, $is_cat) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 13:49:10 +00:00
|
|
|
|
|
|
|
return "";
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 13:49:10 +00:00
|
|
|
/**
|
2021-11-14 22:16:16 +00:00
|
|
|
* @param array<string, array<string, string>> $hotkeys
|
2021-11-14 22:11:27 +00:00
|
|
|
* @return array<string, array<string, string>>
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_HOTKEY_INFO
|
2021-11-14 13:49:10 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_hotkey_info($hotkeys) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 13:49:10 +00:00
|
|
|
|
|
|
|
return [];
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 14:07:47 +00:00
|
|
|
/**
|
|
|
|
* @param array<string,mixed> $row
|
|
|
|
* @return string
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_ARTICLE_LEFT_BUTTON
|
2021-11-14 14:07:47 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_article_left_button($row) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:07:47 +00:00
|
|
|
|
|
|
|
return "";
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 14:07:47 +00:00
|
|
|
/**
|
|
|
|
* @param int $feed_id
|
|
|
|
* @return void
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_PREFS_EDIT_FEED
|
2021-11-14 14:07:47 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_prefs_edit_feed($feed_id) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
2021-11-14 14:07:47 +00:00
|
|
|
/**
|
|
|
|
* @param int $feed_id
|
|
|
|
* @return void
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_PREFS_SAVE_FEED
|
2021-11-14 14:07:47 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_prefs_save_feed($feed_id) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
2021-11-14 14:19:35 +00:00
|
|
|
/**
|
|
|
|
* @param string $feed_data
|
|
|
|
* @param string $fetch_url
|
|
|
|
* @param int $owner_uid
|
|
|
|
* @param int $feed
|
|
|
|
* @param int $last_article_timestamp
|
|
|
|
* @param string $auth_login
|
|
|
|
* @param string $auth_pass
|
|
|
|
* @return string (possibly mangled feed data)
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_FETCH_FEED
|
2021-11-14 14:19:35 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed, $last_article_timestamp, $auth_login, $auth_pass) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:19:35 +00:00
|
|
|
|
|
|
|
return "";
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 14:07:47 +00:00
|
|
|
/**
|
|
|
|
* @param array<string,mixed> $row
|
|
|
|
* @param int $excerpt_length
|
|
|
|
* @return array<string,mixed>
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_QUERY_HEADLINES
|
2021-11-14 14:07:47 +00:00
|
|
|
*/
|
|
|
|
function hook_query_headlines($row, $excerpt_length) {
|
2021-11-13 17:03:28 +00:00
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:07:47 +00:00
|
|
|
|
|
|
|
return [];
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-16 13:31:40 +00:00
|
|
|
/** GLOBAL
|
|
|
|
* @return void
|
|
|
|
* @see PluginHost::HOOK_HOUSE_KEEPING */
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_house_keeping() {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
2021-11-14 14:07:47 +00:00
|
|
|
/**
|
|
|
|
* @param string $query
|
2021-11-15 03:53:55 +00:00
|
|
|
* @return array<int, string|array<string>>
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_SEARCH
|
2021-11-14 14:07:47 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_search($query) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:07:47 +00:00
|
|
|
|
|
|
|
return [];
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 14:19:35 +00:00
|
|
|
/**
|
|
|
|
* @param string $enclosures_formatted
|
|
|
|
* @param array<int, array<string, mixed>> $enclosures
|
|
|
|
* @param int $article_id
|
|
|
|
* @param bool $always_display_enclosures
|
|
|
|
* @param string $article_content
|
|
|
|
* @param bool $hide_images
|
|
|
|
* @return string|array<string,array<int, array<string, mixed>>> ($enclosures_formatted, $enclosures)
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_FORMAT_ENCLOSURES
|
2021-11-14 14:19:35 +00:00
|
|
|
*/
|
|
|
|
function hook_format_enclosures($enclosures_formatted, $enclosures, $article_id, $always_display_enclosures, $article_content, $hide_images) {
|
2021-11-13 17:03:28 +00:00
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:19:35 +00:00
|
|
|
|
|
|
|
return "";
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 14:07:47 +00:00
|
|
|
/**
|
|
|
|
* @param string $contents
|
|
|
|
* @param string $url
|
|
|
|
* @param string $auth_login
|
|
|
|
* @param string $auth_pass
|
|
|
|
* @return string (possibly mangled feed data)
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_SUBSCRIBE_FEED
|
2021-11-14 14:07:47 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_subscribe_feed($contents, $url, $auth_login, $auth_pass) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:19:35 +00:00
|
|
|
|
|
|
|
return "";
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 14:07:47 +00:00
|
|
|
/**
|
|
|
|
* @param int $feed
|
|
|
|
* @param bool $is_cat
|
|
|
|
* @param array<string,mixed> $qfh_ret (headlines object)
|
|
|
|
* @return string
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_HEADLINES_BEFORE
|
2021-11-14 14:07:47 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_headlines_before($feed, $is_cat, $qfh_ret) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:07:47 +00:00
|
|
|
|
|
|
|
return "";
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 14:07:47 +00:00
|
|
|
/**
|
|
|
|
* @param array<string,mixed> $entry
|
|
|
|
* @param int $article_id
|
|
|
|
* @param array<string,mixed> $rv
|
|
|
|
* @return string
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_RENDER_ENCLOSURE
|
2021-11-14 14:07:47 +00:00
|
|
|
*/
|
|
|
|
function hook_render_enclosure($entry, $article_id, $rv) {
|
2021-11-13 17:03:28 +00:00
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:19:35 +00:00
|
|
|
|
|
|
|
return "";
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 14:19:35 +00:00
|
|
|
/**
|
|
|
|
* @param array<string,mixed> $article
|
|
|
|
* @param string $action
|
|
|
|
* @return array<string,mixed> ($article)
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_ARTICLE_FILTER_ACTION
|
2021-11-14 14:19:35 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_article_filter_action($article, $action) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:19:35 +00:00
|
|
|
|
|
|
|
return [];
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 14:07:47 +00:00
|
|
|
/**
|
|
|
|
* @param array<string,mixed> $line
|
|
|
|
* @param int $feed
|
|
|
|
* @param bool $is_cat
|
|
|
|
* @param int $owner_uid
|
|
|
|
* @return array<string,mixed> ($line)
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_ARTICLE_EXPORT_FEED
|
2021-11-14 14:07:47 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_article_export_feed($line, $feed, $is_cat, $owner_uid) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:07:47 +00:00
|
|
|
|
|
|
|
return [];
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-16 13:31:40 +00:00
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
* @see PluginHost::HOOK_MAIN_TOOLBAR_BUTTON
|
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_main_toolbar_button() {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
2021-11-14 08:11:49 +00:00
|
|
|
/**
|
|
|
|
* @param array<string,string> $entry
|
|
|
|
* @param int $id
|
|
|
|
* @param array{'formatted': string, 'entries': array<int, array<string, mixed>>} $rv
|
2021-11-14 14:07:47 +00:00
|
|
|
* @return array<string,string> ($entry)
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_ENCLOSURE_ENTRY
|
2021-11-14 08:11:49 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_enclosure_entry($entry, $id, $rv) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:07:47 +00:00
|
|
|
|
|
|
|
return [];
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 14:07:47 +00:00
|
|
|
/**
|
|
|
|
* @param string $html
|
|
|
|
* @param array<string,mixed> $row
|
|
|
|
* @return string ($html)
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_FORMAT_ARTICLE
|
2021-11-14 14:07:47 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_format_article($html, $row) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:19:35 +00:00
|
|
|
|
|
|
|
return "";
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 15:00:03 +00:00
|
|
|
/**
|
|
|
|
* @param array{"title": string, "site_url": string} $basic_info
|
|
|
|
* @param string $fetch_url
|
|
|
|
* @param int $owner_uid
|
|
|
|
* @param int $feed_id
|
|
|
|
* @param string $auth_login
|
|
|
|
* @param string $auth_pass
|
|
|
|
* @return array{"title": string, "site_url": string}
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_FEED_BASIC_INFO
|
2021-11-14 15:00:03 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_feed_basic_info($basic_info, $fetch_url, $owner_uid, $feed_id, $auth_login, $auth_pass) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 15:00:03 +00:00
|
|
|
|
|
|
|
return $basic_info;
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 15:00:03 +00:00
|
|
|
/**
|
|
|
|
* @param string $filename
|
|
|
|
* @return bool
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_SEND_LOCAL_FILE
|
2021-11-14 15:00:03 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_send_local_file($filename) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 15:00:03 +00:00
|
|
|
|
|
|
|
return false;
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 15:00:03 +00:00
|
|
|
/**
|
|
|
|
* @param int $feed_id
|
|
|
|
* @param int $owner_uid
|
|
|
|
* @return bool
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_UNSUBSCRIBE_FEED
|
2021-11-14 15:00:03 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_unsubscribe_feed($feed_id, $owner_uid) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 15:00:03 +00:00
|
|
|
|
|
|
|
return false;
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 14:07:47 +00:00
|
|
|
/**
|
|
|
|
* @param Mailer $mailer
|
|
|
|
* @param array<string,mixed> $params
|
|
|
|
* @return int
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_SEND_MAIL
|
2021-11-14 14:07:47 +00:00
|
|
|
*/
|
|
|
|
function hook_send_mail($mailer, $params) {
|
2021-11-13 17:03:28 +00:00
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 14:07:47 +00:00
|
|
|
|
|
|
|
return -1;
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 13:49:10 +00:00
|
|
|
/** NOTE: $article_filters should be renamed $filter_actions because that's what this is
|
|
|
|
* @param int $feed_id
|
|
|
|
* @param int $owner_uid
|
|
|
|
* @param array<string,mixed> $article
|
|
|
|
* @param array<string,mixed> $matched_filters
|
|
|
|
* @param array<string,string|bool|int> $matched_rules
|
|
|
|
* @param array<string,string> $article_filters
|
|
|
|
* @return void
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_FILTER_TRIGGERED
|
2021-11-14 13:49:10 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_filter_triggered($feed_id, $owner_uid, $article, $matched_filters, $matched_rules, $article_filters) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
2021-11-14 13:49:10 +00:00
|
|
|
/**
|
|
|
|
* @param string $url
|
2021-11-14 17:19:12 +00:00
|
|
|
* @return string|false
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_GET_FULL_TEXT
|
2021-11-14 13:49:10 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_get_full_text($url) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 13:49:10 +00:00
|
|
|
|
|
|
|
return "";
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 13:49:10 +00:00
|
|
|
/**
|
|
|
|
* @param array<string,string> $enclosures
|
|
|
|
* @param string $content
|
|
|
|
* @param string $site_url
|
|
|
|
* @param array<string,mixed> $article
|
2021-11-14 15:05:31 +00:00
|
|
|
* @return string|array<int,string>
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_ARTICLE_IMAGE
|
2021-11-14 13:49:10 +00:00
|
|
|
*/
|
2021-11-14 08:11:49 +00:00
|
|
|
function hook_article_image($enclosures, $content, $site_url, $article) {
|
2021-11-13 17:03:28 +00:00
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 13:49:10 +00:00
|
|
|
|
|
|
|
return "";
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-16 13:31:40 +00:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
* @see PluginHost::HOOK_FEED_TREE
|
|
|
|
* */
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_feed_tree() {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 13:49:10 +00:00
|
|
|
|
|
|
|
return "";
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 13:49:10 +00:00
|
|
|
/**
|
|
|
|
* @param string $url
|
|
|
|
* @return bool
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_IFRAME_WHITELISTED
|
2021-11-14 13:49:10 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_iframe_whitelisted($url) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 13:49:10 +00:00
|
|
|
|
|
|
|
return false;
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 15:00:03 +00:00
|
|
|
/**
|
2021-11-14 20:03:25 +00:00
|
|
|
* @param object $enclosure
|
2021-11-14 15:00:03 +00:00
|
|
|
* @param int $feed
|
2021-11-14 20:03:25 +00:00
|
|
|
* @return object ($enclosure)
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_ENCLOSURE_IMPORTED
|
2021-11-14 15:00:03 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_enclosure_imported($enclosure, $feed) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 15:00:03 +00:00
|
|
|
|
|
|
|
return $enclosure;
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-16 13:31:40 +00:00
|
|
|
/**
|
|
|
|
* @return array<string,string>
|
|
|
|
* @see PluginHost::HOOK_HEADLINES_CUSTOM_SORT_MAP
|
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_headlines_custom_sort_map() {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 15:00:03 +00:00
|
|
|
|
|
|
|
return ["" => ""];
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 15:00:03 +00:00
|
|
|
/**
|
|
|
|
* @param string $order
|
|
|
|
* @return array<int, string|bool> -- query, skip_first_id
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_HEADLINES_CUSTOM_SORT_OVERRIDE
|
2021-11-14 15:00:03 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_headlines_custom_sort_override($order) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 15:00:03 +00:00
|
|
|
|
|
|
|
return ["", false];
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 15:00:03 +00:00
|
|
|
/**
|
|
|
|
* @param int $feed_id
|
|
|
|
* @param int $is_cat
|
|
|
|
* @return string
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM
|
2021-11-14 15:00:03 +00:00
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_headline_toolbar_select_menu_item($feed_id, $is_cat) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 15:00:03 +00:00
|
|
|
|
|
|
|
return "";
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-14 15:00:03 +00:00
|
|
|
/**
|
|
|
|
* @param string $url
|
|
|
|
* @param string $auth_login
|
|
|
|
* @param string $auth_pass
|
|
|
|
* @return bool
|
2021-11-16 13:31:40 +00:00
|
|
|
* @see PluginHost::HOOK_PRE_SUBSCRIBE
|
2021-11-14 15:00:03 +00:00
|
|
|
*/
|
2021-11-14 08:11:49 +00:00
|
|
|
function hook_pre_subscribe(&$url, $auth_login, $auth_pass) {
|
2021-11-13 17:03:28 +00:00
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
2021-11-14 15:00:03 +00:00
|
|
|
|
|
|
|
return false;
|
2021-11-13 17:03:28 +00:00
|
|
|
}
|
2019-03-05 07:26:23 +00:00
|
|
|
}
|