[cc-commits] [SCM] Integrates CC licensing into media manager and posts (branch master) updated. 0.5-16-gbb7a155
git version control
git at a7.creativecommons.org
Tue Jul 6 09:05:56 EDT 2010
The branch, master has been updated
via bb7a155951ae8acb1bea5deb60c5c8d4b4df653e (commit)
via 410ae78d09f2dc971e5f2431a53a10a649fa9e4d (commit)
from 3d0491092c79bb8236f16bb04c3e906cb7dc17d5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit bb7a155951ae8acb1bea5deb60c5c8d4b4df653e
Author: Nils Dagsson Moskopp <nils at dieweltistgarnichtso.net>
Date: Tue Jul 6 15:05:28 2010 +0200
+ plugin now provides default license option
commit 410ae78d09f2dc971e5f2431a53a10a649fa9e4d
Author: Nils Dagsson Moskopp <nils at dieweltistgarnichtso.net>
Date: Tue Jul 6 15:02:11 2010 +0200
* repaired line-height in wetter.css so it looks nicer
-----------------------------------------------------------------------
Summary of changes (followed by patch):
wordpress-cc-plugin/css/wetter.css | 1 +
wordpress-cc-plugin/wordpress-cc-plugin.php | 75 ++++++++++++++++++++++-----
2 files changed, 63 insertions(+), 13 deletions(-)
diff --git a/wordpress-cc-plugin/css/wetter.css b/wordpress-cc-plugin/css/wetter.css
index 58cd001..4253614 100644
--- a/wordpress-cc-plugin/css/wetter.css
+++ b/wordpress-cc-plugin/css/wetter.css
@@ -15,6 +15,7 @@ figure[about] > video {
figure[about] > figcaption {
border: 1px solid #888a85;
display: block;
+ line-height: 1.5em;
padding: 11px 11px 11px 110px;
}
diff --git a/wordpress-cc-plugin/wordpress-cc-plugin.php b/wordpress-cc-plugin/wordpress-cc-plugin.php
index 7094f3f..46da8a0 100644
--- a/wordpress-cc-plugin/wordpress-cc-plugin.php
+++ b/wordpress-cc-plugin/wordpress-cc-plugin.php
@@ -18,11 +18,13 @@ Author URI: http://dieweltistgarnichtso.net
// create database entry on install
function cc_wordpress_register_settings() {
register_setting('cc_wordpress_options', 'cc_wordpress_css');
+ register_setting('cc_wordpress_options', 'cc_wordpress_default_license');
}
// delete database entry on uninstall
function cc_wordpress_uninstall(){
delete_option('cc_wordpress_css');
+ delete_option('cc_wordpress_options', 'cc_wordpress_default_license');
}
// install hook
@@ -71,6 +73,39 @@ function cc_wordpress_admin_css_list() {
return $html;
}
+// generate license dropdown
+function cc_wordpress_license_select($current_license, $name, $mark_default) {
+ $html = '<select id="cc_license" name="'. $name .'"">';
+
+ $licenses = array('reserved', 'by', 'by-nc', 'by-nc-nd', 'by-nc-sa', 'by-nd', 'by-sa');
+ foreach ($licenses as $license) {
+ $selected = ($license == $current_license) ? ' selected="selected"' : '';
+ $license_name = cc_wordpress_license_name($license, $mark_default);
+ $html .= '<option value="'. $license .'"'. $selected .'>'. $license_name .'</option>';
+ }
+
+ $html .= '</select>';
+
+ return $html;
+}
+
+//generate license name
+function cc_wordpress_license_name($license, $mark_default) {
+ $default_license = get_option('cc_wordpress_default_license');
+
+ if ($license == 'reserved') {
+ $license_name = __('All rights reserved.');
+ } else {
+ $license_name = strtoupper($license);
+
+ if ($license == $default_license and $mark_default == true) {
+ $license_name .= ' ' .__('(Default)');
+ }
+ }
+
+ return $license_name;
+}
+
// admin page
function cc_wordpress_admin_page() {
?>
@@ -98,6 +133,22 @@ label input {
settings_fields('cc_wordpress_options');
?>
+ <h2>Default License</h2>
+ <p>
+ Setting a default license pre-fills the license chooser form field with the chosen license.
+ </p>
+
+ <p>
+ <label>
+ <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAQAAABuvaSwAAAAAnNCSVQICFXsRgQAAAAJcEhZcwAABJ0AAASdAXw0a6EAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAABmklEQVQoz5XTPWiTURTG8d8b/GjEii2VKoqKi2DFwU9wUkTdFIeKIEWcpIOTiA4OLgVdXFJwEZHoIII0TiJipZJFrIgGKXQQCRg6RKREjEjMcQnmTVPB3jNc7j1/7nk49zlJ+P+1rPsqydqFD1HvSkUq9MkpaQihoWRcfzqftGUkx9y10Yy33vlttz2GzBmNQtfLrmqqGu6odNKccOvvubXt1/Da+tAZBkwKx1OwHjNqti1EQ7DBN2Vr2vBl4cJiaAjOCdfbcMF3mWC7O6qmDFntms9KzgYZNU/bcFkxBM+UjXjiilFNl4yZsCIoqrRgA0IuGNRws1W66H1KSE5YFzKoa+pFTV0/ydYk66s+kt5kE1ilqd7qs49KIcj75bEfxp0RJn0yKxtMm21rzmtYG6x0Wt5Fy4ODbhuzJejx06M2PCzc+2frbgjn0z9YEE4tih7Q8FyShgdVzRvpQk+omLe5wxvBIV+ECTtkQpCx00Oh4ugCI7XcfF8INa9MqQnhQdrRSedYJYcdsc9eTHvjRbzsyC5lBjNLYP0B5PQk1O2dJT8AAAAASUVORK5CYII=" alt="Creative Commons"/>
+
+ <?php
+ $current_license = get_option('cc_wordpress_default_license');
+ echo cc_wordpress_license_select($current_license, 'cc_wordpress_default_license', false);
+ ?>
+ </label>
+ </p>
+
<h2>Stylesheet</h2>
<p>
A stylesheet changes the look of the license attribution.
@@ -213,20 +264,17 @@ table {
$id = $post->ID;
+ $default_license = get_option('cc_wordpress_default_license');
$current_license = get_post_meta($id, 'cc_license', true);
-
- $html = '<select id="cc_license" name="attachments['. $id .'][cc_license]">';
- $html .= '<option value="">' . __('All rights reserved.') .'</option>';
- $licenses = array('by', 'by-nc', 'by-nc-nd', 'by-nc-sa', 'by-nd', 'by-sa');
- foreach ( $licenses as $license ) {
- $selected = ( $license == $current_license ) ? ' selected="selected"' : '';
- $license_upper = strtoupper($license);
- $html .= '<option value="'. $license .'"'. $selected .'>'. $license_upper .'</option>';
+ if ($current_license == '') {
+ $current_license = $default_license;
}
- $html .= '</select>';
+
+ $name = 'attachments['. $id .'][cc_license]';
+ $html = cc_wordpress_license_select($current_license, $name, true);
$form_fields['cc_license'] = array(
- 'label' => '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAQAAABuvaSwAAAAAnNCSVQICFXsRgQAAAAJcEhZcwAABJ0AAASdAXw0a6EAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAABmklEQVQoz5XTPWiTURTG8d8b/GjEii2VKoqKi2DFwU9wUkTdFIeKIEWcpIOTiA4OLgVdXFJwEZHoIII0TiJipZJFrIgGKXQQCRg6RKREjEjMcQnmTVPB3jNc7j1/7nk49zlJ+P+1rPsqydqFD1HvSkUq9MkpaQihoWRcfzqftGUkx9y10Yy33vlttz2GzBmNQtfLrmqqGu6odNKccOvvubXt1/Da+tAZBkwKx1OwHjNqti1EQ7DBN2Vr2vBl4cJiaAjOCdfbcMF3mWC7O6qmDFntms9KzgYZNU/bcFkxBM+UjXjiilFNl4yZsCIoqrRgA0IuGNRws1W66H1KSE5YFzKoa+pFTV0/ydYk66s+kt5kE1ilqd7qs49KIcj75bEfxp0RJn0yKxtMm21rzmtYG6x0Wt5Fy4ODbhuzJejx06M2PCzc+2frbgjn0z9YEE4tih7Q8FyShgdVzRvpQk+omLe5wxvBIV+ECTtkQpCx00Oh4ugCI7XcfF8INa9MqQnhQdrRSedYJYcdsc9eTHvjRbzsyC5lBjNLYP0B5PQk1O2dJT8AAAAASUVORK5CYII="/ alt="Creative Commons"> '. __('License'),
+ 'label' => '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAQAAABuvaSwAAAAAnNCSVQICFXsRgQAAAAJcEhZcwAABJ0AAASdAXw0a6EAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAABmklEQVQoz5XTPWiTURTG8d8b/GjEii2VKoqKi2DFwU9wUkTdFIeKIEWcpIOTiA4OLgVdXFJwEZHoIII0TiJipZJFrIgGKXQQCRg6RKREjEjMcQnmTVPB3jNc7j1/7nk49zlJ+P+1rPsqydqFD1HvSkUq9MkpaQihoWRcfzqftGUkx9y10Yy33vlttz2GzBmNQtfLrmqqGu6odNKccOvvubXt1/Da+tAZBkwKx1OwHjNqti1EQ7DBN2Vr2vBl4cJiaAjOCdfbcMF3mWC7O6qmDFntms9KzgYZNU/bcFkxBM+UjXjiilFNl4yZsCIoqrRgA0IuGNRws1W66H1KSE5YFzKoa+pFTV0/ydYk66s+kt5kE1ilqd7qs49KIcj75bEfxp0RJn0yKxtMm21rzmtYG6x0Wt5Fy4ODbhuzJejx06M2PCzc+2frbgjn0z9YEE4tih7Q8FyShgdVzRvpQk+omLe5wxvBIV+ECTtkQpCx00Oh4ugCI7XcfF8INa9MqQnhQdrRSedYJYcdsc9eTHvjRbzsyC5lBjNLYP0B5PQk1O2dJT8AAAAASUVORK5CYII=" alt="Creative Commons"> '. __('License'),
'input' => 'html',
'html' => $html,
'helps' => __('Choose a Creative Commons License.')
@@ -329,9 +377,6 @@ function cc_wordpress_create_figure($attachment_id, $title) {
$license_url = get_post_meta($id, 'cc_license_url', true);
switch ($license) {
- case "":
- // no license, just return standard markup
- return wp_get_attachment_image($id);
case "by":
$license_abbr = 'CC BY';
$license_full = 'Creative Commons'. __('Attribution');
@@ -361,6 +406,10 @@ function cc_wordpress_create_figure($attachment_id, $title) {
$license_abbr = 'CC BY-NC-SA';
$license_full = 'Creative Commons'. __('Attribution-Noncommercial-Share Alike');
break;
+
+ default:
+ // no license, just return standard markup
+ return wp_get_attachment_image($id);
}
// produce caption
hooks/post-receive
--
Integrates CC licensing into media manager and posts
More information about the cc-commits
mailing list