@@ -23,7 +23,8 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * A GEDCOM object. |
25 | 25 | */ |
26 | -class GedcomRecord { |
|
26 | +class GedcomRecord |
|
27 | +{ |
|
27 | 28 | const RECORD_TYPE = 'UNKNOWN'; |
28 | 29 | const URL_PREFIX = 'gedrecord.php?pid='; |
29 | 30 | |
@@ -75,7 +76,8 @@ discard block |
||
75 | 76 | * empty string for records with pending deletions |
76 | 77 | * @param Tree $tree |
77 | 78 | */ |
78 | - public function __construct($xref, $gedcom, $pending, $tree) { |
|
79 | + public function __construct($xref, $gedcom, $pending, $tree) |
|
80 | + { |
|
79 | 81 | $this->xref = $xref; |
80 | 82 | $this->gedcom = $gedcom; |
81 | 83 | $this->pending = $pending; |
@@ -87,7 +89,8 @@ discard block |
||
87 | 89 | /** |
88 | 90 | * Split the record into facts |
89 | 91 | */ |
90 | - private function parseFacts() { |
|
92 | + private function parseFacts() |
|
93 | + { |
|
91 | 94 | // Split the record into facts |
92 | 95 | if ($this->gedcom) { |
93 | 96 | $gedcom_facts = preg_split('/\n(?=1)/s', $this->gedcom); |
@@ -133,7 +136,8 @@ discard block |
||
133 | 136 | * |
134 | 137 | * @return GedcomRecord|Individual|Family|Source|Repository|Media|Note|null |
135 | 138 | */ |
136 | - public static function getInstance($xref, Tree $tree, $gedcom = null) { |
|
139 | + public static function getInstance($xref, Tree $tree, $gedcom = null) |
|
140 | + { |
|
137 | 141 | $tree_id = $tree->getTreeId(); |
138 | 142 | |
139 | 143 | // Is this record already in the cache, and of the correct type? |
@@ -235,7 +239,8 @@ discard block |
||
235 | 239 | * |
236 | 240 | * @return null|string |
237 | 241 | */ |
238 | - protected static function fetchGedcomRecord($xref, $tree_id) { |
|
242 | + protected static function fetchGedcomRecord($xref, $tree_id) |
|
243 | + { |
|
239 | 244 | // We don't know what type of object this is. Try each one in turn. |
240 | 245 | $data = Individual::fetchGedcomRecord($xref, $tree_id); |
241 | 246 | if ($data) { |
@@ -276,7 +281,8 @@ discard block |
||
276 | 281 | * |
277 | 282 | * @return string |
278 | 283 | */ |
279 | - public function getXref() { |
|
284 | + public function getXref() |
|
285 | + { |
|
280 | 286 | return $this->xref; |
281 | 287 | } |
282 | 288 | |
@@ -285,7 +291,8 @@ discard block |
||
285 | 291 | * |
286 | 292 | * @return Tree |
287 | 293 | */ |
288 | - public function getTree() { |
|
294 | + public function getTree() |
|
295 | + { |
|
289 | 296 | return $this->tree; |
290 | 297 | } |
291 | 298 | |
@@ -295,7 +302,8 @@ discard block |
||
295 | 302 | * |
296 | 303 | * @return string |
297 | 304 | */ |
298 | - public function getGedcom() { |
|
305 | + public function getGedcom() |
|
306 | + { |
|
299 | 307 | if ($this->pending === null) { |
300 | 308 | return $this->gedcom; |
301 | 309 | } else { |
@@ -308,7 +316,8 @@ discard block |
||
308 | 316 | * |
309 | 317 | * @return bool |
310 | 318 | */ |
311 | - public function isPendingAddtion() { |
|
319 | + public function isPendingAddtion() |
|
320 | + { |
|
312 | 321 | return $this->pending !== null; |
313 | 322 | } |
314 | 323 | |
@@ -317,7 +326,8 @@ discard block |
||
317 | 326 | * |
318 | 327 | * @return bool |
319 | 328 | */ |
320 | - public function isPendingDeletion() { |
|
329 | + public function isPendingDeletion() |
|
330 | + { |
|
321 | 331 | return $this->pending === ''; |
322 | 332 | } |
323 | 333 | |
@@ -326,7 +336,8 @@ discard block |
||
326 | 336 | * |
327 | 337 | * @return string |
328 | 338 | */ |
329 | - public function getHtmlUrl() { |
|
339 | + public function getHtmlUrl() |
|
340 | + { |
|
330 | 341 | return $this->getLinkUrl('&'); |
331 | 342 | } |
332 | 343 | |
@@ -335,7 +346,8 @@ discard block |
||
335 | 346 | * |
336 | 347 | * @return string |
337 | 348 | */ |
338 | - public function getRawUrl() { |
|
349 | + public function getRawUrl() |
|
350 | + { |
|
339 | 351 | return $this->getLinkUrl('&'); |
340 | 352 | } |
341 | 353 | |
@@ -344,7 +356,8 @@ discard block |
||
344 | 356 | * |
345 | 357 | * @return string |
346 | 358 | */ |
347 | - public function getAbsoluteLinkUrl() { |
|
359 | + public function getAbsoluteLinkUrl() |
|
360 | + { |
|
348 | 361 | return WT_BASE_URL . $this->getHtmlUrl(); |
349 | 362 | } |
350 | 363 | |
@@ -355,7 +368,8 @@ discard block |
||
355 | 368 | * |
356 | 369 | * @return string |
357 | 370 | */ |
358 | - private function getLinkUrl($separator) { |
|
371 | + private function getLinkUrl($separator) |
|
372 | + { |
|
359 | 373 | return static::URL_PREFIX . Filter::escapeUrl($this->getXref()) . $separator . 'ged=' . Filter::escapeUrl($this->tree->getName()); |
360 | 374 | } |
361 | 375 | |
@@ -366,7 +380,8 @@ discard block |
||
366 | 380 | * |
367 | 381 | * @return bool |
368 | 382 | */ |
369 | - private function canShowRecord($access_level) { |
|
383 | + private function canShowRecord($access_level) |
|
384 | + { |
|
370 | 385 | // This setting would better be called "$ENABLE_PRIVACY" |
371 | 386 | if (!$this->tree->getPreference('HIDE_LIVE_PEOPLE')) { |
372 | 387 | return true; |
@@ -410,7 +425,8 @@ discard block |
||
410 | 425 | * |
411 | 426 | * @return bool |
412 | 427 | */ |
413 | - protected function canShowByType($access_level) { |
|
428 | + protected function canShowByType($access_level) |
|
429 | + { |
|
414 | 430 | $fact_privacy = $this->tree->getFactPrivacy(); |
415 | 431 | |
416 | 432 | if (isset($fact_privacy[static::RECORD_TYPE])) { |
@@ -429,7 +445,8 @@ discard block |
||
429 | 445 | * |
430 | 446 | * @return bool |
431 | 447 | */ |
432 | - public function canShow($access_level = null) { |
|
448 | + public function canShow($access_level = null) |
|
449 | + { |
|
433 | 450 | if ($access_level === null) { |
434 | 451 | $access_level = Auth::accessLevel($this->tree); |
435 | 452 | } |
@@ -472,7 +489,8 @@ discard block |
||
472 | 489 | * |
473 | 490 | * @return bool |
474 | 491 | */ |
475 | - public function canShowName($access_level = null) { |
|
492 | + public function canShowName($access_level = null) |
|
493 | + { |
|
476 | 494 | if ($access_level === null) { |
477 | 495 | $access_level = Auth::accessLevel($this->tree); |
478 | 496 | } |
@@ -485,7 +503,8 @@ discard block |
||
485 | 503 | * |
486 | 504 | * @return bool |
487 | 505 | */ |
488 | - public function canEdit() { |
|
506 | + public function canEdit() |
|
507 | + { |
|
489 | 508 | return Auth::isManager($this->tree) || Auth::isEditor($this->tree) && strpos($this->gedcom, "\n1 RESN locked") === false; |
490 | 509 | } |
491 | 510 | |
@@ -497,7 +516,8 @@ discard block |
||
497 | 516 | * |
498 | 517 | * @return string |
499 | 518 | */ |
500 | - public function privatizeGedcom($access_level) { |
|
519 | + public function privatizeGedcom($access_level) |
|
520 | + { |
|
501 | 521 | if ($access_level == Auth::PRIV_HIDE) { |
502 | 522 | // We may need the original record, for example when downloading a GEDCOM or clippings cart |
503 | 523 | return $this->gedcom; |
@@ -527,7 +547,8 @@ discard block |
||
527 | 547 | * |
528 | 548 | * @return string |
529 | 549 | */ |
530 | - protected function createPrivateGedcomRecord($access_level) { |
|
550 | + protected function createPrivateGedcomRecord($access_level) |
|
551 | + { |
|
531 | 552 | return '0 @' . $this->xref . '@ ' . static::RECORD_TYPE . "\n1 NOTE " . I18N::translate('Private'); |
532 | 553 | } |
533 | 554 | |
@@ -539,7 +560,8 @@ discard block |
||
539 | 560 | * @param string $value |
540 | 561 | * @param string $gedcom |
541 | 562 | */ |
542 | - protected function addName($type, $value, $gedcom) { |
|
563 | + protected function addName($type, $value, $gedcom) |
|
564 | + { |
|
543 | 565 | $this->_getAllNames[] = array( |
544 | 566 | 'type' => $type, |
545 | 567 | 'sort' => preg_replace_callback('/([0-9]+)/', function ($matches) { return str_pad($matches[0], 10, '0', STR_PAD_LEFT); }, $value), |
@@ -561,7 +583,8 @@ discard block |
||
561 | 583 | * @param string $fact_type |
562 | 584 | * @param Fact[] $facts |
563 | 585 | */ |
564 | - protected function extractNamesFromFacts($level, $fact_type, $facts) { |
|
586 | + protected function extractNamesFromFacts($level, $fact_type, $facts) |
|
587 | + { |
|
565 | 588 | $sublevel = $level + 1; |
566 | 589 | $subsublevel = $sublevel + 1; |
567 | 590 | foreach ($facts as $fact) { |
@@ -586,7 +609,8 @@ discard block |
||
586 | 609 | /** |
587 | 610 | * Default for "other" object types |
588 | 611 | */ |
589 | - public function extractNames() { |
|
612 | + public function extractNames() |
|
613 | + { |
|
590 | 614 | $this->addName(static::RECORD_TYPE, $this->getFallBackName(), null); |
591 | 615 | } |
592 | 616 | |
@@ -595,7 +619,8 @@ discard block |
||
595 | 619 | * |
596 | 620 | * @return string[][] |
597 | 621 | */ |
598 | - public function getAllNames() { |
|
622 | + public function getAllNames() |
|
623 | + { |
|
599 | 624 | if ($this->_getAllNames === null) { |
600 | 625 | $this->_getAllNames = array(); |
601 | 626 | if ($this->canShowName()) { |
@@ -618,7 +643,8 @@ discard block |
||
618 | 643 | * |
619 | 644 | * @return string |
620 | 645 | */ |
621 | - public function getFallBackName() { |
|
646 | + public function getFallBackName() |
|
647 | + { |
|
622 | 648 | return Filter::escapeHtml($this->getXref()); |
623 | 649 | } |
624 | 650 | |
@@ -627,7 +653,8 @@ discard block |
||
627 | 653 | * |
628 | 654 | * @return int |
629 | 655 | */ |
630 | - public function getPrimaryName() { |
|
656 | + public function getPrimaryName() |
|
657 | + { |
|
631 | 658 | static $language_script; |
632 | 659 | |
633 | 660 | if ($language_script === null) { |
@@ -656,7 +683,8 @@ discard block |
||
656 | 683 | * |
657 | 684 | * @return int |
658 | 685 | */ |
659 | - public function getSecondaryName() { |
|
686 | + public function getSecondaryName() |
|
687 | + { |
|
660 | 688 | if (is_null($this->_getSecondaryName)) { |
661 | 689 | // Generally, the primary and secondary names are the same |
662 | 690 | $this->_getSecondaryName = $this->getPrimaryName(); |
@@ -681,7 +709,8 @@ discard block |
||
681 | 709 | * |
682 | 710 | * @param int $n |
683 | 711 | */ |
684 | - public function setPrimaryName($n) { |
|
712 | + public function setPrimaryName($n) |
|
713 | + { |
|
685 | 714 | $this->_getPrimaryName = $n; |
686 | 715 | $this->_getSecondaryName = null; |
687 | 716 | } |
@@ -691,7 +720,8 @@ discard block |
||
691 | 720 | * |
692 | 721 | * @return string |
693 | 722 | */ |
694 | - public function __toString() { |
|
723 | + public function __toString() |
|
724 | + { |
|
695 | 725 | return $this->xref . '@' . $this->tree->getTreeId(); |
696 | 726 | } |
697 | 727 | |
@@ -704,7 +734,8 @@ discard block |
||
704 | 734 | * |
705 | 735 | * @return int |
706 | 736 | */ |
707 | - public static function compare(GedcomRecord $x, GedcomRecord $y) { |
|
737 | + public static function compare(GedcomRecord $x, GedcomRecord $y) |
|
738 | + { |
|
708 | 739 | if ($x->canShowName()) { |
709 | 740 | if ($y->canShowName()) { |
710 | 741 | return I18N::strcasecmp($x->getSortName(), $y->getSortName()); |
@@ -725,7 +756,8 @@ discard block |
||
725 | 756 | * |
726 | 757 | * @return string |
727 | 758 | */ |
728 | - public function getFullName() { |
|
759 | + public function getFullName() |
|
760 | + { |
|
729 | 761 | if ($this->canShowName()) { |
730 | 762 | $tmp = $this->getAllNames(); |
731 | 763 | |
@@ -740,7 +772,8 @@ discard block |
||
740 | 772 | * |
741 | 773 | * @return string |
742 | 774 | */ |
743 | - public function getSortName() { |
|
775 | + public function getSortName() |
|
776 | + { |
|
744 | 777 | // The sortable name is never displayed, no need to call canShowName() |
745 | 778 | $tmp = $this->getAllNames(); |
746 | 779 | |
@@ -752,7 +785,8 @@ discard block |
||
752 | 785 | * |
753 | 786 | * @return null|string |
754 | 787 | */ |
755 | - public function getAddName() { |
|
788 | + public function getAddName() |
|
789 | + { |
|
756 | 790 | if ($this->canShowName() && $this->getPrimaryName() != $this->getSecondaryName()) { |
757 | 791 | $all_names = $this->getAllNames(); |
758 | 792 | |
@@ -773,7 +807,8 @@ discard block |
||
773 | 807 | * |
774 | 808 | * @return string |
775 | 809 | */ |
776 | - public function formatList($tag = 'li', $find = false, $name = null) { |
|
810 | + public function formatList($tag = 'li', $find = false, $name = null) |
|
811 | + { |
|
777 | 812 | if (is_null($name)) { |
778 | 813 | $name = $this->getFullName(); |
779 | 814 | } |
@@ -794,7 +829,8 @@ discard block |
||
794 | 829 | * |
795 | 830 | * @return string |
796 | 831 | */ |
797 | - public function formatListDetails() { |
|
832 | + public function formatListDetails() |
|
833 | + { |
|
798 | 834 | return ''; |
799 | 835 | } |
800 | 836 | |
@@ -806,7 +842,8 @@ discard block |
||
806 | 842 | * |
807 | 843 | * @return string |
808 | 844 | */ |
809 | - public function formatFirstMajorFact($facts, $style) { |
|
845 | + public function formatFirstMajorFact($facts, $style) |
|
846 | + { |
|
810 | 847 | foreach ($this->getFacts($facts, true) as $event) { |
811 | 848 | // Only display if it has a date or place (or both) |
812 | 849 | if ($event->getDate()->isOK() && !$event->getPlace()->isEmpty()) { |
@@ -834,7 +871,8 @@ discard block |
||
834 | 871 | * |
835 | 872 | * @return Individual[] |
836 | 873 | */ |
837 | - public function linkedIndividuals($link) { |
|
874 | + public function linkedIndividuals($link) |
|
875 | + { |
|
838 | 876 | $rows = Database::prepare( |
839 | 877 | "SELECT i_id AS xref, i_gedcom AS gedcom" . |
840 | 878 | " FROM `##individuals`" . |
@@ -867,7 +905,8 @@ discard block |
||
867 | 905 | * |
868 | 906 | * @return Family[] |
869 | 907 | */ |
870 | - public function linkedFamilies($link) { |
|
908 | + public function linkedFamilies($link) |
|
909 | + { |
|
871 | 910 | $rows = Database::prepare( |
872 | 911 | "SELECT f_id AS xref, f_gedcom AS gedcom" . |
873 | 912 | " FROM `##families`" . |
@@ -898,7 +937,8 @@ discard block |
||
898 | 937 | * |
899 | 938 | * @return Source[] |
900 | 939 | */ |
901 | - public function linkedSources($link) { |
|
940 | + public function linkedSources($link) |
|
941 | + { |
|
902 | 942 | $rows = Database::prepare( |
903 | 943 | "SELECT s_id AS xref, s_gedcom AS gedcom" . |
904 | 944 | " FROM `##sources`" . |
@@ -930,7 +970,8 @@ discard block |
||
930 | 970 | * |
931 | 971 | * @return Media[] |
932 | 972 | */ |
933 | - public function linkedMedia($link) { |
|
973 | + public function linkedMedia($link) |
|
974 | + { |
|
934 | 975 | $rows = Database::prepare( |
935 | 976 | "SELECT m_id AS xref, m_gedcom AS gedcom" . |
936 | 977 | " FROM `##media`" . |
@@ -962,7 +1003,8 @@ discard block |
||
962 | 1003 | * |
963 | 1004 | * @return Note[] |
964 | 1005 | */ |
965 | - public function linkedNotes($link) { |
|
1006 | + public function linkedNotes($link) |
|
1007 | + { |
|
966 | 1008 | $rows = Database::prepare( |
967 | 1009 | "SELECT o_id AS xref, o_gedcom AS gedcom" . |
968 | 1010 | " FROM `##other`" . |
@@ -995,7 +1037,8 @@ discard block |
||
995 | 1037 | * |
996 | 1038 | * @return Repository[] |
997 | 1039 | */ |
998 | - public function linkedRepositories($link) { |
|
1040 | + public function linkedRepositories($link) |
|
1041 | + { |
|
999 | 1042 | $rows = Database::prepare( |
1000 | 1043 | "SELECT o_id AS xref, o_gedcom AS gedcom" . |
1001 | 1044 | " FROM `##other`" . |
@@ -1032,7 +1075,8 @@ discard block |
||
1032 | 1075 | * |
1033 | 1076 | * @return Date[] |
1034 | 1077 | */ |
1035 | - public function getAllEventDates($event_type) { |
|
1078 | + public function getAllEventDates($event_type) |
|
1079 | + { |
|
1036 | 1080 | $dates = array(); |
1037 | 1081 | foreach ($this->getFacts($event_type) as $event) { |
1038 | 1082 | if ($event->getDate()->isOK()) { |
@@ -1050,7 +1094,8 @@ discard block |
||
1050 | 1094 | * |
1051 | 1095 | * @return array |
1052 | 1096 | */ |
1053 | - public function getAllEventPlaces($event_type) { |
|
1097 | + public function getAllEventPlaces($event_type) |
|
1098 | + { |
|
1054 | 1099 | $places = array(); |
1055 | 1100 | foreach ($this->getFacts($event_type) as $event) { |
1056 | 1101 | if (preg_match_all('/\n(?:2 PLAC|3 (?:ROMN|FONE|_HEB)) +(.+)/', $event->getGedcom(), $ged_places)) { |
@@ -1070,7 +1115,8 @@ discard block |
||
1070 | 1115 | * |
1071 | 1116 | * @return Fact|null |
1072 | 1117 | */ |
1073 | - public function getFirstFact($tag) { |
|
1118 | + public function getFirstFact($tag) |
|
1119 | + { |
|
1074 | 1120 | foreach ($this->getFacts() as $fact) { |
1075 | 1121 | if ($fact->getTag() === $tag) { |
1076 | 1122 | return $fact; |
@@ -1090,7 +1136,8 @@ discard block |
||
1090 | 1136 | * |
1091 | 1137 | * @return Fact[] |
1092 | 1138 | */ |
1093 | - public function getFacts($filter = null, $sort = false, $access_level = null, $override = false) { |
|
1139 | + public function getFacts($filter = null, $sort = false, $access_level = null, $override = false) |
|
1140 | + { |
|
1094 | 1141 | if ($access_level === null) { |
1095 | 1142 | $access_level = Auth::accessLevel($this->tree); |
1096 | 1143 | } |
@@ -1118,7 +1165,8 @@ discard block |
||
1118 | 1165 | * |
1119 | 1166 | * @return string |
1120 | 1167 | */ |
1121 | - public function lastChangeTimestamp($sorting = false) { |
|
1168 | + public function lastChangeTimestamp($sorting = false) |
|
1169 | + { |
|
1122 | 1170 | $chan = $this->getFirstFact('CHAN'); |
1123 | 1171 | |
1124 | 1172 | if ($chan) { |
@@ -1151,7 +1199,8 @@ discard block |
||
1151 | 1199 | * |
1152 | 1200 | * @return string |
1153 | 1201 | */ |
1154 | - public function lastChangeUser() { |
|
1202 | + public function lastChangeUser() |
|
1203 | + { |
|
1155 | 1204 | $chan = $this->getFirstFact('CHAN'); |
1156 | 1205 | |
1157 | 1206 | if ($chan === null) { |
@@ -1172,7 +1221,8 @@ discard block |
||
1172 | 1221 | * @param string $gedcom |
1173 | 1222 | * @param bool $update_chan |
1174 | 1223 | */ |
1175 | - public function createFact($gedcom, $update_chan) { |
|
1224 | + public function createFact($gedcom, $update_chan) |
|
1225 | + { |
|
1176 | 1226 | $this->updateFact(null, $gedcom, $update_chan); |
1177 | 1227 | } |
1178 | 1228 | |
@@ -1182,7 +1232,8 @@ discard block |
||
1182 | 1232 | * @param string $fact_id |
1183 | 1233 | * @param bool $update_chan |
1184 | 1234 | */ |
1185 | - public function deleteFact($fact_id, $update_chan) { |
|
1235 | + public function deleteFact($fact_id, $update_chan) |
|
1236 | + { |
|
1186 | 1237 | $this->updateFact($fact_id, null, $update_chan); |
1187 | 1238 | } |
1188 | 1239 | |
@@ -1195,7 +1246,8 @@ discard block |
||
1195 | 1246 | * |
1196 | 1247 | * @throws \Exception |
1197 | 1248 | */ |
1198 | - public function updateFact($fact_id, $gedcom, $update_chan) { |
|
1249 | + public function updateFact($fact_id, $gedcom, $update_chan) |
|
1250 | + { |
|
1199 | 1251 | // MSDOS line endings will break things in horrible ways |
1200 | 1252 | $gedcom = preg_replace('/[\r\n]+/', "\n", $gedcom); |
1201 | 1253 | $gedcom = trim($gedcom); |
@@ -1267,7 +1319,8 @@ discard block |
||
1267 | 1319 | * @param string $gedcom |
1268 | 1320 | * @param bool $update_chan |
1269 | 1321 | */ |
1270 | - public function updateRecord($gedcom, $update_chan) { |
|
1322 | + public function updateRecord($gedcom, $update_chan) |
|
1323 | + { |
|
1271 | 1324 | // MSDOS line endings will break things in horrible ways |
1272 | 1325 | $gedcom = preg_replace('/[\r\n]+/', "\n", $gedcom); |
1273 | 1326 | $gedcom = trim($gedcom); |
@@ -1307,7 +1360,8 @@ discard block |
||
1307 | 1360 | /** |
1308 | 1361 | * Delete this record |
1309 | 1362 | */ |
1310 | - public function deleteRecord() { |
|
1363 | + public function deleteRecord() |
|
1364 | + { |
|
1311 | 1365 | // Create a pending change |
1312 | 1366 | if (!$this->isPendingDeletion()) { |
1313 | 1367 | Database::prepare( |
@@ -1338,7 +1392,8 @@ discard block |
||
1338 | 1392 | * @param string $xref |
1339 | 1393 | * @param bool $update_chan |
1340 | 1394 | */ |
1341 | - public function removeLinks($xref, $update_chan) { |
|
1395 | + public function removeLinks($xref, $update_chan) |
|
1396 | + { |
|
1342 | 1397 | $value = '@' . $xref . '@'; |
1343 | 1398 | |
1344 | 1399 | foreach ($this->getFacts() as $fact) { |
@@ -29,7 +29,8 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * |
31 | 31 | */ |
32 | -class SurnameTradition { |
|
32 | +class SurnameTradition |
|
33 | +{ |
|
33 | 34 | /** |
34 | 35 | * Create a surname tradition object for a given surname tradition name. |
35 | 36 | * |
@@ -37,7 +38,8 @@ discard block |
||
37 | 38 | * |
38 | 39 | * @return SurnameTraditionInterface |
39 | 40 | */ |
40 | - public static function create($name) { |
|
41 | + public static function create($name) |
|
42 | + { |
|
41 | 43 | switch ($name) { |
42 | 44 | case 'paternal': |
43 | 45 | return new PaternalSurnameTradition; |
@@ -65,7 +67,8 @@ discard block |
||
65 | 67 | * |
66 | 68 | * @return string[] |
67 | 69 | */ |
68 | - public static function allDescriptions() { |
|
70 | + public static function allDescriptions() |
|
71 | + { |
|
69 | 72 | return array( |
70 | 73 | 'paternal' => |
71 | 74 | I18N::translateContext('Surname tradition', 'paternal') . |
@@ -18,7 +18,8 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * A GEDCOM repository (REPO) object. |
20 | 20 | */ |
21 | -class Repository extends GedcomRecord { |
|
21 | +class Repository extends GedcomRecord |
|
22 | +{ |
|
22 | 23 | const RECORD_TYPE = 'REPO'; |
23 | 24 | const URL_PREFIX = 'repo.php?rid='; |
24 | 25 | |
@@ -30,7 +31,8 @@ discard block |
||
30 | 31 | * |
31 | 32 | * @return null|string |
32 | 33 | */ |
33 | - protected static function fetchGedcomRecord($xref, $tree_id) { |
|
34 | + protected static function fetchGedcomRecord($xref, $tree_id) |
|
35 | + { |
|
34 | 36 | return Database::prepare( |
35 | 37 | "SELECT o_gedcom FROM `##other` WHERE o_id = :xref AND o_file = :tree_id AND o_type = 'REPO'" |
36 | 38 | )->execute(array( |
@@ -46,14 +48,16 @@ discard block |
||
46 | 48 | * |
47 | 49 | * @return string |
48 | 50 | */ |
49 | - protected function createPrivateGedcomRecord($access_level) { |
|
51 | + protected function createPrivateGedcomRecord($access_level) |
|
52 | + { |
|
50 | 53 | return '0 @' . $this->xref . "@ REPO\n1 NAME " . I18N::translate('Private'); |
51 | 54 | } |
52 | 55 | |
53 | 56 | /** |
54 | 57 | * Extract names from the GEDCOM record. |
55 | 58 | */ |
56 | - public function extractNames() { |
|
59 | + public function extractNames() |
|
60 | + { |
|
57 | 61 | parent::extractNamesFromFacts(1, 'NAME', $this->getFacts('NAME')); |
58 | 62 | } |
59 | 63 | } |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * Class GedcomCodeStat - Functions and logic for GEDCOM "STAT" codes |
22 | 22 | */ |
23 | -class GedcomCodeStat { |
|
23 | +class GedcomCodeStat |
|
24 | +{ |
|
24 | 25 | /** |
25 | 26 | * Get a list of status codes that can be used on a given LDS tag |
26 | 27 | * |
@@ -28,7 +29,8 @@ discard block |
||
28 | 29 | * |
29 | 30 | * @return string[] |
30 | 31 | */ |
31 | - public static function statusCodes($tag) { |
|
32 | + public static function statusCodes($tag) |
|
33 | + { |
|
32 | 34 | switch ($tag) { |
33 | 35 | case 'BAPL': |
34 | 36 | case 'CONL': |
@@ -55,7 +57,8 @@ discard block |
||
55 | 57 | * |
56 | 58 | * @return string |
57 | 59 | */ |
58 | - public static function statusName($status_code) { |
|
60 | + public static function statusName($status_code) |
|
61 | + { |
|
59 | 62 | switch ($status_code) { |
60 | 63 | case 'BIC': |
61 | 64 | return |
@@ -122,7 +125,8 @@ discard block |
||
122 | 125 | * |
123 | 126 | * @return string[] |
124 | 127 | */ |
125 | - public static function statusNames($tag) { |
|
128 | + public static function statusNames($tag) |
|
129 | + { |
|
126 | 130 | $status_names = array(); |
127 | 131 | foreach (self::statusCodes($tag) as $status_code) { |
128 | 132 | $status_names[$status_code] = self::statusName($status_code); |
@@ -22,7 +22,8 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Class GedcomCodeName - Functions and logic for GEDCOM "NAME" codes |
24 | 24 | */ |
25 | -class GedcomCodeName { |
|
25 | +class GedcomCodeName |
|
26 | +{ |
|
26 | 27 | /** @var string[] A list of possible types of name */ |
27 | 28 | private static $TYPES = array('adopted', 'aka', 'birth', 'change', 'estate', 'immigrant', 'maiden', 'married', 'religious'); |
28 | 29 | |
@@ -34,7 +35,8 @@ discard block |
||
34 | 35 | * |
35 | 36 | * @return string |
36 | 37 | */ |
37 | - public static function getValue($type, GedcomRecord $record = null) { |
|
38 | + public static function getValue($type, GedcomRecord $record = null) |
|
39 | + { |
|
38 | 40 | if ($record instanceof Individual) { |
39 | 41 | $sex = $record->getSex(); |
40 | 42 | } else { |
@@ -155,7 +157,8 @@ discard block |
||
155 | 157 | * |
156 | 158 | * @return string[] |
157 | 159 | */ |
158 | - public static function getValues(GedcomRecord $record = null) { |
|
160 | + public static function getValues(GedcomRecord $record = null) |
|
161 | + { |
|
159 | 162 | $values = array(); |
160 | 163 | foreach (self::$TYPES as $type) { |
161 | 164 | $values[$type] = self::getValue($type, $record); |
@@ -22,7 +22,8 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Class GedcomCodeRela - Functions and logic for GEDCOM "RELA" codes |
24 | 24 | */ |
25 | -class GedcomCodeRela { |
|
25 | +class GedcomCodeRela |
|
26 | +{ |
|
26 | 27 | /** @var string[] List of possible values for the RELA tag */ |
27 | 28 | private static $TYPES = array( |
28 | 29 | 'attendant', 'attending', 'best_man', 'bridesmaid', 'buyer', |
@@ -44,7 +45,8 @@ discard block |
||
44 | 45 | * |
45 | 46 | * @return string |
46 | 47 | */ |
47 | - public static function getValue($type, GedcomRecord $record = null) { |
|
48 | + public static function getValue($type, GedcomRecord $record = null) |
|
49 | + { |
|
48 | 50 | if ($record instanceof Individual) { |
49 | 51 | $sex = $record->getSex(); |
50 | 52 | } else { |
@@ -277,7 +279,8 @@ discard block |
||
277 | 279 | * |
278 | 280 | * @return string[] |
279 | 281 | */ |
280 | - public static function getValues(GedcomRecord $record = null) { |
|
282 | + public static function getValues(GedcomRecord $record = null) |
|
283 | + { |
|
281 | 284 | $values = array(); |
282 | 285 | foreach (self::$TYPES as $type) { |
283 | 286 | $values[$type] = self::getValue($type, $record); |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * Class GedcomCodeTemp - Functions and logic for GEDCOM "TEMP" codes |
22 | 22 | */ |
23 | -class GedcomCodeTemp { |
|
23 | +class GedcomCodeTemp |
|
24 | +{ |
|
24 | 25 | /** |
25 | 26 | * A list of GEDCOM tags that require a TEMP subtag |
26 | 27 | * |
@@ -28,7 +29,8 @@ discard block |
||
28 | 29 | * |
29 | 30 | * @return bool |
30 | 31 | */ |
31 | - public static function isTagLDS($tag) { |
|
32 | + public static function isTagLDS($tag) |
|
33 | + { |
|
32 | 34 | return $tag === 'BAPL' || $tag === 'CONL' || $tag === 'ENDL' || $tag === 'SLGC' || $tag === 'SLGS'; |
33 | 35 | } |
34 | 36 | |
@@ -43,7 +45,8 @@ discard block |
||
43 | 45 | * |
44 | 46 | * @return string[] |
45 | 47 | */ |
46 | - public static function templeCodes() { |
|
48 | + public static function templeCodes() |
|
49 | + { |
|
47 | 50 | return array( |
48 | 51 | 'ABA', 'ACCRA', 'ADELA', 'ALBER', 'ALBUQ', 'ANCHO', 'ARIZO', 'ASUNC', |
49 | 52 | 'ATLAN', 'BAIRE', 'BILLI', 'BIRMI', 'BISMA', 'BOGOT', 'BOISE', 'BOSTO', |
@@ -75,7 +78,8 @@ discard block |
||
75 | 78 | * |
76 | 79 | * @return string |
77 | 80 | */ |
78 | - public static function templeName($temple_code) { |
|
81 | + public static function templeName($temple_code) |
|
82 | + { |
|
79 | 83 | switch ($temple_code) { |
80 | 84 | case 'ABA': |
81 | 85 | return /* I18N: Location of an LDS church temple */ I18N::translate('Aba, Nigeria'); |
@@ -397,7 +401,8 @@ discard block |
||
397 | 401 | * |
398 | 402 | * @return string[] |
399 | 403 | */ |
400 | - public static function templeNames() { |
|
404 | + public static function templeNames() |
|
405 | + { |
|
401 | 406 | $temple_names = array(); |
402 | 407 | foreach (self::templeCodes() as $temple_code) { |
403 | 408 | $temple_names[$temple_code] = self::templeName($temple_code); |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * Class GedcomCodeQuay - Functions and logic for GEDCOM "QUAY" codes |
22 | 22 | */ |
23 | -class GedcomCodeQuay { |
|
23 | +class GedcomCodeQuay |
|
24 | +{ |
|
24 | 25 | /** @var string[] Valid values for a QUAY tag. */ |
25 | 26 | private static $TYPES = array('3', '2', '1', '0'); |
26 | 27 | |
@@ -31,7 +32,8 @@ discard block |
||
31 | 32 | * |
32 | 33 | * @return string |
33 | 34 | */ |
34 | - public static function getValue($type) { |
|
35 | + public static function getValue($type) |
|
36 | + { |
|
35 | 37 | switch ($type) { |
36 | 38 | case '3': |
37 | 39 | return |
@@ -59,7 +61,8 @@ discard block |
||
59 | 61 | * |
60 | 62 | * @return string[] |
61 | 63 | */ |
62 | - public static function getValues() { |
|
64 | + public static function getValues() |
|
65 | + { |
|
63 | 66 | $values = array(); |
64 | 67 | foreach (self::$TYPES as $type) { |
65 | 68 | $values[$type] = self::getValue($type); |
@@ -22,7 +22,8 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Class GedcomCodeAdop - Functions and logic for GEDCOM "ADOP" codes |
24 | 24 | */ |
25 | -class GedcomCodeAdop { |
|
25 | +class GedcomCodeAdop |
|
26 | +{ |
|
26 | 27 | /** @var string[] A list of possible adoption codes */ |
27 | 28 | private static $TYPES = array('BOTH', 'HUSB', 'WIFE'); |
28 | 29 | |
@@ -34,7 +35,8 @@ discard block |
||
34 | 35 | * |
35 | 36 | * @return string |
36 | 37 | */ |
37 | - public static function getValue($type, GedcomRecord $record = null) { |
|
38 | + public static function getValue($type, GedcomRecord $record = null) |
|
39 | + { |
|
38 | 40 | if ($record instanceof Individual) { |
39 | 41 | $sex = $record->getSex(); |
40 | 42 | } else { |
@@ -81,7 +83,8 @@ discard block |
||
81 | 83 | * |
82 | 84 | * @return string[] |
83 | 85 | */ |
84 | - public static function getValues(GedcomRecord $record = null) { |
|
86 | + public static function getValues(GedcomRecord $record = null) |
|
87 | + { |
|
85 | 88 | $values = array(); |
86 | 89 | foreach (self::$TYPES as $type) { |
87 | 90 | $values[$type] = self::getValue($type, $record); |