Welcome
Well, CSS Naked Day '08 has come and gone. The official site shows 2019 registered nudists--biggest year yet! Way to go everyone. More good news, I had 3 sites using this API to determine when to rip off their styles and all 3 worked flawlessly with the live config. Be sure to let me know if you experienced any issues with it.
CSS Naked Day
What is CSS Naked Day? Seems that would be a good thing to know before trying to work with this class. Read all about it on Dustin Diaz's CSS Naked Day page.
Naked Day Timer Class
Quick Start
require_once( 'naked_day/naked_day.php' );
You'll then need to initialize the class:
naked_day::init();
NOTE: using this methodology the code determines when naked day is based on what is in the Live Config file. This is fully automated and if you were to leave this code in place, and I were to edit the Live Config to make naked day right now, your CSS would be dropped if you had used this class to automate that action. Also, if the config file cannot be retrieved, the script will throw an exception. This is why I have used Google Code to host the Live Config file--reliability is a must.
NOTE 2: If you do not like the idea of the config being centrally managed by someone other than yourself, you can pass config parameters to init(). The first should be passed as false to disable Live Config. The others are properly documented in the Naked Day API Docs.
With all that out of the way, the class is loaded and initialized. Here are some examples of what you can do with it:
Conditionally exclude your CSS
<?php if ( ! naked_day::today() ) { ?> <link href="/css/style.css" rel="stylesheet" type="text/css" media="screen,projection"/> <?php } else { naked_day::css_replacement(); } ?>
<!-- CSS? It's naked day, didn't ya know it? Learn more at http://naked.dustindiaz.com -->
Conditionally display a Naked Day explanation to your visitors
if ( naked_day::today() ) { naked_day::message(); }
<h3>What happened to the design?</h3> <p>To know more about why styles are disabled on this website visit the <a href="http://naked.dustindiaz.com" title="Web Standards Naked Day Host Website">Annual CSS Naked Day</a> website for more information.</p>
Complete Interface
The full list of methods available to you are listed below and are well documented in the Naked Day API Docs.
- ::day()
- ::month()
- ::year()
- ::today()
- ::coming_soon()
- ::over()
- ::message()
- ::css_replacement()