You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pixelfed/app/Util/Media/License.php

139 lines
6.3 KiB
PHTML

<?php
namespace App\Util\Media;
9 months ago
class License
{
public static function get()
{
return [
1 => [
9 months ago
'id' => 1,
'title' => 'All Rights Reserved',
'name' => 'All Rights Reserved',
'description' => 'You, the copyright holder, reserve all rights provided by copyright law, such as the right to make copies, distribute your work, perform your work, license, or otherwise exploit your work; no rights are waived under this license.',
'terms' => [],
'url' => url('/site/kb/licenses'),
],
5 => [
9 months ago
'id' => 5,
'title' => 'Public Domain',
'name' => 'Public Domain Work',
'description' => 'Works, or aspects of copyrighted works, which copyright law does not protect.',
'terms' => [],
'url' => url('/site/kb/licenses'),
],
6 => [
9 months ago
'id' => 6,
'title' => 'Public Domain (CC0)',
'name' => 'Public Domain Dedication (CC0)',
'description' => 'You, the copyright holder, waive your interest in your work and place the work as completely as possible in the public domain so others may freely exploit and use the work without restriction under copyright or database law.',
'terms' => [],
'url' => url('/site/kb/licenses'),
],
11 => [
9 months ago
'id' => 11,
'title' => 'CC BY',
'name' => 'Attribution',
'description' => 'This license allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, so long as attribution is given to the creator. The license allows for commercial use.',
'terms' => [
'Credit must be given to the creator',
],
9 months ago
'url' => 'https://creativecommons.org/licenses/by/4.0/',
],
12 => [
9 months ago
'id' => 12,
'title' => 'CC BY-SA',
'name' => 'Attribution-ShareAlike',
'description' => 'This license allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, so long as attribution is given to the creator. The license allows for commercial use. If you remix, adapt, or build upon the material, you must license the modified material under identical terms.',
'terms' => [
'Credit must be given to the creator',
'Adaptations must be shared under the same terms',
],
9 months ago
'url' => 'https://creativecommons.org/licenses/by-sa/4.0/',
],
13 => [
9 months ago
'id' => 13,
'title' => 'CC BY-NC',
'name' => 'Attribution-NonCommercial',
'description' => 'This license allows reusers to distribute, remix, adapt, and build upon the material in any medium or format for noncommercial purposes only, and only so long as attribution is given to the creator.',
'terms' => [
'Credit must be given to the creator',
'Only noncommercial uses of the work are permitted',
],
9 months ago
'url' => 'https://creativecommons.org/licenses/by-nc/4.0/',
],
14 => [
9 months ago
'id' => 14,
'title' => 'CC BY-NC-SA',
'name' => 'Attribution-NonCommercial-ShareAlike',
'description' => 'This license allows reusers to distribute, remix, adapt, and build upon the material in any medium or format for noncommercial purposes only, and only so long as attribution is given to the creator. If you remix, adapt, or build upon the material, you must license the modified material under identical terms.',
'terms' => [
'Credit must be given to the creator',
'Only noncommercial uses of the work are permitted',
'Adaptations must be shared under the same terms',
],
9 months ago
'url' => 'https://creativecommons.org/licenses/by-nc-sa/4.0/',
],
15 => [
9 months ago
'id' => 15,
'title' => 'CC BY-ND',
'name' => 'Attribution-NoDerivs',
'description' => 'This license allows reusers to copy and distribute the material in any medium or format in unadapted form only, and only so long as attribution is given to the creator. The license allows for commercial use.',
'terms' => [
'Credit must be given to the creator',
'No derivatives or adaptations of the work are permitted',
],
9 months ago
'url' => 'https://creativecommons.org/licenses/by-nd/4.0/',
],
16 => [
9 months ago
'id' => 16,
'title' => 'CC BY-NC-ND',
'name' => 'Attribution-NonCommercial-NoDerivs',
'description' => 'This license allows reusers to copy and distribute the material in any medium or format in unadapted form only, for noncommercial purposes only, and only so long as attribution is given to the creator.',
'terms' => [
'Credit must be given to the creator',
'Only noncommercial uses of the work are permitted',
'No derivatives or adaptations of the work are permitted',
],
9 months ago
'url' => 'https://creativecommons.org/licenses/by-nc-nd/4.0/',
],
];
}
public static function keys()
{
return array_keys(self::get());
}
public static function getId($index)
{
return self::get()[$index]['id'];
}
public static function names()
{
return collect(self::get())
9 months ago
->map(function ($v) {
return $v['title'];
})
->values()
->toArray();
}
public static function nameToId($name)
{
9 months ago
$license = collect(self::get())
->filter(function ($l) use ($name) {
return $l['title'] == $name;
})
->first();
9 months ago
if (! $license || $license['id'] < 2) {
return null;
}
9 months ago
return $license['id'];
}
}