1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
|
<?php
# Movable Type (r) Open Source (C) 2001-2012 Six Apart, Ltd.
# This program is distributed under the terms of the
# GNU General Public License, version 2.
#
# $Id$
global $_cc_Data;
$_cc_Data = array(
'by' => array(
'name' => 'Attribution',
'requires' => array('Attribution', 'Notice'),
'permits' => array('Reproduction', 'Distribution', 'DerivativeWorks'),
),
'by-nd' => array(
'name' => 'Attribution-NoDerivs',
'requires' => array('Attribution', 'Notice'),
'permits' => array('Reproduction', 'Distribution'),
),
'by-nd-nc' => array(
'name' => 'Attribution-NoDerivs-NonCommercial',
'requires' => array('Attribution', 'Notice'),
'permits' => array('Reproduction', 'Distribution'),
'prohibits' => array('CommercialUse'),
),
'by-nc' => array(
'name' => 'Attribution-NonCommercial',
'requires' => array('Attribution', 'Notice'),
'permits' => array('Reproduction', 'Distribution', 'DerivativeWorks'),
'prohibits' => array('CommercialUse'),
),
'by-nc-sa' => array(
'name' => 'Attribution-NonCommercial-ShareAlike',
'requires' => array('Attribution', 'Notice', 'ShareAlike'),
'permits' => array('Reproduction', 'Distribution', 'DerivativeWorks'),
'prohibits' => array('CommercialUse'),
),
'by-sa' => array(
'name' => 'Attribution-ShareAlike',
'requires' => array('Attribution', 'Notice', 'ShareAlike'),
'permits' => array('Reproduction', 'Distribution', 'DerivativeWorks'),
),
'nd' => array(
'name' => 'NonDerivative',
'requires' => array('Notice'),
'permits' => array('Reproduction', 'Distribution'),
),
'nd-nc' => array(
'name' => 'NonDerivative-NonCommercial',
'requires' => array('Notice'),
'permits' => array('Reproduction', 'Distribution'),
'prohibits' => array('CommercialUse'),
),
'nc' => array(
'name' => 'NonCommercial',
'requires' => array('Notice'),
'permits' => array('Reproduction', 'Distribution', 'DerivativeWorks'),
'prohibits' => array('CommercialUse'),
),
'nc-sa' => array(
'name' => 'NonCommercial-ShareAlike',
'requires' => array('Notice', 'ShareAlike'),
'permits' => array('Reproduction', 'Distribution', 'DerivativeWorks'),
'prohibits' => array('CommercialUse'),
),
'sa' => array(
'name' => 'ShareAlike',
'requires' => array('Notice', 'ShareAlike'),
'permits' => array('Reproduction', 'Distribution', 'DerivativeWorks'),
),
'pd' => array(
'name' => 'PublicDomain',
'permits' => array('Reproduction', 'Distribution', 'DerivativeWorks'),
),
);
function cc_url($code) {
if (preg_match('/(\S+) (\S+) (\S+)/', $code, $matches))
return $matches[2]; # the license URL
return $code == 'pd' ?
"http://web.resource.org/cc/PublicDomain" :
"http://creativecommons.org/licenses/$code/1.0/";
}
function cc_rdf($code) {
global $_cc_Data;
$url = cc_url($code);
$rdf = <<<RDF
<License rdf:about="$url">
RDF;
foreach (array('requires', 'permits', 'prohibits') as $type) {
if (isset($_cc_Data[$code])) {
if (!isset($_cc_Data[$code][$type]))
continue;
foreach ($_cc_Data[$code][$type] as $item) {
$rdf .= <<<RDF
<$type rdf:resource="http://web.resource.org/cc/$item" />
RDF;
}
}
}
return $rdf . "</License>\n";
}
function cc_name($code) {
global $_cc_Data;
if (preg_match('/(\S+) (\S+) (\S+)/', $code, $matches))
$code = $matches[1];
if (isset($_cc_Data[$code])) {
return $_cc_Data[$code]['name'];
} else {
return '';
}
}
?>
|