Completed
Pull Request — master (#210)
by Kiran
05:26
created
geodirectory_shortcodes.php 2 patches
Indentation   +656 added lines, -656 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,48 +32,48 @@  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
-        ###### 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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
+	}
709 660
 
710
-    geodir_popular_postview_output($params, $params);
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'));
711 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
+	}
712 679
 
713
-    $output = ob_get_contents();
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']);
714 684
 
715
-    ob_end_clean();
685
+	// Validate our sorting choice
686
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
716 687
 
717
-    return $output;
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
+	 */
709
+
710
+	geodir_popular_postview_output($params, $params);
711
+
712
+
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,105 +1041,105 @@  discard block
 block discarded – undo
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
-    );
1066
-    $params = shortcode_atts($defaults, $atts);
1067
-
1068
-    $params['title']        = wp_strip_all_tags($params['title']);
1069
-    $params['post_type']    = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1070
-
1071
-    // Validate the selected category/ies - Grab the current list based on post_type
1072
-    $category_taxonomy      = geodir_get_taxonomies($params['post_type']);
1073
-    $categories             = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1074
-
1075
-    // Make sure we have an array
1076
-    if (!(is_array($params['category']))) {
1077
-        $params['category'] = explode(',', $params['category']);
1078
-    }
1079
-
1080
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
1081
-    // Otherwise it becomes empty and later on that will mean "All"
1082
-    $params['category']     = array_intersect($params['category'], $categories);
1083
-
1084
-    // Post_number needs to be a positive integer
1085
-    $params['post_number']  = absint($params['post_number']);
1086
-    $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
+	);
1066
+	$params = shortcode_atts($defaults, $atts);
1067
+
1068
+	$params['title']        = wp_strip_all_tags($params['title']);
1069
+	$params['post_type']    = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1070
+
1071
+	// Validate the selected category/ies - Grab the current list based on post_type
1072
+	$category_taxonomy      = geodir_get_taxonomies($params['post_type']);
1073
+	$categories             = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1074
+
1075
+	// Make sure we have an array
1076
+	if (!(is_array($params['category']))) {
1077
+		$params['category'] = explode(',', $params['category']);
1078
+	}
1079
+
1080
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
1081
+	// Otherwise it becomes empty and later on that will mean "All"
1082
+	$params['category']     = array_intersect($params['category'], $categories);
1083
+
1084
+	// Post_number needs to be a positive integer
1085
+	$params['post_number']  = absint($params['post_number']);
1086
+	$params['post_number']  = $params['post_number'] > 0 ? $params['post_number'] : 10;
1087 1087
     
1088
-    // Post_number needs to be a positive integer
1089
-    if (!empty($atts['post_author'])) {
1090
-        if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') {
1091
-            $params['post_author'] = $post->post_author;
1092
-        } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) {
1093
-            $params['post_author'] = absint($atts['post_author']);
1094
-        } else {
1095
-            unset($params['post_author']);
1096
-        }
1097
-    } else {
1098
-        unset($params['post_author']);
1099
-    }
1100
-
1101
-    // Validate character_count
1102
-    //todo: is this necessary?
1103
-    $params['character_count']  = $params['character_count'];
1104
-
1105
-    // Validate our layout choice
1106
-    // Outside of the norm, I added some more simple terms to match the existing
1107
-    // So now I just run the switch to set it properly.
1108
-    $params['layout']           = gdsc_validate_layout_choice($params['layout']);
1109
-
1110
-    // Validate our sorting choice
1111
-    $params['list_sort']        = gdsc_validate_sort_choice($params['list_sort']);
1112
-
1113
-    // Validate Listing width, used in the template widget-listing-listview.php
1114
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1115
-    $params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1116
-
1117
-    // Validate the checkboxes used on the widget
1118
-    $params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
1119
-    $params['show_featured_only']   = gdsc_to_bool_val($params['show_featured_only']);
1120
-    $params['show_special_only']    = gdsc_to_bool_val($params['show_special_only']);
1121
-    $params['with_pics_only']       = gdsc_to_bool_val($params['with_pics_only']);
1122
-    $params['with_videos_only']     = gdsc_to_bool_val($params['with_videos_only']);
1123
-    $params['with_pagination']      = gdsc_to_bool_val($params['with_pagination']);
1124
-    $params['top_pagination']       = gdsc_to_bool_val($params['top_pagination']);
1125
-    $params['bottom_pagination']    = gdsc_to_bool_val($params['bottom_pagination']);
1126
-
1127
-    /**
1128
-     * End of validation
1129
-     */
1130
-    if (isset($atts['geodir_ajax'])) {
1131
-        $params['geodir_ajax'] = $atts['geodir_ajax'];
1132
-        unset($atts['geodir_ajax']);
1133
-    }
1134
-    if (isset($atts['pageno'])) {
1135
-        $params['pageno'] = $atts['pageno'];
1136
-        unset($atts['pageno']);
1137
-    }
1138
-    $params['shortcode_atts']       = $atts;
1139
-
1140
-    $output = geodir_sc_gd_listings_output($params);
1141
-
1142
-    return $output;
1088
+	// Post_number needs to be a positive integer
1089
+	if (!empty($atts['post_author'])) {
1090
+		if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') {
1091
+			$params['post_author'] = $post->post_author;
1092
+		} else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) {
1093
+			$params['post_author'] = absint($atts['post_author']);
1094
+		} else {
1095
+			unset($params['post_author']);
1096
+		}
1097
+	} else {
1098
+		unset($params['post_author']);
1099
+	}
1100
+
1101
+	// Validate character_count
1102
+	//todo: is this necessary?
1103
+	$params['character_count']  = $params['character_count'];
1104
+
1105
+	// Validate our layout choice
1106
+	// Outside of the norm, I added some more simple terms to match the existing
1107
+	// So now I just run the switch to set it properly.
1108
+	$params['layout']           = gdsc_validate_layout_choice($params['layout']);
1109
+
1110
+	// Validate our sorting choice
1111
+	$params['list_sort']        = gdsc_validate_sort_choice($params['list_sort']);
1112
+
1113
+	// Validate Listing width, used in the template widget-listing-listview.php
1114
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
1115
+	$params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1116
+
1117
+	// Validate the checkboxes used on the widget
1118
+	$params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
1119
+	$params['show_featured_only']   = gdsc_to_bool_val($params['show_featured_only']);
1120
+	$params['show_special_only']    = gdsc_to_bool_val($params['show_special_only']);
1121
+	$params['with_pics_only']       = gdsc_to_bool_val($params['with_pics_only']);
1122
+	$params['with_videos_only']     = gdsc_to_bool_val($params['with_videos_only']);
1123
+	$params['with_pagination']      = gdsc_to_bool_val($params['with_pagination']);
1124
+	$params['top_pagination']       = gdsc_to_bool_val($params['top_pagination']);
1125
+	$params['bottom_pagination']    = gdsc_to_bool_val($params['bottom_pagination']);
1126
+
1127
+	/**
1128
+	 * End of validation
1129
+	 */
1130
+	if (isset($atts['geodir_ajax'])) {
1131
+		$params['geodir_ajax'] = $atts['geodir_ajax'];
1132
+		unset($atts['geodir_ajax']);
1133
+	}
1134
+	if (isset($atts['pageno'])) {
1135
+		$params['pageno'] = $atts['pageno'];
1136
+		unset($atts['pageno']);
1137
+	}
1138
+	$params['shortcode_atts']       = $atts;
1139
+
1140
+	$output = geodir_sc_gd_listings_output($params);
1141
+
1142
+	return $output;
1143 1143
 }
1144 1144
 add_shortcode('gd_listings', 'geodir_sc_gd_listings');
1145 1145
 
@@ -1187,23 +1187,23 @@  discard block
 block discarded – undo
1187 1187
 		'max_count' => 'all',
1188 1188
 		'max_level' => '1',
1189 1189
 		'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">',
1190
-        'after_widget' => '</section>',
1191
-        'before_title' => '<h3 class="widget-title">',
1192
-        'after_title' => '</h3>',
1190
+		'after_widget' => '</section>',
1191
+		'before_title' => '<h3 class="widget-title">',
1192
+		'after_title' => '</h3>',
1193 1193
 	);
1194 1194
 	$params = shortcode_atts($defaults, $atts);
1195 1195
 
1196
-    /**
1197
-     * Validate our incoming params
1198
-     */
1196
+	/**
1197
+	 * Validate our incoming params
1198
+	 */
1199 1199
 	// Make sure we have an array
1200
-    $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1200
+	$params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1201 1201
 	 
1202 1202
 	// Validate the checkboxes used on the widget
1203
-    $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1204
-    $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1205
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1206
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1203
+	$params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1204
+	$params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1205
+	$params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1206
+	$params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1207 1207
 	
1208 1208
 	if ($params['max_count'] != 'all') {
1209 1209
 		$params['max_count'] = absint($params['max_count']);
@@ -1217,10 +1217,10 @@  discard block
 block discarded – undo
1217 1217
 
1218 1218
 	ob_start();
1219 1219
 	the_widget('geodir_cpt_categories_widget', $params, $params);
1220
-    $output = ob_get_contents();
1221
-    ob_end_clean();
1220
+	$output = ob_get_contents();
1221
+	ob_end_clean();
1222 1222
 
1223
-    return $output;
1223
+	return $output;
1224 1224
 }
1225 1225
 add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget');
1226 1226
 ?>
1227 1227
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 
1101 1101
     // Validate character_count
1102 1102
     //todo: is this necessary?
1103
-    $params['character_count']  = $params['character_count'];
1103
+    $params['character_count'] = $params['character_count'];
1104 1104
 
1105 1105
     // Validate our layout choice
1106 1106
     // Outside of the norm, I added some more simple terms to match the existing
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 
1113 1113
     // Validate Listing width, used in the template widget-listing-listview.php
1114 1114
     // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1115
-    $params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1115
+    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
1116 1116
 
1117 1117
     // Validate the checkboxes used on the widget
1118 1118
     $params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
         $params['pageno'] = $atts['pageno'];
1136 1136
         unset($atts['pageno']);
1137 1137
     }
1138
-    $params['shortcode_atts']       = $atts;
1138
+    $params['shortcode_atts'] = $atts;
1139 1139
 
1140 1140
     $output = geodir_sc_gd_listings_output($params);
1141 1141
 
@@ -1202,8 +1202,8 @@  discard block
 block discarded – undo
1202 1202
 	// Validate the checkboxes used on the widget
1203 1203
     $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1204 1204
     $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1205
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1206
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1205
+    $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']);
1206
+    $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']);
1207 1207
 	
1208 1208
 	if ($params['max_count'] != 'all') {
1209 1209
 		$params['max_count'] = absint($params['max_count']);
Please login to merge, or discard this patch.
geodirectory-functions/general_functions.php 2 patches
Indentation   +2912 added lines, -2912 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Plugin general functions
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Plugin general functions
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
 
9 9
 
10 10
 /**
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 function geodir_plugin_url()
29 29
 {
30 30
 
31
-    if (is_ssl()) :
32
-        return str_replace('http://', 'https://', WP_PLUGIN_URL) . "/" . plugin_basename(dirname(dirname(__FILE__)));
33
-    else :
34
-        return WP_PLUGIN_URL . "/" . plugin_basename(dirname(dirname(__FILE__)));
35
-    endif;
31
+	if (is_ssl()) :
32
+		return str_replace('http://', 'https://', WP_PLUGIN_URL) . "/" . plugin_basename(dirname(dirname(__FILE__)));
33
+	else :
34
+		return WP_PLUGIN_URL . "/" . plugin_basename(dirname(dirname(__FILE__)));
35
+	endif;
36 36
 }
37 37
 
38 38
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function geodir_plugin_path()
49 49
 {
50
-    return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__)));
50
+	return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__)));
51 51
 }
52 52
 
53 53
 /**
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
  */
62 62
 function geodir_is_plugin_active($plugin)
63 63
 {
64
-    $active_plugins = get_option('active_plugins');
65
-    foreach ($active_plugins as $key => $active_plugin) {
66
-        if (strstr($active_plugin, $plugin)) return true;
67
-    }
68
-    return false;
64
+	$active_plugins = get_option('active_plugins');
65
+	foreach ($active_plugins as $key => $active_plugin) {
66
+		if (strstr($active_plugin, $plugin)) return true;
67
+	}
68
+	return false;
69 69
 }
70 70
 
71 71
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
  */
82 82
 function geodir_get_formated_date($date)
83 83
 {
84
-    return mysql2date(get_option('date_format'), $date);
84
+	return mysql2date(get_option('date_format'), $date);
85 85
 }
86 86
 
87 87
 /**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
  */
97 97
 function geodir_get_formated_time($time)
98 98
 {
99
-    return mysql2date(get_option('time_format'), $time, $translate = true);
99
+	return mysql2date(get_option('time_format'), $time, $translate = true);
100 100
 }
101 101
 
102 102
 
@@ -114,26 +114,26 @@  discard block
 block discarded – undo
114 114
  */
115 115
 function geodir_getlink($url, $params = array(), $use_existing_arguments = false)
116 116
 {
117
-    if ($use_existing_arguments) $params = $params + $_GET;
118
-    if (!$params) return $url;
119
-    $link = $url;
120
-    if (strpos($link, '?') === false) $link .= '?'; //If there is no '?' add one at the end
121
-    elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) $link .= '&amp;'; //If there is no '&' at the END, add one.
122
-    elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) $link .= '&'; //If there is no '&' at the END, add one.
123
-
124
-    $params_arr = array();
125
-    foreach ($params as $key => $value) {
126
-        if (gettype($value) == 'array') { //Handle array data properly
127
-            foreach ($value as $val) {
128
-                $params_arr[] = $key . '[]=' . urlencode($val);
129
-            }
130
-        } else {
131
-            $params_arr[] = $key . '=' . urlencode($value);
132
-        }
133
-    }
134
-    $link .= implode('&', $params_arr);
117
+	if ($use_existing_arguments) $params = $params + $_GET;
118
+	if (!$params) return $url;
119
+	$link = $url;
120
+	if (strpos($link, '?') === false) $link .= '?'; //If there is no '?' add one at the end
121
+	elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) $link .= '&amp;'; //If there is no '&' at the END, add one.
122
+	elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) $link .= '&'; //If there is no '&' at the END, add one.
123
+
124
+	$params_arr = array();
125
+	foreach ($params as $key => $value) {
126
+		if (gettype($value) == 'array') { //Handle array data properly
127
+			foreach ($value as $val) {
128
+				$params_arr[] = $key . '[]=' . urlencode($val);
129
+			}
130
+		} else {
131
+			$params_arr[] = $key . '=' . urlencode($value);
132
+		}
133
+	}
134
+	$link .= implode('&', $params_arr);
135 135
 
136
-    return $link;
136
+	return $link;
137 137
 }
138 138
 
139 139
 
@@ -148,17 +148,17 @@  discard block
 block discarded – undo
148 148
  */
149 149
 function geodir_get_addlisting_link($post_type = '')
150 150
 {
151
-    global $wpdb;
151
+	global $wpdb;
152 152
 
153
-    //$check_pkg  = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'");
154
-    $check_pkg = 1;
155
-    if (post_type_exists($post_type) && $check_pkg) {
153
+	//$check_pkg  = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'");
154
+	$check_pkg = 1;
155
+	if (post_type_exists($post_type) && $check_pkg) {
156 156
 
157
-        $add_listing_link = get_page_link(geodir_add_listing_page_id());
157
+		$add_listing_link = get_page_link(geodir_add_listing_page_id());
158 158
 
159
-        return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
160
-    } else
161
-        return get_bloginfo('url');
159
+		return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
160
+	} else
161
+		return get_bloginfo('url');
162 162
 }
163 163
 
164 164
 /**
@@ -171,19 +171,19 @@  discard block
 block discarded – undo
171 171
  */
172 172
 function geodir_curPageURL()
173 173
 {
174
-    $pageURL = 'http';
175
-    if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
176
-        $pageURL .= "s";
177
-    }
178
-    $pageURL .= "://";
179
-    $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
180
-    /**
181
-     * Filter the current page URL returned by function geodir_curPageURL().
182
-     *
183
-     * @since 1.4.1
184
-     * @param string $pageURL The URL of the current page.
185
-     */
186
-    return apply_filters('geodir_curPageURL', $pageURL);
174
+	$pageURL = 'http';
175
+	if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
176
+		$pageURL .= "s";
177
+	}
178
+	$pageURL .= "://";
179
+	$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
180
+	/**
181
+	 * Filter the current page URL returned by function geodir_curPageURL().
182
+	 *
183
+	 * @since 1.4.1
184
+	 * @param string $pageURL The URL of the current page.
185
+	 */
186
+	return apply_filters('geodir_curPageURL', $pageURL);
187 187
 }
188 188
 
189 189
 
@@ -200,12 +200,12 @@  discard block
 block discarded – undo
200 200
 function geodir_clean($string)
201 201
 {
202 202
 
203
-    $string = trim(strip_tags(stripslashes($string)));
204
-    $string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
205
-    $string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars.
206
-    $string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
203
+	$string = trim(strip_tags(stripslashes($string)));
204
+	$string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
205
+	$string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars.
206
+	$string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
207 207
 
208
-    return $string;
208
+	return $string;
209 209
 }
210 210
 
211 211
 /**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
  */
218 218
 function geodir_get_weekday()
219 219
 {
220
-    return array(__('Sunday', 'geodirectory'), __('Monday', 'geodirectory'), __('Tuesday', 'geodirectory'), __('Wednesday', 'geodirectory'), __('Thursday', 'geodirectory'), __('Friday', 'geodirectory'), __('Saturday', 'geodirectory'));
220
+	return array(__('Sunday', 'geodirectory'), __('Monday', 'geodirectory'), __('Tuesday', 'geodirectory'), __('Wednesday', 'geodirectory'), __('Thursday', 'geodirectory'), __('Friday', 'geodirectory'), __('Saturday', 'geodirectory'));
221 221
 }
222 222
 
223 223
 /**
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
  */
230 230
 function geodir_get_weeks()
231 231
 {
232
-    return array(__('First', 'geodirectory'), __('Second', 'geodirectory'), __('Third', 'geodirectory'), __('Fourth', 'geodirectory'), __('Last', 'geodirectory'));
232
+	return array(__('First', 'geodirectory'), __('Second', 'geodirectory'), __('Third', 'geodirectory'), __('Fourth', 'geodirectory'), __('Last', 'geodirectory'));
233 233
 }
234 234
 
235 235
 
@@ -248,97 +248,97 @@  discard block
 block discarded – undo
248 248
 function geodir_is_page($gdpage = '')
249 249
 {
250 250
 
251
-    global $wp_query, $post,$wp;
252
-    //if(!is_admin()):
253
-
254
-    switch ($gdpage):
255
-        case 'add-listing':
256
-
257
-            if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) {
258
-                return true;
259
-            } elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
260
-                return true;
261
-            }
262
-
263
-            break;
264
-        case 'preview':
265
-            if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
266
-                && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
267
-            )
268
-                return true;
269
-            break;
270
-        case 'listing-success':
271
-            if (is_page() && get_query_var('page_id') == geodir_success_page_id())
272
-                return true;
273
-            break;
274
-        case 'detail':
275
-            if (is_single() && in_array(get_query_var('post_type'), geodir_get_posttypes()))
276
-                return true;
277
-            break;
278
-        case 'pt':
279
-            if (is_post_type_archive() && in_array(get_query_var('post_type'), geodir_get_posttypes()) && !is_tax())
280
-                return true;
281
-
282
-            break;
283
-        case 'listing':
284
-            if (is_tax() && geodir_get_taxonomy_posttype()) {
285
-                global $current_term, $taxonomy, $term;
286
-
287
-                return true;
288
-            }
289
-            if (is_post_type_archive() && in_array(get_query_var('post_type'), geodir_get_posttypes()))
290
-                return true;
291
-
292
-            break;
293
-        case 'home':
294
-
295
-            if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home())
296
-                return true;
297
-
298
-            break;
299
-        case 'location':
300
-            if (is_page() && get_query_var('page_id') == geodir_location_page_id())
301
-                return true;
302
-            break;
303
-        case 'author':
304
-            if (is_author() && isset($_REQUEST['geodir_dashbord']))
305
-                return true;
251
+	global $wp_query, $post,$wp;
252
+	//if(!is_admin()):
253
+
254
+	switch ($gdpage):
255
+		case 'add-listing':
256
+
257
+			if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) {
258
+				return true;
259
+			} elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
260
+				return true;
261
+			}
262
+
263
+			break;
264
+		case 'preview':
265
+			if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
266
+				&& in_array($_REQUEST['listing_type'], geodir_get_posttypes())
267
+			)
268
+				return true;
269
+			break;
270
+		case 'listing-success':
271
+			if (is_page() && get_query_var('page_id') == geodir_success_page_id())
272
+				return true;
273
+			break;
274
+		case 'detail':
275
+			if (is_single() && in_array(get_query_var('post_type'), geodir_get_posttypes()))
276
+				return true;
277
+			break;
278
+		case 'pt':
279
+			if (is_post_type_archive() && in_array(get_query_var('post_type'), geodir_get_posttypes()) && !is_tax())
280
+				return true;
281
+
282
+			break;
283
+		case 'listing':
284
+			if (is_tax() && geodir_get_taxonomy_posttype()) {
285
+				global $current_term, $taxonomy, $term;
286
+
287
+				return true;
288
+			}
289
+			if (is_post_type_archive() && in_array(get_query_var('post_type'), geodir_get_posttypes()))
290
+				return true;
291
+
292
+			break;
293
+		case 'home':
294
+
295
+			if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home())
296
+				return true;
297
+
298
+			break;
299
+		case 'location':
300
+			if (is_page() && get_query_var('page_id') == geodir_location_page_id())
301
+				return true;
302
+			break;
303
+		case 'author':
304
+			if (is_author() && isset($_REQUEST['geodir_dashbord']))
305
+				return true;
306 306
 			
307 307
 			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) {
308 308
 				if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) {
309 309
 					return true;
310 310
 				}
311 311
 			}
312
-            break;
313
-        case 'search':
314
-            if (is_search() && isset($_REQUEST['geodir_search']))
315
-                return true;
316
-            break;
317
-        case 'info':
318
-            if (is_page() && get_query_var('page_id') == geodir_info_page_id())
319
-                return true;
320
-            break;
321
-        case 'login':
322
-            if (is_page() && get_query_var('page_id') == geodir_login_page_id())
323
-                return true;
324
-            break;
325
-        case 'checkout':
326
-            if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id())
327
-                return true;
328
-            break;
329
-        case 'invoices':
330
-            if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id())
331
-                return true;
332
-            break;
333
-        default:
334
-            return false;
335
-            break;
336
-
337
-    endswitch;
338
-
339
-    //endif;
340
-
341
-    return false;
312
+			break;
313
+		case 'search':
314
+			if (is_search() && isset($_REQUEST['geodir_search']))
315
+				return true;
316
+			break;
317
+		case 'info':
318
+			if (is_page() && get_query_var('page_id') == geodir_info_page_id())
319
+				return true;
320
+			break;
321
+		case 'login':
322
+			if (is_page() && get_query_var('page_id') == geodir_login_page_id())
323
+				return true;
324
+			break;
325
+		case 'checkout':
326
+			if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id())
327
+				return true;
328
+			break;
329
+		case 'invoices':
330
+			if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id())
331
+				return true;
332
+			break;
333
+		default:
334
+			return false;
335
+			break;
336
+
337
+	endswitch;
338
+
339
+	//endif;
340
+
341
+	return false;
342 342
 }
343 343
 
344 344
 /**
@@ -352,97 +352,97 @@  discard block
 block discarded – undo
352 352
  */
353 353
 function geodir_set_is_geodir_page($wp)
354 354
 {
355
-    if (!is_admin()) {
356
-        //$wp->query_vars['gd_is_geodir_page'] = false;
357
-        //print_r()
358
-        if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
359
-            if (get_option('geodir_set_as_home'))
360
-                $wp->query_vars['gd_is_geodir_page'] = true;
361
-            if(geodir_is_page('home')){
362
-                $wp->query_vars['gd_is_geodir_page'] = true;
363
-            }
355
+	if (!is_admin()) {
356
+		//$wp->query_vars['gd_is_geodir_page'] = false;
357
+		//print_r()
358
+		if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
359
+			if (get_option('geodir_set_as_home'))
360
+				$wp->query_vars['gd_is_geodir_page'] = true;
361
+			if(geodir_is_page('home')){
362
+				$wp->query_vars['gd_is_geodir_page'] = true;
363
+			}
364 364
 
365 365
 
366
-        }
366
+		}
367 367
 
368
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
369
-            if (
370
-                $wp->query_vars['page_id'] == geodir_add_listing_page_id()
371
-                || $wp->query_vars['page_id'] == geodir_preview_page_id()
372
-                || $wp->query_vars['page_id'] == geodir_success_page_id()
373
-                || $wp->query_vars['page_id'] == geodir_location_page_id()
374
-                || $wp->query_vars['page_id'] == geodir_home_page_id()
375
-                || $wp->query_vars['page_id'] == geodir_info_page_id()
376
-                || $wp->query_vars['page_id'] == geodir_login_page_id()
377
-                || (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
378
-                || (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
379
-            )
380
-                $wp->query_vars['gd_is_geodir_page'] = true;
381
-        }
368
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
369
+			if (
370
+				$wp->query_vars['page_id'] == geodir_add_listing_page_id()
371
+				|| $wp->query_vars['page_id'] == geodir_preview_page_id()
372
+				|| $wp->query_vars['page_id'] == geodir_success_page_id()
373
+				|| $wp->query_vars['page_id'] == geodir_location_page_id()
374
+				|| $wp->query_vars['page_id'] == geodir_home_page_id()
375
+				|| $wp->query_vars['page_id'] == geodir_info_page_id()
376
+				|| $wp->query_vars['page_id'] == geodir_login_page_id()
377
+				|| (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
378
+				|| (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
379
+			)
380
+				$wp->query_vars['gd_is_geodir_page'] = true;
381
+		}
382 382
 
383
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
384
-            $page = get_page_by_path($wp->query_vars['pagename']);
385
-
386
-            if (!empty($page) && (
387
-                    $page->ID == geodir_add_listing_page_id()
388
-                    || $page->ID == geodir_preview_page_id()
389
-                    || $page->ID == geodir_success_page_id()
390
-                    || $page->ID == geodir_location_page_id()
391
-                    || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id())
392
-                    || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id())
393
-                    || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id())
394
-                    || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
395
-                    || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
396
-                )
397
-            )
398
-                $wp->query_vars['gd_is_geodir_page'] = true;
399
-        }
383
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
384
+			$page = get_page_by_path($wp->query_vars['pagename']);
385
+
386
+			if (!empty($page) && (
387
+					$page->ID == geodir_add_listing_page_id()
388
+					|| $page->ID == geodir_preview_page_id()
389
+					|| $page->ID == geodir_success_page_id()
390
+					|| $page->ID == geodir_location_page_id()
391
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id())
392
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id())
393
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id())
394
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
395
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
396
+				)
397
+			)
398
+				$wp->query_vars['gd_is_geodir_page'] = true;
399
+		}
400 400
 
401 401
 
402
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
403
-            $requested_post_type = $wp->query_vars['post_type'];
404
-            // check if this post type is geodirectory post types 
405
-            $post_type_array = geodir_get_posttypes();
406
-            if (in_array($requested_post_type, $post_type_array)) {
407
-                $wp->query_vars['gd_is_geodir_page'] = true;
408
-            }
409
-        }
402
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
403
+			$requested_post_type = $wp->query_vars['post_type'];
404
+			// check if this post type is geodirectory post types 
405
+			$post_type_array = geodir_get_posttypes();
406
+			if (in_array($requested_post_type, $post_type_array)) {
407
+				$wp->query_vars['gd_is_geodir_page'] = true;
408
+			}
409
+		}
410 410
 
411
-        if (!isset($wp->query_vars['gd_is_geodir_page'])) {
412
-            $geodir_taxonomis = geodir_get_taxonomies('', true);
413
-            if(!empty($geodir_taxonomis)){
414
-                foreach ($geodir_taxonomis as $taxonomy) {
415
-                    if (array_key_exists($taxonomy, $wp->query_vars)) {
416
-                        $wp->query_vars['gd_is_geodir_page'] = true;
417
-                        break;
418
-                    }
419
-                }
420
-            }
411
+		if (!isset($wp->query_vars['gd_is_geodir_page'])) {
412
+			$geodir_taxonomis = geodir_get_taxonomies('', true);
413
+			if(!empty($geodir_taxonomis)){
414
+				foreach ($geodir_taxonomis as $taxonomy) {
415
+					if (array_key_exists($taxonomy, $wp->query_vars)) {
416
+						$wp->query_vars['gd_is_geodir_page'] = true;
417
+						break;
418
+					}
419
+				}
420
+			}
421 421
 
422
-        }
422
+		}
423 423
 
424
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord']))
425
-            $wp->query_vars['gd_is_geodir_page'] = true;
424
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord']))
425
+			$wp->query_vars['gd_is_geodir_page'] = true;
426 426
 
427 427
 
428
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search']))
429
-            $wp->query_vars['gd_is_geodir_page'] = true;
428
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search']))
429
+			$wp->query_vars['gd_is_geodir_page'] = true;
430 430
 
431 431
 
432 432
 //check if homepage
433
-        if(!isset($wp->query_vars['gd_is_geodir_page'])
434
-            && !isset($wp->query_vars['page_id'])
435
-            && !isset($wp->query_vars['pagename'])
436
-            && is_page_geodir_home()){
437
-            $wp->query_vars['gd_is_geodir_page'] = true;
438
-        }
439
-        //echo $wp->query_vars['gd_is_geodir_page'] ;
440
-        /*echo "<pre>" ;
433
+		if(!isset($wp->query_vars['gd_is_geodir_page'])
434
+			&& !isset($wp->query_vars['page_id'])
435
+			&& !isset($wp->query_vars['pagename'])
436
+			&& is_page_geodir_home()){
437
+			$wp->query_vars['gd_is_geodir_page'] = true;
438
+		}
439
+		//echo $wp->query_vars['gd_is_geodir_page'] ;
440
+		/*echo "<pre>" ;
441 441
 		print_r($wp) ;
442 442
 		echo "</pre>" ;
443 443
 	//	exit();
444 444
 			*/
445
-    } // end of is admin
445
+	} // end of is admin
446 446
 }
447 447
 
448 448
 /**
@@ -455,56 +455,56 @@  discard block
 block discarded – undo
455 455
  */
456 456
 function geodir_is_geodir_page()
457 457
 {
458
-    global $wp;
459
-    if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page'])
460
-        return true;
461
-    else
462
-        return false;
458
+	global $wp;
459
+	if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page'])
460
+		return true;
461
+	else
462
+		return false;
463 463
 }
464 464
 
465 465
 if (!function_exists('geodir_get_imagesize')) {
466
-    /**
467
-     * Get image size using the size key .
468
-     *
469
-     * @since 1.0.0
470
-     * @package GeoDirectory
471
-     * @param string $size The image size key.
472
-     * @return array|mixed|void|WP_Error If valid returns image size. Else returns error.
473
-     */
474
-    function geodir_get_imagesize($size = '')
475
-    {
476
-
477
-        $imagesizes = array('list-thumb' => array('w' => 283, 'h' => 188),
478
-            'thumbnail' => array('w' => 125, 'h' => 125),
479
-            'widget-thumb' => array('w' => 50, 'h' => 50),
480
-            'slider-thumb' => array('w' => 100, 'h' => 100)
481
-        );
482
-
483
-        /**
484
-         * Filter the image sizes array.
485
-         *
486
-         * @since 1.0.0
487
-         * @param array $imagesizes Image size array.
488
-         */
489
-        $imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
490
-
491
-        if (!empty($size) && array_key_exists($size, $imagesizes)) {
492
-            /**
493
-             * Filters image size of the passed key.
494
-             *
495
-             * @since 1.0.0
496
-             * @param array $imagesizes[$size] Image size array of the passed key.
497
-             */
498
-            return apply_filters('geodir_get_imagesize_' . $size, $imagesizes[$size]);
499
-
500
-        } elseif (!empty($size)) {
501
-
502
-            return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
466
+	/**
467
+	 * Get image size using the size key .
468
+	 *
469
+	 * @since 1.0.0
470
+	 * @package GeoDirectory
471
+	 * @param string $size The image size key.
472
+	 * @return array|mixed|void|WP_Error If valid returns image size. Else returns error.
473
+	 */
474
+	function geodir_get_imagesize($size = '')
475
+	{
476
+
477
+		$imagesizes = array('list-thumb' => array('w' => 283, 'h' => 188),
478
+			'thumbnail' => array('w' => 125, 'h' => 125),
479
+			'widget-thumb' => array('w' => 50, 'h' => 50),
480
+			'slider-thumb' => array('w' => 100, 'h' => 100)
481
+		);
482
+
483
+		/**
484
+		 * Filter the image sizes array.
485
+		 *
486
+		 * @since 1.0.0
487
+		 * @param array $imagesizes Image size array.
488
+		 */
489
+		$imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
490
+
491
+		if (!empty($size) && array_key_exists($size, $imagesizes)) {
492
+			/**
493
+			 * Filters image size of the passed key.
494
+			 *
495
+			 * @since 1.0.0
496
+			 * @param array $imagesizes[$size] Image size array of the passed key.
497
+			 */
498
+			return apply_filters('geodir_get_imagesize_' . $size, $imagesizes[$size]);
499
+
500
+		} elseif (!empty($size)) {
501
+
502
+			return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
503 503
 
504
-        }
504
+		}
505 505
 
506
-        return $imagesizes;
507
-    }
506
+		return $imagesizes;
507
+	}
508 508
 }
509 509
 
510 510
 /**
@@ -524,148 +524,148 @@  discard block
 block discarded – undo
524 524
 
525 525
 
526 526
 if (!function_exists('createRandomString')) {
527
-    /**
528
-     * Creates random string.
529
-     *
530
-     * @since 1.0.0
531
-     * @package GeoDirectory
532
-     * @return string Random string.
533
-     */
534
-    function createRandomString()
535
-    {
536
-        $chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
537
-        srand((double)microtime() * 1000000);
538
-        $i = 0;
539
-        $rstring = '';
540
-        while ($i <= 25) {
541
-            $num = rand() % 33;
542
-            $tmp = substr($chars, $num, 1);
543
-            $rstring = $rstring . $tmp;
544
-            $i++;
545
-        }
546
-        return $rstring;
547
-    }
527
+	/**
528
+	 * Creates random string.
529
+	 *
530
+	 * @since 1.0.0
531
+	 * @package GeoDirectory
532
+	 * @return string Random string.
533
+	 */
534
+	function createRandomString()
535
+	{
536
+		$chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
537
+		srand((double)microtime() * 1000000);
538
+		$i = 0;
539
+		$rstring = '';
540
+		while ($i <= 25) {
541
+			$num = rand() % 33;
542
+			$tmp = substr($chars, $num, 1);
543
+			$rstring = $rstring . $tmp;
544
+			$i++;
545
+		}
546
+		return $rstring;
547
+	}
548 548
 }
549 549
 
550 550
 if (!function_exists('geodir_getDistanceRadius')) {
551
-    /**
552
-     * Calculates the distance radius.
553
-     *
554
-     * @since 1.0.0
555
-     * @package GeoDirectory
556
-     * @param string $uom Measurement unit type.
557
-     * @return float The mean radius.
558
-     */
559
-    function geodir_getDistanceRadius($uom = 'km')
560
-    {
551
+	/**
552
+	 * Calculates the distance radius.
553
+	 *
554
+	 * @since 1.0.0
555
+	 * @package GeoDirectory
556
+	 * @param string $uom Measurement unit type.
557
+	 * @return float The mean radius.
558
+	 */
559
+	function geodir_getDistanceRadius($uom = 'km')
560
+	{
561 561
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
562
-        switch (geodir_strtolower($uom)):
563
-            case 'km'    :
564
-                $earthMeanRadius = 6371.009; // km
565
-                break;
566
-            case 'm'    :
567
-            case 'meters'    :
568
-                $earthMeanRadius = 6371.009 * 1000; // km
569
-                break;
570
-            case 'miles'    :
571
-                $earthMeanRadius = 3958.761; // miles
572
-                break;
573
-            case 'yards'    :
574
-            case 'yds'    :
575
-                $earthMeanRadius = 3958.761 * 1760; // yards
576
-                break;
577
-            case 'feet'    :
578
-            case 'ft'    :
579
-                $earthMeanRadius = 3958.761 * 1760 * 3; // feet
580
-                break;
581
-            case 'nm'    :
582
-                $earthMeanRadius = 3440.069; //  miles
583
-                break;
584
-            default:
585
-                $earthMeanRadius = 3958.761; // miles
586
-                break;
587
-        endswitch;
588
-        return $earthMeanRadius;
589
-    }
562
+		switch (geodir_strtolower($uom)):
563
+			case 'km'    :
564
+				$earthMeanRadius = 6371.009; // km
565
+				break;
566
+			case 'm'    :
567
+			case 'meters'    :
568
+				$earthMeanRadius = 6371.009 * 1000; // km
569
+				break;
570
+			case 'miles'    :
571
+				$earthMeanRadius = 3958.761; // miles
572
+				break;
573
+			case 'yards'    :
574
+			case 'yds'    :
575
+				$earthMeanRadius = 3958.761 * 1760; // yards
576
+				break;
577
+			case 'feet'    :
578
+			case 'ft'    :
579
+				$earthMeanRadius = 3958.761 * 1760 * 3; // feet
580
+				break;
581
+			case 'nm'    :
582
+				$earthMeanRadius = 3440.069; //  miles
583
+				break;
584
+			default:
585
+				$earthMeanRadius = 3958.761; // miles
586
+				break;
587
+		endswitch;
588
+		return $earthMeanRadius;
589
+	}
590 590
 }
591 591
 
592 592
 
593 593
 if (!function_exists('geodir_calculateDistanceFromLatLong')) {
594
-    /**
595
-     * Calculate the great circle distance between two points identified by longitude and latitude.
596
-     *
597
-     * @since 1.0.0
598
-     * @package GeoDirectory
599
-     * @param array $point1 Latitude and Longitude of point 1.
600
-     * @param array $point2 Latitude and Longitude of point 2.
601
-     * @param string $uom Unit of measurement.
602
-     * @return float The distance.
603
-     */
604
-    function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km')
605
-    {
594
+	/**
595
+	 * Calculate the great circle distance between two points identified by longitude and latitude.
596
+	 *
597
+	 * @since 1.0.0
598
+	 * @package GeoDirectory
599
+	 * @param array $point1 Latitude and Longitude of point 1.
600
+	 * @param array $point2 Latitude and Longitude of point 2.
601
+	 * @param string $uom Unit of measurement.
602
+	 * @return float The distance.
603
+	 */
604
+	function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km')
605
+	{
606 606
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
607 607
 
608
-        $earthMeanRadius = geodir_getDistanceRadius($uom);
608
+		$earthMeanRadius = geodir_getDistanceRadius($uom);
609 609
 
610
-        $deltaLatitude = deg2rad($point2['latitude'] - $point1['latitude']);
611
-        $deltaLongitude = deg2rad($point2['longitude'] - $point1['longitude']);
612
-        $a = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
613
-            cos(deg2rad($point1['latitude'])) * cos(deg2rad($point2['latitude'])) *
614
-            sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
615
-        $c = 2 * atan2(sqrt($a), sqrt(1 - $a));
616
-        $distance = $earthMeanRadius * $c;
617
-        return $distance;
610
+		$deltaLatitude = deg2rad($point2['latitude'] - $point1['latitude']);
611
+		$deltaLongitude = deg2rad($point2['longitude'] - $point1['longitude']);
612
+		$a = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
613
+			cos(deg2rad($point1['latitude'])) * cos(deg2rad($point2['latitude'])) *
614
+			sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
615
+		$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
616
+		$distance = $earthMeanRadius * $c;
617
+		return $distance;
618 618
 
619
-    }
619
+	}
620 620
 }
621 621
 
622 622
 
623 623
 if (!function_exists('geodir_sendEmail')) {
624
-    /**
625
-     * The main function that send transactional emails using the args provided.
626
-     *
627
-     * @since 1.0.0
628
-     * @since 1.5.7 Added db translations for notifications subject and content.
629
-     * @package GeoDirectory
630
-     * @param string $fromEmail Sender email address.
631
-     * @param string $fromEmailName Sender name.
632
-     * @param string $toEmail Receiver email address.
633
-     * @param string $toEmailName Receiver name.
634
-     * @param string $to_subject Email subject.
635
-     * @param string $to_message Email content.
636
-     * @param string $extra Not being used.
637
-     * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
638
-     * @param string $post_id The post ID.
639
-     * @param string $user_id The user ID.
640
-     */
641
-    function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
642
-        $login_details = '';
643
-
644
-        // strip slashes from subject & message text
645
-        $to_subject = stripslashes_deep($to_subject);
646
-        $to_message = stripslashes_deep($to_message);
647
-
648
-        if ($message_type == 'send_friend') {
649
-            $subject = get_option('geodir_email_friend_subject');
650
-            $message = get_option('geodir_email_friend_content');
651
-        } elseif ($message_type == 'send_enquiry') {
652
-            $subject = get_option('geodir_email_enquiry_subject');
653
-            $message = get_option('geodir_email_enquiry_content');
654
-        } elseif ($message_type == 'forgot_password') {
655
-            $subject = get_option('geodir_forgot_password_subject');
656
-            $message = get_option('geodir_forgot_password_content');
657
-            $login_details = $to_message;
658
-        } elseif ($message_type == 'registration') {
659
-            $subject = get_option('geodir_registration_success_email_subject');
660
-            $message = get_option('geodir_registration_success_email_content');
661
-            $login_details = $to_message;
662
-        } elseif ($message_type == 'post_submit') {
663
-            $subject = get_option('geodir_post_submited_success_email_subject');
664
-            $message = get_option('geodir_post_submited_success_email_content');
665
-        } elseif ($message_type == 'listing_published') {
666
-            $subject = get_option('geodir_post_published_email_subject');
667
-            $message = get_option('geodir_post_published_email_content');
668
-        }
624
+	/**
625
+	 * The main function that send transactional emails using the args provided.
626
+	 *
627
+	 * @since 1.0.0
628
+	 * @since 1.5.7 Added db translations for notifications subject and content.
629
+	 * @package GeoDirectory
630
+	 * @param string $fromEmail Sender email address.
631
+	 * @param string $fromEmailName Sender name.
632
+	 * @param string $toEmail Receiver email address.
633
+	 * @param string $toEmailName Receiver name.
634
+	 * @param string $to_subject Email subject.
635
+	 * @param string $to_message Email content.
636
+	 * @param string $extra Not being used.
637
+	 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
638
+	 * @param string $post_id The post ID.
639
+	 * @param string $user_id The user ID.
640
+	 */
641
+	function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
642
+		$login_details = '';
643
+
644
+		// strip slashes from subject & message text
645
+		$to_subject = stripslashes_deep($to_subject);
646
+		$to_message = stripslashes_deep($to_message);
647
+
648
+		if ($message_type == 'send_friend') {
649
+			$subject = get_option('geodir_email_friend_subject');
650
+			$message = get_option('geodir_email_friend_content');
651
+		} elseif ($message_type == 'send_enquiry') {
652
+			$subject = get_option('geodir_email_enquiry_subject');
653
+			$message = get_option('geodir_email_enquiry_content');
654
+		} elseif ($message_type == 'forgot_password') {
655
+			$subject = get_option('geodir_forgot_password_subject');
656
+			$message = get_option('geodir_forgot_password_content');
657
+			$login_details = $to_message;
658
+		} elseif ($message_type == 'registration') {
659
+			$subject = get_option('geodir_registration_success_email_subject');
660
+			$message = get_option('geodir_registration_success_email_content');
661
+			$login_details = $to_message;
662
+		} elseif ($message_type == 'post_submit') {
663
+			$subject = get_option('geodir_post_submited_success_email_subject');
664
+			$message = get_option('geodir_post_submited_success_email_content');
665
+		} elseif ($message_type == 'listing_published') {
666
+			$subject = get_option('geodir_post_published_email_subject');
667
+			$message = get_option('geodir_post_published_email_content');
668
+		}
669 669
 		
670 670
 		if (!empty($subject)) {
671 671
 			$subject = __(stripslashes_deep($subject),'geodirectory');
@@ -675,125 +675,125 @@  discard block
 block discarded – undo
675 675
 			$message = __(stripslashes_deep($message),'geodirectory');
676 676
 		}
677 677
 
678
-        $to_message = nl2br($to_message);
679
-        $sitefromEmail = get_option('site_email');
680
-        $sitefromEmailName = get_site_emailName();
681
-        $productlink = get_permalink($post_id);
678
+		$to_message = nl2br($to_message);
679
+		$sitefromEmail = get_option('site_email');
680
+		$sitefromEmailName = get_site_emailName();
681
+		$productlink = get_permalink($post_id);
682 682
 
683
-        $user_login = '';
684
-        if ($user_id > 0 && $user_info = get_userdata($user_id)) {
685
-            $user_login = $user_info->user_login;
686
-        }
683
+		$user_login = '';
684
+		if ($user_id > 0 && $user_info = get_userdata($user_id)) {
685
+			$user_login = $user_info->user_login;
686
+		}
687 687
 
688
-        $posted_date = '';
689
-        $listingLink = '';
688
+		$posted_date = '';
689
+		$listingLink = '';
690 690
 
691
-        $post_info = get_post($post_id);
691
+		$post_info = get_post($post_id);
692 692
 
693
-        if ($post_info) {
694
-            $posted_date = $post_info->post_date;
695
-            $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
696
-        }
697
-        $siteurl = home_url();
698
-        $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
699
-        $loginurl = geodir_login_url();
700
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
693
+		if ($post_info) {
694
+			$posted_date = $post_info->post_date;
695
+			$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
696
+		}
697
+		$siteurl = home_url();
698
+		$siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
699
+		$loginurl = geodir_login_url();
700
+		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
701 701
 
702
-        if ($fromEmail == '') {
703
-            $fromEmail = get_option('site_email');
704
-        }
702
+		if ($fromEmail == '') {
703
+			$fromEmail = get_option('site_email');
704
+		}
705 705
 
706
-        if ($fromEmailName == '') {
707
-            $fromEmailName = get_option('site_email_name');
708
-        }
706
+		if ($fromEmailName == '') {
707
+			$fromEmailName = get_option('site_email_name');
708
+		}
709 709
 
710
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]');
711
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login);
712
-        $message = str_replace($search_array, $replace_array, $message);
713
-
714
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]');
715
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login);
716
-        $subject = str_replace($search_array, $replace_array, $subject);
717
-
718
-        $headers = 'MIME-Version: 1.0' . "\r\n";
719
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
720
-        $headers .= "Reply-To: " . $fromEmail . "\r\n";
721
-        $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
722
-
723
-        $to = $toEmail;
724
-        $sent = wp_mail($to, $subject, $message, $headers);
725
-
726
-        if( ! $sent ) {
727
-            if ( is_array( $to ) ) {
728
-                $to = implode( ',', $to );
729
-            }
730
-            $log_message = sprintf(
731
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
732
-                $message_type,
733
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
734
-                $to,
735
-                $subject
736
-            );
737
-            geodir_error_log( $log_message );
738
-        }
710
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]');
711
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login);
712
+		$message = str_replace($search_array, $replace_array, $message);
739 713
 
740
-        ///////// ADMIN BCC EMIALS
741
-        $adminEmail = get_bloginfo('admin_email');
742
-        $to = $adminEmail;
714
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]');
715
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login);
716
+		$subject = str_replace($search_array, $replace_array, $subject);
743 717
 
744
-        $admin_bcc = false;
745
-        if ($message_type == 'post_submit') {
746
-            $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
747
-            $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
718
+		$headers = 'MIME-Version: 1.0' . "\r\n";
719
+		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
720
+		$headers .= "Reply-To: " . $fromEmail . "\r\n";
721
+		$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
748 722
 
749
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
750
-            $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $user_login, $user_login);
751
-            $message = str_replace($search_array, $replace_array, $message);
723
+		$to = $toEmail;
724
+		$sent = wp_mail($to, $subject, $message, $headers);
752 725
 
753
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
754
-            $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
755
-            $subject = str_replace($search_array, $replace_array, $subject);
726
+		if( ! $sent ) {
727
+			if ( is_array( $to ) ) {
728
+				$to = implode( ',', $to );
729
+			}
730
+			$log_message = sprintf(
731
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
732
+				$message_type,
733
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
734
+				$to,
735
+				$subject
736
+			);
737
+			geodir_error_log( $log_message );
738
+		}
756 739
 
757
-            $subject .= ' - ADMIN BCC COPY';
758
-            $admin_bcc = true;
740
+		///////// ADMIN BCC EMIALS
741
+		$adminEmail = get_bloginfo('admin_email');
742
+		$to = $adminEmail;
759 743
 
760
-        }
761
-        elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
762
-            $subject .= ' - ADMIN BCC COPY';
763
-            $admin_bcc = true;
764
-        }
765
-        elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
766
-            $subject .= ' - ADMIN BCC COPY';
767
-            $admin_bcc = true;
768
-        }
769
-        elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
770
-            $subject .= ' - ADMIN BCC COPY';
771
-            $admin_bcc = true;
772
-        }
773
-        elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
774
-            $subject .= ' - ADMIN BCC COPY';
775
-            $admin_bcc = true;
776
-        }
744
+		$admin_bcc = false;
745
+		if ($message_type == 'post_submit') {
746
+			$subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
747
+			$message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
777 748
 
778
-        if($admin_bcc===true){
779
-            $sent = wp_mail($to, $subject, $message, $headers);
780
-
781
-            if( ! $sent ) {
782
-                if ( is_array( $to ) ) {
783
-                    $to = implode( ',', $to );
784
-                }
785
-                $log_message = sprintf(
786
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
787
-                    $message_type,
788
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
789
-                    $to,
790
-                    $subject
791
-                );
792
-                geodir_error_log( $log_message );
793
-            }
794
-        }
749
+			$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
750
+			$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $user_login, $user_login);
751
+			$message = str_replace($search_array, $replace_array, $message);
752
+
753
+			$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
754
+			$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
755
+			$subject = str_replace($search_array, $replace_array, $subject);
756
+
757
+			$subject .= ' - ADMIN BCC COPY';
758
+			$admin_bcc = true;
759
+
760
+		}
761
+		elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
762
+			$subject .= ' - ADMIN BCC COPY';
763
+			$admin_bcc = true;
764
+		}
765
+		elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
766
+			$subject .= ' - ADMIN BCC COPY';
767
+			$admin_bcc = true;
768
+		}
769
+		elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
770
+			$subject .= ' - ADMIN BCC COPY';
771
+			$admin_bcc = true;
772
+		}
773
+		elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
774
+			$subject .= ' - ADMIN BCC COPY';
775
+			$admin_bcc = true;
776
+		}
777
+
778
+		if($admin_bcc===true){
779
+			$sent = wp_mail($to, $subject, $message, $headers);
780
+
781
+			if( ! $sent ) {
782
+				if ( is_array( $to ) ) {
783
+					$to = implode( ',', $to );
784
+				}
785
+				$log_message = sprintf(
786
+					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
787
+					$message_type,
788
+					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
789
+					$to,
790
+					$subject
791
+				);
792
+				geodir_error_log( $log_message );
793
+			}
794
+		}
795 795
 
796
-    }
796
+	}
797 797
 }
798 798
 
799 799
 
@@ -806,27 +806,27 @@  discard block
 block discarded – undo
806 806
 function geodir_taxonomy_breadcrumb()
807 807
 {
808 808
 
809
-    $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
810
-    $parent = $term->parent;
809
+	$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
810
+	$parent = $term->parent;
811 811
 
812
-    while ($parent):
813
-        $parents[] = $parent;
814
-        $new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
815
-        $parent = $new_parent->parent;
816
-    endwhile;
812
+	while ($parent):
813
+		$parents[] = $parent;
814
+		$new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
815
+		$parent = $new_parent->parent;
816
+	endwhile;
817 817
 
818
-    if (!empty($parents)):
819
-        $parents = array_reverse($parents);
818
+	if (!empty($parents)):
819
+		$parents = array_reverse($parents);
820 820
 
821
-        foreach ($parents as $parent):
822
-            $item = get_term_by('id', $parent, get_query_var('taxonomy'));
823
-            $url = get_term_link($item, get_query_var('taxonomy'));
824
-            echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
825
-        endforeach;
821
+		foreach ($parents as $parent):
822
+			$item = get_term_by('id', $parent, get_query_var('taxonomy'));
823
+			$url = get_term_link($item, get_query_var('taxonomy'));
824
+			echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
825
+		endforeach;
826 826
 
827
-    endif;
827
+	endif;
828 828
 
829
-    echo '<li> > ' . $term->name . '</li>';
829
+	echo '<li> > ' . $term->name . '</li>';
830 830
 }
831 831
 
832 832
 
@@ -842,365 +842,365 @@  discard block
 block discarded – undo
842 842
  */
843 843
 function geodir_breadcrumb()
844 844
 {
845
-    global $wp_query, $geodir_add_location_url;
846
-
847
-    /**
848
-     * Filter breadcrumb separator.
849
-     *
850
-     * @since 1.0.0
851
-     */
852
-    $separator = apply_filters('geodir_breadcrumb_separator', ' > ');
853
-
854
-    if (!geodir_is_page('home')) {
855
-        $breadcrumb = '';
856
-        $url_categoris = '';
857
-        $breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
858
-        /**
859
-         * Filter breadcrumb's first link.
860
-         *
861
-         * @since 1.0.0
862
-         */
863
-        $breadcrumb .= '<li>' . apply_filters('geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __('Home', 'geodirectory') . '</a>') . '</li>';
845
+	global $wp_query, $geodir_add_location_url;
846
+
847
+	/**
848
+	 * Filter breadcrumb separator.
849
+	 *
850
+	 * @since 1.0.0
851
+	 */
852
+	$separator = apply_filters('geodir_breadcrumb_separator', ' > ');
853
+
854
+	if (!geodir_is_page('home')) {
855
+		$breadcrumb = '';
856
+		$url_categoris = '';
857
+		$breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
858
+		/**
859
+		 * Filter breadcrumb's first link.
860
+		 *
861
+		 * @since 1.0.0
862
+		 */
863
+		$breadcrumb .= '<li>' . apply_filters('geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __('Home', 'geodirectory') . '</a>') . '</li>';
864
+
865
+		$gd_post_type = geodir_get_current_posttype();
866
+		$post_type_info = get_post_type_object($gd_post_type);
867
+
868
+		remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
869
+
870
+		$listing_link = get_post_type_archive_link($gd_post_type);
871
+
872
+		add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
873
+		$listing_link = rtrim($listing_link, '/');
874
+		$listing_link .= '/';
875
+
876
+		$post_type_for_location_link = $listing_link;
877
+		$location_terms = geodir_get_current_location_terms('query_vars', $gd_post_type);
878
+
879
+		global $wp, $gd_session;
880
+		$location_link = $post_type_for_location_link;
881
+
882
+		if (geodir_is_page('detail') || geodir_is_page('listing')) {
883
+			global $post;
884
+			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
885
+			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
886
+				
887
+			if(geodir_is_page('detail') && isset($post->country_slug)){
888
+				$location_terms = array(
889
+					'gd_country' => $post->country_slug,
890
+					'gd_region' => $post->region_slug,
891
+					'gd_city' => $post->city_slug
892
+				);
893
+				
894
+				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
895
+					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
896
+				}
897
+			}
864 898
 
865
-        $gd_post_type = geodir_get_current_posttype();
866
-        $post_type_info = get_post_type_object($gd_post_type);
899
+			$geodir_show_location_url = get_option('geodir_show_location_url');
867 900
 
868
-        remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
901
+			$hide_url_part = array();
902
+			if ($location_manager) {
903
+				$hide_country_part = get_option('geodir_location_hide_country_part');
904
+				$hide_region_part = get_option('geodir_location_hide_region_part');
869 905
 
870
-        $listing_link = get_post_type_archive_link($gd_post_type);
906
+				if ($hide_region_part && $hide_country_part) {
907
+					$hide_url_part = array('gd_country', 'gd_region');
908
+				} else if ($hide_region_part && !$hide_country_part) {
909
+					$hide_url_part = array('gd_region');
910
+				} else if (!$hide_region_part && $hide_country_part) {
911
+					$hide_url_part = array('gd_country');
912
+				}
913
+			}
871 914
 
872
-        add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
873
-        $listing_link = rtrim($listing_link, '/');
874
-        $listing_link .= '/';
915
+			$hide_text_part = array();
916
+			if ($geodir_show_location_url == 'country_city') {
917
+				$hide_text_part = array('gd_region');
875 918
 
876
-        $post_type_for_location_link = $listing_link;
877
-        $location_terms = geodir_get_current_location_terms('query_vars', $gd_post_type);
919
+				if (isset($location_terms['gd_region']) && !$location_manager) {
920
+					unset($location_terms['gd_region']);
921
+				}
922
+			} else if ($geodir_show_location_url == 'region_city') {
923
+				$hide_text_part = array('gd_country');
878 924
 
879
-        global $wp, $gd_session;
880
-        $location_link = $post_type_for_location_link;
925
+				if (isset($location_terms['gd_country']) && !$location_manager) {
926
+					unset($location_terms['gd_country']);
927
+				}
928
+			} else if ($geodir_show_location_url == 'city') {
929
+				$hide_text_part = array('gd_country', 'gd_region');
881 930
 
882
-        if (geodir_is_page('detail') || geodir_is_page('listing')) {
883
-            global $post;
884
-            $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
885
-			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
886
-				
887
-			if(geodir_is_page('detail') && isset($post->country_slug)){
888
-                $location_terms = array(
889
-                    'gd_country' => $post->country_slug,
890
-                    'gd_region' => $post->region_slug,
891
-                    'gd_city' => $post->city_slug
892
-                );
893
-				
894
-				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
895
-					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
931
+				if (isset($location_terms['gd_country']) && !$location_manager) {
932
+					unset($location_terms['gd_country']);
896 933
 				}
897
-            }
898
-
899
-            $geodir_show_location_url = get_option('geodir_show_location_url');
900
-
901
-            $hide_url_part = array();
902
-            if ($location_manager) {
903
-                $hide_country_part = get_option('geodir_location_hide_country_part');
904
-                $hide_region_part = get_option('geodir_location_hide_region_part');
905
-
906
-                if ($hide_region_part && $hide_country_part) {
907
-                    $hide_url_part = array('gd_country', 'gd_region');
908
-                } else if ($hide_region_part && !$hide_country_part) {
909
-                    $hide_url_part = array('gd_region');
910
-                } else if (!$hide_region_part && $hide_country_part) {
911
-                    $hide_url_part = array('gd_country');
912
-                }
913
-            }
914
-
915
-            $hide_text_part = array();
916
-            if ($geodir_show_location_url == 'country_city') {
917
-                $hide_text_part = array('gd_region');
918
-
919
-                if (isset($location_terms['gd_region']) && !$location_manager) {
920
-                    unset($location_terms['gd_region']);
921
-                }
922
-            } else if ($geodir_show_location_url == 'region_city') {
923
-                $hide_text_part = array('gd_country');
924
-
925
-                if (isset($location_terms['gd_country']) && !$location_manager) {
926
-                    unset($location_terms['gd_country']);
927
-                }
928
-            } else if ($geodir_show_location_url == 'city') {
929
-                $hide_text_part = array('gd_country', 'gd_region');
930
-
931
-                if (isset($location_terms['gd_country']) && !$location_manager) {
932
-                    unset($location_terms['gd_country']);
933
-                }
934
-                if (isset($location_terms['gd_region']) && !$location_manager) {
935
-                    unset($location_terms['gd_region']);
936
-                }
937
-            }
938
-
939
-            $is_location_last = '';
940
-            $is_taxonomy_last = '';
941
-            $breadcrumb .= '<li>';
942
-            if (get_query_var($gd_post_type . 'category'))
943
-                $gd_taxonomy = $gd_post_type . 'category';
944
-            elseif (get_query_var($gd_post_type . '_tags'))
945
-                $gd_taxonomy = $gd_post_type . '_tags';
946
-
947
-            $breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
948
-            if (!empty($gd_taxonomy) || geodir_is_page('detail'))
949
-                $is_location_last = false;
950
-            else
951
-                $is_location_last = true;
952
-
953
-            if (!empty($gd_taxonomy) && geodir_is_page('listing'))
954
-                $is_taxonomy_last = true;
955
-            else
956
-                $is_taxonomy_last = false;
957
-
958
-            if (!empty($location_terms)) {
959
-                $geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
960
-
961
-                foreach ($location_terms as $key => $location_term) {
962
-                    if ($location_term != '') {
963
-                        if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
964
-                            continue;
965
-                        }
966
-
967
-                        $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
968
-                        $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
969
-                        $gd_location_link_text = ucfirst($gd_location_link_text);
970
-
971
-                        $location_term_actual_country = '';
972
-                        $location_term_actual_region = '';
973
-                        $location_term_actual_city = '';
974
-                        if ($geodir_get_locations) {
975
-                            if ($key == 'gd_country') {
976
-                                $location_term_actual_country = get_actual_location_name('country', $location_term, true);
977
-                            } else if ($key == 'gd_region') {
978
-                                $location_term_actual_region = get_actual_location_name('region', $location_term, true);
979
-                            } else if ($key == 'gd_city') {
980
-                                $location_term_actual_city = get_actual_location_name('city', $location_term, true);
981
-                            }
982
-                        } else {
983
-                            $location_info = geodir_get_location();
984
-
985
-                            if (!empty($location_info) && isset($location_info->location_id)) {
986
-                                if ($key == 'gd_country') {
987
-                                    $location_term_actual_country = __($location_info->country, 'geodirectory');
988
-                                } else if ($key == 'gd_region') {
989
-                                    $location_term_actual_region = __($location_info->region, 'geodirectory');
990
-                                } else if ($key == 'gd_city') {
991
-                                    $location_term_actual_city = __($location_info->city, 'geodirectory');
992
-                                }
993
-                            }
994
-                        }
995
-
996
-                        if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
997
-                            $breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
998
-                        } else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
999
-                            $breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1000
-                        } else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1001
-                            $breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1002
-                        } else if ($is_location_last && $key == 'gd_neighbourhood') {
1003
-                            $breadcrumb .= $separator . $gd_location_link_text;
1004
-                        } else {
1005
-                            if (get_option('permalink_structure') != '') {
1006
-                                $location_link .= $location_term . '/';
1007
-                            } else {
1008
-                                $location_link .= "&$key=" . $location_term;
1009
-                            }
934
+				if (isset($location_terms['gd_region']) && !$location_manager) {
935
+					unset($location_terms['gd_region']);
936
+				}
937
+			}
1010 938
 
1011
-                            if ($key == 'gd_country' && $location_term_actual_country != '') {
1012
-                                $gd_location_link_text = $location_term_actual_country;
1013
-                            } else if ($key == 'gd_region' && $location_term_actual_region != '') {
1014
-                                $gd_location_link_text = $location_term_actual_region;
1015
-                            } else if ($key == 'gd_city' && $location_term_actual_city != '') {
1016
-                                $gd_location_link_text = $location_term_actual_city;
1017
-                            }
939
+			$is_location_last = '';
940
+			$is_taxonomy_last = '';
941
+			$breadcrumb .= '<li>';
942
+			if (get_query_var($gd_post_type . 'category'))
943
+				$gd_taxonomy = $gd_post_type . 'category';
944
+			elseif (get_query_var($gd_post_type . '_tags'))
945
+				$gd_taxonomy = $gd_post_type . '_tags';
946
+
947
+			$breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
948
+			if (!empty($gd_taxonomy) || geodir_is_page('detail'))
949
+				$is_location_last = false;
950
+			else
951
+				$is_location_last = true;
952
+
953
+			if (!empty($gd_taxonomy) && geodir_is_page('listing'))
954
+				$is_taxonomy_last = true;
955
+			else
956
+				$is_taxonomy_last = false;
957
+
958
+			if (!empty($location_terms)) {
959
+				$geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
960
+
961
+				foreach ($location_terms as $key => $location_term) {
962
+					if ($location_term != '') {
963
+						if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
964
+							continue;
965
+						}
966
+
967
+						$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
968
+						$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
969
+						$gd_location_link_text = ucfirst($gd_location_link_text);
970
+
971
+						$location_term_actual_country = '';
972
+						$location_term_actual_region = '';
973
+						$location_term_actual_city = '';
974
+						if ($geodir_get_locations) {
975
+							if ($key == 'gd_country') {
976
+								$location_term_actual_country = get_actual_location_name('country', $location_term, true);
977
+							} else if ($key == 'gd_region') {
978
+								$location_term_actual_region = get_actual_location_name('region', $location_term, true);
979
+							} else if ($key == 'gd_city') {
980
+								$location_term_actual_city = get_actual_location_name('city', $location_term, true);
981
+							}
982
+						} else {
983
+							$location_info = geodir_get_location();
984
+
985
+							if (!empty($location_info) && isset($location_info->location_id)) {
986
+								if ($key == 'gd_country') {
987
+									$location_term_actual_country = __($location_info->country, 'geodirectory');
988
+								} else if ($key == 'gd_region') {
989
+									$location_term_actual_region = __($location_info->region, 'geodirectory');
990
+								} else if ($key == 'gd_city') {
991
+									$location_term_actual_city = __($location_info->city, 'geodirectory');
992
+								}
993
+							}
994
+						}
1018 995
 
1019
-                            /*
996
+						if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
997
+							$breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
998
+						} else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
999
+							$breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1000
+						} else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1001
+							$breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1002
+						} else if ($is_location_last && $key == 'gd_neighbourhood') {
1003
+							$breadcrumb .= $separator . $gd_location_link_text;
1004
+						} else {
1005
+							if (get_option('permalink_structure') != '') {
1006
+								$location_link .= $location_term . '/';
1007
+							} else {
1008
+								$location_link .= "&$key=" . $location_term;
1009
+							}
1010
+
1011
+							if ($key == 'gd_country' && $location_term_actual_country != '') {
1012
+								$gd_location_link_text = $location_term_actual_country;
1013
+							} else if ($key == 'gd_region' && $location_term_actual_region != '') {
1014
+								$gd_location_link_text = $location_term_actual_region;
1015
+							} else if ($key == 'gd_city' && $location_term_actual_city != '') {
1016
+								$gd_location_link_text = $location_term_actual_city;
1017
+							}
1018
+
1019
+							/*
1020 1020
                             if (geodir_is_page('detail') && !empty($hide_text_part) && in_array($key, $hide_text_part)) {
1021 1021
                                 continue;
1022 1022
                             }
1023 1023
                             */
1024 1024
 
1025
-                            $breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1026
-                        }
1027
-                    }
1028
-                }
1029
-            }
1030
-
1031
-            if (!empty($gd_taxonomy)) {
1032
-                $term_index = 1;
1033
-
1034
-                //if(get_option('geodir_add_categories_url'))
1035
-                {
1036
-                    if (get_query_var($gd_post_type . '_tags')) {
1037
-                        $cat_link = $listing_link . 'tags/';
1038
-                    } else
1039
-                        $cat_link = $listing_link;
1040
-
1041
-                    foreach ($location_terms as $key => $location_term) {
1042
-                        if ($location_manager && in_array($key, $hide_url_part)) {
1043
-                            continue;
1044
-                        }
1045
-
1046
-                        if ($location_term != '') {
1047
-                            if (get_option('permalink_structure') != '') {
1048
-                                $cat_link .= $location_term . '/';
1049
-                            }
1050
-                        }
1051
-                    }
1052
-
1053
-                    $term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1054
-                    foreach ($term_array as $term) {
1055
-                        $term_link_text = preg_replace('/-(\d+)$/', '', $term);
1056
-                        $term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1057
-
1058
-                        // get term actual name
1059
-                        $term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1060
-                        if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1061
-                            $term_link_text = urldecode($term_info['name']);
1062
-                        } else {
1063
-                            $term_link_text = geodir_ucwords(urldecode($term_link_text));
1064
-                        }
1065
-
1066
-                        if ($term_index == count($term_array) && $is_taxonomy_last)
1067
-                            $breadcrumb .= $separator . $term_link_text;
1068
-                        else {
1069
-                            $cat_link .= $term . '/';
1070
-                            $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1071
-                        }
1072
-                        $term_index++;
1073
-                    }
1074
-                }
1075
-
1076
-
1077
-            }
1078
-
1079
-            if (geodir_is_page('detail'))
1080
-                $breadcrumb .= $separator . get_the_title();
1081
-
1082
-            $breadcrumb .= '</li>';
1083
-
1084
-
1085
-        } elseif (geodir_is_page('author')) {
1086
-            $user_id = get_current_user_id();
1087
-            $author_link = get_author_posts_url($user_id);
1088
-            $default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
1089
-
1090
-            /**
1091
-             * Filter author page link.
1092
-             *
1093
-             * @since 1.0.0
1094
-             * @param string $default_author_link Default author link.
1095
-             * @param int $user_id Author ID.
1096
-             */
1097
-            $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1098
-
1099
-            $breadcrumb .= '<li>';
1100
-            $breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>';
1101
-
1102
-            if (isset($_REQUEST['list'])) {
1103
-                $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false);
1104
-
1105
-                /**
1106
-                 * Filter author page link.
1107
-                 *
1108
-                 * @since 1.0.0
1109
-                 * @param string $author_link Author page link.
1110
-                 * @param int $user_id Author ID.
1111
-                 * @param string $_REQUEST['stype'] Post type.
1112
-                 */
1113
-                $author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1114
-
1115
-                $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1116
-                $breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1117
-            } else
1118
-                $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1119
-
1120
-            $breadcrumb .= '</li>';
1121
-        } elseif (is_category() || is_single()) {
1122
-            $category = get_the_category();
1123
-            if (is_category()) {
1124
-                $breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1125
-            }
1126
-            if (is_single()) {
1127
-                $breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>';
1128
-                $breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1129
-            }
1130
-            /* End of my version ##################################################### */
1131
-        } else if (is_page()) {
1132
-            $page_title = get_the_title();
1133
-
1134
-            if (geodir_is_page('location')) {
1135
-                $page_title = defined('GD_LOCATION') ? GD_LOCATION : __('Location', 'geodirectory');
1136
-            }
1137
-
1138
-            $breadcrumb .= '<li>' . $separator;
1139
-            $breadcrumb .= stripslashes_deep($page_title);
1140
-            $breadcrumb .= '</li>';
1141
-        } else if (is_tag()) {
1142
-            $breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1143
-        } else if (is_day()) {
1144
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1145
-            the_time('F jS, Y');
1146
-            $breadcrumb .= '</li>';
1147
-        } else if (is_month()) {
1148
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1149
-            the_time('F, Y');
1150
-            $breadcrumb .= '</li>';
1151
-        } else if (is_year()) {
1152
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1153
-            the_time('Y');
1154
-            $breadcrumb .= '</li>';
1155
-        } else if (is_author()) {
1156
-            $breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory');
1157
-            $breadcrumb .= '</li>';
1158
-        } else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1159
-            $breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory');
1160
-            $breadcrumb .= '</li>';
1161
-        } else if (is_search()) {
1162
-            $breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory');
1163
-            $breadcrumb .= '</li>';
1164
-        }
1165
-        $breadcrumb .= '</ul></div>';
1166
-
1167
-        /**
1168
-         * Filter breadcrumb html output.
1169
-         *
1170
-         * @since 1.0.0
1171
-         * @param string $breadcrumb Breadcrumb HTML.
1172
-         * @param string $separator Breadcrumb separator.
1173
-         */
1174
-        echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1175
-    }
1025
+							$breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1026
+						}
1027
+					}
1028
+				}
1029
+			}
1030
+
1031
+			if (!empty($gd_taxonomy)) {
1032
+				$term_index = 1;
1033
+
1034
+				//if(get_option('geodir_add_categories_url'))
1035
+				{
1036
+					if (get_query_var($gd_post_type . '_tags')) {
1037
+						$cat_link = $listing_link . 'tags/';
1038
+					} else
1039
+						$cat_link = $listing_link;
1040
+
1041
+					foreach ($location_terms as $key => $location_term) {
1042
+						if ($location_manager && in_array($key, $hide_url_part)) {
1043
+							continue;
1044
+						}
1045
+
1046
+						if ($location_term != '') {
1047
+							if (get_option('permalink_structure') != '') {
1048
+								$cat_link .= $location_term . '/';
1049
+							}
1050
+						}
1051
+					}
1052
+
1053
+					$term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1054
+					foreach ($term_array as $term) {
1055
+						$term_link_text = preg_replace('/-(\d+)$/', '', $term);
1056
+						$term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1057
+
1058
+						// get term actual name
1059
+						$term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1060
+						if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1061
+							$term_link_text = urldecode($term_info['name']);
1062
+						} else {
1063
+							$term_link_text = geodir_ucwords(urldecode($term_link_text));
1064
+						}
1065
+
1066
+						if ($term_index == count($term_array) && $is_taxonomy_last)
1067
+							$breadcrumb .= $separator . $term_link_text;
1068
+						else {
1069
+							$cat_link .= $term . '/';
1070
+							$breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1071
+						}
1072
+						$term_index++;
1073
+					}
1074
+				}
1075
+
1076
+
1077
+			}
1078
+
1079
+			if (geodir_is_page('detail'))
1080
+				$breadcrumb .= $separator . get_the_title();
1081
+
1082
+			$breadcrumb .= '</li>';
1083
+
1084
+
1085
+		} elseif (geodir_is_page('author')) {
1086
+			$user_id = get_current_user_id();
1087
+			$author_link = get_author_posts_url($user_id);
1088
+			$default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
1089
+
1090
+			/**
1091
+			 * Filter author page link.
1092
+			 *
1093
+			 * @since 1.0.0
1094
+			 * @param string $default_author_link Default author link.
1095
+			 * @param int $user_id Author ID.
1096
+			 */
1097
+			$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1098
+
1099
+			$breadcrumb .= '<li>';
1100
+			$breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>';
1101
+
1102
+			if (isset($_REQUEST['list'])) {
1103
+				$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false);
1104
+
1105
+				/**
1106
+				 * Filter author page link.
1107
+				 *
1108
+				 * @since 1.0.0
1109
+				 * @param string $author_link Author page link.
1110
+				 * @param int $user_id Author ID.
1111
+				 * @param string $_REQUEST['stype'] Post type.
1112
+				 */
1113
+				$author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1114
+
1115
+				$breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1116
+				$breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1117
+			} else
1118
+				$breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1119
+
1120
+			$breadcrumb .= '</li>';
1121
+		} elseif (is_category() || is_single()) {
1122
+			$category = get_the_category();
1123
+			if (is_category()) {
1124
+				$breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1125
+			}
1126
+			if (is_single()) {
1127
+				$breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>';
1128
+				$breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1129
+			}
1130
+			/* End of my version ##################################################### */
1131
+		} else if (is_page()) {
1132
+			$page_title = get_the_title();
1133
+
1134
+			if (geodir_is_page('location')) {
1135
+				$page_title = defined('GD_LOCATION') ? GD_LOCATION : __('Location', 'geodirectory');
1136
+			}
1137
+
1138
+			$breadcrumb .= '<li>' . $separator;
1139
+			$breadcrumb .= stripslashes_deep($page_title);
1140
+			$breadcrumb .= '</li>';
1141
+		} else if (is_tag()) {
1142
+			$breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1143
+		} else if (is_day()) {
1144
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1145
+			the_time('F jS, Y');
1146
+			$breadcrumb .= '</li>';
1147
+		} else if (is_month()) {
1148
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1149
+			the_time('F, Y');
1150
+			$breadcrumb .= '</li>';
1151
+		} else if (is_year()) {
1152
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1153
+			the_time('Y');
1154
+			$breadcrumb .= '</li>';
1155
+		} else if (is_author()) {
1156
+			$breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory');
1157
+			$breadcrumb .= '</li>';
1158
+		} else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1159
+			$breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory');
1160
+			$breadcrumb .= '</li>';
1161
+		} else if (is_search()) {
1162
+			$breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory');
1163
+			$breadcrumb .= '</li>';
1164
+		}
1165
+		$breadcrumb .= '</ul></div>';
1166
+
1167
+		/**
1168
+		 * Filter breadcrumb html output.
1169
+		 *
1170
+		 * @since 1.0.0
1171
+		 * @param string $breadcrumb Breadcrumb HTML.
1172
+		 * @param string $separator Breadcrumb separator.
1173
+		 */
1174
+		echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1175
+	}
1176 1176
 }
1177 1177
 
1178 1178
 
1179 1179
 add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin
1180 1180
 if (!function_exists('geodir_allow_wpadmin')) {
1181
-    /**
1182
-     * Allow only admins to access wp-admin.
1183
-     *
1184
-     * Normal users will be redirected to home page.
1185
-     *
1186
-     * @since 1.0.0
1187
-     * @package GeoDirectory
1188
-     * @global object $wpdb WordPress Database object.
1189
-     */
1190
-    function geodir_allow_wpadmin()
1191
-    {
1192
-        global $wpdb;
1193
-        if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) // checking action in request to allow ajax request go through
1194
-        {
1195
-            if (current_user_can('manage_options')) {
1196
-            } else {
1197
-
1198
-                wp_redirect(home_url());
1199
-                exit;
1200
-            }
1181
+	/**
1182
+	 * Allow only admins to access wp-admin.
1183
+	 *
1184
+	 * Normal users will be redirected to home page.
1185
+	 *
1186
+	 * @since 1.0.0
1187
+	 * @package GeoDirectory
1188
+	 * @global object $wpdb WordPress Database object.
1189
+	 */
1190
+	function geodir_allow_wpadmin()
1191
+	{
1192
+		global $wpdb;
1193
+		if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) // checking action in request to allow ajax request go through
1194
+		{
1195
+			if (current_user_can('manage_options')) {
1196
+			} else {
1197
+
1198
+				wp_redirect(home_url());
1199
+				exit;
1200
+			}
1201 1201
 
1202
-        }
1203
-    }
1202
+		}
1203
+	}
1204 1204
 }
1205 1205
 
1206 1206
 
@@ -1214,50 +1214,50 @@  discard block
 block discarded – undo
1214 1214
  */
1215 1215
 function fetch_remote_file($url)
1216 1216
 {
1217
-    // extract the file name and extension from the url
1218
-    require_once(ABSPATH . 'wp-includes/pluggable.php');
1219
-    $file_name = basename($url);
1220
-    if (strpos($file_name, '?') !== false) {
1221
-        list($file_name) = explode('?', $file_name);
1222
-    }
1223
-
1224
-
1225
-    // get placeholder file in the upload dir with a unique, sanitized filename
1226
-
1227
-    $post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1228
-
1229
-    $upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1230
-    if ($upload['error'])
1231
-        return new WP_Error('upload_dir_error', $upload['error']);
1232
-
1233
-    // fetch the remote url and write it to the placeholder file
1234
-    $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1235
-
1236
-    $log_message = '';
1237
-    $filesize = filesize($upload['file']);
1238
-    // request failed
1239
-    if (!$headers) {
1240
-        $log_message = __('Remote server did not respond', 'geodirectory');
1241
-    }
1242
-    // make sure the fetch was successful
1243
-    elseif ($headers['response']['code'] != '200') {
1244
-        $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1245
-    }
1246
-    elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1247
-        $log_message =  __('Remote file is incorrect size', 'geodirectory');
1248
-    }
1249
-    elseif (0 == $filesize) {
1250
-        $log_message = __('Zero size file downloaded', 'geodirectory');
1251
-    }
1252
-
1253
-    if($log_message){
1254
-        $del = unlink($upload['file']);
1255
-        if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1256
-        return new WP_Error('import_file_error',$log_message );
1257
-    }
1258
-
1259
-
1260
-    return $upload;
1217
+	// extract the file name and extension from the url
1218
+	require_once(ABSPATH . 'wp-includes/pluggable.php');
1219
+	$file_name = basename($url);
1220
+	if (strpos($file_name, '?') !== false) {
1221
+		list($file_name) = explode('?', $file_name);
1222
+	}
1223
+
1224
+
1225
+	// get placeholder file in the upload dir with a unique, sanitized filename
1226
+
1227
+	$post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1228
+
1229
+	$upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1230
+	if ($upload['error'])
1231
+		return new WP_Error('upload_dir_error', $upload['error']);
1232
+
1233
+	// fetch the remote url and write it to the placeholder file
1234
+	$headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1235
+
1236
+	$log_message = '';
1237
+	$filesize = filesize($upload['file']);
1238
+	// request failed
1239
+	if (!$headers) {
1240
+		$log_message = __('Remote server did not respond', 'geodirectory');
1241
+	}
1242
+	// make sure the fetch was successful
1243
+	elseif ($headers['response']['code'] != '200') {
1244
+		$log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1245
+	}
1246
+	elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1247
+		$log_message =  __('Remote file is incorrect size', 'geodirectory');
1248
+	}
1249
+	elseif (0 == $filesize) {
1250
+		$log_message = __('Zero size file downloaded', 'geodirectory');
1251
+	}
1252
+
1253
+	if($log_message){
1254
+		$del = unlink($upload['file']);
1255
+		if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1256
+		return new WP_Error('import_file_error',$log_message );
1257
+	}
1258
+
1259
+
1260
+	return $upload;
1261 1261
 }
1262 1262
 
1263 1263
 /**
@@ -1269,21 +1269,21 @@  discard block
 block discarded – undo
1269 1269
  */
1270 1270
 function geodir_max_upload_size()
1271 1271
 {
1272
-    $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1273
-
1274
-    if ($max_filesize > 0 && $max_filesize < 1) {
1275
-        $max_filesize = (int)($max_filesize * 1024) . 'kb';
1276
-    } else {
1277
-        $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1278
-    }
1279
-
1280
-    /**
1281
-     * Filter default image upload size limit.
1282
-     *
1283
-     * @since 1.0.0
1284
-     * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1285
-     */
1286
-    return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1272
+	$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1273
+
1274
+	if ($max_filesize > 0 && $max_filesize < 1) {
1275
+		$max_filesize = (int)($max_filesize * 1024) . 'kb';
1276
+	} else {
1277
+		$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1278
+	}
1279
+
1280
+	/**
1281
+	 * Filter default image upload size limit.
1282
+	 *
1283
+	 * @since 1.0.0
1284
+	 * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1285
+	 */
1286
+	return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1287 1287
 }
1288 1288
 
1289 1289
 /**
@@ -1297,11 +1297,11 @@  discard block
 block discarded – undo
1297 1297
  */
1298 1298
 function geodir_dummy_folder_exists()
1299 1299
 {
1300
-    $path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1301
-    if (!is_dir($path))
1302
-        return false;
1303
-    else
1304
-        return true;
1300
+	$path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1301
+	if (!is_dir($path))
1302
+		return false;
1303
+	else
1304
+		return true;
1305 1305
 
1306 1306
 }
1307 1307
 
@@ -1316,237 +1316,237 @@  discard block
 block discarded – undo
1316 1316
  */
1317 1317
 function  geodir_get_author_info($aid)
1318 1318
 {
1319
-    global $wpdb;
1320
-    /*$infosql = "select * from $wpdb->users where ID=$aid";*/
1321
-    $infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1322
-    $info = $wpdb->get_results($infosql);
1323
-    if ($info) {
1324
-        return $info[0];
1325
-    }
1319
+	global $wpdb;
1320
+	/*$infosql = "select * from $wpdb->users where ID=$aid";*/
1321
+	$infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1322
+	$info = $wpdb->get_results($infosql);
1323
+	if ($info) {
1324
+		return $info[0];
1325
+	}
1326 1326
 }
1327 1327
 
1328 1328
 if (!function_exists('adminEmail')) {
1329
-    /**
1330
-     * Send emails to client on post submission, renew etc.
1331
-     *
1332
-     * @since 1.0.0
1333
-     * @package GeoDirectory
1334
-     * @global object $wpdb WordPress Database object.
1335
-     * @param int|string $page_id Page ID.
1336
-     * @param int|string $user_id User ID.
1337
-     * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1338
-     * @param string $custom_1 Custom data to be sent.
1339
-     */
1340
-    function adminEmail($page_id, $user_id, $message_type, $custom_1 = '')
1341
-    {
1342
-        global $wpdb;
1343
-        if ($message_type == 'expiration') {
1344
-            $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1345
-            $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1346
-        } elseif ($message_type == 'post_submited') {
1347
-            $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1348
-            $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1349
-        } elseif ($message_type == 'renew') {
1350
-            $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1351
-            $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1352
-        } elseif ($message_type == 'upgrade') {
1353
-            $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1354
-            $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1355
-        } elseif ($message_type == 'claim_approved') {
1356
-            $subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1357
-            $client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1358
-        } elseif ($message_type == 'claim_rejected') {
1359
-            $subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1360
-            $client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1361
-        } elseif ($message_type == 'claim_requested') {
1362
-            $subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1363
-            $client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1364
-        } elseif ($message_type == 'auto_claim') {
1365
-            $subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1366
-            $client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1367
-        } elseif ($message_type == 'payment_success') {
1368
-            $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1369
-            $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1370
-        } elseif ($message_type == 'payment_fail') {
1371
-            $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1372
-            $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1373
-        }
1374
-        $transaction_details = $custom_1;
1375
-        $fromEmail = get_option('site_email');
1376
-        $fromEmailName = get_site_emailName();
1329
+	/**
1330
+	 * Send emails to client on post submission, renew etc.
1331
+	 *
1332
+	 * @since 1.0.0
1333
+	 * @package GeoDirectory
1334
+	 * @global object $wpdb WordPress Database object.
1335
+	 * @param int|string $page_id Page ID.
1336
+	 * @param int|string $user_id User ID.
1337
+	 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1338
+	 * @param string $custom_1 Custom data to be sent.
1339
+	 */
1340
+	function adminEmail($page_id, $user_id, $message_type, $custom_1 = '')
1341
+	{
1342
+		global $wpdb;
1343
+		if ($message_type == 'expiration') {
1344
+			$subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1345
+			$client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1346
+		} elseif ($message_type == 'post_submited') {
1347
+			$subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1348
+			$client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1349
+		} elseif ($message_type == 'renew') {
1350
+			$subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1351
+			$client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1352
+		} elseif ($message_type == 'upgrade') {
1353
+			$subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1354
+			$client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1355
+		} elseif ($message_type == 'claim_approved') {
1356
+			$subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1357
+			$client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1358
+		} elseif ($message_type == 'claim_rejected') {
1359
+			$subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1360
+			$client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1361
+		} elseif ($message_type == 'claim_requested') {
1362
+			$subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1363
+			$client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1364
+		} elseif ($message_type == 'auto_claim') {
1365
+			$subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1366
+			$client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1367
+		} elseif ($message_type == 'payment_success') {
1368
+			$subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1369
+			$client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1370
+		} elseif ($message_type == 'payment_fail') {
1371
+			$subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1372
+			$client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1373
+		}
1374
+		$transaction_details = $custom_1;
1375
+		$fromEmail = get_option('site_email');
1376
+		$fromEmailName = get_site_emailName();
1377 1377
 //$alivedays = get_post_meta($page_id,'alive_days',true);
1378
-        $pkg_limit = get_property_price_info_listing($page_id);
1379
-        $alivedays = $pkg_limit['days'];
1380
-        $productlink = get_permalink($page_id);
1381
-        $post_info = get_post($page_id);
1382
-        $post_date = date('dS F,Y', strtotime($post_info->post_date));
1383
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1384
-        $loginurl = geodir_login_url();
1385
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1386
-        $siteurl = home_url();
1387
-        $siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1388
-        $user_info = get_userdata($user_id);
1389
-        $user_email = $user_info->user_email;
1390
-        $display_name = geodir_get_client_name($user_id);
1391
-        $user_login = $user_info->user_login;
1392
-        $number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1393
-        if ($number_of_grace_days == '') {
1394
-            $number_of_grace_days = 1;
1395
-        }
1396
-        if ($post_info->post_type == 'event') {
1397
-            $post_type = 'event';
1398
-        } else {
1399
-            $post_type = 'listing';
1400
-        }
1401
-        $renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1402
-        $search_array = array('[#client_name#]', '[#listing_link#]', '[#posted_date#]', '[#number_of_days#]', '[#number_of_grace_days#]', '[#login_url#]', '[#username#]', '[#user_email#]', '[#site_name_url#]', '[#renew_link#]', '[#post_id#]', '[#site_name#]', '[#transaction_details#]');
1403
-        $replace_array = array($display_name, $listingLink, $post_date, $alivedays, $number_of_grace_days, $loginurl_link, $user_login, $user_email, $siteurl_link, $renew_link, $page_id, $fromEmailName, $transaction_details);
1404
-        $client_message = str_replace($search_array, $replace_array, $client_message);
1405
-        $subject = str_replace($search_array, $replace_array, $subject);
1406
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1407
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1408
-        $headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1409
-
1410
-        $to = $fromEmail;
1411
-        $message = $client_message;
1412
-        $sent = wp_mail($to, $subject, $message, $headers);
1413
-        if( ! $sent ) {
1414
-            if ( is_array( $to ) ) {
1415
-                $to = implode( ',', $to );
1416
-            }
1417
-            $log_message = sprintf(
1418
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1419
-                $message_type,
1420
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1421
-                $to,
1422
-                $subject
1423
-            );
1424
-            geodir_error_log( $log_message );
1425
-        }
1426
-    }
1378
+		$pkg_limit = get_property_price_info_listing($page_id);
1379
+		$alivedays = $pkg_limit['days'];
1380
+		$productlink = get_permalink($page_id);
1381
+		$post_info = get_post($page_id);
1382
+		$post_date = date('dS F,Y', strtotime($post_info->post_date));
1383
+		$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1384
+		$loginurl = geodir_login_url();
1385
+		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
1386
+		$siteurl = home_url();
1387
+		$siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1388
+		$user_info = get_userdata($user_id);
1389
+		$user_email = $user_info->user_email;
1390
+		$display_name = geodir_get_client_name($user_id);
1391
+		$user_login = $user_info->user_login;
1392
+		$number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1393
+		if ($number_of_grace_days == '') {
1394
+			$number_of_grace_days = 1;
1395
+		}
1396
+		if ($post_info->post_type == 'event') {
1397
+			$post_type = 'event';
1398
+		} else {
1399
+			$post_type = 'listing';
1400
+		}
1401
+		$renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1402
+		$search_array = array('[#client_name#]', '[#listing_link#]', '[#posted_date#]', '[#number_of_days#]', '[#number_of_grace_days#]', '[#login_url#]', '[#username#]', '[#user_email#]', '[#site_name_url#]', '[#renew_link#]', '[#post_id#]', '[#site_name#]', '[#transaction_details#]');
1403
+		$replace_array = array($display_name, $listingLink, $post_date, $alivedays, $number_of_grace_days, $loginurl_link, $user_login, $user_email, $siteurl_link, $renew_link, $page_id, $fromEmailName, $transaction_details);
1404
+		$client_message = str_replace($search_array, $replace_array, $client_message);
1405
+		$subject = str_replace($search_array, $replace_array, $subject);
1406
+		$headers = 'MIME-Version: 1.0' . "\r\n";
1407
+		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1408
+		$headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1409
+
1410
+		$to = $fromEmail;
1411
+		$message = $client_message;
1412
+		$sent = wp_mail($to, $subject, $message, $headers);
1413
+		if( ! $sent ) {
1414
+			if ( is_array( $to ) ) {
1415
+				$to = implode( ',', $to );
1416
+			}
1417
+			$log_message = sprintf(
1418
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1419
+				$message_type,
1420
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1421
+				$to,
1422
+				$subject
1423
+			);
1424
+			geodir_error_log( $log_message );
1425
+		}
1426
+	}
1427 1427
 }
1428 1428
 
1429 1429
 if (!function_exists('sendEmail')) {
1430
-    /**
1431
-     * @todo could be a duplicate of geodir_sendEmail.
1432
-     *
1433
-     * @since 1.0.0
1434
-     * @package GeoDirectory
1435
-     * @param string $fromEmail Sender email address.
1436
-     * @param string $fromEmailName Sender name.
1437
-     * @param string $toEmail Receiver email address.
1438
-     * @param string $toEmailName Receiver name.
1439
-     * @param string $to_subject Email subject.
1440
-     * @param string $to_message Email content.
1441
-     * @param string $extra Not being used.
1442
-     * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration.
1443
-     * @param string $post_id The post ID.
1444
-     * @param string $user_id The user ID.
1445
-     */
1446
-    function sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '')
1447
-    {
1448
-        $login_details = '';
1449
-        if ($message_type == 'send_friend') {
1450
-            $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1451
-            $message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1452
-        } elseif ($message_type == 'send_enquiry') {
1453
-            $subject = __(get_option('email_enquiry_subject'),'geodirectory');
1454
-            $message = __(get_option('email_enquiry_content'),'geodirectory');
1455
-        } elseif ($message_type == 'forgot_password') {
1456
-            $subject = __(get_option('forgot_password_subject'),'geodirectory');
1457
-            $message = __(get_option('forgot_password_content'),'geodirectory');
1458
-            $login_details = $to_message;
1459
-        } elseif ($message_type == 'registration') {
1460
-            $subject = __(get_option('registration_success_email_subject'),'geodirectory');
1461
-            $message = __(get_option('registration_success_email_content'),'geodirectory');
1462
-            $login_details = $to_message;
1463
-        }
1464
-        $to_message = nl2br($to_message);
1465
-        $sitefromEmail = get_option('site_email');
1466
-        $sitefromEmailName = get_site_emailName();
1467
-        $productlink = get_permalink($post_id);
1468
-        $post_info = get_post($post_id);
1469
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1470
-        $siteurl = home_url();
1471
-        $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1472
-        $loginurl = geodir_login_url();
1473
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1474
-        if ($fromEmail == '') {
1475
-            $fromEmail = get_option('site_email');
1476
-        }
1477
-        if ($fromEmailName == '') {
1478
-            $fromEmailName = get_option('site_email_name');
1479
-        }
1480
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]');
1481
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName);
1482
-        $message = str_replace($search_array, $replace_array, $message);
1483
-
1484
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]');
1485
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName);
1486
-        $subject = str_replace($search_array, $replace_array, $subject);
1487
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1488
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1489
-        $headers .= "Reply-To: " . $fromEmail . "\r\n";
1490
-        $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1491
-
1492
-        $to = $toEmail;
1493
-
1494
-        $sent = wp_mail($to, $subject, $message, $headers);
1495
-        if( ! $sent ) {
1496
-            if ( is_array( $to ) ) {
1497
-                $to = implode( ',', $to );
1498
-            }
1499
-            $log_message = sprintf(
1500
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1501
-                $message_type,
1502
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1503
-                $to,
1504
-                $subject
1505
-            );
1506
-            geodir_error_log( $log_message );
1507
-        }
1430
+	/**
1431
+	 * @todo could be a duplicate of geodir_sendEmail.
1432
+	 *
1433
+	 * @since 1.0.0
1434
+	 * @package GeoDirectory
1435
+	 * @param string $fromEmail Sender email address.
1436
+	 * @param string $fromEmailName Sender name.
1437
+	 * @param string $toEmail Receiver email address.
1438
+	 * @param string $toEmailName Receiver name.
1439
+	 * @param string $to_subject Email subject.
1440
+	 * @param string $to_message Email content.
1441
+	 * @param string $extra Not being used.
1442
+	 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration.
1443
+	 * @param string $post_id The post ID.
1444
+	 * @param string $user_id The user ID.
1445
+	 */
1446
+	function sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '')
1447
+	{
1448
+		$login_details = '';
1449
+		if ($message_type == 'send_friend') {
1450
+			$subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1451
+			$message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1452
+		} elseif ($message_type == 'send_enquiry') {
1453
+			$subject = __(get_option('email_enquiry_subject'),'geodirectory');
1454
+			$message = __(get_option('email_enquiry_content'),'geodirectory');
1455
+		} elseif ($message_type == 'forgot_password') {
1456
+			$subject = __(get_option('forgot_password_subject'),'geodirectory');
1457
+			$message = __(get_option('forgot_password_content'),'geodirectory');
1458
+			$login_details = $to_message;
1459
+		} elseif ($message_type == 'registration') {
1460
+			$subject = __(get_option('registration_success_email_subject'),'geodirectory');
1461
+			$message = __(get_option('registration_success_email_content'),'geodirectory');
1462
+			$login_details = $to_message;
1463
+		}
1464
+		$to_message = nl2br($to_message);
1465
+		$sitefromEmail = get_option('site_email');
1466
+		$sitefromEmailName = get_site_emailName();
1467
+		$productlink = get_permalink($post_id);
1468
+		$post_info = get_post($post_id);
1469
+		$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1470
+		$siteurl = home_url();
1471
+		$siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1472
+		$loginurl = geodir_login_url();
1473
+		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
1474
+		if ($fromEmail == '') {
1475
+			$fromEmail = get_option('site_email');
1476
+		}
1477
+		if ($fromEmailName == '') {
1478
+			$fromEmailName = get_option('site_email_name');
1479
+		}
1480
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]');
1481
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName);
1482
+		$message = str_replace($search_array, $replace_array, $message);
1483
+
1484
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]');
1485
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName);
1486
+		$subject = str_replace($search_array, $replace_array, $subject);
1487
+		$headers = 'MIME-Version: 1.0' . "\r\n";
1488
+		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1489
+		$headers .= "Reply-To: " . $fromEmail . "\r\n";
1490
+		$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1491
+
1492
+		$to = $toEmail;
1493
+
1494
+		$sent = wp_mail($to, $subject, $message, $headers);
1495
+		if( ! $sent ) {
1496
+			if ( is_array( $to ) ) {
1497
+				$to = implode( ',', $to );
1498
+			}
1499
+			$log_message = sprintf(
1500
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1501
+				$message_type,
1502
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1503
+				$to,
1504
+				$subject
1505
+			);
1506
+			geodir_error_log( $log_message );
1507
+		}
1508 1508
 
1509
-        ///////// ADMIN BCC EMIALS
1510
-        $admin_bcc = false;
1511
-        if ($message_type == 'registration') {
1512
-            $message_raw = explode(__("Password:", 'geodirectory'), $message);
1513
-            $message_raw2 = explode("</p>", $message_raw[1], 2);
1514
-            $message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1];
1515
-        }
1516
-        $adminEmail = get_bloginfo('admin_email');
1517
-        $to = $adminEmail;
1509
+		///////// ADMIN BCC EMIALS
1510
+		$admin_bcc = false;
1511
+		if ($message_type == 'registration') {
1512
+			$message_raw = explode(__("Password:", 'geodirectory'), $message);
1513
+			$message_raw2 = explode("</p>", $message_raw[1], 2);
1514
+			$message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1];
1515
+		}
1516
+		$adminEmail = get_bloginfo('admin_email');
1517
+		$to = $adminEmail;
1518 1518
 
1519
-        if ($message_type == 'registration' && get_option('bcc_new_user')) {
1520
-            $subject .= ' - ADMIN BCC COPY';
1521
-            $admin_bcc = true;
1522
-        }
1523
-        elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1524
-            $subject .= ' - ADMIN BCC COPY';
1525
-            $admin_bcc = true;
1526
-        }
1527
-        elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1528
-            $subject .= ' - ADMIN BCC COPY';
1529
-            $admin_bcc = true;
1530
-        }
1519
+		if ($message_type == 'registration' && get_option('bcc_new_user')) {
1520
+			$subject .= ' - ADMIN BCC COPY';
1521
+			$admin_bcc = true;
1522
+		}
1523
+		elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1524
+			$subject .= ' - ADMIN BCC COPY';
1525
+			$admin_bcc = true;
1526
+		}
1527
+		elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1528
+			$subject .= ' - ADMIN BCC COPY';
1529
+			$admin_bcc = true;
1530
+		}
1531 1531
 
1532
-        if($admin_bcc === true){
1533
-            $sent = wp_mail($to, $subject, $message, $headers);
1534
-            if( ! $sent ) {
1535
-                if ( is_array( $to ) ) {
1536
-                    $to = implode( ',', $to );
1537
-                }
1538
-                $log_message = sprintf(
1539
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1540
-                    $message_type,
1541
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1542
-                    $to,
1543
-                    $subject
1544
-                );
1545
-                geodir_error_log( $log_message );
1546
-            }
1547
-        }
1532
+		if($admin_bcc === true){
1533
+			$sent = wp_mail($to, $subject, $message, $headers);
1534
+			if( ! $sent ) {
1535
+				if ( is_array( $to ) ) {
1536
+					$to = implode( ',', $to );
1537
+				}
1538
+				$log_message = sprintf(
1539
+					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1540
+					$message_type,
1541
+					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1542
+					$to,
1543
+					$subject
1544
+				);
1545
+				geodir_error_log( $log_message );
1546
+			}
1547
+		}
1548 1548
 
1549
-    }
1549
+	}
1550 1550
 }
1551 1551
 
1552 1552
 /*
@@ -1564,16 +1564,16 @@  discard block
 block discarded – undo
1564 1564
  */
1565 1565
 function gd_lang_object_ids($ids_array, $type)
1566 1566
 {
1567
-    if (function_exists('icl_object_id')) {
1568
-        $res = array();
1569
-        foreach ($ids_array as $id) {
1570
-            $xlat = icl_object_id($id, $type, false);
1571
-            if (!is_null($xlat)) $res[] = $xlat;
1572
-        }
1573
-        return $res;
1574
-    } else {
1575
-        return $ids_array;
1576
-    }
1567
+	if (function_exists('icl_object_id')) {
1568
+		$res = array();
1569
+		foreach ($ids_array as $id) {
1570
+			$xlat = icl_object_id($id, $type, false);
1571
+			if (!is_null($xlat)) $res[] = $xlat;
1572
+		}
1573
+		return $res;
1574
+	} else {
1575
+		return $ids_array;
1576
+	}
1577 1577
 }
1578 1578
 
1579 1579
 
@@ -1588,31 +1588,31 @@  discard block
 block discarded – undo
1588 1588
  * @return array Modified Body CSS classes.
1589 1589
  */
1590 1590
 function geodir_custom_posts_body_class($classes) {
1591
-    global $wpdb, $wp;
1592
-    $post_types = geodir_get_posttypes('object');
1593
-    if (!empty($post_types) && count((array)$post_types) > 1) {
1594
-        $classes[] = 'geodir_custom_posts';
1595
-    }
1596
-
1597
-    // fix body class for signup page
1598
-    if (geodir_is_page('login')) {
1599
-        $new_classes = array();
1600
-        $new_classes[] = 'signup page-geodir-signup';
1601
-        if (!empty($classes)) {
1602
-            foreach ($classes as $class) {
1603
-                if ($class && $class != 'home' && $class != 'blog') {
1604
-                    $new_classes[] = $class;
1605
-                }
1606
-            }
1607
-        }
1608
-        $classes = $new_classes;
1609
-    }
1591
+	global $wpdb, $wp;
1592
+	$post_types = geodir_get_posttypes('object');
1593
+	if (!empty($post_types) && count((array)$post_types) > 1) {
1594
+		$classes[] = 'geodir_custom_posts';
1595
+	}
1596
+
1597
+	// fix body class for signup page
1598
+	if (geodir_is_page('login')) {
1599
+		$new_classes = array();
1600
+		$new_classes[] = 'signup page-geodir-signup';
1601
+		if (!empty($classes)) {
1602
+			foreach ($classes as $class) {
1603
+				if ($class && $class != 'home' && $class != 'blog') {
1604
+					$new_classes[] = $class;
1605
+				}
1606
+			}
1607
+		}
1608
+		$classes = $new_classes;
1609
+	}
1610 1610
 
1611
-    if (geodir_is_geodir_page()) {
1612
-        $classes[] = 'geodir-page';
1613
-    }
1611
+	if (geodir_is_geodir_page()) {
1612
+		$classes[] = 'geodir-page';
1613
+	}
1614 1614
 
1615
-    return $classes;
1615
+	return $classes;
1616 1616
 }
1617 1617
 
1618 1618
 add_filter('body_class', 'geodir_custom_posts_body_class'); // let's add a class to the body so we can style the new addition to the search
@@ -1627,12 +1627,12 @@  discard block
 block discarded – undo
1627 1627
  */
1628 1628
 function geodir_map_zoom_level()
1629 1629
 {
1630
-    /**
1631
-     * Filter GD map zoom level.
1632
-     *
1633
-     * @since 1.0.0
1634
-     */
1635
-    return apply_filters('geodir_map_zoom_level', array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19));
1630
+	/**
1631
+	 * Filter GD map zoom level.
1632
+	 *
1633
+	 * @since 1.0.0
1634
+	 */
1635
+	return apply_filters('geodir_map_zoom_level', array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19));
1636 1636
 
1637 1637
 }
1638 1638
 
@@ -1646,12 +1646,12 @@  discard block
 block discarded – undo
1646 1646
  */
1647 1647
 function geodir_option_version_backup($geodir_option_name)
1648 1648
 {
1649
-    $version_date = time();
1650
-    $geodir_option = get_option($geodir_option_name);
1649
+	$version_date = time();
1650
+	$geodir_option = get_option($geodir_option_name);
1651 1651
 
1652
-    if (!empty($geodir_option)) {
1653
-        add_option($geodir_option_name . '_' . $version_date, $geodir_option);
1654
-    }
1652
+	if (!empty($geodir_option)) {
1653
+		add_option($geodir_option_name . '_' . $version_date, $geodir_option);
1654
+	}
1655 1655
 }
1656 1656
 
1657 1657
 /**
@@ -1664,11 +1664,11 @@  discard block
 block discarded – undo
1664 1664
  */
1665 1665
 function get_page_id_geodir_add_listing_page($page_id)
1666 1666
 {
1667
-    if (geodir_wpml_multilingual_status()) {
1668
-        $post_type = 'post_page';
1669
-        $page_id = geodir_get_wpml_element_id($page_id, $post_type);
1670
-    }
1671
-    return $page_id;
1667
+	if (geodir_wpml_multilingual_status()) {
1668
+		$post_type = 'post_page';
1669
+		$page_id = geodir_get_wpml_element_id($page_id, $post_type);
1670
+	}
1671
+	return $page_id;
1672 1672
 }
1673 1673
 
1674 1674
 /**
@@ -1680,10 +1680,10 @@  discard block
 block discarded – undo
1680 1680
  */
1681 1681
 function geodir_wpml_multilingual_status()
1682 1682
 {
1683
-    if (function_exists('icl_object_id')) {
1684
-        return true;
1685
-    }
1686
-    return false;
1683
+	if (function_exists('icl_object_id')) {
1684
+		return true;
1685
+	}
1686
+	return false;
1687 1687
 }
1688 1688
 
1689 1689
 /**
@@ -1697,22 +1697,22 @@  discard block
 block discarded – undo
1697 1697
  */
1698 1698
 function geodir_get_wpml_element_id($page_id, $post_type)
1699 1699
 {
1700
-    global $sitepress;
1701
-    if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1702
-        $trid = $sitepress->get_element_trid($page_id, $post_type);
1700
+	global $sitepress;
1701
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1702
+		$trid = $sitepress->get_element_trid($page_id, $post_type);
1703 1703
 
1704
-        if ($trid > 0) {
1705
-            $translations = $sitepress->get_element_translations($trid, $post_type);
1704
+		if ($trid > 0) {
1705
+			$translations = $sitepress->get_element_translations($trid, $post_type);
1706 1706
 
1707
-            $lang = $sitepress->get_current_language();
1708
-            $lang = $lang ? $lang : $sitepress->get_default_language();
1707
+			$lang = $sitepress->get_current_language();
1708
+			$lang = $lang ? $lang : $sitepress->get_default_language();
1709 1709
 
1710
-            if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
1711
-                $page_id = $translations[$lang]->element_id;
1712
-            }
1713
-        }
1714
-    }
1715
-    return $page_id;
1710
+			if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
1711
+				$page_id = $translations[$lang]->element_id;
1712
+			}
1713
+		}
1714
+	}
1715
+	return $page_id;
1716 1716
 }
1717 1717
 
1718 1718
 /**
@@ -1724,20 +1724,20 @@  discard block
 block discarded – undo
1724 1724
  */
1725 1725
 function geodir_wpml_check_element_id()
1726 1726
 {
1727
-    global $sitepress;
1728
-    if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1729
-        $el_type = 'post_page';
1730
-        $el_id = get_option('geodir_add_listing_page');
1731
-        $default_lang = $sitepress->get_default_language();
1732
-        $el_details = $sitepress->get_element_language_details($el_id, $el_type);
1733
-
1734
-        if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
1735
-            if (!$el_details->source_language_code) {
1736
-                $sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
1737
-                $sitepress->icl_translations_cache->clear();
1738
-            }
1739
-        }
1740
-    }
1727
+	global $sitepress;
1728
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1729
+		$el_type = 'post_page';
1730
+		$el_id = get_option('geodir_add_listing_page');
1731
+		$default_lang = $sitepress->get_default_language();
1732
+		$el_details = $sitepress->get_element_language_details($el_id, $el_type);
1733
+
1734
+		if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
1735
+			if (!$el_details->source_language_code) {
1736
+				$sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
1737
+				$sitepress->icl_translations_cache->clear();
1738
+			}
1739
+		}
1740
+	}
1741 1741
 }
1742 1742
 
1743 1743
 /**
@@ -1752,44 +1752,44 @@  discard block
 block discarded – undo
1752 1752
  */
1753 1753
 function geodir_widget_listings_get_order($query_args)
1754 1754
 {
1755
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1756
-
1757
-    $query_args = $gd_query_args_widgets;
1758
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1759
-        return $wpdb->posts . ".post_date DESC, ";
1760
-    }
1761
-
1762
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1763
-    $table = $plugin_prefix . $post_type . '_detail';
1764
-
1765
-    $sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
1766
-
1767
-    switch ($sort_by) {
1768
-        case 'latest':
1769
-        case 'newest':
1770
-            $orderby = $wpdb->posts . ".post_date DESC, ";
1771
-            break;
1772
-        case 'featured':
1773
-            $orderby = $table . ".is_featured ASC, ";
1774
-            break;
1775
-        case 'az':
1776
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1777
-            break;
1778
-        case 'high_review':
1779
-            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
1780
-            break;
1781
-        case 'high_rating':
1782
-            $orderby = "( " . $table . ".overall_rating  ) DESC, ";
1783
-            break;
1784
-        case 'random':
1785
-            $orderby = "RAND(), ";
1786
-            break;
1787
-        default:
1788
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1789
-            break;
1790
-    }
1791
-
1792
-    return $orderby;
1755
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1756
+
1757
+	$query_args = $gd_query_args_widgets;
1758
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1759
+		return $wpdb->posts . ".post_date DESC, ";
1760
+	}
1761
+
1762
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1763
+	$table = $plugin_prefix . $post_type . '_detail';
1764
+
1765
+	$sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
1766
+
1767
+	switch ($sort_by) {
1768
+		case 'latest':
1769
+		case 'newest':
1770
+			$orderby = $wpdb->posts . ".post_date DESC, ";
1771
+			break;
1772
+		case 'featured':
1773
+			$orderby = $table . ".is_featured ASC, ";
1774
+			break;
1775
+		case 'az':
1776
+			$orderby = $wpdb->posts . ".post_title ASC, ";
1777
+			break;
1778
+		case 'high_review':
1779
+			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
1780
+			break;
1781
+		case 'high_rating':
1782
+			$orderby = "( " . $table . ".overall_rating  ) DESC, ";
1783
+			break;
1784
+		case 'random':
1785
+			$orderby = "RAND(), ";
1786
+			break;
1787
+		default:
1788
+			$orderby = $wpdb->posts . ".post_title ASC, ";
1789
+			break;
1790
+	}
1791
+
1792
+	return $orderby;
1793 1793
 }
1794 1794
 
1795 1795
 /**
@@ -1807,127 +1807,127 @@  discard block
 block discarded – undo
1807 1807
  */
1808 1808
 function geodir_get_widget_listings($query_args = array(), $count_only = false)
1809 1809
 {
1810
-    global $wpdb, $plugin_prefix, $table_prefix;
1811
-    $GLOBALS['gd_query_args_widgets'] = $query_args;
1812
-    $gd_query_args_widgets = $query_args;
1813
-
1814
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1815
-    $table = $plugin_prefix . $post_type . '_detail';
1816
-
1817
-    $fields = $wpdb->posts . ".*, " . $table . ".*";
1818
-    /**
1819
-     * Filter widget listing fields string part that is being used for query.
1820
-     *
1821
-     * @since 1.0.0
1822
-     * @param string $fields Fields string.
1823
-     * @param string $table Table name.
1824
-     * @param string $post_type Post type.
1825
-     */
1826
-    $fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
1827
-
1828
-    $join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
1829
-
1830
-    ########### WPML ###########
1831
-
1832
-    if (function_exists('icl_object_id')) {
1833
-        global $sitepress;
1834
-        $lang_code = ICL_LANGUAGE_CODE;
1835
-        $default_lang_code = $sitepress->get_default_language();
1836
-        if ($lang_code) {
1837
-            $join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
1838
-        }
1839
-    }
1840
-
1841
-    ########### WPML ###########
1810
+	global $wpdb, $plugin_prefix, $table_prefix;
1811
+	$GLOBALS['gd_query_args_widgets'] = $query_args;
1812
+	$gd_query_args_widgets = $query_args;
1813
+
1814
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1815
+	$table = $plugin_prefix . $post_type . '_detail';
1816
+
1817
+	$fields = $wpdb->posts . ".*, " . $table . ".*";
1818
+	/**
1819
+	 * Filter widget listing fields string part that is being used for query.
1820
+	 *
1821
+	 * @since 1.0.0
1822
+	 * @param string $fields Fields string.
1823
+	 * @param string $table Table name.
1824
+	 * @param string $post_type Post type.
1825
+	 */
1826
+	$fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
1827
+
1828
+	$join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
1829
+
1830
+	########### WPML ###########
1831
+
1832
+	if (function_exists('icl_object_id')) {
1833
+		global $sitepress;
1834
+		$lang_code = ICL_LANGUAGE_CODE;
1835
+		$default_lang_code = $sitepress->get_default_language();
1836
+		if ($lang_code) {
1837
+			$join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
1838
+		}
1839
+	}
1842 1840
 
1843
-    /**
1844
-     * Filter widget listing join clause string part that is being used for query.
1845
-     *
1846
-     * @since 1.0.0
1847
-     * @param string $join Join clause string.
1848
-     * @param string $post_type Post type.
1849
-     */
1850
-    $join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
1841
+	########### WPML ###########
1851 1842
 
1852
-    $post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
1843
+	/**
1844
+	 * Filter widget listing join clause string part that is being used for query.
1845
+	 *
1846
+	 * @since 1.0.0
1847
+	 * @param string $join Join clause string.
1848
+	 * @param string $post_type Post type.
1849
+	 */
1850
+	$join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
1853 1851
 
1854
-    $where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
1852
+	$post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
1855 1853
 
1856
-    ########### WPML ###########
1857
-    if (function_exists('icl_object_id')) {
1858
-        if ($lang_code) {
1859
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
1860
-        }
1861
-    }
1862
-    ########### WPML ###########
1863
-    /**
1864
-     * Filter widget listing where clause string part that is being used for query.
1865
-     *
1866
-     * @since 1.0.0
1867
-     * @param string $where Where clause string.
1868
-     * @param string $post_type Post type.
1869
-     */
1870
-    $where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
1871
-    $where = $where != '' ? " WHERE 1=1 " . $where : '';
1872
-
1873
-    $groupby = " GROUP BY $wpdb->posts.ID ";
1874
-    /**
1875
-     * Filter widget listing groupby clause string part that is being used for query.
1876
-     *
1877
-     * @since 1.0.0
1878
-     * @param string $groupby Group by clause string.
1879
-     * @param string $post_type Post type.
1880
-     */
1881
-    $groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
1854
+	$where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
1882 1855
 
1883
-    if ($count_only) {
1884
-        $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
1856
+	########### WPML ###########
1857
+	if (function_exists('icl_object_id')) {
1858
+		if ($lang_code) {
1859
+			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
1860
+		}
1861
+	}
1862
+	########### WPML ###########
1863
+	/**
1864
+	 * Filter widget listing where clause string part that is being used for query.
1865
+	 *
1866
+	 * @since 1.0.0
1867
+	 * @param string $where Where clause string.
1868
+	 * @param string $post_type Post type.
1869
+	 */
1870
+	$where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
1871
+	$where = $where != '' ? " WHERE 1=1 " . $where : '';
1872
+
1873
+	$groupby = " GROUP BY $wpdb->posts.ID ";
1874
+	/**
1875
+	 * Filter widget listing groupby clause string part that is being used for query.
1876
+	 *
1877
+	 * @since 1.0.0
1878
+	 * @param string $groupby Group by clause string.
1879
+	 * @param string $post_type Post type.
1880
+	 */
1881
+	$groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
1882
+
1883
+	if ($count_only) {
1884
+		$sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
1885 1885
 			" . $join . "
1886 1886
 			" . $where;
1887
-        $rows = (int)$wpdb->get_var($sql);
1888
-    } else {
1889
-        $orderby = geodir_widget_listings_get_order($query_args);
1890
-        /**
1891
-         * Filter widget listing orderby clause string part that is being used for query.
1892
-         *
1893
-         * @since 1.0.0
1894
-         * @param string $orderby Order by clause string.
1895
-         * @param string $table Table name.
1896
-         * @param string $post_type Post type.
1897
-         */
1898
-        $orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
1899
-        $orderby .= $wpdb->posts . ".post_title ASC";
1900
-        $orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
1901
-
1902
-        $limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
1903
-        /**
1904
-         * Filter widget listing limit that is being used for query.
1905
-         *
1906
-         * @since 1.0.0
1907
-         * @param int $limit Query results limit.
1908
-         * @param string $post_type Post type.
1909
-         */
1910
-        $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
1911
-
1912
-        $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
1913
-        if ( !$page )
1914
-            $page = 1;
1915
-
1916
-        $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
1917
-
1918
-        $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
1887
+		$rows = (int)$wpdb->get_var($sql);
1888
+	} else {
1889
+		$orderby = geodir_widget_listings_get_order($query_args);
1890
+		/**
1891
+		 * Filter widget listing orderby clause string part that is being used for query.
1892
+		 *
1893
+		 * @since 1.0.0
1894
+		 * @param string $orderby Order by clause string.
1895
+		 * @param string $table Table name.
1896
+		 * @param string $post_type Post type.
1897
+		 */
1898
+		$orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
1899
+		$orderby .= $wpdb->posts . ".post_title ASC";
1900
+		$orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
1901
+
1902
+		$limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
1903
+		/**
1904
+		 * Filter widget listing limit that is being used for query.
1905
+		 *
1906
+		 * @since 1.0.0
1907
+		 * @param int $limit Query results limit.
1908
+		 * @param string $post_type Post type.
1909
+		 */
1910
+		$limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
1911
+
1912
+		$page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
1913
+		if ( !$page )
1914
+			$page = 1;
1915
+
1916
+		$limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
1917
+
1918
+		$sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
1919 1919
 			" . $join . "
1920 1920
 			" . $where . "
1921 1921
 			" . $groupby . "
1922 1922
 			" . $orderby . "
1923 1923
 			" . $limit;
1924
-        $rows = $wpdb->get_results($sql);
1925
-    }
1924
+		$rows = $wpdb->get_results($sql);
1925
+	}
1926 1926
 
1927
-    unset($GLOBALS['gd_query_args_widgets']);
1928
-    unset($gd_query_args_widgets);
1927
+	unset($GLOBALS['gd_query_args_widgets']);
1928
+	unset($gd_query_args_widgets);
1929 1929
 
1930
-    return $rows;
1930
+	return $rows;
1931 1931
 }
1932 1932
 
1933 1933
 /**
@@ -1942,21 +1942,21 @@  discard block
 block discarded – undo
1942 1942
  */
1943 1943
 function geodir_function_widget_listings_fields($fields)
1944 1944
 {
1945
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1945
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1946 1946
 
1947
-    $query_args = $gd_query_args_widgets;
1948
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1949
-        return $fields;
1950
-    }
1951
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1952
-    $table = $plugin_prefix . $post_type . '_detail';
1947
+	$query_args = $gd_query_args_widgets;
1948
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1949
+		return $fields;
1950
+	}
1951
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1952
+	$table = $plugin_prefix . $post_type . '_detail';
1953 1953
 
1954
-    /*
1954
+	/*
1955 1955
 	if ( $post_type == 'gd_event' && defined( 'EVENT_SCHEDULE' ) ) {
1956 1956
 		$fields .= $fields != '' ? ", " . EVENT_SCHEDULE . ".*" : EVENT_SCHEDULE . ".*";
1957 1957
 	}
1958 1958
 	*/
1959
-    return $fields;
1959
+	return $fields;
1960 1960
 }
1961 1961
 
1962 1962
 /**
@@ -1971,34 +1971,34 @@  discard block
 block discarded – undo
1971 1971
  */
1972 1972
 function geodir_function_widget_listings_join($join)
1973 1973
 {
1974
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1974
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1975 1975
 
1976
-    $query_args = $gd_query_args_widgets;
1977
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1978
-        return $where;
1979
-    }
1976
+	$query_args = $gd_query_args_widgets;
1977
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1978
+		return $where;
1979
+	}
1980 1980
 
1981
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1982
-    $table = $plugin_prefix . $post_type . '_detail';
1981
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1982
+	$table = $plugin_prefix . $post_type . '_detail';
1983 1983
 
1984
-    if (!empty($query_args['with_pics_only'])) {
1985
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
1986
-    }
1984
+	if (!empty($query_args['with_pics_only'])) {
1985
+		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
1986
+	}
1987 1987
 
1988
-    /*
1988
+	/*
1989 1989
 	if ( $post_type == 'gd_event' && defined( 'EVENT_SCHEDULE' ) ) {
1990 1990
 		$join .= " INNER JOIN " . EVENT_SCHEDULE ." ON (" . EVENT_SCHEDULE .".event_id = " . $wpdb->posts . ".ID)";
1991 1991
 	}
1992 1992
 	*/
1993 1993
 
1994
-    if (!empty($query_args['tax_query'])) {
1995
-        $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
1996
-        if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
1997
-            $join .= $tax_queries['join'];
1998
-        }
1999
-    }
1994
+	if (!empty($query_args['tax_query'])) {
1995
+		$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
1996
+		if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
1997
+			$join .= $tax_queries['join'];
1998
+		}
1999
+	}
2000 2000
 
2001
-    return $join;
2001
+	return $join;
2002 2002
 }
2003 2003
 
2004 2004
 /**
@@ -2013,54 +2013,54 @@  discard block
 block discarded – undo
2013 2013
  */
2014 2014
 function geodir_function_widget_listings_where($where)
2015 2015
 {
2016
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2017
-
2018
-    $query_args = $gd_query_args_widgets;
2019
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2020
-        return $where;
2021
-    }
2022
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2023
-    $table = $plugin_prefix . $post_type . '_detail';
2024
-
2025
-    if (!empty($query_args)) {
2026
-        if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2027
-            $where = geodir_default_location_where($where, $table);
2028
-        }
2016
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2029 2017
 
2030
-        if (!empty($query_args['post_author'])) {
2031
-            $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2032
-        }
2033
-        
2034
-        if (!empty($query_args['show_featured_only'])) {
2035
-            $where .= " AND " . $table . ".is_featured = '1'";
2036
-        }
2018
+	$query_args = $gd_query_args_widgets;
2019
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2020
+		return $where;
2021
+	}
2022
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2023
+	$table = $plugin_prefix . $post_type . '_detail';
2037 2024
 
2038
-        if (!empty($query_args['show_special_only'])) {
2039
-            $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2040
-        }
2025
+	if (!empty($query_args)) {
2026
+		if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2027
+			$where = geodir_default_location_where($where, $table);
2028
+		}
2041 2029
 
2042
-        if (!empty($query_args['with_pics_only'])) {
2043
-            $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2044
-        }
2030
+		if (!empty($query_args['post_author'])) {
2031
+			$where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2032
+		}
2033
+        
2034
+		if (!empty($query_args['show_featured_only'])) {
2035
+			$where .= " AND " . $table . ".is_featured = '1'";
2036
+		}
2045 2037
 
2046
-        if (!empty($query_args['featured_image_only'])) {
2047
-            $where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2048
-        }
2038
+		if (!empty($query_args['show_special_only'])) {
2039
+			$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2040
+		}
2049 2041
 
2050
-        if (!empty($query_args['with_videos_only'])) {
2051
-            $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2052
-        }
2042
+		if (!empty($query_args['with_pics_only'])) {
2043
+			$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2044
+		}
2053 2045
 
2054
-        if (!empty($query_args['tax_query'])) {
2055
-            $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2046
+		if (!empty($query_args['featured_image_only'])) {
2047
+			$where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2048
+		}
2056 2049
 
2057
-            if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2058
-                $where .= $tax_queries['where'];
2059
-            }
2060
-        }
2061
-    }
2050
+		if (!empty($query_args['with_videos_only'])) {
2051
+			$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2052
+		}
2053
+
2054
+		if (!empty($query_args['tax_query'])) {
2055
+			$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2062 2056
 
2063
-    return $where;
2057
+			if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2058
+				$where .= $tax_queries['where'];
2059
+			}
2060
+		}
2061
+	}
2062
+
2063
+	return $where;
2064 2064
 }
2065 2065
 
2066 2066
 /**
@@ -2075,23 +2075,23 @@  discard block
 block discarded – undo
2075 2075
  */
2076 2076
 function geodir_function_widget_listings_orderby($orderby)
2077 2077
 {
2078
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2078
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2079 2079
 
2080
-    $query_args = $gd_query_args_widgets;
2081
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2082
-        return $orderby;
2083
-    }
2080
+	$query_args = $gd_query_args_widgets;
2081
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2082
+		return $orderby;
2083
+	}
2084 2084
 
2085
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2086
-    $table = $plugin_prefix . $post_type . '_detail';
2085
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2086
+	$table = $plugin_prefix . $post_type . '_detail';
2087 2087
 
2088
-    /*
2088
+	/*
2089 2089
 	if ( $post_type == 'gd_event' && defined( 'EVENT_SCHEDULE' ) ) {
2090 2090
 		$orderby .= EVENT_SCHEDULE . ".event_date ASC, " . EVENT_SCHEDULE . ".event_starttime ASC , " . $table . ".is_featured ASC, ";
2091 2091
 	}
2092 2092
 	*/
2093 2093
 
2094
-    return $orderby;
2094
+	return $orderby;
2095 2095
 }
2096 2096
 
2097 2097
 /**
@@ -2106,18 +2106,18 @@  discard block
 block discarded – undo
2106 2106
  */
2107 2107
 function geodir_function_widget_listings_limit($limit)
2108 2108
 {
2109
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2109
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2110 2110
 
2111
-    $query_args = $gd_query_args_widgets;
2112
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2113
-        return $limit;
2114
-    }
2111
+	$query_args = $gd_query_args_widgets;
2112
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2113
+		return $limit;
2114
+	}
2115 2115
 
2116
-    if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2117
-        $limit = (int)$query_args['posts_per_page'];
2118
-    }
2116
+	if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2117
+		$limit = (int)$query_args['posts_per_page'];
2118
+	}
2119 2119
 
2120
-    return $limit;
2120
+	return $limit;
2121 2121
 }
2122 2122
 
2123 2123
 /**
@@ -2131,24 +2131,24 @@  discard block
 block discarded – undo
2131 2131
  */
2132 2132
 function geodir_media_image_large_width($default = 800, $params = '')
2133 2133
 {
2134
-    $large_size_w = get_option('large_size_w');
2135
-    $large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2136
-    $large_size_w = absint($large_size_w);
2137
-
2138
-    if (!get_option('geodir_use_wp_media_large_size')) {
2139
-        $large_size_w = 800;
2140
-    }
2141
-
2142
-    /**
2143
-     * Filter large image width.
2144
-     *
2145
-     * @since 1.0.0
2146
-     * @param int $large_size_w Large image width.
2147
-     * @param int $default Default width.
2148
-     * @param string|array $params Image parameters.
2149
-     */
2150
-    $large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2151
-    return $large_size_w;
2134
+	$large_size_w = get_option('large_size_w');
2135
+	$large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2136
+	$large_size_w = absint($large_size_w);
2137
+
2138
+	if (!get_option('geodir_use_wp_media_large_size')) {
2139
+		$large_size_w = 800;
2140
+	}
2141
+
2142
+	/**
2143
+	 * Filter large image width.
2144
+	 *
2145
+	 * @since 1.0.0
2146
+	 * @param int $large_size_w Large image width.
2147
+	 * @param int $default Default width.
2148
+	 * @param string|array $params Image parameters.
2149
+	 */
2150
+	$large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2151
+	return $large_size_w;
2152 2152
 }
2153 2153
 
2154 2154
 /**
@@ -2162,25 +2162,25 @@  discard block
 block discarded – undo
2162 2162
  */
2163 2163
 function geodir_media_image_large_height($default = 800, $params = '')
2164 2164
 {
2165
-    $large_size_h = get_option('large_size_h');
2166
-    $large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2167
-    $large_size_h = absint($large_size_h);
2168
-
2169
-    if (!get_option('geodir_use_wp_media_large_size')) {
2170
-        $large_size_h = 800;
2171
-    }
2172
-
2173
-    /**
2174
-     * Filter large image height.
2175
-     *
2176
-     * @since 1.0.0
2177
-     * @param int $large_size_h Large image height.
2178
-     * @param int $default Default height.
2179
-     * @param string|array $params Image parameters.
2180
-     */
2181
-    $large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2165
+	$large_size_h = get_option('large_size_h');
2166
+	$large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2167
+	$large_size_h = absint($large_size_h);
2182 2168
 
2183
-    return $large_size_h;
2169
+	if (!get_option('geodir_use_wp_media_large_size')) {
2170
+		$large_size_h = 800;
2171
+	}
2172
+
2173
+	/**
2174
+	 * Filter large image height.
2175
+	 *
2176
+	 * @since 1.0.0
2177
+	 * @param int $large_size_h Large image height.
2178
+	 * @param int $default Default height.
2179
+	 * @param string|array $params Image parameters.
2180
+	 */
2181
+	$large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2182
+
2183
+	return $large_size_h;
2184 2184
 }
2185 2185
 
2186 2186
 /**
@@ -2195,25 +2195,25 @@  discard block
 block discarded – undo
2195 2195
  */
2196 2196
 function geodir_sanitize_location_name($type, $name, $translate = true)
2197 2197
 {
2198
-    if ($name == '') {
2199
-        return NULL;
2200
-    }
2201
-
2202
-    $type = $type == 'gd_country' ? 'country' : $type;
2203
-    $type = $type == 'gd_region' ? 'region' : $type;
2204
-    $type = $type == 'gd_city' ? 'city' : $type;
2205
-
2206
-    $return = $name;
2207
-    if (function_exists('get_actual_location_name')) {
2208
-        $return = get_actual_location_name($type, $name, $translate);
2209
-    } else {
2210
-        $return = preg_replace('/-(\d+)$/', '', $return);
2211
-        $return = preg_replace('/[_-]/', ' ', $return);
2212
-        $return = geodir_ucwords($return);
2213
-        $return = $translate ? __($return, 'geodirectory') : $return;
2214
-    }
2215
-
2216
-    return $return;
2198
+	if ($name == '') {
2199
+		return NULL;
2200
+	}
2201
+
2202
+	$type = $type == 'gd_country' ? 'country' : $type;
2203
+	$type = $type == 'gd_region' ? 'region' : $type;
2204
+	$type = $type == 'gd_city' ? 'city' : $type;
2205
+
2206
+	$return = $name;
2207
+	if (function_exists('get_actual_location_name')) {
2208
+		$return = get_actual_location_name($type, $name, $translate);
2209
+	} else {
2210
+		$return = preg_replace('/-(\d+)$/', '', $return);
2211
+		$return = preg_replace('/[_-]/', ' ', $return);
2212
+		$return = geodir_ucwords($return);
2213
+		$return = $translate ? __($return, 'geodirectory') : $return;
2214
+	}
2215
+
2216
+	return $return;
2217 2217
 }
2218 2218
 
2219 2219
 
@@ -2227,14 +2227,14 @@  discard block
 block discarded – undo
2227 2227
 function geodir_comments_number($number)
2228 2228
 {
2229 2229
 
2230
-    if ($number > 1) {
2231
-        $output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2232
-    } elseif ($number == 0 || $number == '') {
2233
-        $output = __('No Reviews', 'geodirectory');
2234
-    } else { // must be one
2235
-        $output = __('1 Review', 'geodirectory');
2236
-    }
2237
-    echo $output;
2230
+	if ($number > 1) {
2231
+		$output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2232
+	} elseif ($number == 0 || $number == '') {
2233
+		$output = __('No Reviews', 'geodirectory');
2234
+	} else { // must be one
2235
+		$output = __('1 Review', 'geodirectory');
2236
+	}
2237
+	echo $output;
2238 2238
 }
2239 2239
 
2240 2240
 /**
@@ -2247,23 +2247,23 @@  discard block
 block discarded – undo
2247 2247
  */
2248 2248
 function is_page_geodir_home()
2249 2249
 {
2250
-    global $wpdb;
2251
-    $cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2252
-    if (function_exists('geodir_location_geo_home_link')) {
2253
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2254
-    }
2255
-    $home_url = home_url('', 'http');
2256
-    if (function_exists('geodir_location_geo_home_link')) {
2257
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2258
-    }
2259
-    $home_url = str_replace("www.", "", $home_url);
2260
-    if ( (strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')) ) {
2261
-        return true;
2262
-    }elseif(get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')){
2263
-        return true;
2264
-    } else {
2265
-        return false;
2266
-    }
2250
+	global $wpdb;
2251
+	$cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2252
+	if (function_exists('geodir_location_geo_home_link')) {
2253
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2254
+	}
2255
+	$home_url = home_url('', 'http');
2256
+	if (function_exists('geodir_location_geo_home_link')) {
2257
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2258
+	}
2259
+	$home_url = str_replace("www.", "", $home_url);
2260
+	if ( (strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')) ) {
2261
+		return true;
2262
+	}elseif(get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')){
2263
+		return true;
2264
+	} else {
2265
+		return false;
2266
+	}
2267 2267
 
2268 2268
 }
2269 2269
 
@@ -2279,13 +2279,13 @@  discard block
 block discarded – undo
2279 2279
  */
2280 2280
 function geodir_wpseo_homepage_canonical($url)
2281 2281
 {
2282
-    global $post;
2282
+	global $post;
2283 2283
 
2284
-    if (is_page_geodir_home()) {
2285
-        return home_url();
2286
-    }
2284
+	if (is_page_geodir_home()) {
2285
+		return home_url();
2286
+	}
2287 2287
 
2288
-    return $url;
2288
+	return $url;
2289 2289
 }
2290 2290
 
2291 2291
 add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10);
@@ -2302,16 +2302,16 @@  discard block
 block discarded – undo
2302 2302
  */
2303 2303
 function geodir_googlemap_script_extra_details_page($extra)
2304 2304
 {
2305
-    global $post;
2306
-    $add_google_places_api = false;
2307
-    if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2308
-        $add_google_places_api = true;
2309
-    }
2310
-    if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2311
-        $extra .= "&amp;libraries=places";
2312
-    }
2313
-
2314
-    return $extra;
2305
+	global $post;
2306
+	$add_google_places_api = false;
2307
+	if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2308
+		$add_google_places_api = true;
2309
+	}
2310
+	if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2311
+		$extra .= "&amp;libraries=places";
2312
+	}
2313
+
2314
+	return $extra;
2315 2315
 }
2316 2316
 
2317 2317
 add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1);
@@ -2331,91 +2331,91 @@  discard block
 block discarded – undo
2331 2331
  */
2332 2332
 function geodir_popular_post_category_output($args = '', $instance = '')
2333 2333
 {
2334
-    // prints the widget
2335
-    global $wpdb, $plugin_prefix, $geodir_post_category_str;
2336
-    extract($args, EXTR_SKIP);
2334
+	// prints the widget
2335
+	global $wpdb, $plugin_prefix, $geodir_post_category_str;
2336
+	extract($args, EXTR_SKIP);
2337 2337
 
2338
-    echo $before_widget;
2338
+	echo $before_widget;
2339 2339
 
2340
-    /** This filter is documented in geodirectory_widgets.php */
2341
-    $title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2340
+	/** This filter is documented in geodirectory_widgets.php */
2341
+	$title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2342 2342
 
2343
-    $gd_post_type = geodir_get_current_posttype();
2343
+	$gd_post_type = geodir_get_current_posttype();
2344 2344
 
2345
-    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2346
-    $default_post_type = !empty($gd_post_type) ? $gd_post_type : (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ? $instance['default_post_type'] : '');
2345
+	$category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2346
+	$default_post_type = !empty($gd_post_type) ? $gd_post_type : (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ? $instance['default_post_type'] : '');
2347 2347
 
2348
-    $taxonomy = array();
2349
-    if (!empty($gd_post_type)) {
2350
-        $taxonomy[] = $gd_post_type . "category";
2351
-    } else {
2352
-        $taxonomy = geodir_get_taxonomies($gd_post_type);
2353
-    }
2348
+	$taxonomy = array();
2349
+	if (!empty($gd_post_type)) {
2350
+		$taxonomy[] = $gd_post_type . "category";
2351
+	} else {
2352
+		$taxonomy = geodir_get_taxonomies($gd_post_type);
2353
+	}
2354 2354
 
2355
-    $terms = get_terms($taxonomy);
2356
-    $a_terms = array();
2357
-    $b_terms = array();
2355
+	$terms = get_terms($taxonomy);
2356
+	$a_terms = array();
2357
+	$b_terms = array();
2358 2358
 
2359
-    foreach ($terms as $term) {
2360
-        if ($term->count > 0) {
2361
-            $a_terms[$term->taxonomy][] = $term;
2362
-        }
2363
-    }
2359
+	foreach ($terms as $term) {
2360
+		if ($term->count > 0) {
2361
+			$a_terms[$term->taxonomy][] = $term;
2362
+		}
2363
+	}
2364 2364
 
2365
-    if (!empty($a_terms)) {
2366
-        foreach ($a_terms as $b_key => $b_val) {
2367
-            $b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2368
-        }
2365
+	if (!empty($a_terms)) {
2366
+		foreach ($a_terms as $b_key => $b_val) {
2367
+			$b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2368
+		}
2369 2369
 
2370
-        $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : '';
2371
-
2372
-        $tax_change_output = '';
2373
-        if (count($b_terms) > 1) {
2374
-            $tax_change_output .= "<select data-limit='$category_limit' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2375
-            foreach ($b_terms as $key => $val) {
2376
-                $ptype = get_post_type_object(str_replace("category", "", $key));
2377
-                $cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2378
-                $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2379
-            }
2380
-            $tax_change_output .= "</select>";
2381
-        }
2370
+		$default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : '';
2371
+
2372
+		$tax_change_output = '';
2373
+		if (count($b_terms) > 1) {
2374
+			$tax_change_output .= "<select data-limit='$category_limit' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2375
+			foreach ($b_terms as $key => $val) {
2376
+				$ptype = get_post_type_object(str_replace("category", "", $key));
2377
+				$cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2378
+				$tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2379
+			}
2380
+			$tax_change_output .= "</select>";
2381
+		}
2382 2382
 
2383
-        if (!empty($b_terms)) {
2384
-            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2385
-            global $cat_count;//make global so we can change via function
2386
-            $cat_count = 0;
2387
-            ?>
2383
+		if (!empty($b_terms)) {
2384
+			$terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2385
+			global $cat_count;//make global so we can change via function
2386
+			$cat_count = 0;
2387
+			?>
2388 2388
             <div class="geodir-category-list-in clearfix">
2389 2389
                 <div class="geodir-cat-list clearfix">
2390 2390
                     <?php
2391
-                    echo $before_title . __($title) . $after_title;
2391
+					echo $before_title . __($title) . $after_title;
2392 2392
 
2393
-                    echo $tax_change_output;
2393
+					echo $tax_change_output;
2394 2394
 
2395
-                    echo '<ul class="geodir-popular-cat-list">';
2395
+					echo '<ul class="geodir-popular-cat-list">';
2396 2396
 
2397
-                    geodir_helper_cat_list_output($terms, $category_limit);
2397
+					geodir_helper_cat_list_output($terms, $category_limit);
2398 2398
 
2399
-                    echo '</ul>';
2400
-                    ?>
2399
+					echo '</ul>';
2400
+					?>
2401 2401
                 </div>
2402 2402
                 <?php
2403
-                $hide = '';
2404
-                if ($cat_count < $category_limit) {
2405
-                    $hide = 'style="display:none;"';
2406
-                }
2407
-                echo "<div class='geodir-cat-list-more' $hide >";
2408
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>';
2409
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>';
2410
-                echo "</div>";
2411
-                /* add scripts */
2412
-                add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2413
-                ?>
2403
+				$hide = '';
2404
+				if ($cat_count < $category_limit) {
2405
+					$hide = 'style="display:none;"';
2406
+				}
2407
+				echo "<div class='geodir-cat-list-more' $hide >";
2408
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>';
2409
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>';
2410
+				echo "</div>";
2411
+				/* add scripts */
2412
+				add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2413
+				?>
2414 2414
             </div>
2415 2415
         <?php
2416
-        }
2417
-    }
2418
-    echo $after_widget;
2416
+		}
2417
+	}
2418
+	echo $after_widget;
2419 2419
 }
2420 2420
 
2421 2421
 /**
@@ -2429,38 +2429,38 @@  discard block
 block discarded – undo
2429 2429
  */
2430 2430
 function geodir_helper_cat_list_output($terms, $category_limit)
2431 2431
 {
2432
-    global $geodir_post_category_str, $cat_count;
2433
-    $term_icons = geodir_get_term_icon();
2432
+	global $geodir_post_category_str, $cat_count;
2433
+	$term_icons = geodir_get_term_icon();
2434 2434
 
2435
-    $geodir_post_category_str = array();
2435
+	$geodir_post_category_str = array();
2436 2436
 
2437 2437
 
2438
-    foreach ($terms as $cat) {
2439
-        $post_type = str_replace("category", "", $cat->taxonomy);
2440
-        $term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2438
+	foreach ($terms as $cat) {
2439
+		$post_type = str_replace("category", "", $cat->taxonomy);
2440
+		$term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2441 2441
 
2442
-        $cat_count++;
2442
+		$cat_count++;
2443 2443
 
2444
-        $geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2444
+		$geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2445 2445
 
2446
-        $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2447
-        $total_post = $cat->count;
2446
+		$class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2447
+		$total_post = $cat->count;
2448 2448
 
2449
-        $term_link = get_term_link( $cat, $cat->taxonomy );
2450
-        /**
2451
-         * Filer the category term link.
2452
-         *
2453
-         * @since 1.4.5
2454
-         * @param string $term_link The term permalink.
2455
-         * @param int    $cat->term_id The term id.
2456
-         * @param string $post_type Wordpress post type.
2457
-         */
2458
-        $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2449
+		$term_link = get_term_link( $cat, $cat->taxonomy );
2450
+		/**
2451
+		 * Filer the category term link.
2452
+		 *
2453
+		 * @since 1.4.5
2454
+		 * @param string $term_link The term permalink.
2455
+		 * @param int    $cat->term_id The term id.
2456
+		 * @param string $post_type Wordpress post type.
2457
+		 */
2458
+		$term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2459 2459
 
2460
-        echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2461
-        echo '<img alt="' . esc_attr($cat->name) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">'; echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
2462
-        echo '</a></li>';
2463
-    }
2460
+		echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2461
+		echo '<img alt="' . esc_attr($cat->name) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">'; echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
2462
+		echo '</a></li>';
2463
+	}
2464 2464
 }
2465 2465
 
2466 2466
 /**
@@ -2474,108 +2474,108 @@  discard block
 block discarded – undo
2474 2474
  */
2475 2475
 function geodir_listing_slider_widget_output($args = '', $instance = '')
2476 2476
 {
2477
-    // prints the widget
2478
-    extract($args, EXTR_SKIP);
2479
-
2480
-    echo $before_widget;
2481
-
2482
-    /** This filter is documented in geodirectory_widgets.php */
2483
-    $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2484
-    /**
2485
-     * Filter the widget post type.
2486
-     *
2487
-     * @since 1.0.0
2488
-     * @param string $instance['post_type'] Post type of listing.
2489
-     */
2490
-    $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2491
-    /**
2492
-     * Filter the widget's term.
2493
-     *
2494
-     * @since 1.0.0
2495
-     * @param string $instance['category'] Filter by term. Can be any valid term.
2496
-     */
2497
-    $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2498
-    /**
2499
-     * Filter the widget listings limit.
2500
-     *
2501
-     * @since 1.0.0
2502
-     * @param string $instance['post_number'] Number of listings to display.
2503
-     */
2504
-    $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2505
-    /**
2506
-     * Filter the widget listings limit shown at one time.
2507
-     *
2508
-     * @since 1.5.0
2509
-     * @param string $instance['max_show'] Number of listings to display on screen.
2510
-     */
2511
-    $max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
2512
-    /**
2513
-     * Filter the widget slide width.
2514
-     *
2515
-     * @since 1.5.0
2516
-     * @param string $instance['slide_width'] Width of the slides shown.
2517
-     */
2518
-    $slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
2519
-    /**
2520
-     * Filter widget's "show title" value.
2521
-     *
2522
-     * @since 1.0.0
2523
-     * @param string|bool $instance['show_title'] Do you want to display title? Can be 1 or 0.
2524
-     */
2525
-    $show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
2526
-    /**
2527
-     * Filter widget's "slideshow" value.
2528
-     *
2529
-     * @since 1.0.0
2530
-     * @param int $instance['slideshow'] Setup a slideshow for the slider to animate automatically.
2531
-     */
2532
-    $slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
2533
-    /**
2534
-     * Filter widget's "animationLoop" value.
2535
-     *
2536
-     * @since 1.0.0
2537
-     * @param int $instance['animationLoop'] Gives the slider a seamless infinite loop.
2538
-     */
2539
-    $animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
2540
-    /**
2541
-     * Filter widget's "directionNav" value.
2542
-     *
2543
-     * @since 1.0.0
2544
-     * @param int $instance['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
2545
-     */
2546
-    $directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
2547
-    /**
2548
-     * Filter widget's "slideshowSpeed" value.
2549
-     *
2550
-     * @since 1.0.0
2551
-     * @param int $instance['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
2552
-     */
2553
-    $slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
2554
-    /**
2555
-     * Filter widget's "animationSpeed" value.
2556
-     *
2557
-     * @since 1.0.0
2558
-     * @param int $instance['animationSpeed'] Set the speed of animations, in milliseconds.
2559
-     */
2560
-    $animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
2561
-    /**
2562
-     * Filter widget's "animation" value.
2563
-     *
2564
-     * @since 1.0.0
2565
-     * @param string $instance['animation'] Controls the animation type, "fade" or "slide".
2566
-     */
2567
-    $animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
2568
-    /**
2569
-     * Filter widget's "list_sort" type.
2570
-     *
2571
-     * @since 1.0.0
2572
-     * @param string $instance['list_sort'] Listing sort by type.
2573
-     */
2574
-    $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
2575
-    $show_featured_only = !empty($instance['show_featured_only']) ? 1 : NULL;
2576
-
2577
-    wp_enqueue_script('geodirectory-jquery-flexslider-js');
2578
-    ?>
2477
+	// prints the widget
2478
+	extract($args, EXTR_SKIP);
2479
+
2480
+	echo $before_widget;
2481
+
2482
+	/** This filter is documented in geodirectory_widgets.php */
2483
+	$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2484
+	/**
2485
+	 * Filter the widget post type.
2486
+	 *
2487
+	 * @since 1.0.0
2488
+	 * @param string $instance['post_type'] Post type of listing.
2489
+	 */
2490
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2491
+	/**
2492
+	 * Filter the widget's term.
2493
+	 *
2494
+	 * @since 1.0.0
2495
+	 * @param string $instance['category'] Filter by term. Can be any valid term.
2496
+	 */
2497
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2498
+	/**
2499
+	 * Filter the widget listings limit.
2500
+	 *
2501
+	 * @since 1.0.0
2502
+	 * @param string $instance['post_number'] Number of listings to display.
2503
+	 */
2504
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2505
+	/**
2506
+	 * Filter the widget listings limit shown at one time.
2507
+	 *
2508
+	 * @since 1.5.0
2509
+	 * @param string $instance['max_show'] Number of listings to display on screen.
2510
+	 */
2511
+	$max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
2512
+	/**
2513
+	 * Filter the widget slide width.
2514
+	 *
2515
+	 * @since 1.5.0
2516
+	 * @param string $instance['slide_width'] Width of the slides shown.
2517
+	 */
2518
+	$slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
2519
+	/**
2520
+	 * Filter widget's "show title" value.
2521
+	 *
2522
+	 * @since 1.0.0
2523
+	 * @param string|bool $instance['show_title'] Do you want to display title? Can be 1 or 0.
2524
+	 */
2525
+	$show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
2526
+	/**
2527
+	 * Filter widget's "slideshow" value.
2528
+	 *
2529
+	 * @since 1.0.0
2530
+	 * @param int $instance['slideshow'] Setup a slideshow for the slider to animate automatically.
2531
+	 */
2532
+	$slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
2533
+	/**
2534
+	 * Filter widget's "animationLoop" value.
2535
+	 *
2536
+	 * @since 1.0.0
2537
+	 * @param int $instance['animationLoop'] Gives the slider a seamless infinite loop.
2538
+	 */
2539
+	$animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
2540
+	/**
2541
+	 * Filter widget's "directionNav" value.
2542
+	 *
2543
+	 * @since 1.0.0
2544
+	 * @param int $instance['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
2545
+	 */
2546
+	$directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
2547
+	/**
2548
+	 * Filter widget's "slideshowSpeed" value.
2549
+	 *
2550
+	 * @since 1.0.0
2551
+	 * @param int $instance['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
2552
+	 */
2553
+	$slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
2554
+	/**
2555
+	 * Filter widget's "animationSpeed" value.
2556
+	 *
2557
+	 * @since 1.0.0
2558
+	 * @param int $instance['animationSpeed'] Set the speed of animations, in milliseconds.
2559
+	 */
2560
+	$animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
2561
+	/**
2562
+	 * Filter widget's "animation" value.
2563
+	 *
2564
+	 * @since 1.0.0
2565
+	 * @param string $instance['animation'] Controls the animation type, "fade" or "slide".
2566
+	 */
2567
+	$animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
2568
+	/**
2569
+	 * Filter widget's "list_sort" type.
2570
+	 *
2571
+	 * @since 1.0.0
2572
+	 * @param string $instance['list_sort'] Listing sort by type.
2573
+	 */
2574
+	$list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
2575
+	$show_featured_only = !empty($instance['show_featured_only']) ? 1 : NULL;
2576
+
2577
+	wp_enqueue_script('geodirectory-jquery-flexslider-js');
2578
+	?>
2579 2579
     <script type="text/javascript">
2580 2580
         jQuery(window).load(function () {
2581 2581
             jQuery('#geodir_widget_carousel').flexslider({
@@ -2616,73 +2616,73 @@  discard block
 block discarded – undo
2616 2616
         });
2617 2617
     </script>
2618 2618
     <?php
2619
-    $query_args = array(
2620
-        'posts_per_page' => $post_number,
2621
-        'is_geodir_loop' => true,
2622
-        'post_type' => $post_type,
2623
-        'order_by' => $list_sort
2624
-    );
2625
-    if ($show_featured_only) {
2626
-        $query_args['show_featured_only'] = 1;
2627
-    }
2628
-
2629
-    if ($category != 0 || $category != '') {
2630
-        $category_taxonomy = geodir_get_taxonomies($post_type);
2631
-        $tax_query = array(
2632
-            'taxonomy' => $category_taxonomy[0],
2633
-            'field' => 'id',
2634
-            'terms' => $category
2635
-        );
2636
-
2637
-        $query_args['tax_query'] = array($tax_query);
2638
-    }
2639
-
2640
-    // we want listings with featured image only
2641
-    $query_args['featured_image_only'] = 1;
2642
-
2643
-    if ($post_type == 'gd_event') {
2644
-        $query_args['gedir_event_listing_filter'] = 'upcoming';
2645
-    }// show only upcomming events
2646
-
2647
-    $widget_listings = geodir_get_widget_listings($query_args);
2648
-    if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
2649
-        if ($title) {
2650
-            echo $before_title . $title . $after_title;
2651
-        }
2619
+	$query_args = array(
2620
+		'posts_per_page' => $post_number,
2621
+		'is_geodir_loop' => true,
2622
+		'post_type' => $post_type,
2623
+		'order_by' => $list_sort
2624
+	);
2625
+	if ($show_featured_only) {
2626
+		$query_args['show_featured_only'] = 1;
2627
+	}
2652 2628
 
2653
-        global $post;
2629
+	if ($category != 0 || $category != '') {
2630
+		$category_taxonomy = geodir_get_taxonomies($post_type);
2631
+		$tax_query = array(
2632
+			'taxonomy' => $category_taxonomy[0],
2633
+			'field' => 'id',
2634
+			'terms' => $category
2635
+		);
2654 2636
 
2655
-        $current_post = $post;// keep current post info
2637
+		$query_args['tax_query'] = array($tax_query);
2638
+	}
2656 2639
 
2657
-        $widget_main_slides = '';
2658
-        $nav_slides = '';
2659
-        $widget_slides = 0;
2640
+	// we want listings with featured image only
2641
+	$query_args['featured_image_only'] = 1;
2660 2642
 
2661
-        foreach ($widget_listings as $widget_listing) {
2662
-            global $gd_widget_listing_type;
2663
-            $post = $widget_listing;
2664
-            $widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
2643
+	if ($post_type == 'gd_event') {
2644
+		$query_args['gedir_event_listing_filter'] = 'upcoming';
2645
+	}// show only upcomming events
2665 2646
 
2666
-            if (!empty($widget_image)) {
2667
-                if ($widget_image->height >= 200) {
2668
-                    $widget_spacer_height = 0;
2669
-                } else {
2670
-                    $widget_spacer_height = ((200 - $widget_image->height) / 2);
2671
-                }
2647
+	$widget_listings = geodir_get_widget_listings($query_args);
2648
+	if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
2649
+		if ($title) {
2650
+			echo $before_title . $title . $after_title;
2651
+		}
2672 2652
 
2673
-                $widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />';
2653
+		global $post;
2674 2654
 
2675
-                $title = '';
2676
-                if ($show_title) {
2677
-                    $title = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>';
2678
-                }
2655
+		$current_post = $post;// keep current post info
2679 2656
 
2680
-                $widget_main_slides .= $title . '<img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></li>';
2681
-                $nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
2682
-                $widget_slides++;
2683
-            }
2684
-        }
2685
-        ?>
2657
+		$widget_main_slides = '';
2658
+		$nav_slides = '';
2659
+		$widget_slides = 0;
2660
+
2661
+		foreach ($widget_listings as $widget_listing) {
2662
+			global $gd_widget_listing_type;
2663
+			$post = $widget_listing;
2664
+			$widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
2665
+
2666
+			if (!empty($widget_image)) {
2667
+				if ($widget_image->height >= 200) {
2668
+					$widget_spacer_height = 0;
2669
+				} else {
2670
+					$widget_spacer_height = ((200 - $widget_image->height) / 2);
2671
+				}
2672
+
2673
+				$widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />';
2674
+
2675
+				$title = '';
2676
+				if ($show_title) {
2677
+					$title = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>';
2678
+				}
2679
+
2680
+				$widget_main_slides .= $title . '<img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></li>';
2681
+				$nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
2682
+				$widget_slides++;
2683
+			}
2684
+		}
2685
+		?>
2686 2686
         <div class="flex-container" style="min-height:200px;">
2687 2687
             <div class="geodir-listing-flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
2688 2688
             <div id="geodir_widget_slider" class="geodir_flexslider">
@@ -2695,10 +2695,10 @@  discard block
 block discarded – undo
2695 2695
             <?php } ?>
2696 2696
         </div>
2697 2697
         <?php
2698
-        $GLOBALS['post'] = $current_post;
2699
-        setup_postdata($current_post);
2700
-    }
2701
-    echo $after_widget;
2698
+		$GLOBALS['post'] = $current_post;
2699
+		setup_postdata($current_post);
2700
+	}
2701
+	echo $after_widget;
2702 2702
 }
2703 2703
 
2704 2704
 
@@ -2713,68 +2713,68 @@  discard block
 block discarded – undo
2713 2713
  */
2714 2714
 function geodir_loginwidget_output($args = '', $instance = '')
2715 2715
 {
2716
-    //print_r($args);
2717
-    //print_r($instance);
2718
-    // prints the widget
2719
-    extract($args, EXTR_SKIP);
2716
+	//print_r($args);
2717
+	//print_r($instance);
2718
+	// prints the widget
2719
+	extract($args, EXTR_SKIP);
2720 2720
 
2721
-    /** This filter is documented in geodirectory_widgets.php */
2722
-    $title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2721
+	/** This filter is documented in geodirectory_widgets.php */
2722
+	$title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2723 2723
 
2724
-    echo $before_widget;
2725
-    echo $before_title . $title . $after_title;
2724
+	echo $before_widget;
2725
+	echo $before_title . $title . $after_title;
2726 2726
 
2727
-    if (is_user_logged_in()) {
2728
-        global $current_user;
2727
+	if (is_user_logged_in()) {
2728
+		global $current_user;
2729 2729
 
2730
-        $login_url = geodir_login_url();
2731
-        $add_listurl = get_permalink(geodir_add_listing_page_id());
2732
-        $add_listurl = geodir_getlink($add_listurl, array('listing_type' => 'gd_place'));
2733
-        $author_link = get_author_posts_url($current_user->data->ID);
2734
-        $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
2730
+		$login_url = geodir_login_url();
2731
+		$add_listurl = get_permalink(geodir_add_listing_page_id());
2732
+		$add_listurl = geodir_getlink($add_listurl, array('listing_type' => 'gd_place'));
2733
+		$author_link = get_author_posts_url($current_user->data->ID);
2734
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
2735 2735
 
2736
-        echo '<ul class="geodir-loginbox-list">';
2737
-        ob_start();
2738
-        ?>
2736
+		echo '<ul class="geodir-loginbox-list">';
2737
+		ob_start();
2738
+		?>
2739 2739
         <li><a class="signin"
2740 2740
                href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li>
2741 2741
         <?php
2742
-        $post_types = geodir_get_posttypes('object');
2743
-        $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
2744
-        $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2742
+		$post_types = geodir_get_posttypes('object');
2743
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
2744
+		$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2745 2745
 
2746
-        if (!empty($show_add_listing_post_types_main_nav)) {
2747
-            $addlisting_links = '';
2748
-            foreach ($post_types as $key => $postobj) {
2746
+		if (!empty($show_add_listing_post_types_main_nav)) {
2747
+			$addlisting_links = '';
2748
+			foreach ($post_types as $key => $postobj) {
2749 2749
 
2750
-                if (in_array($key, $show_add_listing_post_types_main_nav)) {
2750
+				if (in_array($key, $show_add_listing_post_types_main_nav)) {
2751 2751
 
2752
-                    if ($add_link = geodir_get_addlisting_link($key)) {
2752
+					if ($add_link = geodir_get_addlisting_link($key)) {
2753 2753
 
2754
-                        $name = $postobj->labels->name;
2754
+						$name = $postobj->labels->name;
2755 2755
 
2756
-                        $selected = '';
2757
-                        if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing'))
2758
-                            $selected = 'selected="selected"';
2756
+						$selected = '';
2757
+						if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing'))
2758
+							$selected = 'selected="selected"';
2759 2759
 
2760
-                        /**
2761
-                         * Filter add listing link.
2762
-                         *
2763
-                         * @since 1.0.0
2764
-                         * @param string $add_link Add listing link.
2765
-                         * @param string $key Add listing array key.
2766
-                         * @param int $current_user->ID Current user ID.
2767
-                         */
2768
-                        $add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
2760
+						/**
2761
+						 * Filter add listing link.
2762
+						 *
2763
+						 * @since 1.0.0
2764
+						 * @param string $add_link Add listing link.
2765
+						 * @param string $key Add listing array key.
2766
+						 * @param int $current_user->ID Current user ID.
2767
+						 */
2768
+						$add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
2769 2769
 
2770
-                        $addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2770
+						$addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2771 2771
 
2772
-                    }
2773
-                }
2772
+					}
2773
+				}
2774 2774
 
2775
-            }
2775
+			}
2776 2776
 
2777
-            if ($addlisting_links != '') { ?>
2777
+			if ($addlisting_links != '') { ?>
2778 2778
 
2779 2779
                 <li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value"
2780 2780
                             option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false"
@@ -2783,42 +2783,42 @@  discard block
 block discarded – undo
2783 2783
                         <?php echo $addlisting_links; ?>
2784 2784
                     </select></li> <?php
2785 2785
 
2786
-            }
2786
+			}
2787 2787
 
2788
-        }
2789
-        // My Favourites in Dashboard
2790
-        $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
2791
-        $user_favourite = geodir_user_favourite_listing_count();
2792
-
2793
-        if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
2794
-            $favourite_links = '';
2795
-
2796
-            foreach ($post_types as $key => $postobj) {
2797
-                if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
2798
-                    $name = $postobj->labels->name;
2799
-                    $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
2800
-
2801
-                    $selected = '';
2802
-
2803
-                    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
2804
-                        $selected = 'selected="selected"';
2805
-                    }
2806
-                    /**
2807
-                     * Filter favorite listing link.
2808
-                     *
2809
-                     * @since 1.0.0
2810
-                     * @param string $post_type_link Favorite listing link.
2811
-                     * @param string $key Favorite listing array key.
2812
-                     * @param int $current_user->ID Current user ID.
2813
-                     */
2814
-                    $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
2815
-
2816
-                    $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2817
-                }
2818
-            }
2819
-
2820
-            if ($favourite_links != '') {
2821
-                ?>
2788
+		}
2789
+		// My Favourites in Dashboard
2790
+		$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
2791
+		$user_favourite = geodir_user_favourite_listing_count();
2792
+
2793
+		if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
2794
+			$favourite_links = '';
2795
+
2796
+			foreach ($post_types as $key => $postobj) {
2797
+				if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
2798
+					$name = $postobj->labels->name;
2799
+					$post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
2800
+
2801
+					$selected = '';
2802
+
2803
+					if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
2804
+						$selected = 'selected="selected"';
2805
+					}
2806
+					/**
2807
+					 * Filter favorite listing link.
2808
+					 *
2809
+					 * @since 1.0.0
2810
+					 * @param string $post_type_link Favorite listing link.
2811
+					 * @param string $key Favorite listing array key.
2812
+					 * @param int $current_user->ID Current user ID.
2813
+					 */
2814
+					$post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
2815
+
2816
+					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2817
+				}
2818
+			}
2819
+
2820
+			if ($favourite_links != '') {
2821
+				?>
2822 2822
                 <li>
2823 2823
                     <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
2824 2824
                             option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false"
@@ -2828,42 +2828,42 @@  discard block
 block discarded – undo
2828 2828
                     </select>
2829 2829
                 </li>
2830 2830
             <?php
2831
-            }
2832
-        }
2833
-
2831
+			}
2832
+		}
2834 2833
 
2835
-        $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
2836
-        $user_listing = geodir_user_post_listing_count();
2837 2834
 
2838
-        if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
2839
-            $listing_links = '';
2835
+		$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
2836
+		$user_listing = geodir_user_post_listing_count();
2840 2837
 
2841
-            foreach ($post_types as $key => $postobj) {
2842
-                if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
2843
-                    $name = $postobj->labels->name;
2844
-                    $listing_link = geodir_getlink($author_link, array('stype' => $key), false);
2838
+		if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
2839
+			$listing_links = '';
2845 2840
 
2846
-                    $selected = '';
2847
-                    if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
2848
-                        $selected = 'selected="selected"';
2849
-                    }
2841
+			foreach ($post_types as $key => $postobj) {
2842
+				if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
2843
+					$name = $postobj->labels->name;
2844
+					$listing_link = geodir_getlink($author_link, array('stype' => $key), false);
2850 2845
 
2851
-                    /**
2852
-                     * Filter my listing link.
2853
-                     *
2854
-                     * @since 1.0.0
2855
-                     * @param string $listing_link My listing link.
2856
-                     * @param string $key My listing array key.
2857
-                     * @param int $current_user->ID Current user ID.
2858
-                     */
2859
-                    $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
2846
+					$selected = '';
2847
+					if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
2848
+						$selected = 'selected="selected"';
2849
+					}
2860 2850
 
2861
-                    $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2862
-                }
2863
-            }
2851
+					/**
2852
+					 * Filter my listing link.
2853
+					 *
2854
+					 * @since 1.0.0
2855
+					 * @param string $listing_link My listing link.
2856
+					 * @param string $key My listing array key.
2857
+					 * @param int $current_user->ID Current user ID.
2858
+					 */
2859
+					$listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
2860
+
2861
+					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2862
+				}
2863
+			}
2864 2864
 
2865
-            if ($listing_links != '') {
2866
-                ?>
2865
+			if ($listing_links != '') {
2866
+				?>
2867 2867
                 <li>
2868 2868
                     <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
2869 2869
                             option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false"
@@ -2873,27 +2873,27 @@  discard block
 block discarded – undo
2873 2873
                     </select>
2874 2874
                 </li>
2875 2875
             <?php
2876
-            }
2877
-        }
2876
+			}
2877
+		}
2878 2878
 
2879
-        $dashboard_link = ob_get_clean();
2880
-        /**
2881
-         * Filter dashboard links HTML.
2882
-         *
2883
-         * @since 1.0.0
2884
-         * @param string $dashboard_link Dashboard links HTML.
2885
-         */
2886
-        echo apply_filters('geodir_dashboard_links', $dashboard_link);
2887
-        echo '</ul>';
2888
-    } else {
2889
-        ?>
2879
+		$dashboard_link = ob_get_clean();
2880
+		/**
2881
+		 * Filter dashboard links HTML.
2882
+		 *
2883
+		 * @since 1.0.0
2884
+		 * @param string $dashboard_link Dashboard links HTML.
2885
+		 */
2886
+		echo apply_filters('geodir_dashboard_links', $dashboard_link);
2887
+		echo '</ul>';
2888
+	} else {
2889
+		?>
2890 2890
         <?php
2891
-        /**
2892
-         * Filter signup form action link.
2893
-         *
2894
-         * @since 1.0.0
2895
-         */
2896
-        ?>
2891
+		/**
2892
+		 * Filter signup form action link.
2893
+		 *
2894
+		 * @since 1.0.0
2895
+		 */
2896
+		?>
2897 2897
         <form name="loginform" class="loginform1"
2898 2898
               action="<?php echo geodir_login_url(); ?>"
2899 2899
               method="post">
@@ -2913,28 +2913,28 @@  discard block
 block discarded – undo
2913 2913
 
2914 2914
                 <p class="geodir-new-forgot-link">
2915 2915
                     <?php
2916
-                    /**
2917
-                     * Filter signup page register form link.
2918
-                     *
2919
-                     * @since 1.0.0
2920
-                     */
2921
-                    ?>
2916
+					/**
2917
+					 * Filter signup page register form link.
2918
+					 *
2919
+					 * @since 1.0.0
2920
+					 */
2921
+					?>
2922 2922
                     <a href="<?php echo geodir_login_url(array('signup' => true)); ?>"
2923 2923
                        class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a>
2924 2924
 
2925 2925
                     <?php
2926
-                    /**
2927
-                     * Filter signup page forgot password form link.
2928
-                     *
2929
-                     * @since 1.0.0
2930
-                     */
2931
-                    ?>
2926
+					/**
2927
+					 * Filter signup page forgot password form link.
2928
+					 *
2929
+					 * @since 1.0.0
2930
+					 */
2931
+					?>
2932 2932
                     <a href="<?php echo geodir_login_url(array('forgot' => true)); ?>"
2933 2933
                        class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div>
2934 2934
         </form>
2935 2935
     <?php }
2936 2936
 
2937
-    echo $after_widget;
2937
+	echo $after_widget;
2938 2938
 }
2939 2939
 
2940 2940
 
@@ -2953,284 +2953,284 @@  discard block
 block discarded – undo
2953 2953
  * @param array|string $instance The settings for the particular instance of the widget.
2954 2954
  */
2955 2955
 function geodir_popular_postview_output($args = '', $instance = '') {
2956
-    global $gd_session;
2956
+	global $gd_session;
2957 2957
 	
2958
-    // prints the widget
2959
-    extract($args, EXTR_SKIP);
2960
-
2961
-    echo $before_widget;
2962
-
2963
-    /** This filter is documented in geodirectory_widgets.php */
2964
-    $title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2965
-    /**
2966
-     * Filter the widget post type.
2967
-     *
2968
-     * @since 1.0.0
2969
-     * @param string $instance['post_type'] Post type of listing.
2970
-     */
2971
-    $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2972
-    /**
2973
-     * Filter the widget's term.
2974
-     *
2975
-     * @since 1.0.0
2976
-     * @param string $instance['category'] Filter by term. Can be any valid term.
2977
-     */
2978
-    $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2979
-    /**
2980
-     * Filter the widget listings limit.
2981
-     *
2982
-     * @since 1.0.0
2983
-     * @param string $instance['post_number'] Number of listings to display.
2984
-     */
2985
-    $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2986
-    /**
2987
-     * Filter widget's "layout" type.
2988
-     *
2989
-     * @since 1.0.0
2990
-     * @param string $instance['layout'] Widget layout type.
2991
-     */
2992
-    $layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
2993
-    /**
2994
-     * Filter widget's "add_location_filter" value.
2995
-     *
2996
-     * @since 1.0.0
2997
-     * @param string|bool $instance['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
2998
-     */
2999
-    $add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3000
-    /**
3001
-     * Filter widget's listing width.
3002
-     *
3003
-     * @since 1.0.0
3004
-     * @param string $instance['listing_width'] Listing width.
3005
-     */
3006
-    $listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3007
-    /**
3008
-     * Filter widget's "list_sort" type.
3009
-     *
3010
-     * @since 1.0.0
3011
-     * @param string $instance['list_sort'] Listing sort by type.
3012
-     */
3013
-    $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3014
-    $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3015
-
3016
-    // set post type to current viewing post type
3017
-    if ($use_viewing_post_type) {
3018
-        $current_post_type = geodir_get_current_posttype();
3019
-        if ($current_post_type != '' && $current_post_type != $post_type) {
3020
-            $post_type = $current_post_type;
3021
-            $category = array(); // old post type category will not work for current changed post type
3022
-        }
3023
-    }
3024
-    // replace widget title dynamically
3025
-    $posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory');
3026
-    $posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3027
-
3028
-    $title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3029
-    $title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3030
-
3031
-    if (isset($instance['character_count'])) {
3032
-        /**
3033
-         * Filter the widget's excerpt character count.
3034
-         *
3035
-         * @since 1.0.0
3036
-         * @param int $instance['character_count'] Excerpt character count.
3037
-         */
3038
-        $character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3039
-    } else {
3040
-        $character_count = '';
3041
-    }
3042
-
3043
-    if (empty($title) || $title == 'All') {
3044
-        $title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory');
3045
-    }
3046
-
3047
-    $location_url = array();
3048
-    $city = get_query_var('gd_city');
3049
-    if (!empty($city)) {
3050
-        $country = get_query_var('gd_country');
3051
-        $region = get_query_var('gd_region');
3052
-
3053
-        $geodir_show_location_url = get_option('geodir_show_location_url');
3054
-
3055
-        if ($geodir_show_location_url == 'all') {
3056
-            if ($country != '') {
3057
-                $location_url[] = $country;
3058
-            }
3059
-
3060
-            if ($region != '') {
3061
-                $location_url[] = $region;
3062
-            }
3063
-        } else if ($geodir_show_location_url == 'country_city') {
3064
-            if ($country != '') {
3065
-                $location_url[] = $country;
3066
-            }
3067
-        } else if ($geodir_show_location_url == 'region_city') {
3068
-            if ($region != '') {
3069
-                $location_url[] = $region;
3070
-            }
3071
-        }
2958
+	// prints the widget
2959
+	extract($args, EXTR_SKIP);
2960
+
2961
+	echo $before_widget;
2962
+
2963
+	/** This filter is documented in geodirectory_widgets.php */
2964
+	$title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2965
+	/**
2966
+	 * Filter the widget post type.
2967
+	 *
2968
+	 * @since 1.0.0
2969
+	 * @param string $instance['post_type'] Post type of listing.
2970
+	 */
2971
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2972
+	/**
2973
+	 * Filter the widget's term.
2974
+	 *
2975
+	 * @since 1.0.0
2976
+	 * @param string $instance['category'] Filter by term. Can be any valid term.
2977
+	 */
2978
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2979
+	/**
2980
+	 * Filter the widget listings limit.
2981
+	 *
2982
+	 * @since 1.0.0
2983
+	 * @param string $instance['post_number'] Number of listings to display.
2984
+	 */
2985
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2986
+	/**
2987
+	 * Filter widget's "layout" type.
2988
+	 *
2989
+	 * @since 1.0.0
2990
+	 * @param string $instance['layout'] Widget layout type.
2991
+	 */
2992
+	$layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
2993
+	/**
2994
+	 * Filter widget's "add_location_filter" value.
2995
+	 *
2996
+	 * @since 1.0.0
2997
+	 * @param string|bool $instance['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
2998
+	 */
2999
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3000
+	/**
3001
+	 * Filter widget's listing width.
3002
+	 *
3003
+	 * @since 1.0.0
3004
+	 * @param string $instance['listing_width'] Listing width.
3005
+	 */
3006
+	$listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3007
+	/**
3008
+	 * Filter widget's "list_sort" type.
3009
+	 *
3010
+	 * @since 1.0.0
3011
+	 * @param string $instance['list_sort'] Listing sort by type.
3012
+	 */
3013
+	$list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3014
+	$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3015
+
3016
+	// set post type to current viewing post type
3017
+	if ($use_viewing_post_type) {
3018
+		$current_post_type = geodir_get_current_posttype();
3019
+		if ($current_post_type != '' && $current_post_type != $post_type) {
3020
+			$post_type = $current_post_type;
3021
+			$category = array(); // old post type category will not work for current changed post type
3022
+		}
3023
+	}
3024
+	// replace widget title dynamically
3025
+	$posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory');
3026
+	$posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3027
+
3028
+	$title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3029
+	$title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3030
+
3031
+	if (isset($instance['character_count'])) {
3032
+		/**
3033
+		 * Filter the widget's excerpt character count.
3034
+		 *
3035
+		 * @since 1.0.0
3036
+		 * @param int $instance['character_count'] Excerpt character count.
3037
+		 */
3038
+		$character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3039
+	} else {
3040
+		$character_count = '';
3041
+	}
3072 3042
 
3073
-        $location_url[] = $city;
3074
-    }
3043
+	if (empty($title) || $title == 'All') {
3044
+		$title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory');
3045
+	}
3075 3046
 
3076
-    $location_url = implode('/', $location_url);
3077
-    $skip_location = false;
3078
-    if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3079
-        $skip_location = true;
3080
-        $gd_session->un_set('gd_multi_location');
3081
-    }
3047
+	$location_url = array();
3048
+	$city = get_query_var('gd_city');
3049
+	if (!empty($city)) {
3050
+		$country = get_query_var('gd_country');
3051
+		$region = get_query_var('gd_region');
3082 3052
 
3083
-    if (get_option('permalink_structure')) {
3084
-        $viewall_url = get_post_type_archive_link($post_type);
3085
-    } else {
3086
-        $viewall_url = get_post_type_archive_link($post_type);
3087
-    }
3053
+		$geodir_show_location_url = get_option('geodir_show_location_url');
3088 3054
 
3089
-    if (!empty($category) && $category[0] != '0') {
3090
-        global $geodir_add_location_url;
3055
+		if ($geodir_show_location_url == 'all') {
3056
+			if ($country != '') {
3057
+				$location_url[] = $country;
3058
+			}
3059
+
3060
+			if ($region != '') {
3061
+				$location_url[] = $region;
3062
+			}
3063
+		} else if ($geodir_show_location_url == 'country_city') {
3064
+			if ($country != '') {
3065
+				$location_url[] = $country;
3066
+			}
3067
+		} else if ($geodir_show_location_url == 'region_city') {
3068
+			if ($region != '') {
3069
+				$location_url[] = $region;
3070
+			}
3071
+		}
3091 3072
 
3092
-        $geodir_add_location_url = '0';
3073
+		$location_url[] = $city;
3074
+	}
3093 3075
 
3094
-        if ($add_location_filter != '0') {
3095
-            $geodir_add_location_url = '1';
3096
-        }
3076
+	$location_url = implode('/', $location_url);
3077
+	$skip_location = false;
3078
+	if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3079
+		$skip_location = true;
3080
+		$gd_session->un_set('gd_multi_location');
3081
+	}
3097 3082
 
3098
-        $viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3083
+	if (get_option('permalink_structure')) {
3084
+		$viewall_url = get_post_type_archive_link($post_type);
3085
+	} else {
3086
+		$viewall_url = get_post_type_archive_link($post_type);
3087
+	}
3099 3088
 
3100
-        $geodir_add_location_url = NULL;
3101
-    }
3102
-    if ($skip_location) {
3103
-        $gd_session->set('gd_multi_location', 1);
3104
-    }
3089
+	if (!empty($category) && $category[0] != '0') {
3090
+		global $geodir_add_location_url;
3105 3091
 
3106
-    if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3092
+		$geodir_add_location_url = '0';
3107 3093
 
3108
-    $query_args = array(
3109
-        'posts_per_page' => $post_number,
3110
-        'is_geodir_loop' => true,
3111
-        'gd_location' => $add_location_filter ? true : false,
3112
-        'post_type' => $post_type,
3113
-        'order_by' => $list_sort
3114
-    );
3094
+		if ($add_location_filter != '0') {
3095
+			$geodir_add_location_url = '1';
3096
+		}
3115 3097
 
3116
-    if ($character_count) {
3117
-        $query_args['excerpt_length'] = $character_count;
3118
-    }
3098
+		$viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3099
+
3100
+		$geodir_add_location_url = NULL;
3101
+	}
3102
+	if ($skip_location) {
3103
+		$gd_session->set('gd_multi_location', 1);
3104
+	}
3119 3105
 
3120
-    if (!empty($instance['show_featured_only'])) {
3121
-        $query_args['show_featured_only'] = 1;
3122
-    }
3106
+	if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3123 3107
 
3124
-    if (!empty($instance['show_special_only'])) {
3125
-        $query_args['show_special_only'] = 1;
3126
-    }
3108
+	$query_args = array(
3109
+		'posts_per_page' => $post_number,
3110
+		'is_geodir_loop' => true,
3111
+		'gd_location' => $add_location_filter ? true : false,
3112
+		'post_type' => $post_type,
3113
+		'order_by' => $list_sort
3114
+	);
3127 3115
 
3128
-    if (!empty($instance['with_pics_only'])) {
3129
-        $query_args['with_pics_only'] = 0;
3130
-        $query_args['featured_image_only'] = 1;
3131
-    }
3116
+	if ($character_count) {
3117
+		$query_args['excerpt_length'] = $character_count;
3118
+	}
3132 3119
 
3133
-    if (!empty($instance['with_videos_only'])) {
3134
-        $query_args['with_videos_only'] = 1;
3135
-    }
3136
-    $with_no_results = !empty($instance['without_no_results']) ? false : true;
3120
+	if (!empty($instance['show_featured_only'])) {
3121
+		$query_args['show_featured_only'] = 1;
3122
+	}
3137 3123
 
3138
-    if (!empty($category) && $category[0] != '0') {
3139
-        $category_taxonomy = geodir_get_taxonomies($post_type);
3124
+	if (!empty($instance['show_special_only'])) {
3125
+		$query_args['show_special_only'] = 1;
3126
+	}
3140 3127
 
3141
-        ######### WPML #########
3142
-        if (function_exists('icl_object_id')) {
3143
-            $category = gd_lang_object_ids($category, $category_taxonomy[0]);
3144
-        }
3145
-        ######### WPML #########
3128
+	if (!empty($instance['with_pics_only'])) {
3129
+		$query_args['with_pics_only'] = 0;
3130
+		$query_args['featured_image_only'] = 1;
3131
+	}
3132
+
3133
+	if (!empty($instance['with_videos_only'])) {
3134
+		$query_args['with_videos_only'] = 1;
3135
+	}
3136
+	$with_no_results = !empty($instance['without_no_results']) ? false : true;
3137
+
3138
+	if (!empty($category) && $category[0] != '0') {
3139
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3140
+
3141
+		######### WPML #########
3142
+		if (function_exists('icl_object_id')) {
3143
+			$category = gd_lang_object_ids($category, $category_taxonomy[0]);
3144
+		}
3145
+		######### WPML #########
3146 3146
 
3147
-        $tax_query = array(
3148
-            'taxonomy' => $category_taxonomy[0],
3149
-            'field' => 'id',
3150
-            'terms' => $category
3151
-        );
3147
+		$tax_query = array(
3148
+			'taxonomy' => $category_taxonomy[0],
3149
+			'field' => 'id',
3150
+			'terms' => $category
3151
+		);
3152 3152
 
3153
-        $query_args['tax_query'] = array($tax_query);
3154
-    }
3153
+		$query_args['tax_query'] = array($tax_query);
3154
+	}
3155 3155
 
3156
-    global $gridview_columns_widget, $geodir_is_widget_listing;
3156
+	global $gridview_columns_widget, $geodir_is_widget_listing;
3157 3157
 
3158
-    $widget_listings = geodir_get_widget_listings($query_args);
3158
+	$widget_listings = geodir_get_widget_listings($query_args);
3159 3159
 
3160
-    if (!empty($widget_listings) || $with_no_results) {
3161
-        ?>
3160
+	if (!empty($widget_listings) || $with_no_results) {
3161
+		?>
3162 3162
         <div class="geodir_locations geodir_location_listing">
3163 3163
 
3164 3164
             <?php
3165
-            /**
3166
-             * Called before the div containing the title and view all link in popular post view widget.
3167
-             *
3168
-             * @since 1.0.0
3169
-             */
3170
-            do_action('geodir_before_view_all_link_in_widget'); ?>
3165
+			/**
3166
+			 * Called before the div containing the title and view all link in popular post view widget.
3167
+			 *
3168
+			 * @since 1.0.0
3169
+			 */
3170
+			do_action('geodir_before_view_all_link_in_widget'); ?>
3171 3171
             <div class="geodir_list_heading clearfix">
3172 3172
                 <?php echo $before_title . $title . $after_title; ?>
3173 3173
                 <a href="<?php echo $viewall_url; ?>"
3174 3174
                    class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3175 3175
             </div>
3176 3176
             <?php
3177
-            /**
3178
-             * Called after the div containing the title and view all link in popular post view widget.
3179
-             *
3180
-             * @since 1.0.0
3181
-             */
3182
-            do_action('geodir_after_view_all_link_in_widget'); ?>
3177
+			/**
3178
+			 * Called after the div containing the title and view all link in popular post view widget.
3179
+			 *
3180
+			 * @since 1.0.0
3181
+			 */
3182
+			do_action('geodir_after_view_all_link_in_widget'); ?>
3183 3183
             <?php
3184
-            if (strstr($layout, 'gridview')) {
3185
-                $listing_view_exp = explode('_', $layout);
3186
-                $gridview_columns_widget = $layout;
3187
-                $layout = $listing_view_exp[0];
3188
-            } else {
3189
-                $gridview_columns_widget = '';
3190
-            }
3191
-
3192
-            /**
3193
-             * Filter the widget listing listview template path.
3194
-             *
3195
-             * @since 1.0.0
3196
-             */
3197
-            $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3198
-            if (!isset($character_count)) {
3199
-                /**
3200
-                 * Filter the widget's excerpt character count.
3201
-                 *
3202
-                 * @since 1.0.0
3203
-                 * @param int $instance['character_count'] Excerpt character count.
3204
-                 */
3205
-                $character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3206
-            }
3207
-
3208
-            global $post, $map_jason, $map_canvas_arr;
3209
-
3210
-            $current_post = $post;
3211
-            $current_map_jason = $map_jason;
3212
-            $current_map_canvas_arr = $map_canvas_arr;
3213
-            $geodir_is_widget_listing = true;
3214
-
3215
-            /**
3216
-             * Includes related listing listview template.
3217
-             *
3218
-             * @since 1.0.0
3219
-             */
3220
-            include($template);
3221
-
3222
-            $geodir_is_widget_listing = false;
3223
-
3224
-            $GLOBALS['post'] = $current_post;
3225
-            if (!empty($current_post))
3226
-                setup_postdata($current_post);
3227
-            $map_jason = $current_map_jason;
3228
-            $map_canvas_arr = $current_map_canvas_arr;
3229
-            ?>
3184
+			if (strstr($layout, 'gridview')) {
3185
+				$listing_view_exp = explode('_', $layout);
3186
+				$gridview_columns_widget = $layout;
3187
+				$layout = $listing_view_exp[0];
3188
+			} else {
3189
+				$gridview_columns_widget = '';
3190
+			}
3191
+
3192
+			/**
3193
+			 * Filter the widget listing listview template path.
3194
+			 *
3195
+			 * @since 1.0.0
3196
+			 */
3197
+			$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3198
+			if (!isset($character_count)) {
3199
+				/**
3200
+				 * Filter the widget's excerpt character count.
3201
+				 *
3202
+				 * @since 1.0.0
3203
+				 * @param int $instance['character_count'] Excerpt character count.
3204
+				 */
3205
+				$character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3206
+			}
3207
+
3208
+			global $post, $map_jason, $map_canvas_arr;
3209
+
3210
+			$current_post = $post;
3211
+			$current_map_jason = $map_jason;
3212
+			$current_map_canvas_arr = $map_canvas_arr;
3213
+			$geodir_is_widget_listing = true;
3214
+
3215
+			/**
3216
+			 * Includes related listing listview template.
3217
+			 *
3218
+			 * @since 1.0.0
3219
+			 */
3220
+			include($template);
3221
+
3222
+			$geodir_is_widget_listing = false;
3223
+
3224
+			$GLOBALS['post'] = $current_post;
3225
+			if (!empty($current_post))
3226
+				setup_postdata($current_post);
3227
+			$map_jason = $current_map_jason;
3228
+			$map_canvas_arr = $current_map_canvas_arr;
3229
+			?>
3230 3230
         </div>
3231 3231
     <?php
3232
-    }
3233
-    echo $after_widget;
3232
+	}
3233
+	echo $after_widget;
3234 3234
 
3235 3235
 }
3236 3236
 
@@ -3253,26 +3253,26 @@  discard block
 block discarded – undo
3253 3253
  */
3254 3254
 function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type)
3255 3255
 {
3256
-    global $wpdb, $plugin_prefix;
3256
+	global $wpdb, $plugin_prefix;
3257 3257
 
3258
-    $detail_table = $plugin_prefix . $post_type . '_detail';
3258
+	$detail_table = $plugin_prefix . $post_type . '_detail';
3259 3259
 
3260
-    $sql = "SELECT COALESCE(SUM(rating_count),0) FROM " . $detail_table . " WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(" . $term_id . ", " . $taxonomy . ")";
3260
+	$sql = "SELECT COALESCE(SUM(rating_count),0) FROM " . $detail_table . " WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(" . $term_id . ", " . $taxonomy . ")";
3261 3261
 
3262
-    /**
3263
-     * Filter count review sql query.
3264
-     *
3265
-     * @since 1.5.1
3266
-     * @param string $sql Database sql query..
3267
-     * @param int $term_id The term ID.
3268
-     * @param int $taxonomy The taxonomy Id.
3269
-     * @param string $post_type The post type.
3270
-     */
3271
-    $sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3262
+	/**
3263
+	 * Filter count review sql query.
3264
+	 *
3265
+	 * @since 1.5.1
3266
+	 * @param string $sql Database sql query..
3267
+	 * @param int $term_id The term ID.
3268
+	 * @param int $taxonomy The taxonomy Id.
3269
+	 * @param string $post_type The post type.
3270
+	 */
3271
+	$sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3272 3272
 
3273
-    $count = $wpdb->get_var($sql);
3273
+	$count = $wpdb->get_var($sql);
3274 3274
 
3275
-    return $count;
3275
+	return $count;
3276 3276
 }
3277 3277
 
3278 3278
 /**
@@ -3285,53 +3285,53 @@  discard block
 block discarded – undo
3285 3285
  */
3286 3286
 function geodir_count_reviews_by_terms($force_update = false)
3287 3287
 {
3288
-    /**
3289
-     * Filter review count option data.
3290
-     *
3291
-     * @since 1.0.0
3292
-     * @param bool $force_update Force update option value?. Default.false.
3293
-     */
3294
-    $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update);
3295
-    if (!empty($option_data)) {
3296
-        return $option_data;
3297
-    }
3288
+	/**
3289
+	 * Filter review count option data.
3290
+	 *
3291
+	 * @since 1.0.0
3292
+	 * @param bool $force_update Force update option value?. Default.false.
3293
+	 */
3294
+	$option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update);
3295
+	if (!empty($option_data)) {
3296
+		return $option_data;
3297
+	}
3298 3298
 
3299
-    $option_data = get_option('geodir_global_review_count');
3299
+	$option_data = get_option('geodir_global_review_count');
3300 3300
 
3301
-    if (!$option_data OR $force_update) {
3302
-        $post_types = geodir_get_posttypes();
3303
-        $term_array = array();
3304
-        foreach ($post_types as $post_type) {
3301
+	if (!$option_data OR $force_update) {
3302
+		$post_types = geodir_get_posttypes();
3303
+		$term_array = array();
3304
+		foreach ($post_types as $post_type) {
3305 3305
 
3306
-            $taxonomy = geodir_get_taxonomies($post_type);
3307
-            $taxonomy = $taxonomy[0];
3306
+			$taxonomy = geodir_get_taxonomies($post_type);
3307
+			$taxonomy = $taxonomy[0];
3308 3308
 
3309
-            $args = array(
3310
-                'hide_empty' => false
3311
-            );
3309
+			$args = array(
3310
+				'hide_empty' => false
3311
+			);
3312 3312
 
3313
-            $terms = get_terms($taxonomy, $args);
3313
+			$terms = get_terms($taxonomy, $args);
3314 3314
 
3315
-            foreach ($terms as $term) {
3316
-                $count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3317
-                $children = get_term_children($term->term_id, $taxonomy);
3318
-                /*if ( is_array( $children ) ) {
3315
+			foreach ($terms as $term) {
3316
+				$count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3317
+				$children = get_term_children($term->term_id, $taxonomy);
3318
+				/*if ( is_array( $children ) ) {
3319 3319
 					foreach ( $children as $child_id ) {
3320 3320
 						$child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type);
3321 3321
 						$count = $count + $child_count;
3322 3322
 					}
3323 3323
 				}*/
3324
-                $term_array[$term->term_id] = $count;
3325
-            }
3326
-        }
3324
+				$term_array[$term->term_id] = $count;
3325
+			}
3326
+		}
3327 3327
 
3328
-        update_option('geodir_global_review_count', $term_array);
3329
-        //clear cache
3330
-        wp_cache_delete('geodir_global_review_count');
3331
-        return $term_array;
3332
-    } else {
3333
-        return $option_data;
3334
-    }
3328
+		update_option('geodir_global_review_count', $term_array);
3329
+		//clear cache
3330
+		wp_cache_delete('geodir_global_review_count');
3331
+		return $term_array;
3332
+	} else {
3333
+		return $option_data;
3334
+	}
3335 3335
 }
3336 3336
 
3337 3337
 /**
@@ -3343,15 +3343,15 @@  discard block
 block discarded – undo
3343 3343
  */
3344 3344
 function geodir_term_review_count_force_update($new_status, $old_status='', $post='')
3345 3345
 {
3346
-    if(isset($_REQUEST['action']) && $_REQUEST['action']=='geodir_import_export'){return;}//do not run if importing listings
3347
-
3348
-    if(isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')){
3349
-        return;
3350
-    }
3351
-    if($new_status!=$old_status) {
3352
-        geodir_count_reviews_by_terms(true);
3353
-    }
3354
-    return true;
3346
+	if(isset($_REQUEST['action']) && $_REQUEST['action']=='geodir_import_export'){return;}//do not run if importing listings
3347
+
3348
+	if(isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')){
3349
+		return;
3350
+	}
3351
+	if($new_status!=$old_status) {
3352
+		geodir_count_reviews_by_terms(true);
3353
+	}
3354
+	return true;
3355 3355
 }
3356 3356
 
3357 3357
 
@@ -3370,15 +3370,15 @@  discard block
 block discarded – undo
3370 3370
 function geodir_count_posts_by_term($data, $term)
3371 3371
 {
3372 3372
 
3373
-    if ($data) {
3374
-        if (isset($data[$term->term_id])) {
3375
-            return $data[$term->term_id];
3376
-        } else {
3377
-            return 0;
3378
-        }
3379
-    } else {
3380
-        return $term->count;
3381
-    }
3373
+	if ($data) {
3374
+		if (isset($data[$term->term_id])) {
3375
+			return $data[$term->term_id];
3376
+		} else {
3377
+			return 0;
3378
+		}
3379
+	} else {
3380
+		return $term->count;
3381
+	}
3382 3382
 }
3383 3383
 
3384 3384
 /**
@@ -3391,8 +3391,8 @@  discard block
 block discarded – undo
3391 3391
  */
3392 3392
 function geodir_sort_terms_by_count($terms)
3393 3393
 {
3394
-    usort($terms, "geodir_sort_by_count_obj");
3395
-    return $terms;
3394
+	usort($terms, "geodir_sort_by_count_obj");
3395
+	return $terms;
3396 3396
 }
3397 3397
 
3398 3398
 /**
@@ -3405,8 +3405,8 @@  discard block
 block discarded – undo
3405 3405
  */
3406 3406
 function geodir_sort_terms_by_review_count($terms)
3407 3407
 {
3408
-    usort($terms, "geodir_sort_by_review_count_obj");
3409
-    return $terms;
3408
+	usort($terms, "geodir_sort_by_review_count_obj");
3409
+	return $terms;
3410 3410
 }
3411 3411
 
3412 3412
 /**
@@ -3420,12 +3420,12 @@  discard block
 block discarded – undo
3420 3420
  */
3421 3421
 function geodir_sort_terms($terms, $sort = 'count')
3422 3422
 {
3423
-    if ($sort == 'count') {
3424
-        return geodir_sort_terms_by_count($terms);
3425
-    }
3426
-    if ($sort == 'review_count') {
3427
-        return geodir_sort_terms_by_review_count($terms);
3428
-    }
3423
+	if ($sort == 'count') {
3424
+		return geodir_sort_terms_by_count($terms);
3425
+	}
3426
+	if ($sort == 'review_count') {
3427
+		return geodir_sort_terms_by_review_count($terms);
3428
+	}
3429 3429
 }
3430 3430
 
3431 3431
 /*-----------------------------------------------------------------------------------*/
@@ -3442,7 +3442,7 @@  discard block
 block discarded – undo
3442 3442
  */
3443 3443
 function geodir_sort_by_count($a, $b)
3444 3444
 {
3445
-    return $a['count'] < $b['count'];
3445
+	return $a['count'] < $b['count'];
3446 3446
 }
3447 3447
 
3448 3448
 /**
@@ -3456,7 +3456,7 @@  discard block
 block discarded – undo
3456 3456
  */
3457 3457
 function geodir_sort_by_count_obj($a, $b)
3458 3458
 {
3459
-    return $a->count < $b->count;
3459
+	return $a->count < $b->count;
3460 3460
 }
3461 3461
 
3462 3462
 /**
@@ -3470,7 +3470,7 @@  discard block
 block discarded – undo
3470 3470
  */
3471 3471
 function geodir_sort_by_review_count_obj($a, $b)
3472 3472
 {
3473
-    return $a->review_count < $b->review_count;
3473
+	return $a->review_count < $b->review_count;
3474 3474
 }
3475 3475
 
3476 3476
 /**
@@ -3480,43 +3480,43 @@  discard block
 block discarded – undo
3480 3480
  * @package GeoDirectory
3481 3481
  */
3482 3482
 function geodir_load_textdomain() {
3483
-    /**
3484
-     * Filter the plugin locale.
3485
-     *
3486
-     * @since 1.4.2
3487
-     * @package GeoDirectory
3488
-     */
3489
-    $locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
3490
-
3491
-    load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo');
3492
-    load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages');
3483
+	/**
3484
+	 * Filter the plugin locale.
3485
+	 *
3486
+	 * @since 1.4.2
3487
+	 * @package GeoDirectory
3488
+	 */
3489
+	$locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
3490
+
3491
+	load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo');
3492
+	load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages');
3493
+
3494
+	/**
3495
+	 * Define language constants.
3496
+	 *
3497
+	 * @since 1.0.0
3498
+	 */
3499
+	require_once(geodir_plugin_path() . '/language.php');
3500
+
3501
+	$language_file = geodir_plugin_path() . '/db-language.php';
3502
+
3503
+	// Load language string file if not created yet
3504
+	if (!file_exists($language_file)) {
3505
+		geodirectory_load_db_language();
3506
+	}
3493 3507
 
3494
-    /**
3495
-     * Define language constants.
3496
-     *
3497
-     * @since 1.0.0
3498
-     */
3499
-    require_once(geodir_plugin_path() . '/language.php');
3500
-
3501
-    $language_file = geodir_plugin_path() . '/db-language.php';
3502
-
3503
-    // Load language string file if not created yet
3504
-    if (!file_exists($language_file)) {
3505
-        geodirectory_load_db_language();
3506
-    }
3507
-
3508
-    if (file_exists($language_file)) {
3509
-        /**
3510
-         * Language strings from database.
3511
-         *
3512
-         * @since 1.4.2
3513
-         */
3514
-        try {
3515
-            require_once($language_file);
3516
-        } catch(Exception $e) {
3517
-            error_log('Language Error: ' . $e->getMessage());
3518
-        }
3519
-    }
3508
+	if (file_exists($language_file)) {
3509
+		/**
3510
+		 * Language strings from database.
3511
+		 *
3512
+		 * @since 1.4.2
3513
+		 */
3514
+		try {
3515
+			require_once($language_file);
3516
+		} catch(Exception $e) {
3517
+			error_log('Language Error: ' . $e->getMessage());
3518
+		}
3519
+	}
3520 3520
 }
3521 3521
 
3522 3522
 /**
@@ -3530,66 +3530,66 @@  discard block
 block discarded – undo
3530 3530
  * @return bool True if file created otherwise false
3531 3531
  */
3532 3532
 function geodirectory_load_db_language() {
3533
-    global $wp_filesystem;
3534
-    if( empty( $wp_filesystem ) ) {
3535
-        require_once( ABSPATH .'/wp-admin/includes/file.php' );
3536
-        WP_Filesystem();
3537
-        global $wp_filesystem;
3538
-    }
3539
-
3540
-    $language_file = geodir_plugin_path() . '/db-language.php';
3541
-
3542
-    if(is_file($language_file) && !is_writable($language_file))
3543
-        return false; // Not possible to create.
3544
-
3545
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3546
-        return false; // Not possible to create.
3547
-
3548
-    $contents_strings = array();
3533
+	global $wp_filesystem;
3534
+	if( empty( $wp_filesystem ) ) {
3535
+		require_once( ABSPATH .'/wp-admin/includes/file.php' );
3536
+		WP_Filesystem();
3537
+		global $wp_filesystem;
3538
+	}
3549 3539
 
3550
-    /**
3551
-     * Filter the language string from database to translate via po editor
3552
-     *
3553
-     * @since 1.4.2
3554
-     *
3555
-     * @param array $contents_strings Array of strings.
3556
-     */
3557
-    $contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
3558
-
3559
-    $contents_strings = array_unique($contents_strings);
3560
-
3561
-    $contents_head = array();
3562
-    $contents_head[] = "<?php";
3563
-    $contents_head[] = "/**";
3564
-    $contents_head[] = " * Translate language string stored in database. Ex: Custom Fields";
3565
-    $contents_head[] = " *";
3566
-    $contents_head[] = " * @package GeoDirectory";
3567
-    $contents_head[] = " * @since 1.4.2";
3568
-    $contents_head[] = " */";
3569
-    $contents_head[] = "";
3570
-    $contents_head[] = "// Language keys";
3571
-
3572
-    $contents_foot = array();
3573
-    $contents_foot[] = "";
3574
-    $contents_foot[] = "";
3575
-
3576
-    $contents = implode(PHP_EOL, $contents_head);
3577
-
3578
-    if (!empty($contents_strings)) {
3579
-        foreach ( $contents_strings as $string ) {
3580
-            if (is_scalar($string) && $string != '') {
3581
-                $string = str_replace("'", "\'", $string);
3582
-                $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
3583
-            }
3584
-        }
3585
-    }
3540
+	$language_file = geodir_plugin_path() . '/db-language.php';
3541
+
3542
+	if(is_file($language_file) && !is_writable($language_file))
3543
+		return false; // Not possible to create.
3544
+
3545
+	if(!is_file($language_file) && !is_writable(dirname($language_file)))
3546
+		return false; // Not possible to create.
3547
+
3548
+	$contents_strings = array();
3549
+
3550
+	/**
3551
+	 * Filter the language string from database to translate via po editor
3552
+	 *
3553
+	 * @since 1.4.2
3554
+	 *
3555
+	 * @param array $contents_strings Array of strings.
3556
+	 */
3557
+	$contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
3558
+
3559
+	$contents_strings = array_unique($contents_strings);
3560
+
3561
+	$contents_head = array();
3562
+	$contents_head[] = "<?php";
3563
+	$contents_head[] = "/**";
3564
+	$contents_head[] = " * Translate language string stored in database. Ex: Custom Fields";
3565
+	$contents_head[] = " *";
3566
+	$contents_head[] = " * @package GeoDirectory";
3567
+	$contents_head[] = " * @since 1.4.2";
3568
+	$contents_head[] = " */";
3569
+	$contents_head[] = "";
3570
+	$contents_head[] = "// Language keys";
3571
+
3572
+	$contents_foot = array();
3573
+	$contents_foot[] = "";
3574
+	$contents_foot[] = "";
3575
+
3576
+	$contents = implode(PHP_EOL, $contents_head);
3577
+
3578
+	if (!empty($contents_strings)) {
3579
+		foreach ( $contents_strings as $string ) {
3580
+			if (is_scalar($string) && $string != '') {
3581
+				$string = str_replace("'", "\'", $string);
3582
+				$contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
3583
+			}
3584
+		}
3585
+	}
3586 3586
 
3587
-    $contents .= implode(PHP_EOL, $contents_foot);
3587
+	$contents .= implode(PHP_EOL, $contents_foot);
3588 3588
 
3589
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3590
-        return false; // Failure; could not write file.
3589
+	if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3590
+		return false; // Failure; could not write file.
3591 3591
 
3592
-    return true;
3592
+	return true;
3593 3593
 }
3594 3594
 
3595 3595
 /**
@@ -3605,31 +3605,31 @@  discard block
 block discarded – undo
3605 3605
  * @return array Translation texts.
3606 3606
  */
3607 3607
 function geodir_load_custom_field_translation($translation_texts = array()) {
3608
-    global $wpdb;
3608
+	global $wpdb;
3609 3609
 
3610
-    // Custom fields table
3611
-    $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
3612
-    $rows = $wpdb->get_results($sql);
3610
+	// Custom fields table
3611
+	$sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
3612
+	$rows = $wpdb->get_results($sql);
3613 3613
 
3614
-    if (!empty($rows)) {
3615
-        foreach($rows as $row) {
3616
-            if (!empty($row->admin_title))
3617
-                $translation_texts[] = stripslashes_deep($row->admin_title);
3614
+	if (!empty($rows)) {
3615
+		foreach($rows as $row) {
3616
+			if (!empty($row->admin_title))
3617
+				$translation_texts[] = stripslashes_deep($row->admin_title);
3618 3618
 			
3619
-            if (!empty($row->admin_desc))
3620
-                $translation_texts[] = stripslashes_deep($row->admin_desc);
3619
+			if (!empty($row->admin_desc))
3620
+				$translation_texts[] = stripslashes_deep($row->admin_desc);
3621 3621
 
3622
-            if (!empty($row->site_title))
3623
-                $translation_texts[] = stripslashes_deep($row->site_title);
3622
+			if (!empty($row->site_title))
3623
+				$translation_texts[] = stripslashes_deep($row->site_title);
3624 3624
 
3625
-            if (!empty($row->clabels))
3626
-                $translation_texts[] = stripslashes_deep($row->clabels);
3625
+			if (!empty($row->clabels))
3626
+				$translation_texts[] = stripslashes_deep($row->clabels);
3627 3627
 
3628
-            if (!empty($row->required_msg))
3629
-                $translation_texts[] = stripslashes_deep($row->required_msg);
3628
+			if (!empty($row->required_msg))
3629
+				$translation_texts[] = stripslashes_deep($row->required_msg);
3630 3630
 			
3631 3631
 			if (!empty($row->default_value))
3632
-                $translation_texts[] = stripslashes_deep($row->default_value);
3632
+				$translation_texts[] = stripslashes_deep($row->default_value);
3633 3633
 			
3634 3634
 			if (!empty($row->option_values)) {
3635 3635
 				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
@@ -3642,25 +3642,25 @@  discard block
 block discarded – undo
3642 3642
 					}
3643 3643
 				}
3644 3644
 			}
3645
-        }
3646
-    }
3645
+		}
3646
+	}
3647 3647
 	
3648
-    // Custom sorting fields table
3649
-    $sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3650
-    $rows = $wpdb->get_results($sql);
3648
+	// Custom sorting fields table
3649
+	$sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3650
+	$rows = $wpdb->get_results($sql);
3651 3651
 
3652
-    if (!empty($rows)) {
3653
-        foreach($rows as $row) {
3654
-            if (!empty($row->site_title))
3655
-                $translation_texts[] = stripslashes_deep($row->site_title);
3652
+	if (!empty($rows)) {
3653
+		foreach($rows as $row) {
3654
+			if (!empty($row->site_title))
3655
+				$translation_texts[] = stripslashes_deep($row->site_title);
3656 3656
 
3657
-            if (!empty($row->asc_title))
3658
-                $translation_texts[] = stripslashes_deep($row->asc_title);
3657
+			if (!empty($row->asc_title))
3658
+				$translation_texts[] = stripslashes_deep($row->asc_title);
3659 3659
 
3660
-            if (!empty($row->desc_title))
3661
-                $translation_texts[] = stripslashes_deep($row->desc_title);
3662
-        }
3663
-    }
3660
+			if (!empty($row->desc_title))
3661
+				$translation_texts[] = stripslashes_deep($row->desc_title);
3662
+		}
3663
+	}
3664 3664
 	
3665 3665
 	// Advance search filter fields table
3666 3666
 	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
@@ -3681,9 +3681,9 @@  discard block
 block discarded – undo
3681 3681
 		}
3682 3682
 	}
3683 3683
 
3684
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3684
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3685 3685
 
3686
-    return $translation_texts;
3686
+	return $translation_texts;
3687 3687
 }
3688 3688
 
3689 3689
 /**
@@ -3695,71 +3695,71 @@  discard block
 block discarded – undo
3695 3695
  * @return array Array of mime types.
3696 3696
  */
3697 3697
 function geodir_allowed_mime_types() {
3698
-    /**
3699
-     * Filter the list of mime types and file extensions allowed for file upload.
3700
-     *
3701
-     * @since 1.4.7
3702
-     * @package GeoDirectory
3703
-     *
3704
-     * @param array $geodir_allowed_mime_types and file extensions.
3705
-     */
3706
-    return apply_filters( 'geodir_allowed_mime_types', array(
3707
-            'Image' => array( // Image formats.
3708
-                'jpg' => 'image/jpeg',
3709
-                'jpe' => 'image/jpeg',
3710
-                'jpeg' => 'image/jpeg',
3711
-                'gif' => 'image/gif',
3712
-                'png' => 'image/png',
3713
-                'bmp' => 'image/bmp',
3714
-                'ico' => 'image/x-icon',
3715
-            ),
3716
-            'Video' => array( // Video formats.
3717
-                'asf' => 'video/x-ms-asf',
3718
-                'avi' => 'video/avi',
3719
-                'flv' => 'video/x-flv',
3720
-                'mkv' => 'video/x-matroska',
3721
-                'mp4' => 'video/mp4',
3722
-                'mpeg' => 'video/mpeg',
3723
-                'mpg' => 'video/mpeg',
3724
-                'wmv' => 'video/x-ms-wmv',
3725
-                '3gp' => 'video/3gpp',
3726
-            ),
3727
-            'Audio' => array( // Audio formats.
3728
-                'ogg' => 'audio/ogg',
3729
-                'mp3' => 'audio/mpeg',
3730
-                'wav' => 'audio/wav',
3731
-                'wma' => 'audio/x-ms-wma',
3732
-            ),
3733
-            'Text' => array( // Text formats.
3734
-                'css' => 'text/css',
3735
-                'csv' => 'text/csv',
3736
-                'htm' => 'text/html',
3737
-                'html' => 'text/html',
3738
-                'txt' => 'text/plain',
3739
-                'rtx' => 'text/richtext',
3740
-                'vtt' => 'text/vtt',
3741
-            ),
3742
-            'Application' => array( // Application formats.
3743
-                'doc' => 'application/msword',
3744
-                'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
3745
-                'exe' => 'application/x-msdownload',
3746
-                'js' => 'application/javascript',
3747
-                'odt' => 'application/vnd.oasis.opendocument.text',
3748
-                'pdf' => 'application/pdf',
3749
-                'pot' => 'application/vnd.ms-powerpoint',
3750
-                'ppt' => 'application/vnd.ms-powerpoint',
3751
-                'pptx' => 'application/vnd.ms-powerpoint',
3752
-                'psd' => 'application/octet-stream',
3753
-                'rar' => 'application/rar',
3754
-                'rtf' => 'application/rtf',
3755
-                'swf' => 'application/x-shockwave-flash',
3756
-                'tar' => 'application/x-tar',
3757
-                'xls' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3758
-                'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3759
-                'zip' => 'application/zip',
3760
-            )
3761
-        )
3762
-    );
3698
+	/**
3699
+	 * Filter the list of mime types and file extensions allowed for file upload.
3700
+	 *
3701
+	 * @since 1.4.7
3702
+	 * @package GeoDirectory
3703
+	 *
3704
+	 * @param array $geodir_allowed_mime_types and file extensions.
3705
+	 */
3706
+	return apply_filters( 'geodir_allowed_mime_types', array(
3707
+			'Image' => array( // Image formats.
3708
+				'jpg' => 'image/jpeg',
3709
+				'jpe' => 'image/jpeg',
3710
+				'jpeg' => 'image/jpeg',
3711
+				'gif' => 'image/gif',
3712
+				'png' => 'image/png',
3713
+				'bmp' => 'image/bmp',
3714
+				'ico' => 'image/x-icon',
3715
+			),
3716
+			'Video' => array( // Video formats.
3717
+				'asf' => 'video/x-ms-asf',
3718
+				'avi' => 'video/avi',
3719
+				'flv' => 'video/x-flv',
3720
+				'mkv' => 'video/x-matroska',
3721
+				'mp4' => 'video/mp4',
3722
+				'mpeg' => 'video/mpeg',
3723
+				'mpg' => 'video/mpeg',
3724
+				'wmv' => 'video/x-ms-wmv',
3725
+				'3gp' => 'video/3gpp',
3726
+			),
3727
+			'Audio' => array( // Audio formats.
3728
+				'ogg' => 'audio/ogg',
3729
+				'mp3' => 'audio/mpeg',
3730
+				'wav' => 'audio/wav',
3731
+				'wma' => 'audio/x-ms-wma',
3732
+			),
3733
+			'Text' => array( // Text formats.
3734
+				'css' => 'text/css',
3735
+				'csv' => 'text/csv',
3736
+				'htm' => 'text/html',
3737
+				'html' => 'text/html',
3738
+				'txt' => 'text/plain',
3739
+				'rtx' => 'text/richtext',
3740
+				'vtt' => 'text/vtt',
3741
+			),
3742
+			'Application' => array( // Application formats.
3743
+				'doc' => 'application/msword',
3744
+				'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
3745
+				'exe' => 'application/x-msdownload',
3746
+				'js' => 'application/javascript',
3747
+				'odt' => 'application/vnd.oasis.opendocument.text',
3748
+				'pdf' => 'application/pdf',
3749
+				'pot' => 'application/vnd.ms-powerpoint',
3750
+				'ppt' => 'application/vnd.ms-powerpoint',
3751
+				'pptx' => 'application/vnd.ms-powerpoint',
3752
+				'psd' => 'application/octet-stream',
3753
+				'rar' => 'application/rar',
3754
+				'rtf' => 'application/rtf',
3755
+				'swf' => 'application/x-shockwave-flash',
3756
+				'tar' => 'application/x-tar',
3757
+				'xls' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3758
+				'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3759
+				'zip' => 'application/zip',
3760
+			)
3761
+		)
3762
+	);
3763 3763
 }
3764 3764
 
3765 3765
 /**
@@ -3771,21 +3771,21 @@  discard block
 block discarded – undo
3771 3771
  * @return string User display name.
3772 3772
  */
3773 3773
 function geodir_get_client_name($user_id) {
3774
-    $client_name = '';
3774
+	$client_name = '';
3775 3775
 
3776
-    $user_data = get_userdata($user_id);
3776
+	$user_data = get_userdata($user_id);
3777 3777
 
3778
-    if (!empty($user_data)) {
3779
-        if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
3780
-            $client_name = trim($user_data->display_name);
3781
-        } else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
3782
-            $client_name = trim($user_data->user_nicename);
3783
-        } else {
3784
-            $client_name = trim($user_data->user_login);
3785
-        }
3786
-    }
3778
+	if (!empty($user_data)) {
3779
+		if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
3780
+			$client_name = trim($user_data->display_name);
3781
+		} else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
3782
+			$client_name = trim($user_data->user_nicename);
3783
+		} else {
3784
+			$client_name = trim($user_data->user_login);
3785
+		}
3786
+	}
3787 3787
 
3788
-    return $client_name;
3788
+	return $client_name;
3789 3789
 }
3790 3790
 
3791 3791
 
@@ -3800,125 +3800,125 @@  discard block
 block discarded – undo
3800 3800
  */
3801 3801
 function geodir_wpseo_replacements($vars){
3802 3802
 
3803
-    global $wp;
3804
-    $title = '';
3805
-    // location variables
3806
-    $gd_post_type = geodir_get_current_posttype();
3807
-    $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
3808
-    /**
3809
-     * Filter the title variables location variables array
3810
-     *
3811
-     * @since 1.5.5
3812
-     * @package GeoDirectory
3813
-     * @param array $location_array The array of location variables.
3814
-     * @param array $vars The page title variables.
3815
-     */
3816
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
3817
-    $location_titles = array();
3818
-    if(get_query_var( 'gd_country_full' )){
3819
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
3820
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
3821
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
3822
-    }
3823
-    $location_single = '';
3824
-    $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
3825
-    $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
3826
-    $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
3827
-
3828
-    $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
3829
-
3830
-    if (function_exists('get_actual_location_name')) {
3831
-        $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
3832
-        $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
3833
-        $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
3834
-    }
3835
-
3836
-    if ($gd_city != '') {
3837
-        if ($gd_city_actual != '') {
3838
-            $gd_city = $gd_city_actual;
3839
-        } else {
3840
-            $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
3841
-            $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
3842
-            $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
3843
-        }
3844
-        $location_single = $gd_city;
3845
-
3846
-    } else if ($gd_region != '') {
3847
-        if ($gd_region_actual != '') {
3848
-            $gd_region = $gd_region_actual;
3849
-        } else {
3850
-            $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
3851
-            $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
3852
-            $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
3853
-        }
3803
+	global $wp;
3804
+	$title = '';
3805
+	// location variables
3806
+	$gd_post_type = geodir_get_current_posttype();
3807
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
3808
+	/**
3809
+	 * Filter the title variables location variables array
3810
+	 *
3811
+	 * @since 1.5.5
3812
+	 * @package GeoDirectory
3813
+	 * @param array $location_array The array of location variables.
3814
+	 * @param array $vars The page title variables.
3815
+	 */
3816
+	$location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
3817
+	$location_titles = array();
3818
+	if(get_query_var( 'gd_country_full' )){
3819
+		if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
3820
+		if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
3821
+		if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
3822
+	}
3823
+	$location_single = '';
3824
+	$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
3825
+	$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
3826
+	$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
3854 3827
 
3855
-        $location_single = $gd_region;
3856
-    } else if ($gd_country != '') {
3857
-        if ($gd_country_actual != '') {
3858
-            $gd_country = $gd_country_actual;
3859
-        } else {
3860
-            $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
3861
-            $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
3862
-            $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
3863
-        }
3828
+	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
3864 3829
 
3865
-        $location_single = $gd_country;
3866
-    }
3830
+	if (function_exists('get_actual_location_name')) {
3831
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
3832
+		$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
3833
+		$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
3834
+	}
3867 3835
 
3868
-    if (!empty($location_array)) {
3836
+	if ($gd_city != '') {
3837
+		if ($gd_city_actual != '') {
3838
+			$gd_city = $gd_city_actual;
3839
+		} else {
3840
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
3841
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
3842
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
3843
+		}
3844
+		$location_single = $gd_city;
3845
+
3846
+	} else if ($gd_region != '') {
3847
+		if ($gd_region_actual != '') {
3848
+			$gd_region = $gd_region_actual;
3849
+		} else {
3850
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
3851
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
3852
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
3853
+		}
3869 3854
 
3870
-        $actual_location_name = function_exists('get_actual_location_name') ? true : false;
3871
-        $location_array = array_reverse($location_array);
3855
+		$location_single = $gd_region;
3856
+	} else if ($gd_country != '') {
3857
+		if ($gd_country_actual != '') {
3858
+			$gd_country = $gd_country_actual;
3859
+		} else {
3860
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
3861
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
3862
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
3863
+		}
3872 3864
 
3873
-        foreach ($location_array as $location_type => $location) {
3874
-            $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
3875
-            $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
3865
+		$location_single = $gd_country;
3866
+	}
3876 3867
 
3877
-            $location_name = geodir_ucwords($gd_location_link_text);
3878
-            $location_name = __($location_name, 'geodirectory');
3868
+	if (!empty($location_array)) {
3879 3869
 
3880
-            if ($actual_location_name) {
3881
-                $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
3882
-                $location_name = get_actual_location_name($location_type, $location, true);
3883
-            }
3870
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
3871
+		$location_array = array_reverse($location_array);
3884 3872
 
3885
-            $location_titles[] = $location_name;
3886
-        }
3887
-        if (!empty($location_titles)) {
3888
-            $location_titles = array_unique($location_titles);
3889
-        }
3890
-    }
3873
+		foreach ($location_array as $location_type => $location) {
3874
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
3875
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
3891 3876
 
3877
+			$location_name = geodir_ucwords($gd_location_link_text);
3878
+			$location_name = __($location_name, 'geodirectory');
3892 3879
 
3893
-    if(!empty($location_titles)) {
3894
-        $vars['%%location%%'] = implode(", ", $location_titles);
3895
-    }
3880
+			if ($actual_location_name) {
3881
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
3882
+				$location_name = get_actual_location_name($location_type, $location, true);
3883
+			}
3884
+
3885
+			$location_titles[] = $location_name;
3886
+		}
3887
+		if (!empty($location_titles)) {
3888
+			$location_titles = array_unique($location_titles);
3889
+		}
3890
+	}
3896 3891
 
3897 3892
 
3898
-    if(!empty($location_titles)) {
3899
-        $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
3900
-    }
3893
+	if(!empty($location_titles)) {
3894
+		$vars['%%location%%'] = implode(", ", $location_titles);
3895
+	}
3901 3896
 
3902 3897
 
3898
+	if(!empty($location_titles)) {
3899
+		$vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
3900
+	}
3903 3901
 
3904
-    if($location_single) {
3905
-        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
3906
-    }
3907 3902
 
3908 3903
 
3909
-    if($location_single) {
3910
-        $vars['%%location_single%%'] = $location_single;
3911
-    }
3904
+	if($location_single) {
3905
+		$vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
3906
+	}
3912 3907
 
3913
-    /**
3914
-     * Filter the title variables after standard ones have been filtered for wpseo.
3915
-     *
3916
-     * @since 1.5.7
3917
-     * @package GeoDirectory
3918
-     * @param string $vars The title with variables.
3919
-     * @param array $location_array The array of location variables.
3920
-     */
3921
-    return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
3908
+
3909
+	if($location_single) {
3910
+		$vars['%%location_single%%'] = $location_single;
3911
+	}
3912
+
3913
+	/**
3914
+	 * Filter the title variables after standard ones have been filtered for wpseo.
3915
+	 *
3916
+	 * @since 1.5.7
3917
+	 * @package GeoDirectory
3918
+	 * @param string $vars The title with variables.
3919
+	 * @param array $location_array The array of location variables.
3920
+	 */
3921
+	return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
3922 3922
 }
3923 3923
 
3924 3924
 
@@ -3928,10 +3928,10 @@  discard block
 block discarded – undo
3928 3928
 function geodir_filter_title_variables($title, $gd_page, $sep=''){
3929 3929
 
3930 3930
 
3931
-    if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
3932
-    global $post;
3933
-    //print_r($post);
3934
-    /*
3931
+	if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
3932
+	global $post;
3933
+	//print_r($post);
3934
+	/*
3935 3935
     %%date%%	                Replaced with the date of the post/page
3936 3936
     %%title%%	                Replaced with the title of the post/page
3937 3937
     %%sitename%%	            The site's name
@@ -3958,134 +3958,134 @@  discard block
 block discarded – undo
3958 3958
     %%pagenumber%%	            Replaced with the current page number
3959 3959
      */
3960 3960
 
3961
-    if ($sep == '') {
3962
-        /**
3963
-         * Filter the page title separator.
3964
-         *
3965
-         * @since 1.0.0
3966
-         * @package GeoDirectory
3967
-         * @param string $sep The separator, default: `|`.
3968
-         */
3969
-        $sep = apply_filters('geodir_page_title_separator', '|');
3970
-    }
3971
-
3972
-
3973
-    if(strpos($title,'%%title%%') !== false){
3974
-        $title = str_replace("%%title%%",$post->post_title,$title);
3975
-    }
3976
-
3977
-    if(strpos($title,'%%sitename%%') !== false){
3978
-        $title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
3979
-    }
3980
-
3981
-    if(strpos($title,'%%sitedesc%%') !== false){
3982
-        $title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
3983
-    }
3984
-
3985
-    if(strpos($title,'%%excerpt%%') !== false){
3986
-        $title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
3987
-    }
3988
-
3989
-    if(strpos($title,'%%pt_single%%') !== false){
3990
-        $single_name = '';
3991
-        if($gd_page=='search' || $gd_page=='author'){
3992
-            $geodir_post_types = get_option('geodir_post_types');
3993
-            $spt = esc_attr($_REQUEST['stype']);
3994
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
3995
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
3996
-            }
3997
-        }elseif($gd_page=='add-listing'){
3998
-            $geodir_post_types = get_option('geodir_post_types');
3999
-            $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
4000
-            if(!$spt && isset($_REQUEST['pid'])){
4001
-                $spt = get_post_type( $_REQUEST['pid'] );
4002
-            }
4003
-            if(!$spt){$spt='gd_place';}
4004
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4005
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4006
-            }
4007
-        }
4008
-        elseif($post->post_type){
4009
-            $geodir_post_types = get_option('geodir_post_types');
4010
-            if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4011
-                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
4012
-            }
3961
+	if ($sep == '') {
3962
+		/**
3963
+		 * Filter the page title separator.
3964
+		 *
3965
+		 * @since 1.0.0
3966
+		 * @package GeoDirectory
3967
+		 * @param string $sep The separator, default: `|`.
3968
+		 */
3969
+		$sep = apply_filters('geodir_page_title_separator', '|');
3970
+	}
4013 3971
 
4014 3972
 
4015
-        }
4016
-        $title = str_replace("%%pt_single%%",$single_name,$title);
4017
-    }
4018
-
4019
-    if(strpos($title,'%%pt_plural%%') !== false){
4020
-        $plural_name = '';
4021
-        if($gd_page=='search' || $gd_page=='author'){
4022
-            $geodir_post_types = get_option('geodir_post_types');
4023
-            $spt = esc_attr($_REQUEST['stype']);
4024
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4025
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4026
-            }
4027
-        }elseif($gd_page=='add-listing'){
4028
-            $geodir_post_types = get_option('geodir_post_types');
4029
-            $spt = sanitize_text_field($_REQUEST['listing_type']);
4030
-            if(!$spt){$spt='gd_place';}
4031
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4032
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4033
-            }
4034
-        }
4035
-        elseif(isset($post->post_type) && $post->post_type){
4036
-            $geodir_post_types = get_option('geodir_post_types');
4037
-            if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4038
-                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
4039
-            }
3973
+	if(strpos($title,'%%title%%') !== false){
3974
+		$title = str_replace("%%title%%",$post->post_title,$title);
3975
+	}
4040 3976
 
4041
-        }
4042
-        $title = str_replace("%%pt_plural%%",$plural_name,$title);
4043
-    }
3977
+	if(strpos($title,'%%sitename%%') !== false){
3978
+		$title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
3979
+	}
3980
+
3981
+	if(strpos($title,'%%sitedesc%%') !== false){
3982
+		$title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
3983
+	}
4044 3984
 
3985
+	if(strpos($title,'%%excerpt%%') !== false){
3986
+		$title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
3987
+	}
4045 3988
 
3989
+	if(strpos($title,'%%pt_single%%') !== false){
3990
+		$single_name = '';
3991
+		if($gd_page=='search' || $gd_page=='author'){
3992
+			$geodir_post_types = get_option('geodir_post_types');
3993
+			$spt = esc_attr($_REQUEST['stype']);
3994
+			if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
3995
+				$single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
3996
+			}
3997
+		}elseif($gd_page=='add-listing'){
3998
+			$geodir_post_types = get_option('geodir_post_types');
3999
+			$spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
4000
+			if(!$spt && isset($_REQUEST['pid'])){
4001
+				$spt = get_post_type( $_REQUEST['pid'] );
4002
+			}
4003
+			if(!$spt){$spt='gd_place';}
4004
+			if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4005
+				$single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4006
+			}
4007
+		}
4008
+		elseif($post->post_type){
4009
+			$geodir_post_types = get_option('geodir_post_types');
4010
+			if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4011
+				$single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
4012
+			}
4046 4013
 
4047
-    if(strpos($title,'%%category%%') !== false){
4048
-        $cat_name = '';
4049 4014
 
4050
-        if($gd_page=='detail') {
4051
-            if ($post->default_category) {
4052
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4053
-                $cat_name = (isset($cat->name)) ? $cat->name : '';
4054
-            }
4055
-        }elseif($gd_page=='listing'){
4056
-            $queried_object = get_queried_object();
4057
-            if(isset($queried_object->name)){
4058
-                $cat_name = $queried_object->name;
4059
-            }
4060
-        }
4061
-        $title = str_replace("%%category%%",$cat_name,$title);
4062
-    }
4063
-
4064
-    if(strpos($title,'%%tag%%') !== false){
4065
-        $cat_name = '';
4066
-
4067
-        if($gd_page=='detail') {
4068
-            if ($post->default_category) {
4069
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4070
-                $cat_name = (isset($cat->name)) ? $cat->name : '';
4071
-            }
4072
-        }elseif($gd_page=='listing'){
4073
-            $queried_object = get_queried_object();
4074
-            if(isset($queried_object->name)){
4075
-                $cat_name = $queried_object->name;
4076
-            }
4077
-        }
4078
-        $title = str_replace("%%tag%%",$cat_name,$title);
4079
-    }
4015
+		}
4016
+		$title = str_replace("%%pt_single%%",$single_name,$title);
4017
+	}
4018
+
4019
+	if(strpos($title,'%%pt_plural%%') !== false){
4020
+		$plural_name = '';
4021
+		if($gd_page=='search' || $gd_page=='author'){
4022
+			$geodir_post_types = get_option('geodir_post_types');
4023
+			$spt = esc_attr($_REQUEST['stype']);
4024
+			if(isset($geodir_post_types[$spt]['labels']['name'])){
4025
+				$plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4026
+			}
4027
+		}elseif($gd_page=='add-listing'){
4028
+			$geodir_post_types = get_option('geodir_post_types');
4029
+			$spt = sanitize_text_field($_REQUEST['listing_type']);
4030
+			if(!$spt){$spt='gd_place';}
4031
+			if(isset($geodir_post_types[$spt]['labels']['name'])){
4032
+				$plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4033
+			}
4034
+		}
4035
+		elseif(isset($post->post_type) && $post->post_type){
4036
+			$geodir_post_types = get_option('geodir_post_types');
4037
+			if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4038
+				$plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
4039
+			}
4040
+
4041
+		}
4042
+		$title = str_replace("%%pt_plural%%",$plural_name,$title);
4043
+	}
4044
+
4045
+
4046
+
4047
+	if(strpos($title,'%%category%%') !== false){
4048
+		$cat_name = '';
4049
+
4050
+		if($gd_page=='detail') {
4051
+			if ($post->default_category) {
4052
+				$cat = get_term($post->default_category, $post->post_type . 'category');
4053
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4054
+			}
4055
+		}elseif($gd_page=='listing'){
4056
+			$queried_object = get_queried_object();
4057
+			if(isset($queried_object->name)){
4058
+				$cat_name = $queried_object->name;
4059
+			}
4060
+		}
4061
+		$title = str_replace("%%category%%",$cat_name,$title);
4062
+	}
4063
+
4064
+	if(strpos($title,'%%tag%%') !== false){
4065
+		$cat_name = '';
4066
+
4067
+		if($gd_page=='detail') {
4068
+			if ($post->default_category) {
4069
+				$cat = get_term($post->default_category, $post->post_type . 'category');
4070
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4071
+			}
4072
+		}elseif($gd_page=='listing'){
4073
+			$queried_object = get_queried_object();
4074
+			if(isset($queried_object->name)){
4075
+				$cat_name = $queried_object->name;
4076
+			}
4077
+		}
4078
+		$title = str_replace("%%tag%%",$cat_name,$title);
4079
+	}
4080 4080
 
4081 4081
 
4082 4082
 
4083
-    if(strpos($title,'%%id%%') !== false){
4084
-        $ID = (isset($post->ID)) ? $post->ID : '';
4085
-        $title = str_replace("%%id%%",$ID,$title);
4086
-    }
4083
+	if(strpos($title,'%%id%%') !== false){
4084
+		$ID = (isset($post->ID)) ? $post->ID : '';
4085
+		$title = str_replace("%%id%%",$ID,$title);
4086
+	}
4087 4087
 
4088
-    /*
4088
+	/*
4089 4089
         if(strpos($title,'') !== false){
4090 4090
             $title = str_replace("",,$title);
4091 4091
         }
@@ -4095,174 +4095,174 @@  discard block
 block discarded – undo
4095 4095
         }
4096 4096
     */
4097 4097
 
4098
-    if(strpos($title,'%%sep%%') !== false){
4099
-        $title = str_replace("%%sep%%",$sep,$title);
4100
-    }
4101
-
4102
-
4103
-    global $wp;
4104
-    // location variables
4105
-    $gd_post_type = geodir_get_current_posttype();
4106
-    $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4107
-    /**
4108
-     * Filter the title variables location variables array
4109
-     *
4110
-     * @since 1.5.5
4111
-     * @package GeoDirectory
4112
-     * @param array $location_array The array of location variables.
4113
-     * @param string $title The title with variables..
4114
-     * @param string $gd_page The page being filtered.
4115
-     * @param string $sep The separator, default: `|`.
4116
-     */
4117
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4118
-    $location_titles = array();
4119
-    if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4120
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4121
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4122
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4123
-    }
4124
-    $location_single = '';
4125
-    $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4126
-    $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4127
-    $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4128
-
4129
-    $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4130
-
4131
-    if (function_exists('get_actual_location_name')) {
4132
-        $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4133
-        $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4134
-        $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4135
-    }
4136
-
4137
-    if ($gd_city != '') {
4138
-        if ($gd_city_actual != '') {
4139
-            $gd_city = $gd_city_actual;
4140
-        } else {
4141
-            $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4142
-            $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4143
-            $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4144
-        }
4145
-        $location_single = $gd_city;
4146
-
4147
-    } else if ($gd_region != '') {
4148
-        if ($gd_region_actual != '') {
4149
-            $gd_region = $gd_region_actual;
4150
-        } else {
4151
-            $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4152
-            $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4153
-            $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4154
-        }
4098
+	if(strpos($title,'%%sep%%') !== false){
4099
+		$title = str_replace("%%sep%%",$sep,$title);
4100
+	}
4155 4101
 
4156
-        $location_single = $gd_region;
4157
-    } else if ($gd_country != '') {
4158
-        if ($gd_country_actual != '') {
4159
-            $gd_country = $gd_country_actual;
4160
-        } else {
4161
-            $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4162
-            $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4163
-            $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4164
-        }
4165 4102
 
4166
-        $location_single = $gd_country;
4167
-    }
4103
+	global $wp;
4104
+	// location variables
4105
+	$gd_post_type = geodir_get_current_posttype();
4106
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4107
+	/**
4108
+	 * Filter the title variables location variables array
4109
+	 *
4110
+	 * @since 1.5.5
4111
+	 * @package GeoDirectory
4112
+	 * @param array $location_array The array of location variables.
4113
+	 * @param string $title The title with variables..
4114
+	 * @param string $gd_page The page being filtered.
4115
+	 * @param string $sep The separator, default: `|`.
4116
+	 */
4117
+	$location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4118
+	$location_titles = array();
4119
+	if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4120
+		if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4121
+		if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4122
+		if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4123
+	}
4124
+	$location_single = '';
4125
+	$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4126
+	$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4127
+	$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4168 4128
 
4169
-    if (!empty($location_array)) {
4129
+	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4170 4130
 
4171
-        $actual_location_name = function_exists('get_actual_location_name') ? true : false;
4172
-        $location_array = array_reverse($location_array);
4131
+	if (function_exists('get_actual_location_name')) {
4132
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4133
+		$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4134
+		$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4135
+	}
4173 4136
 
4174
-        foreach ($location_array as $location_type => $location) {
4175
-            $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4176
-            $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4137
+	if ($gd_city != '') {
4138
+		if ($gd_city_actual != '') {
4139
+			$gd_city = $gd_city_actual;
4140
+		} else {
4141
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4142
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4143
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4144
+		}
4145
+		$location_single = $gd_city;
4146
+
4147
+	} else if ($gd_region != '') {
4148
+		if ($gd_region_actual != '') {
4149
+			$gd_region = $gd_region_actual;
4150
+		} else {
4151
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4152
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4153
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4154
+		}
4177 4155
 
4178
-            $location_name = geodir_ucwords($gd_location_link_text);
4179
-            $location_name = __($location_name, 'geodirectory');
4156
+		$location_single = $gd_region;
4157
+	} else if ($gd_country != '') {
4158
+		if ($gd_country_actual != '') {
4159
+			$gd_country = $gd_country_actual;
4160
+		} else {
4161
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4162
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4163
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4164
+		}
4180 4165
 
4181
-            if ($actual_location_name) {
4182
-                $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4183
-                $location_name = get_actual_location_name($location_type, $location, true);
4184
-            }
4166
+		$location_single = $gd_country;
4167
+	}
4185 4168
 
4186
-            $location_titles[] = $location_name;
4187
-        }
4188
-        if (!empty($location_titles)) {
4189
-            $location_titles = array_unique($location_titles);
4190
-        }
4191
-    }
4169
+	if (!empty($location_array)) {
4192 4170
 
4171
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4172
+		$location_array = array_reverse($location_array);
4193 4173
 
4194
-    if(strpos($title,'%%location%%') !== false){
4195
-        $location = '';
4196
-        if($location_titles) {
4197
-            $location = implode(", ", $location_titles);
4198
-        }
4199
-        $title = str_replace("%%location%%",$location,$title);
4200
-    }
4174
+		foreach ($location_array as $location_type => $location) {
4175
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4176
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4201 4177
 
4202
-    if(strpos($title,'%%in_location%%') !== false){
4203
-        $location = '';
4204
-        if($location_titles) {
4205
-            $location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4206
-        }
4207
-        $title = str_replace("%%in_location%%",$location,$title);
4208
-    }
4178
+			$location_name = geodir_ucwords($gd_location_link_text);
4179
+			$location_name = __($location_name, 'geodirectory');
4209 4180
 
4210
-    if(strpos($title,'%%in_location_single%%') !== false){
4211
-        if($location_single) {
4212
-            $location_single = __('in', 'geodirectory') . ' ' .$location_single;
4213
-        }
4214
-        $title = str_replace("%%in_location_single%%",$location_single,$title);
4215
-    }
4181
+			if ($actual_location_name) {
4182
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4183
+				$location_name = get_actual_location_name($location_type, $location, true);
4184
+			}
4216 4185
 
4217
-    if(strpos($title,'%%location_single%%') !== false){
4218
-        $title = str_replace("%%location_single%%",$location_single,$title);
4219
-    }
4186
+			$location_titles[] = $location_name;
4187
+		}
4188
+		if (!empty($location_titles)) {
4189
+			$location_titles = array_unique($location_titles);
4190
+		}
4191
+	}
4220 4192
 
4221 4193
 
4222
-    if(strpos($title,'%%search_term%%') !== false){
4223
-        $search_term = '';
4224
-        if(isset($_REQUEST['s'])){
4225
-            $search_term = esc_attr($_REQUEST['s']);
4226
-        }
4227
-        $title = str_replace("%%search_term%%",$search_term,$title);
4228
-    }
4194
+	if(strpos($title,'%%location%%') !== false){
4195
+		$location = '';
4196
+		if($location_titles) {
4197
+			$location = implode(", ", $location_titles);
4198
+		}
4199
+		$title = str_replace("%%location%%",$location,$title);
4200
+	}
4229 4201
 
4230
-    if(strpos($title,'%%search_near%%') !== false){
4231
-        $search_term = '';
4232
-        if(isset($_REQUEST['snear'])){
4233
-            $search_term = esc_attr($_REQUEST['snear']);
4234
-        }
4235
-        $title = str_replace("%%search_near%%",$search_term,$title);
4236
-    }
4237
-
4238
-    if(strpos($title,'%%name%%') !== false){
4239
-        $author_name = '';
4240
-        if($author_name = get_the_author()){}
4241
-        else{
4242
-            $queried_object = get_queried_object();
4243
-            if(isset($queried_object->data->user_nicename)){
4244
-                $author_name = $queried_object->data->user_nicename;
4245
-            }
4246
-        }
4247
-        $title = str_replace("%%name%%",$author_name,$title);
4248
-    }
4249
-
4250
-    $title = wptexturize( $title );
4251
-    $title = convert_chars( $title );
4252
-    $title = esc_html( $title );
4253
-
4254
-    /**
4255
-     * Filter the title variables after standard ones have been filtered.
4256
-     *
4257
-     * @since 1.5.7
4258
-     * @package GeoDirectory
4259
-     * @param string $title The title with variables.
4260
-     * @param array $location_array The array of location variables.
4261
-     * @param string $gd_page The page being filtered.
4262
-     * @param string $sep The separator, default: `|`.
4263
-     */
4202
+	if(strpos($title,'%%in_location%%') !== false){
4203
+		$location = '';
4204
+		if($location_titles) {
4205
+			$location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4206
+		}
4207
+		$title = str_replace("%%in_location%%",$location,$title);
4208
+	}
4209
+
4210
+	if(strpos($title,'%%in_location_single%%') !== false){
4211
+		if($location_single) {
4212
+			$location_single = __('in', 'geodirectory') . ' ' .$location_single;
4213
+		}
4214
+		$title = str_replace("%%in_location_single%%",$location_single,$title);
4215
+	}
4216
+
4217
+	if(strpos($title,'%%location_single%%') !== false){
4218
+		$title = str_replace("%%location_single%%",$location_single,$title);
4219
+	}
4220
+
4221
+
4222
+	if(strpos($title,'%%search_term%%') !== false){
4223
+		$search_term = '';
4224
+		if(isset($_REQUEST['s'])){
4225
+			$search_term = esc_attr($_REQUEST['s']);
4226
+		}
4227
+		$title = str_replace("%%search_term%%",$search_term,$title);
4228
+	}
4229
+
4230
+	if(strpos($title,'%%search_near%%') !== false){
4231
+		$search_term = '';
4232
+		if(isset($_REQUEST['snear'])){
4233
+			$search_term = esc_attr($_REQUEST['snear']);
4234
+		}
4235
+		$title = str_replace("%%search_near%%",$search_term,$title);
4236
+	}
4237
+
4238
+	if(strpos($title,'%%name%%') !== false){
4239
+		$author_name = '';
4240
+		if($author_name = get_the_author()){}
4241
+		else{
4242
+			$queried_object = get_queried_object();
4243
+			if(isset($queried_object->data->user_nicename)){
4244
+				$author_name = $queried_object->data->user_nicename;
4245
+			}
4246
+		}
4247
+		$title = str_replace("%%name%%",$author_name,$title);
4248
+	}
4264 4249
 
4265
-    return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4250
+	$title = wptexturize( $title );
4251
+	$title = convert_chars( $title );
4252
+	$title = esc_html( $title );
4253
+
4254
+	/**
4255
+	 * Filter the title variables after standard ones have been filtered.
4256
+	 *
4257
+	 * @since 1.5.7
4258
+	 * @package GeoDirectory
4259
+	 * @param string $title The title with variables.
4260
+	 * @param array $location_array The array of location variables.
4261
+	 * @param string $gd_page The page being filtered.
4262
+	 * @param string $sep The separator, default: `|`.
4263
+	 */
4264
+
4265
+	return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4266 4266
 }
4267 4267
 
4268 4268
 /**
@@ -4275,65 +4275,65 @@  discard block
 block discarded – undo
4275 4275
  * @return array Translation texts.
4276 4276
  */
4277 4277
 function geodir_load_cpt_text_translation($translation_texts = array()) {
4278
-    $gd_post_types = geodir_get_posttypes('array');
4279
-
4280
-    if (!empty($gd_post_types)) {
4281
-        foreach ($gd_post_types as $post_type => $cpt_info) {
4282
-            $labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4283
-            $description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4284
-            $seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4285
-
4286
-            if (!empty($labels)) {
4287
-                if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts))
4288
-                    $translation_texts[] = $labels['name'];
4289
-                if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts))
4290
-                    $translation_texts[] = $labels['singular_name'];
4291
-                if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts))
4292
-                    $translation_texts[] = $labels['add_new'];
4293
-                if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts))
4294
-                    $translation_texts[] = $labels['add_new_item'];
4295
-                if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts))
4296
-                    $translation_texts[] = $labels['edit_item'];
4297
-                if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts))
4298
-                    $translation_texts[] = $labels['new_item'];
4299
-                if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts))
4300
-                    $translation_texts[] = $labels['view_item'];
4301
-                if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts))
4302
-                    $translation_texts[] = $labels['search_items'];
4303
-                if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts))
4304
-                    $translation_texts[] = $labels['not_found'];
4305
-                if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts))
4306
-                    $translation_texts[] = $labels['not_found_in_trash'];
4307
-                if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts))
4308
-                    $translation_texts[] = $labels['label_post_profile'];
4309
-                if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts))
4310
-                    $translation_texts[] = $labels['label_post_info'];
4311
-                if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts))
4312
-                    $translation_texts[] = $labels['label_post_images'];
4313
-                if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts))
4314
-                    $translation_texts[] = $labels['label_post_map'];
4315
-                if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts))
4316
-                    $translation_texts[] = $labels['label_reviews'];
4317
-                if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts))
4318
-                    $translation_texts[] = $labels['label_related_listing'];
4319
-            }
4320
-
4321
-            if ($description != '' && !in_array($description, $translation_texts)) {
4322
-                $translation_texts[] = normalize_whitespace($description);
4323
-            }
4324
-
4325
-            if (!empty($seo)) {
4326
-                if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts))
4327
-                    $translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4328
-
4329
-                if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts))
4330
-                    $translation_texts[] = normalize_whitespace($seo['meta_description']);
4331
-            }
4332
-        }
4333
-    }
4334
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4278
+	$gd_post_types = geodir_get_posttypes('array');
4279
+
4280
+	if (!empty($gd_post_types)) {
4281
+		foreach ($gd_post_types as $post_type => $cpt_info) {
4282
+			$labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4283
+			$description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4284
+			$seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4285
+
4286
+			if (!empty($labels)) {
4287
+				if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts))
4288
+					$translation_texts[] = $labels['name'];
4289
+				if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts))
4290
+					$translation_texts[] = $labels['singular_name'];
4291
+				if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts))
4292
+					$translation_texts[] = $labels['add_new'];
4293
+				if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts))
4294
+					$translation_texts[] = $labels['add_new_item'];
4295
+				if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts))
4296
+					$translation_texts[] = $labels['edit_item'];
4297
+				if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts))
4298
+					$translation_texts[] = $labels['new_item'];
4299
+				if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts))
4300
+					$translation_texts[] = $labels['view_item'];
4301
+				if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts))
4302
+					$translation_texts[] = $labels['search_items'];
4303
+				if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts))
4304
+					$translation_texts[] = $labels['not_found'];
4305
+				if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts))
4306
+					$translation_texts[] = $labels['not_found_in_trash'];
4307
+				if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts))
4308
+					$translation_texts[] = $labels['label_post_profile'];
4309
+				if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts))
4310
+					$translation_texts[] = $labels['label_post_info'];
4311
+				if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts))
4312
+					$translation_texts[] = $labels['label_post_images'];
4313
+				if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts))
4314
+					$translation_texts[] = $labels['label_post_map'];
4315
+				if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts))
4316
+					$translation_texts[] = $labels['label_reviews'];
4317
+				if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts))
4318
+					$translation_texts[] = $labels['label_related_listing'];
4319
+			}
4335 4320
 
4336
-    return $translation_texts;
4321
+			if ($description != '' && !in_array($description, $translation_texts)) {
4322
+				$translation_texts[] = normalize_whitespace($description);
4323
+			}
4324
+
4325
+			if (!empty($seo)) {
4326
+				if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts))
4327
+					$translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4328
+
4329
+				if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts))
4330
+					$translation_texts[] = normalize_whitespace($seo['meta_description']);
4331
+			}
4332
+		}
4333
+	}
4334
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4335
+
4336
+	return $translation_texts;
4337 4337
 }
4338 4338
 
4339 4339
 /**
@@ -4346,25 +4346,25 @@  discard block
 block discarded – undo
4346 4346
  * @return array Location terms.
4347 4347
  */
4348 4348
 function geodir_remove_location_terms($location_terms = array()) {
4349
-    $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4350
-
4351
-    if (!empty($location_terms) && $location_manager) {
4352
-        $hide_country_part = get_option('geodir_location_hide_country_part');
4353
-        $hide_region_part = get_option('geodir_location_hide_region_part');
4354
-
4355
-        if ($hide_region_part && $hide_country_part) {
4356
-            if (isset($location_terms['gd_country']))
4357
-                unset($location_terms['gd_country']);
4358
-            if (isset($location_terms['gd_region']))
4359
-                unset($location_terms['gd_region']);
4360
-        } else if ($hide_region_part && !$hide_country_part) {
4361
-            if (isset($location_terms['gd_region']))
4362
-                unset($location_terms['gd_region']);
4363
-        } else if (!$hide_region_part && $hide_country_part) {
4364
-            if (isset($location_terms['gd_country']))
4365
-                unset($location_terms['gd_country']);
4366
-        }
4367
-    }
4349
+	$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4350
+
4351
+	if (!empty($location_terms) && $location_manager) {
4352
+		$hide_country_part = get_option('geodir_location_hide_country_part');
4353
+		$hide_region_part = get_option('geodir_location_hide_region_part');
4354
+
4355
+		if ($hide_region_part && $hide_country_part) {
4356
+			if (isset($location_terms['gd_country']))
4357
+				unset($location_terms['gd_country']);
4358
+			if (isset($location_terms['gd_region']))
4359
+				unset($location_terms['gd_region']);
4360
+		} else if ($hide_region_part && !$hide_country_part) {
4361
+			if (isset($location_terms['gd_region']))
4362
+				unset($location_terms['gd_region']);
4363
+		} else if (!$hide_region_part && $hide_country_part) {
4364
+			if (isset($location_terms['gd_country']))
4365
+				unset($location_terms['gd_country']);
4366
+		}
4367
+	}
4368 4368
 
4369
-    return $location_terms;
4369
+	return $location_terms;
4370 4370
 }
4371 4371
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +226 added lines, -226 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
         $add_listing_link = get_page_link(geodir_add_listing_page_id());
158 158
 
159
-        return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
159
+        return esc_url(add_query_arg(array('listing_type' => $post_type), $add_listing_link));
160 160
     } else
161 161
         return get_bloginfo('url');
162 162
 }
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 function geodir_is_page($gdpage = '')
249 249
 {
250 250
 
251
-    global $wp_query, $post,$wp;
251
+    global $wp_query, $post, $wp;
252 252
     //if(!is_admin()):
253 253
 
254 254
     switch ($gdpage):
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
             if (is_author() && isset($_REQUEST['geodir_dashbord']))
305 305
                 return true;
306 306
 			
307
-			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) {
308
-				if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) {
307
+			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) {
308
+				if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) {
309 309
 					return true;
310 310
 				}
311 311
 			}
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
359 359
             if (get_option('geodir_set_as_home'))
360 360
                 $wp->query_vars['gd_is_geodir_page'] = true;
361
-            if(geodir_is_page('home')){
361
+            if (geodir_is_page('home')) {
362 362
                 $wp->query_vars['gd_is_geodir_page'] = true;
363 363
             }
364 364
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 
411 411
         if (!isset($wp->query_vars['gd_is_geodir_page'])) {
412 412
             $geodir_taxonomis = geodir_get_taxonomies('', true);
413
-            if(!empty($geodir_taxonomis)){
413
+            if (!empty($geodir_taxonomis)) {
414 414
                 foreach ($geodir_taxonomis as $taxonomy) {
415 415
                     if (array_key_exists($taxonomy, $wp->query_vars)) {
416 416
                         $wp->query_vars['gd_is_geodir_page'] = true;
@@ -430,10 +430,10 @@  discard block
 block discarded – undo
430 430
 
431 431
 
432 432
 //check if homepage
433
-        if(!isset($wp->query_vars['gd_is_geodir_page'])
433
+        if (!isset($wp->query_vars['gd_is_geodir_page'])
434 434
             && !isset($wp->query_vars['page_id'])
435 435
             && !isset($wp->query_vars['pagename'])
436
-            && is_page_geodir_home()){
436
+            && is_page_geodir_home()) {
437 437
             $wp->query_vars['gd_is_geodir_page'] = true;
438 438
         }
439 439
         //echo $wp->query_vars['gd_is_geodir_page'] ;
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
     function createRandomString()
535 535
     {
536 536
         $chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
537
-        srand((double)microtime() * 1000000);
537
+        srand((double) microtime() * 1000000);
538 538
         $i = 0;
539 539
         $rstring = '';
540 540
         while ($i <= 25) {
@@ -668,11 +668,11 @@  discard block
 block discarded – undo
668 668
         }
669 669
 		
670 670
 		if (!empty($subject)) {
671
-			$subject = __(stripslashes_deep($subject),'geodirectory');
671
+			$subject = __(stripslashes_deep($subject), 'geodirectory');
672 672
 		}
673 673
 		
674 674
 		if (!empty($message)) {
675
-			$message = __(stripslashes_deep($message),'geodirectory');
675
+			$message = __(stripslashes_deep($message), 'geodirectory');
676 676
 		}
677 677
 
678 678
         $to_message = nl2br($to_message);
@@ -707,12 +707,12 @@  discard block
 block discarded – undo
707 707
             $fromEmailName = get_option('site_email_name');
708 708
         }
709 709
 
710
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]');
711
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login);
710
+        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]', '[#from_email#]', '[#user_login#]', '[#username#]');
711
+        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $fromEmail, $user_login, $user_login);
712 712
         $message = str_replace($search_array, $replace_array, $message);
713 713
 
714
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]');
715
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login);
714
+        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]', '[#from_email#]', '[#user_login#]', '[#username#]');
715
+        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $fromEmail, $user_login, $user_login);
716 716
         $subject = str_replace($search_array, $replace_array, $subject);
717 717
 
718 718
         $headers = 'MIME-Version: 1.0' . "\r\n";
@@ -723,18 +723,18 @@  discard block
 block discarded – undo
723 723
         $to = $toEmail;
724 724
         $sent = wp_mail($to, $subject, $message, $headers);
725 725
 
726
-        if( ! $sent ) {
727
-            if ( is_array( $to ) ) {
728
-                $to = implode( ',', $to );
726
+        if (!$sent) {
727
+            if (is_array($to)) {
728
+                $to = implode(',', $to);
729 729
             }
730 730
             $log_message = sprintf(
731
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
731
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
732 732
                 $message_type,
733
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
733
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
734 734
                 $to,
735 735
                 $subject
736 736
             );
737
-            geodir_error_log( $log_message );
737
+            geodir_error_log($log_message);
738 738
         }
739 739
 
740 740
         ///////// ADMIN BCC EMIALS
@@ -746,11 +746,11 @@  discard block
 block discarded – undo
746 746
             $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
747 747
             $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
748 748
 
749
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
749
+            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]', '[#user_login#]', '[#username#]');
750 750
             $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $user_login, $user_login);
751 751
             $message = str_replace($search_array, $replace_array, $message);
752 752
 
753
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
753
+            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]', '[#user_login#]', '[#username#]');
754 754
             $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
755 755
             $subject = str_replace($search_array, $replace_array, $subject);
756 756
 
@@ -775,21 +775,21 @@  discard block
 block discarded – undo
775 775
             $admin_bcc = true;
776 776
         }
777 777
 
778
-        if($admin_bcc===true){
778
+        if ($admin_bcc === true) {
779 779
             $sent = wp_mail($to, $subject, $message, $headers);
780 780
 
781
-            if( ! $sent ) {
782
-                if ( is_array( $to ) ) {
783
-                    $to = implode( ',', $to );
781
+            if (!$sent) {
782
+                if (is_array($to)) {
783
+                    $to = implode(',', $to);
784 784
                 }
785 785
                 $log_message = sprintf(
786
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
786
+                    __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
787 787
                     $message_type,
788
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
788
+                    date_i18n('F j Y H:i:s', current_time('timestamp')),
789 789
                     $to,
790 790
                     $subject
791 791
                 );
792
-                geodir_error_log( $log_message );
792
+                geodir_error_log($log_message);
793 793
             }
794 794
         }
795 795
 
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
             $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
885 885
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
886 886
 				
887
-			if(geodir_is_page('detail') && isset($post->country_slug)){
887
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
888 888
                 $location_terms = array(
889 889
                     'gd_country' => $post->country_slug,
890 890
                     'gd_region' => $post->region_slug,
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
             $breadcrumb .= stripslashes_deep($page_title);
1140 1140
             $breadcrumb .= '</li>';
1141 1141
         } else if (is_tag()) {
1142
-            $breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1142
+            $breadcrumb .= "<li> " . $separator . single_tag_title('', false) . '</li>';
1143 1143
         } else if (is_day()) {
1144 1144
             $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1145 1145
             the_time('F jS, Y');
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
         return new WP_Error('upload_dir_error', $upload['error']);
1232 1232
 
1233 1233
     // fetch the remote url and write it to the placeholder file
1234
-    $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1234
+    $headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
1235 1235
 
1236 1236
     $log_message = '';
1237 1237
     $filesize = filesize($upload['file']);
@@ -1244,16 +1244,16 @@  discard block
 block discarded – undo
1244 1244
         $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1245 1245
     }
1246 1246
     elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1247
-        $log_message =  __('Remote file is incorrect size', 'geodirectory');
1247
+        $log_message = __('Remote file is incorrect size', 'geodirectory');
1248 1248
     }
1249 1249
     elseif (0 == $filesize) {
1250 1250
         $log_message = __('Zero size file downloaded', 'geodirectory');
1251 1251
     }
1252 1252
 
1253
-    if($log_message){
1253
+    if ($log_message) {
1254 1254
         $del = unlink($upload['file']);
1255
-        if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1256
-        return new WP_Error('import_file_error',$log_message );
1255
+        if (!$del) {geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory')); }
1256
+        return new WP_Error('import_file_error', $log_message);
1257 1257
     }
1258 1258
 
1259 1259
 
@@ -1269,10 +1269,10 @@  discard block
 block discarded – undo
1269 1269
  */
1270 1270
 function geodir_max_upload_size()
1271 1271
 {
1272
-    $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1272
+    $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1273 1273
 
1274 1274
     if ($max_filesize > 0 && $max_filesize < 1) {
1275
-        $max_filesize = (int)($max_filesize * 1024) . 'kb';
1275
+        $max_filesize = (int) ($max_filesize * 1024) . 'kb';
1276 1276
     } else {
1277 1277
         $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1278 1278
     }
@@ -1341,35 +1341,35 @@  discard block
 block discarded – undo
1341 1341
     {
1342 1342
         global $wpdb;
1343 1343
         if ($message_type == 'expiration') {
1344
-            $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1345
-            $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1344
+            $subject = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
1345
+            $client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
1346 1346
         } elseif ($message_type == 'post_submited') {
1347
-            $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1348
-            $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1347
+            $subject = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
1348
+            $client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
1349 1349
         } elseif ($message_type == 'renew') {
1350
-            $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1351
-            $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1350
+            $subject = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
1351
+            $client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
1352 1352
         } elseif ($message_type == 'upgrade') {
1353
-            $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1354
-            $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1353
+            $subject = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
1354
+            $client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
1355 1355
         } elseif ($message_type == 'claim_approved') {
1356
-            $subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1357
-            $client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1356
+            $subject = __(get_option('claim_approved_email_subject'), 'geodirectory');
1357
+            $client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
1358 1358
         } elseif ($message_type == 'claim_rejected') {
1359
-            $subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1360
-            $client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1359
+            $subject = __(get_option('claim_rejected_email_subject'), 'geodirectory');
1360
+            $client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
1361 1361
         } elseif ($message_type == 'claim_requested') {
1362
-            $subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1363
-            $client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1362
+            $subject = __(get_option('claim_email_subject_admin'), 'geodirectory');
1363
+            $client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
1364 1364
         } elseif ($message_type == 'auto_claim') {
1365
-            $subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1366
-            $client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1365
+            $subject = __(get_option('auto_claim_email_subject'), 'geodirectory');
1366
+            $client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
1367 1367
         } elseif ($message_type == 'payment_success') {
1368
-            $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1369
-            $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1368
+            $subject = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
1369
+            $client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
1370 1370
         } elseif ($message_type == 'payment_fail') {
1371
-            $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1372
-            $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1371
+            $subject = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
1372
+            $client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
1373 1373
         }
1374 1374
         $transaction_details = $custom_1;
1375 1375
         $fromEmail = get_option('site_email');
@@ -1410,18 +1410,18 @@  discard block
 block discarded – undo
1410 1410
         $to = $fromEmail;
1411 1411
         $message = $client_message;
1412 1412
         $sent = wp_mail($to, $subject, $message, $headers);
1413
-        if( ! $sent ) {
1414
-            if ( is_array( $to ) ) {
1415
-                $to = implode( ',', $to );
1413
+        if (!$sent) {
1414
+            if (is_array($to)) {
1415
+                $to = implode(',', $to);
1416 1416
             }
1417 1417
             $log_message = sprintf(
1418
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1418
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1419 1419
                 $message_type,
1420
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1420
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
1421 1421
                 $to,
1422 1422
                 $subject
1423 1423
             );
1424
-            geodir_error_log( $log_message );
1424
+            geodir_error_log($log_message);
1425 1425
         }
1426 1426
     }
1427 1427
 }
@@ -1447,18 +1447,18 @@  discard block
 block discarded – undo
1447 1447
     {
1448 1448
         $login_details = '';
1449 1449
         if ($message_type == 'send_friend') {
1450
-            $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1451
-            $message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1450
+            $subject = stripslashes(__(get_option('email_friend_subject'), 'geodirectory'));
1451
+            $message = stripslashes(__(get_option('email_friend_content'), 'geodirectory'));
1452 1452
         } elseif ($message_type == 'send_enquiry') {
1453
-            $subject = __(get_option('email_enquiry_subject'),'geodirectory');
1454
-            $message = __(get_option('email_enquiry_content'),'geodirectory');
1453
+            $subject = __(get_option('email_enquiry_subject'), 'geodirectory');
1454
+            $message = __(get_option('email_enquiry_content'), 'geodirectory');
1455 1455
         } elseif ($message_type == 'forgot_password') {
1456
-            $subject = __(get_option('forgot_password_subject'),'geodirectory');
1457
-            $message = __(get_option('forgot_password_content'),'geodirectory');
1456
+            $subject = __(get_option('forgot_password_subject'), 'geodirectory');
1457
+            $message = __(get_option('forgot_password_content'), 'geodirectory');
1458 1458
             $login_details = $to_message;
1459 1459
         } elseif ($message_type == 'registration') {
1460
-            $subject = __(get_option('registration_success_email_subject'),'geodirectory');
1461
-            $message = __(get_option('registration_success_email_content'),'geodirectory');
1460
+            $subject = __(get_option('registration_success_email_subject'), 'geodirectory');
1461
+            $message = __(get_option('registration_success_email_content'), 'geodirectory');
1462 1462
             $login_details = $to_message;
1463 1463
         }
1464 1464
         $to_message = nl2br($to_message);
@@ -1492,18 +1492,18 @@  discard block
 block discarded – undo
1492 1492
         $to = $toEmail;
1493 1493
 
1494 1494
         $sent = wp_mail($to, $subject, $message, $headers);
1495
-        if( ! $sent ) {
1496
-            if ( is_array( $to ) ) {
1497
-                $to = implode( ',', $to );
1495
+        if (!$sent) {
1496
+            if (is_array($to)) {
1497
+                $to = implode(',', $to);
1498 1498
             }
1499 1499
             $log_message = sprintf(
1500
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1500
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1501 1501
                 $message_type,
1502
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1502
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
1503 1503
                 $to,
1504 1504
                 $subject
1505 1505
             );
1506
-            geodir_error_log( $log_message );
1506
+            geodir_error_log($log_message);
1507 1507
         }
1508 1508
 
1509 1509
         ///////// ADMIN BCC EMIALS
@@ -1529,20 +1529,20 @@  discard block
 block discarded – undo
1529 1529
             $admin_bcc = true;
1530 1530
         }
1531 1531
 
1532
-        if($admin_bcc === true){
1532
+        if ($admin_bcc === true) {
1533 1533
             $sent = wp_mail($to, $subject, $message, $headers);
1534
-            if( ! $sent ) {
1535
-                if ( is_array( $to ) ) {
1536
-                    $to = implode( ',', $to );
1534
+            if (!$sent) {
1535
+                if (is_array($to)) {
1536
+                    $to = implode(',', $to);
1537 1537
                 }
1538 1538
                 $log_message = sprintf(
1539
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1539
+                    __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1540 1540
                     $message_type,
1541
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1541
+                    date_i18n('F j Y H:i:s', current_time('timestamp')),
1542 1542
                     $to,
1543 1543
                     $subject
1544 1544
                 );
1545
-                geodir_error_log( $log_message );
1545
+                geodir_error_log($log_message);
1546 1546
             }
1547 1547
         }
1548 1548
 
@@ -1590,7 +1590,7 @@  discard block
 block discarded – undo
1590 1590
 function geodir_custom_posts_body_class($classes) {
1591 1591
     global $wpdb, $wp;
1592 1592
     $post_types = geodir_get_posttypes('object');
1593
-    if (!empty($post_types) && count((array)$post_types) > 1) {
1593
+    if (!empty($post_types) && count((array) $post_types) > 1) {
1594 1594
         $classes[] = 'geodir_custom_posts';
1595 1595
     }
1596 1596
 
@@ -1884,7 +1884,7 @@  discard block
 block discarded – undo
1884 1884
         $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
1885 1885
 			" . $join . "
1886 1886
 			" . $where;
1887
-        $rows = (int)$wpdb->get_var($sql);
1887
+        $rows = (int) $wpdb->get_var($sql);
1888 1888
     } else {
1889 1889
         $orderby = geodir_widget_listings_get_order($query_args);
1890 1890
         /**
@@ -1910,10 +1910,10 @@  discard block
 block discarded – undo
1910 1910
         $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
1911 1911
 
1912 1912
         $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
1913
-        if ( !$page )
1913
+        if (!$page)
1914 1914
             $page = 1;
1915 1915
 
1916
-        $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
1916
+        $limit = (int) $limit > 0 ? " LIMIT " . absint(($page - 1) * (int) $limit) . ", " . (int) $limit : "";
1917 1917
 
1918 1918
         $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
1919 1919
 			" . $join . "
@@ -2028,7 +2028,7 @@  discard block
 block discarded – undo
2028 2028
         }
2029 2029
 
2030 2030
         if (!empty($query_args['post_author'])) {
2031
-            $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2031
+            $where .= " AND " . $wpdb->posts . ".post_author = " . (int) $query_args['post_author'];
2032 2032
         }
2033 2033
         
2034 2034
         if (!empty($query_args['show_featured_only'])) {
@@ -2114,7 +2114,7 @@  discard block
 block discarded – undo
2114 2114
     }
2115 2115
 
2116 2116
     if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2117
-        $limit = (int)$query_args['posts_per_page'];
2117
+        $limit = (int) $query_args['posts_per_page'];
2118 2118
     }
2119 2119
 
2120 2120
     return $limit;
@@ -2257,9 +2257,9 @@  discard block
 block discarded – undo
2257 2257
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2258 2258
     }
2259 2259
     $home_url = str_replace("www.", "", $home_url);
2260
-    if ( (strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')) ) {
2260
+    if ((strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page'))) {
2261 2261
         return true;
2262
-    }elseif(get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')){
2262
+    }elseif (get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page')) {
2263 2263
         return true;
2264 2264
     } else {
2265 2265
         return false;
@@ -2342,7 +2342,7 @@  discard block
 block discarded – undo
2342 2342
 
2343 2343
     $gd_post_type = geodir_get_current_posttype();
2344 2344
 
2345
-    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2345
+    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2346 2346
     $default_post_type = !empty($gd_post_type) ? $gd_post_type : (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ? $instance['default_post_type'] : '');
2347 2347
 
2348 2348
     $taxonomy = array();
@@ -2375,14 +2375,14 @@  discard block
 block discarded – undo
2375 2375
             foreach ($b_terms as $key => $val) {
2376 2376
                 $ptype = get_post_type_object(str_replace("category", "", $key));
2377 2377
                 $cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2378
-                $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2378
+                $tax_change_output .= "<option value='$key' " . selected($key, $default_taxonomy, false) . ">" . sprintf(__('%s Categories', 'geodirectory'), $cpt_name) . "</option>";
2379 2379
             }
2380 2380
             $tax_change_output .= "</select>";
2381 2381
         }
2382 2382
 
2383 2383
         if (!empty($b_terms)) {
2384
-            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2385
-            global $cat_count;//make global so we can change via function
2384
+            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array
2385
+            global $cat_count; //make global so we can change via function
2386 2386
             $cat_count = 0;
2387 2387
             ?>
2388 2388
             <div class="geodir-category-list-in clearfix">
@@ -2446,7 +2446,7 @@  discard block
 block discarded – undo
2446 2446
         $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2447 2447
         $total_post = $cat->count;
2448 2448
 
2449
-        $term_link = get_term_link( $cat, $cat->taxonomy );
2449
+        $term_link = get_term_link($cat, $cat->taxonomy);
2450 2450
         /**
2451 2451
          * Filer the category term link.
2452 2452
          *
@@ -2455,7 +2455,7 @@  discard block
 block discarded – undo
2455 2455
          * @param int    $cat->term_id The term id.
2456 2456
          * @param string $post_type Wordpress post type.
2457 2457
          */
2458
-        $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2458
+        $term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
2459 2459
 
2460 2460
         echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2461 2461
         echo '<img alt="' . esc_attr($cat->name) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">'; echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
@@ -2589,29 +2589,29 @@  discard block
 block discarded – undo
2589 2589
                 itemWidth: 75,
2590 2590
                 itemMargin: 5,
2591 2591
                 asNavFor: '#geodir_widget_slider',
2592
-                rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
2592
+                rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
2593 2593
             });
2594 2594
 
2595 2595
             jQuery('#geodir_widget_slider').flexslider({
2596
-                animation: "<?php echo $animation;?>",
2596
+                animation: "<?php echo $animation; ?>",
2597 2597
                 selector: ".geodir-slides > li",
2598 2598
                 namespace: "geodir-",
2599 2599
                 controlNav: true,
2600
-                animationLoop: <?php echo $animationLoop;?>,
2601
-                slideshow: <?php echo $slideshow;?>,
2602
-                slideshowSpeed: <?php echo $slideshowSpeed;?>,
2603
-                animationSpeed: <?php echo $animationSpeed;?>,
2604
-                directionNav: <?php echo $directionNav;?>,
2605
-                maxItems: <?php echo $max_show;?>,
2600
+                animationLoop: <?php echo $animationLoop; ?>,
2601
+                slideshow: <?php echo $slideshow; ?>,
2602
+                slideshowSpeed: <?php echo $slideshowSpeed; ?>,
2603
+                animationSpeed: <?php echo $animationSpeed; ?>,
2604
+                directionNav: <?php echo $directionNav; ?>,
2605
+                maxItems: <?php echo $max_show; ?>,
2606 2606
                 move: 1,
2607
-                <?php if($slide_width){ echo "itemWidth: ".$slide_width.",";}?>
2607
+                <?php if ($slide_width) { echo "itemWidth: " . $slide_width . ","; }?>
2608 2608
                 sync: "#geodir_widget_carousel",
2609 2609
                 start: function (slider) {
2610 2610
                     jQuery('.geodir-listing-flex-loader').hide();
2611 2611
                     jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
2612 2612
                     jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
2613 2613
                 },
2614
-                rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
2614
+                rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
2615 2615
             });
2616 2616
         });
2617 2617
     </script>
@@ -2652,7 +2652,7 @@  discard block
 block discarded – undo
2652 2652
 
2653 2653
         global $post;
2654 2654
 
2655
-        $current_post = $post;// keep current post info
2655
+        $current_post = $post; // keep current post info
2656 2656
 
2657 2657
         $widget_main_slides = '';
2658 2658
         $nav_slides = '';
@@ -3095,7 +3095,7 @@  discard block
 block discarded – undo
3095 3095
             $geodir_add_location_url = '1';
3096 3096
         }
3097 3097
 
3098
-        $viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3098
+        $viewall_url = get_term_link((int) $category[0], $post_type . 'category');
3099 3099
 
3100 3100
         $geodir_add_location_url = NULL;
3101 3101
     }
@@ -3103,7 +3103,7 @@  discard block
 block discarded – undo
3103 3103
         $gd_session->set('gd_multi_location', 1);
3104 3104
     }
3105 3105
 
3106
-    if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3106
+    if (is_wp_error($viewall_url)) {$viewall_url = ''; }
3107 3107
 
3108 3108
     $query_args = array(
3109 3109
         'posts_per_page' => $post_number,
@@ -3341,14 +3341,14 @@  discard block
 block discarded – undo
3341 3341
  * @package GeoDirectory
3342 3342
  * @return bool
3343 3343
  */
3344
-function geodir_term_review_count_force_update($new_status, $old_status='', $post='')
3344
+function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '')
3345 3345
 {
3346
-    if(isset($_REQUEST['action']) && $_REQUEST['action']=='geodir_import_export'){return;}//do not run if importing listings
3346
+    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {return; }//do not run if importing listings
3347 3347
 
3348
-    if(isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')){
3348
+    if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
3349 3349
         return;
3350 3350
     }
3351
-    if($new_status!=$old_status) {
3351
+    if ($new_status != $old_status) {
3352 3352
         geodir_count_reviews_by_terms(true);
3353 3353
     }
3354 3354
     return true;
@@ -3513,7 +3513,7 @@  discard block
 block discarded – undo
3513 3513
          */
3514 3514
         try {
3515 3515
             require_once($language_file);
3516
-        } catch(Exception $e) {
3516
+        } catch (Exception $e) {
3517 3517
             error_log('Language Error: ' . $e->getMessage());
3518 3518
         }
3519 3519
     }
@@ -3531,18 +3531,18 @@  discard block
 block discarded – undo
3531 3531
  */
3532 3532
 function geodirectory_load_db_language() {
3533 3533
     global $wp_filesystem;
3534
-    if( empty( $wp_filesystem ) ) {
3535
-        require_once( ABSPATH .'/wp-admin/includes/file.php' );
3534
+    if (empty($wp_filesystem)) {
3535
+        require_once(ABSPATH . '/wp-admin/includes/file.php');
3536 3536
         WP_Filesystem();
3537 3537
         global $wp_filesystem;
3538 3538
     }
3539 3539
 
3540 3540
     $language_file = geodir_plugin_path() . '/db-language.php';
3541 3541
 
3542
-    if(is_file($language_file) && !is_writable($language_file))
3542
+    if (is_file($language_file) && !is_writable($language_file))
3543 3543
         return false; // Not possible to create.
3544 3544
 
3545
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3545
+    if (!is_file($language_file) && !is_writable(dirname($language_file)))
3546 3546
         return false; // Not possible to create.
3547 3547
 
3548 3548
     $contents_strings = array();
@@ -3576,7 +3576,7 @@  discard block
 block discarded – undo
3576 3576
     $contents = implode(PHP_EOL, $contents_head);
3577 3577
 
3578 3578
     if (!empty($contents_strings)) {
3579
-        foreach ( $contents_strings as $string ) {
3579
+        foreach ($contents_strings as $string) {
3580 3580
             if (is_scalar($string) && $string != '') {
3581 3581
                 $string = str_replace("'", "\'", $string);
3582 3582
                 $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
@@ -3586,7 +3586,7 @@  discard block
 block discarded – undo
3586 3586
 
3587 3587
     $contents .= implode(PHP_EOL, $contents_foot);
3588 3588
 
3589
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3589
+    if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE))
3590 3590
         return false; // Failure; could not write file.
3591 3591
 
3592 3592
     return true;
@@ -3612,7 +3612,7 @@  discard block
 block discarded – undo
3612 3612
     $rows = $wpdb->get_results($sql);
3613 3613
 
3614 3614
     if (!empty($rows)) {
3615
-        foreach($rows as $row) {
3615
+        foreach ($rows as $row) {
3616 3616
             if (!empty($row->admin_title))
3617 3617
                 $translation_texts[] = stripslashes_deep($row->admin_title);
3618 3618
 			
@@ -3650,7 +3650,7 @@  discard block
 block discarded – undo
3650 3650
     $rows = $wpdb->get_results($sql);
3651 3651
 
3652 3652
     if (!empty($rows)) {
3653
-        foreach($rows as $row) {
3653
+        foreach ($rows as $row) {
3654 3654
             if (!empty($row->site_title))
3655 3655
                 $translation_texts[] = stripslashes_deep($row->site_title);
3656 3656
 
@@ -3668,7 +3668,7 @@  discard block
 block discarded – undo
3668 3668
 		$rows = $wpdb->get_results($sql);
3669 3669
 
3670 3670
 		if (!empty($rows)) {
3671
-			foreach($rows as $row) {
3671
+			foreach ($rows as $row) {
3672 3672
 				if (!empty($row->field_site_name))
3673 3673
 					$translation_texts[] = stripslashes_deep($row->field_site_name);
3674 3674
 
@@ -3703,7 +3703,7 @@  discard block
 block discarded – undo
3703 3703
      *
3704 3704
      * @param array $geodir_allowed_mime_types and file extensions.
3705 3705
      */
3706
-    return apply_filters( 'geodir_allowed_mime_types', array(
3706
+    return apply_filters('geodir_allowed_mime_types', array(
3707 3707
             'Image' => array( // Image formats.
3708 3708
                 'jpg' => 'image/jpeg',
3709 3709
                 'jpe' => 'image/jpeg',
@@ -3792,13 +3792,13 @@  discard block
 block discarded – undo
3792 3792
 
3793 3793
 
3794 3794
 
3795
-add_filter('wpseo_replacements','geodir_wpseo_replacements',10,1);
3795
+add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
3796 3796
 /*
3797 3797
  * Add location variables to wpseo replacements.
3798 3798
  *
3799 3799
  * @since 1.5.4
3800 3800
  */
3801
-function geodir_wpseo_replacements($vars){
3801
+function geodir_wpseo_replacements($vars) {
3802 3802
 
3803 3803
     global $wp;
3804 3804
     $title = '';
@@ -3813,12 +3813,12 @@  discard block
 block discarded – undo
3813 3813
      * @param array $location_array The array of location variables.
3814 3814
      * @param array $vars The page title variables.
3815 3815
      */
3816
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
3816
+    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
3817 3817
     $location_titles = array();
3818
-    if(get_query_var( 'gd_country_full' )){
3819
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
3820
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
3821
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
3818
+    if (get_query_var('gd_country_full')) {
3819
+        if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
3820
+        if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
3821
+        if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
3822 3822
     }
3823 3823
     $location_single = '';
3824 3824
     $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
@@ -3890,23 +3890,23 @@  discard block
 block discarded – undo
3890 3890
     }
3891 3891
 
3892 3892
 
3893
-    if(!empty($location_titles)) {
3893
+    if (!empty($location_titles)) {
3894 3894
         $vars['%%location%%'] = implode(", ", $location_titles);
3895 3895
     }
3896 3896
 
3897 3897
 
3898
-    if(!empty($location_titles)) {
3898
+    if (!empty($location_titles)) {
3899 3899
         $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
3900 3900
     }
3901 3901
 
3902 3902
 
3903 3903
 
3904
-    if($location_single) {
3905
-        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
3904
+    if ($location_single) {
3905
+        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' . $location_single;
3906 3906
     }
3907 3907
 
3908 3908
 
3909
-    if($location_single) {
3909
+    if ($location_single) {
3910 3910
         $vars['%%location_single%%'] = $location_single;
3911 3911
     }
3912 3912
 
@@ -3918,17 +3918,17 @@  discard block
 block discarded – undo
3918 3918
      * @param string $vars The title with variables.
3919 3919
      * @param array $location_array The array of location variables.
3920 3920
      */
3921
-    return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
3921
+    return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
3922 3922
 }
3923 3923
 
3924 3924
 
3925
-add_filter('geodir_seo_meta_title','geodir_filter_title_variables',10,3);
3926
-add_filter('geodir_seo_page_title','geodir_filter_title_variables',10,2);
3927
-add_filter('geodir_seo_meta_description_pre','geodir_filter_title_variables',10,3);
3928
-function geodir_filter_title_variables($title, $gd_page, $sep=''){
3925
+add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
3926
+add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
3927
+add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
3928
+function geodir_filter_title_variables($title, $gd_page, $sep = '') {
3929 3929
 
3930 3930
 
3931
-    if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
3931
+    if (!$gd_page || !$title) {return $title; }// if no a GD page then bail.
3932 3932
     global $post;
3933 3933
     //print_r($post);
3934 3934
     /*
@@ -3970,119 +3970,119 @@  discard block
 block discarded – undo
3970 3970
     }
3971 3971
 
3972 3972
 
3973
-    if(strpos($title,'%%title%%') !== false){
3974
-        $title = str_replace("%%title%%",$post->post_title,$title);
3973
+    if (strpos($title, '%%title%%') !== false) {
3974
+        $title = str_replace("%%title%%", $post->post_title, $title);
3975 3975
     }
3976 3976
 
3977
-    if(strpos($title,'%%sitename%%') !== false){
3978
-        $title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
3977
+    if (strpos($title, '%%sitename%%') !== false) {
3978
+        $title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
3979 3979
     }
3980 3980
 
3981
-    if(strpos($title,'%%sitedesc%%') !== false){
3982
-        $title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
3981
+    if (strpos($title, '%%sitedesc%%') !== false) {
3982
+        $title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
3983 3983
     }
3984 3984
 
3985
-    if(strpos($title,'%%excerpt%%') !== false){
3986
-        $title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
3985
+    if (strpos($title, '%%excerpt%%') !== false) {
3986
+        $title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
3987 3987
     }
3988 3988
 
3989
-    if(strpos($title,'%%pt_single%%') !== false){
3989
+    if (strpos($title, '%%pt_single%%') !== false) {
3990 3990
         $single_name = '';
3991
-        if($gd_page=='search' || $gd_page=='author'){
3991
+        if ($gd_page == 'search' || $gd_page == 'author') {
3992 3992
             $geodir_post_types = get_option('geodir_post_types');
3993 3993
             $spt = esc_attr($_REQUEST['stype']);
3994
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
3995
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
3994
+            if (isset($geodir_post_types[$spt]['labels']['singular_name'])) {
3995
+                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'], 'geodirectory');
3996 3996
             }
3997
-        }elseif($gd_page=='add-listing'){
3997
+        }elseif ($gd_page == 'add-listing') {
3998 3998
             $geodir_post_types = get_option('geodir_post_types');
3999 3999
             $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
4000
-            if(!$spt && isset($_REQUEST['pid'])){
4001
-                $spt = get_post_type( $_REQUEST['pid'] );
4000
+            if (!$spt && isset($_REQUEST['pid'])) {
4001
+                $spt = get_post_type($_REQUEST['pid']);
4002 4002
             }
4003
-            if(!$spt){$spt='gd_place';}
4004
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4005
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4003
+            if (!$spt) {$spt = 'gd_place'; }
4004
+            if (isset($geodir_post_types[$spt]['labels']['singular_name'])) {
4005
+                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'], 'geodirectory');
4006 4006
             }
4007 4007
         }
4008
-        elseif($post->post_type){
4008
+        elseif ($post->post_type) {
4009 4009
             $geodir_post_types = get_option('geodir_post_types');
4010
-            if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4011
-                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
4010
+            if (isset($geodir_post_types[$post->post_type]['labels']['singular_name'])) {
4011
+                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'], 'geodirectory');
4012 4012
             }
4013 4013
 
4014 4014
 
4015 4015
         }
4016
-        $title = str_replace("%%pt_single%%",$single_name,$title);
4016
+        $title = str_replace("%%pt_single%%", $single_name, $title);
4017 4017
     }
4018 4018
 
4019
-    if(strpos($title,'%%pt_plural%%') !== false){
4019
+    if (strpos($title, '%%pt_plural%%') !== false) {
4020 4020
         $plural_name = '';
4021
-        if($gd_page=='search' || $gd_page=='author'){
4021
+        if ($gd_page == 'search' || $gd_page == 'author') {
4022 4022
             $geodir_post_types = get_option('geodir_post_types');
4023 4023
             $spt = esc_attr($_REQUEST['stype']);
4024
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4025
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4024
+            if (isset($geodir_post_types[$spt]['labels']['name'])) {
4025
+                $plural_name = __($geodir_post_types[$spt]['labels']['name'], 'geodirectory');
4026 4026
             }
4027
-        }elseif($gd_page=='add-listing'){
4027
+        }elseif ($gd_page == 'add-listing') {
4028 4028
             $geodir_post_types = get_option('geodir_post_types');
4029 4029
             $spt = sanitize_text_field($_REQUEST['listing_type']);
4030
-            if(!$spt){$spt='gd_place';}
4031
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4032
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4030
+            if (!$spt) {$spt = 'gd_place'; }
4031
+            if (isset($geodir_post_types[$spt]['labels']['name'])) {
4032
+                $plural_name = __($geodir_post_types[$spt]['labels']['name'], 'geodirectory');
4033 4033
             }
4034 4034
         }
4035
-        elseif(isset($post->post_type) && $post->post_type){
4035
+        elseif (isset($post->post_type) && $post->post_type) {
4036 4036
             $geodir_post_types = get_option('geodir_post_types');
4037
-            if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4038
-                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
4037
+            if (isset($geodir_post_types[$post->post_type]['labels']['name'])) {
4038
+                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'], 'geodirectory');
4039 4039
             }
4040 4040
 
4041 4041
         }
4042
-        $title = str_replace("%%pt_plural%%",$plural_name,$title);
4042
+        $title = str_replace("%%pt_plural%%", $plural_name, $title);
4043 4043
     }
4044 4044
 
4045 4045
 
4046 4046
 
4047
-    if(strpos($title,'%%category%%') !== false){
4047
+    if (strpos($title, '%%category%%') !== false) {
4048 4048
         $cat_name = '';
4049 4049
 
4050
-        if($gd_page=='detail') {
4050
+        if ($gd_page == 'detail') {
4051 4051
             if ($post->default_category) {
4052 4052
                 $cat = get_term($post->default_category, $post->post_type . 'category');
4053 4053
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4054 4054
             }
4055
-        }elseif($gd_page=='listing'){
4055
+        }elseif ($gd_page == 'listing') {
4056 4056
             $queried_object = get_queried_object();
4057
-            if(isset($queried_object->name)){
4057
+            if (isset($queried_object->name)) {
4058 4058
                 $cat_name = $queried_object->name;
4059 4059
             }
4060 4060
         }
4061
-        $title = str_replace("%%category%%",$cat_name,$title);
4061
+        $title = str_replace("%%category%%", $cat_name, $title);
4062 4062
     }
4063 4063
 
4064
-    if(strpos($title,'%%tag%%') !== false){
4064
+    if (strpos($title, '%%tag%%') !== false) {
4065 4065
         $cat_name = '';
4066 4066
 
4067
-        if($gd_page=='detail') {
4067
+        if ($gd_page == 'detail') {
4068 4068
             if ($post->default_category) {
4069 4069
                 $cat = get_term($post->default_category, $post->post_type . 'category');
4070 4070
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4071 4071
             }
4072
-        }elseif($gd_page=='listing'){
4072
+        }elseif ($gd_page == 'listing') {
4073 4073
             $queried_object = get_queried_object();
4074
-            if(isset($queried_object->name)){
4074
+            if (isset($queried_object->name)) {
4075 4075
                 $cat_name = $queried_object->name;
4076 4076
             }
4077 4077
         }
4078
-        $title = str_replace("%%tag%%",$cat_name,$title);
4078
+        $title = str_replace("%%tag%%", $cat_name, $title);
4079 4079
     }
4080 4080
 
4081 4081
 
4082 4082
 
4083
-    if(strpos($title,'%%id%%') !== false){
4083
+    if (strpos($title, '%%id%%') !== false) {
4084 4084
         $ID = (isset($post->ID)) ? $post->ID : '';
4085
-        $title = str_replace("%%id%%",$ID,$title);
4085
+        $title = str_replace("%%id%%", $ID, $title);
4086 4086
     }
4087 4087
 
4088 4088
     /*
@@ -4095,8 +4095,8 @@  discard block
 block discarded – undo
4095 4095
         }
4096 4096
     */
4097 4097
 
4098
-    if(strpos($title,'%%sep%%') !== false){
4099
-        $title = str_replace("%%sep%%",$sep,$title);
4098
+    if (strpos($title, '%%sep%%') !== false) {
4099
+        $title = str_replace("%%sep%%", $sep, $title);
4100 4100
     }
4101 4101
 
4102 4102
 
@@ -4114,12 +4114,12 @@  discard block
 block discarded – undo
4114 4114
      * @param string $gd_page The page being filtered.
4115 4115
      * @param string $sep The separator, default: `|`.
4116 4116
      */
4117
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4117
+    $location_array = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
4118 4118
     $location_titles = array();
4119
-    if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4120
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4121
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4122
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4119
+    if ($gd_page == 'location' && get_query_var('gd_country_full')) {
4120
+        if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
4121
+        if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
4122
+        if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
4123 4123
     }
4124 4124
     $location_single = '';
4125 4125
     $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
@@ -4191,65 +4191,65 @@  discard block
 block discarded – undo
4191 4191
     }
4192 4192
 
4193 4193
 
4194
-    if(strpos($title,'%%location%%') !== false){
4194
+    if (strpos($title, '%%location%%') !== false) {
4195 4195
         $location = '';
4196
-        if($location_titles) {
4196
+        if ($location_titles) {
4197 4197
             $location = implode(", ", $location_titles);
4198 4198
         }
4199
-        $title = str_replace("%%location%%",$location,$title);
4199
+        $title = str_replace("%%location%%", $location, $title);
4200 4200
     }
4201 4201
 
4202
-    if(strpos($title,'%%in_location%%') !== false){
4202
+    if (strpos($title, '%%in_location%%') !== false) {
4203 4203
         $location = '';
4204
-        if($location_titles) {
4204
+        if ($location_titles) {
4205 4205
             $location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4206 4206
         }
4207
-        $title = str_replace("%%in_location%%",$location,$title);
4207
+        $title = str_replace("%%in_location%%", $location, $title);
4208 4208
     }
4209 4209
 
4210
-    if(strpos($title,'%%in_location_single%%') !== false){
4211
-        if($location_single) {
4212
-            $location_single = __('in', 'geodirectory') . ' ' .$location_single;
4210
+    if (strpos($title, '%%in_location_single%%') !== false) {
4211
+        if ($location_single) {
4212
+            $location_single = __('in', 'geodirectory') . ' ' . $location_single;
4213 4213
         }
4214
-        $title = str_replace("%%in_location_single%%",$location_single,$title);
4214
+        $title = str_replace("%%in_location_single%%", $location_single, $title);
4215 4215
     }
4216 4216
 
4217
-    if(strpos($title,'%%location_single%%') !== false){
4218
-        $title = str_replace("%%location_single%%",$location_single,$title);
4217
+    if (strpos($title, '%%location_single%%') !== false) {
4218
+        $title = str_replace("%%location_single%%", $location_single, $title);
4219 4219
     }
4220 4220
 
4221 4221
 
4222
-    if(strpos($title,'%%search_term%%') !== false){
4222
+    if (strpos($title, '%%search_term%%') !== false) {
4223 4223
         $search_term = '';
4224
-        if(isset($_REQUEST['s'])){
4224
+        if (isset($_REQUEST['s'])) {
4225 4225
             $search_term = esc_attr($_REQUEST['s']);
4226 4226
         }
4227
-        $title = str_replace("%%search_term%%",$search_term,$title);
4227
+        $title = str_replace("%%search_term%%", $search_term, $title);
4228 4228
     }
4229 4229
 
4230
-    if(strpos($title,'%%search_near%%') !== false){
4230
+    if (strpos($title, '%%search_near%%') !== false) {
4231 4231
         $search_term = '';
4232
-        if(isset($_REQUEST['snear'])){
4232
+        if (isset($_REQUEST['snear'])) {
4233 4233
             $search_term = esc_attr($_REQUEST['snear']);
4234 4234
         }
4235
-        $title = str_replace("%%search_near%%",$search_term,$title);
4235
+        $title = str_replace("%%search_near%%", $search_term, $title);
4236 4236
     }
4237 4237
 
4238
-    if(strpos($title,'%%name%%') !== false){
4238
+    if (strpos($title, '%%name%%') !== false) {
4239 4239
         $author_name = '';
4240
-        if($author_name = get_the_author()){}
4241
-        else{
4240
+        if ($author_name = get_the_author()) {}
4241
+        else {
4242 4242
             $queried_object = get_queried_object();
4243
-            if(isset($queried_object->data->user_nicename)){
4243
+            if (isset($queried_object->data->user_nicename)) {
4244 4244
                 $author_name = $queried_object->data->user_nicename;
4245 4245
             }
4246 4246
         }
4247
-        $title = str_replace("%%name%%",$author_name,$title);
4247
+        $title = str_replace("%%name%%", $author_name, $title);
4248 4248
     }
4249 4249
 
4250
-    $title = wptexturize( $title );
4251
-    $title = convert_chars( $title );
4252
-    $title = esc_html( $title );
4250
+    $title = wptexturize($title);
4251
+    $title = convert_chars($title);
4252
+    $title = esc_html($title);
4253 4253
 
4254 4254
     /**
4255 4255
      * Filter the title variables after standard ones have been filtered.
@@ -4262,7 +4262,7 @@  discard block
 block discarded – undo
4262 4262
      * @param string $sep The separator, default: `|`.
4263 4263
      */
4264 4264
 
4265
-    return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4265
+    return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
4266 4266
 }
4267 4267
 
4268 4268
 /**
Please login to merge, or discard this patch.
geodirectory-functions/shortcode_functions.php 1 patch
Indentation   +358 added lines, -358 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
365 365
             }
366 366
         </script>
367 367
     <?php
368
-    }
368
+	}
369 369
 }
370 370
 
371 371
 /**
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
@@ -574,61 +574,61 @@  discard block
 block discarded – undo
574 574
 	$pageno 	 		 = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1;
575 575
 	
576 576
 	$query_args = array(
577
-        'posts_per_page' => $post_number,
578
-        'is_geodir_loop' => true,
579
-        'gd_location' => $add_location_filter,
580
-        'post_type' => $post_type,
581
-        'order_by' => $list_sort,
577
+		'posts_per_page' => $post_number,
578
+		'is_geodir_loop' => true,
579
+		'gd_location' => $add_location_filter,
580
+		'post_type' => $post_type,
581
+		'order_by' => $list_sort,
582 582
 		'pageno' => $pageno
583
-    );
583
+	);
584 584
 
585
-    if ($character_count >= 0) {
586
-        $query_args['excerpt_length'] = $character_count;
587
-    }
585
+	if ($character_count >= 0) {
586
+		$query_args['excerpt_length'] = $character_count;
587
+	}
588 588
     
589
-    if (!empty($args['post_author'])) {
590
-        $query_args['post_author'] = $args['post_author'];
591
-    }
589
+	if (!empty($args['post_author'])) {
590
+		$query_args['post_author'] = $args['post_author'];
591
+	}
592 592
 
593
-    if (!empty($args['show_featured_only'])) {
594
-        $query_args['show_featured_only'] = 1;
595
-    }
593
+	if (!empty($args['show_featured_only'])) {
594
+		$query_args['show_featured_only'] = 1;
595
+	}
596 596
 
597
-    if (!empty($args['show_special_only'])) {
598
-        $query_args['show_special_only'] = 1;
599
-    }
597
+	if (!empty($args['show_special_only'])) {
598
+		$query_args['show_special_only'] = 1;
599
+	}
600 600
 
601
-    if (!empty($args['with_pics_only'])) {
602
-        $query_args['with_pics_only'] = 0;
603
-        $query_args['featured_image_only'] = 1;
604
-    }
601
+	if (!empty($args['with_pics_only'])) {
602
+		$query_args['with_pics_only'] = 0;
603
+		$query_args['featured_image_only'] = 1;
604
+	}
605 605
 
606
-    if (!empty($args['with_videos_only'])) {
607
-        $query_args['with_videos_only'] = 1;
608
-    }
609
-    $with_no_results = !empty($args['without_no_results']) ? false : true;
606
+	if (!empty($args['with_videos_only'])) {
607
+		$query_args['with_videos_only'] = 1;
608
+	}
609
+	$with_no_results = !empty($args['without_no_results']) ? false : true;
610 610
 
611
-    if (!empty($category) && isset($category[0]) && $category[0] != '0') {
612
-        $category_taxonomy = geodir_get_taxonomies($post_type);
611
+	if (!empty($category) && isset($category[0]) && $category[0] != '0') {
612
+		$category_taxonomy = geodir_get_taxonomies($post_type);
613 613
 
614
-        ######### WPML #########
615
-        if (function_exists('icl_object_id')) {
616
-            $category = gd_lang_object_ids($category, $category_taxonomy[0]);
617
-        }
618
-        ######### WPML #########
614
+		######### WPML #########
615
+		if (function_exists('icl_object_id')) {
616
+			$category = gd_lang_object_ids($category, $category_taxonomy[0]);
617
+		}
618
+		######### WPML #########
619 619
 
620
-        $tax_query = array(
621
-            'taxonomy' => $category_taxonomy[0],
622
-            'field' => 'id',
623
-            'terms' => $category
624
-        );
620
+		$tax_query = array(
621
+			'taxonomy' => $category_taxonomy[0],
622
+			'field' => 'id',
623
+			'terms' => $category
624
+		);
625 625
 
626
-        $query_args['tax_query'] = array($tax_query);
627
-    }
626
+		$query_args['tax_query'] = array($tax_query);
627
+	}
628 628
 
629
-    global $gridview_columns_widget, $geodir_is_widget_listing;
629
+	global $gridview_columns_widget, $geodir_is_widget_listing;
630 630
 
631
-    if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) {
631
+	if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) {
632 632
 		global $geodir_event_widget_listview;
633 633
 		$geodir_event_widget_listview = true;
634 634
 		
@@ -645,15 +645,15 @@  discard block
 block discarded – undo
645 645
 	}
646 646
 	$current_gridview_columns_widget = $gridview_columns_widget;
647 647
 
648
-    ob_start();
648
+	ob_start();
649 649
 	if (!empty($widget_listings) || $with_no_results) {
650 650
 		if (!$geodir_ajax) {
651
-        /**
652
-         * Called before the shortcode [gd_listings] content is output.
653
-         *
654
-         * @since 1.0.0
655
-         */
656
-        do_action('geodir_before_sc_gd_listings');
651
+		/**
652
+		 * Called before the shortcode [gd_listings] content is output.
653
+		 *
654
+		 * @since 1.0.0
655
+		 */
656
+		do_action('geodir_before_sc_gd_listings');
657 657
 		?>
658 658
         <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings">
659 659
 		<?php } ?>
@@ -663,15 +663,15 @@  discard block
 block discarded – undo
663 663
             </div>
664 664
 			<?php } ?>
665 665
             <?php
666
-            if (strstr($layout, 'gridview')) {
667
-                $listing_view_exp = explode('_', $layout);
668
-                $gridview_columns_widget = $layout;
669
-                $layout = $listing_view_exp[0];
670
-            } else {
671
-                $gridview_columns_widget = '';
672
-            }
666
+			if (strstr($layout, 'gridview')) {
667
+				$listing_view_exp = explode('_', $layout);
668
+				$gridview_columns_widget = $layout;
669
+				$layout = $listing_view_exp[0];
670
+			} else {
671
+				$gridview_columns_widget = '';
672
+			}
673 673
 
674
-            /**
674
+			/**
675 675
 			 * Filter the widget listing listview template.
676 676
 			 *
677 677
 			 * @since 1.0.0
@@ -680,43 +680,43 @@  discard block
 block discarded – undo
680 680
 			 */
681 681
 			$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
682 682
             			
683
-            global $post, $map_jason, $map_canvas_arr, $gd_session;
683
+			global $post, $map_jason, $map_canvas_arr, $gd_session;
684 684
 
685
-            $current_post = $post;
686
-            $current_map_jason = $map_jason;
687
-            $current_map_canvas_arr = $map_canvas_arr;
688
-            $geodir_is_widget_listing = true;
685
+			$current_post = $post;
686
+			$current_map_jason = $map_jason;
687
+			$current_map_canvas_arr = $map_canvas_arr;
688
+			$geodir_is_widget_listing = true;
689 689
 			$gd_session->un_set('gd_listing_view');
690 690
 
691
-            if ($with_pagination && $top_pagination) {				
691
+			if ($with_pagination && $top_pagination) {				
692 692
 				echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno);
693 693
 			}
694 694
 
695
-            /**
696
-             * Includes listing listview template.
697
-             *
698
-             * @since 1.0.0
699
-             */
695
+			/**
696
+			 * Includes listing listview template.
697
+			 *
698
+			 * @since 1.0.0
699
+			 */
700 700
 			include($template);
701 701
 			
702 702
 			if ($with_pagination && $bottom_pagination) {				
703 703
 				echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno);
704 704
 			}
705 705
 
706
-            $geodir_is_widget_listing = false;
706
+			$geodir_is_widget_listing = false;
707 707
 
708
-            $GLOBALS['post'] = $current_post;
708
+			$GLOBALS['post'] = $current_post;
709 709
 			if (!empty($current_post)) {
710
-            	setup_postdata($current_post);
710
+				setup_postdata($current_post);
711 711
 			}
712
-            $map_jason = $current_map_jason;
713
-            $map_canvas_arr = $current_map_canvas_arr;
712
+			$map_jason = $current_map_jason;
713
+			$map_canvas_arr = $current_map_canvas_arr;
714 714
 			global $gridview_columns_widget;
715 715
 			$gridview_columns_widget = $current_gridview_columns_widget;
716 716
 			?>
717 717
 			<p class="geodir-sclisting-loading" style="display:none;"><i class="fa fa-cog fa-spin"></i></p>
718 718
 			<?php
719
-            if (!$geodir_ajax) { 
719
+			if (!$geodir_ajax) { 
720 720
 			?>
721 721
         </div>
722 722
 		<script type="text/javascript">
@@ -753,11 +753,11 @@  discard block
 block discarded – undo
753 753
 		</script>
754 754
 		<?php } ?>
755 755
     <?php
756
-    }
756
+	}
757 757
 	$output = ob_get_contents();
758
-    ob_end_clean();
758
+	ob_end_clean();
759 759
 
760
-    return trim($output);
760
+	return trim($output);
761 761
 }
762 762
 
763 763
 /**
@@ -784,15 +784,15 @@  discard block
 block discarded – undo
784 784
  * @return string Listings pagination HTML content.
785 785
  */
786 786
 function geodir_sc_listings_pagination($total_posts, $posts_per_page, $pageno, $before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
787
-    if (empty($prelabel)) {
788
-        $prelabel = '<strong>&laquo;</strong>';
789
-    }
787
+	if (empty($prelabel)) {
788
+		$prelabel = '<strong>&laquo;</strong>';
789
+	}
790 790
 
791
-    if (empty($nxtlabel)) {
792
-        $nxtlabel = '<strong>&raquo;</strong>';
793
-    }
791
+	if (empty($nxtlabel)) {
792
+		$nxtlabel = '<strong>&raquo;</strong>';
793
+	}
794 794
 
795
-    $half_pages_to_show = round($pages_to_show / 2);
795
+	$half_pages_to_show = round($pages_to_show / 2);
796 796
 
797 797
 	$numposts = $total_posts;
798 798
 
@@ -848,9 +848,9 @@  discard block
 block discarded – undo
848 848
 		echo "</div> $after";
849 849
 	}
850 850
 	$output = ob_get_contents();
851
-    ob_end_clean();
851
+	ob_end_clean();
852 852
 
853
-    return trim($output);
853
+	return trim($output);
854 854
 }
855 855
 
856 856
 /**
@@ -861,10 +861,10 @@  discard block
 block discarded – undo
861 861
  * @return string Listings HTML content.
862 862
  */
863 863
 function geodir_sclistings_callback() {
864
-    check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce');
865
-    //set variables
866
-    $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL;
867
-    $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1;
864
+	check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce');
865
+	//set variables
866
+	$scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL;
867
+	$pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1;
868 868
 	
869 869
 	$shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL;
870 870
 	
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 	} else {
877 877
 		echo 0;
878 878
 	}
879
-    wp_die();
879
+	wp_die();
880 880
 }
881 881
 add_action('wp_ajax_geodir_sclistings', 'geodir_sclistings_callback');
882 882
 add_action('wp_ajax_nopriv_geodir_sclistings', 'geodir_sclistings_callback');
883 883
\ No newline at end of file
Please login to merge, or discard this patch.