@@ -40,7 +40,8 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * Class FunctionsPrintFacts - common functions |
42 | 42 | */ |
43 | -class FunctionsPrintFacts { |
|
43 | +class FunctionsPrintFacts |
|
44 | +{ |
|
44 | 45 | /** |
45 | 46 | * Print a fact record, for the individual/family/source/repository/etc. pages. |
46 | 47 | * |
@@ -53,7 +54,8 @@ discard block |
||
53 | 54 | * @param Fact $fact |
54 | 55 | * @param GedcomRecord $record |
55 | 56 | */ |
56 | - public static function printFact(Fact $fact, GedcomRecord $record) { |
|
57 | + public static function printFact(Fact $fact, GedcomRecord $record) |
|
58 | + { |
|
57 | 59 | static $n_chil = 0, $n_gchi = 0; |
58 | 60 | |
59 | 61 | $parent = $fact->getParent(); |
@@ -494,7 +496,8 @@ discard block |
||
494 | 496 | * |
495 | 497 | * @return string |
496 | 498 | */ |
497 | - private static function formatAssociateRelationship(Fact $event) { |
|
499 | + private static function formatAssociateRelationship(Fact $event) |
|
500 | + { |
|
498 | 501 | $parent = $event->getParent(); |
499 | 502 | // To whom is this record an assocate? |
500 | 503 | if ($parent instanceof Individual) { |
@@ -561,7 +564,8 @@ discard block |
||
561 | 564 | * |
562 | 565 | * @param string $xref the Gedcom Xref ID of the repository to print |
563 | 566 | */ |
564 | - public static function printRepositoryRecord($xref) { |
|
567 | + public static function printRepositoryRecord($xref) |
|
568 | + { |
|
565 | 569 | global $WT_TREE; |
566 | 570 | |
567 | 571 | $repository = Repository::getInstance($xref, $WT_TREE); |
@@ -583,7 +587,8 @@ discard block |
||
583 | 587 | * |
584 | 588 | * @return string HTML text |
585 | 589 | */ |
586 | - public static function printFactSources($factrec, $level) { |
|
590 | + public static function printFactSources($factrec, $level) |
|
591 | + { |
|
587 | 592 | global $WT_TREE; |
588 | 593 | |
589 | 594 | $data = ''; |
@@ -666,7 +671,8 @@ discard block |
||
666 | 671 | * @param string $factrec |
667 | 672 | * @param int $level |
668 | 673 | */ |
669 | - public static function printMediaLinks($factrec, $level) { |
|
674 | + public static function printMediaLinks($factrec, $level) |
|
675 | + { |
|
670 | 676 | global $WT_TREE; |
671 | 677 | |
672 | 678 | $nlevel = $level + 1; |
@@ -735,7 +741,8 @@ discard block |
||
735 | 741 | * @param Fact $fact |
736 | 742 | * @param int $level |
737 | 743 | */ |
738 | - public static function printMainSources(Fact $fact, $level) { |
|
744 | + public static function printMainSources(Fact $fact, $level) |
|
745 | + { |
|
739 | 746 | $factrec = $fact->getGedcom(); |
740 | 747 | $fact_id = $fact->getFactId(); |
741 | 748 | $parent = $fact->getParent(); |
@@ -881,7 +888,8 @@ discard block |
||
881 | 888 | * |
882 | 889 | * @return string |
883 | 890 | */ |
884 | - public static function printSourceStructure($textSOUR) { |
|
891 | + public static function printSourceStructure($textSOUR) |
|
892 | + { |
|
885 | 893 | global $WT_TREE; |
886 | 894 | $html = ''; |
887 | 895 | |
@@ -928,7 +936,8 @@ discard block |
||
928 | 936 | * |
929 | 937 | * @return string[] |
930 | 938 | */ |
931 | - public static function getSourceStructure($srec) { |
|
939 | + public static function getSourceStructure($srec) |
|
940 | + { |
|
932 | 941 | // Set up the output array |
933 | 942 | $textSOUR = array( |
934 | 943 | 'PAGE' => '', |
@@ -974,7 +983,8 @@ discard block |
||
974 | 983 | * @param Fact $fact |
975 | 984 | * @param int $level |
976 | 985 | */ |
977 | - public static function printMainNotes(Fact $fact, $level) { |
|
986 | + public static function printMainNotes(Fact $fact, $level) |
|
987 | + { |
|
978 | 988 | $factrec = $fact->getGedcom(); |
979 | 989 | $fact_id = $fact->getFactId(); |
980 | 990 | $parent = $fact->getParent(); |
@@ -1121,7 +1131,8 @@ discard block |
||
1121 | 1131 | * @param Fact $fact |
1122 | 1132 | * @param int $level |
1123 | 1133 | */ |
1124 | - public static function printMainMedia(Fact $fact, $level) { |
|
1134 | + public static function printMainMedia(Fact $fact, $level) |
|
1135 | + { |
|
1125 | 1136 | $factrec = $fact->getGedcom(); |
1126 | 1137 | $parent = $fact->getParent(); |
1127 | 1138 |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * Class FunctionsMedia - common functions |
22 | 22 | */ |
23 | -class FunctionsMedia { |
|
23 | +class FunctionsMedia |
|
24 | +{ |
|
24 | 25 | /** |
25 | 26 | * Convert raw values from php.ini file into bytes |
26 | 27 | * |
@@ -28,7 +29,8 @@ discard block |
||
28 | 29 | * |
29 | 30 | * @return int |
30 | 31 | */ |
31 | - public static function sizeToBytes($val) { |
|
32 | + public static function sizeToBytes($val) |
|
33 | + { |
|
32 | 34 | if (!$val) { |
33 | 35 | // no value was passed in, assume no limit and return -1 |
34 | 36 | $val = -1; |
@@ -55,7 +57,8 @@ discard block |
||
55 | 57 | * |
56 | 58 | * @return bool |
57 | 59 | */ |
58 | - public static function hasMemoryForImage($serverFilename) { |
|
60 | + public static function hasMemoryForImage($serverFilename) |
|
61 | + { |
|
59 | 62 | // find out how much total memory this script can access |
60 | 63 | $memoryAvailable = self::sizeToBytes(ini_get('memory_limit')); |
61 | 64 | // if memory is unlimited, it will return -1 and we don’t need to worry about it |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * RTL Functions for use in the PDF/HTML reports |
22 | 22 | */ |
23 | -class FunctionsRtl { |
|
23 | +class FunctionsRtl |
|
24 | +{ |
|
24 | 25 | const OPEN_PARENTHESES = '([{'; |
25 | 26 | |
26 | 27 | const CLOSE_PARENTHESES = ')]}'; |
@@ -72,7 +73,8 @@ discard block |
||
72 | 73 | * |
73 | 74 | * @return string The input string, with ‎ and ‏ stripped |
74 | 75 | */ |
75 | - public static function stripLrmRlm($inputText) { |
|
76 | + public static function stripLrmRlm($inputText) |
|
77 | + { |
|
76 | 78 | return str_replace(array(WT_UTF8_LRM, WT_UTF8_RLM, WT_UTF8_LRO, WT_UTF8_RLO, WT_UTF8_LRE, WT_UTF8_RLE, WT_UTF8_PDF, "‎", "‏", "‎", "‏"), "", $inputText); |
77 | 79 | } |
78 | 80 | |
@@ -86,7 +88,8 @@ discard block |
||
86 | 88 | * |
87 | 89 | * @return string The string with all texts encapsulated as required |
88 | 90 | */ |
89 | - public static function spanLtrRtl($inputText, $direction = 'BOTH', $class = '') { |
|
91 | + public static function spanLtrRtl($inputText, $direction = 'BOTH', $class = '') |
|
92 | + { |
|
90 | 93 | if ($inputText == '') { |
91 | 94 | // Nothing to do |
92 | 95 | return ''; |
@@ -504,7 +507,8 @@ discard block |
||
504 | 507 | * |
505 | 508 | * @return string |
506 | 509 | */ |
507 | - public static function starredName($textSpan, $direction) { |
|
510 | + public static function starredName($textSpan, $direction) |
|
511 | + { |
|
508 | 512 | // To avoid a TCPDF bug that mixes up the word order, insert those <u> and </u> tags |
509 | 513 | // only when page and span directions are identical. |
510 | 514 | if ($direction === strtoupper(I18N::direction())) { |
@@ -545,7 +549,8 @@ discard block |
||
545 | 549 | * |
546 | 550 | * @return array |
547 | 551 | */ |
548 | - public static function getChar($text, $offset) { |
|
552 | + public static function getChar($text, $offset) |
|
553 | + { |
|
549 | 554 | |
550 | 555 | if ($text == '') { |
551 | 556 | return array('letter' => '', 'length' => 0); |
@@ -572,7 +577,8 @@ discard block |
||
572 | 577 | * |
573 | 578 | * @param string $result |
574 | 579 | */ |
575 | - public static function breakCurrentSpan(&$result) { |
|
580 | + public static function breakCurrentSpan(&$result) |
|
581 | + { |
|
576 | 582 | // Interrupt the current span, insert that <br>, and then continue the current span |
577 | 583 | $result .= self::$waitingText; |
578 | 584 | self::$waitingText = ''; |
@@ -588,7 +594,8 @@ discard block |
||
588 | 594 | * |
589 | 595 | * @param string $result |
590 | 596 | */ |
591 | - public static function beginCurrentSpan(&$result) { |
|
597 | + public static function beginCurrentSpan(&$result) |
|
598 | + { |
|
592 | 599 | if (self::$currentState == 'LTR') { |
593 | 600 | $result .= self::$startLTR; |
594 | 601 | } |
@@ -605,7 +612,8 @@ discard block |
||
605 | 612 | * @param string $result |
606 | 613 | * @param bool $theEnd |
607 | 614 | */ |
608 | - public static function finishCurrentSpan(&$result, $theEnd = false) { |
|
615 | + public static function finishCurrentSpan(&$result, $theEnd = false) |
|
616 | + { |
|
609 | 617 | $textSpan = substr($result, self::$posSpanStart); |
610 | 618 | $result = substr($result, 0, self::$posSpanStart); |
611 | 619 | |
@@ -1116,7 +1124,8 @@ discard block |
||
1116 | 1124 | * |
1117 | 1125 | * @return string |
1118 | 1126 | */ |
1119 | - public static function utf8WordWrap($string, $width = 75, $sep = "\n", $cut = false) { |
|
1127 | + public static function utf8WordWrap($string, $width = 75, $sep = "\n", $cut = false) |
|
1128 | + { |
|
1120 | 1129 | $out = ''; |
1121 | 1130 | while ($string) { |
1122 | 1131 | if (mb_strlen($string) <= $width) { |
@@ -39,7 +39,8 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * Class FunctionsPrint - common functions |
41 | 41 | */ |
42 | -class FunctionsPrint { |
|
42 | +class FunctionsPrint |
|
43 | +{ |
|
43 | 44 | /** |
44 | 45 | * print the information for an individual chart box |
45 | 46 | * |
@@ -48,7 +49,8 @@ discard block |
||
48 | 49 | * @param Individual $person The person to print |
49 | 50 | * @param int $show_full The style to print the box in, 0 for smaller boxes, 1 for larger boxes |
50 | 51 | */ |
51 | - public static function printPedigreePerson(Individual $person = null, $show_full = 1) { |
|
52 | + public static function printPedigreePerson(Individual $person = null, $show_full = 1) |
|
53 | + { |
|
52 | 54 | |
53 | 55 | switch ($show_full) { |
54 | 56 | case 0: |
@@ -78,7 +80,8 @@ discard block |
||
78 | 80 | * |
79 | 81 | * @return string |
80 | 82 | */ |
81 | - public static function printNoteRecord($text, $nlevel, $nrec, $textOnly = false) { |
|
83 | + public static function printNoteRecord($text, $nlevel, $nrec, $textOnly = false) |
|
84 | + { |
|
82 | 85 | global $WT_TREE; |
83 | 86 | |
84 | 87 | $text .= Functions::getCont($nlevel, $nrec); |
@@ -137,7 +140,8 @@ discard block |
||
137 | 140 | * |
138 | 141 | * @return string HTML |
139 | 142 | */ |
140 | - public static function printFactNotes($factrec, $level, $textOnly = false) { |
|
143 | + public static function printFactNotes($factrec, $level, $textOnly = false) |
|
144 | + { |
|
141 | 145 | global $WT_TREE; |
142 | 146 | |
143 | 147 | $data = ''; |
@@ -194,7 +198,8 @@ discard block |
||
194 | 198 | * |
195 | 199 | * @return string |
196 | 200 | */ |
197 | - public static function helpLink($help_topic, $module = '') { |
|
201 | + public static function helpLink($help_topic, $module = '') |
|
202 | + { |
|
198 | 203 | return '<span class="icon-help" onclick="helpDialog(\'' . $help_topic . '\',\'' . $module . '\'); return false;"> </span>'; |
199 | 204 | } |
200 | 205 | |
@@ -207,7 +212,8 @@ discard block |
||
207 | 212 | * |
208 | 213 | * @return string |
209 | 214 | */ |
210 | - public static function wikiHelpLink($topic) { |
|
215 | + public static function wikiHelpLink($topic) |
|
216 | + { |
|
211 | 217 | return '<a class="help icon-wiki" href="' . WT_WEBTREES_WIKI . $topic . '" title="' . I18N::translate('webtrees wiki') . '"></a>'; |
212 | 218 | } |
213 | 219 | |
@@ -219,7 +225,8 @@ discard block |
||
219 | 225 | * |
220 | 226 | * @return string |
221 | 227 | */ |
222 | - public static function highlightSearchHits($string) { |
|
228 | + public static function highlightSearchHits($string) |
|
229 | + { |
|
223 | 230 | global $controller; |
224 | 231 | |
225 | 232 | if ($controller instanceof SearchController && $controller->query) { |
@@ -248,7 +255,8 @@ discard block |
||
248 | 255 | * |
249 | 256 | * @return string HTML |
250 | 257 | */ |
251 | - public static function formatParentsAges(Individual $person, Date $birth_date) { |
|
258 | + public static function formatParentsAges(Individual $person, Date $birth_date) |
|
259 | + { |
|
252 | 260 | $html = ''; |
253 | 261 | $families = $person->getChildFamilies(); |
254 | 262 | // Multiple sets of parents (e.g. adoption) cause complications, so ignore. |
@@ -300,7 +308,8 @@ discard block |
||
300 | 308 | * |
301 | 309 | * @return string |
302 | 310 | */ |
303 | - public static function formatFactDate(Fact $event, GedcomRecord $record, $anchor, $time) { |
|
311 | + public static function formatFactDate(Fact $event, GedcomRecord $record, $anchor, $time) |
|
312 | + { |
|
304 | 313 | global $pid; |
305 | 314 | |
306 | 315 | $factrec = $event->getGedcom(); |
@@ -433,7 +442,8 @@ discard block |
||
433 | 442 | * |
434 | 443 | * @return string HTML |
435 | 444 | */ |
436 | - public static function formatFactPlace(Fact $event, $anchor = false, $sub_records = false, $lds = false) { |
|
445 | + public static function formatFactPlace(Fact $event, $anchor = false, $sub_records = false, $lds = false) |
|
446 | + { |
|
437 | 447 | if ($anchor) { |
438 | 448 | // Show the full place name, for facts/events tab |
439 | 449 | $html = '<a href="' . $event->getPlace()->getURL() . '">' . $event->getPlace()->getFullName() . '</a>'; |
@@ -501,7 +511,8 @@ discard block |
||
501 | 511 | * |
502 | 512 | * @return string[] |
503 | 513 | */ |
504 | - public static function checkFactUnique($uniquefacts, $recfacts, $type) { |
|
514 | + public static function checkFactUnique($uniquefacts, $recfacts, $type) |
|
515 | + { |
|
505 | 516 | foreach ($recfacts as $factarray) { |
506 | 517 | $fact = false; |
507 | 518 | if (is_object($factarray)) { |
@@ -537,7 +548,8 @@ discard block |
||
537 | 548 | * @param array $usedfacts an array of facts already used in this record |
538 | 549 | * @param string $type the type of record INDI, FAM, SOUR etc |
539 | 550 | */ |
540 | - public static function printAddNewFact($id, $usedfacts, $type) { |
|
551 | + public static function printAddNewFact($id, $usedfacts, $type) |
|
552 | + { |
|
541 | 553 | global $WT_TREE; |
542 | 554 | |
543 | 555 | // -- Add from clipboard |
@@ -637,7 +649,8 @@ discard block |
||
637 | 649 | /** |
638 | 650 | * javascript declaration for calendar popup |
639 | 651 | */ |
640 | - public static function initializeCalendarPopup() { |
|
652 | + public static function initializeCalendarPopup() |
|
653 | + { |
|
641 | 654 | global $controller; |
642 | 655 | |
643 | 656 | $controller->addInlineJavascript(' |
@@ -677,7 +690,8 @@ discard block |
||
677 | 690 | * |
678 | 691 | * @return string |
679 | 692 | */ |
680 | - public static function printFindIndividualLink($element_id, $indiname = '', $tree = null) { |
|
693 | + public static function printFindIndividualLink($element_id, $indiname = '', $tree = null) |
|
694 | + { |
|
681 | 695 | global $WT_TREE; |
682 | 696 | |
683 | 697 | if ($tree === null) { |
@@ -694,7 +708,8 @@ discard block |
||
694 | 708 | * |
695 | 709 | * @return string |
696 | 710 | */ |
697 | - public static function printFindPlaceLink($element_id) { |
|
711 | + public static function printFindPlaceLink($element_id) |
|
712 | + { |
|
698 | 713 | return '<a href="#" onclick="findPlace(document.getElementById(\'' . $element_id . '\'), WT_GEDCOM); return false;" class="icon-button_place" title="' . I18N::translate('Find a place') . '"></a>'; |
699 | 714 | } |
700 | 715 | |
@@ -705,7 +720,8 @@ discard block |
||
705 | 720 | * |
706 | 721 | * @return string |
707 | 722 | */ |
708 | - public static function printFindFamilyLink($element_id) { |
|
723 | + public static function printFindFamilyLink($element_id) |
|
724 | + { |
|
709 | 725 | return '<a href="#" onclick="findFamily(document.getElementById(\'' . $element_id . '\'), WT_GEDCOM); return false;" class="icon-button_family" title="' . I18N::translate('Find a family') . '"></a>'; |
710 | 726 | } |
711 | 727 | |
@@ -716,7 +732,8 @@ discard block |
||
716 | 732 | * |
717 | 733 | * @return string |
718 | 734 | */ |
719 | - public static function printSpecialCharacterLink($element_id) { |
|
735 | + public static function printSpecialCharacterLink($element_id) |
|
736 | + { |
|
720 | 737 | return '<span onclick="findSpecialChar(document.getElementById(\'' . $element_id . '\')); if (window.updatewholename) { updatewholename(); } return false;" class="icon-button_keyboard" title="' . I18N::translate('Find a special character') . '"></span>'; |
721 | 738 | } |
722 | 739 | |
@@ -726,7 +743,8 @@ discard block |
||
726 | 743 | * @param string $element_id |
727 | 744 | * @param string[] $choices |
728 | 745 | */ |
729 | - public static function printAutoPasteLink($element_id, $choices) { |
|
746 | + public static function printAutoPasteLink($element_id, $choices) |
|
747 | + { |
|
730 | 748 | echo '<small>'; |
731 | 749 | foreach ($choices as $choice) { |
732 | 750 | echo '<span onclick="document.getElementById(\'', $element_id, '\').value='; |
@@ -744,7 +762,8 @@ discard block |
||
744 | 762 | * |
745 | 763 | * @return string |
746 | 764 | */ |
747 | - public static function printFindSourceLink($element_id, $sourcename = '') { |
|
765 | + public static function printFindSourceLink($element_id, $sourcename = '') |
|
766 | + { |
|
748 | 767 | return '<a href="#" onclick="findSource(document.getElementById(\'' . $element_id . '\'), document.getElementById(\'' . $sourcename . '\'), WT_GEDCOM); return false;" class="icon-button_source" title="' . I18N::translate('Find a source') . '"></a>'; |
749 | 768 | } |
750 | 769 | |
@@ -756,7 +775,8 @@ discard block |
||
756 | 775 | * |
757 | 776 | * @return string |
758 | 777 | */ |
759 | - public static function printFindNoteLink($element_id, $notename = '') { |
|
778 | + public static function printFindNoteLink($element_id, $notename = '') |
|
779 | + { |
|
760 | 780 | return '<a href="#" onclick="findnote(document.getElementById(\'' . $element_id . '\'), document.getElementById(\'' . $notename . '\'), \'WT_GEDCOM\'); return false;" class="icon-button_find" title="' . I18N::translate('Find a shared note') . '"></a>'; |
761 | 781 | } |
762 | 782 | |
@@ -767,7 +787,8 @@ discard block |
||
767 | 787 | * |
768 | 788 | * @return string |
769 | 789 | */ |
770 | - public static function printFindRepositoryLink($element_id) { |
|
790 | + public static function printFindRepositoryLink($element_id) |
|
791 | + { |
|
771 | 792 | return '<a href="#" onclick="findRepository(document.getElementById(\'' . $element_id . '\'), WT_GEDCOM); return false;" class="icon-button_repository" title="' . I18N::translate('Find a repository') . '"></a>'; |
772 | 793 | } |
773 | 794 | |
@@ -779,7 +800,8 @@ discard block |
||
779 | 800 | * |
780 | 801 | * @return string |
781 | 802 | */ |
782 | - public static function printFindMediaLink($element_id, $choose = '') { |
|
803 | + public static function printFindMediaLink($element_id, $choose = '') |
|
804 | + { |
|
783 | 805 | return '<a href="#" onclick="findMedia(document.getElementById(\'' . $element_id . '\'), \'' . $choose . '\', WT_GEDCOM); return false;" class="icon-button_media" title="' . I18N::translate('Find a media object') . '"></a>'; |
784 | 806 | } |
785 | 807 | |
@@ -790,7 +812,8 @@ discard block |
||
790 | 812 | * |
791 | 813 | * @return string |
792 | 814 | */ |
793 | - public static function printFindFactLink($element_id) { |
|
815 | + public static function printFindFactLink($element_id) |
|
816 | + { |
|
794 | 817 | return '<a href="#" onclick="findFact(document.getElementById(\'' . $element_id . '\'), WT_GEDCOM); return false;" class="icon-button_find_facts" title="' . I18N::translate('Find a fact or event') . '"></a>'; |
795 | 818 | } |
796 | 819 | |
@@ -801,7 +824,8 @@ discard block |
||
801 | 824 | * |
802 | 825 | * @return string |
803 | 826 | */ |
804 | - public static function getLdsSummary(Individual $individual) { |
|
827 | + public static function getLdsSummary(Individual $individual) |
|
828 | + { |
|
805 | 829 | $BAPL = $individual->getFacts('BAPL') ? 'B' : '_'; |
806 | 830 | $ENDL = $individual->getFacts('ENDL') ? 'E' : '_'; |
807 | 831 | $SLGC = $individual->getFacts('SLGC') ? 'C' : '_'; |
@@ -52,7 +52,8 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * Class FunctionsEdit - common functions |
54 | 54 | */ |
55 | -class FunctionsEdit { |
|
55 | +class FunctionsEdit |
|
56 | +{ |
|
56 | 57 | /** |
57 | 58 | * Create a <select> control for a form. |
58 | 59 | * |
@@ -64,7 +65,8 @@ discard block |
||
64 | 65 | * |
65 | 66 | * @return string |
66 | 67 | */ |
67 | - public static function selectEditControl($name, $values, $empty, $selected, $extra = '') { |
|
68 | + public static function selectEditControl($name, $values, $empty, $selected, $extra = '') |
|
69 | + { |
|
68 | 70 | if (is_null($empty)) { |
69 | 71 | $html = ''; |
70 | 72 | } else { |
@@ -104,7 +106,8 @@ discard block |
||
104 | 106 | * |
105 | 107 | * @return string |
106 | 108 | */ |
107 | - public static function radioButtons($name, $values, $selected, $extra = '') { |
|
109 | + public static function radioButtons($name, $values, $selected, $extra = '') |
|
110 | + { |
|
108 | 111 | $html = ''; |
109 | 112 | foreach ($values as $key => $value) { |
110 | 113 | $html .= |
@@ -129,7 +132,8 @@ discard block |
||
129 | 132 | * |
130 | 133 | * @return string |
131 | 134 | */ |
132 | - public static function editFieldYesNo($name, $selected = false, $extra = '') { |
|
135 | + public static function editFieldYesNo($name, $selected = false, $extra = '') |
|
136 | + { |
|
133 | 137 | return self::radioButtons( |
134 | 138 | $name, array(I18N::translate('no'), I18N::translate('yes')), $selected, $extra |
135 | 139 | ); |
@@ -144,7 +148,8 @@ discard block |
||
144 | 148 | * |
145 | 149 | * @return string |
146 | 150 | */ |
147 | - public static function checkbox($name, $is_checked = false, $extra = '') { |
|
151 | + public static function checkbox($name, $is_checked = false, $extra = '') |
|
152 | + { |
|
148 | 153 | return '<input type="checkbox" name="' . $name . '" value="1" ' . ($is_checked ? 'checked ' : '') . $extra . '>'; |
149 | 154 | } |
150 | 155 | |
@@ -160,7 +165,8 @@ discard block |
||
160 | 165 | * |
161 | 166 | * @return string |
162 | 167 | */ |
163 | - public static function twoStateCheckbox($name, $is_checked = 0, $extra = '') { |
|
168 | + public static function twoStateCheckbox($name, $is_checked = 0, $extra = '') |
|
169 | + { |
|
164 | 170 | return |
165 | 171 | '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . ($is_checked ? 1 : 0) . '">' . |
166 | 172 | '<input type="checkbox" name="' . $name . '-GUI-ONLY" value="1"' . |
@@ -176,7 +182,8 @@ discard block |
||
176 | 182 | * |
177 | 183 | * @return string |
178 | 184 | */ |
179 | - public static function editLanguageCheckboxes($parameter_name, $accepted_languages) { |
|
185 | + public static function editLanguageCheckboxes($parameter_name, $accepted_languages) |
|
186 | + { |
|
180 | 187 | $html = ''; |
181 | 188 | foreach (I18N::activeLocales() as $locale) { |
182 | 189 | $html .= '<div class="checkbox">'; |
@@ -200,7 +207,8 @@ discard block |
||
200 | 207 | * |
201 | 208 | * @return string |
202 | 209 | */ |
203 | - public static function editFieldAccessLevel($name, $selected = '', $extra = '') { |
|
210 | + public static function editFieldAccessLevel($name, $selected = '', $extra = '') |
|
211 | + { |
|
204 | 212 | $ACCESS_LEVEL = array( |
205 | 213 | Auth::PRIV_PRIVATE => I18N::translate('Show to visitors'), |
206 | 214 | Auth::PRIV_USER => I18N::translate('Show to members'), |
@@ -220,7 +228,8 @@ discard block |
||
220 | 228 | * |
221 | 229 | * @return string |
222 | 230 | */ |
223 | - public static function editFieldRestriction($name, $selected = '', $extra = '') { |
|
231 | + public static function editFieldRestriction($name, $selected = '', $extra = '') |
|
232 | + { |
|
224 | 233 | $RESN = array( |
225 | 234 | '' => '', |
226 | 235 | 'none' => I18N::translate('Show to visitors'), // Not valid GEDCOM, but very useful |
@@ -241,7 +250,8 @@ discard block |
||
241 | 250 | * |
242 | 251 | * @return string |
243 | 252 | */ |
244 | - public static function editFieldContact($name, $selected = '', $extra = '') { |
|
253 | + public static function editFieldContact($name, $selected = '', $extra = '') |
|
254 | + { |
|
245 | 255 | // Different ways to contact the users |
246 | 256 | $CONTACT_METHODS = array( |
247 | 257 | 'messaging' => I18N::translate('Internal messaging'), |
@@ -263,7 +273,8 @@ discard block |
||
263 | 273 | * |
264 | 274 | * @return string |
265 | 275 | */ |
266 | - public static function editFieldLanguage($name, $selected = '', $extra = '') { |
|
276 | + public static function editFieldLanguage($name, $selected = '', $extra = '') |
|
277 | + { |
|
267 | 278 | $languages = array(); |
268 | 279 | foreach (I18N::activeLocales() as $locale) { |
269 | 280 | $languages[$locale->languageTag()] = $locale->endonym(); |
@@ -283,7 +294,8 @@ discard block |
||
283 | 294 | * |
284 | 295 | * @return string |
285 | 296 | */ |
286 | - public static function editFieldInteger($name, $selected = '', $min, $max, $extra = '') { |
|
297 | + public static function editFieldInteger($name, $selected = '', $min, $max, $extra = '') |
|
298 | + { |
|
287 | 299 | $array = array(); |
288 | 300 | for ($i = $min; $i <= $max; ++$i) { |
289 | 301 | $array[$i] = I18N::number($i); |
@@ -301,7 +313,8 @@ discard block |
||
301 | 313 | * |
302 | 314 | * @return string |
303 | 315 | */ |
304 | - public static function editFieldUsername($name, $selected = '', $extra = '') { |
|
316 | + public static function editFieldUsername($name, $selected = '', $extra = '') |
|
317 | + { |
|
305 | 318 | $users = array(); |
306 | 319 | foreach (User::all() as $user) { |
307 | 320 | $users[$user->getUserName()] = $user->getRealName() . ' - ' . $user->getUserName(); |
@@ -324,7 +337,8 @@ discard block |
||
324 | 337 | * |
325 | 338 | * @return string |
326 | 339 | */ |
327 | - public static function editFieldAdoption($name, $selected = '', $extra = '', Individual $individual = null) { |
|
340 | + public static function editFieldAdoption($name, $selected = '', $extra = '', Individual $individual = null) |
|
341 | + { |
|
328 | 342 | return self::selectEditControl($name, GedcomCodeAdop::getValues($individual), null, $selected, $extra); |
329 | 343 | } |
330 | 344 | |
@@ -338,7 +352,8 @@ discard block |
||
338 | 352 | * |
339 | 353 | * @return string |
340 | 354 | */ |
341 | - public static function editFieldPedigree($name, $selected = '', $extra = '', Individual $individual = null) { |
|
355 | + public static function editFieldPedigree($name, $selected = '', $extra = '', Individual $individual = null) |
|
356 | + { |
|
342 | 357 | return self::selectEditControl($name, GedcomCodePedi::getValues($individual), '', $selected, $extra); |
343 | 358 | } |
344 | 359 | |
@@ -352,7 +367,8 @@ discard block |
||
352 | 367 | * |
353 | 368 | * @return string |
354 | 369 | */ |
355 | - public static function editFieldNameType($name, $selected = '', $extra = '', Individual $individual = null) { |
|
370 | + public static function editFieldNameType($name, $selected = '', $extra = '', Individual $individual = null) |
|
371 | + { |
|
356 | 372 | return self::selectEditControl($name, GedcomCodeName::getValues($individual), '', $selected, $extra); |
357 | 373 | } |
358 | 374 | |
@@ -365,7 +381,8 @@ discard block |
||
365 | 381 | * |
366 | 382 | * @return string |
367 | 383 | */ |
368 | - public static function editFieldRelationship($name, $selected = '', $extra = '') { |
|
384 | + public static function editFieldRelationship($name, $selected = '', $extra = '') |
|
385 | + { |
|
369 | 386 | $rela_codes = GedcomCodeRela::getValues(); |
370 | 387 | // The user is allowed to specify values that aren't in the list. |
371 | 388 | if (!array_key_exists($selected, $rela_codes)) { |
@@ -383,7 +400,8 @@ discard block |
||
383 | 400 | * |
384 | 401 | * @return string |
385 | 402 | */ |
386 | - public static function removeLinks($gedrec, $xref) { |
|
403 | + public static function removeLinks($gedrec, $xref) |
|
404 | + { |
|
387 | 405 | $gedrec = preg_replace('/\n1 ' . WT_REGEX_TAG . ' @' . $xref . '@(\n[2-9].*)*/', '', $gedrec); |
388 | 406 | $gedrec = preg_replace('/\n2 ' . WT_REGEX_TAG . ' @' . $xref . '@(\n[3-9].*)*/', '', $gedrec); |
389 | 407 | $gedrec = preg_replace('/\n3 ' . WT_REGEX_TAG . ' @' . $xref . '@(\n[4-9].*)*/', '', $gedrec); |
@@ -400,7 +418,8 @@ discard block |
||
400 | 418 | * |
401 | 419 | * @return string |
402 | 420 | */ |
403 | - public static function printCalendarPopup($id) { |
|
421 | + public static function printCalendarPopup($id) |
|
422 | + { |
|
404 | 423 | return |
405 | 424 | ' <a href="#" onclick="cal_toggleDate(\'caldiv' . $id . '\', \'' . $id . '\'); return false;" class="icon-button_calendar" title="' . I18N::translate('Select a date') . '"></a>' . |
406 | 425 | '<div id="caldiv' . $id . '" style="position:absolute;visibility:hidden;background-color:white;z-index:1000;"></div>'; |
@@ -413,7 +432,8 @@ discard block |
||
413 | 432 | * |
414 | 433 | * @return string |
415 | 434 | */ |
416 | - public static function printAddNewMediaLink($element_id) { |
|
435 | + public static function printAddNewMediaLink($element_id) |
|
436 | + { |
|
417 | 437 | return '<a href="#" onclick="pastefield=document.getElementById(\'' . $element_id . '\'); window.open(\'addmedia.php?action=showmediaform\', \'_blank\', edit_window_specs); return false;" class="icon-button_addmedia" title="' . I18N::translate('Create a media object') . '"></a>'; |
418 | 438 | } |
419 | 439 | |
@@ -424,7 +444,8 @@ discard block |
||
424 | 444 | * |
425 | 445 | * @return string |
426 | 446 | */ |
427 | - public static function printAddNewRepositoryLink($element_id) { |
|
447 | + public static function printAddNewRepositoryLink($element_id) |
|
448 | + { |
|
428 | 449 | return '<a href="#" onclick="addnewrepository(document.getElementById(\'' . $element_id . '\')); return false;" class="icon-button_addrepository" title="' . I18N::translate('Create a repository') . '"></a>'; |
429 | 450 | } |
430 | 451 | |
@@ -435,7 +456,8 @@ discard block |
||
435 | 456 | * |
436 | 457 | * @return string |
437 | 458 | */ |
438 | - public static function printAddNewNoteLink($element_id) { |
|
459 | + public static function printAddNewNoteLink($element_id) |
|
460 | + { |
|
439 | 461 | return '<a href="#" onclick="addnewnote(document.getElementById(\'' . $element_id . '\')); return false;" class="icon-button_addnote" title="' . I18N::translate('Create a shared note') . '"></a>'; |
440 | 462 | } |
441 | 463 | |
@@ -446,7 +468,8 @@ discard block |
||
446 | 468 | * |
447 | 469 | * @return string |
448 | 470 | */ |
449 | - public static function printEditNoteLink($note_id) { |
|
471 | + public static function printEditNoteLink($note_id) |
|
472 | + { |
|
450 | 473 | return '<a href="#" onclick="edit_note(\'' . $note_id . '\'); return false;" class="icon-button_note" title="' . I18N::translate('Edit the shared note') . '"></a>'; |
451 | 474 | } |
452 | 475 | |
@@ -457,7 +480,8 @@ discard block |
||
457 | 480 | * |
458 | 481 | * @return string |
459 | 482 | */ |
460 | - public static function printAddNewSourceLink($element_id) { |
|
483 | + public static function printAddNewSourceLink($element_id) |
|
484 | + { |
|
461 | 485 | return '<a href="#" onclick="addnewsource(document.getElementById(\'' . $element_id . '\')); return false;" class="icon-button_addsource" title="' . I18N::translate('Create a source') . '"></a>'; |
462 | 486 | } |
463 | 487 | |
@@ -480,7 +504,8 @@ discard block |
||
480 | 504 | * |
481 | 505 | * @return string |
482 | 506 | */ |
483 | - public static function addSimpleTag($tag, $upperlevel = '', $label = '', $extra = null, Individual $person = null) { |
|
507 | + public static function addSimpleTag($tag, $upperlevel = '', $label = '', $extra = null, Individual $person = null) |
|
508 | + { |
|
484 | 509 | global $tags, $main_fact, $xref, $bdm, $action, $WT_TREE; |
485 | 510 | |
486 | 511 | // Keep track of SOUR fields, so we can reference them in subsequent PAGE fields. |
@@ -964,7 +989,8 @@ discard block |
||
964 | 989 | * @param string $locale - Sort the censuses for this locale |
965 | 990 | * @param string $xref - The individual for whom we are adding a census |
966 | 991 | */ |
967 | - public static function censusDateSelector($locale, $xref) { |
|
992 | + public static function censusDateSelector($locale, $xref) |
|
993 | + { |
|
968 | 994 | global $controller; |
969 | 995 | |
970 | 996 | // Show more likely census details at the top of the list. |
@@ -1049,7 +1075,8 @@ discard block |
||
1049 | 1075 | * @param int $level |
1050 | 1076 | * @param string $parent_tag |
1051 | 1077 | */ |
1052 | - public static function printAddLayer($tag, $level = 2, $parent_tag = '') { |
|
1078 | + public static function printAddLayer($tag, $level = 2, $parent_tag = '') |
|
1079 | + { |
|
1053 | 1080 | global $WT_TREE; |
1054 | 1081 | |
1055 | 1082 | switch ($tag) { |
@@ -1152,7 +1179,8 @@ discard block |
||
1152 | 1179 | * |
1153 | 1180 | * @param string $fact |
1154 | 1181 | */ |
1155 | - public static function addSimpleTags($fact) { |
|
1182 | + public static function addSimpleTags($fact) |
|
1183 | + { |
|
1156 | 1184 | global $WT_TREE; |
1157 | 1185 | |
1158 | 1186 | // For new individuals, these facts default to "Y" |
@@ -1185,7 +1213,8 @@ discard block |
||
1185 | 1213 | * |
1186 | 1214 | * @return string |
1187 | 1215 | */ |
1188 | - public static function addNewName() { |
|
1216 | + public static function addNewName() |
|
1217 | + { |
|
1189 | 1218 | global $WT_TREE; |
1190 | 1219 | |
1191 | 1220 | $gedrec = "\n1 NAME " . Filter::post('NAME'); |
@@ -1217,7 +1246,8 @@ discard block |
||
1217 | 1246 | * |
1218 | 1247 | * @return string |
1219 | 1248 | */ |
1220 | - public static function addNewSex() { |
|
1249 | + public static function addNewSex() |
|
1250 | + { |
|
1221 | 1251 | switch (Filter::post('SEX', '[MF]', 'U')) { |
1222 | 1252 | case 'M': |
1223 | 1253 | return "\n1 SEX M"; |
@@ -1235,7 +1265,8 @@ discard block |
||
1235 | 1265 | * |
1236 | 1266 | * @return string |
1237 | 1267 | */ |
1238 | - public static function addNewFact($fact) { |
|
1268 | + public static function addNewFact($fact) |
|
1269 | + { |
|
1239 | 1270 | global $WT_TREE; |
1240 | 1271 | |
1241 | 1272 | $FACT = Filter::post($fact); |
@@ -1305,7 +1336,8 @@ discard block |
||
1305 | 1336 | * - $islinkRest[] - an array of 1 or 0 values to indicate when the text is a link element |
1306 | 1337 | * - $textRest[] - an array of the text data for each line |
1307 | 1338 | */ |
1308 | - public static function splitSource() { |
|
1339 | + public static function splitSource() |
|
1340 | + { |
|
1309 | 1341 | global $glevels, $tag, $islink, $text; |
1310 | 1342 | global $glevelsSOUR, $tagSOUR, $islinkSOUR, $textSOUR; |
1311 | 1343 | global $glevelsRest, $tagRest, $islinkRest, $textRest; |
@@ -1363,7 +1395,8 @@ discard block |
||
1363 | 1395 | * |
1364 | 1396 | * @return string |
1365 | 1397 | */ |
1366 | - public static function updateSource($inputRec, $levelOverride = 'no') { |
|
1398 | + public static function updateSource($inputRec, $levelOverride = 'no') |
|
1399 | + { |
|
1367 | 1400 | global $glevels, $tag, $islink, $text; |
1368 | 1401 | global $glevelsSOUR, $tagSOUR, $islinkSOUR, $textSOUR; |
1369 | 1402 | |
@@ -1403,7 +1436,8 @@ discard block |
||
1403 | 1436 | * |
1404 | 1437 | * @return string |
1405 | 1438 | */ |
1406 | - public static function updateRest($inputRec, $levelOverride = 'no') { |
|
1439 | + public static function updateRest($inputRec, $levelOverride = 'no') |
|
1440 | + { |
|
1407 | 1441 | global $glevels, $tag, $islink, $text; |
1408 | 1442 | global $glevelsRest, $tagRest, $islinkRest, $textRest; |
1409 | 1443 | |
@@ -1458,7 +1492,8 @@ discard block |
||
1458 | 1492 | * |
1459 | 1493 | * @return string The updated gedcom record |
1460 | 1494 | */ |
1461 | - public static function handleUpdates($newged, $levelOverride = 'no') { |
|
1495 | + public static function handleUpdates($newged, $levelOverride = 'no') |
|
1496 | + { |
|
1462 | 1497 | global $glevels, $islink, $tag, $uploaded_files, $text; |
1463 | 1498 | |
1464 | 1499 | if ($levelOverride === 'no' || count($glevels) === 0) { |
@@ -1532,7 +1567,8 @@ discard block |
||
1532 | 1567 | * |
1533 | 1568 | * @param string $fact the new fact we are adding |
1534 | 1569 | */ |
1535 | - public static function createAddForm($fact) { |
|
1570 | + public static function createAddForm($fact) |
|
1571 | + { |
|
1536 | 1572 | global $tags, $WT_TREE; |
1537 | 1573 | |
1538 | 1574 | $tags = array(); |
@@ -1576,7 +1612,8 @@ discard block |
||
1576 | 1612 | * |
1577 | 1613 | * @return string |
1578 | 1614 | */ |
1579 | - public static function createEditForm(Fact $fact) { |
|
1615 | + public static function createEditForm(Fact $fact) |
|
1616 | + { |
|
1580 | 1617 | global $tags; |
1581 | 1618 | |
1582 | 1619 | $record = $fact->getParent(); |
@@ -1720,7 +1757,8 @@ discard block |
||
1720 | 1757 | * @param string $level1tag the type of the level 1 gedcom record |
1721 | 1758 | * @param bool $add_date |
1722 | 1759 | */ |
1723 | - public static function insertMissingSubtags($level1tag, $add_date = false) { |
|
1760 | + public static function insertMissingSubtags($level1tag, $add_date = false) |
|
1761 | + { |
|
1724 | 1762 | global $tags, $WT_TREE; |
1725 | 1763 | |
1726 | 1764 | // handle MARRiage TYPE |
@@ -24,7 +24,8 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * Class FunctionsCharts - common functions |
26 | 26 | */ |
27 | -class FunctionsCharts { |
|
27 | +class FunctionsCharts |
|
28 | +{ |
|
28 | 29 | /** |
29 | 30 | * print a table cell with sosa number |
30 | 31 | * |
@@ -32,7 +33,8 @@ discard block |
||
32 | 33 | * @param string $pid optional pid |
33 | 34 | * @param string $arrowDirection direction of link arrow |
34 | 35 | */ |
35 | - public static function printSosaNumber($sosa, $pid = "", $arrowDirection = "up") { |
|
36 | + public static function printSosaNumber($sosa, $pid = "", $arrowDirection = "up") |
|
37 | + { |
|
36 | 38 | if (substr($sosa, -1, 1) == ".") { |
37 | 39 | $personLabel = substr($sosa, 0, -1); |
38 | 40 | } else { |
@@ -71,7 +73,8 @@ discard block |
||
71 | 73 | * @param string $gparid gd-parent ID (descendancy booklet) |
72 | 74 | * @param int $show_full large or small box |
73 | 75 | */ |
74 | - public static function printFamilyParents(Family $family, $sosa = 0, $label = '', $parid = '', $gparid = '', $show_full = 1) { |
|
76 | + public static function printFamilyParents(Family $family, $sosa = 0, $label = '', $parid = '', $gparid = '', $show_full = 1) |
|
77 | + { |
|
75 | 78 | |
76 | 79 | if ($show_full) { |
77 | 80 | $pbheight = Theme::theme()->parameter('chart-box-y') + 14; |
@@ -280,7 +283,8 @@ discard block |
||
280 | 283 | * @param int $show_cousins display cousins on chart |
281 | 284 | * @param int $show_full large or small box |
282 | 285 | */ |
283 | - public static function printFamilyChildren(Family $family, $childid = '', $sosa = 0, $label = '', $show_cousins = 0, $show_full = 1) { |
|
286 | + public static function printFamilyChildren(Family $family, $childid = '', $sosa = 0, $label = '', $show_cousins = 0, $show_full = 1) |
|
287 | + { |
|
284 | 288 | |
285 | 289 | if ($show_full) { |
286 | 290 | $bheight = Theme::theme()->parameter('chart-box-y'); |
@@ -425,7 +429,8 @@ discard block |
||
425 | 429 | * @param int $show_cousins display cousins on chart |
426 | 430 | * @param int $show_full large or small box |
427 | 431 | */ |
428 | - public static function printSosaFamily($famid, $childid, $sosa, $label = '', $parid = '', $gparid = '', $show_cousins = 0, $show_full = 1) { |
|
432 | + public static function printSosaFamily($famid, $childid, $sosa, $label = '', $parid = '', $gparid = '', $show_cousins = 0, $show_full = 1) |
|
433 | + { |
|
429 | 434 | global $WT_TREE; |
430 | 435 | |
431 | 436 | echo '<hr>'; |
@@ -448,7 +453,8 @@ discard block |
||
448 | 453 | * @param string $label arrow label |
449 | 454 | * @param int $dir arrow direction 0=left 1=right 2=up 3=down (default=2) |
450 | 455 | */ |
451 | - public static function printUrlArrow($url, $label, $dir = 2) { |
|
456 | + public static function printUrlArrow($url, $label, $dir = 2) |
|
457 | + { |
|
452 | 458 | if ($url === '') { |
453 | 459 | return; |
454 | 460 | } |
@@ -477,7 +483,8 @@ discard block |
||
477 | 483 | * |
478 | 484 | * @return string |
479 | 485 | */ |
480 | - public static function getSosaName($sosa) { |
|
486 | + public static function getSosaName($sosa) |
|
487 | + { |
|
481 | 488 | $path = ''; |
482 | 489 | while ($sosa > 1) { |
483 | 490 | if ($sosa % 2 == 1) { |
@@ -498,7 +505,8 @@ discard block |
||
498 | 505 | * @param string $famid family ID |
499 | 506 | * @param int $show_full large or small box |
500 | 507 | */ |
501 | - public static function printCousins($famid, $show_full = 1) { |
|
508 | + public static function printCousins($famid, $show_full = 1) |
|
509 | + { |
|
502 | 510 | global $WT_TREE; |
503 | 511 | |
504 | 512 | if ($show_full) { |
@@ -22,7 +22,8 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Provide an interface to the wt_gedcom table. |
24 | 24 | */ |
25 | -class Tree { |
|
25 | +class Tree |
|
26 | +{ |
|
26 | 27 | /** @var int The tree's ID number */ |
27 | 28 | private $tree_id; |
28 | 29 | |
@@ -58,7 +59,8 @@ discard block |
||
58 | 59 | * @param string $tree_name |
59 | 60 | * @param string $tree_title |
60 | 61 | */ |
61 | - private function __construct($tree_id, $tree_name, $tree_title) { |
|
62 | + private function __construct($tree_id, $tree_name, $tree_title) |
|
63 | + { |
|
62 | 64 | $this->tree_id = $tree_id; |
63 | 65 | $this->name = $tree_name; |
64 | 66 | $this->title = $tree_title; |
@@ -97,7 +99,8 @@ discard block |
||
97 | 99 | * |
98 | 100 | * @return int |
99 | 101 | */ |
100 | - public function getTreeId() { |
|
102 | + public function getTreeId() |
|
103 | + { |
|
101 | 104 | return $this->tree_id; |
102 | 105 | } |
103 | 106 | |
@@ -106,7 +109,8 @@ discard block |
||
106 | 109 | * |
107 | 110 | * @return string |
108 | 111 | */ |
109 | - public function getName() { |
|
112 | + public function getName() |
|
113 | + { |
|
110 | 114 | return $this->name; |
111 | 115 | } |
112 | 116 | |
@@ -115,7 +119,8 @@ discard block |
||
115 | 119 | * |
116 | 120 | * @return string |
117 | 121 | */ |
118 | - public function getNameHtml() { |
|
122 | + public function getNameHtml() |
|
123 | + { |
|
119 | 124 | return Filter::escapeHtml($this->name); |
120 | 125 | } |
121 | 126 | |
@@ -124,7 +129,8 @@ discard block |
||
124 | 129 | * |
125 | 130 | * @return string |
126 | 131 | */ |
127 | - public function getNameUrl() { |
|
132 | + public function getNameUrl() |
|
133 | + { |
|
128 | 134 | return Filter::escapeUrl($this->name); |
129 | 135 | } |
130 | 136 | |
@@ -133,7 +139,8 @@ discard block |
||
133 | 139 | * |
134 | 140 | * @return string |
135 | 141 | */ |
136 | - public function getTitle() { |
|
142 | + public function getTitle() |
|
143 | + { |
|
137 | 144 | return $this->title; |
138 | 145 | } |
139 | 146 | |
@@ -142,7 +149,8 @@ discard block |
||
142 | 149 | * |
143 | 150 | * @return string |
144 | 151 | */ |
145 | - public function getTitleHtml() { |
|
152 | + public function getTitleHtml() |
|
153 | + { |
|
146 | 154 | return '<span dir="auto">' . Filter::escapeHtml($this->title) . '</span>'; |
147 | 155 | } |
148 | 156 | |
@@ -151,7 +159,8 @@ discard block |
||
151 | 159 | * |
152 | 160 | * @return int[] |
153 | 161 | */ |
154 | - public function getFactPrivacy() { |
|
162 | + public function getFactPrivacy() |
|
163 | + { |
|
155 | 164 | return $this->fact_privacy; |
156 | 165 | } |
157 | 166 | |
@@ -160,7 +169,8 @@ discard block |
||
160 | 169 | * |
161 | 170 | * @return int[] |
162 | 171 | */ |
163 | - public function getIndividualPrivacy() { |
|
172 | + public function getIndividualPrivacy() |
|
173 | + { |
|
164 | 174 | return $this->individual_privacy; |
165 | 175 | } |
166 | 176 | |
@@ -169,7 +179,8 @@ discard block |
||
169 | 179 | * |
170 | 180 | * @return integer[][] |
171 | 181 | */ |
172 | - public function getIndividualFactPrivacy() { |
|
182 | + public function getIndividualFactPrivacy() |
|
183 | + { |
|
173 | 184 | return $this->individual_fact_privacy; |
174 | 185 | } |
175 | 186 | |
@@ -181,7 +192,8 @@ discard block |
||
181 | 192 | * |
182 | 193 | * @return string|null |
183 | 194 | */ |
184 | - public function getPreference($setting_name, $default = null) { |
|
195 | + public function getPreference($setting_name, $default = null) |
|
196 | + { |
|
185 | 197 | if ($this->preferences === null) { |
186 | 198 | $this->preferences = Database::prepare( |
187 | 199 | "SELECT setting_name, setting_value FROM `##gedcom_setting` WHERE gedcom_id = ?" |
@@ -203,7 +215,8 @@ discard block |
||
203 | 215 | * |
204 | 216 | * @return $this |
205 | 217 | */ |
206 | - public function setPreference($setting_name, $setting_value) { |
|
218 | + public function setPreference($setting_name, $setting_value) |
|
219 | + { |
|
207 | 220 | if ($setting_value !== $this->getPreference($setting_name)) { |
208 | 221 | // Update the database |
209 | 222 | if ($setting_value === null) { |
@@ -241,7 +254,8 @@ discard block |
||
241 | 254 | * |
242 | 255 | * @return string |
243 | 256 | */ |
244 | - public function getUserPreference(User $user, $setting_name, $default = null) { |
|
257 | + public function getUserPreference(User $user, $setting_name, $default = null) |
|
258 | + { |
|
245 | 259 | // There are lots of settings, and we need to fetch lots of them on every page |
246 | 260 | // so it is quicker to fetch them all in one go. |
247 | 261 | if (!array_key_exists($user->getUserId(), $this->user_preferences)) { |
@@ -266,7 +280,8 @@ discard block |
||
266 | 280 | * |
267 | 281 | * @return $this |
268 | 282 | */ |
269 | - public function setUserPreference(User $user, $setting_name, $setting_value) { |
|
283 | + public function setUserPreference(User $user, $setting_name, $setting_value) |
|
284 | + { |
|
270 | 285 | if ($this->getUserPreference($user, $setting_name) !== $setting_value) { |
271 | 286 | // Update the database |
272 | 287 | if ($setting_value === null) { |
@@ -303,7 +318,8 @@ discard block |
||
303 | 318 | * |
304 | 319 | * @return bool |
305 | 320 | */ |
306 | - public function canAcceptChanges(User $user) { |
|
321 | + public function canAcceptChanges(User $user) |
|
322 | + { |
|
307 | 323 | return Auth::isModerator($this, $user); |
308 | 324 | } |
309 | 325 | |
@@ -312,7 +328,8 @@ discard block |
||
312 | 328 | * |
313 | 329 | * @return Tree[] |
314 | 330 | */ |
315 | - public static function getAll() { |
|
331 | + public static function getAll() |
|
332 | + { |
|
316 | 333 | if (self::$trees === null) { |
317 | 334 | self::$trees = array(); |
318 | 335 | $rows = Database::prepare( |
@@ -350,7 +367,8 @@ discard block |
||
350 | 367 | * |
351 | 368 | * @return Tree |
352 | 369 | */ |
353 | - public static function findById($tree_id) { |
|
370 | + public static function findById($tree_id) |
|
371 | + { |
|
354 | 372 | foreach (self::getAll() as $tree) { |
355 | 373 | if ($tree->tree_id == $tree_id) { |
356 | 374 | return $tree; |
@@ -366,7 +384,8 @@ discard block |
||
366 | 384 | * |
367 | 385 | * @return Tree|null |
368 | 386 | */ |
369 | - public static function findByName($tree_name) { |
|
387 | + public static function findByName($tree_name) |
|
388 | + { |
|
370 | 389 | foreach (self::getAll() as $tree) { |
371 | 390 | if ($tree->name === $tree_name) { |
372 | 391 | return $tree; |
@@ -382,7 +401,8 @@ discard block |
||
382 | 401 | * |
383 | 402 | * @return string[] |
384 | 403 | */ |
385 | - public static function getIdList() { |
|
404 | + public static function getIdList() |
|
405 | + { |
|
386 | 406 | $list = array(); |
387 | 407 | foreach (self::getAll() as $tree) { |
388 | 408 | $list[$tree->tree_id] = $tree->title; |
@@ -397,7 +417,8 @@ discard block |
||
397 | 417 | * |
398 | 418 | * @return string[] |
399 | 419 | */ |
400 | - public static function getNameList() { |
|
420 | + public static function getNameList() |
|
421 | + { |
|
401 | 422 | $list = array(); |
402 | 423 | foreach (self::getAll() as $tree) { |
403 | 424 | $list[$tree->name] = $tree->title; |
@@ -414,7 +435,8 @@ discard block |
||
414 | 435 | * |
415 | 436 | * @return Tree |
416 | 437 | */ |
417 | - public static function create($tree_name, $tree_title) { |
|
438 | + public static function create($tree_name, $tree_title) |
|
439 | + { |
|
418 | 440 | try { |
419 | 441 | // Create a new tree |
420 | 442 | Database::prepare( |
@@ -508,7 +530,8 @@ discard block |
||
508 | 530 | * |
509 | 531 | * @return bool |
510 | 532 | */ |
511 | - public function hasPendingEdit() { |
|
533 | + public function hasPendingEdit() |
|
534 | + { |
|
512 | 535 | return (bool) Database::prepare( |
513 | 536 | "SELECT 1 FROM `##change` WHERE status = 'pending' AND gedcom_id = :tree_id" |
514 | 537 | )->execute(array( |
@@ -524,7 +547,8 @@ discard block |
||
524 | 547 | * |
525 | 548 | * @param bool $keep_media |
526 | 549 | */ |
527 | - public function deleteGenealogyData($keep_media) { |
|
550 | + public function deleteGenealogyData($keep_media) |
|
551 | + { |
|
528 | 552 | Database::prepare("DELETE FROM `##gedcom_chunk` WHERE gedcom_id = ?")->execute(array($this->tree_id)); |
529 | 553 | Database::prepare("DELETE FROM `##individuals` WHERE i_file = ?")->execute(array($this->tree_id)); |
530 | 554 | Database::prepare("DELETE FROM `##families` WHERE f_file = ?")->execute(array($this->tree_id)); |
@@ -547,7 +571,8 @@ discard block |
||
547 | 571 | /** |
548 | 572 | * Delete everything relating to a tree |
549 | 573 | */ |
550 | - public function delete() { |
|
574 | + public function delete() |
|
575 | + { |
|
551 | 576 | // If this is the default tree, then unset it |
552 | 577 | if (Site::getPreference('DEFAULT_GEDCOM') === $this->name) { |
553 | 578 | Site::setPreference('DEFAULT_GEDCOM', ''); |
@@ -576,7 +601,8 @@ discard block |
||
576 | 601 | * |
577 | 602 | * @param resource $stream |
578 | 603 | */ |
579 | - public function exportGedcom($stream) { |
|
604 | + public function exportGedcom($stream) |
|
605 | + { |
|
580 | 606 | $stmt = Database::prepare( |
581 | 607 | "SELECT i_gedcom AS gedcom, i_id AS xref, 1 AS n FROM `##individuals` WHERE i_file = :tree_id_1" . |
582 | 608 | " UNION ALL " . |
@@ -616,7 +642,8 @@ discard block |
||
616 | 642 | * |
617 | 643 | * @throws \Exception |
618 | 644 | */ |
619 | - public function importGedcomFile($path, $filename) { |
|
645 | + public function importGedcomFile($path, $filename) |
|
646 | + { |
|
620 | 647 | // Read the file in blocks of roughly 64K. Ensure that each block |
621 | 648 | // contains complete gedcom records. This will ensure we don’t split |
622 | 649 | // multi-byte characters, as well as simplifying the code to import |
@@ -664,7 +691,8 @@ discard block |
||
664 | 691 | * |
665 | 692 | * @return string |
666 | 693 | */ |
667 | - public function getNewXref($type = 'INDI') { |
|
694 | + public function getNewXref($type = 'INDI') |
|
695 | + { |
|
668 | 696 | /** @var string[] Which tree preference is used for which record type */ |
669 | 697 | static $type_to_preference = array( |
670 | 698 | 'INDI' => 'GEDCOM_ID_PREFIX', |
@@ -747,7 +775,8 @@ discard block |
||
747 | 775 | * |
748 | 776 | * @return GedcomRecord |
749 | 777 | */ |
750 | - public function createRecord($gedcom) { |
|
778 | + public function createRecord($gedcom) |
|
779 | + { |
|
751 | 780 | if (preg_match('/^0 @(' . WT_REGEX_XREF . ')@ (' . WT_REGEX_TAG . ')/', $gedcom, $match)) { |
752 | 781 | $xref = $match[1]; |
753 | 782 | $type = $match[2]; |
@@ -22,7 +22,8 @@ discard block |
||
22 | 22 | * Father: Jose /CCCC/ /DDDD/ |
23 | 23 | * Child: Pablo /CCCC/ /AAAA/ |
24 | 24 | */ |
25 | -class SpanishSurnameTradition extends DefaultSurnameTradition implements SurnameTraditionInterface { |
|
25 | +class SpanishSurnameTradition extends DefaultSurnameTradition implements SurnameTraditionInterface |
|
26 | +{ |
|
26 | 27 | /** |
27 | 28 | * What names are given to a new child |
28 | 29 | * |
@@ -32,7 +33,8 @@ discard block |
||
32 | 33 | * |
33 | 34 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
34 | 35 | */ |
35 | - public function newChildNames($father_name, $mother_name, $child_sex) { |
|
36 | + public function newChildNames($father_name, $mother_name, $child_sex) |
|
37 | + { |
|
36 | 38 | if (preg_match(self::REGEX_SURNS, $father_name, $match_father)) { |
37 | 39 | $father_surname = $match_father['SURN1']; |
38 | 40 | } else { |
@@ -59,7 +61,8 @@ discard block |
||
59 | 61 | * |
60 | 62 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
61 | 63 | */ |
62 | - public function newParentNames($child_name, $parent_sex) { |
|
64 | + public function newParentNames($child_name, $parent_sex) |
|
65 | + { |
|
63 | 66 | if (preg_match(self::REGEX_SURNS, $child_name, $match)) { |
64 | 67 | switch ($parent_sex) { |
65 | 68 | case 'M': |
@@ -88,7 +91,8 @@ discard block |
||
88 | 91 | * |
89 | 92 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
90 | 93 | */ |
91 | - public function newSpouseNames($spouse_name, $spouse_sex) { |
|
94 | + public function newSpouseNames($spouse_name, $spouse_sex) |
|
95 | + { |
|
92 | 96 | return array( |
93 | 97 | 'NAME' => '// //', |
94 | 98 | ); |
@@ -18,13 +18,15 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Children take their father’s surname. Wives take their husband’s surname. |
20 | 20 | */ |
21 | -class PaternalSurnameTradition extends PatrilinealSurnameTradition implements SurnameTraditionInterface { |
|
21 | +class PaternalSurnameTradition extends PatrilinealSurnameTradition implements SurnameTraditionInterface |
|
22 | +{ |
|
22 | 23 | /** |
23 | 24 | * Does this surname tradition change surname at marriage? |
24 | 25 | * |
25 | 26 | * @return bool |
26 | 27 | */ |
27 | - public function hasMarriedNames() { |
|
28 | + public function hasMarriedNames() |
|
29 | + { |
|
28 | 30 | return true; |
29 | 31 | } |
30 | 32 | |
@@ -36,7 +38,8 @@ discard block |
||
36 | 38 | * |
37 | 39 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
38 | 40 | */ |
39 | - public function newParentNames($child_name, $parent_sex) { |
|
41 | + public function newParentNames($child_name, $parent_sex) |
|
42 | + { |
|
40 | 43 | if (preg_match(self::REGEX_SPFX_SURN, $child_name, $match)) { |
41 | 44 | switch ($parent_sex) { |
42 | 45 | case 'M': |
@@ -66,7 +69,8 @@ discard block |
||
66 | 69 | * |
67 | 70 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
68 | 71 | */ |
69 | - public function newSpouseNames($spouse_name, $spouse_sex) { |
|
72 | + public function newSpouseNames($spouse_name, $spouse_sex) |
|
73 | + { |
|
70 | 74 | if ($spouse_sex === 'F' && preg_match(self::REGEX_SURN, $spouse_name, $match)) { |
71 | 75 | return array( |
72 | 76 | 'NAME' => '//', |