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 +108 -40 1.2.5 → 1.5.9 View file →
@@ -20,8 +20,11 @@
20 20
21 21 global $wdk_text_search_button;
22 22 $wdk_text_search_button = esc_html(wmvc_show_data('text_search_button', $settings));
23 23
24 +global $wdk_text_reset_button;
25 +$wdk_text_reset_button = esc_html(wmvc_show_data('text_reset_button', $settings));
26 +
24 27 global $wdk_text_more_button;
25 28 $wdk_text_more_button = esc_html(wmvc_show_data('text_more_button', $settings));
26 29
27 30 $current_url = '';
@@ -26,13 +29,16 @@
26 29
27 30 $current_url = '';
28 31
29 32 $results_page = wmvc_show_data('conf_link', $settings);
33 +
30 34 if(!is_array($results_page) && !empty($results_page)) {
31 - $results_page = get_permalink($results_page);
35 + //$results_page = get_permalink($results_page);
32 36 } else {
33 - $results_page = get_permalink(wdk_get_option('wdk_results_page'));
37 + //$results_page = get_permalink(wdk_get_option('wdk_results_page'));
34 38
39 + $results_page = wdk_get_option('wdk_results_page');
40 +
35 41 if (!wdk_get_option('wdk_is_results_page_require')) {
36 42 $obj_id = get_queried_object_id();
37 43 $current_url = get_permalink( $obj_id );
38 44 }
@@ -37,19 +43,51 @@
37 43 $current_url = get_permalink( $obj_id );
38 44 }
39 45 }
40 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 +
41 55 $form_opened = '';
42 56 if(isset($_GET['wdk_search_additional_opened']) && wmvc_xss_clean($_GET['wdk_search_additional_opened']) == 1) {
43 57 $form_opened = 'open-form';
44 58 }
45 -
46 59 ?>
47 60
48 61 <div class="wdk-element" id="wdk_el_<?php echo esc_html($id_element);?>">
49 - <div class="wdk-search layout_<?php echo esc_attr(wmvc_show_data('design_layout', $settings));?>">
50 - <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 <?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);?>">
51 -
62 + <div class="wdk-search layout_<?php echo esc_attr(wmvc_show_data('design_layout', $settings));?>
63 + <?php if
64 + (
65 + wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_ajax_results') &&
66 + isset($settings['is_ajax_enable']) && $settings['is_ajax_enable'] == 'yes'
67 + && $results_page_id == get_queried_object_id()
68 + ):?>
69 + ajax_results_enabled
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
86 + ">
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
88 + <?php if(wmvc_show_data('auto_search_enable', $settings) == 'yes'):?> auto_search <?php endif;?>
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);?>">
52 90 <?php
53 91 $field_id = $tab_field ;
54 92 $field_values = wdk_field_option ($field_id, 'values_list');
55 93 $values = array();
@@ -57,9 +95,9 @@
57 95 $values = explode(',', $field_values);
58 96 }
59 97 $field_value = false;
60 98 if(isset($_GET['field_'.$field_id])) {
61 - $field_value = sanitize_text_field($_GET['field_'.$field_id]);
99 + $field_value = sanitize_text_field(wp_unslash($_GET['field_'.$field_id]));
62 100 }
63 101
64 102 ?>
65 103 <?php if(!empty( $values )):?>
@@ -64,13 +102,19 @@
64 102 ?>
65 103 <?php if(!empty( $values )):?>
66 104 <div class="wdk-search-tabs">
67 105 <input type="radio" name="field_<?php echo esc_attr($field_id);?>" id="wdk_tab_field_any" value="" <?php if(empty($field_value)):?>checked="checked"<?php endif;?>>
68 - <label for="wdk_tab_field_any"><?php echo esc_html__('Any', 'wpdirectorykit');?></label>
106 + <label for="wdk_tab_field_any">
107 + <?php echo esc_html__('Any', 'wpdirectorykit');?>
108 + </label>
69 109 <?php foreach ($values as $key => $value):?>
70 110 <?php if(empty($value)) continue;?>
71 - <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;?>>
72 - <label for="<?php echo esc_html($id_element);?>_wdk_tab_field_<?php echo esc_attr($key);?>"><?php echo esc_html($value);?></label>
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);?>
113 + <?php if(wmvc_show_data('tabs_count', $settings) == 'yes'):?>
114 + <span class="tab_count"><?php echo esc_html(wmvc_show_data($value, $this->data['counts'][$field_id], 0));?></span>
115 + <?php endif;?>
116 + </label>
73 117 <?php endforeach;?>
74 118 </div>
75 119 <script>
76 120 jQuery(document).ready(function(){
@@ -78,45 +122,69 @@
78 122 });
79 123 </script>
80 124 <?php endif;?>
81 125
82 - <?php if(wmvc_user_in_role('administrator')):?>
126 + <?php if(wmvc_user_in_role('administrator') || current_user_can('wdk_listings_manage')):?>
83 127 <div class="section-widget-control">
84 - <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>
85 129 </div>
86 130 <?php endif;?>
87 131 <div class="wdk-row">
88 - <?php wdk_generate_search_form(1, '', TRUE, $predefields_query); ?>
89 - <?php if(!$wdk_button_search_defined): ?>
90 - <div class="wdk-col wdk-col-btns">
91 - <div class="wdk-field wdk-field-btn">
92 - <div class="wdk-field-group">
93 - <button id="wdk-start-primary" type="submit" class="wdk-search-start wdk-click-load-animation">&nbsp;&nbsp;<?php echo esc_html(wmvc_show_data('text_search_button', $settings)); ?>&nbsp;<i class="fa fa-spinner fa-spin fa-ajax-indicator" style="display: none;"></i>&nbsp;</button>
94 - <?php if(function_exists('run_wdk_save_search') && wdk_get_option('wdk_save_search_show_on_searchform')):?>
95 - <div class="section-widget-control right">
96 - <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">
97 - <i class="fas fa-save" aria-hidden="true"></i>
98 - <i class="fa fa-spinner fa-spin fa-ajax-indicator"></i>
99 - </a>
132 + <?php if(wmvc_show_data('enable_custom_fields', $settings) == 'yes'):?>
133 + <?php wdk_generate_search_form_fields_elementor(wmvc_show_data('custom_fields', $settings), '', TRUE, $predefields_query); ?>
134 + <?php else:?>
135 + <?php wdk_generate_search_form(1, '', TRUE, $predefields_query); ?>
136 + <?php endif;?>
137 +
138 + <?php if(!$wdk_button_search_defined): ?>
139 + <div class="wdk-col wdk-col-btns">
140 + <div class="wdk-field wdk-field-btn">
141 + <?php if(wmvc_show_data('enable_custom_fields', $settings) != 'yes'):?>
142 + <div class="wdk-field-group wdk-field-group-additional">
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>
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' />
145 + </div>
146 + <?php endif;?>
147 + <div class="wdk-field-group wdk-field-group-reset">
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>
100 149 </div>
101 - <?php endif;?>
150 + <div class="wdk-field-group wdk-field-group-search">
151 + <button title="<?php echo esc_attr__('Search','wpdirectorykit');?>" id="wdk-start-primary" type="submit" class="wdk-search-start wdk-click-load-animation">
152 + <?php if(wmvc_show_data('field_button_icon_position', $settings) == 'left') :?>
153 + <?php \Elementor\Icons_Manager::render_icon( $settings['field_button_icon'], [ 'aria-hidden' => 'true', "class"=>'icon_search' ] ); ?>
154 + <?php endif;?>
155 + &nbsp;&nbsp;<?php echo esc_html(wmvc_show_data('text_search_button', $settings)); ?>
156 + <?php if(wmvc_show_data('field_button_icon_position', $settings) == 'right') :?>
157 + <?php \Elementor\Icons_Manager::render_icon( $settings['field_button_icon'], [ 'aria-hidden' => 'true', "class"=>'icon_search' ] ); ?>
158 + <?php endif;?>
159 + &nbsp;<i class="fa fa-spinner fa-spin fa-ajax-indicator" style="display: none;"></i>&nbsp;
160 + </button>
161 +
162 + <?php if(function_exists('run_wdk_save_search') && wdk_get_option('wdk_save_search_show_on_searchform')):?>
163 + <div class="section-widget-control right">
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">
165 + <i class="fas fa-save" aria-hidden="true"></i>
166 + <i class="fa fa-spinner fa-spin fa-ajax-indicator"></i>
167 + </a>
168 + </div>
169 + <?php endif;?>
170 + </div>
102 171 </div>
103 172 </div>
173 + <?php else: ?>
104 174 </div>
105 - <?php else: ?>
106 175 </div>
107 - </div>
108 - <?php endif; ?>
176 + <?php endif; ?>
109 177 </div>
110 178 </form>
111 179 </div>
112 - <script>
180 + <script>
113 181 jQuery(document).ready(function($) {
114 - $('#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) {
115 183 e.preventDefault();
116 - if ($('#wdk_el_<?php echo esc_html($id_element);?> #wdk-form-additional').length) {
117 - var addition = $('#wdk_el_<?php echo esc_html($id_element);?> #wdk-form-additional');
118 - 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 ');
119 187 form.toggleClass('open-form');
120 188 if (form.hasClass('open-form')) {
121 189 form.find("[name='wdk_search_additional_opened']").prop('checked', 'checked');
122 190 addition.slideDown();
@@ -126,9 +194,9 @@
126 194 }
127 195 }
128 196 })
129 197
130 - $("form.wdk-result-page-notdefined").on('submit', function() {
198 + jQuery("form.wdk-result-page-notdefined").on('submit', function() {
131 199 wdk_log_notify('<?php echo esc_js(__('Results page not found, please configure results page', 'wpdirectorykit')); ?>', 'error');
132 200 return false;
133 201 });
134 202
@@ -154,9 +222,9 @@
154 222 else if(elem.attr('type') == 'text')
155 223 {
156 224 if(elem.parent().find('.wdk_dropdown_tree').length > 0) // For treefield
157 225 {
158 - if(elem.val() != '' && elem.val() != 0 && elem.val() != null)
226 + if(elem.val() != '' && elem.val() != null)
159 227 {
160 228 // add selector class
161 229 elem.closest('.wdk_dropdown_tree_style').find('.wdk_dropdown_tree').addClass('sel_class');
162 230 elem.parent().find('.btn-group:first-child').addClass('sel_class');
@@ -169,9 +237,9 @@
169 237 }
170 238 }
171 239 else // For basic input
172 240 {
173 - if(elem.val() != '' && elem.val() != 0 && elem.val() != null)
241 + if(elem.val() != '' && elem.val() != null)
174 242 {
175 243 // add selector class
176 244 elem.addClass('sel_class');
177 245 }
@@ -184,18 +252,18 @@
184 252 }
185 253 }
186 254
187 255 // On change value, change field style
188 - $('#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)
189 257 {
190 - $(this).on('change', function(){search_highlight($(this))});
191 - search_highlight($(this));
258 + jQuery(this).on('change', function(){search_highlight(jQuery(this))});
259 + search_highlight(jQuery(this));
192 260 })
193 261 <?php if($is_edit_mode):?>
194 262 wdk_select_init();
195 263
196 264 if(typeof $.fn.fieldSliderRange == 'function' && typeof $.fn.ionRangeSlider == 'function') {
197 - $('.wdk-slider-range-field').fieldSliderRange();
265 + jQuery('.wdk-slider-range-field').fieldSliderRange();
198 266 }
199 267 <?php endif;?>
200 268 });
201 269 </script>