CI / Tests (PHP 8.2) (pull_request) Successful in 44s
CI / Tests (PHP 8.1) (pull_request) Successful in 49s
CI / No Debug Code (pull_request) Successful in 2s
CI / PHPStan (pull_request) Successful in 2m49s
CI / Coding Standards (pull_request) Successful in 2m55s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m40s
CI / Build Plugin Zip (pull_request) Skipped
Group classes can now be marked invite-only (us_offerings.access_mode). Invite-only classes are hidden from the public catalog and reachable only when the instructor lets someone in via one of three paths, managed from My Lessons -> My Group Classes: - Add students directly: enrols them now with a pending payment. - Make available: grants registered students access to self-enrol through the normal paid flow (multi-select, emailed a notice). - Invite by email: tokenised registration invite tied to the class for a non-account address; after they register the class becomes enrollable. Reuses an existing pending invite instead of sending a second link. New us_group_access table records grants; GET /offerings merges granted invite-only classes for the caller; enrolment requires a grant (403 invite_required) and flips it to enrolled on success. composer test (487), composer lint, composer cs all pass. Co-Authored-By: Claude Opus 4.8 <[email protected]>
90 lines
4.5 KiB
PHP
90 lines
4.5 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Unsupervised\Schedular;
|
|
|
|
use Unsupervised\Schedular\Auth\EmailConfirmationHandler;
|
|
use Unsupervised\Schedular\Auth\InviteRepository;
|
|
use Unsupervised\Schedular\Auth\LoginPage;
|
|
use Unsupervised\Schedular\Auth\RegistrationLoginGate;
|
|
use Unsupervised\Schedular\Auth\RegistrationMailer;
|
|
use Unsupervised\Schedular\Auth\RegistrationPage;
|
|
use Unsupervised\Schedular\Auth\RoleManager;
|
|
use Unsupervised\Schedular\Booking\BookingPage;
|
|
use Unsupervised\Schedular\Availability\AvailabilityRepository;
|
|
use Unsupervised\Schedular\Booking\BookingRepository;
|
|
use Unsupervised\Schedular\GroupClass\EnrollmentRepository;
|
|
use Unsupervised\Schedular\GroupClass\GroupAccessRepository;
|
|
use Unsupervised\Schedular\GroupClass\GroupClassPage;
|
|
use Unsupervised\Schedular\Offering\OfferingRepository;
|
|
use Unsupervised\Schedular\Payment\BillingMethodResolver;
|
|
use Unsupervised\Schedular\Payment\PaymentRepository;
|
|
use Unsupervised\Schedular\Payment\PaymentService;
|
|
use Unsupervised\Schedular\Payment\ReceiptMailer;
|
|
use Unsupervised\Schedular\Payment\StripeGateway;
|
|
use Unsupervised\Schedular\Payment\StudioSettings;
|
|
use Unsupervised\Schedular\Policy\AcceptanceRepository;
|
|
use Unsupervised\Schedular\Policy\PolicyRepository;
|
|
use Unsupervised\Schedular\Policy\PolicyService;
|
|
use Unsupervised\Schedular\Policy\PolicyVersionRepository;
|
|
use Unsupervised\Schedular\Registration\AnswerRepository;
|
|
use Unsupervised\Schedular\Registration\QuestionRepository;
|
|
use Unsupervised\Schedular\Registration\RegistrationGate;
|
|
use Unsupervised\Schedular\Update\UpdateChecker;
|
|
|
|
class Plugin {
|
|
|
|
public static function boot(): void {
|
|
load_plugin_textdomain( 'unsupervised-schedular', false, dirname( plugin_basename( USC_PLUGIN_FILE ) ) . '/languages' );
|
|
|
|
global $wpdb;
|
|
if ( ! $wpdb instanceof \wpdb ) {
|
|
return;
|
|
}
|
|
|
|
// Re-run install steps when the plugin files were updated without a fresh
|
|
// activation (e.g. a deploy), so schema and data migrations still apply.
|
|
if ( get_option( 'us_schedular_version' ) !== USC_VERSION ) {
|
|
( new Installer() )->run();
|
|
}
|
|
|
|
$availability = new AvailabilityRepository( $wpdb );
|
|
$bookings = new BookingRepository( $wpdb );
|
|
$offerings = new OfferingRepository( $wpdb );
|
|
$questions = new QuestionRepository( $wpdb );
|
|
$answers = new AnswerRepository( $wpdb );
|
|
$policies = new PolicyRepository( $wpdb );
|
|
$policyVersions = new PolicyVersionRepository( $wpdb );
|
|
$policyService = new PolicyService( $policies, $policyVersions );
|
|
$acceptances = new AcceptanceRepository( $wpdb );
|
|
$invites = new InviteRepository( $wpdb );
|
|
$enrollments = new EnrollmentRepository( $wpdb );
|
|
$groupAccess = new GroupAccessRepository( $wpdb );
|
|
$registrationGate = new RegistrationGate( $questions, $answers, $policies, $policyVersions, $acceptances );
|
|
|
|
$paymentRepo = new PaymentRepository( $wpdb );
|
|
$settings = new StudioSettings();
|
|
$resolver = new BillingMethodResolver( $settings );
|
|
$stripe = new StripeGateway( $settings );
|
|
$paymentService = new PaymentService( $paymentRepo, $resolver, new ReceiptMailer(), $bookings, $enrollments, $settings, $stripe );
|
|
|
|
// The shortcode and block wrappers share the same page objects so
|
|
// front-end output is identical whichever way a page embeds them.
|
|
$registrationMailer = new RegistrationMailer();
|
|
|
|
$bookingPage = new BookingPage();
|
|
$loginPage = new LoginPage();
|
|
$registrationPage = new RegistrationPage( $invites, $policies, $policyVersions, $acceptances, $settings, $registrationMailer, $questions, $answers, $groupAccess );
|
|
$groupClassPage = new GroupClassPage();
|
|
|
|
( new UpdateChecker() )->register();
|
|
( new RoleManager() )->register();
|
|
( new RegistrationLoginGate() )->register();
|
|
( new EmailConfirmationHandler( $settings, $registrationMailer ) )->register();
|
|
( new AdminMenu( $availability, $bookings, $offerings, $questions, $answers, $policies, $policyVersions, $policyService, $acceptances, $invites, $enrollments, $groupAccess, $settings, $paymentRepo, $paymentService, $resolver, $registrationMailer ) )->register();
|
|
( new RestRegistrar( $availability, $bookings, $offerings, $questions, $policies, $policyVersions, $policyService, $registrationGate, $enrollments, $groupAccess, $paymentService ) )->register();
|
|
( new ShortcodeRegistrar( $bookingPage, $loginPage, $registrationPage, $groupClassPage ) )->register();
|
|
( new BlockRegistrar( $bookingPage, $loginPage, $registrationPage, $groupClassPage ) )->register();
|
|
}
|
|
}
|