Update of /cvsroot/php-blog/serendipity/plugins/serendipity_event_creativecommons
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13996
Modified Files:
serendipity_event_creativecommons.php
Log Message:
Make plugin play nice with sites already using version 1 of the license.
Index: serendipity_event_creativecommons.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/plugins/serendipity_event_creativecommons/serendipity_event_creativecommons.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- serendipity_event_creativecommons.php 29 May 2004 09:04:20 -0000 1.8
+++ serendipity_event_creativecommons.php 14 Jun 2004 11:29:36 -0000 1.9
@@ -8,8 +8,8 @@
@define('PLUGIN_CREATIVECOMMONS_TXT_DESC', 'Zeigt eine kurze Erklärung zu Ihrer individuellen Lizensierung an');
@define('PLUGIN_CREATIVECOMMONS_CAP', 'Der Inhalt dieses Werkes ist lizensiert unter der <a href="#license_uri#">Creative Commons Lizenz</a>');
@define('PLUGIN_CREATIVECOMMONS_CAP_PD', 'Der Inhalt dieses Werkes ist als <a href="#license_url#}">Public Domain</a> gewidmet');
- @define('PLUGIN_CREATIVECOMMONS_BY', 'Attribution (Nennung als Author) erforderlich?');
- @define('PLUGIN_CREATIVECOMMONS_BY_DESC', 'Der Lizenzgeber erlaubt anderen dieses Werk zu kopieren, zu verteilen, anzuwenden und darzustellen. Als Gegenleistung müssen Lizenznehmer den ursprünglichen Authoren nennen.');
+ // @define('PLUGIN_CREATIVECOMMONS_BY', 'Attribution (Nennung als Author) erforderlich?');
+ // @define('PLUGIN_CREATIVECOMMONS_BY_DESC', 'Der Lizenzgeber erlaubt anderen dieses Werk zu kopieren, zu verteilen, anzuwenden und darzustellen. Als Gegenleistung müssen Lizenznehmer den ursprünglichen Authoren nennen.');
@define('PLUGIN_CREATIVECOMMONS_NC', 'Kommerzielle Nutzung des Werkes erlauben?');
@define('PLUGIN_CREATIVECOMMONS_NC_DESC', 'Der Lizenzgeber erlaubt anderen dieses Werk zu kopieren, zu verteilen, anzuwenden und darzustellen. Als Gegenleistung dürfen die Lizenznehmer das Werk nicht in kommerziellem Kontext einsetzen - es sei denn, sie erhalten die ausdrückliche Genehmigung.');
@define('PLUGIN_CREATIVECOMMONS_ND', 'Veränderungen des Werkes erlauben?');
@@ -25,8 +25,8 @@
@define('PLUGIN_CREATIVECOMMONS_TXT_DESC', 'For visible notifications of license status, show a brief explanation of your license choice.');
@define('PLUGIN_CREATIVECOMMONS_CAP', 'Original content in this work is licensed under a <a href="#license_uri#">Creative Commons License</a>');
@define('PLUGIN_CREATIVECOMMONS_CAP_PD', 'Original content in this work is dedicated to the <a href="#license_url#}">Public Domain</a>');
- @define('PLUGIN_CREATIVECOMMONS_BY', 'Require attribution?');
- @define('PLUGIN_CREATIVECOMMONS_BY_DESC', 'The licensor permits others to copy, distribute, display, and perform the work. In return, licensees must give the original author credit.');
+ // @define('PLUGIN_CREATIVECOMMONS_BY', 'Require attribution?');
+ // @define('PLUGIN_CREATIVECOMMONS_BY_DESC', 'The licensor permits others to copy, distribute, display, and perform the work. In return, licensees must give the original author credit.');
@define('PLUGIN_CREATIVECOMMONS_NC', 'Allow commercial uses of your work?');
@define('PLUGIN_CREATIVECOMMONS_NC_DESC', 'The licensor permits others to copy, distribute, display, and perform the work. In return, licensees may not use the work for commercial purposes -- unless they get the licensor\'s permission.');
@define('PLUGIN_CREATIVECOMMONS_ND', 'Allow modifications of your work?');
@@ -40,7 +40,7 @@
{
$propbag->add('name', PLUGIN_CREATIVECOMMONS_NAME);
$propbag->add('description', PLUGIN_CREATIVECOMMONS_DESC);
- $propbag->add('configuration', array('by', 'nc', 'nd', 'txt'));
+ $propbag->add('configuration', array('nc', 'nd', 'txt', 'cc_v2'));
$propbag->add('event_hooks',
array('frontend_display:rss-1.0:per_entry' => true,
'frontend_display:rss-1.0:once' => true,
@@ -54,11 +54,18 @@
function introspect_config_item($name, &$propbag)
{
switch($name) {
+ /*
case 'by':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_CREATIVECOMMONS_BY);
$propbag->add('description', PLUGIN_CREATIVECOMMONS_BY_DESC);
break;
+ */
+
+ case 'cc_v2':
+ $propbag->add('type', 'hidden');
+ $propbag->add('value', 'true');
+ break;
case 'nc':
$propbag->add('type', 'boolean');
@@ -98,6 +105,7 @@
global $serendipity;
$license_data = $this->get_license_data();
+ $license_version = $this->get_config('cc_version', '1.0');
$license_type = $license_data['type'];
$license_string = $license_data['string'];
$rdf = $license_data['rdf'];
@@ -105,7 +113,7 @@
if ($license_string == '') {
$license_uri = 'http://web.resource.org/cc/PublicDomain';
} else {
- $license_uri = 'http://creativecommons.org/licenses/'.$license_string.'/2.0/';
+ $license_uri = 'http://creativecommons.org/licenses/'.$license_string.'/'.$license_version.'/';
}
$cc_visibility = 'invisible';
@@ -182,8 +190,14 @@
function get_license_data() {
$license_type = array();
+ $license_version = $this->get_config('cc_version', '1.0');
- if (serendipity_db_bool($this->get_config('by', true))) {
+ if ( ($license_version < 2.0) && ($this->get_config('cc_v2', 'false') == 'true') ) {
+ $this->set_config('cc_version', '2.0');
+ $license_version = '2.0';
+ }
+
+ if (($license_version >= 2.0) || serendipity_db_bool($this->get_config('by', true))) {
$license_type[] = 'by';
}
|