33/**
44 * https://github.com/ggrachdev/BitrixDebugger
556- * @version 0.1
6+ * @version 0.01
77 *
88 * Пример дебага:
99 *
2222 * include 'BitrixDebugger/initializer.php';
2323 *
2424 */
25-
2625use Bitrix \Main \Page \Asset ;
2726
28- $ ggrachDebuggerRootPath = str_replace ($ _SERVER ['DOCUMENT_ROOT ' ], '' , __DIR__ );
29-
30- \Bitrix \Main \Loader::registerAutoLoadClasses (null , [
31- "\GGrach\BitrixDebugger\Debugger\Debugger " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Debugger/Debugger.php " ,
32- "\GGrach\BitrixDebugger\Debugger\DebuggerShowModable " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Debugger/DebuggerShowModable.php " ,
33- "\GGrach\BitrixDebugger\Contract\ShowModableContract " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Contract/ShowModableContract.php " ,
34- "\GGrach\BitrixDebugger\Configurator\DebuggerConfigurator " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Configurator/DebuggerConfigurator.php " ,
35- "\GGrach\BitrixDebugger\Configurator\DebugBarConfigurator " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Configurator/DebugBarConfigurator.php " ,
36- "\GGrach\BitrixDebugger\Cache\RuntimeCache " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Cache/RuntimeCache.php " ,
37- "\GGrach\BitrixDebugger\Validator\ShowModeDebuggerValidator " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Validator/ShowModeDebuggerValidator.php " ,
38- "\GGrach\BitrixDebugger\Representer\DebugBarRepresenter " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Representer/DebugBarRepresenter.php " ,
39- "\GGrach\Writer\FileWriter " => $ ggrachDebuggerRootPath . "/src/Writer/FileWriter.php " ,
40- "\GGrach\Writer\Contract\WritableContract " => $ ggrachDebuggerRootPath . "/src/Writer/Contract/WritableContract.php "
41- ]);
27+ if (!empty ($ _SERVER ['DOCUMENT_ROOT ' ])) {
4228
43- $ ggrachDebuggerConfigurator = new \GGrach \BitrixDebugger \Configurator \DebuggerConfigurator ();
44- $ ggrachDebugBarConfigurator = new \GGrach \BitrixDebugger \Configurator \DebugBarConfigurator ();
29+ $ ggrachDebuggerRootPath = str_replace ($ _SERVER ['DOCUMENT_ROOT ' ], '' , __DIR__ );
4530
46- $ ggrachDebuggerConfigurator ->setLogPath ('error ' , __DIR__ . '/logs/error.log ' );
47- $ ggrachDebuggerConfigurator ->setLogPath ('warning ' , __DIR__ . '/logs/warning.log ' );
48- $ ggrachDebuggerConfigurator ->setLogPath ('success ' , __DIR__ . '/logs/success.log ' );
49- $ ggrachDebuggerConfigurator ->setLogPath ('notice ' , __DIR__ . '/logs/notice.log ' );
31+ \Bitrix \Main \Loader::registerAutoLoadClasses (null , [
32+ "\GGrach\BitrixDebugger\Debugger\Debugger " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Debugger/Debugger.php " ,
33+ "\GGrach\BitrixDebugger\Debugger\DebuggerShowModable " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Debugger/DebuggerShowModable.php " ,
34+ "\GGrach\BitrixDebugger\Contract\ShowModableContract " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Contract/ShowModableContract.php " ,
35+ "\GGrach\BitrixDebugger\Configurator\DebuggerConfigurator " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Configurator/DebuggerConfigurator.php " ,
36+ "\GGrach\BitrixDebugger\Configurator\DebugBarConfigurator " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Configurator/DebugBarConfigurator.php " ,
37+ "\GGrach\BitrixDebugger\Cache\RuntimeCache " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Cache/RuntimeCache.php " ,
38+ "\GGrach\BitrixDebugger\Validator\ShowModeDebuggerValidator " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Validator/ShowModeDebuggerValidator.php " ,
39+ "\GGrach\BitrixDebugger\Representer\DebugBarRepresenter " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Representer/DebugBarRepresenter.php " ,
40+ "\GGrach\Writer\FileWriter " => $ ggrachDebuggerRootPath . "/src/Writer/FileWriter.php " ,
41+ "\GGrach\Writer\Contract\WritableContract " => $ ggrachDebuggerRootPath . "/src/Writer/Contract/WritableContract.php "
42+ ]);
5043
51- global $ GD ;
52- $ GD = new \GGrach \BitrixDebugger \Debugger \ Debugger ( $ ggrachDebuggerConfigurator , $ ggrachDebugBarConfigurator );
44+ $ ggrachDebuggerConfigurator = new \ GGrach \ BitrixDebugger \ Configurator \ DebuggerConfigurator () ;
45+ $ ggrachDebugBarConfigurator = new \GGrach \BitrixDebugger \Configurator \ DebugBarConfigurator ( );
5346
54- /*
55- * code - отображать дебаг-данные в коде
56- * debug_bar - отображать дебаг-данные в debug_bar
57- */
58- $ GD ->setShowModes (['code ' , 'debug_bar ' ]);
47+ $ ggrachDebuggerConfigurator ->setLogPath ('error ' , __DIR__ . '/logs/error.log ' );
48+ $ ggrachDebuggerConfigurator ->setLogPath ('warning ' , __DIR__ . '/logs/warning.log ' );
49+ $ ggrachDebuggerConfigurator ->setLogPath ('success ' , __DIR__ . '/logs/success.log ' );
50+ $ ggrachDebuggerConfigurator ->setLogPath ('notice ' , __DIR__ . '/logs/notice.log ' );
5951
60- function GD () {
6152 global $ GD ;
62- return $ GD ;
63- }
53+ $ GD = new \GGrach \BitrixDebugger \Debugger \Debugger ($ ggrachDebuggerConfigurator , $ ggrachDebugBarConfigurator );
54+
55+ /*
56+ * code - отображать дебаг-данные в коде
57+ * debug_bar - отображать дебаг-данные в debug_bar
58+ */
59+ $ GD ->setShowModes (['code ' , 'debug_bar ' ]);
60+
61+ function GD () {
62+ global $ GD ;
63+ return $ GD ;
64+ }
6465
65- Asset::getInstance ()->addJs ($ ggrachDebuggerRootPath . "/assets/DebugBar/js/initializer.js " );
66- Asset::getInstance ()->addCss ($ ggrachDebuggerRootPath . '/assets/DebugBar/themes/general.css ' );
67- Asset::getInstance ()->addCss ($ ggrachDebuggerRootPath . '/assets/DebugBar/themes/ ' . $ ggrachDebugBarConfigurator ->getColorTheme () . '/theme.css ' );
66+ if (\GGrach \BitrixDebugger \Validator \ShowModeDebuggerValidator::needShowInDebugBar ($ GD )) {
6867
69- if (\GGrach \BitrixDebugger \Validator \ShowModeDebuggerValidator::needShowInDebugBar ($ GD )) {
68+ 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 ' );
7071
71- include 'functions.php ' ;
72+ include 'functions.php ' ;
7273
73- include 'events.php ' ;
74- }
74+ include 'events.php ' ;
75+ }
76+ }
0 commit comments