From a18c35046daee15e7ac5f85db290d54541a03e3c Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 11 Nov 2025 08:17:12 +0100 Subject: Housekeeping lib_rss.php (#8193) * Housekeeping lib_rss.php `lib_rss.php` had become much too large, especially after https://github.com/FreshRSS/FreshRSS/pull/7924 Moved most functions to other places. Mostly no change of code otherwise (see comments). * Extension: composer run-script phpstan-third-party --- app/Controllers/configureController.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'app/Controllers/configureController.php') diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 17c6c20bd..451e98a8b 100644 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -236,6 +236,30 @@ class FreshRSS_configure_Controller extends FreshRSS_ActionController { FreshRSS_View::prependTitle(_t('conf.sharing.title') . ' ยท '); } + private const SHORTCUT_KEYS = [ + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12', + 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'Backspace', 'Delete', + 'End', 'Enter', 'Escape', 'Home', 'Insert', 'PageDown', 'PageUp', 'Space', 'Tab', + ]; + + /** + * @param array $shortcuts + * @return list + */ + public static function getNonStandardShortcuts(array $shortcuts): array { + $standard = strtolower(implode(' ', self::SHORTCUT_KEYS)); + + $nonStandard = array_filter($shortcuts, static function (string $shortcut) use ($standard) { + $shortcut = trim($shortcut); + return $shortcut !== '' && stripos($standard, $shortcut) === false; + }); + + return array_values($nonStandard); + } + /** * This action handles the shortcut configuration page. * @@ -249,7 +273,7 @@ class FreshRSS_configure_Controller extends FreshRSS_ActionController { * tab and up. */ public function shortcutAction(): void { - $this->view->list_keys = SHORTCUT_KEYS; + $this->view->list_keys = self::SHORTCUT_KEYS; if (Minz_Request::isPost()) { $shortcuts = Minz_Request::paramArray('shortcuts', plaintext: true); -- cgit v1.2.3