diff --git a/setup.php b/setup.php index c0adf7d..ee849fe 100644 --- a/setup.php +++ b/setup.php @@ -1,4 +1,118 @@ authors) && isset($xml->authors->author)) { + foreach ($xml->authors->author as $author) { + $authors[] = (string)$author->name . (isset($author->email) ? ' <' . (string)$author->email . '>' : ''); + } + } + + $versions = []; + if (isset($xml->versions) && isset($xml->versions->version)) { + foreach ($xml->versions->version as $version) { + $versions[] = [ + 'num' => (string)$version->num, + 'minGlpiVersion' => (string)$version->compatibility, // GLPI expects minGlpiVersion + ]; + } + } + + $langs = []; + if (isset($xml->langs) && isset($xml->langs->lang)) { + foreach ($xml->langs->lang as $lang) { + $langs[] = (string)$lang; + } + } + + $tags = []; + if (isset($xml->tags)) { + foreach ($xml->tags->children() as $lang_code => $tag_list) { + $current_tags = []; + foreach ($tag_list->tag as $tag) { + $current_tags[] = (string)$tag; + } + $tags[$lang_code] = $current_tags; + } + } + + + return [ + 'name' => (string)$xml->name, + 'key' => (string)$xml->key, + 'state' => (string)$xml->state, + 'logo' => (string)$xml->logo, + 'shortdesc' => (string)$xml->description_short, // GLPI expects shortdesc + 'longdesc' => (string)$xml->description_long, // GLPI expects longdesc + 'homepage' => (string)$xml->homepage, + 'download' => (string)$xml->download, + 'issues_tracker' => (string)$xml->issues, // GLPI expects issues_tracker + 'readme' => (string)$xml->readme, + 'authors' => $authors, + 'versions' => $versions, + 'langs' => $langs, + 'license' => (string)$xml->license, + 'tags' => $tags, + 'minGlpiVersion' => !empty($versions) ? $versions[count($versions)-1]['minGlpiVersion'] : '' // Default to last version's compatibility + ]; +} + +/** + * Initialize plugin options + * + * @return array + */ +function plugin_init_options() { + return [ + 'name' => __('SOC Case Management', 'soc'), + 'key' => 'soc', + 'tooltip' => __('SOC Case Management integration plugin for security teams.', 'soc'), + ]; +} + +/** + * Check plugin prerequisites. + * + * @return boolean + */ +function plugin_check_prerequisites() { + // For now, always return true + return true; +} + +/** + * Check plugin configuration. + * + * @param boolean $verbose Enable verbose mode (default false) + * + * @return boolean + */ +function plugin_check_config($verbose = false) { + // For now, always return true + return true; +} + +/** + * Display plugin configuration page. + * + * @return void + */ +function plugin_display_config() { + // Currently does nothing +} + /** * Init the hooks of the plugin *