Changeset 3840711
- Timestamp:
- 12/02/2026 05:16:24 PM (29 hours ago)
- Location:
- larkbots-ai-chat
- Files:
-
- 28 added
- 10 edited
- 1 copied
-
tags/1.3.0 (copied) (copied from larkbots-ai-chat/trunk )
-
tags/1.3.0/includes/class-larkbots-admin.php (modified) (3 diffs)
-
tags/1.3.0/includes/class-larkbots-connection.php (modified) (1 diff)
-
tags/1.3.0/includes/class-larkbots-widget.php (modified) (1 diff)
-
tags/1.3.0/languages/larkbots-ai-chat-de_DE.mo (added)
-
tags/1.3.0/languages/larkbots-ai-chat-de_DE.po (added)
-
tags/1.3.0/languages/larkbots-ai-chat-es_US.mo (added)
-
tags/1.3.0/languages/larkbots-ai-chat-es_US.po (added)
-
tags/1.3.0/languages/larkbots-ai-chat-fr_FR.mo (added)
-
tags/1.3.0/languages/larkbots-ai-chat-fr_FR.po (added)
-
tags/1.3.0/languages/larkbots-ai-chat-ja.mo (added)
-
tags/1.3.0/languages/larkbots-ai-chat-ja.po (added)
-
tags/1.3.0/languages/larkbots-ai-chat-pt_BR.mo (added)
-
tags/1.3.0/languages/larkbots-ai-chat-pt_BR.po (added)
-
tags/1.3.0/languages/larkbots-ai-chat-zh_CN.mo (added)
-
tags/1.3.0/languages/larkbots-ai-chat-zh_CN.po (added)
-
tags/1.3.0/languages/larkbots-ai-chat-zh_TW.mo (added)
-
tags/1.3.0/languages/larkbots-ai-chat-zh_TW.po (added)
-
tags/1.3.0/larkbots-ai-chat.php (modified) (3 diffs)
-
tags/1.3.0/readme.txt (modified) (2 diffs)
-
trunk/includes/class-larkbots-admin.php (modified) (3 diffs)
-
trunk/includes/class-larkbots-connection.php (modified) (1 diff)
-
trunk/includes/class-larkbots-widget.php (modified) (1 diff)
-
trunk/languages/larkbots-ai-chat-de_DE.mo (added)
-
trunk/languages/larkbots-ai-chat-de_DE.po (added)
-
trunk/languages/larkbots-ai-chat-es_US.mo (added)
-
trunk/languages/larkbots-ai-chat-es_US.po (added)
-
trunk/languages/larkbots-ai-chat-fr_FR.mo (added)
-
trunk/languages/larkbots-ai-chat-fr_FR.po (added)
-
trunk/languages/larkbots-ai-chat-ja.mo (added)
-
trunk/languages/larkbots-ai-chat-ja.po (added)
-
trunk/languages/larkbots-ai-chat-pt_BR.mo (added)
-
trunk/languages/larkbots-ai-chat-pt_BR.po (added)
-
trunk/languages/larkbots-ai-chat-zh_CN.mo (added)
-
trunk/languages/larkbots-ai-chat-zh_CN.po (added)
-
trunk/languages/larkbots-ai-chat-zh_TW.mo (added)
-
trunk/languages/larkbots-ai-chat-zh_TW.po (added)
-
trunk/larkbots-ai-chat.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
larkbots-ai-chat/tags/1.3.0/includes/class-larkbots-admin.php
r3840461 r3840711 150 150 $appearance_url = 'https://www.larkbots.com/admin/settings/ai/appearance'; 151 151 $knowledge_url = 'https://www.larkbots.com/admin/settings/ai/knowledge'; 152 $locale = LarkBots_AI_Chat_Connection::connect_locale( get_user_locale() ); 153 $help_prefix = '' !== $locale && 'en-US' !== $locale ? '/' . strtolower( $locale ) : ''; 154 $help_url = 'https://www.larkbots.com' . $help_prefix . '/help/connect-wordpress'; 152 155 $logo_url = plugins_url( 'assets/larkbots-logo.png', LARKBOTS_AI_CHAT_FILE ); 153 156 $status_class = $value['local_enabled'] ? 'larkbots-status larkbots-status-success' : 'larkbots-status'; … … 343 346 <a class="button" href="<?php echo esc_url( $connect_url ); ?>"><?php echo esc_html__( 'Reconnect LarkBots', 'larkbots-ai-chat' ); ?></a> 344 347 <a class="button" href="<?php echo esc_url( $chat_url ); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html__( 'Chat behavior settings', 'larkbots-ai-chat' ); ?></a> 345 <a class="button" href=" https://www.larkbots.com/help/connect-wordpress" target="_blank" rel="noopener noreferrer"><?php echo esc_html__( 'Get help', 'larkbots-ai-chat' ); ?></a>348 <a class="button" href="<?php echo esc_url( $help_url ); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html__( 'Get help', 'larkbots-ai-chat' ); ?></a> 346 349 </div> 347 350 <details class="larkbots-manual"> … … 417 420 <a href="<?php echo esc_url( $chat_url ); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html__( 'Chat settings', 'larkbots-ai-chat' ); ?></a> 418 421 <span aria-hidden="true"> · </span> 419 <a href=" https://www.larkbots.com/help/connect-wordpress" target="_blank" rel="noopener noreferrer"><?php echo esc_html__( 'Help', 'larkbots-ai-chat' ); ?></a>422 <a href="<?php echo esc_url( $help_url ); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html__( 'Help', 'larkbots-ai-chat' ); ?></a> 420 423 </p> 421 424 <?php endif; ?> -
larkbots-ai-chat/tags/1.3.0/includes/class-larkbots-connection.php
r3840461 r3840711 69 69 'wordpress_version' => get_bloginfo( 'version' ), 70 70 ); 71 $locale = $this->connect_locale( get_user_locale() ); 72 if ( '' !== $locale ) { 73 $query['locale'] = $locale; 74 } 71 75 wp_safe_redirect( esc_url_raw( add_query_arg( $query, self::CONNECT_URL ) ) ); 72 76 exit; 77 } 78 79 /** Map a WordPress administrator's locale to a supported cloud locale. */ 80 public static function connect_locale( $locale ) { 81 $normalized = strtolower( str_replace( '_', '-', $locale ) ); 82 $parts = explode( '-', $normalized ); 83 if ( 'zh' === $parts[0] ) { 84 $traditional = in_array( 'hant', $parts, true ) || 85 ( ! in_array( 'hans', $parts, true ) && array_intersect( array( 'tw', 'hk', 'mo' ), $parts ) ); 86 return $traditional ? 'zh-TW' : 'zh-CN'; 87 } 88 $locales = array( 'en' => 'en-US', 'es' => 'es-US', 'de' => 'de-DE', 'fr' => 'fr-FR', 'pt' => 'pt-BR', 'ja' => 'ja-JP' ); 89 return isset( $locales[ $parts[0] ] ) ? $locales[ $parts[0] ] : ''; 73 90 } 74 91 -
larkbots-ai-chat/tags/1.3.0/includes/class-larkbots-widget.php
r3840461 r3840711 115 115 116 116 $attributes = sprintf( 117 ' data-tenant-%1$s="%2$s"%3$s async',117 ' data-tenant-%1$s="%2$s"%3$s data-larkbots-locale="auto" async', 118 118 esc_attr( $value['identifier_type'] ), 119 119 esc_attr( $value['tenant_identifier'] ), -
larkbots-ai-chat/tags/1.3.0/larkbots-ai-chat.php
r3840461 r3840711 3 3 * Plugin Name: LarkBots AI Chat 4 4 * Description: Add the LarkBots AI website chat to your WordPress site without editing code. 5 * Version: 1. 2.15 * Version: 1.3.0 6 6 * Requires at least: 6.0 7 7 * Requires PHP: 7.4 … … 18 18 } 19 19 20 define( 'LARKBOTS_AI_CHAT_VERSION', '1. 2.1' );20 define( 'LARKBOTS_AI_CHAT_VERSION', '1.3.0' ); 21 21 define( 'LARKBOTS_AI_CHAT_FILE', __FILE__ ); 22 22 define( 'LARKBOTS_AI_CHAT_DIR', plugin_dir_path( __FILE__ ) ); … … 59 59 } 60 60 add_action( 'plugins_loaded', 'larkbots_ai_chat_boot' ); 61 62 /** Load the bundled admin translation when WordPress has no installed language pack. */ 63 function larkbots_ai_chat_load_translations() { 64 if ( ! is_admin() ) { 65 return; 66 } 67 $locale = get_user_locale(); 68 if ( ! preg_match( '/^[a-z]{2,3}(?:_[A-Za-z0-9]+)*$/D', $locale ) ) { 69 return; 70 } 71 $pack = WP_LANG_DIR . '/plugins/larkbots-ai-chat-' . $locale; 72 if ( is_readable( $pack . '.mo' ) || is_readable( $pack . '.l10n.php' ) ) { 73 return; 74 } 75 $catalog = str_replace( '-', '_', LarkBots_AI_Chat_Connection::connect_locale( $locale ) ); 76 $catalog = 'ja_JP' === $catalog ? 'ja' : $catalog; 77 $file = LARKBOTS_AI_CHAT_DIR . 'languages/larkbots-ai-chat-' . $catalog . '.mo'; 78 if ( '' !== $catalog && is_readable( $file ) ) { 79 load_textdomain( 'larkbots-ai-chat', $file, $locale ); 80 } 81 } 82 add_action( 'init', 'larkbots_ai_chat_load_translations' ); -
larkbots-ai-chat/tags/1.3.0/readme.txt
r3840461 r3840711 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 1. 2.17 Stable tag: 1.3.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 68 68 == Changelog == 69 69 70 = 1.3.0 = 71 * Keep the administrator's language through WordPress setup, LarkBots account creation and site confirmation. 72 * Use the language of the public page for the hosted chat interface when supported. 73 70 74 = 1.2.1 = 71 75 -
larkbots-ai-chat/trunk/includes/class-larkbots-admin.php
r3840461 r3840711 150 150 $appearance_url = 'https://www.larkbots.com/admin/settings/ai/appearance'; 151 151 $knowledge_url = 'https://www.larkbots.com/admin/settings/ai/knowledge'; 152 $locale = LarkBots_AI_Chat_Connection::connect_locale( get_user_locale() ); 153 $help_prefix = '' !== $locale && 'en-US' !== $locale ? '/' . strtolower( $locale ) : ''; 154 $help_url = 'https://www.larkbots.com' . $help_prefix . '/help/connect-wordpress'; 152 155 $logo_url = plugins_url( 'assets/larkbots-logo.png', LARKBOTS_AI_CHAT_FILE ); 153 156 $status_class = $value['local_enabled'] ? 'larkbots-status larkbots-status-success' : 'larkbots-status'; … … 343 346 <a class="button" href="<?php echo esc_url( $connect_url ); ?>"><?php echo esc_html__( 'Reconnect LarkBots', 'larkbots-ai-chat' ); ?></a> 344 347 <a class="button" href="<?php echo esc_url( $chat_url ); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html__( 'Chat behavior settings', 'larkbots-ai-chat' ); ?></a> 345 <a class="button" href=" https://www.larkbots.com/help/connect-wordpress" target="_blank" rel="noopener noreferrer"><?php echo esc_html__( 'Get help', 'larkbots-ai-chat' ); ?></a>348 <a class="button" href="<?php echo esc_url( $help_url ); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html__( 'Get help', 'larkbots-ai-chat' ); ?></a> 346 349 </div> 347 350 <details class="larkbots-manual"> … … 417 420 <a href="<?php echo esc_url( $chat_url ); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html__( 'Chat settings', 'larkbots-ai-chat' ); ?></a> 418 421 <span aria-hidden="true"> · </span> 419 <a href=" https://www.larkbots.com/help/connect-wordpress" target="_blank" rel="noopener noreferrer"><?php echo esc_html__( 'Help', 'larkbots-ai-chat' ); ?></a>422 <a href="<?php echo esc_url( $help_url ); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html__( 'Help', 'larkbots-ai-chat' ); ?></a> 420 423 </p> 421 424 <?php endif; ?> -
larkbots-ai-chat/trunk/includes/class-larkbots-connection.php
r3840461 r3840711 69 69 'wordpress_version' => get_bloginfo( 'version' ), 70 70 ); 71 $locale = $this->connect_locale( get_user_locale() ); 72 if ( '' !== $locale ) { 73 $query['locale'] = $locale; 74 } 71 75 wp_safe_redirect( esc_url_raw( add_query_arg( $query, self::CONNECT_URL ) ) ); 72 76 exit; 77 } 78 79 /** Map a WordPress administrator's locale to a supported cloud locale. */ 80 public static function connect_locale( $locale ) { 81 $normalized = strtolower( str_replace( '_', '-', $locale ) ); 82 $parts = explode( '-', $normalized ); 83 if ( 'zh' === $parts[0] ) { 84 $traditional = in_array( 'hant', $parts, true ) || 85 ( ! in_array( 'hans', $parts, true ) && array_intersect( array( 'tw', 'hk', 'mo' ), $parts ) ); 86 return $traditional ? 'zh-TW' : 'zh-CN'; 87 } 88 $locales = array( 'en' => 'en-US', 'es' => 'es-US', 'de' => 'de-DE', 'fr' => 'fr-FR', 'pt' => 'pt-BR', 'ja' => 'ja-JP' ); 89 return isset( $locales[ $parts[0] ] ) ? $locales[ $parts[0] ] : ''; 73 90 } 74 91 -
larkbots-ai-chat/trunk/includes/class-larkbots-widget.php
r3840461 r3840711 115 115 116 116 $attributes = sprintf( 117 ' data-tenant-%1$s="%2$s"%3$s async',117 ' data-tenant-%1$s="%2$s"%3$s data-larkbots-locale="auto" async', 118 118 esc_attr( $value['identifier_type'] ), 119 119 esc_attr( $value['tenant_identifier'] ), -
larkbots-ai-chat/trunk/larkbots-ai-chat.php
r3840461 r3840711 3 3 * Plugin Name: LarkBots AI Chat 4 4 * Description: Add the LarkBots AI website chat to your WordPress site without editing code. 5 * Version: 1. 2.15 * Version: 1.3.0 6 6 * Requires at least: 6.0 7 7 * Requires PHP: 7.4 … … 18 18 } 19 19 20 define( 'LARKBOTS_AI_CHAT_VERSION', '1. 2.1' );20 define( 'LARKBOTS_AI_CHAT_VERSION', '1.3.0' ); 21 21 define( 'LARKBOTS_AI_CHAT_FILE', __FILE__ ); 22 22 define( 'LARKBOTS_AI_CHAT_DIR', plugin_dir_path( __FILE__ ) ); … … 59 59 } 60 60 add_action( 'plugins_loaded', 'larkbots_ai_chat_boot' ); 61 62 /** Load the bundled admin translation when WordPress has no installed language pack. */ 63 function larkbots_ai_chat_load_translations() { 64 if ( ! is_admin() ) { 65 return; 66 } 67 $locale = get_user_locale(); 68 if ( ! preg_match( '/^[a-z]{2,3}(?:_[A-Za-z0-9]+)*$/D', $locale ) ) { 69 return; 70 } 71 $pack = WP_LANG_DIR . '/plugins/larkbots-ai-chat-' . $locale; 72 if ( is_readable( $pack . '.mo' ) || is_readable( $pack . '.l10n.php' ) ) { 73 return; 74 } 75 $catalog = str_replace( '-', '_', LarkBots_AI_Chat_Connection::connect_locale( $locale ) ); 76 $catalog = 'ja_JP' === $catalog ? 'ja' : $catalog; 77 $file = LARKBOTS_AI_CHAT_DIR . 'languages/larkbots-ai-chat-' . $catalog . '.mo'; 78 if ( '' !== $catalog && is_readable( $file ) ) { 79 load_textdomain( 'larkbots-ai-chat', $file, $locale ); 80 } 81 } 82 add_action( 'init', 'larkbots_ai_chat_load_translations' ); -
larkbots-ai-chat/trunk/readme.txt
r3840461 r3840711 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 1. 2.17 Stable tag: 1.3.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 68 68 == Changelog == 69 69 70 = 1.3.0 = 71 * Keep the administrator's language through WordPress setup, LarkBots account creation and site confirmation. 72 * Use the language of the public page for the hosted chat interface when supported. 73 70 74 = 1.2.1 = 71 75
Note:
See TracChangeset
for help on using the changeset viewer.