Update MDTlLoader and MDAllowedValueSets

phpcs-errors:226 phpunit-status:successful phpstan-errors:209
This commit is contained in:
Joshua Ramon Enslin 2020-10-29 20:45:59 +01:00 committed by Stefan Rohde-Enslin
parent 36b8fec24b
commit a8f73a4b86
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
8 changed files with 97 additions and 71 deletions

6
.gitmodules vendored
View File

@ -13,3 +13,9 @@
[submodule "classes/MDMailer"]
path = classes/MDMailer
url = /var/www/vhosts/museum-digital.de/git-base/MDMailer
[submodule "l10n/musdb"]
path = l10n/musdb
url = /var/www/vhosts/museum-digital.de/translation.museum-digital.de/backend_approved
[submodule "l10n/importer"]
path = l10n/importer
url = /var/www/vhosts/museum-digital.de/translation.museum-digital.de/importer_approved

@ -1 +1 @@
Subproject commit a300538188f6367eac129934b058417adab05d69
Subproject commit d8bfca1df6031da2500d346426c53ebb7d932796

@ -1 +1 @@
Subproject commit ae0886e34702794f0841cdb6e35f052cc8989b1a
Subproject commit 7721ad60fc607d76de4932cc184727249726590e

View File

@ -9,12 +9,13 @@
declare(strict_types = 1);
// Set autoloader
error_reporting(E_ALL);
ini_set('display_errors', "1");
spl_autoload_register("mdCsvxmlAutoloader");
set_exception_handler("mdExceptionHandler");
set_error_handler("mdErrorHandler", E_ALL);
\error_reporting(E_ALL);
\ini_set('display_errors', "1");
\spl_autoload_register("mdCsvxmlAutoloader");
\set_exception_handler("mdExceptionHandler");
\set_error_handler("mdErrorHandler", E_ALL);
require_once __DIR__ . '/../inc/constants.php';
require_once __DIR__ . '/../vendor/autoload.php';
/**
@ -26,22 +27,11 @@ require_once __DIR__ . '/../vendor/autoload.php';
*/
function mdCsvxmlAutoloader(string $className):void {
$classDirs = [
__DIR__ . "/../classes/MDTlLoader",
__DIR__ . "/../classes/MD_STD",
__DIR__ . "/../classes/MDAllowedValueSets/src",
__DIR__ . "/../classes/MDExportFormats/src",
__DIR__ . "/../classes/MDErrorReporter",
__DIR__ . "/../classes/MDMailer/src",
__DIR__ . "/../conf",
__DIR__ . "/../classes/MDErrorReporter/exceptions/generic",
__DIR__ . "/../classes/MDErrorReporter/exceptions/page",
__DIR__ . "/../classes/MDErrorReporter/exceptions/updates",
];
$classDirs = AUTOLOAD_DIRS;
foreach ($classDirs as $classDir) {
if (file_exists("$classDir/$className.php")) {
if (\file_exists("$classDir/$className.php")) {
include "$classDir/$className.php";
return;
}

28
inc/constants.php Normal file
View File

@ -0,0 +1,28 @@
<?PHP
/**
* This file collects global constants to the code of the frontend.
*
* @file
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
const TL_FILE_DIRS = [
__DIR__ . "/../l10n/musdb/",
__DIR__ . "/../classes/MDAllowedValueSets/l18n/",
];
const AUTOLOAD_DIRS = [
__DIR__ . "/../classes/MDTlLoader/src",
__DIR__ . "/../classes/MD_STD",
__DIR__ . "/../classes/MDAllowedValueSets/src",
__DIR__ . "/../classes/MDExportFormats/src",
__DIR__ . "/../classes/MDErrorReporter",
__DIR__ . "/../classes/MDMailer/src",
__DIR__ . "/../conf",
__DIR__ . "/../classes/MDErrorReporter/exceptions/generic",
__DIR__ . "/../classes/MDErrorReporter/exceptions/page",
__DIR__ . "/../classes/MDErrorReporter/exceptions/updates",
__DIR__ . "/../classes/MDTlLoader/exceptions",
];

1
l10n/importer Submodule

@ -0,0 +1 @@
Subproject commit c59afb70be28488deab5f280546a88c4b17552e3

1
l10n/musdb Submodule

@ -0,0 +1 @@
Subproject commit 8ec3c886c7a19b7cf73864b817f7eb10083c1e6e

View File

@ -13,9 +13,9 @@ require __DIR__ . "/../translation-importer/$lang/csvxml-overview.php";
$tlLoader = new MDTlLoader("available_fields", $lang);
foreach (array_diff(scandir(__DIR__ . "/langfiles/$lang/"), ['.', '..']) as $fileName) {
foreach (MD_STD::scandir(__DIR__ . "/../l10n/musdb/$lang/") as $fileName) {
if (in_array($fileName, ['start.php', 'start2.php'])) continue;
include __DIR__ . "/langfiles/{$lang}/{$fileName}";
include __DIR__ . "/../l10n/musdb/{$lang}/{$fileName}";
}
require __DIR__ . "/commonservices/$lang/search_all_fields.php";
@ -36,48 +36,48 @@ $availableFields = [
"allowedValues" => [],
"dependsOn" => [],
"remark" => 'Only unique values allowed',
"name_human_readable" => $object_basis['inventory_number'],
"explica" => $object_basis['inv_explica'],
"name_human_readable" => $tlLoader->tl("object_basis", "object_basis", 'inventory_number'),
"explica" => $tlLoader->tl("object_basis", "object_basis", 'inv_explica'),
],
"object_type" => [
"required" => true,
"allowedValues" => [],
"dependsOn" => [],
"remark" => 'Keep it short! Field is needed to create valid LIDO from museum-digital entries',
"name_human_readable" => $object_basis['object_type'],
"explica" => $object_basis['oart_explica'],
"name_human_readable" => $tlLoader->tl("object_basis", "object_basis", 'object_type'),
"explica" => $tlLoader->tl("object_basis", "object_basis", 'oart_explica'),
],
"object_title" => [
"required" => true,
"allowedValues" => [],
"dependsOn" => [],
"remark" => 'Best is not to repeat the title again and again for many objects, e.g. vase, vase, vase ... better: Green vase, Blue vase, Yellow vase, ...',
"name_human_readable" => $object_basis['object_name'],
"explica" => $object_basis['oname_explica'],
"name_human_readable" => $tlLoader->tl("object_basis", "object_basis", 'object_name'),
"explica" => $tlLoader->tl("object_basis", "object_basis", 'oname_explica'),
],
"object_description" => [
"required" => true,
"allowedValues" => [],
"dependsOn" => [],
"remark" => 'A good description of the objects is fundamental to make the objects searchable in the internet',
"name_human_readable" => $object_basis['description'],
"explica" => $object_basis['obesch_explica'],
"name_human_readable" => $tlLoader->tl("object_basis", "object_basis", 'description'),
"explica" => $tlLoader->tl("object_basis", "object_basis", 'obesch_explica'),
],
"object_material_technique" => [
"required" => false,
"allowedValues" => [],
"dependsOn" => [],
"remark" => 'This is a cummulative field for material and technique. It is also possible to additionally save the information separate in the fields: <i>material_separate</i> and <i>technique_separate</i>',
"name_human_readable" => $object_basis['mattech'],
"explica" => $object_basis['mattech_explica'],
"name_human_readable" => $tlLoader->tl("object_basis", "object_basis", 'mattech'),
"explica" => $tlLoader->tl("object_basis", "object_basis", 'mattech_explica'),
],
"object_dimensions" => [
"required" => false,
"allowedValues" => [],
"dependsOn" => [],
"remark" => 'This is a cummulative field for dimensions (values and units). It is also possible to additionally save the information separate. See the block: <i>separate dimensions</i>',
"name_human_readable" => $object_basis['measurements'],
"explica" => $object_basis['ausmass_explica'],
"name_human_readable" => $tlLoader->tl("object_basis", "object_basis", 'measurements'),
"explica" => $tlLoader->tl("object_basis", "object_basis", 'ausmass_explica'),
],
"object_publication" => [
"required" => false,
@ -245,7 +245,7 @@ $availableFields = [
"dependsOn" => ['dimensions_separate_width_value', 'dimensions_separate_show_md', 'dimensions_separate_show_extern'],
"remark" => 'If a separated value is given an entry for the respective unit is necessary. If a separated dimension entry is given, <i>dimensions_separate_show_md</i> and <i>dimensions_separate_show_extern</i> need to be filled in, too.',
"name_human_readable" => $export['exact_measurements_weight_unit'],
"explica" => $object_basis['inv_explica'],
"explica" => $tlLoader->tl("object_basis", "object_basis", 'inv_explica'),
],
"dimensions_separate_diameter_value" => [
"required" => false,
@ -289,7 +289,7 @@ $availableFields = [
"dimensions_separate_diameter_unit", "dimensions_separate_wall_thickness_value", "dimensions_separate_wall_thickness_unit"
],
"remark" => 'If one or more separate dimension-value (and -unit) is given it has to be specified if the separated entries should be made visible at museum-digital',
"name_human_readable" => $object_basis['inventory_number'],
"name_human_readable" => $tlLoader->tl("object_basis", "object_basis", 'inventory_number'),
"explica" => "",
],
"dimensions_separate_show_extern" => [
@ -302,7 +302,7 @@ $availableFields = [
"dimensions_separate_diameter_unit", "dimensions_separate_wall_thickness_value", "dimensions_separate_wall_thickness_unit"
],
"remark" => 'If one or more separate dimension-value (and -unit) is given it has to be specified if the separated entries should be included in a later export from museum-digital',
"name_human_readable" => $object_basis['inventory_number'],
"name_human_readable" => $tlLoader->tl("object_basis", "object_basis", 'inventory_number'),
"explica" => "",
],
"number_of_pieces" => [
@ -422,7 +422,7 @@ $availableFields = [
"allowedValues" => '',
"remark" => '',
"name_human_readable" => $searchvar[19][0],
"explica" => $object_basis['inv_explica'],
"explica" => $tlLoader->tl("object_basis", "object_basis", 'inv_explica'),
],
"inclusion_kind_of" => [
"required" => false,
@ -481,7 +481,7 @@ $availableFields = [
"dependsOn" => ["bought_for_currency"],
"remark" => '',
"name_human_readable" => "{$searchvar[19][0]}, {$object_add['for']}",
"explica" => $object_basis['inv_explica'],
"explica" => $tlLoader->tl("object_basis", "object_basis", 'inv_explica'),
],
"bought_for_currency" => [
"required" => false,
@ -807,40 +807,40 @@ for ($i = 1; $i <= 2 * $fieldNoMultiplicator; $i++) {
"allowedValues" => [],
"dependsOn" => ["obj_trans_language{$i}", "obj_trans_object_type{$i}", "obj_trans_object_title{$i}", "obj_trans_object_description{$i}"],
"remark" => '',
"name_human_readable" => $object_basis['object_type'],
"explica" => $object_basis['oart_explica'],
"name_human_readable" => $tlLoader->tl("object_basis", "object_basis", 'object_type'),
"explica" => $tlLoader->tl("object_basis", "object_basis", 'oart_explica'),
],
"obj_trans_object_title{$i}" => [
"required" => false,
"allowedValues" => [],
"dependsOn" => ["obj_trans_language{$i}", "obj_trans_object_type{$i}", "obj_trans_object_title{$i}", "obj_trans_object_description{$i}"],
"remark" => '',
"name_human_readable" => $object_basis['object_name'],
"explica" => $object_basis['oname_explica'],
"name_human_readable" => $tlLoader->tl("object_basis", "object_basis", 'object_name'),
"explica" => $tlLoader->tl("object_basis", "object_basis", 'oname_explica'),
],
"obj_trans_object_description{$i}" => [
"required" => false,
"allowedValues" => [],
"dependsOn" => ["obj_trans_language{$i}", "obj_trans_object_type{$i}", "obj_trans_object_title{$i}", "obj_trans_object_description{$i}"],
"remark" => '',
"name_human_readable" => $object_basis['description'],
"explica" => $object_basis['obesch_explica'],
"name_human_readable" => $tlLoader->tl("object_basis", "object_basis", 'description'),
"explica" => $tlLoader->tl("object_basis", "object_basis", 'obesch_explica'),
],
"obj_trans_object_material_technique{$i}" => [
"required" => false,
"allowedValues" => [],
"dependsOn" => ["obj_trans_language{$i}", "obj_trans_object_type{$i}", "obj_trans_object_title{$i}", "obj_trans_object_description{$i}"],
"remark" => '',
"name_human_readable" => $object_basis['mattech'],
"explica" => $object_basis['mattech_explica'],
"name_human_readable" => $tlLoader->tl("object_basis", "object_basis", 'mattech'),
"explica" => $tlLoader->tl("object_basis", "object_basis", 'mattech_explica'),
],
"obj_trans_object_dimensions{$i}" => [
"required" => false,
"allowedValues" => [],
"dependsOn" => ["obj_trans_language{$i}", "obj_trans_object_type{$i}", "obj_trans_object_title{$i}", "obj_trans_object_description{$i}"],
"remark" => '',
"name_human_readable" => $object_basis['measurements'],
"explica" => $object_basis['ausmass_explica'],
"name_human_readable" => $tlLoader->tl("object_basis", "object_basis", 'measurements'),
"explica" => $tlLoader->tl("object_basis", "object_basis", 'ausmass_explica'),
],
]);
@ -855,88 +855,88 @@ for ($i = 1; $i <= 5 * $fieldNoMultiplicator; $i++) {
"allowedValues" => [],
"dependsOn" => ["literature_title{$i}"],
"remark" => '',
"name_human_readable" => $literature['author'],
"explica" => $literature['autor_explica'],
"name_human_readable" => $tlLoader->tl("literature", "literature", 'author'),
"explica" => $tlLoader->tl("literature", "literature", 'autor_explica'),
],
"literature_year{$i}" => [
"required" => false,
"allowedValues" => [],
"dependsOn" => ["literature_title{$i}"],
"remark" => '',
"name_human_readable" => $literature['year'],
"explica" => $literature['jahr_explica'],
"name_human_readable" => $tlLoader->tl("literature", "literature", 'year'),
"explica" => $tlLoader->tl("literature", "literature", 'jahr_explica'),
],
"literature_title{$i}" => [
"required" => false,
"allowedValues" => [],
"dependsOn" => [],
"remark" => '',
"name_human_readable" => $literature['title'],
"explica" => $literature['titel_explica'],
"name_human_readable" => $tlLoader->tl("literature", "literature", 'title'),
"explica" => $tlLoader->tl("literature", "literature", 'titel_explica'),
],
"literature_place{$i}" => [
"required" => false,
"allowedValues" => [],
"dependsOn" => ["literature_title{$i}"],
"remark" => '',
"name_human_readable" => $literature['place'],
"explica" => $literature['ort_explica'],
"name_human_readable" => $tlLoader->tl("literature", "literature", 'place'),
"explica" => $tlLoader->tl("literature", "literature", 'ort_explica'),
],
"literature_abbreviation{$i}" => [
"required" => false,
"allowedValues" => [],
"dependsOn" => ["literature_title{$i}"],
"remark" => '',
"name_human_readable" => $literature['abbr'],
"explica" => $literature['abbr_explica'],
"name_human_readable" => $tlLoader->tl("literature", "literature", 'abbr'),
"explica" => $tlLoader->tl("literature", "literature", 'abbr_explica'),
],
"literature_gnd{$i}" => [
"required" => false,
"allowedValues" => [],
"dependsOn" => ["literature_title{$i}"],
"remark" => '',
"name_human_readable" => $literature['gnd'],
"explica" => $literature['gnd_explica'],
"name_human_readable" => $tlLoader->tl("literature", "literature", 'gnd'),
"explica" => $tlLoader->tl("literature", "literature", 'gnd_explica'),
],
"literature_isbn{$i}" => [
"required" => false,
"allowedValues" => [],
"dependsOn" => ["literature_title{$i}"],
"remark" => '',
"name_human_readable" => $literature['isbn'],
"explica" => $literature['isbn_explica'],
"name_human_readable" => $tlLoader->tl("literature", "literature", 'isbn'),
"explica" => $tlLoader->tl("literature", "literature", 'isbn_explica'),
],
"literature_signature{$i}" => [
"required" => false,
"allowedValues" => [],
"dependsOn" => ["literature_title{$i}"],
"remark" => '',
"name_human_readable" => $literature['id_in_museum'],
"explica" => $literature['id_in_museum_explica'],
"name_human_readable" => $tlLoader->tl("literature", "literature", 'id_in_museum'),
"explica" => $tlLoader->tl("literature", "literature", 'id_in_museum_explica'),
],
"literature_online{$i}" => [
"required" => false,
"allowedValues" => [],
"dependsOn" => ["literature_title{$i}"],
"remark" => '',
"name_human_readable" => $literature['online'],
"explica" => $literature['online_explica'],
"name_human_readable" => $tlLoader->tl("literature", "literature", 'online'),
"explica" => $tlLoader->tl("literature", "literature", 'online_explica'),
],
"literature_annotation{$i}" => [
"required" => false,
"allowedValues" => [],
"dependsOn" => ["literature_title{$i}"],
"remark" => '',
"name_human_readable" => $literature['annotation'],
"explica" => $literature['annotation_explica'],
"name_human_readable" => $tlLoader->tl("literature", "literature", 'annotation'),
"explica" => $tlLoader->tl("literature", "literature", 'annotation_explica'),
],
"literature_inlit{$i}" => [
"required" => false,
"allowedValues" => [],
"dependsOn" => ["literature_title{$i}"],
"remark" => '',
"name_human_readable" => $literature['where_inside'],
"explica" => $literature['where_in_explica'],
"name_human_readable" => $tlLoader->tl("literature", "literature", 'where_inside'),
"explica" => $tlLoader->tl("literature", "literature", 'where_in_explica'),
],
]);