@@ -19,35 +19,35 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function geodir_cfi_fieldset($html,$cf){ |
21 | 21 | |
22 | - $html_var = $cf['htmlvar_name']; |
|
23 | - |
|
24 | - // Check if there is a custom field specific filter. |
|
25 | - if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){ |
|
26 | - /** |
|
27 | - * Filter the fieldset html by individual custom field. |
|
28 | - * |
|
29 | - * @param string $html The html to filter. |
|
30 | - * @param array $cf The custom field array. |
|
31 | - * @since 1.6.6 |
|
32 | - */ |
|
33 | - $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf); |
|
34 | - } |
|
35 | - |
|
36 | - // If no html then we run the standard output. |
|
37 | - if(empty($html)) { |
|
38 | - |
|
39 | - ob_start(); // Start buffering; |
|
40 | - ?> |
|
22 | + $html_var = $cf['htmlvar_name']; |
|
23 | + |
|
24 | + // Check if there is a custom field specific filter. |
|
25 | + if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){ |
|
26 | + /** |
|
27 | + * Filter the fieldset html by individual custom field. |
|
28 | + * |
|
29 | + * @param string $html The html to filter. |
|
30 | + * @param array $cf The custom field array. |
|
31 | + * @since 1.6.6 |
|
32 | + */ |
|
33 | + $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf); |
|
34 | + } |
|
35 | + |
|
36 | + // If no html then we run the standard output. |
|
37 | + if(empty($html)) { |
|
38 | + |
|
39 | + ob_start(); // Start buffering; |
|
40 | + ?> |
|
41 | 41 | <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row" |
42 | 42 | gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo __( $cf['site_title'], 'geodirectory' ); ?> |
43 | 43 | <?php if ( $cf['desc'] != '' ) { |
44 | - echo '<small>( ' . __( $cf['desc'], 'geodirectory' ) . ' )</small>'; |
|
45 | - } ?></h5> |
|
44 | + echo '<small>( ' . __( $cf['desc'], 'geodirectory' ) . ' )</small>'; |
|
45 | + } ?></h5> |
|
46 | 46 | <?php |
47 | - $html = ob_get_clean(); |
|
48 | - } |
|
47 | + $html = ob_get_clean(); |
|
48 | + } |
|
49 | 49 | |
50 | - return $html; |
|
50 | + return $html; |
|
51 | 51 | } |
52 | 52 | add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2); |
53 | 53 | |
@@ -64,47 +64,47 @@ discard block |
||
64 | 64 | */ |
65 | 65 | function geodir_cfi_text($html,$cf){ |
66 | 66 | |
67 | - $html_var = $cf['htmlvar_name']; |
|
68 | - |
|
69 | - // Check if there is a custom field specific filter. |
|
70 | - if(has_filter("geodir_custom_field_input_text_{$html_var}")){ |
|
71 | - /** |
|
72 | - * Filter the text html by individual custom field. |
|
73 | - * |
|
74 | - * @param string $html The html to filter. |
|
75 | - * @param array $cf The custom field array. |
|
76 | - * @since 1.6.6 |
|
77 | - */ |
|
78 | - $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf); |
|
79 | - } |
|
80 | - |
|
81 | - // If no html then we run the standard output. |
|
82 | - if(empty($html)) { |
|
83 | - |
|
84 | - ob_start(); // Start buffering; |
|
85 | - |
|
86 | - $value = geodir_get_cf_value($cf); |
|
87 | - $type = $cf['type']; |
|
88 | - //number and float validation $validation_pattern |
|
89 | - if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} |
|
90 | - elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';} |
|
91 | - |
|
92 | - //validation |
|
93 | - if(isset($cf['validation_pattern']) && $cf['validation_pattern']){ |
|
94 | - $validation = 'pattern="'.$cf['validation_pattern'].'"'; |
|
95 | - }else{$validation='';} |
|
96 | - |
|
97 | - // validation message |
|
98 | - if(isset($cf['validation_msg']) && $cf['validation_msg']){ |
|
99 | - $validation_msg = 'title="'.$cf['validation_msg'].'"'; |
|
100 | - }else{$validation_msg='';} |
|
101 | - ?> |
|
67 | + $html_var = $cf['htmlvar_name']; |
|
68 | + |
|
69 | + // Check if there is a custom field specific filter. |
|
70 | + if(has_filter("geodir_custom_field_input_text_{$html_var}")){ |
|
71 | + /** |
|
72 | + * Filter the text html by individual custom field. |
|
73 | + * |
|
74 | + * @param string $html The html to filter. |
|
75 | + * @param array $cf The custom field array. |
|
76 | + * @since 1.6.6 |
|
77 | + */ |
|
78 | + $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf); |
|
79 | + } |
|
80 | + |
|
81 | + // If no html then we run the standard output. |
|
82 | + if(empty($html)) { |
|
83 | + |
|
84 | + ob_start(); // Start buffering; |
|
85 | + |
|
86 | + $value = geodir_get_cf_value($cf); |
|
87 | + $type = $cf['type']; |
|
88 | + //number and float validation $validation_pattern |
|
89 | + if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} |
|
90 | + elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';} |
|
91 | + |
|
92 | + //validation |
|
93 | + if(isset($cf['validation_pattern']) && $cf['validation_pattern']){ |
|
94 | + $validation = 'pattern="'.$cf['validation_pattern'].'"'; |
|
95 | + }else{$validation='';} |
|
96 | + |
|
97 | + // validation message |
|
98 | + if(isset($cf['validation_msg']) && $cf['validation_msg']){ |
|
99 | + $validation_msg = 'title="'.$cf['validation_msg'].'"'; |
|
100 | + }else{$validation_msg='';} |
|
101 | + ?> |
|
102 | 102 | |
103 | 103 | <div id="<?php echo $cf['name'];?>_row" |
104 | 104 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
105 | 105 | <label> |
106 | 106 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
107 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
107 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
108 | 108 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
109 | 109 | </label> |
110 | 110 | <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | </div> |
117 | 117 | |
118 | 118 | <?php |
119 | - $html = ob_get_clean(); |
|
120 | - } |
|
119 | + $html = ob_get_clean(); |
|
120 | + } |
|
121 | 121 | |
122 | - return $html; |
|
122 | + return $html; |
|
123 | 123 | } |
124 | 124 | add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2); |
125 | 125 | |
@@ -135,35 +135,35 @@ discard block |
||
135 | 135 | */ |
136 | 136 | function geodir_cfi_email($html,$cf){ |
137 | 137 | |
138 | - $html_var = $cf['htmlvar_name']; |
|
138 | + $html_var = $cf['htmlvar_name']; |
|
139 | 139 | |
140 | - // Check if there is a custom field specific filter. |
|
141 | - if(has_filter("geodir_custom_field_input_email_{$html_var}")){ |
|
142 | - /** |
|
143 | - * Filter the email html by individual custom field. |
|
144 | - * |
|
145 | - * @param string $html The html to filter. |
|
146 | - * @param array $cf The custom field array. |
|
147 | - * @since 1.6.6 |
|
148 | - */ |
|
149 | - $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf); |
|
150 | - } |
|
140 | + // Check if there is a custom field specific filter. |
|
141 | + if(has_filter("geodir_custom_field_input_email_{$html_var}")){ |
|
142 | + /** |
|
143 | + * Filter the email html by individual custom field. |
|
144 | + * |
|
145 | + * @param string $html The html to filter. |
|
146 | + * @param array $cf The custom field array. |
|
147 | + * @since 1.6.6 |
|
148 | + */ |
|
149 | + $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf); |
|
150 | + } |
|
151 | 151 | |
152 | - // If no html then we run the standard output. |
|
153 | - if(empty($html)) { |
|
152 | + // If no html then we run the standard output. |
|
153 | + if(empty($html)) { |
|
154 | 154 | |
155 | - ob_start(); // Start buffering; |
|
156 | - $value = geodir_get_cf_value($cf); |
|
155 | + ob_start(); // Start buffering; |
|
156 | + $value = geodir_get_cf_value($cf); |
|
157 | 157 | |
158 | - if ($value == $cf['default']) { |
|
159 | - $value = ''; |
|
160 | - }?> |
|
158 | + if ($value == $cf['default']) { |
|
159 | + $value = ''; |
|
160 | + }?> |
|
161 | 161 | |
162 | 162 | <div id="<?php echo $cf['name'];?>_row" |
163 | 163 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
164 | 164 | <label> |
165 | 165 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
166 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
166 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
167 | 167 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
168 | 168 | </label> |
169 | 169 | <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | </div> |
176 | 176 | |
177 | 177 | <?php |
178 | - $html = ob_get_clean(); |
|
179 | - } |
|
178 | + $html = ob_get_clean(); |
|
179 | + } |
|
180 | 180 | |
181 | - return $html; |
|
181 | + return $html; |
|
182 | 182 | } |
183 | 183 | add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2); |
184 | 184 | |
@@ -195,35 +195,35 @@ discard block |
||
195 | 195 | */ |
196 | 196 | function geodir_cfi_phone($html,$cf){ |
197 | 197 | |
198 | - $html_var = $cf['htmlvar_name']; |
|
198 | + $html_var = $cf['htmlvar_name']; |
|
199 | 199 | |
200 | - // Check if there is a custom field specific filter. |
|
201 | - if(has_filter("geodir_custom_field_input_phone_{$html_var}")){ |
|
202 | - /** |
|
203 | - * Filter the phone html by individual custom field. |
|
204 | - * |
|
205 | - * @param string $html The html to filter. |
|
206 | - * @param array $cf The custom field array. |
|
207 | - * @since 1.6.6 |
|
208 | - */ |
|
209 | - $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf); |
|
210 | - } |
|
200 | + // Check if there is a custom field specific filter. |
|
201 | + if(has_filter("geodir_custom_field_input_phone_{$html_var}")){ |
|
202 | + /** |
|
203 | + * Filter the phone html by individual custom field. |
|
204 | + * |
|
205 | + * @param string $html The html to filter. |
|
206 | + * @param array $cf The custom field array. |
|
207 | + * @since 1.6.6 |
|
208 | + */ |
|
209 | + $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf); |
|
210 | + } |
|
211 | 211 | |
212 | - // If no html then we run the standard output. |
|
213 | - if(empty($html)) { |
|
212 | + // If no html then we run the standard output. |
|
213 | + if(empty($html)) { |
|
214 | 214 | |
215 | - ob_start(); // Start buffering; |
|
216 | - $value = geodir_get_cf_value($cf); |
|
215 | + ob_start(); // Start buffering; |
|
216 | + $value = geodir_get_cf_value($cf); |
|
217 | 217 | |
218 | - if ($value == $cf['default']) { |
|
219 | - $value = ''; |
|
220 | - }?> |
|
218 | + if ($value == $cf['default']) { |
|
219 | + $value = ''; |
|
220 | + }?> |
|
221 | 221 | |
222 | 222 | <div id="<?php echo $cf['name'];?>_row" |
223 | 223 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
224 | 224 | <label> |
225 | 225 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
226 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
226 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
227 | 227 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
228 | 228 | </label> |
229 | 229 | <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | </div> |
236 | 236 | |
237 | 237 | <?php |
238 | - $html = ob_get_clean(); |
|
239 | - } |
|
238 | + $html = ob_get_clean(); |
|
239 | + } |
|
240 | 240 | |
241 | - return $html; |
|
241 | + return $html; |
|
242 | 242 | } |
243 | 243 | add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2); |
244 | 244 | |
@@ -255,35 +255,35 @@ discard block |
||
255 | 255 | */ |
256 | 256 | function geodir_cfi_url($html,$cf){ |
257 | 257 | |
258 | - $html_var = $cf['htmlvar_name']; |
|
258 | + $html_var = $cf['htmlvar_name']; |
|
259 | 259 | |
260 | - // Check if there is a custom field specific filter. |
|
261 | - if(has_filter("geodir_custom_field_input_url_{$html_var}")){ |
|
262 | - /** |
|
263 | - * Filter the url html by individual custom field. |
|
264 | - * |
|
265 | - * @param string $html The html to filter. |
|
266 | - * @param array $cf The custom field array. |
|
267 | - * @since 1.6.6 |
|
268 | - */ |
|
269 | - $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf); |
|
270 | - } |
|
260 | + // Check if there is a custom field specific filter. |
|
261 | + if(has_filter("geodir_custom_field_input_url_{$html_var}")){ |
|
262 | + /** |
|
263 | + * Filter the url html by individual custom field. |
|
264 | + * |
|
265 | + * @param string $html The html to filter. |
|
266 | + * @param array $cf The custom field array. |
|
267 | + * @since 1.6.6 |
|
268 | + */ |
|
269 | + $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf); |
|
270 | + } |
|
271 | 271 | |
272 | - // If no html then we run the standard output. |
|
273 | - if(empty($html)) { |
|
272 | + // If no html then we run the standard output. |
|
273 | + if(empty($html)) { |
|
274 | 274 | |
275 | - ob_start(); // Start buffering; |
|
276 | - $value = geodir_get_cf_value($cf); |
|
275 | + ob_start(); // Start buffering; |
|
276 | + $value = geodir_get_cf_value($cf); |
|
277 | 277 | |
278 | - if ($value == $cf['default']) { |
|
279 | - $value = ''; |
|
280 | - }?> |
|
278 | + if ($value == $cf['default']) { |
|
279 | + $value = ''; |
|
280 | + }?> |
|
281 | 281 | |
282 | 282 | <div id="<?php echo $cf['name'];?>_row" |
283 | 283 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
284 | 284 | <label> |
285 | 285 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
286 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
286 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
287 | 287 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
288 | 288 | </label> |
289 | 289 | <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | </div> |
299 | 299 | |
300 | 300 | <?php |
301 | - $html = ob_get_clean(); |
|
302 | - } |
|
301 | + $html = ob_get_clean(); |
|
302 | + } |
|
303 | 303 | |
304 | - return $html; |
|
304 | + return $html; |
|
305 | 305 | } |
306 | 306 | add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2); |
307 | 307 | |
@@ -317,48 +317,48 @@ discard block |
||
317 | 317 | */ |
318 | 318 | function geodir_cfi_radio($html,$cf){ |
319 | 319 | |
320 | - $html_var = $cf['htmlvar_name']; |
|
320 | + $html_var = $cf['htmlvar_name']; |
|
321 | 321 | |
322 | - // Check if there is a custom field specific filter. |
|
323 | - if(has_filter("geodir_custom_field_input_radio_{$html_var}")){ |
|
324 | - /** |
|
325 | - * Filter the radio html by individual custom field. |
|
326 | - * |
|
327 | - * @param string $html The html to filter. |
|
328 | - * @param array $cf The custom field array. |
|
329 | - * @since 1.6.6 |
|
330 | - */ |
|
331 | - $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf); |
|
332 | - } |
|
322 | + // Check if there is a custom field specific filter. |
|
323 | + if(has_filter("geodir_custom_field_input_radio_{$html_var}")){ |
|
324 | + /** |
|
325 | + * Filter the radio html by individual custom field. |
|
326 | + * |
|
327 | + * @param string $html The html to filter. |
|
328 | + * @param array $cf The custom field array. |
|
329 | + * @since 1.6.6 |
|
330 | + */ |
|
331 | + $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf); |
|
332 | + } |
|
333 | 333 | |
334 | - // If no html then we run the standard output. |
|
335 | - if(empty($html)) { |
|
334 | + // If no html then we run the standard output. |
|
335 | + if(empty($html)) { |
|
336 | 336 | |
337 | - ob_start(); // Start buffering; |
|
338 | - $value = geodir_get_cf_value($cf); |
|
337 | + ob_start(); // Start buffering; |
|
338 | + $value = geodir_get_cf_value($cf); |
|
339 | 339 | |
340 | - ?> |
|
340 | + ?> |
|
341 | 341 | <div id="<?php echo $cf['name'];?>_row" |
342 | 342 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
343 | 343 | <label> |
344 | 344 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
345 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
345 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
346 | 346 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
347 | 347 | </label> |
348 | 348 | <?php if ($cf['option_values']) { |
349 | - $option_values = geodir_string_values_to_options($cf['option_values'], true); |
|
349 | + $option_values = geodir_string_values_to_options($cf['option_values'], true); |
|
350 | 350 | |
351 | - if (!empty($option_values)) { |
|
352 | - foreach ($option_values as $option_value) { |
|
353 | - if (empty($option_value['optgroup'])) { |
|
354 | - ?> |
|
351 | + if (!empty($option_values)) { |
|
352 | + foreach ($option_values as $option_value) { |
|
353 | + if (empty($option_value['optgroup'])) { |
|
354 | + ?> |
|
355 | 355 | <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked(stripslashes($value), $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span> |
356 | 356 | <?php |
357 | - } |
|
358 | - } |
|
359 | - } |
|
360 | - } |
|
361 | - ?> |
|
357 | + } |
|
358 | + } |
|
359 | + } |
|
360 | + } |
|
361 | + ?> |
|
362 | 362 | <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
363 | 363 | <?php if ($cf['is_required']) { ?> |
364 | 364 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
@@ -366,10 +366,10 @@ discard block |
||
366 | 366 | </div> |
367 | 367 | |
368 | 368 | <?php |
369 | - $html = ob_get_clean(); |
|
370 | - } |
|
369 | + $html = ob_get_clean(); |
|
370 | + } |
|
371 | 371 | |
372 | - return $html; |
|
372 | + return $html; |
|
373 | 373 | } |
374 | 374 | add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2); |
375 | 375 | |
@@ -385,46 +385,46 @@ discard block |
||
385 | 385 | */ |
386 | 386 | function geodir_cfi_checkbox($html,$cf){ |
387 | 387 | |
388 | - $html_var = $cf['htmlvar_name']; |
|
388 | + $html_var = $cf['htmlvar_name']; |
|
389 | 389 | |
390 | - // Check if there is a custom field specific filter. |
|
391 | - if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){ |
|
392 | - /** |
|
393 | - * Filter the checkbox html by individual custom field. |
|
394 | - * |
|
395 | - * @param string $html The html to filter. |
|
396 | - * @param array $cf The custom field array. |
|
397 | - * @since 1.6.6 |
|
398 | - */ |
|
399 | - $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf); |
|
400 | - } |
|
390 | + // Check if there is a custom field specific filter. |
|
391 | + if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){ |
|
392 | + /** |
|
393 | + * Filter the checkbox html by individual custom field. |
|
394 | + * |
|
395 | + * @param string $html The html to filter. |
|
396 | + * @param array $cf The custom field array. |
|
397 | + * @since 1.6.6 |
|
398 | + */ |
|
399 | + $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf); |
|
400 | + } |
|
401 | 401 | |
402 | - // If no html then we run the standard output. |
|
403 | - if(empty($html)) { |
|
402 | + // If no html then we run the standard output. |
|
403 | + if(empty($html)) { |
|
404 | 404 | |
405 | - ob_start(); // Start buffering; |
|
406 | - $value = geodir_get_cf_value($cf); |
|
405 | + ob_start(); // Start buffering; |
|
406 | + $value = geodir_get_cf_value($cf); |
|
407 | 407 | |
408 | 408 | |
409 | - if ($value == '' && $cf['default']) { |
|
410 | - $value = '1'; |
|
411 | - } |
|
412 | - ?> |
|
409 | + if ($value == '' && $cf['default']) { |
|
410 | + $value = '1'; |
|
411 | + } |
|
412 | + ?> |
|
413 | 413 | |
414 | 414 | <div id="<?php echo $cf['name'];?>_row" |
415 | 415 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
416 | 416 | <label> |
417 | 417 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
418 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
418 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
419 | 419 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
420 | 420 | </label> |
421 | 421 | <?php if ($value != '1') { |
422 | - $value = '0'; |
|
423 | - }?> |
|
422 | + $value = '0'; |
|
423 | + }?> |
|
424 | 424 | <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/> |
425 | 425 | <input <?php if ($value == '1') { |
426 | - echo 'checked="checked"'; |
|
427 | - }?> value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox" |
|
426 | + echo 'checked="checked"'; |
|
427 | + }?> value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox" |
|
428 | 428 | onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/> |
429 | 429 | <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
430 | 430 | <?php if ($cf['is_required']) { ?> |
@@ -433,10 +433,10 @@ discard block |
||
433 | 433 | </div> |
434 | 434 | |
435 | 435 | <?php |
436 | - $html = ob_get_clean(); |
|
437 | - } |
|
436 | + $html = ob_get_clean(); |
|
437 | + } |
|
438 | 438 | |
439 | - return $html; |
|
439 | + return $html; |
|
440 | 440 | } |
441 | 441 | add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2); |
442 | 442 | |
@@ -452,52 +452,52 @@ discard block |
||
452 | 452 | */ |
453 | 453 | function geodir_cfi_textarea($html,$cf){ |
454 | 454 | |
455 | - $html_var = $cf['htmlvar_name']; |
|
455 | + $html_var = $cf['htmlvar_name']; |
|
456 | 456 | |
457 | - // Check if there is a custom field specific filter. |
|
458 | - if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){ |
|
459 | - /** |
|
460 | - * Filter the textarea html by individual custom field. |
|
461 | - * |
|
462 | - * @param string $html The html to filter. |
|
463 | - * @param array $cf The custom field array. |
|
464 | - * @since 1.6.6 |
|
465 | - */ |
|
466 | - $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf); |
|
467 | - } |
|
457 | + // Check if there is a custom field specific filter. |
|
458 | + if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){ |
|
459 | + /** |
|
460 | + * Filter the textarea html by individual custom field. |
|
461 | + * |
|
462 | + * @param string $html The html to filter. |
|
463 | + * @param array $cf The custom field array. |
|
464 | + * @since 1.6.6 |
|
465 | + */ |
|
466 | + $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf); |
|
467 | + } |
|
468 | 468 | |
469 | - // If no html then we run the standard output. |
|
470 | - if(empty($html)) { |
|
469 | + // If no html then we run the standard output. |
|
470 | + if(empty($html)) { |
|
471 | 471 | |
472 | - ob_start(); // Start buffering; |
|
473 | - $value = geodir_get_cf_value($cf); |
|
472 | + ob_start(); // Start buffering; |
|
473 | + $value = geodir_get_cf_value($cf); |
|
474 | 474 | |
475 | - $extra_fields = unserialize($cf['extra_fields']); |
|
476 | - ?> |
|
475 | + $extra_fields = unserialize($cf['extra_fields']); |
|
476 | + ?> |
|
477 | 477 | |
478 | 478 | <div id="<?php echo $cf['name'];?>_row" |
479 | 479 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
480 | 480 | <label> |
481 | 481 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
482 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
482 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
483 | 483 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
484 | 484 | </label><?php |
485 | 485 | |
486 | 486 | |
487 | - if (is_array($extra_fields) && in_array('1', $extra_fields)) { |
|
487 | + if (is_array($extra_fields) && in_array('1', $extra_fields)) { |
|
488 | 488 | |
489 | - $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?> |
|
489 | + $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?> |
|
490 | 490 | |
491 | 491 | <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor"> |
492 | 492 | <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?> |
493 | 493 | </div><?php |
494 | 494 | |
495 | - } else { |
|
495 | + } else { |
|
496 | 496 | |
497 | - ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>" |
|
497 | + ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>" |
|
498 | 498 | id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php |
499 | 499 | |
500 | - }?> |
|
500 | + }?> |
|
501 | 501 | |
502 | 502 | |
503 | 503 | <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
@@ -507,10 +507,10 @@ discard block |
||
507 | 507 | </div> |
508 | 508 | |
509 | 509 | <?php |
510 | - $html = ob_get_clean(); |
|
511 | - } |
|
510 | + $html = ob_get_clean(); |
|
511 | + } |
|
512 | 512 | |
513 | - return $html; |
|
513 | + return $html; |
|
514 | 514 | } |
515 | 515 | add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2); |
516 | 516 | |
@@ -526,53 +526,53 @@ discard block |
||
526 | 526 | */ |
527 | 527 | function geodir_cfi_select($html,$cf){ |
528 | 528 | |
529 | - $html_var = $cf['htmlvar_name']; |
|
529 | + $html_var = $cf['htmlvar_name']; |
|
530 | 530 | |
531 | - // Check if there is a custom field specific filter. |
|
532 | - if(has_filter("geodir_custom_field_input_select_{$html_var}")){ |
|
533 | - /** |
|
534 | - * Filter the select html by individual custom field. |
|
535 | - * |
|
536 | - * @param string $html The html to filter. |
|
537 | - * @param array $cf The custom field array. |
|
538 | - * @since 1.6.6 |
|
539 | - */ |
|
540 | - $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf); |
|
541 | - } |
|
531 | + // Check if there is a custom field specific filter. |
|
532 | + if(has_filter("geodir_custom_field_input_select_{$html_var}")){ |
|
533 | + /** |
|
534 | + * Filter the select html by individual custom field. |
|
535 | + * |
|
536 | + * @param string $html The html to filter. |
|
537 | + * @param array $cf The custom field array. |
|
538 | + * @since 1.6.6 |
|
539 | + */ |
|
540 | + $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf); |
|
541 | + } |
|
542 | 542 | |
543 | - // If no html then we run the standard output. |
|
544 | - if(empty($html)) { |
|
543 | + // If no html then we run the standard output. |
|
544 | + if(empty($html)) { |
|
545 | 545 | |
546 | - ob_start(); // Start buffering; |
|
547 | - $value = geodir_get_cf_value($cf); |
|
546 | + ob_start(); // Start buffering; |
|
547 | + $value = geodir_get_cf_value($cf); |
|
548 | 548 | |
549 | - ?> |
|
549 | + ?> |
|
550 | 550 | <div id="<?php echo $cf['name'];?>_row" |
551 | 551 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details"> |
552 | 552 | <label> |
553 | 553 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
554 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
554 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
555 | 555 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
556 | 556 | </label> |
557 | 557 | <?php |
558 | - $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
|
559 | - $select_options = ''; |
|
560 | - if (!empty($option_values_arr)) { |
|
561 | - foreach ($option_values_arr as $option_row) { |
|
562 | - if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
|
563 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
564 | - |
|
565 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
566 | - } else { |
|
567 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
568 | - $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
569 | - $selected = $option_value == stripslashes($value) ? 'selected="selected"' : ''; |
|
570 | - |
|
571 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
572 | - } |
|
573 | - } |
|
574 | - } |
|
575 | - ?> |
|
558 | + $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
|
559 | + $select_options = ''; |
|
560 | + if (!empty($option_values_arr)) { |
|
561 | + foreach ($option_values_arr as $option_row) { |
|
562 | + if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
|
563 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
564 | + |
|
565 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
566 | + } else { |
|
567 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
568 | + $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
569 | + $selected = $option_value == stripslashes($value) ? 'selected="selected"' : ''; |
|
570 | + |
|
571 | + $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
572 | + } |
|
573 | + } |
|
574 | + } |
|
575 | + ?> |
|
576 | 576 | <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
577 | 577 | class="geodir_textfield textfield_x chosen_select" |
578 | 578 | data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '…';?>" |
@@ -584,10 +584,10 @@ discard block |
||
584 | 584 | </div> |
585 | 585 | |
586 | 586 | <?php |
587 | - $html = ob_get_clean(); |
|
588 | - } |
|
587 | + $html = ob_get_clean(); |
|
588 | + } |
|
589 | 589 | |
590 | - return $html; |
|
590 | + return $html; |
|
591 | 591 | } |
592 | 592 | add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2); |
593 | 593 | |
@@ -603,36 +603,36 @@ discard block |
||
603 | 603 | */ |
604 | 604 | function geodir_cfi_multiselect($html,$cf){ |
605 | 605 | |
606 | - $html_var = $cf['htmlvar_name']; |
|
607 | - |
|
608 | - // Check if there is a custom field specific filter. |
|
609 | - if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){ |
|
610 | - /** |
|
611 | - * Filter the multiselect html by individual custom field. |
|
612 | - * |
|
613 | - * @param string $html The html to filter. |
|
614 | - * @param array $cf The custom field array. |
|
615 | - * @since 1.6.6 |
|
616 | - */ |
|
617 | - $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf); |
|
618 | - } |
|
619 | - |
|
620 | - // If no html then we run the standard output. |
|
621 | - if(empty($html)) { |
|
622 | - |
|
623 | - ob_start(); // Start buffering; |
|
624 | - $value = geodir_get_cf_value($cf); |
|
625 | - |
|
626 | - $multi_display = 'select'; |
|
627 | - if (!empty($cf['extra_fields'])) { |
|
628 | - $multi_display = unserialize($cf['extra_fields']); |
|
629 | - } |
|
630 | - ?> |
|
606 | + $html_var = $cf['htmlvar_name']; |
|
607 | + |
|
608 | + // Check if there is a custom field specific filter. |
|
609 | + if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){ |
|
610 | + /** |
|
611 | + * Filter the multiselect html by individual custom field. |
|
612 | + * |
|
613 | + * @param string $html The html to filter. |
|
614 | + * @param array $cf The custom field array. |
|
615 | + * @since 1.6.6 |
|
616 | + */ |
|
617 | + $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf); |
|
618 | + } |
|
619 | + |
|
620 | + // If no html then we run the standard output. |
|
621 | + if(empty($html)) { |
|
622 | + |
|
623 | + ob_start(); // Start buffering; |
|
624 | + $value = geodir_get_cf_value($cf); |
|
625 | + |
|
626 | + $multi_display = 'select'; |
|
627 | + if (!empty($cf['extra_fields'])) { |
|
628 | + $multi_display = unserialize($cf['extra_fields']); |
|
629 | + } |
|
630 | + ?> |
|
631 | 631 | <div id="<?php echo $cf['name']; ?>_row" |
632 | 632 | class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
633 | 633 | <label> |
634 | 634 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
635 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
635 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
636 | 636 | <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
637 | 637 | </label> |
638 | 638 | <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/> |
@@ -643,63 +643,63 @@ discard block |
||
643 | 643 | data-placeholder="<?php _e('Select', 'geodirectory'); ?>" |
644 | 644 | option-ajaxchosen="false"> |
645 | 645 | <?php |
646 | - } else { |
|
647 | - echo '<ul class="gd_multi_choice">'; |
|
648 | - } |
|
649 | - |
|
650 | - $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
|
651 | - $select_options = ''; |
|
652 | - if (!empty($option_values_arr)) { |
|
653 | - foreach ($option_values_arr as $option_row) { |
|
654 | - if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
|
655 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
656 | - |
|
657 | - if ($multi_display == 'select') { |
|
658 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
659 | - } else { |
|
660 | - $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : ''; |
|
661 | - } |
|
662 | - } else { |
|
663 | - if (!is_array($value) && $value != '') { |
|
664 | - $value = trim($value); |
|
665 | - } |
|
646 | + } else { |
|
647 | + echo '<ul class="gd_multi_choice">'; |
|
648 | + } |
|
649 | + |
|
650 | + $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
|
651 | + $select_options = ''; |
|
652 | + if (!empty($option_values_arr)) { |
|
653 | + foreach ($option_values_arr as $option_row) { |
|
654 | + if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
|
655 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
656 | + |
|
657 | + if ($multi_display == 'select') { |
|
658 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
659 | + } else { |
|
660 | + $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : ''; |
|
661 | + } |
|
662 | + } else { |
|
663 | + if (!is_array($value) && $value != '') { |
|
664 | + $value = trim($value); |
|
665 | + } |
|
666 | 666 | |
667 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
668 | - $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
669 | - $selected = $option_value == $value ? 'selected="selected"' : ''; |
|
670 | - $selected = ''; |
|
671 | - $checked = ''; |
|
672 | - |
|
673 | - if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) { |
|
674 | - if (!is_array($value)) { |
|
675 | - $value_array = explode(',', $value); |
|
676 | - } else { |
|
677 | - $value_array = $value; |
|
678 | - } |
|
667 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
668 | + $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
669 | + $selected = $option_value == $value ? 'selected="selected"' : ''; |
|
670 | + $selected = ''; |
|
671 | + $checked = ''; |
|
672 | + |
|
673 | + if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) { |
|
674 | + if (!is_array($value)) { |
|
675 | + $value_array = explode(',', $value); |
|
676 | + } else { |
|
677 | + $value_array = $value; |
|
678 | + } |
|
679 | 679 | |
680 | - $value_array = stripslashes_deep($value_array); |
|
680 | + $value_array = stripslashes_deep($value_array); |
|
681 | 681 | |
682 | - if (is_array($value_array)) { |
|
683 | - $value_array = array_map('trim', $value_array); |
|
682 | + if (is_array($value_array)) { |
|
683 | + $value_array = array_map('trim', $value_array); |
|
684 | 684 | |
685 | - if (in_array($option_value, $value_array)) { |
|
686 | - $selected = 'selected="selected"'; |
|
687 | - $checked = 'checked="checked"'; |
|
688 | - } |
|
689 | - } |
|
690 | - } |
|
691 | - |
|
692 | - if ($multi_display == 'select') { |
|
693 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
694 | - } else { |
|
695 | - $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>'; |
|
696 | - } |
|
697 | - } |
|
698 | - } |
|
699 | - } |
|
700 | - echo $select_options; |
|
701 | - |
|
702 | - if ($multi_display == 'select') { ?></select></div> |
|
685 | + if (in_array($option_value, $value_array)) { |
|
686 | + $selected = 'selected="selected"'; |
|
687 | + $checked = 'checked="checked"'; |
|
688 | + } |
|
689 | + } |
|
690 | + } |
|
691 | + |
|
692 | + if ($multi_display == 'select') { |
|
693 | + $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
694 | + } else { |
|
695 | + $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>'; |
|
696 | + } |
|
697 | + } |
|
698 | + } |
|
699 | + } |
|
700 | + echo $select_options; |
|
701 | + |
|
702 | + if ($multi_display == 'select') { ?></select></div> |
|
703 | 703 | <?php } else { ?></ul><?php } ?> |
704 | 704 | <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
705 | 705 | <?php if ($cf['is_required']) { ?> |
@@ -707,10 +707,10 @@ discard block |
||
707 | 707 | <?php } ?> |
708 | 708 | </div> |
709 | 709 | <?php |
710 | - $html = ob_get_clean(); |
|
711 | - } |
|
710 | + $html = ob_get_clean(); |
|
711 | + } |
|
712 | 712 | |
713 | - return $html; |
|
713 | + return $html; |
|
714 | 714 | } |
715 | 715 | add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2); |
716 | 716 | |
@@ -726,32 +726,32 @@ discard block |
||
726 | 726 | */ |
727 | 727 | function geodir_cfi_html($html,$cf){ |
728 | 728 | |
729 | - $html_var = $cf['htmlvar_name']; |
|
729 | + $html_var = $cf['htmlvar_name']; |
|
730 | 730 | |
731 | - // Check if there is a custom field specific filter. |
|
732 | - if(has_filter("geodir_custom_field_input_html_{$html_var}")){ |
|
733 | - /** |
|
734 | - * Filter the html html by individual custom field. |
|
735 | - * |
|
736 | - * @param string $html The html to filter. |
|
737 | - * @param array $cf The custom field array. |
|
738 | - * @since 1.6.6 |
|
739 | - */ |
|
740 | - $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf); |
|
741 | - } |
|
731 | + // Check if there is a custom field specific filter. |
|
732 | + if(has_filter("geodir_custom_field_input_html_{$html_var}")){ |
|
733 | + /** |
|
734 | + * Filter the html html by individual custom field. |
|
735 | + * |
|
736 | + * @param string $html The html to filter. |
|
737 | + * @param array $cf The custom field array. |
|
738 | + * @since 1.6.6 |
|
739 | + */ |
|
740 | + $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf); |
|
741 | + } |
|
742 | 742 | |
743 | - // If no html then we run the standard output. |
|
744 | - if(empty($html)) { |
|
743 | + // If no html then we run the standard output. |
|
744 | + if(empty($html)) { |
|
745 | 745 | |
746 | - ob_start(); // Start buffering; |
|
747 | - $value = geodir_get_cf_value($cf); |
|
748 | - ?> |
|
746 | + ob_start(); // Start buffering; |
|
747 | + $value = geodir_get_cf_value($cf); |
|
748 | + ?> |
|
749 | 749 | |
750 | 750 | <div id="<?php echo $cf['name']; ?>_row" |
751 | 751 | class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
752 | 752 | <label> |
753 | 753 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
754 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
754 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
755 | 755 | <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
756 | 756 | </label> |
757 | 757 | |
@@ -769,10 +769,10 @@ discard block |
||
769 | 769 | </div> |
770 | 770 | |
771 | 771 | <?php |
772 | - $html = ob_get_clean(); |
|
773 | - } |
|
772 | + $html = ob_get_clean(); |
|
773 | + } |
|
774 | 774 | |
775 | - return $html; |
|
775 | + return $html; |
|
776 | 776 | } |
777 | 777 | add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2); |
778 | 778 | |
@@ -789,68 +789,68 @@ discard block |
||
789 | 789 | */ |
790 | 790 | function geodir_cfi_datepicker($html,$cf){ |
791 | 791 | |
792 | - $html_var = $cf['htmlvar_name']; |
|
792 | + $html_var = $cf['htmlvar_name']; |
|
793 | 793 | |
794 | - // Check if there is a custom field specific filter. |
|
795 | - if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){ |
|
796 | - /** |
|
797 | - * Filter the datepicker html by individual custom field. |
|
798 | - * |
|
799 | - * @param string $html The html to filter. |
|
800 | - * @param array $cf The custom field array. |
|
801 | - * @since 1.6.6 |
|
802 | - */ |
|
803 | - $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf); |
|
804 | - } |
|
794 | + // Check if there is a custom field specific filter. |
|
795 | + if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){ |
|
796 | + /** |
|
797 | + * Filter the datepicker html by individual custom field. |
|
798 | + * |
|
799 | + * @param string $html The html to filter. |
|
800 | + * @param array $cf The custom field array. |
|
801 | + * @since 1.6.6 |
|
802 | + */ |
|
803 | + $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf); |
|
804 | + } |
|
805 | 805 | |
806 | - // If no html then we run the standard output. |
|
807 | - if(empty($html)) { |
|
806 | + // If no html then we run the standard output. |
|
807 | + if(empty($html)) { |
|
808 | 808 | |
809 | - ob_start(); // Start buffering; |
|
810 | - $value = geodir_get_cf_value($cf); |
|
809 | + ob_start(); // Start buffering; |
|
810 | + $value = geodir_get_cf_value($cf); |
|
811 | 811 | |
812 | - $extra_fields = unserialize($cf['extra_fields']); |
|
813 | - $name = $cf['name']; |
|
812 | + $extra_fields = unserialize($cf['extra_fields']); |
|
813 | + $name = $cf['name']; |
|
814 | 814 | |
815 | - if ($extra_fields['date_format'] == '') |
|
816 | - $extra_fields['date_format'] = 'yy-mm-dd'; |
|
815 | + if ($extra_fields['date_format'] == '') |
|
816 | + $extra_fields['date_format'] = 'yy-mm-dd'; |
|
817 | 817 | |
818 | - $date_format = $extra_fields['date_format']; |
|
819 | - $jquery_date_format = $date_format; |
|
818 | + $date_format = $extra_fields['date_format']; |
|
819 | + $jquery_date_format = $date_format; |
|
820 | 820 | |
821 | 821 | |
822 | - // check if we need to change the format or not |
|
823 | - $date_format_len = strlen(str_replace(' ', '', $date_format)); |
|
824 | - if($date_format_len>5){// if greater then 5 then it's the old style format. |
|
822 | + // check if we need to change the format or not |
|
823 | + $date_format_len = strlen(str_replace(' ', '', $date_format)); |
|
824 | + if($date_format_len>5){// if greater then 5 then it's the old style format. |
|
825 | 825 | |
826 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
827 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
826 | + $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
827 | + $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
828 | 828 | |
829 | - $date_format = str_replace($search, $replace, $date_format); |
|
830 | - }else{ |
|
831 | - $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format ); |
|
832 | - } |
|
829 | + $date_format = str_replace($search, $replace, $date_format); |
|
830 | + }else{ |
|
831 | + $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format ); |
|
832 | + } |
|
833 | 833 | |
834 | - if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty |
|
835 | - if($value && !isset($_REQUEST['backandedit'])) { |
|
836 | - //$time = strtotime($value); |
|
837 | - //$value = date_i18n($date_format, $time); |
|
838 | - } |
|
839 | - $value = geodir_date($value, 'Y-m-d', $date_format); |
|
834 | + if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty |
|
835 | + if($value && !isset($_REQUEST['backandedit'])) { |
|
836 | + //$time = strtotime($value); |
|
837 | + //$value = date_i18n($date_format, $time); |
|
838 | + } |
|
839 | + $value = geodir_date($value, 'Y-m-d', $date_format); |
|
840 | 840 | |
841 | - ?> |
|
841 | + ?> |
|
842 | 842 | <script type="text/javascript"> |
843 | 843 | |
844 | 844 | jQuery(function () { |
845 | 845 | |
846 | 846 | jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php |
847 | - /** |
|
848 | - * Used to add extra option to datepicker per custom field. |
|
849 | - * |
|
850 | - * @since 1.5.7 |
|
851 | - * @param string $name The custom field name. |
|
852 | - */ |
|
853 | - echo apply_filters("gd_datepicker_extra_{$name}",'');?>}); |
|
847 | + /** |
|
848 | + * Used to add extra option to datepicker per custom field. |
|
849 | + * |
|
850 | + * @since 1.5.7 |
|
851 | + * @param string $name The custom field name. |
|
852 | + */ |
|
853 | + echo apply_filters("gd_datepicker_extra_{$name}",'');?>}); |
|
854 | 854 | |
855 | 855 | jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>'); |
856 | 856 | |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | <label> |
867 | 867 | |
868 | 868 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
869 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
869 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
870 | 870 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
871 | 871 | </label> |
872 | 872 | |
@@ -880,10 +880,10 @@ discard block |
||
880 | 880 | </div> |
881 | 881 | |
882 | 882 | <?php |
883 | - $html = ob_get_clean(); |
|
884 | - } |
|
883 | + $html = ob_get_clean(); |
|
884 | + } |
|
885 | 885 | |
886 | - return $html; |
|
886 | + return $html; |
|
887 | 887 | } |
888 | 888 | add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2); |
889 | 889 | |
@@ -899,31 +899,31 @@ discard block |
||
899 | 899 | */ |
900 | 900 | function geodir_cfi_time($html,$cf){ |
901 | 901 | |
902 | - $html_var = $cf['htmlvar_name']; |
|
902 | + $html_var = $cf['htmlvar_name']; |
|
903 | 903 | |
904 | - // Check if there is a custom field specific filter. |
|
905 | - if(has_filter("geodir_custom_field_input_time_{$html_var}")){ |
|
906 | - /** |
|
907 | - * Filter the time html by individual custom field. |
|
908 | - * |
|
909 | - * @param string $html The html to filter. |
|
910 | - * @param array $cf The custom field array. |
|
911 | - * @since 1.6.6 |
|
912 | - */ |
|
913 | - $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf); |
|
914 | - } |
|
904 | + // Check if there is a custom field specific filter. |
|
905 | + if(has_filter("geodir_custom_field_input_time_{$html_var}")){ |
|
906 | + /** |
|
907 | + * Filter the time html by individual custom field. |
|
908 | + * |
|
909 | + * @param string $html The html to filter. |
|
910 | + * @param array $cf The custom field array. |
|
911 | + * @since 1.6.6 |
|
912 | + */ |
|
913 | + $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf); |
|
914 | + } |
|
915 | 915 | |
916 | - // If no html then we run the standard output. |
|
917 | - if(empty($html)) { |
|
916 | + // If no html then we run the standard output. |
|
917 | + if(empty($html)) { |
|
918 | 918 | |
919 | - ob_start(); // Start buffering; |
|
920 | - $value = geodir_get_cf_value($cf); |
|
919 | + ob_start(); // Start buffering; |
|
920 | + $value = geodir_get_cf_value($cf); |
|
921 | 921 | |
922 | - $name = $cf['name']; |
|
922 | + $name = $cf['name']; |
|
923 | 923 | |
924 | - if ($value != '') |
|
925 | - $value = date('H:i', strtotime($value)); |
|
926 | - ?> |
|
924 | + if ($value != '') |
|
925 | + $value = date('H:i', strtotime($value)); |
|
926 | + ?> |
|
927 | 927 | <script type="text/javascript"> |
928 | 928 | jQuery(document).ready(function () { |
929 | 929 | |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | <label> |
940 | 940 | |
941 | 941 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
942 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
942 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
943 | 943 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
944 | 944 | </label> |
945 | 945 | <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" |
@@ -951,10 +951,10 @@ discard block |
||
951 | 951 | <?php } ?> |
952 | 952 | </div> |
953 | 953 | <?php |
954 | - $html = ob_get_clean(); |
|
955 | - } |
|
954 | + $html = ob_get_clean(); |
|
955 | + } |
|
956 | 956 | |
957 | - return $html; |
|
957 | + return $html; |
|
958 | 958 | } |
959 | 959 | add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2); |
960 | 960 | |
@@ -970,100 +970,100 @@ discard block |
||
970 | 970 | */ |
971 | 971 | function geodir_cfi_address($html,$cf){ |
972 | 972 | |
973 | - $html_var = $cf['htmlvar_name']; |
|
974 | - |
|
975 | - // Check if there is a custom field specific filter. |
|
976 | - if(has_filter("geodir_custom_field_input_address_{$html_var}")){ |
|
977 | - /** |
|
978 | - * Filter the address html by individual custom field. |
|
979 | - * |
|
980 | - * @param string $html The html to filter. |
|
981 | - * @param array $cf The custom field array. |
|
982 | - * @since 1.6.6 |
|
983 | - */ |
|
984 | - $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf); |
|
985 | - } |
|
986 | - |
|
987 | - // If no html then we run the standard output. |
|
988 | - if(empty($html)) { |
|
989 | - |
|
990 | - global $gd_session; |
|
991 | - ob_start(); // Start buffering; |
|
992 | - $value = geodir_get_cf_value($cf); |
|
993 | - $name = $cf['name']; |
|
994 | - $type = $cf['type']; |
|
995 | - $admin_desc = $cf['desc']; |
|
996 | - $is_required = $cf['is_required']; |
|
997 | - $required_msg = $cf['required_msg']; |
|
998 | - $site_title = $cf['site_title']; |
|
999 | - $is_admin = $cf['is_admin']; |
|
1000 | - $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
1001 | - $prefix = $name . '_'; |
|
1002 | - |
|
1003 | - ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address'); |
|
1004 | - ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code '); |
|
1005 | - ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map'); |
|
1006 | - ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview'); |
|
1007 | - |
|
1008 | - $address = ''; |
|
1009 | - $zip = ''; |
|
1010 | - $mapview = ''; |
|
1011 | - $mapzoom = ''; |
|
1012 | - $lat = ''; |
|
1013 | - $lng = ''; |
|
1014 | - |
|
1015 | - if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) { |
|
1016 | - $post = $gd_ses_listing; |
|
1017 | - $address = $post[$prefix . 'address']; |
|
1018 | - $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : ''; |
|
1019 | - $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : ''; |
|
1020 | - $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : ''; |
|
1021 | - $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : ''; |
|
1022 | - $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : ''; |
|
1023 | - } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) { |
|
1024 | - $post_info = (array)$post_info; |
|
1025 | - |
|
1026 | - $address = $post_info[$prefix . 'address']; |
|
1027 | - $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : ''; |
|
1028 | - $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : ''; |
|
1029 | - $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : ''; |
|
1030 | - $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : ''; |
|
1031 | - $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : ''; |
|
1032 | - } |
|
1033 | - |
|
1034 | - $location = geodir_get_default_location(); |
|
1035 | - if (empty($city)) $city = isset($location->city) ? $location->city : ''; |
|
1036 | - if (empty($region)) $region = isset($location->region) ? $location->region : ''; |
|
1037 | - if (empty($country)) $country = isset($location->country) ? $location->country : ''; |
|
1038 | - |
|
1039 | - $lat_lng_blank = false; |
|
1040 | - if (empty($lat) && empty($lng)) { |
|
1041 | - $lat_lng_blank = true; |
|
1042 | - } |
|
1043 | - |
|
1044 | - if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : ''; |
|
1045 | - if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : ''; |
|
1046 | - |
|
1047 | - /** |
|
1048 | - * Filter the default latitude. |
|
1049 | - * |
|
1050 | - * @since 1.0.0 |
|
1051 | - * |
|
1052 | - * @param float $lat Default latitude. |
|
1053 | - * @param bool $is_admin For admin use only?. |
|
1054 | - */ |
|
1055 | - $lat = apply_filters('geodir_default_latitude', $lat, $is_admin); |
|
1056 | - /** |
|
1057 | - * Filter the default longitude. |
|
1058 | - * |
|
1059 | - * @since 1.0.0 |
|
1060 | - * |
|
1061 | - * @param float $lat Default longitude. |
|
1062 | - * @param bool $is_admin For admin use only?. |
|
1063 | - */ |
|
1064 | - $lng = apply_filters('geodir_default_longitude', $lng, $is_admin); |
|
1065 | - |
|
1066 | - ?> |
|
973 | + $html_var = $cf['htmlvar_name']; |
|
974 | + |
|
975 | + // Check if there is a custom field specific filter. |
|
976 | + if(has_filter("geodir_custom_field_input_address_{$html_var}")){ |
|
977 | + /** |
|
978 | + * Filter the address html by individual custom field. |
|
979 | + * |
|
980 | + * @param string $html The html to filter. |
|
981 | + * @param array $cf The custom field array. |
|
982 | + * @since 1.6.6 |
|
983 | + */ |
|
984 | + $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf); |
|
985 | + } |
|
986 | + |
|
987 | + // If no html then we run the standard output. |
|
988 | + if(empty($html)) { |
|
989 | + |
|
990 | + global $gd_session; |
|
991 | + ob_start(); // Start buffering; |
|
992 | + $value = geodir_get_cf_value($cf); |
|
993 | + $name = $cf['name']; |
|
994 | + $type = $cf['type']; |
|
995 | + $admin_desc = $cf['desc']; |
|
996 | + $is_required = $cf['is_required']; |
|
997 | + $required_msg = $cf['required_msg']; |
|
998 | + $site_title = $cf['site_title']; |
|
999 | + $is_admin = $cf['is_admin']; |
|
1000 | + $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
1001 | + $prefix = $name . '_'; |
|
1002 | + |
|
1003 | + ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address'); |
|
1004 | + ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code '); |
|
1005 | + ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map'); |
|
1006 | + ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview'); |
|
1007 | + |
|
1008 | + $address = ''; |
|
1009 | + $zip = ''; |
|
1010 | + $mapview = ''; |
|
1011 | + $mapzoom = ''; |
|
1012 | + $lat = ''; |
|
1013 | + $lng = ''; |
|
1014 | + |
|
1015 | + if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) { |
|
1016 | + $post = $gd_ses_listing; |
|
1017 | + $address = $post[$prefix . 'address']; |
|
1018 | + $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : ''; |
|
1019 | + $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : ''; |
|
1020 | + $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : ''; |
|
1021 | + $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : ''; |
|
1022 | + $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : ''; |
|
1023 | + } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) { |
|
1024 | + $post_info = (array)$post_info; |
|
1025 | + |
|
1026 | + $address = $post_info[$prefix . 'address']; |
|
1027 | + $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : ''; |
|
1028 | + $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : ''; |
|
1029 | + $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : ''; |
|
1030 | + $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : ''; |
|
1031 | + $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : ''; |
|
1032 | + } |
|
1033 | + |
|
1034 | + $location = geodir_get_default_location(); |
|
1035 | + if (empty($city)) $city = isset($location->city) ? $location->city : ''; |
|
1036 | + if (empty($region)) $region = isset($location->region) ? $location->region : ''; |
|
1037 | + if (empty($country)) $country = isset($location->country) ? $location->country : ''; |
|
1038 | + |
|
1039 | + $lat_lng_blank = false; |
|
1040 | + if (empty($lat) && empty($lng)) { |
|
1041 | + $lat_lng_blank = true; |
|
1042 | + } |
|
1043 | + |
|
1044 | + if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : ''; |
|
1045 | + if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : ''; |
|
1046 | + |
|
1047 | + /** |
|
1048 | + * Filter the default latitude. |
|
1049 | + * |
|
1050 | + * @since 1.0.0 |
|
1051 | + * |
|
1052 | + * @param float $lat Default latitude. |
|
1053 | + * @param bool $is_admin For admin use only?. |
|
1054 | + */ |
|
1055 | + $lat = apply_filters('geodir_default_latitude', $lat, $is_admin); |
|
1056 | + /** |
|
1057 | + * Filter the default longitude. |
|
1058 | + * |
|
1059 | + * @since 1.0.0 |
|
1060 | + * |
|
1061 | + * @param float $lat Default longitude. |
|
1062 | + * @param bool $is_admin For admin use only?. |
|
1063 | + */ |
|
1064 | + $lng = apply_filters('geodir_default_longitude', $lng, $is_admin); |
|
1065 | + |
|
1066 | + ?> |
|
1067 | 1067 | |
1068 | 1068 | <div id="geodir_<?php echo $prefix . 'address';?>_row" |
1069 | 1069 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
@@ -1082,17 +1082,17 @@ discard block |
||
1082 | 1082 | |
1083 | 1083 | |
1084 | 1084 | <?php |
1085 | - /** |
|
1086 | - * Called after the address input on the add listings. |
|
1087 | - * |
|
1088 | - * This is used by the location manage to add further locations info etc. |
|
1089 | - * |
|
1090 | - * @since 1.0.0 |
|
1091 | - * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}. |
|
1092 | - */ |
|
1093 | - do_action('geodir_address_extra_listing_fields', $cf); |
|
1094 | - |
|
1095 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?> |
|
1085 | + /** |
|
1086 | + * Called after the address input on the add listings. |
|
1087 | + * |
|
1088 | + * This is used by the location manage to add further locations info etc. |
|
1089 | + * |
|
1090 | + * @since 1.0.0 |
|
1091 | + * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}. |
|
1092 | + */ |
|
1093 | + do_action('geodir_address_extra_listing_fields', $cf); |
|
1094 | + |
|
1095 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?> |
|
1096 | 1096 | |
1097 | 1097 | <div id="geodir_<?php echo $prefix . 'zip'; ?>_row" |
1098 | 1098 | class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details"> |
@@ -1113,22 +1113,22 @@ discard block |
||
1113 | 1113 | |
1114 | 1114 | <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details"> |
1115 | 1115 | <?php |
1116 | - /** |
|
1117 | - * Contains add listing page map functions. |
|
1118 | - * |
|
1119 | - * @since 1.0.0 |
|
1120 | - */ |
|
1121 | - include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"); |
|
1122 | - if ($lat_lng_blank) { |
|
1123 | - $lat = ''; |
|
1124 | - $lng = ''; |
|
1125 | - } |
|
1126 | - ?> |
|
1116 | + /** |
|
1117 | + * Contains add listing page map functions. |
|
1118 | + * |
|
1119 | + * @since 1.0.0 |
|
1120 | + */ |
|
1121 | + include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"); |
|
1122 | + if ($lat_lng_blank) { |
|
1123 | + $lat = ''; |
|
1124 | + $lng = ''; |
|
1125 | + } |
|
1126 | + ?> |
|
1127 | 1127 | <span class="geodir_message_note"><?php echo stripslashes(GET_MAP_MSG); ?></span> |
1128 | 1128 | </div> |
1129 | 1129 | <?php |
1130 | - /* show lat lng */ |
|
1131 | - $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?> |
|
1130 | + /* show lat lng */ |
|
1131 | + $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?> |
|
1132 | 1132 | <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row" |
1133 | 1133 | class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>> |
1134 | 1134 | <label> |
@@ -1169,27 +1169,27 @@ discard block |
||
1169 | 1169 | class="gd-checkbox" |
1170 | 1170 | name="<?php echo $prefix . 'mapview'; ?>" |
1171 | 1171 | id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') { |
1172 | - echo 'checked="checked"'; |
|
1173 | - } ?> value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span> |
|
1172 | + echo 'checked="checked"'; |
|
1173 | + } ?> value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span> |
|
1174 | 1174 | <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio" |
1175 | 1175 | class="gd-checkbox" |
1176 | 1176 | name="<?php echo $prefix . 'mapview'; ?>" |
1177 | 1177 | id="map_view1" <?php if ($mapview == 'SATELLITE') { |
1178 | - echo 'checked="checked"'; |
|
1179 | - } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span> |
|
1178 | + echo 'checked="checked"'; |
|
1179 | + } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span> |
|
1180 | 1180 | |
1181 | 1181 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
1182 | 1182 | class="gd-checkbox" |
1183 | 1183 | name="<?php echo $prefix . 'mapview'; ?>" |
1184 | 1184 | id="map_view2" <?php if ($mapview == 'HYBRID') { |
1185 | - echo 'checked="checked"'; |
|
1186 | - } ?> value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span> |
|
1185 | + echo 'checked="checked"'; |
|
1186 | + } ?> value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span> |
|
1187 | 1187 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
1188 | 1188 | class="gd-checkbox" |
1189 | 1189 | name="<?php echo $prefix . 'mapview'; ?>" |
1190 | 1190 | id="map_view3" <?php if ($mapview == 'TERRAIN') { |
1191 | - echo 'checked="checked"'; |
|
1192 | - } ?> value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span> |
|
1191 | + echo 'checked="checked"'; |
|
1192 | + } ?> value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span> |
|
1193 | 1193 | |
1194 | 1194 | |
1195 | 1195 | </div> |
@@ -1197,14 +1197,14 @@ discard block |
||
1197 | 1197 | |
1198 | 1198 | <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?> |
1199 | 1199 | <input type="hidden" value="<?php if (isset($mapzoom)) { |
1200 | - echo esc_attr($mapzoom); |
|
1201 | - } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/> |
|
1200 | + echo esc_attr($mapzoom); |
|
1201 | + } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/> |
|
1202 | 1202 | <?php } |
1203 | 1203 | |
1204 | - $html = ob_get_clean(); |
|
1205 | - } |
|
1204 | + $html = ob_get_clean(); |
|
1205 | + } |
|
1206 | 1206 | |
1207 | - return $html; |
|
1207 | + return $html; |
|
1208 | 1208 | } |
1209 | 1209 | add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2); |
1210 | 1210 | |
@@ -1221,137 +1221,137 @@ discard block |
||
1221 | 1221 | */ |
1222 | 1222 | function geodir_cfi_taxonomy($html,$cf){ |
1223 | 1223 | |
1224 | - $html_var = $cf['htmlvar_name']; |
|
1225 | - |
|
1226 | - // Check if there is a custom field specific filter. |
|
1227 | - if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){ |
|
1228 | - /** |
|
1229 | - * Filter the taxonomy html by individual custom field. |
|
1230 | - * |
|
1231 | - * @param string $html The html to filter. |
|
1232 | - * @param array $cf The custom field array. |
|
1233 | - * @since 1.6.6 |
|
1234 | - */ |
|
1235 | - $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf); |
|
1236 | - } |
|
1237 | - |
|
1238 | - // If no html then we run the standard output. |
|
1239 | - if(empty($html)) { |
|
1240 | - |
|
1241 | - ob_start(); // Start buffering; |
|
1242 | - $value = geodir_get_cf_value($cf); |
|
1243 | - |
|
1244 | - $name = $cf['name']; |
|
1245 | - $site_title = $cf['site_title']; |
|
1246 | - $admin_desc = $cf['desc']; |
|
1247 | - $is_required = $cf['is_required']; |
|
1248 | - $is_admin = $cf['is_admin']; |
|
1249 | - $required_msg = $cf['required_msg']; |
|
1250 | - |
|
1251 | - if ($value == $cf['default']) { |
|
1252 | - $value = ''; |
|
1253 | - } ?> |
|
1224 | + $html_var = $cf['htmlvar_name']; |
|
1225 | + |
|
1226 | + // Check if there is a custom field specific filter. |
|
1227 | + if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){ |
|
1228 | + /** |
|
1229 | + * Filter the taxonomy html by individual custom field. |
|
1230 | + * |
|
1231 | + * @param string $html The html to filter. |
|
1232 | + * @param array $cf The custom field array. |
|
1233 | + * @since 1.6.6 |
|
1234 | + */ |
|
1235 | + $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf); |
|
1236 | + } |
|
1237 | + |
|
1238 | + // If no html then we run the standard output. |
|
1239 | + if(empty($html)) { |
|
1240 | + |
|
1241 | + ob_start(); // Start buffering; |
|
1242 | + $value = geodir_get_cf_value($cf); |
|
1243 | + |
|
1244 | + $name = $cf['name']; |
|
1245 | + $site_title = $cf['site_title']; |
|
1246 | + $admin_desc = $cf['desc']; |
|
1247 | + $is_required = $cf['is_required']; |
|
1248 | + $is_admin = $cf['is_admin']; |
|
1249 | + $required_msg = $cf['required_msg']; |
|
1250 | + |
|
1251 | + if ($value == $cf['default']) { |
|
1252 | + $value = ''; |
|
1253 | + } ?> |
|
1254 | 1254 | <div id="<?php echo $name;?>_row" |
1255 | 1255 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
1256 | 1256 | <label> |
1257 | 1257 | <?php $site_title = __($site_title, 'geodirectory'); |
1258 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
1258 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
1259 | 1259 | <?php if ($is_required) echo '<span>*</span>';?> |
1260 | 1260 | </label> |
1261 | 1261 | |
1262 | 1262 | <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;"> |
1263 | 1263 | <?php |
1264 | - global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats; |
|
1264 | + global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats; |
|
1265 | 1265 | |
1266 | - $exclude_cats = array(); |
|
1266 | + $exclude_cats = array(); |
|
1267 | 1267 | |
1268 | - if ($is_admin == '1') { |
|
1268 | + if ($is_admin == '1') { |
|
1269 | 1269 | |
1270 | - $post_type = get_post_type(); |
|
1270 | + $post_type = get_post_type(); |
|
1271 | 1271 | |
1272 | - $package_info = array(); |
|
1272 | + $package_info = array(); |
|
1273 | 1273 | |
1274 | - $package_info = (array)geodir_post_package_info($package_info, $post, $post_type); |
|
1274 | + $package_info = (array)geodir_post_package_info($package_info, $post, $post_type); |
|
1275 | 1275 | |
1276 | - if (!empty($package_info)) { |
|
1276 | + if (!empty($package_info)) { |
|
1277 | 1277 | |
1278 | - if (isset($package_info['cat']) && $package_info['cat'] != '') { |
|
1278 | + if (isset($package_info['cat']) && $package_info['cat'] != '') { |
|
1279 | 1279 | |
1280 | - $exclude_cats = explode(',', $package_info['cat']); |
|
1280 | + $exclude_cats = explode(',', $package_info['cat']); |
|
1281 | 1281 | |
1282 | - } |
|
1283 | - } |
|
1284 | - } |
|
1282 | + } |
|
1283 | + } |
|
1284 | + } |
|
1285 | 1285 | |
1286 | - $cat_display = unserialize($cf['extra_fields']); |
|
1286 | + $cat_display = unserialize($cf['extra_fields']); |
|
1287 | 1287 | |
1288 | - if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) { |
|
1288 | + if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) { |
|
1289 | 1289 | |
1290 | - $post_cat = implode(",", $post_cat[$name]); |
|
1290 | + $post_cat = implode(",", $post_cat[$name]); |
|
1291 | 1291 | |
1292 | - } else { |
|
1293 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
1294 | - $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
1295 | - } |
|
1292 | + } else { |
|
1293 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
1294 | + $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
1295 | + } |
|
1296 | 1296 | |
1297 | 1297 | |
1298 | - global $geodir_addon_list; |
|
1299 | - if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') { |
|
1298 | + global $geodir_addon_list; |
|
1299 | + if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') { |
|
1300 | 1300 | |
1301 | - $catadd_limit = $wpdb->get_var( |
|
1302 | - $wpdb->prepare( |
|
1303 | - "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d", |
|
1304 | - array($package_id) |
|
1305 | - ) |
|
1306 | - ); |
|
1301 | + $catadd_limit = $wpdb->get_var( |
|
1302 | + $wpdb->prepare( |
|
1303 | + "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d", |
|
1304 | + array($package_id) |
|
1305 | + ) |
|
1306 | + ); |
|
1307 | 1307 | |
1308 | 1308 | |
1309 | - } else { |
|
1310 | - $catadd_limit = 0; |
|
1311 | - } |
|
1309 | + } else { |
|
1310 | + $catadd_limit = 0; |
|
1311 | + } |
|
1312 | 1312 | |
1313 | 1313 | |
1314 | - if ($cat_display != '' && $cat_display != 'ajax_chained') { |
|
1314 | + if ($cat_display != '' && $cat_display != 'ajax_chained') { |
|
1315 | 1315 | |
1316 | - $required_limit_msg = ''; |
|
1317 | - if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') { |
|
1316 | + $required_limit_msg = ''; |
|
1317 | + if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') { |
|
1318 | 1318 | |
1319 | - $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory'); |
|
1319 | + $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory'); |
|
1320 | 1320 | |
1321 | - } else { |
|
1322 | - $required_limit_msg = $required_msg; |
|
1323 | - } |
|
1321 | + } else { |
|
1322 | + $required_limit_msg = $required_msg; |
|
1323 | + } |
|
1324 | 1324 | |
1325 | - echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />'; |
|
1325 | + echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />'; |
|
1326 | 1326 | |
1327 | 1327 | |
1328 | - if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
1328 | + if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
1329 | 1329 | |
1330 | - $cat_display == ''; |
|
1331 | - $multiple = ''; |
|
1332 | - if ($cat_display == 'multiselect') |
|
1333 | - $multiple = 'multiple="multiple"'; |
|
1330 | + $cat_display == ''; |
|
1331 | + $multiple = ''; |
|
1332 | + if ($cat_display == 'multiselect') |
|
1333 | + $multiple = 'multiple="multiple"'; |
|
1334 | 1334 | |
1335 | - echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">'; |
|
1335 | + echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">'; |
|
1336 | 1336 | |
1337 | 1337 | |
1338 | - if ($cat_display == 'select') |
|
1339 | - echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; |
|
1338 | + if ($cat_display == 'select') |
|
1339 | + echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; |
|
1340 | 1340 | |
1341 | - } |
|
1341 | + } |
|
1342 | 1342 | |
1343 | - echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0); |
|
1343 | + echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0); |
|
1344 | 1344 | |
1345 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
1346 | - echo '</select>'; |
|
1345 | + if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
1346 | + echo '</select>'; |
|
1347 | 1347 | |
1348 | - } else { |
|
1348 | + } else { |
|
1349 | 1349 | |
1350 | - echo geodir_custom_taxonomy_walker2($name, $catadd_limit); |
|
1350 | + echo geodir_custom_taxonomy_walker2($name, $catadd_limit); |
|
1351 | 1351 | |
1352 | - } |
|
1352 | + } |
|
1353 | 1353 | |
1354 | - ?> |
|
1354 | + ?> |
|
1355 | 1355 | </div> |
1356 | 1356 | |
1357 | 1357 | <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
@@ -1361,10 +1361,10 @@ discard block |
||
1361 | 1361 | </div> |
1362 | 1362 | |
1363 | 1363 | <?php |
1364 | - $html = ob_get_clean(); |
|
1365 | - } |
|
1364 | + $html = ob_get_clean(); |
|
1365 | + } |
|
1366 | 1366 | |
1367 | - return $html; |
|
1367 | + return $html; |
|
1368 | 1368 | } |
1369 | 1369 | add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2); |
1370 | 1370 | |
@@ -1380,74 +1380,74 @@ discard block |
||
1380 | 1380 | */ |
1381 | 1381 | function geodir_cfi_file($html,$cf){ |
1382 | 1382 | |
1383 | - $html_var = $cf['htmlvar_name']; |
|
1383 | + $html_var = $cf['htmlvar_name']; |
|
1384 | 1384 | |
1385 | - // Check if there is a custom field specific filter. |
|
1386 | - if(has_filter("geodir_custom_field_input_file_{$html_var}")){ |
|
1387 | - /** |
|
1388 | - * Filter the file html by individual custom field. |
|
1389 | - * |
|
1390 | - * @param string $html The html to filter. |
|
1391 | - * @param array $cf The custom field array. |
|
1392 | - * @since 1.6.6 |
|
1393 | - */ |
|
1394 | - $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf); |
|
1395 | - } |
|
1385 | + // Check if there is a custom field specific filter. |
|
1386 | + if(has_filter("geodir_custom_field_input_file_{$html_var}")){ |
|
1387 | + /** |
|
1388 | + * Filter the file html by individual custom field. |
|
1389 | + * |
|
1390 | + * @param string $html The html to filter. |
|
1391 | + * @param array $cf The custom field array. |
|
1392 | + * @since 1.6.6 |
|
1393 | + */ |
|
1394 | + $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf); |
|
1395 | + } |
|
1396 | 1396 | |
1397 | - // If no html then we run the standard output. |
|
1398 | - if(empty($html)) { |
|
1397 | + // If no html then we run the standard output. |
|
1398 | + if(empty($html)) { |
|
1399 | 1399 | |
1400 | - ob_start(); // Start buffering; |
|
1401 | - $value = geodir_get_cf_value($cf); |
|
1400 | + ob_start(); // Start buffering; |
|
1401 | + $value = geodir_get_cf_value($cf); |
|
1402 | 1402 | |
1403 | - $name = $cf['name']; |
|
1404 | - $site_title = $cf['site_title']; |
|
1405 | - $admin_desc = $cf['desc']; |
|
1406 | - $is_required = $cf['is_required']; |
|
1407 | - $required_msg = $cf['required_msg']; |
|
1408 | - $extra_fields = unserialize($cf['extra_fields']); |
|
1403 | + $name = $cf['name']; |
|
1404 | + $site_title = $cf['site_title']; |
|
1405 | + $admin_desc = $cf['desc']; |
|
1406 | + $is_required = $cf['is_required']; |
|
1407 | + $required_msg = $cf['required_msg']; |
|
1408 | + $extra_fields = unserialize($cf['extra_fields']); |
|
1409 | 1409 | |
1410 | 1410 | |
1411 | - // adjust values here |
|
1412 | - $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls |
|
1411 | + // adjust values here |
|
1412 | + $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls |
|
1413 | 1413 | |
1414 | - if ($value != '') { |
|
1414 | + if ($value != '') { |
|
1415 | 1415 | |
1416 | - $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls. |
|
1416 | + $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls. |
|
1417 | 1417 | |
1418 | - } else |
|
1419 | - $file_value = ''; |
|
1418 | + } else |
|
1419 | + $file_value = ''; |
|
1420 | 1420 | |
1421 | - if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) |
|
1422 | - $file_multiple = true; // allow multiple files upload |
|
1423 | - else |
|
1424 | - $file_multiple = false; |
|
1421 | + if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) |
|
1422 | + $file_multiple = true; // allow multiple files upload |
|
1423 | + else |
|
1424 | + $file_multiple = false; |
|
1425 | 1425 | |
1426 | - if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) |
|
1427 | - $file_image_limit = $extra_fields['image_limit']; |
|
1428 | - else |
|
1429 | - $file_image_limit = 1; |
|
1426 | + if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) |
|
1427 | + $file_image_limit = $extra_fields['image_limit']; |
|
1428 | + else |
|
1429 | + $file_image_limit = 1; |
|
1430 | 1430 | |
1431 | - $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
1431 | + $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
1432 | 1432 | |
1433 | - $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
1433 | + $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
1434 | 1434 | |
1435 | - if (!empty($file_value)) { |
|
1436 | - $curImages = explode(',', $file_value); |
|
1437 | - if (!empty($curImages)) |
|
1438 | - $file_totImg = count($curImages); |
|
1439 | - } |
|
1435 | + if (!empty($file_value)) { |
|
1436 | + $curImages = explode(',', $file_value); |
|
1437 | + if (!empty($curImages)) |
|
1438 | + $file_totImg = count($curImages); |
|
1439 | + } |
|
1440 | 1440 | |
1441 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : ''; |
|
1442 | - $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : ''; |
|
1441 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : ''; |
|
1442 | + $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : ''; |
|
1443 | 1443 | |
1444 | - ?> |
|
1444 | + ?> |
|
1445 | 1445 | <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?> |
1446 | 1446 | <?php if($file_image_limit!=0 && $file_image_limit==1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('image with this package').')</small>';} ?> |
1447 | 1447 | <?php if($file_image_limit!=0 && $file_image_limit>1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('images with this package').')</small>';} ?> |
1448 | 1448 | <?php if($file_image_limit==0){echo '<br /><small>('.__('You can upload unlimited images with this package').')</small>';} ?> |
1449 | 1449 | </h5> <?php */ |
1450 | - ?> |
|
1450 | + ?> |
|
1451 | 1451 | |
1452 | 1452 | <div id="<?php echo $name;?>_row" |
1453 | 1453 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
@@ -1455,7 +1455,7 @@ discard block |
||
1455 | 1455 | <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;"> |
1456 | 1456 | <label |
1457 | 1457 | style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory'); |
1458 | - echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label> |
|
1458 | + echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label> |
|
1459 | 1459 | <input class="geodir-custom-file-upload" field_type="file" type="hidden" |
1460 | 1460 | name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>" |
1461 | 1461 | value="<?php echo esc_attr($file_value); ?>"/> |
@@ -1467,17 +1467,17 @@ discard block |
||
1467 | 1467 | <?php } ?> |
1468 | 1468 | <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg" |
1469 | 1469 | value="<?php if (isset($file_totImg)) { |
1470 | - echo esc_attr($file_totImg); |
|
1471 | - } else { |
|
1472 | - echo '0'; |
|
1473 | - } ?>"/> |
|
1470 | + echo esc_attr($file_totImg); |
|
1471 | + } else { |
|
1472 | + echo '0'; |
|
1473 | + } ?>"/> |
|
1474 | 1474 | |
1475 | 1475 | <div style="float:left; width:55%;"> |
1476 | 1476 | <div |
1477 | 1477 | class="plupload-upload-uic hide-if-no-js <?php if ($file_multiple): ?>plupload-upload-uic-multiple<?php endif; ?>" |
1478 | 1478 | id="<?php echo $file_id; ?>plupload-upload-ui" style="float:left; width:30%;"> |
1479 | 1479 | <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */ |
1480 | - ?> |
|
1480 | + ?> |
|
1481 | 1481 | <input id="<?php echo $file_id; ?>plupload-browse-button" type="button" |
1482 | 1482 | value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>" |
1483 | 1483 | class="geodir_button" style="margin-top:10px;"/> |
@@ -1496,7 +1496,7 @@ discard block |
||
1496 | 1496 | style=" clear:inherit; margin-top:0; margin-left:15px; padding-top:10px; float:left; width:50%;"> |
1497 | 1497 | </div> |
1498 | 1498 | <?php /*?><span id="upload-msg" ><?php _e('Please drag & drop the images to rearrange the order');?></span><?php */ |
1499 | - ?> |
|
1499 | + ?> |
|
1500 | 1500 | |
1501 | 1501 | <span id="<?php echo $file_id; ?>upload-error" style="display:none"></span> |
1502 | 1502 | |
@@ -1510,9 +1510,9 @@ discard block |
||
1510 | 1510 | |
1511 | 1511 | |
1512 | 1512 | <?php |
1513 | - $html = ob_get_clean(); |
|
1514 | - } |
|
1513 | + $html = ob_get_clean(); |
|
1514 | + } |
|
1515 | 1515 | |
1516 | - return $html; |
|
1516 | + return $html; |
|
1517 | 1517 | } |
1518 | 1518 | add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2); |
1519 | 1519 | \ No newline at end of file |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | * @return int|null Return the page ID if present or null if not. |
15 | 15 | */ |
16 | 16 | function geodir_add_listing_page_id(){ |
17 | - $gd_page_id = get_option('geodir_add_listing_page'); |
|
17 | + $gd_page_id = get_option('geodir_add_listing_page'); |
|
18 | 18 | |
19 | - if (function_exists('icl_object_id')) { |
|
20 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
21 | - } |
|
19 | + if (function_exists('icl_object_id')) { |
|
20 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
21 | + } |
|
22 | 22 | |
23 | - return $gd_page_id; |
|
23 | + return $gd_page_id; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | * @return int|null Return the page ID if present or null if not. |
32 | 32 | */ |
33 | 33 | function geodir_preview_page_id(){ |
34 | - $gd_page_id = get_option('geodir_preview_page'); |
|
34 | + $gd_page_id = get_option('geodir_preview_page'); |
|
35 | 35 | |
36 | - if (function_exists('icl_object_id')) { |
|
37 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
38 | - } |
|
36 | + if (function_exists('icl_object_id')) { |
|
37 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
38 | + } |
|
39 | 39 | |
40 | - return $gd_page_id; |
|
40 | + return $gd_page_id; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | * @return int|null Return the page ID if present or null if not. |
49 | 49 | */ |
50 | 50 | function geodir_success_page_id(){ |
51 | - $gd_page_id = get_option('geodir_success_page'); |
|
51 | + $gd_page_id = get_option('geodir_success_page'); |
|
52 | 52 | |
53 | - if (function_exists('icl_object_id')) { |
|
54 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
55 | - } |
|
53 | + if (function_exists('icl_object_id')) { |
|
54 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
55 | + } |
|
56 | 56 | |
57 | - return $gd_page_id; |
|
57 | + return $gd_page_id; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | * @return int|null Return the page ID if present or null if not. |
66 | 66 | */ |
67 | 67 | function geodir_location_page_id(){ |
68 | - $gd_page_id = get_option('geodir_location_page'); |
|
68 | + $gd_page_id = get_option('geodir_location_page'); |
|
69 | 69 | |
70 | - if (function_exists('icl_object_id')) { |
|
71 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
72 | - } |
|
70 | + if (function_exists('icl_object_id')) { |
|
71 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
72 | + } |
|
73 | 73 | |
74 | - return $gd_page_id; |
|
74 | + return $gd_page_id; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | * @return int|null Return the page ID if present or null if not. |
83 | 83 | */ |
84 | 84 | function geodir_home_page_id(){ |
85 | - $gd_page_id = get_option('geodir_home_page'); |
|
85 | + $gd_page_id = get_option('geodir_home_page'); |
|
86 | 86 | |
87 | - if (function_exists('icl_object_id')) { |
|
88 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
89 | - } |
|
87 | + if (function_exists('icl_object_id')) { |
|
88 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
89 | + } |
|
90 | 90 | |
91 | - return $gd_page_id; |
|
91 | + return $gd_page_id; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | * @return int|null Return the page ID if present or null if not. |
100 | 100 | */ |
101 | 101 | function geodir_info_page_id(){ |
102 | - $gd_page_id = get_option('geodir_info_page'); |
|
102 | + $gd_page_id = get_option('geodir_info_page'); |
|
103 | 103 | |
104 | - if (function_exists('icl_object_id')) { |
|
105 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
106 | - } |
|
104 | + if (function_exists('icl_object_id')) { |
|
105 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
106 | + } |
|
107 | 107 | |
108 | - return $gd_page_id; |
|
108 | + return $gd_page_id; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -116,13 +116,13 @@ discard block |
||
116 | 116 | * @return int|null Return the page ID if present or null if not. |
117 | 117 | */ |
118 | 118 | function geodir_login_page_id(){ |
119 | - $gd_page_id = get_option('geodir_login_page'); |
|
119 | + $gd_page_id = get_option('geodir_login_page'); |
|
120 | 120 | |
121 | - if (function_exists('icl_object_id')) { |
|
122 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
123 | - } |
|
121 | + if (function_exists('icl_object_id')) { |
|
122 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
123 | + } |
|
124 | 124 | |
125 | - return $gd_page_id; |
|
125 | + return $gd_page_id; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -134,51 +134,51 @@ discard block |
||
134 | 134 | * @return int|null Return the page ID if present or null if not. |
135 | 135 | */ |
136 | 136 | function geodir_login_url($args=array()){ |
137 | - $gd_page_id = get_option('geodir_login_page'); |
|
138 | - |
|
139 | - if (function_exists('icl_object_id')) { |
|
140 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
141 | - } |
|
142 | - |
|
143 | - if (function_exists('geodir_location_geo_home_link')) { |
|
144 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
145 | - } |
|
146 | - |
|
147 | - if (geodir_is_wpml()){ |
|
148 | - $home_url = icl_get_home_url(); |
|
149 | - }else{ |
|
150 | - $home_url = home_url(); |
|
151 | - } |
|
152 | - |
|
153 | - if (function_exists('geodir_location_geo_home_link')) { |
|
154 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
155 | - } |
|
156 | - |
|
157 | - if($gd_page_id){ |
|
158 | - $post = get_post($gd_page_id); |
|
159 | - $slug = $post->post_name; |
|
160 | - //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
161 | - $login_url = trailingslashit($home_url)."$slug/"; |
|
162 | - }else{ |
|
163 | - $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
|
164 | - } |
|
165 | - |
|
166 | - if($args){ |
|
167 | - $login_url = add_query_arg($args,$login_url ); |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * Filter the GeoDirectory login page url. |
|
172 | - * |
|
173 | - * This filter can be used to change the GeoDirectory page url. |
|
174 | - * |
|
175 | - * @since 1.5.3 |
|
176 | - * @package GeoDirectory |
|
177 | - * @param string $login_url The url of the login page. |
|
178 | - * @param array $args The array of query args used. |
|
179 | - * @param int $gd_page_id The page id of the GD login page. |
|
180 | - */ |
|
181 | - return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
137 | + $gd_page_id = get_option('geodir_login_page'); |
|
138 | + |
|
139 | + if (function_exists('icl_object_id')) { |
|
140 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
141 | + } |
|
142 | + |
|
143 | + if (function_exists('geodir_location_geo_home_link')) { |
|
144 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
145 | + } |
|
146 | + |
|
147 | + if (geodir_is_wpml()){ |
|
148 | + $home_url = icl_get_home_url(); |
|
149 | + }else{ |
|
150 | + $home_url = home_url(); |
|
151 | + } |
|
152 | + |
|
153 | + if (function_exists('geodir_location_geo_home_link')) { |
|
154 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
155 | + } |
|
156 | + |
|
157 | + if($gd_page_id){ |
|
158 | + $post = get_post($gd_page_id); |
|
159 | + $slug = $post->post_name; |
|
160 | + //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
161 | + $login_url = trailingslashit($home_url)."$slug/"; |
|
162 | + }else{ |
|
163 | + $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
|
164 | + } |
|
165 | + |
|
166 | + if($args){ |
|
167 | + $login_url = add_query_arg($args,$login_url ); |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * Filter the GeoDirectory login page url. |
|
172 | + * |
|
173 | + * This filter can be used to change the GeoDirectory page url. |
|
174 | + * |
|
175 | + * @since 1.5.3 |
|
176 | + * @package GeoDirectory |
|
177 | + * @param string $login_url The url of the login page. |
|
178 | + * @param array $args The array of query args used. |
|
179 | + * @param int $gd_page_id The page id of the GD login page. |
|
180 | + */ |
|
181 | + return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -190,40 +190,40 @@ discard block |
||
190 | 190 | * @return string Info page url. |
191 | 191 | */ |
192 | 192 | function geodir_info_url($args=array()){ |
193 | - $gd_page_id = get_option('geodir_info_page'); |
|
194 | - |
|
195 | - if (function_exists('icl_object_id')) { |
|
196 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
197 | - } |
|
198 | - |
|
199 | - if (function_exists('geodir_location_geo_home_link')) { |
|
200 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
201 | - } |
|
202 | - |
|
203 | - if (geodir_is_wpml()){ |
|
204 | - $home_url = icl_get_home_url(); |
|
205 | - }else{ |
|
206 | - $home_url = home_url(); |
|
207 | - } |
|
208 | - |
|
209 | - if (function_exists('geodir_location_geo_home_link')) { |
|
210 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
211 | - } |
|
212 | - |
|
213 | - if($gd_page_id){ |
|
214 | - $post = get_post($gd_page_id); |
|
215 | - $slug = $post->post_name; |
|
216 | - //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
217 | - $info_url = trailingslashit($home_url)."$slug/"; |
|
218 | - }else{ |
|
219 | - $info_url = trailingslashit($home_url); |
|
220 | - } |
|
221 | - |
|
222 | - if($args){ |
|
223 | - $info_url = add_query_arg($args,$info_url ); |
|
224 | - } |
|
225 | - |
|
226 | - return $info_url; |
|
193 | + $gd_page_id = get_option('geodir_info_page'); |
|
194 | + |
|
195 | + if (function_exists('icl_object_id')) { |
|
196 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
197 | + } |
|
198 | + |
|
199 | + if (function_exists('geodir_location_geo_home_link')) { |
|
200 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
201 | + } |
|
202 | + |
|
203 | + if (geodir_is_wpml()){ |
|
204 | + $home_url = icl_get_home_url(); |
|
205 | + }else{ |
|
206 | + $home_url = home_url(); |
|
207 | + } |
|
208 | + |
|
209 | + if (function_exists('geodir_location_geo_home_link')) { |
|
210 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
211 | + } |
|
212 | + |
|
213 | + if($gd_page_id){ |
|
214 | + $post = get_post($gd_page_id); |
|
215 | + $slug = $post->post_name; |
|
216 | + //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
217 | + $info_url = trailingslashit($home_url)."$slug/"; |
|
218 | + }else{ |
|
219 | + $info_url = trailingslashit($home_url); |
|
220 | + } |
|
221 | + |
|
222 | + if($args){ |
|
223 | + $info_url = add_query_arg($args,$info_url ); |
|
224 | + } |
|
225 | + |
|
226 | + return $info_url; |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | * @return string Returns converted string. |
240 | 240 | */ |
241 | 241 | function geodir_ucwords($string, $charset='UTF-8') { |
242 | - if (function_exists('mb_convert_case')) { |
|
243 | - return mb_convert_case($string, MB_CASE_TITLE, $charset); |
|
244 | - } else { |
|
245 | - return ucwords($string); |
|
246 | - } |
|
242 | + if (function_exists('mb_convert_case')) { |
|
243 | + return mb_convert_case($string, MB_CASE_TITLE, $charset); |
|
244 | + } else { |
|
245 | + return ucwords($string); |
|
246 | + } |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | * @return string Returns converted string. |
260 | 260 | */ |
261 | 261 | function geodir_strtolower($string, $charset='UTF-8') { |
262 | - if (function_exists('mb_convert_case')) { |
|
263 | - return mb_convert_case($string, MB_CASE_LOWER, $charset); |
|
264 | - } else { |
|
265 | - return strtolower($string); |
|
266 | - } |
|
262 | + if (function_exists('mb_convert_case')) { |
|
263 | + return mb_convert_case($string, MB_CASE_LOWER, $charset); |
|
264 | + } else { |
|
265 | + return strtolower($string); |
|
266 | + } |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -279,11 +279,11 @@ discard block |
||
279 | 279 | * @return string Returns converted string. |
280 | 280 | */ |
281 | 281 | function geodir_strtoupper($string, $charset='UTF-8') { |
282 | - if (function_exists('mb_convert_case')) { |
|
283 | - return mb_convert_case($string, MB_CASE_UPPER, $charset); |
|
284 | - } else { |
|
285 | - return strtoupper($string); |
|
286 | - } |
|
282 | + if (function_exists('mb_convert_case')) { |
|
283 | + return mb_convert_case($string, MB_CASE_UPPER, $charset); |
|
284 | + } else { |
|
285 | + return strtoupper($string); |
|
286 | + } |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | /** |
@@ -462,11 +462,11 @@ discard block |
||
462 | 462 | * @package GeoDirectory |
463 | 463 | */ |
464 | 464 | function _gd_die_handler() { |
465 | - if ( defined( 'GD_TESTING_MODE' ) ) { |
|
466 | - return '_gd_die_handler'; |
|
467 | - } else { |
|
468 | - die(); |
|
469 | - } |
|
465 | + if ( defined( 'GD_TESTING_MODE' ) ) { |
|
466 | + return '_gd_die_handler'; |
|
467 | + } else { |
|
468 | + die(); |
|
469 | + } |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | /** |
@@ -481,9 +481,9 @@ discard block |
||
481 | 481 | * @param int $status Optional. Status code. |
482 | 482 | */ |
483 | 483 | function gd_die( $message = '', $title = '', $status = 400 ) { |
484 | - add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
485 | - add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
486 | - wp_die( $message, $title, array( 'response' => $status )); |
|
484 | + add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
485 | + add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
486 | + wp_die( $message, $title, array( 'response' => $status )); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | /* |
@@ -652,37 +652,37 @@ discard block |
||
652 | 652 | * @return string The formatted date. |
653 | 653 | */ |
654 | 654 | function geodir_date($date_input, $date_to, $date_from = '') { |
655 | - if (empty($date_input) || empty($date_to)) { |
|
656 | - return NULL; |
|
657 | - } |
|
655 | + if (empty($date_input) || empty($date_to)) { |
|
656 | + return NULL; |
|
657 | + } |
|
658 | 658 | |
659 | - $date = ''; |
|
660 | - if (!empty($date_from)) { |
|
661 | - $datetime = date_create_from_format($date_from, $date_input); |
|
659 | + $date = ''; |
|
660 | + if (!empty($date_from)) { |
|
661 | + $datetime = date_create_from_format($date_from, $date_input); |
|
662 | 662 | |
663 | - if (!empty($datetime)) { |
|
664 | - $date = $datetime->format($date_to); |
|
665 | - } |
|
666 | - } |
|
663 | + if (!empty($datetime)) { |
|
664 | + $date = $datetime->format($date_to); |
|
665 | + } |
|
666 | + } |
|
667 | 667 | |
668 | - if (empty($date)) { |
|
669 | - $date = strpos($date_input, '/') !== false ? str_replace('/', '-', $date_input) : $date_input; |
|
670 | - $date = date_i18n($date_to, strtotime($date)); |
|
671 | - } |
|
668 | + if (empty($date)) { |
|
669 | + $date = strpos($date_input, '/') !== false ? str_replace('/', '-', $date_input) : $date_input; |
|
670 | + $date = date_i18n($date_to, strtotime($date)); |
|
671 | + } |
|
672 | 672 | |
673 | - $date = geodir_maybe_untranslate_date($date); |
|
674 | - /** |
|
675 | - * Filter the the date format conversion. |
|
676 | - * |
|
677 | - * @since 1.6.7 |
|
678 | - * @package GeoDirectory |
|
679 | - * |
|
680 | - * @param string $date The date string. |
|
681 | - * @param string $date_input The date input. |
|
682 | - * @param string $date_to The destination date format. |
|
683 | - * @param string $date_from The source date format. |
|
684 | - */ |
|
685 | - return apply_filters('geodir_date', $date, $date_input, $date_to, $date_from); |
|
673 | + $date = geodir_maybe_untranslate_date($date); |
|
674 | + /** |
|
675 | + * Filter the the date format conversion. |
|
676 | + * |
|
677 | + * @since 1.6.7 |
|
678 | + * @package GeoDirectory |
|
679 | + * |
|
680 | + * @param string $date The date string. |
|
681 | + * @param string $date_input The date input. |
|
682 | + * @param string $date_to The destination date format. |
|
683 | + * @param string $date_from The source date format. |
|
684 | + */ |
|
685 | + return apply_filters('geodir_date', $date, $date_input, $date_to, $date_from); |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | /** |
@@ -707,91 +707,91 @@ discard block |
||
707 | 707 | * @return string Trimmed string. |
708 | 708 | */ |
709 | 709 | function geodir_excerpt($text, $length = 100, $options = array()) { |
710 | - if (!(int)$length > 0) { |
|
711 | - return $text; |
|
712 | - } |
|
713 | - $default = array( |
|
714 | - 'ellipsis' => '', 'exact' => true, 'html' => true, 'trimWidth' => false, |
|
710 | + if (!(int)$length > 0) { |
|
711 | + return $text; |
|
712 | + } |
|
713 | + $default = array( |
|
714 | + 'ellipsis' => '', 'exact' => true, 'html' => true, 'trimWidth' => false, |
|
715 | 715 | ); |
716 | - if (!empty($options['html']) && strtolower(mb_internal_encoding()) === 'utf-8') { |
|
717 | - $default['ellipsis'] = ""; |
|
718 | - } |
|
719 | - $options += $default; |
|
720 | - |
|
721 | - $prefix = ''; |
|
722 | - $suffix = $options['ellipsis']; |
|
723 | - |
|
724 | - if ($options['html']) { |
|
725 | - $ellipsisLength = geodir_strlen(strip_tags($options['ellipsis']), $options); |
|
726 | - |
|
727 | - $truncateLength = 0; |
|
728 | - $totalLength = 0; |
|
729 | - $openTags = array(); |
|
730 | - $truncate = ''; |
|
731 | - |
|
732 | - preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER); |
|
733 | - foreach ($tags as $tag) { |
|
734 | - $contentLength = geodir_strlen($tag[3], $options); |
|
735 | - |
|
736 | - if ($truncate === '') { |
|
737 | - if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) { |
|
738 | - if (preg_match('/<[\w]+[^>]*>/', $tag[0])) { |
|
739 | - array_unshift($openTags, $tag[2]); |
|
740 | - } elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) { |
|
741 | - $pos = array_search($closeTag[1], $openTags); |
|
742 | - if ($pos !== false) { |
|
743 | - array_splice($openTags, $pos, 1); |
|
744 | - } |
|
745 | - } |
|
746 | - } |
|
747 | - |
|
748 | - $prefix .= $tag[1]; |
|
749 | - |
|
750 | - if ($totalLength + $contentLength + $ellipsisLength > $length) { |
|
751 | - $truncate = $tag[3]; |
|
752 | - $truncateLength = $length - $totalLength; |
|
753 | - } else { |
|
754 | - $prefix .= $tag[3]; |
|
755 | - } |
|
756 | - } |
|
757 | - |
|
758 | - $totalLength += $contentLength; |
|
759 | - if ($totalLength > $length) { |
|
760 | - break; |
|
761 | - } |
|
762 | - } |
|
763 | - |
|
764 | - if ($totalLength <= $length) { |
|
765 | - return $text; |
|
766 | - } |
|
767 | - |
|
768 | - $text = $truncate; |
|
769 | - $length = $truncateLength; |
|
770 | - |
|
771 | - foreach ($openTags as $tag) { |
|
772 | - $suffix .= '</' . $tag . '>'; |
|
773 | - } |
|
774 | - } else { |
|
775 | - if (geodir_strlen($text, $options) <= $length) { |
|
776 | - return $text; |
|
777 | - } |
|
778 | - $ellipsisLength = geodir_strlen($options['ellipsis'], $options); |
|
779 | - } |
|
780 | - |
|
781 | - $result = geodir_substr($text, 0, $length - $ellipsisLength, $options); |
|
782 | - |
|
783 | - if (!$options['exact']) { |
|
784 | - if (geodir_substr($text, $length - $ellipsisLength, 1, $options) !== ' ') { |
|
785 | - $result = geodir_remove_last_word($result); |
|
786 | - } |
|
787 | - |
|
788 | - // Do not need to count ellipsis in the cut, if result is empty. |
|
789 | - if (!strlen($result)) { |
|
790 | - $result = geodir_substr($text, 0, $length, $options); |
|
791 | - } |
|
792 | - } |
|
793 | - |
|
794 | - return $prefix . $result . $suffix; |
|
716 | + if (!empty($options['html']) && strtolower(mb_internal_encoding()) === 'utf-8') { |
|
717 | + $default['ellipsis'] = ""; |
|
718 | + } |
|
719 | + $options += $default; |
|
720 | + |
|
721 | + $prefix = ''; |
|
722 | + $suffix = $options['ellipsis']; |
|
723 | + |
|
724 | + if ($options['html']) { |
|
725 | + $ellipsisLength = geodir_strlen(strip_tags($options['ellipsis']), $options); |
|
726 | + |
|
727 | + $truncateLength = 0; |
|
728 | + $totalLength = 0; |
|
729 | + $openTags = array(); |
|
730 | + $truncate = ''; |
|
731 | + |
|
732 | + preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER); |
|
733 | + foreach ($tags as $tag) { |
|
734 | + $contentLength = geodir_strlen($tag[3], $options); |
|
735 | + |
|
736 | + if ($truncate === '') { |
|
737 | + if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) { |
|
738 | + if (preg_match('/<[\w]+[^>]*>/', $tag[0])) { |
|
739 | + array_unshift($openTags, $tag[2]); |
|
740 | + } elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) { |
|
741 | + $pos = array_search($closeTag[1], $openTags); |
|
742 | + if ($pos !== false) { |
|
743 | + array_splice($openTags, $pos, 1); |
|
744 | + } |
|
745 | + } |
|
746 | + } |
|
747 | + |
|
748 | + $prefix .= $tag[1]; |
|
749 | + |
|
750 | + if ($totalLength + $contentLength + $ellipsisLength > $length) { |
|
751 | + $truncate = $tag[3]; |
|
752 | + $truncateLength = $length - $totalLength; |
|
753 | + } else { |
|
754 | + $prefix .= $tag[3]; |
|
755 | + } |
|
756 | + } |
|
757 | + |
|
758 | + $totalLength += $contentLength; |
|
759 | + if ($totalLength > $length) { |
|
760 | + break; |
|
761 | + } |
|
762 | + } |
|
763 | + |
|
764 | + if ($totalLength <= $length) { |
|
765 | + return $text; |
|
766 | + } |
|
767 | + |
|
768 | + $text = $truncate; |
|
769 | + $length = $truncateLength; |
|
770 | + |
|
771 | + foreach ($openTags as $tag) { |
|
772 | + $suffix .= '</' . $tag . '>'; |
|
773 | + } |
|
774 | + } else { |
|
775 | + if (geodir_strlen($text, $options) <= $length) { |
|
776 | + return $text; |
|
777 | + } |
|
778 | + $ellipsisLength = geodir_strlen($options['ellipsis'], $options); |
|
779 | + } |
|
780 | + |
|
781 | + $result = geodir_substr($text, 0, $length - $ellipsisLength, $options); |
|
782 | + |
|
783 | + if (!$options['exact']) { |
|
784 | + if (geodir_substr($text, $length - $ellipsisLength, 1, $options) !== ' ') { |
|
785 | + $result = geodir_remove_last_word($result); |
|
786 | + } |
|
787 | + |
|
788 | + // Do not need to count ellipsis in the cut, if result is empty. |
|
789 | + if (!strlen($result)) { |
|
790 | + $result = geodir_substr($text, 0, $length, $options); |
|
791 | + } |
|
792 | + } |
|
793 | + |
|
794 | + return $prefix . $result . $suffix; |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | /** |
@@ -815,28 +815,28 @@ discard block |
||
815 | 815 | * @return int |
816 | 816 | */ |
817 | 817 | function geodir_strlen($text, array $options) { |
818 | - if (empty($options['trimWidth'])) { |
|
819 | - $strlen = 'mb_strlen'; |
|
820 | - } else { |
|
821 | - $strlen = 'mb_strwidth'; |
|
822 | - } |
|
823 | - |
|
824 | - if (empty($options['html'])) { |
|
825 | - return $strlen($text); |
|
826 | - } |
|
827 | - |
|
828 | - $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i'; |
|
829 | - $replace = preg_replace_callback( |
|
830 | - $pattern, |
|
831 | - function ($match) use ($strlen) { |
|
832 | - $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8'); |
|
833 | - |
|
834 | - return str_repeat(' ', $strlen($utf8, 'UTF-8')); |
|
835 | - }, |
|
836 | - $text |
|
837 | - ); |
|
838 | - |
|
839 | - return $strlen($replace); |
|
818 | + if (empty($options['trimWidth'])) { |
|
819 | + $strlen = 'mb_strlen'; |
|
820 | + } else { |
|
821 | + $strlen = 'mb_strwidth'; |
|
822 | + } |
|
823 | + |
|
824 | + if (empty($options['html'])) { |
|
825 | + return $strlen($text); |
|
826 | + } |
|
827 | + |
|
828 | + $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i'; |
|
829 | + $replace = preg_replace_callback( |
|
830 | + $pattern, |
|
831 | + function ($match) use ($strlen) { |
|
832 | + $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8'); |
|
833 | + |
|
834 | + return str_repeat(' ', $strlen($utf8, 'UTF-8')); |
|
835 | + }, |
|
836 | + $text |
|
837 | + ); |
|
838 | + |
|
839 | + return $strlen($replace); |
|
840 | 840 | } |
841 | 841 | |
842 | 842 | /** |
@@ -857,80 +857,80 @@ discard block |
||
857 | 857 | * @return string |
858 | 858 | */ |
859 | 859 | function geodir_substr($text, $start, $length, array $options) { |
860 | - if (empty($options['trimWidth'])) { |
|
861 | - $substr = 'mb_substr'; |
|
862 | - } else { |
|
863 | - $substr = 'mb_strimwidth'; |
|
864 | - } |
|
865 | - |
|
866 | - $maxPosition = geodir_strlen($text, array('trimWidth' => false) + $options); |
|
867 | - if ($start < 0) { |
|
868 | - $start += $maxPosition; |
|
869 | - if ($start < 0) { |
|
870 | - $start = 0; |
|
871 | - } |
|
872 | - } |
|
873 | - if ($start >= $maxPosition) { |
|
874 | - return ''; |
|
875 | - } |
|
876 | - |
|
877 | - if ($length === null) { |
|
878 | - $length = geodir_strlen($text, $options); |
|
879 | - } |
|
880 | - |
|
881 | - if ($length < 0) { |
|
882 | - $text = geodir_substr($text, $start, null, $options); |
|
883 | - $start = 0; |
|
884 | - $length += geodir_strlen($text, $options); |
|
885 | - } |
|
886 | - |
|
887 | - if ($length <= 0) { |
|
888 | - return ''; |
|
889 | - } |
|
890 | - |
|
891 | - if (empty($options['html'])) { |
|
892 | - return (string)$substr($text, $start, $length); |
|
893 | - } |
|
894 | - |
|
895 | - $totalOffset = 0; |
|
896 | - $totalLength = 0; |
|
897 | - $result = ''; |
|
898 | - |
|
899 | - $pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i'; |
|
900 | - $parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
901 | - foreach ($parts as $part) { |
|
902 | - $offset = 0; |
|
903 | - |
|
904 | - if ($totalOffset < $start) { |
|
905 | - $len = geodir_strlen($part, array('trimWidth' => false) + $options); |
|
906 | - if ($totalOffset + $len <= $start) { |
|
907 | - $totalOffset += $len; |
|
908 | - continue; |
|
909 | - } |
|
910 | - |
|
911 | - $offset = $start - $totalOffset; |
|
912 | - $totalOffset = $start; |
|
913 | - } |
|
914 | - |
|
915 | - $len = geodir_strlen($part, $options); |
|
916 | - if ($offset !== 0 || $totalLength + $len > $length) { |
|
917 | - if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) { |
|
918 | - // Entities cannot be passed substr. |
|
919 | - continue; |
|
920 | - } |
|
921 | - |
|
922 | - $part = $substr($part, $offset, $length - $totalLength); |
|
923 | - $len = geodir_strlen($part, $options); |
|
924 | - } |
|
925 | - |
|
926 | - $result .= $part; |
|
927 | - $totalLength += $len; |
|
928 | - if ($totalLength >= $length) { |
|
929 | - break; |
|
930 | - } |
|
931 | - } |
|
932 | - |
|
933 | - return $result; |
|
860 | + if (empty($options['trimWidth'])) { |
|
861 | + $substr = 'mb_substr'; |
|
862 | + } else { |
|
863 | + $substr = 'mb_strimwidth'; |
|
864 | + } |
|
865 | + |
|
866 | + $maxPosition = geodir_strlen($text, array('trimWidth' => false) + $options); |
|
867 | + if ($start < 0) { |
|
868 | + $start += $maxPosition; |
|
869 | + if ($start < 0) { |
|
870 | + $start = 0; |
|
871 | + } |
|
872 | + } |
|
873 | + if ($start >= $maxPosition) { |
|
874 | + return ''; |
|
875 | + } |
|
876 | + |
|
877 | + if ($length === null) { |
|
878 | + $length = geodir_strlen($text, $options); |
|
879 | + } |
|
880 | + |
|
881 | + if ($length < 0) { |
|
882 | + $text = geodir_substr($text, $start, null, $options); |
|
883 | + $start = 0; |
|
884 | + $length += geodir_strlen($text, $options); |
|
885 | + } |
|
886 | + |
|
887 | + if ($length <= 0) { |
|
888 | + return ''; |
|
889 | + } |
|
890 | + |
|
891 | + if (empty($options['html'])) { |
|
892 | + return (string)$substr($text, $start, $length); |
|
893 | + } |
|
894 | + |
|
895 | + $totalOffset = 0; |
|
896 | + $totalLength = 0; |
|
897 | + $result = ''; |
|
898 | + |
|
899 | + $pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i'; |
|
900 | + $parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
901 | + foreach ($parts as $part) { |
|
902 | + $offset = 0; |
|
903 | + |
|
904 | + if ($totalOffset < $start) { |
|
905 | + $len = geodir_strlen($part, array('trimWidth' => false) + $options); |
|
906 | + if ($totalOffset + $len <= $start) { |
|
907 | + $totalOffset += $len; |
|
908 | + continue; |
|
909 | + } |
|
910 | + |
|
911 | + $offset = $start - $totalOffset; |
|
912 | + $totalOffset = $start; |
|
913 | + } |
|
914 | + |
|
915 | + $len = geodir_strlen($part, $options); |
|
916 | + if ($offset !== 0 || $totalLength + $len > $length) { |
|
917 | + if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) { |
|
918 | + // Entities cannot be passed substr. |
|
919 | + continue; |
|
920 | + } |
|
921 | + |
|
922 | + $part = $substr($part, $offset, $length - $totalLength); |
|
923 | + $len = geodir_strlen($part, $options); |
|
924 | + } |
|
925 | + |
|
926 | + $result .= $part; |
|
927 | + $totalLength += $len; |
|
928 | + if ($totalLength >= $length) { |
|
929 | + break; |
|
930 | + } |
|
931 | + } |
|
932 | + |
|
933 | + return $result; |
|
934 | 934 | } |
935 | 935 | |
936 | 936 | /** |
@@ -943,21 +943,21 @@ discard block |
||
943 | 943 | * @return string |
944 | 944 | */ |
945 | 945 | function geodir_remove_last_word($text) { |
946 | - $spacepos = mb_strrpos($text, ' '); |
|
946 | + $spacepos = mb_strrpos($text, ' '); |
|
947 | 947 | |
948 | - if ($spacepos !== false) { |
|
949 | - $lastWord = mb_strrpos($text, $spacepos); |
|
948 | + if ($spacepos !== false) { |
|
949 | + $lastWord = mb_strrpos($text, $spacepos); |
|
950 | 950 | |
951 | - // Some languages are written without word separation. |
|
952 | - // We recognize a string as a word if it does not contain any full-width characters. |
|
953 | - if (mb_strwidth($lastWord) === mb_strlen($lastWord)) { |
|
954 | - $text = mb_substr($text, 0, $spacepos); |
|
955 | - } |
|
951 | + // Some languages are written without word separation. |
|
952 | + // We recognize a string as a word if it does not contain any full-width characters. |
|
953 | + if (mb_strwidth($lastWord) === mb_strlen($lastWord)) { |
|
954 | + $text = mb_substr($text, 0, $spacepos); |
|
955 | + } |
|
956 | 956 | |
957 | - return $text; |
|
958 | - } |
|
957 | + return $text; |
|
958 | + } |
|
959 | 959 | |
960 | - return ''; |
|
960 | + return ''; |
|
961 | 961 | } |
962 | 962 | |
963 | 963 | function geodir_tool_restore_cpt_from_taxonomies(){ |
@@ -13,26 +13,26 @@ discard block |
||
13 | 13 | global $wp_query, $current_term, $query; |
14 | 14 | |
15 | 15 | if (function_exists('geodir_location_geo_home_link')) { |
16 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
16 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | if (geodir_is_wpml() && defined('DOING_AJAX') && DOING_AJAX){ |
20 | - $search_url = icl_get_home_url(); |
|
20 | + $search_url = icl_get_home_url(); |
|
21 | 21 | } else { |
22 | - $search_url = get_home_url(); |
|
22 | + $search_url = get_home_url(); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | $search_url = trailingslashit($search_url); |
26 | 26 | |
27 | 27 | if (function_exists('geodir_location_geo_home_link')) { |
28 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
28 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
32 | 32 | $form_class = 'geodir-listing-search'; |
33 | 33 | |
34 | 34 | if($new_style){ |
35 | - $form_class .= ' gd-search-bar-style'; |
|
35 | + $form_class .= ' gd-search-bar-style'; |
|
36 | 36 | } |
37 | 37 | ?> |
38 | 38 | <form class="<?php |
@@ -49,56 +49,56 @@ discard block |
||
49 | 49 | <div class="geodir-loc-bar"> |
50 | 50 | |
51 | 51 | <?php |
52 | - /** |
|
53 | - * Called inside the search form but before any of the fields. |
|
54 | - * |
|
55 | - * @since 1.0.0 |
|
56 | - */ |
|
57 | - do_action('geodir_before_search_form') ?> |
|
52 | + /** |
|
53 | + * Called inside the search form but before any of the fields. |
|
54 | + * |
|
55 | + * @since 1.0.0 |
|
56 | + */ |
|
57 | + do_action('geodir_before_search_form') ?> |
|
58 | 58 | |
59 | 59 | <div class="clearfix geodir-loc-bar-in"> |
60 | 60 | <div class="geodir-search"> |
61 | 61 | |
62 | 62 | <?php |
63 | 63 | |
64 | - /** |
|
65 | - * Adds the input fields to the search form. |
|
66 | - * |
|
67 | - * @since 1.6.9 |
|
68 | - */ |
|
69 | - do_action('geodir_search_form_inputs'); |
|
64 | + /** |
|
65 | + * Adds the input fields to the search form. |
|
66 | + * |
|
67 | + * @since 1.6.9 |
|
68 | + */ |
|
69 | + do_action('geodir_search_form_inputs'); |
|
70 | 70 | |
71 | 71 | |
72 | 72 | |
73 | - /** |
|
74 | - * Called on the GD search form just before the search button. |
|
75 | - * |
|
76 | - * @since 1.0.0 |
|
77 | - */ |
|
78 | - do_action('geodir_before_search_button'); |
|
73 | + /** |
|
74 | + * Called on the GD search form just before the search button. |
|
75 | + * |
|
76 | + * @since 1.0.0 |
|
77 | + */ |
|
78 | + do_action('geodir_before_search_button'); |
|
79 | 79 | |
80 | 80 | |
81 | - /** |
|
82 | - * Called on the GD search form just after the search button. |
|
83 | - * |
|
84 | - * @since 1.0.0 |
|
85 | - */ |
|
86 | - do_action('geodir_after_search_button'); |
|
81 | + /** |
|
82 | + * Called on the GD search form just after the search button. |
|
83 | + * |
|
84 | + * @since 1.0.0 |
|
85 | + */ |
|
86 | + do_action('geodir_after_search_button'); |
|
87 | 87 | |
88 | 88 | |
89 | - ?> |
|
89 | + ?> |
|
90 | 90 | </div> |
91 | 91 | |
92 | 92 | |
93 | 93 | </div> |
94 | 94 | |
95 | 95 | <?php |
96 | - /** |
|
97 | - * Called inside the search form but after all the input fields. |
|
98 | - * |
|
99 | - * @since 1.0.0 |
|
100 | - */ |
|
101 | - do_action('geodir_after_search_form') ?> |
|
96 | + /** |
|
97 | + * Called inside the search form but after all the input fields. |
|
98 | + * |
|
99 | + * @since 1.0.0 |
|
100 | + */ |
|
101 | + do_action('geodir_after_search_form') ?> |
|
102 | 102 | |
103 | 103 | |
104 | 104 | </div> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | // If this file is called directly, abort. |
11 | 11 | if (!defined('WPINC')) { |
12 | - die; |
|
12 | + die; |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | /** |
@@ -22,22 +22,22 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function gdsc_validate_measurements($value) |
24 | 24 | { |
25 | - if ((strlen($value) - 1) == strpos(trim($value), '%')) { |
|
26 | - // $value is entered as a percent, so it can't be less than 0 or more than 100 |
|
27 | - $value = preg_replace('/\D/', '', $value); |
|
28 | - if (100 < $value) { |
|
29 | - $value = 100; |
|
30 | - } |
|
31 | - // Re-add the percent symbol |
|
32 | - $value = $value . '%'; |
|
33 | - } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) { |
|
34 | - // Get the absint & re-add the 'px' |
|
35 | - $value = preg_replace('/\D/', '', $value) . 'px'; |
|
36 | - } else { |
|
37 | - $value = preg_replace('/\D/', '', $value); |
|
38 | - } |
|
25 | + if ((strlen($value) - 1) == strpos(trim($value), '%')) { |
|
26 | + // $value is entered as a percent, so it can't be less than 0 or more than 100 |
|
27 | + $value = preg_replace('/\D/', '', $value); |
|
28 | + if (100 < $value) { |
|
29 | + $value = 100; |
|
30 | + } |
|
31 | + // Re-add the percent symbol |
|
32 | + $value = $value . '%'; |
|
33 | + } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) { |
|
34 | + // Get the absint & re-add the 'px' |
|
35 | + $value = preg_replace('/\D/', '', $value) . 'px'; |
|
36 | + } else { |
|
37 | + $value = preg_replace('/\D/', '', $value); |
|
38 | + } |
|
39 | 39 | |
40 | - return $value; |
|
40 | + return $value; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -52,35 +52,35 @@ discard block |
||
52 | 52 | function gdsc_validate_map_args($params) |
53 | 53 | { |
54 | 54 | |
55 | - $params['width'] = gdsc_validate_measurements($params['width']); |
|
56 | - $params['height'] = gdsc_validate_measurements($params['height']); |
|
55 | + $params['width'] = gdsc_validate_measurements($params['width']); |
|
56 | + $params['height'] = gdsc_validate_measurements($params['height']); |
|
57 | 57 | |
58 | - // Only accept our 4 maptypes. Otherwise, revert to the default. |
|
59 | - if (!(in_array(geodir_strtoupper($params['maptype']), array('HYBRID', 'SATELLITE', 'ROADMAP', 'TERRAIN')))) { |
|
60 | - $params['maptype'] = 'ROADMAP'; |
|
61 | - } else { |
|
62 | - $params['maptype'] = geodir_strtoupper($params['maptype']); |
|
63 | - } |
|
58 | + // Only accept our 4 maptypes. Otherwise, revert to the default. |
|
59 | + if (!(in_array(geodir_strtoupper($params['maptype']), array('HYBRID', 'SATELLITE', 'ROADMAP', 'TERRAIN')))) { |
|
60 | + $params['maptype'] = 'ROADMAP'; |
|
61 | + } else { |
|
62 | + $params['maptype'] = geodir_strtoupper($params['maptype']); |
|
63 | + } |
|
64 | 64 | |
65 | - // Zoom accepts a value between 1 and 19 |
|
66 | - $params['zoom'] = absint($params['zoom']); |
|
67 | - if (19 < $params['zoom']) { |
|
68 | - $params['zoom'] = '19'; |
|
69 | - } |
|
70 | - if (0 == $params['zoom']) { |
|
71 | - $params['zoom'] = '1'; |
|
72 | - } |
|
65 | + // Zoom accepts a value between 1 and 19 |
|
66 | + $params['zoom'] = absint($params['zoom']); |
|
67 | + if (19 < $params['zoom']) { |
|
68 | + $params['zoom'] = '19'; |
|
69 | + } |
|
70 | + if (0 == $params['zoom']) { |
|
71 | + $params['zoom'] = '1'; |
|
72 | + } |
|
73 | 73 | |
74 | - // Child_collapse must be boolean |
|
75 | - $params['child_collapse'] = gdsc_to_bool_val($params['child_collapse']); |
|
74 | + // Child_collapse must be boolean |
|
75 | + $params['child_collapse'] = gdsc_to_bool_val($params['child_collapse']); |
|
76 | 76 | |
77 | - // Scrollwheel must be boolean |
|
78 | - $params['scrollwheel'] = gdsc_to_bool_val($params['scrollwheel']); |
|
77 | + // Scrollwheel must be boolean |
|
78 | + $params['scrollwheel'] = gdsc_to_bool_val($params['scrollwheel']); |
|
79 | 79 | |
80 | - // Scrollwheel must be boolean |
|
81 | - $params['autozoom'] = gdsc_to_bool_val($params['autozoom']); |
|
80 | + // Scrollwheel must be boolean |
|
81 | + $params['autozoom'] = gdsc_to_bool_val($params['autozoom']); |
|
82 | 82 | |
83 | - return $params; |
|
83 | + return $params; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -99,52 +99,52 @@ discard block |
||
99 | 99 | */ |
100 | 100 | function gdsc_to_bool_val($in, $strict = false) |
101 | 101 | { |
102 | - $out = null; |
|
103 | - |
|
104 | - // if not strict, we only have to check if something is false |
|
105 | - if (in_array($in, array( |
|
106 | - 'false', |
|
107 | - 'False', |
|
108 | - 'FALSE', |
|
109 | - 'no', |
|
110 | - 'No', |
|
111 | - 'n', |
|
112 | - 'N', |
|
113 | - '0', |
|
114 | - 'off', |
|
115 | - 'Off', |
|
116 | - 'OFF', |
|
117 | - false, |
|
118 | - 0, |
|
119 | - null |
|
120 | - ), true)) { |
|
121 | - $out = false; |
|
122 | - } else if ($strict) { |
|
123 | - // if strict, check the equivalent true values |
|
124 | - if (in_array($in, array( |
|
125 | - 'true', |
|
126 | - 'True', |
|
127 | - 'TRUE', |
|
128 | - 'yes', |
|
129 | - 'Yes', |
|
130 | - 'y', |
|
131 | - 'Y', |
|
132 | - '1', |
|
133 | - 'on', |
|
134 | - 'On', |
|
135 | - 'ON', |
|
136 | - true, |
|
137 | - 1 |
|
138 | - ), true)) { |
|
139 | - $out = true; |
|
140 | - } |
|
141 | - } else { |
|
142 | - // not strict? let the regular php bool check figure it out (will |
|
143 | - // largely default to true) |
|
144 | - $out = ($in ? true : false); |
|
145 | - } |
|
102 | + $out = null; |
|
103 | + |
|
104 | + // if not strict, we only have to check if something is false |
|
105 | + if (in_array($in, array( |
|
106 | + 'false', |
|
107 | + 'False', |
|
108 | + 'FALSE', |
|
109 | + 'no', |
|
110 | + 'No', |
|
111 | + 'n', |
|
112 | + 'N', |
|
113 | + '0', |
|
114 | + 'off', |
|
115 | + 'Off', |
|
116 | + 'OFF', |
|
117 | + false, |
|
118 | + 0, |
|
119 | + null |
|
120 | + ), true)) { |
|
121 | + $out = false; |
|
122 | + } else if ($strict) { |
|
123 | + // if strict, check the equivalent true values |
|
124 | + if (in_array($in, array( |
|
125 | + 'true', |
|
126 | + 'True', |
|
127 | + 'TRUE', |
|
128 | + 'yes', |
|
129 | + 'Yes', |
|
130 | + 'y', |
|
131 | + 'Y', |
|
132 | + '1', |
|
133 | + 'on', |
|
134 | + 'On', |
|
135 | + 'ON', |
|
136 | + true, |
|
137 | + 1 |
|
138 | + ), true)) { |
|
139 | + $out = true; |
|
140 | + } |
|
141 | + } else { |
|
142 | + // not strict? let the regular php bool check figure it out (will |
|
143 | + // largely default to true) |
|
144 | + $out = ($in ? true : false); |
|
145 | + } |
|
146 | 146 | |
147 | - return $out; |
|
147 | + return $out; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -157,16 +157,16 @@ discard block |
||
157 | 157 | */ |
158 | 158 | function gdsc_is_post_type_valid($incoming_post_type) |
159 | 159 | { |
160 | - $post_types = geodir_get_posttypes(); |
|
161 | - $post_types = array_map('geodir_strtolower', $post_types); |
|
162 | - $post_type_found = false; |
|
163 | - foreach ($post_types as $type) { |
|
164 | - if (geodir_strtolower($incoming_post_type) == geodir_strtolower($type)) { |
|
165 | - $post_type_found = true; |
|
166 | - } |
|
167 | - } |
|
160 | + $post_types = geodir_get_posttypes(); |
|
161 | + $post_types = array_map('geodir_strtolower', $post_types); |
|
162 | + $post_type_found = false; |
|
163 | + foreach ($post_types as $type) { |
|
164 | + if (geodir_strtolower($incoming_post_type) == geodir_strtolower($type)) { |
|
165 | + $post_type_found = true; |
|
166 | + } |
|
167 | + } |
|
168 | 168 | |
169 | - return $post_type_found; |
|
169 | + return $post_type_found; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -186,52 +186,52 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function gdsc_listing_loop_filter($query) |
188 | 188 | { |
189 | - global $wp_query, $geodir_post_type, $table, $plugin_prefix, $term; |
|
190 | - |
|
191 | - $geodir_post_type = geodir_get_current_posttype(); |
|
192 | - |
|
193 | - if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) { |
|
194 | - $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
195 | - |
|
196 | - if (isset($wp_query->query[$taxonomies[0]])) { |
|
197 | - $request_term = explode("/", $wp_query->query[$taxonomies[0]]); |
|
198 | - $request_term = end($request_term); |
|
199 | - if (!term_exists($request_term)) { |
|
200 | - $args = array('number' => '1',); |
|
201 | - $terms_arr = get_terms($taxonomies[0], $args); |
|
202 | - foreach ($terms_arr as $location_term) { |
|
203 | - $term_arr = $location_term; |
|
204 | - $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term)); |
|
205 | - } |
|
206 | - $wp_query->queried_object_id = 1; |
|
207 | - $wp_query->queried_object = $term_arr; |
|
208 | - } |
|
209 | - } |
|
189 | + global $wp_query, $geodir_post_type, $table, $plugin_prefix, $term; |
|
190 | + |
|
191 | + $geodir_post_type = geodir_get_current_posttype(); |
|
192 | + |
|
193 | + if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) { |
|
194 | + $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
195 | + |
|
196 | + if (isset($wp_query->query[$taxonomies[0]])) { |
|
197 | + $request_term = explode("/", $wp_query->query[$taxonomies[0]]); |
|
198 | + $request_term = end($request_term); |
|
199 | + if (!term_exists($request_term)) { |
|
200 | + $args = array('number' => '1',); |
|
201 | + $terms_arr = get_terms($taxonomies[0], $args); |
|
202 | + foreach ($terms_arr as $location_term) { |
|
203 | + $term_arr = $location_term; |
|
204 | + $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term)); |
|
205 | + } |
|
206 | + $wp_query->queried_object_id = 1; |
|
207 | + $wp_query->queried_object = $term_arr; |
|
208 | + } |
|
209 | + } |
|
210 | 210 | |
211 | - } |
|
212 | - if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
|
211 | + } |
|
212 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
|
213 | 213 | |
214 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
214 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
215 | 215 | |
216 | - add_filter('posts_fields', 'geodir_posts_fields', 1); |
|
217 | - add_filter('posts_join', 'geodir_posts_join', 1); |
|
218 | - geodir_post_where(); |
|
219 | - if (!is_admin()) { |
|
220 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
221 | - } |
|
216 | + add_filter('posts_fields', 'geodir_posts_fields', 1); |
|
217 | + add_filter('posts_join', 'geodir_posts_join', 1); |
|
218 | + geodir_post_where(); |
|
219 | + if (!is_admin()) { |
|
220 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
221 | + } |
|
222 | 222 | |
223 | - // advanced filter for popular post view widget |
|
224 | - global $wp_query; |
|
225 | - if (!is_admin()) { |
|
226 | - if (!empty($wp_query->query['with_pics_only'])) { |
|
227 | - add_filter('posts_join', 'geodir_filter_widget_join', 1000); |
|
228 | - } |
|
229 | - add_filter('posts_where', 'geodir_filter_widget_where', 1000); |
|
230 | - } |
|
223 | + // advanced filter for popular post view widget |
|
224 | + global $wp_query; |
|
225 | + if (!is_admin()) { |
|
226 | + if (!empty($wp_query->query['with_pics_only'])) { |
|
227 | + add_filter('posts_join', 'geodir_filter_widget_join', 1000); |
|
228 | + } |
|
229 | + add_filter('posts_where', 'geodir_filter_widget_where', 1000); |
|
230 | + } |
|
231 | 231 | |
232 | - } |
|
232 | + } |
|
233 | 233 | |
234 | - return $query; |
|
234 | + return $query; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -245,40 +245,40 @@ discard block |
||
245 | 245 | */ |
246 | 246 | function gdsc_manage_category_choice($post_type, $category) |
247 | 247 | { |
248 | - if (0 == $category || '' == $category) { |
|
249 | - return ''; |
|
250 | - } |
|
248 | + if (0 == $category || '' == $category) { |
|
249 | + return ''; |
|
250 | + } |
|
251 | 251 | |
252 | - if (!(gdsc_is_post_type_valid($post_type))) { |
|
253 | - return ''; |
|
254 | - } |
|
252 | + if (!(gdsc_is_post_type_valid($post_type))) { |
|
253 | + return ''; |
|
254 | + } |
|
255 | 255 | |
256 | - $taxonomies = geodir_get_taxonomies($post_type); |
|
256 | + $taxonomies = geodir_get_taxonomies($post_type); |
|
257 | 257 | |
258 | - $categories = get_terms(array('taxonomy' => $taxonomies[0])); |
|
258 | + $categories = get_terms(array('taxonomy' => $taxonomies[0])); |
|
259 | 259 | |
260 | - $cat_id = 0; |
|
260 | + $cat_id = 0; |
|
261 | 261 | |
262 | - foreach ($categories as $cat) { |
|
263 | - if (is_numeric($category)) { |
|
264 | - if (absint($category) == $cat->term_id) { |
|
265 | - $cat_id = $cat->term_id; |
|
266 | - break; |
|
267 | - } |
|
268 | - } else { |
|
269 | - if ($category == $cat->slug) { |
|
270 | - $cat_id = $cat->term_id; |
|
271 | - break; |
|
272 | - } |
|
262 | + foreach ($categories as $cat) { |
|
263 | + if (is_numeric($category)) { |
|
264 | + if (absint($category) == $cat->term_id) { |
|
265 | + $cat_id = $cat->term_id; |
|
266 | + break; |
|
267 | + } |
|
268 | + } else { |
|
269 | + if ($category == $cat->slug) { |
|
270 | + $cat_id = $cat->term_id; |
|
271 | + break; |
|
272 | + } |
|
273 | 273 | |
274 | - if ($category == $cat->name) { |
|
275 | - $cat_id = $cat->term_id; |
|
276 | - break; |
|
277 | - } |
|
278 | - } |
|
279 | - } |
|
274 | + if ($category == $cat->name) { |
|
275 | + $cat_id = $cat->term_id; |
|
276 | + break; |
|
277 | + } |
|
278 | + } |
|
279 | + } |
|
280 | 280 | |
281 | - return $cat_id; |
|
281 | + return $cat_id; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | // @todo: Extract this |
@@ -288,11 +288,11 @@ discard block |
||
288 | 288 | * Adds the script in the page footer for the home page google map. |
289 | 289 | * |
290 | 290 | * @since 1.0.0 |
291 | - * @return string Print the script in page footer. |
|
291 | + * @return string Print the script in page footer. |
|
292 | 292 | */ |
293 | 293 | function geodir_home_map_add_script() |
294 | - { |
|
295 | - ?> |
|
294 | + { |
|
295 | + ?> |
|
296 | 296 | <script type="text/javascript"> |
297 | 297 | jQuery(document).ready(function () { |
298 | 298 | geoDirMapSlide(); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | } |
366 | 366 | </script> |
367 | 367 | <?php |
368 | - } |
|
368 | + } |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | */ |
377 | 377 | function geodir_popular_category_add_scripts() |
378 | 378 | { |
379 | - ?> |
|
379 | + ?> |
|
380 | 380 | <script type="text/javascript"> |
381 | 381 | jQuery(function ($) { |
382 | 382 | $('.geodir-showcat').click(function () { |
@@ -406,56 +406,56 @@ discard block |
||
406 | 406 | */ |
407 | 407 | function gdsc_validate_layout_choice($layout_choice) |
408 | 408 | { |
409 | - switch (geodir_strtolower($layout_choice)) { |
|
410 | - case 'list'; |
|
411 | - case 'one'; |
|
412 | - case 'one_column'; |
|
413 | - case 'onecolumn'; |
|
414 | - case '1'; |
|
415 | - $layout_choice = 'list'; |
|
416 | - break; |
|
417 | - case 'gridview_onehalf'; |
|
418 | - case 'two'; |
|
419 | - case 'two_column'; |
|
420 | - case 'two_columns'; |
|
421 | - case 'twocolumn'; |
|
422 | - case 'twocolumns'; |
|
423 | - case '2'; |
|
424 | - $layout_choice = 'gridview_onehalf'; |
|
425 | - break; |
|
426 | - case 'gridview_onethird'; |
|
427 | - case 'three'; |
|
428 | - case 'three_column'; |
|
429 | - case 'three_columns'; |
|
430 | - case 'threecolumn'; |
|
431 | - case 'threecolumns'; |
|
432 | - case '3'; |
|
433 | - $layout_choice = 'gridview_onethird'; |
|
434 | - break; |
|
435 | - case 'gridview_onefourth'; |
|
436 | - case 'four'; |
|
437 | - case 'four_column'; |
|
438 | - case 'four_columns'; |
|
439 | - case 'fourcolumn'; |
|
440 | - case 'fourcolumns'; |
|
441 | - case '4'; |
|
442 | - $layout_choice = 'gridview_onefourth'; |
|
443 | - break; |
|
444 | - case 'gridview_onefifth'; |
|
445 | - case 'five'; |
|
446 | - case 'five_column'; |
|
447 | - case 'five_columns'; |
|
448 | - case 'fivecolumn'; |
|
449 | - case 'fivecolumns'; |
|
450 | - case '5'; |
|
451 | - $layout_choice = 'gridview_onefifth'; |
|
452 | - break; |
|
453 | - default: |
|
454 | - $layout_choice = 'gridview_onehalf'; |
|
455 | - break; |
|
456 | - } |
|
409 | + switch (geodir_strtolower($layout_choice)) { |
|
410 | + case 'list'; |
|
411 | + case 'one'; |
|
412 | + case 'one_column'; |
|
413 | + case 'onecolumn'; |
|
414 | + case '1'; |
|
415 | + $layout_choice = 'list'; |
|
416 | + break; |
|
417 | + case 'gridview_onehalf'; |
|
418 | + case 'two'; |
|
419 | + case 'two_column'; |
|
420 | + case 'two_columns'; |
|
421 | + case 'twocolumn'; |
|
422 | + case 'twocolumns'; |
|
423 | + case '2'; |
|
424 | + $layout_choice = 'gridview_onehalf'; |
|
425 | + break; |
|
426 | + case 'gridview_onethird'; |
|
427 | + case 'three'; |
|
428 | + case 'three_column'; |
|
429 | + case 'three_columns'; |
|
430 | + case 'threecolumn'; |
|
431 | + case 'threecolumns'; |
|
432 | + case '3'; |
|
433 | + $layout_choice = 'gridview_onethird'; |
|
434 | + break; |
|
435 | + case 'gridview_onefourth'; |
|
436 | + case 'four'; |
|
437 | + case 'four_column'; |
|
438 | + case 'four_columns'; |
|
439 | + case 'fourcolumn'; |
|
440 | + case 'fourcolumns'; |
|
441 | + case '4'; |
|
442 | + $layout_choice = 'gridview_onefourth'; |
|
443 | + break; |
|
444 | + case 'gridview_onefifth'; |
|
445 | + case 'five'; |
|
446 | + case 'five_column'; |
|
447 | + case 'five_columns'; |
|
448 | + case 'fivecolumn'; |
|
449 | + case 'fivecolumns'; |
|
450 | + case '5'; |
|
451 | + $layout_choice = 'gridview_onefifth'; |
|
452 | + break; |
|
453 | + default: |
|
454 | + $layout_choice = 'gridview_onehalf'; |
|
455 | + break; |
|
456 | + } |
|
457 | 457 | |
458 | - return $layout_choice; |
|
458 | + return $layout_choice; |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
@@ -468,20 +468,20 @@ discard block |
||
468 | 468 | */ |
469 | 469 | function gdsc_validate_sort_choice($sort_choice) |
470 | 470 | { |
471 | - $sorts = array( |
|
472 | - 'az', |
|
473 | - 'latest', |
|
474 | - 'featured', |
|
475 | - 'high_review', |
|
476 | - 'high_rating', |
|
477 | - 'random', |
|
478 | - ); |
|
479 | - |
|
480 | - if (!(in_array($sort_choice, $sorts))) { |
|
481 | - $sort_choice = 'latest'; |
|
482 | - } |
|
471 | + $sorts = array( |
|
472 | + 'az', |
|
473 | + 'latest', |
|
474 | + 'featured', |
|
475 | + 'high_review', |
|
476 | + 'high_rating', |
|
477 | + 'random', |
|
478 | + ); |
|
479 | + |
|
480 | + if (!(in_array($sort_choice, $sorts))) { |
|
481 | + $sort_choice = 'latest'; |
|
482 | + } |
|
483 | 483 | |
484 | - return $sort_choice; |
|
484 | + return $sort_choice; |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | /** |
@@ -494,22 +494,22 @@ discard block |
||
494 | 494 | */ |
495 | 495 | function gdsc_validate_listing_width($width_choice) |
496 | 496 | { |
497 | - if (!(empty($width_choice))) { |
|
498 | - $width_choice = absint($width_choice); |
|
499 | - } else { |
|
500 | - return ''; |
|
501 | - } |
|
497 | + if (!(empty($width_choice))) { |
|
498 | + $width_choice = absint($width_choice); |
|
499 | + } else { |
|
500 | + return ''; |
|
501 | + } |
|
502 | 502 | |
503 | - if (100 < $width_choice) { |
|
504 | - $width_choice = 100; |
|
505 | - } |
|
503 | + if (100 < $width_choice) { |
|
504 | + $width_choice = 100; |
|
505 | + } |
|
506 | 506 | |
507 | - // If listing_width is too narrow, it won't work, arbitrarily set to 10% here |
|
508 | - if (10 > $width_choice) { |
|
509 | - $width_choice = 10; |
|
510 | - } |
|
507 | + // If listing_width is too narrow, it won't work, arbitrarily set to 10% here |
|
508 | + if (10 > $width_choice) { |
|
509 | + $width_choice = 10; |
|
510 | + } |
|
511 | 511 | |
512 | - return $width_choice; |
|
512 | + return $width_choice; |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | /** |
@@ -522,18 +522,18 @@ discard block |
||
522 | 522 | */ |
523 | 523 | function gdsc_validate_list_filter_choice($filter_choice) |
524 | 524 | { |
525 | - $filters = array( |
|
526 | - 'all', |
|
527 | - 'today', |
|
528 | - 'upcoming', |
|
529 | - 'past', |
|
530 | - ); |
|
531 | - |
|
532 | - if (!(in_array($filter_choice, $filters))) { |
|
533 | - $filter_choice = 'all'; |
|
534 | - } |
|
525 | + $filters = array( |
|
526 | + 'all', |
|
527 | + 'today', |
|
528 | + 'upcoming', |
|
529 | + 'past', |
|
530 | + ); |
|
531 | + |
|
532 | + if (!(in_array($filter_choice, $filters))) { |
|
533 | + $filter_choice = 'all'; |
|
534 | + } |
|
535 | 535 | |
536 | - return $filter_choice; |
|
536 | + return $filter_choice; |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | /** |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | * @return string Listings HTML content. |
556 | 556 | */ |
557 | 557 | function geodir_sc_gd_listings_output($args = array()) { |
558 | - $title = !empty($args['title']) ? __($args['title'], 'geodirectory') : ''; |
|
558 | + $title = !empty($args['title']) ? __($args['title'], 'geodirectory') : ''; |
|
559 | 559 | $post_type = !empty($args['post_type']) ? $args['post_type'] : 'gd_place'; |
560 | 560 | $category = !empty($args['category']) ? $args['category'] : '0'; |
561 | 561 | $post_number = !empty($args['post_number']) ? $args['post_number'] : 10; |
@@ -565,17 +565,17 @@ discard block |
||
565 | 565 | $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; |
566 | 566 | $with_pagination = !empty($args['with_pagination']) ? true : false; |
567 | 567 | $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; |
568 | - $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
|
569 | - $tags = !empty($args['tags']) ? $args['tags'] : array(); |
|
570 | - /** |
|
571 | - * Filter the content text displayed when no listings found. |
|
572 | - * |
|
573 | - * @since 1.6.0 |
|
574 | - * |
|
575 | - * @param string $shortcode_content The shortcode content text. |
|
576 | - * @param array $args Array of arguements to filter listings. |
|
577 | - */ |
|
578 | - $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
|
568 | + $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
|
569 | + $tags = !empty($args['tags']) ? $args['tags'] : array(); |
|
570 | + /** |
|
571 | + * Filter the content text displayed when no listings found. |
|
572 | + * |
|
573 | + * @since 1.6.0 |
|
574 | + * |
|
575 | + * @param string $shortcode_content The shortcode content text. |
|
576 | + * @param array $args Array of arguements to filter listings. |
|
577 | + */ |
|
578 | + $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
|
579 | 579 | |
580 | 580 | $top_pagination = $with_pagination && !empty($args['top_pagination']) ? true : false; |
581 | 581 | $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; |
@@ -587,92 +587,92 @@ discard block |
||
587 | 587 | $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; |
588 | 588 | |
589 | 589 | $query_args = array( |
590 | - 'posts_per_page' => $post_number, |
|
591 | - 'is_geodir_loop' => true, |
|
592 | - 'gd_location' => $add_location_filter, |
|
593 | - 'post_type' => $post_type, |
|
594 | - 'order_by' => $list_sort, |
|
590 | + 'posts_per_page' => $post_number, |
|
591 | + 'is_geodir_loop' => true, |
|
592 | + 'gd_location' => $add_location_filter, |
|
593 | + 'post_type' => $post_type, |
|
594 | + 'order_by' => $list_sort, |
|
595 | 595 | 'pageno' => $pageno |
596 | - ); |
|
596 | + ); |
|
597 | 597 | |
598 | - if ($character_count >= 0) { |
|
599 | - $query_args['excerpt_length'] = $character_count; |
|
600 | - } |
|
598 | + if ($character_count >= 0) { |
|
599 | + $query_args['excerpt_length'] = $character_count; |
|
600 | + } |
|
601 | 601 | |
602 | - if (!empty($args['post_author'])) { |
|
603 | - $query_args['post_author'] = $args['post_author']; |
|
604 | - } |
|
602 | + if (!empty($args['post_author'])) { |
|
603 | + $query_args['post_author'] = $args['post_author']; |
|
604 | + } |
|
605 | 605 | |
606 | - if (!empty($args['show_featured_only'])) { |
|
607 | - $query_args['show_featured_only'] = 1; |
|
608 | - } |
|
606 | + if (!empty($args['show_featured_only'])) { |
|
607 | + $query_args['show_featured_only'] = 1; |
|
608 | + } |
|
609 | 609 | |
610 | - if (!empty($args['show_special_only'])) { |
|
611 | - $query_args['show_special_only'] = 1; |
|
612 | - } |
|
610 | + if (!empty($args['show_special_only'])) { |
|
611 | + $query_args['show_special_only'] = 1; |
|
612 | + } |
|
613 | 613 | |
614 | - if (!empty($args['with_pics_only'])) { |
|
615 | - $query_args['with_pics_only'] = 0; |
|
616 | - $query_args['featured_image_only'] = 1; |
|
617 | - } |
|
614 | + if (!empty($args['with_pics_only'])) { |
|
615 | + $query_args['with_pics_only'] = 0; |
|
616 | + $query_args['featured_image_only'] = 1; |
|
617 | + } |
|
618 | 618 | |
619 | - if (!empty($args['with_videos_only'])) { |
|
620 | - $query_args['with_videos_only'] = 1; |
|
621 | - } |
|
619 | + if (!empty($args['with_videos_only'])) { |
|
620 | + $query_args['with_videos_only'] = 1; |
|
621 | + } |
|
622 | 622 | |
623 | - if (!empty($args['show_favorites_only'])) { |
|
624 | - $query_args['show_favorites_only'] = 1; |
|
625 | - $query_args['favorites_by_user'] = !empty($args['favorites_by_user']) ? $args['favorites_by_user'] : 0; |
|
626 | - } |
|
627 | - $with_no_results = !empty($args['without_no_results']) ? false : true; |
|
623 | + if (!empty($args['show_favorites_only'])) { |
|
624 | + $query_args['show_favorites_only'] = 1; |
|
625 | + $query_args['favorites_by_user'] = !empty($args['favorites_by_user']) ? $args['favorites_by_user'] : 0; |
|
626 | + } |
|
627 | + $with_no_results = !empty($args['without_no_results']) ? false : true; |
|
628 | 628 | |
629 | - if (!empty($category) && isset($category[0]) && $category[0] != '0') { |
|
630 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
629 | + if (!empty($category) && isset($category[0]) && $category[0] != '0') { |
|
630 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
631 | 631 | |
632 | - ######### WPML ######### |
|
633 | - if (function_exists('icl_object_id')) { |
|
634 | - $category = gd_lang_object_ids($category, $category_taxonomy[0]); |
|
635 | - } |
|
636 | - ######### WPML ######### |
|
632 | + ######### WPML ######### |
|
633 | + if (function_exists('icl_object_id')) { |
|
634 | + $category = gd_lang_object_ids($category, $category_taxonomy[0]); |
|
635 | + } |
|
636 | + ######### WPML ######### |
|
637 | 637 | |
638 | - $tax_query = array( |
|
639 | - 'taxonomy' => $category_taxonomy[0], |
|
640 | - 'field' => 'id', |
|
641 | - 'terms' => $category |
|
642 | - ); |
|
638 | + $tax_query = array( |
|
639 | + 'taxonomy' => $category_taxonomy[0], |
|
640 | + 'field' => 'id', |
|
641 | + 'terms' => $category |
|
642 | + ); |
|
643 | 643 | |
644 | - $query_args['tax_query'] = array($tax_query); |
|
645 | - } |
|
644 | + $query_args['tax_query'] = array($tax_query); |
|
645 | + } |
|
646 | 646 | |
647 | - if (!empty($tags)) { |
|
648 | - // Clean tags |
|
649 | - if (!is_array($tags)) { |
|
650 | - $comma = _x(',', 'tag delimiter'); |
|
651 | - if ( ',' !== $comma ) { |
|
652 | - $tags = str_replace($comma, ',', $tags); |
|
653 | - } |
|
654 | - $tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); |
|
655 | - $tags = array_map('trim', $tags); |
|
656 | - } |
|
647 | + if (!empty($tags)) { |
|
648 | + // Clean tags |
|
649 | + if (!is_array($tags)) { |
|
650 | + $comma = _x(',', 'tag delimiter'); |
|
651 | + if ( ',' !== $comma ) { |
|
652 | + $tags = str_replace($comma, ',', $tags); |
|
653 | + } |
|
654 | + $tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); |
|
655 | + $tags = array_map('trim', $tags); |
|
656 | + } |
|
657 | 657 | |
658 | - if (!empty($tags)) { |
|
659 | - $tag_query = array( |
|
660 | - 'taxonomy' => $post_type . '_tags', |
|
661 | - 'field' => 'name', |
|
662 | - 'terms' => $tags |
|
663 | - ); |
|
664 | - |
|
665 | - if (!empty($query_args['tax_query'])) { |
|
666 | - $query_args['tax_query'][] = $tag_query; |
|
667 | - } else { |
|
668 | - $query_args['tax_query'] = array($tag_query); |
|
669 | - } |
|
670 | - } |
|
671 | - } |
|
658 | + if (!empty($tags)) { |
|
659 | + $tag_query = array( |
|
660 | + 'taxonomy' => $post_type . '_tags', |
|
661 | + 'field' => 'name', |
|
662 | + 'terms' => $tags |
|
663 | + ); |
|
664 | + |
|
665 | + if (!empty($query_args['tax_query'])) { |
|
666 | + $query_args['tax_query'][] = $tag_query; |
|
667 | + } else { |
|
668 | + $query_args['tax_query'] = array($tag_query); |
|
669 | + } |
|
670 | + } |
|
671 | + } |
|
672 | 672 | |
673 | - global $gridview_columns_widget, $geodir_is_widget_listing; |
|
673 | + global $gridview_columns_widget, $geodir_is_widget_listing; |
|
674 | 674 | |
675 | - if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
675 | + if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
676 | 676 | global $geodir_event_widget_listview; |
677 | 677 | $geodir_event_widget_listview = true; |
678 | 678 | |
@@ -687,16 +687,16 @@ discard block |
||
687 | 687 | $widget_listings = $total_posts > 0 ? geodir_get_widget_listings($query_args) : array(); |
688 | 688 | } |
689 | 689 | $current_gridview_columns_widget = $gridview_columns_widget; |
690 | - $identifier = ' gd-wgt-pagi-' . mt_rand(); |
|
691 | - ob_start(); |
|
690 | + $identifier = ' gd-wgt-pagi-' . mt_rand(); |
|
691 | + ob_start(); |
|
692 | 692 | if (!empty($widget_listings) || $with_no_results) { |
693 | 693 | if (!$geodir_ajax) { |
694 | - /** |
|
695 | - * Called before the shortcode [gd_listings] content is output. |
|
696 | - * |
|
697 | - * @since 1.0.0 |
|
698 | - */ |
|
699 | - do_action('geodir_before_sc_gd_listings'); |
|
694 | + /** |
|
695 | + * Called before the shortcode [gd_listings] content is output. |
|
696 | + * |
|
697 | + * @since 1.0.0 |
|
698 | + */ |
|
699 | + do_action('geodir_before_sc_gd_listings'); |
|
700 | 700 | ?> |
701 | 701 | <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier;?>"> |
702 | 702 | <?php if ($title != '') { ?> |
@@ -707,63 +707,63 @@ discard block |
||
707 | 707 | <div class="gd-sc-loader"> |
708 | 708 | <div class="gd-sc-content"> |
709 | 709 | <?php } |
710 | - if (!(empty($widget_listings) && !empty($shortcode_content))) { |
|
711 | - if (strstr($layout, 'gridview')) { |
|
712 | - $listing_view_exp = explode('_', $layout); |
|
713 | - $gridview_columns_widget = $layout; |
|
714 | - $layout = $listing_view_exp[0]; |
|
715 | - } else { |
|
716 | - $gridview_columns_widget = ''; |
|
717 | - } |
|
718 | - |
|
719 | - /** |
|
720 | - * Filter the widget listing listview template. |
|
721 | - * |
|
722 | - * @since 1.0.0 |
|
723 | - * |
|
724 | - * @param string The template file to display listing. |
|
725 | - */ |
|
726 | - $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
710 | + if (!(empty($widget_listings) && !empty($shortcode_content))) { |
|
711 | + if (strstr($layout, 'gridview')) { |
|
712 | + $listing_view_exp = explode('_', $layout); |
|
713 | + $gridview_columns_widget = $layout; |
|
714 | + $layout = $listing_view_exp[0]; |
|
715 | + } else { |
|
716 | + $gridview_columns_widget = ''; |
|
717 | + } |
|
718 | + |
|
719 | + /** |
|
720 | + * Filter the widget listing listview template. |
|
721 | + * |
|
722 | + * @since 1.0.0 |
|
723 | + * |
|
724 | + * @param string The template file to display listing. |
|
725 | + */ |
|
726 | + $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
727 | 727 | |
728 | - global $post, $map_jason, $map_canvas_arr, $gd_session; |
|
729 | - |
|
730 | - $current_post = $post; |
|
731 | - $current_map_jason = $map_jason; |
|
732 | - $current_map_canvas_arr = $map_canvas_arr; |
|
733 | - $geodir_is_widget_listing = true; |
|
734 | - $gd_session->un_set('gd_listing_view'); |
|
735 | - |
|
736 | - if ($with_pagination && $top_pagination) { |
|
737 | - echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
738 | - } |
|
739 | - |
|
740 | - /** |
|
741 | - * Includes listing listview template. |
|
742 | - * |
|
743 | - * @since 1.0.0 |
|
744 | - */ |
|
745 | - include($template); |
|
728 | + global $post, $map_jason, $map_canvas_arr, $gd_session; |
|
729 | + |
|
730 | + $current_post = $post; |
|
731 | + $current_map_jason = $map_jason; |
|
732 | + $current_map_canvas_arr = $map_canvas_arr; |
|
733 | + $geodir_is_widget_listing = true; |
|
734 | + $gd_session->un_set('gd_listing_view'); |
|
735 | + |
|
736 | + if ($with_pagination && $top_pagination) { |
|
737 | + echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
738 | + } |
|
739 | + |
|
740 | + /** |
|
741 | + * Includes listing listview template. |
|
742 | + * |
|
743 | + * @since 1.0.0 |
|
744 | + */ |
|
745 | + include($template); |
|
746 | 746 | |
747 | - if ($with_pagination && $bottom_pagination) { |
|
748 | - echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
749 | - } |
|
750 | - |
|
751 | - $geodir_is_widget_listing = false; |
|
752 | - |
|
753 | - $GLOBALS['post'] = $current_post; |
|
754 | - if (!empty($current_post)) { |
|
755 | - setup_postdata($current_post); |
|
756 | - } |
|
757 | - $map_jason = $current_map_jason; |
|
758 | - $map_canvas_arr = $current_map_canvas_arr; |
|
759 | - global $gridview_columns_widget; |
|
760 | - $gridview_columns_widget = $current_gridview_columns_widget; |
|
761 | - } else { |
|
762 | - echo $shortcode_content; |
|
763 | - } |
|
747 | + if ($with_pagination && $bottom_pagination) { |
|
748 | + echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
749 | + } |
|
750 | + |
|
751 | + $geodir_is_widget_listing = false; |
|
752 | + |
|
753 | + $GLOBALS['post'] = $current_post; |
|
754 | + if (!empty($current_post)) { |
|
755 | + setup_postdata($current_post); |
|
756 | + } |
|
757 | + $map_jason = $current_map_jason; |
|
758 | + $map_canvas_arr = $current_map_canvas_arr; |
|
759 | + global $gridview_columns_widget; |
|
760 | + $gridview_columns_widget = $current_gridview_columns_widget; |
|
761 | + } else { |
|
762 | + echo $shortcode_content; |
|
763 | + } |
|
764 | 764 | ?> |
765 | 765 | <?php |
766 | - if (!$geodir_ajax) { |
|
766 | + if (!$geodir_ajax) { |
|
767 | 767 | ?> |
768 | 768 | </div><p class="geodir-sclisting-loading" style="display:none;"><i class="fa fa-cog fa-spin"></i></p></div> |
769 | 769 | <script type="text/javascript"> |
@@ -801,10 +801,10 @@ discard block |
||
801 | 801 | loading.hide(); |
802 | 802 | jQuery(items).html(response); |
803 | 803 | <?php |
804 | - /** |
|
805 | - * if lazyload images enabled then refresh them once ajax page changed. |
|
806 | - */ |
|
807 | - if (get_option('geodir_lazy_load', 1)) { ?> |
|
804 | + /** |
|
805 | + * if lazyload images enabled then refresh them once ajax page changed. |
|
806 | + */ |
|
807 | + if (get_option('geodir_lazy_load', 1)) { ?> |
|
808 | 808 | geodir_init_lazy_load(); |
809 | 809 | <?php } ?> |
810 | 810 | } |
@@ -814,11 +814,11 @@ discard block |
||
814 | 814 | </div> |
815 | 815 | <?php } ?> |
816 | 816 | <?php |
817 | - } |
|
817 | + } |
|
818 | 818 | $output = ob_get_contents(); |
819 | - ob_end_clean(); |
|
819 | + ob_end_clean(); |
|
820 | 820 | |
821 | - return trim($output); |
|
821 | + return trim($output); |
|
822 | 822 | } |
823 | 823 | |
824 | 824 | /** |
@@ -845,15 +845,15 @@ discard block |
||
845 | 845 | * @return string Listings pagination HTML content. |
846 | 846 | */ |
847 | 847 | function geodir_sc_listings_pagination($total_posts, $posts_per_page, $pageno, $before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { |
848 | - if (empty($prelabel)) { |
|
849 | - $prelabel = '<strong>«</strong>'; |
|
850 | - } |
|
848 | + if (empty($prelabel)) { |
|
849 | + $prelabel = '<strong>«</strong>'; |
|
850 | + } |
|
851 | 851 | |
852 | - if (empty($nxtlabel)) { |
|
853 | - $nxtlabel = '<strong>»</strong>'; |
|
854 | - } |
|
852 | + if (empty($nxtlabel)) { |
|
853 | + $nxtlabel = '<strong>»</strong>'; |
|
854 | + } |
|
855 | 855 | |
856 | - $half_pages_to_show = round($pages_to_show / 2); |
|
856 | + $half_pages_to_show = round($pages_to_show / 2); |
|
857 | 857 | |
858 | 858 | $numposts = $total_posts; |
859 | 859 | |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | } |
887 | 887 | |
888 | 888 | if (($pageno - 1) > 0) { |
889 | - echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> '; |
|
889 | + echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> '; |
|
890 | 890 | } |
891 | 891 | |
892 | 892 | for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) { |
@@ -909,9 +909,9 @@ discard block |
||
909 | 909 | echo "</div> $after </div>"; |
910 | 910 | } |
911 | 911 | $output = ob_get_contents(); |
912 | - ob_end_clean(); |
|
912 | + ob_end_clean(); |
|
913 | 913 | |
914 | - return trim($output); |
|
914 | + return trim($output); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | /** |
@@ -922,10 +922,10 @@ discard block |
||
922 | 922 | * @return string Listings HTML content. |
923 | 923 | */ |
924 | 924 | function geodir_sclistings_callback() { |
925 | - check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce'); |
|
926 | - //set variables |
|
927 | - $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
|
928 | - $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
|
925 | + check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce'); |
|
926 | + //set variables |
|
927 | + $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
|
928 | + $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
|
929 | 929 | |
930 | 930 | $shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL; |
931 | 931 | |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | } else { |
938 | 938 | echo 0; |
939 | 939 | } |
940 | - wp_die(); |
|
940 | + wp_die(); |
|
941 | 941 | } |
942 | 942 | add_action('wp_ajax_geodir_sclistings', 'geodir_sclistings_callback'); |
943 | 943 | add_action('wp_ajax_nopriv_geodir_sclistings', 'geodir_sclistings_callback'); |
944 | 944 | \ No newline at end of file |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | // If this file is called directly, abort. |
9 | 9 | if (!defined('WPINC')) { |
10 | - die; |
|
10 | + die; |
|
11 | 11 | } |
12 | 12 | require_once('geodirectory-functions/shortcode_functions.php'); |
13 | 13 | |
@@ -32,43 +32,43 @@ discard block |
||
32 | 32 | */ |
33 | 33 | function geodir_sc_add_listing($atts) |
34 | 34 | { |
35 | - ob_start(); |
|
36 | - $defaults = array( |
|
37 | - 'pid' => '', |
|
38 | - 'listing_type' => 'gd_place', |
|
39 | - 'login_msg' => __('You must login to post.', 'geodirectory'), |
|
40 | - 'show_login' => false, |
|
41 | - ); |
|
42 | - $params = shortcode_atts($defaults, $atts); |
|
43 | - |
|
44 | - foreach ($params as $key => $value) { |
|
45 | - $_REQUEST[$key] = $value; |
|
46 | - } |
|
47 | - |
|
48 | - $user_id = get_current_user_id(); |
|
49 | - if (!$user_id) { |
|
50 | - echo $params['login_msg']; |
|
51 | - if ($params['show_login']) { |
|
52 | - echo "<br />"; |
|
53 | - $defaults = array( |
|
54 | - 'before_widget' => '', |
|
55 | - 'after_widget' => '', |
|
56 | - 'before_title' => '', |
|
57 | - 'after_title' => '', |
|
58 | - ); |
|
59 | - |
|
60 | - geodir_loginwidget_output($defaults, $defaults); |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - } else { |
|
65 | - // Add listing page will be used if shortcode is detected in page content, no need to call it here |
|
66 | - } |
|
67 | - $output = ob_get_contents(); |
|
68 | - |
|
69 | - ob_end_clean(); |
|
70 | - |
|
71 | - return $output; |
|
35 | + ob_start(); |
|
36 | + $defaults = array( |
|
37 | + 'pid' => '', |
|
38 | + 'listing_type' => 'gd_place', |
|
39 | + 'login_msg' => __('You must login to post.', 'geodirectory'), |
|
40 | + 'show_login' => false, |
|
41 | + ); |
|
42 | + $params = shortcode_atts($defaults, $atts); |
|
43 | + |
|
44 | + foreach ($params as $key => $value) { |
|
45 | + $_REQUEST[$key] = $value; |
|
46 | + } |
|
47 | + |
|
48 | + $user_id = get_current_user_id(); |
|
49 | + if (!$user_id) { |
|
50 | + echo $params['login_msg']; |
|
51 | + if ($params['show_login']) { |
|
52 | + echo "<br />"; |
|
53 | + $defaults = array( |
|
54 | + 'before_widget' => '', |
|
55 | + 'after_widget' => '', |
|
56 | + 'before_title' => '', |
|
57 | + 'after_title' => '', |
|
58 | + ); |
|
59 | + |
|
60 | + geodir_loginwidget_output($defaults, $defaults); |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + } else { |
|
65 | + // Add listing page will be used if shortcode is detected in page content, no need to call it here |
|
66 | + } |
|
67 | + $output = ob_get_contents(); |
|
68 | + |
|
69 | + ob_end_clean(); |
|
70 | + |
|
71 | + return $output; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -96,136 +96,136 @@ discard block |
||
96 | 96 | */ |
97 | 97 | function geodir_sc_home_map($atts) |
98 | 98 | { |
99 | - ob_start(); |
|
100 | - $defaults = array( |
|
101 | - 'width' => '960', |
|
102 | - 'height' => '425', |
|
103 | - 'maptype' => 'ROADMAP', |
|
104 | - 'zoom' => '13', |
|
105 | - 'autozoom' => '', |
|
106 | - 'child_collapse' => '0', |
|
107 | - 'scrollwheel' => '0', |
|
99 | + ob_start(); |
|
100 | + $defaults = array( |
|
101 | + 'width' => '960', |
|
102 | + 'height' => '425', |
|
103 | + 'maptype' => 'ROADMAP', |
|
104 | + 'zoom' => '13', |
|
105 | + 'autozoom' => '', |
|
106 | + 'child_collapse' => '0', |
|
107 | + 'scrollwheel' => '0', |
|
108 | 108 | 'marker_cluster' => false, |
109 | - 'latitude' => '', |
|
110 | - 'longitude' => '' |
|
111 | - ); |
|
112 | - |
|
113 | - $params = shortcode_atts($defaults, $atts); |
|
114 | - |
|
115 | - $params = gdsc_validate_map_args($params); |
|
116 | - |
|
117 | - $map_args = array( |
|
118 | - 'map_canvas_name' => 'gd_home_map', |
|
119 | - 'latitude' => $params['latitude'], |
|
120 | - 'longitude' => $params['longitude'], |
|
121 | - |
|
122 | - /** |
|
123 | - * Filter the widget width of the map on home/listings page. |
|
124 | - * |
|
125 | - * @since 1.0.0 |
|
126 | - * @param mixed(string|int|float) $params['width'] The map width. |
|
127 | - */ |
|
128 | - 'width' => apply_filters('widget_width', $params['width']), |
|
129 | - /** |
|
130 | - * Filter the widget height of the map on home/listings page. |
|
131 | - * |
|
132 | - * @since 1.0.0 |
|
133 | - * @param mixed(string|int|float) $params['height'] The map height. |
|
134 | - */ |
|
135 | - 'height' => apply_filters('widget_heigh', $params['height']), |
|
136 | - /** |
|
137 | - * Filter the widget maptype of the map on home/listings page. |
|
138 | - * |
|
139 | - * @since 1.0.0 |
|
109 | + 'latitude' => '', |
|
110 | + 'longitude' => '' |
|
111 | + ); |
|
112 | + |
|
113 | + $params = shortcode_atts($defaults, $atts); |
|
114 | + |
|
115 | + $params = gdsc_validate_map_args($params); |
|
116 | + |
|
117 | + $map_args = array( |
|
118 | + 'map_canvas_name' => 'gd_home_map', |
|
119 | + 'latitude' => $params['latitude'], |
|
120 | + 'longitude' => $params['longitude'], |
|
121 | + |
|
122 | + /** |
|
123 | + * Filter the widget width of the map on home/listings page. |
|
124 | + * |
|
125 | + * @since 1.0.0 |
|
126 | + * @param mixed(string|int|float) $params['width'] The map width. |
|
127 | + */ |
|
128 | + 'width' => apply_filters('widget_width', $params['width']), |
|
129 | + /** |
|
130 | + * Filter the widget height of the map on home/listings page. |
|
131 | + * |
|
132 | + * @since 1.0.0 |
|
133 | + * @param mixed(string|int|float) $params['height'] The map height. |
|
134 | + */ |
|
135 | + 'height' => apply_filters('widget_heigh', $params['height']), |
|
136 | + /** |
|
137 | + * Filter the widget maptype of the map on home/listings page. |
|
138 | + * |
|
139 | + * @since 1.0.0 |
|
140 | 140 | * @since 1.5.2 Added TERRAIN map type. |
141 | - * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN. |
|
142 | - */ |
|
143 | - 'maptype' => apply_filters('widget_maptype', $params['maptype']), |
|
144 | - /** |
|
145 | - * Filter the widget scrollwheel value of the map on home/listings page. |
|
146 | - * |
|
147 | - * Should the scrollwheel zoom the map or not. |
|
148 | - * |
|
149 | - * @since 1.0.0 |
|
150 | - * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not. |
|
151 | - */ |
|
152 | - 'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']), |
|
153 | - /** |
|
154 | - * Filter the widget zoom level of the map on home/listings page. |
|
155 | - * |
|
156 | - * @since 1.0.0 |
|
157 | - * @param int $params['zoom'] The zoom level of the map. Between 1-19. |
|
158 | - */ |
|
159 | - 'zoom' => apply_filters('widget_zoom', $params['zoom']), |
|
160 | - /** |
|
161 | - * Filter the widget auto zoom value of the map on home/listings page. |
|
162 | - * |
|
163 | - * If the map should autozoom to fit the markers shown. |
|
164 | - * |
|
165 | - * @since 1.0.0 |
|
166 | - * @param bool $params['autozoom'] True if the map should autozoom, false if not. |
|
167 | - */ |
|
168 | - 'autozoom' => apply_filters('widget_autozoom', $params['autozoom']), |
|
169 | - /** |
|
170 | - * Filter the widget child_collapse value of the map on home/listings page. |
|
171 | - * |
|
172 | - * If the map should auto collapse the child categories if the category bar is present. |
|
173 | - * |
|
174 | - * @since 1.0.0 |
|
175 | - * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not. |
|
176 | - */ |
|
177 | - 'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']), |
|
178 | - 'enable_cat_filters' => true, |
|
179 | - 'enable_text_search' => true, |
|
180 | - 'enable_post_type_filters' => true, |
|
181 | - /** |
|
182 | - * Filter the widget enable_location_filters value of the map on home/listings page. |
|
183 | - * |
|
184 | - * This is used when the location addon is used. |
|
185 | - * |
|
186 | - * @since 1.0.0 |
|
187 | - * @param bool $val True if location filters should be used, false if not. |
|
188 | - */ |
|
189 | - 'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false), |
|
190 | - 'enable_jason_on_load' => false, |
|
191 | - 'enable_marker_cluster' => false, |
|
192 | - 'enable_map_resize_button' => true, |
|
193 | - 'map_class_name' => 'geodir-map-home-page', |
|
194 | - 'is_geodir_home_map_widget' => true, |
|
195 | - ); |
|
141 | + * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN. |
|
142 | + */ |
|
143 | + 'maptype' => apply_filters('widget_maptype', $params['maptype']), |
|
144 | + /** |
|
145 | + * Filter the widget scrollwheel value of the map on home/listings page. |
|
146 | + * |
|
147 | + * Should the scrollwheel zoom the map or not. |
|
148 | + * |
|
149 | + * @since 1.0.0 |
|
150 | + * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not. |
|
151 | + */ |
|
152 | + 'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']), |
|
153 | + /** |
|
154 | + * Filter the widget zoom level of the map on home/listings page. |
|
155 | + * |
|
156 | + * @since 1.0.0 |
|
157 | + * @param int $params['zoom'] The zoom level of the map. Between 1-19. |
|
158 | + */ |
|
159 | + 'zoom' => apply_filters('widget_zoom', $params['zoom']), |
|
160 | + /** |
|
161 | + * Filter the widget auto zoom value of the map on home/listings page. |
|
162 | + * |
|
163 | + * If the map should autozoom to fit the markers shown. |
|
164 | + * |
|
165 | + * @since 1.0.0 |
|
166 | + * @param bool $params['autozoom'] True if the map should autozoom, false if not. |
|
167 | + */ |
|
168 | + 'autozoom' => apply_filters('widget_autozoom', $params['autozoom']), |
|
169 | + /** |
|
170 | + * Filter the widget child_collapse value of the map on home/listings page. |
|
171 | + * |
|
172 | + * If the map should auto collapse the child categories if the category bar is present. |
|
173 | + * |
|
174 | + * @since 1.0.0 |
|
175 | + * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not. |
|
176 | + */ |
|
177 | + 'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']), |
|
178 | + 'enable_cat_filters' => true, |
|
179 | + 'enable_text_search' => true, |
|
180 | + 'enable_post_type_filters' => true, |
|
181 | + /** |
|
182 | + * Filter the widget enable_location_filters value of the map on home/listings page. |
|
183 | + * |
|
184 | + * This is used when the location addon is used. |
|
185 | + * |
|
186 | + * @since 1.0.0 |
|
187 | + * @param bool $val True if location filters should be used, false if not. |
|
188 | + */ |
|
189 | + 'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false), |
|
190 | + 'enable_jason_on_load' => false, |
|
191 | + 'enable_marker_cluster' => false, |
|
192 | + 'enable_map_resize_button' => true, |
|
193 | + 'map_class_name' => 'geodir-map-home-page', |
|
194 | + 'is_geodir_home_map_widget' => true, |
|
195 | + ); |
|
196 | 196 | |
197 | 197 | // Add marker cluster |
198 | 198 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
199 | - $map_args['enable_marker_cluster'] = true; |
|
200 | - if(get_option('geodir_marker_cluster_type')) { |
|
201 | - if ($map_args['autozoom']) { |
|
202 | - $map_args['enable_marker_cluster_no_reposition'] = false; |
|
203 | - } else { |
|
204 | - $map_args['enable_marker_cluster_no_reposition'] = true; |
|
205 | - } |
|
199 | + $map_args['enable_marker_cluster'] = true; |
|
200 | + if(get_option('geodir_marker_cluster_type')) { |
|
201 | + if ($map_args['autozoom']) { |
|
202 | + $map_args['enable_marker_cluster_no_reposition'] = false; |
|
203 | + } else { |
|
204 | + $map_args['enable_marker_cluster_no_reposition'] = true; |
|
205 | + } |
|
206 | 206 | |
207 | - $map_args['enable_marker_cluster_server'] = true ; |
|
207 | + $map_args['enable_marker_cluster_server'] = true ; |
|
208 | 208 | |
209 | - } |
|
209 | + } |
|
210 | 210 | } else { |
211 | 211 | $map_args['enable_marker_cluster'] = false; |
212 | 212 | } |
213 | 213 | |
214 | - // if lat and long set in shortcode, hack it so the map is not repositioned |
|
215 | - if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
216 | - $map_args['enable_marker_cluster_no_reposition'] = true; |
|
217 | - } |
|
214 | + // if lat and long set in shortcode, hack it so the map is not repositioned |
|
215 | + if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
216 | + $map_args['enable_marker_cluster_no_reposition'] = true; |
|
217 | + } |
|
218 | 218 | |
219 | 219 | |
220 | - geodir_draw_map($map_args); |
|
220 | + geodir_draw_map($map_args); |
|
221 | 221 | |
222 | - add_action('wp_footer', 'geodir_home_map_add_script', 100); |
|
222 | + add_action('wp_footer', 'geodir_home_map_add_script', 100); |
|
223 | 223 | |
224 | - $output = ob_get_contents(); |
|
224 | + $output = ob_get_contents(); |
|
225 | 225 | |
226 | - ob_end_clean(); |
|
226 | + ob_end_clean(); |
|
227 | 227 | |
228 | - return $output; |
|
228 | + return $output; |
|
229 | 229 | } |
230 | 230 | add_shortcode('gd_homepage_map', 'geodir_sc_home_map'); |
231 | 231 | |
@@ -264,243 +264,243 @@ discard block |
||
264 | 264 | */ |
265 | 265 | function geodir_sc_listing_map($atts) { |
266 | 266 | |
267 | - // if some params are set then we need a new query, if not then we can use the main query |
|
268 | - if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) { |
|
269 | - |
|
270 | - global $add_post_in_marker_array, $gd_sc_map_params; |
|
271 | - $backup_globals = array(); |
|
272 | - $backup_globals['add_post_in_marker_array'] = $add_post_in_marker_array; |
|
273 | - $backup_globals['gd_sc_map_params'] = $gd_sc_map_params; |
|
274 | - |
|
275 | - $defaults = array( |
|
276 | - 'width' => '294', |
|
277 | - 'height' => '370', |
|
278 | - 'zoom' => '13', |
|
279 | - 'autozoom' => '', |
|
280 | - 'sticky' => '', |
|
281 | - 'showall' => '0', |
|
282 | - 'scrollwheel' => '0', |
|
283 | - 'maptype' => 'ROADMAP', |
|
284 | - 'child_collapse' => 0, |
|
285 | - 'marker_cluster' => false, |
|
286 | - 'post_type' => 'gd_place', |
|
287 | - 'category' => '0', |
|
288 | - 'event_type' => 'all' |
|
289 | - ); |
|
290 | - |
|
291 | - $params = shortcode_atts( $defaults, $atts ); |
|
292 | - |
|
293 | - if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) { |
|
294 | - $params['post_type'] = 'gd_place'; |
|
295 | - } |
|
296 | - |
|
297 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
298 | - $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
299 | - $categories = get_terms( $category_taxonomy, array( |
|
300 | - 'orderby' => 'count', |
|
301 | - 'order' => 'DESC', |
|
302 | - 'fields' => 'ids' |
|
303 | - ) ); |
|
304 | - |
|
305 | - // Make sure we have an array |
|
306 | - if ( ! ( is_array( $params['category'] ) ) ) { |
|
307 | - $params['category'] = explode( ',', $params['category'] ); |
|
308 | - } |
|
309 | - |
|
310 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
311 | - // Otherwise it becomes empty and later on that will mean "All" |
|
312 | - $params['category'] = array_intersect( $params['category'], $categories ); |
|
313 | - |
|
314 | - if ( $params['post_type'] == 'gd_event' ) { |
|
315 | - $params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] ); |
|
316 | - } |
|
317 | - |
|
318 | - $params = gdsc_validate_map_args( $params ); |
|
319 | - |
|
320 | - $gd_sc_map_params = $params; |
|
321 | - |
|
322 | - $query_args = array( |
|
323 | - 'posts_per_page' => 1000000, //@todo kiran why was this added? |
|
324 | - 'is_geodir_loop' => true, |
|
325 | - 'gd_location' => false, |
|
326 | - 'post_type' => $params['post_type'], |
|
327 | - ); |
|
328 | - |
|
329 | - if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) { |
|
330 | - $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
331 | - |
|
332 | - ######### WPML ######### |
|
333 | - if ( function_exists( 'icl_object_id' ) ) { |
|
334 | - $category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] ); |
|
335 | - } |
|
336 | - ######### WPML ######### |
|
337 | - |
|
338 | - $tax_query = array( |
|
339 | - 'taxonomy' => $category_taxonomy[0], |
|
340 | - 'field' => 'id', |
|
341 | - 'terms' => $params['category'] |
|
342 | - ); |
|
343 | - |
|
344 | - $query_args['tax_query'] = array( $tax_query ); |
|
345 | - } |
|
346 | - |
|
347 | - $add_post_in_marker_array = true; |
|
348 | - |
|
349 | - if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) { |
|
350 | - global $geodir_event_widget_listview; |
|
351 | - $geodir_event_widget_listview = true; |
|
352 | - |
|
353 | - $query_args['geodir_event_type'] = $params['event_type']; |
|
354 | - |
|
355 | - $listings = geodir_event_get_widget_events( $query_args ); |
|
356 | - |
|
357 | - $geodir_event_widget_listview = false; |
|
358 | - } else { |
|
359 | - $listings = geodir_get_widget_listings( $query_args ); |
|
360 | - } |
|
361 | - |
|
362 | - if ( ! empty( $listings ) ) { |
|
363 | - foreach ( $listings as $listing ) { |
|
364 | - create_marker_jason_of_posts( $listing ); |
|
365 | - } |
|
366 | - } |
|
367 | - |
|
368 | - ob_start(); |
|
369 | - add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array |
|
370 | - |
|
371 | - add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array |
|
372 | - |
|
373 | - add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers |
|
374 | - |
|
375 | - $default_location = geodir_get_default_location(); |
|
376 | - |
|
377 | - $map_args = array( |
|
378 | - 'map_canvas_name' => 'gd_listing_map', |
|
379 | - 'width' => $params['width'], |
|
380 | - 'height' => $params['height'], |
|
381 | - 'zoom' => $params['zoom'], |
|
382 | - 'autozoom' => $params['autozoom'], |
|
383 | - 'sticky' => $params['sticky'], |
|
384 | - 'showall' => $params['showall'], |
|
385 | - 'scrollwheel' => $params['scrollwheel'], |
|
386 | - 'maptype' => $params['maptype'], |
|
387 | - 'child_collapse' => 0, |
|
388 | - 'enable_cat_filters' => false, |
|
389 | - 'enable_text_search' => false, |
|
390 | - 'enable_post_type_filters' => false, |
|
391 | - 'enable_location_filters' => false, |
|
392 | - 'enable_jason_on_load' => true, |
|
393 | - 'ajax_url' => geodir_get_ajax_url(), |
|
394 | - 'latitude' => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '', |
|
395 | - 'longitude' => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '', |
|
396 | - 'streetViewControl' => true, |
|
397 | - 'showPreview' => '0', |
|
398 | - 'maxZoom' => 21, |
|
399 | - 'bubble_size' => 'small', |
|
400 | - ); |
|
401 | - |
|
402 | - if ( is_single() ) { |
|
403 | - global $post; |
|
404 | - if ( isset( $post->post_latitude ) ) { |
|
405 | - $map_args['latitude'] = $post->post_latitude; |
|
406 | - $map_args['longitude'] = $post->post_longitude; |
|
407 | - } |
|
408 | - |
|
409 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
410 | - } else { |
|
411 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
412 | - } |
|
413 | - |
|
414 | - // Add marker cluster |
|
415 | - if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) { |
|
416 | - $map_args['enable_marker_cluster'] = true; |
|
417 | - } else { |
|
418 | - $map_args['enable_marker_cluster'] = false; |
|
419 | - } |
|
420 | - |
|
421 | - geodir_draw_map( $map_args ); |
|
422 | - |
|
423 | - $output = ob_get_contents(); |
|
424 | - |
|
425 | - ob_end_clean(); |
|
426 | - |
|
427 | - foreach ( $backup_globals as $global => $value ) { |
|
428 | - ${$global} = $value; |
|
429 | - } |
|
430 | - |
|
431 | - return $output; |
|
432 | - }else{ |
|
433 | - ob_start(); |
|
434 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
435 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
436 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
437 | - $defaults = array( |
|
438 | - 'width' => '294', |
|
439 | - 'height' => '370', |
|
440 | - 'zoom' => '13', |
|
441 | - 'autozoom' => '', |
|
442 | - 'sticky' => '', |
|
443 | - 'showall' => '0', |
|
444 | - 'scrollwheel' => '0', |
|
445 | - 'maptype' => 'ROADMAP', |
|
446 | - 'child_collapse' => 0, |
|
447 | - 'marker_cluster' => false |
|
448 | - ); |
|
449 | - $params = shortcode_atts($defaults, $atts); |
|
450 | - $params = gdsc_validate_map_args($params); |
|
451 | - $map_args = array( |
|
452 | - 'map_canvas_name' => 'gd_listing_map', |
|
453 | - 'width' => $params['width'], |
|
454 | - 'height' => $params['height'], |
|
455 | - 'zoom' => $params['zoom'], |
|
456 | - 'autozoom' => $params['autozoom'], |
|
457 | - 'sticky' => $params['sticky'], |
|
458 | - 'showall' => $params['showall'], |
|
459 | - 'scrollwheel' => $params['scrollwheel'], |
|
460 | - 'child_collapse' => 0, |
|
461 | - 'enable_cat_filters' => false, |
|
462 | - 'enable_text_search' => false, |
|
463 | - 'enable_post_type_filters' => false, |
|
464 | - 'enable_location_filters' => false, |
|
465 | - 'enable_jason_on_load' => true, |
|
466 | - ); |
|
467 | - if (is_single()) { |
|
468 | - global $post; |
|
469 | - $map_default_lat = $address_latitude = $post->post_latitude; |
|
470 | - $map_default_lng = $address_longitude = $post->post_longitude; |
|
471 | - $mapview = $post->post_mapview; |
|
472 | - $map_args['zoom'] = $post->post_mapzoom; |
|
473 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
474 | - } else { |
|
475 | - $default_location = geodir_get_default_location(); |
|
476 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
477 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
478 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
479 | - } |
|
480 | - if (empty($mapview)) { |
|
481 | - $mapview = 'ROADMAP'; |
|
482 | - } |
|
483 | - // Set default map options |
|
484 | - $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
485 | - $map_args['latitude'] = $map_default_lat; |
|
486 | - $map_args['longitude'] = $map_default_lng; |
|
487 | - $map_args['streetViewControl'] = true; |
|
488 | - $map_args['maptype'] = $mapview; |
|
489 | - $map_args['showPreview'] = '0'; |
|
490 | - $map_args['maxZoom'] = 21; |
|
491 | - $map_args['bubble_size'] = 'small'; |
|
492 | - |
|
493 | - // Add marker cluster |
|
494 | - if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
|
495 | - $map_args['enable_marker_cluster'] = true; |
|
496 | - } else { |
|
497 | - $map_args['enable_marker_cluster'] = false; |
|
498 | - } |
|
499 | - geodir_draw_map($map_args); |
|
500 | - $output = ob_get_contents(); |
|
501 | - ob_end_clean(); |
|
502 | - return $output; |
|
503 | - } |
|
267 | + // if some params are set then we need a new query, if not then we can use the main query |
|
268 | + if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) { |
|
269 | + |
|
270 | + global $add_post_in_marker_array, $gd_sc_map_params; |
|
271 | + $backup_globals = array(); |
|
272 | + $backup_globals['add_post_in_marker_array'] = $add_post_in_marker_array; |
|
273 | + $backup_globals['gd_sc_map_params'] = $gd_sc_map_params; |
|
274 | + |
|
275 | + $defaults = array( |
|
276 | + 'width' => '294', |
|
277 | + 'height' => '370', |
|
278 | + 'zoom' => '13', |
|
279 | + 'autozoom' => '', |
|
280 | + 'sticky' => '', |
|
281 | + 'showall' => '0', |
|
282 | + 'scrollwheel' => '0', |
|
283 | + 'maptype' => 'ROADMAP', |
|
284 | + 'child_collapse' => 0, |
|
285 | + 'marker_cluster' => false, |
|
286 | + 'post_type' => 'gd_place', |
|
287 | + 'category' => '0', |
|
288 | + 'event_type' => 'all' |
|
289 | + ); |
|
290 | + |
|
291 | + $params = shortcode_atts( $defaults, $atts ); |
|
292 | + |
|
293 | + if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) { |
|
294 | + $params['post_type'] = 'gd_place'; |
|
295 | + } |
|
296 | + |
|
297 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
298 | + $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
299 | + $categories = get_terms( $category_taxonomy, array( |
|
300 | + 'orderby' => 'count', |
|
301 | + 'order' => 'DESC', |
|
302 | + 'fields' => 'ids' |
|
303 | + ) ); |
|
304 | + |
|
305 | + // Make sure we have an array |
|
306 | + if ( ! ( is_array( $params['category'] ) ) ) { |
|
307 | + $params['category'] = explode( ',', $params['category'] ); |
|
308 | + } |
|
309 | + |
|
310 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
311 | + // Otherwise it becomes empty and later on that will mean "All" |
|
312 | + $params['category'] = array_intersect( $params['category'], $categories ); |
|
313 | + |
|
314 | + if ( $params['post_type'] == 'gd_event' ) { |
|
315 | + $params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] ); |
|
316 | + } |
|
317 | + |
|
318 | + $params = gdsc_validate_map_args( $params ); |
|
319 | + |
|
320 | + $gd_sc_map_params = $params; |
|
321 | + |
|
322 | + $query_args = array( |
|
323 | + 'posts_per_page' => 1000000, //@todo kiran why was this added? |
|
324 | + 'is_geodir_loop' => true, |
|
325 | + 'gd_location' => false, |
|
326 | + 'post_type' => $params['post_type'], |
|
327 | + ); |
|
328 | + |
|
329 | + if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) { |
|
330 | + $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
331 | + |
|
332 | + ######### WPML ######### |
|
333 | + if ( function_exists( 'icl_object_id' ) ) { |
|
334 | + $category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] ); |
|
335 | + } |
|
336 | + ######### WPML ######### |
|
337 | + |
|
338 | + $tax_query = array( |
|
339 | + 'taxonomy' => $category_taxonomy[0], |
|
340 | + 'field' => 'id', |
|
341 | + 'terms' => $params['category'] |
|
342 | + ); |
|
343 | + |
|
344 | + $query_args['tax_query'] = array( $tax_query ); |
|
345 | + } |
|
346 | + |
|
347 | + $add_post_in_marker_array = true; |
|
348 | + |
|
349 | + if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) { |
|
350 | + global $geodir_event_widget_listview; |
|
351 | + $geodir_event_widget_listview = true; |
|
352 | + |
|
353 | + $query_args['geodir_event_type'] = $params['event_type']; |
|
354 | + |
|
355 | + $listings = geodir_event_get_widget_events( $query_args ); |
|
356 | + |
|
357 | + $geodir_event_widget_listview = false; |
|
358 | + } else { |
|
359 | + $listings = geodir_get_widget_listings( $query_args ); |
|
360 | + } |
|
361 | + |
|
362 | + if ( ! empty( $listings ) ) { |
|
363 | + foreach ( $listings as $listing ) { |
|
364 | + create_marker_jason_of_posts( $listing ); |
|
365 | + } |
|
366 | + } |
|
367 | + |
|
368 | + ob_start(); |
|
369 | + add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array |
|
370 | + |
|
371 | + add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array |
|
372 | + |
|
373 | + add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers |
|
374 | + |
|
375 | + $default_location = geodir_get_default_location(); |
|
376 | + |
|
377 | + $map_args = array( |
|
378 | + 'map_canvas_name' => 'gd_listing_map', |
|
379 | + 'width' => $params['width'], |
|
380 | + 'height' => $params['height'], |
|
381 | + 'zoom' => $params['zoom'], |
|
382 | + 'autozoom' => $params['autozoom'], |
|
383 | + 'sticky' => $params['sticky'], |
|
384 | + 'showall' => $params['showall'], |
|
385 | + 'scrollwheel' => $params['scrollwheel'], |
|
386 | + 'maptype' => $params['maptype'], |
|
387 | + 'child_collapse' => 0, |
|
388 | + 'enable_cat_filters' => false, |
|
389 | + 'enable_text_search' => false, |
|
390 | + 'enable_post_type_filters' => false, |
|
391 | + 'enable_location_filters' => false, |
|
392 | + 'enable_jason_on_load' => true, |
|
393 | + 'ajax_url' => geodir_get_ajax_url(), |
|
394 | + 'latitude' => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '', |
|
395 | + 'longitude' => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '', |
|
396 | + 'streetViewControl' => true, |
|
397 | + 'showPreview' => '0', |
|
398 | + 'maxZoom' => 21, |
|
399 | + 'bubble_size' => 'small', |
|
400 | + ); |
|
401 | + |
|
402 | + if ( is_single() ) { |
|
403 | + global $post; |
|
404 | + if ( isset( $post->post_latitude ) ) { |
|
405 | + $map_args['latitude'] = $post->post_latitude; |
|
406 | + $map_args['longitude'] = $post->post_longitude; |
|
407 | + } |
|
408 | + |
|
409 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
410 | + } else { |
|
411 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
412 | + } |
|
413 | + |
|
414 | + // Add marker cluster |
|
415 | + if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) { |
|
416 | + $map_args['enable_marker_cluster'] = true; |
|
417 | + } else { |
|
418 | + $map_args['enable_marker_cluster'] = false; |
|
419 | + } |
|
420 | + |
|
421 | + geodir_draw_map( $map_args ); |
|
422 | + |
|
423 | + $output = ob_get_contents(); |
|
424 | + |
|
425 | + ob_end_clean(); |
|
426 | + |
|
427 | + foreach ( $backup_globals as $global => $value ) { |
|
428 | + ${$global} = $value; |
|
429 | + } |
|
430 | + |
|
431 | + return $output; |
|
432 | + }else{ |
|
433 | + ob_start(); |
|
434 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
435 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
436 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
437 | + $defaults = array( |
|
438 | + 'width' => '294', |
|
439 | + 'height' => '370', |
|
440 | + 'zoom' => '13', |
|
441 | + 'autozoom' => '', |
|
442 | + 'sticky' => '', |
|
443 | + 'showall' => '0', |
|
444 | + 'scrollwheel' => '0', |
|
445 | + 'maptype' => 'ROADMAP', |
|
446 | + 'child_collapse' => 0, |
|
447 | + 'marker_cluster' => false |
|
448 | + ); |
|
449 | + $params = shortcode_atts($defaults, $atts); |
|
450 | + $params = gdsc_validate_map_args($params); |
|
451 | + $map_args = array( |
|
452 | + 'map_canvas_name' => 'gd_listing_map', |
|
453 | + 'width' => $params['width'], |
|
454 | + 'height' => $params['height'], |
|
455 | + 'zoom' => $params['zoom'], |
|
456 | + 'autozoom' => $params['autozoom'], |
|
457 | + 'sticky' => $params['sticky'], |
|
458 | + 'showall' => $params['showall'], |
|
459 | + 'scrollwheel' => $params['scrollwheel'], |
|
460 | + 'child_collapse' => 0, |
|
461 | + 'enable_cat_filters' => false, |
|
462 | + 'enable_text_search' => false, |
|
463 | + 'enable_post_type_filters' => false, |
|
464 | + 'enable_location_filters' => false, |
|
465 | + 'enable_jason_on_load' => true, |
|
466 | + ); |
|
467 | + if (is_single()) { |
|
468 | + global $post; |
|
469 | + $map_default_lat = $address_latitude = $post->post_latitude; |
|
470 | + $map_default_lng = $address_longitude = $post->post_longitude; |
|
471 | + $mapview = $post->post_mapview; |
|
472 | + $map_args['zoom'] = $post->post_mapzoom; |
|
473 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
474 | + } else { |
|
475 | + $default_location = geodir_get_default_location(); |
|
476 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
477 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
478 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
479 | + } |
|
480 | + if (empty($mapview)) { |
|
481 | + $mapview = 'ROADMAP'; |
|
482 | + } |
|
483 | + // Set default map options |
|
484 | + $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
485 | + $map_args['latitude'] = $map_default_lat; |
|
486 | + $map_args['longitude'] = $map_default_lng; |
|
487 | + $map_args['streetViewControl'] = true; |
|
488 | + $map_args['maptype'] = $mapview; |
|
489 | + $map_args['showPreview'] = '0'; |
|
490 | + $map_args['maxZoom'] = 21; |
|
491 | + $map_args['bubble_size'] = 'small'; |
|
492 | + |
|
493 | + // Add marker cluster |
|
494 | + if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
|
495 | + $map_args['enable_marker_cluster'] = true; |
|
496 | + } else { |
|
497 | + $map_args['enable_marker_cluster'] = false; |
|
498 | + } |
|
499 | + geodir_draw_map($map_args); |
|
500 | + $output = ob_get_contents(); |
|
501 | + ob_end_clean(); |
|
502 | + return $output; |
|
503 | + } |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider'); |
@@ -533,120 +533,120 @@ discard block |
||
533 | 533 | */ |
534 | 534 | function geodir_sc_listing_slider($atts) |
535 | 535 | { |
536 | - ob_start(); |
|
537 | - $defaults = array( |
|
538 | - 'post_type' => 'gd_place', |
|
539 | - 'category' => '0', |
|
540 | - 'post_number' => '5', |
|
541 | - 'slideshow' => '0', |
|
542 | - 'animation_loop' => 0, |
|
543 | - 'direction_nav' => 0, |
|
544 | - 'slideshow_speed' => 5000, |
|
545 | - 'animation_speed' => 600, |
|
546 | - 'animation' => 'slide', |
|
547 | - 'order_by' => 'latest', |
|
548 | - 'show_title' => '', |
|
549 | - 'show_featured_only' => '', |
|
550 | - 'title' => '', |
|
551 | - ); |
|
552 | - |
|
553 | - $params = shortcode_atts($defaults, $atts); |
|
554 | - |
|
555 | - |
|
556 | - /* |
|
536 | + ob_start(); |
|
537 | + $defaults = array( |
|
538 | + 'post_type' => 'gd_place', |
|
539 | + 'category' => '0', |
|
540 | + 'post_number' => '5', |
|
541 | + 'slideshow' => '0', |
|
542 | + 'animation_loop' => 0, |
|
543 | + 'direction_nav' => 0, |
|
544 | + 'slideshow_speed' => 5000, |
|
545 | + 'animation_speed' => 600, |
|
546 | + 'animation' => 'slide', |
|
547 | + 'order_by' => 'latest', |
|
548 | + 'show_title' => '', |
|
549 | + 'show_featured_only' => '', |
|
550 | + 'title' => '', |
|
551 | + ); |
|
552 | + |
|
553 | + $params = shortcode_atts($defaults, $atts); |
|
554 | + |
|
555 | + |
|
556 | + /* |
|
557 | 557 | * |
558 | 558 | * Now we begin the validation of the attributes. |
559 | 559 | */ |
560 | - // Check we have a valid post_type |
|
561 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
562 | - $params['post_type'] = 'gd_place'; |
|
563 | - } |
|
564 | - |
|
565 | - // Check we have a valid sort_order |
|
566 | - $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
567 | - |
|
568 | - // Match the chosen animation to our options |
|
569 | - $animation_list = array('slide', 'fade'); |
|
570 | - if (!(in_array($params['animation'], $animation_list))) { |
|
571 | - $params['animation'] = 'slide'; |
|
572 | - } |
|
573 | - |
|
574 | - // Post_number needs to be a positive integer |
|
575 | - $params['post_number'] = absint($params['post_number']); |
|
576 | - if (0 == $params['post_number']) { |
|
577 | - $params['post_number'] = 1; |
|
578 | - } |
|
579 | - |
|
580 | - // Manage the entered categories |
|
581 | - if (0 != $params['category'] || '' != $params['category']) { |
|
582 | - $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
583 | - } |
|
584 | - // Convert show_title to a bool |
|
585 | - $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
586 | - |
|
587 | - // Convert show_featured_only to a bool |
|
588 | - $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
589 | - |
|
590 | - /* |
|
560 | + // Check we have a valid post_type |
|
561 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
562 | + $params['post_type'] = 'gd_place'; |
|
563 | + } |
|
564 | + |
|
565 | + // Check we have a valid sort_order |
|
566 | + $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
567 | + |
|
568 | + // Match the chosen animation to our options |
|
569 | + $animation_list = array('slide', 'fade'); |
|
570 | + if (!(in_array($params['animation'], $animation_list))) { |
|
571 | + $params['animation'] = 'slide'; |
|
572 | + } |
|
573 | + |
|
574 | + // Post_number needs to be a positive integer |
|
575 | + $params['post_number'] = absint($params['post_number']); |
|
576 | + if (0 == $params['post_number']) { |
|
577 | + $params['post_number'] = 1; |
|
578 | + } |
|
579 | + |
|
580 | + // Manage the entered categories |
|
581 | + if (0 != $params['category'] || '' != $params['category']) { |
|
582 | + $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
583 | + } |
|
584 | + // Convert show_title to a bool |
|
585 | + $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
586 | + |
|
587 | + // Convert show_featured_only to a bool |
|
588 | + $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
589 | + |
|
590 | + /* |
|
591 | 591 | * Hopefully all attributes are now valid, and safe to pass forward |
592 | 592 | */ |
593 | 593 | |
594 | - // redeclare vars after validation |
|
595 | - |
|
596 | - if (isset($params['direction_nav'])) { |
|
597 | - $params['directionNav'] = $params['direction_nav']; |
|
598 | - } |
|
599 | - if (isset($params['animation_loop'])) { |
|
600 | - $params['animationLoop'] = $params['animation_loop']; |
|
601 | - } |
|
602 | - if (isset($params['slideshow_speed'])) { |
|
603 | - $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
604 | - } |
|
605 | - if (isset($params['animation_speed'])) { |
|
606 | - $params['animationSpeed'] = $params['animation_speed']; |
|
607 | - } |
|
608 | - if (isset($params['order_by'])) { |
|
609 | - $params['list_sort'] = $params['order_by']; |
|
610 | - } |
|
611 | - |
|
612 | - $query_args = array( |
|
613 | - 'post_number' => $params['post_number'], |
|
614 | - 'is_geodir_loop' => true, |
|
615 | - 'post_type' => $params['post_type'], |
|
616 | - 'order_by' => $params['order_by'] |
|
617 | - ); |
|
618 | - |
|
619 | - if (1 == $params['show_featured_only']) { |
|
620 | - $query_args['show_featured_only'] = 1; |
|
621 | - } |
|
622 | - |
|
623 | - if (0 != $params['category'] && '' != $params['category']) { |
|
624 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
625 | - $tax_query = array( |
|
626 | - 'taxonomy' => $category_taxonomy[0], |
|
627 | - 'field' => 'id', |
|
628 | - 'terms' => $params['category'], |
|
629 | - ); |
|
630 | - |
|
631 | - $query_args['tax_query'] = array($tax_query); |
|
632 | - } |
|
633 | - |
|
634 | - $defaults = array( |
|
635 | - 'before_widget' => '', |
|
636 | - 'after_widget' => '', |
|
637 | - 'before_title' => '', |
|
638 | - 'after_title' => '', |
|
639 | - ); |
|
640 | - |
|
641 | - $query_args = array_merge($query_args, $params); |
|
642 | - |
|
643 | - geodir_listing_slider_widget_output($defaults, $query_args); |
|
644 | - |
|
645 | - $output = ob_get_contents(); |
|
646 | - |
|
647 | - ob_end_clean(); |
|
648 | - |
|
649 | - return $output; |
|
594 | + // redeclare vars after validation |
|
595 | + |
|
596 | + if (isset($params['direction_nav'])) { |
|
597 | + $params['directionNav'] = $params['direction_nav']; |
|
598 | + } |
|
599 | + if (isset($params['animation_loop'])) { |
|
600 | + $params['animationLoop'] = $params['animation_loop']; |
|
601 | + } |
|
602 | + if (isset($params['slideshow_speed'])) { |
|
603 | + $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
604 | + } |
|
605 | + if (isset($params['animation_speed'])) { |
|
606 | + $params['animationSpeed'] = $params['animation_speed']; |
|
607 | + } |
|
608 | + if (isset($params['order_by'])) { |
|
609 | + $params['list_sort'] = $params['order_by']; |
|
610 | + } |
|
611 | + |
|
612 | + $query_args = array( |
|
613 | + 'post_number' => $params['post_number'], |
|
614 | + 'is_geodir_loop' => true, |
|
615 | + 'post_type' => $params['post_type'], |
|
616 | + 'order_by' => $params['order_by'] |
|
617 | + ); |
|
618 | + |
|
619 | + if (1 == $params['show_featured_only']) { |
|
620 | + $query_args['show_featured_only'] = 1; |
|
621 | + } |
|
622 | + |
|
623 | + if (0 != $params['category'] && '' != $params['category']) { |
|
624 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
625 | + $tax_query = array( |
|
626 | + 'taxonomy' => $category_taxonomy[0], |
|
627 | + 'field' => 'id', |
|
628 | + 'terms' => $params['category'], |
|
629 | + ); |
|
630 | + |
|
631 | + $query_args['tax_query'] = array($tax_query); |
|
632 | + } |
|
633 | + |
|
634 | + $defaults = array( |
|
635 | + 'before_widget' => '', |
|
636 | + 'after_widget' => '', |
|
637 | + 'before_title' => '', |
|
638 | + 'after_title' => '', |
|
639 | + ); |
|
640 | + |
|
641 | + $query_args = array_merge($query_args, $params); |
|
642 | + |
|
643 | + geodir_listing_slider_widget_output($defaults, $query_args); |
|
644 | + |
|
645 | + $output = ob_get_contents(); |
|
646 | + |
|
647 | + ob_end_clean(); |
|
648 | + |
|
649 | + return $output; |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | add_shortcode('gd_login_box', 'geodir_sc_login_box'); |
@@ -670,22 +670,22 @@ discard block |
||
670 | 670 | */ |
671 | 671 | function geodir_sc_login_box($atts) |
672 | 672 | { |
673 | - ob_start(); |
|
673 | + ob_start(); |
|
674 | 674 | |
675 | - $defaults = array( |
|
676 | - 'before_widget' => '', |
|
677 | - 'after_widget' => '', |
|
678 | - 'before_title' => '', |
|
679 | - 'after_title' => '', |
|
680 | - ); |
|
675 | + $defaults = array( |
|
676 | + 'before_widget' => '', |
|
677 | + 'after_widget' => '', |
|
678 | + 'before_title' => '', |
|
679 | + 'after_title' => '', |
|
680 | + ); |
|
681 | 681 | |
682 | - geodir_loginwidget_output($defaults, $defaults); |
|
682 | + geodir_loginwidget_output($defaults, $defaults); |
|
683 | 683 | |
684 | - $output = ob_get_contents(); |
|
684 | + $output = ob_get_contents(); |
|
685 | 685 | |
686 | - ob_end_clean(); |
|
686 | + ob_end_clean(); |
|
687 | 687 | |
688 | - return $output; |
|
688 | + return $output; |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category'); |
@@ -716,31 +716,31 @@ discard block |
||
716 | 716 | */ |
717 | 717 | function geodir_sc_popular_post_category($atts) |
718 | 718 | { |
719 | - ob_start(); |
|
720 | - global $geodir_post_category_str; |
|
721 | - $defaults = array( |
|
722 | - 'category_limit' => 15, |
|
723 | - 'category_restrict' => false, |
|
724 | - 'before_widget' => '', |
|
725 | - 'after_widget' => '', |
|
726 | - 'before_title' => '', |
|
727 | - 'after_title' => '', |
|
728 | - 'title' => '', |
|
729 | - 'default_post_type' => '', |
|
730 | - 'parent_only' => false, |
|
731 | - ); |
|
732 | - |
|
733 | - $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
734 | - $params['category_limit'] = absint($params['category_limit']); |
|
735 | - $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; |
|
736 | - $params['parent_only'] = gdsc_to_bool_val($params['parent_only']); |
|
737 | - geodir_popular_post_category_output($params, $params); |
|
738 | - |
|
739 | - $output = ob_get_contents(); |
|
740 | - |
|
741 | - ob_end_clean(); |
|
742 | - |
|
743 | - return $output; |
|
719 | + ob_start(); |
|
720 | + global $geodir_post_category_str; |
|
721 | + $defaults = array( |
|
722 | + 'category_limit' => 15, |
|
723 | + 'category_restrict' => false, |
|
724 | + 'before_widget' => '', |
|
725 | + 'after_widget' => '', |
|
726 | + 'before_title' => '', |
|
727 | + 'after_title' => '', |
|
728 | + 'title' => '', |
|
729 | + 'default_post_type' => '', |
|
730 | + 'parent_only' => false, |
|
731 | + ); |
|
732 | + |
|
733 | + $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
734 | + $params['category_limit'] = absint($params['category_limit']); |
|
735 | + $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; |
|
736 | + $params['parent_only'] = gdsc_to_bool_val($params['parent_only']); |
|
737 | + geodir_popular_post_category_output($params, $params); |
|
738 | + |
|
739 | + $output = ob_get_contents(); |
|
740 | + |
|
741 | + ob_end_clean(); |
|
742 | + |
|
743 | + return $output; |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view'); |
@@ -780,97 +780,97 @@ discard block |
||
780 | 780 | */ |
781 | 781 | function geodir_sc_popular_post_view($atts) |
782 | 782 | { |
783 | - ob_start(); |
|
784 | - $defaults = array( |
|
785 | - 'post_type' => 'gd_place', |
|
786 | - 'category' => '0', |
|
787 | - 'post_number' => '5', |
|
788 | - 'layout' => 'gridview_onehalf', |
|
789 | - 'add_location_filter' => '0', |
|
790 | - 'list_sort' => 'latest', |
|
791 | - 'use_viewing_post_type' => '1', |
|
792 | - 'character_count' => '20', |
|
793 | - 'listing_width' => '', |
|
794 | - 'show_featured_only' => '0', |
|
795 | - 'show_special_only' => '0', |
|
796 | - 'with_pics_only' => '0', |
|
797 | - 'with_videos_only' => '0', |
|
798 | - 'before_widget' => '', |
|
799 | - 'after_widget' => '', |
|
800 | - 'before_title' => '<h3 class="widget-title">', |
|
801 | - 'after_title' => '</h3>', |
|
802 | - 'title' => '', |
|
803 | - 'category_title' => '', |
|
804 | - ); |
|
805 | - |
|
806 | - $params = shortcode_atts($defaults, $atts); |
|
807 | - |
|
808 | - /** |
|
809 | - * Validate our incoming params |
|
810 | - */ |
|
783 | + ob_start(); |
|
784 | + $defaults = array( |
|
785 | + 'post_type' => 'gd_place', |
|
786 | + 'category' => '0', |
|
787 | + 'post_number' => '5', |
|
788 | + 'layout' => 'gridview_onehalf', |
|
789 | + 'add_location_filter' => '0', |
|
790 | + 'list_sort' => 'latest', |
|
791 | + 'use_viewing_post_type' => '1', |
|
792 | + 'character_count' => '20', |
|
793 | + 'listing_width' => '', |
|
794 | + 'show_featured_only' => '0', |
|
795 | + 'show_special_only' => '0', |
|
796 | + 'with_pics_only' => '0', |
|
797 | + 'with_videos_only' => '0', |
|
798 | + 'before_widget' => '', |
|
799 | + 'after_widget' => '', |
|
800 | + 'before_title' => '<h3 class="widget-title">', |
|
801 | + 'after_title' => '</h3>', |
|
802 | + 'title' => '', |
|
803 | + 'category_title' => '', |
|
804 | + ); |
|
811 | 805 | |
812 | - // Validate the selected post type, default to gd_place on fail |
|
813 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
814 | - $params['post_type'] = 'gd_place'; |
|
815 | - } |
|
816 | - |
|
817 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
818 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
819 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
820 | - |
|
821 | - // Make sure we have an array |
|
822 | - if (!(is_array($params['category']))) { |
|
823 | - $params['category'] = explode(',', $params['category']); |
|
824 | - } |
|
825 | - |
|
826 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
827 | - // Otherwise it becomes empty and later on that will mean "All" |
|
828 | - $params['category'] = array_intersect($params['category'], $categories); |
|
829 | - |
|
830 | - // Post_number needs to be a positive integer |
|
831 | - $params['post_number'] = absint($params['post_number']); |
|
832 | - if (0 == $params['post_number']) { |
|
833 | - $params['post_number'] = 1; |
|
834 | - } |
|
835 | - |
|
836 | - // Validate our layout choice |
|
837 | - // Outside of the norm, I added some more simple terms to match the existing |
|
838 | - // So now I just run the switch to set it properly. |
|
839 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
840 | - |
|
841 | - // Validate our sorting choice |
|
842 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
843 | - |
|
844 | - // Validate character_count |
|
845 | - $params['character_count'] = absint($params['character_count']); |
|
846 | - if (20 > $params['character_count']) { |
|
847 | - $params['character_count'] = 20; |
|
848 | - } |
|
849 | - |
|
850 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
851 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
852 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
853 | - |
|
854 | - // Validate the checkboxes used on the widget |
|
855 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
856 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
857 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
858 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
859 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
860 | - $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
861 | - |
|
862 | - /** |
|
863 | - * End of validation |
|
864 | - */ |
|
806 | + $params = shortcode_atts($defaults, $atts); |
|
807 | + |
|
808 | + /** |
|
809 | + * Validate our incoming params |
|
810 | + */ |
|
811 | + |
|
812 | + // Validate the selected post type, default to gd_place on fail |
|
813 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
814 | + $params['post_type'] = 'gd_place'; |
|
815 | + } |
|
816 | + |
|
817 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
818 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
819 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
820 | + |
|
821 | + // Make sure we have an array |
|
822 | + if (!(is_array($params['category']))) { |
|
823 | + $params['category'] = explode(',', $params['category']); |
|
824 | + } |
|
865 | 825 | |
866 | - geodir_popular_postview_output($params, $params); |
|
826 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
827 | + // Otherwise it becomes empty and later on that will mean "All" |
|
828 | + $params['category'] = array_intersect($params['category'], $categories); |
|
867 | 829 | |
830 | + // Post_number needs to be a positive integer |
|
831 | + $params['post_number'] = absint($params['post_number']); |
|
832 | + if (0 == $params['post_number']) { |
|
833 | + $params['post_number'] = 1; |
|
834 | + } |
|
835 | + |
|
836 | + // Validate our layout choice |
|
837 | + // Outside of the norm, I added some more simple terms to match the existing |
|
838 | + // So now I just run the switch to set it properly. |
|
839 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
840 | + |
|
841 | + // Validate our sorting choice |
|
842 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
843 | + |
|
844 | + // Validate character_count |
|
845 | + $params['character_count'] = absint($params['character_count']); |
|
846 | + if (20 > $params['character_count']) { |
|
847 | + $params['character_count'] = 20; |
|
848 | + } |
|
849 | + |
|
850 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
851 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
852 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
868 | 853 | |
869 | - $output = ob_get_contents(); |
|
854 | + // Validate the checkboxes used on the widget |
|
855 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
856 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
857 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
858 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
859 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
860 | + $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
870 | 861 | |
871 | - ob_end_clean(); |
|
862 | + /** |
|
863 | + * End of validation |
|
864 | + */ |
|
872 | 865 | |
873 | - return $output; |
|
866 | + geodir_popular_postview_output($params, $params); |
|
867 | + |
|
868 | + |
|
869 | + $output = ob_get_contents(); |
|
870 | + |
|
871 | + ob_end_clean(); |
|
872 | + |
|
873 | + return $output; |
|
874 | 874 | } |
875 | 875 | |
876 | 876 | add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews'); |
@@ -892,37 +892,37 @@ discard block |
||
892 | 892 | * @return string Recent reviews HTML. |
893 | 893 | */ |
894 | 894 | function geodir_sc_recent_reviews($atts) { |
895 | - ob_start(); |
|
896 | - $defaults = array( |
|
895 | + ob_start(); |
|
896 | + $defaults = array( |
|
897 | 897 | 'title' => '', |
898 | 898 | 'count' => 5, |
899 | - ); |
|
899 | + ); |
|
900 | 900 | |
901 | - $params = shortcode_atts($defaults, $atts); |
|
901 | + $params = shortcode_atts($defaults, $atts); |
|
902 | 902 | |
903 | - $count = absint($params['count']); |
|
904 | - if (0 == $count) { |
|
905 | - $count = 1; |
|
906 | - } |
|
903 | + $count = absint($params['count']); |
|
904 | + if (0 == $count) { |
|
905 | + $count = 1; |
|
906 | + } |
|
907 | 907 | |
908 | 908 | $title = !empty($params['title']) ? __($params['title'], 'geodirectory') : ''; |
909 | 909 | |
910 | - $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
910 | + $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
911 | 911 | |
912 | - if ($comments_li) { |
|
913 | - if ($title != '') { ?> |
|
912 | + if ($comments_li) { |
|
913 | + if ($title != '') { ?> |
|
914 | 914 | <h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3> |
915 | 915 | <?php } ?> |
916 | 916 | <div class="geodir_sc_recent_reviews_section"> |
917 | 917 | <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul> |
918 | 918 | </div> |
919 | 919 | <?php |
920 | - } |
|
921 | - $output = ob_get_contents(); |
|
920 | + } |
|
921 | + $output = ob_get_contents(); |
|
922 | 922 | |
923 | - ob_end_clean(); |
|
923 | + ob_end_clean(); |
|
924 | 924 | |
925 | - return $output; |
|
925 | + return $output; |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | add_shortcode('gd_related_listings', 'geodir_sc_related_listings'); |
@@ -952,64 +952,64 @@ discard block |
||
952 | 952 | */ |
953 | 953 | function geodir_sc_related_listings($atts) |
954 | 954 | { |
955 | - ob_start(); |
|
956 | - $defaults = array( |
|
957 | - 'post_number' => 5, |
|
958 | - 'relate_to' => 'category', |
|
959 | - 'layout' => 'gridview_onehalf', |
|
960 | - 'add_location_filter' => 0, |
|
961 | - 'listing_width' => '', |
|
962 | - 'list_sort' => 'latest', |
|
963 | - 'character_count' => 20, |
|
964 | - 'is_widget' => 1, |
|
965 | - 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
966 | - ); |
|
967 | - // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
968 | - |
|
969 | - $params = shortcode_atts($defaults, $atts); |
|
970 | - |
|
971 | - /** |
|
972 | - * Begin validating parameters |
|
973 | - */ |
|
955 | + ob_start(); |
|
956 | + $defaults = array( |
|
957 | + 'post_number' => 5, |
|
958 | + 'relate_to' => 'category', |
|
959 | + 'layout' => 'gridview_onehalf', |
|
960 | + 'add_location_filter' => 0, |
|
961 | + 'listing_width' => '', |
|
962 | + 'list_sort' => 'latest', |
|
963 | + 'character_count' => 20, |
|
964 | + 'is_widget' => 1, |
|
965 | + 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
966 | + ); |
|
967 | + // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
974 | 968 | |
975 | - // Validate that post_number is a number and is 1 or higher |
|
976 | - $params['post_number'] = absint($params['post_number']); |
|
977 | - if (0 === $params['post_number']) { |
|
978 | - $params['post_number'] = 1; |
|
979 | - } |
|
969 | + $params = shortcode_atts($defaults, $atts); |
|
980 | 970 | |
981 | - // Validate relate_to - only category or tags |
|
982 | - $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
983 | - if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
984 | - $params['relate_to'] = 'category'; |
|
985 | - } |
|
971 | + /** |
|
972 | + * Begin validating parameters |
|
973 | + */ |
|
986 | 974 | |
987 | - // Validate layout selection |
|
988 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
975 | + // Validate that post_number is a number and is 1 or higher |
|
976 | + $params['post_number'] = absint($params['post_number']); |
|
977 | + if (0 === $params['post_number']) { |
|
978 | + $params['post_number'] = 1; |
|
979 | + } |
|
989 | 980 | |
990 | - // Validate sorting option |
|
991 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
981 | + // Validate relate_to - only category or tags |
|
982 | + $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
983 | + if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
984 | + $params['relate_to'] = 'category'; |
|
985 | + } |
|
986 | + |
|
987 | + // Validate layout selection |
|
988 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
992 | 989 | |
993 | - // Validate add_location_filter |
|
994 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
990 | + // Validate sorting option |
|
991 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
995 | 992 | |
996 | - // Validate listing_width |
|
997 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
993 | + // Validate add_location_filter |
|
994 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
998 | 995 | |
999 | - // Validate character_count |
|
1000 | - $params['character_count'] = absint($params['character_count']); |
|
1001 | - if (20 > $params['character_count']) { |
|
1002 | - $params['character_count'] = 20; |
|
1003 | - } |
|
996 | + // Validate listing_width |
|
997 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1004 | 998 | |
1005 | - if ($related_display = geodir_related_posts_display($params)) { |
|
1006 | - echo $related_display; |
|
1007 | - } |
|
1008 | - $output = ob_get_contents(); |
|
999 | + // Validate character_count |
|
1000 | + $params['character_count'] = absint($params['character_count']); |
|
1001 | + if (20 > $params['character_count']) { |
|
1002 | + $params['character_count'] = 20; |
|
1003 | + } |
|
1004 | + |
|
1005 | + if ($related_display = geodir_related_posts_display($params)) { |
|
1006 | + echo $related_display; |
|
1007 | + } |
|
1008 | + $output = ob_get_contents(); |
|
1009 | 1009 | |
1010 | - ob_end_clean(); |
|
1010 | + ob_end_clean(); |
|
1011 | 1011 | |
1012 | - return $output; |
|
1012 | + return $output; |
|
1013 | 1013 | } |
1014 | 1014 | |
1015 | 1015 | /** |
@@ -1033,13 +1033,13 @@ discard block |
||
1033 | 1033 | * @return string Advanced search widget HTML. |
1034 | 1034 | */ |
1035 | 1035 | function geodir_sc_advanced_search($atts) { |
1036 | - $defaults = array( |
|
1036 | + $defaults = array( |
|
1037 | 1037 | 'title' => '', |
1038 | 1038 | 'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advance_search_widget">', |
1039 | - 'after_widget' => '</section>', |
|
1040 | - 'before_title' => '<h3 class="widget-title">', |
|
1041 | - 'after_title' => '</h3>', |
|
1042 | - 'show_adv_search' => 'default', |
|
1039 | + 'after_widget' => '</section>', |
|
1040 | + 'before_title' => '<h3 class="widget-title">', |
|
1041 | + 'after_title' => '</h3>', |
|
1042 | + 'show_adv_search' => 'default', |
|
1043 | 1043 | 'post_type' => '' |
1044 | 1044 | ); |
1045 | 1045 | |
@@ -1063,9 +1063,9 @@ discard block |
||
1063 | 1063 | the_widget('geodir_advance_search_widget', $params, $params ); |
1064 | 1064 | |
1065 | 1065 | $output = ob_get_contents(); |
1066 | - ob_end_clean(); |
|
1066 | + ob_end_clean(); |
|
1067 | 1067 | |
1068 | - return $output; |
|
1068 | + return $output; |
|
1069 | 1069 | } |
1070 | 1070 | add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search'); |
1071 | 1071 | |
@@ -1111,48 +1111,48 @@ discard block |
||
1111 | 1111 | 'add_location_filter' => '1', |
1112 | 1112 | 'tab_layout' => 'bestof-tabs-on-top', |
1113 | 1113 | 'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">', |
1114 | - 'after_widget' => '</section>', |
|
1115 | - 'before_title' => '<h3 class="widget-title">', |
|
1116 | - 'after_title' => '</h3>', |
|
1114 | + 'after_widget' => '</section>', |
|
1115 | + 'before_title' => '<h3 class="widget-title">', |
|
1116 | + 'after_title' => '</h3>', |
|
1117 | 1117 | ); |
1118 | 1118 | $params = shortcode_atts($defaults, $atts); |
1119 | 1119 | |
1120 | - /** |
|
1121 | - * Validate our incoming params |
|
1122 | - */ |
|
1120 | + /** |
|
1121 | + * Validate our incoming params |
|
1122 | + */ |
|
1123 | 1123 | |
1124 | - // Validate the selected post type, default to gd_place on fail |
|
1125 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
1126 | - $params['post_type'] = 'gd_place'; |
|
1127 | - } |
|
1124 | + // Validate the selected post type, default to gd_place on fail |
|
1125 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
1126 | + $params['post_type'] = 'gd_place'; |
|
1127 | + } |
|
1128 | 1128 | |
1129 | 1129 | // Post limit needs to be a positive integer |
1130 | - $params['post_limit'] = absint($params['post_limit']); |
|
1131 | - if (0 == $params['post_limit']) { |
|
1132 | - $params['post_limit'] = 5; |
|
1133 | - } |
|
1130 | + $params['post_limit'] = absint($params['post_limit']); |
|
1131 | + if (0 == $params['post_limit']) { |
|
1132 | + $params['post_limit'] = 5; |
|
1133 | + } |
|
1134 | 1134 | |
1135 | 1135 | // Category limit needs to be a positive integer |
1136 | - $params['categ_limit'] = absint($params['categ_limit']); |
|
1137 | - if (0 == $params['categ_limit']) { |
|
1138 | - $params['categ_limit'] = 3; |
|
1139 | - } |
|
1136 | + $params['categ_limit'] = absint($params['categ_limit']); |
|
1137 | + if (0 == $params['categ_limit']) { |
|
1138 | + $params['categ_limit'] = 3; |
|
1139 | + } |
|
1140 | 1140 | |
1141 | 1141 | // Tab layout validation |
1142 | - $params['tab_layout'] = $params['tab_layout']; |
|
1143 | - if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
1144 | - $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
1145 | - } |
|
1142 | + $params['tab_layout'] = $params['tab_layout']; |
|
1143 | + if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
1144 | + $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
1145 | + } |
|
1146 | 1146 | |
1147 | 1147 | // Validate character_count |
1148 | - $params['character_count'] = $params['character_count']; |
|
1148 | + $params['character_count'] = $params['character_count']; |
|
1149 | 1149 | |
1150 | 1150 | ob_start(); |
1151 | 1151 | the_widget('geodir_bestof_widget', $params, $params); |
1152 | - $output = ob_get_contents(); |
|
1153 | - ob_end_clean(); |
|
1152 | + $output = ob_get_contents(); |
|
1153 | + ob_end_clean(); |
|
1154 | 1154 | |
1155 | - return $output; |
|
1155 | + return $output; |
|
1156 | 1156 | } |
1157 | 1157 | add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget'); |
1158 | 1158 | |
@@ -1204,143 +1204,143 @@ discard block |
||
1204 | 1204 | * @return string HTML content to display geodirectory listings. |
1205 | 1205 | */ |
1206 | 1206 | function geodir_sc_gd_listings($atts, $content = '') { |
1207 | - global $post; |
|
1208 | - $defaults = array( |
|
1209 | - 'title' => '', |
|
1210 | - 'post_type' => 'gd_place', |
|
1211 | - 'category' => 0, |
|
1212 | - 'list_sort' => 'latest', |
|
1213 | - 'event_type' => '', |
|
1214 | - 'post_number' => 10, |
|
1215 | - 'post_author' => '', |
|
1216 | - 'layout' => 'gridview_onehalf', |
|
1217 | - 'listing_width' => '', |
|
1218 | - 'character_count' => 20, |
|
1219 | - 'add_location_filter' => 1, |
|
1220 | - 'show_featured_only' => '', |
|
1221 | - 'show_special_only' => '', |
|
1222 | - 'with_pics_only' => '', |
|
1223 | - 'with_videos_only' => '', |
|
1224 | - 'with_pagination' => '1', |
|
1225 | - 'top_pagination' => '0', |
|
1226 | - 'bottom_pagination' => '1', |
|
1227 | - 'without_no_results' => 0, |
|
1228 | - 'tags' => '', |
|
1229 | - 'show_favorites_only' => '', |
|
1230 | - 'favorites_by_user' => '', |
|
1231 | - ); |
|
1232 | - $params = shortcode_atts($defaults, $atts); |
|
1233 | - |
|
1234 | - $params['title'] = wp_strip_all_tags($params['title']); |
|
1235 | - $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
1236 | - |
|
1237 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
1238 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
1239 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
1240 | - |
|
1241 | - // Make sure we have an array |
|
1242 | - if (!(is_array($params['category']))) { |
|
1243 | - $params['category'] = explode(',', $params['category']); |
|
1244 | - } |
|
1245 | - |
|
1246 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
1247 | - // Otherwise it becomes empty and later on that will mean "All" |
|
1248 | - $params['category'] = array_intersect($params['category'], $categories); |
|
1249 | - |
|
1250 | - // Post_number needs to be a positive integer |
|
1251 | - $params['post_number'] = absint($params['post_number']); |
|
1252 | - $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
1207 | + global $post; |
|
1208 | + $defaults = array( |
|
1209 | + 'title' => '', |
|
1210 | + 'post_type' => 'gd_place', |
|
1211 | + 'category' => 0, |
|
1212 | + 'list_sort' => 'latest', |
|
1213 | + 'event_type' => '', |
|
1214 | + 'post_number' => 10, |
|
1215 | + 'post_author' => '', |
|
1216 | + 'layout' => 'gridview_onehalf', |
|
1217 | + 'listing_width' => '', |
|
1218 | + 'character_count' => 20, |
|
1219 | + 'add_location_filter' => 1, |
|
1220 | + 'show_featured_only' => '', |
|
1221 | + 'show_special_only' => '', |
|
1222 | + 'with_pics_only' => '', |
|
1223 | + 'with_videos_only' => '', |
|
1224 | + 'with_pagination' => '1', |
|
1225 | + 'top_pagination' => '0', |
|
1226 | + 'bottom_pagination' => '1', |
|
1227 | + 'without_no_results' => 0, |
|
1228 | + 'tags' => '', |
|
1229 | + 'show_favorites_only' => '', |
|
1230 | + 'favorites_by_user' => '', |
|
1231 | + ); |
|
1232 | + $params = shortcode_atts($defaults, $atts); |
|
1233 | + |
|
1234 | + $params['title'] = wp_strip_all_tags($params['title']); |
|
1235 | + $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
1236 | + |
|
1237 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
1238 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
1239 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
1240 | + |
|
1241 | + // Make sure we have an array |
|
1242 | + if (!(is_array($params['category']))) { |
|
1243 | + $params['category'] = explode(',', $params['category']); |
|
1244 | + } |
|
1245 | + |
|
1246 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
1247 | + // Otherwise it becomes empty and later on that will mean "All" |
|
1248 | + $params['category'] = array_intersect($params['category'], $categories); |
|
1249 | + |
|
1250 | + // Post_number needs to be a positive integer |
|
1251 | + $params['post_number'] = absint($params['post_number']); |
|
1252 | + $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
1253 | 1253 | |
1254 | - // Post_number needs to be a positive integer |
|
1255 | - if (!empty($atts['post_author'])) { |
|
1256 | - if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1257 | - $params['post_author'] = $post->post_author; |
|
1258 | - } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
1259 | - $params['post_author'] = absint($atts['post_author']); |
|
1260 | - } else { |
|
1261 | - unset($params['post_author']); |
|
1262 | - } |
|
1263 | - } else { |
|
1264 | - unset($params['post_author']); |
|
1265 | - } |
|
1266 | - |
|
1267 | - // Validate character_count |
|
1268 | - //todo: is this necessary? |
|
1269 | - $params['character_count'] = $params['character_count']; |
|
1270 | - |
|
1271 | - // Validate our layout choice |
|
1272 | - // Outside of the norm, I added some more simple terms to match the existing |
|
1273 | - // So now I just run the switch to set it properly. |
|
1274 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
1275 | - |
|
1276 | - // Validate our sorting choice |
|
1277 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
1278 | - |
|
1279 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
1280 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
1281 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1282 | - |
|
1283 | - // Validate the checkboxes used on the widget |
|
1284 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1285 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
1286 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
1287 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
1288 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
1289 | - $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
1290 | - $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
1291 | - $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
1254 | + // Post_number needs to be a positive integer |
|
1255 | + if (!empty($atts['post_author'])) { |
|
1256 | + if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1257 | + $params['post_author'] = $post->post_author; |
|
1258 | + } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
1259 | + $params['post_author'] = absint($atts['post_author']); |
|
1260 | + } else { |
|
1261 | + unset($params['post_author']); |
|
1262 | + } |
|
1263 | + } else { |
|
1264 | + unset($params['post_author']); |
|
1265 | + } |
|
1266 | + |
|
1267 | + // Validate character_count |
|
1268 | + //todo: is this necessary? |
|
1269 | + $params['character_count'] = $params['character_count']; |
|
1270 | + |
|
1271 | + // Validate our layout choice |
|
1272 | + // Outside of the norm, I added some more simple terms to match the existing |
|
1273 | + // So now I just run the switch to set it properly. |
|
1274 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
1275 | + |
|
1276 | + // Validate our sorting choice |
|
1277 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
1278 | + |
|
1279 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
1280 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
1281 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1282 | + |
|
1283 | + // Validate the checkboxes used on the widget |
|
1284 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1285 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
1286 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
1287 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
1288 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
1289 | + $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
1290 | + $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
1291 | + $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
1292 | 1292 | |
1293 | - // User favorites |
|
1294 | - $params['show_favorites_only'] = gdsc_to_bool_val($params['show_favorites_only']); |
|
1295 | - if (!empty($params['show_favorites_only'])) { |
|
1296 | - if ($params['favorites_by_user'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1297 | - $params['favorites_by_user'] = $post->post_author; |
|
1298 | - } else if ($params['favorites_by_user'] != 'current' && absint($params['favorites_by_user']) > 0) { |
|
1299 | - $params['favorites_by_user'] = absint($atts['favorites_by_user']); |
|
1300 | - } else if ($params['favorites_by_user'] != 'current' && $current_user_id = get_current_user_id()) { |
|
1301 | - $params['favorites_by_user'] = $current_user_id; |
|
1302 | - } else { |
|
1303 | - $params['favorites_by_user'] = 0; |
|
1304 | - } |
|
1305 | - } |
|
1306 | - |
|
1307 | - // Clean tags |
|
1308 | - if (!empty($params['tags'])) { |
|
1309 | - if (!is_array($params['tags'])) { |
|
1310 | - $comma = _x(',', 'tag delimiter'); |
|
1311 | - if ( ',' !== $comma ) { |
|
1312 | - $params['tags'] = str_replace($comma, ',', $params['tags']); |
|
1313 | - } |
|
1314 | - $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
|
1315 | - $params['tags'] = array_map('trim', $params['tags']); |
|
1316 | - } |
|
1317 | - } else { |
|
1318 | - $params['tags'] = array(); |
|
1319 | - } |
|
1320 | - |
|
1321 | - /** |
|
1322 | - * End of validation |
|
1323 | - */ |
|
1324 | - if (isset($atts['geodir_ajax'])) { |
|
1325 | - $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
1326 | - unset($atts['geodir_ajax']); |
|
1327 | - } |
|
1328 | - if (isset($atts['pageno'])) { |
|
1329 | - $params['pageno'] = $atts['pageno']; |
|
1330 | - unset($atts['pageno']); |
|
1331 | - } |
|
1332 | - |
|
1333 | - if ( !empty($atts['shortcode_content']) ) { |
|
1334 | - $content = $atts['shortcode_content']; |
|
1335 | - } |
|
1336 | - $params['shortcode_content'] = trim($content); |
|
1337 | - $atts['shortcode_content'] = trim($content); |
|
1293 | + // User favorites |
|
1294 | + $params['show_favorites_only'] = gdsc_to_bool_val($params['show_favorites_only']); |
|
1295 | + if (!empty($params['show_favorites_only'])) { |
|
1296 | + if ($params['favorites_by_user'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1297 | + $params['favorites_by_user'] = $post->post_author; |
|
1298 | + } else if ($params['favorites_by_user'] != 'current' && absint($params['favorites_by_user']) > 0) { |
|
1299 | + $params['favorites_by_user'] = absint($atts['favorites_by_user']); |
|
1300 | + } else if ($params['favorites_by_user'] != 'current' && $current_user_id = get_current_user_id()) { |
|
1301 | + $params['favorites_by_user'] = $current_user_id; |
|
1302 | + } else { |
|
1303 | + $params['favorites_by_user'] = 0; |
|
1304 | + } |
|
1305 | + } |
|
1306 | + |
|
1307 | + // Clean tags |
|
1308 | + if (!empty($params['tags'])) { |
|
1309 | + if (!is_array($params['tags'])) { |
|
1310 | + $comma = _x(',', 'tag delimiter'); |
|
1311 | + if ( ',' !== $comma ) { |
|
1312 | + $params['tags'] = str_replace($comma, ',', $params['tags']); |
|
1313 | + } |
|
1314 | + $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
|
1315 | + $params['tags'] = array_map('trim', $params['tags']); |
|
1316 | + } |
|
1317 | + } else { |
|
1318 | + $params['tags'] = array(); |
|
1319 | + } |
|
1320 | + |
|
1321 | + /** |
|
1322 | + * End of validation |
|
1323 | + */ |
|
1324 | + if (isset($atts['geodir_ajax'])) { |
|
1325 | + $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
1326 | + unset($atts['geodir_ajax']); |
|
1327 | + } |
|
1328 | + if (isset($atts['pageno'])) { |
|
1329 | + $params['pageno'] = $atts['pageno']; |
|
1330 | + unset($atts['pageno']); |
|
1331 | + } |
|
1332 | + |
|
1333 | + if ( !empty($atts['shortcode_content']) ) { |
|
1334 | + $content = $atts['shortcode_content']; |
|
1335 | + } |
|
1336 | + $params['shortcode_content'] = trim($content); |
|
1337 | + $atts['shortcode_content'] = trim($content); |
|
1338 | 1338 | |
1339 | - $params['shortcode_atts'] = $atts; |
|
1339 | + $params['shortcode_atts'] = $atts; |
|
1340 | 1340 | |
1341 | - $output = geodir_sc_gd_listings_output($params); |
|
1341 | + $output = geodir_sc_gd_listings_output($params); |
|
1342 | 1342 | |
1343 | - return $output; |
|
1343 | + return $output; |
|
1344 | 1344 | } |
1345 | 1345 | add_shortcode('gd_listings', 'geodir_sc_gd_listings'); |
1346 | 1346 | |
@@ -1380,56 +1380,56 @@ discard block |
||
1380 | 1380 | * @return string HTML content to display CPT categories. |
1381 | 1381 | */ |
1382 | 1382 | function geodir_sc_cpt_categories_widget($atts, $content = '') { |
1383 | - $defaults = array( |
|
1384 | - 'title' => '', |
|
1385 | - 'post_type' => '', // NULL for all |
|
1386 | - 'hide_empty' => '', |
|
1387 | - 'show_count' => '', |
|
1388 | - 'hide_icon' => '', |
|
1389 | - 'cpt_left' => '', |
|
1390 | - 'sort_by' => 'count', |
|
1391 | - 'max_count' => 'all', |
|
1392 | - 'max_level' => '1', |
|
1393 | - 'no_cpt_filter' => '', |
|
1394 | - 'no_cat_filter' => '', |
|
1395 | - 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
|
1396 | - 'after_widget' => '</section>', |
|
1397 | - 'before_title' => '<h3 class="widget-title">', |
|
1398 | - 'after_title' => '</h3>', |
|
1399 | - ); |
|
1400 | - $params = shortcode_atts($defaults, $atts); |
|
1401 | - |
|
1402 | - /** |
|
1403 | - * Validate our incoming params |
|
1404 | - */ |
|
1405 | - // Make sure we have an array |
|
1406 | - $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
1407 | - |
|
1408 | - // Validate the checkboxes used on the widget |
|
1409 | - $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
1410 | - $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
1411 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1412 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1383 | + $defaults = array( |
|
1384 | + 'title' => '', |
|
1385 | + 'post_type' => '', // NULL for all |
|
1386 | + 'hide_empty' => '', |
|
1387 | + 'show_count' => '', |
|
1388 | + 'hide_icon' => '', |
|
1389 | + 'cpt_left' => '', |
|
1390 | + 'sort_by' => 'count', |
|
1391 | + 'max_count' => 'all', |
|
1392 | + 'max_level' => '1', |
|
1393 | + 'no_cpt_filter' => '', |
|
1394 | + 'no_cat_filter' => '', |
|
1395 | + 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
|
1396 | + 'after_widget' => '</section>', |
|
1397 | + 'before_title' => '<h3 class="widget-title">', |
|
1398 | + 'after_title' => '</h3>', |
|
1399 | + ); |
|
1400 | + $params = shortcode_atts($defaults, $atts); |
|
1413 | 1401 | |
1414 | - if ($params['max_count'] != 'all') { |
|
1415 | - $params['max_count'] = absint($params['max_count']); |
|
1416 | - } |
|
1402 | + /** |
|
1403 | + * Validate our incoming params |
|
1404 | + */ |
|
1405 | + // Make sure we have an array |
|
1406 | + $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
1407 | + |
|
1408 | + // Validate the checkboxes used on the widget |
|
1409 | + $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
1410 | + $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
1411 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1412 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1413 | + |
|
1414 | + if ($params['max_count'] != 'all') { |
|
1415 | + $params['max_count'] = absint($params['max_count']); |
|
1416 | + } |
|
1417 | 1417 | |
1418 | - if ($params['max_level'] != 'all') { |
|
1419 | - $params['max_level'] = absint($params['max_level']); |
|
1420 | - } |
|
1418 | + if ($params['max_level'] != 'all') { |
|
1419 | + $params['max_level'] = absint($params['max_level']); |
|
1420 | + } |
|
1421 | 1421 | |
1422 | - $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']); |
|
1423 | - $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']); |
|
1422 | + $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']); |
|
1423 | + $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']); |
|
1424 | 1424 | |
1425 | - $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count'; |
|
1425 | + $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count'; |
|
1426 | 1426 | |
1427 | - ob_start(); |
|
1428 | - the_widget('geodir_cpt_categories_widget', $params, $params); |
|
1429 | - $output = ob_get_contents(); |
|
1430 | - ob_end_clean(); |
|
1427 | + ob_start(); |
|
1428 | + the_widget('geodir_cpt_categories_widget', $params, $params); |
|
1429 | + $output = ob_get_contents(); |
|
1430 | + ob_end_clean(); |
|
1431 | 1431 | |
1432 | - return $output; |
|
1432 | + return $output; |
|
1433 | 1433 | } |
1434 | 1434 | add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget'); |
1435 | 1435 | |
@@ -1444,6 +1444,6 @@ discard block |
||
1444 | 1444 | * @return string HTML code. |
1445 | 1445 | */ |
1446 | 1446 | function geodir_sc_responsive_videos($atts, $content) { |
1447 | - return '<div class="geodir-video-wrapper">'.$content.'</div>'; |
|
1447 | + return '<div class="geodir-video-wrapper">'.$content.'</div>'; |
|
1448 | 1448 | } |
1449 | 1449 | add_shortcode('gd_video', 'geodir_sc_responsive_videos'); |
1450 | 1450 | \ No newline at end of file |