@@ -125,7 +125,7 @@ |
||
125 | 125 | * @since 5.1.0 |
126 | 126 | */ |
127 | 127 | public function count() { |
128 | - throw new Exception('You should implement ' . get_called_class() . '::count()'); |
|
128 | + throw new Exception('You should implement '.get_called_class().'::count()'); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | } |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | class PropertyHiderInObject extends PropertyHider { |
4 | 4 | private function getPhysicalPropertyName($name) { |
5 | - return '_' . $name; |
|
5 | + return '_'.$name; |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | /** |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | function loadModuleRootConfig() { |
75 | - require SN_ROOT_PHYSICAL . 'config.php'; |
|
75 | + require SN_ROOT_PHYSICAL.'config.php'; |
|
76 | 76 | |
77 | - $module_config_array = get_class($this) . '_config'; |
|
78 | - if(!empty($$module_config_array) && is_array($$module_config_array)) { |
|
77 | + $module_config_array = get_class($this).'_config'; |
|
78 | + if (!empty($$module_config_array) && is_array($$module_config_array)) { |
|
79 | 79 | $this->config = $$module_config_array; |
80 | 80 | |
81 | 81 | return true; |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | |
94 | 94 | // TODO: Load configuration from DB. Manifest setting |
95 | 95 | // Trying to load configuration from file |
96 | - if(!$config_exists = $this->loadModuleRootConfig()) { |
|
96 | + if (!$config_exists = $this->loadModuleRootConfig()) { |
|
97 | 97 | // Конфигурация может лежать в config_path в манифеста или в корне модуля |
98 | - if(isset($this->manifest['config_path']) && file_exists($config_filename = $this->manifest['config_path'] . '/config.php')) { |
|
98 | + if (isset($this->manifest['config_path']) && file_exists($config_filename = $this->manifest['config_path'].'/config.php')) { |
|
99 | 99 | $config_exists = true; |
100 | - } elseif(file_exists($config_filename = dirname($filename) . '/config.php')) { |
|
100 | + } elseif (file_exists($config_filename = dirname($filename).'/config.php')) { |
|
101 | 101 | $config_exists = true; |
102 | 102 | } |
103 | 103 | |
104 | - if($config_exists) { |
|
104 | + if ($config_exists) { |
|
105 | 105 | include($config_filename); |
106 | - $module_config_array = $class_module_name . '_config'; |
|
106 | + $module_config_array = $class_module_name.'_config'; |
|
107 | 107 | $this->config = $$module_config_array; |
108 | 108 | } |
109 | 109 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | // Checking module status - is it installed and active |
120 | 120 | $this->check_status(); |
121 | - if(!$this->manifest['active']) { |
|
121 | + if (!$this->manifest['active']) { |
|
122 | 122 | return; |
123 | 123 | } |
124 | 124 | |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | |
139 | 139 | protected function setSystemConstants() { |
140 | 140 | // Setting constants - if any |
141 | - if(empty($this->manifest['constants']) || !is_array($this->manifest['constants'])) { |
|
141 | + if (empty($this->manifest['constants']) || !is_array($this->manifest['constants'])) { |
|
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | - foreach($this->manifest['constants'] as $constant_name => $constant_value) { |
|
145 | + foreach ($this->manifest['constants'] as $constant_name => $constant_value) { |
|
146 | 146 | !defined($constant_name) ? define($constant_name, $constant_value) : false; |
147 | 147 | } |
148 | 148 | } |
@@ -154,48 +154,48 @@ discard block |
||
154 | 154 | // New values from module variables will overwrite previous values (for root variables) and array elements with corresponding indexes (for arrays) |
155 | 155 | // Constants as array indexes are honored - it's make valid such declarations as 'sn_data[ques][QUE_STRUCTURES]' |
156 | 156 | $this->manifest['vars'] = $this->__assign_vars(); |
157 | - if(empty($this->manifest['vars']) || !is_array($this->manifest['vars'])) { |
|
157 | + if (empty($this->manifest['vars']) || !is_array($this->manifest['vars'])) { |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
161 | 161 | $vars_assigned = array(); |
162 | - foreach($this->manifest['vars'] as $var_name => $var_value) { |
|
162 | + foreach ($this->manifest['vars'] as $var_name => $var_value) { |
|
163 | 163 | $sub_vars = explode('[', str_replace(']', '', $var_name)); |
164 | 164 | $var_name = $sub_vars[0]; |
165 | 165 | |
166 | - if(!isset($vars_assigned[$var_name])) { |
|
166 | + if (!isset($vars_assigned[$var_name])) { |
|
167 | 167 | $vars_assigned[$var_name] = true; |
168 | 168 | global $$var_name; |
169 | 169 | } |
170 | 170 | |
171 | 171 | $pointer = &$$var_name; |
172 | - if(($n = count($sub_vars)) > 1) { |
|
173 | - for($i = 1; $i < $n; $i++) { |
|
174 | - if(defined($sub_vars[$i])) { |
|
172 | + if (($n = count($sub_vars)) > 1) { |
|
173 | + for ($i = 1; $i < $n; $i++) { |
|
174 | + if (defined($sub_vars[$i])) { |
|
175 | 175 | $sub_vars[$i] = constant($sub_vars[$i]); |
176 | 176 | } |
177 | 177 | |
178 | - if(!isset($pointer[$sub_vars[$i]]) && $i != $n) { |
|
178 | + if (!isset($pointer[$sub_vars[$i]]) && $i != $n) { |
|
179 | 179 | $pointer[$sub_vars[$i]] = array(); |
180 | 180 | } |
181 | 181 | $pointer = &$pointer[$sub_vars[$i]]; |
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | - if(!isset($pointer) || !is_array($pointer)) { |
|
185 | + if (!isset($pointer) || !is_array($pointer)) { |
|
186 | 186 | $pointer = $var_value; |
187 | - } elseif(is_array($$var_name)) { |
|
187 | + } elseif (is_array($$var_name)) { |
|
188 | 188 | $pointer = array_merge_recursive_numeric($pointer, $var_value); |
189 | 189 | } |
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
193 | 193 | protected function mergeMenu(&$sn_menu_extra, &$menu_patch) { |
194 | - if(!is_array($menu_patch)) { |
|
194 | + if (!is_array($menu_patch)) { |
|
195 | 195 | return; |
196 | 196 | } |
197 | 197 | |
198 | - foreach($menu_patch as $menu_item_name => $menu_item_data) { |
|
198 | + foreach ($menu_patch as $menu_item_name => $menu_item_data) { |
|
199 | 199 | $sn_menu_extra[$menu_item_name] = $menu_item_data; |
200 | 200 | } |
201 | 201 | } |
@@ -204,34 +204,34 @@ discard block |
||
204 | 204 | // Overriding function if any |
205 | 205 | sn_sys_handler_add(classSupernova::$functions, $this->manifest['functions'], $this); |
206 | 206 | |
207 | - foreach(classSupernova::$sn_mvc as $handler_type => &$handler_data) { |
|
207 | + foreach (classSupernova::$sn_mvc as $handler_type => &$handler_data) { |
|
208 | 208 | sn_sys_handler_add($handler_data, $this->manifest['mvc'][$handler_type], $this, $handler_type); |
209 | 209 | } |
210 | 210 | } |
211 | 211 | |
212 | 212 | protected function mergeNavbarButton() { |
213 | - if(empty($this->manifest['navbar_prefix_button']) || !is_array($this->manifest['navbar_prefix_button'])) { |
|
213 | + if (empty($this->manifest['navbar_prefix_button']) || !is_array($this->manifest['navbar_prefix_button'])) { |
|
214 | 214 | return; |
215 | 215 | } |
216 | 216 | |
217 | - foreach($this->manifest['navbar_prefix_button'] as $button_image => $button_url_relative) { |
|
217 | + foreach ($this->manifest['navbar_prefix_button'] as $button_image => $button_url_relative) { |
|
218 | 218 | classSupernova::$sn_mvc['navbar_prefix_button'][$button_image] = $button_url_relative; |
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | 222 | protected function mergeI18N() { |
223 | 223 | $arrayName = 'i18n'; |
224 | - if(empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) { |
|
224 | + if (empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) { |
|
225 | 225 | return; |
226 | 226 | } |
227 | 227 | |
228 | - foreach($this->manifest[$arrayName] as $pageName => &$contentList) { |
|
229 | - foreach($contentList as &$i18n_file_data) { |
|
230 | - if(is_array($i18n_file_data) && !$i18n_file_data['path']) { |
|
228 | + foreach ($this->manifest[$arrayName] as $pageName => &$contentList) { |
|
229 | + foreach ($contentList as &$i18n_file_data) { |
|
230 | + if (is_array($i18n_file_data) && !$i18n_file_data['path']) { |
|
231 | 231 | $i18n_file_data['path'] = $this->manifest['root_relative']; |
232 | 232 | } |
233 | 233 | } |
234 | - if(!isset(classSupernova::$sn_mvc[$arrayName][$pageName])) { |
|
234 | + if (!isset(classSupernova::$sn_mvc[$arrayName][$pageName])) { |
|
235 | 235 | classSupernova::$sn_mvc[$arrayName][$pageName] = array(); |
236 | 236 | } |
237 | 237 | classSupernova::$sn_mvc[$arrayName][$pageName] += $contentList; |
@@ -239,13 +239,13 @@ discard block |
||
239 | 239 | } |
240 | 240 | |
241 | 241 | protected function mergeArraySpecial($arrayName) { |
242 | - if(empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) { |
|
242 | + if (empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) { |
|
243 | 243 | return; |
244 | 244 | } |
245 | 245 | |
246 | - foreach($this->manifest[$arrayName] as $pageName => &$contentList) { |
|
246 | + foreach ($this->manifest[$arrayName] as $pageName => &$contentList) { |
|
247 | 247 | !isset(classSupernova::$sn_mvc[$arrayName][$pageName]) ? classSupernova::$sn_mvc[$arrayName][$pageName] = array() : false; |
248 | - foreach($contentList as $contentName => &$content) { |
|
248 | + foreach ($contentList as $contentName => &$content) { |
|
249 | 249 | classSupernova::$sn_mvc[$arrayName][$pageName][$contentName] = $content; |
250 | 250 | } |
251 | 251 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | $load_order[$loaded_module_name] = $level; |
300 | 300 | } |
301 | 301 | } |
302 | - } while($prev_order != $load_order); |
|
302 | + } while ($prev_order != $load_order); |
|
303 | 303 | |
304 | 304 | asort($load_order); |
305 | 305 |
@@ -30,6 +30,6 @@ |
||
30 | 30 | |
31 | 31 | |
32 | 32 | public function addPlayerLock($table, $playerIdFieldName) { |
33 | - $this->lock_player[$table . '-' . $playerIdFieldName] = array($table, $playerIdFieldName); |
|
33 | + $this->lock_player[$table.'-'.$playerIdFieldName] = array($table, $playerIdFieldName); |
|
34 | 34 | } |
35 | 35 | } |
@@ -15,13 +15,13 @@ |
||
15 | 15 | * @return string |
16 | 16 | */ |
17 | 17 | public static function quoteComment($comment) { |
18 | - if($comment == '') { |
|
18 | + if ($comment == '') { |
|
19 | 19 | return ''; |
20 | 20 | } |
21 | 21 | |
22 | - $comment = str_replace(array('/*', '*/'), '__',$comment); |
|
22 | + $comment = str_replace(array('/*', '*/'), '__', $comment); |
|
23 | 23 | |
24 | - return "\r\n/*" . $comment . "*/"; |
|
24 | + return "\r\n/*".$comment."*/"; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | } |
@@ -39,19 +39,19 @@ |
||
39 | 39 | |
40 | 40 | @$this->link = mysqli_connect($settings['server'], $settings['user'], $settings['pass'], $settings['name']); |
41 | 41 | if (!is_object($this->link) || $this->link->connect_error) { |
42 | - classSupernova::$debug->error_fatal('DB Error - cannot connect to server error #' . $this->link->connect_errno, $this->link->connect_error); |
|
42 | + classSupernova::$debug->error_fatal('DB Error - cannot connect to server error #'.$this->link->connect_errno, $this->link->connect_error); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
46 | 46 | !$this->mysql_query("/*!40101 SET NAMES 'utf8' */") |
47 | - ? classSupernova::$debug->error_fatal('DB error - cannot set names 1 error #' . $this->link->errno, $this->link->error) |
|
47 | + ? classSupernova::$debug->error_fatal('DB error - cannot set names 1 error #'.$this->link->errno, $this->link->error) |
|
48 | 48 | : false; |
49 | 49 | !$this->mysql_query("SET NAMES 'utf8';") |
50 | - ? classSupernova::$debug->error_fatal('DB error - cannot set names 2 error #' . $this->link->errno, $this->link->error) |
|
50 | + ? classSupernova::$debug->error_fatal('DB error - cannot set names 2 error #'.$this->link->errno, $this->link->error) |
|
51 | 51 | : false; |
52 | 52 | |
53 | - !$this->mysql_query('SET SESSION TRANSACTION ISOLATION LEVEL ' . self::DB_MYSQL_TRANSACTION_REPEATABLE_READ . ';') |
|
54 | - ? classSupernova::$debug->error_fatal('DB error - cannot set desired isolation level error #' . $this->link->errno, $this->link->error) |
|
53 | + !$this->mysql_query('SET SESSION TRANSACTION ISOLATION LEVEL '.self::DB_MYSQL_TRANSACTION_REPEATABLE_READ.';') |
|
54 | + ? classSupernova::$debug->error_fatal('DB error - cannot set desired isolation level error #'.$this->link->errno, $this->link->error) |
|
55 | 55 | : false; |
56 | 56 | |
57 | 57 | $this->connected = true; |
@@ -38,7 +38,7 @@ |
||
38 | 38 | if ($que_type == QUE_RESEARCH || $planet_id === null) { |
39 | 39 | $query[] = "`que_planet_id` IS NULL"; |
40 | 40 | } elseif ($planet_id) { |
41 | - $query[] = "(`que_planet_id` = {$planet_id}" . ($que_type ? '' : ' OR que_planet_id IS NULL') . ")"; |
|
41 | + $query[] = "(`que_planet_id` = {$planet_id}".($que_type ? '' : ' OR que_planet_id IS NULL').")"; |
|
42 | 42 | } |
43 | 43 | if ($que_type) { |
44 | 44 | $query[] = "`que_type` = {$que_type}"; |
@@ -239,7 +239,7 @@ |
||
239 | 239 | |
240 | 240 | $factory = $this->values[$id]; |
241 | 241 | |
242 | - $extended = function ($c) use ($callable, $factory) { |
|
242 | + $extended = function($c) use ($callable, $factory) { |
|
243 | 243 | return $callable($factory($c), $c); |
244 | 244 | }; |
245 | 245 |
@@ -154,15 +154,15 @@ discard block |
||
154 | 154 | * @param string $group_name |
155 | 155 | */ |
156 | 156 | public static function _init($group_name = '') { |
157 | - if(static::$_is_static_init) { |
|
157 | + if (static::$_is_static_init) { |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
161 | - if($group_name) { |
|
161 | + if ($group_name) { |
|
162 | 162 | static::$_sn_group_name = $group_name; |
163 | 163 | } |
164 | 164 | |
165 | - if(static::$_sn_group_name) { |
|
165 | + if (static::$_sn_group_name) { |
|
166 | 166 | static::$_group_unit_id_list = sn_get_groups(static::$_sn_group_name); |
167 | 167 | empty(static::$_group_unit_id_list) ? static::$_group_unit_id_list = array() : false; |
168 | 168 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | // TODO - Reset combat stats?? |
188 | 188 | $this->_unitId = $unitId; |
189 | 189 | |
190 | - if($this->_unitId) { |
|
190 | + if ($this->_unitId) { |
|
191 | 191 | $this->info = get_unit_param($this->_unitId); |
192 | 192 | $this->_type = $this->info[P_UNIT_TYPE]; |
193 | 193 | } else { |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | protected function setCount($value) { |
200 | 200 | // TODO - Reset combat stats?? |
201 | - if($value < 0) { |
|
201 | + if ($value < 0) { |
|
202 | 202 | classSupernova::$debug->error('Can not set Unit::$count to negative value'); |
203 | 203 | } |
204 | 204 | $this->_count = $value; |