Version Description
- Nav bar on the Countdown types section (Coming soon option)
- Show on selected user roles
- Schedule 1 option bug fixed
- Code optimization
- Code clean up
Download this release
Release Info
Developer | adamskaat |
Plugin | Countdown, Coming Soon – Countdown & Clock |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.9.9 to 2.0.0
- CountdownInit.php +2 -0
- assets/css/admin.css +18 -0
- assets/views/admin/comingSoon/comingSoonOptions.php +26 -2
- assets/views/settings.php +2 -2
- assets/views/types.php +9 -4
- classes/CountdownType.php +47 -9
- classes/RegisterPostType.php +209 -209
- classes/Tickbox.php +1 -1
- classes/YcdWidget.php +2 -2
- classes/countdown/ComingSoon.php +10 -3
- classes/countdown/Countdown.php +7 -1
- config/config.php +15 -11
- config/optionsConfig.php +37 -6
- countdown-builder.php +1 -1
- helpers/HelperFunctions.php +12 -5
- helpers/TypesNavBar.php +51 -0
- readme.txt +8 -1
CountdownInit.php
CHANGED
@@ -41,6 +41,7 @@ class CountdownInit {
|
|
41 |
require_once YCD_HELPERS_PATH.'HelperFunctions.php';
|
42 |
require_once YCD_HELPERS_PATH.'ScriptsIncluder.php';
|
43 |
require_once YCD_HELPERS_PATH.'MultipleChoiceButton.php';
|
|
|
44 |
require_once YCD_HELPERS_PATH.'AdminHelper.php';
|
45 |
require_once YCD_CLASSES_PATH.'DisplayRuleChecker.php';
|
46 |
require_once YCD_CLASSES_PATH.'ConditionBuilder.php';
|
@@ -65,6 +66,7 @@ class CountdownInit {
|
|
65 |
require_once YCD_CLASSES_PATH.'Subscription.php';
|
66 |
require_once YCD_CLASSES_PATH.'AjaxPro.php';
|
67 |
require_once YCD_CLASSES_PATH.'ActionsPro.php';
|
|
|
68 |
require_once YCD_CLASSES_PATH.'FiltersPro.php';
|
69 |
require_once(YCD_HELPERS_PATH.'ExtensionRegister.php');
|
70 |
}
|
41 |
require_once YCD_HELPERS_PATH.'HelperFunctions.php';
|
42 |
require_once YCD_HELPERS_PATH.'ScriptsIncluder.php';
|
43 |
require_once YCD_HELPERS_PATH.'MultipleChoiceButton.php';
|
44 |
+
require_once YCD_HELPERS_PATH.'TypesNavBar.php';
|
45 |
require_once YCD_HELPERS_PATH.'AdminHelper.php';
|
46 |
require_once YCD_CLASSES_PATH.'DisplayRuleChecker.php';
|
47 |
require_once YCD_CLASSES_PATH.'ConditionBuilder.php';
|
66 |
require_once YCD_CLASSES_PATH.'Subscription.php';
|
67 |
require_once YCD_CLASSES_PATH.'AjaxPro.php';
|
68 |
require_once YCD_CLASSES_PATH.'ActionsPro.php';
|
69 |
+
require_once YCD_COMING_SOON_PATH.'CommingSoonProFilters.php';
|
70 |
require_once YCD_CLASSES_PATH.'FiltersPro.php';
|
71 |
require_once(YCD_HELPERS_PATH.'ExtensionRegister.php');
|
72 |
}
|
assets/css/admin.css
CHANGED
@@ -32,6 +32,10 @@
|
|
32 |
transition: all .1s ease-in-out;
|
33 |
}
|
34 |
|
|
|
|
|
|
|
|
|
35 |
.countdowns-div:hover {
|
36 |
background-color: #CDCDCD;
|
37 |
transform: scale(1.05);
|
@@ -770,4 +774,18 @@ div.ycd-tabs-text-header > div.ycd-toggle-icon-open {
|
|
770 |
.ycd-bootstrap-wrapper input[type="radio"] {
|
771 |
box-shadow: none;
|
772 |
outline: none !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
773 |
}
|
32 |
transition: all .1s ease-in-out;
|
33 |
}
|
34 |
|
35 |
+
.ycd-mb-20 {
|
36 |
+
margin-bottom: 20px !important;
|
37 |
+
}
|
38 |
+
|
39 |
.countdowns-div:hover {
|
40 |
background-color: #CDCDCD;
|
41 |
transform: scale(1.05);
|
774 |
.ycd-bootstrap-wrapper input[type="radio"] {
|
775 |
box-shadow: none;
|
776 |
outline: none !important;
|
777 |
+
}
|
778 |
+
|
779 |
+
#crontrol-header-ycd-groups ul a:first-child {
|
780 |
+
margin-left: 0 !important;
|
781 |
+
}
|
782 |
+
|
783 |
+
#crontrol-header-ycd-groups {
|
784 |
+
margin-left: 6px;
|
785 |
+
}
|
786 |
+
|
787 |
+
.ycd-page-h3 {
|
788 |
+
margin-left: 6px;
|
789 |
+
font-size: 30px;
|
790 |
+
color: #333333;
|
791 |
}
|
assets/views/admin/comingSoon/comingSoonOptions.php
CHANGED
@@ -1,4 +1,9 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
if(YCD_PKG_VERSION == YCD_FREE_VERSION) {
|
3 |
$isPro = '-pro';
|
4 |
$proSpan = '<span class="ycd-pro-span">'.__('pro', YCD_TEXT_DOMAIN).'</span>';
|
@@ -7,6 +12,25 @@ if(YCD_PKG_VERSION == YCD_FREE_VERSION) {
|
|
7 |
<div class="panel panel-default">
|
8 |
<div class="panel-heading"><?php _e('Options', YCD_TEXT_DOMAIN)?></div>
|
9 |
<div class="panel-body">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
<div class="row form-group">
|
11 |
<div class="col-md-6">
|
12 |
<label for="ycd-coming-soon-whitelist-ip" class="ycd-label-of-switch"><?php _e('White list IP address', YCD_TEXT_DOMAIN); echo $proSpan; ?></label>
|
@@ -19,10 +43,10 @@ if(YCD_PKG_VERSION == YCD_FREE_VERSION) {
|
|
19 |
</div>
|
20 |
</div>
|
21 |
<div class="ycd-accordion-content ycd-hide-content">
|
22 |
-
<div class="col-md-
|
23 |
<label for="ycd-coming-soon-ip-address"><?php _e('IP address(s)', YCD_TEXT_DOMAIN);?></label>
|
24 |
</div>
|
25 |
-
<div class="col-md-
|
26 |
<input type="text" class="form-control" name="ycd-coming-soon-ip-address" placeholder="<?php _e('You can enter multiple IP address, just separate them with comma', YCD_TEXT_DOMAIN)?>" value="<?php echo esc_attr($this->getOptionValue('ycd-coming-soon-ip-address'))?>">
|
27 |
</div>
|
28 |
</div>
|
1 |
<?php
|
2 |
+
use ycd\AdminHelper;
|
3 |
+
use ycd\HelperFunction;
|
4 |
+
$defaultData = AdminHelper::defaultData();
|
5 |
+
$userSavedRoles = $this->getOptionValue('ycd-coming-soon-user-roles');
|
6 |
+
|
7 |
if(YCD_PKG_VERSION == YCD_FREE_VERSION) {
|
8 |
$isPro = '-pro';
|
9 |
$proSpan = '<span class="ycd-pro-span">'.__('pro', YCD_TEXT_DOMAIN).'</span>';
|
12 |
<div class="panel panel-default">
|
13 |
<div class="panel-heading"><?php _e('Options', YCD_TEXT_DOMAIN)?></div>
|
14 |
<div class="panel-body">
|
15 |
+
<div class="row form-group">
|
16 |
+
<div class="col-md-6">
|
17 |
+
<label for="ycd-coming-soon-for-loggdin" class="ycd-label-of-switch"><?php _e('Show on selected user roles', YCD_TEXT_DOMAIN); echo $proSpan; ?></label>
|
18 |
+
</div>
|
19 |
+
<div class="col-md-6 ycd-circles-width-wrapper ycd-option-wrapper<?php echo $isPro; ?>">
|
20 |
+
<label class="ycd-switch">
|
21 |
+
<input type="checkbox" id="ycd-coming-soon-for-loggdin" name="ycd-coming-soon-for-loggdin" class="ycd-accordion-checkbox" <?php echo $this->getOptionValue('ycd-coming-soon-for-loggdin'); ?>>
|
22 |
+
<span class="ycd-slider ycd-round"></span>
|
23 |
+
</label>
|
24 |
+
</div>
|
25 |
+
</div>
|
26 |
+
<div class="row form-group ycd-accordion-content ycd-hide-content">
|
27 |
+
<div class="col-md-6">
|
28 |
+
<label for="ycd-coming-soon-user-roles"><?php _e('Select user role(s)', YCD_TEXT_DOMAIN)?></label>
|
29 |
+
</div>
|
30 |
+
<div class="col-md-6">
|
31 |
+
<?php echo HelperFunction::createSelectBox($defaultData['userRoles'], $userSavedRoles, array('name' => 'ycd-coming-soon-user-roles[]', 'class' => 'js-ycd-select ycd-countdowns', 'multiple' => 'multiple', 'id' => 'ycd-coming-soon-user-roles')); ?>
|
32 |
+
</div>
|
33 |
+
</div>
|
34 |
<div class="row form-group">
|
35 |
<div class="col-md-6">
|
36 |
<label for="ycd-coming-soon-whitelist-ip" class="ycd-label-of-switch"><?php _e('White list IP address', YCD_TEXT_DOMAIN); echo $proSpan; ?></label>
|
43 |
</div>
|
44 |
</div>
|
45 |
<div class="ycd-accordion-content ycd-hide-content">
|
46 |
+
<div class="col-md-6">
|
47 |
<label for="ycd-coming-soon-ip-address"><?php _e('IP address(s)', YCD_TEXT_DOMAIN);?></label>
|
48 |
</div>
|
49 |
+
<div class="col-md-6">
|
50 |
<input type="text" class="form-control" name="ycd-coming-soon-ip-address" placeholder="<?php _e('You can enter multiple IP address, just separate them with comma', YCD_TEXT_DOMAIN)?>" value="<?php echo esc_attr($this->getOptionValue('ycd-coming-soon-ip-address'))?>">
|
51 |
</div>
|
52 |
</div>
|
assets/views/settings.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
use ycd\AdminHelper;
|
3 |
-
use ycd\
|
4 |
$defaultData = AdminHelper::defaultData();
|
5 |
$userSavedRoles = get_option('ycd-user-roles');
|
6 |
$dontDeleteData = (get_option('ycd-delete-data') ? 'checked': '');
|
@@ -62,7 +62,7 @@
|
|
62 |
<label><?php _e('User role who can use plugin', YCD_TEXT_DOMAIN)?></label>
|
63 |
</div>
|
64 |
<div class="col-md-4">
|
65 |
-
<?php echo
|
66 |
</div>
|
67 |
</div>
|
68 |
<div class="row form-group">
|
1 |
<?php
|
2 |
use ycd\AdminHelper;
|
3 |
+
use ycd\HelperFunction;
|
4 |
$defaultData = AdminHelper::defaultData();
|
5 |
$userSavedRoles = get_option('ycd-user-roles');
|
6 |
$dontDeleteData = (get_option('ycd-delete-data') ? 'checked': '');
|
62 |
<label><?php _e('User role who can use plugin', YCD_TEXT_DOMAIN)?></label>
|
63 |
</div>
|
64 |
<div class="col-md-4">
|
65 |
+
<?php echo HelperFunction::createSelectBox($defaultData['userRoles'], $userSavedRoles, array('name' => 'ycd-user-roles[]', 'class' => 'js-ycd-select ycd-countdowns', 'multiple' => 'multiple')); ?>
|
66 |
</div>
|
67 |
</div>
|
68 |
<div class="row form-group">
|
assets/views/types.php
CHANGED
@@ -1,19 +1,24 @@
|
|
1 |
<?php
|
2 |
use ycd\Countdown;
|
3 |
use ycd\AdminHelper;
|
|
|
4 |
$types = Countdown::getCountdownTypes();
|
5 |
$currentExtensions = YcdCountdownConfig::extensions();
|
6 |
$extensionsResult = AdminHelper::separateToActiveAndNotActive($currentExtensions);
|
7 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
<div class="ycd-bootstrap-wrapper ycd-types-wrapper">
|
9 |
-
<div class="row">
|
10 |
<div class="col-md-12">
|
11 |
-
<h3><?php _e('Add New Countdown', YCD_TEXT_DOMAIN); ?></h3>
|
12 |
</div>
|
13 |
</div>
|
14 |
-
<div class="add-new-hr"></div>
|
15 |
<?php foreach ($types as $type): ?>
|
16 |
-
<?php if(
|
17 |
<?php continue; ?>
|
18 |
<?php endif; ?>
|
19 |
<a class="create-countdown-link" <?php echo AdminHelper::buildCreateCountdownAttrs($type); ?> href="<?php echo AdminHelper::buildCreateCountdownUrl($type); ?>">
|
1 |
<?php
|
2 |
use ycd\Countdown;
|
3 |
use ycd\AdminHelper;
|
4 |
+
use ycd\TypesNavBar;
|
5 |
$types = Countdown::getCountdownTypes();
|
6 |
$currentExtensions = YcdCountdownConfig::extensions();
|
7 |
$extensionsResult = AdminHelper::separateToActiveAndNotActive($currentExtensions);
|
8 |
?>
|
9 |
+
|
10 |
+
<div>
|
11 |
+
<h3 class="ycd-page-h3"><?php _e('Add New Countdown', YCD_TEXT_DOMAIN); ?></h3>
|
12 |
+
</div>
|
13 |
+
<?php echo TypesNavBar::render(); ?>
|
14 |
+
|
15 |
<div class="ycd-bootstrap-wrapper ycd-types-wrapper">
|
16 |
+
<div class="row ycd-mb-20">
|
17 |
<div class="col-md-12">
|
|
|
18 |
</div>
|
19 |
</div>
|
|
|
20 |
<?php foreach ($types as $type): ?>
|
21 |
+
<?php if(!$type->isVisible()): ?>
|
22 |
<?php continue; ?>
|
23 |
<?php endif; ?>
|
24 |
<a class="create-countdown-link" <?php echo AdminHelper::buildCreateCountdownAttrs($type); ?> href="<?php echo AdminHelper::buildCreateCountdownUrl($type); ?>">
|
classes/CountdownType.php
CHANGED
@@ -1,40 +1,78 @@
|
|
1 |
<?php
|
2 |
namespace ycd;
|
3 |
|
4 |
-
class CountdownType
|
|
|
5 |
private $available = false;
|
6 |
private $isComingSoon = false;
|
7 |
private $name = '';
|
|
|
8 |
private $accessLevel = YCD_FREE_VERSION;
|
9 |
|
10 |
-
public function setName($name)
|
|
|
11 |
$this->name = $name;
|
12 |
}
|
13 |
-
|
|
|
|
|
14 |
return $this->name;
|
15 |
}
|
16 |
|
17 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
$this->available = $available;
|
19 |
}
|
20 |
|
21 |
-
public function isAvailable()
|
|
|
22 |
return $this->available;
|
23 |
}
|
24 |
|
25 |
-
public function setAccessLevel($accessLevel)
|
|
|
26 |
$this->accessLevel = $accessLevel;
|
27 |
}
|
28 |
|
29 |
-
public function getAccessLevel()
|
|
|
30 |
return $this->accessLevel;
|
31 |
}
|
32 |
|
33 |
-
public function setIsComingSoon($isComingSoon)
|
|
|
34 |
$this->isComingSoon = $isComingSoon;
|
35 |
}
|
36 |
|
37 |
-
public function getIsComingSoon()
|
|
|
38 |
return $this->isComingSoon;
|
39 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
1 |
<?php
|
2 |
namespace ycd;
|
3 |
|
4 |
+
class CountdownType
|
5 |
+
{
|
6 |
private $available = false;
|
7 |
private $isComingSoon = false;
|
8 |
private $name = '';
|
9 |
+
private $group = array();
|
10 |
private $accessLevel = YCD_FREE_VERSION;
|
11 |
|
12 |
+
public function setName($name)
|
13 |
+
{
|
14 |
$this->name = $name;
|
15 |
}
|
16 |
+
|
17 |
+
public function getName()
|
18 |
+
{
|
19 |
return $this->name;
|
20 |
}
|
21 |
|
22 |
+
public function setGroup($group)
|
23 |
+
{
|
24 |
+
$this->group = $group;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getGroup()
|
28 |
+
{
|
29 |
+
return $this->group;
|
30 |
+
}
|
31 |
+
|
32 |
+
public function setAvailable($available)
|
33 |
+
{
|
34 |
$this->available = $available;
|
35 |
}
|
36 |
|
37 |
+
public function isAvailable()
|
38 |
+
{
|
39 |
return $this->available;
|
40 |
}
|
41 |
|
42 |
+
public function setAccessLevel($accessLevel)
|
43 |
+
{
|
44 |
$this->accessLevel = $accessLevel;
|
45 |
}
|
46 |
|
47 |
+
public function getAccessLevel()
|
48 |
+
{
|
49 |
return $this->accessLevel;
|
50 |
}
|
51 |
|
52 |
+
public function setIsComingSoon($isComingSoon)
|
53 |
+
{
|
54 |
$this->isComingSoon = $isComingSoon;
|
55 |
}
|
56 |
|
57 |
+
public function getIsComingSoon()
|
58 |
+
{
|
59 |
return $this->isComingSoon;
|
60 |
}
|
61 |
+
|
62 |
+
public function isVisible()
|
63 |
+
{
|
64 |
+
$status = true;
|
65 |
+
$isAvailable = $this->isAvailable();
|
66 |
+
|
67 |
+
if (!$isAvailable && YCD_PKG_VERSION != YCD_FREE_VERSION) {
|
68 |
+
$status = false;
|
69 |
+
}
|
70 |
+
|
71 |
+
if (!empty($_GET['ycd_group_name']) && $_GET['ycd_group_name'] != 'all') {
|
72 |
+
$group = $this->getGroup();
|
73 |
+
$status = $status && in_array($_GET['ycd_group_name'], $group);
|
74 |
+
}
|
75 |
+
|
76 |
+
return $status;
|
77 |
+
}
|
78 |
}
|
classes/RegisterPostType.php
CHANGED
@@ -4,60 +4,60 @@ use \YcdCountdownOptionsConfig;
|
|
4 |
|
5 |
class RegisterPostType {
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
}
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
|
44 |
-
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
|
54 |
-
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
|
62 |
public function postTypeSupports($supports) {
|
63 |
|
@@ -82,171 +82,171 @@ class RegisterPostType {
|
|
82 |
return $supports;
|
83 |
}
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
}
|
4 |
|
5 |
class RegisterPostType {
|
6 |
|
7 |
+
private $typeObj;
|
8 |
+
private $type;
|
9 |
+
private $id;
|
10 |
|
11 |
+
public function __construct() {
|
12 |
+
if (!AdminHelper::showMenuForCurrentUser()) {
|
13 |
+
return false;
|
14 |
}
|
15 |
+
$this->init();
|
16 |
+
|
17 |
+
return true;
|
18 |
+
}
|
19 |
|
20 |
+
public function setId($id) {
|
21 |
+
$this->id = $id;
|
22 |
+
}
|
23 |
|
24 |
+
public function getId() {
|
25 |
+
return (int)$this->id;
|
26 |
+
}
|
27 |
|
28 |
+
public function setType($type) {
|
29 |
+
$this->type = $type;
|
30 |
+
}
|
31 |
|
32 |
+
public function getType() {
|
33 |
+
return $this->type;
|
34 |
+
}
|
35 |
|
36 |
+
public function setTypeObj($typeObj) {
|
37 |
+
$this->typeObj = $typeObj;
|
38 |
+
}
|
39 |
|
40 |
+
public function getTypeObj() {
|
41 |
+
return $this->typeObj;
|
42 |
+
}
|
43 |
|
44 |
+
public function init() {
|
45 |
|
46 |
+
if (!empty($_GET['post_type']) && $_GET['post_type'] == YCD_COUNTDOWN_POST_TYPE) {
|
47 |
+
wp_deregister_script('autosave');
|
48 |
+
}
|
49 |
+
|
50 |
+
$postType = YCD_COUNTDOWN_POST_TYPE;
|
51 |
+
add_filter('ycdPostTypeSupport', array($this, 'postTypeSupports'), 10, 1);
|
52 |
+
$args = $this->getPostTypeArgs();
|
53 |
|
54 |
+
register_post_type($postType, $args);
|
55 |
|
56 |
+
if(@$_GET['post_type'] || get_post_type(@$_GET['post']) == YCD_COUNTDOWN_POST_TYPE) {
|
57 |
+
$this->createCdObjFromCdType();
|
58 |
+
}
|
59 |
+
YcdCountdownOptionsConfig::optionsValues();
|
60 |
+
}
|
61 |
|
62 |
public function postTypeSupports($supports) {
|
63 |
|
82 |
return $supports;
|
83 |
}
|
84 |
|
85 |
+
private function createCdObjFromCdType() {
|
86 |
+
$id = 0;
|
87 |
+
|
88 |
+
if (!empty($_GET['post'])) {
|
89 |
+
$id = (int)$_GET['post'];
|
90 |
+
}
|
91 |
+
|
92 |
+
$type = $this->getTypeName();
|
93 |
+
$this->setType($type);
|
94 |
+
$this->setId($id);
|
95 |
+
|
96 |
+
$this->createCdObj();
|
97 |
+
}
|
98 |
+
|
99 |
+
public function createCdObj()
|
100 |
+
{
|
101 |
+
$id = $this->getId();
|
102 |
+
$type = $this->getType();
|
103 |
+
$typePath = Countdown::getTypePathFormCountdownType($type);
|
104 |
+
$className = Countdown::getClassNameCountdownType($type);
|
105 |
+
|
106 |
+
if (!file_exists($typePath.$className.'.php')) {
|
107 |
+
wp_die(__($className.' class does not exist', YCD_TEXT_DOMAIN));
|
108 |
+
}
|
109 |
+
require_once($typePath.$className.'.php');
|
110 |
+
$className = __NAMESPACE__.'\\'.$className;
|
111 |
+
if (!class_exists($className)) {
|
112 |
+
wp_die(__($className.' class does not exist', YCD_TEXT_DOMAIN));
|
113 |
+
}
|
114 |
+
$typeObj = new $className();
|
115 |
+
$typeObj->setId($id);
|
116 |
+
$typeObj->setType($type);
|
117 |
+
$this->setTypeObj($typeObj);
|
118 |
+
}
|
119 |
+
|
120 |
+
private function getTypeName() {
|
121 |
+
$type = 'circle';
|
122 |
+
|
123 |
+
/*
|
124 |
+
* First, we try to find the countdown type with the post id then,
|
125 |
+
* if the post id doesn't exist, we try to find it with $_GET['ycd_type']
|
126 |
+
*/
|
127 |
+
if (!empty($_GET['post'])) {
|
128 |
+
$id = (int)$_GET['post'];
|
129 |
+
$cdOptionsData = Countdown::getPostSavedData($id);
|
130 |
+
if (!empty($cdOptionsData['ycd-type'])) {
|
131 |
+
$type = $cdOptionsData['ycd-type'];
|
132 |
+
}
|
133 |
+
}
|
134 |
+
else if (!empty($_GET['ycd_type'])) {
|
135 |
+
$type = $_GET['ycd_type'];
|
136 |
+
}
|
137 |
+
|
138 |
+
return $type;
|
139 |
+
}
|
140 |
+
|
141 |
+
public function getPostTypeArgs()
|
142 |
+
{
|
143 |
+
$labels = $this->getPostTypeLabels();
|
144 |
+
|
145 |
+
$args = array(
|
146 |
+
'labels' => $labels,
|
147 |
+
'description' => __('Description.', 'your-plugin-textdomain'),
|
148 |
+
//Exclude_from_search
|
149 |
+
'public' => true,
|
150 |
+
'has_archive' => true,
|
151 |
+
//Where to show the post type in the admin menu
|
152 |
+
'show_ui' => true,
|
153 |
+
'query_var' => false,
|
154 |
+
// post preview button
|
155 |
+
'publicly_queryable' => false,
|
156 |
+
'map_meta_cap' => true,
|
157 |
+
'capability_type' => array('ycd_countdown', 'ycd_countdowns'),
|
158 |
+
'menu_position' => 10,
|
159 |
+
'supports' => apply_filters('ycdPostTypeSupport', array('title')),
|
160 |
+
'menu_icon' => 'dashicons-clock'
|
161 |
+
);
|
162 |
+
|
163 |
+
return $args;
|
164 |
+
}
|
165 |
+
|
166 |
+
public function getPostTypeLabels()
|
167 |
+
{
|
168 |
+
$labels = array(
|
169 |
+
'name' => _x(YCD_COUNTDOWN_MENU_TITLE, 'post type general name', YCD_TEXT_DOMAIN),
|
170 |
+
'singular_name' => _x(YCD_COUNTDOWN_MENU_TITLE, 'post type singular name', YCD_TEXT_DOMAIN),
|
171 |
+
'menu_name' => _x(YCD_COUNTDOWN_MENU_TITLE, 'admin menu', YCD_TEXT_DOMAIN),
|
172 |
+
'name_admin_bar' => _x('Countdown', 'add new on admin bar', YCD_TEXT_DOMAIN),
|
173 |
+
'add_new' => _x('Add New', 'Countdown', YCD_TEXT_DOMAIN),
|
174 |
+
'add_new_item' => __('Add New Countdown', YCD_TEXT_DOMAIN),
|
175 |
+
'new_item' => __('New Countdown', YCD_TEXT_DOMAIN),
|
176 |
+
'edit_item' => __('Edit Countdown', YCD_TEXT_DOMAIN),
|
177 |
+
'view_item' => __('View Countdown', YCD_TEXT_DOMAIN),
|
178 |
+
'all_items' => __('All '.YCD_COUNTDOWN_MENU_TITLE, YCD_TEXT_DOMAIN),
|
179 |
+
'search_items' => __('Search '.YCD_COUNTDOWN_MENU_TITLE, YCD_TEXT_DOMAIN),
|
180 |
+
'parent_item_colon' => __('Parent '.YCD_COUNTDOWN_MENU_TITLE.':', YCD_TEXT_DOMAIN),
|
181 |
+
'not_found' => __('No '.YCD_COUNTDOWN_MENU_TITLE.' found.', YCD_TEXT_DOMAIN),
|
182 |
+
'not_found_in_trash' => __('No '.YCD_COUNTDOWN_MENU_TITLE.' found in Trash.', YCD_TEXT_DOMAIN)
|
183 |
+
);
|
184 |
+
|
185 |
+
return $labels;
|
186 |
+
}
|
187 |
+
|
188 |
+
public function addSubMenu() {
|
189 |
+
$menuLabel = '';
|
190 |
+
if (YCD_PKG_VERSION == YCD_FREE_VERSION) {
|
191 |
+
$menuLabel = '<span style="color: red;"> '.__('Pro', YCD_TEXT_DOMAIN).'</span>';
|
192 |
+
}
|
193 |
+
add_submenu_page(
|
194 |
+
'edit.php?post_type='.YCD_COUNTDOWN_POST_TYPE,
|
195 |
+
__('Countdown Types', YCD_TEXT_DOMAIN), // page title
|
196 |
+
__('Countdown Types', YCD_TEXT_DOMAIN), // menu title
|
197 |
+
'ycd_manage_options',
|
198 |
+
YCD_COUNTDOWN_POST_TYPE,
|
199 |
+
array($this, 'countdownTypes')
|
200 |
+
);
|
201 |
+
add_submenu_page('edit.php?post_type='.YCD_COUNTDOWN_POST_TYPE, __('Newsletter', YCD_TEXT_DOMAIN), __('Newsletter', YCD_TEXT_DOMAIN).$menuLabel, 'ycd_manage_options', YCD_COUNTDOWN_NEWSLETTER, array($this, 'countdownNewsletter'));
|
202 |
+
add_submenu_page('edit.php?post_type='.YCD_COUNTDOWN_POST_TYPE, __('Coming Soon', YCD_TEXT_DOMAIN), __('Coming Soon', YCD_TEXT_DOMAIN), 'ycd_manage_options', YCD_COUNTDOWN_COMING_SOON, array($this, 'comingSoon'));
|
203 |
+
add_submenu_page('edit.php?post_type='.YCD_COUNTDOWN_POST_TYPE, __('Support', YCD_TEXT_DOMAIN), __('Support', YCD_TEXT_DOMAIN), 'ycd_manage_options', YCD_COUNTDOWN_SUPPORT, array($this, 'countdownSupport'));
|
204 |
+
add_submenu_page('edit.php?post_type='.YCD_COUNTDOWN_POST_TYPE, __('Tutorials', YCD_TEXT_DOMAIN), __('Tutorials', YCD_TEXT_DOMAIN), 'ycd_manage_options', YCD_COUNTDOWN_TUTORIALS, array($this, 'countdownTutorials'));
|
205 |
+
add_submenu_page('edit.php?post_type='.YCD_COUNTDOWN_POST_TYPE, __('More Ideas?', YCD_TEXT_DOMAIN), __('More Ideas?', YCD_TEXT_DOMAIN), 'ycd_manage_options', YCD_COUNTDOWN_IDEAS, array($this, 'countdownIdeas'));
|
206 |
+
add_submenu_page('edit.php?post_type='.YCD_COUNTDOWN_POST_TYPE, __('Subscribers', YCD_TEXT_DOMAIN), __('Subscribers', YCD_TEXT_DOMAIN).$menuLabel, 'ycd_manage_options', YCD_COUNTDOWN_SUBSCRIBERS, array($this, 'countdownSubscribers'));
|
207 |
+
add_submenu_page('edit.php?post_type='.YCD_COUNTDOWN_POST_TYPE, __('More Plugins', YCD_TEXT_DOMAIN), __('More Plugins', YCD_TEXT_DOMAIN), 'manage_options', YCD_COUNTDOWN_MORE_PLUGINS, array($this, 'morePlugins'));
|
208 |
+
add_submenu_page('edit.php?post_type='.YCD_COUNTDOWN_POST_TYPE, __('Settings', YCD_TEXT_DOMAIN), __('Settings', YCD_TEXT_DOMAIN), 'manage_options', YCD_COUNTDOWN_SETTINGS, array($this, 'countdownSettings'));
|
209 |
+
}
|
210 |
+
|
211 |
+
public function countdownNewsletter() {
|
212 |
+
if (YCD_PKG_VERSION == YCD_FREE_VERSION) {
|
213 |
+
wp_redirect(YCD_COUNTDOWN_PRO_URL);
|
214 |
+
}
|
215 |
+
else {
|
216 |
+
require_once YCD_VIEWS_PATH.'newsletter.php';
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
public function comingSoon() {
|
221 |
+
$comingSoonObj = new ComingSoon();
|
222 |
+
$comingSoonObj->adminView();
|
223 |
+
}
|
224 |
+
|
225 |
+
public function countdownSupport() {
|
226 |
+
require_once YCD_VIEWS_PATH.'support.php';
|
227 |
+
}
|
228 |
+
|
229 |
+
public function countdownIdeas() {
|
230 |
+
|
231 |
+
}
|
232 |
+
|
233 |
+
public function countdownTutorials() {
|
234 |
+
require_once YCD_ADMIN_VIEWS_PATH.'tutorials.php';
|
235 |
+
}
|
236 |
+
|
237 |
+
public function morePlugins() {
|
238 |
+
require_once YCD_VIEWS_PATH.'morePlugins.php';
|
239 |
+
}
|
240 |
+
|
241 |
+
public function countdownSubscribers() {
|
242 |
+
require_once YCD_VIEWS_PATH.'subscribers.php';
|
243 |
+
}
|
244 |
+
|
245 |
+
public function countdownTypes() {
|
246 |
+
require_once YCD_VIEWS_PATH.'types.php';
|
247 |
+
}
|
248 |
+
|
249 |
+
public function countdownSettings() {
|
250 |
+
require_once YCD_VIEWS_PATH.'settings.php';
|
251 |
+
}
|
252 |
}
|
classes/Tickbox.php
CHANGED
@@ -100,7 +100,7 @@ class Tickbox {
|
|
100 |
<p>
|
101 |
<label><?php _e('Select countdown', YCD_TEXT_DOMAIN); ?>:</label>
|
102 |
<?php if(!empty($idTitle)): ?>
|
103 |
-
<?php echo
|
104 |
<?php else: ?>
|
105 |
<a href="<?php echo YCD_ADMIN_URL.'edit.php?post_type='.YCD_COUNTDOWN_POST_TYPE.'&page='.YCD_COUNTDOWN_POST_TYPE; ?>"><?php _e('Add New Countdown', YCD_TEXT_DOMAIN); ?></a>
|
106 |
<?php endif; ?>
|
100 |
<p>
|
101 |
<label><?php _e('Select countdown', YCD_TEXT_DOMAIN); ?>:</label>
|
102 |
<?php if(!empty($idTitle)): ?>
|
103 |
+
<?php echo HelperFunction::createSelectBox($idTitle, '', array('name' => 'ycdOption', 'class' => 'ycd-countdowns')); ?>
|
104 |
<?php else: ?>
|
105 |
<a href="<?php echo YCD_ADMIN_URL.'edit.php?post_type='.YCD_COUNTDOWN_POST_TYPE.'&page='.YCD_COUNTDOWN_POST_TYPE; ?>"><?php _e('Add New Countdown', YCD_TEXT_DOMAIN); ?></a>
|
106 |
<?php endif; ?>
|
classes/YcdWidget.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
use ycd\Countdown;
|
3 |
-
use ycd\
|
4 |
|
5 |
// Creating the widget
|
6 |
class ycd_countdown_widget extends WP_Widget {
|
@@ -33,7 +33,7 @@ class ycd_countdown_widget extends WP_Widget {
|
|
33 |
?>
|
34 |
<p>
|
35 |
<label><?php _e('Select countdown', YCD_TEXT_DOMAIN); ?>:</label>
|
36 |
-
<?php echo
|
37 |
</p>
|
38 |
<?php
|
39 |
}
|
1 |
<?php
|
2 |
use ycd\Countdown;
|
3 |
+
use ycd\HelperFunction;
|
4 |
|
5 |
// Creating the widget
|
6 |
class ycd_countdown_widget extends WP_Widget {
|
33 |
?>
|
34 |
<p>
|
35 |
<label><?php _e('Select countdown', YCD_TEXT_DOMAIN); ?>:</label>
|
36 |
+
<?php echo HelperFunction::createSelectBox($idTitle, $optionName, array('name' => $optionSaved)); ?>
|
37 |
</p>
|
38 |
<?php
|
39 |
}
|
classes/countdown/ComingSoon.php
CHANGED
@@ -48,8 +48,12 @@ Class ComingSoon {
|
|
48 |
public function allowComingSoon() {
|
49 |
$renderStatus = true;
|
50 |
$isAllow = $this->getOptionValue('ycd-enable-coming-soon');
|
51 |
-
$status = empty($isAllow)
|
52 |
-
|
|
|
|
|
|
|
|
|
53 |
if ($status) {
|
54 |
return false;
|
55 |
}
|
@@ -97,13 +101,16 @@ Class ComingSoon {
|
|
97 |
$defaults['ycd-coming-soon-countdown-custom-css'] = '';
|
98 |
$defaults['ycd-coming-soon-countdown-custom-js'] = '';
|
99 |
$defaults['ycd-coming-soon-whitelist-ip'] = '';
|
|
|
100 |
$defaults['ycd-coming-soon-ip-address'] = '';
|
|
|
101 |
$defaults['checkboxes'] = array(
|
102 |
'ycd-enable-coming-soon',
|
103 |
'ycd-coming-soon-bg-image',
|
104 |
'ycd-coming-soon-add-countdown',
|
105 |
'ycd-coming-soon-bg-video',
|
106 |
-
'ycd-coming-soon-whitelist-ip'
|
|
|
107 |
);
|
108 |
|
109 |
return apply_filters('ycdComingSoonDefaults', $defaults);
|
48 |
public function allowComingSoon() {
|
49 |
$renderStatus = true;
|
50 |
$isAllow = $this->getOptionValue('ycd-enable-coming-soon');
|
51 |
+
$status = empty($isAllow);
|
52 |
+
|
53 |
+
if (YCD_PKG_VERSION == YCD_FREE_VERSION) {
|
54 |
+
$status = $status || is_user_logged_in();
|
55 |
+
}
|
56 |
+
|
57 |
if ($status) {
|
58 |
return false;
|
59 |
}
|
101 |
$defaults['ycd-coming-soon-countdown-custom-css'] = '';
|
102 |
$defaults['ycd-coming-soon-countdown-custom-js'] = '';
|
103 |
$defaults['ycd-coming-soon-whitelist-ip'] = '';
|
104 |
+
$defaults['ycd-coming-soon-for-loggdin'] = '';
|
105 |
$defaults['ycd-coming-soon-ip-address'] = '';
|
106 |
+
$defaults['ycd-coming-soon-user-roles'] = '';
|
107 |
$defaults['checkboxes'] = array(
|
108 |
'ycd-enable-coming-soon',
|
109 |
'ycd-coming-soon-bg-image',
|
110 |
'ycd-coming-soon-add-countdown',
|
111 |
'ycd-coming-soon-bg-video',
|
112 |
+
'ycd-coming-soon-whitelist-ip',
|
113 |
+
'ycd-coming-soon-for-loggdin'
|
114 |
);
|
115 |
|
116 |
return apply_filters('ycdComingSoonDefaults', $defaults);
|
classes/countdown/Countdown.php
CHANGED
@@ -416,10 +416,12 @@ abstract class Countdown {
|
|
416 |
*
|
417 |
* @return array $countdownType
|
418 |
*/
|
419 |
-
public static function getCountdownTypes()
|
|
|
420 |
global $YCD_TYPES;
|
421 |
$countdownTypesObj = array();
|
422 |
$countdownTypes = $YCD_TYPES['typeName'];
|
|
|
423 |
|
424 |
foreach($countdownTypes as $type => $level) {
|
425 |
if(empty($level)) {
|
@@ -437,6 +439,10 @@ abstract class Countdown {
|
|
437 |
$typeObj->setName($type);
|
438 |
$typeObj->setAccessLevel($level);
|
439 |
|
|
|
|
|
|
|
|
|
440 |
if(YCD_PKG_VERSION >= $level) {
|
441 |
$isAvailable = true;
|
442 |
}
|
416 |
*
|
417 |
* @return array $countdownType
|
418 |
*/
|
419 |
+
public static function getCountdownTypes()
|
420 |
+
{
|
421 |
global $YCD_TYPES;
|
422 |
$countdownTypesObj = array();
|
423 |
$countdownTypes = $YCD_TYPES['typeName'];
|
424 |
+
$groups = $YCD_TYPES['typeGroupName'];
|
425 |
|
426 |
foreach($countdownTypes as $type => $level) {
|
427 |
if(empty($level)) {
|
439 |
$typeObj->setName($type);
|
440 |
$typeObj->setAccessLevel($level);
|
441 |
|
442 |
+
if (!empty($groups[$type])) {
|
443 |
+
$typeObj->setGroup($groups[$type]);
|
444 |
+
}
|
445 |
+
|
446 |
if(YCD_PKG_VERSION >= $level) {
|
447 |
$isAvailable = true;
|
448 |
}
|
config/config.php
CHANGED
@@ -1,14 +1,17 @@
|
|
1 |
<?php
|
2 |
use ycd\AdminHelper;
|
3 |
|
4 |
-
class YcdCountdownConfig
|
5 |
-
|
|
|
|
|
6 |
if(!defined($name)) {
|
7 |
define($name, $value);
|
8 |
}
|
9 |
}
|
10 |
|
11 |
-
public static function init()
|
|
|
12 |
self::addDefine('YCD_PREFIX', YCD_FILE_NAME);
|
13 |
self::addDefine('YCD_ADMIN_URL', admin_url());
|
14 |
self::addDefine('YCD_COUNTDOWN_BUILDER_URL', plugins_url().'/'.YCD_FOLDER_NAME.'/');
|
@@ -38,6 +41,7 @@ class YcdCountdownConfig {
|
|
38 |
self::addDefine('YCD_CSS_PATH', YCD_ASSETS_PATH.'css/');
|
39 |
self::addDefine('YCD_JS_PATH', YCD_ASSETS_PATH.'js/');
|
40 |
self::addDefine('YCD_COUNTDOWNS_PATH', YCD_CLASSES_PATH.'countdown/');
|
|
|
41 |
self::addDefine('YCD_HELPERS_PATH', YCD_COUNTDOWN_PATH.'helpers/');
|
42 |
self::addDefine('YCD_COUNTDOWN_POST_TYPE', 'ycdcountdown');
|
43 |
self::addDefine('YCD_COUNTDOWN_SETTINGS', 'ycdSettings');
|
@@ -70,8 +74,8 @@ class YcdCountdownConfig {
|
|
70 |
self::addDefine('YCD_CRON_REPEAT_INTERVAL', 1);
|
71 |
self::addDefine('YCD_AJAX_SUCCESS', 1);
|
72 |
self::addDefine('YCD_TABLE_LIMIT', 15);
|
73 |
-
self::addDefine('YCD_VERSION_PRO', 1.
|
74 |
-
self::addDefine('YCD_VERSION',
|
75 |
self::addDefine('YCD_FREE_VERSION', 1);
|
76 |
self::addDefine('YCD_SILVER_VERSION', 2);
|
77 |
self::addDefine('YCD_GOLD_VERSION', 3);
|
@@ -79,17 +83,17 @@ class YcdCountdownConfig {
|
|
79 |
self::addDefine('YCD_EXTENSION_VERSION', 99);
|
80 |
require_once(dirname(__FILE__).'/config-pkg.php');
|
81 |
|
82 |
-
$versionText = '
|
83 |
if (YCD_PKG_VERSION != YCD_FREE_VERSION) {
|
84 |
-
$versionText = '1.8.
|
85 |
}
|
86 |
self::addDefine('YCD_VERSION_TEXT', $versionText);
|
87 |
-
self::addDefine('YCD_LAST_UPDATE', '
|
88 |
-
self::addDefine('YCD_NEXT_UPDATE', '
|
89 |
}
|
90 |
|
91 |
-
public static function displaySettings()
|
92 |
-
|
93 |
global $YCD_DISPLAY_SETTINGS_CONFIG;
|
94 |
$keys = array(
|
95 |
'select_settings' => 'Select settings',
|
1 |
<?php
|
2 |
use ycd\AdminHelper;
|
3 |
|
4 |
+
class YcdCountdownConfig
|
5 |
+
{
|
6 |
+
public static function addDefine($name, $value)
|
7 |
+
{
|
8 |
if(!defined($name)) {
|
9 |
define($name, $value);
|
10 |
}
|
11 |
}
|
12 |
|
13 |
+
public static function init()
|
14 |
+
{
|
15 |
self::addDefine('YCD_PREFIX', YCD_FILE_NAME);
|
16 |
self::addDefine('YCD_ADMIN_URL', admin_url());
|
17 |
self::addDefine('YCD_COUNTDOWN_BUILDER_URL', plugins_url().'/'.YCD_FOLDER_NAME.'/');
|
41 |
self::addDefine('YCD_CSS_PATH', YCD_ASSETS_PATH.'css/');
|
42 |
self::addDefine('YCD_JS_PATH', YCD_ASSETS_PATH.'js/');
|
43 |
self::addDefine('YCD_COUNTDOWNS_PATH', YCD_CLASSES_PATH.'countdown/');
|
44 |
+
self::addDefine('YCD_COMING_SOON_PATH', YCD_CLASSES_PATH.'commingSoon/');
|
45 |
self::addDefine('YCD_HELPERS_PATH', YCD_COUNTDOWN_PATH.'helpers/');
|
46 |
self::addDefine('YCD_COUNTDOWN_POST_TYPE', 'ycdcountdown');
|
47 |
self::addDefine('YCD_COUNTDOWN_SETTINGS', 'ycdSettings');
|
74 |
self::addDefine('YCD_CRON_REPEAT_INTERVAL', 1);
|
75 |
self::addDefine('YCD_AJAX_SUCCESS', 1);
|
76 |
self::addDefine('YCD_TABLE_LIMIT', 15);
|
77 |
+
self::addDefine('YCD_VERSION_PRO', 1.86);
|
78 |
+
self::addDefine('YCD_VERSION', 2.0);
|
79 |
self::addDefine('YCD_FREE_VERSION', 1);
|
80 |
self::addDefine('YCD_SILVER_VERSION', 2);
|
81 |
self::addDefine('YCD_GOLD_VERSION', 3);
|
83 |
self::addDefine('YCD_EXTENSION_VERSION', 99);
|
84 |
require_once(dirname(__FILE__).'/config-pkg.php');
|
85 |
|
86 |
+
$versionText = '2.0.0';
|
87 |
if (YCD_PKG_VERSION != YCD_FREE_VERSION) {
|
88 |
+
$versionText = '1.8.6';
|
89 |
}
|
90 |
self::addDefine('YCD_VERSION_TEXT', $versionText);
|
91 |
+
self::addDefine('YCD_LAST_UPDATE', 'Feb 14');
|
92 |
+
self::addDefine('YCD_NEXT_UPDATE', 'Feb 28');
|
93 |
}
|
94 |
|
95 |
+
public static function displaySettings()
|
96 |
+
{
|
97 |
global $YCD_DISPLAY_SETTINGS_CONFIG;
|
98 |
$keys = array(
|
99 |
'select_settings' => 'Select settings',
|
config/optionsConfig.php
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class YcdCountdownOptionsConfig
|
4 |
-
|
5 |
-
public static function init()
|
|
|
6 |
global $YCD_TYPES;
|
7 |
|
8 |
$YCD_TYPES['typeName'] = apply_filters('ycdTypes', array(
|
@@ -23,6 +24,24 @@ class YcdCountdownOptionsConfig {
|
|
23 |
'flipClockPopup' => YCD_GOLD_VERSION
|
24 |
));
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
$YCD_TYPES['typePath'] = apply_filters('ycdTypePaths', array(
|
27 |
'circle' => YCD_COUNTDOWNS_PATH,
|
28 |
'sticky' => YCD_COUNTDOWNS_PATH,
|
@@ -89,9 +108,19 @@ class YcdCountdownOptionsConfig {
|
|
89 |
'analytics' => __('Countdown Analytic Extension', YCD_TEXT_DOMAIN),
|
90 |
'circleTimer' => __('Circle Timer Extension', YCD_TEXT_DOMAIN)
|
91 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
}
|
93 |
|
94 |
-
public static function optionsValues()
|
|
|
95 |
global $YCD_OPTIONS;
|
96 |
$options = array();
|
97 |
$options[] = array('name' => 'ycd-type', 'type' => 'text', 'defaultValue' => 'circle');
|
@@ -314,7 +343,8 @@ class YcdCountdownOptionsConfig {
|
|
314 |
$YCD_OPTIONS = apply_filters('ycdCountdownDefaultOptions', $options);
|
315 |
}
|
316 |
|
317 |
-
public static function getDefaultValuesData()
|
|
|
318 |
self::optionsValues();
|
319 |
global $YCD_OPTIONS;
|
320 |
$currentKeyVal = array();
|
@@ -325,7 +355,8 @@ class YcdCountdownOptionsConfig {
|
|
325 |
return $currentKeyVal;
|
326 |
}
|
327 |
|
328 |
-
public static function getDefaultTimezone()
|
|
|
329 |
$timezone = get_option('timezone_string');
|
330 |
if (!$timezone) {
|
331 |
$timezone = 'America/New_York';
|
1 |
<?php
|
2 |
|
3 |
+
class YcdCountdownOptionsConfig
|
4 |
+
{
|
5 |
+
public static function init()
|
6 |
+
{
|
7 |
global $YCD_TYPES;
|
8 |
|
9 |
$YCD_TYPES['typeName'] = apply_filters('ycdTypes', array(
|
24 |
'flipClockPopup' => YCD_GOLD_VERSION
|
25 |
));
|
26 |
|
27 |
+
$YCD_TYPES['typeGroupName'] = apply_filters('ycdTypeGroupName', array(
|
28 |
+
'circle' => array('countdown'),
|
29 |
+
'sticky' => array('countdown', 'other'),
|
30 |
+
'simple' => array('countdown'),
|
31 |
+
'timer' => array('timer'),
|
32 |
+
'clock1' => array('clock'),
|
33 |
+
'clock2' => array('clock'),
|
34 |
+
'clock3' => array('clock'),
|
35 |
+
'clock4' => array('clock'),
|
36 |
+
'clock5' => array('clock'),
|
37 |
+
'clock6' => array('clock'),
|
38 |
+
'clock7' => array('clock'),
|
39 |
+
'woo' => array('countdown', 'other'),
|
40 |
+
'circlePopup' => array('countdown', 'popup'),
|
41 |
+
'flipClock' => array('countdown'),
|
42 |
+
'flipClockPopup' => array('countdown', 'popup')
|
43 |
+
));
|
44 |
+
|
45 |
$YCD_TYPES['typePath'] = apply_filters('ycdTypePaths', array(
|
46 |
'circle' => YCD_COUNTDOWNS_PATH,
|
47 |
'sticky' => YCD_COUNTDOWNS_PATH,
|
108 |
'analytics' => __('Countdown Analytic Extension', YCD_TEXT_DOMAIN),
|
109 |
'circleTimer' => __('Circle Timer Extension', YCD_TEXT_DOMAIN)
|
110 |
));
|
111 |
+
|
112 |
+
$YCD_TYPES['typesGroupList'] = apply_filters('ycdGroupsLost', array(
|
113 |
+
'all' => __('All Types', YCD_TEXT_DOMAIN),
|
114 |
+
'countdown' => __('Countdown', YCD_TEXT_DOMAIN),
|
115 |
+
'clock' => __('Clock', YCD_TEXT_DOMAIN),
|
116 |
+
'other' => __('Other', YCD_TEXT_DOMAIN),
|
117 |
+
'timer' => __('Timer', YCD_TEXT_DOMAIN),
|
118 |
+
'popup' => __('Popup', YCD_TEXT_DOMAIN)
|
119 |
+
));
|
120 |
}
|
121 |
|
122 |
+
public static function optionsValues()
|
123 |
+
{
|
124 |
global $YCD_OPTIONS;
|
125 |
$options = array();
|
126 |
$options[] = array('name' => 'ycd-type', 'type' => 'text', 'defaultValue' => 'circle');
|
343 |
$YCD_OPTIONS = apply_filters('ycdCountdownDefaultOptions', $options);
|
344 |
}
|
345 |
|
346 |
+
public static function getDefaultValuesData()
|
347 |
+
{
|
348 |
self::optionsValues();
|
349 |
global $YCD_OPTIONS;
|
350 |
$currentKeyVal = array();
|
355 |
return $currentKeyVal;
|
356 |
}
|
357 |
|
358 |
+
public static function getDefaultTimezone()
|
359 |
+
{
|
360 |
$timezone = get_option('timezone_string');
|
361 |
if (!$timezone) {
|
362 |
$timezone = 'America/New_York';
|
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:
|
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.0.0
|
6 |
* Author: Adam Skaat
|
7 |
* Author URI: https://edmonsoft.com/countdown
|
8 |
* License: GPLv2
|
helpers/HelperFunctions.php
CHANGED
@@ -1,10 +1,14 @@
|
|
1 |
<?php
|
|
|
2 |
namespace ycd;
|
|
|
3 |
use \SxGeo;
|
4 |
|
5 |
-
class
|
|
|
6 |
|
7 |
-
public static function createAttrs($attrs)
|
|
|
8 |
$attrString = '';
|
9 |
if(!empty($attrs) && isset($attrs)) {
|
10 |
|
@@ -16,7 +20,8 @@ class HelperFunctions {
|
|
16 |
return $attrString;
|
17 |
}
|
18 |
|
19 |
-
public static function getIpAddress()
|
|
|
20 |
if (getenv('HTTP_CLIENT_IP'))
|
21 |
$ipAddress = getenv('HTTP_CLIENT_IP');
|
22 |
else if (getenv('HTTP_X_FORWARDED_FOR'))
|
@@ -35,7 +40,8 @@ class HelperFunctions {
|
|
35 |
return $ipAddress;
|
36 |
}
|
37 |
|
38 |
-
public static function getCountryName($ip)
|
|
|
39 |
require_once(YCD_LIB_PATH.'SxGeo/SxGeo.php');
|
40 |
|
41 |
$SxGeo = new SxGeo(YCD_LIB_PATH.'SxGeo/SxGeo.dat');
|
@@ -44,7 +50,8 @@ class HelperFunctions {
|
|
44 |
return $country;
|
45 |
}
|
46 |
|
47 |
-
public static function createSelectBox($data, $selectedValue, $attrs)
|
|
|
48 |
$selected = '';
|
49 |
$attrString = self::createAttrs($attrs);
|
50 |
|
1 |
<?php
|
2 |
+
|
3 |
namespace ycd;
|
4 |
+
|
5 |
use \SxGeo;
|
6 |
|
7 |
+
class HelperFunction
|
8 |
+
{
|
9 |
|
10 |
+
public static function createAttrs($attrs)
|
11 |
+
{
|
12 |
$attrString = '';
|
13 |
if(!empty($attrs) && isset($attrs)) {
|
14 |
|
20 |
return $attrString;
|
21 |
}
|
22 |
|
23 |
+
public static function getIpAddress()
|
24 |
+
{
|
25 |
if (getenv('HTTP_CLIENT_IP'))
|
26 |
$ipAddress = getenv('HTTP_CLIENT_IP');
|
27 |
else if (getenv('HTTP_X_FORWARDED_FOR'))
|
40 |
return $ipAddress;
|
41 |
}
|
42 |
|
43 |
+
public static function getCountryName($ip)
|
44 |
+
{
|
45 |
require_once(YCD_LIB_PATH.'SxGeo/SxGeo.php');
|
46 |
|
47 |
$SxGeo = new SxGeo(YCD_LIB_PATH.'SxGeo/SxGeo.dat');
|
50 |
return $country;
|
51 |
}
|
52 |
|
53 |
+
public static function createSelectBox($data, $selectedValue, $attrs)
|
54 |
+
{
|
55 |
$selected = '';
|
56 |
$attrString = self::createAttrs($attrs);
|
57 |
|
helpers/TypesNavBar.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ycd;
|
4 |
+
|
5 |
+
class TypesNavBar
|
6 |
+
{
|
7 |
+
public static function render()
|
8 |
+
{
|
9 |
+
ob_start();
|
10 |
+
?>
|
11 |
+
<div id="crontrol-header-ycd-groups">
|
12 |
+
<ul class="nav nav-tab-wrapper">
|
13 |
+
<?php echo self::renderOptions()?>
|
14 |
+
</ul>
|
15 |
+
</div>
|
16 |
+
<?php
|
17 |
+
$content = ob_get_contents();
|
18 |
+
ob_end_clean();
|
19 |
+
|
20 |
+
return $content;
|
21 |
+
}
|
22 |
+
|
23 |
+
private static function renderOptions()
|
24 |
+
{
|
25 |
+
global $YCD_TYPES;
|
26 |
+
$groups = $YCD_TYPES['typesGroupList'];
|
27 |
+
$activeGroupName = self::getActiveGroupName();
|
28 |
+
$url = admin_url('edit.php?post_type='.YCD_COUNTDOWN_POST_TYPE.'&page='.YCD_COUNTDOWN_POST_TYPE);
|
29 |
+
$urls = '';
|
30 |
+
foreach ($groups as $groupKey => $groupTitle) {
|
31 |
+
$activeClass = '';
|
32 |
+
|
33 |
+
if ($activeGroupName == $groupKey) {
|
34 |
+
$activeClass = 'nav-tab-active';
|
35 |
+
}
|
36 |
+
$urls .= '<a href="'.$url.'&ycd_group_name='.$groupKey.'" class="nav-tab '.$activeClass.'">'.$groupTitle.'</a>';
|
37 |
+
}
|
38 |
+
|
39 |
+
return $urls;
|
40 |
+
}
|
41 |
+
|
42 |
+
private static function getActiveGroupName()
|
43 |
+
{
|
44 |
+
$groupName = 'all';
|
45 |
+
if (!empty($_GET['ycd_group_name'])) {
|
46 |
+
$groupName = $_GET['ycd_group_name'];
|
47 |
+
}
|
48 |
+
|
49 |
+
return $groupName;
|
50 |
+
}
|
51 |
+
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: adamskaat
|
|
3 |
Tags: countdown, timer, countdown timer
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 5.6.1
|
6 |
-
Stable tag:
|
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,13 @@ 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 |
= 1.9.9 =
|
71 |
* Fixed countdown activation issue
|
72 |
* Fixed circle countdown
|
3 |
Tags: countdown, timer, countdown timer
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 5.6.1
|
6 |
+
Stable tag: 2.0.0
|
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.0.0 =
|
71 |
+
* Nav bar on the Countdown types section (Coming soon option)
|
72 |
+
* Show on selected user roles
|
73 |
+
* Schedule 1 option bug fixed
|
74 |
+
* Code optimization
|
75 |
+
* Code clean up
|
76 |
+
|
77 |
= 1.9.9 =
|
78 |
* Fixed countdown activation issue
|
79 |
* Fixed circle countdown
|