(bool) ( $config['enabled'] ?? false ), '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', 'button_size' => in_array( $button_size, $valid_sizes, true ) ? $button_size : 'medium', 'features' => array_map( 'sanitize_text_field', (array) ( $config['features'] ?? [] ) ), 'hide_powered_by' => (bool) ( $config['hide_powered_by'] ?? true ), 'offset_vertical' => max( 0, min( 500, (int) ( $config['offset_vertical'] ?? 15 ) ) ), 'offset_horizontal' => max( 0, min( 500, (int) ( $config['offset_horizontal'] ?? 15 ) ) ), 'dyslexicFontUrl' => esc_url( ACCESSMATE_URL . 'assets/fonts/opendyslexic/files/opendyslexic-latin-400-normal.woff2' ), ]; 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' => false, 'color' => '#7c6aff', 'position' => 'bottom-right', 'button_size' => 'medium', 'features' => [ 'font', 'contrast', 'dyslexia', 'reading-guide', 'animations', 'line-height' ], 'hide_powered_by' => true, 'offset_vertical' => 15, 'offset_horizontal' => 15, ]; } }