Advanced Woo Search - Version 2.52

Version Description

( 2022-04-11 ) = * Update - Search results styles * Update - Product description scrapper for search results * Fix - Remove markup for search form input title

Download this release

Release Info

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

Code changes from version 2.51 to 2.52

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: 2.51
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: advanced-woo-search
@@ -96,7 +96,7 @@ final class AWS_Main {
96
  */
97
  private function define_constants() {
98
 
99
- $this->define( 'AWS_VERSION', '2.51' );
100
 
101
  $this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
102
  $this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 2.52
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: advanced-woo-search
96
  */
97
  private function define_constants() {
98
 
99
+ $this->define( 'AWS_VERSION', '2.52' );
100
 
101
  $this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
102
  $this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
assets/js/common.js CHANGED
@@ -170,7 +170,7 @@ AwsHooks.filters = AwsHooks.filters || {};
170
 
171
  html += '<li class="aws_result_item aws_result_tag" style="position:relative;">';
172
  html += '<div class="aws_result_link">';
173
- html += '<a class="aws_result_link_top" style="position:absolute;z-index:1;white-space:nowrap;text-indent:-9999px;overflow:hidden;top:0;bottom:0;left:0;right:0;opacity:0;outline:none;text-decoration:none;" href="' + taxitem.link + '">' + taxitem.name + '</a>';
174
  html += '<span class="aws_result_content">';
175
  html += '<span class="aws_result_title">';
176
  html += taxitem.name;
@@ -201,7 +201,7 @@ AwsHooks.filters = AwsHooks.filters || {};
201
  html += '<li class="aws_result_item" style="position:relative;">';
202
  html += '<div class="aws_result_link">';
203
 
204
- html += '<a class="aws_result_link_top" style="position:absolute;z-index:1;white-space:nowrap;text-indent:-9999px;overflow:hidden;top:0;bottom:0;left:0;right:0;opacity:0;outline:none;text-decoration:none;" href="' + result.link + '">' + result.title.replace(/<(?:.|\n)*?>/gm, '') + '</a>';
205
 
206
  if ( result.image ) {
207
  html += '<span class="aws_result_image">';
170
 
171
  html += '<li class="aws_result_item aws_result_tag" style="position:relative;">';
172
  html += '<div class="aws_result_link">';
173
+ html += '<a class="aws_result_link_top" href="' + taxitem.link + '">' + taxitem.name + '</a>';
174
  html += '<span class="aws_result_content">';
175
  html += '<span class="aws_result_title">';
176
  html += taxitem.name;
201
  html += '<li class="aws_result_item" style="position:relative;">';
202
  html += '<div class="aws_result_link">';
203
 
204
+ html += '<a class="aws_result_link_top" href="' + result.link + '">' + result.title.replace(/(<[\s\S]*>)/gm, '') + '</a>';
205
 
206
  if ( result.image ) {
207
  html += '<span class="aws_result_image">';
includes/class-aws-search.php CHANGED
@@ -721,6 +721,7 @@ if ( ! class_exists( 'AWS_Search' ) ) :
721
 
722
  $exact_words = array();
723
  $words = array();
 
724
 
725
  foreach( $this->data['search_terms'] as $search_in ) {
726
 
@@ -747,10 +748,6 @@ if ( ! class_exists( 'AWS_Search' ) ) :
747
  preg_match( '/([^.?!]*?)(' . $words . '){1}(.*?[.!?])/i', $content, $matches );
748
  }
749
 
750
- if ( ! isset( $matches[0] ) ) {
751
- preg_match( '/([^.?!]*?)(.*?)(.*?[.!?])/i', $content, $matches );
752
- }
753
-
754
  if ( isset( $matches[0] ) ) {
755
 
756
  $content = $matches[0];
@@ -768,7 +765,29 @@ if ( ! class_exists( 'AWS_Search' ) ) :
768
 
769
  } else {
770
 
771
- $content = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
772
 
773
  }
774
 
721
 
722
  $exact_words = array();
723
  $words = array();
724
+ $excerpt_length = AWS()->get_settings( 'excerpt_length' );
725
 
726
  foreach( $this->data['search_terms'] as $search_in ) {
727
 
748
  preg_match( '/([^.?!]*?)(' . $words . '){1}(.*?[.!?])/i', $content, $matches );
749
  }
750
 
 
 
 
 
751
  if ( isset( $matches[0] ) ) {
752
 
753
  $content = $matches[0];
765
 
766
  } else {
767
 
768
+ // Get first N sentences
769
+ if ( str_word_count( strip_tags( $content ) ) > $excerpt_length ) {
770
+
771
+ $sentences_array = preg_split( "/(?<=[.!?])/", $content, 10, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
772
+ $sentences_string = '';
773
+ $str_word_count = 0;
774
+
775
+ if ( ! empty( $sentences_array ) ) {
776
+ foreach ( $sentences_array as $sentence ) {
777
+ $str_word_count = $str_word_count + str_word_count( strip_tags( $sentence ) );
778
+ if ( $str_word_count <= $excerpt_length ) {
779
+ $sentences_string .= $sentence;
780
+ } else {
781
+ break;
782
+ }
783
+ }
784
+ }
785
+
786
+ if ( $sentences_string ) {
787
+ $content = $sentences_string;
788
+ }
789
+
790
+ }
791
 
792
  }
793
 
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: 5.9
7
- Stable tag: 2.51
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -167,6 +167,11 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
167
 
168
  == Changelog ==
169
 
 
 
 
 
 
170
  = 2.51 ( 2022-03-28 ) =
171
  * Update - Hooks for index table products sync
172
  * Fix - Search results page filters for default WooCommerce filter widgets
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: 5.9
7
+ Stable tag: 2.52
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
167
 
168
  == Changelog ==
169
 
170
+ = 2.52 ( 2022-04-11 ) =
171
+ * Update - Search results styles
172
+ * Update - Product description scrapper for search results
173
+ * Fix - Remove markup for search form input title
174
+
175
  = 2.51 ( 2022-03-28 ) =
176
  * Update - Hooks for index table products sync
177
  * Fix - Search results page filters for default WooCommerce filter widgets