69 lines
2.2 KiB
PHP
69 lines
2.2 KiB
PHP
<?PHP
|
|
/**
|
|
* Contains a class of available licenses.
|
|
*
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
*/
|
|
declare(strict_types = 1);
|
|
|
|
/**
|
|
* Class containing static functions for getting available licenses on md.
|
|
*/
|
|
final class MDLicensesSet extends MDValueSet {
|
|
|
|
const DEFAULT_LICENSE_IMGS = 'CC BY-NC-SA';
|
|
const DEFAULT_LICENSE_METADATA = 'CC BY-NC-SA';
|
|
|
|
const AVAILABLE_LICENSES_NAMES = [
|
|
|
|
'CC BY-NC-SA',
|
|
'CC BY-NC-ND',
|
|
'CC BY-NC',
|
|
'CC BY-ND',
|
|
'CC BY-SA',
|
|
'CC BY',
|
|
'CC0',
|
|
'RR-F',
|
|
'RR-P',
|
|
'RR-R',
|
|
'Public Domain Mark',
|
|
'Orphan Work',
|
|
|
|
];
|
|
|
|
const AVAILABLE_LICENSES = [
|
|
|
|
'CC BY-NC-SA' => 'https://creativecommons.org/licenses/by-nc-sa/4.0/',
|
|
'CC BY-NC-ND' => 'https://creativecommons.org/licenses/by-nc-nd/4.0/',
|
|
'CC BY-NC' => 'https://creativecommons.org/licenses/by-nc/4.0/',
|
|
'CC BY-ND' => 'https://creativecommons.org/licenses/by-nd/4.0/',
|
|
'CC BY-SA' => 'https://creativecommons.org/licenses/by-sa/4.0/',
|
|
'CC BY' => 'https://creativecommons.org/licenses/by/4.0/',
|
|
'CC0' => 'https://creativecommons.org/publicdomain/zero/1.0/',
|
|
'RR-F' => 'https://www.europeana.eu/rights/rr-f/',
|
|
'RR-P' => 'https://www.europeana.eu/rights/rr-p/',
|
|
'RR-R' => 'https://www.europeana.eu/rights/rr-r/',
|
|
'Public Domain Mark' => 'https://creativecommons.org/publicdomain/mark/1.0/',
|
|
'Orphan Work' => 'https://www.europeana.eu/rights/orphan-work-eu/',
|
|
|
|
];
|
|
|
|
/**
|
|
* Function for checking the availability of a provided license at
|
|
* museum-digital.
|
|
* If the license is available, the corresponding URL is returned. Else, false
|
|
* is returned.
|
|
*
|
|
* @param string $license License to check.
|
|
*
|
|
* @return string|boolean
|
|
*/
|
|
final public static function checkLicenseAvailable(string $license) {
|
|
if (isset(self::AVAILABLE_LICENSES[$license])) {
|
|
return self::AVAILABLE_LICENSES[$license];
|
|
}
|
|
return false;
|
|
|
|
}
|
|
}
|