Advanced Woo Search - Version 2.46

Version Description

Download this release

Release Info

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

Code changes from version 2.45 to 2.46

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.45
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.45' );
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.46
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.46' );
100
 
101
  $this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
102
  $this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
includes/class-aws-helpers.php CHANGED
@@ -927,6 +927,13 @@ if ( ! class_exists( 'AWS_Helpers' ) ) :
927
  */
928
  $apply_filters = apply_filters( 'aws_index_apply_filters', false );
929
 
 
 
 
 
 
 
 
930
  $index_variations_option = AWS()->get_settings( 'index_variations' );
931
  $index_sources_option = AWS()->get_settings( 'index_sources' );
932
 
@@ -952,6 +959,7 @@ if ( ! class_exists( 'AWS_Helpers' ) ) :
952
 
953
  $options = array(
954
  'apply_filters' => $apply_filters,
 
955
  'index' => $index_vars,
956
  );
957
 
927
  */
928
  $apply_filters = apply_filters( 'aws_index_apply_filters', false );
929
 
930
+ /**
931
+ * Run or not shortcodes inside product content
932
+ * @since 2.46
933
+ * @param bool true
934
+ */
935
+ $do_shortcodes = apply_filters( 'aws_index_do_shortcodes', true );
936
+
937
  $index_variations_option = AWS()->get_settings( 'index_variations' );
938
  $index_sources_option = AWS()->get_settings( 'index_sources' );
939
 
959
 
960
  $options = array(
961
  'apply_filters' => $apply_filters,
962
+ 'do_shortcodes' => $do_shortcodes,
963
  'index' => $index_vars,
964
  );
965
 
includes/class-aws-integrations.php CHANGED
@@ -222,11 +222,6 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
222
  remove_action('woocommerce_after_main_content','flatsome_pages_in_search_results', 10);
223
  }
224
 
225
- // Divi builder dynamic text shortcodes
226
- if ( defined( 'ET_BUILDER_PLUGIN_DIR' ) ) {
227
- add_filter( 'aws_before_strip_shortcodes', array( $this, 'divi_builder_strip_shortcodes' ) );
228
- }
229
-
230
  // WP all import finish
231
  //add_action( 'pmxi_after_xml_import', array( $this, 'pmxi_after_xml_import' ) );
232
 
@@ -308,6 +303,7 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
308
 
309
  // Divi module
310
  if ( defined( 'ET_BUILDER_PLUGIN_DIR' ) || function_exists( 'et_setup_theme' ) ) {
 
311
  include_once( AWS_DIR . '/includes/modules/divi/class-divi-aws-module.php' );
312
  }
313
 
@@ -1846,14 +1842,6 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
1846
  return 9999;
1847
  }
1848
 
1849
- /*
1850
- * Divi builder remove dynamic text shortcodes
1851
- */
1852
- public function divi_builder_strip_shortcodes( $str ) {
1853
- $str = preg_replace( '#\[et_pb_text.[^\]]*?_dynamic_attributes.*?\]@ET-.*?\[\/et_pb_text\]#', '', $str );
1854
- return $str;
1855
- }
1856
-
1857
  /*
1858
  * WP all import cron job
1859
  */
222
  remove_action('woocommerce_after_main_content','flatsome_pages_in_search_results', 10);
223
  }
224
 
 
 
 
 
 
225
  // WP all import finish
226
  //add_action( 'pmxi_after_xml_import', array( $this, 'pmxi_after_xml_import' ) );
227
 
303
 
304
  // Divi module
305
  if ( defined( 'ET_BUILDER_PLUGIN_DIR' ) || function_exists( 'et_setup_theme' ) ) {
306
+ include_once( AWS_DIR . '/includes/modules/divi/class-aws-divi.php' );
307
  include_once( AWS_DIR . '/includes/modules/divi/class-divi-aws-module.php' );
308
  }
309
 
1842
  return 9999;
1843
  }
1844
 
 
 
 
 
 
 
 
 
1845
  /*
1846
  * WP all import cron job
1847
  */
includes/class-aws-table-data.php CHANGED
@@ -83,7 +83,7 @@ if ( ! class_exists( 'AWS_Table_Data' ) ) :
83
 
84
  if ( $this->options['apply_filters'] ) {
85
  $content = apply_filters( 'the_content', $content, $data['id'] );
86
- } else {
87
  $content = do_shortcode( $content );
88
  }
89
 
83
 
84
  if ( $this->options['apply_filters'] ) {
85
  $content = apply_filters( 'the_content', $content, $data['id'] );
86
+ } elseif( isset( $this->options['do_shortcodes'] ) && $this->options['do_shortcodes'] ) {
87
  $content = do_shortcode( $content );
88
  }
89
 
includes/modules/divi/class-aws-divi.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Divi builder integration
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit; // Exit if accessed directly.
8
+ }
9
+
10
+ if ( ! class_exists( 'AWS_Divi' ) ) :
11
+
12
+ /**
13
+ * Class
14
+ */
15
+ class AWS_Divi {
16
+
17
+ /**
18
+ * Main AWS_Divi Instance
19
+ *
20
+ * Ensures only one instance of AWS_Divi is loaded or can be loaded.
21
+ *
22
+ * @static
23
+ * @return AWS_Divi - Main instance
24
+ */
25
+ protected static $_instance = null;
26
+
27
+ /**
28
+ * Main AWS_Divi Instance
29
+ *
30
+ * Ensures only one instance of AWS_Divi is loaded or can be loaded.
31
+ *
32
+ * @static
33
+ * @return AWS_Divi - Main instance
34
+ */
35
+ public static function instance() {
36
+ if ( is_null( self::$_instance ) ) {
37
+ self::$_instance = new self();
38
+ }
39
+ return self::$_instance;
40
+ }
41
+
42
+ /**
43
+ * Constructor
44
+ */
45
+ public function __construct() {
46
+
47
+ add_filter( 'aws_before_strip_shortcodes', array( $this, 'divi_builder_strip_shortcodes' ) );
48
+ add_filter( 'aws_index_do_shortcodes', array( $this, 'divi_builder_index_do_shortcodes' ) );
49
+ add_filter( 'aws_indexed_content', array( $this, 'aws_indexed_content' ), 10, 3 );
50
+
51
+ }
52
+
53
+ /*
54
+ * Divi builder remove dynamic text shortcodes
55
+ */
56
+ public function divi_builder_strip_shortcodes( $str ) {
57
+ $str = preg_replace( '#\[et_pb_text.[^\]]*?_dynamic_attributes.*?\]@ET-.*?\[\/et_pb_text\]#', '', $str );
58
+ return $str;
59
+ }
60
+
61
+ /*
62
+ * Disable shortcodes exucution inside product content when runing Divi visual builder
63
+ */
64
+ public function divi_builder_index_do_shortcodes( $do_shortcodes ) {
65
+ if ( isset( $_POST['action'] ) && $_POST['action'] === 'et_fb_ajax_save' ) {
66
+ return false;
67
+ }
68
+ return $do_shortcodes;
69
+ }
70
+
71
+ /*
72
+ * Add to index content from 'long description' field
73
+ */
74
+ public function aws_indexed_content( $content, $post_id, $product ) {
75
+
76
+ if ( function_exists('et_pb_is_pagebuilder_used') && defined('ET_BUILDER_WC_PRODUCT_LONG_DESC_META_KEY') && et_pb_is_pagebuilder_used( $post_id ) ) {
77
+ $description = get_post_meta( $post_id, ET_BUILDER_WC_PRODUCT_LONG_DESC_META_KEY, true );
78
+ if ( $description ) {
79
+ $description = AWS_Helpers::strip_shortcodes( $description );
80
+ $content .= ' ' . $description;
81
+ }
82
+ }
83
+
84
+ return $content;
85
+
86
+ }
87
+
88
+ }
89
+
90
+ endif;
91
+
92
+ AWS_Divi::instance();
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.45
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -167,6 +167,10 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
167
 
168
  == Changelog ==
169
 
 
 
 
 
170
  = 2.45 ( 2022-01-24 ) =
171
  * Update - Tested with WC 6.1
172
  * Update - Divi theme support. Autofocus on search field in the header
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.46
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
167
 
168
  == Changelog ==
169
 
170
+ = 2.45 ( 2022-01-26 ) =
171
+ * Update - Divi builder support. Index content from long description fields
172
+ * Fix - Bug with Divi visual builder that trigger error on save
173
+
174
  = 2.45 ( 2022-01-24 ) =
175
  * Update - Tested with WC 6.1
176
  * Update - Divi theme support. Autofocus on search field in the header