PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / trunk
Subscriptions for WooCommerce with Stripe Recurring Payments vtrunk
1.11.2 1.11.1 1.11.0 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.6 1.9.5 trunk 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 All 60 releases
subscription / includes / Admin / Required.php

Required.php in Subscriptions for WooCommerce with Stripe Recurring Payments trunk, at includes/Admin/Required.php

62 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SpringDevs\Subscription\Admin;
4
5 /**
6 * Install & Activate required plugins
7 *
8 * Class Required
9 */
10 class Required {
11
12 private $plugin_file = true;
13
14 public function __construct() {
15 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
16 add_action( 'init', array( $this, 'check_plugins' ) );
17 }
18
19 public function check_plugins() {
20 if ( ! function_exists( 'is_plugin_active' ) ) {
21 include_once ABSPATH . 'wp-admin/includes/plugin.php';
22 }
23
24 $plugin_file = WP_PLUGIN_DIR . '/woocommerce/woocommerce.php';
25
26 if ( ! file_exists( $plugin_file ) ) {
27 $this->plugin_file = false;
28 }
29
30 if ( ! file_exists( $plugin_file ) || ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
31 add_action( 'admin_notices', array( $this, 'install_plugin_notice' ) );
32 }
33 }
34
35 public function enqueue_assets() {
36 if ( ! wp_style_is( 'sdevs_installer' ) ) {
37 wp_enqueue_style( 'sdevs_installer' );
38 }
39
40 if ( ! wp_script_is( 'sdevs_installer' ) ) {
41 wp_enqueue_script( 'sdevs_installer' );
42 wp_localize_script(
43 'sdevs_installer',
44 'sdevs_installer_helper_obj',
45 array( 'ajax_url' => admin_url( 'admin-ajax.php' ) )
46 );
47 }
48 }
49
50 public function install_plugin_notice() {
51 if ( $this->plugin_file ) {
52 $id = 'sdevs-activate-plugin';
53 $label = __( 'Activate Woocommerce', 'subscription' );
54 } else {
55 $id = 'sdevs-install-plugin';
56 $label = __( 'Install Woocommerce', 'subscription' );
57 }
58
59 include 'views/required-notice.php';
60 }
61 }
62