Uji Countdown - Version 1.0.8

Version Description

  • Important Fix: Get server time instead of local PC time. See same values on any GMT/UTC time zone
  • Fix p or br tag inclusion on some themes
  • Move script to separate file. More cleaner code
Download this release

Release Info

Developer ujimoto
Plugin Icon 128x128 Uji Countdown
Version 1.0.8
Comparing to
See all releases

Code changes from version 1.0.7 to 1.0.8

js/countdown.js.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ header("content-type: application/x-javascript");
3
+
4
+ if(file_exists('../../../../wp-load.php')) :
5
+ include '../../../../wp-load.php';
6
+ else:
7
+ include '../../../../../wp-load.php';
8
+ endif;
9
+
10
+
11
+ ?>
12
+ var uji_plugin = ujiCount.uji_plugin;
13
+
14
+ var expire = ujiCount.expire;
15
+
16
+ var Years = ujiCount.Years;
17
+ var Months = ujiCount.Months;
18
+ var Weeks = ujiCount.Weeks;
19
+ var Days = ujiCount.Days;
20
+ var Hours = ujiCount.Hours;
21
+ var Minutes = ujiCount.Minutes;
22
+ var Seconds = ujiCount.Seconds;
23
+
24
+ var Year = ujiCount.Year;
25
+ var Month = ujiCount.Month;
26
+ var Week = ujiCount.Week;
27
+ var Day = ujiCount.Day;
28
+ var Hour = ujiCount.Hour;
29
+ var Minute = ujiCount.Minute;
30
+ var Second = ujiCount.Second;
31
+
32
+ var ujic_txt_size = ujiCount.ujic_txt_size;
33
+ var ujic_col_dw = ujiCount.ujic_col_dw;
34
+ var ujic_col_up = ujiCount.ujic_col_up;
35
+ var ujic_col_txt = ujiCount.ujic_col_txt;
36
+ var ujic_col_sw = ujiCount.ujic_col_sw;
37
+ var ujic_txt = (ujiCount.ujic_txt == "true") ? true : false ;
38
+ var ujic_ani = (ujiCount.ujic_ani == "true") ? true : false ;
39
+ var ujic_url = (ujiCount.ujic_url == "true") ? true : false ;
40
+
41
+ var uji_center = ujiCount.uji_center;
42
+
43
+ jQuery(document).ready(function($){
44
+ var austDay = new Date(''+ expire +'');
45
+ jQuery.countdown.regional["uji"] = {
46
+ labels: [''+ Years +'', ''+ Months +'', ''+ Weeks +'', ''+ Days +'', ''+ Hours +'', ''+ Minutes +'', ''+ Seconds +''],
47
+ labels1: [''+ Year +'', ''+ Month +'', ''+ Week +'', ''+ Day +'', ''+ Hour +'', ''+ Minute +'', ''+ Second +''],
48
+ compactLabels: ["A", "L", "S", "Z"],
49
+ whichLabels: null,
50
+ timeSeparator: ':', isRTL: false};
51
+ jQuery.countdown.setDefaults(jQuery.countdown.regional["uji"]);
52
+ jQuery("#ujiCountdown").countdown({until: austDay, serverSync: serverTime, text_size: ''+ ujic_txt_size +'', color_down: ''+ ujic_col_dw +'', color_up: ''+ ujic_col_up +'', color_txt: ''+ ujic_col_txt +'', color_sw: ''+ ujic_col_sw +'', ujic_txt: ujic_txt, animate_sec: ujic_ani, ujic_url: ujic_url });
53
+ if(uji_center && uji_center!='')
54
+ jQuery("#ujiCountdown").css({"width": (jQuery("#ujiCountdown").width()+5)+"px", "padding-left": "10px", "display": "block"});
55
+ });
56
+
57
+ function serverTime() {
58
+ var time = null;
59
+ jQuery.ajax({url: uji_plugin + '/js/serverTime.php',
60
+ async: false, dataType: 'text',
61
+ success: function(text) {
62
+ time = new Date(text);
63
+ }, error: function(http, message, exc) {
64
+ time = new Date();
65
+ }});
66
+ return time;
67
+ }
js/serverTime.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ $now = new DateTime();
3
+ echo $now->format("M j, Y H:i:s O")."\n";
4
+ ?>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wpmanage.com/Uji-countdown
4
  Tags: countdown, counter, html5 countdown, animated countdown, countdown timer, count down, countdown clock, jQuery countdown, clock, timer
5
  Requires at least: 3.0
6
  Tested up to: 3.4.1
7
- Stable tag: 1.0.7
8
 
9
  Uji Countdown - HTML5 Customizable Countdown Timer
10
 
@@ -47,6 +47,12 @@ WPmanage [(http://www.wpmanage.com/uji-countdown/)](http://www.wpmanage.com/uji-
47
 
48
  == Changelog ==
49
 
 
 
 
 
 
 
50
  = 1.0.7 =
51
 
52
  * Fix: "Setting the date and time" on some themes
4
  Tags: countdown, counter, html5 countdown, animated countdown, countdown timer, count down, countdown clock, jQuery countdown, clock, timer
5
  Requires at least: 3.0
6
  Tested up to: 3.4.1
7
+ Stable tag: 1.0.8
8
 
9
  Uji Countdown - HTML5 Customizable Countdown Timer
10
 
47
 
48
  == Changelog ==
49
 
50
+ = 1.0.8 =
51
+
52
+ * Important Fix: Get server time instead of local PC time. See same values on any GMT/UTC time zone
53
+ * Fix p or br tag inclusion on some themes
54
+ * Move script to separate file. More cleaner code
55
+
56
  = 1.0.7 =
57
 
58
  * Fix: "Setting the date and time" on some themes
uji-countdown-front.php CHANGED
@@ -151,8 +151,7 @@ function ujic_code( $atts, $content = null ) {
151
  if($hide=="true" && $now_time > $unx_time){
152
  return $content;
153
  }else{
154
- wp_enqueue_style( 'ujiStyleCount');
155
- wp_enqueue_script('UJI_js_countdown');
156
 
157
  $table_name = $wpdb->prefix ."uji_counter";
158
  $ujic_datas = $wpdb->get_results("SELECT * FROM $table_name WHERE title = '".$id."'");
@@ -179,26 +178,39 @@ function ujic_code( $atts, $content = null ) {
179
  $ujic_ani = !empty($ujic_ani) ? 'true' : 'false';
180
  $ujic_url = !empty($url) ? '\''.$url.'\'' : 'false';
181
 
182
- if($class=='center'){ $center_script = 'jQuery("#ujiCountdown").css({"width": (jQuery("#ujiCountdown").width()+5)+"px", "padding-left": "10px", "display": "block"});';} else{$center_script = '';}
183
- $script =' <script type="text/javascript">
184
- <!--
185
- jQuery(document).ready(function($){
186
- var austDay = new Date("'.$expire.'");
187
- jQuery.countdown.regional["uji"] = {
188
- labels: ["'.__("Years", "uji-countdown").'", "'.__("Months", "uji-countdown").'", "'.__("Weeks", "uji-countdown").'", "'.__("Days", "uji-countdown").'", "'.__("Hours", "uji-countdown").'", "'.__("Minutes", "uji-countdown").'", "'.__("Seconds", "uji-countdown").'"],
189
- labels1: ["'.__("Year", "uji-countdown").'", "'.__("Month", "uji-countdown").'", "'.__("Week", "uji-countdown").'", "'.__("Day", "uji-countdown").'", "'.__("Hour", "uji-countdown").'", "'.__("Minute", "uji-countdown").'", "'.__("Second", "uji-countdown").'"],
190
- compactLabels: ["A", "L", "S", "Z"],
191
- whichLabels: null,
192
- timeSeparator: \':\', isRTL: false};
193
- jQuery.countdown.setDefaults(jQuery.countdown.regional["uji"]);
194
- jQuery("#ujiCountdown").countdown({until: austDay, text_size: \''.$ujic_txt_size.'\', color_down: \''.$ujic_col_dw.'\', color_up: \''.$ujic_col_up.'\', color_txt: \''.$ujic_col_txt.'\', color_sw: \''.$ujic_col_sw.'\', ujic_txt: '.$ujic_txt .', animate_sec: '.$ujic_ani.', ujic_url: '.$ujic_url.'});
195
- '.$center_script.'
196
- });
197
-
198
- //-->
199
- </script>';
 
 
 
 
 
 
 
 
 
 
 
 
 
200
 
201
- return strip_shortcodes($script.'<div id="ujiCountdown" '.$classh.'></div>'.$content);
202
  }
203
  }
204
  add_shortcode("ujicountdown", "ujic_code");
151
  if($hide=="true" && $now_time > $unx_time){
152
  return $content;
153
  }else{
154
+
 
155
 
156
  $table_name = $wpdb->prefix ."uji_counter";
157
  $ujic_datas = $wpdb->get_results("SELECT * FROM $table_name WHERE title = '".$id."'");
178
  $ujic_ani = !empty($ujic_ani) ? 'true' : 'false';
179
  $ujic_url = !empty($url) ? '\''.$url.'\'' : 'false';
180
 
181
+
182
+ wp_enqueue_style( 'ujiStyleCount');
183
+ wp_enqueue_script('UJI_js_countdown');
184
+ wp_localize_script('js_countdown', 'ujiCount', array(
185
+ 'uji_plugin' => UJI_PLUGIN_URL,
186
+ 'expire' => $expire,
187
+ 'Years' => __("Years", "uji-countdown"),
188
+ 'Months' => __("Months", "uji-countdown"),
189
+ 'Weeks' => __("Weeks", "uji-countdown"),
190
+ 'Days' => __("Days", "uji-countdown"),
191
+ 'Hours' => __("Hours", "uji-countdown"),
192
+ 'Minutes' => __("Minutes", "uji-countdown"),
193
+ 'Seconds' => __("Seconds", "uji-countdown"),
194
+ 'Year' => __("Year", "uji-countdown"),
195
+ 'Month' => __("Month", "uji-countdown"),
196
+ 'Week' => __("Week", "uji-countdown"),
197
+ 'Day' => __("Day", "uji-countdown"),
198
+ 'Hour' => __("Hour", "uji-countdown"),
199
+ 'Minute' => __("Minute", "uji-countdown"),
200
+ 'Second' => __("Second", "uji-countdown"),
201
+ 'ujic_txt_size' => $ujic_txt_size,
202
+ 'ujic_col_dw' => $ujic_col_dw,
203
+ 'ujic_col_up' => $ujic_col_up,
204
+ 'ujic_col_txt' => $ujic_col_txt,
205
+ 'ujic_col_sw' => $ujic_col_sw,
206
+ 'ujic_txt' => $ujic_txt,
207
+ 'ujic_ani' => $ujic_ani,
208
+ 'ujic_url' => $ujic_url,
209
+ 'uji_center' => $classh,
210
+ ));
211
+ wp_enqueue_script('js_countdown');
212
 
213
+ return strip_shortcodes('<div id="ujiCountdown" '.$classh.'></div>'.$content);
214
  }
215
  }
216
  add_shortcode("ujicountdown", "ujic_code");
uji-countdown.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Uji Countdown
4
  Plugin URI: http://www.wpmanage.com/uji-countdown/
5
  Description: HTML5 Countdown.
6
- Version: 1.0.7
7
  Author: Ujog Raul
8
  Author URI: http://www.wpmanage.com
9
 
@@ -152,6 +152,7 @@ function ujic_scripts_register() {
152
  wp_register_style('ujiStyleCount', UJI_PLUGIN_URL . '/css/jquery.countdown.css');
153
  wp_enqueue_script('jquery');
154
  wp_register_script('UJI_js_countdown', UJI_PLUGIN_URL . '/js/jquery.countdown.js', array('jquery'), '1.0', true);
 
155
  }
156
  add_action('wp_enqueue_scripts', 'ujic_scripts_register');
157
 
3
  Plugin Name: Uji Countdown
4
  Plugin URI: http://www.wpmanage.com/uji-countdown/
5
  Description: HTML5 Countdown.
6
+ Version: 1.0.8
7
  Author: Ujog Raul
8
  Author URI: http://www.wpmanage.com
9
 
152
  wp_register_style('ujiStyleCount', UJI_PLUGIN_URL . '/css/jquery.countdown.css');
153
  wp_enqueue_script('jquery');
154
  wp_register_script('UJI_js_countdown', UJI_PLUGIN_URL . '/js/jquery.countdown.js', array('jquery'), '1.0', true);
155
+ wp_register_script('js_countdown', UJI_PLUGIN_URL . '/js/countdown.js.php', array('jquery'), '1.0', true);
156
  }
157
  add_action('wp_enqueue_scripts', 'ujic_scripts_register');
158