Dual Personality: Standalone-First, Glass-Enhanced

Conflict Detector and Fortify needed to work on WordPress.org, where Glass is not installed. But they also needed to provide a premium experience when Glass is available. The dual-personality pattern solves this: standalone-first, Glass-enhanced when detected.

Detection at Bootstrap

Every dual-personality plugin checks for Glass at bootstrap: class_exists('AJT_DB'), function_exists('glass_url'), function_exists('glass_robot_register_tool'). Based on what is available, the plugin progressively enhances: AJT_DB for storage, Glass app registration for the admin UI, Robot tools for AI integration, Spotlight actions for command palette access.

Standalone Admin UI

Without Glass, the plugin registers a standard WordPress admin menu page. The admin UI is fully functional: dashboard, settings, scan results, notifications. All features work. The CSS follows AJT design patterns but does not depend on Glass stylesheets. JavaScript is self-contained.

Glass Enhancement

When Glass is detected, the wp-admin menu is hidden (Glass Lock suppresses it) and the plugin registers as a Glass app instead. The same PHP renders the same UI, but inside the Glass shell with badge counts, Spotlight search, and Robot quick actions. The rendering callback is identical; only the container changes.

Storage Abstraction

Three-tier storage: AJT_DB (isolated database, best performance), custom wpdb tables (standard WordPress, good performance), or wp_options (universal fallback, adequate for small datasets). The plugin tries each in order and uses the best available. This means it works on any WordPress installation, from shared hosting with no AJT_DB to a full Glass-powered ajt.support deployment.

← Previous mattartley.online: The Official Plugin Shop
Next → One Architecture, Six Plugins