Add bootstrapping for tests, parse additional wikidata ID format
This commit is contained in:
4 files changed
+57
No files matched your search
@@ -624,6 +624,13 @@ private static function validateWikidataId(string $id):string|false {
|
||||
'https://www.wikidata.org/entity/' => '',
|
||||
'https://www.wikidata.org/w/index.php?search=&search=' => '',
|
||||
]);
|
||||
|
||||
if (str_starts_with($id, 'https://www.wikidata.org/w/index.php?title=')) {
|
||||
$id = str_replace('https://www.wikidata.org/w/index.php?title=', '', $id);
|
||||
if (($endPos = strpos($id, '&')) !== false) {
|
||||
$id = substr($id, 0, $endPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (substr($id, 0, 1) !== 'Q') {
|
||||
|
||||
Reference in new issue
Block a user