Merge branch 'master' of gitea:museum-digital/MDNodaHelpers

This commit is contained in:
Joshua Ramon Enslin 2021-10-10 13:22:44 +02:00
commit 99a5303773
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
3 changed files with 14 additions and 14 deletions

View File

@ -561,16 +561,16 @@ final class NodaTimeAutotranslater {
// Beginn: 1500. (1501 - 1) / 100 + 1 = 16. 16th century is the time.
$start_cen = ((\intval($timeInfo['zeit_beginn']) - 1) / 100) + 1;
// End: 1600. 16th century is the time.
$end_cen = (\intval($timeInfo['zeit_ende']) / 100);
$end_cen = \intval($timeInfo['zeit_ende']) / 100;
}
else {
// End: -1600. 16th century is the time.
$start_cen = (\intval($timeInfo['zeit_beginn']) / 100);
$start_cen = \intval($timeInfo['zeit_beginn']) / 100;
// End: -1500. (1501 - 1) / 100 + 1 = 16. 16th century is the time.
$end_cen = ((\intval($timeInfo['zeit_ende']) + 1) / 100) - 1;
}
$suffixMode = self::getSuffixModeForYearsWSuffix((\intval($timeInfo['zeit_beginn']) - 1), \intval($timeInfo['zeit_ende']));
$suffixMode = self::getSuffixModeForYearsWSuffix(\intval($timeInfo['zeit_beginn']) - 1, \intval($timeInfo['zeit_ende']));
$output = [];
@ -604,7 +604,7 @@ final class NodaTimeAutotranslater {
// End: 1600. 16th century is the time.
$end_cen = (\intval($timeInfo['zeit_ende']));
$suffixMode = self::getSuffixModeForYearsWSuffix((\intval($timeInfo['zeit_beginn']) - 1), \intval($timeInfo['zeit_ende']));
$suffixMode = self::getSuffixModeForYearsWSuffix(\intval($timeInfo['zeit_beginn']) - 1, \intval($timeInfo['zeit_ende']));
$output = [];
@ -822,7 +822,7 @@ final class NodaTimeAutotranslater {
return self::translateYearsWithSuffix($timeInfo);
}
$suffixMode = self::getSuffixModeForYearsWSuffix((\intval($timeInfo['zeit_beginn']) - 1), \intval($timeInfo['zeit_ende']));
$suffixMode = self::getSuffixModeForYearsWSuffix(\intval($timeInfo['zeit_beginn']) - 1, \intval($timeInfo['zeit_ende']));
if (\trim((string)$timeInfo['zeit_zaehlzeit_tag'], ", .0") === "") {
$dateStr = "{$timeInfo['zeit_zaehlzeit_jahr']}-{$timeInfo['zeit_zaehlzeit_monat']}-05 00:00:01";

View File

@ -493,7 +493,7 @@ final class NodaTimeSplitter {
if (\substr($datum, -2, 1) === " " and self::is_numeric((string)\substr($datum, -1, 1))) {
$day = "0" . \substr($datum, -1, 1);
}
else if ((empty($day)) and \substr($datum, -3, 1) === " " and self::is_numeric((string)\substr($datum, -2, 1))) {
else if (empty($day) and \substr($datum, -3, 1) === " " and self::is_numeric((string)\substr($datum, -2, 1))) {
$day = "0" . \substr($datum, -2, 1);
}
@ -757,7 +757,7 @@ final class NodaTimeSplitter {
}
$output[1] = "?";
if (empty(trim($output[2], "0 .,"))) $output[0] = \strval((\intval($output[0]) + 1));
if (empty(trim($output[2], "0 .,"))) $output[0] = \strval(\intval($output[0]) + 1);
$output[5] = "Nach";
return $output;
}
@ -775,7 +775,7 @@ final class NodaTimeSplitter {
}
$output[1] = "?";
if (empty(trim($output[2], "0 .,"))) $output[0] = \strval((\intval($output[0]) + 1));
if (empty(trim($output[2], "0 .,"))) $output[0] = \strval(\intval($output[0]) + 1);
$output[5] = "Nach";
return $output;
}
@ -788,7 +788,7 @@ final class NodaTimeSplitter {
if ($output = self::attempt_splitting(\substr($datum, $spacePos))) {
$output[0] = "?";
if (empty(trim($output[2], "0 .,"))) $output[1] = \strval((\intval($output[1]) - 1));
if (empty(trim($output[2], "0 .,"))) $output[1] = \strval(\intval($output[1]) - 1);
$output[5] = "Vor";
return $output;
}
@ -801,7 +801,7 @@ final class NodaTimeSplitter {
if ($output = self::attempt_splitting(\substr($datum, 0, $spacePos))) {
$output[0] = "?";
if (empty(trim($output[2], "0 .,"))) $output[1] = \strval((\intval($output[1]) - 1));
if (empty(trim($output[2], "0 .,"))) $output[1] = \strval(\intval($output[1]) - 1);
$output[5] = "Vor";
return $output;
}

View File

@ -151,7 +151,7 @@ final class NodaWikidataFetcher {
if (empty($wikipedia_cont = MD_STD::runCurl($linkUrl))) return '';
$doc = new DOMDocument();
if (!($doc->loadHTML($wikipedia_cont))) {
if (!$doc->loadHTML($wikipedia_cont)) {
return '';
}
@ -526,7 +526,7 @@ final class NodaWikidataFetcher {
if (!empty($cinfo['persinst_kurzinfo']) and substr($cinfo['persinst_kurzinfo'], 0, 3) !== 'GND') {
if (isset($_GET['keep'])) {
if (!($_GET['keep']) || $_GET['keep'] === 'replace') {
if (!$_GET['keep'] || $_GET['keep'] === 'replace') {
$updatePersinstStmt->bind_param("si", $datafromwiki, $persinst_id);
$updatePersinstStmt->execute();
@ -1189,7 +1189,7 @@ final class NodaWikidataFetcher {
$updateStmt = $this->_mysqli_noda->do_prepare("UPDATE `orte`
SET `ort_nord_sued` = ?, `ort_west_ost` = ?, ort_zoom = '9'
WHERE `ort_id` = ?");
$updateStmt->bind_param("ssi", $latitude_wd, $longitude_wd, $onum);
$updateStmt->bind_param("ddi", $latitude_wd, $longitude_wd, $onum);
$updateStmt->execute();
$updateStmt->close();
unset($updateStmt);
@ -1335,7 +1335,7 @@ final class NodaWikidataFetcher {
if (!empty($cinfo['tag_anmerkung']) and substr($cinfo['tag_anmerkung'], 0, 3) !== 'GND') {
if (isset($_GET['keep'])) {
if (!($_GET['keep']) || $_GET['keep'] === 'replace') {
if (!$_GET['keep'] || $_GET['keep'] === 'replace') {
$updateTagDescStmt->bind_param("si", $datafromwiki, $tag_id);
$updateTagDescStmt->execute();