├── .gitignore ├── LICENSE ├── README.md ├── README.md.tpl ├── composer.json ├── hook.php.tpl ├── plugin.sh ├── plugin.xml ├── setup.php.tpl └── tools └── HEADER /.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | node_modules/ 3 | vendor/ 4 | .gh_token 5 | composer.lock 6 | *.min.* 7 | 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Empty GLPI plugin 2 | 3 | An empty plugin, to get started! 4 | 5 | This is basically a plugin skeleton with last minimal good practice to help you starting a new plugin (or even update/check an existing one!). 6 | 7 | ## Getting started 8 | 9 | For convenience, you can place the `empty` directory in you GLPI plugins directory. 10 | 11 | You can use provided `plugin.sh` script in the main directory to get started. You'll have to pass name and version of your plugin in the call: 12 | ``` 13 | ./plugin.sh MyGreatPlugin 0.0.1 14 | ``` 15 | 16 | Please note than you really want to avoid special characters in name; as it will be used for paths, methods names, constants, and so on. 17 | 18 | This will create a directory named `mygreatplugin` at the same level than the `empty` directory that contains the plugin; 19 | all methods will be named accordingly (see result in `hook.php` and `setup.php`). Note that `My-Great-Plugin` would also create a directory named `mygreatplugin`. 20 | 21 | You can also provide a destination path (ie. if your `empty` directory is not in the GLPI's plugins directory): 22 | ``` 23 | ./plugin.sh MyGreatPlugin 0.0.1 /path/to/glpi/plugins/ 24 | ``` 25 | 26 | ### Replacements 27 | 28 | * `{NAME}` will be replaced by the name you've provide, verbatim, 29 | * `{VERSION}` will be replaced byt the version you've provided, 30 | * `{LNAME}` will be replaced byt the lowercased name, 31 | * `{UNAME}` will be replaced by the uppercased name, 32 | * `{YEAR}` will be replaced by the current year. 33 | -------------------------------------------------------------------------------- /README.md.tpl: -------------------------------------------------------------------------------- 1 | # {NAME} GLPI plugin 2 | 3 | Add your plugin description here. 4 | 5 | ## Contributing 6 | 7 | * Open a ticket for each bug/feature so it can be discussed 8 | * Follow [development guidelines](http://glpi-developer-documentation.readthedocs.io/en/latest/plugins/index.html) 9 | * Refer to [GitFlow](http://git-flow.readthedocs.io/) process for branching 10 | * Work on a new branch on your own fork 11 | * Open a PR that will be reviewed by a developer 12 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "php": ">=7.4" 4 | }, 5 | "require-dev": { 6 | "glpi-project/tools": "^0.4" 7 | }, 8 | "config": { 9 | "optimize-autoloader": true, 10 | "platform": { 11 | "php": "7.4.0" 12 | }, 13 | "sort-packages": true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /hook.php.tpl: -------------------------------------------------------------------------------- 1 | /dev/null 70 | 71 | #rename .tpl... 72 | for f in `ls *.tpl` 73 | do 74 | mv $f ${f%.*} 75 | done 76 | 77 | # move xml file 78 | mv plugin.xml $LNAME.xml 79 | 80 | #do replacements 81 | sed \ 82 | -e "s/{NAME}/$NAME/" \ 83 | -e "s/{LNAME}/$LNAME/" \ 84 | -e "s/{UNAME}/$UNAME/" \ 85 | -e "s/{VERSION}/$VERSION/" \ 86 | -e "s/{YEAR}/$YEAR/" \ 87 | -i setup.php hook.php $LNAME.xml tools/HEADER README.md 88 | 89 | popd > /dev/null 90 | -------------------------------------------------------------------------------- /plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | {NAME} 3 | {LNAME} 4 | 5 | stable 6 | https://raw.githubusercontent.com/pluginsGLPI/{LNAME}/master/{LNAME}.png 7 | 8 | 9 | 10 | {NAME} GLPI plugin. 11 | Plugin GLPI {NAME} 12 | 13 | 14 | 15 | A long description for {NAME} GLPI plugin. 16 | Un description longue pour le plugin GLPI {NAME} 17 | 18 | 19 | https://github.com/pluginsGLPI/{LNAME} 20 | https://github.com/pluginsGLPI/{LNAME}/releases 21 | https://github.com/pluginsGLPI/{LNAME}/issues 22 | https://github.com/pluginsGLPI/{LNAME}/blob/master/README.md 23 | 24 | 25 | Teclib' 26 | 27 | 28 | 29 | 30 | {VERSION} 31 | 32 | 9.4 33 | 9.3 34 | 9.2 35 | 36 | 37 | 38 | 39 | en_GB 40 | fr_FR 41 | 42 | GPL V3+ 43 | 53 | 57 | 58 | -------------------------------------------------------------------------------- /setup.php.tpl: -------------------------------------------------------------------------------- 1 | '{NAME}', 63 | 'version' => PLUGIN_{UNAME}_VERSION, 64 | 'author' => 'Teclib\'', 65 | 'license' => '', 66 | 'homepage' => '', 67 | 'requirements' => [ 68 | 'glpi' => [ 69 | 'min' => PLUGIN_{UNAME}_MIN_GLPI_VERSION, 70 | 'max' => PLUGIN_{UNAME}_MAX_GLPI_VERSION, 71 | ] 72 | ] 73 | ]; 74 | } 75 | 76 | /** 77 | * Check pre-requisites before install 78 | * OPTIONNAL, but recommanded 79 | * 80 | * @return boolean 81 | */ 82 | function plugin_{LNAME}_check_prerequisites() 83 | { 84 | return true; 85 | } 86 | 87 | /** 88 | * Check configuration process 89 | * 90 | * @param boolean $verbose Whether to display message on failure. Defaults to false 91 | * 92 | * @return boolean 93 | */ 94 | function plugin_{LNAME}_check_config($verbose = false) 95 | { 96 | if (true) { // Your configuration check 97 | return true; 98 | } 99 | 100 | if ($verbose) { 101 | echo __('Installed / not configured', '{LNAME}'); 102 | } 103 | return false; 104 | } 105 | -------------------------------------------------------------------------------- /tools/HEADER: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------- 2 | {NAME} plugin for GLPI 3 | ------------------------------------------------------------------------- 4 | 5 | MIT License 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | ------------------------------------------------------------------------- 25 | @copyright Copyright (C) {YEAR} by the {NAME} plugin team. 26 | @license MIT https://opensource.org/licenses/mit-license.php 27 | @link https://github.com/pluginsGLPI/{LNAME} 28 | ------------------------------------------------------------------------- 29 | --------------------------------------------------------------------------------