@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * Collection constructor. |
17 | 17 | * @param array $data |
18 | 18 | */ |
19 | - public function __construct(array $data = array()) |
|
20 | - { |
|
19 | + public function __construct(array $data = array()) |
|
20 | + { |
|
21 | 21 | $this->data = $data; |
22 | 22 | } |
23 | 23 | |
@@ -25,16 +25,16 @@ discard block |
||
25 | 25 | * @param array $data |
26 | 26 | * @return static |
27 | 27 | */ |
28 | - public function create(array $data = array()) |
|
29 | - { |
|
28 | + public function create(array $data = array()) |
|
29 | + { |
|
30 | 30 | return new static($data); |
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @return \ArrayIterator |
35 | 35 | */ |
36 | - public function getIterator() |
|
37 | - { |
|
36 | + public function getIterator() |
|
37 | + { |
|
38 | 38 | return new \ArrayIterator($this->data); |
39 | 39 | } |
40 | 40 | |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param Closure $func |
43 | 43 | * @return Collection |
44 | 44 | */ |
45 | - public function map(Closure $func) |
|
46 | - { |
|
45 | + public function map(Closure $func) |
|
46 | + { |
|
47 | 47 | return $this->create(array_map($func, $this->data)); |
48 | 48 | } |
49 | 49 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * @param Closure $callback |
54 | 54 | * @return static |
55 | 55 | */ |
56 | - public function filter(Closure $callback) |
|
57 | - { |
|
56 | + public function filter(Closure $callback) |
|
57 | + { |
|
58 | 58 | return $this->create(array_filter($this->data, $callback)); |
59 | 59 | } |
60 | 60 | |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | * @param Closure $p |
63 | 63 | * @return bool |
64 | 64 | */ |
65 | - public function forAll(Closure $p) |
|
66 | - { |
|
67 | - foreach ($this->data as $key => $element) { |
|
68 | - if (!$p($key, $element)) { |
|
65 | + public function forAll(Closure $p) |
|
66 | + { |
|
67 | + foreach ($this->data as $key => $element) { |
|
68 | + if (!$p($key, $element)) { |
|
69 | 69 | return false; |
70 | 70 | } |
71 | 71 | } |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | * @param Closure $p |
78 | 78 | * @return array |
79 | 79 | */ |
80 | - public function partition(Closure $p) |
|
81 | - { |
|
80 | + public function partition(Closure $p) |
|
81 | + { |
|
82 | 82 | $matches = $noMatches = array(); |
83 | - foreach ($this->data as $key => $element) { |
|
84 | - if ($p($key, $element)) { |
|
83 | + foreach ($this->data as $key => $element) { |
|
84 | + if ($p($key, $element)) { |
|
85 | 85 | $matches[$key] = $element; |
86 | - } else { |
|
86 | + } else { |
|
87 | 87 | $noMatches[$key] = $element; |
88 | 88 | } |
89 | 89 | } |
@@ -96,24 +96,24 @@ discard block |
||
96 | 96 | * @param null $length |
97 | 97 | * @return array |
98 | 98 | */ |
99 | - public function slice($offset, $length = null) |
|
100 | - { |
|
99 | + public function slice($offset, $length = null) |
|
100 | + { |
|
101 | 101 | return array_slice($this->data, $offset, $length, true); |
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
105 | 105 | * @return bool |
106 | 106 | */ |
107 | - public function isEmpty() |
|
108 | - { |
|
107 | + public function isEmpty() |
|
108 | + { |
|
109 | 109 | return empty($this->data); |
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
113 | 113 | * @return $this |
114 | 114 | */ |
115 | - public function clear() |
|
116 | - { |
|
115 | + public function clear() |
|
116 | + { |
|
117 | 117 | $this->data = array(); |
118 | 118 | |
119 | 119 | return $this; |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | * @param $value |
124 | 124 | * @return $this |
125 | 125 | */ |
126 | - public function append($value) |
|
127 | - { |
|
126 | + public function append($value) |
|
127 | + { |
|
128 | 128 | $this->data[] = $value; |
129 | 129 | |
130 | 130 | return $this; |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | * @param null $id |
136 | 136 | * @return $this |
137 | 137 | */ |
138 | - public function add($data, $id = null) |
|
139 | - { |
|
140 | - if ((is_int($id) || is_string($id)) && $id !== '') { |
|
138 | + public function add($data, $id = null) |
|
139 | + { |
|
140 | + if ((is_int($id) || is_string($id)) && $id !== '') { |
|
141 | 141 | $this->data[$id] = $data; |
142 | - } else { |
|
142 | + } else { |
|
143 | 143 | $this->append($data); |
144 | 144 | } |
145 | 145 | |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | /** |
150 | 150 | * @return int |
151 | 151 | */ |
152 | - public function count() |
|
153 | - { |
|
152 | + public function count() |
|
153 | + { |
|
154 | 154 | return count($this->data); |
155 | 155 | } |
156 | 156 | |
@@ -158,10 +158,10 @@ discard block |
||
158 | 158 | * @param $id |
159 | 159 | * @return mixed|null |
160 | 160 | */ |
161 | - public function get($id) |
|
162 | - { |
|
161 | + public function get($id) |
|
162 | + { |
|
163 | 163 | $out = null; |
164 | - if (is_scalar($id) && $id !== '' && $this->containsKey($id)) { |
|
164 | + if (is_scalar($id) && $id !== '' && $this->containsKey($id)) { |
|
165 | 165 | $out = $this->data[$id]; |
166 | 166 | } |
167 | 167 | |
@@ -172,56 +172,56 @@ discard block |
||
172 | 172 | * @param $key |
173 | 173 | * @param $value |
174 | 174 | */ |
175 | - public function set($key, $value) |
|
176 | - { |
|
175 | + public function set($key, $value) |
|
176 | + { |
|
177 | 177 | $this->data[$key] = $value; |
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
181 | 181 | * @return mixed |
182 | 182 | */ |
183 | - public function first() |
|
184 | - { |
|
183 | + public function first() |
|
184 | + { |
|
185 | 185 | return reset($this->data); |
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
189 | 189 | * @return mixed |
190 | 190 | */ |
191 | - public function last() |
|
192 | - { |
|
191 | + public function last() |
|
192 | + { |
|
193 | 193 | return end($this->data); |
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
197 | 197 | * @return mixed |
198 | 198 | */ |
199 | - public function key() |
|
200 | - { |
|
199 | + public function key() |
|
200 | + { |
|
201 | 201 | return key($this->data); |
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
205 | 205 | * @return mixed |
206 | 206 | */ |
207 | - public function prev() |
|
208 | - { |
|
207 | + public function prev() |
|
208 | + { |
|
209 | 209 | return prev($this->data); |
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
213 | 213 | * @return mixed |
214 | 214 | */ |
215 | - public function next() |
|
216 | - { |
|
215 | + public function next() |
|
216 | + { |
|
217 | 217 | return next($this->data); |
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
221 | 221 | * @return mixed |
222 | 222 | */ |
223 | - public function current() |
|
224 | - { |
|
223 | + public function current() |
|
224 | + { |
|
225 | 225 | return current($this->data); |
226 | 226 | } |
227 | 227 | |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | * @param $key |
230 | 230 | * @return mixed|null |
231 | 231 | */ |
232 | - public function remove($key) |
|
233 | - { |
|
234 | - if (!isset($this->data[$key]) && !array_key_exists($key, $this->data)) { |
|
232 | + public function remove($key) |
|
233 | + { |
|
234 | + if (!isset($this->data[$key]) && !array_key_exists($key, $this->data)) { |
|
235 | 235 | return null; |
236 | 236 | } |
237 | 237 | $removed = $this->data[$key]; |
@@ -244,10 +244,10 @@ discard block |
||
244 | 244 | * @param $element |
245 | 245 | * @return bool |
246 | 246 | */ |
247 | - public function removeElement($element) |
|
248 | - { |
|
247 | + public function removeElement($element) |
|
248 | + { |
|
249 | 249 | $key = array_search($element, $this->data, true); |
250 | - if ($key === false) { |
|
250 | + if ($key === false) { |
|
251 | 251 | return false; |
252 | 252 | } |
253 | 253 | unset($this->data[$key]); |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | * @param mixed $offset |
260 | 260 | * @return bool |
261 | 261 | */ |
262 | - public function offsetExists($offset) |
|
263 | - { |
|
262 | + public function offsetExists($offset) |
|
263 | + { |
|
264 | 264 | return $this->containsKey($offset); |
265 | 265 | } |
266 | 266 | |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | * @param mixed $offset |
269 | 269 | * @return mixed|null |
270 | 270 | */ |
271 | - public function offsetGet($offset) |
|
272 | - { |
|
271 | + public function offsetGet($offset) |
|
272 | + { |
|
273 | 273 | return $this->get($offset); |
274 | 274 | } |
275 | 275 | |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | * @param mixed $value |
279 | 279 | * @return Collection |
280 | 280 | */ |
281 | - public function offsetSet($offset, $value) |
|
282 | - { |
|
283 | - if (!isset($offset)) { |
|
281 | + public function offsetSet($offset, $value) |
|
282 | + { |
|
283 | + if (!isset($offset)) { |
|
284 | 284 | return $this->add($value); |
285 | 285 | } |
286 | 286 | $this->set($offset, $value); |
@@ -290,8 +290,8 @@ discard block |
||
290 | 290 | * @param mixed $offset |
291 | 291 | * @return mixed|null |
292 | 292 | */ |
293 | - public function offsetUnset($offset) |
|
294 | - { |
|
293 | + public function offsetUnset($offset) |
|
294 | + { |
|
295 | 295 | return $this->remove($offset); |
296 | 296 | } |
297 | 297 | |
@@ -299,8 +299,8 @@ discard block |
||
299 | 299 | * @param $key |
300 | 300 | * @return bool |
301 | 301 | */ |
302 | - public function containsKey($key) |
|
303 | - { |
|
302 | + public function containsKey($key) |
|
303 | + { |
|
304 | 304 | return isset($this->data[$key]) || array_key_exists($key, $this->data); |
305 | 305 | } |
306 | 306 | |
@@ -308,8 +308,8 @@ discard block |
||
308 | 308 | * @param $element |
309 | 309 | * @return bool |
310 | 310 | */ |
311 | - public function contains($element) |
|
312 | - { |
|
311 | + public function contains($element) |
|
312 | + { |
|
313 | 313 | return in_array($element, $this->data, true); |
314 | 314 | } |
315 | 315 | |
@@ -317,10 +317,10 @@ discard block |
||
317 | 317 | * @param Closure $p |
318 | 318 | * @return bool |
319 | 319 | */ |
320 | - public function exists(Closure $p) |
|
321 | - { |
|
322 | - foreach ($this->data as $key => $element) { |
|
323 | - if ($p($key, $element)) { |
|
320 | + public function exists(Closure $p) |
|
321 | + { |
|
322 | + foreach ($this->data as $key => $element) { |
|
323 | + if ($p($key, $element)) { |
|
324 | 324 | return true; |
325 | 325 | } |
326 | 326 | } |
@@ -332,32 +332,32 @@ discard block |
||
332 | 332 | * @param $element |
333 | 333 | * @return mixed |
334 | 334 | */ |
335 | - public function indexOf($element) |
|
336 | - { |
|
335 | + public function indexOf($element) |
|
336 | + { |
|
337 | 337 | return array_search($element, $this->data, true); |
338 | 338 | } |
339 | 339 | |
340 | 340 | /** |
341 | 341 | * @return array |
342 | 342 | */ |
343 | - public function getKeys() |
|
344 | - { |
|
343 | + public function getKeys() |
|
344 | + { |
|
345 | 345 | return array_keys($this->data); |
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
349 | 349 | * @return array |
350 | 350 | */ |
351 | - public function getValues() |
|
352 | - { |
|
351 | + public function getValues() |
|
352 | + { |
|
353 | 353 | return array_values($this->data); |
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
357 | 357 | * @return array |
358 | 358 | */ |
359 | - public function toArray() |
|
360 | - { |
|
359 | + public function toArray() |
|
360 | + { |
|
361 | 361 | return $this->data; |
362 | 362 | } |
363 | 363 | |
@@ -368,8 +368,8 @@ discard block |
||
368 | 368 | * @param mixed $initial |
369 | 369 | * @return mixed |
370 | 370 | */ |
371 | - public function reduce(Closure $callback, $initial = null) |
|
372 | - { |
|
371 | + public function reduce(Closure $callback, $initial = null) |
|
372 | + { |
|
373 | 373 | return array_reduce($this->data, $callback, $initial); |
374 | 374 | } |
375 | 375 | |
@@ -379,9 +379,9 @@ discard block |
||
379 | 379 | * @param string $key |
380 | 380 | * @return mixed |
381 | 381 | */ |
382 | - public function max($key) |
|
383 | - { |
|
384 | - return $this->reduce(function ($result, $item) use ($key) { |
|
382 | + public function max($key) |
|
383 | + { |
|
384 | + return $this->reduce(function ($result, $item) use ($key) { |
|
385 | 385 | return (is_null($result) || $item[$key] > $result) ? $item[$key] : $result; |
386 | 386 | }); |
387 | 387 | } |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | * @param string $key |
393 | 393 | * @return mixed |
394 | 394 | */ |
395 | - public function min($key) |
|
396 | - { |
|
397 | - return $this->reduce(function ($result, $item) use ($key) { |
|
395 | + public function min($key) |
|
396 | + { |
|
397 | + return $this->reduce(function ($result, $item) use ($key) { |
|
398 | 398 | return (is_null($result) || $item[$key] < $result) ? $item[$key] : $result; |
399 | 399 | }); |
400 | 400 | } |
@@ -405,8 +405,8 @@ discard block |
||
405 | 405 | * @param Closure $callback |
406 | 406 | * @return $this |
407 | 407 | */ |
408 | - public function sort(Closure $callback) |
|
409 | - { |
|
408 | + public function sort(Closure $callback) |
|
409 | + { |
|
410 | 410 | uasort($this->data, $callback); |
411 | 411 | |
412 | 412 | return $this; |
@@ -416,8 +416,8 @@ discard block |
||
416 | 416 | * @param Closure $callback |
417 | 417 | * @return $this |
418 | 418 | */ |
419 | - public function ksort(Closure $callback) |
|
420 | - { |
|
419 | + public function ksort(Closure $callback) |
|
420 | + { |
|
421 | 421 | uksort($this->data, $callback); |
422 | 422 | |
423 | 423 | return $this; |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | /** |
427 | 427 | * @return $this |
428 | 428 | */ |
429 | - public function reindex() |
|
430 | - { |
|
429 | + public function reindex() |
|
430 | + { |
|
431 | 431 | $this->data = array_values($this->data); |
432 | 432 | |
433 | 433 | return $this; |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | * |
439 | 439 | * @return static |
440 | 440 | */ |
441 | - public function unique() |
|
442 | - { |
|
441 | + public function unique() |
|
442 | + { |
|
443 | 443 | return $this->create(array_unique($this->data)); |
444 | 444 | } |
445 | 445 | |
@@ -448,8 +448,8 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @return static |
450 | 450 | */ |
451 | - public function reverse() |
|
452 | - { |
|
451 | + public function reverse() |
|
452 | + { |
|
453 | 453 | return $this->create(array_reverse($this->data)); |
454 | 454 | } |
455 | 455 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | $userClass = APIHelpers::getkey($params, 'userClass', 'modUsers'); |
8 | 8 | $DLUsers = \DLUsers\Actions::getInstance($modx, $lang, $userClass); |
9 | 9 | $out = ''; |
10 | -if (!empty($action) && method_exists($DLUsers, $action)) { |
|
10 | +if ( ! empty($action) && method_exists($DLUsers, $action)) { |
|
11 | 11 | $out = call_user_func_array(array($DLUsers, $action), array($params)); |
12 | 12 | } |
13 | 13 |
@@ -7,7 +7,7 @@ |
||
7 | 7 | $userClass = APIHelpers::getkey($params, 'userClass', 'modUsers'); |
8 | 8 | $DLUsers = \DLUsers\Actions::getInstance($modx, $lang, $userClass); |
9 | 9 | $out = ''; |
10 | -if (!empty($action) && method_exists($DLUsers, $action)) { |
|
10 | +if (!empty($action) && method_exists($DLUsers, $action)) { |
|
11 | 11 | $out = call_user_func_array(array($DLUsers, $action), array($params)); |
12 | 12 | } |
13 | 13 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('MODX_BASE_PATH')) die('What are you doing? Get out of here!'); |
|
2 | +if ( ! defined('MODX_BASE_PATH')) die('What are you doing? Get out of here!'); |
|
3 | 3 | |
4 | 4 | $_lang = array( |
5 | 5 | 'error' => array( |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('MODX_BASE_PATH')) die('What are you doing? Get out of here!'); |
|
2 | +if (!defined('MODX_BASE_PATH')) { |
|
3 | + die('What are you doing? Get out of here!'); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | $_lang = array( |
5 | 7 | 'error' => array( |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | /** |
5 | 5 | * Class DLCollection |
6 | 6 | */ |
7 | -class DLCollection extends \Helpers\Collection |
|
8 | -{ |
|
7 | +class DLCollection extends \Helpers\Collection |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * Объект DocumentParser - основной класс MODX |
11 | 11 | * @var \DocumentParser |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | * @param array $modx |
19 | 19 | * @param mixed $data |
20 | 20 | */ |
21 | - public function __construct($modx, $data = array()) |
|
22 | - { |
|
21 | + public function __construct($modx, $data = array()) |
|
22 | + { |
|
23 | 23 | $this->modx = $modx; |
24 | - switch (true) { |
|
24 | + switch (true) { |
|
25 | 25 | case is_resource($data): |
26 | 26 | case (is_object($data) && $data instanceof \mysqli_result): |
27 | 27 | $this->fromQuery($data, false); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $this->data = $data; |
31 | 31 | break; |
32 | 32 | case (is_object($data) && $data instanceof \IteratorAggregate): |
33 | - foreach ($data as $key => $item) { |
|
33 | + foreach ($data as $key => $item) { |
|
34 | 34 | $this->add($item, $key); |
35 | 35 | } |
36 | 36 | break; |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | * @param bool $exec |
45 | 45 | * @return int |
46 | 46 | */ |
47 | - public function fromQuery($q, $exec = true) |
|
48 | - { |
|
47 | + public function fromQuery($q, $exec = true) |
|
48 | + { |
|
49 | 49 | $i = 0; |
50 | - if ($exec) { |
|
50 | + if ($exec) { |
|
51 | 51 | $q = $this->modx->db->query($q); |
52 | 52 | } |
53 | - while ($row = $this->modx->db->getRow($q)) { |
|
53 | + while ($row = $this->modx->db->getRow($q)) { |
|
54 | 54 | $data = $this->create($row); |
55 | 55 | $this->add($data); |
56 | 56 | $i++; |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * @param array $data |
64 | 64 | * @return static |
65 | 65 | */ |
66 | - public function create(array $data = array()) |
|
67 | - { |
|
66 | + public function create(array $data = array()) |
|
67 | + { |
|
68 | 68 | return new static($this->modx, $data); |
69 | 69 | } |
70 | 70 | } |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | /** |
4 | 4 | * Class xNop |
5 | 5 | */ |
6 | -class xNop |
|
7 | -{ |
|
6 | +class xNop |
|
7 | +{ |
|
8 | 8 | /** |
9 | 9 | * Magic call |
10 | 10 | * |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | * @param mixed $args |
13 | 13 | * @return null |
14 | 14 | */ |
15 | - public function __call($method, $args) |
|
16 | - { |
|
15 | + public function __call($method, $args) |
|
16 | + { |
|
17 | 17 | return null; |
18 | 18 | } |
19 | 19 | |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | * @param mixed $args |
25 | 25 | * @return null |
26 | 26 | */ |
27 | - public static function __callStatic($method, $args) |
|
28 | - { |
|
27 | + public static function __callStatic($method, $args) |
|
28 | + { |
|
29 | 29 | return null; |
30 | 30 | } |
31 | 31 | |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | * @param mixed $value |
37 | 37 | * @return null |
38 | 38 | */ |
39 | - public function __set($key, $value) |
|
40 | - { |
|
39 | + public function __set($key, $value) |
|
40 | + { |
|
41 | 41 | return null; |
42 | 42 | } |
43 | 43 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return string |
48 | 48 | */ |
49 | - public function __toString() |
|
50 | - { |
|
49 | + public function __toString() |
|
50 | + { |
|
51 | 51 | return ''; |
52 | 52 | } |
53 | 53 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('MODX_BASE_PATH')) die('HACK???'); |
|
2 | +if ( ! defined('MODX_BASE_PATH')) die('HACK???'); |
|
3 | 3 | |
4 | 4 | $ID = $modx->documentObject['id']; |
5 | 5 | $params = is_array($modx->Event->params) ? $modx->Event->params : array(); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $children = is_array($children) ? $children : array(); |
15 | 15 | $self = $prev = $next = null; |
16 | 16 | foreach ($children as $key => $data) { |
17 | - if (!empty($self)) { |
|
17 | + if ( ! empty($self)) { |
|
18 | 18 | $next = $key; |
19 | 19 | break; |
20 | 20 | } |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('MODX_BASE_PATH')) die('HACK???'); |
|
2 | +if (!defined('MODX_BASE_PATH')) { |
|
3 | + die('HACK???'); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | $ID = $modx->documentObject['id']; |
5 | 7 | $params = is_array($modx->Event->params) ? $modx->Event->params : array(); |
@@ -13,27 +15,27 @@ discard block |
||
13 | 15 | $children = jsonHelper::jsonDecode($json, array('assoc' => true)); |
14 | 16 | $children = is_array($children) ? $children : array(); |
15 | 17 | $self = $prev = $next = null; |
16 | -foreach ($children as $key => $data) { |
|
17 | - if (!empty($self)) { |
|
18 | +foreach ($children as $key => $data) { |
|
19 | + if (!empty($self)) { |
|
18 | 20 | $next = $key; |
19 | 21 | break; |
20 | 22 | } |
21 | - if ($key == $ID) { |
|
23 | + if ($key == $ID) { |
|
22 | 24 | $self = $key; |
23 | - if (empty($prev)) { |
|
25 | + if (empty($prev)) { |
|
24 | 26 | $prev = end($children); |
25 | 27 | $prev = $prev['id']; |
26 | 28 | } |
27 | - } else { |
|
29 | + } else { |
|
28 | 30 | $prev = $key; |
29 | 31 | } |
30 | 32 | } |
31 | -if (empty($next)) { |
|
33 | +if (empty($next)) { |
|
32 | 34 | reset($children); |
33 | 35 | $next = current($children); |
34 | 36 | $next = $next['id']; |
35 | 37 | } |
36 | -if ($next == $prev) { |
|
38 | +if ($next == $prev) { |
|
37 | 39 | $next = ''; |
38 | 40 | } |
39 | 41 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('MODX_BASE_PATH')) die('What are you doing? Get out of here!'); |
|
2 | +if ( ! defined('MODX_BASE_PATH')) die('What are you doing? Get out of here!'); |
|
3 | 3 | |
4 | 4 | setlocale(LC_ALL, 'ja_JP.UTF-8'); |
5 | 5 |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('MODX_BASE_PATH')) die('What are you doing? Get out of here!'); |
|
2 | +if (!defined('MODX_BASE_PATH')) { |
|
3 | + die('What are you doing? Get out of here!'); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | setlocale(LC_ALL, 'ja_JP.UTF-8'); |
5 | 7 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('MODX_BASE_PATH')) die('What are you doing? Get out of here!'); |
|
2 | +if ( ! defined('MODX_BASE_PATH')) die('What are you doing? Get out of here!'); |
|
3 | 3 | |
4 | 4 | $_lang = array(); |
5 | 5 | $_lang['hello'] = 'こんにちは'; |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('MODX_BASE_PATH')) die('What are you doing? Get out of here!'); |
|
2 | +if (!defined('MODX_BASE_PATH')) { |
|
3 | + die('What are you doing? Get out of here!'); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | $_lang = array(); |
5 | 7 | $_lang['hello'] = 'こんにちは'; |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('MODX_BASE_PATH')) die('What are you doing? Get out of here!'); |
|
2 | +if ( ! defined('MODX_BASE_PATH')) die('What are you doing? Get out of here!'); |
|
3 | 3 | |
4 | 4 | $_lang = array( |
5 | 5 | /** Именительный падеж */ |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('MODX_BASE_PATH')) die('What are you doing? Get out of here!'); |
|
2 | +if (!defined('MODX_BASE_PATH')) { |
|
3 | + die('What are you doing? Get out of here!'); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | $_lang = array( |
5 | 7 | /** Именительный падеж */ |