Countdown, Coming Soon – Countdown & Clock - Version 1.5.1

Version Description

  • Display countdown on all custom post
  • Display countdown on selected custost
  • Code optimization
  • Backend functions improvement
  • Bug fixed
Download this release

Release Info

Developer adamskaat
Plugin Icon 128x128 Countdown, Coming Soon – Countdown & Clock
Version 1.5.1
Comparing to
See all releases

Code changes from version 1.5.0 to 1.5.1

classes/Actions.php CHANGED
@@ -2,6 +2,7 @@
2
  namespace ycd;
3
  use \YcdCountdownOptionsConfig;
4
  use \YcdShowReviewNotice;
 
5
 
6
  class Actions {
7
  public $customPostTypeObj;
@@ -59,7 +60,7 @@ class Actions {
59
  }
60
 
61
  public static function wpHead() {
62
- echo \YcdCountdownConfig::headerScript();
63
  }
64
 
65
  public function userRolesCaps() {
@@ -103,6 +104,11 @@ class Actions {
103
  public function postTypeInit() {
104
  $this->revieNotice();
105
  $this->customPostTypeObj = new RegisterPostType();
 
 
 
 
 
106
  }
107
 
108
  private function revieNotice() {
2
  namespace ycd;
3
  use \YcdCountdownOptionsConfig;
4
  use \YcdShowReviewNotice;
5
+ use \YcdCountdownConfig;
6
 
7
  class Actions {
8
  public $customPostTypeObj;
60
  }
61
 
62
  public static function wpHead() {
63
+ echo YcdCountdownConfig::headerScript();
64
  }
65
 
66
  public function userRolesCaps() {
104
  public function postTypeInit() {
105
  $this->revieNotice();
106
  $this->customPostTypeObj = new RegisterPostType();
107
+ $currentPostType = AdminHelper::getCurrentPostType();
108
+
109
+ if ($currentPostType == YCD_COUNTDOWN_POST_TYPE) {
110
+ YcdCountdownConfig::displaySettings();
111
+ }
112
  }
113
 
114
  private function revieNotice() {
classes/Ajax.php CHANGED
@@ -78,7 +78,7 @@ class Ajax {
78
 
79
  public function select2Ajax() {
80
  check_ajax_referer('ycd_ajax_nonce', 'nonce_ajax');
81
-
82
  $postTypeName = sanitize_text_field($_POST['postType']);
83
  $search = sanitize_text_field($_POST['searchTerm']);
84
 
@@ -110,6 +110,7 @@ class Ajax {
110
 
111
  public function conditionsRow() {
112
  check_ajax_referer('ycd_ajax_nonce', 'nonce');
 
113
  $selectedParams = sanitize_text_field($_POST['selectedParams']);
114
  $conditionId = (int)$_POST['conditionId'];
115
  $childClassName = $_POST['conditionsClassName'];
78
 
79
  public function select2Ajax() {
80
  check_ajax_referer('ycd_ajax_nonce', 'nonce_ajax');
81
+ YcdCountdownConfig::displaySettings();
82
  $postTypeName = sanitize_text_field($_POST['postType']);
83
  $search = sanitize_text_field($_POST['searchTerm']);
84
 
110
 
111
  public function conditionsRow() {
112
  check_ajax_referer('ycd_ajax_nonce', 'nonce');
113
+ YcdCountdownConfig::displaySettings();
114
  $selectedParams = sanitize_text_field($_POST['selectedParams']);
115
  $conditionId = (int)$_POST['conditionId'];
116
  $childClassName = $_POST['conditionsClassName'];
classes/DisplayConditionBuilder.php CHANGED
@@ -5,6 +5,7 @@ class DisplayConditionBuilder extends ConditionBuilder {
5
  public function __construct() {
6
  global $YCD_DISPLAY_SETTINGS_CONFIG;
7
  $configData = $YCD_DISPLAY_SETTINGS_CONFIG;
 
8
  $this->setConfigData($configData);
9
  $this->setNameString('ycd-display-settings');
10
  }
5
  public function __construct() {
6
  global $YCD_DISPLAY_SETTINGS_CONFIG;
7
  $configData = $YCD_DISPLAY_SETTINGS_CONFIG;
8
+
9
  $this->setConfigData($configData);
10
  $this->setNameString('ycd-display-settings');
11
  }
classes/Filters.php CHANGED
@@ -14,6 +14,52 @@ class Filters {
14
  add_filter('post_updated_messages' , array($this, 'updatedMessages'), 10, 1);
15
  add_filter('cron_schedules', array($this, 'cronAddMinutes'), 10, 1);
16
  add_filter('ycdCountdownContent', array($this, 'countdownContent'), 10, 2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  }
18
 
19
  public function countdownContent($content, $obj) {
14
  add_filter('post_updated_messages' , array($this, 'updatedMessages'), 10, 1);
15
  add_filter('cron_schedules', array($this, 'cronAddMinutes'), 10, 1);
16
  add_filter('ycdCountdownContent', array($this, 'countdownContent'), 10, 2);
17
+
18
+ add_filter('ycdConditionsDisplayKeys', array($this, 'addTargetParams'), 1, 1);
19
+ add_filter('ycdConditionsDisplayAttributes', array($this, 'attrsDisplaySettings'), 1, 1);
20
+ }
21
+
22
+ public function attrsDisplaySettings($attrs) {
23
+ require_once YCD_HELPERS_PATH.'AdminHelper.php';
24
+ $allCustomPostTypes = AdminHelper::getAllCustomPosts();
25
+
26
+ // for conditions, to exclude other post types, tags etc.
27
+ if (isset($targetParams['select_role'])) {
28
+ return $targetParams;
29
+ }
30
+
31
+ foreach ($allCustomPostTypes as $customPostType) {
32
+ $attrs['selected_'.$customPostType] = array(
33
+ 'label' => __('Select Post(s)'),
34
+ 'fieldType' => 'select',
35
+ 'fieldAttributes' => array(
36
+ 'data-post-type' => $customPostType,
37
+ 'data-select-type' => 'ajax',
38
+ 'multiple' => 'multiple',
39
+ 'class' => 'ycd-condition-select js-ycd-select',
40
+ 'value' => ''
41
+ )
42
+ );
43
+ }
44
+
45
+ return $attrs;
46
+ }
47
+
48
+ public static function addTargetParams($keys) {
49
+ require_once YCD_HELPERS_PATH.'AdminHelper.php';
50
+ $allCustomPostTypes = AdminHelper::getAllCustomPosts();
51
+
52
+ // for conditions, to exclude other post types, tags etc.
53
+ if (isset($targetParams['select_role'])) {
54
+ return $targetParams;
55
+ }
56
+
57
+ foreach ($allCustomPostTypes as $customPostType) {
58
+ $keys['all_'.$customPostType] = 'All '.ucfirst($customPostType).'s';
59
+ $keys['selected_'.$customPostType] = 'Select '.ucfirst($customPostType).'s';
60
+ }
61
+
62
+ return $keys;
63
  }
64
 
65
  public function countdownContent($content, $obj) {
classes/countdown/Countdown.php CHANGED
@@ -440,7 +440,7 @@ abstract class Countdown {
440
 
441
  public function mainOptions() {
442
  $proLabel = '';
443
-
444
  if (YCD_PKG_VERSION == YCD_FREE_VERSION) {
445
  $proLabel = '<span class="ycd-pro-span"><b>'.__('pro', YCD_TEXT_DOMAIN).'</b></span>';
446
  }
440
 
441
  public function mainOptions() {
442
  $proLabel = '';
443
+
444
  if (YCD_PKG_VERSION == YCD_FREE_VERSION) {
445
  $proLabel = '<span class="ycd-pro-span"><b>'.__('pro', YCD_TEXT_DOMAIN).'</b></span>';
446
  }
config/config.php CHANGED
@@ -1,153 +1,155 @@
1
  <?php
 
2
 
3
  class YcdCountdownConfig {
4
- public static function addDefine($name, $value) {
5
- if(!defined($name)) {
6
- define($name, $value);
7
- }
8
- }
9
 
10
- public static function init() {
11
- self::addDefine('YCD_PREFIX', YCD_FILE_NAME);
12
- self::addDefine('YCD_ADMIN_URL', admin_url());
13
- self::addDefine('YCD_COUNTDOWN_BUILDER_URL', plugins_url().'/'.YCD_FOLDER_NAME.'/');
14
- self::addDefine('YCD_COUNTDOWN_ADMIN_URL', admin_url());
15
- self::addDefine('YCD_COUNTDOWN_URL', plugins_url().'/'.YCD_FOLDER_NAME.'/');
16
- self::addDefine('YCD_COUNTDOWN_ASSETS_URL', YCD_COUNTDOWN_URL.'assets/');
17
- self::addDefine('YCD_COUNTDOWN_CSS_URL', YCD_COUNTDOWN_ASSETS_URL.'css/');
18
- self::addDefine('YCD_COUNTDOWN_JS_URL', YCD_COUNTDOWN_ASSETS_URL.'js/');
19
- self::addDefine('YCD_COUNTDOWN_ADMIN_JS_URL', YCD_COUNTDOWN_JS_URL.'admin/');
20
- self::addDefine('YCD_COUNTDOWN_IMG_URL', YCD_COUNTDOWN_ASSETS_URL.'img/');
21
- self::addDefine('YCD_COUNTDOWN_LIB_URL', YCD_COUNTDOWN_URL.'lib/');
22
- self::addDefine('YCD_COUNTDOWN_PATH', WP_PLUGIN_DIR.'/'.YCD_FOLDER_NAME.'/');
23
- self::addDefine('YCD_CLASSES_PATH', YCD_COUNTDOWN_PATH.'classes/');
24
- self::addDefine('YCD_BLOCKS_PATH', YCD_CLASSES_PATH.'blocks/');
25
- self::addDefine('YCD_DATA_TABLE_PATH', YCD_CLASSES_PATH.'dataTable/');
26
- self::addDefine('YCD_LIB_PATH', YCD_COUNTDOWN_PATH.'lib/');
27
- self::addDefine('YCD_HELPERS_PATH', YCD_COUNTDOWN_PATH.'helpers/');
28
- self::addDefine('YCD_CONFIG_PATH', YCD_COUNTDOWN_PATH.'config/');
29
- self::addDefine('YCD_ASSETS_PATH', YCD_COUNTDOWN_PATH.'/assets/');
30
- self::addDefine('YCD_VIEWS_PATH', YCD_ASSETS_PATH.'views/');
31
- self::addDefine('YCD_VIEWS_MAIN_PATH', YCD_VIEWS_PATH.'main/');
32
- self::addDefine('YCD_PREVIEW_VIEWS_PATH', YCD_VIEWS_PATH.'preview/');
33
- self::addDefine('YCD_CSS_PATH', YCD_ASSETS_PATH.'css/');
34
- self::addDefine('YCD_JS_PATH', YCD_ASSETS_PATH.'js/');
35
- self::addDefine('YCD_COUNTDOWNS_PATH', YCD_CLASSES_PATH.'countdown/');
36
- self::addDefine('YCD_HELPERS_PATH', YCD_COUNTDOWN_PATH.'helpers/');
37
- self::addDefine('YCD_COUNTDOWN_POST_TYPE', 'ycdcountdown');
38
- self::addDefine('YCD_COUNTDOWN_SETTINGS', 'ycdSettings');
39
- self::addDefine('YCD_COUNTDOWN_SUPPORT', 'supports');
40
- self::addDefine('YCD_COUNTDOWN_NEWSLETTER', 'ycdNewsletter');
41
- self::addDefine('YCD_COUNTDOWN_SUBSCRIBERS', 'ycdSubscribers');
42
- self::addDefine('YCD_POSTS_TABLE_NAME', 'posts');
43
- self::addDefine('YCD_COUNTDOWN_SUBSCRIBERS_TABLE', 'ycd_subscribers');
44
- self::addDefine('YCD_COUNTDOWN_WIDGET', 'ycd_countdown_widget');
45
- self::addDefine('YCD_TEXT_DOMAIN', 'ycdCountdown');
46
- self::addDefine('YCD_COUNTDOWN_PRO_URL', 'https://edmonsoft.com/countdown');
47
- self::addDefine('YCD_COUNTDOWN_REVIEW_URL', 'https://wordpress.org/support/plugin/countdown-builder/reviews/?filter=5');
48
- self::addDefine('YCD_PROGRESS_METABOX_KEY', 'ycdMetaboxProgress');
49
- self::addDefine('YCD_PROGRESS_METABOX_TITLE', __('Progress Bar', YCD_TEXT_DOMAIN));
50
- self::addDefine('YCD_COUNTDOWN_MENU_TITLE', 'Countdown & Clock');
51
- self::addDefine('YCD_COUNTDOWN_SUPPORT_URL', 'https://wordpress.org/support/plugin/countdown-builder/');
52
- self::addDefine('YCD_FILTER_REPEAT_INTERVAL', 50);
53
- self::addDefine('YCD_SHOW_REVIEW_PERIOD', 30);
54
- self::addDefine('YCD_PRODUCTS_LIMIT', 1000);
55
- self::addDefine('YCD_CRON_REPEAT_INTERVAL', 1);
56
- self::addDefine('YCD_AJAX_SUCCESS', 1);
57
- self::addDefine('YCD_TABLE_LIMIT', 15);
58
- self::addDefine('YCD_VERSION', 1.5);
59
- self::addDefine('YCD_VERSION_PRO', 1.34);
60
- self::addDefine('YCD_FREE_VERSION', 1);
61
- self::addDefine('YCD_SILVER_VERSION', 2);
62
- self::addDefine('YCD_GOLD_VERSION', 3);
63
- self::addDefine('YCD_PLATINUM_VERSION', 4);
64
- require_once(dirname(__FILE__).'/config-pkg.php');
65
- self::displaySettings();
66
- }
67
 
68
- private static function displaySettings() {
69
- global $YCD_DISPLAY_SETTINGS_CONFIG;
70
- $keys = array(
71
- 'select_settings' => 'Select settings',
72
- 'everywhere' => 'Everywhere',
73
- 'selected_post' => 'Select posts',
74
- 'all_post' => 'All posts',
75
- 'selected_page' => 'Select pages',
76
- 'all_page' => 'All pages',
77
- );
78
 
79
- $values = array(
80
- 'key1' => $keys,
81
- 'key2' => array('is' => 'Is', 'isnot' => 'Is not'),
82
- 'selected_post' => array(),
83
- 'all_post' => array(),
84
- 'selected_page' => array(),
85
- 'all_page' => array(),
86
- 'everywhere' => array()
87
- );
88
 
89
- $attributes = array(
90
- 'key1' => array(
91
- 'label' => __('Select Conditions'),
92
- 'fieldType' => 'select',
93
- 'fieldAttributes' => array(
94
- 'class' => 'ycd-condition-select js-ycd-select js-conditions-param',
95
- 'value' => ''
96
- )
97
- ),
98
- 'key2' => array(
99
- 'label' => __('Select Conditions'),
100
- 'fieldType' => 'select',
101
- 'fieldAttributes' => array(
102
- 'class' => 'ycd-condition-select js-ycd-select',
103
- 'value' => ''
104
- )
105
- ),
106
- 'selected_post' => array(
107
- 'label' => __('Select Post(s)'),
108
- 'fieldType' => 'select',
109
- 'fieldAttributes' => array(
110
- 'data-post-type' => 'post',
111
- 'data-select-type' => 'ajax',
112
- 'multiple' => 'multiple',
113
- 'class' => 'ycd-condition-select js-ycd-select',
114
- 'value' => ''
115
- )
116
- ),
117
- 'selected_page' => array(
118
- 'label' => __('Select Page(s)'),
119
- 'fieldType' => 'select',
120
- 'fieldAttributes' => array(
121
- 'data-post-type' => 'page',
122
- 'data-select-type' => 'ajax',
123
- 'multiple' => 'multiple',
124
- 'class' => 'ycd-condition-select js-ycd-select',
125
- 'value' => ''
126
- )
127
- ),
128
- );
129
 
130
- $keys = apply_filters('ycdConditionsDisplayKeys', $keys);
131
- $values = apply_filters('ycdConditionsDisplayValues', $values);
132
- $attributes = apply_filters('ycdConditionsDisplayAttributes', $attributes);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
 
134
- $YCD_DISPLAY_SETTINGS_CONFIG = array(
135
- 'keys' => $keys,
136
- 'values' => $values,
137
- 'attributes' => $attributes
138
- );
139
- }
140
 
141
- public static function getVersionString() {
142
- $version = 'YCD_VERSION='.YCD_VERSION;
143
- if(YCD_PKG_VERSION > YCD_FREE_VERSION) {
144
- $version = 'YCD_VERSION_PRO=' . YCD_VERSION_PRO.";";
145
- }
 
146
 
147
- return $version;
148
- }
 
 
 
149
 
150
- public static function headerScript() {
 
 
 
151
  $version = self::getVersionString();
152
 
153
  ob_start();
@@ -155,12 +157,12 @@ class YcdCountdownConfig {
155
  <script type="text/javascript">
156
  <?= $version; ?>
157
  </script>
158
- <?php
159
- $content = ob_get_contents();
160
- ob_get_clean();
161
 
162
- return $content;
163
- }
164
  }
165
 
166
  YcdCountdownConfig::init();
1
  <?php
2
+ use ycd\AdminHelper;
3
 
4
  class YcdCountdownConfig {
5
+ public static function addDefine($name, $value) {
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.'/');
15
+ self::addDefine('YCD_COUNTDOWN_ADMIN_URL', admin_url());
16
+ self::addDefine('YCD_COUNTDOWN_URL', plugins_url().'/'.YCD_FOLDER_NAME.'/');
17
+ self::addDefine('YCD_COUNTDOWN_ASSETS_URL', YCD_COUNTDOWN_URL.'assets/');
18
+ self::addDefine('YCD_COUNTDOWN_CSS_URL', YCD_COUNTDOWN_ASSETS_URL.'css/');
19
+ self::addDefine('YCD_COUNTDOWN_JS_URL', YCD_COUNTDOWN_ASSETS_URL.'js/');
20
+ self::addDefine('YCD_COUNTDOWN_ADMIN_JS_URL', YCD_COUNTDOWN_JS_URL.'admin/');
21
+ self::addDefine('YCD_COUNTDOWN_IMG_URL', YCD_COUNTDOWN_ASSETS_URL.'img/');
22
+ self::addDefine('YCD_COUNTDOWN_LIB_URL', YCD_COUNTDOWN_URL.'lib/');
23
+ self::addDefine('YCD_COUNTDOWN_PATH', WP_PLUGIN_DIR.'/'.YCD_FOLDER_NAME.'/');
24
+ self::addDefine('YCD_CLASSES_PATH', YCD_COUNTDOWN_PATH.'classes/');
25
+ self::addDefine('YCD_BLOCKS_PATH', YCD_CLASSES_PATH.'blocks/');
26
+ self::addDefine('YCD_DATA_TABLE_PATH', YCD_CLASSES_PATH.'dataTable/');
27
+ self::addDefine('YCD_LIB_PATH', YCD_COUNTDOWN_PATH.'lib/');
28
+ self::addDefine('YCD_HELPERS_PATH', YCD_COUNTDOWN_PATH.'helpers/');
29
+ self::addDefine('YCD_CONFIG_PATH', YCD_COUNTDOWN_PATH.'config/');
30
+ self::addDefine('YCD_ASSETS_PATH', YCD_COUNTDOWN_PATH.'/assets/');
31
+ self::addDefine('YCD_VIEWS_PATH', YCD_ASSETS_PATH.'views/');
32
+ self::addDefine('YCD_VIEWS_MAIN_PATH', YCD_VIEWS_PATH.'main/');
33
+ self::addDefine('YCD_PREVIEW_VIEWS_PATH', YCD_VIEWS_PATH.'preview/');
34
+ self::addDefine('YCD_CSS_PATH', YCD_ASSETS_PATH.'css/');
35
+ self::addDefine('YCD_JS_PATH', YCD_ASSETS_PATH.'js/');
36
+ self::addDefine('YCD_COUNTDOWNS_PATH', YCD_CLASSES_PATH.'countdown/');
37
+ self::addDefine('YCD_HELPERS_PATH', YCD_COUNTDOWN_PATH.'helpers/');
38
+ self::addDefine('YCD_COUNTDOWN_POST_TYPE', 'ycdcountdown');
39
+ self::addDefine('YCD_COUNTDOWN_SETTINGS', 'ycdSettings');
40
+ self::addDefine('YCD_COUNTDOWN_SUPPORT', 'supports');
41
+ self::addDefine('YCD_COUNTDOWN_NEWSLETTER', 'ycdNewsletter');
42
+ self::addDefine('YCD_COUNTDOWN_SUBSCRIBERS', 'ycdSubscribers');
43
+ self::addDefine('YCD_POSTS_TABLE_NAME', 'posts');
44
+ self::addDefine('YCD_COUNTDOWN_SUBSCRIBERS_TABLE', 'ycd_subscribers');
45
+ self::addDefine('YCD_COUNTDOWN_WIDGET', 'ycd_countdown_widget');
46
+ self::addDefine('YCD_TEXT_DOMAIN', 'ycdCountdown');
47
+ self::addDefine('YCD_COUNTDOWN_PRO_URL', 'https://edmonsoft.com/countdown');
48
+ self::addDefine('YCD_COUNTDOWN_REVIEW_URL', 'https://wordpress.org/support/plugin/countdown-builder/reviews/?filter=5');
49
+ self::addDefine('YCD_PROGRESS_METABOX_KEY', 'ycdMetaboxProgress');
50
+ self::addDefine('YCD_PROGRESS_METABOX_TITLE', __('Progress Bar', YCD_TEXT_DOMAIN));
51
+ self::addDefine('YCD_COUNTDOWN_MENU_TITLE', 'Countdown & Clock');
52
+ self::addDefine('YCD_COUNTDOWN_SUPPORT_URL', 'https://wordpress.org/support/plugin/countdown-builder/');
53
+ self::addDefine('YCD_FILTER_REPEAT_INTERVAL', 50);
54
+ self::addDefine('YCD_SHOW_REVIEW_PERIOD', 30);
55
+ self::addDefine('YCD_PRODUCTS_LIMIT', 1000);
56
+ self::addDefine('YCD_CRON_REPEAT_INTERVAL', 1);
57
+ self::addDefine('YCD_AJAX_SUCCESS', 1);
58
+ self::addDefine('YCD_TABLE_LIMIT', 15);
59
+ self::addDefine('YCD_VERSION_PRO', 1.35);
60
+ self::addDefine('YCD_VERSION', 1.51);
61
+ self::addDefine('YCD_FREE_VERSION', 1);
62
+ self::addDefine('YCD_SILVER_VERSION', 2);
63
+ self::addDefine('YCD_GOLD_VERSION', 3);
64
+ self::addDefine('YCD_PLATINUM_VERSION', 4);
65
+ require_once(dirname(__FILE__).'/config-pkg.php');
66
+ }
 
67
 
68
+ public static function displaySettings() {
 
 
 
 
 
 
 
 
 
69
 
70
+ global $YCD_DISPLAY_SETTINGS_CONFIG;
71
+ $keys = array(
72
+ 'select_settings' => 'Select settings',
73
+ 'everywhere' => 'Everywhere',
74
+ 'selected_post' => 'Select posts',
75
+ 'all_post' => 'All posts',
76
+ 'selected_page' => 'Select pages',
77
+ 'all_page' => 'All pages',
78
+ );
79
 
80
+ $keys = apply_filters('ycdConditionsDisplayKeys', $keys);
81
+
82
+ $values = array(
83
+ 'key1' => $keys,
84
+ 'key2' => array('is' => 'Is', 'isnot' => 'Is not'),
85
+ 'selected_post' => array(),
86
+ 'all_post' => array(),
87
+ 'selected_page' => array(),
88
+ 'all_page' => array(),
89
+ 'everywhere' => array()
90
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
+ $attributes = array(
93
+ 'key1' => array(
94
+ 'label' => __('Select Conditions'),
95
+ 'fieldType' => 'select',
96
+ 'fieldAttributes' => array(
97
+ 'class' => 'ycd-condition-select js-ycd-select js-conditions-param',
98
+ 'value' => ''
99
+ )
100
+ ),
101
+ 'key2' => array(
102
+ 'label' => __('Select Conditions'),
103
+ 'fieldType' => 'select',
104
+ 'fieldAttributes' => array(
105
+ 'class' => 'ycd-condition-select js-ycd-select',
106
+ 'value' => ''
107
+ )
108
+ ),
109
+ 'selected_post' => array(
110
+ 'label' => __('Select Post(s)'),
111
+ 'fieldType' => 'select',
112
+ 'fieldAttributes' => array(
113
+ 'data-post-type' => 'post',
114
+ 'data-select-type' => 'ajax',
115
+ 'multiple' => 'multiple',
116
+ 'class' => 'ycd-condition-select js-ycd-select',
117
+ 'value' => ''
118
+ )
119
+ ),
120
+ 'selected_page' => array(
121
+ 'label' => __('Select Page(s)'),
122
+ 'fieldType' => 'select',
123
+ 'fieldAttributes' => array(
124
+ 'data-post-type' => 'page',
125
+ 'data-select-type' => 'ajax',
126
+ 'multiple' => 'multiple',
127
+ 'class' => 'ycd-condition-select js-ycd-select',
128
+ 'value' => ''
129
+ )
130
+ ),
131
+ );
132
 
133
+ $values = apply_filters('ycdConditionsDisplayValues', $values);
134
+ $attributes = apply_filters('ycdConditionsDisplayAttributes', $attributes);
 
 
 
 
135
 
136
+ $YCD_DISPLAY_SETTINGS_CONFIG = array(
137
+ 'keys' => $keys,
138
+ 'values' => $values,
139
+ 'attributes' => $attributes
140
+ );
141
+ }
142
 
143
+ public static function getVersionString() {
144
+ $version = 'YCD_VERSION='.YCD_VERSION;
145
+ if(YCD_PKG_VERSION > YCD_FREE_VERSION) {
146
+ $version = 'YCD_VERSION_PRO=' . YCD_VERSION_PRO.";";
147
+ }
148
 
149
+ return $version;
150
+ }
151
+
152
+ public static function headerScript() {
153
  $version = self::getVersionString();
154
 
155
  ob_start();
157
  <script type="text/javascript">
158
  <?= $version; ?>
159
  </script>
160
+ <?php
161
+ $content = ob_get_contents();
162
+ ob_get_clean();
163
 
164
+ return $content;
165
+ }
166
  }
167
 
168
  YcdCountdownConfig::init();
countdown-builder.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Countdown builder
4
  * Description: The best countdown plugin
5
- * Version: 1.5.0
6
  * Author: Adam Skaat
7
  * Author URI: https://edmonsoft.com/countdown
8
  * License: GPLv2
2
  /**
3
  * Plugin Name: Countdown builder
4
  * Description: The best countdown plugin
5
+ * Version: 1.5.1
6
  * Author: Adam Skaat
7
  * Author URI: https://edmonsoft.com/countdown
8
  * License: GPLv2
helpers/AdminHelper.php CHANGED
@@ -1049,6 +1049,8 @@ class AdminHelper {
1049
  //lastly check the post_type querystring
1050
  elseif( isset( $_REQUEST['post_type'] ) )
1051
  return sanitize_key( $_REQUEST['post_type'] );
 
 
1052
 
1053
  //we do not know the post type!
1054
  return null;
@@ -1110,4 +1112,20 @@ class AdminHelper {
1110
 
1111
  return $query;
1112
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1113
  }
1049
  //lastly check the post_type querystring
1050
  elseif( isset( $_REQUEST['post_type'] ) )
1051
  return sanitize_key( $_REQUEST['post_type'] );
1052
+ else if (!empty($_GET['post']))
1053
+ return get_post_type($_GET['post']);
1054
 
1055
  //we do not know the post type!
1056
  return null;
1112
 
1113
  return $query;
1114
  }
1115
+
1116
+ public static function getAllCustomPosts()
1117
+ {
1118
+ $args = array(
1119
+ 'public' => true,
1120
+ '_builtin' => false
1121
+ );
1122
+
1123
+ $allCustomPosts = get_post_types($args);
1124
+
1125
+ if(isset($allCustomPosts[YCD_COUNTDOWN_POST_TYPE])) {
1126
+ unset($allCustomPosts[YCD_COUNTDOWN_POST_TYPE]);
1127
+ }
1128
+
1129
+ return $allCustomPosts;
1130
+ }
1131
  }
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: adamskaat
3
  Tags: countdown, timer, countdown timer
4
  Requires at least: 3.8
5
- Tested up to: 5.2.1
6
- Stable tag: 1.5.0
7
  Requires PHP: 5.3
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -64,6 +64,13 @@ You need to select the .zip file, there is no need to extract the zip file, just
64
 
65
 
66
  == Changelog ==
 
 
 
 
 
 
 
67
  = 1.5.0 =
68
  * Clock 3 type improvement
69
  * Bug fixed
2
  Contributors: adamskaat
3
  Tags: countdown, timer, countdown timer
4
  Requires at least: 3.8
5
+ Tested up to: 5.2.2
6
+ Stable tag: 1.5.1
7
  Requires PHP: 5.3
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
64
 
65
 
66
  == Changelog ==
67
+ = 1.5.1 =
68
+ * Display countdown on all custom post
69
+ * Display countdown on selected custost
70
+ * Code optimization
71
+ * Backend functions improvement
72
+ * Bug fixed
73
+
74
  = 1.5.0 =
75
  * Clock 3 type improvement
76
  * Bug fixed