are_met() ) {
add_action( 'admin_notices', array( $requirements, 'render_notice' ) );
return;
}
self::$recorder = new Recorder( new Context(), new Buffer() );
self::$recorder->register();
self::$scheduler = new Scheduler( new Reconciler( self::$recorder->buffer() ), new Cleanup() );
self::$scheduler->register();
// Read-only abilities (WordPress 6.9+), for the REST API and MCP clients.
( new Registry() )->register();
( new McpServer() )->register();
if ( is_admin() ) {
( new Privacy() )->register();
$settings = new SettingsPage();
$assistant = new Assistant();
$settings->register();
$assistant->register();
( new Screens( $settings ) )->register();
( new ProductMetaBox( null, $assistant ) )->register();
( new Export() )->register();
add_filter( 'plugin_action_links_' . plugin_basename( STOCK_ALIBI_FILE ), array( self::class, 'action_links' ) );
}
/**
* Fires once Stock Alibi has booted and its requirements are met.
*
* @since 0.1.0
*/
do_action( 'stock_alibi_loaded' );
}
/**
* The change recorder. NULL when the requirements are not met.
*/
public static function recorder(): ?Recorder {
return self::$recorder;
}
/**
* The background jobs (reconciliation, retention). NULL when the
* requirements are not met.
*/
public static function scheduler(): ?Scheduler {
return self::$scheduler;
}
/**
* Adds History and Settings links to the plugin's row on the Plugins screen.
*
* @param string[] $links Existing action links.
* @return string[]
*/
public static function action_links( array $links ): array {
$ours = array(
sprintf( '%s', esc_url( Screens::url( Screens::TAB_HISTORY ) ), esc_html__( 'History', 'stock-alibi' ) ),
sprintf( '%s', esc_url( SettingsPage::url() ), esc_html__( 'Settings', 'stock-alibi' ) ),
);
array_unshift( $links, ...$ours );
return $links;
}
}