Countdown Timer – Widget Countdown - Version 1.2.2

Version Description

  • Added date picker.

=

Download this release

Release Info

Developer wpdevart
Plugin Icon 128x128 Countdown Timer – Widget Countdown
Version 1.2.2
Comparing to
See all releases

Code changes from version 1.2.1 to 1.2.2

includes/admin_menu.php CHANGED
@@ -108,7 +108,27 @@ class wpdevart_countdown_admin_menu{
108
  <input type="text" name="countdown_seconds_text" id="countdown_seconds_text" value="Seconds">
109
  </td>
110
  </tr>
111
- <tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  <td>
113
  Countdown expire time <span title="Type the Countdown expire time." class="desription_class">?</span>
114
  </td>
@@ -293,7 +313,25 @@ class wpdevart_countdown_admin_menu{
293
  jQuery('.coming_set_hiddens').each(function(index, element) {
294
  jQuery('.tr_'+jQuery(this).val()).show();
295
  });
296
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297
 
298
  jQuery( '.slider_div' ).slider({
299
  orientation: "horizontal",
@@ -322,6 +360,12 @@ class wpdevart_countdown_admin_menu{
322
  if(jQuery('#countdown_seconds_text').length)
323
  variables=variables+'text_for_second="'+jQuery('#countdown_seconds_text').val()+'" ';
324
 
 
 
 
 
 
 
325
  if(jQuery('#countdown_start_date').length)
326
  variables=variables+'start_time="'+jQuery('#countdown_start_date').val()+'" ';
327
 
108
  <input type="text" name="countdown_seconds_text" id="countdown_seconds_text" value="Seconds">
109
  </td>
110
  </tr>
111
+ <tr>
112
+ <td>
113
+ expiry date type <span title="Type here Second field text." class="desription_class">?</span>
114
+
115
+ </td>
116
+ <td>
117
+ <select class="show_hide_experet_type" id="countdown_experet_type">
118
+ <option selected="selected" value="time">Time</option>
119
+ <option value="date">Date</option>
120
+ </select>
121
+ </td>
122
+ </tr>
123
+ <tr class="expert_type_date" style="display:none">
124
+ <td>
125
+ Countdown expiry date : <span title="Type here Second field text." class="desription_class">?</span>
126
+ </td>
127
+ <td>
128
+ <input type="text" value="<?php echo date('d-m-Y 23:59') ?>" id="countdown_experet_date" /><small>dd-mm-yyyy hh:ii</small>
129
+ </td>
130
+ </tr>
131
+ <tr class="expert_type_time">
132
  <td>
133
  Countdown expire time <span title="Type the Countdown expire time." class="desription_class">?</span>
134
  </td>
313
  jQuery('.coming_set_hiddens').each(function(index, element) {
314
  jQuery('.tr_'+jQuery(this).val()).show();
315
  });
316
+ // show hidden countdown end date type
317
+ jQuery('.show_hide_experet_type').change(function(){
318
+ if(jQuery(this).val()=='date'){
319
+ jQuery('.expert_type_date').show();
320
+ jQuery('.expert_type_time').hide();
321
+ }else{
322
+ jQuery('.expert_type_date').hide();
323
+ jQuery('.expert_type_time').show();
324
+ }
325
+ })
326
+ var nowTemp = new Date();
327
+ var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
328
+ jQuery('#countdown_experet_date').fdatepicker({
329
+ format: 'dd-mm-yyyy hh:ii',
330
+ pickTime: true,
331
+ onRender: function (date) {
332
+ return date.valueOf() < now.valueOf() ? 'disabled' : '';
333
+ }
334
+ });
335
 
336
  jQuery( '.slider_div' ).slider({
337
  orientation: "horizontal",
360
  if(jQuery('#countdown_seconds_text').length)
361
  variables=variables+'text_for_second="'+jQuery('#countdown_seconds_text').val()+'" ';
362
 
363
+ if(jQuery('#countdown_experet_type').length)
364
+ variables=variables+'countdown_end_type="'+jQuery('#countdown_experet_type').val()+'" ';
365
+
366
+ if(jQuery('#countdown_experet_date').length)
367
+ variables=variables+'end_date="'+jQuery('#countdown_experet_date').val()+'" ';
368
+
369
  if(jQuery('#countdown_start_date').length)
370
  variables=variables+'start_time="'+jQuery('#countdown_start_date').val()+'" ';
371
 
includes/front_end.php CHANGED
@@ -45,6 +45,8 @@ class wpdevart_countdown_front_end{
45
  "text_for_minut" => "minutes",
46
  "text_for_second" => "seconds",
47
  "start_time" => mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y")),
 
 
48
  "end_time" => "0,1,0",
49
  "action_end_time" => "hide",
50
  "content_position" => "center",
@@ -55,9 +57,16 @@ class wpdevart_countdown_front_end{
55
 
56
 
57
 
58
- $time_experit=explode(',',$curent_value['end_time']);
59
- $time_diferent=(int)$time_experit[0]*24*3600+(int)+$time_experit[1]*3600+(int)$time_experit[2]*60+$curent_value['start_time']-mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y"));
60
-
 
 
 
 
 
 
 
61
  $day_left=(int)($time_diferent/(3600*24));
62
  $hourse_left=(int)(($time_diferent-$day_left*24*3600)/(3600));
63
  $minuts_left=(int)(($time_diferent-$day_left*24*3600-$hourse_left*3600)/(60));
@@ -87,8 +96,16 @@ class wpdevart_countdown_front_end{
87
  public function wpdevart_countdown_javascript($parametrs_for_countedown){
88
  $output_js='';
89
 
90
- $time_experit=explode(',',$parametrs_for_countedown['end_time']);
91
- $time_diferent=(int)$time_experit[0]*24*3600+(int)+$time_experit[1]*3600+(int)$time_experit[2]*60+$parametrs_for_countedown['start_time']-mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y"));
 
 
 
 
 
 
 
 
92
  $day_left=(int)($time_diferent/(3600*24));
93
  $hourse_left=(int)(($time_diferent-$day_left*24*3600)/(3600));
94
  $minuts_left=(int)(($time_diferent-$day_left*24*3600-$hourse_left*3600)/(60));
45
  "text_for_minut" => "minutes",
46
  "text_for_second" => "seconds",
47
  "start_time" => mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y")),
48
+ "countdown_end_type" => "time",
49
+ "end_date" => date('d-m-Y 23:59'),
50
  "end_time" => "0,1,0",
51
  "action_end_time" => "hide",
52
  "content_position" => "center",
57
 
58
 
59
 
60
+ if(isset($curent_value['countdown_end_type']) && $curent_value['countdown_end_type']=='date'){
61
+ $end_date=explode(' ',$curent_value['end_date']);
62
+ $end_date_only_date=explode('-',$end_date[0]);
63
+ $end_date_hour=explode(':',$end_date[1]);
64
+ $curent_time=mktime ($end_date_hour['0'], $end_date_hour[1],0,$end_date_only_date[1], $end_date_only_date[0],$end_date_only_date[2]);
65
+ $time_diferent=$curent_time-mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y"));
66
+ }else{
67
+ $time_experit=explode(',',$curent_value['end_time']);
68
+ $time_diferent=(int)$time_experit[0]*24*3600+(int)+$time_experit[1]*3600+(int)$time_experit[2]*60+$curent_value['start_time']-mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y"));
69
+ }
70
  $day_left=(int)($time_diferent/(3600*24));
71
  $hourse_left=(int)(($time_diferent-$day_left*24*3600)/(3600));
72
  $minuts_left=(int)(($time_diferent-$day_left*24*3600-$hourse_left*3600)/(60));
96
  public function wpdevart_countdown_javascript($parametrs_for_countedown){
97
  $output_js='';
98
 
99
+ if(isset($parametrs_for_countedown['countdown_end_type']) && $parametrs_for_countedown['countdown_end_type']=='date'){
100
+ $end_date=explode(' ',$parametrs_for_countedown['end_date']);
101
+ $end_date_only_date=explode('-',$end_date[0]);
102
+ $end_date_hour=explode(':',$end_date[1]);
103
+ $curent_time=mktime ($end_date_hour['0'], $end_date_hour[1],0,$end_date_only_date[1], $end_date_only_date[0],$end_date_only_date[2]);
104
+ $time_diferent=$curent_time-mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y"));
105
+ }else{
106
+ $time_experit=explode(',',$parametrs_for_countedown['end_time']);
107
+ $time_diferent=(int)$time_experit[0]*24*3600+(int)+$time_experit[1]*3600+(int)$time_experit[2]*60+$parametrs_for_countedown['start_time']-mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y"));
108
+ }
109
  $day_left=(int)($time_diferent/(3600*24));
110
  $hourse_left=(int)(($time_diferent-$day_left*24*3600)/(3600));
111
  $minuts_left=(int)(($time_diferent-$day_left*24*3600-$hourse_left*3600)/(60));
includes/widget.php CHANGED
@@ -35,6 +35,8 @@ class wpdevart_countdown extends WP_Widget {
35
  $instance['text_for_hour'] = $new_instance['text_for_hour'];
36
  $instance['text_for_minut'] = $new_instance['text_for_minut'];
37
  $instance['text_for_second'] = $new_instance['text_for_second'];
 
 
38
  $instance['end_time'] = $new_instance['end_time'];
39
  $instance['start_time'] = $new_instance['start_time'];
40
  $instance['content'] = $new_instance['content'];
@@ -56,7 +58,9 @@ class wpdevart_countdown extends WP_Widget {
56
  'text_for_minut' => 'Minuts',
57
  'text_for_second' => 'Seconds',
58
  'start_time' => mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y")),
 
59
  'end_time' => '0,1,5',
 
60
  'action_end_time' => 'hide',
61
  'content' => '',
62
  'content_position' => 'center',
@@ -97,7 +101,7 @@ class wpdevart_countdown extends WP_Widget {
97
  <input id="<?php echo $this->get_field_id('text_for_second'); ?>" name="<?php echo $this->get_field_name('text_for_second'); ?>" type="text" value="<?php echo $instance['text_for_second']; ?>" class="widefat">
98
  </p>
99
 
100
- <p class="flb_field">
101
  <?php $time_end=explode(',',$instance['end_time']);
102
 
103
  if(isset($time_end[0]) && isset($time_end[1]) && isset($time_end[2]) ){
@@ -126,6 +130,20 @@ class wpdevart_countdown extends WP_Widget {
126
  font-weight: bold;
127
  color: rgba(10, 154, 62, 1);
128
  }</style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  <label>Countdown expire time :</label>
130
  <br>
131
  <span style="display:inline-block; margin-right:3px; width:55px;">
@@ -245,6 +263,41 @@ class wpdevart_countdown extends WP_Widget {
245
  </p>
246
  <br>
247
  <input type="hidden" id="flb-submit" name="flb-submit" value="1">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  <a href="http://wpdevart.com/wordpress-countdown-plugin/" target="_blank" style="color: rgba(10, 154, 62, 1);; font-weight: bold; font-size: 18px; text-decoration: none;">Upgrade to Pro Version</a>
249
  <?php
250
  }
@@ -253,9 +306,16 @@ class wpdevart_countdown extends WP_Widget {
253
  self::$id_for_content++;
254
  $output_html='';
255
 
256
- $time_experit=explode(',',$parametrs['end_time']);
257
- $time_diferent=(int)$time_experit[0]*24*3600+(int)+$time_experit[1]*3600+(int)$time_experit[2]*60+$parametrs['start_time']-mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y"));
258
-
 
 
 
 
 
 
 
259
  $day_left=(int)($time_diferent/(3600*24));
260
  $hourse_left=(int)(($time_diferent-$day_left*24*3600)/(3600));
261
  $minuts_left=(int)(($time_diferent-$day_left*24*3600-$hourse_left*3600)/(60));
35
  $instance['text_for_hour'] = $new_instance['text_for_hour'];
36
  $instance['text_for_minut'] = $new_instance['text_for_minut'];
37
  $instance['text_for_second'] = $new_instance['text_for_second'];
38
+ $instance['end_time_type'] = $new_instance['end_time_type'];
39
+ $instance['end_time_date'] = $new_instance['end_time_date'];
40
  $instance['end_time'] = $new_instance['end_time'];
41
  $instance['start_time'] = $new_instance['start_time'];
42
  $instance['content'] = $new_instance['content'];
58
  'text_for_minut' => 'Minuts',
59
  'text_for_second' => 'Seconds',
60
  'start_time' => mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y")),
61
+ 'end_time_type' => 'time',
62
  'end_time' => '0,1,5',
63
+ 'end_time_date' => date('d-m-Y 23:59'),
64
  'action_end_time' => 'hide',
65
  'content' => '',
66
  'content_position' => 'center',
101
  <input id="<?php echo $this->get_field_id('text_for_second'); ?>" name="<?php echo $this->get_field_name('text_for_second'); ?>" type="text" value="<?php echo $instance['text_for_second']; ?>" class="widefat">
102
  </p>
103
 
104
+
105
  <?php $time_end=explode(',',$instance['end_time']);
106
 
107
  if(isset($time_end[0]) && isset($time_end[1]) && isset($time_end[2]) ){
130
  font-weight: bold;
131
  color: rgba(10, 154, 62, 1);
132
  }</style>
133
+ <p class="experet_type">
134
+ <label for="<?php echo $this->get_field_id('end_time_type'); ?>">Countdown expire type :</label>
135
+ <br>
136
+ <select class="show_hide_experet_type" id="<?php echo $this->get_field_id('end_time_type'); ?>" name="<?php echo $this->get_field_name('end_time_type'); ?>">
137
+ <option <?php selected('time',$instance['end_time_type']) ?> value="time">Time</option>
138
+ <option <?php selected('date',$instance['end_time_type']) ?> value="date">Date</option>
139
+ </select>
140
+ </p>
141
+ <p class="experet_type_date">
142
+ <label>Countdown expiry date :</label>
143
+ <br>
144
+ <input type="text" id="<?php echo $this->get_field_id('end_time_date'); ?>" name="<?php echo $this->get_field_name('end_time_date'); ?>" value="<?php echo $instance['end_time_date'] ?>" class="wpdevart-date-time-picker" /><small>dd-mm-yyyy hh:ii</small>
145
+ </p>
146
+ <p class="flb_field experet_type_time">
147
  <label>Countdown expire time :</label>
148
  <br>
149
  <span style="display:inline-block; margin-right:3px; width:55px;">
263
  </p>
264
  <br>
265
  <input type="hidden" id="flb-submit" name="flb-submit" value="1">
266
+ <script>
267
+ jQuery('.wpdevart-date-time-picker').ready(function(){
268
+ var nowTemp = new Date();
269
+ var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
270
+ jQuery('.wpdevart-date-time-picker').fdatepicker({
271
+ format: 'dd-mm-yyyy hh:ii',
272
+ pickTime: true,
273
+ onRender: function (date) {
274
+ return date.valueOf() < now.valueOf() ? 'disabled' : '';
275
+ }
276
+ });
277
+ });
278
+ jQuery('.show_hide_experet_type').ready(function(){
279
+ jQuery('.show_hide_experet_type').each(function(index, element) {
280
+ if(jQuery(this).val()=='time'){
281
+ jQuery(this).parent().parent().find(jQuery('.experet_type_date')).hide();
282
+ jQuery(this).parent().parent().find(jQuery('.experet_type_time')).show();
283
+ }
284
+ if(jQuery(this).val()=='date'){
285
+ jQuery(this).parent().parent().find(jQuery('.experet_type_date')).show();
286
+ jQuery(this).parent().parent().find(jQuery('.experet_type_time')).hide();
287
+ }
288
+ });
289
+ jQuery('.show_hide_experet_type').change(function(){
290
+ if(jQuery(this).val()=='time'){
291
+ jQuery(this).parent().parent().find(jQuery('.experet_type_date')).hide();
292
+ jQuery(this).parent().parent().find(jQuery('.experet_type_time')).show();
293
+ }
294
+ if(jQuery(this).val()=='date'){
295
+ jQuery(this).parent().parent().find(jQuery('.experet_type_date')).show();
296
+ jQuery(this).parent().parent().find(jQuery('.experet_type_time')).hide();
297
+ }
298
+ })
299
+ })
300
+ </script>
301
  <a href="http://wpdevart.com/wordpress-countdown-plugin/" target="_blank" style="color: rgba(10, 154, 62, 1);; font-weight: bold; font-size: 18px; text-decoration: none;">Upgrade to Pro Version</a>
302
  <?php
303
  }
306
  self::$id_for_content++;
307
  $output_html='';
308
 
309
+ if(isset($parametrs['end_time_type']) && $parametrs['end_time_type']=='date'){
310
+ $end_date=explode(' ',$parametrs['end_time_date']);
311
+ $end_date_only_date=explode('-',$end_date[0]);
312
+ $end_date_hour=explode(':',$end_date[1]);
313
+ $curent_time=mktime ($end_date_hour['0'], $end_date_hour[1],0,$end_date_only_date[1], $end_date_only_date[0],$end_date_only_date[2]);
314
+ $time_diferent=$curent_time-mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y"));
315
+ }else{
316
+ $time_experit=explode(',',$parametrs['end_time']);
317
+ $time_diferent=(int)$time_experit[0]*24*3600+(int)+$time_experit[1]*3600+(int)$time_experit[2]*60+$parametrs['start_time']-mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y"));
318
+ }
319
  $day_left=(int)($time_diferent/(3600*24));
320
  $hourse_left=(int)(($time_diferent-$day_left*24*3600)/(3600));
321
  $minuts_left=(int)(($time_diferent-$day_left*24*3600-$hourse_left*3600)/(60));
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WordPress Countdown plugin ===
2
  Contributors: wpdevart
3
  Donate link: http://wpdevart.com/wordpress-countdown-plugin
4
- Tags: countdown, count down, countdown timer, jQuery countdown, countdown generator, animated countdown, countdown widget, timer, countdown clock, wp countdown timer, event countdown, widget countdown, clock, countdown to time, countdown timer plugin, wordpress countdown, birthday countdown, html5 countdown, wp countdown, countdown timer widget, website countdown, date countdown, flash countdown, upcoming, event countdown, minutero
5
  Requires at least: 3.3.0
6
  Tested up to: 4.2.3
7
- Stable tag: 1.2.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -195,6 +195,10 @@ Dear users, we also recommend you to take a look for this useful plugins - [Word
195
 
196
  * Bug fixed.
197
 
 
 
 
 
198
  == Wordpress Countdown step by step guide ==
199
 
200
  ### WordPress Countdown plugin options
1
  === WordPress Countdown plugin ===
2
  Contributors: wpdevart
3
  Donate link: http://wpdevart.com/wordpress-countdown-plugin
4
+ Tags: countdown, count down, countdown timer, jQuery countdown, countdown generator, animated countdown, countdown widget, timer, countdown clock, wp countdown timer, event countdown, widget countdown, clock, countdown to time, countdown timer plugin, wordpress countdown, birthday countdown, html5 countdown, wp countdown, countdown timer widget, website countdown, date countdown, flash countdown, upcoming, event countdown
5
  Requires at least: 3.3.0
6
  Tested up to: 4.2.3
7
+ Stable tag: 1.2.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
195
 
196
  * Bug fixed.
197
 
198
+ = 1.2.2 =
199
+
200
+ * Added date picker.
201
+
202
  == Wordpress Countdown step by step guide ==
203
 
204
  ### WordPress Countdown plugin options
wpdevart-countdown.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Countdown Wpdevart
4
  Plugin URI: http://wpdevart.com/wordpress-countdown-plugin/
5
  Description: WordPress Countdown plugin is an nice tool to create and insert countdown timers into your posts/pages and widgets .
6
- Version: 1.2.1
7
  Author: wpdevart
8
  Author URI: http://wpdevart.com
9
  License: GPL3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -58,7 +58,11 @@ class wpdevart_countdown_main{
58
  public function registr_requeried_scripts(){
59
  wp_register_script('countdown-front-end',$this->wpdevart_countdown_plugin_url.'includes/javascript/front_end_js.js');
60
  wp_register_style('countdown_css',$this->wpdevart_countdown_plugin_url.'includes/style/style.css');
61
- wp_register_style('animated',$this->wpdevart_countdown_plugin_url.'includes/style/effects.css');
 
 
 
 
62
  }
63
 
64
  public function call_base_filters(){
@@ -68,6 +72,9 @@ class wpdevart_countdown_main{
68
  public function include_requeried_scripts(){
69
  wp_enqueue_script('wp-color-picker');
70
  wp_enqueue_style( 'wp-color-picker' );
 
 
 
71
  }
72
 
73
  }
3
  Plugin Name: Countdown Wpdevart
4
  Plugin URI: http://wpdevart.com/wordpress-countdown-plugin/
5
  Description: WordPress Countdown plugin is an nice tool to create and insert countdown timers into your posts/pages and widgets .
6
+ Version: 1.2.2
7
  Author: wpdevart
8
  Author URI: http://wpdevart.com
9
  License: GPL3 http://www.gnu.org/licenses/gpl-3.0.html
58
  public function registr_requeried_scripts(){
59
  wp_register_script('countdown-front-end',$this->wpdevart_countdown_plugin_url.'includes/javascript/front_end_js.js');
60
  wp_register_style('countdown_css',$this->wpdevart_countdown_plugin_url.'includes/style/style.css');
61
+ wp_register_style('animated',$this->wpdevart_countdown_plugin_url.'includes/style/effects.css');
62
+
63
+ // datepicker
64
+ wp_register_script('foundation-datepicker',$this->wpdevart_countdown_plugin_url.'includes/javascript/foundation-datepicker.min.js');
65
+ wp_register_style('foundation-datepicker',$this->wpdevart_countdown_plugin_url.'includes/style/foundation-datepicker.min.css');
66
  }
67
 
68
  public function call_base_filters(){
72
  public function include_requeried_scripts(){
73
  wp_enqueue_script('wp-color-picker');
74
  wp_enqueue_style( 'wp-color-picker' );
75
+ // datepicker
76
+ wp_enqueue_script('foundation-datepicker');
77
+ wp_enqueue_style('foundation-datepicker');
78
  }
79
 
80
  }