'rai-search-gate', 'data-cfasync' => 'false', 'data-no-optimize' => '1', 'data-no-defer' => '1', ) ); } function raptive_intelligence_activate() { add_option( RAPTIVE_INTELLIGENCE_ENABLED_OPTION, false ); } function raptive_intelligence_is_public_page(): bool { if ( is_preview() || is_search() || is_archive() || is_404() ) { return false; } if ( is_front_page() && ! is_singular() ) { return true; } if ( ! is_singular( array( 'post', 'page' ) ) ) { return false; } $post = get_queried_object(); return $post instanceof WP_Post && is_post_publicly_viewable( $post ) && '' === $post->post_password; } function raptive_intelligence_enqueue_loader() { if ( ! raptive_intelligence_is_enabled() || ! raptive_intelligence_is_public_page() ) { return; } $config = raptive_intelligence_service_config(); $handle = 'raptive-intelligence-loader'; wp_register_script( $handle, plugin_dir_url( RAPTIVE_INTELLIGENCE_PLUGIN_FILE ) . 'assets/js/loader.js', array(), RAPTIVE_INTELLIGENCE_VERSION, array( 'in_footer' => true ) ); wp_add_inline_script( $handle, 'window.RaptiveAssistantConfig = ' . wp_json_encode( array( 'apiBaseUrl' => $config['apiBaseUrl'], 'embedUrl' => $config['embedUrl'], 'iframeUrl' => $config['iframeUrl'], 'eventingUrl' => $config['eventingUrl'], 'initiallyOpen' => false, 'theme' => 'system', ), JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT ) . ';', 'before' ); wp_enqueue_script( $handle ); }