esc_html__('Select or Upload Icon', 'ai24-assistant-integrator'), 'useIconText' => esc_html__('Use this icon', 'ai24-assistant-integrator') ); wp_localize_script('AI24AI-image-uploader-toggle', 'ai24aiToggleImage', $localize_data); } // Conditionally enqueue the toggle-sidebar.js script for the 'styling' tab if (isset($_GET['tab']) && 'styling' === $_GET['tab']) { wp_enqueue_script( 'AI24AI-toggle-sidebar', AI24AI_PLUGIN_URL . 'assets/js/toggle-sidebar.js', array('jquery'), false, true ); } // Conditionally enqueue the sliders.css file if (isset($_GET['tab']) && $_GET['tab'] === 'styling') { wp_enqueue_style( 'AI24AI-sliders-css', AI24AI_PLUGIN_URL . 'assets/css/sliders.css', array(), false ); } // Conditionally enqueue the extra-admin.js file if (isset($_GET['tab']) && $_GET['tab'] === 'styling') { wp_enqueue_script( 'AI24AI-extra-admin-js', AI24AI_PLUGIN_URL . 'assets/js/extra-admin.js', array('jquery'), false, true ); } wp_enqueue_style( 'AI24AI-admin-css', AI24AI_PLUGIN_URL . 'assets/css/admin.css', array(), false ); wp_enqueue_script( 'ai24ai-generate-functions', AI24AI_PLUGIN_URL . 'assets/js/generate-functions.js', array('jquery'), false, true ); wp_enqueue_script( 'ai24ai-regenerate-functions', AI24AI_PLUGIN_URL . 'assets/js/regenerate-functions.js', array('jquery'), false, true ); wp_enqueue_script( 'ai24ai-duplicate-functions', AI24AI_PLUGIN_URL . 'assets/js/duplicate-functions.js', array('jquery'), false, true ); } add_action('admin_enqueue_scripts', 'AI24AI_enqueue_admin_scripts'); function AI24AI_add_admin_menu() { $icon_path = __DIR__ . '/../assets/images/spy-agent.svg'; $icon_data = file_get_contents($icon_path); if ($icon_data === false) { $icon_base64 = ''; } else { $icon_base64 = base64_encode($icon_data); } add_menu_page( 'AI24 Assistant Integrator Settings', // Page title 'AI24 AI', // Menu title 'manage_options', // Capability 'AI24-assistant-integrator', // Menu slug 'AI24AI_settings_page', // Callback function 'data:image/svg+xml;base64,' . $icon_base64, // Icon URL 3 // Position ); add_submenu_page( 'AI24-assistant-integrator', // Parent slug 'API Settings', // Page title 'API Settings', // Menu title 'manage_options', // Capability 'AI24-assistant-integrator&tab=main_settings', // Menu slug 'AI24AI_settings_page' // Callback function ); add_submenu_page( 'AI24-assistant-integrator', // Parent slug 'Widget Styling', // Page title 'Widget Styling', // Menu title 'manage_options', // Capability 'AI24-assistant-integrator&tab=styling', // Menu slug 'AI24AI_settings_page' // Callback function ); add_submenu_page( 'AI24-assistant-integrator', // Parent slug 'Assistant Styling', // Page title 'Assistant Styling', // Menu title 'manage_options', // Capability 'AI24-assistant-integrator&tab=assistant_styling', // Menu slug 'AI24AI_settings_page' // Callback function ); add_submenu_page( 'AI24-assistant-integrator', // Parent slug 'Tutorials', // Page title 'Tutorials', // Menu title 'manage_options', // Capability 'AI24-assistant-integrator&tab=tutorials', // Menu slug 'AI24AI_settings_page' // Callback function ); // Remove the duplicate submenu item remove_submenu_page('AI24-assistant-integrator', 'AI24-assistant-integrator'); } add_action('admin_menu', 'AI24AI_add_admin_menu'); // Filter to add 'current' class to active submenu item function AI24AI_highlight_submenu($parent_file) { global $submenu_file, $current_screen, $pagenow; // Check if we're on the settings page if ($pagenow === 'admin.php' && isset($_GET['page']) && $_GET['page'] === 'AI24-assistant-integrator') { $submenu_file = 'AI24-assistant-integrator'; if (isset($_GET['tab'])) { switch ($_GET['tab']) { case 'main_settings': $submenu_file = 'AI24-assistant-integrator&tab=main_settings'; break; case 'styling': $submenu_file = 'AI24-assistant-integrator&tab=styling'; break; case 'assistant_styling': $submenu_file = 'AI24-assistant-integrator&tab=assistant_styling'; break; case 'tutorials': $submenu_file = 'AI24-assistant-integrator&tab=tutorials'; break; } } $parent_file = 'AI24-assistant-integrator'; } return $parent_file; } add_filter('parent_file', 'AI24AI_highlight_submenu'); //Function to add the settings page function AI24AI_settings_page() { if (!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.')); } $default_tab = 'main_settings'; $active_tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : $default_tab; $base_url = admin_url('admin.php?page=AI24-assistant-integrator'); $tabs = [ 'main_settings' => 'API settings', 'styling' => 'Widget Styling', 'assistant_styling' => 'Assistant Styling', 'tutorials' => 'Tutorials', ]; ?>

AI24 Assistant Integrator Settings

'AI24AI_functions_generate_button', 'class' => 'AI24AI-class', 'description' => 'Click to generate the custom functions file.')); add_settings_field('AI24AI_functions_regenerate_button', 'Regenerate Functions File', 'AI24AI_regenerate_button_callback', 'AI24AI-main-settings', 'AI24AI_function_settings', array('label_for' => 'AI24AI_functions_regenerate_button', 'class' => 'AI24AI-class', 'description' => 'Click to regenerate the custom functions file.')); add_settings_field('AI24AI_functions_duplicate_button', 'Duplicate Functions File', 'AI24AI_duplicate_button_callback', 'AI24AI-main-settings', 'AI24AI_function_settings', array('label_for' => 'AI24AI_functions_duplicate_button', 'class' => 'AI24AI-class', 'description' => 'Click to duplicate the custom functions file.')); add_settings_field('AI24AI_functions_edit_button', 'Edit Functions File', 'AI24AI_edit_button_callback', 'AI24AI-main-settings', 'AI24AI_function_settings', array('label_for' => 'AI24AI_functions_edit_button', 'class' => 'AI24AI-class', 'description' => 'Click to edit the custom functions file.')); // Add settings section and fields for API Settings add_settings_section('AI24AI_api_settings', 'API Keys', null, 'AI24AI-main-settings'); add_settings_field('AI24AI_api_key', 'OpenAI API Key', 'AI24AI_api_key_callback', 'AI24AI-main-settings', 'AI24AI_api_settings'); add_settings_field('AI24AI_assistant_id', 'Assistant ID', 'AI24AI_assistant_id_callback', 'AI24AI-main-settings', 'AI24AI_api_settings'); add_settings_field('AI24AI_api_keys', 'Secret Keys', 'AI24AI_api_keys_callback', 'AI24AI-main-settings', 'AI24AI_api_settings'); // Register settings for widget styling register_setting('AI24AI_styling_group', 'AI24AI_enable_widget', 'sanitize_text_field'); register_setting('AI24AI_styling_group', 'AI24AI_widget_pages', 'AI24AI_sanitize_pages'); register_setting('AI24AI_styling_group', 'AI24AI_widget_show_hide_mode'); register_setting('AI24AI_styling_group', 'AI24AI_header_color'); register_setting('AI24AI_styling_group', 'AI24AI_widget_corner_color'); register_setting('AI24AI_styling_group', 'AI24AI_toggle_image'); register_setting('AI24AI_styling_group', 'AI24AI_input_border_glow_color'); register_setting('AI24AI_styling_group', 'AI24AI_icon_color'); register_setting('AI24AI_styling_group', 'AI24AI_widget_position'); register_setting('AI24AI_styling_group', 'AI24AI_sidebar_content'); register_setting('AI24AI_styling_group', 'AI24AI_sidebar_text', 'sanitize_text_field'); register_setting('AI24AI_styling_group', 'AI24AI_text_options', 'AI24AI_sanitize_text_options'); // Add settings section and fields for widget styling add_settings_section('AI24AI_widget_styling', 'Widget Styling', null, 'AI24AI-styling'); add_settings_field('AI24AI_enable_widget', 'Enable Widget', 'AI24AI_enable_widget_callback', 'AI24AI-styling', 'AI24AI_widget_styling'); add_settings_field('AI24AI_widget_pages', 'Select Pages for Widget', 'AI24AI_widget_pages_callback', 'AI24AI-styling', 'AI24AI_widget_styling'); add_settings_field('AI24AI_widget_position', 'Widget Position', 'AI24AI_widget_position_callback', 'AI24AI-styling', 'AI24AI_widget_styling'); add_settings_field('AI24AI_sidebar_content', 'Sidebar Content', 'AI24AI_sidebar_content_callback', 'AI24AI-styling', 'AI24AI_widget_styling'); add_settings_field('AI24AI_header_color', 'Header Color', 'AI24AI_header_color_callback', 'AI24AI-styling', 'AI24AI_widget_styling'); add_settings_field('AI24AI_widget_corner_color', 'Toggle Color', 'AI24AI_widget_corner_color_callback', 'AI24AI-styling', 'AI24AI_widget_styling'); add_settings_field('AI24AI_icon_color', 'Toggle Icon/Text Color', 'AI24AI_icon_color_callback', 'AI24AI-styling', 'AI24AI_widget_styling'); add_settings_field('AI24AI_toggle_image', 'Toggle Icon SVG', 'AI24AI_toggle_image_callback', 'AI24AI-styling', 'AI24AI_widget_styling'); add_settings_field('AI24AI_input_border_glow_color', 'Input Border Glow Color', 'AI24AI_input_border_glow_color_callback', 'AI24AI-styling', 'AI24AI_widget_styling'); // New font settings section and field //add_settings_section('AI24AI_font_settings', 'Font Settings', 'AI24AI_font_settings_callback', 'AI24AI-styling'); //add_settings_field('AI24AI_font', 'Chatbot Font', 'AI24AI_font_field_callback', 'AI24AI-styling', 'AI24AI_font_settings'); // Add settings section for text options add_settings_section('AI24AI_text_options', 'Text Options', 'AI24AI_text_options_callback', 'AI24AI-styling'); add_settings_field('AI24AI_markdown_enabled', 'Enable Markdown', 'AI24AI_markdown_enabled_callback', 'AI24AI-styling', 'AI24AI_text_options'); // Tutorials Section add_settings_section('AI24AI_tutorials_section', 'Tutorials', 'AI24AI_tutorials_section_callback', 'AI24AI-tutorials'); add_settings_field('AI24AI_tutorial_video', 'What is AI24?', 'AI24AI_tutorial_video_callback', 'AI24AI-tutorials', 'AI24AI_tutorials_section'); add_settings_field('AI24AI_tutorial_video2', 'What are functions?', 'AI24AI_tutorial_video2_callback', 'AI24AI-tutorials', 'AI24AI_tutorials_section'); add_settings_field('AI24AI_tutorial_video3', 'How to create OpenAI assistant functions', 'AI24AI_tutorial_video3_callback', 'AI24AI-tutorials', 'AI24AI_tutorials_section'); add_settings_field('AI24AI_tutorial_video4', 'How to create OpenAI assistants', 'AI24AI_tutorial_video4_callback', 'AI24AI-tutorials', 'AI24AI_tutorials_section'); // First, create a new option group for assistant styling settings. register_setting('AI24AI_assistant_styling_group', 'AI24AI_assistant_name'); register_setting('AI24AI_assistant_styling_group', 'AI24AI_assistant_description'); register_setting('AI24AI_assistant_styling_group', 'AI24AI_assistant_image'); register_setting('AI24AI_assistant_styling_group', 'AI24AI_assistant_context_message'); register_setting('AI24AI_assistant_styling_group', 'AI24AI_chat_input_placeholder'); register_setting('AI24AI_assistant_styling_group', 'AI24AI_exit_confirmation_text'); register_setting('AI24AI_assistant_styling_group', 'AI24AI_confirm_exit_button'); register_setting('AI24AI_assistant_styling_group', 'AI24AI_cancel_exit_button'); // Register new settings for up to three context messages and their toggles for ($i = 1; $i <= 3; $i++) { register_setting('AI24AI_assistant_styling_group', "AI24AI_assistant_context_message_$i"); register_setting('AI24AI_assistant_styling_group', "AI24AI_assistant_context_toggle_$i"); } // Add settings section for assistant styling add_settings_section('AI24AI_assistant_styling_settings', 'Assistant Styling Settings', 'AI24AI_styling_settings_callback', 'AI24AI-assistant-styling'); add_settings_field('AI24AI_assistant_name', 'Assistant Name', 'AI24AI_assistant_name_callback', 'AI24AI-assistant-styling', 'AI24AI_assistant_styling_settings'); add_settings_field('AI24AI_assistant_description', 'Assistant Description', 'AI24AI_assistant_description_callback', 'AI24AI-assistant-styling', 'AI24AI_assistant_styling_settings'); add_settings_field('AI24AI_assistant_image', 'Assistant Image', 'AI24AI_assistant_image_callback', 'AI24AI-assistant-styling', 'AI24AI_assistant_styling_settings'); for ($i = 1; $i <= 3; $i++) { add_settings_field("AI24AI_assistant_context_message_$i", "Starting Message $i", 'AI24AI_context_message_callback', 'AI24AI-assistant-styling', 'AI24AI_assistant_styling_settings', array('index' => $i)); add_settings_field("AI24AI_assistant_context_toggle_$i", "Enable Message $i", 'AI24AI_context_toggle_callback', 'AI24AI-assistant-styling', 'AI24AI_assistant_styling_settings', array('index' => $i)); } add_settings_field('AI24AI_chat_input_placeholder', 'Chat Input Placeholder', 'AI24AI_chat_input_placeholder_callback', 'AI24AI-assistant-styling', 'AI24AI_assistant_styling_settings'); add_settings_field('AI24AI_exit_confirmation_text', 'Exit Confirmation Text', 'AI24AI_exit_confirmation_text_callback', 'AI24AI-assistant-styling', 'AI24AI_assistant_styling_settings'); add_settings_field('AI24AI_confirm_exit_button', 'Confirm Exit Button Text', 'AI24AI_confirm_exit_button_callback', 'AI24AI-assistant-styling', 'AI24AI_assistant_styling_settings'); add_settings_field('AI24AI_cancel_exit_button', 'Cancel Exit Button Text', 'AI24AI_cancel_exit_button_callback', 'AI24AI-assistant-styling', 'AI24AI_assistant_styling_settings'); } add_action('admin_init', 'AI24AI_register_settings'); // Generate Function file button callback function AI24AI_generate_button_callback($args) { echo ''; } // Regenerate Function file button callback function AI24AI_regenerate_button_callback($args) { echo ''; } // Duplicate Function file button callback function AI24AI_duplicate_button_callback($args) { echo '
'; } function AI24AI_edit_button_callback($args) { $plugin_base_dir = basename(WP_PLUGIN_DIR . '/AI24AI-child'); $plugin_file_path = 'includes/functions.php'; $plugin_editor_link = network_admin_url("plugin-editor.php") . '?file=' . urlencode($plugin_base_dir . '/' . $plugin_file_path) . '&plugin=' . urlencode($plugin_base_dir . '/pluginmain.php'); echo 'Edit Functions File'; } // AJAX handler for generating the functions file add_action('wp_ajax_AI24AI_generate_function', function() { // Paths for source and destination files $source_main_file = WP_PLUGIN_DIR . '/ai24-assistant-integrator/includes/pluginmain.php'; $source_functions_file = WP_PLUGIN_DIR . '/ai24-assistant-integrator/includes/functions.php'; $destination_dir = WP_PLUGIN_DIR . '/AI24AI-child'; $destination_main_file = $destination_dir . '/pluginmain.php'; $destination_functions_file = $destination_dir . '/includes/functions.php'; // Ensure source files exist if (!file_exists($source_main_file) || !file_exists($source_functions_file)) { wp_send_json_error('Source file(s) do not exist.'); return; } // Create destination directory if it doesn't exist if (!file_exists($destination_dir)) { mkdir($destination_dir, 0755, true); } // Create includes directory if it doesn't exist if (!file_exists($destination_dir . '/includes')) { mkdir($destination_dir . '/includes', 0755, true); } // Clean up any existing files in the destination directory if (file_exists($destination_main_file)) { unlink($destination_main_file); } if (file_exists($destination_functions_file)) { unlink($destination_functions_file); } // Copy main plugin file to the destination directory if (!copy($source_main_file, $destination_main_file)) { wp_send_json_error('Failed to generate main plugin file.'); return; } // Copy functions file to the destination includes directory if (!copy($source_functions_file, $destination_functions_file)) { wp_send_json_error('Failed to generate functions file.'); return; } wp_send_json_success('Plugin files generated successfully.'); }); // AJAX handler for regenerating the functions file add_action('wp_ajax_AI24AI_regenerate_function', function() { // Paths for source and destination files $source_main_file = WP_PLUGIN_DIR . '/ai24-assistant-integrator/includes/pluginmain.php'; $source_functions_file = WP_PLUGIN_DIR . '/ai24-assistant-integrator/includes/functions.php'; $destination_main_file = WP_PLUGIN_DIR . '/AI24AI-child/pluginmain.php'; $destination_functions_file = WP_PLUGIN_DIR . '/AI24AI-child/includes/functions.php'; // Ensure source files exist if (!file_exists($source_main_file) || !file_exists($source_functions_file)) { wp_send_json_error('Source file(s) do not exist.'); return; } // Clean up any existing files in the destination directory if (file_exists($destination_main_file)) { unlink($destination_main_file); } if (file_exists($destination_functions_file)) { unlink($destination_functions_file); } // Copy main plugin file to the destination directory if (!copy($source_main_file, $destination_main_file)) { wp_send_json_error('Failed to regenerate main plugin file.'); return; } // Copy functions file to the destination includes directory if (!copy($source_functions_file, $destination_functions_file)) { wp_send_json_error('Failed to regenerate functions file.'); return; } wp_send_json_success('Plugin files regenerated successfully.'); }); add_action('wp_ajax_AI24AI_duplicate_function_file', function() { // Check for required parameters if (!isset($_POST['file_name']) || empty($_POST['file_name'])) { wp_send_json_error('File name is required.'); return; } $file_name = sanitize_text_field($_POST['file_name']); $source_file = WP_PLUGIN_DIR . '/AI24AI-child/includes/functions.php'; $destination_file = WP_PLUGIN_DIR . '/AI24AI-child/includes/' . $file_name . '-' . time() . '.php'; // Ensure the source file exists if (!file_exists($source_file)) { wp_send_json_error('Source file does not exist.'); return; } // Copy the source file to the new destination if (!copy($source_file, $destination_file)) { wp_send_json_error('Failed to duplicate file.'); return; } wp_send_json_success('File duplicated successfully.'); }); // Enable widget and page view handling // Callback function for the enable/disable widget field function AI24AI_enable_widget_callback() { $enable_widget = get_option('AI24AI_enable_widget', 'no'); ?>
post_title); ?>

Select the pages where the widget should be displayed or hidden based on the selected mode. Leave all unchecked to display on all pages.

" . esc_textarea($context_message) . ""; } //function AI24AI_widget_styling_callback() { // echo '

Widget Styling

'; //} // Callback for the 'Widget Position' setting field function AI24AI_widget_position_callback() { $widget_position = get_option('AI24AI_widget_position', 'corner'); ?>

"; // Optionally, add a hidden field to ensure the value gets posted echo ""; } else { $checked = $context_toggle === 'on' ? 'checked' : ''; echo ""; } } function AI24AI_api_keys_callback() { $apiKeys = get_option('AI24AI_api_keys'); if (!is_array($apiKeys)) { $apiKeys = []; } echo '

Here you can add as many secret keys as you need.

'; echo '
'; foreach ($apiKeys as $index => $details) { echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo ''; // Show button echo '
'; echo ''; echo '
'; } echo ''; echo '
'; // Close the container } function AI24AI_api_key_callback() { $apiKey = get_option('AI24AI_api_key'); $locked = !empty($apiKey); echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
'; } function AI24AI_assistant_id_callback() { $assistantId = get_option('AI24AI_assistant_id'); $locked = !empty($assistantId); echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
'; } add_action('admin_init', function () { if (isset($_POST['option_page']) && $_POST['option_page'] == 'AI24AI_options_group') { // Sanitize and verify the nonce first to ensure the form submission is valid if (!isset($_POST['AI24AI_settings_nonce'])) { wp_die(esc_html__('Nonce not set.', 'ai24-assistant-integrator')); } $nonce = sanitize_text_field(wp_unslash($_POST['AI24AI_settings_nonce'])); if (!wp_verify_nonce($nonce, 'AI24AI_settings_action')) { wp_die(esc_html__('Security check failed.', 'ai24-assistant-integrator')); } // Process the form since the nonce is verified. if (isset($_POST['AI24AI_api_key']) && $_POST['AI24AI_api_key'] !== '') { update_option('AI24AI_api_key', sanitize_text_field($_POST['AI24AI_api_key'])); } if (isset($_POST['AI24AI_assistant_id']) && $_POST['AI24AI_assistant_id'] !== '') { update_option('AI24AI_assistant_id', sanitize_text_field($_POST['AI24AI_assistant_id'])); } } }); // Display the settings errors add_action('admin_notices', function() { settings_errors('AI24AI_messages'); }); // Show a confirmation message when settings are saved add_action('admin_notices', function () { if (get_transient('settings_saved')) { echo '

Settings saved.

'; delete_transient('settings_saved'); } }); // Define callback functions for each field function AI24AI_assistant_name_callback() { $name = get_option('AI24AI_assistant_name'); echo ''; } function AI24AI_assistant_description_callback() { $description = get_option('AI24AI_assistant_description'); echo ''; } function AI24AI_assistant_context_message_callback() { $context_message = get_option('AI24AI_assistant_context_message'); echo ''; } // Placeholder for settings section callback function function AI24AI_styling_settings_callback() { // Output any description or header you want for the Assistant Styling section. echo '

Customize the appearance and behavior of the virtual assistant here.

'; } function AI24AI_placement_settings_callback() { echo '

Select where you want the virtual assistant to appear on your site.

'; } function AI24AI_placement_options_callback() { $placement_options = get_option('AI24AI_placement_options'); // Assuming $placement_options is an array with the selected options ?>

Hold down the Ctrl (Windows) or Command (Mac) button to select multiple options.

'; } // Callback for the 'Widget Corner Color' field function AI24AI_widget_corner_color_callback() { $widget_corner_color = get_option('AI24AI_widget_corner_color', '#632289'); // Default color echo ''; } // Callback for the 'Input Border Glow Color' field function AI24AI_input_border_glow_color_callback() { $input_border_glow_color = get_option('AI24AI_input_border_glow_color', '#632289'); // Default color echo ''; } function AI24AI_icon_color_callback() { $icon_text_color = get_option('AI24AI_icon_color', '#ffffff'); // Default to white ?>
Icon and Text Color

Choose a color for the icon or text:


'; echo ''; echo ''; } function AI24AI_sidebar_content_callback() { $sidebar_content = get_option('AI24AI_sidebar_content', 'icon'); $sidebar_text = get_option('AI24AI_sidebar_text', ''); $initial_display_style = get_option('AI24AI_widget_position', 'corner') === 'corner' ? 'style="display: none;"' : ''; ?> Select the type of API handler you wish to use.

'; } // Function to get dynamic plugin file path function get_dynamic_plugin_file_path() { return 'includes/functions.php'; } function AI24AI_functions_field_callback() { $options = get_option('AI24AI_functions_option'); $handler_type = is_array($options) && isset($options['handler_type']) ? $options['handler_type'] : 'non_functions'; ?> >
> Video tutorials to help you make the most of the AI24 Assistant Integrator and OpenAI assistants in general.

'; } // Callback for What is AI24 function AI24AI_tutorial_video_callback() { // Embed YouTube video https://youtu.be/blGeFZOvncY echo ''; } // The callback for what are OpenAI functions function AI24AI_tutorial_video2_callback() { // Embed YouTube video https://youtu.be/JIv3dnx7S30 echo ''; } // The callback for How to make functions for OpenAI assistants function AI24AI_tutorial_video3_callback() { // Embed YouTube video https://youtu.be/pOIWTjgv9Sc echo ''; } // The callback for How to ACTUALLY make an OpenAI assistant function AI24AI_tutorial_video4_callback() { // Embed YouTube video https://youtu.be/Io_HckHRxow echo ''; } function AI24AI_sanitize_api_keys($keys) { $sanitized_keys = []; if (is_array($keys)) { foreach ($keys as $key => $details) { if (is_array($details) && isset($details['name']) && isset($details['key'])) { $sanitized_key = [ 'name' => sanitize_text_field($details['name']), 'key' => sanitize_text_field($details['key']), // Consider encrypting this value ]; $sanitized_keys[$key] = $sanitized_key; } } } return $sanitized_keys; } //SETTINGS FOR TEXT OPTIONS /*//Settings for all the font selection and forcing // Font settings section callback //function AI24AI_font_settings_callback() { echo '

' . __('Configure the font settings for the chatbot.', 'AI24AI') . '

'; } // Sanitize settings input function AI24AI_sanitize_settings($input) { $sanitized_input = array(); $sanitized_input['font'] = sanitize_text_field($input['font']); error_log('Sanitized font: ' . $sanitized_input['font']); // Debug log return $sanitized_input; } // Font field callback function AI24AI_font_field_callback() { $options = get_option('AI24AI_font_settings'); $fonts = array( 'AI24AIKumbhsans' => 'Kumbh Sans', 'Arial' => 'Arial', 'Helvetica' => 'Helvetica', 'Times New Roman' => 'Times New Roman', 'Georgia' => 'Georgia', 'Verdana' => 'Verdana', 'Tahoma' => 'Tahoma', 'Courier New' => 'Courier New', 'Lucida Console' => 'Lucida Console', 'Monaco' => 'Monaco', 'serif' => 'Serif', 'sans-serif' => 'Sans-serif', 'monospace' => 'Monospace', 'cursive' => 'Cursive', 'fantasy' => 'Fantasy', ); $selected_font = isset($options['font']) ? $options['font'] : 'AI24AIKumbhsans'; // Default to Kumbh Sans error_log('Current selected font in callback: ' . $selected_font); // Debug log ?>

Select a font from the available options.

' . __('Configure the text options for the chatbot.', 'AI24AI') . '

'; } function AI24AI_markdown_enabled_callback() { $options = get_option('AI24AI_text_options'); ?>

Enable or disable Markdown processing in the chatbot.

'; } function AI24AI_confirm_exit_button_callback() { $confirm_button = get_option('AI24AI_confirm_exit_button'); echo ''; } function AI24AI_cancel_exit_button_callback() { $cancel_button = get_option('AI24AI_cancel_exit_button'); echo ''; } function AI24AI_chat_input_placeholder_callback() { $placeholder = get_option('AI24AI_chat_input_placeholder'); echo ''; }