- Wordpress improvements - Multi-language support
- Styling of the administrative interface in line with askeveai.com website
This commit is contained in:
@@ -3,11 +3,9 @@
|
||||
Plugin Name: EveAI Chat Widget
|
||||
Plugin URI: https://askeveai.com/
|
||||
Description: Integrates the EveAI chat interface into your WordPress site.
|
||||
Version: 1.2
|
||||
Version: 1.3.20
|
||||
Author: Josako, Pieter Laroy
|
||||
Author URI: https://askeveai.com/about/
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
// Enqueue necessary scripts and styles
|
||||
@@ -28,6 +26,7 @@ function eveai_chat_shortcode($atts) {
|
||||
$api_key = esc_js($options['api_key']);
|
||||
$domain = esc_js($options['domain']);
|
||||
$language = esc_js($options['language']);
|
||||
$supported_languages = esc_js($options['supported_languages']);
|
||||
|
||||
// Generate a unique ID for this instance of the chat widget
|
||||
$chat_id = 'chat-container-' . uniqid();
|
||||
@@ -39,7 +38,8 @@ function eveai_chat_shortcode($atts) {
|
||||
'$tenant_id',
|
||||
'$api_key',
|
||||
'$domain',
|
||||
'$language'
|
||||
'$language',
|
||||
'$supported_languages'
|
||||
);
|
||||
eveAI.initializeChat('$chat_id');
|
||||
});
|
||||
@@ -81,6 +81,7 @@ function eveai_chat_register_settings() {
|
||||
add_settings_field('eveai_chat_api_key', 'API Key', 'eveai_chat_api_key_input', 'eveai-chat-settings', 'eveai_chat_main');
|
||||
add_settings_field('eveai_chat_domain', 'Domain', 'eveai_chat_domain_input', 'eveai-chat-settings', 'eveai_chat_main');
|
||||
add_settings_field('eveai_chat_language', 'Default Language', 'eveai_chat_language_input', 'eveai-chat-settings', 'eveai_chat_main');
|
||||
add_settings_field('eveai_chat_supported_languages', 'Supported Languages', 'eveai_chat_supported_languages_input', 'eveai-chat-settings', 'eveai_chat_main');
|
||||
}
|
||||
add_action('admin_init', 'eveai_chat_register_settings');
|
||||
|
||||
@@ -108,11 +109,20 @@ function eveai_chat_language_input() {
|
||||
echo "<input id='eveai_chat_language' name='eveai_chat_options[language]' type='text' value='" . esc_attr($options['language']) . "' />";
|
||||
}
|
||||
|
||||
function eveai_chat_supported_languages_input() {
|
||||
$options = get_option('eveai_chat_options');
|
||||
$supported_languages = isset($options['supported_languages']) ? $options['supported_languages'] : 'en,fr,de,es';
|
||||
echo "<input id='eveai_chat_supported_languages' name='eveai_chat_options[supported_languages]' type='text' value='" . esc_attr($supported_languages) . "' />";
|
||||
echo "<p class='description'>Enter comma-separated language codes (e.g., en,fr,de,es)</p>";
|
||||
}
|
||||
|
||||
|
||||
function eveai_chat_options_validate($input) {
|
||||
$new_input = array();
|
||||
$new_input['tenant_id'] = sanitize_text_field($input['tenant_id']);
|
||||
$new_input['api_key'] = sanitize_text_field($input['api_key']);
|
||||
$new_input['domain'] = esc_url_raw($input['domain']);
|
||||
$new_input['language'] = sanitize_text_field($input['language']);
|
||||
$new_input['supported_languages'] = sanitize_text_field($input['supported_languages']);
|
||||
return $new_input;
|
||||
}
|
||||
Reference in New Issue
Block a user