Coming Soon Page & Maintenance Mode by SeedProd - Version 5.1.3

Version Description

  • Tweak - Prepping for upcoming new version
Download this release

Release Info

Developer seedprod
Plugin Icon 128x128 Coming Soon Page & Maintenance Mode by SeedProd
Version 5.1.3
Comparing to
See all releases

Code changes from version 5.1.2 to 5.1.3

README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: seedprod, smub
3
  Donate link: http://www.seedprod.com
4
  Tags: maintenance mode, coming soon page, coming soon, under construction, landing page, launch, maintenance, construction, offline, unavailable, under construction page, launch page
5
  Requires at least: 3.5.1
6
- Tested up to: 5.4
7
- Stable tag: 5.1.2
8
  Text Domain: coming-soon
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -115,6 +115,9 @@ This is always a caching issue. Go to the caching plugin's setting page and clea
115
  4. Design Page
116
 
117
  == Changelog ==
 
 
 
118
  = 5.1.2 =
119
  * Tweak - Escape logo and custom css fields: reported by security researcher (Jinson Varghese Behanan) from the company (Astra Security)
120
 
@@ -242,6 +245,9 @@ This is always a caching issue. Go to the caching plugin's setting page and clea
242
  * Initial Commit
243
 
244
  == Upgrade Notice ==
 
 
 
245
  = 5.1.2 =
246
  * Tweak - Escape logo and custom css fields: reported by security researcher (Jinson Varghese Behanan) from the company (Astra Security)
247
 
3
  Donate link: http://www.seedprod.com
4
  Tags: maintenance mode, coming soon page, coming soon, under construction, landing page, launch, maintenance, construction, offline, unavailable, under construction page, launch page
5
  Requires at least: 3.5.1
6
+ Tested up to: 5.5
7
+ Stable tag: 5.1.3
8
  Text Domain: coming-soon
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
115
  4. Design Page
116
 
117
  == Changelog ==
118
+ = 5.1.3 =
119
+ * Tweak - Prepping for upcoming new version
120
+
121
  = 5.1.2 =
122
  * Tweak - Escape logo and custom css fields: reported by security researcher (Jinson Varghese Behanan) from the company (Astra Security)
123
 
245
  * Initial Commit
246
 
247
  == Upgrade Notice ==
248
+ = 5.1.3 =
249
+ * Tweak - Prepping for upcoming new version
250
+
251
  = 5.1.2 =
252
  * Tweak - Escape logo and custom css fields: reported by security researcher (Jinson Varghese Behanan) from the company (Astra Security)
253
 
coming-soon.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Coming Soon Page, Under Construction & Maintenance Mode by SeedProd
4
  * Plugin URI: http://www.seedprod.com
5
  * Description: The #1 Coming Soon Page, Under Construction & Maintenance Mode plugin for WordPress.
6
- * Version: 5.1.2
7
  * Author: SeedProd
8
  * Author URI: http://www.seedprod.com
9
  * Text Domain: coming-soon
@@ -20,7 +20,7 @@ define('SEED_CSP4_SHORTNAME', 'seed_csp4'); // Used to reference namespace funct
20
  define('SEED_CSP4_SLUG', 'coming-soon/coming-soon.php'); // Used for settings link.
21
  define('SEED_CSP4_TEXTDOMAIN', 'coming-soon'); // Your textdomain
22
  define('SEED_CSP4_PLUGIN_NAME', __('Coming Soon Page & Maintenance Mode by SeedProd', 'coming-soon')); // Plugin Name shows up on the admin settings screen.
23
- define('SEED_CSP4_VERSION', '5.1.2'); // Plugin Version Number. Recommend you use Semantic Versioning http://semver.org/
24
  define('SEED_CSP4_PLUGIN_PATH', plugin_dir_path(__FILE__)); // Example output: /Applications/MAMP/htdocs/wordpress/wp-content/plugins/seed_csp4/
25
  define('SEED_CSP4_PLUGIN_URL', plugin_dir_url(__FILE__)); // Example output: http://localhost:8888/wordpress/wp-content/plugins/seed_csp4/
26
  define('SEED_CSP4_TABLENAME', 'seed_csp4_subscribers');
@@ -69,9 +69,24 @@ register_activation_hook(__FILE__, 'seed_csp4_welcome_screen_activate');
69
  function seed_csp4_welcome_screen_activate()
70
  {
71
  set_transient('_seed_csp4_welcome_screen_activation_redirect', true, 30);
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  }
73
 
74
 
 
 
75
  add_action('admin_init', 'seed_csp4_welcome_screen_do_activation_redirect');
76
  function seed_csp4_welcome_screen_do_activation_redirect()
77
  {
@@ -90,6 +105,7 @@ function seed_csp4_welcome_screen_do_activation_redirect()
90
 
91
  // Redirect to bbPress about page
92
  wp_safe_redirect(add_query_arg(array( 'page' => 'seed_csp4' ), admin_url('admin.php')));
 
93
  }
94
 
95
 
@@ -105,6 +121,7 @@ $seed_csp4_settings = seed_csp4_get_settings();
105
 
106
  require_once(SEED_CSP4_PLUGIN_PATH.'inc/class-seed-csp4.php');
107
  add_action('plugins_loaded', array( 'SEED_CSP4', 'get_instance' ));
 
108
 
109
  if (is_admin()) {
110
  // Admin Only
@@ -168,4 +185,5 @@ function seed_csp4_clear_known_caches($o, $n)
168
  function seed_csp4_admin_upgrade_link($medium = 'link')
169
  {
170
  return apply_filters('seed_csp4_upgrade_link', 'https://www.seedprod.com/ultimate-coming-soon-page-vs-coming-soon-pro/?utm_source=WordPress&utm_medium=' . sanitize_key(apply_filters('seed_csp4_upgrade_link_medium', $medium)) . '&utm_campaign=liteplugin');
171
- }
 
3
  * Plugin Name: Coming Soon Page, Under Construction & Maintenance Mode by SeedProd
4
  * Plugin URI: http://www.seedprod.com
5
  * Description: The #1 Coming Soon Page, Under Construction & Maintenance Mode plugin for WordPress.
6
+ * Version: 5.1.3
7
  * Author: SeedProd
8
  * Author URI: http://www.seedprod.com
9
  * Text Domain: coming-soon
20
  define('SEED_CSP4_SLUG', 'coming-soon/coming-soon.php'); // Used for settings link.
21
  define('SEED_CSP4_TEXTDOMAIN', 'coming-soon'); // Your textdomain
22
  define('SEED_CSP4_PLUGIN_NAME', __('Coming Soon Page & Maintenance Mode by SeedProd', 'coming-soon')); // Plugin Name shows up on the admin settings screen.
23
+ define('SEED_CSP4_VERSION', '5.1.3'); // Plugin Version Number. Recommend you use Semantic Versioning http://semver.org/
24
  define('SEED_CSP4_PLUGIN_PATH', plugin_dir_path(__FILE__)); // Example output: /Applications/MAMP/htdocs/wordpress/wp-content/plugins/seed_csp4/
25
  define('SEED_CSP4_PLUGIN_URL', plugin_dir_url(__FILE__)); // Example output: http://localhost:8888/wordpress/wp-content/plugins/seed_csp4/
26
  define('SEED_CSP4_TABLENAME', 'seed_csp4_subscribers');
69
  function seed_csp4_welcome_screen_activate()
70
  {
71
  set_transient('_seed_csp4_welcome_screen_activation_redirect', true, 30);
72
+
73
+ // set cron to fetch feed
74
+ if (! wp_next_scheduled( 'seedprod_lite_notifications')) {
75
+ wp_schedule_event(time(), 'daily', 'seedprod_lite_notifications');
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Deactivate
81
+ */
82
+ register_deactivation_hook(__FILE__, 'seed_csp4_deactivate');
83
+ function seed_csp4_deactivate(){
84
+ wp_clear_scheduled_hook( 'seedprod_lite_notifications');
85
  }
86
 
87
 
88
+
89
+
90
  add_action('admin_init', 'seed_csp4_welcome_screen_do_activation_redirect');
91
  function seed_csp4_welcome_screen_do_activation_redirect()
92
  {
105
 
106
  // Redirect to bbPress about page
107
  wp_safe_redirect(add_query_arg(array( 'page' => 'seed_csp4' ), admin_url('admin.php')));
108
+
109
  }
110
 
111
 
121
 
122
  require_once(SEED_CSP4_PLUGIN_PATH.'inc/class-seed-csp4.php');
123
  add_action('plugins_loaded', array( 'SEED_CSP4', 'get_instance' ));
124
+ require_once(SEED_CSP4_PLUGIN_PATH.'framework/notifications.php');
125
 
126
  if (is_admin()) {
127
  // Admin Only
185
  function seed_csp4_admin_upgrade_link($medium = 'link')
186
  {
187
  return apply_filters('seed_csp4_upgrade_link', 'https://www.seedprod.com/ultimate-coming-soon-page-vs-coming-soon-pro/?utm_source=WordPress&utm_medium=' . sanitize_key(apply_filters('seed_csp4_upgrade_link_medium', $medium)) . '&utm_campaign=liteplugin');
188
+ }
189
+
framework/framework.php CHANGED
@@ -183,9 +183,17 @@ class SEED_CSP4_ADMIN
183
  */
184
  public function create_menus()
185
  {
 
 
 
 
 
 
 
 
186
  add_menu_page(
187
- __("SeedProd", 'coming-soon'),
188
- __("SeedProd", 'coming-soon'),
189
  'manage_options',
190
  'seed_csp4',
191
  array( &$this , 'option_page' ),
@@ -423,6 +431,77 @@ class SEED_CSP4_ADMIN
423
  Coming Soon Page and Maintenance Mode Lite
424
  <span class="seed_csp4_version" style="font-size: 10px;"> Version <?php echo SEED_CSP4_VERSION; ?></span>
425
  </h1>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
426
 
427
 
428
 
183
  */
184
  public function create_menus()
185
  {
186
+ // get notifications count
187
+ $notification = '';
188
+ $n = new SeedProd_Notifications();
189
+ $notifications_count = $n->get_count();
190
+ if(!empty( $notifications_count)){
191
+ $notification = ' <span class="update-plugins"><span class="plugin-count">'.$notifications_count.'</span></span>';
192
+ }
193
+
194
  add_menu_page(
195
+ "SeedProd",
196
+ "SeedProd".$notification,
197
  'manage_options',
198
  'seed_csp4',
199
  array( &$this , 'option_page' ),
431
  Coming Soon Page and Maintenance Mode Lite
432
  <span class="seed_csp4_version" style="font-size: 10px;"> Version <?php echo SEED_CSP4_VERSION; ?></span>
433
  </h1>
434
+ <?php
435
+ // Get notifications
436
+ $notifications = new SeedProd_Notifications();
437
+ $notifications = $notifications->get();
438
+
439
+ ?>
440
+ <?php foreach ($notifications as $v) { ?>
441
+ <div
442
+ id="sp-notification-<?php echo $v['id'] ?>"
443
+ style="display: flex;background: #fff2ee; margin:20px; border-radius:4px; border: 2px solid #f1460d; color:#f1460d; padding:20px; font-size:16px"
444
+ >
445
+
446
+ <div style="flex-grow:1">
447
+ <div
448
+ style="font-weight:bold; margin-bottom:10px; display:flex; justify-content:space-between"
449
+ >
450
+ <?php echo $v['title'] ?>
451
+ <span
452
+ style="cursor:pointer; width: 20px"
453
+ id="sp-dismiss-<?php echo $v['id'] ?>"
454
+ >
455
+ <svg
456
+ xmlns="http://www.w3.org/2000/svg"
457
+ viewBox="0 0 24 24"
458
+ style="width:18px; fill:#999"
459
+ >
460
+ <path d="M0 0h24v24H0V0z" fill="none" />
461
+ <path
462
+ d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
463
+ />
464
+ </svg>
465
+ </span>
466
+ </div>
467
+ <div style="margin-bottom:10px"><?php echo $v['content'] ?></div>
468
+ <div style="display:flex;justify-content:space-between">
469
+ <div>
470
+ <?php if(!empty($v['btns']['main'])){ ?>
471
+ <a
472
+ href="<?php echo $v['btns']['main']['url'] ?>"
473
+ class="button button-primary"
474
+ style="margin-right:5px"
475
+ target="_blank"
476
+ ><?php echo $v['btns']['main']['text'] ?></a>
477
+ <?php } ?>
478
+ <?php if(!empty($v['btns']['alt'])){ ?>
479
+ <a
480
+
481
+ href="<?php echo $v['btns']['alt']['url'] ?>"
482
+ class="button button-secondary"
483
+ target="_blank"
484
+ ><?php echo $v['btns']['alt']['text'] ?></a>
485
+ <?php } ?>
486
+ </div>
487
+ </div>
488
+ </div>
489
+ </div>
490
+
491
+ <script>
492
+ <?php $ajax_url = html_entity_decode(wp_nonce_url('admin-ajax.php?action=seedprod_lite_notification_dismiss', 'seedprod_lite_notification_dismiss')); ?>
493
+ var seedprod_dismiss_<?php echo $v['id'] ?> = "<?php echo $ajax_url; ?>";
494
+ jQuery( "#sp-dismiss-<?php echo $v['id'] ?>" ).click(function() {
495
+
496
+ jQuery.get( seedprod_dismiss_<?php echo $v['id'] ?>+'&id=<?php echo $v['id'] ?>', function( data ) {
497
+ jQuery( "#sp-notification-<?php echo $v['id'] ?>" ).hide();
498
+ } );
499
+ });
500
+ </script>
501
+ <?php } ?>
502
+
503
+
504
+
505
 
506
 
507
 
framework/notifications.php ADDED
@@ -0,0 +1,435 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Notifications.
5
+ *
6
+ * @since 7.10.5
7
+ */
8
+ if (!class_exists('SeedProd_Notifications')) {
9
+ class SeedProd_Notifications
10
+ {
11
+ protected static $instance = null;
12
+ /**
13
+ * Source of notifications content.
14
+ *
15
+ * @since {VERSION}
16
+ *
17
+ * @var string
18
+ */
19
+ const SOURCE_URL = 'https://seedprod-notifications.s3.amazonaws.com/sp-notifications.json';
20
+
21
+ /**
22
+ * Option value.
23
+ *
24
+ * @since {VERSION}
25
+ *
26
+ * @var bool|array
27
+ */
28
+ public $option = false;
29
+
30
+ /**
31
+ * The name of the option used to store the data.
32
+ *
33
+ * @var string
34
+ */
35
+ public $option_name = 'seedprod_notifications';
36
+
37
+ /**
38
+ * Return an instance of this class.
39
+ */
40
+ public static function get_instance()
41
+ {
42
+
43
+ // If the single instance hasn't been set, set it now.
44
+ if (null == self::$instance) {
45
+ self::$instance = new self;
46
+ }
47
+
48
+ return self::$instance;
49
+ }
50
+
51
+ /**
52
+ * SeedProd_Notifications constructor.
53
+ */
54
+ public function __construct()
55
+ {
56
+ $this->init();
57
+ }
58
+
59
+ /**
60
+ * Initialize class.
61
+ *
62
+ * @since {VERSION}
63
+ */
64
+ public function init()
65
+ {
66
+ $this->hooks();
67
+ }
68
+
69
+ /**
70
+ * Register hooks.
71
+ *
72
+ * @since {VERSION}
73
+ */
74
+ public function hooks()
75
+ {
76
+ add_action('wp_ajax_seedprod_lite_notification_dismiss', array( $this, 'dismiss' ));
77
+ }
78
+
79
+ /**
80
+ * Check if user has access and is enabled.
81
+ *
82
+ * @return bool
83
+ * @since {VERSION}
84
+ *
85
+ */
86
+ public function has_access()
87
+ {
88
+ $access = true;
89
+
90
+ if (current_user_can('install_plugins')) {
91
+ $access = true;
92
+ }
93
+
94
+ return apply_filters('seedprod_admin_notifications_has_access', $access);
95
+ }
96
+
97
+ /**
98
+ * Get option value.
99
+ *
100
+ * @param bool $cache Reference property cache if available.
101
+ *
102
+ * @return array
103
+ * @since {VERSION}
104
+ *
105
+ */
106
+ public function get_option($cache = true)
107
+ {
108
+ if ($this->option && $cache) {
109
+ return $this->option;
110
+ }
111
+
112
+ $option = get_option($this->option_name, array());
113
+
114
+ $this->option = array(
115
+ 'update' => ! empty($option['update']) ? $option['update'] : 0,
116
+ 'events' => ! empty($option['events']) ? $option['events'] : array(),
117
+ 'feed' => ! empty($option['feed']) ? $option['feed'] : array(),
118
+ 'dismissed' => ! empty($option['dismissed']) ? $option['dismissed'] : array(),
119
+ );
120
+
121
+ return $this->option;
122
+ }
123
+
124
+ /**
125
+ * Fetch notifications from feed.
126
+ *
127
+ * @return array
128
+ * @since {VERSION}
129
+ *
130
+ */
131
+ public function fetch_feed()
132
+ {
133
+ $res = wp_remote_get(self::SOURCE_URL);
134
+
135
+ if (is_wp_error($res)) {
136
+ return array();
137
+ }
138
+
139
+ $body = wp_remote_retrieve_body($res);
140
+
141
+ if (empty($body)) {
142
+ return array();
143
+ }
144
+
145
+ return $this->verify(json_decode($body, true));
146
+ }
147
+
148
+ /**
149
+ * Verify notification data before it is saved.
150
+ *
151
+ * @param array $notifications Array of notifications items to verify.
152
+ *
153
+ * @return array
154
+ * @since {VERSION}
155
+ *
156
+ */
157
+ public function verify($notifications)
158
+ { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
159
+
160
+ $data = array();
161
+
162
+ if (! is_array($notifications) || empty($notifications)) {
163
+ return $data;
164
+ }
165
+
166
+ $option = $this->get_option();
167
+
168
+ foreach ($notifications as $notification) {
169
+
170
+ // The message and license should never be empty, if they are, ignore.
171
+ if (empty($notification['content']) || empty($notification['type'])) {
172
+ continue;
173
+ }
174
+
175
+ // Ignore if license type does not match.
176
+
177
+ $license_name = 'unlicensed';
178
+
179
+ if (! in_array('any', $notification['type'])) {
180
+ if (! in_array($license_name, $notification['type'])) {
181
+ continue;
182
+ }
183
+ }
184
+
185
+ // Ignore if expired.
186
+ if (! empty($notification['end']) && time() > strtotime($notification['end'])) {
187
+ continue;
188
+ }
189
+
190
+ // Ignore if notification has already been dismissed.
191
+ if (! empty($option['dismissed']) && in_array($notification['id'], $option['dismissed'])) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
192
+ continue;
193
+ }
194
+
195
+ // Ignore if notification existed before installing SeedProd.
196
+ // Prevents bombarding the user with notifications after activation.
197
+ $over_time = get_option('seedprod_over_time', array());
198
+
199
+ if (
200
+ ! empty($over_time['installed_date']) &&
201
+ ! empty($notification['start']) &&
202
+ $over_time['installed_date'] > strtotime($notification['start'])
203
+ ) {
204
+ //continue;
205
+ }
206
+
207
+ $data[] = $notification;
208
+ }
209
+
210
+ return $data;
211
+ }
212
+
213
+ /**
214
+ * Verify saved notification data for active notifications.
215
+ *
216
+ * @param array $notifications Array of notifications items to verify.
217
+ *
218
+ * @return array
219
+ * @since {VERSION}
220
+ *
221
+ */
222
+ public function verify_active($notifications)
223
+ {
224
+ if (! is_array($notifications) || empty($notifications)) {
225
+ return array();
226
+ }
227
+
228
+ // Remove notifications that are not active.
229
+ foreach ($notifications as $key => $notification) {
230
+ if (
231
+ (! empty($notification['start']) && time() < strtotime($notification['start'])) ||
232
+ (! empty($notification['end']) && time() > strtotime($notification['end']))
233
+ ) {
234
+ unset($notifications[ $key ]);
235
+ }
236
+ }
237
+
238
+ return $notifications;
239
+ }
240
+
241
+ /**
242
+ * Get notification data.
243
+ *
244
+ * @return array
245
+ * @since {VERSION}
246
+ *
247
+ */
248
+ public function get()
249
+ {
250
+ if (! $this->has_access()) {
251
+ return array();
252
+ }
253
+
254
+ $option = $this->get_option();
255
+
256
+ $events = ! empty($option['events']) ? $this->verify_active($option['events']) : array();
257
+ $feed = ! empty($option['feed']) ? $this->verify_active($option['feed']) : array();
258
+
259
+ return array_merge($events, $feed);
260
+ }
261
+
262
+ /**
263
+ * Get notification count.
264
+ *
265
+ * @return int
266
+ * @since {VERSION}
267
+ *
268
+ */
269
+ public function get_count()
270
+ {
271
+ $count = count($this->get());
272
+
273
+ return $count;
274
+ }
275
+
276
+ /**
277
+ * Add a manual notification event.
278
+ *
279
+ * @param array $notification Notification data.
280
+ *
281
+ * @since {VERSION}
282
+ *
283
+ */
284
+ public function add($notification)
285
+ {
286
+ if (empty($notification['id'])) {
287
+ return;
288
+ }
289
+
290
+ $option = $this->get_option();
291
+
292
+ if (in_array($notification['id'], $option['dismissed'])) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
293
+ return;
294
+ }
295
+
296
+ foreach ($option['events'] as $item) {
297
+ if ($item['id'] === $notification['id']) {
298
+ return;
299
+ }
300
+ }
301
+
302
+ $notification = $this->verify(array( $notification ));
303
+
304
+ update_option(
305
+ $this->option_name,
306
+ array(
307
+ 'update' => $option['update'],
308
+ 'feed' => $option['feed'],
309
+ 'events' => array_merge($notification, $option['events']),
310
+ 'dismissed' => $option['dismissed'],
311
+ )
312
+ );
313
+ }
314
+
315
+ /**
316
+ * Update notification data from feed.
317
+ *
318
+ * @since {VERSION}
319
+ */
320
+ public function update()
321
+ {
322
+ $feed = $this->fetch_feed();
323
+ $option = $this->get_option();
324
+
325
+ update_option(
326
+ $this->option_name,
327
+ array(
328
+ 'update' => time(),
329
+ 'feed' => $feed,
330
+ 'events' => $option['events'],
331
+ 'dismissed' => $option['dismissed'],
332
+ )
333
+ );
334
+ }
335
+
336
+ /**
337
+ * Dismiss notification via AJAX.
338
+ *
339
+ * @since {VERSION}
340
+ */
341
+ public function dismiss()
342
+ {
343
+
344
+ // Run a security check.
345
+ check_ajax_referer('seedprod_lite_notification_dismiss', '_wpnonce');
346
+
347
+ // Check for access and required param.
348
+ if (! $this->has_access() || empty($_REQUEST['id'])) {
349
+ wp_send_json_error();
350
+ }
351
+
352
+ $id = sanitize_text_field(wp_unslash($_REQUEST['id']));
353
+ $option = $this->get_option();
354
+ $type = is_numeric($id) ? 'feed' : 'events';
355
+
356
+ $option['dismissed'][] = $id;
357
+ $option['dismissed'] = array_unique($option['dismissed']);
358
+
359
+ // Remove notification.
360
+ if (is_array($option[ $type ]) && ! empty($option[ $type ])) {
361
+ foreach ($option[ $type ] as $key => $notification) {
362
+ if ($notification['id'] == $id) { // phpcs:ignore WordPress.PHP.StrictComparisons
363
+ unset($option[ $type ][ $key ]);
364
+ break;
365
+ }
366
+ }
367
+ }
368
+
369
+ update_option($this->option_name, $option);
370
+
371
+ wp_send_json_success();
372
+ }
373
+
374
+ /**
375
+ * This generates the markup for the notifications indicator if needed.
376
+ *
377
+ * @return string
378
+ */
379
+ public function get_menu_count()
380
+ {
381
+ if ($this->get_count() > 0) {
382
+ return '<span class="seedprod-menu-notification-indicator"></span>';
383
+ }
384
+
385
+ return '';
386
+ }
387
+
388
+ /**
389
+ * Retrieve the notifications via an ajax call.
390
+ */
391
+ public function ajax_get_notifications()
392
+ {
393
+
394
+ // Run a security check.
395
+ check_ajax_referer('sp-admin-nonce', 'nonce');
396
+
397
+ $notifications_data = array(
398
+ 'notifications' => $this->get(),
399
+ 'view_url' => $this->get_view_url(),
400
+ );
401
+
402
+ wp_send_json_success($notifications_data);
403
+ }
404
+
405
+ /**
406
+ * Get the URL for the page where users can see/read notifications.
407
+ *
408
+ * @return string
409
+ */
410
+ public function get_view_url()
411
+ {
412
+ $disabled = get_option('dashboards_disabled', false);
413
+
414
+ $url = add_query_arg('page', 'seedprod_reports', admin_url('admin.php'));
415
+
416
+ if (false !== $disabled) {
417
+ $url = is_multisite() ? network_admin_url('admin.php?page=seedprod_network') : admin_url('admin.php?page=seedprod_settings');
418
+ }
419
+
420
+ return $url;
421
+ }
422
+ }
423
+ }
424
+
425
+ //add_action( 'seedprod_notification', array( 'SeedProd_Notifications', 'update' ) );
426
+ if (!function_exists('seedprod_lite_do_notifications')) {
427
+
428
+ add_action('seedprod_lite_notifications', 'seedprod_lite_do_notifications');
429
+ function seedprod_lite_do_notifications()
430
+ {
431
+ $notifications = new SeedProd_Notifications();
432
+ $notifications ->update();
433
+
434
+ }
435
+ }
framework/settings-style.css CHANGED
@@ -89,19 +89,18 @@ font-size: 16px;
89
  }
90
 
91
  .seed_csp4_quicklinks_menu_list{
92
- display: flex;
93
  flex-direction: column;
94
  align-items: flex-end;
95
  position: relative;
96
  right: 14px;
97
  opacity: 0;
98
- visibility: hidden;
99
  transition: all 0.2s ease-out;
100
  }
101
 
102
  #seed_csp4_quicklinks.active .seed_csp4_quicklinks_menu_list{
103
  opacity: 1;
104
- visibility: visible;
105
  transition: all 0.2s ease-out;
106
  }
107
 
89
  }
90
 
91
  .seed_csp4_quicklinks_menu_list{
 
92
  flex-direction: column;
93
  align-items: flex-end;
94
  position: relative;
95
  right: 14px;
96
  opacity: 0;
97
+ display: none;
98
  transition: all 0.2s ease-out;
99
  }
100
 
101
  #seed_csp4_quicklinks.active .seed_csp4_quicklinks_menu_list{
102
  opacity: 1;
103
+ display: flex;
104
  transition: all 0.2s ease-out;
105
  }
106
 
inc/config-settings.php CHANGED
@@ -12,6 +12,7 @@
12
  */
13
  function seed_csp4_get_options(){
14
 
 
15
  /**
16
  * Create new menus
17
  */
12
  */
13
  function seed_csp4_get_options(){
14
 
15
+
16
  /**
17
  * Create new menus
18
  */