PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 2.2.0
Subscriptions for WooCommerce with Stripe Recurring Payments v2.2.0
2.4.0 2.3.0 2.2.0 2.1.0 2.0.0 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 All 65 releases
← All changes | includes/Admin.php +46 -8 1.3.0 → 2.2.0 View file →
@@ -1,13 +1,19 @@
1 1 <?php
2 2
3 3 namespace SpringDevs\Subscription;
4 4
5 +use SpringDevs\Subscription\Admin\Dashboard;
6 +use SpringDevs\Subscription\Admin\Integrations;
5 7 use SpringDevs\Subscription\Admin\Required;
6 8 use SpringDevs\Subscription\Admin\Links;
9 +use SpringDevs\Subscription\Admin\CancellationFlow;
7 10 use SpringDevs\Subscription\Admin\Menu;
8 11 use SpringDevs\Subscription\Admin\Order as AdminOrder;
12 +use SpringDevs\Subscription\Admin\Plans;
9 13 use SpringDevs\Subscription\Admin\Product;
14 +use SpringDevs\Subscription\Admin\ProductList;
15 +use SpringDevs\Subscription\Admin\ProSettingsFields;
10 16 use SpringDevs\Subscription\Admin\Settings;
11 17 use SpringDevs\Subscription\Admin\Subscriptions;
12 18 use SpringDevs\Subscription\Illuminate\Comments;
13 19
@@ -20,16 +26,38 @@
20 26 * Initialize the class
21 27 */
22 28 public function __construct() {
23 29 $this->dispatch_actions();
24 - new Required();
25 - new Menu();
26 - new Product();
27 - new Subscriptions();
28 - new AdminOrder();
29 - new Comments();
30 - new Settings();
31 - new Links();
30 + if ( ! function_exists( 'is_plugin_active' ) ) {
31 + include_once ABSPATH . 'wp-admin/includes/plugin.php';
32 + }
33 + // Only show required plugins notice if Pro is NOT active
34 + if ( ! is_plugin_active( 'subscription-pro/subscription-pro.php' ) ) {
35 + if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
36 + // Show required notice only, do not load other admin content
37 + new Required();
38 + return;
39 + } else {
40 + new Required();
41 + }
42 + }
43 + // Only load admin content if WooCommerce is active
44 + if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
45 + new Menu();
46 + new Dashboard();
47 + new Plans();
48 + new CancellationFlow();
49 + new Product\Plans();
50 + new Integrations();
51 + new Product();
52 + new ProductList();
53 + new Subscriptions();
54 + new AdminOrder();
55 + new Comments();
56 + new Settings();
57 + new ProSettingsFields();
58 + new Links();
59 + }
32 60 }
33 61
34 62 /**
35 63 * Dispatch and bind actions
@@ -36,6 +64,16 @@
36 64 *
37 65 * @return void
38 66 */
39 67 public function dispatch_actions() {
68 + add_action( 'save_post_product', array( $this, 'flush_gsc_cache' ) );
69 + }
70 +
71 + /**
72 + * Bust the GSC product-exists cache when any product is saved.
73 + *
74 + * @return void
75 + */
76 + public function flush_gsc_cache() {
77 + delete_transient( 'subscrpt_has_enabled_product' );
40 78 }
41 79 }