@@ -28,7 +28,8 @@ |
||
28 | 28 | } |
29 | 29 | if (!file_exists($absolutePath)) { |
30 | 30 | return ''; |
31 | - } else { |
|
31 | + } |
|
32 | + else { |
|
32 | 33 | $options = []; |
33 | 34 | if ($resize) { |
34 | 35 | $resize = explode('x', $resize); |
@@ -65,7 +65,8 @@ |
||
65 | 65 | $val = @self::$server->get($name . serialize($params)); |
66 | 66 | if ($val !== false) { |
67 | 67 | return $val; |
68 | - } else { |
|
68 | + } |
|
69 | + else { |
|
69 | 70 | if (is_callable($callback, true)) { |
70 | 71 | $val = $callback($params); |
71 | 72 | self::set($name, $params, $val); |
@@ -105,7 +105,8 @@ |
||
105 | 105 | $moduleClassName = $this->findModuleClass($className); |
106 | 106 | if (!is_bool($moduleClassName) && $moduleClassName != $className) { |
107 | 107 | return $this->_objects[$moduleClassName][$paramsStr] = $this->_objects[$className][$paramsStr] = $this->getObject($moduleClassName); |
108 | - } elseif (Module::installed($className, $this) && class_exists($className)) { |
|
108 | + } |
|
109 | + elseif (Module::installed($className, $this) && class_exists($className)) { |
|
109 | 110 | $this->_objects[$className][$paramsStr] = new $className($this); |
110 | 111 | } |
111 | 112 | if (isset($this->_objects[$className][$paramsStr])) { |
@@ -19,9 +19,11 @@ discard block |
||
19 | 19 | public function __construct() { |
20 | 20 | if (!empty($_SERVER['REQUEST_TIME_FLOAT'])) { |
21 | 21 | $this->startTime = $_SERVER['REQUEST_TIME_FLOAT']; |
22 | - } elseif (!empty($_SERVER['REQUEST_TIME'])) { |
|
22 | + } |
|
23 | + elseif (!empty($_SERVER['REQUEST_TIME'])) { |
|
23 | 24 | $this->startTime = $_SERVER['REQUEST_TIME']; |
24 | - } else { |
|
25 | + } |
|
26 | + else { |
|
25 | 27 | $this->startTime = time(); |
26 | 28 | } |
27 | 29 | $this->log[] = array('name' => 'System init', 'start' => $this->startTime, 'end' => microtime(true)); |
@@ -39,7 +41,8 @@ discard block |
||
39 | 41 | if ($this->run) { |
40 | 42 | if ($key === false) { |
41 | 43 | $this->log[$this->lastLog]['end'] = microtime(true); |
42 | - } else { |
|
44 | + } |
|
45 | + else { |
|
43 | 46 | $this->log[$key]['end'] = microtime(true); |
44 | 47 | } |
45 | 48 | } |
@@ -70,11 +73,14 @@ discard block |
||
70 | 73 | foreach ($this->log as $log) { |
71 | 74 | if (!empty($log['status'])) { |
72 | 75 | echo "<tr class = '{$log['status']}'><td>{$log['name']}</td><td>{$log['status']}</td></tr>"; |
73 | - } else { |
|
74 | - if (empty($log['end'])) |
|
75 | - $log['end'] = microtime(true); |
|
76 | - if (empty($log['start'])) |
|
77 | - $log['start'] = microtime(true); |
|
76 | + } |
|
77 | + else { |
|
78 | + if (empty($log['end'])) { |
|
79 | + $log['end'] = microtime(true); |
|
80 | + } |
|
81 | + if (empty($log['start'])) { |
|
82 | + $log['start'] = microtime(true); |
|
83 | + } |
|
78 | 84 | echo "<tr><td>{$log['name']}</td><td" . (round(($log['end'] - $log['start']), 5) > 0.1 ? ' class ="danger"' : '') . ">" . round(($log['end'] - $log['start']), 5) . "</td></tr>"; |
79 | 85 | } |
80 | 86 | } |
@@ -84,12 +90,15 @@ discard block |
||
84 | 90 | |
85 | 91 | public function convertSize($size) { |
86 | 92 | |
87 | - if ($size < 1024) |
|
88 | - return $size . "B"; |
|
89 | - elseif ($size < 1048576) |
|
90 | - return round($size / 1024, 2) . "KB"; |
|
91 | - else |
|
92 | - return round($size / 1048576, 2) . "MB"; |
|
93 | + if ($size < 1024) { |
|
94 | + return $size . "B"; |
|
95 | + } |
|
96 | + elseif ($size < 1048576) { |
|
97 | + return round($size / 1024, 2) . "KB"; |
|
98 | + } |
|
99 | + else { |
|
100 | + return round($size / 1048576, 2) . "MB"; |
|
101 | + } |
|
93 | 102 | } |
94 | 103 | |
95 | 104 | public function __destruct() { |
@@ -68,7 +68,8 @@ |
||
68 | 68 | include_once 'composer/vendor/autoload.php'; |
69 | 69 | if ($needOutput) { |
70 | 70 | $output = new Symfony\Component\Console\Output\StreamOutput(fopen('php://output', 'w')); |
71 | - } else { |
|
71 | + } |
|
72 | + else { |
|
72 | 73 | $output = null; |
73 | 74 | } |
74 | 75 | $path = str_replace('\\', '/', $path === null ? App::$primary->path . '/' : $path); |
@@ -49,7 +49,8 @@ discard block |
||
49 | 49 | case 'method': |
50 | 50 | if (!empty($colInfo['colParams']['params'])) { |
51 | 51 | $values = call_user_func_array([App::$cur->$colInfo['colParams']['module'], $colInfo['colParams']['method']], $colInfo['colParams']['params']); |
52 | - } else { |
|
52 | + } |
|
53 | + else { |
|
53 | 54 | $values = $colInfo['colParams']['module']->$colInfo['colParams']['method'](); |
54 | 55 | } |
55 | 56 | return !empty($values[$this->model->{$this->valueKey}]) ? $values[$this->model->{$this->valueKey}] : 'Не задано'; |
@@ -63,7 +64,8 @@ discard block |
||
63 | 64 | $file = Files\File::get($this->model->{$this->valueKey}); |
64 | 65 | if ($file) { |
65 | 66 | return '<img src="' . $file->path . '?resize=60x120" />'; |
66 | - } else { |
|
67 | + } |
|
68 | + else { |
|
67 | 69 | return '<img src="/static/system/images/no-image.png?resize=60x120" />'; |
68 | 70 | } |
69 | 71 | case 'bool': |
@@ -26,7 +26,8 @@ discard block |
||
26 | 26 | $html .=" {$key} = '"; |
27 | 27 | if (!is_array($value)) { |
28 | 28 | $html .= addcslashes($value, "'"); |
29 | - } else { |
|
29 | + } |
|
30 | + else { |
|
30 | 31 | $html .= json_encode($value); |
31 | 32 | } |
32 | 33 | $html .= "'"; |
@@ -34,9 +35,11 @@ discard block |
||
34 | 35 | } |
35 | 36 | if ($noCloseTag === null) { |
36 | 37 | $html .= ' />'; |
37 | - } elseif ($noCloseTag === false) { |
|
38 | + } |
|
39 | + elseif ($noCloseTag === false) { |
|
38 | 40 | $html .= ">{$body}</{$tag}>"; |
39 | - } else { |
|
41 | + } |
|
42 | + else { |
|
40 | 43 | $html .= ">{$body}"; |
41 | 44 | } |
42 | 45 | return $html; |
@@ -45,8 +45,9 @@ discard block |
||
45 | 45 | return self::$_configs['custom'][$path]; |
46 | 46 | } |
47 | 47 | |
48 | - if (!file_exists($path)) |
|
49 | - return []; |
|
48 | + if (!file_exists($path)) { |
|
49 | + return []; |
|
50 | + } |
|
50 | 51 | |
51 | 52 | return self::$_configs['custom'][$path] = include $path; |
52 | 53 | } |
@@ -85,7 +86,8 @@ discard block |
||
85 | 86 | return self::$_configs['shareModules'][$module]; |
86 | 87 | } |
87 | 88 | $path = INJI_PROGRAM_DIR . "/config/modules/{$module}.php"; |
88 | - } else { |
|
89 | + } |
|
90 | + else { |
|
89 | 91 | if (isset(self::$_configs['share'])) { |
90 | 92 | return self::$_configs['share']; |
91 | 93 | } |
@@ -94,14 +96,16 @@ discard block |
||
94 | 96 | if (!file_exists($path)) { |
95 | 97 | if (file_exists(INJI_SYSTEM_DIR . "/modules/{$module}/defaultConfig.php")) { |
96 | 98 | $path = INJI_SYSTEM_DIR . "/modules/{$module}/defaultConfig.php"; |
97 | - } else { |
|
99 | + } |
|
100 | + else { |
|
98 | 101 | return []; |
99 | 102 | } |
100 | 103 | } |
101 | 104 | |
102 | 105 | if ($module) { |
103 | 106 | return self::$_configs['shareModules'][$module] = include $path; |
104 | - } else { |
|
107 | + } |
|
108 | + else { |
|
105 | 109 | return self::$_configs['share'] = include $path; |
106 | 110 | } |
107 | 111 | } |
@@ -122,7 +126,8 @@ discard block |
||
122 | 126 | if ($system) { |
123 | 127 | $appName = 'system'; |
124 | 128 | $appPath = INJI_SYSTEM_DIR; |
125 | - } else { |
|
129 | + } |
|
130 | + else { |
|
126 | 131 | $appName = $app->name; |
127 | 132 | $appPath = $app->path; |
128 | 133 | } |
@@ -176,7 +181,8 @@ discard block |
||
176 | 181 | $path = INJI_PROGRAM_DIR . "/config/modules/{$module}.php"; |
177 | 182 | self::$_configs['shareModules'][$module] = $data; |
178 | 183 | Inji::$inst->event('Config-change-shareModules-' . $module, $data); |
179 | - } else { |
|
184 | + } |
|
185 | + else { |
|
180 | 186 | $path = INJI_PROGRAM_DIR . "/config/config.php"; |
181 | 187 | self::$_configs['share'] = $data; |
182 | 188 | Inji::$inst->event('Config-change-share', $data); |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | foreach ($params as $key => $param) { |
42 | 42 | if ($param != '') { |
43 | 43 | $params[$key] = urldecode($param); |
44 | - } else { |
|
44 | + } |
|
45 | + else { |
|
45 | 46 | unset($params[$key]); |
46 | 47 | } |
47 | 48 | } |
@@ -55,8 +56,9 @@ discard block |
||
55 | 56 | * @return boolean |
56 | 57 | */ |
57 | 58 | public static function createDir($path) { |
58 | - if (file_exists($path)) |
|
59 | - return true; |
|
59 | + if (file_exists($path)) { |
|
60 | + return true; |
|
61 | + } |
|
60 | 62 | |
61 | 63 | $path = explode('/', $path); |
62 | 64 | $cur = ''; |
@@ -100,10 +102,12 @@ discard block |
||
100 | 102 | return false; |
101 | 103 | } |
102 | 104 | |
103 | - if ($img_width / $max_width > $img_height / $max_height) |
|
104 | - $separator = $img_width / $max_width; |
|
105 | - else |
|
106 | - $separator = $img_height / $max_height; |
|
105 | + if ($img_width / $max_width > $img_height / $max_height) { |
|
106 | + $separator = $img_width / $max_width; |
|
107 | + } |
|
108 | + else { |
|
109 | + $separator = $img_height / $max_height; |
|
110 | + } |
|
107 | 111 | |
108 | 112 | if ($crop === true || $crop == 'q') { |
109 | 113 | if ($img_width > $img_height) { |
@@ -112,7 +116,8 @@ discard block |
||
112 | 116 | $img_width = $img_height; |
113 | 117 | $new_width = $max_width; |
114 | 118 | $new_height = $max_height; |
115 | - } else { |
|
119 | + } |
|
120 | + else { |
|
116 | 121 | $imgX = 0; |
117 | 122 | $imgY = floor(( $img_height - $img_width ) / 2); |
118 | 123 | $img_height = $img_width; |
@@ -122,7 +127,8 @@ discard block |
||
122 | 127 | if ($pos == 'top') { |
123 | 128 | $imgY = 0; |
124 | 129 | } |
125 | - } elseif ($crop == 'c') { |
|
130 | + } |
|
131 | + elseif ($crop == 'c') { |
|
126 | 132 | //Вычисляем некий коэффициент масштабирования |
127 | 133 | $k1 = $img_width / $max_width; |
128 | 134 | $k2 = $img_height / $max_height; |
@@ -138,10 +144,12 @@ discard block |
||
138 | 144 | $imgX = (int) (($ow / 2) - ($img_width / 2) ); |
139 | 145 | if ($pos == 'center') { |
140 | 146 | $imgY = (int) (($oh / 2) - ($img_height / 2)); |
141 | - } else { |
|
147 | + } |
|
148 | + else { |
|
142 | 149 | $imgY = 0; |
143 | 150 | } |
144 | - } else { |
|
151 | + } |
|
152 | + else { |
|
145 | 153 | $imgX = 0; |
146 | 154 | $imgY = 0; |
147 | 155 | $new_width = floor($img_width / $separator); |
@@ -156,7 +164,8 @@ discard block |
||
156 | 164 | if ($img_type == 'jpeg') { |
157 | 165 | imageinterlace($new_res, 1); // чересстрочное формирование изображение |
158 | 166 | imagejpeg($new_res, $img_path, 85); |
159 | - } else { |
|
167 | + } |
|
168 | + else { |
|
160 | 169 | $imageX = "image{$img_type}"; |
161 | 170 | $imageX($new_res, $img_path); |
162 | 171 | } |
@@ -207,7 +216,8 @@ discard block |
||
207 | 216 | } |
208 | 217 | if (!headers_sent()) { |
209 | 218 | header("Location: {$href}"); |
210 | - } else { |
|
219 | + } |
|
220 | + else { |
|
211 | 221 | echo '\'"><script>window.location="' . $href . '";</script>'; |
212 | 222 | } |
213 | 223 | exit("Перенаправление на: <a href = '{$href}'>{$href}</a>"); |
@@ -224,7 +234,8 @@ discard block |
||
224 | 234 | $number = $number % 100; |
225 | 235 | if ($number >= 11 && $number <= 19) { |
226 | 236 | $ending = $endingArray[2]; |
227 | - } else { |
|
237 | + } |
|
238 | + else { |
|
228 | 239 | $i = $number % 10; |
229 | 240 | switch ($i) { |
230 | 241 | case (1): $ending = $endingArray[0]; |
@@ -366,7 +377,8 @@ discard block |
||
366 | 377 | } |
367 | 378 | if (is_dir($from . '/' . $file)) { |
368 | 379 | self::copyFiles($from . '/' . $file, $to . '/' . $file); |
369 | - } else { |
|
380 | + } |
|
381 | + else { |
|
370 | 382 | copy($from . '/' . $file, $to . '/' . $file); |
371 | 383 | } |
372 | 384 | } |