dolibarr  21.0.0-alpha
DebugBar.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 
25 dol_include_once('/debugbar/class/autoloader.php');
26 
27 use DebugBar\DebugBar;
28 
29 dol_include_once('/debugbar/class/DataCollector/DolRequestDataCollector.php');
30 dol_include_once('/debugbar/class/DataCollector/DolConfigCollector.php');
31 dol_include_once('/debugbar/class/DataCollector/DolTimeDataCollector.php');
32 dol_include_once('/debugbar/class/DataCollector/DolMemoryCollector.php');
33 dol_include_once('/debugbar/class/DataCollector/DolPhpCollector.php');
34 dol_include_once('/debugbar/class/DataCollector/DolExceptionsCollector.php');
35 dol_include_once('/debugbar/class/DataCollector/DolQueryCollector.php');
36 dol_include_once('/debugbar/class/DataCollector/DolibarrCollector.php');
37 dol_include_once('/debugbar/class/DataCollector/DolLogsCollector.php');
38 dol_include_once('/debugbar/class/DataCollector/DolHooksCollector.php');
39 
46 class DolibarrDebugBar extends DebugBar
47 {
52  public function __construct()
53  {
54  //$this->addCollector(new PhpInfoCollector());
55  //$this->addCollector(new DolMessagesCollector());
56  $this->addCollector(new DolRequestDataCollector());
57  //$this->addCollector(new DolConfigCollector()); // Disabled for security purpose
58  $this->addCollector(new DolTimeDataCollector());
59  $this->addCollector(new PhpCollector());
60  $this->addCollector(new DolMemoryCollector());
61  //$this->addCollector(new DolExceptionsCollector());
62  $this->addCollector(new DolQueryCollector());
63  $this->addCollector(new DolibarrCollector());
64  $this->addCollector(new DolHooksCollector());
65  if (isModEnabled('syslog')) {
66  $this->addCollector(new DolLogsCollector());
67  }
68  }
69 
77  public function getJavascriptRenderer($baseUrl = null, $basePath = null)
78  {
79  if ($baseUrl === null) {
80  $baseUrl = DOL_URL_ROOT.'/includes/maximebf/debugbar/src/DebugBar/Resources';
81  }
82  $renderer = parent::getJavascriptRenderer($baseUrl, $basePath);
83  $renderer->disableVendor('jquery'); // We already have jquery loaded globally by the main.inc.php
84  $renderer->disableVendor('fontawesome'); // We already have fontawesome loaded globally by the main.inc.php
85  $renderer->disableVendor('highlightjs'); // We don't need this
86  $renderer->setEnableJqueryNoConflict(false); // We don't need no conflict
87 
88  return $renderer;
89  }
90 
97  public function getRenderer()
98  {
99  return $this->getJavascriptRenderer();
100  }
101 }
DolRequestDataCollector class.
DolLogsCollector class.
DolMemoryCollector class.
DolQueryCollector class.
DolRequestDataCollector class.
DolTimeDataCollector class.
DolibarrCollector class.
DolibarrDebugBar class.
Definition: DebugBar.php:47
getRenderer()
Returns a JavascriptRenderer for this instance.
Definition: DebugBar.php:97
getJavascriptRenderer($baseUrl=null, $basePath=null)
Returns a JavascriptRenderer for this instance.
Definition: DebugBar.php:77
__construct()
Constructor.
Definition: DebugBar.php:52
Class PhpCollector.
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
isModEnabled($module)
Is Dolibarr module enabled.