Completed
Push — master ( 95506d...0f93c5 )
by Jonathan
07:55
created
src/Webtrees/Module/HooksModule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
     public function getConfigLink() {
55 55
         Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
56 56
         
57
-        return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig';
57
+        return 'module.php?mod='.$this->getName().'&mod_action=AdminConfig';
58 58
     }
59 59
     
60 60
 
Please login to merge, or discard this patch.
src/Webtrees/Module/ModuleManager.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,10 +61,10 @@
 block discarded – undo
61 61
      * @see \MyArtJaub\Webtrees\Module\ModuleManagerInterface::isOperational()
62 62
      */
63 63
     public function isOperational($moduleName) {
64
-    	if(!array_key_exists($moduleName, $this->modules_list)) {
65
-    		if($module = fw\Module::getModuleByName($moduleName)) {
66
-    			if($module instanceof DependentInterface) {
67
-    				if($module->validatePrerequisites()) {
64
+    	if (!array_key_exists($moduleName, $this->modules_list)) {
65
+    		if ($module = fw\Module::getModuleByName($moduleName)) {
66
+    			if ($module instanceof DependentInterface) {
67
+    				if ($module->validatePrerequisites()) {
68 68
     					$this->modules_list[$moduleName] = TRUE;
69 69
     					return true;
70 70
     				} else {
Please login to merge, or discard this patch.
src/Webtrees/Module/MiscExtensions/AdminConfigController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     protected function update() {
35 35
         global $WT_TREE;
36 36
     
37
-        if(Auth::isAdmin()){
37
+        if (Auth::isAdmin()) {
38 38
     
39 39
             $this->module->setSetting('MAJ_TITLE_PREFIX', Filter::post('MAJ_TITLE_PREFIX'));
40 40
             
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         global $WT_TREE;
67 67
         
68 68
         $action = Filter::post('action');        
69
-        if($action == 'update' && Filter::checkCsrf()) $this->update();
69
+        if ($action == 'update' && Filter::checkCsrf()) $this->update();
70 70
         
71 71
         Theme::theme(new AdministrationTheme)->init($WT_TREE);        
72 72
         $ctrl = new PageController();
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/GeoDisplayOptions.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 *
45 45
      * @return (OutlineMap|null)
46 46
      */
47
-    public function getMap(){
47
+    public function getMap() {
48 48
         return $this->map;
49 49
     }
50 50
     
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return int
66 66
 	 */
67
-    public function getMapLevel(){
67
+    public function getMapLevel() {
68 68
         return $this->map_level;
69 69
     }
70 70
     
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return bool
86 86
 	 */
87
-    public function isUsingFlags(){
87
+    public function isUsingFlags() {
88 88
         return $this->use_flags;
89 89
     }
90 90
     
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return int
106 106
 	 */
107
-    public function getMaxDetailsInGen(){
107
+    public function getMaxDetailsInGen() {
108 108
         return $this->max_details_in_gen;
109 109
     }
110 110
     
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/GeoAnalysisProvider.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
         ->setIsUsingFlags($row['majgd_useflagsgen'] == 'yes')
66 66
         ->setMaxDetailsInGen($row['majgd_detailsgen']);
67 67
         
68
-        if($row['majgd_map']) {
68
+        if ($row['majgd_map']) {
69 69
             $options
70 70
             ->setMap(new OutlineMap($row['majgd_map']))
71 71
             ->setMapLevel($row['majgd_toplevel']);
72 72
         }
73 73
         
74 74
         $enabled = true;
75
-        if(isset($row['majgd_status']) && $row['majgd_status'] == 'disabled') {
75
+        if (isset($row['majgd_status']) && $row['majgd_status'] == 'disabled') {
76 76
             $enabled = false;
77 77
         }
78 78
         
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function getGeoAnalysisCount() {
95 95
         return Database::prepare(
96
-            'SELECT COUNT(majgd_id)' .
97
-            ' FROM `##maj_geodispersion`' .
96
+            'SELECT COUNT(majgd_id)'.
97
+            ' FROM `##maj_geodispersion`'.
98 98
             ' WHERE majgd_file = :gedcom_id'
99 99
             )->execute(array(
100 100
                 'gedcom_id' => $this->tree->getTreeId()
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
      * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis|NULL
111 111
      */
112 112
     public function getGeoAnalysis($id, $only_enabled = true) {
113
-        $args = array (
113
+        $args = array(
114 114
             'gedcom_id' => $this->tree->getTreeId(),
115 115
             'ga_id' => $id
116 116
         );
117 117
         
118
-        $sql = 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
119
-            ' FROM `##maj_geodispersion`' .
118
+        $sql = 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status'.
119
+            ' FROM `##maj_geodispersion`'.
120 120
             ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id';
121
-        if($only_enabled) {
121
+        if ($only_enabled) {
122 122
             $sql .= ' AND majgd_status = :status';
123 123
             $args['status'] = 'enabled';
124 124
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         
127 127
         $ga_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC);
128 128
         
129
-        if($ga_array) {
129
+        if ($ga_array) {
130 130
             return $this->loadGeoAnalysisFromRow($ga_array);
131 131
         }
132 132
         
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      * @return GeoAnalysis
147 147
      */
148 148
 	public function createGeoAnalysis($description, $analysis_level, $map_file, $map_top_level, $use_flags, $gen_details) {
149
-		try{
149
+		try {
150 150
 			Database::beginTransaction();
151 151
 		
152 152
 			Database::prepare(
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 			
169 169
 			$id = Database::commit();
170 170
 		}
171
-		catch(\Exception $ex) {
171
+		catch (\Exception $ex) {
172 172
 			Database::rollback();
173 173
 			$ga = null;
174 174
 			Log::addErrorLog('A new Geo Analysis failed to be created. Transaction rollbacked. Parameters ['.$description.', '.$analysis_level.','.$map_file.','.$map_top_level.','.$use_flags.', '.$gen_details.']. Exception: '.$ex->getMessage());
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 			
212 212
 			$id = Database::commit();
213 213
 		}
214
-		catch(\Exception $ex) {		    
214
+		catch (\Exception $ex) {		    
215 215
 			Database::rollback();
216
-			Log::addErrorLog('The Geo Analysis ID “' . $ga->getId() . '” failed to be updated. Transaction rollbacked. Exception: '.$ex->getMessage());
216
+			Log::addErrorLog('The Geo Analysis ID “'.$ga->getId().'” failed to be updated. Transaction rollbacked. Exception: '.$ex->getMessage());
217 217
 			$ga = null;
218 218
 		}
219 219
 		return $ga;
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
      *
259 259
      * @return array List of enabled maps
260 260
      */
261
-    public function getGeoAnalysisList(){
261
+    public function getGeoAnalysisList() {
262 262
         $res = array();
263 263
         
264 264
         $list = Database::prepare(
265
-            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen' .
266
-            ' FROM `##maj_geodispersion`' .
265
+            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen'.
266
+            ' FROM `##maj_geodispersion`'.
267 267
             ' WHERE majgd_file = :gedcom_id AND majgd_status = :status'.
268 268
             ' ORDER BY majgd_descr'
269 269
         )->execute(array(
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
             'status' => 'enabled'
272 272
         ))->fetchAll(\PDO::FETCH_ASSOC);
273 273
         
274
-        foreach($list as $ga) {
274
+        foreach ($list as $ga) {
275 275
            $res[] = $this->loadGeoAnalysisFromRow($ga);
276 276
         }
277 277
         
@@ -287,17 +287,17 @@  discard block
 block discarded – undo
287 287
      * @param int|null $limit Max number of items to return (for pagination)
288 288
      * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis[]
289 289
      */
290
-    public function getFilteredGeoAnalysisList($search = null, $order_by = null, $start = 0, $limit = null){
290
+    public function getFilteredGeoAnalysisList($search = null, $order_by = null, $start = 0, $limit = null) {
291 291
         $res = array();
292 292
             
293 293
         $sql = 
294
-            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
295
-            ' FROM `##maj_geodispersion`' .
294
+            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status'.
295
+            ' FROM `##maj_geodispersion`'.
296 296
             ' WHERE majgd_file = :gedcom_id';
297 297
         
298 298
         $args = array('gedcom_id'=> $this->tree->getTreeId());
299 299
         
300
-        if($search) {
300
+        if ($search) {
301 301
             $sql .= ' AND majgd_descr LIKE CONCAT(\'%\', :search, \'%\')';
302 302
             $args['search'] = $search;
303 303
         }
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
                 
312 312
                 switch ($value['dir']) {
313 313
                     case 'asc':
314
-                        $sql .= $value['column'] . ' ASC ';
314
+                        $sql .= $value['column'].' ASC ';
315 315
                         break;
316 316
                     case 'desc':
317
-                        $sql .= $value['column'] . ' DESC ';
317
+                        $sql .= $value['column'].' DESC ';
318 318
                         break;
319 319
                 }
320 320
             }
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
             
331 331
         $data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
332 332
 
333
-        foreach($data as $ga) {
333
+        foreach ($data as $ga) {
334 334
             $res[] = $this->loadGeoAnalysisFromRow($ga);
335 335
         }
336 336
         
@@ -347,8 +347,8 @@  discard block
 block discarded – undo
347 347
      * @return array
348 348
      */
349 349
     public function getPlacesHierarchy() {
350
-        if(!$this->place_hierarchy) {
351
-            if($place_structure = $this->getPlacesHierarchyFromHeader()) {
350
+        if (!$this->place_hierarchy) {
351
+            if ($place_structure = $this->getPlacesHierarchyFromHeader()) {
352 352
                 $this->place_hierarchy = array('type' => 'header', 'hierarchy' => $place_structure);
353 353
             }
354 354
             else {
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
     protected function getPlacesHierarchyFromHeader() {
368 368
         $head = GedcomRecord::getInstance('HEAD', $this->tree);
369 369
         $head_place = $head->getFirstFact('PLAC');
370
-        if($head_place && $head_place_value = $head_place->getAttribute('FORM')){
371
-            return array_reverse(array_map('trim',explode(',', $head_place_value)));
370
+        if ($head_place && $head_place_value = $head_place->getAttribute('FORM')) {
371
+            return array_reverse(array_map('trim', explode(',', $head_place_value)));
372 372
         }
373 373
         return null;
374 374
     }
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
         $nb_levels = 0;
386 386
         
387 387
         //Select all '2 PLAC ' tags in the file and create array
388
-        $places_list=array();
388
+        $places_list = array();
389 389
         $ged_data = Database::prepare(
390 390
             'SELECT i_gedcom AS gedcom'.
391 391
             ' FROM `##individuals`'.
@@ -401,35 +401,35 @@  discard block
 block discarded – undo
401 401
         foreach ($ged_data as $ged_datum) {
402 402
             preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches);
403 403
             foreach ($matches[1] as $match) {
404
-                $places_list[$match]=true;
404
+                $places_list[$match] = true;
405 405
             }
406 406
         }
407 407
         
408 408
         // Unique list of places
409
-        $places_list=array_keys($places_list);
409
+        $places_list = array_keys($places_list);
410 410
         
411 411
         //sort the array, limit to unique values, and count them
412
-        $places_parts=array();
412
+        $places_parts = array();
413 413
         usort($places_list, array('I18N', 'strcasecmp'));
414 414
         $nb_places = count($places_list);
415 415
         
416 416
         //calculate maximum no. of levels to display
417 417
         $has_found_good_example = false;
418
-        foreach($places_list as $place){
418
+        foreach ($places_list as $place) {
419 419
             $levels = explode(",", $place);
420 420
             $parts = count($levels);
421
-            if ($parts >= $nb_levels){
421
+            if ($parts >= $nb_levels) {
422 422
                 $nb_levels = $parts;
423
-                if(!$has_found_good_example){
423
+                if (!$has_found_good_example) {
424 424
                     $random_place = $$place;
425
-                    if(min(array_map('strlen', $levels)) > 0){
425
+                    if (min(array_map('strlen', $levels)) > 0) {
426 426
                         $has_found_good_example = true;
427 427
                     }
428 428
                 }
429 429
             }
430 430
         }
431 431
         
432
-        return array_reverse(array_map('trim',explode(',', $randomPlace)));
432
+        return array_reverse(array_map('trim', explode(',', $randomPlace)));
433 433
     }
434 434
     
435 435
     /**
@@ -440,9 +440,9 @@  discard block
 block discarded – undo
440 440
     public function getOutlineMapsList() {
441 441
         $res = array();
442 442
         $root_path = WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/';
443
-        if(is_dir($root_path)){
443
+        if (is_dir($root_path)) {
444 444
             $dir = opendir($root_path);
445
-            while (($file=readdir($dir))!== false) {
445
+            while (($file = readdir($dir)) !== false) {
446 446
                 if (preg_match('/^[a-zA-Z0-9_]+.xml$/', $file)) {
447 447
                     $res[base64_encode($file)] = new OutlineMap($file, true);
448 448
                 }
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/GeoAnalysis.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	 * @return string
165 165
 	 */
166 166
 	 public function getHtmlUrl() {
167
-        return 'module.php?mod='. Constants::MODULE_MAJ_GEODISP_NAME . '&mod_action=GeoAnalysis&ga_id=' . $this->getId() . '&ged=' . $this->tree->getNameUrl();
167
+        return 'module.php?mod='.Constants::MODULE_MAJ_GEODISP_NAME.'&mod_action=GeoAnalysis&ga_id='.$this->getId().'&ged='.$this->tree->getNameUrl();
168 168
     }
169 169
     
170 170
     /**
@@ -187,50 +187,50 @@  discard block
 block discarded – undo
187 187
         $placesDispGeneral = null;
188 188
         $placesDispGenerations = null;
189 189
         
190
-        if($sosalist && count($sosalist) > 0) {
190
+        if ($sosalist && count($sosalist) > 0) {
191 191
             $placesDispGeneral['knownsum'] = 0;
192 192
             $placesDispGeneral['unknown'] = 0;
193 193
             $placesDispGeneral['max'] = 0;
194 194
             $placesDispGeneral['places'] = array();
195
-            foreach($sosalist as $sosaid => $gens) {
195
+            foreach ($sosalist as $sosaid => $gens) {
196 196
                 $sosa = Individual::getIntance($sosaid, $this->tree);
197
-                $place =$sosa->getSignificantPlace();
197
+                $place = $sosa->getSignificantPlace();
198 198
                 $genstab = explode(',', $gens);
199
-                $isUnknown=true;
200
-                if($sosa->getDerivedRecord()->canShow() && !is_null($place)){
201
-                    $levels = array_reverse(array_map('trim',explode(',', $place)));
202
-                    if(count($levels)>= $this->analysis_level){                        
199
+                $isUnknown = true;
200
+                if ($sosa->getDerivedRecord()->canShow() && !is_null($place)) {
201
+                    $levels = array_reverse(array_map('trim', explode(',', $place)));
202
+                    if (count($levels) >= $this->analysis_level) {                        
203 203
                         $toplevelvalues = array();
204
-                        if($this->hasMap() && $toplevelvalue = $this->options->getMap()->getTopLevelName()) {
205
-                            $toplevelvalues = array_map('trim',explode(',', strtolower($toplevelvalue)));
204
+                        if ($this->hasMap() && $toplevelvalue = $this->options->getMap()->getTopLevelName()) {
205
+                            $toplevelvalues = array_map('trim', explode(',', strtolower($toplevelvalue)));
206 206
                         }
207
-                        if(!$this->hasMap() 
207
+                        if (!$this->hasMap() 
208 208
                             || is_null($this->options->getMapLevel()) 
209 209
                             || $this->options->getMap()->getTopLevelName() == '*' 
210 210
                             || (
211 211
                                 $this->options->getMapLevel() <= $this->analysis_level 
212 212
                                 && $this->options->getMapLevel() > 0
213 213
                                 && count($levels) >= $this->options->getMapLevel()
214
-                                && in_array(strtolower($levels[$this->options->getMapLevel()-1]), $toplevelvalues)
214
+                                && in_array(strtolower($levels[$this->options->getMapLevel() - 1]), $toplevelvalues)
215 215
                             )
216 216
                         ) {
217 217
                             $placest = implode(I18N::$list_separator, array_slice($levels, 0, $this->analysis_level));
218
-                            if(isset($placesDispGeneral['places'][$placest])) {
218
+                            if (isset($placesDispGeneral['places'][$placest])) {
219 219
                                 $placesDispGeneral['places'][$placest] += 1;
220 220
                             }
221 221
                             else { 
222 222
                                 $placesDispGeneral['places'][$placest] = 1;
223 223
                             }
224
-                            if($placesDispGeneral['places'][$placest]>$placesDispGeneral['max'])
224
+                            if ($placesDispGeneral['places'][$placest] > $placesDispGeneral['max'])
225 225
                                 $placesDispGeneral['max'] = $placesDispGeneral['places'][$placest];
226
-                            foreach($genstab as $gen) {
227
-                                if(isset($placesDispGenerations[$gen]['places'][$placest])) {
226
+                            foreach ($genstab as $gen) {
227
+                                if (isset($placesDispGenerations[$gen]['places'][$placest])) {
228 228
                                     $placesDispGenerations[$gen]['places'][$placest] += 1;
229 229
                                 }
230 230
                                 else { 
231 231
                                     $placesDispGenerations[$gen]['places'][$placest] = 1;
232 232
                                 }
233
-                                if(isset($placesDispGenerations[$gen]['sum'])) {
233
+                                if (isset($placesDispGenerations[$gen]['sum'])) {
234 234
                                     $placesDispGenerations[$gen]['sum'] += 1;
235 235
                                 }
236 236
                                 else { 
@@ -238,15 +238,15 @@  discard block
 block discarded – undo
238 238
                                 }
239 239
                             }
240 240
                         }
241
-                        else{
242
-                            if(isset($placesDispGeneral['other'])) {
241
+                        else {
242
+                            if (isset($placesDispGeneral['other'])) {
243 243
                                 $placesDispGeneral['other'] += 1;
244 244
                             }
245 245
                             else { 
246 246
                                 $placesDispGeneral['other'] = 1;
247 247
                             }
248
-                            foreach($genstab as $gen) {
249
-                                if(isset($placesDispGenerations[$gen]['other'])) {
248
+                            foreach ($genstab as $gen) {
249
+                                if (isset($placesDispGenerations[$gen]['other'])) {
250 250
                                     $placesDispGenerations[$gen]['other'] += 1;
251 251
                                 }
252 252
                                 else { 
@@ -258,10 +258,10 @@  discard block
 block discarded – undo
258 258
                         $isUnknown = false;
259 259
                     }
260 260
                 }
261
-                if($isUnknown){
261
+                if ($isUnknown) {
262 262
                     $placesDispGeneral['unknown'] += 1;
263
-                    foreach($genstab as $gen) {
264
-                        if(isset($placesDispGenerations[$gen]['unknown'])) { 
263
+                    foreach ($genstab as $gen) {
264
+                        if (isset($placesDispGenerations[$gen]['unknown'])) { 
265 265
                             $placesDispGenerations[$gen]['unknown'] += 1;
266 266
                         }
267 267
                         else { 
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/OutlineMap.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         $this->is_loaded = false;
71 71
         $this->subdivisions = array();
72 72
         $this->mappings = array();
73
-        if($load) $this->load();
73
+        if ($load) $this->load();
74 74
     }
75 75
     
76 76
     /**
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	 * 
100 100
      */
101 101
     protected function load() {
102
-        if(file_exists(WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/'.$this->filename)){
102
+        if (file_exists(WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/'.$this->filename)) {
103 103
             $xml = simplexml_load_file(WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/'.$this->filename);
104
-            if($xml){
104
+            if ($xml) {
105 105
                 $this->description = trim($xml->displayName);
106 106
                 $this->top_level_name = trim($xml->topLevel);
107 107
                 $this->canvas = new OutlineMapCanvas(
@@ -114,18 +114,18 @@  discard block
 block discarded – undo
114 114
                     trim($xml->canvas->defaultcolor), 
115 115
                     trim($xml->canvas->defaultstroke)
116 116
                 );
117
-                foreach($xml->subdivisions->children() as $subdivision){
117
+                foreach ($xml->subdivisions->children() as $subdivision) {
118 118
                     $attributes = $subdivision->attributes();
119 119
                     $key = trim($attributes['name']);
120
-                    if(isset($attributes['parent'])) $key .= '@'.trim($attributes['parent']);
120
+                    if (isset($attributes['parent'])) $key .= '@'.trim($attributes['parent']);
121 121
                     $this->subdivisions[$key] = array(
122 122
                         'id' => trim($attributes['id']),
123 123
                         'displayname' => trim($attributes['name']),
124 124
                         'coord' => trim($subdivision[0])
125 125
                     );
126 126
                 }
127
-                if(isset($xml->mappings)) {
128
-                    foreach($xml->mappings->children() as $mappings){
127
+                if (isset($xml->mappings)) {
128
+                    foreach ($xml->mappings->children() as $mappings) {
129 129
                         $attributes = $mappings->attributes();
130 130
                         $this->mappings[trim($attributes['name'])] = trim($attributes['mapto']);
131 131
                     }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @return string
143 143
 	 */
144 144
     public function getFileName() {
145
-        if(!$this->is_loaded) $this->load();
145
+        if (!$this->is_loaded) $this->load();
146 146
         return $this->filename;
147 147
     }
148 148
     
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @return string
152 152
 	 */
153 153
     public function getDescription() {
154
-        if(!$this->is_loaded) $this->load();
154
+        if (!$this->is_loaded) $this->load();
155 155
         return $this->description;
156 156
     }
157 157
     
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @return string
161 161
 	 */
162 162
     public function getTopLevelName() {
163
-        if(!$this->is_loaded) $this->load();
163
+        if (!$this->is_loaded) $this->load();
164 164
         return $this->top_level_name;
165 165
     }    
166 166
     
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\OutlineMapCanvas
170 170
      */
171 171
     public function getCanvas() {
172
-        if(!$this->is_loaded) $this->load();
172
+        if (!$this->is_loaded) $this->load();
173 173
         return $this->canvas;
174 174
     }
175 175
     
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      * @return array
179 179
      */
180 180
     public function getSubdivisions() {
181
-        if(!$this->is_loaded) $this->load();
181
+        if (!$this->is_loaded) $this->load();
182 182
         return $this->subdivisions;
183 183
     }
184 184
     
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      * @return array
188 188
      */
189 189
     public function getPlacesMappings() {
190
-        if(!$this->is_loaded) $this->load();
190
+        if (!$this->is_loaded) $this->load();
191 191
         return $this->mappings;
192 192
     }
193 193
                    
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/AdminConfigController.php 1 patch
Spacing   +43 added lines, -45 removed lines patch added patch discarded remove patch
@@ -72,14 +72,14 @@  discard block
 block discarded – undo
72 72
         $data->set('title', $controller->getPageTitle());
73 73
         $data->set('tree', $WT_TREE);
74 74
         
75
-        $data->set('root_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig');
75
+        $data->set('root_url', 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig');
76 76
                 
77
-        $table_id = 'table-geoanalysis-' . Uuid::uuid4();
77
+        $table_id = 'table-geoanalysis-'.Uuid::uuid4();
78 78
         $data->set('table_id', $table_id);
79 79
         
80 80
         $other_trees = array();
81 81
         foreach (Tree::getAll() as $tree) {
82
-            if($tree->getTreeId() != $WT_TREE->getTreeId()) $other_trees[] = $tree;
82
+            if ($tree->getTreeId() != $WT_TREE->getTreeId()) $other_trees[] = $tree;
83 83
         }      
84 84
         $data->set('other_trees', $other_trees);
85 85
         
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
                     processing: true,
106 106
                     serverSide : true,
107 107
 					ajax : {
108
-						url : "module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@jsonGeoAnalysisList&ged='. $WT_TREE->getNameUrl().'",
108
+						url : "module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@jsonGeoAnalysisList&ged='.$WT_TREE->getNameUrl().'",
109 109
                         type : "POST"
110 110
 					},
111 111
                     columns: [
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
                             url: "module.php", 
130 130
                             type: "GET",
131 131
                             data: {
132
-                			    mod: "' . $this->module->getName() .'",
132
+                			    mod: "' . $this->module->getName().'",
133 133
                                 mod_action:  "GeoAnalysis@setStatus",
134 134
                 			    ga_id: ga_id,
135 135
                 			    ged: typeof gedcom === "undefined" ? WT_GEDCOM : gedcom,
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                             },
138 138
                             error: function(result, stat, error) {
139 139
                                 var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error;
140
-                                alert("' . I18N::translate('An error occured while editing this analysis:') . '" + err);
140
+                                alert("' . I18N::translate('An error occured while editing this analysis:').'" + err);
141 141
                             },
142 142
                             complete: function(result, stat) {
143 143
                                 geoAnalysisTable.ajax.reload(null, false);
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
                             url: "module.php", 
151 151
                             type: "GET",
152 152
                             data: {
153
-                			    mod: "' . $this->module->getName() .'",
153
+                			    mod: "' . $this->module->getName().'",
154 154
                                 mod_action:  "GeoAnalysis@delete",
155 155
                 			    ga_id: ga_id,
156 156
                 			    ged: typeof gedcom === "undefined" ? WT_GEDCOM : gedcom
157 157
                             },
158 158
                             error: function(result, stat, error) {
159 159
                                 var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error;
160
-                                alert("' . I18N::translate('An error occured while deleting this analysis:') . '" + err);
160
+                                alert("' . I18N::translate('An error occured while deleting this analysis:').'" + err);
161 161
                             },
162 162
                             complete: function(result, stat) {
163 163
                                 geoAnalysisTable.ajax.reload(null, false);
@@ -182,13 +182,13 @@  discard block
 block discarded – undo
182 182
         
183 183
         // Generate an AJAX/JSON response for datatables to load a block of rows
184 184
         $search = Filter::postArray('search');
185
-        if($search) $search = $search['value'];
185
+        if ($search) $search = $search['value'];
186 186
         $start  = Filter::postInteger('start');
187 187
         $length = Filter::postInteger('length');
188 188
         $order  = Filter::postArray('order');
189 189
         
190
-        foreach($order as $key => &$value) {
191
-            switch($value['column']) {
190
+        foreach ($order as $key => &$value) {
191
+            switch ($value['column']) {
192 192
                 case 3:
193 193
                     $value['column'] = 'majgd_descr';
194 194
                     break;
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
         
210 210
         $data = array();
211 211
         $place_hierarchy = $this->provider->getPlacesHierarchy();
212
-        foreach($list as $ga) {
212
+        foreach ($list as $ga) {
213 213
             /** @var GeoAnalysis $ga */
214 214
             
215 215
             $datum = array();
216
-            $options= $ga->getOptions();
216
+            $options = $ga->getOptions();
217 217
             
218 218
             $datum[0] = '
219 219
                 <div class="btn-group">
@@ -223,50 +223,48 @@  discard block
 block discarded – undo
223 223
                     <ul class="dropdown-menu" role="menu">
224 224
                        <li>
225 225
                             <a href="#" onclick="return set_geoanalysis_status('. $ga->getId().', '.($ga->isEnabled() ? 'false' : 'true').', \''.Filter::escapeJs($WT_TREE->getName()).'\');">
226
-                                <i class="fa fa-fw '.($ga->isEnabled() ? 'fa-times' : 'fa-check').'"></i> ' . ($ga->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')) . '
226
+                                <i class="fa fa-fw '.($ga->isEnabled() ? 'fa-times' : 'fa-check').'"></i> '.($ga->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')).'
227 227
                             </a>
228 228
                        </li>
229 229
                         <li>
230 230
                             <a href="module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@edit&ga_id='.$ga->getId().'&ged='.$WT_TREE->getName().'">
231
-                                <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit') . '
231
+                                <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit').'
232 232
                             </a>
233 233
                        </li>
234 234
                        <li class="divider" />
235 235
                        <li>
236 236
                             <a href="#" onclick="return delete_geoanalysis('. $ga->getId().', \''.Filter::escapeJs($WT_TREE->getName()).'\');">
237
-                                <i class="fa fa-fw fa-trash-o"></i> ' . I18N::translate('Delete') . '
237
+                                <i class="fa fa-fw fa-trash-o"></i> ' . I18N::translate('Delete').'
238 238
                             </a>
239 239
                        </li>
240 240
                     </ul>
241 241
                 </div>';
242 242
 		    $datum[1] = $ga->getId();
243 243
 		    $datum[2] = $ga->isEnabled() ? 
244
-				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : 
245
-				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>';
244
+				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>';
246 245
 		    $datum[3] = $ga->getTitle();
247 246
 		    $analysis_level = $ga->getAnalysisLevel();
248
-		    if($place_hierarchy['type'] == 'header') {
247
+		    if ($place_hierarchy['type'] == 'header') {
249 248
 		        $datum[4] = $place_hierarchy['hierarchy'][$analysis_level - 1];
250 249
 		    } else {
251
-		        $datum[4] = $analysis_level . '(' . $place_hierarchy['hierarchy'][$analysis_level - 1] . ')';
250
+		        $datum[4] = $analysis_level.'('.$place_hierarchy['hierarchy'][$analysis_level - 1].')';
252 251
 		    }
253 252
 		    $datum[5] = $ga->getAnalysisLevel();
254 253
 		    $datum[6] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>';
255 254
 		    $datum[7] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>';
256
-		    if($ga->hasMap()) {
255
+		    if ($ga->hasMap()) {
257 256
 		        $datum[6] = $options->getMap()->getDescription();
258
-		        $datum[7] = '<span data-toggle="tooltip" title="' . $options->getMap()->getTopLevelName() . '" />';
257
+		        $datum[7] = '<span data-toggle="tooltip" title="'.$options->getMap()->getTopLevelName().'" />';
259 258
 		        $top_level = $options->getMapLevel();
260
-		        if($place_hierarchy['type'] == 'header') {
259
+		        if ($place_hierarchy['type'] == 'header') {
261 260
 		            $datum[7] .= $place_hierarchy['hierarchy'][$top_level - 1];
262 261
 		        } else {
263
-		            $datum[7] .= $top_level . '(' . $place_hierarchy['hierarchy'][$top_level - 1] . ')';
262
+		            $datum[7] .= $top_level.'('.$place_hierarchy['hierarchy'][$top_level - 1].')';
264 263
 		        }
265 264
 		        $datum[7] .= '</span>';
266 265
 		    }
267 266
 		    $datum[8] = $options->isUsingFlags() ? 
268
-				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : 
269
-				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>';
267
+				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>';
270 268
 		    $datum[9] = $options->getMaxDetailsInGen() > 0 ? $options->getMaxDetailsInGen() : I18N::translate('All');
271 269
 		    
272 270
 		    $data[] = $datum;
@@ -316,24 +314,24 @@  discard block
 block discarded – undo
316 314
         $description    = Filter::post('description');
317 315
         $analysislevel  = Filter::postInteger('analysislevel');
318 316
         $use_map        = Filter::postBool('use_map');
319
-        if($use_map) {
317
+        if ($use_map) {
320 318
             $map_file   = base64_decode(Filter::post('map_file'));
321
-            $map_top_level   = Filter::postInteger('map_top_level');
319
+            $map_top_level = Filter::postInteger('map_top_level');
322 320
         }
323 321
         $use_flags      = Filter::postBool('use_flags');
324 322
         $gen_details    = Filter::postInteger('gen_details');
325 323
         
326 324
         $success = false; 
327
-        if($ga_id) {
325
+        if ($ga_id) {
328 326
             $ga = $this->provider->getGeoAnalysis($ga_id, false);
329
-            if($ga) {
327
+            if ($ga) {
330 328
                 $ga->setTitle($description);
331 329
                 $ga->setAnalysisLevel($analysislevel + 1);
332 330
                 $options = $ga->getOptions();
333
-                if($options) {
331
+                if ($options) {
334 332
                     $options->setIsUsingFlags($use_flags);
335 333
                     $options->setMaxDetailsInGen($gen_details);
336
-                    if($use_map) {
334
+                    if ($use_map) {
337 335
                         $options->setMap(new OutlineMap($map_file));
338 336
                         $options->setMapLevel($map_top_level + 1);
339 337
                     }
@@ -343,7 +341,7 @@  discard block
 block discarded – undo
343 341
                 }
344 342
 				
345 343
 				$res = $this->provider->updateGeoAnalysis($ga);
346
-				if($res) {
344
+				if ($res) {
347 345
 					FlashMessages::addMessage(I18N::translate('The geographical dispersion analysis “%s” has been successfully updated', $res->getTitle()), 'success');
348 346
 					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$res->getId().'” has been updated.');
349 347
 					$ga = $res;
@@ -351,7 +349,7 @@  discard block
 block discarded – undo
351 349
 				}
352 350
 				else {
353 351
 					FlashMessages::addMessage(I18N::translate('An error occured while updating the geographical dispersion analysis “%s”', $ga->getTitle()), 'danger');
354
-					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'. $ga->getId() .'” could not be updated. See error log.');
352
+					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$ga->getId().'” could not be updated. See error log.');
355 353
 				}
356 354
             }
357 355
         } else {
@@ -363,7 +361,7 @@  discard block
 block discarded – undo
363 361
 				$use_flags,
364 362
 				$gen_details
365 363
 			);
366
-			if($ga) {
364
+			if ($ga) {
367 365
 				FlashMessages::addMessage(I18N::translate('The geographical dispersion analysis “%s” has been successfully added.', $ga->getTitle()), 'success');
368 366
 				Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$ga->getId().'” has been added.');
369 367
 				$success = true;
@@ -374,16 +372,16 @@  discard block
 block discarded – undo
374 372
 			}
375 373
         }
376 374
         
377
-        $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl();
378
-        if(!$success) {			
379
-            if($ga) {
380
-                $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $WT_TREE->getNameUrl();
375
+        $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig&ged='.$WT_TREE->getNameUrl();
376
+        if (!$success) {			
377
+            if ($ga) {
378
+                $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@edit&ga_id='.$ga->getId().'&ged='.$WT_TREE->getNameUrl();
381 379
             }
382 380
             else {
383
-                $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $WT_TREE->getNameUrl();
381
+                $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@add&ged='.$WT_TREE->getNameUrl();
384 382
             }
385 383
         }        
386
-        header('Location: ' . WT_BASE_URL . $redirection_url);
384
+        header('Location: '.WT_BASE_URL.$redirection_url);
387 385
         
388 386
     }
389 387
      
@@ -414,7 +412,7 @@  discard block
 block discarded – undo
414 412
             ');
415 413
         
416 414
         $data = new ViewBag();
417
-        if($ga) {
415
+        if ($ga) {
418 416
             $controller->setPageTitle(I18N::translate('Edit the geographical dispersion analysis'));
419 417
             $data->set('geo_analysis', $ga);
420 418
         } else {
@@ -422,9 +420,9 @@  discard block
 block discarded – undo
422 420
         }
423 421
         
424 422
         $data->set('title', $controller->getPageTitle());
425
-        $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl());
423
+        $data->set('admin_config_url', 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig&ged='.$WT_TREE->getNameUrl());
426 424
         $data->set('module_title', $this->module->getTitle());
427
-        $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@save&ged=' . $WT_TREE->getNameUrl());
425
+        $data->set('save_url', 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@save&ged='.$WT_TREE->getNameUrl());
428 426
         $data->set('places_hierarchy', $this->provider->getPlacesHierarchy());
429 427
     
430 428
         $map_list = array_map(
@@ -437,7 +435,7 @@  discard block
 block discarded – undo
437 435
         $data->set('map_list', $map_list);
438 436
     
439 437
         $gen_details = array(0 => I18N::translate('All'));
440
-        for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i;
438
+        for ($i = 1; $i <= 10; $i++) $gen_details[$i] = $i;
441 439
         $data->set('generation_details', $gen_details);
442 440
     
443 441
         ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render();
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Views/GeoAnalysisEditView.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		
45 45
 		<form class="form-horizontal" name="newform" method="post" role="form" action="<?php echo $this->data->get('save_url'); ?>" autocomplete="off">
46 46
     		<?php echo Filter::getCsrf(); ?>
47
-    		<?php if(!$is_new) { ?>
47
+    		<?php if (!$is_new) { ?>
48 48
     		<input type="hidden" name="ga_id" value="<?php echo $ga->getId(); ?>">
49 49
     		<?php } ?>
50 50
     
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     				<?php echo I18N::translate('Description'); ?>
55 55
     			</label>
56 56
     			<div class="col-sm-9">
57
-    				<input class="form-control" type="text" id="description" name="description" required maxlength="70" <?php if(!$is_new) echo 'value="' . Filter::escapeHtml($ga->getTitle()) .'"'; ?> dir="auto">
57
+    				<input class="form-control" type="text" id="description" name="description" required maxlength="70" <?php if (!$is_new) echo 'value="'.Filter::escapeHtml($ga->getTitle()).'"'; ?> dir="auto">
58 58
     				<p class="small text-muted">
59 59
     					<?php echo I18N::translate('Description to be given to the geographical dispersion analysis. It will be used as the page title for it.'); ?>
60 60
     				</p>
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         				<?php echo I18N::translate('Map'); ?>
98 98
         			</label>
99 99
         			<div class="col-sm-9">
100
-        				<?php echo FunctionsEdit::selectEditControl('map_file', $this->data->get('map_list') , null, $is_new || ! $ga->hasMap() ? '' : base64_encode($ga->getOptions()->getMap()->getFileName()), 'class="form-control"'); ?>
100
+        				<?php echo FunctionsEdit::selectEditControl('map_file', $this->data->get('map_list'), null, $is_new || !$ga->hasMap() ? '' : base64_encode($ga->getOptions()->getMap()->getFileName()), 'class="form-control"'); ?>
101 101
         				<p class="small text-muted">
102 102
         					<?php echo I18N::translate('Map outline to be used for the result display.'); ?>
103 103
         				</p>
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         				<?php echo I18N::translate('Map parent level'); ?>
111 111
         			</label>
112 112
         			<div class="col-sm-9">
113
-        				<?php echo FunctionsEdit::selectEditControl('map_top_level', $places_hierarchy['hierarchy'], null, $is_new || ! $ga->hasMap() ? '' : $ga->getOptions()->getMapLevel() - 1, 'class="form-control"'); ?>
113
+        				<?php echo FunctionsEdit::selectEditControl('map_top_level', $places_hierarchy['hierarchy'], null, $is_new || !$ga->hasMap() ? '' : $ga->getOptions()->getMapLevel() - 1, 'class="form-control"'); ?>
114 114
         				<p class="small text-muted">
115 115
         					<?php echo I18N::translate('Subdivision level of the parent subdivision(s) represented by the map.'); ?><br />
116 116
         					<?php echo I18N::translate('For instance, if the map is intended to represent a country by county analysis, then the map parent level would be “Country”, and the analysis level would be “County”.'); ?>
Please login to merge, or discard this patch.