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-13 17:07:13 +00:00
|
|
|
/**
|
|
|
|
* @param array<string,mixed> $line
|
|
|
|
* @return string
|
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_article_button($line) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
2021-11-13 17:07:13 +00:00
|
|
|
/**
|
|
|
|
* @param array<string,mixed> $article
|
|
|
|
* @return array<string,mixed>
|
|
|
|
*/
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_article_filter($article) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
2021-11-13 17:07:13 +00:00
|
|
|
/**
|
|
|
|
* @param string $tab
|
|
|
|
* @return void
|
|
|
|
*/
|
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-13 17:03:28 +00:00
|
|
|
function hook_prefs_tab_section($section) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
2021-11-13 17:07:13 +00:00
|
|
|
/** @return void */
|
2021-11-13 17:03:28 +00:00
|
|
|
function hook_prefs_tabs() {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_feed_parsed($parser, $feed_id) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_update_task($cli_options) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_auth_user($login, $password, $service) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_hotkey_map($hotkeys) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_render_article($article) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_render_article_cdm($article) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_feed_fetched($feed_data, $fetch_url, $owner_uid, $feed) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes, $article_id) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_render_article_api($params) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_toolbar_button() {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_action_item() {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_headline_toolbar_button($feed_id, $is_cat) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_hotkey_info($hotkeys) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_article_left_button($row) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_prefs_edit_feed($feed_id) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_prefs_save_feed($feed_id) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_query_headlines($row) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_house_keeping() {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_search($query) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_format_enclosures($rv, $result, $id, $always_display_enclosures, $article_content, $hide_images) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_subscribe_feed($contents, $url, $auth_login, $auth_pass) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_headlines_before($feed, $is_cat, $qfh_ret) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_render_enclosure($entry, $id, $rv) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_article_filter_action($article, $action) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_article_export_feed($line, $feed, $is_cat, $owner_uid) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_main_toolbar_button() {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_enclosure_entry($entry, $id, $rv) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_format_article($html, $row) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_send_local_file($filename) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_unsubscribe_feed($feed_id, $owner_uid) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_send_mail(Mailer $mailer, $params) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_filter_triggered($feed_id, $owner_uid, $article, $matched_filters, $matched_rules, $article_filters) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_get_full_text($url) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_article_image($enclosures, $content, $site_url) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_feed_tree() {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_iframe_whitelisted($url) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_enclosure_imported($enclosure, $feed) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_headlines_custom_sort_map() {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_headlines_custom_sort_override($order) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_headline_toolbar_select_menu_item($feed_id, $is_cat) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_pre_subscribe($url, $auth_login, $auth_pass) {
|
|
|
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
|
|
|
}
|
2019-03-05 07:26:23 +00:00
|
|
|
}
|