Changeset 3332960
- Timestamp:
- 07/23/2025 01:33:43 PM (8 months ago)
- Location:
- muchat-ai
- Files:
-
- 10 edited
- 1 copied
-
tags/2.0.44 (copied) (copied from muchat-ai/trunk)
-
tags/2.0.44/includes/Admin/Settings.php (modified) (3 diffs)
-
tags/2.0.44/includes/Frontend/Widget.php (modified) (2 diffs)
-
tags/2.0.44/muchat-ai.php (modified) (2 diffs)
-
tags/2.0.44/readme.txt (modified) (2 diffs)
-
tags/2.0.44/templates/admin/widget-settings.php (modified) (1 diff)
-
trunk/includes/Admin/Settings.php (modified) (3 diffs)
-
trunk/includes/Frontend/Widget.php (modified) (2 diffs)
-
trunk/muchat-ai.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/templates/admin/widget-settings.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
muchat-ai/tags/2.0.44/includes/Admin/Settings.php
r3332933 r3332960 247 247 $guest_context = get_option('muchat_ai_chatbot_guest_context', ''); 248 248 $load_strategy = get_option('muchat_ai_chatbot_load_strategy', 'FAST'); 249 $script_position = get_option('muchat_ai_chatbot_script_position', 'head'); 249 250 $use_logged_in_user_info = get_option('muchat_ai_chatbot_use_logged_in_user_info', ''); 250 251 $widget_enabled = get_option('muchat_ai_chatbot_widget_enabled', '1'); … … 835 836 'default' => 'FAST' 836 837 )); 838 register_setting('muchat-settings-group', 'muchat_ai_chatbot_script_position', array( 839 'type' => 'string', 840 'sanitize_callback' => 'sanitize_text_field' 841 )); 837 842 register_setting('muchat-settings-group', 'muchat_ai_chatbot_use_logged_in_user_info', array( 838 843 'type' => 'string', … … 910 915 // Default load strategy 911 916 add_option('muchat_ai_chatbot_load_strategy', 'FAST'); 917 add_option('muchat_ai_chatbot_script_position', 'footer'); 912 918 913 919 // Default visibility settings -
muchat-ai/tags/2.0.44/includes/Frontend/Widget.php
r3332933 r3332960 10 10 public function __construct() 11 11 { 12 add_action('wp_head', [$this, 'hook_head'], 1); 12 // For existing users, the option won't exist, so we default to 'head' for 13 // backward compatibility. For new installs, the default is set to 'footer' 14 // in 'includes/Admin/Settings.php' during activation. 15 $position = get_option('muchat_ai_chatbot_script_position', 'head'); 16 $hook = 'wp_head'; // Default hook 17 18 if ($position === 'footer') { 19 $hook = 'wp_footer'; 20 } elseif ($position === 'body_open') { 21 // wp_body_open was introduced in WP 5.2. 22 // We'll use it if available, otherwise fallback to wp_footer. 23 if (function_exists('wp_body_open')) { 24 $hook = 'wp_body_open'; 25 } else { 26 $hook = 'wp_footer'; 27 } 28 } 29 30 add_action($hook, [$this, 'hook_head'], 1); 13 31 $this->register_cache_clearing_hooks(); 14 32 } … … 23 41 add_action('update_option_muchat_ai_chatbot_use_logged_in_user_info', [$this, 'clear_widget_cache']); 24 42 add_action('update_option_muchat_ai_chatbot_load_strategy', [$this, 'clear_widget_cache']); 43 add_action('update_option_muchat_ai_chatbot_script_position', [$this, 'clear_widget_cache']); 25 44 add_action('update_option_muchat_ai_chatbot_widget_enabled', [$this, 'clear_widget_cache']); 26 45 } -
muchat-ai/tags/2.0.44/muchat-ai.php
r3332933 r3332960 5 5 * Plugin URI: https://mu.chat 6 6 * Description: Muchat, a powerful tool for customer support using artificial intelligence 7 * Version: 2.0.4 37 * Version: 2.0.44 8 8 * Author: Muchat 9 9 * Text Domain: muchat-ai … … 27 27 28 28 // Define plugin constants with unique prefix 29 define('MUCHAT_AI_CHATBOT_PLUGIN_VERSION', '2.0.4 3');29 define('MUCHAT_AI_CHATBOT_PLUGIN_VERSION', '2.0.44'); 30 30 // define('MUCHAT_AI_CHATBOT_CACHE_DURATION', HOUR_IN_SECONDS); 31 31 define('MUCHAT_AI_CHATBOT_PLUGIN_FILE', __FILE__); -
muchat-ai/tags/2.0.44/readme.txt
r3332933 r3332960 4 4 Requires at least: 5.0 5 5 Tested up to: 6.8 6 Stable tag: 2.0.4 36 Stable tag: 2.0.44 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 75 75 76 76 == Changelog == 77 78 = 2.0.44 = 79 * Feature: Added a "Script Load Position" setting (Header, Footer, Body Opening) to provide control over widget loading and improve site performance. 80 * Tweak: The default script load position for new installations is now "Footer" for better performance, while maintaining "Header" for existing sites to ensure backward compatibility. 77 81 78 82 = 2.0.43 = -
muchat-ai/tags/2.0.44/templates/admin/widget-settings.php
r3332933 r3332960 186 186 </td> 187 187 </tr> 188 <tr valign="top"> 189 <th scope="row"><?php esc_html_e('Script Load Position', 'muchat-ai'); ?></th> 190 <td> 191 <select name="muchat_ai_chatbot_script_position" class="regular-text"> 192 <option value="footer" <?php selected($script_position, 'footer'); ?>><?php esc_html_e('Footer (Recommended for Performance)', 'muchat-ai'); ?></option> 193 <option value="head" <?php selected($script_position, 'head'); ?>><?php esc_html_e('Header', 'muchat-ai'); ?></option> 194 <option value="body_open" <?php selected($script_position, 'body_open'); ?>><?php esc_html_e('Body Opening', 'muchat-ai'); ?></option> 195 </select> 196 <p class="description"> 197 <?php esc_html_e('Determines where the widget script is loaded on your page. Loading in the footer improves page speed.', 'muchat-ai'); ?> 198 </p> 199 </td> 200 </tr> 188 201 </table> 189 202 </div> -
muchat-ai/trunk/includes/Admin/Settings.php
r3332933 r3332960 247 247 $guest_context = get_option('muchat_ai_chatbot_guest_context', ''); 248 248 $load_strategy = get_option('muchat_ai_chatbot_load_strategy', 'FAST'); 249 $script_position = get_option('muchat_ai_chatbot_script_position', 'head'); 249 250 $use_logged_in_user_info = get_option('muchat_ai_chatbot_use_logged_in_user_info', ''); 250 251 $widget_enabled = get_option('muchat_ai_chatbot_widget_enabled', '1'); … … 835 836 'default' => 'FAST' 836 837 )); 838 register_setting('muchat-settings-group', 'muchat_ai_chatbot_script_position', array( 839 'type' => 'string', 840 'sanitize_callback' => 'sanitize_text_field' 841 )); 837 842 register_setting('muchat-settings-group', 'muchat_ai_chatbot_use_logged_in_user_info', array( 838 843 'type' => 'string', … … 910 915 // Default load strategy 911 916 add_option('muchat_ai_chatbot_load_strategy', 'FAST'); 917 add_option('muchat_ai_chatbot_script_position', 'footer'); 912 918 913 919 // Default visibility settings -
muchat-ai/trunk/includes/Frontend/Widget.php
r3332933 r3332960 10 10 public function __construct() 11 11 { 12 add_action('wp_head', [$this, 'hook_head'], 1); 12 // For existing users, the option won't exist, so we default to 'head' for 13 // backward compatibility. For new installs, the default is set to 'footer' 14 // in 'includes/Admin/Settings.php' during activation. 15 $position = get_option('muchat_ai_chatbot_script_position', 'head'); 16 $hook = 'wp_head'; // Default hook 17 18 if ($position === 'footer') { 19 $hook = 'wp_footer'; 20 } elseif ($position === 'body_open') { 21 // wp_body_open was introduced in WP 5.2. 22 // We'll use it if available, otherwise fallback to wp_footer. 23 if (function_exists('wp_body_open')) { 24 $hook = 'wp_body_open'; 25 } else { 26 $hook = 'wp_footer'; 27 } 28 } 29 30 add_action($hook, [$this, 'hook_head'], 1); 13 31 $this->register_cache_clearing_hooks(); 14 32 } … … 23 41 add_action('update_option_muchat_ai_chatbot_use_logged_in_user_info', [$this, 'clear_widget_cache']); 24 42 add_action('update_option_muchat_ai_chatbot_load_strategy', [$this, 'clear_widget_cache']); 43 add_action('update_option_muchat_ai_chatbot_script_position', [$this, 'clear_widget_cache']); 25 44 add_action('update_option_muchat_ai_chatbot_widget_enabled', [$this, 'clear_widget_cache']); 26 45 } -
muchat-ai/trunk/muchat-ai.php
r3332933 r3332960 5 5 * Plugin URI: https://mu.chat 6 6 * Description: Muchat, a powerful tool for customer support using artificial intelligence 7 * Version: 2.0.4 37 * Version: 2.0.44 8 8 * Author: Muchat 9 9 * Text Domain: muchat-ai … … 27 27 28 28 // Define plugin constants with unique prefix 29 define('MUCHAT_AI_CHATBOT_PLUGIN_VERSION', '2.0.4 3');29 define('MUCHAT_AI_CHATBOT_PLUGIN_VERSION', '2.0.44'); 30 30 // define('MUCHAT_AI_CHATBOT_CACHE_DURATION', HOUR_IN_SECONDS); 31 31 define('MUCHAT_AI_CHATBOT_PLUGIN_FILE', __FILE__); -
muchat-ai/trunk/readme.txt
r3332933 r3332960 4 4 Requires at least: 5.0 5 5 Tested up to: 6.8 6 Stable tag: 2.0.4 36 Stable tag: 2.0.44 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 75 75 76 76 == Changelog == 77 78 = 2.0.44 = 79 * Feature: Added a "Script Load Position" setting (Header, Footer, Body Opening) to provide control over widget loading and improve site performance. 80 * Tweak: The default script load position for new installations is now "Footer" for better performance, while maintaining "Header" for existing sites to ensure backward compatibility. 77 81 78 82 = 2.0.43 = -
muchat-ai/trunk/templates/admin/widget-settings.php
r3332933 r3332960 186 186 </td> 187 187 </tr> 188 <tr valign="top"> 189 <th scope="row"><?php esc_html_e('Script Load Position', 'muchat-ai'); ?></th> 190 <td> 191 <select name="muchat_ai_chatbot_script_position" class="regular-text"> 192 <option value="footer" <?php selected($script_position, 'footer'); ?>><?php esc_html_e('Footer (Recommended for Performance)', 'muchat-ai'); ?></option> 193 <option value="head" <?php selected($script_position, 'head'); ?>><?php esc_html_e('Header', 'muchat-ai'); ?></option> 194 <option value="body_open" <?php selected($script_position, 'body_open'); ?>><?php esc_html_e('Body Opening', 'muchat-ai'); ?></option> 195 </select> 196 <p class="description"> 197 <?php esc_html_e('Determines where the widget script is loaded on your page. Loading in the footer improves page speed.', 'muchat-ai'); ?> 198 </p> 199 </td> 200 </tr> 188 201 </table> 189 202 </div>
Note: See TracChangeset
for help on using the changeset viewer.