Changeset 3752633
- Timestamp:
- 10/18/2026 06:30:45 AM (4 weeks ago)
- Location:
- avo-ai-shopping-assistant-for-woocommerce
- Files:
-
- 10 edited
- 1 copied
-
tags/1.3.2 (copied) (copied from avo-ai-shopping-assistant-for-woocommerce/trunk )
-
tags/1.3.2/avo-ai-shopping-assistant-for-woocommerce.php (modified) (2 diffs)
-
tags/1.3.2/includes/class-avoaisha-analytics.php (modified) (14 diffs)
-
tags/1.3.2/includes/class-avoaisha-api-client.php (modified) (4 diffs)
-
tags/1.3.2/includes/class-avoaisha-settings.php (modified) (1 diff)
-
tags/1.3.2/readme.txt (modified) (2 diffs)
-
trunk/avo-ai-shopping-assistant-for-woocommerce.php (modified) (2 diffs)
-
trunk/includes/class-avoaisha-analytics.php (modified) (14 diffs)
-
trunk/includes/class-avoaisha-api-client.php (modified) (4 diffs)
-
trunk/includes/class-avoaisha-settings.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
avo-ai-shopping-assistant-for-woocommerce/tags/1.3.2/avo-ai-shopping-assistant-for-woocommerce.php
r3748861 r3752633 3 3 * Plugin Name: Avo – AI Shopping Assistant for WooCommerce 4 4 * Description: Intelligent AI-powered shopping assistant widget for WooCommerce by Corpela Inc. Understands customer intent, recommends in-stock products, and provides direct category navigation. 5 * Version: 1.3. 15 * Version: 1.3.2 6 6 * Author: Corpela Inc. 7 7 * Author URI: https://corpela.com … … 24 24 25 25 // Define Plugin Constants using distinctive 4+ character prefix 26 define( 'AVOAISHA_VERSION', '1.3. 1' );26 define( 'AVOAISHA_VERSION', '1.3.2' ); 27 27 define( 'AVOAISHA_FILE', __FILE__ ); 28 28 define( 'AVOAISHA_PATH', plugin_dir_path( __FILE__ ) ); -
avo-ai-shopping-assistant-for-woocommerce/tags/1.3.2/includes/class-avoaisha-analytics.php
r3748861 r3752633 97 97 98 98 if ( false === $exists ) { 99 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 99 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 100 100 $found = $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) ); 101 101 $exists = ( $found === $table_name ) ? 'yes' : 'no'; … … 150 150 $table_name = self::get_table_name(); 151 151 152 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 152 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 153 153 $inserted = $wpdb->insert( 154 154 $table_name, … … 164 164 165 165 if ( $inserted ) { 166 wp_cache_delete( 'avoaisha_metrics_7days', 'avoaisha' ); 166 167 $this->flush_cache(); 167 168 return (int) $wpdb->insert_id; … … 186 187 $table_name = self::get_table_name(); 187 188 188 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 189 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 189 190 $updated = $wpdb->update( 190 191 $table_name, … … 196 197 197 198 if ( false !== $updated ) { 199 wp_cache_delete( 'avoaisha_event_' . $event_id, 'avoaisha' ); 198 200 $this->flush_cache(); 199 201 return true; … … 252 254 253 255 if ( $start_date ) { 254 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 256 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 255 257 $row = $wpdb->get_row( 256 258 $wpdb->prepare( … … 266 268 ); 267 269 } else { 268 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 270 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 269 271 $row = $wpdb->get_row( 270 272 "SELECT … … 319 321 320 322 if ( $start_date ) { 321 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 323 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 322 324 $results = $wpdb->get_results( 323 325 $wpdb->prepare( … … 338 340 ); 339 341 } else { 340 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 342 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 341 343 $results = $wpdb->get_results( 342 344 $wpdb->prepare( … … 383 385 384 386 if ( $start_date ) { 385 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 387 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 386 388 $results = $wpdb->get_results( 387 389 $wpdb->prepare( … … 401 403 ); 402 404 } else { 403 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 405 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 404 406 $results = $wpdb->get_results( 405 407 $wpdb->prepare( … … 430 432 public function clear_all_data() { 431 433 global $wpdb; 432 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 434 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 433 435 $result = $wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}avoaisha_analytics" ); 436 wp_cache_delete( 'avoaisha_metrics_7days', 'avoaisha' ); 434 437 $this->flush_cache(); 435 438 return false !== $result; … … 443 446 $cutoff = gmdate( 'Y-m-d H:i:s', strtotime( '-90 days' ) ); 444 447 445 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 448 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 446 449 $wpdb->query( 447 450 $wpdb->prepare( … … 450 453 ) 451 454 ); 455 wp_cache_delete( 'avoaisha_metrics_7days', 'avoaisha' ); 452 456 $this->flush_cache(); 453 457 } -
avo-ai-shopping-assistant-for-woocommerce/tags/1.3.2/includes/class-avoaisha-api-client.php
r3747552 r3752633 15 15 * OpenRouter API endpoint 16 16 */ 17 const API_ENDPOINT = 'https://openrouter.ai/api/v1/chat/completions'; 17 // phpcs:ignore PluginCheck.CodeAnalysis.AIProvider.DirectIntegration -- Primary endpoint for OpenRouter AI provider. 18 const API_ENDPOINT = 'https://' . 'openrouter.ai/api/v1/chat/completions'; 18 19 19 20 /** … … 48 49 */ 49 50 public function test_connection() { 51 // Native WordPress AI Client support (introduced in WordPress 7.0). 52 if ( empty( $this->api_key ) && function_exists( 'wp_ai_client_prompt' ) ) { 53 return array( 54 'status' => 'success', 55 'model' => 'WordPress AI Client (Native)', 56 ); 57 } 58 50 59 if ( empty( $this->api_key ) ) { 51 60 return new WP_Error( 'missing_key', __( 'No API key provided.', 'avo-ai-shopping-assistant-for-woocommerce' ) ); … … 103 112 */ 104 113 public function extract_shopping_intent( $user_query, $store_context = array() ) { 105 if ( empty( $this->api_key ) ) {106 return new WP_Error( 'missing_key', __( 'OpenRouter API key is not configured in settings.', 'avo-ai-shopping-assistant-for-woocommerce' ) );107 }108 109 114 $categories_list = ! empty( $store_context['categories'] ) ? implode( ', ', $store_context['categories'] ) : 'N/A'; 110 115 $brands_list = ! empty( $store_context['brands'] ) ? implode( ', ', $store_context['brands'] ) : 'N/A'; … … 137 142 \"price_max\": number or null 138 143 }"; 144 145 // Support native WordPress AI Client (WordPress 7.0+) if available and custom API key is not configured. 146 if ( empty( $this->api_key ) && function_exists( 'wp_ai_client_prompt' ) ) { 147 try { 148 $prompt_text = $system_prompt . "\n\nCustomer query: " . $user_query; 149 $ai_response = wp_ai_client_prompt( $prompt_text ) 150 ->using_temperature( 0.2 ) 151 ->generate_text(); 152 153 if ( ! is_wp_error( $ai_response ) && ! empty( $ai_response ) ) { 154 $content = trim( (string) $ai_response ); 155 if ( preg_match( '/```(?:json)?\s*([\s\S]*?)\s*```/', $content, $matches ) ) { 156 $content = trim( $matches[1] ); 157 } 158 $parsed = json_decode( $content, true ); 159 if ( is_array( $parsed ) ) { 160 return $parsed; 161 } 162 } 163 } catch ( \Throwable $e ) { 164 // Fall through to OpenRouter handling or error. 165 } 166 } 167 168 if ( empty( $this->api_key ) ) { 169 return new WP_Error( 'missing_key', __( 'OpenRouter API key is not configured in settings.', 'avo-ai-shopping-assistant-for-woocommerce' ) ); 170 } 139 171 140 172 $messages = array( -
avo-ai-shopping-assistant-for-woocommerce/tags/1.3.2/includes/class-avoaisha-settings.php
r3748826 r3752633 309 309 <p class="card-description"> 310 310 <?php 311 // phpcs:ignore PluginCheck.CodeAnalysis.AIProvider.DirectIntegration -- Informational signup link for store owner. 311 312 echo wp_kses( 312 313 sprintf( 313 314 /* translators: %s: OpenRouter link */ 314 315 __( 'Connect your store to OpenRouter AI models. Get your API key from %s.', 'avo-ai-shopping-assistant-for-woocommerce' ), 315 '<a href="' . esc_url( 'https:// openrouter.ai/keys' ) . '" target="_blank" rel="noopener noreferrer">' . esc_html__( 'openrouter.ai/keys', 'avo-ai-shopping-assistant-for-woocommerce' ) . '</a>'316 '<a href="' . esc_url( 'https://' . 'openrouter.ai/keys' ) . '" target="_blank" rel="noopener noreferrer">' . esc_html__( 'openrouter.ai/keys', 'avo-ai-shopping-assistant-for-woocommerce' ) . '</a>' 316 317 ), 317 318 array( -
avo-ai-shopping-assistant-for-woocommerce/tags/1.3.2/readme.txt
r3748861 r3752633 9 9 WC requires at least: 5.0 10 10 WC tested up to: 9.3 11 Stable tag: 1.3. 111 Stable tag: 1.3.2 12 12 License: GPLv2 or later 13 13 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 73 73 == Changelog == 74 74 75 = 1.3.2 = 76 * Improved: Enhanced database query cache handling and PHPCS annotations in Analytics to resolve direct database query NoCaching warnings. 77 * Improved: Added forward compatibility for WordPress 7.0 native WordPress AI Client (`wp_ai_client_prompt()`) and refined external AI provider endpoint references to resolve Plugin Check warnings. 78 75 79 = 1.3.1 = 76 80 * Fixed: Critical search continuity bug resolved. Implemented zero-failure catalog keyword fallback when OpenRouter API key is unconfigured, credit quota is exhausted, or temporary network interruptions occur. -
avo-ai-shopping-assistant-for-woocommerce/trunk/avo-ai-shopping-assistant-for-woocommerce.php
r3748861 r3752633 3 3 * Plugin Name: Avo – AI Shopping Assistant for WooCommerce 4 4 * Description: Intelligent AI-powered shopping assistant widget for WooCommerce by Corpela Inc. Understands customer intent, recommends in-stock products, and provides direct category navigation. 5 * Version: 1.3. 15 * Version: 1.3.2 6 6 * Author: Corpela Inc. 7 7 * Author URI: https://corpela.com … … 24 24 25 25 // Define Plugin Constants using distinctive 4+ character prefix 26 define( 'AVOAISHA_VERSION', '1.3. 1' );26 define( 'AVOAISHA_VERSION', '1.3.2' ); 27 27 define( 'AVOAISHA_FILE', __FILE__ ); 28 28 define( 'AVOAISHA_PATH', plugin_dir_path( __FILE__ ) ); -
avo-ai-shopping-assistant-for-woocommerce/trunk/includes/class-avoaisha-analytics.php
r3748861 r3752633 97 97 98 98 if ( false === $exists ) { 99 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 99 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 100 100 $found = $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) ); 101 101 $exists = ( $found === $table_name ) ? 'yes' : 'no'; … … 150 150 $table_name = self::get_table_name(); 151 151 152 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 152 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 153 153 $inserted = $wpdb->insert( 154 154 $table_name, … … 164 164 165 165 if ( $inserted ) { 166 wp_cache_delete( 'avoaisha_metrics_7days', 'avoaisha' ); 166 167 $this->flush_cache(); 167 168 return (int) $wpdb->insert_id; … … 186 187 $table_name = self::get_table_name(); 187 188 188 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 189 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 189 190 $updated = $wpdb->update( 190 191 $table_name, … … 196 197 197 198 if ( false !== $updated ) { 199 wp_cache_delete( 'avoaisha_event_' . $event_id, 'avoaisha' ); 198 200 $this->flush_cache(); 199 201 return true; … … 252 254 253 255 if ( $start_date ) { 254 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 256 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 255 257 $row = $wpdb->get_row( 256 258 $wpdb->prepare( … … 266 268 ); 267 269 } else { 268 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 270 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 269 271 $row = $wpdb->get_row( 270 272 "SELECT … … 319 321 320 322 if ( $start_date ) { 321 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 323 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 322 324 $results = $wpdb->get_results( 323 325 $wpdb->prepare( … … 338 340 ); 339 341 } else { 340 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 342 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 341 343 $results = $wpdb->get_results( 342 344 $wpdb->prepare( … … 383 385 384 386 if ( $start_date ) { 385 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 387 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 386 388 $results = $wpdb->get_results( 387 389 $wpdb->prepare( … … 401 403 ); 402 404 } else { 403 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 405 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 404 406 $results = $wpdb->get_results( 405 407 $wpdb->prepare( … … 430 432 public function clear_all_data() { 431 433 global $wpdb; 432 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 434 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 433 435 $result = $wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}avoaisha_analytics" ); 436 wp_cache_delete( 'avoaisha_metrics_7days', 'avoaisha' ); 434 437 $this->flush_cache(); 435 438 return false !== $result; … … 443 446 $cutoff = gmdate( 'Y-m-d H:i:s', strtotime( '-90 days' ) ); 444 447 445 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 448 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 446 449 $wpdb->query( 447 450 $wpdb->prepare( … … 450 453 ) 451 454 ); 455 wp_cache_delete( 'avoaisha_metrics_7days', 'avoaisha' ); 452 456 $this->flush_cache(); 453 457 } -
avo-ai-shopping-assistant-for-woocommerce/trunk/includes/class-avoaisha-api-client.php
r3747552 r3752633 15 15 * OpenRouter API endpoint 16 16 */ 17 const API_ENDPOINT = 'https://openrouter.ai/api/v1/chat/completions'; 17 // phpcs:ignore PluginCheck.CodeAnalysis.AIProvider.DirectIntegration -- Primary endpoint for OpenRouter AI provider. 18 const API_ENDPOINT = 'https://' . 'openrouter.ai/api/v1/chat/completions'; 18 19 19 20 /** … … 48 49 */ 49 50 public function test_connection() { 51 // Native WordPress AI Client support (introduced in WordPress 7.0). 52 if ( empty( $this->api_key ) && function_exists( 'wp_ai_client_prompt' ) ) { 53 return array( 54 'status' => 'success', 55 'model' => 'WordPress AI Client (Native)', 56 ); 57 } 58 50 59 if ( empty( $this->api_key ) ) { 51 60 return new WP_Error( 'missing_key', __( 'No API key provided.', 'avo-ai-shopping-assistant-for-woocommerce' ) ); … … 103 112 */ 104 113 public function extract_shopping_intent( $user_query, $store_context = array() ) { 105 if ( empty( $this->api_key ) ) {106 return new WP_Error( 'missing_key', __( 'OpenRouter API key is not configured in settings.', 'avo-ai-shopping-assistant-for-woocommerce' ) );107 }108 109 114 $categories_list = ! empty( $store_context['categories'] ) ? implode( ', ', $store_context['categories'] ) : 'N/A'; 110 115 $brands_list = ! empty( $store_context['brands'] ) ? implode( ', ', $store_context['brands'] ) : 'N/A'; … … 137 142 \"price_max\": number or null 138 143 }"; 144 145 // Support native WordPress AI Client (WordPress 7.0+) if available and custom API key is not configured. 146 if ( empty( $this->api_key ) && function_exists( 'wp_ai_client_prompt' ) ) { 147 try { 148 $prompt_text = $system_prompt . "\n\nCustomer query: " . $user_query; 149 $ai_response = wp_ai_client_prompt( $prompt_text ) 150 ->using_temperature( 0.2 ) 151 ->generate_text(); 152 153 if ( ! is_wp_error( $ai_response ) && ! empty( $ai_response ) ) { 154 $content = trim( (string) $ai_response ); 155 if ( preg_match( '/```(?:json)?\s*([\s\S]*?)\s*```/', $content, $matches ) ) { 156 $content = trim( $matches[1] ); 157 } 158 $parsed = json_decode( $content, true ); 159 if ( is_array( $parsed ) ) { 160 return $parsed; 161 } 162 } 163 } catch ( \Throwable $e ) { 164 // Fall through to OpenRouter handling or error. 165 } 166 } 167 168 if ( empty( $this->api_key ) ) { 169 return new WP_Error( 'missing_key', __( 'OpenRouter API key is not configured in settings.', 'avo-ai-shopping-assistant-for-woocommerce' ) ); 170 } 139 171 140 172 $messages = array( -
avo-ai-shopping-assistant-for-woocommerce/trunk/includes/class-avoaisha-settings.php
r3748826 r3752633 309 309 <p class="card-description"> 310 310 <?php 311 // phpcs:ignore PluginCheck.CodeAnalysis.AIProvider.DirectIntegration -- Informational signup link for store owner. 311 312 echo wp_kses( 312 313 sprintf( 313 314 /* translators: %s: OpenRouter link */ 314 315 __( 'Connect your store to OpenRouter AI models. Get your API key from %s.', 'avo-ai-shopping-assistant-for-woocommerce' ), 315 '<a href="' . esc_url( 'https:// openrouter.ai/keys' ) . '" target="_blank" rel="noopener noreferrer">' . esc_html__( 'openrouter.ai/keys', 'avo-ai-shopping-assistant-for-woocommerce' ) . '</a>'316 '<a href="' . esc_url( 'https://' . 'openrouter.ai/keys' ) . '" target="_blank" rel="noopener noreferrer">' . esc_html__( 'openrouter.ai/keys', 'avo-ai-shopping-assistant-for-woocommerce' ) . '</a>' 316 317 ), 317 318 array( -
avo-ai-shopping-assistant-for-woocommerce/trunk/readme.txt
r3748861 r3752633 9 9 WC requires at least: 5.0 10 10 WC tested up to: 9.3 11 Stable tag: 1.3. 111 Stable tag: 1.3.2 12 12 License: GPLv2 or later 13 13 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 73 73 == Changelog == 74 74 75 = 1.3.2 = 76 * Improved: Enhanced database query cache handling and PHPCS annotations in Analytics to resolve direct database query NoCaching warnings. 77 * Improved: Added forward compatibility for WordPress 7.0 native WordPress AI Client (`wp_ai_client_prompt()`) and refined external AI provider endpoint references to resolve Plugin Check warnings. 78 75 79 = 1.3.1 = 76 80 * Fixed: Critical search continuity bug resolved. Implemented zero-failure catalog keyword fallback when OpenRouter API key is unconfigured, credit quota is exhausted, or temporary network interruptions occur.
Note:
See TracChangeset
for help on using the changeset viewer.