Return a function that can be used as a callback to filter arrays of {@link Addon} objects.
public static makeFilterCallback ( array $where ) : Closure | ||
$where | array | A where array that filters the info array. |
Результат | Closure | Returns a new closure. |
/** * Get a list of all of the enabled plugins. * * @return array */ public function enabledPlugins() { $addons = $this->addonManager->getEnabled(); $plugins = array_filter($addons, Addon::makeFilterCallback(['oldType' => 'plugin'])); $result = []; /* @var Addon $plugin */ foreach ($plugins as $key => $plugin) { $result[$plugin->getRawKey()] = $this->calcOldInfoArray($plugin); } return $result; }
/** * Get the enabled application folders. * * This is a temporary refactor of the the {@link enabledApplicationFolders()} method and will be removed once * support for application prefixes has been removed from the site. Please leave this method as private and don't * call it unless you know what you're doing. * * @return array An array of application folders. */ private function getEnabledApplicationFolders() { if (!isset($this->enabledApplicationFolders)) { $addons = $this->addonManager->getEnabled(); $applications = array_filter($addons, Addon::makeFilterCallback(['oldType' => 'application'])); $result = ['dashboard']; /* @var Addon $application */ foreach ($applications as $application) { $result[] = $application->getKey(); } $this->enabledApplicationFolders = array_unique($result); } return $this->enabledApplicationFolders; }
/** * Get an list of enabled application folders. * * @return array Returns an array of all of the enabled application folders. * @deprecated */ public function enabledApplicationFolders() { deprecated('Gdn_ApplicationManager->enabledApplicationFolders()'); $addons = $this->addonManager->getEnabled(); $applications = array_filter($addons, Addon::makeFilterCallback(['oldType' => 'application'])); $result = ['dashboard']; /* @var Addon $application */ foreach ($applications as $application) { $result[] = $application->getKey(); } return array_unique($result); }