[cc-commits] [SCM] Integrates CC licensing into media manager and posts (branch master) updated. 0.5-33-ga80bf7d

git version control git at a7.creativecommons.org
Tue Jul 27 00:47:46 EDT 2010


The branch, master has been updated
       via  a80bf7ddf271ec39658cc0942ae1258eb02b32b5 (commit)
       via  8a6efb39ebeb27ff0451fd5b03022ffe92f26922 (commit)
      from  896525c66c00597f255caa3cf335121a5931cb47 (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 a80bf7ddf271ec39658cc0942ae1258eb02b32b5
Merge: 896525c66c00597f255caa3cf335121a5931cb47 8a6efb39ebeb27ff0451fd5b03022ffe92f26922
Author: Nils Dagsson Moskopp <nils at dieweltistgarnichtso.net>
Date:   Wed Jul 21 16:30:07 2010 +0200

    Merge branch 'nkinkade' of code.creativecommons.org:wordpress-cc-plugin

-----------------------------------------------------------------------

Summary of changes (followed by patch):
 wordpress-cc-plugin/wordpress-cc-plugin.php |   66 +++++++++++----------------
 1 files changed, 27 insertions(+), 39 deletions(-)

diff --git a/wordpress-cc-plugin/wordpress-cc-plugin.php b/wordpress-cc-plugin/wordpress-cc-plugin.php
index 3c7fac5..c3677d5 100644
--- a/wordpress-cc-plugin/wordpress-cc-plugin.php
+++ b/wordpress-cc-plugin/wordpress-cc-plugin.php
@@ -13,6 +13,17 @@ Version: 0.5
 Author URI: http://dieweltistgarnichtso.net
 */
 
+// A handy list of licenses and full names.
+$license_list = array(
+    'reserved' => 'All rights reserved.',
+    'by' => 'Attribution',
+    'by-nc' => 'Attribution Non-Commerical',
+    'by-nc-nd' => 'Attribution Non-Commercial No Derivatives',
+    'by-nc-sa' => 'Attribution Non-Commercial Share Alike',
+    'by-nd' => 'Attribution No Derivatives',
+    'by-sa' => 'Attribution Share Alike'
+);
+
 /* install and uninstall */
 
 // create database entry on install
@@ -80,13 +91,15 @@ function cc_wordpress_admin_css_list() {
 
 // generate license dropdown
 function cc_wordpress_license_select($current_license, $name, $mark_default) {
+
+    global $license_list;
+
     $html  = '<select id="cc_license" name="'. $name .'"">';
 
-    $licenses = array('reserved', 'by', 'by-nc', 'by-nd', 'by-sa', 'by-nc-nd', 'by-nc-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>';
+    foreach ($license_list as $abbr => $license) {
+        $selected = ($abbr == $current_license) ? ' selected="selected"' : '';
+        $license_name = cc_wordpress_license_name($abbr, $mark_default);
+        $html .= '<option value="'. $abbr .'"'. $selected .'>'. $license_name .'</option>';
     }
 
     $html .= '</select>';
@@ -394,6 +407,9 @@ function cc_wordpress_media_send_to_editor($html, $attachment_id, $attachment) {
 }
 
 function cc_wordpress_create_figure($attachment_id, $title, $size = '', $is_post_thumbnail = false) {
+
+    global $license_list;
+
     $post =& get_post($attachment_id);
     $id = $post->ID;
 
@@ -438,40 +454,12 @@ function cc_wordpress_create_figure($attachment_id, $title, $size = '', $is_post
     $license = get_post_meta($id, 'cc_license', true);
     $license_url = get_post_meta($id, 'cc_license_url', true);
 
-    switch ($license) {
-        case "by":
-            $license_abbr = 'CC BY';
-            $license_full = 'Creative Commons'. __('Attribution');
-            break;
-
-        case "by-nc":
-            $license_abbr = 'CC BY-NC';
-            $license_full = 'Creative Commons'. __('Attribution-Noncommercial');
-            break;
-
-        case "by-nd":
-            $license_abbr = 'CC BY-ND';
-            $license_full = 'Creative Commons'. __('Attribution-No Derivative Works');
-            break;
-
-        case "by-sa":
-            $license_abbr = 'CC BY-SA';
-            $license_full = 'Creative Commons'. __('Attribution-ShareAlike');
-            break;
-
-        case "by-nc-nd":
-            $license_abbr = 'CC BY-NC-ND';
-            $license_full = 'Creative Commons'. __('Attribution-Noncommercial-No Derivative Works');
-            break;
-
-        case "by-nc-sa":
-            $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);
+    if ( $license ) {
+        $license_abbr = 'CC' . strtoupper($license);
+        $license_full = 'Creative Commons'. __($license_list($license));
+    } else {
+        // 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