Changeset 3468718
- Timestamp:
- 02/24/2026 02:58:45 PM (5 weeks ago)
- Location:
- wpiko-chatbot
- Files:
-
- 72 added
- 7 edited
-
tags/1.1.3 (added)
-
tags/1.1.3/admin (added)
-
tags/1.1.3/admin/admin-page.php (added)
-
tags/1.1.3/admin/css (added)
-
tags/1.1.3/admin/css/admin-style.css (added)
-
tags/1.1.3/admin/css/ai-configuration.css (added)
-
tags/1.1.3/admin/css/conversation-mobile-style.css (added)
-
tags/1.1.3/admin/css/conversation-style.css (added)
-
tags/1.1.3/admin/css/dashboard-style.css (added)
-
tags/1.1.3/admin/css/debug-log-style.css (added)
-
tags/1.1.3/admin/css/file-management.css (added)
-
tags/1.1.3/admin/css/modal-style.css (added)
-
tags/1.1.3/admin/css/plugin-header.css (added)
-
tags/1.1.3/admin/css/transcript-styles.css (added)
-
tags/1.1.3/admin/includes (added)
-
tags/1.1.3/admin/includes/plugin-header.php (added)
-
tags/1.1.3/admin/js (added)
-
tags/1.1.3/admin/js/admin-script.js (added)
-
tags/1.1.3/admin/js/conversations.js (added)
-
tags/1.1.3/admin/js/dashboard.js (added)
-
tags/1.1.3/admin/js/file-management.js (added)
-
tags/1.1.3/admin/js/files-list.js (added)
-
tags/1.1.3/admin/js/modal-handlers.js (added)
-
tags/1.1.3/admin/js/models-info.js (added)
-
tags/1.1.3/admin/js/responses-api.js (added)
-
tags/1.1.3/admin/sections (added)
-
tags/1.1.3/admin/sections/ai-configuration-section.php (added)
-
tags/1.1.3/admin/sections/api-key-section.php (added)
-
tags/1.1.3/admin/sections/chatbot-menu-section.php (added)
-
tags/1.1.3/admin/sections/chatbot-style-section.php (added)
-
tags/1.1.3/admin/sections/conversations-section.php (added)
-
tags/1.1.3/admin/sections/dashboard-section.php (added)
-
tags/1.1.3/admin/sections/debug-log-section.php (added)
-
tags/1.1.3/admin/sections/error-messages-section.php (added)
-
tags/1.1.3/admin/sections/floating-chatbot-section.php (added)
-
tags/1.1.3/admin/sections/questions-section.php (added)
-
tags/1.1.3/admin/sections/shortcode-chatbot-section.php (added)
-
tags/1.1.3/admin/templates (added)
-
tags/1.1.3/admin/templates/admin-wrapper.php (added)
-
tags/1.1.3/admin/templates/file-management.php (added)
-
tags/1.1.3/assets (added)
-
tags/1.1.3/assets/images (added)
-
tags/1.1.3/assets/images/chatbot-icon.png (added)
-
tags/1.1.3/chatbot-interface.php (added)
-
tags/1.1.3/css (added)
-
tags/1.1.3/css/frontend-transcript-styles.css (added)
-
tags/1.1.3/css/wpiko-chatbot.css (added)
-
tags/1.1.3/includes (added)
-
tags/1.1.3/includes/api-helpers.php (added)
-
tags/1.1.3/includes/cache-management.php (added)
-
tags/1.1.3/includes/conversation-handler.php (added)
-
tags/1.1.3/includes/conversation-translation.php (added)
-
tags/1.1.3/includes/files-list-handler.php (added)
-
tags/1.1.3/includes/floating-chatbot.php (added)
-
tags/1.1.3/includes/instructions-handler.php (added)
-
tags/1.1.3/includes/logging.php (added)
-
tags/1.1.3/includes/markdown-handler.php (added)
-
tags/1.1.3/includes/nonce-refresh.php (added)
-
tags/1.1.3/includes/responses-api.php (added)
-
tags/1.1.3/includes/sound-functions.php (added)
-
tags/1.1.3/includes/transcript-generator.php (added)
-
tags/1.1.3/index.php (added)
-
tags/1.1.3/js (added)
-
tags/1.1.3/js/chatbot-sound.js (added)
-
tags/1.1.3/js/howler.min.js (added)
-
tags/1.1.3/js/wpiko-chatbot.js (added)
-
tags/1.1.3/readme.txt (added)
-
tags/1.1.3/sounds (added)
-
tags/1.1.3/sounds/clear-chat-notification.mp3 (added)
-
tags/1.1.3/sounds/error-notification.mp3 (added)
-
tags/1.1.3/sounds/message-notification.mp3 (added)
-
tags/1.1.3/wpiko-chatbot.php (added)
-
trunk/chatbot-interface.php (modified) (1 diff)
-
trunk/css/wpiko-chatbot.css (modified) (4 diffs)
-
trunk/includes/cache-management.php (modified) (33 diffs)
-
trunk/includes/instructions-handler.php (modified) (2 diffs)
-
trunk/includes/markdown-handler.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wpiko-chatbot.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpiko-chatbot/trunk/chatbot-interface.php
r3454700 r3468718 104 104 $email_capture_email_placeholder = get_option('wpiko_chatbot_email_capture_email_placeholder', 'Enter your email'); 105 105 ?> 106 <div id="email-capture-overlay-container" >106 <div id="email-capture-overlay-container" style="display:none"> 107 107 <div id="email-capture-overlay"> 108 108 <h3><?php echo esc_html($email_capture_title); ?></h3> -
wpiko-chatbot/trunk/css/wpiko-chatbot.css
r3454700 r3468718 10 10 display: flex; 11 11 flex-direction: column; 12 z-index: 0; 12 13 } 13 14 … … 21 22 border-bottom: 1px solid var(--chatbot-border-color); 22 23 border-radius: 20px 20px 0 0; 23 z-index: 90 1;24 z-index: 900; 24 25 } 25 26 … … 75 76 flex-shrink: 0; 76 77 } 77 78 78 79 #chatbot-status-dot { 79 80 position: absolute; … … 508 509 #input-container { 509 510 padding: 0 8px 8px 8px; 510 z-index: 902;511 z-index: 10; 511 512 } 512 513 -
wpiko-chatbot/trunk/includes/cache-management.php
r3373160 r3468718 11 11 */ 12 12 13 class WPiko_Chatbot_Cache_Manager { 14 13 class WPiko_Chatbot_Cache_Manager 14 { 15 15 16 private static $instance = null; 16 17 private $cache_key_version = ''; 17 18 private $monitored_options = array(); 18 19 public static function get_instance() { 19 20 public static function get_instance() 21 { 20 22 if (self::$instance === null) { 21 23 self::$instance = new self(); … … 23 25 return self::$instance; 24 26 } 25 26 private function __construct() { 27 28 private function __construct() 29 { 27 30 $this->init_monitored_options(); 28 31 $this->init_hooks(); 29 32 $this->cache_key_version = $this->get_cache_key_version(); 30 33 } 31 34 32 35 /** 33 36 * Initialize the list of options that should trigger cache clearing 34 37 */ 35 private function init_monitored_options() { 38 private function init_monitored_options() 39 { 36 40 $this->monitored_options = array( 37 41 // Chatbot style options … … 53 57 'wpiko_chatbot_input_background_color', 54 58 'wpiko_chatbot_show_user_border', 55 59 56 60 // Chatbot menu options 57 61 'wpiko_chatbot_sound_enabled', 58 62 'wpiko_chatbot_enable_transcript_download', 59 63 60 64 // Floating chatbot options 61 65 'wpiko_chatbot_enable_floating', … … 66 70 'wpiko_chatbot_width', 67 71 'wpiko_chatbot_height', 68 72 69 73 // Floating chatbot exclusion options 70 74 'wpiko_chatbot_exclude_home', … … 74 78 'wpiko_chatbot_exclude_checkout', 75 79 'wpiko_chatbot_custom_exclusions', 76 80 77 81 // Questions 78 82 'wpiko_chatbot_questions', 79 83 80 84 // Pro plugin options (if active) 81 85 'wpiko_chatbot_enable_email_capture', … … 87 91 'wpiko_chatbot_contact_form_attachments', 88 92 'wpiko_chatbot_contact_form_dropdown_options', 93 'wpiko_chatbot_contact_form_custom_field_1', 94 'wpiko_chatbot_contact_form_custom_field_1_label', 95 'wpiko_chatbot_contact_form_custom_field_1_required', 96 'wpiko_chatbot_contact_form_custom_field_2', 97 'wpiko_chatbot_contact_form_custom_field_2_label', 98 'wpiko_chatbot_contact_form_custom_field_2_required', 89 99 ); 90 100 91 101 // Allow pro plugin to add more options 92 102 $this->monitored_options = apply_filters('wpiko_chatbot_cache_monitored_options', $this->monitored_options); 93 103 } 94 104 95 105 /** 96 106 * Initialize WordPress hooks 97 107 */ 98 private function init_hooks() { 108 private function init_hooks() 109 { 99 110 // Hook into option updates to clear cache 100 111 foreach ($this->monitored_options as $option) { 101 112 add_action("update_option_{$option}", array($this, 'on_option_update'), 10, 3); 102 113 } 103 114 104 115 // Add cache-busting to script/style enqueuing 105 116 add_filter('wpiko_chatbot_asset_version', array($this, 'get_dynamic_version')); 106 117 107 118 // Add cache headers for chatbot content 108 119 add_action('wp_head', array($this, 'add_cache_headers'), 1); 109 120 110 121 // Clear cache when assistant is updated 111 122 add_action('wpiko_chatbot_assistant_updated', array($this, 'clear_chatbot_cache')); 112 123 113 124 // Admin notices for cache clearing 114 125 add_action('admin_notices', array($this, 'show_cache_notices')); 115 126 } 116 127 117 128 /** 118 129 * Handle option updates 119 130 */ 120 public function on_option_update($old_value, $value, $option) { 131 public function on_option_update($old_value, $value, $option) 132 { 121 133 // Update cache key version 122 134 $this->update_cache_key_version(); 123 135 124 136 // Clear various caches 125 137 $cleared_plugins = $this->clear_chatbot_cache(); 126 138 127 139 // If this is during a form submission (POST request), show immediate notice 128 140 if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST' && !wp_doing_ajax()) { … … 133 145 set_transient('wpiko_chatbot_cleared_plugins', $cleared_plugins, 30); 134 146 } 135 147 136 148 // Log cache clearing 137 149 if (function_exists('wpiko_chatbot_log')) { … … 139 151 } 140 152 } 141 153 142 154 /** 143 155 * Get or generate cache key version 144 156 */ 145 private function get_cache_key_version() { 157 private function get_cache_key_version() 158 { 146 159 $version = get_option('wpiko_chatbot_cache_version', ''); 147 160 148 161 if (empty($version)) { 149 162 $version = $this->generate_cache_version(); 150 163 update_option('wpiko_chatbot_cache_version', $version); 151 164 } 152 165 153 166 return $version; 154 167 } 155 168 156 169 /** 157 170 * Update cache key version 158 171 */ 159 private function update_cache_key_version() { 172 private function update_cache_key_version() 173 { 160 174 $new_version = $this->generate_cache_version(); 161 175 update_option('wpiko_chatbot_cache_version', $new_version); 162 176 $this->cache_key_version = $new_version; 163 177 } 164 178 165 179 /** 166 180 * Generate a unique cache version 167 181 */ 168 private function generate_cache_version() { 182 private function generate_cache_version() 183 { 169 184 return md5(time() . wp_rand()); 170 185 } 171 186 172 187 /** 173 188 * Get dynamic version for assets 174 189 */ 175 public function get_dynamic_version($version) { 190 public function get_dynamic_version($version) 191 { 176 192 return $version . '-' . $this->cache_key_version; 177 193 } 178 194 179 195 /** 180 196 * Clear chatbot-related caches 181 197 */ 182 public function clear_chatbot_cache() { 198 public function clear_chatbot_cache() 199 { 183 200 // Clear WordPress transients 184 201 $this->clear_wordpress_cache(); 185 202 186 203 // Clear popular caching plugins and track what was cleared 187 204 $cleared_plugins = $this->clear_plugin_caches(); 188 205 189 206 // Clear page cache for pages containing chatbot 190 207 $this->clear_page_cache(); 191 208 192 209 // Clear object cache 193 210 $this->clear_object_cache(); 194 211 195 212 // Store information about what was cleared for the admin notice 196 213 set_transient('wpiko_chatbot_cleared_plugins', $cleared_plugins, 30); 197 214 198 215 return $cleared_plugins; 199 216 } 200 217 201 218 /** 202 219 * Clear WordPress native cache 203 220 */ 204 private function clear_wordpress_cache() { 221 private function clear_wordpress_cache() 222 { 205 223 // Clear WordPress transients related to chatbot 206 224 global $wpdb; 207 225 208 226 $wpdb->query( 209 227 $wpdb->prepare( … … 212 230 ) 213 231 ); 214 232 215 233 $wpdb->query( 216 234 $wpdb->prepare( … … 220 238 ); 221 239 } 222 240 223 241 /** 224 242 * Clear popular caching plugin caches 225 243 */ 226 private function clear_plugin_caches() { 244 private function clear_plugin_caches() 245 { 227 246 $cleared_plugins = array(); 228 247 229 248 // WP Rocket 230 249 if (function_exists('rocket_clean_domain')) { … … 232 251 $cleared_plugins[] = 'WP Rocket'; 233 252 } 234 253 235 254 // W3 Total Cache 236 255 if (function_exists('w3tc_flush_all')) { … … 238 257 $cleared_plugins[] = 'W3 Total Cache'; 239 258 } 240 259 241 260 // WP Super Cache 242 261 if (function_exists('wp_cache_clear_cache')) { … … 244 263 $cleared_plugins[] = 'WP Super Cache'; 245 264 } 246 265 247 266 // LiteSpeed Cache - Use modern action hook API 248 267 if (defined('LSCWP_V')) { … … 251 270 $cleared_plugins[] = 'LiteSpeed Cache'; 252 271 } 253 272 254 273 // WP Fastest Cache 255 274 if (function_exists('wpfc_clear_all_cache')) { … … 257 276 $cleared_plugins[] = 'WP Fastest Cache'; 258 277 } 259 278 260 279 // Autoptimize 261 280 if (class_exists('autoptimizeCache')) { … … 263 282 $cleared_plugins[] = 'Autoptimize'; 264 283 } 265 284 266 285 // WP Optimize 267 286 if (class_exists('WP_Optimize')) { … … 272 291 } 273 292 } 274 293 275 294 // Breeze 276 295 if (defined('BREEZE_PLUGIN_DIR') || class_exists('Breeze_Admin')) { … … 279 298 $cleared_plugins[] = 'Breeze'; 280 299 } 281 300 282 301 // SG Optimizer 283 302 if (function_exists('sg_cachepress_purge_cache')) { … … 285 304 $cleared_plugins[] = 'SG Optimizer'; 286 305 } 287 306 288 307 // Comet Cache 289 308 if (class_exists('comet_cache')) { … … 291 310 $cleared_plugins[] = 'Comet Cache'; 292 311 } 293 312 294 313 // Cache Enabler 295 314 if (class_exists('Cache_Enabler')) { … … 297 316 $cleared_plugins[] = 'Cache Enabler'; 298 317 } 299 318 300 319 // Swift Performance 301 320 if (class_exists('Swift_Performance_Cache')) { … … 303 322 $cleared_plugins[] = 'Swift Performance'; 304 323 } 305 324 306 325 // Hummingbird 307 326 if (class_exists('Hummingbird\\WP_Hummingbird')) { … … 309 328 $cleared_plugins[] = 'Hummingbird'; 310 329 } 311 330 312 331 return $cleared_plugins; 313 332 } 314 333 315 334 /** 316 335 * Clear page cache for specific pages 317 336 */ 318 private function clear_page_cache() { 337 private function clear_page_cache() 338 { 319 339 // Clear homepage cache (most likely to have floating chatbot) 320 340 $this->clear_page_cache_by_url(home_url()); 321 341 322 342 // If floating chatbot is enabled, cache is cleared globally by caching plugins 323 343 // so we don't need to identify specific pages … … 325 345 return; 326 346 } 327 347 328 348 // For shortcode usage, search for posts containing the shortcode (more efficient than meta_query) 329 349 global $wpdb; 330 350 331 351 // Get posts that contain the chatbot shortcode 332 352 $posts_with_shortcode = $wpdb->get_results( … … 340 360 ) 341 361 ); 342 362 343 363 // Clear cache for each page with shortcode 344 364 foreach ($posts_with_shortcode as $post) { … … 346 366 } 347 367 } 348 368 349 369 /** 350 370 * Clear cache for specific URL 351 371 */ 352 private function clear_page_cache_by_url($url) { 372 private function clear_page_cache_by_url($url) 373 { 353 374 // WP Rocket 354 375 if (function_exists('rocket_clean_files')) { 355 376 rocket_clean_files($url); 356 377 } 357 378 358 379 // W3 Total Cache 359 380 if (function_exists('w3tc_flush_url')) { 360 381 w3tc_flush_url($url); 361 382 } 362 383 363 384 // LiteSpeed Cache - Use modern action hook API for URL purging 364 385 if (defined('LSCWP_V')) { … … 366 387 } 367 388 } 368 389 369 390 /** 370 391 * Clear object cache 371 392 */ 372 private function clear_object_cache() { 393 private function clear_object_cache() 394 { 373 395 if (function_exists('wp_cache_flush')) { 374 396 wp_cache_flush(); 375 397 } 376 398 } 377 399 378 400 /** 379 401 * Add cache headers for chatbot content 380 402 */ 381 public function add_cache_headers() { 403 public function add_cache_headers() 404 { 382 405 // Only add headers if chatbot is present on the page 383 406 if ($this->is_chatbot_page()) { … … 393 416 } 394 417 } 395 418 396 419 /** 397 420 * Check if current page has chatbot 398 421 */ 399 private function is_chatbot_page() { 422 private function is_chatbot_page() 423 { 400 424 global $post; 401 425 402 426 // Check if floating chatbot is enabled 403 427 if (get_option('wpiko_chatbot_floating_enabled', '0') === '1') { 404 428 return true; 405 429 } 406 430 407 431 // Check if page has shortcode 408 432 if ($post && has_shortcode($post->post_content, 'wpiko_chatbot')) { 409 433 return true; 410 434 } 411 435 412 436 // Check if page has meta indicating chatbot presence 413 437 if ($post && get_post_meta($post->ID, '_wpiko_chatbot_enabled', true) === '1') { 414 438 return true; 415 439 } 416 440 417 441 return false; 418 442 } 419 443 420 444 /** 421 445 * Show admin notices when cache is cleared 422 446 */ 423 public function show_cache_notices() { 447 public function show_cache_notices() 448 { 424 449 if (get_transient('wpiko_chatbot_cache_cleared')) { 425 450 delete_transient('wpiko_chatbot_cache_cleared'); 426 451 427 452 // Get information about which plugins were cleared 428 453 $cleared_plugins = get_transient('wpiko_chatbot_cleared_plugins'); 429 454 delete_transient('wpiko_chatbot_cleared_plugins'); 430 455 431 456 // Generate appropriate message based on what was cleared 432 457 $message = $this->generate_cache_notice_message($cleared_plugins); 433 458 434 459 // Always show notice now that we provide helpful messages for all cases 435 460 ?> 436 461 <div class="notice notice-success is-dismissible"> 437 462 <p> 438 <strong>WPiko Chatbot:</strong> 463 <strong>WPiko Chatbot:</strong> 439 464 <?php echo wp_kses_post($message); ?> 440 465 </p> … … 443 468 } 444 469 } 445 470 446 471 /** 447 472 * Show immediate cache notice during form submissions 448 473 */ 449 public function show_immediate_cache_notice($cleared_plugins) { 474 public function show_immediate_cache_notice($cleared_plugins) 475 { 450 476 // Generate appropriate message based on what was cleared 451 477 $message = $this->generate_cache_notice_message($cleared_plugins); 452 478 453 479 // Show immediate success notice 454 480 echo '<div class="notice notice-success is-dismissible">'; … … 456 482 echo '</div>'; 457 483 } 458 484 459 485 /** 460 486 * Generate appropriate cache notice message 461 487 */ 462 private function generate_cache_notice_message($cleared_plugins) { 488 private function generate_cache_notice_message($cleared_plugins) 489 { 463 490 if (empty($cleared_plugins)) { 464 491 // No caching plugins detected - still show a helpful message with read more link … … 473 500 } 474 501 } 475 502 476 503 /** 477 504 * Get current cache version (public method) 478 505 */ 479 public function get_cache_version() { 506 public function get_cache_version() 507 { 480 508 return $this->cache_key_version; 481 509 } … … 483 511 484 512 // Initialize the cache manager 485 function wpiko_chatbot_init_cache_manager() { 513 function wpiko_chatbot_init_cache_manager() 514 { 486 515 return WPiko_Chatbot_Cache_Manager::get_instance(); 487 516 } … … 489 518 490 519 // Helper functions for other parts of the plugin 491 function wpiko_chatbot_get_cache_version() { 520 function wpiko_chatbot_get_cache_version() 521 { 492 522 $cache_manager = WPiko_Chatbot_Cache_Manager::get_instance(); 493 523 return $cache_manager->get_cache_version(); 494 524 } 495 525 496 function wpiko_chatbot_get_detected_cache_plugins() { 526 function wpiko_chatbot_get_detected_cache_plugins() 527 { 497 528 $cache_manager = WPiko_Chatbot_Cache_Manager::get_instance(); 498 529 return $cache_manager->get_detected_cache_plugins(); 499 530 } 500 531 501 function wpiko_chatbot_clear_file_cache() { 532 function wpiko_chatbot_clear_file_cache() 533 { 502 534 $cache_manager = WPiko_Chatbot_Cache_Manager::get_instance(); 503 535 return $cache_manager->clear_chatbot_cache(); -
wpiko-chatbot/trunk/includes/instructions-handler.php
r3373160 r3468718 172 172 $combined .= "ORDERS INSTRUCTIONS:\n\n" . $orders_instructions; 173 173 } 174 175 // Allow pro plugins to append additional instruction sections (e.g. contact form AI instructions) 176 $combined = apply_filters('wpiko_chatbot_combined_instructions', $combined); 174 177 175 178 return $combined; … … 276 279 $combined .= "ORDERS INSTRUCTIONS:\n\n" . $orders_instructions; 277 280 } 281 282 // Allow pro plugins to append additional instruction sections (e.g. contact form AI instructions) 283 $combined = apply_filters('wpiko_chatbot_combined_instructions', $combined); 278 284 279 285 return $combined; -
wpiko-chatbot/trunk/includes/markdown-handler.php
r3446013 r3468718 66 66 return $placeholder . $suffix; 67 67 }, $text); 68 69 // Allow plugins to extract and protect custom markers before markdown processing 70 // This prevents markdown (bold/italic) from mangling content inside markers 71 $text = apply_filters('wpiko_chatbot_before_markdown', $text); 68 72 69 73 // Apply markdown processing -
wpiko-chatbot/trunk/readme.txt
r3464145 r3468718 4 4 Requires at least: 6.0 5 5 Tested up to: 6.9 6 Stable tag: 1.1. 26 Stable tag: 1.1.3 7 7 Requires PHP: 7.0 8 8 License: GPL-2.0+ … … 123 123 == Changelog == 124 124 125 = 1.1.3 = 126 * Fix: Shortcode chatbot overlap issue (Z-index fix) 127 * Info: This release includes new AI-powered contact form features in wpiko-chatbot-pro. 128 125 129 = 1.1.2 = 126 130 * Improve: Sound notifications -
wpiko-chatbot/trunk/wpiko-chatbot.php
r3464145 r3468718 4 4 * Plugin URI: https://wpiko.com/chatbot 5 5 * Description: A WordPress plugin that integrates OpenAI's AI models to create an intelligent chatbot for WordPress websites. 6 * Version: 1.1. 26 * Version: 1.1.3 7 7 * Author: WPiko 8 8 * Author URI: https://wpiko.com … … 20 20 define('WPIKO_CHATBOT_PLUGIN_DIR', plugin_dir_path(__FILE__)); 21 21 define('WPIKO_CHATBOT_PLUGIN_URL', plugin_dir_url(__FILE__)); 22 define('WPIKO_CHATBOT_VERSION', '1.1. 2');22 define('WPIKO_CHATBOT_VERSION', '1.1.3'); 23 23 24 24 // Ensures that the default options is set
Note: See TracChangeset
for help on using the changeset viewer.