Commit be609809 authored by root's avatar root Committed by lechuck
Browse files

Adding plugin wp-license-reloaded

parent 3f2022ca
=== WP License reloaded ===
Contributors: estebanglas
Tags: Creative Commons, Licensing, content
Requires at least: 2.7
Tested up to: 2.8.1
Stable tag: /0.1.1/
Per post Creative Commons Licensing (Ideal for multiple authours / licenses blogs)
== Description ==
Based on the amazing Job by <a title="Nathan's Homepage" href="http://yergler.net/">Nathan R. Yergler</a> and his <a href="http://wiki.creativecommons.org/WpLicense">WP-Licencse Plugin</a>. This plugin Alows users to assign a Creative Commons license to content on a per post basis (or no license at all)
This plugin was made possible thanks to <a href="http://www.socialbrite.org">SocialBrite</a>
The license chunk on the posts is wrapped in a DIV with class: wp_license
== Installation ==
1. Upload the plugin folder (named wp-license-reloaded) in to the `/wp-content/plugins/` directory
2. Activate WP License reloaded through the 'Plugins' menu in WordPress
3. In the post screen you'll now have a CC license area where you can assign
== Frequently Asked Questions ==
= What can be expected in future releases of the plugin =
* Global settings
* Mass post licensing
= What about foo bar? =
Answer to foo bar dilemma.
== Screenshots ==
== Changelog ==
= 0.1 =
* Initial release
= 0.1.1 =
*Minor Bug Fixes (Thanks MAC13 & WikiChaves)
\ No newline at end of file
<?php
/*
Plugin Name: wpLicense-reloaded
Plugin URI: http://estebanglas.com/2009/07/creative-commons-plugin/
Description: Based on <a href="http://wiki.creativecommons.org/WpLicense">wpLicense</a> Allows selection of a <a href="http://creativecommons.org">Creative Commons</a> license for blog content on a per-post basis. Work done originally for <a href="http://www.socialbrite.org">SocialBrite</a>
Version: 0.1.1
Author: Esteban Panzeri Glas (based on the work by Nathan R. Yergler>)
Author URI: http://estebanglas.com
*/
/* Copyright 2009,
Esteban A. Panzeri Glas (email : esteban.glas@gmail.com)
Creative Commons (email : software@creativecommons.org),
Nathan R. Yergler (email : nathan@creativecommons.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Template Functions */
function licenseHtml($content) {
global $post;
$license_uri = get_post_meta($post->ID, 'cc_content_license_uri',true);
$license_img = get_post_meta($post->ID, 'cc_content_license_img',true);
$license_name = get_post_meta($post->ID, 'cc_content_license',true);
$CC_logo = get_bloginfo("wpurl") . "/wp-content/plugins/wp-license-reloaded/images/cclogo.gif";
if (($license_uri) && $license_uri != ""){
$image = <<< END_OF_STMT
<img src="${license_img}" alt="${license_name}" class="alignleft" style="margin-top:4px;" />
END_OF_STMT;
$result = <<< END_OF_STMT
<div class="wp_license">
<p><a rel="license" href="${license_uri}">$image</a>This work ${attrib} is licensed under a <a rel="license" href="${license_uri}">${license_name}</a>.</p>
</div>
END_OF_STMT;
$content = $content . $result;
}
return $content;
} // licenseHtml
/* Admin functions */
function license_options() {
global $post;
$slart = $_GET['post'];
$defaults = array("license_name" => get_post_meta($slart, 'cc_content_license',true),
"license_uri" => get_post_meta($slart, 'cc_content_license_uri',true),
);
$wp_url = get_bloginfo('wpurl');
$license_url = get_post_meta($slart, 'cc_content_license_uri',true);
if ($license_url == '') { $jswidget_extra = "want_a_license=no_license_by_default"; }
else { $jswidget_extra = ""; }
echo <<< END_OF_ADMIN
<div class="wrap">
<p>This page allows you to choose a
<a href="http://creativecommons.org">Creative Commons</a> license
for your content. </p>
<script type="text/javascript" src="http://api.creativecommons.org/jswidget/tags/0.92/complete.js?${jswidget_extra}">
</script>
<input id="cc_js_seed_uri" type="hidden" value="${license_url}" />
<input name="blog_url" id="blog_url" type="hidden" value="${wp_url}" />
<input name="remove_license" type="hidden" value="false" />
<input name="submitted" type="hidden" value="wplicense" />
<br/>
</div>
</div>
END_OF_ADMIN;
} // license_options
// Include the necessary java-script libraries
function wplicense_header() {
$css_url = get_bloginfo("wpurl") . "/wp-content/plugins/wp-license-reloaded/wplicense.css";
echo "<link rel=\"stylesheet\" href=\"${css_url}\" />";
add_meta_box('cc_license_control', 'Creative Commons Licensing', 'license_options', 'post', 'normal', 'high');
} // wplicense_header
// Initialize the WordPress content variables
function init_content_license($fullreset=false, $just_license_reset=false) {
global $post;
// if reset is True, destructively reset the values
if ($fullreset == true) {
update_post_meta($_POST['post_ID'],'cc_content_license', '');
update_post_meta($_POST['post_ID'],'cc_content_license_uri', '');
update_post_meta($_POST['post_ID'],'cc_content_license_img', '');
} // if resetting
if ($just_license_reset) {
update_post_meta($_POST['post_ID'],'cc_content_license', '');
update_post_meta($_POST['post_ID'],'cc_content_license_uri', '');
update_post_meta($_POST['post_ID'],'cc_content_license_img', '');
} // if just resetting license details but not other prefs
} // init_content_license
function post_form() {
global $post_msg;
global $post;
//update_post_meta($slart,'cc_content_license_img', $_POST['cc_js_result_img']);
// check for standard return (using web services
if ( (isset($_POST['submitted'])) && ($_POST['submitted'] == 'wplicense')) {
// check if the license should be removed
if ($_POST['remove_license'] == '__remove' ||
($_POST['cc_js_result_uri'] == '' && get_post_meta($_POST['post_ID'],'cc_content_license_uri') != '')) {
init_content_license(false, true);
$post_msg = "<h3>License information removed.</h3>";
return;
} // remove license
// check if the license was changed
if ($_POST['cc_js_result_uri'] != get_post_meta($_POST['post_ID'],'cc_content_license_uri')) {
// store the new license information
update_post_meta($_POST['post_ID'],'cc_content_license', $_POST['cc_js_result_name']);
update_post_meta($_POST['post_ID'],'cc_content_license_uri', $_POST['cc_js_result_uri']);
update_post_meta($_POST['post_ID'],'cc_content_license_img', $_POST['cc_js_result_img']);
}
// store the settings
$post_msg = "<h3>License information updated.</h3>";
} // standard web services post
} // post_form
/* admin interface action registration */
add_action('admin_head', 'wplicense_header');
/* content action/filter registration */
add_action('save_post', 'post_form');
add_action('edit_post', 'post_form');
add_action('publish_post', 'post_form');
add_action('admin_head', 'post_form');
add_filter('the_content','licenseHtml');
?>
/**
* This was written by CC as a demonstration of how to interoperate
* with the Creative Commons JsWidget. No rights reserved.
*
* See README for a little more detail.
*/
/** Edit me to fit your particular look **/
#cc_js_lic-menu
{
margin: 0 auto;
/*border: 1px solid #ddd;*/
}
.cc_js_body {
background-color: #fff;
color: #343434;
font: 60% "Lucida Grande", verdana, sans-serif;
padding: 0;
margin: 0;
text-align: center;
}
#cc_js_header-main {
width: 93%;
min-width: 700px;
margin: 0 3%;
padding: 10px 0 2px 1%;
text-align: left;
font-size: 11px !important;
}
/* -- elements */
a.cs_js_a, a:link.cs_js_a {
text-decoration: none;
color: #00b;
}
a:hover.cs_js_a {
text-decoration: underline;
}
/**
* This was written by CC as a demonstration of how to interoperate
* with the Creative Commons JsWidget. No rights reserved.
*
* See README for a little more detail.
*/
#cc_js_license_selected
{
border: 1px solid #c2e0cf;
text-align: center;
padding: 3%;
margin-bottom: 2.7%;
}
#cc_js_jurisdiction_box
{
/* border: 1px solid black; */
padding: 0.5% 2% 1% 2%;
margin-bottom: 1%;
}
#cc_js_lic-menu h2
{
/* text-decoration: underline; */
/* border-bottom: 1px solid black; */
padding: 3% 0 1% 0;
border: none;
}
#cc_js_lic-result
{
padding: 0;
margin: 0;
}
select#cc_js_jurisdiction
{
margin-bottom: 2%;
}
textarea#cc_js_result
{
width: 9%;
border: 1px solid #ccc;
color: gray;
margin-top: 1%;
}
a.cc_js_a img
{
border: none;
text-decoration: none;
}
#cc_js_more_info
{
border: 1px solid #eee;
padding: 0.5% 2% 1% 2%;
margin-bottom: 1%;
margin-top: 1%;
width: 87%;
}
#cc_js_more_info table
{
width: 65%;
}
#cc_js_more_info .header
{
width: 35%;
}
#cc_js_more_info input
{
width: 100%;
border: 1px solid #ccc;
}
#cc_js_required
{
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
padding: 4% 2%;
margin-bottom: 1%;
margin-top: 2px;
/* background: #efefef;
background: #eef6e6;*/
}
#cc_js_work_title
{
font-style: italic;
}
#cc_js_optional
{
border: 1px solid #eee;
padding: 0.5% 2% 1% 2%;
margin-bottom: 1%;
margin-top: 1%;
width: 87%;
}
.cc_js_cc-button
{
padding-bottom: 1%;
}
.cc_js_info
{
vertical-align: middle;
}
img.cc_js_info {
float: right;
}
#cc_js_jurisdiction_box {
clear: left;
}
#cc_js_lic-menu p{
padding: 3px 0 5px 0;
margin: 0 0 5px 0;
}
.cc_js_tooltip
{
background: white;
border: 2px solid gray;
padding: 3px 10px 3px 10px;
width: 300px;
text-align: left;
}
.cc_js_tooltip .cc_js_icon
{
float: left;
padding-right: 4%;
padding-bottom: 20%;
}
.cc_js_tooltipimage
{
border: 2px solid gray;
}
.cc_js_infobox
{
cursor: help;
}
.cc_js_question
{
cursor: help;
/*color: #00b;*/
border-bottom: 1px dashed #66b;
}
.cc_js_hidden {
display: none;
}
#cc_js_required .cc_js_question { border: none; }
#cc_js_want_cc_license_at_all {
background-color: #eef6e6;
padding: 1em;
padding-left: 0;
}
#cc_js_want_cc_license_at_all span {
margin-right: 10px;
margin-left: 10px;
padding: 0.5em;
}
#cc_js_want_cc_license_at_all span span {
margin: 0;
padding: 0;
}
#cc_js_required p { padding-bottom: 50px; }
#cc_js_remix-label span {
background: url('http://creativecommons.org/images/deed/remix.png') no-repeat top left;
padding-left: 60px;
padding-bottom: 60px;
}
#cc_js_nc-label span {
background: url('http://creativecommons.org/images/deed/nc.png') no-repeat top left;
padding-left: 60px;
padding-bottom: 60px;
}
#cc_js_sa-label span {
background: url('http://creativecommons.org/images/deed/sa.png') no-repeat top left;
padding-left: 60px;
padding-bottom: 60px;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment