Compare commits

...

5 Commits

Author SHA1 Message Date
ivan e6aa5ad57b v2.555 2022-07-17 20:12:48 +03:00
ivan 7a955031d4 v2.555 2022-07-17 19:33:08 +03:00
ivan 6c1eae64d7 fixed holiday misprint 2020-06-18 12:01:08 +03:00
ivan 37b2f5593b version 2.5 2020-04-04 12:02:47 +03:00
ivan 658ecbd0ff version 2.5 2020-04-04 11:52:59 +03:00
4 changed files with 422 additions and 90 deletions

View File

@ -4,10 +4,10 @@ under DWTWL 2.55 license: https://soundragon.su/license/license.html
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.
Also provides a widget which displays the current date according to the Discordian calendar, with notification of more than 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.

View File

@ -2,8 +2,8 @@
/*
Plugin Name: Discordian Date Function
Plugin URI: https://is3.soundragon.su/discordian-date-function
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.555
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: 2.555
Author: ivan zlax
Author URI: https://is3.soundragon.su/about
*/
@ -14,22 +14,36 @@ function get_ddate($content, $format = "", $originalRequest = null) {
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");
switch ($originalRequest) {
case "get_the_date":
case "get_the_time":
$post = get_post( $format );
$standard_date = getdate (mysql2date( 'U', $post->post_date ));
if (get_option('dtime_convert'))
$standard_date = utcm5_convert(mysql2date( 'U', $post->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 );
$standard_date = getdate (mysql2date( 'U', $comment->comment_date ));
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":
$standard_date = getdate();
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"];
@ -77,6 +91,9 @@ function get_ddate($content, $format = "", $originalRequest = null) {
$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;
@ -92,11 +109,40 @@ function get_ddate($content, $format = "", $originalRequest = null) {
$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() {
@ -117,117 +163,117 @@ 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="";
$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) {
$holyday = " Celebrate Apostle Day, ".$a_holiday[$dseason].".";
$holiday = " Celebrate Apostle Day, ".$a_holiday[$dseason].".";
} elseif ($dday==23) {
$holyday = " Celebrate Synaptyclypse Day, ".$m_holiday[$dseason].".";
$holiday = " Celebrate Synaptyclypse Day, ".$m_holiday[$dseason].".";
} elseif ($dday==27) {
$holyday = " Celebrate Sloth Day, ".$t_holiday[$dseason].".";
$holiday = " Celebrate Sloth Day, ".$t_holiday[$dseason].".";
} elseif ($dday==50) {
$holyday = " Celebrate Flux Day, ".$s_holiday[$dseason].".";
$holiday = " Celebrate Flux Day, ".$s_holiday[$dseason].".";
} elseif ($dday==73) {
$holyday = " Celebrate Eye Day, ".$e_holiday[$dseason].".";
$holiday = " Celebrate Eye Day, ".$e_holiday[$dseason].".";
} elseif ($mon==2 && $mday==29) {
$holyday = " Celebrate St. Tib's Day.";
$holiday = " Celebrate St. Tib's Day.";
} elseif ($dseason==0 && $dday==8) {
$holyday = " Celebrate Death of Emperor Norton.";
$holiday = " Celebrate Death of Emperor Norton.";
} elseif ($dseason==0 && $dday==10) {
$holyday = " Celebrate Backwards/Binary Day.";
$holiday = " Celebrate Backwards/Binary Day.";
} elseif ($dseason==0 && $dday==11) {
$holyday = " Celebrate RAW Day.";
$holiday = " Celebrate RAW Day.";
} elseif ($dseason==0 && $dday==14) {
$holyday = " Celebrate Golden Apple Presentation Day.";
$holiday = " Celebrate Golden Apple Presentation Day.";
} elseif ($dseason==0 && $dday==17) {
$holyday = " Celebrate Joshmas.";
$holiday = " Celebrate Joshmas.";
} elseif ($dseason==0 && $dday==18) {
$holyday = " Celebrate Pat Pineapple Day.";
$holiday = " Celebrate Pat Pineapple Day.";
} elseif ($dseason==0 && $dday==21) {
$holyday = " Celebrate Hug Day.";
$holiday = " Celebrate Hug Day.";
} elseif ($dseason==0 && $dday==26) {
$holyday = " Celebrate Backwards Day (Traditional).";
$holiday = " Celebrate Backwards Day (Traditional).";
} elseif ($dseason==0 && $dday==37) {
$holyday = " Celebrate Aaron Burrs Birthday.";
$holiday = " Celebrate Aaron Burrs Birthday.";
} elseif ($dseason==0 && $dday==49) {
$holyday = " Celebrate The Mary Day.";
$holiday = " Celebrate The Mary Day.";
} elseif ($dseason==0 && $dday==51) {
$holyday = " Celebrate Pet Loving Day.";
$holiday = " Celebrate Pet Loving Day.";
} elseif ($dseason==0 && $dday==69) {
$holyday = " Celebrate Head Chicken/Chicken Head Day.";
$holiday = " Celebrate Head Chicken/Chicken Head Day.";
} elseif ($dseason==0 && $dday==72) {
$holyday = " Celebrate Daytime.";
$holiday = " Celebrate Daytime.";
} elseif ($dseason==1 && $dday==4) {
$holyday = " Celebrate Grover Clevelands Birthday.";
$holiday = " Celebrate Grover Clevelands Birthday.";
} 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) {
$holyday = " Celebrate Fools Day.";
$holiday = " Celebrate Fools Day.";
} elseif ($dseason==1 && $dday==19) {
$holyday = " Celebrate St. John the Blasphemists Day.";
$holiday = " Celebrate St. John the Blasphemists Day.";
} elseif ($dseason==1 && $dday==34) {
$holyday = " Celebrate Omarmas.";
$holiday = " Celebrate Omarmas.";
} elseif ($dseason==1 && $dday==43) {
$holyday = " Celebrate Universal Ordination Day.";
$holiday = " Celebrate Universal Ordination Day.";
} elseif ($dseason==1 && $dday==68) {
$holyday = " Celebrate Mal-2mas.";
$holiday = " Celebrate Mal-2mas.";
} 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) {
$holyday = " Celebrate Towel Day.";
$holiday = " Celebrate Towel Day.";
} elseif ($dseason==2 && $dday==26) {
$holyday = " Celebrate Imaginary Friend/Captain Tuttle Day.";
$holiday = " Celebrate Imaginary Friend/Captain Tuttle Day.";
} elseif ($dseason==2 && $dday==28) {
$holyday = " Celebrate St. Georges Day.";
$holiday = " Celebrate St. Georges Day.";
} elseif ($dseason==2 && $dday==30) {
$holyday = " Celebrate Zoog Day.";
$holiday = " Celebrate Zoog Day.";
} elseif ($dseason==2 && $dday==36) {
$holyday = " Celebrate June 31st for Popes.";
$holiday = " Celebrate June 31st for Popes.";
} elseif ($dseason==2 && $dday==37) {
$holyday = " Celebrate Mid-Years Day.";
$holiday = " Celebrate Mid-Years Day.";
} elseif ($dseason==2 && $dday==40) {
$holyday = " Celebrate X-Day.";
$holiday = " Celebrate X-Day.";
} elseif ($dseason==2 && $dday==55) {
$holyday = " Celebrate Mal-2 Day.";
$holiday = " Celebrate Mal-2 Day.";
} elseif ($dseason==2 && $dday==57) {
$holyday = " Celebrate John Dillinger Day.";
$holiday = " Celebrate John Dillinger Day.";
} elseif ($dseason==3 && $dday==3) {
$holyday = " Celebrate Multiversal Underwear Day.";
$holiday = " Celebrate Multiversal Underwear Day.";
} elseif ($dseason==3 && $dday==18) {
$holyday = " Celebrate Festival of Hanky-Panky Spankies.";
$holiday = " Celebrate Festival of Hanky-Panky Spankies.";
} elseif ($dseason==3 && $dday==33) {
$holyday = " Celebrate Cat Dancing & Pussyfoot Day.";
$holiday = " Celebrate Cat Dancing & Pussyfoot Day.";
} elseif ($dseason==3 && $dday==37) {
$holyday = " Celebrate Mass of Planet Eris/Eristotle.";
$holiday = " Celebrate Mass of Planet Eris/Eristotle.";
} elseif ($dseason==3 && $dday==39) {
$holyday = " Celebrate St. Mammes's Day.";
$holiday = " Celebrate St. Mammes's Day.";
} elseif ($dseason==3 && $dday==41) {
$holyday = " Celebrate Emperor Norton Proclamation Day.";
$holiday = " Celebrate Emperor Norton Proclamation Day.";
} elseif ($dseason==3 && $dday==57) {
$holyday = " Celebrate Shamlicht Kids Club Day.";
$holiday = " Celebrate Shamlicht Kids Club Day.";
} elseif ($dseason==3 && $dday==59) {
$holyday = " Celebrate Gonkulator Day (Gonculator Day).";
$holiday = " Celebrate Gonkulator Day (Gonculator Day).";
} elseif ($dseason==3 && $dday==60) {
$holyday = " Celebrate Mad Hatter Day.";
$holiday = " Celebrate Mad Hatter Day.";
} elseif ($dseason==3 && $dday==66) {
$holyday = " Celebrate Habeas Corpus Remembrance Day.";
$holiday = " Celebrate Habeas Corpus Remembrance Day.";
} elseif ($dseason==4 && $dday==28) {
$holyday = " Celebrate Ek-sen-triks CluborGuild Day.";
$holiday = " Celebrate Ek-sen-triks CluborGuild Day.";
} elseif ($dseason==4 && $dday==36) {
$holyday = " Celebrate Spanking Fest.";
$holiday = " Celebrate Spanking Fest.";
} elseif ($dseason==4 && $dday==37) {
$holyday = " Celebrate 537 Day, sometimes Turkey Day.";
$holiday = " Celebrate 537 Day, sometimes Turkey Day.";
} elseif ($dseason==4 && $dday==40) {
$holyday = " Celebrate Omars Day.";
$holiday = " Celebrate Omars Day.";
} elseif ($dseason==4 && $dday==43) {
$holyday = " Celebrate Day D.";
$holiday = " Celebrate Day D.";
} elseif ($dseason==4 && $dday==46) {
$holyday = " Celebrate Hug Day II.";
$holiday = " Celebrate Hug Day II.";
} elseif ($dseason==4 && $dday==65) {
$holyday = " Celebrate Circlemas.";
$holiday = " Celebrate Circlemas.";
}
extract($args);
@ -237,7 +283,8 @@ class Discordian_Date_Widget extends WP_Widget {
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 get_ddate($content, $format, "now").".";
if ($holyday) echo "<br><b>".$holyday."</b>";
if ($holiday) echo "<br><b>".$holiday."</b>";
if (get_option('dtime_widget')) echo "<br><h1 style=\"font-size: 255%\" id=\"dtime\">5:55:55</h1>";
echo "</div>";
$body2 = ob_get_contents();
ob_end_clean();
@ -269,9 +316,15 @@ class Discordian_Date_Widget extends WP_Widget {
function get_the_ddate_post($content, $format = null) {
return get_ddate($content, $format, "get_the_date"); }
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"); }
function get_the_dtime_comment($content, $format = null) {
return get_ddate($content, $format, "get_comment_time"); }
function register_ddatefunc_widget() {
register_widget( 'Discordian_Date_Widget' );
}
@ -300,10 +353,22 @@ function ddatefunc_admin() {
echo '<h2>'.$settings_name.'</h2>';
if (isset($_POST['save'])) {
update_option('ddatefunc_string', stripslashes($_POST['textfield']));
if (isset($_POST['checkbox']))
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");
if (isset($_POST['dtime_widget_checkbox']))
update_option('dtime_widget', "1");
else
update_option('dtime_widget', "0");
echo '<div id="setting-error-settings_updated" class="updated settings-error"><p><b>'.__('Settings saved.').'</b></p></div>';
}
?>
@ -328,6 +393,9 @@ function ddatefunc_admin() {
<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>
@ -337,14 +405,53 @@ Examples<br>
</td>
</tr>
<tr valign="top">
<th scope="row">Convert all post and comments dates:</th>
<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="checkbox" id="users_can_register" type="checkbox" value="1" <?php if(get_option('ddatefunc_change')==1) { echo 'checked="checked"'; } ?>>
<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>
<tr valign="top">
<th scope="row">Show Erisian time clock in the widget:</th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span>Erisian time in the widget</span>
</legend>
<label for="users_can_register">
<input name="dtime_widget_checkbox" id="users_can_register" type="checkbox" value="1" <?php if(get_option('dtime_widget')==1) { echo 'checked="checked"'; } ?>>
</label>
</fieldset>
</td>
@ -358,32 +465,50 @@ Examples<br>
<?php
}
function ddatefunc_settings( $actions, $plugin_file ) {
if( false === strpos( $plugin_file, basename(__FILE__) ) )
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 );
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');
delete_option('dtime_widget');
}
add_shortcode( 'today_ddate', 'return_today_ddate' );
add_action( 'widgets_init', 'register_ddatefunc_widget' );
add_option( 'ddatefunc_string', '%DD day of %DS, in the yold %DY');
add_option( 'ddatefunc_change', '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' );
function ddatefunc_init() {
wp_enqueue_script('dtime', plugins_url('/dtime.js', __FILE__));
}
add_shortcode('today_ddate', 'return_today_ddate');
add_action('widgets_init', 'register_ddatefunc_widget');
add_option('ddatefunc_string', '%DD day of %DS, in the yold %DY');
add_option('ddatefunc_change', '1');
add_option('dtimefunc_change', '1');
add_option('dtime_convert', '1');
add_option('dtime_widget', '1');
add_filter('plugin_action_links', 'ddatefunc_settings', 10, 2);
add_action('admin_menu', 'ddatefunc_add_admin');
if (get_option('ddatefunc_change')) {
add_filter('get_the_date','get_the_ddate_post');
add_filter('get_comment_date','get_the_ddate_comment');
}
if (get_option('dtimefunc_change')) {
add_filter('get_the_time','get_the_dtime_post');
add_filter('get_comment_time','get_the_dtime_comment');
}
if (get_option('dtime_widget'))
add_action('wp_enqueue_scripts','ddatefunc_init');
if (function_exists('register_uninstall_hook'))
register_uninstall_hook(__FILE__, 'ddatefunc_deinstall');

197
dtime.js Normal file
View File

@ -0,0 +1,197 @@
/*
* https://gitlab.com/zlax/dtime-js
* based on:
*
* REAL-TIME CLOCK (c) 2009 por Tiago Madeira (http://tiagomadeira.com/)
* Idealizado por Santaum (http://santaum.org/)
*
* All Hail Eris!
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function az(x) {
if (x < 10)
return "0"+x;
return x;
}
function ly(Y) {
return (Y % 4 == 0 && !(Y % 100 == 0 && Y % 400 != 0));
}
function dy(D, M, Y) {
var dm = Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if (ly(Y)) {
dm[1] = 29;
}
var d = D;
for (var i = 0; i < M-1; i++) {
d+= dm[i]
}
return d;
}
function dtime(gregorianDate,resultar="default") {
// Easter Island Winter Time Zone offset (-5*60*60*1000)
var date = new Date(gregorianDate.getTime()-18000000);
var D = date.getUTCDate();
var M = date.getUTCMonth()+1;
var Y = date.getUTCFullYear();
var d = dy(D, M, Y);
var sttiby = 0;
if (ly(Y)) {
if (d == 60) {
sttiby = 1;
} else if (d > 60) {
d--;
}
}
M = Math.floor(d/73);
D = d % 73;
if (D == 0) {
M--;
D = 73;
}
var ddaystr = dday(D,M,d,sttiby);
var seasonnum = M+1;
switch (M) {
case 0:
M = "Chaos";
break;
case 1:
M = "Discord";
break;
case 2:
M = "Confusion";
break;
case 3:
M = "Bureaucracy";
break;
case 4:
M = "Aftermath";
break;
default:
M = "fnord";
}
Y+= 1166;
if (sttiby) {
var ddatestr = "St. Tib's Day, "+Y+" YOLD";
} else {
var ddatestr = M+" "+az(D)+", "+Y+" YOLD";
}
var h = date.getUTCHours();
var m = date.getUTCMinutes();
var s = date.getUTCSeconds();
var ms = date.getUTCMilliseconds();
var e = h*3600000+m*60000+s*1000+ms;
var ds = Math.round(e/864);
h = Math.floor(ds/10000);
ds%= 10000;
m = Math.floor(ds/100);
ds%= 100;
s = ds;
switch (resultar) {
case "shortsec":
return [ddatestr, h+":"+az(m), ":"+az(s), ddaystr];
break;
case "ddatetime":
return [Y, seasonnum, D, h, m, s];
break;
case "dtimeonly":
return h+":"+az(m)+":"+az(s);
break;
default:
var dtimestr = h+":"+az(m)+":"+az(s);
return [ddatestr, dtimestr, ddaystr];
break;
}
}
function dday(day, season, yearday, sttiby) {
var day_list = ["Sweetmorn", "Boomtime", "Pungenday", "Prickle-Prickle", "Setting Orange"];
var dweekday = day_list[((yearday-1)%5)];
var ddaystr = dweekday;
var a_holiday = ["Mungday", "Mojoday", "Syaday", "Zaraday", "Maladay"];
var s_holiday = ["Chaoflux", "Discoflux", "Confuflux", "Bureflux", "Afflux"];
var m_holiday = ["Chaomas", "Discomas", "Confumas", "Buremas", "Afmas"];
var t_holiday = ["Chaosloth", "Discosloth", "Confusloth", "Buresloth", "Afsloth"];
var e_holiday = ["Mungeye", "Mojeye", "Syadeye", "Zareye", "Maleye"];
if (sttiby) ddaystr = "Celebrate St. Tib's Day";
else if (day == 5) ddaystr += ", Celebrate " + a_holiday[season];
else if (day == 23) ddaystr += ", Celebrate " + m_holiday[season];
else if (day == 27) ddaystr += ", Celebrate " + t_holiday[season];
else if (day == 50) ddaystr += ", Celebrate " + s_holiday[season];
else if (day == 73) ddaystr += ", Celebrate " + e_holiday[season];
else if (season == 0 && day == 8) ddaystr += ", Celebrate Death of Emperor Norton";
else if (season == 0 && day == 10) ddaystr += ", Celebrate Backwards/Binary Day";
else if (season == 0 && day == 11) ddaystr += ", Celebrate RAW Day";
else if (season == 0 && day == 14) ddaystr += ", Celebrate Golden Apple Presentation Day";
else if (season == 0 && day == 17) ddaystr += ", Celebrate Joshmas";
else if (season == 0 && day == 18) ddaystr += ", Celebrate Pat Pineapple Day";
else if (season == 0 && day == 21) ddaystr += ", Celebrate Hug Day";
else if (season == 0 && day == 26) ddaystr += ", Celebrate Backwards Day, Traditional";
else if (season == 0 && day == 37) ddaystr += ", Celebrate Aaron Burr’s Birthday";
else if (season == 0 && day == 51) ddaystr += ", Celebrate Pet Loving Day";
else if (season == 0 && day == 69) ddaystr += ", Celebrate Chicken Head Day";
else if (season == 0 && day == 72) ddaystr += ", Celebrate Daytime";
else if (season == 1 && day == 4) ddaystr += ", Celebrate Grover Cleveland’s Birthday";
else if (season == 1 && day == 11) ddaystr += ", Celebrate Discordians for Jesus/Love Your Neighbor Day";
else if (season == 1 && day == 18) ddaystr += ", Celebrate Fool’s Day";
else if (season == 1 && day == 19) ddaystr += ", Celebrate St. John the Blasphemist’s Day";
else if (season == 1 && day == 34) ddaystr += ", Celebrate Omarmas";
else if (season == 1 && day == 43) ddaystr += ", Celebrate Universal Ordination Day";
else if (season == 1 && day == 68) ddaystr += ", Celebrate Mal-2mas";
else if (season == 1 && day == 70) ddaystr += ", Celebrate Jake Day Jr./Day of the Elppin";
else if (season == 1 && day == 72) ddaystr += ", Celebrate Towel Day";
else if (season == 2 && day == 26) ddaystr += ", Celebrate Imaginary Friend Day";
else if (season == 2 && day == 28) ddaystr += ", Celebrate St. George’s Day";
else if (season == 2 && day == 30) ddaystr += ", Celebrate Zoog Day";
else if (season == 2 && day == 37) ddaystr += ", Celebrate Mid-Year’s Day";
else if (season == 2 && day == 40) ddaystr += ", Celebrate X-Day";
else if (season == 2 && day == 55) ddaystr += ", Celebrate Mal-2 Day";
else if (season == 2 && day == 57) ddaystr += ", Celebrate John Dillinger Day";
else if (season == 3 && day == 3) ddaystr += ", Celebrate Multiversal Underwear Day";
else if (season == 3 && day == 10) ddaystr += ", Celebrate St. Cecil Day";
else if (season == 3 && day == 18) ddaystr += ", Celebrate Spanking Fest";
else if (season == 3 && day == 33) ddaystr += ", Celebrate Pussyfoot Day";
else if (season == 3 && day == 37) ddaystr += ", Celebrate Mass of Planet Eris/Mass of Eristotle";
else if (season == 3 && day == 39) ddaystr += ", Celebrate St. Mammes's Day";
else if (season == 3 && day == 41) ddaystr += ", Celebrate Emperor Norton Proclamation Day";
else if (season == 3 && day == 55) ddaystr += ", Celebrate Feast of St. John Blasphemist";
else if (season == 3 && day == 57) ddaystr += ", Celebrate Shamlicht Kids Club Day";
else if (season == 3 && day == 59) ddaystr += ", Celebrate Gonculator Day";
else if (season == 3 && day == 60) ddaystr += ", Celebrate Mad Hatter Day";
else if (season == 3 && day == 66) ddaystr += ", Celebrate Habeas Corpus Remembrance Day";
else if (season == 4 && day == 17) ddaystr += ", Celebrate Pope Night";
else if (season == 4 && day == 28) ddaystr += ", Celebrate Ek-sen-triks CluborGuild Day";
else if (season == 4 && day == 37) ddaystr += ", Celebrate 537 Day";
else if (season == 4 && day == 40) ddaystr += ", Celebrate Omar Day";
else if (season == 4 && day == 43) ddaystr += ", Celebrate Day D";
else if (season == 4 && day == 46) ddaystr += ", Celebrate Hug Day II";
else if (season == 4 && day == 56) ddaystr += ", Celebrate Agnostica";
else if (season == 4 && day == 65) ddaystr += ", Celebrate Circlemas";
return ddaystr;
}
function go() {
document.getElementById("dtime").innerHTML = dtime(new Date(), "dtimeonly");
}
window.onload = function() {
go();
// 1 discordian decimal second = 864 christian milliseconds
setInterval(go, 864);
}

View File

@ -1,21 +1,21 @@
=== Discordian Date Function ===
Contributors: zlaxyi
Donate link: https://is3.soundragon.su/discordian-date-function
Tags: date, discordian, erisian, widget, eris, discordia, calendar
Tags: date, time, discordian, erisian, widget, eris, discordia, calendar, ddate, dtime
Requires at least: 2.0
Tested up to: 5.3.2
Tested up to: 6.0
Stable tag: trunk
License: DWTWL 2.55
License URI: https://soundragon.su/license/license.html
This plugin provides Erisian (Discordian) dates in Wordpress.
Also provides shortcode and widget which displays the current date according to the Discordian calendar, with notification of 70 holydays.
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 more than 70 holidays and clock.
== Description ==
This plugin allows WordPress to easily show customizable 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 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.
The Discordian Date Function plugin provides a widget which will display the current Erisian time and 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.
@ -41,6 +41,16 @@ Feel free to ask any questions about this plugin at the [Discordian Date Functio
== Changelog ==
= 2.555 =
*Release Date - 52nd day of Confusion, 3188*
* Add optional Erisian time clock to the widget.
= 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*
@ -61,5 +71,5 @@ Feel free to ask any questions about this plugin at the [Discordian Date Functio
== Upgrade Notice ==
= 0.555 =
= 2.555 =
This version is actual.