diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2021-02-12 19:10:53 +0000 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2021-02-14 06:56:27 +0000 |
| commit | ae0043b720d44ad147874b2a3afe4e7a347c314a (patch) | |
| tree | c39fb0d93d25507d4fa702c3a7d964580699f160 | |
| parent | 4708b347e34e3bf84dc2c74a1f3fac5406b030aa (diff) | |
| download | webtrees-ae0043b720d44ad147874b2a3afe4e7a347c314a.tar.gz webtrees-ae0043b720d44ad147874b2a3afe4e7a347c314a.tar.bz2 webtrees-ae0043b720d44ad147874b2a3afe4e7a347c314a.zip | |
Gedcom elements
71 files changed, 349 insertions, 69 deletions
diff --git a/app/Elements/AbstractElement.php b/app/Elements/AbstractElement.php index a70c9d4eb1..7101c3154e 100644 --- a/app/Elements/AbstractElement.php +++ b/app/Elements/AbstractElement.php @@ -52,7 +52,8 @@ abstract class AbstractElement implements ElementInterface protected const REGEX_URL = '~((https?|ftp]):)(//([^\s/?#<>]*))?([^\s?#<>]*)(\?([^\s#<>]*))?(#[^\s?#<>]+)?~'; // HTML attributes for an <input> - protected const MAX_LENGTH = false; + protected const MAXIMUM_LENGTH = false; + protected const PATTERN = false; // Which child elements can appear under this element. protected const SUBTAGS = []; @@ -144,7 +145,8 @@ abstract class AbstractElement implements ElementInterface 'id' => $id, 'name' => $name, 'value' => $value, - 'maxvalue' => static::MAX_LENGTH, + 'maxvalue' => static::MAXIMUM_LENGTH, + 'pattern' => static::PATTERN, ]; return '<input ' . Html::attributes($attributes) . '">'; diff --git a/app/Elements/AddressCity.php b/app/Elements/AddressCity.php index ab5ee8fe1b..c4c8e25254 100644 --- a/app/Elements/AddressCity.php +++ b/app/Elements/AddressCity.php @@ -25,5 +25,5 @@ namespace Fisharebest\Webtrees\Elements; */ class AddressCity extends AbstractElement { - protected const MAX_LENGTH = 60; + protected const MAXIMUM_LENGTH = 60; } diff --git a/app/Elements/AddressCountry.php b/app/Elements/AddressCountry.php index cc45fcf378..9e62db1dba 100644 --- a/app/Elements/AddressCountry.php +++ b/app/Elements/AddressCountry.php @@ -27,5 +27,5 @@ namespace Fisharebest\Webtrees\Elements; */ class AddressCountry extends AbstractElement { - protected const MAX_LENGTH = 60; + protected const MAXIMUM_LENGTH = 60; } diff --git a/app/Elements/AddressEmail.php b/app/Elements/AddressEmail.php index 13aab39921..b661b1a0da 100644 --- a/app/Elements/AddressEmail.php +++ b/app/Elements/AddressEmail.php @@ -29,7 +29,7 @@ use function e; */ class AddressEmail extends AbstractElement { - protected const MAX_LENGTH = 120; + protected const MAXIMUM_LENGTH = 120; /** * Display the value of this type of element. diff --git a/app/Elements/AddressFax.php b/app/Elements/AddressFax.php index f33dc9f2fb..d31926a094 100644 --- a/app/Elements/AddressFax.php +++ b/app/Elements/AddressFax.php @@ -30,7 +30,7 @@ use function preg_match; */ class AddressFax extends AbstractElement { - protected const MAX_LENGTH = 60; + protected const MAXIMUM_LENGTH = 60; /** * Display the value of this type of element. diff --git a/app/Elements/AddressLine.php b/app/Elements/AddressLine.php index ea00c158d0..df9847bb0a 100644 --- a/app/Elements/AddressLine.php +++ b/app/Elements/AddressLine.php @@ -31,7 +31,7 @@ use Fisharebest\Webtrees\Tree; */ class AddressLine extends AbstractElement { - protected const MAX_LENGTH = 60; + protected const MAXIMUM_LENGTH = 60; /** * Convert a value to a canonical form. diff --git a/app/Elements/AddressLine1.php b/app/Elements/AddressLine1.php index 3f4a4f3305..1174d31666 100644 --- a/app/Elements/AddressLine1.php +++ b/app/Elements/AddressLine1.php @@ -26,5 +26,5 @@ namespace Fisharebest\Webtrees\Elements; */ class AddressLine1 extends AbstractElement { - protected const MAX_LENGTH = 60; + protected const MAXIMUM_LENGTH = 60; } diff --git a/app/Elements/AddressLine2.php b/app/Elements/AddressLine2.php index ef9369d232..6a222244bb 100644 --- a/app/Elements/AddressLine2.php +++ b/app/Elements/AddressLine2.php @@ -26,5 +26,5 @@ namespace Fisharebest\Webtrees\Elements; */ class AddressLine2 extends AbstractElement { - protected const MAX_LENGTH = 60; + protected const MAXIMUM_LENGTH = 60; } diff --git a/app/Elements/AddressLine3.php b/app/Elements/AddressLine3.php index 8ae0cc69fa..5dfe2033c4 100644 --- a/app/Elements/AddressLine3.php +++ b/app/Elements/AddressLine3.php @@ -26,5 +26,5 @@ namespace Fisharebest\Webtrees\Elements; */ class AddressLine3 extends AbstractElement { - protected const MAX_LENGTH = 60; + protected const MAXIMUM_LENGTH = 60; } diff --git a/app/Elements/AddressPostalCode.php b/app/Elements/AddressPostalCode.php index 338ef6e445..6b80627caf 100644 --- a/app/Elements/AddressPostalCode.php +++ b/app/Elements/AddressPostalCode.php @@ -28,7 +28,7 @@ use function strtoupper; */ class AddressPostalCode extends AbstractElement { - protected const MAX_LENGTH = 10; + protected const MAXIMUM_LENGTH = 10; /** * Convert a value to a canonical form. diff --git a/app/Elements/AddressState.php b/app/Elements/AddressState.php index 1ca2cac192..83de7d4f26 100644 --- a/app/Elements/AddressState.php +++ b/app/Elements/AddressState.php @@ -25,5 +25,5 @@ namespace Fisharebest\Webtrees\Elements; */ class AddressState extends AbstractElement { - protected const MAX_LENGTH = 60; + protected const MAXIMUM_LENGTH = 60; } diff --git a/app/Elements/AddressWebPage.php b/app/Elements/AddressWebPage.php index 45847209a5..e939a6c921 100644 --- a/app/Elements/AddressWebPage.php +++ b/app/Elements/AddressWebPage.php @@ -29,7 +29,7 @@ use function e; */ class AddressWebPage extends AbstractElement { - protected const MAX_LENGTH = 120; + protected const MAXIMUM_LENGTH = 120; /** * Display the value of this type of element. diff --git a/app/Elements/AgeAtEvent.php b/app/Elements/AgeAtEvent.php index bd762ee366..b8ac5913db 100644 --- a/app/Elements/AgeAtEvent.php +++ b/app/Elements/AgeAtEvent.php @@ -44,7 +44,7 @@ use function strtoupper; */ class AgeAtEvent extends AbstractElement { - protected const MAX_LENGTH = 12; + protected const MAXIMUM_LENGTH = 12; public function canonical(string $value): string { diff --git a/app/Elements/AncestralFileNumber.php b/app/Elements/AncestralFileNumber.php index 4ed8bd2862..0f1b077041 100644 --- a/app/Elements/AncestralFileNumber.php +++ b/app/Elements/AncestralFileNumber.php @@ -34,7 +34,7 @@ class AncestralFileNumber extends AbstractElement { protected const EXTERNAL_URL = 'https://www.familysearch.org/search/family-trees/results?q.afnId='; - protected const MAX_LENGTH = 12; + protected const MAXIMUM_LENGTH = 12; /** * Convert a value to a canonical form. diff --git a/app/Elements/ApprovedSystemId.php b/app/Elements/ApprovedSystemId.php index 55ed6355bd..d75405ea0a 100644 --- a/app/Elements/ApprovedSystemId.php +++ b/app/Elements/ApprovedSystemId.php @@ -31,7 +31,7 @@ use Fisharebest\Webtrees\Webtrees; */ class ApprovedSystemId extends AbstractElement { - protected const MAX_LENGTH = 20; + protected const MAXIMUM_LENGTH = 20; /** * Create a default value for this element. diff --git a/app/Elements/AutomatedRecordId.php b/app/Elements/AutomatedRecordId.php index 72805b9d29..e35770fd9b 100644 --- a/app/Elements/AutomatedRecordId.php +++ b/app/Elements/AutomatedRecordId.php @@ -28,5 +28,5 @@ namespace Fisharebest\Webtrees\Elements; */ class AutomatedRecordId extends AbstractElement { - protected const MAX_LENGTH = 12; + protected const MAXIMUM_LENGTH = 12; } diff --git a/app/Elements/CasteName.php b/app/Elements/CasteName.php index 1716154b85..3a151470c7 100644 --- a/app/Elements/CasteName.php +++ b/app/Elements/CasteName.php @@ -27,7 +27,7 @@ namespace Fisharebest\Webtrees\Elements; */ class CasteName extends AbstractElement { - protected const MAX_LENGTH = 90; + protected const MAXIMUM_LENGTH = 90; protected const SUBTAGS = [ 'DATE' => '0:1', diff --git a/app/Elements/CauseOfEvent.php b/app/Elements/CauseOfEvent.php index 9eb3fe3204..b8a441cf00 100644 --- a/app/Elements/CauseOfEvent.php +++ b/app/Elements/CauseOfEvent.php @@ -27,5 +27,5 @@ namespace Fisharebest\Webtrees\Elements; */ class CauseOfEvent extends AbstractElement { - protected const MAX_LENGTH = 90; + protected const MAXIMUM_LENGTH = 90; } diff --git a/app/Elements/CopyrightFile.php b/app/Elements/CopyrightFile.php index d4fb0332c4..a4d13c4719 100644 --- a/app/Elements/CopyrightFile.php +++ b/app/Elements/CopyrightFile.php @@ -26,5 +26,5 @@ namespace Fisharebest\Webtrees\Elements; */ class CopyrightFile extends AbstractElement { - protected const MAX_LENGTH = 90; + protected const MAXIMUM_LENGTH = 90; } diff --git a/app/Elements/CopyrightSourceData.php b/app/Elements/CopyrightSourceData.php index 9305f06916..ef66a26fce 100644 --- a/app/Elements/CopyrightSourceData.php +++ b/app/Elements/CopyrightSourceData.php @@ -28,5 +28,5 @@ namespace Fisharebest\Webtrees\Elements; */ class CopyrightSourceData extends AbstractElement { - protected const MAX_LENGTH = 90; + protected const MAXIMUM_LENGTH = 90; } diff --git a/app/Elements/DemographicDataType.php b/app/Elements/DemographicDataType.php new file mode 100644 index 0000000000..408610dd63 --- /dev/null +++ b/app/Elements/DemographicDataType.php @@ -0,0 +1,63 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2021 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +declare(strict_types=1); + +namespace Fisharebest\Webtrees\Elements; + +use Fisharebest\Webtrees\I18N; + +use function strtoupper; + +/** + * <TYPE_OF_DEMOGRAPHICAL_DATA>:= {Size=1:35} + * Type the demographic data for a place. + * [ HSHO | CITI ] means: household | resident + */ +class DemographicDataType extends AbstractElement +{ + /** + * Convert a value to a canonical form. + * + * @param string $value + * + * @return string + */ + public function canonical(string $value): string + { + return strtoupper(parent::canonical($value)); + } + + + /** + * A list of controlled values for this element + * + * @return array<int|string,string> + */ + public function values(): array + { + $values = [ + '' => '', + 'HSHO' => I18N::translate('household'), + 'CITI' => I18N::translate('citizen'), + ]; + + uasort($values, [I18N::class, 'strcasecmp']); + + return $values; + } +} diff --git a/app/Elements/EventAttributeType.php b/app/Elements/EventAttributeType.php index 797158f2b5..66b26033d9 100644 --- a/app/Elements/EventAttributeType.php +++ b/app/Elements/EventAttributeType.php @@ -29,5 +29,5 @@ namespace Fisharebest\Webtrees\Elements; */ class EventAttributeType extends AbstractElement { - protected const MAX_LENGTH = 15; + protected const MAXIMUM_LENGTH = 15; } diff --git a/app/Elements/EventDescriptor.php b/app/Elements/EventDescriptor.php index a27e774da9..09e27d5c1f 100644 --- a/app/Elements/EventDescriptor.php +++ b/app/Elements/EventDescriptor.php @@ -36,7 +36,7 @@ use Fisharebest\Webtrees\Tree; */ class EventDescriptor extends AbstractElement { - protected const MAX_LENGTH = 90; + protected const MAXIMUM_LENGTH = 90; protected const SUBTAGS = [ 'DATE' => '0:1', diff --git a/app/Elements/EventOrFactClassification.php b/app/Elements/EventOrFactClassification.php index 50a95091e6..59a71312bf 100644 --- a/app/Elements/EventOrFactClassification.php +++ b/app/Elements/EventOrFactClassification.php @@ -46,5 +46,5 @@ namespace Fisharebest\Webtrees\Elements; */ class EventOrFactClassification extends AbstractElement { - protected const MAX_LENGTH = 90; + protected const MAXIMUM_LENGTH = 90; } diff --git a/app/Elements/EventTypeCitedFrom.php b/app/Elements/EventTypeCitedFrom.php index 30eeace39e..32583f12ec 100644 --- a/app/Elements/EventTypeCitedFrom.php +++ b/app/Elements/EventTypeCitedFrom.php @@ -31,5 +31,5 @@ namespace Fisharebest\Webtrees\Elements; */ class EventTypeCitedFrom extends AbstractElement { - protected const MAX_LENGTH = 15; + protected const MAXIMUM_LENGTH = 15; } diff --git a/app/Elements/FileName.php b/app/Elements/FileName.php index 8e408d0b07..7f6b4242a6 100644 --- a/app/Elements/FileName.php +++ b/app/Elements/FileName.php @@ -26,7 +26,7 @@ namespace Fisharebest\Webtrees\Elements; */ class FileName extends AbstractElement { - protected const MAX_LENGTH = 90; + protected const MAXIMUM_LENGTH = 90; /** * Convert a value to a canonical form. diff --git a/app/Elements/Form.php b/app/Elements/Form.php index e264b5daf9..ea2024f1f5 100644 --- a/app/Elements/Form.php +++ b/app/Elements/Form.php @@ -31,7 +31,7 @@ use Fisharebest\Webtrees\Tree; */ class Form extends AbstractElement { - protected const MAX_LENGTH = 20; + protected const MAXIMUM_LENGTH = 20; /** * Create a default value for this element. diff --git a/app/Elements/GenerationsOfAncestors.php b/app/Elements/GenerationsOfAncestors.php index c79714053a..5053801fcc 100644 --- a/app/Elements/GenerationsOfAncestors.php +++ b/app/Elements/GenerationsOfAncestors.php @@ -29,7 +29,7 @@ use Fisharebest\Webtrees\Tree; */ class GenerationsOfAncestors extends AbstractElement { - protected const MAX_LENGTH = 4; + protected const MAXIMUM_LENGTH = 4; /** * Display the value of this type of element. diff --git a/app/Elements/GenerationsOfDescendants.php b/app/Elements/GenerationsOfDescendants.php index 844a304375..84d8666d2b 100644 --- a/app/Elements/GenerationsOfDescendants.php +++ b/app/Elements/GenerationsOfDescendants.php @@ -29,7 +29,7 @@ use Fisharebest\Webtrees\Tree; */ class GenerationsOfDescendants extends AbstractElement { - protected const MAX_LENGTH = 4; + protected const MAXIMUM_LENGTH = 4; /** * Display the value of this type of element. diff --git a/app/Elements/GovId.php b/app/Elements/GovId.php index 852f01bab8..ac880f5a30 100644 --- a/app/Elements/GovId.php +++ b/app/Elements/GovId.php @@ -32,7 +32,7 @@ class GovId extends AbstractElement { protected const EXTERNAL_URL = 'https://gov.genealogy.net/item/show/'; - protected const MAX_LENGTH = 12; + protected const MAXIMUM_LENGTH = 12; /** * Convert a value to a canonical form. diff --git a/app/Elements/HierarchicalRelationship.php b/app/Elements/HierarchicalRelationship.php new file mode 100644 index 0000000000..f161c669fe --- /dev/null +++ b/app/Elements/HierarchicalRelationship.php @@ -0,0 +1,66 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2021 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +declare(strict_types=1); + +namespace Fisharebest\Webtrees\Elements; + +use Fisharebest\Webtrees\I18N; + +use function strtoupper; + +/** + * <HIERARCHICAL_RELATIONSHIP>:= [POLI|RELI|GEOG|CULT] + * Used to differentiate political (administrative), religious, geographical + * or cultural associations. For the superior location object the details of + * its type are defined by the <TYPE_OF_LOCATION> in its record. + */ +class HierarchicalRelationship extends AbstractElement +{ + /** + * Convert a value to a canonical form. + * + * @param string $value + * + * @return string + */ + public function canonical(string $value): string + { + return strtoupper(parent::canonical($value)); + } + + + /** + * A list of controlled values for this element + * + * @return array<int|string,string> + */ + public function values(): array + { + $values = [ + '' => '', + 'POLI' => I18N::translate('political'), + 'RELI' => I18N::translate('religious'), + 'GEOG' => I18N::translate('geographic'), + 'CULT' => I18N::translate('cultural'), + ]; + + uasort($values, [I18N::class, 'strcasecmp']); + + return $values; + } +} diff --git a/app/Elements/LocationRecord.php b/app/Elements/LocationRecord.php new file mode 100644 index 0000000000..6d67693995 --- /dev/null +++ b/app/Elements/LocationRecord.php @@ -0,0 +1,44 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2021 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +declare(strict_types=1); + +namespace Fisharebest\Webtrees\Elements; + +/** + * A level 0 location record + */ +class LocationRecord extends AbstractElement +{ + protected const SUBTAGS = [ + 'NAME' => '1:M', + 'TYPE' => '0:M', + '_POST' => '0:M', + '_GOV' => '0:1', + 'MAP' => '0:1', + '_MAIDENHEAD' => '0:1', + 'RELI' => '0:1', + 'EVEN' => '0:M', + '_LOC' => '0:M', + '_DMGD' => '0:M', + '_AIDN' => '0:M', + 'OBJE' => '0:M', + 'NOTE' => '0:M', + 'SOUR' => '0:M', + 'CHAN' => '0:1', + ]; +} diff --git a/app/Elements/MaidenheadLocator.php b/app/Elements/MaidenheadLocator.php new file mode 100644 index 0000000000..7150a6699c --- /dev/null +++ b/app/Elements/MaidenheadLocator.php @@ -0,0 +1,58 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2021 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +declare(strict_types=1); + +namespace Fisharebest\Webtrees\Elements; + +use function mb_strlen; +use function mb_strtolower; +use function mb_strtoupper; +use function mb_substr; + +/** + * @see https://en.wikipedia.org/wiki/Maidenhead_Locator_System + */ +class MaidenheadLocator extends AbstractElement +{ + protected const MAXIMUM_LENGTH = 8; + protected const PATTERN = '[A-Ra-r][A-Ra-r]([0-9][0-9]([A-Xa-x][A-Xa-x]([0-9][0-9])?)?)?'; + + /** + * Convert a value to a canonical form. + * + * @param string $value + * + * @return string + */ + public function canonical(string $value): string + { + $value = parent::canonical($value); + + // Characters 1 and 2 are upper case + if (mb_strlen($value) >= 2) { + $value = mb_strtoupper(mb_substr($value, 0, 2)) . mb_substr($value, 2); + } + + // Characters 5 and 6 are lower case + if (mb_strlen($value) >= 6) { + $value = mb_substr($value, 0, 4) . mb_strtolower(mb_substr($value, 4, 2)) . mb_substr($value, 6); + } + + return $value; + } +} diff --git a/app/Elements/NameOfBusiness.php b/app/Elements/NameOfBusiness.php index 1ea4a784da..20ae197e6d 100644 --- a/app/Elements/NameOfBusiness.php +++ b/app/Elements/NameOfBusiness.php @@ -26,5 +26,5 @@ namespace Fisharebest\Webtrees\Elements; */ class NameOfBusiness extends AbstractElement { - protected const MAX_LENGTH = 90; + protected const MAXIMUM_LENGTH = 90; } diff --git a/app/Elements/NameOfFamilyFile.php b/app/Elements/NameOfFamilyFile.php index ec2c6d0e06..b8c210c84c 100644 --- a/app/Elements/NameOfFamilyFile.php +++ b/app/Elements/NameOfFamilyFile.php @@ -35,7 +35,7 @@ use const PATHINFO_EXTENSION; */ class NameOfFamilyFile extends AbstractElement { - protected const MAX_LENGTH = 120; + protected const MAXIMUM_LENGTH = 120; /** * Create a default value for this element. @@ -46,12 +46,12 @@ class NameOfFamilyFile extends AbstractElement */ public function default(Tree $tree): string { - $value = mb_substr($tree->name(), 0, self::MAX_LENGTH); + $value = mb_substr($tree->name(), 0, self::MAXIMUM_LENGTH); $extension = strtolower(pathinfo($value, PATHINFO_EXTENSION)); if ($extension !== 'ged') { - $value = mb_substr($tree->name(), 0, self::MAX_LENGTH - 4) . '.ged'; + $value = mb_substr($tree->name(), 0, self::MAXIMUM_LENGTH - 4) . '.ged'; } return $value; diff --git a/app/Elements/NameOfProduct.php b/app/Elements/NameOfProduct.php index 7ada45ba11..8a4bf9d0bb 100644 --- a/app/Elements/NameOfProduct.php +++ b/app/Elements/NameOfProduct.php @@ -25,5 +25,5 @@ namespace Fisharebest\Webtrees\Elements; */ class NameOfProduct extends AbstractElement { - protected const MAX_LENGTH = 90; + protected const MAXIMUM_LENGTH = 90; } diff --git a/app/Elements/NameOfRepository.php b/app/Elements/NameOfRepository.php index b702ce4d83..b0dcbe6a63 100644 --- a/app/Elements/NameOfRepository.php +++ b/app/Elements/NameOfRepository.php @@ -25,5 +25,5 @@ namespace Fisharebest\Webtrees\Elements; */ class NameOfRepository extends AbstractElement { - protected const MAX_LENGTH = 90; + protected const MAXIMUM_LENGTH = 90; } diff --git a/app/Elements/NameOfSourceData.php b/app/Elements/NameOfSourceData.php index 5d6d9165bb..81488e749a 100644 --- a/app/Elements/NameOfSourceData.php +++ b/app/Elements/NameOfSourceData.php @@ -27,5 +27,5 @@ namespace Fisharebest\Webtrees\Elements; */ class NameOfSourceData extends AbstractElement { - protected const MAX_LENGTH = 90; + protected const MAXIMUM_LENGTH = 90; } diff --git a/app/Elements/NamePersonal.php b/app/Elements/NamePersonal.php index 0e79f72b45..e4c96bc854 100644 --- a/app/Elements/NamePersonal.php +++ b/app/Elements/NamePersonal.php @@ -51,7 +51,7 @@ use function view; */ class NamePersonal extends AbstractElement { - protected const MAX_LENGTH = 120; + protected const MAXIMUM_LENGTH = 120; protected const SUBTAGS = [ 'TYPE' => '0:1', diff --git a/app/Elements/NamePhoneticVariation.php b/app/Elements/NamePhoneticVariation.php index 42fe464dc6..622731fee5 100644 --- a/app/Elements/NamePhoneticVariation.php +++ b/app/Elements/NamePhoneticVariation.php @@ -29,5 +29,5 @@ namespace Fisharebest\Webtrees\Elements; */ class NamePhoneticVariation extends AbstractElement { - protected const MAX_LENGTH = 120; + protected const MAXIMUM_LENGTH = 120; } diff --git a/app/Elements/NamePieceGiven.php b/app/Elements/NamePieceGiven.php index 3c6f4809aa..1f13bd6673 100644 --- a/app/Elements/NamePieceGiven.php +++ b/app/Elements/NamePieceGiven.php @@ -31,7 +31,7 @@ use function view; */ class NamePieceGiven extends AbstractElement { - protected const MAX_LENGTH = 120; + protected const MAXIMUM_LENGTH = 120; /** * An edit control for this data. diff --git a/app/Elements/NamePieceNickname.php b/app/Elements/NamePieceNickname.php index 6f51448cb6..b4970b5a0f 100644 --- a/app/Elements/NamePieceNickname.php +++ b/app/Elements/NamePieceNickname.php @@ -31,7 +31,7 @@ use function view; */ class NamePieceNickname extends AbstractElement { - protected const MAX_LENGTH = 30; + protected const MAXIMUM_LENGTH = 30; /** * An edit control for this data. diff --git a/app/Elements/NamePiecePrefix.php b/app/Elements/NamePiecePrefix.php index 321291752e..41b61e996e 100644 --- a/app/Elements/NamePiecePrefix.php +++ b/app/Elements/NamePiecePrefix.php @@ -35,7 +35,7 @@ use function view; */ class NamePiecePrefix extends AbstractElement { - protected const MAX_LENGTH = 30; + protected const MAXIMUM_LENGTH = 30; /** * An edit control for this data. diff --git a/app/Elements/NamePieceSuffix.php b/app/Elements/NamePieceSuffix.php index a1f1192828..4bfe2b24a1 100644 --- a/app/Elements/NamePieceSuffix.php +++ b/app/Elements/NamePieceSuffix.php @@ -35,7 +35,7 @@ use function view; */ class NamePieceSuffix extends AbstractElement { - protected const MAX_LENGTH = 30; + protected const MAXIMUM_LENGTH = 30; /** * An edit control for this data. diff --git a/app/Elements/NamePieceSurname.php b/app/Elements/NamePieceSurname.php index d54227e427..8327f4ede8 100644 --- a/app/Elements/NamePieceSurname.php +++ b/app/Elements/NamePieceSurname.php @@ -32,7 +32,7 @@ use function view; */ class NamePieceSurname extends AbstractElement { - protected const MAX_LENGTH = 30; + protected const MAXIMUM_LENGTH = 30; /** * An edit control for this data. diff --git a/app/Elements/NamePieceSurnamePrefix.php b/app/Elements/NamePieceSurnamePrefix.php index 3c7bed7186..783abe16d1 100644 --- a/app/Elements/NamePieceSurnamePrefix.php +++ b/app/Elements/NamePieceSurnamePrefix.php @@ -32,7 +32,7 @@ use function view; */ class NamePieceSurnamePrefix extends AbstractElement { - protected const MAX_LENGTH = 30; + protected const MAXIMUM_LENGTH = 30; /** * An edit control for this data. diff --git a/app/Elements/NameRomanizedVariation.php b/app/Elements/NameRomanizedVariation.php index 00d9a316fe..26979df1a7 100644 --- a/app/Elements/NameRomanizedVariation.php +++ b/app/Elements/NameRomanizedVariation.php @@ -35,7 +35,7 @@ use function view; */ class NameRomanizedVariation extends AbstractElement { - protected const MAX_LENGTH = 120; + protected const MAXIMUM_LENGTH = 120; /** * An edit control for this data. diff --git a/app/Elements/NationOrTribalOrigin.php b/app/Elements/NationOrTribalOrigin.php index e1fa3b5e70..ac4148eda5 100644 --- a/app/Elements/NationOrTribalOrigin.php +++ b/app/Elements/NationOrTribalOrigin.php @@ -28,7 +28,7 @@ namespace Fisharebest\Webtrees\Elements; */ class NationOrTribalOrigin extends AbstractElement { - protected const MAX_LENGTH = 120; + protected const MAXIMUM_LENGTH = 120; protected const SUBTAGS = [ 'DATE' => '0:1', diff --git a/app/Elements/NationalIdNumber.php b/app/Elements/NationalIdNumber.php index 23483df026..5c5bb4e1c1 100644 --- a/app/Elements/NationalIdNumber.php +++ b/app/Elements/NationalIdNumber.php @@ -31,7 +31,7 @@ namespace Fisharebest\Webtrees\Elements; */ class NationalIdNumber extends AbstractElement { - protected const MAX_LENGTH = 30; + protected const MAXIMUM_LENGTH = 30; protected const SUBTAGS = [ 'DATE' => '0:1', diff --git a/app/Elements/NobilityTypeTitle.php b/app/Elements/NobilityTypeTitle.php index 7a396cad01..96906913a8 100644 --- a/app/Elements/NobilityTypeTitle.php +++ b/app/Elements/NobilityTypeTitle.php @@ -26,7 +26,7 @@ namespace Fisharebest\Webtrees\Elements; */ class NobilityTypeTitle extends AbstractElement { - protected const MAX_LENGTH = 120; + protected const MAXIMUM_LENGTH = 120; protected const SUBTAGS = [ 'DATE' => '0:1', diff --git a/app/Elements/PafUid.php b/app/Elements/PafUid.php index 1c1bd15870..b34d712516 100644 --- a/app/Elements/PafUid.php +++ b/app/Elements/PafUid.php @@ -34,7 +34,7 @@ use function substr; */ class PafUid extends AbstractElement { - protected const MAX_LENGTH = 34; + protected const MAXIMUM_LENGTH = 34; /** * Create a default value for this element. diff --git a/app/Elements/PedigreeLinkageType.php b/app/Elements/PedigreeLinkageType.php index a024b74d0a..62046559ad 100644 --- a/app/Elements/PedigreeLinkageType.php +++ b/app/Elements/PedigreeLinkageType.php @@ -33,7 +33,7 @@ use Fisharebest\Webtrees\I18N; */ class PedigreeLinkageType extends AbstractElement { - protected const MAX_LENGTH = 7; + protected const MAXIMUM_LENGTH = 7; /** * A list of controlled values for this element diff --git a/app/Elements/PermanentRecordFileNumber.php b/app/Elements/PermanentRecordFileNumber.php index b335ec60ef..bcdeb30dc8 100644 --- a/app/Elements/PermanentRecordFileNumber.php +++ b/app/Elements/PermanentRecordFileNumber.php @@ -34,5 +34,5 @@ namespace Fisharebest\Webtrees\Elements; */ class PermanentRecordFileNumber extends AbstractElement { - protected const MAX_LENGTH = 90; + protected const MAXIMUM_LENGTH = 90; } diff --git a/app/Elements/PhoneNumber.php b/app/Elements/PhoneNumber.php index 71365be23c..bd5e25a29c 100644 --- a/app/Elements/PhoneNumber.php +++ b/app/Elements/PhoneNumber.php @@ -30,7 +30,7 @@ use function preg_match; */ class PhoneNumber extends AbstractElement { - protected const MAX_LENGTH = 25; + protected const MAXIMUM_LENGTH = 25; /** * Display the value of this type of element. diff --git a/app/Elements/PhoneticType.php b/app/Elements/PhoneticType.php index 089ab80379..e5583503a9 100644 --- a/app/Elements/PhoneticType.php +++ b/app/Elements/PhoneticType.php @@ -32,7 +32,7 @@ use function strtolower; */ class PhoneticType extends AbstractElement { - protected const MAX_LENGTH = 30; + protected const MAXIMUM_LENGTH = 30; /** * Convert a value to a canonical form. diff --git a/app/Elements/PlaceHierarchy.php b/app/Elements/PlaceHierarchy.php index 035e35ecfb..9aa837c896 100644 --- a/app/Elements/PlaceHierarchy.php +++ b/app/Elements/PlaceHierarchy.php @@ -35,5 +35,5 @@ namespace Fisharebest\Webtrees\Elements; */ class PlaceHierarchy extends AbstractElement { - protected const MAX_LENGTH = 120; + protected const MAXIMUM_LENGTH = 120; } diff --git a/app/Elements/ReceivingSystemName.php b/app/Elements/ReceivingSystemName.php index 79faff8e62..e6220ee078 100644 --- a/app/Elements/ReceivingSystemName.php +++ b/app/Elements/ReceivingSystemName.php @@ -32,7 +32,7 @@ use Fisharebest\Webtrees\Tree; */ class ReceivingSystemName extends AbstractElement { - protected const MAX_LENGTH = 20; + protected const MAXIMUM_LENGTH = 20; /** * Create a default value for this element. diff --git a/app/Elements/RelationIsDescriptor.php b/app/Elements/RelationIsDescriptor.php index bd3289d309..79fce320ea 100644 --- a/app/Elements/RelationIsDescriptor.php +++ b/app/Elements/RelationIsDescriptor.php @@ -33,7 +33,7 @@ use Fisharebest\Webtrees\I18N; */ class RelationIsDescriptor extends AbstractElement { - protected const MAX_LENGTH = 25; + protected const MAXIMUM_LENGTH = 25; /** * A list of controlled values for this element diff --git a/app/Elements/ReligiousAffiliation.php b/app/Elements/ReligiousAffiliation.php index 7f667120e7..1747b3497d 100644 --- a/app/Elements/ReligiousAffiliation.php +++ b/app/Elements/ReligiousAffiliation.php @@ -25,7 +25,7 @@ namespace Fisharebest\Webtrees\Elements; */ class ReligiousAffiliation extends AbstractElement { - protected const MAX_LENGTH = 120; + protected const MAXIMUM_LENGTH = 120; protected const SUBTAGS = [ 'DATE' => '0:1', diff --git a/app/Elements/ResponsibleAgency.php b/app/Elements/ResponsibleAgency.php index d5c14414fa..ec279f57a6 100644 --- a/app/Elements/ResponsibleAgency.php +++ b/app/Elements/ResponsibleAgency.php @@ -28,5 +28,5 @@ namespace Fisharebest\Webtrees\Elements; */ class ResponsibleAgency extends AbstractElement { - protected const MAX_LENGTH = 120; + protected const MAXIMUM_LENGTH = 120; } diff --git a/app/Elements/RoleInEvent.php b/app/Elements/RoleInEvent.php index 5fe1a1fbf2..cbf4c9d1a0 100644 --- a/app/Elements/RoleInEvent.php +++ b/app/Elements/RoleInEvent.php @@ -30,5 +30,5 @@ namespace Fisharebest\Webtrees\Elements; */ class RoleInEvent extends AbstractElement { - protected const MAX_LENGTH = 15; + protected const MAXIMUM_LENGTH = 15; } diff --git a/app/Elements/RomanizedType.php b/app/Elements/RomanizedType.php index 2df79b16f8..b6c587e55e 100644 --- a/app/Elements/RomanizedType.php +++ b/app/Elements/RomanizedType.php @@ -28,7 +28,7 @@ use function strtolower; */ class RomanizedType extends AbstractElement { - protected const MAX_LENGTH = 30; + protected const MAXIMUM_LENGTH = 30; /** * Convert a value to a canonical form. diff --git a/app/Elements/SexXValue.php b/app/Elements/SexXValue.php new file mode 100644 index 0000000000..badb9eb7bc --- /dev/null +++ b/app/Elements/SexXValue.php @@ -0,0 +1,47 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2021 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +declare(strict_types=1); + +namespace Fisharebest\Webtrees\Elements; + +use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Tree; + +use function strtoupper; +use function view; + +/** + * A modification to the standard SEX record, which allows 'X'. + * Gedcom-L defines this as 'Intersex'. We use the more general term 'Other'. + */ +class SexXValue extends AbstractElement +{ + /** + * A list of controlled values for this element + * + * @return array<int|string,string> + */ + public function values(): array + { + $values = parent::values(); + + $values['X'] = I18N::translate('Other'); + + return $values; + } +} diff --git a/app/Elements/SocialSecurityNumber.php b/app/Elements/SocialSecurityNumber.php index 0cefa6fc40..268114a621 100644 --- a/app/Elements/SocialSecurityNumber.php +++ b/app/Elements/SocialSecurityNumber.php @@ -25,7 +25,7 @@ namespace Fisharebest\Webtrees\Elements; */ class SocialSecurityNumber extends AbstractElement { - protected const MAX_LENGTH = 11; + protected const MAXIMUM_LENGTH = 11; protected const SUBTAGS = [ 'DATE' => '0:1', diff --git a/app/Elements/SourceCallNumber.php b/app/Elements/SourceCallNumber.php index 0028496d4c..3d787cedf0 100644 --- a/app/Elements/SourceCallNumber.php +++ b/app/Elements/SourceCallNumber.php @@ -28,7 +28,7 @@ use Fisharebest\Webtrees\Tree; */ class SourceCallNumber extends AbstractElement { - protected const MAX_LENGTH = 120; + protected const MAXIMUM_LENGTH = 120; /** * Display the value of this type of element. * diff --git a/app/Elements/SourceFiledByEntry.php b/app/Elements/SourceFiledByEntry.php index 43dd2da544..399321212b 100644 --- a/app/Elements/SourceFiledByEntry.php +++ b/app/Elements/SourceFiledByEntry.php @@ -25,5 +25,5 @@ namespace Fisharebest\Webtrees\Elements; */ class SourceFiledByEntry extends AbstractElement { - protected const MAX_LENGTH = 60; + protected const MAXIMUM_LENGTH = 60; } diff --git a/app/Elements/SourceMediaType.php b/app/Elements/SourceMediaType.php index 3b72426517..fae0b9ac58 100644 --- a/app/Elements/SourceMediaType.php +++ b/app/Elements/SourceMediaType.php @@ -33,7 +33,7 @@ use function uasort; */ class SourceMediaType extends AbstractElement { - protected const MAX_LENGTH = 15; + protected const MAXIMUM_LENGTH = 15; /** * Convert a value to a canonical form. diff --git a/app/Elements/SubmitterName.php b/app/Elements/SubmitterName.php index fd09564553..0d3bc7c401 100644 --- a/app/Elements/SubmitterName.php +++ b/app/Elements/SubmitterName.php @@ -25,5 +25,5 @@ namespace Fisharebest\Webtrees\Elements; */ class SubmitterName extends AbstractElement { - protected const MAX_LENGTH = 60; + protected const MAXIMUM_LENGTH = 60; } diff --git a/app/Elements/SubmitterRegisteredRfn.php b/app/Elements/SubmitterRegisteredRfn.php index 6c0c90f8be..2851f22ce6 100644 --- a/app/Elements/SubmitterRegisteredRfn.php +++ b/app/Elements/SubmitterRegisteredRfn.php @@ -26,5 +26,5 @@ namespace Fisharebest\Webtrees\Elements; */ class SubmitterRegisteredRfn extends AbstractElement { - protected const MAX_LENGTH = 30; + protected const MAXIMUM_LENGTH = 30; } diff --git a/app/Elements/UserReferenceType.php b/app/Elements/UserReferenceType.php index f577c7d9cf..49ad8b5f0e 100644 --- a/app/Elements/UserReferenceType.php +++ b/app/Elements/UserReferenceType.php @@ -25,5 +25,5 @@ namespace Fisharebest\Webtrees\Elements; */ class UserReferenceType extends AbstractElement { - protected const MAX_LENGTH = 40; + protected const MAXIMUM_LENGTH = 40; } diff --git a/app/Elements/VersionNumber.php b/app/Elements/VersionNumber.php index 6493188a2f..43439cb77d 100644 --- a/app/Elements/VersionNumber.php +++ b/app/Elements/VersionNumber.php @@ -30,7 +30,7 @@ use function e; */ class VersionNumber extends AbstractElement { - protected const MAX_LENGTH = 15; + protected const MAXIMUM_LENGTH = 15; /** * Display the value of this type of element. * |
