| @@ -29,8 +29,9 @@ | ||
| 29 | 29 | |
| 30 | 30 | $current_url = ''; |
| 31 | 31 | |
| 32 | 32 | $results_page = wmvc_show_data('conf_link', $settings); |
| 33 | + | |
| 33 | 34 | if(!is_array($results_page) && !empty($results_page)) { |
| 34 | 35 | //$results_page = get_permalink($results_page); |
| 35 | 36 | } else { |
| 36 | 37 | //$results_page = get_permalink(wdk_get_option('wdk_results_page')); |
| @@ -47,9 +48,9 @@ | ||
| 47 | 48 | if(function_exists('PLL')) |
| 48 | 49 | { |
| 49 | 50 | $results_page = pll_get_post($results_page); |
| 50 | 51 | } |
| 51 | - | |
| 52 | +$results_page_id = $results_page; | |
| 52 | 53 | $results_page = get_permalink($results_page); |
| 53 | 54 | |
| 54 | 55 | $form_opened = ''; |
| 55 | 56 | if(isset($_GET['wdk_search_additional_opened']) && wmvc_xss_clean($_GET['wdk_search_additional_opened']) == 1) { |
| @@ -61,18 +62,32 @@ | ||
| 61 | 62 | <div class="wdk-search layout_<?php echo esc_attr(wmvc_show_data('design_layout', $settings));?> |
| 62 | 63 | <?php if |
| 63 | 64 | ( |
| 64 | 65 | wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_ajax_results') && |
| 65 | - isset($settings['is_ajax_enable']) && $settings['is_ajax_enable'] == 'yes' | |
| 66 | + isset($settings['is_ajax_enable']) && $settings['is_ajax_enable'] == 'yes' | |
| 67 | + && $results_page_id == get_queried_object_id() | |
| 66 | 68 | ):?> |
| 67 | 69 | ajax_results_enabled |
| 68 | 70 | <?php endif;?> |
| 71 | + <?php if | |
| 72 | + ( | |
| 73 | + isset($settings['section_more_before_buttons']) && $settings['section_more_before_buttons'] == 'yes' | |
| 74 | + ):?> | |
| 75 | + section_more_before_buttons | |
| 76 | + <?php endif;?> | |
| 77 | + | |
| 78 | + <?php if | |
| 79 | + ( | |
| 80 | + isset($settings['ai_search_enable']) && $settings['ai_search_enable'] == 'yes' | |
| 81 | + ):?> | |
| 82 | + ai_search_enable | |
| 83 | + <?php endif;?> | |
| 84 | + | |
| 85 | + wdk-form-additional | |
| 69 | 86 | "> |
| 70 | 87 | <form data-current-link="<?php echo esc_url($current_url);?>" data-scrollto="<?php echo esc_attr(wmvc_show_data('search_scroll', $settings));?>" class="wdk-search-form wdk-skip-empty |
| 71 | 88 | <?php if(wmvc_show_data('auto_search_enable', $settings) == 'yes'):?> auto_search <?php endif;?> |
| 72 | 89 | <?php echo esc_html($form_opened);?> <?php if(!wdk_get_option('wdk_results_page')):?> wdk-result-page-notdefined <?php endif;?>" action="<?php echo esc_url($results_page);?>"> |
| 73 | - <input name="rectangle_ne" type="hidden" class="wdk-hidden" value="<?php echo isset($_GET['rectangle_ne']) ? esc_attr(sanitize_text_field($_GET['rectangle_ne'])) : '';?>"/> | |
| 74 | - <input name="rectangle_sw" type="hidden" class="wdk-hidden" value="<?php echo isset($_GET['rectangle_sw']) ? esc_attr(sanitize_text_field($_GET['rectangle_sw'])) : '';?>"/> | |
| 75 | 90 | <?php |
| 76 | 91 | $field_id = $tab_field ; |
| 77 | 92 | $field_values = wdk_field_option ($field_id, 'values_list'); |
| 78 | 93 | $values = array(); |
| @@ -80,9 +95,9 @@ | ||
| 80 | 95 | $values = explode(',', $field_values); |
| 81 | 96 | } |
| 82 | 97 | $field_value = false; |
| 83 | 98 | if(isset($_GET['field_'.$field_id])) { |
| 84 | - $field_value = sanitize_text_field($_GET['field_'.$field_id]); | |
| 99 | + $field_value = sanitize_text_field(wp_unslash($_GET['field_'.$field_id])); | |
| 85 | 100 | } |
| 86 | 101 | |
| 87 | 102 | ?> |
| 88 | 103 | <?php if(!empty( $values )):?> |
| @@ -92,10 +107,10 @@ | ||
| 92 | 107 | <?php echo esc_html__('Any', 'wpdirectorykit');?> |
| 93 | 108 | </label> |
| 94 | 109 | <?php foreach ($values as $key => $value):?> |
| 95 | 110 | <?php if(empty($value)) continue;?> |
| 96 | - <input type="radio" name="field_<?php echo esc_attr($field_id);?>" id="<?php echo esc_html($id_element);?>_wdk_tab_field_<?php echo esc_attr($key);?>" value="<?php echo esc_attr($value);?>" <?php if($field_value == $value):?>checked="checked"<?php endif;?>> | |
| 97 | - <label for="<?php echo esc_html($id_element);?>_wdk_tab_field_<?php echo esc_attr($key);?>"><?php echo esc_html($value);?> | |
| 111 | + <input type="radio" name="field_<?php echo esc_attr($field_id);?>" id="<?php echo esc_attr($id_element);?>_wdk_tab_field_<?php echo esc_attr($key);?>" value="<?php echo esc_attr($value);?>" <?php if($field_value == $value):?>checked="checked"<?php endif;?>> | |
| 112 | + <label for="<?php echo esc_attr($id_element);?>_wdk_tab_field_<?php echo esc_attr($key);?>"><?php echo esc_html($value);?> | |
| 98 | 113 | <?php if(wmvc_show_data('tabs_count', $settings) == 'yes'):?> |
| 99 | 114 | <span class="tab_count"><?php echo esc_html(wmvc_show_data($value, $this->data['counts'][$field_id], 0));?></span> |
| 100 | 115 | <?php endif;?> |
| 101 | 116 | </label> |
| @@ -109,9 +124,9 @@ | ||
| 109 | 124 | <?php endif;?> |
| 110 | 125 | |
| 111 | 126 | <?php if(wmvc_user_in_role('administrator') || current_user_can('wdk_listings_manage')):?> |
| 112 | 127 | <div class="section-widget-control"> |
| 113 | - <a class="wdk-c-btn wdk-c-edit" href="<?php echo esc_url(admin_url('admin.php?page=wdk_searchform'));?>" title="<?php echo esc_attr_e('Edit search form', 'selio'); ?>" target="_blank"><span class="dashicons dashicons-edit"></span></a> | |
| 128 | + <a class="wdk-c-btn wdk-c-edit" href="<?php echo esc_url(admin_url('admin.php?page=wdk_searchform'));?>" title="<?php echo esc_attr_e('Edit search form', 'wpdirectorykit'); ?>" target="_blank"><span class="dashicons dashicons-edit"></span></a> | |
| 114 | 129 | </div> |
| 115 | 130 | <?php endif;?> |
| 116 | 131 | <div class="wdk-row"> |
| 117 | 132 | <?php if(wmvc_show_data('enable_custom_fields', $settings) == 'yes'):?> |
| @@ -129,12 +144,12 @@ | ||
| 129 | 144 | <input type='checkbox' style="display: none !important" value='1' <?php if(isset($_GET['wdk_search_additional_opened']) && wmvc_xss_clean($_GET['wdk_search_additional_opened']) == 1):?> checked <?php endif;?> name='wdk_search_additional_opened' /> |
| 130 | 145 | </div> |
| 131 | 146 | <?php endif;?> |
| 132 | 147 | <div class="wdk-field-group wdk-field-group-reset"> |
| 133 | - <button id="wdk-start-primary" type="reset" class="wdk-search-start wdk-search-reset wdk-click-load-animation"> <?php echo esc_html(wmvc_show_data('text_reset_button', $settings)); ?> <i class="fa fa-spinner fa-spin fa-ajax-indicator" style="display: none;"></i> </button> | |
| 148 | + <button title="<?php echo esc_attr__('Reset','wpdirectorykit');?>" id="wdk-start-primary" type="reset" class="wdk-search-start wdk-search-reset wdk-click-load-animation"> <?php echo esc_html(wmvc_show_data('text_reset_button', $settings)); ?> <i class="fa fa-spinner fa-spin fa-ajax-indicator" style="display: none;"></i> </button> | |
| 134 | 149 | </div> |
| 135 | 150 | <div class="wdk-field-group wdk-field-group-search"> |
| 136 | - <button id="wdk-start-primary" type="submit" class="wdk-search-start wdk-click-load-animation"> | |
| 151 | + <button title="<?php echo esc_attr__('Search','wpdirectorykit');?>" id="wdk-start-primary" type="submit" class="wdk-search-start wdk-click-load-animation"> | |
| 137 | 152 | <?php if(wmvc_show_data('field_button_icon_position', $settings) == 'left') :?> |
| 138 | 153 | <?php \Elementor\Icons_Manager::render_icon( $settings['field_button_icon'], [ 'aria-hidden' => 'true', "class"=>'icon_search' ] ); ?> |
| 139 | 154 | <?php endif;?> |
| 140 | 155 | <?php echo esc_html(wmvc_show_data('text_search_button', $settings)); ?> |
| @@ -145,9 +160,9 @@ | ||
| 145 | 160 | </button> |
| 146 | 161 | |
| 147 | 162 | <?php if(function_exists('run_wdk_save_search') && wdk_get_option('wdk_save_search_show_on_searchform')):?> |
| 148 | 163 | <div class="section-widget-control right"> |
| 149 | - <a class="wdk-c-btn wdk-c-edit wdk-save-search-button" href="#" data-url="<?php echo esc_url(admin_url('admin-ajax.php')); ?>" title="<?php echo esc_attr_e('Save Search', 'selio'); ?>" target="_blank"> | |
| 164 | + <a class="wdk-c-btn wdk-c-edit wdk-save-search-button" href="#" data-url="<?php echo esc_url(admin_url('admin-ajax.php')); ?>" title="<?php echo esc_attr_e('Save Search', 'wpdirectorykit'); ?>" target="_blank"> | |
| 150 | 165 | <i class="fas fa-save" aria-hidden="true"></i> |
| 151 | 166 | <i class="fa fa-spinner fa-spin fa-ajax-indicator"></i> |
| 152 | 167 | </a> |
| 153 | 168 | </div> |
| @@ -161,15 +176,15 @@ | ||
| 161 | 176 | <?php endif; ?> |
| 162 | 177 | </div> |
| 163 | 178 | </form> |
| 164 | 179 | </div> |
| 165 | - <script> | |
| 180 | + <script> | |
| 166 | 181 | jQuery(document).ready(function($) { |
| 167 | - $('#wdk_el_<?php echo esc_html($id_element);?> #wdk-search-additional').on('click', function (e) { | |
| 182 | + jQuery('#wdk_el_<?php echo esc_html($id_element);?> #wdk-search-additional').on('click', function (e) { | |
| 168 | 183 | e.preventDefault(); |
| 169 | - if ($('#wdk_el_<?php echo esc_html($id_element);?> #wdk-form-additional').length) { | |
| 170 | - var addition = $('#wdk_el_<?php echo esc_html($id_element);?> #wdk-form-additional'); | |
| 171 | - var form = $(this).closest('.wdk-search-form '); | |
| 184 | + if (jQuery('#wdk_el_<?php echo esc_html($id_element);?> #wdk-form-additional').length) { | |
| 185 | + var addition = jQuery('#wdk_el_<?php echo esc_html($id_element);?> #wdk-form-additional'); | |
| 186 | + var form = jQuery(this).closest('.wdk-search-form '); | |
| 172 | 187 | form.toggleClass('open-form'); |
| 173 | 188 | if (form.hasClass('open-form')) { |
| 174 | 189 | form.find("[name='wdk_search_additional_opened']").prop('checked', 'checked'); |
| 175 | 190 | addition.slideDown(); |
| @@ -179,9 +194,9 @@ | ||
| 179 | 194 | } |
| 180 | 195 | } |
| 181 | 196 | }) |
| 182 | 197 | |
| 183 | - $("form.wdk-result-page-notdefined").on('submit', function() { | |
| 198 | + jQuery("form.wdk-result-page-notdefined").on('submit', function() { | |
| 184 | 199 | wdk_log_notify('<?php echo esc_js(__('Results page not found, please configure results page', 'wpdirectorykit')); ?>', 'error'); |
| 185 | 200 | return false; |
| 186 | 201 | }); |
| 187 | 202 | |
| @@ -237,18 +252,18 @@ | ||
| 237 | 252 | } |
| 238 | 253 | } |
| 239 | 254 | |
| 240 | 255 | // On change value, change field style |
| 241 | - $('#wdk_el_<?php echo esc_html($id_element);?>').find('input, select').each(function(i) | |
| 256 | + jQuery('#wdk_el_<?php echo esc_html($id_element);?>').find('input, select').each(function(i) | |
| 242 | 257 | { |
| 243 | - $(this).on('change', function(){search_highlight($(this))}); | |
| 244 | - search_highlight($(this)); | |
| 258 | + jQuery(this).on('change', function(){search_highlight(jQuery(this))}); | |
| 259 | + search_highlight(jQuery(this)); | |
| 245 | 260 | }) |
| 246 | 261 | <?php if($is_edit_mode):?> |
| 247 | 262 | wdk_select_init(); |
| 248 | 263 | |
| 249 | 264 | if(typeof $.fn.fieldSliderRange == 'function' && typeof $.fn.ionRangeSlider == 'function') { |
| 250 | - $('.wdk-slider-range-field').fieldSliderRange(); | |
| 265 | + jQuery('.wdk-slider-range-field').fieldSliderRange(); | |
| 251 | 266 | } |
| 252 | 267 | <?php endif;?> |
| 253 | 268 | }); |
| 254 | 269 | </script> |