diff options
| author | 2018-06-16 09:59:46 +0200 | |
|---|---|---|
| committer | 2018-06-16 09:59:46 +0200 | |
| commit | 3306a1679c2570c30d4b662c887b4a71ce147398 (patch) | |
| tree | 35fb1616c1166723676c789d6127a98db3260148 /lib/Minz/ExtensionManager.php | |
| parent | c0122003fe3031926546012b86a38b5187082613 (diff) | |
| parent | 8fcacc8cf41c14dd7d9712329d75ff4f041f3caf (diff) | |
Merge pull request #1921 from FreshRSS/dev1.11.1
FreshRSS 1.11.1
Diffstat (limited to 'lib/Minz/ExtensionManager.php')
| -rw-r--r-- | lib/Minz/ExtensionManager.php | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/lib/Minz/ExtensionManager.php b/lib/Minz/ExtensionManager.php index 10c49a8b6..b086c4001 100644 --- a/lib/Minz/ExtensionManager.php +++ b/lib/Minz/ExtensionManager.php @@ -35,6 +35,10 @@ class Minz_ExtensionManager { 'list' => array(), 'signature' => 'OneToOne', ), + 'simplepie_before_init' => array( // function($simplePie, $feed) -> none + 'list' => array(), + 'signature' => 'PassArguments', + ), ); private static $ext_to_hooks = array(); @@ -160,7 +164,8 @@ class Minz_ExtensionManager { self::$ext_list[$name] = $ext; if ($ext->getType() === 'system' && - in_array($name, self::$ext_auto_enabled)) { + (!empty(self::$ext_auto_enabled[$name]) || + in_array($name, self::$ext_auto_enabled, true))) { //Legacy format < FreshRSS 1.11.1 self::enable($ext->getName()); } @@ -189,8 +194,15 @@ class Minz_ExtensionManager { * @param string[] $ext_list the names of extensions we want to load. */ public static function enableByList($ext_list) { - foreach ($ext_list as $ext_name) { - self::enable($ext_name); + if (!is_array($ext_list)) { + return; + } + foreach ($ext_list as $ext_name => $ext_status) { + if (is_int($ext_name)) { //Legacy format int=>name + self::enable($ext_status); + } elseif ($ext_status) { //New format name=>Boolean + self::enable($ext_name); + } } } @@ -255,10 +267,15 @@ class Minz_ExtensionManager { } $signature = self::$hook_list[$hook_name]['signature']; - $signature = 'self::call' . $signature; $args = func_get_args(); - - return call_user_func_array($signature, $args); + if ($signature === 'PassArguments') { + array_shift($args); + foreach (self::$hook_list[$hook_name]['list'] as $function) { + call_user_func_array($function, $args); + } + } else { + return call_user_func_array('self::call' . $signature, $args); + } } /** |
