cclicense.php is a simple library written in pure PHP that helps developers utilize and integrate the Creative Commons licenses in their own programs. The library currently contains representations of all the available Creative Commons licenses and the Public Domain Dedication pseudo-license. ccllicense is capable of producing valid RDF representations of the rights and restrictions imposed by the license. It can also provide the developer with a set of icons corresponding to these rights. Altough designed for use with the Creative Commons licenses, cclicense can easily be extended to represent additional licenses through inheritance of the base object.

[More: Downloads, CVS, Documentation, Project Page]

Downloads

Here you can find the latest released version of the cclicense library. Because of the relative simplicity of the license, I do not anticipate that releases will be coming very often (perhaps only as new license files are contributed to the project). If you have an additional license you would like to have bundled with the next release of cclicense, please e-mail me a copy of your contribution and I'll get it into the codebase quickly.

CVS

cclicense, like many open source projects, is distributed with the aid of the Concurrent Versioning System (CVS). CVS allows developers to maintain a single, controlled source tree with multiple check-outs of individual files.

If you don't know how to use CVS, you'll probably want to look at the official guides. It's a powerful, but complicated piece of software.

If you're interested in using the cclicense CVS, though, you can view it online at SourceForge. Documentation on accessing it via pserver or ssh can be found on the SourceForge project page.

Obtaining cclicense through CVS

These are the simple instructions how to obtain the cclicense files through CVS. Use this when you have a reasonable fast internet connection and want to utilize the bleeding edge version of cclicense in your application. It should work well on any system that supports CVS.

Doing it for the first time

Go to a directory where you want the cclicense source tree to appear. Use this command (it is one line):

      cvs -z3 -d:pserver:anonymous@cvs.sf.net:/cvsroot/cclicense checkout cclicense

If this doesn't work, try this one:

      cvs -z3 -d:pserver:anonymous@cvs-pserver.sf.net:80/cvsroot/cclicense checkout cclicense

This will create the "cclicense" directory and download all the cclicense files and subdirectories into it. It should also work when you are behind a firewall, because it uses port 80. It probably doesn't work with a proxy though.

Updating

Recent patches appear in CVS all the time. Change into the "cclicense" directory and include the changes with this single command:

      cvs -z3 update

You will get messages for all directories that are inspected and files that are being updated.

Documentation

The cclicense library is designed to be integrated into other PHP applications and ease the task of developers seeking to include support for the Creative Commons licenses in their software. cclicense uses the license primitives defined by the Creative Commons project to represent a basic subset of what you are allowed to do with a piece of content under the license. These primitives may also be used by other non Creative Commons licenses and the base class can easily be extended to add support for additional rights/restrictions.

The cclicense Class

Under the cclicense library, a license is represented using a set of primitives (rights/restrictions) and a set of metadata that provides human friendly information about the license. All licenses must indicate:

Additionally, all licenses must indicate the permissions, restrictions and requirements that are imposed under the terms of the license. Under the Creative Commons schema, the permissions include:

  1. Reproduction - A boolean indication of whether or not reproduction of the work is allowed
  2. Distribution - A boolean indication of whether or not distribution of the work is allowed
  3. Derivative Works - A boolean indication of whether or not the creation of derivatives of the work is allowed

There is also a restriction that can be imposed:

  1. Noncommercial - A boolean indication of whether or not the work is may be used strictly for non-commercial purposes

And a few requirements...

  1. Notice - A boolean indication of whether or not the author requires that the copyright notice be maintained
  2. Attribution - A boolean indication of whether or not the author requires that credit be attributed to them
  3. Share Alike - A boolean indication of whether or not derivatives works must be distributed under the same license as the original

Obtaining a List of Available Licenses

The cclicense library uses a set of files to represent the various licenses contained in a given installation of the library. This allows for clean, easy extension of the installed licenses and empowers the programmer to easily remove unnecessary or undesirable licenses based on the needs of their project. To facilitate the easy use of the licenses, cclicense provides a few utility functions that make life easier on the programmer.

Currently, there are two functions defined:

  1. get_licenses - Returns an array of cclicense objects, one for each installed license
  2. find_license_by_uri - Searches an array of licenses for a desired one by uri (matches on URI and full text URI)

Sometimes a bit of sample code is worth a thousand words:

// Grab the cclicense library
require_once ('cc_license.php');

// Load all licenses from the cclicense install directory
$licenses = get_licenses ();

// Find the Creative Commons Public Domain Dedication (pseudo) license...
if ($pd = find_license_by_uri ('http://creativecommons.org/licenses/publicdomain') != false) {
	// Echo out the RDF representation of this license
	echo $pd->get_rdf ();
}

Defining a New License

Since cclicense was built as an extensible framework for representing licenses, a great deal of its usefulness is derived from third-party extensions through the definition of additional licenses. New licenses may defined through either instantiating a new cc_license object and setting the defined fields, or by inheriting from the base cc_license class and adding additional fields to the object.

$my_license = new cc_license ('My License', 'My License', 'http://example.org/licenses/mine', '', 1, 1, 1, 1, 0, 1, 0, '');

or

class another_license extends cc_license {
   var $educational_only; // Do we allow only educational use?
   var $no_export; // Do we restrict export of the content?
}

Valid XHTML 1.0! Valid CSS! SourceForge Logo