Ivory Search – WordPress Search Plugin - Version 4.1.1

Version Description

  • Developed reset button to reset search form.
  • Designed new switch control UI for plugin settings page.
  • Developed functionality to display plugin options changed indicator.
Download this release

Release Info

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

Code changes from version 4.1 to 4.1.1

add-search-to-menu.php CHANGED
@@ -2,8 +2,8 @@
2
  /**
3
  * Plugin Name: Ivory Search
4
  * Plugin URI: https://ivorysearch.com
5
- * Description: The Ultimate WordPress Search plugin to power your custom search. Helping you build a better search. Includes WooCommerce Search support!
6
- * Version: 4.1
7
  * Author: Ivory Search
8
  * Author URI: https://ivorysearch.com/
9
  * License: GPL2+
2
  /**
3
  * Plugin Name: Ivory Search
4
  * Plugin URI: https://ivorysearch.com
5
+ * Description: The WordPress Search plugin to power your WordPress site custom search. Helping you build a better search. Includes WooCommerce Search support!
6
+ * Version: 4.1.1
7
  * Author: Ivory Search
8
  * Author URI: https://ivorysearch.com/
9
  * License: GPL2+
admin/class-is-admin.php CHANGED
@@ -1,143 +1,153 @@
1
  <?php
 
2
  /**
3
  * The class defines all functionality for the dashboard of the plugin.
4
  *
5
  * @package IS
6
  * @since 1.0.0
7
  */
8
-
9
- class IS_Admin {
10
-
11
- /**
12
- * Stores plugin options.
13
- */
14
- public $opt;
15
-
16
- /**
17
- * Stores network activation status.
18
- */
19
- private $networkactive;
20
-
21
- /**
22
- * Core singleton class
23
- * @var self
24
- */
25
- private static $_instance;
26
-
27
- /**
28
- * Initializes this class.
29
- *
30
- */
31
- public function __construct() {
32
- $is = Ivory_Search::getInstance();
33
-
34
- if ( null !== $is ) {
35
- $this->opt = $is->opt;
36
- } else {
37
- $old_opt = (array)get_option( 'add_search_to_menu' );
38
- $new_opt = (array)get_option( 'ivory_search' );
39
- $this->opt = array_merge( $old_opt, $new_opt );
40
- }
41
-
42
- $this->networkactive = ( is_multisite() && array_key_exists( plugin_basename( IS_PLUGIN_FILE ), (array) get_site_option( 'active_sitewide_plugins' ) ) );
43
- }
44
-
45
- /**
46
- * Gets the instance of this class.
47
- *
48
- * @return self
49
- */
50
- public static function getInstance() {
51
- if ( ! ( self::$_instance instanceof self ) ) {
52
- self::$_instance = new self();
53
- }
54
-
55
- return self::$_instance;
56
- }
57
-
58
- /**
59
- * Loads plugin javascript and stylesheet files in the admin area.
60
- */
61
- function admin_enqueue_scripts( $hook_suffix ) {
62
-
63
- if ( false === strpos( $hook_suffix, 'ivory-search' ) ) {
64
- return;
65
- }
66
-
67
- wp_enqueue_style( 'is-admin-styles', plugins_url( '/admin/css/ivory-search-admin.css', IS_PLUGIN_FILE ), array(), IS_VERSION );
68
-
69
- wp_register_script( 'is-admin-scripts', plugins_url( '/admin/js/ivory-search-admin.js', IS_PLUGIN_FILE ), array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-accordion' ), IS_VERSION, true );
70
-
71
- $args = array(
72
- 'saveAlert' => __(
73
- "The changes you made will be lost if you navigate away from this page.",
74
- 'ivory-search' ),
75
- 'activeTab' => isset( $_GET['active-tab'] )
76
- ? (int) $_GET['active-tab'] : 0,
77
- );
78
-
79
- wp_localize_script( 'is-admin-scripts', 'ivory_search', $args );
80
- wp_enqueue_script( 'is-admin-scripts' );
81
- }
82
-
83
- /**
84
- * Adds a link to the settings page in the plugins list.
85
- *
86
- * @param array $links array of links for the plugins, adapted when the current plugin is found.
87
- * @param string $file the filename for the current plugin, which the filter loops through.
88
- *
89
- * @return array $links
90
- */
91
- function plugin_action_links( $links, $file ) {
92
- if ( false !== strpos( $file, 'add-search-to-menu' ) ) {
93
- $mylinks = array(
94
- '<a href="https://ivorysearch.com/support">' . esc_html__( 'Support', 'ivory-search' ) . '</a>'
95
- );
96
- $links = array_merge( $mylinks, $links );
97
- }
98
- return $links;
99
- }
100
-
101
- /**
102
- * Displays plugin configuration notice in admin area.
103
- */
104
- function all_admin_notices(){
105
-
106
- $strpos = strpos( get_current_screen()->id, 'ivory-search' );
107
-
108
- if ( 0 === $strpos || 0 < $strpos ) {
109
- return;
110
- }
111
-
112
- $hascaps = $this->networkactive ? is_network_admin() && current_user_can( 'manage_network_plugins' ) : current_user_can( 'manage_options' );
113
-
114
- if ( $hascaps ) {
115
- $url = is_network_admin() ? network_site_url() : site_url( '/' );
116
- echo '<div class="notice notice-info is-dismissible ivory-search"><p>' . sprintf( __( 'To configure <em>Ivory Search plugin</em> please visit its <a href="%1$s">configuration page</a> and to get plugin support contact us on <a href="%2$s" target="_blank">plugin support forum</a> or <a href="%3$s" target="_blank">contact us page</a>.', 'ivory-search'), $url . 'wp-admin/admin.php?page=ivory-search', 'https://ivorysearch.com/support/', 'https://ivorysearch.com/contact/' ) . '</p></div>';
117
- }
118
- }
119
-
120
- /**
121
- * Handles plugin notice dismiss functionality using AJAX.
122
- */
123
- function dismiss_notice() {
124
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
125
- $this->opt['dismiss_admin_notices'] = 1;
126
- update_option( 'ivory_search', $this->opt );
127
- }
128
- die();
129
- }
130
-
131
- /**
132
- * Adds scripts in the admin footer
133
- */
134
- function admin_footer() {
135
- $strpos = strpos( get_current_screen()->id, 'ivory-search' );
136
-
137
- if ( 0 === $strpos || 0 < $strpos ) {
138
- return;
139
- }
140
- ?>
 
 
 
 
 
 
 
 
 
141
  <script>
142
  // Dismisses plugin notices.
143
  ( function( $ ) {
@@ -145,7 +155,9 @@ class IS_Admin {
145
  $( window ).load( function() {
146
  $( '.notice.is-dismissible.ivory-search .notice-dismiss' ).on( 'click', function() {
147
  $.ajax( {
148
- url: "<?php echo admin_url( 'admin-ajax.php' ); ?>",
 
 
149
  data: {
150
  action: 'dismiss_notice'
151
  }
@@ -154,554 +166,591 @@ class IS_Admin {
154
  } );
155
  } )( jQuery );
156
  </script>
157
- <?php }
158
-
159
- /**
160
- * Registers plugin settings.
161
- */
162
- function admin_init() {
163
-
164
- $settings_fields = new IS_Settings_Fields( $this->opt );
165
- $settings_fields->register_settings_fields();
166
-
167
- /* Creates default search form */
168
- $search_form = get_page_by_title( 'Default Search Form', OBJECT, IS_Search_Form::post_type );
169
-
170
- if ( NULL === $search_form ) {
171
-
172
- $args['id'] = -1;
173
- $args['title'] = 'Default Search Form';
174
- $args['_is_locale'] = 'en_US';
175
- $args['_is_includes'] = array(
176
- 'post_type' => array(
177
- 'post' => 'post',
178
- 'page' => 'page'
179
- ),
180
- 'search_title' => 1,
181
- 'search_content' => 1,
182
- 'search_excerpt' => 1,
183
- );
184
- $args['_is_excludes'] = '';
185
- $args['_is_settings'] = '';
186
-
187
- $this->save_form( $args );
188
- }
189
- }
190
-
191
- /**
192
- * Maps custom capabilities.
193
- */
194
- function map_meta_cap( $caps, $cap, $user_id, $args ) {
195
- $meta_caps = array(
196
- 'is_edit_search_form' => IS_ADMIN_READ_WRITE_CAPABILITY,
197
- 'is_edit_search_forms' => IS_ADMIN_READ_WRITE_CAPABILITY,
198
- 'is_read_search_forms' => IS_ADMIN_READ_CAPABILITY,
199
- 'is_delete_search_form' => IS_ADMIN_READ_WRITE_CAPABILITY,
200
- );
201
-
202
- $meta_caps = apply_filters( 'is_map_meta_cap', $meta_caps );
203
-
204
- $caps = array_diff( $caps, array_keys( $meta_caps ) );
205
-
206
- if ( isset( $meta_caps[$cap] ) ) {
207
- $caps[] = $meta_caps[$cap];
208
- }
209
-
210
- return $caps;
211
- }
212
-
213
- /**
214
- * Displays admin messages on updating search form
215
- */
216
- function admin_updated_message() {
217
- if ( empty( $_REQUEST['message'] ) ) {
218
- return;
219
- }
220
-
221
- if ( 'created' == $_REQUEST['message'] ) {
222
- $updated_message = __( "Search form created.", 'ivory-search' );
223
- } elseif ( 'saved' == $_REQUEST['message'] ) {
224
- $updated_message = __( "Search form saved.", 'ivory-search' );
225
- } elseif ( 'deleted' == $_REQUEST['message'] ) {
226
- $updated_message = __( "Search form deleted.", 'ivory-search' );
227
- }
228
-
229
- if ( ! empty( $updated_message ) ) {
230
- echo sprintf( '<div id="message" class="notice notice-success is-dismissible"><p>%s</p></div>', esc_html( $updated_message ) );
231
- return;
232
- }
233
-
234
- if ( 'failed' == $_REQUEST['message'] ) {
235
- $updated_message = __( "There was an error saving the search form.",
236
- 'ivory-search' );
237
-
238
- echo sprintf( '<div id="message" class="notice notice-error is-dismissible"><p>%s</p></div>', esc_html( $updated_message ) );
239
- return;
240
- }
241
-
242
- if ( 'invalid' == $_REQUEST['message'] ) {
243
- $updated_message = __( "There was a validation error saving the search form.",
244
- 'ivory-search' );
245
- $updated_message2 = sprintf( __( "Please make sure you have not selected similar %s fields in the search form Includes and Excludes sections.", 'ivory-search' ), $_REQUEST['data'] ) ;
246
- echo sprintf( '<div id="message" class="notice notice-error is-dismissible"><p>%s</p><p>%s</p></div>', esc_html( $updated_message ), esc_html( $updated_message2 ) );
247
- return;
248
- }
249
- }
250
-
251
- /**
252
- * Registers plugin admin menu item.
253
- */
254
- function admin_menu() {
255
- add_menu_page( __( 'Ivory Search', 'ivory-search' ), __( 'Ivory Search', 'ivory-search' ), 'manage_options', 'ivory-search', array( $this, 'search_forms_page' ), 'dashicons-search', 35 );
256
-
257
- $edit = add_submenu_page( 'ivory-search', __( 'Search Forms', 'ivory-search' ), __( 'Search Forms', 'ivory-search' ), 'manage_options', 'ivory-search', array( $this, 'search_forms_page' ) );
258
- add_action( 'load-' . $edit, array( $this, 'load_admin_search_form' ) );
259
-
260
- $addnew = add_submenu_page( 'ivory-search', __( 'Add New Search Form', 'ivory-search' ), __( 'Add New', 'ivory-search' ), 'manage_options', 'ivory-search-new', array( $this, 'new_search_form_page' ) );
261
- add_action( 'load-' . $addnew, array( $this, 'load_admin_search_form' ) );
262
-
263
- $settings = add_submenu_page( 'ivory-search', __( 'Ivory Search Settings', 'ivory-search' ), __( 'Settings', 'ivory-search' ), 'manage_options', 'ivory-search-settings', array( $this, 'settings_page' ) );
264
- add_action( 'load-' . $settings, array( $this, 'is_settings_add_help_tab' ) );
265
- }
266
-
267
- /**
268
- * Adds help tab to settings page screen.
269
- */
270
- function is_settings_add_help_tab() {
271
- $current_screen = get_current_screen();
272
- $help_tabs = new IS_Help( $current_screen );
273
- $help_tabs->set_help_tabs( 'settings' );
274
- }
275
-
276
- /**
277
- * Renders the search forms page for this plugin.
278
- */
279
- function search_forms_page() {
280
-
281
- /* Edits search form */
282
- if ( $post = IS_Search_Form::get_current() ) {
283
- $post_id = $post->initial() ? -1 : $post->id();
284
- include_once( 'partials/new-search-form.php' );
285
- return;
286
- }
287
-
288
- $list_table = new IS_List_Table();
289
- $list_table->prepare_items();
290
-
291
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  <div class="wrap">
293
 
294
  <h1 class="wp-heading-inline">
295
- <?php echo esc_html( __( 'Search Forms', 'ivory-search' ) ); ?>
 
 
296
  </h1>
297
 
298
- <?php
299
- if ( current_user_can( 'is_edit_search_forms' ) ) {
300
- echo sprintf( '<a href="%1$s" class="add-new-h2">%2$s</a>',
301
- esc_url( menu_page_url( 'ivory-search-new', false ) ),
302
- esc_html( __( 'Add New', 'ivory-search' ) ) );
303
- }
304
-
305
- if ( ! empty( $_REQUEST['s'] ) ) {
306
- echo sprintf( '<span class="subtitle">'
307
- /* translators: %s: search keywords */
308
- . __( 'Search results for &#8220;%s&#8221;', 'ivory-search' )
309
- . '</span>', esc_html( $_REQUEST['s'] ) );
310
- }
311
- ?>
312
 
313
  <hr class="wp-header-end" />
314
 
315
- <?php do_action( 'is_admin_notices' ); ?>
 
 
316
 
317
  <form method="get" action="">
318
- <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
319
- <?php $list_table->search_box( __( 'Search Search Forms', 'ivory-search' ), 'is-search' ); ?>
320
- <?php $list_table->display(); ?>
 
 
 
 
 
 
321
  </form>
322
 
323
  </div>
324
- <?php
325
- }
326
-
327
- /**
328
- * Renders the add new search form page for this plugin.
329
- */
330
- function new_search_form_page() {
331
-
332
- $post = IS_Search_Form::get_current();
333
-
334
- if ( ! $post ) {
335
- $post = IS_Search_Form::get_template();
336
- }
337
-
338
- $post_id = -1;
339
-
340
- include_once( 'partials/new-search-form.php' );
341
- }
342
-
343
- /**
344
- * Renders the settings page for this plugin.
345
- */
346
- function settings_page() {
347
- include_once( 'partials/settings-form.php' );
348
- }
349
-
350
- /**
351
- * Performs various search forms operations.
352
- */
353
- function load_admin_search_form() {
354
- global $plugin_page;
355
-
356
- $action = ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) ? $_REQUEST['action'] : false;
357
-
358
- if ( 'save' == $action ) {
359
- $id = isset( $_POST['post_ID'] ) ? $_POST['post_ID'] : '-1';
360
- check_admin_referer( 'is-save-search-form_' . $id );
361
-
362
- if ( ! current_user_can( 'is_edit_search_form', $id ) ) {
363
- wp_die( __( 'You are not allowed to edit this item.', 'ivory-search' ) );
364
- }
365
-
366
- $args = $_REQUEST;
367
-
368
- $args['id'] = $id;
369
- $args['title'] = isset( $_POST['post_title'] ) ? $_POST['post_title'] : null;
370
- $args['_is_locale'] = isset( $_POST['is_locale'] ) ? $_POST['is_locale'] : null;
371
- $args['_is_includes'] = isset( $_POST['_is_includes'] ) ? $_POST['_is_includes'] : '';
372
- $args['_is_excludes'] = isset( $_POST['_is_excludes'] ) ? $_POST['_is_excludes'] : '';
373
- $args['_is_settings'] = isset( $_POST['_is_settings'] ) ? $_POST['_is_settings'] : '';
374
-
375
- $invalid = false;
376
- if ( ! empty( $args['_is_includes'] ) && ! empty( $args['_is_excludes'] ) ) {
377
- foreach ( $args['_is_includes'] as $key => $value ) {
378
- if ( $invalid ) {
379
- break;
380
- }
381
- if ( isset( $args['_is_excludes'][ $key ] ) && ! empty( $args['_is_excludes'][ $key ] ) ) {
382
- if ( is_array( $value ) && is_array( $args['_is_excludes'][ $key ] ) ) {
383
- foreach ( $value as $key2 => $val ) {
384
- if ( $invalid ) {
385
- break;
386
- }
387
- if ( is_array( $val ) && isset( $args['_is_excludes'][ $key ][ $key2 ] ) && is_array( $args['_is_excludes'][ $key ][ $key2 ] ) ) {
388
- $similar = array_intersect( $val, $args['_is_excludes'][ $key ][ $key2 ] );
389
- if ( ! empty( $similar ) ) {
390
- $invalid = $key;
391
- }
392
- } else if ( in_array( $val, $args['_is_excludes'][ $key ] ) ) {
393
- $invalid = $key;
394
- }
395
- }
396
- }
397
- }
398
- }
399
- }
400
-
401
- $query = '';
402
-
403
- if ( $invalid ) {
404
- $query = array(
405
- 'post' => $id,
406
- 'active-tab' => isset( $_POST['active-tab'] )
407
- ? (int) $_POST['active-tab'] : 0,
408
- );
409
- $query['message'] = 'invalid';
410
- $query['data'] = $invalid;
411
- } else {
412
- $search_form = $this->save_form( $args );
413
- $query = array(
414
- 'post' => $search_form ? $search_form->id() : 0,
415
- 'active-tab' => isset( $_POST['active-tab'] )
416
- ? (int) $_POST['active-tab'] : 0,
417
- );
418
-
419
- if ( ! $search_form ) {
420
- $query['message'] = 'failed';
421
- } elseif ( -1 == $id ) {
422
- $query['message'] = 'created';
423
- } else {
424
- $query['message'] = 'saved';
425
- }
426
- }
427
-
428
- $redirect_to = add_query_arg( $query, menu_page_url( 'ivory-search', false ) );
429
- wp_safe_redirect( $redirect_to );
430
- exit();
431
- }
432
-
433
- if ( 'copy' == $action ) {
434
- $id = empty( $_POST['post_ID'] )
435
- ? absint( $_REQUEST['post'] )
436
- : absint( $_POST['post_ID'] );
437
-
438
- check_admin_referer( 'is-copy-search-form_' . $id );
439
-
440
- if ( ! current_user_can( 'is_edit_search_form', $id ) ) {
441
- wp_die( __( 'You are not allowed to copy this item.', 'ivory-search' ) );
442
- }
443
-
444
- $query = array();
445
-
446
- if ( $search_form = IS_Search_Form::get_instance( $id ) ) {
447
- $new_search_form = $search_form->copy();
448
- $new_search_form->save();
449
-
450
- $query['post'] = $new_search_form->id();
451
- $query['message'] = 'created';
452
- }
453
-
454
- $redirect_to = add_query_arg( $query, menu_page_url( 'ivory-search', false ) );
455
- wp_safe_redirect( $redirect_to );
456
- exit();
457
- }
458
-
459
- if ( 'delete' == $action ) {
460
- if ( ! empty( $_POST['post_ID'] ) ) {
461
- check_admin_referer( 'is-delete-search-form_' . $_POST['post_ID'] );
462
- } else if ( ! is_array( $_REQUEST['post'] ) ) {
463
- check_admin_referer( 'is-delete-search-form_' . $_REQUEST['post'] );
464
- } else {
465
- check_admin_referer( 'bulk-posts' );
466
- }
467
-
468
- $posts = empty( $_POST['post_ID'] )
469
- ? (array) $_REQUEST['post']
470
- : (array) $_POST['post_ID'];
471
-
472
- $deleted = 0;
473
-
474
- foreach ( $posts as $post ) {
475
- $post = IS_Search_Form::get_instance( $post );
476
-
477
- if ( empty( $post ) ) {
478
- continue;
479
- }
480
-
481
- if ( ! current_user_can( 'is_delete_search_form', $post->id() ) ) {
482
- wp_die( __( 'You are not allowed to delete this item.', 'ivory-search' ) );
483
- }
484
-
485
- if ( ! $post->delete() ) {
486
- wp_die( __( 'Error in deleting.', 'ivory-search' ) );
487
- }
488
-
489
- $deleted += 1;
490
- }
491
-
492
- $query = array();
493
-
494
- if ( $deleted ) {
495
- $query['message'] = 'deleted';
496
- }
497
-
498
- $redirect_to = add_query_arg( $query, menu_page_url( 'ivory-search', false ) );
499
-
500
- wp_safe_redirect( $redirect_to );
501
- exit();
502
- }
503
-
504
- $_GET['post'] = isset( $_GET['post'] ) ? $_GET['post'] : '';
505
-
506
- $post = null;
507
-
508
- if ( 'ivory-search-new' == $plugin_page ) {
509
- $post = IS_Search_Form::get_template( array(
510
- 'locale' => isset( $_GET['locale'] ) ? $_GET['locale'] : null ) );
511
- } elseif ( ! empty( $_GET['post'] ) ) {
512
- $post = IS_Search_Form::get_instance( $_GET['post'] );
513
- }
514
-
515
- $current_screen = get_current_screen();
516
-
517
- $help_tabs = new IS_Help( $current_screen );
518
-
519
- if ( $post && current_user_can( 'is_edit_search_form', $post->id() ) ) {
520
- $help_tabs->set_help_tabs( 'edit' );
521
- } else {
522
- $help_tabs->set_help_tabs( 'list' );
523
-
524
- add_filter( 'manage_' . $current_screen->id . '_columns',
525
- array( 'IS_List_Table', 'define_columns' ) );
526
-
527
- add_screen_option( 'per_page', array(
528
- 'default' => 20,
529
- 'option' => 'is_search_forms_per_page',
530
- ) );
531
- }
532
- }
533
-
534
- /**
535
- * Saves search form.
536
- */
537
- function save_form( $args = '', $context = 'save' ) {
538
-
539
- $args = wp_parse_args( $args, array(
540
- 'id' => -1,
541
- 'title' => null,
542
- '_is_locale' => null,
543
- '_is_includes' => null,
544
- '_is_excludes' => null,
545
- '_is_settings' => null,
546
- ) );
547
-
548
- $args['id'] = (int) $args['id'];
549
-
550
- $search_form = '';
551
-
552
- if ( -1 == $args['id'] ) {
553
- $search_form = IS_Search_Form::get_template();
554
- } else {
555
- $search_form = IS_Search_Form::get_instance( $args['id'] );
556
- }
557
-
558
- if ( empty( $search_form ) ) {
559
- return false;
560
- }
561
-
562
- if ( null !== $args['title'] ) {
563
- $search_form->set_title( $args['title'] );
564
- }
565
-
566
- if ( null !== $args['_is_locale'] ) {
567
- $search_form->set_locale( $args['_is_locale'] );
568
- }
569
-
570
- $properties = $search_form->get_properties();
571
-
572
- $properties['_is_includes'] = $this->sanitize_includes(
573
- $args['_is_includes'] );
574
-
575
- $properties['_is_excludes'] = $this->sanitize_excludes(
576
- $args['_is_excludes'] );
577
-
578
- $properties['_is_settings'] = $this->sanitize_settings(
579
- $args['_is_settings'] );
580
-
581
- $search_form->set_properties( $properties );
582
-
583
- do_action( 'is_before_save_form', $search_form, $args, $context );
584
-
585
- if ( 'save' == $context ) {
586
- $search_form->save();
587
- }
588
-
589
- do_action( 'is_after_save_form', $search_form, $args, $context );
590
-
591
- return $search_form;
592
- }
593
-
594
- /**
595
- * Sanitizes includes settings.
596
- */
597
- function sanitize_includes( $input, $defaults = array() ) {
598
-
599
- if ( null === $input ) {
600
- return $defaults;
601
- }
602
-
603
- $defaults = wp_parse_args( $defaults, array(
604
- 'post_type' => array(
605
- 'post' => 'post',
606
- 'page' => 'page'
607
- ),
608
- ) );
609
-
610
- $input = wp_parse_args( $input, $defaults );
611
- $output = $this->sanitize_fields( $input );
612
-
613
- return $output;
614
- }
615
-
616
- /**
617
- * Sanitizes excludes settings.
618
- */
619
- function sanitize_excludes( $input, $defaults = '' ) {
620
- if ( null === $input ) {
621
- return $defaults;
622
- }
623
-
624
- $output = $this->sanitize_fields( $input );
625
-
626
- return $output;
627
- }
628
-
629
- /**
630
- * Sanitizes settings options.
631
- */
632
- function sanitize_settings( $input, $defaults = '' ) {
633
- if ( null === $input ) {
634
- return $defaults;
635
- }
636
-
637
- $output = $this->sanitize_fields( $input );
638
-
639
- return $output;
640
- }
641
-
642
- /**
643
- * Sanitizes fields.
644
- */
645
- function sanitize_fields( $input ) {
646
-
647
- $output = array();
648
-
649
- if ( is_array( $input ) && ! empty( $input ) ) {
650
- foreach ( $input as $key => $value ) {
651
- if ( is_array( $value ) ) {
652
- foreach ( $value as $key2 => $value2 ) {
653
- if ( is_array( $value2 ) ) {
654
- foreach ( $value2 as $key3 => $value3 ) {
655
- $output[$key][$key2][$key3] = esc_attr( $input[$key][$key2][$key3] );
656
- }
657
- } else {
658
- $output[$key][$key2] = esc_attr( $input[$key][$key2] );
659
- }
660
- }
661
- } else {
662
- $output[$key] = esc_attr( $input[$key] );
663
- }
664
- }
665
- }
666
-
667
- return $output;
668
- }
669
-
670
- /**
671
- * Displays search form save button.
672
- */
673
- function save_button( $post_id ) {
674
- static $button = '';
675
-
676
- if ( ! empty( $button ) ) {
677
- echo $button;
678
- return;
679
- }
680
-
681
- $nonce = wp_create_nonce( 'is-save-search-form_' . $post_id );
682
-
683
- $onclick = sprintf(
684
- "this.form._wpnonce.value = '%s';"
685
- . " this.form.action.value = 'save';"
686
- . " return true;",
687
- $nonce );
688
-
689
- $button = sprintf(
690
- '<input type="submit" class="button-primary" name="is_save" value="%1$s" onclick="%2$s" />',
691
- esc_attr( __( 'Save Form', 'ivory-search' ) ),
692
- $onclick );
693
-
694
- echo $button;
695
- }
696
-
697
- /**
698
- * Returns premium plugin version link.
699
- */
700
- public static function pro_link( $plan = 'pro' ) {
701
- if ( is_fs()->is_plan_or_trial( $plan ) ) {
702
- return '';
703
- } else {
704
- return '<span class="upgrade-wrapper"><a class="upgrade-link" href="' . esc_url( menu_page_url( 'ivory-search-pricing', false ) ) . '"> ' . esc_html__( "Upgrade To Access", 'ivory-search' ) . '</a></span>';
705
- }
706
- }
707
- }
1
  <?php
2
+
3
  /**
4
  * The class defines all functionality for the dashboard of the plugin.
5
  *
6
  * @package IS
7
  * @since 1.0.0
8
  */
9
+ class IS_Admin
10
+ {
11
+ /**
12
+ * Stores plugin options.
13
+ */
14
+ public $opt ;
15
+ /**
16
+ * Stores network activation status.
17
+ */
18
+ private $networkactive ;
19
+ /**
20
+ * Core singleton class
21
+ * @var self
22
+ */
23
+ private static $_instance ;
24
+ /**
25
+ * Initializes this class.
26
+ *
27
+ */
28
+ public function __construct()
29
+ {
30
+ $is = Ivory_Search::getInstance();
31
+
32
+ if ( null !== $is ) {
33
+ $this->opt = $is->opt;
34
+ } else {
35
+ $old_opt = (array) get_option( 'add_search_to_menu' );
36
+ $new_opt = (array) get_option( 'ivory_search' );
37
+ $this->opt = array_merge( $old_opt, $new_opt );
38
+ }
39
+
40
+ $this->networkactive = is_multisite() && array_key_exists( plugin_basename( IS_PLUGIN_FILE ), (array) get_site_option( 'active_sitewide_plugins' ) );
41
+ }
42
+
43
+ /**
44
+ * Gets the instance of this class.
45
+ *
46
+ * @return self
47
+ */
48
+ public static function getInstance()
49
+ {
50
+ if ( !self::$_instance instanceof self ) {
51
+ self::$_instance = new self();
52
+ }
53
+ return self::$_instance;
54
+ }
55
+
56
+ /**
57
+ * Loads plugin javascript and stylesheet files in the admin area.
58
+ */
59
+ function admin_enqueue_scripts( $hook_suffix )
60
+ {
61
+ if ( false === strpos( $hook_suffix, 'ivory-search' ) ) {
62
+ return;
63
+ }
64
+ wp_enqueue_style(
65
+ 'is-admin-styles',
66
+ plugins_url( '/admin/css/ivory-search-admin.css', IS_PLUGIN_FILE ),
67
+ array(),
68
+ IS_VERSION
69
+ );
70
+ wp_register_script(
71
+ 'is-admin-scripts',
72
+ plugins_url( '/admin/js/ivory-search-admin.js', IS_PLUGIN_FILE ),
73
+ array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-accordion' ),
74
+ IS_VERSION,
75
+ true
76
+ );
77
+ $args = array(
78
+ 'saveAlert' => __( "The changes you made will be lost if you navigate away from this page.", 'ivory-search' ),
79
+ 'activeTab' => ( isset( $_GET['active-tab'] ) ? (int) $_GET['active-tab'] : 0 ),
80
+ );
81
+ wp_localize_script( 'is-admin-scripts', 'ivory_search', $args );
82
+ wp_enqueue_script( 'is-admin-scripts' );
83
+ }
84
+
85
+ /**
86
+ * Adds a link to the settings page in the plugins list.
87
+ *
88
+ * @param array $links array of links for the plugins, adapted when the current plugin is found.
89
+ * @param string $file the filename for the current plugin, which the filter loops through.
90
+ *
91
+ * @return array $links
92
+ */
93
+ function plugin_action_links( $links, $file )
94
+ {
95
+
96
+ if ( false !== strpos( $file, 'add-search-to-menu' ) ) {
97
+ $mylinks = array( '<a href="https://ivorysearch.com/support">' . esc_html__( 'Support', 'ivory-search' ) . '</a>' );
98
+ $links = array_merge( $mylinks, $links );
99
+ }
100
+
101
+ return $links;
102
+ }
103
+
104
+ /**
105
+ * Displays plugin configuration notice in admin area.
106
+ */
107
+ function all_admin_notices()
108
+ {
109
+ $strpos = strpos( get_current_screen()->id, 'ivory-search' );
110
+ if ( 0 === $strpos || 0 < $strpos ) {
111
+ return;
112
+ }
113
+ $hascaps = ( $this->networkactive ? is_network_admin() && current_user_can( 'manage_network_plugins' ) : current_user_can( 'manage_options' ) );
114
+
115
+ if ( $hascaps ) {
116
+ $url = ( is_network_admin() ? network_site_url() : site_url( '/' ) );
117
+ echo '<div class="notice notice-info is-dismissible ivory-search"><p>' . sprintf(
118
+ __( 'To configure <em>Ivory Search plugin</em> please visit its <a href="%1$s">configuration page</a> and to get plugin support contact us on <a href="%2$s" target="_blank">plugin support forum</a> or <a href="%3$s" target="_blank">contact us page</a>.', 'ivory-search' ),
119
+ $url . 'wp-admin/admin.php?page=ivory-search',
120
+ 'https://ivorysearch.com/support/',
121
+ 'https://ivorysearch.com/contact/'
122
+ ) . '</p></div>' ;
123
+ }
124
+
125
+ }
126
+
127
+ /**
128
+ * Handles plugin notice dismiss functionality using AJAX.
129
+ */
130
+ function dismiss_notice()
131
+ {
132
+
133
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
134
+ $this->opt['dismiss_admin_notices'] = 1;
135
+ update_option( 'ivory_search', $this->opt );
136
+ }
137
+
138
+ die;
139
+ }
140
+
141
+ /**
142
+ * Adds scripts in the admin footer
143
+ */
144
+ function admin_footer()
145
+ {
146
+ $strpos = strpos( get_current_screen()->id, 'ivory-search' );
147
+ if ( 0 === $strpos || 0 < $strpos ) {
148
+ return;
149
+ }
150
+ ?>
151
  <script>
152
  // Dismisses plugin notices.
153
  ( function( $ ) {
155
  $( window ).load( function() {
156
  $( '.notice.is-dismissible.ivory-search .notice-dismiss' ).on( 'click', function() {
157
  $.ajax( {
158
+ url: "<?php
159
+ echo admin_url( 'admin-ajax.php' ) ;
160
+ ?>",
161
  data: {
162
  action: 'dismiss_notice'
163
  }
166
  } );
167
  } )( jQuery );
168
  </script>
169
+ <?php
170
+ }
171
+
172
+ /**
173
+ * Registers plugin settings.
174
+ */
175
+ function admin_init()
176
+ {
177
+ $settings_fields = new IS_Settings_Fields( $this->opt );
178
+ $settings_fields->register_settings_fields();
179
+ /* Creates default search form */
180
+ $search_form = get_page_by_title( 'Default Search Form', OBJECT, IS_Search_Form::post_type );
181
+
182
+ if ( NULL === $search_form ) {
183
+ $args['id'] = -1;
184
+ $args['title'] = 'Default Search Form';
185
+ $args['_is_locale'] = 'en_US';
186
+ $args['_is_includes'] = array(
187
+ 'post_type' => array(
188
+ 'post' => 'post',
189
+ 'page' => 'page',
190
+ ),
191
+ 'search_title' => 1,
192
+ 'search_content' => 1,
193
+ 'search_excerpt' => 1,
194
+ );
195
+ $args['_is_excludes'] = '';
196
+ $args['_is_settings'] = '';
197
+ $this->save_form( $args );
198
+ }
199
+
200
+ }
201
+
202
+ /**
203
+ * Maps custom capabilities.
204
+ */
205
+ function map_meta_cap(
206
+ $caps,
207
+ $cap,
208
+ $user_id,
209
+ $args
210
+ )
211
+ {
212
+ $meta_caps = array(
213
+ 'is_edit_search_form' => IS_ADMIN_READ_WRITE_CAPABILITY,
214
+ 'is_edit_search_forms' => IS_ADMIN_READ_WRITE_CAPABILITY,
215
+ 'is_read_search_forms' => IS_ADMIN_READ_CAPABILITY,
216
+ 'is_delete_search_form' => IS_ADMIN_READ_WRITE_CAPABILITY,
217
+ );
218
+ $meta_caps = apply_filters( 'is_map_meta_cap', $meta_caps );
219
+ $caps = array_diff( $caps, array_keys( $meta_caps ) );
220
+ if ( isset( $meta_caps[$cap] ) ) {
221
+ $caps[] = $meta_caps[$cap];
222
+ }
223
+ return $caps;
224
+ }
225
+
226
+ /**
227
+ * Displays admin messages on updating search form
228
+ */
229
+ function admin_updated_message()
230
+ {
231
+ if ( empty($_REQUEST['message']) ) {
232
+ return;
233
+ }
234
+
235
+ if ( 'created' == $_REQUEST['message'] ) {
236
+ $updated_message = __( "Search form created.", 'ivory-search' );
237
+ } elseif ( 'saved' == $_REQUEST['message'] ) {
238
+ $updated_message = __( "Search form saved.", 'ivory-search' );
239
+ } elseif ( 'deleted' == $_REQUEST['message'] ) {
240
+ $updated_message = __( "Search form deleted.", 'ivory-search' );
241
+ } elseif ( 'reset' == $_REQUEST['message'] ) {
242
+ $updated_message = __( "Search form reset.", 'ivory-search' );
243
+ }
244
+
245
+
246
+ if ( !empty($updated_message) ) {
247
+ echo sprintf( '<div id="message" class="notice notice-success is-dismissible"><p>%s</p></div>', esc_html( $updated_message ) ) ;
248
+ return;
249
+ }
250
+
251
+
252
+ if ( 'failed' == $_REQUEST['message'] ) {
253
+ $updated_message = __( "There was an error saving the search form.", 'ivory-search' );
254
+ echo sprintf( '<div id="message" class="notice notice-error is-dismissible"><p>%s</p></div>', esc_html( $updated_message ) ) ;
255
+ return;
256
+ }
257
+
258
+
259
+ if ( 'invalid' == $_REQUEST['message'] ) {
260
+ $updated_message = __( "There was a validation error saving the search form.", 'ivory-search' );
261
+ $updated_message2 = sprintf( __( "Please make sure you have not selected similar %s fields in the search form Includes and Excludes sections.", 'ivory-search' ), $_REQUEST['data'] );
262
+ echo sprintf( '<div id="message" class="notice notice-error is-dismissible"><p>%s</p><p>%s</p></div>', esc_html( $updated_message ), esc_html( $updated_message2 ) ) ;
263
+ return;
264
+ }
265
+
266
+ }
267
+
268
+ /**
269
+ * Registers plugin admin menu item.
270
+ */
271
+ function admin_menu()
272
+ {
273
+ add_menu_page(
274
+ __( 'Ivory Search', 'ivory-search' ),
275
+ __( 'Ivory Search', 'ivory-search' ),
276
+ 'manage_options',
277
+ 'ivory-search',
278
+ array( $this, 'search_forms_page' ),
279
+ 'dashicons-search',
280
+ 35
281
+ );
282
+ $edit = add_submenu_page(
283
+ 'ivory-search',
284
+ __( 'Search Forms', 'ivory-search' ),
285
+ __( 'Search Forms', 'ivory-search' ),
286
+ 'manage_options',
287
+ 'ivory-search',
288
+ array( $this, 'search_forms_page' )
289
+ );
290
+ add_action( 'load-' . $edit, array( $this, 'load_admin_search_form' ) );
291
+ $addnew = add_submenu_page(
292
+ 'ivory-search',
293
+ __( 'Add New Search Form', 'ivory-search' ),
294
+ __( 'Add New', 'ivory-search' ),
295
+ 'manage_options',
296
+ 'ivory-search-new',
297
+ array( $this, 'new_search_form_page' )
298
+ );
299
+ add_action( 'load-' . $addnew, array( $this, 'load_admin_search_form' ) );
300
+ $settings = add_submenu_page(
301
+ 'ivory-search',
302
+ __( 'Ivory Search Settings', 'ivory-search' ),
303
+ __( 'Settings', 'ivory-search' ),
304
+ 'manage_options',
305
+ 'ivory-search-settings',
306
+ array( $this, 'settings_page' )
307
+ );
308
+ add_action( 'load-' . $settings, array( $this, 'is_settings_add_help_tab' ) );
309
+ }
310
+
311
+ /**
312
+ * Adds help tab to settings page screen.
313
+ */
314
+ function is_settings_add_help_tab()
315
+ {
316
+ $current_screen = get_current_screen();
317
+ $help_tabs = new IS_Help( $current_screen );
318
+ $help_tabs->set_help_tabs( 'settings' );
319
+ }
320
+
321
+ /**
322
+ * Renders the search forms page for this plugin.
323
+ */
324
+ function search_forms_page()
325
+ {
326
+ /* Edits search form */
327
+
328
+ if ( $post = IS_Search_Form::get_current() ) {
329
+ $post_id = ( $post->initial() ? -1 : $post->id() );
330
+ include_once 'partials/new-search-form.php';
331
+ return;
332
+ }
333
+
334
+ $list_table = new IS_List_Table();
335
+ $list_table->prepare_items();
336
+ ?>
337
  <div class="wrap">
338
 
339
  <h1 class="wp-heading-inline">
340
+ <?php
341
+ echo esc_html( __( 'Search Forms', 'ivory-search' ) ) ;
342
+ ?>
343
  </h1>
344
 
345
+ <?php
346
+ if ( current_user_can( 'is_edit_search_forms' ) ) {
347
+ echo sprintf( '<a href="%1$s" class="add-new-h2">%2$s</a>', esc_url( menu_page_url( 'ivory-search-new', false ) ), esc_html( __( 'Add New', 'ivory-search' ) ) ) ;
348
+ }
349
+ if ( !empty($_REQUEST['s']) ) {
350
+ echo sprintf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;', 'ivory-search' ) . '</span>', esc_html( $_REQUEST['s'] ) ) ;
351
+ }
352
+ ?>
 
 
 
 
 
 
353
 
354
  <hr class="wp-header-end" />
355
 
356
+ <?php
357
+ do_action( 'is_admin_notices' );
358
+ ?>
359
 
360
  <form method="get" action="">
361
+ <input type="hidden" name="page" value="<?php
362
+ echo esc_attr( $_REQUEST['page'] ) ;
363
+ ?>" />
364
+ <?php
365
+ $list_table->search_box( __( 'Search Search Forms', 'ivory-search' ), 'is-search' );
366
+ ?>
367
+ <?php
368
+ $list_table->display();
369
+ ?>
370
  </form>
371
 
372
  </div>
373
+ <?php
374
+ }
375
+
376
+ /**
377
+ * Renders the add new search form page for this plugin.
378
+ */
379
+ function new_search_form_page()
380
+ {
381
+ $post = IS_Search_Form::get_current();
382
+ if ( !$post ) {
383
+ $post = IS_Search_Form::get_template();
384
+ }
385
+ $post_id = -1;
386
+ include_once 'partials/new-search-form.php';
387
+ }
388
+
389
+ /**
390
+ * Renders the settings page for this plugin.
391
+ */
392
+ function settings_page()
393
+ {
394
+ include_once 'partials/settings-form.php';
395
+ }
396
+
397
+ /**
398
+ * Performs various search forms operations.
399
+ */
400
+ function load_admin_search_form()
401
+ {
402
+ global $plugin_page ;
403
+ $action = ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ? $_REQUEST['action'] : false );
404
+
405
+ if ( 'save' == $action ) {
406
+ $id = ( isset( $_POST['post_ID'] ) ? $_POST['post_ID'] : '-1' );
407
+ check_admin_referer( 'is-save-search-form_' . $id );
408
+ if ( !current_user_can( 'is_edit_search_form', $id ) ) {
409
+ wp_die( __( 'You are not allowed to edit this item.', 'ivory-search' ) );
410
+ }
411
+ $args = $_REQUEST;
412
+ $args['id'] = $id;
413
+ $args['title'] = ( isset( $_POST['post_title'] ) ? $_POST['post_title'] : null );
414
+ $args['_is_locale'] = ( isset( $_POST['is_locale'] ) ? $_POST['is_locale'] : null );
415
+ $args['_is_includes'] = ( isset( $_POST['_is_includes'] ) ? $_POST['_is_includes'] : '' );
416
+ $args['_is_excludes'] = ( isset( $_POST['_is_excludes'] ) ? $_POST['_is_excludes'] : '' );
417
+ $args['_is_settings'] = ( isset( $_POST['_is_settings'] ) ? $_POST['_is_settings'] : '' );
418
+ $invalid = false;
419
+ if ( !empty($args['_is_includes']) && !empty($args['_is_excludes']) ) {
420
+ foreach ( $args['_is_includes'] as $key => $value ) {
421
+ if ( $invalid ) {
422
+ break;
423
+ }
424
+ if ( isset( $args['_is_excludes'][$key] ) && !empty($args['_is_excludes'][$key]) ) {
425
+ if ( is_array( $value ) && is_array( $args['_is_excludes'][$key] ) ) {
426
+ foreach ( $value as $key2 => $val ) {
427
+ if ( $invalid ) {
428
+ break;
429
+ }
430
+
431
+ if ( is_array( $val ) && isset( $args['_is_excludes'][$key][$key2] ) && is_array( $args['_is_excludes'][$key][$key2] ) ) {
432
+ $similar = array_intersect( $val, $args['_is_excludes'][$key][$key2] );
433
+ if ( !empty($similar) ) {
434
+ $invalid = $key;
435
+ }
436
+ } else {
437
+ if ( in_array( $val, $args['_is_excludes'][$key] ) ) {
438
+ $invalid = $key;
439
+ }
440
+ }
441
+
442
+ }
443
+ }
444
+ }
445
+ }
446
+ }
447
+ $query = '';
448
+
449
+ if ( $invalid ) {
450
+ $query = array(
451
+ 'post' => $id,
452
+ 'active-tab' => ( isset( $_POST['active-tab'] ) ? (int) $_POST['active-tab'] : 0 ),
453
+ );
454
+ $query['message'] = 'invalid';
455
+ $query['data'] = $invalid;
456
+ } else {
457
+ $search_form = $this->save_form( $args );
458
+ $query = array(
459
+ 'post' => ( $search_form ? $search_form->id() : 0 ),
460
+ 'active-tab' => ( isset( $_POST['active-tab'] ) ? (int) $_POST['active-tab'] : 0 ),
461
+ );
462
+
463
+ if ( !$search_form ) {
464
+ $query['message'] = 'failed';
465
+ } elseif ( -1 == $id ) {
466
+ $query['message'] = 'created';
467
+ } else {
468
+ $query['message'] = 'saved';
469
+ }
470
+
471
+ }
472
+
473
+ $redirect_to = add_query_arg( $query, menu_page_url( 'ivory-search', false ) );
474
+ wp_safe_redirect( $redirect_to );
475
+ exit;
476
+ }
477
+
478
+
479
+ if ( 'reset' == $action ) {
480
+ $id = ( empty($_POST['post_ID']) ? absint( $_REQUEST['post'] ) : absint( $_POST['post_ID'] ) );
481
+ check_admin_referer( 'is-reset-search-form_' . $id );
482
+ if ( !current_user_can( 'is_edit_search_form', $id ) ) {
483
+ wp_die( __( 'You are not allowed to reset this item.', 'ivory-search' ) );
484
+ }
485
+ $query = array();
486
+
487
+ if ( $id ) {
488
+ $args['id'] = $id;
489
+ $args['title'] = ( isset( $_POST['post_title'] ) ? $_POST['post_title'] : null );
490
+ $args['_is_locale'] = null;
491
+ $args['_is_includes'] = '';
492
+ $args['_is_excludes'] = '';
493
+ $args['_is_settings'] = '';
494
+ $search_form = $this->save_form( $args );
495
+ $query['post'] = $id;
496
+ $query['active-tab'] = ( isset( $_POST['active-tab'] ) ? (int) $_POST['active-tab'] : 0 );
497
+ $query['message'] = 'reset';
498
+ }
499
+
500
+ $redirect_to = add_query_arg( $query, menu_page_url( 'ivory-search', false ) );
501
+ wp_safe_redirect( $redirect_to );
502
+ exit;
503
+ }
504
+
505
+
506
+ if ( 'copy' == $action ) {
507
+ $id = ( empty($_POST['post_ID']) ? absint( $_REQUEST['post'] ) : absint( $_POST['post_ID'] ) );
508
+ check_admin_referer( 'is-copy-search-form_' . $id );
509
+ if ( !current_user_can( 'is_edit_search_form', $id ) ) {
510
+ wp_die( __( 'You are not allowed to copy this item.', 'ivory-search' ) );
511
+ }
512
+ $query = array();
513
+
514
+ if ( $search_form = IS_Search_Form::get_instance( $id ) ) {
515
+ $new_search_form = $search_form->copy();
516
+ $new_search_form->save();
517
+ $query['post'] = $new_search_form->id();
518
+ $query['message'] = 'created';
519
+ }
520
+
521
+ $redirect_to = add_query_arg( $query, menu_page_url( 'ivory-search', false ) );
522
+ wp_safe_redirect( $redirect_to );
523
+ exit;
524
+ }
525
+
526
+
527
+ if ( 'delete' == $action ) {
528
+
529
+ if ( !empty($_POST['post_ID']) ) {
530
+ check_admin_referer( 'is-delete-search-form_' . $_POST['post_ID'] );
531
+ } else {
532
+
533
+ if ( !is_array( $_REQUEST['post'] ) ) {
534
+ check_admin_referer( 'is-delete-search-form_' . $_REQUEST['post'] );
535
+ } else {
536
+ check_admin_referer( 'bulk-posts' );
537
+ }
538
+
539
+ }
540
+
541
+ $posts = ( empty($_POST['post_ID']) ? (array) $_REQUEST['post'] : (array) $_POST['post_ID'] );
542
+ $deleted = 0;
543
+ foreach ( $posts as $post ) {
544
+ $post = IS_Search_Form::get_instance( $post );
545
+ if ( empty($post) ) {
546
+ continue;
547
+ }
548
+ if ( !current_user_can( 'is_delete_search_form', $post->id() ) ) {
549
+ wp_die( __( 'You are not allowed to delete this item.', 'ivory-search' ) );
550
+ }
551
+ if ( !$post->delete() ) {
552
+ wp_die( __( 'Error in deleting.', 'ivory-search' ) );
553
+ }
554
+ $deleted += 1;
555
+ }
556
+ $query = array();
557
+ if ( $deleted ) {
558
+ $query['message'] = 'deleted';
559
+ }
560
+ $redirect_to = add_query_arg( $query, menu_page_url( 'ivory-search', false ) );
561
+ wp_safe_redirect( $redirect_to );
562
+ exit;
563
+ }
564
+
565
+ $_GET['post'] = ( isset( $_GET['post'] ) ? $_GET['post'] : '' );
566
+ $post = null;
567
+
568
+ if ( 'ivory-search-new' == $plugin_page ) {
569
+ $post = IS_Search_Form::get_template( array(
570
+ 'locale' => ( isset( $_GET['locale'] ) ? $_GET['locale'] : null ),
571
+ ) );
572
+ } elseif ( !empty($_GET['post']) ) {
573
+ $post = IS_Search_Form::get_instance( $_GET['post'] );
574
+ }
575
+
576
+ $current_screen = get_current_screen();
577
+ $help_tabs = new IS_Help( $current_screen );
578
+
579
+ if ( $post && current_user_can( 'is_edit_search_form', $post->id() ) ) {
580
+ $help_tabs->set_help_tabs( 'edit' );
581
+ } else {
582
+ $help_tabs->set_help_tabs( 'list' );
583
+ add_filter( 'manage_' . $current_screen->id . '_columns', array( 'IS_List_Table', 'define_columns' ) );
584
+ add_screen_option( 'per_page', array(
585
+ 'default' => 20,
586
+ 'option' => 'is_search_forms_per_page',
587
+ ) );
588
+ }
589
+
590
+ }
591
+
592
+ /**
593
+ * Saves search form.
594
+ */
595
+ function save_form( $args = '', $context = 'save' )
596
+ {
597
+ $args = wp_parse_args( $args, array(
598
+ 'id' => -1,
599
+ 'title' => null,
600
+ '_is_locale' => null,
601
+ '_is_includes' => null,
602
+ '_is_excludes' => null,
603
+ '_is_settings' => null,
604
+ ) );
605
+ $args['id'] = (int) $args['id'];
606
+ $search_form = '';
607
+
608
+ if ( -1 == $args['id'] ) {
609
+ $search_form = IS_Search_Form::get_template();
610
+ } else {
611
+ $search_form = IS_Search_Form::get_instance( $args['id'] );
612
+ }
613
+
614
+ if ( empty($search_form) ) {
615
+ return false;
616
+ }
617
+ if ( null !== $args['title'] ) {
618
+ $search_form->set_title( $args['title'] );
619
+ }
620
+ if ( null !== $args['_is_locale'] ) {
621
+ $search_form->set_locale( $args['_is_locale'] );
622
+ }
623
+ $properties = $search_form->get_properties();
624
+ $properties['_is_includes'] = $this->sanitize_includes( $args['_is_includes'] );
625
+ $properties['_is_excludes'] = $this->sanitize_excludes( $args['_is_excludes'] );
626
+ $properties['_is_settings'] = $this->sanitize_settings( $args['_is_settings'] );
627
+ $search_form->set_properties( $properties );
628
+ do_action(
629
+ 'is_before_save_form',
630
+ $search_form,
631
+ $args,
632
+ $context
633
+ );
634
+ if ( 'save' == $context ) {
635
+ $search_form->save();
636
+ }
637
+ do_action(
638
+ 'is_after_save_form',
639
+ $search_form,
640
+ $args,
641
+ $context
642
+ );
643
+ return $search_form;
644
+ }
645
+
646
+ /**
647
+ * Sanitizes includes settings.
648
+ */
649
+ function sanitize_includes( $input, $defaults = array() )
650
+ {
651
+ if ( null === $input ) {
652
+ return $defaults;
653
+ }
654
+ $defaults = wp_parse_args( $defaults, array(
655
+ 'post_type' => array(
656
+ 'post' => 'post',
657
+ 'page' => 'page',
658
+ ),
659
+ ) );
660
+ $input = wp_parse_args( $input, $defaults );
661
+ $output = $this->sanitize_fields( $input );
662
+ return $output;
663
+ }
664
+
665
+ /**
666
+ * Sanitizes excludes settings.
667
+ */
668
+ function sanitize_excludes( $input, $defaults = '' )
669
+ {
670
+ if ( null === $input ) {
671
+ return $defaults;
672
+ }
673
+ $output = $this->sanitize_fields( $input );
674
+ return $output;
675
+ }
676
+
677
+ /**
678
+ * Sanitizes settings options.
679
+ */
680
+ function sanitize_settings( $input, $defaults = '' )
681
+ {
682
+ if ( null === $input ) {
683
+ return $defaults;
684
+ }
685
+ $output = $this->sanitize_fields( $input );
686
+ return $output;
687
+ }
688
+
689
+ /**
690
+ * Sanitizes fields.
691
+ */
692
+ function sanitize_fields( $input )
693
+ {
694
+ $output = array();
695
+ if ( is_array( $input ) && !empty($input) ) {
696
+ foreach ( $input as $key => $value ) {
697
+
698
+ if ( is_array( $value ) ) {
699
+ foreach ( $value as $key2 => $value2 ) {
700
+
701
+ if ( is_array( $value2 ) ) {
702
+ foreach ( $value2 as $key3 => $value3 ) {
703
+ $output[$key][$key2][$key3] = esc_attr( $input[$key][$key2][$key3] );
704
+ }
705
+ } else {
706
+ $output[$key][$key2] = esc_attr( $input[$key][$key2] );
707
+ }
708
+
709
+ }
710
+ } else {
711
+ $output[$key] = esc_attr( $input[$key] );
712
+ }
713
+
714
+ }
715
+ }
716
+ return $output;
717
+ }
718
+
719
+ /**
720
+ * Displays search form save button.
721
+ */
722
+ function save_button( $post_id )
723
+ {
724
+ static $button = '' ;
725
+
726
+ if ( !empty($button) ) {
727
+ echo $button ;
728
+ return;
729
+ }
730
+
731
+ $nonce = wp_create_nonce( 'is-save-search-form_' . $post_id );
732
+ $onclick = sprintf( "this.form._wpnonce.value = '%s';" . " this.form.action.value = 'save';" . " return true;", $nonce );
733
+ $button = sprintf( '<input type="submit" class="button-primary" name="is_save" value="%1$s" onclick="%2$s" />', esc_attr( __( 'Save Form', 'ivory-search' ) ), $onclick );
734
+ echo $button ;
735
+ }
736
+
737
+ /**
738
+ * Returns premium plugin version link.
739
+ */
740
+ public static function pro_link( $plan = 'pro' )
741
+ {
742
+ $is_premium_plugin = false;
743
+ $msg = esc_html__( "Upgrade To Access", 'ivory-search' );
744
+ if ( is_fs()->is_plan_or_trial( $plan ) ) {
745
+ $msg = esc_html__( "Install Pro Version To Access", 'ivory-search' );
746
+ }
747
+
748
+ if ( is_fs()->is_plan_or_trial( $plan ) && $is_premium_plugin ) {
749
+ return '';
750
+ } else {
751
+ return '<span class="upgrade-wrapper"><a class="upgrade-link" href="' . esc_url( menu_page_url( 'ivory-search-pricing', false ) ) . '"> ' . $msg . '</a></span>';
752
+ }
753
+
754
+ }
755
+
756
+ }
admin/class-is-editor.php CHANGED
@@ -1,979 +1,1454 @@
1
  <?php
2
 
3
- class IS_Search_Editor {
4
-
5
- private $search_form;
6
- private $panels = array();
7
-
8
- public function __construct( IS_Search_Form $search_form ) {
9
- $this->search_form = $search_form;
10
- }
11
-
12
- function is_name( $string ) {
13
- return preg_match( '/^[A-Za-z][-A-Za-z0-9_:.]*$/', $string );
14
- }
15
-
16
- public function add_panel( $id, $title, $callback ) {
17
- if ( $this->is_name( $id ) ) {
18
- $this->panels[$id] = array(
19
- 'title' => $title,
20
- 'callback' => $callback,
21
- );
22
- }
23
- }
24
-
25
- public function display() {
26
- if ( empty( $this->panels ) ) {
27
- return;
28
- }
29
-
30
- echo '<ul id="search-form-editor-tabs">';
31
-
32
- foreach ( $this->panels as $id => $panel ) {
33
- echo sprintf( '<li id="%1$s-tab"><a href="#%1$s">%2$s</a></li>',
34
- esc_attr( $id ), esc_html( $panel['title'] ) );
35
- }
36
-
37
- echo '</ul>';
38
-
39
- foreach ( $this->panels as $id => $panel ) {
40
- echo sprintf( '<div class="search-form-editor-panel" id="%1$s">',
41
- esc_attr( $id ) );
42
-
43
- $this->notice( $id, $panel );
44
- $callback = $panel['callback'];
45
- $this->$callback( $this->search_form );
46
-
47
- echo '</div>';
48
- }
49
- }
50
-
51
- public function notice( $id, $panel ) {
52
- echo '<div class="config-error"></div>';
53
- }
54
-
55
- /**
56
- * Gets all public meta keys of post types
57
- *
58
- * @global Object $wpdb WPDB object
59
- * @return Array array of meta keys
60
- */
61
- function is_meta_keys( $post_types ) {
62
- global $wpdb;
63
- $post_types = implode( "', '", $post_types );
64
- $is_fields = $wpdb->get_results( apply_filters( 'is_meta_keys_query', "select DISTINCT meta_key from $wpdb->postmeta pt LEFT JOIN $wpdb->posts p ON (pt.post_id = p.ID) where meta_key NOT LIKE '\_%' AND post_type IN ( '$post_types' ) ORDER BY meta_key ASC" ) );
65
- $meta_keys = array();
66
-
67
- if ( is_array( $is_fields ) && ! empty( $is_fields ) ) {
68
- foreach ( $is_fields as $field ) {
69
- if ( isset( $field->meta_key ) ) {
70
- $meta_keys[] = $field->meta_key;
71
- }
72
- }
73
- }
74
-
75
- /**
76
- * Filter results of SQL query for meta keys
77
- */
78
- return apply_filters( 'is_meta_keys', $meta_keys );
79
- }
80
-
81
- public function includes_panel( $post ) {
82
- $id = '_is_includes';
83
- $includes = $post->prop( $id );
84
- $settings = $post->prop( '_is_settings' );
85
- $excludes = $post->prop( '_is_excludes' );
86
- ?>
87
  <h4 class="panel-desc">
88
- <?php
89
- _e( "Configure the below options to make specific content searchable.", 'ivory-search' );
90
- ?>
91
  </h4>
92
- <div class="search-form-editor-box" id="<?php echo $id; ?>">
 
 
93
 
94
  <div class="form-table">
95
 
96
  <h3 scope="row">
97
- <label for="<?php echo $id; ?>-post_type"><?php esc_html_e( 'Post Types', 'ivory-search' ); ?></label>
98
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span>
 
 
 
 
 
 
 
 
 
 
99
  </h3>
100
  <div>
101
- <?php
102
-
103
- $content = __( 'Select post types that you want to make searchable.', 'ivory-search' );
104
- IS_Help::help_info( $content );
105
- echo '<div>';
106
- $args = array( 'public' => true );
107
-
108
- if ( isset( $settings['exclude_from_search'] ) ) {
109
- $args = array( 'public' => true, 'exclude_from_search' => false );
110
- }
111
- $posts = get_post_types( $args );
112
-
113
- if ( ! empty( $posts ) ){
114
- foreach ( $posts as $key => $post_type ) {
115
- $checked = isset( $includes['post_type'][ esc_attr( $key )] ) ? $includes['post_type'][ esc_attr( $key )] : 0;
116
-
117
- echo '<div class="col-wrapper check-radio">';
118
- echo '<label for="'. $id . '-post_type-' . esc_attr( $key ) . '"> ';
119
- echo '<input type="checkbox" id="'. $id . '-post_type-' . esc_attr( $key ) . '" name="'. $id . '[post_type][' . esc_attr( $key ) . ']" value="' . esc_attr( $key ) . '" ' . checked( $key, $checked, false ) . '/>';
120
- echo '<span class="toggle-check-text"></span>';
121
- echo ucfirst( esc_html( $post_type ) ) . '</label></div>';
122
- }
123
- $checked = ( isset( $includes['search_title'] ) && $includes['search_title'] ) ? 1 : 0;
124
- echo '<br /><p class="check-radio"><label for="'. $id . '-search_title"><input type="checkbox" id="'. $id . '-search_title" name="'. $id . '[search_title]" value="1" ' . checked( 1, $checked, false ) . '/>';
125
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Search in post title.", 'ivory-search' ) . '</label></p>';
126
- $checked = ( isset( $includes['search_content'] ) && $includes['search_content'] ) ? 1 : 0;
127
- echo '<p class="check-radio"><label for="'. $id . '-search_content"><input type="checkbox" id="'. $id . '-search_content" name="'. $id . '[search_content]" value="1" ' . checked( 1, $checked, false ) . '/>';
128
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Search in post content.", 'ivory-search' ) . '</label></p>';
129
- $checked = ( isset( $includes['search_excerpt'] ) && $includes['search_excerpt'] ) ? 1 : 0;
130
- echo '<p class="check-radio"><label for="'. $id . '-search_excerpt"><input type="checkbox" id="'. $id . '-search_excerpt" name="'. $id . '[search_excerpt]" value="1" ' . checked( 1, $checked, false ) . '/>';
131
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Search in post excerpt.", 'ivory-search' ) . '</label></p>';
132
- echo '<br /><select name="'. $id . '[post_type_qs]" >';
133
- $checked = isset( $includes['post_type_qs'] ) ? $includes['post_type_qs'] : 'none';
134
- echo '<option value="none" ' . selected( 'none', $checked, false ) . '>' . esc_html( __( 'None', 'ivory-search' ) ) . '</option>';
135
- foreach ( $posts as $key => $post_type ) {
136
- echo '<option value="' . $key . '" ' . selected( $key, $checked, false ) . '>' . ucfirst( esc_html( $post_type ) ) . '</option>';
137
- }
138
- echo '</select><label for="'. $id . '-post_type_qs"> ' . esc_html( __( 'Display this post type in the search query URL and restrict search to it.', 'ivory-search' ) ) . '</label>';
139
- } else {
140
- _e( 'No post types registered on your site.', 'ivory-search' );
141
- }
142
-
143
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  </div></div>
145
 
146
 
147
 
148
  <h3 scope="row">
149
- <label for="<?php echo $id; ?>-tax_query"><?php esc_html_e( 'Taxonomy Terms', 'ivory-search' ); ?></label>
150
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
151
  <div>
152
- <?php
153
-
154
- $content = __( 'Taxonomy terms that have no posts will not be visible below. Add a post with the taxonomy you want for it to be configurable.', 'ivory-search' );
155
- $content .= '<br /><br />' . __( 'Terms selected here will restrict the search to posts that have the selected terms.', 'ivory-search' );
156
- $content .= '<br />' .__( 'Taxonomy terms selected display in BOLD', 'ivory-search' );
157
- IS_Help::help_info( $content );
158
- echo '<div>';
159
- $args = array( 'post', 'page' );
160
-
161
- if ( isset( $includes['post_type'] ) && ! empty( $includes['post_type'] ) && is_array( $includes['post_type'] ) ) {
162
- $args = array_values( $includes['post_type'] );
163
- }
164
-
165
- $tax_objs = get_object_taxonomies( $args, 'objects' );
166
-
167
- if ( ! empty( $tax_objs ) ){
168
- foreach ( $tax_objs as $key => $tax_obj ) {
169
-
170
- $terms = get_terms( array(
171
- 'taxonomy' => $key,
172
- 'hide_empty' => false,
173
- ) );
174
-
175
- if ( ! empty( $terms ) ){
176
-
177
- echo '<div class="col-wrapper"><div class="col-title">';
178
- $col_title = ucwords( str_replace( '-', ' ', str_replace( '_', ' ', esc_html( $key ) ) ) );
179
- if ( isset( $includes['tax_query'][$key] ) ) {
180
- $col_title = '<strong>' . $col_title . '</strong>';
181
- }
182
- echo $col_title . '<input class="list-search" placeholder="'. __( "Search..", 'ivory-search' ) . '" type="text"></div><input type="hidden" id="'. $id . '-tax_post_type" name="'. $id . '[tax_post_type]['.$key.']" value="'. implode( ',', $tax_obj->object_type ) .'" />';
183
- echo '<select name="'. $id . '[tax_query]['.$key.'][]" multiple size="8" >';
184
- foreach ( $terms as $key2 => $term ) {
185
- $checked = ( isset( $includes['tax_query'][$key] ) && in_array( $term->term_taxonomy_id, $includes['tax_query'][$key] ) ) ? $term->term_taxonomy_id : 0;
186
- echo '<option value="' . esc_attr( $term->term_taxonomy_id ) . '" ' . selected( $term->term_taxonomy_id, $checked, false ) . '>' . esc_html( $term->name ) . '</option>';
187
- }
188
- echo '</select></div>';
189
- }
190
- }
191
- echo '<br /><label for="'. $id . '-tax_query" style="font-size: 10px;clear:both;display:block;">' . esc_html__( "Press CTRL key to select multiple terms or deselect them.", 'ivory-search' ) . '</label>';
192
-
193
- $checked = ( isset( $includes['tax_rel'] ) && "OR" == $includes['tax_rel'] ) ? "OR" : "AND";
194
- echo '<br /><p class="check-radio"><label for="'. $id . '-tax_rel_and" ><input type="radio" id="'. $id . '-tax_rel_and" name="'. $id . '[tax_rel]" value="AND" ' . checked( 'AND', $checked, false ) . '/>';
195
- echo '<span class="toggle-check-text"></span>' . esc_html__( "AND - Search posts having all the above selected terms.", 'ivory-search' ) . '</label></p>';
196
- echo '<p class="check-radio"><label for="'. $id . '-tax_rel_or" ><input type="radio" id="'. $id . '-tax_rel_or" name="'. $id . '[tax_rel]" value="OR" ' . checked( 'OR', $checked, false ) . '/>';
197
- echo '<span class="toggle-check-text"></span>' . esc_html__( "OR - Search posts having any one of the above selected terms.", 'ivory-search' ) . '</label></p>';
198
- $checked = ( isset( $includes['search_tax_title'] ) && $includes['search_tax_title'] ) ? 1 : 0;
199
- echo '<br /><p class="check-radio"><label for="'. $id . '-search_tax_title" ><input type="checkbox" id="'. $id . '-search_tax_title" name="'. $id . '[search_tax_title]" value="1" ' . checked( 1, $checked, false ) . '/>';
200
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Search in taxonomy terms title.", 'ivory-search' ) . '</label></p>';
201
- $checked = ( isset( $includes['search_tax_desp'] ) && $includes['search_tax_desp'] ) ? 1 : 0;
202
- echo '<p class="check-radio"><label for="'. $id . '-search_tax_desp" ><input type="checkbox" id="'. $id . '-search_tax_desp" name="'. $id . '[search_tax_desp]" value="1" ' . checked( 1, $checked, false ) . '/>';
203
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Search in taxonomy terms description.", 'ivory-search' ) . '</label></p>';
204
- } else {
205
- _e( 'No taxonomies registered for slected post types.', 'ivory-search' );
206
- }
207
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
208
  </div></div>
209
 
210
 
211
  <h3 scope="row">
212
- <label for="<?php echo $id; ?>-custom_field"><?php echo esc_html( __( 'Custom Fields', 'ivory-search' ) ); ?></label>
213
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
214
  <div>
215
- <?php
216
- $content = __( 'Select custom fields to make their values searchable.', 'ivory-search' );
217
- IS_Help::help_info( $content );
218
- echo '<div>';
219
- $args = array( 'post', 'page' );
220
-
221
- if ( isset( $includes['post_type'] ) && ! empty( $includes['post_type'] ) && is_array( $includes['post_type'] ) ) {
222
- $args = array_values( $includes['post_type'] );
223
- }
224
- $meta_keys = $this->is_meta_keys( $args );
225
- if ( ! empty( $meta_keys ) ) {
226
- echo '<input class="list-search wide" placeholder="'. __( "Search..", 'ivory-search' ) . '" type="text">';
227
- echo '<select name="'. $id . '[custom_field][]" multiple size="8" >';
228
- foreach ( $meta_keys as $meta_key ) {
229
- $checked = ( isset( $includes['custom_field'] ) && in_array( $meta_key, $includes['custom_field'] ) ) ? $meta_key : 0;
230
- echo '<option value="' . esc_attr( $meta_key ) . '" ' . selected( $meta_key, $checked, false ) . '>' . esc_html( $meta_key ) . '</option>';
231
- }
232
- echo '</select>';
233
- echo '<br /><label for="'. $id . '-custom_field" style="font-size: 10px;clear:both;display:block;">' . esc_html__( "Press CTRL key to select multiple terms or deselect them.", 'ivory-search' ) . '</label>';
234
- }
235
-
236
- if ( isset( $includes['custom_field'] ) ) {
237
- echo '<br />' . __( 'Selected Custom Fields :', 'ivory-search' );
238
- foreach ( $includes['custom_field'] as $custom_field ) {
239
- echo '<br /><span style="font-size: 11px;">' . $custom_field . '</span>';
240
- }
241
- }
242
- ?>
 
 
 
243
  </div></div>
244
 
245
 
246
  <h3 scope="row">
247
- <label for="<?php echo $id; ?>-woocommerce"><?php echo esc_html( __( 'WooCommerce', 'ivory-search' ) ); ?></label>
248
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
249
  <div>
250
- <?php
251
- $content = __( 'Configure WooCommerce products search options here.', 'ivory-search' );
252
- IS_Help::help_info( $content );
253
- echo '<div>';
254
- $args = array( 'post', 'page' );
255
-
256
- if ( isset( $includes['post_type'] ) && ! empty( $includes['post_type'] ) && is_array( $includes['post_type'] ) ) {
257
- $args = array_values( $includes['post_type'] );
258
- }
259
- if ( in_array( 'product', $args ) ) {
260
- $woo_sku_disable = is_fs()->is_plan_or_trial( 'pro_plus' ) ? '' : ' disabled ';
261
- $checked = ( isset( $includes['woo']['sku'] ) && $includes['woo']['sku'] ) ? 1 : 0;
262
- echo '<p class="check-radio"><label for="'. $id . '-sku" ><input type="checkbox" ' . $woo_sku_disable . ' id="'. $id . '-sku" name="'. $id . '[woo][sku]" value="1" ' . checked( 1, $checked, false ) . '/>';
263
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Search in WooCommerce products SKU.", 'ivory-search' ) . '</label>';
264
- echo IS_Admin::pro_link( 'pro_plus' ) . '</p>';
265
- } else {
266
- _e( 'WooCommerce product post type is not included in search.', 'ivory-search' );
267
- }
268
- ?>
 
 
 
 
269
  </div></div>
270
 
271
 
272
  <h3 scope="row">
273
- <label for="<?php echo $id; ?>-author"><?php echo esc_html( __( 'Authors', 'ivory-search' ) ); ?></label>
274
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
275
  <div>
276
- <?php
277
- $content = __( 'Make specific author posts searchable.', 'ivory-search' );
278
- IS_Help::help_info( $content );
279
- echo '<div>';
280
- if ( ! isset( $excludes['author'] ) ) {
281
- $author_disable = is_fs()->is_plan_or_trial( 'pro' ) ? '' : ' disabled ';
282
-
283
- $authors = get_users( array(
284
- 'fields' => array( 'ID', 'display_name' ),
285
- 'orderby' => 'post_count',
286
- 'order' => 'DESC',
287
- 'who' => 'authors',
288
- ) );
289
-
290
- if ( ! empty( $authors ) ) {
291
- if ( '' !== $author_disable ) {
292
- echo '<div class="upgrade-parent">' . IS_Admin::pro_link();
293
- }
294
- foreach ( $authors as $author ) {
295
-
296
- $post_count = count_user_posts( $author->ID );
297
-
298
- // Move on if user has not published a post (yet).
299
- if ( ! $post_count ) {
300
- continue;
301
- }
302
-
303
- $checked = isset( $includes['author'][ esc_attr( $author->ID )] ) ? $includes['author'][ esc_attr( $author->ID )] : 0;
304
-
305
- echo '<div class="col-wrapper check-radio"><label for="'. $id . '-author-' . esc_attr( $author->ID ) . '"><input type="checkbox" ' . $author_disable . ' id="'. $id . '-author-' . esc_attr( $author->ID ) . '" name="'. $id . '[author][' . esc_attr( $author->ID ) . ']" value="' . esc_attr( $author->ID ) . '" ' . checked( $author->ID, $checked, false ) . '/>';
306
- echo '<span class="toggle-check-text"></span> ' . ucfirst( esc_html( $author->display_name ) ) . '</label></div>';
307
- }
308
- }
309
- } else {
310
- echo '<label>' . esc_html__( "Search has been already limited by excluding specific authors posts in the Excludes section.", 'ivory-search' ) . '</label>';
311
- }
312
-
313
- if ( '' !== $author_disable ) {
314
- echo '</div>';
315
- }
316
- $checked = ( isset( $includes['search_author'] ) && $includes['search_author'] ) ? 1 : 0;
317
- echo '<br /><br /><p class="check-radio"><label for="'. $id . '-search_author" ><input type="checkbox" id="'. $id . '-search_author" name="'. $id . '[search_author]" value="1" ' . checked( 1, $checked, false ) . '/>';
318
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Search in author Display name and display the posts created by that author.", 'ivory-search' ) . '</label></p>';
319
- ?>
320
  </div></div>
321
 
322
  <h3 scope="row">
323
- <label for="<?php echo $id; ?>-post_status"><?php echo esc_html( __( 'Post Status', 'ivory-search' ) ); ?></label>
324
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
325
  <div>
326
- <?php
327
- $content = __( 'Configure options to search posts having specific post statuses.', 'ivory-search' );
328
- IS_Help::help_info( $content );
329
- echo '<div>';
330
- if ( ! isset( $excludes['post_status'] ) ) {
331
- $post_statuses = get_post_stati();
332
-
333
- $post_status_disable = is_fs()->is_plan_or_trial( 'pro' ) ? '' : ' disabled ';
334
-
335
- if ( ! empty( $post_statuses ) ) {
336
- if ( '' !== $post_status_disable ) {
337
- echo IS_Admin::pro_link();
338
- }
339
- foreach ( $post_statuses as $key => $post_status ) {
340
-
341
- $checked = isset( $includes['post_status'][ esc_attr( $key )] ) ? $includes['post_status'][ esc_attr( $key )] : 0;
342
-
343
- echo '<div class="col-wrapper check-radio"><label for="'. $id . '-post_status-' . esc_attr( $key ) . '"><input type="checkbox" ' . $post_status_disable . ' id="'. $id . '-post_status-' . esc_attr( $key ) . '" name="'. $id . '[post_status][' . esc_attr( $key ) . ']" value="' . esc_attr( $key ) . '" ' . checked( $key, $checked, false ) . '/>';
344
- echo '<span class="toggle-check-text"></span> ' . ucwords( str_replace( '-', ' ', esc_html( $post_status ) ) ) . '</label></div>';
345
- }
346
- }
347
- } else {
348
- echo '<label>' . esc_html__( "Search has been already limited by excluding specific posts statuses from search in the Excludes section.", 'ivory-search' ) . '</label>';
349
- }
350
- ?>
 
 
 
351
  </div></div>
352
 
353
 
354
  <h3 scope="row">
355
- <label for="<?php echo $id; ?>-comment_count"><?php echo esc_html( __( 'Comments', 'ivory-search' ) ); ?></label>
356
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
357
  <div>
358
- <?php
359
- $content = __( 'Make posts searchable that have a specific number of comments.', 'ivory-search' );
360
- IS_Help::help_info( $content );
361
- echo '<div>';
362
- $comment_count_disable = is_fs()->is_plan_or_trial( 'pro' ) ? '' : ' disabled ';
363
- if ( '' !== $comment_count_disable ) {
364
- echo '<div class="upgrade-parent">' . IS_Admin::pro_link();
365
- }
366
- echo '<select name="'. $id . '[comment_count][compare]" ' . $comment_count_disable . ' style="min-width: 50px;">';
367
- $checked = isset( $includes['comment_count']['compare'] ) ? htmlspecialchars_decode( $includes['comment_count']['compare'] ) : '=';
368
- $compare = array( '=', '!=', '>', '>=', '<', '<=' );
369
- foreach ( $compare as $d ) {
370
- echo '<option value="' . htmlspecialchars_decode( $d ) . '" ' . selected( $d, $checked, false ) . '>' . esc_html( $d ) . '</option>';
371
- }
372
- echo '</select><label for="'. $id . '-comment_count-compare"> ' . esc_html( __( 'The search operator to compare comments count.', 'ivory-search' ) ) . '</label>';
373
-
374
- echo '<br /><select name="'. $id . '[comment_count][value]" ' . $comment_count_disable . ' >';
375
- $checked = isset( $includes['comment_count']['value'] ) ? $includes['comment_count']['value'] : 'na';
376
- echo '<option value="na" ' . selected( 'na', $checked, false ) . '>' . esc_html( __( 'NA', 'ivory-search' ) ) . '</option>';
377
- for ( $d = 0; $d <= 999; $d++ ) {
378
- echo '<option value="' . $d . '" ' . selected( $d, $checked, false ) . '>' . $d . '</option>';
379
- }
380
- echo '</select><label for="'. $id . '-comment_count-value"> ' . esc_html( __( 'The amount of comments your posts has to have.', 'ivory-search' ) ) . '</label>';
381
- if ( '' !== $comment_count_disable ) {
382
- echo '</div>';
383
- }
384
-
385
- $checked = ( isset( $includes['search_comment'] ) && $includes['search_comment'] ) ? 1 : 0;
386
- echo '<br /><br /><p class="check-radio"><label for="'. $id . '-search_comment" ><input type="checkbox" id="'. $id . '-search_comment" name="'. $id . '[search_comment]" value="1" ' . checked( 1, $checked, false ) . '/>';
387
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Search in approved comments content.", 'ivory-search' ) . '</label></p>';
388
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  </div></div>
390
 
391
 
392
  <h3 scope="row">
393
- <label for="<?php echo $id; ?>-date_query"><?php echo esc_html( __( 'Date', 'ivory-search' ) ); ?></label>
394
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
395
  <div>
396
- <?php
397
- $content = __( 'Make posts searchable that were created in the specified data range.', 'ivory-search' );
398
- IS_Help::help_info( $content );
399
- echo '<div>';
400
- $range = array( 'after', 'before' );
401
- foreach ( $range as $value ) {
402
- echo '<div class="col-wrapper ' . $value . '"><div class="col-title">' . ucfirst( $value ) . '</div>';
403
-
404
- echo '<select name="'. $id . '[date_query]['.$value.'][day]" >';
405
- $checked = isset( $includes['date_query'][$value]['day'] ) ? $includes['date_query'][$value]['day'] : 'day';
406
- echo '<option value="day" ' . selected( 'day', $checked, false ) . '>' . esc_html( __( 'Day', 'ivory-search' ) ) . '</option>';
407
- for ( $d = 1; $d <= 31; $d++ ) {
408
- echo '<option value="' . $d . '" ' . selected( $d, $checked, false ) . '>' . $d . '</option>';
409
- }
410
- echo '</select>';
411
-
412
- echo '<select name="'. $id . '[date_query]['.$value.'][month]" >';
413
- $checked = isset( $includes['date_query'][$value]['month'] ) ? $includes['date_query'][$value]['month'] : 'month';
414
- echo '<option value="month" ' . selected( 'month', $checked, false ) . '>' . esc_html( __( 'Month', 'ivory-search' ) ) . '</option>';
415
- for ( $m = 1; $m <= 12; $m++ ) {
416
- echo '<option value="' . $m . '" ' . selected( $m, $checked, false ) . '>' . date( 'F', mktime( 0, 0, 0, $m, 1 ) ) . '</option>';
417
- }
418
- echo '</select>';
419
-
420
- echo '<select name="'. $id . '[date_query]['.$value.'][year]" >';
421
- $checked = isset( $includes['date_query'][$value]['year'] ) ? $includes['date_query'][$value]['year'] : 'year';
422
- echo '<option value="year" ' . selected( 'year', $checked, false ) . '>' . esc_html( __( 'Year', 'ivory-search' ) ) . '</option>';
423
- for ( $y = date("Y"); $y >= 1995; $y-- ) {
424
- echo '<option value="' . $y . '" ' . selected( $y, $checked, false ) . '>' . $y . '</option>';
425
- }
426
- echo '</select></div>';
427
- }
428
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
429
  </div></div>
430
 
431
 
432
  <h3 scope="row">
433
- <label for="<?php echo $id; ?>-has_password"><?php echo esc_html( __( 'Password', 'ivory-search' ) ); ?></label>
434
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
435
  <div>
436
- <?php
437
- $content = __( 'Configure options to search posts with or without password.', 'ivory-search' );
438
- IS_Help::help_info( $content );
439
- echo '<div>';
440
- $checked = ( isset( $includes['has_password'] ) ) ? $includes['has_password'] : 'null';
441
- echo '<p class="check-radio"><label for="'. $id . '-has_password" ><input type="radio" id="'. $id . '-has_password" name="'. $id . '[has_password]" value="null" ' . checked( 'null', $checked, false ) . '/>';
442
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Search all posts with and without passwords.", 'ivory-search' ) . '</label></p>';
443
- echo '<p class="check-radio"><label for="'. $id . '-has_password_1" ><input type="radio" id="'. $id . '-has_password_1" name="'. $id . '[has_password]" value="1" ' . checked( 1, $checked, false ) . '/>';
444
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Search only posts with passwords.", 'ivory-search' ) . '</label></p>';
445
- echo '<p class="check-radio"><label for="'. $id . '-has_password_0" ><input type="radio" id="'. $id . '-has_password_0" name="'. $id . '[has_password]" value="0" ' . checked( 0, $checked, false ) . '/>';
446
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Search only posts without passwords.", 'ivory-search' ) . '</label></p>';
447
- ?>
 
 
 
448
  </div></div>
449
 
450
- <?php
451
- global $wp_version;
452
- if ( 4.9 <= $wp_version ) {
453
- ?>
 
454
 
455
  <h3 scope="row">
456
- <label for="<?php echo $id; ?>-post_file_type"><?php echo esc_html( __( 'File Types', 'ivory-search' ) ); ?></label>
457
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
458
  <div>
459
- <?php
460
- $content = __( 'Configure searching to search based on posts that have a specific MIME type or files that have specific media attachments', 'ivory-search' );
461
- IS_Help::help_info( $content );
462
- echo '<div>';
463
- if ( ! isset( $excludes['post_file_type'] ) ) {
464
- $file_types = get_allowed_mime_types();
465
- if ( ! empty( $file_types ) ) {
466
- $file_type_disable = is_fs()->is_plan_or_trial( 'pro_plus' ) ? '' : ' disabled ';
467
- ksort($file_types);
468
- echo '<input class="list-search wide" placeholder="'. __( "Search..", 'ivory-search' ) . '" type="text">';
469
- echo '<select name="'. $id . '[post_file_type][]" ' . $file_type_disable . ' multiple size="8" >';
470
- foreach ( $file_types as $key => $file_type ) {
471
- $checked = ( isset( $includes['post_file_type'] ) && in_array( $file_type, $includes['post_file_type'] ) ) ? $file_type : 0;
472
- echo '<option value="' . esc_attr( $file_type ) . '" ' . selected( $file_type, $checked, false ) . '>' . esc_html( $key ) . '</option>';
473
- }
474
- echo '</select>';
475
- echo IS_Admin::pro_link( 'pro_plus' );
476
- echo '<br /><br /><label for="'. $id . '-post_file_type" style="font-size: 10px;clear:both;display:block;">' . esc_html__( "Press CTRL key to select multiple terms or deselect them.", 'ivory-search' ) . '</label>';
477
- }
478
- } else {
479
- echo '<label>' . esc_html__( "Search has been already limited by excluding specific File type in the Excludes section.", 'ivory-search' ) . '</label>';
480
- }
481
-
482
- if ( isset( $includes['post_file_type'] ) ) {
483
- echo '<br />' . __( 'Selected File Types :', 'ivory-search' );
484
- foreach ( $includes['post_file_type'] as $post_file_type ) {
485
- echo '<br /><span style="font-size: 11px;">' . $post_file_type . '</span>';
486
- }
487
- }
488
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
489
  </div></div>
490
 
491
- <?php
492
- }
493
- ?>
 
494
  </div>
495
 
496
  </div>
497
 
498
- <?php
499
- }
500
-
501
- public function excludes_panel( $post ) {
502
- $id = '_is_excludes';
503
- $excludes = $post->prop( $id );
504
- $includes = $post->prop( '_is_includes' );
505
- ?>
 
506
  <h4 class="panel-desc">
507
- <?php
508
- _e( "Configure the options to exclude specific content from search.", 'ivory-search' );
509
- ?>
510
  </h4>
511
- <div class="search-form-editor-box" id="<?php echo $id; ?>">
 
 
512
  <div class="form-table">
513
 
514
  <h3 scope="row">
515
- <label for="<?php echo $id; ?>-post__not_in"><?php echo esc_html( __( 'Posts', 'ivory-search' ) ); ?></label>
516
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
517
  <div>
518
- <?php
519
- $content = __( 'The posts and pages of searchable post types display here.', 'ivory-search' );
520
- $content .= '<br />' . __( 'Select the posts you wish to exclude from the search.', 'ivory-search' );
521
- $content .= '<br />' . __( 'Selected post types display in BOLD.', 'ivory-search' );
522
- IS_Help::help_info( $content );
523
- echo '<div>';
524
- $post_types = array( 'post', 'page' );
525
-
526
- if ( isset( $includes['post_type'] ) && ! empty( $includes['post_type'] ) && is_array( $includes['post_type'] ) ) {
527
- $post_types = array_values( $includes['post_type'] );
528
- }
529
-
530
- foreach ( $post_types as $post_type ) {
531
-
532
- $posts = get_posts( array(
533
- 'post_type' => $post_type,
534
- 'posts_per_page'=> -1,
535
- 'orderby' => 'title',
536
- 'order' => 'ASC',
537
- ) );
538
-
539
- if ( ! empty( $posts ) ) {
540
- $html = '<div class="col-wrapper"><div class="col-title">';
541
- $col_title = ucwords( $post_type );
542
- $temp = '';
543
- $selected_pt = array();
544
- foreach ( $posts as $post2 ) {
545
- $checked = ( isset( $excludes['post__not_in'] ) && in_array( $post2->ID, $excludes['post__not_in'] ) ) ? $post2->ID : 0;
546
- if ( $checked ) {
547
- array_push( $selected_pt, $post_type );
548
- }
549
- $post_title = ( isset( $post2->post_title ) && '' !== $post2->post_title ) ? esc_html( $post2->post_title ) : $post2->post_name;
550
- $temp .= '<option value="' . esc_attr( $post2->ID ) . '" ' . selected( $post2->ID, $checked, false ) . '>' . $post_title . '</option>';
551
- }
552
- if ( ! empty( $selected_pt ) && in_array( $post_type, $selected_pt) ) {
553
- $col_title = '<strong>' . $col_title . '</strong>';
554
- }
555
- $html .= $col_title . '<input class="list-search" placeholder="'. __( "Search..", 'ivory-search' ) . '" type="text"></div>';
556
- $html .= '<select name="'. $id . '[post__not_in][]" multiple size="8" >';
557
- $html .= $temp . '</select></div>';
558
- echo $html;
559
- }
560
- }
561
- echo '<br /><label for="'. $id . '-post__not_in" style="font-size: 10px;clear:both;display:block;">' . esc_html__( "Press CTRL key to select multiple terms or deselect them.", 'ivory-search' ) . '</label>';
562
- ?>
 
563
  </div></div>
564
 
565
  <h3 scope="row">
566
- <label for="<?php echo $id; ?>-tax_query"><?php esc_html_e( 'Taxonomy Terms', 'ivory-search' ); ?></label>
567
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
568
  <div>
569
- <?php
570
- $content = __( 'The taxonomies and terms attached to searchable post types display here.', 'ivory-search' );
571
- $content .= '<br />' . __( 'Exclude posts from search results that have specific terms', 'ivory-search' );
572
- $content .= '<br />' . __( 'Selected terms taxonomy title display in BOLD.', 'ivory-search' );
573
- IS_Help::help_info( $content );
574
- echo '<div>';
575
- $tax_objs = get_object_taxonomies( $post_types, 'objects' );
576
-
577
- if ( ! empty( $tax_objs ) ) {
578
- foreach ( $tax_objs as $key => $tax_obj ) {
579
-
580
- $terms = get_terms( array(
581
- 'taxonomy' => $key,
582
- 'hide_empty' => false,
583
- ) );
584
-
585
- if ( ! empty( $terms ) ){
586
- echo '<div class="col-wrapper"><div class="col-title">';
587
- $col_title = ucwords( str_replace( '-', ' ', str_replace( '_', ' ', esc_html( $key ) ) ) );
588
- if ( isset( $excludes['tax_query'][$key] ) ) {
589
- $col_title = '<strong>' . $col_title . '</strong>';
590
- }
591
- echo $col_title . '<input class="list-search" placeholder="'. __( "Search..", 'ivory-search' ) . '" type="text"></div><select name="'. $id . '[tax_query]['.$key.'][]" multiple size="8" >';
592
- foreach ( $terms as $key2 => $term ) {
593
-
594
- $checked = ( isset( $excludes['tax_query'][$key] ) && in_array( $term->term_taxonomy_id, $excludes['tax_query'][$key] ) ) ? $term->term_taxonomy_id : 0;
595
- echo '<option value="' . esc_attr( $term->term_taxonomy_id ) . '" ' . selected( $term->term_taxonomy_id, $checked, false ) . '>' . esc_html( $term->name ) . '</option>';
596
- }
597
- echo '</select></div>';
598
- }
599
- }
600
- echo '<br /><label for="'. $id . '-tax_query" style="font-size: 10px;clear:both;display:block;">' . esc_html__( "Press CTRL key to select multiple terms or deselect them.", 'ivory-search' ) . '</label>';
601
- } else {
602
- _e( 'No taxonomies registered for slected post types.', 'ivory-search' );
603
- }
604
- ?>
 
 
 
605
  </div></div>
606
 
607
 
608
  <h3 scope="row">
609
- <label for="<?php echo $id; ?>-custom_field"><?php echo esc_html( __( 'Custom Fields', 'ivory-search' ) ); ?></label>
610
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
611
  <div>
612
- <?php
613
- $content = __( 'Exclude posts from the search having selected custom fields.', 'ivory-search' );
614
- IS_Help::help_info( $content );
615
- echo '<div>';
616
- $args = array( 'post', 'page' );
617
-
618
- if ( isset( $excludes['post_type'] ) && ! empty( $excludes['post_type'] ) && is_array( $excludes['post_type'] ) ) {
619
- $args = array_values( $excludes['post_type'] );
620
- }
621
- $meta_keys = $this->is_meta_keys( $args );
622
- if ( ! empty( $meta_keys ) ) {
623
- $custom_field_disable = is_fs()->is_plan_or_trial( 'pro' ) ? '' : ' disabled ';
624
- echo '<input class="list-search wide" placeholder="'. __( "Search..", 'ivory-search' ) . '" type="text">';
625
- echo '<select name="'. $id . '[custom_field][]" ' . $custom_field_disable . ' multiple size="8" >';
626
- foreach ( $meta_keys as $meta_key ) {
627
- $checked = ( isset( $excludes['custom_field'] ) && in_array( $meta_key, $excludes['custom_field'] ) ) ? $meta_key : 0;
628
- echo '<option value="' . esc_attr( $meta_key ) . '" ' . selected( $meta_key, $checked, false ) . '>' . esc_html( $meta_key ) . '</option>';
629
- }
630
- echo '</select>';
631
- echo IS_Admin::pro_link();
632
- echo '<br /><br /><label for="'. $id . '-custom_field" style="font-size: 10px;clear:both;display:block;">' . esc_html__( "Press CTRL key to select multiple terms or deselect them.", 'ivory-search' ) . '</label>';
633
- }
634
-
635
- if ( isset( $excludes['custom_field'] ) ) {
636
- echo '<br />' . __( 'Excluded Custom Fields :', 'ivory-search' );
637
- foreach ( $excludes['custom_field'] as $custom_field ) {
638
- echo '<br /><span style="font-size: 11px;">' . $custom_field . '</span>';
639
- }
640
- }
641
- ?>
 
 
 
642
  </div></div>
643
 
644
 
645
  <h3 scope="row">
646
- <label for="<?php echo $id; ?>-woocommerce"><?php echo esc_html( __( 'WooCommerce', 'ivory-search' ) ); ?></label>
647
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
648
  <div>
649
- <?php
650
- $content = __( 'Exclude specific WooCommerce products from the search.', 'ivory-search' );
651
- IS_Help::help_info( $content );
652
- echo '<div>';
653
- $args = array( 'post', 'page' );
654
-
655
- if ( isset( $includes['post_type'] ) && ! empty( $includes['post_type'] ) && is_array( $includes['post_type'] ) ) {
656
- $args = array_values( $includes['post_type'] );
657
- }
658
- if ( in_array( 'product', $args ) ) {
659
- $outofstock_disable = is_fs()->is_plan_or_trial( 'pro_plus' ) ? '' : ' disabled ';
660
- $checked = ( isset( $excludes['woo']['outofstock'] ) && $excludes['woo']['outofstock'] ) ? 1 : 0;
661
- echo '<p class="check-radio"><label for="'. $id . '-outofstock" ><input type="checkbox" ' . $outofstock_disable . ' id="'. $id . '-outofstock" name="'. $id . '[woo][outofstock]" value="1" ' . checked( 1, $checked, false ) . '/>';
662
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Exclude 'out of stock' WooCommerce products.", 'ivory-search' ) . '</label></p>';
663
- echo IS_Admin::pro_link( 'pro_plus' );
664
- } else {
665
- _e( 'WooCommerce product post type is not included in search.', 'ivory-search' );
666
- }
667
- ?>
 
 
 
 
668
  </div></div>
669
 
670
 
671
  <h3 scope="row">
672
- <label for="<?php echo $id; ?>-author"><?php echo esc_html( __( 'Authors', 'ivory-search' ) ); ?></label>
673
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
674
  <div>
675
- <?php
676
- $content = __( 'Exclude posts from the search created by slected authors.', 'ivory-search' );
677
- IS_Help::help_info( $content );
678
- echo '<div>';
679
- if ( ! isset( $includes['author'] ) ) {
680
-
681
- $author_disable = is_fs()->is_plan_or_trial( 'pro' ) ? '' : ' disabled ';
682
- $authors = get_users( array(
683
- 'fields' => array( 'ID', 'display_name' ),
684
- 'orderby' => 'post_count',
685
- 'order' => 'DESC',
686
- 'who' => 'authors',
687
- ) );
688
- if ( ! empty( $authors ) ) {
689
- if ( '' !== $author_disable ) {
690
- echo IS_Admin::pro_link();
691
- }
692
- foreach ( $authors as $author ) {
693
-
694
- $post_count = count_user_posts( $author->ID );
695
-
696
- // Move on if user has not published a post (yet).
697
- if ( ! $post_count ) {
698
- continue;
699
- }
700
-
701
- $checked = isset( $excludes['author'][ esc_attr( $author->ID )] ) ? $excludes['author'][ esc_attr( $author->ID )] : 0;
702
-
703
- echo '<div class="col-wrapper check-radio"><label for="'. $id . '-author-' . esc_attr( $author->ID ) . '"><input type="checkbox" ' . $author_disable . ' id="'. $id . '-author-' . esc_attr( $author->ID ) . '" name="'. $id . '[author][' . esc_attr( $author->ID ) . ']" value="' . esc_attr( $author->ID ) . '" ' . checked( $author->ID, $checked, false ) . '/>';
704
- echo '<span class="toggle-check-text"></span> ' . ucfirst( esc_html( $author->display_name ) ) . '</label></div>';
705
- }
706
- }
707
- } else {
708
- echo '<label>' . esc_html__( "Search has been already limited to posts created by specific authors in the Includes section.", 'ivory-search' ) . '</label>';
709
- }
710
- ?>
 
 
711
  </div></div>
712
 
713
 
714
  <h3 scope="row">
715
- <label for="<?php echo $id; ?>-post_status"><?php echo esc_html( __( 'Post Status', 'ivory-search' ) ); ?></label>
716
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
717
  <div>
718
- <?php
719
- $content = __( 'Exclude posts from the search having selected post statuses.', 'ivory-search' );
720
- IS_Help::help_info( $content );
721
- echo '<div>';
722
- if ( ! isset( $includes['post_status'] ) ) {
723
- $post_statuses = get_post_stati();
724
- $post_status_disable = is_fs()->is_plan_or_trial( 'pro' ) ? '' : ' disabled ';
725
-
726
- if ( ! empty( $post_statuses ) ) {
727
- if ( '' !== $post_status_disable ) {
728
- echo '<div class="upgrade-parent">' . IS_Admin::pro_link();
729
- }
730
- foreach ( $post_statuses as $key => $post_status ) {
731
-
732
- $checked = isset( $excludes['post_status'][ esc_attr( $key )] ) ? $excludes['post_status'][ esc_attr( $key )] : 0;
733
-
734
- echo '<div class="col-wrapper check-radio"><label for="'. $id . '-post_status-' . esc_attr( $key ) . '"><input type="checkbox" ' . $post_status_disable . ' id="'. $id . '-post_status-' . esc_attr( $key ) . '" name="'. $id . '[post_status][' . esc_attr( $key ) . ']" value="' . esc_attr( $key ) . '" ' . checked( $key, $checked, false ) . '/>';
735
- echo '<span class="toggle-check-text"></span> ' . ucwords( str_replace( '-', ' ', esc_html( $post_status ) ) ) . '</label></div>';
736
- }
737
- if ( '' !== $post_status_disable ) {
738
- echo '</div>';
739
- }
740
- }
741
- } else {
742
- echo '<label>' . esc_html__( "Search has been already limited to posts statuses set in the Includes section.", 'ivory-search' ) . '</label>';
743
- }
744
-
745
- $checked = ( isset( $excludes['ignore_sticky_posts'] ) && $excludes['ignore_sticky_posts'] ) ? 1 : 0;
746
- echo '<br /><br /><p class="check-radio"><label for="'. $id . '-ignore_sticky_posts" ><input type="checkbox" id="'. $id . '-ignore_sticky_posts" name="'. $id . '[ignore_sticky_posts]" value="1" ' . checked( 1, $checked, false ) . '/>';
747
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Exclude sticky posts from search.", 'ivory-search' ) . '</label></p>';
748
- ?>
 
 
 
749
  </div></div>
750
 
751
- <?php
752
- global $wp_version;
753
- if ( 4.9 <= $wp_version ) {
754
- ?>
 
755
 
756
  <h3 scope="row">
757
- <label for="<?php echo $id; ?>-post_file_type"><?php echo esc_html( __( 'File Types', 'ivory-search' ) ); ?></label>
758
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
759
  <div>
760
- <?php
761
- $content = __( 'Exclude posts specially media attachment posts from the search having selected file types.', 'ivory-search' );
762
- IS_Help::help_info( $content );
763
- echo '<div>';
764
- if ( ! isset( $includes['post_file_type'] ) ) {
765
- $file_types = get_allowed_mime_types();
766
- if ( ! empty( $file_types ) ) {
767
- $file_type_disable = is_fs()->is_plan_or_trial( 'pro_plus' ) ? '' : ' disabled ';
768
- ksort( $file_types );
769
- echo '<input class="list-search wide" placeholder="'. __( "Search..", 'ivory-search' ) . '" type="text">';
770
- echo '<select name="'. $id . '[post_file_type][]" ' . $file_type_disable . ' multiple size="8" >';
771
- foreach ( $file_types as $key => $file_type ) {
772
- $checked = ( isset( $excludes['post_file_type'] ) && in_array( $file_type, $excludes['post_file_type'] ) ) ? $file_type : 0;
773
- echo '<option value="' . esc_attr( $file_type ) . '" ' . selected( $file_type, $checked, false ) . '>' . esc_html( $key ) . '</option>';
774
- }
775
- echo '</select>';
776
- echo IS_Admin::pro_link( 'pro_plus' );
777
- echo '<br /><br /><label for="'. $id . '-post_file_type" style="font-size: 10px;clear:both;display:block;">' . esc_html__( "Press CTRL key to select multiple terms or deselect them.", 'ivory-search' ) . '</label>';
778
- }
779
- } else {
780
- echo '<label>' . esc_html__( "Search has been already limited to specific File type set in the Includes section.", 'ivory-search' ) . '</label>';
781
- }
782
-
783
- if ( isset( $excludes['post_file_type'] ) ) {
784
- echo '<br />' . __( 'Excluded File Types :', 'ivory-search' );
785
- foreach ( $excludes['post_file_type'] as $post_file_type ) {
786
- echo '<br /><span style="font-size: 11px;">' . $post_file_type . '</span>';
787
- }
788
- }
789
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
790
  </div></div>
791
 
792
- <?php
793
- }
794
- ?>
 
795
  </div>
796
  </div>
797
- <?php
798
- }
799
-
800
- public function settings_panel( $post ) {
801
- $id = '_is_settings';
802
- $settings = $post->prop( $id );
803
- ?>
 
804
  <h4 class="panel-desc">
805
- <?php
806
- _e( "Configure the options here to control search of this search form.", 'ivory-search' );
807
- ?>
808
  </h4>
809
- <div class="search-form-editor-box" id="<?php echo $id; ?>">
 
 
810
  <div class="form-table">
811
 
812
  <h3 scope="row">
813
- <label for="<?php echo $id; ?>-posts_per_page"><?php echo esc_html( __( 'Posts Per Page', 'ivory-search' ) ); ?></label>
814
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
815
  <div><div>
816
- <?php
817
- echo '<select name="'. $id . '[posts_per_page]" >';
818
- $checked = isset( $settings['posts_per_page'] ) ? $settings['posts_per_page'] : get_option( 'posts_per_page', 10 );
819
- for ( $d = 1; $d <= 1000; $d++ ) {
820
- echo '<option value="' . $d . '" ' . selected( $d, $checked, false ) . '>' . $d . '</option>';
821
- }
822
- echo '</select><label for="'. $id . '-posts_per_page"> ' . esc_html( __( 'Number of posts to display on search results page.', 'ivory-search' ) ) . '</label>';
823
- ?>
 
 
 
 
824
  </div></div>
825
 
826
 
827
  <h3 scope="row">
828
- <label for="<?php echo $id; ?>-order"><?php echo esc_html( __( 'Order By', 'ivory-search' ) ); ?></label>
829
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
830
  <div><div>
831
- <?php
832
- $orderby_disable = is_fs()->is_plan_or_trial( 'pro' ) ? '' : ' disabled ';
833
- echo '<select name="'. $id . '[orderby]" ' . $orderby_disable . ' >';
834
- $checked = isset( $settings['orderby'] ) ? $settings['orderby'] : 'date';
835
- $orderbys = array( 'date', 'relevance', 'none', 'ID', 'author', 'title', 'name', 'type', 'modified', 'parent', 'rand',
836
- 'comment_count', 'menu_order', 'meta_value', 'meta_value_num', 'post__in', 'post_name__in', 'post_parent__in' );
837
- foreach ( $orderbys as $orderby ) {
838
- echo '<option value="' . $orderby . '" ' . selected( $orderby, $checked, false ) . '>' . ucwords( str_replace( '_', ' ', esc_html( $orderby ) ) ) . '</option>';
839
- }
840
-
841
- echo '</select><select name="'. $id . '[order]" ' . $orderby_disable . ' >';
842
- $checked = isset( $settings['order'] ) ? $settings['order'] : 'DESC';
843
- $orders = array( 'DESC', 'ASC' );
844
- foreach ( $orders as $order ) {
845
- echo '<option value="' . $order . '" ' . selected( $order, $checked, false ) . '>' . ucwords( str_replace( '_', ' ', esc_html( $order ) ) ) . '</option>';
846
- }
847
- echo '</select>';
848
- echo IS_Admin::pro_link();
849
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
850
  </div></div>
851
 
852
 
853
  <h3 scope="row">
854
- <label for="<?php echo $id; ?>-highlight_terms"><?php echo esc_html( __( 'Highlight Terms', 'ivory-search' ) ); ?></label>
855
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
856
  <div><div>
857
- <?php
858
- $checked = ( isset( $settings['highlight_terms'] ) && $settings['highlight_terms'] ) ? 1 : 0;
859
- echo '<p class="check-radio"><label for="'. $id . '-highlight_terms" ><input type="checkbox" id="'. $id . '-highlight_terms" name="'. $id . '[highlight_terms]" value="1" ' . checked( 1, $checked, false ) . '/>';
860
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Highlight searched terms on search results page.", 'ivory-search' ) . '</label></p>';
861
- $color = ( isset( $settings['highlight_color'] ) ) ? $settings['highlight_color'] : '#FFFFB9';
862
- echo '<br /><br /><input size="10" type="text" id="'. $id . '-highlight_color" name="'. $id . '[highlight_color]" value="' . $color . '" />';
863
- echo '<label for="'. $id . '-highlight_color" > ' . esc_html__( "Set highlight color.", 'ivory-search' ) . '</label>';
864
- ?>
 
 
 
 
 
 
 
 
 
 
865
  </div></div>
866
 
867
 
868
  <h3 scope="row">
869
- <label for="<?php echo $id; ?>-term_rel"><?php echo esc_html( __( 'Search Terms Relation', 'ivory-search' ) ); ?></label>
870
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
871
  <div><div>
872
- <?php
873
- $term_rel_disable = is_fs()->is_plan_or_trial( 'pro' ) ? '' : ' disabled ';
874
- $checked = ( isset( $settings['term_rel'] ) && "OR" === $settings['term_rel'] ) ? "OR" : "AND";
875
- echo '<p class="check-radio"><label for="'. $id . '-term_rel_or" ><input type="radio" ' . $term_rel_disable . ' id="'. $id . '-term_rel_or" name="'. $id . '[term_rel]" value="OR" ' . checked( 'OR', $checked, false ) . '/>';
876
- echo '<span class="toggle-check-text"></span>' . esc_html__( "OR - Display content having any of the searched terms.", 'ivory-search' ) . '</label>' . IS_Admin::pro_link() . '</p>';
877
- echo '<p class="check-radio"><label for="'. $id . '-term_rel_and" ><input type="radio" ' . $term_rel_disable . ' id="'. $id . '-term_rel_and" name="'. $id . '[term_rel]" value="AND" ' . checked( 'AND', $checked, false ) . '/>';
878
- echo '<span class="toggle-check-text"></span>' . esc_html__( "AND - Display content having all the searched terms.", 'ivory-search' ) . '</label></p>';
879
- ?>
 
 
 
880
  </div></div>
881
 
882
 
883
  <h3 scope="row">
884
- <label for="<?php echo $id; ?>-fuzzy_match"><?php echo esc_html( __( 'Fuzzy Matching', 'ivory-search' ) ); ?></label>
885
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
886
  <div><div>
887
- <?php
888
- $checked = isset( $settings['fuzzy_match'] ) ? $settings['fuzzy_match'] : '2';
889
- echo '<p class="check-radio"><label for="'. $id . '-whole" ><input type="radio" id="'. $id . '-whole" name="'. $id . '[fuzzy_match]" value="1" ' . checked( '1', $checked, false ) . '/>';
890
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Whole - Search posts that include the whole search term.", 'ivory-search' ) . '</label></p>';
891
- echo '<p class="check-radio"><label for="'. $id . '-partial" ><input type="radio" id="'. $id . '-partial" name="'. $id . '[fuzzy_match]" value="2" ' . checked( '2', $checked, false ) . '/>';
892
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Partial - Also search words in the posts that begins or ends with the search term.", 'ivory-search' ) . '</label></p>';
893
- ?>
 
 
 
894
  </div></div>
895
 
896
 
897
  <h3 scope="row">
898
- <label for="<?php echo $id; ?>-keyword_stem"><?php echo esc_html( __( 'Keyword Stemming', 'ivory-search' ) ); ?></label>
899
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
900
  <div>
901
- <?php
902
- $content = __( 'Searches the base word of a searched keyword', 'ivory-search' );
903
- $content .= '<p>' . __( 'For Example: If you search "doing" then it also searches base word of "doing" that is "do" in the specified post types.', 'ivory-search' ). '</p>';;
904
- $content .= '<p>' . __( 'If you want to search whole exact searched term then do not use this options and in this case it is not recommended to use when Fuzzy Matching option is set to Whole.', 'ivory-search' ). '</p>';
905
- IS_Help::help_info( $content );
906
- echo '<div>';
907
- $stem_disable = is_fs()->is_plan_or_trial( 'pro_plus' ) ? '' : ' disabled ';
908
- $checked = ( isset( $settings['keyword_stem'] ) && $settings['keyword_stem'] ) ? 1 : 0;
909
- echo '<p class="check-radio"><label for="'. $id . '-keyword_stem" ><input type="checkbox" id="'. $id . '-keyword_stem" ' . $stem_disable . ' name="'. $id . '[keyword_stem]" value="1" ' . checked( 1, $checked, false ) . '/>';
910
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Also search base word of searched keyword.", 'ivory-search' ) . '</label></p>';
911
- echo IS_Admin::pro_link( 'pro_plus' );
912
- echo '<br /><label for="'. $id . '-keyword_stem" style="font-size: 10px;clear:both;display:block;">' . esc_html__( "Not recommended to use when Fuzzy Matching option is set to Whole.", 'ivory-search' ) . '</label>';
913
- ?>
 
 
 
914
  </div></div>
915
 
916
 
917
  <h3 scope="row">
918
- <label for="<?php echo $id; ?>-move_sticky_posts"><?php echo esc_html( __( 'Sticky Posts', 'ivory-search' ) ); ?></label>
919
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
920
  <div><div>
921
- <?php
922
- $checked = ( isset( $settings['move_sticky_posts'] ) && $settings['move_sticky_posts'] ) ? 1 : 0;
923
- echo '<p class="check-radio"><label for="'. $id . '-move_sticky_posts" ><input type="checkbox" id="'. $id . '-move_sticky_posts" name="'. $id . '[move_sticky_posts]" value="1" ' . checked( 1, $checked, false ) . '/>';
924
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Move sticky posts to the start of the search results page.", 'ivory-search' ) . '</label></p>';
925
- ?>
 
 
 
926
  </div></div>
927
 
928
 
929
  <h3 scope="row">
930
- <label for="<?php echo $id; ?>-empty_search"><?php echo esc_html( __( 'Empty Search', 'ivory-search' ) ); ?></label>
931
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
932
  <div><div>
933
- <?php
934
- $checked = ( isset( $settings['empty_search'] ) && $settings['empty_search'] ) ? 1 : 0;
935
- echo '<p class="check-radio"><label for="'. $id . '-empty_search" ><input type="checkbox" id="'. $id . '-empty_search" name="'. $id . '[empty_search]" value="1" ' . checked( 1, $checked, false ) . '/>';
936
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Display an error for empty search query.", 'ivory-search' ) . '</label></p>';
937
- ?>
 
 
 
938
  </div></div>
939
 
940
 
941
  <h3 scope="row">
942
- <label for="<?php echo $id; ?>-exclude_from_search"><?php echo esc_html( __( 'Respect exclude_from_search', 'ivory-search' ) ); ?></label>
943
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
944
  <div><div>
945
- <?php
946
- $checked = ( isset( $settings['exclude_from_search'] ) && $settings['exclude_from_search'] ) ? 1 : 0;
947
- echo '<p class="check-radio"><label for="'. $id . '-exclude_from_search" ><input type="checkbox" id="'. $id . '-exclude_from_search" name="'. $id . '[exclude_from_search]" value="1" ' . checked( 1, $checked, false ) . '/>';
948
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Do not search post types which are excluded from search.", 'ivory-search' ) . '</label></p>';
949
- ?>
 
 
 
950
  </div></div>
951
 
952
 
953
  <h3 scope="row">
954
- <label for="<?php echo $id; ?>-demo"><?php echo esc_html( __( 'Demo', 'ivory-search' ) ); ?></label>
955
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
956
  <div><div>
957
- <?php
958
- $checked = ( isset( $settings['demo'] ) && $settings['demo'] ) ? 1 : 0;
959
- echo '<p class="check-radio"><label for="'. $id . '-demo" ><input type="checkbox" id="'. $id . '-demo" name="'. $id . '[demo]" value="1" ' . checked( 1, $checked, false ) . '/>';
960
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Display search form only for site administrator.", 'ivory-search' ) . '</label></p>';
961
- ?>
 
 
 
962
  </div></div>
963
 
964
 
965
  <h3 scope="row">
966
- <label for="<?php echo $id; ?>-disable"><?php echo esc_html( __( 'Disable', 'ivory-search' ) ); ?></label>
967
- <span class="actions"><a class="expand" href="#"><?php esc_html_e( 'Expand All', 'ivory-search' ); ?></a><a class="collapse" href="#" style="display:none;"><?php esc_html_e( 'Collapse All', 'ivory-search' ); ?></a></span></h3>
 
 
 
 
 
 
 
 
 
 
968
  <div><div>
969
- <?php
970
- $checked = ( isset( $settings['disable'] ) && $settings['disable'] ) ? 1 : 0;
971
- echo '<p class="check-radio"><label for="'. $id . '-disable" ><input type="checkbox" id="'. $id . '-disable" name="'. $id . '[disable]" value="1" ' . checked( 1, $checked, false ) . '/>';
972
- echo '<span class="toggle-check-text"></span>' . esc_html__( "Disable this search form.", 'ivory-search' ) . '</label></p>';
973
- ?>
 
 
 
974
  </div></div>
975
  </div>
976
  </div>
977
- <?php
978
- }
979
- }
 
1
  <?php
2
 
3
+ class IS_Search_Editor
4
+ {
5
+ private $search_form ;
6
+ private $panels = array() ;
7
+ private $is_premium_plugin = false ;
8
+ public function __construct( IS_Search_Form $search_form )
9
+ {
10
+ $this->search_form = $search_form;
11
+ }
12
+
13
+ function is_name( $string )
14
+ {
15
+ return preg_match( '/^[A-Za-z][-A-Za-z0-9_:.]*$/', $string );
16
+ }
17
+
18
+ public function add_panel( $id, $title, $callback )
19
+ {
20
+ if ( $this->is_name( $id ) ) {
21
+ $this->panels[$id] = array(
22
+ 'title' => $title,
23
+ 'callback' => $callback,
24
+ );
25
+ }
26
+ }
27
+
28
+ public function display()
29
+ {
30
+ if ( empty($this->panels) ) {
31
+ return;
32
+ }
33
+ echo '<ul id="search-form-editor-tabs">' ;
34
+ foreach ( $this->panels as $id => $panel ) {
35
+ echo sprintf( '<li id="%1$s-tab"><a href="#%1$s">%2$s</a></li>', esc_attr( $id ), esc_html( $panel['title'] ) ) ;
36
+ }
37
+ echo '</ul>' ;
38
+ foreach ( $this->panels as $id => $panel ) {
39
+ echo sprintf( '<div class="search-form-editor-panel" id="%1$s">', esc_attr( $id ) ) ;
40
+ $this->notice( $id, $panel );
41
+ $callback = $panel['callback'];
42
+ $this->{$callback}( $this->search_form );
43
+ echo '</div>' ;
44
+ }
45
+ }
46
+
47
+ public function notice( $id, $panel )
48
+ {
49
+ echo '<div class="config-error"></div>' ;
50
+ }
51
+
52
+ /**
53
+ * Gets all public meta keys of post types
54
+ *
55
+ * @global Object $wpdb WPDB object
56
+ * @return Array array of meta keys
57
+ */
58
+ function is_meta_keys( $post_types )
59
+ {
60
+ global $wpdb ;
61
+ $post_types = implode( "', '", $post_types );
62
+ $is_fields = $wpdb->get_results( apply_filters( 'is_meta_keys_query', "select DISTINCT meta_key from {$wpdb->postmeta} pt LEFT JOIN {$wpdb->posts} p ON (pt.post_id = p.ID) where meta_key NOT LIKE '\\_%' AND post_type IN ( '{$post_types}' ) ORDER BY meta_key ASC" ) );
63
+ $meta_keys = array();
64
+ if ( is_array( $is_fields ) && !empty($is_fields) ) {
65
+ foreach ( $is_fields as $field ) {
66
+ if ( isset( $field->meta_key ) ) {
67
+ $meta_keys[] = $field->meta_key;
68
+ }
69
+ }
70
+ }
71
+ /**
72
+ * Filter results of SQL query for meta keys
73
+ */
74
+ return apply_filters( 'is_meta_keys', $meta_keys );
75
+ }
76
+
77
+ public function includes_panel( $post )
78
+ {
79
+ $id = '_is_includes';
80
+ $includes = $post->prop( $id );
81
+ $settings = $post->prop( '_is_settings' );
82
+ $excludes = $post->prop( '_is_excludes' );
83
+ ?>
 
 
 
84
  <h4 class="panel-desc">
85
+ <?php
86
+ _e( "Configure the below options to make specific content searchable.", 'ivory-search' );
87
+ ?>
88
  </h4>
89
+ <div class="search-form-editor-box" id="<?php
90
+ echo $id ;
91
+ ?>">
92
 
93
  <div class="form-table">
94
 
95
  <h3 scope="row">
96
+ <label for="<?php
97
+ echo $id ;
98
+ ?>-post_type"><?php
99
+ esc_html_e( 'Post Types', 'ivory-search' );
100
+ ?></label>
101
+ <span class="actions"><span class="indicator <?php
102
+ echo $id ;
103
+ ?>-post_type"></span><a class="expand" href="#"><?php
104
+ esc_html_e( 'Expand All', 'ivory-search' );
105
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
106
+ esc_html_e( 'Collapse All', 'ivory-search' );
107
+ ?></a></span>
108
  </h3>
109
  <div>
110
+ <?php
111
+ $content = __( 'Select post types that you want to make searchable.', 'ivory-search' );
112
+ IS_Help::help_info( $content );
113
+ echo '<div>' ;
114
+ $args = array(
115
+ 'public' => true,
116
+ );
117
+ if ( isset( $settings['exclude_from_search'] ) ) {
118
+ $args = array(
119
+ 'public' => true,
120
+ 'exclude_from_search' => false,
121
+ );
122
+ }
123
+ $posts = get_post_types( $args );
124
+
125
+ if ( !empty($posts) ) {
126
+ $ind_status = false;
127
+ foreach ( $posts as $key => $post_type ) {
128
+ $checked = ( isset( $includes['post_type'][esc_attr( $key )] ) ? $includes['post_type'][esc_attr( $key )] : 0 );
129
+ if ( !$ind_status && $checked && 'post' !== $key && 'page' !== $key ) {
130
+ $ind_status = true;
131
+ }
132
+ echo '<div class="col-wrapper check-radio">' ;
133
+ echo '<label for="' . $id . '-post_type-' . esc_attr( $key ) . '"> ' ;
134
+ echo '<input class="_is_includes-post_type" type="checkbox" id="' . $id . '-post_type-' . esc_attr( $key ) . '" name="' . $id . '[post_type][' . esc_attr( $key ) . ']" value="' . esc_attr( $key ) . '" ' . checked( $key, $checked, false ) . '/>' ;
135
+ echo '<span class="toggle-check-text"></span>' ;
136
+ echo ucfirst( esc_html( $post_type ) ) . '</label></div>' ;
137
+ }
138
+ $checked = ( isset( $includes['search_title'] ) && $includes['search_title'] ? 1 : 0 );
139
+ if ( !$ind_status && !$checked ) {
140
+ $ind_status = true;
141
+ }
142
+ echo '<br /><br /><p class="check-radio"><label for="' . $id . '-search_title"><input class="_is_includes-post_type" type="checkbox" id="' . $id . '-search_title" name="' . $id . '[search_title]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
143
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Search in post title.", 'ivory-search' ) . '</label></p>' ;
144
+ $checked = ( isset( $includes['search_content'] ) && $includes['search_content'] ? 1 : 0 );
145
+ if ( !$ind_status && !$checked ) {
146
+ $ind_status = true;
147
+ }
148
+ echo '<p class="check-radio"><label for="' . $id . '-search_content"><input class="_is_includes-post_type" type="checkbox" id="' . $id . '-search_content" name="' . $id . '[search_content]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
149
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Search in post content.", 'ivory-search' ) . '</label></p>' ;
150
+ $checked = ( isset( $includes['search_excerpt'] ) && $includes['search_excerpt'] ? 1 : 0 );
151
+ if ( !$ind_status && !$checked ) {
152
+ $ind_status = true;
153
+ }
154
+ echo '<p class="check-radio"><label for="' . $id . '-search_excerpt"><input class="_is_includes-post_type" type="checkbox" id="' . $id . '-search_excerpt" name="' . $id . '[search_excerpt]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
155
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Search in post excerpt.", 'ivory-search' ) . '</label></p>' ;
156
+ echo '<br /><select class="_is_includes-post_type" name="' . $id . '[post_type_qs]" >' ;
157
+ $checked = ( isset( $includes['post_type_qs'] ) ? $includes['post_type_qs'] : 'none' );
158
+ if ( !$ind_status && 'none' !== $checked ) {
159
+ $ind_status = true;
160
+ }
161
+ echo '<option value="none" ' . selected( 'none', $checked, false ) . '>' . esc_html( __( 'None', 'ivory-search' ) ) . '</option>' ;
162
+ foreach ( $posts as $key => $post_type ) {
163
+ echo '<option value="' . $key . '" ' . selected( $key, $checked, false ) . '>' . ucfirst( esc_html( $post_type ) ) . '</option>' ;
164
+ }
165
+ echo '</select><label for="' . $id . '-post_type_qs"> ' . esc_html( __( 'Display this post type in the search query URL and restrict search to it.', 'ivory-search' ) ) . '</label>' ;
166
+ if ( $ind_status ) {
167
+ echo '<span class="ind-status ' . $id . '-post_type"></span>' ;
168
+ }
169
+ } else {
170
+ _e( 'No post types registered on your site.', 'ivory-search' );
171
+ }
172
+
173
+ ?>
174
  </div></div>
175
 
176
 
177
 
178
  <h3 scope="row">
179
+ <label for="<?php
180
+ echo $id ;
181
+ ?>-tax_query"><?php
182
+ esc_html_e( 'Taxonomy Terms', 'ivory-search' );
183
+ ?></label>
184
+ <span class="actions"><span class="indicator <?php
185
+ echo $id ;
186
+ ?>-tax_query"></span><a class="expand" href="#"><?php
187
+ esc_html_e( 'Expand All', 'ivory-search' );
188
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
189
+ esc_html_e( 'Collapse All', 'ivory-search' );
190
+ ?></a></span></h3>
191
  <div>
192
+ <?php
193
+ $content = __( 'Taxonomy terms that have no posts will not be visible below. Add a post with the taxonomy you want for it to be configurable.', 'ivory-search' );
194
+ $content .= '<br /><br />' . __( 'Terms selected here will restrict the search to posts that have the selected terms.', 'ivory-search' );
195
+ $content .= '<br />' . __( 'Taxonomy terms selected display in BOLD', 'ivory-search' );
196
+ IS_Help::help_info( $content );
197
+ echo '<div>' ;
198
+ $args = array( 'post', 'page' );
199
+ if ( isset( $includes['post_type'] ) && !empty($includes['post_type']) && is_array( $includes['post_type'] ) ) {
200
+ $args = array_values( $includes['post_type'] );
201
+ }
202
+ $tax_objs = get_object_taxonomies( $args, 'objects' );
203
+
204
+ if ( !empty($tax_objs) ) {
205
+ foreach ( $tax_objs as $key => $tax_obj ) {
206
+ $terms = get_terms( array(
207
+ 'taxonomy' => $key,
208
+ 'hide_empty' => false,
209
+ ) );
210
+
211
+ if ( !empty($terms) ) {
212
+ echo '<div class="col-wrapper"><div class="col-title">' ;
213
+ $col_title = ucwords( str_replace( '-', ' ', str_replace( '_', ' ', esc_html( $key ) ) ) );
214
+ if ( isset( $includes['tax_query'][$key] ) ) {
215
+ $col_title = '<strong>' . $col_title . '</strong>';
216
+ }
217
+ echo $col_title . '<input class="list-search" placeholder="' . __( "Search..", 'ivory-search' ) . '" type="text"></div><input type="hidden" id="' . $id . '-tax_post_type" name="' . $id . '[tax_post_type][' . $key . ']" value="' . implode( ',', $tax_obj->object_type ) . '" />' ;
218
+ echo '<select class="_is_includes-tax_query" name="' . $id . '[tax_query][' . $key . '][]" multiple size="8" >' ;
219
+ foreach ( $terms as $key2 => $term ) {
220
+ $checked = ( isset( $includes['tax_query'][$key] ) && in_array( $term->term_taxonomy_id, $includes['tax_query'][$key] ) ? $term->term_taxonomy_id : 0 );
221
+ echo '<option value="' . esc_attr( $term->term_taxonomy_id ) . '" ' . selected( $term->term_taxonomy_id, $checked, false ) . '>' . esc_html( $term->name ) . '</option>' ;
222
+ }
223
+ echo '</select></div>' ;
224
+ }
225
+
226
+ }
227
+ echo '<br /><label for="' . $id . '-tax_query" style="font-size: 10px;clear:both;display:block;">' . esc_html__( "Press CTRL key to select multiple terms or deselect them.", 'ivory-search' ) . '</label>' ;
228
+ $ind_status = false;
229
+ if ( isset( $includes['tax_query'] ) && !empty($includes['tax_query']) ) {
230
+ $ind_status = true;
231
+ }
232
+ $checked = ( isset( $includes['tax_rel'] ) && "OR" == $includes['tax_rel'] ? "OR" : "AND" );
233
+ if ( !$ind_status && "AND" !== $checked ) {
234
+ $ind_status = true;
235
+ }
236
+ echo '<br /><p class="check-radio"><label for="' . $id . '-tax_rel_and" ><input class="_is_includes-tax_query" type="radio" id="' . $id . '-tax_rel_and" name="' . $id . '[tax_rel]" value="AND" ' . checked( 'AND', $checked, false ) . '/>' ;
237
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "AND - Search posts having all the above selected terms.", 'ivory-search' ) . '</label></p>' ;
238
+ echo '<p class="check-radio"><label for="' . $id . '-tax_rel_or" ><input class="_is_includes-tax_query" type="radio" id="' . $id . '-tax_rel_or" name="' . $id . '[tax_rel]" value="OR" ' . checked( 'OR', $checked, false ) . '/>' ;
239
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "OR - Search posts having any one of the above selected terms.", 'ivory-search' ) . '</label></p>' ;
240
+ $checked = ( isset( $includes['search_tax_title'] ) && $includes['search_tax_title'] ? 1 : 0 );
241
+ if ( !$ind_status && $checked ) {
242
+ $ind_status = true;
243
+ }
244
+ echo '<br /><p class="check-radio"><label for="' . $id . '-search_tax_title" ><input class="_is_includes-tax_query" type="checkbox" id="' . $id . '-search_tax_title" name="' . $id . '[search_tax_title]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
245
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Search in taxonomy terms title.", 'ivory-search' ) . '</label></p>' ;
246
+ $checked = ( isset( $includes['search_tax_desp'] ) && $includes['search_tax_desp'] ? 1 : 0 );
247
+ if ( !$ind_status && $checked ) {
248
+ $ind_status = true;
249
+ }
250
+ echo '<p class="check-radio"><label for="' . $id . '-search_tax_desp" ><input class="_is_includes-tax_query" type="checkbox" id="' . $id . '-search_tax_desp" name="' . $id . '[search_tax_desp]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
251
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Search in taxonomy terms description.", 'ivory-search' ) . '</label></p>' ;
252
+ if ( $ind_status ) {
253
+ echo '<span class="ind-status ' . $id . '-tax_query"></span>' ;
254
+ }
255
+ } else {
256
+ _e( 'No taxonomies registered for slected post types.', 'ivory-search' );
257
+ }
258
+
259
+ ?>
260
  </div></div>
261
 
262
 
263
  <h3 scope="row">
264
+ <label for="<?php
265
+ echo $id ;
266
+ ?>-custom_field"><?php
267
+ echo esc_html( __( 'Custom Fields', 'ivory-search' ) ) ;
268
+ ?></label>
269
+ <span class="actions"><span class="indicator <?php
270
+ echo $id ;
271
+ ?>-custom_field"></span><a class="expand" href="#"><?php
272
+ esc_html_e( 'Expand All', 'ivory-search' );
273
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
274
+ esc_html_e( 'Collapse All', 'ivory-search' );
275
+ ?></a></span></h3>
276
  <div>
277
+ <?php
278
+ $content = __( 'Select custom fields to make their values searchable.', 'ivory-search' );
279
+ IS_Help::help_info( $content );
280
+ echo '<div>' ;
281
+ $args = array( 'post', 'page' );
282
+ if ( isset( $includes['post_type'] ) && !empty($includes['post_type']) && is_array( $includes['post_type'] ) ) {
283
+ $args = array_values( $includes['post_type'] );
284
+ }
285
+ $meta_keys = $this->is_meta_keys( $args );
286
+
287
+ if ( !empty($meta_keys) ) {
288
+ echo '<input class="list-search wide" placeholder="' . __( "Search..", 'ivory-search' ) . '" type="text">' ;
289
+ echo '<select class="_is_includes-custom_field" name="' . $id . '[custom_field][]" multiple size="8" >' ;
290
+ foreach ( $meta_keys as $meta_key ) {
291
+ $checked = ( isset( $includes['custom_field'] ) && in_array( $meta_key, $includes['custom_field'] ) ? $meta_key : 0 );
292
+ echo '<option value="' . esc_attr( $meta_key ) . '" ' . selected( $meta_key, $checked, false ) . '>' . esc_html( $meta_key ) . '</option>' ;
293
+ }
294
+ echo '</select>' ;
295
+ echo '<br /><label for="' . $id . '-custom_field" style="font-size: 10px;clear:both;display:block;">' . esc_html__( "Press CTRL key to select multiple terms or deselect them.", 'ivory-search' ) . '</label>' ;
296
+ }
297
+
298
+
299
+ if ( isset( $includes['custom_field'] ) ) {
300
+ echo '<br />' . __( 'Selected Custom Fields :', 'ivory-search' ) ;
301
+ foreach ( $includes['custom_field'] as $custom_field ) {
302
+ echo '<br /><span style="font-size: 11px;">' . $custom_field . '</span>' ;
303
+ }
304
+ echo '<span class="ind-status ' . $id . '-custom_field"></span>' ;
305
+ }
306
+
307
+ ?>
308
  </div></div>
309
 
310
 
311
  <h3 scope="row">
312
+ <label for="<?php
313
+ echo $id ;
314
+ ?>-woocommerce"><?php
315
+ echo esc_html( __( 'WooCommerce', 'ivory-search' ) ) ;
316
+ ?></label>
317
+ <span class="actions"><span class="indicator <?php
318
+ echo $id ;
319
+ ?>-woocommerce"></span><a class="expand" href="#"><?php
320
+ esc_html_e( 'Expand All', 'ivory-search' );
321
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
322
+ esc_html_e( 'Collapse All', 'ivory-search' );
323
+ ?></a></span></h3>
324
  <div>
325
+ <?php
326
+ $content = __( 'Configure WooCommerce products search options here.', 'ivory-search' );
327
+ IS_Help::help_info( $content );
328
+ echo '<div>' ;
329
+ $args = array( 'post', 'page' );
330
+ if ( isset( $includes['post_type'] ) && !empty($includes['post_type']) && is_array( $includes['post_type'] ) ) {
331
+ $args = array_values( $includes['post_type'] );
332
+ }
333
+
334
+ if ( in_array( 'product', $args ) ) {
335
+ $woo_sku_disable = ( is_fs()->is_plan_or_trial( 'pro_plus' ) && $this->is_premium_plugin ? '' : ' disabled ' );
336
+ $checked = ( isset( $includes['woo']['sku'] ) && $includes['woo']['sku'] ? 1 : 0 );
337
+ echo '<p class="check-radio"><label for="' . $id . '-sku" ><input class="_is_includes-woocommerce" type="checkbox" ' . $woo_sku_disable . ' id="' . $id . '-sku" name="' . $id . '[woo][sku]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
338
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Search in WooCommerce products SKU.", 'ivory-search' ) . '</label>' ;
339
+ echo IS_Admin::pro_link( 'pro_plus' ) . '</p>' ;
340
+ if ( $checked ) {
341
+ echo '<span class="ind-status ' . $id . '-woocommerce"></span>' ;
342
+ }
343
+ } else {
344
+ _e( 'WooCommerce product post type is not included in search.', 'ivory-search' );
345
+ }
346
+
347
+ ?>
348
  </div></div>
349
 
350
 
351
  <h3 scope="row">
352
+ <label for="<?php
353
+ echo $id ;
354
+ ?>-author"><?php
355
+ echo esc_html( __( 'Authors', 'ivory-search' ) ) ;
356
+ ?></label>
357
+ <span class="actions"><span class="indicator <?php
358
+ echo $id ;
359
+ ?>-author"></span><a class="expand" href="#"><?php
360
+ esc_html_e( 'Expand All', 'ivory-search' );
361
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
362
+ esc_html_e( 'Collapse All', 'ivory-search' );
363
+ ?></a></span></h3>
364
  <div>
365
+ <?php
366
+ $content = __( 'Make specific author posts searchable.', 'ivory-search' );
367
+ IS_Help::help_info( $content );
368
+ echo '<div>' ;
369
+ $author_disable = ( is_fs()->is_plan_or_trial( 'pro' ) && $this->is_premium_plugin ? '' : ' disabled ' );
370
+
371
+ if ( !isset( $excludes['author'] ) ) {
372
+ $authors = get_users( array(
373
+ 'fields' => array( 'ID', 'display_name' ),
374
+ 'orderby' => 'post_count',
375
+ 'order' => 'DESC',
376
+ 'who' => 'authors',
377
+ ) );
378
+
379
+ if ( !empty($authors) ) {
380
+ if ( '' !== $author_disable ) {
381
+ echo '<div class="upgrade-parent">' . IS_Admin::pro_link() ;
382
+ }
383
+ foreach ( $authors as $author ) {
384
+ $post_count = count_user_posts( $author->ID );
385
+ // Move on if user has not published a post (yet).
386
+ if ( !$post_count ) {
387
+ continue;
388
+ }
389
+ $checked = ( isset( $includes['author'][esc_attr( $author->ID )] ) ? $includes['author'][esc_attr( $author->ID )] : 0 );
390
+ echo '<div class="col-wrapper check-radio"><label for="' . $id . '-author-' . esc_attr( $author->ID ) . '"><input class="_is_includes-author" type="checkbox" ' . $author_disable . ' id="' . $id . '-author-' . esc_attr( $author->ID ) . '" name="' . $id . '[author][' . esc_attr( $author->ID ) . ']" value="' . esc_attr( $author->ID ) . '" ' . checked( $author->ID, $checked, false ) . '/>' ;
391
+ echo '<span class="toggle-check-text"></span> ' . ucfirst( esc_html( $author->display_name ) ) . '</label></div>' ;
392
+ }
393
+ }
394
+
395
+ } else {
396
+ echo '<label>' . esc_html__( "Search has been already limited by excluding specific authors posts in the Excludes section.", 'ivory-search' ) . '</label>' ;
397
+ }
398
+
399
+ if ( '' !== $author_disable ) {
400
+ echo '</div>' ;
401
+ }
402
+ $checked = ( isset( $includes['search_author'] ) && $includes['search_author'] ? 1 : 0 );
403
+ echo '<br /><br /><p class="check-radio"><label for="' . $id . '-search_author" ><input class="_is_includes-author" type="checkbox" id="' . $id . '-search_author" name="' . $id . '[search_author]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
404
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Search in author Display name and display the posts created by that author.", 'ivory-search' ) . '</label></p>' ;
405
+ if ( $checked || isset( $includes['author'] ) && !empty($includes['author']) ) {
406
+ echo '<span class="ind-status ' . $id . '-author"></span>' ;
407
+ }
408
+ ?>
409
  </div></div>
410
 
411
  <h3 scope="row">
412
+ <label for="<?php
413
+ echo $id ;
414
+ ?>-post_status"><?php
415
+ echo esc_html( __( 'Post Status', 'ivory-search' ) ) ;
416
+ ?></label>
417
+ <span class="actions"><span class="indicator <?php
418
+ echo $id ;
419
+ ?>-post_status"></span><a class="expand" href="#"><?php
420
+ esc_html_e( 'Expand All', 'ivory-search' );
421
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
422
+ esc_html_e( 'Collapse All', 'ivory-search' );
423
+ ?></a></span></h3>
424
  <div>
425
+ <?php
426
+ $content = __( 'Configure options to search posts having specific post statuses.', 'ivory-search' );
427
+ IS_Help::help_info( $content );
428
+ echo '<div>' ;
429
+
430
+ if ( !isset( $excludes['post_status'] ) ) {
431
+ $post_statuses = get_post_stati();
432
+ $post_status_disable = ( is_fs()->is_plan_or_trial( 'pro' ) && $this->is_premium_plugin ? '' : ' disabled ' );
433
+
434
+ if ( !empty($post_statuses) ) {
435
+ if ( '' !== $post_status_disable ) {
436
+ echo IS_Admin::pro_link() ;
437
+ }
438
+ foreach ( $post_statuses as $key => $post_status ) {
439
+ $checked = ( isset( $includes['post_status'][esc_attr( $key )] ) ? $includes['post_status'][esc_attr( $key )] : 0 );
440
+ echo '<div class="col-wrapper check-radio"><label for="' . $id . '-post_status-' . esc_attr( $key ) . '"><input class="_is_includes-post_status" type="checkbox" ' . $post_status_disable . ' id="' . $id . '-post_status-' . esc_attr( $key ) . '" name="' . $id . '[post_status][' . esc_attr( $key ) . ']" value="' . esc_attr( $key ) . '" ' . checked( $key, $checked, false ) . '/>' ;
441
+ echo '<span class="toggle-check-text"></span> ' . ucwords( str_replace( '-', ' ', esc_html( $post_status ) ) ) . '</label></div>' ;
442
+ }
443
+ }
444
+
445
+ if ( isset( $includes['post_status'] ) && !empty($includes['post_status']) ) {
446
+ echo '<span class="ind-status ' . $id . '-post_status"></span>' ;
447
+ }
448
+ } else {
449
+ echo '<label>' . esc_html__( "Search has been already limited by excluding specific posts statuses from search in the Excludes section.", 'ivory-search' ) . '</label>' ;
450
+ }
451
+
452
+ ?>
453
  </div></div>
454
 
455
 
456
  <h3 scope="row">
457
+ <label for="<?php
458
+ echo $id ;
459
+ ?>-comment_count"><?php
460
+ echo esc_html( __( 'Comments', 'ivory-search' ) ) ;
461
+ ?></label>
462
+ <span class="actions"><span class="indicator <?php
463
+ echo $id ;
464
+ ?>-comment_count"></span><a class="expand" href="#"><?php
465
+ esc_html_e( 'Expand All', 'ivory-search' );
466
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
467
+ esc_html_e( 'Collapse All', 'ivory-search' );
468
+ ?></a></span></h3>
469
  <div>
470
+ <?php
471
+ $ind_status = false;
472
+ $content = __( 'Make posts searchable that have a specific number of comments.', 'ivory-search' );
473
+ IS_Help::help_info( $content );
474
+ echo '<div>' ;
475
+ $comment_count_disable = ( is_fs()->is_plan_or_trial( 'pro' ) && $this->is_premium_plugin ? '' : ' disabled ' );
476
+ if ( '' !== $comment_count_disable ) {
477
+ echo '<div class="upgrade-parent">' . IS_Admin::pro_link() ;
478
+ }
479
+ echo '<select class="_is_includes-comment_count" name="' . $id . '[comment_count][compare]" ' . $comment_count_disable . ' style="min-width: 50px;">' ;
480
+ $checked = ( isset( $includes['comment_count']['compare'] ) ? htmlspecialchars_decode( $includes['comment_count']['compare'] ) : '=' );
481
+ if ( '=' !== $checked ) {
482
+ $ind_status = true;
483
+ }
484
+ $compare = array(
485
+ '=',
486
+ '!=',
487
+ '>',
488
+ '>=',
489
+ '<',
490
+ '<='
491
+ );
492
+ foreach ( $compare as $d ) {
493
+ echo '<option value="' . htmlspecialchars_decode( $d ) . '" ' . selected( $d, $checked, false ) . '>' . esc_html( $d ) . '</option>' ;
494
+ }
495
+ echo '</select><label for="' . $id . '-comment_count-compare"> ' . esc_html( __( 'The search operator to compare comments count.', 'ivory-search' ) ) . '</label>' ;
496
+ echo '<br /><select class="_is_includes-comment_count" name="' . $id . '[comment_count][value]" ' . $comment_count_disable . ' >' ;
497
+ $checked = ( isset( $includes['comment_count']['value'] ) ? $includes['comment_count']['value'] : 'na' );
498
+ if ( !$ind_status && 'na' !== $checked ) {
499
+ $ind_status = true;
500
+ }
501
+ echo '<option value="na" ' . selected( 'na', $checked, false ) . '>' . esc_html( __( 'NA', 'ivory-search' ) ) . '</option>' ;
502
+ for ( $d = 0 ; $d <= 999 ; $d++ ) {
503
+ echo '<option value="' . $d . '" ' . selected( $d, $checked, false ) . '>' . $d . '</option>' ;
504
+ }
505
+ echo '</select><label for="' . $id . '-comment_count-value"> ' . esc_html( __( 'The amount of comments your posts has to have.', 'ivory-search' ) ) . '</label>' ;
506
+ if ( '' !== $comment_count_disable ) {
507
+ echo '</div>' ;
508
+ }
509
+ $checked = ( isset( $includes['search_comment'] ) && $includes['search_comment'] ? 1 : 0 );
510
+ if ( !$ind_status && $checked ) {
511
+ $ind_status = true;
512
+ }
513
+ echo '<br /><br /><p class="check-radio"><label for="' . $id . '-search_comment" ><input class="_is_includes-comment_count" type="checkbox" id="' . $id . '-search_comment" name="' . $id . '[search_comment]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
514
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Search in approved comments content.", 'ivory-search' ) . '</label></p>' ;
515
+ if ( $ind_status ) {
516
+ echo '<span class="ind-status ' . $id . '-comment_count"></span>' ;
517
+ }
518
+ ?>
519
  </div></div>
520
 
521
 
522
  <h3 scope="row">
523
+ <label for="<?php
524
+ echo $id ;
525
+ ?>-date_query"><?php
526
+ echo esc_html( __( 'Date', 'ivory-search' ) ) ;
527
+ ?></label>
528
+ <span class="actions"><span class="indicator <?php
529
+ echo $id ;
530
+ ?>-date_query"></span><a class="expand" href="#"><?php
531
+ esc_html_e( 'Expand All', 'ivory-search' );
532
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
533
+ esc_html_e( 'Collapse All', 'ivory-search' );
534
+ ?></a></span></h3>
535
  <div>
536
+ <?php
537
+ $content = __( 'Make posts searchable that were created in the specified date range.', 'ivory-search' );
538
+ IS_Help::help_info( $content );
539
+ echo '<div>' ;
540
+ $range = array( 'after', 'before' );
541
+ $ind_status = false;
542
+ foreach ( $range as $value ) {
543
+ echo '<div class="col-wrapper ' . $value . '"><div class="col-title">' . ucfirst( $value ) . '</div>' ;
544
+ echo '<select class="_is_includes-date_query" name="' . $id . '[date_query][' . $value . '][day]" >' ;
545
+ $checked = ( isset( $includes['date_query'][$value]['day'] ) ? $includes['date_query'][$value]['day'] : 'day' );
546
+ if ( 'day' !== $checked ) {
547
+ $ind_status = true;
548
+ }
549
+ echo '<option value="day" ' . selected( 'day', $checked, false ) . '>' . esc_html( __( 'Day', 'ivory-search' ) ) . '</option>' ;
550
+ for ( $d = 1 ; $d <= 31 ; $d++ ) {
551
+ echo '<option value="' . $d . '" ' . selected( $d, $checked, false ) . '>' . $d . '</option>' ;
552
+ }
553
+ echo '</select>' ;
554
+ echo '<select class="_is_includes-date_query" name="' . $id . '[date_query][' . $value . '][month]" >' ;
555
+ $checked = ( isset( $includes['date_query'][$value]['month'] ) ? $includes['date_query'][$value]['month'] : 'month' );
556
+ if ( !$ind_status && 'month' !== $checked ) {
557
+ $ind_status = true;
558
+ }
559
+ echo '<option value="month" ' . selected( 'month', $checked, false ) . '>' . esc_html( __( 'Month', 'ivory-search' ) ) . '</option>' ;
560
+ for ( $m = 1 ; $m <= 12 ; $m++ ) {
561
+ echo '<option value="' . $m . '" ' . selected( $m, $checked, false ) . '>' . date( 'F', mktime(
562
+ 0,
563
+ 0,
564
+ 0,
565
+ $m,
566
+ 1
567
+ ) ) . '</option>' ;
568
+ }
569
+ echo '</select>' ;
570
+ echo '<select class="_is_includes-date_query" name="' . $id . '[date_query][' . $value . '][year]" >' ;
571
+ $checked = ( isset( $includes['date_query'][$value]['year'] ) ? $includes['date_query'][$value]['year'] : 'year' );
572
+ if ( !$ind_status && 'year' !== $checked ) {
573
+ $ind_status = true;
574
+ }
575
+ echo '<option value="year" ' . selected( 'year', $checked, false ) . '>' . esc_html( __( 'Year', 'ivory-search' ) ) . '</option>' ;
576
+ for ( $y = date( "Y" ) ; $y >= 1995 ; $y-- ) {
577
+ echo '<option value="' . $y . '" ' . selected( $y, $checked, false ) . '>' . $y . '</option>' ;
578
+ }
579
+ echo '</select></div>' ;
580
+ }
581
+ if ( $ind_status ) {
582
+ echo '<span class="ind-status ' . $id . '-date_query"></span>' ;
583
+ }
584
+ ?>
585
  </div></div>
586
 
587
 
588
  <h3 scope="row">
589
+ <label for="<?php
590
+ echo $id ;
591
+ ?>-has_password"><?php
592
+ echo esc_html( __( 'Password', 'ivory-search' ) ) ;
593
+ ?></label>
594
+ <span class="actions"><span class="indicator <?php
595
+ echo $id ;
596
+ ?>-has_password"></span><a class="expand" href="#"><?php
597
+ esc_html_e( 'Expand All', 'ivory-search' );
598
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
599
+ esc_html_e( 'Collapse All', 'ivory-search' );
600
+ ?></a></span></h3>
601
  <div>
602
+ <?php
603
+ $content = __( 'Configure options to search posts with or without password.', 'ivory-search' );
604
+ IS_Help::help_info( $content );
605
+ echo '<div>' ;
606
+ $checked = ( isset( $includes['has_password'] ) ? $includes['has_password'] : 'null' );
607
+ echo '<p class="check-radio"><label for="' . $id . '-has_password" ><input class="_is_includes-has_password" type="radio" id="' . $id . '-has_password" name="' . $id . '[has_password]" value="null" ' . checked( 'null', $checked, false ) . '/>' ;
608
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Search all posts with and without passwords.", 'ivory-search' ) . '</label></p>' ;
609
+ echo '<p class="check-radio"><label for="' . $id . '-has_password_1" ><input class="_is_includes-has_password" type="radio" id="' . $id . '-has_password_1" name="' . $id . '[has_password]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
610
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Search only posts with passwords.", 'ivory-search' ) . '</label></p>' ;
611
+ echo '<p class="check-radio"><label for="' . $id . '-has_password_0" ><input class="_is_includes-has_password" type="radio" id="' . $id . '-has_password_0" name="' . $id . '[has_password]" value="0" ' . checked( 0, $checked, false ) . '/>' ;
612
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Search only posts without passwords.", 'ivory-search' ) . '</label></p>' ;
613
+ if ( 'null' !== $checked ) {
614
+ echo '<span class="ind-status ' . $id . '-has_password"></span>' ;
615
+ }
616
+ ?>
617
  </div></div>
618
 
619
+ <?php
620
+ global $wp_version ;
621
+
622
+ if ( 4.9 <= $wp_version ) {
623
+ ?>
624
 
625
  <h3 scope="row">
626
+ <label for="<?php
627
+ echo $id ;
628
+ ?>-post_file_type"><?php
629
+ echo esc_html( __( 'File Types', 'ivory-search' ) ) ;
630
+ ?></label>
631
+ <span class="actions"><span class="indicator <?php
632
+ echo $id ;
633
+ ?>-post_file_type"></span><a class="expand" href="#"><?php
634
+ esc_html_e( 'Expand All', 'ivory-search' );
635
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
636
+ esc_html_e( 'Collapse All', 'ivory-search' );
637
+ ?></a></span></h3>
638
  <div>
639
+ <?php
640
+ $content = __( 'Configure searching to search based on posts that have a specific MIME type or files that have specific media attachments', 'ivory-search' );
641
+ IS_Help::help_info( $content );
642
+ echo '<div>' ;
643
+
644
+ if ( isset( $includes['post_type'] ) && in_array( 'attachment', $includes['post_type'] ) ) {
645
+
646
+ if ( !isset( $excludes['post_file_type'] ) ) {
647
+ $file_types = get_allowed_mime_types();
648
+
649
+ if ( !empty($file_types) ) {
650
+ $file_type_disable = ( is_fs()->is_plan_or_trial( 'pro_plus' ) && $this->is_premium_plugin ? '' : ' disabled ' );
651
+ ksort( $file_types );
652
+ echo '<input class="list-search wide" placeholder="' . __( "Search..", 'ivory-search' ) . '" type="text">' ;
653
+ echo '<select class="_is_includes-post_file_type" name="' . $id . '[post_file_type][]" ' . $file_type_disable . ' multiple size="8" >' ;
654
+ foreach ( $file_types as $key => $file_type ) {
655
+ $checked = ( isset( $includes['post_file_type'] ) && in_array( $file_type, $includes['post_file_type'] ) ? $file_type : 0 );
656
+ echo '<option value="' . esc_attr( $file_type ) . '" ' . selected( $file_type, $checked, false ) . '>' . esc_html( $key ) . '</option>' ;
657
+ }
658
+ echo '</select>' ;
659
+ echo IS_Admin::pro_link( 'pro_plus' ) ;
660
+ echo '<br /><br /><label for="' . $id . '-post_file_type" style="font-size: 10px;clear:both;display:block;">' . esc_html__( "Press CTRL key to select multiple terms or deselect them.", 'ivory-search' ) . '</label>' ;
661
+ }
662
+
663
+ } else {
664
+ echo '<label>' . esc_html__( "Search has been already limited by excluding specific File type in the Excludes section.", 'ivory-search' ) . '</label>' ;
665
+ }
666
+
667
+ } else {
668
+ _e( 'Attachment post type is not included in search.', 'ivory-search' );
669
+ }
670
+
671
+
672
+ if ( isset( $includes['post_file_type'] ) ) {
673
+ echo '<br />' . __( 'Selected File Types :', 'ivory-search' ) ;
674
+ foreach ( $includes['post_file_type'] as $post_file_type ) {
675
+ echo '<br /><span style="font-size: 11px;">' . $post_file_type . '</span>' ;
676
+ }
677
+ echo '<span class="ind-status ' . $id . '-post_file_type"></span>' ;
678
+ }
679
+
680
+ ?>
681
  </div></div>
682
 
683
+ <?php
684
+ }
685
+
686
+ ?>
687
  </div>
688
 
689
  </div>
690
 
691
+ <?php
692
+ }
693
+
694
+ public function excludes_panel( $post )
695
+ {
696
+ $id = '_is_excludes';
697
+ $excludes = $post->prop( $id );
698
+ $includes = $post->prop( '_is_includes' );
699
+ ?>
700
  <h4 class="panel-desc">
701
+ <?php
702
+ _e( "Configure the options to exclude specific content from search.", 'ivory-search' );
703
+ ?>
704
  </h4>
705
+ <div class="search-form-editor-box" id="<?php
706
+ echo $id ;
707
+ ?>">
708
  <div class="form-table">
709
 
710
  <h3 scope="row">
711
+ <label for="<?php
712
+ echo $id ;
713
+ ?>-post__not_in"><?php
714
+ echo esc_html( __( 'Posts', 'ivory-search' ) ) ;
715
+ ?></label>
716
+ <span class="actions"><span class="indicator <?php
717
+ echo $id ;
718
+ ?>-post__not_in"></span><a class="expand" href="#"><?php
719
+ esc_html_e( 'Expand All', 'ivory-search' );
720
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
721
+ esc_html_e( 'Collapse All', 'ivory-search' );
722
+ ?></a></span></h3>
723
  <div>
724
+ <?php
725
+ $content = __( 'The posts and pages of searchable post types display here.', 'ivory-search' );
726
+ $content .= '<br />' . __( 'Select the posts you wish to exclude from the search.', 'ivory-search' );
727
+ $content .= '<br />' . __( 'Selected post types display in BOLD.', 'ivory-search' );
728
+ IS_Help::help_info( $content );
729
+ echo '<div>' ;
730
+ $post_types = array( 'post', 'page' );
731
+ if ( isset( $includes['post_type'] ) && !empty($includes['post_type']) && is_array( $includes['post_type'] ) ) {
732
+ $post_types = array_values( $includes['post_type'] );
733
+ }
734
+ foreach ( $post_types as $post_type ) {
735
+ $posts = get_posts( array(
736
+ 'post_type' => $post_type,
737
+ 'posts_per_page' => -1,
738
+ 'orderby' => 'title',
739
+ 'order' => 'ASC',
740
+ ) );
741
+
742
+ if ( !empty($posts) ) {
743
+ $html = '<div class="col-wrapper"><div class="col-title">';
744
+ $col_title = ucwords( $post_type );
745
+ $temp = '';
746
+ $selected_pt = array();
747
+ foreach ( $posts as $post2 ) {
748
+ $checked = ( isset( $excludes['post__not_in'] ) && in_array( $post2->ID, $excludes['post__not_in'] ) ? $post2->ID : 0 );
749
+ if ( $checked ) {
750
+ array_push( $selected_pt, $post_type );
751
+ }
752
+ $post_title = ( isset( $post2->post_title ) && '' !== $post2->post_title ? esc_html( $post2->post_title ) : $post2->post_name );
753
+ $temp .= '<option value="' . esc_attr( $post2->ID ) . '" ' . selected( $post2->ID, $checked, false ) . '>' . $post_title . '</option>';
754
+ }
755
+ if ( !empty($selected_pt) && in_array( $post_type, $selected_pt ) ) {
756
+ $col_title = '<strong>' . $col_title . '</strong>';
757
+ }
758
+ $html .= $col_title . '<input class="list-search" placeholder="' . __( "Search..", 'ivory-search' ) . '" type="text"></div>';
759
+ $html .= '<select class="_is_excludes-post__not_in" name="' . $id . '[post__not_in][]" multiple size="8" >';
760
+ $html .= $temp . '</select></div>';
761
+ echo $html ;
762
+ if ( !empty($selected_pt) ) {
763
+ echo '<span class="ind-status ' . $id . '-post__not_in"></span>' ;
764
+ }
765
+ }
766
+
767
+ }
768
+ echo '<br /><label for="' . $id . '-post__not_in" style="font-size: 10px;clear:both;display:block;">' . esc_html__( "Press CTRL key to select multiple terms or deselect them.", 'ivory-search' ) . '</label>' ;
769
+ ?>
770
  </div></div>
771
 
772
  <h3 scope="row">
773
+ <label for="<?php
774
+ echo $id ;
775
+ ?>-tax_query"><?php
776
+ esc_html_e( 'Taxonomy Terms', 'ivory-search' );
777
+ ?></label>
778
+ <span class="actions"><span class="indicator <?php
779
+ echo $id ;
780
+ ?>-tax_query"></span><a class="expand" href="#"><?php
781
+ esc_html_e( 'Expand All', 'ivory-search' );
782
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
783
+ esc_html_e( 'Collapse All', 'ivory-search' );
784
+ ?></a></span></h3>
785
  <div>
786
+ <?php
787
+ $content = __( 'The taxonomies and terms attached to searchable post types display here.', 'ivory-search' );
788
+ $content .= '<br />' . __( 'Exclude posts from search results that have specific terms', 'ivory-search' );
789
+ $content .= '<br />' . __( 'Selected terms taxonomy title display in BOLD.', 'ivory-search' );
790
+ IS_Help::help_info( $content );
791
+ echo '<div>' ;
792
+ $tax_objs = get_object_taxonomies( $post_types, 'objects' );
793
+
794
+ if ( !empty($tax_objs) ) {
795
+ foreach ( $tax_objs as $key => $tax_obj ) {
796
+ $terms = get_terms( array(
797
+ 'taxonomy' => $key,
798
+ 'hide_empty' => false,
799
+ ) );
800
+
801
+ if ( !empty($terms) ) {
802
+ echo '<div class="col-wrapper"><div class="col-title">' ;
803
+ $col_title = ucwords( str_replace( '-', ' ', str_replace( '_', ' ', esc_html( $key ) ) ) );
804
+ if ( isset( $excludes['tax_query'][$key] ) ) {
805
+ $col_title = '<strong>' . $col_title . '</strong>';
806
+ }
807
+ echo $col_title . '<input class="list-search" placeholder="' . __( "Search..", 'ivory-search' ) . '" type="text"></div><select class="_is_excludes-tax_query" name="' . $id . '[tax_query][' . $key . '][]" multiple size="8" >' ;
808
+ foreach ( $terms as $key2 => $term ) {
809
+ $checked = ( isset( $excludes['tax_query'][$key] ) && in_array( $term->term_taxonomy_id, $excludes['tax_query'][$key] ) ? $term->term_taxonomy_id : 0 );
810
+ echo '<option value="' . esc_attr( $term->term_taxonomy_id ) . '" ' . selected( $term->term_taxonomy_id, $checked, false ) . '>' . esc_html( $term->name ) . '</option>' ;
811
+ }
812
+ echo '</select></div>' ;
813
+ }
814
+
815
+ }
816
+ echo '<br /><label for="' . $id . '-tax_query" style="font-size: 10px;clear:both;display:block;">' . esc_html__( "Press CTRL key to select multiple terms or deselect them.", 'ivory-search' ) . '</label>' ;
817
+ if ( isset( $excludes['tax_query'] ) && !empty($excludes['tax_query']) ) {
818
+ echo '<span class="ind-status ' . $id . '-tax_query"></span>' ;
819
+ }
820
+ } else {
821
+ _e( 'No taxonomies registered for slected post types.', 'ivory-search' );
822
+ }
823
+
824
+ ?>
825
  </div></div>
826
 
827
 
828
  <h3 scope="row">
829
+ <label for="<?php
830
+ echo $id ;
831
+ ?>-custom_field"><?php
832
+ echo esc_html( __( 'Custom Fields', 'ivory-search' ) ) ;
833
+ ?></label>
834
+ <span class="actions"><span class="indicator <?php
835
+ echo $id ;
836
+ ?>-custom_field"></span><a class="expand" href="#"><?php
837
+ esc_html_e( 'Expand All', 'ivory-search' );
838
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
839
+ esc_html_e( 'Collapse All', 'ivory-search' );
840
+ ?></a></span></h3>
841
  <div>
842
+ <?php
843
+ $content = __( 'Exclude posts from the search having selected custom fields.', 'ivory-search' );
844
+ IS_Help::help_info( $content );
845
+ echo '<div>' ;
846
+ $args = array( 'post', 'page' );
847
+ if ( isset( $excludes['post_type'] ) && !empty($excludes['post_type']) && is_array( $excludes['post_type'] ) ) {
848
+ $args = array_values( $excludes['post_type'] );
849
+ }
850
+ $meta_keys = $this->is_meta_keys( $args );
851
+
852
+ if ( !empty($meta_keys) ) {
853
+ $custom_field_disable = ( is_fs()->is_plan_or_trial( 'pro' ) && $this->is_premium_plugin ? '' : ' disabled ' );
854
+ echo '<input class="list-search wide" placeholder="' . __( "Search..", 'ivory-search' ) . '" type="text">' ;
855
+ echo '<select class="_is_excludes-custom_field" name="' . $id . '[custom_field][]" ' . $custom_field_disable . ' multiple size="8" >' ;
856
+ foreach ( $meta_keys as $meta_key ) {
857
+ $checked = ( isset( $excludes['custom_field'] ) && in_array( $meta_key, $excludes['custom_field'] ) ? $meta_key : 0 );
858
+ echo '<option value="' . esc_attr( $meta_key ) . '" ' . selected( $meta_key, $checked, false ) . '>' . esc_html( $meta_key ) . '</option>' ;
859
+ }
860
+ echo '</select>' ;
861
+ echo IS_Admin::pro_link() ;
862
+ echo '<br /><br /><label for="' . $id . '-custom_field" style="font-size: 10px;clear:both;display:block;">' . esc_html__( "Press CTRL key to select multiple terms or deselect them.", 'ivory-search' ) . '</label>' ;
863
+ }
864
+
865
+
866
+ if ( isset( $excludes['custom_field'] ) ) {
867
+ echo '<br />' . __( 'Excluded Custom Fields :', 'ivory-search' ) ;
868
+ foreach ( $excludes['custom_field'] as $custom_field ) {
869
+ echo '<br /><span style="font-size: 11px;">' . $custom_field . '</span>' ;
870
+ }
871
+ echo '<span class="ind-status ' . $id . '-custom_field"></span>' ;
872
+ }
873
+
874
+ ?>
875
  </div></div>
876
 
877
 
878
  <h3 scope="row">
879
+ <label for="<?php
880
+ echo $id ;
881
+ ?>-woocommerce"><?php
882
+ echo esc_html( __( 'WooCommerce', 'ivory-search' ) ) ;
883
+ ?></label>
884
+ <span class="actions"><span class="indicator <?php
885
+ echo $id ;
886
+ ?>-woocommerce"></span><a class="expand" href="#"><?php
887
+ esc_html_e( 'Expand All', 'ivory-search' );
888
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
889
+ esc_html_e( 'Collapse All', 'ivory-search' );
890
+ ?></a></span></h3>
891
  <div>
892
+ <?php
893
+ $content = __( 'Exclude specific WooCommerce products from the search.', 'ivory-search' );
894
+ IS_Help::help_info( $content );
895
+ echo '<div>' ;
896
+ $args = array( 'post', 'page' );
897
+ if ( isset( $includes['post_type'] ) && !empty($includes['post_type']) && is_array( $includes['post_type'] ) ) {
898
+ $args = array_values( $includes['post_type'] );
899
+ }
900
+
901
+ if ( in_array( 'product', $args ) ) {
902
+ $outofstock_disable = ( is_fs()->is_plan_or_trial( 'pro_plus' ) && $this->is_premium_plugin ? '' : ' disabled ' );
903
+ $checked = ( isset( $excludes['woo']['outofstock'] ) && $excludes['woo']['outofstock'] ? 1 : 0 );
904
+ if ( $checked ) {
905
+ echo '<span class="ind-status ' . $id . '-woocommerce"></span>' ;
906
+ }
907
+ echo '<p class="check-radio"><label for="' . $id . '-outofstock" ><input class="_is_excludes-woocommerce" type="checkbox" ' . $outofstock_disable . ' id="' . $id . '-outofstock" name="' . $id . '[woo][outofstock]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
908
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Exclude 'out of stock' WooCommerce products.", 'ivory-search' ) . '</label></p>' ;
909
+ echo IS_Admin::pro_link( 'pro_plus' ) ;
910
+ } else {
911
+ _e( 'WooCommerce product post type is not included in search.', 'ivory-search' );
912
+ }
913
+
914
+ ?>
915
  </div></div>
916
 
917
 
918
  <h3 scope="row">
919
+ <label for="<?php
920
+ echo $id ;
921
+ ?>-author"><?php
922
+ echo esc_html( __( 'Authors', 'ivory-search' ) ) ;
923
+ ?></label>
924
+ <span class="actions"><span class="indicator <?php
925
+ echo $id ;
926
+ ?>-author"></span><a class="expand" href="#"><?php
927
+ esc_html_e( 'Expand All', 'ivory-search' );
928
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
929
+ esc_html_e( 'Collapse All', 'ivory-search' );
930
+ ?></a></span></h3>
931
  <div>
932
+ <?php
933
+ $content = __( 'Exclude posts from the search created by slected authors.', 'ivory-search' );
934
+ IS_Help::help_info( $content );
935
+ echo '<div>' ;
936
+
937
+ if ( !isset( $includes['author'] ) ) {
938
+ $author_disable = ( is_fs()->is_plan_or_trial( 'pro' ) && $this->is_premium_plugin ? '' : ' disabled ' );
939
+ $authors = get_users( array(
940
+ 'fields' => array( 'ID', 'display_name' ),
941
+ 'orderby' => 'post_count',
942
+ 'order' => 'DESC',
943
+ 'who' => 'authors',
944
+ ) );
945
+
946
+ if ( !empty($authors) ) {
947
+ if ( '' !== $author_disable ) {
948
+ echo IS_Admin::pro_link() ;
949
+ }
950
+ foreach ( $authors as $author ) {
951
+ $post_count = count_user_posts( $author->ID );
952
+ // Move on if user has not published a post (yet).
953
+ if ( !$post_count ) {
954
+ continue;
955
+ }
956
+ $checked = ( isset( $excludes['author'][esc_attr( $author->ID )] ) ? $excludes['author'][esc_attr( $author->ID )] : 0 );
957
+ echo '<div class="col-wrapper check-radio"><label for="' . $id . '-author-' . esc_attr( $author->ID ) . '"><input class="_is_excludes-author" type="checkbox" ' . $author_disable . ' id="' . $id . '-author-' . esc_attr( $author->ID ) . '" name="' . $id . '[author][' . esc_attr( $author->ID ) . ']" value="' . esc_attr( $author->ID ) . '" ' . checked( $author->ID, $checked, false ) . '/>' ;
958
+ echo '<span class="toggle-check-text"></span> ' . ucfirst( esc_html( $author->display_name ) ) . '</label></div>' ;
959
+ }
960
+ if ( isset( $excludes['author'] ) && !empty($excludes['author']) ) {
961
+ echo '<span class="ind-status ' . $id . '-author"></span>' ;
962
+ }
963
+ }
964
+
965
+ } else {
966
+ echo '<label>' . esc_html__( "Search has been already limited to posts created by specific authors in the Includes section.", 'ivory-search' ) . '</label>' ;
967
+ }
968
+
969
+ ?>
970
  </div></div>
971
 
972
 
973
  <h3 scope="row">
974
+ <label for="<?php
975
+ echo $id ;
976
+ ?>-post_status"><?php
977
+ echo esc_html( __( 'Post Status', 'ivory-search' ) ) ;
978
+ ?></label>
979
+ <span class="actions"><span class="indicator <?php
980
+ echo $id ;
981
+ ?>-post_status"></span><a class="expand" href="#"><?php
982
+ esc_html_e( 'Expand All', 'ivory-search' );
983
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
984
+ esc_html_e( 'Collapse All', 'ivory-search' );
985
+ ?></a></span></h3>
986
  <div>
987
+ <?php
988
+ $content = __( 'Exclude posts from the search having selected post statuses.', 'ivory-search' );
989
+ IS_Help::help_info( $content );
990
+ echo '<div>' ;
991
+
992
+ if ( !isset( $includes['post_status'] ) ) {
993
+ $post_statuses = get_post_stati();
994
+ $post_status_disable = ( is_fs()->is_plan_or_trial( 'pro' ) && $this->is_premium_plugin ? '' : ' disabled ' );
995
+
996
+ if ( !empty($post_statuses) ) {
997
+ if ( '' !== $post_status_disable ) {
998
+ echo '<div class="upgrade-parent">' . IS_Admin::pro_link() ;
999
+ }
1000
+ foreach ( $post_statuses as $key => $post_status ) {
1001
+ $checked = ( isset( $excludes['post_status'][esc_attr( $key )] ) ? $excludes['post_status'][esc_attr( $key )] : 0 );
1002
+ echo '<div class="col-wrapper check-radio"><label for="' . $id . '-post_status-' . esc_attr( $key ) . '"><input class="_is_excludes-post_status" type="checkbox" ' . $post_status_disable . ' id="' . $id . '-post_status-' . esc_attr( $key ) . '" name="' . $id . '[post_status][' . esc_attr( $key ) . ']" value="' . esc_attr( $key ) . '" ' . checked( $key, $checked, false ) . '/>' ;
1003
+ echo '<span class="toggle-check-text"></span> ' . ucwords( str_replace( '-', ' ', esc_html( $post_status ) ) ) . '</label></div>' ;
1004
+ }
1005
+ if ( '' !== $post_status_disable ) {
1006
+ echo '</div>' ;
1007
+ }
1008
+ }
1009
+
1010
+ } else {
1011
+ echo '<label>' . esc_html__( "Search has been already limited to posts statuses set in the Includes section.", 'ivory-search' ) . '</label>' ;
1012
+ }
1013
+
1014
+ $checked = ( isset( $excludes['ignore_sticky_posts'] ) && $excludes['ignore_sticky_posts'] ? 1 : 0 );
1015
+ if ( isset( $excludes['post_status'] ) && !empty($excludes['post_status']) || $checked ) {
1016
+ echo '<span class="ind-status ' . $id . '-post_status"></span>' ;
1017
+ }
1018
+ echo '<br /><br /><p class="check-radio"><label for="' . $id . '-ignore_sticky_posts" ><input class="_is_excludes-post_status" type="checkbox" id="' . $id . '-ignore_sticky_posts" name="' . $id . '[ignore_sticky_posts]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
1019
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Exclude sticky posts from search.", 'ivory-search' ) . '</label></p>' ;
1020
+ ?>
1021
  </div></div>
1022
 
1023
+ <?php
1024
+ global $wp_version ;
1025
+
1026
+ if ( 4.9 <= $wp_version ) {
1027
+ ?>
1028
 
1029
  <h3 scope="row">
1030
+ <label for="<?php
1031
+ echo $id ;
1032
+ ?>-post_file_type"><?php
1033
+ echo esc_html( __( 'File Types', 'ivory-search' ) ) ;
1034
+ ?></label>
1035
+ <span class="actions"><span class="indicator <?php
1036
+ echo $id ;
1037
+ ?>-post_file_type"></span><a class="expand" href="#"><?php
1038
+ esc_html_e( 'Expand All', 'ivory-search' );
1039
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
1040
+ esc_html_e( 'Collapse All', 'ivory-search' );
1041
+ ?></a></span></h3>
1042
  <div>
1043
+ <?php
1044
+ $content = __( 'Exclude posts specially media attachment posts from the search having selected file types.', 'ivory-search' );
1045
+ IS_Help::help_info( $content );
1046
+ echo '<div>' ;
1047
+
1048
+ if ( isset( $includes['post_type'] ) && in_array( 'attachment', $includes['post_type'] ) ) {
1049
+
1050
+ if ( !isset( $includes['post_file_type'] ) ) {
1051
+ $file_types = get_allowed_mime_types();
1052
+
1053
+ if ( !empty($file_types) ) {
1054
+ $file_type_disable = ( is_fs()->is_plan_or_trial( 'pro_plus' ) && $this->is_premium_plugin ? '' : ' disabled ' );
1055
+ ksort( $file_types );
1056
+ echo '<input class="list-search wide" placeholder="' . __( "Search..", 'ivory-search' ) . '" type="text">' ;
1057
+ echo '<select class="_is_excludes-post_file_type" name="' . $id . '[post_file_type][]" ' . $file_type_disable . ' multiple size="8" >' ;
1058
+ foreach ( $file_types as $key => $file_type ) {
1059
+ $checked = ( isset( $excludes['post_file_type'] ) && in_array( $file_type, $excludes['post_file_type'] ) ? $file_type : 0 );
1060
+ echo '<option value="' . esc_attr( $file_type ) . '" ' . selected( $file_type, $checked, false ) . '>' . esc_html( $key ) . '</option>' ;
1061
+ }
1062
+ echo '</select>' ;
1063
+ echo IS_Admin::pro_link( 'pro_plus' ) ;
1064
+ echo '<br /><br /><label for="' . $id . '-post_file_type" style="font-size: 10px;clear:both;display:block;">' . esc_html__( "Press CTRL key to select multiple terms or deselect them.", 'ivory-search' ) . '</label>' ;
1065
+ }
1066
+
1067
+ } else {
1068
+ echo '<label>' . esc_html__( "Search has been already limited to specific File type set in the Includes section.", 'ivory-search' ) . '</label>' ;
1069
+ }
1070
+
1071
+ } else {
1072
+ _e( 'Attachment post type is not included in search.', 'ivory-search' );
1073
+ }
1074
+
1075
+
1076
+ if ( isset( $excludes['post_file_type'] ) ) {
1077
+ echo '<br />' . __( 'Excluded File Types :', 'ivory-search' ) ;
1078
+ foreach ( $excludes['post_file_type'] as $post_file_type ) {
1079
+ echo '<br /><span style="font-size: 11px;">' . $post_file_type . '</span>' ;
1080
+ }
1081
+ echo '<span class="ind-status ' . $id . '-post_file_type"></span>' ;
1082
+ }
1083
+
1084
+ ?>
1085
  </div></div>
1086
 
1087
+ <?php
1088
+ }
1089
+
1090
+ ?>
1091
  </div>
1092
  </div>
1093
+ <?php
1094
+ }
1095
+
1096
+ public function settings_panel( $post )
1097
+ {
1098
+ $id = '_is_settings';
1099
+ $settings = $post->prop( $id );
1100
+ ?>
1101
  <h4 class="panel-desc">
1102
+ <?php
1103
+ _e( "Configure the options here to control search of this search form.", 'ivory-search' );
1104
+ ?>
1105
  </h4>
1106
+ <div class="search-form-editor-box" id="<?php
1107
+ echo $id ;
1108
+ ?>">
1109
  <div class="form-table">
1110
 
1111
  <h3 scope="row">
1112
+ <label for="<?php
1113
+ echo $id ;
1114
+ ?>-posts_per_page"><?php
1115
+ echo esc_html( __( 'Posts Per Page', 'ivory-search' ) ) ;
1116
+ ?></label>
1117
+ <span class="actions"><span class="indicator <?php
1118
+ echo $id ;
1119
+ ?>-posts_per_page"></span><a class="expand" href="#"><?php
1120
+ esc_html_e( 'Expand All', 'ivory-search' );
1121
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
1122
+ esc_html_e( 'Collapse All', 'ivory-search' );
1123
+ ?></a></span></h3>
1124
  <div><div>
1125
+ <?php
1126
+ echo '<select class="_is_settings-posts_per_page" name="' . $id . '[posts_per_page]" >' ;
1127
+ $default_per_page = get_option( 'posts_per_page', 10 );
1128
+ $checked = ( isset( $settings['posts_per_page'] ) ? $settings['posts_per_page'] : $default_per_page );
1129
+ for ( $d = 1 ; $d <= 1000 ; $d++ ) {
1130
+ echo '<option value="' . $d . '" ' . selected( $d, $checked, false ) . '>' . $d . '</option>' ;
1131
+ }
1132
+ echo '</select><label for="' . $id . '-posts_per_page"> ' . esc_html( __( 'Number of posts to display on search results page.', 'ivory-search' ) ) . '</label>' ;
1133
+ if ( $checked !== $default_per_page ) {
1134
+ echo '<span class="ind-status ' . $id . '-posts_per_page"></span>' ;
1135
+ }
1136
+ ?>
1137
  </div></div>
1138
 
1139
 
1140
  <h3 scope="row">
1141
+ <label for="<?php
1142
+ echo $id ;
1143
+ ?>-order"><?php
1144
+ echo esc_html( __( 'Order By', 'ivory-search' ) ) ;
1145
+ ?></label>
1146
+ <span class="actions"><span class="indicator <?php
1147
+ echo $id ;
1148
+ ?>-order"></span><a class="expand" href="#"><?php
1149
+ esc_html_e( 'Expand All', 'ivory-search' );
1150
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
1151
+ esc_html_e( 'Collapse All', 'ivory-search' );
1152
+ ?></a></span></h3>
1153
  <div><div>
1154
+ <?php
1155
+ $ind_status = false;
1156
+ $orderby_disable = ( is_fs()->is_plan_or_trial( 'pro' ) && $this->is_premium_plugin ? '' : ' disabled ' );
1157
+ echo '<select class="_is_settings-order" name="' . $id . '[orderby]" ' . $orderby_disable . ' >' ;
1158
+ $checked = ( isset( $settings['orderby'] ) ? $settings['orderby'] : 'date' );
1159
+ if ( 'date' !== $checked ) {
1160
+ $ind_status = true;
1161
+ }
1162
+ $orderbys = array(
1163
+ 'date',
1164
+ 'relevance',
1165
+ 'none',
1166
+ 'ID',
1167
+ 'author',
1168
+ 'title',
1169
+ 'name',
1170
+ 'type',
1171
+ 'modified',
1172
+ 'parent',
1173
+ 'rand',
1174
+ 'comment_count',
1175
+ 'menu_order',
1176
+ 'meta_value',
1177
+ 'meta_value_num',
1178
+ 'post__in',
1179
+ 'post_name__in',
1180
+ 'post_parent__in'
1181
+ );
1182
+ foreach ( $orderbys as $orderby ) {
1183
+ echo '<option value="' . $orderby . '" ' . selected( $orderby, $checked, false ) . '>' . ucwords( str_replace( '_', ' ', esc_html( $orderby ) ) ) . '</option>' ;
1184
+ }
1185
+ echo '</select><select class="_is_settings-order" name="' . $id . '[order]" ' . $orderby_disable . ' >' ;
1186
+ $checked = ( isset( $settings['order'] ) ? $settings['order'] : 'DESC' );
1187
+ if ( !$ind_status && 'DESC' !== $checked ) {
1188
+ $ind_status = true;
1189
+ }
1190
+ $orders = array( 'DESC', 'ASC' );
1191
+ foreach ( $orders as $order ) {
1192
+ echo '<option value="' . $order . '" ' . selected( $order, $checked, false ) . '>' . ucwords( str_replace( '_', ' ', esc_html( $order ) ) ) . '</option>' ;
1193
+ }
1194
+ echo '</select>' ;
1195
+ echo IS_Admin::pro_link() ;
1196
+ if ( $ind_status ) {
1197
+ echo '<span class="ind-status ' . $id . '-order"></span>' ;
1198
+ }
1199
+ ?>
1200
  </div></div>
1201
 
1202
 
1203
  <h3 scope="row">
1204
+ <label for="<?php
1205
+ echo $id ;
1206
+ ?>-highlight_terms"><?php
1207
+ echo esc_html( __( 'Highlight Terms', 'ivory-search' ) ) ;
1208
+ ?></label>
1209
+ <span class="actions"><span class="indicator <?php
1210
+ echo $id ;
1211
+ ?>-highlight_terms"></span><a class="expand" href="#"><?php
1212
+ esc_html_e( 'Expand All', 'ivory-search' );
1213
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
1214
+ esc_html_e( 'Collapse All', 'ivory-search' );
1215
+ ?></a></span></h3>
1216
  <div><div>
1217
+ <?php
1218
+ $ind_status = false;
1219
+ $checked = ( isset( $settings['highlight_terms'] ) && $settings['highlight_terms'] ? 1 : 0 );
1220
+ if ( $checked ) {
1221
+ $ind_status = true;
1222
+ }
1223
+ echo '<p class="check-radio"><label for="' . $id . '-highlight_terms" ><input class="_is_settings-highlight_terms" type="checkbox" id="' . $id . '-highlight_terms" name="' . $id . '[highlight_terms]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
1224
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Highlight searched terms on search results page.", 'ivory-search' ) . '</label></p>' ;
1225
+ $color = ( isset( $settings['highlight_color'] ) ? $settings['highlight_color'] : '#FFFFB9' );
1226
+ if ( !$ind_status && '#FFFFB9' !== $color ) {
1227
+ $ind_status = true;
1228
+ }
1229
+ echo '<br /><br /><input class="_is_settings-highlight_terms" size="10" type="text" id="' . $id . '-highlight_color" name="' . $id . '[highlight_color]" value="' . $color . '" />' ;
1230
+ echo '<label for="' . $id . '-highlight_color" > ' . esc_html__( "Set highlight color.", 'ivory-search' ) . '</label>' ;
1231
+ if ( $ind_status ) {
1232
+ echo '<span class="ind-status ' . $id . '-highlight_terms"></span>' ;
1233
+ }
1234
+ ?>
1235
  </div></div>
1236
 
1237
 
1238
  <h3 scope="row">
1239
+ <label for="<?php
1240
+ echo $id ;
1241
+ ?>-term_rel"><?php
1242
+ echo esc_html( __( 'Search Terms Relation', 'ivory-search' ) ) ;
1243
+ ?></label>
1244
+ <span class="actions"><span class="indicator <?php
1245
+ echo $id ;
1246
+ ?>-term_rel"></span><a class="expand" href="#"><?php
1247
+ esc_html_e( 'Expand All', 'ivory-search' );
1248
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
1249
+ esc_html_e( 'Collapse All', 'ivory-search' );
1250
+ ?></a></span></h3>
1251
  <div><div>
1252
+ <?php
1253
+ $term_rel_disable = ( is_fs()->is_plan_or_trial( 'pro' ) && $this->is_premium_plugin ? '' : ' disabled ' );
1254
+ $checked = ( isset( $settings['term_rel'] ) && "OR" === $settings['term_rel'] ? "OR" : "AND" );
1255
+ echo '<p class="check-radio"><label for="' . $id . '-term_rel_or" ><input class="_is_settings-term_rel" type="radio" ' . $term_rel_disable . ' id="' . $id . '-term_rel_or" name="' . $id . '[term_rel]" value="OR" ' . checked( 'OR', $checked, false ) . '/>' ;
1256
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "OR - Display content having any of the searched terms.", 'ivory-search' ) . '</label>' . IS_Admin::pro_link() . '</p>' ;
1257
+ echo '<p class="check-radio"><label for="' . $id . '-term_rel_and" ><input class="_is_settings-term_rel" type="radio" ' . $term_rel_disable . ' id="' . $id . '-term_rel_and" name="' . $id . '[term_rel]" value="AND" ' . checked( 'AND', $checked, false ) . '/>' ;
1258
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "AND - Display content having all the searched terms.", 'ivory-search' ) . '</label></p>' ;
1259
+ if ( "AND" !== $checked ) {
1260
+ echo '<span class="ind-status ' . $id . '-term_rel"></span>' ;
1261
+ }
1262
+ ?>
1263
  </div></div>
1264
 
1265
 
1266
  <h3 scope="row">
1267
+ <label for="<?php
1268
+ echo $id ;
1269
+ ?>-fuzzy_match"><?php
1270
+ echo esc_html( __( 'Fuzzy Matching', 'ivory-search' ) ) ;
1271
+ ?></label>
1272
+ <span class="actions"><span class="indicator <?php
1273
+ echo $id ;
1274
+ ?>-fuzzy_match"></span><a class="expand" href="#"><?php
1275
+ esc_html_e( 'Expand All', 'ivory-search' );
1276
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
1277
+ esc_html_e( 'Collapse All', 'ivory-search' );
1278
+ ?></a></span></h3>
1279
  <div><div>
1280
+ <?php
1281
+ $checked = ( isset( $settings['fuzzy_match'] ) ? $settings['fuzzy_match'] : '2' );
1282
+ echo '<p class="check-radio"><label for="' . $id . '-whole" ><input class="_is_settings-fuzzy_match" type="radio" id="' . $id . '-whole" name="' . $id . '[fuzzy_match]" value="1" ' . checked( '1', $checked, false ) . '/>' ;
1283
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Whole - Search posts that include the whole search term.", 'ivory-search' ) . '</label></p>' ;
1284
+ echo '<p class="check-radio"><label for="' . $id . '-partial" ><input class="_is_settings-fuzzy_match" type="radio" id="' . $id . '-partial" name="' . $id . '[fuzzy_match]" value="2" ' . checked( '2', $checked, false ) . '/>' ;
1285
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Partial - Also search words in the posts that begins or ends with the search term.", 'ivory-search' ) . '</label></p>' ;
1286
+ if ( "2" !== $checked ) {
1287
+ echo '<span class="ind-status ' . $id . '-fuzzy_match"></span>' ;
1288
+ }
1289
+ ?>
1290
  </div></div>
1291
 
1292
 
1293
  <h3 scope="row">
1294
+ <label for="<?php
1295
+ echo $id ;
1296
+ ?>-keyword_stem"><?php
1297
+ echo esc_html( __( 'Keyword Stemming', 'ivory-search' ) ) ;
1298
+ ?></label>
1299
+ <span class="actions"><span class="indicator <?php
1300
+ echo $id ;
1301
+ ?>-keyword_stem"></span><a class="expand" href="#"><?php
1302
+ esc_html_e( 'Expand All', 'ivory-search' );
1303
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
1304
+ esc_html_e( 'Collapse All', 'ivory-search' );
1305
+ ?></a></span></h3>
1306
  <div>
1307
+ <?php
1308
+ $content = __( 'Searches the base word of a searched keyword', 'ivory-search' );
1309
+ $content .= '<p>' . __( 'For Example: If you search "doing" then it also searches base word of "doing" that is "do" in the specified post types.', 'ivory-search' ) . '</p>';
1310
+ $content .= '<p>' . __( 'If you want to search whole exact searched term then do not use this options and in this case it is not recommended to use when Fuzzy Matching option is set to Whole.', 'ivory-search' ) . '</p>';
1311
+ IS_Help::help_info( $content );
1312
+ echo '<div>' ;
1313
+ $stem_disable = ( is_fs()->is_plan_or_trial( 'pro_plus' ) && $this->is_premium_plugin ? '' : ' disabled ' );
1314
+ $checked = ( isset( $settings['keyword_stem'] ) && $settings['keyword_stem'] ? 1 : 0 );
1315
+ echo '<p class="check-radio"><label for="' . $id . '-keyword_stem" ><input class="_is_settings-keyword_stem" type="checkbox" id="' . $id . '-keyword_stem" ' . $stem_disable . ' name="' . $id . '[keyword_stem]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
1316
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Also search base word of searched keyword.", 'ivory-search' ) . '</label></p>' ;
1317
+ echo IS_Admin::pro_link( 'pro_plus' ) ;
1318
+ echo '<br /><label for="' . $id . '-keyword_stem" style="font-size: 10px;clear:both;display:block;">' . esc_html__( "Not recommended to use when Fuzzy Matching option is set to Whole.", 'ivory-search' ) . '</label>' ;
1319
+ if ( $checked ) {
1320
+ echo '<span class="ind-status ' . $id . '-keyword_stem"></span>' ;
1321
+ }
1322
+ ?>
1323
  </div></div>
1324
 
1325
 
1326
  <h3 scope="row">
1327
+ <label for="<?php
1328
+ echo $id ;
1329
+ ?>-move_sticky_posts"><?php
1330
+ echo esc_html( __( 'Sticky Posts', 'ivory-search' ) ) ;
1331
+ ?></label>
1332
+ <span class="actions"><span class="indicator <?php
1333
+ echo $id ;
1334
+ ?>-move_sticky_posts"></span><a class="expand" href="#"><?php
1335
+ esc_html_e( 'Expand All', 'ivory-search' );
1336
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
1337
+ esc_html_e( 'Collapse All', 'ivory-search' );
1338
+ ?></a></span></h3>
1339
  <div><div>
1340
+ <?php
1341
+ $checked = ( isset( $settings['move_sticky_posts'] ) && $settings['move_sticky_posts'] ? 1 : 0 );
1342
+ echo '<p class="check-radio"><label for="' . $id . '-move_sticky_posts" ><input class="_is_settings-move_sticky_posts" type="checkbox" id="' . $id . '-move_sticky_posts" name="' . $id . '[move_sticky_posts]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
1343
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Move sticky posts to the start of the search results page.", 'ivory-search' ) . '</label></p>' ;
1344
+ if ( $checked ) {
1345
+ echo '<span class="ind-status ' . $id . '-move_sticky_posts"></span>' ;
1346
+ }
1347
+ ?>
1348
  </div></div>
1349
 
1350
 
1351
  <h3 scope="row">
1352
+ <label for="<?php
1353
+ echo $id ;
1354
+ ?>-empty_search"><?php
1355
+ echo esc_html( __( 'Empty Search', 'ivory-search' ) ) ;
1356
+ ?></label>
1357
+ <span class="actions"><span class="indicator <?php
1358
+ echo $id ;
1359
+ ?>-empty_search"></span><a class="expand" href="#"><?php
1360
+ esc_html_e( 'Expand All', 'ivory-search' );
1361
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
1362
+ esc_html_e( 'Collapse All', 'ivory-search' );
1363
+ ?></a></span></h3>
1364
  <div><div>
1365
+ <?php
1366
+ $checked = ( isset( $settings['empty_search'] ) && $settings['empty_search'] ? 1 : 0 );
1367
+ echo '<p class="check-radio"><label for="' . $id . '-empty_search" ><input class="_is_settings-empty_search" type="checkbox" id="' . $id . '-empty_search" name="' . $id . '[empty_search]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
1368
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Display an error for empty search query.", 'ivory-search' ) . '</label></p>' ;
1369
+ if ( $checked ) {
1370
+ echo '<span class="ind-status ' . $id . '-empty_search"></span>' ;
1371
+ }
1372
+ ?>
1373
  </div></div>
1374
 
1375
 
1376
  <h3 scope="row">
1377
+ <label for="<?php
1378
+ echo $id ;
1379
+ ?>-exclude_from_search"><?php
1380
+ echo esc_html( __( 'Respect exclude_from_search', 'ivory-search' ) ) ;
1381
+ ?></label>
1382
+ <span class="actions"><span class="indicator <?php
1383
+ echo $id ;
1384
+ ?>-exclude_from_search"></span><a class="expand" href="#"><?php
1385
+ esc_html_e( 'Expand All', 'ivory-search' );
1386
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
1387
+ esc_html_e( 'Collapse All', 'ivory-search' );
1388
+ ?></a></span></h3>
1389
  <div><div>
1390
+ <?php
1391
+ $checked = ( isset( $settings['exclude_from_search'] ) && $settings['exclude_from_search'] ? 1 : 0 );
1392
+ echo '<p class="check-radio"><label for="' . $id . '-exclude_from_search" ><input class="_is_settings-exclude_from_search" type="checkbox" id="' . $id . '-exclude_from_search" name="' . $id . '[exclude_from_search]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
1393
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Do not search post types which are excluded from search.", 'ivory-search' ) . '</label></p>' ;
1394
+ if ( $checked ) {
1395
+ echo '<span class="ind-status ' . $id . '-exclude_from_search"></span>' ;
1396
+ }
1397
+ ?>
1398
  </div></div>
1399
 
1400
 
1401
  <h3 scope="row">
1402
+ <label for="<?php
1403
+ echo $id ;
1404
+ ?>-demo"><?php
1405
+ echo esc_html( __( 'Demo', 'ivory-search' ) ) ;
1406
+ ?></label>
1407
+ <span class="actions"><span class="indicator <?php
1408
+ echo $id ;
1409
+ ?>-demo"></span><a class="expand" href="#"><?php
1410
+ esc_html_e( 'Expand All', 'ivory-search' );
1411
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
1412
+ esc_html_e( 'Collapse All', 'ivory-search' );
1413
+ ?></a></span></h3>
1414
  <div><div>
1415
+ <?php
1416
+ $checked = ( isset( $settings['demo'] ) && $settings['demo'] ? 1 : 0 );
1417
+ echo '<p class="check-radio"><label for="' . $id . '-demo" ><input class="_is_settings-demo" type="checkbox" id="' . $id . '-demo" name="' . $id . '[demo]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
1418
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Display search form only for site administrator.", 'ivory-search' ) . '</label></p>' ;
1419
+ if ( $checked ) {
1420
+ echo '<span class="ind-status ' . $id . '-demo"></span>' ;
1421
+ }
1422
+ ?>
1423
  </div></div>
1424
 
1425
 
1426
  <h3 scope="row">
1427
+ <label for="<?php
1428
+ echo $id ;
1429
+ ?>-disable"><?php
1430
+ echo esc_html( __( 'Disable', 'ivory-search' ) ) ;
1431
+ ?></label>
1432
+ <span class="actions"><span class="indicator <?php
1433
+ echo $id ;
1434
+ ?>-disable"></span><a class="expand" href="#"><?php
1435
+ esc_html_e( 'Expand All', 'ivory-search' );
1436
+ ?></a><a class="collapse" href="#" style="display:none;"><?php
1437
+ esc_html_e( 'Collapse All', 'ivory-search' );
1438
+ ?></a></span></h3>
1439
  <div><div>
1440
+ <?php
1441
+ $checked = ( isset( $settings['disable'] ) && $settings['disable'] ? 1 : 0 );
1442
+ echo '<p class="check-radio"><label for="' . $id . '-disable" ><input class="_is_settings-disable" type="checkbox" id="' . $id . '-disable" name="' . $id . '[disable]" value="1" ' . checked( 1, $checked, false ) . '/>' ;
1443
+ echo '<span class="toggle-check-text"></span>' . esc_html__( "Disable this search form.", 'ivory-search' ) . '</label></p>' ;
1444
+ if ( $checked ) {
1445
+ echo '<span class="ind-status ' . $id . '-disable"></span>' ;
1446
+ }
1447
+ ?>
1448
  </div></div>
1449
  </div>
1450
  </div>
1451
+ <?php
1452
+ }
1453
+
1454
+ }
admin/class-is-settings-fields.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Defines plugin settings fields.
4
  *
@@ -6,576 +7,690 @@
6
  *
7
  * @package IS
8
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
- class IS_Settings_Fields {
11
-
12
- /**
13
- * Stores plugin options.
14
- */
15
- public $opt;
16
-
17
- /**
18
- * Stores flag to know whether new plugin options are saved.
19
- */
20
- public $ivory_search = false;
21
-
22
- /**
23
- * Core singleton class
24
- * @var self
25
- */
26
- private static $_instance;
27
-
28
- /**
29
- * Instantiates the plugin by setting up the core properties and loading
30
- * all necessary dependencies and defining the hooks.
31
- *
32
- * The constructor uses internal functions to import all the
33
- * plugin dependencies, and will leverage the Ivory_Search for
34
- * registering the hooks and the callback functions used throughout the plugin.
35
- */
36
- public function __construct( $is = null ) {
37
-
38
- $new_opt = get_option( 'ivory_search' );
39
-
40
- if ( ! empty( $new_opt ) ) {
41
- $this->ivory_search = true;
42
- }
43
-
44
- if ( null !== $is ) {
45
- $this->opt = $is;
46
- } else {
47
- $old_opt = (array)get_option( 'add_search_to_menu' );
48
- $this->opt = array_merge( $old_opt, (array)$new_opt );
49
- }
50
- }
51
-
52
- /**
53
- * Gets the instance of this class.
54
- *
55
- * @return self
56
- */
57
- public static function getInstance() {
58
- if ( ! ( self::$_instance instanceof self ) ) {
59
- self::$_instance = new self();
60
- }
61
-
62
- return self::$_instance;
63
- }
64
-
65
- /**
66
- * Displays settings sections having custom markup.
67
- */
68
- public function is_do_settings_sections( $page ) {
69
- global $wp_settings_sections, $wp_settings_fields;
70
-
71
- if ( ! isset( $wp_settings_sections[$page] ) )
72
- return;
73
-
74
- foreach ( (array) $wp_settings_sections[$page] as $section ) {
75
- if ( $section['title'] )
76
- echo "<h2>{$section['title']}</h2>\n";
77
-
78
- if ( $section['callback'] )
79
- call_user_func( $section['callback'], $section );
80
-
81
- if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) )
82
- continue;
83
- echo '<div class="form-table">';
84
- $this->is_do_settings_fields( $page, $section['id'] );
85
- echo '</div>';
86
- }
87
- }
88
-
89
- /**
90
- * Displays settings fields having custom markup.
91
- */
92
- public function is_do_settings_fields( $page, $section ) {
93
- global $wp_settings_fields;
94
-
95
- if ( ! isset( $wp_settings_fields[$page][$section] ) )
96
- return;
97
-
98
- foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
99
- $class = '';
100
-
101
- if ( ! empty( $field['args']['class'] ) ) {
102
- $class = ' class="' . esc_attr( $field['args']['class'] ) . '"';
103
- }
104
-
105
- if ( ! empty( $field['args']['label_for'] ) ) {
106
- echo '<h3 scope="row"><label for="' . esc_attr( $field['args']['label_for'] ) . '">' . $field['title'] . '</label>';
107
- } else {
108
- echo '<h3 scope="row">' . $field['title'];
109
- }
110
-
111
- echo '<span class="actions"><a class="expand" href="#">'. esc_html__( 'Expand All', 'ivory-search' ).'</a><a class="collapse" href="#" style="display:none;">'. esc_html__( 'Collapse All', 'ivory-search' ).'</a></span></h3><div>';
112
- call_user_func($field['callback'], $field['args']);
113
- echo '</div>';
114
- }
115
- }
116
-
117
- /**
118
- * Registers plugin settings fields.
119
- */
120
- function register_settings_fields(){
121
- add_settings_section( 'ivory_search_section', '', array( $this, 'search_to_menu_section_desc' ), 'ivory_search' );
122
-
123
- add_settings_field( 'ivory_search_locations', __( 'Select Menu', 'ivory-search' ), array( $this, 'menu_locations' ), 'ivory_search', 'ivory_search_section' );
124
-
125
- $menu_search_form = isset( $this->opt['menu_search_form'] ) ? $this->opt['menu_search_form'] : 0;
126
- if ( ! $menu_search_form ) {
127
- add_settings_field( 'ivory_search_posts', __( 'Post Types', 'ivory-search' ), array( $this, 'menu_post_types' ), 'ivory_search', 'ivory_search_section' );
128
- }
129
-
130
- add_settings_field( 'ivory_search_form', __( 'Search Form', 'ivory-search' ), array( $this, 'menu_search_form' ), 'ivory_search', 'ivory_search_section' );
131
- add_settings_field( 'ivory_search_style', __( 'Form Style', 'ivory-search' ), array( $this, 'menu_form_style' ), 'ivory_search', 'ivory_search_section' );
132
- add_settings_field( 'ivory_search_title', __( 'Menu Title', 'ivory-search' ), array( $this, 'menu_title' ), 'ivory_search', 'ivory_search_section' );
133
- add_settings_field( 'ivory_search_classes', __( 'Menu Classes', 'ivory-search' ), array( $this, 'menu_classes' ), 'ivory_search', 'ivory_search_section' );
134
- add_settings_field( 'ivory_search_gcse', __( 'Google CSE', 'ivory-search' ), array( $this, 'menu_google_cse' ), 'ivory_search', 'ivory_search_section' );
135
- add_settings_field( 'ivory_search_close_icon', __( 'Close Icon', 'ivory-search' ), array( $this, 'menu_close_icon' ), 'ivory_search', 'ivory_search_section' );
136
-
137
- add_settings_section( 'ivory_search_settings', '', array( $this, 'settings_section_desc'), 'ivory_search' );
138
-
139
- add_settings_field( 'ivory_search_header', __( 'Header', 'ivory-search' ), array( $this, 'header' ), 'ivory_search', 'ivory_search_settings' );
140
- add_settings_field( 'ivory_search_footer', __( 'Footer', 'ivory-search' ), array( $this, 'footer' ), 'ivory_search', 'ivory_search_settings' );
141
- add_settings_field( 'ivory_search_display_in_header', __( 'Mobile Display', 'ivory-search' ), array( $this, 'menu_search_in_header' ), 'ivory_search', 'ivory_search_settings' );
142
- add_settings_field( 'ivory_search_css', __( 'Custom CSS', 'ivory-search' ), array( $this, 'custom_css' ), 'ivory_search', 'ivory_search_settings' );
143
- add_settings_field( 'ivory_search_stopwords', __( 'Stopwords', 'ivory-search' ), array( $this, 'stopwords' ), 'ivory_search', 'ivory_search_settings' );
144
- add_settings_field( 'ivory_search_synonyms', __( 'Synonyms', 'ivory-search' ), array( $this, 'synonyms' ), 'ivory_search', 'ivory_search_settings' );
145
- add_settings_field( 'not_load_files', __( 'Not load files', 'ivory-search' ), array( $this, 'plugin_files' ), 'ivory_search', 'ivory_search_settings' );
146
- add_settings_field( 'ivory_search_disable', __( 'Disable', 'ivory-search' ), array( $this, 'disable' ), 'ivory_search', 'ivory_search_settings' );
147
- add_settings_field( 'ivory_search_default', __( 'Default Search', 'ivory-search' ), array( $this, 'default_search' ), 'ivory_search', 'ivory_search_settings' );
148
-
149
- register_setting( 'ivory_search', 'ivory_search' );
150
- }
151
-
152
- /**
153
- * Displays Search To Menu section description text.
154
- */
155
- function search_to_menu_section_desc() {
156
- echo '<h4 class="panel-desc">' . __( 'Use below options to display search in menu and configure it.', 'ivory-search' ) . '</h4>';
157
- }
158
-
159
- /**
160
- * Displays Settings section description text.
161
- */
162
- function settings_section_desc(){
163
- echo '</div>';
164
- echo '<div class="search-form-editor-panel" id="settings">';
165
- echo '<h4 class="panel-desc">' . __( 'Use below options to make sitewide changes in search.', 'ivory-search' ) . '</h4>';
166
- }
167
-
168
- /**
169
- * Displays choose menu locations field.
170
- */
171
- function menu_locations() {
172
-
173
- $content = __( 'Select menu here where you want to display search form.', 'ivory-search' );
174
- IS_Help::help_info( $content );
175
-
176
- $html = '';
177
- $menus = get_registered_nav_menus();
178
-
179
- if ( ! empty( $menus ) ) {
180
- $check_value = '';
181
- foreach ( $menus as $location => $description ) {
182
-
183
- if ( $this->ivory_search ) {
184
- $check_value = isset( $this->opt['menus'][ $location ] ) ? $this->opt['menus'][ $location ] : 0;
185
- } else {
186
- $check_value = isset( $this->opt['add_search_to_menu_locations'][ $location ] ) ? $this->opt['add_search_to_menu_locations'][ $location ] : 0;
187
- }
188
-
189
- $html .= '<p><input type="checkbox" id="is_menus' . esc_attr( $location ) . '" name="ivory_search[menus][' . esc_attr( $location ) . ']" value="' . esc_attr( $location ) . '" ' . checked( $location, $check_value, false ) . '/>';
190
- $html .= '<label for="is_menus' . esc_attr( $location ) . '"> ' . esc_html( $description ) . '</label></p>';
191
- }
192
- } else {
193
- $html = __( 'No navigation menu registered on your site.', 'ivory-search' );
194
- }
195
- echo '<div>' . $html . '</div>';
196
- }
197
-
198
- /**
199
- * Displays post types field.
200
- */
201
- function menu_post_types() {
202
-
203
- $content = __( 'Select post types here that you want to make searchable.', 'ivory-search' );
204
- IS_Help::help_info( $content );
205
-
206
- $html = '';
207
- $args = array( 'exclude_from_search' => false );
208
-
209
- $posts = get_post_types( $args );
210
-
211
- if ( ! empty( $posts ) ){
212
-
213
- foreach ( $posts as $key => $post ) {
214
-
215
- $check_value = ( isset( $this->opt['add_search_to_menu_posts'][$key] ) && ! $this->ivory_search ) ? $this->opt['add_search_to_menu_posts'][ $key ] : 0;
216
- $check_value = isset( $this->opt['menu_posts'][$key] ) ? $this->opt['menu_posts'][ $key ] : $check_value;
217
- $html .= '<p><input type="checkbox" id="is_menu_posts' . esc_attr( $key ) . '" name="ivory_search[menu_posts][' . esc_attr( $key ) . ']" value="' . esc_attr( $key ) . '" ' . checked( $key, $check_value, false ) . '/>';
218
- $html .= '<label for="is_menu_posts' . esc_attr( $key ) . '"> ' . ucfirst( esc_html( $post ) ) . '</label></p>';
219
- }
220
- } else {
221
- $html = __( 'No post types registered on your site.', 'ivory-search' );
222
- }
223
- echo '<div>' . $html . '</div>';
224
- }
225
-
226
-
227
- /**
228
- * Displays menu search form field.
229
- */
230
- function menu_search_form() {
231
-
232
- $content = __( 'Select search form that will control search performed using menu search.', 'ivory-search' );
233
- $content .= '<br />';
234
- $content .= __( 'It overwrites above Post Types option.', 'ivory-search' );
235
- IS_Help::help_info( $content );
236
-
237
- $html = '';
238
- $form_disable = is_fs()->is_plan_or_trial( 'pro' ) ? false : true;
239
- if ( $form_disable ) {
240
- $html .= '<p>'.IS_Admin::pro_link();
241
- $html .= '<select disabled id="menu_search_form" name="ivory_search[menu_search_form]" >';
242
- $html .= '<option value="0" selected="selected">' . __( 'none', 'ivory-search' ) . '</option>';
243
- $html .= '</select></p>';
244
- } else {
245
- $args = array( 'numberposts' => -1, 'post_type' => 'is_search_form' );
246
- $posts = get_posts( $args );
247
-
248
- if ( ! empty( $posts ) ) {
249
-
250
- $check_value = isset( $this->opt['menu_search_form'] ) ? $this->opt['menu_search_form'] : 0;
251
- $html .= '<p><select id="menu_search_form" name="ivory_search[menu_search_form]" >';
252
- $html .= '<option value="0" ' . selected( 0, $check_value, false ) . '>' . __( 'none', 'ivory-search' ) . '</option>';
253
- foreach ( $posts as $post ) {
254
- $html .= '<option value="' . $post->ID . '"' . selected( $post->ID, $check_value, false ) . ' >' . $post->post_title . '</option>';
255
- }
256
-
257
- $html .= '</select>';
258
- if ( $check_value && get_post_type( $check_value ) ) {
259
- $html .= '<a href="' . esc_url( menu_page_url( 'ivory-search', false ) ) . '&post='.$check_value.'&action=edit"> ' . esc_html__( "Edit", 'ivory-search' ) . '</a>';
260
- } else {
261
- $html .= '<a href="' . esc_url( menu_page_url( 'ivory-search-new', false ) ) . '"> ' . esc_html__( "Create New", 'ivory-search' ) . '</a>';
262
- }
263
- $html .= '</p>';
264
- }
265
- }
266
- echo '<div>' . $html . '</div>';
267
- }
268
-
269
-
270
- /**
271
- * Displays form style field.
272
- */
273
- function menu_form_style() {
274
-
275
- $content = __( 'Select form style for the search form displayed in the menu.', 'ivory-search' );
276
- IS_Help::help_info( $content );
277
-
278
- $styles = array(
279
- 'default' => __( 'Default', 'ivory-search' ),
280
- 'dropdown' => __( 'Dropdown', 'ivory-search' ),
281
- 'sliding' => __( 'Sliding', 'ivory-search' ),
282
- 'full-width-menu' => __( 'Full Width', 'ivory-search' ),
283
- 'popup' => __( 'Popup', 'ivory-search' )
284
- );
285
-
286
- $popup_disable = is_fs()->is_plan_or_trial( 'pro' ) ? false : true;
287
-
288
- if ( empty( $this->opt ) || ( ! isset( $this->opt['add_search_to_menu_style'] ) && ! isset( $this->opt['menu_style'] ) ) ) {
289
- $this->opt['menu_style'] = 'default';
290
- update_option( 'ivory_search', $this->opt );
291
- }
292
-
293
- $html = '';
294
- $check_value = isset( $this->opt['add_search_to_menu_style'] ) ? $this->opt['add_search_to_menu_style'] : 'default';
295
- $check_value = isset( $this->opt['menu_style'] ) ? $this->opt['menu_style'] : $check_value;
296
-
297
- foreach ( $styles as $key => $style ) {
298
- if ( $popup_disable && 'popup' === $key ) {
299
- $html .= '<p class="upgrade-parent">'.IS_Admin::pro_link();
300
- } else {
301
- $html .= '<p>';
302
- }
303
- $html .= '<input type="radio" id="is_menu_style' . esc_attr( $key ) . '" name="ivory_search[menu_style]"';
304
- $html .= ( $popup_disable && 'popup' === $key ) ? ' disabled ' : '';
305
- $html .= 'name="ivory_search[menu_style]" value="' . esc_attr( $key ) . '" ' . checked( $key, $check_value, false ) . '/>';
306
- $html .= '<label for="is_menu_style' . esc_attr( $key ) . '"> ' . esc_html( $style ) . '</label>';
307
- $html .= '</p>';
308
- }
309
- echo '<div>' . $html . '</div>';
310
- }
311
-
312
- /**
313
- * Displays search menu title field.
314
- */
315
- function menu_title() {
316
- $content = __( 'Displays set menu title text in place of search icon displays in navigation menu.', 'ivory-search' );
317
- IS_Help::help_info( $content );
318
- $this->opt['add_search_to_menu_title'] = isset( $this->opt['add_search_to_menu_title'] ) ? $this->opt['add_search_to_menu_title'] : '';
319
- $this->opt['menu_title'] = isset( $this->opt['menu_title'] ) ? $this->opt['menu_title'] : $this->opt['add_search_to_menu_title'];
320
- $html = '<input type="text" class="large-text" id="is_menu_title" name="ivory_search[menu_title]" value="' . esc_attr( $this->opt['menu_title'] ) . '" />';
321
- echo '<div>' . $html . '</div>';
322
- }
323
-
324
- /**
325
- * Displays search menu classes field.
326
- */
327
- function menu_classes() {
328
- $content = __( 'Adds set classes in the search navigation menu item.', 'ivory-search' );
329
- IS_Help::help_info( $content );
330
- $this->opt['add_search_to_menu_classes'] = isset( $this->opt['add_search_to_menu_classes'] ) ? $this->opt['add_search_to_menu_classes'] : '';
331
- $this->opt['menu_classes'] = isset( $this->opt['menu_classes'] ) ? $this->opt['menu_classes'] : $this->opt['add_search_to_menu_classes'];
332
- $html = '<input type="text" class="large-text" id="is_menu_classes" name="ivory_search[menu_classes]" value="' . esc_attr( $this->opt['menu_classes'] ) . '" />';
333
- $html .= '<br /><label for="is_menu_classes" style="font-size: 10px;">' . esc_html__( "Add classes seperated by space.", 'ivory-search' ) . '</label>';
334
- echo '<div>' . $html . '</div>';
335
- }
336
-
337
- /**
338
- * Displays google cse field.
339
- */
340
- function menu_google_cse() {
341
- $content = __( 'Add only Google Custom Search( CSE ) search form code in the above text box that will replace default search form.', 'ivory-search' );
342
- IS_Help::help_info( $content );
343
- $this->opt['add_search_to_menu_gcse'] = isset( $this->opt['add_search_to_menu_gcse'] ) ? $this->opt['add_search_to_menu_gcse'] : '';
344
- $this->opt['menu_gcse'] = isset( $this->opt['menu_gcse'] ) ? $this->opt['menu_gcse'] : $this->opt['add_search_to_menu_gcse'];
345
- $html = '<input type="text" class="large-text" id="is_menu_gcse" name="ivory_search[menu_gcse]" value="' . esc_attr( $this->opt['menu_gcse'] ) . '" />';
346
- echo '<div>' . $html . '</div>';
347
- }
348
-
349
- /**
350
- * Displays display in header field.
351
- */
352
- function menu_search_in_header() {
353
- $content = __( 'Note: Does not work with caching as this functionality uses the WordPress wp_is_mobile function.', 'ivory-search' );
354
- IS_Help::help_info( $content );
355
-
356
- $check_value = isset( $this->opt['add_search_to_menu_display_in_header'] ) ? $this->opt['add_search_to_menu_display_in_header'] : 0;
357
-
358
- $check_string = checked( 'add_search_to_menu_display_in_header', $check_value, false );
359
-
360
- if ( $this->ivory_search ) {
361
- $check_value = isset( $this->opt['header_menu_search'] ) ? $this->opt['header_menu_search'] : 0;
362
- $check_string = checked( 'header_menu_search', $check_value, false );
363
- }
364
-
365
- $html = '<input type="checkbox" id="is_search_in_header" name="ivory_search[header_menu_search]" value="header_menu_search" ' . $check_string . ' />';
366
- $html .= '<label for="is_search_in_header"> ' . esc_html__( 'Display search form in header on mobile devices', 'ivory-search' ) . '</label>';
367
- echo '<div>' . $html . '</div><br />';
368
- $html = '';
369
- $content = __( 'Use this option to display search form in your site header and hide the search form on desktop using CSS code.', 'ivory-search' );
370
- IS_Help::help_info( $content );
371
-
372
- $check_value = isset( $this->opt['astm_site_uses_cache'] ) ? $this->opt['astm_site_uses_cache'] : 0;
373
-
374
- $check_string = checked( 'astm_site_uses_cache', $check_value, false );
375
-
376
- if ( $this->ivory_search ) {
377
- $check_value = isset( $this->opt['site_uses_cache'] ) ? $this->opt['site_uses_cache'] : 0;
378
- $check_string = checked( 'site_uses_cache', $check_value, false );
379
- }
380
-
381
- $html .= '<input type="checkbox" id="is_site_uses_cache" name="ivory_search[site_uses_cache]" value="site_uses_cache" ' . $check_string . ' />';
382
- $html .= '<label for="is_site_uses_cache"> ' . esc_html__( 'This site uses cache', 'ivory-search' ) . '</label>';
383
- echo '<div>' . $html . '</div>';
384
- }
385
-
386
- /**
387
- * Disables search functionality on whole site.
388
- */
389
- function disable() {
390
- $check_value = isset( $this->opt['disable'] ) ? $this->opt['disable'] : 0;
391
- $disable = checked( 1, $check_value, false );
392
- $html = '<input type="checkbox" id="is_disable" name="ivory_search[disable]" value="1" ' . $disable . ' />';
393
- $html .= '<label for="is_disable"> ' . esc_html__( 'Disable search functionality on whole site.', 'ivory-search' ) . '</label>';
394
- echo '<div>' . $html . '</div>';
395
- }
396
-
397
- /**
398
- * Controls default search functionality.
399
- */
400
- function default_search() {
401
- $check_value = isset( $this->opt['default_search'] ) ? $this->opt['default_search'] : 0;
402
- $disable = checked( 1, $check_value, false );
403
- $html = '<input type="checkbox" id="is_default_search" name="ivory_search[default_search]" value="1" ' . $disable . ' />';
404
- $html .= '<label for="is_default_search"> ' . esc_html__( 'Do not use default search form to control WordPress default search functionality.', 'ivory-search' ) . '</label>';
405
- echo '<div>' . $html . '</div>';
406
- }
407
-
408
- /**
409
- * Displays search form in site header.
410
- */
411
- function header() {
412
-
413
- $content = __( 'Displays search form in site header using wp_head hook.', 'ivory-search' );
414
- IS_Help::help_info( $content );
415
-
416
- $html = '';
417
- $args = array( 'numberposts' => -1, 'post_type' => 'is_search_form' );
418
-
419
- $posts = get_posts( $args );
420
-
421
- if ( ! empty( $posts ) ) {
422
-
423
- $check_value = isset( $this->opt['header_search'] ) ? $this->opt['header_search'] : 0;
424
- $html .= '<select id="is_header_search" name="ivory_search[header_search]" >';
425
- $html .= '<option value="0" ' . selected( 0, $check_value, false ) . '>' . __( 'none', 'ivory-search' ) . '</option>';
426
- foreach ( $posts as $post ) {
427
- $html .= '<option value="' . $post->ID . '"' . selected( $post->ID, $check_value, false ) . ' >' . $post->post_title . '</option>';
428
- }
429
-
430
- $html .= '</select>';
431
- if ( $check_value && get_post_type( $check_value ) ) {
432
- $html .= '<a href="' . esc_url( menu_page_url( 'ivory-search', false ) ) . '&post='.$check_value.'&action=edit"> ' . esc_html__( "Edit", 'ivory-search' ) . '</a>';
433
- } else {
434
- $html .= '<a href="' . esc_url( menu_page_url( 'ivory-search-new', false ) ) . '"> ' . esc_html__( "Create New", 'ivory-search' ) . '</a>';
435
- }
436
- }
437
- echo '<div>' . $html . '</div>';
438
- }
439
-
440
- /**
441
- * Displays search form in site footer.
442
- */
443
- function footer() {
444
-
445
- $content = __( 'Displays search form in site footer using wp_footer hook.', 'ivory-search' );
446
- IS_Help::help_info( $content );
447
-
448
- $html = '';
449
- $args = array( 'numberposts' => -1, 'post_type' => 'is_search_form' );
450
-
451
- $posts = get_posts( $args );
452
-
453
- if ( ! empty( $posts ) ) {
454
-
455
- $check_value = isset( $this->opt['footer_search'] ) ? $this->opt['footer_search'] : 0;
456
- $html .= '<select id="is_footer_search" name="ivory_search[footer_search]" >';
457
- $html .= '<option value="0" ' . selected( 0, $check_value, false ) . '>' . __( 'none', 'ivory-search' ) . '</option>';
458
- foreach ( $posts as $post ) {
459
- $html .= '<option value="' . $post->ID . '"' . selected( $post->ID, $check_value, false ) . ' >' . $post->post_title . '</option>';
460
- }
461
-
462
- $html .= '</select>';
463
- if ( $check_value && get_post_type( $check_value ) ) {
464
- $html .= '<a href="' . esc_url( menu_page_url( 'ivory-search', false ) ) . '&post='.$check_value.'&action=edit"> ' . esc_html__( "Edit", 'ivory-search' ) . '</a>';
465
- } else {
466
- $html .= '<a href="' . esc_url( menu_page_url( 'ivory-search-new', false ) ) . '"> ' . esc_html__( "Create New", 'ivory-search' ) . '</a>';
467
- }
468
- }
469
- echo '<div>' . $html . '</div>';
470
- }
471
-
472
- /**
473
- * Displays search form close icon field.
474
- */
475
- function menu_close_icon() {
476
- $check_value = isset( $this->opt['add_search_to_menu_close_icon'] ) ? $this->opt['add_search_to_menu_close_icon'] : 0;
477
-
478
- $check_string = checked( 'add_search_to_menu_close_icon', $check_value, false );
479
-
480
- if ( $this->ivory_search ) {
481
- $check_value = isset( $this->opt['menu_close_icon'] ) ? $this->opt['menu_close_icon'] : 0;
482
- $check_string = checked( 'menu_close_icon', $check_value, false );
483
- }
484
-
485
- $html = '<input type="checkbox" id="menu_close_icon" name="ivory_search[menu_close_icon]" value="menu_close_icon" ' . $check_string . ' />';
486
- $html .= '<label for="menu_close_icon"> ' . esc_html__( 'Display Search Form Close Icon', 'ivory-search' ) . '</label>';
487
- echo '<div>' . $html . '</div>';
488
- }
489
-
490
- /**
491
- * Displays custom css field.
492
- */
493
- function custom_css() {
494
- $content = __( 'Add custom css code if any to style search form.', 'ivory-search' );
495
- IS_Help::help_info( $content );
496
-
497
- $this->opt['add_search_to_menu_css'] = isset( $this->opt['add_search_to_menu_css'] ) ? $this->opt['add_search_to_menu_css'] : '';
498
- $this->opt['custom_css'] = isset( $this->opt['custom_css'] ) ? $this->opt['custom_css'] : $this->opt['add_search_to_menu_css'];
499
- $html = '<textarea class="large-text" rows="4" id="custom_css" name="ivory_search[custom_css]" >' . esc_attr( $this->opt['custom_css'] ) . '</textarea>';
500
- echo '<div>' . $html . '</div>';
501
- }
502
-
503
- /**
504
- * Displays stopwords field.
505
- */
506
- function stopwords() {
507
- $content = __( 'Enter words here to add them to the list of stopwords. The stopwords will not be searched.', 'ivory-search' );
508
- IS_Help::help_info( $content );
509
- $this->opt['stopwords'] = isset( $this->opt['stopwords'] ) ? $this->opt['stopwords'] : '';
510
- $html = '<textarea class="large-text" rows="4" id="stopwords" name="ivory_search[stopwords]" >' . esc_attr( $this->opt['stopwords'] ) . '</textarea>';
511
- $html .= '<br /><label for="stopwords" style="font-size: 10px;">' . esc_html__( "Please separate words with commas.", 'ivory-search' ) . '</label>';
512
- echo '<div>' . $html . '</div>';
513
- }
514
-
515
- /**
516
- * Displays synonyms field.
517
- */
518
- function synonyms() {
519
- $content = __( 'Add synonyms here to make the searches find better results.', 'ivory-search' );
520
- $content .= '<br /><br />' . __( 'If you add bird = crow to the list of synonyms, searches for bird automatically become a search for bird crow and will thus match to posts that include either bird or crow.', 'ivory-search' );
521
- $content .= '<br /><br />' . __( 'This only works for search forms and in OR searches. In AND searches the synonyms only restrict the search, as now the search only finds posts that contain both bird and crow.', 'ivory-search' );
522
- IS_Help::help_info( $content );
523
-
524
- $this->opt['synonyms'] = isset( $this->opt['synonyms'] ) ? $this->opt['synonyms'] : '';
525
- $html = '<textarea class="large-text" rows="4" id="synonyms" name="ivory_search[synonyms]" >' . esc_attr( $this->opt['synonyms'] ) . '</textarea>';
526
- $html .= '<br /><label for="synonyms" style="font-size: 10px;">' . esc_html__( 'The format here is key = value;. Please separate every synonyms key = value pairs with semicolon.', 'ivory-search' ) . '</label>';
527
- $synonyms_disable = is_fs()->is_plan_or_trial( 'pro' ) ? '' : ' disabled ';
528
- $check_value = isset( $this->opt['synonyms_and'] ) ? $this->opt['synonyms_and'] : 0;
529
- $disable = checked( 1, $check_value, false );
530
- if ( '' !== $synonyms_disable ) {
531
- $html .= '<p class="upgrade-parent">'.IS_Admin::pro_link();
532
- } else {
533
- $html .= '<p>';
534
- }
535
- $html .= '<input type="checkbox" ' . $synonyms_disable . ' id="synonyms_and" name="ivory_search[synonyms_and]" value="1" ' . $disable . ' />';
536
- $html .= '<label for="synonyms_and"> ' . esc_html__( 'Disable synonyms for the search forms having AND search terms relation.', 'ivory-search' ) . '</label>';
537
- echo '</p><div>' . $html . '</div>';
538
- }
539
-
540
- /**
541
- * Displays do not load plugin files field.
542
- */
543
- function plugin_files() {
544
-
545
- $content = __( 'Configure to disable loading plugin CSS and JavaScript files.', 'ivory-search' );
546
- IS_Help::help_info( $content );
547
-
548
- $styles = array(
549
- 'css' => __( 'Plugin CSS File', 'ivory-search' ),
550
- 'js' => __( 'Plugin JavaScript File', 'ivory-search' )
551
-
552
- );
553
-
554
- $html = '';
555
- foreach ( $styles as $key => $file ) {
556
-
557
- $check_value = isset( $this->opt['do_not_load_plugin_files'][ "plugin-$key-file"] ) ? $this->opt['do_not_load_plugin_files'][ "plugin-$key-file" ] : 0;
558
-
559
- $check_string = checked( "plugin-$key-file", $check_value, false );
560
-
561
- if ( $this->ivory_search ) {
562
- $check_value = isset( $this->opt['not_load_files'][ $key] ) ? $this->opt['not_load_files'][ $key] : 0;
563
- $check_string = checked( $key, $check_value, false );
564
- }
565
-
566
- $html .= '<input type="checkbox" id="not_load_files[' . esc_attr( $key ) . ']" name="ivory_search[not_load_files][' . esc_attr( $key ) . ']" value="' . esc_attr( $key ) . '" ' . $check_string . '/>';
567
- $html .= '<label for="not_load_files[' . esc_attr( $key ) . ']"> ' . esc_html( $file ) . '</label>';
568
-
569
- if ( 'css' == $key ) {
570
- $html .= '<br /><label for="not_load_files[' . esc_attr( $key ) . ']" style="font-size: 10px;">' . esc_html__( 'If checked, you have to add following plugin file code into your child theme CSS file.', 'ivory-search' ) . '</label>';
571
- $html .= '<br /><a style="font-size: 13px;" target="_blank" href="' . plugins_url( '/public/css/ivory-search.css', IS_PLUGIN_FILE ) . '"/a>' . plugins_url( '/public/css/ivory-search.css', IS_PLUGIN_FILE ) . '</a>';
572
- $html .= '<br /><br />';
573
- } else {
574
- $html .= '<br /><label for="not_load_files[' . esc_attr( $key ) . ']" style="font-size: 10px;">' . esc_html__( "If checked, you have to add following plugin files code into your child theme JavaScript file.", 'ivory-search' ) . '</label>';
575
- $html .= '<br /><a style="font-size: 13px;" target="_blank" href="' . plugins_url( '/public/js/ivory-search.js', IS_PLUGIN_FILE ) . '"/a>' . plugins_url( '/public/js/ivory-search.js', IS_PLUGIN_FILE ) . '</a>';
576
- $html .= '<br /><a style="font-size: 13px;" target="_blank" href="' . plugins_url( '/public/js/is-highlight.js', IS_PLUGIN_FILE ) . '"/a>' . plugins_url( '/public/js/is-highlight.js', IS_PLUGIN_FILE ) . '</a>';
577
- }
578
- }
579
- echo '<div>' . $html . '</div>';
580
- }
581
  }
1
  <?php
2
+
3
  /**
4
  * Defines plugin settings fields.
5
  *
7
  *
8
  * @package IS
9
  */
10
+ class IS_Settings_Fields
11
+ {
12
+ /**
13
+ * Stores plugin options.
14
+ */
15
+ public $opt ;
16
+ /**
17
+ * Stores flag to know whether new plugin options are saved.
18
+ */
19
+ public $ivory_search = false ;
20
+ /**
21
+ * Core singleton class
22
+ * @var self
23
+ */
24
+ private static $_instance ;
25
+ private $is_premium_plugin = false ;
26
+ /**
27
+ * Instantiates the plugin by setting up the core properties and loading
28
+ * all necessary dependencies and defining the hooks.
29
+ *
30
+ * The constructor uses internal functions to import all the
31
+ * plugin dependencies, and will leverage the Ivory_Search for
32
+ * registering the hooks and the callback functions used throughout the plugin.
33
+ */
34
+ public function __construct( $is = null )
35
+ {
36
+ $new_opt = get_option( 'ivory_search' );
37
+ if ( !empty($new_opt) ) {
38
+ $this->ivory_search = true;
39
+ }
40
+
41
+ if ( null !== $is ) {
42
+ $this->opt = $is;
43
+ } else {
44
+ $old_opt = (array) get_option( 'add_search_to_menu' );
45
+ $this->opt = array_merge( $old_opt, (array) $new_opt );
46
+ }
47
+
48
+ }
49
+
50
+ /**
51
+ * Gets the instance of this class.
52
+ *
53
+ * @return self
54
+ */
55
+ public static function getInstance()
56
+ {
57
+ if ( !self::$_instance instanceof self ) {
58
+ self::$_instance = new self();
59
+ }
60
+ return self::$_instance;
61
+ }
62
+
63
+ /**
64
+ * Displays settings sections having custom markup.
65
+ */
66
+ public function is_do_settings_sections( $page )
67
+ {
68
+ global $wp_settings_sections, $wp_settings_fields ;
69
+ if ( !isset( $wp_settings_sections[$page] ) ) {
70
+ return;
71
+ }
72
+ foreach ( (array) $wp_settings_sections[$page] as $section ) {
73
+ if ( $section['title'] ) {
74
+ echo "<h2>{$section['title']}</h2>\n" ;
75
+ }
76
+ if ( $section['callback'] ) {
77
+ call_user_func( $section['callback'], $section );
78
+ }
79
+ if ( !isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) ) {
80
+ continue;
81
+ }
82
+ echo '<div class="form-table">' ;
83
+ $this->is_do_settings_fields( $page, $section['id'] );
84
+ echo '</div>' ;
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Displays settings fields having custom markup.
90
+ */
91
+ public function is_do_settings_fields( $page, $section )
92
+ {
93
+ global $wp_settings_fields ;
94
+ if ( !isset( $wp_settings_fields[$page][$section] ) ) {
95
+ return;
96
+ }
97
+ foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
98
+ $class = '';
99
+ if ( !empty($field['args']['class']) ) {
100
+ $class = ' class="' . esc_attr( $field['args']['class'] ) . '"';
101
+ }
102
+
103
+ if ( !empty($field['args']['label_for']) ) {
104
+ echo '<h3 scope="row"><label for="' . esc_attr( $field['args']['label_for'] ) . '">' . $field['title'] . '</label>' ;
105
+ } else {
106
+ echo '<h3 scope="row">' . $field['title'] ;
107
+ }
108
+
109
+ echo '<span class="actions"><span class="indicator ' . $field['id'] . '"></span><a class="expand" href="#">' . esc_html__( 'Expand All', 'ivory-search' ) . '</a><a class="collapse" href="#" style="display:none;">' . esc_html__( 'Collapse All', 'ivory-search' ) . '</a></span></h3><div>' ;
110
+ call_user_func( $field['callback'], $field['args'] );
111
+ echo '</div>' ;
112
+ }
113
+ }
114
+
115
+ /**
116
+ * Registers plugin settings fields.
117
+ */
118
+ function register_settings_fields()
119
+ {
120
+ add_settings_section(
121
+ 'ivory_search_section',
122
+ '',
123
+ array( $this, 'search_to_menu_section_desc' ),
124
+ 'ivory_search'
125
+ );
126
+ add_settings_field(
127
+ 'ivory_search_locations',
128
+ __( 'Select Menu', 'ivory-search' ),
129
+ array( $this, 'menu_locations' ),
130
+ 'ivory_search',
131
+ 'ivory_search_section'
132
+ );
133
+ $menu_search_form = ( isset( $this->opt['menu_search_form'] ) ? $this->opt['menu_search_form'] : 0 );
134
+ if ( !$menu_search_form ) {
135
+ add_settings_field(
136
+ 'ivory_search_posts',
137
+ __( 'Post Types', 'ivory-search' ),
138
+ array( $this, 'menu_post_types' ),
139
+ 'ivory_search',
140
+ 'ivory_search_section'
141
+ );
142
+ }
143
+ add_settings_field(
144
+ 'ivory_search_form',
145
+ __( 'Search Form', 'ivory-search' ),
146
+ array( $this, 'menu_search_form' ),
147
+ 'ivory_search',
148
+ 'ivory_search_section'
149
+ );
150
+ add_settings_field(
151
+ 'ivory_search_style',
152
+ __( 'Form Style', 'ivory-search' ),
153
+ array( $this, 'menu_form_style' ),
154
+ 'ivory_search',
155
+ 'ivory_search_section'
156
+ );
157
+ add_settings_field(
158
+ 'ivory_search_title',
159
+ __( 'Menu Title', 'ivory-search' ),
160
+ array( $this, 'menu_title' ),
161
+ 'ivory_search',
162
+ 'ivory_search_section'
163
+ );
164
+ add_settings_field(
165
+ 'ivory_search_classes',
166
+ __( 'Menu Classes', 'ivory-search' ),
167
+ array( $this, 'menu_classes' ),
168
+ 'ivory_search',
169
+ 'ivory_search_section'
170
+ );
171
+ add_settings_field(
172
+ 'ivory_search_gcse',
173
+ __( 'Google CSE', 'ivory-search' ),
174
+ array( $this, 'menu_google_cse' ),
175
+ 'ivory_search',
176
+ 'ivory_search_section'
177
+ );
178
+ add_settings_field(
179
+ 'ivory_search_close_icon',
180
+ __( 'Close Icon', 'ivory-search' ),
181
+ array( $this, 'menu_close_icon' ),
182
+ 'ivory_search',
183
+ 'ivory_search_section'
184
+ );
185
+ add_settings_section(
186
+ 'ivory_search_settings',
187
+ '',
188
+ array( $this, 'settings_section_desc' ),
189
+ 'ivory_search'
190
+ );
191
+ add_settings_field(
192
+ 'ivory_search_header',
193
+ __( 'Header', 'ivory-search' ),
194
+ array( $this, 'header' ),
195
+ 'ivory_search',
196
+ 'ivory_search_settings'
197
+ );
198
+ add_settings_field(
199
+ 'ivory_search_footer',
200
+ __( 'Footer', 'ivory-search' ),
201
+ array( $this, 'footer' ),
202
+ 'ivory_search',
203
+ 'ivory_search_settings'
204
+ );
205
+ add_settings_field(
206
+ 'ivory_search_display_in_header',
207
+ __( 'Mobile Display', 'ivory-search' ),
208
+ array( $this, 'menu_search_in_header' ),
209
+ 'ivory_search',
210
+ 'ivory_search_settings'
211
+ );
212
+ add_settings_field(
213
+ 'ivory_search_css',
214
+ __( 'Custom CSS', 'ivory-search' ),
215
+ array( $this, 'custom_css' ),
216
+ 'ivory_search',
217
+ 'ivory_search_settings'
218
+ );
219
+ add_settings_field(
220
+ 'ivory_search_stopwords',
221
+ __( 'Stopwords', 'ivory-search' ),
222
+ array( $this, 'stopwords' ),
223
+ 'ivory_search',
224
+ 'ivory_search_settings'
225
+ );
226
+ add_settings_field(
227
+ 'ivory_search_synonyms',
228
+ __( 'Synonyms', 'ivory-search' ),
229
+ array( $this, 'synonyms' ),
230
+ 'ivory_search',
231
+ 'ivory_search_settings'
232
+ );
233
+ add_settings_field(
234
+ 'not_load_files',
235
+ __( 'Not load files', 'ivory-search' ),
236
+ array( $this, 'plugin_files' ),
237
+ 'ivory_search',
238
+ 'ivory_search_settings'
239
+ );
240
+ add_settings_field(
241
+ 'ivory_search_disable',
242
+ __( 'Disable', 'ivory-search' ),
243
+ array( $this, 'disable' ),
244
+ 'ivory_search',
245
+ 'ivory_search_settings'
246
+ );
247
+ add_settings_field(
248
+ 'ivory_search_default',
249
+ __( 'Default Search', 'ivory-search' ),
250
+ array( $this, 'default_search' ),
251
+ 'ivory_search',
252
+ 'ivory_search_settings'
253
+ );
254
+ register_setting( 'ivory_search', 'ivory_search' );
255
+ }
256
+
257
+ /**
258
+ * Displays Search To Menu section description text.
259
+ */
260
+ function search_to_menu_section_desc()
261
+ {
262
+ echo '<h4 class="panel-desc">' . __( 'Use below options to display search in menu and configure it.', 'ivory-search' ) . '</h4>' ;
263
+ }
264
+
265
+ /**
266
+ * Displays Settings section description text.
267
+ */
268
+ function settings_section_desc()
269
+ {
270
+ echo '</div>' ;
271
+ echo '<div class="search-form-editor-panel" id="settings">' ;
272
+ echo '<h4 class="panel-desc">' . __( 'Use below options to make sitewide changes in search.', 'ivory-search' ) . '</h4>' ;
273
+ }
274
+
275
+ /**
276
+ * Displays choose menu locations field.
277
+ */
278
+ function menu_locations()
279
+ {
280
+ $content = __( 'Select menu here where you want to display search form.', 'ivory-search' );
281
+ IS_Help::help_info( $content );
282
+ $html = '';
283
+ $menus = get_registered_nav_menus();
284
+
285
+ if ( !empty($menus) ) {
286
+ $check_value = '';
287
+ foreach ( $menus as $location => $description ) {
288
+
289
+ if ( $this->ivory_search ) {
290
+ $check_value = ( isset( $this->opt['menus'][$location] ) ? $this->opt['menus'][$location] : 0 );
291
+ } else {
292
+ $check_value = ( isset( $this->opt['add_search_to_menu_locations'][$location] ) ? $this->opt['add_search_to_menu_locations'][$location] : 0 );
293
+ }
294
+
295
+ $html .= '<p><label for="is_menus' . esc_attr( $location ) . '"><input type="checkbox" class="ivory_search_locations" id="is_menus' . esc_attr( $location ) . '" name="ivory_search[menus][' . esc_attr( $location ) . ']" value="' . esc_attr( $location ) . '" ' . checked( $location, $check_value, false ) . '/>';
296
+ $html .= '<span class="toggle-check-text"></span> ' . esc_html( $description ) . '</label></p>';
297
+ }
298
+ } else {
299
+ $html = __( 'No navigation menu registered on your site.', 'ivory-search' );
300
+ }
301
+
302
+ echo '<div>' . $html . '</div>' ;
303
+ }
304
+
305
+ /**
306
+ * Displays post types field.
307
+ */
308
+ function menu_post_types()
309
+ {
310
+ $content = __( 'Select post types here that you want to make searchable.', 'ivory-search' );
311
+ IS_Help::help_info( $content );
312
+ $html = '';
313
+ $args = array(
314
+ 'exclude_from_search' => false,
315
+ );
316
+ $posts = get_post_types( $args );
317
+
318
+ if ( !empty($posts) ) {
319
+ foreach ( $posts as $key => $post ) {
320
+ $check_value = ( isset( $this->opt['add_search_to_menu_posts'][$key] ) && !$this->ivory_search ? $this->opt['add_search_to_menu_posts'][$key] : 0 );
321
+ $check_value = ( isset( $this->opt['menu_posts'][$key] ) ? $this->opt['menu_posts'][$key] : $check_value );
322
+ $html .= '<p><label for="is_menu_posts' . esc_attr( $key ) . '"><input class="ivory_search_posts" type="checkbox" id="is_menu_posts' . esc_attr( $key ) . '" name="ivory_search[menu_posts][' . esc_attr( $key ) . ']" value="' . esc_attr( $key ) . '" ' . checked( $key, $check_value, false ) . '/>';
323
+ $html .= '<span class="toggle-check-text"></span>' . ucfirst( esc_html( $post ) ) . '</label></p>';
324
+ }
325
+ } else {
326
+ $html = __( 'No post types registered on your site.', 'ivory-search' );
327
+ }
328
+
329
+ echo '<div>' . $html . '</div>' ;
330
+ }
331
+
332
+ /**
333
+ * Displays menu search form field.
334
+ */
335
+ function menu_search_form()
336
+ {
337
+ $content = __( 'Select search form that will control search performed using menu search.', 'ivory-search' );
338
+ $content .= '<br />';
339
+ $content .= __( 'It overwrites above Post Types option.', 'ivory-search' );
340
+ IS_Help::help_info( $content );
341
+ $html = '';
342
+ $form_disable = ( is_fs()->is_plan_or_trial( 'pro' ) && $this->is_premium_plugin ? false : true );
343
+
344
+ if ( $form_disable ) {
345
+ $html .= '<p>' . IS_Admin::pro_link();
346
+ $html .= '<select class="ivory_search_form" disabled id="menu_search_form" name="ivory_search[menu_search_form]" >';
347
+ $html .= '<option value="0" selected="selected">' . __( 'none', 'ivory-search' ) . '</option>';
348
+ $html .= '</select></p>';
349
+ } else {
350
+ $args = array(
351
+ 'numberposts' => -1,
352
+ 'post_type' => 'is_search_form',
353
+ );
354
+ $posts = get_posts( $args );
355
+
356
+ if ( !empty($posts) ) {
357
+ $check_value = ( isset( $this->opt['menu_search_form'] ) ? $this->opt['menu_search_form'] : 0 );
358
+ $html .= '<p><select class="ivory_search_form" id="menu_search_form" name="ivory_search[menu_search_form]" >';
359
+ $html .= '<option value="0" ' . selected( 0, $check_value, false ) . '>' . __( 'none', 'ivory-search' ) . '</option>';
360
+ foreach ( $posts as $post ) {
361
+ $html .= '<option value="' . $post->ID . '"' . selected( $post->ID, $check_value, false ) . ' >' . $post->post_title . '</option>';
362
+ }
363
+ $html .= '</select>';
364
+
365
+ if ( $check_value && get_post_type( $check_value ) ) {
366
+ $html .= '<a href="' . esc_url( menu_page_url( 'ivory-search', false ) ) . '&post=' . $check_value . '&action=edit"> ' . esc_html__( "Edit", 'ivory-search' ) . '</a>';
367
+ } else {
368
+ $html .= '<a href="' . esc_url( menu_page_url( 'ivory-search-new', false ) ) . '"> ' . esc_html__( "Create New", 'ivory-search' ) . '</a>';
369
+ }
370
+
371
+ $html .= '</p>';
372
+ }
373
+
374
+ }
375
+
376
+ echo '<div>' . $html . '</div>' ;
377
+ }
378
+
379
+ /**
380
+ * Displays form style field.
381
+ */
382
+ function menu_form_style()
383
+ {
384
+ $content = __( 'Select form style for the search form displayed in the menu.', 'ivory-search' );
385
+ IS_Help::help_info( $content );
386
+ $styles = array(
387
+ 'default' => __( 'Default', 'ivory-search' ),
388
+ 'dropdown' => __( 'Dropdown', 'ivory-search' ),
389
+ 'sliding' => __( 'Sliding', 'ivory-search' ),
390
+ 'full-width-menu' => __( 'Full Width', 'ivory-search' ),
391
+ 'popup' => __( 'Popup', 'ivory-search' ),
392
+ );
393
+ $popup_disable = ( is_fs()->is_plan_or_trial( 'pro' ) && $this->is_premium_plugin ? false : true );
394
+
395
+ if ( empty($this->opt) || !isset( $this->opt['add_search_to_menu_style'] ) && !isset( $this->opt['menu_style'] ) ) {
396
+ $this->opt['menu_style'] = 'default';
397
+ update_option( 'ivory_search', $this->opt );
398
+ }
399
+
400
+ $html = '';
401
+ $check_value = ( isset( $this->opt['add_search_to_menu_style'] ) ? $this->opt['add_search_to_menu_style'] : 'default' );
402
+ $check_value = ( isset( $this->opt['menu_style'] ) ? $this->opt['menu_style'] : $check_value );
403
+ foreach ( $styles as $key => $style ) {
404
+
405
+ if ( $popup_disable && 'popup' === $key ) {
406
+ $html .= '<p class="upgrade-parent">' . IS_Admin::pro_link();
407
+ } else {
408
+ $html .= '<p>';
409
+ }
410
+
411
+ $html .= '<label for="is_menu_style' . esc_attr( $key ) . '"><input class="ivory_search_style" type="radio" id="is_menu_style' . esc_attr( $key ) . '" name="ivory_search[menu_style]"';
412
+ $html .= ( $popup_disable && 'popup' === $key ? ' disabled ' : '' );
413
+ $html .= 'name="ivory_search[menu_style]" value="' . esc_attr( $key ) . '" ' . checked( $key, $check_value, false ) . '/>';
414
+ $html .= '<span class="toggle-check-text"></span>' . esc_html( $style ) . '</label>';
415
+ $html .= '</p>';
416
+ }
417
+ echo '<div>' . $html . '</div>' ;
418
+ }
419
+
420
+ /**
421
+ * Displays search menu title field.
422
+ */
423
+ function menu_title()
424
+ {
425
+ $content = __( 'Displays set menu title text in place of search icon displays in navigation menu.', 'ivory-search' );
426
+ IS_Help::help_info( $content );
427
+ $this->opt['add_search_to_menu_title'] = ( isset( $this->opt['add_search_to_menu_title'] ) ? $this->opt['add_search_to_menu_title'] : '' );
428
+ $this->opt['menu_title'] = ( isset( $this->opt['menu_title'] ) ? $this->opt['menu_title'] : $this->opt['add_search_to_menu_title'] );
429
+ $html = '<input class="ivory_search_title" type="text" class="ivory_search_title" id="is_menu_title" name="ivory_search[menu_title]" value="' . esc_attr( $this->opt['menu_title'] ) . '" />';
430
+ echo '<div>' . $html . '</div>' ;
431
+ }
432
+
433
+ /**
434
+ * Displays search menu classes field.
435
+ */
436
+ function menu_classes()
437
+ {
438
+ $content = __( 'Adds set classes in the search navigation menu item.', 'ivory-search' );
439
+ IS_Help::help_info( $content );
440
+ $this->opt['add_search_to_menu_classes'] = ( isset( $this->opt['add_search_to_menu_classes'] ) ? $this->opt['add_search_to_menu_classes'] : '' );
441
+ $this->opt['menu_classes'] = ( isset( $this->opt['menu_classes'] ) ? $this->opt['menu_classes'] : $this->opt['add_search_to_menu_classes'] );
442
+ $html = '<input class="ivory_search_classes" type="text" class="ivory_search_classes" id="is_menu_classes" name="ivory_search[menu_classes]" value="' . esc_attr( $this->opt['menu_classes'] ) . '" />';
443
+ $html .= '<br /><label for="is_menu_classes" style="font-size: 10px;">' . esc_html__( "Add classes seperated by space.", 'ivory-search' ) . '</label>';
444
+ echo '<div>' . $html . '</div>' ;
445
+ }
446
+
447
+ /**
448
+ * Displays google cse field.
449
+ */
450
+ function menu_google_cse()
451
+ {
452
+ $content = __( 'Add only Google Custom Search( CSE ) search form code in the above text box that will replace default search form.', 'ivory-search' );
453
+ IS_Help::help_info( $content );
454
+ $this->opt['add_search_to_menu_gcse'] = ( isset( $this->opt['add_search_to_menu_gcse'] ) ? $this->opt['add_search_to_menu_gcse'] : '' );
455
+ $this->opt['menu_gcse'] = ( isset( $this->opt['menu_gcse'] ) ? $this->opt['menu_gcse'] : $this->opt['add_search_to_menu_gcse'] );
456
+ $html = '<input class="ivory_search_gcse" type="text" class="large-text" id="is_menu_gcse" name="ivory_search[menu_gcse]" value="' . esc_attr( $this->opt['menu_gcse'] ) . '" />';
457
+ echo '<div>' . $html . '</div>' ;
458
+ }
459
+
460
+ /**
461
+ * Displays display in header field.
462
+ */
463
+ function menu_search_in_header()
464
+ {
465
+ $content = __( 'Note: Does not work with caching as this functionality uses the WordPress wp_is_mobile function.', 'ivory-search' );
466
+ IS_Help::help_info( $content );
467
+ $check_value = ( isset( $this->opt['add_search_to_menu_display_in_header'] ) ? $this->opt['add_search_to_menu_display_in_header'] : 0 );
468
+ $check_string = checked( 'add_search_to_menu_display_in_header', $check_value, false );
469
+
470
+ if ( $this->ivory_search ) {
471
+ $check_value = ( isset( $this->opt['header_menu_search'] ) ? $this->opt['header_menu_search'] : 0 );
472
+ $check_string = checked( 'header_menu_search', $check_value, false );
473
+ }
474
+
475
+ $html = '<label for="is_search_in_header"><input class="ivory_search_display_in_header" type="checkbox" id="is_search_in_header" name="ivory_search[header_menu_search]" value="header_menu_search" ' . $check_string . ' />';
476
+ $html .= '<span class="toggle-check-text"></span>' . esc_html__( 'Display search form in header on mobile devices', 'ivory-search' ) . '</label>';
477
+ echo '<div>' . $html . '</div><br />' ;
478
+ $html = '';
479
+ $content = __( 'Use this option to display search form in your site header and hide the search form on desktop using CSS code.', 'ivory-search' );
480
+ IS_Help::help_info( $content );
481
+ $check_value = ( isset( $this->opt['astm_site_uses_cache'] ) ? $this->opt['astm_site_uses_cache'] : 0 );
482
+ $check_string = checked( 'astm_site_uses_cache', $check_value, false );
483
+
484
+ if ( $this->ivory_search ) {
485
+ $check_value = ( isset( $this->opt['site_uses_cache'] ) ? $this->opt['site_uses_cache'] : 0 );
486
+ $check_string = checked( 'site_uses_cache', $check_value, false );
487
+ }
488
+
489
+ $html .= '<label for="is_site_uses_cache"><input class="ivory_search_display_in_header" type="checkbox" id="is_site_uses_cache" name="ivory_search[site_uses_cache]" value="site_uses_cache" ' . $check_string . ' />';
490
+ $html .= '<span class="toggle-check-text"></span>' . esc_html__( 'This site uses cache', 'ivory-search' ) . '</label>';
491
+ echo '<div>' . $html . '</div>' ;
492
+ }
493
+
494
+ /**
495
+ * Disables search functionality on whole site.
496
+ */
497
+ function disable()
498
+ {
499
+ $check_value = ( isset( $this->opt['disable'] ) ? $this->opt['disable'] : 0 );
500
+ $disable = checked( 1, $check_value, false );
501
+ $html = '<label for="is_disable"><input class="ivory_search_disable" type="checkbox" id="is_disable" name="ivory_search[disable]" value="1" ' . $disable . ' />';
502
+ $html .= '<span class="toggle-check-text"></span>' . esc_html__( 'Disable search functionality on whole site.', 'ivory-search' ) . '</label>';
503
+ echo '<div>' . $html . '</div>' ;
504
+ }
505
+
506
+ /**
507
+ * Controls default search functionality.
508
+ */
509
+ function default_search()
510
+ {
511
+ $check_value = ( isset( $this->opt['default_search'] ) ? $this->opt['default_search'] : 0 );
512
+ $disable = checked( 1, $check_value, false );
513
+ $html = '<label for="is_default_search"><input class="ivory_search_default" type="checkbox" id="is_default_search" name="ivory_search[default_search]" value="1" ' . $disable . ' />';
514
+ $html .= '<span class="toggle-check-text"></span>' . esc_html__( 'Do not use default search form to control WordPress default search functionality.', 'ivory-search' ) . '</label>';
515
+ echo '<div>' . $html . '</div>' ;
516
+ }
517
+
518
+ /**
519
+ * Displays search form in site header.
520
+ */
521
+ function header()
522
+ {
523
+ $content = __( 'Displays search form in site header using wp_head hook.', 'ivory-search' );
524
+ IS_Help::help_info( $content );
525
+ $html = '';
526
+ $args = array(
527
+ 'numberposts' => -1,
528
+ 'post_type' => 'is_search_form',
529
+ );
530
+ $posts = get_posts( $args );
531
+
532
+ if ( !empty($posts) ) {
533
+ $check_value = ( isset( $this->opt['header_search'] ) ? $this->opt['header_search'] : 0 );
534
+ $html .= '<select class="ivory_search_header" id="is_header_search" name="ivory_search[header_search]" >';
535
+ $html .= '<option value="0" ' . selected( 0, $check_value, false ) . '>' . __( 'none', 'ivory-search' ) . '</option>';
536
+ foreach ( $posts as $post ) {
537
+ $html .= '<option value="' . $post->ID . '"' . selected( $post->ID, $check_value, false ) . ' >' . $post->post_title . '</option>';
538
+ }
539
+ $html .= '</select>';
540
+
541
+ if ( $check_value && get_post_type( $check_value ) ) {
542
+ $html .= '<a href="' . esc_url( menu_page_url( 'ivory-search', false ) ) . '&post=' . $check_value . '&action=edit"> ' . esc_html__( "Edit", 'ivory-search' ) . '</a>';
543
+ } else {
544
+ $html .= '<a href="' . esc_url( menu_page_url( 'ivory-search-new', false ) ) . '"> ' . esc_html__( "Create New", 'ivory-search' ) . '</a>';
545
+ }
546
+
547
+ }
548
+
549
+ echo '<div>' . $html . '</div>' ;
550
+ }
551
+
552
+ /**
553
+ * Displays search form in site footer.
554
+ */
555
+ function footer()
556
+ {
557
+ $content = __( 'Displays search form in site footer using wp_footer hook.', 'ivory-search' );
558
+ IS_Help::help_info( $content );
559
+ $html = '';
560
+ $args = array(
561
+ 'numberposts' => -1,
562
+ 'post_type' => 'is_search_form',
563
+ );
564
+ $posts = get_posts( $args );
565
+
566
+ if ( !empty($posts) ) {
567
+ $check_value = ( isset( $this->opt['footer_search'] ) ? $this->opt['footer_search'] : 0 );
568
+ $html .= '<select class="ivory_search_footer" id="is_footer_search" name="ivory_search[footer_search]" >';
569
+ $html .= '<option value="0" ' . selected( 0, $check_value, false ) . '>' . __( 'none', 'ivory-search' ) . '</option>';
570
+ foreach ( $posts as $post ) {
571
+ $html .= '<option value="' . $post->ID . '"' . selected( $post->ID, $check_value, false ) . ' >' . $post->post_title . '</option>';
572
+ }
573
+ $html .= '</select>';
574
+
575
+ if ( $check_value && get_post_type( $check_value ) ) {
576
+ $html .= '<a href="' . esc_url( menu_page_url( 'ivory-search', false ) ) . '&post=' . $check_value . '&action=edit"> ' . esc_html__( "Edit", 'ivory-search' ) . '</a>';
577
+ } else {
578
+ $html .= '<a href="' . esc_url( menu_page_url( 'ivory-search-new', false ) ) . '"> ' . esc_html__( "Create New", 'ivory-search' ) . '</a>';
579
+ }
580
+
581
+ }
582
+
583
+ echo '<div>' . $html . '</div>' ;
584
+ }
585
+
586
+ /**
587
+ * Displays search form close icon field.
588
+ */
589
+ function menu_close_icon()
590
+ {
591
+ $check_value = ( isset( $this->opt['add_search_to_menu_close_icon'] ) ? $this->opt['add_search_to_menu_close_icon'] : 0 );
592
+ $check_string = checked( 'add_search_to_menu_close_icon', $check_value, false );
593
+
594
+ if ( $this->ivory_search ) {
595
+ $check_value = ( isset( $this->opt['menu_close_icon'] ) ? $this->opt['menu_close_icon'] : 0 );
596
+ $check_string = checked( 'menu_close_icon', $check_value, false );
597
+ }
598
+
599
+ $html = '<label for="menu_close_icon"><input class="ivory_search_close_icon" type="checkbox" id="menu_close_icon" name="ivory_search[menu_close_icon]" value="menu_close_icon" ' . $check_string . ' />';
600
+ $html .= '<span class="toggle-check-text"></span>' . esc_html__( 'Display Search Form Close Icon', 'ivory-search' ) . '</label>';
601
+ echo '<div>' . $html . '</div>' ;
602
+ }
603
+
604
+ /**
605
+ * Displays custom css field.
606
+ */
607
+ function custom_css()
608
+ {
609
+ $content = __( 'Add custom css code if any to style search form.', 'ivory-search' );
610
+ IS_Help::help_info( $content );
611
+ $this->opt['add_search_to_menu_css'] = ( isset( $this->opt['add_search_to_menu_css'] ) ? $this->opt['add_search_to_menu_css'] : '' );
612
+ $this->opt['custom_css'] = ( isset( $this->opt['custom_css'] ) ? $this->opt['custom_css'] : $this->opt['add_search_to_menu_css'] );
613
+ $html = '<textarea class="ivory_search_css" rows="4" id="custom_css" name="ivory_search[custom_css]" >' . esc_attr( $this->opt['custom_css'] ) . '</textarea>';
614
+ echo '<div>' . $html . '</div>' ;
615
+ }
616
+
617
+ /**
618
+ * Displays stopwords field.
619
+ */
620
+ function stopwords()
621
+ {
622
+ $content = __( 'Enter words here to add them to the list of stopwords. The stopwords will not be searched.', 'ivory-search' );
623
+ $content .= '<br />' . __( 'This works with search form.', 'ivory-search' );
624
+ IS_Help::help_info( $content );
625
+ $this->opt['stopwords'] = ( isset( $this->opt['stopwords'] ) ? $this->opt['stopwords'] : '' );
626
+ $html = '<textarea class="ivory_search_stopwords" rows="4" id="stopwords" name="ivory_search[stopwords]" >' . esc_attr( $this->opt['stopwords'] ) . '</textarea>';
627
+ $html .= '<br /><label for="stopwords" style="font-size: 10px;">' . esc_html__( "Please separate words with commas.", 'ivory-search' ) . '</label>';
628
+ echo '<div>' . $html . '</div>' ;
629
+ }
630
+
631
+ /**
632
+ * Displays synonyms field.
633
+ */
634
+ function synonyms()
635
+ {
636
+ $content = __( 'Add synonyms here to make the searches find better results.', 'ivory-search' );
637
+ $content .= '<br /><br />' . __( 'If you add bird = crow to the list of synonyms, searches for bird automatically become a search for bird crow and will thus match to posts that include either bird or crow.', 'ivory-search' );
638
+ $content .= '<br /><br />' . __( 'This only works for search forms and in OR searches. In AND searches the synonyms only restrict the search, as now the search only finds posts that contain both bird and crow.', 'ivory-search' );
639
+ IS_Help::help_info( $content );
640
+ $this->opt['synonyms'] = ( isset( $this->opt['synonyms'] ) ? $this->opt['synonyms'] : '' );
641
+ $html = '<textarea class="ivory_search_synonyms" rows="4" id="synonyms" name="ivory_search[synonyms]" >' . esc_attr( $this->opt['synonyms'] ) . '</textarea>';
642
+ $html .= '<br /><label for="synonyms" style="font-size: 10px;">' . esc_html__( 'The format here is key = value;. Please separate every synonyms key = value pairs with semicolon.', 'ivory-search' ) . '</label>';
643
+ $synonyms_disable = ( is_fs()->is_plan_or_trial( 'pro' ) && $this->is_premium_plugin ? '' : ' disabled ' );
644
+ $check_value = ( isset( $this->opt['synonyms_and'] ) ? $this->opt['synonyms_and'] : 0 );
645
+ $disable = checked( 1, $check_value, false );
646
+
647
+ if ( '' !== $synonyms_disable ) {
648
+ $html .= '<p class="upgrade-parent">' . IS_Admin::pro_link();
649
+ } else {
650
+ $html .= '<p>';
651
+ }
652
+
653
+ $html .= '<label for="synonyms_and"><input class="ivory_search_synonyms" type="checkbox" ' . $synonyms_disable . ' id="synonyms_and" name="ivory_search[synonyms_and]" value="1" ' . $disable . ' />';
654
+ $html .= '<span class="toggle-check-text"></span>' . esc_html__( 'Disable synonyms for the search forms having AND search terms relation.', 'ivory-search' ) . '</label>';
655
+ echo '</p><div>' . $html . '</div>' ;
656
+ }
657
+
658
+ /**
659
+ * Displays do not load plugin files field.
660
+ */
661
+ function plugin_files()
662
+ {
663
+ $content = __( 'Configure to disable loading plugin CSS and JavaScript files.', 'ivory-search' );
664
+ IS_Help::help_info( $content );
665
+ $styles = array(
666
+ 'css' => __( 'Plugin CSS File', 'ivory-search' ),
667
+ 'js' => __( 'Plugin JavaScript File', 'ivory-search' ),
668
+ );
669
+ $html = '';
670
+ foreach ( $styles as $key => $file ) {
671
+ $check_value = ( isset( $this->opt['do_not_load_plugin_files']["plugin-{$key}-file"] ) ? $this->opt['do_not_load_plugin_files']["plugin-{$key}-file"] : 0 );
672
+ $check_string = checked( "plugin-{$key}-file", $check_value, false );
673
+
674
+ if ( $this->ivory_search ) {
675
+ $check_value = ( isset( $this->opt['not_load_files'][$key] ) ? $this->opt['not_load_files'][$key] : 0 );
676
+ $check_string = checked( $key, $check_value, false );
677
+ }
678
+
679
+ $html .= '<label for="not_load_files[' . esc_attr( $key ) . ']"><input class="not_load_files" type="checkbox" id="not_load_files[' . esc_attr( $key ) . ']" name="ivory_search[not_load_files][' . esc_attr( $key ) . ']" value="' . esc_attr( $key ) . '" ' . $check_string . '/>';
680
+ $html .= '<span class="toggle-check-text"></span>' . esc_html( $file ) . '</label>';
681
+
682
+ if ( 'css' == $key ) {
683
+ $html .= '<br /><label for="not_load_files[' . esc_attr( $key ) . ']" style="font-size: 10px;">' . esc_html__( 'If checked, you have to add following plugin file code into your child theme CSS file.', 'ivory-search' ) . '</label>';
684
+ $html .= '<br /><a style="font-size: 13px;" target="_blank" href="' . plugins_url( '/public/css/ivory-search.css', IS_PLUGIN_FILE ) . '"/a>' . plugins_url( '/public/css/ivory-search.css', IS_PLUGIN_FILE ) . '</a>';
685
+ $html .= '<br /><br />';
686
+ } else {
687
+ $html .= '<br /><label for="not_load_files[' . esc_attr( $key ) . ']" style="font-size: 10px;">' . esc_html__( "If checked, you have to add following plugin files code into your child theme JavaScript file.", 'ivory-search' ) . '</label>';
688
+ $html .= '<br /><a style="font-size: 13px;" target="_blank" href="' . plugins_url( '/public/js/ivory-search.js', IS_PLUGIN_FILE ) . '"/a>' . plugins_url( '/public/js/ivory-search.js', IS_PLUGIN_FILE ) . '</a>';
689
+ $html .= '<br /><a style="font-size: 13px;" target="_blank" href="' . plugins_url( '/public/js/is-highlight.js', IS_PLUGIN_FILE ) . '"/a>' . plugins_url( '/public/js/is-highlight.js', IS_PLUGIN_FILE ) . '</a>';
690
+ }
691
+
692
+ }
693
+ echo '<div>' . $html . '</div>' ;
694
+ }
695
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
696
  }
admin/css/ivory-search-admin.css CHANGED
@@ -2,11 +2,14 @@ br {
2
  clear: both;
3
  }
4
 
5
- #search-form-editor .check-radio input{
6
- display: none;
 
7
  }
8
 
9
- #search-form-editor .check-radio input {
 
 
10
  width: 1px;
11
  height: 1px;
12
  position: absolute;
@@ -16,8 +19,10 @@ br {
16
  z-index: 99999;
17
  }
18
 
19
- .check-radio .toggle-check-text {
 
20
  display: inline-block;
 
21
  position: relative;
22
  text-transform: uppercase;
23
  background: #CCC;
@@ -33,7 +38,8 @@ br {
33
  vertical-align: middle;
34
  }
35
 
36
- .check-radio .toggle-check-text:after {
 
37
  content: ' ';
38
  display: block;
39
  background: #FFF;
@@ -46,21 +52,22 @@ br {
46
  transition: left 0.15s, margin-left 0.15s;
47
  }
48
 
49
- .check-radio .toggle-check-text:before {
 
50
  content: ' ';
51
  }
52
 
53
- .check-radio input:checked ~ .toggle-check-text {
54
  background: #8ad869;
55
  padding-left: 10px;
56
  padding-right: 17px;
57
  }
58
 
59
- .check-radio input:checked ~ .toggle-check-text:before {
60
  content: ' ';
61
  }
62
 
63
- .check-radio input:checked ~ .toggle-check-text:after {
64
  left: 100%;
65
  margin-left: -16px;
66
  }
@@ -105,7 +112,11 @@ br {
105
  }
106
 
107
  #submitdiv.searchbox input.copy.button {
108
- background:#0073aa;
 
 
 
 
109
  }
110
 
111
  #submitdiv.searchbox #delete-action {
@@ -472,6 +483,16 @@ h4.panel-desc {
472
  float: right;
473
  }
474
 
 
 
 
 
 
 
 
 
 
 
475
  .form-table h3 .actions a {
476
  color: #FFF;
477
  text-decoration: none;
2
  clear: both;
3
  }
4
 
5
+ #search-form-editor textarea,
6
+ #search-form-editor input[type=text] {
7
+ width: 99%;
8
  }
9
 
10
+ #search-form-editor input[type=checkbox],
11
+ #search-form-editor input[type=radio] {
12
+ display: none;
13
  width: 1px;
14
  height: 1px;
15
  position: absolute;
19
  z-index: 99999;
20
  }
21
 
22
+ #search-form-editor input[type=checkbox] + .toggle-check-text,
23
+ #search-form-editor input[type=radio] + .toggle-check-text {
24
  display: inline-block;
25
+ box-sizing: content-box;
26
  position: relative;
27
  text-transform: uppercase;
28
  background: #CCC;
38
  vertical-align: middle;
39
  }
40
 
41
+ #search-form-editor input[type=checkbox] + .toggle-check-text:after,
42
+ #search-form-editor input[type=radio] + .toggle-check-text:after {
43
  content: ' ';
44
  display: block;
45
  background: #FFF;
52
  transition: left 0.15s, margin-left 0.15s;
53
  }
54
 
55
+ #search-form-editor input[type=checkbox] + .toggle-check-text:before,
56
+ #search-form-editor input[type=radio] + .toggle-check-text:before {
57
  content: ' ';
58
  }
59
 
60
+ #search-form-editor input:checked ~ .toggle-check-text {
61
  background: #8ad869;
62
  padding-left: 10px;
63
  padding-right: 17px;
64
  }
65
 
66
+ #search-form-editor input:checked ~ .toggle-check-text:before {
67
  content: ' ';
68
  }
69
 
70
+ #search-form-editor input:checked ~ .toggle-check-text:after {
71
  left: 100%;
72
  margin-left: -16px;
73
  }
112
  }
113
 
114
  #submitdiv.searchbox input.copy.button {
115
+ background: #0073aa;
116
+ }
117
+
118
+ #submitdiv.searchbox input.reset.button {
119
+ background: #009688;
120
  }
121
 
122
  #submitdiv.searchbox #delete-action {
483
  float: right;
484
  }
485
 
486
+ .form-table h3 .actions .indicator {
487
+ height: 10px;
488
+ background-color: #0ede7b;
489
+ width: 10px;
490
+ display: none;
491
+ border-radius: 100%;
492
+ float: left;
493
+ margin-top: 5px;
494
+ }
495
+
496
  .form-table h3 .actions a {
497
  color: #FFF;
498
  text-decoration: none;
admin/js/ivory-search-admin.js CHANGED
@@ -74,6 +74,10 @@
74
  } else {
75
  $(this).attr('selected', 'selected' );
76
  }
 
 
 
 
77
  return false;
78
  } );
79
 
@@ -107,6 +111,20 @@
107
 
108
  ivory_search.titleHint();
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  var changed = false;
111
 
112
  $(document).on("submit", "form", function(event){
74
  } else {
75
  $(this).attr('selected', 'selected' );
76
  }
77
+ var ind_class = $(this).parent().attr("class");
78
+ if ( ind_class !== null ) {
79
+ $('.form-table h3 .indicator.'+ind_class).fadeOut().fadeIn();
80
+ }
81
  return false;
82
  } );
83
 
111
 
112
  ivory_search.titleHint();
113
 
114
+ $('#search-form-editor .ind-status').each(function(){
115
+ var ind_class = $(this).attr('class').split(' ')[1];
116
+ if ( ind_class !== null ) {
117
+ $('.form-table h3 .indicator.'+ind_class).fadeIn();
118
+ }
119
+ } );
120
+
121
+ $('#search-form-editor').on('keyup change paste', 'input, select, textarea', function( e ){
122
+ var ind_class = $(e.target).attr("class");
123
+ if ( ind_class !== null ) {
124
+ $('.form-table h3 .indicator.'+ind_class).fadeOut().fadeIn();
125
+ }
126
+ } );
127
+
128
  var changed = false;
129
 
130
  $(document).on("submit", "form", function(event){
admin/partials/new-search-form.php CHANGED
@@ -166,6 +166,10 @@ if ( ! defined( 'ABSPATH' ) ) {
166
  $copy_nonce = wp_create_nonce( 'is-copy-search-form_' . $post_id );
167
  ?>
168
  <input type="submit" name="is-copy" class="copy button" value="<?php echo esc_attr( __( 'Duplicate', 'ivory-search' ) ); ?>" <?php echo "onclick=\"this.form._wpnonce.value = '$copy_nonce'; this.form.action.value = 'copy'; return true;\""; ?> />
 
 
 
 
169
  </div><!-- #minor-publishing-actions -->
170
  <?php endif; ?>
171
  </div><!-- #submitpost -->
166
  $copy_nonce = wp_create_nonce( 'is-copy-search-form_' . $post_id );
167
  ?>
168
  <input type="submit" name="is-copy" class="copy button" value="<?php echo esc_attr( __( 'Duplicate', 'ivory-search' ) ); ?>" <?php echo "onclick=\"this.form._wpnonce.value = '$copy_nonce'; this.form.action.value = 'copy'; return true;\""; ?> />
169
+ <?php
170
+ $reset_nonce = wp_create_nonce( 'is-reset-search-form_' . $post_id );
171
+ ?>
172
+ <p><input type="submit" name="is-reset" class="reset button" value="<?php echo esc_attr( __( 'Reset', 'ivory-search' ) ); ?>" <?php echo "onclick=\"if (confirm('" . esc_js( __( "You are about to reset this search form.\n 'Cancel' to stop, 'OK' to reset.", 'ivory-search' ) ) . "')) {this.form._wpnonce.value = '$reset_nonce'; this.form.action.value = 'reset'; return true;} return false;\""; ?> /></p>
173
  </div><!-- #minor-publishing-actions -->
174
  <?php endif; ?>
175
  </div><!-- #submitpost -->
includes/freemius.php CHANGED
@@ -26,10 +26,6 @@ function is_fs()
26
  'has_addons' => false,
27
  'has_paid_plans' => true,
28
  'has_affiliation' => 'selected',
29
- 'trial' => array(
30
- 'days' => 7,
31
- 'is_require_payment' => false,
32
- ),
33
  'menu' => array(
34
  'slug' => 'ivory-search',
35
  'support' => false,
26
  'has_addons' => false,
27
  'has_paid_plans' => true,
28
  'has_affiliation' => 'selected',
 
 
 
 
29
  'menu' => array(
30
  'slug' => 'ivory-search',
31
  'support' => false,
languages/default.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Ivory Search\n"
4
- "POT-Creation-Date: 2018-08-30 16:16+0530\n"
5
- "PO-Revision-Date: 2018-08-30 16:16+0530\n"
6
  "Last-Translator: \n"
7
  "Language-Team: Ivory Search <admin@ivorysearch.com>\n"
8
  "Language: en_US\n"
@@ -16,17 +16,17 @@ msgstr ""
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
  "X-Poedit-SearchPath-0: ..\n"
18
 
19
- #: ../admin/class-is-admin.php:73
20
  msgid "The changes you made will be lost if you navigate away from this page."
21
  msgstr ""
22
 
23
- #: ../admin/class-is-admin.php:94 ../admin/class-is-help.php:111
24
- #: ../admin/partials/new-search-form.php:181
25
  #: ../admin/partials/settings-form.php:91
26
  msgid "Support"
27
  msgstr ""
28
 
29
- #: ../admin/class-is-admin.php:116
30
  #, php-format
31
  msgid ""
32
  "To configure <em>Ivory Search plugin</em> please visit its <a href=\"%1$s"
@@ -35,574 +35,590 @@ msgid ""
35
  "target=\"_blank\">contact us page</a>."
36
  msgstr ""
37
 
38
- #: ../admin/class-is-admin.php:222
39
  msgid "Search form created."
40
  msgstr ""
41
 
42
- #: ../admin/class-is-admin.php:224
43
  msgid "Search form saved."
44
  msgstr ""
45
 
46
- #: ../admin/class-is-admin.php:226
47
  msgid "Search form deleted."
48
  msgstr ""
49
 
50
- #: ../admin/class-is-admin.php:235
 
 
 
 
51
  msgid "There was an error saving the search form."
52
  msgstr ""
53
 
54
- #: ../admin/class-is-admin.php:243
55
  msgid "There was a validation error saving the search form."
56
  msgstr ""
57
 
58
- #: ../admin/class-is-admin.php:245
59
  #, php-format
60
  msgid ""
61
  "Please make sure you have not selected similar %s fields in the search form "
62
  "Includes and Excludes sections."
63
  msgstr ""
64
 
65
- #: ../admin/class-is-admin.php:255 ../includes/class-is-widget.php:13
66
  #: ../includes/class-is-widget.php:45
67
  msgid "Ivory Search"
68
  msgstr ""
69
 
70
- #: ../admin/class-is-admin.php:257 ../admin/class-is-admin.php:295
71
  #: ../includes/class-is-search-form.php:59
72
  msgid "Search Forms"
73
  msgstr ""
74
 
75
- #: ../admin/class-is-admin.php:260 ../admin/partials/new-search-form.php:21
76
  msgid "Add New Search Form"
77
  msgstr ""
78
 
79
- #: ../admin/class-is-admin.php:260 ../admin/class-is-admin.php:302
80
  #: ../admin/partials/new-search-form.php:31
81
  msgid "Add New"
82
  msgstr ""
83
 
84
- #: ../admin/class-is-admin.php:263 ../admin/partials/settings-form.php:20
85
  msgid "Ivory Search Settings"
86
  msgstr ""
87
 
88
- #: ../admin/class-is-admin.php:263 ../admin/class-is-help.php:64
89
  msgid "Settings"
90
  msgstr ""
91
 
92
- #: ../admin/class-is-admin.php:308
93
  #, php-format
94
  msgid "Search results for &#8220;%s&#8221;"
95
  msgstr ""
96
 
97
- #: ../admin/class-is-admin.php:319
98
  msgid "Search Search Forms"
99
  msgstr ""
100
 
101
- #: ../admin/class-is-admin.php:363
102
  msgid "You are not allowed to edit this item."
103
  msgstr ""
104
 
105
- #: ../admin/class-is-admin.php:441
 
 
 
 
106
  msgid "You are not allowed to copy this item."
107
  msgstr ""
108
 
109
- #: ../admin/class-is-admin.php:482
110
  msgid "You are not allowed to delete this item."
111
  msgstr ""
112
 
113
- #: ../admin/class-is-admin.php:486
114
  msgid "Error in deleting."
115
  msgstr ""
116
 
117
- #: ../admin/class-is-admin.php:691
118
  msgid "Save Form"
119
  msgstr ""
120
 
121
- #: ../admin/class-is-admin.php:704
122
  msgid "Upgrade To Access"
123
  msgstr ""
124
 
125
- #: ../admin/class-is-editor.php:89
 
 
 
 
126
  msgid "Configure the below options to make specific content searchable."
127
  msgstr ""
128
 
129
- #: ../admin/class-is-editor.php:97 ../admin/class-is-settings-fields.php:127
130
  msgid "Post Types"
131
  msgstr ""
132
 
133
- #: ../admin/class-is-editor.php:98 ../admin/class-is-editor.php:150
134
- #: ../admin/class-is-editor.php:213 ../admin/class-is-editor.php:248
135
- #: ../admin/class-is-editor.php:274 ../admin/class-is-editor.php:324
136
- #: ../admin/class-is-editor.php:356 ../admin/class-is-editor.php:394
137
- #: ../admin/class-is-editor.php:434 ../admin/class-is-editor.php:457
138
- #: ../admin/class-is-editor.php:516 ../admin/class-is-editor.php:567
139
- #: ../admin/class-is-editor.php:610 ../admin/class-is-editor.php:647
140
- #: ../admin/class-is-editor.php:673 ../admin/class-is-editor.php:716
141
- #: ../admin/class-is-editor.php:758 ../admin/class-is-editor.php:814
142
- #: ../admin/class-is-editor.php:829 ../admin/class-is-editor.php:855
143
- #: ../admin/class-is-editor.php:870 ../admin/class-is-editor.php:885
144
- #: ../admin/class-is-editor.php:899 ../admin/class-is-editor.php:919
145
- #: ../admin/class-is-editor.php:931 ../admin/class-is-editor.php:943
146
- #: ../admin/class-is-editor.php:955 ../admin/class-is-editor.php:967
147
- #: ../admin/class-is-settings-fields.php:111
148
  msgid "Expand All"
149
  msgstr ""
150
 
151
- #: ../admin/class-is-editor.php:98 ../admin/class-is-editor.php:150
152
- #: ../admin/class-is-editor.php:213 ../admin/class-is-editor.php:248
153
- #: ../admin/class-is-editor.php:274 ../admin/class-is-editor.php:324
154
- #: ../admin/class-is-editor.php:356 ../admin/class-is-editor.php:394
155
- #: ../admin/class-is-editor.php:434 ../admin/class-is-editor.php:457
156
- #: ../admin/class-is-editor.php:516 ../admin/class-is-editor.php:567
157
- #: ../admin/class-is-editor.php:610 ../admin/class-is-editor.php:647
158
- #: ../admin/class-is-editor.php:673 ../admin/class-is-editor.php:716
159
- #: ../admin/class-is-editor.php:758 ../admin/class-is-editor.php:814
160
- #: ../admin/class-is-editor.php:829 ../admin/class-is-editor.php:855
161
- #: ../admin/class-is-editor.php:870 ../admin/class-is-editor.php:885
162
- #: ../admin/class-is-editor.php:899 ../admin/class-is-editor.php:919
163
- #: ../admin/class-is-editor.php:931 ../admin/class-is-editor.php:943
164
- #: ../admin/class-is-editor.php:955 ../admin/class-is-editor.php:967
165
- #: ../admin/class-is-settings-fields.php:111
166
  msgid "Collapse All"
167
  msgstr ""
168
 
169
- #: ../admin/class-is-editor.php:103
170
  msgid "Select post types that you want to make searchable."
171
  msgstr ""
172
 
173
- #: ../admin/class-is-editor.php:125
174
  msgid "Search in post title."
175
  msgstr ""
176
 
177
- #: ../admin/class-is-editor.php:128
178
  msgid "Search in post content."
179
  msgstr ""
180
 
181
- #: ../admin/class-is-editor.php:131
182
  msgid "Search in post excerpt."
183
  msgstr ""
184
 
185
- #: ../admin/class-is-editor.php:134
186
  msgid "None"
187
  msgstr ""
188
 
189
- #: ../admin/class-is-editor.php:138
190
  msgid ""
191
  "Display this post type in the search query URL and restrict search to it."
192
  msgstr ""
193
 
194
- #: ../admin/class-is-editor.php:140 ../admin/class-is-settings-fields.php:221
195
  msgid "No post types registered on your site."
196
  msgstr ""
197
 
198
- #: ../admin/class-is-editor.php:149 ../admin/class-is-editor.php:566
199
  msgid "Taxonomy Terms"
200
  msgstr ""
201
 
202
- #: ../admin/class-is-editor.php:154
203
  msgid ""
204
  "Taxonomy terms that have no posts will not be visible below. Add a post with "
205
  "the taxonomy you want for it to be configurable."
206
  msgstr ""
207
 
208
- #: ../admin/class-is-editor.php:155
209
  msgid ""
210
  "Terms selected here will restrict the search to posts that have the selected "
211
  "terms."
212
  msgstr ""
213
 
214
- #: ../admin/class-is-editor.php:156
215
  msgid "Taxonomy terms selected display in BOLD"
216
  msgstr ""
217
 
218
- #: ../admin/class-is-editor.php:182 ../admin/class-is-editor.php:226
219
- #: ../admin/class-is-editor.php:468 ../admin/class-is-editor.php:555
220
- #: ../admin/class-is-editor.php:591 ../admin/class-is-editor.php:624
221
- #: ../admin/class-is-editor.php:769
222
  msgid "Search.."
223
  msgstr ""
224
 
225
- #: ../admin/class-is-editor.php:191 ../admin/class-is-editor.php:233
226
- #: ../admin/class-is-editor.php:476 ../admin/class-is-editor.php:561
227
- #: ../admin/class-is-editor.php:600 ../admin/class-is-editor.php:632
228
- #: ../admin/class-is-editor.php:777
229
  msgid "Press CTRL key to select multiple terms or deselect them."
230
  msgstr ""
231
 
232
- #: ../admin/class-is-editor.php:195
233
  msgid "AND - Search posts having all the above selected terms."
234
  msgstr ""
235
 
236
- #: ../admin/class-is-editor.php:197
237
  msgid "OR - Search posts having any one of the above selected terms."
238
  msgstr ""
239
 
240
- #: ../admin/class-is-editor.php:200
241
  msgid "Search in taxonomy terms title."
242
  msgstr ""
243
 
244
- #: ../admin/class-is-editor.php:203
245
  msgid "Search in taxonomy terms description."
246
  msgstr ""
247
 
248
- #: ../admin/class-is-editor.php:205 ../admin/class-is-editor.php:602
249
  msgid "No taxonomies registered for slected post types."
250
  msgstr ""
251
 
252
- #: ../admin/class-is-editor.php:212 ../admin/class-is-editor.php:609
253
  msgid "Custom Fields"
254
  msgstr ""
255
 
256
- #: ../admin/class-is-editor.php:216
257
  msgid "Select custom fields to make their values searchable."
258
  msgstr ""
259
 
260
- #: ../admin/class-is-editor.php:237
261
  msgid "Selected Custom Fields :"
262
  msgstr ""
263
 
264
- #: ../admin/class-is-editor.php:247 ../admin/class-is-editor.php:646
265
  msgid "WooCommerce"
266
  msgstr ""
267
 
268
- #: ../admin/class-is-editor.php:251
269
  msgid "Configure WooCommerce products search options here."
270
  msgstr ""
271
 
272
- #: ../admin/class-is-editor.php:263
273
  msgid "Search in WooCommerce products SKU."
274
  msgstr ""
275
 
276
- #: ../admin/class-is-editor.php:266 ../admin/class-is-editor.php:665
277
  msgid "WooCommerce product post type is not included in search."
278
  msgstr ""
279
 
280
- #: ../admin/class-is-editor.php:273 ../admin/class-is-editor.php:672
281
  msgid "Authors"
282
  msgstr ""
283
 
284
- #: ../admin/class-is-editor.php:277
285
  msgid "Make specific author posts searchable."
286
  msgstr ""
287
 
288
- #: ../admin/class-is-editor.php:310
289
  msgid ""
290
  "Search has been already limited by excluding specific authors posts in the "
291
  "Excludes section."
292
  msgstr ""
293
 
294
- #: ../admin/class-is-editor.php:318
295
  msgid ""
296
  "Search in author Display name and display the posts created by that author."
297
  msgstr ""
298
 
299
- #: ../admin/class-is-editor.php:323 ../admin/class-is-editor.php:715
300
  msgid "Post Status"
301
  msgstr ""
302
 
303
- #: ../admin/class-is-editor.php:327
304
  msgid "Configure options to search posts having specific post statuses."
305
  msgstr ""
306
 
307
- #: ../admin/class-is-editor.php:348
308
  msgid ""
309
  "Search has been already limited by excluding specific posts statuses from "
310
  "search in the Excludes section."
311
  msgstr ""
312
 
313
- #: ../admin/class-is-editor.php:355
314
  msgid "Comments"
315
  msgstr ""
316
 
317
- #: ../admin/class-is-editor.php:359
318
  msgid "Make posts searchable that have a specific number of comments."
319
  msgstr ""
320
 
321
- #: ../admin/class-is-editor.php:372
322
  msgid "The search operator to compare comments count."
323
  msgstr ""
324
 
325
- #: ../admin/class-is-editor.php:376
326
  msgid "NA"
327
  msgstr ""
328
 
329
- #: ../admin/class-is-editor.php:380
330
  msgid "The amount of comments your posts has to have."
331
  msgstr ""
332
 
333
- #: ../admin/class-is-editor.php:387
334
  msgid "Search in approved comments content."
335
  msgstr ""
336
 
337
- #: ../admin/class-is-editor.php:393 ../admin/class-is-list-table.php:34
338
  msgid "Date"
339
  msgstr ""
340
 
341
- #: ../admin/class-is-editor.php:397
342
- msgid "Make posts searchable that were created in the specified data range."
343
  msgstr ""
344
 
345
- #: ../admin/class-is-editor.php:406
346
  msgid "Day"
347
  msgstr ""
348
 
349
- #: ../admin/class-is-editor.php:414
350
  msgid "Month"
351
  msgstr ""
352
 
353
- #: ../admin/class-is-editor.php:422
354
  msgid "Year"
355
  msgstr ""
356
 
357
- #: ../admin/class-is-editor.php:433
358
  msgid "Password"
359
  msgstr ""
360
 
361
- #: ../admin/class-is-editor.php:437
362
  msgid "Configure options to search posts with or without password."
363
  msgstr ""
364
 
365
- #: ../admin/class-is-editor.php:442
366
  msgid "Search all posts with and without passwords."
367
  msgstr ""
368
 
369
- #: ../admin/class-is-editor.php:444
370
  msgid "Search only posts with passwords."
371
  msgstr ""
372
 
373
- #: ../admin/class-is-editor.php:446
374
  msgid "Search only posts without passwords."
375
  msgstr ""
376
 
377
- #: ../admin/class-is-editor.php:456 ../admin/class-is-editor.php:757
378
  msgid "File Types"
379
  msgstr ""
380
 
381
- #: ../admin/class-is-editor.php:460
382
  msgid ""
383
  "Configure searching to search based on posts that have a specific MIME type "
384
  "or files that have specific media attachments"
385
  msgstr ""
386
 
387
- #: ../admin/class-is-editor.php:479
388
  msgid ""
389
  "Search has been already limited by excluding specific File type in the "
390
  "Excludes section."
391
  msgstr ""
392
 
393
- #: ../admin/class-is-editor.php:483
 
 
 
 
394
  msgid "Selected File Types :"
395
  msgstr ""
396
 
397
- #: ../admin/class-is-editor.php:508
398
  msgid "Configure the options to exclude specific content from search."
399
  msgstr ""
400
 
401
- #: ../admin/class-is-editor.php:515
402
  msgid "Posts"
403
  msgstr ""
404
 
405
- #: ../admin/class-is-editor.php:519
406
  msgid "The posts and pages of searchable post types display here."
407
  msgstr ""
408
 
409
- #: ../admin/class-is-editor.php:520
410
  msgid "Select the posts you wish to exclude from the search."
411
  msgstr ""
412
 
413
- #: ../admin/class-is-editor.php:521
414
  msgid "Selected post types display in BOLD."
415
  msgstr ""
416
 
417
- #: ../admin/class-is-editor.php:570
418
  msgid ""
419
  "The taxonomies and terms attached to searchable post types display here."
420
  msgstr ""
421
 
422
- #: ../admin/class-is-editor.php:571
423
  msgid "Exclude posts from search results that have specific terms"
424
  msgstr ""
425
 
426
- #: ../admin/class-is-editor.php:572
427
  msgid "Selected terms taxonomy title display in BOLD."
428
  msgstr ""
429
 
430
- #: ../admin/class-is-editor.php:613
431
  msgid "Exclude posts from the search having selected custom fields."
432
  msgstr ""
433
 
434
- #: ../admin/class-is-editor.php:636
435
  msgid "Excluded Custom Fields :"
436
  msgstr ""
437
 
438
- #: ../admin/class-is-editor.php:650
439
  msgid "Exclude specific WooCommerce products from the search."
440
  msgstr ""
441
 
442
- #: ../admin/class-is-editor.php:662
443
  msgid "Exclude 'out of stock' WooCommerce products."
444
  msgstr ""
445
 
446
- #: ../admin/class-is-editor.php:676
447
  msgid "Exclude posts from the search created by slected authors."
448
  msgstr ""
449
 
450
- #: ../admin/class-is-editor.php:708
451
  msgid ""
452
  "Search has been already limited to posts created by specific authors in the "
453
  "Includes section."
454
  msgstr ""
455
 
456
- #: ../admin/class-is-editor.php:719
457
  msgid "Exclude posts from the search having selected post statuses."
458
  msgstr ""
459
 
460
- #: ../admin/class-is-editor.php:742
461
  msgid ""
462
  "Search has been already limited to posts statuses set in the Includes "
463
  "section."
464
  msgstr ""
465
 
466
- #: ../admin/class-is-editor.php:747
467
  msgid "Exclude sticky posts from search."
468
  msgstr ""
469
 
470
- #: ../admin/class-is-editor.php:761
471
  msgid ""
472
  "Exclude posts specially media attachment posts from the search having "
473
  "selected file types."
474
  msgstr ""
475
 
476
- #: ../admin/class-is-editor.php:780
477
  msgid ""
478
  "Search has been already limited to specific File type set in the Includes "
479
  "section."
480
  msgstr ""
481
 
482
- #: ../admin/class-is-editor.php:784
483
  msgid "Excluded File Types :"
484
  msgstr ""
485
 
486
- #: ../admin/class-is-editor.php:806
487
  msgid "Configure the options here to control search of this search form."
488
  msgstr ""
489
 
490
- #: ../admin/class-is-editor.php:813
491
  msgid "Posts Per Page"
492
  msgstr ""
493
 
494
- #: ../admin/class-is-editor.php:822
495
  msgid "Number of posts to display on search results page."
496
  msgstr ""
497
 
498
- #: ../admin/class-is-editor.php:828
499
  msgid "Order By"
500
  msgstr ""
501
 
502
- #: ../admin/class-is-editor.php:854
503
  msgid "Highlight Terms"
504
  msgstr ""
505
 
506
- #: ../admin/class-is-editor.php:860
507
  msgid "Highlight searched terms on search results page."
508
  msgstr ""
509
 
510
- #: ../admin/class-is-editor.php:863
511
  msgid "Set highlight color."
512
  msgstr ""
513
 
514
- #: ../admin/class-is-editor.php:869
515
  msgid "Search Terms Relation"
516
  msgstr ""
517
 
518
- #: ../admin/class-is-editor.php:876
519
  msgid "OR - Display content having any of the searched terms."
520
  msgstr ""
521
 
522
- #: ../admin/class-is-editor.php:878
523
  msgid "AND - Display content having all the searched terms."
524
  msgstr ""
525
 
526
- #: ../admin/class-is-editor.php:884
527
  msgid "Fuzzy Matching"
528
  msgstr ""
529
 
530
- #: ../admin/class-is-editor.php:890
531
  msgid "Whole - Search posts that include the whole search term."
532
  msgstr ""
533
 
534
- #: ../admin/class-is-editor.php:892
535
  msgid ""
536
  "Partial - Also search words in the posts that begins or ends with the search "
537
  "term."
538
  msgstr ""
539
 
540
- #: ../admin/class-is-editor.php:898
541
  msgid "Keyword Stemming"
542
  msgstr ""
543
 
544
- #: ../admin/class-is-editor.php:902
545
  msgid "Searches the base word of a searched keyword"
546
  msgstr ""
547
 
548
- #: ../admin/class-is-editor.php:903
549
  msgid ""
550
  "For Example: If you search \"doing\" then it also searches base word of "
551
  "\"doing\" that is \"do\" in the specified post types."
552
  msgstr ""
553
 
554
- #: ../admin/class-is-editor.php:904
555
  msgid ""
556
  "If you want to search whole exact searched term then do not use this options "
557
  "and in this case it is not recommended to use when Fuzzy Matching option is "
558
  "set to Whole."
559
  msgstr ""
560
 
561
- #: ../admin/class-is-editor.php:910
562
  msgid "Also search base word of searched keyword."
563
  msgstr ""
564
 
565
- #: ../admin/class-is-editor.php:912
566
  msgid "Not recommended to use when Fuzzy Matching option is set to Whole."
567
  msgstr ""
568
 
569
- #: ../admin/class-is-editor.php:918
570
  msgid "Sticky Posts"
571
  msgstr ""
572
 
573
- #: ../admin/class-is-editor.php:924
574
  msgid "Move sticky posts to the start of the search results page."
575
  msgstr ""
576
 
577
- #: ../admin/class-is-editor.php:930
578
  msgid "Empty Search"
579
  msgstr ""
580
 
581
- #: ../admin/class-is-editor.php:936
582
  msgid "Display an error for empty search query."
583
  msgstr ""
584
 
585
- #: ../admin/class-is-editor.php:942
586
  msgid "Respect exclude_from_search"
587
  msgstr ""
588
 
589
- #: ../admin/class-is-editor.php:948
590
  msgid "Do not search post types which are excluded from search."
591
  msgstr ""
592
 
593
- #: ../admin/class-is-editor.php:954
594
  msgid "Demo"
595
  msgstr ""
596
 
597
- #: ../admin/class-is-editor.php:960
598
  msgid "Display search form only for site administrator."
599
  msgstr ""
600
 
601
- #: ../admin/class-is-editor.php:966 ../admin/class-is-settings-fields.php:146
602
  msgid "Disable"
603
  msgstr ""
604
 
605
- #: ../admin/class-is-editor.php:972
606
  msgid "Disable this search form."
607
  msgstr ""
608
 
@@ -746,12 +762,12 @@ msgstr ""
746
  msgid "For more information:"
747
  msgstr ""
748
 
749
- #: ../admin/class-is-help.php:110 ../admin/partials/new-search-form.php:180
750
  #: ../admin/partials/settings-form.php:90
751
  msgid "Docs"
752
  msgstr ""
753
 
754
- #: ../admin/class-is-help.php:112 ../admin/partials/new-search-form.php:183
755
  #: ../admin/partials/settings-form.php:93
756
  msgid "Give us a rating"
757
  msgstr ""
@@ -779,9 +795,9 @@ msgid "Edit &#8220;%s&#8221;"
779
  msgstr ""
780
 
781
  #: ../admin/class-is-list-table.php:150
782
- #: ../admin/class-is-settings-fields.php:259
783
- #: ../admin/class-is-settings-fields.php:432
784
- #: ../admin/class-is-settings-fields.php:464 ../includes/class-is-widget.php:69
785
  msgid "Edit"
786
  msgstr ""
787
 
@@ -810,256 +826,260 @@ msgstr ""
810
  msgid "d/m/Y"
811
  msgstr ""
812
 
813
- #: ../admin/class-is-settings-fields.php:123
814
  msgid "Select Menu"
815
  msgstr ""
816
 
817
- #: ../admin/class-is-settings-fields.php:130
818
  #: ../includes/class-is-search-form.php:60
819
  msgid "Search Form"
820
  msgstr ""
821
 
822
- #: ../admin/class-is-settings-fields.php:131
823
  msgid "Form Style"
824
  msgstr ""
825
 
826
- #: ../admin/class-is-settings-fields.php:132
827
  msgid "Menu Title"
828
  msgstr ""
829
 
830
- #: ../admin/class-is-settings-fields.php:133
831
  msgid "Menu Classes"
832
  msgstr ""
833
 
834
- #: ../admin/class-is-settings-fields.php:134
835
  msgid "Google CSE"
836
  msgstr ""
837
 
838
- #: ../admin/class-is-settings-fields.php:135
839
  msgid "Close Icon"
840
  msgstr ""
841
 
842
- #: ../admin/class-is-settings-fields.php:139
843
  msgid "Header"
844
  msgstr ""
845
 
846
- #: ../admin/class-is-settings-fields.php:140
847
  msgid "Footer"
848
  msgstr ""
849
 
850
- #: ../admin/class-is-settings-fields.php:141
851
  msgid "Mobile Display"
852
  msgstr ""
853
 
854
- #: ../admin/class-is-settings-fields.php:142
855
  msgid "Custom CSS"
856
  msgstr ""
857
 
858
- #: ../admin/class-is-settings-fields.php:143
859
  msgid "Stopwords"
860
  msgstr ""
861
 
862
- #: ../admin/class-is-settings-fields.php:144
863
  msgid "Synonyms"
864
  msgstr ""
865
 
866
- #: ../admin/class-is-settings-fields.php:145
867
  msgid "Not load files"
868
  msgstr ""
869
 
870
- #: ../admin/class-is-settings-fields.php:147
871
  msgid "Default Search"
872
  msgstr ""
873
 
874
- #: ../admin/class-is-settings-fields.php:156
875
  msgid "Use below options to display search in menu and configure it."
876
  msgstr ""
877
 
878
- #: ../admin/class-is-settings-fields.php:165
879
  msgid "Use below options to make sitewide changes in search."
880
  msgstr ""
881
 
882
- #: ../admin/class-is-settings-fields.php:173
883
  msgid "Select menu here where you want to display search form."
884
  msgstr ""
885
 
886
- #: ../admin/class-is-settings-fields.php:193
887
  msgid "No navigation menu registered on your site."
888
  msgstr ""
889
 
890
- #: ../admin/class-is-settings-fields.php:203
891
  msgid "Select post types here that you want to make searchable."
892
  msgstr ""
893
 
894
- #: ../admin/class-is-settings-fields.php:232
895
  msgid ""
896
  "Select search form that will control search performed using menu search."
897
  msgstr ""
898
 
899
- #: ../admin/class-is-settings-fields.php:234
900
  msgid "It overwrites above Post Types option."
901
  msgstr ""
902
 
903
- #: ../admin/class-is-settings-fields.php:242
904
- #: ../admin/class-is-settings-fields.php:252
905
- #: ../admin/class-is-settings-fields.php:425
906
- #: ../admin/class-is-settings-fields.php:457 ../includes/class-is-widget.php:62
907
  msgid "none"
908
  msgstr ""
909
 
910
- #: ../admin/class-is-settings-fields.php:261
911
- #: ../admin/class-is-settings-fields.php:434
912
- #: ../admin/class-is-settings-fields.php:466 ../includes/class-is-widget.php:71
913
  msgid "Create New"
914
  msgstr ""
915
 
916
- #: ../admin/class-is-settings-fields.php:275
917
  msgid "Select form style for the search form displayed in the menu."
918
  msgstr ""
919
 
920
- #: ../admin/class-is-settings-fields.php:279
921
  msgid "Default"
922
  msgstr ""
923
 
924
- #: ../admin/class-is-settings-fields.php:280
925
  msgid "Dropdown"
926
  msgstr ""
927
 
928
- #: ../admin/class-is-settings-fields.php:281
929
  msgid "Sliding"
930
  msgstr ""
931
 
932
- #: ../admin/class-is-settings-fields.php:282
933
  msgid "Full Width"
934
  msgstr ""
935
 
936
- #: ../admin/class-is-settings-fields.php:283
937
  msgid "Popup"
938
  msgstr ""
939
 
940
- #: ../admin/class-is-settings-fields.php:316
941
  msgid ""
942
  "Displays set menu title text in place of search icon displays in navigation "
943
  "menu."
944
  msgstr ""
945
 
946
- #: ../admin/class-is-settings-fields.php:328
947
  msgid "Adds set classes in the search navigation menu item."
948
  msgstr ""
949
 
950
- #: ../admin/class-is-settings-fields.php:333
951
  msgid "Add classes seperated by space."
952
  msgstr ""
953
 
954
- #: ../admin/class-is-settings-fields.php:341
955
  msgid ""
956
  "Add only Google Custom Search( CSE ) search form code in the above text box "
957
  "that will replace default search form."
958
  msgstr ""
959
 
960
- #: ../admin/class-is-settings-fields.php:353
961
  msgid ""
962
  "Note: Does not work with caching as this functionality uses the WordPress "
963
  "wp_is_mobile function."
964
  msgstr ""
965
 
966
- #: ../admin/class-is-settings-fields.php:366
967
  msgid "Display search form in header on mobile devices"
968
  msgstr ""
969
 
970
- #: ../admin/class-is-settings-fields.php:369
971
  msgid ""
972
  "Use this option to display search form in your site header and hide the "
973
  "search form on desktop using CSS code."
974
  msgstr ""
975
 
976
- #: ../admin/class-is-settings-fields.php:382
977
  msgid "This site uses cache"
978
  msgstr ""
979
 
980
- #: ../admin/class-is-settings-fields.php:393
981
  msgid "Disable search functionality on whole site."
982
  msgstr ""
983
 
984
- #: ../admin/class-is-settings-fields.php:404
985
  msgid ""
986
  "Do not use default search form to control WordPress default search "
987
  "functionality."
988
  msgstr ""
989
 
990
- #: ../admin/class-is-settings-fields.php:413
991
  msgid "Displays search form in site header using wp_head hook."
992
  msgstr ""
993
 
994
- #: ../admin/class-is-settings-fields.php:445
995
  msgid "Displays search form in site footer using wp_footer hook."
996
  msgstr ""
997
 
998
- #: ../admin/class-is-settings-fields.php:486
999
  msgid "Display Search Form Close Icon"
1000
  msgstr ""
1001
 
1002
- #: ../admin/class-is-settings-fields.php:494
1003
  msgid "Add custom css code if any to style search form."
1004
  msgstr ""
1005
 
1006
- #: ../admin/class-is-settings-fields.php:507
1007
  msgid ""
1008
  "Enter words here to add them to the list of stopwords. The stopwords will "
1009
  "not be searched."
1010
  msgstr ""
1011
 
1012
- #: ../admin/class-is-settings-fields.php:511
 
 
 
 
1013
  msgid "Please separate words with commas."
1014
  msgstr ""
1015
 
1016
- #: ../admin/class-is-settings-fields.php:519
1017
  msgid "Add synonyms here to make the searches find better results."
1018
  msgstr ""
1019
 
1020
- #: ../admin/class-is-settings-fields.php:520
1021
  msgid ""
1022
  "If you add bird = crow to the list of synonyms, searches for bird "
1023
  "automatically become a search for bird crow and will thus match to posts "
1024
  "that include either bird or crow."
1025
  msgstr ""
1026
 
1027
- #: ../admin/class-is-settings-fields.php:521
1028
  msgid ""
1029
  "This only works for search forms and in OR searches. In AND searches the "
1030
  "synonyms only restrict the search, as now the search only finds posts that "
1031
  "contain both bird and crow."
1032
  msgstr ""
1033
 
1034
- #: ../admin/class-is-settings-fields.php:526
1035
  msgid ""
1036
  "The format here is key = value;. Please separate every synonyms key = value "
1037
  "pairs with semicolon."
1038
  msgstr ""
1039
 
1040
- #: ../admin/class-is-settings-fields.php:536
1041
  msgid "Disable synonyms for the search forms having AND search terms relation."
1042
  msgstr ""
1043
 
1044
- #: ../admin/class-is-settings-fields.php:545
1045
  msgid "Configure to disable loading plugin CSS and JavaScript files."
1046
  msgstr ""
1047
 
1048
- #: ../admin/class-is-settings-fields.php:549
1049
  msgid "Plugin CSS File"
1050
  msgstr ""
1051
 
1052
- #: ../admin/class-is-settings-fields.php:550
1053
  msgid "Plugin JavaScript File"
1054
  msgstr ""
1055
 
1056
- #: ../admin/class-is-settings-fields.php:570
1057
  msgid ""
1058
  "If checked, you have to add following plugin file code into your child theme "
1059
  "CSS file."
1060
  msgstr ""
1061
 
1062
- #: ../admin/class-is-settings-fields.php:574
1063
  msgid ""
1064
  "If checked, you have to add following plugin files code into your child "
1065
  "theme JavaScript file."
@@ -1083,12 +1103,22 @@ msgstr ""
1083
  msgid "Save"
1084
  msgstr ""
1085
 
1086
- #: ../admin/partials/new-search-form.php:177
 
 
 
 
 
 
 
 
 
 
1087
  #: ../admin/partials/settings-form.php:87
1088
  msgid "Information"
1089
  msgstr ""
1090
 
1091
- #: ../admin/partials/new-search-form.php:182
1092
  #: ../admin/partials/settings-form.php:92
1093
  msgid "Contact"
1094
  msgstr ""
@@ -1109,12 +1139,12 @@ msgstr ""
1109
  msgid "Displays ivory search form."
1110
  msgstr ""
1111
 
1112
- #: ../includes/freemius.php:59
1113
  #, php-format
1114
  msgid "Hey %1$s"
1115
  msgstr ""
1116
 
1117
- #: ../includes/freemius.php:59
1118
  #, php-format
1119
  msgid ""
1120
  "Please help us improve %2$s by securely sharing some usage data with %5$s. "
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Ivory Search\n"
4
+ "POT-Creation-Date: 2018-09-10 19:33+0530\n"
5
+ "PO-Revision-Date: 2018-09-10 19:33+0530\n"
6
  "Last-Translator: \n"
7
  "Language-Team: Ivory Search <admin@ivorysearch.com>\n"
8
  "Language: en_US\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
  "X-Poedit-SearchPath-0: ..\n"
18
 
19
+ #: ../admin/class-is-admin.php:74
20
  msgid "The changes you made will be lost if you navigate away from this page."
21
  msgstr ""
22
 
23
+ #: ../admin/class-is-admin.php:95 ../admin/class-is-help.php:111
24
+ #: ../admin/partials/new-search-form.php:185
25
  #: ../admin/partials/settings-form.php:91
26
  msgid "Support"
27
  msgstr ""
28
 
29
+ #: ../admin/class-is-admin.php:117
30
  #, php-format
31
  msgid ""
32
  "To configure <em>Ivory Search plugin</em> please visit its <a href=\"%1$s"
35
  "target=\"_blank\">contact us page</a>."
36
  msgstr ""
37
 
38
+ #: ../admin/class-is-admin.php:223
39
  msgid "Search form created."
40
  msgstr ""
41
 
42
+ #: ../admin/class-is-admin.php:225
43
  msgid "Search form saved."
44
  msgstr ""
45
 
46
+ #: ../admin/class-is-admin.php:227
47
  msgid "Search form deleted."
48
  msgstr ""
49
 
50
+ #: ../admin/class-is-admin.php:229
51
+ msgid "Search form reset."
52
+ msgstr ""
53
+
54
+ #: ../admin/class-is-admin.php:238
55
  msgid "There was an error saving the search form."
56
  msgstr ""
57
 
58
+ #: ../admin/class-is-admin.php:246
59
  msgid "There was a validation error saving the search form."
60
  msgstr ""
61
 
62
+ #: ../admin/class-is-admin.php:248
63
  #, php-format
64
  msgid ""
65
  "Please make sure you have not selected similar %s fields in the search form "
66
  "Includes and Excludes sections."
67
  msgstr ""
68
 
69
+ #: ../admin/class-is-admin.php:258 ../includes/class-is-widget.php:13
70
  #: ../includes/class-is-widget.php:45
71
  msgid "Ivory Search"
72
  msgstr ""
73
 
74
+ #: ../admin/class-is-admin.php:260 ../admin/class-is-admin.php:298
75
  #: ../includes/class-is-search-form.php:59
76
  msgid "Search Forms"
77
  msgstr ""
78
 
79
+ #: ../admin/class-is-admin.php:263 ../admin/partials/new-search-form.php:21
80
  msgid "Add New Search Form"
81
  msgstr ""
82
 
83
+ #: ../admin/class-is-admin.php:263 ../admin/class-is-admin.php:305
84
  #: ../admin/partials/new-search-form.php:31
85
  msgid "Add New"
86
  msgstr ""
87
 
88
+ #: ../admin/class-is-admin.php:266 ../admin/partials/settings-form.php:20
89
  msgid "Ivory Search Settings"
90
  msgstr ""
91
 
92
+ #: ../admin/class-is-admin.php:266 ../admin/class-is-help.php:64
93
  msgid "Settings"
94
  msgstr ""
95
 
96
+ #: ../admin/class-is-admin.php:311
97
  #, php-format
98
  msgid "Search results for &#8220;%s&#8221;"
99
  msgstr ""
100
 
101
+ #: ../admin/class-is-admin.php:322
102
  msgid "Search Search Forms"
103
  msgstr ""
104
 
105
+ #: ../admin/class-is-admin.php:366
106
  msgid "You are not allowed to edit this item."
107
  msgstr ""
108
 
109
+ #: ../admin/class-is-admin.php:444
110
+ msgid "You are not allowed to reset this item."
111
+ msgstr ""
112
+
113
+ #: ../admin/class-is-admin.php:478
114
  msgid "You are not allowed to copy this item."
115
  msgstr ""
116
 
117
+ #: ../admin/class-is-admin.php:519
118
  msgid "You are not allowed to delete this item."
119
  msgstr ""
120
 
121
+ #: ../admin/class-is-admin.php:523
122
  msgid "Error in deleting."
123
  msgstr ""
124
 
125
+ #: ../admin/class-is-admin.php:728
126
  msgid "Save Form"
127
  msgstr ""
128
 
129
+ #: ../admin/class-is-admin.php:740
130
  msgid "Upgrade To Access"
131
  msgstr ""
132
 
133
+ #: ../admin/class-is-admin.php:747
134
+ msgid "Install Pro Version To Access"
135
+ msgstr ""
136
+
137
+ #: ../admin/class-is-editor.php:94
138
  msgid "Configure the below options to make specific content searchable."
139
  msgstr ""
140
 
141
+ #: ../admin/class-is-editor.php:102 ../admin/class-is-settings-fields.php:133
142
  msgid "Post Types"
143
  msgstr ""
144
 
145
+ #: ../admin/class-is-editor.php:103 ../admin/class-is-editor.php:174
146
+ #: ../admin/class-is-editor.php:252 ../admin/class-is-editor.php:288
147
+ #: ../admin/class-is-editor.php:317 ../admin/class-is-editor.php:370
148
+ #: ../admin/class-is-editor.php:405 ../admin/class-is-editor.php:456
149
+ #: ../admin/class-is-editor.php:509 ../admin/class-is-editor.php:535
150
+ #: ../admin/class-is-editor.php:601 ../admin/class-is-editor.php:655
151
+ #: ../admin/class-is-editor.php:701 ../admin/class-is-editor.php:739
152
+ #: ../admin/class-is-editor.php:768 ../admin/class-is-editor.php:814
153
+ #: ../admin/class-is-editor.php:859 ../admin/class-is-editor.php:921
154
+ #: ../admin/class-is-editor.php:940 ../admin/class-is-editor.php:976
155
+ #: ../admin/class-is-editor.php:1001 ../admin/class-is-editor.php:1019
156
+ #: ../admin/class-is-editor.php:1036 ../admin/class-is-editor.php:1059
157
+ #: ../admin/class-is-editor.php:1074 ../admin/class-is-editor.php:1089
158
+ #: ../admin/class-is-editor.php:1104 ../admin/class-is-editor.php:1119
159
+ #: ../admin/class-is-settings-fields.php:117
160
  msgid "Expand All"
161
  msgstr ""
162
 
163
+ #: ../admin/class-is-editor.php:103 ../admin/class-is-editor.php:174
164
+ #: ../admin/class-is-editor.php:252 ../admin/class-is-editor.php:288
165
+ #: ../admin/class-is-editor.php:317 ../admin/class-is-editor.php:370
166
+ #: ../admin/class-is-editor.php:405 ../admin/class-is-editor.php:456
167
+ #: ../admin/class-is-editor.php:509 ../admin/class-is-editor.php:535
168
+ #: ../admin/class-is-editor.php:601 ../admin/class-is-editor.php:655
169
+ #: ../admin/class-is-editor.php:701 ../admin/class-is-editor.php:739
170
+ #: ../admin/class-is-editor.php:768 ../admin/class-is-editor.php:814
171
+ #: ../admin/class-is-editor.php:859 ../admin/class-is-editor.php:921
172
+ #: ../admin/class-is-editor.php:940 ../admin/class-is-editor.php:976
173
+ #: ../admin/class-is-editor.php:1001 ../admin/class-is-editor.php:1019
174
+ #: ../admin/class-is-editor.php:1036 ../admin/class-is-editor.php:1059
175
+ #: ../admin/class-is-editor.php:1074 ../admin/class-is-editor.php:1089
176
+ #: ../admin/class-is-editor.php:1104 ../admin/class-is-editor.php:1119
177
+ #: ../admin/class-is-settings-fields.php:117
178
  msgid "Collapse All"
179
  msgstr ""
180
 
181
+ #: ../admin/class-is-editor.php:108
182
  msgid "Select post types that you want to make searchable."
183
  msgstr ""
184
 
185
+ #: ../admin/class-is-editor.php:137
186
  msgid "Search in post title."
187
  msgstr ""
188
 
189
+ #: ../admin/class-is-editor.php:143
190
  msgid "Search in post content."
191
  msgstr ""
192
 
193
+ #: ../admin/class-is-editor.php:149
194
  msgid "Search in post excerpt."
195
  msgstr ""
196
 
197
+ #: ../admin/class-is-editor.php:155
198
  msgid "None"
199
  msgstr ""
200
 
201
+ #: ../admin/class-is-editor.php:159
202
  msgid ""
203
  "Display this post type in the search query URL and restrict search to it."
204
  msgstr ""
205
 
206
+ #: ../admin/class-is-editor.php:164 ../admin/class-is-settings-fields.php:227
207
  msgid "No post types registered on your site."
208
  msgstr ""
209
 
210
+ #: ../admin/class-is-editor.php:173 ../admin/class-is-editor.php:654
211
  msgid "Taxonomy Terms"
212
  msgstr ""
213
 
214
+ #: ../admin/class-is-editor.php:178
215
  msgid ""
216
  "Taxonomy terms that have no posts will not be visible below. Add a post with "
217
  "the taxonomy you want for it to be configurable."
218
  msgstr ""
219
 
220
+ #: ../admin/class-is-editor.php:179
221
  msgid ""
222
  "Terms selected here will restrict the search to posts that have the selected "
223
  "terms."
224
  msgstr ""
225
 
226
+ #: ../admin/class-is-editor.php:180
227
  msgid "Taxonomy terms selected display in BOLD"
228
  msgstr ""
229
 
230
+ #: ../admin/class-is-editor.php:206 ../admin/class-is-editor.php:265
231
+ #: ../admin/class-is-editor.php:549 ../admin/class-is-editor.php:640
232
+ #: ../admin/class-is-editor.php:679 ../admin/class-is-editor.php:715
233
+ #: ../admin/class-is-editor.php:872
234
  msgid "Search.."
235
  msgstr ""
236
 
237
+ #: ../admin/class-is-editor.php:215 ../admin/class-is-editor.php:272
238
+ #: ../admin/class-is-editor.php:557 ../admin/class-is-editor.php:649
239
+ #: ../admin/class-is-editor.php:688 ../admin/class-is-editor.php:723
240
+ #: ../admin/class-is-editor.php:880
241
  msgid "Press CTRL key to select multiple terms or deselect them."
242
  msgstr ""
243
 
244
+ #: ../admin/class-is-editor.php:225
245
  msgid "AND - Search posts having all the above selected terms."
246
  msgstr ""
247
 
248
+ #: ../admin/class-is-editor.php:227
249
  msgid "OR - Search posts having any one of the above selected terms."
250
  msgstr ""
251
 
252
+ #: ../admin/class-is-editor.php:233
253
  msgid "Search in taxonomy terms title."
254
  msgstr ""
255
 
256
+ #: ../admin/class-is-editor.php:239
257
  msgid "Search in taxonomy terms description."
258
  msgstr ""
259
 
260
+ #: ../admin/class-is-editor.php:244 ../admin/class-is-editor.php:693
261
  msgid "No taxonomies registered for slected post types."
262
  msgstr ""
263
 
264
+ #: ../admin/class-is-editor.php:251 ../admin/class-is-editor.php:700
265
  msgid "Custom Fields"
266
  msgstr ""
267
 
268
+ #: ../admin/class-is-editor.php:255
269
  msgid "Select custom fields to make their values searchable."
270
  msgstr ""
271
 
272
+ #: ../admin/class-is-editor.php:276
273
  msgid "Selected Custom Fields :"
274
  msgstr ""
275
 
276
+ #: ../admin/class-is-editor.php:287 ../admin/class-is-editor.php:738
277
  msgid "WooCommerce"
278
  msgstr ""
279
 
280
+ #: ../admin/class-is-editor.php:291
281
  msgid "Configure WooCommerce products search options here."
282
  msgstr ""
283
 
284
+ #: ../admin/class-is-editor.php:303
285
  msgid "Search in WooCommerce products SKU."
286
  msgstr ""
287
 
288
+ #: ../admin/class-is-editor.php:309 ../admin/class-is-editor.php:760
289
  msgid "WooCommerce product post type is not included in search."
290
  msgstr ""
291
 
292
+ #: ../admin/class-is-editor.php:316 ../admin/class-is-editor.php:767
293
  msgid "Authors"
294
  msgstr ""
295
 
296
+ #: ../admin/class-is-editor.php:320
297
  msgid "Make specific author posts searchable."
298
  msgstr ""
299
 
300
+ #: ../admin/class-is-editor.php:353
301
  msgid ""
302
  "Search has been already limited by excluding specific authors posts in the "
303
  "Excludes section."
304
  msgstr ""
305
 
306
+ #: ../admin/class-is-editor.php:361
307
  msgid ""
308
  "Search in author Display name and display the posts created by that author."
309
  msgstr ""
310
 
311
+ #: ../admin/class-is-editor.php:369 ../admin/class-is-editor.php:813
312
  msgid "Post Status"
313
  msgstr ""
314
 
315
+ #: ../admin/class-is-editor.php:373
316
  msgid "Configure options to search posts having specific post statuses."
317
  msgstr ""
318
 
319
+ #: ../admin/class-is-editor.php:397
320
  msgid ""
321
  "Search has been already limited by excluding specific posts statuses from "
322
  "search in the Excludes section."
323
  msgstr ""
324
 
325
+ #: ../admin/class-is-editor.php:404
326
  msgid "Comments"
327
  msgstr ""
328
 
329
+ #: ../admin/class-is-editor.php:409
330
  msgid "Make posts searchable that have a specific number of comments."
331
  msgstr ""
332
 
333
+ #: ../admin/class-is-editor.php:425
334
  msgid "The search operator to compare comments count."
335
  msgstr ""
336
 
337
+ #: ../admin/class-is-editor.php:432
338
  msgid "NA"
339
  msgstr ""
340
 
341
+ #: ../admin/class-is-editor.php:436
342
  msgid "The amount of comments your posts has to have."
343
  msgstr ""
344
 
345
+ #: ../admin/class-is-editor.php:446
346
  msgid "Search in approved comments content."
347
  msgstr ""
348
 
349
+ #: ../admin/class-is-editor.php:455 ../admin/class-is-list-table.php:34
350
  msgid "Date"
351
  msgstr ""
352
 
353
+ #: ../admin/class-is-editor.php:459
354
+ msgid "Make posts searchable that were created in the specified date range."
355
  msgstr ""
356
 
357
+ #: ../admin/class-is-editor.php:472
358
  msgid "Day"
359
  msgstr ""
360
 
361
+ #: ../admin/class-is-editor.php:483
362
  msgid "Month"
363
  msgstr ""
364
 
365
+ #: ../admin/class-is-editor.php:494
366
  msgid "Year"
367
  msgstr ""
368
 
369
+ #: ../admin/class-is-editor.php:508
370
  msgid "Password"
371
  msgstr ""
372
 
373
+ #: ../admin/class-is-editor.php:512
374
  msgid "Configure options to search posts with or without password."
375
  msgstr ""
376
 
377
+ #: ../admin/class-is-editor.php:517
378
  msgid "Search all posts with and without passwords."
379
  msgstr ""
380
 
381
+ #: ../admin/class-is-editor.php:519
382
  msgid "Search only posts with passwords."
383
  msgstr ""
384
 
385
+ #: ../admin/class-is-editor.php:521
386
  msgid "Search only posts without passwords."
387
  msgstr ""
388
 
389
+ #: ../admin/class-is-editor.php:534 ../admin/class-is-editor.php:858
390
  msgid "File Types"
391
  msgstr ""
392
 
393
+ #: ../admin/class-is-editor.php:538
394
  msgid ""
395
  "Configure searching to search based on posts that have a specific MIME type "
396
  "or files that have specific media attachments"
397
  msgstr ""
398
 
399
+ #: ../admin/class-is-editor.php:560
400
  msgid ""
401
  "Search has been already limited by excluding specific File type in the "
402
  "Excludes section."
403
  msgstr ""
404
 
405
+ #: ../admin/class-is-editor.php:563 ../admin/class-is-editor.php:886
406
+ msgid "Attachment post type is not included in search."
407
+ msgstr ""
408
+
409
+ #: ../admin/class-is-editor.php:567
410
  msgid "Selected File Types :"
411
  msgstr ""
412
 
413
+ #: ../admin/class-is-editor.php:593
414
  msgid "Configure the options to exclude specific content from search."
415
  msgstr ""
416
 
417
+ #: ../admin/class-is-editor.php:600
418
  msgid "Posts"
419
  msgstr ""
420
 
421
+ #: ../admin/class-is-editor.php:604
422
  msgid "The posts and pages of searchable post types display here."
423
  msgstr ""
424
 
425
+ #: ../admin/class-is-editor.php:605
426
  msgid "Select the posts you wish to exclude from the search."
427
  msgstr ""
428
 
429
+ #: ../admin/class-is-editor.php:606
430
  msgid "Selected post types display in BOLD."
431
  msgstr ""
432
 
433
+ #: ../admin/class-is-editor.php:658
434
  msgid ""
435
  "The taxonomies and terms attached to searchable post types display here."
436
  msgstr ""
437
 
438
+ #: ../admin/class-is-editor.php:659
439
  msgid "Exclude posts from search results that have specific terms"
440
  msgstr ""
441
 
442
+ #: ../admin/class-is-editor.php:660
443
  msgid "Selected terms taxonomy title display in BOLD."
444
  msgstr ""
445
 
446
+ #: ../admin/class-is-editor.php:704
447
  msgid "Exclude posts from the search having selected custom fields."
448
  msgstr ""
449
 
450
+ #: ../admin/class-is-editor.php:727
451
  msgid "Excluded Custom Fields :"
452
  msgstr ""
453
 
454
+ #: ../admin/class-is-editor.php:742
455
  msgid "Exclude specific WooCommerce products from the search."
456
  msgstr ""
457
 
458
+ #: ../admin/class-is-editor.php:757
459
  msgid "Exclude 'out of stock' WooCommerce products."
460
  msgstr ""
461
 
462
+ #: ../admin/class-is-editor.php:771
463
  msgid "Exclude posts from the search created by slected authors."
464
  msgstr ""
465
 
466
+ #: ../admin/class-is-editor.php:806
467
  msgid ""
468
  "Search has been already limited to posts created by specific authors in the "
469
  "Includes section."
470
  msgstr ""
471
 
472
+ #: ../admin/class-is-editor.php:817
473
  msgid "Exclude posts from the search having selected post statuses."
474
  msgstr ""
475
 
476
+ #: ../admin/class-is-editor.php:840
477
  msgid ""
478
  "Search has been already limited to posts statuses set in the Includes "
479
  "section."
480
  msgstr ""
481
 
482
+ #: ../admin/class-is-editor.php:848
483
  msgid "Exclude sticky posts from search."
484
  msgstr ""
485
 
486
+ #: ../admin/class-is-editor.php:862
487
  msgid ""
488
  "Exclude posts specially media attachment posts from the search having "
489
  "selected file types."
490
  msgstr ""
491
 
492
+ #: ../admin/class-is-editor.php:883
493
  msgid ""
494
  "Search has been already limited to specific File type set in the Includes "
495
  "section."
496
  msgstr ""
497
 
498
+ #: ../admin/class-is-editor.php:890
499
  msgid "Excluded File Types :"
500
  msgstr ""
501
 
502
+ #: ../admin/class-is-editor.php:913
503
  msgid "Configure the options here to control search of this search form."
504
  msgstr ""
505
 
506
+ #: ../admin/class-is-editor.php:920
507
  msgid "Posts Per Page"
508
  msgstr ""
509
 
510
+ #: ../admin/class-is-editor.php:930
511
  msgid "Number of posts to display on search results page."
512
  msgstr ""
513
 
514
+ #: ../admin/class-is-editor.php:939
515
  msgid "Order By"
516
  msgstr ""
517
 
518
+ #: ../admin/class-is-editor.php:975
519
  msgid "Highlight Terms"
520
  msgstr ""
521
 
522
+ #: ../admin/class-is-editor.php:985
523
  msgid "Highlight searched terms on search results page."
524
  msgstr ""
525
 
526
+ #: ../admin/class-is-editor.php:991
527
  msgid "Set highlight color."
528
  msgstr ""
529
 
530
+ #: ../admin/class-is-editor.php:1000
531
  msgid "Search Terms Relation"
532
  msgstr ""
533
 
534
+ #: ../admin/class-is-editor.php:1007
535
  msgid "OR - Display content having any of the searched terms."
536
  msgstr ""
537
 
538
+ #: ../admin/class-is-editor.php:1009
539
  msgid "AND - Display content having all the searched terms."
540
  msgstr ""
541
 
542
+ #: ../admin/class-is-editor.php:1018
543
  msgid "Fuzzy Matching"
544
  msgstr ""
545
 
546
+ #: ../admin/class-is-editor.php:1024
547
  msgid "Whole - Search posts that include the whole search term."
548
  msgstr ""
549
 
550
+ #: ../admin/class-is-editor.php:1026
551
  msgid ""
552
  "Partial - Also search words in the posts that begins or ends with the search "
553
  "term."
554
  msgstr ""
555
 
556
+ #: ../admin/class-is-editor.php:1035
557
  msgid "Keyword Stemming"
558
  msgstr ""
559
 
560
+ #: ../admin/class-is-editor.php:1039
561
  msgid "Searches the base word of a searched keyword"
562
  msgstr ""
563
 
564
+ #: ../admin/class-is-editor.php:1040
565
  msgid ""
566
  "For Example: If you search \"doing\" then it also searches base word of "
567
  "\"doing\" that is \"do\" in the specified post types."
568
  msgstr ""
569
 
570
+ #: ../admin/class-is-editor.php:1041
571
  msgid ""
572
  "If you want to search whole exact searched term then do not use this options "
573
  "and in this case it is not recommended to use when Fuzzy Matching option is "
574
  "set to Whole."
575
  msgstr ""
576
 
577
+ #: ../admin/class-is-editor.php:1047
578
  msgid "Also search base word of searched keyword."
579
  msgstr ""
580
 
581
+ #: ../admin/class-is-editor.php:1049
582
  msgid "Not recommended to use when Fuzzy Matching option is set to Whole."
583
  msgstr ""
584
 
585
+ #: ../admin/class-is-editor.php:1058
586
  msgid "Sticky Posts"
587
  msgstr ""
588
 
589
+ #: ../admin/class-is-editor.php:1064
590
  msgid "Move sticky posts to the start of the search results page."
591
  msgstr ""
592
 
593
+ #: ../admin/class-is-editor.php:1073
594
  msgid "Empty Search"
595
  msgstr ""
596
 
597
+ #: ../admin/class-is-editor.php:1079
598
  msgid "Display an error for empty search query."
599
  msgstr ""
600
 
601
+ #: ../admin/class-is-editor.php:1088
602
  msgid "Respect exclude_from_search"
603
  msgstr ""
604
 
605
+ #: ../admin/class-is-editor.php:1094
606
  msgid "Do not search post types which are excluded from search."
607
  msgstr ""
608
 
609
+ #: ../admin/class-is-editor.php:1103
610
  msgid "Demo"
611
  msgstr ""
612
 
613
+ #: ../admin/class-is-editor.php:1109
614
  msgid "Display search form only for site administrator."
615
  msgstr ""
616
 
617
+ #: ../admin/class-is-editor.php:1118 ../admin/class-is-settings-fields.php:152
618
  msgid "Disable"
619
  msgstr ""
620
 
621
+ #: ../admin/class-is-editor.php:1124
622
  msgid "Disable this search form."
623
  msgstr ""
624
 
762
  msgid "For more information:"
763
  msgstr ""
764
 
765
+ #: ../admin/class-is-help.php:110 ../admin/partials/new-search-form.php:184
766
  #: ../admin/partials/settings-form.php:90
767
  msgid "Docs"
768
  msgstr ""
769
 
770
+ #: ../admin/class-is-help.php:112 ../admin/partials/new-search-form.php:187
771
  #: ../admin/partials/settings-form.php:93
772
  msgid "Give us a rating"
773
  msgstr ""
795
  msgstr ""
796
 
797
  #: ../admin/class-is-list-table.php:150
798
+ #: ../admin/class-is-settings-fields.php:265
799
+ #: ../admin/class-is-settings-fields.php:438
800
+ #: ../admin/class-is-settings-fields.php:470 ../includes/class-is-widget.php:69
801
  msgid "Edit"
802
  msgstr ""
803
 
826
  msgid "d/m/Y"
827
  msgstr ""
828
 
829
+ #: ../admin/class-is-settings-fields.php:129
830
  msgid "Select Menu"
831
  msgstr ""
832
 
833
+ #: ../admin/class-is-settings-fields.php:136
834
  #: ../includes/class-is-search-form.php:60
835
  msgid "Search Form"
836
  msgstr ""
837
 
838
+ #: ../admin/class-is-settings-fields.php:137
839
  msgid "Form Style"
840
  msgstr ""
841
 
842
+ #: ../admin/class-is-settings-fields.php:138
843
  msgid "Menu Title"
844
  msgstr ""
845
 
846
+ #: ../admin/class-is-settings-fields.php:139
847
  msgid "Menu Classes"
848
  msgstr ""
849
 
850
+ #: ../admin/class-is-settings-fields.php:140
851
  msgid "Google CSE"
852
  msgstr ""
853
 
854
+ #: ../admin/class-is-settings-fields.php:141
855
  msgid "Close Icon"
856
  msgstr ""
857
 
858
+ #: ../admin/class-is-settings-fields.php:145
859
  msgid "Header"
860
  msgstr ""
861
 
862
+ #: ../admin/class-is-settings-fields.php:146
863
  msgid "Footer"
864
  msgstr ""
865
 
866
+ #: ../admin/class-is-settings-fields.php:147
867
  msgid "Mobile Display"
868
  msgstr ""
869
 
870
+ #: ../admin/class-is-settings-fields.php:148
871
  msgid "Custom CSS"
872
  msgstr ""
873
 
874
+ #: ../admin/class-is-settings-fields.php:149
875
  msgid "Stopwords"
876
  msgstr ""
877
 
878
+ #: ../admin/class-is-settings-fields.php:150
879
  msgid "Synonyms"
880
  msgstr ""
881
 
882
+ #: ../admin/class-is-settings-fields.php:151
883
  msgid "Not load files"
884
  msgstr ""
885
 
886
+ #: ../admin/class-is-settings-fields.php:153
887
  msgid "Default Search"
888
  msgstr ""
889
 
890
+ #: ../admin/class-is-settings-fields.php:162
891
  msgid "Use below options to display search in menu and configure it."
892
  msgstr ""
893
 
894
+ #: ../admin/class-is-settings-fields.php:171
895
  msgid "Use below options to make sitewide changes in search."
896
  msgstr ""
897
 
898
+ #: ../admin/class-is-settings-fields.php:179
899
  msgid "Select menu here where you want to display search form."
900
  msgstr ""
901
 
902
+ #: ../admin/class-is-settings-fields.php:199
903
  msgid "No navigation menu registered on your site."
904
  msgstr ""
905
 
906
+ #: ../admin/class-is-settings-fields.php:209
907
  msgid "Select post types here that you want to make searchable."
908
  msgstr ""
909
 
910
+ #: ../admin/class-is-settings-fields.php:238
911
  msgid ""
912
  "Select search form that will control search performed using menu search."
913
  msgstr ""
914
 
915
+ #: ../admin/class-is-settings-fields.php:240
916
  msgid "It overwrites above Post Types option."
917
  msgstr ""
918
 
919
+ #: ../admin/class-is-settings-fields.php:248
920
+ #: ../admin/class-is-settings-fields.php:258
921
+ #: ../admin/class-is-settings-fields.php:431
922
+ #: ../admin/class-is-settings-fields.php:463 ../includes/class-is-widget.php:62
923
  msgid "none"
924
  msgstr ""
925
 
926
+ #: ../admin/class-is-settings-fields.php:267
927
+ #: ../admin/class-is-settings-fields.php:440
928
+ #: ../admin/class-is-settings-fields.php:472 ../includes/class-is-widget.php:71
929
  msgid "Create New"
930
  msgstr ""
931
 
932
+ #: ../admin/class-is-settings-fields.php:281
933
  msgid "Select form style for the search form displayed in the menu."
934
  msgstr ""
935
 
936
+ #: ../admin/class-is-settings-fields.php:285
937
  msgid "Default"
938
  msgstr ""
939
 
940
+ #: ../admin/class-is-settings-fields.php:286
941
  msgid "Dropdown"
942
  msgstr ""
943
 
944
+ #: ../admin/class-is-settings-fields.php:287
945
  msgid "Sliding"
946
  msgstr ""
947
 
948
+ #: ../admin/class-is-settings-fields.php:288
949
  msgid "Full Width"
950
  msgstr ""
951
 
952
+ #: ../admin/class-is-settings-fields.php:289
953
  msgid "Popup"
954
  msgstr ""
955
 
956
+ #: ../admin/class-is-settings-fields.php:322
957
  msgid ""
958
  "Displays set menu title text in place of search icon displays in navigation "
959
  "menu."
960
  msgstr ""
961
 
962
+ #: ../admin/class-is-settings-fields.php:334
963
  msgid "Adds set classes in the search navigation menu item."
964
  msgstr ""
965
 
966
+ #: ../admin/class-is-settings-fields.php:339
967
  msgid "Add classes seperated by space."
968
  msgstr ""
969
 
970
+ #: ../admin/class-is-settings-fields.php:347
971
  msgid ""
972
  "Add only Google Custom Search( CSE ) search form code in the above text box "
973
  "that will replace default search form."
974
  msgstr ""
975
 
976
+ #: ../admin/class-is-settings-fields.php:359
977
  msgid ""
978
  "Note: Does not work with caching as this functionality uses the WordPress "
979
  "wp_is_mobile function."
980
  msgstr ""
981
 
982
+ #: ../admin/class-is-settings-fields.php:372
983
  msgid "Display search form in header on mobile devices"
984
  msgstr ""
985
 
986
+ #: ../admin/class-is-settings-fields.php:375
987
  msgid ""
988
  "Use this option to display search form in your site header and hide the "
989
  "search form on desktop using CSS code."
990
  msgstr ""
991
 
992
+ #: ../admin/class-is-settings-fields.php:388
993
  msgid "This site uses cache"
994
  msgstr ""
995
 
996
+ #: ../admin/class-is-settings-fields.php:399
997
  msgid "Disable search functionality on whole site."
998
  msgstr ""
999
 
1000
+ #: ../admin/class-is-settings-fields.php:410
1001
  msgid ""
1002
  "Do not use default search form to control WordPress default search "
1003
  "functionality."
1004
  msgstr ""
1005
 
1006
+ #: ../admin/class-is-settings-fields.php:419
1007
  msgid "Displays search form in site header using wp_head hook."
1008
  msgstr ""
1009
 
1010
+ #: ../admin/class-is-settings-fields.php:451
1011
  msgid "Displays search form in site footer using wp_footer hook."
1012
  msgstr ""
1013
 
1014
+ #: ../admin/class-is-settings-fields.php:492
1015
  msgid "Display Search Form Close Icon"
1016
  msgstr ""
1017
 
1018
+ #: ../admin/class-is-settings-fields.php:500
1019
  msgid "Add custom css code if any to style search form."
1020
  msgstr ""
1021
 
1022
+ #: ../admin/class-is-settings-fields.php:513
1023
  msgid ""
1024
  "Enter words here to add them to the list of stopwords. The stopwords will "
1025
  "not be searched."
1026
  msgstr ""
1027
 
1028
+ #: ../admin/class-is-settings-fields.php:514
1029
+ msgid "This works with search form."
1030
+ msgstr ""
1031
+
1032
+ #: ../admin/class-is-settings-fields.php:518
1033
  msgid "Please separate words with commas."
1034
  msgstr ""
1035
 
1036
+ #: ../admin/class-is-settings-fields.php:526
1037
  msgid "Add synonyms here to make the searches find better results."
1038
  msgstr ""
1039
 
1040
+ #: ../admin/class-is-settings-fields.php:527
1041
  msgid ""
1042
  "If you add bird = crow to the list of synonyms, searches for bird "
1043
  "automatically become a search for bird crow and will thus match to posts "
1044
  "that include either bird or crow."
1045
  msgstr ""
1046
 
1047
+ #: ../admin/class-is-settings-fields.php:528
1048
  msgid ""
1049
  "This only works for search forms and in OR searches. In AND searches the "
1050
  "synonyms only restrict the search, as now the search only finds posts that "
1051
  "contain both bird and crow."
1052
  msgstr ""
1053
 
1054
+ #: ../admin/class-is-settings-fields.php:533
1055
  msgid ""
1056
  "The format here is key = value;. Please separate every synonyms key = value "
1057
  "pairs with semicolon."
1058
  msgstr ""
1059
 
1060
+ #: ../admin/class-is-settings-fields.php:543
1061
  msgid "Disable synonyms for the search forms having AND search terms relation."
1062
  msgstr ""
1063
 
1064
+ #: ../admin/class-is-settings-fields.php:552
1065
  msgid "Configure to disable loading plugin CSS and JavaScript files."
1066
  msgstr ""
1067
 
1068
+ #: ../admin/class-is-settings-fields.php:556
1069
  msgid "Plugin CSS File"
1070
  msgstr ""
1071
 
1072
+ #: ../admin/class-is-settings-fields.php:557
1073
  msgid "Plugin JavaScript File"
1074
  msgstr ""
1075
 
1076
+ #: ../admin/class-is-settings-fields.php:577
1077
  msgid ""
1078
  "If checked, you have to add following plugin file code into your child theme "
1079
  "CSS file."
1080
  msgstr ""
1081
 
1082
+ #: ../admin/class-is-settings-fields.php:581
1083
  msgid ""
1084
  "If checked, you have to add following plugin files code into your child "
1085
  "theme JavaScript file."
1103
  msgid "Save"
1104
  msgstr ""
1105
 
1106
+ #: ../admin/partials/new-search-form.php:172
1107
+ msgid "Reset"
1108
+ msgstr ""
1109
+
1110
+ #: ../admin/partials/new-search-form.php:172
1111
+ msgid ""
1112
+ "You are about to reset this search form.\n"
1113
+ " 'Cancel' to stop, 'OK' to reset."
1114
+ msgstr ""
1115
+
1116
+ #: ../admin/partials/new-search-form.php:181
1117
  #: ../admin/partials/settings-form.php:87
1118
  msgid "Information"
1119
  msgstr ""
1120
 
1121
+ #: ../admin/partials/new-search-form.php:186
1122
  #: ../admin/partials/settings-form.php:92
1123
  msgid "Contact"
1124
  msgstr ""
1139
  msgid "Displays ivory search form."
1140
  msgstr ""
1141
 
1142
+ #: ../includes/freemius.php:55
1143
  #, php-format
1144
  msgid "Hey %1$s"
1145
  msgstr ""
1146
 
1147
+ #: ../includes/freemius.php:55
1148
  #, php-format
1149
  msgid ""
1150
  "Please help us improve %2$s by securely sharing some usage data with %5$s. "
public/class-is-public.php CHANGED
@@ -60,7 +60,7 @@ class IS_Public
60
  function wp_enqueue_scripts()
61
  {
62
  global $wp_query ;
63
- if ( !isset( $this->opt['do_not_load_plugin_files']['plugin-css-file'] ) && !isset( $this->opt['not_load_files']['css'] ) ) {
64
  wp_enqueue_style(
65
  'ivory-search-styles',
66
  plugins_url( '/public/css/ivory-search.css', IS_PLUGIN_FILE ),
@@ -69,7 +69,7 @@ class IS_Public
69
  );
70
  }
71
 
72
- if ( !isset( $this->opt['do_not_load_plugin_files']['plugin-js-file'] ) && !isset( $this->opt['not_load_files']['js'] ) ) {
73
  wp_enqueue_script(
74
  'ivory-search-scripts',
75
  plugins_url( '/public/js/ivory-search.js', IS_PLUGIN_FILE ),
@@ -264,23 +264,23 @@ class IS_Public
264
  $items .= '<li class="gsc-cse-search-menu">' . $this->opt['menu_gcse'] . '</li>';
265
  } else {
266
 
267
- if ( isset( $this->opt['add_search_to_menu_gcse'] ) && '' != $this->opt['add_search_to_menu_gcse'] ) {
268
  $items .= '<li class="gsc-cse-search-menu">' . $this->opt['add_search_to_menu_gcse'] . '</li>';
269
  } else {
270
- $search_class = ( isset( $this->opt['add_search_to_menu_classes'] ) ? $this->opt['add_search_to_menu_classes'] . ' astm-search-menu is-menu ' : 'astm-search-menu is-menu ' );
271
  $search_class = ( isset( $this->opt['menu_classes'] ) ? $this->opt['menu_classes'] . ' astm-search-menu is-menu ' : $search_class );
272
 
273
  if ( isset( $this->opt['menu_style'] ) ) {
274
  $search_class .= $this->opt['menu_style'];
275
  } else {
276
- $search_class .= ( isset( $this->opt['add_search_to_menu_style'] ) ? $this->opt['add_search_to_menu_style'] : 'default' );
277
  }
278
 
279
 
280
  if ( isset( $this->opt['menu_title'] ) ) {
281
  $title = $this->opt['menu_title'];
282
  } else {
283
- $title = ( isset( $this->opt['add_search_to_menu_title'] ) ? $this->opt['add_search_to_menu_title'] : '' );
284
  }
285
 
286
  $items .= '<li class="' . esc_attr( $search_class ) . '">';
@@ -326,23 +326,23 @@ class IS_Public
326
  $items .= '<div class="astm-search-menu-wrapper is-menu-wrapper"><div class="gsc-cse-search-menu">' . $this->opt['menu_gcse'] . '</div></div>';
327
  } else {
328
 
329
- if ( isset( $this->opt['add_search_to_menu_gcse'] ) && $this->opt['add_search_to_menu_gcse'] != '' ) {
330
  $items .= '<div class="astm-search-menu-wrapper is-menu-wrapper"><div class="gsc-cse-search-menu">' . $this->opt['add_search_to_menu_gcse'] . '</div></div>';
331
  } else {
332
- $search_class = ( isset( $this->opt['add_search_to_menu_classes'] ) ? $this->opt['add_search_to_menu_classes'] . ' astm-search-menu is-menu ' : 'astm-search-menu is-menu ' );
333
  $search_class = ( isset( $this->opt['menu_classes'] ) ? $this->opt['menu_classes'] . ' astm-search-menu is-menu ' : $search_class );
334
 
335
  if ( isset( $this->opt['menu_style'] ) ) {
336
  $search_class .= $this->opt['menu_style'];
337
  } else {
338
- $search_class .= ( isset( $this->opt['add_search_to_menu_style'] ) ? $this->opt['add_search_to_menu_style'] : 'default' );
339
  }
340
 
341
 
342
  if ( isset( $this->opt['menu_title'] ) ) {
343
  $title = $this->opt['menu_title'];
344
  } else {
345
- $title = ( isset( $this->opt['add_search_to_menu_title'] ) ? $this->opt['add_search_to_menu_title'] : '' );
346
  }
347
 
348
  $items .= '<div class="astm-search-menu-wrapper is-menu-wrapper"><div>';
@@ -364,7 +364,7 @@ class IS_Public
364
 
365
  if ( !isset( $this->opt['menu_style'] ) || $this->opt['menu_style'] !== 'popup' ) {
366
  $items .= $this->get_menu_search_form( false );
367
- if ( isset( $this->opt['add_search_to_menu_close_icon'] ) && $this->opt['add_search_to_menu_close_icon'] || isset( $this->opt['menu_close_icon'] ) && $this->opt['menu_close_icon'] ) {
368
  $items .= '<div class="search-close"></div>';
369
  }
370
  }
@@ -787,13 +787,7 @@ class IS_Public
787
  $searchand = " {$terms_relation_type} ";
788
  }
789
  $search = apply_filters( 'is_posts_search_terms', $search, $q['search_terms'] );
790
-
791
- if ( '' !== $OR ) {
792
- $search .= ")";
793
- } else {
794
- $search = "";
795
- }
796
-
797
  if ( isset( $q['post_type'] ) && NULL !== $q['post_type'] && !is_array( $q['post_type'] ) ) {
798
  $q['post_type'] = array( $q['post_type'] );
799
  }
@@ -923,7 +917,7 @@ class IS_Public
923
  echo '</style>' ;
924
  } else {
925
 
926
- if ( isset( $this->opt['add_search_to_menu_css'] ) && $this->opt['add_search_to_menu_css'] != '' ) {
927
  echo '<style type="text/css" media="screen">' ;
928
  echo '/* Add search to menu custom CSS code */' ;
929
  echo wp_specialchars_decode( esc_html( $this->opt['add_search_to_menu_css'] ), ENT_QUOTES ) ;
60
  function wp_enqueue_scripts()
61
  {
62
  global $wp_query ;
63
+ if ( ($this->ivory_search || !isset( $this->opt['do_not_load_plugin_files']['plugin-css-file'] )) && !isset( $this->opt['not_load_files']['css'] ) ) {
64
  wp_enqueue_style(
65
  'ivory-search-styles',
66
  plugins_url( '/public/css/ivory-search.css', IS_PLUGIN_FILE ),
69
  );
70
  }
71
 
72
+ if ( ($this->ivory_search || !isset( $this->opt['do_not_load_plugin_files']['plugin-js-file'] )) && !isset( $this->opt['not_load_files']['js'] ) ) {
73
  wp_enqueue_script(
74
  'ivory-search-scripts',
75
  plugins_url( '/public/js/ivory-search.js', IS_PLUGIN_FILE ),
264
  $items .= '<li class="gsc-cse-search-menu">' . $this->opt['menu_gcse'] . '</li>';
265
  } else {
266
 
267
+ if ( !$this->ivory_search && isset( $this->opt['add_search_to_menu_gcse'] ) && '' != $this->opt['add_search_to_menu_gcse'] ) {
268
  $items .= '<li class="gsc-cse-search-menu">' . $this->opt['add_search_to_menu_gcse'] . '</li>';
269
  } else {
270
+ $search_class = ( !$this->ivory_search && isset( $this->opt['add_search_to_menu_classes'] ) ? $this->opt['add_search_to_menu_classes'] . ' astm-search-menu is-menu ' : 'astm-search-menu is-menu ' );
271
  $search_class = ( isset( $this->opt['menu_classes'] ) ? $this->opt['menu_classes'] . ' astm-search-menu is-menu ' : $search_class );
272
 
273
  if ( isset( $this->opt['menu_style'] ) ) {
274
  $search_class .= $this->opt['menu_style'];
275
  } else {
276
+ $search_class .= ( !$this->ivory_search && isset( $this->opt['add_search_to_menu_style'] ) ? $this->opt['add_search_to_menu_style'] : 'default' );
277
  }
278
 
279
 
280
  if ( isset( $this->opt['menu_title'] ) ) {
281
  $title = $this->opt['menu_title'];
282
  } else {
283
+ $title = ( !$this->ivory_search && isset( $this->opt['add_search_to_menu_title'] ) ? $this->opt['add_search_to_menu_title'] : '' );
284
  }
285
 
286
  $items .= '<li class="' . esc_attr( $search_class ) . '">';
326
  $items .= '<div class="astm-search-menu-wrapper is-menu-wrapper"><div class="gsc-cse-search-menu">' . $this->opt['menu_gcse'] . '</div></div>';
327
  } else {
328
 
329
+ if ( !$this->ivory_search && isset( $this->opt['add_search_to_menu_gcse'] ) && $this->opt['add_search_to_menu_gcse'] != '' ) {
330
  $items .= '<div class="astm-search-menu-wrapper is-menu-wrapper"><div class="gsc-cse-search-menu">' . $this->opt['add_search_to_menu_gcse'] . '</div></div>';
331
  } else {
332
+ $search_class = ( !$this->ivory_search && isset( $this->opt['add_search_to_menu_classes'] ) ? $this->opt['add_search_to_menu_classes'] . ' astm-search-menu is-menu ' : 'astm-search-menu is-menu ' );
333
  $search_class = ( isset( $this->opt['menu_classes'] ) ? $this->opt['menu_classes'] . ' astm-search-menu is-menu ' : $search_class );
334
 
335
  if ( isset( $this->opt['menu_style'] ) ) {
336
  $search_class .= $this->opt['menu_style'];
337
  } else {
338
+ $search_class .= ( !$this->ivory_search && isset( $this->opt['add_search_to_menu_style'] ) ? $this->opt['add_search_to_menu_style'] : 'default' );
339
  }
340
 
341
 
342
  if ( isset( $this->opt['menu_title'] ) ) {
343
  $title = $this->opt['menu_title'];
344
  } else {
345
+ $title = ( !$this->ivory_search && isset( $this->opt['add_search_to_menu_title'] ) ? $this->opt['add_search_to_menu_title'] : '' );
346
  }
347
 
348
  $items .= '<div class="astm-search-menu-wrapper is-menu-wrapper"><div>';
364
 
365
  if ( !isset( $this->opt['menu_style'] ) || $this->opt['menu_style'] !== 'popup' ) {
366
  $items .= $this->get_menu_search_form( false );
367
+ if ( isset( $this->opt['add_search_to_menu_close_icon'] ) && $this->opt['add_search_to_menu_close_icon'] && !$this->ivory_search || isset( $this->opt['menu_close_icon'] ) && $this->opt['menu_close_icon'] ) {
368
  $items .= '<div class="search-close"></div>';
369
  }
370
  }
787
  $searchand = " {$terms_relation_type} ";
788
  }
789
  $search = apply_filters( 'is_posts_search_terms', $search, $q['search_terms'] );
790
+ $search .= ")";
 
 
 
 
 
 
791
  if ( isset( $q['post_type'] ) && NULL !== $q['post_type'] && !is_array( $q['post_type'] ) ) {
792
  $q['post_type'] = array( $q['post_type'] );
793
  }
917
  echo '</style>' ;
918
  } else {
919
 
920
+ if ( !$this->ivory_search && isset( $this->opt['add_search_to_menu_css'] ) && $this->opt['add_search_to_menu_css'] != '' ) {
921
  echo '<style type="text/css" media="screen">' ;
922
  echo '/* Add search to menu custom CSS code */' ;
923
  echo wp_specialchars_decode( esc_html( $this->opt['add_search_to_menu_css'] ), ENT_QUOTES ) ;
readme.txt CHANGED
@@ -5,99 +5,111 @@ Tags: search, search menu, woocommerce search, search plugin, search shortcode,
5
  Requires at least: 3.9
6
  Tested up to: 4.9
7
  Requires PHP: 5.2.4
8
- Stable tag: 4.1
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
12
- The Ultimate WordPress Search plugin to power your custom search. Helping you build a better search. Includes WooCommerce Search support!
13
 
14
  == Description ==
15
 
16
- Ivory Search enhances the default WordPress search allowing you to build a powerful and advanced custom search for your WordPress site.
17
-
18
- With Ivory Search, you can create an unlimited number of search forms and configure each search form individually, giving you unlimited power and flexibility in how your WordPress Search works. Just a few of the options include excluding specific post types from search, excluding specific categories from search and more!
19
-
20
- Display the custom search forms in your site header, include a search form in your footer. Even include a search form in your navigation! Best of all? Include a search form anywhere at all on your site, on pages, posts and custom post types by using Ivory Search’s powerful built in search shortcode system.
21
-
22
- Read [this documentation](https://ivorysearch.com/knowledge-base/how-to-use-ivory-search-plugin/) to learn how to build and create a custom search using Ivory Search.
23
-
24
- Want to know more? Here are just some of the key features of the Ivory Search plugin.
25
-
26
- = Key Features =
27
- * Create unlimited number of search forms and use the powerful search editor to configure each one separately.
28
- * Configure each WordPress search form to search specific content, such as only searching a specific post type.
29
- * Configure each WordPress search form to exclude specific content, maybe you don’t want the media library results displaying? Disable them from showing entirely!
30
- * Create a search form to search by category, search by term, search by tags, search by post format, search by product category, search by product type or search any custom taxonomies!
31
- * Search in taxonomy terms title and description.
32
- * Search posts that have specific custom fields or search by metadata.
33
- * Search in author display name and display the posts created by that author.
34
- * Search WordPress comments! No more do you have to sift through countless comments, quickly and easily search comments.
35
- * Search by date! Allows you to search for posts created before, after or in between specified dates.
36
- * Search posts with passwords, search posts without passwords or only search posts with or without passwords.
37
- * Search exact words with term matching using quotes, for example “Ivory Search is awesome”.
38
- * Display Search Forms anywhere on your site.
39
- * Search all or any of the search terms.
40
- * Fuzzy Match searching! Fuzzy Search allows you to search whole or partial word of the search term using Fuzzy matching search.
41
- * Integrates directly with bbPress allowing you to create a powerful search, to search bbPress forums and topics.
42
- * Integrates directly with WooCommerce, creating an advanced powerful custom WooCommerce Search.
43
-
44
- Phew! That’s a lot of stuff right? Best of all, everything there is free! A powerful plug and play search plugin. There’s more though.
45
-
46
- = Exclude Specific Content From Search =
47
-
48
- Excluding content from a users search is an important aspect of any custom search plugin, this allows you to easily configure what doesn’t show in the search including:
49
-
50
- * Exclude specific posts, pages, WooCommerce Products, Media Attachments, forums or any custom post type from search.
51
- * Do not search in the post title, or configure the search form to not search in post content or search the post excerpt.
52
- * Exclude posts and custom posts types from search which have specific categories, terms, tags, post formats, product category, product type or exclude any custom taxonomies from the search.
53
- * Exclude Sticky Posts from search.
54
- * Exclude posts from search that have a specific number of comments.
55
- * Exclude posts from search which were created before or after specific dates.
56
- * Exclude password protected posts from search.
57
-
58
- Still not tempted to use Ivory Search to get a better search for your WordPress site? How about making an even more Relevant Search by controlling and extending the custom search forms?
59
-
60
- = Control and Extend Search =
61
- * Add search to menu, configure the custom search menu functionality and create custom styles.
62
- * Configure the number of posts to display in search results.
63
- * Highlight Search terms on the search results page.
64
- * Option to display or hide sticky posts at the top of the search results page.
65
- * Display custom errors for empty search queries or display all posts.
66
- * Option to search posts or not search posts that have been created using the exclude_from_search.
67
- * Display custom search forms for administrators only while testing, before going live.
68
- * Disable an individual search form or disable searching site wide!
69
- * Custom stop words, configure stop words from being search.
70
- * Option to add synonyms to provide more relevant search results and provide a better search experience.
71
-
72
- All those features above are all free! You can’t get much better than a custom search plugin for free right? How about this. The styling of the search form highly depends on how your theme styles it, but no one wants a search form that doesn’t fit their site style. Have a search form style issue? Get support from our friendly and helpful team to match the search styling to your site from [Ivory Search Support](https://ivorysearch.com/support/).
73
-
74
- Wondering what happened to Add Search To Menu Plugin? We re-wrote it from the ground up and Add Search to Menu has become Ivory Search.
75
-
76
- Stop! Wait! There’s more. Think the above is good? Wait until you see what Ivory Search Premium offers.
77
-
78
- = Ivory Search Premium =
79
-
80
- Love Ivory Search? Why not upgrade to Ivory Search Premium and support us in providing the best custom search for WordPress.
81
-
82
- Just a few of the key features of Ivory Search Premium;
83
-
84
- * Advanced WooCommerce Search Integration.
85
- * Search by specific taxonomy terms.
86
- * Use the custom WooCommerce search to search products by SKU.
87
- * Search posts by author.
88
- * Search posts that have a specific post status.
89
- * Search posts that have a specific, greater than or less than number of comments.
90
- * Search Images.
91
- * Search attachments and media that have a specific file type or search for a specific MIME type.
92
- * Search in the title, caption and description of images, attachments and media!
93
- * Exclude Posts and custom post types from search that have specific custom fields or metadata.
94
- * Exclude out of stock WooCommerce products from showing in the WooCommerce Search.
95
- * Exclude specific authors posts from search.
96
- * Exclude posts from search that have a specific post status.
97
- * Exclude Images, attachments and media from search that have a specific file type or MIME type.
98
- * Create advanced relevant searches by ordering posts in ascending or descending order of date, relevance, id, author, title, type, name, comment count, menu order or entirely random.
99
-
100
- Find out more about Ivory Search Pro and purchase from [Ivory Search Premium](https://ivorysearch.com/pricing/).
 
 
 
 
 
 
 
 
 
 
 
 
101
 
102
  = Help =
103
 
@@ -120,33 +132,33 @@ Any suggestions or comments are welcome. Feel free to contact us using this [Con
120
 
121
  Please read below documentation to know how to use Ivory Search plugin.
122
 
123
- https://ivorysearch.com/knowledge-base/how-to-use-ivory-search-plugin/
124
 
125
  = Is the plugin compatible with WooCommerce? =
126
 
127
- It is! Ivory Search integrates directly with WooCommerce to provide a powerful and advanced WooCommerce Search. Not only can you use Fuzzy searching, you can exclude specific WooCommerce products from search, include specific WooCommerce products in your search and much much more.
128
 
129
- If you need more advanced WooCommerce Search functionality, upgrade to Ivory Search premium which provides WooCommerce SKU searching and even more powerful WooCommerce Search functionality.
130
 
131
- = Can I Add Search to Menu? =
132
 
133
- Sure thing! Using our advanced custom search plugin you can easily add your search to menu in just a couple of clicks, be up and running in minutes and never look back.
134
 
135
- = What About Search Shortcodes? =
136
 
137
- Glad you asked! Ivory Search provides a range of search shortcodes you can use, best of all you can create an unlimited number of custom search forms and then embed them on your WordPress site using our powerful and easy to use range of Search Shortcodes.
138
 
139
- = Don’t suppose you have Search Widgets? =
140
 
141
- We do have Search Widgets! Using Ivory Search you can add a custom search widget to your WordPress powered website quickly and easily, with minimal hassle. Simply add your custom search form. Then head on over to your widgets area and add your custom search widget in a couple of clicks. Couldn’t get much easier than that. What’s more, the custom search widget works completely out the box with any theme.
142
 
143
- = Will My Custom Search Work With My Theme? =
144
 
145
- Ivory Search, has been tested and works perfectly with a range of themes, including but by no means limited to Divi, allowing you to build a custom search with Divi, Avada, X and Pro by Themeco, GeneratePress, OceanWP and many more.
146
 
147
  = Do You Offer Customization Support? =
148
 
149
- We do! We try our best to help free users with customisation requests and we offer guaranteed CSS customisations for our premium users.
150
 
151
  == Screenshots ==
152
 
@@ -163,6 +175,11 @@ We do! We try our best to help free users with customisation requests and we off
163
 
164
  == Changelog ==
165
 
 
 
 
 
 
166
  = 4.1 =
167
  * Improved plugin settings User Interface.
168
  * Added compatibility with Polylang plugin.
5
  Requires at least: 3.9
6
  Tested up to: 4.9
7
  Requires PHP: 5.2.4
8
+ Stable tag: 4.1.1
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
12
+ The WordPress Search plugin to power your WordPress site custom search. Helping you build a better search. Includes WooCommerce Search support!
13
 
14
  == Description ==
15
 
16
+ Ivory Search is a simple to use advanced WordPress search plugin.
17
+
18
+ It enhances the default WordPress search and also allows you to create new custom search forms.
19
+
20
+ With Ivory Search, you can create an unlimited number of search forms and configure each search form individually to customize WordPress search and perform different types of searches on site content.
21
+
22
+ Display the custom search forms on site header, footer, sidebar or widget area, navigation or menu, on pages, posts, custom post types or anywhere on the site using its shortcodes.
23
+
24
+ > Note: The styling of the search form highly depends on how your theme styles it. If your theme does not style search form correctly then to style it get free support from [Ivory Search Support](https://ivorysearch.com/support/).
25
+
26
+ Have any doubt or question?
27
+ Feel free to ask it using [Contact Form](https://ivorysearch.com/contact/).
28
+
29
+ = Links =
30
+ * [Website](https://ivorysearch.com/)
31
+ * [Documentation](https://ivorysearch.com/documentation/)
32
+ * [Support](https://ivorysearch.com/support/)
33
+ * [Contact Us](https://ivorysearch.com/contact/)
34
+
35
+ ###Key Features
36
+
37
+ <ul>
38
+ <li> Create unlimited number of search forms.</li>
39
+ <li> Configure each search forms separately.</li>
40
+ <li> Configure search form to search specific content.</li>
41
+ <li> Exclude specific content from search results.</li>
42
+ <li> Display Search Forms anywhere on your site.</li>
43
+ <li> Integrates with popular plugins such as WooCommerce, Polylang, bbPress etc.</li>
44
+ </ul>
45
+
46
+ ###Search Specific Content
47
+ <ul>
48
+ <li> Search specific post types such as post, page, product, attachment, forum etc.</li>
49
+ <li> Search in post title.</li>
50
+ <li> Search in post content.</li>
51
+ <li> Search in post excerpt.</li>
52
+ <li> Search posts having specific category or taxonomy terms.</li>
53
+ <li> Search in category or taxonomy terms title.</li>
54
+ <li> Search in category or taxonomy terms description.</li>
55
+ <li> Search posts having specific custom fields or metadata.</li>
56
+ <li> Search WooCommerce products SKU. [Premium]</li>
57
+ <li> Search posts created by specific authors. [Premium]</li>
58
+ <li> Search in author Display name and display the posts created by that author.</li>
59
+ <li> Search posts having specific statuses. [Premium]</li>
60
+ <li> Search posts having specific number of comments. [Premium]</li>
61
+ <li> Search in approved comments content.</li>
62
+ <li> Search posts created in specific date.</li>
63
+ <li> Search only password protected posts.</li>
64
+ <li> Search only posts without passwords.</li>
65
+ <li> Search all posts with and without passwords.</li>
66
+ <li> Search specific files, MIME type or media attachments such as images, audio, videos, PDF, documents etc. [Premium]</li>
67
+ <li> Search in the title, caption and description of images, attachments and media. [Premium]</li>
68
+ </ul>
69
+
70
+ ###Exclude Specific Content From Search
71
+ <ul>
72
+ <li> Exclude specific post types from search.</li>
73
+ <li> Exclude specific posts, pages, WooCommerce Products, Media Attachments, forums or any custom post type from search.</li>
74
+ <li> Do not search in the post title.</li>
75
+ <li> Configure to not search in post content.</li>
76
+ <li> Configure to not search in post excerpt.</li>
77
+ <li> Exclude posts from search having specific category or taxonomy terms.</li>
78
+ <li> Exclude posts from search having specific custom fields or metadata. [Premium]</li>
79
+ <li> Exclude 'out of stock' WooCommerce products from search. [Premium]</li>
80
+ <li> Exclude posts from search created by specific authors. [Premium]</li>
81
+ <li> Exclude posts from search having specific statuses. [Premium]</li>
82
+ <li> Exclude sticky posts from search.</li>
83
+ <li> Exclude posts from search having specific number of comments.</li>
84
+ <li> Exclude posts from search created before or after specific dates.</li>
85
+ <li> Exclude password protected posts from search.</li>
86
+ <li> Exclude posts from search without passwords.</li>
87
+ <li> Exclude images, audios, videos, PDF, documents, attachments, files, media, file type or MIME type from search. [Premium]</li>
88
+ </ul>
89
+
90
+ ###Control and Extend Search
91
+ <ul>
92
+ <li> Display search form in navigation menu and configure its functionality.</li>
93
+ <li> Configure the number of posts to display in search results.</li>
94
+ <li> Highlight search terms on the search results page.</li>
95
+ <li> Order posts in ascending or descending order of date, relevance, id, author, title, type, name, comment count, menu order or entirely random. [Premium]</li>
96
+ <li> Display or hide sticky posts at the top of the search results page.</li>
97
+ <li> Display an error page or list all posts for empty search queries.</li>
98
+ <li> Option to search or not search post types excluded from search using exclude_from_search.</li>
99
+ <li> Display search forms only to site administrators while testing, before going live.</li>
100
+ <li> Disable an individual search form or disable searching site wide.</li>
101
+ <li> Configure stop words which are excluded from search.</li>
102
+ <li> Option to add word synonyms to provide more relevant search results.</li>
103
+ <li> Display post_type argument in the search query URL and restrict search to it.</li>
104
+ <li> Search posts having all or any of the selected category or taxonomy terms.</li>
105
+ <li> Display content having any or all the searched terms. [Premium]</li>
106
+ <li> Fuzzy Matching - Search posts that include the whole search term or search words in the posts that begins or ends with the search term.</li>
107
+ <li> Keyword Stemming - Also searches base word of searched keyword. [Premium]</li>
108
+ </ul>
109
+
110
+ > Note: some of the features are Premium marked as [Premium]. To have access to those features you will need Ivory Search Premium. You can [get Ivory Search Premium here](https://ivorysearch.com/pricing/)!
111
+
112
+ We enhanced and re-wrote old Add Search To Menu plugin from the ground up and Add Search To Menu has renamed to Ivory Search.
113
 
114
  = Help =
115
 
132
 
133
  Please read below documentation to know how to use Ivory Search plugin.
134
 
135
+ [https://ivorysearch.com/knowledge-base/how-to-use-ivory-search-plugin/](https://ivorysearch.com/knowledge-base/how-to-use-ivory-search-plugin/)
136
 
137
  = Is the plugin compatible with WooCommerce? =
138
 
139
+ Yes the Ivory Search plugin integrates directly with WooCommerce to provide a powerful and advanced WooCommerce Search. Not only can you use Fuzzy searching, you can exclude specific WooCommerce products from search, include specific WooCommerce products in your search and much more.
140
 
141
+ If you need more advanced WooCommerce Search functionality, upgrade to [Ivory Search Premium](https://ivorysearch.com/pricing/) which provides WooCommerce SKU searching and even more powerful WooCommerce Search functionality.
142
 
143
+ = Can I add search to menu? =
144
 
145
+ Yes you can easily add your search to menu in just a couple of clicks, be up and running in minutes.
146
 
147
+ = Does the plugin provide search shortcodes? =
148
 
149
+ Yes Ivory Search provides a range of search shortcodes you can use, best of all you can create an unlimited number of custom search forms and then embed them on your WordPress site using our powerful and easy to use range of Search Shortcodes.
150
 
151
+ = Does the plugin provide search widgets? =
152
 
153
+ Yes it provides search widgets. Using Ivory Search you can add a custom search widget to your WordPress powered website quickly and easily, with minimal hassle. To use it simply add your custom search form then head on over to your widgets area and add ivory search widget in widget area.
154
 
155
+ = Will the custom search work with my theme? =
156
 
157
+ Yes. Ivory Search, has been tested and works perfectly with a range of themes, including but by no means limited to Divi, allowing you to build a custom search with Divi, Avada, X and Pro by Themeco, GeneratePress, OceanWP and many more.
158
 
159
  = Do You Offer Customization Support? =
160
 
161
+ Yes we do. We try our best to help free users with customisation requests and we offer guaranteed CSS customisations for our premium users.
162
 
163
  == Screenshots ==
164
 
175
 
176
  == Changelog ==
177
 
178
+ = 4.1.1 =
179
+ * Developed reset button to reset search form.
180
+ * Designed new switch control UI for plugin settings page.
181
+ * Developed functionality to display plugin options changed indicator.
182
+
183
  = 4.1 =
184
  * Improved plugin settings User Interface.
185
  * Added compatibility with Polylang plugin.