11 Commits
v0.5 ... v2.5

Author SHA1 Message Date
6c1eae64d7 fixed holiday misprint 2020-06-18 12:01:08 +03:00
37b2f5593b version 2.5 2020-04-04 12:02:47 +03:00
658ecbd0ff version 2.5 2020-04-04 11:52:59 +03:00
4ea02f909d add 3 holidays, widget tib's day shift fix 2020-03-13 09:10:29 +01:00
0fa6636b0e Update 'readme.txt' 2020-03-01 13:27:35 +01:00
fbed282ae1 remove obsoleted part of code 2020-03-01 15:24:45 +03:00
f32e9d7fdd Update 'readme.txt' 2020-03-01 10:59:50 +01:00
b23f60ca66 version 0.555 2020-03-01 12:47:54 +03:00
1ec1203a26 version 0.555 2020-03-01 12:46:42 +03:00
9bd12fb4d3 php warning fix
"PHP Warning:  Missing argument 2" fix in 259 and 262 strings
2019-08-04 22:00:05 +00:00
feder
e817a39bd0 Version update 2017-03-19 14:18:04 +03:00
3 changed files with 352 additions and 94 deletions

View File

@@ -1,13 +1,13 @@
Discordian Date Function Discordian Date Function
under DWTWL 2.5 license: https://soundragon.su/license/license.html under DWTWL 2.55 license: https://soundragon.su/license/license.html
https://wordpress.org/plugins/discordian-date-function/ https://wordpress.org/plugins/discordian-date-function/
This plugin allows WordPress to easily show Erisian dates instead of the standard Gregorian dates. No theme changes are required. This plugin allows WordPress to easily show Erisian dates and time (decimal) instead of the standard Gregorian dates. No theme changes are required.
This functional based on the Discordian Date plugin by Dan Johnson. This functional based on the Discordian Date plugin by Dan Johnson.
Also provides a widget which displays the current date according to the Discordian calendar, with notification of 70 holydays. Also provides a widget which displays the current date according to the Discordian calendar, with notification of more than 70 holidays.
And you can add the shortcode [todаy_ddate] in posts or pages for show the Discordian date of today. And you can add the shortcode [todаy_ddate] in posts or pages for show the Discordian date of today.

View File

@@ -2,8 +2,8 @@
/* /*
Plugin Name: Discordian Date Function Plugin Name: Discordian Date Function
Plugin URI: https://is3.soundragon.su/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. Description: Convert dates in Wordpress to customizable Discordian dates and time (decimal). Also, this plugin provides shortcode and widget used to display the current erisian date with notification of 70 holidays. Based on the Discordian Date plugin by Dan Johnson.
Version: 0.5 Version: 2.5
Author: ivan zlax Author: ivan zlax
Author URI: https://is3.soundragon.su/about Author URI: https://is3.soundragon.su/about
*/ */
@@ -14,29 +14,50 @@ function get_ddate($content, $format = "", $originalRequest = null) {
Based on: http://www.dexterityunlimited.com/wordpress-plugins/discordian-date/ by Dan Johnson Based on: http://www.dexterityunlimited.com/wordpress-plugins/discordian-date/ by Dan Johnson
*/ */
$season_list = array("Chaos", "Discord", "Confusion", "Bureaucracy", "The Aftermath"); $season_list = array("Chaos", "Discord", "Confusion", "Bureaucracy", "Aftermath");
$day_list = array("Sweetmorn", "Boomtime", "Pungenday", "Prickle-Prickle", "Setting Orange"); $day_list = array("Sweetmorn", "Boomtime", "Pungenday", "Prickle-Prickle", "Setting Orange");
switch ($originalRequest) { switch ($originalRequest) {
case "get_the_date": case "get_the_date":
case "get_the_time":
$post = get_post( $format ); $post = get_post( $format );
$standard_date = getdate (mysql2date( 'U', $post->post_date )); if ( get_option('dtime_convert') == '1' )
$standard_date = utcm5_convert(mysql2date( 'U', $post->post_date_gmt ));
else
$standard_date = getdate (mysql2date( 'U', $post->post_date ));
break; break;
case "get_comment_date": case "get_comment_date":
case "get_comment_time":
$comment = get_comment( $format ); $comment = get_comment( $format );
$standard_date = getdate (mysql2date( 'U', $comment->comment_date )); if ( get_option('dtime_convert') == '1' )
$standard_date = utcm5_convert(mysql2date( 'U', $comment->comment_date_gmt ));
else
$standard_date = getdate (mysql2date( 'U', $comment->comment_date ));
break; break;
case "now": case "now":
$standard_date = getdate(); if ( get_option('dtime_convert') == '1' )
$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; $dyear=$standard_date["year"]+1166;
$gyear=$standard_date["year"];
$yday=$standard_date["yday"]; $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"]; $mon=$standard_date["mon"];
$mday=$standard_date["mday"]; $mday=$standard_date["mday"];
$dseason=(int)($yday/73); $dseason=(int)($yday/73);
$name_season=$season_list[$dseason]; $name_season=$season_list[$dseason];
$dday=($yday-(73*$dseason))+1; $dday=($yday-(73*$dseason))+1;
$clear_dday=$dday;
$suff=$dday%10; $suff=$dday%10;
switch ($suff) { switch ($suff) {
@@ -54,11 +75,74 @@ function get_ddate($content, $format = "", $originalRequest = null) {
} }
$dweekday=$day_list[($yday%5)]; $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;
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; 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 { class Discordian_Date_Widget extends WP_Widget {
function Discordian_Date_Widget() { function Discordian_Date_Widget() {
@@ -74,130 +158,132 @@ class Discordian_Date_Widget extends WP_Widget {
$mon=$now["mon"]; $mon=$now["mon"];
$mday=$now["mday"]; $mday=$now["mday"];
$dseason=(int)($yday/73); $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; $dday=($yday-(73*$dseason))+1;
$a_holiday=array("Mungday", "Mojoday", "Syaday", "Zaraday", "Maladay"); $a_holiday=array("Mungday", "Mojoday", "Syaday", "Zaraday", "Maladay");
$s_holiday=array("Chaoflux", "Discoflux", "Confuflux", "Bureflux", "Afflux"); $s_holiday=array("Chaoflux", "Discoflux", "Confuflux", "Bureflux", "Afflux");
$holyday=""; $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) { if ($dday==5) {
$holyday = " Celebrate ".$a_holiday[$dseason]."."; $holiday = " Celebrate Apostle Day, ".$a_holiday[$dseason].".";
} elseif ($dday==50) {
$holyday = " Celebrate ".$s_holiday[$dseason].".";
} elseif ($mon==2 && $mday==29) {
$holyday = " Celebrate St. Tib's Day.";
} elseif ($dseason==2 && $dday==28) {
$holyday = " Celebrate St. Georges Day.";
} elseif ($dseason==2 && $dday==57) {
$holyday = " Celebrate John Dillinger Day.";
} elseif ($dseason==4 && $dday==65) {
$holyday = " Celebrate Circlemas.";
} elseif ($dday==23) { } elseif ($dday==23) {
$holyday = " Celebrate Synaptyclypse Day."; $holiday = " Celebrate Synaptyclypse Day, ".$m_holiday[$dseason].".";
} elseif ($dday==27) { } elseif ($dday==27) {
$holyday = " Celebrate Sloth Day."; $holiday = " Celebrate Sloth Day, ".$t_holiday[$dseason].".";
} elseif ($dday==50) {
$holiday = " Celebrate Flux Day, ".$s_holiday[$dseason].".";
} elseif ($dday==73) { } elseif ($dday==73) {
$holyday = " Celebrate Eye Day."; $holiday = " Celebrate Eye Day, ".$e_holiday[$dseason].".";
} elseif ($mon==2 && $mday==29) {
$holiday = " Celebrate St. Tib's Day.";
} elseif ($dseason==0 && $dday==8) { } elseif ($dseason==0 && $dday==8) {
$holyday = " Celebrate Death of Emperor Norton."; $holiday = " Celebrate Death of Emperor Norton.";
} elseif ($dseason==0 && $dday==10) { } elseif ($dseason==0 && $dday==10) {
$holyday = " Celebrate Backwards Day, Reformed / Binary Day."; $holiday = " Celebrate Backwards/Binary Day.";
} elseif ($dseason==0 && $dday==11) { } elseif ($dseason==0 && $dday==11) {
$holyday = " Celebrate RAW Day."; $holiday = " Celebrate RAW Day.";
} elseif ($dseason==0 && $dday==14) {
$holiday = " Celebrate Golden Apple Presentation Day.";
} elseif ($dseason==0 && $dday==17) { } elseif ($dseason==0 && $dday==17) {
$holyday = " Celebrate Joshmas."; $holiday = " Celebrate Joshmas.";
} elseif ($dseason==0 && $dday==18) { } elseif ($dseason==0 && $dday==18) {
$holyday = " Celebrate Pat Pineapple Day."; $holiday = " Celebrate Pat Pineapple Day.";
} elseif ($dseason==0 && $dday==21) { } elseif ($dseason==0 && $dday==21) {
$holyday = " Celebrate Hug Day."; $holiday = " Celebrate Hug Day.";
} elseif ($dseason==0 && $dday==26) { } elseif ($dseason==0 && $dday==26) {
$holyday = " Celebrate Backwards Day (Traditional)."; $holiday = " Celebrate Backwards Day (Traditional).";
} elseif ($dseason==0 && $dday==37) { } elseif ($dseason==0 && $dday==37) {
$holyday = " Celebrate Aaron Burrs Birthday."; $holiday = " Celebrate Aaron Burrs Birthday.";
} elseif ($dseason==0 && $dday==49) { } elseif ($dseason==0 && $dday==49) {
$holyday = " Celebrate The Mary Day."; $holiday = " Celebrate The Mary Day.";
} elseif ($dseason==0 && $dday==51) { } elseif ($dseason==0 && $dday==51) {
$holyday = " Celebrate Pet Loving Day."; $holiday = " Celebrate Pet Loving Day.";
} elseif ($dseason==0 && $dday==69) { } elseif ($dseason==0 && $dday==69) {
$holyday = " Celebrate Head Chicken/Chicken Head Day."; $holiday = " Celebrate Head Chicken/Chicken Head Day.";
} elseif ($dseason==0 && $dday==72) { } elseif ($dseason==0 && $dday==72) {
$holyday = " Celebrate Daytime."; $holiday = " Celebrate Daytime.";
} elseif ($dseason==1 && $dday==4) { } elseif ($dseason==1 && $dday==4) {
$holyday = " Celebrate Grover Clevelands Birthday."; $holiday = " Celebrate Grover Clevelands Birthday.";
} elseif ($dseason==1 && $dday==11) { } elseif ($dseason==1 && $dday==11) {
$holyday = " Celebrate Discordians for Jesus/Love Your Neighbor Day."; $holiday = " Celebrate Discordians for Jesus/Love Your Neighbor Day.";
} elseif ($dseason==1 && $dday==18) { } elseif ($dseason==1 && $dday==18) {
$holyday = " Celebrate April Fools Day."; $holiday = " Celebrate Fools Day.";
} elseif ($dseason==1 && $dday==19) { } elseif ($dseason==1 && $dday==19) {
$holyday = " Celebrate St John the Blasphemists Day."; $holiday = " Celebrate St. John the Blasphemists Day.";
} elseif ($dseason==1 && $dday==23) {
$holyday = " Celebrate Jake Day.";
} elseif ($dseason==1 && $dday==34) { } elseif ($dseason==1 && $dday==34) {
$holyday = " Celebrate Omarmas."; $holiday = " Celebrate Omarmas.";
} elseif ($dseason==1 && $dday==43) { } elseif ($dseason==1 && $dday==43) {
$holyday = " Celebrate Universal Ordination Day."; $holiday = " Celebrate Universal Ordination Day.";
} elseif ($dseason==1 && $dday==68) { } elseif ($dseason==1 && $dday==68) {
$holyday = " Celebrate Mal-2mas."; $holiday = " Celebrate Mal-2mas.";
} elseif ($dseason==1 && $dday==70) { } elseif ($dseason==1 && $dday==70) {
$holyday = " Celebrate Jake Day Jr. (DJ)/Day of the Elppin."; $holiday = " Celebrate Jake Day Jr. (DJ)/Day of the Elppin.";
} elseif ($dseason==1 && $dday==72) { } elseif ($dseason==1 && $dday==72) {
$holyday = " Celebrate Towel Day."; $holiday = " Celebrate Towel Day.";
} elseif ($dseason==2 && $dday==26) { } elseif ($dseason==2 && $dday==26) {
$holyday = " Celebrate Imaginary Friend/Captain Tuttle Day."; $holiday = " Celebrate Imaginary Friend/Captain Tuttle Day.";
} elseif ($dseason==2 && $dday==28) {
$holiday = " Celebrate St. Georges Day.";
} elseif ($dseason==2 && $dday==30) {
$holiday = " Celebrate Zoog Day.";
} elseif ($dseason==2 && $dday==36) {
$holiday = " Celebrate June 31st for Popes.";
} elseif ($dseason==2 && $dday==37) { } elseif ($dseason==2 && $dday==37) {
$holyday = " Celebrate Mid-Years Day."; $holiday = " Celebrate Mid-Years Day.";
} elseif ($dseason==2 && $dday==40) { } elseif ($dseason==2 && $dday==40) {
$holyday = " Celebrate X-Day."; $holiday = " Celebrate X-Day.";
} elseif ($dseason==2 && $dday==55) { } elseif ($dseason==2 && $dday==55) {
$holyday = " Celebrate Mal-2 Day."; $holiday = " Celebrate Mal-2 Day.";
} elseif ($dseason==2 && $dday==57) {
$holiday = " Celebrate John Dillinger Day.";
} elseif ($dseason==3 && $dday==3) { } elseif ($dseason==3 && $dday==3) {
$holyday = " Celebrate Multiversal Underwear Day."; $holiday = " Celebrate Multiversal Underwear Day.";
} elseif ($dseason==3 && $dday==18) { } elseif ($dseason==3 && $dday==18) {
$holyday = " Celebrate Festival of Hanky-Panky Spankies."; $holiday = " Celebrate Festival of Hanky-Panky Spankies.";
} elseif ($dseason==3 && $dday==33) { } elseif ($dseason==3 && $dday==33) {
$holyday = " Celebrate Cat Dancing & Foot Fetish Day aka Pussyfoot Day."; $holiday = " Celebrate Cat Dancing & Pussyfoot Day.";
} elseif ($dseason==3 && $dday==37) { } elseif ($dseason==3 && $dday==37) {
$holyday = " Celebrate Mass of Planet Eris/Eristotle."; $holiday = " Celebrate Mass of Planet Eris/Eristotle.";
} elseif ($dseason==3 && $dday==39) {
$holiday = " Celebrate St. Mammes's Day.";
} elseif ($dseason==3 && $dday==41) { } elseif ($dseason==3 && $dday==41) {
$holyday = " Celebrate Emperor Norton Proclamation Day."; $holiday = " Celebrate Emperor Norton Proclamation Day.";
} elseif ($dseason==3 && $dday==57) { } elseif ($dseason==3 && $dday==57) {
$holyday = " Celebrate Shamlicht Kids Club Day."; $holiday = " Celebrate Shamlicht Kids Club Day.";
} elseif ($dseason==3 && $dday==59) { } elseif ($dseason==3 && $dday==59) {
$holyday = " Celebrate Gonkulator Day (Gonculator Day)."; $holiday = " Celebrate Gonkulator Day (Gonculator Day).";
} elseif ($dseason==3 && $dday==60) { } elseif ($dseason==3 && $dday==60) {
$holyday = " Celebrate Mad Hatter Day."; $holiday = " Celebrate Mad Hatter Day.";
} elseif ($dseason==3 && $dday==66) { } elseif ($dseason==3 && $dday==66) {
$holyday = " Celebrate Habeas Corpus Remembrance Day."; $holiday = " Celebrate Habeas Corpus Remembrance Day.";
} elseif ($dseason==4 && $dday==28) { } elseif ($dseason==4 && $dday==28) {
$holyday = " Celebrate Ek-sen-triks CluborGuild Day."; $holiday = " Celebrate Ek-sen-triks CluborGuild Day.";
} elseif ($dseason==4 && $dday==36) { } elseif ($dseason==4 && $dday==36) {
$holyday = " Celebrate Spanking Fest."; $holiday = " Celebrate Spanking Fest.";
} elseif ($dseason==4 && $dday==37) { } elseif ($dseason==4 && $dday==37) {
$holyday = " Celebrate 537 Day, sometimes Turkey Day."; $holiday = " Celebrate 537 Day, sometimes Turkey Day.";
} elseif ($dseason==4 && $dday==40) { } elseif ($dseason==4 && $dday==40) {
$holyday = " Celebrate Omars Day."; $holiday = " Celebrate Omars Day.";
} elseif ($dseason==4 && $dday==43) {
$holiday = " Celebrate Day D.";
} elseif ($dseason==4 && $dday==46) { } elseif ($dseason==4 && $dday==46) {
$holyday = " Celebrate Hug Day II."; $holiday = " Celebrate Hug Day II.";
} elseif ($dseason==4 && $dday==67) { } elseif ($dseason==4 && $dday==65) {
$holyday = " Celebrate Santa Claus Day."; $holiday = " Celebrate Circlemas.";
} elseif ($dseason==4 && $dday==72) {
$holyday = " Celebrate New Years Eve Eve.";
} }
extract($args); extract($args);
$title = $instance['title']; $title = $instance['title'];
$body = apply_filters('widget_text', $instance['body']); $body = apply_filters('widget_text', $instance['body']);
if (!empty($title)) {
ob_start();
eval(" ?>$title<?php ");
$title2 = ob_get_contents();
ob_end_clean();
}
ob_start(); ob_start();
echo "<div class=\"discordian_date_func\" style=\"width:100%;text-align:center;font-size:18px;line-height:36px;padding-top:40px;padding-bottom:40px;\"> Today is "; echo "<div class=\"discordian_date_func\" style=\"width:100%;text-align:center;font-size:18px;line-height:36px;padding-top:40px;padding-bottom:40px;\"> Today is ";
echo get_ddate($content, $format, "now")."."; echo get_ddate($content, $format, "now").".";
if ($holyday) echo "<br><b>".$holyday."</b>"; if ($holiday) echo "<br><b>".$holiday."</b>";
echo "</div>"; echo "</div>";
$body2 = ob_get_contents(); $body2 = ob_get_contents();
ob_end_clean(); ob_end_clean();
@@ -222,21 +308,27 @@ class Discordian_Date_Widget extends WP_Widget {
<input class="widefat" id="<?php echo $title_id; ?>" name="<?php echo $title_name; ?>" <input class="widefat" id="<?php echo $title_id; ?>" name="<?php echo $title_name; ?>"
type="text" value="<?php echo esc_attr($title); ?>"/> type="text" value="<?php echo esc_attr($title); ?>"/>
</p> </p>
<?php <?php
} }
} }
function get_the_ddate_post($content, $format){ function get_the_ddate_post($content, $format = null) {
return get_ddate($content, $format, "get_the_date"); } return get_ddate($content, $format, "get_the_date"); }
function get_the_ddate_comment($content, $format){ function get_the_dtime_post($content, $format = null) {
return get_ddate($content, $format, "get_the_time"); }
function get_the_ddate_comment($content, $format = null) {
return get_ddate($content, $format, "get_comment_date"); } return get_ddate($content, $format, "get_comment_date"); }
function get_the_dtime_comment($content, $format = null) {
return get_ddate($content, $format, "get_comment_time"); }
function register_ddatefunc_widget() { function register_ddatefunc_widget() {
register_widget( 'Discordian_Date_Widget' ); register_widget( 'Discordian_Date_Widget' );
} }
function today_ddate(){ function today_ddate() {
echo return_today_hebDate(); echo return_today_hebDate();
} }
@@ -244,7 +336,152 @@ function return_today_ddate() {
return get_ddate($content, $format, "now"); return get_ddate($content, $format, "now");
} }
add_shortcode('today_ddate', 'return_today_ddate'); $settings_name = "Discordian Date Function Settings";
function ddatefunc_add_admin() {
global $settings_name;
add_options_page(__('Settings').': '.$settings_name, $settings_name, 'edit_themes', basename(__FILE__), 'ddatefunc_admin');
}
function ddatefunc_admin() {
global $settings_name;
?>
<div class="wrap">
<?php
screen_icon();
echo '<h2>'.$settings_name.'</h2>';
if (isset($_POST['save'])) {
update_option('ddatefunc_string', stripslashes($_POST['textfield']));
if (isset($_POST['ddatefunc_change_checkbox']))
update_option('ddatefunc_change', "1");
else
update_option('ddatefunc_change', "0");
if (isset($_POST['dtimefunc_change_checkbox']))
update_option('dtimefunc_change', "1");
else
update_option('dtimefunc_change', "0");
if (isset($_POST['dtime_convert_checkbox']))
update_option('dtime_convert', "1");
else
update_option('dtime_convert', "0");
echo '<div id="setting-error-settings_updated" class="updated settings-error"><p><b>'.__('Settings saved.').'</b></p></div>';
}
?>
<form method="post">
<table class="form-table">
<tr valign="top">
<th scope="row">Date string:</th>
<td>
<input name="textfield" class="regular-text" type="text" value="<?php echo get_option('ddatefunc_string'); ?>" >
</td>
</tr>
<tr valign="top">
<th scope="row">Legend:</th>
<td>
<b>%DY</b> - Discordian yold (example: 3180)<br>
<b>%DS</b> - Erisian season name (example: Chaos)<br>
<b>%DD</b> - Discordian season day (example: 5th)<br>
<b>%DC</b> - Clear erisian day number (example: 5)<br>
<b>%DW</b> - Discordian week day (example: Setting Orange)<br>
<b>%GY</b> - Gregorian year (example: 2014)<br>
<b>%GM</b> - Gregorian month (example: January)<br>
<b>%GN</b> - Gregorian month number (example: 1)<br>
<b>%GD</b> - Gregorian month day (example: 5)<br>
<b>%GW</b> - Gregorian weekday (example: Friday)<br>
<b>%DT</b> - Discordian (decimal) time (example: 5:67)<br>
<b>%CT</b> - Christian time (example: 23:00)<br>
<b>%UT</b> - Unix time (example: 1555222555)<br>
<br>
Examples<br>
<br>
<b>%DW, the %DD day of %DS, in the yold %DY</b><br> returns:<br><b>Setting Orange, the 5th day of Chaos, in the yold 3180</b><br>
<br>
<b>%DC %DS, %DY (%GN.%GN.%GY)</b><br> returns:<br><b>5 Chaos, 3180 (5.1.2014)</br>
</td>
</tr>
<tr valign="top">
<th scope="row">Convert all post and comment dates:</th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span>Convert to Discordian dates</span>
</legend>
<label for="users_can_register">
<input name="ddatefunc_change_checkbox" id="users_can_register" type="checkbox" value="1" <?php if(get_option('ddatefunc_change')==1) { echo 'checked="checked"'; } ?>>
</label>
</fieldset>
</td>
</tr>
<tr valign="top">
<th scope="row">Convert Christian time to Discordian (decimal) time:</th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span>Convert to Erisian time</span>
</legend>
<label for="users_can_register">
<input name="dtimefunc_change_checkbox" id="users_can_register" type="checkbox" value="1" <?php if(get_option('dtimefunc_change')==1) { echo 'checked="checked"'; } ?>>
</label>
</fieldset>
</td>
</tr>
<tr valign="top">
<th scope="row">Use Erisian start of the day - <a href="https://www.reddit.com/r/Time/comments/fhys8v/erisian_time/">starts 5 Christian hours later than the day in London</a>:</th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span>Erisian start of the day</span>
</legend>
<label for="users_can_register">
<input name="dtime_convert_checkbox" id="users_can_register" type="checkbox" value="1" <?php if(get_option('dtime_convert')==1) { echo 'checked="checked"'; } ?>>
</label>
</fieldset>
</td>
</tr>
</table>
<div class="submit">
<input name="save" type="submit" class="button-primary" value="<?php echo __('Save Cganges'); ?>" />
</div>
</form>
</div>
<?php
}
function ddatefunc_settings( $actions, $plugin_file ) {
if( false === strpos( $plugin_file, basename(__FILE__) ) )
return $actions;
$settings_link = '<a href="options-general.php?page=ddatefunc.php' .'">Settings</a>';
array_unshift( $actions, $settings_link );
return $actions;
}
function ddatefunc_deinstall() {
delete_option('ddatefunc_string');
delete_option('ddatefunc_change');
delete_option('dtimefunc_change');
delete_option('dtime_convert');
}
add_shortcode( 'today_ddate', 'return_today_ddate' );
add_action( 'widgets_init', 'register_ddatefunc_widget' ); add_action( 'widgets_init', 'register_ddatefunc_widget' );
add_filter( 'get_the_date','get_the_ddate_post' ); add_option( 'ddatefunc_string', '%DD day of %DS, in the yold %DY');
add_filter( 'get_comment_date','get_the_ddate_comment' ); add_option( 'ddatefunc_change', '1');
add_option( 'dtimefunc_change', '1');
add_option( 'dtime_convert', '1');
add_filter( 'plugin_action_links', 'ddatefunc_settings', 10, 2 );
add_action( 'admin_menu', 'ddatefunc_add_admin' );
if ( get_option('ddatefunc_change') == '1' ) {
add_filter( 'get_the_date','get_the_ddate_post' );
add_filter( 'get_comment_date','get_the_ddate_comment' );
}
if ( get_option('dtimefunc_change') == '1' ) {
add_filter( 'get_the_time','get_the_dtime_post' );
add_filter( 'get_comment_time','get_the_dtime_comment' );
}
if (function_exists('register_uninstall_hook'))
register_uninstall_hook(__FILE__, 'ddatefunc_deinstall');

View File

@@ -1,21 +1,21 @@
=== Discordian Date Function === === Discordian Date Function ===
Contributors: zlaxyi Contributors: zlaxyi
Donate link: https://is3.soundragon.su/discordian-date-function Donate link: https://is3.soundragon.su/discordian-date-function
Tags: date, discordian, erisian, widget Tags: date, time, discordian, erisian, widget, eris, discordia, calendar
Requires at least: 2.0 Requires at least: 2.0
Tested up to: 4.7.3 Tested up to: 5.4
Stable tag: trunk Stable tag: trunk
License: DWTWL 2.5 License: DWTWL 2.55
License URI: https://soundragon.su/license/license.html License URI: https://soundragon.su/license/license.html
This plugin provides Discordian dates in Wordpress. This plugin provides Erisian (Discordian) dates and time in Wordpress.
Also provides shortcode and widget which displays the current date according to the Discordian calendar, with notification of 70 holydays. Also provides shortcode and widget which displays the current date according to the Discordian calendar, with notification of more than 70 holidays.
== Description == == Description ==
This plugin allows WordPress to easily show Erisian dates instead of the standard Gregorian dates. No theme changes are required. This plugin allows WordPress to easily show customizable Erisian dates and time (decimal) instead of the standard Gregorian dates. No theme changes are required.
The Discordian Date plugin provides a widget which will display the current date according to the [Discordian calendar](http://en.wikipedia.org/wiki/Discordian_calendar). This functional based on the Discordian Date plugin by Dan Johnson. The Discordian Date Function plugin provides a widget which will display the current date according to the [Discordian calendar](http://en.wikipedia.org/wiki/Discordian_calendar). This functional based on the Discordian Date plugin by Dan Johnson.
And you can add the shortcode [today_ddate] in posts or pages for show the Discordian date of today. And you can add the shortcode [today_ddate] in posts or pages for show the Discordian date of today.
@@ -24,6 +24,7 @@ And you can add the shortcode [today_ddate] in posts or pages for show the Disco
1. Extract the files from archive. 1. Extract the files from archive.
1. Upload the folder ddatefunc and its contents to the /wp-content/plugins/ directory. 1. Upload the folder ddatefunc and its contents to the /wp-content/plugins/ directory.
1. Activate the plugin through the 'Plugins' menu in WordPress. 1. Activate the plugin through the 'Plugins' menu in WordPress.
1. Press 'Settings' for customize date string.
1. If you want to add widget: position the widget in an available area on your pages using the Widgets section of your WordPress administration control panel. 1. If you want to add widget: position the widget in an available area on your pages using the Widgets section of your WordPress administration control panel.
1. Use the widget options to give the widget any title you'd like. 1. Use the widget options to give the widget any title you'd like.
1. (Optional) if you want to add the erisian date of today than you need to add <?php today_ddate() ?> where you want. 1. (Optional) if you want to add the erisian date of today than you need to add <?php today_ddate() ?> where you want.
@@ -40,10 +41,30 @@ Feel free to ask any questions about this plugin at the [Discordian Date Functio
== Changelog == == Changelog ==
= 2.5 =
*Release Date - 21st day of Discord, 3186*
* Add optional [Erisian (decimal) time](https://www.reddit.com/r/Time/comments/fhys8v/erisian_time/) support
= 0.555 =
*Release Date - 60th day of Chaos, 3186*
* Fixed Tib's day shift according Gregorian calendar's leap year.
* Add St. Mammes's day, fixed some other holiday strings.
= 0.55 =
*Release Date - 5th day of Discord, 3183*
* Fixed names of some Whollydays.
* Add settings page.
* Add customizable date string.
= 0.5 = = 0.5 =
*Release Date - 2nd day of Discord, 3183*
* First public release. * First public release.
== Upgrade Notice == == Upgrade Notice ==
= 0.5 = = 2.5 =
This version is the first public release. This version is actual.