search_form = $search_form; } function is_name( $string ) { return preg_match( '/^[A-Za-z][-A-Za-z0-9_:.]*$/', $string ); } public function add_panel( $id, $title, $callback ) { if ( $this->is_name( $id ) ) { $this->panels[$id] = array( 'title' => $title, 'callback' => $callback, ); } } public function display() { if ( empty( $this->panels ) ) { return; } echo ''; foreach ( $this->panels as $id => $panel ) { echo sprintf( '
', esc_attr( $id ) ); $this->notice( $id, $panel ); $callback = $panel['callback']; $this->$callback( $this->search_form ); echo '
'; } } public function notice( $id, $panel ) { echo '
'; } /** * Gets all public meta keys of post types * * @global Object $wpdb WPDB object * @return Array array of meta keys */ function is_meta_keys( $post_types ) { global $wpdb; $post_types = implode( "', '", $post_types ); $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" ) ); $meta_keys = array(); if ( is_array( $is_fields ) && ! empty( $is_fields ) ) { foreach ( $is_fields as $field ) { if ( isset( $field->meta_key ) ) { $meta_keys[] = $field->meta_key; } } } /** * Filter results of SQL query for meta keys */ return apply_filters( 'is_meta_keys', $meta_keys ); } public function includes_panel( $post ) { $id = '_is_includes'; $includes = $post->prop( $id ); $settings = $post->prop( '_is_settings' ); $excludes = $post->prop( '_is_excludes' ); ?>
true ); if ( isset( $settings['exclude_from_search'] ) ) { $args = array( 'public' => true, 'exclude_from_search' => false ); } $posts = get_post_types( $args ); if ( ! empty( $posts ) ){ foreach ( $posts as $key => $post_type ) { $checked = isset( $includes['post_type'][ esc_attr( $key )] ) ? $includes['post_type'][ esc_attr( $key )] : 0; echo '
'; echo '
'; } $checked = ( isset( $includes['search_title'] ) && $includes['search_title'] ) ? 1 : 0; echo '

'; echo '

'; $checked = ( isset( $includes['search_content'] ) && $includes['search_content'] ) ? 1 : 0; echo '

'; echo '

'; $checked = ( isset( $includes['search_excerpt'] ) && $includes['search_excerpt'] ) ? 1 : 0; echo '

'; echo '

'; echo '
'; } else { _e( 'No post types registered on your site.', 'ivory-search' ); } ?>
' . __( 'Select post types that you want to make searchable.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
$tax_obj ) { $terms = get_terms( array( 'taxonomy' => $key, 'hide_empty' => false, ) ); if ( ! empty( $terms ) ){ echo '
' . ucwords( str_replace( '-', ' ', str_replace( '_', ' ', esc_html( $key ) ) ) ) . '
'; echo ''; echo '
'; } } echo '
'; $checked = ( isset( $includes['tax_rel'] ) && "OR" == $includes['tax_rel'] ) ? "OR" : "AND"; echo '

'; echo '

'; echo '

'; echo '

'; $checked = ( isset( $includes['search_tax_title'] ) && $includes['search_tax_title'] ) ? 1 : 0; echo '

'; echo '

'; $checked = ( isset( $includes['search_tax_desp'] ) && $includes['search_tax_desp'] ) ? 1 : 0; echo '

'; echo '

'; } else { _e( 'No taxonomies registered for slected post types.', 'ivory-search' ); } ?>
' . __( 'The non empty terms created in the registered taxonomies of above selected post types display here.', 'ivory-search' ) . '

'; $content .= '

' . __( 'Select terms here to restrict search to the posts having selected terms.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
is_meta_keys( $args ); if ( ! empty( $meta_keys ) ) { echo ''; echo '

'; } ?>
' . __( 'Select custom fields to make their values searchable.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
is_plan( 'pro_plus' ) ? '' : ' disabled '; $checked = ( isset( $includes['woo']['sku'] ) && $includes['woo']['sku'] ) ? 1 : 0; echo '

'; echo ''; echo IS_Admin::pro_link( 'pro_plus' ) . '

'; } else { _e( 'WooCommerce product post type is not included in search.', 'ivory-search' ); } ?>
' . __( 'Configure WooCommerce products search options here.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
is_plan( 'pro' ) ? '' : ' disabled '; $authors = get_users( array( 'fields' => array( 'ID', 'display_name' ), 'orderby' => 'post_count', 'order' => 'DESC', 'who' => 'authors', ) ); if ( ! empty( $authors ) ) { if ( '' !== $author_disable ) { echo '
' . IS_Admin::pro_link() . '
'; } foreach ( $authors as $author ) { $post_count = count_user_posts( $author->ID ); // Move on if user has not published a post (yet). if ( ! $post_count ) { continue; } $checked = isset( $includes['author'][ esc_attr( $author->ID )] ) ? $includes['author'][ esc_attr( $author->ID )] : 0; echo '
ID, $checked, false ) . '/>'; echo '
'; } } } else { echo ''; } $checked = ( isset( $includes['search_author'] ) && $includes['search_author'] ) ? 1 : 0; echo '

'; echo ''; ?>
' . __( 'Make specific author posts searchable.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
is_plan( 'pro' ) ? '' : ' disabled '; if ( ! empty( $post_statuses ) ) { if ( '' !== $post_status_disable ) { echo '
' . IS_Admin::pro_link() . '
'; } foreach ( $post_statuses as $key => $post_status ) { $checked = isset( $includes['post_status'][ esc_attr( $key )] ) ? $includes['post_status'][ esc_attr( $key )] : 0; echo '
'; echo '
'; } } } else { echo ''; } ?>
' . __( 'Configure options to search posts having specific post statuses.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
is_plan( 'pro' ) ? '' : ' disabled '; echo ''; echo IS_Admin::pro_link() . ''; echo '
'; echo IS_Admin::pro_link() . ''; $checked = ( isset( $includes['search_comment'] ) && $includes['search_comment'] ) ? 1 : 0; echo '

'; echo ''; ?>
' . __( 'Make posts searchable having specific comments count.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
' . ucfirst( $value ) . '
'; echo ''; echo ''; echo ''; } ?>
' . __( 'Make posts searchable created in the specific date range.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
'; echo '

'; echo '

'; echo '

'; echo '

'; echo '

'; ?>
' . __( 'Configure options to search posts with or without password.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
is_plan( 'pro_plus' ) ? '' : ' disabled '; ksort($file_types); echo ''; echo IS_Admin::pro_link( 'pro_plus' ); echo '

'; } } else { echo ''; } ?>
' . __( 'Configure options to search posts having specific MIME or file types specially media attachment posts.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
prop( $id ); $includes = $post->prop( '_is_includes' ); ?>
$post_type, 'posts_per_page'=> -1, 'orderby' => 'title', 'order' => 'ASC', ) ); if ( ! empty( $posts ) ) { echo '
' . ucwords( $post_type ) . '
'; echo '
'; } } echo '
'; ?>
' . __( 'The posts and pages of searchable post types display here. You can make post types searchable in the form Includes section.', 'ivory-search' ) . '

'; $content .= '

' . __( 'Select the posts to exclude from the search.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
$tax_obj ) { $terms = get_terms( array( 'taxonomy' => $key, 'hide_empty' => false, ) ); if ( ! empty( $terms ) ){ echo '
' . ucwords( str_replace( '-', ' ', str_replace( '_', ' ', esc_html( $key ) ) ) ) . '
'; echo '
'; } } echo '
'; } else { _e( 'No taxonomies registered for slected post types.', 'ivory-search' ); } ?>
' . __( 'The taxonomies and terms attached to searchable post types display here. You can make post types searchable in the form Includes section.', 'ivory-search' ) . '

'; $content .= '

' . __( 'Exclude posts from the search having selected terms.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
is_meta_keys( $args ); if ( ! empty( $meta_keys ) ) { $custom_field_disable = is_fs()->is_plan( 'pro' ) ? '' : ' disabled '; echo ''; echo IS_Admin::pro_link(); echo '

'; } ?>
' . __( 'Exclude posts from the search having selected custom fields.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
is_plan( 'pro_plus' ) ? '' : ' disabled '; $checked = ( isset( $excludes['woo']['outofstock'] ) && $excludes['woo']['outofstock'] ) ? 1 : 0; echo ''; echo ''; echo IS_Admin::pro_link( 'pro_plus' ); } else { _e( 'WooCommerce product post type is not included in search.', 'ivory-search' ); } ?> ' . __( 'Exclude specific WooCommerce products from the search.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
is_plan( 'pro' ) ? '' : ' disabled '; $authors = get_users( array( 'fields' => array( 'ID', 'display_name' ), 'orderby' => 'post_count', 'order' => 'DESC', 'who' => 'authors', ) ); if ( ! empty( $authors ) ) { if ( '' !== $author_disable ) { echo '
' . IS_Admin::pro_link() . '
'; } foreach ( $authors as $author ) { $post_count = count_user_posts( $author->ID ); // Move on if user has not published a post (yet). if ( ! $post_count ) { continue; } $checked = isset( $excludes['author'][ esc_attr( $author->ID )] ) ? $excludes['author'][ esc_attr( $author->ID )] : 0; echo '
ID, $checked, false ) . '/>'; echo '
'; } } } else { echo ''; } ?>
' . __( 'Exclude posts from the search created by slected authors.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
is_plan( 'pro' ) ? '' : ' disabled '; if ( ! empty( $post_statuses ) ) { if ( '' !== $post_status_disable ) { echo '
' . IS_Admin::pro_link() . '
'; } foreach ( $post_statuses as $key => $post_status ) { $checked = isset( $excludes['post_status'][ esc_attr( $key )] ) ? $excludes['post_status'][ esc_attr( $key )] : 0; echo '
'; echo '
'; } } } else { echo ''; } $checked = ( isset( $excludes['ignore_sticky_posts'] ) && $excludes['ignore_sticky_posts'] ) ? 1 : 0; echo '

'; echo ''; ?>
' . __( 'Exclude posts from the search having selected post statuses.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
is_plan( 'pro_plus' ) ? '' : ' disabled '; ksort( $file_types ); echo ''; echo IS_Admin::pro_link( 'pro_plus' ); echo '

'; } } else { echo ''; } ?>
' . __( 'Exclude posts specially media attachment posts from the search having selected file types.', 'ivory-search' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
prop( $id ); ?>
'; $checked = isset( $settings['posts_per_page'] ) ? $settings['posts_per_page'] : get_option( 'posts_per_page', 10 ); for ( $d = 1; $d <= 1000; $d++ ) { echo ''; } echo ''; ?>
is_plan( 'pro' ) ? '' : ' disabled '; echo ''; echo IS_Admin::pro_link(); ?>
'; echo ''; $color = ( isset( $settings['highlight_color'] ) ) ? $settings['highlight_color'] : '#FFFFB9'; echo '

'; echo ''; ?>
is_plan( 'pro' ) ? '' : ' disabled '; $checked = ( isset( $settings['term_rel'] ) && "OR" === $settings['term_rel'] ) ? "OR" : "AND"; echo '

'; echo '' . IS_Admin::pro_link() . '

'; echo '

'; echo '

'; ?>
'; echo '

'; echo '

'; echo '

'; ?>
is_plan( 'pro_plus' ) ? '' : ' disabled '; $checked = ( isset( $settings['keyword_stem'] ) && $settings['keyword_stem'] ) ? 1 : 0; echo ''; echo ''; echo IS_Admin::pro_link( 'pro_plus' ); echo '
'; ?>
' . __( 'It also searches base word of searched keyword.', 'ivory-search' ) . '

'; $content .= '

' . __( 'For Example: If you search "doing" then it also searches base word of "doing" that is "do" in the posts.', 'ivory-search' ) . '

'; $content .= '

' . __( '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' ) . '

'; IS_Help::help_tooltip( $title, $content ); ?>
'; echo ''; ?>
'; echo ''; ?>
'; echo ''; ?>
'; echo ''; ?>
'; echo ''; ?>