$step ) { if ( '' !== $from && version_compare( $from, $version, '>=' ) && Schema::DB_VERSION === (string) get_option( Schema::OPTION, '' ) ) { continue; } call_user_func( $step ); $ran[] = $version; } return $ran; } /** * Every upgrade step. Settings merge their defaults on read (§S-ARCH), so the * only migration is the tables, which dbDelta creates or brings up to date. * * @return array */ public static function steps() { return array( '0.1.0' => array( Schema::class, 'install' ), ); } /** * Wire everything up. Each item of the roadmap adds its own line here: where * the gate applies and the gate itself (P2, P3 — Scope, Gate), the checkout * questions (P7, P8), the record (P9), privacy (P11). * * @return void */ public static function boot() { self::maybe_upgrade(); // The admin routes, and the one public route — which exists only while the // gate is on (Rest_Public::register() checks). add_action( 'rest_api_init', array( Rest_Admin::class, 'register' ) ); add_action( 'rest_api_init', array( Rest_Public::class, 'register' ) ); // The classic checkout's question (P7) — hooked before the admin branch: an // order can be placed through admin-ajax.php too, and that is "admin" to // WordPress. Nothing is hooked while the checkout question is off. Checkout_Classic::init(); // The block checkout's (P8): the Store API's order requests, which are REST, // and the checkout block's integration, which WooCommerce registers on `init`. Checkout_Block::init(); // Privacy (P11): the suggested policy text (wp-admin only), the personal-data // exporters and erasers (WordPress's privacy tools run through admin-ajax.php), // and WooCommerce's own removal of an order's personal data, which its scheduled // clean-up of old orders runs outside wp-admin too. Privacy::init(); // A section of a page behind the gate (B2): the block (the editor needs it in // wp-admin, the page outside it) and the shortcode. Only content that holds one // is changed. Section::init(); if ( is_admin() ) { Admin::init(); return; } // The public side: hooked only while the gate is on (Gate::init() checks), and // decided per page from the address and the settings — never per visitor. Gate::init(); // A restricted product's page names the checkout question, when switched on. Woo::init(); } }