@@ -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 customizable Discordian dates. Also, this plugin provides shortcode and widget used to display the current erisian date with notification of 70 holy days. 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 holi days. Based on the Discordian Date plugin by Dan Johnson.
Version: 0 .555
Version: 2 .555
Author: ivan zlax
Author: ivan zlax
Author URI: https://is3.soundragon.su/about
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
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 );
if ( get_option ( 'dtime_convert' ))
$standard_date = utcm5_convert ( mysql2date ( 'U' , $post -> post_date_gmt ));
else
$standard_date = getdate ( mysql2date ( 'U' , $post -> post_date ));
$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 );
if ( get_option ( 'dtime_convert' ))
$standard_date = utcm5_convert ( mysql2date ( 'U' , $comment -> comment_date_gmt ));
else
$standard_date = getdate ( mysql2date ( 'U' , $comment -> comment_date ));
$standard_date = getdate ( mysql2date ( 'U' , $comment -> comment_date ));
break ;
break ;
case " now " :
case " now " :
if ( get_option ( 'dtime_convert' ))
$standard_date = utcm5_convert ( getdate ()[ 0 ]);
else
$standard_date = getdate ();
$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 " ];
$gyear = $standard_date [ " year " ];
$yday = $standard_date [ " yday " ];
$yday = $standard_date [ " yday " ];
@@ -77,6 +91,9 @@ function get_ddate($content, $format = "", $originalRequest = null) {
$patterns [ 7 ] = '%GN' ;
$patterns [ 7 ] = '%GN' ;
$patterns [ 8 ] = '%GD' ;
$patterns [ 8 ] = '%GD' ;
$patterns [ 9 ] = '%GW' ;
$patterns [ 9 ] = '%GW' ;
$patterns [ 10 ] = '%DT' ;
$patterns [ 11 ] = '%CT' ;
$patterns [ 12 ] = '%UT' ;
$replacements = array ();
$replacements = array ();
$replacements [ 0 ] = $dyear ;
$replacements [ 0 ] = $dyear ;
$replacements [ 1 ] = $name_season ;
$replacements [ 1 ] = $name_season ;
@@ -92,11 +109,40 @@ function get_ddate($content, $format = "", $originalRequest = null) {
$replacements [ 7 ] = $standard_date [ " mon " ];
$replacements [ 7 ] = $standard_date [ " mon " ];
$replacements [ 8 ] = $standard_date [ " mday " ];
$replacements [ 8 ] = $standard_date [ " mday " ];
$replacements [ 9 ] = $standard_date [ " weekday " ];
$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' ));
$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 () {
@@ -117,117 +163,119 @@ class Discordian_Date_Widget extends WP_Widget {
$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 " );
$m_holy day = array ( " Chaomas " , " Discomas " , " Confumas " , " Buremas " , " Afmas " );
$m_holi day = array ( " Chaomas " , " Discomas " , " Confumas " , " Buremas " , " Afmas " );
$t_holy day = array ( " Chaosloth " , " Discosloth " , " Confusloth " , " Buresloth " , " Afsloth " );
$t_holi day = array ( " Chaosloth " , " Discosloth " , " Confusloth " , " Buresloth " , " Afsloth " );
$e_holy day = array ( " Mungeye " , " Mojeye " , " Syadeye " , " Zareye " , " Maleye " );
$e_holi day = array ( " Mungeye " , " Mojeye " , " Syadeye " , " Zareye " , " Maleye " );
$holy day = " " ;
$holi day = " " ;
if ( $dday == 5 ) {
if ( $dday == 5 ) {
$holy day = " Celebrate Apostle Day, " . $a_holiday [ $dseason ] . " . " ;
$holi day = " Celebrate Apostle Day, " . $a_holiday [ $dseason ] . " . " ;
} elseif ( $dday == 23 ) {
} elseif ( $dday == 23 ) {
$holy day = " Celebrate Synaptyclypse Day, " . $m_holiday [ $dseason ] . " . " ;
$holi day = " Celebrate Synaptyclypse Day, " . $m_holiday [ $dseason ] . " . " ;
} elseif ( $dday == 27 ) {
} elseif ( $dday == 27 ) {
$holy day = " Celebrate Sloth Day, " . $t_holiday [ $dseason ] . " . " ;
$holi day = " Celebrate Sloth Day, " . $t_holiday [ $dseason ] . " . " ;
} elseif ( $dday == 50 ) {
} elseif ( $dday == 50 ) {
$holy day = " Celebrate Flux Day, " . $s_holiday [ $dseason ] . " . " ;
$holi day = " Celebrate Flux Day, " . $s_holiday [ $dseason ] . " . " ;
} elseif ( $dday == 73 ) {
} elseif ( $dday == 73 ) {
$holy day = " Celebrate Eye Day, " . $e_holiday [ $dseason ] . " . " ;
$holi day = " Celebrate Eye Day, " . $e_holiday [ $dseason ] . " . " ;
} elseif ( $mon == 2 && $mday == 29 ) {
} elseif ( $mon == 2 && $mday == 29 ) {
$holy day = " Celebrate St. Tib's Day. " ;
$holi day = " Celebrate St. Tib's Day. " ;
} elseif ( $dseason == 0 && $dday == 8 ) {
} elseif ( $dseason == 0 && $dday == 8 ) {
$holy day = " Celebrate Death of Emperor Norton. " ;
$holi day = " Celebrate Death of Emperor Norton. " ;
} elseif ( $dseason == 0 && $dday == 10 ) {
} elseif ( $dseason == 0 && $dday == 10 ) {
$holy day = " Celebrate Backwards/Binary Day. " ;
$holi day = " Celebrate Backwards/Binary Day. " ;
} elseif ( $dseason == 0 && $dday == 11 ) {
} elseif ( $dseason == 0 && $dday == 11 ) {
$holy day = " Celebrate RAW Day. " ;
$holi day = " Celebrate RAW Day. " ;
} elseif ( $dseason == 0 && $dday == 14 ) {
} elseif ( $dseason == 0 && $dday == 14 ) {
$holy day = " Celebrate Golden Apple Presentation Day. " ;
$holi day = " Celebrate Golden Apple Presentation Day. " ;
} elseif ( $dseason == 0 && $dday == 17 ) {
} elseif ( $dseason == 0 && $dday == 17 ) {
$holy day = " Celebrate Joshmas. " ;
$holi day = " Celebrate Joshmas. " ;
} elseif ( $dseason == 0 && $dday == 18 ) {
} elseif ( $dseason == 0 && $dday == 18 ) {
$holy day = " Celebrate Pat Pineapple Day. " ;
$holi day = " Celebrate Pat Pineapple Day. " ;
} elseif ( $dseason == 0 && $dday == 21 ) {
} elseif ( $dseason == 0 && $dday == 21 ) {
$holy day = " Celebrate Hug Day. " ;
$holi day = " Celebrate Hug Day. " ;
} elseif ( $dseason == 0 && $dday == 26 ) {
} elseif ( $dseason == 0 && $dday == 26 ) {
$holy day = " Celebrate Backwards Day ( Traditional) . " ;
$holi day = " Celebrate yaD sdrawkcaB, Traditional. " ;
} elseif ( $dseason == 0 && $dday == 37 ) {
} elseif ( $dseason == 0 && $dday == 37 ) {
$holy day = " Celebrate Aaron Burr’ s Birthday. " ;
$holi day = " Celebrate Aaron Burr' s Birthday. " ;
} elseif ( $dseason == 0 && $dday == 49 ) {
$holyday = " Celebrate The Mary Day. " ;
} elseif ( $dseason == 0 && $dday == 51 ) {
} elseif ( $dseason == 0 && $dday == 51 ) {
$holy day = " Celebrate Pet Loving Day. " ;
$holi day = " Celebrate Pet Loving Day. " ;
} elseif ( $dseason == 0 && $dday == 69 ) {
} elseif ( $dseason == 0 && $dday == 69 ) {
$holy day = " Celebrate Head Chicken/ Chicken Head Day. " ;
$holi day = " Celebrate Chicken Head Day. " ;
} elseif ( $dseason == 0 && $dday == 72 ) {
} elseif ( $dseason == 0 && $dday == 72 ) {
$holy day = " Celebrate Daytime. " ;
$holi day = " Celebrate Daytime. " ;
} elseif ( $dseason == 1 && $dday == 4 ) {
} elseif ( $dseason == 1 && $dday == 4 ) {
$holy day = " Celebrate Grover Cleveland’ s Birthday. " ;
$holi day = " Celebrate Grover Cleveland' s Birthday. " ;
} elseif ( $dseason == 1 && $dday == 11 ) {
} elseif ( $dseason == 1 && $dday == 11 ) {
$holy day = " Celebrate Discordians for Jesus/Love Your Neighbor Day. " ;
$holi day = " Celebrate Discordians for Jesus/Love Your Neighbor Day. " ;
} elseif ( $dseason == 1 && $dday == 18 ) {
} elseif ( $dseason == 1 && $dday == 18 ) {
$holy day = " Celebrate Fool’ s Day. " ;
$holi day = " Celebrate Fool' s Day. " ;
} elseif ( $dseason == 1 && $dday == 19 ) {
} elseif ( $dseason == 1 && $dday == 19 ) {
$holy day = " Celebrate St. John the Blasphemist’ s Day. " ;
$holi day = " Celebrate St. John the Blasphemist' s Day. " ;
} elseif ( $dseason == 1 && $dday == 34 ) {
} elseif ( $dseason == 1 && $dday == 34 ) {
$holy day = " Celebrate Omarmas. " ;
$holi day = " Celebrate Omarmas. " ;
} elseif ( $dseason == 1 && $dday == 43 ) {
} elseif ( $dseason == 1 && $dday == 43 ) {
$holy day = " Celebrate Universal Ordination Day. " ;
$holi day = " Celebrate Universal Ordination Day. " ;
} elseif ( $dseason == 1 && $dday == 68 ) {
} elseif ( $dseason == 1 && $dday == 68 ) {
$holy day = " Celebrate Mal-2mas. " ;
$holi day = " Celebrate Mal-2mas. " ;
} elseif ( $dseason == 1 && $dday == 70 ) {
} elseif ( $dseason == 1 && $dday == 70 ) {
$holy day = " Celebrate Jake Day Jr. (DJ)/Day of the Elppin . " ;
$holi day = " Celebrate Day of the Elppin/Defenestration of Prague Day . " ;
} elseif ( $dseason == 1 && $dday == 72 ) {
} elseif ( $dseason == 1 && $dday == 72 ) {
$holy day = " Celebrate Towel Day. " ;
$holi day = " Celebrate Towel Day. " ;
} elseif ( $dseason == 2 && $dday == 26 ) {
} elseif ( $dseason == 2 && $dday == 26 ) {
$holy day = " Celebrate Imaginary Friend/Captain Tuttle Day . " ;
$holi day = " Celebrate Imaginary Friend. " ;
} elseif ( $dseason == 2 && $dday == 28 ) {
} elseif ( $dseason == 2 && $dday == 28 ) {
$holy day = " Celebrate St. George’ s Day. " ;
$holi day = " Celebrate St. George' s Day. " ;
} elseif ( $dseason == 2 && $dday == 30 ) {
} elseif ( $dseason == 2 && $dday == 30 ) {
$holy day = " Celebrate Zoog Day. " ;
$holi day = " Celebrate Zoog Day. " ;
} elseif ( $dseason == 2 && $dday == 36 ) {
$holyday = " Celebrate June 31st for Popes. " ;
} elseif ( $dseason == 2 && $dday == 37 ) {
} elseif ( $dseason == 2 && $dday == 37 ) {
$holy day = " Celebrate Mid-Year’ s Day. " ;
$holi day = " Celebrate Mid-Year' s Day. " ;
} elseif ( $dseason == 2 && $dday == 40 ) {
} elseif ( $dseason == 2 && $dday == 40 ) {
$holy day = " Celebrate X-Day. " ;
$holi day = " Celebrate X-Day. " ;
} elseif ( $dseason == 2 && $dday == 55 ) {
} elseif ( $dseason == 2 && $dday == 55 ) {
$holy day = " Celebrate Mal-2 Day. " ;
$holi day = " Celebrate Mal-2 Day. " ;
} elseif ( $dseason == 2 && $dday == 57 ) {
} elseif ( $dseason == 2 && $dday == 57 ) {
$holy day = " Celebrate John Dillinger Day. " ;
$holi day = " Celebrate John Dillinger Day. " ;
} elseif ( $dseason == 3 && $dday == 3 ) {
} elseif ( $dseason == 3 && $dday == 3 ) {
$holy day = " Celebrate Multiversal Underwear Day. " ;
$holi day = " Celebrate Multiversal Underwear Day. " ;
} elseif ( $dseason == 3 && $dday == 10 ) {
$holiday = " Celebrate St. Cecil Day. " ;
} elseif ( $dseason == 3 && $dday == 18 ) {
} elseif ( $dseason == 3 && $dday == 18 ) {
$holy day = " Celebrate Festival of Hanky-Panky Spankies. " ;
$holi day = " Celebrate Spanking F est . " ;
} elseif ( $dseason == 3 && $dday == 33 ) {
} elseif ( $dseason == 3 && $dday == 33 ) {
$holy day = " Celebrate Cat Dancing & Pussyfoot Day. " ;
$holi day = " Celebrate Pussyfoot Day. " ;
} elseif ( $dseason == 3 && $dday == 37 ) {
} elseif ( $dseason == 3 && $dday == 37 ) {
$holy day = " Celebrate Mass of Planet Eris/Eristotle. " ;
$holi day = " Celebrate Mass of Planet Eris/Mass of Eristotle. " ;
} elseif ( $dseason == 3 && $dday == 39 ) {
} elseif ( $dseason == 3 && $dday == 39 ) {
$holy day = " Celebrate St. Mammes's Day. " ;
$holi day = " Celebrate St. Mammes's Day. " ;
} elseif ( $dseason == 3 && $dday == 41 ) {
} elseif ( $dseason == 3 && $dday == 41 ) {
$holy day = " Celebrate Emperor Norton Proclamation Day. " ;
$holi day = " Celebrate Emperor Norton Proclamation Day. " ;
} elseif ( $dseason == 3 && $dday == 55 ) {
$holiday = " Celebrate Feast of St. John Blasphemist. " ;
} elseif ( $dseason == 3 && $dday == 57 ) {
} elseif ( $dseason == 3 && $dday == 57 ) {
$holy day = " Celebrate Shamlicht Kids Club Day. " ;
$holi day = " Celebrate Shamlicht Kids Club Day. " ;
} elseif ( $dseason == 3 && $dday == 59 ) {
} elseif ( $dseason == 3 && $dday == 59 ) {
$holy day = " Celebrate Gonkulator Day ( Gonculator Day) . " ;
$holi day = " Celebrate Gonculator Day. " ;
} elseif ( $dseason == 3 && $dday == 60 ) {
} elseif ( $dseason == 3 && $dday == 60 ) {
$holy day = " Celebrate Mad Hatter Day. " ;
$holi day = " Celebrate Mad Hatter Day. " ;
} elseif ( $dseason == 3 && $dday == 66 ) {
} elseif ( $dseason == 3 && $dday == 66 ) {
$holy day = " Celebrate Habeas Corpus Remembrance Day. " ;
$holi day = " Celebrate Habeas Corpus Remembrance Day. " ;
} elseif ( $dseason == 4 && $dday == 17 ) {
$holiday = " Celebrate Pope Night. " ;
} elseif ( $dseason == 4 && $dday == 28 ) {
} elseif ( $dseason == 4 && $dday == 28 ) {
$holy day = " Celebrate Ek-sen-triks CluborGuild Day. " ;
$holi day = " Celebrate Ek-sen-triks CluborGuild Day. " ;
} elseif ( $dseason == 4 && $dday == 36 ) {
$holyday = " Celebrate Spanking Fest. " ;
} elseif ( $dseason == 4 && $dday == 37 ) {
} elseif ( $dseason == 4 && $dday == 37 ) {
$holy day = " Celebrate 537 Day, sometimes Turkey Day. " ;
$holi day = " Celebrate 537 Day. " ;
} elseif ( $dseason == 4 && $dday == 40 ) {
} elseif ( $dseason == 4 && $dday == 40 ) {
$holy day = " Celebrate Omar’ s Day. " ;
$holi day = " Celebrate Omar' s Day. " ;
} elseif ( $dseason == 4 && $dday == 43 ) {
} elseif ( $dseason == 4 && $dday == 43 ) {
$holy day = " Celebrate Day D. " ;
$holi day = " Celebrate Day D. " ;
} elseif ( $dseason == 4 && $dday == 46 ) {
} elseif ( $dseason == 4 && $dday == 46 ) {
$holy day = " Celebrate Hug Day II. " ;
$holi day = " Celebrate Hug Day II. " ;
} elseif ( $dseason == 4 && $dday == 56 ) {
$holiday = " Celebrate Agnostica. " ;
} elseif ( $dseason == 4 && $dday == 65 ) {
} elseif ( $dseason == 4 && $dday == 65 ) {
$holy day = " Celebrate Circlemas. " ;
$holi day = " Celebrate Circlemas. " ;
}
}
extract ( $args );
extract ( $args );
@@ -235,9 +283,11 @@ class Discordian_Date_Widget extends WP_Widget {
$body = apply_filters ( 'widget_text' , $instance [ 'body' ]);
$body = apply_filters ( 'widget_text' , $instance [ 'body' ]);
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; \" > " ;
if ( get_option ( 'dtime_widget' )) echo " <h1 style= \" font-size: 255% \" id= \" dtime \" ></h1> " ;
echo " Today is " ;
echo get_ddate ( $content , $format , " now " ) . " . " ;
echo get_ddate ( $content , $format , " now " ) . " . " ;
if ( $holy day ) echo " <br><b> " . $holy day . " </b> " ;
if ( $holi day ) echo " <br><b> " . $holi day . " </b> " ;
echo " </div> " ;
echo " </div> " ;
$body2 = ob_get_contents ();
$body2 = ob_get_contents ();
ob_end_clean ();
ob_end_clean ();
@@ -269,9 +319,15 @@ class Discordian_Date_Widget extends WP_Widget {
function get_the_ddate_post($content, $format = null) {
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_dtime_post($content, $format = null) {
return get_ddate($content, $format, "get_the_time"); }
function get_the_ddate_comment($content, $format = null) {
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' );
}
}
@@ -300,10 +356,22 @@ function ddatefunc_admin() {
echo '<h2>'.$settings_name.'</h2>';
echo '<h2>'.$settings_name.'</h2>';
if (isset($_POST['save'])) {
if (isset($_POST['save'])) {
update_option('ddatefunc_string', stripslashes($_POST['textfield']));
update_option('ddatefunc_string', stripslashes($_POST['textfield']));
if (isset($_POST['checkbox']))
if (isset($_POST['ddatefunc_change_ checkbox']))
update_option('ddatefunc_change', "1");
update_option('ddatefunc_change', "1");
else
else
update_option('ddatefunc_change', "0");
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>';
echo '<div id="setting-error-settings_updated" class="updated settings-error"><p><b>'.__('Settings saved.').'</b></p></div>';
}
}
?>
?>
@@ -328,6 +396,9 @@ function ddatefunc_admin() {
<b>%GN</b> - Gregorian month number (example: 1)<br>
<b>%GN</b> - Gregorian month number (example: 1)<br>
<b>%GD</b> - Gregorian month day (example: 5)<br>
<b>%GD</b> - Gregorian month day (example: 5)<br>
<b>%GW</b> - Gregorian weekday (example: Friday)<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>
<br>
Examples<br>
Examples<br>
<br>
<br>
@@ -337,14 +408,53 @@ Examples<br>
</td>
</td>
</tr>
</tr>
<tr valign="top">
<tr valign="top">
<th scope="row">Convert all post and comments dates:</th>
<th scope="row">Convert all post and comment dates:</th>
<td>
<td>
<fieldset>
<fieldset>
<legend class="screen-reader-text">
<legend class="screen-reader-text">
<span>Convert to Discordian dates</span>
<span>Convert to Discordian dates</span>
</legend>
</legend>
<label for="users_can_register">
<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://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">
<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>
</label>
</fieldset>
</fieldset>
</td>
</td>
@@ -370,20 +480,38 @@ function ddatefunc_settings( $actions, $plugin_file ) {
function ddatefunc_deinstall() {
function ddatefunc_deinstall() {
delete_option('ddatefunc_string');
delete_option('ddatefunc_string');
delete_option('ddatefunc_change');
delete_option('ddatefunc_change');
delete_option('dtimefunc_change');
delete_option('dtime_convert');
delete_option('dtime_widget');
}
function ddatefunc_init() {
wp_enqueue_script('dtime', plugins_url('/dtime.js', __FILE__));
}
}
add_shortcode('today_ddate', 'return_today_ddate');
add_shortcode('today_ddate', 'return_today_ddate');
add_action('widgets_init', 'register_ddatefunc_widget');
add_action('widgets_init', 'register_ddatefunc_widget');
add_option('ddatefunc_string', '%DD day of %DS, in the yold %DY');
add_option('ddatefunc_string', '%DD day of %DS, in the yold %DY');
add_option('ddatefunc_change', '1');
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_filter('plugin_action_links', 'ddatefunc_settings', 10, 2);
add_action('admin_menu', 'ddatefunc_add_admin');
add_action('admin_menu', 'ddatefunc_add_admin');
if ( get_option('ddatefunc_change') == '1' ) {
if (get_option('ddatefunc_change')) {
add_filter('get_the_date','get_the_ddate_post');
add_filter('get_the_date','get_the_ddate_post');
add_filter('get_comment_date','get_the_ddate_comment');
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'))
if (function_exists('register_uninstall_hook'))
register_uninstall_hook(__FILE__, 'ddatefunc_deinstall');
register_uninstall_hook(__FILE__, 'ddatefunc_deinstall');