Habari\Plugins::provided PHP Метод

provided() публичный статический Метод

Get a list of features and the active plugins that provide that feature
public static provided ( null | string $exclude = null, boolean $include_inactive = false, boolean $use_file = false ) : array
$exclude null | string A plugin id to exclude from the results
$include_inactive boolean Default false. If true, include inactive plugins in the list.
$use_file boolean If true, return a filename as the depenedency. If false (default), return the name of the plugin.
Результат array An array with keys of the feature name, values are an array of plugin names providing that feature
    public static function provided($exclude = null, $include_inactive = false, $use_file = false)
    {
        if ($include_inactive) {
            $all_plugins = Plugins::list_all();
            $plugin_list = array();
            foreach ($all_plugins as $plugin => $plugin_file) {
                $pdata = new \stdClass();
                $pdata->info = self::load_info($plugin_file);
                $pdata->filename = $plugin_file;
                $plugin_list[self::id_from_file($plugin_file)] = $pdata;
            }
        } else {
            $plugin_list = Plugins::get_active();
        }
        $provided = array();
        foreach ($plugin_list as $plugin_id => $plugin) {
            if ($plugin->info->name == $exclude || $plugin_id == $exclude) {
                continue;
            }
            if (isset($plugin->info->provides)) {
                foreach ($plugin->info->provides->feature as $provide) {
                    if ($use_file) {
                        $provided[(string) $provide][] = isset(self::$plugin_files[get_class($plugin)]) ? self::$plugin_files[get_class($plugin)] : $plugin->filename;
                    } else {
                        $provided[(string) $provide][] = (string) $plugin->info->name;
                    }
                }
            }
        }
        return Plugins::filter('provided', $provided);
    }