PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 2.7.0
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v2.7.0
2.7.0 2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 All 43 releases
← All changes | includes/admin/class-notices.php +44 -3 1.2.22.7.0 View file →
@@ -5,8 +5,9 @@
5 5 /**
6 6 * Components class.
7 7 *
8 8 * @since 1.1.0
9 + * @SuppressWarnings(PHPMD.NPathComplexity)
9 10 */
10 11 class Sellkit_Notices {
11 12
12 13 /**
@@ -17,17 +18,42 @@
17 18 public function __construct() {
18 19 $this->load_notices();
19 20
20 21 add_action( 'wp_ajax_sellkit_admin_notice_dismiss', [ $this, 'dismiss_notice' ] );
22 + add_action( 'wp_ajax_sellkit_admin_notice_maybe_later', [ $this, 'handle_maybe_later_rating_btn' ] );
21 23 }
22 24
23 25 /**
26 + * Handle maybe later button.
27 + *
28 + * @since 1.5.7
29 + * @return void
30 + */
31 + public function handle_maybe_later_rating_btn() {
32 + check_ajax_referer( 'sellkit_admin', 'nonce' );
33 +
34 + sellkit_update_option( 'sellkit_rating_notice_trigger', time() + 48 * 60 * 60 );
35 + wp_send_json_success( esc_html__( 'The operation was successful.', 'sellkit' ) );
36 + }
37 +
38 + /**
24 39 * Load notices.
25 40 *
26 41 * @since 1.1.0
42 + * @param string $plugin_name Plugin name.
27 43 */
28 - public function load_notices() {
29 - $path = trailingslashit( sellkit()->plugin_dir() . 'includes/admin/notices' );
44 + public function load_notices( $plugin_name = 'sellkit' ) {
45 + $path = trailingslashit( sellkit()->plugin_dir() . 'includes/admin/notices' );
46 +
47 + if (
48 + 'sellkit-pro' === $plugin_name &&
49 + sellkit()->has_pro &&
50 + file_exists( sellkit_pro()->plugin_dir() . 'includes/admin/notices/notice-base.php' )
51 + ) {
52 + $path = trailingslashit( sellkit_pro()->plugin_dir() . 'includes/admin/notices' );
53 + require_once sellkit_pro()->plugin_dir() . 'includes/admin/notices/notice-base.php';
54 + }
55 +
30 56 $file_paths = glob( $path . '*.php' );
31 57
32 58 foreach ( $file_paths as $file_path ) {
33 59 if ( ! file_exists( $file_path ) ) {
@@ -38,10 +64,17 @@
38 64
39 65 $file_name = str_replace( '.php', '', basename( $file_path ) );
40 66 $operator_class = str_replace( '-', ' ', $file_name );
41 67 $operator_class = str_replace( ' ', '_', ucwords( $operator_class ) );
42 - $operator_class = "Sellkit\Admin\Notices\\{$operator_class}";
43 68
69 + if ( 'sellkit' === $plugin_name ) {
70 + $operator_class = "Sellkit\Admin\Notices\\{$operator_class}";
71 + }
72 +
73 + if ( 'sellkit-pro' === $plugin_name && sellkit()->has_pro ) {
74 + $operator_class = "Sellkit_Pro\Admin\Notices\\{$operator_class}";
75 + }
76 +
44 77 if ( ! class_exists( $operator_class ) || 'notice-base' === $file_name ) {
45 78 continue;
46 79 }
47 80
@@ -50,8 +83,12 @@
50 83 if ( $notice->is_valid() ) {
51 84 add_action( 'admin_notices', [ $notice, 'notice_content_wrapper' ], $notice->priority() );
52 85 }
53 86 }
87 +
88 + if ( sellkit()->has_pro && 'sellkit' === $plugin_name ) {
89 + $this->load_notices( 'sellkit-pro' );
90 + }
54 91 }
55 92
56 93 /**
57 94 * Dismiss notice handler.
@@ -66,8 +103,12 @@
66 103 $dismissed_notices = empty( $dismissed_notices ) ? [] : $dismissed_notices;
67 104 $new_dismissed_notices = array_merge( $dismissed_notices, [ $new_notice_key ] );
68 105
69 106 sellkit_update_option( 'dismissed_notices', array_filter( array_unique( $new_dismissed_notices ) ) );
107 +
108 + if ( 'sellkit-partners-theme-offer' === $new_notice_key ) {
109 + update_option( 'sellkit-partner-offer-theme-dismissed', time() );
110 + }
70 111 }
71 112 }
72 113
73 114 new Sellkit_Notices();