Accept iconclass names with specifying brackets
This commit is contained in:
@@ -399,26 +399,25 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
||||
*/
|
||||
private static function validateIconclassId(string $id):string|false {
|
||||
|
||||
if (filter_var($id, FILTER_VALIDATE_URL) !== false) {
|
||||
$id = rtrim(strtr($id, [
|
||||
'http://iconclass.org/rkd/' => '',
|
||||
'http://iconclass.org/' => '',
|
||||
'https://iconclass.org/' => '',
|
||||
'http://www.iconclass.org/rkd/' => '',
|
||||
'http://www.iconclass.org/' => '',
|
||||
'https://www.iconclass.org/' => '',
|
||||
]), '/');
|
||||
}
|
||||
$id = trim($id, "/");
|
||||
$id = trim(strtr($id, [
|
||||
'http://iconclass.org/rkd/' => '',
|
||||
'http://iconclass.org/' => '',
|
||||
'https://iconclass.org/' => '',
|
||||
'http://www.iconclass.org/rkd/' => '',
|
||||
'http://www.iconclass.org/' => '',
|
||||
'https://www.iconclass.org/' => '',
|
||||
]), '/');
|
||||
|
||||
if (!empty(trim($id, '0123456789abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ(+)'))) {
|
||||
if (!empty(trim($id, '0123456789abcdefghijklmnopqrstuvwxyzäüö-/ABCDEFGHIJKLMNOPQRSTUVWXYZÄÜÖ(+)'))) {
|
||||
// Try url_decoding
|
||||
$id = urldecode($id);
|
||||
if (!empty(trim($id, '0123456789abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ(+)'))) {
|
||||
if (!empty(trim($id, '0123456789abcdefghijklmnopqrstuvwxyzäüö-/ABCDEFGHIJKLMNOPQRSTUVWXYZÄÜÖ(+)'))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_numeric(substr($id, 0, 1))) return false;
|
||||
|
||||
return $id;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user