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

Commit 3c3827b

Browse files
authored
Merge pull request #11 from ggrachdev/dev
0.0.8 fix
2 parents e346c52 + ff67208 commit 3c3827b

File tree

4 files changed

+72
-70
lines changed

4 files changed

+72
-70
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public function addDebugBar(&$content) {
2121
$APPLICATION->GetProperty("save_kernel") == "Y" ||
2222
!\is_object($USER) ||
2323
!$USER->IsAdmin() ||
24-
$request->isAjaxRequest()
24+
$request->isAjaxRequest() ||
25+
(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
2526
) {
2627
return;
2728
}

ggrachdev.debugbar/classes/general/BitrixDebugger/View/DebugBarView.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,14 @@ public static function render(Debugger $debugger): string {
9999

100100
self::addViewInRightSlot('<a target="_blank" href="/bitrix/admin/site_edit.php?LID=' . \SITE_ID . '&lang=ru" class="ggrach__debug-bar__right__item ggrach_background_success" title="Текущая страница">' . SITE_CHARSET . '</a>');
101101

102-
$debugBarIsClosed = $_COOKIE['ggrach_debug_bar_is_close'] == 'true';
102+
if(!isset($_COOKIE['ggrach_debug_bar_is_close']))
103+
{
104+
$debugBarIsClosed = true;
105+
}
106+
else
107+
{
108+
$debugBarIsClosed = $_COOKIE['ggrach_debug_bar_is_close'] == 'true';
109+
}
103110

104111
$closeIcon = $debugBarIsClosed ? '&lt;' : '&#215;';
105112

ggrachdev.debugbar/filters.php

Lines changed: 45 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,56 @@
11
<?php
22

33
DD()->addFilter('values', function ($data, $filterParams) {
4-
if (\is_array($data)) {
5-
return \array_values($data);
6-
} else {
7-
return $data;
8-
}
9-
});
10-
11-
DD()->addFilter('limit', function ($data, $filterParams) {
12-
if (\is_array($data) && !empty($data)) {
13-
if (empty($filterParams[0]) || !\is_numeric($filterParams[0]) || $filterParams[0] < 1) {
14-
$count = 10;
4+
if (\is_array($data)) {
5+
return \array_values($data);
156
} else {
16-
$count = $filterParams[0];
7+
return $data;
178
}
18-
$data = array_slice($data, 0, $count, true);
19-
}
20-
21-
return $data;
22-
});
23-
24-
DD()->addFilter('first', function ($data, $filterParams) {
25-
if (\is_array($data) && !empty($data)) {
26-
$data = array_shift($data);
27-
}
28-
29-
return $data;
30-
});
31-
32-
DD()->addFilter('keys', function ($data, $filterParams) {
33-
34-
if (
35-
!empty($data) &&
36-
is_array($data) &&
37-
!empty($filterParams[0]) &&
38-
\is_array($filterParams[0])
39-
) {
40-
$newData = [];
41-
42-
foreach ($data as $k => $v) {
43-
if (\in_array($k, $filterParams[0])) {
44-
$newData[$k] = $v;
9+
})
10+
->addFilter('limit', function ($data, $filterParams) {
11+
if (\is_array($data) && !empty($data)) {
12+
if (empty($filterParams[0]) || !\is_numeric($filterParams[0]) || $filterParams[0] < 1) {
13+
$count = 10;
14+
} else {
15+
$count = $filterParams[0];
4516
}
17+
$data = array_slice($data, 0, $count, true);
4618
}
4719

48-
$data = $newData;
49-
}
20+
return $data;
21+
})
22+
->addFilter('first', function ($data, $filterParams) {
23+
if (\is_array($data) && !empty($data)) {
24+
$data = array_shift($data);
25+
}
26+
27+
return $data;
28+
})
29+
->addFilter('keys', function ($data, $filterParams) {
30+
31+
if (
32+
!empty($data) &&
33+
is_array($data) &&
34+
!empty($filterParams[0]) &&
35+
\is_array($filterParams[0])
36+
) {
37+
$newData = [];
38+
39+
foreach ($data as $k => $v) {
40+
if (\in_array($k, $filterParams[0])) {
41+
$newData[$k] = $v;
42+
}
43+
}
5044

51-
return $data;
52-
});
45+
$data = $newData;
46+
}
5347

54-
DD()->addFilter('last', function ($data, $filterParams) {
55-
if (\is_array($data) && !empty($data)) {
56-
$data = array_pop($data);
57-
}
48+
return $data;
49+
})
50+
->addFilter('last', function ($data, $filterParams) {
51+
if (\is_array($data) && !empty($data)) {
52+
$data = array_pop($data);
53+
}
5854

59-
return $data;
60-
});
55+
return $data;
56+
});

ggrachdev.debugbar/install/index.php

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -75,43 +75,41 @@ public function installAssets() {
7575

7676
// copy js
7777
$dirJsFrom = null;
78-
79-
if(\is_file($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/{$this->MODULE_ID}/install/version.php"))
80-
{
78+
79+
if (\is_file($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/{$this->MODULE_ID}/install/version.php")) {
8180
$dirJsFrom = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/" . $this->MODULE_ID . "/install/js";
82-
}
83-
else if(\is_file($_SERVER["DOCUMENT_ROOT"] . "/local/modules/{$this->MODULE_ID}/install/version.php"))
84-
{
81+
} else if (\is_file($_SERVER["DOCUMENT_ROOT"] . "/local/modules/{$this->MODULE_ID}/install/version.php")) {
8582
$dirJsFrom = $_SERVER["DOCUMENT_ROOT"] . "/local/modules/" . $this->MODULE_ID . "/install/js";
8683
}
8784

8885
$dirJsTo = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/js/" . $this->MODULE_ID;
89-
90-
if ($dirJsFrom && !\is_dir($dirJsTo)) {
86+
87+
if (!\is_dir($dirJsTo)) {
9188
\mkdir($dirJsTo);
9289
}
9390

94-
\CopyDirFiles($dirJsFrom, $dirJsTo, true, true);
91+
if (\is_dir($dirJsFrom) && \is_dir($dirJsTo)) {
92+
\CopyDirFiles($dirJsFrom, $dirJsTo, true, true);
93+
}
9594

9695
// copy css
9796
$dirCssFrom = null;
98-
99-
if(\is_file($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/{$this->MODULE_ID}/install/version.php"))
100-
{
97+
98+
if (\is_file($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/{$this->MODULE_ID}/install/version.php")) {
10199
$dirCssFrom = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/" . $this->MODULE_ID . "/install/css";
102-
}
103-
else if(\is_file($_SERVER["DOCUMENT_ROOT"] . "/local/modules/{$this->MODULE_ID}/install/version.php"))
104-
{
100+
} else if (\is_file($_SERVER["DOCUMENT_ROOT"] . "/local/modules/{$this->MODULE_ID}/install/version.php")) {
105101
$dirCssFrom = $_SERVER["DOCUMENT_ROOT"] . "/local/modules/" . $this->MODULE_ID . "/install/css";
106102
}
107-
103+
108104
$dirCssTo = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/css/" . $this->MODULE_ID;
109-
110-
if ($dirCssTo && !\is_dir($dirCssTo)) {
105+
106+
if (!\is_dir($dirCssTo)) {
111107
\mkdir($dirCssTo);
112108
}
113109

114-
\CopyDirFiles($dirCssFrom, $dirCssTo, true, true);
110+
if (\is_dir($dirCssFrom) && \is_dir($dirCssTo)) {
111+
\CopyDirFiles($dirCssFrom, $dirCssTo, true, true);
112+
}
115113
}
116114

117115
public function reinstallAssets() {

0 commit comments

Comments
 (0)