'SOC Case Management', 'version' => PLUGIN_SOC_VERSION, 'author' => 'Your Organization', 'license' => 'GPL-3.0+', 'homepage' => 'https://yourorganization.com', 'requirements' => [ 'glpi' => [ 'min' => PLUGIN_SOC_MIN_GLPI, 'max' => PLUGIN_SOC_MAX_GLPI, ], 'php' => [ 'min' => '7.4.0', ] ] ]; } /** * Check plugin prerequisites before installation * * @return boolean */ function plugin_soc_check_prerequisites() { if (version_compare(GLPI_VERSION, PLUGIN_SOC_MIN_GLPI, 'lt') || version_compare(GLPI_VERSION, PLUGIN_SOC_MAX_GLPI, 'gt')) { echo "This plugin requires GLPI >= " . PLUGIN_SOC_MIN_GLPI . " and < " . PLUGIN_SOC_MAX_GLPI; return false; } return true; } /** * Check if plugin configuration is compatible with current GLPI status * * @return boolean */ function plugin_soc_check_config() { return true; } /** * Plugin initialization * * @global array $PLUGIN_HOOKS * @return void */ function plugin_init_soc() { global $PLUGIN_HOOKS; $PLUGIN_HOOKS['csrf_compliant']['soc'] = true; $PLUGIN_HOOKS['menu_toadd']['soc'] = ['management' => 'PluginSocCase']; $PLUGIN_HOOKS['javascript']['soc'] = ['/plugins/soc/js/soc.js']; $PLUGIN_HOOKS['add_css']['soc'] = ['/plugins/soc/css/soc.css']; // Initialize translations $PLUGIN_HOOKS['init_translations']['soc'] = 'initTranslations'; if (Session::haveRight('plugin_soc_case', READ)) { $PLUGIN_HOOKS['menu_toadd']['soc'] = ['management' => 'PluginSocCase']; } // Add a tab to Changes if (Session::haveRight('change', READ)) { Plugin::registerClass('PluginSocCase', [ 'addtabtypes' => ['Change'] ]); } // Add a tab to Tickets if (Session::haveRight('ticket', READ)) { Plugin::registerClass('PluginSocCase', [ 'addtabtypes' => ['Ticket'] ]); } } /** * Initialize plugin translations * * @return void */ function initTranslations() { global $CFG_GLPI; $domain = 'soc'; $locale_dir = GLPI_ROOT . '/plugins/soc/locales/'; if (file_exists($locale_dir)) { // Load plugin translations $GLOBALS['LANG']->addTranslationFile('gettext', $locale_dir, $domain, $_SESSION['glpilanguage']); } }