event_creativecommons:
* Changed default cc version to 3.0, respecting old configuration while updating. * BY only version is only valid since 3.0. 2.5 doesn't support this. * Japanese users get a wrong link to the creative common license * Mouseover image title supports Mozilla, too (title attribute)
This commit is contained in:
parent
bfb29a697b
commit
3894f4b673
@ -23,13 +23,13 @@ class serendipity_event_creativecommons extends serendipity_event {
|
|||||||
$propbag->add('description', PLUGIN_CREATIVECOMMONS_DESC);
|
$propbag->add('description', PLUGIN_CREATIVECOMMONS_DESC);
|
||||||
$propbag->add('stackable', false);
|
$propbag->add('stackable', false);
|
||||||
$propbag->add('author', 'Evan Nemerson');
|
$propbag->add('author', 'Evan Nemerson');
|
||||||
$propbag->add('version', '1.3');
|
$propbag->add('version', '1.4');
|
||||||
$propbag->add('requirements', array(
|
$propbag->add('requirements', array(
|
||||||
'serendipity' => '0.8',
|
'serendipity' => '0.8',
|
||||||
'smarty' => '2.6.7',
|
'smarty' => '2.6.7',
|
||||||
'php' => '4.1.0'
|
'php' => '4.1.0'
|
||||||
));
|
));
|
||||||
$propbag->add('configuration', array('nc', 'nd', 'txt', 'cc_v2'));
|
$propbag->add('configuration', array('cc_version', 'nc', 'nd', 'txt', 'image_type'));
|
||||||
$propbag->add('event_hooks',
|
$propbag->add('event_hooks',
|
||||||
array('frontend_display:rss-1.0:per_entry' => true,
|
array('frontend_display:rss-1.0:per_entry' => true,
|
||||||
'frontend_display:rss-1.0:once' => true,
|
'frontend_display:rss-1.0:once' => true,
|
||||||
@ -51,10 +51,17 @@ class serendipity_event_creativecommons extends serendipity_event {
|
|||||||
$propbag->add('description', PLUGIN_CREATIVECOMMONS_BY_DESC);
|
$propbag->add('description', PLUGIN_CREATIVECOMMONS_BY_DESC);
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
|
case 'cc_version':
|
||||||
case 'cc_v2':
|
$cc_versions = array(
|
||||||
$propbag->add('type', 'hidden');
|
'1.0' => '1.0',
|
||||||
$propbag->add('value', 'true');
|
'2.5' => '2.5',
|
||||||
|
'3.0' => '3.0'
|
||||||
|
);
|
||||||
|
$propbag->add('type', 'select');
|
||||||
|
$propbag->add('name', PLUGIN_CREATIVECOMMONS_VERSION);
|
||||||
|
$propbag->add('description', PLUGIN_CREATIVECOMMONS_VERSION_DESC);
|
||||||
|
$propbag->add('select_values', $cc_versions);
|
||||||
|
$propbag->add('default', '3.0');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'nc':
|
case 'nc':
|
||||||
@ -76,6 +83,18 @@ class serendipity_event_creativecommons extends serendipity_event {
|
|||||||
$propbag->add('default', 'yes');
|
$propbag->add('default', 'yes');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case 'image_type':
|
||||||
|
$image_types = array(
|
||||||
|
'generic' => PLUGIN_CREATIVECOMMONS_IMAGETYPE_GENERIC,
|
||||||
|
'small' => PLUGIN_CREATIVECOMMONS_IMAGETYPE_SMALL,
|
||||||
|
'big' => PLUGIN_CREATIVECOMMONS_IMAGETYPE_BIG
|
||||||
|
);
|
||||||
|
$propbag->add('type', 'select');
|
||||||
|
$propbag->add('name', PLUGIN_CREATIVECOMMONS_IMAGETYPE);
|
||||||
|
$propbag->add('description', PLUGIN_CREATIVECOMMONS_IMAGETYPE_DESC);
|
||||||
|
$propbag->add('select_values', $image_types);
|
||||||
|
$propbag->add('default', 'generic');
|
||||||
|
break;
|
||||||
|
|
||||||
case 'txt':
|
case 'txt':
|
||||||
$propbag->add('type', 'boolean');
|
$propbag->add('type', 'boolean');
|
||||||
@ -99,7 +118,7 @@ class serendipity_event_creativecommons extends serendipity_event {
|
|||||||
global $serendipity;
|
global $serendipity;
|
||||||
|
|
||||||
$license_data = $this->get_license_data();
|
$license_data = $this->get_license_data();
|
||||||
$license_version = $this->get_config('cc_version', '1.0');
|
$license_version = $this->get_config('cc_version', '3.0');
|
||||||
$license_type = $license_data['type'];
|
$license_type = $license_data['type'];
|
||||||
$license_string = $license_data['string'];
|
$license_string = $license_data['string'];
|
||||||
$rdf = $license_data['rdf'];
|
$rdf = $license_data['rdf'];
|
||||||
@ -110,7 +129,7 @@ class serendipity_event_creativecommons extends serendipity_event {
|
|||||||
$license_uri = 'http://creativecommons.org/licenses/'.$license_string.'/'.$license_version.'/';
|
$license_uri = 'http://creativecommons.org/licenses/'.$license_string.'/'.$license_version.'/';
|
||||||
switch ($serendipity['lang']){
|
switch ($serendipity['lang']){
|
||||||
case 'ja':
|
case 'ja':
|
||||||
$license_uri .= 'jp/';
|
$license_uri .= 'deed.ja';
|
||||||
break;
|
break;
|
||||||
case 'de':
|
case 'de':
|
||||||
$license_uri .= 'deed.de';
|
$license_uri .= 'deed.de';
|
||||||
@ -127,16 +146,18 @@ class serendipity_event_creativecommons extends serendipity_event {
|
|||||||
$eventData['display_dat'] .= '<div style="text-align: center;">';
|
$eventData['display_dat'] .= '<div style="text-align: center;">';
|
||||||
if ($license_string == '') {
|
if ($license_string == '') {
|
||||||
if ($cc_visibility == 'visible') {
|
if ($cc_visibility == 'visible') {
|
||||||
|
$image_titel = 'No Rights Reserved';
|
||||||
$eventData['display_dat'] .= '<a href="http://creativecommons.org/licenses/publicdomain">';
|
$eventData['display_dat'] .= '<a href="http://creativecommons.org/licenses/publicdomain">';
|
||||||
$eventData['display_dat'] .= '<img style="border: 0px" alt="No Rights Reserved" src="' . serendipity_getTemplateFile('img/norights.png') .'" />';
|
$eventData['display_dat'] .= '<img style="border: 0px" alt="' . $image_titel. '" title="' . $image_titel. '" src="' . serendipity_getTemplateFile('img/norights.png') .'" />';
|
||||||
$eventData['display_dat'] .= '</a>';
|
$eventData['display_dat'] .= '</a>';
|
||||||
if (serendipity_db_bool($this->get_config('txt', true))) {
|
if (serendipity_db_bool($this->get_config('txt', true))) {
|
||||||
$eventData['display_dat'] .= '<br />' . str_replace('#license_uri#', $license_uri, PLUGIN_CREATIVECOMMONS_CAP_PD);
|
$eventData['display_dat'] .= '<br />' . str_replace('#license_uri#', $license_uri, PLUGIN_CREATIVECOMMONS_CAP_PD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($cc_visibility == 'visible') {
|
} elseif ($cc_visibility == 'visible') {
|
||||||
|
$image_titel = 'Creative Commons License - Some Rights Reserved';
|
||||||
$eventData['display_dat'] .= '<a href="'.$license_uri.'">';
|
$eventData['display_dat'] .= '<a href="'.$license_uri.'">';
|
||||||
$eventData['display_dat'] .= '<img style="border: 0px" alt="Creative Commons License - Some Rights Reserved" src="' . serendipity_getTemplateFile('img/somerights20.gif') .'" />';
|
$eventData['display_dat'] .= '<img style="border: 0px" alt="' . $image_titel. '" title="' . $image_titel. '" src="' . serendipity_getTemplateFile('img/somerights20.gif') .'" />';
|
||||||
$eventData['display_dat'] .= '</a>';
|
$eventData['display_dat'] .= '</a>';
|
||||||
if (serendipity_db_bool($this->get_config('txt', true))) {
|
if (serendipity_db_bool($this->get_config('txt', true))) {
|
||||||
$eventData['display_dat'] .= '<br />' . str_replace('#license_uri#', $license_uri, PLUGIN_CREATIVECOMMONS_CAP);
|
$eventData['display_dat'] .= '<br />' . str_replace('#license_uri#', $license_uri, PLUGIN_CREATIVECOMMONS_CAP);
|
||||||
@ -194,12 +215,7 @@ class serendipity_event_creativecommons extends serendipity_event {
|
|||||||
|
|
||||||
function get_license_data() {
|
function get_license_data() {
|
||||||
$license_type = array();
|
$license_type = array();
|
||||||
$license_version = $this->get_config('cc_version', '1.0');
|
$license_version = $this->get_config('cc_version', '3.0');
|
||||||
|
|
||||||
if ( ($license_version < 2.5) && ($this->get_config('cc_v2', 'false') == 'true') ) {
|
|
||||||
$this->set_config('cc_version', '2.5');
|
|
||||||
$license_version = '2.5';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($license_version >= 2.5) || serendipity_db_bool($this->get_config('by', true))) {
|
if (($license_version >= 2.5) || serendipity_db_bool($this->get_config('by', true))) {
|
||||||
$license_type[] = 'by';
|
$license_type[] = 'by';
|
||||||
@ -222,6 +238,8 @@ class serendipity_event_creativecommons extends serendipity_event {
|
|||||||
|
|
||||||
switch ($license_string) {
|
switch ($license_string) {
|
||||||
case 'by':
|
case 'by':
|
||||||
|
// BY only is only valid from version 3.0 on
|
||||||
|
$license_version = '3.0';
|
||||||
$rdf = array(
|
$rdf = array(
|
||||||
'Attribution' => 'requires',
|
'Attribution' => 'requires',
|
||||||
'Reproduction' => 'permits',
|
'Reproduction' => 'permits',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user