Version Description
- Added new clock 2 types (new)
- Code optimization
- Bug fixed
Download this release
Release Info
Developer | adamskaat |
Plugin | Countdown, Coming Soon – Countdown & Clock |
Version | 1.3.2 |
Comparing to | |
See all releases |
Code changes from version 1.3.1 to 1.3.2
- assets/css/admin.css +34 -0
- assets/img/clock2.png +0 -0
- assets/img/clock3.png +0 -0
- assets/img/clock4.png +0 -0
- assets/img/clock5.png +0 -0
- assets/img/clock6.png +0 -0
- assets/img/clock7.png +0 -0
- assets/js/Admin.js +37 -13
- assets/js/clock/Clock.js +30 -3
- assets/js/clock/canvas_clock.js +49 -47
- assets/views/main/clock1View.php +3 -3
- assets/views/main/clock2View.php +38 -0
- assets/views/main/clock3View.php +38 -0
- classes/countdown/Clock2Countdown.php +107 -0
- classes/countdown/Clock3Countdown.php +107 -0
- config/config.php +2 -2
- config/optionsConfig.php +31 -0
- countdown-builder.php +1 -1
- readme.txt +7 -2
assets/css/admin.css
CHANGED
@@ -43,6 +43,40 @@
|
|
43 |
background-size: 100% 100%;
|
44 |
}
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
.timer-countdown {
|
47 |
background-image: url("../img/DigtalCountdown.jpg");
|
48 |
background-size: 100% 100%;
|
43 |
background-size: 100% 100%;
|
44 |
}
|
45 |
|
46 |
+
.clock2-countdown {
|
47 |
+
background-image: url("../img/clock2.png");
|
48 |
+
background-size: 100% 100%;
|
49 |
+
}
|
50 |
+
|
51 |
+
.clock3-countdown {
|
52 |
+
background-image: url("../img/clock3.png");
|
53 |
+
background-size: 100% 100%;
|
54 |
+
}
|
55 |
+
|
56 |
+
.clock4-countdown,
|
57 |
+
.clock4-countdown-pro {
|
58 |
+
background-image: url("../img/clock4.png");
|
59 |
+
background-size: 100% 100%;
|
60 |
+
}
|
61 |
+
|
62 |
+
.clock5-countdown,
|
63 |
+
.clock5-countdown-pro {
|
64 |
+
background-image: url("../img/clock5.png");
|
65 |
+
background-size: 100% 100%;
|
66 |
+
}
|
67 |
+
|
68 |
+
.clock6-countdown,
|
69 |
+
.clock6-countdown-pro {
|
70 |
+
background-image: url("../img/clock6.png");
|
71 |
+
background-size: 100% 100%;
|
72 |
+
}
|
73 |
+
|
74 |
+
.clock7-countdown,
|
75 |
+
.clock7-countdown-pro {
|
76 |
+
background-image: url("../img/clock7.png");
|
77 |
+
background-size: 100% 100%;
|
78 |
+
}
|
79 |
+
|
80 |
.timer-countdown {
|
81 |
background-image: url("../img/DigtalCountdown.jpg");
|
82 |
background-size: 100% 100%;
|
assets/img/clock2.png
ADDED
Binary file
|
assets/img/clock3.png
ADDED
Binary file
|
assets/img/clock4.png
ADDED
Binary file
|
assets/img/clock5.png
ADDED
Binary file
|
assets/img/clock6.png
ADDED
Binary file
|
assets/img/clock7.png
ADDED
Binary file
|
assets/js/Admin.js
CHANGED
@@ -24,21 +24,23 @@ YcdAdmin.prototype.init = function() {
|
|
24 |
YcdAdmin.prototype.clockLivePreview = function() {
|
25 |
this.changeClcokWidth();
|
26 |
this.changeTimeZone();
|
|
|
27 |
};
|
28 |
|
29 |
YcdAdmin.prototype.changeClcokWidth = function() {
|
30 |
-
var width = jQuery('
|
31 |
|
32 |
if (width.length) {
|
33 |
var that = this;
|
34 |
width.bind('change', function() {
|
|
|
35 |
var widthVal = parseInt(jQuery(this).val())+'px';
|
36 |
-
var cnavas = jQuery('.
|
37 |
|
38 |
cnavas.attr('width', widthVal);
|
39 |
cnavas.attr('height', widthVal);
|
40 |
|
41 |
-
that.reinitClock();
|
42 |
});
|
43 |
}
|
44 |
};
|
@@ -53,26 +55,48 @@ YcdAdmin.prototype.changeTimeZone = function() {
|
|
53 |
|
54 |
timeZone.bind('change', function() {
|
55 |
var val = jQuery(this).val();
|
56 |
-
var
|
|
|
57 |
options['timeZone'] = val;
|
58 |
-
jQuery('.
|
59 |
|
60 |
-
that.reinitClock();
|
61 |
});
|
62 |
};
|
63 |
|
64 |
-
YcdAdmin.prototype.
|
65 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
var dataArgs = cnavas.data('args');
|
67 |
var dataOptions = cnavas.data('options');
|
68 |
|
69 |
-
var width = jQuery(
|
70 |
-
var height = jQuery(
|
71 |
|
72 |
-
jQuery(
|
73 |
-
jQuery('.ycd-countdown-wrapper').prepend('<canvas data-args='+JSON.stringify(dataArgs)+' data-options='+JSON.stringify(dataOptions)+' class="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
-
var obj = new YcdClock();
|
76 |
obj.init()
|
77 |
};
|
78 |
|
24 |
YcdAdmin.prototype.clockLivePreview = function() {
|
25 |
this.changeClcokWidth();
|
26 |
this.changeTimeZone();
|
27 |
+
this.changeAlignClock();
|
28 |
};
|
29 |
|
30 |
YcdAdmin.prototype.changeClcokWidth = function() {
|
31 |
+
var width = jQuery('.ycd-clock-width');
|
32 |
|
33 |
if (width.length) {
|
34 |
var that = this;
|
35 |
width.bind('change', function() {
|
36 |
+
var targetId = jQuery(this).data('target-index');
|
37 |
var widthVal = parseInt(jQuery(this).val())+'px';
|
38 |
+
var cnavas = jQuery('.ycdClock'+targetId);
|
39 |
|
40 |
cnavas.attr('width', widthVal);
|
41 |
cnavas.attr('height', widthVal);
|
42 |
|
43 |
+
that.reinitClock(targetId);
|
44 |
});
|
45 |
}
|
46 |
};
|
55 |
|
56 |
timeZone.bind('change', function() {
|
57 |
var val = jQuery(this).val();
|
58 |
+
var targetId = jQuery(this).data('target-index');
|
59 |
+
var options = jQuery('.ycdClock'+targetId).data('options');
|
60 |
options['timeZone'] = val;
|
61 |
+
jQuery('.ycdClock'+targetId).attr('data-options', options);
|
62 |
|
63 |
+
that.reinitClock(targetId);
|
64 |
});
|
65 |
};
|
66 |
|
67 |
+
YcdAdmin.prototype.changeAlignClock = function() {
|
68 |
+
var alignement = jQuery('.ycd-clock-alignment');
|
69 |
+
|
70 |
+
if(!alignement.length) {
|
71 |
+
return false;
|
72 |
+
}
|
73 |
+
var that = this;
|
74 |
+
|
75 |
+
alignement.bind('change', function() {
|
76 |
+
var val = jQuery(this).val();
|
77 |
+
jQuery('.ycd-countdown-wrapper').css({'text-align': val});
|
78 |
+
});
|
79 |
+
};
|
80 |
+
|
81 |
+
YcdAdmin.prototype.reinitClock = function(targetId) {
|
82 |
+
var targetClassName = '.ycdClock'+targetId;
|
83 |
+
var cnavas = jQuery(targetClassName);
|
84 |
var dataArgs = cnavas.data('args');
|
85 |
var dataOptions = cnavas.data('options');
|
86 |
|
87 |
+
var width = jQuery(targetClassName).width();
|
88 |
+
var height = jQuery(targetClassName).height();
|
89 |
|
90 |
+
jQuery(targetClassName).remove();
|
91 |
+
jQuery('.ycd-countdown-wrapper').prepend('<canvas data-args='+JSON.stringify(dataArgs)+' data-options='+JSON.stringify(dataOptions)+' class="ycdClock'+targetId+'" width="'+width+'px" height="'+height+'px"></canvas>');
|
92 |
+
|
93 |
+
if (typeof YcdClock != 'undefined') {
|
94 |
+
var obj = new YcdClock();
|
95 |
+
}
|
96 |
+
else if (typeof YcdClockPro != 'ndefined') {
|
97 |
+
var obj = new YcdClockPro();
|
98 |
+
}
|
99 |
|
|
|
100 |
obj.init()
|
101 |
};
|
102 |
|
assets/js/clock/Clock.js
CHANGED
@@ -3,7 +3,34 @@ function YcdClock() {
|
|
3 |
}
|
4 |
|
5 |
YcdClock.prototype.init = function() {
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
var args = jQuery(element).data('args');
|
8 |
var options = jQuery(element).data('options');
|
9 |
|
@@ -15,8 +42,8 @@ YcdClock.prototype.init = function() {
|
|
15 |
var settings = {};
|
16 |
|
17 |
settings.timeZone = options['timeZone'];
|
18 |
-
|
19 |
-
|
20 |
});
|
21 |
};
|
22 |
|
3 |
}
|
4 |
|
5 |
YcdClock.prototype.init = function() {
|
6 |
+
this.clock1();
|
7 |
+
this.clock2();
|
8 |
+
this.clock3();
|
9 |
+
};
|
10 |
+
|
11 |
+
YcdClock.prototype.clock1 = function() {
|
12 |
+
this.clockId = 1;
|
13 |
+
this.callback = 'ycdClockConti';
|
14 |
+
this.renderClock();
|
15 |
+
};
|
16 |
+
|
17 |
+
YcdClock.prototype.clock2 = function() {
|
18 |
+
this.clockId = 2;
|
19 |
+
this.callback = 'ycdClockBars';
|
20 |
+
this.renderClock();
|
21 |
+
};
|
22 |
+
|
23 |
+
YcdClock.prototype.clock3 = function() {
|
24 |
+
this.clockId = 3;
|
25 |
+
this.callback = 'ycdDigitalClock';
|
26 |
+
this.renderClock();
|
27 |
+
};
|
28 |
+
|
29 |
+
YcdClock.prototype.renderClock = function() {
|
30 |
+
var that = this;
|
31 |
+
var id = that.clockId;
|
32 |
+
var clock = that.callback;
|
33 |
+
jQuery('.ycdClock'+id).each(function(index, element) {
|
34 |
var args = jQuery(element).data('args');
|
35 |
var options = jQuery(element).data('options');
|
36 |
|
42 |
var settings = {};
|
43 |
|
44 |
settings.timeZone = options['timeZone'];
|
45 |
+
var clock = eval(that.callback);
|
46 |
+
clock(width, context, args, settings);
|
47 |
});
|
48 |
};
|
49 |
|
assets/js/clock/canvas_clock.js
CHANGED
@@ -58,18 +58,11 @@ function ycdClockConti(size, cns, clockd, extraOptions)
|
|
58 |
|
59 |
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
60 |
{
|
61 |
-
|
62 |
}
|
63 |
|
64 |
-
var now =
|
65 |
|
66 |
-
if (extraOptions.timeZone) {
|
67 |
-
var now = new Date().toLocaleString('en-US', {
|
68 |
-
timeZone: extraOptions.timeZone
|
69 |
-
});
|
70 |
-
}
|
71 |
-
|
72 |
-
now = new Date(now);
|
73 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
74 |
now.setTime(now.getTime()+time_off*1000);
|
75 |
var milisec=now.getMilliseconds();
|
@@ -130,9 +123,9 @@ function ycdClockConti(size, cns, clockd, extraOptions)
|
|
130 |
clockd.timer=setTimeout(function(){ycdClockConti(size, cns, clockd, extraOptions)},50);
|
131 |
}
|
132 |
|
133 |
-
function
|
134 |
{
|
135 |
-
var now=
|
136 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
137 |
now.setTime(now.getTime()+time_off*1000);
|
138 |
var milisec=now.getMilliseconds();
|
@@ -160,10 +153,10 @@ function clock_digital(size, cns, clockd)
|
|
160 |
|
161 |
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
162 |
{
|
163 |
-
|
164 |
}
|
165 |
|
166 |
-
clockd.timer=setTimeout(function(){
|
167 |
}
|
168 |
|
169 |
function clock_reverse(size, cns, clockd)
|
@@ -345,7 +338,7 @@ var r4=[4,5,7];
|
|
345 |
clockd.timer=setTimeout(function(){clock_norm(size, cns, clockd)},50);
|
346 |
}
|
347 |
|
348 |
-
function
|
349 |
{
|
350 |
cns.clearRect(0,0,size,size);
|
351 |
|
@@ -361,7 +354,7 @@ function clock_follow(size, cns, clockd)
|
|
361 |
indicator(size, cns, clockd);
|
362 |
}
|
363 |
|
364 |
-
var now=
|
365 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
366 |
now.setTime(now.getTime()+time_off*1000);
|
367 |
var milisec=now.getMilliseconds();
|
@@ -413,18 +406,18 @@ function clock_follow(size, cns, clockd)
|
|
413 |
|
414 |
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
415 |
{
|
416 |
-
ycd_time_add((size/2),size/5*3, size, cns, clockd);
|
417 |
}
|
418 |
|
419 |
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
420 |
{
|
421 |
-
|
422 |
}
|
423 |
|
424 |
-
clockd.timer=setTimeout(function(){
|
425 |
}
|
426 |
|
427 |
-
function
|
428 |
{
|
429 |
cns.clearRect(0,0,size,size);
|
430 |
|
@@ -440,7 +433,7 @@ function clock_circles(size, cns, clockd)
|
|
440 |
indicator(size, cns, clockd);
|
441 |
}
|
442 |
|
443 |
-
var now=
|
444 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
445 |
now.setTime(now.getTime()+time_off*1000);
|
446 |
var milisec=now.getMilliseconds();
|
@@ -480,15 +473,15 @@ function clock_circles(size, cns, clockd)
|
|
480 |
|
481 |
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
482 |
{
|
483 |
-
ycd_time_add((size/2),size/6*3, size, cns, clockd);
|
484 |
}
|
485 |
|
486 |
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
487 |
{
|
488 |
-
|
489 |
}
|
490 |
|
491 |
-
clockd.timer=setTimeout(function(){
|
492 |
}
|
493 |
|
494 |
function clock_grow(size, cns, clockd)
|
@@ -562,7 +555,7 @@ function clock_grow(size, cns, clockd)
|
|
562 |
clockd.timer=setTimeout(function(){clock_grow(size, cns, clockd)},50);
|
563 |
}
|
564 |
|
565 |
-
function
|
566 |
{
|
567 |
cns.clearRect(0,0,size,size);
|
568 |
|
@@ -575,20 +568,20 @@ function clock_dots(size, cns, clockd)
|
|
575 |
|
576 |
if((clockd.hasOwnProperty("indicate") && clockd.indicate==true) || !clockd.hasOwnProperty("indicate"))
|
577 |
{
|
578 |
-
|
579 |
}
|
580 |
|
581 |
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
582 |
{
|
583 |
-
ycd_time_add((size/2),size/6*3, size, cns, clockd);
|
584 |
}
|
585 |
|
586 |
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
587 |
{
|
588 |
-
|
589 |
}
|
590 |
|
591 |
-
var now=
|
592 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
593 |
now.setTime(now.getTime()+time_off*1000);
|
594 |
var milisec=now.getMilliseconds();
|
@@ -643,7 +636,7 @@ function clock_dots(size, cns, clockd)
|
|
643 |
cns.closePath();
|
644 |
}
|
645 |
|
646 |
-
clockd.timer=setTimeout(function(){
|
647 |
}
|
648 |
|
649 |
function clock_num(size, cns, clockd)
|
@@ -840,7 +833,7 @@ function clock_digitalran(size, cns, clockd)
|
|
840 |
clockd.timer=setTimeout(function(){clock_digitalran(size, cns, clockd)},50);
|
841 |
}
|
842 |
|
843 |
-
function
|
844 |
{
|
845 |
cns.clearRect(0,0,size,size);
|
846 |
|
@@ -851,7 +844,8 @@ function clock_bars(size, cns, clockd)
|
|
851 |
cns.closePath();
|
852 |
if(clockd.hasOwnProperty("bgLoaded") && clockd.bgLoaded==1){if(clockd.hasOwnProperty("bg_opacity")){cns.globalAlpha=clockd["bg_opacity"];cns.drawImage(clockd.bgImage,0,0,size,size);cns.globalAlpha=1;}}
|
853 |
|
854 |
-
var now=
|
|
|
855 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
856 |
now.setTime(now.getTime()+time_off*1000);
|
857 |
var mili=now.getMilliseconds();
|
@@ -894,12 +888,12 @@ function clock_bars(size, cns, clockd)
|
|
894 |
|
895 |
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
896 |
{
|
897 |
-
ycd_time_add((size/2),size/20, size, cns, clockd);
|
898 |
}
|
899 |
|
900 |
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
901 |
{
|
902 |
-
|
903 |
}
|
904 |
|
905 |
cns.strokeStyle=(clockd.hasOwnProperty("indicate_color"))?clockd["indicate_color"]:"#333333";
|
@@ -931,10 +925,10 @@ function clock_bars(size, cns, clockd)
|
|
931 |
cns.fill();
|
932 |
cns.closePath();
|
933 |
|
934 |
-
clockd.timer=setTimeout(function(){
|
935 |
}
|
936 |
|
937 |
-
function
|
938 |
{
|
939 |
cns.clearRect(0,0,size,size);
|
940 |
|
@@ -952,15 +946,15 @@ function clock_planets(size, cns, clockd)
|
|
952 |
|
953 |
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
954 |
{
|
955 |
-
ycd_time_add((size/2),size/5*3, size, cns, clockd);
|
956 |
}
|
957 |
|
958 |
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
959 |
{
|
960 |
-
|
961 |
}
|
962 |
|
963 |
-
var now=
|
964 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
965 |
now.setTime(now.getTime()+time_off*1000);
|
966 |
var milisec=now.getMilliseconds();
|
@@ -1042,7 +1036,7 @@ function clock_planets(size, cns, clockd)
|
|
1042 |
cns.fill();
|
1043 |
cns.closePath();
|
1044 |
|
1045 |
-
clockd.timer=setTimeout(function(){
|
1046 |
}
|
1047 |
|
1048 |
function clock_roulette(size, cns, clockd)
|
@@ -1262,12 +1256,7 @@ function ycd_time_add(x, y, size, cns, clockd, extraOptions)
|
|
1262 |
return;
|
1263 |
}
|
1264 |
|
1265 |
-
var now =
|
1266 |
-
if (extraOptions.timeZone) {
|
1267 |
-
now = new Date().toLocaleString('en-US', {
|
1268 |
-
timeZone: extraOptions.timeZone
|
1269 |
-
});
|
1270 |
-
}
|
1271 |
|
1272 |
now = new Date(now);
|
1273 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
@@ -1306,14 +1295,14 @@ function ycd_time_add(x, y, size, cns, clockd, extraOptions)
|
|
1306 |
}
|
1307 |
}
|
1308 |
|
1309 |
-
function
|
1310 |
{
|
1311 |
if(!clockd.hasOwnProperty("date_add"))
|
1312 |
{
|
1313 |
return;
|
1314 |
}
|
1315 |
|
1316 |
-
var now=
|
1317 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
1318 |
now.setTime(now.getTime()+time_off*1000);
|
1319 |
var day=now.getDate();
|
@@ -1350,3 +1339,16 @@ function date_add(x, y, size, cns, clockd)
|
|
1350 |
cns.fillText(day+" "+month_arr[month],x,y);
|
1351 |
}
|
1352 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
60 |
{
|
61 |
+
ycd_date_add((size/2),size/5*3+size/10, size, cns, clockd, extraOptions);
|
62 |
}
|
63 |
|
64 |
+
var now = ycdGetChangedDateFromTimeZone(extraOptions);
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
67 |
now.setTime(now.getTime()+time_off*1000);
|
68 |
var milisec=now.getMilliseconds();
|
123 |
clockd.timer=setTimeout(function(){ycdClockConti(size, cns, clockd, extraOptions)},50);
|
124 |
}
|
125 |
|
126 |
+
function ycdDigitalClock(size, cns, clockd, extraOptions)
|
127 |
{
|
128 |
+
var now = ycdGetChangedDateFromTimeZone(extraOptions);
|
129 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
130 |
now.setTime(now.getTime()+time_off*1000);
|
131 |
var milisec=now.getMilliseconds();
|
153 |
|
154 |
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
155 |
{
|
156 |
+
ycd_date_add((size/2),size/5*3+size/10,size,cns, clockd, extraOptions);
|
157 |
}
|
158 |
|
159 |
+
clockd.timer=setTimeout(function(){ycdDigitalClock(size, cns, clockd, extraOptions)},50);
|
160 |
}
|
161 |
|
162 |
function clock_reverse(size, cns, clockd)
|
338 |
clockd.timer=setTimeout(function(){clock_norm(size, cns, clockd)},50);
|
339 |
}
|
340 |
|
341 |
+
function ycdClockFollow(size, cns, clockd, extraOptions)
|
342 |
{
|
343 |
cns.clearRect(0,0,size,size);
|
344 |
|
354 |
indicator(size, cns, clockd);
|
355 |
}
|
356 |
|
357 |
+
var now = ycdGetChangedDateFromTimeZone(extraOptions);
|
358 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
359 |
now.setTime(now.getTime()+time_off*1000);
|
360 |
var milisec=now.getMilliseconds();
|
406 |
|
407 |
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
408 |
{
|
409 |
+
ycd_time_add((size/2),size/5*3, size, cns, clockd, extraOptions);
|
410 |
}
|
411 |
|
412 |
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
413 |
{
|
414 |
+
ycd_date_add((size/2),size/5*3+size/15, size, cns, clockd, extraOptions);
|
415 |
}
|
416 |
|
417 |
+
clockd.timer=setTimeout(function(){ycdClockFollow(size, cns, clockd, extraOptions)},50);
|
418 |
}
|
419 |
|
420 |
+
function ycdClockCircles(size, cns, clockd, extraOptions)
|
421 |
{
|
422 |
cns.clearRect(0,0,size,size);
|
423 |
|
433 |
indicator(size, cns, clockd);
|
434 |
}
|
435 |
|
436 |
+
var now = ycdGetChangedDateFromTimeZone(extraOptions);
|
437 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
438 |
now.setTime(now.getTime()+time_off*1000);
|
439 |
var milisec=now.getMilliseconds();
|
473 |
|
474 |
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
475 |
{
|
476 |
+
ycd_time_add((size/2),size/6*3, size, cns, clockd, extraOptions);
|
477 |
}
|
478 |
|
479 |
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
480 |
{
|
481 |
+
ycd_date_add((size/2),size/6*3+size/10, size, cns, clockd, extraOptions);
|
482 |
}
|
483 |
|
484 |
+
clockd.timer=setTimeout(function(){ycdClockCircles(size, cns, clockd, extraOptions)},50);
|
485 |
}
|
486 |
|
487 |
function clock_grow(size, cns, clockd)
|
555 |
clockd.timer=setTimeout(function(){clock_grow(size, cns, clockd)},50);
|
556 |
}
|
557 |
|
558 |
+
function ycdClockDots(size, cns, clockd,extraOptions)
|
559 |
{
|
560 |
cns.clearRect(0,0,size,size);
|
561 |
|
568 |
|
569 |
if((clockd.hasOwnProperty("indicate") && clockd.indicate==true) || !clockd.hasOwnProperty("indicate"))
|
570 |
{
|
571 |
+
indicator(size, cns, clockd);
|
572 |
}
|
573 |
|
574 |
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
575 |
{
|
576 |
+
ycd_time_add((size/2),size/6*3, size, cns, clockd, extraOptions);
|
577 |
}
|
578 |
|
579 |
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
580 |
{
|
581 |
+
ycd_date_add((size/2),size/6*3+size/10, size, cns, clockd, extraOptions);
|
582 |
}
|
583 |
|
584 |
+
var now = ycdGetChangedDateFromTimeZone(extraOptions);
|
585 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
586 |
now.setTime(now.getTime()+time_off*1000);
|
587 |
var milisec=now.getMilliseconds();
|
636 |
cns.closePath();
|
637 |
}
|
638 |
|
639 |
+
clockd.timer=setTimeout(function(){ycdClockDots(size, cns, clockd, extraOptions)},50);
|
640 |
}
|
641 |
|
642 |
function clock_num(size, cns, clockd)
|
833 |
clockd.timer=setTimeout(function(){clock_digitalran(size, cns, clockd)},50);
|
834 |
}
|
835 |
|
836 |
+
function ycdClockBars(size, cns, clockd, extraOptions)
|
837 |
{
|
838 |
cns.clearRect(0,0,size,size);
|
839 |
|
844 |
cns.closePath();
|
845 |
if(clockd.hasOwnProperty("bgLoaded") && clockd.bgLoaded==1){if(clockd.hasOwnProperty("bg_opacity")){cns.globalAlpha=clockd["bg_opacity"];cns.drawImage(clockd.bgImage,0,0,size,size);cns.globalAlpha=1;}}
|
846 |
|
847 |
+
var now = ycdGetChangedDateFromTimeZone(extraOptions);
|
848 |
+
|
849 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
850 |
now.setTime(now.getTime()+time_off*1000);
|
851 |
var mili=now.getMilliseconds();
|
888 |
|
889 |
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
890 |
{
|
891 |
+
ycd_time_add((size/2),size/20, size, cns, clockd, extraOptions);
|
892 |
}
|
893 |
|
894 |
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
895 |
{
|
896 |
+
ycd_date_add((size/2),size/14*13, size, cns, clockd, extraOptions);
|
897 |
}
|
898 |
|
899 |
cns.strokeStyle=(clockd.hasOwnProperty("indicate_color"))?clockd["indicate_color"]:"#333333";
|
925 |
cns.fill();
|
926 |
cns.closePath();
|
927 |
|
928 |
+
clockd.timer=setTimeout(function(){ycdClockBars(size, cns, clockd, extraOptions)},50);
|
929 |
}
|
930 |
|
931 |
+
function ycdClockPlanets(size, cns, clockd, extraOptions)
|
932 |
{
|
933 |
cns.clearRect(0,0,size,size);
|
934 |
|
946 |
|
947 |
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
948 |
{
|
949 |
+
ycd_time_add((size/2),size/5*3, size, cns, clockd, extraOptions);
|
950 |
}
|
951 |
|
952 |
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
953 |
{
|
954 |
+
ycd_date_add((size/2),size/5*3+size/10, size, cns, clockd, extraOptions);
|
955 |
}
|
956 |
|
957 |
+
var now = ycdGetChangedDateFromTimeZone(extraOptions);
|
958 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
959 |
now.setTime(now.getTime()+time_off*1000);
|
960 |
var milisec=now.getMilliseconds();
|
1036 |
cns.fill();
|
1037 |
cns.closePath();
|
1038 |
|
1039 |
+
clockd.timer=setTimeout(function(){ycdClockPlanets(size, cns, clockd, extraOptions)},50);
|
1040 |
}
|
1041 |
|
1042 |
function clock_roulette(size, cns, clockd)
|
1256 |
return;
|
1257 |
}
|
1258 |
|
1259 |
+
var now = ycdGetChangedDateFromTimeZone(extraOptions);
|
|
|
|
|
|
|
|
|
|
|
1260 |
|
1261 |
now = new Date(now);
|
1262 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
1295 |
}
|
1296 |
}
|
1297 |
|
1298 |
+
function ycd_date_add(x, y, size, cns, clockd, extraOptions)
|
1299 |
{
|
1300 |
if(!clockd.hasOwnProperty("date_add"))
|
1301 |
{
|
1302 |
return;
|
1303 |
}
|
1304 |
|
1305 |
+
var now = ycdGetChangedDateFromTimeZone(extraOptions);
|
1306 |
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
1307 |
now.setTime(now.getTime()+time_off*1000);
|
1308 |
var day=now.getDate();
|
1339 |
cns.fillText(day+" "+month_arr[month],x,y);
|
1340 |
}
|
1341 |
}
|
1342 |
+
|
1343 |
+
function ycdGetChangedDateFromTimeZone(extraOptions) {
|
1344 |
+
var now = new Date();
|
1345 |
+
if (extraOptions && extraOptions.timeZone != null && extraOptions.timeZone) {
|
1346 |
+
var now = new Date().toLocaleString('en-US', {
|
1347 |
+
timeZone: extraOptions.timeZone
|
1348 |
+
});
|
1349 |
+
}
|
1350 |
+
|
1351 |
+
now = new Date(now);
|
1352 |
+
|
1353 |
+
return now;
|
1354 |
+
}
|
assets/views/main/clock1View.php
CHANGED
@@ -9,7 +9,7 @@ $type = $this->getCurrentTypeFromOptions();
|
|
9 |
<label class="ycd-label-of-input"><?php _e('Time zone', YCD_TEXT_DOMAIN); ?></label>
|
10 |
</div>
|
11 |
<div class="col-md-5">
|
12 |
-
<?php echo AdminHelper::selectBox($defaultData['clock-time-zone'], esc_attr($this->getOptionValue('ycd-clock1-time-zone')), array('name' => 'ycd-clock1-time-zone', 'class' => 'js-ycd-select js-circle-time-zone')); ?>
|
13 |
</div>
|
14 |
</div>
|
15 |
<div class="row form-group">
|
@@ -17,7 +17,7 @@ $type = $this->getCurrentTypeFromOptions();
|
|
17 |
<label for="ycd-clock1-width" class="ycd-label-of-input"><?php _e('Dimension', YCD_TEXT_DOMAIN); ?></label>
|
18 |
</div>
|
19 |
<div class="col-md-5">
|
20 |
-
<input type="number" name="ycd-clock1-width" class="form-control" id="ycd-clock1-width" value="<?php echo esc_attr($this->getOptionValue('ycd-clock1-width')); ?>">
|
21 |
</div>
|
22 |
<div class="col-md-1 ycd-label-of-input">
|
23 |
<?php _e('px', YCD_TEXT_DOMAIN); ?>
|
@@ -28,7 +28,7 @@ $type = $this->getCurrentTypeFromOptions();
|
|
28 |
<label class="ycd-label-of-input"><?php _e('Alignment', YCD_TEXT_DOMAIN); ?></label>
|
29 |
</div>
|
30 |
<div class="col-md-5">
|
31 |
-
<?php echo AdminHelper::selectBox($defaultData['horizontal-alignment'], esc_attr($this->getOptionValue('ycd-clock1-alignment')), array('name' => 'ycd-clock1-alignment', 'class' => 'js-ycd-select
|
32 |
</div>
|
33 |
</div>
|
34 |
</div>
|
9 |
<label class="ycd-label-of-input"><?php _e('Time zone', YCD_TEXT_DOMAIN); ?></label>
|
10 |
</div>
|
11 |
<div class="col-md-5">
|
12 |
+
<?php echo AdminHelper::selectBox($defaultData['clock-time-zone'], esc_attr($this->getOptionValue('ycd-clock1-time-zone')), array('name' => 'ycd-clock1-time-zone','data-target-index' => '1','class' => 'js-ycd-select js-circle-time-zone')); ?>
|
13 |
</div>
|
14 |
</div>
|
15 |
<div class="row form-group">
|
17 |
<label for="ycd-clock1-width" class="ycd-label-of-input"><?php _e('Dimension', YCD_TEXT_DOMAIN); ?></label>
|
18 |
</div>
|
19 |
<div class="col-md-5">
|
20 |
+
<input type="number" name="ycd-clock1-width" data-target-index="1" class="form-control ycd-clock-width" id="ycd-clock1-width" value="<?php echo esc_attr($this->getOptionValue('ycd-clock1-width')); ?>">
|
21 |
</div>
|
22 |
<div class="col-md-1 ycd-label-of-input">
|
23 |
<?php _e('px', YCD_TEXT_DOMAIN); ?>
|
28 |
<label class="ycd-label-of-input"><?php _e('Alignment', YCD_TEXT_DOMAIN); ?></label>
|
29 |
</div>
|
30 |
<div class="col-md-5">
|
31 |
+
<?php echo AdminHelper::selectBox($defaultData['horizontal-alignment'], esc_attr($this->getOptionValue('ycd-clock1-alignment')), array('name' => 'ycd-clock1-alignment', 'class' => 'js-ycd-select ycd-clock1-alignment ycd-clock-alignment')); ?>
|
32 |
</div>
|
33 |
</div>
|
34 |
</div>
|
assets/views/main/clock2View.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
use ycd\AdminHelper;
|
3 |
+
$defaultData = AdminHelper::defaultData();
|
4 |
+
$type = $this->getCurrentTypeFromOptions();
|
5 |
+
?>
|
6 |
+
<div class="ycd-bootstrap-wrapper">
|
7 |
+
<div class="row form-group">
|
8 |
+
<div class="col-md-6">
|
9 |
+
<label class="ycd-label-of-input"><?php _e('Time zone', YCD_TEXT_DOMAIN); ?></label>
|
10 |
+
</div>
|
11 |
+
<div class="col-md-5">
|
12 |
+
<?php echo AdminHelper::selectBox($defaultData['clock-time-zone'], esc_attr($this->getOptionValue('ycd-clock2-time-zone')), array('name' => 'ycd-clock2-time-zone','data-target-index' => '2', 'class' => 'js-ycd-select js-circle-time-zone')); ?>
|
13 |
+
</div>
|
14 |
+
</div>
|
15 |
+
<div class="row form-group">
|
16 |
+
<div class="col-md-6">
|
17 |
+
<label for="ycd-clock2-width" class="ycd-label-of-input"><?php _e('Dimension', YCD_TEXT_DOMAIN); ?></label>
|
18 |
+
</div>
|
19 |
+
<div class="col-md-5">
|
20 |
+
<input type="number" name="ycd-clock2-width" data-target-index="2" class="form-control ycd-clock-width" id="ycd-clock2-width" value="<?php echo esc_attr($this->getOptionValue('ycd-clock2-width')); ?>">
|
21 |
+
</div>
|
22 |
+
<div class="col-md-1 ycd-label-of-input">
|
23 |
+
<?php _e('px', YCD_TEXT_DOMAIN); ?>
|
24 |
+
</div>
|
25 |
+
</div>
|
26 |
+
<div class="row">
|
27 |
+
<div class="col-md-6">
|
28 |
+
<label class="ycd-label-of-input"><?php _e('Alignment', YCD_TEXT_DOMAIN); ?></label>
|
29 |
+
</div>
|
30 |
+
<div class="col-md-5">
|
31 |
+
<?php echo AdminHelper::selectBox($defaultData['horizontal-alignment'], esc_attr($this->getOptionValue('ycd-clock2-alignment')), array('name' => 'ycd-clock2-alignment', 'class' => 'js-ycd-select ycd-clock2-alignment ycd-clock-alignment')); ?>
|
32 |
+
</div>
|
33 |
+
</div>
|
34 |
+
</div>
|
35 |
+
<?php
|
36 |
+
require_once YCD_VIEWS_PATH.'preview.php';
|
37 |
+
?>
|
38 |
+
<input type="hidden" name="ycd-type" value="<?php echo esc_attr($type); ?>">
|
assets/views/main/clock3View.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
use ycd\AdminHelper;
|
3 |
+
$defaultData = AdminHelper::defaultData();
|
4 |
+
$type = $this->getCurrentTypeFromOptions();
|
5 |
+
?>
|
6 |
+
<div class="ycd-bootstrap-wrapper">
|
7 |
+
<div class="row form-group">
|
8 |
+
<div class="col-md-6">
|
9 |
+
<label class="ycd-label-of-input"><?php _e('Time zone', YCD_TEXT_DOMAIN); ?></label>
|
10 |
+
</div>
|
11 |
+
<div class="col-md-5">
|
12 |
+
<?php echo AdminHelper::selectBox($defaultData['clock-time-zone'], esc_attr($this->getOptionValue('ycd-clock3-time-zone')), array('name' => 'ycd-clock3-time-zone','data-target-index' => '3', 'class' => 'js-ycd-select js-circle-time-zone')); ?>
|
13 |
+
</div>
|
14 |
+
</div>
|
15 |
+
<div class="row form-group">
|
16 |
+
<div class="col-md-6">
|
17 |
+
<label for="ycd-clock3-width" class="ycd-label-of-input"><?php _e('Dimension', YCD_TEXT_DOMAIN); ?></label>
|
18 |
+
</div>
|
19 |
+
<div class="col-md-5">
|
20 |
+
<input type="number" name="ycd-clock3-width" data-target-index="3" class="form-control ycd-clock-width" id="ycd-clock3-width" value="<?php echo esc_attr($this->getOptionValue('ycd-clock3-width')); ?>">
|
21 |
+
</div>
|
22 |
+
<div class="col-md-1 ycd-label-of-input">
|
23 |
+
<?php _e('px', YCD_TEXT_DOMAIN); ?>
|
24 |
+
</div>
|
25 |
+
</div>
|
26 |
+
<div class="row">
|
27 |
+
<div class="col-md-6">
|
28 |
+
<label class="ycd-label-of-input"><?php _e('Alignment', YCD_TEXT_DOMAIN); ?></label>
|
29 |
+
</div>
|
30 |
+
<div class="col-md-5">
|
31 |
+
<?php echo AdminHelper::selectBox($defaultData['horizontal-alignment'], esc_attr($this->getOptionValue('ycd-clock3-alignment')), array('name' => 'ycd-clock3-alignment', 'class' => 'js-ycd-select ycd-clock3-alignment ycd-clock-alignment')); ?>
|
32 |
+
</div>
|
33 |
+
</div>
|
34 |
+
</div>
|
35 |
+
<?php
|
36 |
+
require_once YCD_VIEWS_PATH.'preview.php';
|
37 |
+
?>
|
38 |
+
<input type="hidden" name="ycd-type" value="<?php echo esc_attr($type); ?>">
|
classes/countdown/Clock2Countdown.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace ycd;
|
3 |
+
|
4 |
+
class Clock2Countdown extends Countdown {
|
5 |
+
|
6 |
+
public function __construct() {
|
7 |
+
add_filter('ycdGeneralMetaboxes', array($this, 'metaboxes'));
|
8 |
+
add_action('add_meta_boxes', array($this, 'mainOptions'));
|
9 |
+
add_filter('ycdCountdownDefaultOptions', array($this, 'defaultOptions'), 1, 1);
|
10 |
+
}
|
11 |
+
|
12 |
+
public function metaboxes($mtaboxes) {
|
13 |
+
unset($mtaboxes['generalOptions']);
|
14 |
+
unset($mtaboxes['afterCountdownExpire']);
|
15 |
+
|
16 |
+
return $mtaboxes;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function defaultOptions($options) {
|
20 |
+
|
21 |
+
return $options;
|
22 |
+
}
|
23 |
+
|
24 |
+
public function includeStyles() {
|
25 |
+
wp_enqueue_script("jquery-ui-draggable");
|
26 |
+
ScriptsIncluder::registerScript('canvas_clock.js', array('dirUrl' => YCD_COUNTDOWN_JS_URL.'clock/'));
|
27 |
+
ScriptsIncluder::enqueueScript('canvas_clock.js');
|
28 |
+
ScriptsIncluder::registerScript('Clock.js', array('dirUrl' => YCD_COUNTDOWN_JS_URL.'clock/'));
|
29 |
+
ScriptsIncluder::enqueueScript('Clock.js');
|
30 |
+
}
|
31 |
+
|
32 |
+
public function mainOptions(){
|
33 |
+
parent::mainOptions();
|
34 |
+
add_meta_box('ycdMainOptions', __('Clock options', YCD_TEXT_DOMAIN), array($this, 'mainView'), YCD_COUNTDOWN_POST_TYPE, 'normal', 'high');
|
35 |
+
}
|
36 |
+
|
37 |
+
public function mainView() {
|
38 |
+
$typeObj = $this;
|
39 |
+
require_once YCD_VIEWS_MAIN_PATH.'clock2View.php';
|
40 |
+
}
|
41 |
+
|
42 |
+
public function renderLivePreview()
|
43 |
+
{
|
44 |
+
$typeObj = $this;
|
45 |
+
require_once YCD_PREVIEW_VIEWS_PATH . 'circlePreview.php';
|
46 |
+
}
|
47 |
+
|
48 |
+
private function getClockArgs() {
|
49 |
+
$args = array(
|
50 |
+
'indicate' => true,
|
51 |
+
'indicate_color' => '#222',
|
52 |
+
'dial1_color' => '#666600',
|
53 |
+
'dial2_color' => '#81812e',
|
54 |
+
'dial3_color' => '#9d9d5c',
|
55 |
+
'time_add' => 1,
|
56 |
+
'time_24h' => true,
|
57 |
+
'date_add' => 3,
|
58 |
+
'date_add_color' => '#999',
|
59 |
+
);
|
60 |
+
|
61 |
+
return $args;
|
62 |
+
}
|
63 |
+
|
64 |
+
private function getCanvasOptions() {
|
65 |
+
$options = array();
|
66 |
+
$width = (int)$this->getOptionValue('ycd-clock2-width');
|
67 |
+
$timeZone = $this->getOptionValue('ycd-clock2-time-zone');
|
68 |
+
|
69 |
+
$options['width'] = $width;
|
70 |
+
$options['timeZone'] = $timeZone;
|
71 |
+
|
72 |
+
return $options;
|
73 |
+
}
|
74 |
+
|
75 |
+
private function getStylesStr() {
|
76 |
+
$align = $this->getOptionValue('ycd-clock2-alignment');
|
77 |
+
$id = $this->getId();
|
78 |
+
|
79 |
+
$style = '<style type="text/css">';
|
80 |
+
$style .= '.ycd-countdown-'.esc_attr($id).'-wrapper {';
|
81 |
+
$style .= 'text-align: '.$align;
|
82 |
+
$style .= '}';
|
83 |
+
$style .= '</style>';
|
84 |
+
|
85 |
+
return $style;
|
86 |
+
}
|
87 |
+
|
88 |
+
public function getViewContent() {
|
89 |
+
$this->includeStyles();
|
90 |
+
$id = $this->getId();
|
91 |
+
|
92 |
+
$options = $this->getCanvasOptions();
|
93 |
+
$width = @$options['width'];
|
94 |
+
$args = $this->getClockArgs();
|
95 |
+
|
96 |
+
$args = json_encode($args);
|
97 |
+
$options = json_encode($options);
|
98 |
+
|
99 |
+
$content = '<div class="ycd-countdown-wrapper ycd-countdown-'.esc_attr($id).'-wrapper">';
|
100 |
+
$content .= '<canvas data-args="'.esc_attr($args).'" data-options="'.esc_attr($options).'" class="ycdClock2" width="'.$width.'px" height="'.$width.'px"></canvas>';
|
101 |
+
$content .= $this->renderSubscriptionForm();
|
102 |
+
$content .= '</div>';
|
103 |
+
$content .= $this->getStylesStr();
|
104 |
+
|
105 |
+
return $content;
|
106 |
+
}
|
107 |
+
}
|
classes/countdown/Clock3Countdown.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace ycd;
|
3 |
+
|
4 |
+
class Clock3Countdown extends Countdown {
|
5 |
+
|
6 |
+
public function __construct() {
|
7 |
+
add_filter('ycdGeneralMetaboxes', array($this, 'metaboxes'));
|
8 |
+
add_action('add_meta_boxes', array($this, 'mainOptions'));
|
9 |
+
add_filter('ycdCountdownDefaultOptions', array($this, 'defaultOptions'), 1, 1);
|
10 |
+
}
|
11 |
+
|
12 |
+
public function metaboxes($mtaboxes) {
|
13 |
+
unset($mtaboxes['generalOptions']);
|
14 |
+
unset($mtaboxes['afterCountdownExpire']);
|
15 |
+
|
16 |
+
return $mtaboxes;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function defaultOptions($options) {
|
20 |
+
|
21 |
+
return $options;
|
22 |
+
}
|
23 |
+
|
24 |
+
public function includeStyles() {
|
25 |
+
wp_enqueue_script("jquery-ui-draggable");
|
26 |
+
ScriptsIncluder::registerScript('canvas_clock.js', array('dirUrl' => YCD_COUNTDOWN_JS_URL.'clock/'));
|
27 |
+
ScriptsIncluder::enqueueScript('canvas_clock.js');
|
28 |
+
ScriptsIncluder::registerScript('Clock.js', array('dirUrl' => YCD_COUNTDOWN_JS_URL.'clock/'));
|
29 |
+
ScriptsIncluder::enqueueScript('Clock.js');
|
30 |
+
}
|
31 |
+
|
32 |
+
public function mainOptions(){
|
33 |
+
parent::mainOptions();
|
34 |
+
add_meta_box('ycdMainOptions', __('Clock options', YCD_TEXT_DOMAIN), array($this, 'mainView'), YCD_COUNTDOWN_POST_TYPE, 'normal', 'high');
|
35 |
+
}
|
36 |
+
|
37 |
+
public function mainView() {
|
38 |
+
$typeObj = $this;
|
39 |
+
require_once YCD_VIEWS_MAIN_PATH.'clock3View.php';
|
40 |
+
}
|
41 |
+
|
42 |
+
public function renderLivePreview()
|
43 |
+
{
|
44 |
+
$typeObj = $this;
|
45 |
+
require_once YCD_PREVIEW_VIEWS_PATH . 'circlePreview.php';
|
46 |
+
}
|
47 |
+
|
48 |
+
private function getClockArgs() {
|
49 |
+
$args = array(
|
50 |
+
'indicate' => true,
|
51 |
+
'indicate_color' => '#222',
|
52 |
+
'dial1_color' => '#666600',
|
53 |
+
'dial2_color' => '#81812e',
|
54 |
+
'dial3_color' => '#9d9d5c',
|
55 |
+
'time_add' => 1,
|
56 |
+
'time_24h' => true,
|
57 |
+
'date_add' => 3,
|
58 |
+
'date_add_color' => '#999',
|
59 |
+
);
|
60 |
+
|
61 |
+
return $args;
|
62 |
+
}
|
63 |
+
|
64 |
+
private function getCanvasOptions() {
|
65 |
+
$options = array();
|
66 |
+
$width = (int)$this->getOptionValue('ycd-clock3-width');
|
67 |
+
$timeZone = $this->getOptionValue('ycd-clock3-time-zone');
|
68 |
+
|
69 |
+
$options['width'] = $width;
|
70 |
+
$options['timeZone'] = $timeZone;
|
71 |
+
|
72 |
+
return $options;
|
73 |
+
}
|
74 |
+
|
75 |
+
private function getStylesStr() {
|
76 |
+
$align = $this->getOptionValue('ycd-clock3-alignment');
|
77 |
+
$id = $this->getId();
|
78 |
+
|
79 |
+
$style = '<style type="text/css">';
|
80 |
+
$style .= '.ycd-countdown-'.esc_attr($id).'-wrapper {';
|
81 |
+
$style .= 'text-align: '.$align;
|
82 |
+
$style .= '}';
|
83 |
+
$style .= '</style>';
|
84 |
+
|
85 |
+
return $style;
|
86 |
+
}
|
87 |
+
|
88 |
+
public function getViewContent() {
|
89 |
+
$this->includeStyles();
|
90 |
+
$id = $this->getId();
|
91 |
+
|
92 |
+
$options = $this->getCanvasOptions();
|
93 |
+
$width = @$options['width'];
|
94 |
+
$args = $this->getClockArgs();
|
95 |
+
|
96 |
+
$args = json_encode($args);
|
97 |
+
$options = json_encode($options);
|
98 |
+
|
99 |
+
$content = '<div class="ycd-countdown-wrapper ycd-countdown-'.esc_attr($id).'-wrapper">';
|
100 |
+
$content .= '<canvas data-args="'.esc_attr($args).'" data-options="'.esc_attr($options).'" class="ycdClock3" width="'.$width.'px" height="'.$width.'px"></canvas>';
|
101 |
+
$content .= $this->renderSubscriptionForm();
|
102 |
+
$content .= '</div>';
|
103 |
+
$content .= $this->getStylesStr();
|
104 |
+
|
105 |
+
return $content;
|
106 |
+
}
|
107 |
+
}
|
config/config.php
CHANGED
@@ -45,8 +45,8 @@ class YcdCountdownConfig {
|
|
45 |
self::addDefine('YCD_FILTER_REPEAT_INTERVAL', 50);
|
46 |
self::addDefine('YCD_CRON_REPEAT_INTERVAL', 1);
|
47 |
self::addDefine('YCD_TABLE_LIMIT', 15);
|
48 |
-
self::addDefine('YCD_VERSION', 1.
|
49 |
-
self::addDefine('YCD_VERSION_PRO', 1.
|
50 |
self::addDefine('YCD_FREE_VERSION', 1);
|
51 |
self::addDefine('YCD_SILVER_VERSION', 2);
|
52 |
self::addDefine('YCD_GOLD_VERSION', 3);
|
45 |
self::addDefine('YCD_FILTER_REPEAT_INTERVAL', 50);
|
46 |
self::addDefine('YCD_CRON_REPEAT_INTERVAL', 1);
|
47 |
self::addDefine('YCD_TABLE_LIMIT', 15);
|
48 |
+
self::addDefine('YCD_VERSION', 1.32);
|
49 |
+
self::addDefine('YCD_VERSION_PRO', 1.19);
|
50 |
self::addDefine('YCD_FREE_VERSION', 1);
|
51 |
self::addDefine('YCD_SILVER_VERSION', 2);
|
52 |
self::addDefine('YCD_GOLD_VERSION', 3);
|
config/optionsConfig.php
CHANGED
@@ -9,6 +9,12 @@ class YcdCountdownOptionsConfig {
|
|
9 |
'circle' => YCD_FREE_VERSION,
|
10 |
'timer' => YCD_FREE_VERSION,
|
11 |
'clock1' => YCD_FREE_VERSION,
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
'circlePopup' => YCD_SILVER_VERSION,
|
13 |
'flipClock' => YCD_SILVER_VERSION,
|
14 |
'flipClockPopup' => YCD_SILVER_VERSION
|
@@ -18,6 +24,12 @@ class YcdCountdownOptionsConfig {
|
|
18 |
'circle' => YCD_COUNTDOWNS_PATH,
|
19 |
'timer' => YCD_COUNTDOWNS_PATH,
|
20 |
'clock1' => YCD_COUNTDOWNS_PATH,
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
'circlePopup' => YCD_COUNTDOWNS_PATH,
|
22 |
'flipClock' => YCD_COUNTDOWNS_PATH,
|
23 |
'flipClockPopup' => YCD_COUNTDOWNS_PATH
|
@@ -27,6 +39,12 @@ class YcdCountdownOptionsConfig {
|
|
27 |
'circle' => __('Circle', YCD_TEXT_DOMAIN),
|
28 |
'timer' => __('Digital', YCD_TEXT_DOMAIN),
|
29 |
'clock1' => __('Clock 1', YCD_TEXT_DOMAIN),
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
'circlePopup' => __('Circle Popup', YCD_TEXT_DOMAIN),
|
31 |
'flipClock' => __('Flip Clock', YCD_TEXT_DOMAIN),
|
32 |
'flipClockPopup' => __('Flip Clock Popup', YCD_TEXT_DOMAIN)
|
@@ -98,6 +116,19 @@ class YcdCountdownOptionsConfig {
|
|
98 |
// clock
|
99 |
$options[] = array('name' => 'ycd-clock1-time-zone', 'type' => 'text', 'defaultValue' => '');
|
100 |
$options[] = array('name' => 'ycd-clock1-width', 'type' => 'text', 'defaultValue' => 200);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
if(YCD_PKG_VERSION > YCD_FREE_VERSION) {
|
103 |
require_once dirname(__FILE__) . '/proOptionsConfig.php';
|
9 |
'circle' => YCD_FREE_VERSION,
|
10 |
'timer' => YCD_FREE_VERSION,
|
11 |
'clock1' => YCD_FREE_VERSION,
|
12 |
+
'clock2' => YCD_FREE_VERSION,
|
13 |
+
'clock3' => YCD_FREE_VERSION,
|
14 |
+
'clock4' => YCD_SILVER_VERSION,
|
15 |
+
'clock5' => YCD_SILVER_VERSION,
|
16 |
+
'clock6' => YCD_SILVER_VERSION,
|
17 |
+
'clock7' => YCD_SILVER_VERSION,
|
18 |
'circlePopup' => YCD_SILVER_VERSION,
|
19 |
'flipClock' => YCD_SILVER_VERSION,
|
20 |
'flipClockPopup' => YCD_SILVER_VERSION
|
24 |
'circle' => YCD_COUNTDOWNS_PATH,
|
25 |
'timer' => YCD_COUNTDOWNS_PATH,
|
26 |
'clock1' => YCD_COUNTDOWNS_PATH,
|
27 |
+
'clock2' => YCD_COUNTDOWNS_PATH,
|
28 |
+
'clock3' => YCD_COUNTDOWNS_PATH,
|
29 |
+
'clock4' => YCD_COUNTDOWNS_PATH,
|
30 |
+
'clock5' => YCD_COUNTDOWNS_PATH,
|
31 |
+
'clock6' => YCD_COUNTDOWNS_PATH,
|
32 |
+
'clock7' => YCD_COUNTDOWNS_PATH,
|
33 |
'circlePopup' => YCD_COUNTDOWNS_PATH,
|
34 |
'flipClock' => YCD_COUNTDOWNS_PATH,
|
35 |
'flipClockPopup' => YCD_COUNTDOWNS_PATH
|
39 |
'circle' => __('Circle', YCD_TEXT_DOMAIN),
|
40 |
'timer' => __('Digital', YCD_TEXT_DOMAIN),
|
41 |
'clock1' => __('Clock 1', YCD_TEXT_DOMAIN),
|
42 |
+
'clock2' => __('Clock 2', YCD_TEXT_DOMAIN),
|
43 |
+
'clock3' => __('Clock 3', YCD_TEXT_DOMAIN),
|
44 |
+
'clock4' => __('Clock 4', YCD_TEXT_DOMAIN),
|
45 |
+
'clock5' => __('Clock 5', YCD_TEXT_DOMAIN),
|
46 |
+
'clock6' => __('Clock 6', YCD_TEXT_DOMAIN),
|
47 |
+
'clock7' => __('Clock 7', YCD_TEXT_DOMAIN),
|
48 |
'circlePopup' => __('Circle Popup', YCD_TEXT_DOMAIN),
|
49 |
'flipClock' => __('Flip Clock', YCD_TEXT_DOMAIN),
|
50 |
'flipClockPopup' => __('Flip Clock Popup', YCD_TEXT_DOMAIN)
|
116 |
// clock
|
117 |
$options[] = array('name' => 'ycd-clock1-time-zone', 'type' => 'text', 'defaultValue' => '');
|
118 |
$options[] = array('name' => 'ycd-clock1-width', 'type' => 'text', 'defaultValue' => 200);
|
119 |
+
$options[] = array('name' => 'ycd-clock1-alignment', 'type' => 'text', 'defaultValue' => 'center');
|
120 |
+
$options[] = array('name' => 'ycd-clock2-width', 'type' => 'text', 'defaultValue' => 200);
|
121 |
+
$options[] = array('name' => 'ycd-clock2-alignment', 'type' => 'text', 'defaultValue' => 'center');
|
122 |
+
$options[] = array('name' => 'ycd-clock3-width', 'type' => 'text', 'defaultValue' => 200);
|
123 |
+
$options[] = array('name' => 'ycd-clock3-alignment', 'type' => 'text', 'defaultValue' => 'center');
|
124 |
+
$options[] = array('name' => 'ycd-clock4-width', 'type' => 'text', 'defaultValue' => 200);
|
125 |
+
$options[] = array('name' => 'ycd-clock4-alignment', 'type' => 'text', 'defaultValue' => 'center');
|
126 |
+
$options[] = array('name' => 'ycd-clock5-width', 'type' => 'text', 'defaultValue' => 200);
|
127 |
+
$options[] = array('name' => 'ycd-clock5-alignment', 'type' => 'text', 'defaultValue' => 'center');
|
128 |
+
$options[] = array('name' => 'ycd-clock6-width', 'type' => 'text', 'defaultValue' => 200);
|
129 |
+
$options[] = array('name' => 'ycd-clock6-alignment', 'type' => 'text', 'defaultValue' => 'center');
|
130 |
+
$options[] = array('name' => 'ycd-clock7-width', 'type' => 'text', 'defaultValue' => 200);
|
131 |
+
$options[] = array('name' => 'ycd-clock7-alignment', 'type' => 'text', 'defaultValue' => 'center');
|
132 |
|
133 |
if(YCD_PKG_VERSION > YCD_FREE_VERSION) {
|
134 |
require_once dirname(__FILE__) . '/proOptionsConfig.php';
|
countdown-builder.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Countdown builder
|
4 |
* Description: The best countdown plugin
|
5 |
-
* Version: 1.3.
|
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.3.2
|
6 |
* Author: Adam Skaat
|
7 |
* Author URI: https://edmonsoft.com/countdown
|
8 |
* License: GPLv2
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
=== Countdown ===
|
2 |
Contributors: adamskaat
|
3 |
Tags: countdown, timer, countdown timer
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 5.0.2
|
6 |
-
Stable tag: 1.3.
|
7 |
Requires PHP: 5.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -33,6 +33,11 @@ Coming soon
|
|
33 |
|
34 |
== Changelog ==
|
35 |
|
|
|
|
|
|
|
|
|
|
|
36 |
= 1.3.1 =
|
37 |
* Add new type clock
|
38 |
* Code improvement
|
1 |
+
=== Countdown - Clock ===
|
2 |
Contributors: adamskaat
|
3 |
Tags: countdown, timer, countdown timer
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 5.0.2
|
6 |
+
Stable tag: 1.3.2
|
7 |
Requires PHP: 5.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
33 |
|
34 |
== Changelog ==
|
35 |
|
36 |
+
= 1.3.2 =
|
37 |
+
* Added new clock 2 types (new)
|
38 |
+
* Code optimization
|
39 |
+
* Bug fixed
|
40 |
+
|
41 |
= 1.3.1 =
|
42 |
* Add new type clock
|
43 |
* Code improvement
|