* with SRI + a tag — exactly as documented in * docs/architecture/embeddability.md ("The manifest — embed snippets as data"). * * The one job of a WordPress wrapper is to reproduce that snippet from PHP against a * configurable catalog base, escape everything on the way out, and register the bundle * script through WordPress's own dependency graph (so SRI + crossorigin survive and the * script loads once even if a page has several maps). */ // No direct file access. if ( ! defined( 'ABSPATH' ) ) { exit; } define( 'DOXA_MAPS_EMBED_VERSION', '0.1.0' ); define( 'DOXA_MAPS_EMBED_FILE', __FILE__ ); define( 'DOXA_MAPS_EMBED_DIR', plugin_dir_path( __FILE__ ) ); /** * The default public catalog base — the served root of the built doxa-maps tree, i.e. the * directory that contains manifest.json and every /.js. It maps 1:1 to the * bundle's own `window.MAP_EMBED_BASE_URL` / embedBase.js "tree root" concept. * * Override per-site in Settings → Doxa Maps, or per-embed with the shortcode `base=""` attr. * This illustrative default matches the one used in library/utils/embedBase.js. */ if ( ! defined( 'DOXA_MAPS_EMBED_DEFAULT_BASE' ) ) { define( 'DOXA_MAPS_EMBED_DEFAULT_BASE', 'https://doxa.life/js/doxa-maps' ); } require_once DOXA_MAPS_EMBED_DIR . 'includes/class-doxa-maps-embed.php'; require_once DOXA_MAPS_EMBED_DIR . 'includes/class-doxa-maps-embed-settings.php'; /** * Boot the singleton on plugins_loaded. */ function doxa_maps_embed_boot() { Doxa_Maps_Embed::instance(); if ( is_admin() ) { Doxa_Maps_Embed_Settings::instance(); } } add_action( 'plugins_loaded', 'doxa_maps_embed_boot' );