1<?php 2 3/** 4 * webtrees: online genealogy 5 * Copyright (C) 2023 webtrees development team 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <https://www.gnu.org/licenses/>. 16 */ 17 18declare(strict_types=1); 19 20namespace Fisharebest\Webtrees\CustomTags; 21 22use Fisharebest\Webtrees\Contracts\CustomTagInterface; 23use Fisharebest\Webtrees\Contracts\ElementInterface; 24use Fisharebest\Webtrees\Elements\Creation; 25use Fisharebest\Webtrees\Elements\CustomElement; 26use Fisharebest\Webtrees\Elements\DateValueExact; 27use Fisharebest\Webtrees\Elements\DateValueToday; 28use Fisharebest\Webtrees\Elements\EmptyElement; 29use Fisharebest\Webtrees\Elements\EventOrFactClassification; 30use Fisharebest\Webtrees\Elements\ExternalIdentifier; 31use Fisharebest\Webtrees\Elements\ExternalIdentifierType; 32use Fisharebest\Webtrees\Elements\FamilyFact; 33use Fisharebest\Webtrees\Elements\FamilyNonEvent; 34use Fisharebest\Webtrees\Elements\LdsInitiatory; 35use Fisharebest\Webtrees\Elements\LdsOrdinanceStatus; 36use Fisharebest\Webtrees\Elements\IndividualNonEvent; 37use Fisharebest\Webtrees\Elements\ResidenceWithValue; 38use Fisharebest\Webtrees\Elements\RoleInEvent; 39use Fisharebest\Webtrees\Elements\TempleCode; 40use Fisharebest\Webtrees\Elements\TimeValue; 41use Fisharebest\Webtrees\Elements\TimeValueNow; 42use Fisharebest\Webtrees\Elements\Uid; 43use Fisharebest\Webtrees\Elements\UserReferenceNumber; 44use Fisharebest\Webtrees\Elements\UserReferenceType; 45use Fisharebest\Webtrees\Elements\XrefAssociate; 46use Fisharebest\Webtrees\Elements\XrefSharedNote; 47use Fisharebest\Webtrees\I18N; 48use Fisharebest\Webtrees\Site; 49 50/** 51 * GEDCOM files created by Gedcom7 52 * 53 * @see https://gedcom.io 54 */ 55class Gedcom7 implements CustomTagInterface 56{ 57 /** 58 * The name of the application. 59 * 60 * @return string 61 */ 62 public function name(): string 63 { 64 return 'Gedcom 7'; 65 } 66 67 /** 68 * Tags created by this application. 69 * 70 * @return array<string,ElementInterface> 71 */ 72 public function tags(): array 73 { 74 $tags = [ 75 'FAM:NO' => new FamilyNonEvent(I18N::translate('Event did not occur')), 76 'INDI:NO' => new IndividualNonEvent(I18N::translate('Event did not occur')), 77 'FAM:*:ASSO' => new XrefAssociate(I18N::translate('Associate')), 78 'FAM:*:ASSO:PHRASE' => new CustomElement(I18N::translate('Phrase')), 79 'FAM:*:ASSO:ROLE' => new RoleInEvent(I18N::translate('Role')), 80 'FAM:*:ASSO:ROLE:PHRASE' => new CustomElement(I18N::translate('Phrase')), 81 'FAM:*:DATE:TIME' => new TimeValue(I18N::translate('Time')), 82 'FAM:*:PLAC:EXID' => new ExternalIdentifier(I18N::translate('External identifier')), 83 'FAM:*:PLAC:EXID:TYPE' => new ExternalIdentifierType(I18N::translate('Type')), 84 'FAM:*:SDATE' => new CustomElement(I18N::translate('Sort date')), 85 'FAM:*:SDATE:PHRASE' => new CustomElement(I18N::translate('Phrase')), 86 'FAM:*:SDATE:TIME' => new CustomElement(I18N::translate('Sort time')), 87 'FAM:*:SNOTE' => new XrefSharedNote(I18N::translate('Shared note')), 88 'FAM:*:UID' => new Uid(I18N::translate('Unique identifier')), 89 'FAM:ASSO' => new XrefAssociate(I18N::translate('Associate')), 90 'FAM:ASSO:PHRASE' => new CustomElement(I18N::translate('Phrase')), 91 'FAM:ASSO:ROLE' => new RoleInEvent(I18N::translate('Role')), 92 'FAM:ASSO:ROLE:PHRASE' => new CustomElement(I18N::translate('Phrase')), 93 'FAM:CREA' => new Creation(I18N::translate('Created at')), 94 'FAM:CREA:DATE' => new DateValueToday(I18N::translate('Creation date')), 95 'FAM:CREA:DATE:TIME' => new TimeValueNow(I18N::translate('Creation time')), 96 'FAM:EXID' => new ExternalIdentifier(I18N::translate('External identifier')), 97 'FAM:EXID:TYPE' => new ExternalIdentifierType(I18N::translate('Type')), 98 'FAM:FACT' => new FamilyFact(I18N::translate('Fact')), 99 'FAM:FACT:TYPE' => new EventOrFactClassification(I18N::translate('Type of fact')), 100 'FAM:REFN' => new UserReferenceNumber(I18N::translate('Reference number')), 101 'FAM:REFN:TYPE' => new UserReferenceType(I18N::translate('Type')), 102 'FAM:SNOTE' => new XrefSharedNote(I18N::translate('Shared note')), 103 'FAM:UID' => new Uid(I18N::translate('Unique identifier')), 104 'HEAD:SCHMA' => new EmptyElement(I18N::translate('Custom GEDCOM tags'), ['TAG' => '0:M']), 105 'HEAD:SCHMA:TAG' => new CustomElement(I18N::translate('GEDCOM tag')), 106 'INDI:*:ASSO' => new XrefAssociate(I18N::translate('Associate')), 107 'INDI:*:ASSO:PHRASE' => new CustomElement(I18N::translate('Phrase')), 108 'INDI:*:ASSO:ROLE' => new RoleInEvent(I18N::translate('Role')), 109 'INDI:*:ASSO:ROLE:PHRASE' => new CustomElement(I18N::translate('Phrase')), 110 'INDI:*:DATE:TIME' => new TimeValue(I18N::translate('Time')), 111 'INDI:*:PLAC:EXID' => new ExternalIdentifier(I18N::translate('External identifier')), 112 'INDI:*:PLAC:EXID:TYPE' => new ExternalIdentifierType(I18N::translate('Type')), 113 'INDI:*:SDATE' => new CustomElement(I18N::translate('Sort date')), 114 'INDI:*:SDATE:PHRASE' => new CustomElement(I18N::translate('Phrase')), 115 'INDI:*:SDATE:TIME' => new CustomElement(I18N::translate('Sort time')), 116 'INDI:*:SNOTE' => new XrefSharedNote(I18N::translate('Shared note')), 117 'INDI:*:UID' => new Uid(I18N::translate('Unique identifier')), 118 'INDI:ADOP:FAMC:ADOP:PHRASE' => new CustomElement(I18N::translate('Phrase')), 119 'INDI:ALIA:PHRASE' => new CustomElement(I18N::translate('Phrase')), 120 'INDI:ASSO' => new XrefAssociate(I18N::translate('Associate')), 121 'INDI:ASSO:PHRASE' => new CustomElement(I18N::translate('Phrase')), 122 'INDI:ASSO:ROLE' => new RoleInEvent(I18N::translate('Role')), 123 'INDI:ASSO:ROLE:PHRASE' => new CustomElement(I18N::translate('Phrase')), 124 'INDI:BIRT:DATE:TIME' => new TimeValue(I18N::translate('Time of birth')), 125 'INDI:CREA' => new Creation(I18N::translate('Created at')), 126 'INDI:CREA:DATE' => new DateValueToday(I18N::translate('Creation date')), 127 'INDI:CREA:DATE:TIME' => new TimeValueNow(I18N::translate('Creation time')), 128 'INDI:DEAT:DATE:TIME' => new TimeValue(I18N::translate('Time of death')), 129 'INDI:EXID' => new ExternalIdentifier(I18N::translate('External identifier')), 130 'INDI:EXID:TYPE' => new ExternalIdentifierType(I18N::translate('Type')), 131 'INDI:INIL' => /* I18N: GEDCOM tag INIL - an LDS ceremony */ new LdsInitiatory(I18N::translate('LDS initiatory')), 132 'INDI:INIL:STAT' => new LdsOrdinanceStatus(I18N::translate('Status')), 133 'INDI:INIL:STAT:DATE' => new DateValueExact(I18N::translate('Date of status change')), 134 'INDI:INIL:STAT:DATE:TIME' => new TimeValue(I18N::translate('Time of status change')), 135 'INDI:INIL:TEMP' => new TempleCode(I18N::translate('Temple')), 136 'INDI:REFN' => new UserReferenceNumber(I18N::translate('Reference number')), 137 'INDI:REFN:TYPE' => new UserReferenceType(I18N::translate('Type')), 138 'INDI:SNOTE' => new XrefSharedNote(I18N::translate('Shared note')), 139 'INDI:UID' => new Uid(I18N::translate('Unique identifier')), 140 'OBJE:CREA' => new Creation(I18N::translate('Created at')), 141 'OBJE:CREA:DATE' => new DateValueToday(I18N::translate('Creation date')), 142 'OBJE:CREA:DATE:TIME' => new TimeValueNow(I18N::translate('Creation time')), 143 'OBJE:SNOTE' => new XrefSharedNote(I18N::translate('Shared note')), 144 'REPO:CREA' => new Creation(I18N::translate('Created at')), 145 'REPO:CREA:DATE' => new DateValueToday(I18N::translate('Creation date')), 146 'REPO:CREA:DATE:TIME' => new TimeValueNow(I18N::translate('Creation time')), 147 'REPO:EXID' => new ExternalIdentifier(I18N::translate('External identifier')), 148 'REPO:EXID:TYPE' => new ExternalIdentifierType(I18N::translate('Type')), 149 'REPO:REFN' => new UserReferenceNumber(I18N::translate('Reference number')), 150 'REPO:REFN:TYPE' => new UserReferenceType(I18N::translate('Type')), 151 'REPO:SNOTE' => new XrefSharedNote(I18N::translate('Shared note')), 152 'REPO:UID' => new Uid(I18N::translate('Unique identifier')), 153 'SNOTE:CREA' => new Creation(I18N::translate('Created at')), 154 'SNOTE:CREA:DATE' => new DateValueToday(I18N::translate('Creation date')), 155 'SNOTE:CREA:DATE:TIME' => new TimeValueNow(I18N::translate('Creation time')), 156 'SNOTE:EXID' => new ExternalIdentifier(I18N::translate('External identifier')), 157 'SNOTE:EXID:TYPE' => new ExternalIdentifierType(I18N::translate('Type')), 158 'SNOTE:REFN' => new UserReferenceNumber(I18N::translate('Reference number')), 159 'SNOTE:REFN:TYPE' => new UserReferenceType(I18N::translate('Type')), 160 'SNOTE:UID' => new Uid(I18N::translate('Unique identifier')), 161 'SOUR:CREA' => new Creation(I18N::translate('Created at')), 162 'SOUR:CREA:DATE' => new DateValueToday(I18N::translate('Creation date')), 163 'SOUR:CREA:DATE:TIME' => new TimeValueNow(I18N::translate('Creation time')), 164 'SOUR:EXID' => new ExternalIdentifier(I18N::translate('External identifier')), 165 'SOUR:EXID:TYPE' => new ExternalIdentifierType(I18N::translate('Type')), 166 'SOUR:REFN' => new UserReferenceNumber(I18N::translate('Reference number')), 167 'SOUR:REFN:TYPE' => new UserReferenceType(I18N::translate('Type')), 168 'SOUR:SNOTE' => new XrefSharedNote(I18N::translate('Shared note')), 169 'SOUR:UID' => new Uid(I18N::translate('Unique identifier')), 170 'SUBM:CREA' => new Creation(I18N::translate('Created at')), 171 'SUBM:CREA:DATE' => new DateValueToday(I18N::translate('Creation date')), 172 'SUBM:CREA:DATE:TIME' => new TimeValueNow(I18N::translate('Creation time')), 173 'SUBM:EXID' => new ExternalIdentifier(I18N::translate('External identifier')), 174 'SUBM:EXID:TYPE' => new ExternalIdentifierType(I18N::translate('Type')), 175 'SUBM:REFN' => new UserReferenceNumber(I18N::translate('Reference number')), 176 'SUBM:REFN:TYPE' => new UserReferenceType(I18N::translate('Type')), 177 'SUBM:SNOTE' => new XrefSharedNote(I18N::translate('Shared note')), 178 'SUBM:UID' => new Uid(I18N::translate('Unique identifier')), 179 ]; 180 181 if (Site::getPreference('CUSTOM_RESI_VALUE') === '1') { 182 if (Site::getPreference('HIDE_FAM_RESI') !== '1') { 183 $tags['FAM:RESI'] = new ResidenceWithValue(I18N::translate('Family residence')); 184 } 185 186 $tags['INDI:RESI'] = new ResidenceWithValue(I18N::translate('Residence')); 187 } 188 189 return $tags; 190 } 191} 192