CC License Manager

GSoC CC WordPress Plugin: Weekly Report #12

erlehmann, August 19th, 2010

This may be my last report for the plugin. After 150 commits and a bit over 30KB of written PHP code, the Google Summer of Code proposal Support for CC licenses in WordPress is finally finished, though the final product is remarkably different from the original suggestion. As time went by fast in the last few days before the deadline, I successfully managed to fix the three remaining issues mentioned before; namely an IE bug, adding license information to the media manager overview table (screenshot) and having a proper README (written in Markdown).

However, one thing still did not work quite right: Embedding. A security restriction called the same origin policy prevents audio and video (but not images, as they came before the SOP) from one site to be included on another, unless a special HTTP header is sent. As Jonas Sicking puts it in an explanatory email (via):

Requiring that sites add ‘Access-Control-Allow-Origin:*’ simply is
a way for us to know that “this is a public resource that other sites
can embed”.

In addition to the above issue, other things should be taken care of server-side to ensure media playback works as intended:

  • The X-Content-Duration header should tell the browser how long a media file is, in seconds. If it is not given, Browsers will have to figure out the duration by themselves, by seeking to the end of the file.
  • gzip/deflate compression must not be used — if it is employed, Firefox will be unable to fast-forward, and Chrome will not play the given file at all.
  • HTTP 1.1 byte range requests must be served correctly; otherwise there can be no seeking unless the relevant part of the file is already downloaded.

For many of these cases, if a server does not already handle them, only a few lines in the .htaccess file would need to be changed. But, as the plugin should also accommodate users who may not have the option, technical skill or time to edit their web server configuration, everything mentioned above needs to happen automagically. This has led me to writing a small web server and bundling it with the plugin.

Technical issues aside, participating in the Google Summer of Code was an interesting and unique experience that certainly made me grow in confidence regarding my abilities. I also learned to value how much work can go into a relatively small piece of code to create a sufficiently polished product. Finally, the plugin in its current incarnation was made possible only through assistance of the following people, whom I wish to thank:

  • Matthias wetterfrosch Mehldau for a blog post regarding markup for creative-commons-licensed content
  • Julia zeitrafferin Seeliger for a related article, the inspiring moment for me
  • Johnny Häusler for a screenshot of the Spreeblick plugin interfaces
  • Michelle Thorne for connecting me with a metadata expert
  • Nathan Yergler for advising me on RDFa
  • Nathan Kinkade for mentoring me over the course of the Google Summer of Code, continually suggesting code improvements and standing by to patiently explain issues until I got the point
  • Moritz Metz for advising me to take non-standard WordPress directory names and post thumbnails into account
  • Markus Beckedahl for suggesting the embed functionality
  • Bernd Holzmüller for testing performance and explaining how to avoid memory leaks

What will follow now is user testing, hopefully yielding some real world experience and small improvements so a more polished version of the plugin can be packaged and released through the plugin directory. If, in the future, the plugin’s functionality is extended notably, I may write another blog post — for now, however, I’m done.

1 Comment »

GSoC CC WordPress Plugin: Weekly Report #11

erlehmann, August 10th, 2010

This week most of the work on the plugin consisted of styling changes and fixing bugs, mainly regressions that sneaked in due to the rewrite of functions that are now using the API. Still, there are some new features:

  • The embed button: Suggested by Markus Beckedahl, a re-embedding possibility actively promotes sharing content. Clicking on the button reveals a text input filled with the markup necessary to put a copy of the media item into another website. Bonus: The re-embedded content keeps the style of the original content and also sports an embed-button.
  • An API cache: Results of queries to the CC REST API are now saved for two weeks, using the WordPress Transients API. This speeds up figure generation and the administration page tremendously.
  • Automagic locale selection: The plugin now simply uses the WordPress locale.

I also made a screencast, approximately 6 minutes long, that demonstrates how the plugin is used.

For the remaining few days, I have three things to resolve: First, there is a bug preventing the embed markup to show up properly in Internet Explorer 6 and 7. Second, provided that I find the corresponding hook, I will add license icons to the media manager overview. Third, a proper README file needs to be written.

Comments Off

GSoC CC WordPress Plugin: Weekly Report #9 / #10

erlehmann, August 4th, 2010

Time is running out for work on the plugin. With the 9th of this month being the suggested date to start working on documentation and cleanup and the 16th being a definitive “pencils down” date, I’m definitely in a hurry. Here’s my story for the last two weeks, decorated with nicely drawn bullet points:

  • <figure> elements are inline blocks now: Like the elements they are supposed to replace — <img>, <video>, <audio> and the occasional <object><figure> elements should not disturb the flow of a blog post. They also now display effortless besides each other.
  • The wetter style became less US-centric: I created a version of the stylesheet with a crossed-out Euro symbol (€).
    screenshot of wetter stylesheet with crossed out dollar symbol
    screenshot of wetter stylesheet with crossed out euro symbol
  • No more shortcodes: The plugin now inserts simple image, video or audio elements and uses the PHP DOM facilities to detect and replace them. For error-tolerant parsing, I use the MIT-licensed html5lib.
  • Some IE 6/7 support: After discovering older versions of Internet Explorer are unable to style new HTML5 elements, I came upon Remy Sharp’s javascript-based workaround. Granted, some parts still looks like crap in IE, but that is what you get for using a browser that is older than dirt.
  • New hybrid style: screenshot of hybrid style, showing a dark bar with light text
  • Locale and jurisdiction support: Both can now be set in the admin interface, each media item can have a separate jurisdiction. All information comes from the excellent CC REST API. See for yourself:
    screenshot of WordPress plugin showing Polish licenses, displayed in German

Two very important things are still missing: A cache for API responses and an easy method for re-embedding. I am going to work on those (and everything else Nathan Kinkade digs up in this version) in the next few days.

The overly frequent API calls result in notable slowness interface-wise and unneccessary load on the server side — so kids, don’t try this at home! You have been warned.

Comments Off

GSoC CC WordPress Plugin: Weekly Report #8

erlehmann, July 21st, 2010

This is a short one. This week, I did only a few things related to the plugin: First, planned features and bugs are now listed in the issue tracker. Second, you can now specify default attribution in the form of rights holder and URL. I did also work on the default licensing mechanism, but it probably needs a complete overhaul.

For this week, I will be looking into more REST API stuff, get rid of the shortcodes so even with a deactivated plugin, there will still be content (parsing the elements WordPress inserts instead, using DOM methods) and approach the mentioned rewrite of the default licensing mechanism.

Comments Off

GSoC CC WordPress Plugin: Weekly Report #6 / #7

erlehmann, July 13th, 2010

One week ago, my laptop’s harddisk broke down during the afternoon. I had been accustomed to occasional data loss before — sometimes, pictures would be garbled and on one incident, a 100 MB sound file was corrupted and could not be copied. However, as the kernel printed unpleasant warnings during every startup, aborting the normal boot process, insisting that the file system was damaged, I decided it was the proper time to panic and check the backups.

Getting a replacement drive took me several days. As I did not have money to spare, my first hurdle was activating the GsoC prepaid card. To make it short, I was not able to activate the card using the error-prone web site, but succeeded in doing it by phone. When I finally held the new hard drive in my hands, I felt like an RPG character, who had in a side quest acquired the item necessary to continue his main endeavour; on sunday, almost all backups were applied.

Regarding the plugin, I have fixed a number of small bugs and also added several new features, listed below:

  • Default licensing: Users can now choose a license that gets applied to every attachment if they do not choose a specific license.
  • Post thumbnail figures: WordPress post thumbnails can now be embedded as figures with annotated markup, just like inline content. Since many theme authors do not properly filter the markup returned by the WordPress function the_post_thumbnail() (and similar ones), expecting only an <img> element, this option is disabled by default.
  • Fallback links for multimedia content: <audio>, <video> and <object> elements now sport a fallback link for browsers that do not support HTML5.
  • Support for alternate content and plugin directories: Since WordPress 2.6, you can change the names of the wp-content and plugins directories; earlier versions of the plugin did not cope with that. I had struggled with this issue before, but after Moritz Metz provided a working default configuration for wp-config.php, everything fell into place fast.
  • New stylesheet: I modified the existing grau style, using 80×15 icons. I am pondering setting it as the standard stylesheet for the plugin. This is how it looks:

For this week, I will focus on making default licensing more expansive, adding differing license options for different types of media content and maybe even for single users. I will also try to modify the existing stylesheets so they work well with post thumbnail figures. As Nathan Kinkade suggested, I may expand the scope of the plugin to also manage licensing metadata of pages and posts.


GSoC CC WordPress Plugin: Weekly Report #5

erlehmann, June 30th, 2010

Another delayed report, late by a day. This time, however, I can deliver; the current version of the plugin sports the filter system I unsuccessfully tried to implement the week before: While previous versions of the plugin inserted HTML directly into the post (example screenshot), the new iteration only inserts a shortcode containing the attachment ID and a caption (e.g. [[cc:18|some caption]]). The actual markup is then generated when the page is requested. This satisfies use cases in which a blogger wishes to modify media metadata later on, like changing license or alt text.

Less visible for the user, I was able to unify the two saving functions triggered on saving and inserting media and adding a metadata field which holds the exact license URI for every attachment (determined using the Creative Commons API). I recommend checking out the repository.

For the coming week, I will look into post thumbnails, which require no inline markup for purely decorative pictures, like those used at Spreeblick and Breitband. I will also explore alternate content and plugin directories again, as my last attempt regarding that issue was a complete failure.

Comments Off

GSoC CC WordPress Plugin: Weekly Report #4

erlehmann, June 25th, 2010

As some of you may have noticed, this report about the WordPress CC plugin is several days late. This is because I was unable to produce new substantial features and have hit a roadblock with the one that is most important right now: A filter.

In its current state, the plugin works fairly straightforward; it generates the markup and inserts it into the post. When planning it, I thought that would suffic — however, Nathan Kinkade advised me that several use cases would break this simple behaviour: If, for example, the chosen license is changed, there is no way to update all posts containing the already generated markup.

The solution lies in an intermediate form of markup that gets applied every time a page containing cc-licensed media is generated. My current approach looks like this: [[cc:18]] (where 18 is the id of the image/audio/video). This should get converted to the already known RDFa-enriched HTML; currently, however, a bug in my code apparently makes WordPress return a blank page whenever I activate that filter.

On a related note, someone in #swig on FreeNode advised me to look at Oshani Seneviratnes semantic clipboard; as I can tell, it would go together nicely with my plugin.

1 Comment »

GSoC CC WordPress Plugin: Weekly Report #3

erlehmann, June 16th, 2010

This week, development on the plugin proceeded at a faster pace. Shortly after I posted the last report, Nathan Kinkade pointed out the fix to the bug that prevented saving, a simple type error. On the next day, I implemented stylesheet support, hereby adapting three styles I originally made for my defunct microdata plugin, and an admin interface to switch between them (screenshot). Additional more or less notable changes are:

  • metadata is not only saved now, but will also be retrieved to populate form fields
  • multiple RDFa fixes, machine-readable data should be correct now
  • the plugin has a directory structure, earlier versions were just a single file
  • there is now a sample file for stylesheet development
  • metadata is also saved when the media item is inserted into the post
  • the plugin now uses the Creative Commons API to get the current license version

The current output of the plugin can be seen at my GSoC test blog and checked using the W3Cs RDFa distiller and parser.

On a less technical note, I have met three people relevant to plugin development: When I explained to Julia Seeliger that I was implementing her plugin idea, she was delighted. Max Winde, creator of the inspiring Spreeblick plugin, suggested including an easy option for re-embedding the relevant content, possibly using Javascript. Last but not least, Moritz Metz, a radio journalist and blogger at Breitband, intending to use the plugin when it is finished, told me about his use of alternate content and plugin directories and urged me to consider supporting not only inline content, but also post thumbnail images.

I consider this version of the plugin not finished, but functional enough for testers, who are encouraged to check out the Git repository. For the coming week, I will look into the issue surrounding alternate content and plugin directories and proceed to polish the existing features.

Comments Off

GSoC CC WordPress Plugin: Weekly Report #2

erlehmann, June 8th, 2010

For last week’s work on the plugin, I had two targets, both related to the goal of making the interface functional: First, saving license, rights holder and attribution URL in the database and enabling the WordPress media manager to display that information; second, generating the RDFa-enriched markup using those aforementioned three bits. While I succeeded in generating the markup, when trying to actually save the input, I hit a wall, neither being able to figure out how this should be done, nor how it could be done. By the way, a blog post about a thumbnail plugin helped me understand which hooks are actually important.

The added functionality is easily explained: If a Creative Commons license is selected, the standard WordPress markup generating behaviour is replaced by the plugin’s. Two screenshots exemplify this development:

As always, this version can be viewed and checked out at the official Git repository. For this week, I will be focusing on stylesheets and trying to further tackle the saving issue.

On a related note, the inconsistent order of parameters regarding WordPress functions, the lack of easy debugging facilities and the subtle differences between double quoted and single quoted strings added to my frustration.

Comments Off

GSoC CC WordPress Plugin: Weekly Report #1

erlehmann, June 1st, 2010

This week I was busy and lazy in turns, so I worked on the plugin only on two days. These are the tasks that I finished:

  • Setting up a test WordPress installation, to start with a clean slate.
  • Installing the Hook Sniffer plugin; which prints out every WordPress hook triggered on a page load.
  • Creating a simple form interface (screenshot).
  • Putting all this together into a dummy plugin that adds the non-functional interface to the WordPress upload manager.

I am aware that this is not much and will try to improve on my progress for the coming week. Currently I am trying to find out how to correctly handle the form input and write the incoming data into appropriate database fields, license representation in the media manager will probably come after that.

As always, the code is in the official Git repository.

1 Comment »

next page