post_date_gmt )); else $standard_date = getdate (mysql2date( 'U', $post->post_date )); break; case "get_comment_date": case "get_comment_time": $comment = get_comment( $format ); if (get_option('dtime_convert')) $standard_date = utcm5_convert(mysql2date( 'U', $comment->comment_date_gmt )); else $standard_date = getdate (mysql2date( 'U', $comment->comment_date )); break; case "now": if (get_option('dtime_convert')) $standard_date = utcm5_convert(getdate()[0]); else $standard_date = getdate(); } if ($originalRequest == "get_comment_time") return dtime_convert($standard_date); if ($originalRequest == "get_the_time") return dtime_convert($standard_date); $dyear=$standard_date["year"]+1166; $gyear=$standard_date["year"]; $yday=$standard_date["yday"]; // Check Tib's day according to Gregorian calendar if ($gyear%4==0&&$gyear%100!=0 || $gyear%400==0) { if ($standard_date["yday"]==59) $sttib="St. Tib's"; if ($standard_date["yday"]>59) $yday=$standard_date["yday"]-1; } $mon=$standard_date["mon"]; $mday=$standard_date["mday"]; $dseason=(int)($yday/73); $name_season=$season_list[$dseason]; $dday=($yday-(73*$dseason))+1; $clear_dday=$dday; $suff=$dday%10; switch ($suff) { case 1: $dday.="st"; break; case 2: $dday.="nd"; break; case 3: $dday.="rd"; break; default: $dday.="th"; } $dweekday=$day_list[($yday%5)]; if ($originalRequest == "now") { $ddate=$dweekday.", the ".$dday." day of ".$name_season.", in the yold ".$dyear; if (isset($sttib)) $ddate=$sttib." day, in the yold ".$dyear; } else { $patterns = array(); $patterns[0] = '%DY'; $patterns[1] = '%DS'; $patterns[2] = '%DD'; $patterns[3] = '%DC'; $patterns[4] = '%DW'; $patterns[5] = '%GY'; $patterns[6] = '%GM'; $patterns[7] = '%GN'; $patterns[8] = '%GD'; $patterns[9] = '%GW'; $patterns[10] = '%DT'; $patterns[11] = '%CT'; $patterns[12] = '%UT'; $replacements = array(); $replacements[0] = $dyear; $replacements[1] = $name_season; $replacements[2] = $dday; $replacements[3] = $clear_dday; if (isset($sttib)) { $replacements[2] = $sttib; $replacements[3] = "tib"; } $replacements[4] = $dweekday; $replacements[5] = $standard_date["year"]; $replacements[6] = $standard_date["month"]; $replacements[7] = $standard_date["mon"]; $replacements[8] = $standard_date["mday"]; $replacements[9] = $standard_date["weekday"]; $replacements[10] = dtime_convert($standard_date); $replacements[11] = $standard_date["hours"] . ":" . str_pad($standard_date["minutes"], 2, '0', STR_PAD_LEFT); $replacements[12] = $standard_date[0]; $ddate = str_replace($patterns, $replacements, get_option('ddatefunc_string')); } return $ddate; } function dtime_convert($standard_date) { $standard_msday = $standard_date["hours"]*3600000+$standard_date["minutes"]*60000+$standard_date["seconds"]*1000; $discordian_sday = round($standard_msday/864); $discordian_minutes = $discordian_sday%10000; $dtime = floor($discordian_sday/10000) . ":" . str_pad(floor($discordian_minutes/100), 2, '0', STR_PAD_LEFT); return $dtime; } function utcm5_convert($standard_date) { // Easter Island Winter Time Zone offset (-5*60*60) $utcm5_date = array(); $utcm5_date[0] = $standard_date; $unixtime_utcm5 = $standard_date-18000; $utcm5_date["seconds"] = gmdate("s", $unixtime_utcm5); $utcm5_date["minutes"] = gmdate("i", $unixtime_utcm5); $utcm5_date["hours"] = gmdate("G", $unixtime_utcm5); $utcm5_date["mday"] = gmdate("j", $unixtime_utcm5); $utcm5_date["wday"] = gmdate("w", $unixtime_utcm5); $utcm5_date["mon"] = gmdate("n", $unixtime_utcm5); $utcm5_date["year"] = gmdate("Y", $unixtime_utcm5); $utcm5_date["yday"] = gmdate("z", $unixtime_utcm5); $utcm5_date["weekday"] = gmdate("l", $unixtime_utcm5); $utcm5_date["month"] = gmdate("F", $unixtime_utcm5); return $utcm5_date; } class Discordian_Date_Widget extends WP_Widget { function Discordian_Date_Widget() { $widget_ops = array('classname' => 'discordian_date_func', 'description' => 'Display the current date according to the Discordian Calendar.'); $control_ops = array('width' => 200, 'height' => 120); $this->WP_Widget('discordian_date_func', 'Discordian Date Widget', $widget_ops, $control_ops); } function widget($args, $instance) { $now = getdate(); $yday=$now["yday"]; $mon=$now["mon"]; $mday=$now["mday"]; $dseason=(int)($yday/73); if ($now["year"]%4==0&&$now["year"]%100!=0 || $now["year"]%400==0) if ($now["yday"]>59) $yday=$now["yday"]-1; $dday=($yday-(73*$dseason))+1; $a_holiday=array("Mungday", "Mojoday", "Syaday", "Zaraday", "Maladay"); $s_holiday=array("Chaoflux", "Discoflux", "Confuflux", "Bureflux", "Afflux"); $m_holiday=array("Chaomas", "Discomas", "Confumas", "Buremas", "Afmas"); $t_holiday=array("Chaosloth", "Discosloth", "Confusloth", "Buresloth", "Afsloth"); $e_holiday=array("Mungeye", "Mojeye", "Syadeye", "Zareye", "Maleye"); $holiday=""; if ($dday==5) { $holiday = " Celebrate Apostle Day, ".$a_holiday[$dseason]."."; } elseif ($dday==23) { $holiday = " Celebrate Synaptyclypse Day, ".$m_holiday[$dseason]."."; } elseif ($dday==27) { $holiday = " Celebrate Sloth Day, ".$t_holiday[$dseason]."."; } elseif ($dday==50) { $holiday = " Celebrate Flux Day, ".$s_holiday[$dseason]."."; } elseif ($dday==73) { $holiday = " Celebrate Eye Day, ".$e_holiday[$dseason]."."; } elseif ($mon==2 && $mday==29) { $holiday = " Celebrate St. Tib's Day."; } elseif ($dseason==0 && $dday==8) { $holiday = " Celebrate Death of Emperor Norton."; } elseif ($dseason==0 && $dday==10) { $holiday = " Celebrate Backwards/Binary Day."; } elseif ($dseason==0 && $dday==11) { $holiday = " Celebrate RAW Day."; } elseif ($dseason==0 && $dday==14) { $holiday = " Celebrate Golden Apple Presentation Day."; } elseif ($dseason==0 && $dday==17) { $holiday = " Celebrate Joshmas."; } elseif ($dseason==0 && $dday==18) { $holiday = " Celebrate Pat Pineapple Day."; } elseif ($dseason==0 && $dday==21) { $holiday = " Celebrate Hug Day."; } elseif ($dseason==0 && $dday==26) { $holiday = " Celebrate yaD sdrawkcaB, Traditional."; } elseif ($dseason==0 && $dday==37) { $holiday = " Celebrate Aaron Burr's Birthday."; } elseif ($dseason==0 && $dday==51) { $holiday = " Celebrate Pet Loving Day."; } elseif ($dseason==0 && $dday==69) { $holiday = " Celebrate Chicken Head Day."; } elseif ($dseason==0 && $dday==72) { $holiday = " Celebrate Daytime."; } elseif ($dseason==1 && $dday==4) { $holiday = " Celebrate Grover Cleveland's Birthday."; } elseif ($dseason==1 && $dday==11) { $holiday = " Celebrate Discordians for Jesus/Love Your Neighbor Day."; } elseif ($dseason==1 && $dday==18) { $holiday = " Celebrate Fool's Day."; } elseif ($dseason==1 && $dday==19) { $holiday = " Celebrate St. John the Blasphemist's Day."; } elseif ($dseason==1 && $dday==34) { $holiday = " Celebrate Omarmas."; } elseif ($dseason==1 && $dday==43) { $holiday = " Celebrate Universal Ordination Day."; } elseif ($dseason==1 && $dday==68) { $holiday = " Celebrate Mal-2mas."; } elseif ($dseason==1 && $dday==70) { $holiday = " Celebrate Day of the Elppin/Defenestration of Prague Day."; } elseif ($dseason==1 && $dday==72) { $holiday = " Celebrate Towel Day."; } elseif ($dseason==2 && $dday==26) { $holiday = " Celebrate Imaginary Friend."; } elseif ($dseason==2 && $dday==28) { $holiday = " Celebrate St. George's Day."; } elseif ($dseason==2 && $dday==30) { $holiday = " Celebrate Zoog Day."; } elseif ($dseason==2 && $dday==37) { $holiday = " Celebrate Mid-Year's Day."; } elseif ($dseason==2 && $dday==40) { $holiday = " Celebrate X-Day."; } elseif ($dseason==2 && $dday==55) { $holiday = " Celebrate Mal-2 Day."; } elseif ($dseason==2 && $dday==57) { $holiday = " Celebrate John Dillinger Day."; } elseif ($dseason==3 && $dday==3) { $holiday = " Celebrate Multiversal Underwear Day."; } elseif ($dseason==3 && $dday==10) { $holiday = " Celebrate St. Cecil Day."; } elseif ($dseason==3 && $dday==18) { $holiday = " Celebrate Spanking Fest."; } elseif ($dseason==3 && $dday==33) { $holiday = " Celebrate Pussyfoot Day."; } elseif ($dseason==3 && $dday==37) { $holiday = " Celebrate Mass of Planet Eris/Mass of Eristotle."; } elseif ($dseason==3 && $dday==39) { $holiday = " Celebrate St. Mammes's Day."; } elseif ($dseason==3 && $dday==41) { $holiday = " Celebrate Emperor Norton Proclamation Day."; } elseif ($dseason==3 && $dday==55) { $holiday = " Celebrate Feast of St. John Blasphemist."; } elseif ($dseason==3 && $dday==57) { $holiday = " Celebrate Shamlicht Kids Club Day."; } elseif ($dseason==3 && $dday==59) { $holiday = " Celebrate Gonculator Day."; } elseif ($dseason==3 && $dday==60) { $holiday = " Celebrate Mad Hatter Day."; } elseif ($dseason==3 && $dday==66) { $holiday = " Celebrate Habeas Corpus Remembrance Day."; } elseif ($dseason==4 && $dday==17) { $holiday = " Celebrate Pope Night."; } elseif ($dseason==4 && $dday==28) { $holiday = " Celebrate Ek-sen-triks CluborGuild Day."; } elseif ($dseason==4 && $dday==37) { $holiday = " Celebrate 537 Day."; } elseif ($dseason==4 && $dday==40) { $holiday = " Celebrate Omar's Day."; } elseif ($dseason==4 && $dday==43) { $holiday = " Celebrate Day D."; } elseif ($dseason==4 && $dday==46) { $holiday = " Celebrate Hug Day II."; } elseif ($dseason==4 && $dday==56) { $holiday = " Celebrate Agnostica."; } elseif ($dseason==4 && $dday==65) { $holiday = " Celebrate Circlemas."; } extract($args); $title = $instance['title']; $body = apply_filters('widget_text', $instance['body']); ob_start(); echo "
'.__('Settings saved.').'