'fullpage', 'position' => 'right', 'config_id' => '', 'width' => '', 'height' => '', 'auto_open' => '', 'header_text' => '', 'accent_color' => '', 'bubble_label' => '', 'class' => '', 'container_height' => '600px', // Per-shortcode chatbot behavior overrides 'scenario' => '', 'context_hint' => '', 'hide_bubble' => '', // "1"/"true" hides the floating bubble ], (array) $atts, 'agentsia_chatbot' ); $hide_bubble_raw = strtolower( (string) $atts['hide_bubble'] ); $hide_bubble = in_array( $hide_bubble_raw, [ '1', 'true', 'yes' ], true ); $overrides = [ 'mode' => in_array( $atts['mode'], [ 'bubble', 'modal', 'fullpage' ], true ) ? $atts['mode'] : 'fullpage', 'position' => in_array( $atts['position'], [ 'left', 'right' ], true ) ? $atts['position'] : 'right', 'chatbot_config_id' => sanitize_text_field( $atts['config_id'] ), 'width' => sanitize_text_field( $atts['width'] ), 'height' => sanitize_text_field( $atts['height'] ), 'auto_open' => sanitize_text_field( $atts['auto_open'] ), 'header_text' => sanitize_text_field( $atts['header_text'] ), 'accent_color' => sanitize_text_field( $atts['accent_color'] ), 'bubble_label' => sanitize_text_field( $atts['bubble_label'] ), 'scenario' => preg_replace( '/\s+/u', '-', sanitize_text_field( $atts['scenario'] ) ), 'context_hint' => sanitize_textarea_field( $atts['context_hint'] ), ]; if ( $hide_bubble_raw !== '' ) { $overrides['hide_bubble'] = $hide_bubble; } // Fall back to the per-page overrides (sidebar panel / meta box) for values // the shortcode didn't set — so a page's chosen scenario also applies to an // embedded chatbot, not only the global floating bubble. $post_overrides = Post_Meta::instance()->resolve_overrides_for_current_request(); if ( empty( $overrides['scenario'] ) && ! empty( $post_overrides['scenario'] ) ) { $overrides['scenario'] = $post_overrides['scenario']; } if ( empty( $overrides['context_hint'] ) && ! empty( $post_overrides['context_hint'] ) ) { $overrides['context_hint'] = $post_overrides['context_hint']; } $container_attrs = [ 'class' => sanitize_html_class( $atts['class'] ), 'style' => 'width:100%;min-height:' . esc_attr( $atts['container_height'] ) . ';', ]; return Chatbot::instance()->enqueue_widget( $overrides, $container_attrs ); } public function render_booking( $atts ): string { $settings = Plugin::get_settings(); $atts = shortcode_atts( [ 'slug' => $settings['default_booking_slug'], 'height' => '780', 'width' => '100%', 'class' => '', ], (array) $atts, 'agentsia_booking' ); $slug = sanitize_title( $atts['slug'] ); if ( $slug === '' ) { if ( current_user_can( 'manage_options' ) ) { return sprintf( '