@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * All shortcode related functions |
|
4 | - * |
|
5 | - * @since 1.0.0 |
|
6 | - * |
|
7 | - * @package GeoDirectory |
|
8 | - */ |
|
3 | + * All shortcode related functions |
|
4 | + * |
|
5 | + * @since 1.0.0 |
|
6 | + * |
|
7 | + * @package GeoDirectory |
|
8 | + */ |
|
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 | - } |
|
39 | - |
|
40 | - return $value; |
|
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 | + |
|
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 | - } |
|
146 | - |
|
147 | - return $out; |
|
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 | + |
|
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 | - } |
|
168 | - |
|
169 | - return $post_type_found; |
|
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 | + |
|
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 | - } |
|
457 | - |
|
458 | - return $layout_choice; |
|
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 | + |
|
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 | - } |
|
483 | - |
|
484 | - return $sort_choice; |
|
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 | + |
|
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 | - } |
|
502 | - |
|
503 | - if (100 < $width_choice) { |
|
504 | - $width_choice = 100; |
|
505 | - } |
|
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 | - } |
|
511 | - |
|
512 | - return $width_choice; |
|
497 | + if (!(empty($width_choice))) { |
|
498 | + $width_choice = absint($width_choice); |
|
499 | + } else { |
|
500 | + return ''; |
|
501 | + } |
|
502 | + |
|
503 | + if (100 < $width_choice) { |
|
504 | + $width_choice = 100; |
|
505 | + } |
|
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 | + } |
|
511 | + |
|
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 | - } |
|
535 | - |
|
536 | - return $filter_choice; |
|
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 | + |
|
536 | + return $filter_choice; |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | /** |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | * @return string Listings HTML content. |
554 | 554 | */ |
555 | 555 | function geodir_sc_gd_listings_output($args = array()) { |
556 | - $title = !empty($args['title']) ? __($args['title'], 'geodirectory') : ''; |
|
556 | + $title = !empty($args['title']) ? __($args['title'], 'geodirectory') : ''; |
|
557 | 557 | $post_type = !empty($args['post_type']) ? $args['post_type'] : 'gd_place'; |
558 | 558 | $category = !empty($args['category']) ? $args['category'] : '0'; |
559 | 559 | $post_number = !empty($args['post_number']) ? $args['post_number'] : 10; |
@@ -563,16 +563,16 @@ discard block |
||
563 | 563 | $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; |
564 | 564 | $with_pagination = !empty($args['with_pagination']) ? true : false; |
565 | 565 | $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; |
566 | - $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
|
567 | - /** |
|
568 | - * Filter the content text displayed when no listings found. |
|
569 | - * |
|
570 | - * @since 1.6.0 |
|
571 | - * |
|
572 | - * @param string $shortcode_content The shortcode content text. |
|
573 | - * @param array $args Array of arguements to filter listings. |
|
574 | - */ |
|
575 | - $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
|
566 | + $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
|
567 | + /** |
|
568 | + * Filter the content text displayed when no listings found. |
|
569 | + * |
|
570 | + * @since 1.6.0 |
|
571 | + * |
|
572 | + * @param string $shortcode_content The shortcode content text. |
|
573 | + * @param array $args Array of arguements to filter listings. |
|
574 | + */ |
|
575 | + $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
|
576 | 576 | |
577 | 577 | $top_pagination = $with_pagination && !empty($args['top_pagination']) ? true : false; |
578 | 578 | $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; |
@@ -584,61 +584,61 @@ discard block |
||
584 | 584 | $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; |
585 | 585 | |
586 | 586 | $query_args = array( |
587 | - 'posts_per_page' => $post_number, |
|
588 | - 'is_geodir_loop' => true, |
|
589 | - 'gd_location' => $add_location_filter, |
|
590 | - 'post_type' => $post_type, |
|
591 | - 'order_by' => $list_sort, |
|
587 | + 'posts_per_page' => $post_number, |
|
588 | + 'is_geodir_loop' => true, |
|
589 | + 'gd_location' => $add_location_filter, |
|
590 | + 'post_type' => $post_type, |
|
591 | + 'order_by' => $list_sort, |
|
592 | 592 | 'pageno' => $pageno |
593 | - ); |
|
593 | + ); |
|
594 | 594 | |
595 | - if ($character_count >= 0) { |
|
596 | - $query_args['excerpt_length'] = $character_count; |
|
597 | - } |
|
595 | + if ($character_count >= 0) { |
|
596 | + $query_args['excerpt_length'] = $character_count; |
|
597 | + } |
|
598 | 598 | |
599 | - if (!empty($args['post_author'])) { |
|
600 | - $query_args['post_author'] = $args['post_author']; |
|
601 | - } |
|
599 | + if (!empty($args['post_author'])) { |
|
600 | + $query_args['post_author'] = $args['post_author']; |
|
601 | + } |
|
602 | 602 | |
603 | - if (!empty($args['show_featured_only'])) { |
|
604 | - $query_args['show_featured_only'] = 1; |
|
605 | - } |
|
603 | + if (!empty($args['show_featured_only'])) { |
|
604 | + $query_args['show_featured_only'] = 1; |
|
605 | + } |
|
606 | 606 | |
607 | - if (!empty($args['show_special_only'])) { |
|
608 | - $query_args['show_special_only'] = 1; |
|
609 | - } |
|
607 | + if (!empty($args['show_special_only'])) { |
|
608 | + $query_args['show_special_only'] = 1; |
|
609 | + } |
|
610 | 610 | |
611 | - if (!empty($args['with_pics_only'])) { |
|
612 | - $query_args['with_pics_only'] = 0; |
|
613 | - $query_args['featured_image_only'] = 1; |
|
614 | - } |
|
611 | + if (!empty($args['with_pics_only'])) { |
|
612 | + $query_args['with_pics_only'] = 0; |
|
613 | + $query_args['featured_image_only'] = 1; |
|
614 | + } |
|
615 | 615 | |
616 | - if (!empty($args['with_videos_only'])) { |
|
617 | - $query_args['with_videos_only'] = 1; |
|
618 | - } |
|
619 | - $with_no_results = !empty($args['without_no_results']) ? false : true; |
|
616 | + if (!empty($args['with_videos_only'])) { |
|
617 | + $query_args['with_videos_only'] = 1; |
|
618 | + } |
|
619 | + $with_no_results = !empty($args['without_no_results']) ? false : true; |
|
620 | 620 | |
621 | - if (!empty($category) && isset($category[0]) && $category[0] != '0') { |
|
622 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
621 | + if (!empty($category) && isset($category[0]) && $category[0] != '0') { |
|
622 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
623 | 623 | |
624 | - ######### WPML ######### |
|
625 | - if (function_exists('icl_object_id')) { |
|
626 | - $category = gd_lang_object_ids($category, $category_taxonomy[0]); |
|
627 | - } |
|
628 | - ######### WPML ######### |
|
624 | + ######### WPML ######### |
|
625 | + if (function_exists('icl_object_id')) { |
|
626 | + $category = gd_lang_object_ids($category, $category_taxonomy[0]); |
|
627 | + } |
|
628 | + ######### WPML ######### |
|
629 | 629 | |
630 | - $tax_query = array( |
|
631 | - 'taxonomy' => $category_taxonomy[0], |
|
632 | - 'field' => 'id', |
|
633 | - 'terms' => $category |
|
634 | - ); |
|
630 | + $tax_query = array( |
|
631 | + 'taxonomy' => $category_taxonomy[0], |
|
632 | + 'field' => 'id', |
|
633 | + 'terms' => $category |
|
634 | + ); |
|
635 | 635 | |
636 | - $query_args['tax_query'] = array($tax_query); |
|
637 | - } |
|
636 | + $query_args['tax_query'] = array($tax_query); |
|
637 | + } |
|
638 | 638 | |
639 | - global $gridview_columns_widget, $geodir_is_widget_listing; |
|
639 | + global $gridview_columns_widget, $geodir_is_widget_listing; |
|
640 | 640 | |
641 | - if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
641 | + if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
642 | 642 | global $geodir_event_widget_listview; |
643 | 643 | $geodir_event_widget_listview = true; |
644 | 644 | |
@@ -655,15 +655,15 @@ discard block |
||
655 | 655 | } |
656 | 656 | $current_gridview_columns_widget = $gridview_columns_widget; |
657 | 657 | |
658 | - ob_start(); |
|
658 | + ob_start(); |
|
659 | 659 | if (!empty($widget_listings) || $with_no_results) { |
660 | 660 | if (!$geodir_ajax) { |
661 | - /** |
|
662 | - * Called before the shortcode [gd_listings] content is output. |
|
663 | - * |
|
664 | - * @since 1.0.0 |
|
665 | - */ |
|
666 | - do_action('geodir_before_sc_gd_listings'); |
|
661 | + /** |
|
662 | + * Called before the shortcode [gd_listings] content is output. |
|
663 | + * |
|
664 | + * @since 1.0.0 |
|
665 | + */ |
|
666 | + do_action('geodir_before_sc_gd_listings'); |
|
667 | 667 | ?> |
668 | 668 | <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings"> |
669 | 669 | <?php } ?> |
@@ -673,64 +673,64 @@ discard block |
||
673 | 673 | </div> |
674 | 674 | <?php } ?> |
675 | 675 | <?php |
676 | - if (!(empty($widget_listings) && !empty($shortcode_content))) { |
|
677 | - if (strstr($layout, 'gridview')) { |
|
678 | - $listing_view_exp = explode('_', $layout); |
|
679 | - $gridview_columns_widget = $layout; |
|
680 | - $layout = $listing_view_exp[0]; |
|
681 | - } else { |
|
682 | - $gridview_columns_widget = ''; |
|
683 | - } |
|
684 | - |
|
685 | - /** |
|
686 | - * Filter the widget listing listview template. |
|
687 | - * |
|
688 | - * @since 1.0.0 |
|
689 | - * |
|
690 | - * @param string The template file to display listing. |
|
691 | - */ |
|
692 | - $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
676 | + if (!(empty($widget_listings) && !empty($shortcode_content))) { |
|
677 | + if (strstr($layout, 'gridview')) { |
|
678 | + $listing_view_exp = explode('_', $layout); |
|
679 | + $gridview_columns_widget = $layout; |
|
680 | + $layout = $listing_view_exp[0]; |
|
681 | + } else { |
|
682 | + $gridview_columns_widget = ''; |
|
683 | + } |
|
684 | + |
|
685 | + /** |
|
686 | + * Filter the widget listing listview template. |
|
687 | + * |
|
688 | + * @since 1.0.0 |
|
689 | + * |
|
690 | + * @param string The template file to display listing. |
|
691 | + */ |
|
692 | + $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
693 | 693 | |
694 | - global $post, $map_jason, $map_canvas_arr, $gd_session; |
|
695 | - |
|
696 | - $current_post = $post; |
|
697 | - $current_map_jason = $map_jason; |
|
698 | - $current_map_canvas_arr = $map_canvas_arr; |
|
699 | - $geodir_is_widget_listing = true; |
|
700 | - $gd_session->un_set('gd_listing_view'); |
|
701 | - |
|
702 | - if ($with_pagination && $top_pagination) { |
|
703 | - echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
704 | - } |
|
705 | - |
|
706 | - /** |
|
707 | - * Includes listing listview template. |
|
708 | - * |
|
709 | - * @since 1.0.0 |
|
710 | - */ |
|
711 | - include($template); |
|
694 | + global $post, $map_jason, $map_canvas_arr, $gd_session; |
|
695 | + |
|
696 | + $current_post = $post; |
|
697 | + $current_map_jason = $map_jason; |
|
698 | + $current_map_canvas_arr = $map_canvas_arr; |
|
699 | + $geodir_is_widget_listing = true; |
|
700 | + $gd_session->un_set('gd_listing_view'); |
|
701 | + |
|
702 | + if ($with_pagination && $top_pagination) { |
|
703 | + echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
704 | + } |
|
705 | + |
|
706 | + /** |
|
707 | + * Includes listing listview template. |
|
708 | + * |
|
709 | + * @since 1.0.0 |
|
710 | + */ |
|
711 | + include($template); |
|
712 | 712 | |
713 | - if ($with_pagination && $bottom_pagination) { |
|
714 | - echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
715 | - } |
|
716 | - |
|
717 | - $geodir_is_widget_listing = false; |
|
718 | - |
|
719 | - $GLOBALS['post'] = $current_post; |
|
720 | - if (!empty($current_post)) { |
|
721 | - setup_postdata($current_post); |
|
722 | - } |
|
723 | - $map_jason = $current_map_jason; |
|
724 | - $map_canvas_arr = $current_map_canvas_arr; |
|
725 | - global $gridview_columns_widget; |
|
726 | - $gridview_columns_widget = $current_gridview_columns_widget; |
|
727 | - } else { |
|
728 | - echo $shortcode_content; |
|
729 | - } |
|
713 | + if ($with_pagination && $bottom_pagination) { |
|
714 | + echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
715 | + } |
|
716 | + |
|
717 | + $geodir_is_widget_listing = false; |
|
718 | + |
|
719 | + $GLOBALS['post'] = $current_post; |
|
720 | + if (!empty($current_post)) { |
|
721 | + setup_postdata($current_post); |
|
722 | + } |
|
723 | + $map_jason = $current_map_jason; |
|
724 | + $map_canvas_arr = $current_map_canvas_arr; |
|
725 | + global $gridview_columns_widget; |
|
726 | + $gridview_columns_widget = $current_gridview_columns_widget; |
|
727 | + } else { |
|
728 | + echo $shortcode_content; |
|
729 | + } |
|
730 | 730 | ?> |
731 | 731 | <p class="geodir-sclisting-loading" style="display:none;"><i class="fa fa-cog fa-spin"></i></p> |
732 | 732 | <?php |
733 | - if (!$geodir_ajax) { |
|
733 | + if (!$geodir_ajax) { |
|
734 | 734 | ?> |
735 | 735 | </div> |
736 | 736 | <script type="text/javascript"> |
@@ -767,11 +767,11 @@ discard block |
||
767 | 767 | </script> |
768 | 768 | <?php } ?> |
769 | 769 | <?php |
770 | - } |
|
770 | + } |
|
771 | 771 | $output = ob_get_contents(); |
772 | - ob_end_clean(); |
|
772 | + ob_end_clean(); |
|
773 | 773 | |
774 | - return trim($output); |
|
774 | + return trim($output); |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | /** |
@@ -798,15 +798,15 @@ discard block |
||
798 | 798 | * @return string Listings pagination HTML content. |
799 | 799 | */ |
800 | 800 | function geodir_sc_listings_pagination($total_posts, $posts_per_page, $pageno, $before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { |
801 | - if (empty($prelabel)) { |
|
802 | - $prelabel = '<strong>«</strong>'; |
|
803 | - } |
|
801 | + if (empty($prelabel)) { |
|
802 | + $prelabel = '<strong>«</strong>'; |
|
803 | + } |
|
804 | 804 | |
805 | - if (empty($nxtlabel)) { |
|
806 | - $nxtlabel = '<strong>»</strong>'; |
|
807 | - } |
|
805 | + if (empty($nxtlabel)) { |
|
806 | + $nxtlabel = '<strong>»</strong>'; |
|
807 | + } |
|
808 | 808 | |
809 | - $half_pages_to_show = round($pages_to_show / 2); |
|
809 | + $half_pages_to_show = round($pages_to_show / 2); |
|
810 | 810 | |
811 | 811 | $numposts = $total_posts; |
812 | 812 | |
@@ -862,9 +862,9 @@ discard block |
||
862 | 862 | echo "</div> $after"; |
863 | 863 | } |
864 | 864 | $output = ob_get_contents(); |
865 | - ob_end_clean(); |
|
865 | + ob_end_clean(); |
|
866 | 866 | |
867 | - return trim($output); |
|
867 | + return trim($output); |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | /** |
@@ -875,10 +875,10 @@ discard block |
||
875 | 875 | * @return string Listings HTML content. |
876 | 876 | */ |
877 | 877 | function geodir_sclistings_callback() { |
878 | - check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce'); |
|
879 | - //set variables |
|
880 | - $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
|
881 | - $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
|
878 | + check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce'); |
|
879 | + //set variables |
|
880 | + $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
|
881 | + $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
|
882 | 882 | |
883 | 883 | $shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL; |
884 | 884 | |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | } else { |
891 | 891 | echo 0; |
892 | 892 | } |
893 | - wp_die(); |
|
893 | + wp_die(); |
|
894 | 894 | } |
895 | 895 | add_action('wp_ajax_geodir_sclistings', 'geodir_sclistings_callback'); |
896 | 896 | add_action('wp_ajax_nopriv_geodir_sclistings', 'geodir_sclistings_callback'); |
897 | 897 | \ No newline at end of file |
@@ -559,11 +559,11 @@ discard block |
||
559 | 559 | $post_number = !empty($args['post_number']) ? $args['post_number'] : 10; |
560 | 560 | $add_location_filter = !empty($args['add_location_filter']) ? true : false; |
561 | 561 | $list_sort = !empty($args['list_sort']) ? $args['list_sort'] : 'latest'; |
562 | - $character_count = isset($args['character_count']) ? $args['character_count'] : ''; |
|
563 | - $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; |
|
564 | - $with_pagination = !empty($args['with_pagination']) ? true : false; |
|
565 | - $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; |
|
566 | - $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
|
562 | + $character_count = isset($args['character_count']) ? $args['character_count'] : ''; |
|
563 | + $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; |
|
564 | + $with_pagination = !empty($args['with_pagination']) ? true : false; |
|
565 | + $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; |
|
566 | + $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
|
567 | 567 | /** |
568 | 568 | * Filter the content text displayed when no listings found. |
569 | 569 | * |
@@ -575,13 +575,13 @@ discard block |
||
575 | 575 | $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
576 | 576 | |
577 | 577 | $top_pagination = $with_pagination && !empty($args['top_pagination']) ? true : false; |
578 | - $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; |
|
578 | + $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; |
|
579 | 579 | |
580 | 580 | $shortcode_atts = !empty($args['shortcode_atts']) ? $args['shortcode_atts'] : array(); |
581 | 581 | |
582 | 582 | // ajax mode |
583 | - $geodir_ajax = !empty($args['geodir_ajax']) ? true : false; |
|
584 | - $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; |
|
583 | + $geodir_ajax = !empty($args['geodir_ajax']) ? true : false; |
|
584 | + $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; |
|
585 | 585 | |
586 | 586 | $query_args = array( |
587 | 587 | 'posts_per_page' => $post_number, |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | if(!pid > 0 || !(container && typeof container != 'undefined')) { |
741 | 741 | return false; |
742 | 742 | } |
743 | - var scatts = "<?php echo addslashes(json_encode($shortcode_atts));?>"; |
|
743 | + var scatts = "<?php echo addslashes(json_encode($shortcode_atts)); ?>"; |
|
744 | 744 | |
745 | 745 | var data = { |
746 | 746 | 'action': 'geodir_sclistings', |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | if ($max_page > 1 || $always_show) { |
821 | 821 | // Extra pagination info |
822 | 822 | $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
823 | - $start_no = ( $pageno - 1 ) * $posts_per_page + 1; |
|
823 | + $start_no = ($pageno - 1) * $posts_per_page + 1; |
|
824 | 824 | $end_no = min($pageno * $posts_per_page, $numposts); |
825 | 825 | |
826 | 826 | if ($geodir_pagination_more_info != '') { |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | } |
840 | 840 | |
841 | 841 | if (($pageno - 1) > 0) { |
842 | - echo '<a class="gd-page-sc-prev" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)($pageno - 1) . ');">' . $prelabel . '</a> '; |
|
842 | + echo '<a class="gd-page-sc-prev" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int) ($pageno - 1) . ');">' . $prelabel . '</a> '; |
|
843 | 843 | } |
844 | 844 | |
845 | 845 | for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) { |
@@ -847,17 +847,17 @@ discard block |
||
847 | 847 | if ($i == $pageno) { |
848 | 848 | echo "<strong class='on' class='gd-page-sc-act'>$i</strong>"; |
849 | 849 | } else { |
850 | - echo ' <a class="gd-page-sc-no" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)$i . ');">' . $i . '</a> '; |
|
850 | + echo ' <a class="gd-page-sc-no" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int) $i . ');">' . $i . '</a> '; |
|
851 | 851 | } |
852 | 852 | } |
853 | 853 | } |
854 | 854 | |
855 | 855 | if (($pageno + 1) <= $max_page) { |
856 | - echo ' <a class="gd-page-sc-nxt" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)($pageno + 1) . ');">' . $nxtlabel . '</a>'; |
|
856 | + echo ' <a class="gd-page-sc-nxt" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int) ($pageno + 1) . ');">' . $nxtlabel . '</a>'; |
|
857 | 857 | } |
858 | 858 | |
859 | 859 | if ($pageno < $max_page) { |
860 | - echo ' <a class="gd-page-sc-lst" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)$max_page . ');">»</a>'; |
|
860 | + echo ' <a class="gd-page-sc-lst" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int) $max_page . ');">»</a>'; |
|
861 | 861 | } |
862 | 862 | echo "</div> $after"; |
863 | 863 | } |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
881 | 881 | $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
882 | 882 | |
883 | - $shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL; |
|
883 | + $shortcode_atts = !empty($scatts) ? (array) json_decode(stripslashes_deep($scatts)) : NULL; |
|
884 | 884 | |
885 | 885 | if (!empty($shortcode_atts) && is_array($shortcode_atts)) { |
886 | 886 | $shortcode_atts['pageno'] = $pageno; |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Shortcode functions. |
|
4 | - * |
|
5 | - * @since 1.0.0 |
|
6 | - * @package GeoDirectory |
|
7 | - */ |
|
3 | + * Shortcode functions. |
|
4 | + * |
|
5 | + * @since 1.0.0 |
|
6 | + * @package GeoDirectory |
|
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,48 +32,48 @@ 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 | - ###### MAIN CONTENT ###### |
|
66 | - |
|
67 | - /** This action is documented in geodirectory-templates/add-listing.php */ |
|
68 | - do_action('geodir_add_listing_page_mandatory'); |
|
69 | - /** This action is documented in geodirectory-templates/add-listing.php */ |
|
70 | - do_action('geodir_add_listing_form'); |
|
71 | - } |
|
72 | - $output = ob_get_contents(); |
|
73 | - |
|
74 | - ob_end_clean(); |
|
75 | - |
|
76 | - 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 | + ###### MAIN CONTENT ###### |
|
66 | + |
|
67 | + /** This action is documented in geodirectory-templates/add-listing.php */ |
|
68 | + do_action('geodir_add_listing_page_mandatory'); |
|
69 | + /** This action is documented in geodirectory-templates/add-listing.php */ |
|
70 | + do_action('geodir_add_listing_form'); |
|
71 | + } |
|
72 | + $output = ob_get_contents(); |
|
73 | + |
|
74 | + ob_end_clean(); |
|
75 | + |
|
76 | + return $output; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -101,136 +101,136 @@ discard block |
||
101 | 101 | */ |
102 | 102 | function geodir_sc_home_map($atts) |
103 | 103 | { |
104 | - ob_start(); |
|
105 | - $defaults = array( |
|
106 | - 'width' => '960', |
|
107 | - 'height' => '425', |
|
108 | - 'maptype' => 'ROADMAP', |
|
109 | - 'zoom' => '13', |
|
110 | - 'autozoom' => '', |
|
111 | - 'child_collapse' => '0', |
|
112 | - 'scrollwheel' => '0', |
|
104 | + ob_start(); |
|
105 | + $defaults = array( |
|
106 | + 'width' => '960', |
|
107 | + 'height' => '425', |
|
108 | + 'maptype' => 'ROADMAP', |
|
109 | + 'zoom' => '13', |
|
110 | + 'autozoom' => '', |
|
111 | + 'child_collapse' => '0', |
|
112 | + 'scrollwheel' => '0', |
|
113 | 113 | 'marker_cluster' => false, |
114 | - 'latitude' => '', |
|
115 | - 'longitude' => '' |
|
116 | - ); |
|
117 | - |
|
118 | - $params = shortcode_atts($defaults, $atts); |
|
119 | - |
|
120 | - $params = gdsc_validate_map_args($params); |
|
121 | - |
|
122 | - $map_args = array( |
|
123 | - 'map_canvas_name' => 'gd_home_map', |
|
124 | - 'latitude' => $params['latitude'], |
|
125 | - 'longitude' => $params['longitude'], |
|
126 | - |
|
127 | - /** |
|
128 | - * Filter the widget width of the map on home/listings page. |
|
129 | - * |
|
130 | - * @since 1.0.0 |
|
131 | - * @param mixed(string|int|float) $params['width'] The map width. |
|
132 | - */ |
|
133 | - 'width' => apply_filters('widget_width', $params['width']), |
|
134 | - /** |
|
135 | - * Filter the widget height of the map on home/listings page. |
|
136 | - * |
|
137 | - * @since 1.0.0 |
|
138 | - * @param mixed(string|int|float) $params['height'] The map height. |
|
139 | - */ |
|
140 | - 'height' => apply_filters('widget_heigh', $params['height']), |
|
141 | - /** |
|
142 | - * Filter the widget maptype of the map on home/listings page. |
|
143 | - * |
|
144 | - * @since 1.0.0 |
|
114 | + 'latitude' => '', |
|
115 | + 'longitude' => '' |
|
116 | + ); |
|
117 | + |
|
118 | + $params = shortcode_atts($defaults, $atts); |
|
119 | + |
|
120 | + $params = gdsc_validate_map_args($params); |
|
121 | + |
|
122 | + $map_args = array( |
|
123 | + 'map_canvas_name' => 'gd_home_map', |
|
124 | + 'latitude' => $params['latitude'], |
|
125 | + 'longitude' => $params['longitude'], |
|
126 | + |
|
127 | + /** |
|
128 | + * Filter the widget width of the map on home/listings page. |
|
129 | + * |
|
130 | + * @since 1.0.0 |
|
131 | + * @param mixed(string|int|float) $params['width'] The map width. |
|
132 | + */ |
|
133 | + 'width' => apply_filters('widget_width', $params['width']), |
|
134 | + /** |
|
135 | + * Filter the widget height of the map on home/listings page. |
|
136 | + * |
|
137 | + * @since 1.0.0 |
|
138 | + * @param mixed(string|int|float) $params['height'] The map height. |
|
139 | + */ |
|
140 | + 'height' => apply_filters('widget_heigh', $params['height']), |
|
141 | + /** |
|
142 | + * Filter the widget maptype of the map on home/listings page. |
|
143 | + * |
|
144 | + * @since 1.0.0 |
|
145 | 145 | * @since 1.5.2 Added TERRAIN map type. |
146 | - * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN. |
|
147 | - */ |
|
148 | - 'maptype' => apply_filters('widget_maptype', $params['maptype']), |
|
149 | - /** |
|
150 | - * Filter the widget scrollwheel value of the map on home/listings page. |
|
151 | - * |
|
152 | - * Should the scrollwheel zoom the map or not. |
|
153 | - * |
|
154 | - * @since 1.0.0 |
|
155 | - * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not. |
|
156 | - */ |
|
157 | - 'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']), |
|
158 | - /** |
|
159 | - * Filter the widget zoom level of the map on home/listings page. |
|
160 | - * |
|
161 | - * @since 1.0.0 |
|
162 | - * @param int $params['zoom'] The zoom level of the map. Between 1-19. |
|
163 | - */ |
|
164 | - 'zoom' => apply_filters('widget_zoom', $params['zoom']), |
|
165 | - /** |
|
166 | - * Filter the widget auto zoom value of the map on home/listings page. |
|
167 | - * |
|
168 | - * If the map should autozoom to fit the markers shown. |
|
169 | - * |
|
170 | - * @since 1.0.0 |
|
171 | - * @param bool $params['autozoom'] True if the map should autozoom, false if not. |
|
172 | - */ |
|
173 | - 'autozoom' => apply_filters('widget_autozoom', $params['autozoom']), |
|
174 | - /** |
|
175 | - * Filter the widget child_collapse value of the map on home/listings page. |
|
176 | - * |
|
177 | - * If the map should auto collapse the child categories if the category bar is present. |
|
178 | - * |
|
179 | - * @since 1.0.0 |
|
180 | - * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not. |
|
181 | - */ |
|
182 | - 'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']), |
|
183 | - 'enable_cat_filters' => true, |
|
184 | - 'enable_text_search' => true, |
|
185 | - 'enable_post_type_filters' => true, |
|
186 | - /** |
|
187 | - * Filter the widget enable_location_filters value of the map on home/listings page. |
|
188 | - * |
|
189 | - * This is used when the location addon is used. |
|
190 | - * |
|
191 | - * @since 1.0.0 |
|
192 | - * @param bool $val True if location filters should be used, false if not. |
|
193 | - */ |
|
194 | - 'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false), |
|
195 | - 'enable_jason_on_load' => false, |
|
196 | - 'enable_marker_cluster' => false, |
|
197 | - 'enable_map_resize_button' => true, |
|
198 | - 'map_class_name' => 'geodir-map-home-page', |
|
199 | - 'is_geodir_home_map_widget' => true, |
|
200 | - ); |
|
146 | + * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN. |
|
147 | + */ |
|
148 | + 'maptype' => apply_filters('widget_maptype', $params['maptype']), |
|
149 | + /** |
|
150 | + * Filter the widget scrollwheel value of the map on home/listings page. |
|
151 | + * |
|
152 | + * Should the scrollwheel zoom the map or not. |
|
153 | + * |
|
154 | + * @since 1.0.0 |
|
155 | + * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not. |
|
156 | + */ |
|
157 | + 'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']), |
|
158 | + /** |
|
159 | + * Filter the widget zoom level of the map on home/listings page. |
|
160 | + * |
|
161 | + * @since 1.0.0 |
|
162 | + * @param int $params['zoom'] The zoom level of the map. Between 1-19. |
|
163 | + */ |
|
164 | + 'zoom' => apply_filters('widget_zoom', $params['zoom']), |
|
165 | + /** |
|
166 | + * Filter the widget auto zoom value of the map on home/listings page. |
|
167 | + * |
|
168 | + * If the map should autozoom to fit the markers shown. |
|
169 | + * |
|
170 | + * @since 1.0.0 |
|
171 | + * @param bool $params['autozoom'] True if the map should autozoom, false if not. |
|
172 | + */ |
|
173 | + 'autozoom' => apply_filters('widget_autozoom', $params['autozoom']), |
|
174 | + /** |
|
175 | + * Filter the widget child_collapse value of the map on home/listings page. |
|
176 | + * |
|
177 | + * If the map should auto collapse the child categories if the category bar is present. |
|
178 | + * |
|
179 | + * @since 1.0.0 |
|
180 | + * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not. |
|
181 | + */ |
|
182 | + 'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']), |
|
183 | + 'enable_cat_filters' => true, |
|
184 | + 'enable_text_search' => true, |
|
185 | + 'enable_post_type_filters' => true, |
|
186 | + /** |
|
187 | + * Filter the widget enable_location_filters value of the map on home/listings page. |
|
188 | + * |
|
189 | + * This is used when the location addon is used. |
|
190 | + * |
|
191 | + * @since 1.0.0 |
|
192 | + * @param bool $val True if location filters should be used, false if not. |
|
193 | + */ |
|
194 | + 'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false), |
|
195 | + 'enable_jason_on_load' => false, |
|
196 | + 'enable_marker_cluster' => false, |
|
197 | + 'enable_map_resize_button' => true, |
|
198 | + 'map_class_name' => 'geodir-map-home-page', |
|
199 | + 'is_geodir_home_map_widget' => true, |
|
200 | + ); |
|
201 | 201 | |
202 | 202 | // Add marker cluster |
203 | 203 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
204 | - $map_args['enable_marker_cluster'] = true; |
|
205 | - if(get_option('geodir_marker_cluster_type')) { |
|
206 | - if ($map_args['autozoom']) { |
|
207 | - $map_args['enable_marker_cluster_no_reposition'] = false; |
|
208 | - } else { |
|
209 | - $map_args['enable_marker_cluster_no_reposition'] = true; |
|
210 | - } |
|
204 | + $map_args['enable_marker_cluster'] = true; |
|
205 | + if(get_option('geodir_marker_cluster_type')) { |
|
206 | + if ($map_args['autozoom']) { |
|
207 | + $map_args['enable_marker_cluster_no_reposition'] = false; |
|
208 | + } else { |
|
209 | + $map_args['enable_marker_cluster_no_reposition'] = true; |
|
210 | + } |
|
211 | 211 | |
212 | - $map_args['enable_marker_cluster_server'] = true ; |
|
212 | + $map_args['enable_marker_cluster_server'] = true ; |
|
213 | 213 | |
214 | - } |
|
214 | + } |
|
215 | 215 | } else { |
216 | 216 | $map_args['enable_marker_cluster'] = false; |
217 | 217 | } |
218 | 218 | |
219 | - // if lat and long set in shortcode, hack it so the map is not repositioned |
|
220 | - if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
221 | - $map_args['enable_marker_cluster_no_reposition'] = true; |
|
222 | - } |
|
219 | + // if lat and long set in shortcode, hack it so the map is not repositioned |
|
220 | + if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
221 | + $map_args['enable_marker_cluster_no_reposition'] = true; |
|
222 | + } |
|
223 | 223 | |
224 | 224 | |
225 | - geodir_draw_map($map_args); |
|
225 | + geodir_draw_map($map_args); |
|
226 | 226 | |
227 | - add_action('wp_footer', 'geodir_home_map_add_script', 100); |
|
227 | + add_action('wp_footer', 'geodir_home_map_add_script', 100); |
|
228 | 228 | |
229 | - $output = ob_get_contents(); |
|
229 | + $output = ob_get_contents(); |
|
230 | 230 | |
231 | - ob_end_clean(); |
|
231 | + ob_end_clean(); |
|
232 | 232 | |
233 | - return $output; |
|
233 | + return $output; |
|
234 | 234 | } |
235 | 235 | add_shortcode('gd_homepage_map', 'geodir_sc_home_map'); |
236 | 236 | |
@@ -264,77 +264,77 @@ discard block |
||
264 | 264 | */ |
265 | 265 | function geodir_sc_listing_map($atts) |
266 | 266 | { |
267 | - ob_start(); |
|
268 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
269 | - |
|
270 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
271 | - |
|
272 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
273 | - |
|
274 | - $defaults = array( |
|
275 | - 'width' => '294', |
|
276 | - 'height' => '370', |
|
277 | - 'zoom' => '13', |
|
278 | - 'autozoom' => '', |
|
279 | - 'sticky' => '', |
|
280 | - 'showall' => '0', |
|
281 | - 'scrollwheel' => '0', |
|
282 | - 'maptype' => 'ROADMAP', |
|
283 | - 'child_collapse' => 0, |
|
267 | + ob_start(); |
|
268 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
269 | + |
|
270 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
271 | + |
|
272 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
273 | + |
|
274 | + $defaults = array( |
|
275 | + 'width' => '294', |
|
276 | + 'height' => '370', |
|
277 | + 'zoom' => '13', |
|
278 | + 'autozoom' => '', |
|
279 | + 'sticky' => '', |
|
280 | + 'showall' => '0', |
|
281 | + 'scrollwheel' => '0', |
|
282 | + 'maptype' => 'ROADMAP', |
|
283 | + 'child_collapse' => 0, |
|
284 | 284 | 'marker_cluster' => false |
285 | - ); |
|
286 | - |
|
287 | - $params = shortcode_atts($defaults, $atts); |
|
288 | - |
|
289 | - $params = gdsc_validate_map_args($params); |
|
290 | - |
|
291 | - $map_args = array( |
|
292 | - 'map_canvas_name' => 'gd_listing_map', |
|
293 | - 'width' => $params['width'], |
|
294 | - 'height' => $params['height'], |
|
295 | - 'zoom' => $params['zoom'], |
|
296 | - 'autozoom' => $params['autozoom'], |
|
297 | - 'sticky' => $params['sticky'], |
|
298 | - 'showall' => $params['showall'], |
|
299 | - 'scrollwheel' => $params['scrollwheel'], |
|
300 | - 'child_collapse' => 0, |
|
301 | - 'enable_cat_filters' => false, |
|
302 | - 'enable_text_search' => false, |
|
303 | - 'enable_post_type_filters' => false, |
|
304 | - 'enable_location_filters' => false, |
|
305 | - 'enable_jason_on_load' => true, |
|
306 | - ); |
|
307 | - |
|
308 | - if (is_single()) { |
|
309 | - |
|
310 | - global $post; |
|
311 | - $map_default_lat = $address_latitude = $post->post_latitude; |
|
312 | - $map_default_lng = $address_longitude = $post->post_longitude; |
|
313 | - $mapview = $post->post_mapview; |
|
314 | - $map_args['zoom'] = $post->post_mapzoom; |
|
315 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
316 | - |
|
317 | - } else { |
|
318 | - $default_location = geodir_get_default_location(); |
|
319 | - |
|
320 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
321 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
322 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
323 | - } |
|
324 | - |
|
325 | - if (empty($mapview)) { |
|
326 | - $mapview = 'ROADMAP'; |
|
327 | - } |
|
328 | - |
|
329 | - // Set default map options |
|
330 | - $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
331 | - $map_args['latitude'] = $map_default_lat; |
|
332 | - $map_args['longitude'] = $map_default_lng; |
|
333 | - $map_args['streetViewControl'] = true; |
|
334 | - $map_args['maptype'] = $mapview; |
|
335 | - $map_args['showPreview'] = '0'; |
|
336 | - $map_args['maxZoom'] = 21; |
|
337 | - $map_args['bubble_size'] = 'small'; |
|
285 | + ); |
|
286 | + |
|
287 | + $params = shortcode_atts($defaults, $atts); |
|
288 | + |
|
289 | + $params = gdsc_validate_map_args($params); |
|
290 | + |
|
291 | + $map_args = array( |
|
292 | + 'map_canvas_name' => 'gd_listing_map', |
|
293 | + 'width' => $params['width'], |
|
294 | + 'height' => $params['height'], |
|
295 | + 'zoom' => $params['zoom'], |
|
296 | + 'autozoom' => $params['autozoom'], |
|
297 | + 'sticky' => $params['sticky'], |
|
298 | + 'showall' => $params['showall'], |
|
299 | + 'scrollwheel' => $params['scrollwheel'], |
|
300 | + 'child_collapse' => 0, |
|
301 | + 'enable_cat_filters' => false, |
|
302 | + 'enable_text_search' => false, |
|
303 | + 'enable_post_type_filters' => false, |
|
304 | + 'enable_location_filters' => false, |
|
305 | + 'enable_jason_on_load' => true, |
|
306 | + ); |
|
307 | + |
|
308 | + if (is_single()) { |
|
309 | + |
|
310 | + global $post; |
|
311 | + $map_default_lat = $address_latitude = $post->post_latitude; |
|
312 | + $map_default_lng = $address_longitude = $post->post_longitude; |
|
313 | + $mapview = $post->post_mapview; |
|
314 | + $map_args['zoom'] = $post->post_mapzoom; |
|
315 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
316 | + |
|
317 | + } else { |
|
318 | + $default_location = geodir_get_default_location(); |
|
319 | + |
|
320 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
321 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
322 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
323 | + } |
|
324 | + |
|
325 | + if (empty($mapview)) { |
|
326 | + $mapview = 'ROADMAP'; |
|
327 | + } |
|
328 | + |
|
329 | + // Set default map options |
|
330 | + $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
331 | + $map_args['latitude'] = $map_default_lat; |
|
332 | + $map_args['longitude'] = $map_default_lng; |
|
333 | + $map_args['streetViewControl'] = true; |
|
334 | + $map_args['maptype'] = $mapview; |
|
335 | + $map_args['showPreview'] = '0'; |
|
336 | + $map_args['maxZoom'] = 21; |
|
337 | + $map_args['bubble_size'] = 'small'; |
|
338 | 338 | |
339 | 339 | // Add marker cluster |
340 | 340 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
@@ -343,13 +343,13 @@ discard block |
||
343 | 343 | $map_args['enable_marker_cluster'] = false; |
344 | 344 | } |
345 | 345 | |
346 | - geodir_draw_map($map_args); |
|
346 | + geodir_draw_map($map_args); |
|
347 | 347 | |
348 | - $output = ob_get_contents(); |
|
348 | + $output = ob_get_contents(); |
|
349 | 349 | |
350 | - ob_end_clean(); |
|
350 | + ob_end_clean(); |
|
351 | 351 | |
352 | - return $output; |
|
352 | + return $output; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider'); |
@@ -382,120 +382,120 @@ discard block |
||
382 | 382 | */ |
383 | 383 | function geodir_sc_listing_slider($atts) |
384 | 384 | { |
385 | - ob_start(); |
|
386 | - $defaults = array( |
|
387 | - 'post_type' => 'gd_place', |
|
388 | - 'category' => '0', |
|
389 | - 'post_number' => '5', |
|
390 | - 'slideshow' => '0', |
|
391 | - 'animation_loop' => 0, |
|
392 | - 'direction_nav' => 0, |
|
393 | - 'slideshow_speed' => 5000, |
|
394 | - 'animation_speed' => 600, |
|
395 | - 'animation' => 'slide', |
|
396 | - 'order_by' => 'latest', |
|
397 | - 'show_title' => '', |
|
398 | - 'show_featured_only' => '', |
|
399 | - 'title' => '', |
|
400 | - ); |
|
401 | - |
|
402 | - $params = shortcode_atts($defaults, $atts); |
|
403 | - |
|
404 | - |
|
405 | - /* |
|
385 | + ob_start(); |
|
386 | + $defaults = array( |
|
387 | + 'post_type' => 'gd_place', |
|
388 | + 'category' => '0', |
|
389 | + 'post_number' => '5', |
|
390 | + 'slideshow' => '0', |
|
391 | + 'animation_loop' => 0, |
|
392 | + 'direction_nav' => 0, |
|
393 | + 'slideshow_speed' => 5000, |
|
394 | + 'animation_speed' => 600, |
|
395 | + 'animation' => 'slide', |
|
396 | + 'order_by' => 'latest', |
|
397 | + 'show_title' => '', |
|
398 | + 'show_featured_only' => '', |
|
399 | + 'title' => '', |
|
400 | + ); |
|
401 | + |
|
402 | + $params = shortcode_atts($defaults, $atts); |
|
403 | + |
|
404 | + |
|
405 | + /* |
|
406 | 406 | * |
407 | 407 | * Now we begin the validation of the attributes. |
408 | 408 | */ |
409 | - // Check we have a valid post_type |
|
410 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
411 | - $params['post_type'] = 'gd_place'; |
|
412 | - } |
|
413 | - |
|
414 | - // Check we have a valid sort_order |
|
415 | - $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
416 | - |
|
417 | - // Match the chosen animation to our options |
|
418 | - $animation_list = array('slide', 'fade'); |
|
419 | - if (!(in_array($params['animation'], $animation_list))) { |
|
420 | - $params['animation'] = 'slide'; |
|
421 | - } |
|
422 | - |
|
423 | - // Post_number needs to be a positive integer |
|
424 | - $params['post_number'] = absint($params['post_number']); |
|
425 | - if (0 == $params['post_number']) { |
|
426 | - $params['post_number'] = 1; |
|
427 | - } |
|
428 | - |
|
429 | - // Manage the entered categories |
|
430 | - if (0 != $params['category'] || '' != $params['category']) { |
|
431 | - $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
432 | - } |
|
433 | - // Convert show_title to a bool |
|
434 | - $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
435 | - |
|
436 | - // Convert show_featured_only to a bool |
|
437 | - $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
438 | - |
|
439 | - /* |
|
409 | + // Check we have a valid post_type |
|
410 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
411 | + $params['post_type'] = 'gd_place'; |
|
412 | + } |
|
413 | + |
|
414 | + // Check we have a valid sort_order |
|
415 | + $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
416 | + |
|
417 | + // Match the chosen animation to our options |
|
418 | + $animation_list = array('slide', 'fade'); |
|
419 | + if (!(in_array($params['animation'], $animation_list))) { |
|
420 | + $params['animation'] = 'slide'; |
|
421 | + } |
|
422 | + |
|
423 | + // Post_number needs to be a positive integer |
|
424 | + $params['post_number'] = absint($params['post_number']); |
|
425 | + if (0 == $params['post_number']) { |
|
426 | + $params['post_number'] = 1; |
|
427 | + } |
|
428 | + |
|
429 | + // Manage the entered categories |
|
430 | + if (0 != $params['category'] || '' != $params['category']) { |
|
431 | + $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
432 | + } |
|
433 | + // Convert show_title to a bool |
|
434 | + $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
435 | + |
|
436 | + // Convert show_featured_only to a bool |
|
437 | + $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
438 | + |
|
439 | + /* |
|
440 | 440 | * Hopefully all attributes are now valid, and safe to pass forward |
441 | 441 | */ |
442 | 442 | |
443 | - // redeclare vars after validation |
|
444 | - |
|
445 | - if (isset($params['direction_nav'])) { |
|
446 | - $params['directionNav'] = $params['direction_nav']; |
|
447 | - } |
|
448 | - if (isset($params['animation_loop'])) { |
|
449 | - $params['animationLoop'] = $params['animation_loop']; |
|
450 | - } |
|
451 | - if (isset($params['slideshow_speed'])) { |
|
452 | - $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
453 | - } |
|
454 | - if (isset($params['animation_speed'])) { |
|
455 | - $params['animationSpeed'] = $params['animation_speed']; |
|
456 | - } |
|
457 | - if (isset($params['order_by'])) { |
|
458 | - $params['list_sort'] = $params['order_by']; |
|
459 | - } |
|
460 | - |
|
461 | - $query_args = array( |
|
462 | - 'post_number' => $params['post_number'], |
|
463 | - 'is_geodir_loop' => true, |
|
464 | - 'post_type' => $params['post_type'], |
|
465 | - 'order_by' => $params['order_by'] |
|
466 | - ); |
|
467 | - |
|
468 | - if (1 == $params['show_featured_only']) { |
|
469 | - $query_args['show_featured_only'] = 1; |
|
470 | - } |
|
471 | - |
|
472 | - if (0 != $params['category'] && '' != $params['category']) { |
|
473 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
474 | - $tax_query = array( |
|
475 | - 'taxonomy' => $category_taxonomy[0], |
|
476 | - 'field' => 'id', |
|
477 | - 'terms' => $params['category'], |
|
478 | - ); |
|
479 | - |
|
480 | - $query_args['tax_query'] = array($tax_query); |
|
481 | - } |
|
482 | - |
|
483 | - $defaults = array( |
|
484 | - 'before_widget' => '', |
|
485 | - 'after_widget' => '', |
|
486 | - 'before_title' => '', |
|
487 | - 'after_title' => '', |
|
488 | - ); |
|
489 | - |
|
490 | - $query_args = array_merge($query_args, $params); |
|
491 | - |
|
492 | - geodir_listing_slider_widget_output($defaults, $query_args); |
|
493 | - |
|
494 | - $output = ob_get_contents(); |
|
495 | - |
|
496 | - ob_end_clean(); |
|
497 | - |
|
498 | - return $output; |
|
443 | + // redeclare vars after validation |
|
444 | + |
|
445 | + if (isset($params['direction_nav'])) { |
|
446 | + $params['directionNav'] = $params['direction_nav']; |
|
447 | + } |
|
448 | + if (isset($params['animation_loop'])) { |
|
449 | + $params['animationLoop'] = $params['animation_loop']; |
|
450 | + } |
|
451 | + if (isset($params['slideshow_speed'])) { |
|
452 | + $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
453 | + } |
|
454 | + if (isset($params['animation_speed'])) { |
|
455 | + $params['animationSpeed'] = $params['animation_speed']; |
|
456 | + } |
|
457 | + if (isset($params['order_by'])) { |
|
458 | + $params['list_sort'] = $params['order_by']; |
|
459 | + } |
|
460 | + |
|
461 | + $query_args = array( |
|
462 | + 'post_number' => $params['post_number'], |
|
463 | + 'is_geodir_loop' => true, |
|
464 | + 'post_type' => $params['post_type'], |
|
465 | + 'order_by' => $params['order_by'] |
|
466 | + ); |
|
467 | + |
|
468 | + if (1 == $params['show_featured_only']) { |
|
469 | + $query_args['show_featured_only'] = 1; |
|
470 | + } |
|
471 | + |
|
472 | + if (0 != $params['category'] && '' != $params['category']) { |
|
473 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
474 | + $tax_query = array( |
|
475 | + 'taxonomy' => $category_taxonomy[0], |
|
476 | + 'field' => 'id', |
|
477 | + 'terms' => $params['category'], |
|
478 | + ); |
|
479 | + |
|
480 | + $query_args['tax_query'] = array($tax_query); |
|
481 | + } |
|
482 | + |
|
483 | + $defaults = array( |
|
484 | + 'before_widget' => '', |
|
485 | + 'after_widget' => '', |
|
486 | + 'before_title' => '', |
|
487 | + 'after_title' => '', |
|
488 | + ); |
|
489 | + |
|
490 | + $query_args = array_merge($query_args, $params); |
|
491 | + |
|
492 | + geodir_listing_slider_widget_output($defaults, $query_args); |
|
493 | + |
|
494 | + $output = ob_get_contents(); |
|
495 | + |
|
496 | + ob_end_clean(); |
|
497 | + |
|
498 | + return $output; |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | add_shortcode('gd_login_box', 'geodir_sc_login_box'); |
@@ -519,22 +519,22 @@ discard block |
||
519 | 519 | */ |
520 | 520 | function geodir_sc_login_box($atts) |
521 | 521 | { |
522 | - ob_start(); |
|
522 | + ob_start(); |
|
523 | 523 | |
524 | - $defaults = array( |
|
525 | - 'before_widget' => '', |
|
526 | - 'after_widget' => '', |
|
527 | - 'before_title' => '', |
|
528 | - 'after_title' => '', |
|
529 | - ); |
|
524 | + $defaults = array( |
|
525 | + 'before_widget' => '', |
|
526 | + 'after_widget' => '', |
|
527 | + 'before_title' => '', |
|
528 | + 'after_title' => '', |
|
529 | + ); |
|
530 | 530 | |
531 | - geodir_loginwidget_output($defaults, $defaults); |
|
531 | + geodir_loginwidget_output($defaults, $defaults); |
|
532 | 532 | |
533 | - $output = ob_get_contents(); |
|
533 | + $output = ob_get_contents(); |
|
534 | 534 | |
535 | - ob_end_clean(); |
|
535 | + ob_end_clean(); |
|
536 | 536 | |
537 | - return $output; |
|
537 | + return $output; |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category'); |
@@ -563,28 +563,28 @@ discard block |
||
563 | 563 | */ |
564 | 564 | function geodir_sc_popular_post_category($atts) |
565 | 565 | { |
566 | - ob_start(); |
|
567 | - global $geodir_post_category_str; |
|
568 | - $defaults = array( |
|
569 | - 'category_limit' => 15, |
|
570 | - 'before_widget' => '', |
|
571 | - 'after_widget' => '', |
|
572 | - 'before_title' => '', |
|
573 | - 'after_title' => '', |
|
574 | - 'title' => '', |
|
566 | + ob_start(); |
|
567 | + global $geodir_post_category_str; |
|
568 | + $defaults = array( |
|
569 | + 'category_limit' => 15, |
|
570 | + 'before_widget' => '', |
|
571 | + 'after_widget' => '', |
|
572 | + 'before_title' => '', |
|
573 | + 'after_title' => '', |
|
574 | + 'title' => '', |
|
575 | 575 | 'default_post_type' => '', |
576 | - ); |
|
576 | + ); |
|
577 | 577 | |
578 | - $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
579 | - $params['category_limit'] = absint($params['category_limit']); |
|
578 | + $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
579 | + $params['category_limit'] = absint($params['category_limit']); |
|
580 | 580 | $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; |
581 | - geodir_popular_post_category_output($params, $params); |
|
581 | + geodir_popular_post_category_output($params, $params); |
|
582 | 582 | |
583 | - $output = ob_get_contents(); |
|
583 | + $output = ob_get_contents(); |
|
584 | 584 | |
585 | - ob_end_clean(); |
|
585 | + ob_end_clean(); |
|
586 | 586 | |
587 | - return $output; |
|
587 | + return $output; |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view'); |
@@ -624,97 +624,97 @@ discard block |
||
624 | 624 | */ |
625 | 625 | function geodir_sc_popular_post_view($atts) |
626 | 626 | { |
627 | - ob_start(); |
|
628 | - $defaults = array( |
|
629 | - 'post_type' => 'gd_place', |
|
630 | - 'category' => '0', |
|
631 | - 'post_number' => '5', |
|
632 | - 'layout' => 'gridview_onehalf', |
|
633 | - 'add_location_filter' => '0', |
|
634 | - 'list_sort' => 'latest', |
|
635 | - 'use_viewing_post_type' => '1', |
|
636 | - 'character_count' => '20', |
|
637 | - 'listing_width' => '', |
|
638 | - 'show_featured_only' => '0', |
|
639 | - 'show_special_only' => '0', |
|
640 | - 'with_pics_only' => '0', |
|
641 | - 'with_videos_only' => '0', |
|
642 | - 'before_widget' => '', |
|
643 | - 'after_widget' => '', |
|
644 | - 'before_title' => '<h3 class="widget-title">', |
|
645 | - 'after_title' => '</h3>', |
|
646 | - 'title' => '', |
|
647 | - 'category_title' => '', |
|
648 | - ); |
|
649 | - |
|
650 | - $params = shortcode_atts($defaults, $atts); |
|
651 | - |
|
652 | - /** |
|
653 | - * Validate our incoming params |
|
654 | - */ |
|
627 | + ob_start(); |
|
628 | + $defaults = array( |
|
629 | + 'post_type' => 'gd_place', |
|
630 | + 'category' => '0', |
|
631 | + 'post_number' => '5', |
|
632 | + 'layout' => 'gridview_onehalf', |
|
633 | + 'add_location_filter' => '0', |
|
634 | + 'list_sort' => 'latest', |
|
635 | + 'use_viewing_post_type' => '1', |
|
636 | + 'character_count' => '20', |
|
637 | + 'listing_width' => '', |
|
638 | + 'show_featured_only' => '0', |
|
639 | + 'show_special_only' => '0', |
|
640 | + 'with_pics_only' => '0', |
|
641 | + 'with_videos_only' => '0', |
|
642 | + 'before_widget' => '', |
|
643 | + 'after_widget' => '', |
|
644 | + 'before_title' => '<h3 class="widget-title">', |
|
645 | + 'after_title' => '</h3>', |
|
646 | + 'title' => '', |
|
647 | + 'category_title' => '', |
|
648 | + ); |
|
655 | 649 | |
656 | - // Validate the selected post type, default to gd_place on fail |
|
657 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
658 | - $params['post_type'] = 'gd_place'; |
|
659 | - } |
|
660 | - |
|
661 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
662 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
663 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
664 | - |
|
665 | - // Make sure we have an array |
|
666 | - if (!(is_array($params['category']))) { |
|
667 | - $params['category'] = explode(',', $params['category']); |
|
668 | - } |
|
669 | - |
|
670 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
671 | - // Otherwise it becomes empty and later on that will mean "All" |
|
672 | - $params['category'] = array_intersect($params['category'], $categories); |
|
673 | - |
|
674 | - // Post_number needs to be a positive integer |
|
675 | - $params['post_number'] = absint($params['post_number']); |
|
676 | - if (0 == $params['post_number']) { |
|
677 | - $params['post_number'] = 1; |
|
678 | - } |
|
679 | - |
|
680 | - // Validate our layout choice |
|
681 | - // Outside of the norm, I added some more simple terms to match the existing |
|
682 | - // So now I just run the switch to set it properly. |
|
683 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
684 | - |
|
685 | - // Validate our sorting choice |
|
686 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
687 | - |
|
688 | - // Validate character_count |
|
689 | - $params['character_count'] = absint($params['character_count']); |
|
690 | - if (20 > $params['character_count']) { |
|
691 | - $params['character_count'] = 20; |
|
692 | - } |
|
693 | - |
|
694 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
695 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
696 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
697 | - |
|
698 | - // Validate the checkboxes used on the widget |
|
699 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
700 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
701 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
702 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
703 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
704 | - $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
705 | - |
|
706 | - /** |
|
707 | - * End of validation |
|
708 | - */ |
|
650 | + $params = shortcode_atts($defaults, $atts); |
|
651 | + |
|
652 | + /** |
|
653 | + * Validate our incoming params |
|
654 | + */ |
|
655 | + |
|
656 | + // Validate the selected post type, default to gd_place on fail |
|
657 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
658 | + $params['post_type'] = 'gd_place'; |
|
659 | + } |
|
660 | + |
|
661 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
662 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
663 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
664 | + |
|
665 | + // Make sure we have an array |
|
666 | + if (!(is_array($params['category']))) { |
|
667 | + $params['category'] = explode(',', $params['category']); |
|
668 | + } |
|
669 | + |
|
670 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
671 | + // Otherwise it becomes empty and later on that will mean "All" |
|
672 | + $params['category'] = array_intersect($params['category'], $categories); |
|
673 | + |
|
674 | + // Post_number needs to be a positive integer |
|
675 | + $params['post_number'] = absint($params['post_number']); |
|
676 | + if (0 == $params['post_number']) { |
|
677 | + $params['post_number'] = 1; |
|
678 | + } |
|
679 | + |
|
680 | + // Validate our layout choice |
|
681 | + // Outside of the norm, I added some more simple terms to match the existing |
|
682 | + // So now I just run the switch to set it properly. |
|
683 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
684 | + |
|
685 | + // Validate our sorting choice |
|
686 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
709 | 687 | |
710 | - geodir_popular_postview_output($params, $params); |
|
688 | + // Validate character_count |
|
689 | + $params['character_count'] = absint($params['character_count']); |
|
690 | + if (20 > $params['character_count']) { |
|
691 | + $params['character_count'] = 20; |
|
692 | + } |
|
693 | + |
|
694 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
695 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
696 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
711 | 697 | |
698 | + // Validate the checkboxes used on the widget |
|
699 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
700 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
701 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
702 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
703 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
704 | + $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
705 | + |
|
706 | + /** |
|
707 | + * End of validation |
|
708 | + */ |
|
712 | 709 | |
713 | - $output = ob_get_contents(); |
|
710 | + geodir_popular_postview_output($params, $params); |
|
714 | 711 | |
715 | - ob_end_clean(); |
|
716 | 712 | |
717 | - return $output; |
|
713 | + $output = ob_get_contents(); |
|
714 | + |
|
715 | + ob_end_clean(); |
|
716 | + |
|
717 | + return $output; |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews'); |
@@ -736,37 +736,37 @@ discard block |
||
736 | 736 | * @return string Recent reviews HTML. |
737 | 737 | */ |
738 | 738 | function geodir_sc_recent_reviews($atts) { |
739 | - ob_start(); |
|
740 | - $defaults = array( |
|
739 | + ob_start(); |
|
740 | + $defaults = array( |
|
741 | 741 | 'title' => '', |
742 | 742 | 'count' => 5, |
743 | - ); |
|
743 | + ); |
|
744 | 744 | |
745 | - $params = shortcode_atts($defaults, $atts); |
|
745 | + $params = shortcode_atts($defaults, $atts); |
|
746 | 746 | |
747 | - $count = absint($params['count']); |
|
748 | - if (0 == $count) { |
|
749 | - $count = 1; |
|
750 | - } |
|
747 | + $count = absint($params['count']); |
|
748 | + if (0 == $count) { |
|
749 | + $count = 1; |
|
750 | + } |
|
751 | 751 | |
752 | 752 | $title = !empty($params['title']) ? __($params['title'], 'geodirectory') : ''; |
753 | 753 | |
754 | - $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
754 | + $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
755 | 755 | |
756 | - if ($comments_li) { |
|
757 | - if ($title != '') { ?> |
|
756 | + if ($comments_li) { |
|
757 | + if ($title != '') { ?> |
|
758 | 758 | <h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3> |
759 | 759 | <?php } ?> |
760 | 760 | <div class="geodir_sc_recent_reviews_section"> |
761 | 761 | <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul> |
762 | 762 | </div> |
763 | 763 | <?php |
764 | - } |
|
765 | - $output = ob_get_contents(); |
|
764 | + } |
|
765 | + $output = ob_get_contents(); |
|
766 | 766 | |
767 | - ob_end_clean(); |
|
767 | + ob_end_clean(); |
|
768 | 768 | |
769 | - return $output; |
|
769 | + return $output; |
|
770 | 770 | } |
771 | 771 | |
772 | 772 | add_shortcode('gd_related_listings', 'geodir_sc_related_listings'); |
@@ -796,64 +796,64 @@ discard block |
||
796 | 796 | */ |
797 | 797 | function geodir_sc_related_listings($atts) |
798 | 798 | { |
799 | - ob_start(); |
|
800 | - $defaults = array( |
|
801 | - 'post_number' => 5, |
|
802 | - 'relate_to' => 'category', |
|
803 | - 'layout' => 'gridview_onehalf', |
|
804 | - 'add_location_filter' => 0, |
|
805 | - 'listing_width' => '', |
|
806 | - 'list_sort' => 'latest', |
|
807 | - 'character_count' => 20, |
|
808 | - 'is_widget' => 1, |
|
809 | - 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
810 | - ); |
|
811 | - // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
812 | - |
|
813 | - $params = shortcode_atts($defaults, $atts); |
|
814 | - |
|
815 | - /** |
|
816 | - * Begin validating parameters |
|
817 | - */ |
|
799 | + ob_start(); |
|
800 | + $defaults = array( |
|
801 | + 'post_number' => 5, |
|
802 | + 'relate_to' => 'category', |
|
803 | + 'layout' => 'gridview_onehalf', |
|
804 | + 'add_location_filter' => 0, |
|
805 | + 'listing_width' => '', |
|
806 | + 'list_sort' => 'latest', |
|
807 | + 'character_count' => 20, |
|
808 | + 'is_widget' => 1, |
|
809 | + 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
810 | + ); |
|
811 | + // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
812 | + |
|
813 | + $params = shortcode_atts($defaults, $atts); |
|
814 | + |
|
815 | + /** |
|
816 | + * Begin validating parameters |
|
817 | + */ |
|
818 | 818 | |
819 | - // Validate that post_number is a number and is 1 or higher |
|
820 | - $params['post_number'] = absint($params['post_number']); |
|
821 | - if (0 === $params['post_number']) { |
|
822 | - $params['post_number'] = 1; |
|
823 | - } |
|
819 | + // Validate that post_number is a number and is 1 or higher |
|
820 | + $params['post_number'] = absint($params['post_number']); |
|
821 | + if (0 === $params['post_number']) { |
|
822 | + $params['post_number'] = 1; |
|
823 | + } |
|
824 | 824 | |
825 | - // Validate relate_to - only category or tags |
|
826 | - $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
827 | - if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
828 | - $params['relate_to'] = 'category'; |
|
829 | - } |
|
825 | + // Validate relate_to - only category or tags |
|
826 | + $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
827 | + if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
828 | + $params['relate_to'] = 'category'; |
|
829 | + } |
|
830 | 830 | |
831 | - // Validate layout selection |
|
832 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
831 | + // Validate layout selection |
|
832 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
833 | 833 | |
834 | - // Validate sorting option |
|
835 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
834 | + // Validate sorting option |
|
835 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
836 | 836 | |
837 | - // Validate add_location_filter |
|
838 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
837 | + // Validate add_location_filter |
|
838 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
839 | 839 | |
840 | - // Validate listing_width |
|
841 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
840 | + // Validate listing_width |
|
841 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
842 | 842 | |
843 | - // Validate character_count |
|
844 | - $params['character_count'] = absint($params['character_count']); |
|
845 | - if (20 > $params['character_count']) { |
|
846 | - $params['character_count'] = 20; |
|
847 | - } |
|
843 | + // Validate character_count |
|
844 | + $params['character_count'] = absint($params['character_count']); |
|
845 | + if (20 > $params['character_count']) { |
|
846 | + $params['character_count'] = 20; |
|
847 | + } |
|
848 | 848 | |
849 | - if ($related_display = geodir_related_posts_display($params)) { |
|
850 | - echo $related_display; |
|
851 | - } |
|
852 | - $output = ob_get_contents(); |
|
849 | + if ($related_display = geodir_related_posts_display($params)) { |
|
850 | + echo $related_display; |
|
851 | + } |
|
852 | + $output = ob_get_contents(); |
|
853 | 853 | |
854 | - ob_end_clean(); |
|
854 | + ob_end_clean(); |
|
855 | 855 | |
856 | - return $output; |
|
856 | + return $output; |
|
857 | 857 | } |
858 | 858 | |
859 | 859 | /** |
@@ -877,12 +877,12 @@ discard block |
||
877 | 877 | * @return string Advanced search widget HTML. |
878 | 878 | */ |
879 | 879 | function geodir_sc_advanced_search($atts) { |
880 | - $defaults = array( |
|
880 | + $defaults = array( |
|
881 | 881 | 'title' => '', |
882 | 882 | 'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advanced_search_widget">', |
883 | - 'after_widget' => '</section>', |
|
884 | - 'before_title' => '<h3 class="widget-title">', |
|
885 | - 'after_title' => '</h3>', |
|
883 | + 'after_widget' => '</section>', |
|
884 | + 'before_title' => '<h3 class="widget-title">', |
|
885 | + 'after_title' => '</h3>', |
|
886 | 886 | 'show_adv_search' => 'default' |
887 | 887 | ); |
888 | 888 | |
@@ -906,9 +906,9 @@ discard block |
||
906 | 906 | the_widget('geodir_advance_search_widget', $params, $params ); |
907 | 907 | |
908 | 908 | $output = ob_get_contents(); |
909 | - ob_end_clean(); |
|
909 | + ob_end_clean(); |
|
910 | 910 | |
911 | - return $output; |
|
911 | + return $output; |
|
912 | 912 | } |
913 | 913 | add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search'); |
914 | 914 | |
@@ -954,48 +954,48 @@ discard block |
||
954 | 954 | 'add_location_filter' => '1', |
955 | 955 | 'tab_layout' => 'bestof-tabs-on-top', |
956 | 956 | 'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">', |
957 | - 'after_widget' => '</section>', |
|
958 | - 'before_title' => '<h3 class="widget-title">', |
|
959 | - 'after_title' => '</h3>', |
|
957 | + 'after_widget' => '</section>', |
|
958 | + 'before_title' => '<h3 class="widget-title">', |
|
959 | + 'after_title' => '</h3>', |
|
960 | 960 | ); |
961 | 961 | $params = shortcode_atts($defaults, $atts); |
962 | 962 | |
963 | - /** |
|
964 | - * Validate our incoming params |
|
965 | - */ |
|
963 | + /** |
|
964 | + * Validate our incoming params |
|
965 | + */ |
|
966 | 966 | |
967 | - // Validate the selected post type, default to gd_place on fail |
|
968 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
969 | - $params['post_type'] = 'gd_place'; |
|
970 | - } |
|
967 | + // Validate the selected post type, default to gd_place on fail |
|
968 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
969 | + $params['post_type'] = 'gd_place'; |
|
970 | + } |
|
971 | 971 | |
972 | 972 | // Post limit needs to be a positive integer |
973 | - $params['post_limit'] = absint($params['post_limit']); |
|
974 | - if (0 == $params['post_limit']) { |
|
975 | - $params['post_limit'] = 5; |
|
976 | - } |
|
973 | + $params['post_limit'] = absint($params['post_limit']); |
|
974 | + if (0 == $params['post_limit']) { |
|
975 | + $params['post_limit'] = 5; |
|
976 | + } |
|
977 | 977 | |
978 | 978 | // Category limit needs to be a positive integer |
979 | - $params['categ_limit'] = absint($params['categ_limit']); |
|
980 | - if (0 == $params['categ_limit']) { |
|
981 | - $params['categ_limit'] = 3; |
|
982 | - } |
|
979 | + $params['categ_limit'] = absint($params['categ_limit']); |
|
980 | + if (0 == $params['categ_limit']) { |
|
981 | + $params['categ_limit'] = 3; |
|
982 | + } |
|
983 | 983 | |
984 | 984 | // Tab layout validation |
985 | - $params['tab_layout'] = $params['tab_layout']; |
|
986 | - if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
987 | - $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
988 | - } |
|
985 | + $params['tab_layout'] = $params['tab_layout']; |
|
986 | + if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
987 | + $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
988 | + } |
|
989 | 989 | |
990 | 990 | // Validate character_count |
991 | - $params['character_count'] = $params['character_count']; |
|
991 | + $params['character_count'] = $params['character_count']; |
|
992 | 992 | |
993 | 993 | ob_start(); |
994 | 994 | the_widget('geodir_bestof_widget', $params, $params); |
995 | - $output = ob_get_contents(); |
|
996 | - ob_end_clean(); |
|
995 | + $output = ob_get_contents(); |
|
996 | + ob_end_clean(); |
|
997 | 997 | |
998 | - return $output; |
|
998 | + return $output; |
|
999 | 999 | } |
1000 | 1000 | add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget'); |
1001 | 1001 | |
@@ -1041,113 +1041,113 @@ discard block |
||
1041 | 1041 | * @return string HTML content to display geodirectory listings. |
1042 | 1042 | */ |
1043 | 1043 | function geodir_sc_gd_listings($atts, $content = '') { |
1044 | - global $post; |
|
1044 | + global $post; |
|
1045 | 1045 | |
1046 | - $defaults = array( |
|
1047 | - 'title' => '', |
|
1048 | - 'post_type' => 'gd_place', |
|
1049 | - 'category' => 0, |
|
1050 | - 'list_sort' => 'latest', |
|
1051 | - 'event_type' => '', |
|
1052 | - 'post_number' => 10, |
|
1053 | - 'post_author' => '', |
|
1054 | - 'layout' => 'gridview_onehalf', |
|
1055 | - 'listing_width' => '', |
|
1056 | - 'character_count' => 20, |
|
1057 | - 'add_location_filter' => 1, |
|
1058 | - 'show_featured_only' => '', |
|
1059 | - 'show_special_only' => '', |
|
1060 | - 'with_pics_only' => '', |
|
1061 | - 'with_videos_only' => '', |
|
1062 | - 'with_pagination' => '1', |
|
1063 | - 'top_pagination' => '0', |
|
1064 | - 'bottom_pagination' => '1', |
|
1065 | - 'without_no_results' => 0, |
|
1066 | - ); |
|
1067 | - $params = shortcode_atts($defaults, $atts); |
|
1068 | - |
|
1069 | - $params['title'] = wp_strip_all_tags($params['title']); |
|
1070 | - $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
1071 | - |
|
1072 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
1073 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
1074 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
1075 | - |
|
1076 | - // Make sure we have an array |
|
1077 | - if (!(is_array($params['category']))) { |
|
1078 | - $params['category'] = explode(',', $params['category']); |
|
1079 | - } |
|
1080 | - |
|
1081 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
1082 | - // Otherwise it becomes empty and later on that will mean "All" |
|
1083 | - $params['category'] = array_intersect($params['category'], $categories); |
|
1084 | - |
|
1085 | - // Post_number needs to be a positive integer |
|
1086 | - $params['post_number'] = absint($params['post_number']); |
|
1087 | - $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
1046 | + $defaults = array( |
|
1047 | + 'title' => '', |
|
1048 | + 'post_type' => 'gd_place', |
|
1049 | + 'category' => 0, |
|
1050 | + 'list_sort' => 'latest', |
|
1051 | + 'event_type' => '', |
|
1052 | + 'post_number' => 10, |
|
1053 | + 'post_author' => '', |
|
1054 | + 'layout' => 'gridview_onehalf', |
|
1055 | + 'listing_width' => '', |
|
1056 | + 'character_count' => 20, |
|
1057 | + 'add_location_filter' => 1, |
|
1058 | + 'show_featured_only' => '', |
|
1059 | + 'show_special_only' => '', |
|
1060 | + 'with_pics_only' => '', |
|
1061 | + 'with_videos_only' => '', |
|
1062 | + 'with_pagination' => '1', |
|
1063 | + 'top_pagination' => '0', |
|
1064 | + 'bottom_pagination' => '1', |
|
1065 | + 'without_no_results' => 0, |
|
1066 | + ); |
|
1067 | + $params = shortcode_atts($defaults, $atts); |
|
1068 | + |
|
1069 | + $params['title'] = wp_strip_all_tags($params['title']); |
|
1070 | + $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
1071 | + |
|
1072 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
1073 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
1074 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
1075 | + |
|
1076 | + // Make sure we have an array |
|
1077 | + if (!(is_array($params['category']))) { |
|
1078 | + $params['category'] = explode(',', $params['category']); |
|
1079 | + } |
|
1080 | + |
|
1081 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
1082 | + // Otherwise it becomes empty and later on that will mean "All" |
|
1083 | + $params['category'] = array_intersect($params['category'], $categories); |
|
1084 | + |
|
1085 | + // Post_number needs to be a positive integer |
|
1086 | + $params['post_number'] = absint($params['post_number']); |
|
1087 | + $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
1088 | 1088 | |
1089 | - // Post_number needs to be a positive integer |
|
1090 | - if (!empty($atts['post_author'])) { |
|
1091 | - if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1092 | - $params['post_author'] = $post->post_author; |
|
1093 | - } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
1094 | - $params['post_author'] = absint($atts['post_author']); |
|
1095 | - } else { |
|
1096 | - unset($params['post_author']); |
|
1097 | - } |
|
1098 | - } else { |
|
1099 | - unset($params['post_author']); |
|
1100 | - } |
|
1101 | - |
|
1102 | - // Validate character_count |
|
1103 | - //todo: is this necessary? |
|
1104 | - $params['character_count'] = $params['character_count']; |
|
1105 | - |
|
1106 | - // Validate our layout choice |
|
1107 | - // Outside of the norm, I added some more simple terms to match the existing |
|
1108 | - // So now I just run the switch to set it properly. |
|
1109 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
1110 | - |
|
1111 | - // Validate our sorting choice |
|
1112 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
1113 | - |
|
1114 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
1115 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
1116 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1117 | - |
|
1118 | - // Validate the checkboxes used on the widget |
|
1119 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1120 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
1121 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
1122 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
1123 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
1124 | - $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
1125 | - $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
1126 | - $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
1127 | - |
|
1128 | - /** |
|
1129 | - * End of validation |
|
1130 | - */ |
|
1131 | - if (isset($atts['geodir_ajax'])) { |
|
1132 | - $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
1133 | - unset($atts['geodir_ajax']); |
|
1134 | - } |
|
1135 | - if (isset($atts['pageno'])) { |
|
1136 | - $params['pageno'] = $atts['pageno']; |
|
1137 | - unset($atts['pageno']); |
|
1138 | - } |
|
1139 | - |
|
1140 | - if ( !empty($atts['shortcode_content']) ) { |
|
1141 | - $content = $atts['shortcode_content']; |
|
1142 | - } |
|
1143 | - $params['shortcode_content'] = trim($content); |
|
1144 | - $atts['shortcode_content'] = trim($content); |
|
1089 | + // Post_number needs to be a positive integer |
|
1090 | + if (!empty($atts['post_author'])) { |
|
1091 | + if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1092 | + $params['post_author'] = $post->post_author; |
|
1093 | + } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
1094 | + $params['post_author'] = absint($atts['post_author']); |
|
1095 | + } else { |
|
1096 | + unset($params['post_author']); |
|
1097 | + } |
|
1098 | + } else { |
|
1099 | + unset($params['post_author']); |
|
1100 | + } |
|
1101 | + |
|
1102 | + // Validate character_count |
|
1103 | + //todo: is this necessary? |
|
1104 | + $params['character_count'] = $params['character_count']; |
|
1105 | + |
|
1106 | + // Validate our layout choice |
|
1107 | + // Outside of the norm, I added some more simple terms to match the existing |
|
1108 | + // So now I just run the switch to set it properly. |
|
1109 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
1110 | + |
|
1111 | + // Validate our sorting choice |
|
1112 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
1113 | + |
|
1114 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
1115 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
1116 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1117 | + |
|
1118 | + // Validate the checkboxes used on the widget |
|
1119 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1120 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
1121 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
1122 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
1123 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
1124 | + $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
1125 | + $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
1126 | + $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
1127 | + |
|
1128 | + /** |
|
1129 | + * End of validation |
|
1130 | + */ |
|
1131 | + if (isset($atts['geodir_ajax'])) { |
|
1132 | + $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
1133 | + unset($atts['geodir_ajax']); |
|
1134 | + } |
|
1135 | + if (isset($atts['pageno'])) { |
|
1136 | + $params['pageno'] = $atts['pageno']; |
|
1137 | + unset($atts['pageno']); |
|
1138 | + } |
|
1139 | + |
|
1140 | + if ( !empty($atts['shortcode_content']) ) { |
|
1141 | + $content = $atts['shortcode_content']; |
|
1142 | + } |
|
1143 | + $params['shortcode_content'] = trim($content); |
|
1144 | + $atts['shortcode_content'] = trim($content); |
|
1145 | 1145 | |
1146 | - $params['shortcode_atts'] = $atts; |
|
1146 | + $params['shortcode_atts'] = $atts; |
|
1147 | 1147 | |
1148 | - $output = geodir_sc_gd_listings_output($params); |
|
1148 | + $output = geodir_sc_gd_listings_output($params); |
|
1149 | 1149 | |
1150 | - return $output; |
|
1150 | + return $output; |
|
1151 | 1151 | } |
1152 | 1152 | add_shortcode('gd_listings', 'geodir_sc_gd_listings'); |
1153 | 1153 | |
@@ -1195,23 +1195,23 @@ discard block |
||
1195 | 1195 | 'max_count' => 'all', |
1196 | 1196 | 'max_level' => '1', |
1197 | 1197 | 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
1198 | - 'after_widget' => '</section>', |
|
1199 | - 'before_title' => '<h3 class="widget-title">', |
|
1200 | - 'after_title' => '</h3>', |
|
1198 | + 'after_widget' => '</section>', |
|
1199 | + 'before_title' => '<h3 class="widget-title">', |
|
1200 | + 'after_title' => '</h3>', |
|
1201 | 1201 | ); |
1202 | 1202 | $params = shortcode_atts($defaults, $atts); |
1203 | 1203 | |
1204 | - /** |
|
1205 | - * Validate our incoming params |
|
1206 | - */ |
|
1204 | + /** |
|
1205 | + * Validate our incoming params |
|
1206 | + */ |
|
1207 | 1207 | // Make sure we have an array |
1208 | - $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
1208 | + $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
1209 | 1209 | |
1210 | 1210 | // Validate the checkboxes used on the widget |
1211 | - $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
1212 | - $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
1213 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1214 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1211 | + $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
1212 | + $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
1213 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1214 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1215 | 1215 | |
1216 | 1216 | if ($params['max_count'] != 'all') { |
1217 | 1217 | $params['max_count'] = absint($params['max_count']); |
@@ -1225,10 +1225,10 @@ discard block |
||
1225 | 1225 | |
1226 | 1226 | ob_start(); |
1227 | 1227 | the_widget('geodir_cpt_categories_widget', $params, $params); |
1228 | - $output = ob_get_contents(); |
|
1229 | - ob_end_clean(); |
|
1228 | + $output = ob_get_contents(); |
|
1229 | + ob_end_clean(); |
|
1230 | 1230 | |
1231 | - return $output; |
|
1231 | + return $output; |
|
1232 | 1232 | } |
1233 | 1233 | add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget'); |
1234 | 1234 | ?> |
1235 | 1235 | \ No newline at end of file |
@@ -202,14 +202,14 @@ discard block |
||
202 | 202 | // Add marker cluster |
203 | 203 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
204 | 204 | $map_args['enable_marker_cluster'] = true; |
205 | - if(get_option('geodir_marker_cluster_type')) { |
|
205 | + if (get_option('geodir_marker_cluster_type')) { |
|
206 | 206 | if ($map_args['autozoom']) { |
207 | 207 | $map_args['enable_marker_cluster_no_reposition'] = false; |
208 | 208 | } else { |
209 | 209 | $map_args['enable_marker_cluster_no_reposition'] = true; |
210 | 210 | } |
211 | 211 | |
212 | - $map_args['enable_marker_cluster_server'] = true ; |
|
212 | + $map_args['enable_marker_cluster_server'] = true; |
|
213 | 213 | |
214 | 214 | } |
215 | 215 | } else { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } |
218 | 218 | |
219 | 219 | // if lat and long set in shortcode, hack it so the map is not repositioned |
220 | - if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
220 | + if (!empty($params['latitude']) && !empty($params['longitude'])) { |
|
221 | 221 | $map_args['enable_marker_cluster_no_reposition'] = true; |
222 | 222 | } |
223 | 223 | |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | |
891 | 891 | $show_adv_search = isset($params['show_adv_search']) && in_array($params['show_adv_search'], array('default', 'always', 'searched')) ? $params['show_adv_search'] : ''; |
892 | 892 | |
893 | - if ($show_adv_search != '' ) { |
|
893 | + if ($show_adv_search != '') { |
|
894 | 894 | $show_adv_class = 'geodir-advance-search-' . $show_adv_search . ' '; |
895 | 895 | if ($show_adv_search == 'searched' && geodir_is_page('search')) { |
896 | 896 | $show_adv_search = 'search'; |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | ob_start(); |
904 | 904 | |
905 | 905 | //geodir_get_template_part('listing', 'filter-form'); |
906 | - the_widget('geodir_advance_search_widget', $params, $params ); |
|
906 | + the_widget('geodir_advance_search_widget', $params, $params); |
|
907 | 907 | |
908 | 908 | $output = ob_get_contents(); |
909 | 909 | ob_end_clean(); |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | |
1102 | 1102 | // Validate character_count |
1103 | 1103 | //todo: is this necessary? |
1104 | - $params['character_count'] = $params['character_count']; |
|
1104 | + $params['character_count'] = $params['character_count']; |
|
1105 | 1105 | |
1106 | 1106 | // Validate our layout choice |
1107 | 1107 | // Outside of the norm, I added some more simple terms to match the existing |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | |
1114 | 1114 | // Validate Listing width, used in the template widget-listing-listview.php |
1115 | 1115 | // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
1116 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1116 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1117 | 1117 | |
1118 | 1118 | // Validate the checkboxes used on the widget |
1119 | 1119 | $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
@@ -1137,13 +1137,13 @@ discard block |
||
1137 | 1137 | unset($atts['pageno']); |
1138 | 1138 | } |
1139 | 1139 | |
1140 | - if ( !empty($atts['shortcode_content']) ) { |
|
1140 | + if (!empty($atts['shortcode_content'])) { |
|
1141 | 1141 | $content = $atts['shortcode_content']; |
1142 | 1142 | } |
1143 | 1143 | $params['shortcode_content'] = trim($content); |
1144 | 1144 | $atts['shortcode_content'] = trim($content); |
1145 | 1145 | |
1146 | - $params['shortcode_atts'] = $atts; |
|
1146 | + $params['shortcode_atts'] = $atts; |
|
1147 | 1147 | |
1148 | 1148 | $output = geodir_sc_gd_listings_output($params); |
1149 | 1149 | |
@@ -1210,8 +1210,8 @@ discard block |
||
1210 | 1210 | // Validate the checkboxes used on the widget |
1211 | 1211 | $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
1212 | 1212 | $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
1213 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1214 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1213 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1214 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1215 | 1215 | |
1216 | 1216 | if ($params['max_count'] != 'all') { |
1217 | 1217 | $params['max_count'] = absint($params['max_count']); |