diff --git a/ddatefunc.php b/ddatefunc.php index 00db1ed..18d1675 100644 --- a/ddatefunc.php +++ b/ddatefunc.php @@ -2,8 +2,8 @@ /* Plugin Name: Discordian Date Function Plugin URI: https://is3.soundragon.su/discordian-date-function -Description: Convert dates in Wordpress to Discordian dates. Also, this plugin provides shortcode and widget used to display the current erisian date with notification of 70 holydays. Based on the Discordian Date plugin by Dan Johnson. -Version: 0.5 +Description: Convert dates in Wordpress to customizable Discordian dates. Also, this plugin provides shortcode and widget used to display the current erisian date with notification of 70 holydays. Based on the Discordian Date plugin by Dan Johnson. +Version: 0.55 Author: ivan zlax Author URI: https://is3.soundragon.su/about */ @@ -37,6 +37,7 @@ function get_ddate($content, $format = "", $originalRequest = null) { $dseason=(int)($yday/73); $name_season=$season_list[$dseason]; $dday=($yday-(73*$dseason))+1; + $clear_dday=$dday; $suff=$dday%10; switch ($suff) { @@ -54,8 +55,34 @@ function get_ddate($content, $format = "", $originalRequest = null) { } $dweekday=$day_list[($yday%5)]; - $ddate=$dweekday.", the ".$dday." day of ".$name_season.", in the yold ".$dyear; + if ($originalRequest == "now") { + $ddate=$dweekday.", the ".$dday." day of ".$name_season.", 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'; + $replacements = array(); + $replacements[0] = $dyear; + $replacements[1] = $name_season; + $replacements[2] = $dday; + $replacements[3] = $clear_dday; + $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"]; + $ddate = str_replace($patterns, $replacements, get_option('ddatefunc_string')); + } return $ddate; } @@ -77,12 +104,15 @@ class Discordian_Date_Widget extends WP_Widget { $dday=($yday-(73*$dseason))+1; $a_holiday=array("Mungday", "Mojoday", "Syaday", "Zaraday", "Maladay"); $s_holiday=array("Chaoflux", "Discoflux", "Confuflux", "Bureflux", "Afflux"); + $m_holyday=array("Chaomas", "Discomas", "Confumas", "Buremas", "Afmas"); + $t_holyday=array("Chaosloth", "Discosloth", "Confusloth", "Buresloth", "Afsloth"); + $e_holyday=array("Mungeye", "Mojeye", "Syadeye", "Zareye", "Maleye"); $holyday=""; if ($dday==5) { - $holyday = " Celebrate ".$a_holiday[$dseason]."."; + $holyday = " Celebrate Apostle Day, ".$a_holiday[$dseason]."."; } elseif ($dday==50) { - $holyday = " Celebrate ".$s_holiday[$dseason]."."; + $holyday = " Celebrate Flux Day, ".$s_holiday[$dseason]."."; } elseif ($mon==2 && $mday==29) { $holyday = " Celebrate St. Tib's Day."; } elseif ($dseason==2 && $dday==28) { @@ -92,11 +122,11 @@ class Discordian_Date_Widget extends WP_Widget { } elseif ($dseason==4 && $dday==65) { $holyday = " Celebrate Circlemas."; } elseif ($dday==23) { - $holyday = " Celebrate Synaptyclypse Day."; + $holyday = " Celebrate Synaptyclypse Day, ".$m_holiday[$dseason]."."; } elseif ($dday==27) { - $holyday = " Celebrate Sloth Day."; + $holyday = " Celebrate Sloth Day, ".$t_holiday[$dseason]."."; } elseif ($dday==73) { - $holyday = " Celebrate Eye Day."; + $holyday = " Celebrate Eye Day, ".$e_holiday[$dseason]."."; } elseif ($dseason==0 && $dday==8) { $holyday = " Celebrate Death of Emperor Norton."; } elseif ($dseason==0 && $dday==10) { @@ -222,21 +252,21 @@ class Discordian_Date_Widget extends WP_Widget {
- +'.__('Settings saved.').'