(bool) ( $config['enabled'] ?? true ), 'color' => sanitize_hex_color( $config['color'] ?? '#7c6aff' ) ?? '#7c6aff', 'position' => in_array( $config['position'] ?? '', [ 'top-left', 'top-right', 'bottom-left', 'bottom-right' ], true ) ? $config['position'] : 'bottom-right', 'features' => array_map( 'sanitize_text_field', (array) ( $config['features'] ?? [] ) ), 'hide_powered_by' => (bool) ( $config['hide_powered_by'] ?? true ), ]; if ( in_array( 'dyslexia', $safe_config['features'], true ) ) { wp_enqueue_style( 'accessmate-dyslexia-font', ACCESSMATE_URL . 'assets/fonts/opendyslexic/opendyslexic.css', [], ACCESSMATE_VERSION ); } wp_register_script( 'accessmate-widget', ACCESSMATE_URL . 'assets/widget.js', [], ACCESSMATE_VERSION, true ); wp_add_inline_script( 'accessmate-widget', 'window.accessmateWidgetConfig=' . wp_json_encode( $safe_config ) . ';', 'before' ); wp_enqueue_script( 'accessmate-widget' ); } public static function defaults(): array { return [ 'enabled' => true, 'color' => '#7c6aff', 'position' => 'bottom-right', 'features' => [ 'font', 'contrast', 'dyslexia', 'reading-guide', 'animations', 'line-height' ], ]; } }