PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.2.1
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.2.1
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
← All changes | vendor/codeinwp/themeisle-sdk/src/Modules/Notification.php +10 -46 3.10.03.2.1 View file →
@@ -83,9 +83,9 @@
83 83 }
84 84 $notification_html = self::get_notification_html( $notification_details );
85 85 do_action( $notification_details['id'] . '_before_render' );
86 86
87 - echo $notification_html; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, already escaped internally.
87 + echo $notification_html;
88 88
89 89 do_action( $notification_details['id'] . '_after_render' );
90 90 self::render_snippets();
91 91 }
@@ -225,9 +225,9 @@
225 225
226 226 /**
227 227 * Get last notification details.
228 228 *
229 - * @return int Last notification details.
229 + * @return array Last notification details.
230 230 */
231 231 private static function get_last_active_notification_timestamp() {
232 232 $notification = self::get_notifications_metadata();
233 233
@@ -268,12 +268,11 @@
268 268 ],
269 269 ],
270 270 ];
271 271 $notification_details = wp_parse_args( $notification_details, $default );
272 - global $pagenow;
273 - $notification_details['ctas']['cancel']['link'] = wp_nonce_url( add_query_arg( [ 'nid' => $notification_details['id'] ], admin_url( $pagenow ) ), $notification_details['id'], 'tsdk_dismiss_nonce' );
274 - $notification_html = '<div class="notice notice-success is-dismissible themeisle-sdk-notice" data-notification-id="' . esc_attr( $notification_details['id'] ) . '" id="' . esc_attr( $notification_details['id'] ) . '-notification"> <div class="themeisle-sdk-notification-box">';
275 272
273 + $notification_html = '<div class="notice notice-success is-dismissible themeisle-sdk-notice" data-notification-id="' . esc_attr( $notification_details['id'] ) . '" id="' . esc_attr( $notification_details['id'] ) . '-notification"> <div class="themeisle-sdk-notification-box">';
274 +
276 275 if ( ! empty( $notification_details['heading'] ) ) {
277 276 $notification_html .= sprintf( '<h4>%s</h4>', wp_kses_post( $notification_details['heading'] ) );
278 277 }
279 278 if ( ! empty( $notification_details['message'] ) ) {
@@ -340,16 +339,14 @@
340 339 }
341 340 $.post(
342 341 ajaxurl,
343 342 {
344 - 'nonce': '<?php echo esc_attr( wp_create_nonce( (string) __CLASS__ ) ); ?>',
343 + 'nonce': '<?php echo wp_create_nonce( (string) __CLASS__ ); ?>',
345 344 'action': 'themeisle_sdk_dismiss_notice',
346 345 'id': notification_id,
347 - 'confirm': confirm,
348 - },
349 - ).fail(function() {
350 - location.href = encodeURI(link.attr('href'));
351 - });
346 + 'confirm': confirm
347 + }
348 + );
352 349 if (confirm === 'yes') {
353 350 $(this).trigger('themeisle-sdk:confirmed');
354 351 } else {
355 352 $(this).trigger('themeisle-sdk:canceled');
@@ -354,9 +351,9 @@
354 351 } else {
355 352 $(this).trigger('themeisle-sdk:canceled');
356 353 }
357 354 container.hide();
358 - if (confirm === 'no' || link.attr('href') === '#') {
355 + if (link.attr('href') === '#') {
359 356 return false;
360 357 }
361 358 });
362 359 });
@@ -367,9 +364,9 @@
367 364
368 365 /**
369 366 * Dismiss the notification.
370 367 */
371 - public static function dismiss() {
368 + static function dismiss() {
372 369 check_ajax_referer( (string) __CLASS__, 'nonce' );
373 370
374 371 $id = isset( $_POST['id'] ) ? sanitize_text_field( $_POST['id'] ) : '';
375 372 $confirm = isset( $_POST['confirm'] ) ? sanitize_text_field( $_POST['confirm'] ) : 'no';
@@ -376,42 +373,13 @@
376 373
377 374 if ( empty( $id ) ) {
378 375 wp_send_json( [] );
379 376 }
380 - $ids = wp_list_pluck( self::$notifications, 'id' );
381 - if ( ! in_array( $id, $ids, true ) ) {
382 - wp_send_json( [] );
383 - }
384 377 self::set_last_active_notification_timestamp();
385 378 update_option( $id, $confirm );
386 379 do_action( $id . '_process_confirm', $confirm );
387 380 wp_send_json( [] );
388 381 }
389 - /**
390 - * Dismiss the notification.
391 - */
392 - public static function dismiss_get() {
393 - $is_nonce_dismiss = sanitize_text_field( isset( $_GET['tsdk_dismiss_nonce'] ) ? $_GET['tsdk_dismiss_nonce'] : '' );
394 - if ( strlen( $is_nonce_dismiss ) < 5 ) {
395 - return;
396 - }
397 - $id = sanitize_text_field( isset( $_GET['nid'] ) ? $_GET['nid'] : '' );
398 - if ( empty( $id ) ) {
399 - return;
400 - }
401 - $nonce = wp_verify_nonce( sanitize_text_field( $_GET['tsdk_dismiss_nonce'] ), $id );
402 - if ( $nonce !== 1 ) {
403 - return;
404 - }
405 - $ids = wp_list_pluck( self::$notifications, 'id' );
406 - if ( ! in_array( $id, $ids, true ) ) {
407 - return;
408 - }
409 - $confirm = 'no';
410 - self::set_last_active_notification_timestamp();
411 - update_option( $id, $confirm );
412 - do_action( $id . '_process_confirm', $confirm );
413 - }
414 382
415 383 /**
416 384 * Check if we should load the notification module.
417 385 *
@@ -461,11 +429,8 @@
461 429 *
462 430 * @return Notification Module instance.
463 431 */
464 432 public function load( $product ) {
465 - if ( apply_filters( 'themeisle_sdk_hide_notifications', false ) ) {
466 - return;
467 - }
468 433 $this->product = $product;
469 434
470 435 $notifications = apply_filters( 'themeisle_sdk_registered_notifications', [] );
471 436 $notifications = array_filter(
@@ -483,9 +448,8 @@
483 448 );
484 449 self::$notifications = $notifications;
485 450 add_action( 'admin_notices', array( __CLASS__, 'show_notification' ) );
486 451 add_action( 'wp_ajax_themeisle_sdk_dismiss_notice', array( __CLASS__, 'dismiss' ) );
487 - add_action( 'admin_head', array( __CLASS__, 'dismiss_get' ) );
488 452 add_action( 'admin_head', array( __CLASS__, 'setup_notifications' ) );
489 453
490 454 return $this;
491 455 }