Completed
Push — work-fleets ( d6c2ef...5197c7 )
by SuperNova.WS
04:51
created
includes/classes/module.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -239,6 +239,9 @@
 block discarded – undo
239 239
     }
240 240
   }
241 241
 
242
+  /**
243
+   * @param string $arrayName
244
+   */
242 245
   protected function mergeArraySpecial($arrayName) {
243 246
     global $sn_mvc;
244 247
 
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     require SN_ROOT_PHYSICAL . 'config.php';
69 69
 
70 70
     $module_config_array = get_class($this) . '_config';
71
-    if(!empty($$module_config_array) && is_array($$module_config_array)) {
71
+    if (!empty($$module_config_array) && is_array($$module_config_array)) {
72 72
       $this->config = $$module_config_array;
73 73
 
74 74
       return true;
@@ -88,15 +88,15 @@  discard block
 block discarded – undo
88 88
 
89 89
     // TODO: Load configuration from DB. Manifest setting
90 90
     // Trying to load configuration from file
91
-    if(!$config_exists = $this->loadModuleRootConfig()) {
91
+    if (!$config_exists = $this->loadModuleRootConfig()) {
92 92
       // Конфигурация может лежать в config_path в манифеста или в корне модуля
93
-      if(isset($this->manifest['config_path']) && file_exists($config_filename = $this->manifest['config_path'] . '/config.php')) {
93
+      if (isset($this->manifest['config_path']) && file_exists($config_filename = $this->manifest['config_path'] . '/config.php')) {
94 94
         $config_exists = true;
95
-      } elseif(file_exists($config_filename = dirname($filename) . '/config.php')) {
95
+      } elseif (file_exists($config_filename = dirname($filename) . '/config.php')) {
96 96
         $config_exists = true;
97 97
       }
98 98
 
99
-      if($config_exists) {
99
+      if ($config_exists) {
100 100
         include($config_filename);
101 101
         $module_config_array = $class_module_name . '_config';
102 102
         $this->config = $$module_config_array;
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
     // Checking module status - is it installed and active
115 115
     $this->check_status();
116
-    if(!$this->manifest['active']) {
116
+    if (!$this->manifest['active']) {
117 117
       return;
118 118
     }
119 119
 
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 
134 134
   protected function setSystemConstants() {
135 135
     // Setting constants - if any
136
-    if(empty($this->manifest['constants']) || !is_array($this->manifest['constants'])) {
136
+    if (empty($this->manifest['constants']) || !is_array($this->manifest['constants'])) {
137 137
       return;
138 138
     }
139 139
 
140
-    foreach($this->manifest['constants'] as $constant_name => $constant_value) {
140
+    foreach ($this->manifest['constants'] as $constant_name => $constant_value) {
141 141
       defined($constant_name) || define($constant_name, $constant_value);
142 142
     }
143 143
   }
@@ -149,48 +149,48 @@  discard block
 block discarded – undo
149 149
     // New values from module variables will overwrite previous values (for root variables) and array elements with corresponding indexes (for arrays)
150 150
     // Constants as array indexes are honored - it's make valid such declarations as 'sn_data[ques][QUE_STRUCTURES]'
151 151
     $this->manifest['vars'] = $this->__assign_vars();
152
-    if(empty($this->manifest['vars']) || !is_array($this->manifest['vars'])) {
152
+    if (empty($this->manifest['vars']) || !is_array($this->manifest['vars'])) {
153 153
       return;
154 154
     }
155 155
 
156 156
     $vars_assigned = array();
157
-    foreach($this->manifest['vars'] as $var_name => $var_value) {
157
+    foreach ($this->manifest['vars'] as $var_name => $var_value) {
158 158
       $sub_vars = explode('[', str_replace(']', '', $var_name));
159 159
       $var_name = $sub_vars[0];
160 160
 
161
-      if(!isset($vars_assigned[$var_name])) {
161
+      if (!isset($vars_assigned[$var_name])) {
162 162
         $vars_assigned[$var_name] = true;
163 163
         global $$var_name;
164 164
       }
165 165
 
166 166
       $pointer = &$$var_name;
167
-      if(($n = count($sub_vars)) > 1) {
168
-        for($i = 1; $i < $n; $i++) {
169
-          if(defined($sub_vars[$i])) {
167
+      if (($n = count($sub_vars)) > 1) {
168
+        for ($i = 1; $i < $n; $i++) {
169
+          if (defined($sub_vars[$i])) {
170 170
             $sub_vars[$i] = constant($sub_vars[$i]);
171 171
           }
172 172
 
173
-          if(!isset($pointer[$sub_vars[$i]]) && $i != $n) {
173
+          if (!isset($pointer[$sub_vars[$i]]) && $i != $n) {
174 174
             $pointer[$sub_vars[$i]] = array();
175 175
           }
176 176
           $pointer = &$pointer[$sub_vars[$i]];
177 177
         }
178 178
       }
179 179
 
180
-      if(!isset($pointer) || !is_array($pointer)) {
180
+      if (!isset($pointer) || !is_array($pointer)) {
181 181
         $pointer = $var_value;
182
-      } elseif(is_array($$var_name)) {
182
+      } elseif (is_array($$var_name)) {
183 183
         $pointer = array_merge_recursive_numeric($pointer, $var_value);
184 184
       }
185 185
     }
186 186
   }
187 187
 
188 188
   protected function mergeMenu(&$sn_menu_extra, &$menu_patch) {
189
-    if(!is_array($menu_patch)) {
189
+    if (!is_array($menu_patch)) {
190 190
       return;
191 191
     }
192 192
 
193
-    foreach($menu_patch as $menu_item_name => $menu_item_data) {
193
+    foreach ($menu_patch as $menu_item_name => $menu_item_data) {
194 194
       $sn_menu_extra[$menu_item_name] = $menu_item_data;
195 195
     }
196 196
   }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     // Overriding function if any
202 202
     sn_sys_handler_add($functions, $this->manifest['functions'], $this);
203 203
 
204
-    foreach($sn_mvc as $handler_type => &$handler_data) {
204
+    foreach ($sn_mvc as $handler_type => &$handler_data) {
205 205
       sn_sys_handler_add($handler_data, $this->manifest['mvc'][$handler_type], $this, $handler_type);
206 206
     }
207 207
   }
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
   protected function mergeNavbarButton() {
210 210
     global $sn_mvc;
211 211
 
212
-    if(empty($this->manifest['navbar_prefix_button']) || !is_array($this->manifest['navbar_prefix_button'])) {
212
+    if (empty($this->manifest['navbar_prefix_button']) || !is_array($this->manifest['navbar_prefix_button'])) {
213 213
       return;
214 214
     }
215 215
 
216
-    foreach($this->manifest['navbar_prefix_button'] as $button_image => $button_url_relative) {
216
+    foreach ($this->manifest['navbar_prefix_button'] as $button_image => $button_url_relative) {
217 217
       $sn_mvc['navbar_prefix_button'][$button_image] = $button_url_relative;
218 218
     }
219 219
   }
@@ -222,17 +222,17 @@  discard block
 block discarded – undo
222 222
     global $sn_mvc;
223 223
 
224 224
     $arrayName = 'i18n';
225
-    if(empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) {
225
+    if (empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) {
226 226
       return;
227 227
     }
228 228
 
229
-    foreach($this->manifest[$arrayName] as $pageName => &$contentList) {
230
-      foreach($contentList as &$i18n_file_data) {
231
-        if(is_array($i18n_file_data) && !$i18n_file_data['path']) {
229
+    foreach ($this->manifest[$arrayName] as $pageName => &$contentList) {
230
+      foreach ($contentList as &$i18n_file_data) {
231
+        if (is_array($i18n_file_data) && !$i18n_file_data['path']) {
232 232
           $i18n_file_data['path'] = $this->manifest['root_relative'];
233 233
         }
234 234
       }
235
-      if(!isset($sn_mvc[$arrayName][$pageName])) {
235
+      if (!isset($sn_mvc[$arrayName][$pageName])) {
236 236
         $sn_mvc[$arrayName][$pageName] = array();
237 237
       }
238 238
       $sn_mvc[$arrayName][$pageName] += $contentList;
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
   protected function mergeArraySpecial($arrayName) {
243 243
     global $sn_mvc;
244 244
 
245
-    if(empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) {
245
+    if (empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) {
246 246
       return;
247 247
     }
248 248
 
249
-    foreach($this->manifest[$arrayName] as $pageName => &$contentList) {
249
+    foreach ($this->manifest[$arrayName] as $pageName => &$contentList) {
250 250
       !isset($sn_mvc[$arrayName][$pageName]) ? $sn_mvc[$arrayName][$pageName] = array() : false;
251
-      foreach($contentList as $contentName => &$content) {
251
+      foreach ($contentList as $contentName => &$content) {
252 252
         $sn_mvc[$arrayName][$pageName][$contentName] = $content;
253 253
       }
254 254
     }
Please login to merge, or discard this patch.