Version Description
- Simple countdown new type
Download this release
Release Info
Developer | adamskaat |
Plugin | Countdown, Coming Soon – Countdown & Clock |
Version | 1.9.4 |
Comparing to | |
See all releases |
Code changes from version 1.9.3 to 1.9.4
- assets/css/admin.css +5 -0
- assets/css/simpleCountdown.css +32 -0
- assets/img/simpleCountdown.png +0 -0
- assets/js/YcdGeneral.js +13 -0
- assets/js/YcdSimpleCountdown.js +132 -0
- assets/views/main/simpleMainView.php +122 -0
- classes/countdown/Countdown.php +1 -0
- classes/countdown/SimpleCountdown.php +163 -0
- config/config.php +2 -2
- config/optionsConfig.php +44 -31
- countdown-builder.php +1 -1
- helpers/ScriptsIncluder.php +9 -0
- readme.txt +6 -1
assets/css/admin.css
CHANGED
@@ -38,6 +38,11 @@
|
|
38 |
background-size: 100% 100%;
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
41 |
.clock1-countdown {
|
42 |
background-image: url("../img/clock1.png");
|
43 |
background-size: 100% 100%;
|
38 |
background-size: 100% 100%;
|
39 |
}
|
40 |
|
41 |
+
.simple-countdown {
|
42 |
+
background-image: url("../img/simpleCountdown.png");
|
43 |
+
background-size: 100% 100%;
|
44 |
+
}
|
45 |
+
|
46 |
.clock1-countdown {
|
47 |
background-image: url("../img/clock1.png");
|
48 |
background-size: 100% 100%;
|
assets/css/simpleCountdown.css
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.ycd-hide {
|
2 |
+
display: none !important;
|
3 |
+
}
|
4 |
+
|
5 |
+
.ycd-simple-current-unite {
|
6 |
+
display: inline-block;
|
7 |
+
}
|
8 |
+
|
9 |
+
.ycd-simple-countdown-time {
|
10 |
+
line-height: 1;
|
11 |
+
}
|
12 |
+
|
13 |
+
.ycd-simple-timer-dots {
|
14 |
+
display: inline-block;
|
15 |
+
vertical-align: top !important;
|
16 |
+
line-height: 1;
|
17 |
+
margin: 0 5px;
|
18 |
+
}
|
19 |
+
|
20 |
+
.ycd-simple-current-unite-wrapper {
|
21 |
+
display: inline-block;
|
22 |
+
vertical-align: top;
|
23 |
+
}
|
24 |
+
|
25 |
+
.ycd-simple-countdown-number, .ycd-simple-timer-dots {
|
26 |
+
font-size: 35px;
|
27 |
+
}
|
28 |
+
|
29 |
+
.ycd-simple-countdown-label {
|
30 |
+
font-size: 12px;
|
31 |
+
text-align: center;
|
32 |
+
}
|
assets/img/simpleCountdown.png
ADDED
Binary file
|
assets/js/YcdGeneral.js
CHANGED
@@ -45,6 +45,19 @@ YcgGeneral.prototype.getSeconds = function (options) {
|
|
45 |
return seconds;
|
46 |
};
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
YcgGeneral.prototype.countDurationSeconds = function (options) {
|
49 |
var days = parseInt(options['ycd-countdown-duration-days']);
|
50 |
var hours = parseInt(options['ycd-countdown-duration-hours']);
|
45 |
return seconds;
|
46 |
};
|
47 |
|
48 |
+
YcgGeneral.prototype.setCounterTime = function(calendarValue, selectedTimezone) {
|
49 |
+
var currentDate = ycdmoment(new Date()).tz(selectedTimezone).format('MM-DD-YYYY H:m:s');
|
50 |
+
|
51 |
+
var dateTime = new Date(currentDate).valueOf();
|
52 |
+
var timeNow = Math.floor(dateTime / 1000);
|
53 |
+
var seconds = Math.floor(new Date(calendarValue).getTime() / 1000) - timeNow;
|
54 |
+
if (seconds < 0) {
|
55 |
+
seconds = 0;
|
56 |
+
}
|
57 |
+
|
58 |
+
return seconds;
|
59 |
+
};
|
60 |
+
|
61 |
YcgGeneral.prototype.countDurationSeconds = function (options) {
|
62 |
var days = parseInt(options['ycd-countdown-duration-days']);
|
63 |
var hours = parseInt(options['ycd-countdown-duration-hours']);
|
assets/js/YcdSimpleCountdown.js
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function YcdSimpleCountdown()
|
2 |
+
{
|
3 |
+
this.seconds = 0;
|
4 |
+
}
|
5 |
+
|
6 |
+
YcdSimpleCountdown.prototype = new YcgGeneral();
|
7 |
+
|
8 |
+
YcdSimpleCountdown.run = function()
|
9 |
+
{
|
10 |
+
var simpleCountdown = jQuery('.ycd-simple-container');
|
11 |
+
|
12 |
+
if (!simpleCountdown.length) {
|
13 |
+
return false;
|
14 |
+
}
|
15 |
+
|
16 |
+
simpleCountdown.each(function () {
|
17 |
+
var options = jQuery(this).data('options');
|
18 |
+
var id = jQuery(this).data('id');
|
19 |
+
var obj = new YcdSimpleCountdown();
|
20 |
+
options['id'] = id;
|
21 |
+
obj.options = options;
|
22 |
+
obj.id = id;
|
23 |
+
obj.init();
|
24 |
+
});
|
25 |
+
};
|
26 |
+
|
27 |
+
YcdSimpleCountdown.prototype.init = function()
|
28 |
+
{
|
29 |
+
this.render();
|
30 |
+
this.livePreview();
|
31 |
+
};
|
32 |
+
|
33 |
+
YcdSimpleCountdown.prototype.livePreview = function()
|
34 |
+
{
|
35 |
+
var adminElement = jQuery('.ycd-simple-text');
|
36 |
+
if (!adminElement.length) {
|
37 |
+
return false;
|
38 |
+
}
|
39 |
+
|
40 |
+
this.changeText();
|
41 |
+
this.changeSwitch();
|
42 |
+
};
|
43 |
+
|
44 |
+
YcdSimpleCountdown.prototype.changeText = function()
|
45 |
+
{
|
46 |
+
var texts = jQuery('.ycd-simple-text');
|
47 |
+
|
48 |
+
texts.bind('input', function () {
|
49 |
+
var unite = jQuery(this).data('time-type');
|
50 |
+
jQuery('.ycd-simple-countdown-'+unite+'-label').html(jQuery(this).val());
|
51 |
+
});
|
52 |
+
};
|
53 |
+
|
54 |
+
YcdSimpleCountdown.prototype.changeSwitch = function()
|
55 |
+
{
|
56 |
+
var status = jQuery('.js-ycd-time-status');
|
57 |
+
|
58 |
+
if (!status.length) {
|
59 |
+
return false;
|
60 |
+
}
|
61 |
+
|
62 |
+
status.bind('change', function () {
|
63 |
+
var currentStatus = jQuery(this).is(':checked');
|
64 |
+
var type = jQuery(this).data('time-type');
|
65 |
+
var wrapper = jQuery('.ycd-simple-current-unite-'+type);
|
66 |
+
if (currentStatus) {
|
67 |
+
wrapper.show();
|
68 |
+
}
|
69 |
+
else {
|
70 |
+
wrapper.hide();
|
71 |
+
}
|
72 |
+
});
|
73 |
+
};
|
74 |
+
|
75 |
+
YcdSimpleCountdown.prototype.render = function()
|
76 |
+
{
|
77 |
+
this.addTimeToClock();
|
78 |
+
this.countdown();
|
79 |
+
};
|
80 |
+
|
81 |
+
YcdSimpleCountdown.prototype.countdown = function()
|
82 |
+
{
|
83 |
+
var unites = ['days', 'hours', 'minutes', 'seconds'];
|
84 |
+
var that = this;
|
85 |
+
var countdownWrapper = jQuery('.ycd-simple-wrapper-'+this.id);
|
86 |
+
var runCountdown = function() {
|
87 |
+
|
88 |
+
// Get today's date and time
|
89 |
+
var now = new Date().getTime();
|
90 |
+
|
91 |
+
// Find the distance between now and the count down date
|
92 |
+
var distance = that.seconds;
|
93 |
+
|
94 |
+
// Time calculations for days, hours, minutes and seconds
|
95 |
+
var unitesValues = {};
|
96 |
+
unitesValues.days = Math.floor(distance / (1000 * 60 * 60 * 24));
|
97 |
+
unitesValues.hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
98 |
+
unitesValues.minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
|
99 |
+
unitesValues.seconds = Math.floor((distance % (1000 * 60)) / 1000);
|
100 |
+
|
101 |
+
for (var i in unites) {
|
102 |
+
var unite = unites[i];
|
103 |
+
var selector = '.ycd-simple-countdown-'+unite+'-time';
|
104 |
+
jQuery(selector).text(unitesValues[unite]);
|
105 |
+
}
|
106 |
+
|
107 |
+
// If the count down is finished, write some text
|
108 |
+
if (distance == 0) {
|
109 |
+
clearInterval(x);
|
110 |
+
that.endBehavior(countdownWrapper, that.options);
|
111 |
+
}
|
112 |
+
that.seconds -= 1000;
|
113 |
+
};
|
114 |
+
runCountdown();
|
115 |
+
|
116 |
+
var x = setInterval(function() {
|
117 |
+
runCountdown();
|
118 |
+
}, 1000);
|
119 |
+
};
|
120 |
+
|
121 |
+
YcdSimpleCountdown.prototype.addTimeToClock = function()
|
122 |
+
{
|
123 |
+
var options = this.options;
|
124 |
+
var seconds = this.getSeconds(options);
|
125 |
+
this.seconds = seconds*1000;
|
126 |
+
this.options['allSeconds'] = seconds;
|
127 |
+
this.savedOptions = this.options;
|
128 |
+
};
|
129 |
+
|
130 |
+
jQuery(document).ready(function() {
|
131 |
+
YcdSimpleCountdown.run();
|
132 |
+
});
|
assets/views/main/simpleMainView.php
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$type = $this->getCurrentTypeFromOptions();
|
3 |
+
?>
|
4 |
+
<div class="ycd-bootstrap-wrapper">
|
5 |
+
<!-- Labels start -->
|
6 |
+
<div class="row form-group">
|
7 |
+
<div class="col-md-6">
|
8 |
+
<label for="ycd-countdown-timer-days" class="ycd-label-of-switch"><?php _e('Labels', YCD_TEXT_DOMAIN); ?></label>
|
9 |
+
</div>
|
10 |
+
<div class="col-md-6">
|
11 |
+
</div>
|
12 |
+
</div>
|
13 |
+
<div class="row form-group">
|
14 |
+
<div class="col-md-6">
|
15 |
+
<!-- Days section start -->
|
16 |
+
<div class="row form-group">
|
17 |
+
<div class="col-md-6">
|
18 |
+
<label for="ycd-simple-enable-days"><?php _e('Days', YCD_TEXT_DOMAIN); ?></label>
|
19 |
+
</div>
|
20 |
+
<div class="col-md-6">
|
21 |
+
<label class="ycd-switch">
|
22 |
+
<input type="checkbox" id="ycd-simple-enable-days" data-time-type="days" name="ycd-simple-enable-days" class="ycd-accordion-checkbox js-ycd-time-status" <?php echo $typeObj->getOptionValue('ycd-simple-enable-days'); ?>>
|
23 |
+
<span class="ycd-slider ycd-round"></span>
|
24 |
+
</label>
|
25 |
+
</div>
|
26 |
+
</div>
|
27 |
+
<div class="ycd-accordion-content ycd-hide-content">
|
28 |
+
<div class="row form-group">
|
29 |
+
<div class="col-md-6">
|
30 |
+
<label for="ycd-simple-days-text"><?php _e('label', YCD_TEXT_DOMAIN); ?></label>
|
31 |
+
</div>
|
32 |
+
<div class="col-md-6">
|
33 |
+
<input type="text" id="ycd-simple-days-text" class="form-control ycd-simple-text" data-time-type="days" name="ycd-simple-days-text" value="<?php echo esc_attr($typeObj->getOptionValue('ycd-simple-days-text')); ?>" >
|
34 |
+
</div>
|
35 |
+
</div>
|
36 |
+
</div>
|
37 |
+
<!-- Days section end -->
|
38 |
+
</div>
|
39 |
+
<div class="col-md-6">
|
40 |
+
<!-- Hours section start -->
|
41 |
+
<div class="row form-group">
|
42 |
+
<div class="col-md-6">
|
43 |
+
<label for="ycd-simple-enable-hours"><?php _e('Hours', YCD_TEXT_DOMAIN); ?></label>
|
44 |
+
</div>
|
45 |
+
<div class="col-md-6">
|
46 |
+
<label class="ycd-switch">
|
47 |
+
<input type="checkbox" id="ycd-simple-enable-hours" data-time-type="hours" name="ycd-simple-enable-hours" class="ycd-accordion-checkbox js-ycd-time-status" <?php echo $typeObj->getOptionValue('ycd-simple-enable-hours'); ?>>
|
48 |
+
<span class="ycd-slider ycd-round"></span>
|
49 |
+
</label>
|
50 |
+
</div>
|
51 |
+
</div>
|
52 |
+
<div class="ycd-accordion-content ycd-hide-content">
|
53 |
+
<div class="row form-group">
|
54 |
+
<div class="col-md-6">
|
55 |
+
<label for="ycd-simple-hours-text"><?php _e('label', YCD_TEXT_DOMAIN); ?></label>
|
56 |
+
</div>
|
57 |
+
<div class="col-md-6">
|
58 |
+
<input type="text" id="ycd-simple-hours-text" class="form-control ycd-simple-text" data-time-type="hours" name="ycd-simple-hours-text" value="<?php echo esc_attr($typeObj->getOptionValue('ycd-simple-hours-text')); ?>" >
|
59 |
+
</div>
|
60 |
+
</div>
|
61 |
+
</div>
|
62 |
+
<!-- Hours section end -->
|
63 |
+
</div>
|
64 |
+
</div>
|
65 |
+
<div class="row form-group">
|
66 |
+
<div class="col-md-6">
|
67 |
+
<!-- Minutes section start -->
|
68 |
+
<div class="row form-group">
|
69 |
+
<div class="col-md-6">
|
70 |
+
<label for="ycd-simple-enable-minutes"><?php _e('Minutes', YCD_TEXT_DOMAIN); ?></label>
|
71 |
+
</div>
|
72 |
+
<div class="col-md-6">
|
73 |
+
<label class="ycd-switch">
|
74 |
+
<input type="checkbox" id="ycd-simple-enable-minutes" data-time-type="minutes" name="ycd-simple-enable-minutes" class="ycd-accordion-checkbox js-ycd-time-status" <?php echo $typeObj->getOptionValue('ycd-simple-enable-minutes'); ?>>
|
75 |
+
<span class="ycd-slider ycd-round"></span>
|
76 |
+
</label>
|
77 |
+
</div>
|
78 |
+
</div>
|
79 |
+
<div class="ycd-accordion-content ycd-hide-content">
|
80 |
+
<div class="row form-group">
|
81 |
+
<div class="col-md-6">
|
82 |
+
<label for="ycd-simple-minutes-text"><?php _e('label', YCD_TEXT_DOMAIN); ?></label>
|
83 |
+
</div>
|
84 |
+
<div class="col-md-6">
|
85 |
+
<input type="text" id="ycd-simple-minutes-text" class="form-control ycd-simple-text" data-time-type="minutes" name="ycd-simple-minutes-text" value="<?php echo esc_attr($typeObj->getOptionValue('ycd-simple-minutes-text')); ?>" >
|
86 |
+
</div>
|
87 |
+
</div>
|
88 |
+
</div>
|
89 |
+
<!-- Minutes section end -->
|
90 |
+
</div>
|
91 |
+
<div class="col-md-6">
|
92 |
+
<!-- Seconds section start -->
|
93 |
+
<div class="row form-group">
|
94 |
+
<div class="col-md-6">
|
95 |
+
<label for="ycd-simple-enable-seconds"><?php _e('Seconds', YCD_TEXT_DOMAIN); ?></label>
|
96 |
+
</div>
|
97 |
+
<div class="col-md-6">
|
98 |
+
<label class="ycd-switch">
|
99 |
+
<input type="checkbox" id="ycd-simple-enable-seconds" data-time-type="seconds" name="ycd-simple-enable-seconds" class="ycd-accordion-checkbox js-ycd-time-status" <?php echo $typeObj->getOptionValue('ycd-simple-enable-seconds'); ?>>
|
100 |
+
<span class="ycd-slider ycd-round"></span>
|
101 |
+
</label>
|
102 |
+
</div>
|
103 |
+
</div>
|
104 |
+
<div class="ycd-accordion-content ycd-hide-content">
|
105 |
+
<div class="row form-group">
|
106 |
+
<div class="col-md-6">
|
107 |
+
<label for="ycd-simple-seconds-text"><?php _e('label', YCD_TEXT_DOMAIN); ?></label>
|
108 |
+
</div>
|
109 |
+
<div class="col-md-6">
|
110 |
+
<input type="text" id="ycd-simple-seconds-text" class="form-control ycd-simple-text" data-time-type="seconds" name="ycd-simple-seconds-text" value="<?php echo esc_attr($typeObj->getOptionValue('ycd-simple-seconds-text')); ?>" >
|
111 |
+
</div>
|
112 |
+
</div>
|
113 |
+
</div>
|
114 |
+
<!-- Seconds section end -->
|
115 |
+
</div>
|
116 |
+
</div>
|
117 |
+
<!-- Labels end -->
|
118 |
+
<?php
|
119 |
+
require_once YCD_VIEWS_PATH.'preview.php';
|
120 |
+
?>
|
121 |
+
</div>
|
122 |
+
<input type="hidden" name="ycd-type" value="<?php echo esc_attr($type); ?>">
|
classes/countdown/Countdown.php
CHANGED
@@ -976,6 +976,7 @@ abstract class Countdown {
|
|
976 |
$options = array();
|
977 |
$isExpired = $this->isExpired();
|
978 |
|
|
|
979 |
$options['ycd-countdown-duration-days'] = $this->getOptionValue('ycd-countdown-duration-days');
|
980 |
$options['ycd-countdown-duration-hours'] = $this->getOptionValue('ycd-countdown-duration-hours');
|
981 |
$options['ycd-countdown-duration-minutes'] = $this->getOptionValue('ycd-countdown-duration-minutes');
|
976 |
$options = array();
|
977 |
$isExpired = $this->isExpired();
|
978 |
|
979 |
+
$options['ycd-countdown-date-type'] = $this->getOptionValue('ycd-countdown-date-type');
|
980 |
$options['ycd-countdown-duration-days'] = $this->getOptionValue('ycd-countdown-duration-days');
|
981 |
$options['ycd-countdown-duration-hours'] = $this->getOptionValue('ycd-countdown-duration-hours');
|
982 |
$options['ycd-countdown-duration-minutes'] = $this->getOptionValue('ycd-countdown-duration-minutes');
|
classes/countdown/SimpleCountdown.php
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace ycd;
|
3 |
+
|
4 |
+
class SimpleCountdown extends Countdown
|
5 |
+
{
|
6 |
+
private $mode = 'textUnderCountdown';
|
7 |
+
private $timeUnites = array('days', 'hours', 'minutes', 'seconds');
|
8 |
+
|
9 |
+
public function __construct()
|
10 |
+
{
|
11 |
+
parent::__construct();
|
12 |
+
if(is_admin()) {
|
13 |
+
$this->adminConstruct();
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
public function setMode($mode)
|
18 |
+
{
|
19 |
+
return $this->mode;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function getMode()
|
23 |
+
{
|
24 |
+
return $this->mode;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getTimeUnites()
|
28 |
+
{
|
29 |
+
return $this->timeUnites;
|
30 |
+
}
|
31 |
+
|
32 |
+
public function adminConstruct()
|
33 |
+
{
|
34 |
+
add_filter('ycdGeneralMetaboxes', array($this, 'metaboxes'), 1, 1);
|
35 |
+
add_action('add_meta_boxes', array($this, 'mainOptions'));
|
36 |
+
add_filter('ycdCountdownDefaultOptions', array($this, 'defaultOptions'), 1, 1);
|
37 |
+
}
|
38 |
+
|
39 |
+
public function metaboxes($metaboxes) {
|
40 |
+
// $metaboxes[YCD_PROGRESS_METABOX_KEY] = array('title' => YCD_PROGRESS_METABOX_TITLE, 'position' => 'normal', 'prioritet' => 'high');
|
41 |
+
|
42 |
+
return $metaboxes;
|
43 |
+
}
|
44 |
+
|
45 |
+
public function mainOptions()
|
46 |
+
{
|
47 |
+
parent::mainOptions();
|
48 |
+
add_meta_box('ycdSimpleOptions', __('Main options', YCD_TEXT_DOMAIN), array($this, 'mainView'), YCD_COUNTDOWN_POST_TYPE, 'normal', 'high');
|
49 |
+
}
|
50 |
+
|
51 |
+
public function mainView()
|
52 |
+
{
|
53 |
+
$typeObj = $this;
|
54 |
+
require_once YCD_VIEWS_MAIN_PATH.'simpleMainView.php';
|
55 |
+
}
|
56 |
+
|
57 |
+
public function defaultOptions($defaultOptions)
|
58 |
+
{
|
59 |
+
return $defaultOptions;
|
60 |
+
}
|
61 |
+
|
62 |
+
public function renderLivePreview() {
|
63 |
+
$typeObj = $this;
|
64 |
+
require_once YCD_PREVIEW_VIEWS_PATH.'timerPreview.php';
|
65 |
+
}
|
66 |
+
|
67 |
+
private function timeUnitNumber($unit)
|
68 |
+
{
|
69 |
+
$default = '0';
|
70 |
+
return '<div class="ycd-simple-countdown-time ycd-simple-countdown-number ycd-simple-countdown-'.$unit.'-time">'.$default.'</div>';
|
71 |
+
}
|
72 |
+
|
73 |
+
private function timeUnitText($unit)
|
74 |
+
{
|
75 |
+
$unitLabel = $this->getOptionValue('ycd-simple-'.$unit.'-text');
|
76 |
+
return '<div class="ycd-simple-countdown-time ycd-simple-countdown-label ycd-simple-countdown-'.$unit.'-label">'.$unitLabel.'</div>';
|
77 |
+
}
|
78 |
+
|
79 |
+
private function render()
|
80 |
+
{
|
81 |
+
$unites = $this->getTimeUnites();
|
82 |
+
$availableUnites = array_filter($unites, function($unite) {
|
83 |
+
return $this->getOptionValue('ycd-simple-enable-'.$unite);
|
84 |
+
});
|
85 |
+
$this->renderScripts();
|
86 |
+
$lastUnite = end($availableUnites);
|
87 |
+
$mode = $this->getMode();
|
88 |
+
ob_start();
|
89 |
+
?>
|
90 |
+
<div class="ycd-simple-mode-<?php echo $mode; ?>">
|
91 |
+
<?php foreach($unites as $key => $unite): ?>
|
92 |
+
<?php
|
93 |
+
$hideDotsClassName = '';
|
94 |
+
$hideUnite = '';
|
95 |
+
if ($unite == $lastUnite) {
|
96 |
+
$hideDotsClassName = 'ycd-hide';
|
97 |
+
}
|
98 |
+
if (!in_array($unite, $availableUnites)) {
|
99 |
+
$hideUnite = 'ycd-hide';
|
100 |
+
}
|
101 |
+
?>
|
102 |
+
<div class="ycd-simple-current-unite-wrapper ycd-simple-current-unite-<?php echo esc_attr($unite); ?> <?php echo $hideUnite?>">
|
103 |
+
<div class="ycd-simple-current-unite"><!--
|
104 |
+
--><?php echo $this->timeUnitNumber($unite); ?><!--
|
105 |
+
--><?php echo $this->timeUnitText($unite); ?>
|
106 |
+
</div>
|
107 |
+
<div class="ycd-simple-timer-dots <?php echo $hideDotsClassName; ?>">:</div>
|
108 |
+
</div>
|
109 |
+
<?php endforeach; ?>
|
110 |
+
</div>
|
111 |
+
<?php
|
112 |
+
$content = ob_get_contents();
|
113 |
+
ob_end_clean();
|
114 |
+
|
115 |
+
return $content;
|
116 |
+
}
|
117 |
+
|
118 |
+
public function renderScripts()
|
119 |
+
{
|
120 |
+
$this->includeGeneralScripts();
|
121 |
+
wp_enqueue_script('jquery');
|
122 |
+
ScriptsIncluder::loadStyle('simpleCountdown.css');
|
123 |
+
ScriptsIncluder::loadScript('YcdSimpleCountdown.js');
|
124 |
+
}
|
125 |
+
|
126 |
+
private function getAllOptions()
|
127 |
+
{
|
128 |
+
$options = array();
|
129 |
+
$allDataOptions = $this->getDataAllOptions();
|
130 |
+
$generalOptionsData = $this->generalOptionsData();
|
131 |
+
$unites = $this->getTimeUnites();
|
132 |
+
|
133 |
+
foreach ($unites as $unite) {
|
134 |
+
$enableName = 'ycd-simple-enable-'.$unite;
|
135 |
+
$labelName = 'ycd-simple-'.$unite.'-text';
|
136 |
+
$options[$enableName] = $this->getOptionValue($enableName);
|
137 |
+
$options[$labelName] = $this->getOptionValue($labelName);
|
138 |
+
}
|
139 |
+
$options += $allDataOptions;
|
140 |
+
$options += $generalOptionsData;
|
141 |
+
|
142 |
+
return $options;
|
143 |
+
}
|
144 |
+
|
145 |
+
public function getViewContent()
|
146 |
+
{
|
147 |
+
$id = $this->getId();
|
148 |
+
$options = $this->getAllOptions();
|
149 |
+
$options = json_encode($options);
|
150 |
+
ob_start();
|
151 |
+
?>
|
152 |
+
<div class="ycd-countdown-wrapper ycd-simple-content-wrapper-<?php echo esc_attr($id); ?>">
|
153 |
+
<div class="ycd-simple-time ycd-simple-container ycd-simple-wrapper-<?php echo esc_attr($id); ?>" data-options='<?php echo $options; ?>' data-id="<?php echo esc_attr($id); ?>">
|
154 |
+
<?php echo $this->render(); ?>
|
155 |
+
</div>
|
156 |
+
</div>
|
157 |
+
<?php
|
158 |
+
$content = ob_get_contents();
|
159 |
+
ob_end_clean();
|
160 |
+
|
161 |
+
return $content;
|
162 |
+
}
|
163 |
+
}
|
config/config.php
CHANGED
@@ -84,8 +84,8 @@ class YcdCountdownConfig {
|
|
84 |
$versionText = '1.7.9';
|
85 |
}
|
86 |
self::addDefine('YCD_VERSION_TEXT', $versionText);
|
87 |
-
self::addDefine('YCD_LAST_UPDATE', 'Dec
|
88 |
-
self::addDefine('YCD_NEXT_UPDATE', 'Dec
|
89 |
}
|
90 |
|
91 |
public static function displaySettings() {
|
84 |
$versionText = '1.7.9';
|
85 |
}
|
86 |
self::addDefine('YCD_VERSION_TEXT', $versionText);
|
87 |
+
self::addDefine('YCD_LAST_UPDATE', 'Dec 20');
|
88 |
+
self::addDefine('YCD_NEXT_UPDATE', 'Dec 30');
|
89 |
}
|
90 |
|
91 |
public static function displaySettings() {
|
config/optionsConfig.php
CHANGED
@@ -8,6 +8,7 @@ class YcdCountdownOptionsConfig {
|
|
8 |
$YCD_TYPES['typeName'] = apply_filters('ycdTypes', array(
|
9 |
'circle' => YCD_FREE_VERSION,
|
10 |
'sticky' => YCD_FREE_VERSION,
|
|
|
11 |
'timer' => YCD_FREE_VERSION,
|
12 |
'clock1' => YCD_FREE_VERSION,
|
13 |
'clock2' => YCD_FREE_VERSION,
|
@@ -25,6 +26,7 @@ class YcdCountdownOptionsConfig {
|
|
25 |
$YCD_TYPES['typePath'] = apply_filters('ycdTypePaths', array(
|
26 |
'circle' => YCD_COUNTDOWNS_PATH,
|
27 |
'sticky' => YCD_COUNTDOWNS_PATH,
|
|
|
28 |
'timer' => YCD_COUNTDOWNS_PATH,
|
29 |
'clock1' => YCD_COUNTDOWNS_PATH,
|
30 |
'clock2' => YCD_COUNTDOWNS_PATH,
|
@@ -42,6 +44,7 @@ class YcdCountdownOptionsConfig {
|
|
42 |
$YCD_TYPES['titles'] = apply_filters('ycdTitles', array(
|
43 |
'circle' => __('Circle', YCD_TEXT_DOMAIN),
|
44 |
'sticky' => __('Sticky Countdown', YCD_TEXT_DOMAIN),
|
|
|
45 |
'timer' => __('Timer', YCD_TEXT_DOMAIN),
|
46 |
'clock1' => __('Clock 1', YCD_TEXT_DOMAIN),
|
47 |
'clock2' => __('Clock 2', YCD_TEXT_DOMAIN),
|
@@ -248,29 +251,29 @@ class YcdCountdownOptionsConfig {
|
|
248 |
$options[] = array('name' => 'ycd-timer-reset-button-label', 'type' => 'text', 'defaultValue' => __('Reset', YCD_TEXT_DOMAIN));
|
249 |
$options[] = array('name' => 'ycd-count-up-from-end-date', 'type' => 'checkbox', 'defaultValue' => '');
|
250 |
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
|
275 |
$options[] = array('name' => 'ycd-sticky-button-text', 'type' => 'text', 'defaultValue' => __('Checkout', YCD_TEXT_DOMAIN));
|
276 |
$options[] = array('name' => 'ycd-sticky-bg-color', 'type' => 'text', 'defaultValue' => '#000000');
|
@@ -295,19 +298,29 @@ class YcdCountdownOptionsConfig {
|
|
295 |
$options[] = array('name' => 'ycd-sticky-enable-close', 'type' => 'checkbox', 'defaultValue' => '');
|
296 |
$options[] = array('name' => 'ycd-sticky-close-text', 'type' => 'text', 'defaultValue' => __('Close', YCD_TEXT_DOMAIN));
|
297 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
$YCD_OPTIONS = apply_filters('ycdCountdownDefaultOptions', $options);
|
299 |
}
|
300 |
|
301 |
public static function getDefaultValuesData() {
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
|
309 |
-
|
310 |
-
|
311 |
|
312 |
public static function getDefaultTimezone() {
|
313 |
$timezone = get_option('timezone_string');
|
8 |
$YCD_TYPES['typeName'] = apply_filters('ycdTypes', array(
|
9 |
'circle' => YCD_FREE_VERSION,
|
10 |
'sticky' => YCD_FREE_VERSION,
|
11 |
+
'simple' => YCD_FREE_VERSION,
|
12 |
'timer' => YCD_FREE_VERSION,
|
13 |
'clock1' => YCD_FREE_VERSION,
|
14 |
'clock2' => YCD_FREE_VERSION,
|
26 |
$YCD_TYPES['typePath'] = apply_filters('ycdTypePaths', array(
|
27 |
'circle' => YCD_COUNTDOWNS_PATH,
|
28 |
'sticky' => YCD_COUNTDOWNS_PATH,
|
29 |
+
'simple' => YCD_COUNTDOWNS_PATH,
|
30 |
'timer' => YCD_COUNTDOWNS_PATH,
|
31 |
'clock1' => YCD_COUNTDOWNS_PATH,
|
32 |
'clock2' => YCD_COUNTDOWNS_PATH,
|
44 |
$YCD_TYPES['titles'] = apply_filters('ycdTitles', array(
|
45 |
'circle' => __('Circle', YCD_TEXT_DOMAIN),
|
46 |
'sticky' => __('Sticky Countdown', YCD_TEXT_DOMAIN),
|
47 |
+
'simple' => __('Simple Countdown', YCD_TEXT_DOMAIN),
|
48 |
'timer' => __('Timer', YCD_TEXT_DOMAIN),
|
49 |
'clock1' => __('Clock 1', YCD_TEXT_DOMAIN),
|
50 |
'clock2' => __('Clock 2', YCD_TEXT_DOMAIN),
|
251 |
$options[] = array('name' => 'ycd-timer-reset-button-label', 'type' => 'text', 'defaultValue' => __('Reset', YCD_TEXT_DOMAIN));
|
252 |
$options[] = array('name' => 'ycd-count-up-from-end-date', 'type' => 'checkbox', 'defaultValue' => '');
|
253 |
|
254 |
+
$options[] = array('name' => 'ycd-button-name', 'type' => 'text', 'defaultValue' => 'Buy Now');
|
255 |
+
$options[] = array('name' => 'ycd-button-action-url', 'type' => 'text', 'defaultValue' => get_site_url());
|
256 |
+
$options[] = array('name' => 'ycd-button-action-url-tab', 'type' => 'checkbox', 'defaultValue' => '');
|
257 |
+
$options[] = array('name' => 'ycd-countdown-enable-button', 'type' => 'checkbox', 'defaultValue' => '');
|
258 |
+
$options[] = array('name' => 'ycd-button-width', 'type' => 'text', 'defaultValue' => '200px');
|
259 |
+
$options[] = array('name' => 'ycd-button-height', 'type' => 'text', 'defaultValue' => '50px');
|
260 |
+
$options[] = array('name' => 'ycd-button-border-width', 'type' => 'text', 'defaultValue' => '0px');
|
261 |
+
$options[] = array('name' => 'ycd-button-border-radius', 'type' => 'text', 'defaultValue' => '5');
|
262 |
+
$options[] = array('name' => 'ycd-button-bg-color', 'type' => 'text', 'defaultValue' => '#4dba7a');
|
263 |
+
$options[] = array('name' => 'ycd-button-color', 'type' => 'text', 'defaultValue' => '#ffffff');
|
264 |
+
$options[] = array('name' => 'ycd-button-after-countdown', 'type' => 'checkbox', 'defaultValue' => '');
|
265 |
+
$options[] = array('name' => 'ycd-button-horizontal', 'type' => 'text', 'defaultValue' => 'center');
|
266 |
+
$options[] = array('name' => 'ycd-button-font-size', 'type' => 'text', 'defaultValue' => '14px');
|
267 |
+
$options[] = array('name' => 'ycd-button-margin-top', 'type' => 'text', 'defaultValue' => '0px');
|
268 |
+
$options[] = array('name' => 'ycd-button-margin-right', 'type' => 'text', 'defaultValue' => '0px');
|
269 |
+
$options[] = array('name' => 'ycd-button-margin-bottom', 'type' => 'text', 'defaultValue' => '0px');
|
270 |
+
$options[] = array('name' => 'ycd-button-margin-left', 'type' => 'text', 'defaultValue' => '0px');
|
271 |
+
$options[] = array('name' => 'ycd-button-opacity', 'type' => 'text', 'defaultValue' => '1');
|
272 |
+
$options[] = array('name' => 'ycd-button-hover-colors', 'type' => 'checkbox', 'defaultValue' => '');
|
273 |
+
$options[] = array('name' => 'ycd-button-hover-bg-color', 'type' => 'text', 'defaultValue' => '#4dba7a');
|
274 |
+
$options[] = array('name' => 'ycd-button-hover-color', 'type' => 'text', 'defaultValue' => '#ffffff');
|
275 |
+
$options[] = array('name' => 'ycd-countdown-content-click-url-tab', 'type' => 'checkbox', 'defaultValue' => '');
|
276 |
+
$options[] = array('name' => 'ycd-countdown-button-behavior', 'type' => 'text', 'defaultValue' => 'redirect');
|
277 |
|
278 |
$options[] = array('name' => 'ycd-sticky-button-text', 'type' => 'text', 'defaultValue' => __('Checkout', YCD_TEXT_DOMAIN));
|
279 |
$options[] = array('name' => 'ycd-sticky-bg-color', 'type' => 'text', 'defaultValue' => '#000000');
|
298 |
$options[] = array('name' => 'ycd-sticky-enable-close', 'type' => 'checkbox', 'defaultValue' => '');
|
299 |
$options[] = array('name' => 'ycd-sticky-close-text', 'type' => 'text', 'defaultValue' => __('Close', YCD_TEXT_DOMAIN));
|
300 |
|
301 |
+
// Simple countdown
|
302 |
+
$options[] = array('name' => 'ycd-simple-enable-days', 'type' => 'checkbox', 'defaultValue' => 'on');
|
303 |
+
$options[] = array('name' => 'ycd-simple-days-text', 'type' => 'text', 'defaultValue' => __('Days', YCD_TEXT_DOMAIN));
|
304 |
+
$options[] = array('name' => 'ycd-simple-enable-hours', 'type' => 'checkbox', 'defaultValue' => 'on');
|
305 |
+
$options[] = array('name' => 'ycd-simple-hours-text', 'type' => 'text', 'defaultValue' => __('Hrs', YCD_TEXT_DOMAIN));
|
306 |
+
$options[] = array('name' => 'ycd-simple-enable-minutes', 'type' => 'checkbox', 'defaultValue' => 'on');
|
307 |
+
$options[] = array('name' => 'ycd-simple-minutes-text', 'type' => 'text', 'defaultValue' => __('Mins', YCD_TEXT_DOMAIN));
|
308 |
+
$options[] = array('name' => 'ycd-simple-enable-seconds', 'type' => 'checkbox', 'defaultValue' => 'on');
|
309 |
+
$options[] = array('name' => 'ycd-simple-seconds-text', 'type' => 'text', 'defaultValue' => __('Secs', YCD_TEXT_DOMAIN));
|
310 |
+
|
311 |
$YCD_OPTIONS = apply_filters('ycdCountdownDefaultOptions', $options);
|
312 |
}
|
313 |
|
314 |
public static function getDefaultValuesData() {
|
315 |
+
self::optionsValues();
|
316 |
+
global $YCD_OPTIONS;
|
317 |
+
$currentKeyVal = array();
|
318 |
+
foreach ($YCD_OPTIONS as $option) {
|
319 |
+
$currentKeyVal[$option['name']] = $option['defaultValue'];
|
320 |
+
}
|
321 |
|
322 |
+
return $currentKeyVal;
|
323 |
+
}
|
324 |
|
325 |
public static function getDefaultTimezone() {
|
326 |
$timezone = get_option('timezone_string');
|
countdown-builder.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Countdown builder
|
4 |
* Description: The best countdown plugin by Adam skaat
|
5 |
-
* Version: 1.9.
|
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 by Adam skaat
|
5 |
+
* Version: 1.9.4
|
6 |
* Author: Adam Skaat
|
7 |
* Author URI: https://edmonsoft.com/countdown
|
8 |
* License: GPLv2
|
helpers/ScriptsIncluder.php
CHANGED
@@ -65,6 +65,15 @@ class ScriptsIncluder {
|
|
65 |
}
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
/**
|
69 |
* Countdown register style
|
70 |
*
|
65 |
}
|
66 |
}
|
67 |
|
68 |
+
/**
|
69 |
+
* @since 1.9.4
|
70 |
+
* @param $styleName
|
71 |
+
*/
|
72 |
+
public static function loadStyle($styleName) {
|
73 |
+
self::registerStyle($styleName);
|
74 |
+
self::enqueueStyle($styleName);
|
75 |
+
}
|
76 |
+
|
77 |
/**
|
78 |
* Countdown register style
|
79 |
*
|
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.6.1
|
6 |
-
Stable tag: 1.9.
|
7 |
Requires PHP: 5.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -31,6 +31,7 @@ Countdown types
|
|
31 |
* Clock 5
|
32 |
* Clock 6
|
33 |
* Clock 7
|
|
|
34 |
* Sticky Countdown
|
35 |
* Circle countdown & popup
|
36 |
* Flipclock countdwon
|
@@ -66,6 +67,10 @@ Yes you can, we have Circle and Flipclock countdown popups.
|
|
66 |
You need to select the .zip file, there is no need to extract the zip file, just upload it.
|
67 |
|
68 |
== Changelog ==
|
|
|
|
|
|
|
|
|
69 |
= 1.9.3 =
|
70 |
* Added ' Print scripts to the page ' option in the Setting section
|
71 |
* WordPress 5.6 version full support
|
3 |
Tags: countdown, timer, countdown timer
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 5.6.1
|
6 |
+
Stable tag: 1.9.4
|
7 |
Requires PHP: 5.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
31 |
* Clock 5
|
32 |
* Clock 6
|
33 |
* Clock 7
|
34 |
+
* Simple countdown
|
35 |
* Sticky Countdown
|
36 |
* Circle countdown & popup
|
37 |
* Flipclock countdwon
|
67 |
You need to select the .zip file, there is no need to extract the zip file, just upload it.
|
68 |
|
69 |
== Changelog ==
|
70 |
+
|
71 |
+
= 1.9.4 =
|
72 |
+
* Simple countdown new type
|
73 |
+
|
74 |
= 1.9.3 =
|
75 |
* Added ' Print scripts to the page ' option in the Setting section
|
76 |
* WordPress 5.6 version full support
|