Version Description
- Added possibility via Sticky countdown button copy text
Download this release
Release Info
Developer | adamskaat |
Plugin | Countdown, Coming Soon – Countdown & Clock |
Version | 2.1.3 |
Comparing to | |
See all releases |
Code changes from version 2.1.2 to 2.1.3
- assets/js/Sticky.js +36 -0
- assets/views/main/stickyMainView.php +35 -15
- classes/countdown/StickyCountdown.php +9 -7
- config/config.php +2 -2
- config/optionsConfig.php +2 -0
- countdown-builder.php +1 -1
- helpers/AdminHelper.php +42 -0
- readme.txt +4 -1
assets/js/Sticky.js
CHANGED
@@ -119,6 +119,41 @@ YcdSticky.prototype.initClose = function () {
|
|
119 |
});
|
120 |
};
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
YcdSticky.prototype.header = function() {
|
123 |
var header = jQuery('.ycd-sticky-header');
|
124 |
|
@@ -126,6 +161,7 @@ YcdSticky.prototype.header = function() {
|
|
126 |
return false;
|
127 |
}
|
128 |
|
|
|
129 |
this.initClose();
|
130 |
|
131 |
var sticky = header.offset().top;
|
119 |
});
|
120 |
};
|
121 |
|
122 |
+
YcdSticky.prototype.buttonBehavior = function()
|
123 |
+
{
|
124 |
+
var header = jQuery('.ycd-sticky-header');
|
125 |
+
var settings = jQuery(header).data('settings');
|
126 |
+
jQuery('.ycd-sticky-button').bind('click', function (e) {
|
127 |
+
e.preventDefault();
|
128 |
+
var behavior = settings['ycd-sticky-expire-behavior'];
|
129 |
+
if (behavior == 'redirectToURL') {
|
130 |
+
var url = settings['ycd-sticky-url'];
|
131 |
+
if (settings['ycd-sticky-url-new-tab']) {
|
132 |
+
window.open(url);
|
133 |
+
}
|
134 |
+
else {
|
135 |
+
window.location = url;
|
136 |
+
}
|
137 |
+
}
|
138 |
+
if (behavior == 'copy') {
|
139 |
+
var textAreaId = 'ycd-copy-text-area-' + 1;
|
140 |
+
var value = settings['ycd-sticky-button-copy'];
|
141 |
+
var textArea = jQuery('<input>', {
|
142 |
+
id: textAreaId,
|
143 |
+
value: value,
|
144 |
+
style: 'position: absolute; right: -10000px'
|
145 |
+
});
|
146 |
+
|
147 |
+
if (!jQuery('#' + textAreaId).length) {
|
148 |
+
jQuery('body').append(textArea);
|
149 |
+
}
|
150 |
+
jQuery('#' + textAreaId).select();
|
151 |
+
document.execCommand('copy');
|
152 |
+
jQuery('#' + textAreaId).remove();
|
153 |
+
}
|
154 |
+
});
|
155 |
+
};
|
156 |
+
|
157 |
YcdSticky.prototype.header = function() {
|
158 |
var header = jQuery('.ycd-sticky-header');
|
159 |
|
161 |
return false;
|
162 |
}
|
163 |
|
164 |
+
this.buttonBehavior();
|
165 |
this.initClose();
|
166 |
|
167 |
var sticky = header.offset().top;
|
assets/views/main/stickyMainView.php
CHANGED
@@ -14,6 +14,7 @@ $createCountdown = AdminHelper::getCreateCountdownUrl();
|
|
14 |
$args = array('allowTypes' => array('circle'), 'except' => array('sticky'));
|
15 |
$countdownsIdAndTitle = \ycd\Countdown::getCountdownsIdAndTitle($args);
|
16 |
$stickySectionsOrder = $defaultData['stickySectionsOrder'];
|
|
|
17 |
?>
|
18 |
<div class="ycd-bootstrap-wrapper">
|
19 |
<!-- Button settings start -->
|
@@ -53,26 +54,45 @@ $stickySectionsOrder = $defaultData['stickySectionsOrder'];
|
|
53 |
</div>
|
54 |
</div>
|
55 |
</div>
|
56 |
-
<div class="
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
</div>
|
60 |
-
<div class="
|
61 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
</div>
|
63 |
</div>
|
64 |
-
<div class="
|
65 |
-
<div class="
|
66 |
-
<
|
67 |
-
|
68 |
-
|
69 |
-
<
|
70 |
-
<input type="
|
71 |
-
|
72 |
-
</label>
|
73 |
</div>
|
74 |
</div>
|
75 |
-
|
|
|
76 |
<div class="col-md-6">
|
77 |
<label for="ycd-sticky-button-padding-enable" class="ycd-label-of-switch"><?php _e('Enable padding', YCD_TEXT_DOMAIN); ?></label>
|
78 |
</div>
|
14 |
$args = array('allowTypes' => array('circle'), 'except' => array('sticky'));
|
15 |
$countdownsIdAndTitle = \ycd\Countdown::getCountdownsIdAndTitle($args);
|
16 |
$stickySectionsOrder = $defaultData['stickySectionsOrder'];
|
17 |
+
$stickyExpiration = $defaultData['stickyButtonExpiration'];
|
18 |
?>
|
19 |
<div class="ycd-bootstrap-wrapper">
|
20 |
<!-- Button settings start -->
|
54 |
</div>
|
55 |
</div>
|
56 |
</div>
|
57 |
+
<div class="ycd-multichoice-wrapper">
|
58 |
+
<?php
|
59 |
+
$multipleChoiceButton = new MultipleChoiceButton($stickyExpiration, esc_attr($this->getOptionValue('ycd-sticky-expire-behavior')));
|
60 |
+
echo $multipleChoiceButton;
|
61 |
+
?>
|
62 |
+
</div>
|
63 |
+
<div id="ycd-sticky-expire-redirect-url" class="ycd-countdown-show-text ycd-sub-option ycd-hide">
|
64 |
+
<div class="row form-group">
|
65 |
+
<div class="col-md-6">
|
66 |
+
<label class="ycd-label-of-input" for="ycd-sticky-url"><?php _e('URL', YCD_TEXT_DOMAIN); ?></label>
|
67 |
+
</div>
|
68 |
+
<div class="col-md-5">
|
69 |
+
<input type="url" placeholder="https://www.example.com" name="ycd-sticky-url" id="ycd-sticky-url" class="form-control" value="<?php echo esc_attr($this->getOptionValue('ycd-sticky-url')); ?>">
|
70 |
+
</div>
|
71 |
</div>
|
72 |
+
<div class="row form-group">
|
73 |
+
<div class="col-md-6">
|
74 |
+
<label for="ycd-sticky-button-redirect-new-tab" class="ycd-label-of-switch"><?php _e('Redirect to new tab', YCD_TEXT_DOMAIN); ?></label>
|
75 |
+
</div>
|
76 |
+
<div class="col-md-6">
|
77 |
+
<label class="ycd-switch">
|
78 |
+
<input type="checkbox" id="ycd-sticky-button-redirect-new-tab" class="" name="ycd-sticky-button-redirect-new-tab" <?php echo $this->getOptionValue('ycd-sticky-button-redirect-new-tab'); ?>>
|
79 |
+
<span class="ycd-slider ycd-round"></span>
|
80 |
+
</label>
|
81 |
+
</div>
|
82 |
</div>
|
83 |
</div>
|
84 |
+
<div id="ycd-sticky-expire-copy" class="ycd-countdown-show-text ycd-sub-option ycd-hide">
|
85 |
+
<div class="row form-group">
|
86 |
+
<div class="col-md-6">
|
87 |
+
<label for="ycd-sticky-button-copy" class="ycd-label-of-switch"><?php _e('Text', YCD_TEXT_DOMAIN); ?></label>
|
88 |
+
</div>
|
89 |
+
<div class="col-md-6">
|
90 |
+
<input type="text" name="ycd-sticky-button-copy" class="form-control" placeholder="<?php echo _e('Copy to clipboard'); ?>" value="<?php echo esc_attr($this->getOptionValue('ycd-sticky-button-copy')); ?>">
|
91 |
+
</div>
|
|
|
92 |
</div>
|
93 |
</div>
|
94 |
+
|
95 |
+
<div class="row form-group">
|
96 |
<div class="col-md-6">
|
97 |
<label for="ycd-sticky-button-padding-enable" class="ycd-label-of-switch"><?php _e('Enable padding', YCD_TEXT_DOMAIN); ?></label>
|
98 |
</div>
|
classes/countdown/StickyCountdown.php
CHANGED
@@ -199,23 +199,25 @@ class StickyCountdown extends Countdown {
|
|
199 |
$settings['timeZone'] = $timeZone;
|
200 |
$settings['ycd-countdown-end-sound'] = $this->getOptionValue('ycd-countdown-end-sound');
|
201 |
$settings['ycd-countdown-end-sound-url'] = $this->getOptionValue('ycd-countdown-end-sound-url');
|
202 |
-
$settings['ycd-sticky-button-redirect-new-tab'] = $this->getOptionValue('ycd-sticky-button-redirect-new-tab');
|
203 |
$settings['ycd-countdown-expire-behavior'] = $this->getOptionValue('ycd-countdown-expire-behavior');
|
204 |
$settings['ycd-expire-text'] = $this->getOptionValue('ycd-expire-text');
|
205 |
$settings['ycd-expire-url'] = $this->getOptionValue('ycd-expire-url');
|
206 |
$settings['id'] = $id;
|
207 |
$settings['ycd-countdown-date-type'] = $this->getOptionValue('ycd-countdown-date-type');
|
|
|
|
|
|
|
|
|
|
|
208 |
$settings += $this->generalOptionsData();
|
209 |
|
210 |
$settings = json_encode($settings);
|
211 |
|
212 |
$stickyUrl = $this->getOptionValue('ycd-sticky-url');
|
|
|
213 |
$actionUrl = "window.location.href = '$stickyUrl'";
|
214 |
-
|
215 |
-
|
216 |
-
$actionUrl = "window.open('$stickyUrl')";
|
217 |
-
}
|
218 |
-
|
219 |
$textContent = $this->getOptionValue('ycd-sticky-text');
|
220 |
$buttonText = $this->getOptionValue('ycd-sticky-button-text');
|
221 |
$sectionsOrder = $this->getOptionValue('ycd-sticky-countdown-sections');
|
@@ -247,7 +249,7 @@ class StickyCountdown extends Countdown {
|
|
247 |
ob_start();
|
248 |
?>
|
249 |
<div class="ycd-sticky-header-child ycd-sticky-header-button">
|
250 |
-
<input type="button"
|
251 |
</div>
|
252 |
<?php
|
253 |
$sectionsHtml['Button'] = ob_get_contents();
|
199 |
$settings['timeZone'] = $timeZone;
|
200 |
$settings['ycd-countdown-end-sound'] = $this->getOptionValue('ycd-countdown-end-sound');
|
201 |
$settings['ycd-countdown-end-sound-url'] = $this->getOptionValue('ycd-countdown-end-sound-url');
|
|
|
202 |
$settings['ycd-countdown-expire-behavior'] = $this->getOptionValue('ycd-countdown-expire-behavior');
|
203 |
$settings['ycd-expire-text'] = $this->getOptionValue('ycd-expire-text');
|
204 |
$settings['ycd-expire-url'] = $this->getOptionValue('ycd-expire-url');
|
205 |
$settings['id'] = $id;
|
206 |
$settings['ycd-countdown-date-type'] = $this->getOptionValue('ycd-countdown-date-type');
|
207 |
+
// end behavior
|
208 |
+
$settings['ycd-sticky-expire-behavior'] = $this->getOptionValue('ycd-sticky-expire-behavior');
|
209 |
+
$settings['ycd-sticky-url'] = $this->getOptionValue('ycd-sticky-url');
|
210 |
+
$settings['ycd-sticky-url-new-tab'] = $this->getOptionValue('ycd-sticky-button-redirect-new-tab');
|
211 |
+
$settings['ycd-sticky-button-copy'] = $this->getOptionValue('ycd-sticky-button-copy');
|
212 |
$settings += $this->generalOptionsData();
|
213 |
|
214 |
$settings = json_encode($settings);
|
215 |
|
216 |
$stickyUrl = $this->getOptionValue('ycd-sticky-url');
|
217 |
+
|
218 |
$actionUrl = "window.location.href = '$stickyUrl'";
|
219 |
+
|
220 |
+
|
|
|
|
|
|
|
221 |
$textContent = $this->getOptionValue('ycd-sticky-text');
|
222 |
$buttonText = $this->getOptionValue('ycd-sticky-button-text');
|
223 |
$sectionsOrder = $this->getOptionValue('ycd-sticky-countdown-sections');
|
249 |
ob_start();
|
250 |
?>
|
251 |
<div class="ycd-sticky-header-child ycd-sticky-header-button">
|
252 |
+
<input type="button" data-id = "<?php echo esc_attr($id); ?>" class="ycd-sticky-button" value="<?php echo esc_attr($buttonText); ?>">
|
253 |
</div>
|
254 |
<?php
|
255 |
$sectionsHtml['Button'] = ob_get_contents();
|
config/config.php
CHANGED
@@ -89,8 +89,8 @@ class YcdCountdownConfig
|
|
89 |
$versionText = '1.9.8';
|
90 |
}
|
91 |
self::addDefine('YCD_VERSION_TEXT', $versionText);
|
92 |
-
self::addDefine('YCD_LAST_UPDATE', '
|
93 |
-
self::addDefine('YCD_NEXT_UPDATE', 'July
|
94 |
}
|
95 |
|
96 |
public static function displaySettings()
|
89 |
$versionText = '1.9.8';
|
90 |
}
|
91 |
self::addDefine('YCD_VERSION_TEXT', $versionText);
|
92 |
+
self::addDefine('YCD_LAST_UPDATE', 'July 3');
|
93 |
+
self::addDefine('YCD_NEXT_UPDATE', 'July 26');
|
94 |
}
|
95 |
|
96 |
public static function displaySettings()
|
config/optionsConfig.php
CHANGED
@@ -326,6 +326,8 @@ class YcdCountdownOptionsConfig
|
|
326 |
$options[] = array('name' => 'ycd-sticky-countdown-sections', 'type' => 'text', 'defaultValue' => 'Text-Countdown-Button');
|
327 |
$options[] = array('name' => 'ycd-sticky-enable-close', 'type' => 'checkbox', 'defaultValue' => '');
|
328 |
$options[] = array('name' => 'ycd-sticky-close-text', 'type' => 'text', 'defaultValue' => __('Close', YCD_TEXT_DOMAIN));
|
|
|
|
|
329 |
|
330 |
// Simple countdown
|
331 |
$options[] = array('name' => 'ycd-simple-enable-months', 'type' => 'checkbox', 'defaultValue' => '');
|
326 |
$options[] = array('name' => 'ycd-sticky-countdown-sections', 'type' => 'text', 'defaultValue' => 'Text-Countdown-Button');
|
327 |
$options[] = array('name' => 'ycd-sticky-enable-close', 'type' => 'checkbox', 'defaultValue' => '');
|
328 |
$options[] = array('name' => 'ycd-sticky-close-text', 'type' => 'text', 'defaultValue' => __('Close', YCD_TEXT_DOMAIN));
|
329 |
+
$options[] = array('name' => 'ycd-sticky-expire-behavior', 'type' => 'text', 'defaultValue' => 'redirectToURL');
|
330 |
+
$options[] = array('name' => 'ycd-sticky-button-copy', 'type' => 'text', 'defaultValue' => '');
|
331 |
|
332 |
// Simple countdown
|
333 |
$options[] = array('name' => 'ycd-simple-enable-months', 'type' => 'checkbox', 'defaultValue' => '');
|
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.1.
|
6 |
* Author: Adam Skaat
|
7 |
* Author URI: https://edmonsoft.com/countdown
|
8 |
* License: GPLv2
|
2 |
/**
|
3 |
* Plugin Name: Countdown builder
|
4 |
* Description: The best countdown plugin by Adam skaat
|
5 |
+
* Version: 2.1.3
|
6 |
* Author: Adam Skaat
|
7 |
* Author URI: https://edmonsoft.com/countdown
|
8 |
* License: GPLv2
|
helpers/AdminHelper.php
CHANGED
@@ -616,6 +616,48 @@ class AdminHelper {
|
|
616 |
)
|
617 |
);
|
618 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
619 |
$data['countdownFlipExpireTime'] = array(
|
620 |
'template' => array(
|
621 |
'fieldWrapperAttr' => array(
|
616 |
)
|
617 |
);
|
618 |
|
619 |
+
$data['stickyButtonExpiration'] = array(
|
620 |
+
'template' => array(
|
621 |
+
'fieldWrapperAttr' => array(
|
622 |
+
'class' => 'col-md-6 ycd-choice-option-wrapper'
|
623 |
+
),
|
624 |
+
'labelAttr' => array(
|
625 |
+
'class' => 'col-md-6 ycd-choice-option-wrapper'
|
626 |
+
),
|
627 |
+
'groupWrapperAttr' => array(
|
628 |
+
'class' => 'row form-group ycd-choice-wrapper'
|
629 |
+
)
|
630 |
+
),
|
631 |
+
'buttonPosition' => 'right',
|
632 |
+
'nextNewLine' => true,
|
633 |
+
'fields' => array(
|
634 |
+
array(
|
635 |
+
'attr' => array(
|
636 |
+
'type' => 'radio',
|
637 |
+
'name' => 'ycd-sticky-expire-behavior',
|
638 |
+
'class' => 'ycd-sticky-expire-redirect-url ycd-form-radio',
|
639 |
+
'data-attr-href' => 'ycd-sticky-expire-redirect-url',
|
640 |
+
'value' => 'redirectToURL'
|
641 |
+
),
|
642 |
+
'label' => array(
|
643 |
+
'name' => __('Redirect To URL', YCD_TEXT_DOMAIN)
|
644 |
+
)
|
645 |
+
),
|
646 |
+
array(
|
647 |
+
'attr' => array(
|
648 |
+
'type' => 'radio',
|
649 |
+
'name' => 'ycd-sticky-expire-behavior',
|
650 |
+
'class' => 'ycd-sticky-expire-copy ycd-form-radio',
|
651 |
+
'data-attr-href' => 'ycd-sticky-expire-copy',
|
652 |
+
'value' => 'copy'
|
653 |
+
),
|
654 |
+
'label' => array(
|
655 |
+
'name' => __('Copy to clipboard', YCD_TEXT_DOMAIN)
|
656 |
+
)
|
657 |
+
)
|
658 |
+
)
|
659 |
+
);
|
660 |
+
|
661 |
$data['countdownFlipExpireTime'] = array(
|
662 |
'template' => array(
|
663 |
'fieldWrapperAttr' => array(
|
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.7.2
|
6 |
-
Stable tag: 2.1.
|
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,9 @@ 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.1.2 =
|
71 |
* Added security for settings save
|
72 |
* Support menu fixed
|
3 |
Tags: countdown, timer, countdown timer
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 5.7.2
|
6 |
+
Stable tag: 2.1.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.1.3 =
|
71 |
+
* Added possibility via Sticky countdown button copy text
|
72 |
+
|
73 |
= 2.1.2 =
|
74 |
* Added security for settings save
|
75 |
* Support menu fixed
|