Changeset 3363841
- Timestamp:
- 09/18/2025 09:22:43 AM (5 months ago)
- Location:
- chatbot-ai-free-models
- Files:
-
- 91 added
- 9 edited
-
tags/1.6.4 (added)
-
tags/1.6.4/chatbot-admin.php (added)
-
tags/1.6.4/css (added)
-
tags/1.6.4/css/chatbot.css (added)
-
tags/1.6.4/images (added)
-
tags/1.6.4/images/buymeacoffee.gif (added)
-
tags/1.6.4/images/icon-bot.png (added)
-
tags/1.6.4/images/icon-closed.gif (added)
-
tags/1.6.4/images/icon-open.png (added)
-
tags/1.6.4/images/icon-user.png (added)
-
tags/1.6.4/images/loading.gif (added)
-
tags/1.6.4/index.html (added)
-
tags/1.6.4/js (added)
-
tags/1.6.4/js/chatbot-admin.js (added)
-
tags/1.6.4/js/chatbot.js (added)
-
tags/1.6.4/js/marked.min.js (added)
-
tags/1.6.4/js/purify.min.js (added)
-
tags/1.6.4/languages (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-de_AT.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-de_AT.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-de_BE.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-de_BE.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-de_CH.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-de_CH.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-de_DE.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-de_DE.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_AR.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_AR.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_BO.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_BO.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_CL.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_CL.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_CO.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_CO.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_CR.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_CR.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_CU.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_CU.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_DO.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_DO.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_EC.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_EC.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_ES.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_ES.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_GT.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_GT.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_HN.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_HN.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_MX.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_MX.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_PA.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_PA.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_PE.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_PE.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_PY.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_PY.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_SV.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_SV.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_US.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_US.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_UY.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_UY.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_VE.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-es_VE.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-fr_BE.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-fr_BE.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-fr_CA.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-fr_CA.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-fr_CH.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-fr_CH.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-fr_DZ.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-fr_DZ.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-fr_FR.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-fr_FR.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-fr_MA.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-fr_MA.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-fr_TN.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-fr_TN.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-it_IT.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-it_IT.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-pt_BR.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-pt_BR.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-pt_PT.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-pt_PT.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-ru_RU.mo (added)
-
tags/1.6.4/languages/chatbot-ai-free-models-ru_RU.po (added)
-
tags/1.6.4/languages/chatbot-ai-free-models.pot (added)
-
tags/1.6.4/readme.txt (added)
-
tags/1.6.4/sounds (added)
-
tags/1.6.4/sounds/notification.mp3 (added)
-
tags/1.6.4/wp-chatbot.php (added)
-
trunk/chatbot-admin.php (modified) (3 diffs)
-
trunk/css/chatbot.css (modified) (1 diff)
-
trunk/js/chatbot-admin.js (modified) (5 diffs)
-
trunk/js/chatbot.js (modified) (3 diffs)
-
trunk/languages/chatbot-ai-free-models-it_IT.mo (modified) (previous)
-
trunk/languages/chatbot-ai-free-models-it_IT.po (modified) (32 diffs)
-
trunk/languages/chatbot-ai-free-models.pot (modified) (29 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/wp-chatbot.php (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
chatbot-ai-free-models/trunk/chatbot-admin.php
r3348456 r3363841 550 550 <?php 551 551 global $wpdb; 552 $ table_name = $wpdb->prefix . 'newcodebyte_chatbot_messages';553 554 // Query per raggruppare i messaggi in conversazioni, leggendo dalla tabella MySQL. 552 $messages_table = $wpdb->prefix . 'newcodebyte_chatbot_messages'; 553 $conversations_table = $wpdb->prefix . 'newcodebyte_chatbot_conversations'; 554 555 555 $conversations_query = " 556 556 SELECT 557 conversation_id, 558 MAX(CASE WHEN user_name IS NOT NULL AND user_name != '' THEN user_name ELSE NULL END) as user_name, 559 MAX(CASE WHEN user_email IS NOT NULL AND user_email != '' THEN user_email ELSE NULL END) as user_email, 560 MAX(CASE WHEN sender = 'User' THEN ip ELSE NULL END) as ip, 561 MIN(date) as start_date, 562 COUNT(id) as message_count 563 FROM $table_name 564 WHERE conversation_id IS NOT NULL AND conversation_id != '' 565 GROUP BY conversation_id 566 ORDER BY MIN(date) DESC 557 conv.id as conversation_id, 558 conv.start_date, 559 MIN(msg.is_read) as is_read, 560 COUNT(msg.id) as message_count, 561 MAX(CASE WHEN msg.user_name IS NOT NULL AND msg.user_name != '' THEN msg.user_name ELSE NULL END) as user_name, 562 MAX(CASE WHEN msg.user_email IS NOT NULL AND msg.user_email != '' THEN msg.user_email ELSE NULL END) as user_email, 563 MAX(CASE WHEN msg.sender = 'User' THEN msg.ip ELSE NULL END) as ip 564 FROM $conversations_table as conv 565 JOIN $messages_table as msg ON conv.id = msg.conversation_id 566 GROUP BY conv.id 567 ORDER BY conv.start_date DESC 567 568 "; 568 569 569 // Eseguiamo la query in modo sicuro570 570 $conversations = $wpdb->get_results($conversations_query, ARRAY_A); 571 571 … … 578 578 579 579 if (!empty($row['user_name'])) { 580 $display_name = '<strong>' . esc_html($row['user_name']) . '</strong>';580 $display_name = esc_html($row['user_name']); 581 581 } 582 582 … … 585 585 $user_details = '<br><small>' . esc_html($row['user_email']) . '</small>'; 586 586 } else { 587 $display_name = '<strong>' . esc_html($row['user_email']) . '</strong>';587 $display_name = esc_html($row['user_email']); 588 588 } 589 589 } 590 590 591 591 if (!$display_name) { 592 $display_name = '<strong>' . esc_html__('Anonymous User', 'chatbot-ai-free-models') . '</strong>'; 592 $display_name = esc_html__('Anonymous User', 'chatbot-ai-free-models'); 593 } 594 595 // --- LOGICA CORRETTA PER CLASSE E TOOLTIP --- 596 $row_class = 'conversation-row'; 597 if (isset($row['is_read']) && intval($row['is_read']) === 0) { 598 $row_class .= ' unread'; 593 599 } 594 600 ?> 595 <tr class=" conversation-row" data-conv-id="<?php echo esc_attr($row['conversation_id']); ?>" title="<?php esc_attr_e('Click to view messages', 'chatbot-ai-free-models'); ?>" >601 <tr class="<?php echo esc_attr($row_class); ?>" data-conv-id="<?php echo esc_attr($row['conversation_id']); ?>" title="<?php esc_attr_e('Click to view messages', 'chatbot-ai-free-models'); ?>" > 596 602 <td><?php echo $display_name . $user_details; ?></td> 597 603 <td><?php echo esc_html($row['ip']); ?></td> 598 604 <td><?php echo esc_html($row['start_date']); ?></td> 599 605 <td><?php echo esc_html($row['message_count']); ?></td> 600 <td><?php echo esc_html($row['conversation_id']); ?></td>606 <td><?php echo 'Chat_' . esc_html($row['conversation_id']); ?></td> 601 607 </tr> 602 608 <tr class="messages-container" id="messages-for-<?php echo esc_attr($row['conversation_id']); ?>" style="display: none;"> -
chatbot-ai-free-models/trunk/css/chatbot.css
r3349202 r3363841 660 660 box-shadow: none; 661 661 } 662 663 /* 664 ===================================================== 665 Stili per Conversazioni Non Lette nel Pannello Admin 666 ===================================================== 667 */ 668 #chatbot-conversations-table tr.unread td { 669 font-weight: bold; 670 } 671 672 #chatbot-conversations-table tr.unread:hover td { 673 background-color: #cfcfcf; /* Sfondo leggermente rosato al passaggio del mouse */ 674 } -
chatbot-ai-free-models/trunk/js/chatbot-admin.js
r3344781 r3363841 5 5 // Definiamo una sola costante per accedere all'oggetto globale. LA USIAMO OVUNQUE. 6 6 const adminVars = chatbot_admin_vars; 7 8 // Rimuoviamo la riga "const { ... }" che creava confusione.9 7 10 8 function updateCounter(textareaIdPrefix, charactersSpanID, tokensSpanID) { … … 265 263 var $innerBox = $messagesContainer.find('.inner-messages-box'); 266 264 265 // 1. Se la riga è non letta, invia una chiamata AJAX separata per marcarla come letta. 266 if ($this.hasClass('unread')) { 267 $this.removeClass('unread'); 268 269 $.ajax({ 270 url: adminVars.ajaxurl, 271 type: 'POST', 272 data: { 273 action: 'newcodebyte_chatbot_mark_as_read', 274 nonce: adminVars.get_messages_nonce, 275 conversation_id: convId 276 }, 277 success: function(response) { 278 if (!response.success) { 279 $this.addClass('unread'); 280 } 281 }, 282 error: function(xhr) { 283 $this.addClass('unread'); 284 } 285 }); 286 } 287 288 // 2. Gestisci la visualizzazione dei messaggi (apri/chiudi). 267 289 if ($messagesContainer.is(':visible')) { 268 290 $messagesContainer.slideUp(200); … … 273 295 $('.messages-container').not($messagesContainer).slideUp(200); 274 296 $('.conversation-row').not($this).css('cursor', 'zoom-in').removeClass('is-open'); 275 276 297 $messagesContainer.slideDown(200); 277 298 $this.css('cursor', 'zoom-out').addClass('is-open'); 278 299 300 // 3. Se i messaggi non sono ancora stati caricati, esegui la chiamata AJAX per caricarli. 279 301 if (!$innerBox.hasClass('loaded')) { 280 302 $.ajax({ … … 287 309 }, 288 310 beforeSend: function() { 289 $innerBox.html('<div class="loading-messages">Loading messages...</div>'); 311 // CORREZIONE: Usa la variabile passata da wp_localize_script 312 $innerBox.html('<div class="loading-messages">' + adminVars.loading_messages + '</div>'); 290 313 }, 291 314 success: function(response) { … … 296 319 } 297 320 }, 298 error: function( ) {321 error: function(xhr) { 299 322 $innerBox.html('<div class="error-messages">An error occurred while loading messages.</div>'); 300 323 } -
chatbot-ai-free-models/trunk/js/chatbot.js
r3348456 r3363841 157 157 } 158 158 159 function getConversationId() { 160 if (currentConversationId) return currentConversationId; 161 let storedId = null; 162 try { 163 storedId = sessionStorage.getItem('newcodebyteChatbotConversationId'); 164 } catch (e) { 165 console.warn('Chatbot: sessionStorage not accessible.'); 166 } 167 168 if (!storedId) { 169 storedId = 'chat_' + Date.now(); 170 try { 171 sessionStorage.setItem('newcodebyteChatbotConversationId', storedId); 172 } catch (e) { 173 console.warn('Chatbot: Could not save ID to sessionStorage.'); 174 } 175 } 176 currentConversationId = storedId; 177 return currentConversationId; 178 } 159 function getConversationId() { 160 if (currentConversationId) return currentConversationId; 161 162 try { 163 currentConversationId = sessionStorage.getItem('newcodebyteChatbotConversationId'); 164 } catch (e) { 165 console.warn('Chatbot: sessionStorage not accessible.'); 166 } 167 168 return currentConversationId; 169 } 179 170 180 171 $(window).on('resize scroll', function() { … … 222 213 } 223 214 224 function sendMessageToServer(message) {225 var conversationId = getConversationId();226 var ajaxData = {227 action: 'newcodebyte_chatbot_send_message',228 message: message,229 conversation_id: conversationId,230 newcodebyte_chatbot_message_nonce: chatbot_ajax.newcodebyte_chatbot_message_nonce231 };215 function sendMessageToServer(message) { 216 var conversationId = getConversationId(); // Potrebbe essere null 217 var ajaxData = { 218 action: 'newcodebyte_chatbot_send_message', 219 message: message, 220 conversation_id: conversationId, // Invia l'ID o null 221 newcodebyte_chatbot_message_nonce: chatbot_ajax.newcodebyte_chatbot_message_nonce 222 }; 232 223 233 224 if (userInfo) { … … 248 239 } 249 240 250 function handleServerResponse(response) { 251 $('.chat-message.loading').remove(); 241 function handleServerResponse(response) { 242 $('.chat-message.loading').remove(); 243 244 if (response.success && response.data.conversation_id) { 245 currentConversationId = response.data.conversation_id; 246 try { 247 sessionStorage.setItem('newcodebyteChatbotConversationId', currentConversationId); 248 } catch (e) { 249 console.warn('Chatbot: Could not save ID to sessionStorage.'); 250 } 251 } 252 252 253 253 if (!response || !response.success || typeof response.data === 'undefined' || typeof response.data.message === 'undefined') { -
chatbot-ai-free-models/trunk/languages/chatbot-ai-free-models-it_IT.po
r3348456 r3363841 2 2 msgstr "" 3 3 "Project-Id-Version: Chatbot AI Free\n" 4 "POT-Creation-Date: 2025-0 8-21 16:03+0200\n"5 "PO-Revision-Date: 2025-0 8-21 16:13+0200\n"4 "POT-Creation-Date: 2025-09-18 11:13+0200\n" 5 "PO-Revision-Date: 2025-09-18 11:17+0200\n" 6 6 "Last-Translator: \n" 7 7 "Language-Team: \n" … … 32 32 #: chatbot-admin.php:67 chatbot-admin.php:123 chatbot-admin.php:186 33 33 #: chatbot-admin.php:214 chatbot-admin.php:228 chatbot-admin.php:238 34 #: wp-chatbot.php:2 68 wp-chatbot.php:533 wp-chatbot.php:55734 #: wp-chatbot.php:286 wp-chatbot.php:546 wp-chatbot.php:571 35 35 msgid "Security check failed." 36 36 msgstr "Controllo di sicurezza fallito." … … 41 41 msgstr "Errore" 42 42 43 #: chatbot-admin.php:74 chatbot-admin.php:256 wp-chatbot.php:2 2743 #: chatbot-admin.php:74 chatbot-admin.php:256 wp-chatbot.php:245 44 44 msgid "Hello! How can I assist you today?" 45 45 msgstr "Ciao! Come posso aiutarti oggi?" … … 312 312 msgstr "Descrizione Form" 313 313 314 #: chatbot-admin.php:499 chatbot-admin.php:523 chatbot-admin.php:68 2315 #: chatbot-admin.php:7 55 chatbot-admin.php:781 chatbot-admin.php:839314 #: chatbot-admin.php:499 chatbot-admin.php:523 chatbot-admin.php:688 315 #: chatbot-admin.php:761 chatbot-admin.php:787 chatbot-admin.php:845 316 316 msgid "Save settings" 317 317 msgstr "Salva impostazioni" … … 369 369 msgstr "Nessun messaggio trovato." 370 370 371 #: chatbot-admin.php:592 wp-chatbot.php:7 16371 #: chatbot-admin.php:592 wp-chatbot.php:733 372 372 msgid "Anonymous User" 373 373 msgstr "Utente Anonimo" 374 374 375 #: chatbot-admin.php: 595375 #: chatbot-admin.php:601 376 376 msgid "Click to view messages" 377 377 msgstr "Clicca per vedere i messaggi" 378 378 379 #: chatbot-admin.php:6 05379 #: chatbot-admin.php:611 wp-chatbot.php:859 380 380 msgid "Loading messages..." 381 381 msgstr "Caricamento dei messaggi..." 382 382 383 #: chatbot-admin.php:62 3383 #: chatbot-admin.php:629 384 384 msgid "Header background color" 385 385 msgstr "Colore di sfondo dell'intestazione" 386 386 387 #: chatbot-admin.php:6 27387 #: chatbot-admin.php:633 388 388 msgid "Header text color" 389 389 msgstr "Colore del testo dell'intestazione" 390 390 391 #: chatbot-admin.php:63 1391 #: chatbot-admin.php:637 392 392 msgid "Chatbox background color" 393 393 msgstr "Colore di sfondo della chatbox" 394 394 395 #: chatbot-admin.php:6 35395 #: chatbot-admin.php:641 396 396 msgid "User message background color" 397 397 msgstr "Colore di sfondo del messaggio utente" 398 398 399 #: chatbot-admin.php:6 39399 #: chatbot-admin.php:645 400 400 msgid "User message text color" 401 401 msgstr "Colore del testo del messaggio utente" 402 402 403 #: chatbot-admin.php:64 3403 #: chatbot-admin.php:649 404 404 msgid "Bot message background color" 405 405 msgstr "Colore di sfondo del messaggio del bot" 406 406 407 #: chatbot-admin.php:6 47407 #: chatbot-admin.php:653 408 408 msgid "Bot message text color" 409 409 msgstr "Colore del testo del messaggio del bot" 410 410 411 #: chatbot-admin.php:65 1411 #: chatbot-admin.php:657 412 412 msgid "Send button background color" 413 413 msgstr "Colore di sfondo del pulsante di invio" 414 414 415 #: chatbot-admin.php:6 55415 #: chatbot-admin.php:661 416 416 msgid "Send button text color" 417 417 msgstr "Colore del testo del pulsante di invio" 418 418 419 #: chatbot-admin.php:66 0419 #: chatbot-admin.php:666 420 420 msgid "Chat Window Height" 421 421 msgstr "Altezza della Finestra di Chat" 422 422 423 #: chatbot-admin.php:6 64423 #: chatbot-admin.php:670 424 424 msgid "" 425 425 "Set the height of the chat window on desktop. Default: 600px. (Min: 300, " … … 429 429 "(Minimo: 300, Massimo: 1000)" 430 430 431 #: chatbot-admin.php:6 68431 #: chatbot-admin.php:674 432 432 msgid "Chatbot Position" 433 433 msgstr "Posizione Chatbot" 434 434 435 #: chatbot-admin.php:67 2435 #: chatbot-admin.php:678 436 436 msgid "Bottom Right" 437 437 msgstr "Basso a destra" 438 438 439 #: chatbot-admin.php:6 75439 #: chatbot-admin.php:681 440 440 msgid "Bottom Left" 441 441 msgstr "Basso a sinistra" 442 442 443 #: chatbot-admin.php:6 78443 #: chatbot-admin.php:684 444 444 msgid "Choose which corner of the screen the chatbot button should appear in." 445 445 msgstr "" 446 446 "Scegli in quale angolo dello schermo deve apparire il pulsante del chatbot." 447 447 448 #: chatbot-admin.php:69 1448 #: chatbot-admin.php:697 449 449 msgid "User Avatar" 450 450 msgstr "Avatar Utente" 451 451 452 #: chatbot-admin.php: 695452 #: chatbot-admin.php:701 453 453 msgid "User Avatar Preview" 454 454 msgstr "Anteprima Avatar Utente" 455 455 456 #: chatbot-admin.php:70 0 chatbot-admin.php:716 chatbot-admin.php:732457 #: chatbot-admin.php:7 48456 #: chatbot-admin.php:706 chatbot-admin.php:722 chatbot-admin.php:738 457 #: chatbot-admin.php:754 458 458 msgid "Upload Image" 459 459 msgstr "Carica Immagine" 460 460 461 #: chatbot-admin.php:70 3 chatbot-admin.php:719 chatbot-admin.php:735462 #: chatbot-admin.php:75 1461 #: chatbot-admin.php:709 chatbot-admin.php:725 chatbot-admin.php:741 462 #: chatbot-admin.php:757 463 463 msgid "Accepted formats: JPG, PNG, GIF" 464 464 msgstr "Formati accettati: JPG, PNG, GIF" 465 465 466 #: chatbot-admin.php:7 07466 #: chatbot-admin.php:713 467 467 msgid "Bot Avatar" 468 468 msgstr "Avatar Bot" 469 469 470 #: chatbot-admin.php:71 1470 #: chatbot-admin.php:717 471 471 msgid "Bot Avatar Preview" 472 472 msgstr "Anteprima Avatar Bot" 473 473 474 #: chatbot-admin.php:72 3474 #: chatbot-admin.php:729 475 475 msgid "Chat Open Icon" 476 476 msgstr "Icona Chat Aperta" 477 477 478 #: chatbot-admin.php:7 27478 #: chatbot-admin.php:733 479 479 msgid "Chat Open Icon Preview" 480 480 msgstr "Anteprima Icona Chat Aperta" 481 481 482 #: chatbot-admin.php:7 39482 #: chatbot-admin.php:745 483 483 msgid "Chat Closed Icon" 484 484 msgstr "Icona Chat Chiusa" 485 485 486 #: chatbot-admin.php:74 3486 #: chatbot-admin.php:749 487 487 msgid "Chat Closed Icon Preview" 488 488 msgstr "Anteprima Icona Chat Chiusa" 489 489 490 #: chatbot-admin.php:7 64490 #: chatbot-admin.php:770 491 491 msgid "Notification Sound" 492 492 msgstr "Suono di Notifica" 493 493 494 #: chatbot-admin.php:7 68494 #: chatbot-admin.php:774 495 495 msgid "Upload Sound" 496 496 msgstr "Carica Suono" 497 497 498 #: chatbot-admin.php:77 3498 #: chatbot-admin.php:779 499 499 msgid "Current sound file:" 500 500 msgstr "File audio attuale:" 501 501 502 #: chatbot-admin.php:7 77502 #: chatbot-admin.php:783 503 503 msgid "" 504 504 "Upload a custom sound for new notifications (MP3, WAV, or OGG format). If no " … … 508 508 "OGG). Se non viene caricato alcun suono, verrà utilizzato quello predefinito." 509 509 510 #: chatbot-admin.php:7 86510 #: chatbot-admin.php:792 511 511 msgid "Chatbot AI Free Models - Guide" 512 512 msgstr "Chatbot AI Free Models - Guida" 513 513 514 #: chatbot-admin.php:7 87514 #: chatbot-admin.php:793 515 515 msgid "" 516 516 "Thank you for installing Chatbot AI Free Models! This guide will help you " … … 520 520 "configurare il plugin e a ottenere il massimo da esso." 521 521 522 #: chatbot-admin.php:7 88522 #: chatbot-admin.php:794 523 523 msgid "Basic Configuration" 524 524 msgstr "Configurazione di base" 525 525 526 #: chatbot-admin.php:7 89526 #: chatbot-admin.php:795 527 527 msgid "" 528 528 "Get an API Key: This plugin uses the OpenRouter API. Get your free API key at" … … 531 531 "tua chiave API gratuita su" 532 532 533 #: chatbot-admin.php:7 89533 #: chatbot-admin.php:795 534 534 msgid "" 535 535 "OpenRouter offers access to over 300 models, including ChatGPT, Claude, " … … 545 545 "senza complicazioni!" 546 546 547 #: chatbot-admin.php:79 0547 #: chatbot-admin.php:796 548 548 msgid "" 549 549 "Enter your API Key: Go to the \"Settings\" tab and enter your OpenRouter API " … … 553 553 "tua chiave API OpenRouter nel campo \"Chiave API\"." 554 554 555 #: chatbot-admin.php:79 1555 #: chatbot-admin.php:797 556 556 msgid "" 557 557 "Choose a Model: Select an AI model from the \"Model\" dropdown. Free models " … … 566 566 "indipendentemente dal provider originale." 567 567 568 #: chatbot-admin.php:79 2568 #: chatbot-admin.php:798 569 569 msgid "" 570 570 "Provide Context: In the \"Information for responses\" field, enter " … … 575 575 "rispondere alle query degli utenti in modo più accurato." 576 576 577 #: chatbot-admin.php:79 3577 #: chatbot-admin.php:799 578 578 msgid "" 579 579 "Set the bot's behavior: In the \"Behavior type\" field, enter instructions " … … 583 583 "inserisci istruzioni sul comportamento del bot." 584 584 585 #: chatbot-admin.php: 794585 #: chatbot-admin.php:800 586 586 msgid "" 587 587 "Save Settings: Click \"Save settings\". Remember to refresh your website " … … 594 594 "correttamente a causa della cache." 595 595 596 #: chatbot-admin.php: 795596 #: chatbot-admin.php:801 597 597 msgid "Customization" 598 598 msgstr "Personalizzazione" 599 599 600 #: chatbot-admin.php: 796600 #: chatbot-admin.php:802 601 601 msgid "" 602 602 "You can customize the appearance of the chatbot in the \"Style\" and \"Images" … … 606 606 "\"." 607 607 608 #: chatbot-admin.php: 797608 #: chatbot-admin.php:803 609 609 msgid "" 610 610 "Style: Change the colors of the header, chatbox, messages, and send button." … … 613 613 "pulsante di invio." 614 614 615 #: chatbot-admin.php: 798615 #: chatbot-admin.php:804 616 616 msgid "" 617 617 "Images: Change the avatars for the user and bot, and the icons for the chat " … … 621 621 "della chat." 622 622 623 #: chatbot-admin.php: 799623 #: chatbot-admin.php:805 624 624 msgid "" 625 625 "Sounds: In the tab \"Sounds\", you can change the default sound when opening " … … 630 630 "un file audio in formato MP3." 631 631 632 #: chatbot-admin.php:80 0632 #: chatbot-admin.php:806 633 633 msgid "Troubleshooting" 634 634 msgstr "Risoluzione dei problemi" 635 635 636 #: chatbot-admin.php:80 1636 #: chatbot-admin.php:807 637 637 msgid "" 638 638 "Changes not appearing? After making changes, press Ctrl+F5 (or Cmd+Shift+R " … … 643 643 "del browser." 644 644 645 #: chatbot-admin.php:80 2645 #: chatbot-admin.php:808 646 646 msgid "" 647 647 "Bot not responding? Check your API key and make sure it's valid. Also, check " … … 652 652 "se ci sono problemi noti." 653 653 654 #: chatbot-admin.php:80 3654 #: chatbot-admin.php:809 655 655 msgid "Managing Messages" 656 656 msgstr "Gestione dei messaggi" 657 657 658 #: chatbot-admin.php:8 04658 #: chatbot-admin.php:810 659 659 msgid "You can view and export the messages in the \"Messages\" tab." 660 660 msgstr "Puoi visualizzare ed esportare i messaggi nella scheda \"Messaggi\"." 661 661 662 #: chatbot-admin.php:8 05662 #: chatbot-admin.php:811 663 663 msgid "View: See all chat messages." 664 664 msgstr "Visualizza: visualizza tutti i messaggi della chat." 665 665 666 #: chatbot-admin.php:8 06666 #: chatbot-admin.php:812 667 667 msgid "Export: Export the messages in various formats (TXT, CSV, MD, HTML)." 668 668 msgstr "Esporta: esporta i messaggi in vari formati (TXT, CSV, MD, HTML)." 669 669 670 #: chatbot-admin.php:8 07670 #: chatbot-admin.php:813 671 671 msgid "Delete: Delete all chat messages." 672 672 msgstr "Elimina: elimina tutti i messaggi della chat." 673 673 674 #: chatbot-admin.php:8 08674 #: chatbot-admin.php:814 675 675 msgid "Saving messages" 676 676 msgstr "Salvataggio messaggi" 677 677 678 #: chatbot-admin.php:8 09678 #: chatbot-admin.php:815 679 679 msgid "You can enable or disable saving messages in the \"Messages\" tab." 680 680 msgstr "" … … 682 682 "\"Messaggi\"." 683 683 684 #: chatbot-admin.php:81 0684 #: chatbot-admin.php:816 685 685 msgid "" 686 686 "If enabled, all chat messages and IP will be saved in the database. If " … … 690 690 "database. Se disabilitato, nessun messaggio della chat verrà salvato." 691 691 692 #: chatbot-admin.php:81 1692 #: chatbot-admin.php:817 693 693 msgid "" 694 694 "Important: If you enable message saving, be sure to update your privacy " … … 698 698 "la tua politica sulla privacy per riflettere questa pratica di raccolta dati." 699 699 700 #: chatbot-admin.php:81 2700 #: chatbot-admin.php:818 701 701 msgid "Enabling \"Powered by NewCodeByte\"" 702 702 msgstr "Abilitazione di \"Powered by NewCodeByte\"" 703 703 704 #: chatbot-admin.php:81 3704 #: chatbot-admin.php:819 705 705 msgid "" 706 706 "Enabling \"Powered by NewCodeByte\" helps me support the development of this " … … 712 712 "favore considera di abilitarlo!" 713 713 714 #: chatbot-admin.php:8 16714 #: chatbot-admin.php:822 715 715 #, php-format 716 716 msgid "" … … 721 721 "supportarmi con una donazione su Buy Me a Coffee tramite %s." 722 722 723 #: chatbot-admin.php:8 17723 #: chatbot-admin.php:823 724 724 msgid "Buy Me a Coffee" 725 725 msgstr "Buy Me a Coffee" 726 726 727 #: chatbot-admin.php:8 19727 #: chatbot-admin.php:825 728 728 msgid "" 729 729 "All donations are greatly appreciated and will help me continue to improve " … … 733 733 "migliorare e mantenere questo plugin." 734 734 735 #: chatbot-admin.php:8 27735 #: chatbot-admin.php:833 736 736 msgid "Show \"Powered by NewCodeByte\"?" 737 737 msgstr "Mostrare \"Powered by NewCodeByte\"?" 738 738 739 #: chatbot-admin.php:8 34739 #: chatbot-admin.php:840 740 740 msgid "Yes, show the link to support the plugin." 741 741 msgstr "Sì, mostra il link per supportare il plugin." 742 742 743 #: chatbot-admin.php:8 49743 #: chatbot-admin.php:855 744 744 msgid "" 745 745 "Boost visitor engagement with a powerful AI Chatbot for WordPress. " … … 755 755 "una singola chiave API facile da usare." 756 756 757 #: chatbot-admin.php:8 59757 #: chatbot-admin.php:865 758 758 msgid "" 759 759 "The complete manager for external links. Opens in new tabs, handles dynamic " … … 768 768 "scelta professionale per i siti moderni." 769 769 770 #: chatbot-admin.php:8 69770 #: chatbot-admin.php:875 771 771 msgid "" 772 772 "Your all-in-one suite for total link control and site maintenance. Manage " … … 782 782 "link rotti dal tuo sito. La scelta professionale per ottimizzare la tua SEO." 783 783 784 #: wp-chatbot.php:1 37784 #: wp-chatbot.php:144 785 785 msgid "Chatbot AI - Action Required:" 786 786 msgstr "Chatbot AI - Azione Richiesta:" 787 787 788 #: wp-chatbot.php:1 38788 #: wp-chatbot.php:145 789 789 msgid "" 790 790 "The chatbot database setup is incomplete. Please deactivate and reactivate " … … 795 795 "l'installazione." 796 796 797 #: wp-chatbot.php:152 797 #: wp-chatbot.php:159 wp-chatbot.php:490 wp-chatbot.php:870 798 msgid "Chatbot" 799 msgstr "Chatbot" 800 801 #: wp-chatbot.php:170 798 802 msgid "Chatbot Settings" 799 803 msgstr "Impostazioni Chatbot" 800 804 801 #: wp-chatbot.php:153 wp-chatbot.php:475 wp-chatbot.php:852 802 msgid "Chatbot" 803 msgstr "Chatbot" 804 805 #: wp-chatbot.php:224 wp-chatbot.php:489 wp-chatbot.php:862 805 #: wp-chatbot.php:242 wp-chatbot.php:504 wp-chatbot.php:880 806 806 msgid "Type your message..." 807 807 msgstr "Scrivi un messaggio..." 808 808 809 #: wp-chatbot.php:2 25 wp-chatbot.php:490 wp-chatbot.php:863809 #: wp-chatbot.php:243 wp-chatbot.php:505 wp-chatbot.php:881 810 810 msgid "Send" 811 811 msgstr "Invia" 812 812 813 #: wp-chatbot.php:2 26813 #: wp-chatbot.php:244 814 814 msgid "There was an error." 815 815 msgstr "Si è verificato un errore." 816 816 817 #: wp-chatbot.php:2 30817 #: wp-chatbot.php:248 818 818 msgid "Before we start chatting" 819 819 msgstr "Prima di iniziare a chattare" 820 820 821 #: wp-chatbot.php:2 31821 #: wp-chatbot.php:249 822 822 msgid "Please provide the following information:" 823 823 msgstr "Per favore, inserisci le seguenti informazioni:" 824 824 825 #: wp-chatbot.php:2 32825 #: wp-chatbot.php:250 826 826 msgid "Name" 827 827 msgstr "Nome" 828 828 829 #: wp-chatbot.php:2 33829 #: wp-chatbot.php:251 830 830 msgid "Email" 831 831 msgstr "Email" 832 832 833 #: wp-chatbot.php:2 34833 #: wp-chatbot.php:252 834 834 msgid "Start Chat" 835 835 msgstr "Avvia Chat" 836 836 837 #: wp-chatbot.php:2 35837 #: wp-chatbot.php:253 838 838 msgid "Please fill in all required fields." 839 839 msgstr "Per favore, compila tutti i campi obbligatori." 840 840 841 #: wp-chatbot.php:2 48841 #: wp-chatbot.php:266 842 842 msgid "Have a question? Ask me!" 843 843 msgstr "Hai una domanda? Chiedi pure!" 844 844 845 #: wp-chatbot.php:3 40 wp-chatbot.php:454 wp-chatbot.php:471845 #: wp-chatbot.php:355 wp-chatbot.php:469 wp-chatbot.php:486 846 846 msgid "Sorry, I was unable to get a response from the server." 847 847 msgstr "" 848 848 "Siamo spiacenti, non è stato possibile ottenere una risposta dal server." 849 849 850 #: wp-chatbot.php:3 41850 #: wp-chatbot.php:356 851 851 msgid "API Error:" 852 852 msgstr "Errore API:" 853 853 854 #: wp-chatbot.php: 397854 #: wp-chatbot.php:412 855 855 #, php-format 856 856 msgid "" … … 867 867 "%3$s" 868 868 869 #: wp-chatbot.php:4 13869 #: wp-chatbot.php:428 870 870 msgid "You are a helpful assistant." 871 871 msgstr "Sei un assistente molto disponibile." 872 872 873 #: wp-chatbot.php:4 67873 #: wp-chatbot.php:482 874 874 #, php-format 875 875 msgid "API Error: %s" 876 876 msgstr "Errore API: %s" 877 877 878 #: wp-chatbot.php: 497 wp-chatbot.php:867878 #: wp-chatbot.php:512 wp-chatbot.php:885 879 879 #, php-format 880 880 msgid "Powered by %s" 881 881 msgstr "Powered by %s" 882 882 883 #: wp-chatbot.php:5 29 wp-chatbot.php:553883 #: wp-chatbot.php:542 wp-chatbot.php:567 884 884 msgid "You do not have permission to perform this action." 885 885 msgstr "Non hai l'autorizzazione per eseguire questa azione." 886 886 887 #: wp-chatbot.php:5 44887 #: wp-chatbot.php:559 888 888 msgid "All messages have been deleted." 889 889 msgstr "Tutti i messaggi sono stati eliminati." 890 890 891 #: wp-chatbot.php:5 61891 #: wp-chatbot.php:575 892 892 msgid "Export format not specified." 893 893 msgstr "Formato di esportazione non specificato." 894 894 895 #: wp-chatbot.php:5 68895 #: wp-chatbot.php:582 896 896 msgid "Invalid format specified." 897 897 msgstr "Formato di esportazione non specificato." 898 898 899 #: wp-chatbot.php:8 34899 #: wp-chatbot.php:851 900 900 msgid "Are you sure you want to delete all messages?" 901 901 msgstr "Sei sicuro di voler eliminare tutti i messaggi?" 902 902 903 #: wp-chatbot.php:8 35903 #: wp-chatbot.php:852 904 904 msgid "Error while deleting messages." 905 905 msgstr "Errore durante l'eliminazione dei messaggi." 906 906 907 #: wp-chatbot.php:8 36907 #: wp-chatbot.php:853 908 908 msgid "Select an export format." 909 909 msgstr "Seleziona un formato di esportazione." 910 910 911 #: wp-chatbot.php:8 37911 #: wp-chatbot.php:854 912 912 msgid "Error loading the image." 913 913 msgstr "Errore durante il caricamento dell'immagine." 914 914 915 #: wp-chatbot.php:8 38915 #: wp-chatbot.php:855 916 916 msgid "Choose an Image" 917 917 msgstr "Scegli una Immagine" 918 918 919 #: wp-chatbot.php:8 39919 #: wp-chatbot.php:856 920 920 msgid "Use this Image" 921 921 msgstr "Usa questa Immagine" 922 923 #: wp-chatbot.php:1034 924 #, php-format 925 msgid "You have %d unread conversation." 926 msgid_plural "You have %d unread conversations." 927 msgstr[0] "Hai %d conversazione non letta." 928 msgstr[1] "Hai %d conversazioni non lette." 922 929 923 930 #. Plugin Name of the plugin/theme -
chatbot-ai-free-models/trunk/languages/chatbot-ai-free-models.pot
r3348456 r3363841 3 3 msgstr "" 4 4 "Project-Id-Version: Chatbot AI Free\n" 5 "POT-Creation-Date: 2025-0 8-21 16:03+0200\n"5 "POT-Creation-Date: 2025-09-18 11:13+0200\n" 6 6 "PO-Revision-Date: 2025-02-06 12:35+0100\n" 7 7 "Last-Translator: \n" … … 32 32 #: chatbot-admin.php:67 chatbot-admin.php:123 chatbot-admin.php:186 33 33 #: chatbot-admin.php:214 chatbot-admin.php:228 chatbot-admin.php:238 34 #: wp-chatbot.php:2 68 wp-chatbot.php:533 wp-chatbot.php:55734 #: wp-chatbot.php:286 wp-chatbot.php:546 wp-chatbot.php:571 35 35 msgid "Security check failed." 36 36 msgstr "" … … 41 41 msgstr "" 42 42 43 #: chatbot-admin.php:74 chatbot-admin.php:256 wp-chatbot.php:2 2743 #: chatbot-admin.php:74 chatbot-admin.php:256 wp-chatbot.php:245 44 44 msgid "Hello! How can I assist you today?" 45 45 msgstr "" … … 281 281 msgstr "" 282 282 283 #: chatbot-admin.php:499 chatbot-admin.php:523 chatbot-admin.php:68 2284 #: chatbot-admin.php:7 55 chatbot-admin.php:781 chatbot-admin.php:839283 #: chatbot-admin.php:499 chatbot-admin.php:523 chatbot-admin.php:688 284 #: chatbot-admin.php:761 chatbot-admin.php:787 chatbot-admin.php:845 285 285 msgid "Save settings" 286 286 msgstr "" … … 336 336 msgstr "" 337 337 338 #: chatbot-admin.php:592 wp-chatbot.php:7 16338 #: chatbot-admin.php:592 wp-chatbot.php:733 339 339 msgid "Anonymous User" 340 340 msgstr "" 341 341 342 #: chatbot-admin.php: 595342 #: chatbot-admin.php:601 343 343 msgid "Click to view messages" 344 344 msgstr "" 345 345 346 #: chatbot-admin.php:6 05346 #: chatbot-admin.php:611 wp-chatbot.php:859 347 347 msgid "Loading messages..." 348 348 msgstr "" 349 349 350 #: chatbot-admin.php:62 3350 #: chatbot-admin.php:629 351 351 msgid "Header background color" 352 352 msgstr "" 353 353 354 #: chatbot-admin.php:6 27354 #: chatbot-admin.php:633 355 355 msgid "Header text color" 356 356 msgstr "" 357 357 358 #: chatbot-admin.php:63 1358 #: chatbot-admin.php:637 359 359 msgid "Chatbox background color" 360 360 msgstr "" 361 361 362 #: chatbot-admin.php:6 35362 #: chatbot-admin.php:641 363 363 msgid "User message background color" 364 364 msgstr "" 365 365 366 #: chatbot-admin.php:6 39366 #: chatbot-admin.php:645 367 367 msgid "User message text color" 368 368 msgstr "" 369 369 370 #: chatbot-admin.php:64 3370 #: chatbot-admin.php:649 371 371 msgid "Bot message background color" 372 372 msgstr "" 373 373 374 #: chatbot-admin.php:6 47374 #: chatbot-admin.php:653 375 375 msgid "Bot message text color" 376 376 msgstr "" 377 377 378 #: chatbot-admin.php:65 1378 #: chatbot-admin.php:657 379 379 msgid "Send button background color" 380 380 msgstr "" 381 381 382 #: chatbot-admin.php:6 55382 #: chatbot-admin.php:661 383 383 msgid "Send button text color" 384 384 msgstr "" 385 385 386 #: chatbot-admin.php:66 0386 #: chatbot-admin.php:666 387 387 msgid "Chat Window Height" 388 388 msgstr "" 389 389 390 #: chatbot-admin.php:6 64390 #: chatbot-admin.php:670 391 391 msgid "" 392 392 "Set the height of the chat window on desktop. Default: 600px. (Min: 300, " … … 394 394 msgstr "" 395 395 396 #: chatbot-admin.php:6 68396 #: chatbot-admin.php:674 397 397 msgid "Chatbot Position" 398 398 msgstr "" 399 399 400 #: chatbot-admin.php:67 2400 #: chatbot-admin.php:678 401 401 msgid "Bottom Right" 402 402 msgstr "" 403 403 404 #: chatbot-admin.php:6 75404 #: chatbot-admin.php:681 405 405 msgid "Bottom Left" 406 406 msgstr "" 407 407 408 #: chatbot-admin.php:6 78408 #: chatbot-admin.php:684 409 409 msgid "Choose which corner of the screen the chatbot button should appear in." 410 410 msgstr "" 411 411 412 #: chatbot-admin.php:69 1412 #: chatbot-admin.php:697 413 413 msgid "User Avatar" 414 414 msgstr "" 415 415 416 #: chatbot-admin.php: 695416 #: chatbot-admin.php:701 417 417 msgid "User Avatar Preview" 418 418 msgstr "" 419 419 420 #: chatbot-admin.php:70 0 chatbot-admin.php:716 chatbot-admin.php:732421 #: chatbot-admin.php:7 48420 #: chatbot-admin.php:706 chatbot-admin.php:722 chatbot-admin.php:738 421 #: chatbot-admin.php:754 422 422 msgid "Upload Image" 423 423 msgstr "" 424 424 425 #: chatbot-admin.php:70 3 chatbot-admin.php:719 chatbot-admin.php:735426 #: chatbot-admin.php:75 1425 #: chatbot-admin.php:709 chatbot-admin.php:725 chatbot-admin.php:741 426 #: chatbot-admin.php:757 427 427 msgid "Accepted formats: JPG, PNG, GIF" 428 428 msgstr "" 429 429 430 #: chatbot-admin.php:7 07430 #: chatbot-admin.php:713 431 431 msgid "Bot Avatar" 432 432 msgstr "" 433 433 434 #: chatbot-admin.php:71 1434 #: chatbot-admin.php:717 435 435 msgid "Bot Avatar Preview" 436 436 msgstr "" 437 437 438 #: chatbot-admin.php:72 3438 #: chatbot-admin.php:729 439 439 msgid "Chat Open Icon" 440 440 msgstr "" 441 441 442 #: chatbot-admin.php:7 27442 #: chatbot-admin.php:733 443 443 msgid "Chat Open Icon Preview" 444 444 msgstr "" 445 445 446 #: chatbot-admin.php:7 39446 #: chatbot-admin.php:745 447 447 msgid "Chat Closed Icon" 448 448 msgstr "" 449 449 450 #: chatbot-admin.php:74 3450 #: chatbot-admin.php:749 451 451 msgid "Chat Closed Icon Preview" 452 452 msgstr "" 453 453 454 #: chatbot-admin.php:7 64454 #: chatbot-admin.php:770 455 455 msgid "Notification Sound" 456 456 msgstr "" 457 457 458 #: chatbot-admin.php:7 68458 #: chatbot-admin.php:774 459 459 msgid "Upload Sound" 460 460 msgstr "" 461 461 462 #: chatbot-admin.php:77 3462 #: chatbot-admin.php:779 463 463 msgid "Current sound file:" 464 464 msgstr "" 465 465 466 #: chatbot-admin.php:7 77466 #: chatbot-admin.php:783 467 467 msgid "" 468 468 "Upload a custom sound for new notifications (MP3, WAV, or OGG format). If no " … … 470 470 msgstr "" 471 471 472 #: chatbot-admin.php:7 86472 #: chatbot-admin.php:792 473 473 msgid "Chatbot AI Free Models - Guide" 474 474 msgstr "" 475 475 476 #: chatbot-admin.php:7 87476 #: chatbot-admin.php:793 477 477 msgid "" 478 478 "Thank you for installing Chatbot AI Free Models! This guide will help you " … … 480 480 msgstr "" 481 481 482 #: chatbot-admin.php:7 88482 #: chatbot-admin.php:794 483 483 msgid "Basic Configuration" 484 484 msgstr "" 485 485 486 #: chatbot-admin.php:7 89486 #: chatbot-admin.php:795 487 487 msgid "" 488 488 "Get an API Key: This plugin uses the OpenRouter API. Get your free API key at" 489 489 msgstr "" 490 490 491 #: chatbot-admin.php:7 89491 #: chatbot-admin.php:795 492 492 msgid "" 493 493 "OpenRouter offers access to over 300 models, including ChatGPT, Claude, " … … 498 498 msgstr "" 499 499 500 #: chatbot-admin.php:79 0500 #: chatbot-admin.php:796 501 501 msgid "" 502 502 "Enter your API Key: Go to the \"Settings\" tab and enter your OpenRouter API " … … 504 504 msgstr "" 505 505 506 #: chatbot-admin.php:79 1506 #: chatbot-admin.php:797 507 507 msgid "" 508 508 "Choose a Model: Select an AI model from the \"Model\" dropdown. Free models " … … 512 512 msgstr "" 513 513 514 #: chatbot-admin.php:79 2514 #: chatbot-admin.php:798 515 515 msgid "" 516 516 "Provide Context: In the \"Information for responses\" field, enter " … … 518 518 msgstr "" 519 519 520 #: chatbot-admin.php:79 3520 #: chatbot-admin.php:799 521 521 msgid "" 522 522 "Set the bot's behavior: In the \"Behavior type\" field, enter instructions " … … 524 524 msgstr "" 525 525 526 #: chatbot-admin.php: 794526 #: chatbot-admin.php:800 527 527 msgid "" 528 528 "Save Settings: Click \"Save settings\". Remember to refresh your website " … … 531 531 msgstr "" 532 532 533 #: chatbot-admin.php: 795533 #: chatbot-admin.php:801 534 534 msgid "Customization" 535 535 msgstr "" 536 536 537 #: chatbot-admin.php: 796537 #: chatbot-admin.php:802 538 538 msgid "" 539 539 "You can customize the appearance of the chatbot in the \"Style\" and \"Images" … … 541 541 msgstr "" 542 542 543 #: chatbot-admin.php: 797543 #: chatbot-admin.php:803 544 544 msgid "" 545 545 "Style: Change the colors of the header, chatbox, messages, and send button." 546 546 msgstr "" 547 547 548 #: chatbot-admin.php: 798548 #: chatbot-admin.php:804 549 549 msgid "" 550 550 "Images: Change the avatars for the user and bot, and the icons for the chat " … … 552 552 msgstr "" 553 553 554 #: chatbot-admin.php: 799554 #: chatbot-admin.php:805 555 555 msgid "" 556 556 "Sounds: In the tab \"Sounds\", you can change the default sound when opening " … … 558 558 msgstr "" 559 559 560 #: chatbot-admin.php:80 0560 #: chatbot-admin.php:806 561 561 msgid "Troubleshooting" 562 562 msgstr "" 563 563 564 #: chatbot-admin.php:80 1564 #: chatbot-admin.php:807 565 565 msgid "" 566 566 "Changes not appearing? After making changes, press Ctrl+F5 (or Cmd+Shift+R " … … 568 568 msgstr "" 569 569 570 #: chatbot-admin.php:80 2570 #: chatbot-admin.php:808 571 571 msgid "" 572 572 "Bot not responding? Check your API key and make sure it's valid. Also, check " … … 574 574 msgstr "" 575 575 576 #: chatbot-admin.php:80 3576 #: chatbot-admin.php:809 577 577 msgid "Managing Messages" 578 578 msgstr "" 579 579 580 #: chatbot-admin.php:8 04580 #: chatbot-admin.php:810 581 581 msgid "You can view and export the messages in the \"Messages\" tab." 582 582 msgstr "" 583 583 584 #: chatbot-admin.php:8 05584 #: chatbot-admin.php:811 585 585 msgid "View: See all chat messages." 586 586 msgstr "" 587 587 588 #: chatbot-admin.php:8 06588 #: chatbot-admin.php:812 589 589 msgid "Export: Export the messages in various formats (TXT, CSV, MD, HTML)." 590 590 msgstr "" 591 591 592 #: chatbot-admin.php:8 07592 #: chatbot-admin.php:813 593 593 msgid "Delete: Delete all chat messages." 594 594 msgstr "" 595 595 596 #: chatbot-admin.php:8 08596 #: chatbot-admin.php:814 597 597 msgid "Saving messages" 598 598 msgstr "" 599 599 600 #: chatbot-admin.php:8 09600 #: chatbot-admin.php:815 601 601 msgid "You can enable or disable saving messages in the \"Messages\" tab." 602 602 msgstr "" 603 603 604 #: chatbot-admin.php:81 0604 #: chatbot-admin.php:816 605 605 msgid "" 606 606 "If enabled, all chat messages and IP will be saved in the database. If " … … 608 608 msgstr "" 609 609 610 #: chatbot-admin.php:81 1610 #: chatbot-admin.php:817 611 611 msgid "" 612 612 "Important: If you enable message saving, be sure to update your privacy " … … 614 614 msgstr "" 615 615 616 #: chatbot-admin.php:81 2616 #: chatbot-admin.php:818 617 617 msgid "Enabling \"Powered by NewCodeByte\"" 618 618 msgstr "" 619 619 620 #: chatbot-admin.php:81 3620 #: chatbot-admin.php:819 621 621 msgid "" 622 622 "Enabling \"Powered by NewCodeByte\" helps me support the development of this " … … 625 625 msgstr "" 626 626 627 #: chatbot-admin.php:8 16627 #: chatbot-admin.php:822 628 628 #, php-format 629 629 msgid "" … … 632 632 msgstr "" 633 633 634 #: chatbot-admin.php:8 17634 #: chatbot-admin.php:823 635 635 msgid "Buy Me a Coffee" 636 636 msgstr "" 637 637 638 #: chatbot-admin.php:8 19638 #: chatbot-admin.php:825 639 639 msgid "" 640 640 "All donations are greatly appreciated and will help me continue to improve " … … 642 642 msgstr "" 643 643 644 #: chatbot-admin.php:8 27644 #: chatbot-admin.php:833 645 645 msgid "Show \"Powered by NewCodeByte\"?" 646 646 msgstr "" 647 647 648 #: chatbot-admin.php:8 34648 #: chatbot-admin.php:840 649 649 msgid "Yes, show the link to support the plugin." 650 650 msgstr "" 651 651 652 #: chatbot-admin.php:8 49652 #: chatbot-admin.php:855 653 653 msgid "" 654 654 "Boost visitor engagement with a powerful AI Chatbot for WordPress. " … … 659 659 msgstr "" 660 660 661 #: chatbot-admin.php:8 59661 #: chatbot-admin.php:865 662 662 msgid "" 663 663 "The complete manager for external links. Opens in new tabs, handles dynamic " … … 667 667 msgstr "" 668 668 669 #: chatbot-admin.php:8 69669 #: chatbot-admin.php:875 670 670 msgid "" 671 671 "Your all-in-one suite for total link control and site maintenance. Manage " … … 676 676 msgstr "" 677 677 678 #: wp-chatbot.php:1 37678 #: wp-chatbot.php:144 679 679 msgid "Chatbot AI - Action Required:" 680 680 msgstr "" 681 681 682 #: wp-chatbot.php:1 38682 #: wp-chatbot.php:145 683 683 msgid "" 684 684 "The chatbot database setup is incomplete. Please deactivate and reactivate " … … 686 686 msgstr "" 687 687 688 #: wp-chatbot.php:152 688 #: wp-chatbot.php:159 wp-chatbot.php:490 wp-chatbot.php:870 689 msgid "Chatbot" 690 msgstr "" 691 692 #: wp-chatbot.php:170 689 693 msgid "Chatbot Settings" 690 694 msgstr "" 691 695 692 #: wp-chatbot.php:153 wp-chatbot.php:475 wp-chatbot.php:852 693 msgid "Chatbot" 694 msgstr "" 695 696 #: wp-chatbot.php:224 wp-chatbot.php:489 wp-chatbot.php:862 696 #: wp-chatbot.php:242 wp-chatbot.php:504 wp-chatbot.php:880 697 697 msgid "Type your message..." 698 698 msgstr "" 699 699 700 #: wp-chatbot.php:2 25 wp-chatbot.php:490 wp-chatbot.php:863700 #: wp-chatbot.php:243 wp-chatbot.php:505 wp-chatbot.php:881 701 701 msgid "Send" 702 702 msgstr "" 703 703 704 #: wp-chatbot.php:2 26704 #: wp-chatbot.php:244 705 705 msgid "There was an error." 706 706 msgstr "" 707 707 708 #: wp-chatbot.php:2 30708 #: wp-chatbot.php:248 709 709 msgid "Before we start chatting" 710 710 msgstr "" 711 711 712 #: wp-chatbot.php:2 31712 #: wp-chatbot.php:249 713 713 msgid "Please provide the following information:" 714 714 msgstr "" 715 715 716 #: wp-chatbot.php:2 32716 #: wp-chatbot.php:250 717 717 msgid "Name" 718 718 msgstr "" 719 719 720 #: wp-chatbot.php:2 33720 #: wp-chatbot.php:251 721 721 msgid "Email" 722 722 msgstr "" 723 723 724 #: wp-chatbot.php:2 34724 #: wp-chatbot.php:252 725 725 msgid "Start Chat" 726 726 msgstr "" 727 727 728 #: wp-chatbot.php:2 35728 #: wp-chatbot.php:253 729 729 msgid "Please fill in all required fields." 730 730 msgstr "" 731 731 732 #: wp-chatbot.php:2 48732 #: wp-chatbot.php:266 733 733 msgid "Have a question? Ask me!" 734 734 msgstr "" 735 735 736 #: wp-chatbot.php:3 40 wp-chatbot.php:454 wp-chatbot.php:471736 #: wp-chatbot.php:355 wp-chatbot.php:469 wp-chatbot.php:486 737 737 msgid "Sorry, I was unable to get a response from the server." 738 738 msgstr "" 739 739 740 #: wp-chatbot.php:3 41740 #: wp-chatbot.php:356 741 741 msgid "API Error:" 742 742 msgstr "" 743 743 744 #: wp-chatbot.php: 397744 #: wp-chatbot.php:412 745 745 #, php-format 746 746 msgid "" … … 752 752 msgstr "" 753 753 754 #: wp-chatbot.php:4 13754 #: wp-chatbot.php:428 755 755 msgid "You are a helpful assistant." 756 756 msgstr "" 757 757 758 #: wp-chatbot.php:4 67758 #: wp-chatbot.php:482 759 759 #, php-format 760 760 msgid "API Error: %s" 761 761 msgstr "" 762 762 763 #: wp-chatbot.php: 497 wp-chatbot.php:867763 #: wp-chatbot.php:512 wp-chatbot.php:885 764 764 #, php-format 765 765 msgid "Powered by %s" 766 766 msgstr "" 767 767 768 #: wp-chatbot.php:5 29 wp-chatbot.php:553768 #: wp-chatbot.php:542 wp-chatbot.php:567 769 769 msgid "You do not have permission to perform this action." 770 770 msgstr "" 771 771 772 #: wp-chatbot.php:5 44772 #: wp-chatbot.php:559 773 773 msgid "All messages have been deleted." 774 774 msgstr "" 775 775 776 #: wp-chatbot.php:5 61776 #: wp-chatbot.php:575 777 777 msgid "Export format not specified." 778 778 msgstr "" 779 779 780 #: wp-chatbot.php:5 68780 #: wp-chatbot.php:582 781 781 msgid "Invalid format specified." 782 782 msgstr "" 783 783 784 #: wp-chatbot.php:8 34784 #: wp-chatbot.php:851 785 785 msgid "Are you sure you want to delete all messages?" 786 786 msgstr "" 787 787 788 #: wp-chatbot.php:8 35788 #: wp-chatbot.php:852 789 789 msgid "Error while deleting messages." 790 790 msgstr "" 791 791 792 #: wp-chatbot.php:8 36792 #: wp-chatbot.php:853 793 793 msgid "Select an export format." 794 794 msgstr "" 795 795 796 #: wp-chatbot.php:8 37796 #: wp-chatbot.php:854 797 797 msgid "Error loading the image." 798 798 msgstr "" 799 799 800 #: wp-chatbot.php:8 38800 #: wp-chatbot.php:855 801 801 msgid "Choose an Image" 802 802 msgstr "" 803 803 804 #: wp-chatbot.php:8 39804 #: wp-chatbot.php:856 805 805 msgid "Use this Image" 806 806 msgstr "" 807 808 #: wp-chatbot.php:1034 809 #, php-format 810 msgid "You have %d unread conversation." 811 msgid_plural "You have %d unread conversations." 812 msgstr[0] "" 813 msgstr[1] "" 807 814 808 815 #. Plugin Name of the plugin/theme -
chatbot-ai-free-models/trunk/readme.txt
r3348456 r3363841 4 4 Requires PHP: 7.4 5 5 Tested up to: 6.8.2 6 Stable tag: 1.6. 36 Stable tag: 1.6.4 7 7 Tags: ai chatbot, chatbot, live chat, virtual assistant, customer support 8 8 License: GPLv2 or later … … 118 118 A: Third, if the issue persists, try switching to a different model. Free models can sometimes experience high traffic and connection problems, so experimenting with alternative models might resolve the issue. 119 119 120 **Q: How do I know if there are new messages?** 121 A: Yes, the plugin includes an automatic notification system to alert you of new, unread conversations. Here’s how it works: 122 123 * **Notification Badge in the Menu:** When a user starts a new conversation, a **red notification badge** with a number will appear next to the 'Chatbot' menu item in your WordPress admin sidebar. This number does not represent individual messages, but rather the **total number of conversations** that contain at least one unread message. 124 125 * **Detailed Tooltip:** If you hover your mouse over the "Chatbot" menu item, a tooltip will provide more details (e.g., "You have 2 unread conversations"). 126 127 * **Highlighting in the Table:** Once you navigate to the 'Messages' tab, unread conversations are easy to spot because the entire row is displayed in **bold text**. 128 129 * **How to Mark as Read:** To mark a conversation as 'read' and decrease the notification counter, simply **click on the conversation's row** to view its messages. The action is automatic, and the bold styling will disappear. 130 120 131 == External Services == 121 132 … … 129 140 130 141 == Changelog == 142 143 = 1.6.4 = 144 * New: Unread conversation notifications! A red badge will now appear on the 'Chatbot' admin menu item, showing the count of unread conversations. 145 * New: Conversation IDs are now clean and sequential (e.g., Chat_1, Chat_2) instead of the long, timestamp-based string. 146 * Enhancement: The admin message list has been improved. Unread conversations are now highlighted in bold for easy identification. 147 * Enhancement: Added a descriptive tooltip to the admin menu badge, showing the exact number of unread conversations on hover. 148 * Dev: Major refactor of the database schema. A new conversations table has been introduced to manage conversations more robustly and enable sequential IDs. 131 149 132 150 = 1.6.3 = -
chatbot-ai-free-models/trunk/wp-chatbot.php
r3348456 r3363841 3 3 Plugin Name: Chatbot AI Free Models 4 4 Description: Easily integrate advanced AI chatbots into your WordPress site with a single API key. Use free models like Llama, DeepSeek, Mixtral, and others, or access premium models like ChatGPT and Claude for more power. Simple management, unlimited messages, and all conversations saved for easy review. 5 Version: 1.6. 35 Version: 1.6.4 6 6 Author: NewCodeByte 7 7 Author URI: https://newcodebyte.altervista.org … … 75 75 * Registra le funzioni da eseguire all'attivazione del plugin e nel backend. 76 76 */ 77 function newcodebyte_chatbot_on_deactivate() { 78 delete_transient('newcodebyte_chatbot_db_checked'); 79 } 80 77 81 register_activation_hook(__FILE__, 'newcodebyte_chatbot_install_or_update'); 78 82 add_action('admin_init', 'newcodebyte_chatbot_install_or_update'); … … 84 88 * che la tabella del database esista. 85 89 */ 90 86 91 function newcodebyte_chatbot_install_or_update() { 87 // Usiamo un transient per evitare di eseguire dbDelta ad ogni caricamento di pagina88 92 if (get_transient('newcodebyte_chatbot_db_checked')) { 89 93 return; … … 91 95 92 96 global $wpdb; 93 $table_name = $wpdb->prefix . 'newcodebyte_chatbot_messages'; 94 95 // Controlla se la tabella esiste. Se esiste già, non facciamo nulla, 96 // perché dbDelta aggiornerà lo schema se necessario. 97 // La logica di creazione viene eseguita solo se la tabella manca. 98 $charset_collate = $wpdb->get_charset_collate(); 99 $sql = "CREATE TABLE $table_name ( 97 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 98 99 $messages_table_name = $wpdb->prefix . 'newcodebyte_chatbot_messages'; 100 $sql_messages = "CREATE TABLE $messages_table_name ( 100 101 id mediumint(9) NOT NULL AUTO_INCREMENT, 101 conversation_id varchar(255) DEFAULT ''NOT NULL,102 conversation_id bigint(20) NOT NULL, 102 103 user_name tinytext, 103 104 user_email varchar(100), 104 ip varchar(100) DEFAULT '' NOT NULL,105 date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,106 sender varchar(50) DEFAULT '' NOT NULL,105 ip varchar(100) NOT NULL DEFAULT '', 106 date datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 107 sender varchar(50) NOT NULL DEFAULT '', 107 108 message text NOT NULL, 109 is_read tinyint(1) NOT NULL DEFAULT 0, 108 110 PRIMARY KEY (id), 109 INDEX conv_id_idx (conversation_id) 110 ) $charset_collate;"; 111 112 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 113 dbDelta($sql); 114 115 // Imposta un transient che scade dopo un'ora. Questo è efficiente 116 // e permette di riprovare in caso di problemi. 111 KEY conv_id_idx (conversation_id), 112 KEY is_read_idx (is_read) 113 );"; 114 dbDelta($sql_messages); 115 116 $conversations_table_name = $wpdb->prefix . 'newcodebyte_chatbot_conversations'; 117 $sql_conversations = "CREATE TABLE $conversations_table_name ( 118 id bigint(20) NOT NULL AUTO_INCREMENT, 119 start_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 120 PRIMARY KEY (id) 121 );"; 122 dbDelta($sql_conversations); 123 117 124 set_transient('newcodebyte_chatbot_db_checked', 'yes', HOUR_IN_SECONDS); 118 125 } … … 149 156 // Funzione per creare la pagina di configurazione 150 157 function newcodebyte_chatbot_add_admin_page() { 158 $unread_count = newcodebyte_chatbot_get_unread_count(); 159 $menu_title = __( 'Chatbot', 'chatbot-ai-free-models' ); 160 161 if ($unread_count > 0) { 162 $badge = sprintf( 163 ' <span class="awaiting-mod" style="background-color: #d63638;"><span class="pending-count">%d</span></span>', 164 $unread_count 165 ); 166 $menu_title .= $badge; 167 } 168 151 169 add_menu_page( 152 170 __( 'Chatbot Settings', 'chatbot-ai-free-models' ), 153 __( 'Chatbot', 'chatbot-ai-free-models' ),171 $menu_title, // USA IL TITOLO CON IL BADGE 154 172 'manage_options', 155 173 'newcodebyte-chatbot-settings', … … 273 291 return; 274 292 } 275 if ( !isset($_POST['conversation_id']) || trim(wp_unslash($_POST['conversation_id'])) === '' ) { 276 wp_send_json_error(['message' => 'Conversation ID is required.'], 400); 277 return; 278 } 279 293 294 global $wpdb; 280 295 $newcodebyte_message = sanitize_text_field( wp_unslash( $_POST['message'] ) ); 281 $newcodebyte_conversation_id = sanitize_text_field( wp_unslash( $_POST['conversation_id'] ) ); 296 $newcodebyte_conversation_id = isset($_POST['conversation_id']) ? absint($_POST['conversation_id']) : 0; 297 298 if (empty($newcodebyte_conversation_id)) { 299 $conversations_table = $wpdb->prefix . 'newcodebyte_chatbot_conversations'; 300 $wpdb->insert( 301 $conversations_table, 302 ['start_date' => current_time('mysql')], 303 ['%s'] 304 ); 305 $newcodebyte_conversation_id = $wpdb->insert_id; 306 } 307 282 308 $user_name = isset($_POST['name']) ? sanitize_text_field(wp_unslash($_POST['name'])) : null; 283 309 $user_email = isset($_POST['email']) ? sanitize_email(wp_unslash($_POST['email'])) : null; … … 305 331 $_SESSION[ $session_history_key ][ $newcodebyte_conversation_id ] = $current_session_history; 306 332 307 // ================== SALVATAGGIO MESSAGGIO UTENTE ==================308 333 $save_messages = get_option('newcodebyte_chatbot_save_messages', '0'); 309 334 if ($save_messages === '1') { 310 global $wpdb;311 335 $table_name = $wpdb->prefix . 'newcodebyte_chatbot_messages'; 312 // Inseriamo il messaggio dell'utente nella tabella.313 336 $data_to_insert = [ 314 337 'ip' => $newcodebyte_ip, … … 321 344 ]; 322 345 323 // Specifica i formati dei dati per la sicurezza. 324 $data_formats = [ 325 '%s', // ip 326 '%s', // date 327 '%s', // sender 328 '%s', // message 329 '%s', // conversation_id 330 '%s', // user_name 331 '%s', // user_email 332 ]; 346 $data_formats = ['%s', '%s', '%s', '%s', '%d', '%s', '%s']; 333 347 334 348 $wpdb->insert($table_name, $data_to_insert, $data_formats); 349 delete_transient('newcodebyte_chatbot_unread_count'); 335 350 } 336 351 … … 344 359 $_SESSION[ $session_history_key ][ $newcodebyte_conversation_id ][] = ['role' => 'assistant', 'content' => $newcodebyte_bot_response]; 345 360 346 // ================== SALVATAGGIO MESSAGGIO BOT ==================361 // Se il salvataggio è attivo, salva anche la risposta del bot. 347 362 if ($save_messages === '1') { 348 global $wpdb;349 363 $table_name = $wpdb->prefix . 'newcodebyte_chatbot_messages'; 350 351 // Inseriamo la risposta del bot.352 364 $wpdb->insert( 353 365 $table_name, … … 356 368 'sender' => 'Bot', 357 369 'message' => $newcodebyte_bot_response, 358 'conversation_id' => $newcodebyte_conversation_id, 359 // ip, user_name, e user_email sono nulli di default 370 'conversation_id' => $newcodebyte_conversation_id 360 371 ], 361 372 [ … … 363 374 '%s', // sender 364 375 '%s', // message 365 '% s', // conversation_id376 '%d' // conversation_id (corretto a %d per il numero) 366 377 ] 367 378 ); 368 379 } 380 // --- FINE BLOCCO REINSERITO --- 369 381 } 370 382 … … 372 384 wp_send_json_error(array('message' => $newcodebyte_bot_response)); 373 385 } else { 374 wp_send_json_success(array('message' => $newcodebyte_bot_response)); 386 wp_send_json_success(array( 387 'message' => $newcodebyte_bot_response, 388 'conversation_id' => $newcodebyte_conversation_id 389 )); 375 390 } 376 391 } … … 483 498 $position_class = 'chatbot-position-' . esc_attr($position); 484 499 ?> 485 <div id="chatbox" class="<?php echo $position_class; ?>" data-version-ncb="1.6. 3">500 <div id="chatbox" class="<?php echo $position_class; ?>" data-version-ncb="1.6.4"> 486 501 <div id="chatbox-header"><?php echo esc_html($newcodebyte_chatbot_title); ?><span id="chatbox-close">x</span></div> 487 502 <div id="chatbox-content"></div> … … 522 537 523 538 add_action('wp_ajax_newcodebyte_chatbot_delete_messages', 'newcodebyte_chatbot_delete_messages'); 524 // in wp-chatbot.php525 539 526 540 function newcodebyte_chatbot_delete_messages() { 527 // Sicurezza (invariato)528 541 if ( ! current_user_can( 'manage_options' ) ) { 529 542 wp_send_json_error( ['message' => esc_html__( 'You do not have permission to perform this action.', 'chatbot-ai-free-models' )] ); … … 535 548 } 536 549 537 // ======== INIZIO MODIFICA ========538 550 global $wpdb; 539 551 $table_name = $wpdb->prefix . 'newcodebyte_chatbot_messages'; … … 542 554 $wpdb->query("TRUNCATE TABLE $table_name"); 543 555 556 // Questo assicura che la notifica nel menu scompaia immediatamente. 557 delete_transient('newcodebyte_chatbot_unread_count'); 558 544 559 wp_send_json_success( ['message' => __( 'All messages have been deleted.', 'chatbot-ai-free-models' )] ); 545 // ========= FINE MODIFICA =========546 560 } 547 561 … … 696 710 add_action('wp_ajax_newcodebyte_chatbot_get_conversation_messages', 'newcodebyte_chatbot_get_conversation_messages'); 697 711 698 // in wp-chatbot.php699 700 712 function newcodebyte_chatbot_get_conversation_messages() { 713 if (!isset($_POST['nonce']) || !wp_verify_nonce(sanitize_text_field($_POST['nonce']), 'newcodebyte_chatbot_admin_nonce')) { 714 wp_send_json_error(['message' => 'Security check failed.'], 403); 715 return; 716 } 717 701 718 if (!current_user_can('manage_options')) { 702 719 wp_send_json_error(['message' => 'Permission denied.'], 403); 703 720 } 704 check_ajax_referer('newcodebyte_chatbot_admin_nonce', 'nonce'); 705 721 722 // ... il resto della funzione rimane invariato ... 706 723 $conversation_id = isset($_POST['conversation_id']) ? sanitize_text_field($_POST['conversation_id']) : ''; 707 724 if (empty($conversation_id)) { … … 712 729 $table_name = $wpdb->prefix . 'newcodebyte_chatbot_messages'; 713 730 714 // Recupera le info utente731 // ... il resto della funzione rimane invariato ... 715 732 $user_info = $wpdb->get_row($wpdb->prepare("SELECT user_name, user_email FROM $table_name WHERE conversation_id = %s AND (user_name IS NOT NULL AND user_name != '') LIMIT 1", $conversation_id), ARRAY_A); 716 733 $user_display_name = __('Anonymous User', 'chatbot-ai-free-models'); … … 807 824 // 2. Rimuovi la nuova tabella personalizzata dal database MySQL 808 825 global $wpdb; 809 $table_name = $wpdb->prefix . 'newcodebyte_chatbot_messages'; 810 $wpdb->query("DROP TABLE IF EXISTS $table_name"); 811 812 // NOTA: Non cancelliamo deliberatamente il file chatbot.db per permettere 813 // agli utenti che aggiornano di recuperare la loro vecchia cronologia. 826 $messages_table = $wpdb->prefix . 'newcodebyte_chatbot_messages'; 827 $conversations_table = $wpdb->prefix . 'newcodebyte_chatbot_conversations'; 828 $wpdb->query("DROP TABLE IF EXISTS $messages_table"); 829 $wpdb->query("DROP TABLE IF EXISTS $conversations_table"); 814 830 } 815 831 … … 825 841 plugins_url( 'js/chatbot-admin.js', __FILE__ ), 826 842 array( 'jquery', 'wp-color-picker', 'media-upload' ), 827 '1. 0', // Considera di aggiornare la versione se fai modifiche significative843 '1.3', // Considera di aggiornare la versione se fai modifiche significative 828 844 true 829 845 ); 846 830 847 wp_localize_script( 'chatbot-admin-js', 'chatbot_admin_vars', array( 831 848 'ajaxurl' => admin_url( 'admin-ajax.php' ), … … 839 856 'media_uploader_button_text' => esc_html__( 'Use this Image', 'chatbot-ai-free-models' ), // Per il pulsante del media uploader 840 857 'chatbot_delete_nonce' => wp_create_nonce('newcodebyte_chatbot_delete_messages'), 841 'get_messages_nonce' => wp_create_nonce('newcodebyte_chatbot_admin_nonce') 858 'get_messages_nonce' => wp_create_nonce('newcodebyte_chatbot_admin_nonce'), 859 'loading_messages' => esc_html__( 'Loading messages...', 'chatbot-ai-free-models' ) 842 860 ) ); 843 861 } … … 936 954 } 937 955 add_shortcode('newcodebyte_chatbot', 'newcodebyte_chatbot_shortcode_handler'); 956 957 /** 958 * Recupera il numero di conversazioni non lette. 959 * Usa un transient per non interrogare il DB ad ogni caricamento di pagina. 960 * 961 * @return int Numero di conversazioni non lette. 962 */ 963 function newcodebyte_chatbot_get_unread_count() { 964 $cache_key = 'newcodebyte_chatbot_unread_count'; 965 $unread_count = get_transient($cache_key); 966 967 if (false === $unread_count) { 968 global $wpdb; 969 $table_name = $wpdb->prefix . 'newcodebyte_chatbot_messages'; 970 971 // Conta gli ID di conversazione unici che hanno almeno un messaggio non letto. 972 $unread_count = $wpdb->get_var( 973 "SELECT COUNT(DISTINCT conversation_id) FROM {$table_name} WHERE is_read = 0" 974 ); 975 976 set_transient($cache_key, $unread_count, 5 * MINUTE_IN_SECONDS); // Cache per 5 minuti 977 } 978 979 return (int) $unread_count; 980 } 981 982 /** 983 * Funzione AJAX per segnare una conversazione come letta. 984 */ 985 function newcodebyte_chatbot_mark_as_read_callback() { 986 // Controlla il nonce usando l'azione corretta e il nome del campo corretto. 987 if (!isset($_POST['nonce']) || !wp_verify_nonce(sanitize_text_field($_POST['nonce']), 'newcodebyte_chatbot_admin_nonce')) { 988 wp_send_json_error(['message' => 'Security check failed.'], 403); 989 return; 990 } 991 992 if (!current_user_can('manage_options')) { 993 wp_send_json_error(['message' => 'Permission denied.'], 403); 994 return; 995 } 996 997 $conversation_id = isset($_POST['conversation_id']) ? sanitize_text_field($_POST['conversation_id']) : ''; 998 if (empty($conversation_id)) { 999 wp_send_json_error(['message' => 'Conversation ID is required.'], 400); 1000 } 1001 1002 global $wpdb; 1003 $table_name = $wpdb->prefix . 'newcodebyte_chatbot_messages'; 1004 1005 $result = $wpdb->update( 1006 $table_name, 1007 ['is_read' => 1], // Imposta a "letto" 1008 ['conversation_id' => $conversation_id, 'is_read' => 0], // Aggiunto 'is_read' = 0 per efficienza 1009 ['%d'], 1010 ['%s', '%d'] 1011 ); 1012 1013 // Pulisci la cache solo se abbiamo effettivamente aggiornato delle righe 1014 if ($result !== false && $result > 0) { 1015 delete_transient('newcodebyte_chatbot_unread_count'); 1016 } 1017 1018 wp_send_json_success(['message' => 'Conversation marked as read. Rows affected: ' . $result]); 1019 } 1020 add_action('wp_ajax_newcodebyte_chatbot_mark_as_read', 'newcodebyte_chatbot_mark_as_read_callback'); 1021 1022 /** 1023 * Aggiunge un tooltip alla voce di menu del chatbot se ci sono conversazioni non lette. 1024 * Questo script viene caricato in TUTTE le pagine di amministrazione. 1025 */ 1026 function newcodebyte_chatbot_add_admin_menu_tooltip() { 1027 $unread_count = newcodebyte_chatbot_get_unread_count(); 1028 1029 // Esegui solo se ci sono messaggi non letti 1030 if ($unread_count > 0) { 1031 // Prepara il testo del tooltip (con gestione singolare/plurale) 1032 $tooltip_text = sprintf( 1033 esc_attr(_n( 1034 'You have %d unread conversation.', 1035 'You have %d unread conversations.', 1036 $unread_count, 1037 'chatbot-ai-free-models' 1038 )), 1039 $unread_count 1040 ); 1041 1042 // Prepara un piccolo snippet di JavaScript 1043 $script = " 1044 jQuery(document).ready(function($) { 1045 $('#toplevel_page_newcodebyte-chatbot-settings > a').attr('title', '" . $tooltip_text . "'); 1046 }); 1047 "; 1048 1049 // Allega lo snippet a jQuery, che è sempre presente nel backend. 1050 wp_add_inline_script('jquery', $script); 1051 } 1052 } 1053 add_action('admin_enqueue_scripts', 'newcodebyte_chatbot_add_admin_menu_tooltip');
Note: See TracChangeset
for help on using the changeset viewer.