PluginProbe
EmailKit – Email Customizer for WooCommerce & WP / 1.2.0
EmailKit – Email Customizer for WooCommerce & WP v1.2.0
1.6.9 1.6.8 1.6.7 trunk 1.0.0 1.2.0 1.4.0 1.4.5 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6
emailkit / includes / Admin / Dependency.php

Dependency.php in EmailKit – Email Customizer for WooCommerce & WP 1.2.0, at includes/Admin/Dependency.php

54 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Emailkit\Admin;
3
4 use EmailKit;
5
6 defined("ABSPATH") || exit;
7
8 class Dependency {
9
10 public function __construct()
11 {
12 add_action('admin_init', array($this, 'check'));
13 }
14
15 public function check() {
16 $error = false;
17
18 // check woocommerce plugin
19 if(!did_action('woocommerce_loaded')) {
20 add_action('admin_notices', [$this, 'missing_woocommerce']);
21
22 $error = true;
23 }
24
25 if($error) {
26 return;
27 }
28 }
29
30 public function missing_woocommerce() {
31
32 if(file_exists(WP_PLUGIN_DIR . '/woocommerce/woocommerce.php')) {
33
34 $btn['label'] = esc_html__('Activate WooCommerce', 'emailkit');
35 $btn['url'] = wp_nonce_url('plugins.php?action=activate&plugin=woocommerce/woocommerce.php&plugin_status=all&paged=1', 'activate-plugin_woocommerce/woocommerce.php');
36
37 } else {
38
39 $btn['label'] = esc_html__('Install WooCommerce', 'emailkit');
40 $btn['url'] = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=woocommerce'), 'install-plugin_woocommerce');
41 }
42
43 EmailKit\Admin\Emails\Helpers\Notice\Notice::push(
44 [
45 'id' => 'missing-woo',
46 'type' => 'error',
47 'dismissible' => true,
48 'is_required' => true,
49 'btn' => $btn,
50 'message' => sprintf(esc_html__('Emailkit requires woocommerce Plugin, which is currently NOT RUNNING.', 'emailkit'))
51 ]
52 );
53 }
54 }