dolibarr 21.0.0-beta
DolRequestDataCollector.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
4 *
5 * This program 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 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
25use DebugBar\DataCollector\RequestDataCollector;
26
31class DolRequestDataCollector extends RequestDataCollector
32{
38 public function collect()
39 {
40 $vars = array('_GET', '_POST', '_SESSION', '_COOKIE', '_SERVER');
41 $data = array();
42
43 foreach ($vars as $var) {
44 if (isset($GLOBALS[$var])) {
45 $arrayofvalues = $GLOBALS[$var];
46
47 if ($var == '_COOKIE') {
48 foreach ($arrayofvalues as $key => $val) {
49 if (preg_match('/^DOLSESSID_/', $key)) {
50 $arrayofvalues[$key] = '*****hidden*****';
51 }
52 }
53 //var_dump($arrayofvalues);
54 }
55 if ($var == '_SERVER') {
56 foreach ($arrayofvalues as $key => $val) {
57 if (preg_match('/^PHP_AUTH_PW/', $key)) {
58 $arrayofvalues[$key] = '*****hidden*****';
59 }
60 }
61 }
62 $data["$".$var] = $this->getDataFormatter()->formatVar($arrayofvalues);
63 }
64 }
65
66 return $data;
67 }
68
74 public function getWidgets()
75 {
76 global $langs;
77
78 $langs->load("other");
79
80 return array(
81 $langs->transnoentities('Variables') => array(
82 "icon" => "tags",
83 "widget" => "PhpDebugBar.Widgets.VariableListWidget",
84 "map" => "request",
85 "default" => "{}"
86 )
87 );
88 }
89}
DolRequestDataCollector class.
collect()
Collects the data from the collectors.
getWidgets()
Return widget settings.