Upcoming: CSS Naked Day

CSS Naked DayAnnouncement: April 5th will be the second CSS Naked Day.

Just like last year, a lot of bloggers and web developers will have fun on this day by disabling the CSS for their sites and see what the raw content looks like.

I just installed a plugin for WordPress which does CSS switching for me. Well, it did not quite work with the current 2.1x release of WordPress, so I made a slight modification.

This version of the plugin works for me in WordPress 2.1x:

<?php
/*
Plugin Name: CSS Naked Day
Plugin URI: http://guff.szub.net/2006/04/03/css-naked-day/
Description: Automatically turns off stylesheet on April 5. 
Also provides is_naked_day() conditional for use in your templates.
Author: Kaf Oseo
Version: 1.0.2
Author URI: http://szub.net

	For info on CSS Naked Day: http://www.dustindiaz.com/naked-day/

	Copyright (c) 2006 Kaf Oseo (http://szub.net)
	CSS Naked Day WordPress plugin is released under the GNU General
	Public License (GPL) http://www.gnu.org/licenses/gpl.txt

	Adapted for WordPress 2.1x by Johannes la Poutre
	See http://squio.nl/blog/2007/04/03/upcoming-css-naked-day/

	This is a WordPress plugin (http://wordpress.org).
*/

function time_to_get_naked($text) {

	if(is_Naked_Day() && $text == get_bloginfo('stylesheet_url')) {
		return;
	}

	return $text;
}

function is_Naked_Day() {

	$use_gmt_offset = 1; // use GMT offset (Options > General, Date and Time 'differ')

	$start = date('U', mktime(0,0,0,04,05,date(Y)));
	$end = date('U', mktime(24,0,0,04,05,date(Y)));
	$now = time('U');

	if($use_gmt_offset) {
		$offset = get_settings('gmt_offset')*60*60;
		$start += $offset;
		$end += $offset;
		$now += $offset;
	}
	if (($now >= $start) && ($now <= $end))
		return true;
	else
		return false;
}

add_filter('bloginfo_url', 'time_to_get_naked', 5);
?>

Just copy the content to a file named ‘css_naked_day.php‘, upload it to your wp-plugins directory, activate it from the Plugins menu and you should be ready.