Completed
Push — master ( 8c59e5...eb013e )
by Jonathan
09:17
created
src/Webtrees/Functions/FunctionsPrint.php 1 patch
Braces   +11 added lines, -7 removed lines patch added patch discarded remove patch
@@ -160,7 +160,9 @@  discard block
 block discarded – undo
160 160
 	public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true){
161 161
 		$html = '';
162 162
 		$tag = 'em';
163
-		if($isStrong) $tag = 'strong';
163
+		if($isStrong) {
164
+			$tag = 'strong';
165
+		}
164 166
 		if($individual && $individual->canShow()){
165 167
 			$dindi = new Individual($individual);
166 168
 			$html = $individual->getSexImage();
@@ -174,8 +176,7 @@  discard block
 block discarded – undo
174 176
 			$html .= '&nbsp;<span><small><em>'.$dindi->formatFirstMajorFact(WT_EVENTS_BIRT, 10).'</em></small></span>';
175 177
 			$html .= '&nbsp;<span><small><em>'.$dindi->formatFirstMajorFact(WT_EVENTS_DEAT, 10).'</em></small></span>';
176 178
 			$html .= '</a>';
177
-		}
178
-		else {
179
+		} else {
179 180
 			$html .= '<span class=\"list_item\"><'.$tag.'>' . I18N::translate('Private') . '</'.$tag.'></span>';
180 181
 		}
181 182
 		return $html;
@@ -193,8 +194,7 @@  discard block
 block discarded – undo
193 194
 		$date = $fact->getDate();
194 195
 		if($date->isOK()){
195 196
 			$html.=' '.$date->Display($anchor && !Globals::isSearchSpider(), '%Y');
196
-		}
197
-		else{
197
+		} else{
198 198
 			// 1 DEAT Y with no DATE => print YES
199 199
 			// 1 BIRT 2 SOUR @S1@ => print YES
200 200
 			// 1 DEAT N is not allowed
@@ -218,7 +218,9 @@  discard block
 block discarded – undo
218 218
 	public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){
219 219
 		$html='';
220 220
 		
221
-		if ($fact === null) return $html;
221
+		if ($fact === null) {
222
+			return $html;
223
+		}
222 224
 		$place = $fact->getPlace();
223 225
 		if($place){
224 226
 			$dplace = new Place($place);
@@ -336,7 +338,9 @@  discard block
 block discarded – undo
336 338
 					default:
337 339
 						break;
338 340
 				}
339
-				if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>';
341
+				if($image && $title) {
342
+					$html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>';
343
+				}
340 344
 				break;
341 345
 			default:
342 346
 				break;
Please login to merge, or discard this patch.
src/Webtrees/Functions/Functions.php 1 patch
Braces   +18 added lines, -11 removed lines patch added patch discarded remove patch
@@ -108,16 +108,18 @@  discard block
 block discarded – undo
108 108
 		$len_chars = count($chars);
109 109
 		$token = '';
110 110
 		
111
-		for ($i = 0; $i < $length; $i++)
112
-			$token .= $chars[ mt_rand(0, $len_chars - 1) ];
111
+		for ($i = 0; $i < $length; $i++) {
112
+					$token .= $chars[ mt_rand(0, $len_chars - 1) ];
113
+		}
113 114
 		
114 115
 		# Number of 32 char chunks
115 116
 		$chunks = ceil( strlen($token) / 32 );
116 117
 		$md5token = '';
117 118
 		
118 119
 		# Run each chunk through md5
119
-		for ( $i=1; $i<=$chunks; $i++ )
120
-			$md5token .= md5( substr($token, $i * 32 - 32, 32) );
120
+		for ( $i=1; $i<=$chunks; $i++ ) {
121
+					$md5token .= md5( substr($token, $i * 32 - 32, 32) );
122
+		}
121 123
 		
122 124
 			# Trim the token
123 125
 		return substr($md5token, 0, $length);		
@@ -130,8 +132,9 @@  discard block
 block discarded – undo
130 132
 	 */
131 133
 	protected static function getBase64EncryptionKey() {	    
132 134
 	    $key = 'STANDARDKEYIFNOSERVER';
133
-	    if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE')))
134
-	        $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE'));
135
+	    if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE'))) {
136
+	    	        $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE'));
137
+	    }
135 138
 	    
136 139
 	    return $key;
137 140
 	}
@@ -168,11 +171,13 @@  discard block
 block discarded – undo
168 171
 		$encrypted = str_replace('_', '/', $encrypted);
169 172
 		$encrypted = str_replace('*', '=', $encrypted);
170 173
 		$encrypted = base64_decode($encrypted);
171
-		if($encrypted === false)
172
-			throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.');
174
+		if($encrypted === false) {
175
+					throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.');
176
+		}
173 177
 		
174
-		if (mb_strlen($encrypted, '8bit') < (SODIUM_CRYPTO_SECRETBOX_NONCEBYTES + SODIUM_CRYPTO_SECRETBOX_MACBYTES))
175
-		    throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.');
178
+		if (mb_strlen($encrypted, '8bit') < (SODIUM_CRYPTO_SECRETBOX_NONCEBYTES + SODIUM_CRYPTO_SECRETBOX_MACBYTES)) {
179
+				    throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.');
180
+		}
176 181
 
177 182
 	    $nonce = mb_substr($encrypted, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit');
178 183
 	    $ciphertext = mb_substr($encrypted, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit');
@@ -222,7 +227,9 @@  discard block
 block discarded – undo
222 227
 	 * @return boolean True if path valid
223 228
 	 */
224 229
 	public static function isValidPath($filename, $acceptfolder = FALSE) {		
225
-		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
230
+		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) {
231
+			return true;
232
+		}
226 233
 		return false;
227 234
 	}
228 235
 	
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/AdminConfigController.php 1 patch
Braces   +14 added lines, -13 removed lines patch added patch discarded remove patch
@@ -78,7 +78,9 @@  discard block
 block discarded – undo
78 78
         
79 79
         $other_trees = array();
80 80
         foreach (Tree::getAll() as $tree) {
81
-            if($tree->getTreeId() != $wt_tree->getTreeId()) $other_trees[] = $tree;
81
+            if($tree->getTreeId() != $wt_tree->getTreeId()) {
82
+            	$other_trees[] = $tree;
83
+            }
82 84
         }      
83 85
         $data->set('other_trees', $other_trees);
84 86
         
@@ -177,7 +179,9 @@  discard block
 block discarded – undo
177 179
         
178 180
         // Generate an AJAX/JSON response for datatables to load a block of rows
179 181
         $search = Filter::postArray('search');
180
-        if($search) $search = $search['value'];
182
+        if($search) {
183
+        	$search = $search['value'];
184
+        }
181 185
         $start  = Filter::postInteger('start');
182 186
         $length = Filter::postInteger('length');
183 187
         $order  = Filter::postArray('order');
@@ -259,8 +263,7 @@  discard block
 block discarded – undo
259 263
     		            $datum[7] .= $top_level . '(' . $place_hierarchy['hierarchy'][$top_level - 1] . ')';
260 264
     		        }
261 265
     		        $datum[7] .= '</span>';
262
-		        }
263
-		        else {
266
+		        } else {
264 267
 		            $datum[6] = I18N::translate('Error when loading map.');
265 268
 		        }
266 269
 		    }
@@ -335,8 +338,7 @@  discard block
 block discarded – undo
335 338
                     if($use_map) {
336 339
                         $options->setMap(new OutlineMap($map_file));
337 340
                         $options->setMapLevel($map_top_level + 1);
338
-                    }
339
-                    else {
341
+                    } else {
340 342
                         $options->setMap(null);
341 343
                     }
342 344
                 }
@@ -347,8 +349,7 @@  discard block
 block discarded – undo
347 349
 					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$res->getId().'” has been updated.');
348 350
 					$ga = $res;
349 351
 					$success = true;
350
-				}
351
-				else {
352
+				} else {
352 353
 					FlashMessages::addMessage(I18N::translate('An error occured while updating the geographical dispersion analysis “%s”', $ga->getTitle()), 'danger');
353 354
 					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'. $ga->getId() .'” could not be updated. See error log.');
354 355
 				}
@@ -366,8 +367,7 @@  discard block
 block discarded – undo
366 367
 				FlashMessages::addMessage(I18N::translate('The geographical dispersion analysis “%s” has been successfully added.', $ga->getTitle()), 'success');
367 368
 				Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$ga->getId().'” has been added.');
368 369
 				$success = true;
369
-			}
370
-			else {
370
+			} else {
371 371
 				FlashMessages::addMessage(I18N::translate('An error occured while adding the geographical dispersion analysis “%s”', $description), 'danger');
372 372
 				Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis “'.$description.'” could not be added. See error log.');
373 373
 			}
@@ -377,8 +377,7 @@  discard block
 block discarded – undo
377 377
         if(!$success) {			
378 378
             if($ga) {
379 379
                 $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $wt_tree->getNameUrl();
380
-            }
381
-            else {
380
+            } else {
382 381
                 $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $wt_tree->getNameUrl();
383 382
             }
384 383
         }        
@@ -435,7 +434,9 @@  discard block
 block discarded – undo
435 434
         $data->set('map_list', $map_list);
436 435
     
437 436
         $gen_details = array(0 => I18N::translate('All'));
438
-        for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i;
437
+        for($i = 1; $i <= 10 ; $i++) {
438
+        	$gen_details[$i] = $i;
439
+        }
439 440
         $data->set('generation_details', $gen_details);
440 441
     
441 442
         ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render();
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Model/SosaProvider.php 1 patch
Braces   +77 added lines, -30 removed lines patch added patch discarded remove patch
@@ -84,21 +84,25 @@  discard block
 block discarded – undo
84 84
      * @param User $user
85 85
      */
86 86
     public function __construct(Tree $tree, User $user = null) {
87
-        if(self::$default_user === null) 
88
-            self::$default_user = User::find(-1);
87
+        if(self::$default_user === null) {
88
+                    self::$default_user = User::find(-1);
89
+        }
89 90
         
90 91
         $this->tree = $tree;
91 92
         $this->user = $user;
92 93
         $this->is_setup = true;
93
-        if($this->user === null) $this->user = Auth::user();
94
-        if(strlen($this->user->getUserId()) == 0) $this->user = self::$default_user;
94
+        if($this->user === null) {
95
+        	$this->user = Auth::user();
96
+        }
97
+        if(strlen($this->user->getUserId()) == 0) {
98
+        	$this->user = self::$default_user;
99
+        }
95 100
         
96 101
         // Check if the user, or the default user, has a root already setup;
97 102
         if(empty($this->getRootIndiId())) {
98 103
             if($this->user == self::$default_user) {  // If the default user is not setup
99 104
                 $this->is_setup = false;
100
-            }
101
-            else {
105
+            } else {
102 106
                 $this->user = self::$default_user;
103 107
                 $this->is_setup = $this->getRootIndiId() === null;
104 108
             }            
@@ -141,7 +145,9 @@  discard block
 block discarded – undo
141 145
      * Remove all Sosa entries related to the gedcom file and user
142 146
      */
143 147
     public function deleteAll() {
144
-        if(!$this->is_setup) return;
148
+        if(!$this->is_setup) {
149
+        	return;
150
+        }
145 151
         Database::prepare(
146 152
             'DELETE FROM `##maj_sosa`'.
147 153
             ' WHERE majs_gedcom_id= :tree_id and majs_user_id = :user_id ')
@@ -157,7 +163,9 @@  discard block
 block discarded – undo
157 163
      * @param int $sosa
158 164
      */
159 165
     public function deleteAncestors($sosa) {
160
-        if(!$this->is_setup) return;
166
+        if(!$this->is_setup) {
167
+        	return;
168
+        }
161 169
         $gen = Functions::getGeneration($sosa);
162 170
         Database::prepare(
163 171
             'DELETE FROM `##maj_sosa`'.
@@ -177,7 +185,9 @@  discard block
 block discarded – undo
177 185
      * @param array $sosa_records
178 186
      */
179 187
     public function insertOrUpdate($sosa_records) {
180
-        if(!$this->is_setup) return;
188
+        if(!$this->is_setup) {
189
+        	return;
190
+        }
181 191
         
182 192
         $treeid = $this->tree->getTreeId();
183 193
         $userid = $this->user->getUserId();
@@ -224,7 +234,9 @@  discard block
 block discarded – undo
224 234
      * @return array Array of sosa numbers
225 235
      */
226 236
     public function getSosaNumbers(Individual $indi) {
227
-        if(!$this->is_setup) return array();
237
+        if(!$this->is_setup) {
238
+        	return array();
239
+        }
228 240
         return Database::prepare(
229 241
                 'SELECT majs_sosa, majs_gen FROM `##maj_sosa`'.
230 242
                 ' WHERE majs_i_id=:indi_id AND majs_gedcom_id=:tree_id AND majs_user_id=:user_id'
@@ -241,7 +253,9 @@  discard block
 block discarded – undo
241 253
      * @return number Last generation if found, 1 otherwise
242 254
      */
243 255
     public function getLastGeneration() {
244
-        if(!$this->is_setup) return;
256
+        if(!$this->is_setup) {
257
+        	return;
258
+        }
245 259
         return Database::prepare(
246 260
                 'SELECT MAX(majs_gen) FROM `##maj_sosa`'.
247 261
                 ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'
@@ -261,7 +275,9 @@  discard block
 block discarded – undo
261 275
      * @return array Associative array of Sosa ancestors, with their generation, comma separated
262 276
      */
263 277
     public function getAllSosaWithGenerations(){
264
-        if(!$this->is_setup) return array();
278
+        if(!$this->is_setup) {
279
+        	return array();
280
+        }
265 281
         return Database::prepare(
266 282
             'SELECT majs_i_id AS indi,' .
267 283
             ' GROUP_CONCAT(DISTINCT majs_gen ORDER BY majs_gen ASC SEPARATOR ",") AS generations' .
@@ -281,9 +297,12 @@  discard block
 block discarded – undo
281 297
      * @return array Array of Sosa individuals
282 298
      */
283 299
     public function getSosaListAtGeneration($gen){
284
-        if(!$this->is_setup) return array();
285
-        if(!$this->sosa_list_by_gen)
286
-            $this->sosa_list_by_gen = array();
300
+        if(!$this->is_setup) {
301
+        	return array();
302
+        }
303
+        if(!$this->sosa_list_by_gen) {
304
+                    $this->sosa_list_by_gen = array();
305
+        }
287 306
         
288 307
         if($gen){
289 308
             if(!isset($this->sosa_list_by_gen[$gen])){
@@ -312,9 +331,12 @@  discard block
 block discarded – undo
312 331
      * @return array Array of Sosa families
313 332
      */
314 333
     public function getFamilySosaListAtGeneration($gen){
315
-        if(!$this->is_setup) return array();
316
-        if(!$this->sosa_fam_list_by_gen)
317
-            $this->sosa_fam_list_by_gen = array();
334
+        if(!$this->is_setup) {
335
+        	return array();
336
+        }
337
+        if(!$this->sosa_fam_list_by_gen) {
338
+                    $this->sosa_fam_list_by_gen = array();
339
+        }
318 340
         
319 341
         if($gen){
320 342
             if(!isset($this->sosa_fam_list_by_gen[$gen])){
@@ -348,7 +370,9 @@  discard block
 block discarded – undo
348 370
      * @return array Array of Sosa individuals
349 371
      */
350 372
     public function getMissingSosaListAtGeneration($gen){
351
-        if(!$this->is_setup) return array();    
373
+        if(!$this->is_setup) {
374
+        	return array();
375
+        }
352 376
         if($gen){
353 377
             return $this->sosa_list_by_gen[$gen] = Database::prepare(
354 378
                 'SELECT schild.majs_sosa sosa, schild.majs_i_id indi, sfat.majs_sosa IS NOT NULL has_father, smot.majs_sosa IS NOT NULL has_mother'.
@@ -386,7 +410,9 @@  discard block
 block discarded – undo
386 410
      * @return array Statistics array
387 411
      */
388 412
     public function getStatisticsByGeneration() {
389
-        if(!$this->is_setup) return array();
413
+        if(!$this->is_setup) {
414
+        	return array();
415
+        }
390 416
         if(!$this->statistics_tab) {
391 417
             $this->statistics_tab = array();
392 418
             if($maxGeneration = $this->getLastGeneration()) {
@@ -412,7 +438,9 @@  discard block
 block discarded – undo
412 438
 	 * @return int
413 439
 	 */
414 440
 	public function getTotalIndividuals() {
415
-	    if(!$this->is_setup) return 0;
441
+	    if(!$this->is_setup) {
442
+	    	return 0;
443
+	    }
416 444
 	    return Database::prepare(
417 445
 	        'SELECT COUNT(*) FROM `##individuals`' .
418 446
 	        ' WHERE i_file = :tree_id')
@@ -426,7 +454,9 @@  discard block
 block discarded – undo
426 454
      * @return number Number of Sosas
427 455
      */
428 456
     public function getSosaCount(){
429
-        if(!$this->is_setup) return 0;
457
+        if(!$this->is_setup) {
458
+        	return 0;
459
+        }
430 460
         return Database::prepare(
431 461
             'SELECT COUNT(majs_sosa) FROM `##maj_sosa`' .
432 462
             ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id')
@@ -443,7 +473,9 @@  discard block
 block discarded – undo
443 473
      * @return number Number of Sosas in generation
444 474
      */
445 475
     public function getSosaCountAtGeneration($gen){
446
-        if(!$this->is_setup) return 0;
476
+        if(!$this->is_setup) {
477
+        	return 0;
478
+        }
447 479
         return Database::prepare(
448 480
             'SELECT COUNT(majs_sosa) FROM `##maj_sosa`' .
449 481
             ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
@@ -462,7 +494,9 @@  discard block
 block discarded – undo
462 494
      * @return number Total number of Sosas up to generation
463 495
      */
464 496
     public function getSosaCountUpToGeneration($gen){
465
-        if(!$this->is_setup) return 0;
497
+        if(!$this->is_setup) {
498
+        	return 0;
499
+        }
466 500
         return Database::prepare(
467 501
             'SELECT COUNT(majs_sosa) FROM `##maj_sosa`' .
468 502
             ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
@@ -480,7 +514,9 @@  discard block
 block discarded – undo
480 514
      * @return number Total number of distinct individual
481 515
      */
482 516
     public function getDifferentSosaCount(){
483
-        if(!$this->is_setup) return 0;
517
+        if(!$this->is_setup) {
518
+        	return 0;
519
+        }
484 520
         return Database::prepare(
485 521
             'SELECT COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' .
486 522
             ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id')
@@ -497,7 +533,9 @@  discard block
 block discarded – undo
497 533
      * @return number Number of distinct Sosa individuals up to generation
498 534
      */
499 535
     public function getDifferentSosaCountUpToGeneration($gen){
500
-        if(!$this->is_setup) return 0;
536
+        if(!$this->is_setup) {
537
+        	return 0;
538
+        }
501 539
         return Database::prepare(
502 540
             'SELECT COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' .
503 541
             ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
@@ -520,7 +558,9 @@  discard block
 block discarded – undo
520 558
      * @return array Birth statistics array
521 559
      */
522 560
     public function getStatsBirthYearInGeneration($gen){
523
-        if(!$this->is_setup) return array('first' => 0, 'avg' => 0, 'last' => 0);
561
+        if(!$this->is_setup) {
562
+        	return array('first' => 0, 'avg' => 0, 'last' => 0);
563
+        }
524 564
         return Database::prepare(
525 565
             'SELECT MIN(majs_birth_year) AS first, AVG(majs_birth_year) AS avg, MAX(majs_birth_year) AS last'.
526 566
             ' FROM `##maj_sosa`' .
@@ -540,7 +580,9 @@  discard block
 block discarded – undo
540 580
      * @return number|NULL Mean generation time
541 581
      */
542 582
     public function getMeanGenerationTime(){
543
-        if(!$this->is_setup) return;
583
+        if(!$this->is_setup) {
584
+        	return;
585
+        }
544 586
         if(!$this->statistics_tab){
545 587
             $this->getStatisticsByGeneration();
546 588
         }
@@ -586,7 +628,10 @@  discard block
 block discarded – undo
586 628
      * @return array
587 629
      */
588 630
     public function getAncestorDispersionForGen($gen) {
589
-        if(!$this->is_setup || $gen > 11) return array();  // Going further than 11 gen will be out of range in the query
631
+        if(!$this->is_setup || $gen > 11) {
632
+        	return array();
633
+        }
634
+        // Going further than 11 gen will be out of range in the query
590 635
         return Database::prepare(
591 636
             'SELECT branches, count(i_id)'.
592 637
             ' FROM ('.
@@ -626,7 +671,9 @@  discard block
 block discarded – undo
626 671
      * @return array 
627 672
      */
628 673
     public function getTopMultiSosaAncestorsNoTies($limit) {
629
-        if(!$this->is_setup) return array();
674
+        if(!$this->is_setup) {
675
+        	return array();
676
+        }
630 677
         return Database::prepare(
631 678
             'SELECT sosa_i_id, sosa_count FROM ('.
632 679
             '   SELECT'.
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/OutlineMap.php 1 patch
Braces   +25 added lines, -10 removed lines patch added patch discarded remove patch
@@ -71,7 +71,9 @@  discard block
 block discarded – undo
71 71
         $this->is_loaded = false;
72 72
         $this->subdivisions = array();
73 73
         $this->mappings = array();
74
-        if($load) $this->load();
74
+        if($load) {
75
+        	$this->load();
76
+        }
75 77
     }
76 78
     
77 79
     /**
@@ -118,7 +120,9 @@  discard block
 block discarded – undo
118 120
                 foreach($xml->subdivisions->children() as $subdivision){
119 121
                     $attributes = $subdivision->attributes();
120 122
                     $key = I18N::strtolower(trim($attributes['name']));
121
-                    if(isset($attributes['parent'])) $key .= '@'. I18N::strtolower(trim($attributes['parent']));
123
+                    if(isset($attributes['parent'])) {
124
+                    	$key .= '@'. I18N::strtolower(trim($attributes['parent']));
125
+                    }
122 126
                     $this->subdivisions[$key] = array(
123 127
                         'id' => trim($attributes['id']),
124 128
                         'displayname' => trim($attributes['name']),
@@ -145,9 +149,10 @@  discard block
 block discarded – undo
145 149
      */
146 150
     public function isLoaded() {
147 151
         try{
148
-            if(!$this->is_loaded) $this->load();
149
-        }
150
-        catch (\Exception $ex) { }
152
+            if(!$this->is_loaded) {
153
+            	$this->load();
154
+            }
155
+        } catch (\Exception $ex) { }
151 156
         return $this->is_loaded;
152 157
     }
153 158
     
@@ -164,7 +169,9 @@  discard block
 block discarded – undo
164 169
 	 * @return string
165 170
 	 */
166 171
     public function getDescription() {
167
-        if(!$this->is_loaded) $this->load();
172
+        if(!$this->is_loaded) {
173
+        	$this->load();
174
+        }
168 175
         return $this->description;
169 176
     }
170 177
     
@@ -173,7 +180,9 @@  discard block
 block discarded – undo
173 180
 	 * @return string
174 181
 	 */
175 182
     public function getTopLevelName() {
176
-        if(!$this->is_loaded) $this->load();
183
+        if(!$this->is_loaded) {
184
+        	$this->load();
185
+        }
177 186
         return $this->top_level_name;
178 187
     }    
179 188
     
@@ -182,7 +191,9 @@  discard block
 block discarded – undo
182 191
      * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\OutlineMapCanvas
183 192
      */
184 193
     public function getCanvas() {
185
-        if(!$this->is_loaded) $this->load();
194
+        if(!$this->is_loaded) {
195
+        	$this->load();
196
+        }
186 197
         return $this->canvas;
187 198
     }
188 199
     
@@ -191,7 +202,9 @@  discard block
 block discarded – undo
191 202
      * @return array
192 203
      */
193 204
     public function getSubdivisions() {
194
-        if(!$this->is_loaded) $this->load();
205
+        if(!$this->is_loaded) {
206
+        	$this->load();
207
+        }
195 208
         return $this->subdivisions;
196 209
     }
197 210
     
@@ -200,7 +213,9 @@  discard block
 block discarded – undo
200 213
      * @return array
201 214
      */
202 215
     public function getPlacesMappings() {
203
-        if(!$this->is_loaded) $this->load();
216
+        if(!$this->is_loaded) {
217
+        	$this->load();
218
+        }
204 219
         return $this->mappings;
205 220
     }
206 221
     
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/GeoAnalysisController.php 1 patch
Braces   +28 added lines, -21 removed lines patch added patch discarded remove patch
@@ -144,14 +144,15 @@  discard block
 block discarded – undo
144 144
             $this->provider->setGeoAnalysisStatus($ga, $status);
145 145
             $res['status'] = $status;
146 146
 			Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '. ($status ? 'enabled' : 'disabled') .'.');
147
-        }
148
-        catch (\Exception $ex) {
147
+        } catch (\Exception $ex) {
149 148
             $res['error'] = $ex->getMessage();
150 149
 			Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage());
151 150
         }
152 151
         
153 152
         $controller->pageHeader();
154
-        if($res['error']) http_response_code(500);
153
+        if($res['error']) {
154
+        	http_response_code(500);
155
+        }
155 156
         
156 157
         $controller->encode($res);
157 158
     }
@@ -175,14 +176,15 @@  discard block
 block discarded – undo
175 176
         try{
176 177
             $this->provider->deleteGeoAnalysis($ga);
177 178
 			Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been deleted.');
178
-        }
179
-        catch (\Exception $ex) {
179
+        } catch (\Exception $ex) {
180 180
             $res['error'] = $ex->getMessage();
181 181
 			Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '. $ex->getMessage());
182 182
         }
183 183
     
184 184
         $controller->pageHeader();
185
-        if($res['error']) http_response_code(500);
185
+        if($res['error']) {
186
+        	http_response_code(500);
187
+        }
186 188
 
187 189
         $controller->encode($res);
188 190
     }
@@ -234,7 +236,9 @@  discard block
 block discarded – undo
234 236
             
235 237
             $nb_found = $placesGeneralResults['knownsum'];
236 238
             $nb_other = 0;
237
-            if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other'];
239
+            if(isset($placesGeneralResults['other'])) {
240
+            	$nb_other =$placesGeneralResults['other'];
241
+            }
238 242
             $nb_unknown = $placesGeneralResults['unknown'];
239 243
             
240 244
             $data->set('stats_gen_nb_found', $nb_found);
@@ -255,12 +259,13 @@  discard block
 block discarded – undo
255 259
                         if($level_map >= 0 && $level_map < count($levelvalues)) {
256 260
                             $levelref = I18N::strtolower($levelvalues[0] . '@' . $levelvalues[$level_map]);
257 261
                             if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; }
258
-                        }
259
-                        else {
262
+                        } else {
260 263
                             $levelref = $levelvalues[0];
261 264
                         }
262 265
                         $levelref = I18N::strtolower($levelref);
263
-                        if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref];
266
+                        if(isset($places_mappings[$levelref])) {
267
+                        	$levelref = $places_mappings[$levelref];
268
+                        }
264 269
                         if(isset($results_by_subdivs[$levelref])) {
265 270
                             $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0;
266 271
                             $count_subd  += $count;
@@ -278,8 +283,7 @@  discard block
 block discarded – undo
278 283
                 }
279 284
                 
280 285
                 $html = ViewFactory::make('GeoAnalysisTabGeneralMap', $this, new BaseController(), $data)->getHtmlPartial();
281
-            }
282
-            else {
286
+            } else {
283 287
                 $results = $placesGeneralResults['places'];
284 288
                 arsort($results);
285 289
                 $data->set('results', $results);
@@ -287,8 +291,7 @@  discard block
 block discarded – undo
287 291
                 
288 292
                 $html = ViewFactory::make('GeoAnalysisTabGeneralTable', $this, new BaseController(), $data)->getHtmlPartial();
289 293
             }
290
-        }
291
-        else {
294
+        } else {
292 295
             $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>';
293 296
         }
294 297
         return $html;
@@ -320,9 +323,15 @@  discard block
 block discarded – undo
320 323
                 $sum = 0;
321 324
                 $other = 0;
322 325
                 $unknown = 0;
323
-                if(isset($genData['sum'])) $sum = $genData['sum'];
324
-                if(isset($genData['other'])) $other = $genData['other'];
325
-                if(isset($genData['unknown'])) $unknown = $genData['unknown'];
326
+                if(isset($genData['sum'])) {
327
+                	$sum = $genData['sum'];
328
+                }
329
+                if(isset($genData['other'])) {
330
+                	$other = $genData['other'];
331
+                }
332
+                if(isset($genData['unknown'])) {
333
+                	$unknown = $genData['unknown'];
334
+                }
326 335
                 
327 336
                 if($sum > 0) {                
328 337
                     $results_by_gen[$gen]['sum'] = $sum;
@@ -340,8 +349,7 @@  discard block
 block discarded – undo
340 349
                                 $results_by_gen[$gen]['places'][$placename]['flag'] = $flag;
341 350
                             }
342 351
                         }
343
-                    }
344
-                    else {
352
+                    } else {
345 353
                         $tmp = $genData['places'];
346 354
                         if($other > 0) {
347 355
                             $tmp = array_slice($tmp, 0, 5, true);
@@ -357,8 +365,7 @@  discard block
 block discarded – undo
357 365
             
358 366
             $html = ViewFactory::make('GeoAnalysisTabGenerations', $this, new BaseController(), $data)->getHtmlPartial();
359 367
             
360
-        }
361
-        else {
368
+        } else {
362 369
             $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>';
363 370
         }
364 371
         return $html;
Please login to merge, or discard this patch.