PluginProbe
WP Directory Kit / 1.5.9
WP Directory Kit v1.5.9
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
← All changes | elementor-elements/views/wdk-search.php +48 -23 1.3.0 → 1.5.9 View file →
@@ -29,13 +29,16 @@
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 - $results_page = get_permalink($results_page);
35 + //$results_page = get_permalink($results_page);
35 36 } else {
36 - $results_page = get_permalink(wdk_get_option('wdk_results_page'));
37 + //$results_page = get_permalink(wdk_get_option('wdk_results_page'));
37 38
39 + $results_page = wdk_get_option('wdk_results_page');
40 +
38 41 if (!wdk_get_option('wdk_is_results_page_require')) {
39 42 $obj_id = get_queried_object_id();
40 43 $current_url = get_permalink( $obj_id );
41 44 }
@@ -40,8 +43,16 @@
40 43 $current_url = get_permalink( $obj_id );
41 44 }
42 45 }
43 46
47 +//get translation page
48 +if(function_exists('PLL'))
49 +{
50 + $results_page = pll_get_post($results_page);
51 +}
52 +$results_page_id = $results_page;
53 +$results_page = get_permalink($results_page);
54 +
44 55 $form_opened = '';
45 56 if(isset($_GET['wdk_search_additional_opened']) && wmvc_xss_clean($_GET['wdk_search_additional_opened']) == 1) {
46 57 $form_opened = 'open-form';
47 58 }
@@ -51,18 +62,32 @@
51 62 <div class="wdk-search layout_<?php echo esc_attr(wmvc_show_data('design_layout', $settings));?>
52 63 <?php if
53 64 (
54 65 wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_ajax_results') &&
55 - 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()
56 68 ):?>
57 69 ajax_results_enabled
58 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
59 86 ">
60 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
61 88 <?php if(wmvc_show_data('auto_search_enable', $settings) == 'yes'):?> auto_search <?php endif;?>
62 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);?>">
63 - <input name="rectangle_ne" type="hidden" class="wdk-hidden" value="<?php echo isset($_GET['rectangle_ne']) ? esc_attr(sanitize_text_field($_GET['rectangle_ne'])) : '';?>"/>
64 - <input name="rectangle_sw" type="hidden" class="wdk-hidden" value="<?php echo isset($_GET['rectangle_sw']) ? esc_attr(sanitize_text_field($_GET['rectangle_sw'])) : '';?>"/>
65 90 <?php
66 91 $field_id = $tab_field ;
67 92 $field_values = wdk_field_option ($field_id, 'values_list');
68 93 $values = array();
@@ -70,9 +95,9 @@
70 95 $values = explode(',', $field_values);
71 96 }
72 97 $field_value = false;
73 98 if(isset($_GET['field_'.$field_id])) {
74 - $field_value = sanitize_text_field($_GET['field_'.$field_id]);
99 + $field_value = sanitize_text_field(wp_unslash($_GET['field_'.$field_id]));
75 100 }
76 101
77 102 ?>
78 103 <?php if(!empty( $values )):?>
@@ -82,10 +107,10 @@
82 107 <?php echo esc_html__('Any', 'wpdirectorykit');?>
83 108 </label>
84 109 <?php foreach ($values as $key => $value):?>
85 110 <?php if(empty($value)) continue;?>
86 - <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;?>>
87 - <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);?>
88 113 <?php if(wmvc_show_data('tabs_count', $settings) == 'yes'):?>
89 114 <span class="tab_count"><?php echo esc_html(wmvc_show_data($value, $this->data['counts'][$field_id], 0));?></span>
90 115 <?php endif;?>
91 116 </label>
@@ -99,9 +124,9 @@
99 124 <?php endif;?>
100 125
101 126 <?php if(wmvc_user_in_role('administrator') || current_user_can('wdk_listings_manage')):?>
102 127 <div class="section-widget-control">
103 - <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>
104 129 </div>
105 130 <?php endif;?>
106 131 <div class="wdk-row">
107 132 <?php if(wmvc_show_data('enable_custom_fields', $settings) == 'yes'):?>
@@ -115,16 +140,16 @@
115 140 <div class="wdk-field wdk-field-btn">
116 141 <?php if(wmvc_show_data('enable_custom_fields', $settings) != 'yes'):?>
117 142 <div class="wdk-field-group wdk-field-group-additional">
118 143 <button id="wdk-search-additional" type="button" class="wdk-search-additional-btn"><?php echo esc_html($wdk_text_more_button); ?><i class="wdk-toggle-icon"></i></button>
119 - <input type='checkbox' style="display: none !important" value='1' name='wdk_search_additional_opened' />
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' />
120 145 </div>
121 146 <?php endif;?>
122 147 <div class="wdk-field-group wdk-field-group-reset">
123 - <button id="wdk-start-primary" type="reset" class="wdk-search-start wdk-search-reset wdk-click-load-animation">&nbsp;&nbsp;<?php echo esc_html(wmvc_show_data('text_reset_button', $settings)); ?>&nbsp;<i class="fa fa-spinner fa-spin fa-ajax-indicator" style="display: none;"></i>&nbsp;</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">&nbsp;&nbsp;<?php echo esc_html(wmvc_show_data('text_reset_button', $settings)); ?>&nbsp;<i class="fa fa-spinner fa-spin fa-ajax-indicator" style="display: none;"></i>&nbsp;</button>
124 149 </div>
125 150 <div class="wdk-field-group wdk-field-group-search">
126 - <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">
127 152 <?php if(wmvc_show_data('field_button_icon_position', $settings) == 'left') :?>
128 153 <?php \Elementor\Icons_Manager::render_icon( $settings['field_button_icon'], [ 'aria-hidden' => 'true', "class"=>'icon_search' ] ); ?>
129 154 <?php endif;?>
130 155 &nbsp;&nbsp;<?php echo esc_html(wmvc_show_data('text_search_button', $settings)); ?>
@@ -135,9 +160,9 @@
135 160 </button>
136 161
137 162 <?php if(function_exists('run_wdk_save_search') && wdk_get_option('wdk_save_search_show_on_searchform')):?>
138 163 <div class="section-widget-control right">
139 - <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">
140 165 <i class="fas fa-save" aria-hidden="true"></i>
141 166 <i class="fa fa-spinner fa-spin fa-ajax-indicator"></i>
142 167 </a>
143 168 </div>
@@ -151,15 +176,15 @@
151 176 <?php endif; ?>
152 177 </div>
153 178 </form>
154 179 </div>
155 - <script>
180 + <script>
156 181 jQuery(document).ready(function($) {
157 - $('#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) {
158 183 e.preventDefault();
159 - if ($('#wdk_el_<?php echo esc_html($id_element);?> #wdk-form-additional').length) {
160 - var addition = $('#wdk_el_<?php echo esc_html($id_element);?> #wdk-form-additional');
161 - 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 ');
162 187 form.toggleClass('open-form');
163 188 if (form.hasClass('open-form')) {
164 189 form.find("[name='wdk_search_additional_opened']").prop('checked', 'checked');
165 190 addition.slideDown();
@@ -169,9 +194,9 @@
169 194 }
170 195 }
171 196 })
172 197
173 - $("form.wdk-result-page-notdefined").on('submit', function() {
198 + jQuery("form.wdk-result-page-notdefined").on('submit', function() {
174 199 wdk_log_notify('<?php echo esc_js(__('Results page not found, please configure results page', 'wpdirectorykit')); ?>', 'error');
175 200 return false;
176 201 });
177 202
@@ -227,18 +252,18 @@
227 252 }
228 253 }
229 254
230 255 // On change value, change field style
231 - $('#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)
232 257 {
233 - $(this).on('change', function(){search_highlight($(this))});
234 - search_highlight($(this));
258 + jQuery(this).on('change', function(){search_highlight(jQuery(this))});
259 + search_highlight(jQuery(this));
235 260 })
236 261 <?php if($is_edit_mode):?>
237 262 wdk_select_init();
238 263
239 264 if(typeof $.fn.fieldSliderRange == 'function' && typeof $.fn.ionRangeSlider == 'function') {
240 - $('.wdk-slider-range-field').fieldSliderRange();
265 + jQuery('.wdk-slider-range-field').fieldSliderRange();
241 266 }
242 267 <?php endif;?>
243 268 });
244 269 </script>