← All changes
|
vendor/codeinwp/themeisle-sdk/src/Modules/Notification.php
+8
-1
3.1.3
→
3.4.4
View file →
| @@ -225,9 +225,9 @@ | ||
| 225 | 225 | |
| 226 | 226 | /** |
| 227 | 227 | * Get last notification details. |
| 228 | 228 | * |
| 229 | - * @return array Last notification details. | |
| 229 | + * @return int Last notification details. | |
| 230 | 230 | */ |
| 231 | 231 | private static function get_last_active_notification_timestamp() { |
| 232 | 232 | $notification = self::get_notifications_metadata(); |
| 233 | 233 | |
| @@ -373,8 +373,12 @@ | ||
| 373 | 373 | |
| 374 | 374 | if ( empty( $id ) ) { |
| 375 | 375 | wp_send_json( [] ); |
| 376 | 376 | } |
| 377 | + $ids = wp_list_pluck( self::$notifications, 'id' ); | |
| 378 | + if ( ! in_array( $id, $ids, true ) ) { | |
| 379 | + wp_send_json( [] ); | |
| 380 | + } | |
| 377 | 381 | self::set_last_active_notification_timestamp(); |
| 378 | 382 | update_option( $id, $confirm ); |
| 379 | 383 | do_action( $id . '_process_confirm', $confirm ); |
| 380 | 384 | wp_send_json( [] ); |
| @@ -429,8 +433,11 @@ | ||
| 429 | 433 | * |
| 430 | 434 | * @return Notification Module instance. |
| 431 | 435 | */ |
| 432 | 436 | public function load( $product ) { |
| 437 | + if ( apply_filters( 'themeisle_sdk_hide_notifications', false ) ) { | |
| 438 | + return; | |
| 439 | + } | |
| 433 | 440 | $this->product = $product; |
| 434 | 441 | |
| 435 | 442 | $notifications = apply_filters( 'themeisle_sdk_registered_notifications', [] ); |
| 436 | 443 | $notifications = array_filter( |