Advanced Woo Search - Version 1.44

Version Description

  • Make SKU string in search results translatable
  • Strip some new special chars from products content
  • Add 'aws_extracted_string' and 'aws_extracted_terms' filters
  • Fix bug with empty excerpt
Download this release

Release Info

Developer Mihail Barinov
Plugin Icon 128x128 Advanced Woo Search
Version 1.44
Comparing to
See all releases

Code changes from version 1.43 to 1.44

advanced-woo-search.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
- Version: 1.43
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: aws
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  exit;
17
  }
18
 
19
- define( 'AWS_VERSION', '1.43' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
@@ -142,6 +142,7 @@ final class AWS_Main {
142
  wp_enqueue_script('aws-script', AWS_URL . '/assets/js/common.js', array('jquery'), AWS_VERSION, true);
143
  wp_localize_script('aws-script', 'aws_vars', array(
144
  'sale' => __('Sale!', 'aws'),
 
145
  'showmore' => __('View all results', 'aws'),
146
  'noresults' => $this->get_settings('not_found_text') ? AWS_Helpers::translate( 'not_found_text', stripslashes( $this->get_settings('not_found_text') ) ) : __('Nothing found', 'aws')
147
  ));
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 1.44
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: aws
16
  exit;
17
  }
18
 
19
+ define( 'AWS_VERSION', '1.44' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
142
  wp_enqueue_script('aws-script', AWS_URL . '/assets/js/common.js', array('jquery'), AWS_VERSION, true);
143
  wp_localize_script('aws-script', 'aws_vars', array(
144
  'sale' => __('Sale!', 'aws'),
145
+ 'sku' => __('SKU', 'aws'),
146
  'showmore' => __('View all results', 'aws'),
147
  'noresults' => $this->get_settings('not_found_text') ? AWS_Helpers::translate( 'not_found_text', stripslashes( $this->get_settings('not_found_text') ) ) : __('Nothing found', 'aws')
148
  ));
assets/js/common.js CHANGED
@@ -6,6 +6,7 @@
6
  var pluginPfx = 'aws_opts';
7
  var translate = {
8
  sale : aws_vars.sale,
 
9
  showmore : aws_vars.showmore,
10
  noresults : aws_vars.noresults
11
  };
@@ -161,7 +162,7 @@
161
  }
162
 
163
  if ( result.sku ) {
164
- html += '<span class="aws_result_sku">SKU: ' + result.sku + '</span>';
165
  }
166
 
167
  if ( result.excerpt ) {
6
  var pluginPfx = 'aws_opts';
7
  var translate = {
8
  sale : aws_vars.sale,
9
+ sku : aws_vars.sku,
10
  showmore : aws_vars.showmore,
11
  noresults : aws_vars.noresults
12
  };
162
  }
163
 
164
  if ( result.sku ) {
165
+ html += '<span class="aws_result_sku">' + translate.sku + ': ' + result.sku + '</span>';
166
  }
167
 
168
  if ( result.excerpt ) {
includes/class-aws-helpers.php CHANGED
@@ -140,6 +140,9 @@ if ( ! class_exists( 'AWS_Helpers' ) ) :
140
  "/",
141
  "[",
142
  "]",
 
 
 
143
  );
144
 
145
  return apply_filters( 'aws_special_chars', $chars );
140
  "/",
141
  "[",
142
  "]",
143
+ "’",
144
+ "“",
145
+ "”"
146
  );
147
 
148
  return apply_filters( 'aws_special_chars', $chars );
includes/class-aws-search.php CHANGED
@@ -429,7 +429,12 @@ if ( ! class_exists( 'AWS_Search' ) ) :
429
  $marked_content = $this->mark_search_words( $title, $excerpt );
430
 
431
  $title = $marked_content['title'];
432
- $excerpt = $marked_content['content'];
 
 
 
 
 
433
 
434
  } else {
435
  $excerpt = wp_trim_words( $excerpt, $excerpt_length, '...' );
429
  $marked_content = $this->mark_search_words( $title, $excerpt );
430
 
431
  $title = $marked_content['title'];
432
+
433
+ if ( $marked_content['content'] ) {
434
+ $excerpt = $marked_content['content'];
435
+ } else {
436
+ $excerpt = wp_trim_words( $excerpt, $excerpt_length, '...' );
437
+ }
438
 
439
  } else {
440
  $excerpt = wp_trim_words( $excerpt, $excerpt_length, '...' );
includes/class-aws-table.php CHANGED
@@ -712,9 +712,27 @@ if ( ! class_exists( 'AWS_Table' ) ) :
712
 
713
  $str = trim( preg_replace( '/\s+/', ' ', $str ) );
714
 
 
 
 
 
 
 
 
 
 
715
  $str_array = array_count_values( explode( ' ', $str ) );
716
  $str_array = AWS_Helpers::filter_stopwords( $str_array );
717
 
 
 
 
 
 
 
 
 
 
718
  return $str_array;
719
 
720
  }
712
 
713
  $str = trim( preg_replace( '/\s+/', ' ', $str ) );
714
 
715
+ /**
716
+ * Filters extracted string
717
+ *
718
+ * @since 1.44
719
+ *
720
+ * @param string $str String of product content
721
+ */
722
+ $str = apply_filters( 'aws_extracted_string', $str );
723
+
724
  $str_array = array_count_values( explode( ' ', $str ) );
725
  $str_array = AWS_Helpers::filter_stopwords( $str_array );
726
 
727
+ /**
728
+ * Filters extracted terms before adding to index table
729
+ *
730
+ * @since 1.44
731
+ *
732
+ * @param string $str_array Array of terms
733
+ */
734
+ $str_array = apply_filters( 'aws_extracted_terms', $str_array );
735
+
736
  return $str_array;
737
 
738
  }
languages/aws.pot CHANGED
@@ -61,6 +61,9 @@ msgstr ""
61
  msgid "Sale!"
62
  msgstr ""
63
 
 
 
 
64
  msgid "View all results"
65
  msgstr ""
66
 
61
  msgid "Sale!"
62
  msgstr ""
63
 
64
+ msgid "SKU"
65
+ msgstr ""
66
+
67
  msgid "View all results"
68
  msgstr ""
69
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: widget, plugin, woocommerce, search, product search, woocommerce search, ajax search, live search, custom search, ajax, shortcode, better search, relevance search, relevant search, search by sku, search plugin, shop, store, wordpress search, wp ajax search, wp search, wp search plugin, sidebar, ecommerce, merketing, products, category search, instant-search, search highlight, woocommerce advanced search, woocommerce live search, WooCommerce Plugin, woocommerce product search
5
  Requires at least: 4.0
6
  Tested up to: 4.9.6
7
- Stable tag: 1.43
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -90,6 +90,12 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
90
 
91
  == Changelog ==
92
 
 
 
 
 
 
 
93
  = 1.43 =
94
  * Add 'aws_search_results_all' filter
95
  * Update WPML string translation
4
  Tags: widget, plugin, woocommerce, search, product search, woocommerce search, ajax search, live search, custom search, ajax, shortcode, better search, relevance search, relevant search, search by sku, search plugin, shop, store, wordpress search, wp ajax search, wp search, wp search plugin, sidebar, ecommerce, merketing, products, category search, instant-search, search highlight, woocommerce advanced search, woocommerce live search, WooCommerce Plugin, woocommerce product search
5
  Requires at least: 4.0
6
  Tested up to: 4.9.6
7
+ Stable tag: 1.44
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
90
 
91
  == Changelog ==
92
 
93
+ = 1.44 =
94
+ * Make SKU string in search results translatable
95
+ * Strip some new special chars from products content
96
+ * Add 'aws_extracted_string' and 'aws_extracted_terms' filters
97
+ * Fix bug with empty excerpt
98
+
99
  = 1.43 =
100
  * Add 'aws_search_results_all' filter
101
  * Update WPML string translation