Skip to content

Commit c69dee0

Browse files
committed
Fix coding standards violations
1 parent 8e4b504 commit c69dee0

13 files changed

+87
-87
lines changed

front/type.form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
$_GET["id"] = '';
3232
}
3333
$type = new PluginGenericobjectType();
34-
$extraparams = array ();
34+
$extraparams = [];
3535
if (isset ($_POST["select"]) && $_POST["select"] == "all") {
3636
$extraparams["selected"] = "checked";
3737
}

front/type.php

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
1-
<?php
2-
/*
3-
This file is part of the genericobject plugin.
4-
5-
Genericobject plugin is free software; you can redistribute it and/or modify
6-
it under the terms of the GNU General Public License as published by
7-
the Free Software Foundation; either version 2 of the License, or
8-
(at your option) any later version.
9-
10-
Genericobject plugin is distributed in the hope that it will be useful,
11-
but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
GNU General Public License for more details.
14-
15-
You should have received a copy of the GNU General Public License
16-
along with Genericobject. If not, see <http://www.gnu.org/licenses/>.
17-
--------------------------------------------------------------------------
18-
@package genericobject
19-
@author the genericobject plugin team
20-
@copyright Copyright (c) 2010-2011 Order plugin team
21-
@license GPLv2+
22-
http://www.gnu.org/licenses/gpl.txt
23-
@link https://forge.indepnet.net/projects/genericobject
24-
@link http://www.glpi-project.org/
25-
@since 2009
26-
---------------------------------------------------------------------- */
27-
28-
include ("../../../inc/includes.php");
29-
30-
if (isset($_GET['itemtype'])
31-
&& !isset($_GET['search'])
32-
&& !isset($_GET['sort'])) {
33-
$type = new PluginGenericobjectType();
34-
$type->getFromDBByType($_GET['itemtype']);
35-
Html::redirect(Toolbox::getItemTypeFormURL('PluginGenericobjectType').'?id='.$type->getID());
36-
37-
} else if (Session::haveRightsOr('plugin_genericobject_types', [READ, CREATE, UPDATE, PURGE])) {
38-
Html::header(__("Type of objects", "genericobject"), $_SERVER['PHP_SELF'], "config",
39-
"PluginGenericobjectType");
40-
Search::Show('PluginGenericobjectType');
41-
Html::footer();
42-
43-
} else {
44-
Html::redirect($CFG_GLPI['root_doc']."/front/central.php");
45-
}
1+
<?php
2+
/*
3+
This file is part of the genericobject plugin.
4+
5+
Genericobject plugin is free software; you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation; either version 2 of the License, or
8+
(at your option) any later version.
9+
10+
Genericobject plugin is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with Genericobject. If not, see <http://www.gnu.org/licenses/>.
17+
--------------------------------------------------------------------------
18+
@package genericobject
19+
@author the genericobject plugin team
20+
@copyright Copyright (c) 2010-2011 Order plugin team
21+
@license GPLv2+
22+
http://www.gnu.org/licenses/gpl.txt
23+
@link https://forge.indepnet.net/projects/genericobject
24+
@link http://www.glpi-project.org/
25+
@since 2009
26+
---------------------------------------------------------------------- */
27+
28+
include ("../../../inc/includes.php");
29+
30+
if (isset($_GET['itemtype'])
31+
&& !isset($_GET['search'])
32+
&& !isset($_GET['sort'])) {
33+
$type = new PluginGenericobjectType();
34+
$type->getFromDBByType($_GET['itemtype']);
35+
Html::redirect(Toolbox::getItemTypeFormURL('PluginGenericobjectType').'?id='.$type->getID());
36+
37+
} else if (Session::haveRightsOr('plugin_genericobject_types', [READ, CREATE, UPDATE, PURGE])) {
38+
Html::header(__("Type of objects", "genericobject"), $_SERVER['PHP_SELF'], "config",
39+
"PluginGenericobjectType");
40+
Search::Show('PluginGenericobjectType');
41+
Html::footer();
42+
43+
} else {
44+
Html::redirect($CFG_GLPI['root_doc']."/front/central.php");
45+
}

inc/commondropdown.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
class PluginGenericobjectCommonDropdown extends CommonDropdown {
2929

3030
//Get itemtype name
31-
static function getTypeName($nb=0) {
31+
static function getTypeName($nb = 0) {
3232
$class=get_called_class();
3333
return dropdown_getTypeName($class, $nb);
3434
}
3535

36-
static function getFormURL($full=true) {
36+
static function getFormURL($full = true) {
3737
return Toolbox::getItemTypeFormURL( get_parent_class(get_called_class()), $full) .
3838
"?itemtype=".get_called_class();
3939
}
40-
static function getSearchURL($full=true) {
40+
static function getSearchURL($full = true) {
4141
return Toolbox::getItemTypeSearchURL( get_parent_class(get_called_class()), $full) .
4242
"?itemtype=".get_called_class();
4343

inc/commontreedropdown.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@
2828
class PluginGenericobjectCommonTreeDropdown extends CommonTreeDropdown {
2929

3030
//Get itemtype name
31-
static function getTypeName($nb=0) {
31+
static function getTypeName($nb = 0) {
3232
$class=get_called_class();
3333
return dropdown_getTypeName($class, $nb);
3434
}
3535

36-
static function getFormURL($full=true) {
36+
static function getFormURL($full = true) {
3737
_log("PluginGenericobjectCommonTreeDropdown::getFormURL", get_parent_class(get_called_class()));
3838
return Toolbox::getItemTypeFormURL( get_parent_class(get_called_class()), $full) .
3939
"?itemtype=".get_called_class();
4040
}
41-
static function getSearchURL($full=true) {
41+
static function getSearchURL($full = true) {
4242
_log("PluginGenericobjectCommonTreeDropdown::getSearchURL", get_parent_class(get_called_class()));
4343
return Toolbox::getItemTypeSearchURL( get_parent_class(get_called_class()), $full) .
4444
"?itemtype=".get_called_class();

inc/field.class.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static function getFieldName($field, $itemtype, $options, $remove_prefix = false
218218
*
219219
* @return the dropdown random ID
220220
*/
221-
static function dropdownFields($name,$itemtype, $used = []) {
221+
static function dropdownFields($name, $itemtype, $used = []) {
222222
global $GO_FIELDS;
223223

224224
$dropdown_types = [];
@@ -279,7 +279,7 @@ static function dropdownFields($name,$itemtype, $used = []) {
279279
* @param $itemtype the itemtype
280280
* @return an array which contains the full field definition
281281
*/
282-
static function getFieldOptions($field, $itemtype="") {
282+
static function getFieldOptions($field, $itemtype = "") {
283283
global $GO_FIELDS;
284284

285285
$cleaned_field = preg_replace("/^plugin_genericobject_/", '', $field);
@@ -346,7 +346,7 @@ public static function displayFieldDefinition($target, $itemtype, $field, $index
346346
* @param field the field to delete
347347
* @return nothing
348348
*/
349-
public static function addNewField($table, $field, $after=false) {
349+
public static function addNewField($table, $field, $after = false) {
350350
global $DB;
351351

352352
_log("add", $field, "from", $table);
@@ -501,7 +501,7 @@ static function changeFieldOrder($params = []) {
501501
}
502502
}
503503

504-
public static function checkNecessaryFieldsDelete($itemtype,$field) {
504+
public static function checkNecessaryFieldsDelete($itemtype, $field) {
505505
$type = new PluginGenericobjectType();
506506
$type->getFromDBByType($itemtype);
507507

inc/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* - PluginGenericobjectCommonDropdown
77
* - PluginGenericobjectCommonTreeDropdown
88
*/
9-
function dropdown_getTypeName($class,$nb=0) {
9+
function dropdown_getTypeName($class, $nb = 0) {
1010
global $GO_FIELDS;
1111
$fk = getForeignKeyFieldForTable(getTableForItemType($class));
1212
$instance = new $class();

inc/object.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class PluginGenericobjectObject extends CommonDBTM {
3333
private $cpt = 0;
3434

3535
//Get itemtype name
36-
static function getTypeName($nb=0) {
36+
static function getTypeName($nb = 0) {
3737
global $LANG;
3838
$class = get_called_class();
3939
//Datainjection : Don't understand why I need this trick : need to be investigated !

inc/object_item.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class PluginGenericobjectObject_Item extends CommonDBChild {
3737
static public $items_id_2 = 'items_id';
3838

3939
//Get itemtype name
40-
static function getTypeName($nb=0) {
40+
static function getTypeName($nb = 0) {
4141
global $LANG;
4242
$class = get_called_class();
4343
//Datainjection : Don't understand why I need this trick : need to be investigated !
@@ -102,7 +102,7 @@ static function getItemType1() {
102102
return $classname::$itemtype_1;
103103
}
104104

105-
function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
105+
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
106106
if (!$withtemplate) {
107107
$itemtypes = self::getLinkedItemTypes();
108108
if (in_array(get_class($item), $itemtypes) || get_class($item) == self::getItemType1()) {
@@ -112,7 +112,7 @@ function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
112112
return '';
113113
}
114114

115-
static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {
115+
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
116116
$itemtypes = self::getLinkedItemTypes();
117117
if (get_class($item) == self::getItemType1()) {
118118
self::showItemsForSource($item);

inc/profile.class.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function cleanProfiles($id) {
3232
$this->deleteByCriteria(['id' => $id]);
3333
}
3434

35-
function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
35+
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
3636

3737
switch ($item->getType()) {
3838
case 'Profile':
@@ -44,7 +44,7 @@ function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
4444
}
4545
}
4646

47-
static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {
47+
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
4848
switch ($item->getType()) {
4949
case 'Profile':
5050
$profile = new self();
@@ -55,7 +55,7 @@ static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtempl
5555
self::showForItemtype($item);
5656
break;
5757
}
58-
return TRUE;
58+
return true;
5959
}
6060

6161
static function showForItemtype($type) {
@@ -177,7 +177,7 @@ static function getProfileforItemtype($profiles_id, $itemtype) {
177177

178178
function getProfilesFromDB($id, $config = true) {
179179
global $DB;
180-
$prof_datas = array ();
180+
$prof_datas = [];
181181
foreach (getAllDatasFromTable(getTableForItemType(__CLASS__),
182182
"`profiles_id`='" . $id . "'") as $prof) {
183183
if ($prof['right'] != "" || $config) {
@@ -265,7 +265,7 @@ public static function profileExists($profiles_id, $itemtype = false) {
265265
* @param profileID the profile ID
266266
* @return nothing
267267
*/
268-
public static function createAccess($profiles_id, $itemtype, $first=false) {
268+
public static function createAccess($profiles_id, $itemtype, $first = false) {
269269

270270
$rights = getAllDatasFromTable('glpi_profiles');
271271
$profile_right = new ProfileRight();
@@ -311,7 +311,7 @@ public static function getTypesRights() {
311311
return $rights;
312312
}
313313

314-
public static function installRights($first=false) {
314+
public static function installRights($first = false) {
315315
$missing_rights = [];
316316
$installed_rights = ProfileRight::getAllPossibleRights();
317317
$right_names = [];
@@ -384,7 +384,7 @@ static function install(Migration $migration) {
384384
"`profiles_id`='".$right['profiles_id']."'
385385
AND `name`='$newrightname'")) {
386386
switch ($right['right']) {
387-
case NULL:
387+
case null:
388388
case '':
389389
$rightvalue = 0;
390390
break;

inc/type.class.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function isEntityAssign() {
6262
return false;
6363
}
6464

65-
static function getTypeName($nb=0) {
65+
static function getTypeName($nb = 0) {
6666
return __("Type of objects", "genericobject");
6767
}
6868

@@ -96,7 +96,7 @@ function defineTabs($options = []) {
9696
return $tabs;
9797
}
9898

99-
function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
99+
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
100100
if (!$withtemplate) {
101101
switch ($item->getType()) {
102102
case __CLASS__ :
@@ -106,12 +106,12 @@ function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
106106
$obj->getEmpty();
107107
$nb_fields = count($obj->fields);
108108

109-
$tabs = array (
109+
$tabs = [
110110
1 => __("Main"),
111111
3 => _n("Field", "Fields", 2),
112112
3 => self::createTabEntry(_n("Field", "Fields", Session::getPluralNumber()), $nb_fields),
113113
5 => __("Preview")
114-
);
114+
];
115115
if ($item->canUseDirectConnections()) {
116116
$tabs[7] = __("Associated element");
117117
}
@@ -122,7 +122,7 @@ function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
122122

123123
}
124124

125-
static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {
125+
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
126126
if ($item->getType() == __CLASS__) {
127127
switch ($tabnum) {
128128
case 1 :
@@ -1336,7 +1336,7 @@ static function deleteFilesAndClassesForOneItemtype($name) {
13361336

13371337
static function deleteItemtypeReferencesInGLPI($itemtype) {
13381338
//Delete references to PluginGenericobjectType in the following tables
1339-
$itemtypes = array ("Contract_Item", "DisplayPreference", "Document_Item", "SavedSearch", "Log");
1339+
$itemtypes = ["Contract_Item", "DisplayPreference", "Document_Item", "SavedSearch", "Log"];
13401340
foreach ($itemtypes as $type) {
13411341
$item = new $type();
13421342
$item->deleteByCriteria(['itemtype' => $itemtype]);
@@ -1648,7 +1648,7 @@ static function getTypes($all = false) {
16481648
}
16491649
return $mytypes;
16501650
} else {
1651-
return array ();
1651+
return [];
16521652
}
16531653
}
16541654

@@ -1669,7 +1669,7 @@ static function getTypesByFamily($all = false) {
16691669
}
16701670
return $mytypes;
16711671
} else {
1672-
return array ();
1672+
return [];
16731673
}
16741674
}
16751675

inc/typefamily.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
class PluginGenericobjectTypeFamily extends CommonDropdown {
3333
var $can_be_translated = true;
3434

35-
static function getTypeName($nb=0) {
35+
static function getTypeName($nb = 0) {
3636
return __('Family of type of objects', 'genericobject');
3737
}
3838

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
if (count($types) == 1) {
4747
//There's only one itemtype ? If yes, then automatically
4848
//redirect to the search engine
49-
if (key($types) == NULL) {
49+
if (key($types) == null) {
5050
$mytypes = $types;
5151
$tmp = array_pop($mytypes);
5252
if (count($tmp) == 1) {

0 commit comments

Comments
 (0)