Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/tutor-pro/addons/subscription/src/Subscription.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 + /**
3 + * Subscription Main Class
4 + *
5 + * @package TutorPro\Subscription
6 + * @author Themeum <support@themeum.com>
7 + * @link https://themeum.com
8 + * @since 3.0.0
9 + */
10 +
11 + namespace TutorPro\Subscription;
12 +
13 + use TUTOR\Addons;
14 + use TUTOR\Singleton;
15 + use TutorPro\Subscription\Controllers\SubscriptionPlanController;
16 + use TutorPro\Subscription\Controllers\FrontendController;
17 + use TutorPro\Subscription\Controllers\CronController;
18 + use TutorPro\Subscription\Controllers\EmailController;
19 + use TutorPro\Subscription\Controllers\InvoiceController;
20 + use TutorPro\Subscription\Controllers\ManualSubscriptionController;
21 + use TutorPro\Subscription\Controllers\MembershipController;
22 + use TutorPro\Subscription\Controllers\PlanCheckoutController;
23 + use TutorPro\Subscription\Controllers\ReportController;
24 + use TutorPro\Subscription\Controllers\SubscriptionController;
25 + use TutorPro\Subscription\Controllers\SubscriptionListController;
26 +
27 + if ( ! defined( 'ABSPATH' ) ) {
28 + exit;
29 + }
30 +
31 + /**
32 + * Class Subscription
33 + *
34 + * @since 3.0.0
35 + */
36 + final class Subscription extends Singleton {
37 + /**
38 + * Register dependencies
39 + */
40 + protected function __construct() {
41 + new AddonRegister();
42 + new Database();
43 +
44 + /**
45 + * Disable the subscription addon if not monetized by tutor
46 + *
47 + * @since 3.0.0
48 + */
49 + if ( self::is_enabled() && ! tutor_utils()->is_monetize_by_tutor() ) {
50 + Addons::update_addon_status( plugin_basename( TUTOR_SUBSCRIPTION_FILE ), 0 );
51 + }
52 +
53 + if ( ! self::is_enabled() || ! tutor_utils()->is_monetize_by_tutor() ) {
54 + return;
55 + }
56 +
57 + new Assets();
58 + new Menu();
59 + new Settings();
60 + new Shortcode();
61 + new HookHandler();
62 + new PlanCheckoutController();
63 + new SubscriptionPlanController();
64 + new MembershipController();
65 + new FrontendController();
66 + new ManualSubscriptionController();
67 + new SubscriptionController();
68 + new SubscriptionListController();
69 + new CronController();
70 + new ReportController();
71 + new InvoiceController();
72 +
73 + add_action(
74 + 'tutor_email_addon_loaded',
75 + function() {
76 + if ( class_exists( 'TUTOR_EMAIL\EmailNotification' ) ) {
77 + new EmailController();
78 + }
79 + }
80 + );
81 + }
82 +
83 + /**
84 + * Check addon is enabled or not.
85 + *
86 + * @since 3.0.0.
87 + *
88 + * @return boolean
89 + */
90 + public static function is_enabled() {
91 + $basename = plugin_basename( TUTOR_SUBSCRIPTION_FILE );
92 + $is_enabled = tutor_utils()->is_addon_enabled( $basename );
93 + return $is_enabled;
94 + }
95 +
96 + }
97 +