xref: /webtrees/app/Gedcom.php (revision 5bfc689774bb9a6401271c4ed15a6d50652c991b)
10f471f91SGreg Roach<?php
23976b470SGreg Roach
30f471f91SGreg Roach/**
40f471f91SGreg Roach * webtrees: online genealogy
5*5bfc6897SGreg Roach * Copyright (C) 2022 webtrees development team
60f471f91SGreg Roach * This program is free software: you can redistribute it and/or modify
70f471f91SGreg Roach * it under the terms of the GNU General Public License as published by
80f471f91SGreg Roach * the Free Software Foundation, either version 3 of the License, or
90f471f91SGreg Roach * (at your option) any later version.
100f471f91SGreg Roach * This program is distributed in the hope that it will be useful,
110f471f91SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
120f471f91SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
130f471f91SGreg Roach * GNU General Public License for more details.
140f471f91SGreg Roach * You should have received a copy of the GNU General Public License
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
160f471f91SGreg Roach */
17fcfa147eSGreg Roach
18e7f56f2aSGreg Roachdeclare(strict_types=1);
19e7f56f2aSGreg Roach
200f471f91SGreg Roachnamespace Fisharebest\Webtrees;
210f471f91SGreg Roach
220f471f91SGreg Roach/**
230f471f91SGreg Roach * GEDCOM 5.5.1 specification
240f471f91SGreg Roach */
25c1010edaSGreg Roachclass Gedcom
26c1010edaSGreg Roach{
270f471f91SGreg Roach    // 255 less the EOL character.
2816d6367aSGreg Roach    public const LINE_LENGTH = 253;
298d0ebef0SGreg Roach
308d0ebef0SGreg Roach    // Gedcom tags which indicate the start of life.
3169d5bee2SGreg Roach    public const BIRTH_EVENTS = ['BIRT', 'CHR', 'BAPM'];
328d0ebef0SGreg Roach
338d0ebef0SGreg Roach    // Gedcom tags which indicate the end of life.
3416d6367aSGreg Roach    public const DEATH_EVENTS = ['DEAT', 'BURI', 'CREM'];
358d0ebef0SGreg Roach
368d0ebef0SGreg Roach    // Gedcom tags which indicate the start of a relationship.
3716d6367aSGreg Roach    public const MARRIAGE_EVENTS = ['MARR', '_NMR'];
388d0ebef0SGreg Roach
398d0ebef0SGreg Roach    // Gedcom tags which indicate the end of a relationship.
4016d6367aSGreg Roach    public const DIVORCE_EVENTS = ['DIV', 'ANUL', '_SEPR'];
418d0ebef0SGreg Roach
428d0ebef0SGreg Roach    // Regular expression to match a GEDCOM tag.
4316d6367aSGreg Roach    public const REGEX_TAG = '[_A-Z][_A-Z0-9]*';
448d0ebef0SGreg Roach
458d0ebef0SGreg Roach    // Regular expression to match a GEDCOM XREF.
46f81cefe9SGreg Roach    public const REGEX_XREF = '[A-Za-z0-9:_.-]{1,20}';
478d0ebef0SGreg Roach
481c6adce8SGreg Roach    // Separates the parts of a place name.
49ead61980SGreg Roach    public const PLACE_SEPARATOR = ', ';
50392561bbSGreg Roach
51392561bbSGreg Roach    // Regex to match a (badly formed) GEDCOM place separator.
5290949315SGreg Roach    public const PLACE_SEPARATOR_REGEX = '/ *,[, ]*/';
5390949315SGreg Roach
5490949315SGreg Roach    // LATI and LONG tags
5590949315SGreg Roach    public const LATITUDE_NORTH = 'N';
5690949315SGreg Roach    public const LATITUDE_SOUTH = 'S';
5790949315SGreg Roach    public const LONGITUDE_EAST = 'E';
5890949315SGreg Roach    public const LONGITUDE_WEST = 'W';
5971f696adSGreg Roach
6071f696adSGreg Roach    // Not all record types allow a CHAN event.
6171f696adSGreg Roach    public const RECORDS_WITH_CHAN = [
6271f696adSGreg Roach        Family::RECORD_TYPE,
6371f696adSGreg Roach        Individual::RECORD_TYPE,
6471f696adSGreg Roach        Media::RECORD_TYPE,
6571f696adSGreg Roach        Note::RECORD_TYPE,
6671f696adSGreg Roach        Repository::RECORD_TYPE,
6771f696adSGreg Roach        Source::RECORD_TYPE,
6871f696adSGreg Roach        Submitter::RECORD_TYPE,
6971f696adSGreg Roach    ];
70c8183f29SGreg Roach
71c8183f29SGreg Roach    // These preferences control multiple tag definitions
72c8183f29SGreg Roach    public const HIDDEN_TAGS = [
73c8183f29SGreg Roach        // Individual names
74c8183f29SGreg Roach        'NAME_NPFX' => ['INDI:NAME:NPFX', 'INDI:NAME:FONE:NPFX', 'INDI:NAME:ROMN:NPFX'],
75c8183f29SGreg Roach        'NAME_SPFX' => ['INDI:NAME:SPFX', 'INDI:NAME:FONE:SPFX', 'INDI:NAME:ROMN:SPFX'],
76c8183f29SGreg Roach        'NAME_NSFX' => ['INDI:NAME:NSFX', 'INDI:NAME:FONE:NSFX', 'INDI:NAME:ROMN:NSFX'],
77c8183f29SGreg Roach        'NAME_NICK' => ['INDI:NAME:NICK', 'INDI:NAME:FONE:NICK', 'INDI:NAME:ROMN:NICK'],
78c8183f29SGreg Roach        'NAME_FONE' => ['INDI:NAME:FONE'],
79c8183f29SGreg Roach        'NAME_ROMN' => ['INDI:NAME:ROMN'],
80c8183f29SGreg Roach        'NAME_NOTE' => ['INDI:NAME:NOTE'],
81c8183f29SGreg Roach        'NAME_SOUR' => ['INDI:NAME:SOUR'],
82c8183f29SGreg Roach        // Places
83c8183f29SGreg Roach        'PLAC_MAP'  => ['PLAC:MAP'],
84c8183f29SGreg Roach        'PLAC_FONE' => ['PLAC:FONE'],
85c8183f29SGreg Roach        'PLAC_ROMN' => ['PLAC:ROMN'],
86676cffa0SGreg Roach        'PLAC_FORM' => ['PLAC:FORM', 'HEAD:PLAC'],
87c8183f29SGreg Roach        'PLAC_NOTE' => ['PLAC:NOTE'],
88c8183f29SGreg Roach        // Addresses
89c8183f29SGreg Roach        'ADDR_FAX'  => ['FAX'],
90c8183f29SGreg Roach        'ADDR_PHON' => ['PHON'],
91c8183f29SGreg Roach        'ADDR_WWW'  => ['WWW'],
92c8183f29SGreg Roach        // Source citations
93c8183f29SGreg Roach        'SOUR_EVEN' => [':SOUR:EVEN'],
94c8183f29SGreg Roach        'SOUR_DATE' => [':SOUR:DATA:DATE'],
95c8183f29SGreg Roach        'SOUR_NOTE' => [':SOUR:NOTE'],
96c8183f29SGreg Roach        'SOUR_QUAY' => [':SOUR:QUAY'],
97c8183f29SGreg Roach        // Sources
9840c249dcSGreg Roach        'SOUR_DATA' => ['SOUR:DATA:EVEN', 'SOUR:DATA:AGNC', 'SOUR:DATA:NOTE'],
99c8183f29SGreg Roach        // Individuals
100c8183f29SGreg Roach        'BIRT_FAMC' => ['INDI:BIRT:FAMC'],
101c8183f29SGreg Roach        'RELI'      => ['INDI:RELI'],
102c8183f29SGreg Roach        'BAPM'      => ['INDI:BAPM'],
103c8183f29SGreg Roach        'CHR'       => ['INDI:CHR', 'INDI:CHRA'],
104c8183f29SGreg Roach        'FCOM'      => ['INDI:FCOM', 'INDI:CONF'],
105c8183f29SGreg Roach        'ORDN'      => ['INDI:ORDN'],
106c8183f29SGreg Roach        'BARM'      => ['INDI:BARM', 'INDI:BASM'],
107c8183f29SGreg Roach        'ALIA'      => ['INDI:ALIA'],
108c8183f29SGreg Roach        'ASSO'      => ['INDI:ASSO'],
109c8183f29SGreg Roach        // Families
110c8183f29SGreg Roach        'ENGA'      => ['FAM:ENGA'],
111c8183f29SGreg Roach        'MARB'      => ['FAM:MARB'],
112c8183f29SGreg Roach        'MARC'      => ['FAM:MARC'],
113c8183f29SGreg Roach        'MARL'      => ['FAM:MARL'],
114c8183f29SGreg Roach        'MARS'      => ['FAM:MARS'],
115c8183f29SGreg Roach        'ANUL'      => ['FAM:ANUL'],
116c8183f29SGreg Roach        'DIVF'      => ['FAM:DIVF'],
117c8183f29SGreg Roach        'FAM_RESI'  => ['FAM:RESI'],
118c8183f29SGreg Roach        'FAM_CENS'  => ['FAM:CENS'],
119c8183f29SGreg Roach        // LDS church
120c8183f29SGreg Roach        'LDS'       => ['INDI:BAPL', 'INDI:CONL', 'INDI:ENDL', 'INDI:SLGC', 'FAM:SLGS', 'HEAD:SUBN'],
121c8183f29SGreg Roach        // Identifiers
122c8183f29SGreg Roach        'AFN'       => ['INDI:AFN'],
123c8183f29SGreg Roach        'IDNO'      => ['INDI:IDNO'],
124c8183f29SGreg Roach        'SSN'       => ['INDI:SSN'],
125c8183f29SGreg Roach        'RFN'       => ['RFN'],
126c8183f29SGreg Roach        'REFN'      => ['REFN'],
127c8183f29SGreg Roach        'RIN'       => ['RIN'],
128c8183f29SGreg Roach        // Submitters
129c8183f29SGreg Roach        'SUBM'      => ['INDI:SUBM', 'FAM:SUBM'],
130c8183f29SGreg Roach        'ANCI'      => ['INDI:ANCI', 'INDI:DESI'],
131c8183f29SGreg Roach    ];
1320f471f91SGreg Roach}
133