Test Failed
Push — master ( 604a51...06830e )
by Stiofan
07:59
created
geodirectory_shortcodes.php 1 patch
Indentation   +671 added lines, -671 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 // If this file is called directly, abort.
9 9
 if (!defined('WPINC')) {
10
-    die;
10
+	die;
11 11
 }
12 12
 require_once('geodirectory-functions/shortcode_functions.php');
13 13
 
@@ -32,43 +32,43 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function geodir_sc_add_listing($atts)
34 34
 {
35
-    ob_start();
36
-    $defaults = array(
37
-        'pid' => '',
38
-        'listing_type' => 'gd_place',
39
-        'login_msg' => __('You must login to post.', 'geodirectory'),
40
-        'show_login' => false,
41
-    );
42
-    $params = shortcode_atts($defaults, $atts);
43
-
44
-    foreach ($params as $key => $value) {
45
-        $_REQUEST[$key] = $value;
46
-    }
47
-
48
-    $user_id = get_current_user_id();
49
-    if (!$user_id) {
50
-        echo $params['login_msg'];
51
-        if ($params['show_login']) {
52
-            echo "<br />";
53
-            $defaults = array(
54
-                'before_widget' => '',
55
-                'after_widget' => '',
56
-                'before_title' => '',
57
-                'after_title' => '',
58
-            );
59
-
60
-            geodir_loginwidget_output($defaults, $defaults);
61
-        }
62
-
63
-
64
-    } else {
65
-       // Add listing page will be used if shortcode is detected in page content, no need to call it here
66
-    }
67
-    $output = ob_get_contents();
68
-
69
-    ob_end_clean();
70
-
71
-    return $output;
35
+	ob_start();
36
+	$defaults = array(
37
+		'pid' => '',
38
+		'listing_type' => 'gd_place',
39
+		'login_msg' => __('You must login to post.', 'geodirectory'),
40
+		'show_login' => false,
41
+	);
42
+	$params = shortcode_atts($defaults, $atts);
43
+
44
+	foreach ($params as $key => $value) {
45
+		$_REQUEST[$key] = $value;
46
+	}
47
+
48
+	$user_id = get_current_user_id();
49
+	if (!$user_id) {
50
+		echo $params['login_msg'];
51
+		if ($params['show_login']) {
52
+			echo "<br />";
53
+			$defaults = array(
54
+				'before_widget' => '',
55
+				'after_widget' => '',
56
+				'before_title' => '',
57
+				'after_title' => '',
58
+			);
59
+
60
+			geodir_loginwidget_output($defaults, $defaults);
61
+		}
62
+
63
+
64
+	} else {
65
+	   // Add listing page will be used if shortcode is detected in page content, no need to call it here
66
+	}
67
+	$output = ob_get_contents();
68
+
69
+	ob_end_clean();
70
+
71
+	return $output;
72 72
 }
73 73
 
74 74
 /**
@@ -96,136 +96,136 @@  discard block
 block discarded – undo
96 96
  */
97 97
 function geodir_sc_home_map($atts)
98 98
 {
99
-    ob_start();
100
-    $defaults = array(
101
-        'width' => '960',
102
-        'height' => '425',
103
-        'maptype' => 'ROADMAP',
104
-        'zoom' => '13',
105
-        'autozoom' => '',
106
-        'child_collapse' => '0',
107
-        'scrollwheel' => '0',
99
+	ob_start();
100
+	$defaults = array(
101
+		'width' => '960',
102
+		'height' => '425',
103
+		'maptype' => 'ROADMAP',
104
+		'zoom' => '13',
105
+		'autozoom' => '',
106
+		'child_collapse' => '0',
107
+		'scrollwheel' => '0',
108 108
 		'marker_cluster' => false,
109
-        'latitude' => '',
110
-        'longitude' => ''
111
-    );
112
-
113
-    $params = shortcode_atts($defaults, $atts);
114
-
115
-    $params = gdsc_validate_map_args($params);
116
-
117
-    $map_args = array(
118
-        'map_canvas_name' => 'gd_home_map',
119
-        'latitude' => $params['latitude'],
120
-        'longitude' => $params['longitude'],
121
-
122
-        /**
123
-         * Filter the widget width of the map on home/listings page.
124
-         *
125
-         * @since 1.0.0
126
-         * @param mixed(string|int|float) $params['width'] The map width.
127
-         */
128
-        'width' => apply_filters('widget_width', $params['width']),
129
-        /**
130
-         * Filter the widget height of the map on home/listings page.
131
-         *
132
-         * @since 1.0.0
133
-         * @param mixed(string|int|float) $params['height'] The map height.
134
-         */
135
-        'height' => apply_filters('widget_heigh', $params['height']),
136
-        /**
137
-         * Filter the widget maptype of the map on home/listings page.
138
-         *
139
-         * @since 1.0.0
109
+		'latitude' => '',
110
+		'longitude' => ''
111
+	);
112
+
113
+	$params = shortcode_atts($defaults, $atts);
114
+
115
+	$params = gdsc_validate_map_args($params);
116
+
117
+	$map_args = array(
118
+		'map_canvas_name' => 'gd_home_map',
119
+		'latitude' => $params['latitude'],
120
+		'longitude' => $params['longitude'],
121
+
122
+		/**
123
+		 * Filter the widget width of the map on home/listings page.
124
+		 *
125
+		 * @since 1.0.0
126
+		 * @param mixed(string|int|float) $params['width'] The map width.
127
+		 */
128
+		'width' => apply_filters('widget_width', $params['width']),
129
+		/**
130
+		 * Filter the widget height of the map on home/listings page.
131
+		 *
132
+		 * @since 1.0.0
133
+		 * @param mixed(string|int|float) $params['height'] The map height.
134
+		 */
135
+		'height' => apply_filters('widget_heigh', $params['height']),
136
+		/**
137
+		 * Filter the widget maptype of the map on home/listings page.
138
+		 *
139
+		 * @since 1.0.0
140 140
 		 * @since 1.5.2 Added TERRAIN map type.
141
-         * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
142
-         */
143
-        'maptype' => apply_filters('widget_maptype', $params['maptype']),
144
-        /**
145
-         * Filter the widget scrollwheel value of the map on home/listings page.
146
-         *
147
-         * Should the scrollwheel zoom the map or not.
148
-         *
149
-         * @since 1.0.0
150
-         * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
151
-         */
152
-        'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
153
-        /**
154
-         * Filter the widget zoom level of the map on home/listings page.
155
-         *
156
-         * @since 1.0.0
157
-         * @param int $params['zoom'] The zoom level of the map. Between 1-19.
158
-         */
159
-        'zoom' => apply_filters('widget_zoom', $params['zoom']),
160
-        /**
161
-         * Filter the widget auto zoom value of the map on home/listings page.
162
-         *
163
-         * If the map should autozoom to fit the markers shown.
164
-         *
165
-         * @since 1.0.0
166
-         * @param bool $params['autozoom'] True if the map should autozoom, false if not.
167
-         */
168
-        'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
169
-        /**
170
-         * Filter the widget child_collapse value of the map on home/listings page.
171
-         *
172
-         * If the map should auto collapse the child categories if the category bar is present.
173
-         *
174
-         * @since 1.0.0
175
-         * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
176
-         */
177
-        'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
178
-        'enable_cat_filters' => true,
179
-        'enable_text_search' => true,
180
-        'enable_post_type_filters' => true,
181
-        /**
182
-         * Filter the widget enable_location_filters value of the map on home/listings page.
183
-         *
184
-         * This is used when the location addon is used.
185
-         *
186
-         * @since 1.0.0
187
-         * @param bool $val True if location filters should be used, false if not.
188
-         */
189
-        'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
190
-        'enable_jason_on_load' => false,
191
-        'enable_marker_cluster' => false,
192
-        'enable_map_resize_button' => true,
193
-        'map_class_name' => 'geodir-map-home-page',
194
-        'is_geodir_home_map_widget' => true,
195
-    );
141
+		 * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
142
+		 */
143
+		'maptype' => apply_filters('widget_maptype', $params['maptype']),
144
+		/**
145
+		 * Filter the widget scrollwheel value of the map on home/listings page.
146
+		 *
147
+		 * Should the scrollwheel zoom the map or not.
148
+		 *
149
+		 * @since 1.0.0
150
+		 * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
151
+		 */
152
+		'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
153
+		/**
154
+		 * Filter the widget zoom level of the map on home/listings page.
155
+		 *
156
+		 * @since 1.0.0
157
+		 * @param int $params['zoom'] The zoom level of the map. Between 1-19.
158
+		 */
159
+		'zoom' => apply_filters('widget_zoom', $params['zoom']),
160
+		/**
161
+		 * Filter the widget auto zoom value of the map on home/listings page.
162
+		 *
163
+		 * If the map should autozoom to fit the markers shown.
164
+		 *
165
+		 * @since 1.0.0
166
+		 * @param bool $params['autozoom'] True if the map should autozoom, false if not.
167
+		 */
168
+		'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
169
+		/**
170
+		 * Filter the widget child_collapse value of the map on home/listings page.
171
+		 *
172
+		 * If the map should auto collapse the child categories if the category bar is present.
173
+		 *
174
+		 * @since 1.0.0
175
+		 * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
176
+		 */
177
+		'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
178
+		'enable_cat_filters' => true,
179
+		'enable_text_search' => true,
180
+		'enable_post_type_filters' => true,
181
+		/**
182
+		 * Filter the widget enable_location_filters value of the map on home/listings page.
183
+		 *
184
+		 * This is used when the location addon is used.
185
+		 *
186
+		 * @since 1.0.0
187
+		 * @param bool $val True if location filters should be used, false if not.
188
+		 */
189
+		'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
190
+		'enable_jason_on_load' => false,
191
+		'enable_marker_cluster' => false,
192
+		'enable_map_resize_button' => true,
193
+		'map_class_name' => 'geodir-map-home-page',
194
+		'is_geodir_home_map_widget' => true,
195
+	);
196 196
 
197 197
 	// Add marker cluster
198 198
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
199
-        $map_args['enable_marker_cluster'] = true;
200
-        if(get_option('geodir_marker_cluster_type')) {
201
-            if ($map_args['autozoom']) {
202
-                $map_args['enable_marker_cluster_no_reposition'] = false;
203
-            } else {
204
-                $map_args['enable_marker_cluster_no_reposition'] = true;
205
-            }
199
+		$map_args['enable_marker_cluster'] = true;
200
+		if(get_option('geodir_marker_cluster_type')) {
201
+			if ($map_args['autozoom']) {
202
+				$map_args['enable_marker_cluster_no_reposition'] = false;
203
+			} else {
204
+				$map_args['enable_marker_cluster_no_reposition'] = true;
205
+			}
206 206
 
207
-            $map_args['enable_marker_cluster_server'] = true ;
207
+			$map_args['enable_marker_cluster_server'] = true ;
208 208
 
209
-        }
209
+		}
210 210
 	} else {
211 211
 		$map_args['enable_marker_cluster'] = false;
212 212
 	}
213 213
 
214
-    // if lat and long set in shortcode, hack it so the map is not repositioned
215
-    if(!empty($params['latitude']) && !empty($params['longitude']) ){
216
-        $map_args['enable_marker_cluster_no_reposition'] = true;
217
-    }
214
+	// if lat and long set in shortcode, hack it so the map is not repositioned
215
+	if(!empty($params['latitude']) && !empty($params['longitude']) ){
216
+		$map_args['enable_marker_cluster_no_reposition'] = true;
217
+	}
218 218
 
219 219
 
220
-    geodir_draw_map($map_args);
220
+	geodir_draw_map($map_args);
221 221
 
222
-    add_action('wp_footer', 'geodir_home_map_add_script', 100);
222
+	add_action('wp_footer', 'geodir_home_map_add_script', 100);
223 223
 
224
-    $output = ob_get_contents();
224
+	$output = ob_get_contents();
225 225
 
226
-    ob_end_clean();
226
+	ob_end_clean();
227 227
 
228
-    return $output;
228
+	return $output;
229 229
 }
230 230
 add_shortcode('gd_homepage_map', 'geodir_sc_home_map');
231 231
 
@@ -259,77 +259,77 @@  discard block
 block discarded – undo
259 259
  */
260 260
 function geodir_sc_listing_map($atts)
261 261
 {
262
-    ob_start();
263
-    add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
264
-
265
-    add_action('the_post', 'create_list_jsondata'); // Add marker in json array
266
-
267
-    add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
268
-
269
-    $defaults = array(
270
-        'width' => '294',
271
-        'height' => '370',
272
-        'zoom' => '13',
273
-        'autozoom' => '',
274
-        'sticky' => '',
275
-        'showall' => '0',
276
-        'scrollwheel' => '0',
277
-        'maptype' => 'ROADMAP',
278
-        'child_collapse' => 0,
262
+	ob_start();
263
+	add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
264
+
265
+	add_action('the_post', 'create_list_jsondata'); // Add marker in json array
266
+
267
+	add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
268
+
269
+	$defaults = array(
270
+		'width' => '294',
271
+		'height' => '370',
272
+		'zoom' => '13',
273
+		'autozoom' => '',
274
+		'sticky' => '',
275
+		'showall' => '0',
276
+		'scrollwheel' => '0',
277
+		'maptype' => 'ROADMAP',
278
+		'child_collapse' => 0,
279 279
 		'marker_cluster' => false
280
-    );
281
-
282
-    $params = shortcode_atts($defaults, $atts);
283
-
284
-    $params = gdsc_validate_map_args($params);
285
-
286
-    $map_args = array(
287
-        'map_canvas_name' => 'gd_listing_map',
288
-        'width' => $params['width'],
289
-        'height' => $params['height'],
290
-        'zoom' => $params['zoom'],
291
-        'autozoom' => $params['autozoom'],
292
-        'sticky' => $params['sticky'],
293
-        'showall' => $params['showall'],
294
-        'scrollwheel' => $params['scrollwheel'],
295
-        'child_collapse' => 0,
296
-        'enable_cat_filters' => false,
297
-        'enable_text_search' => false,
298
-        'enable_post_type_filters' => false,
299
-        'enable_location_filters' => false,
300
-        'enable_jason_on_load' => true,
301
-    );
302
-
303
-    if (is_single()) {
304
-
305
-        global $post;
306
-        $map_default_lat = $address_latitude = $post->post_latitude;
307
-        $map_default_lng = $address_longitude = $post->post_longitude;
308
-        $mapview = $post->post_mapview;
309
-        $map_args['zoom'] = $post->post_mapzoom;
310
-        $map_args['map_class_name'] = 'geodir-map-listing-page-single';
311
-
312
-    } else {
313
-        $default_location = geodir_get_default_location();
314
-
315
-        $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
316
-        $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
317
-        $map_args['map_class_name'] = 'geodir-map-listing-page';
318
-    }
319
-
320
-    if (empty($mapview)) {
321
-        $mapview = 'ROADMAP';
322
-    }
323
-
324
-    // Set default map options
325
-    $map_args['ajax_url'] = geodir_get_ajax_url();
326
-    $map_args['latitude'] = $map_default_lat;
327
-    $map_args['longitude'] = $map_default_lng;
328
-    $map_args['streetViewControl'] = true;
329
-    $map_args['maptype'] = $mapview;
330
-    $map_args['showPreview'] = '0';
331
-    $map_args['maxZoom'] = 21;
332
-    $map_args['bubble_size'] = 'small';
280
+	);
281
+
282
+	$params = shortcode_atts($defaults, $atts);
283
+
284
+	$params = gdsc_validate_map_args($params);
285
+
286
+	$map_args = array(
287
+		'map_canvas_name' => 'gd_listing_map',
288
+		'width' => $params['width'],
289
+		'height' => $params['height'],
290
+		'zoom' => $params['zoom'],
291
+		'autozoom' => $params['autozoom'],
292
+		'sticky' => $params['sticky'],
293
+		'showall' => $params['showall'],
294
+		'scrollwheel' => $params['scrollwheel'],
295
+		'child_collapse' => 0,
296
+		'enable_cat_filters' => false,
297
+		'enable_text_search' => false,
298
+		'enable_post_type_filters' => false,
299
+		'enable_location_filters' => false,
300
+		'enable_jason_on_load' => true,
301
+	);
302
+
303
+	if (is_single()) {
304
+
305
+		global $post;
306
+		$map_default_lat = $address_latitude = $post->post_latitude;
307
+		$map_default_lng = $address_longitude = $post->post_longitude;
308
+		$mapview = $post->post_mapview;
309
+		$map_args['zoom'] = $post->post_mapzoom;
310
+		$map_args['map_class_name'] = 'geodir-map-listing-page-single';
311
+
312
+	} else {
313
+		$default_location = geodir_get_default_location();
314
+
315
+		$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
316
+		$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
317
+		$map_args['map_class_name'] = 'geodir-map-listing-page';
318
+	}
319
+
320
+	if (empty($mapview)) {
321
+		$mapview = 'ROADMAP';
322
+	}
323
+
324
+	// Set default map options
325
+	$map_args['ajax_url'] = geodir_get_ajax_url();
326
+	$map_args['latitude'] = $map_default_lat;
327
+	$map_args['longitude'] = $map_default_lng;
328
+	$map_args['streetViewControl'] = true;
329
+	$map_args['maptype'] = $mapview;
330
+	$map_args['showPreview'] = '0';
331
+	$map_args['maxZoom'] = 21;
332
+	$map_args['bubble_size'] = 'small';
333 333
 	
334 334
 	// Add marker cluster
335 335
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
@@ -338,13 +338,13 @@  discard block
 block discarded – undo
338 338
 		$map_args['enable_marker_cluster'] = false;
339 339
 	}
340 340
 
341
-    geodir_draw_map($map_args);
341
+	geodir_draw_map($map_args);
342 342
 
343
-    $output = ob_get_contents();
343
+	$output = ob_get_contents();
344 344
 
345
-    ob_end_clean();
345
+	ob_end_clean();
346 346
 
347
-    return $output;
347
+	return $output;
348 348
 }
349 349
 
350 350
 add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider');
@@ -377,120 +377,120 @@  discard block
 block discarded – undo
377 377
  */
378 378
 function geodir_sc_listing_slider($atts)
379 379
 {
380
-    ob_start();
381
-    $defaults = array(
382
-        'post_type' => 'gd_place',
383
-        'category' => '0',
384
-        'post_number' => '5',
385
-        'slideshow' => '0',
386
-        'animation_loop' => 0,
387
-        'direction_nav' => 0,
388
-        'slideshow_speed' => 5000,
389
-        'animation_speed' => 600,
390
-        'animation' => 'slide',
391
-        'order_by' => 'latest',
392
-        'show_title' => '',
393
-        'show_featured_only' => '',
394
-        'title' => '',
395
-    );
396
-
397
-    $params = shortcode_atts($defaults, $atts);
398
-
399
-
400
-    /*
380
+	ob_start();
381
+	$defaults = array(
382
+		'post_type' => 'gd_place',
383
+		'category' => '0',
384
+		'post_number' => '5',
385
+		'slideshow' => '0',
386
+		'animation_loop' => 0,
387
+		'direction_nav' => 0,
388
+		'slideshow_speed' => 5000,
389
+		'animation_speed' => 600,
390
+		'animation' => 'slide',
391
+		'order_by' => 'latest',
392
+		'show_title' => '',
393
+		'show_featured_only' => '',
394
+		'title' => '',
395
+	);
396
+
397
+	$params = shortcode_atts($defaults, $atts);
398
+
399
+
400
+	/*
401 401
      *
402 402
      * Now we begin the validation of the attributes.
403 403
      */
404
-    // Check we have a valid post_type
405
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
406
-        $params['post_type'] = 'gd_place';
407
-    }
408
-
409
-    // Check we have a valid sort_order
410
-    $params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
411
-
412
-    // Match the chosen animation to our options
413
-    $animation_list = array('slide', 'fade');
414
-    if (!(in_array($params['animation'], $animation_list))) {
415
-        $params['animation'] = 'slide';
416
-    }
417
-
418
-    // Post_number needs to be a positive integer
419
-    $params['post_number'] = absint($params['post_number']);
420
-    if (0 == $params['post_number']) {
421
-        $params['post_number'] = 1;
422
-    }
423
-
424
-    // Manage the entered categories
425
-    if (0 != $params['category'] || '' != $params['category']) {
426
-        $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
427
-    }
428
-    // Convert show_title to a bool
429
-    $params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
430
-
431
-    // Convert show_featured_only to a bool
432
-    $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
433
-
434
-    /*
404
+	// Check we have a valid post_type
405
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
406
+		$params['post_type'] = 'gd_place';
407
+	}
408
+
409
+	// Check we have a valid sort_order
410
+	$params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
411
+
412
+	// Match the chosen animation to our options
413
+	$animation_list = array('slide', 'fade');
414
+	if (!(in_array($params['animation'], $animation_list))) {
415
+		$params['animation'] = 'slide';
416
+	}
417
+
418
+	// Post_number needs to be a positive integer
419
+	$params['post_number'] = absint($params['post_number']);
420
+	if (0 == $params['post_number']) {
421
+		$params['post_number'] = 1;
422
+	}
423
+
424
+	// Manage the entered categories
425
+	if (0 != $params['category'] || '' != $params['category']) {
426
+		$params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
427
+	}
428
+	// Convert show_title to a bool
429
+	$params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
430
+
431
+	// Convert show_featured_only to a bool
432
+	$params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
433
+
434
+	/*
435 435
      * Hopefully all attributes are now valid, and safe to pass forward
436 436
      */
437 437
 
438
-    // redeclare vars after validation
439
-
440
-    if (isset($params['direction_nav'])) {
441
-        $params['directionNav'] = $params['direction_nav'];
442
-    }
443
-    if (isset($params['animation_loop'])) {
444
-        $params['animationLoop'] = $params['animation_loop'];
445
-    }
446
-    if (isset($params['slideshow_speed'])) {
447
-        $params['slideshowSpeed'] = $params['slideshow_speed'];
448
-    }
449
-    if (isset($params['animation_speed'])) {
450
-        $params['animationSpeed'] = $params['animation_speed'];
451
-    }
452
-    if (isset($params['order_by'])) {
453
-        $params['list_sort'] = $params['order_by'];
454
-    }
455
-
456
-    $query_args = array(
457
-        'post_number' => $params['post_number'],
458
-        'is_geodir_loop' => true,
459
-        'post_type' => $params['post_type'],
460
-        'order_by' => $params['order_by']
461
-    );
462
-
463
-    if (1 == $params['show_featured_only']) {
464
-        $query_args['show_featured_only'] = 1;
465
-    }
466
-
467
-    if (0 != $params['category'] && '' != $params['category']) {
468
-        $category_taxonomy = geodir_get_taxonomies($params['post_type']);
469
-        $tax_query = array(
470
-            'taxonomy' => $category_taxonomy[0],
471
-            'field' => 'id',
472
-            'terms' => $params['category'],
473
-        );
474
-
475
-        $query_args['tax_query'] = array($tax_query);
476
-    }
477
-
478
-    $defaults = array(
479
-        'before_widget' => '',
480
-        'after_widget' => '',
481
-        'before_title' => '',
482
-        'after_title' => '',
483
-    );
484
-
485
-    $query_args = array_merge($query_args, $params);
486
-
487
-    geodir_listing_slider_widget_output($defaults, $query_args);
488
-
489
-    $output = ob_get_contents();
490
-
491
-    ob_end_clean();
492
-
493
-    return $output;
438
+	// redeclare vars after validation
439
+
440
+	if (isset($params['direction_nav'])) {
441
+		$params['directionNav'] = $params['direction_nav'];
442
+	}
443
+	if (isset($params['animation_loop'])) {
444
+		$params['animationLoop'] = $params['animation_loop'];
445
+	}
446
+	if (isset($params['slideshow_speed'])) {
447
+		$params['slideshowSpeed'] = $params['slideshow_speed'];
448
+	}
449
+	if (isset($params['animation_speed'])) {
450
+		$params['animationSpeed'] = $params['animation_speed'];
451
+	}
452
+	if (isset($params['order_by'])) {
453
+		$params['list_sort'] = $params['order_by'];
454
+	}
455
+
456
+	$query_args = array(
457
+		'post_number' => $params['post_number'],
458
+		'is_geodir_loop' => true,
459
+		'post_type' => $params['post_type'],
460
+		'order_by' => $params['order_by']
461
+	);
462
+
463
+	if (1 == $params['show_featured_only']) {
464
+		$query_args['show_featured_only'] = 1;
465
+	}
466
+
467
+	if (0 != $params['category'] && '' != $params['category']) {
468
+		$category_taxonomy = geodir_get_taxonomies($params['post_type']);
469
+		$tax_query = array(
470
+			'taxonomy' => $category_taxonomy[0],
471
+			'field' => 'id',
472
+			'terms' => $params['category'],
473
+		);
474
+
475
+		$query_args['tax_query'] = array($tax_query);
476
+	}
477
+
478
+	$defaults = array(
479
+		'before_widget' => '',
480
+		'after_widget' => '',
481
+		'before_title' => '',
482
+		'after_title' => '',
483
+	);
484
+
485
+	$query_args = array_merge($query_args, $params);
486
+
487
+	geodir_listing_slider_widget_output($defaults, $query_args);
488
+
489
+	$output = ob_get_contents();
490
+
491
+	ob_end_clean();
492
+
493
+	return $output;
494 494
 }
495 495
 
496 496
 add_shortcode('gd_login_box', 'geodir_sc_login_box');
@@ -514,22 +514,22 @@  discard block
 block discarded – undo
514 514
  */
515 515
 function geodir_sc_login_box($atts)
516 516
 {
517
-    ob_start();
517
+	ob_start();
518 518
 
519
-    $defaults = array(
520
-        'before_widget' => '',
521
-        'after_widget' => '',
522
-        'before_title' => '',
523
-        'after_title' => '',
524
-    );
519
+	$defaults = array(
520
+		'before_widget' => '',
521
+		'after_widget' => '',
522
+		'before_title' => '',
523
+		'after_title' => '',
524
+	);
525 525
 
526
-    geodir_loginwidget_output($defaults, $defaults);
526
+	geodir_loginwidget_output($defaults, $defaults);
527 527
 
528
-    $output = ob_get_contents();
528
+	$output = ob_get_contents();
529 529
 
530
-    ob_end_clean();
530
+	ob_end_clean();
531 531
 
532
-    return $output;
532
+	return $output;
533 533
 }
534 534
 
535 535
 add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category');
@@ -558,28 +558,28 @@  discard block
 block discarded – undo
558 558
  */
559 559
 function geodir_sc_popular_post_category($atts)
560 560
 {
561
-    ob_start();
562
-    global $geodir_post_category_str;
563
-    $defaults = array(
564
-        'category_limit' => 15,
565
-        'before_widget' => '',
566
-        'after_widget' => '',
567
-        'before_title' => '',
568
-        'after_title' => '',
569
-        'title' => '',
561
+	ob_start();
562
+	global $geodir_post_category_str;
563
+	$defaults = array(
564
+		'category_limit' => 15,
565
+		'before_widget' => '',
566
+		'after_widget' => '',
567
+		'before_title' => '',
568
+		'after_title' => '',
569
+		'title' => '',
570 570
 		'default_post_type' => '',
571
-    );
571
+	);
572 572
 
573
-    $params = shortcode_atts($defaults, $atts, 'popular_post_category');
574
-    $params['category_limit'] = absint($params['category_limit']);
573
+	$params = shortcode_atts($defaults, $atts, 'popular_post_category');
574
+	$params['category_limit'] = absint($params['category_limit']);
575 575
 	$params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : '';
576
-    geodir_popular_post_category_output($params, $params);
576
+	geodir_popular_post_category_output($params, $params);
577 577
 
578
-    $output = ob_get_contents();
578
+	$output = ob_get_contents();
579 579
 
580
-    ob_end_clean();
580
+	ob_end_clean();
581 581
 
582
-    return $output;
582
+	return $output;
583 583
 }
584 584
 
585 585
 add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view');
@@ -619,97 +619,97 @@  discard block
 block discarded – undo
619 619
  */
620 620
 function geodir_sc_popular_post_view($atts)
621 621
 {
622
-    ob_start();
623
-    $defaults = array(
624
-        'post_type' => 'gd_place',
625
-        'category' => '0',
626
-        'post_number' => '5',
627
-        'layout' => 'gridview_onehalf',
628
-        'add_location_filter' => '0',
629
-        'list_sort' => 'latest',
630
-        'use_viewing_post_type' => '1',
631
-        'character_count' => '20',
632
-        'listing_width' => '',
633
-        'show_featured_only' => '0',
634
-        'show_special_only' => '0',
635
-        'with_pics_only' => '0',
636
-        'with_videos_only' => '0',
637
-        'before_widget' => '',
638
-        'after_widget' => '',
639
-        'before_title' => '<h3 class="widget-title">',
640
-        'after_title' => '</h3>',
641
-        'title' => '',
642
-        'category_title' => '',
643
-    );
644
-
645
-    $params = shortcode_atts($defaults, $atts);
646
-
647
-    /**
648
-     * Validate our incoming params
649
-     */
622
+	ob_start();
623
+	$defaults = array(
624
+		'post_type' => 'gd_place',
625
+		'category' => '0',
626
+		'post_number' => '5',
627
+		'layout' => 'gridview_onehalf',
628
+		'add_location_filter' => '0',
629
+		'list_sort' => 'latest',
630
+		'use_viewing_post_type' => '1',
631
+		'character_count' => '20',
632
+		'listing_width' => '',
633
+		'show_featured_only' => '0',
634
+		'show_special_only' => '0',
635
+		'with_pics_only' => '0',
636
+		'with_videos_only' => '0',
637
+		'before_widget' => '',
638
+		'after_widget' => '',
639
+		'before_title' => '<h3 class="widget-title">',
640
+		'after_title' => '</h3>',
641
+		'title' => '',
642
+		'category_title' => '',
643
+	);
650 644
 
651
-    // Validate the selected post type, default to gd_place on fail
652
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
653
-        $params['post_type'] = 'gd_place';
654
-    }
655
-
656
-    // Validate the selected category/ies - Grab the current list based on post_type
657
-    $category_taxonomy = geodir_get_taxonomies($params['post_type']);
658
-    $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
659
-
660
-    // Make sure we have an array
661
-    if (!(is_array($params['category']))) {
662
-        $params['category'] = explode(',', $params['category']);
663
-    }
664
-
665
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
666
-    // Otherwise it becomes empty and later on that will mean "All"
667
-    $params['category'] = array_intersect($params['category'], $categories);
668
-
669
-    // Post_number needs to be a positive integer
670
-    $params['post_number'] = absint($params['post_number']);
671
-    if (0 == $params['post_number']) {
672
-        $params['post_number'] = 1;
673
-    }
674
-
675
-    // Validate our layout choice
676
-    // Outside of the norm, I added some more simple terms to match the existing
677
-    // So now I just run the switch to set it properly.
678
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
679
-
680
-    // Validate our sorting choice
681
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
682
-
683
-    // Validate character_count
684
-    $params['character_count'] = absint($params['character_count']);
685
-    if (20 > $params['character_count']) {
686
-        $params['character_count'] = 20;
687
-    }
688
-
689
-    // Validate Listing width, used in the template widget-listing-listview.php
690
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
691
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
692
-
693
-    // Validate the checkboxes used on the widget
694
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
695
-    $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
696
-    $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
697
-    $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
698
-    $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
699
-    $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
700
-
701
-    /**
702
-     * End of validation
703
-     */
645
+	$params = shortcode_atts($defaults, $atts);
646
+
647
+	/**
648
+	 * Validate our incoming params
649
+	 */
650
+
651
+	// Validate the selected post type, default to gd_place on fail
652
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
653
+		$params['post_type'] = 'gd_place';
654
+	}
655
+
656
+	// Validate the selected category/ies - Grab the current list based on post_type
657
+	$category_taxonomy = geodir_get_taxonomies($params['post_type']);
658
+	$categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
659
+
660
+	// Make sure we have an array
661
+	if (!(is_array($params['category']))) {
662
+		$params['category'] = explode(',', $params['category']);
663
+	}
664
+
665
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
666
+	// Otherwise it becomes empty and later on that will mean "All"
667
+	$params['category'] = array_intersect($params['category'], $categories);
668
+
669
+	// Post_number needs to be a positive integer
670
+	$params['post_number'] = absint($params['post_number']);
671
+	if (0 == $params['post_number']) {
672
+		$params['post_number'] = 1;
673
+	}
704 674
 
705
-    geodir_popular_postview_output($params, $params);
675
+	// Validate our layout choice
676
+	// Outside of the norm, I added some more simple terms to match the existing
677
+	// So now I just run the switch to set it properly.
678
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
706 679
 
680
+	// Validate our sorting choice
681
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
707 682
 
708
-    $output = ob_get_contents();
683
+	// Validate character_count
684
+	$params['character_count'] = absint($params['character_count']);
685
+	if (20 > $params['character_count']) {
686
+		$params['character_count'] = 20;
687
+	}
688
+
689
+	// Validate Listing width, used in the template widget-listing-listview.php
690
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
691
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
692
+
693
+	// Validate the checkboxes used on the widget
694
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
695
+	$params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
696
+	$params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
697
+	$params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
698
+	$params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
699
+	$params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
700
+
701
+	/**
702
+	 * End of validation
703
+	 */
709 704
 
710
-    ob_end_clean();
705
+	geodir_popular_postview_output($params, $params);
711 706
 
712
-    return $output;
707
+
708
+	$output = ob_get_contents();
709
+
710
+	ob_end_clean();
711
+
712
+	return $output;
713 713
 }
714 714
 
715 715
 add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews');
@@ -731,37 +731,37 @@  discard block
 block discarded – undo
731 731
  * @return string Recent reviews HTML.
732 732
  */
733 733
 function geodir_sc_recent_reviews($atts) {
734
-    ob_start();
735
-    $defaults = array(
734
+	ob_start();
735
+	$defaults = array(
736 736
 		'title' => '',
737 737
 		'count' => 5,
738
-    );
738
+	);
739 739
 
740
-    $params = shortcode_atts($defaults, $atts);
740
+	$params = shortcode_atts($defaults, $atts);
741 741
 
742
-    $count = absint($params['count']);
743
-    if (0 == $count) {
744
-        $count = 1;
745
-    }
742
+	$count = absint($params['count']);
743
+	if (0 == $count) {
744
+		$count = 1;
745
+	}
746 746
 	
747 747
 	$title = !empty($params['title']) ? __($params['title'], 'geodirectory') : '';
748 748
 
749
-    $comments_li = geodir_get_recent_reviews(30, $count, 100, false);
749
+	$comments_li = geodir_get_recent_reviews(30, $count, 100, false);
750 750
 
751
-    if ($comments_li) {
752
-        if ($title != '') { ?>
751
+	if ($comments_li) {
752
+		if ($title != '') { ?>
753 753
 		<h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3>
754 754
 		<?php } ?>
755 755
         <div class="geodir_sc_recent_reviews_section">
756 756
             <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul>
757 757
         </div>
758 758
     <?php
759
-    }
760
-    $output = ob_get_contents();
759
+	}
760
+	$output = ob_get_contents();
761 761
 
762
-    ob_end_clean();
762
+	ob_end_clean();
763 763
 
764
-    return $output;
764
+	return $output;
765 765
 }
766 766
 
767 767
 add_shortcode('gd_related_listings', 'geodir_sc_related_listings');
@@ -791,64 +791,64 @@  discard block
 block discarded – undo
791 791
  */
792 792
 function geodir_sc_related_listings($atts)
793 793
 {
794
-    ob_start();
795
-    $defaults = array(
796
-        'post_number' => 5,
797
-        'relate_to' => 'category',
798
-        'layout' => 'gridview_onehalf',
799
-        'add_location_filter' => 0,
800
-        'listing_width' => '',
801
-        'list_sort' => 'latest',
802
-        'character_count' => 20,
803
-        'is_widget' => 1,
804
-        'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
805
-    );
806
-    // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
807
-
808
-    $params = shortcode_atts($defaults, $atts);
809
-
810
-    /**
811
-     * Begin validating parameters
812
-     */
794
+	ob_start();
795
+	$defaults = array(
796
+		'post_number' => 5,
797
+		'relate_to' => 'category',
798
+		'layout' => 'gridview_onehalf',
799
+		'add_location_filter' => 0,
800
+		'listing_width' => '',
801
+		'list_sort' => 'latest',
802
+		'character_count' => 20,
803
+		'is_widget' => 1,
804
+		'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
805
+	);
806
+	// The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
807
+
808
+	$params = shortcode_atts($defaults, $atts);
809
+
810
+	/**
811
+	 * Begin validating parameters
812
+	 */
813 813
 
814
-    // Validate that post_number is a number and is 1 or higher
815
-    $params['post_number'] = absint($params['post_number']);
816
-    if (0 === $params['post_number']) {
817
-        $params['post_number'] = 1;
818
-    }
814
+	// Validate that post_number is a number and is 1 or higher
815
+	$params['post_number'] = absint($params['post_number']);
816
+	if (0 === $params['post_number']) {
817
+		$params['post_number'] = 1;
818
+	}
819 819
 
820
-    // Validate relate_to - only category or tags
821
-    $params['relate_to'] = geodir_strtolower($params['relate_to']);
822
-    if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
823
-        $params['relate_to'] = 'category';
824
-    }
820
+	// Validate relate_to - only category or tags
821
+	$params['relate_to'] = geodir_strtolower($params['relate_to']);
822
+	if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
823
+		$params['relate_to'] = 'category';
824
+	}
825 825
 
826
-    // Validate layout selection
827
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
826
+	// Validate layout selection
827
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
828 828
 
829
-    // Validate sorting option
830
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
829
+	// Validate sorting option
830
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
831 831
 
832
-    // Validate add_location_filter
833
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
832
+	// Validate add_location_filter
833
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
834 834
 
835
-    // Validate listing_width
836
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
835
+	// Validate listing_width
836
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
837 837
 
838
-    // Validate character_count
839
-    $params['character_count'] = absint($params['character_count']);
840
-    if (20 > $params['character_count']) {
841
-        $params['character_count'] = 20;
842
-    }
838
+	// Validate character_count
839
+	$params['character_count'] = absint($params['character_count']);
840
+	if (20 > $params['character_count']) {
841
+		$params['character_count'] = 20;
842
+	}
843 843
 
844
-    if ($related_display = geodir_related_posts_display($params)) {
845
-        echo $related_display;
846
-    }
847
-    $output = ob_get_contents();
844
+	if ($related_display = geodir_related_posts_display($params)) {
845
+		echo $related_display;
846
+	}
847
+	$output = ob_get_contents();
848 848
 
849
-    ob_end_clean();
849
+	ob_end_clean();
850 850
 
851
-    return $output;
851
+	return $output;
852 852
 }
853 853
 
854 854
 /**
@@ -872,12 +872,12 @@  discard block
 block discarded – undo
872 872
  * @return string Advanced search widget HTML.
873 873
  */
874 874
 function geodir_sc_advanced_search($atts) {
875
-    $defaults = array(
875
+	$defaults = array(
876 876
 		'title' => '',
877 877
 		'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advance_search_widget">',
878
-        'after_widget' => '</section>',
879
-        'before_title' => '<h3 class="widget-title">',
880
-        'after_title' => '</h3>',
878
+		'after_widget' => '</section>',
879
+		'before_title' => '<h3 class="widget-title">',
880
+		'after_title' => '</h3>',
881 881
 		'show_adv_search' => 'default'
882 882
 	);
883 883
 	
@@ -901,9 +901,9 @@  discard block
 block discarded – undo
901 901
 	the_widget('geodir_advance_search_widget', $params, $params );
902 902
 	
903 903
 	$output = ob_get_contents();
904
-    ob_end_clean();
904
+	ob_end_clean();
905 905
 
906
-    return $output;
906
+	return $output;
907 907
 }
908 908
 add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search');
909 909
 
@@ -949,48 +949,48 @@  discard block
 block discarded – undo
949 949
 		'add_location_filter' => '1',
950 950
 		'tab_layout' => 'bestof-tabs-on-top',
951 951
 		'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">',
952
-        'after_widget' => '</section>',
953
-        'before_title' => '<h3 class="widget-title">',
954
-        'after_title' => '</h3>',
952
+		'after_widget' => '</section>',
953
+		'before_title' => '<h3 class="widget-title">',
954
+		'after_title' => '</h3>',
955 955
 	);
956 956
 	$params = shortcode_atts($defaults, $atts);
957 957
 
958
-    /**
959
-     * Validate our incoming params
960
-     */
958
+	/**
959
+	 * Validate our incoming params
960
+	 */
961 961
 
962
-    // Validate the selected post type, default to gd_place on fail
963
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
964
-        $params['post_type'] = 'gd_place';
965
-    }
962
+	// Validate the selected post type, default to gd_place on fail
963
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
964
+		$params['post_type'] = 'gd_place';
965
+	}
966 966
 	
967 967
 	// Post limit needs to be a positive integer
968
-    $params['post_limit'] = absint($params['post_limit']);
969
-    if (0 == $params['post_limit']) {
970
-        $params['post_limit'] = 5;
971
-    }
968
+	$params['post_limit'] = absint($params['post_limit']);
969
+	if (0 == $params['post_limit']) {
970
+		$params['post_limit'] = 5;
971
+	}
972 972
 	
973 973
 	// Category limit needs to be a positive integer
974
-    $params['categ_limit'] = absint($params['categ_limit']);
975
-    if (0 == $params['categ_limit']) {
976
-        $params['categ_limit'] = 3;
977
-    }
974
+	$params['categ_limit'] = absint($params['categ_limit']);
975
+	if (0 == $params['categ_limit']) {
976
+		$params['categ_limit'] = 3;
977
+	}
978 978
 	
979 979
 	// Tab layout validation
980
-    $params['tab_layout'] = $params['tab_layout'];
981
-    if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
982
-        $params['tab_layout'] = 'bestof-tabs-on-top';
983
-    }
980
+	$params['tab_layout'] = $params['tab_layout'];
981
+	if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
982
+		$params['tab_layout'] = 'bestof-tabs-on-top';
983
+	}
984 984
 	
985 985
 	// Validate character_count
986
-    $params['character_count'] = $params['character_count'];
986
+	$params['character_count'] = $params['character_count'];
987 987
 
988 988
 	ob_start();
989 989
 	the_widget('geodir_bestof_widget', $params, $params);
990
-    $output = ob_get_contents();
991
-    ob_end_clean();
990
+	$output = ob_get_contents();
991
+	ob_end_clean();
992 992
 
993
-    return $output;
993
+	return $output;
994 994
 }
995 995
 add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget');
996 996
 
@@ -1038,127 +1038,127 @@  discard block
 block discarded – undo
1038 1038
  * @return string HTML content to display geodirectory listings.
1039 1039
  */
1040 1040
 function geodir_sc_gd_listings($atts, $content = '') {
1041
-    global $post;
1042
-    $defaults = array(
1043
-        'title'                 => '',
1044
-        'post_type'             => 'gd_place',
1045
-        'category'              => 0,
1046
-        'list_sort'             => 'latest',
1047
-        'event_type'            => '',
1048
-        'post_number'           => 10,
1049
-        'post_author'           => '',
1050
-        'layout'                => 'gridview_onehalf',
1051
-        'listing_width'         => '',
1052
-        'character_count'       => 20,
1053
-        'add_location_filter'   => 1,
1054
-        'show_featured_only'    => '',
1055
-        'show_special_only'     => '',
1056
-        'with_pics_only'        => '',
1057
-        'with_videos_only'      => '',
1058
-        'with_pagination'       => '1',
1059
-        'top_pagination'        => '0',
1060
-        'bottom_pagination'     => '1',
1061
-        'without_no_results'    => 0,
1062
-        'tags'                  => ''
1063
-    );
1064
-    $params = shortcode_atts($defaults, $atts);
1065
-
1066
-    $params['title']        = wp_strip_all_tags($params['title']);
1067
-    $params['post_type']    = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1068
-
1069
-    // Validate the selected category/ies - Grab the current list based on post_type
1070
-    $category_taxonomy      = geodir_get_taxonomies($params['post_type']);
1071
-    $categories             = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1072
-
1073
-    // Make sure we have an array
1074
-    if (!(is_array($params['category']))) {
1075
-        $params['category'] = explode(',', $params['category']);
1076
-    }
1077
-
1078
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
1079
-    // Otherwise it becomes empty and later on that will mean "All"
1080
-    $params['category']     = array_intersect($params['category'], $categories);
1081
-
1082
-    // Post_number needs to be a positive integer
1083
-    $params['post_number']  = absint($params['post_number']);
1084
-    $params['post_number']  = $params['post_number'] > 0 ? $params['post_number'] : 10;
1041
+	global $post;
1042
+	$defaults = array(
1043
+		'title'                 => '',
1044
+		'post_type'             => 'gd_place',
1045
+		'category'              => 0,
1046
+		'list_sort'             => 'latest',
1047
+		'event_type'            => '',
1048
+		'post_number'           => 10,
1049
+		'post_author'           => '',
1050
+		'layout'                => 'gridview_onehalf',
1051
+		'listing_width'         => '',
1052
+		'character_count'       => 20,
1053
+		'add_location_filter'   => 1,
1054
+		'show_featured_only'    => '',
1055
+		'show_special_only'     => '',
1056
+		'with_pics_only'        => '',
1057
+		'with_videos_only'      => '',
1058
+		'with_pagination'       => '1',
1059
+		'top_pagination'        => '0',
1060
+		'bottom_pagination'     => '1',
1061
+		'without_no_results'    => 0,
1062
+		'tags'                  => ''
1063
+	);
1064
+	$params = shortcode_atts($defaults, $atts);
1065
+
1066
+	$params['title']        = wp_strip_all_tags($params['title']);
1067
+	$params['post_type']    = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1068
+
1069
+	// Validate the selected category/ies - Grab the current list based on post_type
1070
+	$category_taxonomy      = geodir_get_taxonomies($params['post_type']);
1071
+	$categories             = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1072
+
1073
+	// Make sure we have an array
1074
+	if (!(is_array($params['category']))) {
1075
+		$params['category'] = explode(',', $params['category']);
1076
+	}
1077
+
1078
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
1079
+	// Otherwise it becomes empty and later on that will mean "All"
1080
+	$params['category']     = array_intersect($params['category'], $categories);
1081
+
1082
+	// Post_number needs to be a positive integer
1083
+	$params['post_number']  = absint($params['post_number']);
1084
+	$params['post_number']  = $params['post_number'] > 0 ? $params['post_number'] : 10;
1085 1085
     
1086
-    // Post_number needs to be a positive integer
1087
-    if (!empty($atts['post_author'])) {
1088
-        if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') {
1089
-            $params['post_author'] = $post->post_author;
1090
-        } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) {
1091
-            $params['post_author'] = absint($atts['post_author']);
1092
-        } else {
1093
-            unset($params['post_author']);
1094
-        }
1095
-    } else {
1096
-        unset($params['post_author']);
1097
-    }
1098
-
1099
-    // Validate character_count
1100
-    //todo: is this necessary?
1101
-    $params['character_count']  = $params['character_count'];
1102
-
1103
-    // Validate our layout choice
1104
-    // Outside of the norm, I added some more simple terms to match the existing
1105
-    // So now I just run the switch to set it properly.
1106
-    $params['layout']           = gdsc_validate_layout_choice($params['layout']);
1107
-
1108
-    // Validate our sorting choice
1109
-    $params['list_sort']        = gdsc_validate_sort_choice($params['list_sort']);
1110
-
1111
-    // Validate Listing width, used in the template widget-listing-listview.php
1112
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1113
-    $params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1114
-
1115
-    // Validate the checkboxes used on the widget
1116
-    $params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
1117
-    $params['show_featured_only']   = gdsc_to_bool_val($params['show_featured_only']);
1118
-    $params['show_special_only']    = gdsc_to_bool_val($params['show_special_only']);
1119
-    $params['with_pics_only']       = gdsc_to_bool_val($params['with_pics_only']);
1120
-    $params['with_videos_only']     = gdsc_to_bool_val($params['with_videos_only']);
1121
-    $params['with_pagination']      = gdsc_to_bool_val($params['with_pagination']);
1122
-    $params['top_pagination']       = gdsc_to_bool_val($params['top_pagination']);
1123
-    $params['bottom_pagination']    = gdsc_to_bool_val($params['bottom_pagination']);
1124
-
1125
-    // Clean tags
1126
-    if (!empty($params['tags'])) {
1127
-        if (!is_array($params['tags'])) {
1128
-            $comma = _x(',', 'tag delimiter');
1129
-            if ( ',' !== $comma ) {
1130
-                $params['tags'] = str_replace($comma, ',', $params['tags']);
1131
-            }
1132
-            $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,"));
1133
-            $params['tags'] = array_map('trim', $params['tags']);
1134
-        }
1135
-    } else {
1136
-        $params['tags'] = array();
1137
-    }
1138
-
1139
-    /**
1140
-     * End of validation
1141
-     */
1142
-    if (isset($atts['geodir_ajax'])) {
1143
-        $params['geodir_ajax'] = $atts['geodir_ajax'];
1144
-        unset($atts['geodir_ajax']);
1145
-    }
1146
-    if (isset($atts['pageno'])) {
1147
-        $params['pageno'] = $atts['pageno'];
1148
-        unset($atts['pageno']);
1149
-    }
1150
-
1151
-    if ( !empty($atts['shortcode_content']) ) {
1152
-        $content = $atts['shortcode_content'];
1153
-    }
1154
-    $params['shortcode_content'] = trim($content);
1155
-    $atts['shortcode_content'] = trim($content);
1086
+	// Post_number needs to be a positive integer
1087
+	if (!empty($atts['post_author'])) {
1088
+		if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') {
1089
+			$params['post_author'] = $post->post_author;
1090
+		} else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) {
1091
+			$params['post_author'] = absint($atts['post_author']);
1092
+		} else {
1093
+			unset($params['post_author']);
1094
+		}
1095
+	} else {
1096
+		unset($params['post_author']);
1097
+	}
1098
+
1099
+	// Validate character_count
1100
+	//todo: is this necessary?
1101
+	$params['character_count']  = $params['character_count'];
1102
+
1103
+	// Validate our layout choice
1104
+	// Outside of the norm, I added some more simple terms to match the existing
1105
+	// So now I just run the switch to set it properly.
1106
+	$params['layout']           = gdsc_validate_layout_choice($params['layout']);
1107
+
1108
+	// Validate our sorting choice
1109
+	$params['list_sort']        = gdsc_validate_sort_choice($params['list_sort']);
1110
+
1111
+	// Validate Listing width, used in the template widget-listing-listview.php
1112
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
1113
+	$params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1114
+
1115
+	// Validate the checkboxes used on the widget
1116
+	$params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
1117
+	$params['show_featured_only']   = gdsc_to_bool_val($params['show_featured_only']);
1118
+	$params['show_special_only']    = gdsc_to_bool_val($params['show_special_only']);
1119
+	$params['with_pics_only']       = gdsc_to_bool_val($params['with_pics_only']);
1120
+	$params['with_videos_only']     = gdsc_to_bool_val($params['with_videos_only']);
1121
+	$params['with_pagination']      = gdsc_to_bool_val($params['with_pagination']);
1122
+	$params['top_pagination']       = gdsc_to_bool_val($params['top_pagination']);
1123
+	$params['bottom_pagination']    = gdsc_to_bool_val($params['bottom_pagination']);
1124
+
1125
+	// Clean tags
1126
+	if (!empty($params['tags'])) {
1127
+		if (!is_array($params['tags'])) {
1128
+			$comma = _x(',', 'tag delimiter');
1129
+			if ( ',' !== $comma ) {
1130
+				$params['tags'] = str_replace($comma, ',', $params['tags']);
1131
+			}
1132
+			$params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,"));
1133
+			$params['tags'] = array_map('trim', $params['tags']);
1134
+		}
1135
+	} else {
1136
+		$params['tags'] = array();
1137
+	}
1138
+
1139
+	/**
1140
+	 * End of validation
1141
+	 */
1142
+	if (isset($atts['geodir_ajax'])) {
1143
+		$params['geodir_ajax'] = $atts['geodir_ajax'];
1144
+		unset($atts['geodir_ajax']);
1145
+	}
1146
+	if (isset($atts['pageno'])) {
1147
+		$params['pageno'] = $atts['pageno'];
1148
+		unset($atts['pageno']);
1149
+	}
1150
+
1151
+	if ( !empty($atts['shortcode_content']) ) {
1152
+		$content = $atts['shortcode_content'];
1153
+	}
1154
+	$params['shortcode_content'] = trim($content);
1155
+	$atts['shortcode_content'] = trim($content);
1156 1156
     
1157
-    $params['shortcode_atts']       = $atts;
1157
+	$params['shortcode_atts']       = $atts;
1158 1158
 
1159
-    $output = geodir_sc_gd_listings_output($params);
1159
+	$output = geodir_sc_gd_listings_output($params);
1160 1160
 
1161
-    return $output;
1161
+	return $output;
1162 1162
 }
1163 1163
 add_shortcode('gd_listings', 'geodir_sc_gd_listings');
1164 1164
 
@@ -1206,23 +1206,23 @@  discard block
 block discarded – undo
1206 1206
 		'max_count' => 'all',
1207 1207
 		'max_level' => '1',
1208 1208
 		'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">',
1209
-        'after_widget' => '</section>',
1210
-        'before_title' => '<h3 class="widget-title">',
1211
-        'after_title' => '</h3>',
1209
+		'after_widget' => '</section>',
1210
+		'before_title' => '<h3 class="widget-title">',
1211
+		'after_title' => '</h3>',
1212 1212
 	);
1213 1213
 	$params = shortcode_atts($defaults, $atts);
1214 1214
 
1215
-    /**
1216
-     * Validate our incoming params
1217
-     */
1215
+	/**
1216
+	 * Validate our incoming params
1217
+	 */
1218 1218
 	// Make sure we have an array
1219
-    $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1219
+	$params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1220 1220
 	 
1221 1221
 	// Validate the checkboxes used on the widget
1222
-    $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1223
-    $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1224
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1225
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1222
+	$params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1223
+	$params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1224
+	$params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1225
+	$params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1226 1226
 	
1227 1227
 	if ($params['max_count'] != 'all') {
1228 1228
 		$params['max_count'] = absint($params['max_count']);
@@ -1236,10 +1236,10 @@  discard block
 block discarded – undo
1236 1236
 
1237 1237
 	ob_start();
1238 1238
 	the_widget('geodir_cpt_categories_widget', $params, $params);
1239
-    $output = ob_get_contents();
1240
-    ob_end_clean();
1239
+	$output = ob_get_contents();
1240
+	ob_end_clean();
1241 1241
 
1242
-    return $output;
1242
+	return $output;
1243 1243
 }
1244 1244
 add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget');
1245 1245
 ?>
1246 1246
\ No newline at end of file
Please login to merge, or discard this patch.