+
+ /**
+ * Checks if the provided addon is enabled
+ *
+ * @param string $addon
+ * @return boolean
+ */
+ public static function isEnabled($addon)
+ {
+ return in_array($addon, self::$addons);
+ }
+
+ /**
+ * Returns a list of the enabled addon names
+ *
+ * @return array
+ */
+ public static function getEnabledList()
+ {
+ return self::$addons;
+ }
+
+ /**
+ * Saves the current enabled addon list in the system.addon config key
+ *
+ * @return boolean
+ */
+ public static function saveEnabledList()
+ {
+ return Config::set('system', 'addon', implode(',', self::$addons));
+ }
+
+ /**
+ * Returns the list of non-hidden enabled addon names
+ *
+ * @return array
+ * @throws \Exception
+ */
+ public static function getVisibleList()
+ {
+ $visible_addons = [];
+ $stmt = DBA::select('addon', ['name'], ['hidden' => false, 'installed' => true]);
+ if (DBA::isResult($stmt)) {
+ foreach (DBA::toArray($stmt) as $addon) {
+ $visible_addons[] = $addon['name'];
+ }
+ }
+
+ return $visible_addons;
+ }
+
+ /**
+ * Shim of Hook::register left for backward compatibility purpose.
+ *
+ * @see Hook::register
+ * @deprecated since version 2018.12
+ * @param string $hook the name of the hook
+ * @param string $file the name of the file that hooks into
+ * @param string $function the name of the function that the hook will call
+ * @param int $priority A priority (defaults to 0)
+ * @return mixed|bool
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+ */
+ public static function registerHook($hook, $file, $function, $priority = 0)
+ {
+ return Hook::register($hook, $file, $function, $priority);
+ }
+
+ /**
+ * Shim of Hook::unregister left for backward compatibility purpose.
+ *
+ * @see Hook::unregister
+ * @deprecated since version 2018.12
+ * @param string $hook the name of the hook
+ * @param string $file the name of the file that hooks into
+ * @param string $function the name of the function that the hook called
+ * @return boolean
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+ */
+ public static function unregisterHook($hook, $file, $function)
+ {
+ return Hook::unregister($hook, $file, $function);
+ }
+
+ /**
+ * Shim of Hook::callAll left for backward-compatibility purpose.
+ *
+ * @see Hook::callAll
+ * @deprecated since version 2018.12
+ * @param string $name of the hook to call
+ * @param string|array &$data to transmit to the callback handler
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+ */
+ public static function callHooks($name, &$data = null)
+ {
+ Hook::callAll($name, $data);
+ }