dolibarr 19.0.3
DolRequestDataCollector.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
24use DebugBar\DataCollector\RequestDataCollector;
25
30class DolRequestDataCollector extends RequestDataCollector
31{
37 public function collect()
38 {
39 $vars = array('_GET', '_POST', '_SESSION', '_COOKIE', '_SERVER');
40 $data = array();
41
42 foreach ($vars as $var) {
43 if (isset($GLOBALS[$var])) {
44 $arrayofvalues = $GLOBALS[$var];
45
46 if ($var == '_COOKIE') {
47 foreach ($arrayofvalues as $key => $val) {
48 if (preg_match('/^DOLSESSID_/', $key)) {
49 $arrayofvalues[$key] = '*****hidden*****';
50 }
51 }
52 //var_dump($arrayofvalues);
53 }
54 if ($var == '_SERVER') {
55 foreach ($arrayofvalues as $key => $val) {
56 if (preg_match('/^PHP_AUTH_PW/', $key)) {
57 $arrayofvalues[$key] = '*****hidden*****';
58 }
59 }
60 }
61 $data["$".$var] = $this->getDataFormatter()->formatVar($arrayofvalues);
62 }
63 }
64
65 return $data;
66 }
67
73 public function getWidgets()
74 {
75 global $langs;
76
77 $langs->load("other");
78
79 return array(
80 $langs->transnoentities('Variables') => array(
81 "icon" => "tags",
82 "widget" => "PhpDebugBar.Widgets.VariableListWidget",
83 "map" => "request",
84 "default" => "{}"
85 )
86 );
87 }
88}
DolRequestDataCollector class.
collect()
Collects the data from the collectors.
getWidgets()
Return widget settings.