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
wpdirectorykit / application / views / search_fields / NUMBER.php

NUMBER.php in WP Directory Kit 1.5.9, at application/views/search_fields/NUMBER.php

174 lines 8.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The template for Search field NUMBER.
4 *
5 * This is the template that field layout for search form
6 *
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly.
11 }
12 ?>
13 <?php
14
15 $field_key = 'field_'.wmvc_show_data('idfield',$field_data);
16 $field_attr_id = 'wdk_field_'.wmvc_show_data('idfield', $field_data);
17
18 $placeholder = wmvc_show_data('field_label', $field_data);
19 if(!empty(wmvc_show_data('placeholder', $field_data,'')))
20 $placeholder = wmvc_show_data('placeholder', $field_data);
21 // Dynamic field values are registered in the translation catalog separately.
22 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
23 $placeholder = esc_html__($placeholder,'wpdirectorykit');
24 $field_value = '';
25 $query_type = wmvc_show_data('query_type', $field_data, '');
26
27 if(!empty($query_type) && $query_type !='min_max')
28 $field_key .='_'.$query_type;
29
30
31 if(isset($predefinedfields_query) && !empty($predefinedfields_query[$field_key])) {
32 $field_value = sanitize_text_field($predefinedfields_query[$field_key]);
33 }
34
35 if(isset($_GET[$field_key])) {
36 $field_value = sanitize_text_field(wp_unslash($_GET[$field_key]));
37 }
38
39 $suffix = '';
40 $prefix = '';
41 $clear_prefix = $prefix = apply_filters( 'wpdirectorykit/listing/field/prefix', wmvc_show_data('prefix',$field_data), wmvc_show_data('idfield', $field_data));
42 $clear_suffix = $suffix = apply_filters( 'wpdirectorykit/listing/field/suffix',wmvc_show_data('suffix',$field_data), wmvc_show_data('idfield', $field_data));
43
44 if(!empty($prefix)) {
45 $prefix = ' ('.$prefix.')';
46 }
47
48 if(!empty($suffix)) {
49 $suffix = ' ('.$suffix.')';
50 }
51
52 if($query_type =='min')
53 $placeholder = esc_html__('Min','wpdirectorykit').' '.$placeholder.$prefix.$suffix;
54 if($query_type =='max')
55 $placeholder = esc_html__('Max','wpdirectorykit').' '.$placeholder.$prefix.$suffix;
56
57 $values = array();
58 if(!empty(wmvc_show_data('values_list', $field_data)) && strpos(wmvc_show_data('values_list', $field_data), ',') !== FALSE){
59 $values = explode(',', wmvc_show_data('values_list', $field_data));
60 $values = array_combine($values, $values);
61
62 array_walk($values, function(&$item) use($clear_prefix, $clear_suffix, $field_data) {
63 $item = $clear_prefix.((wdk_field_option(wmvc_show_data('idfield',$field_data), 'is_price_format') && wdk_field_option(wmvc_show_data('idfield',$field_data), 'field_type') == 'NUMBER') ? wdk_number_format_i18n($item) : $item).$clear_suffix;
64 }
65 );
66 }
67 wdk_search_fields_toggle();
68 ?>
69
70 <div class="wdk-field wdk-col wdk_search_<?php echo esc_attr($field_key);?> <?php if($query_type == 'min_max'):?>min_max_wdk-field<?php endif;?>
71 <?php if(empty($values)):?>
72 <?php echo esc_attr(wmvc_show_data('field_type', $field_data)); ?>
73 <?php else:?>
74 psudo_<?php echo esc_attr(wmvc_show_data('field_type', $field_data)); ?>
75 DROPDOWN
76 <?php endif;?>
77 <?php echo esc_attr(wmvc_show_data('class', $field_data)); ?>
78 wdk_field_id_<?php echo esc_attr(wmvc_show_data('idfield',$field_data));?>"
79 >
80 <label class="wdk-field-label"><?php
81 // Dynamic field values are registered in the translation catalog separately.
82 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
83 echo esc_html__(wmvc_show_data('field_label', $field_data),'wpdirectorykit'); ?></label>
84 <div class="wdk-field-group">
85 <?php if(empty($values)):?>
86 <?php if($query_type == 'min_max'):?>
87 <div class="wdk-row min_max_row">
88 <div class="wdk-col wdk-col-6">
89 <input class="wdk-control" name="<?php echo esc_attr($field_key.'_min'); ?>" type="number" id="<?php echo esc_attr($field_attr_id.'_min'); ?>" value="<?php echo (isset($_GET[$field_key.'_min'])) ? esc_attr(wmvc_xss_clean($_GET[$field_key.'_min'])) : ''; ?>" placeholder="<?php echo esc_attr__('Min','wpdirectorykit').' '.esc_attr(trim($placeholder)).' '.esc_attr($prefix.$suffix);?>">
90 </div>
91 <div class="wdk-col wdk-col-6">
92 <input class="wdk-control" name="<?php echo esc_attr($field_key.'_max'); ?>" type="number" id="<?php echo esc_attr($field_attr_id.'_max'); ?>" value="<?php echo (isset($_GET[$field_key.'_max'])) ? esc_attr(wmvc_xss_clean($_GET[$field_key.'_max'])) : ''; ?>" placeholder="<?php echo esc_attr__('Max','wpdirectorykit').' '.esc_attr(trim($placeholder)).' '.esc_attr($prefix.$suffix);?>">
93 </div>
94 </div>
95 <?php else:?>
96 <input class="wdk-control" name="<?php echo esc_attr($field_key); ?>" type="number" id="<?php echo esc_attr($field_attr_id); ?>" value="<?php echo esc_attr($field_value); ?>" placeholder="<?php echo esc_attr(trim($placeholder));?>">
97 <?php endif;?>
98 <?php else:?>
99 <?php if($query_type == 'min_max'):?>
100 <div class="wdk-row min_max_row">
101 <div class="wdk-col wdk-col-6">
102 <?php echo wp_kses(
103 wmvc_select_option(
104 $field_key.'_min',
105 (array(''=> __('Min', 'wpdirectorykit').' '.$placeholder.$prefix.$suffix) + $values),
106 (isset($_GET[$field_key.'_min'])) ? esc_attr($_GET[$field_key.'_min']) : '',
107 'class="wdk-control"'
108 ),
109 [
110 'select' => [
111 'class' => true,
112 'name' => true,
113 'id' => true,
114 ],
115 'option' => [
116 'value' => true,
117 'selected' => true,
118 ],
119 ]
120 ); ?>
121
122 </div>
123 <div class="wdk-col wdk-col-6">
124 <?php
125 echo wp_kses(
126 wmvc_select_option(
127 $field_key.'_max',
128 (array(''=> __('Max', 'wpdirectorykit').' '.$placeholder.$prefix.$suffix) + $values),
129 (isset($_GET[$field_key.'_max'])) ? esc_attr($_GET[$field_key.'_max']) : '',
130 'class="wdk-control"'
131 ),
132 [
133 'select' => [
134 'class' => true,
135 'name' => true,
136 'id' => true,
137 ],
138 'option' => [
139 'value' => true,
140 'selected' => true,
141 ],
142 ]
143 );
144 ?>
145
146 </div>
147 </div>
148 <?php else:?>
149 <?php
150 echo wp_kses(
151 wmvc_select_option(
152 $field_key,
153 (array(''=> $placeholder) + $values),
154 $field_value,
155 'class="wdk-control"'
156 ),
157 [
158 'select' => [
159 'class' => true,
160 'name' => true,
161 'id' => true,
162 ],
163 'option' => [
164 'value' => true,
165 'selected' => true,
166 ],
167 ]
168 );
169 ?>
170
171 <?php endif;?>
172 <?php endif;?>
173 </div>
174 </div>