PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 1.1.4
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v1.1.4
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
sellkit / includes / admin / notices / woocommerce-not-installed.php

woocommerce-not-installed.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster 1.1.4, at includes/admin/notices/woocommerce-not-installed.php

109 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Sellkit\Admin\Notices;
4
5 defined( 'ABSPATH' ) || die();
6
7 /**
8 * Woocommerce not installed.
9 *
10 * @since 1.1.0
11 */
12 class Woocommerce_Not_Installed extends Notice_Base {
13
14 /**
15 * Notice key.
16 *
17 * @since 1.1.0
18 * @var string
19 */
20 public $key = 'sellkit-woocommerce-not-installed';
21
22 /**
23 * Construct of class.
24 *
25 * @since 1.1.0
26 */
27 public function __construct() {
28 parent::__construct();
29
30 $this->assets();
31
32 $this->content = $this->content_html();
33 $this->buttons = [];
34 }
35
36 /**
37 * Enqueue required assets because these won't be loaded if Woocommerce is not installed.
38 *
39 * @since 1.1.0
40 */
41 public function assets() {
42 if ( ! $this->is_valid() ) {
43 return;
44 }
45
46 add_action( 'admin_enqueue_scripts', function() {
47 wp_enqueue_style(
48 'sellkit-admin-notices-woo',
49 sellkit()->plugin_url() . 'assets/dist/css/admin.min.css',
50 [],
51 sellkit()->version()
52 );
53
54 wp_enqueue_script(
55 'sellkit-admin-notice-woo',
56 sellkit()->plugin_url() . 'assets/dist/js/admin.min.js',
57 [ 'jquery' ],
58 sellkit()->version(),
59 true
60 );
61 } );
62 }
63
64 /**
65 * Check if notice is valid or not.
66 *
67 * @since 1.1.0
68 * @return bool
69 */
70 public function is_valid() {
71 if ( class_exists( 'woocommerce' ) ) {
72 return false;
73 }
74
75 return true;
76 }
77
78 /**
79 * Content of notice.
80 *
81 * @since 1.1.0
82 */
83 public function content_html() {
84 $message = sprintf(
85 '<span>'
86 . '<h3>'
87 . esc_html__( 'Welcome to Sellkit', 'sellkit' )
88 . '</h3>'
89 /* Translators: 1: bold sellkit 2: bold woocommerce */
90 . esc_html__( 'The %1$s plugin requires the %2$s plugin to be installed & activated as well.', 'sellkit' )
91 . '</span>',
92 '<b>Sellkit</b>',
93 '<b>WooCommerce</b>'
94 );
95
96 return $message;
97 }
98
99 /**
100 * Set the priority of notice.
101 *
102 * @since 1.1.0
103 * @return int
104 */
105 public function priority() {
106 return 1;
107 }
108 }
109