|
Cookbook /
LicensesSummary: Markup to display licensing info on pages
Version: 2007-02-15
Prerequisites: PmWiki 2.0
Status: New
Maintainer: Pm
Categories: Markup
Discussion: Licenses-Talk
Questions answered by this recipeHow can I allow authors to display a Creative Commons license in pages? DescriptionThis recipe enables a To install the recipe, simply download licenses.phpΔ into the cookbook/ directory, and then add the line below to a local customization file: include_once('cookbook/licenses.php');
Once installed, the recipe enables the (:license by-nc-nd:) CC Attribution Non-commercial No Derivatives (:license by-nc-sa:) CC Attribution Non-commercial Share Alike (:license by-nc:) CC Attribution Non-commercial (:license by-nd:) CC Attribution No Derivatives (:license by-sa:) CC Attribution Share Alike (:license by:) CC Attribution (:license pd:) Public Domain (:license:) site default license, configured by $LicenseDefault
WikiStyles can be used to alter the appearance and behavior of the directive, thus
NotesEasy 3.0 update + icons for the individual license conditionsin response to Lighans' suggestion below, a new recipe is not required in order update PM's current recipe - rather, one need only add their own up-to-date
$LicenseDefault = 'by-sa-nc';
$LicenseLoc = "/us"; # location is not necessary - the following works without it
$LicenseSize = "88x31"; # regular size
#$LicenseSize = "80x15"; # smaller
$LicenseVersion = "3.0"; # change or update the version
$LicenseTypeFmt = array(
# main licenses
'by' => "[[http://creativecommons.org/licenses/by/$LicenseVersion/ |
http://i.creativecommons.org/l/by/$LicenseVersion$LicenseLoc/$LicenseSize.png\"Creative Commons License\"]]",
'by-nd' => "[[http://creativecommons.org/licenses/by-nd/$LicenseVersion/ |
http://i.creativecommons.org/l/by-nd/$LicenseVersion$LicenseLoc/$LicenseSize.png\"Creative Commons License\"]]",
'by-nc-nd' => "[[http://creativecommons.org/licenses/by-nc-nd/$LicenseVersion/ |
http://i.creativecommons.org/l/by-nc-nd/$LicenseVersion$LicenseLoc/$LicenseSize.png\"Creative Commons License\"]]",
'by-nc' => "[[http://creativecommons.org/licenses/by-nc/$LicenseVersion/ |
http://i.creativecommons.org/l/by-nc/$LicenseVersion$LicenseLoc/$LicenseSize.png\"Creative Commons License\"]]",
'by-nc-sa' => "[[http://creativecommons.org/licenses/by-nc-sa/$LicenseVersion/ |
http://i.creativecommons.org/l/by-nc-sa/$LicenseVersion$LicenseLoc/$LicenseSize.png\"Creative Commons License\"]]",
'by-sa' => "[[http://creativecommons.org/licenses/by-sa/$LicenseVersion/ |
http://i.creativecommons.org/l/by-sa/$LicenseVersion$LicenseLoc/$LicenseSize.png\"Creative Commons License\"]]",
'pd' => "[[http://creativecommons.org/licenses/publicdomain/ |
http://i.creativecommons.org/l/publicdomain/$LicenseSize.png\"Public Domain Dedication\"]]",
# individual license condition icons
'by-icon' => "[[http://creativecommons.org/about/licenses |
http://creativecommons.org/images/icons/attrib.gif\"Creative Commons - Attribution\"]]",
'sa-icon' => "[[http://creativecommons.org/about/licenses |
http://creativecommons.org/images/icons/sharealike.gif\"Creative Commons - Share Alike\"]]",
'nd-icon' => "[[http://creativecommons.org/about/licenses |
http://creativecommons.org/images/icons/nomod.gif\"Creative Commons - No Derivative Works\"]]",
'nc-icon' => "[[http://creativecommons.org/about/licenses |
http://creativecommons.org/images/icons/noncomm.gif\"Creative Commons - Noncommercial\"]]",
'pd-icon' => "[[http://creativecommons.org/about/licenses |
http://creativecommons.org/images/icons/pd.gif\"Creative Commons - Public Domain\"]]"
);
include_once("$FarmD/cookbook/licenses.php");
As a result, one can call An updated license recipe, incorporating all of the above!licenses-2009-08-04.phpΔ - So, this may be a little too complex for such a simple recipe, but I went ahead and created another recipe that takes the modifications mentioned above - the ability to declare a location, to display a license-condition icon, to change the size - and makes them possible at the markup level. This only makes sense for a site where individual users may want to declare different creative commons licenses for different groups or pages; for sites that only need one site-wide license, I recommend just using the original To start, simply include the file: include_once("$FarmD/cookbook/licenses-2009-08-04.php");
... and then use any of the following markup to indicate license-type, size, and location (optional): (:license type=by-nc-nd size=large loc=us:)
or
(:license by-nc-nd size=small:)
This version of the license recipe also incorporates the individual license-condition icons for each aspect of a CC license, i.e. Share Alike, No Derivatives, etc. These are accessed the same as above, but without any size or location arguments, using one of the following arguments - (:license by-icon:)
or
(:license type=by-icon:)
The recipe also permits the following default variables in
overtones99 August 04, 2009, at 10:42 PM History
Comments
See AlsoContributorsUser notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |