normalize some mismatching hook function definitions to match base Plugin class
This commit is contained in:
parent
81a10f69bc
commit
0a2dcacbcf
|
@ -8,8 +8,8 @@ abstract class Auth_Base extends Plugin implements IAuthModule {
|
||||||
$this->pdo = Db::pdo();
|
$this->pdo = Db::pdo();
|
||||||
}
|
}
|
||||||
|
|
||||||
function hook_auth_user(...$args) {
|
function hook_auth_user($login, $password, $service = '') {
|
||||||
return $this->authenticate(...$args);
|
return $this->authenticate($login, $password, $service);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto-creates specified user if allowed by system configuration
|
// Auto-creates specified user if allowed by system configuration
|
||||||
|
|
|
@ -3,14 +3,16 @@ interface IAuthModule {
|
||||||
/**
|
/**
|
||||||
* @param string $login
|
* @param string $login
|
||||||
* @param string $password
|
* @param string $password
|
||||||
* optional third string $service
|
* @param string $service
|
||||||
* @return int|false user_id
|
* @return int|false user_id
|
||||||
*/
|
*/
|
||||||
function authenticate($login, $password); // + optional third parameter: $service
|
function authenticate($login, $password, $service = '');
|
||||||
|
|
||||||
/** 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 mixed $args = ($login, $password, $service)
|
* @param string $login
|
||||||
|
* @param string $password
|
||||||
|
* @param string $service
|
||||||
* @return int|false user_id
|
* @return int|false user_id
|
||||||
*/
|
*/
|
||||||
function hook_auth_user(...$args);
|
function hook_auth_user($login, $password, $service = '');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
/* TODO: I haven't yet decided if we're keeping hook prototypes which did grow (with additional params) over time and breaking all plugins
|
||||||
|
with legacy function definitions, or commenting base definitions out for the time being -fox
|
||||||
|
|
||||||
|
(It's a shame that PHP doesn't support argument overloading)
|
||||||
|
|
||||||
|
Stuff like hook_enclosure_entry() etc.
|
||||||
|
*/
|
||||||
abstract class Plugin {
|
abstract class Plugin {
|
||||||
const API_VERSION_COMPAT = 1;
|
const API_VERSION_COMPAT = 1;
|
||||||
|
|
||||||
|
@ -142,10 +149,12 @@ abstract class Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 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 mixed $args = ($login, $password, $service)
|
* @param string $login
|
||||||
|
* @param string $password
|
||||||
|
* @param string $service
|
||||||
* @return int|false user_id
|
* @return int|false user_id
|
||||||
*/
|
*/
|
||||||
function hook_auth_user(...$args) {
|
function hook_auth_user($login, $password, $service = '') {
|
||||||
user_error("Dummy method invoked.", E_USER_ERROR);
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -153,10 +162,10 @@ abstract class Plugin {
|
||||||
/** IAuthModule only
|
/** IAuthModule only
|
||||||
* @param string $login
|
* @param string $login
|
||||||
* @param string $password
|
* @param string $password
|
||||||
* optional third string $service
|
* @param string $service
|
||||||
* @return int|false user_id
|
* @return int|false user_id
|
||||||
*/
|
*/
|
||||||
function authenticate($login, $password) {
|
function authenticate($login, $password, $service = '') {
|
||||||
user_error("Dummy method invoked.", E_USER_ERROR);
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -257,6 +266,12 @@ abstract class Plugin {
|
||||||
user_error("Dummy method invoked.", E_USER_ERROR);
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string,string> $entry
|
||||||
|
* @param int $id
|
||||||
|
* @param array{'formatted': string, 'entries': array<int, array<string, mixed>>} $rv
|
||||||
|
* @return array<string,string>
|
||||||
|
*/
|
||||||
function hook_enclosure_entry($entry, $id, $rv) {
|
function hook_enclosure_entry($entry, $id, $rv) {
|
||||||
user_error("Dummy method invoked.", E_USER_ERROR);
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -289,7 +304,7 @@ abstract class Plugin {
|
||||||
user_error("Dummy method invoked.", E_USER_ERROR);
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hook_article_image($enclosures, $content, $site_url) {
|
function hook_article_image($enclosures, $content, $site_url, $article) {
|
||||||
user_error("Dummy method invoked.", E_USER_ERROR);
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +332,7 @@ abstract class Plugin {
|
||||||
user_error("Dummy method invoked.", E_USER_ERROR);
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hook_pre_subscribe($url, $auth_login, $auth_pass) {
|
function hook_pre_subscribe(&$url, $auth_login, $auth_pass) {
|
||||||
user_error("Dummy method invoked.", E_USER_ERROR);
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Af_Youtube_Embed extends Plugin {
|
||||||
"youtu.be"]);
|
"youtu.be"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hook_render_enclosure($entry, $hide_images) {
|
function hook_render_enclosure($entry, $id, $rv) {
|
||||||
|
|
||||||
$url = $entry["content_url"];
|
$url = $entry["content_url"];
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Auth_Remote extends Auth_Base {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function authenticate($login, $password) {
|
function authenticate($login, $password, $service = '') {
|
||||||
$try_login = "";
|
$try_login = "";
|
||||||
|
|
||||||
foreach (["REMOTE_USER", "HTTP_REMOTE_USER", "REDIRECT_REMOTE_USER", "PHP_AUTH_USER"] as $hdr) {
|
foreach (["REMOTE_USER", "HTTP_REMOTE_USER", "REDIRECT_REMOTE_USER", "PHP_AUTH_USER"] as $hdr) {
|
||||||
|
|
|
@ -97,7 +97,7 @@ class Cache_Starred_Images extends Plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function hook_enclosure_entry($enc, $article_id) {
|
function hook_enclosure_entry($enc, $article_id, $rv) {
|
||||||
$local_filename = $article_id . "-" . sha1($enc["content_url"]);
|
$local_filename = $article_id . "-" . sha1($enc["content_url"]);
|
||||||
|
|
||||||
if ($this->cache->exists($local_filename)) {
|
if ($this->cache->exists($local_filename)) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ class No_Iframes extends Plugin {
|
||||||
$host->add_hook($host::HOOK_SANITIZE, $this);
|
$host->add_hook($host::HOOK_SANITIZE, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes) {
|
function hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes, $article_id) {
|
||||||
|
|
||||||
$xpath = new DOMXpath($doc);
|
$xpath = new DOMXpath($doc);
|
||||||
$entries = $xpath->query('//iframe');
|
$entries = $xpath->query('//iframe');
|
||||||
|
|
Loading…
Reference in New Issue