Countdown, Coming Soon – Countdown & Clock - Version 1.5.2

Version Description

  • Enable Timer Button (new)
  • Enable/Disable auto counting
  • Timer button start label
  • Timer button stop label
Download this release

Release Info

Developer adamskaat
Plugin Icon 128x128 Countdown, Coming Soon – Countdown & Clock
Version 1.5.2
Comparing to
See all releases

Code changes from version 1.5.1 to 1.5.2

assets/css/timer.css CHANGED
@@ -20,3 +20,8 @@
20
  color: #333;
21
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
22
  }
 
 
 
 
 
20
  color: #333;
21
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
22
  }
23
+
24
+ .ycd-timmer-buttons {
25
+ margin-top: 10px;
26
+ text-align: center;
27
+ }
assets/js/ycdTimer.js CHANGED
@@ -26,7 +26,11 @@ YcdTimer.prototype.init = function() {
26
  this.gMinutes = settings['minutes'];
27
  this.gSeconds = settings['seconds'];
28
 
 
29
  this.resetTimer();
 
 
 
30
  this.startTimer();
31
 
32
  jQuery('#shortButton').removeClass('btn-success');
@@ -135,6 +139,27 @@ YcdTimer.prototype.endBehavior = function() {
135
  }
136
  };
137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  YcdTimer.prototype.startTimer = function() {
139
  var that = this;
140
  this.countdownHandle = setInterval(function() {
26
  this.gMinutes = settings['minutes'];
27
  this.gSeconds = settings['seconds'];
28
 
29
+ this.buttonListener();
30
  this.resetTimer();
31
+ if (settings['timerButton'] && settings['autoCounting'] == '') {
32
+ return '';
33
+ }
34
  this.startTimer();
35
 
36
  jQuery('#shortButton').removeClass('btn-success');
139
  }
140
  };
141
 
142
+ YcdTimer.prototype.buttonListener = function () {
143
+ var id = this.getId();
144
+ var that = this;
145
+ var button = jQuery('.ycd-timer-start-stop-'+id);
146
+
147
+ button.bind('click', function () {
148
+ var status = jQuery(this).data('status');
149
+ var title = status ? jQuery(this).data('start') : jQuery(this).data('stop');
150
+ jQuery(this).text(title);
151
+ status = status ? 0: 1;
152
+
153
+ if (!status) {
154
+ clearInterval(that.countdownHandle);
155
+ }
156
+ else {
157
+ that.startTimer();
158
+ }
159
+ jQuery(this).data('status', status);
160
+ });
161
+ };
162
+
163
  YcdTimer.prototype.startTimer = function() {
164
  var that = this;
165
  this.countdownHandle = setInterval(function() {
assets/views/timerMainView.php CHANGED
@@ -27,6 +27,46 @@ $textFontFamily = $this->getOptionValue('ycd-text-font-family');
27
  <input type="number" name="ycd-timer-seconds" id="ycdTimeSeconds" min="0" max="60" class="form-control ycd-timer-time-settings" data-type="seconds" value="<?php echo esc_attr($this->getOptionValue('ycd-timer-seconds'))?>">
28
  </div>
29
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  <div class="row form-group">
31
  <div class="col-md-6">
32
  <label for="ycd-countdown-end-sound" class="ycd-label-of-switch"><?php _e('Timer End Sound', YCD_TEXT_DOMAIN); ?></label>
27
  <input type="number" name="ycd-timer-seconds" id="ycdTimeSeconds" min="0" max="60" class="form-control ycd-timer-time-settings" data-type="seconds" value="<?php echo esc_attr($this->getOptionValue('ycd-timer-seconds'))?>">
28
  </div>
29
  </div>
30
+ <div class="row form-group">
31
+ <div class="col-md-6">
32
+ <label for="ycd-countdown-timer-button" class="ycd-label-of-switch"><?php _e('Enable Button', YCD_TEXT_DOMAIN); ?></label>
33
+ </div>
34
+ <div class="col-md-6">
35
+ <label class="ycd-switch">
36
+ <input type="checkbox" id="ycd-countdown-timer-button" name="ycd-countdown-timer-button" class="ycd-accordion-checkbox" <?php echo $this->getOptionValue('ycd-countdown-timer-button'); ?>>
37
+ <span class="ycd-slider ycd-round"></span>
38
+ </label>
39
+ </div>
40
+ </div>
41
+ <div class="ycd-accordion-content ycd-hide-content">
42
+ <div class="row form-group">
43
+ <div class="col-md-6">
44
+ <label for="ycd-timer-auto-counting" ><?php _e('enable autocounting', YCD_TEXT_DOMAIN); ?></label>
45
+ </div>
46
+ <div class="col-md-4 ycd-timer-font-size">
47
+ <label class="ycd-switch">
48
+ <input type="checkbox" id="ycd-timer-auto-counting" name="ycd-timer-auto-counting" class="ycd-accordion-checkbox" <?php echo $this->getOptionValue('ycd-timer-auto-counting'); ?>>
49
+ <span class="ycd-slider ycd-round"></span>
50
+ </label>
51
+ </div>
52
+ </div>
53
+ <div class="row form-group">
54
+ <div class="col-md-6">
55
+ <label for="ycd-timer-button-start-title" ><?php _e('start title', YCD_TEXT_DOMAIN); ?></label>
56
+ </div>
57
+ <div class="col-md-4 ycd-timer-font-size">
58
+ <input id="ycd-timer-button-start-title" type="text" class="form-control" name="ycd-timer-button-start-title" value="<?php echo esc_attr($this->getOptionValue('ycd-timer-button-start-title')); ?>">
59
+ </div>
60
+ </div>
61
+ <div class="row form-group">
62
+ <div class="col-md-6">
63
+ <label for="ycd-timer-button-stop-title" ><?php _e('stop title', YCD_TEXT_DOMAIN); ?></label>
64
+ </div>
65
+ <div class="col-md-4 ycd-timer-font-size">
66
+ <input id="ycd-timer-button-stop-title" type="text" class="form-control" name="ycd-timer-button-stop-title" value="<?php echo esc_attr($this->getOptionValue('ycd-timer-button-stop-title')); ?>">
67
+ </div>
68
+ </div>
69
+ </div>
70
  <div class="row form-group">
71
  <div class="col-md-6">
72
  <label for="ycd-countdown-end-sound" class="ycd-label-of-switch"><?php _e('Timer End Sound', YCD_TEXT_DOMAIN); ?></label>
classes/countdown/Countdown.php CHANGED
@@ -263,6 +263,10 @@ abstract class Countdown {
263
  public static function parseCountdownDataFromData($data) {
264
  $cdData = array();
265
 
 
 
 
 
266
  foreach ($data as $key => $value) {
267
  if (strpos($key, 'ycd') === 0) {
268
  $cdData[$key] = $value;
263
  public static function parseCountdownDataFromData($data) {
264
  $cdData = array();
265
 
266
+ if (empty($data)) {
267
+ return $cdData;
268
+ }
269
+
270
  foreach ($data as $key => $value) {
271
  if (strpos($key, 'ycd') === 0) {
272
  $cdData[$key] = $value;
classes/countdown/TimerCountdown.php CHANGED
@@ -54,7 +54,9 @@ class TimerCountdown extends Countdown {
54
  $options['hours'] = $this->getOptionValue('ycd-timer-hours');
55
  $options['minutes'] = $this->getOptionValue('ycd-timer-minutes');
56
  $options['seconds'] = $this->getOptionValue('ycd-timer-seconds');
57
-
 
 
58
  return array_merge($options, $allDataOptions);
59
  }
60
 
@@ -106,6 +108,12 @@ class TimerCountdown extends Countdown {
106
  $id = $this->getId();
107
  $options = $this->getTimerSettings();
108
  $options = json_encode($options);
 
 
 
 
 
 
109
  ob_start();
110
  ?>
111
  <div class="ycd-countdown-wrapper ycd-timer-content-wrapper-<?php echo esc_attr($id); ?>">
@@ -117,6 +125,11 @@ class TimerCountdown extends Countdown {
117
  <span id="ycdHoursNext"class="ycd-hours-next-value-<?php echo esc_attr($id); ?>">00</span><span>:</span><span id="ycdMinutesNext" class="ycd-minutes-next-value-<?php echo esc_attr($id); ?>">00</span><span>:</span><span id="ycdSecondsNext" class="ycd-seconds-next-value-<?php echo esc_attr($id); ?>">00</span>
118
  </div>
119
  </div>
 
 
 
 
 
120
  <?php echo $this->renderSubscriptionForm(); ?>
121
  <?php echo $this->renderProgressBar(); ?>
122
  </div>
54
  $options['hours'] = $this->getOptionValue('ycd-timer-hours');
55
  $options['minutes'] = $this->getOptionValue('ycd-timer-minutes');
56
  $options['seconds'] = $this->getOptionValue('ycd-timer-seconds');
57
+ $options['autoCounting'] = $this->getOptionValue('ycd-timer-auto-counting');
58
+ $options['timerButton'] = $this->getOptionValue('ycd-countdown-timer-button');
59
+
60
  return array_merge($options, $allDataOptions);
61
  }
62
 
108
  $id = $this->getId();
109
  $options = $this->getTimerSettings();
110
  $options = json_encode($options);
111
+ $timerButton = $this->getOptionValue('ycd-countdown-timer-button');
112
+
113
+ $startTitle = $this->getOptionValue('ycd-timer-button-start-title');
114
+ $stopTitle = $this->getOptionValue('ycd-timer-button-stop-title');
115
+ $autoCounting = (bool)$this->getOptionValue('ycd-timer-auto-counting');
116
+ $buttonTitle = ($autoCounting) ? $stopTitle: $startTitle;
117
  ob_start();
118
  ?>
119
  <div class="ycd-countdown-wrapper ycd-timer-content-wrapper-<?php echo esc_attr($id); ?>">
125
  <span id="ycdHoursNext"class="ycd-hours-next-value-<?php echo esc_attr($id); ?>">00</span><span>:</span><span id="ycdMinutesNext" class="ycd-minutes-next-value-<?php echo esc_attr($id); ?>">00</span><span>:</span><span id="ycdSecondsNext" class="ycd-seconds-next-value-<?php echo esc_attr($id); ?>">00</span>
126
  </div>
127
  </div>
128
+ <?php if (!empty($timerButton)): ?>
129
+ <div class="ycd-timmer-buttons ycd-timmer-buttons-<?php echo esc_attr($id); ?>">
130
+ <button class="ycd-timer-start-stop ycd-timer-start-stop-<?php echo esc_attr($id); ?>" data-status="<?php echo esc_attr($autoCounting); ?>" data-start="<?php echo esc_attr($startTitle); ?>" data-stop="<?php echo esc_attr($stopTitle);?>"><?php echo esc_attr($buttonTitle); ?></button>
131
+ </div>
132
+ <?php endif; ?>
133
  <?php echo $this->renderSubscriptionForm(); ?>
134
  <?php echo $this->renderProgressBar(); ?>
135
  </div>
config/optionsConfig.php CHANGED
@@ -211,6 +211,10 @@ class YcdCountdownOptionsConfig {
211
  $options[] = array('name' => 'ycd-countdown-display-on', 'type' => 'checkbox', 'defaultValue' => '');
212
  $options[] = array('name' => 'ycd-position-countdown', 'type' => 'text', 'defaultValue' => 'top_center');
213
  $options[] = array('name' => 'ycd-countdown-clock-mode', 'type' => 'text', 'defaultValue' => 'clock');
 
 
 
 
214
 
215
  $YCD_OPTIONS = apply_filters('ycdCountdownDefaultOptions', $options);
216
  }
211
  $options[] = array('name' => 'ycd-countdown-display-on', 'type' => 'checkbox', 'defaultValue' => '');
212
  $options[] = array('name' => 'ycd-position-countdown', 'type' => 'text', 'defaultValue' => 'top_center');
213
  $options[] = array('name' => 'ycd-countdown-clock-mode', 'type' => 'text', 'defaultValue' => 'clock');
214
+ $options[] = array('name' => 'ycd-countdown-timer-button', 'type' => 'checkbox', 'defaultValue' => '');
215
+ $options[] = array('name' => 'ycd-timer-auto-counting', 'type' => 'checkbox', 'defaultValue' => 'on');
216
+ $options[] = array('name' => 'ycd-timer-button-start-title', 'type' => 'text', 'defaultValue' => __('Start', YCD_TEXT_DOMAIN));
217
+ $options[] = array('name' => 'ycd-timer-button-stop-title', 'type' => 'text', 'defaultValue' => __('Stop', YCD_TEXT_DOMAIN));
218
 
219
  $YCD_OPTIONS = apply_filters('ycdCountdownDefaultOptions', $options);
220
  }
countdown-builder.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Countdown builder
4
  * Description: The best countdown plugin
5
- * Version: 1.5.1
6
  * Author: Adam Skaat
7
  * Author URI: https://edmonsoft.com/countdown
8
  * License: GPLv2
2
  /**
3
  * Plugin Name: Countdown builder
4
  * Description: The best countdown plugin
5
+ * Version: 1.5.2
6
  * Author: Adam Skaat
7
  * Author URI: https://edmonsoft.com/countdown
8
  * License: GPLv2
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: adamskaat
3
  Tags: countdown, timer, countdown timer
4
  Requires at least: 3.8
5
  Tested up to: 5.2.2
6
- Stable tag: 1.5.1
7
  Requires PHP: 5.3
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -64,9 +64,15 @@ You need to select the .zip file, there is no need to extract the zip file, just
64
 
65
 
66
  == Changelog ==
 
 
 
 
 
 
67
  = 1.5.1 =
68
  * Display countdown on all custom post
69
- * Display countdown on selected custost
70
  * Code optimization
71
  * Backend functions improvement
72
  * Bug fixed
3
  Tags: countdown, timer, countdown timer
4
  Requires at least: 3.8
5
  Tested up to: 5.2.2
6
+ Stable tag: 1.5.2
7
  Requires PHP: 5.3
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
64
 
65
 
66
  == Changelog ==
67
+ = 1.5.2 =
68
+ * Enable Timer Button (new)
69
+ * Enable/Disable auto counting
70
+ * Timer button start label
71
+ * Timer button stop label
72
+
73
  = 1.5.1 =
74
  * Display countdown on all custom post
75
+ * Display countdown on selected custom post
76
  * Code optimization
77
  * Backend functions improvement
78
  * Bug fixed