Test Failed
Branch master (4a3c5b)
by Greg
12:31
created
app/Functions/Functions.php 1 patch
Switch Indentation   +1458 added lines, -1458 removed lines patch added patch discarded remove patch
@@ -79,29 +79,29 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public static function fileUploadErrorText($error_code) {
81 81
 		switch ($error_code) {
82
-		case UPLOAD_ERR_OK:
83
-			return I18N::translate('File successfully uploaded');
84
-		case UPLOAD_ERR_INI_SIZE:
85
-		case UPLOAD_ERR_FORM_SIZE:
86
-			// I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
87
-			return I18N::translate('The uploaded file exceeds the allowed size.');
88
-		case UPLOAD_ERR_PARTIAL:
89
-			// I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
90
-			return I18N::translate('The file was only partially uploaded. Please try again.');
91
-		case UPLOAD_ERR_NO_FILE:
92
-			// I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
93
-			return I18N::translate('No file was received. Please try again.');
94
-		case UPLOAD_ERR_NO_TMP_DIR:
95
-			// I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
96
-			return I18N::translate('The PHP temporary folder is missing.');
97
-		case UPLOAD_ERR_CANT_WRITE:
98
-			// I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
99
-			return I18N::translate('PHP failed to write to disk.');
100
-		case UPLOAD_ERR_EXTENSION:
101
-			// I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
102
-			return I18N::translate('PHP blocked the file because of its extension.');
103
-		default:
104
-			return 'Error: ' . $error_code;
82
+			case UPLOAD_ERR_OK:
83
+				return I18N::translate('File successfully uploaded');
84
+			case UPLOAD_ERR_INI_SIZE:
85
+			case UPLOAD_ERR_FORM_SIZE:
86
+				// I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
87
+				return I18N::translate('The uploaded file exceeds the allowed size.');
88
+			case UPLOAD_ERR_PARTIAL:
89
+				// I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
90
+				return I18N::translate('The file was only partially uploaded. Please try again.');
91
+			case UPLOAD_ERR_NO_FILE:
92
+				// I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
93
+				return I18N::translate('No file was received. Please try again.');
94
+			case UPLOAD_ERR_NO_TMP_DIR:
95
+				// I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
96
+				return I18N::translate('The PHP temporary folder is missing.');
97
+			case UPLOAD_ERR_CANT_WRITE:
98
+				// I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
99
+				return I18N::translate('PHP failed to write to disk.');
100
+			case UPLOAD_ERR_EXTENSION:
101
+				// I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
102
+				return I18N::translate('PHP blocked the file because of its extension.');
103
+			default:
104
+				return 'Error: ' . $error_code;
105 105
 		}
106 106
 	}
107 107
 
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 	 */
269 269
 	private static function reflexivePronoun(Individual $individual) {
270 270
 		switch ($individual->getSex()) {
271
-		case 'M':
272
-			return /* I18N: reflexive pronoun */ I18N::translate('himself');
273
-		case 'F':
274
-			return /* I18N: reflexive pronoun */ I18N::translate('herself');
275
-		default:
276
-			return /* I18N: reflexive pronoun - gender neutral version of himself/herself */ I18N::translate('themself');
271
+			case 'M':
272
+				return /* I18N: reflexive pronoun */ I18N::translate('himself');
273
+			case 'F':
274
+				return /* I18N: reflexive pronoun */ I18N::translate('herself');
275
+			default:
276
+				return /* I18N: reflexive pronoun - gender neutral version of himself/herself */ I18N::translate('themself');
277 277
 		}
278 278
 	}
279 279
 
@@ -436,127 +436,127 @@  discard block
 block discarded – undo
436 436
 	 */
437 437
 	public static function cousinName($n, $sex) {
438 438
 		switch ($sex) {
439
-		case 'M':
440
-			switch ($n) {
441
-			case  1:
442
-			/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
443
-			return I18N::translateContext('MALE', 'first cousin');
444
-			case  2:
445
-			/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
446
-			return I18N::translateContext('MALE', 'second cousin');
447
-			case  3:
448
-			/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
449
-			return I18N::translateContext('MALE', 'third cousin');
450
-			case  4:
451
-			/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
452
-			return I18N::translateContext('MALE', 'fourth cousin');
453
-			case  5:
454
-			/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
455
-			return I18N::translateContext('MALE', 'fifth cousin');
456
-			case  6:
457
-			/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
458
-			return I18N::translateContext('MALE', 'sixth cousin');
459
-			case  7:
460
-			/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
461
-			return I18N::translateContext('MALE', 'seventh cousin');
462
-			case  8:
463
-			/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
464
-			return I18N::translateContext('MALE', 'eighth cousin');
465
-			case  9:
466
-			/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
467
-			return I18N::translateContext('MALE', 'ninth cousin');
468
-			case 10:
469
-			/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
470
-			return I18N::translateContext('MALE', 'tenth cousin');
471
-			case 11:
472
-			/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
473
-			return I18N::translateContext('MALE', 'eleventh cousin');
474
-			case 12:
475
-			/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
476
-			return I18N::translateContext('MALE', 'twelfth cousin');
477
-			case 13:
478
-			/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
479
-			return I18N::translateContext('MALE', 'thirteenth cousin');
480
-			case 14:
481
-			/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
482
-			return I18N::translateContext('MALE', 'fourteenth cousin');
483
-			case 15:
484
-			/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
485
-			return I18N::translateContext('MALE', 'fifteenth cousin');
486
-			default:
487
-			/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
488
-			return I18N::translateContext('MALE', '%s × cousin', I18N::number($n));
489
-			}
490
-		case 'F':
491
-			switch ($n) {
492
-			case  1:
493
-			return I18N::translateContext('FEMALE', 'first cousin');
494
-			case  2:
495
-			return I18N::translateContext('FEMALE', 'second cousin');
496
-			case  3:
497
-			return I18N::translateContext('FEMALE', 'third cousin');
498
-			case  4:
499
-			return I18N::translateContext('FEMALE', 'fourth cousin');
500
-			case  5:
501
-			return I18N::translateContext('FEMALE', 'fifth cousin');
502
-			case  6:
503
-			return I18N::translateContext('FEMALE', 'sixth cousin');
504
-			case  7:
505
-			return I18N::translateContext('FEMALE', 'seventh cousin');
506
-			case  8:
507
-			return I18N::translateContext('FEMALE', 'eighth cousin');
508
-			case  9:
509
-			return I18N::translateContext('FEMALE', 'ninth cousin');
510
-			case 10:
511
-			return I18N::translateContext('FEMALE', 'tenth cousin');
512
-			case 11:
513
-			return I18N::translateContext('FEMALE', 'eleventh cousin');
514
-			case 12:
515
-			return I18N::translateContext('FEMALE', 'twelfth cousin');
516
-			case 13:
517
-			return I18N::translateContext('FEMALE', 'thirteenth cousin');
518
-			case 14:
519
-			return I18N::translateContext('FEMALE', 'fourteenth cousin');
520
-			case 15:
521
-			return I18N::translateContext('FEMALE', 'fifteenth cousin');
522
-			default:
523
-			return I18N::translateContext('FEMALE', '%s × cousin', I18N::number($n));
524
-			}
525
-		default:
526
-			switch ($n) {
527
-			case  1:
528
-			return I18N::translate('first cousin');
529
-			case  2:
530
-			return I18N::translate('second cousin');
531
-			case  3:
532
-			return I18N::translate('third cousin');
533
-			case  4:
534
-			return I18N::translate('fourth cousin');
535
-			case  5:
536
-			return I18N::translate('fifth cousin');
537
-			case  6:
538
-			return I18N::translate('sixth cousin');
539
-			case  7:
540
-			return I18N::translate('seventh cousin');
541
-			case  8:
542
-			return I18N::translate('eighth cousin');
543
-			case  9:
544
-			return I18N::translate('ninth cousin');
545
-			case 10:
546
-			return I18N::translate('tenth cousin');
547
-			case 11:
548
-			return I18N::translate('eleventh cousin');
549
-			case 12:
550
-			return I18N::translate('twelfth cousin');
551
-			case 13:
552
-			return I18N::translate('thirteenth cousin');
553
-			case 14:
554
-			return I18N::translate('fourteenth cousin');
555
-			case 15:
556
-			return I18N::translate('fifteenth cousin');
439
+			case 'M':
440
+				switch ($n) {
441
+					case  1:
442
+					/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
443
+					return I18N::translateContext('MALE', 'first cousin');
444
+					case  2:
445
+					/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
446
+					return I18N::translateContext('MALE', 'second cousin');
447
+					case  3:
448
+					/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
449
+					return I18N::translateContext('MALE', 'third cousin');
450
+					case  4:
451
+					/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
452
+					return I18N::translateContext('MALE', 'fourth cousin');
453
+					case  5:
454
+					/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
455
+					return I18N::translateContext('MALE', 'fifth cousin');
456
+					case  6:
457
+					/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
458
+					return I18N::translateContext('MALE', 'sixth cousin');
459
+					case  7:
460
+					/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
461
+					return I18N::translateContext('MALE', 'seventh cousin');
462
+					case  8:
463
+					/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
464
+					return I18N::translateContext('MALE', 'eighth cousin');
465
+					case  9:
466
+					/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
467
+					return I18N::translateContext('MALE', 'ninth cousin');
468
+					case 10:
469
+					/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
470
+					return I18N::translateContext('MALE', 'tenth cousin');
471
+					case 11:
472
+					/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
473
+					return I18N::translateContext('MALE', 'eleventh cousin');
474
+					case 12:
475
+					/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
476
+					return I18N::translateContext('MALE', 'twelfth cousin');
477
+					case 13:
478
+					/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
479
+					return I18N::translateContext('MALE', 'thirteenth cousin');
480
+					case 14:
481
+					/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
482
+					return I18N::translateContext('MALE', 'fourteenth cousin');
483
+					case 15:
484
+					/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
485
+					return I18N::translateContext('MALE', 'fifteenth cousin');
486
+					default:
487
+					/* I18N: Note that for Italian and Polish, “N’th cousins” are different from English “N’th cousins”, and the software has already generated the correct “N” for your language. You only need to translate - you do not need to convert. For other languages, if your cousin rules are different from English, please contact the developers. */
488
+					return I18N::translateContext('MALE', '%s × cousin', I18N::number($n));
489
+				}
490
+			case 'F':
491
+				switch ($n) {
492
+					case  1:
493
+					return I18N::translateContext('FEMALE', 'first cousin');
494
+					case  2:
495
+					return I18N::translateContext('FEMALE', 'second cousin');
496
+					case  3:
497
+					return I18N::translateContext('FEMALE', 'third cousin');
498
+					case  4:
499
+					return I18N::translateContext('FEMALE', 'fourth cousin');
500
+					case  5:
501
+					return I18N::translateContext('FEMALE', 'fifth cousin');
502
+					case  6:
503
+					return I18N::translateContext('FEMALE', 'sixth cousin');
504
+					case  7:
505
+					return I18N::translateContext('FEMALE', 'seventh cousin');
506
+					case  8:
507
+					return I18N::translateContext('FEMALE', 'eighth cousin');
508
+					case  9:
509
+					return I18N::translateContext('FEMALE', 'ninth cousin');
510
+					case 10:
511
+					return I18N::translateContext('FEMALE', 'tenth cousin');
512
+					case 11:
513
+					return I18N::translateContext('FEMALE', 'eleventh cousin');
514
+					case 12:
515
+					return I18N::translateContext('FEMALE', 'twelfth cousin');
516
+					case 13:
517
+					return I18N::translateContext('FEMALE', 'thirteenth cousin');
518
+					case 14:
519
+					return I18N::translateContext('FEMALE', 'fourteenth cousin');
520
+					case 15:
521
+					return I18N::translateContext('FEMALE', 'fifteenth cousin');
522
+					default:
523
+					return I18N::translateContext('FEMALE', '%s × cousin', I18N::number($n));
524
+				}
557 525
 			default:
558
-			return I18N::translate('%s × cousin', I18N::number($n));
559
-			}
526
+				switch ($n) {
527
+					case  1:
528
+					return I18N::translate('first cousin');
529
+					case  2:
530
+					return I18N::translate('second cousin');
531
+					case  3:
532
+					return I18N::translate('third cousin');
533
+					case  4:
534
+					return I18N::translate('fourth cousin');
535
+					case  5:
536
+					return I18N::translate('fifth cousin');
537
+					case  6:
538
+					return I18N::translate('sixth cousin');
539
+					case  7:
540
+					return I18N::translate('seventh cousin');
541
+					case  8:
542
+					return I18N::translate('eighth cousin');
543
+					case  9:
544
+					return I18N::translate('ninth cousin');
545
+					case 10:
546
+					return I18N::translate('tenth cousin');
547
+					case 11:
548
+					return I18N::translate('eleventh cousin');
549
+					case 12:
550
+					return I18N::translate('twelfth cousin');
551
+					case 13:
552
+					return I18N::translate('thirteenth cousin');
553
+					case 14:
554
+					return I18N::translate('fourteenth cousin');
555
+					case 15:
556
+					return I18N::translate('fifteenth cousin');
557
+					default:
558
+					return I18N::translate('%s × cousin', I18N::number($n));
559
+				}
560 560
 		}
561 561
 	}
562 562
 
@@ -572,51 +572,51 @@  discard block
 block discarded – undo
572 572
 	 */
573 573
 	public static function cousinName2($n, $sex, $relation) {
574 574
 		switch ($sex) {
575
-		case 'M':
576
-			switch ($n) {
577
-			case  1:
578
-				return /* I18N: A Spanish relationship name, such as third great-nephew */ I18N::translateContext('MALE', 'first %s', $relation);
579
-			case  2:
580
-				return I18N::translateContext('MALE', 'second %s', $relation);
581
-			case  3:
582
-				return I18N::translateContext('MALE', 'third %s', $relation);
583
-			case  4:
584
-				return I18N::translateContext('MALE', 'fourth %s', $relation);
585
-			case  5:
586
-				return I18N::translateContext('MALE', 'fifth %s', $relation);
587
-			default:
588
-				return /* I18N: A Spanish relationship name, such as third great-nephew */ I18N::translateContext('MALE', '%1$s × %2$s', I18N::number($n), $relation);
589
-			}
590
-		case 'F':
591
-			switch ($n) {
592
-			case  1:
593
-				return /* I18N: A Spanish relationship name, such as third great-nephew */ I18N::translateContext('FEMALE', 'first %s', $relation);
594
-			case  2:
595
-				return I18N::translateContext('FEMALE', 'second %s', $relation);
596
-			case  3:
597
-				return I18N::translateContext('FEMALE', 'third %s', $relation);
598
-			case  4:
599
-				return I18N::translateContext('FEMALE', 'fourth %s', $relation);
600
-			case  5:
601
-				return I18N::translateContext('FEMALE', 'fifth %s', $relation);
602
-			default: // I18N: A Spanish relationship name, such as third great-nephew
603
-				return I18N::translateContext('FEMALE', '%1$s × %2$s', I18N::number($n), $relation);
604
-			}
605
-		default:
606
-			switch ($n) {
607
-			case  1:
608
-				return /* I18N: A Spanish relationship name, such as first great-nephew */ I18N::translate('first %s', $relation);
609
-			case  2:
610
-				return /* I18N: A Spanish relationship name, such as second great-nephew */ I18N::translate('second %s', $relation);
611
-			case  3:
612
-				return /* I18N: A Spanish relationship name, such as third great-nephew */ I18N::translate('third %s', $relation);
613
-			case  4:
614
-				return /* I18N: A Spanish relationship name, such as fourth great-nephew */ I18N::translate('fourth %s', $relation);
615
-			case  5:
616
-				return /* I18N: A Spanish relationship name, such as fifth great-nephew */ I18N::translate('fifth %s', $relation);
575
+			case 'M':
576
+				switch ($n) {
577
+					case  1:
578
+						return /* I18N: A Spanish relationship name, such as third great-nephew */ I18N::translateContext('MALE', 'first %s', $relation);
579
+					case  2:
580
+						return I18N::translateContext('MALE', 'second %s', $relation);
581
+					case  3:
582
+						return I18N::translateContext('MALE', 'third %s', $relation);
583
+					case  4:
584
+						return I18N::translateContext('MALE', 'fourth %s', $relation);
585
+					case  5:
586
+						return I18N::translateContext('MALE', 'fifth %s', $relation);
587
+					default:
588
+						return /* I18N: A Spanish relationship name, such as third great-nephew */ I18N::translateContext('MALE', '%1$s × %2$s', I18N::number($n), $relation);
589
+				}
590
+			case 'F':
591
+				switch ($n) {
592
+					case  1:
593
+						return /* I18N: A Spanish relationship name, such as third great-nephew */ I18N::translateContext('FEMALE', 'first %s', $relation);
594
+					case  2:
595
+						return I18N::translateContext('FEMALE', 'second %s', $relation);
596
+					case  3:
597
+						return I18N::translateContext('FEMALE', 'third %s', $relation);
598
+					case  4:
599
+						return I18N::translateContext('FEMALE', 'fourth %s', $relation);
600
+					case  5:
601
+						return I18N::translateContext('FEMALE', 'fifth %s', $relation);
602
+					default: // I18N: A Spanish relationship name, such as third great-nephew
603
+						return I18N::translateContext('FEMALE', '%1$s × %2$s', I18N::number($n), $relation);
604
+				}
617 605
 			default:
618
-				return /* I18N: A Spanish relationship name, such as 7th great-nephew */ I18N::translate('%1$s × %2$s', I18N::number($n), $relation);
619
-			}
606
+				switch ($n) {
607
+					case  1:
608
+						return /* I18N: A Spanish relationship name, such as first great-nephew */ I18N::translate('first %s', $relation);
609
+					case  2:
610
+						return /* I18N: A Spanish relationship name, such as second great-nephew */ I18N::translate('second %s', $relation);
611
+					case  3:
612
+						return /* I18N: A Spanish relationship name, such as third great-nephew */ I18N::translate('third %s', $relation);
613
+					case  4:
614
+						return /* I18N: A Spanish relationship name, such as fourth great-nephew */ I18N::translate('fourth %s', $relation);
615
+					case  5:
616
+						return /* I18N: A Spanish relationship name, such as fifth great-nephew */ I18N::translate('fifth %s', $relation);
617
+					default:
618
+						return /* I18N: A Spanish relationship name, such as 7th great-nephew */ I18N::translate('%1$s × %2$s', I18N::number($n), $relation);
619
+				}
620 620
 		}
621 621
 	}
622 622
 
@@ -653,796 +653,796 @@  discard block
 block discarded – undo
653 653
 		}
654 654
 
655 655
 		switch ($path) {
656
-		case '':
657
-			return I18N::translate('self');
658
-		//  Level One relationships
659
-		case 'mot':
660
-			return I18N::translate('mother');
661
-		case 'fat':
662
-			return I18N::translate('father');
663
-		case 'par':
664
-			return I18N::translate('parent');
665
-		case 'hus':
666
-			if ($person1 && $person2) {
667
-				foreach ($person1->getSpouseFamilies() as $family) {
668
-					if ($person2 === $family->getSpouse($person1)) {
669
-						if ($family->getFacts('MARR')) {
670
-							if ($family->getFacts(WT_EVENTS_DIV)) {
671
-								return I18N::translate('ex-husband');
672
-							} else {
673
-								return I18N::translate('husband');
656
+			case '':
657
+				return I18N::translate('self');
658
+			//  Level One relationships
659
+			case 'mot':
660
+				return I18N::translate('mother');
661
+			case 'fat':
662
+				return I18N::translate('father');
663
+			case 'par':
664
+				return I18N::translate('parent');
665
+			case 'hus':
666
+				if ($person1 && $person2) {
667
+					foreach ($person1->getSpouseFamilies() as $family) {
668
+						if ($person2 === $family->getSpouse($person1)) {
669
+							if ($family->getFacts('MARR')) {
670
+								if ($family->getFacts(WT_EVENTS_DIV)) {
671
+									return I18N::translate('ex-husband');
672
+								} else {
673
+									return I18N::translate('husband');
674
+								}
675
+							} elseif ($family->getFacts(WT_EVENTS_DIV)) {
676
+								return I18N::translateContext('MALE', 'ex-partner');
674 677
 							}
675
-						} elseif ($family->getFacts(WT_EVENTS_DIV)) {
676
-							return I18N::translateContext('MALE', 'ex-partner');
677 678
 						}
678 679
 					}
679 680
 				}
680
-			}
681 681
 
682
-			return I18N::translateContext('MALE', 'partner');
683
-		case 'wif':
684
-			if ($person1 && $person2) {
685
-				foreach ($person1->getSpouseFamilies() as $family) {
686
-					if ($person2 === $family->getSpouse($person1)) {
687
-						if ($family->getFacts('MARR')) {
688
-							if ($family->getFacts(WT_EVENTS_DIV)) {
689
-								return I18N::translate('ex-wife');
690
-							} else {
691
-								return I18N::translate('wife');
682
+				return I18N::translateContext('MALE', 'partner');
683
+			case 'wif':
684
+				if ($person1 && $person2) {
685
+					foreach ($person1->getSpouseFamilies() as $family) {
686
+						if ($person2 === $family->getSpouse($person1)) {
687
+							if ($family->getFacts('MARR')) {
688
+								if ($family->getFacts(WT_EVENTS_DIV)) {
689
+									return I18N::translate('ex-wife');
690
+								} else {
691
+									return I18N::translate('wife');
692
+								}
693
+							} elseif ($family->getFacts(WT_EVENTS_DIV)) {
694
+								return I18N::translateContext('FEMALE', 'ex-partner');
692 695
 							}
693
-						} elseif ($family->getFacts(WT_EVENTS_DIV)) {
694
-							return I18N::translateContext('FEMALE', 'ex-partner');
695 696
 						}
696 697
 					}
697 698
 				}
698
-			}
699 699
 
700
-			return I18N::translateContext('FEMALE', 'partner');
701
-		case 'spo':
702
-			if ($person1 && $person2) {
703
-				foreach ($person1->getSpouseFamilies() as $family) {
704
-					if ($person2 === $family->getSpouse($person1)) {
705
-						if ($family->getFacts('MARR')) {
706
-							if ($family->getFacts(WT_EVENTS_DIV)) {
707
-								return I18N::translate('ex-spouse');
708
-							} else {
709
-								return I18N::translate('spouse');
700
+				return I18N::translateContext('FEMALE', 'partner');
701
+			case 'spo':
702
+				if ($person1 && $person2) {
703
+					foreach ($person1->getSpouseFamilies() as $family) {
704
+						if ($person2 === $family->getSpouse($person1)) {
705
+							if ($family->getFacts('MARR')) {
706
+								if ($family->getFacts(WT_EVENTS_DIV)) {
707
+									return I18N::translate('ex-spouse');
708
+								} else {
709
+									return I18N::translate('spouse');
710
+								}
711
+							} elseif ($family->getFacts(WT_EVENTS_DIV)) {
712
+								return I18N::translate('ex-partner');
710 713
 							}
711
-						} elseif ($family->getFacts(WT_EVENTS_DIV)) {
712
-							return I18N::translate('ex-partner');
713 714
 						}
714 715
 					}
715 716
 				}
716
-			}
717 717
 
718
-			return I18N::translate('partner');
719
-		case 'son':
720
-			return I18N::translate('son');
721
-		case 'dau':
722
-			return I18N::translate('daughter');
723
-		case 'chi':
724
-			return I18N::translate('child');
725
-		case 'bro':
726
-			if ($person1 && $person2) {
727
-				$dob1 = $person1->getBirthDate();
728
-				$dob2 = $person2->getBirthDate();
729
-				if ($dob1->isOK() && $dob2->isOK()) {
730
-					if (abs($dob1->julianDay() - $dob2->julianDay()) < 2 && !$dob1->minimumDate()->d !== 0 && !$dob2->minimumDate()->d !== 0) {
731
-						// Exclude BEF, AFT, etc.
732
-						return I18N::translate('twin brother');
733
-					} elseif ($dob1->maximumJulianDay() < $dob2->minimumJulianDay()) {
734
-						return I18N::translate('younger brother');
735
-					} elseif ($dob1->minimumJulianDay() > $dob2->maximumJulianDay()) {
736
-						return I18N::translate('elder brother');
718
+				return I18N::translate('partner');
719
+			case 'son':
720
+				return I18N::translate('son');
721
+			case 'dau':
722
+				return I18N::translate('daughter');
723
+			case 'chi':
724
+				return I18N::translate('child');
725
+			case 'bro':
726
+				if ($person1 && $person2) {
727
+					$dob1 = $person1->getBirthDate();
728
+					$dob2 = $person2->getBirthDate();
729
+					if ($dob1->isOK() && $dob2->isOK()) {
730
+						if (abs($dob1->julianDay() - $dob2->julianDay()) < 2 && !$dob1->minimumDate()->d !== 0 && !$dob2->minimumDate()->d !== 0) {
731
+							// Exclude BEF, AFT, etc.
732
+							return I18N::translate('twin brother');
733
+						} elseif ($dob1->maximumJulianDay() < $dob2->minimumJulianDay()) {
734
+							return I18N::translate('younger brother');
735
+						} elseif ($dob1->minimumJulianDay() > $dob2->maximumJulianDay()) {
736
+							return I18N::translate('elder brother');
737
+						}
737 738
 					}
738 739
 				}
739
-			}
740 740
 
741
-			return I18N::translate('brother');
742
-		case 'sis':
743
-			if ($person1 && $person2) {
744
-				$dob1 = $person1->getBirthDate();
745
-				$dob2 = $person2->getBirthDate();
746
-				if ($dob1->isOK() && $dob2->isOK()) {
747
-					if (abs($dob1->julianDay() - $dob2->julianDay()) < 2 && !$dob1->minimumDate()->d !== 0 && !$dob2->minimumDate()->d !== 0) {
748
-						// Exclude BEF, AFT, etc.
749
-						return I18N::translate('twin sister');
750
-					} elseif ($dob1->maximumJulianDay() < $dob2->minimumJulianDay()) {
751
-						return I18N::translate('younger sister');
752
-					} elseif ($dob1->minimumJulianDay() > $dob2->maximumJulianDay()) {
753
-						return I18N::translate('elder sister');
741
+				return I18N::translate('brother');
742
+			case 'sis':
743
+				if ($person1 && $person2) {
744
+					$dob1 = $person1->getBirthDate();
745
+					$dob2 = $person2->getBirthDate();
746
+					if ($dob1->isOK() && $dob2->isOK()) {
747
+						if (abs($dob1->julianDay() - $dob2->julianDay()) < 2 && !$dob1->minimumDate()->d !== 0 && !$dob2->minimumDate()->d !== 0) {
748
+							// Exclude BEF, AFT, etc.
749
+							return I18N::translate('twin sister');
750
+						} elseif ($dob1->maximumJulianDay() < $dob2->minimumJulianDay()) {
751
+							return I18N::translate('younger sister');
752
+						} elseif ($dob1->minimumJulianDay() > $dob2->maximumJulianDay()) {
753
+							return I18N::translate('elder sister');
754
+						}
754 755
 					}
755 756
 				}
756
-			}
757 757
 
758
-			return I18N::translate('sister');
759
-		case 'sib':
760
-			if ($person1 && $person2) {
761
-				$dob1 = $person1->getBirthDate();
762
-				$dob2 = $person2->getBirthDate();
763
-				if ($dob1->isOK() && $dob2->isOK()) {
764
-					if (abs($dob1->julianDay() - $dob2->julianDay()) < 2 && !$dob1->minimumDate()->d !== 0 && !$dob2->minimumDate()->d !== 0) {
765
-						// Exclude BEF, AFT, etc.
766
-						return I18N::translate('twin sibling');
767
-					} elseif ($dob1->maximumJulianDay() < $dob2->minimumJulianDay()) {
768
-						return I18N::translate('younger sibling');
769
-					} elseif ($dob1->minimumJulianDay() > $dob2->maximumJulianDay()) {
770
-						return I18N::translate('elder sibling');
758
+				return I18N::translate('sister');
759
+			case 'sib':
760
+				if ($person1 && $person2) {
761
+					$dob1 = $person1->getBirthDate();
762
+					$dob2 = $person2->getBirthDate();
763
+					if ($dob1->isOK() && $dob2->isOK()) {
764
+						if (abs($dob1->julianDay() - $dob2->julianDay()) < 2 && !$dob1->minimumDate()->d !== 0 && !$dob2->minimumDate()->d !== 0) {
765
+							// Exclude BEF, AFT, etc.
766
+							return I18N::translate('twin sibling');
767
+						} elseif ($dob1->maximumJulianDay() < $dob2->minimumJulianDay()) {
768
+							return I18N::translate('younger sibling');
769
+						} elseif ($dob1->minimumJulianDay() > $dob2->maximumJulianDay()) {
770
+							return I18N::translate('elder sibling');
771
+						}
771 772
 					}
772 773
 				}
773
-			}
774 774
 
775
-			return I18N::translate('sibling');
775
+				return I18N::translate('sibling');
776 776
 
777
-		// Level Two relationships
778
-		case 'brochi':
779
-			return I18N::translateContext('brother’s child', 'nephew/niece');
780
-		case 'brodau':
781
-			return I18N::translateContext('brother’s daughter', 'niece');
782
-		case 'broson':
783
-			return I18N::translateContext('brother’s son', 'nephew');
784
-		case 'browif':
785
-			return I18N::translateContext('brother’s wife', 'sister-in-law');
786
-		case 'chichi':
787
-			return I18N::translateContext('child’s child', 'grandchild');
788
-		case 'chidau':
789
-			return I18N::translateContext('child’s daughter', 'granddaughter');
790
-		case 'chihus':
791
-			return I18N::translateContext('child’s husband', 'son-in-law');
792
-		case 'chison':
793
-			return I18N::translateContext('child’s son', 'grandson');
794
-		case 'chispo':
795
-			return I18N::translateContext('child’s spouse', 'son/daughter-in-law');
796
-		case 'chiwif':
797
-			return I18N::translateContext('child’s wife', 'daughter-in-law');
798
-		case 'dauchi':
799
-			return I18N::translateContext('daughter’s child', 'grandchild');
800
-		case 'daudau':
801
-			return I18N::translateContext('daughter’s daughter', 'granddaughter');
802
-		case 'dauhus':
803
-			return I18N::translateContext('daughter’s husband', 'son-in-law');
804
-		case 'dauson':
805
-			return I18N::translateContext('daughter’s son', 'grandson');
806
-		case 'fatbro':
807
-			return I18N::translateContext('father’s brother', 'uncle');
808
-		case 'fatchi':
809
-			return I18N::translateContext('father’s child', 'half-sibling');
810
-		case 'fatdau':
811
-			return I18N::translateContext('father’s daughter', 'half-sister');
812
-		case 'fatfat':
813
-			return I18N::translateContext('father’s father', 'paternal grandfather');
814
-		case 'fatmot':
815
-			return I18N::translateContext('father’s mother', 'paternal grandmother');
816
-		case 'fatpar':
817
-			return I18N::translateContext('father’s parent', 'paternal grandparent');
818
-		case 'fatsib':
819
-			return I18N::translateContext('father’s sibling', 'aunt/uncle');
820
-		case 'fatsis':
821
-			return I18N::translateContext('father’s sister', 'aunt');
822
-		case 'fatson':
823
-			return I18N::translateContext('father’s son', 'half-brother');
824
-		case 'fatwif':
825
-			return I18N::translateContext('father’s wife', 'step-mother');
826
-		case 'husbro':
827
-			return I18N::translateContext('husband’s brother', 'brother-in-law');
828
-		case 'huschi':
829
-			return I18N::translateContext('husband’s child', 'step-child');
830
-		case 'husdau':
831
-			return I18N::translateContext('husband’s daughter', 'step-daughter');
832
-		case 'husfat':
833
-			return I18N::translateContext('husband’s father', 'father-in-law');
834
-		case 'husmot':
835
-			return I18N::translateContext('husband’s mother', 'mother-in-law');
836
-		case 'hussib':
837
-			return I18N::translateContext('husband’s sibling', 'brother/sister-in-law');
838
-		case 'hussis':
839
-			return I18N::translateContext('husband’s sister', 'sister-in-law');
840
-		case 'husson':
841
-			return I18N::translateContext('husband’s son', 'step-son');
842
-		case 'motbro':
843
-			return I18N::translateContext('mother’s brother', 'uncle');
844
-		case 'motchi':
845
-			return I18N::translateContext('mother’s child', 'half-sibling');
846
-		case 'motdau':
847
-			return I18N::translateContext('mother’s daughter', 'half-sister');
848
-		case 'motfat':
849
-			return I18N::translateContext('mother’s father', 'maternal grandfather');
850
-		case 'mothus':
851
-			return I18N::translateContext('mother’s husband', 'step-father');
852
-		case 'motmot':
853
-			return I18N::translateContext('mother’s mother', 'maternal grandmother');
854
-		case 'motpar':
855
-			return I18N::translateContext('mother’s parent', 'maternal grandparent');
856
-		case 'motsib':
857
-			return I18N::translateContext('mother’s sibling', 'aunt/uncle');
858
-		case 'motsis':
859
-			return I18N::translateContext('mother’s sister', 'aunt');
860
-		case 'motson':
861
-			return I18N::translateContext('mother’s son', 'half-brother');
862
-		case 'parbro':
863
-			return I18N::translateContext('parent’s brother', 'uncle');
864
-		case 'parchi':
865
-			return I18N::translateContext('parent’s child', 'half-sibling');
866
-		case 'pardau':
867
-			return I18N::translateContext('parent’s daughter', 'half-sister');
868
-		case 'parfat':
869
-			return I18N::translateContext('parent’s father', 'grandfather');
870
-		case 'parmot':
871
-			return I18N::translateContext('parent’s mother', 'grandmother');
872
-		case 'parpar':
873
-			return I18N::translateContext('parent’s parent', 'grandparent');
874
-		case 'parsib':
875
-			return I18N::translateContext('parent’s sibling', 'aunt/uncle');
876
-		case 'parsis':
877
-			return I18N::translateContext('parent’s sister', 'aunt');
878
-		case 'parson':
879
-			return I18N::translateContext('parent’s son', 'half-brother');
880
-		case 'parspo':
881
-			return I18N::translateContext('parent’s spouse', 'step-parent');
882
-		case 'sibchi':
883
-			return I18N::translateContext('sibling’s child', 'nephew/niece');
884
-		case 'sibdau':
885
-			return I18N::translateContext('sibling’s daughter', 'niece');
886
-		case 'sibson':
887
-			return I18N::translateContext('sibling’s son', 'nephew');
888
-		case 'sibspo':
889
-			return I18N::translateContext('sibling’s spouse', 'brother/sister-in-law');
890
-		case 'sischi':
891
-			return I18N::translateContext('sister’s child', 'nephew/niece');
892
-		case 'sisdau':
893
-			return I18N::translateContext('sister’s daughter', 'niece');
894
-		case 'sishus':
895
-			return I18N::translateContext('sister’s husband', 'brother-in-law');
896
-		case 'sisson':
897
-			return I18N::translateContext('sister’s son', 'nephew');
898
-		case 'sonchi':
899
-			return I18N::translateContext('son’s child', 'grandchild');
900
-		case 'sondau':
901
-			return I18N::translateContext('son’s daughter', 'granddaughter');
902
-		case 'sonson':
903
-			return I18N::translateContext('son’s son', 'grandson');
904
-		case 'sonwif':
905
-			return I18N::translateContext('son’s wife', 'daughter-in-law');
906
-		case 'spobro':
907
-			return I18N::translateContext('spouse’s brother', 'brother-in-law');
908
-		case 'spochi':
909
-			return I18N::translateContext('spouse’s child', 'step-child');
910
-		case 'spodau':
911
-			return I18N::translateContext('spouse’s daughter', 'step-daughter');
912
-		case 'spofat':
913
-			return I18N::translateContext('spouse’s father', 'father-in-law');
914
-		case 'spomot':
915
-			return I18N::translateContext('spouse’s mother', 'mother-in-law');
916
-		case 'sposis':
917
-			return I18N::translateContext('spouse’s sister', 'sister-in-law');
918
-		case 'sposon':
919
-			return I18N::translateContext('spouse’s son', 'step-son');
920
-		case 'spopar':
921
-			return I18N::translateContext('spouse’s parent', 'mother/father-in-law');
922
-		case 'sposib':
923
-			return I18N::translateContext('spouse’s sibling', 'brother/sister-in-law');
924
-		case 'wifbro':
925
-			return I18N::translateContext('wife’s brother', 'brother-in-law');
926
-		case 'wifchi':
927
-			return I18N::translateContext('wife’s child', 'step-child');
928
-		case 'wifdau':
929
-			return I18N::translateContext('wife’s daughter', 'step-daughter');
930
-		case 'wiffat':
931
-			return I18N::translateContext('wife’s father', 'father-in-law');
932
-		case 'wifmot':
933
-			return I18N::translateContext('wife’s mother', 'mother-in-law');
934
-		case 'wifsib':
935
-			return I18N::translateContext('wife’s sibling', 'brother/sister-in-law');
936
-		case 'wifsis':
937
-			return I18N::translateContext('wife’s sister', 'sister-in-law');
938
-		case 'wifson':
939
-			return I18N::translateContext('wife’s son', 'step-son');
777
+			// Level Two relationships
778
+			case 'brochi':
779
+				return I18N::translateContext('brother’s child', 'nephew/niece');
780
+			case 'brodau':
781
+				return I18N::translateContext('brother’s daughter', 'niece');
782
+			case 'broson':
783
+				return I18N::translateContext('brother’s son', 'nephew');
784
+			case 'browif':
785
+				return I18N::translateContext('brother’s wife', 'sister-in-law');
786
+			case 'chichi':
787
+				return I18N::translateContext('child’s child', 'grandchild');
788
+			case 'chidau':
789
+				return I18N::translateContext('child’s daughter', 'granddaughter');
790
+			case 'chihus':
791
+				return I18N::translateContext('child’s husband', 'son-in-law');
792
+			case 'chison':
793
+				return I18N::translateContext('child’s son', 'grandson');
794
+			case 'chispo':
795
+				return I18N::translateContext('child’s spouse', 'son/daughter-in-law');
796
+			case 'chiwif':
797
+				return I18N::translateContext('child’s wife', 'daughter-in-law');
798
+			case 'dauchi':
799
+				return I18N::translateContext('daughter’s child', 'grandchild');
800
+			case 'daudau':
801
+				return I18N::translateContext('daughter’s daughter', 'granddaughter');
802
+			case 'dauhus':
803
+				return I18N::translateContext('daughter’s husband', 'son-in-law');
804
+			case 'dauson':
805
+				return I18N::translateContext('daughter’s son', 'grandson');
806
+			case 'fatbro':
807
+				return I18N::translateContext('father’s brother', 'uncle');
808
+			case 'fatchi':
809
+				return I18N::translateContext('father’s child', 'half-sibling');
810
+			case 'fatdau':
811
+				return I18N::translateContext('father’s daughter', 'half-sister');
812
+			case 'fatfat':
813
+				return I18N::translateContext('father’s father', 'paternal grandfather');
814
+			case 'fatmot':
815
+				return I18N::translateContext('father’s mother', 'paternal grandmother');
816
+			case 'fatpar':
817
+				return I18N::translateContext('father’s parent', 'paternal grandparent');
818
+			case 'fatsib':
819
+				return I18N::translateContext('father’s sibling', 'aunt/uncle');
820
+			case 'fatsis':
821
+				return I18N::translateContext('father’s sister', 'aunt');
822
+			case 'fatson':
823
+				return I18N::translateContext('father’s son', 'half-brother');
824
+			case 'fatwif':
825
+				return I18N::translateContext('father’s wife', 'step-mother');
826
+			case 'husbro':
827
+				return I18N::translateContext('husband’s brother', 'brother-in-law');
828
+			case 'huschi':
829
+				return I18N::translateContext('husband’s child', 'step-child');
830
+			case 'husdau':
831
+				return I18N::translateContext('husband’s daughter', 'step-daughter');
832
+			case 'husfat':
833
+				return I18N::translateContext('husband’s father', 'father-in-law');
834
+			case 'husmot':
835
+				return I18N::translateContext('husband’s mother', 'mother-in-law');
836
+			case 'hussib':
837
+				return I18N::translateContext('husband’s sibling', 'brother/sister-in-law');
838
+			case 'hussis':
839
+				return I18N::translateContext('husband’s sister', 'sister-in-law');
840
+			case 'husson':
841
+				return I18N::translateContext('husband’s son', 'step-son');
842
+			case 'motbro':
843
+				return I18N::translateContext('mother’s brother', 'uncle');
844
+			case 'motchi':
845
+				return I18N::translateContext('mother’s child', 'half-sibling');
846
+			case 'motdau':
847
+				return I18N::translateContext('mother’s daughter', 'half-sister');
848
+			case 'motfat':
849
+				return I18N::translateContext('mother’s father', 'maternal grandfather');
850
+			case 'mothus':
851
+				return I18N::translateContext('mother’s husband', 'step-father');
852
+			case 'motmot':
853
+				return I18N::translateContext('mother’s mother', 'maternal grandmother');
854
+			case 'motpar':
855
+				return I18N::translateContext('mother’s parent', 'maternal grandparent');
856
+			case 'motsib':
857
+				return I18N::translateContext('mother’s sibling', 'aunt/uncle');
858
+			case 'motsis':
859
+				return I18N::translateContext('mother’s sister', 'aunt');
860
+			case 'motson':
861
+				return I18N::translateContext('mother’s son', 'half-brother');
862
+			case 'parbro':
863
+				return I18N::translateContext('parent’s brother', 'uncle');
864
+			case 'parchi':
865
+				return I18N::translateContext('parent’s child', 'half-sibling');
866
+			case 'pardau':
867
+				return I18N::translateContext('parent’s daughter', 'half-sister');
868
+			case 'parfat':
869
+				return I18N::translateContext('parent’s father', 'grandfather');
870
+			case 'parmot':
871
+				return I18N::translateContext('parent’s mother', 'grandmother');
872
+			case 'parpar':
873
+				return I18N::translateContext('parent’s parent', 'grandparent');
874
+			case 'parsib':
875
+				return I18N::translateContext('parent’s sibling', 'aunt/uncle');
876
+			case 'parsis':
877
+				return I18N::translateContext('parent’s sister', 'aunt');
878
+			case 'parson':
879
+				return I18N::translateContext('parent’s son', 'half-brother');
880
+			case 'parspo':
881
+				return I18N::translateContext('parent’s spouse', 'step-parent');
882
+			case 'sibchi':
883
+				return I18N::translateContext('sibling’s child', 'nephew/niece');
884
+			case 'sibdau':
885
+				return I18N::translateContext('sibling’s daughter', 'niece');
886
+			case 'sibson':
887
+				return I18N::translateContext('sibling’s son', 'nephew');
888
+			case 'sibspo':
889
+				return I18N::translateContext('sibling’s spouse', 'brother/sister-in-law');
890
+			case 'sischi':
891
+				return I18N::translateContext('sister’s child', 'nephew/niece');
892
+			case 'sisdau':
893
+				return I18N::translateContext('sister’s daughter', 'niece');
894
+			case 'sishus':
895
+				return I18N::translateContext('sister’s husband', 'brother-in-law');
896
+			case 'sisson':
897
+				return I18N::translateContext('sister’s son', 'nephew');
898
+			case 'sonchi':
899
+				return I18N::translateContext('son’s child', 'grandchild');
900
+			case 'sondau':
901
+				return I18N::translateContext('son’s daughter', 'granddaughter');
902
+			case 'sonson':
903
+				return I18N::translateContext('son’s son', 'grandson');
904
+			case 'sonwif':
905
+				return I18N::translateContext('son’s wife', 'daughter-in-law');
906
+			case 'spobro':
907
+				return I18N::translateContext('spouse’s brother', 'brother-in-law');
908
+			case 'spochi':
909
+				return I18N::translateContext('spouse’s child', 'step-child');
910
+			case 'spodau':
911
+				return I18N::translateContext('spouse’s daughter', 'step-daughter');
912
+			case 'spofat':
913
+				return I18N::translateContext('spouse’s father', 'father-in-law');
914
+			case 'spomot':
915
+				return I18N::translateContext('spouse’s mother', 'mother-in-law');
916
+			case 'sposis':
917
+				return I18N::translateContext('spouse’s sister', 'sister-in-law');
918
+			case 'sposon':
919
+				return I18N::translateContext('spouse’s son', 'step-son');
920
+			case 'spopar':
921
+				return I18N::translateContext('spouse’s parent', 'mother/father-in-law');
922
+			case 'sposib':
923
+				return I18N::translateContext('spouse’s sibling', 'brother/sister-in-law');
924
+			case 'wifbro':
925
+				return I18N::translateContext('wife’s brother', 'brother-in-law');
926
+			case 'wifchi':
927
+				return I18N::translateContext('wife’s child', 'step-child');
928
+			case 'wifdau':
929
+				return I18N::translateContext('wife’s daughter', 'step-daughter');
930
+			case 'wiffat':
931
+				return I18N::translateContext('wife’s father', 'father-in-law');
932
+			case 'wifmot':
933
+				return I18N::translateContext('wife’s mother', 'mother-in-law');
934
+			case 'wifsib':
935
+				return I18N::translateContext('wife’s sibling', 'brother/sister-in-law');
936
+			case 'wifsis':
937
+				return I18N::translateContext('wife’s sister', 'sister-in-law');
938
+			case 'wifson':
939
+				return I18N::translateContext('wife’s son', 'step-son');
940 940
 
941
-		// Level Three relationships
942
-		// I have commented out some of the unknown-sex relationships that are unlikely to to occur.
943
-		// Feel free to add them in, if you think they might be needed
944
-		case 'brochichi':
945
-			if ($sex1 === 'M') {
946
-				return I18N::translateContext('(a man’s) brother’s child’s child', 'great-nephew/niece');
947
-			} else {
948
-				return I18N::translateContext('(a woman’s) brother’s child’s child', 'great-nephew/niece');
949
-			}
950
-		case 'brochidau':
951
-			if ($sex1 === 'M') {
952
-				return I18N::translateContext('(a man’s) brother’s child’s daughter', 'great-niece');
953
-			} else {
954
-				return I18N::translateContext('(a woman’s) brother’s child’s daughter', 'great-niece');
955
-			}
956
-		case 'brochison':
957
-			if ($sex1 === 'M') {
958
-				return I18N::translateContext('(a man’s) brother’s child’s son', 'great-nephew');
959
-			} else {
960
-				return I18N::translateContext('(a woman’s) brother’s child’s son', 'great-nephew');
961
-			}
962
-		case 'brodauchi':
963
-			if ($sex1 === 'M') {
964
-				return I18N::translateContext('(a man’s) brother’s daughter’s child', 'great-nephew/niece');
965
-			} else {
966
-				return I18N::translateContext('(a woman’s) brother’s daughter’s child', 'great-nephew/niece');
967
-			}
968
-		case 'brodaudau':
969
-			if ($sex1 === 'M') {
970
-				return I18N::translateContext('(a man’s) brother’s daughter’s daughter', 'great-niece');
971
-			} else {
972
-				return I18N::translateContext('(a woman’s) brother’s daughter’s daughter', 'great-niece');
973
-			}
974
-		case 'brodauhus':
975
-			return I18N::translateContext('brother’s daughter’s husband', 'nephew-in-law');
976
-		case 'brodauson':
977
-			if ($sex1 === 'M') {
978
-				return I18N::translateContext('(a man’s) brother’s daughter’s son', 'great-nephew');
979
-			} else {
980
-				return I18N::translateContext('(a woman’s) brother’s daughter’s son', 'great-nephew');
981
-			}
982
-		case 'brosonchi':
983
-			if ($sex1 === 'M') {
984
-				return I18N::translateContext('(a man’s) brother’s son’s child', 'great-nephew/niece');
985
-			} else {
986
-				return I18N::translateContext('(a woman’s) brother’s son’s child', 'great-nephew/niece');
987
-			}
988
-		case 'brosondau':
989
-			if ($sex1 === 'M') {
990
-				return I18N::translateContext('(a man’s) brother’s son’s daughter', 'great-niece');
991
-			} else {
992
-				return I18N::translateContext('(a woman’s) brother’s son’s daughter', 'great-niece');
993
-			}
994
-		case 'brosonson':
995
-			if ($sex1 === 'M') {
996
-				return I18N::translateContext('(a man’s) brother’s son’s son', 'great-nephew');
997
-			} else {
998
-				return I18N::translateContext('(a woman’s) brother’s son’s son', 'great-nephew');
999
-			}
1000
-		case 'brosonwif':
1001
-			return I18N::translateContext('brother’s son’s wife', 'niece-in-law');
1002
-		case 'browifbro':
1003
-			return I18N::translateContext('brother’s wife’s brother', 'brother-in-law');
1004
-		case 'browifsib':
1005
-			return I18N::translateContext('brother’s wife’s sibling', 'brother/sister-in-law');
1006
-		case 'browifsis':
1007
-			return I18N::translateContext('brother’s wife’s sister', 'sister-in-law');
1008
-		case 'chichichi':
1009
-			return I18N::translateContext('child’s child’s child', 'great-grandchild');
1010
-		case 'chichidau':
1011
-			return I18N::translateContext('child’s child’s daughter', 'great-granddaughter');
1012
-		case 'chichison':
1013
-			return I18N::translateContext('child’s child’s son', 'great-grandson');
1014
-		case 'chidauchi':
1015
-			return I18N::translateContext('child’s daughter’s child', 'great-grandchild');
1016
-		case 'chidaudau':
1017
-			return I18N::translateContext('child’s daughter’s daughter', 'great-granddaughter');
1018
-		case 'chidauhus':
1019
-			return I18N::translateContext('child’s daughter’s husband', 'granddaughter’s husband');
1020
-		case 'chidauson':
1021
-			return I18N::translateContext('child’s daughter’s son', 'great-grandson');
1022
-		case 'chisonchi':
1023
-			return I18N::translateContext('child’s son’s child', 'great-grandchild');
1024
-		case 'chisondau':
1025
-			return I18N::translateContext('child’s son’s daughter', 'great-granddaughter');
1026
-		case 'chisonson':
1027
-			return I18N::translateContext('child’s son’s son', 'great-grandson');
1028
-		case 'chisonwif':
1029
-			return I18N::translateContext('child’s son’s wife', 'grandson’s wife');
1030
-		case 'dauchichi':
1031
-			return I18N::translateContext('daughter’s child’s child', 'great-grandchild');
1032
-		case 'dauchidau':
1033
-			return I18N::translateContext('daughter’s child’s daughter', 'great-granddaughter');
1034
-		case 'dauchison':
1035
-			return I18N::translateContext('daughter’s child’s son', 'great-grandson');
1036
-		case 'daudauchi':
1037
-			return I18N::translateContext('daughter’s daughter’s child', 'great-grandchild');
1038
-		case 'daudaudau':
1039
-			return I18N::translateContext('daughter’s daughter’s daughter', 'great-granddaughter');
1040
-		case 'daudauhus':
1041
-			return I18N::translateContext('daughter’s daughter’s husband', 'granddaughter’s husband');
1042
-		case 'daudauson':
1043
-			return I18N::translateContext('daughter’s daughter’s son', 'great-grandson');
1044
-		case 'dauhusfat':
1045
-			return I18N::translateContext('daughter’s husband’s father', 'son-in-law’s father');
1046
-		case 'dauhusmot':
1047
-			return I18N::translateContext('daughter’s husband’s mother', 'son-in-law’s mother');
1048
-		case 'dauhuspar':
1049
-			return I18N::translateContext('daughter’s husband’s parent', 'son-in-law’s parent');
1050
-		case 'dausonchi':
1051
-			return I18N::translateContext('daughter’s son’s child', 'great-grandchild');
1052
-		case 'dausondau':
1053
-			return I18N::translateContext('daughter’s son’s daughter', 'great-granddaughter');
1054
-		case 'dausonson':
1055
-			return I18N::translateContext('daughter’s son’s son', 'great-grandson');
1056
-		case 'dausonwif':
1057
-			return I18N::translateContext('daughter’s son’s wife', 'grandson’s wife');
1058
-		case 'fatbrochi':
1059
-			return I18N::translateContext('father’s brother’s child', 'first cousin');
1060
-		case 'fatbrodau':
1061
-			return I18N::translateContext('father’s brother’s daughter', 'first cousin');
1062
-		case 'fatbroson':
1063
-			return I18N::translateContext('father’s brother’s son', 'first cousin');
1064
-		case 'fatbrowif':
1065
-			return I18N::translateContext('father’s brother’s wife', 'aunt');
1066
-		case 'fatfatbro':
1067
-			return I18N::translateContext('father’s father’s brother', 'great-uncle');
1068
-		case 'fatfatfat':
1069
-			return I18N::translateContext('father’s father’s father', 'great-grandfather');
1070
-		case 'fatfatmot':
1071
-			return I18N::translateContext('father’s father’s mother', 'great-grandmother');
1072
-		case 'fatfatpar':
1073
-			return I18N::translateContext('father’s father’s parent', 'great-grandparent');
1074
-		case 'fatfatsib':
1075
-			return I18N::translateContext('father’s father’s sibling', 'great-aunt/uncle');
1076
-		case 'fatfatsis':
1077
-			return I18N::translateContext('father’s father’s sister', 'great-aunt');
1078
-		case 'fatmotbro':
1079
-			return I18N::translateContext('father’s mother’s brother', 'great-uncle');
1080
-		case 'fatmotfat':
1081
-			return I18N::translateContext('father’s mother’s father', 'great-grandfather');
1082
-		case 'fatmotmot':
1083
-			return I18N::translateContext('father’s mother’s mother', 'great-grandmother');
1084
-		case 'fatmotpar':
1085
-			return I18N::translateContext('father’s mother’s parent', 'great-grandparent');
1086
-		case 'fatmotsib':
1087
-			return I18N::translateContext('father’s mother’s sibling', 'great-aunt/uncle');
1088
-		case 'fatmotsis':
1089
-			return I18N::translateContext('father’s mother’s sister', 'great-aunt');
1090
-		case 'fatparbro':
1091
-			return I18N::translateContext('father’s parent’s brother', 'great-uncle');
1092
-		case 'fatparfat':
1093
-			return I18N::translateContext('father’s parent’s father', 'great-grandfather');
1094
-		case 'fatparmot':
1095
-			return I18N::translateContext('father’s parent’s mother', 'great-grandmother');
1096
-		case 'fatparpar':
1097
-			return I18N::translateContext('father’s parent’s parent', 'great-grandparent');
1098
-		case 'fatparsib':
1099
-			return I18N::translateContext('father’s parent’s sibling', 'great-aunt/uncle');
1100
-		case 'fatparsis':
1101
-			return I18N::translateContext('father’s parent’s sister', 'great-aunt');
1102
-		case 'fatsischi':
1103
-			return I18N::translateContext('father’s sister’s child', 'first cousin');
1104
-		case 'fatsisdau':
1105
-			return I18N::translateContext('father’s sister’s daughter', 'first cousin');
1106
-		case 'fatsishus':
1107
-			return I18N::translateContext('father’s sister’s husband', 'uncle');
1108
-		case 'fatsisson':
1109
-			return I18N::translateContext('father’s sister’s son', 'first cousin');
1110
-		case 'fatwifchi':
1111
-			return I18N::translateContext('father’s wife’s child', 'step-sibling');
1112
-		case 'fatwifdau':
1113
-			return I18N::translateContext('father’s wife’s daughter', 'step-sister');
1114
-		case 'fatwifson':
1115
-			return I18N::translateContext('father’s wife’s son', 'step-brother');
1116
-		case 'husbrowif':
1117
-			return I18N::translateContext('husband’s brother’s wife', 'sister-in-law');
1118
-		case 'hussishus':
1119
-			return I18N::translateContext('husband’s sister’s husband', 'brother-in-law');
1120
-		case 'motbrochi':
1121
-			return I18N::translateContext('mother’s brother’s child', 'first cousin');
1122
-		case 'motbrodau':
1123
-			return I18N::translateContext('mother’s brother’s daughter', 'first cousin');
1124
-		case 'motbroson':
1125
-			return I18N::translateContext('mother’s brother’s son', 'first cousin');
1126
-		case 'motbrowif':
1127
-			return I18N::translateContext('mother’s brother’s wife', 'aunt');
1128
-		case 'motfatbro':
1129
-			return I18N::translateContext('mother’s father’s brother', 'great-uncle');
1130
-		case 'motfatfat':
1131
-			return I18N::translateContext('mother’s father’s father', 'great-grandfather');
1132
-		case 'motfatmot':
1133
-			return I18N::translateContext('mother’s father’s mother', 'great-grandmother');
1134
-		case 'motfatpar':
1135
-			return I18N::translateContext('mother’s father’s parent', 'great-grandparent');
1136
-		case 'motfatsib':
1137
-			return I18N::translateContext('mother’s father’s sibling', 'great-aunt/uncle');
1138
-		case 'motfatsis':
1139
-			return I18N::translateContext('mother’s father’s sister', 'great-aunt');
1140
-		case 'mothuschi':
1141
-			return I18N::translateContext('mother’s husband’s child', 'step-sibling');
1142
-		case 'mothusdau':
1143
-			return I18N::translateContext('mother’s husband’s daughter', 'step-sister');
1144
-		case 'mothusson':
1145
-			return I18N::translateContext('mother’s husband’s son', 'step-brother');
1146
-		case 'motmotbro':
1147
-			return I18N::translateContext('mother’s mother’s brother', 'great-uncle');
1148
-		case 'motmotfat':
1149
-			return I18N::translateContext('mother’s mother’s father', 'great-grandfather');
1150
-		case 'motmotmot':
1151
-			return I18N::translateContext('mother’s mother’s mother', 'great-grandmother');
1152
-		case 'motmotpar':
1153
-			return I18N::translateContext('mother’s mother’s parent', 'great-grandparent');
1154
-		case 'motmotsib':
1155
-			return I18N::translateContext('mother’s mother’s sibling', 'great-aunt/uncle');
1156
-		case 'motmotsis':
1157
-			return I18N::translateContext('mother’s mother’s sister', 'great-aunt');
1158
-		case 'motparbro':
1159
-			return I18N::translateContext('mother’s parent’s brother', 'great-uncle');
1160
-		case 'motparfat':
1161
-			return I18N::translateContext('mother’s parent’s father', 'great-grandfather');
1162
-		case 'motparmot':
1163
-			return I18N::translateContext('mother’s parent’s mother', 'great-grandmother');
1164
-		case 'motparpar':
1165
-			return I18N::translateContext('mother’s parent’s parent', 'great-grandparent');
1166
-		case 'motparsib':
1167
-			return I18N::translateContext('mother’s parent’s sibling', 'great-aunt/uncle');
1168
-		case 'motparsis':
1169
-			return I18N::translateContext('mother’s parent’s sister', 'great-aunt');
1170
-		case 'motsischi':
1171
-			return I18N::translateContext('mother’s sister’s child', 'first cousin');
1172
-		case 'motsisdau':
1173
-			return I18N::translateContext('mother’s sister’s daughter', 'first cousin');
1174
-		case 'motsishus':
1175
-			return I18N::translateContext('mother’s sister’s husband', 'uncle');
1176
-		case 'motsisson':
1177
-			return I18N::translateContext('mother’s sister’s son', 'first cousin');
1178
-		case 'parbrowif':
1179
-			return I18N::translateContext('parent’s brother’s wife', 'aunt');
1180
-		case 'parfatbro':
1181
-			return I18N::translateContext('parent’s father’s brother', 'great-uncle');
1182
-		case 'parfatfat':
1183
-			return I18N::translateContext('parent’s father’s father', 'great-grandfather');
1184
-		case 'parfatmot':
1185
-			return I18N::translateContext('parent’s father’s mother', 'great-grandmother');
1186
-		case 'parfatpar':
1187
-			return I18N::translateContext('parent’s father’s parent', 'great-grandparent');
1188
-		case 'parfatsib':
1189
-			return I18N::translateContext('parent’s father’s sibling', 'great-aunt/uncle');
1190
-		case 'parfatsis':
1191
-			return I18N::translateContext('parent’s father’s sister', 'great-aunt');
1192
-		case 'parmotbro':
1193
-			return I18N::translateContext('parent’s mother’s brother', 'great-uncle');
1194
-		case 'parmotfat':
1195
-			return I18N::translateContext('parent’s mother’s father', 'great-grandfather');
1196
-		case 'parmotmot':
1197
-			return I18N::translateContext('parent’s mother’s mother', 'great-grandmother');
1198
-		case 'parmotpar':
1199
-			return I18N::translateContext('parent’s mother’s parent', 'great-grandparent');
1200
-		case 'parmotsib':
1201
-			return I18N::translateContext('parent’s mother’s sibling', 'great-aunt/uncle');
1202
-		case 'parmotsis':
1203
-			return I18N::translateContext('parent’s mother’s sister', 'great-aunt');
1204
-		case 'parparbro':
1205
-			return I18N::translateContext('parent’s parent’s brother', 'great-uncle');
1206
-		case 'parparfat':
1207
-			return I18N::translateContext('parent’s parent’s father', 'great-grandfather');
1208
-		case 'parparmot':
1209
-			return I18N::translateContext('parent’s parent’s mother', 'great-grandmother');
1210
-		case 'parparpar':
1211
-			return I18N::translateContext('parent’s parent’s parent', 'great-grandparent');
1212
-		case 'parparsib':
1213
-			return I18N::translateContext('parent’s parent’s sibling', 'great-aunt/uncle');
1214
-		case 'parparsis':
1215
-			return I18N::translateContext('parent’s parent’s sister', 'great-aunt');
1216
-		case 'parsishus':
1217
-			return I18N::translateContext('parent’s sister’s husband', 'uncle');
1218
-		case 'parspochi':
1219
-			return I18N::translateContext('parent’s spouse’s child', 'step-sibling');
1220
-		case 'parspodau':
1221
-			return I18N::translateContext('parent’s spouse’s daughter', 'step-sister');
1222
-		case 'parsposon':
1223
-			return I18N::translateContext('parent’s spouse’s son', 'step-brother');
1224
-		case 'sibchichi':
1225
-			return I18N::translateContext('sibling’s child’s child', 'great-nephew/niece');
1226
-		case 'sibchidau':
1227
-			return I18N::translateContext('sibling’s child’s daughter', 'great-niece');
1228
-		case 'sibchison':
1229
-			return I18N::translateContext('sibling’s child’s son', 'great-nephew');
1230
-		case 'sibdauchi':
1231
-			return I18N::translateContext('sibling’s daughter’s child', 'great-nephew/niece');
1232
-		case 'sibdaudau':
1233
-			return I18N::translateContext('sibling’s daughter’s daughter', 'great-niece');
1234
-		case 'sibdauhus':
1235
-			return I18N::translateContext('sibling’s daughter’s husband', 'nephew-in-law');
1236
-		case 'sibdauson':
1237
-			return I18N::translateContext('sibling’s daughter’s son', 'great-nephew');
1238
-		case 'sibsonchi':
1239
-			return I18N::translateContext('sibling’s son’s child', 'great-nephew/niece');
1240
-		case 'sibsondau':
1241
-			return I18N::translateContext('sibling’s son’s daughter', 'great-niece');
1242
-		case 'sibsonson':
1243
-			return I18N::translateContext('sibling’s son’s son', 'great-nephew');
1244
-		case 'sibsonwif':
1245
-			return I18N::translateContext('sibling’s son’s wife', 'niece-in-law');
1246
-		case 'sischichi':
1247
-			if ($sex1 === 'M') {
1248
-				return I18N::translateContext('(a man’s) sister’s child’s child', 'great-nephew/niece');
1249
-			} else {
1250
-				return I18N::translateContext('(a woman’s) sister’s child’s child', 'great-nephew/niece');
1251
-			}
1252
-		case 'sischidau':
1253
-			if ($sex1 === 'M') {
1254
-				return I18N::translateContext('(a man’s) sister’s child’s daughter', 'great-niece');
1255
-			} else {
1256
-				return I18N::translateContext('(a woman’s) sister’s child’s daughter', 'great-niece');
1257
-			}
1258
-		case 'sischison':
1259
-			if ($sex1 === 'M') {
1260
-				return I18N::translateContext('(a man’s) sister’s child’s son', 'great-nephew');
1261
-			} else {
1262
-				return I18N::translateContext('(a woman’s) sister’s child’s son', 'great-nephew');
1263
-			}
1264
-		case 'sisdauchi':
1265
-			if ($sex1 === 'M') {
1266
-				return I18N::translateContext('(a man’s) sister’s daughter’s child', 'great-nephew/niece');
1267
-			} else {
1268
-				return I18N::translateContext('(a woman’s) sister’s daughter’s child', 'great-nephew/niece');
1269
-			}
1270
-		case 'sisdaudau':
1271
-			if ($sex1 === 'M') {
1272
-				return I18N::translateContext('(a man’s) sister’s daughter’s daughter', 'great-niece');
1273
-			} else {
1274
-				return I18N::translateContext('(a woman’s) sister’s daughter’s daughter', 'great-niece');
1275
-			}
1276
-		case 'sisdauhus':
1277
-			return I18N::translateContext('sisters’s daughter’s husband', 'nephew-in-law');
1278
-		case 'sisdauson':
1279
-			if ($sex1 === 'M') {
1280
-				return I18N::translateContext('(a man’s) sister’s daughter’s son', 'great-nephew');
1281
-			} else {
1282
-				return I18N::translateContext('(a woman’s) sister’s daughter’s son', 'great-nephew');
1283
-			}
1284
-		case 'sishusbro':
1285
-			return I18N::translateContext('sister’s husband’s brother', 'brother-in-law');
1286
-		case 'sishussib':
1287
-			return I18N::translateContext('sister’s husband’s sibling', 'brother/sister-in-law');
1288
-		case 'sishussis':
1289
-			return I18N::translateContext('sister’s husband’s sister', 'sister-in-law');
1290
-		case 'sissonchi':
1291
-			if ($sex1 === 'M') {
1292
-				return I18N::translateContext('(a man’s) sister’s son’s child', 'great-nephew/niece');
1293
-			} else {
1294
-				return I18N::translateContext('(a woman’s) sister’s son’s child', 'great-nephew/niece');
1295
-			}
1296
-		case 'sissondau':
1297
-			if ($sex1 === 'M') {
1298
-				return I18N::translateContext('(a man’s) sister’s son’s daughter', 'great-niece');
1299
-			} else {
1300
-				return I18N::translateContext('(a woman’s) sister’s son’s daughter', 'great-niece');
1301
-			}
1302
-		case 'sissonson':
1303
-			if ($sex1 === 'M') {
1304
-				return I18N::translateContext('(a man’s) sister’s son’s son', 'great-nephew');
1305
-			} else {
1306
-				return I18N::translateContext('(a woman’s) sister’s son’s son', 'great-nephew');
1307
-			}
1308
-		case 'sissonwif':
1309
-			return I18N::translateContext('sisters’s son’s wife', 'niece-in-law');
1310
-		case 'sonchichi':
1311
-			return I18N::translateContext('son’s child’s child', 'great-grandchild');
1312
-		case 'sonchidau':
1313
-			return I18N::translateContext('son’s child’s daughter', 'great-granddaughter');
1314
-		case 'sonchison':
1315
-			return I18N::translateContext('son’s child’s son', 'great-grandson');
1316
-		case 'sondauchi':
1317
-			return I18N::translateContext('son’s daughter’s child', 'great-grandchild');
1318
-		case 'sondaudau':
1319
-			return I18N::translateContext('son’s daughter’s daughter', 'great-granddaughter');
1320
-		case 'sondauhus':
1321
-			return I18N::translateContext('son’s daughter’s husband', 'granddaughter’s husband');
1322
-		case 'sondauson':
1323
-			return I18N::translateContext('son’s daughter’s son', 'great-grandson');
1324
-		case 'sonsonchi':
1325
-			return I18N::translateContext('son’s son’s child', 'great-grandchild');
1326
-		case 'sonsondau':
1327
-			return I18N::translateContext('son’s son’s daughter', 'great-granddaughter');
1328
-		case 'sonsonson':
1329
-			return I18N::translateContext('son’s son’s son', 'great-grandson');
1330
-		case 'sonsonwif':
1331
-			return I18N::translateContext('son’s son’s wife', 'grandson’s wife');
1332
-		case 'sonwiffat':
1333
-			return I18N::translateContext('son’s wife’s father', 'daughter-in-law’s father');
1334
-		case 'sonwifmot':
1335
-			return I18N::translateContext('son’s wife’s mother', 'daughter-in-law’s mother');
1336
-		case 'sonwifpar':
1337
-			return I18N::translateContext('son’s wife’s parent', 'daughter-in-law’s parent');
1338
-		case 'wifbrowif':
1339
-			return I18N::translateContext('wife’s brother’s wife', 'sister-in-law');
1340
-		case 'wifsishus':
1341
-			return I18N::translateContext('wife’s sister’s husband', 'brother-in-law');
941
+			// Level Three relationships
942
+			// I have commented out some of the unknown-sex relationships that are unlikely to to occur.
943
+			// Feel free to add them in, if you think they might be needed
944
+			case 'brochichi':
945
+				if ($sex1 === 'M') {
946
+					return I18N::translateContext('(a man’s) brother’s child’s child', 'great-nephew/niece');
947
+				} else {
948
+					return I18N::translateContext('(a woman’s) brother’s child’s child', 'great-nephew/niece');
949
+				}
950
+			case 'brochidau':
951
+				if ($sex1 === 'M') {
952
+					return I18N::translateContext('(a man’s) brother’s child’s daughter', 'great-niece');
953
+				} else {
954
+					return I18N::translateContext('(a woman’s) brother’s child’s daughter', 'great-niece');
955
+				}
956
+			case 'brochison':
957
+				if ($sex1 === 'M') {
958
+					return I18N::translateContext('(a man’s) brother’s child’s son', 'great-nephew');
959
+				} else {
960
+					return I18N::translateContext('(a woman’s) brother’s child’s son', 'great-nephew');
961
+				}
962
+			case 'brodauchi':
963
+				if ($sex1 === 'M') {
964
+					return I18N::translateContext('(a man’s) brother’s daughter’s child', 'great-nephew/niece');
965
+				} else {
966
+					return I18N::translateContext('(a woman’s) brother’s daughter’s child', 'great-nephew/niece');
967
+				}
968
+			case 'brodaudau':
969
+				if ($sex1 === 'M') {
970
+					return I18N::translateContext('(a man’s) brother’s daughter’s daughter', 'great-niece');
971
+				} else {
972
+					return I18N::translateContext('(a woman’s) brother’s daughter’s daughter', 'great-niece');
973
+				}
974
+			case 'brodauhus':
975
+				return I18N::translateContext('brother’s daughter’s husband', 'nephew-in-law');
976
+			case 'brodauson':
977
+				if ($sex1 === 'M') {
978
+					return I18N::translateContext('(a man’s) brother’s daughter’s son', 'great-nephew');
979
+				} else {
980
+					return I18N::translateContext('(a woman’s) brother’s daughter’s son', 'great-nephew');
981
+				}
982
+			case 'brosonchi':
983
+				if ($sex1 === 'M') {
984
+					return I18N::translateContext('(a man’s) brother’s son’s child', 'great-nephew/niece');
985
+				} else {
986
+					return I18N::translateContext('(a woman’s) brother’s son’s child', 'great-nephew/niece');
987
+				}
988
+			case 'brosondau':
989
+				if ($sex1 === 'M') {
990
+					return I18N::translateContext('(a man’s) brother’s son’s daughter', 'great-niece');
991
+				} else {
992
+					return I18N::translateContext('(a woman’s) brother’s son’s daughter', 'great-niece');
993
+				}
994
+			case 'brosonson':
995
+				if ($sex1 === 'M') {
996
+					return I18N::translateContext('(a man’s) brother’s son’s son', 'great-nephew');
997
+				} else {
998
+					return I18N::translateContext('(a woman’s) brother’s son’s son', 'great-nephew');
999
+				}
1000
+			case 'brosonwif':
1001
+				return I18N::translateContext('brother’s son’s wife', 'niece-in-law');
1002
+			case 'browifbro':
1003
+				return I18N::translateContext('brother’s wife’s brother', 'brother-in-law');
1004
+			case 'browifsib':
1005
+				return I18N::translateContext('brother’s wife’s sibling', 'brother/sister-in-law');
1006
+			case 'browifsis':
1007
+				return I18N::translateContext('brother’s wife’s sister', 'sister-in-law');
1008
+			case 'chichichi':
1009
+				return I18N::translateContext('child’s child’s child', 'great-grandchild');
1010
+			case 'chichidau':
1011
+				return I18N::translateContext('child’s child’s daughter', 'great-granddaughter');
1012
+			case 'chichison':
1013
+				return I18N::translateContext('child’s child’s son', 'great-grandson');
1014
+			case 'chidauchi':
1015
+				return I18N::translateContext('child’s daughter’s child', 'great-grandchild');
1016
+			case 'chidaudau':
1017
+				return I18N::translateContext('child’s daughter’s daughter', 'great-granddaughter');
1018
+			case 'chidauhus':
1019
+				return I18N::translateContext('child’s daughter’s husband', 'granddaughter’s husband');
1020
+			case 'chidauson':
1021
+				return I18N::translateContext('child’s daughter’s son', 'great-grandson');
1022
+			case 'chisonchi':
1023
+				return I18N::translateContext('child’s son’s child', 'great-grandchild');
1024
+			case 'chisondau':
1025
+				return I18N::translateContext('child’s son’s daughter', 'great-granddaughter');
1026
+			case 'chisonson':
1027
+				return I18N::translateContext('child’s son’s son', 'great-grandson');
1028
+			case 'chisonwif':
1029
+				return I18N::translateContext('child’s son’s wife', 'grandson’s wife');
1030
+			case 'dauchichi':
1031
+				return I18N::translateContext('daughter’s child’s child', 'great-grandchild');
1032
+			case 'dauchidau':
1033
+				return I18N::translateContext('daughter’s child’s daughter', 'great-granddaughter');
1034
+			case 'dauchison':
1035
+				return I18N::translateContext('daughter’s child’s son', 'great-grandson');
1036
+			case 'daudauchi':
1037
+				return I18N::translateContext('daughter’s daughter’s child', 'great-grandchild');
1038
+			case 'daudaudau':
1039
+				return I18N::translateContext('daughter’s daughter’s daughter', 'great-granddaughter');
1040
+			case 'daudauhus':
1041
+				return I18N::translateContext('daughter’s daughter’s husband', 'granddaughter’s husband');
1042
+			case 'daudauson':
1043
+				return I18N::translateContext('daughter’s daughter’s son', 'great-grandson');
1044
+			case 'dauhusfat':
1045
+				return I18N::translateContext('daughter’s husband’s father', 'son-in-law’s father');
1046
+			case 'dauhusmot':
1047
+				return I18N::translateContext('daughter’s husband’s mother', 'son-in-law’s mother');
1048
+			case 'dauhuspar':
1049
+				return I18N::translateContext('daughter’s husband’s parent', 'son-in-law’s parent');
1050
+			case 'dausonchi':
1051
+				return I18N::translateContext('daughter’s son’s child', 'great-grandchild');
1052
+			case 'dausondau':
1053
+				return I18N::translateContext('daughter’s son’s daughter', 'great-granddaughter');
1054
+			case 'dausonson':
1055
+				return I18N::translateContext('daughter’s son’s son', 'great-grandson');
1056
+			case 'dausonwif':
1057
+				return I18N::translateContext('daughter’s son’s wife', 'grandson’s wife');
1058
+			case 'fatbrochi':
1059
+				return I18N::translateContext('father’s brother’s child', 'first cousin');
1060
+			case 'fatbrodau':
1061
+				return I18N::translateContext('father’s brother’s daughter', 'first cousin');
1062
+			case 'fatbroson':
1063
+				return I18N::translateContext('father’s brother’s son', 'first cousin');
1064
+			case 'fatbrowif':
1065
+				return I18N::translateContext('father’s brother’s wife', 'aunt');
1066
+			case 'fatfatbro':
1067
+				return I18N::translateContext('father’s father’s brother', 'great-uncle');
1068
+			case 'fatfatfat':
1069
+				return I18N::translateContext('father’s father’s father', 'great-grandfather');
1070
+			case 'fatfatmot':
1071
+				return I18N::translateContext('father’s father’s mother', 'great-grandmother');
1072
+			case 'fatfatpar':
1073
+				return I18N::translateContext('father’s father’s parent', 'great-grandparent');
1074
+			case 'fatfatsib':
1075
+				return I18N::translateContext('father’s father’s sibling', 'great-aunt/uncle');
1076
+			case 'fatfatsis':
1077
+				return I18N::translateContext('father’s father’s sister', 'great-aunt');
1078
+			case 'fatmotbro':
1079
+				return I18N::translateContext('father’s mother’s brother', 'great-uncle');
1080
+			case 'fatmotfat':
1081
+				return I18N::translateContext('father’s mother’s father', 'great-grandfather');
1082
+			case 'fatmotmot':
1083
+				return I18N::translateContext('father’s mother’s mother', 'great-grandmother');
1084
+			case 'fatmotpar':
1085
+				return I18N::translateContext('father’s mother’s parent', 'great-grandparent');
1086
+			case 'fatmotsib':
1087
+				return I18N::translateContext('father’s mother’s sibling', 'great-aunt/uncle');
1088
+			case 'fatmotsis':
1089
+				return I18N::translateContext('father’s mother’s sister', 'great-aunt');
1090
+			case 'fatparbro':
1091
+				return I18N::translateContext('father’s parent’s brother', 'great-uncle');
1092
+			case 'fatparfat':
1093
+				return I18N::translateContext('father’s parent’s father', 'great-grandfather');
1094
+			case 'fatparmot':
1095
+				return I18N::translateContext('father’s parent’s mother', 'great-grandmother');
1096
+			case 'fatparpar':
1097
+				return I18N::translateContext('father’s parent’s parent', 'great-grandparent');
1098
+			case 'fatparsib':
1099
+				return I18N::translateContext('father’s parent’s sibling', 'great-aunt/uncle');
1100
+			case 'fatparsis':
1101
+				return I18N::translateContext('father’s parent’s sister', 'great-aunt');
1102
+			case 'fatsischi':
1103
+				return I18N::translateContext('father’s sister’s child', 'first cousin');
1104
+			case 'fatsisdau':
1105
+				return I18N::translateContext('father’s sister’s daughter', 'first cousin');
1106
+			case 'fatsishus':
1107
+				return I18N::translateContext('father’s sister’s husband', 'uncle');
1108
+			case 'fatsisson':
1109
+				return I18N::translateContext('father’s sister’s son', 'first cousin');
1110
+			case 'fatwifchi':
1111
+				return I18N::translateContext('father’s wife’s child', 'step-sibling');
1112
+			case 'fatwifdau':
1113
+				return I18N::translateContext('father’s wife’s daughter', 'step-sister');
1114
+			case 'fatwifson':
1115
+				return I18N::translateContext('father’s wife’s son', 'step-brother');
1116
+			case 'husbrowif':
1117
+				return I18N::translateContext('husband’s brother’s wife', 'sister-in-law');
1118
+			case 'hussishus':
1119
+				return I18N::translateContext('husband’s sister’s husband', 'brother-in-law');
1120
+			case 'motbrochi':
1121
+				return I18N::translateContext('mother’s brother’s child', 'first cousin');
1122
+			case 'motbrodau':
1123
+				return I18N::translateContext('mother’s brother’s daughter', 'first cousin');
1124
+			case 'motbroson':
1125
+				return I18N::translateContext('mother’s brother’s son', 'first cousin');
1126
+			case 'motbrowif':
1127
+				return I18N::translateContext('mother’s brother’s wife', 'aunt');
1128
+			case 'motfatbro':
1129
+				return I18N::translateContext('mother’s father’s brother', 'great-uncle');
1130
+			case 'motfatfat':
1131
+				return I18N::translateContext('mother’s father’s father', 'great-grandfather');
1132
+			case 'motfatmot':
1133
+				return I18N::translateContext('mother’s father’s mother', 'great-grandmother');
1134
+			case 'motfatpar':
1135
+				return I18N::translateContext('mother’s father’s parent', 'great-grandparent');
1136
+			case 'motfatsib':
1137
+				return I18N::translateContext('mother’s father’s sibling', 'great-aunt/uncle');
1138
+			case 'motfatsis':
1139
+				return I18N::translateContext('mother’s father’s sister', 'great-aunt');
1140
+			case 'mothuschi':
1141
+				return I18N::translateContext('mother’s husband’s child', 'step-sibling');
1142
+			case 'mothusdau':
1143
+				return I18N::translateContext('mother’s husband’s daughter', 'step-sister');
1144
+			case 'mothusson':
1145
+				return I18N::translateContext('mother’s husband’s son', 'step-brother');
1146
+			case 'motmotbro':
1147
+				return I18N::translateContext('mother’s mother’s brother', 'great-uncle');
1148
+			case 'motmotfat':
1149
+				return I18N::translateContext('mother’s mother’s father', 'great-grandfather');
1150
+			case 'motmotmot':
1151
+				return I18N::translateContext('mother’s mother’s mother', 'great-grandmother');
1152
+			case 'motmotpar':
1153
+				return I18N::translateContext('mother’s mother’s parent', 'great-grandparent');
1154
+			case 'motmotsib':
1155
+				return I18N::translateContext('mother’s mother’s sibling', 'great-aunt/uncle');
1156
+			case 'motmotsis':
1157
+				return I18N::translateContext('mother’s mother’s sister', 'great-aunt');
1158
+			case 'motparbro':
1159
+				return I18N::translateContext('mother’s parent’s brother', 'great-uncle');
1160
+			case 'motparfat':
1161
+				return I18N::translateContext('mother’s parent’s father', 'great-grandfather');
1162
+			case 'motparmot':
1163
+				return I18N::translateContext('mother’s parent’s mother', 'great-grandmother');
1164
+			case 'motparpar':
1165
+				return I18N::translateContext('mother’s parent’s parent', 'great-grandparent');
1166
+			case 'motparsib':
1167
+				return I18N::translateContext('mother’s parent’s sibling', 'great-aunt/uncle');
1168
+			case 'motparsis':
1169
+				return I18N::translateContext('mother’s parent’s sister', 'great-aunt');
1170
+			case 'motsischi':
1171
+				return I18N::translateContext('mother’s sister’s child', 'first cousin');
1172
+			case 'motsisdau':
1173
+				return I18N::translateContext('mother’s sister’s daughter', 'first cousin');
1174
+			case 'motsishus':
1175
+				return I18N::translateContext('mother’s sister’s husband', 'uncle');
1176
+			case 'motsisson':
1177
+				return I18N::translateContext('mother’s sister’s son', 'first cousin');
1178
+			case 'parbrowif':
1179
+				return I18N::translateContext('parent’s brother’s wife', 'aunt');
1180
+			case 'parfatbro':
1181
+				return I18N::translateContext('parent’s father’s brother', 'great-uncle');
1182
+			case 'parfatfat':
1183
+				return I18N::translateContext('parent’s father’s father', 'great-grandfather');
1184
+			case 'parfatmot':
1185
+				return I18N::translateContext('parent’s father’s mother', 'great-grandmother');
1186
+			case 'parfatpar':
1187
+				return I18N::translateContext('parent’s father’s parent', 'great-grandparent');
1188
+			case 'parfatsib':
1189
+				return I18N::translateContext('parent’s father’s sibling', 'great-aunt/uncle');
1190
+			case 'parfatsis':
1191
+				return I18N::translateContext('parent’s father’s sister', 'great-aunt');
1192
+			case 'parmotbro':
1193
+				return I18N::translateContext('parent’s mother’s brother', 'great-uncle');
1194
+			case 'parmotfat':
1195
+				return I18N::translateContext('parent’s mother’s father', 'great-grandfather');
1196
+			case 'parmotmot':
1197
+				return I18N::translateContext('parent’s mother’s mother', 'great-grandmother');
1198
+			case 'parmotpar':
1199
+				return I18N::translateContext('parent’s mother’s parent', 'great-grandparent');
1200
+			case 'parmotsib':
1201
+				return I18N::translateContext('parent’s mother’s sibling', 'great-aunt/uncle');
1202
+			case 'parmotsis':
1203
+				return I18N::translateContext('parent’s mother’s sister', 'great-aunt');
1204
+			case 'parparbro':
1205
+				return I18N::translateContext('parent’s parent’s brother', 'great-uncle');
1206
+			case 'parparfat':
1207
+				return I18N::translateContext('parent’s parent’s father', 'great-grandfather');
1208
+			case 'parparmot':
1209
+				return I18N::translateContext('parent’s parent’s mother', 'great-grandmother');
1210
+			case 'parparpar':
1211
+				return I18N::translateContext('parent’s parent’s parent', 'great-grandparent');
1212
+			case 'parparsib':
1213
+				return I18N::translateContext('parent’s parent’s sibling', 'great-aunt/uncle');
1214
+			case 'parparsis':
1215
+				return I18N::translateContext('parent’s parent’s sister', 'great-aunt');
1216
+			case 'parsishus':
1217
+				return I18N::translateContext('parent’s sister’s husband', 'uncle');
1218
+			case 'parspochi':
1219
+				return I18N::translateContext('parent’s spouse’s child', 'step-sibling');
1220
+			case 'parspodau':
1221
+				return I18N::translateContext('parent’s spouse’s daughter', 'step-sister');
1222
+			case 'parsposon':
1223
+				return I18N::translateContext('parent’s spouse’s son', 'step-brother');
1224
+			case 'sibchichi':
1225
+				return I18N::translateContext('sibling’s child’s child', 'great-nephew/niece');
1226
+			case 'sibchidau':
1227
+				return I18N::translateContext('sibling’s child’s daughter', 'great-niece');
1228
+			case 'sibchison':
1229
+				return I18N::translateContext('sibling’s child’s son', 'great-nephew');
1230
+			case 'sibdauchi':
1231
+				return I18N::translateContext('sibling’s daughter’s child', 'great-nephew/niece');
1232
+			case 'sibdaudau':
1233
+				return I18N::translateContext('sibling’s daughter’s daughter', 'great-niece');
1234
+			case 'sibdauhus':
1235
+				return I18N::translateContext('sibling’s daughter’s husband', 'nephew-in-law');
1236
+			case 'sibdauson':
1237
+				return I18N::translateContext('sibling’s daughter’s son', 'great-nephew');
1238
+			case 'sibsonchi':
1239
+				return I18N::translateContext('sibling’s son’s child', 'great-nephew/niece');
1240
+			case 'sibsondau':
1241
+				return I18N::translateContext('sibling’s son’s daughter', 'great-niece');
1242
+			case 'sibsonson':
1243
+				return I18N::translateContext('sibling’s son’s son', 'great-nephew');
1244
+			case 'sibsonwif':
1245
+				return I18N::translateContext('sibling’s son’s wife', 'niece-in-law');
1246
+			case 'sischichi':
1247
+				if ($sex1 === 'M') {
1248
+					return I18N::translateContext('(a man’s) sister’s child’s child', 'great-nephew/niece');
1249
+				} else {
1250
+					return I18N::translateContext('(a woman’s) sister’s child’s child', 'great-nephew/niece');
1251
+				}
1252
+			case 'sischidau':
1253
+				if ($sex1 === 'M') {
1254
+					return I18N::translateContext('(a man’s) sister’s child’s daughter', 'great-niece');
1255
+				} else {
1256
+					return I18N::translateContext('(a woman’s) sister’s child’s daughter', 'great-niece');
1257
+				}
1258
+			case 'sischison':
1259
+				if ($sex1 === 'M') {
1260
+					return I18N::translateContext('(a man’s) sister’s child’s son', 'great-nephew');
1261
+				} else {
1262
+					return I18N::translateContext('(a woman’s) sister’s child’s son', 'great-nephew');
1263
+				}
1264
+			case 'sisdauchi':
1265
+				if ($sex1 === 'M') {
1266
+					return I18N::translateContext('(a man’s) sister’s daughter’s child', 'great-nephew/niece');
1267
+				} else {
1268
+					return I18N::translateContext('(a woman’s) sister’s daughter’s child', 'great-nephew/niece');
1269
+				}
1270
+			case 'sisdaudau':
1271
+				if ($sex1 === 'M') {
1272
+					return I18N::translateContext('(a man’s) sister’s daughter’s daughter', 'great-niece');
1273
+				} else {
1274
+					return I18N::translateContext('(a woman’s) sister’s daughter’s daughter', 'great-niece');
1275
+				}
1276
+			case 'sisdauhus':
1277
+				return I18N::translateContext('sisters’s daughter’s husband', 'nephew-in-law');
1278
+			case 'sisdauson':
1279
+				if ($sex1 === 'M') {
1280
+					return I18N::translateContext('(a man’s) sister’s daughter’s son', 'great-nephew');
1281
+				} else {
1282
+					return I18N::translateContext('(a woman’s) sister’s daughter’s son', 'great-nephew');
1283
+				}
1284
+			case 'sishusbro':
1285
+				return I18N::translateContext('sister’s husband’s brother', 'brother-in-law');
1286
+			case 'sishussib':
1287
+				return I18N::translateContext('sister’s husband’s sibling', 'brother/sister-in-law');
1288
+			case 'sishussis':
1289
+				return I18N::translateContext('sister’s husband’s sister', 'sister-in-law');
1290
+			case 'sissonchi':
1291
+				if ($sex1 === 'M') {
1292
+					return I18N::translateContext('(a man’s) sister’s son’s child', 'great-nephew/niece');
1293
+				} else {
1294
+					return I18N::translateContext('(a woman’s) sister’s son’s child', 'great-nephew/niece');
1295
+				}
1296
+			case 'sissondau':
1297
+				if ($sex1 === 'M') {
1298
+					return I18N::translateContext('(a man’s) sister’s son’s daughter', 'great-niece');
1299
+				} else {
1300
+					return I18N::translateContext('(a woman’s) sister’s son’s daughter', 'great-niece');
1301
+				}
1302
+			case 'sissonson':
1303
+				if ($sex1 === 'M') {
1304
+					return I18N::translateContext('(a man’s) sister’s son’s son', 'great-nephew');
1305
+				} else {
1306
+					return I18N::translateContext('(a woman’s) sister’s son’s son', 'great-nephew');
1307
+				}
1308
+			case 'sissonwif':
1309
+				return I18N::translateContext('sisters’s son’s wife', 'niece-in-law');
1310
+			case 'sonchichi':
1311
+				return I18N::translateContext('son’s child’s child', 'great-grandchild');
1312
+			case 'sonchidau':
1313
+				return I18N::translateContext('son’s child’s daughter', 'great-granddaughter');
1314
+			case 'sonchison':
1315
+				return I18N::translateContext('son’s child’s son', 'great-grandson');
1316
+			case 'sondauchi':
1317
+				return I18N::translateContext('son’s daughter’s child', 'great-grandchild');
1318
+			case 'sondaudau':
1319
+				return I18N::translateContext('son’s daughter’s daughter', 'great-granddaughter');
1320
+			case 'sondauhus':
1321
+				return I18N::translateContext('son’s daughter’s husband', 'granddaughter’s husband');
1322
+			case 'sondauson':
1323
+				return I18N::translateContext('son’s daughter’s son', 'great-grandson');
1324
+			case 'sonsonchi':
1325
+				return I18N::translateContext('son’s son’s child', 'great-grandchild');
1326
+			case 'sonsondau':
1327
+				return I18N::translateContext('son’s son’s daughter', 'great-granddaughter');
1328
+			case 'sonsonson':
1329
+				return I18N::translateContext('son’s son’s son', 'great-grandson');
1330
+			case 'sonsonwif':
1331
+				return I18N::translateContext('son’s son’s wife', 'grandson’s wife');
1332
+			case 'sonwiffat':
1333
+				return I18N::translateContext('son’s wife’s father', 'daughter-in-law’s father');
1334
+			case 'sonwifmot':
1335
+				return I18N::translateContext('son’s wife’s mother', 'daughter-in-law’s mother');
1336
+			case 'sonwifpar':
1337
+				return I18N::translateContext('son’s wife’s parent', 'daughter-in-law’s parent');
1338
+			case 'wifbrowif':
1339
+				return I18N::translateContext('wife’s brother’s wife', 'sister-in-law');
1340
+			case 'wifsishus':
1341
+				return I18N::translateContext('wife’s sister’s husband', 'brother-in-law');
1342 1342
 
1343
-		// Some “special case” level four relationships that have specific names in certain languages
1344
-		case 'fatfatbrowif':
1345
-			return I18N::translateContext('father’s father’s brother’s wife', 'great-aunt');
1346
-		case 'fatfatsibspo':
1347
-			return I18N::translateContext('father’s father’s sibling’s spouse', 'great-aunt/uncle');
1348
-		case 'fatfatsishus':
1349
-			return I18N::translateContext('father’s father’s sister’s husband', 'great-uncle');
1350
-		case 'fatmotbrowif':
1351
-			return I18N::translateContext('father’s mother’s brother’s wife', 'great-aunt');
1352
-		case 'fatmotsibspo':
1353
-			return I18N::translateContext('father’s mother’s sibling’s spouse', 'great-aunt/uncle');
1354
-		case 'fatmotsishus':
1355
-			return I18N::translateContext('father’s mother’s sister’s husband', 'great-uncle');
1356
-		case 'fatparbrowif':
1357
-			return I18N::translateContext('father’s parent’s brother’s wife', 'great-aunt');
1358
-		case 'fatparsibspo':
1359
-			return I18N::translateContext('father’s parent’s sibling’s spouse', 'great-aunt/uncle');
1360
-		case 'fatparsishus':
1361
-			return I18N::translateContext('father’s parent’s sister’s husband', 'great-uncle');
1362
-		case 'motfatbrowif':
1363
-			return I18N::translateContext('mother’s father’s brother’s wife', 'great-aunt');
1364
-		case 'motfatsibspo':
1365
-			return I18N::translateContext('mother’s father’s sibling’s spouse', 'great-aunt/uncle');
1366
-		case 'motfatsishus':
1367
-			return I18N::translateContext('mother’s father’s sister’s husband', 'great-uncle');
1368
-		case 'motmotbrowif':
1369
-			return I18N::translateContext('mother’s mother’s brother’s wife', 'great-aunt');
1370
-		case 'motmotsibspo':
1371
-			return I18N::translateContext('mother’s mother’s sibling’s spouse', 'great-aunt/uncle');
1372
-		case 'motmotsishus':
1373
-			return I18N::translateContext('mother’s mother’s sister’s husband', 'great-uncle');
1374
-		case 'motparbrowif':
1375
-			return I18N::translateContext('mother’s parent’s brother’s wife', 'great-aunt');
1376
-		case 'motparsibspo':
1377
-			return I18N::translateContext('mother’s parent’s sibling’s spouse', 'great-aunt/uncle');
1378
-		case 'motparsishus':
1379
-			return I18N::translateContext('mother’s parent’s sister’s husband', 'great-uncle');
1380
-		case 'parfatbrowif':
1381
-			return I18N::translateContext('parent’s father’s brother’s wife', 'great-aunt');
1382
-		case 'parfatsibspo':
1383
-			return I18N::translateContext('parent’s father’s sibling’s spouse', 'great-aunt/uncle');
1384
-		case 'parfatsishus':
1385
-			return I18N::translateContext('parent’s father’s sister’s husband', 'great-uncle');
1386
-		case 'parmotbrowif':
1387
-			return I18N::translateContext('parent’s mother’s brother’s wife', 'great-aunt');
1388
-		case 'parmotsibspo':
1389
-			return I18N::translateContext('parent’s mother’s sibling’s spouse', 'great-aunt/uncle');
1390
-		case 'parmotsishus':
1391
-			return I18N::translateContext('parent’s mother’s sister’s husband', 'great-uncle');
1392
-		case 'parparbrowif':
1393
-			return I18N::translateContext('parent’s parent’s brother’s wife', 'great-aunt');
1394
-		case 'parparsibspo':
1395
-			return I18N::translateContext('parent’s parent’s sibling’s spouse', 'great-aunt/uncle');
1396
-		case 'parparsishus':
1397
-			return I18N::translateContext('parent’s parent’s sister’s husband', 'great-uncle');
1398
-		case 'fatfatbrodau':
1399
-			return I18N::translateContext('father’s father’s brother’s daughter', 'first cousin once removed ascending');
1400
-		case 'fatfatbroson':
1401
-			return I18N::translateContext('father’s father’s brother’s son', 'first cousin once removed ascending');
1402
-		case 'fatfatbrochi':
1403
-			return I18N::translateContext('father’s father’s brother’s child', 'first cousin once removed ascending');
1404
-		case 'fatfatsisdau':
1405
-			return I18N::translateContext('father’s father’s sister’s daughter', 'first cousin once removed ascending');
1406
-		case 'fatfatsisson':
1407
-			return I18N::translateContext('father’s father’s sister’s son', 'first cousin once removed ascending');
1408
-		case 'fatfatsischi':
1409
-			return I18N::translateContext('father’s father’s sister’s child', 'first cousin once removed ascending');
1410
-		case 'fatmotbrodau':
1411
-			return I18N::translateContext('father’s mother’s brother’s daughter', 'first cousin once removed ascending');
1412
-		case 'fatmotbroson':
1413
-			return I18N::translateContext('father’s mother’s brother’s son', 'first cousin once removed ascending');
1414
-		case 'fatmotbrochi':
1415
-			return I18N::translateContext('father’s mother’s brother’s child', 'first cousin once removed ascending');
1416
-		case 'fatmotsisdau':
1417
-			return I18N::translateContext('father’s mother’s sister’s daughter', 'first cousin once removed ascending');
1418
-		case 'fatmotsisson':
1419
-			return I18N::translateContext('father’s mother’s sister’s son', 'first cousin once removed ascending');
1420
-		case 'fatmotsischi':
1421
-			return I18N::translateContext('father’s mother’s sister’s child', 'first cousin once removed ascending');
1422
-		case 'motfatbrodau':
1423
-			return I18N::translateContext('mother’s father’s brother’s daughter', 'first cousin once removed ascending');
1424
-		case 'motfatbroson':
1425
-			return I18N::translateContext('mother’s father’s brother’s son', 'first cousin once removed ascending');
1426
-		case 'motfatbrochi':
1427
-			return I18N::translateContext('mother’s father’s brother’s child', 'first cousin once removed ascending');
1428
-		case 'motfatsisdau':
1429
-			return I18N::translateContext('mother’s father’s sister’s daughter', 'first cousin once removed ascending');
1430
-		case 'motfatsisson':
1431
-			return I18N::translateContext('mother’s father’s sister’s son', 'first cousin once removed ascending');
1432
-		case 'motfatsischi':
1433
-			return I18N::translateContext('mother’s father’s sister’s child', 'first cousin once removed ascending');
1434
-		case 'motmotbrodau':
1435
-			return I18N::translateContext('mother’s mother’s brother’s daughter', 'first cousin once removed ascending');
1436
-		case 'motmotbroson':
1437
-			return I18N::translateContext('mother’s mother’s brother’s son', 'first cousin once removed ascending');
1438
-		case 'motmotbrochi':
1439
-			return I18N::translateContext('mother’s mother’s brother’s child', 'first cousin once removed ascending');
1440
-		case 'motmotsisdau':
1441
-			return I18N::translateContext('mother’s mother’s sister’s daughter', 'first cousin once removed ascending');
1442
-		case 'motmotsisson':
1443
-			return I18N::translateContext('mother’s mother’s sister’s son', 'first cousin once removed ascending');
1444
-		case 'motmotsischi':
1445
-			return I18N::translateContext('mother’s mother’s sister’s child', 'first cousin once removed ascending');
1343
+			// Some “special case” level four relationships that have specific names in certain languages
1344
+			case 'fatfatbrowif':
1345
+				return I18N::translateContext('father’s father’s brother’s wife', 'great-aunt');
1346
+			case 'fatfatsibspo':
1347
+				return I18N::translateContext('father’s father’s sibling’s spouse', 'great-aunt/uncle');
1348
+			case 'fatfatsishus':
1349
+				return I18N::translateContext('father’s father’s sister’s husband', 'great-uncle');
1350
+			case 'fatmotbrowif':
1351
+				return I18N::translateContext('father’s mother’s brother’s wife', 'great-aunt');
1352
+			case 'fatmotsibspo':
1353
+				return I18N::translateContext('father’s mother’s sibling’s spouse', 'great-aunt/uncle');
1354
+			case 'fatmotsishus':
1355
+				return I18N::translateContext('father’s mother’s sister’s husband', 'great-uncle');
1356
+			case 'fatparbrowif':
1357
+				return I18N::translateContext('father’s parent’s brother’s wife', 'great-aunt');
1358
+			case 'fatparsibspo':
1359
+				return I18N::translateContext('father’s parent’s sibling’s spouse', 'great-aunt/uncle');
1360
+			case 'fatparsishus':
1361
+				return I18N::translateContext('father’s parent’s sister’s husband', 'great-uncle');
1362
+			case 'motfatbrowif':
1363
+				return I18N::translateContext('mother’s father’s brother’s wife', 'great-aunt');
1364
+			case 'motfatsibspo':
1365
+				return I18N::translateContext('mother’s father’s sibling’s spouse', 'great-aunt/uncle');
1366
+			case 'motfatsishus':
1367
+				return I18N::translateContext('mother’s father’s sister’s husband', 'great-uncle');
1368
+			case 'motmotbrowif':
1369
+				return I18N::translateContext('mother’s mother’s brother’s wife', 'great-aunt');
1370
+			case 'motmotsibspo':
1371
+				return I18N::translateContext('mother’s mother’s sibling’s spouse', 'great-aunt/uncle');
1372
+			case 'motmotsishus':
1373
+				return I18N::translateContext('mother’s mother’s sister’s husband', 'great-uncle');
1374
+			case 'motparbrowif':
1375
+				return I18N::translateContext('mother’s parent’s brother’s wife', 'great-aunt');
1376
+			case 'motparsibspo':
1377
+				return I18N::translateContext('mother’s parent’s sibling’s spouse', 'great-aunt/uncle');
1378
+			case 'motparsishus':
1379
+				return I18N::translateContext('mother’s parent’s sister’s husband', 'great-uncle');
1380
+			case 'parfatbrowif':
1381
+				return I18N::translateContext('parent’s father’s brother’s wife', 'great-aunt');
1382
+			case 'parfatsibspo':
1383
+				return I18N::translateContext('parent’s father’s sibling’s spouse', 'great-aunt/uncle');
1384
+			case 'parfatsishus':
1385
+				return I18N::translateContext('parent’s father’s sister’s husband', 'great-uncle');
1386
+			case 'parmotbrowif':
1387
+				return I18N::translateContext('parent’s mother’s brother’s wife', 'great-aunt');
1388
+			case 'parmotsibspo':
1389
+				return I18N::translateContext('parent’s mother’s sibling’s spouse', 'great-aunt/uncle');
1390
+			case 'parmotsishus':
1391
+				return I18N::translateContext('parent’s mother’s sister’s husband', 'great-uncle');
1392
+			case 'parparbrowif':
1393
+				return I18N::translateContext('parent’s parent’s brother’s wife', 'great-aunt');
1394
+			case 'parparsibspo':
1395
+				return I18N::translateContext('parent’s parent’s sibling’s spouse', 'great-aunt/uncle');
1396
+			case 'parparsishus':
1397
+				return I18N::translateContext('parent’s parent’s sister’s husband', 'great-uncle');
1398
+			case 'fatfatbrodau':
1399
+				return I18N::translateContext('father’s father’s brother’s daughter', 'first cousin once removed ascending');
1400
+			case 'fatfatbroson':
1401
+				return I18N::translateContext('father’s father’s brother’s son', 'first cousin once removed ascending');
1402
+			case 'fatfatbrochi':
1403
+				return I18N::translateContext('father’s father’s brother’s child', 'first cousin once removed ascending');
1404
+			case 'fatfatsisdau':
1405
+				return I18N::translateContext('father’s father’s sister’s daughter', 'first cousin once removed ascending');
1406
+			case 'fatfatsisson':
1407
+				return I18N::translateContext('father’s father’s sister’s son', 'first cousin once removed ascending');
1408
+			case 'fatfatsischi':
1409
+				return I18N::translateContext('father’s father’s sister’s child', 'first cousin once removed ascending');
1410
+			case 'fatmotbrodau':
1411
+				return I18N::translateContext('father’s mother’s brother’s daughter', 'first cousin once removed ascending');
1412
+			case 'fatmotbroson':
1413
+				return I18N::translateContext('father’s mother’s brother’s son', 'first cousin once removed ascending');
1414
+			case 'fatmotbrochi':
1415
+				return I18N::translateContext('father’s mother’s brother’s child', 'first cousin once removed ascending');
1416
+			case 'fatmotsisdau':
1417
+				return I18N::translateContext('father’s mother’s sister’s daughter', 'first cousin once removed ascending');
1418
+			case 'fatmotsisson':
1419
+				return I18N::translateContext('father’s mother’s sister’s son', 'first cousin once removed ascending');
1420
+			case 'fatmotsischi':
1421
+				return I18N::translateContext('father’s mother’s sister’s child', 'first cousin once removed ascending');
1422
+			case 'motfatbrodau':
1423
+				return I18N::translateContext('mother’s father’s brother’s daughter', 'first cousin once removed ascending');
1424
+			case 'motfatbroson':
1425
+				return I18N::translateContext('mother’s father’s brother’s son', 'first cousin once removed ascending');
1426
+			case 'motfatbrochi':
1427
+				return I18N::translateContext('mother’s father’s brother’s child', 'first cousin once removed ascending');
1428
+			case 'motfatsisdau':
1429
+				return I18N::translateContext('mother’s father’s sister’s daughter', 'first cousin once removed ascending');
1430
+			case 'motfatsisson':
1431
+				return I18N::translateContext('mother’s father’s sister’s son', 'first cousin once removed ascending');
1432
+			case 'motfatsischi':
1433
+				return I18N::translateContext('mother’s father’s sister’s child', 'first cousin once removed ascending');
1434
+			case 'motmotbrodau':
1435
+				return I18N::translateContext('mother’s mother’s brother’s daughter', 'first cousin once removed ascending');
1436
+			case 'motmotbroson':
1437
+				return I18N::translateContext('mother’s mother’s brother’s son', 'first cousin once removed ascending');
1438
+			case 'motmotbrochi':
1439
+				return I18N::translateContext('mother’s mother’s brother’s child', 'first cousin once removed ascending');
1440
+			case 'motmotsisdau':
1441
+				return I18N::translateContext('mother’s mother’s sister’s daughter', 'first cousin once removed ascending');
1442
+			case 'motmotsisson':
1443
+				return I18N::translateContext('mother’s mother’s sister’s son', 'first cousin once removed ascending');
1444
+			case 'motmotsischi':
1445
+				return I18N::translateContext('mother’s mother’s sister’s child', 'first cousin once removed ascending');
1446 1446
 		}
1447 1447
 
1448 1448
 		// Some “special case” level five relationships that have specific names in certain languages
@@ -1508,125 +1508,125 @@  discard block
 block discarded – undo
1508 1508
 			$up       = strlen($match[1]) / 3;
1509 1509
 			$bef_last = substr($path, -6, 3);
1510 1510
 			switch ($up) {
1511
-			case 3:
1512
-				switch ($sex2) {
1513
-				case 'M':
1514
-				if ($bef_last === 'fat') {
1515
-					return I18N::translateContext('great-grandfather’s brother', 'great-great-uncle');
1516
-				} elseif ($bef_last === 'mot') {
1517
-					return I18N::translateContext('great-grandmother’s brother', 'great-great-uncle');
1518
-				} else {
1519
-					return I18N::translateContext('great-grandparent’s brother', 'great-great-uncle');
1520
-				}
1521
-				case 'F':
1522
-				return I18N::translate('great-great-aunt');
1523
-				default:
1524
-				return I18N::translate('great-great-aunt/uncle');
1525
-				}
1526
-			case 4:
1527
-				switch ($sex2) {
1528
-				case 'M':
1529
-				if ($bef_last === 'fat') {
1530
-					return I18N::translateContext('great-great-grandfather’s brother', 'great-great-great-uncle');
1531
-				} elseif ($bef_last === 'mot') {
1532
-					return I18N::translateContext('great-great-grandmother’s brother', 'great-great-great-uncle');
1533
-				} else {
1534
-					return I18N::translateContext('great-great-grandparent’s brother', 'great-great-great-uncle');
1535
-				}
1536
-				case 'F':
1537
-				return I18N::translate('great-great-great-aunt');
1538
-				default:
1539
-				return I18N::translate('great-great-great-aunt/uncle');
1540
-				}
1541
-			case 5:
1542
-				switch ($sex2) {
1543
-				case 'M':
1544
-				if ($bef_last === 'fat') {
1545
-					return I18N::translateContext('great-great-great-grandfather’s brother', 'great ×4 uncle');
1546
-				} elseif ($bef_last === 'mot') {
1547
-					return I18N::translateContext('great-great-great-grandmother’s brother', 'great ×4 uncle');
1548
-				} else {
1549
-					return I18N::translateContext('great-great-great-grandparent’s brother', 'great ×4 uncle');
1550
-				}
1551
-				case 'F':
1552
-				return I18N::translate('great ×4 aunt');
1553
-				default:
1554
-				return I18N::translate('great ×4 aunt/uncle');
1555
-				}
1556
-			case 6:
1557
-				switch ($sex2) {
1558
-				case 'M':
1559
-				if ($bef_last === 'fat') {
1560
-					return I18N::translateContext('great ×4 grandfather’s brother', 'great ×5 uncle');
1561
-				} elseif ($bef_last === 'mot') {
1562
-					return I18N::translateContext('great ×4 grandmother’s brother', 'great ×5 uncle');
1563
-				} else {
1564
-					return I18N::translateContext('great ×4 grandparent’s brother', 'great ×5 uncle');
1565
-				}
1566
-				case 'F':
1567
-				return I18N::translate('great ×5 aunt');
1568
-				default:
1569
-				return I18N::translate('great ×5 aunt/uncle');
1570
-				}
1571
-			case 7:
1572
-				switch ($sex2) {
1573
-				case 'M':
1574
-				if ($bef_last === 'fat') {
1575
-					return I18N::translateContext('great ×5 grandfather’s brother', 'great ×6 uncle');
1576
-				} elseif ($bef_last === 'mot') {
1577
-					return I18N::translateContext('great ×5 grandmother’s brother', 'great ×6 uncle');
1578
-				} else {
1579
-					return I18N::translateContext('great ×5 grandparent’s brother', 'great ×6 uncle');
1580
-				}
1581
-				case 'F':
1582
-				return I18N::translate('great ×6 aunt');
1583
-				default:
1584
-				return I18N::translate('great ×6 aunt/uncle');
1585
-				}
1586
-			case 8:
1587
-				switch ($sex2) {
1588
-				case 'M':
1589
-				if ($bef_last === 'fat') {
1590
-					return I18N::translateContext('great ×6 grandfather’s brother', 'great ×7 uncle');
1591
-				} elseif ($bef_last === 'mot') {
1592
-					return I18N::translateContext('great ×6 grandmother’s brother', 'great ×7 uncle');
1593
-				} else {
1594
-					return I18N::translateContext('great ×6 grandparent’s brother', 'great ×7 uncle');
1595
-				}
1596
-				case 'F':
1597
-				return I18N::translate('great ×7 aunt');
1598
-				default:
1599
-				return I18N::translate('great ×7 aunt/uncle');
1600
-				}
1601
-			default:
1602
-				// Different languages have different rules for naming generations.
1603
-				// An English great ×12 uncle is a Danish great ×10 uncle.
1604
-				//
1605
-				// Need to find out which languages use which rules.
1606
-				switch (WT_LOCALE) {
1607
-				case 'da':
1608
-				switch ($sex2) {
1609
-				case 'M':
1610
-				return I18N::translate('great ×%s uncle', I18N::number($up - 4));
1611
-				case 'F':
1612
-				return I18N::translate('great ×%s aunt', I18N::number($up - 4));
1511
+				case 3:
1512
+					switch ($sex2) {
1513
+						case 'M':
1514
+						if ($bef_last === 'fat') {
1515
+							return I18N::translateContext('great-grandfather’s brother', 'great-great-uncle');
1516
+						} elseif ($bef_last === 'mot') {
1517
+							return I18N::translateContext('great-grandmother’s brother', 'great-great-uncle');
1518
+						} else {
1519
+							return I18N::translateContext('great-grandparent’s brother', 'great-great-uncle');
1520
+						}
1521
+						case 'F':
1522
+						return I18N::translate('great-great-aunt');
1523
+						default:
1524
+						return I18N::translate('great-great-aunt/uncle');
1525
+					}
1526
+				case 4:
1527
+					switch ($sex2) {
1528
+						case 'M':
1529
+						if ($bef_last === 'fat') {
1530
+							return I18N::translateContext('great-great-grandfather’s brother', 'great-great-great-uncle');
1531
+						} elseif ($bef_last === 'mot') {
1532
+							return I18N::translateContext('great-great-grandmother’s brother', 'great-great-great-uncle');
1533
+						} else {
1534
+							return I18N::translateContext('great-great-grandparent’s brother', 'great-great-great-uncle');
1535
+						}
1536
+						case 'F':
1537
+						return I18N::translate('great-great-great-aunt');
1538
+						default:
1539
+						return I18N::translate('great-great-great-aunt/uncle');
1540
+					}
1541
+				case 5:
1542
+					switch ($sex2) {
1543
+						case 'M':
1544
+						if ($bef_last === 'fat') {
1545
+							return I18N::translateContext('great-great-great-grandfather’s brother', 'great ×4 uncle');
1546
+						} elseif ($bef_last === 'mot') {
1547
+							return I18N::translateContext('great-great-great-grandmother’s brother', 'great ×4 uncle');
1548
+						} else {
1549
+							return I18N::translateContext('great-great-great-grandparent’s brother', 'great ×4 uncle');
1550
+						}
1551
+						case 'F':
1552
+						return I18N::translate('great ×4 aunt');
1553
+						default:
1554
+						return I18N::translate('great ×4 aunt/uncle');
1555
+					}
1556
+				case 6:
1557
+					switch ($sex2) {
1558
+						case 'M':
1559
+						if ($bef_last === 'fat') {
1560
+							return I18N::translateContext('great ×4 grandfather’s brother', 'great ×5 uncle');
1561
+						} elseif ($bef_last === 'mot') {
1562
+							return I18N::translateContext('great ×4 grandmother’s brother', 'great ×5 uncle');
1563
+						} else {
1564
+							return I18N::translateContext('great ×4 grandparent’s brother', 'great ×5 uncle');
1565
+						}
1566
+						case 'F':
1567
+						return I18N::translate('great ×5 aunt');
1568
+						default:
1569
+						return I18N::translate('great ×5 aunt/uncle');
1570
+					}
1571
+				case 7:
1572
+					switch ($sex2) {
1573
+						case 'M':
1574
+						if ($bef_last === 'fat') {
1575
+							return I18N::translateContext('great ×5 grandfather’s brother', 'great ×6 uncle');
1576
+						} elseif ($bef_last === 'mot') {
1577
+							return I18N::translateContext('great ×5 grandmother’s brother', 'great ×6 uncle');
1578
+						} else {
1579
+							return I18N::translateContext('great ×5 grandparent’s brother', 'great ×6 uncle');
1580
+						}
1581
+						case 'F':
1582
+						return I18N::translate('great ×6 aunt');
1583
+						default:
1584
+						return I18N::translate('great ×6 aunt/uncle');
1585
+					}
1586
+				case 8:
1587
+					switch ($sex2) {
1588
+						case 'M':
1589
+						if ($bef_last === 'fat') {
1590
+							return I18N::translateContext('great ×6 grandfather’s brother', 'great ×7 uncle');
1591
+						} elseif ($bef_last === 'mot') {
1592
+							return I18N::translateContext('great ×6 grandmother’s brother', 'great ×7 uncle');
1593
+						} else {
1594
+							return I18N::translateContext('great ×6 grandparent’s brother', 'great ×7 uncle');
1595
+						}
1596
+						case 'F':
1597
+						return I18N::translate('great ×7 aunt');
1598
+						default:
1599
+						return I18N::translate('great ×7 aunt/uncle');
1600
+					}
1613 1601
 				default:
1614
-				return I18N::translate('great ×%s aunt/uncle', I18N::number($up - 4));
1615
-				}
1602
+					// Different languages have different rules for naming generations.
1603
+					// An English great ×12 uncle is a Danish great ×10 uncle.
1604
+					//
1605
+					// Need to find out which languages use which rules.
1606
+					switch (WT_LOCALE) {
1607
+						case 'da':
1608
+						switch ($sex2) {
1609
+							case 'M':
1610
+							return I18N::translate('great ×%s uncle', I18N::number($up - 4));
1611
+							case 'F':
1612
+							return I18N::translate('great ×%s aunt', I18N::number($up - 4));
1613
+							default:
1614
+							return I18N::translate('great ×%s aunt/uncle', I18N::number($up - 4));
1615
+						}
1616 1616
 				case 'pl':
1617 1617
 					switch ($sex2) {
1618
-					case 'M':
1619
-					if ($bef_last === 'fat') {
1620
-						return I18N::translateContext('great ×(%s-1) grandfather’s brother', 'great ×%s uncle', I18N::number($up - 2));
1621
-					} elseif ($bef_last === 'mot') {
1622
-						return I18N::translateContext('great ×(%s-1) grandmother’s brother', 'great ×%s uncle', I18N::number($up - 2));
1623
-					} else {
1624
-						return I18N::translateContext('great ×(%s-1) grandparent’s brother', 'great ×%s uncle', I18N::number($up - 2));
1625
-					}
1626
-					case 'F':
1627
-					return I18N::translate('great ×%s aunt', I18N::number($up - 2));
1628
-					default:
1629
-					return I18N::translate('great ×%s aunt/uncle', I18N::number($up - 2));
1618
+						case 'M':
1619
+						if ($bef_last === 'fat') {
1620
+							return I18N::translateContext('great ×(%s-1) grandfather’s brother', 'great ×%s uncle', I18N::number($up - 2));
1621
+						} elseif ($bef_last === 'mot') {
1622
+							return I18N::translateContext('great ×(%s-1) grandmother’s brother', 'great ×%s uncle', I18N::number($up - 2));
1623
+						} else {
1624
+							return I18N::translateContext('great ×(%s-1) grandparent’s brother', 'great ×%s uncle', I18N::number($up - 2));
1625
+						}
1626
+						case 'F':
1627
+						return I18N::translate('great ×%s aunt', I18N::number($up - 2));
1628
+						default:
1629
+						return I18N::translate('great ×%s aunt/uncle', I18N::number($up - 2));
1630 1630
 					}
1631 1631
 				case 'it': // Source: Michele Locati
1632 1632
 				case 'en_AU':
@@ -1634,12 +1634,12 @@  discard block
 block discarded – undo
1634 1634
 				case 'en_US':
1635 1635
 				default:
1636 1636
 					switch ($sex2) {
1637
-					case 'M': // I18N: if you need a different number for %s, contact the developers, as a code-change is required
1638
-					return I18N::translate('great ×%s uncle', I18N::number($up - 1));
1639
-					case 'F':
1640
-					return I18N::translate('great ×%s aunt', I18N::number($up - 1));
1641
-					default:
1642
-					return I18N::translate('great ×%s aunt/uncle', I18N::number($up - 1));
1637
+						case 'M': // I18N: if you need a different number for %s, contact the developers, as a code-change is required
1638
+						return I18N::translate('great ×%s uncle', I18N::number($up - 1));
1639
+						case 'F':
1640
+						return I18N::translate('great ×%s aunt', I18N::number($up - 1));
1641
+						default:
1642
+						return I18N::translate('great ×%s aunt/uncle', I18N::number($up - 1));
1643 1643
 					}
1644 1644
 					}
1645 1645
 			}
@@ -1649,155 +1649,155 @@  discard block
 block discarded – undo
1649 1649
 			$down  = strlen($match[1]) / 3 + 1; // Add one, as we count generations from the common ancestor
1650 1650
 			$first = substr($path, 0, 3);
1651 1651
 			switch ($down) {
1652
-			case 4:
1653
-				switch ($sex2) {
1654
-				case 'M':
1655
-				if ($first === 'bro' && $sex1 === 'M') {
1656
-					return I18N::translateContext('(a man’s) brother’s great-grandson', 'great-great-nephew');
1657
-				} elseif ($first === 'sis' && $sex1 === 'M') {
1658
-					return I18N::translateContext('(a man’s) sister’s great-grandson', 'great-great-nephew');
1659
-				} else {
1660
-					return I18N::translateContext('(a woman’s) great-great-nephew', 'great-great-nephew');
1661
-				}
1662
-				case 'F':
1663
-				if ($first === 'bro' && $sex1 === 'M') {
1664
-					return I18N::translateContext('(a man’s) brother’s great-granddaughter', 'great-great-niece');
1665
-				} elseif ($first === 'sis' && $sex1 === 'M') {
1666
-					return I18N::translateContext('(a man’s) sister’s great-granddaughter', 'great-great-niece');
1667
-				} else {
1668
-					return I18N::translateContext('(a woman’s) great-great-niece', 'great-great-niece');
1669
-				}
1670
-				default:
1671
-				if ($first === 'bro' && $sex1 === 'M') {
1672
-					return I18N::translateContext('(a man’s) brother’s great-grandchild', 'great-great-nephew/niece');
1673
-				} elseif ($first === 'sis' && $sex1 === 'M') {
1674
-					return I18N::translateContext('(a man’s) sister’s great-grandchild', 'great-great-nephew/niece');
1675
-				} else {
1676
-					return I18N::translateContext('(a woman’s) great-great-nephew/niece', 'great-great-nephew/niece');
1677
-				}
1678
-				}
1679
-			case 5:
1680
-				switch ($sex2) {
1681
-				case 'M':
1682
-				if ($first === 'bro' && $sex1 === 'M') {
1683
-					return I18N::translateContext('(a man’s) brother’s great-great-grandson', 'great-great-great-nephew');
1684
-				} elseif ($first === 'sis' && $sex1 === 'M') {
1685
-					return I18N::translateContext('(a man’s) sister’s great-great-grandson', 'great-great-great-nephew');
1686
-				} else {
1687
-					return I18N::translateContext('(a woman’s) great-great-great-nephew', 'great-great-great-nephew');
1688
-				}
1689
-				case 'F':
1690
-				if ($first === 'bro' && $sex1 === 'M') {
1691
-					return I18N::translateContext('(a man’s) brother’s great-great-granddaughter', 'great-great-great-niece');
1692
-				} elseif ($first === 'sis' && $sex1 === 'M') {
1693
-					return I18N::translateContext('(a man’s) sister’s great-great-granddaughter', 'great-great-great-niece');
1694
-				} else {
1695
-					return I18N::translateContext('(a woman’s) great-great-great-niece', 'great-great-great-niece');
1696
-				}
1697
-				default:
1698
-				if ($first === 'bro' && $sex1 === 'M') {
1699
-					return I18N::translateContext('(a man’s) brother’s great-great-grandchild', 'great-great-great-nephew/niece');
1700
-				} elseif ($first === 'sis' && $sex1 === 'M') {
1701
-					return I18N::translateContext('(a man’s) sister’s great-great-grandchild', 'great-great-great-nephew/niece');
1702
-				} else {
1703
-					return I18N::translateContext('(a woman’s) great-great-great-nephew/niece', 'great-great-great-nephew/niece');
1704
-				}
1705
-				}
1706
-			case 6:
1707
-				switch ($sex2) {
1708
-				case 'M':
1709
-				if ($first === 'bro' && $sex1 === 'M') {
1710
-					return I18N::translateContext('(a man’s) brother’s great-great-great-grandson', 'great ×4 nephew');
1711
-				} elseif ($first === 'sis' && $sex1 === 'M') {
1712
-					return I18N::translateContext('(a man’s) sister’s great-great-great-grandson', 'great ×4 nephew');
1713
-				} else {
1714
-					return I18N::translateContext('(a woman’s) great ×4 nephew', 'great ×4 nephew');
1715
-				}
1716
-				case 'F':
1717
-				if ($first === 'bro' && $sex1 === 'M') {
1718
-					return I18N::translateContext('(a man’s) brother’s great-great-great-granddaughter', 'great ×4 niece');
1719
-				} elseif ($first === 'sis' && $sex1 === 'M') {
1720
-					return I18N::translateContext('(a man’s) sister’s great-great-great-granddaughter', 'great ×4 niece');
1721
-				} else {
1722
-					return I18N::translateContext('(a woman’s) great ×4 niece', 'great ×4 niece');
1723
-				}
1724
-				default:
1725
-				if ($first === 'bro' && $sex1 === 'M') {
1726
-					return I18N::translateContext('(a man’s) brother’s great-great-great-grandchild', 'great ×4 nephew/niece');
1727
-				} elseif ($first === 'sis' && $sex1 === 'M') {
1728
-					return I18N::translateContext('(a man’s) sister’s great-great-great-grandchild', 'great ×4 nephew/niece');
1729
-				} else {
1730
-					return I18N::translateContext('(a woman’s) great ×4 nephew/niece', 'great ×4 nephew/niece');
1731
-				}
1732
-				}
1733
-			case 7:
1734
-				switch ($sex2) {
1735
-				case 'M':
1736
-				if ($first === 'bro' && $sex1 === 'M') {
1737
-					return I18N::translateContext('(a man’s) brother’s great ×4 grandson', 'great ×5 nephew');
1738
-				} elseif ($first === 'sis' && $sex1 === 'M') {
1739
-					return I18N::translateContext('(a man’s) sister’s great ×4 grandson', 'great ×5 nephew');
1740
-				} else {
1741
-					return I18N::translateContext('(a woman’s) great ×5 nephew', 'great ×5 nephew');
1742
-				}
1743
-				case 'F':
1744
-				if ($first === 'bro' && $sex1 === 'M') {
1745
-					return I18N::translateContext('(a man’s) brother’s great ×4 granddaughter', 'great ×5 niece');
1746
-				} elseif ($first === 'sis' && $sex1 === 'M') {
1747
-					return I18N::translateContext('(a man’s) sister’s great ×4 granddaughter', 'great ×5 niece');
1748
-				} else {
1749
-					return I18N::translateContext('(a woman’s) great ×5 niece', 'great ×5 niece');
1750
-				}
1751
-				default:
1752
-				if ($first === 'bro' && $sex1 === 'M') {
1753
-					return I18N::translateContext('(a man’s) brother’s great ×4 grandchild', 'great ×5 nephew/niece');
1754
-				} elseif ($first === 'sis' && $sex1 === 'M') {
1755
-					return I18N::translateContext('(a man’s) sister’s great ×4 grandchild', 'great ×5 nephew/niece');
1756
-				} else {
1757
-					return I18N::translateContext('(a woman’s) great ×5 nephew/niece', 'great ×5 nephew/niece');
1758
-				}
1759
-				}
1760
-			default:
1761
-				// Different languages have different rules for naming generations.
1762
-				// An English great ×12 nephew is a Polish great ×11 nephew.
1763
-				//
1764
-				// Need to find out which languages use which rules.
1765
-				switch (WT_LOCALE) {
1766
-				case 'pl': // Source: Lukasz Wilenski
1767
-				switch ($sex2) {
1768
-				case 'M':
1769
-				if ($first === 'bro' && $sex1 === 'M') {
1770
-					return I18N::translateContext('(a man’s) brother’s great ×(%s-1) grandson', 'great ×%s nephew', I18N::number($down - 3));
1771
-				} elseif ($first === 'sis' && $sex1 === 'M') {
1772
-					return I18N::translateContext('(a man’s) sister’s great ×(%s-1) grandson', 'great ×%s nephew', I18N::number($down - 3));
1773
-				} else {
1774
-					return I18N::translateContext('(a woman’s) great ×%s nephew', 'great ×%s nephew', I18N::number($down - 3));
1775
-				}
1776
-				case 'F':
1777
-				if ($first === 'bro' && $sex1 === 'M') {
1778
-					return I18N::translateContext('(a man’s) brother’s great ×(%s-1) granddaughter', 'great ×%s niece', I18N::number($down - 3));
1779
-				} elseif ($first === 'sis' && $sex1 === 'M') {
1780
-					return I18N::translateContext('(a man’s) sister’s great ×(%s-1) granddaughter', 'great ×%s niece', I18N::number($down - 3));
1781
-				} else {
1782
-					return I18N::translateContext('(a woman’s) great ×%s niece', 'great ×%s niece', I18N::number($down - 3));
1783
-				}
1652
+				case 4:
1653
+					switch ($sex2) {
1654
+						case 'M':
1655
+						if ($first === 'bro' && $sex1 === 'M') {
1656
+							return I18N::translateContext('(a man’s) brother’s great-grandson', 'great-great-nephew');
1657
+						} elseif ($first === 'sis' && $sex1 === 'M') {
1658
+							return I18N::translateContext('(a man’s) sister’s great-grandson', 'great-great-nephew');
1659
+						} else {
1660
+							return I18N::translateContext('(a woman’s) great-great-nephew', 'great-great-nephew');
1661
+						}
1662
+						case 'F':
1663
+						if ($first === 'bro' && $sex1 === 'M') {
1664
+							return I18N::translateContext('(a man’s) brother’s great-granddaughter', 'great-great-niece');
1665
+						} elseif ($first === 'sis' && $sex1 === 'M') {
1666
+							return I18N::translateContext('(a man’s) sister’s great-granddaughter', 'great-great-niece');
1667
+						} else {
1668
+							return I18N::translateContext('(a woman’s) great-great-niece', 'great-great-niece');
1669
+						}
1670
+						default:
1671
+						if ($first === 'bro' && $sex1 === 'M') {
1672
+							return I18N::translateContext('(a man’s) brother’s great-grandchild', 'great-great-nephew/niece');
1673
+						} elseif ($first === 'sis' && $sex1 === 'M') {
1674
+							return I18N::translateContext('(a man’s) sister’s great-grandchild', 'great-great-nephew/niece');
1675
+						} else {
1676
+							return I18N::translateContext('(a woman’s) great-great-nephew/niece', 'great-great-nephew/niece');
1677
+						}
1678
+					}
1679
+				case 5:
1680
+					switch ($sex2) {
1681
+						case 'M':
1682
+						if ($first === 'bro' && $sex1 === 'M') {
1683
+							return I18N::translateContext('(a man’s) brother’s great-great-grandson', 'great-great-great-nephew');
1684
+						} elseif ($first === 'sis' && $sex1 === 'M') {
1685
+							return I18N::translateContext('(a man’s) sister’s great-great-grandson', 'great-great-great-nephew');
1686
+						} else {
1687
+							return I18N::translateContext('(a woman’s) great-great-great-nephew', 'great-great-great-nephew');
1688
+						}
1689
+						case 'F':
1690
+						if ($first === 'bro' && $sex1 === 'M') {
1691
+							return I18N::translateContext('(a man’s) brother’s great-great-granddaughter', 'great-great-great-niece');
1692
+						} elseif ($first === 'sis' && $sex1 === 'M') {
1693
+							return I18N::translateContext('(a man’s) sister’s great-great-granddaughter', 'great-great-great-niece');
1694
+						} else {
1695
+							return I18N::translateContext('(a woman’s) great-great-great-niece', 'great-great-great-niece');
1696
+						}
1697
+						default:
1698
+						if ($first === 'bro' && $sex1 === 'M') {
1699
+							return I18N::translateContext('(a man’s) brother’s great-great-grandchild', 'great-great-great-nephew/niece');
1700
+						} elseif ($first === 'sis' && $sex1 === 'M') {
1701
+							return I18N::translateContext('(a man’s) sister’s great-great-grandchild', 'great-great-great-nephew/niece');
1702
+						} else {
1703
+							return I18N::translateContext('(a woman’s) great-great-great-nephew/niece', 'great-great-great-nephew/niece');
1704
+						}
1705
+					}
1706
+				case 6:
1707
+					switch ($sex2) {
1708
+						case 'M':
1709
+						if ($first === 'bro' && $sex1 === 'M') {
1710
+							return I18N::translateContext('(a man’s) brother’s great-great-great-grandson', 'great ×4 nephew');
1711
+						} elseif ($first === 'sis' && $sex1 === 'M') {
1712
+							return I18N::translateContext('(a man’s) sister’s great-great-great-grandson', 'great ×4 nephew');
1713
+						} else {
1714
+							return I18N::translateContext('(a woman’s) great ×4 nephew', 'great ×4 nephew');
1715
+						}
1716
+						case 'F':
1717
+						if ($first === 'bro' && $sex1 === 'M') {
1718
+							return I18N::translateContext('(a man’s) brother’s great-great-great-granddaughter', 'great ×4 niece');
1719
+						} elseif ($first === 'sis' && $sex1 === 'M') {
1720
+							return I18N::translateContext('(a man’s) sister’s great-great-great-granddaughter', 'great ×4 niece');
1721
+						} else {
1722
+							return I18N::translateContext('(a woman’s) great ×4 niece', 'great ×4 niece');
1723
+						}
1724
+						default:
1725
+						if ($first === 'bro' && $sex1 === 'M') {
1726
+							return I18N::translateContext('(a man’s) brother’s great-great-great-grandchild', 'great ×4 nephew/niece');
1727
+						} elseif ($first === 'sis' && $sex1 === 'M') {
1728
+							return I18N::translateContext('(a man’s) sister’s great-great-great-grandchild', 'great ×4 nephew/niece');
1729
+						} else {
1730
+							return I18N::translateContext('(a woman’s) great ×4 nephew/niece', 'great ×4 nephew/niece');
1731
+						}
1732
+					}
1733
+				case 7:
1734
+					switch ($sex2) {
1735
+						case 'M':
1736
+						if ($first === 'bro' && $sex1 === 'M') {
1737
+							return I18N::translateContext('(a man’s) brother’s great ×4 grandson', 'great ×5 nephew');
1738
+						} elseif ($first === 'sis' && $sex1 === 'M') {
1739
+							return I18N::translateContext('(a man’s) sister’s great ×4 grandson', 'great ×5 nephew');
1740
+						} else {
1741
+							return I18N::translateContext('(a woman’s) great ×5 nephew', 'great ×5 nephew');
1742
+						}
1743
+						case 'F':
1744
+						if ($first === 'bro' && $sex1 === 'M') {
1745
+							return I18N::translateContext('(a man’s) brother’s great ×4 granddaughter', 'great ×5 niece');
1746
+						} elseif ($first === 'sis' && $sex1 === 'M') {
1747
+							return I18N::translateContext('(a man’s) sister’s great ×4 granddaughter', 'great ×5 niece');
1748
+						} else {
1749
+							return I18N::translateContext('(a woman’s) great ×5 niece', 'great ×5 niece');
1750
+						}
1751
+						default:
1752
+						if ($first === 'bro' && $sex1 === 'M') {
1753
+							return I18N::translateContext('(a man’s) brother’s great ×4 grandchild', 'great ×5 nephew/niece');
1754
+						} elseif ($first === 'sis' && $sex1 === 'M') {
1755
+							return I18N::translateContext('(a man’s) sister’s great ×4 grandchild', 'great ×5 nephew/niece');
1756
+						} else {
1757
+							return I18N::translateContext('(a woman’s) great ×5 nephew/niece', 'great ×5 nephew/niece');
1758
+						}
1759
+					}
1784 1760
 				default:
1785
-				if ($first === 'bro' && $sex1 === 'M') {
1786
-					return I18N::translateContext('(a man’s) brother’s great ×(%s-1) grandchild', 'great ×%s nephew/niece', I18N::number($down - 3));
1787
-				} elseif ($first === 'sis' && $sex1 === 'M') {
1788
-					return I18N::translateContext('(a man’s) sister’s great ×(%s-1) grandchild', 'great ×%s nephew/niece', I18N::number($down - 3));
1789
-				} else {
1790
-					return I18N::translateContext('(a woman’s) great ×%s nephew/niece', 'great ×%s nephew/niece', I18N::number($down - 3));
1791
-				}
1792
-				}
1761
+					// Different languages have different rules for naming generations.
1762
+					// An English great ×12 nephew is a Polish great ×11 nephew.
1763
+					//
1764
+					// Need to find out which languages use which rules.
1765
+					switch (WT_LOCALE) {
1766
+						case 'pl': // Source: Lukasz Wilenski
1767
+						switch ($sex2) {
1768
+							case 'M':
1769
+							if ($first === 'bro' && $sex1 === 'M') {
1770
+								return I18N::translateContext('(a man’s) brother’s great ×(%s-1) grandson', 'great ×%s nephew', I18N::number($down - 3));
1771
+							} elseif ($first === 'sis' && $sex1 === 'M') {
1772
+								return I18N::translateContext('(a man’s) sister’s great ×(%s-1) grandson', 'great ×%s nephew', I18N::number($down - 3));
1773
+							} else {
1774
+								return I18N::translateContext('(a woman’s) great ×%s nephew', 'great ×%s nephew', I18N::number($down - 3));
1775
+							}
1776
+							case 'F':
1777
+							if ($first === 'bro' && $sex1 === 'M') {
1778
+								return I18N::translateContext('(a man’s) brother’s great ×(%s-1) granddaughter', 'great ×%s niece', I18N::number($down - 3));
1779
+							} elseif ($first === 'sis' && $sex1 === 'M') {
1780
+								return I18N::translateContext('(a man’s) sister’s great ×(%s-1) granddaughter', 'great ×%s niece', I18N::number($down - 3));
1781
+							} else {
1782
+								return I18N::translateContext('(a woman’s) great ×%s niece', 'great ×%s niece', I18N::number($down - 3));
1783
+							}
1784
+							default:
1785
+							if ($first === 'bro' && $sex1 === 'M') {
1786
+								return I18N::translateContext('(a man’s) brother’s great ×(%s-1) grandchild', 'great ×%s nephew/niece', I18N::number($down - 3));
1787
+							} elseif ($first === 'sis' && $sex1 === 'M') {
1788
+								return I18N::translateContext('(a man’s) sister’s great ×(%s-1) grandchild', 'great ×%s nephew/niece', I18N::number($down - 3));
1789
+							} else {
1790
+								return I18N::translateContext('(a woman’s) great ×%s nephew/niece', 'great ×%s nephew/niece', I18N::number($down - 3));
1791
+							}
1792
+						}
1793 1793
 				case 'he': // Source: Meliza Amity
1794 1794
 					switch ($sex2) {
1795
-					case 'M':
1796
-					return I18N::translate('great ×%s nephew', I18N::number($down - 1));
1797
-					case 'F':
1798
-					return I18N::translate('great ×%s niece', I18N::number($down - 1));
1799
-					default:
1800
-					return I18N::translate('great ×%s nephew/niece', I18N::number($down - 1));
1795
+						case 'M':
1796
+						return I18N::translate('great ×%s nephew', I18N::number($down - 1));
1797
+						case 'F':
1798
+						return I18N::translate('great ×%s niece', I18N::number($down - 1));
1799
+						default:
1800
+						return I18N::translate('great ×%s nephew/niece', I18N::number($down - 1));
1801 1801
 					}
1802 1802
 				case 'it': // Source: Michele Locati.
1803 1803
 				case 'en_AU':
@@ -1805,12 +1805,12 @@  discard block
 block discarded – undo
1805 1805
 				case 'en_US':
1806 1806
 				default:
1807 1807
 					switch ($sex2) {
1808
-					case 'M': // I18N: if you need a different number for %s, contact the developers, as a code-change is required
1809
-					return I18N::translate('great ×%s nephew', I18N::number($down - 2));
1810
-					case 'F':
1811
-					return I18N::translate('great ×%s niece', I18N::number($down - 2));
1812
-					default:
1813
-					return I18N::translate('great ×%s nephew/niece', I18N::number($down - 2));
1808
+						case 'M': // I18N: if you need a different number for %s, contact the developers, as a code-change is required
1809
+						return I18N::translate('great ×%s nephew', I18N::number($down - 2));
1810
+						case 'F':
1811
+						return I18N::translate('great ×%s niece', I18N::number($down - 2));
1812
+						default:
1813
+						return I18N::translate('great ×%s nephew/niece', I18N::number($down - 2));
1814 1814
 					}
1815 1815
 					}
1816 1816
 			}
@@ -1819,116 +1819,116 @@  discard block
 block discarded – undo
1819 1819
 			// direct ancestors
1820 1820
 			$up = strlen($match[1]) / 3;
1821 1821
 			switch ($up) {
1822
-			case 4:
1823
-				switch ($sex2) {
1824
-				case 'M':
1825
-				return I18N::translate('great-great-grandfather');
1826
-				case 'F':
1827
-				return I18N::translate('great-great-grandmother');
1828
-				default:
1829
-				return I18N::translate('great-great-grandparent');
1830
-				}
1831
-			case 5:
1832
-				switch ($sex2) {
1833
-				case 'M':
1834
-				return I18N::translate('great-great-great-grandfather');
1835
-				case 'F':
1836
-				return I18N::translate('great-great-great-grandmother');
1837
-				default:
1838
-				return I18N::translate('great-great-great-grandparent');
1839
-				}
1840
-			case 6:
1841
-				switch ($sex2) {
1842
-				case 'M':
1843
-				return I18N::translate('great ×4 grandfather');
1844
-				case 'F':
1845
-				return I18N::translate('great ×4 grandmother');
1846
-				default:
1847
-				return I18N::translate('great ×4 grandparent');
1848
-				}
1849
-			case 7:
1850
-				switch ($sex2) {
1851
-				case 'M':
1852
-				return I18N::translate('great ×5 grandfather');
1853
-				case 'F':
1854
-				return I18N::translate('great ×5 grandmother');
1855
-				default:
1856
-				return I18N::translate('great ×5 grandparent');
1857
-				}
1858
-			case 8:
1859
-				switch ($sex2) {
1860
-				case 'M':
1861
-				return I18N::translate('great ×6 grandfather');
1862
-				case 'F':
1863
-				return I18N::translate('great ×6 grandmother');
1864
-				default:
1865
-				return I18N::translate('great ×6 grandparent');
1866
-				}
1867
-			case 9:
1868
-				switch ($sex2) {
1869
-				case 'M':
1870
-				return I18N::translate('great ×7 grandfather');
1871
-				case 'F':
1872
-				return I18N::translate('great ×7 grandmother');
1873
-				default:
1874
-				return I18N::translate('great ×7 grandparent');
1875
-				}
1876
-			default:
1877
-				// Different languages have different rules for naming generations.
1878
-				// An English great ×12 grandfather is a Danish great ×11 grandfather.
1879
-				//
1880
-				// Need to find out which languages use which rules.
1881
-				switch (WT_LOCALE) {
1882
-				case 'da': // Source: Patrick Sorensen
1883
-				switch ($sex2) {
1884
-				case 'M':
1885
-				return I18N::translate('great ×%s grandfather', I18N::number($up - 3));
1886
-				case 'F':
1887
-				return I18N::translate('great ×%s grandmother', I18N::number($up - 3));
1822
+				case 4:
1823
+					switch ($sex2) {
1824
+						case 'M':
1825
+						return I18N::translate('great-great-grandfather');
1826
+						case 'F':
1827
+						return I18N::translate('great-great-grandmother');
1828
+						default:
1829
+						return I18N::translate('great-great-grandparent');
1830
+					}
1831
+				case 5:
1832
+					switch ($sex2) {
1833
+						case 'M':
1834
+						return I18N::translate('great-great-great-grandfather');
1835
+						case 'F':
1836
+						return I18N::translate('great-great-great-grandmother');
1837
+						default:
1838
+						return I18N::translate('great-great-great-grandparent');
1839
+					}
1840
+				case 6:
1841
+					switch ($sex2) {
1842
+						case 'M':
1843
+						return I18N::translate('great ×4 grandfather');
1844
+						case 'F':
1845
+						return I18N::translate('great ×4 grandmother');
1846
+						default:
1847
+						return I18N::translate('great ×4 grandparent');
1848
+					}
1849
+				case 7:
1850
+					switch ($sex2) {
1851
+						case 'M':
1852
+						return I18N::translate('great ×5 grandfather');
1853
+						case 'F':
1854
+						return I18N::translate('great ×5 grandmother');
1855
+						default:
1856
+						return I18N::translate('great ×5 grandparent');
1857
+					}
1858
+				case 8:
1859
+					switch ($sex2) {
1860
+						case 'M':
1861
+						return I18N::translate('great ×6 grandfather');
1862
+						case 'F':
1863
+						return I18N::translate('great ×6 grandmother');
1864
+						default:
1865
+						return I18N::translate('great ×6 grandparent');
1866
+					}
1867
+				case 9:
1868
+					switch ($sex2) {
1869
+						case 'M':
1870
+						return I18N::translate('great ×7 grandfather');
1871
+						case 'F':
1872
+						return I18N::translate('great ×7 grandmother');
1873
+						default:
1874
+						return I18N::translate('great ×7 grandparent');
1875
+					}
1888 1876
 				default:
1889
-				return I18N::translate('great ×%s grandparent', I18N::number($up - 3));
1890
-				}
1877
+					// Different languages have different rules for naming generations.
1878
+					// An English great ×12 grandfather is a Danish great ×11 grandfather.
1879
+					//
1880
+					// Need to find out which languages use which rules.
1881
+					switch (WT_LOCALE) {
1882
+						case 'da': // Source: Patrick Sorensen
1883
+						switch ($sex2) {
1884
+							case 'M':
1885
+							return I18N::translate('great ×%s grandfather', I18N::number($up - 3));
1886
+							case 'F':
1887
+							return I18N::translate('great ×%s grandmother', I18N::number($up - 3));
1888
+							default:
1889
+							return I18N::translate('great ×%s grandparent', I18N::number($up - 3));
1890
+						}
1891 1891
 				case 'it': // Source: Michele Locati
1892 1892
 				case 'es': // Source: Wes Groleau
1893 1893
 					switch ($sex2) {
1894
-					case 'M':
1895
-					return I18N::translate('great ×%s grandfather', I18N::number($up));
1896
-					case 'F':
1897
-					return I18N::translate('great ×%s grandmother', I18N::number($up));
1898
-					default:
1899
-					return I18N::translate('great ×%s grandparent', I18N::number($up));
1894
+						case 'M':
1895
+						return I18N::translate('great ×%s grandfather', I18N::number($up));
1896
+						case 'F':
1897
+						return I18N::translate('great ×%s grandmother', I18N::number($up));
1898
+						default:
1899
+						return I18N::translate('great ×%s grandparent', I18N::number($up));
1900 1900
 					}
1901 1901
 				case 'fr': // Source: Jacqueline Tetreault
1902 1902
 				case 'fr_CA':
1903 1903
 					switch ($sex2) {
1904
-					case 'M':
1905
-					return I18N::translate('great ×%s grandfather', I18N::number($up - 1));
1906
-					case 'F':
1907
-					return I18N::translate('great ×%s grandmother', I18N::number($up - 1));
1908
-					default:
1909
-					return I18N::translate('great ×%s grandparent', I18N::number($up - 1));
1904
+						case 'M':
1905
+						return I18N::translate('great ×%s grandfather', I18N::number($up - 1));
1906
+						case 'F':
1907
+						return I18N::translate('great ×%s grandmother', I18N::number($up - 1));
1908
+						default:
1909
+						return I18N::translate('great ×%s grandparent', I18N::number($up - 1));
1910 1910
 					}
1911 1911
 				case 'nn': // Source: Hogne Røed Nilsen (https://bugs.launchpad.net/webtrees/+bug/1168553)
1912 1912
 				case 'nb':
1913 1913
 					switch ($sex2) {
1914
-					case 'M': // I18N: if you need a different number for %s, contact the developers, as a code-change is required
1915
-					return I18N::translate('great ×%s grandfather', I18N::number($up - 3));
1916
-					case 'F':
1917
-					return I18N::translate('great ×%s grandmother', I18N::number($up - 3));
1918
-					default:
1919
-					return I18N::translate('great ×%s grandparent', I18N::number($up - 3));
1914
+						case 'M': // I18N: if you need a different number for %s, contact the developers, as a code-change is required
1915
+						return I18N::translate('great ×%s grandfather', I18N::number($up - 3));
1916
+						case 'F':
1917
+						return I18N::translate('great ×%s grandmother', I18N::number($up - 3));
1918
+						default:
1919
+						return I18N::translate('great ×%s grandparent', I18N::number($up - 3));
1920 1920
 					}
1921 1921
 				case 'en_AU':
1922 1922
 				case 'en_GB':
1923 1923
 				case 'en_US':
1924 1924
 				default:
1925 1925
 					switch ($sex2) {
1926
-					case 'M': // I18N: if you need a different number for %s, contact the developers, as a code-change is required
1927
-					return I18N::translate('great ×%s grandfather', I18N::number($up - 2));
1928
-					case 'F':
1929
-					return I18N::translate('great ×%s grandmother', I18N::number($up - 2));
1930
-					default:
1931
-					return I18N::translate('great ×%s grandparent', I18N::number($up - 2));
1926
+						case 'M': // I18N: if you need a different number for %s, contact the developers, as a code-change is required
1927
+						return I18N::translate('great ×%s grandfather', I18N::number($up - 2));
1928
+						case 'F':
1929
+						return I18N::translate('great ×%s grandmother', I18N::number($up - 2));
1930
+						default:
1931
+						return I18N::translate('great ×%s grandparent', I18N::number($up - 2));
1932 1932
 					}
1933 1933
 					}
1934 1934
 			}
@@ -1937,83 +1937,83 @@  discard block
 block discarded – undo
1937 1937
 			// direct descendants
1938 1938
 			$up = strlen($match[1]) / 3;
1939 1939
 			switch ($up) {
1940
-			case 4:
1941
-				switch ($sex2) {
1942
-				case 'M':
1943
-				return I18N::translate('great-great-grandson');
1944
-				case 'F':
1945
-				return I18N::translate('great-great-granddaughter');
1946
-				default:
1947
-				return I18N::translate('great-great-grandchild');
1948
-				}
1940
+				case 4:
1941
+					switch ($sex2) {
1942
+						case 'M':
1943
+						return I18N::translate('great-great-grandson');
1944
+						case 'F':
1945
+						return I18N::translate('great-great-granddaughter');
1946
+						default:
1947
+						return I18N::translate('great-great-grandchild');
1948
+					}
1949 1949
 
1950
-			case 5:
1951
-				switch ($sex2) {
1952
-				case 'M':
1953
-				return I18N::translate('great-great-great-grandson');
1954
-				case 'F':
1955
-				return I18N::translate('great-great-great-granddaughter');
1956
-				default:
1957
-				return I18N::translate('great-great-great-grandchild');
1958
-				}
1950
+				case 5:
1951
+					switch ($sex2) {
1952
+						case 'M':
1953
+						return I18N::translate('great-great-great-grandson');
1954
+						case 'F':
1955
+						return I18N::translate('great-great-great-granddaughter');
1956
+						default:
1957
+						return I18N::translate('great-great-great-grandchild');
1958
+					}
1959 1959
 
1960
-			case 6:
1961
-				switch ($sex2) {
1962
-				case 'M':
1963
-				return I18N::translate('great ×4 grandson');
1964
-				case 'F':
1965
-				return I18N::translate('great ×4 granddaughter');
1966
-				default:
1967
-				return I18N::translate('great ×4 grandchild');
1968
-				}
1960
+				case 6:
1961
+					switch ($sex2) {
1962
+						case 'M':
1963
+						return I18N::translate('great ×4 grandson');
1964
+						case 'F':
1965
+						return I18N::translate('great ×4 granddaughter');
1966
+						default:
1967
+						return I18N::translate('great ×4 grandchild');
1968
+					}
1969 1969
 
1970
-			case 7:
1971
-				switch ($sex2) {
1972
-				case 'M':
1973
-				return I18N::translate('great ×5 grandson');
1974
-				case 'F':
1975
-				return I18N::translate('great ×5 granddaughter');
1976
-				default:
1977
-				return I18N::translate('great ×5 grandchild');
1978
-				}
1970
+				case 7:
1971
+					switch ($sex2) {
1972
+						case 'M':
1973
+						return I18N::translate('great ×5 grandson');
1974
+						case 'F':
1975
+						return I18N::translate('great ×5 granddaughter');
1976
+						default:
1977
+						return I18N::translate('great ×5 grandchild');
1978
+					}
1979 1979
 
1980
-			case 8:
1981
-				switch ($sex2) {
1982
-				case 'M':
1983
-				return I18N::translate('great ×6 grandson');
1984
-				case 'F':
1985
-				return I18N::translate('great ×6 granddaughter');
1986
-				default:
1987
-				return I18N::translate('great ×6 grandchild');
1988
-				}
1980
+				case 8:
1981
+					switch ($sex2) {
1982
+						case 'M':
1983
+						return I18N::translate('great ×6 grandson');
1984
+						case 'F':
1985
+						return I18N::translate('great ×6 granddaughter');
1986
+						default:
1987
+						return I18N::translate('great ×6 grandchild');
1988
+					}
1989 1989
 
1990
-			case 9:
1991
-				switch ($sex2) {
1992
-				case 'M':
1993
-				return I18N::translate('great ×7 grandson');
1994
-				case 'F':
1995
-				return I18N::translate('great ×7 granddaughter');
1996
-				default:
1997
-				return I18N::translate('great ×7 grandchild');
1998
-				}
1990
+				case 9:
1991
+					switch ($sex2) {
1992
+						case 'M':
1993
+						return I18N::translate('great ×7 grandson');
1994
+						case 'F':
1995
+						return I18N::translate('great ×7 granddaughter');
1996
+						default:
1997
+						return I18N::translate('great ×7 grandchild');
1998
+					}
1999 1999
 
2000
-			default:
2001
-				// Different languages have different rules for naming generations.
2002
-				// An English great ×12 grandson is a Danish great ×11 grandson.
2003
-				//
2004
-				// Need to find out which languages use which rules.
2005
-				switch (WT_LOCALE) {
2006
-				case 'nn': // Source: Hogne Røed Nilsen
2007
-				case 'nb':
2008
-				case 'da': // Source: Patrick Sorensen
2009
-				switch ($sex2) {
2010
-				case 'M':
2011
-				return I18N::translate('great ×%s grandson', I18N::number($up - 3));
2012
-				case 'F':
2013
-				return I18N::translate('great ×%s granddaughter', I18N::number($up - 3));
2014 2000
 				default:
2015
-				return I18N::translate('great ×%s grandchild', I18N::number($up - 3));
2016
-				}
2001
+					// Different languages have different rules for naming generations.
2002
+					// An English great ×12 grandson is a Danish great ×11 grandson.
2003
+					//
2004
+					// Need to find out which languages use which rules.
2005
+					switch (WT_LOCALE) {
2006
+						case 'nn': // Source: Hogne Røed Nilsen
2007
+						case 'nb':
2008
+						case 'da': // Source: Patrick Sorensen
2009
+						switch ($sex2) {
2010
+							case 'M':
2011
+							return I18N::translate('great ×%s grandson', I18N::number($up - 3));
2012
+							case 'F':
2013
+							return I18N::translate('great ×%s granddaughter', I18N::number($up - 3));
2014
+							default:
2015
+							return I18N::translate('great ×%s grandchild', I18N::number($up - 3));
2016
+						}
2017 2017
 				case 'it': // Source: Michele Locati
2018 2018
 				case 'es': // Source: Wes Groleau (adding doesn’t change behavior, but needs to be better researched)
2019 2019
 				case 'en_AU':
@@ -2022,12 +2022,12 @@  discard block
 block discarded – undo
2022 2022
 				default:
2023 2023
 					switch ($sex2) {
2024 2024
 
2025
-					case 'M': // I18N: if you need a different number for %s, contact the developers, as a code-change is required
2026
-					return I18N::translate('great ×%s grandson', I18N::number($up - 2));
2027
-					case 'F':
2028
-					return I18N::translate('great ×%s granddaughter', I18N::number($up - 2));
2029
-					default:
2030
-					return I18N::translate('great ×%s grandchild', I18N::number($up - 2));
2025
+						case 'M': // I18N: if you need a different number for %s, contact the developers, as a code-change is required
2026
+						return I18N::translate('great ×%s grandson', I18N::number($up - 2));
2027
+						case 'F':
2028
+						return I18N::translate('great ×%s granddaughter', I18N::number($up - 2));
2029
+						default:
2030
+						return I18N::translate('great ×%s grandchild', I18N::number($up - 2));
2031 2031
 					}
2032 2032
 					}
2033 2033
 			}
@@ -2046,68 +2046,68 @@  discard block
 block discarded – undo
2046 2046
 			//
2047 2047
 			// Need to find out which languages use which rules.
2048 2048
 			switch (WT_LOCALE) {
2049
-			case 'pl': // Source: Lukasz Wilenski
2050
-				return self::cousinName($up + $down + 2, $sex2);
2051
-			case 'it':
2052
-				// Source: Michele Locati. See italian_cousins_names.zip
2053
-				// https://webtrees.net/forums/8-translation/1200-great-xn-grandparent?limit=6&start=6
2054
-				return self::cousinName($up + $down - 3, $sex2);
2055
-			case 'es':
2056
-				// Source: Wes Groleau. See http://UniGen.us/Parentesco.html & http://UniGen.us/Parentesco-D.html
2057
-				if ($down == $up) {
2058
-					return self::cousinName($cousin, $sex2);
2059
-				} elseif ($down < $up) {
2060
-					return self::cousinName2($cousin + 1, $sex2, self::getRelationshipNameFromPath('sib' . $descent, null, null));
2061
-				} else {
2062
-					switch ($sex2) {
2063
-					case 'M':
2064
-					return self::cousinName2($cousin + 1, $sex2, self::getRelationshipNameFromPath('bro' . $descent, null, null));
2065
-					case 'F':
2066
-					return self::cousinName2($cousin + 1, $sex2, self::getRelationshipNameFromPath('sis' . $descent, null, null));
2067
-					default:
2068
-					return self::cousinName2($cousin + 1, $sex2, self::getRelationshipNameFromPath('sib' . $descent, null, null));
2069
-					}
2070
-				}
2071
-			case 'en_AU': // See: http://en.wikipedia.org/wiki/File:CousinTree.svg
2072
-			case 'en_GB':
2073
-			case 'en_US':
2074
-			default:
2075
-				switch ($removed) {
2076
-				case 0:
2077
-				return self::cousinName($cousin, $sex2);
2078
-				case 1:
2079
-				if ($up > $down) {
2080
-					/* I18N: %s=“fifth cousin”, etc. http://www.ancestry.com/learn/library/article.aspx?article=2856 */
2081
-					return I18N::translate('%s once removed ascending', self::cousinName($cousin, $sex2));
2082
-				} else {
2083
-					/* I18N: %s=“fifth cousin”, etc. http://www.ancestry.com/learn/library/article.aspx?article=2856 */
2084
-					return I18N::translate('%s once removed descending', self::cousinName($cousin, $sex2));
2085
-				}
2086
-				case 2:
2087
-				if ($up > $down) {
2088
-					/* I18N: %s=“fifth cousin”, etc. */
2089
-					return I18N::translate('%s twice removed ascending', self::cousinName($cousin, $sex2));
2090
-				} else {
2091
-					/* I18N: %s=“fifth cousin”, etc. */
2092
-					return I18N::translate('%s twice removed descending', self::cousinName($cousin, $sex2));
2093
-				}
2094
-				case 3:
2095
-				if ($up > $down) {
2096
-					/* I18N: %s=“fifth cousin”, etc. */
2097
-					return I18N::translate('%s three times removed ascending', self::cousinName($cousin, $sex2));
2098
-				} else {
2099
-					/* I18N: %s=“fifth cousin”, etc. */
2100
-					return I18N::translate('%s three times removed descending', self::cousinName($cousin, $sex2));
2049
+				case 'pl': // Source: Lukasz Wilenski
2050
+					return self::cousinName($up + $down + 2, $sex2);
2051
+				case 'it':
2052
+					// Source: Michele Locati. See italian_cousins_names.zip
2053
+					// https://webtrees.net/forums/8-translation/1200-great-xn-grandparent?limit=6&start=6
2054
+					return self::cousinName($up + $down - 3, $sex2);
2055
+				case 'es':
2056
+					// Source: Wes Groleau. See http://UniGen.us/Parentesco.html & http://UniGen.us/Parentesco-D.html
2057
+					if ($down == $up) {
2058
+						return self::cousinName($cousin, $sex2);
2059
+					} elseif ($down < $up) {
2060
+						return self::cousinName2($cousin + 1, $sex2, self::getRelationshipNameFromPath('sib' . $descent, null, null));
2061
+					} else {
2062
+						switch ($sex2) {
2063
+							case 'M':
2064
+							return self::cousinName2($cousin + 1, $sex2, self::getRelationshipNameFromPath('bro' . $descent, null, null));
2065
+							case 'F':
2066
+							return self::cousinName2($cousin + 1, $sex2, self::getRelationshipNameFromPath('sis' . $descent, null, null));
2067
+							default:
2068
+							return self::cousinName2($cousin + 1, $sex2, self::getRelationshipNameFromPath('sib' . $descent, null, null));
2069
+						}
2101 2070
 				}
2071
+				case 'en_AU': // See: http://en.wikipedia.org/wiki/File:CousinTree.svg
2072
+				case 'en_GB':
2073
+				case 'en_US':
2102 2074
 				default:
2103
-				if ($up > $down) {
2104
-					/* I18N: %1$s=“fifth cousin”, etc., %2$s>=4 */
2105
-					return I18N::translate('%1$s %2$s times removed ascending', self::cousinName($cousin, $sex2), I18N::number($removed));
2106
-				} else {
2107
-					/* I18N: %1$s=“fifth cousin”, etc., %2$s>=4 */
2108
-					return I18N::translate('%1$s %2$s times removed descending', self::cousinName($cousin, $sex2), I18N::number($removed));
2109
-				}
2110
-				}
2075
+					switch ($removed) {
2076
+						case 0:
2077
+						return self::cousinName($cousin, $sex2);
2078
+						case 1:
2079
+						if ($up > $down) {
2080
+							/* I18N: %s=“fifth cousin”, etc. http://www.ancestry.com/learn/library/article.aspx?article=2856 */
2081
+							return I18N::translate('%s once removed ascending', self::cousinName($cousin, $sex2));
2082
+						} else {
2083
+							/* I18N: %s=“fifth cousin”, etc. http://www.ancestry.com/learn/library/article.aspx?article=2856 */
2084
+							return I18N::translate('%s once removed descending', self::cousinName($cousin, $sex2));
2085
+						}
2086
+						case 2:
2087
+						if ($up > $down) {
2088
+							/* I18N: %s=“fifth cousin”, etc. */
2089
+							return I18N::translate('%s twice removed ascending', self::cousinName($cousin, $sex2));
2090
+						} else {
2091
+							/* I18N: %s=“fifth cousin”, etc. */
2092
+							return I18N::translate('%s twice removed descending', self::cousinName($cousin, $sex2));
2093
+						}
2094
+						case 3:
2095
+						if ($up > $down) {
2096
+							/* I18N: %s=“fifth cousin”, etc. */
2097
+							return I18N::translate('%s three times removed ascending', self::cousinName($cousin, $sex2));
2098
+						} else {
2099
+							/* I18N: %s=“fifth cousin”, etc. */
2100
+							return I18N::translate('%s three times removed descending', self::cousinName($cousin, $sex2));
2101
+						}
2102
+						default:
2103
+						if ($up > $down) {
2104
+							/* I18N: %1$s=“fifth cousin”, etc., %2$s>=4 */
2105
+							return I18N::translate('%1$s %2$s times removed ascending', self::cousinName($cousin, $sex2), I18N::number($removed));
2106
+						} else {
2107
+							/* I18N: %1$s=“fifth cousin”, etc., %2$s>=4 */
2108
+							return I18N::translate('%1$s %2$s times removed descending', self::cousinName($cousin, $sex2), I18N::number($removed));
2109
+						}
2110
+					}
2111 2111
 			}
2112 2112
 		}
2113 2113
 
Please login to merge, or discard this patch.
app/Functions/FunctionsImport.php 1 patch
Switch Indentation   +644 added lines, -644 removed lines patch added patch discarded remove patch
@@ -60,477 +60,477 @@  discard block
 block discarded – undo
60 60
 			$tag                               = strtoupper($tag); // Tags should always be upper case
61 61
 			switch ($tag) {
62 62
 				// Convert PhpGedView tags to WT
63
-			case '_PGVU':
64
-				$tag = '_WT_USER';
65
-				break;
66
-			case '_PGV_OBJS':
67
-				$tag = '_WT_OBJE_SORT';
68
-				break;
69
-				// Convert FTM-style "TAG_FORMAL_NAME" into "TAG".
70
-			case 'ABBREVIATION':
71
-				$tag = 'ABBR';
72
-				break;
73
-			case 'ADDRESS':
74
-				$tag = 'ADDR';
75
-				break;
76
-			case 'ADDRESS1':
77
-				$tag = 'ADR1';
78
-				break;
79
-			case 'ADDRESS2':
80
-				$tag = 'ADR2';
81
-				break;
82
-			case 'ADDRESS3':
83
-				$tag = 'ADR3';
84
-				break;
85
-			case 'ADOPTION':
86
-				$tag = 'ADOP';
87
-				break;
88
-			case 'ADULT_CHRISTENING':
89
-				$tag = 'CHRA';
90
-				break;
91
-			case 'AFN':
92
-				// AFN values are upper case
93
-				$data = strtoupper($data);
94
-				break;
95
-			case 'AGENCY':
96
-				$tag = 'AGNC';
97
-				break;
98
-			case 'ALIAS':
99
-				$tag = 'ALIA';
100
-				break;
101
-			case 'ANCESTORS':
102
-				$tag = 'ANCE';
103
-				break;
104
-			case 'ANCES_INTEREST':
105
-				$tag = 'ANCI';
106
-				break;
107
-			case 'ANNULMENT':
108
-				$tag = 'ANUL';
109
-				break;
110
-			case 'ASSOCIATES':
111
-				$tag = 'ASSO';
112
-				break;
113
-			case 'AUTHOR':
114
-				$tag = 'AUTH';
115
-				break;
116
-			case 'BAPTISM':
117
-				$tag = 'BAPM';
118
-				break;
119
-			case 'BAPTISM_LDS':
120
-				$tag = 'BAPL';
121
-				break;
122
-			case 'BAR_MITZVAH':
123
-				$tag = 'BARM';
124
-				break;
125
-			case 'BAS_MITZVAH':
126
-				$tag = 'BASM';
127
-				break;
128
-			case 'BIRTH':
129
-				$tag = 'BIRT';
130
-				break;
131
-			case 'BLESSING':
132
-				$tag = 'BLES';
133
-				break;
134
-			case 'BURIAL':
135
-				$tag = 'BURI';
136
-				break;
137
-			case 'CALL_NUMBER':
138
-				$tag = 'CALN';
139
-				break;
140
-			case 'CASTE':
141
-				$tag = 'CAST';
142
-				break;
143
-			case 'CAUSE':
144
-				$tag = 'CAUS';
145
-				break;
146
-			case 'CENSUS':
147
-				$tag = 'CENS';
148
-				break;
149
-			case 'CHANGE':
150
-				$tag = 'CHAN';
151
-				break;
152
-			case 'CHARACTER':
153
-				$tag = 'CHAR';
154
-				break;
155
-			case 'CHILD':
156
-				$tag = 'CHIL';
157
-				break;
158
-			case 'CHILDREN_COUNT':
159
-				$tag = 'NCHI';
160
-				break;
161
-			case 'CHRISTENING':
162
-				$tag = 'CHR';
163
-				break;
164
-			case 'CONCATENATION':
165
-				$tag = 'CONC';
166
-				break;
167
-			case 'CONFIRMATION':
168
-				$tag = 'CONF';
169
-				break;
170
-			case 'CONFIRMATION_LDS':
171
-				$tag = 'CONL';
172
-				break;
173
-			case 'CONTINUED':
174
-				$tag = 'CONT';
175
-				break;
176
-			case 'COPYRIGHT':
177
-				$tag = 'COPR';
178
-				break;
179
-			case 'CORPORATE':
180
-				$tag = 'CORP';
181
-				break;
182
-			case 'COUNTRY':
183
-				$tag = 'CTRY';
184
-				break;
185
-			case 'CREMATION':
186
-				$tag = 'CREM';
187
-				break;
188
-			case 'DATE':
189
-				// Preserve text from INT dates
190
-				if (strpos($data, '(') !== false) {
191
-					list($date, $text) = explode('(', $data, 2);
192
-					$text              = ' (' . $text;
193
-				} else {
194
-					$date = $data;
195
-					$text = '';
196
-				}
197
-				// Capitals
198
-				$date = strtoupper($date);
199
-				// Temporarily add leading/trailing spaces, to allow efficient matching below
200
-				$date = " {$date} ";
201
-				// Ensure space digits and letters
202
-				$date = preg_replace('/([A-Z])(\d)/', '$1 $2', $date);
203
-				$date = preg_replace('/(\d)([A-Z])/', '$1 $2', $date);
204
-				// Ensure space before/after calendar escapes
205
-				$date = preg_replace('/@#[^@]+@/', ' $0 ', $date);
206
-				// "BET." => "BET"
207
-				$date = preg_replace('/(\w\w)\./', '$1', $date);
208
-				// "CIR" => "ABT"
209
-				$date = str_replace(' CIR ', ' ABT ', $date);
210
-				$date = str_replace(' APX ', ' ABT ', $date);
211
-				// B.C. => BC (temporarily, to allow easier handling of ".")
212
-				$date = str_replace(' B.C. ', ' BC ', $date);
213
-				// "BET X - Y " => "BET X AND Y"
214
-				$date = preg_replace('/^(.* BET .+) - (.+)/', '$1 AND $2', $date);
215
-				$date = preg_replace('/^(.* FROM .+) - (.+)/', '$1 TO $2', $date);
216
-				// "@#ESC@ FROM X TO Y" => "FROM @#ESC@ X TO @#ESC@ Y"
217
-				$date = preg_replace('/^ +(@#[^@]+@) +FROM +(.+) +TO +(.+)/', ' FROM $1 $2 TO $1 $3', $date);
218
-				$date = preg_replace('/^ +(@#[^@]+@) +BET +(.+) +AND +(.+)/', ' BET $1 $2 AND $1 $3', $date);
219
-				// "@#ESC@ AFT X" => "AFT @#ESC@ X"
220
-				$date = preg_replace('/^ +(@#[^@]+@) +(FROM|BET|TO|AND|BEF|AFT|CAL|EST|INT|ABT) +(.+)/', ' $2 $1 $3', $date);
221
-				// Ignore any remaining punctuation, e.g. "14-MAY, 1900" => "14 MAY 1900"
222
-				// (don't change "/" - it is used in NS/OS dates)
223
-				$date = preg_replace('/[.,:;-]/', ' ', $date);
224
-				// BC => B.C.
225
-				$date = str_replace(' BC ', ' B.C. ', $date);
226
-				// Append the "INT" text
227
-				$data = $date . $text;
228
-				break;
229
-			case 'DEATH':
230
-				$tag = 'DEAT';
231
-				break;
232
-			case '_DEATH_OF_SPOUSE':
233
-				$tag = '_DETS';
234
-				break;
235
-			case '_DEGREE':
236
-				$tag = '_DEG';
237
-				break;
238
-			case 'DESCENDANTS':
239
-				$tag = 'DESC';
240
-				break;
241
-			case 'DESCENDANT_INT':
242
-				$tag = 'DESI';
243
-				break;
244
-			case 'DESTINATION':
245
-				$tag = 'DEST';
246
-				break;
247
-			case 'DIVORCE':
248
-				$tag = 'DIV';
249
-				break;
250
-			case 'DIVORCE_FILED':
251
-				$tag = 'DIVF';
252
-				break;
253
-			case 'EDUCATION':
254
-				$tag = 'EDUC';
255
-				break;
256
-			case 'EMIGRATION':
257
-				$tag = 'EMIG';
258
-				break;
259
-			case 'ENDOWMENT':
260
-				$tag = 'ENDL';
261
-				break;
262
-			case 'ENGAGEMENT':
263
-				$tag = 'ENGA';
264
-				break;
265
-			case 'EVENT':
266
-				$tag = 'EVEN';
267
-				break;
268
-			case 'FACSIMILE':
269
-				$tag = 'FAX';
270
-				break;
271
-			case 'FAMILY':
272
-				$tag = 'FAM';
273
-				break;
274
-			case 'FAMILY_CHILD':
275
-				$tag = 'FAMC';
276
-				break;
277
-			case 'FAMILY_FILE':
278
-				$tag = 'FAMF';
279
-				break;
280
-			case 'FAMILY_SPOUSE':
281
-				$tag = 'FAMS';
282
-				break;
283
-			case 'FIRST_COMMUNION':
284
-				$tag = 'FCOM';
285
-				break;
286
-			case '_FILE':
287
-				$tag = 'FILE';
288
-				break;
289
-			case 'FORMAT':
290
-				$tag = 'FORM';
291
-			case 'FORM':
292
-				// Consistent commas
293
-				$data = preg_replace('/ *, */', ', ', $data);
294
-				break;
295
-			case 'GEDCOM':
296
-				$tag = 'GEDC';
297
-				break;
298
-			case 'GIVEN_NAME':
299
-				$tag = 'GIVN';
300
-				break;
301
-			case 'GRADUATION':
302
-				$tag = 'GRAD';
303
-				break;
304
-			case 'HEADER':
305
-				$tag = 'HEAD';
306
-			case 'HEAD':
307
-				// HEAD records don't have an XREF or DATA
308
-				if ($level == '0') {
309
-					$xref = '';
310
-					$data = '';
311
-				}
312
-				break;
313
-			case 'HUSBAND':
314
-				$tag = 'HUSB';
315
-				break;
316
-			case 'IDENT_NUMBER':
317
-				$tag = 'IDNO';
318
-				break;
319
-			case 'IMMIGRATION':
320
-				$tag = 'IMMI';
321
-				break;
322
-			case 'INDIVIDUAL':
323
-				$tag = 'INDI';
324
-				break;
325
-			case 'LANGUAGE':
326
-				$tag = 'LANG';
327
-				break;
328
-			case 'LATITUDE':
329
-				$tag = 'LATI';
330
-				break;
331
-			case 'LONGITUDE':
332
-				$tag = 'LONG';
333
-				break;
334
-			case 'MARRIAGE':
335
-				$tag = 'MARR';
336
-				break;
337
-			case 'MARRIAGE_BANN':
338
-				$tag = 'MARB';
339
-				break;
340
-			case 'MARRIAGE_COUNT':
341
-				$tag = 'NMR';
342
-				break;
343
-			case 'MARRIAGE_CONTRACT':
344
-				$tag = 'MARC';
345
-				break;
346
-			case 'MARRIAGE_LICENSE':
347
-				$tag = 'MARL';
348
-				break;
349
-			case 'MARRIAGE_SETTLEMENT':
350
-				$tag = 'MARS';
351
-				break;
352
-			case 'MEDIA':
353
-				$tag = 'MEDI';
354
-				break;
355
-			case '_MEDICAL':
356
-				$tag = '_MDCL';
357
-				break;
358
-			case '_MILITARY_SERVICE':
359
-				$tag = '_MILT';
360
-				break;
361
-			case 'NAME':
362
-				// Tidy up whitespace
363
-				$data = preg_replace('/  +/', ' ', trim($data));
364
-				break;
365
-			case 'NAME_PREFIX':
366
-				$tag = 'NPFX';
367
-				break;
368
-			case 'NAME_SUFFIX':
369
-				$tag = 'NSFX';
370
-				break;
371
-			case 'NATIONALITY':
372
-				$tag = 'NATI';
373
-				break;
374
-			case 'NATURALIZATION':
375
-				$tag = 'NATU';
376
-				break;
377
-			case 'NICKNAME':
378
-				$tag = 'NICK';
379
-				break;
380
-			case 'OBJECT':
381
-				$tag = 'OBJE';
382
-				break;
383
-			case 'OCCUPATION':
384
-				$tag = 'OCCU';
385
-				break;
386
-			case 'ORDINANCE':
387
-				$tag = 'ORDI';
388
-				break;
389
-			case 'ORDINATION':
390
-				$tag = 'ORDN';
391
-				break;
392
-			case 'PEDIGREE':
393
-				$tag = 'PEDI';
394
-			case 'PEDI':
395
-				// PEDI values are lower case
396
-				$data = strtolower($data);
397
-				break;
398
-			case 'PHONE':
399
-				$tag = 'PHON';
400
-				break;
401
-			case 'PHONETIC':
402
-				$tag = 'FONE';
403
-				break;
404
-			case 'PHY_DESCRIPTION':
405
-				$tag = 'DSCR';
406
-				break;
407
-			case 'PLACE':
408
-				$tag = 'PLAC';
409
-			case 'PLAC':
410
-				// Consistent commas
411
-				$data = preg_replace('/ *(،|,) */', ', ', $data);
412
-				// The Master Genealogist stores LAT/LONG data in the PLAC field, e.g. Pennsylvania, USA, 395945N0751013W
413
-				if (preg_match('/(.*), (\d\d)(\d\d)(\d\d)([NS])(\d\d\d)(\d\d)(\d\d)([EW])$/', $data, $match)) {
414
-					$data =
415
-						$match[1] . "\n" .
416
-						($level + 1) . " MAP\n" .
417
-						($level + 2) . ' LATI ' . ($match[5] . (round($match[2] + ($match[3] / 60) + ($match[4] / 3600), 4))) . "\n" .
418
-						($level + 2) . ' LONG ' . ($match[9] . (round($match[6] + ($match[7] / 60) + ($match[8] / 3600), 4)));
419
-				}
420
-				break;
421
-			case 'POSTAL_CODE':
422
-				$tag = 'POST';
423
-				break;
424
-			case 'PROBATE':
425
-				$tag = 'PROB';
426
-				break;
427
-			case 'PROPERTY':
428
-				$tag = 'PROP';
429
-				break;
430
-			case 'PUBLICATION':
431
-				$tag = 'PUBL';
432
-				break;
433
-			case 'QUALITY_OF_DATA':
434
-				$tag = 'QUAL';
435
-				break;
436
-			case 'REC_FILE_NUMBER':
437
-				$tag = 'RFN';
438
-				break;
439
-			case 'REC_ID_NUMBER':
440
-				$tag = 'RIN';
441
-				break;
442
-			case 'REFERENCE':
443
-				$tag = 'REFN';
444
-				break;
445
-			case 'RELATIONSHIP':
446
-				$tag = 'RELA';
447
-				break;
448
-			case 'RELIGION':
449
-				$tag = 'RELI';
450
-				break;
451
-			case 'REPOSITORY':
452
-				$tag = 'REPO';
453
-				break;
454
-			case 'RESIDENCE':
455
-				$tag = 'RESI';
456
-				break;
457
-			case 'RESTRICTION':
458
-				$tag = 'RESN';
459
-			case 'RESN':
460
-				// RESN values are lower case (confidential, privacy, locked, none)
461
-				$data = strtolower($data);
462
-				if ($data == 'invisible') {
463
-					$data = 'confidential'; // From old versions of Legacy.
464
-				}
465
-				break;
466
-			case 'RETIREMENT':
467
-				$tag = 'RETI';
468
-				break;
469
-			case 'ROMANIZED':
470
-				$tag = 'ROMN';
471
-				break;
472
-			case 'SEALING_CHILD':
473
-				$tag = 'SLGC';
474
-				break;
475
-			case 'SEALING_SPOUSE':
476
-				$tag = 'SLGS';
477
-				break;
478
-			case 'SOC_SEC_NUMBER':
479
-				$tag = 'SSN';
480
-				break;
481
-			case 'SEX':
482
-				$data = strtoupper($data);
483
-				break;
484
-			case 'SOURCE':
485
-				$tag = 'SOUR';
486
-				break;
487
-			case 'STATE':
488
-				$tag = 'STAE';
489
-				break;
490
-			case 'STATUS':
491
-				$tag = 'STAT';
492
-			case 'STAT':
493
-				if ($data == 'CANCELLED') {
494
-					// PhpGedView mis-spells this tag - correct it.
495
-					$data = 'CANCELED';
496
-				}
497
-				break;
498
-			case 'SUBMISSION':
499
-				$tag = 'SUBN';
500
-				break;
501
-			case 'SUBMITTER':
502
-				$tag = 'SUBM';
503
-				break;
504
-			case 'SURNAME':
505
-				$tag = 'SURN';
506
-				break;
507
-			case 'SURN_PREFIX':
508
-				$tag = 'SPFX';
509
-				break;
510
-			case 'TEMPLE':
511
-				$tag = 'TEMP';
512
-			case 'TEMP':
513
-				// Temple codes are upper case
514
-				$data = strtoupper($data);
515
-				break;
516
-			case 'TITLE':
517
-				$tag = 'TITL';
518
-				break;
519
-			case 'TRAILER':
520
-				$tag = 'TRLR';
521
-			case 'TRLR':
522
-				// TRLR records don't have an XREF or DATA
523
-				if ($level == '0') {
524
-					$xref = '';
525
-					$data = '';
526
-				}
527
-				break;
528
-			case 'VERSION':
529
-				$tag = 'VERS';
530
-				break;
531
-			case 'WEB':
532
-				$tag = 'WWW';
533
-				break;
63
+				case '_PGVU':
64
+					$tag = '_WT_USER';
65
+					break;
66
+				case '_PGV_OBJS':
67
+					$tag = '_WT_OBJE_SORT';
68
+					break;
69
+					// Convert FTM-style "TAG_FORMAL_NAME" into "TAG".
70
+				case 'ABBREVIATION':
71
+					$tag = 'ABBR';
72
+					break;
73
+				case 'ADDRESS':
74
+					$tag = 'ADDR';
75
+					break;
76
+				case 'ADDRESS1':
77
+					$tag = 'ADR1';
78
+					break;
79
+				case 'ADDRESS2':
80
+					$tag = 'ADR2';
81
+					break;
82
+				case 'ADDRESS3':
83
+					$tag = 'ADR3';
84
+					break;
85
+				case 'ADOPTION':
86
+					$tag = 'ADOP';
87
+					break;
88
+				case 'ADULT_CHRISTENING':
89
+					$tag = 'CHRA';
90
+					break;
91
+				case 'AFN':
92
+					// AFN values are upper case
93
+					$data = strtoupper($data);
94
+					break;
95
+				case 'AGENCY':
96
+					$tag = 'AGNC';
97
+					break;
98
+				case 'ALIAS':
99
+					$tag = 'ALIA';
100
+					break;
101
+				case 'ANCESTORS':
102
+					$tag = 'ANCE';
103
+					break;
104
+				case 'ANCES_INTEREST':
105
+					$tag = 'ANCI';
106
+					break;
107
+				case 'ANNULMENT':
108
+					$tag = 'ANUL';
109
+					break;
110
+				case 'ASSOCIATES':
111
+					$tag = 'ASSO';
112
+					break;
113
+				case 'AUTHOR':
114
+					$tag = 'AUTH';
115
+					break;
116
+				case 'BAPTISM':
117
+					$tag = 'BAPM';
118
+					break;
119
+				case 'BAPTISM_LDS':
120
+					$tag = 'BAPL';
121
+					break;
122
+				case 'BAR_MITZVAH':
123
+					$tag = 'BARM';
124
+					break;
125
+				case 'BAS_MITZVAH':
126
+					$tag = 'BASM';
127
+					break;
128
+				case 'BIRTH':
129
+					$tag = 'BIRT';
130
+					break;
131
+				case 'BLESSING':
132
+					$tag = 'BLES';
133
+					break;
134
+				case 'BURIAL':
135
+					$tag = 'BURI';
136
+					break;
137
+				case 'CALL_NUMBER':
138
+					$tag = 'CALN';
139
+					break;
140
+				case 'CASTE':
141
+					$tag = 'CAST';
142
+					break;
143
+				case 'CAUSE':
144
+					$tag = 'CAUS';
145
+					break;
146
+				case 'CENSUS':
147
+					$tag = 'CENS';
148
+					break;
149
+				case 'CHANGE':
150
+					$tag = 'CHAN';
151
+					break;
152
+				case 'CHARACTER':
153
+					$tag = 'CHAR';
154
+					break;
155
+				case 'CHILD':
156
+					$tag = 'CHIL';
157
+					break;
158
+				case 'CHILDREN_COUNT':
159
+					$tag = 'NCHI';
160
+					break;
161
+				case 'CHRISTENING':
162
+					$tag = 'CHR';
163
+					break;
164
+				case 'CONCATENATION':
165
+					$tag = 'CONC';
166
+					break;
167
+				case 'CONFIRMATION':
168
+					$tag = 'CONF';
169
+					break;
170
+				case 'CONFIRMATION_LDS':
171
+					$tag = 'CONL';
172
+					break;
173
+				case 'CONTINUED':
174
+					$tag = 'CONT';
175
+					break;
176
+				case 'COPYRIGHT':
177
+					$tag = 'COPR';
178
+					break;
179
+				case 'CORPORATE':
180
+					$tag = 'CORP';
181
+					break;
182
+				case 'COUNTRY':
183
+					$tag = 'CTRY';
184
+					break;
185
+				case 'CREMATION':
186
+					$tag = 'CREM';
187
+					break;
188
+				case 'DATE':
189
+					// Preserve text from INT dates
190
+					if (strpos($data, '(') !== false) {
191
+						list($date, $text) = explode('(', $data, 2);
192
+						$text              = ' (' . $text;
193
+					} else {
194
+						$date = $data;
195
+						$text = '';
196
+					}
197
+					// Capitals
198
+					$date = strtoupper($date);
199
+					// Temporarily add leading/trailing spaces, to allow efficient matching below
200
+					$date = " {$date} ";
201
+					// Ensure space digits and letters
202
+					$date = preg_replace('/([A-Z])(\d)/', '$1 $2', $date);
203
+					$date = preg_replace('/(\d)([A-Z])/', '$1 $2', $date);
204
+					// Ensure space before/after calendar escapes
205
+					$date = preg_replace('/@#[^@]+@/', ' $0 ', $date);
206
+					// "BET." => "BET"
207
+					$date = preg_replace('/(\w\w)\./', '$1', $date);
208
+					// "CIR" => "ABT"
209
+					$date = str_replace(' CIR ', ' ABT ', $date);
210
+					$date = str_replace(' APX ', ' ABT ', $date);
211
+					// B.C. => BC (temporarily, to allow easier handling of ".")
212
+					$date = str_replace(' B.C. ', ' BC ', $date);
213
+					// "BET X - Y " => "BET X AND Y"
214
+					$date = preg_replace('/^(.* BET .+) - (.+)/', '$1 AND $2', $date);
215
+					$date = preg_replace('/^(.* FROM .+) - (.+)/', '$1 TO $2', $date);
216
+					// "@#ESC@ FROM X TO Y" => "FROM @#ESC@ X TO @#ESC@ Y"
217
+					$date = preg_replace('/^ +(@#[^@]+@) +FROM +(.+) +TO +(.+)/', ' FROM $1 $2 TO $1 $3', $date);
218
+					$date = preg_replace('/^ +(@#[^@]+@) +BET +(.+) +AND +(.+)/', ' BET $1 $2 AND $1 $3', $date);
219
+					// "@#ESC@ AFT X" => "AFT @#ESC@ X"
220
+					$date = preg_replace('/^ +(@#[^@]+@) +(FROM|BET|TO|AND|BEF|AFT|CAL|EST|INT|ABT) +(.+)/', ' $2 $1 $3', $date);
221
+					// Ignore any remaining punctuation, e.g. "14-MAY, 1900" => "14 MAY 1900"
222
+					// (don't change "/" - it is used in NS/OS dates)
223
+					$date = preg_replace('/[.,:;-]/', ' ', $date);
224
+					// BC => B.C.
225
+					$date = str_replace(' BC ', ' B.C. ', $date);
226
+					// Append the "INT" text
227
+					$data = $date . $text;
228
+					break;
229
+				case 'DEATH':
230
+					$tag = 'DEAT';
231
+					break;
232
+				case '_DEATH_OF_SPOUSE':
233
+					$tag = '_DETS';
234
+					break;
235
+				case '_DEGREE':
236
+					$tag = '_DEG';
237
+					break;
238
+				case 'DESCENDANTS':
239
+					$tag = 'DESC';
240
+					break;
241
+				case 'DESCENDANT_INT':
242
+					$tag = 'DESI';
243
+					break;
244
+				case 'DESTINATION':
245
+					$tag = 'DEST';
246
+					break;
247
+				case 'DIVORCE':
248
+					$tag = 'DIV';
249
+					break;
250
+				case 'DIVORCE_FILED':
251
+					$tag = 'DIVF';
252
+					break;
253
+				case 'EDUCATION':
254
+					$tag = 'EDUC';
255
+					break;
256
+				case 'EMIGRATION':
257
+					$tag = 'EMIG';
258
+					break;
259
+				case 'ENDOWMENT':
260
+					$tag = 'ENDL';
261
+					break;
262
+				case 'ENGAGEMENT':
263
+					$tag = 'ENGA';
264
+					break;
265
+				case 'EVENT':
266
+					$tag = 'EVEN';
267
+					break;
268
+				case 'FACSIMILE':
269
+					$tag = 'FAX';
270
+					break;
271
+				case 'FAMILY':
272
+					$tag = 'FAM';
273
+					break;
274
+				case 'FAMILY_CHILD':
275
+					$tag = 'FAMC';
276
+					break;
277
+				case 'FAMILY_FILE':
278
+					$tag = 'FAMF';
279
+					break;
280
+				case 'FAMILY_SPOUSE':
281
+					$tag = 'FAMS';
282
+					break;
283
+				case 'FIRST_COMMUNION':
284
+					$tag = 'FCOM';
285
+					break;
286
+				case '_FILE':
287
+					$tag = 'FILE';
288
+					break;
289
+				case 'FORMAT':
290
+					$tag = 'FORM';
291
+				case 'FORM':
292
+					// Consistent commas
293
+					$data = preg_replace('/ *, */', ', ', $data);
294
+					break;
295
+				case 'GEDCOM':
296
+					$tag = 'GEDC';
297
+					break;
298
+				case 'GIVEN_NAME':
299
+					$tag = 'GIVN';
300
+					break;
301
+				case 'GRADUATION':
302
+					$tag = 'GRAD';
303
+					break;
304
+				case 'HEADER':
305
+					$tag = 'HEAD';
306
+				case 'HEAD':
307
+					// HEAD records don't have an XREF or DATA
308
+					if ($level == '0') {
309
+						$xref = '';
310
+						$data = '';
311
+					}
312
+					break;
313
+				case 'HUSBAND':
314
+					$tag = 'HUSB';
315
+					break;
316
+				case 'IDENT_NUMBER':
317
+					$tag = 'IDNO';
318
+					break;
319
+				case 'IMMIGRATION':
320
+					$tag = 'IMMI';
321
+					break;
322
+				case 'INDIVIDUAL':
323
+					$tag = 'INDI';
324
+					break;
325
+				case 'LANGUAGE':
326
+					$tag = 'LANG';
327
+					break;
328
+				case 'LATITUDE':
329
+					$tag = 'LATI';
330
+					break;
331
+				case 'LONGITUDE':
332
+					$tag = 'LONG';
333
+					break;
334
+				case 'MARRIAGE':
335
+					$tag = 'MARR';
336
+					break;
337
+				case 'MARRIAGE_BANN':
338
+					$tag = 'MARB';
339
+					break;
340
+				case 'MARRIAGE_COUNT':
341
+					$tag = 'NMR';
342
+					break;
343
+				case 'MARRIAGE_CONTRACT':
344
+					$tag = 'MARC';
345
+					break;
346
+				case 'MARRIAGE_LICENSE':
347
+					$tag = 'MARL';
348
+					break;
349
+				case 'MARRIAGE_SETTLEMENT':
350
+					$tag = 'MARS';
351
+					break;
352
+				case 'MEDIA':
353
+					$tag = 'MEDI';
354
+					break;
355
+				case '_MEDICAL':
356
+					$tag = '_MDCL';
357
+					break;
358
+				case '_MILITARY_SERVICE':
359
+					$tag = '_MILT';
360
+					break;
361
+				case 'NAME':
362
+					// Tidy up whitespace
363
+					$data = preg_replace('/  +/', ' ', trim($data));
364
+					break;
365
+				case 'NAME_PREFIX':
366
+					$tag = 'NPFX';
367
+					break;
368
+				case 'NAME_SUFFIX':
369
+					$tag = 'NSFX';
370
+					break;
371
+				case 'NATIONALITY':
372
+					$tag = 'NATI';
373
+					break;
374
+				case 'NATURALIZATION':
375
+					$tag = 'NATU';
376
+					break;
377
+				case 'NICKNAME':
378
+					$tag = 'NICK';
379
+					break;
380
+				case 'OBJECT':
381
+					$tag = 'OBJE';
382
+					break;
383
+				case 'OCCUPATION':
384
+					$tag = 'OCCU';
385
+					break;
386
+				case 'ORDINANCE':
387
+					$tag = 'ORDI';
388
+					break;
389
+				case 'ORDINATION':
390
+					$tag = 'ORDN';
391
+					break;
392
+				case 'PEDIGREE':
393
+					$tag = 'PEDI';
394
+				case 'PEDI':
395
+					// PEDI values are lower case
396
+					$data = strtolower($data);
397
+					break;
398
+				case 'PHONE':
399
+					$tag = 'PHON';
400
+					break;
401
+				case 'PHONETIC':
402
+					$tag = 'FONE';
403
+					break;
404
+				case 'PHY_DESCRIPTION':
405
+					$tag = 'DSCR';
406
+					break;
407
+				case 'PLACE':
408
+					$tag = 'PLAC';
409
+				case 'PLAC':
410
+					// Consistent commas
411
+					$data = preg_replace('/ *(،|,) */', ', ', $data);
412
+					// The Master Genealogist stores LAT/LONG data in the PLAC field, e.g. Pennsylvania, USA, 395945N0751013W
413
+					if (preg_match('/(.*), (\d\d)(\d\d)(\d\d)([NS])(\d\d\d)(\d\d)(\d\d)([EW])$/', $data, $match)) {
414
+						$data =
415
+							$match[1] . "\n" .
416
+							($level + 1) . " MAP\n" .
417
+							($level + 2) . ' LATI ' . ($match[5] . (round($match[2] + ($match[3] / 60) + ($match[4] / 3600), 4))) . "\n" .
418
+							($level + 2) . ' LONG ' . ($match[9] . (round($match[6] + ($match[7] / 60) + ($match[8] / 3600), 4)));
419
+					}
420
+					break;
421
+				case 'POSTAL_CODE':
422
+					$tag = 'POST';
423
+					break;
424
+				case 'PROBATE':
425
+					$tag = 'PROB';
426
+					break;
427
+				case 'PROPERTY':
428
+					$tag = 'PROP';
429
+					break;
430
+				case 'PUBLICATION':
431
+					$tag = 'PUBL';
432
+					break;
433
+				case 'QUALITY_OF_DATA':
434
+					$tag = 'QUAL';
435
+					break;
436
+				case 'REC_FILE_NUMBER':
437
+					$tag = 'RFN';
438
+					break;
439
+				case 'REC_ID_NUMBER':
440
+					$tag = 'RIN';
441
+					break;
442
+				case 'REFERENCE':
443
+					$tag = 'REFN';
444
+					break;
445
+				case 'RELATIONSHIP':
446
+					$tag = 'RELA';
447
+					break;
448
+				case 'RELIGION':
449
+					$tag = 'RELI';
450
+					break;
451
+				case 'REPOSITORY':
452
+					$tag = 'REPO';
453
+					break;
454
+				case 'RESIDENCE':
455
+					$tag = 'RESI';
456
+					break;
457
+				case 'RESTRICTION':
458
+					$tag = 'RESN';
459
+				case 'RESN':
460
+					// RESN values are lower case (confidential, privacy, locked, none)
461
+					$data = strtolower($data);
462
+					if ($data == 'invisible') {
463
+						$data = 'confidential'; // From old versions of Legacy.
464
+					}
465
+					break;
466
+				case 'RETIREMENT':
467
+					$tag = 'RETI';
468
+					break;
469
+				case 'ROMANIZED':
470
+					$tag = 'ROMN';
471
+					break;
472
+				case 'SEALING_CHILD':
473
+					$tag = 'SLGC';
474
+					break;
475
+				case 'SEALING_SPOUSE':
476
+					$tag = 'SLGS';
477
+					break;
478
+				case 'SOC_SEC_NUMBER':
479
+					$tag = 'SSN';
480
+					break;
481
+				case 'SEX':
482
+					$data = strtoupper($data);
483
+					break;
484
+				case 'SOURCE':
485
+					$tag = 'SOUR';
486
+					break;
487
+				case 'STATE':
488
+					$tag = 'STAE';
489
+					break;
490
+				case 'STATUS':
491
+					$tag = 'STAT';
492
+				case 'STAT':
493
+					if ($data == 'CANCELLED') {
494
+						// PhpGedView mis-spells this tag - correct it.
495
+						$data = 'CANCELED';
496
+					}
497
+					break;
498
+				case 'SUBMISSION':
499
+					$tag = 'SUBN';
500
+					break;
501
+				case 'SUBMITTER':
502
+					$tag = 'SUBM';
503
+					break;
504
+				case 'SURNAME':
505
+					$tag = 'SURN';
506
+					break;
507
+				case 'SURN_PREFIX':
508
+					$tag = 'SPFX';
509
+					break;
510
+				case 'TEMPLE':
511
+					$tag = 'TEMP';
512
+				case 'TEMP':
513
+					// Temple codes are upper case
514
+					$data = strtoupper($data);
515
+					break;
516
+				case 'TITLE':
517
+					$tag = 'TITL';
518
+					break;
519
+				case 'TRAILER':
520
+					$tag = 'TRLR';
521
+				case 'TRLR':
522
+					// TRLR records don't have an XREF or DATA
523
+					if ($level == '0') {
524
+						$xref = '';
525
+						$data = '';
526
+					}
527
+					break;
528
+				case 'VERSION':
529
+					$tag = 'VERS';
530
+					break;
531
+				case 'WEB':
532
+					$tag = 'WWW';
533
+					break;
534 534
 			}
535 535
 			// Suppress "Y", for facts/events with a DATE or PLAC
536 536
 			if ($data == 'y') {
@@ -546,40 +546,40 @@  discard block
 block discarded – undo
546 546
 			}
547 547
 			// Reassemble components back into a single line
548 548
 			switch ($tag) {
549
-			default:
550
-				// Remove tabs and multiple/leading/trailing spaces
551
-				if (strpos($data, "\t") !== false) {
552
-					$data = str_replace("\t", ' ', $data);
553
-				}
554
-				if (substr($data, 0, 1) == ' ' || substr($data, -1, 1) == ' ') {
555
-					$data = trim($data);
556
-				}
557
-				while (strpos($data, '  ')) {
558
-					$data = str_replace('  ', ' ', $data);
559
-				}
560
-				$newrec .= ($newrec ? "\n" : '') . $level . ' ' . ($level == '0' && $xref ? $xref . ' ' : '') . $tag . ($data === '' && $tag != 'NOTE' ? '' : ' ' . $data);
561
-				break;
562
-			case 'NOTE':
563
-			case 'TEXT':
564
-			case 'DATA':
565
-			case 'CONT':
566
-				$newrec .= ($newrec ? "\n" : '') . $level . ' ' . ($level == '0' && $xref ? $xref . ' ' : '') . $tag . ($data === '' && $tag != 'NOTE' ? '' : ' ' . $data);
567
-				break;
568
-			case 'FILE':
569
-				// Strip off the user-defined path prefix
570
-				$GEDCOM_MEDIA_PATH = $tree->getPreference('GEDCOM_MEDIA_PATH');
571
-				if ($GEDCOM_MEDIA_PATH && strpos($data, $GEDCOM_MEDIA_PATH) === 0) {
572
-					$data = substr($data, strlen($GEDCOM_MEDIA_PATH));
573
-				}
574
-				// convert backslashes in filenames to forward slashes
575
-				$data = preg_replace("/\\\/", '/', $data);
549
+				default:
550
+					// Remove tabs and multiple/leading/trailing spaces
551
+					if (strpos($data, "\t") !== false) {
552
+						$data = str_replace("\t", ' ', $data);
553
+					}
554
+					if (substr($data, 0, 1) == ' ' || substr($data, -1, 1) == ' ') {
555
+						$data = trim($data);
556
+					}
557
+					while (strpos($data, '  ')) {
558
+						$data = str_replace('  ', ' ', $data);
559
+					}
560
+					$newrec .= ($newrec ? "\n" : '') . $level . ' ' . ($level == '0' && $xref ? $xref . ' ' : '') . $tag . ($data === '' && $tag != 'NOTE' ? '' : ' ' . $data);
561
+					break;
562
+				case 'NOTE':
563
+				case 'TEXT':
564
+				case 'DATA':
565
+				case 'CONT':
566
+					$newrec .= ($newrec ? "\n" : '') . $level . ' ' . ($level == '0' && $xref ? $xref . ' ' : '') . $tag . ($data === '' && $tag != 'NOTE' ? '' : ' ' . $data);
567
+					break;
568
+				case 'FILE':
569
+					// Strip off the user-defined path prefix
570
+					$GEDCOM_MEDIA_PATH = $tree->getPreference('GEDCOM_MEDIA_PATH');
571
+					if ($GEDCOM_MEDIA_PATH && strpos($data, $GEDCOM_MEDIA_PATH) === 0) {
572
+						$data = substr($data, strlen($GEDCOM_MEDIA_PATH));
573
+					}
574
+					// convert backslashes in filenames to forward slashes
575
+					$data = preg_replace("/\\\/", '/', $data);
576 576
 
577
-				$newrec .= ($newrec ? "\n" : '') . $level . ' ' . ($level == '0' && $xref ? $xref . ' ' : '') . $tag . ($data === '' && $tag != 'NOTE' ? '' : ' ' . $data);
578
-				break;
579
-			case 'CONC':
580
-				// Merge CONC lines, to simplify access later on.
581
-				$newrec .= ($tree->getPreference('WORD_WRAPPED_NOTES') ? ' ' : '') . $data;
582
-				break;
577
+					$newrec .= ($newrec ? "\n" : '') . $level . ' ' . ($level == '0' && $xref ? $xref . ' ' : '') . $tag . ($data === '' && $tag != 'NOTE' ? '' : ' ' . $data);
578
+					break;
579
+				case 'CONC':
580
+					// Merge CONC lines, to simplify access later on.
581
+					$newrec .= ($tree->getPreference('WORD_WRAPPED_NOTES') ? ' ' : '') . $data;
582
+					break;
583 583
 			}
584 584
 		}
585 585
 
@@ -636,139 +636,139 @@  discard block
 block discarded – undo
636 636
 		}
637 637
 
638 638
 		switch ($type) {
639
-		case 'INDI':
640
-			// Convert inline media into media objects
641
-			$gedrec = self::convertInlineMedia($tree, $gedrec);
639
+			case 'INDI':
640
+				// Convert inline media into media objects
641
+				$gedrec = self::convertInlineMedia($tree, $gedrec);
642 642
 
643
-			$record = new Individual($xref, $gedrec, null, $tree);
644
-			if (preg_match('/\n1 RIN (.+)/', $gedrec, $match)) {
645
-				$rin = $match[1];
646
-			} else {
647
-				$rin = $xref;
648
-			}
649
-			Database::prepare(
650
-				"INSERT INTO `##individuals` (i_id, i_file, i_rin, i_sex, i_gedcom) VALUES (?, ?, ?, ?, ?)"
651
-			)->execute([
652
-				$xref, $tree_id, $rin, $record->getSex(), $gedrec,
653
-			]);
654
-			// Update the cross-reference/index tables.
655
-			self::updatePlaces($xref, $tree_id, $gedrec);
656
-			self::updateDates($xref, $tree_id, $gedrec);
657
-			self::updateLinks($xref, $tree_id, $gedrec);
658
-			self::updateNames($xref, $tree_id, $record);
659
-			break;
660
-		case 'FAM':
661
-			// Convert inline media into media objects
662
-			$gedrec = self::convertInlineMedia($tree, $gedrec);
663
-
664
-			if (preg_match('/\n1 HUSB @(' . WT_REGEX_XREF . ')@/', $gedrec, $match)) {
665
-				$husb = $match[1];
666
-			} else {
667
-				$husb = '';
668
-			}
669
-			if (preg_match('/\n1 WIFE @(' . WT_REGEX_XREF . ')@/', $gedrec, $match)) {
670
-				$wife = $match[1];
671
-			} else {
672
-				$wife = '';
673
-			}
674
-			$nchi = preg_match_all('/\n1 CHIL @(' . WT_REGEX_XREF . ')@/', $gedrec, $match);
675
-			if (preg_match('/\n1 NCHI (\d+)/', $gedrec, $match)) {
676
-				$nchi = max($nchi, $match[1]);
677
-			}
678
-			Database::prepare(
679
-				"INSERT INTO `##families` (f_id, f_file, f_husb, f_wife, f_gedcom, f_numchil) VALUES (?, ?, ?, ?, ?, ?)"
680
-			)->execute([
681
-				$xref, $tree_id, $husb, $wife, $gedrec, $nchi,
682
-			]);
683
-			// Update the cross-reference/index tables.
684
-			self::updatePlaces($xref, $tree_id, $gedrec);
685
-			self::updateDates($xref, $tree_id, $gedrec);
686
-			self::updateLinks($xref, $tree_id, $gedrec);
687
-			break;
688
-		case 'SOUR':
689
-			// Convert inline media into media objects
690
-			$gedrec = self::convertInlineMedia($tree, $gedrec);
643
+				$record = new Individual($xref, $gedrec, null, $tree);
644
+				if (preg_match('/\n1 RIN (.+)/', $gedrec, $match)) {
645
+					$rin = $match[1];
646
+				} else {
647
+					$rin = $xref;
648
+				}
649
+				Database::prepare(
650
+					"INSERT INTO `##individuals` (i_id, i_file, i_rin, i_sex, i_gedcom) VALUES (?, ?, ?, ?, ?)"
651
+				)->execute([
652
+					$xref, $tree_id, $rin, $record->getSex(), $gedrec,
653
+				]);
654
+				// Update the cross-reference/index tables.
655
+				self::updatePlaces($xref, $tree_id, $gedrec);
656
+				self::updateDates($xref, $tree_id, $gedrec);
657
+				self::updateLinks($xref, $tree_id, $gedrec);
658
+				self::updateNames($xref, $tree_id, $record);
659
+				break;
660
+			case 'FAM':
661
+				// Convert inline media into media objects
662
+				$gedrec = self::convertInlineMedia($tree, $gedrec);
691 663
 
692
-			$record = new Source($xref, $gedrec, null, $tree);
693
-			if (preg_match('/\n1 TITL (.+)/', $gedrec, $match)) {
694
-				$name = $match[1];
695
-			} elseif (preg_match('/\n1 ABBR (.+)/', $gedrec, $match)) {
696
-				$name = $match[1];
697
-			} else {
698
-				$name = $xref;
699
-			}
700
-			Database::prepare(
701
-				"INSERT INTO `##sources` (s_id, s_file, s_name, s_gedcom) VALUES (?, ?, LEFT(?, 255), ?)"
702
-			)->execute([
703
-				$xref, $tree_id, $name, $gedrec,
704
-			]);
705
-			// Update the cross-reference/index tables.
706
-			self::updateLinks($xref, $tree_id, $gedrec);
707
-			self::updateNames($xref, $tree_id, $record);
708
-			break;
709
-		case 'REPO':
710
-			// Convert inline media into media objects
711
-			$gedrec = self::convertInlineMedia($tree, $gedrec);
664
+				if (preg_match('/\n1 HUSB @(' . WT_REGEX_XREF . ')@/', $gedrec, $match)) {
665
+					$husb = $match[1];
666
+				} else {
667
+					$husb = '';
668
+				}
669
+				if (preg_match('/\n1 WIFE @(' . WT_REGEX_XREF . ')@/', $gedrec, $match)) {
670
+					$wife = $match[1];
671
+				} else {
672
+					$wife = '';
673
+				}
674
+				$nchi = preg_match_all('/\n1 CHIL @(' . WT_REGEX_XREF . ')@/', $gedrec, $match);
675
+				if (preg_match('/\n1 NCHI (\d+)/', $gedrec, $match)) {
676
+					$nchi = max($nchi, $match[1]);
677
+				}
678
+				Database::prepare(
679
+					"INSERT INTO `##families` (f_id, f_file, f_husb, f_wife, f_gedcom, f_numchil) VALUES (?, ?, ?, ?, ?, ?)"
680
+				)->execute([
681
+					$xref, $tree_id, $husb, $wife, $gedrec, $nchi,
682
+				]);
683
+				// Update the cross-reference/index tables.
684
+				self::updatePlaces($xref, $tree_id, $gedrec);
685
+				self::updateDates($xref, $tree_id, $gedrec);
686
+				self::updateLinks($xref, $tree_id, $gedrec);
687
+				break;
688
+			case 'SOUR':
689
+				// Convert inline media into media objects
690
+				$gedrec = self::convertInlineMedia($tree, $gedrec);
712 691
 
713
-			$record = new Repository($xref, $gedrec, null, $tree);
714
-			Database::prepare(
715
-				"INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom) VALUES (?, ?, 'REPO', ?)"
716
-			)->execute([
717
-				$xref, $tree_id, $gedrec,
718
-			]);
719
-			// Update the cross-reference/index tables.
720
-			self::updateLinks($xref, $tree_id, $gedrec);
721
-			self::updateNames($xref, $tree_id, $record);
722
-			break;
723
-		case 'NOTE':
724
-			$record = new Note($xref, $gedrec, null, $tree);
725
-			Database::prepare(
726
-				"INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom) VALUES (?, ?, 'NOTE', ?)"
727
-			)->execute([
728
-				$xref, $tree_id, $gedrec,
729
-			]);
730
-			// Update the cross-reference/index tables.
731
-			self::updateLinks($xref, $tree_id, $gedrec);
732
-			self::updateNames($xref, $tree_id, $record);
733
-			break;
734
-		case 'OBJE':
735
-			$record = new Media($xref, $gedrec, null, $tree);
736
-			Database::prepare(
737
-				"INSERT INTO `##media` (m_id, m_file, m_gedcom) VALUES (:m_id, :m_file, :m_gedcom)"
738
-			)->execute([
739
-				'm_id'     => $xref,
740
-				'm_file'   => $tree_id,
741
-				'm_gedcom' => $gedrec,
742
-			]);
692
+				$record = new Source($xref, $gedrec, null, $tree);
693
+				if (preg_match('/\n1 TITL (.+)/', $gedrec, $match)) {
694
+					$name = $match[1];
695
+				} elseif (preg_match('/\n1 ABBR (.+)/', $gedrec, $match)) {
696
+					$name = $match[1];
697
+				} else {
698
+					$name = $xref;
699
+				}
700
+				Database::prepare(
701
+					"INSERT INTO `##sources` (s_id, s_file, s_name, s_gedcom) VALUES (?, ?, LEFT(?, 255), ?)"
702
+				)->execute([
703
+					$xref, $tree_id, $name, $gedrec,
704
+				]);
705
+				// Update the cross-reference/index tables.
706
+				self::updateLinks($xref, $tree_id, $gedrec);
707
+				self::updateNames($xref, $tree_id, $record);
708
+				break;
709
+			case 'REPO':
710
+				// Convert inline media into media objects
711
+				$gedrec = self::convertInlineMedia($tree, $gedrec);
743 712
 
744
-			foreach ($record->mediaFiles() as $media_file) {
713
+				$record = new Repository($xref, $gedrec, null, $tree);
745 714
 				Database::prepare(
746
-					"INSERT INTO `##media_file` (m_id, m_file, multimedia_file_refn, multimedia_format, source_media_type, descriptive_title) VALUES (:m_id, :m_file, LEFT(:multimedia_file_refn, 512), LEFT(:multimedia_format, 4), LEFT(:source_media_type, 15), LEFT(:descriptive_title, 248))"
715
+					"INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom) VALUES (?, ?, 'REPO', ?)"
747 716
 				)->execute([
748
-					'm_id'                 => $xref,
749
-					'm_file'               => $tree_id,
750
-					'multimedia_file_refn' => $media_file->filename(),
751
-					'multimedia_format'    => $media_file->format(),
752
-					'source_media_type'    => $media_file->type(),
753
-					'descriptive_title'    => $media_file->title(),
717
+					$xref, $tree_id, $gedrec,
718
+				]);
719
+				// Update the cross-reference/index tables.
720
+				self::updateLinks($xref, $tree_id, $gedrec);
721
+				self::updateNames($xref, $tree_id, $record);
722
+				break;
723
+			case 'NOTE':
724
+				$record = new Note($xref, $gedrec, null, $tree);
725
+				Database::prepare(
726
+					"INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom) VALUES (?, ?, 'NOTE', ?)"
727
+				)->execute([
728
+					$xref, $tree_id, $gedrec,
729
+				]);
730
+				// Update the cross-reference/index tables.
731
+				self::updateLinks($xref, $tree_id, $gedrec);
732
+				self::updateNames($xref, $tree_id, $record);
733
+				break;
734
+			case 'OBJE':
735
+				$record = new Media($xref, $gedrec, null, $tree);
736
+				Database::prepare(
737
+					"INSERT INTO `##media` (m_id, m_file, m_gedcom) VALUES (:m_id, :m_file, :m_gedcom)"
738
+				)->execute([
739
+					'm_id'     => $xref,
740
+					'm_file'   => $tree_id,
741
+					'm_gedcom' => $gedrec,
754 742
 				]);
755
-			}
756 743
 
757
-			// Update the cross-reference/index tables.
758
-			self::updateLinks($xref, $tree_id, $gedrec);
759
-			self::updateNames($xref, $tree_id, $record);
760
-			break;
761
-		default: // HEAD, TRLR, SUBM, SUBN, and custom record types.
762
-			// Force HEAD records to have a creation date.
763
-			if ($type === 'HEAD' && strpos($gedrec, "\n1 DATE ") === false) {
764
-				$gedrec .= "\n1 DATE " . date('j M Y');
765
-			}
766
-			Database::prepare(
767
-				"INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom) VALUES (?, ?, LEFT(?, 15), ?)"
768
-			)->execute([$xref, $tree_id, $type, $gedrec]);
769
-			// Update the cross-reference/index tables.
770
-			self::updateLinks($xref, $tree_id, $gedrec);
771
-			break;
744
+				foreach ($record->mediaFiles() as $media_file) {
745
+					Database::prepare(
746
+						"INSERT INTO `##media_file` (m_id, m_file, multimedia_file_refn, multimedia_format, source_media_type, descriptive_title) VALUES (:m_id, :m_file, LEFT(:multimedia_file_refn, 512), LEFT(:multimedia_format, 4), LEFT(:source_media_type, 15), LEFT(:descriptive_title, 248))"
747
+					)->execute([
748
+						'm_id'                 => $xref,
749
+						'm_file'               => $tree_id,
750
+						'multimedia_file_refn' => $media_file->filename(),
751
+						'multimedia_format'    => $media_file->format(),
752
+						'source_media_type'    => $media_file->type(),
753
+						'descriptive_title'    => $media_file->title(),
754
+					]);
755
+				}
756
+
757
+				// Update the cross-reference/index tables.
758
+				self::updateLinks($xref, $tree_id, $gedrec);
759
+				self::updateNames($xref, $tree_id, $record);
760
+				break;
761
+			default: // HEAD, TRLR, SUBM, SUBN, and custom record types.
762
+				// Force HEAD records to have a creation date.
763
+				if ($type === 'HEAD' && strpos($gedrec, "\n1 DATE ") === false) {
764
+					$gedrec .= "\n1 DATE " . date('j M Y');
765
+				}
766
+				Database::prepare(
767
+					"INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom) VALUES (?, ?, LEFT(?, 15), ?)"
768
+				)->execute([$xref, $tree_id, $type, $gedrec]);
769
+				// Update the cross-reference/index tables.
770
+				self::updateLinks($xref, $tree_id, $gedrec);
771
+				break;
772 772
 		}
773 773
 	}
774 774
 
@@ -1170,21 +1170,21 @@  discard block
 block discarded – undo
1170 1170
 		Database::prepare("DELETE FROM `##link` WHERE l_from=? AND l_file=?")->execute([$gid, $ged_id]);
1171 1171
 
1172 1172
 		switch ($type) {
1173
-		case 'INDI':
1174
-			Database::prepare("DELETE FROM `##individuals` WHERE i_id=? AND i_file=?")->execute([$gid, $ged_id]);
1175
-			break;
1176
-		case 'FAM':
1177
-			Database::prepare("DELETE FROM `##families` WHERE f_id=? AND f_file=?")->execute([$gid, $ged_id]);
1178
-			break;
1179
-		case 'SOUR':
1180
-			Database::prepare("DELETE FROM `##sources` WHERE s_id=? AND s_file=?")->execute([$gid, $ged_id]);
1181
-			break;
1182
-		case 'OBJE':
1183
-			Database::prepare("DELETE FROM `##media` WHERE m_id=? AND m_file=?")->execute([$gid, $ged_id]);
1184
-			break;
1185
-		default:
1186
-			Database::prepare("DELETE FROM `##other` WHERE o_id=? AND o_file=?")->execute([$gid, $ged_id]);
1187
-			break;
1173
+			case 'INDI':
1174
+				Database::prepare("DELETE FROM `##individuals` WHERE i_id=? AND i_file=?")->execute([$gid, $ged_id]);
1175
+				break;
1176
+			case 'FAM':
1177
+				Database::prepare("DELETE FROM `##families` WHERE f_id=? AND f_file=?")->execute([$gid, $ged_id]);
1178
+				break;
1179
+			case 'SOUR':
1180
+				Database::prepare("DELETE FROM `##sources` WHERE s_id=? AND s_file=?")->execute([$gid, $ged_id]);
1181
+				break;
1182
+			case 'OBJE':
1183
+				Database::prepare("DELETE FROM `##media` WHERE m_id=? AND m_file=?")->execute([$gid, $ged_id]);
1184
+				break;
1185
+			default:
1186
+				Database::prepare("DELETE FROM `##other` WHERE o_id=? AND o_file=?")->execute([$gid, $ged_id]);
1187
+				break;
1188 1188
 		}
1189 1189
 
1190 1190
 		if (!$delete) {
Please login to merge, or discard this patch.
app/Functions/FunctionsPrintFacts.php 1 patch
Switch Indentation   +283 added lines, -283 removed lines patch added patch discarded remove patch
@@ -63,34 +63,34 @@  discard block
 block discarded – undo
63 63
 
64 64
 		// Some facts don't get printed here ...
65 65
 		switch ($fact->getTag()) {
66
-		case 'NOTE':
67
-			self::printMainNotes($fact, 1);
66
+			case 'NOTE':
67
+				self::printMainNotes($fact, 1);
68 68
 
69
-			return;
70
-		case 'SOUR':
71
-			self::printMainSources($fact, 1);
69
+				return;
70
+			case 'SOUR':
71
+				self::printMainSources($fact, 1);
72 72
 
73
-			return;
74
-		case 'OBJE':
75
-			self::printMainMedia($fact, 1);
73
+				return;
74
+			case 'OBJE':
75
+				self::printMainMedia($fact, 1);
76 76
 
77
-			return;
78
-		case 'FAMC':
79
-		case 'FAMS':
80
-		case 'CHIL':
81
-		case 'HUSB':
82
-		case 'WIFE':
83
-			// These are internal links, not facts
84
-			return;
85
-		case '_WT_OBJE_SORT':
86
-			// These links are used internally to record the sort order.
87
-			return;
88
-		default:
89
-			// Hide unrecognized/custom tags?
90
-			if ($fact->getParent()->getTree()->getPreference('HIDE_GEDCOM_ERRORS') === '0' && !GedcomTag::isTag($fact->getTag())) {
91 77
 				return;
92
-			}
93
-			break;
78
+			case 'FAMC':
79
+			case 'FAMS':
80
+			case 'CHIL':
81
+			case 'HUSB':
82
+			case 'WIFE':
83
+				// These are internal links, not facts
84
+				return;
85
+			case '_WT_OBJE_SORT':
86
+				// These links are used internally to record the sort order.
87
+				return;
88
+			default:
89
+				// Hide unrecognized/custom tags?
90
+				if ($fact->getParent()->getTree()->getPreference('HIDE_GEDCOM_ERRORS') === '0' && !GedcomTag::isTag($fact->getTag())) {
91
+					return;
92
+				}
93
+				break;
94 94
 		}
95 95
 
96 96
 		// Who is this fact about? Need it to translate fact label correctly
@@ -134,35 +134,35 @@  discard block
 block discarded – undo
134 134
 		}
135 135
 
136 136
 		switch ($fact->getTag()) {
137
-		case 'EVEN':
138
-		case 'FACT':
139
-			if (GedcomTag::isTag($type)) {
140
-				// Some users (just Meliza?) use "1 EVEN/2 TYPE BIRT". Translate the TYPE.
141
-				$label = GedcomTag::getLabel($type, $label_person);
142
-				$type  = ''; // Do not print this again
143
-			} elseif ($type) {
144
-				// We don't have a translation for $type - but a custom translation might exist.
145
-				$label = I18N::translate(Html::escape($type));
146
-				$type  = ''; // Do not print this again
147
-			} else {
148
-				// An unspecified fact/event
149
-				$label = $fact->getLabel();
150
-			}
151
-			break;
152
-		case 'MARR':
153
-			// This is a hack for a proprietory extension. Is it still used/needed?
154
-			$utype = strtoupper($type);
155
-			if ($utype == 'CIVIL' || $utype == 'PARTNERS' || $utype == 'RELIGIOUS') {
156
-				$label = GedcomTag::getLabel('MARR_' . $utype, $label_person);
157
-				$type  = ''; // Do not print this again
158
-			} else {
137
+			case 'EVEN':
138
+			case 'FACT':
139
+				if (GedcomTag::isTag($type)) {
140
+					// Some users (just Meliza?) use "1 EVEN/2 TYPE BIRT". Translate the TYPE.
141
+					$label = GedcomTag::getLabel($type, $label_person);
142
+					$type  = ''; // Do not print this again
143
+				} elseif ($type) {
144
+					// We don't have a translation for $type - but a custom translation might exist.
145
+					$label = I18N::translate(Html::escape($type));
146
+					$type  = ''; // Do not print this again
147
+				} else {
148
+					// An unspecified fact/event
149
+					$label = $fact->getLabel();
150
+				}
151
+				break;
152
+			case 'MARR':
153
+				// This is a hack for a proprietory extension. Is it still used/needed?
154
+				$utype = strtoupper($type);
155
+				if ($utype == 'CIVIL' || $utype == 'PARTNERS' || $utype == 'RELIGIOUS') {
156
+					$label = GedcomTag::getLabel('MARR_' . $utype, $label_person);
157
+					$type  = ''; // Do not print this again
158
+				} else {
159
+					$label = $fact->getLabel();
160
+				}
161
+				break;
162
+			default:
163
+				// Normal fact/event
159 164
 				$label = $fact->getLabel();
160
-			}
161
-			break;
162
-		default:
163
-			// Normal fact/event
164
-			$label = $fact->getLabel();
165
-			break;
165
+				break;
166 166
 		}
167 167
 
168 168
 		echo '<tr class="', $styleadd, '">';
@@ -173,16 +173,16 @@  discard block
 block discarded – undo
173 173
 		}
174 174
 
175 175
 		switch ($fact->getTag()) {
176
-		case '_BIRT_CHIL':
177
-			$children[$fact->getParent()->getXref()] = true;
178
-			$label .= '<br>' . /* I18N: Abbreviation for "number %s" */ I18N::translate('#%s', count($children));
179
-			break;
180
-		case '_BIRT_GCHI':
181
-		case '_BIRT_GCH1':
182
-		case '_BIRT_GCH2':
183
-			$grandchildren[$fact->getParent()->getXref()] = true;
184
-			$label .= '<br>' . /* I18N: Abbreviation for "number %s" */ I18N::translate('#%s', count($grandchildren));
185
-			break;
176
+			case '_BIRT_CHIL':
177
+				$children[$fact->getParent()->getXref()] = true;
178
+				$label .= '<br>' . /* I18N: Abbreviation for "number %s" */ I18N::translate('#%s', count($children));
179
+				break;
180
+			case '_BIRT_GCHI':
181
+			case '_BIRT_GCH1':
182
+			case '_BIRT_GCH2':
183
+				$grandchildren[$fact->getParent()->getXref()] = true;
184
+				$label .= '<br>' . /* I18N: Abbreviation for "number %s" */ I18N::translate('#%s', count($grandchildren));
185
+				break;
186 186
 		}
187 187
 
188 188
 		if ($fact->getFactId() != 'histo' && $fact->canEdit()) {
@@ -217,87 +217,87 @@  discard block
 block discarded – undo
217 217
 
218 218
 		// Print the value of this fact/event
219 219
 		switch ($fact->getTag()) {
220
-		case 'ADDR':
221
-			echo $fact->getValue();
222
-			break;
223
-		case 'AFN':
224
-			echo '<div class="field"><a href="https://familysearch.org/search/tree/results#count=20&query=afn:', rawurlencode($fact->getValue()), '">', Html::escape($fact->getValue()), '</a></div>';
225
-			break;
226
-		case 'ASSO':
227
-			// we handle this later, in format_asso_rela_record()
228
-			break;
229
-		case 'EMAIL':
230
-		case 'EMAI':
231
-		case '_EMAIL':
232
-			echo '<div class="field"><a href="mailto:', Html::escape($fact->getValue()), '">', Html::escape($fact->getValue()), '</a></div>';
233
-			break;
234
-		case 'RESN':
235
-			echo '<div class="field">';
236
-			switch ($fact->getValue()) {
237
-			case 'none':
238
-			// Note: "1 RESN none" is not valid gedcom.
239
-			// However, webtrees privacy rules will interpret it as "show an otherwise private record to public".
240
-			echo '<i class="icon-resn-none"></i> ', I18N::translate('Show to visitors');
241
-			break;
242
-			case 'privacy':
243
-			echo '<i class="icon-class-none"></i> ', I18N::translate('Show to members');
244
-			break;
245
-			case 'confidential':
246
-			echo '<i class="icon-confidential-none"></i> ', I18N::translate('Show to managers');
247
-			break;
248
-			case 'locked':
249
-			echo '<i class="icon-locked-none"></i> ', I18N::translate('Only managers can edit');
250
-			break;
251
-			default:
252
-			echo Html::escape($fact->getValue());
253
-			break;
254
-			}
220
+			case 'ADDR':
221
+				echo $fact->getValue();
222
+				break;
223
+			case 'AFN':
224
+				echo '<div class="field"><a href="https://familysearch.org/search/tree/results#count=20&query=afn:', rawurlencode($fact->getValue()), '">', Html::escape($fact->getValue()), '</a></div>';
225
+				break;
226
+			case 'ASSO':
227
+				// we handle this later, in format_asso_rela_record()
228
+				break;
229
+			case 'EMAIL':
230
+			case 'EMAI':
231
+			case '_EMAIL':
232
+				echo '<div class="field"><a href="mailto:', Html::escape($fact->getValue()), '">', Html::escape($fact->getValue()), '</a></div>';
233
+				break;
234
+			case 'RESN':
235
+				echo '<div class="field">';
236
+				switch ($fact->getValue()) {
237
+					case 'none':
238
+					// Note: "1 RESN none" is not valid gedcom.
239
+					// However, webtrees privacy rules will interpret it as "show an otherwise private record to public".
240
+					echo '<i class="icon-resn-none"></i> ', I18N::translate('Show to visitors');
241
+					break;
242
+					case 'privacy':
243
+					echo '<i class="icon-class-none"></i> ', I18N::translate('Show to members');
244
+					break;
245
+					case 'confidential':
246
+					echo '<i class="icon-confidential-none"></i> ', I18N::translate('Show to managers');
247
+					break;
248
+					case 'locked':
249
+					echo '<i class="icon-locked-none"></i> ', I18N::translate('Only managers can edit');
250
+					break;
251
+					default:
252
+					echo Html::escape($fact->getValue());
253
+					break;
254
+				}
255 255
 				echo '</div>';
256 256
 				break;
257
-		case 'PUBL': // Publication details might contain URLs.
258
-			echo '<div class="field">', Filter::expandUrls($fact->getValue(), $record->getTree()), '</div>';
259
-			break;
260
-		case 'REPO':
261
-			if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $fact->getValue(), $match)) {
262
-				self::printRepositoryRecord($match[1]);
263
-			} else {
264
-				echo '<div class="error">', Html::escape($fact->getValue()), '</div>';
265
-			}
266
-			break;
267
-		case 'URL':
268
-		case '_URL':
269
-		case 'WWW':
270
-			echo '<div class="field"><a href="', Html::escape($fact->getValue()), '">', Html::escape($fact->getValue()), '</a></div>';
271
-			break;
272
-		case 'TEXT': // 0 SOUR / 1 TEXT
273
-			echo '<div class="field">', nl2br(Html::escape($fact->getValue()), false), '</div>';
274
-			break;
275
-		default:
276
-			// Display the value for all other facts/events
277
-			switch ($fact->getValue()) {
278
-			case '':
279
-			// Nothing to display
280
-			break;
281
-			case 'N':
282
-			// Not valid GEDCOM
283
-			echo '<div class="field">', I18N::translate('No'), '</div>';
284
-			break;
285
-			case 'Y':
286
-			// Do not display "Yes".
287
-			break;
288
-			default:
289
-			if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $fact->getValue(), $match)) {
290
-				$target = GedcomRecord::getInstance($match[1], $fact->getParent()->getTree());
291
-				if ($target) {
292
-					echo '<div><a href="', $target->getHtmlUrl(), '">', $target->getFullName(), '</a></div>';
257
+			case 'PUBL': // Publication details might contain URLs.
258
+				echo '<div class="field">', Filter::expandUrls($fact->getValue(), $record->getTree()), '</div>';
259
+				break;
260
+			case 'REPO':
261
+				if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $fact->getValue(), $match)) {
262
+					self::printRepositoryRecord($match[1]);
293 263
 				} else {
294 264
 					echo '<div class="error">', Html::escape($fact->getValue()), '</div>';
295 265
 				}
296
-			} else {
297
-				echo '<div class="field"><span dir="auto">', Html::escape($fact->getValue()), '</span></div>';
298
-			}
299
-			break;
300
-			}
266
+				break;
267
+			case 'URL':
268
+			case '_URL':
269
+			case 'WWW':
270
+				echo '<div class="field"><a href="', Html::escape($fact->getValue()), '">', Html::escape($fact->getValue()), '</a></div>';
271
+				break;
272
+			case 'TEXT': // 0 SOUR / 1 TEXT
273
+				echo '<div class="field">', nl2br(Html::escape($fact->getValue()), false), '</div>';
274
+				break;
275
+			default:
276
+				// Display the value for all other facts/events
277
+				switch ($fact->getValue()) {
278
+					case '':
279
+					// Nothing to display
280
+					break;
281
+					case 'N':
282
+					// Not valid GEDCOM
283
+					echo '<div class="field">', I18N::translate('No'), '</div>';
284
+					break;
285
+					case 'Y':
286
+					// Do not display "Yes".
287
+					break;
288
+					default:
289
+					if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $fact->getValue(), $match)) {
290
+						$target = GedcomRecord::getInstance($match[1], $fact->getParent()->getTree());
291
+						if ($target) {
292
+							echo '<div><a href="', $target->getHtmlUrl(), '">', $target->getFullName(), '</a></div>';
293
+						} else {
294
+							echo '<div class="error">', Html::escape($fact->getValue()), '</div>';
295
+						}
296
+					} else {
297
+						echo '<div class="field"><span dir="auto">', Html::escape($fact->getValue()), '</span></div>';
298
+					}
299
+					break;
300
+				}
301 301
 				break;
302 302
 		}
303 303
 
@@ -337,123 +337,123 @@  discard block
 block discarded – undo
337 337
 		preg_match_all('/\n2 (' . WT_REGEX_TAG . ') (.+)/', $fact->getGedcom(), $matches, PREG_SET_ORDER);
338 338
 		foreach ($matches as $match) {
339 339
 			switch ($match[1]) {
340
-			case 'DATE':
341
-			case 'TIME':
342
-			case 'AGE':
343
-			case 'PLAC':
344
-			case 'ADDR':
345
-			case 'ALIA':
346
-			case 'ASSO':
347
-			case '_ASSO':
348
-			case 'DESC':
349
-			case 'RELA':
350
-			case 'STAT':
351
-			case 'TEMP':
352
-			case 'TYPE':
353
-			case 'FAMS':
354
-			case 'CONT':
355
-				// These were already shown at the beginning
356
-				break;
357
-			case 'NOTE':
358
-			case 'OBJE':
359
-			case 'SOUR':
360
-				// These will be shown at the end
361
-				break;
362
-			case '_UID':
363
-			case 'RIN':
364
-				// These don't belong at level 2, so do not display them.
365
-				// They are only shown when editing.
366
-				break;
367
-			case 'EVEN': // 0 SOUR / 1 DATA / 2 EVEN / 3 DATE / 3 PLAC
368
-				$events = [];
369
-				foreach (preg_split('/ *, */', $match[2]) as $event) {
370
-					$events[] = GedcomTag::getLabel($event);
371
-				}
372
-				if (count($events) == 1) {
373
-					echo GedcomTag::getLabelValue('EVEN', $event);
374
-				} else {
375
-					echo GedcomTag::getLabelValue('EVEN', implode(I18N::$list_separator, $events));
376
-				}
377
-				if (preg_match('/\n3 DATE (.+)/', $fact->getGedcom(), $date_match)) {
378
-					$date = new Date($date_match[1]);
379
-					echo GedcomTag::getLabelValue('DATE', $date->display());
380
-				}
381
-				if (preg_match('/\n3 PLAC (.+)/', $fact->getGedcom(), $plac_match)) {
382
-					echo GedcomTag::getLabelValue('PLAC', $plac_match[1]);
383
-				}
384
-				break;
385
-			case 'FAMC': // 0 INDI / 1 ADOP / 2 FAMC / 3 ADOP
386
-				$family = Family::getInstance(str_replace('@', '', $match[2]), $fact->getParent()->getTree());
387
-				if ($family) {
388
-					echo GedcomTag::getLabelValue('FAM', '<a href="' . $family->getHtmlUrl() . '">' . $family->getFullName() . '</a>');
389
-					if (preg_match('/\n3 ADOP (HUSB|WIFE|BOTH)/', $fact->getGedcom(), $match)) {
390
-						echo GedcomTag::getLabelValue('ADOP', GedcomCodeAdop::getValue($match[1], $label_person));
340
+				case 'DATE':
341
+				case 'TIME':
342
+				case 'AGE':
343
+				case 'PLAC':
344
+				case 'ADDR':
345
+				case 'ALIA':
346
+				case 'ASSO':
347
+				case '_ASSO':
348
+				case 'DESC':
349
+				case 'RELA':
350
+				case 'STAT':
351
+				case 'TEMP':
352
+				case 'TYPE':
353
+				case 'FAMS':
354
+				case 'CONT':
355
+					// These were already shown at the beginning
356
+					break;
357
+				case 'NOTE':
358
+				case 'OBJE':
359
+				case 'SOUR':
360
+					// These will be shown at the end
361
+					break;
362
+				case '_UID':
363
+				case 'RIN':
364
+					// These don't belong at level 2, so do not display them.
365
+					// They are only shown when editing.
366
+					break;
367
+				case 'EVEN': // 0 SOUR / 1 DATA / 2 EVEN / 3 DATE / 3 PLAC
368
+					$events = [];
369
+					foreach (preg_split('/ *, */', $match[2]) as $event) {
370
+						$events[] = GedcomTag::getLabel($event);
371
+					}
372
+					if (count($events) == 1) {
373
+						echo GedcomTag::getLabelValue('EVEN', $event);
374
+					} else {
375
+						echo GedcomTag::getLabelValue('EVEN', implode(I18N::$list_separator, $events));
376
+					}
377
+					if (preg_match('/\n3 DATE (.+)/', $fact->getGedcom(), $date_match)) {
378
+						$date = new Date($date_match[1]);
379
+						echo GedcomTag::getLabelValue('DATE', $date->display());
380
+					}
381
+					if (preg_match('/\n3 PLAC (.+)/', $fact->getGedcom(), $plac_match)) {
382
+						echo GedcomTag::getLabelValue('PLAC', $plac_match[1]);
391 383
 					}
392
-				} else {
393
-					echo GedcomTag::getLabelValue('FAM', '<span class="error">' . $match[2] . '</span>');
394
-				}
395
-				break;
396
-			case '_WT_USER':
397
-				$user = User::findByIdentifier($match[2]); // may not exist
398
-				if ($user) {
399
-					echo GedcomTag::getLabelValue('_WT_USER', $user->getRealNameHtml());
400
-				} else {
401
-					echo GedcomTag::getLabelValue('_WT_USER', Html::escape($match[2]));
402
-				}
403
-				break;
404
-			case 'RESN':
405
-				switch ($match[2]) {
406
-				case 'none':
407
-				// Note: "2 RESN none" is not valid gedcom.
408
-				// However, webtrees privacy rules will interpret it as "show an otherwise private fact to public".
409
-				echo GedcomTag::getLabelValue('RESN', '<i class="icon-resn-none"></i> ' . I18N::translate('Show to visitors'));
410
-				break;
411
-				case 'privacy':
412
-				echo GedcomTag::getLabelValue('RESN', '<i class="icon-resn-privacy"></i> ' . I18N::translate('Show to members'));
413
-				break;
414
-				case 'confidential':
415
-				echo GedcomTag::getLabelValue('RESN', '<i class="icon-resn-confidential"></i> ' . I18N::translate('Show to managers'));
416
-				break;
417
-				case 'locked':
418
-				echo GedcomTag::getLabelValue('RESN', '<i class="icon-resn-locked"></i> ' . I18N::translate('Only managers can edit'));
419
-				break;
420
-				default:
421
-				echo GedcomTag::getLabelValue('RESN', Html::escape($match[2]));
422
-				break;
423
-				}
424 384
 					break;
425
-			case 'CALN':
426
-				echo GedcomTag::getLabelValue('CALN', Filter::expandUrls($match[2], $record->getTree()));
427
-				break;
428
-			case 'FORM': // 0 OBJE / 1 FILE / 2 FORM / 3 TYPE
429
-				echo GedcomTag::getLabelValue('FORM', $match[2]);
430
-				if (preg_match('/\n3 TYPE (.+)/', $fact->getGedcom(), $type_match)) {
431
-					echo GedcomTag::getLabelValue('TYPE', GedcomTag::getFileFormTypeValue($type_match[1]));
432
-				}
433
-				break;
434
-			case 'URL':
435
-			case '_URL':
436
-			case 'WWW':
437
-				$link = '<a href="' . Html::escape($match[2]) . '">' . Html::escape($match[2]) . '</a>';
438
-				echo GedcomTag::getLabelValue($fact->getTag() . ':' . $match[1], $link);
439
-				break;
440
-			default:
441
-				if ($fact->getParent()->getTree()->getPreference('HIDE_GEDCOM_ERRORS') === '1' || GedcomTag::isTag($match[1])) {
442
-					if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $match[2], $xmatch)) {
443
-						// Links
444
-						$linked_record = GedcomRecord::getInstance($xmatch[1], $fact->getParent()->getTree());
445
-						if ($linked_record) {
446
-							$link = '<a href="' . $linked_record->getHtmlUrl() . '">' . $linked_record->getFullName() . '</a>';
447
-							echo GedcomTag::getLabelValue($fact->getTag() . ':' . $match[1], $link);
385
+				case 'FAMC': // 0 INDI / 1 ADOP / 2 FAMC / 3 ADOP
386
+					$family = Family::getInstance(str_replace('@', '', $match[2]), $fact->getParent()->getTree());
387
+					if ($family) {
388
+						echo GedcomTag::getLabelValue('FAM', '<a href="' . $family->getHtmlUrl() . '">' . $family->getFullName() . '</a>');
389
+						if (preg_match('/\n3 ADOP (HUSB|WIFE|BOTH)/', $fact->getGedcom(), $match)) {
390
+							echo GedcomTag::getLabelValue('ADOP', GedcomCodeAdop::getValue($match[1], $label_person));
391
+						}
392
+					} else {
393
+						echo GedcomTag::getLabelValue('FAM', '<span class="error">' . $match[2] . '</span>');
394
+					}
395
+					break;
396
+				case '_WT_USER':
397
+					$user = User::findByIdentifier($match[2]); // may not exist
398
+					if ($user) {
399
+						echo GedcomTag::getLabelValue('_WT_USER', $user->getRealNameHtml());
400
+					} else {
401
+						echo GedcomTag::getLabelValue('_WT_USER', Html::escape($match[2]));
402
+					}
403
+					break;
404
+				case 'RESN':
405
+					switch ($match[2]) {
406
+						case 'none':
407
+						// Note: "2 RESN none" is not valid gedcom.
408
+						// However, webtrees privacy rules will interpret it as "show an otherwise private fact to public".
409
+						echo GedcomTag::getLabelValue('RESN', '<i class="icon-resn-none"></i> ' . I18N::translate('Show to visitors'));
410
+						break;
411
+						case 'privacy':
412
+						echo GedcomTag::getLabelValue('RESN', '<i class="icon-resn-privacy"></i> ' . I18N::translate('Show to members'));
413
+						break;
414
+						case 'confidential':
415
+						echo GedcomTag::getLabelValue('RESN', '<i class="icon-resn-confidential"></i> ' . I18N::translate('Show to managers'));
416
+						break;
417
+						case 'locked':
418
+						echo GedcomTag::getLabelValue('RESN', '<i class="icon-resn-locked"></i> ' . I18N::translate('Only managers can edit'));
419
+						break;
420
+						default:
421
+						echo GedcomTag::getLabelValue('RESN', Html::escape($match[2]));
422
+						break;
423
+					}
424
+					break;
425
+				case 'CALN':
426
+					echo GedcomTag::getLabelValue('CALN', Filter::expandUrls($match[2], $record->getTree()));
427
+					break;
428
+				case 'FORM': // 0 OBJE / 1 FILE / 2 FORM / 3 TYPE
429
+					echo GedcomTag::getLabelValue('FORM', $match[2]);
430
+					if (preg_match('/\n3 TYPE (.+)/', $fact->getGedcom(), $type_match)) {
431
+						echo GedcomTag::getLabelValue('TYPE', GedcomTag::getFileFormTypeValue($type_match[1]));
432
+					}
433
+					break;
434
+				case 'URL':
435
+				case '_URL':
436
+				case 'WWW':
437
+					$link = '<a href="' . Html::escape($match[2]) . '">' . Html::escape($match[2]) . '</a>';
438
+					echo GedcomTag::getLabelValue($fact->getTag() . ':' . $match[1], $link);
439
+					break;
440
+				default:
441
+					if ($fact->getParent()->getTree()->getPreference('HIDE_GEDCOM_ERRORS') === '1' || GedcomTag::isTag($match[1])) {
442
+						if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $match[2], $xmatch)) {
443
+							// Links
444
+							$linked_record = GedcomRecord::getInstance($xmatch[1], $fact->getParent()->getTree());
445
+							if ($linked_record) {
446
+								$link = '<a href="' . $linked_record->getHtmlUrl() . '">' . $linked_record->getFullName() . '</a>';
447
+								echo GedcomTag::getLabelValue($fact->getTag() . ':' . $match[1], $link);
448
+							} else {
449
+								echo GedcomTag::getLabelValue($fact->getTag() . ':' . $match[1], Html::escape($match[2]));
450
+							}
448 451
 						} else {
452
+							// Non links
449 453
 							echo GedcomTag::getLabelValue($fact->getTag() . ':' . $match[1], Html::escape($match[2]));
450 454
 						}
451
-					} else {
452
-						// Non links
453
-						echo GedcomTag::getLabelValue($fact->getTag() . ':' . $match[1], Html::escape($match[2]));
454 455
 					}
455
-				}
456
-				break;
456
+					break;
457 457
 			}
458 458
 		}
459 459
 		echo self::printFactSources($fact->getGedcom(), 2);
@@ -800,23 +800,23 @@  discard block
 block discarded – undo
800 800
 						foreach ($rmatches[1] as $rmatch) {
801 801
 							echo '<br><span class="label">', GedcomTag::getLabel('RESN'), ':</span> <span class="field">';
802 802
 							switch ($rmatch) {
803
-							case 'none':
804
-								// Note: "2 RESN none" is not valid gedcom, and the GUI will not let you add it.
805
-								// However, webtrees privacy rules will interpret it as "show an otherwise private fact to public".
806
-								echo '<i class="icon-resn-none"></i> ', I18N::translate('Show to visitors');
807
-								break;
808
-							case 'privacy':
809
-								echo '<i class="icon-resn-privacy"></i> ', I18N::translate('Show to members');
810
-								break;
811
-							case 'confidential':
812
-								echo '<i class="icon-resn-confidential"></i> ', I18N::translate('Show to managers');
813
-								break;
814
-							case 'locked':
815
-								echo '<i class="icon-resn-locked"></i> ', I18N::translate('Only managers can edit');
816
-								break;
817
-							default:
818
-								echo $rmatch;
819
-								break;
803
+								case 'none':
804
+									// Note: "2 RESN none" is not valid gedcom, and the GUI will not let you add it.
805
+									// However, webtrees privacy rules will interpret it as "show an otherwise private fact to public".
806
+									echo '<i class="icon-resn-none"></i> ', I18N::translate('Show to visitors');
807
+									break;
808
+								case 'privacy':
809
+									echo '<i class="icon-resn-privacy"></i> ', I18N::translate('Show to members');
810
+									break;
811
+								case 'confidential':
812
+									echo '<i class="icon-resn-confidential"></i> ', I18N::translate('Show to managers');
813
+									break;
814
+								case 'locked':
815
+									echo '<i class="icon-resn-locked"></i> ', I18N::translate('Only managers can edit');
816
+									break;
817
+								default:
818
+									echo $rmatch;
819
+									break;
820 820
 							}
821 821
 							echo '</span>';
822 822
 						}
@@ -1053,23 +1053,23 @@  discard block
 block discarded – undo
1053 1053
 				foreach ($matches[1] as $match) {
1054 1054
 					echo '<br><span class="label">', GedcomTag::getLabel('RESN'), ':</span> <span class="field">';
1055 1055
 					switch ($match) {
1056
-					case 'none':
1057
-						// Note: "2 RESN none" is not valid gedcom, and the GUI will not let you add it.
1058
-						// However, webtrees privacy rules will interpret it as "show an otherwise private fact to public".
1059
-						echo '<i class="icon-resn-none"></i> ', I18N::translate('Show to visitors');
1060
-						break;
1061
-					case 'privacy':
1062
-						echo '<i class="icon-resn-privacy"></i> ', I18N::translate('Show to members');
1063
-						break;
1064
-					case 'confidential':
1065
-						echo '<i class="icon-resn-confidential"></i> ', I18N::translate('Show to managers');
1066
-						break;
1067
-					case 'locked':
1068
-						echo '<i class="icon-resn-locked"></i> ', I18N::translate('Only managers can edit');
1069
-						break;
1070
-					default:
1071
-						echo $match;
1072
-						break;
1056
+						case 'none':
1057
+							// Note: "2 RESN none" is not valid gedcom, and the GUI will not let you add it.
1058
+							// However, webtrees privacy rules will interpret it as "show an otherwise private fact to public".
1059
+							echo '<i class="icon-resn-none"></i> ', I18N::translate('Show to visitors');
1060
+							break;
1061
+						case 'privacy':
1062
+							echo '<i class="icon-resn-privacy"></i> ', I18N::translate('Show to members');
1063
+							break;
1064
+						case 'confidential':
1065
+							echo '<i class="icon-resn-confidential"></i> ', I18N::translate('Show to managers');
1066
+							break;
1067
+						case 'locked':
1068
+							echo '<i class="icon-resn-locked"></i> ', I18N::translate('Only managers can edit');
1069
+							break;
1070
+						default:
1071
+							echo $match;
1072
+							break;
1073 1073
 					}
1074 1074
 					echo '</span>';
1075 1075
 				}
Please login to merge, or discard this patch.
app/Functions/FunctionsDate.php 1 patch
Switch Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -31,28 +31,28 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public static function getAgeAtEvent($age_string) {
33 33
 		switch (strtoupper($age_string)) {
34
-		case 'CHILD':
35
-			return I18N::translate('Child');
36
-		case 'INFANT':
37
-			return I18N::translate('Infant');
38
-		case 'STILLBORN':
39
-			return I18N::translate('Stillborn');
40
-		default:
41
-			return preg_replace_callback(
42
-				[
43
-					'/(\d+)([ymwd])/',
44
-				],
45
-				function ($match) {
46
-					switch ($match[2]) {
47
-					case 'y':
48
-						return I18N::plural('%s year', '%s years', $match[1], I18N::digits($match[1]));
49
-					case 'm':
50
-						return I18N::plural('%s month', '%s months', $match[1], I18N::digits($match[1]));
51
-					case 'w':
52
-						return I18N::plural('%s week', '%s weeks', $match[1], I18N::digits($match[1]));
53
-					case 'd':
54
-						return I18N::plural('%s day', '%s days', $match[1], I18N::digits($match[1]));
55
-					}
34
+			case 'CHILD':
35
+				return I18N::translate('Child');
36
+			case 'INFANT':
37
+				return I18N::translate('Infant');
38
+			case 'STILLBORN':
39
+				return I18N::translate('Stillborn');
40
+			default:
41
+				return preg_replace_callback(
42
+					[
43
+						'/(\d+)([ymwd])/',
44
+					],
45
+					function ($match) {
46
+						switch ($match[2]) {
47
+							case 'y':
48
+								return I18N::plural('%s year', '%s years', $match[1], I18N::digits($match[1]));
49
+							case 'm':
50
+								return I18N::plural('%s month', '%s months', $match[1], I18N::digits($match[1]));
51
+							case 'w':
52
+								return I18N::plural('%s week', '%s weeks', $match[1], I18N::digits($match[1]));
53
+							case 'd':
54
+								return I18N::plural('%s day', '%s days', $match[1], I18N::digits($match[1]));
55
+						}
56 56
 				},
57 57
 				$age_string
58 58
 			);
@@ -74,40 +74,40 @@  discard block
 block discarded – undo
74 74
 		preg_match_all('/%[^%]/', $time_fmt, $matches);
75 75
 		foreach ($matches[0] as $match) {
76 76
 			switch ($match) {
77
-			case '%a':
78
-				$t = gmdate('His', $time);
79
-				if ($t == '000000') {
80
-					$time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 00:00:00 */
81
-						I18N::translate('midnight'), $time_fmt);
82
-				} elseif ($t < '120000') {
83
-					$time_fmt = str_replace($match, /* I18N: time format “%a” - between 00:00:01 and 11:59:59 */
84
-						I18N::translate('a.m.'), $time_fmt);
85
-				} elseif ($t == '120000') {
86
-					$time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 12:00:00 */
87
-						I18N::translate('noon'), $time_fmt);
88
-				} else {
89
-					$time_fmt = str_replace($match, /* I18N: time format “%a” - between 12:00:01 and 23:59:59 */
90
-						I18N::translate('p.m.'), $time_fmt);
91
-				}
92
-				break;
93
-			case '%A':
94
-				$t = gmdate('His', $time);
95
-				if ($t == '000000') {
96
-					$time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 00:00:00 */
97
-						I18N::translate('Midnight'), $time_fmt);
98
-				} elseif ($t < '120000') {
99
-					$time_fmt = str_replace($match, /* I18N: time format “%A” - between 00:00:01 and 11:59:59 */
100
-						I18N::translate('A.M.'), $time_fmt);
101
-				} elseif ($t == '120000') {
102
-					$time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 12:00:00 */
103
-						I18N::translate('Noon'), $time_fmt);
104
-				} else {
105
-					$time_fmt = str_replace($match, /* I18N: time format “%A” - between 12:00:01 and 23:59:59 */
106
-						I18N::translate('P.M.'), $time_fmt);
107
-				}
108
-				break;
109
-			default:
110
-				$time_fmt = str_replace($match, I18N::digits(gmdate(substr($match, -1), $time)), $time_fmt);
77
+				case '%a':
78
+					$t = gmdate('His', $time);
79
+					if ($t == '000000') {
80
+						$time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 00:00:00 */
81
+							I18N::translate('midnight'), $time_fmt);
82
+					} elseif ($t < '120000') {
83
+						$time_fmt = str_replace($match, /* I18N: time format “%a” - between 00:00:01 and 11:59:59 */
84
+							I18N::translate('a.m.'), $time_fmt);
85
+					} elseif ($t == '120000') {
86
+						$time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 12:00:00 */
87
+							I18N::translate('noon'), $time_fmt);
88
+					} else {
89
+						$time_fmt = str_replace($match, /* I18N: time format “%a” - between 12:00:01 and 23:59:59 */
90
+							I18N::translate('p.m.'), $time_fmt);
91
+					}
92
+					break;
93
+				case '%A':
94
+					$t = gmdate('His', $time);
95
+					if ($t == '000000') {
96
+						$time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 00:00:00 */
97
+							I18N::translate('Midnight'), $time_fmt);
98
+					} elseif ($t < '120000') {
99
+						$time_fmt = str_replace($match, /* I18N: time format “%A” - between 00:00:01 and 11:59:59 */
100
+							I18N::translate('A.M.'), $time_fmt);
101
+					} elseif ($t == '120000') {
102
+						$time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 12:00:00 */
103
+							I18N::translate('Noon'), $time_fmt);
104
+					} else {
105
+						$time_fmt = str_replace($match, /* I18N: time format “%A” - between 12:00:01 and 23:59:59 */
106
+							I18N::translate('P.M.'), $time_fmt);
107
+					}
108
+					break;
109
+				default:
110
+					$time_fmt = str_replace($match, I18N::digits(gmdate(substr($match, -1), $time)), $time_fmt);
111 111
 			}
112 112
 		}
113 113
 
Please login to merge, or discard this patch.
app/Functions/FunctionsPrint.php 1 patch
Switch Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -220,25 +220,25 @@  discard block
 block discarded – undo
220 220
 					$age      = Date::getAge($parent->getBirthDate(), $birth_date, 2);
221 221
 					$deatdate = $parent->getDeathDate();
222 222
 					switch ($parent->getSex()) {
223
-					case 'F':
224
-						// Highlight mothers who die in childbirth or shortly afterwards
225
-						if ($deatdate->isOK() && $deatdate->maximumJulianDay() < $birth_date->minimumJulianDay() + 90) {
226
-							$html .= ' <span title="' . GedcomTag::getLabel('_DEAT_PARE', $parent) . '" class="parentdeath">' . $sex . $age . '</span>';
227
-						} else {
228
-							$html .= ' <span title="' . I18N::translate('Mother’s age') . '">' . $sex . $age . '</span>';
229
-						}
230
-						break;
231
-					case 'M':
232
-						// Highlight fathers who die before the birth
233
-						if ($deatdate->isOK() && $deatdate->maximumJulianDay() < $birth_date->minimumJulianDay()) {
234
-							$html .= ' <span title="' . GedcomTag::getLabel('_DEAT_PARE', $parent) . '" class="parentdeath">' . $sex . $age . '</span>';
235
-						} else {
236
-							$html .= ' <span title="' . I18N::translate('Father’s age') . '">' . $sex . $age . '</span>';
237
-						}
238
-						break;
239
-					default:
240
-						$html .= ' <span title="' . I18N::translate('Parent’s age') . '">' . $sex . $age . '</span>';
241
-						break;
223
+						case 'F':
224
+							// Highlight mothers who die in childbirth or shortly afterwards
225
+							if ($deatdate->isOK() && $deatdate->maximumJulianDay() < $birth_date->minimumJulianDay() + 90) {
226
+								$html .= ' <span title="' . GedcomTag::getLabel('_DEAT_PARE', $parent) . '" class="parentdeath">' . $sex . $age . '</span>';
227
+							} else {
228
+								$html .= ' <span title="' . I18N::translate('Mother’s age') . '">' . $sex . $age . '</span>';
229
+							}
230
+							break;
231
+						case 'M':
232
+							// Highlight fathers who die before the birth
233
+							if ($deatdate->isOK() && $deatdate->maximumJulianDay() < $birth_date->minimumJulianDay()) {
234
+								$html .= ' <span title="' . GedcomTag::getLabel('_DEAT_PARE', $parent) . '" class="parentdeath">' . $sex . $age . '</span>';
235
+							} else {
236
+								$html .= ' <span title="' . I18N::translate('Father’s age') . '">' . $sex . $age . '</span>';
237
+							}
238
+							break;
239
+						default:
240
+							$html .= ' <span title="' . I18N::translate('Parent’s age') . '">' . $sex . $age . '</span>';
241
+							break;
242 242
 					}
243 243
 				}
244 244
 			}
@@ -533,38 +533,38 @@  discard block
 block discarded – undo
533 533
 
534 534
 		// -- Add from pick list
535 535
 		switch ($type) {
536
-		case 'INDI':
537
-			$addfacts    = preg_split('/[, ;:]+/', $WT_TREE->getPreference('INDI_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
538
-			$uniquefacts = preg_split('/[, ;:]+/', $WT_TREE->getPreference('INDI_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
539
-			$quickfacts  = preg_split('/[, ;:]+/', $WT_TREE->getPreference('INDI_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
540
-			break;
541
-		case 'FAM':
542
-			$addfacts    = preg_split('/[, ;:]+/', $WT_TREE->getPreference('FAM_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
543
-			$uniquefacts = preg_split('/[, ;:]+/', $WT_TREE->getPreference('FAM_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
544
-			$quickfacts  = preg_split('/[, ;:]+/', $WT_TREE->getPreference('FAM_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
545
-			break;
546
-		case 'SOUR':
547
-			$addfacts    = preg_split('/[, ;:]+/', $WT_TREE->getPreference('SOUR_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
548
-			$uniquefacts = preg_split('/[, ;:]+/', $WT_TREE->getPreference('SOUR_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
549
-			$quickfacts  = preg_split('/[, ;:]+/', $WT_TREE->getPreference('SOUR_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
550
-			break;
551
-		case 'NOTE':
552
-			$addfacts    = preg_split('/[, ;:]+/', $WT_TREE->getPreference('NOTE_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
553
-			$uniquefacts = preg_split('/[, ;:]+/', $WT_TREE->getPreference('NOTE_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
554
-			$quickfacts  = preg_split('/[, ;:]+/', $WT_TREE->getPreference('NOTE_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
555
-			break;
556
-		case 'REPO':
557
-			$addfacts    = preg_split('/[, ;:]+/', $WT_TREE->getPreference('REPO_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
558
-			$uniquefacts = preg_split('/[, ;:]+/', $WT_TREE->getPreference('REPO_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
559
-			$quickfacts  = preg_split('/[, ;:]+/', $WT_TREE->getPreference('REPO_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
560
-			break;
561
-		case 'OBJE':
562
-			$addfacts    = ['NOTE'];
563
-			$uniquefacts = ['_PRIM'];
564
-			$quickfacts  = [];
565
-			break;
566
-		default:
567
-			return;
536
+			case 'INDI':
537
+				$addfacts    = preg_split('/[, ;:]+/', $WT_TREE->getPreference('INDI_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
538
+				$uniquefacts = preg_split('/[, ;:]+/', $WT_TREE->getPreference('INDI_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
539
+				$quickfacts  = preg_split('/[, ;:]+/', $WT_TREE->getPreference('INDI_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
540
+				break;
541
+			case 'FAM':
542
+				$addfacts    = preg_split('/[, ;:]+/', $WT_TREE->getPreference('FAM_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
543
+				$uniquefacts = preg_split('/[, ;:]+/', $WT_TREE->getPreference('FAM_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
544
+				$quickfacts  = preg_split('/[, ;:]+/', $WT_TREE->getPreference('FAM_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
545
+				break;
546
+			case 'SOUR':
547
+				$addfacts    = preg_split('/[, ;:]+/', $WT_TREE->getPreference('SOUR_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
548
+				$uniquefacts = preg_split('/[, ;:]+/', $WT_TREE->getPreference('SOUR_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
549
+				$quickfacts  = preg_split('/[, ;:]+/', $WT_TREE->getPreference('SOUR_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
550
+				break;
551
+			case 'NOTE':
552
+				$addfacts    = preg_split('/[, ;:]+/', $WT_TREE->getPreference('NOTE_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
553
+				$uniquefacts = preg_split('/[, ;:]+/', $WT_TREE->getPreference('NOTE_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
554
+				$quickfacts  = preg_split('/[, ;:]+/', $WT_TREE->getPreference('NOTE_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
555
+				break;
556
+			case 'REPO':
557
+				$addfacts    = preg_split('/[, ;:]+/', $WT_TREE->getPreference('REPO_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
558
+				$uniquefacts = preg_split('/[, ;:]+/', $WT_TREE->getPreference('REPO_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
559
+				$quickfacts  = preg_split('/[, ;:]+/', $WT_TREE->getPreference('REPO_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
560
+				break;
561
+			case 'OBJE':
562
+				$addfacts    = ['NOTE'];
563
+				$uniquefacts = ['_PRIM'];
564
+				$quickfacts  = [];
565
+				break;
566
+			default:
567
+				return;
568 568
 		}
569 569
 		$addfacts            = array_merge(self::checkFactUnique($uniquefacts, $usedfacts, $type), $addfacts);
570 570
 		$quickfacts          = array_intersect($quickfacts, $addfacts);
Please login to merge, or discard this patch.
app/Functions/FunctionsRtl.php 1 patch
Switch Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -124,227 +124,227 @@  discard block
 block discarded – undo
124 124
 			$closeParIndex = strpos(self::CLOSE_PARENTHESES, $currentLetter); // Which closing parenthesis is this?
125 125
 
126 126
 			switch ($currentLetter) {
127
-			case '<':
128
-				// Assume this '<' starts an HTML element
129
-				$endPos = strpos($workingText, '>'); // look for the terminating '>'
130
-				if ($endPos === false) {
131
-					$endPos = 0;
132
-				}
133
-				$currentLen += $endPos;
134
-				$element = substr($workingText, 0, $currentLen);
135
-				$temp    = strtolower(substr($element, 0, 3));
136
-				if (strlen($element) < 7 && $temp == '<br') {
137
-					if ($numberState) {
138
-						$numberState = false;
139
-						if (self::$currentState == 'RTL') {
140
-							self::$waitingText .= WT_UTF8_PDF;
127
+				case '<':
128
+					// Assume this '<' starts an HTML element
129
+					$endPos = strpos($workingText, '>'); // look for the terminating '>'
130
+					if ($endPos === false) {
131
+						$endPos = 0;
132
+					}
133
+					$currentLen += $endPos;
134
+					$element = substr($workingText, 0, $currentLen);
135
+					$temp    = strtolower(substr($element, 0, 3));
136
+					if (strlen($element) < 7 && $temp == '<br') {
137
+						if ($numberState) {
138
+							$numberState = false;
139
+							if (self::$currentState == 'RTL') {
140
+								self::$waitingText .= WT_UTF8_PDF;
141
+							}
141 142
 						}
143
+						self::breakCurrentSpan($result);
144
+					} elseif (self::$waitingText == '') {
145
+						$result .= $element;
146
+					} else {
147
+						self::$waitingText .= $element;
142 148
 					}
143
-					self::breakCurrentSpan($result);
144
-				} elseif (self::$waitingText == '') {
145
-					$result .= $element;
146
-				} else {
147
-					self::$waitingText .= $element;
148
-				}
149
-				$workingText = substr($workingText, $currentLen);
150
-				break;
151
-			case '&':
152
-				// Assume this '&' starts an HTML entity
153
-				$endPos = strpos($workingText, ';'); // look for the terminating ';'
154
-				if ($endPos === false) {
155
-					$endPos = 0;
156
-				}
157
-				$currentLen += $endPos;
158
-				$entity = substr($workingText, 0, $currentLen);
159
-				if (strtolower($entity) == '&nbsp;') {
160
-					$entity .= '&nbsp;'; // Ensure consistent case for this entity
161
-				}
162
-				if (self::$waitingText == '') {
163
-					$result .= $entity;
164
-				} else {
165
-					self::$waitingText .= $entity;
166
-				}
167
-				$workingText = substr($workingText, $currentLen);
168
-				break;
169
-			case '{':
170
-				if (substr($workingText, 1, 1) == '{') {
171
-					// Assume this '{{' starts a TCPDF directive
172
-					$endPos = strpos($workingText, '}}'); // look for the terminating '}}'
149
+					$workingText = substr($workingText, $currentLen);
150
+					break;
151
+				case '&':
152
+					// Assume this '&' starts an HTML entity
153
+					$endPos = strpos($workingText, ';'); // look for the terminating ';'
173 154
 					if ($endPos === false) {
174 155
 						$endPos = 0;
175 156
 					}
176
-					$currentLen        = $endPos + 2;
177
-					$directive         = substr($workingText, 0, $currentLen);
178
-					$workingText       = substr($workingText, $currentLen);
179
-					$result            = $result . self::$waitingText . $directive;
180
-					self::$waitingText = '';
157
+					$currentLen += $endPos;
158
+					$entity = substr($workingText, 0, $currentLen);
159
+					if (strtolower($entity) == '&nbsp;') {
160
+						$entity .= '&nbsp;'; // Ensure consistent case for this entity
161
+					}
162
+					if (self::$waitingText == '') {
163
+						$result .= $entity;
164
+					} else {
165
+						self::$waitingText .= $entity;
166
+					}
167
+					$workingText = substr($workingText, $currentLen);
181 168
 					break;
182
-				}
183
-			default:
184
-				// Look for strings of numbers with optional leading or trailing + or -
185
-				// and with optional embedded numeric punctuation
186
-				if ($numberState) {
187
-					// If we're inside a numeric string, look for reasons to end it
188
-					$offset    = 0; // Be sure to look at the current character first
189
-					$charArray = self::getChar($workingText . "\n", $offset);
190
-					if (strpos(self::NUMBERS, $charArray['letter']) === false) {
191
-						// This is not a digit. Is it numeric punctuation?
192
-						if (substr($workingText . "\n", $offset, 6) == '&nbsp;') {
193
-							$offset += 6; // This could be numeric punctuation
194
-						} elseif (strpos(self::NUMBER_PUNCTUATION, $charArray['letter']) !== false) {
195
-							$offset += $charArray['length']; // This could be numeric punctuation
169
+				case '{':
170
+					if (substr($workingText, 1, 1) == '{') {
171
+						// Assume this '{{' starts a TCPDF directive
172
+						$endPos = strpos($workingText, '}}'); // look for the terminating '}}'
173
+						if ($endPos === false) {
174
+							$endPos = 0;
196 175
 						}
197
-						// If the next character is a digit, the current character is numeric punctuation
176
+						$currentLen        = $endPos + 2;
177
+						$directive         = substr($workingText, 0, $currentLen);
178
+						$workingText       = substr($workingText, $currentLen);
179
+						$result            = $result . self::$waitingText . $directive;
180
+						self::$waitingText = '';
181
+						break;
182
+					}
183
+				default:
184
+					// Look for strings of numbers with optional leading or trailing + or -
185
+					// and with optional embedded numeric punctuation
186
+					if ($numberState) {
187
+						// If we're inside a numeric string, look for reasons to end it
188
+						$offset    = 0; // Be sure to look at the current character first
198 189
 						$charArray = self::getChar($workingText . "\n", $offset);
199 190
 						if (strpos(self::NUMBERS, $charArray['letter']) === false) {
200
-							// This is not a digit. End the run of digits and punctuation.
201
-							$numberState = false;
202
-							if (self::$currentState == 'RTL') {
203
-								if (strpos(self::NUMBER_PREFIX, $currentLetter) === false) {
204
-									$currentLetter = WT_UTF8_PDF . $currentLetter;
205
-								} else {
206
-									$currentLetter = $currentLetter . WT_UTF8_PDF; // Include a trailing + or - in the run
191
+							// This is not a digit. Is it numeric punctuation?
192
+							if (substr($workingText . "\n", $offset, 6) == '&nbsp;') {
193
+								$offset += 6; // This could be numeric punctuation
194
+							} elseif (strpos(self::NUMBER_PUNCTUATION, $charArray['letter']) !== false) {
195
+								$offset += $charArray['length']; // This could be numeric punctuation
196
+							}
197
+							// If the next character is a digit, the current character is numeric punctuation
198
+							$charArray = self::getChar($workingText . "\n", $offset);
199
+							if (strpos(self::NUMBERS, $charArray['letter']) === false) {
200
+								// This is not a digit. End the run of digits and punctuation.
201
+								$numberState = false;
202
+								if (self::$currentState == 'RTL') {
203
+									if (strpos(self::NUMBER_PREFIX, $currentLetter) === false) {
204
+										$currentLetter = WT_UTF8_PDF . $currentLetter;
205
+									} else {
206
+										$currentLetter = $currentLetter . WT_UTF8_PDF; // Include a trailing + or - in the run
207
+									}
207 208
 								}
208 209
 							}
209 210
 						}
210
-					}
211
-				} else {
212
-					// If we're outside a numeric string, look for reasons to start it
213
-					if (strpos(self::NUMBER_PREFIX, $currentLetter) !== false) {
214
-						// This might be a number lead-in
215
-						$offset   = $currentLen;
216
-						$nextChar = substr($workingText . "\n", $offset, 1);
217
-						if (strpos(self::NUMBERS, $nextChar) !== false) {
218
-							$numberState = true; // We found a digit: the lead-in is therefore numeric
211
+					} else {
212
+						// If we're outside a numeric string, look for reasons to start it
213
+						if (strpos(self::NUMBER_PREFIX, $currentLetter) !== false) {
214
+							// This might be a number lead-in
215
+							$offset   = $currentLen;
216
+							$nextChar = substr($workingText . "\n", $offset, 1);
217
+							if (strpos(self::NUMBERS, $nextChar) !== false) {
218
+								$numberState = true; // We found a digit: the lead-in is therefore numeric
219
+								if (self::$currentState == 'RTL') {
220
+									$currentLetter = WT_UTF8_LRE . $currentLetter;
221
+								}
222
+							}
223
+						} elseif (strpos(self::NUMBERS, $currentLetter) !== false) {
224
+							$numberState = true; // The current letter is a digit
219 225
 							if (self::$currentState == 'RTL') {
220 226
 								$currentLetter = WT_UTF8_LRE . $currentLetter;
221 227
 							}
222 228
 						}
223
-					} elseif (strpos(self::NUMBERS, $currentLetter) !== false) {
224
-						$numberState = true; // The current letter is a digit
225
-						if (self::$currentState == 'RTL') {
226
-							$currentLetter = WT_UTF8_LRE . $currentLetter;
227
-						}
228 229
 					}
229
-				}
230
-
231
-				// Determine the directionality of the current UTF-8 character
232
-				$newState = self::$currentState;
233
-				while (true) {
234
-					if (I18N::scriptDirection(I18N::textScript($currentLetter)) === 'rtl') {
235
-						if (self::$currentState == '') {
236
-							$newState = 'RTL';
237
-							break;
238
-						}
239 230
 
240
-						if (self::$currentState == 'RTL') {
241
-							break;
242
-						}
243
-						// Switch to RTL only if this isn't a solitary RTL letter
244
-						$tempText = substr($workingText, $currentLen);
245
-						while ($tempText != '') {
246
-							$nextCharArray = self::getChar($tempText, 0);
247
-							$nextLetter    = $nextCharArray['letter'];
248
-							$nextLen       = $nextCharArray['length'];
249
-							$tempText      = substr($tempText, $nextLen);
250
-
251
-							if (I18N::scriptDirection(I18N::textScript($nextLetter)) === 'rtl') {
231
+					// Determine the directionality of the current UTF-8 character
232
+					$newState = self::$currentState;
233
+					while (true) {
234
+						if (I18N::scriptDirection(I18N::textScript($currentLetter)) === 'rtl') {
235
+							if (self::$currentState == '') {
252 236
 								$newState = 'RTL';
253
-								break 2;
237
+								break;
254 238
 							}
255 239
 
256
-							if (strpos(self::PUNCTUATION, $nextLetter) !== false || strpos(self::OPEN_PARENTHESES, $nextLetter) !== false) {
257
-								$newState = 'RTL';
258
-								break 2;
240
+							if (self::$currentState == 'RTL') {
241
+								break;
259 242
 							}
243
+							// Switch to RTL only if this isn't a solitary RTL letter
244
+							$tempText = substr($workingText, $currentLen);
245
+							while ($tempText != '') {
246
+								$nextCharArray = self::getChar($tempText, 0);
247
+								$nextLetter    = $nextCharArray['letter'];
248
+								$nextLen       = $nextCharArray['length'];
249
+								$tempText      = substr($tempText, $nextLen);
250
+
251
+								if (I18N::scriptDirection(I18N::textScript($nextLetter)) === 'rtl') {
252
+									$newState = 'RTL';
253
+									break 2;
254
+								}
260 255
 
261
-							if ($nextLetter === ' ') {
262
-								break;
256
+								if (strpos(self::PUNCTUATION, $nextLetter) !== false || strpos(self::OPEN_PARENTHESES, $nextLetter) !== false) {
257
+									$newState = 'RTL';
258
+									break 2;
259
+								}
260
+
261
+								if ($nextLetter === ' ') {
262
+									break;
263
+								}
264
+								$nextLetter .= substr($tempText . "\n", 0, 5);
265
+								if ($nextLetter === '&nbsp;') {
266
+									break;
267
+								}
263 268
 							}
264
-							$nextLetter .= substr($tempText . "\n", 0, 5);
265
-							if ($nextLetter === '&nbsp;') {
266
-								break;
269
+							// This is a solitary RTL letter : wrap it in UTF8 control codes to force LTR directionality
270
+							$currentLetter = WT_UTF8_LRO . $currentLetter . WT_UTF8_PDF;
271
+							$newState      = 'LTR';
272
+							break;
273
+						}
274
+						if (($currentLen != 1) || ($currentLetter >= 'A' && $currentLetter <= 'Z') || ($currentLetter >= 'a' && $currentLetter <= 'z')) {
275
+							// Since it’s neither Hebrew nor Arabic, this UTF-8 character or ASCII letter must be LTR
276
+							$newState = 'LTR';
277
+							break;
278
+						}
279
+						if ($closeParIndex !== false) {
280
+							// This closing parenthesis has to inherit the matching opening parenthesis' directionality
281
+							if (!empty($openParDirection[$closeParIndex]) && $openParDirection[$closeParIndex] != '?') {
282
+								$newState = $openParDirection[$closeParIndex];
267 283
 							}
284
+							$openParDirection[$closeParIndex] = '';
285
+							break;
268 286
 						}
269
-						// This is a solitary RTL letter : wrap it in UTF8 control codes to force LTR directionality
270
-						$currentLetter = WT_UTF8_LRO . $currentLetter . WT_UTF8_PDF;
271
-						$newState      = 'LTR';
272
-						break;
273
-					}
274
-					if (($currentLen != 1) || ($currentLetter >= 'A' && $currentLetter <= 'Z') || ($currentLetter >= 'a' && $currentLetter <= 'z')) {
275
-						// Since it’s neither Hebrew nor Arabic, this UTF-8 character or ASCII letter must be LTR
276
-						$newState = 'LTR';
277
-						break;
278
-					}
279
-					if ($closeParIndex !== false) {
280
-						// This closing parenthesis has to inherit the matching opening parenthesis' directionality
281
-						if (!empty($openParDirection[$closeParIndex]) && $openParDirection[$closeParIndex] != '?') {
282
-							$newState = $openParDirection[$closeParIndex];
287
+						if ($openParIndex !== false) {
288
+							// Opening parentheses always inherit the following directionality
289
+							self::$waitingText .= $currentLetter;
290
+							$workingText = substr($workingText, $currentLen);
291
+							while (true) {
292
+								if ($workingText === '') {
293
+									break;
294
+								}
295
+								if (substr($workingText, 0, 1) === ' ') {
296
+									// Spaces following this left parenthesis inherit the following directionality too
297
+									self::$waitingText .= ' ';
298
+									$workingText = substr($workingText, 1);
299
+									continue;
300
+								}
301
+								if (substr($workingText, 0, 6) === '&nbsp;') {
302
+									// Spaces following this left parenthesis inherit the following directionality too
303
+									self::$waitingText .= '&nbsp;';
304
+									$workingText = substr($workingText, 6);
305
+									continue;
306
+								}
307
+								break;
308
+							}
309
+							$openParDirection[$openParIndex] = '?';
310
+							break 2; // double break because we're waiting for more information
283 311
 						}
284
-						$openParDirection[$closeParIndex] = '';
285
-						break;
286
-					}
287
-					if ($openParIndex !== false) {
288
-						// Opening parentheses always inherit the following directionality
312
+
313
+						// We have a digit or a "normal" special character.
314
+						//
315
+						// When this character is not at the start of the input string, it inherits the preceding directionality;
316
+						// at the start of the input string, it assumes the following directionality.
317
+						//
318
+						// Exceptions to this rule will be handled later during final clean-up.
319
+						//
289 320
 						self::$waitingText .= $currentLetter;
290 321
 						$workingText = substr($workingText, $currentLen);
291
-						while (true) {
292
-							if ($workingText === '') {
293
-								break;
294
-							}
295
-							if (substr($workingText, 0, 1) === ' ') {
296
-								// Spaces following this left parenthesis inherit the following directionality too
297
-								self::$waitingText .= ' ';
298
-								$workingText = substr($workingText, 1);
299
-								continue;
300
-							}
301
-							if (substr($workingText, 0, 6) === '&nbsp;') {
302
-								// Spaces following this left parenthesis inherit the following directionality too
303
-								self::$waitingText .= '&nbsp;';
304
-								$workingText = substr($workingText, 6);
305
-								continue;
306
-							}
307
-							break;
322
+						if (self::$currentState != '') {
323
+							$result .= self::$waitingText;
324
+							self::$waitingText = '';
308 325
 						}
309
-						$openParDirection[$openParIndex] = '?';
310 326
 						break 2; // double break because we're waiting for more information
311 327
 					}
312
-
313
-					// We have a digit or a "normal" special character.
314
-					//
315
-					// When this character is not at the start of the input string, it inherits the preceding directionality;
316
-					// at the start of the input string, it assumes the following directionality.
317
-					//
318
-					// Exceptions to this rule will be handled later during final clean-up.
319
-					//
328
+					if ($newState != self::$currentState) {
329
+						// A direction change has occurred
330
+						self::finishCurrentSpan($result, false);
331
+						self::$previousState = self::$currentState;
332
+						self::$currentState  = $newState;
333
+						self::beginCurrentSpan($result);
334
+					}
320 335
 					self::$waitingText .= $currentLetter;
321 336
 					$workingText = substr($workingText, $currentLen);
322
-					if (self::$currentState != '') {
323
-						$result .= self::$waitingText;
324
-						self::$waitingText = '';
325
-					}
326
-					break 2; // double break because we're waiting for more information
327
-				}
328
-				if ($newState != self::$currentState) {
329
-					// A direction change has occurred
330
-					self::finishCurrentSpan($result, false);
331
-					self::$previousState = self::$currentState;
332
-					self::$currentState  = $newState;
333
-					self::beginCurrentSpan($result);
334
-				}
335
-				self::$waitingText .= $currentLetter;
336
-				$workingText = substr($workingText, $currentLen);
337
-				$result .= self::$waitingText;
338
-				self::$waitingText = '';
337
+					$result .= self::$waitingText;
338
+					self::$waitingText = '';
339 339
 
340
-				foreach ($openParDirection as $index => $value) {
341
-					// Since we now know the proper direction, remember it for all waiting opening parentheses
342
-					if ($value === '?') {
343
-						$openParDirection[$index] = self::$currentState;
340
+					foreach ($openParDirection as $index => $value) {
341
+						// Since we now know the proper direction, remember it for all waiting opening parentheses
342
+						if ($value === '?') {
343
+							$openParDirection[$index] = self::$currentState;
344
+						}
344 345
 					}
345
-				}
346 346
 
347
-				break;
347
+					break;
348 348
 			}
349 349
 		}
350 350
 
@@ -461,34 +461,34 @@  discard block
 block discarded – undo
461 461
 
462 462
 		// Finally, correct '<LTR>', '</LTR>', '<RTL>', and '</RTL>'
463 463
 		switch ($direction) {
464
-		case 'BOTH':
465
-		case 'both':
466
-			// LTR text: <span dir="ltr"> text </span>
467
-			// RTL text: <span dir="rtl"> text </span>
468
-			$sLTR = '<span dir="ltr" ' . $class . '>' . $nothing;
469
-			$eLTR = $nothing . '</span>';
470
-			$sRTL = '<span dir="rtl" ' . $class . '>' . $nothing;
471
-			$eRTL = $nothing . '</span>';
472
-			break;
473
-		case 'LTR':
474
-		case 'ltr':
475
-			// LTR text: <span dir="ltr"> text </span>
476
-			// RTL text: text
477
-			$sLTR = '<span dir="ltr" ' . $class . '>' . $nothing;
478
-			$eLTR = $nothing . '</span>';
479
-			$sRTL = '';
480
-			$eRTL = '';
481
-			break;
482
-		case 'RTL':
483
-		case 'rtl':
484
-		default:
485
-			// LTR text: text
486
-			// RTL text: <span dir="rtl"> text </span>
487
-			$sLTR = '';
488
-			$eLTR = '';
489
-			$sRTL = '<span dir="rtl" ' . $class . '>' . $nothing;
490
-			$eRTL = $nothing . '</span>';
491
-			break;
464
+			case 'BOTH':
465
+			case 'both':
466
+				// LTR text: <span dir="ltr"> text </span>
467
+				// RTL text: <span dir="rtl"> text </span>
468
+				$sLTR = '<span dir="ltr" ' . $class . '>' . $nothing;
469
+				$eLTR = $nothing . '</span>';
470
+				$sRTL = '<span dir="rtl" ' . $class . '>' . $nothing;
471
+				$eRTL = $nothing . '</span>';
472
+				break;
473
+			case 'LTR':
474
+			case 'ltr':
475
+				// LTR text: <span dir="ltr"> text </span>
476
+				// RTL text: text
477
+				$sLTR = '<span dir="ltr" ' . $class . '>' . $nothing;
478
+				$eLTR = $nothing . '</span>';
479
+				$sRTL = '';
480
+				$eRTL = '';
481
+				break;
482
+			case 'RTL':
483
+			case 'rtl':
484
+			default:
485
+				// LTR text: text
486
+				// RTL text: <span dir="rtl"> text </span>
487
+				$sLTR = '';
488
+				$eLTR = '';
489
+				$sRTL = '<span dir="rtl" ' . $class . '>' . $nothing;
490
+				$eRTL = $nothing . '</span>';
491
+				break;
492 492
 		}
493 493
 		$result = str_replace([self::$startLTR, self::$endLTR, self::$startRTL, self::$endRTL], [$sLTR, $eLTR, $sRTL, $eRTL], $result);
494 494
 
Please login to merge, or discard this patch.
app/Functions/FunctionsPrintLists.php 1 patch
Switch Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -1395,37 +1395,37 @@  discard block
 block discarded – undo
1395 1395
 			$html[] = $subhtml;
1396 1396
 		}
1397 1397
 		switch ($style) {
1398
-		case 1:
1399
-			return '<ul><li>' . implode('</li><li>', $html) . '</li></ul>';
1400
-		case 2:
1401
-			return implode(I18N::$list_separator, $html);
1402
-		case 3:
1403
-			$i     = 0;
1404
-			$count = count($html);
1405
-			if ($count > 36) {
1406
-				$col = 4;
1407
-			} elseif ($count > 18) {
1408
-				$col = 3;
1409
-			} elseif ($count > 6) {
1410
-				$col = 2;
1411
-			} else {
1412
-				$col = 1;
1413
-			}
1414
-			$newcol = ceil($count / $col);
1415
-			$html2  = '<table class="list_table"><tr>';
1416
-			$html2 .= '<td class="list_value" style="padding: 14px;">';
1417
-
1418
-			foreach ($html as $surns) {
1419
-				$html2 .= $surns . '<br>';
1420
-				$i++;
1421
-				if ($i == $newcol && $i < $count) {
1422
-					$html2 .= '</td><td class="list_value" style="padding: 14px;">';
1423
-					$newcol = $i + ceil($count / $col);
1398
+			case 1:
1399
+				return '<ul><li>' . implode('</li><li>', $html) . '</li></ul>';
1400
+			case 2:
1401
+				return implode(I18N::$list_separator, $html);
1402
+			case 3:
1403
+				$i     = 0;
1404
+				$count = count($html);
1405
+				if ($count > 36) {
1406
+					$col = 4;
1407
+				} elseif ($count > 18) {
1408
+					$col = 3;
1409
+				} elseif ($count > 6) {
1410
+					$col = 2;
1411
+				} else {
1412
+					$col = 1;
1424 1413
 				}
1425
-			}
1426
-			$html2 .= '</td></tr></table>';
1414
+				$newcol = ceil($count / $col);
1415
+				$html2  = '<table class="list_table"><tr>';
1416
+				$html2 .= '<td class="list_value" style="padding: 14px;">';
1417
+
1418
+				foreach ($html as $surns) {
1419
+					$html2 .= $surns . '<br>';
1420
+					$i++;
1421
+					if ($i == $newcol && $i < $count) {
1422
+						$html2 .= '</td><td class="list_value" style="padding: 14px;">';
1423
+						$newcol = $i + ceil($count / $col);
1424
+					}
1425
+				}
1426
+				$html2 .= '</td></tr></table>';
1427 1427
 
1428
-			return $html2;
1428
+				return $html2;
1429 1429
 		}
1430 1430
 	}
1431 1431
 	/**
@@ -1602,14 +1602,14 @@  discard block
 block discarded – undo
1602 1602
 
1603 1603
 		// Now we've filtered the list, we can sort by event, if required
1604 1604
 		switch ($sort_by) {
1605
-		case 'anniv':
1606
-			// Data is already sorted by anniversary date
1607
-			break;
1608
-		case 'alpha':
1609
-			uasort($filtered_events, function (Fact $x, Fact $y) {
1610
-				return GedcomRecord::compare($x->getParent(), $y->getParent());
1611
-			});
1612
-			break;
1605
+			case 'anniv':
1606
+				// Data is already sorted by anniversary date
1607
+				break;
1608
+			case 'alpha':
1609
+				uasort($filtered_events, function (Fact $x, Fact $y) {
1610
+					return GedcomRecord::compare($x->getParent(), $y->getParent());
1611
+				});
1612
+				break;
1613 1613
 		}
1614 1614
 
1615 1615
 		foreach ($filtered_events as $fact) {
Please login to merge, or discard this patch.
app/Functions/FunctionsExport.php 1 patch
Switch Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -183,18 +183,18 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public static function exportGedcom(Tree $tree, $gedout, $exportOptions) {
185 185
 		switch ($exportOptions['privatize']) {
186
-		case 'gedadmin':
187
-			$access_level = Auth::PRIV_NONE;
188
-			break;
189
-		case 'user':
190
-			$access_level = Auth::PRIV_USER;
191
-			break;
192
-		case 'visitor':
193
-			$access_level = Auth::PRIV_PRIVATE;
194
-			break;
195
-		case 'none':
196
-			$access_level = Auth::PRIV_HIDE;
197
-			break;
186
+			case 'gedadmin':
187
+				$access_level = Auth::PRIV_NONE;
188
+				break;
189
+			case 'user':
190
+				$access_level = Auth::PRIV_USER;
191
+				break;
192
+			case 'visitor':
193
+				$access_level = Auth::PRIV_PRIVATE;
194
+				break;
195
+			case 'none':
196
+				$access_level = Auth::PRIV_HIDE;
197
+				break;
198 198
 		}
199 199
 
200 200
 		$head = self::gedcomHeader($tree);
@@ -251,15 +251,15 @@  discard block
 block discarded – undo
251 251
 
252 252
 		foreach ($rows as $row) {
253 253
 			switch ($row->type) {
254
-			case 'NOTE':
255
-				$record = Note::getInstance($row->xref, $tree, $row->gedcom);
256
-				break;
257
-			case 'REPO':
258
-				$record = Repository::getInstance($row->xref, $tree, $row->gedcom);
259
-				break;
260
-			default:
261
-				$record = GedcomRecord::getInstance($row->xref, $tree, $row->gedcom);
262
-				break;
254
+				case 'NOTE':
255
+					$record = Note::getInstance($row->xref, $tree, $row->gedcom);
256
+					break;
257
+				case 'REPO':
258
+					$record = Repository::getInstance($row->xref, $tree, $row->gedcom);
259
+					break;
260
+				default:
261
+					$record = GedcomRecord::getInstance($row->xref, $tree, $row->gedcom);
262
+					break;
263 263
 			}
264 264
 
265 265
 			$rec = $record->privatizeGedcom($access_level);
Please login to merge, or discard this patch.
app/Functions/FunctionsEdit.php 1 patch
Switch Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -598,21 +598,21 @@  discard block
 block discarded – undo
598 598
 
599 599
 		$row_class = 'form-group row';
600 600
 		switch ($fact) {
601
-		case 'DATA':
602
-		case 'MAP':
603
-			// These GEDCOM tags should have no data, just child tags.
604
-			if ($value === '') {
605
-				$row_class .= ' d-none';
606
-			}
607
-			break;
608
-		case 'LATI':
609
-		case 'LONG':
610
-			// Indicate that this row is a child of a previous row, so we can expand/collapse them.
611
-			$row_class .= ' child_of_' . $previous_ids['PLAC'];
612
-			if ($value === '') {
613
-				$row_class .= ' collapse';
614
-			}
615
-			break;
601
+			case 'DATA':
602
+			case 'MAP':
603
+				// These GEDCOM tags should have no data, just child tags.
604
+				if ($value === '') {
605
+					$row_class .= ' d-none';
606
+				}
607
+				break;
608
+			case 'LATI':
609
+			case 'LONG':
610
+				// Indicate that this row is a child of a previous row, so we can expand/collapse them.
611
+				$row_class .= ' child_of_' . $previous_ids['PLAC'];
612
+				if ($value === '') {
613
+					$row_class .= ' collapse';
614
+				}
615
+				break;
616 616
 		}
617 617
 
618 618
 		$html = '';
@@ -634,16 +634,16 @@  discard block
 block discarded – undo
634 634
 		} else {
635 635
 			// Not all facts have help text.
636 636
 			switch ($fact) {
637
-			case 'NAME':
638
-				if ($upperlevel !== 'REPO' && $upperlevel !== 'UNKNOWN') {
637
+				case 'NAME':
638
+					if ($upperlevel !== 'REPO' && $upperlevel !== 'UNKNOWN') {
639
+						$html .= FunctionsPrint::helpLink($fact);
640
+					}
641
+					break;
642
+				case 'ROMN':
643
+				case 'SURN':
644
+				case '_HEB':
639 645
 					$html .= FunctionsPrint::helpLink($fact);
640
-				}
641
-				break;
642
-			case 'ROMN':
643
-			case 'SURN':
644
-			case '_HEB':
645
-				$html .= FunctionsPrint::helpLink($fact);
646
-				break;
646
+					break;
647 647
 			}
648 648
 		}
649 649
 		// tag level
@@ -848,25 +848,25 @@  discard block
 block discarded – undo
848 848
 
849 849
 		// popup links
850 850
 		switch ($fact) {
851
-		case 'SOUR':
852
-			//-- checkboxes to apply '1 SOUR' to BIRT/MARR/DEAT as '2 SOUR'
853
-			if ($level === '1') {
854
-				$html .= '<br>';
855
-				switch ($WT_TREE->getPreference('PREFER_LEVEL2_SOURCES')) {
856
-				case '2': // records
857
-				$level1_checked = 'checked';
858
-				$level2_checked = '';
859
-				break;
860
-				case '1': // facts
861
-				$level1_checked = '';
862
-				$level2_checked = 'checked';
863
-				break;
864
-				case '0': // none
865
-				default:
866
-				$level1_checked = '';
867
-				$level2_checked = '';
868
-				break;
869
-				}
851
+			case 'SOUR':
852
+				//-- checkboxes to apply '1 SOUR' to BIRT/MARR/DEAT as '2 SOUR'
853
+				if ($level === '1') {
854
+					$html .= '<br>';
855
+					switch ($WT_TREE->getPreference('PREFER_LEVEL2_SOURCES')) {
856
+						case '2': // records
857
+						$level1_checked = 'checked';
858
+						$level2_checked = '';
859
+						break;
860
+						case '1': // facts
861
+						$level1_checked = '';
862
+						$level2_checked = 'checked';
863
+						break;
864
+						case '0': // none
865
+						default:
866
+						$level1_checked = '';
867
+						$level2_checked = '';
868
+						break;
869
+					}
870 870
 				if (strpos($bdm, 'B') !== false) {
871 871
 					$html .= ' <label><input type="checkbox" name="SOUR_INDI" ' . $level1_checked . ' value="1">' . I18N::translate('Individual') . '</label>';
872 872
 					if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) {
@@ -923,29 +923,29 @@  discard block
 block discarded – undo
923 923
 
924 924
 		// Show more likely census details at the top of the list.
925 925
 		switch ($locale) {
926
-		case 'cs':
927
-			$census_places = [new CensusOfCzechRepublic];
928
-			break;
929
-		case 'en-AU':
930
-		case 'en-GB':
931
-			$census_places = [new CensusOfEngland, new CensusOfWales, new CensusOfScotland];
932
-			break;
933
-		case 'en-US':
934
-			$census_places = [new CensusOfUnitedStates];
935
-			break;
936
-		case 'fr':
937
-		case 'fr-CA':
938
-			$census_places = [new CensusOfFrance];
939
-			break;
940
-		case 'da':
941
-			$census_places = [new CensusOfDenmark];
942
-			break;
943
-		case 'de':
944
-			$census_places = [new CensusOfDeutschland];
945
-			break;
946
-		default:
947
-			$census_places = [];
948
-			break;
926
+			case 'cs':
927
+				$census_places = [new CensusOfCzechRepublic];
928
+				break;
929
+			case 'en-AU':
930
+			case 'en-GB':
931
+				$census_places = [new CensusOfEngland, new CensusOfWales, new CensusOfScotland];
932
+				break;
933
+			case 'en-US':
934
+				$census_places = [new CensusOfUnitedStates];
935
+				break;
936
+			case 'fr':
937
+			case 'fr-CA':
938
+				$census_places = [new CensusOfFrance];
939
+				break;
940
+			case 'da':
941
+				$census_places = [new CensusOfDenmark];
942
+				break;
943
+			case 'de':
944
+				$census_places = [new CensusOfDeutschland];
945
+				break;
946
+			default:
947
+				$census_places = [];
948
+				break;
949 949
 		}
950 950
 		foreach (Census::allCensusPlaces() as $census_place) {
951 951
 			if (!in_array($census_place, $census_places)) {
@@ -992,46 +992,46 @@  discard block
 block discarded – undo
992 992
 		global $WT_TREE;
993 993
 
994 994
 		switch ($tag) {
995
-		case 'SOUR':
996
-			echo View::make('cards/add-source-citation', [
997
-				'level'          => $level,
998
-				'full_citations' => $WT_TREE->getPreference('FULL_SOURCES'),
999
-			]);
1000
-			break;
1001
-
1002
-		case 'ASSO':
1003
-		case 'ASSO2':
1004
-			echo View::make('cards/add-associate', [
1005
-				'level' => $level,
1006
-			]);
1007
-			break;
1008
-
1009
-		case 'NOTE':
1010
-			echo View::make('cards/add-note', [
1011
-				'level' => $level,
1012
-			]);
1013
-			break;
1014
-
1015
-		case 'SHARED_NOTE':
1016
-			echo View::make('cards/add-shared-note', [
1017
-				'level'      => $level,
1018
-				'parent_tag' => $parent_tag,
1019
-			]);
1020
-			break;
1021
-
1022
-		case 'OBJE':
1023
-			if ($WT_TREE->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($WT_TREE)) {
1024
-				echo View::make('cards/add-media-object', [
995
+			case 'SOUR':
996
+				echo View::make('cards/add-source-citation', [
997
+					'level'          => $level,
998
+					'full_citations' => $WT_TREE->getPreference('FULL_SOURCES'),
999
+				]);
1000
+				break;
1001
+
1002
+			case 'ASSO':
1003
+			case 'ASSO2':
1004
+				echo View::make('cards/add-associate', [
1025 1005
 					'level' => $level,
1026 1006
 				]);
1027
-			}
1028
-			break;
1007
+				break;
1008
+
1009
+			case 'NOTE':
1010
+				echo View::make('cards/add-note', [
1011
+					'level' => $level,
1012
+				]);
1013
+				break;
1014
+
1015
+			case 'SHARED_NOTE':
1016
+				echo View::make('cards/add-shared-note', [
1017
+					'level'      => $level,
1018
+					'parent_tag' => $parent_tag,
1019
+				]);
1020
+				break;
1021
+
1022
+			case 'OBJE':
1023
+				if ($WT_TREE->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($WT_TREE)) {
1024
+					echo View::make('cards/add-media-object', [
1025
+						'level' => $level,
1026
+					]);
1027
+				}
1028
+				break;
1029 1029
 
1030
-		case 'RESN':
1031
-			echo View::make('cards/add-restriction', [
1032
-				'level' => $level,
1033
-			]);
1034
-			break;
1030
+			case 'RESN':
1031
+				echo View::make('cards/add-restriction', [
1032
+					'level' => $level,
1033
+				]);
1034
+				break;
1035 1035
 		}
1036 1036
 	}
1037 1037
 
@@ -1107,12 +1107,12 @@  discard block
 block discarded – undo
1107 1107
 	 */
1108 1108
 	public static function addNewSex() {
1109 1109
 		switch (Filter::post('SEX', '[MF]', 'U')) {
1110
-		case 'M':
1111
-			return "\n1 SEX M";
1112
-		case 'F':
1113
-			return "\n1 SEX F";
1114
-		default:
1115
-			return "\n1 SEX U";
1110
+			case 'M':
1111
+				return "\n1 SEX M";
1112
+			case 'F':
1113
+				return "\n1 SEX F";
1114
+			default:
1115
+				return "\n1 SEX U";
1116 1116
 		}
1117 1117
 	}
1118 1118
 
@@ -1634,43 +1634,43 @@  discard block
 block discarded – undo
1634 1634
 				}
1635 1635
 				// Add level 3/4 tags as appropriate
1636 1636
 				switch ($key) {
1637
-				case 'PLAC':
1638
-					if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('ADVANCED_PLAC_FACTS'), $match)) {
1639
-						foreach ($match[1] as $tag) {
1640
-							echo self::addSimpleTag('3 ' . $tag, '', GedcomTag::getLabel($level1tag . ':PLAC:' . $tag));
1637
+					case 'PLAC':
1638
+						if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('ADVANCED_PLAC_FACTS'), $match)) {
1639
+							foreach ($match[1] as $tag) {
1640
+								echo self::addSimpleTag('3 ' . $tag, '', GedcomTag::getLabel($level1tag . ':PLAC:' . $tag));
1641
+							}
1641 1642
 						}
1642
-					}
1643
-					echo self::addSimpleTag('3 MAP');
1644
-					echo self::addSimpleTag('4 LATI');
1645
-					echo self::addSimpleTag('4 LONG');
1646
-					break;
1647
-				case 'FILE':
1648
-					echo self::addSimpleTag('3 FORM');
1649
-					break;
1650
-				case 'EVEN':
1651
-					echo self::addSimpleTag('3 DATE');
1652
-					echo self::addSimpleTag('3 PLAC');
1653
-					break;
1654
-				case 'STAT':
1655
-					if (GedcomCodeTemp::isTagLDS($level1tag)) {
1656
-						echo self::addSimpleTag('3 DATE', '', GedcomTag::getLabel('STAT:DATE'));
1657
-					}
1658
-					break;
1659
-				case 'DATE':
1660
-					// TIME is NOT a valid 5.5.1 tag
1661
-					if (in_array($level1tag, Config::dateAndTime())) {
1662
-						echo self::addSimpleTag('3 TIME');
1663
-					}
1664
-					break;
1665
-				case 'HUSB':
1666
-				case 'WIFE':
1667
-					echo self::addSimpleTag('3 AGE');
1668
-					break;
1669
-				case 'FAMC':
1670
-					if ($level1tag === 'ADOP') {
1671
-						echo self::addSimpleTag('3 ADOP BOTH');
1672
-					}
1673
-					break;
1643
+						echo self::addSimpleTag('3 MAP');
1644
+						echo self::addSimpleTag('4 LATI');
1645
+						echo self::addSimpleTag('4 LONG');
1646
+						break;
1647
+					case 'FILE':
1648
+						echo self::addSimpleTag('3 FORM');
1649
+						break;
1650
+					case 'EVEN':
1651
+						echo self::addSimpleTag('3 DATE');
1652
+						echo self::addSimpleTag('3 PLAC');
1653
+						break;
1654
+					case 'STAT':
1655
+						if (GedcomCodeTemp::isTagLDS($level1tag)) {
1656
+							echo self::addSimpleTag('3 DATE', '', GedcomTag::getLabel('STAT:DATE'));
1657
+						}
1658
+						break;
1659
+					case 'DATE':
1660
+						// TIME is NOT a valid 5.5.1 tag
1661
+						if (in_array($level1tag, Config::dateAndTime())) {
1662
+							echo self::addSimpleTag('3 TIME');
1663
+						}
1664
+						break;
1665
+					case 'HUSB':
1666
+					case 'WIFE':
1667
+						echo self::addSimpleTag('3 AGE');
1668
+						break;
1669
+					case 'FAMC':
1670
+						if ($level1tag === 'ADOP') {
1671
+							echo self::addSimpleTag('3 ADOP BOTH');
1672
+						}
1673
+						break;
1674 1674
 				}
1675 1675
 			} elseif ($key === 'DATE' && $add_date) {
1676 1676
 				echo self::addSimpleTag('2 DATE', $level1tag, GedcomTag::getLabel($level1tag . ':DATE'));
Please login to merge, or discard this patch.