Event Calendar WD – Responsive Event Calendar plugin - Version 1.1.7

Version Description

  • New: Option to set zoom level in maps view (Pro)
  • Fixed: Map displayed without any event for that month (Pro)
  • Changed: Minor: WD library updated to version 1.0.12
Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 Event Calendar WD – Responsive Event Calendar plugin
Version 1.1.7
Comparing to
See all releases

Code changes from version 1.1.6 to 1.1.7

Files changed (5) hide show
  1. ecwd.php +2 -2
  2. readme.txt +9 -4
  3. wd/README.md +1 -1
  4. wd/includes/notices.php +170 -170
  5. wd/wd.php +1 -1
ecwd.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Event Calendar WD
4
  * Plugin URI: https://web-dorado.com/products/wordpress-event-calendar-wd.html
5
  * Description: Event Calendar WD is an easy event management and planning tool with advanced features.
6
- * Version: 1.1.6
7
  * Author: WebDorado
8
  * Author URI: https://web-dorado.com
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -24,7 +24,7 @@ if (!defined('ECWD_URL')) {
24
  }
25
 
26
  if (!defined('ECWD_VERSION')) {
27
- define('ECWD_VERSION', "1.1.6");
28
  }
29
 
30
  if (!defined('ECWD_PLUGIN_MAIN_FILE')) {
3
  * Plugin Name: Event Calendar WD
4
  * Plugin URI: https://web-dorado.com/products/wordpress-event-calendar-wd.html
5
  * Description: Event Calendar WD is an easy event management and planning tool with advanced features.
6
+ * Version: 1.1.7
7
  * Author: WebDorado
8
  * Author URI: https://web-dorado.com
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
24
  }
25
 
26
  if (!defined('ECWD_VERSION')) {
27
+ define('ECWD_VERSION', "1.1.7");
28
  }
29
 
30
  if (!defined('ECWD_PLUGIN_MAIN_FILE')) {
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: webdorado,wdsupport
3
  Donate link: https://web-dorado.com/products/wordpress-event-calendar-wd.html
4
  Tags: calendar, date, event, event calendar, events, events calendar, meeting, organizer, recurring, reservation, responsive, schedule
5
  Requires at least: 3.9
6
- Tested up to: 4.8
7
- Stable tag: 1.1.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -86,7 +86,7 @@ Since each events calendar entry is created as a custom post or taxonomy, there
86
 
87
 
88
  ###IMPORTANT:
89
- If you think you found a bug in Event Calendar WD, or have a problem/question concerning the plugin, please check out [Support Forum](https://wordpress.org/support/plugin/event-calendar-wd) on our website. In case you do not find a solution here, feel free to contact us using [this form](https://web-dorado.com/support/contact-us.html).
90
 
91
 
92
 
@@ -247,8 +247,13 @@ After downloading the ZIP file of the Event Calendar WD plugin,
247
 
248
  == Changelog ==
249
 
 
 
 
 
 
250
  = 1.1.6 =
251
- * Fixed: Conflict with some plugins on calendar frontend
252
 
253
  = 1.1.5 =
254
  * Changed: Show notification to install Backup WD plugin only on plugin pages.
3
  Donate link: https://web-dorado.com/products/wordpress-event-calendar-wd.html
4
  Tags: calendar, date, event, event calendar, events, events calendar, meeting, organizer, recurring, reservation, responsive, schedule
5
  Requires at least: 3.9
6
+ Tested up to: 4.9
7
+ Stable tag: 1.1.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
86
 
87
 
88
  ###IMPORTANT:
89
+ If you think you found a bug in Event Calendar WD, or have a problem/question concerning the plugin, please check out [Support Forum](https://wordpress.org/support/plugin/event-calendar-wd) . In case you do not find a solution here, feel free to contact us using [this form](https://web-dorado.com/support/contact-us.html).
90
 
91
 
92
 
247
 
248
  == Changelog ==
249
 
250
+ = 1.1.7 =
251
+ * New: Option to set zoom level in maps view (Pro)
252
+ * Fixed: Map displayed without any event for that month (Pro)
253
+ * Changed: Minor: WD library updated to version 1.0.12
254
+
255
  = 1.1.6 =
256
+ * Fixed: Conflict with some plugins on calendar frontend
257
 
258
  = 1.1.5 =
259
  * Changed: Show notification to install Backup WD plugin only on plugin pages.
wd/README.md CHANGED
@@ -1,4 +1,4 @@
1
- Version: 1.0.11
2
 
3
 
4
 
1
+ Version: 1.0.12
2
 
3
 
4
 
wd/includes/notices.php CHANGED
@@ -1,96 +1,96 @@
1
  <?php
2
- if ( !defined( 'ABSPATH' ) ) {
3
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
 
6
- class DoradoWebNotices {
7
-
8
- protected $promo_link = '';
9
-
10
- public $config;
11
- public $notice_spam = 0;
12
- public $notice_spam_max = 2;
13
-
14
- // Basic actions to run
15
- public function __construct( $config = array() ) {
16
- $this->config = $config;
17
- // Runs the admin notice ignore function incase a dismiss button has been clicked
18
- add_action( 'admin_init', array( $this, 'admin_notice_ignore' ) );
19
- // Runs the admin notice temp ignore function incase a temp dismiss link has been clicked
20
- add_action( 'admin_init', array( $this, 'admin_notice_temp_ignore' ) );
21
- add_action( 'admin_notices', array( $this, 'wd_admin_notices' ) );
22
  }
 
 
23
 
24
- // Checks to ensure notices aren't disabled and the user has the correct permissions.
25
- public function wd_admin_notice() {
26
- $wd_options = $this->config;
27
- $settings = get_option($wd_options->prefix . '_admin_notice');
28
- if ( !isset( $settings['disable_admin_notices'] ) || ( isset( $settings['disable_admin_notices'] ) && $settings['disable_admin_notices'] == 0 ) ) {
29
- if ( current_user_can( 'manage_options' ) ) {
30
- return true;
31
- }
32
- }
33
  return false;
34
  }
35
-
36
- // Primary notice function that can be called from an outside function sending necessary variables
37
- public function admin_notice( $admin_notices ) {
38
- $wd_options = $this->config;
39
- // Check options
40
- if ( !$this->wd_admin_notice() ) {
41
  return false;
42
  }
43
- foreach ( $admin_notices as $slug => $admin_notice ) {
44
- // Call for spam protection
45
- if ( $this->anti_notice_spam() ) {
 
46
  return false;
47
  }
 
48
 
49
- // Check for proper page to display on
50
- if (isset( $admin_notices[$slug]['pages']) && is_array( $admin_notices[$slug]['pages'])) {
51
- if ( !$this->admin_notice_pages( $admin_notices[$slug]['pages'] ) ) {
52
- return false;
53
- }
54
- }
55
 
56
- // Check for required fields
57
- if ( !$this->required_fields( $admin_notices[$slug] ) ) {
58
-
59
- // Get the current date then set start date to either passed value or current date value and add interval
60
- $current_date = current_time( "n/j/Y" );
61
- $start = ( isset( $admin_notices[$slug]['start'] ) ? $admin_notices[$slug]['start'] : $current_date );
62
- $start = date( "n/j/Y", strtotime( $start ) );
63
- $date_array = explode( '/', $start );
64
- $interval = ( isset( $admin_notices[$slug]['int'] ) ? $admin_notices[$slug]['int'] : 0 );
65
-
66
- $date_array[1] += $interval;
67
- $start = date( "n/j/Y", mktime( 0, 0, 0, $date_array[0], $date_array[1], $date_array[2] ) );
68
-
69
- // This is the main notices storage option
70
- $admin_notices_option = get_option( $wd_options->prefix . '_admin_notice', array() );
71
- // Check if the message is already stored and if so just grab the key otherwise store the message and its associated date information
72
- if ( !array_key_exists( $slug, $admin_notices_option ) ) {
73
- $admin_notices_option[$slug]['start'] = $start;
74
- $admin_notices_option[$slug]['int'] = $interval;
75
- update_option( $wd_options->prefix . '_admin_notice', $admin_notices_option );
76
- }
77
 
78
- // Sanity check to ensure we have accurate information
79
- // New date information will not overwrite old date information
80
- $admin_display_check = ( isset( $admin_notices_option[$slug]['dismissed'] ) ? $admin_notices_option[$slug]['dismissed'] : 0 );
81
- $admin_display_start = ( isset( $admin_notices_option[$slug]['start'] ) ? $admin_notices_option[$slug]['start'] : $start );
82
- $admin_display_interval = ( isset($admin_notices_option[$slug]['int'] ) ? $admin_notices_option[$slug]['int'] : $interval );
83
- $admin_display_msg = ( isset($admin_notices[$slug]['msg'] ) ? $admin_notices[$slug]['msg'] : '' );
84
- $admin_display_title = ( isset($admin_notices[$slug]['title'] ) ? $admin_notices[$slug]['title'] : '' );
85
- $admin_display_link = ( isset( $admin_notices[$slug]['link'] ) ? $admin_notices[$slug]['link'] : '' );
86
- $output_css = false;
87
-
88
- // Ensure the notice hasn't been hidden and that the current date is after the start date
89
- if ( $admin_display_check == 0 && strtotime($admin_display_start) <= strtotime($current_date ) ) {
90
-
91
- // Get remaining query string
92
- $query_str = ( isset( $admin_notices[$slug]['later_link'] ) ? $admin_notices[$slug]['later_link'] : esc_url(add_query_arg( $wd_options->prefix . '_admin_notice_ignore', $slug ) ) );
93
- if ( strpos($slug, 'promo' ) === FALSE ) {
 
 
 
 
 
 
 
 
 
 
 
 
94
  // Admin notice display output
95
  echo '<div class="update-nag wd-admin-notice">
96
  <div class="wd-notice-logo" style="background-image: url(' . $wd_options->wd_url_img . '/' . $wd_options->prefix . '_main_plugin.png);"></div>
@@ -99,8 +99,8 @@
99
  <ul class="wd-notice-body wd-blue">' . $admin_display_link . '</ul>
100
  <a href="' . $query_str . '" class="dashicons dashicons-dismiss"></a>
101
  </div>';
102
- }
103
- else {
104
  echo '<div class="admin-notice-promo">';
105
  echo $admin_display_msg;
106
  echo '<ul class="notice-body-promo blue">
@@ -108,116 +108,116 @@
108
  </ul>';
109
  echo '<a href="' . $query_str . '" class="dashicons dashicons-dismiss close-promo"></a>';
110
  echo '</div>';
111
- }
112
- $this->notice_spam += 1;
113
- $output_css = true;
114
- }
115
- if ( $output_css ) {
116
- wp_enqueue_style( $wd_options->prefix . '-admin-notices', $wd_options->wd_url_css . '/notices.css', array(), get_option($wd_options->prefix . "_version" ) );
117
  }
 
 
 
 
 
118
  }
119
  }
120
  }
 
121
 
122
- // Spam protection check
123
- public function anti_notice_spam() {
124
- if ( $this->notice_spam >= $this->notice_spam_max ) {
125
- return true;
126
- }
127
- return false;
128
  }
 
 
129
 
130
- // Ignore function that gets ran at admin init to ensure any messages that were dismissed get marked
131
- public function admin_notice_ignore() {
132
- $wd_options = $this->config;
133
- // If user clicks to ignore the notice, update the option to not show it again
134
- if ( isset( $_GET[$wd_options->prefix . '_admin_notice_ignore'] ) ) {
135
- $admin_notices_option = get_option( $wd_options->prefix . '_admin_notice', array() );
136
- $admin_notices_option[$_GET[$wd_options->prefix . '_admin_notice_ignore']]['dismissed'] = 1;
137
- update_option( $wd_options->prefix . '_admin_notice', $admin_notices_option );
138
- $query_str = remove_query_arg( $wd_options->prefix . '_admin_notice_ignore' );
139
- wp_redirect( $query_str );
140
- exit;
141
- }
142
  }
 
143
 
144
- // Temp Ignore function that gets ran at admin init to ensure any messages that were temp dismissed get their start date changed
145
- public function admin_notice_temp_ignore() {
146
- $wd_options = $this->config;
147
- // If user clicks to temp ignore the notice, update the option to change the start date - default interval of 14 days
148
- if ( isset( $_GET[$wd_options->prefix . '_admin_notice_temp_ignore'] ) ) {
149
- $admin_notices_option = get_option( $wd_options->prefix . '_admin_notice', array() );
150
- $current_date = current_time( "n/j/Y" );
151
- $date_array = explode( '/', $current_date );
152
- $interval = (isset($_GET['wd_int']) ? $_GET['wd_int'] : 14);
153
- $date_array[1] += $interval;
154
- $new_start = date( "n/j/Y", mktime( 0, 0, 0, $date_array[0], $date_array[1], $date_array[2] ) );
155
-
156
- $admin_notices_option[$_GET[$wd_options->prefix . '_admin_notice_temp_ignore']]['start'] = $new_start;
157
- $admin_notices_option[$_GET[$wd_options->prefix . '_admin_notice_temp_ignore']]['dismissed'] = 0;
158
- update_option( $wd_options->prefix . '_admin_notice', $admin_notices_option );
159
- $query_str = remove_query_arg( array( $wd_options->prefix . '_admin_notice_temp_ignore', 'wd_int' ) );
160
- wp_redirect( $query_str );
161
- exit;
162
- }
163
  }
 
164
 
165
- public function admin_notice_pages($pages) {
166
- $wd_options = $this->config;
167
- foreach ( $pages as $key => $page ) {
168
- if (is_array($page)) {
169
- if ( isset( $_GET['page'] ) && $_GET['page'] == $page[0] && isset($_GET['tab']) && $_GET['tab'] == $page[1] ) {
170
- return true;
171
- }
172
- }
173
- else {
174
- if ( $page == 'all' ) {
175
- return true;
176
- }
177
- if ( get_current_screen()->id === $page ) {
178
- return true;
179
- }
180
- if ( isset($_GET['page']) && $_GET['page'] == $page ) {
181
- return true;
182
- }
183
  }
184
- return false;
185
  }
186
- }
187
-
188
- // Required fields check
189
- public function required_fields( $fields ) {
190
- if ( !isset( $fields['msg'] ) || ( isset($fields['msg'] ) && empty( $fields['msg'] ) ) ) {
191
- return true;
192
- }
193
- if ( !isset( $fields['title'] ) || ( isset( $fields['title'] ) && empty( $fields['title'] ) ) ) {
194
- return true;
 
195
  }
196
  return false;
197
  }
 
198
 
199
- // Special parameters function that is to be used in any extension of this class
200
- public function special_parameters($admin_notices) {
201
- // Intentionally left blank
 
 
 
 
202
  }
 
 
203
 
204
- public function wd_admin_notices() {
205
- $wd_options = $this->config;
206
- $two_week_review_ignore = add_query_arg( array( $wd_options->prefix . '_admin_notice_ignore' => 'two_week_review' ) );
207
- $two_week_review_temp = add_query_arg( array( $wd_options->prefix . '_admin_notice_temp_ignore' => 'two_week_review', 'int' => 14 ) );
208
- $promo_close = add_query_arg( array( $wd_options->prefix . '_admin_notice_ignore' => 'ecommerce_promo' ) );
209
 
210
- $notices['two_week_review'] = array(
211
- 'title' => __('Leave A Review?', $wd_options->prefix),
212
- 'msg' => sprintf(__('We hope you\'ve enjoyed using WordPress %s! Would you consider leaving us a review on WordPress.org?', $wd_options->prefix), $wd_options->plugin_title),
213
- 'link' => '<li><span class="dashicons dashicons-external"></span><a href="https://wordpress.org/support/view/plugin-reviews/' . $wd_options->plugin_wordpress_slug . '?filter=5" target="_blank">' . __('Sure! I\'d love to!', $wd_options->prefix) . '</a></li>
 
 
 
 
 
 
214
  <li><span class="dashicons dashicons-smiley"></span><a href="' . $two_week_review_ignore . '"> ' . __('I\'ve already left a review', $wd_options->prefix) . '</a></li>
215
  <li><span class="dashicons dashicons-calendar-alt"></span><a href="' . $two_week_review_temp . '">' . __('Maybe Later', $wd_options->prefix) . '</a></li>
216
  <li><span class="dashicons dashicons-dismiss"></span><a href="' . $two_week_review_ignore . '">' . __('Never show again', $wd_options->prefix) . '</a></li>',
217
- 'later_link' => $two_week_review_temp,
218
- 'int' => 14
219
- );
220
-
221
- $this->admin_notice($notices);
222
- }
223
  }
 
1
  <?php
2
+ if ( !defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ class DoradoWebNotices {
7
+
8
+ protected $promo_link = '';
9
+
10
+ public $config;
11
+ public $notice_spam = 0;
12
+ public $notice_spam_max = 2;
13
+
14
+ // Basic actions to run
15
+ public function __construct( $config = array() ) {
16
+ $this->config = $config;
17
+ // Runs the admin notice ignore function incase a dismiss button has been clicked
18
+ add_action( 'admin_init', array( $this, 'admin_notice_ignore' ) );
19
+ // Runs the admin notice temp ignore function incase a temp dismiss link has been clicked
20
+ add_action( 'admin_init', array( $this, 'admin_notice_temp_ignore' ) );
21
+ add_action( 'admin_notices', array( $this, 'wd_admin_notices' ) );
22
  }
23
 
24
+ // Checks to ensure notices aren't disabled and the user has the correct permissions.
25
+ public function wd_admin_notice() {
26
+ $wd_options = $this->config;
27
+ $settings = get_option($wd_options->prefix . '_admin_notice');
28
+ if ( !isset( $settings['disable_admin_notices'] ) || ( isset( $settings['disable_admin_notices'] ) && $settings['disable_admin_notices'] == 0 ) ) {
29
+ if ( current_user_can( 'manage_options' ) ) {
30
+ return true;
31
+ }
 
 
 
 
 
 
 
 
32
  }
33
+ return false;
34
+ }
35
 
36
+ // Primary notice function that can be called from an outside function sending necessary variables
37
+ public function admin_notice( $admin_notices ) {
38
+ $wd_options = $this->config;
39
+ // Check options
40
+ if ( !$this->wd_admin_notice() ) {
 
 
 
 
41
  return false;
42
  }
43
+ foreach ( $admin_notices as $slug => $admin_notice ) {
44
+ // Call for spam protection
45
+ if ( $this->anti_notice_spam() ) {
 
 
 
46
  return false;
47
  }
48
+
49
+ // Check for proper page to display on
50
+ if (isset( $admin_notices[$slug]['pages']) && is_array( $admin_notices[$slug]['pages'])) {
51
+ if ( !$this->admin_notice_pages( $admin_notices[$slug]['pages'] ) ) {
52
  return false;
53
  }
54
+ }
55
 
56
+ // Check for required fields
57
+ if ( !$this->required_fields( $admin_notices[$slug] ) ) {
 
 
 
 
58
 
59
+ // Get the current date then set start date to either passed value or current date value and add interval
60
+ $current_date = current_time( "n/j/Y" );
61
+ $start = ( isset( $admin_notices[$slug]['start'] ) ? $admin_notices[$slug]['start'] : $current_date );
62
+ $start = date( "n/j/Y", strtotime( $start ) );
63
+ $date_array = explode( '/', $start );
64
+ $interval = ( isset( $admin_notices[$slug]['int'] ) ? $admin_notices[$slug]['int'] : 0 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
+ $date_array[1] += $interval;
67
+ $start = date( "n/j/Y", mktime( 0, 0, 0, $date_array[0], $date_array[1], $date_array[2] ) );
68
+
69
+ // This is the main notices storage option
70
+ $admin_notices_option = get_option( $wd_options->prefix . '_admin_notice', array() );
71
+ // Check if the message is already stored and if so just grab the key otherwise store the message and its associated date information
72
+ if ( !array_key_exists( $slug, $admin_notices_option ) ) {
73
+ $admin_notices_option[$slug]['start'] = $start;
74
+ $admin_notices_option[$slug]['int'] = $interval;
75
+ update_option( $wd_options->prefix . '_admin_notice', $admin_notices_option );
76
+ }
77
+
78
+ // Sanity check to ensure we have accurate information
79
+ // New date information will not overwrite old date information
80
+ $admin_display_check = ( isset( $admin_notices_option[$slug]['dismissed'] ) ? $admin_notices_option[$slug]['dismissed'] : 0 );
81
+ $admin_display_start = ( isset( $admin_notices_option[$slug]['start'] ) ? $admin_notices_option[$slug]['start'] : $start );
82
+ $admin_display_interval = ( isset($admin_notices_option[$slug]['int'] ) ? $admin_notices_option[$slug]['int'] : $interval );
83
+ $admin_display_msg = ( isset($admin_notices[$slug]['msg'] ) ? $admin_notices[$slug]['msg'] : '' );
84
+ $admin_display_title = ( isset($admin_notices[$slug]['title'] ) ? $admin_notices[$slug]['title'] : '' );
85
+ $admin_display_link = ( isset( $admin_notices[$slug]['link'] ) ? $admin_notices[$slug]['link'] : '' );
86
+ $output_css = false;
87
+
88
+ // Ensure the notice hasn't been hidden and that the current date is after the start date
89
+ if ( $admin_display_check == 0 && strtotime($admin_display_start) <= strtotime($current_date ) ) {
90
+
91
+ // Get remaining query string
92
+ $query_str = ( isset( $admin_notices[$slug]['later_link'] ) ? $admin_notices[$slug]['later_link'] : esc_url(add_query_arg( $wd_options->prefix . '_admin_notice_ignore', $slug ) ) );
93
+ if ( strpos($slug, 'promo' ) === FALSE ) {
94
  // Admin notice display output
95
  echo '<div class="update-nag wd-admin-notice">
96
  <div class="wd-notice-logo" style="background-image: url(' . $wd_options->wd_url_img . '/' . $wd_options->prefix . '_main_plugin.png);"></div>
99
  <ul class="wd-notice-body wd-blue">' . $admin_display_link . '</ul>
100
  <a href="' . $query_str . '" class="dashicons dashicons-dismiss"></a>
101
  </div>';
102
+ }
103
+ else {
104
  echo '<div class="admin-notice-promo">';
105
  echo $admin_display_msg;
106
  echo '<ul class="notice-body-promo blue">
108
  </ul>';
109
  echo '<a href="' . $query_str . '" class="dashicons dashicons-dismiss close-promo"></a>';
110
  echo '</div>';
 
 
 
 
 
 
111
  }
112
+ $this->notice_spam += 1;
113
+ $output_css = true;
114
+ }
115
+ if ( $output_css ) {
116
+ wp_enqueue_style( $wd_options->prefix . '-admin-notices', $wd_options->wd_url_css . '/notices.css', array(), get_option($wd_options->prefix . "_version" ) );
117
  }
118
  }
119
  }
120
+ }
121
 
122
+ // Spam protection check
123
+ public function anti_notice_spam() {
124
+ if ( $this->notice_spam >= $this->notice_spam_max ) {
125
+ return true;
 
 
126
  }
127
+ return false;
128
+ }
129
 
130
+ // Ignore function that gets ran at admin init to ensure any messages that were dismissed get marked
131
+ public function admin_notice_ignore() {
132
+ $wd_options = $this->config;
133
+ // If user clicks to ignore the notice, update the option to not show it again
134
+ if ( isset( $_GET[$wd_options->prefix . '_admin_notice_ignore'] ) ) {
135
+ $admin_notices_option = get_option( $wd_options->prefix . '_admin_notice', array() );
136
+ $admin_notices_option[$_GET[$wd_options->prefix . '_admin_notice_ignore']]['dismissed'] = 1;
137
+ update_option( $wd_options->prefix . '_admin_notice', $admin_notices_option );
138
+ $query_str = remove_query_arg( $wd_options->prefix . '_admin_notice_ignore' );
139
+ wp_redirect( $query_str );
140
+ exit;
 
141
  }
142
+ }
143
 
144
+ // Temp Ignore function that gets ran at admin init to ensure any messages that were temp dismissed get their start date changed
145
+ public function admin_notice_temp_ignore() {
146
+ $wd_options = $this->config;
147
+ // If user clicks to temp ignore the notice, update the option to change the start date - default interval of 14 days
148
+ if ( isset( $_GET[$wd_options->prefix . '_admin_notice_temp_ignore'] ) ) {
149
+ $admin_notices_option = get_option( $wd_options->prefix . '_admin_notice', array() );
150
+ $current_date = current_time( "n/j/Y" );
151
+ $date_array = explode( '/', $current_date );
152
+ $interval = (isset($_GET['wd_int']) ? $_GET['wd_int'] : 14);
153
+ $date_array[1] += $interval;
154
+ $new_start = date( "n/j/Y", mktime( 0, 0, 0, $date_array[0], $date_array[1], $date_array[2] ) );
155
+
156
+ $admin_notices_option[$_GET[$wd_options->prefix . '_admin_notice_temp_ignore']]['start'] = $new_start;
157
+ $admin_notices_option[$_GET[$wd_options->prefix . '_admin_notice_temp_ignore']]['dismissed'] = 0;
158
+ update_option( $wd_options->prefix . '_admin_notice', $admin_notices_option );
159
+ $query_str = remove_query_arg( array( $wd_options->prefix . '_admin_notice_temp_ignore', 'wd_int' ) );
160
+ wp_redirect( $query_str );
161
+ exit;
 
162
  }
163
+ }
164
 
165
+ public function admin_notice_pages($pages) {
166
+ $wd_options = $this->config;
167
+ foreach ( $pages as $key => $page ) {
168
+ if (is_array($page)) {
169
+ if ( isset( $_GET['page'] ) && $_GET['page'] == $page[0] && isset($_GET['tab']) && $_GET['tab'] == $page[1] ) {
170
+ return true;
 
 
 
 
 
 
 
 
 
 
 
 
171
  }
 
172
  }
173
+ else {
174
+ if ( $page == 'all' ) {
175
+ return true;
176
+ }
177
+ if ( get_current_screen()->id === $page ) {
178
+ return true;
179
+ }
180
+ if ( isset($_GET['page']) && $_GET['page'] == $page ) {
181
+ return true;
182
+ }
183
  }
184
  return false;
185
  }
186
+ }
187
 
188
+ // Required fields check
189
+ public function required_fields( $fields ) {
190
+ if ( !isset( $fields['msg'] ) || ( isset($fields['msg'] ) && empty( $fields['msg'] ) ) ) {
191
+ return true;
192
+ }
193
+ if ( !isset( $fields['title'] ) || ( isset( $fields['title'] ) && empty( $fields['title'] ) ) ) {
194
+ return true;
195
  }
196
+ return false;
197
+ }
198
 
199
+ // Special parameters function that is to be used in any extension of this class
200
+ public function special_parameters($admin_notices) {
201
+ // Intentionally left blank
202
+ }
 
203
 
204
+ public function wd_admin_notices() {
205
+ $wd_options = $this->config;
206
+ $two_week_review_ignore = add_query_arg( array( $wd_options->prefix . '_admin_notice_ignore' => 'two_week_review' ) );
207
+ $two_week_review_temp = add_query_arg( array( $wd_options->prefix . '_admin_notice_temp_ignore' => 'two_week_review', 'int' => 14 ) );
208
+ $promo_close = add_query_arg( array( $wd_options->prefix . '_admin_notice_ignore' => 'ecommerce_promo' ) );
209
+
210
+ $notices['two_week_review'] = array(
211
+ 'title' => __('Leave A Review?', $wd_options->prefix),
212
+ 'msg' => sprintf(__('We hope you\'ve enjoyed using WordPress %s! Would you consider leaving us a review on WordPress.org?', $wd_options->prefix), $wd_options->plugin_title),
213
+ 'link' => '<li><span class="dashicons dashicons-external"></span><a href="https://wordpress.org/support/plugin/' . $wd_options->plugin_wordpress_slug . '/reviews?filter=5&rate=5#new-post" target="_blank">' . __('Sure! I\'d love to!', $wd_options->prefix) . '</a></li>
214
  <li><span class="dashicons dashicons-smiley"></span><a href="' . $two_week_review_ignore . '"> ' . __('I\'ve already left a review', $wd_options->prefix) . '</a></li>
215
  <li><span class="dashicons dashicons-calendar-alt"></span><a href="' . $two_week_review_temp . '">' . __('Maybe Later', $wd_options->prefix) . '</a></li>
216
  <li><span class="dashicons dashicons-dismiss"></span><a href="' . $two_week_review_ignore . '">' . __('Never show again', $wd_options->prefix) . '</a></li>',
217
+ 'later_link' => $two_week_review_temp,
218
+ 'int' => 14
219
+ );
220
+
221
+ $this->admin_notice($notices);
 
222
  }
223
+ }
wd/wd.php CHANGED
@@ -17,7 +17,7 @@
17
  public $overview_instance;
18
  public $subscribe_instance;
19
  public $config;
20
- private $version = "1.0.11";
21
 
22
  ////////////////////////////////////////////////////////////////////////////////////////
23
  // Constructor & Destructor //
17
  public $overview_instance;
18
  public $subscribe_instance;
19
  public $config;
20
+ private $version = "1.0.12";
21
 
22
  ////////////////////////////////////////////////////////////////////////////////////////
23
  // Constructor & Destructor //