Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit 43fbb02

Browse files
committed
Update OnEndBufferContent.php - if debug not show in debug bar - debug bar not showed
1 parent 531cf0f commit 43fbb02

1 file changed

Lines changed: 22 additions & 18 deletions

File tree

ggrachdev.debugbar/classes/general/BitrixDebugger/Events/OnEndBufferContent.php

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,36 @@
33
namespace GGrach\BitrixDebugger\Events;
44

55
use \Bitrix\Main\Application;
6-
6+
use GGrach\BitrixDebugger\Validator\ShowModeDebuggerValidator;
7+
78
/**
89
* Description of OnEndBufferContent
910
*
1011
* @author ggrachdev
1112
*/
1213
class OnEndBufferContent {
13-
14+
1415
public function addDebugBar(&$content) {
15-
global $USER, $APPLICATION;
16-
17-
$request = Application::getInstance()->getContext()->getRequest();
18-
19-
if (
20-
strpos($APPLICATION->GetCurDir(), "/bitrix/") !== false ||
21-
$APPLICATION->GetProperty("save_kernel") == "Y" ||
22-
!\is_object($USER) ||
23-
!$USER->IsAdmin() ||
24-
$request->isAjaxRequest() ||
25-
(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
26-
) {
27-
return;
28-
}
2916

30-
$logData = \GGrach\BitrixDebugger\View\DebugBarView::render(DD());
31-
$content = \preg_replace("~<\s*\t*/\s*\t*body\s*\t*>~", $logData . '</body>', $content);
17+
if (ShowModeDebuggerValidator::needShowInDebugBar(DD()->getConfiguratorDebugger())) {
18+
global $USER, $APPLICATION;
19+
20+
$request = Application::getInstance()->getContext()->getRequest();
21+
22+
if (
23+
strpos($APPLICATION->GetCurDir(), "/bitrix/") !== false ||
24+
$APPLICATION->GetProperty("save_kernel") == "Y" ||
25+
!\is_object($USER) ||
26+
!$USER->IsAdmin() ||
27+
$request->isAjaxRequest() ||
28+
(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
29+
) {
30+
return;
31+
}
32+
33+
$logData = \GGrach\BitrixDebugger\View\DebugBarView::render(DD());
34+
$content = \preg_replace("~<\s*\t*/\s*\t*body\s*\t*>~", $logData . '</body>', $content);
35+
}
3236
}
3337

3438
}

0 commit comments

Comments
 (0)