Jan 112012
 
 January 11, 2012  Posted by at 8:00 pm Law and Order, Programming, Projects Tagged with: , , , , ,  Comments Off on Quick Project: A Blackout Banner for Protesting Censorship

So, while perusing Techdirt earlier today, I saw an article about WordPress coming out against the Stopping Online Piracy Act (SOPA).  To me, this was just another tech sector company proclaiming, rightfully so, how ripe for abuse the proposed legislation is in its current form.  I noted that WordPress it quite capable of mass distributing a plugin to spread awareness and calls to action in the comments.  Another commenter pointed me to the already successful campaign by americancensorship.org and the small piece of code they provide to blackout a small portion of a website with a banner.  I saw a simple solution: wrap the aforementioned code inside a plugin and submit it myself.  This was a somewhat challenging project as I am not intimately familiar with the details of php, nor had I ever previously delved into the WordPress API.  I was able to cobble together what I feel is a stable plugin that more or less acts like an on/off switch for WordPress websites.  I have submitted my request to place the plugin into the repository, and they will eventually get back to me so I can upload it to the svn.  In the meantime, I thought it was an interesting project and I’ve placed the cleaned up bare-bones source code for the plugin below.

The majority of the effort was actually fixing minor mistakes like blacking out the dashboard where I was editing the plugin and many, many php error message frustrations caused by a single leading “?” prior the rest of the code above.   Beyond those small details it was a matter of figuring out which hook would allow me to place the banner most effectively.  After some fiddling around with different locations, I simply set the dimensions to “100%” and blacked out most of the sandbox I had setup.  So, the plugin works, I got to play with the insides of WordPress, and I was able to complete my project in just a few short hours.