@@ -71,8 +71,8 @@ |
||
71 | 71 | { |
72 | 72 | $paths = Module::getModulePaths($moduleName); |
73 | 73 | foreach ($paths as $path) { |
74 | - if (file_exists($path . '/' . $moduleName . '.php')) { |
|
75 | - include_once $path . '/' . $moduleName . '.php'; |
|
74 | + if (file_exists($path.'/'.$moduleName.'.php')) { |
|
75 | + include_once $path.'/'.$moduleName.'.php'; |
|
76 | 76 | return $moduleName; |
77 | 77 | } |
78 | 78 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $relModel = $relations[$colInfo['colParams']['relation']]['model']; |
212 | 212 | $relModel = strpos($relModel, '\\') === 0 ? substr($relModel, 1) : $relModel; |
213 | 213 | if ($manageHref) { |
214 | - $value = $relValue ? "<a href='/admin/" . str_replace('\\', '/view/', $relModel) . "/" . $relValue->pk() . "'>" . $relValue->name() . "</a>" : 'Не задано'; |
|
214 | + $value = $relValue ? "<a href='/admin/".str_replace('\\', '/view/', $relModel)."/".$relValue->pk()."'>".$relValue->name()."</a>" : 'Не задано'; |
|
215 | 215 | } else { |
216 | 216 | $value = $relValue ? $relValue->name() : 'Не задано'; |
217 | 217 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | case 'image': |
222 | 222 | $file = Files\File::get($item->$colName); |
223 | 223 | if ($file) { |
224 | - $value = '<img src="' . $file->path . '?resize=60x120" />'; |
|
224 | + $value = '<img src="'.$file->path.'?resize=60x120" />'; |
|
225 | 225 | } else { |
226 | 226 | $value = '<img src="/static/system/images/no-image.png?resize=60x120" />'; |
227 | 227 | } |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | return; |
260 | 260 | } |
261 | 261 | if (!is_array($array)) { |
262 | - if (!isset($cols[static::colPrefix() . $array]) && isset(static::$cols[$array])) { |
|
262 | + if (!isset($cols[static::colPrefix().$array]) && isset(static::$cols[$array])) { |
|
263 | 263 | static::createCol($array); |
264 | 264 | $cols = static::cols(true); |
265 | 265 | } |
266 | - if (!isset($cols[$array]) && isset($cols[static::colPrefix() . $array])) { |
|
267 | - $array = static::colPrefix() . $array; |
|
266 | + if (!isset($cols[$array]) && isset($cols[static::colPrefix().$array])) { |
|
267 | + $array = static::colPrefix().$array; |
|
268 | 268 | } else { |
269 | 269 | static::checkForJoin($array, $rootModel); |
270 | 270 | } |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | switch ($searchtype) { |
274 | 274 | case 'key': |
275 | 275 | foreach ($array as $key => $item) { |
276 | - if (!isset($cols[static::colPrefix() . $key]) && isset(static::$cols[$key])) { |
|
276 | + if (!isset($cols[static::colPrefix().$key]) && isset(static::$cols[$key])) { |
|
277 | 277 | static::createCol($key); |
278 | 278 | $cols = static::cols(true); |
279 | 279 | } |
280 | - if (!isset($cols[$key]) && isset($cols[static::colPrefix() . $key])) { |
|
281 | - $array[static::colPrefix() . $key] = $item; |
|
280 | + if (!isset($cols[$key]) && isset($cols[static::colPrefix().$key])) { |
|
281 | + $array[static::colPrefix().$key] = $item; |
|
282 | 282 | unset($array[$key]); |
283 | - $key = static::colPrefix() . $key; |
|
283 | + $key = static::colPrefix().$key; |
|
284 | 284 | } |
285 | 285 | if (is_array($array[$key])) { |
286 | 286 | static::fixPrefix($array[$key], 'key', $rootModel); |
@@ -291,12 +291,12 @@ discard block |
||
291 | 291 | break; |
292 | 292 | case 'first': |
293 | 293 | if (isset($array[0]) && is_string($array[0])) { |
294 | - if (!isset($cols[static::colPrefix() . $array[0]]) && isset(static::$cols[$array[0]])) { |
|
294 | + if (!isset($cols[static::colPrefix().$array[0]]) && isset(static::$cols[$array[0]])) { |
|
295 | 295 | static::createCol($array[0]); |
296 | 296 | $cols = static::cols(true); |
297 | 297 | } |
298 | - if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix() . $array[0]])) { |
|
299 | - $array[0] = static::colPrefix() . $array[0]; |
|
298 | + if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix().$array[0]])) { |
|
299 | + $array[0] = static::colPrefix().$array[0]; |
|
300 | 300 | } else { |
301 | 301 | static::checkForJoin($array[0], $rootModel); |
302 | 302 | } |
@@ -329,13 +329,13 @@ discard block |
||
329 | 329 | case 'to': |
330 | 330 | $relCol = $relations[$rel]['col']; |
331 | 331 | static::fixPrefix($relCol); |
332 | - $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol]; |
|
332 | + $rootModel::$relJoins[$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol]; |
|
333 | 333 | break; |
334 | 334 | case 'one': |
335 | 335 | case 'many': |
336 | 336 | $relCol = $relations[$rel]['col']; |
337 | 337 | $relations[$rel]['model']::fixPrefix($relCol); |
338 | - $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol]; |
|
338 | + $rootModel::$relJoins[$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), static::index().' = '.$relCol]; |
|
339 | 339 | break; |
340 | 340 | } |
341 | 341 | $relations[$rel]['model']::fixPrefix($col, 'key', $rootModel); |
@@ -376,13 +376,13 @@ discard block |
||
376 | 376 | $relCol = $relations[$rel]['col']; |
377 | 377 | static::fixPrefix($relCol); |
378 | 378 | //$info['modelName'] = $relations[$rel]['model']; |
379 | - $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol]; |
|
379 | + $info['joins'][$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol]; |
|
380 | 380 | break; |
381 | 381 | case 'one': |
382 | 382 | $relCol = $relations[$rel]['col']; |
383 | 383 | $relations[$rel]['model']::fixPrefix($relCol); |
384 | 384 | //$info['modelName'] = $relations[$rel]['model']; |
385 | - $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol]; |
|
385 | + $info['joins'][$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), static::index().' = '.$relCol]; |
|
386 | 386 | break; |
387 | 387 | } |
388 | 388 | $info = $relations[$rel]['model']::parseColRecursion($info); |
@@ -400,8 +400,8 @@ discard block |
||
400 | 400 | } else { |
401 | 401 | $info['colParams'] = []; |
402 | 402 | } |
403 | - if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix() . $info['col']])) { |
|
404 | - $info['col'] = static::colPrefix() . $info['col']; |
|
403 | + if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix().$info['col']])) { |
|
404 | + $info['col'] = static::colPrefix().$info['col']; |
|
405 | 405 | } |
406 | 406 | $info['modelName'] = get_called_class(); |
407 | 407 | } |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | if ($params === false) { |
508 | 508 | return false; |
509 | 509 | } |
510 | - return App::$cur->db->addCol(static::table(), static::colPrefix() . $colName, $params); |
|
510 | + return App::$cur->db->addCol(static::table(), static::colPrefix().$colName, $params); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | public static function createTable() |
@@ -537,28 +537,28 @@ discard block |
||
537 | 537 | return true; |
538 | 538 | } |
539 | 539 | $cols = [ |
540 | - $colPrefix . 'id' => 'pk' |
|
540 | + $colPrefix.'id' => 'pk' |
|
541 | 541 | ]; |
542 | 542 | $className = get_called_class(); |
543 | 543 | if (!empty($className::$cols)) { |
544 | 544 | foreach ($className::$cols as $colName => $colParams) { |
545 | 545 | if ($colName == 'date_create') { |
546 | - $cols[$colPrefix . 'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
546 | + $cols[$colPrefix.'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
547 | 547 | continue; |
548 | 548 | } |
549 | 549 | $params = $className::genColParams($colName); |
550 | 550 | if ($params) { |
551 | - $cols[$colPrefix . $colName] = $params; |
|
551 | + $cols[$colPrefix.$colName] = $params; |
|
552 | 552 | } |
553 | 553 | } |
554 | 554 | } |
555 | - if (empty($cols[$colPrefix . 'date_create'])) { |
|
556 | - $cols[$colPrefix . 'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
555 | + if (empty($cols[$colPrefix.'date_create'])) { |
|
556 | + $cols[$colPrefix.'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
557 | 557 | } |
558 | 558 | $tableIndexes = []; |
559 | 559 | if ($indexes) { |
560 | 560 | foreach ($indexes as $indexName => $index) { |
561 | - $tableIndexes[] = $index['type'] . ' ' . App::$cur->db->table_prefix . $indexName . ' (' . implode(',', $index['cols']) . ')'; |
|
561 | + $tableIndexes[] = $index['type'].' '.App::$cur->db->table_prefix.$indexName.' ('.implode(',', $index['cols']).')'; |
|
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | public static function index() |
585 | 585 | { |
586 | 586 | |
587 | - return static::colPrefix() . 'id'; |
|
587 | + return static::colPrefix().'id'; |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | /** |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | { |
597 | 597 | $classPath = explode('\\', get_called_class()); |
598 | 598 | $classPath = array_slice($classPath, 1); |
599 | - return strtolower(implode('_', $classPath)) . '_'; |
|
599 | + return strtolower(implode('_', $classPath)).'_'; |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | /** |
@@ -661,12 +661,12 @@ discard block |
||
661 | 661 | case 'to': |
662 | 662 | $relCol = $relations[$rel]['col']; |
663 | 663 | static::fixPrefix($relCol); |
664 | - App::$cur->db->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
|
664 | + App::$cur->db->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol); |
|
665 | 665 | break; |
666 | 666 | case 'one': |
667 | 667 | $col = $relations[$rel]['col']; |
668 | 668 | $relations[$rel]['model']::fixPrefix($col); |
669 | - App::$cur->db->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
|
669 | + App::$cur->db->join($relations[$rel]['model']::table(), static::index().' = '.$col); |
|
670 | 670 | break; |
671 | 671 | } |
672 | 672 | } |
@@ -681,8 +681,8 @@ discard block |
||
681 | 681 | } |
682 | 682 | if ($param !== null) { |
683 | 683 | $cols = static::cols(); |
684 | - if (!isset($cols[$col]) && isset($cols[static::colPrefix() . $col])) { |
|
685 | - $col = static::colPrefix() . $col; |
|
684 | + if (!isset($cols[$col]) && isset($cols[static::colPrefix().$col])) { |
|
685 | + $col = static::colPrefix().$col; |
|
686 | 686 | } |
687 | 687 | App::$cur->db->where($col, $param); |
688 | 688 | } else { |
@@ -742,12 +742,12 @@ discard block |
||
742 | 742 | case 'to': |
743 | 743 | $relCol = $relations[$rel]['col']; |
744 | 744 | static::fixPrefix($relCol); |
745 | - $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
|
745 | + $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol); |
|
746 | 746 | break; |
747 | 747 | case 'one': |
748 | 748 | $col = $relations[$rel]['col']; |
749 | 749 | $relations[$rel]['model']::fixPrefix($col); |
750 | - $query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
|
750 | + $query->join($relations[$rel]['model']::table(), static::index().' = '.$col); |
|
751 | 751 | break; |
752 | 752 | } |
753 | 753 | } |
@@ -1063,12 +1063,12 @@ discard block |
||
1063 | 1063 | case 'to': |
1064 | 1064 | $relCol = $relations[$rel]['col']; |
1065 | 1065 | static::fixPrefix($relCol); |
1066 | - $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
|
1066 | + $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol); |
|
1067 | 1067 | break; |
1068 | 1068 | case 'one': |
1069 | 1069 | $col = $relations[$rel]['col']; |
1070 | 1070 | $relations[$rel]['model']::fixPrefix($col); |
1071 | - $query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
|
1071 | + $query->join($relations[$rel]['model']::table(), static::index().' = '.$col); |
|
1072 | 1072 | break; |
1073 | 1073 | } |
1074 | 1074 | } |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | } else { |
1086 | 1086 | $cols .= '*'; |
1087 | 1087 | } |
1088 | - $cols .=') as `count`' . (!empty($options['cols']) ? ',' . $options['cols'] : ''); |
|
1088 | + $cols .= ') as `count`'.(!empty($options['cols']) ? ','.$options['cols'] : ''); |
|
1089 | 1089 | $query->cols = $cols; |
1090 | 1090 | if (!empty($options['group'])) { |
1091 | 1091 | $query->group($options['group']); |
@@ -1223,25 +1223,25 @@ discard block |
||
1223 | 1223 | $itemModel = $class::$treeCategory; |
1224 | 1224 | $oldPath = $this->tree_path; |
1225 | 1225 | $this->tree_path = $this->getCatalogTree($this); |
1226 | - $itemsTable = \App::$cur->db->table_prefix . $itemModel::table(); |
|
1227 | - $itemTreeCol = $itemModel::colPrefix() . 'tree_path'; |
|
1226 | + $itemsTable = \App::$cur->db->table_prefix.$itemModel::table(); |
|
1227 | + $itemTreeCol = $itemModel::colPrefix().'tree_path'; |
|
1228 | 1228 | |
1229 | - $categoryTreeCol = $this->colPrefix() . 'tree_path'; |
|
1230 | - $categoryTable = \App::$cur->db->table_prefix . $this->table(); |
|
1229 | + $categoryTreeCol = $this->colPrefix().'tree_path'; |
|
1230 | + $categoryTable = \App::$cur->db->table_prefix.$this->table(); |
|
1231 | 1231 | if ($oldPath) { |
1232 | 1232 | \App::$cur->db->query('UPDATE |
1233 | - ' . $categoryTable . ' |
|
1233 | + ' . $categoryTable.' |
|
1234 | 1234 | SET |
1235 | - ' . $categoryTreeCol . ' = REPLACE(' . $categoryTreeCol . ', "' . $oldPath . $this->id . '/' . '", "' . $this->tree_path . $this->id . '/' . '") |
|
1236 | - WHERE ' . $categoryTreeCol . ' LIKE "' . $oldPath . $this->id . '/' . '%"'); |
|
1235 | + ' . $categoryTreeCol.' = REPLACE('.$categoryTreeCol.', "'.$oldPath.$this->id.'/'.'", "'.$this->tree_path.$this->id.'/'.'") |
|
1236 | + WHERE ' . $categoryTreeCol.' LIKE "'.$oldPath.$this->id.'/'.'%"'); |
|
1237 | 1237 | |
1238 | 1238 | \App::$cur->db->query('UPDATE |
1239 | - ' . $itemsTable . ' |
|
1239 | + ' . $itemsTable.' |
|
1240 | 1240 | SET |
1241 | - ' . $itemTreeCol . ' = REPLACE(' . $itemTreeCol . ', "' . $oldPath . $this->id . '/' . '", "' . $this->tree_path . $this->id . '/' . '") |
|
1242 | - WHERE ' . $itemTreeCol . ' LIKE "' . $oldPath . $this->id . '/' . '%"'); |
|
1241 | + ' . $itemTreeCol.' = REPLACE('.$itemTreeCol.', "'.$oldPath.$this->id.'/'.'", "'.$this->tree_path.$this->id.'/'.'") |
|
1242 | + WHERE ' . $itemTreeCol.' LIKE "'.$oldPath.$this->id.'/'.'%"'); |
|
1243 | 1243 | } |
1244 | - $itemModel::update([$itemTreeCol => $this->tree_path . $this->id . '/'], [$itemModel::colPrefix() . $this->index(), $this->id]); |
|
1244 | + $itemModel::update([$itemTreeCol => $this->tree_path.$this->id.'/'], [$itemModel::colPrefix().$this->index(), $this->id]); |
|
1245 | 1245 | } |
1246 | 1246 | |
1247 | 1247 | /** |
@@ -1256,9 +1256,9 @@ discard block |
||
1256 | 1256 | $catalogParent = $catalogClass::get($catalog->parent_id); |
1257 | 1257 | if ($catalog && $catalogParent) { |
1258 | 1258 | if ($catalogParent->tree_path) { |
1259 | - return $catalogParent->tree_path . $catalogParent->id . '/'; |
|
1259 | + return $catalogParent->tree_path.$catalogParent->id.'/'; |
|
1260 | 1260 | } else { |
1261 | - return $this->getCatalogTree($catalogParent) . $catalogParent->id . '/'; |
|
1261 | + return $this->getCatalogTree($catalogParent).$catalogParent->id.'/'; |
|
1262 | 1262 | } |
1263 | 1263 | } |
1264 | 1264 | return '/'; |
@@ -1273,7 +1273,7 @@ discard block |
||
1273 | 1273 | $categoryModel = $class::$categoryModel; |
1274 | 1274 | $category = $categoryModel::get($this->{$categoryModel::index()}); |
1275 | 1275 | if ($category) { |
1276 | - $this->tree_path = $category->tree_path . $category->pk() . '/'; |
|
1276 | + $this->tree_path = $category->tree_path.$category->pk().'/'; |
|
1277 | 1277 | } else { |
1278 | 1278 | $this->tree_path = '/'; |
1279 | 1279 | } |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | $this->changeCategoryTree(); |
1300 | 1300 | } |
1301 | 1301 | if (!empty($this->_changedParams) && $this->pk()) { |
1302 | - Inji::$inst->event('modelItemParamsChanged-' . get_called_class(), $this); |
|
1302 | + Inji::$inst->event('modelItemParamsChanged-'.get_called_class(), $this); |
|
1303 | 1303 | } |
1304 | 1304 | $this->beforeSave(); |
1305 | 1305 | |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | } |
1338 | 1338 | $this->_params = $result->fetch(); |
1339 | 1339 | if ($new) { |
1340 | - Inji::$inst->event('modelCreatedItem-' . get_called_class(), $this); |
|
1340 | + Inji::$inst->event('modelCreatedItem-'.get_called_class(), $this); |
|
1341 | 1341 | } |
1342 | 1342 | $this->afterSave(); |
1343 | 1343 | return $this->{$this->index()}; |
@@ -1483,7 +1483,7 @@ discard block |
||
1483 | 1483 | static::fixPrefix($params); |
1484 | 1484 | $className = get_called_class(); |
1485 | 1485 | foreach ($params as $paramName => $value) { |
1486 | - $shortName = preg_replace('!' . $this->colPrefix() . '!', '', $paramName); |
|
1486 | + $shortName = preg_replace('!'.$this->colPrefix().'!', '', $paramName); |
|
1487 | 1487 | if (!empty($className::$cols[$shortName])) { |
1488 | 1488 | switch ($className::$cols[$shortName]['type']) { |
1489 | 1489 | case 'decimal': |
@@ -1763,7 +1763,7 @@ discard block |
||
1763 | 1763 | { |
1764 | 1764 | static::fixPrefix($name); |
1765 | 1765 | $className = get_called_class(); |
1766 | - $shortName = preg_replace('!' . $this->colPrefix() . '!', '', $name); |
|
1766 | + $shortName = preg_replace('!'.$this->colPrefix().'!', '', $name); |
|
1767 | 1767 | if (!empty($className::$cols[$shortName])) { |
1768 | 1768 | switch ($className::$cols[$shortName]['type']) { |
1769 | 1769 | case 'decimal': |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public static function uriParse($uri) |
39 | 39 | { |
40 | 40 | $answerPos = strpos($uri, '?'); |
41 | - $params = array_slice(explode('/', substr($uri, 0, $answerPos ? $answerPos : strlen($uri) )), 1); |
|
41 | + $params = array_slice(explode('/', substr($uri, 0, $answerPos ? $answerPos : strlen($uri))), 1); |
|
42 | 42 | |
43 | 43 | foreach ($params as $key => $param) { |
44 | 44 | if ($param != '') { |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $path = explode('/', $path); |
65 | 65 | $cur = ''; |
66 | 66 | foreach ($path as $item) { |
67 | - $cur .= $item . '/'; |
|
67 | + $cur .= $item.'/'; |
|
68 | 68 | if (!file_exists($cur)) { |
69 | 69 | mkdir($cur); |
70 | 70 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | public static function resizeImage($img_path, $max_width = 1000, $max_height = 1000, $crop = false, $pos = 'center') |
86 | 86 | { |
87 | 87 | ini_set("gd.jpeg_ignore_warning", 1); |
88 | - list( $img_width, $img_height, $img_type, $img_tag ) = getimagesize($img_path); |
|
88 | + list($img_width, $img_height, $img_type, $img_tag) = getimagesize($img_path); |
|
89 | 89 | switch ($img_type) { |
90 | 90 | case 1: |
91 | 91 | $img_type = 'gif'; |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | |
109 | 109 | if ($crop === true || $crop == 'q') { |
110 | 110 | if ($img_width > $img_height) { |
111 | - $imgX = floor(( $img_width - $img_height ) / 2); |
|
111 | + $imgX = floor(($img_width - $img_height) / 2); |
|
112 | 112 | $imgY = 0; |
113 | 113 | $img_width = $img_height; |
114 | 114 | $new_width = $max_width; |
115 | 115 | $new_height = $max_height; |
116 | 116 | } else { |
117 | 117 | $imgX = 0; |
118 | - $imgY = floor(( $img_height - $img_width ) / 2); |
|
118 | + $imgY = floor(($img_height - $img_width) / 2); |
|
119 | 119 | $img_height = $img_width; |
120 | 120 | $new_width = $max_width; |
121 | 121 | $new_height = $max_height; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $new_width = $max_width; |
137 | 137 | $new_height = $max_height; |
138 | 138 | //Находим начальные координаты (центрируем новое изображение) |
139 | - $imgX = (int) (($ow / 2) - ($img_width / 2) ); |
|
139 | + $imgX = (int) (($ow / 2) - ($img_width / 2)); |
|
140 | 140 | if ($pos == 'center') { |
141 | 141 | $imgY = (int) (($oh / 2) - ($img_height / 2)); |
142 | 142 | } else { |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | if (!headers_sent()) { |
207 | 207 | header("Location: {$href}"); |
208 | 208 | } else { |
209 | - echo '\'"><script>window.location="' . $href . '";</script>'; |
|
209 | + echo '\'"><script>window.location="'.$href.'";</script>'; |
|
210 | 210 | } |
211 | 211 | exit("Перенаправление на: <a href = '{$href}'>{$href}</a>"); |
212 | 212 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $pathArray = $cleanPathArray; |
267 | 267 | $cleanPathArray = []; |
268 | 268 | } while ($changes); |
269 | - return (strpos($path, '/') === 0 ? '/' : '') . implode('/', $pathArray); |
|
269 | + return (strpos($path, '/') === 0 ? '/' : '').implode('/', $pathArray); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | if (empty($month[$mm - 1])) { |
288 | 288 | return 'Не указано'; |
289 | 289 | } |
290 | - return ($dd > 0 ? $dd . " " : '') . $month[$mm - 1] . " " . $yy . " " . $hours; |
|
290 | + return ($dd > 0 ? $dd." " : '').$month[$mm - 1]." ".$yy." ".$hours; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -369,10 +369,10 @@ discard block |
||
369 | 369 | if (in_array($file, ['.', '..'])) { |
370 | 370 | continue; |
371 | 371 | } |
372 | - if (is_dir($from . '/' . $file)) { |
|
373 | - self::copyFiles($from . '/' . $file, $to . '/' . $file); |
|
372 | + if (is_dir($from.'/'.$file)) { |
|
373 | + self::copyFiles($from.'/'.$file, $to.'/'.$file); |
|
374 | 374 | } else { |
375 | - copy($from . '/' . $file, $to . '/' . $file); |
|
375 | + copy($from.'/'.$file, $to.'/'.$file); |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | } |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | return self::$_configs['system']; |
29 | 29 | } |
30 | 30 | |
31 | - if (!file_exists(INJI_SYSTEM_DIR . '/config/config.php')) { |
|
31 | + if (!file_exists(INJI_SYSTEM_DIR.'/config/config.php')) { |
|
32 | 32 | return []; |
33 | 33 | } |
34 | 34 | |
35 | - return self::$_configs['system'] = include INJI_SYSTEM_DIR . '/config/config.php'; |
|
35 | + return self::$_configs['system'] = include INJI_SYSTEM_DIR.'/config/config.php'; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | return self::$_configs['app'][$app->name]; |
69 | 69 | } |
70 | 70 | |
71 | - $path = $app->path . "/config/config.php"; |
|
71 | + $path = $app->path."/config/config.php"; |
|
72 | 72 | if (!file_exists($path)) { |
73 | 73 | return []; |
74 | 74 | } |
@@ -88,16 +88,16 @@ discard block |
||
88 | 88 | if (isset(self::$_configs['shareModules'][$module])) { |
89 | 89 | return self::$_configs['shareModules'][$module]; |
90 | 90 | } |
91 | - $path = INJI_PROGRAM_DIR . "/config/modules/{$module}.php"; |
|
91 | + $path = INJI_PROGRAM_DIR."/config/modules/{$module}.php"; |
|
92 | 92 | } else { |
93 | 93 | if (isset(self::$_configs['share'])) { |
94 | 94 | return self::$_configs['share']; |
95 | 95 | } |
96 | - $path = INJI_PROGRAM_DIR . "/config/config.php"; |
|
96 | + $path = INJI_PROGRAM_DIR."/config/config.php"; |
|
97 | 97 | } |
98 | 98 | if (!file_exists($path)) { |
99 | - if (file_exists(INJI_SYSTEM_DIR . "/modules/{$module}/defaultConfig.php")) { |
|
100 | - $path = INJI_SYSTEM_DIR . "/modules/{$module}/defaultConfig.php"; |
|
99 | + if (file_exists(INJI_SYSTEM_DIR."/modules/{$module}/defaultConfig.php")) { |
|
100 | + $path = INJI_SYSTEM_DIR."/modules/{$module}/defaultConfig.php"; |
|
101 | 101 | } else { |
102 | 102 | return []; |
103 | 103 | } |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | return self::$_configs['module'][$appName][$module_name]; |
137 | 137 | } |
138 | 138 | |
139 | - $path = $appPath . "/config/modules/{$module_name}.php"; |
|
139 | + $path = $appPath."/config/modules/{$module_name}.php"; |
|
140 | 140 | if (!file_exists($path)) { |
141 | - $path = INJI_SYSTEM_DIR . "/modules/{$module_name}/defaultConfig.php"; |
|
141 | + $path = INJI_SYSTEM_DIR."/modules/{$module_name}/defaultConfig.php"; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
@@ -163,27 +163,27 @@ discard block |
||
163 | 163 | } |
164 | 164 | switch ($type) { |
165 | 165 | case 'system': |
166 | - $path = INJI_SYSTEM_DIR . '/config/config.php'; |
|
166 | + $path = INJI_SYSTEM_DIR.'/config/config.php'; |
|
167 | 167 | self::$_configs['system'] = $data; |
168 | 168 | Inji::$inst->event('Config-change-system', $data); |
169 | 169 | break; |
170 | 170 | case 'app': |
171 | - $path = $app->path . "/config/config.php"; |
|
171 | + $path = $app->path."/config/config.php"; |
|
172 | 172 | self::$_configs['app'][$app->name] = $data; |
173 | - Inji::$inst->event('Config-change-app-' . $app->name, $data); |
|
173 | + Inji::$inst->event('Config-change-app-'.$app->name, $data); |
|
174 | 174 | break; |
175 | 175 | case 'module': |
176 | - $path = $app->path . "/config/modules/{$module}.php"; |
|
176 | + $path = $app->path."/config/modules/{$module}.php"; |
|
177 | 177 | self::$_configs['module'][$app->name][$module] = $data; |
178 | - Inji::$inst->event('Config-change-module-' . $app->name . '-' . $module, $data); |
|
178 | + Inji::$inst->event('Config-change-module-'.$app->name.'-'.$module, $data); |
|
179 | 179 | break; |
180 | 180 | case 'share': |
181 | 181 | if ($module) { |
182 | - $path = INJI_PROGRAM_DIR . "/config/modules/{$module}.php"; |
|
182 | + $path = INJI_PROGRAM_DIR."/config/modules/{$module}.php"; |
|
183 | 183 | self::$_configs['shareModules'][$module] = $data; |
184 | - Inji::$inst->event('Config-change-shareModules-' . $module, $data); |
|
184 | + Inji::$inst->event('Config-change-shareModules-'.$module, $data); |
|
185 | 185 | } else { |
186 | - $path = INJI_PROGRAM_DIR . "/config/config.php"; |
|
186 | + $path = INJI_PROGRAM_DIR."/config/config.php"; |
|
187 | 187 | self::$_configs['share'] = $data; |
188 | 188 | Inji::$inst->event('Config-change-share', $data); |
189 | 189 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | self::$_configs['custom'][$path] = $data; |
194 | 194 | break; |
195 | 195 | } |
196 | - $text = "<?php\nreturn " . CodeGenerator::genArray($data); |
|
196 | + $text = "<?php\nreturn ".CodeGenerator::genArray($data); |
|
197 | 197 | Tools::createDir(substr($path, 0, strripos($path, '/'))); |
198 | 198 | file_put_contents($path, $text); |
199 | 199 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | if ($type == 'array') { |
19 | 19 | return !is_array($_GET[$key]) ? [] : $_GET[$key]; |
20 | 20 | } |
21 | - return eval('return (' . $type . ') $_GET[$key];'); |
|
21 | + return eval('return ('.$type.') $_GET[$key];'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | $month = array('января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'); |
39 | 39 | $yearPosrfix = isset($options['yearPostfix']) ? $options['yearPostfix'] : " г."; |
40 | - return ($dd > 0 ? $dd . " " : '') . $month[$mm - 1] . " " . $yy . $yearPosrfix . (empty($options['notime']) ? " " . $hours : ''); |
|
40 | + return ($dd > 0 ? $dd." " : '').$month[$mm - 1]." ".$yy.$yearPosrfix.(empty($options['notime']) ? " ".$hours : ''); |
|
41 | 41 | case 'select': |
42 | 42 | switch ($colInfo['colParams']['source']) { |
43 | 43 | case 'model': |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | case 'image': |
65 | 65 | $file = Files\File::get($this->model->{$this->valueKey}); |
66 | 66 | if ($file) { |
67 | - return '<img src="' . $file->path . '?resize=60x120" />'; |
|
67 | + return '<img src="'.$file->path.'?resize=60x120" />'; |
|
68 | 68 | } else { |
69 | 69 | return '<img src="/static/system/images/no-image.png?resize=60x120" />'; |
70 | 70 | } |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | public function listen($eventName, $listenCode, $callback, $save = false) |
50 | 50 | { |
51 | 51 | if ($save) { |
52 | - $config = Config::custom(App::$primary->path . '/config/events.php'); |
|
52 | + $config = Config::custom(App::$primary->path.'/config/events.php'); |
|
53 | 53 | $config[$eventName][$listenCode] = serialize($callback); |
54 | - Config::save(App::$primary->path . '/config/events.php', $config); |
|
54 | + Config::save(App::$primary->path.'/config/events.php', $config); |
|
55 | 55 | } else { |
56 | 56 | $this->_listeners[$eventName][$listenCode] = $callback; |
57 | 57 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | if (!empty($this->_listeners[$eventName])) { |
76 | 76 | $listeners = $this->_listeners[$eventName]; |
77 | 77 | } |
78 | - $config = Config::custom(App::$primary->path . '/config/events.php'); |
|
78 | + $config = Config::custom(App::$primary->path.'/config/events.php'); |
|
79 | 79 | if (!empty($config[$eventName])) { |
80 | 80 | foreach ($config[$eventName] as $listenCode => $callback) { |
81 | 81 | $listeners[$listenCode] = (@unserialize($callback) !== false) ? unserialize($callback) : $callback; |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | public function unlisten($eventName, $listenCode, $save = false) |
111 | 111 | { |
112 | 112 | if ($save) { |
113 | - $config = Config::custom(App::$primary->path . '/config/events.php'); |
|
113 | + $config = Config::custom(App::$primary->path.'/config/events.php'); |
|
114 | 114 | if (!empty($config[$eventName][$listenCode])) { |
115 | 115 | unset($config[$eventName][$listenCode]); |
116 | - Config::save(App::$primary->path . '/config/events.php', $config); |
|
116 | + Config::save(App::$primary->path.'/config/events.php', $config); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | if (!empty($this->_listeners[$eventName][$listenCode])) { |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | { |
21 | 21 | if (!$model) { |
22 | 22 | $modulePath = Module::getModulePath($this->module->moduleName); |
23 | - $path = $modulePath . '/models'; |
|
23 | + $path = $modulePath.'/models'; |
|
24 | 24 | if (file_exists($path)) { |
25 | 25 | $files = array_slice(scandir($path), 2); |
26 | 26 | foreach ($files as $file) { |
27 | - if (is_dir($path . '/' . $file)) { |
|
27 | + if (is_dir($path.'/'.$file)) { |
|
28 | 28 | continue; |
29 | 29 | } |
30 | 30 | $model = pathinfo($file, PATHINFO_FILENAME); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | } |
35 | - $fullModelName = $this->module->moduleName . '\\' . ucfirst($model); |
|
35 | + $fullModelName = $this->module->moduleName.'\\'.ucfirst($model); |
|
36 | 36 | $dataManager = new Ui\DataManager($fullModelName, $dataManager); |
37 | 37 | $title = !empty($dataManager->managerOptions['name']) ? $dataManager->managerOptions['name'] : $fullModelName::objectName(); |
38 | 38 | $this->view->setTitle($title); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | public function viewAction($model, $pk) |
43 | 43 | { |
44 | - $fullModelName = $this->module->moduleName . '\\' . ucfirst($model); |
|
44 | + $fullModelName = $this->module->moduleName.'\\'.ucfirst($model); |
|
45 | 45 | $item = $fullModelName::get($pk); |
46 | 46 | $this->view->setTitle($item->name()); |
47 | 47 | if (!empty($_POST['comment'])) { |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | // time start |
17 | 17 | define('INJI_TIME_START', microtime(true)); |
18 | 18 | // system files dir |
19 | -define('INJI_SYSTEM_DIR', __DIR__ . '/system'); |
|
19 | +define('INJI_SYSTEM_DIR', __DIR__.'/system'); |
|
20 | 20 | // apps files dir |
21 | -define('INJI_PROGRAM_DIR', __DIR__ . '/program'); |
|
21 | +define('INJI_PROGRAM_DIR', __DIR__.'/program'); |
|
22 | 22 | |
23 | 23 | // check base config |
24 | 24 | if (!file_exists(INJI_SYSTEM_DIR) || !is_dir(INJI_SYSTEM_DIR)) { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | -require_once( INJI_SYSTEM_DIR . '/init.php' ); |
|
38 | +require_once(INJI_SYSTEM_DIR.'/init.php'); |
|
39 | 39 | /** |
40 | 40 | * System error messages |
41 | 41 | */ |