mirror of
https://github.com/pluginsGLPI/example.git
synced 2025-05-04 18:08:42 +02:00
Add version constant, update phpdoc
This commit is contained in:
parent
b270e19e91
commit
aaab0d8415
29
hook.php
29
hook.php
@ -1,29 +1,28 @@
|
||||
<?php
|
||||
/*
|
||||
* @version $Id: hook.php 219 2013-11-25 19:01:42Z webmyster $
|
||||
-------------------------------------------------------------------------
|
||||
GLPI - Gestionnaire Libre de Parc Informatique
|
||||
Copyright (C) 2003-2011 by the INDEPNET Development Team.
|
||||
Example plugin for GLPI
|
||||
Copyright (C) 2001-2017 by the Example Development Team.
|
||||
|
||||
http://indepnet.net/ http://glpi-project.org
|
||||
https://github.com/pluginsGLPI/example
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
LICENSE
|
||||
|
||||
This file is part of GLPI.
|
||||
This file is part of Example.
|
||||
|
||||
GLPI is free software; you can redistribute it and/or modify
|
||||
Example is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GLPI is distributed in the hope that it will be useful,
|
||||
Example is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
along with Example. If not, see <http://www.gnu.org/licenses/>.
|
||||
--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@ -442,7 +441,11 @@ function plugin_example_addParamFordynamicReport($itemtype) {
|
||||
}
|
||||
|
||||
|
||||
// Install process for plugin : need to return true if succeeded
|
||||
/**
|
||||
* Plugin install process
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function plugin_example_install() {
|
||||
global $DB;
|
||||
|
||||
@ -533,7 +536,11 @@ function plugin_example_install() {
|
||||
}
|
||||
|
||||
|
||||
// Uninstall process for plugin : need to return true if succeeded
|
||||
/**
|
||||
* Plugin uninstall process
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function plugin_example_uninstall() {
|
||||
global $DB;
|
||||
|
||||
@ -664,5 +671,3 @@ function plugin_example_infocom_hook($params) {
|
||||
echo __("Plugin example displays on central page", "example");
|
||||
echo "</th></tr>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
56
setup.php
56
setup.php
@ -1,29 +1,28 @@
|
||||
<?php
|
||||
/*
|
||||
* @version $Id: HEADER 15930 2011-10-25 10:47:55Z jmd $
|
||||
-------------------------------------------------------------------------
|
||||
GLPI - Gestionnaire Libre de Parc Informatique
|
||||
Copyright (C) 2003-2011 by the INDEPNET Development Team.
|
||||
Example plugin for GLPI
|
||||
Copyright (C) {YEAR} by the {NAME} Development Team.
|
||||
|
||||
http://indepnet.net/ http://glpi-project.org
|
||||
https://github.com/pluginsGLPI/example
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
LICENSE
|
||||
|
||||
This file is part of GLPI.
|
||||
This file is part of Example.
|
||||
|
||||
GLPI is free software; you can redistribute it and/or modify
|
||||
Example is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GLPI is distributed in the hope that it will be useful,
|
||||
Example is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
along with Example. If not, see <http://www.gnu.org/licenses/>.
|
||||
--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@ -32,7 +31,14 @@
|
||||
// Purpose of file:
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// Init the hooks of the plugins -Needed
|
||||
define ('PLUGIN_EXAMPLE_VERSION', '7.1');
|
||||
|
||||
/**
|
||||
* Init hooks of the plugin.
|
||||
* REQUIRED
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function plugin_init_example() {
|
||||
global $PLUGIN_HOOKS,$CFG_GLPI;
|
||||
|
||||
@ -205,11 +211,16 @@ function plugin_init_example() {
|
||||
}
|
||||
|
||||
|
||||
// Get the name and the version of the plugin - Needed
|
||||
/**
|
||||
* Get the name and the version of the plugin
|
||||
* REQUIRED
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function plugin_version_example() {
|
||||
|
||||
return array('name' => 'Plugin Example',
|
||||
'version' => '7.1',
|
||||
'version' => PLUGIN_EXAMPLE_VERSION,
|
||||
'author' => 'GLPI developer team',
|
||||
'license' => 'GPLv2+',
|
||||
'homepage' => 'https://github.com/pluginsGLPI/example',
|
||||
@ -217,21 +228,34 @@ function plugin_version_example() {
|
||||
}
|
||||
|
||||
|
||||
// Optional : check prerequisites before install : may print errors or add to message after redirect
|
||||
/**
|
||||
* Check pre-requisites before install
|
||||
* OPTIONNAL, but recommanded
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function plugin_example_check_prerequisites() {
|
||||
|
||||
// Strict version check (could be less strict, or could allow various version)
|
||||
if (version_compare(GLPI_VERSION,'0.85','lt') /*|| version_compare(GLPI_VERSION,'0.84','gt')*/) {
|
||||
if (method_exists('Plugin', 'messageIncompatible')) {
|
||||
echo Plugin::messageIncompatible('core', '0.85');
|
||||
} else {
|
||||
echo "This plugin requires GLPI >= 0.85";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Check configuration process for plugin : need to return true if succeeded
|
||||
// Can display a message only if failure and $verbose is true
|
||||
function plugin_example_check_config($verbose=false) {
|
||||
/**
|
||||
* Check configuration process
|
||||
*
|
||||
* @param boolean $verbose Whether to display message on failure. Defaults to false
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function plugin_example_check_config($verbose = false) {
|
||||
if (true) { // Your configuration check
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user