Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 21d5c0d3a3 | |||
| 0697c2392a | |||
| 235b11259a | |||
| ea64a55218 | |||
| 0832e1504e | |||
| e6aa5ad57b | |||
| 7a955031d4 |
215
ddatefunc.php
215
ddatefunc.php
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Discordian Date Function
|
||||
Plugin URI: https://is3.soundragon.su/discordian-date-function
|
||||
Plugin URI: https://is3.ussr.win/discordian-date-function
|
||||
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.5
|
||||
Version: 3.5
|
||||
Author: ivan zlax
|
||||
Author URI: https://is3.soundragon.su/about
|
||||
Author URI: https://is3.ussr.win/about
|
||||
*/
|
||||
|
||||
function get_ddate($content, $format = "", $originalRequest = null) {
|
||||
@@ -21,7 +21,7 @@ function get_ddate($content, $format = "", $originalRequest = null) {
|
||||
case "get_the_date":
|
||||
case "get_the_time":
|
||||
$post = get_post( $format );
|
||||
if ( get_option('dtime_convert') == '1' )
|
||||
if (get_option('dtime_convert'))
|
||||
$standard_date = utcm5_convert(mysql2date( 'U', $post->post_date_gmt ));
|
||||
else
|
||||
$standard_date = getdate (mysql2date( 'U', $post->post_date ));
|
||||
@@ -29,13 +29,13 @@ function get_ddate($content, $format = "", $originalRequest = null) {
|
||||
case "get_comment_date":
|
||||
case "get_comment_time":
|
||||
$comment = get_comment( $format );
|
||||
if ( get_option('dtime_convert') == '1' )
|
||||
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') == '1' )
|
||||
if (get_option('dtime_convert'))
|
||||
$standard_date = utcm5_convert(getdate()[0]);
|
||||
else
|
||||
$standard_date = getdate();
|
||||
@@ -45,6 +45,7 @@ function get_ddate($content, $format = "", $originalRequest = null) {
|
||||
if ($originalRequest == "get_the_time") return dtime_convert($standard_date);
|
||||
|
||||
$dyear=$standard_date["year"]+1166;
|
||||
$eyear=$dyear-3000;
|
||||
$gyear=$standard_date["year"];
|
||||
$yday=$standard_date["yday"];
|
||||
// Check Tib's day according to Gregorian calendar
|
||||
@@ -77,8 +78,14 @@ function get_ddate($content, $format = "", $originalRequest = null) {
|
||||
$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;
|
||||
|
||||
if (get_option('ee_widget')) {
|
||||
$ddate=$dweekday.", the ".$dday." day of ".$name_season.", in the year ".$eyear." of the erisian era";
|
||||
if (isset($sttib)) $ddate=$sttib." day, in the year ".$eyear." of the erisian era";
|
||||
} else {
|
||||
$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';
|
||||
@@ -94,6 +101,8 @@ function get_ddate($content, $format = "", $originalRequest = null) {
|
||||
$patterns[10] = '%DT';
|
||||
$patterns[11] = '%CT';
|
||||
$patterns[12] = '%UT';
|
||||
$patterns[13] = '%EY';
|
||||
$patterns[14] = '%ES';
|
||||
$replacements = array();
|
||||
$replacements[0] = $dyear;
|
||||
$replacements[1] = $name_season;
|
||||
@@ -112,6 +121,8 @@ function get_ddate($content, $format = "", $originalRequest = null) {
|
||||
$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];
|
||||
$replacements[13] = $eyear;
|
||||
$replacements[14] = $dseason + 1;
|
||||
$ddate = str_replace($patterns, $replacements, get_option('ddatefunc_string'));
|
||||
}
|
||||
return $ddate;
|
||||
@@ -144,11 +155,10 @@ function utcm5_convert($standard_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.');
|
||||
function __construct() {
|
||||
$widget_ops = array('classname' => 'discordian_date_func', 'name' => 'Discordian Date Widget', '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);
|
||||
parent::__construct( 'Discordian_Date_Widget', 'Discordian Date Widget', $widget_ops );
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
@@ -195,25 +205,23 @@ class Discordian_Date_Widget extends WP_Widget {
|
||||
} elseif ($dseason==0 && $dday==21) {
|
||||
$holiday = " Celebrate Hug Day.";
|
||||
} elseif ($dseason==0 && $dday==26) {
|
||||
$holiday = " Celebrate Backwards Day (Traditional).";
|
||||
$holiday = " Celebrate yaD sdrawkcaB, Traditional.";
|
||||
} elseif ($dseason==0 && $dday==37) {
|
||||
$holiday = " Celebrate Aaron Burr’s Birthday.";
|
||||
} elseif ($dseason==0 && $dday==49) {
|
||||
$holiday = " Celebrate The Mary Day.";
|
||||
$holiday = " Celebrate Aaron Burr's Birthday.";
|
||||
} elseif ($dseason==0 && $dday==51) {
|
||||
$holiday = " Celebrate Pet Loving Day.";
|
||||
} elseif ($dseason==0 && $dday==69) {
|
||||
$holiday = " Celebrate Head Chicken/Chicken Head Day.";
|
||||
$holiday = " Celebrate Chicken Head Day.";
|
||||
} elseif ($dseason==0 && $dday==72) {
|
||||
$holiday = " Celebrate Daytime.";
|
||||
} elseif ($dseason==1 && $dday==4) {
|
||||
$holiday = " Celebrate Grover Cleveland’s Birthday.";
|
||||
$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.";
|
||||
$holiday = " Celebrate Fool's Day.";
|
||||
} elseif ($dseason==1 && $dday==19) {
|
||||
$holiday = " Celebrate St. John the Blasphemist’s Day.";
|
||||
$holiday = " Celebrate St. John the Blasphemist's Day.";
|
||||
} elseif ($dseason==1 && $dday==34) {
|
||||
$holiday = " Celebrate Omarmas.";
|
||||
} elseif ($dseason==1 && $dday==43) {
|
||||
@@ -221,19 +229,17 @@ class Discordian_Date_Widget extends WP_Widget {
|
||||
} elseif ($dseason==1 && $dday==68) {
|
||||
$holiday = " Celebrate Mal-2mas.";
|
||||
} elseif ($dseason==1 && $dday==70) {
|
||||
$holiday = " Celebrate Jake Day Jr. (DJ)/Day of the Elppin.";
|
||||
$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/Captain Tuttle Day.";
|
||||
$holiday = " Celebrate Imaginary Friend.";
|
||||
} elseif ($dseason==2 && $dday==28) {
|
||||
$holiday = " Celebrate St. George’s Day.";
|
||||
$holiday = " Celebrate St. George's 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) {
|
||||
$holiday = " Celebrate Mid-Year’s Day.";
|
||||
$holiday = " Celebrate Mid-Year's Day.";
|
||||
} elseif ($dseason==2 && $dday==40) {
|
||||
$holiday = " Celebrate X-Day.";
|
||||
} elseif ($dseason==2 && $dday==55) {
|
||||
@@ -242,47 +248,61 @@ class Discordian_Date_Widget extends WP_Widget {
|
||||
$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 Festival of Hanky-Panky Spankies.";
|
||||
$holiday = " Celebrate Spanking Fest.";
|
||||
} elseif ($dseason==3 && $dday==33) {
|
||||
$holiday = " Celebrate Cat Dancing & Pussyfoot Day.";
|
||||
$holiday = " Celebrate Pussyfoot Day.";
|
||||
} elseif ($dseason==3 && $dday==37) {
|
||||
$holiday = " Celebrate Mass of Planet Eris/Eristotle.";
|
||||
$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 Gonkulator Day (Gonculator Day).";
|
||||
$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==36) {
|
||||
$holiday = " Celebrate Spanking Fest.";
|
||||
} elseif ($dseason==4 && $dday==37) {
|
||||
$holiday = " Celebrate 537 Day, sometimes Turkey Day.";
|
||||
$holiday = " Celebrate 537 Day.";
|
||||
} elseif ($dseason==4 && $dday==40) {
|
||||
$holiday = " Celebrate Omar’s Day.";
|
||||
$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']);
|
||||
$body = apply_filters('widget_text', isset($instance['body']));
|
||||
|
||||
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").".";
|
||||
echo "<div class=\"discordian_date_func\" style=\"width:100%;text-align:center;font-size:18px;line-height:36px;padding-top:40px;padding-bottom:40px;\">";
|
||||
if (get_option('dtime_widget')) {
|
||||
if (get_option('dtime_convert'))
|
||||
echo "<script type=\"text/javascript\">var eastertime = true;</script>";
|
||||
if (get_option('dtime_widgetsec'))
|
||||
echo "<script type=\"text/javascript\">var widgetsec = true;</script>";
|
||||
echo "<h1 style=\"font-size: 255%\" id=\"dtime\"></h1>";
|
||||
}
|
||||
echo "Today is ";
|
||||
echo get_ddate(isset($content), isset($format), "now").".";
|
||||
if ($holiday) echo "<br><b>".$holiday."</b>";
|
||||
echo "</div>";
|
||||
$body2 = ob_get_contents();
|
||||
@@ -299,7 +319,7 @@ class Discordian_Date_Widget extends WP_Widget {
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
$title = $instance['title'];
|
||||
$title = isset($instance['title']);
|
||||
$title_id = $this->get_field_id('title');
|
||||
$title_name = $this->get_field_name('title');
|
||||
?>
|
||||
@@ -364,6 +384,18 @@ function ddatefunc_admin() {
|
||||
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");
|
||||
if (isset($_POST['dtime_widgetsec_checkbox']))
|
||||
update_option('dtime_widgetsec', "1");
|
||||
else
|
||||
update_option('dtime_widgetsec', "0");
|
||||
if (isset($_POST['ee_widget_checkbox']))
|
||||
update_option('ee_widget', "1");
|
||||
else
|
||||
update_option('ee_widget', "0");
|
||||
echo '<div id="setting-error-settings_updated" class="updated settings-error"><p><b>'.__('Settings saved.').'</b></p></div>';
|
||||
}
|
||||
?>
|
||||
@@ -378,8 +410,10 @@ function ddatefunc_admin() {
|
||||
<tr valign="top">
|
||||
<th scope="row">Legend:</th>
|
||||
<td>
|
||||
<b>%EY</b> - Erisian era year (example: 180)<br>
|
||||
<b>%DY</b> - Discordian yold (example: 3180)<br>
|
||||
<b>%DS</b> - Erisian season name (example: Chaos)<br>
|
||||
<b>%DS</b> - Discordian season name (example: Chaos)<br>
|
||||
<b>%ES</b> - Erisian season number (example: 1)<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>
|
||||
@@ -388,15 +422,17 @@ 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>
|
||||
<b>%DT</b> - Erisian (decimal) time (example: 5:67)<br>
|
||||
<b>%CT</b> - Christian time (example: 18:37)<br>
|
||||
<b>%UT</b> - Unix time (example: 1388947033)<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>
|
||||
<b>%EY.%ES.%DC %DT ee (unittime: %UT)</b> <i>(returns: 180.1.5 5:67 ee (unixtime: 1388947033))</i></br>
|
||||
<br>
|
||||
<b>%DC %DS, %DY (%GN.%GN.%GY)</b><br> returns:<br><b>5 Chaos, 3180 (5.1.2014)</br>
|
||||
<b>%DW, the %DD day of %DS, in the yold %DY</b> <i>(returns: Setting Orange, the 5th day of Chaos, in the yold 3180)</i><br>
|
||||
<br>
|
||||
<b>%DC %DS, %DY (%GN.%GN.%GY)</b> <i>(returns: 5 Chaos, 3180 (5.1.2014))</i></br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
@@ -426,7 +462,7 @@ Examples<br>
|
||||
</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>
|
||||
<th scope="row">Use Erisian start of the day - <a href="https://discordia.fandom.com/wiki/Erisian_Time">starts 5 Christian hours later than the day in London</a>:</th>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
@@ -438,6 +474,45 @@ Examples<br>
|
||||
</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>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row">Display seconds in erisian time clock in the widget:</th>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
<span>Seconds in the widget</span>
|
||||
</legend>
|
||||
<label for="users_can_register">
|
||||
<input name="dtime_widgetsec_checkbox" id="users_can_register" type="checkbox" value="1" <?php if(get_option('dtime_widgetsec')==1) { echo 'checked="checked"'; } ?>>
|
||||
</label>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row">Use the erisian era in the widget:</th>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
<span>Erisian era</span>
|
||||
</legend>
|
||||
<label for="users_can_register">
|
||||
<input name="ee_widget_checkbox" id="users_can_register" type="checkbox" value="1" <?php if(get_option('ee_widget')==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'); ?>" />
|
||||
@@ -447,12 +522,12 @@ 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;
|
||||
}
|
||||
|
||||
@@ -461,27 +536,39 @@ function ddatefunc_deinstall() {
|
||||
delete_option('ddatefunc_change');
|
||||
delete_option('dtimefunc_change');
|
||||
delete_option('dtime_convert');
|
||||
delete_option('dtime_widget');
|
||||
delete_option('dtime_widgetsec');
|
||||
delete_option('ee_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_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' );
|
||||
function ddatefunc_init() {
|
||||
wp_enqueue_script('dtime', plugins_url('/dtime.js', __FILE__));
|
||||
}
|
||||
|
||||
if ( get_option('dtimefunc_change') == '1' ) {
|
||||
add_filter( 'get_the_time','get_the_dtime_post' );
|
||||
add_filter( 'get_comment_time','get_the_dtime_comment' );
|
||||
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_option('dtime_widgetsec', '1');
|
||||
add_option('ee_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');
|
||||
|
||||
54
dtime.js
Normal file
54
dtime.js
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* based on:
|
||||
* https://gitlab.com/zlax/dtime-js
|
||||
*/
|
||||
|
||||
function addZero(numeral) {
|
||||
if (numeral < 10)
|
||||
return "0"+numeral;
|
||||
return numeral;
|
||||
}
|
||||
|
||||
function dtime(gregorianDate,resultar="default") {
|
||||
if (typeof eastertime != "undefined") {
|
||||
// Easter Island Winter Time Zone offset (-5*60*60*1000)
|
||||
var date = new Date(gregorianDate.getTime()-18000000);
|
||||
var christianMSDay = date.valueOf() % 86400000;
|
||||
} else {
|
||||
// Christian Time Zone calculation
|
||||
var date = new Date(gregorianDate.getTime());
|
||||
var h = date.getHours();
|
||||
var m = date.getMinutes();
|
||||
var s = date.getSeconds();
|
||||
var ms = date.getMilliseconds();
|
||||
var christianMSDay = h*3600000+m*60000+s*1000+ms;
|
||||
}
|
||||
var erisianSecondsDay = (christianMSDay/864);
|
||||
var hour = Math.floor(erisianSecondsDay/10000);
|
||||
erisianSecondsDay %= 10000;
|
||||
var minute = Math.floor(erisianSecondsDay/100);
|
||||
erisianSecondsDay %= 100;
|
||||
var second = Math.floor(erisianSecondsDay);
|
||||
|
||||
switch (resultar) {
|
||||
case "seconds":
|
||||
return hour+":"+addZero(minute)+":"+addZero(second);
|
||||
break;
|
||||
default:
|
||||
return hour+":"+addZero(minute);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function go() {
|
||||
if (typeof widgetsec != "undefined")
|
||||
document.getElementById("dtime").innerHTML = dtime(new Date(), "seconds");
|
||||
else
|
||||
document.getElementById("dtime").innerHTML = dtime(new Date());
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
go();
|
||||
// 1 discordian decimal second = 864 christian milliseconds
|
||||
setInterval(go, 864);
|
||||
}
|
||||
36
readme.txt
36
readme.txt
@@ -1,23 +1,23 @@
|
||||
=== Discordian Date Function ===
|
||||
Contributors: zlaxyi
|
||||
Donate link: https://is3.soundragon.su/discordian-date-function
|
||||
Tags: date, time, discordian, erisian, widget, eris, discordia, calendar
|
||||
Donate link: https://is3.ussr.win/discordian-date-function
|
||||
Tags: date, time, discordian, erisian, widget, eris, discordia, calendar, ddate, dtime
|
||||
Requires at least: 2.0
|
||||
Tested up to: 5.4
|
||||
Tested up to: 7.0
|
||||
Stable tag: trunk
|
||||
License: DWTWL 2.55
|
||||
License URI: https://soundragon.su/license/license.html
|
||||
|
||||
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.
|
||||
Also provides shortcode and widget which displays the clock, current date according to the Discordian calendar, with notification of more than 70 holidays.
|
||||
|
||||
== Description ==
|
||||
|
||||
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.
|
||||
Also you can add the shortcode [today_ddate] in posts or pages for show the Discordian date of today.
|
||||
|
||||
== Installation ==
|
||||
|
||||
@@ -33,7 +33,7 @@ And you can add the shortcode [today_ddate] in posts or pages for show the Disco
|
||||
|
||||
= Do you have any questions? =
|
||||
|
||||
Feel free to ask any questions about this plugin at the [Discordian Date Function plugin web page](https://is3.soundragon.su/discordian-date-function/).
|
||||
Feel free to ask any questions about this plugin at the [Discordian Date Function plugin web page](https://is3.ussr.win/discordian-date-function/).
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
@@ -41,10 +41,28 @@ Feel free to ask any questions about this plugin at the [Discordian Date Functio
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 3.5 =
|
||||
*Release Date - 32th day of Chaos 3192*
|
||||
|
||||
* Add Erisian era year
|
||||
* php8 and wp7 fixes
|
||||
|
||||
= 2.5555 =
|
||||
*Release Date - 17th day of Confusion 3190*
|
||||
|
||||
* Customisable seconds in the widget
|
||||
* Specification of holidays
|
||||
* Minor fixes
|
||||
|
||||
= 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
|
||||
* 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*
|
||||
@@ -66,5 +84,5 @@ Feel free to ask any questions about this plugin at the [Discordian Date Functio
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 2.5 =
|
||||
= 2.5555 =
|
||||
This version is actual.
|
||||
|
||||
Reference in New Issue
Block a user