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

Commit 638d0cb

Browse files
committed
Удалены лишние папки, событие буфферизации вынесено в класс
1 parent 89749d2 commit 638d0cb

File tree

5 files changed

+34
-22
lines changed

5 files changed

+34
-22
lines changed

events.php

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,10 @@
11
<?php
2-
32
// Добавляем дебаг-бар
43
\Bitrix\Main\EventManager::getInstance()->addEventHandler(
54
"main",
65
"OnEndBufferContent",
7-
"GgrachAddDebugBar"
6+
[
7+
"\\GGrach\\Writer\Events\\OnEndBufferContent",
8+
"addDebugBar"
9+
]
810
);
9-
10-
function GgrachAddDebugBar(&$content) {
11-
12-
global $USER, $APPLICATION;
13-
14-
if (
15-
strpos($APPLICATION->GetCurDir(), "/bitrix/") !== false ||
16-
$APPLICATION->GetProperty("save_kernel") == "Y" ||
17-
!\is_object($USER) ||
18-
!$USER->IsAdmin()
19-
) {
20-
return;
21-
}
22-
23-
$logData = \GGrach\BitrixDebugger\Representer\DebugBarRepresenter::render(DD());
24-
$content = \str_replace(['</body>', '</ body>', '</ body >', '</body >'], $logData . '</body>', $content);
25-
}

initializers/server.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"\GGrach\BitrixDebugger\Validator\ShowModeDebuggerValidator" => $ggrachDebuggerRootPath . "/src/BitrixDebugger/Validator/ShowModeDebuggerValidator.php",
1616
"\GGrach\BitrixDebugger\Representer\DebugBarRepresenter" => $ggrachDebuggerRootPath . "/src/BitrixDebugger/Representer/DebugBarRepresenter.php",
1717
"\GGrach\Writer\FileWriter" => $ggrachDebuggerRootPath . "/src/Writer/FileWriter.php",
18-
"\GGrach\Writer\Contract\WritableContract" => $ggrachDebuggerRootPath . "/src/Writer/Contract/WritableContract.php"
18+
"\GGrach\Writer\Contract\WritableContract" => $ggrachDebuggerRootPath . "/src/Writer/Contract/WritableContract.php",
19+
"\GGrach\Writer\Events\OnEndBufferContent" => $ggrachDebuggerRootPath . "/src/Writer/Events/OnEndBufferContent.php"
1920
]);
2021

2122
$ggrachDebuggerConfigurator = new \GGrach\BitrixDebugger\Configurator\DebuggerConfigurator();

src/BitrixDebugger/DebugBar/.gitkeep

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace GGrach\BitrixDebugger\Events;
4+
5+
/**
6+
* Description of OnEndBufferContent
7+
*
8+
* @author ggrachdev
9+
*/
10+
class OnEndBufferContent {
11+
12+
public function addDebugBar(&$content) {
13+
global $USER, $APPLICATION;
14+
15+
if (
16+
strpos($APPLICATION->GetCurDir(), "/bitrix/") !== false ||
17+
$APPLICATION->GetProperty("save_kernel") == "Y" ||
18+
!\is_object($USER) ||
19+
!$USER->IsAdmin()
20+
) {
21+
return;
22+
}
23+
24+
$logData = \GGrach\BitrixDebugger\Representer\DebugBarRepresenter::render(DD());
25+
$content = \str_replace(['</body>', '</ body>', '</ body >', '</body >'], $logData . '</body>', $content);
26+
}
27+
28+
}

src/BitrixDebugger/Facade/.gitkeep

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)