Plugin Directory

Changeset 3468718


Ignore:
Timestamp:
02/24/2026 02:58:45 PM (5 weeks ago)
Author:
wpiko
Message:

1.1.3

  • Fix: Shortcode chatbot overlap issue (Z-index fix)
  • Info: This release includes new AI-powered contact form features in wpiko-chatbot-pro.
Location:
wpiko-chatbot
Files:
72 added
7 edited

Legend:

Unmodified
Added
Removed
  • wpiko-chatbot/trunk/chatbot-interface.php

    r3454700 r3468718  
    104104            $email_capture_email_placeholder = get_option('wpiko_chatbot_email_capture_email_placeholder', 'Enter your email');
    105105            ?>
    106             <div id="email-capture-overlay-container">
     106            <div id="email-capture-overlay-container" style="display:none">
    107107                <div id="email-capture-overlay">
    108108                    <h3><?php echo esc_html($email_capture_title); ?></h3>
  • wpiko-chatbot/trunk/css/wpiko-chatbot.css

    r3454700 r3468718  
    1010    display: flex;
    1111    flex-direction: column;
     12    z-index: 0;
    1213}
    1314
     
    2122    border-bottom: 1px solid var(--chatbot-border-color);
    2223    border-radius: 20px 20px 0 0;
    23     z-index: 901;
     24    z-index: 900;
    2425}
    2526
     
    7576    flex-shrink: 0;
    7677}
    77  
     78
    7879#chatbot-status-dot {
    7980    position: absolute;
     
    508509#input-container {
    509510    padding: 0 8px 8px 8px;
    510     z-index: 902;
     511    z-index: 10;
    511512}
    512513
  • wpiko-chatbot/trunk/includes/cache-management.php

    r3373160 r3468718  
    1111 */
    1212
    13 class WPiko_Chatbot_Cache_Manager {
    14    
     13class WPiko_Chatbot_Cache_Manager
     14{
     15
    1516    private static $instance = null;
    1617    private $cache_key_version = '';
    1718    private $monitored_options = array();
    18    
    19     public static function get_instance() {
     19
     20    public static function get_instance()
     21    {
    2022        if (self::$instance === null) {
    2123            self::$instance = new self();
     
    2325        return self::$instance;
    2426    }
    25    
    26     private function __construct() {
     27
     28    private function __construct()
     29    {
    2730        $this->init_monitored_options();
    2831        $this->init_hooks();
    2932        $this->cache_key_version = $this->get_cache_key_version();
    3033    }
    31    
     34
    3235    /**
    3336     * Initialize the list of options that should trigger cache clearing
    3437     */
    35     private function init_monitored_options() {
     38    private function init_monitored_options()
     39    {
    3640        $this->monitored_options = array(
    3741            // Chatbot style options
     
    5357            'wpiko_chatbot_input_background_color',
    5458            'wpiko_chatbot_show_user_border',
    55            
     59
    5660            // Chatbot menu options
    5761            'wpiko_chatbot_sound_enabled',
    5862            'wpiko_chatbot_enable_transcript_download',
    59            
     63
    6064            // Floating chatbot options
    6165            'wpiko_chatbot_enable_floating',
     
    6670            'wpiko_chatbot_width',
    6771            'wpiko_chatbot_height',
    68            
     72
    6973            // Floating chatbot exclusion options
    7074            'wpiko_chatbot_exclude_home',
     
    7478            'wpiko_chatbot_exclude_checkout',
    7579            'wpiko_chatbot_custom_exclusions',
    76            
     80
    7781            // Questions
    7882            'wpiko_chatbot_questions',
    79            
     83
    8084            // Pro plugin options (if active)
    8185            'wpiko_chatbot_enable_email_capture',
     
    8791            'wpiko_chatbot_contact_form_attachments',
    8892            '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',
    8999        );
    90        
     100
    91101        // Allow pro plugin to add more options
    92102        $this->monitored_options = apply_filters('wpiko_chatbot_cache_monitored_options', $this->monitored_options);
    93103    }
    94    
     104
    95105    /**
    96106     * Initialize WordPress hooks
    97107     */
    98     private function init_hooks() {
     108    private function init_hooks()
     109    {
    99110        // Hook into option updates to clear cache
    100111        foreach ($this->monitored_options as $option) {
    101112            add_action("update_option_{$option}", array($this, 'on_option_update'), 10, 3);
    102113        }
    103        
     114
    104115        // Add cache-busting to script/style enqueuing
    105116        add_filter('wpiko_chatbot_asset_version', array($this, 'get_dynamic_version'));
    106        
     117
    107118        // Add cache headers for chatbot content
    108119        add_action('wp_head', array($this, 'add_cache_headers'), 1);
    109        
     120
    110121        // Clear cache when assistant is updated
    111122        add_action('wpiko_chatbot_assistant_updated', array($this, 'clear_chatbot_cache'));
    112        
     123
    113124        // Admin notices for cache clearing
    114125        add_action('admin_notices', array($this, 'show_cache_notices'));
    115126    }
    116    
     127
    117128    /**
    118129     * Handle option updates
    119130     */
    120     public function on_option_update($old_value, $value, $option) {
     131    public function on_option_update($old_value, $value, $option)
     132    {
    121133        // Update cache key version
    122134        $this->update_cache_key_version();
    123        
     135
    124136        // Clear various caches
    125137        $cleared_plugins = $this->clear_chatbot_cache();
    126        
     138
    127139        // If this is during a form submission (POST request), show immediate notice
    128140        if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST' && !wp_doing_ajax()) {
     
    133145            set_transient('wpiko_chatbot_cleared_plugins', $cleared_plugins, 30);
    134146        }
    135        
     147
    136148        // Log cache clearing
    137149        if (function_exists('wpiko_chatbot_log')) {
     
    139151        }
    140152    }
    141    
     153
    142154    /**
    143155     * Get or generate cache key version
    144156     */
    145     private function get_cache_key_version() {
     157    private function get_cache_key_version()
     158    {
    146159        $version = get_option('wpiko_chatbot_cache_version', '');
    147        
     160
    148161        if (empty($version)) {
    149162            $version = $this->generate_cache_version();
    150163            update_option('wpiko_chatbot_cache_version', $version);
    151164        }
    152        
     165
    153166        return $version;
    154167    }
    155    
     168
    156169    /**
    157170     * Update cache key version
    158171     */
    159     private function update_cache_key_version() {
     172    private function update_cache_key_version()
     173    {
    160174        $new_version = $this->generate_cache_version();
    161175        update_option('wpiko_chatbot_cache_version', $new_version);
    162176        $this->cache_key_version = $new_version;
    163177    }
    164    
     178
    165179    /**
    166180     * Generate a unique cache version
    167181     */
    168     private function generate_cache_version() {
     182    private function generate_cache_version()
     183    {
    169184        return md5(time() . wp_rand());
    170185    }
    171    
     186
    172187    /**
    173188     * Get dynamic version for assets
    174189     */
    175     public function get_dynamic_version($version) {
     190    public function get_dynamic_version($version)
     191    {
    176192        return $version . '-' . $this->cache_key_version;
    177193    }
    178    
     194
    179195    /**
    180196     * Clear chatbot-related caches
    181197     */
    182     public function clear_chatbot_cache() {
     198    public function clear_chatbot_cache()
     199    {
    183200        // Clear WordPress transients
    184201        $this->clear_wordpress_cache();
    185        
     202
    186203        // Clear popular caching plugins and track what was cleared
    187204        $cleared_plugins = $this->clear_plugin_caches();
    188        
     205
    189206        // Clear page cache for pages containing chatbot
    190207        $this->clear_page_cache();
    191        
     208
    192209        // Clear object cache
    193210        $this->clear_object_cache();
    194        
     211
    195212        // Store information about what was cleared for the admin notice
    196213        set_transient('wpiko_chatbot_cleared_plugins', $cleared_plugins, 30);
    197        
     214
    198215        return $cleared_plugins;
    199216    }
    200    
     217
    201218    /**
    202219     * Clear WordPress native cache
    203220     */
    204     private function clear_wordpress_cache() {
     221    private function clear_wordpress_cache()
     222    {
    205223        // Clear WordPress transients related to chatbot
    206224        global $wpdb;
    207        
     225
    208226        $wpdb->query(
    209227            $wpdb->prepare(
     
    212230            )
    213231        );
    214        
     232
    215233        $wpdb->query(
    216234            $wpdb->prepare(
     
    220238        );
    221239    }
    222    
     240
    223241    /**
    224242     * Clear popular caching plugin caches
    225243     */
    226     private function clear_plugin_caches() {
     244    private function clear_plugin_caches()
     245    {
    227246        $cleared_plugins = array();
    228        
     247
    229248        // WP Rocket
    230249        if (function_exists('rocket_clean_domain')) {
     
    232251            $cleared_plugins[] = 'WP Rocket';
    233252        }
    234        
     253
    235254        // W3 Total Cache
    236255        if (function_exists('w3tc_flush_all')) {
     
    238257            $cleared_plugins[] = 'W3 Total Cache';
    239258        }
    240        
     259
    241260        // WP Super Cache
    242261        if (function_exists('wp_cache_clear_cache')) {
     
    244263            $cleared_plugins[] = 'WP Super Cache';
    245264        }
    246        
     265
    247266        // LiteSpeed Cache - Use modern action hook API
    248267        if (defined('LSCWP_V')) {
     
    251270            $cleared_plugins[] = 'LiteSpeed Cache';
    252271        }
    253        
     272
    254273        // WP Fastest Cache
    255274        if (function_exists('wpfc_clear_all_cache')) {
     
    257276            $cleared_plugins[] = 'WP Fastest Cache';
    258277        }
    259        
     278
    260279        // Autoptimize
    261280        if (class_exists('autoptimizeCache')) {
     
    263282            $cleared_plugins[] = 'Autoptimize';
    264283        }
    265        
     284
    266285        // WP Optimize
    267286        if (class_exists('WP_Optimize')) {
     
    272291            }
    273292        }
    274        
     293
    275294        // Breeze
    276295        if (defined('BREEZE_PLUGIN_DIR') || class_exists('Breeze_Admin')) {
     
    279298            $cleared_plugins[] = 'Breeze';
    280299        }
    281        
     300
    282301        // SG Optimizer
    283302        if (function_exists('sg_cachepress_purge_cache')) {
     
    285304            $cleared_plugins[] = 'SG Optimizer';
    286305        }
    287        
     306
    288307        // Comet Cache
    289308        if (class_exists('comet_cache')) {
     
    291310            $cleared_plugins[] = 'Comet Cache';
    292311        }
    293        
     312
    294313        // Cache Enabler
    295314        if (class_exists('Cache_Enabler')) {
     
    297316            $cleared_plugins[] = 'Cache Enabler';
    298317        }
    299        
     318
    300319        // Swift Performance
    301320        if (class_exists('Swift_Performance_Cache')) {
     
    303322            $cleared_plugins[] = 'Swift Performance';
    304323        }
    305        
     324
    306325        // Hummingbird
    307326        if (class_exists('Hummingbird\\WP_Hummingbird')) {
     
    309328            $cleared_plugins[] = 'Hummingbird';
    310329        }
    311        
     330
    312331        return $cleared_plugins;
    313332    }
    314    
     333
    315334    /**
    316335     * Clear page cache for specific pages
    317336     */
    318     private function clear_page_cache() {
     337    private function clear_page_cache()
     338    {
    319339        // Clear homepage cache (most likely to have floating chatbot)
    320340        $this->clear_page_cache_by_url(home_url());
    321        
     341
    322342        // If floating chatbot is enabled, cache is cleared globally by caching plugins
    323343        // so we don't need to identify specific pages
     
    325345            return;
    326346        }
    327        
     347
    328348        // For shortcode usage, search for posts containing the shortcode (more efficient than meta_query)
    329349        global $wpdb;
    330        
     350
    331351        // Get posts that contain the chatbot shortcode
    332352        $posts_with_shortcode = $wpdb->get_results(
     
    340360            )
    341361        );
    342        
     362
    343363        // Clear cache for each page with shortcode
    344364        foreach ($posts_with_shortcode as $post) {
     
    346366        }
    347367    }
    348    
     368
    349369    /**
    350370     * Clear cache for specific URL
    351371     */
    352     private function clear_page_cache_by_url($url) {
     372    private function clear_page_cache_by_url($url)
     373    {
    353374        // WP Rocket
    354375        if (function_exists('rocket_clean_files')) {
    355376            rocket_clean_files($url);
    356377        }
    357        
     378
    358379        // W3 Total Cache
    359380        if (function_exists('w3tc_flush_url')) {
    360381            w3tc_flush_url($url);
    361382        }
    362        
     383
    363384        // LiteSpeed Cache - Use modern action hook API for URL purging
    364385        if (defined('LSCWP_V')) {
     
    366387        }
    367388    }
    368    
     389
    369390    /**
    370391     * Clear object cache
    371392     */
    372     private function clear_object_cache() {
     393    private function clear_object_cache()
     394    {
    373395        if (function_exists('wp_cache_flush')) {
    374396            wp_cache_flush();
    375397        }
    376398    }
    377    
     399
    378400    /**
    379401     * Add cache headers for chatbot content
    380402     */
    381     public function add_cache_headers() {
     403    public function add_cache_headers()
     404    {
    382405        // Only add headers if chatbot is present on the page
    383406        if ($this->is_chatbot_page()) {
     
    393416        }
    394417    }
    395    
     418
    396419    /**
    397420     * Check if current page has chatbot
    398421     */
    399     private function is_chatbot_page() {
     422    private function is_chatbot_page()
     423    {
    400424        global $post;
    401        
     425
    402426        // Check if floating chatbot is enabled
    403427        if (get_option('wpiko_chatbot_floating_enabled', '0') === '1') {
    404428            return true;
    405429        }
    406        
     430
    407431        // Check if page has shortcode
    408432        if ($post && has_shortcode($post->post_content, 'wpiko_chatbot')) {
    409433            return true;
    410434        }
    411        
     435
    412436        // Check if page has meta indicating chatbot presence
    413437        if ($post && get_post_meta($post->ID, '_wpiko_chatbot_enabled', true) === '1') {
    414438            return true;
    415439        }
    416        
     440
    417441        return false;
    418442    }
    419    
     443
    420444    /**
    421445     * Show admin notices when cache is cleared
    422446     */
    423     public function show_cache_notices() {
     447    public function show_cache_notices()
     448    {
    424449        if (get_transient('wpiko_chatbot_cache_cleared')) {
    425450            delete_transient('wpiko_chatbot_cache_cleared');
    426            
     451
    427452            // Get information about which plugins were cleared
    428453            $cleared_plugins = get_transient('wpiko_chatbot_cleared_plugins');
    429454            delete_transient('wpiko_chatbot_cleared_plugins');
    430            
     455
    431456            // Generate appropriate message based on what was cleared
    432457            $message = $this->generate_cache_notice_message($cleared_plugins);
    433            
     458
    434459            // Always show notice now that we provide helpful messages for all cases
    435460            ?>
    436461            <div class="notice notice-success is-dismissible">
    437462                <p>
    438                     <strong>WPiko Chatbot:</strong> 
     463                    <strong>WPiko Chatbot:</strong>
    439464                    <?php echo wp_kses_post($message); ?>
    440465                </p>
     
    443468        }
    444469    }
    445    
     470
    446471    /**
    447472     * Show immediate cache notice during form submissions
    448473     */
    449     public function show_immediate_cache_notice($cleared_plugins) {
     474    public function show_immediate_cache_notice($cleared_plugins)
     475    {
    450476        // Generate appropriate message based on what was cleared
    451477        $message = $this->generate_cache_notice_message($cleared_plugins);
    452        
     478
    453479        // Show immediate success notice
    454480        echo '<div class="notice notice-success is-dismissible">';
     
    456482        echo '</div>';
    457483    }
    458    
     484
    459485    /**
    460486     * Generate appropriate cache notice message
    461487     */
    462     private function generate_cache_notice_message($cleared_plugins) {
     488    private function generate_cache_notice_message($cleared_plugins)
     489    {
    463490        if (empty($cleared_plugins)) {
    464491            // No caching plugins detected - still show a helpful message with read more link
     
    473500        }
    474501    }
    475    
     502
    476503    /**
    477504     * Get current cache version (public method)
    478505     */
    479     public function get_cache_version() {
     506    public function get_cache_version()
     507    {
    480508        return $this->cache_key_version;
    481509    }
     
    483511
    484512// Initialize the cache manager
    485 function wpiko_chatbot_init_cache_manager() {
     513function wpiko_chatbot_init_cache_manager()
     514{
    486515    return WPiko_Chatbot_Cache_Manager::get_instance();
    487516}
     
    489518
    490519// Helper functions for other parts of the plugin
    491 function wpiko_chatbot_get_cache_version() {
     520function wpiko_chatbot_get_cache_version()
     521{
    492522    $cache_manager = WPiko_Chatbot_Cache_Manager::get_instance();
    493523    return $cache_manager->get_cache_version();
    494524}
    495525
    496 function wpiko_chatbot_get_detected_cache_plugins() {
     526function wpiko_chatbot_get_detected_cache_plugins()
     527{
    497528    $cache_manager = WPiko_Chatbot_Cache_Manager::get_instance();
    498529    return $cache_manager->get_detected_cache_plugins();
    499530}
    500531
    501 function wpiko_chatbot_clear_file_cache() {
     532function wpiko_chatbot_clear_file_cache()
     533{
    502534    $cache_manager = WPiko_Chatbot_Cache_Manager::get_instance();
    503535    return $cache_manager->clear_chatbot_cache();
  • wpiko-chatbot/trunk/includes/instructions-handler.php

    r3373160 r3468718  
    172172        $combined .= "ORDERS INSTRUCTIONS:\n\n" . $orders_instructions;
    173173    }
     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);
    174177   
    175178    return $combined;
     
    276279        $combined .= "ORDERS INSTRUCTIONS:\n\n" . $orders_instructions;
    277280    }
     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);
    278284   
    279285    return $combined;
  • wpiko-chatbot/trunk/includes/markdown-handler.php

    r3446013 r3468718  
    6666        return $placeholder . $suffix;
    6767    }, $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);
    6872
    6973    // Apply markdown processing
  • wpiko-chatbot/trunk/readme.txt

    r3464145 r3468718  
    44Requires at least: 6.0
    55Tested up to: 6.9
    6 Stable tag: 1.1.2
     6Stable tag: 1.1.3
    77Requires PHP: 7.0
    88License: GPL-2.0+
     
    123123== Changelog ==
    124124
     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
    125129= 1.1.2 =
    126130* Improve: Sound notifications
  • wpiko-chatbot/trunk/wpiko-chatbot.php

    r3464145 r3468718  
    44 * Plugin URI: https://wpiko.com/chatbot
    55 * Description: A WordPress plugin that integrates OpenAI's AI models to create an intelligent chatbot for WordPress websites.
    6  * Version: 1.1.2
     6 * Version: 1.1.3
    77 * Author: WPiko
    88 * Author URI: https://wpiko.com
     
    2020define('WPIKO_CHATBOT_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2121define('WPIKO_CHATBOT_PLUGIN_URL', plugin_dir_url(__FILE__));
    22 define('WPIKO_CHATBOT_VERSION', '1.1.2');
     22define('WPIKO_CHATBOT_VERSION', '1.1.3');
    2323
    2424// Ensures that the default options is set
Note: See TracChangeset for help on using the changeset viewer.