PluginProbe
MxChat – AI Chatbot & Content Generation for WordPress / 1.6.1
MxChat – AI Chatbot & Content Generation for WordPress v1.6.1
3.2.22 3.2.21 3.2.20 3.2.19 3.2.18 3.2.17 3.2.16 3.2.15 3.2.14 3.2.12 3.2.13 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 3.2.6 3.2.5 3.2.4 3.2.3 3.2.2 3.2.1 2.0.3 2.0.4 2.0.5 All 153 releases
← All changes | includes/class-mxchat-word-handler.php +13 -13 2.0.51.6.1 View file →
@@ -14,13 +14,13 @@
14 14
15 15 /**
16 16 * Handle Word document upload and processing
17 17 */
18 -public function mxchat_handle_word_upload() {
18 + public function mxchat_handle_word_upload() {
19 19 check_ajax_referer('mxchat_chat_nonce', 'nonce');
20 20
21 21 if (!isset($_FILES['word_file']) || !isset($_POST['session_id'])) {
22 - wp_send_json_error(esc_html__('Missing required parameters.', 'mxchat'));
22 + wp_send_json_error('Missing required parameters.');
23 23 return;
24 24 }
25 25
26 26 $file = $_FILES['word_file'];
@@ -33,9 +33,9 @@
33 33 );
34 34 $file_type = wp_check_filetype($file['name'], $allowed_types);
35 35
36 36 if (!$file_type['type']) {
37 - wp_send_json_error(esc_html__('Invalid file type. Only .docx files are allowed.', 'mxchat'));
37 + wp_send_json_error('Invalid file type. Only .docx files are allowed.');
38 38 return;
39 39 }
40 40
41 41 // Generate unique filename
@@ -42,9 +42,9 @@
42 42 $word_filename = 'mxchat_word_' . $session_id . '_' . time() . '.docx';
43 43 $word_path = $this->temp_dir . '/' . $word_filename;
44 44
45 45 if (!move_uploaded_file($file['tmp_name'], $word_path)) {
46 - wp_send_json_error(esc_html__('Failed to upload file.', 'mxchat'));
46 + wp_send_json_error('Failed to upload file.');
47 47 return;
48 48 }
49 49
50 50 $this->mxchat_clear_word_transients($session_id);
@@ -54,9 +54,9 @@
54 54
55 55 if ($embeddings === false || empty($embeddings)) {
56 56 unlink($word_path);
57 57 $error_message = $this->options['word_intent_error_text'] ??
58 - esc_html__('The uploaded document appears to be empty or contains unsupported content.', 'mxchat');
58 + 'The uploaded document appears to be empty or contains unsupported content.';
59 59 wp_send_json_error($error_message);
60 60 return;
61 61 }
62 62
@@ -66,9 +66,9 @@
66 66 set_transient('mxchat_word_embeddings_' . $session_id, $embeddings, HOUR_IN_SECONDS);
67 67 set_transient('mxchat_include_word_in_context_' . $session_id, true, HOUR_IN_SECONDS);
68 68
69 69 $success_message = $this->options['pdf_intent_success_text'] ??
70 - __("I've processed the document. What questions do you have about it?", 'mxchat');
70 + "I've processed the document. What questions do you have about it?";
71 71
72 72 wp_send_json_success([
73 73 'message' => $success_message,
74 74 'filename' => $original_filename
@@ -103,9 +103,9 @@
103 103 $paragraphs = explode("\n\n", $text);
104 104 $estimated_pages = ceil(count($paragraphs) / 3); // Assume ~3 paragraphs per page
105 105
106 106 if ($estimated_pages > $max_pages) {
107 - return esc_html__('too_many_pages', 'mxchat');
107 + return 'too_many_pages';
108 108 }
109 109
110 110 // Split into chunks and continue processing...
111 111 $chunks = $this->mxchat_split_word_into_chunks($text, 1000);
@@ -116,9 +116,9 @@
116 116 continue;
117 117 }
118 118
119 119 $embedding = $this->mxchat_generate_embedding_word(
120 - esc_html__('Chunk ', 'mxchat') . ($chunk_number + 1) . ': ' . $chunk,
120 + "Chunk " . ($chunk_number + 1) . ": " . $chunk,
121 121 $this->options['api_key']
122 122 );
123 123
124 124 if ($embedding) {
@@ -185,13 +185,13 @@
185 185
186 186 /**
187 187 * Remove Word document and clean up transients
188 188 */
189 -public function mxchat_handle_word_remove() {
189 + public function mxchat_handle_word_remove() {
190 190 check_ajax_referer('mxchat_chat_nonce', 'nonce');
191 191
192 192 if (empty($_POST['session_id'])) {
193 - wp_send_json_error(esc_html__('Session ID missing.', 'mxchat'));
193 + wp_send_json_error('Session ID missing.');
194 194 return;
195 195 }
196 196
197 197 $session_id = sanitize_text_field($_POST['session_id']);
@@ -203,9 +203,9 @@
203 203
204 204 $this->mxchat_clear_word_transients($session_id);
205 205
206 206 wp_send_json_success([
207 - 'message' => esc_html__('Document removed successfully.', 'mxchat')
207 + 'message' => 'Document removed successfully.'
208 208 ]);
209 209 }
210 210
211 211 /**
@@ -249,9 +249,9 @@
249 249
250 250 /**
251 251 * Handle Word document discussion similar to PDF discussion
252 252 */
253 -public function mxchat_handle_word_discussion($message, $user_id, $session_id) {
253 + public function mxchat_handle_word_discussion($message, $user_id, $session_id) {
254 254 // Get stored embeddings for the session
255 255 $embeddings = get_transient('mxchat_word_embeddings_' . $session_id);
256 256 $word_path = get_transient('mxchat_word_url_' . $session_id);
257 257
@@ -256,9 +256,9 @@
256 256 $word_path = get_transient('mxchat_word_url_' . $session_id);
257 257
258 258 if (!$embeddings || !$word_path) {
259 259 $trigger_text = $this->options['word_intent_trigger_text'] ??
260 - __("Please upload a Word document (.docx) that you'd like to discuss.", 'mxchat');
260 + "Please upload a Word document (.docx) that you'd like to discuss.";
261 261 set_transient('mxchat_waiting_for_word_' . $session_id, true, HOUR_IN_SECONDS);
262 262 $this->fallbackResponse['text'] = $trigger_text;
263 263 return;
264 264 }