xref: /webtrees/app/Gedcom.php (revision 89f7189b61a494347591c99bdb92afb7d8b66e1b)
10f471f91SGreg Roach<?php
23976b470SGreg Roach
30f471f91SGreg Roach/**
40f471f91SGreg Roach * webtrees: online genealogy
590949315SGreg Roach * Copyright (C) 2021 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
15*89f7189bSGreg 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    // Use MSDOS style line endings, for maximum compatibility.
2816d6367aSGreg Roach    public const EOL = "\r\n";
290f471f91SGreg Roach
300f471f91SGreg Roach    // 255 less the EOL character.
3116d6367aSGreg Roach    public const LINE_LENGTH = 253;
328d0ebef0SGreg Roach
338d0ebef0SGreg Roach    // Gedcom tags which indicate the start of life.
3416d6367aSGreg Roach    public const BIRTH_EVENTS = ['BIRT', 'CHR', 'BAPM', 'ADOP'];
358d0ebef0SGreg Roach
368d0ebef0SGreg Roach    // Gedcom tags which indicate the end of life.
3716d6367aSGreg Roach    public const DEATH_EVENTS = ['DEAT', 'BURI', 'CREM'];
388d0ebef0SGreg Roach
398d0ebef0SGreg Roach    // Gedcom tags which indicate the start of a relationship.
4016d6367aSGreg Roach    public const MARRIAGE_EVENTS = ['MARR', '_NMR'];
418d0ebef0SGreg Roach
428d0ebef0SGreg Roach    // Gedcom tags which indicate the end of a relationship.
4316d6367aSGreg Roach    public const DIVORCE_EVENTS = ['DIV', 'ANUL', '_SEPR'];
448d0ebef0SGreg Roach
458d0ebef0SGreg Roach    // Regular expression to match a GEDCOM tag.
4616d6367aSGreg Roach    public const REGEX_TAG = '[_A-Z][_A-Z0-9]*';
478d0ebef0SGreg Roach
488d0ebef0SGreg Roach    // Regular expression to match a GEDCOM XREF.
49f81cefe9SGreg Roach    public const REGEX_XREF = '[A-Za-z0-9:_.-]{1,20}';
508d0ebef0SGreg Roach
518d0ebef0SGreg Roach    // UTF-8 encoded files may begin with an optional byte-order-mark (U+FEFF).
5216d6367aSGreg Roach    public const UTF8_BOM = "\xEF\xBB\xBF";
53ead61980SGreg Roach
54ead61980SGreg Roach    // Separates parts of a place name.
55ead61980SGreg Roach    public const PLACE_SEPARATOR = ', ';
56392561bbSGreg Roach
57392561bbSGreg Roach    // Regex to match a (badly formed) GEDCOM place separator.
5890949315SGreg Roach    public const PLACE_SEPARATOR_REGEX = '/ *,[, ]*/';
5990949315SGreg Roach
6090949315SGreg Roach    // LATI and LONG tags
6190949315SGreg Roach    public const LATITUDE_NORTH = 'N';
6290949315SGreg Roach    public const LATITUDE_SOUTH = 'S';
6390949315SGreg Roach    public const LONGITUDE_EAST = 'E';
6490949315SGreg Roach    public const LONGITUDE_WEST = 'W';
6571f696adSGreg Roach
6671f696adSGreg Roach    // Not all record types allow a CHAN event.
6771f696adSGreg Roach    public const RECORDS_WITH_CHAN = [
6871f696adSGreg Roach        Family::RECORD_TYPE,
6971f696adSGreg Roach        Individual::RECORD_TYPE,
7071f696adSGreg Roach        Media::RECORD_TYPE,
7171f696adSGreg Roach        Note::RECORD_TYPE,
7271f696adSGreg Roach        Repository::RECORD_TYPE,
7371f696adSGreg Roach        Source::RECORD_TYPE,
7471f696adSGreg Roach        Submitter::RECORD_TYPE,
7571f696adSGreg Roach    ];
760f471f91SGreg Roach}
77