Mike Gifford

Syndicate content
Updated: 46 weeks 6 days ago

Migrating WordPress Plugins to Drupal Modules - Earth Hour

Sun, 03/22/2009 - 8:30pm

It was Friday afternoon and went over to search for terms on Twitter that I like to keep an eye on when I ran into a post from @haggaret. It was a call to convert an Earth Hour WordPress Plugin over to Drupal.  Now I'm very aware of environmental issues, but there are 8765 (or so) other hours in the year to worry about, so what's the big deal about this one.  I'm still not sure, but in solidarity I decided to check it out and see when it was, unfortunately it was 8 days later on the last Saturday of March. 

But really, how hard could it be?  A bit of CSS, tad of javascript, and heck, most of the logic had already been figured out for WordPress.  It was a bit more difficult than it seemed at first, but never-the-less, by the time there was one week remaining until the Earth Hour countdown of 8:30-9:30pm on March 28th, 2009, I had a working module for Drupal. 

Was interesting to see how this spread through the Twitosphere, getting a few folks trying out the code within a few hours of providing a download able version.  I had a less functional version the previous evening that I posted to pastbin, but didn't get any feedback on.  I had thought it would be neat to get some spontaneous collaboration around improving this module if the right people were watching.

I don't have any prior experience with WordPress conversions, but it was interesting to get a look at the code and compare.  WordPress uses the Snoopy library and I couldn't find an easy equivalent in Drupal, so just pulled off a parsing tool from php.net.  There must be an equivalent library to pull from in Drupal, but didn't find it.

So much of these systems is learning the shortcuts that have been implemented.  I'm still not sure what '__' is supposed to mean in code like:

echo __( "Visit the Earth Hour Website", "earth-hour" );

It's interesting too also understand how when you are emulating someone else's work that it is easy to just adopt their assumptions. I'm still not sure why the WordPress Plugin sent site names over to the server in md5(). Certainly there are places where you would want that security, but if you are making a public statement, not sure it's a useful security measure.

Having dug into this over the weekend, I'm much more likely to attempt to migrate some other good WordPress Plugins.  There is certainly a lot to be learned from this type of review.

I will be extending the module and looking to generalize this type of module for other campaigns.  Since I was a bit late to get working on it (and there are only 5 days left before Earth Hour), I put in some code to ensure that I was able to pull up the right day every year:

$year = date('Y');
$last_day_of_march = date('D', strtotime(date("$year-3-31")));
$days_array = array('Mon' => -2, 'Tue' => -3, 'Wed' => -4, 'Thu' => -5, 'Fri' => -6, 'Sat' => 0, 'Sun' => -1);
$last_sat_of_march = (31 + $days_array[$last_day_of_march]);
$earth_hour_start_time  = gmmktime(20, 30, 0, 3, $last_sat_of_march, $year);

In anycase, if you've got ideas for campaign modules like this, please let me know. It's all about raising awareness and changing behaviours after all. And if you've got a Drupal site, please consider installing the Earth Hour Module.

Irrepressible Sites - Breaking Down Barriers to Democracy

Fri, 03/13/2009 - 10:41pm

Ok, Amnesty's Irrepressible campaign looked like an interesting campaign. I was a bit frustrated because the quotes were completely out of context. However, I really liked that they had an API so that I could try to put it back into context. So although most people will just paste in the following javascript widget that looks like:

var irr_lang = 'en';

Using javascript code like this:

<script type="text/javascript"> var irr_lang = 'en'; </script> <script src="http://fragments.irrepressible.info/js/fragment-468.js" type="text/javascript"> </script>

Amnesty's API let me focus in on a country and even an organization's domain, so I figured I would stick with Burma (since I've got a bit of a history with that country). So by playing with the RSS feeds a bit more to extract a more customized response:

Someone doesn't want people to read this - http://irrepressible.info

The Karen are the largest of the ethnic minority groups living in the mountain ranges of eastern Burma and northwestern Thailand. There

This is an excerpt from: http://karenpeople.org/ The site belongs to Karen People , and has been censored in Myanmar / Burma. It is a non-profit portal about the Karen People

Amnesty has a list of pages, however don't seem to be encouraging people to start creating distributed caches of the censored pages. Electronic Frontier Finland is mirroring Amnesty's list with cached pages and providing php code to allow you to do the same.

I would have liked this campaign's API at least to include:

  • links to the censored organization's site
  • links to the page with the sample fragment
  • a full copy of the text of the page that included the fragment
  • a link to Wikipedia with a description about the organization
  • a screen-shot of the site
  • a list of mirrors for the site

They also don't provide easy links out to those sites that are identified as being censored. I thought I'd just embed them in this iframe:

Your browser does not support iframes.

Transforming Power - A Light of Hope

Tue, 03/10/2009 - 10:10pm

I was fortunate enough to be able to attend the Ottawa Book Launch for Transforming Power, that was held at the Raw Sugar Cafe earlier today.  The cafe was definitely packed with people who came to both see Judy & celebrate Octopus Books' 40th Anniversary.  The venue was intimate and everyone was interested in hearing from Judy.  We have been doing the Website for Octopus Books now for probably 8 years (Krishna & I put up what was at the time a fairly complex site at that time) and also helped Judy Rebick put together her site over the past couple of months.

We took a leadership role in supporting Judy's site because we saw the potential for this project to mobilize the social justice movement in Canada.  When we (Krishna & I) first worked with Judy it was when we helped to launch rabble.ca back in 2001.  Rabble.ca has done a lot to help to focus left leaning media and discussion since that time and it was with rabble.ca that we were involved in our first advocacy campaign to build a petition to release Jaggi Shing. 

In Judy's book was just launched today, but already it's popularity is greater than anticipated.  The power of social networking through the website and other social media has helped to increase the initial sales of her book.  The website however is more than just a platform to sell the book, it's a place to start organizing for change. 

We've supported the early development of this site, primarily because Judy's book not only needs to be read, but needs to be discussed, challenged, extended and applied.  Judy will be going across the country talking to people about the ideas which went into the book, but this should just be the beginning of a dialoge with concerned individuals who passionately want a better future.

I also liked Judy's references to Rev. Van Jones & Velcro Ripper.  Back in 2006 I blogged about a very nice podcast that the Rabble Podcast Network released prior to Velcro's movie Fierce Light, which looked at the requirements to combine spirituality with social activism.  It's a really empowering podcast, so would recommend people download it.  It made me reflect too on the choice of the phrase Transforming Power which I know from my personal Quaker faith and past involvement in the Alternatives to Violence Project (AVP). AVP was started by Quakers, but the very core of AVP happens to be this very concept.

This is a great initiative.  There is something in this book to upset and excite everyone.  Go buy the book, read it, join in on the discussions and let's start making the world we want to live in!

Online Political Campaigning

Tue, 01/27/2009 - 10:02am

A netcast from the 26 Jan 09 meeting of the Social Tech Brewing Co. at the Code Factory, featuring Pam Kapoor, a Gatineau-based communications/advocacy specialist and produced by Chris Brown of Liquid Visual. From the Brewing Co's site:

'Obama's election victory last November has been hailed as the coming of age for online political campaigning. In Canada we've seen the growing importance of online campaigning in recent elections, and in the progressive coalition movement that nearly brought down the government at the end of last year.'