s = AccessIQ_Settings::instance(); add_action( 'wp_enqueue_scripts', [ $this, 'enqueue' ] ); add_action( 'wp_footer', [ $this, 'render' ] ); } public function enqueue() { if ( ! $this->s->get( 'widget_enabled', true ) ) return; if ( ! $this->s->get( 'show_on_mobile', true ) && wp_is_mobile() ) return; wp_enqueue_style( 'accessiq-widget', ACCESSIQ_URL . 'public/css/widget.css', [], ACCESSIQ_VERSION ); wp_enqueue_script( 'accessiq-widget', ACCESSIQ_URL . 'public/js/widget.js', [], ACCESSIQ_VERSION, true ); wp_localize_script( 'accessiq-widget', 'accessiqWidget', [ 'position' => $this->s->get( 'widget_position', 'bottom-right' ), 'color' => $this->s->get( 'widget_color', '#1d4ed8' ), 'features' => $this->s->get( 'widget_features', [ 'font_size', 'contrast', 'dyslexia_font', 'keyboard_nav' ] ), 'showOnMobile' => $this->s->get( 'show_on_mobile', true ) ? true : false, 'pluginUrl' => ACCESSIQ_URL, 'panel_width' => $this->s->get( 'widget_panel_width', 'normal' ), 'panel_height' => $this->s->get( 'widget_panel_height', 'auto' ), 'profiles_enabled' => (bool) $this->s->get( 'profiles_enabled', true ), 'enabled_profiles' => (array) $this->s->get( 'enabled_profiles', array( 'vision', 'adhd', 'seizure', 'dyslexia', 'keyboard' ) ), 'statement_url' => ( function () { $aiq_sid = (int) get_option( 'accessiq_statement_page_id', 0 ); return $aiq_sid ? get_permalink( $aiq_sid ) : ''; } )(), 'i18n' => [ 'openMenu' => __( 'Open Accessibility Menu', 'accessiq' ), 'closeMenu' => __( 'Close', 'accessiq' ), 'fontSize' => __( 'Font Size', 'accessiq' ), 'contrast' => __( 'High Contrast', 'accessiq' ), 'dyslexiaFont' => __( 'Dyslexia Font', 'accessiq' ), 'keyboardNav' => __( 'Keyboard Navigation', 'accessiq' ), 'reset' => __( 'Reset All', 'accessiq' ), ], ] ); } public function render() { if ( ! $this->s->get( 'widget_enabled', true ) ) return; echo ''; } }