Ivory Search – WordPress Search Plugin - Version 5.4

Version Description

  • Fixed - PHP 5.2 compatibility issue.
  • Fixed - Index build max execution time not working.
Download this release

Release Info

Developer vinod dalvi
Plugin Icon 128x128 Ivory Search – WordPress Search Plugin
Version 5.4
Comparing to
See all releases

Code changes from version 5.3 to 5.4

add-search-to-menu.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Ivory Search
5
  * Plugin URI: https://ivorysearch.com
6
  * Description: The WordPress Search plugin that includes Search Form Customizer, WooCommerce Search, Image Search, Search Shortcode, AJAX Search & Live Search support!
7
- * Version: 5.3
8
  * Author: Ivory Search
9
  * Author URI: https://ivorysearch.com/
10
  * License: GPL2+
@@ -110,7 +110,7 @@ final class Ivory_Search
110
  public function define_constants()
111
  {
112
  if ( !defined( 'IS_VERSION' ) ) {
113
- define( 'IS_VERSION', '5.3' );
114
  }
115
  if ( !defined( 'IS_PLUGIN_FILE' ) ) {
116
  define( 'IS_PLUGIN_FILE', __FILE__ );
4
  * Plugin Name: Ivory Search
5
  * Plugin URI: https://ivorysearch.com
6
  * Description: The WordPress Search plugin that includes Search Form Customizer, WooCommerce Search, Image Search, Search Shortcode, AJAX Search & Live Search support!
7
+ * Version: 5.4
8
  * Author: Ivory Search
9
  * Author URI: https://ivorysearch.com/
10
  * License: GPL2+
110
  public function define_constants()
111
  {
112
  if ( !defined( 'IS_VERSION' ) ) {
113
+ define( 'IS_VERSION', '5.4' );
114
  }
115
  if ( !defined( 'IS_PLUGIN_FILE' ) ) {
116
  define( 'IS_PLUGIN_FILE', __FILE__ );
admin/class-is-admin.php CHANGED
@@ -647,7 +647,14 @@ class IS_Admin
647
  $args['_is_locale'] = ( isset( $_POST['is_locale'] ) ? sanitize_text_field( $_POST['is_locale'] ) : null );
648
  $args['_is_includes'] = ( isset( $_POST['_is_includes'] ) && is_array( $_POST['_is_includes'] ) ? $this->sanitize_includes( $_POST['_is_includes'] ) : '' );
649
  $args['_is_excludes'] = ( isset( $_POST['_is_excludes'] ) && is_array( $_POST['_is_excludes'] ) ? $this->sanitize_excludes( $_POST['_is_excludes'] ) : '' );
650
- $args['_is_ajax'] = ( isset( $_POST['_is_ajax'] ) && is_array( $_POST['_is_ajax'] ) ? $this->sanitize_settings( $_POST['_is_ajax'] ) : '' );
 
 
 
 
 
 
 
651
  $args['_is_customize'] = ( isset( $_POST['_is_customize'] ) && is_array( $_POST['_is_customize'] ) ? $this->sanitize_settings( $_POST['_is_customize'] ) : '' );
652
  $args['_is_settings'] = ( isset( $_POST['_is_settings'] ) && is_array( $_POST['_is_settings'] ) ? $this->sanitize_settings( $_POST['_is_settings'] ) : '' );
653
  $args['tab'] = ( isset( $_POST['tab'] ) ? sanitize_text_field( $_POST['tab'] ) : 'includes' );
@@ -981,19 +988,19 @@ class IS_Admin
981
  /**
982
  * Sanitizes settings options.
983
  */
984
- function sanitize_settings( $input, $defaults = '' )
985
  {
986
  if ( null === $input ) {
987
  return $defaults;
988
  }
989
- $output = $this->sanitize_fields( $input );
990
  return $output;
991
  }
992
 
993
  /**
994
  * Sanitizes fields.
995
  */
996
- function sanitize_fields( $input )
997
  {
998
  $output = array();
999
  if ( is_array( $input ) && !empty($input) ) {
@@ -1004,15 +1011,22 @@ class IS_Admin
1004
 
1005
  if ( is_array( $value2 ) ) {
1006
  foreach ( $value2 as $key3 => $value3 ) {
1007
- $output[$key][$key2][$key3] = sanitize_textarea_field( $input[$key][$key2][$key3] );
 
 
 
1008
  }
1009
  } else {
1010
- $output[$key][$key2] = sanitize_textarea_field( $input[$key][$key2] );
 
 
1011
  }
1012
 
1013
  }
1014
  } else {
1015
- $output[$key] = sanitize_textarea_field( $input[$key] );
 
 
1016
  }
1017
 
1018
  }
647
  $args['_is_locale'] = ( isset( $_POST['is_locale'] ) ? sanitize_text_field( $_POST['is_locale'] ) : null );
648
  $args['_is_includes'] = ( isset( $_POST['_is_includes'] ) && is_array( $_POST['_is_includes'] ) ? $this->sanitize_includes( $_POST['_is_includes'] ) : '' );
649
  $args['_is_excludes'] = ( isset( $_POST['_is_excludes'] ) && is_array( $_POST['_is_excludes'] ) ? $this->sanitize_excludes( $_POST['_is_excludes'] ) : '' );
650
+
651
+ if ( isset( $_POST['_is_ajax'] ) && is_array( $_POST['_is_ajax'] ) ) {
652
+ $args['_is_ajax'] = $this->sanitize_settings( $_POST['_is_ajax'], '', 'nothing_found_text' );
653
+ $args['_is_ajax']['nothing_found_text'] = wp_filter_post_kses( $_POST['_is_ajax']['nothing_found_text'] );
654
+ } else {
655
+ $args['_is_ajax'] = '';
656
+ }
657
+
658
  $args['_is_customize'] = ( isset( $_POST['_is_customize'] ) && is_array( $_POST['_is_customize'] ) ? $this->sanitize_settings( $_POST['_is_customize'] ) : '' );
659
  $args['_is_settings'] = ( isset( $_POST['_is_settings'] ) && is_array( $_POST['_is_settings'] ) ? $this->sanitize_settings( $_POST['_is_settings'] ) : '' );
660
  $args['tab'] = ( isset( $_POST['tab'] ) ? sanitize_text_field( $_POST['tab'] ) : 'includes' );
988
  /**
989
  * Sanitizes settings options.
990
  */
991
+ function sanitize_settings( $input, $defaults = '', $exception = '' )
992
  {
993
  if ( null === $input ) {
994
  return $defaults;
995
  }
996
+ $output = $this->sanitize_fields( $input, $exception );
997
  return $output;
998
  }
999
 
1000
  /**
1001
  * Sanitizes fields.
1002
  */
1003
+ function sanitize_fields( $input, $exception = '' )
1004
  {
1005
  $output = array();
1006
  if ( is_array( $input ) && !empty($input) ) {
1011
 
1012
  if ( is_array( $value2 ) ) {
1013
  foreach ( $value2 as $key3 => $value3 ) {
1014
+ echo $input[$key][$key2][$key3] . ' <br>' ;
1015
+ if ( $exception !== $key3 ) {
1016
+ $output[$key][$key2][$key3] = sanitize_textarea_field( $input[$key][$key2][$key3] );
1017
+ }
1018
  }
1019
  } else {
1020
+ if ( $exception !== $key2 ) {
1021
+ $output[$key][$key2] = sanitize_textarea_field( $input[$key][$key2] );
1022
+ }
1023
  }
1024
 
1025
  }
1026
  } else {
1027
+ if ( $exception !== $key ) {
1028
+ $output[$key] = sanitize_textarea_field( $input[$key] );
1029
+ }
1030
  }
1031
 
1032
  }
admin/class-is-editor.php CHANGED
@@ -1299,7 +1299,7 @@ class IS_Search_Editor
1299
  ?>-min_no_for_search" name="<?php
1300
  echo esc_attr( $id ) ;
1301
  ?>[min_no_for_search]" value="<?php
1302
- echo $min_no_for_search ;
1303
  ?>" />
1304
  <p class="description"><?php
1305
  _e( 'Minimum number of characters required to run ajax search.', 'add-search-to-menu' );
@@ -1316,7 +1316,7 @@ class IS_Search_Editor
1316
  ?>-result_box_max_height" name="<?php
1317
  echo esc_attr( $id ) ;
1318
  ?>[result_box_max_height]" value="<?php
1319
- echo esc_attr( $result_box_max_height ) ;
1320
  ?>"/>
1321
  <p class="description"><?php
1322
  _e( 'Search results box max height.', 'add-search-to-menu' );
@@ -1338,7 +1338,7 @@ class IS_Search_Editor
1338
  ?>-nothing_found_text" name="<?php
1339
  echo esc_attr( $id ) ;
1340
  ?>[nothing_found_text]" value="<?php
1341
- echo $nothing_found_text ;
1342
  ?>" />
1343
  <span class="description"><?php
1344
  _e( 'Text when there is no search results. HTML tags is allowed.', 'add-search-to-menu' );
@@ -2405,7 +2405,7 @@ class IS_Search_Editor
2405
  echo '<p class="check-radio"><label for="' . esc_attr( $id ) . '-highlight_terms" ><input class="_is_settings-highlight_terms" type="checkbox" id="' . esc_attr( $id ) . '-highlight_terms" name="' . esc_attr( $id ) . '[highlight_terms]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
2406
  echo '<span class="toggle-check-text"></span>' . esc_html__( "Highlight searched terms on search results page", 'add-search-to-menu' ) . '</label></p>' ;
2407
  $color = ( isset( $settings['highlight_color'] ) ? $settings['highlight_color'] : '#FFFFB9' );
2408
- echo '<div class="highlight-container"><br /><input style="width: 80px;" class="_is_settings-highlight_terms is-colorpicker" size="5" type="text" id="' . esc_attr( $id ) . '-highlight_color" name="' . esc_attr( $id ) . '[highlight_color]" value="' . $color . '" />' ;
2409
  echo '<br /><i> ' . esc_html__( "Select text highlight color", 'add-search-to-menu' ) . '</i></div>' ;
2410
  ?>
2411
  </div></div>
1299
  ?>-min_no_for_search" name="<?php
1300
  echo esc_attr( $id ) ;
1301
  ?>[min_no_for_search]" value="<?php
1302
+ esc_attr_e( $min_no_for_search );
1303
  ?>" />
1304
  <p class="description"><?php
1305
  _e( 'Minimum number of characters required to run ajax search.', 'add-search-to-menu' );
1316
  ?>-result_box_max_height" name="<?php
1317
  echo esc_attr( $id ) ;
1318
  ?>[result_box_max_height]" value="<?php
1319
+ esc_attr_e( $result_box_max_height );
1320
  ?>"/>
1321
  <p class="description"><?php
1322
  _e( 'Search results box max height.', 'add-search-to-menu' );
1338
  ?>-nothing_found_text" name="<?php
1339
  echo esc_attr( $id ) ;
1340
  ?>[nothing_found_text]" value="<?php
1341
+ esc_attr_e( $nothing_found_text );
1342
  ?>" />
1343
  <span class="description"><?php
1344
  _e( 'Text when there is no search results. HTML tags is allowed.', 'add-search-to-menu' );
2405
  echo '<p class="check-radio"><label for="' . esc_attr( $id ) . '-highlight_terms" ><input class="_is_settings-highlight_terms" type="checkbox" id="' . esc_attr( $id ) . '-highlight_terms" name="' . esc_attr( $id ) . '[highlight_terms]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
2406
  echo '<span class="toggle-check-text"></span>' . esc_html__( "Highlight searched terms on search results page", 'add-search-to-menu' ) . '</label></p>' ;
2407
  $color = ( isset( $settings['highlight_color'] ) ? $settings['highlight_color'] : '#FFFFB9' );
2408
+ echo '<div class="highlight-container"><br /><input style="width: 80px;" class="_is_settings-highlight_terms is-colorpicker" size="5" type="text" id="' . esc_attr( $id ) . '-highlight_color" name="' . esc_attr( $id ) . '[highlight_color]" value="' . esc_attr( $color ) . '" />' ;
2409
  echo '<br /><i> ' . esc_html__( "Select text highlight color", 'add-search-to-menu' ) . '</i></div>' ;
2410
  ?>
2411
  </div></div>
includes/class-is-debug.php CHANGED
@@ -103,6 +103,8 @@ class IS_Debug {
103
  }
104
 
105
  public static function set_debug_mode() {
 
 
106
  $defines = [
107
  'IS_DEBUG',
108
  'WP_DEBUG',
@@ -132,5 +134,3 @@ class IS_Debug {
132
  }
133
  }
134
 
135
- set_error_handler( array( 'IS_Debug', 'process_error_backtrace') );
136
-
103
  }
104
 
105
  public static function set_debug_mode() {
106
+ set_error_handler( array( 'IS_Debug', 'process_error_backtrace') );
107
+
108
  $defines = [
109
  'IS_DEBUG',
110
  'WP_DEBUG',
134
  }
135
  }
136
 
 
 
includes/class-is-index-helper.php CHANGED
@@ -636,7 +636,7 @@ class IS_Index_Helper {
636
  * @param string $content The content.
637
  * @return string The content with tags stripped.
638
  */
639
- public function strip_all_tags( $content ): string {
640
  if ( ! is_string( $content ) ) {
641
  $content = '';
642
  }
636
  * @param string $content The content.
637
  * @return string The content with tags stripped.
638
  */
639
+ public function strip_all_tags( $content ) {
640
  if ( ! is_string( $content ) ) {
641
  $content = '';
642
  }
includes/class-is-index-manager.php CHANGED
@@ -409,7 +409,6 @@ class IS_Index_Manager extends IS_Base_Options {
409
  if ( wp_verify_nonce( @$_POST['_isnonce'], self::CREATE_INDEX_ACTION )
410
  && ! $this->check_object_lock() ) {
411
  $this->set_object_lock();
412
- $this->set_start_time();
413
 
414
  switch ( $idx_status ) {
415
  case self::IDX_EMPTY:
@@ -426,6 +425,7 @@ class IS_Index_Manager extends IS_Base_Options {
426
  $this->get_build_pagination_args( $page )
427
  );
428
 
 
429
  $indexed = $this->build_offset;
430
  $posts = $ret['posts'];
431
  $total = $ret['total'];
@@ -592,7 +592,8 @@ class IS_Index_Manager extends IS_Base_Options {
592
  */
593
  protected function get_build_pagination_args( $page ) {
594
  $exec_time = $this->calc_exec_time();
595
- $max_exec_time = ini_get( 'max_execution_time' );
 
596
  $max_per_page = 100;
597
  $multiplier = 2;
598
  $per_page = $this->build_per_page;
@@ -618,16 +619,20 @@ class IS_Index_Manager extends IS_Base_Options {
618
 
619
  if ( $div > ( 2 * $multiplier ) ) {
620
  $per_page *= $multiplier;
621
- } elseif ( $div < $multiplier ) {
622
- $per_page -= 20;
623
  }
624
 
625
- if ( $per_page > $max_per_page ) {
626
- $per_page = $max_per_page;
627
- }
628
- if ( $per_page < 10 ) {
629
- $per_page = 10;
630
- }
 
 
 
 
631
  }
632
  }
633
 
409
  if ( wp_verify_nonce( @$_POST['_isnonce'], self::CREATE_INDEX_ACTION )
410
  && ! $this->check_object_lock() ) {
411
  $this->set_object_lock();
 
412
 
413
  switch ( $idx_status ) {
414
  case self::IDX_EMPTY:
425
  $this->get_build_pagination_args( $page )
426
  );
427
 
428
+ $this->set_start_time();
429
  $indexed = $this->build_offset;
430
  $posts = $ret['posts'];
431
  $total = $ret['total'];
592
  */
593
  protected function get_build_pagination_args( $page ) {
594
  $exec_time = $this->calc_exec_time();
595
+ $max_exec_time = @ini_get( 'max_execution_time' ) * .8;
596
+ $max_exec_time = min( $max_exec_time, 45 );
597
  $max_per_page = 100;
598
  $multiplier = 2;
599
  $per_page = $this->build_per_page;
619
 
620
  if ( $div > ( 2 * $multiplier ) ) {
621
  $per_page *= $multiplier;
622
+ } elseif ( $div > 1.5 ) {
623
+ $per_page += 10;
624
  }
625
 
626
+ }
627
+ elseif( $exec_time > $max_exec_time ) {
628
+ $per_page -= 10;
629
+ }
630
+
631
+ if ( $per_page > $max_per_page ) {
632
+ $per_page = $max_per_page;
633
+ }
634
+ if ( $per_page < 10 ) {
635
+ $per_page = 10;
636
  }
637
  }
638
 
languages/add-search-to-menu.pot CHANGED
@@ -2,7 +2,7 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Ivory Search\n"
5
- "POT-Creation-Date: 2021-12-28 22:16+0530\n"
6
  "PO-Revision-Date: 2020-03-17 21:05+0530\n"
7
  "Last-Translator: \n"
8
  "Language-Team: Ivory Search <admin@ivorysearch.com>\n"
@@ -169,31 +169,31 @@ msgstr ""
169
  msgid "You are not allowed to edit this item."
170
  msgstr ""
171
 
172
- #: ../admin/class-is-admin.php:649
173
  msgid "You are not allowed to reset this item."
174
  msgstr ""
175
 
176
- #: ../admin/class-is-admin.php:685
177
  msgid "You are not allowed to copy this item."
178
  msgstr ""
179
 
180
- #: ../admin/class-is-admin.php:724
181
  msgid "You are not allowed to delete this item."
182
  msgstr ""
183
 
184
- #: ../admin/class-is-admin.php:728
185
  msgid "Error in deleting."
186
  msgstr ""
187
 
188
- #: ../admin/class-is-admin.php:967
189
  msgid "Upgrade to Pro to Access"
190
  msgstr ""
191
 
192
- #: ../admin/class-is-admin.php:974
193
  msgid "Install Premium Version to Access"
194
  msgstr ""
195
 
196
- #: ../admin/class-is-admin.php:976
197
  msgid "Upgrade to Pro Plus to Access"
198
  msgstr ""
199
 
@@ -1804,7 +1804,7 @@ msgid "Creating Index..."
1804
  msgstr ""
1805
 
1806
  #: ../includes/class-is-index-manager.php:360
1807
- #: ../includes/class-is-index-manager.php:689
1808
  msgid "Create Index"
1809
  msgstr ""
1810
 
@@ -1852,27 +1852,27 @@ msgstr ""
1852
  msgid "Error: Index was not created"
1853
  msgstr ""
1854
 
1855
- #: ../includes/class-is-index-manager.php:663
1856
  msgid "Deleting Index..."
1857
  msgstr ""
1858
 
1859
- #: ../includes/class-is-index-manager.php:682
1860
  msgid "Index deleted"
1861
  msgstr ""
1862
 
1863
- #: ../includes/class-is-index-manager.php:684
1864
  msgid "Error: Index was not deleted"
1865
  msgstr ""
1866
 
1867
- #: ../includes/class-is-index-manager.php:731
1868
  msgid "Indexing content..."
1869
  msgstr ""
1870
 
1871
- #: ../includes/class-is-index-manager.php:756
1872
  msgid "Content Indexed ID: "
1873
  msgstr ""
1874
 
1875
- #: ../includes/class-is-index-manager.php:769
1876
  msgid "Error: content was not indexed"
1877
  msgstr ""
1878
 
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Ivory Search\n"
5
+ "POT-Creation-Date: 2022-01-04 23:09+0530\n"
6
  "PO-Revision-Date: 2020-03-17 21:05+0530\n"
7
  "Last-Translator: \n"
8
  "Language-Team: Ivory Search <admin@ivorysearch.com>\n"
169
  msgid "You are not allowed to edit this item."
170
  msgstr ""
171
 
172
+ #: ../admin/class-is-admin.php:654
173
  msgid "You are not allowed to reset this item."
174
  msgstr ""
175
 
176
+ #: ../admin/class-is-admin.php:690
177
  msgid "You are not allowed to copy this item."
178
  msgstr ""
179
 
180
+ #: ../admin/class-is-admin.php:729
181
  msgid "You are not allowed to delete this item."
182
  msgstr ""
183
 
184
+ #: ../admin/class-is-admin.php:733
185
  msgid "Error in deleting."
186
  msgstr ""
187
 
188
+ #: ../admin/class-is-admin.php:975
189
  msgid "Upgrade to Pro to Access"
190
  msgstr ""
191
 
192
+ #: ../admin/class-is-admin.php:982
193
  msgid "Install Premium Version to Access"
194
  msgstr ""
195
 
196
+ #: ../admin/class-is-admin.php:984
197
  msgid "Upgrade to Pro Plus to Access"
198
  msgstr ""
199
 
1804
  msgstr ""
1805
 
1806
  #: ../includes/class-is-index-manager.php:360
1807
+ #: ../includes/class-is-index-manager.php:694
1808
  msgid "Create Index"
1809
  msgstr ""
1810
 
1852
  msgid "Error: Index was not created"
1853
  msgstr ""
1854
 
1855
+ #: ../includes/class-is-index-manager.php:668
1856
  msgid "Deleting Index..."
1857
  msgstr ""
1858
 
1859
+ #: ../includes/class-is-index-manager.php:687
1860
  msgid "Index deleted"
1861
  msgstr ""
1862
 
1863
+ #: ../includes/class-is-index-manager.php:689
1864
  msgid "Error: Index was not deleted"
1865
  msgstr ""
1866
 
1867
+ #: ../includes/class-is-index-manager.php:736
1868
  msgid "Indexing content..."
1869
  msgstr ""
1870
 
1871
+ #: ../includes/class-is-index-manager.php:761
1872
  msgid "Content Indexed ID: "
1873
  msgstr ""
1874
 
1875
+ #: ../includes/class-is-index-manager.php:774
1876
  msgid "Error: content was not indexed"
1877
  msgstr ""
1878
 
public/class-is-public.php CHANGED
@@ -1040,7 +1040,7 @@ class IS_Public
1040
 
1041
  if ( is_search() && isset( $wp_query->query_vars['_is_settings']['highlight_terms'] ) && isset( $wp_query->query_vars['_is_settings']['highlight_color'] ) ) {
1042
  echo '<style type="text/css" media="screen">' ;
1043
- echo '.is-highlight { background-color: ' . $wp_query->query_vars['_is_settings']['highlight_color'] . ' !important;}' ;
1044
  echo '</style>' ;
1045
  }
1046
 
1040
 
1041
  if ( is_search() && isset( $wp_query->query_vars['_is_settings']['highlight_terms'] ) && isset( $wp_query->query_vars['_is_settings']['highlight_color'] ) ) {
1042
  echo '<style type="text/css" media="screen">' ;
1043
+ echo '.is-highlight { background-color: ' . esc_html( $wp_query->query_vars['_is_settings']['highlight_color'] ) . ' !important;}' ;
1044
  echo '</style>' ;
1045
  }
1046
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: search, woocommerce search, image search, ajax search, search shortcode, l
5
  Requires at least: 3.9
6
  Tested up to: 5.9
7
  Requires PHP: 5.2.4
8
- Stable tag: 5.3
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -197,6 +197,10 @@ Yes we do. We try our best to help free users with customisation requests and we
197
 
198
  == Changelog ==
199
 
 
 
 
 
200
  = 5.3 =
201
  * Fixed - Compatibility issue with MySQL 5.7
202
  * Fixed - MySQL > 8 REGEXP compatibility issue.
5
  Requires at least: 3.9
6
  Tested up to: 5.9
7
  Requires PHP: 5.2.4
8
+ Stable tag: 5.4
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
197
 
198
  == Changelog ==
199
 
200
+ = 5.4 =
201
+ * Fixed - PHP 5.2 compatibility issue.
202
+ * Fixed - Index build max execution time not working.
203
+
204
  = 5.3 =
205
  * Fixed - Compatibility issue with MySQL 5.7
206
  * Fixed - MySQL > 8 REGEXP compatibility issue.