WordPress.org

Ready to get started?Download WordPress

Forums

Countdown Timer
[resolved] [patch] On-hover date localization (4 posts)

  1. pwesolek
    Member
    Posted 2 years ago #

    Hi,

    We're using Countdown Timer in non-English installation and the default formatting of on-hover date, which is non-localized with gmdate(), was unsatisfactory.

    Hence a little change in the patch included against 2.4.3.

    Firstly, it makes use of date_i18n() WordPress function instead of gmdate(). This change is backword-compatible, the date format used is the same.

    Secondly, if the format date field in Countdown Timer settings is left blank, the default WordPress format, set on Settings page, is used as "[date], [format]".

    Please consider merging this patch -- probably with fixes to settings instruction to make the behavior clear.

    http://wordpress.org/extend/plugins/countdown-timer/

  2. pwesolek
    Member
    Posted 2 years ago #

    The patch:

    --- ./fergcorp_countdownTimer.php.orig	2012-03-11 23:08:57.000000000 +0100
    +++ ./fergcorp_countdownTimer.php	2012-04-20 10:11:24.860685509 +0200
    @@ -402,7 +402,10 @@
     			$content = "<li class = 'fergcorp_countdownTimer_event_li'>";
     		$nonceTracker = "x".md5(rand()); //XHTML prevents IDs from starting with a number, so append a 'x' on the front just to make sure it dosn't start with numeric
     		$eventTitle = "<span class = 'fergcorp_countdownTimer_event_title'>".($link==""?$eventText:"<a href="$link">".$eventText."</a>").'</span>'.get_option('fergcorp_countdownTimer_titleSuffix')."\n";
    -		$timePrefix = "<abbr title = \"".gmdate($timeFormat, $time + (get_option('gmt_offset') * 3600))."\" id = '$nonceTracker' class = 'fergcorp_countdownTimer_event_time'>";
    +		if ($timeFormat == "") {
    +			$timeFormat = get_option('date_format') . ", " . get_option('time_format');
    +		}
    +		$timePrefix = "<abbr title = \"".date_i18n($timeFormat, $time + (get_option('gmt_offset') * 3600))."\" id = '$nonceTracker' class = 'fergcorp_countdownTimer_event_time'>";
    
     		if(($time_left < 0)&&($timeSince==1)&&((($time_left + $timeSinceTime) > 0)||($timeSinceTime == 0))){ //If the event has already passed and we still want to display the event
     			$fergcorp_countdownTimer_noEventsPresent = FALSE; //Set to FALSE so we know there's an event to display
  3. fergbrain
    Member
    Plugin Author

    Posted 1 year ago #

  4. pwesolek
    Member
    Posted 1 year ago #

    Cool, thanks. :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic