PluginProbe
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO / trunk
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO vtrunk
1.4.13 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.54 1.3.53 1.3.52 1.3.51 1.3.50 1.3.49 1.3.48 1.3.47 1.3.46 1.3.45 1.3.44 All 176 releases
disco / notice / CompatiblePluginNotice.php

CompatiblePluginNotice.php in Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO trunk, at notice/CompatiblePluginNotice.php

100 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Disco\Notice;
4
5 use Disco\App\Disco;
6
7 class CompatiblePluginNotice {
8
9 public function __construct() {
10 add_action( 'admin_notices', [ $this, 'display_compatible_plugin_notice' ] );
11 }
12
13 /**
14 * Display the compatible plugin notice.
15 *
16 * @return void
17 */
18 public function display_compatible_plugin_notice() {
19 $admin_page = get_current_screen();
20
21 if ( Disco::is_pro() ||
22 ( 'toplevel_page_disco-create-discount' !== $admin_page->id ) ) {
23 return;
24 }
25
26 // List of plugins: 'plugin-folder/plugin-file.php' => 'Display Name'
27 $plugin_list = [
28 'woo-multi-currency/woo-multi-currency.php' => 'CURCY - Multi Currency Plugin',
29 'woocommerce-aelia-currencyswitcher/woocommerce-aelia-currencyswitcher.php' => 'Aelia - Currency Switcher plugin',
30 'woocommerce-currency-switcher/index.php' => 'FOX - Currency Switcher Plugin',
31 'woocommerce-multilingual/wpml-woocommerce.php' => 'WPML plugin',
32 'advanced-custom-fields/acf.php' => 'ACF - Advanced Custom Fields',
33 ];
34
35 $user_id = get_current_user_id();
36 $dismiss = get_user_meta( $user_id, 'disco_compatible_plugin_notice_dismissed', true );
37
38 if ( $dismiss === 'never' ) {
39 return;
40 }
41
42 // Require plugin functions if not loaded yet
43 if ( ! function_exists( 'is_plugin_active' ) ) {
44 require_once ABSPATH . 'wp-admin/includes/plugin.php';
45 }
46
47 // Find active plugins from the list
48 $active_plugins = [];
49 foreach ( $plugin_list as $plugin_file => $plugin_name ) {
50 if ( is_plugin_active( $plugin_file ) ) {
51 $active_plugins[] = $plugin_name;
52 }
53 }
54
55 // If none are active, don't show notice
56 if ( empty( $active_plugins ) ) {
57 return;
58 }
59
60 ?>
61
62 <div class="disco-compatible-plugin-notice-wrapper">
63 <div class="notice notice-info is-dismissible disco-compatible-plugin-notice">
64 <img class="disco-notice-icon" src="<?php echo esc_url( plugins_url( 'assets/img/disco-notice-icon.svg', DISCO_PLUGIN_ABSOLUTE ) ); ?>" alt="Disco Logo">
65 <div class="disco-compatible-plugin-wrapper">
66 <h1 class="disco-compatible-plugin-notice-title">
67 Disco Pro is <span class="disco-plugin-special-text">compatible</span> with your installed plugin
68 </h1>
69 <div class="disco-compatible-plugin-items-wrapper">
70 <?php
71 foreach ( $active_plugins as $plugin_name ) {
72 ?>
73 <span class="disco-compatible-plugin-name-item">
74 <img class="disco-compatible-check-icon" src="<?php echo esc_url( plugins_url( 'assets/img/compatible-notice-icon.svg', DISCO_PLUGIN_ABSOLUTE ) ); ?>" alt="Compatible check Icon">
75 <?php echo esc_html( $plugin_name ); ?>
76 </span>
77 <?php
78 }
79 ?>
80 </div>
81 <div class="disco-compatible-plugin-message">Boost your store’s power with advanced features, enjoy smooth plugin compatibility, and unlock the full potential of Disco Pro.</div>
82 <div class="disco-compatible-plugin-buttons">
83 <a href="https://discoplugin.com/?utm_source=Side_Banner&utm_medium=Banner&utm_campaign=Free-to-Pro&utm_id=1" target="_blank" class="disco-compatible-button disco-notice-primary-button">
84 <img class="disco-compatible-plugin-icon" src="<?php echo esc_url( plugins_url( 'assets/img/disco-pro-crown-icon.svg', DISCO_PLUGIN_ABSOLUTE ) ); ?>" alt="Disco Logo">
85 Get Disco Pro
86 </a>
87 <a href="https://discoplugin.com/docs/" target="_blank" class="disco-notice-secondary-button disco-compatible-button">
88 Learn More
89 <img class="disco-compatible-plugin-icon" src="<?php echo esc_url( plugins_url( 'assets/img/disco-learn-more-icon.svg', DISCO_PLUGIN_ABSOLUTE ) ); ?>" alt="Disco learn More Icon">
90 </a>
91 </div>
92 </div>
93 </div>
94 </div>
95
96 <?php
97 }
98
99 }
100