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 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 // 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 ]; 76*c8183f29SGreg Roach 77*c8183f29SGreg Roach // These preferences control multiple tag definitions 78*c8183f29SGreg Roach public const HIDDEN_TAGS = [ 79*c8183f29SGreg Roach // Individual names 80*c8183f29SGreg Roach 'NAME_NPFX' => ['INDI:NAME:NPFX', 'INDI:NAME:FONE:NPFX', 'INDI:NAME:ROMN:NPFX'], 81*c8183f29SGreg Roach 'NAME_SPFX' => ['INDI:NAME:SPFX', 'INDI:NAME:FONE:SPFX', 'INDI:NAME:ROMN:SPFX'], 82*c8183f29SGreg Roach 'NAME_NSFX' => ['INDI:NAME:NSFX', 'INDI:NAME:FONE:NSFX', 'INDI:NAME:ROMN:NSFX'], 83*c8183f29SGreg Roach 'NAME_NICK' => ['INDI:NAME:NICK', 'INDI:NAME:FONE:NICK', 'INDI:NAME:ROMN:NICK'], 84*c8183f29SGreg Roach 'NAME_FONE' => ['INDI:NAME:FONE'], 85*c8183f29SGreg Roach 'NAME_ROMN' => ['INDI:NAME:ROMN'], 86*c8183f29SGreg Roach 'NAME_NOTE' => ['INDI:NAME:NOTE'], 87*c8183f29SGreg Roach 'NAME_SOUR' => ['INDI:NAME:SOUR'], 88*c8183f29SGreg Roach // Places 89*c8183f29SGreg Roach 'PLAC_MAP' => ['PLAC:MAP'], 90*c8183f29SGreg Roach 'PLAC_FONE' => ['PLAC:FONE'], 91*c8183f29SGreg Roach 'PLAC_ROMN' => ['PLAC:ROMN'], 92*c8183f29SGreg Roach 'PLAC_NOTE' => ['PLAC:NOTE'], 93*c8183f29SGreg Roach // Addresses 94*c8183f29SGreg Roach 'ADDR_FAX' => ['FAX'], 95*c8183f29SGreg Roach 'ADDR_PHON' => ['PHON'], 96*c8183f29SGreg Roach 'ADDR_WWW' => ['WWW'], 97*c8183f29SGreg Roach // Source citations 98*c8183f29SGreg Roach 'SOUR_EVEN' => [':SOUR:EVEN'], 99*c8183f29SGreg Roach 'SOUR_DATE' => [':SOUR:DATA:DATE'], 100*c8183f29SGreg Roach 'SOUR_NOTE' => [':SOUR:NOTE'], 101*c8183f29SGreg Roach 'SOUR_QUAY' => [':SOUR:QUAY'], 102*c8183f29SGreg Roach // Sources 103*c8183f29SGreg Roach 'SOUR_DATA' => ['SOUR:DATA'], 104*c8183f29SGreg Roach // Individuals 105*c8183f29SGreg Roach 'BIRT_FAMC' => ['INDI:BIRT:FAMC'], 106*c8183f29SGreg Roach 'RELI' => ['INDI:RELI'], 107*c8183f29SGreg Roach 'BAPM' => ['INDI:BAPM'], 108*c8183f29SGreg Roach 'CHR' => ['INDI:CHR', 'INDI:CHRA'], 109*c8183f29SGreg Roach 'FCOM' => ['INDI:FCOM', 'INDI:CONF'], 110*c8183f29SGreg Roach 'ORDN' => ['INDI:ORDN'], 111*c8183f29SGreg Roach 'BARM' => ['INDI:BARM', 'INDI:BASM'], 112*c8183f29SGreg Roach 'ALIA' => ['INDI:ALIA'], 113*c8183f29SGreg Roach 'ASSO' => ['INDI:ASSO'], 114*c8183f29SGreg Roach // Families 115*c8183f29SGreg Roach 'ENGA' => ['FAM:ENGA'], 116*c8183f29SGreg Roach 'MARB' => ['FAM:MARB'], 117*c8183f29SGreg Roach 'MARC' => ['FAM:MARC'], 118*c8183f29SGreg Roach 'MARL' => ['FAM:MARL'], 119*c8183f29SGreg Roach 'MARS' => ['FAM:MARS'], 120*c8183f29SGreg Roach 'ANUL' => ['FAM:ANUL'], 121*c8183f29SGreg Roach 'DIVF' => ['FAM:DIVF'], 122*c8183f29SGreg Roach 'FAM_RESI' => ['FAM:RESI'], 123*c8183f29SGreg Roach 'FAM_CENS' => ['FAM:CENS'], 124*c8183f29SGreg Roach // LDS church 125*c8183f29SGreg Roach 'LDS' => ['INDI:BAPL', 'INDI:CONL', 'INDI:ENDL', 'INDI:SLGC', 'FAM:SLGS', 'HEAD:SUBN'], 126*c8183f29SGreg Roach // Identifiers 127*c8183f29SGreg Roach 'AFN' => ['INDI:AFN'], 128*c8183f29SGreg Roach 'IDNO' => ['INDI:IDNO'], 129*c8183f29SGreg Roach 'SSN' => ['INDI:SSN'], 130*c8183f29SGreg Roach 'RFN' => ['RFN'], 131*c8183f29SGreg Roach 'REFN' => ['REFN'], 132*c8183f29SGreg Roach 'RIN' => ['RIN'], 133*c8183f29SGreg Roach // Submitters 134*c8183f29SGreg Roach 'SUBM' => ['INDI:SUBM', 'FAM:SUBM'], 135*c8183f29SGreg Roach 'ANCI' => ['INDI:ANCI', 'INDI:DESI'], 136*c8183f29SGreg Roach ]; 1370f471f91SGreg Roach} 138