Countdown Timer – Widget Countdown - Version 2.1.5

Version Description

  • Added new functionality - Redirect.

=

Download this release

Release Info

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

Code changes from version 2.1.4 to 2.1.5

includes/admin_menu.php CHANGED
@@ -190,16 +190,25 @@ class wpdevart_countdown_admin_menu{
190
  <select id="countdownstart_on" >
191
  <option selected="selected" value="hide">Hide countdown</option>
192
  <option value="show_text">Show text</option>
 
193
  </select>
194
  </td>
195
  </tr>
196
  </tr>
197
- <tr>
198
  <td>
199
  Message after countdown expire <span title="Type the message that will appear after countdown time expire. " class="desription_class">?</span>
200
  </td>
201
  <td>
202
  <textarea type="text" name="expeiret_text" id="expeiret_text"></textarea>
 
 
 
 
 
 
 
 
203
  </td>
204
  </tr>
205
  <tr>
@@ -404,6 +413,9 @@ class wpdevart_countdown_admin_menu{
404
  if(jQuery('#countdown_hide_on_mobile').length)
405
  variables=variables+'hide_on_mobile="'+jQuery('#countdown_hide_on_mobile').val()+'" ';
406
 
 
 
 
407
  if(jQuery('#countdown_experet_date').length)
408
  variables=variables+'end_date="'+jQuery('#countdown_experet_date').val()+'" ';
409
 
190
  <select id="countdownstart_on" >
191
  <option selected="selected" value="hide">Hide countdown</option>
192
  <option value="show_text">Show text</option>
193
+ <option value="redirect">Redirect</option>
194
  </select>
195
  </td>
196
  </tr>
197
  </tr>
198
+ <tr>
199
  <td>
200
  Message after countdown expire <span title="Type the message that will appear after countdown time expire. " class="desription_class">?</span>
201
  </td>
202
  <td>
203
  <textarea type="text" name="expeiret_text" id="expeiret_text"></textarea>
204
+ </td>
205
+ </tr>
206
+ <tr>
207
+ <td>
208
+ Redirect URL <span title="Type the redirect URL. " class="desription_class">?</span>
209
+ </td>
210
+ <td>
211
+ <input type="text" id="redirect_url" size="25" placeholder="http://www.example.com" value=""/>
212
  </td>
213
  </tr>
214
  <tr>
413
  if(jQuery('#countdown_hide_on_mobile').length)
414
  variables=variables+'hide_on_mobile="'+jQuery('#countdown_hide_on_mobile').val()+'" ';
415
 
416
+ if(jQuery('#redirect_url').length)
417
+ variables=variables+'redirect_url="'+jQuery('#redirect_url').val()+'" ';
418
+
419
  if(jQuery('#countdown_experet_date').length)
420
  variables=variables+'end_date="'+jQuery('#countdown_experet_date').val()+'" ';
421
 
includes/front_end.php CHANGED
@@ -54,6 +54,7 @@ class wpdevart_countdown_front_end{
54
  "text_for_minut" => "Minutes",
55
  "text_for_second" => "Seconds",
56
  "start_time" => mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y")),
 
57
  "countdown_end_type" => "time",
58
  "hide_on_mobile" => "show",
59
  "end_date" => date('d-m-Y 23:59'),
@@ -77,7 +78,7 @@ class wpdevart_countdown_front_end{
77
  $time_diferent=$curent_time-mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y"));
78
  }else{
79
  $time_experit=explode(',',$curent_value['end_time']);
80
- $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"));
81
  }
82
  $day_left=(int)($time_diferent/(3600*24));
83
  $hourse_left=(int)(($time_diferent-$day_left*24*3600)/(3600));
@@ -119,7 +120,7 @@ class wpdevart_countdown_front_end{
119
  $time_diferent=$curent_time-mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y"));
120
  }else{
121
  $time_experit=explode(',',$parametrs_for_countedown['end_time']);
122
- $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"));
123
  }
124
  $day_left=(int)($time_diferent/(3600*24));
125
  $hourse_left=(int)(($time_diferent-$day_left*24*3600)/(3600));
@@ -137,11 +138,26 @@ class wpdevart_countdown_front_end{
137
  if($parametrs_for_countedown['action_end_time']=='hide'){
138
  $parametrs_for_countedown['content']='';
139
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  $output_js.="
141
  document.addEventListener('DOMContentLoaded', function(event) {
142
- ".((($day_left<=0 && $hourse_left<=0 && $minuts_left<=0 && $seconds_left<=0))?"jQuery('#main_countedown_".self::$id_for_content." .countdown').html('".htmlspecialchars($parametrs_for_countedown['content'])."')":"setInterval(function(){countdown_wpdevart_timer('main_countedown_".self::$id_for_content."');},1000)")."
143
- });
144
- ";
145
  return $output_js;
146
  }
147
 
54
  "text_for_minut" => "Minutes",
55
  "text_for_second" => "Seconds",
56
  "start_time" => mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y")),
57
+ "redirect_url" => get_home_url(),
58
  "countdown_end_type" => "time",
59
  "hide_on_mobile" => "show",
60
  "end_date" => date('d-m-Y 23:59'),
78
  $time_diferent=$curent_time-mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y"));
79
  }else{
80
  $time_experit=explode(',',$curent_value['end_time']);
81
+ $time_diferent=(int)$time_experit[0]*24*3600+(int)+(int)$time_experit[1]*3600+(int)$time_experit[2]*60+(int)$curent_value['start_time']-mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y"));
82
  }
83
  $day_left=(int)($time_diferent/(3600*24));
84
  $hourse_left=(int)(($time_diferent-$day_left*24*3600)/(3600));
120
  $time_diferent=$curent_time-mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y"));
121
  }else{
122
  $time_experit=explode(',',$parametrs_for_countedown['end_time']);
123
+ $time_diferent=(int)$time_experit[0]*24*3600+(int)+(int)$time_experit[1]*3600+(int)$time_experit[2]*60+(int)$parametrs_for_countedown['start_time']-mktime (date("H"), date("i"), date("s"),date("n"), date("j"),date("Y"));
124
  }
125
  $day_left=(int)($time_diferent/(3600*24));
126
  $hourse_left=(int)(($time_diferent-$day_left*24*3600)/(3600));
138
  if($parametrs_for_countedown['action_end_time']=='hide'){
139
  $parametrs_for_countedown['content']='';
140
  }
141
+ $output_js_code='';
142
+
143
+ if(($day_left<=0 && $hourse_left<=0 && $minuts_left<=0 && $seconds_left<=0)){
144
+ if($parametrs_for_countedown['action_end_time']=='redirct'){
145
+ $output_js_code="window.location.replace('".$parametrs_for_countedown['redirect_url']."')";
146
+ }
147
+ elseif($parametrs_for_countedown['action_end_time']=='show_text'){
148
+ $output_js_code="jQuery('#main_countedown_".self::$id_for_content." .countdown').html('".htmlspecialchars($parametrs_for_countedown['content'])."')";
149
+ }
150
+ else{
151
+ $output_js_code="jQuery('#main_countedown_".self::$id_for_content." .countdown').html('')";
152
+ }
153
+ }else{
154
+ $output_js_code="setInterval(function(){countdown_wpdevart_timer('main_countedown_".self::$id_for_content."');},1000);";
155
+
156
+ }
157
  $output_js.="
158
  document.addEventListener('DOMContentLoaded', function(event) {
159
+ ".$output_js_code."
160
+ });";
 
161
  return $output_js;
162
  }
163
 
includes/gutenberg/block.js CHANGED
@@ -81,6 +81,11 @@
81
  value: "",
82
  default: ""
83
  },
 
 
 
 
 
84
  countdown_in_content_position:{
85
  type: 'string',
86
  value: "center",
@@ -194,8 +199,10 @@
194
  wpda_countdown_fields.push(wpda_countdown_lb_days_hourse_minutes("countdownday","countdownhour","countdownminute","Countdown expire time","Type the Countdown expire time.",false,aditional_css_for_countdownday));
195
  wpda_countdown_fields.push(wpda_countdown_lb_calendar_input("countdown_experet_date","Countdown expire date","Type the Countdown expire date.",false,aditional_css_countdown_experet_date));
196
  wpda_countdown_fields.push(wpda_countdown_lb_simple_select("countdown_hide_on_mobile",hide_on_mobile_divace,"Show/Hide countdown on mobile devices","This option allow to show or hide countdown on mobile devices."));
197
- wpda_countdown_fields.push(wpda_countdown_lb_simple_select("countdownstart_on",{"hide":"Hide countdown","show_text":"Show text"},"After Countdown expire","Select the action you prefere after Countdown time expire.",false,{color:'red'}));
198
  wpda_countdown_fields.push(wpda_countdown_lb_simple_textarea("expeiret_text","Message after countdown expire","Type the message that will appear after countdown time expire."));
 
 
199
  wpda_countdown_fields.push(wpda_countdown_lb_simple_select("countdown_in_content_position",{"left":"Left","center":"Center","right":"Right"},"Countdown timer position","Select the Countdown Timer position."));
200
  wpda_countdown_fields.push(wpda_countdown_lb_simple_input_with_small("countdown_top_distance","Countdown distance from top","Type the Countdown distance from top(px).","(px)"));
201
  wpda_countdown_fields.push(wpda_countdown_lb_simple_input_with_small("countdown_bottom_distance","Countdown distance from bottom","Type the Countdown distance from bottom(px).","(px)"));
@@ -430,6 +437,8 @@
430
  shortcode_atributes = shortcode_atributes + ' content_position="' + props.attributes.countdown_in_content_position + '"';
431
  shortcode_atributes = shortcode_atributes + ' top_ditance="' + props.attributes.countdown_top_distance + '"';
432
  shortcode_atributes = shortcode_atributes + ' bottom_distance="' + props.attributes.countdown_bottom_distance + '"';
 
 
433
  shortcode_atributes = shortcode_atributes + ' countdown_type="button"';
434
  shortcode_atributes = shortcode_atributes + ' font_color="#000000"';
435
  shortcode_atributes = shortcode_atributes + ' button_bg_color="#3DA8CC"';
@@ -439,6 +448,7 @@
439
  shortcode_atributes = shortcode_atributes + ' font_size="30"';
440
  shortcode_atributes = shortcode_atributes + ' countdown_font_famaly="monospace"';
441
  shortcode_atributes = shortcode_atributes + ' animation_type=""';
 
442
  return "[wpdevart_countdown "+shortcode_atributes+"]"+props.attributes.expeiret_text+"[/wpdevart_countdown]";
443
  }
444
 
81
  value: "",
82
  default: ""
83
  },
84
+ redirect_url:{
85
+ type: 'string',
86
+ value: "",
87
+ default: ""
88
+ },
89
  countdown_in_content_position:{
90
  type: 'string',
91
  value: "center",
199
  wpda_countdown_fields.push(wpda_countdown_lb_days_hourse_minutes("countdownday","countdownhour","countdownminute","Countdown expire time","Type the Countdown expire time.",false,aditional_css_for_countdownday));
200
  wpda_countdown_fields.push(wpda_countdown_lb_calendar_input("countdown_experet_date","Countdown expire date","Type the Countdown expire date.",false,aditional_css_countdown_experet_date));
201
  wpda_countdown_fields.push(wpda_countdown_lb_simple_select("countdown_hide_on_mobile",hide_on_mobile_divace,"Show/Hide countdown on mobile devices","This option allow to show or hide countdown on mobile devices."));
202
+ wpda_countdown_fields.push(wpda_countdown_lb_simple_select("countdownstart_on",{"hide":"Hide countdown","show_text":"Show text","redirect":"Redirect"},"After Countdown expire","Select the action you prefere after Countdown time expire.",false,{color:'red'}));
203
  wpda_countdown_fields.push(wpda_countdown_lb_simple_textarea("expeiret_text","Message after countdown expire","Type the message that will appear after countdown time expire."));
204
+ wpda_countdown_fields.push(wpda_countdown_lb_simple_input("redirect_url","Redirect URL","Type here redirect URL."));
205
+
206
  wpda_countdown_fields.push(wpda_countdown_lb_simple_select("countdown_in_content_position",{"left":"Left","center":"Center","right":"Right"},"Countdown timer position","Select the Countdown Timer position."));
207
  wpda_countdown_fields.push(wpda_countdown_lb_simple_input_with_small("countdown_top_distance","Countdown distance from top","Type the Countdown distance from top(px).","(px)"));
208
  wpda_countdown_fields.push(wpda_countdown_lb_simple_input_with_small("countdown_bottom_distance","Countdown distance from bottom","Type the Countdown distance from bottom(px).","(px)"));
437
  shortcode_atributes = shortcode_atributes + ' content_position="' + props.attributes.countdown_in_content_position + '"';
438
  shortcode_atributes = shortcode_atributes + ' top_ditance="' + props.attributes.countdown_top_distance + '"';
439
  shortcode_atributes = shortcode_atributes + ' bottom_distance="' + props.attributes.countdown_bottom_distance + '"';
440
+ if(props.attributes.redirect_url)
441
+ shortcode_atributes = shortcode_atributes + ' redirect_url="' + props.attributes.redirect_url + '"';
442
  shortcode_atributes = shortcode_atributes + ' countdown_type="button"';
443
  shortcode_atributes = shortcode_atributes + ' font_color="#000000"';
444
  shortcode_atributes = shortcode_atributes + ' button_bg_color="#3DA8CC"';
448
  shortcode_atributes = shortcode_atributes + ' font_size="30"';
449
  shortcode_atributes = shortcode_atributes + ' countdown_font_famaly="monospace"';
450
  shortcode_atributes = shortcode_atributes + ' animation_type=""';
451
+
452
  return "[wpdevart_countdown "+shortcode_atributes+"]"+props.attributes.expeiret_text+"[/wpdevart_countdown]";
453
  }
454
 
includes/widget.php CHANGED
@@ -46,6 +46,7 @@ class wpdevart_countdown extends WP_Widget {
46
  $instance['start_time'] = $new_instance['start_time'];
47
  $instance['content'] = $new_instance['content'];
48
  $instance['action_end_time'] = $new_instance['action_end_time'];
 
49
  $instance['content_position'] = $new_instance['content_position'];
50
  $instance['top_ditance'] = $new_instance['top_ditance'];
51
  $instance['bottom_distance'] = $new_instance['bottom_distance'];
@@ -68,7 +69,8 @@ class wpdevart_countdown extends WP_Widget {
68
  'end_time' => '0,9,9',
69
  'end_time_date' => date('d-m-Y 23:59'),
70
  'action_end_time' => 'hide',
71
- 'content' => '',
 
72
  'content_position' => 'center',
73
  'top_ditance' => '11',
74
  'bottom_distance' => '11',
@@ -183,6 +185,7 @@ class wpdevart_countdown extends WP_Widget {
183
  <br>
184
  <select id="<?php echo $this->get_field_id('action_end_time'); ?>" name="<?php echo $this->get_field_name('action_end_time'); ?>">
185
  <option <?php selected('show_text',$instance['action_end_time']) ?> value="show_text">Show text</option>
 
186
  <option <?php selected('hide',$instance['action_end_time']) ?> value="hide">Hide Timer</option>
187
  </select>
188
  </p>
@@ -192,6 +195,11 @@ class wpdevart_countdown extends WP_Widget {
192
  <br>
193
  <textarea type="text" id="<?php echo $this->get_field_id('content'); ?>" name="<?php echo $this->get_field_name('content'); ?>"><?php echo $instance['content']; ?></textarea>
194
  </p>
 
 
 
 
 
195
 
196
  <p class="flb_field">
197
  <label>Countdown position: </label>
@@ -362,15 +370,27 @@ class wpdevart_countdown extends WP_Widget {
362
 
363
  /************************** JS Output Code ************************************/
364
  $output_js='';
365
-
366
- if($parametrs['action_end_time']=='hide'){
367
- $parametrs['content']='';
 
 
 
 
 
 
 
 
 
 
 
 
 
368
  }
369
  $output_js.="
370
  document.addEventListener('DOMContentLoaded', function(event) {
371
- ".((($day_left<=0 && $hourse_left<=0 && $minuts_left<=0 && $seconds_left<=0))?"jQuery('#main_countedown_widget_".self::$id_for_content." .countdown').html('".htmlspecialchars($parametrs['content'])."')":"setInterval(function(){countdown_wpdevart_timer('main_countedown_widget_".self::$id_for_content."');},1000)")."
372
- });
373
- ";
374
 
375
  /************************** CSS Output Code ***********************************/
376
 
46
  $instance['start_time'] = $new_instance['start_time'];
47
  $instance['content'] = $new_instance['content'];
48
  $instance['action_end_time'] = $new_instance['action_end_time'];
49
+ $instance['redirect_url'] = $new_instance['redirect_url'];
50
  $instance['content_position'] = $new_instance['content_position'];
51
  $instance['top_ditance'] = $new_instance['top_ditance'];
52
  $instance['bottom_distance'] = $new_instance['bottom_distance'];
69
  'end_time' => '0,9,9',
70
  'end_time_date' => date('d-m-Y 23:59'),
71
  'action_end_time' => 'hide',
72
+ 'redirect_url' => get_home_url(),
73
+ 'content' => '',
74
  'content_position' => 'center',
75
  'top_ditance' => '11',
76
  'bottom_distance' => '11',
185
  <br>
186
  <select id="<?php echo $this->get_field_id('action_end_time'); ?>" name="<?php echo $this->get_field_name('action_end_time'); ?>">
187
  <option <?php selected('show_text',$instance['action_end_time']) ?> value="show_text">Show text</option>
188
+ <option <?php selected('redirect',$instance['action_end_time']) ?> value="redirect">Redirect</option>
189
  <option <?php selected('hide',$instance['action_end_time']) ?> value="hide">Hide Timer</option>
190
  </select>
191
  </p>
195
  <br>
196
  <textarea type="text" id="<?php echo $this->get_field_id('content'); ?>" name="<?php echo $this->get_field_name('content'); ?>"><?php echo $instance['content']; ?></textarea>
197
  </p>
198
+ <p class="flb_field">
199
+ <label for="<?php echo $this->get_field_id('redirect_url'); ?>">Redirect URL:</label>
200
+ <br>
201
+ <input id="<?php echo $this->get_field_id('redirect_url'); ?>" name="<?php echo $this->get_field_name('redirect_url'); ?>" type="text" value="<?php echo $instance['redirect_url']; ?>" class="widefat">
202
+ </p>
203
 
204
  <p class="flb_field">
205
  <label>Countdown position: </label>
370
 
371
  /************************** JS Output Code ************************************/
372
  $output_js='';
373
+
374
+ $output_js_code='';
375
+
376
+ if(($day_left<=0 && $hourse_left<=0 && $minuts_left<=0 && $seconds_left<=0)){
377
+ if($parametrs['action_end_time']=='redirect'){
378
+ $output_js_code="window.location.replace('".$parametrs['redirect_url']."')";
379
+ }
380
+ elseif($parametrs['action_end_time']=='show_text'){
381
+ $output_js_code="jQuery('#main_countedown_widget_".self::$id_for_content." .countdown').html('".htmlspecialchars($parametrs['content'])."')";
382
+ }
383
+ else{
384
+ $output_js_code="jQuery('#main_countedown_widget_".self::$id_for_content." .countdown').html('')";
385
+ }
386
+ }else{
387
+ $output_js_code="setInterval(function(){countdown_wpdevart_timer('main_countedown_widget_".self::$id_for_content."');},1000);";
388
+
389
  }
390
  $output_js.="
391
  document.addEventListener('DOMContentLoaded', function(event) {
392
+ ".$output_js_code."
393
+ });";
 
394
 
395
  /************************** CSS Output Code ***********************************/
396
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: wpdevart
3
  Donate link: http://wpdevart.com/wordpress-countdown-plugin
4
  Tags: countdown, countdown widget, countdown timer, countdown system, countdown generator
5
  Requires at least: 3.3.0
6
- Tested up to: 5.4
7
- Stable tag: 2.1.4
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -498,6 +498,10 @@ Yes dear users, you need to pay only one time for pro version, it's lifetime pla
498
 
499
  * Bug fixed.
500
 
 
 
 
 
501
  == Step by step guide ==
502
 
503
  ### Options
3
  Donate link: http://wpdevart.com/wordpress-countdown-plugin
4
  Tags: countdown, countdown widget, countdown timer, countdown system, countdown generator
5
  Requires at least: 3.3.0
6
+ Tested up to: 5.4.1
7
+ Stable tag: 2.1.5
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
498
 
499
  * Bug fixed.
500
 
501
+ = 2.1.5 =
502
+
503
+ * Added new functionality - Redirect.
504
+
505
  == Step by step guide ==
506
 
507
  ### 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: Countdown plugin is an nice tool to create and insert countdown timers into your posts/pages and widgets .
6
- Version: 2.1.4
7
  Author: wpdevart
8
  Author URI: http://wpdevart.com
9
  License: GPL3 http://www.gnu.org/licenses/gpl-3.0.html
3
  Plugin Name: Countdown Wpdevart
4
  Plugin URI: http://wpdevart.com/wordpress-countdown-plugin/
5
  Description: Countdown plugin is an nice tool to create and insert countdown timers into your posts/pages and widgets .
6
+ Version: 2.1.5
7
  Author: wpdevart
8
  Author URI: http://wpdevart.com
9
  License: GPL3 http://www.gnu.org/licenses/gpl-3.0.html