/** * @group guest * @group init */ public function test_fergcorp_countdownTimer() { $event_object_array = array(); for ($i = -3; $i < 3; $i++) { $time = time() + $i * 3210; array_push($event_object_array, new Fergcorp_Countdown_Timer_Event($time, "Date is set to " . date('Y-m-d H:i:s', $time), "http://example.com", $i % 2)); } update_option("fergcorp_countdownTimer_oneTimeEvent", $event_object_array); $this->plugin->loadSettings(); $this->expectOutputRegex("/^<li class = 'fergcorp_countdownTimer_event_li'><span class = 'fergcorp_countdownTimer_event_title'><a href=\"http:\\/\\/example.com\" class = 'fergcorp_countdownTimer_event_linkTitle'>Date is set to (.*?)<\\/a><\\/span>:<br \\/>\n<abbr title = \"(.*?)\" id = 'x[0-9a-z]{32}' class = 'fergcorp_countdownTimer_event_time'><span class=\"fergcorp_countdownTimer_hour fergcorp_countdownTimer_timeUnit\">[0-9] hours,<\\/span> <span class=\"fergcorp_countdownTimer_minute fergcorp_countdownTimer_timeUnit\">[0-9]{2} minutes<\\/span> ago<\\/abbr><\\/li>\r\n<li class = 'fergcorp_countdownTimer_event_li'><span class = 'fergcorp_countdownTimer_event_title'><a href=\"http:\\/\\/example.com\" class = 'fergcorp_countdownTimer_event_linkTitle'>Date is set to (.*?)<\\/a><\\/span>:<br \\/>\n<abbr title = \"(.*?)\" id = 'x[0-9a-z]{32}' class = 'fergcorp_countdownTimer_event_time'><span class=\"fergcorp_countdownTimer_minute fergcorp_countdownTimer_timeUnit\">[0-9]{2} minutes<\\/span> ago<\\/abbr><\\/li>\r\n<li class = 'fergcorp_countdownTimer_event_li'><span class = 'fergcorp_countdownTimer_event_title'><a href=\"http:\\/\\/example.com\" class = 'fergcorp_countdownTimer_event_linkTitle'>Date is set to (.*?)<\\/a><\\/span>:<br \\/>\n<abbr title = \"(.*?)\" id = 'x[0-9a-z]{32}' class = 'fergcorp_countdownTimer_event_time'>in <span class=\"fergcorp_countdownTimer_minute fergcorp_countdownTimer_timeUnit\">[0-9]{2} minutes<\\/span><\\/abbr><\\/li>\r\n<li class = 'fergcorp_countdownTimer_event_li'><span class = 'fergcorp_countdownTimer_event_title'><a href=\"http:\\/\\/example.com\" class = 'fergcorp_countdownTimer_event_linkTitle'>Date is set to (.*?)<\\/a><\\/span>:<br \\/>\n<abbr title = \"(.*?)\" id = 'x[0-9a-z]{32}' class = 'fergcorp_countdownTimer_event_time'>in <span class=\"fergcorp_countdownTimer_hour fergcorp_countdownTimer_timeUnit\">[0-9] hour,<\\/span> <span class=\"fergcorp_countdownTimer_minute fergcorp_countdownTimer_timeUnit\">[0-9]{2} minutes<\\/span><\\/abbr><\\/li>\r\n\$/is"); fergcorp_countdownTimer(); }
<div class="sticky"> <h2>Navigation</h2> <ul id="primary-nav"> <?php wp_list_pages('title_li='); ?> </ul> </div> <!-- <div id="countdown-timer" class="sticky"> <h2>Countdown</h2> <ul> <?php function_exists('fergcorp_countdownTimer') ? fergcorp_countdownTimer() : NULL; ?> </ul> </div> --> <div id="recent-comments" class="sticky"> <?php if (function_exists('get_recent_comments')) { ?> <li><h2><?php _e('Recent Comments'); ?> </h2> <p>THATCampers can use the blog and comments to talk about session ideas. Follow along by subscribing to the <strong><a href="http://chnm2010.thatcamp.org/comments/feed/">comments feed</a></strong> and to the <strong><a href="http://chnm2010.thatcamp.org/feed/">blog feed</a></strong>!</p>
/** * Outputs the widget version of the countdown timer * * @since 2.1 * @access private * @author Andrew Ferguson */ function widget_fergcorp_countdown($args) { $options = get_option('widget_fergcorp_countdown'); // $args is an array of strings that help widgets to conform to the active theme: before_widget, before_title, after_widget, and after_title are the array keys. Default tags: li and h2. extract($args); $title = $options['title']; // These lines generate our output. Widgets can be very complex but as you can see here, they can also be very, very simple. echo $before_widget . $before_title . "<span class = 'fergcorp_countdownTimer_widgetTitle' >" . $title . "</span>" . $after_title; ?> <ul> <?php fergcorp_countdownTimer($options['count'], "echo"); ?> </ul> <?php echo $after_widget; }