mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 01:46:00 +00:00
* fox.form.Select: add several properties allowing it to better
imitate other controls like DropDownButton, etc. * rework several main toolbar items to use fox.form.Select instead of other controls * replace HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM with HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM2 because of markup change (option instead of menuitem) * PluginHost: add some explicit typecasts to make intellephense shut up
This commit is contained in:
@@ -189,9 +189,14 @@ class PluginHost {
|
||||
/** @see Plugin::hook_headlines_custom_sort_override() */
|
||||
const HOOK_HEADLINES_CUSTOM_SORT_OVERRIDE = "hook_headlines_custom_sort_override";
|
||||
|
||||
/** @see Plugin::hook_headline_toolbar_select_menu_item() */
|
||||
/** @see Plugin::hook_headline_toolbar_select_menu_item()
|
||||
* @deprecated removed, see PluginHost::HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM2
|
||||
*/
|
||||
const HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM = "hook_headline_toolbar_select_menu_item";
|
||||
|
||||
/** @see Plugin::hook_headline_toolbar_select_menu_item() */
|
||||
const HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM2 = "hook_headline_toolbar_select_menu_item2";
|
||||
|
||||
/** @see Plugin::hook_pre_subscribe() */
|
||||
const HOOK_PRE_SUBSCRIBE = "hook_pre_subscribe";
|
||||
|
||||
@@ -270,9 +275,10 @@ class PluginHost {
|
||||
* @param mixed $args
|
||||
*/
|
||||
function run_hooks(string $hook, ...$args): void {
|
||||
$method = strtolower($hook);
|
||||
|
||||
foreach ($this->get_hooks($hook) as $plugin) {
|
||||
$method = strtolower((string)$hook);
|
||||
|
||||
foreach ($this->get_hooks((string)$hook) as $plugin) {
|
||||
//Debug::log("invoking: " . get_class($plugin) . "->$hook()", Debug::$LOG_VERBOSE);
|
||||
|
||||
try {
|
||||
@@ -291,9 +297,9 @@ class PluginHost {
|
||||
* @param mixed $check
|
||||
*/
|
||||
function run_hooks_until(string $hook, $check, ...$args): bool {
|
||||
$method = strtolower($hook);
|
||||
$method = strtolower((string)$hook);
|
||||
|
||||
foreach ($this->get_hooks($hook) as $plugin) {
|
||||
foreach ($this->get_hooks((string)$hook) as $plugin) {
|
||||
try {
|
||||
$result = $plugin->$method(...$args);
|
||||
|
||||
@@ -315,9 +321,9 @@ class PluginHost {
|
||||
* @param mixed $args
|
||||
*/
|
||||
function run_hooks_callback(string $hook, Closure $callback, ...$args): void {
|
||||
$method = strtolower($hook);
|
||||
$method = strtolower((string)$hook);
|
||||
|
||||
foreach ($this->get_hooks($hook) as $plugin) {
|
||||
foreach ($this->get_hooks((string)$hook) as $plugin) {
|
||||
//Debug::log("invoking: " . get_class($plugin) . "->$hook()", Debug::$LOG_VERBOSE);
|
||||
|
||||
try {
|
||||
@@ -336,9 +342,9 @@ class PluginHost {
|
||||
* @param mixed $args
|
||||
*/
|
||||
function chain_hooks_callback(string $hook, Closure $callback, &...$args): void {
|
||||
$method = strtolower($hook);
|
||||
$method = strtolower((string)$hook);
|
||||
|
||||
foreach ($this->get_hooks($hook) as $plugin) {
|
||||
foreach ($this->get_hooks((string)$hook) as $plugin) {
|
||||
//Debug::log("invoking: " . get_class($plugin) . "->$hook()", Debug::$LOG_VERBOSE);
|
||||
|
||||
try {
|
||||
@@ -358,7 +364,7 @@ class PluginHost {
|
||||
function add_hook(string $type, Plugin $sender, int $priority = 50): void {
|
||||
$priority = (int) $priority;
|
||||
|
||||
if (!method_exists($sender, strtolower($type))) {
|
||||
if (!method_exists($sender, strtolower((string)$type))) {
|
||||
user_error(
|
||||
sprintf("Plugin %s tried to register a hook without implementation: %s",
|
||||
get_class($sender), $type),
|
||||
@@ -422,7 +428,7 @@ class PluginHost {
|
||||
|
||||
asort($plugins);
|
||||
|
||||
$this->load(join(",", $plugins), $kind, $owner_uid, $skip_init);
|
||||
$this->load(join(",", $plugins), (int)$kind, $owner_uid, $skip_init);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user