settings ); update_option( 'oorank_rewrite_version', OORANK_VERSION, false ); } /** * Instantiate modules and register their hooks. * * Fires oorank_init so Pro (and other add-ons) can extend a fully * booted free core. Free must run with no listeners present. */ public function init() { $this->settings = new Oorank_Settings(); $this->rest = new Oorank_Rest( $this->settings ); $this->rest->hooks(); // Roles follow the setting: saving the list is what grants and revokes. add_action( 'update_option_' . Oorank_Settings::OPTION, function () { Oorank_Roles::sync( $this->settings ); } ); $this->llms_txt = new Oorank_Llms_Txt( $this->settings ); $this->llms_txt->hooks(); $this->bots = new Oorank_Bot_Manager( $this->settings ); $this->bots->hooks(); $this->audit = new Oorank_Audit( $this->settings, $this->bots ); $this->audit->hooks(); $this->schema = new Oorank_Schema( $this->settings ); $this->schema->hooks(); $this->freshness = new Oorank_Freshness( $this->settings ); $this->freshness->hooks(); $this->mcp = new Oorank_Mcp( $this->settings ); $this->mcp->hooks(); // Not admin-only: both this and the add-on routes are REST, where // is_admin() is false. $permalinks = new Oorank_Permalinks(); $permalinks->hooks(); $addons = new Oorank_Addon_Installer(); $addons->hooks(); Oorank_Cli::register(); if ( is_admin() ) { $this->admin = new Oorank_Admin( $this->settings ); $this->admin->hooks(); $meta_box = new Oorank_Audit_Meta_Box( $this->audit ); $meta_box->hooks(); $llms_meta_box = new Oorank_Llms_Meta_Box(); $llms_meta_box->hooks(); } // Not admin-only: the box is an editor screen, but the authored FAQ // and how-to steps it stores are what the front-end graph publishes. $faq_meta_box = new Oorank_Faq_Meta_Box(); $faq_meta_box->hooks(); /** * Fires after free core has booted. * * Extension seam for the Pro add-on: register listeners for the * oorank_settings_schema, oorank_admin_tabs, and oorank_rest_routes * filters here. Free core runs fully with no listeners attached. * * @param Oorank_Plugin $plugin The booted plugin instance. */ do_action( 'oorank_init', $this ); } /** * Activation: seed default options, defer a rewrite flush. */ public static function activate() { require_once OORANK_PATH . 'includes/class-settings.php'; $settings = new Oorank_Settings(); $settings->maybe_seed_defaults(); require_once OORANK_PATH . 'includes/class-roles.php'; Oorank_Roles::sync( $settings ); // M1 registers rewrite rules; flush on the next init after activation. set_transient( 'oorank_flush_rewrites', 1, 60 ); } /** * Deactivation: clear transient caches only. Never delete user data. */ public static function deactivate() { delete_transient( 'oorank_flush_rewrites' ); delete_transient( 'oorank_llms_index' ); delete_transient( 'oorank_llms_full' ); delete_transient( Oorank_Audit::SITE_CACHE ); // Stop the weekly site scan; audit results themselves are user data. wp_clear_scheduled_hook( Oorank_Audit::CRON_HOOK ); // Drop the rewrite rules we registered so the endpoints 404 cleanly. flush_rewrite_rules( false ); } }