@@ -15,6 +15,9 @@ discard block |
||
15 | 15 | { |
16 | 16 | public $xml = null; |
17 | 17 | |
18 | + /** |
|
19 | + * @param \SimpleXMLElement $xml |
|
20 | + */ |
|
18 | 21 | function __construct($xml) |
19 | 22 | { |
20 | 23 | $this->xml = $xml; |
@@ -79,6 +82,9 @@ discard block |
||
79 | 82 | } |
80 | 83 | } |
81 | 84 | |
85 | + /** |
|
86 | + * @param \Model $cart |
|
87 | + */ |
|
82 | 88 | function updateCartItems($cart, $items) |
83 | 89 | { |
84 | 90 | $itemIds = []; |
@@ -133,7 +133,7 @@ |
||
133 | 133 | foreach ($cart->cartItems as $cartItem) { |
134 | 134 | $isset = false; |
135 | 135 | foreach ($cItems as $key => $cItem) { |
136 | - if (!($cItem['item_id'] == $cartItem->item_id )) { |
|
136 | + if (!($cItem['item_id'] == $cartItem->item_id)) { |
|
137 | 137 | continue; |
138 | 138 | } |
139 | 139 | $isset = true; |
@@ -45,6 +45,10 @@ |
||
45 | 45 | return $modelCols; |
46 | 46 | } |
47 | 47 | |
48 | + /** |
|
49 | + * @param string $colPrefix |
|
50 | + * @param string $tableName |
|
51 | + */ |
|
48 | 52 | function parseColsForTable($cols, $colPrefix, $tableName) |
49 | 53 | { |
50 | 54 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | function parseColsForModel($cols = []) |
27 | 27 | { |
28 | - $modelCols = [ 'labels' => [], 'cols' => [], 'relations' => []]; |
|
28 | + $modelCols = ['labels' => [], 'cols' => [], 'relations' => []]; |
|
29 | 29 | foreach ($cols as $col) { |
30 | 30 | $modelCols['labels'][$col['code']] = $col['label']; |
31 | 31 | $colType = !empty($col['type']['primary']) ? $col['type']['primary'] : $col['type']; |
@@ -280,7 +280,7 @@ |
||
280 | 280 | /** |
281 | 281 | * Draw error message |
282 | 282 | * |
283 | - * @param text $errorText |
|
283 | + * @param string $errorText |
|
284 | 284 | */ |
285 | 285 | function drawError($errorText) |
286 | 286 | { |
@@ -73,7 +73,7 @@ |
||
73 | 73 | $this->model->_params[$modelName::index()] = 0; |
74 | 74 | } |
75 | 75 | $relOptions['model']::fixPrefix($relOptions['col']); |
76 | - $inputs[$col] = new ActiveForm(new $relOptions['model']([ $relOptions['col'] => &$this->model->_params[$modelName::index()]]), $colPath[2]); |
|
76 | + $inputs[$col] = new ActiveForm(new $relOptions['model']([$relOptions['col'] => &$this->model->_params[$modelName::index()]]), $colPath[2]); |
|
77 | 77 | } |
78 | 78 | $inputs[$col]->parent = $this; |
79 | 79 | } elseif (!empty($modelName::$cols[$col])) { |
@@ -83,6 +83,9 @@ |
||
83 | 83 | return null; |
84 | 84 | } |
85 | 85 | |
86 | + /** |
|
87 | + * @return string |
|
88 | + */ |
|
86 | 89 | function colName() |
87 | 90 | { |
88 | 91 | return "{$this->activeForm->requestFormName}[{$this->activeForm->modelName}][{$this->colName}]"; |
@@ -319,6 +319,9 @@ discard block |
||
319 | 319 | return $rows; |
320 | 320 | } |
321 | 321 | |
322 | + /** |
|
323 | + * @param DataManager $dataManager |
|
324 | + */ |
|
322 | 325 | static function drawCol($item, $colName, $params = [], $dataManager = null, $originalCol = '', $originalItem = null) |
323 | 326 | { |
324 | 327 | $modelName = get_class($item); |
@@ -668,7 +671,7 @@ discard block |
||
668 | 671 | /** |
669 | 672 | * Draw error message |
670 | 673 | * |
671 | - * @param text $errorText |
|
674 | + * @param string $errorText |
|
672 | 675 | */ |
673 | 676 | function drawError($errorText) |
674 | 677 | { |
@@ -608,22 +608,22 @@ |
||
608 | 608 | ?> |
609 | 609 | <ul class="nav nav-list-categorys" data-col='tree_path'> |
610 | 610 | <?php |
611 | - $categoryModel = $this->managerOptions['categorys']['model']; |
|
612 | - $order = []; |
|
613 | - if (!empty($this->managerOptions['sortMode'])) { |
|
614 | - $order[] = ['weight', 'asc']; |
|
615 | - } |
|
616 | - $categorys = $categoryModel::getList(['order' => $order]); |
|
617 | - echo "<li> |
|
611 | + $categoryModel = $this->managerOptions['categorys']['model']; |
|
612 | + $order = []; |
|
613 | + if (!empty($this->managerOptions['sortMode'])) { |
|
614 | + $order[] = ['weight', 'asc']; |
|
615 | + } |
|
616 | + $categorys = $categoryModel::getList(['order' => $order]); |
|
617 | + echo "<li> |
|
618 | 618 | <label class='nav-header'> |
619 | 619 | <a href='#' onclick='inji.Ui.dataManagers.get(this).switchCategory(this);return false;' data-path ='/'>/</a> |
620 | 620 | </label> |
621 | 621 | </li>"; |
622 | - foreach ($categorys as $category) { |
|
623 | - if ($category->parent_id == 0) |
|
624 | - $this->showCategory($categorys, $category); |
|
625 | - } |
|
626 | - ?> |
|
622 | + foreach ($categorys as $category) { |
|
623 | + if ($category->parent_id == 0) |
|
624 | + $this->showCategory($categorys, $category); |
|
625 | + } |
|
626 | + ?> |
|
627 | 627 | </ul> |
628 | 628 | <?php |
629 | 629 | } |
@@ -397,7 +397,7 @@ |
||
397 | 397 | return $item->$colName; |
398 | 398 | } |
399 | 399 | } elseif (!empty($modelName::$cols[$colName]['type'])) { |
400 | - if (\App::$cur->name == 'admin' && $originalCol == 'name' || ( $dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) { |
|
400 | + if (\App::$cur->name == 'admin' && $originalCol == 'name' || ($dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) { |
|
401 | 401 | $formName = $dataManager && !empty($dataManager->managerOptions['editForm']) ? $dataManager->managerOptions['editForm'] : 'manager'; |
402 | 402 | $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem)); |
403 | 403 | return "<a href ='/admin/" . str_replace('\\', '/view/', get_class($originalItem)) . "/{$originalItem->id}?formName={$formName}&redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
@@ -620,8 +620,9 @@ |
||
620 | 620 | </label> |
621 | 621 | </li>"; |
622 | 622 | foreach ($categorys as $category) { |
623 | - if ($category->parent_id == 0) |
|
624 | - $this->showCategory($categorys, $category); |
|
623 | + if ($category->parent_id == 0) { |
|
624 | + $this->showCategory($categorys, $category); |
|
625 | + } |
|
625 | 626 | } |
626 | 627 | ?> |
627 | 628 | </ul> |
@@ -45,6 +45,10 @@ |
||
45 | 45 | \App::$cur->view->widget('Ui\\' . $this->options['widgetsDir'] . '/begin', $params); |
46 | 46 | } |
47 | 47 | |
48 | + /** |
|
49 | + * @param string $type |
|
50 | + * @param string $name |
|
51 | + */ |
|
48 | 52 | function input($type, $name, $label = '', $options = []) |
49 | 53 | { |
50 | 54 | switch ($type) { |
@@ -23,6 +23,9 @@ |
||
23 | 23 | public $attributes = []; |
24 | 24 | public $indexCol = null; |
25 | 25 | |
26 | + /** |
|
27 | + * @param string[] $cols |
|
28 | + */ |
|
26 | 29 | function setCols($cols) |
27 | 30 | { |
28 | 31 | $this->cols = $cols; |
@@ -92,6 +92,9 @@ discard block |
||
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | + /** |
|
96 | + * @param string $user_mail |
|
97 | + */ |
|
95 | 98 | function passre($user_mail) |
96 | 99 | { |
97 | 100 | $user = $this->get($user_mail, 'mail'); |
@@ -312,6 +315,9 @@ discard block |
||
312 | 315 | return $user->id; |
313 | 316 | } |
314 | 317 | |
318 | + /** |
|
319 | + * @param string $pass |
|
320 | + */ |
|
315 | 321 | function hashpass($pass) |
316 | 322 | { |
317 | 323 | return password_hash($pass, PASSWORD_DEFAULT); |
@@ -296,7 +296,7 @@ |
||
296 | 296 | $to = $user_mail; |
297 | 297 | $subject = 'Регистрация на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME); |
298 | 298 | $text = 'Вы были зарегистрированы на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME) . '<br />для входа используйте ваш почтовый ящик в качестве логина и пароль: ' . $pass; |
299 | - $text .='<br />'; |
|
299 | + $text .= '<br />'; |
|
300 | 300 | $text .= '<br />'; |
301 | 301 | $text .= 'Для активации вашего аккаунта перейдите по ссылке <a href = "http://' . INJI_DOMAIN_NAME . '/users/activation/' . $user->id . '/' . $user->activation . '">http://' . idn_to_utf8(INJI_DOMAIN_NAME) . '/users/activation/' . $user->id . '/' . $user->activation . '</a>'; |
302 | 302 | Tools::sendMail($from, $to, $subject, $text); |
@@ -189,17 +189,20 @@ |
||
189 | 189 | |
190 | 190 | function get($idn = false, $ltype = 'id') |
191 | 191 | { |
192 | - if (!$idn) |
|
193 | - return false; |
|
192 | + if (!$idn) { |
|
193 | + return false; |
|
194 | + } |
|
194 | 195 | |
195 | - if (is_numeric($idn) && $ltype != 'login') |
|
196 | - $user = Users\User::get($idn, 'id'); |
|
197 | - elseif ($ltype == 'login') |
|
198 | - $user = Users\User::get($idn, 'login'); |
|
199 | - else |
|
200 | - $user = Users\User::get($idn, 'mail'); |
|
201 | - if (!$user) |
|
202 | - return array(); |
|
196 | + if (is_numeric($idn) && $ltype != 'login') { |
|
197 | + $user = Users\User::get($idn, 'id'); |
|
198 | + } elseif ($ltype == 'login') { |
|
199 | + $user = Users\User::get($idn, 'login'); |
|
200 | + } else { |
|
201 | + $user = Users\User::get($idn, 'mail'); |
|
202 | + } |
|
203 | + if (!$user) { |
|
204 | + return array(); |
|
205 | + } |
|
203 | 206 | |
204 | 207 | return $user; |
205 | 208 | } |
@@ -147,6 +147,9 @@ discard block |
||
147 | 147 | return $result[1]; |
148 | 148 | } |
149 | 149 | |
150 | + /** |
|
151 | + * @param string $source |
|
152 | + */ |
|
150 | 153 | function parseSource($source) |
151 | 154 | { |
152 | 155 | $tags = $this->parseRaw($source); |
@@ -190,6 +193,9 @@ discard block |
||
190 | 193 | return substr($source, ( $pos + strlen($rawTag) + 2)); |
191 | 194 | } |
192 | 195 | |
196 | + /** |
|
197 | + * @param string $type |
|
198 | + */ |
|
193 | 199 | function getHref($type, $params) |
194 | 200 | { |
195 | 201 | $href = ''; |
@@ -531,6 +537,9 @@ discard block |
||
531 | 537 | echo round(( microtime(true) - INJI_TIME_START), 4); |
532 | 538 | } |
533 | 539 | |
540 | + /** |
|
541 | + * @param string $type |
|
542 | + */ |
|
534 | 543 | function customAsset($type, $asset, $lib = false) |
535 | 544 | { |
536 | 545 | if (!$lib) { |
@@ -549,6 +558,9 @@ discard block |
||
549 | 558 | } |
550 | 559 | } |
551 | 560 | |
561 | + /** |
|
562 | + * @param string $lineParams |
|
563 | + */ |
|
552 | 564 | function widget($_widgetName, $_params = [], $lineParams = null) |
553 | 565 | { |
554 | 566 | $_paths = $this->getWidgetPaths($_widgetName); |
@@ -187,16 +187,16 @@ discard block |
||
187 | 187 | { |
188 | 188 | $pos = strpos($source, $rawTag) - 1; |
189 | 189 | echo substr($source, 0, $pos); |
190 | - return substr($source, ( $pos + strlen($rawTag) + 2)); |
|
190 | + return substr($source, ($pos + strlen($rawTag) + 2)); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | function getHref($type, $params) |
194 | 194 | { |
195 | 195 | $href = ''; |
196 | 196 | if (is_string($params)) { |
197 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $params; |
|
197 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '') . $params; |
|
198 | 198 | } elseif (empty($params['template']) && !empty($params['file'])) { |
199 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $params['file']; |
|
199 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '') . $params['file']; |
|
200 | 200 | } elseif (!empty($params['template']) && !empty($params['file'])) { |
201 | 201 | $href = $this->app->templatesPath . "/{$this->template->name}/{$type}/{$js['file']}"; |
202 | 202 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | $this->checkNeedLibs(); |
257 | 257 | $this->parseCss(); |
258 | - echo "\n <script src='" . Statics::file(($this->app->type != 'app' ? '/' . $this->app->name : '' ) . "/static/system/js/Inji.js") . "'></script>"; |
|
258 | + echo "\n <script src='" . Statics::file(($this->app->type != 'app' ? '/' . $this->app->name : '') . "/static/system/js/Inji.js") . "'></script>"; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | function parseCss() |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | if (file_exists($path)) { |
280 | 280 | $this->loadedCss[$href] = $href; |
281 | 281 | $urls[$href] = $path; |
282 | - $timeStr.=filemtime($path); |
|
282 | + $timeStr .= filemtime($path); |
|
283 | 283 | } else { |
284 | 284 | echo "\n <link href='{$href}' rel='stylesheet' type='text/css' />"; |
285 | 285 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | if (strpos($css, '//') !== false) |
331 | 331 | $href = $css; |
332 | 332 | else |
333 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
333 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '') . $css; |
|
334 | 334 | $hrefs[$href] = $href; |
335 | 335 | } |
336 | 336 | break; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | if (strpos($css, '//') !== false) |
357 | 357 | $href = $css; |
358 | 358 | else |
359 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
359 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '') . $css; |
|
360 | 360 | $hrefs[$href] = $href; |
361 | 361 | } |
362 | 362 | break; |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | if (file_exists($path)) { |
418 | 418 | $nativeUrl[$script] = $script; |
419 | 419 | $urls[$script] = $path; |
420 | - $timeStr.=filemtime($path); |
|
420 | + $timeStr .= filemtime($path); |
|
421 | 421 | } else { |
422 | 422 | $noParsedScripts[$script] = $script; |
423 | 423 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | if (!empty($script['name'])) { |
433 | 433 | $onLoadModules[$script['name']] = $script['name']; |
434 | 434 | } |
435 | - $timeStr.=filemtime($path); |
|
435 | + $timeStr .= filemtime($path); |
|
436 | 436 | } else { |
437 | 437 | $noParsedScripts[$script] = $script; |
438 | 438 | } |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | function timegen() |
529 | 529 | { |
530 | 530 | $this->current_function = 'TIMEGEN'; |
531 | - echo round(( microtime(true) - INJI_TIME_START), 4); |
|
531 | + echo round((microtime(true) - INJI_TIME_START), 4); |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | function customAsset($type, $asset, $lib = false) |
@@ -140,8 +140,9 @@ discard block |
||
140 | 140 | |
141 | 141 | private function parseRaw($source) |
142 | 142 | { |
143 | - if (!$source) |
|
144 | - return array(); |
|
143 | + if (!$source) { |
|
144 | + return array(); |
|
145 | + } |
|
145 | 146 | |
146 | 147 | preg_match_all("|{([^}]+)}|", $source, $result); |
147 | 148 | return $result[1]; |
@@ -327,10 +328,11 @@ discard block |
||
327 | 328 | $this->ResolveCssHref($css, $type, $hrefs); |
328 | 329 | continue; |
329 | 330 | } |
330 | - if (strpos($css, '//') !== false) |
|
331 | - $href = $css; |
|
332 | - else |
|
333 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
331 | + if (strpos($css, '//') !== false) { |
|
332 | + $href = $css; |
|
333 | + } else { |
|
334 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
335 | + } |
|
334 | 336 | $hrefs[$href] = $href; |
335 | 337 | } |
336 | 338 | break; |
@@ -340,10 +342,11 @@ discard block |
||
340 | 342 | $this->ResolveCssHref($css, $type, $hrefs); |
341 | 343 | continue; |
342 | 344 | } |
343 | - if (strpos($css, '://') !== false) |
|
344 | - $href = $css; |
|
345 | - else |
|
346 | - $href = $this->app->templatesPath . "/{$this->template->name}/css/{$css}"; |
|
345 | + if (strpos($css, '://') !== false) { |
|
346 | + $href = $css; |
|
347 | + } else { |
|
348 | + $href = $this->app->templatesPath . "/{$this->template->name}/css/{$css}"; |
|
349 | + } |
|
347 | 350 | $hrefs[$href] = $href; |
348 | 351 | } |
349 | 352 | break; |
@@ -353,10 +356,11 @@ discard block |
||
353 | 356 | $this->ResolveCssHref($css, $type, $hrefs); |
354 | 357 | continue; |
355 | 358 | } |
356 | - if (strpos($css, '//') !== false) |
|
357 | - $href = $css; |
|
358 | - else |
|
359 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
359 | + if (strpos($css, '//') !== false) { |
|
360 | + $href = $css; |
|
361 | + } else { |
|
362 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
363 | + } |
|
360 | 364 | $hrefs[$href] = $href; |
361 | 365 | } |
362 | 366 | break; |
@@ -410,8 +414,9 @@ discard block |
||
410 | 414 | $noParsedScripts = []; |
411 | 415 | foreach ($scripts as $script) { |
412 | 416 | if (is_string($script)) { |
413 | - if (!empty($urls[$script])) |
|
414 | - continue; |
|
417 | + if (!empty($urls[$script])) { |
|
418 | + continue; |
|
419 | + } |
|
415 | 420 | |
416 | 421 | $path = $this->app->staticLoader->parsePath($script); |
417 | 422 | if (file_exists($path)) { |
@@ -422,8 +427,9 @@ discard block |
||
422 | 427 | $noParsedScripts[$script] = $script; |
423 | 428 | } |
424 | 429 | } elseif (!empty($script['file'])) { |
425 | - if (!empty($urls[$script['file']])) |
|
426 | - continue; |
|
430 | + if (!empty($urls[$script['file']])) { |
|
431 | + continue; |
|
432 | + } |
|
427 | 433 | |
428 | 434 | $path = $this->app->staticLoader->parsePath($script['file']); |
429 | 435 | if (file_exists($path)) { |
@@ -482,12 +488,14 @@ discard block |
||
482 | 488 | $this->genScriptArray($js, $type, $resultArray); |
483 | 489 | continue; |
484 | 490 | } |
485 | - if (strpos($js, '//') !== false) |
|
486 | - $href = $js; |
|
487 | - else |
|
488 | - $href = $this->getHref('js', $js); |
|
489 | - if (!$href) |
|
490 | - continue; |
|
491 | + if (strpos($js, '//') !== false) { |
|
492 | + $href = $js; |
|
493 | + } else { |
|
494 | + $href = $this->getHref('js', $js); |
|
495 | + } |
|
496 | + if (!$href) { |
|
497 | + continue; |
|
498 | + } |
|
491 | 499 | |
492 | 500 | $resultArray[] = $href; |
493 | 501 | } |
@@ -498,10 +506,11 @@ discard block |
||
498 | 506 | $this->genScriptArray($js, $type, $resultArray); |
499 | 507 | continue; |
500 | 508 | } |
501 | - if (strpos($js, '//') !== false) |
|
502 | - $href = $js; |
|
503 | - else |
|
504 | - $href = $this->app->templatesPath . "/{$this->template->name}/js/{$js}"; |
|
509 | + if (strpos($js, '//') !== false) { |
|
510 | + $href = $js; |
|
511 | + } else { |
|
512 | + $href = $this->app->templatesPath . "/{$this->template->name}/js/{$js}"; |
|
513 | + } |
|
505 | 514 | $resultArray[] = $href; |
506 | 515 | } |
507 | 516 | break; |
@@ -517,8 +526,9 @@ discard block |
||
517 | 526 | $asset = []; |
518 | 527 | } |
519 | 528 | $asset['file'] = $this->getHref('js', $js); |
520 | - if (!$asset['file']) |
|
521 | - continue; |
|
529 | + if (!$asset['file']) { |
|
530 | + continue; |
|
531 | + } |
|
522 | 532 | $resultArray[] = $asset; |
523 | 533 | } |
524 | 534 | break; |
@@ -568,8 +578,9 @@ discard block |
||
568 | 578 | $paramArray = true; |
569 | 579 | } |
570 | 580 | } |
571 | - if (!$paramArray) |
|
572 | - $lineParams = ':' . implode(':', $_params); |
|
581 | + if (!$paramArray) { |
|
582 | + $lineParams = ':' . implode(':', $_params); |
|
583 | + } |
|
573 | 584 | } |
574 | 585 | } |
575 | 586 | echo "<!--start:{WIDGET:{$_widgetName}{$lineParams}}-->\n"; |