|
3 | 3 | /** |
4 | 4 | * https://github.com/ggrachdev/BitrixDebugger |
5 | 5 | * @author ggrachdev@yandex.ru |
6 | | - * @version 0.02 |
| 6 | + * @version 0.03 beta |
7 | 7 | * |
8 | 8 | * Пример дебага: |
9 | 9 | * |
10 | | - * GD()->notice('Моя переменная', 'Моя переменная 2'); |
11 | | - * GD()->error('Моя переменная', 'Моя переменная 2'); |
12 | | - * GD()->warning('Моя переменная', 'Моя переменная 2'); |
13 | | - * GD()->success('Моя переменная', 'Моя переменная 2'); |
| 10 | + * DD()->notice('Моя переменная', 'Моя переменная 2'); |
| 11 | + * DD()->error('Моя переменная', 'Моя переменная 2'); |
| 12 | + * DD()->warning('Моя переменная', 'Моя переменная 2'); |
| 13 | + * DD()->success('Моя переменная', 'Моя переменная 2'); |
14 | 14 | * |
15 | 15 | * Залогировать в файлы |
16 | | - * GD()->noticeLog('Моя переменная', 'Моя переменная 2'); |
17 | | - * GD()->errorLog('Моя переменная', 'Моя переменная 2'); |
18 | | - * GD()->warningLog('Моя переменная', 'Моя переменная 2'); |
19 | | - * GD()->successLog('Моя переменная', 'Моя переменная 2'); |
| 16 | + * DD()->noticeLog('Моя переменная', 'Моя переменная 2'); |
| 17 | + * DD()->errorLog('Моя переменная', 'Моя переменная 2'); |
| 18 | + * DD()->warningLog('Моя переменная', 'Моя переменная 2'); |
| 19 | + * DD()->successLog('Моя переменная', 'Моя переменная 2'); |
20 | 20 | * |
21 | 21 | * Нужно подключить этот файл в init.php |
22 | 22 | * include 'BitrixDebugger/initializer.php'; |
23 | 23 | * |
24 | 24 | */ |
25 | 25 | use Bitrix\Main\Page\Asset; |
26 | 26 |
|
27 | | -if (!empty($_SERVER['DOCUMENT_ROOT'])) { |
| 27 | +if (\php_sapi_name() !== 'cli') { |
28 | 28 |
|
29 | 29 | $ggrachDebuggerRootPath = str_replace($_SERVER['DOCUMENT_ROOT'], '', __DIR__); |
30 | 30 |
|
|
49 | 49 | $ggrachDebuggerConfigurator->setLogPath('success', __DIR__ . '/logs/success.log'); |
50 | 50 | $ggrachDebuggerConfigurator->setLogPath('notice', __DIR__ . '/logs/notice.log'); |
51 | 51 |
|
52 | | - global $DD; |
53 | | - $DD = new \GGrach\BitrixDebugger\Debugger\Debugger($ggrachDebuggerConfigurator, $ggrachDebugBarConfigurator); |
| 52 | + $GLOBALS["DD"] = new \GGrach\BitrixDebugger\Debugger\Debugger($ggrachDebuggerConfigurator, $ggrachDebugBarConfigurator); |
54 | 53 |
|
55 | 54 | /* |
56 | 55 | * code - отображать дебаг-данные в коде |
57 | 56 | * debug_bar - отображать дебаг-данные в debug_bar |
58 | 57 | */ |
59 | | - $DD->setShowModes(['code', 'debug_bar']); |
| 58 | + $GLOBALS["DD"]->setShowModes(['code', 'debug_bar']); |
60 | 59 |
|
61 | 60 | function DD() { |
62 | | - global $DD; |
63 | | - return $DD; |
| 61 | + return $GLOBALS["DD"]; |
64 | 62 | } |
65 | 63 |
|
66 | | - if (\GGrach\BitrixDebugger\Validator\ShowModeDebuggerValidator::needShowInDebugBar($DD)) { |
| 64 | + if (\GGrach\BitrixDebugger\Validator\ShowModeDebuggerValidator::needShowInDebugBar($GLOBALS["DD"])) { |
67 | 65 |
|
68 | 66 | Asset::getInstance()->addJs($ggrachDebuggerRootPath . "/assets/DebugBar/js/initializer.js"); |
69 | | - Asset::getInstance()->addCss($ggrachDebuggerRootPath . '/assets/DebugBar/themes/general.css'); |
70 | | - Asset::getInstance()->addCss($ggrachDebuggerRootPath . '/assets/DebugBar/themes/' . $ggrachDebugBarConfigurator->getColorTheme() . '/theme.css'); |
| 67 | + Asset::getInstance()->addCss($ggrachDebuggerRootPath . '/assets/DebugBar/css/themes/general.css'); |
| 68 | + Asset::getInstance()->addCss($ggrachDebuggerRootPath . '/assets/DebugBar/css/themes/' . $ggrachDebugBarConfigurator->getColorTheme() . '/theme.css'); |
71 | 69 |
|
72 | 70 | include 'functions.php'; |
73 | 71 |
|
|
0 commit comments