' . esc_html__( 'Settings', 'flareops' ) . '' ); return $links; } ) ); } } public static function on_init(): void { Util::safe( array( Install::class, 'maybe_upgrade' ) ); Feed::add_rewrite(); if ( get_option( 'flareops_rewrite_version' ) !== Feed::REWRITE_VERSION ) { flush_rewrite_rules( false ); update_option( 'flareops_rewrite_version', Feed::REWRITE_VERSION, true ); } IndexNow::maybe_serve_key(); } /** WooCommerce-only hooks (WooCommerce loads after us alphabetically, so check here). */ public static function woo_hooks(): void { if ( ! Util::woo_active() ) { return; } $g = array( Util::class, 'guard' ); add_action( 'woocommerce_single_product_summary', $g( array( Frontend::class, 'classic_facts' ) ), 11 ); add_filter( 'render_block', $g( array( Frontend::class, 'render_block' ) ), 10, 3 ); add_filter( 'woocommerce_structured_data_product', $g( array( Frontend::class, 'structured_data' ) ), 30, 2 ); // v0.3: visible FAQ after the description (treatment products only, exactly once). add_filter( 'the_content', $g( array( Frontend::class, 'faq_the_content' ) ), 20 ); add_filter( 'render_block', $g( array( Frontend::class, 'render_block_faq' ) ), 20, 3 ); add_action( 'woocommerce_after_single_product_summary', $g( array( Frontend::class, 'classic_faq' ) ), 12 ); $changed = $g( static function ( $id ) { Feed::invalidate(); IndexNow::on_product_change( $id ); } ); add_action( 'woocommerce_new_product', $changed, 20 ); add_action( 'woocommerce_update_product', $changed, 20 ); add_action( 'woocommerce_update_product_variation', $changed, 20 ); add_action( 'woocommerce_product_set_stock_status', $g( array( Feed::class, 'invalidate' ) ) ); add_action( 'woocommerce_variation_set_stock_status', $g( array( Feed::class, 'invalidate' ) ) ); add_action( 'save_post_product', $g( array( Feed::class, 'invalidate' ) ) ); add_action( 'set_object_terms', $g( array( Feed::class, 'invalidate' ) ) ); // v1: product change events to the flareOps service (ids only; connected + consent only; batched in WP-Cron). Events::register_hooks(); } }