Version Description
- Added possibility to translate the circle countdown texts related to browser language.
Download this release
Release Info
Developer | adamskaat |
Plugin | Countdown, Coming Soon – Countdown & Clock |
Version | 2.4.3 |
Comparing to | |
See all releases |
Code changes from version 2.4.1 to 2.4.3
- assets/css/Css.php +3 -1
- assets/css/translation.css +36 -0
- assets/js/Js.php +3 -0
- assets/js/Sticky.js +15 -0
- assets/js/Translation.js +107 -0
- assets/views/cricleMainView.php +10 -0
- assets/views/main/stickyMainView.php +11 -0
- assets/views/translations/circleTranslation.php +11 -0
- classes/countdown/CircleCountdown.php +29 -0
- classes/countdown/StickyCountdown.php +2 -1
- classes/countdown/TimerCountdown.php +1 -1
- classes/translation/AbstractTranslationManager.php +105 -0
- classes/translation/TranslationManager.php +36 -0
- config/config.php +6 -6
- config/optionsConfig.php +2 -0
- countdown-builder.php +1 -1
- helpers/AdminHelper.php +24 -2
- readme.txt +7 -1
assets/css/Css.php
CHANGED
@@ -53,6 +53,7 @@ class Css {
|
|
53 |
ScriptsIncluder::registerStyle('ion.rangeSlider.skinFlat.css');
|
54 |
ScriptsIncluder::registerStyle('select2.css');
|
55 |
ScriptsIncluder::registerStyle('jquery.dateTimePicker.min.css');
|
|
|
56 |
$settingsKey = $this->getSettingsPageKey();
|
57 |
$supportKey = $this->getSupportPageKey();
|
58 |
$subscriberKey = $this->getSubscribersPageKey();
|
@@ -80,7 +81,8 @@ class Css {
|
|
80 |
ScriptsIncluder::enqueueStyle('ion.rangeSlider.skinFlat.css');
|
81 |
ScriptsIncluder::enqueueStyle('select2.css');
|
82 |
ScriptsIncluder::enqueueStyle('jquery.dateTimePicker.min.css');
|
83 |
-
|
|
|
84 |
if (YCD_PKG_VERSION > YCD_FREE_VERSION) {
|
85 |
Subscription::renderStyles();
|
86 |
}
|
53 |
ScriptsIncluder::registerStyle('ion.rangeSlider.skinFlat.css');
|
54 |
ScriptsIncluder::registerStyle('select2.css');
|
55 |
ScriptsIncluder::registerStyle('jquery.dateTimePicker.min.css');
|
56 |
+
ScriptsIncluder::registerStyle('translation.css');
|
57 |
$settingsKey = $this->getSettingsPageKey();
|
58 |
$supportKey = $this->getSupportPageKey();
|
59 |
$subscriberKey = $this->getSubscribersPageKey();
|
81 |
ScriptsIncluder::enqueueStyle('ion.rangeSlider.skinFlat.css');
|
82 |
ScriptsIncluder::enqueueStyle('select2.css');
|
83 |
ScriptsIncluder::enqueueStyle('jquery.dateTimePicker.min.css');
|
84 |
+
ScriptsIncluder::enqueueStyle('translation.css');
|
85 |
+
|
86 |
if (YCD_PKG_VERSION > YCD_FREE_VERSION) {
|
87 |
Subscription::renderStyles();
|
88 |
}
|
assets/css/translation.css
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.ycd-container-wrapper .ycd-translation-wrapper {
|
2 |
+
margin-bottom: 20px;
|
3 |
+
}
|
4 |
+
#template-wrapper {
|
5 |
+
width: 1px;
|
6 |
+
height: 1px;
|
7 |
+
position: absolute;
|
8 |
+
left: -90000px;
|
9 |
+
}
|
10 |
+
.ycd-translation-header {
|
11 |
+
background: #fff;
|
12 |
+
border: 1px solid #ccc;
|
13 |
+
border-radius: 4px;
|
14 |
+
color: #888;
|
15 |
+
padding: 15px 20px;
|
16 |
+
position: relative
|
17 |
+
}
|
18 |
+
|
19 |
+
.delete-item {
|
20 |
+
position: absolute;
|
21 |
+
right: 20px;
|
22 |
+
cursor: pointer;
|
23 |
+
}
|
24 |
+
|
25 |
+
.ycd-translation-body {
|
26 |
+
background: #fff;
|
27 |
+
border: 1px solid #ccc;
|
28 |
+
border-radius: 4px;
|
29 |
+
color: #888;
|
30 |
+
padding: 15px 20px;
|
31 |
+
position: relative;
|
32 |
+
}
|
33 |
+
|
34 |
+
.ycd-hide {
|
35 |
+
display: none;
|
36 |
+
}
|
assets/js/Js.php
CHANGED
@@ -54,6 +54,7 @@ class Js {
|
|
54 |
ScriptsIncluder::localizeScript('WpCountdownBlockMin.js', 'YCD_GUTENBERG_PARAMS', esc_attr($blockSettings));
|
55 |
ScriptsIncluder::enqueueScript('WpCountdownBlockMin.js');
|
56 |
|
|
|
57 |
ScriptsIncluder::registerScript('Admin.js');
|
58 |
ScriptsIncluder::localizeScript('Admin.js', 'ycd_admin_localized', array(
|
59 |
'nonce' => wp_create_nonce('ycd_ajax_nonce'),
|
@@ -89,10 +90,12 @@ class Js {
|
|
89 |
if(in_array($hook, $allowedPages) || get_post_type($post) == YCD_COUNTDOWN_POST_TYPE || @$_GET['post_type'] == YCD_COUNTDOWN_POST_TYPE) {
|
90 |
|
91 |
wp_enqueue_script('jquery-ui-core');
|
|
|
92 |
if(function_exists('wp_enqueue_code_editor')) {
|
93 |
wp_enqueue_code_editor(array( 'type' => 'text/html'));
|
94 |
}
|
95 |
ScriptsIncluder::enqueueScript('Admin.js');
|
|
|
96 |
if(YCD_PKG_VERSION != YCD_FREE_VERSION) {
|
97 |
ScriptsIncluder::registerScript('AdminPro.js');
|
98 |
ScriptsIncluder::enqueueScript('AdminPro.js');
|
54 |
ScriptsIncluder::localizeScript('WpCountdownBlockMin.js', 'YCD_GUTENBERG_PARAMS', esc_attr($blockSettings));
|
55 |
ScriptsIncluder::enqueueScript('WpCountdownBlockMin.js');
|
56 |
|
57 |
+
ScriptsIncluder::registerScript('Translation.js');
|
58 |
ScriptsIncluder::registerScript('Admin.js');
|
59 |
ScriptsIncluder::localizeScript('Admin.js', 'ycd_admin_localized', array(
|
60 |
'nonce' => wp_create_nonce('ycd_ajax_nonce'),
|
90 |
if(in_array($hook, $allowedPages) || get_post_type($post) == YCD_COUNTDOWN_POST_TYPE || @$_GET['post_type'] == YCD_COUNTDOWN_POST_TYPE) {
|
91 |
|
92 |
wp_enqueue_script('jquery-ui-core');
|
93 |
+
wp_enqueue_script( 'jquery-ui-droppable' );
|
94 |
if(function_exists('wp_enqueue_code_editor')) {
|
95 |
wp_enqueue_code_editor(array( 'type' => 'text/html'));
|
96 |
}
|
97 |
ScriptsIncluder::enqueueScript('Admin.js');
|
98 |
+
ScriptsIncluder::enqueueScript('Translation.js');
|
99 |
if(YCD_PKG_VERSION != YCD_FREE_VERSION) {
|
100 |
ScriptsIncluder::registerScript('AdminPro.js');
|
101 |
ScriptsIncluder::enqueueScript('AdminPro.js');
|
assets/js/Sticky.js
CHANGED
@@ -53,11 +53,26 @@ YcdSticky.prototype.stickyClock = function() {
|
|
53 |
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
54 |
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
|
55 |
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
|
|
|
56 |
|
57 |
days = ((days > 0)? days: 0);
|
58 |
hours = ((hours > 0)? hours: 0);
|
59 |
minutes = ((minutes > 0)? minutes: 0);
|
60 |
seconds = ((seconds > 0)? seconds: 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
var clockHtml = days + YCD_STICKY_ARGS.days+" " + hours + YCD_STICKY_ARGS.hours+ " " + minutes + YCD_STICKY_ARGS.minutes+" " + seconds + YCD_STICKY_ARGS.seconds;
|
62 |
stickyClock.html(clockHtml);
|
63 |
|
53 |
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
54 |
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
|
55 |
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
|
56 |
+
var isDouble = YCD_STICKY_ARGS.double;
|
57 |
|
58 |
days = ((days > 0)? days: 0);
|
59 |
hours = ((hours > 0)? hours: 0);
|
60 |
minutes = ((minutes > 0)? minutes: 0);
|
61 |
seconds = ((seconds > 0)? seconds: 0);
|
62 |
+
if (isDouble) {
|
63 |
+
if (days < 10) {
|
64 |
+
days = '0'+days
|
65 |
+
}
|
66 |
+
if (hours < 10) {
|
67 |
+
hours = '0'+hours
|
68 |
+
}
|
69 |
+
if (minutes < 10) {
|
70 |
+
minutes = '0'+minutes
|
71 |
+
}
|
72 |
+
if (seconds < 10) {
|
73 |
+
seconds = '0'+seconds
|
74 |
+
}
|
75 |
+
}
|
76 |
var clockHtml = days + YCD_STICKY_ARGS.days+" " + hours + YCD_STICKY_ARGS.hours+ " " + minutes + YCD_STICKY_ARGS.minutes+" " + seconds + YCD_STICKY_ARGS.seconds;
|
77 |
stickyClock.html(clockHtml);
|
78 |
|
assets/js/Translation.js
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function YcdTranslation() {
|
2 |
+
this.init();
|
3 |
+
}
|
4 |
+
|
5 |
+
YcdTranslation.prototype.init = function () {
|
6 |
+
this.addTranslation();
|
7 |
+
this.action();
|
8 |
+
};
|
9 |
+
|
10 |
+
YcdTranslation.prototype.action = function () {
|
11 |
+
this.toggle();
|
12 |
+
this.select2();
|
13 |
+
this.changeLanguage();
|
14 |
+
this.deleteItem();
|
15 |
+
};
|
16 |
+
|
17 |
+
YcdTranslation.prototype.select2 = function () {
|
18 |
+
var select2 = jQuery(".ycd-container-wrapper .ycd-select2");
|
19 |
+
|
20 |
+
if(!select2.length) {
|
21 |
+
return false;
|
22 |
+
}
|
23 |
+
|
24 |
+
select2.select2({
|
25 |
+
width: "200px"
|
26 |
+
});
|
27 |
+
}
|
28 |
+
|
29 |
+
YcdTranslation.prototype.changeLanguage = function () {
|
30 |
+
jQuery('.ycd-tr-language').bind('change', function () {
|
31 |
+
var id = jQuery(this).data('id');
|
32 |
+
var text = jQuery("option:selected", this).text();
|
33 |
+
|
34 |
+
jQuery('.ycd-translation-wrapper-'+id+' .tab-language-tab').text(text);
|
35 |
+
})
|
36 |
+
}
|
37 |
+
|
38 |
+
YcdTranslation.prototype.deleteItem = function () {
|
39 |
+
jQuery('.delete-item').bind('click', function (e) {
|
40 |
+
e.preventDefault();
|
41 |
+
if (confirm("Are you sure?")) {
|
42 |
+
var id = jQuery(this).data('id');
|
43 |
+
jQuery('.ycd-translation-wrapper-'+id).remove();
|
44 |
+
return ;
|
45 |
+
}
|
46 |
+
})
|
47 |
+
}
|
48 |
+
|
49 |
+
YcdTranslation.prototype.toggle = function () {
|
50 |
+
jQuery('.ycd-translation-header').unbind('click').bind('click', function (e) {
|
51 |
+
e.preventDefault();
|
52 |
+
var hiddenClass = 'ycd-hide';
|
53 |
+
|
54 |
+
var body = jQuery(this).next('.ycd-translation-body');
|
55 |
+
if (body.hasClass(hiddenClass)) {
|
56 |
+
body.removeClass(hiddenClass)
|
57 |
+
}
|
58 |
+
else {
|
59 |
+
body.addClass(hiddenClass);
|
60 |
+
}
|
61 |
+
})
|
62 |
+
}
|
63 |
+
|
64 |
+
YcdTranslation.getMaxIndex = function () {
|
65 |
+
var idsList = [];
|
66 |
+
jQuery('.ycd-container-wrapper .ycd-translation-wrapper').each(function(current) {
|
67 |
+
let id = jQuery(this).data('id');
|
68 |
+
console.log(id);
|
69 |
+
idsList.push(id);
|
70 |
+
});
|
71 |
+
let max = Math.max.apply(null, idsList);
|
72 |
+
if (max === -Infinity) {
|
73 |
+
max = 1;
|
74 |
+
} else {
|
75 |
+
max += 1;
|
76 |
+
}
|
77 |
+
|
78 |
+
return max;
|
79 |
+
};
|
80 |
+
|
81 |
+
YcdTranslation.prototype.addTranslation = function () {
|
82 |
+
var button = jQuery('.ycd-add-translation');
|
83 |
+
|
84 |
+
if (!button.length) {
|
85 |
+
return ;
|
86 |
+
}
|
87 |
+
var that = this;
|
88 |
+
|
89 |
+
button.bind('click', function (e) {
|
90 |
+
e.preventDefault();
|
91 |
+
var template = jQuery('#template-wrapper').html();
|
92 |
+
var index = YcdTranslation.getMaxIndex();
|
93 |
+
template = template.replaceAll('{translationId}', index);
|
94 |
+
var langKey = jQuery('[name="ycd-tr[{translationId}][language]"] option:selected').text();
|
95 |
+
template = template.replaceAll('{isoCode}', langKey);
|
96 |
+
if (jQuery('.ycd-container-wrapper .ycd-translation-wrapper').length === 0) {
|
97 |
+
jQuery('.ycd-container-wrapper p').remove();
|
98 |
+
}
|
99 |
+
jQuery('.ycd-container-wrapper').append(template);
|
100 |
+
that.action();
|
101 |
+
})
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
jQuery(document).ready(function () {
|
106 |
+
new YcdTranslation();
|
107 |
+
})
|
assets/views/cricleMainView.php
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
<?php
|
2 |
use ycd\AdminHelper;
|
|
|
3 |
$proSpan = '';
|
4 |
$isPro = '';
|
5 |
if(YCD_PKG_VERSION == YCD_FREE_VERSION) {
|
@@ -57,6 +58,7 @@ if (YCD_PKG_VERSION > YCD_FREE_VERSION) {
|
|
57 |
die();
|
58 |
}
|
59 |
}
|
|
|
60 |
?>
|
61 |
<div class="ycd-bootstrap-wrapper">
|
62 |
<div class="row">
|
@@ -910,6 +912,14 @@ if (YCD_PKG_VERSION > YCD_FREE_VERSION) {
|
|
910 |
</div>
|
911 |
</div>
|
912 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
913 |
</div>
|
914 |
<?php
|
915 |
require_once YCD_VIEWS_PATH.'preview.php';
|
1 |
<?php
|
2 |
use ycd\AdminHelper;
|
3 |
+
use ycd\TranslationManager;
|
4 |
$proSpan = '';
|
5 |
$isPro = '';
|
6 |
if(YCD_PKG_VERSION == YCD_FREE_VERSION) {
|
58 |
die();
|
59 |
}
|
60 |
}
|
61 |
+
|
62 |
?>
|
63 |
<div class="ycd-bootstrap-wrapper">
|
64 |
<div class="row">
|
912 |
</div>
|
913 |
</div>
|
914 |
</div>
|
915 |
+
<div class="row">
|
916 |
+
<div class="col-md-12">
|
917 |
+
<h5><?php _e('Translations(Synchronized with the browser language)', YCD_TEXT_DOMAIN)?></h5>
|
918 |
+
<?php
|
919 |
+
require_once (dirname(__FILE__).'/translations/circleTranslation.php');
|
920 |
+
?>
|
921 |
+
</div>
|
922 |
+
</div>
|
923 |
</div>
|
924 |
<?php
|
925 |
require_once YCD_VIEWS_PATH.'preview.php';
|
assets/views/main/stickyMainView.php
CHANGED
@@ -365,6 +365,17 @@ $allowed_html = AdminHelper::getAllowedTags();
|
|
365 |
</div>
|
366 |
</div>
|
367 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
<div class="row form-group">
|
369 |
<div class="col-md-6">
|
370 |
<label class="ycd-label-of-input"><?php _e('Sections order', YCD_TEXT_DOMAIN); ?></label>
|
365 |
</div>
|
366 |
</div>
|
367 |
</div>
|
368 |
+
<div class="row form-group">
|
369 |
+
<div class="col-md-6">
|
370 |
+
<label class="ycd-label-of-input" for="ycd-sticky-enable-double-digits"><?php _e('Double digits', YCD_TEXT_DOMAIN); ?></label>
|
371 |
+
</div>
|
372 |
+
<div class="col-md-5">
|
373 |
+
<label class="ycd-switch">
|
374 |
+
<input type="checkbox" id="ycd-sticky-enable-double-digits" class="" name="ycd-sticky-enable-double-digits" <?php echo esc_attr($this->getOptionValue('ycd-sticky-enable-double-digits')); ?>>
|
375 |
+
<span class="ycd-slider ycd-round"></span>
|
376 |
+
</label>
|
377 |
+
</div>
|
378 |
+
</div>
|
379 |
<div class="row form-group">
|
380 |
<div class="col-md-6">
|
381 |
<label class="ycd-label-of-input"><?php _e('Sections order', YCD_TEXT_DOMAIN); ?></label>
|
assets/views/translations/circleTranslation.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
use ycd\TranslationManager;
|
3 |
+
use ycd\AdminHelper;
|
4 |
+
require_once (YCD_CLASSES_PATH.'/translation/TranslationManager.php');
|
5 |
+
$allowed_html = AdminHelper::getAllowedTags();
|
6 |
+
$translation = TranslationManager::init();
|
7 |
+
$translation->setTranslations($this->getOptionValue('ycd-tr'));
|
8 |
+
|
9 |
+
echo wp_kses($translation->translationTemplate(), $allowed_html);
|
10 |
+
echo wp_kses($translation->render(), $allowed_html);
|
11 |
+
|
classes/countdown/CircleCountdown.php
CHANGED
@@ -174,6 +174,33 @@ class CircleCountdown extends Countdown {
|
|
174 |
public function addToContent() {
|
175 |
add_filter('the_content', array($this, 'getTheContentFilter'),99999999, 1);
|
176 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
|
178 |
public function getViewContent() {
|
179 |
$this->includeStyles();
|
@@ -185,6 +212,8 @@ class CircleCountdown extends Countdown {
|
|
185 |
$allDataOptions = $this->getDataAllOptions();
|
186 |
$allDataOptions = json_encode($allDataOptions, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT);
|
187 |
$prepareOptions = $this->getCircleOptionsData();
|
|
|
|
|
188 |
$prepareOptions = json_encode($prepareOptions, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT);
|
189 |
$width = (int)$this->getOptionValue('ycd-countdown-width');
|
190 |
$widthMeasure = $this->getOptionValue('ycd-dimension-measure');
|
174 |
public function addToContent() {
|
175 |
add_filter('the_content', array($this, 'getTheContentFilter'),99999999, 1);
|
176 |
}
|
177 |
+
|
178 |
+
private function filterTranslations($prepareOptions) {
|
179 |
+
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
|
180 |
+
$translations = $this->getOptionValue('ycd-tr');
|
181 |
+
$currentTranslation = null;
|
182 |
+
if (empty($translations)) {
|
183 |
+
return $prepareOptions;
|
184 |
+
}
|
185 |
+
foreach ($translations as $translation) {
|
186 |
+
$isCode = substr($translation['language'], 0, 2);
|
187 |
+
if ($lang === $isCode) {
|
188 |
+
$currentTranslation = $translation;
|
189 |
+
}
|
190 |
+
}
|
191 |
+
if ($currentTranslation) {
|
192 |
+
|
193 |
+
unset($currentTranslation['language']);
|
194 |
+
foreach ($currentTranslation as $unite => $value) {
|
195 |
+
if (empty($value)) {
|
196 |
+
continue;
|
197 |
+
}
|
198 |
+
$prepareOptions['time'][$unite]['text'] = $value;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
return $prepareOptions;
|
203 |
+
}
|
204 |
|
205 |
public function getViewContent() {
|
206 |
$this->includeStyles();
|
212 |
$allDataOptions = $this->getDataAllOptions();
|
213 |
$allDataOptions = json_encode($allDataOptions, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT);
|
214 |
$prepareOptions = $this->getCircleOptionsData();
|
215 |
+
$prepareOptions = $this->filterTranslations($prepareOptions);
|
216 |
+
|
217 |
$prepareOptions = json_encode($prepareOptions, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT);
|
218 |
$width = (int)$this->getOptionValue('ycd-countdown-width');
|
219 |
$widthMeasure = $this->getOptionValue('ycd-dimension-measure');
|
classes/countdown/StickyCountdown.php
CHANGED
@@ -27,7 +27,8 @@ class StickyCountdown extends Countdown {
|
|
27 |
'days' => esc_attr( $this->getOptionValue('ycd-sticky-countdown-days')),
|
28 |
'hours' => esc_attr($this->getOptionValue('ycd-sticky-countdown-hours')),
|
29 |
'minutes' => esc_attr($this->getOptionValue('ycd-sticky-countdown-minutes')),
|
30 |
-
'seconds' => esc_attr($this->getOptionValue('ycd-sticky-countdown-seconds'))
|
|
|
31 |
);
|
32 |
ScriptsIncluder::registerScript('Sticky.js', array('dirUrl' => YCD_COUNTDOWN_JS_URL, 'dep' => array('jquery')));
|
33 |
ScriptsIncluder::localizeScript('Sticky.js', 'YCD_STICKY_ARGS', $data);
|
27 |
'days' => esc_attr( $this->getOptionValue('ycd-sticky-countdown-days')),
|
28 |
'hours' => esc_attr($this->getOptionValue('ycd-sticky-countdown-hours')),
|
29 |
'minutes' => esc_attr($this->getOptionValue('ycd-sticky-countdown-minutes')),
|
30 |
+
'seconds' => esc_attr($this->getOptionValue('ycd-sticky-countdown-seconds')),
|
31 |
+
'double' => esc_attr($this->getOptionValue('ycd-sticky-enable-double-digits'))
|
32 |
);
|
33 |
ScriptsIncluder::registerScript('Sticky.js', array('dirUrl' => YCD_COUNTDOWN_JS_URL, 'dep' => array('jquery')));
|
34 |
ScriptsIncluder::localizeScript('Sticky.js', 'YCD_STICKY_ARGS', $data);
|
classes/countdown/TimerCountdown.php
CHANGED
@@ -183,7 +183,7 @@ class TimerCountdown extends Countdown {
|
|
183 |
<div class="timer-time-set ycd-timer-box ycd-timer-box-next" id="nextTime" style="opacity: 0;">
|
184 |
<span id="ycdDaysNext" class="ycd-days-next-value-<?php echo esc_attr($id); ?> ycd-timer-number">00</span><!--
|
185 |
--><span class="ycd-dots">:</span><!--
|
186 |
-
--><span id="ycdHoursNext"class="ycd-hours-next-value-<?php echo esc_attr($id); ?>">00</span><!--
|
187 |
--><span>:</span><!--
|
188 |
--><span id="ycdMinutesNext" class="ycd-minutes-next-value-<?php echo esc_attr($id); ?>">00</span><!--
|
189 |
--><span>:</span><!--
|
183 |
<div class="timer-time-set ycd-timer-box ycd-timer-box-next" id="nextTime" style="opacity: 0;">
|
184 |
<span id="ycdDaysNext" class="ycd-days-next-value-<?php echo esc_attr($id); ?> ycd-timer-number">00</span><!--
|
185 |
--><span class="ycd-dots">:</span><!--
|
186 |
+
--><span id="ycdHoursNext" class="ycd-hours-next-value-<?php echo esc_attr($id); ?>">00</span><!--
|
187 |
--><span>:</span><!--
|
188 |
--><span id="ycdMinutesNext" class="ycd-minutes-next-value-<?php echo esc_attr($id); ?>">00</span><!--
|
189 |
--><span>:</span><!--
|
classes/translation/AbstractTranslationManager.php
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace ycd;
|
3 |
+
|
4 |
+
abstract class AbstractTranslationManager {
|
5 |
+
abstract function render();
|
6 |
+
private $prefix = '';
|
7 |
+
protected $translations = [];
|
8 |
+
|
9 |
+
public function __construct($optionsPrefix) {
|
10 |
+
$this->prefix = $optionsPrefix;
|
11 |
+
|
12 |
+
}
|
13 |
+
|
14 |
+
public function setTranslations($translations) {
|
15 |
+
if (!empty($translations['{translationId}'])) {
|
16 |
+
unset($translations['{translationId}']);
|
17 |
+
}
|
18 |
+
if (!empty($translations)) {
|
19 |
+
$this->translations = $translations;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
public static function init($optionsPrefix = 'ycd-tr') {
|
24 |
+
return new static($optionsPrefix );
|
25 |
+
}
|
26 |
+
|
27 |
+
public function translationRow($translation) {
|
28 |
+
$labelName = array(
|
29 |
+
'Years' => 'Years',
|
30 |
+
'Months' => 'Months',
|
31 |
+
'Days' => 'Days',
|
32 |
+
'Hours' => 'Hours',
|
33 |
+
'Minutes' => 'Minutes',
|
34 |
+
'Seconds' => 'Seconds'
|
35 |
+
);
|
36 |
+
$language = AdminHelper::getLanguageIsoCodeList();
|
37 |
+
$id = '{translationId}';
|
38 |
+
if (!empty($translation['id'])) {
|
39 |
+
$id = $translation['id'];
|
40 |
+
}
|
41 |
+
$isoCode = '{isoCode}';
|
42 |
+
if (!empty($translation['language'])) {
|
43 |
+
$isoCode = $language[$translation['language']];
|
44 |
+
}
|
45 |
+
ob_start();
|
46 |
+
?>
|
47 |
+
<div class="ycd-translation-wrapper ycd-translation-wrapper-<?php echo esc_attr($id); ?>" data-id="<?php echo esc_attr($id); ?>">
|
48 |
+
<div class="ycd-translation-header">Language <span class="tab-language-tab"><?php echo esc_attr($isoCode); ?></span><span class="delete-item" data-id="<?php echo esc_attr($id); ?>">X</span></div>
|
49 |
+
<div class="ycd-translation-body ycd-hide">
|
50 |
+
<div class="row">
|
51 |
+
<div class="col-md-12">
|
52 |
+
<div>
|
53 |
+
<label><?php _e('Language', YCF_TEXT_DOMAIN)?></label>
|
54 |
+
</div>
|
55 |
+
<div>
|
56 |
+
<?php echo AdminHelper::selectBox($language, esc_attr($translation['language']), array('name' => "$this->prefix[$id][language]", 'class' => 'ycd-select2 ycd-tr-language', 'data-id' => $id))?>
|
57 |
+
</div>
|
58 |
+
</div>
|
59 |
+
</div>
|
60 |
+
<div class="row">
|
61 |
+
<?php foreach ($labelName as $label => $name): ?>
|
62 |
+
<div class="col-md-2">
|
63 |
+
<label for="<?php echo "$this->prefix[$id][$name]"; ?>"><?php _e($label, YCF_TEXT_DOMAIN)?></label>
|
64 |
+
<input name="<?php echo "$this->prefix[$id][$name]"?>" id="<?php echo "$this->prefix[$id][$name]"; ?>" class="form-control" value="<?php echo esc_attr($translation[$name]); ?>">
|
65 |
+
</div>
|
66 |
+
<?php endforeach; ?>
|
67 |
+
</div>
|
68 |
+
</div>
|
69 |
+
</div>
|
70 |
+
<?php
|
71 |
+
$content = ob_get_contents();
|
72 |
+
ob_end_clean();
|
73 |
+
|
74 |
+
return $content;
|
75 |
+
}
|
76 |
+
|
77 |
+
public function translationTemplate($translation = array()) {
|
78 |
+
|
79 |
+
ob_start();
|
80 |
+
?>
|
81 |
+
<div id="template-wrapper">
|
82 |
+
<?php echo $this->translationRow($translation); ?>
|
83 |
+
</div>
|
84 |
+
<?php
|
85 |
+
$content = ob_get_contents();
|
86 |
+
ob_end_clean();
|
87 |
+
|
88 |
+
return $content;
|
89 |
+
}
|
90 |
+
|
91 |
+
protected function addTranslationButton() {
|
92 |
+
ob_start();
|
93 |
+
?>
|
94 |
+
<div class="row">
|
95 |
+
<div class="col-md-12">
|
96 |
+
<button class="btn btn-primary ycd-add-translation">Add Translation</button>
|
97 |
+
</div>
|
98 |
+
</div>
|
99 |
+
<?php
|
100 |
+
$content = ob_get_contents();
|
101 |
+
ob_end_clean();
|
102 |
+
|
103 |
+
return $content;
|
104 |
+
}
|
105 |
+
}
|
classes/translation/TranslationManager.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace ycd;
|
3 |
+
require_once (dirname(__FILE__).'/AbstractTranslationManager.php');
|
4 |
+
|
5 |
+
class TranslationManager extends AbstractTranslationManager {
|
6 |
+
public function renderTranslations() {
|
7 |
+
|
8 |
+
if (!$this->translations) {
|
9 |
+
return '<p>'.esc_attr(__('There is not translations', YCF_TEXT_DOMAIN)).'</p>';
|
10 |
+
}
|
11 |
+
$data = '';
|
12 |
+
foreach ($this->translations as $key => $translation) {
|
13 |
+
$translation['id'] = $key;
|
14 |
+
$data .= $this->translationRow($translation);
|
15 |
+
}
|
16 |
+
|
17 |
+
return $data;
|
18 |
+
}
|
19 |
+
public function render() {
|
20 |
+
ob_start();
|
21 |
+
?>
|
22 |
+
<div class="row">
|
23 |
+
<div class="col-md-12 ycd-container-wrapper">
|
24 |
+
<?php echo $this->renderTranslations(); ?>
|
25 |
+
</div>
|
26 |
+
<div class="col-md-12">
|
27 |
+
<?php echo $this->addTranslationButton(); ?>
|
28 |
+
</div>
|
29 |
+
</div>
|
30 |
+
<?php
|
31 |
+
$content = ob_get_contents();
|
32 |
+
ob_end_clean();
|
33 |
+
|
34 |
+
return $content;
|
35 |
+
}
|
36 |
+
}
|
config/config.php
CHANGED
@@ -75,8 +75,8 @@ class YcdCountdownConfig
|
|
75 |
self::addDefine('YCD_CRON_REPEAT_INTERVAL', 1);
|
76 |
self::addDefine('YCD_AJAX_SUCCESS', 1);
|
77 |
self::addDefine('YCD_TABLE_LIMIT', 15);
|
78 |
-
self::addDefine('YCD_VERSION_PRO', 2.
|
79 |
-
self::addDefine('YCD_VERSION', 2.
|
80 |
self::addDefine('YCD_FREE_VERSION', 1);
|
81 |
self::addDefine('YCD_SILVER_VERSION', 2);
|
82 |
self::addDefine('YCD_GOLD_VERSION', 3);
|
@@ -84,13 +84,13 @@ class YcdCountdownConfig
|
|
84 |
self::addDefine('YCD_EXTENSION_VERSION', 99);
|
85 |
require_once(dirname(__FILE__).'/config-pkg.php');
|
86 |
|
87 |
-
$versionText = '2.4.
|
88 |
if (YCD_PKG_VERSION != YCD_FREE_VERSION) {
|
89 |
-
$versionText = '2.2.
|
90 |
}
|
91 |
self::addDefine('YCD_VERSION_TEXT', $versionText);
|
92 |
-
self::addDefine('YCD_LAST_UPDATE', '
|
93 |
-
self::addDefine('YCD_NEXT_UPDATE', '
|
94 |
}
|
95 |
|
96 |
public static function displaySettings()
|
75 |
self::addDefine('YCD_CRON_REPEAT_INTERVAL', 1);
|
76 |
self::addDefine('YCD_AJAX_SUCCESS', 1);
|
77 |
self::addDefine('YCD_TABLE_LIMIT', 15);
|
78 |
+
self::addDefine('YCD_VERSION_PRO', 2.24);
|
79 |
+
self::addDefine('YCD_VERSION', 2.43);
|
80 |
self::addDefine('YCD_FREE_VERSION', 1);
|
81 |
self::addDefine('YCD_SILVER_VERSION', 2);
|
82 |
self::addDefine('YCD_GOLD_VERSION', 3);
|
84 |
self::addDefine('YCD_EXTENSION_VERSION', 99);
|
85 |
require_once(dirname(__FILE__).'/config-pkg.php');
|
86 |
|
87 |
+
$versionText = '2.4.3';
|
88 |
if (YCD_PKG_VERSION != YCD_FREE_VERSION) {
|
89 |
+
$versionText = '2.2.4';
|
90 |
}
|
91 |
self::addDefine('YCD_VERSION_TEXT', $versionText);
|
92 |
+
self::addDefine('YCD_LAST_UPDATE', 'Sep 29');
|
93 |
+
self::addDefine('YCD_NEXT_UPDATE', 'Hoc 12');
|
94 |
}
|
95 |
|
96 |
public static function displaySettings()
|
config/optionsConfig.php
CHANGED
@@ -330,6 +330,7 @@ class YcdCountdownOptionsConfig
|
|
330 |
$options[] = array('name' => 'ycd-sticky-button-redirect-new-tab', 'type' => 'checkbox', 'defaultValue' => '');
|
331 |
$options[] = array('name' => 'ycd-sticky-countdown-mode', 'type' => 'text', 'defaultValue' => 'stickyCountdownDefault');
|
332 |
$options[] = array('name' => 'ycd-sticky-countdown-sections', 'type' => 'text', 'defaultValue' => 'Text-Countdown-Button');
|
|
|
333 |
$options[] = array('name' => 'ycd-sticky-enable-close', 'type' => 'checkbox', 'defaultValue' => '');
|
334 |
$options[] = array('name' => 'ycd-sticky-close-text', 'type' => 'text', 'defaultValue' => __('Close', YCD_TEXT_DOMAIN));
|
335 |
$options[] = array('name' => 'ycd-sticky-expire-behavior', 'type' => 'text', 'defaultValue' => 'redirectToURL');
|
@@ -364,6 +365,7 @@ class YcdCountdownOptionsConfig
|
|
364 |
$options[] = array('name' => 'ycd-simple-text-margin-right', 'type' => 'text', 'defaultValue' => __('0px', YCD_TEXT_DOMAIN));
|
365 |
$options[] = array('name' => 'ycd-simple-text-margin-bottom', 'type' => 'text', 'defaultValue' => __('0px', YCD_TEXT_DOMAIN));
|
366 |
$options[] = array('name' => 'ycd-simple-text-margin-left', 'type' => 'text', 'defaultValue' => __('0px', YCD_TEXT_DOMAIN));
|
|
|
367 |
|
368 |
$YCD_OPTIONS = apply_filters('ycdCountdownDefaultOptions', $options);
|
369 |
}
|
330 |
$options[] = array('name' => 'ycd-sticky-button-redirect-new-tab', 'type' => 'checkbox', 'defaultValue' => '');
|
331 |
$options[] = array('name' => 'ycd-sticky-countdown-mode', 'type' => 'text', 'defaultValue' => 'stickyCountdownDefault');
|
332 |
$options[] = array('name' => 'ycd-sticky-countdown-sections', 'type' => 'text', 'defaultValue' => 'Text-Countdown-Button');
|
333 |
+
$options[] = array('name' => 'ycd-sticky-enable-double-digits', 'type' => 'checkbox', 'defaultValue' => '');
|
334 |
$options[] = array('name' => 'ycd-sticky-enable-close', 'type' => 'checkbox', 'defaultValue' => '');
|
335 |
$options[] = array('name' => 'ycd-sticky-close-text', 'type' => 'text', 'defaultValue' => __('Close', YCD_TEXT_DOMAIN));
|
336 |
$options[] = array('name' => 'ycd-sticky-expire-behavior', 'type' => 'text', 'defaultValue' => 'redirectToURL');
|
365 |
$options[] = array('name' => 'ycd-simple-text-margin-right', 'type' => 'text', 'defaultValue' => __('0px', YCD_TEXT_DOMAIN));
|
366 |
$options[] = array('name' => 'ycd-simple-text-margin-bottom', 'type' => 'text', 'defaultValue' => __('0px', YCD_TEXT_DOMAIN));
|
367 |
$options[] = array('name' => 'ycd-simple-text-margin-left', 'type' => 'text', 'defaultValue' => __('0px', YCD_TEXT_DOMAIN));
|
368 |
+
$options[] = array('name' => 'ycd-tr', 'type' => 'array', 'defaultValue' => '');
|
369 |
|
370 |
$YCD_OPTIONS = apply_filters('ycdCountdownDefaultOptions', $options);
|
371 |
}
|
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: 2.4.
|
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: 2.4.3
|
6 |
* Author: Adam Skaat
|
7 |
* Author URI: https://edmonsoft.com/countdown
|
8 |
* License: GPLv2
|
helpers/AdminHelper.php
CHANGED
@@ -1495,6 +1495,7 @@ class AdminHelper {
|
|
1495 |
'p' => $generalArray,
|
1496 |
'ul' => $generalArray,
|
1497 |
'li' => $generalArray,
|
|
|
1498 |
'input' => array(
|
1499 |
'type' => array(),
|
1500 |
'id' => array(),
|
@@ -1509,7 +1510,8 @@ class AdminHelper {
|
|
1509 |
'label' => array(
|
1510 |
'id' => array(),
|
1511 |
'class' => array(),
|
1512 |
-
'style' => array()
|
|
|
1513 |
),
|
1514 |
'select' => array(
|
1515 |
'option' => array('value', 'selected'),
|
@@ -1518,7 +1520,8 @@ class AdminHelper {
|
|
1518 |
'js-circle-time-zone' => array(),
|
1519 |
'style' => array(),
|
1520 |
'multiple' => array(),
|
1521 |
-
'data-select-type' => array()
|
|
|
1522 |
),
|
1523 |
'option' => array(
|
1524 |
'value' => array(),
|
@@ -1540,4 +1543,23 @@ class AdminHelper {
|
|
1540 |
|
1541 |
return $allowed_html;
|
1542 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1543 |
}
|
1495 |
'p' => $generalArray,
|
1496 |
'ul' => $generalArray,
|
1497 |
'li' => $generalArray,
|
1498 |
+
'button' => $generalArray,
|
1499 |
'input' => array(
|
1500 |
'type' => array(),
|
1501 |
'id' => array(),
|
1510 |
'label' => array(
|
1511 |
'id' => array(),
|
1512 |
'class' => array(),
|
1513 |
+
'style' => array(),
|
1514 |
+
'for' => array()
|
1515 |
),
|
1516 |
'select' => array(
|
1517 |
'option' => array('value', 'selected'),
|
1520 |
'js-circle-time-zone' => array(),
|
1521 |
'style' => array(),
|
1522 |
'multiple' => array(),
|
1523 |
+
'data-select-type' => array(),
|
1524 |
+
'data-id' => array()
|
1525 |
),
|
1526 |
'option' => array(
|
1527 |
'value' => array(),
|
1543 |
|
1544 |
return $allowed_html;
|
1545 |
}
|
1546 |
+
|
1547 |
+
public static function getLanguageIsoCodeList() {
|
1548 |
+
$translations = [];
|
1549 |
+
require_once ABSPATH . 'wp-admin/includes/translation-install.php';
|
1550 |
+
if (function_exists('wp_get_available_translations')) {
|
1551 |
+
$translations = wp_get_available_translations();
|
1552 |
+
}
|
1553 |
+
|
1554 |
+
$list = array();
|
1555 |
+
if (!$translations) {
|
1556 |
+
return $list;
|
1557 |
+
}
|
1558 |
+
|
1559 |
+
foreach ($translations as $translation) {
|
1560 |
+
$list[$translation['language']] = $translation['english_name'];
|
1561 |
+
}
|
1562 |
+
|
1563 |
+
return $list;
|
1564 |
+
}
|
1565 |
}
|
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: 6.0.1
|
6 |
-
Stable tag: 2.4.
|
7 |
Requires PHP: 5.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -67,6 +67,12 @@ Yes you can, we have Circle and Flipclock countdown popups.
|
|
67 |
You need to select the .zip file, there is no need to extract the zip file, just upload it.
|
68 |
|
69 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
= 2.4.1 =
|
71 |
* Added Years possibility to simple countdown
|
72 |
|
3 |
Tags: countdown, timer, countdown timer
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 6.0.1
|
6 |
+
Stable tag: 2.4.3
|
7 |
Requires PHP: 5.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
67 |
You need to select the .zip file, there is no need to extract the zip file, just upload it.
|
68 |
|
69 |
== Changelog ==
|
70 |
+
= 2.4.3 =
|
71 |
+
* Added possibility to translate the circle countdown texts related to browser language.
|
72 |
+
|
73 |
+
= 2.4.2 =
|
74 |
+
* Sticky Countdown Double Digits option
|
75 |
+
|
76 |
= 2.4.1 =
|
77 |
* Added Years possibility to simple countdown
|
78 |
|