Passed
Push — master ( 5f5503...8bc157 )
by Stiofan
10:06
created
geodirectory-functions/general_functions.php 2 patches
Indentation   +3398 added lines, -3398 removed lines patch added patch discarded remove patch
@@ -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,11 +47,11 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function geodir_plugin_path()
49 49
 {
50
-    if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
51
-        return dirname(dirname(__FILE__));
52
-    } else {
53
-        return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__)));
54
-    }
50
+	if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
51
+		return dirname(dirname(__FILE__));
52
+	} else {
53
+		return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__)));
54
+	}
55 55
 }
56 56
 
57 57
 /**
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
  */
66 66
 function geodir_is_plugin_active($plugin)
67 67
 {
68
-    $active_plugins = get_option('active_plugins');
69
-    foreach ($active_plugins as $key => $active_plugin) {
70
-        if (strstr($active_plugin, $plugin)) return true;
71
-    }
72
-    return false;
68
+	$active_plugins = get_option('active_plugins');
69
+	foreach ($active_plugins as $key => $active_plugin) {
70
+		if (strstr($active_plugin, $plugin)) return true;
71
+	}
72
+	return false;
73 73
 }
74 74
 
75 75
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
  */
86 86
 function geodir_get_formated_date($date)
87 87
 {
88
-    return mysql2date(get_option('date_format'), $date);
88
+	return mysql2date(get_option('date_format'), $date);
89 89
 }
90 90
 
91 91
 /**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
  */
101 101
 function geodir_get_formated_time($time)
102 102
 {
103
-    return mysql2date(get_option('time_format'), $time, $translate = true);
103
+	return mysql2date(get_option('time_format'), $time, $translate = true);
104 104
 }
105 105
 
106 106
 
@@ -118,26 +118,26 @@  discard block
 block discarded – undo
118 118
  */
119 119
 function geodir_getlink($url, $params = array(), $use_existing_arguments = false)
120 120
 {
121
-    if ($use_existing_arguments) $params = $params + $_GET;
122
-    if (!$params) return $url;
123
-    $link = $url;
124
-    if (strpos($link, '?') === false) $link .= '?'; //If there is no '?' add one at the end
125
-    elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) $link .= '&'; //If there is no '&' at the END, add one.
126
-    elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) $link .= '&'; //If there is no '&' at the END, add one.
127
-
128
-    $params_arr = array();
129
-    foreach ($params as $key => $value) {
130
-        if (gettype($value) == 'array') { //Handle array data properly
131
-            foreach ($value as $val) {
132
-                $params_arr[] = $key . '[]=' . urlencode($val);
133
-            }
134
-        } else {
135
-            $params_arr[] = $key . '=' . urlencode($value);
136
-        }
137
-    }
138
-    $link .= implode('&', $params_arr);
139
-
140
-    return $link;
121
+	if ($use_existing_arguments) $params = $params + $_GET;
122
+	if (!$params) return $url;
123
+	$link = $url;
124
+	if (strpos($link, '?') === false) $link .= '?'; //If there is no '?' add one at the end
125
+	elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) $link .= '&'; //If there is no '&' at the END, add one.
126
+	elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) $link .= '&'; //If there is no '&' at the END, add one.
127
+
128
+	$params_arr = array();
129
+	foreach ($params as $key => $value) {
130
+		if (gettype($value) == 'array') { //Handle array data properly
131
+			foreach ($value as $val) {
132
+				$params_arr[] = $key . '[]=' . urlencode($val);
133
+			}
134
+		} else {
135
+			$params_arr[] = $key . '=' . urlencode($value);
136
+		}
137
+	}
138
+	$link .= implode('&', $params_arr);
139
+
140
+	return $link;
141 141
 }
142 142
 
143 143
 
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
  */
153 153
 function geodir_get_addlisting_link($post_type = '')
154 154
 {
155
-    global $wpdb;
155
+	global $wpdb;
156 156
 
157
-    //$check_pkg  = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'");
158
-    $check_pkg = 1;
159
-    if (post_type_exists($post_type) && $check_pkg) {
157
+	//$check_pkg  = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'");
158
+	$check_pkg = 1;
159
+	if (post_type_exists($post_type) && $check_pkg) {
160 160
 
161
-        $add_listing_link = get_page_link(geodir_add_listing_page_id());
161
+		$add_listing_link = get_page_link(geodir_add_listing_page_id());
162 162
 
163
-        return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
164
-    } else
165
-        return get_bloginfo('url');
163
+		return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
164
+	} else
165
+		return get_bloginfo('url');
166 166
 }
167 167
 
168 168
 /**
@@ -175,19 +175,19 @@  discard block
 block discarded – undo
175 175
  */
176 176
 function geodir_curPageURL()
177 177
 {
178
-    $pageURL = 'http';
179
-    if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
180
-        $pageURL .= "s";
181
-    }
182
-    $pageURL .= "://";
183
-    $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
184
-    /**
185
-     * Filter the current page URL returned by function geodir_curPageURL().
186
-     *
187
-     * @since 1.4.1
188
-     * @param string $pageURL The URL of the current page.
189
-     */
190
-    return apply_filters('geodir_curPageURL', $pageURL);
178
+	$pageURL = 'http';
179
+	if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
180
+		$pageURL .= "s";
181
+	}
182
+	$pageURL .= "://";
183
+	$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
184
+	/**
185
+	 * Filter the current page URL returned by function geodir_curPageURL().
186
+	 *
187
+	 * @since 1.4.1
188
+	 * @param string $pageURL The URL of the current page.
189
+	 */
190
+	return apply_filters('geodir_curPageURL', $pageURL);
191 191
 }
192 192
 
193 193
 
@@ -204,12 +204,12 @@  discard block
 block discarded – undo
204 204
 function geodir_clean($string)
205 205
 {
206 206
 
207
-    $string = trim(strip_tags(stripslashes($string)));
208
-    $string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
209
-    $string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars.
210
-    $string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
207
+	$string = trim(strip_tags(stripslashes($string)));
208
+	$string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
209
+	$string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars.
210
+	$string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
211 211
 
212
-    return $string;
212
+	return $string;
213 213
 }
214 214
 
215 215
 /**
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
  */
222 222
 function geodir_get_weekday()
223 223
 {
224
-    return array(__('Sunday', 'geodirectory'), __('Monday', 'geodirectory'), __('Tuesday', 'geodirectory'), __('Wednesday', 'geodirectory'), __('Thursday', 'geodirectory'), __('Friday', 'geodirectory'), __('Saturday', 'geodirectory'));
224
+	return array(__('Sunday', 'geodirectory'), __('Monday', 'geodirectory'), __('Tuesday', 'geodirectory'), __('Wednesday', 'geodirectory'), __('Thursday', 'geodirectory'), __('Friday', 'geodirectory'), __('Saturday', 'geodirectory'));
225 225
 }
226 226
 
227 227
 /**
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
  */
234 234
 function geodir_get_weeks()
235 235
 {
236
-    return array(__('First', 'geodirectory'), __('Second', 'geodirectory'), __('Third', 'geodirectory'), __('Fourth', 'geodirectory'), __('Last', 'geodirectory'));
236
+	return array(__('First', 'geodirectory'), __('Second', 'geodirectory'), __('Third', 'geodirectory'), __('Fourth', 'geodirectory'), __('Last', 'geodirectory'));
237 237
 }
238 238
 
239 239
 
@@ -252,103 +252,103 @@  discard block
 block discarded – undo
252 252
 function geodir_is_page($gdpage = '')
253 253
 {
254 254
 
255
-    global $wp_query, $post,$wp;
256
-    //if(!is_admin()):
257
-
258
-    switch ($gdpage):
259
-        case 'add-listing':
260
-
261
-            if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) {
262
-                return true;
263
-            } elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
264
-                return true;
265
-            }
266
-
267
-            break;
268
-        case 'preview':
269
-            if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
270
-                && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
271
-            )
272
-                return true;
273
-            break;
274
-        case 'listing-success':
275
-            if (is_page() && get_query_var('page_id') == geodir_success_page_id())
276
-                return true;
277
-            break;
278
-        case 'detail':
279
-            $post_type = get_query_var('post_type');
280
-            if(is_array($post_type)){$post_type = reset($post_type);}
281
-            if (is_single() && in_array($post_type, geodir_get_posttypes()))
282
-                return true;
283
-            break;
284
-        case 'pt':
285
-            $post_type = get_query_var('post_type');
286
-            if(is_array($post_type)){$post_type = reset($post_type);}
287
-            if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax())
288
-                return true;
289
-
290
-            break;
291
-        case 'listing':
292
-            if (is_tax() && geodir_get_taxonomy_posttype()) {
293
-                global $current_term, $taxonomy, $term;
294
-
295
-                return true;
296
-            }
297
-            $post_type = get_query_var('post_type');
298
-            if(is_array($post_type)){$post_type = reset($post_type);}
299
-            if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()))
300
-                return true;
301
-
302
-            break;
303
-        case 'home':
304
-
305
-            if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home())
306
-                return true;
307
-
308
-            break;
309
-        case 'location':
310
-            if (is_page() && get_query_var('page_id') == geodir_location_page_id())
311
-                return true;
312
-            break;
313
-        case 'author':
314
-            if (is_author() && isset($_REQUEST['geodir_dashbord']))
315
-                return true;
255
+	global $wp_query, $post,$wp;
256
+	//if(!is_admin()):
257
+
258
+	switch ($gdpage):
259
+		case 'add-listing':
260
+
261
+			if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) {
262
+				return true;
263
+			} elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
264
+				return true;
265
+			}
266
+
267
+			break;
268
+		case 'preview':
269
+			if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
270
+				&& in_array($_REQUEST['listing_type'], geodir_get_posttypes())
271
+			)
272
+				return true;
273
+			break;
274
+		case 'listing-success':
275
+			if (is_page() && get_query_var('page_id') == geodir_success_page_id())
276
+				return true;
277
+			break;
278
+		case 'detail':
279
+			$post_type = get_query_var('post_type');
280
+			if(is_array($post_type)){$post_type = reset($post_type);}
281
+			if (is_single() && in_array($post_type, geodir_get_posttypes()))
282
+				return true;
283
+			break;
284
+		case 'pt':
285
+			$post_type = get_query_var('post_type');
286
+			if(is_array($post_type)){$post_type = reset($post_type);}
287
+			if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax())
288
+				return true;
289
+
290
+			break;
291
+		case 'listing':
292
+			if (is_tax() && geodir_get_taxonomy_posttype()) {
293
+				global $current_term, $taxonomy, $term;
294
+
295
+				return true;
296
+			}
297
+			$post_type = get_query_var('post_type');
298
+			if(is_array($post_type)){$post_type = reset($post_type);}
299
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()))
300
+				return true;
301
+
302
+			break;
303
+		case 'home':
304
+
305
+			if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home())
306
+				return true;
307
+
308
+			break;
309
+		case 'location':
310
+			if (is_page() && get_query_var('page_id') == geodir_location_page_id())
311
+				return true;
312
+			break;
313
+		case 'author':
314
+			if (is_author() && isset($_REQUEST['geodir_dashbord']))
315
+				return true;
316 316
 			
317 317
 			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) {
318 318
 				if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) {
319 319
 					return true;
320 320
 				}
321 321
 			}
322
-            break;
323
-        case 'search':
324
-            if (is_search() && isset($_REQUEST['geodir_search']))
325
-                return true;
326
-            break;
327
-        case 'info':
328
-            if (is_page() && get_query_var('page_id') == geodir_info_page_id())
329
-                return true;
330
-            break;
331
-        case 'login':
332
-            if (is_page() && get_query_var('page_id') == geodir_login_page_id())
333
-                return true;
334
-            break;
335
-        case 'checkout':
336
-            if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id())
337
-                return true;
338
-            break;
339
-        case 'invoices':
340
-            if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id())
341
-                return true;
342
-            break;
343
-        default:
344
-            return false;
345
-            break;
346
-
347
-    endswitch;
348
-
349
-    //endif;
350
-
351
-    return false;
322
+			break;
323
+		case 'search':
324
+			if (is_search() && isset($_REQUEST['geodir_search']))
325
+				return true;
326
+			break;
327
+		case 'info':
328
+			if (is_page() && get_query_var('page_id') == geodir_info_page_id())
329
+				return true;
330
+			break;
331
+		case 'login':
332
+			if (is_page() && get_query_var('page_id') == geodir_login_page_id())
333
+				return true;
334
+			break;
335
+		case 'checkout':
336
+			if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id())
337
+				return true;
338
+			break;
339
+		case 'invoices':
340
+			if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id())
341
+				return true;
342
+			break;
343
+		default:
344
+			return false;
345
+			break;
346
+
347
+	endswitch;
348
+
349
+	//endif;
350
+
351
+	return false;
352 352
 }
353 353
 
354 354
 /**
@@ -362,97 +362,97 @@  discard block
 block discarded – undo
362 362
  */
363 363
 function geodir_set_is_geodir_page($wp)
364 364
 {
365
-    if (!is_admin()) {
366
-        //$wp->query_vars['gd_is_geodir_page'] = false;
367
-        //print_r()
368
-        if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
369
-            if (get_option('geodir_set_as_home'))
370
-                $wp->query_vars['gd_is_geodir_page'] = true;
371
-            if(geodir_is_page('home')){
372
-                $wp->query_vars['gd_is_geodir_page'] = true;
373
-            }
374
-
375
-
376
-        }
377
-
378
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
379
-            if (
380
-                $wp->query_vars['page_id'] == geodir_add_listing_page_id()
381
-                || $wp->query_vars['page_id'] == geodir_preview_page_id()
382
-                || $wp->query_vars['page_id'] == geodir_success_page_id()
383
-                || $wp->query_vars['page_id'] == geodir_location_page_id()
384
-                || $wp->query_vars['page_id'] == geodir_home_page_id()
385
-                || $wp->query_vars['page_id'] == geodir_info_page_id()
386
-                || $wp->query_vars['page_id'] == geodir_login_page_id()
387
-                || (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
388
-                || (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
389
-            )
390
-                $wp->query_vars['gd_is_geodir_page'] = true;
391
-        }
392
-
393
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
394
-            $page = get_page_by_path($wp->query_vars['pagename']);
395
-
396
-            if (!empty($page) && (
397
-                    $page->ID == geodir_add_listing_page_id()
398
-                    || $page->ID == geodir_preview_page_id()
399
-                    || $page->ID == geodir_success_page_id()
400
-                    || $page->ID == geodir_location_page_id()
401
-                    || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id())
402
-                    || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id())
403
-                    || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id())
404
-                    || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
405
-                    || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
406
-                )
407
-            )
408
-                $wp->query_vars['gd_is_geodir_page'] = true;
409
-        }
410
-
411
-
412
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
413
-            $requested_post_type = $wp->query_vars['post_type'];
414
-            // check if this post type is geodirectory post types 
415
-            $post_type_array = geodir_get_posttypes();
416
-            if (in_array($requested_post_type, $post_type_array)) {
417
-                $wp->query_vars['gd_is_geodir_page'] = true;
418
-            }
419
-        }
420
-
421
-        if (!isset($wp->query_vars['gd_is_geodir_page'])) {
422
-            $geodir_taxonomis = geodir_get_taxonomies('', true);
423
-            if(!empty($geodir_taxonomis)){
424
-                foreach ($geodir_taxonomis as $taxonomy) {
425
-                    if (array_key_exists($taxonomy, $wp->query_vars)) {
426
-                        $wp->query_vars['gd_is_geodir_page'] = true;
427
-                        break;
428
-                    }
429
-                }
430
-            }
431
-
432
-        }
433
-
434
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord']))
435
-            $wp->query_vars['gd_is_geodir_page'] = true;
436
-
437
-
438
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search']))
439
-            $wp->query_vars['gd_is_geodir_page'] = true;
365
+	if (!is_admin()) {
366
+		//$wp->query_vars['gd_is_geodir_page'] = false;
367
+		//print_r()
368
+		if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
369
+			if (get_option('geodir_set_as_home'))
370
+				$wp->query_vars['gd_is_geodir_page'] = true;
371
+			if(geodir_is_page('home')){
372
+				$wp->query_vars['gd_is_geodir_page'] = true;
373
+			}
374
+
375
+
376
+		}
377
+
378
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
379
+			if (
380
+				$wp->query_vars['page_id'] == geodir_add_listing_page_id()
381
+				|| $wp->query_vars['page_id'] == geodir_preview_page_id()
382
+				|| $wp->query_vars['page_id'] == geodir_success_page_id()
383
+				|| $wp->query_vars['page_id'] == geodir_location_page_id()
384
+				|| $wp->query_vars['page_id'] == geodir_home_page_id()
385
+				|| $wp->query_vars['page_id'] == geodir_info_page_id()
386
+				|| $wp->query_vars['page_id'] == geodir_login_page_id()
387
+				|| (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
388
+				|| (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
389
+			)
390
+				$wp->query_vars['gd_is_geodir_page'] = true;
391
+		}
392
+
393
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
394
+			$page = get_page_by_path($wp->query_vars['pagename']);
395
+
396
+			if (!empty($page) && (
397
+					$page->ID == geodir_add_listing_page_id()
398
+					|| $page->ID == geodir_preview_page_id()
399
+					|| $page->ID == geodir_success_page_id()
400
+					|| $page->ID == geodir_location_page_id()
401
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id())
402
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id())
403
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id())
404
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
405
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
406
+				)
407
+			)
408
+				$wp->query_vars['gd_is_geodir_page'] = true;
409
+		}
410
+
411
+
412
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
413
+			$requested_post_type = $wp->query_vars['post_type'];
414
+			// check if this post type is geodirectory post types 
415
+			$post_type_array = geodir_get_posttypes();
416
+			if (in_array($requested_post_type, $post_type_array)) {
417
+				$wp->query_vars['gd_is_geodir_page'] = true;
418
+			}
419
+		}
420
+
421
+		if (!isset($wp->query_vars['gd_is_geodir_page'])) {
422
+			$geodir_taxonomis = geodir_get_taxonomies('', true);
423
+			if(!empty($geodir_taxonomis)){
424
+				foreach ($geodir_taxonomis as $taxonomy) {
425
+					if (array_key_exists($taxonomy, $wp->query_vars)) {
426
+						$wp->query_vars['gd_is_geodir_page'] = true;
427
+						break;
428
+					}
429
+				}
430
+			}
431
+
432
+		}
433
+
434
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord']))
435
+			$wp->query_vars['gd_is_geodir_page'] = true;
436
+
437
+
438
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search']))
439
+			$wp->query_vars['gd_is_geodir_page'] = true;
440 440
 
441 441
 
442 442
 //check if homepage
443
-        if(!isset($wp->query_vars['gd_is_geodir_page'])
444
-            && !isset($wp->query_vars['page_id'])
445
-            && !isset($wp->query_vars['pagename'])
446
-            && is_page_geodir_home()){
447
-            $wp->query_vars['gd_is_geodir_page'] = true;
448
-        }
449
-        //echo $wp->query_vars['gd_is_geodir_page'] ;
450
-        /*echo "<pre>" ;
443
+		if(!isset($wp->query_vars['gd_is_geodir_page'])
444
+			&& !isset($wp->query_vars['page_id'])
445
+			&& !isset($wp->query_vars['pagename'])
446
+			&& is_page_geodir_home()){
447
+			$wp->query_vars['gd_is_geodir_page'] = true;
448
+		}
449
+		//echo $wp->query_vars['gd_is_geodir_page'] ;
450
+		/*echo "<pre>" ;
451 451
 		print_r($wp) ;
452 452
 		echo "</pre>" ;
453 453
 	//	exit();
454 454
 			*/
455
-    } // end of is admin
455
+	} // end of is admin
456 456
 }
457 457
 
458 458
 /**
@@ -465,56 +465,56 @@  discard block
 block discarded – undo
465 465
  */
466 466
 function geodir_is_geodir_page()
467 467
 {
468
-    global $wp;
469
-    if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page'])
470
-        return true;
471
-    else
472
-        return false;
468
+	global $wp;
469
+	if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page'])
470
+		return true;
471
+	else
472
+		return false;
473 473
 }
474 474
 
475 475
 if (!function_exists('geodir_get_imagesize')) {
476
-    /**
477
-     * Get image size using the size key .
478
-     *
479
-     * @since 1.0.0
480
-     * @package GeoDirectory
481
-     * @param string $size The image size key.
482
-     * @return array|mixed|void|WP_Error If valid returns image size. Else returns error.
483
-     */
484
-    function geodir_get_imagesize($size = '')
485
-    {
486
-
487
-        $imagesizes = array('list-thumb' => array('w' => 283, 'h' => 188),
488
-            'thumbnail' => array('w' => 125, 'h' => 125),
489
-            'widget-thumb' => array('w' => 50, 'h' => 50),
490
-            'slider-thumb' => array('w' => 100, 'h' => 100)
491
-        );
492
-
493
-        /**
494
-         * Filter the image sizes array.
495
-         *
496
-         * @since 1.0.0
497
-         * @param array $imagesizes Image size array.
498
-         */
499
-        $imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
500
-
501
-        if (!empty($size) && array_key_exists($size, $imagesizes)) {
502
-            /**
503
-             * Filters image size of the passed key.
504
-             *
505
-             * @since 1.0.0
506
-             * @param array $imagesizes[$size] Image size array of the passed key.
507
-             */
508
-            return apply_filters('geodir_get_imagesize_' . $size, $imagesizes[$size]);
509
-
510
-        } elseif (!empty($size)) {
511
-
512
-            return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
513
-
514
-        }
515
-
516
-        return $imagesizes;
517
-    }
476
+	/**
477
+	 * Get image size using the size key .
478
+	 *
479
+	 * @since 1.0.0
480
+	 * @package GeoDirectory
481
+	 * @param string $size The image size key.
482
+	 * @return array|mixed|void|WP_Error If valid returns image size. Else returns error.
483
+	 */
484
+	function geodir_get_imagesize($size = '')
485
+	{
486
+
487
+		$imagesizes = array('list-thumb' => array('w' => 283, 'h' => 188),
488
+			'thumbnail' => array('w' => 125, 'h' => 125),
489
+			'widget-thumb' => array('w' => 50, 'h' => 50),
490
+			'slider-thumb' => array('w' => 100, 'h' => 100)
491
+		);
492
+
493
+		/**
494
+		 * Filter the image sizes array.
495
+		 *
496
+		 * @since 1.0.0
497
+		 * @param array $imagesizes Image size array.
498
+		 */
499
+		$imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
500
+
501
+		if (!empty($size) && array_key_exists($size, $imagesizes)) {
502
+			/**
503
+			 * Filters image size of the passed key.
504
+			 *
505
+			 * @since 1.0.0
506
+			 * @param array $imagesizes[$size] Image size array of the passed key.
507
+			 */
508
+			return apply_filters('geodir_get_imagesize_' . $size, $imagesizes[$size]);
509
+
510
+		} elseif (!empty($size)) {
511
+
512
+			return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
513
+
514
+		}
515
+
516
+		return $imagesizes;
517
+	}
518 518
 }
519 519
 
520 520
 /**
@@ -534,151 +534,151 @@  discard block
 block discarded – undo
534 534
 
535 535
 
536 536
 if (!function_exists('createRandomString')) {
537
-    /**
538
-     * Creates random string.
539
-     *
540
-     * @since 1.0.0
541
-     * @package GeoDirectory
542
-     * @return string Random string.
543
-     */
544
-    function createRandomString()
545
-    {
546
-        $chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
547
-        srand((double)microtime() * 1000000);
548
-        $i = 0;
549
-        $rstring = '';
550
-        while ($i <= 25) {
551
-            $num = rand() % 33;
552
-            $tmp = substr($chars, $num, 1);
553
-            $rstring = $rstring . $tmp;
554
-            $i++;
555
-        }
556
-        return $rstring;
557
-    }
537
+	/**
538
+	 * Creates random string.
539
+	 *
540
+	 * @since 1.0.0
541
+	 * @package GeoDirectory
542
+	 * @return string Random string.
543
+	 */
544
+	function createRandomString()
545
+	{
546
+		$chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
547
+		srand((double)microtime() * 1000000);
548
+		$i = 0;
549
+		$rstring = '';
550
+		while ($i <= 25) {
551
+			$num = rand() % 33;
552
+			$tmp = substr($chars, $num, 1);
553
+			$rstring = $rstring . $tmp;
554
+			$i++;
555
+		}
556
+		return $rstring;
557
+	}
558 558
 }
559 559
 
560 560
 if (!function_exists('geodir_getDistanceRadius')) {
561
-    /**
562
-     * Calculates the distance radius.
563
-     *
564
-     * @since 1.0.0
565
-     * @package GeoDirectory
566
-     * @param string $uom Measurement unit type.
567
-     * @return float The mean radius.
568
-     */
569
-    function geodir_getDistanceRadius($uom = 'km')
570
-    {
561
+	/**
562
+	 * Calculates the distance radius.
563
+	 *
564
+	 * @since 1.0.0
565
+	 * @package GeoDirectory
566
+	 * @param string $uom Measurement unit type.
567
+	 * @return float The mean radius.
568
+	 */
569
+	function geodir_getDistanceRadius($uom = 'km')
570
+	{
571 571
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
572
-        switch (geodir_strtolower($uom)):
573
-            case 'km'    :
574
-                $earthMeanRadius = 6371.009; // km
575
-                break;
576
-            case 'm'    :
577
-            case 'meters'    :
578
-                $earthMeanRadius = 6371.009 * 1000; // km
579
-                break;
580
-            case 'miles'    :
581
-                $earthMeanRadius = 3958.761; // miles
582
-                break;
583
-            case 'yards'    :
584
-            case 'yds'    :
585
-                $earthMeanRadius = 3958.761 * 1760; // yards
586
-                break;
587
-            case 'feet'    :
588
-            case 'ft'    :
589
-                $earthMeanRadius = 3958.761 * 1760 * 3; // feet
590
-                break;
591
-            case 'nm'    :
592
-                $earthMeanRadius = 3440.069; //  miles
593
-                break;
594
-            default:
595
-                $earthMeanRadius = 3958.761; // miles
596
-                break;
597
-        endswitch;
598
-        return $earthMeanRadius;
599
-    }
572
+		switch (geodir_strtolower($uom)):
573
+			case 'km'    :
574
+				$earthMeanRadius = 6371.009; // km
575
+				break;
576
+			case 'm'    :
577
+			case 'meters'    :
578
+				$earthMeanRadius = 6371.009 * 1000; // km
579
+				break;
580
+			case 'miles'    :
581
+				$earthMeanRadius = 3958.761; // miles
582
+				break;
583
+			case 'yards'    :
584
+			case 'yds'    :
585
+				$earthMeanRadius = 3958.761 * 1760; // yards
586
+				break;
587
+			case 'feet'    :
588
+			case 'ft'    :
589
+				$earthMeanRadius = 3958.761 * 1760 * 3; // feet
590
+				break;
591
+			case 'nm'    :
592
+				$earthMeanRadius = 3440.069; //  miles
593
+				break;
594
+			default:
595
+				$earthMeanRadius = 3958.761; // miles
596
+				break;
597
+		endswitch;
598
+		return $earthMeanRadius;
599
+	}
600 600
 }
601 601
 
602 602
 
603 603
 if (!function_exists('geodir_calculateDistanceFromLatLong')) {
604
-    /**
605
-     * Calculate the great circle distance between two points identified by longitude and latitude.
606
-     *
607
-     * @since 1.0.0
608
-     * @package GeoDirectory
609
-     * @param array $point1 Latitude and Longitude of point 1.
610
-     * @param array $point2 Latitude and Longitude of point 2.
611
-     * @param string $uom Unit of measurement.
612
-     * @return float The distance.
613
-     */
614
-    function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km')
615
-    {
604
+	/**
605
+	 * Calculate the great circle distance between two points identified by longitude and latitude.
606
+	 *
607
+	 * @since 1.0.0
608
+	 * @package GeoDirectory
609
+	 * @param array $point1 Latitude and Longitude of point 1.
610
+	 * @param array $point2 Latitude and Longitude of point 2.
611
+	 * @param string $uom Unit of measurement.
612
+	 * @return float The distance.
613
+	 */
614
+	function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km')
615
+	{
616 616
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
617 617
 
618
-        $earthMeanRadius = geodir_getDistanceRadius($uom);
618
+		$earthMeanRadius = geodir_getDistanceRadius($uom);
619 619
 
620
-        $deltaLatitude = deg2rad((float) $point2['latitude'] - (float) $point1['latitude']);
621
-        $deltaLongitude = deg2rad((float) $point2['longitude'] - (float) $point1['longitude']);
622
-        $a = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
623
-            cos(deg2rad((float) $point1['latitude'])) * cos(deg2rad((float) $point2['latitude'])) *
624
-            sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
625
-        $c = 2 * atan2(sqrt($a), sqrt(1 - $a));
626
-        $distance = $earthMeanRadius * $c;
627
-        return $distance;
620
+		$deltaLatitude = deg2rad((float) $point2['latitude'] - (float) $point1['latitude']);
621
+		$deltaLongitude = deg2rad((float) $point2['longitude'] - (float) $point1['longitude']);
622
+		$a = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
623
+			cos(deg2rad((float) $point1['latitude'])) * cos(deg2rad((float) $point2['latitude'])) *
624
+			sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
625
+		$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
626
+		$distance = $earthMeanRadius * $c;
627
+		return $distance;
628 628
 
629
-    }
629
+	}
630 630
 }
631 631
 
632 632
 
633 633
 if (!function_exists('geodir_sendEmail')) {
634
-    /**
635
-     * The main function that send transactional emails using the args provided.
636
-     *
637
-     * @since 1.0.0
638
-     * @since 1.5.7 Added db translations for notifications subject and content.
639
-     * @package GeoDirectory
640
-     * @param string $fromEmail Sender email address.
641
-     * @param string $fromEmailName Sender name.
642
-     * @param string $toEmail Receiver email address.
643
-     * @param string $toEmailName Receiver name.
644
-     * @param string $to_subject Email subject.
645
-     * @param string $to_message Email content.
646
-     * @param string $extra Not being used.
647
-     * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
648
-     * @param string $post_id The post ID.
649
-     * @param string $user_id The user ID.
650
-     */
651
-    function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
652
-        $login_details = '';
653
-
654
-        // strip slashes from subject & message text
655
-        $to_subject = stripslashes_deep($to_subject);
656
-        $to_message = stripslashes_deep($to_message);
657
-
658
-        if ($message_type == 'send_friend') {
659
-            $subject = get_option('geodir_email_friend_subject');
660
-            $message = get_option('geodir_email_friend_content');
661
-        } elseif ($message_type == 'send_enquiry') {
662
-            $subject = get_option('geodir_email_enquiry_subject');
663
-            $message = get_option('geodir_email_enquiry_content');
664
-        } elseif ($message_type == 'forgot_password') {
665
-            $subject = get_option('geodir_forgot_password_subject');
666
-            $message = get_option('geodir_forgot_password_content');
667
-            $login_details = $to_message;
668
-        } elseif ($message_type == 'registration') {
669
-            $subject = get_option('geodir_registration_success_email_subject');
670
-            $message = get_option('geodir_registration_success_email_content');
671
-            $login_details = $to_message;
672
-        } elseif ($message_type == 'post_submit') {
673
-            $subject = get_option('geodir_post_submited_success_email_subject');
674
-            $message = get_option('geodir_post_submited_success_email_content');
675
-        } elseif ($message_type == 'listing_published') {
676
-            $subject = get_option('geodir_post_published_email_subject');
677
-            $message = get_option('geodir_post_published_email_content');
678
-        } elseif ($message_type == 'listing_edited') {
679
-            $subject = get_option('geodir_post_edited_email_subject_admin');
680
-            $message = get_option('geodir_post_edited_email_content_admin');
681
-        }
634
+	/**
635
+	 * The main function that send transactional emails using the args provided.
636
+	 *
637
+	 * @since 1.0.0
638
+	 * @since 1.5.7 Added db translations for notifications subject and content.
639
+	 * @package GeoDirectory
640
+	 * @param string $fromEmail Sender email address.
641
+	 * @param string $fromEmailName Sender name.
642
+	 * @param string $toEmail Receiver email address.
643
+	 * @param string $toEmailName Receiver name.
644
+	 * @param string $to_subject Email subject.
645
+	 * @param string $to_message Email content.
646
+	 * @param string $extra Not being used.
647
+	 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
648
+	 * @param string $post_id The post ID.
649
+	 * @param string $user_id The user ID.
650
+	 */
651
+	function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
652
+		$login_details = '';
653
+
654
+		// strip slashes from subject & message text
655
+		$to_subject = stripslashes_deep($to_subject);
656
+		$to_message = stripslashes_deep($to_message);
657
+
658
+		if ($message_type == 'send_friend') {
659
+			$subject = get_option('geodir_email_friend_subject');
660
+			$message = get_option('geodir_email_friend_content');
661
+		} elseif ($message_type == 'send_enquiry') {
662
+			$subject = get_option('geodir_email_enquiry_subject');
663
+			$message = get_option('geodir_email_enquiry_content');
664
+		} elseif ($message_type == 'forgot_password') {
665
+			$subject = get_option('geodir_forgot_password_subject');
666
+			$message = get_option('geodir_forgot_password_content');
667
+			$login_details = $to_message;
668
+		} elseif ($message_type == 'registration') {
669
+			$subject = get_option('geodir_registration_success_email_subject');
670
+			$message = get_option('geodir_registration_success_email_content');
671
+			$login_details = $to_message;
672
+		} elseif ($message_type == 'post_submit') {
673
+			$subject = get_option('geodir_post_submited_success_email_subject');
674
+			$message = get_option('geodir_post_submited_success_email_content');
675
+		} elseif ($message_type == 'listing_published') {
676
+			$subject = get_option('geodir_post_published_email_subject');
677
+			$message = get_option('geodir_post_published_email_content');
678
+		} elseif ($message_type == 'listing_edited') {
679
+			$subject = get_option('geodir_post_edited_email_subject_admin');
680
+			$message = get_option('geodir_post_edited_email_content_admin');
681
+		}
682 682
 		
683 683
 		if (!empty($subject)) {
684 684
 			$subject = __(stripslashes_deep($subject),'geodirectory');
@@ -688,203 +688,203 @@  discard block
 block discarded – undo
688 688
 			$message = __(stripslashes_deep($message),'geodirectory');
689 689
 		}
690 690
 
691
-        $to_message = nl2br($to_message);
692
-        $sitefromEmail = get_option('site_email');
693
-        $sitefromEmailName = get_site_emailName();
694
-        $productlink = get_permalink($post_id);
695
-
696
-        $user_login = '';
697
-        if ($user_id > 0 && $user_info = get_userdata($user_id)) {
698
-            $user_login = $user_info->user_login;
699
-        }
700
-
701
-        $posted_date = '';
702
-        $listingLink = '';
703
-
704
-        $post_info = get_post($post_id);
705
-
706
-        if ($post_info) {
707
-            $posted_date = $post_info->post_date;
708
-            $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
709
-        }
710
-        $siteurl = home_url();
711
-        $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
712
-        $loginurl = geodir_login_url();
713
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
691
+		$to_message = nl2br($to_message);
692
+		$sitefromEmail = get_option('site_email');
693
+		$sitefromEmailName = get_site_emailName();
694
+		$productlink = get_permalink($post_id);
695
+
696
+		$user_login = '';
697
+		if ($user_id > 0 && $user_info = get_userdata($user_id)) {
698
+			$user_login = $user_info->user_login;
699
+		}
700
+
701
+		$posted_date = '';
702
+		$listingLink = '';
703
+
704
+		$post_info = get_post($post_id);
705
+
706
+		if ($post_info) {
707
+			$posted_date = $post_info->post_date;
708
+			$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
709
+		}
710
+		$siteurl = home_url();
711
+		$siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
712
+		$loginurl = geodir_login_url();
713
+		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
714 714
         
715
-        $post_author_id = !empty($post_info) ? $post_info->post_author : 0;
716
-        $post_author_name = geodir_get_client_name($post_author_id);
717
-        $current_date = date_i18n('Y-m-d H:i:s', current_time('timestamp'));
718
-
719
-        if ($fromEmail == '') {
720
-            $fromEmail = get_option('site_email');
721
-        }
722
-
723
-        if ($fromEmailName == '') {
724
-            $fromEmailName = get_option('site_email_name');
725
-        }
726
-
727
-        $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#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
728
-        $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, $post_author_id, $post_author_name, $current_date);
729
-        $message = str_replace($search_array, $replace_array, $message);
730
-
731
-        $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#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
732
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
733
-        $subject = str_replace($search_array, $replace_array, $subject);
734
-
735
-        $headers = 'MIME-Version: 1.0' . "\r\n";
736
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
737
-        $headers .= "Reply-To: " . $fromEmail . "\r\n";
738
-        $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
739
-
740
-        $to = $toEmail;
741
-
742
-        /**
743
-         * Filter the client email to address.
744
-         *
745
-         * @since 1.6.1
746
-         * @package GeoDirectory
747
-         * @param string $to The email address the email is being sent to.
748
-         * @param string $fromEmail Sender email address.
749
-         * @param string $fromEmailName Sender name.
750
-         * @param string $toEmail Receiver email address.
751
-         * @param string $toEmailName Receiver name.
752
-         * @param string $to_subject Email subject.
753
-         * @param string $to_message Email content.
754
-         * @param string $extra Not being used.
755
-         * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
756
-         * @param string $post_id The post ID.
757
-         * @param string $user_id The user ID.
758
-         */
759
-        $to = apply_filters('geodir_sendEmail_to',$to,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
760
-        /**
761
-         * Filter the client email subject.
762
-         *
763
-         * @since 1.6.1
764
-         * @package GeoDirectory_Payment_Manager
765
-         * @param string $subject The email subject.
766
-         * @param string $fromEmail Sender email address.
767
-         * @param string $fromEmailName Sender name.
768
-         * @param string $toEmail Receiver email address.
769
-         * @param string $toEmailName Receiver name.
770
-         * @param string $to_subject Email subject.
771
-         * @param string $to_message Email content.
772
-         * @param string $extra Not being used.
773
-         * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
774
-         * @param string $post_id The post ID.
775
-         * @param string $user_id The user ID.
776
-         */
777
-        $subject = apply_filters('geodir_sendEmail_subject',$subject,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
778
-        /**
779
-         * Filter the client email message.
780
-         *
781
-         * @since 1.6.1
782
-         * @package GeoDirectory_Payment_Manager
783
-         * @param string $message The email message text.
784
-         * @param string $fromEmail Sender email address.
785
-         * @param string $fromEmailName Sender name.
786
-         * @param string $toEmail Receiver email address.
787
-         * @param string $toEmailName Receiver name.
788
-         * @param string $to_subject Email subject.
789
-         * @param string $to_message Email content.
790
-         * @param string $extra Not being used.
791
-         * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
792
-         * @param string $post_id The post ID.
793
-         * @param string $user_id The user ID.
794
-         */
795
-        $message = apply_filters('geodir_sendEmail_message',$message,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
796
-        /**
797
-         * Filter the client email headers.
798
-         *
799
-         * @since 1.6.1
800
-         * @package GeoDirectory_Payment_Manager
801
-         * @param string $headers The email headers.
802
-         * @param string $fromEmail Sender email address.
803
-         * @param string $fromEmailName Sender name.
804
-         * @param string $toEmail Receiver email address.
805
-         * @param string $toEmailName Receiver name.
806
-         * @param string $to_subject Email subject.
807
-         * @param string $to_message Email content.
808
-         * @param string $extra Not being used.
809
-         * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
810
-         * @param string $post_id The post ID.
811
-         * @param string $user_id The user ID.
812
-         */
813
-        $headers = apply_filters('geodir_sendEmail_headers',$headers,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
814
-
815
-        $sent = wp_mail($to, $subject, $message, $headers);
816
-
817
-        if( ! $sent ) {
818
-            if ( is_array( $to ) ) {
819
-                $to = implode( ',', $to );
820
-            }
821
-            $log_message = sprintf(
822
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
823
-                $message_type,
824
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
825
-                $to,
826
-                $subject
827
-            );
828
-            geodir_error_log( $log_message );
829
-        }
830
-
831
-        ///////// ADMIN BCC EMIALS
832
-        $adminEmail = get_bloginfo('admin_email');
833
-        $to = $adminEmail;
834
-
835
-        $admin_bcc = false;
836
-        if ($message_type == 'post_submit') {
837
-            $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
838
-            $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
839
-
840
-            $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#]');
841
-            $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);
842
-            $message = str_replace($search_array, $replace_array, $message);
843
-
844
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
845
-            $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
846
-            $subject = str_replace($search_array, $replace_array, $subject);
847
-
848
-            $subject .= ' - ADMIN BCC COPY';
849
-            $admin_bcc = true;
850
-
851
-        }
852
-        elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
853
-            $subject .= ' - ADMIN BCC COPY';
854
-            $admin_bcc = true;
855
-        }
856
-        elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
857
-            $subject .= ' - ADMIN BCC COPY';
858
-            $admin_bcc = true;
859
-        }
860
-        elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
861
-            $subject .= ' - ADMIN BCC COPY';
862
-            $admin_bcc = true;
863
-        }
864
-        elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
865
-            $subject .= ' - ADMIN BCC COPY';
866
-            $admin_bcc = true;
867
-        }
868
-
869
-        if($admin_bcc===true){
870
-            $sent = wp_mail($to, $subject, $message, $headers);
871
-
872
-            if( ! $sent ) {
873
-                if ( is_array( $to ) ) {
874
-                    $to = implode( ',', $to );
875
-                }
876
-                $log_message = sprintf(
877
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
878
-                    $message_type,
879
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
880
-                    $to,
881
-                    $subject
882
-                );
883
-                geodir_error_log( $log_message );
884
-            }
885
-        }
886
-
887
-    }
715
+		$post_author_id = !empty($post_info) ? $post_info->post_author : 0;
716
+		$post_author_name = geodir_get_client_name($post_author_id);
717
+		$current_date = date_i18n('Y-m-d H:i:s', current_time('timestamp'));
718
+
719
+		if ($fromEmail == '') {
720
+			$fromEmail = get_option('site_email');
721
+		}
722
+
723
+		if ($fromEmailName == '') {
724
+			$fromEmailName = get_option('site_email_name');
725
+		}
726
+
727
+		$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#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
728
+		$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, $post_author_id, $post_author_name, $current_date);
729
+		$message = str_replace($search_array, $replace_array, $message);
730
+
731
+		$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#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
732
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
733
+		$subject = str_replace($search_array, $replace_array, $subject);
734
+
735
+		$headers = 'MIME-Version: 1.0' . "\r\n";
736
+		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
737
+		$headers .= "Reply-To: " . $fromEmail . "\r\n";
738
+		$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
739
+
740
+		$to = $toEmail;
741
+
742
+		/**
743
+		 * Filter the client email to address.
744
+		 *
745
+		 * @since 1.6.1
746
+		 * @package GeoDirectory
747
+		 * @param string $to The email address the email is being sent to.
748
+		 * @param string $fromEmail Sender email address.
749
+		 * @param string $fromEmailName Sender name.
750
+		 * @param string $toEmail Receiver email address.
751
+		 * @param string $toEmailName Receiver name.
752
+		 * @param string $to_subject Email subject.
753
+		 * @param string $to_message Email content.
754
+		 * @param string $extra Not being used.
755
+		 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
756
+		 * @param string $post_id The post ID.
757
+		 * @param string $user_id The user ID.
758
+		 */
759
+		$to = apply_filters('geodir_sendEmail_to',$to,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
760
+		/**
761
+		 * Filter the client email subject.
762
+		 *
763
+		 * @since 1.6.1
764
+		 * @package GeoDirectory_Payment_Manager
765
+		 * @param string $subject The email subject.
766
+		 * @param string $fromEmail Sender email address.
767
+		 * @param string $fromEmailName Sender name.
768
+		 * @param string $toEmail Receiver email address.
769
+		 * @param string $toEmailName Receiver name.
770
+		 * @param string $to_subject Email subject.
771
+		 * @param string $to_message Email content.
772
+		 * @param string $extra Not being used.
773
+		 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
774
+		 * @param string $post_id The post ID.
775
+		 * @param string $user_id The user ID.
776
+		 */
777
+		$subject = apply_filters('geodir_sendEmail_subject',$subject,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
778
+		/**
779
+		 * Filter the client email message.
780
+		 *
781
+		 * @since 1.6.1
782
+		 * @package GeoDirectory_Payment_Manager
783
+		 * @param string $message The email message text.
784
+		 * @param string $fromEmail Sender email address.
785
+		 * @param string $fromEmailName Sender name.
786
+		 * @param string $toEmail Receiver email address.
787
+		 * @param string $toEmailName Receiver name.
788
+		 * @param string $to_subject Email subject.
789
+		 * @param string $to_message Email content.
790
+		 * @param string $extra Not being used.
791
+		 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
792
+		 * @param string $post_id The post ID.
793
+		 * @param string $user_id The user ID.
794
+		 */
795
+		$message = apply_filters('geodir_sendEmail_message',$message,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
796
+		/**
797
+		 * Filter the client email headers.
798
+		 *
799
+		 * @since 1.6.1
800
+		 * @package GeoDirectory_Payment_Manager
801
+		 * @param string $headers The email headers.
802
+		 * @param string $fromEmail Sender email address.
803
+		 * @param string $fromEmailName Sender name.
804
+		 * @param string $toEmail Receiver email address.
805
+		 * @param string $toEmailName Receiver name.
806
+		 * @param string $to_subject Email subject.
807
+		 * @param string $to_message Email content.
808
+		 * @param string $extra Not being used.
809
+		 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
810
+		 * @param string $post_id The post ID.
811
+		 * @param string $user_id The user ID.
812
+		 */
813
+		$headers = apply_filters('geodir_sendEmail_headers',$headers,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
814
+
815
+		$sent = wp_mail($to, $subject, $message, $headers);
816
+
817
+		if( ! $sent ) {
818
+			if ( is_array( $to ) ) {
819
+				$to = implode( ',', $to );
820
+			}
821
+			$log_message = sprintf(
822
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
823
+				$message_type,
824
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
825
+				$to,
826
+				$subject
827
+			);
828
+			geodir_error_log( $log_message );
829
+		}
830
+
831
+		///////// ADMIN BCC EMIALS
832
+		$adminEmail = get_bloginfo('admin_email');
833
+		$to = $adminEmail;
834
+
835
+		$admin_bcc = false;
836
+		if ($message_type == 'post_submit') {
837
+			$subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
838
+			$message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
839
+
840
+			$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#]');
841
+			$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);
842
+			$message = str_replace($search_array, $replace_array, $message);
843
+
844
+			$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
845
+			$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
846
+			$subject = str_replace($search_array, $replace_array, $subject);
847
+
848
+			$subject .= ' - ADMIN BCC COPY';
849
+			$admin_bcc = true;
850
+
851
+		}
852
+		elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
853
+			$subject .= ' - ADMIN BCC COPY';
854
+			$admin_bcc = true;
855
+		}
856
+		elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
857
+			$subject .= ' - ADMIN BCC COPY';
858
+			$admin_bcc = true;
859
+		}
860
+		elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
861
+			$subject .= ' - ADMIN BCC COPY';
862
+			$admin_bcc = true;
863
+		}
864
+		elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
865
+			$subject .= ' - ADMIN BCC COPY';
866
+			$admin_bcc = true;
867
+		}
868
+
869
+		if($admin_bcc===true){
870
+			$sent = wp_mail($to, $subject, $message, $headers);
871
+
872
+			if( ! $sent ) {
873
+				if ( is_array( $to ) ) {
874
+					$to = implode( ',', $to );
875
+				}
876
+				$log_message = sprintf(
877
+					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
878
+					$message_type,
879
+					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
880
+					$to,
881
+					$subject
882
+				);
883
+				geodir_error_log( $log_message );
884
+			}
885
+		}
886
+
887
+	}
888 888
 }
889 889
 
890 890
 
@@ -897,27 +897,27 @@  discard block
 block discarded – undo
897 897
 function geodir_taxonomy_breadcrumb()
898 898
 {
899 899
 
900
-    $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
901
-    $parent = $term->parent;
900
+	$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
901
+	$parent = $term->parent;
902 902
 
903
-    while ($parent):
904
-        $parents[] = $parent;
905
-        $new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
906
-        $parent = $new_parent->parent;
907
-    endwhile;
903
+	while ($parent):
904
+		$parents[] = $parent;
905
+		$new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
906
+		$parent = $new_parent->parent;
907
+	endwhile;
908 908
 
909
-    if (!empty($parents)):
910
-        $parents = array_reverse($parents);
909
+	if (!empty($parents)):
910
+		$parents = array_reverse($parents);
911 911
 
912
-        foreach ($parents as $parent):
913
-            $item = get_term_by('id', $parent, get_query_var('taxonomy'));
914
-            $url = get_term_link($item, get_query_var('taxonomy'));
915
-            echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
916
-        endforeach;
912
+		foreach ($parents as $parent):
913
+			$item = get_term_by('id', $parent, get_query_var('taxonomy'));
914
+			$url = get_term_link($item, get_query_var('taxonomy'));
915
+			echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
916
+		endforeach;
917 917
 
918
-    endif;
918
+	endif;
919 919
 
920
-    echo '<li> > ' . $term->name . '</li>';
920
+	echo '<li> > ' . $term->name . '</li>';
921 921
 }
922 922
 
923 923
 
@@ -933,365 +933,365 @@  discard block
 block discarded – undo
933 933
  */
934 934
 function geodir_breadcrumb()
935 935
 {
936
-    global $wp_query, $geodir_add_location_url;
937
-
938
-    /**
939
-     * Filter breadcrumb separator.
940
-     *
941
-     * @since 1.0.0
942
-     */
943
-    $separator = apply_filters('geodir_breadcrumb_separator', ' > ');
944
-
945
-    if (!geodir_is_page('home')) {
946
-        $breadcrumb = '';
947
-        $url_categoris = '';
948
-        $breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
949
-        /**
950
-         * Filter breadcrumb's first link.
951
-         *
952
-         * @since 1.0.0
953
-         */
954
-        $breadcrumb .= '<li>' . apply_filters('geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __('Home', 'geodirectory') . '</a>') . '</li>';
955
-
956
-        $gd_post_type = geodir_get_current_posttype();
957
-        $post_type_info = get_post_type_object($gd_post_type);
958
-
959
-        remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
960
-
961
-        $listing_link = get_post_type_archive_link($gd_post_type);
962
-
963
-        add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
964
-        $listing_link = rtrim($listing_link, '/');
965
-        $listing_link .= '/';
966
-
967
-        $post_type_for_location_link = $listing_link;
968
-        $location_terms = geodir_get_current_location_terms('query_vars', $gd_post_type);
969
-
970
-        global $wp, $gd_session;
971
-        $location_link = $post_type_for_location_link;
972
-
973
-        if (geodir_is_page('detail') || geodir_is_page('listing')) {
974
-            global $post;
975
-            $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
936
+	global $wp_query, $geodir_add_location_url;
937
+
938
+	/**
939
+	 * Filter breadcrumb separator.
940
+	 *
941
+	 * @since 1.0.0
942
+	 */
943
+	$separator = apply_filters('geodir_breadcrumb_separator', ' > ');
944
+
945
+	if (!geodir_is_page('home')) {
946
+		$breadcrumb = '';
947
+		$url_categoris = '';
948
+		$breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
949
+		/**
950
+		 * Filter breadcrumb's first link.
951
+		 *
952
+		 * @since 1.0.0
953
+		 */
954
+		$breadcrumb .= '<li>' . apply_filters('geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __('Home', 'geodirectory') . '</a>') . '</li>';
955
+
956
+		$gd_post_type = geodir_get_current_posttype();
957
+		$post_type_info = get_post_type_object($gd_post_type);
958
+
959
+		remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
960
+
961
+		$listing_link = get_post_type_archive_link($gd_post_type);
962
+
963
+		add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
964
+		$listing_link = rtrim($listing_link, '/');
965
+		$listing_link .= '/';
966
+
967
+		$post_type_for_location_link = $listing_link;
968
+		$location_terms = geodir_get_current_location_terms('query_vars', $gd_post_type);
969
+
970
+		global $wp, $gd_session;
971
+		$location_link = $post_type_for_location_link;
972
+
973
+		if (geodir_is_page('detail') || geodir_is_page('listing')) {
974
+			global $post;
975
+			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
976 976
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
977 977
 				
978 978
 			if(geodir_is_page('detail') && isset($post->country_slug)){
979
-                $location_terms = array(
980
-                    'gd_country' => $post->country_slug,
981
-                    'gd_region' => $post->region_slug,
982
-                    'gd_city' => $post->city_slug
983
-                );
979
+				$location_terms = array(
980
+					'gd_country' => $post->country_slug,
981
+					'gd_region' => $post->region_slug,
982
+					'gd_city' => $post->city_slug
983
+				);
984 984
 				
985 985
 				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
986 986
 					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
987 987
 				}
988
-            }
989
-
990
-            $geodir_show_location_url = get_option('geodir_show_location_url');
991
-
992
-            $hide_url_part = array();
993
-            if ($location_manager) {
994
-                $hide_country_part = get_option('geodir_location_hide_country_part');
995
-                $hide_region_part = get_option('geodir_location_hide_region_part');
996
-
997
-                if ($hide_region_part && $hide_country_part) {
998
-                    $hide_url_part = array('gd_country', 'gd_region');
999
-                } else if ($hide_region_part && !$hide_country_part) {
1000
-                    $hide_url_part = array('gd_region');
1001
-                } else if (!$hide_region_part && $hide_country_part) {
1002
-                    $hide_url_part = array('gd_country');
1003
-                }
1004
-            }
1005
-
1006
-            $hide_text_part = array();
1007
-            if ($geodir_show_location_url == 'country_city') {
1008
-                $hide_text_part = array('gd_region');
1009
-
1010
-                if (isset($location_terms['gd_region']) && !$location_manager) {
1011
-                    unset($location_terms['gd_region']);
1012
-                }
1013
-            } else if ($geodir_show_location_url == 'region_city') {
1014
-                $hide_text_part = array('gd_country');
1015
-
1016
-                if (isset($location_terms['gd_country']) && !$location_manager) {
1017
-                    unset($location_terms['gd_country']);
1018
-                }
1019
-            } else if ($geodir_show_location_url == 'city') {
1020
-                $hide_text_part = array('gd_country', 'gd_region');
1021
-
1022
-                if (isset($location_terms['gd_country']) && !$location_manager) {
1023
-                    unset($location_terms['gd_country']);
1024
-                }
1025
-                if (isset($location_terms['gd_region']) && !$location_manager) {
1026
-                    unset($location_terms['gd_region']);
1027
-                }
1028
-            }
1029
-
1030
-            $is_location_last = '';
1031
-            $is_taxonomy_last = '';
1032
-            $breadcrumb .= '<li>';
1033
-            if (get_query_var($gd_post_type . 'category'))
1034
-                $gd_taxonomy = $gd_post_type . 'category';
1035
-            elseif (get_query_var($gd_post_type . '_tags'))
1036
-                $gd_taxonomy = $gd_post_type . '_tags';
1037
-
1038
-            $breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1039
-            if (!empty($gd_taxonomy) || geodir_is_page('detail'))
1040
-                $is_location_last = false;
1041
-            else
1042
-                $is_location_last = true;
1043
-
1044
-            if (!empty($gd_taxonomy) && geodir_is_page('listing'))
1045
-                $is_taxonomy_last = true;
1046
-            else
1047
-                $is_taxonomy_last = false;
1048
-
1049
-            if (!empty($location_terms)) {
1050
-                $geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
1051
-
1052
-                foreach ($location_terms as $key => $location_term) {
1053
-                    if ($location_term != '') {
1054
-                        if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
1055
-                            continue;
1056
-                        }
988
+			}
1057 989
 
1058
-                        $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
1059
-                        $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
1060
-                        $gd_location_link_text = ucfirst($gd_location_link_text);
1061
-
1062
-                        $location_term_actual_country = '';
1063
-                        $location_term_actual_region = '';
1064
-                        $location_term_actual_city = '';
1065
-                        if ($geodir_get_locations) {
1066
-                            if ($key == 'gd_country') {
1067
-                                $location_term_actual_country = get_actual_location_name('country', $location_term, true);
1068
-                            } else if ($key == 'gd_region') {
1069
-                                $location_term_actual_region = get_actual_location_name('region', $location_term, true);
1070
-                            } else if ($key == 'gd_city') {
1071
-                                $location_term_actual_city = get_actual_location_name('city', $location_term, true);
1072
-                            }
1073
-                        } else {
1074
-                            $location_info = geodir_get_location();
1075
-
1076
-                            if (!empty($location_info) && isset($location_info->location_id)) {
1077
-                                if ($key == 'gd_country') {
1078
-                                    $location_term_actual_country = __($location_info->country, 'geodirectory');
1079
-                                } else if ($key == 'gd_region') {
1080
-                                    $location_term_actual_region = __($location_info->region, 'geodirectory');
1081
-                                } else if ($key == 'gd_city') {
1082
-                                    $location_term_actual_city = __($location_info->city, 'geodirectory');
1083
-                                }
1084
-                            }
1085
-                        }
990
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1086 991
 
1087
-                        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'] != '')) {
1088
-                            $breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1089
-                        } else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1090
-                            $breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1091
-                        } else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1092
-                            $breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1093
-                        } else if ($is_location_last && $key == 'gd_neighbourhood') {
1094
-                            $breadcrumb .= $separator . $gd_location_link_text;
1095
-                        } else {
1096
-                            if (get_option('permalink_structure') != '') {
1097
-                                $location_link .= $location_term . '/';
1098
-                            } else {
1099
-                                $location_link .= "&$key=" . $location_term;
1100
-                            }
992
+			$hide_url_part = array();
993
+			if ($location_manager) {
994
+				$hide_country_part = get_option('geodir_location_hide_country_part');
995
+				$hide_region_part = get_option('geodir_location_hide_region_part');
1101 996
 
1102
-                            if ($key == 'gd_country' && $location_term_actual_country != '') {
1103
-                                $gd_location_link_text = $location_term_actual_country;
1104
-                            } else if ($key == 'gd_region' && $location_term_actual_region != '') {
1105
-                                $gd_location_link_text = $location_term_actual_region;
1106
-                            } else if ($key == 'gd_city' && $location_term_actual_city != '') {
1107
-                                $gd_location_link_text = $location_term_actual_city;
1108
-                            }
997
+				if ($hide_region_part && $hide_country_part) {
998
+					$hide_url_part = array('gd_country', 'gd_region');
999
+				} else if ($hide_region_part && !$hide_country_part) {
1000
+					$hide_url_part = array('gd_region');
1001
+				} else if (!$hide_region_part && $hide_country_part) {
1002
+					$hide_url_part = array('gd_country');
1003
+				}
1004
+			}
1005
+
1006
+			$hide_text_part = array();
1007
+			if ($geodir_show_location_url == 'country_city') {
1008
+				$hide_text_part = array('gd_region');
1009
+
1010
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1011
+					unset($location_terms['gd_region']);
1012
+				}
1013
+			} else if ($geodir_show_location_url == 'region_city') {
1014
+				$hide_text_part = array('gd_country');
1015
+
1016
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1017
+					unset($location_terms['gd_country']);
1018
+				}
1019
+			} else if ($geodir_show_location_url == 'city') {
1020
+				$hide_text_part = array('gd_country', 'gd_region');
1021
+
1022
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1023
+					unset($location_terms['gd_country']);
1024
+				}
1025
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1026
+					unset($location_terms['gd_region']);
1027
+				}
1028
+			}
1109 1029
 
1110
-                            /*
1030
+			$is_location_last = '';
1031
+			$is_taxonomy_last = '';
1032
+			$breadcrumb .= '<li>';
1033
+			if (get_query_var($gd_post_type . 'category'))
1034
+				$gd_taxonomy = $gd_post_type . 'category';
1035
+			elseif (get_query_var($gd_post_type . '_tags'))
1036
+				$gd_taxonomy = $gd_post_type . '_tags';
1037
+
1038
+			$breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1039
+			if (!empty($gd_taxonomy) || geodir_is_page('detail'))
1040
+				$is_location_last = false;
1041
+			else
1042
+				$is_location_last = true;
1043
+
1044
+			if (!empty($gd_taxonomy) && geodir_is_page('listing'))
1045
+				$is_taxonomy_last = true;
1046
+			else
1047
+				$is_taxonomy_last = false;
1048
+
1049
+			if (!empty($location_terms)) {
1050
+				$geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
1051
+
1052
+				foreach ($location_terms as $key => $location_term) {
1053
+					if ($location_term != '') {
1054
+						if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
1055
+							continue;
1056
+						}
1057
+
1058
+						$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
1059
+						$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
1060
+						$gd_location_link_text = ucfirst($gd_location_link_text);
1061
+
1062
+						$location_term_actual_country = '';
1063
+						$location_term_actual_region = '';
1064
+						$location_term_actual_city = '';
1065
+						if ($geodir_get_locations) {
1066
+							if ($key == 'gd_country') {
1067
+								$location_term_actual_country = get_actual_location_name('country', $location_term, true);
1068
+							} else if ($key == 'gd_region') {
1069
+								$location_term_actual_region = get_actual_location_name('region', $location_term, true);
1070
+							} else if ($key == 'gd_city') {
1071
+								$location_term_actual_city = get_actual_location_name('city', $location_term, true);
1072
+							}
1073
+						} else {
1074
+							$location_info = geodir_get_location();
1075
+
1076
+							if (!empty($location_info) && isset($location_info->location_id)) {
1077
+								if ($key == 'gd_country') {
1078
+									$location_term_actual_country = __($location_info->country, 'geodirectory');
1079
+								} else if ($key == 'gd_region') {
1080
+									$location_term_actual_region = __($location_info->region, 'geodirectory');
1081
+								} else if ($key == 'gd_city') {
1082
+									$location_term_actual_city = __($location_info->city, 'geodirectory');
1083
+								}
1084
+							}
1085
+						}
1086
+
1087
+						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'] != '')) {
1088
+							$breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1089
+						} else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1090
+							$breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1091
+						} else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1092
+							$breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1093
+						} else if ($is_location_last && $key == 'gd_neighbourhood') {
1094
+							$breadcrumb .= $separator . $gd_location_link_text;
1095
+						} else {
1096
+							if (get_option('permalink_structure') != '') {
1097
+								$location_link .= $location_term . '/';
1098
+							} else {
1099
+								$location_link .= "&$key=" . $location_term;
1100
+							}
1101
+
1102
+							if ($key == 'gd_country' && $location_term_actual_country != '') {
1103
+								$gd_location_link_text = $location_term_actual_country;
1104
+							} else if ($key == 'gd_region' && $location_term_actual_region != '') {
1105
+								$gd_location_link_text = $location_term_actual_region;
1106
+							} else if ($key == 'gd_city' && $location_term_actual_city != '') {
1107
+								$gd_location_link_text = $location_term_actual_city;
1108
+							}
1109
+
1110
+							/*
1111 1111
                             if (geodir_is_page('detail') && !empty($hide_text_part) && in_array($key, $hide_text_part)) {
1112 1112
                                 continue;
1113 1113
                             }
1114 1114
                             */
1115 1115
 
1116
-                            $breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1117
-                        }
1118
-                    }
1119
-                }
1120
-            }
1121
-
1122
-            if (!empty($gd_taxonomy)) {
1123
-                $term_index = 1;
1124
-
1125
-                //if(get_option('geodir_add_categories_url'))
1126
-                {
1127
-                    if (get_query_var($gd_post_type . '_tags')) {
1128
-                        $cat_link = $listing_link . 'tags/';
1129
-                    } else
1130
-                        $cat_link = $listing_link;
1131
-
1132
-                    foreach ($location_terms as $key => $location_term) {
1133
-                        if ($location_manager && in_array($key, $hide_url_part)) {
1134
-                            continue;
1135
-                        }
1116
+							$breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1117
+						}
1118
+					}
1119
+				}
1120
+			}
1136 1121
 
1137
-                        if ($location_term != '') {
1138
-                            if (get_option('permalink_structure') != '') {
1139
-                                $cat_link .= $location_term . '/';
1140
-                            }
1141
-                        }
1142
-                    }
1143
-
1144
-                    $term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1145
-                    foreach ($term_array as $term) {
1146
-                        $term_link_text = preg_replace('/-(\d+)$/', '', $term);
1147
-                        $term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1148
-
1149
-                        // get term actual name
1150
-                        $term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1151
-                        if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1152
-                            $term_link_text = urldecode($term_info['name']);
1153
-                        } else {
1154
-                            $term_link_text = geodir_ucwords(urldecode($term_link_text));
1155
-                        }
1122
+			if (!empty($gd_taxonomy)) {
1123
+				$term_index = 1;
1156 1124
 
1157
-                        if ($term_index == count($term_array) && $is_taxonomy_last)
1158
-                            $breadcrumb .= $separator . $term_link_text;
1159
-                        else {
1160
-                            $cat_link .= $term . '/';
1161
-                            $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1162
-                        }
1163
-                        $term_index++;
1164
-                    }
1165
-                }
1166
-
1167
-
1168
-            }
1169
-
1170
-            if (geodir_is_page('detail'))
1171
-                $breadcrumb .= $separator . get_the_title();
1172
-
1173
-            $breadcrumb .= '</li>';
1174
-
1175
-
1176
-        } elseif (geodir_is_page('author')) {
1177
-            $user_id = get_current_user_id();
1178
-            $author_link = get_author_posts_url($user_id);
1179
-            $default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
1180
-
1181
-            /**
1182
-             * Filter author page link.
1183
-             *
1184
-             * @since 1.0.0
1185
-             * @param string $default_author_link Default author link.
1186
-             * @param int $user_id Author ID.
1187
-             */
1188
-            $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1189
-
1190
-            $breadcrumb .= '<li>';
1191
-            $breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>';
1192
-
1193
-            if (isset($_REQUEST['list'])) {
1194
-                $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false);
1195
-
1196
-                /**
1197
-                 * Filter author page link.
1198
-                 *
1199
-                 * @since 1.0.0
1200
-                 * @param string $author_link Author page link.
1201
-                 * @param int $user_id Author ID.
1202
-                 * @param string $_REQUEST['stype'] Post type.
1203
-                 */
1204
-                $author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1205
-
1206
-                $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1207
-                $breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1208
-            } else
1209
-                $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1210
-
1211
-            $breadcrumb .= '</li>';
1212
-        } elseif (is_category() || is_single()) {
1213
-            $category = get_the_category();
1214
-            if (is_category()) {
1215
-                $breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1216
-            }
1217
-            if (is_single()) {
1218
-                $breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>';
1219
-                $breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1220
-            }
1221
-            /* End of my version ##################################################### */
1222
-        } else if (is_page()) {
1223
-            $page_title = get_the_title();
1224
-
1225
-            if (geodir_is_page('location')) {
1226
-                $page_title = defined('GD_LOCATION') ? GD_LOCATION : __('Location', 'geodirectory');
1227
-            }
1228
-
1229
-            $breadcrumb .= '<li>' . $separator;
1230
-            $breadcrumb .= stripslashes_deep($page_title);
1231
-            $breadcrumb .= '</li>';
1232
-        } else if (is_tag()) {
1233
-            $breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1234
-        } else if (is_day()) {
1235
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1236
-            the_time('F jS, Y');
1237
-            $breadcrumb .= '</li>';
1238
-        } else if (is_month()) {
1239
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1240
-            the_time('F, Y');
1241
-            $breadcrumb .= '</li>';
1242
-        } else if (is_year()) {
1243
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1244
-            the_time('Y');
1245
-            $breadcrumb .= '</li>';
1246
-        } else if (is_author()) {
1247
-            $breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory');
1248
-            $breadcrumb .= '</li>';
1249
-        } else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1250
-            $breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory');
1251
-            $breadcrumb .= '</li>';
1252
-        } else if (is_search()) {
1253
-            $breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory');
1254
-            $breadcrumb .= '</li>';
1255
-        }
1256
-        $breadcrumb .= '</ul></div>';
1257
-
1258
-        /**
1259
-         * Filter breadcrumb html output.
1260
-         *
1261
-         * @since 1.0.0
1262
-         * @param string $breadcrumb Breadcrumb HTML.
1263
-         * @param string $separator Breadcrumb separator.
1264
-         */
1265
-        echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1266
-    }
1125
+				//if(get_option('geodir_add_categories_url'))
1126
+				{
1127
+					if (get_query_var($gd_post_type . '_tags')) {
1128
+						$cat_link = $listing_link . 'tags/';
1129
+					} else
1130
+						$cat_link = $listing_link;
1131
+
1132
+					foreach ($location_terms as $key => $location_term) {
1133
+						if ($location_manager && in_array($key, $hide_url_part)) {
1134
+							continue;
1135
+						}
1136
+
1137
+						if ($location_term != '') {
1138
+							if (get_option('permalink_structure') != '') {
1139
+								$cat_link .= $location_term . '/';
1140
+							}
1141
+						}
1142
+					}
1143
+
1144
+					$term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1145
+					foreach ($term_array as $term) {
1146
+						$term_link_text = preg_replace('/-(\d+)$/', '', $term);
1147
+						$term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1148
+
1149
+						// get term actual name
1150
+						$term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1151
+						if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1152
+							$term_link_text = urldecode($term_info['name']);
1153
+						} else {
1154
+							$term_link_text = geodir_ucwords(urldecode($term_link_text));
1155
+						}
1156
+
1157
+						if ($term_index == count($term_array) && $is_taxonomy_last)
1158
+							$breadcrumb .= $separator . $term_link_text;
1159
+						else {
1160
+							$cat_link .= $term . '/';
1161
+							$breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1162
+						}
1163
+						$term_index++;
1164
+					}
1165
+				}
1166
+
1167
+
1168
+			}
1169
+
1170
+			if (geodir_is_page('detail'))
1171
+				$breadcrumb .= $separator . get_the_title();
1172
+
1173
+			$breadcrumb .= '</li>';
1174
+
1175
+
1176
+		} elseif (geodir_is_page('author')) {
1177
+			$user_id = get_current_user_id();
1178
+			$author_link = get_author_posts_url($user_id);
1179
+			$default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
1180
+
1181
+			/**
1182
+			 * Filter author page link.
1183
+			 *
1184
+			 * @since 1.0.0
1185
+			 * @param string $default_author_link Default author link.
1186
+			 * @param int $user_id Author ID.
1187
+			 */
1188
+			$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1189
+
1190
+			$breadcrumb .= '<li>';
1191
+			$breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>';
1192
+
1193
+			if (isset($_REQUEST['list'])) {
1194
+				$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false);
1195
+
1196
+				/**
1197
+				 * Filter author page link.
1198
+				 *
1199
+				 * @since 1.0.0
1200
+				 * @param string $author_link Author page link.
1201
+				 * @param int $user_id Author ID.
1202
+				 * @param string $_REQUEST['stype'] Post type.
1203
+				 */
1204
+				$author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1205
+
1206
+				$breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1207
+				$breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1208
+			} else
1209
+				$breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1210
+
1211
+			$breadcrumb .= '</li>';
1212
+		} elseif (is_category() || is_single()) {
1213
+			$category = get_the_category();
1214
+			if (is_category()) {
1215
+				$breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1216
+			}
1217
+			if (is_single()) {
1218
+				$breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>';
1219
+				$breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1220
+			}
1221
+			/* End of my version ##################################################### */
1222
+		} else if (is_page()) {
1223
+			$page_title = get_the_title();
1224
+
1225
+			if (geodir_is_page('location')) {
1226
+				$page_title = defined('GD_LOCATION') ? GD_LOCATION : __('Location', 'geodirectory');
1227
+			}
1228
+
1229
+			$breadcrumb .= '<li>' . $separator;
1230
+			$breadcrumb .= stripslashes_deep($page_title);
1231
+			$breadcrumb .= '</li>';
1232
+		} else if (is_tag()) {
1233
+			$breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1234
+		} else if (is_day()) {
1235
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1236
+			the_time('F jS, Y');
1237
+			$breadcrumb .= '</li>';
1238
+		} else if (is_month()) {
1239
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1240
+			the_time('F, Y');
1241
+			$breadcrumb .= '</li>';
1242
+		} else if (is_year()) {
1243
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1244
+			the_time('Y');
1245
+			$breadcrumb .= '</li>';
1246
+		} else if (is_author()) {
1247
+			$breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory');
1248
+			$breadcrumb .= '</li>';
1249
+		} else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1250
+			$breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory');
1251
+			$breadcrumb .= '</li>';
1252
+		} else if (is_search()) {
1253
+			$breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory');
1254
+			$breadcrumb .= '</li>';
1255
+		}
1256
+		$breadcrumb .= '</ul></div>';
1257
+
1258
+		/**
1259
+		 * Filter breadcrumb html output.
1260
+		 *
1261
+		 * @since 1.0.0
1262
+		 * @param string $breadcrumb Breadcrumb HTML.
1263
+		 * @param string $separator Breadcrumb separator.
1264
+		 */
1265
+		echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1266
+	}
1267 1267
 }
1268 1268
 
1269 1269
 
1270 1270
 add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin
1271 1271
 if (!function_exists('geodir_allow_wpadmin')) {
1272
-    /**
1273
-     * Allow only admins to access wp-admin.
1274
-     *
1275
-     * Normal users will be redirected to home page.
1276
-     *
1277
-     * @since 1.0.0
1278
-     * @package GeoDirectory
1279
-     * @global object $wpdb WordPress Database object.
1280
-     */
1281
-    function geodir_allow_wpadmin()
1282
-    {
1283
-        global $wpdb;
1284
-        if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) // checking action in request to allow ajax request go through
1285
-        {
1286
-            if (current_user_can('manage_options')) {
1287
-            } else {
1288
-
1289
-                wp_redirect(home_url());
1290
-                exit;
1291
-            }
1292
-
1293
-        }
1294
-    }
1272
+	/**
1273
+	 * Allow only admins to access wp-admin.
1274
+	 *
1275
+	 * Normal users will be redirected to home page.
1276
+	 *
1277
+	 * @since 1.0.0
1278
+	 * @package GeoDirectory
1279
+	 * @global object $wpdb WordPress Database object.
1280
+	 */
1281
+	function geodir_allow_wpadmin()
1282
+	{
1283
+		global $wpdb;
1284
+		if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) // checking action in request to allow ajax request go through
1285
+		{
1286
+			if (current_user_can('manage_options')) {
1287
+			} else {
1288
+
1289
+				wp_redirect(home_url());
1290
+				exit;
1291
+			}
1292
+
1293
+		}
1294
+	}
1295 1295
 }
1296 1296
 
1297 1297
 
@@ -1305,84 +1305,84 @@  discard block
 block discarded – undo
1305 1305
  */
1306 1306
 function fetch_remote_file($url)
1307 1307
 {
1308
-    // extract the file name and extension from the url
1309
-    require_once(ABSPATH . 'wp-includes/pluggable.php');
1310
-    $file_name = basename($url);
1311
-    if (strpos($file_name, '?') !== false) {
1312
-        list($file_name) = explode('?', $file_name);
1313
-    }
1314
-    $dummy = false;
1315
-    $add_to_cache = false;
1316
-    $key = null;
1317
-    if (strpos($url, '/dummy/') !== false) {
1318
-        $dummy = true;
1319
-        $key = "dummy_".str_replace('.', '_', $file_name);
1320
-        $value = get_transient('cached_dummy_images');
1321
-        if ($value) {
1322
-            if (isset($value[$key])) {
1323
-                return $value[$key];
1324
-            } else {
1325
-                $add_to_cache = true;
1326
-            }
1327
-        } else {
1328
-            $add_to_cache = true;
1329
-        }
1330
-    }
1331
-
1332
-    // get placeholder file in the upload dir with a unique, sanitized filename
1333
-
1334
-    $post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1335
-
1336
-    $upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1337
-    if ($upload['error'])
1338
-        return new WP_Error('upload_dir_error', $upload['error']);
1339
-
1340
-
1341
-    sleep(0.3);// if multiple remote file this can cause the remote server to timeout so we add a slight delay
1342
-
1343
-    // fetch the remote url and write it to the placeholder file
1344
-    $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1345
-
1346
-    $log_message = '';
1347
-    if( is_wp_error( $headers  ) ) {
1348
-        echo 'file: '.$url;
1349
-        return new WP_Error('import_file_error',$headers->get_error_message());
1350
-    }
1351
-
1352
-    $filesize = filesize($upload['file']);
1353
-    // request failed
1354
-    if (!$headers) {
1355
-        $log_message = __('Remote server did not respond', 'geodirectory');
1356
-    }
1357
-    // make sure the fetch was successful
1358
-    elseif ($headers['response']['code'] != '200') {
1359
-        $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1360
-    }
1361
-    elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1362
-        $log_message =  __('Remote file is incorrect size', 'geodirectory');
1363
-    }
1364
-    elseif (0 == $filesize) {
1365
-        $log_message = __('Zero size file downloaded', 'geodirectory');
1366
-    }
1367
-
1368
-    if($log_message){
1369
-        $del = unlink($upload['file']);
1370
-        if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1371
-        return new WP_Error('import_file_error',$log_message );
1372
-    }
1373
-
1374
-    if ($dummy && $add_to_cache && is_array($upload)) {
1375
-        $images = get_transient('cached_dummy_images');
1376
-        if(is_array($images))
1377
-            $images[$key] = $upload;
1378
-        else
1379
-            $images = array($key => $upload);
1380
-
1381
-        //setting the cache using the WP Transient API
1382
-        set_transient('cached_dummy_images', $images, 60 * 10); //10 minutes cache
1383
-    }
1384
-
1385
-    return $upload;
1308
+	// extract the file name and extension from the url
1309
+	require_once(ABSPATH . 'wp-includes/pluggable.php');
1310
+	$file_name = basename($url);
1311
+	if (strpos($file_name, '?') !== false) {
1312
+		list($file_name) = explode('?', $file_name);
1313
+	}
1314
+	$dummy = false;
1315
+	$add_to_cache = false;
1316
+	$key = null;
1317
+	if (strpos($url, '/dummy/') !== false) {
1318
+		$dummy = true;
1319
+		$key = "dummy_".str_replace('.', '_', $file_name);
1320
+		$value = get_transient('cached_dummy_images');
1321
+		if ($value) {
1322
+			if (isset($value[$key])) {
1323
+				return $value[$key];
1324
+			} else {
1325
+				$add_to_cache = true;
1326
+			}
1327
+		} else {
1328
+			$add_to_cache = true;
1329
+		}
1330
+	}
1331
+
1332
+	// get placeholder file in the upload dir with a unique, sanitized filename
1333
+
1334
+	$post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1335
+
1336
+	$upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1337
+	if ($upload['error'])
1338
+		return new WP_Error('upload_dir_error', $upload['error']);
1339
+
1340
+
1341
+	sleep(0.3);// if multiple remote file this can cause the remote server to timeout so we add a slight delay
1342
+
1343
+	// fetch the remote url and write it to the placeholder file
1344
+	$headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1345
+
1346
+	$log_message = '';
1347
+	if( is_wp_error( $headers  ) ) {
1348
+		echo 'file: '.$url;
1349
+		return new WP_Error('import_file_error',$headers->get_error_message());
1350
+	}
1351
+
1352
+	$filesize = filesize($upload['file']);
1353
+	// request failed
1354
+	if (!$headers) {
1355
+		$log_message = __('Remote server did not respond', 'geodirectory');
1356
+	}
1357
+	// make sure the fetch was successful
1358
+	elseif ($headers['response']['code'] != '200') {
1359
+		$log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1360
+	}
1361
+	elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1362
+		$log_message =  __('Remote file is incorrect size', 'geodirectory');
1363
+	}
1364
+	elseif (0 == $filesize) {
1365
+		$log_message = __('Zero size file downloaded', 'geodirectory');
1366
+	}
1367
+
1368
+	if($log_message){
1369
+		$del = unlink($upload['file']);
1370
+		if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1371
+		return new WP_Error('import_file_error',$log_message );
1372
+	}
1373
+
1374
+	if ($dummy && $add_to_cache && is_array($upload)) {
1375
+		$images = get_transient('cached_dummy_images');
1376
+		if(is_array($images))
1377
+			$images[$key] = $upload;
1378
+		else
1379
+			$images = array($key => $upload);
1380
+
1381
+		//setting the cache using the WP Transient API
1382
+		set_transient('cached_dummy_images', $images, 60 * 10); //10 minutes cache
1383
+	}
1384
+
1385
+	return $upload;
1386 1386
 }
1387 1387
 
1388 1388
 /**
@@ -1394,21 +1394,21 @@  discard block
 block discarded – undo
1394 1394
  */
1395 1395
 function geodir_max_upload_size()
1396 1396
 {
1397
-    $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1398
-
1399
-    if ($max_filesize > 0 && $max_filesize < 1) {
1400
-        $max_filesize = (int)($max_filesize * 1024) . 'kb';
1401
-    } else {
1402
-        $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1403
-    }
1404
-
1405
-    /**
1406
-     * Filter default image upload size limit.
1407
-     *
1408
-     * @since 1.0.0
1409
-     * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1410
-     */
1411
-    return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1397
+	$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1398
+
1399
+	if ($max_filesize > 0 && $max_filesize < 1) {
1400
+		$max_filesize = (int)($max_filesize * 1024) . 'kb';
1401
+	} else {
1402
+		$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1403
+	}
1404
+
1405
+	/**
1406
+	 * Filter default image upload size limit.
1407
+	 *
1408
+	 * @since 1.0.0
1409
+	 * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1410
+	 */
1411
+	return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1412 1412
 }
1413 1413
 
1414 1414
 /**
@@ -1422,11 +1422,11 @@  discard block
 block discarded – undo
1422 1422
  */
1423 1423
 function geodir_dummy_folder_exists()
1424 1424
 {
1425
-    $path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1426
-    if (!is_dir($path))
1427
-        return false;
1428
-    else
1429
-        return true;
1425
+	$path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1426
+	if (!is_dir($path))
1427
+		return false;
1428
+	else
1429
+		return true;
1430 1430
 
1431 1431
 }
1432 1432
 
@@ -1441,290 +1441,290 @@  discard block
 block discarded – undo
1441 1441
  */
1442 1442
 function  geodir_get_author_info($aid)
1443 1443
 {
1444
-    global $wpdb;
1445
-    /*$infosql = "select * from $wpdb->users where ID=$aid";*/
1446
-    $infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1447
-    $info = $wpdb->get_results($infosql);
1448
-    if ($info) {
1449
-        return $info[0];
1450
-    }
1444
+	global $wpdb;
1445
+	/*$infosql = "select * from $wpdb->users where ID=$aid";*/
1446
+	$infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1447
+	$info = $wpdb->get_results($infosql);
1448
+	if ($info) {
1449
+		return $info[0];
1450
+	}
1451 1451
 }
1452 1452
 
1453 1453
 if (!function_exists('adminEmail')) {
1454
-    /**
1455
-     * Send emails to client on post submission, renew etc.
1456
-     *
1457
-     * @since 1.0.0
1458
-     * @package GeoDirectory
1459
-     * @global object $wpdb WordPress Database object.
1460
-     * @param int|string $page_id Page ID.
1461
-     * @param int|string $user_id User ID.
1462
-     * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1463
-     * @param string $custom_1 Custom data to be sent.
1464
-     */
1465
-    function adminEmail($page_id, $user_id, $message_type, $custom_1 = '')
1466
-    {
1467
-        global $wpdb;
1468
-        if ($message_type == 'expiration') {
1469
-            $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1470
-            $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1471
-        } elseif ($message_type == 'post_submited') {
1472
-            $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1473
-            $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1474
-        } elseif ($message_type == 'renew') {
1475
-            $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1476
-            $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1477
-        } elseif ($message_type == 'upgrade') {
1478
-            $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1479
-            $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1480
-        } elseif ($message_type == 'claim_approved') {
1481
-            $subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1482
-            $client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1483
-        } elseif ($message_type == 'claim_rejected') {
1484
-            $subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1485
-            $client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1486
-        } elseif ($message_type == 'claim_requested') {
1487
-            $subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1488
-            $client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1489
-        } elseif ($message_type == 'auto_claim') {
1490
-            $subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1491
-            $client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1492
-        } elseif ($message_type == 'payment_success') {
1493
-            $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1494
-            $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1495
-        } elseif ($message_type == 'payment_fail') {
1496
-            $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1497
-            $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1498
-        }
1499
-        $transaction_details = $custom_1;
1500
-        $fromEmail = get_option('site_email');
1501
-        $fromEmailName = get_site_emailName();
1454
+	/**
1455
+	 * Send emails to client on post submission, renew etc.
1456
+	 *
1457
+	 * @since 1.0.0
1458
+	 * @package GeoDirectory
1459
+	 * @global object $wpdb WordPress Database object.
1460
+	 * @param int|string $page_id Page ID.
1461
+	 * @param int|string $user_id User ID.
1462
+	 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1463
+	 * @param string $custom_1 Custom data to be sent.
1464
+	 */
1465
+	function adminEmail($page_id, $user_id, $message_type, $custom_1 = '')
1466
+	{
1467
+		global $wpdb;
1468
+		if ($message_type == 'expiration') {
1469
+			$subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1470
+			$client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1471
+		} elseif ($message_type == 'post_submited') {
1472
+			$subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1473
+			$client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1474
+		} elseif ($message_type == 'renew') {
1475
+			$subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1476
+			$client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1477
+		} elseif ($message_type == 'upgrade') {
1478
+			$subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1479
+			$client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1480
+		} elseif ($message_type == 'claim_approved') {
1481
+			$subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1482
+			$client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1483
+		} elseif ($message_type == 'claim_rejected') {
1484
+			$subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1485
+			$client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1486
+		} elseif ($message_type == 'claim_requested') {
1487
+			$subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1488
+			$client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1489
+		} elseif ($message_type == 'auto_claim') {
1490
+			$subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1491
+			$client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1492
+		} elseif ($message_type == 'payment_success') {
1493
+			$subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1494
+			$client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1495
+		} elseif ($message_type == 'payment_fail') {
1496
+			$subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1497
+			$client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1498
+		}
1499
+		$transaction_details = $custom_1;
1500
+		$fromEmail = get_option('site_email');
1501
+		$fromEmailName = get_site_emailName();
1502 1502
 //$alivedays = get_post_meta($page_id,'alive_days',true);
1503
-        $pkg_limit = get_property_price_info_listing($page_id);
1504
-        $alivedays = $pkg_limit['days'];
1505
-        $productlink = get_permalink($page_id);
1506
-        $post_info = get_post($page_id);
1507
-        $post_date = date('dS F,Y', strtotime($post_info->post_date));
1508
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1509
-        $loginurl = geodir_login_url();
1510
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1511
-        $siteurl = home_url();
1512
-        $siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1513
-        $user_info = get_userdata($user_id);
1514
-        $user_email = $user_info->user_email;
1515
-        $display_name = geodir_get_client_name($user_id);
1516
-        $user_login = $user_info->user_login;
1517
-        $number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1518
-        if ($number_of_grace_days == '') {
1519
-            $number_of_grace_days = 1;
1520
-        }
1521
-        if ($post_info->post_type == 'event') {
1522
-            $post_type = 'event';
1523
-        } else {
1524
-            $post_type = 'listing';
1525
-        }
1526
-        $renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1527
-        $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#]');
1528
-        $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);
1529
-        $client_message = str_replace($search_array, $replace_array, $client_message);
1530
-        $subject = str_replace($search_array, $replace_array, $subject);
1531
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1532
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1533
-        $headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1534
-
1535
-        $to = $fromEmail;
1536
-        $message = $client_message;
1537
-
1538
-
1539
-        /**
1540
-         * Filter the admin email to address.
1541
-         *
1542
-         * @since 1.6.1
1543
-         * @package GeoDirectory
1544
-         * @param string $to The email address the email is being sent to.
1545
-         * @param int|string $page_id Page ID.
1546
-         * @param int|string $user_id User ID.
1547
-         * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1548
-         * @param string $custom_1 Custom data to be sent.
1549
-         */
1550
-        $to = apply_filters('geodir_adminEmail_to',$to,$page_id, $user_id, $message_type, $custom_1 );
1551
-        /**
1552
-         * Filter the admin email subject.
1553
-         *
1554
-         * @since 1.6.1
1555
-         * @package GeoDirectory_Payment_Manager
1556
-         * @param string $subject The email subject.
1557
-         * @param int|string $page_id Page ID.
1558
-         * @param int|string $user_id User ID.
1559
-         * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1560
-         * @param string $custom_1 Custom data to be sent.
1561
-         */
1562
-        $subject = apply_filters('geodir_adminEmail_subject',$subject,$page_id, $user_id, $message_type, $custom_1);
1563
-        /**
1564
-         * Filter the admin email message.
1565
-         *
1566
-         * @since 1.6.1
1567
-         * @package GeoDirectory_Payment_Manager
1568
-         * @param string $message The email message text.
1569
-         * @param int|string $page_id Page ID.
1570
-         * @param int|string $user_id User ID.
1571
-         * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1572
-         * @param string $custom_1 Custom data to be sent.
1573
-         */
1574
-        $message = apply_filters('geodir_adminEmail_message',$message,$page_id, $user_id, $message_type, $custom_1);
1575
-        /**
1576
-         * Filter the admin email headers.
1577
-         *
1578
-         * @since 1.6.1
1579
-         * @package GeoDirectory_Payment_Manager
1580
-         * @param string $headers The email headers.
1581
-         * @param int|string $page_id Page ID.
1582
-         * @param int|string $user_id User ID.
1583
-         * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1584
-         * @param string $custom_1 Custom data to be sent.
1585
-         */
1586
-        $headers = apply_filters('geodir_adminEmail_headers',$headers,$page_id, $user_id, $message_type, $custom_1);
1587
-
1588
-
1589
-
1590
-        $sent = wp_mail($to, $subject, $message, $headers);
1591
-        if( ! $sent ) {
1592
-            if ( is_array( $to ) ) {
1593
-                $to = implode( ',', $to );
1594
-            }
1595
-            $log_message = sprintf(
1596
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1597
-                $message_type,
1598
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1599
-                $to,
1600
-                $subject
1601
-            );
1602
-            geodir_error_log( $log_message );
1603
-        }
1604
-    }
1503
+		$pkg_limit = get_property_price_info_listing($page_id);
1504
+		$alivedays = $pkg_limit['days'];
1505
+		$productlink = get_permalink($page_id);
1506
+		$post_info = get_post($page_id);
1507
+		$post_date = date('dS F,Y', strtotime($post_info->post_date));
1508
+		$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1509
+		$loginurl = geodir_login_url();
1510
+		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
1511
+		$siteurl = home_url();
1512
+		$siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1513
+		$user_info = get_userdata($user_id);
1514
+		$user_email = $user_info->user_email;
1515
+		$display_name = geodir_get_client_name($user_id);
1516
+		$user_login = $user_info->user_login;
1517
+		$number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1518
+		if ($number_of_grace_days == '') {
1519
+			$number_of_grace_days = 1;
1520
+		}
1521
+		if ($post_info->post_type == 'event') {
1522
+			$post_type = 'event';
1523
+		} else {
1524
+			$post_type = 'listing';
1525
+		}
1526
+		$renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1527
+		$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#]');
1528
+		$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);
1529
+		$client_message = str_replace($search_array, $replace_array, $client_message);
1530
+		$subject = str_replace($search_array, $replace_array, $subject);
1531
+		$headers = 'MIME-Version: 1.0' . "\r\n";
1532
+		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1533
+		$headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1534
+
1535
+		$to = $fromEmail;
1536
+		$message = $client_message;
1537
+
1538
+
1539
+		/**
1540
+		 * Filter the admin email to address.
1541
+		 *
1542
+		 * @since 1.6.1
1543
+		 * @package GeoDirectory
1544
+		 * @param string $to The email address the email is being sent to.
1545
+		 * @param int|string $page_id Page ID.
1546
+		 * @param int|string $user_id User ID.
1547
+		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1548
+		 * @param string $custom_1 Custom data to be sent.
1549
+		 */
1550
+		$to = apply_filters('geodir_adminEmail_to',$to,$page_id, $user_id, $message_type, $custom_1 );
1551
+		/**
1552
+		 * Filter the admin email subject.
1553
+		 *
1554
+		 * @since 1.6.1
1555
+		 * @package GeoDirectory_Payment_Manager
1556
+		 * @param string $subject The email subject.
1557
+		 * @param int|string $page_id Page ID.
1558
+		 * @param int|string $user_id User ID.
1559
+		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1560
+		 * @param string $custom_1 Custom data to be sent.
1561
+		 */
1562
+		$subject = apply_filters('geodir_adminEmail_subject',$subject,$page_id, $user_id, $message_type, $custom_1);
1563
+		/**
1564
+		 * Filter the admin email message.
1565
+		 *
1566
+		 * @since 1.6.1
1567
+		 * @package GeoDirectory_Payment_Manager
1568
+		 * @param string $message The email message text.
1569
+		 * @param int|string $page_id Page ID.
1570
+		 * @param int|string $user_id User ID.
1571
+		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1572
+		 * @param string $custom_1 Custom data to be sent.
1573
+		 */
1574
+		$message = apply_filters('geodir_adminEmail_message',$message,$page_id, $user_id, $message_type, $custom_1);
1575
+		/**
1576
+		 * Filter the admin email headers.
1577
+		 *
1578
+		 * @since 1.6.1
1579
+		 * @package GeoDirectory_Payment_Manager
1580
+		 * @param string $headers The email headers.
1581
+		 * @param int|string $page_id Page ID.
1582
+		 * @param int|string $user_id User ID.
1583
+		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1584
+		 * @param string $custom_1 Custom data to be sent.
1585
+		 */
1586
+		$headers = apply_filters('geodir_adminEmail_headers',$headers,$page_id, $user_id, $message_type, $custom_1);
1587
+
1588
+
1589
+
1590
+		$sent = wp_mail($to, $subject, $message, $headers);
1591
+		if( ! $sent ) {
1592
+			if ( is_array( $to ) ) {
1593
+				$to = implode( ',', $to );
1594
+			}
1595
+			$log_message = sprintf(
1596
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1597
+				$message_type,
1598
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1599
+				$to,
1600
+				$subject
1601
+			);
1602
+			geodir_error_log( $log_message );
1603
+		}
1604
+	}
1605 1605
 }
1606 1606
 
1607 1607
 if (!function_exists('sendEmail')) {
1608
-    /**
1609
-     * @todo could be a duplicate of geodir_sendEmail.
1610
-     *
1611
-     * @since 1.0.0
1612
-     * @package GeoDirectory
1613
-     * @param string $fromEmail Sender email address.
1614
-     * @param string $fromEmailName Sender name.
1615
-     * @param string $toEmail Receiver email address.
1616
-     * @param string $toEmailName Receiver name.
1617
-     * @param string $to_subject Email subject.
1618
-     * @param string $to_message Email content.
1619
-     * @param string $extra Not being used.
1620
-     * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration.
1621
-     * @param string $post_id The post ID.
1622
-     * @param string $user_id The user ID.
1623
-     */
1624
-    function sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '')
1625
-    {
1626
-        $login_details = '';
1627
-        if ($message_type == 'send_friend') {
1628
-            $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1629
-            $message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1630
-        } elseif ($message_type == 'send_enquiry') {
1631
-            $subject = __(get_option('email_enquiry_subject'),'geodirectory');
1632
-            $message = __(get_option('email_enquiry_content'),'geodirectory');
1633
-        } elseif ($message_type == 'forgot_password') {
1634
-            $subject = __(get_option('forgot_password_subject'),'geodirectory');
1635
-            $message = __(get_option('forgot_password_content'),'geodirectory');
1636
-            $login_details = $to_message;
1637
-        } elseif ($message_type == 'registration') {
1638
-            $subject = __(get_option('registration_success_email_subject'),'geodirectory');
1639
-            $message = __(get_option('registration_success_email_content'),'geodirectory');
1640
-            $login_details = $to_message;
1641
-        }
1642
-        $to_message = nl2br($to_message);
1643
-        $sitefromEmail = get_option('site_email');
1644
-        $sitefromEmailName = get_site_emailName();
1645
-        $productlink = get_permalink($post_id);
1646
-        $post_info = get_post($post_id);
1647
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1648
-        $siteurl = home_url();
1649
-        $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1650
-        $loginurl = geodir_login_url();
1651
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1652
-        if ($fromEmail == '') {
1653
-            $fromEmail = get_option('site_email');
1654
-        }
1655
-        if ($fromEmailName == '') {
1656
-            $fromEmailName = get_option('site_email_name');
1657
-        }
1658
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]');
1659
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName);
1660
-        $message = str_replace($search_array, $replace_array, $message);
1661
-
1662
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]');
1663
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName);
1664
-        $subject = str_replace($search_array, $replace_array, $subject);
1665
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1666
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1667
-        $headers .= "Reply-To: " . $fromEmail . "\r\n";
1668
-        $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1669
-
1670
-        $to = $toEmail;
1671
-
1672
-        $sent = wp_mail($to, $subject, $message, $headers);
1673
-        if( ! $sent ) {
1674
-            if ( is_array( $to ) ) {
1675
-                $to = implode( ',', $to );
1676
-            }
1677
-            $log_message = sprintf(
1678
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1679
-                $message_type,
1680
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1681
-                $to,
1682
-                $subject
1683
-            );
1684
-            geodir_error_log( $log_message );
1685
-        }
1686
-
1687
-        ///////// ADMIN BCC EMIALS
1688
-        $admin_bcc = false;
1689
-        if ($message_type == 'registration') {
1690
-            $message_raw = explode(__("Password:", 'geodirectory'), $message);
1691
-            $message_raw2 = explode("</p>", $message_raw[1], 2);
1692
-            $message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1];
1693
-        }
1694
-        $adminEmail = get_bloginfo('admin_email');
1695
-        $to = $adminEmail;
1696
-
1697
-        if ($message_type == 'registration' && get_option('bcc_new_user')) {
1698
-            $subject .= ' - ADMIN BCC COPY';
1699
-            $admin_bcc = true;
1700
-        }
1701
-        elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1702
-            $subject .= ' - ADMIN BCC COPY';
1703
-            $admin_bcc = true;
1704
-        }
1705
-        elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1706
-            $subject .= ' - ADMIN BCC COPY';
1707
-            $admin_bcc = true;
1708
-        }
1709
-
1710
-        if($admin_bcc === true){
1711
-            $sent = wp_mail($to, $subject, $message, $headers);
1712
-            if( ! $sent ) {
1713
-                if ( is_array( $to ) ) {
1714
-                    $to = implode( ',', $to );
1715
-                }
1716
-                $log_message = sprintf(
1717
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1718
-                    $message_type,
1719
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1720
-                    $to,
1721
-                    $subject
1722
-                );
1723
-                geodir_error_log( $log_message );
1724
-            }
1725
-        }
1726
-
1727
-    }
1608
+	/**
1609
+	 * @todo could be a duplicate of geodir_sendEmail.
1610
+	 *
1611
+	 * @since 1.0.0
1612
+	 * @package GeoDirectory
1613
+	 * @param string $fromEmail Sender email address.
1614
+	 * @param string $fromEmailName Sender name.
1615
+	 * @param string $toEmail Receiver email address.
1616
+	 * @param string $toEmailName Receiver name.
1617
+	 * @param string $to_subject Email subject.
1618
+	 * @param string $to_message Email content.
1619
+	 * @param string $extra Not being used.
1620
+	 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration.
1621
+	 * @param string $post_id The post ID.
1622
+	 * @param string $user_id The user ID.
1623
+	 */
1624
+	function sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '')
1625
+	{
1626
+		$login_details = '';
1627
+		if ($message_type == 'send_friend') {
1628
+			$subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1629
+			$message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1630
+		} elseif ($message_type == 'send_enquiry') {
1631
+			$subject = __(get_option('email_enquiry_subject'),'geodirectory');
1632
+			$message = __(get_option('email_enquiry_content'),'geodirectory');
1633
+		} elseif ($message_type == 'forgot_password') {
1634
+			$subject = __(get_option('forgot_password_subject'),'geodirectory');
1635
+			$message = __(get_option('forgot_password_content'),'geodirectory');
1636
+			$login_details = $to_message;
1637
+		} elseif ($message_type == 'registration') {
1638
+			$subject = __(get_option('registration_success_email_subject'),'geodirectory');
1639
+			$message = __(get_option('registration_success_email_content'),'geodirectory');
1640
+			$login_details = $to_message;
1641
+		}
1642
+		$to_message = nl2br($to_message);
1643
+		$sitefromEmail = get_option('site_email');
1644
+		$sitefromEmailName = get_site_emailName();
1645
+		$productlink = get_permalink($post_id);
1646
+		$post_info = get_post($post_id);
1647
+		$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1648
+		$siteurl = home_url();
1649
+		$siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1650
+		$loginurl = geodir_login_url();
1651
+		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
1652
+		if ($fromEmail == '') {
1653
+			$fromEmail = get_option('site_email');
1654
+		}
1655
+		if ($fromEmailName == '') {
1656
+			$fromEmailName = get_option('site_email_name');
1657
+		}
1658
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]');
1659
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName);
1660
+		$message = str_replace($search_array, $replace_array, $message);
1661
+
1662
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]');
1663
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName);
1664
+		$subject = str_replace($search_array, $replace_array, $subject);
1665
+		$headers = 'MIME-Version: 1.0' . "\r\n";
1666
+		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1667
+		$headers .= "Reply-To: " . $fromEmail . "\r\n";
1668
+		$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1669
+
1670
+		$to = $toEmail;
1671
+
1672
+		$sent = wp_mail($to, $subject, $message, $headers);
1673
+		if( ! $sent ) {
1674
+			if ( is_array( $to ) ) {
1675
+				$to = implode( ',', $to );
1676
+			}
1677
+			$log_message = sprintf(
1678
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1679
+				$message_type,
1680
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1681
+				$to,
1682
+				$subject
1683
+			);
1684
+			geodir_error_log( $log_message );
1685
+		}
1686
+
1687
+		///////// ADMIN BCC EMIALS
1688
+		$admin_bcc = false;
1689
+		if ($message_type == 'registration') {
1690
+			$message_raw = explode(__("Password:", 'geodirectory'), $message);
1691
+			$message_raw2 = explode("</p>", $message_raw[1], 2);
1692
+			$message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1];
1693
+		}
1694
+		$adminEmail = get_bloginfo('admin_email');
1695
+		$to = $adminEmail;
1696
+
1697
+		if ($message_type == 'registration' && get_option('bcc_new_user')) {
1698
+			$subject .= ' - ADMIN BCC COPY';
1699
+			$admin_bcc = true;
1700
+		}
1701
+		elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1702
+			$subject .= ' - ADMIN BCC COPY';
1703
+			$admin_bcc = true;
1704
+		}
1705
+		elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1706
+			$subject .= ' - ADMIN BCC COPY';
1707
+			$admin_bcc = true;
1708
+		}
1709
+
1710
+		if($admin_bcc === true){
1711
+			$sent = wp_mail($to, $subject, $message, $headers);
1712
+			if( ! $sent ) {
1713
+				if ( is_array( $to ) ) {
1714
+					$to = implode( ',', $to );
1715
+				}
1716
+				$log_message = sprintf(
1717
+					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1718
+					$message_type,
1719
+					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1720
+					$to,
1721
+					$subject
1722
+				);
1723
+				geodir_error_log( $log_message );
1724
+			}
1725
+		}
1726
+
1727
+	}
1728 1728
 }
1729 1729
 
1730 1730
 /*
@@ -1742,16 +1742,16 @@  discard block
 block discarded – undo
1742 1742
  */
1743 1743
 function gd_lang_object_ids($ids_array, $type)
1744 1744
 {
1745
-    if (function_exists('icl_object_id')) {
1746
-        $res = array();
1747
-        foreach ($ids_array as $id) {
1748
-            $xlat = icl_object_id($id, $type, false);
1749
-            if (!is_null($xlat)) $res[] = $xlat;
1750
-        }
1751
-        return $res;
1752
-    } else {
1753
-        return $ids_array;
1754
-    }
1745
+	if (function_exists('icl_object_id')) {
1746
+		$res = array();
1747
+		foreach ($ids_array as $id) {
1748
+			$xlat = icl_object_id($id, $type, false);
1749
+			if (!is_null($xlat)) $res[] = $xlat;
1750
+		}
1751
+		return $res;
1752
+	} else {
1753
+		return $ids_array;
1754
+	}
1755 1755
 }
1756 1756
 
1757 1757
 
@@ -1766,31 +1766,31 @@  discard block
 block discarded – undo
1766 1766
  * @return array Modified Body CSS classes.
1767 1767
  */
1768 1768
 function geodir_custom_posts_body_class($classes) {
1769
-    global $wpdb, $wp;
1770
-    $post_types = geodir_get_posttypes('object');
1771
-    if (!empty($post_types) && count((array)$post_types) > 1) {
1772
-        $classes[] = 'geodir_custom_posts';
1773
-    }
1774
-
1775
-    // fix body class for signup page
1776
-    if (geodir_is_page('login')) {
1777
-        $new_classes = array();
1778
-        $new_classes[] = 'signup page-geodir-signup';
1779
-        if (!empty($classes)) {
1780
-            foreach ($classes as $class) {
1781
-                if ($class && $class != 'home' && $class != 'blog') {
1782
-                    $new_classes[] = $class;
1783
-                }
1784
-            }
1785
-        }
1786
-        $classes = $new_classes;
1787
-    }
1788
-
1789
-    if (geodir_is_geodir_page()) {
1790
-        $classes[] = 'geodir-page';
1791
-    }
1792
-
1793
-    return $classes;
1769
+	global $wpdb, $wp;
1770
+	$post_types = geodir_get_posttypes('object');
1771
+	if (!empty($post_types) && count((array)$post_types) > 1) {
1772
+		$classes[] = 'geodir_custom_posts';
1773
+	}
1774
+
1775
+	// fix body class for signup page
1776
+	if (geodir_is_page('login')) {
1777
+		$new_classes = array();
1778
+		$new_classes[] = 'signup page-geodir-signup';
1779
+		if (!empty($classes)) {
1780
+			foreach ($classes as $class) {
1781
+				if ($class && $class != 'home' && $class != 'blog') {
1782
+					$new_classes[] = $class;
1783
+				}
1784
+			}
1785
+		}
1786
+		$classes = $new_classes;
1787
+	}
1788
+
1789
+	if (geodir_is_geodir_page()) {
1790
+		$classes[] = 'geodir-page';
1791
+	}
1792
+
1793
+	return $classes;
1794 1794
 }
1795 1795
 
1796 1796
 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
@@ -1805,12 +1805,12 @@  discard block
 block discarded – undo
1805 1805
  */
1806 1806
 function geodir_map_zoom_level()
1807 1807
 {
1808
-    /**
1809
-     * Filter GD map zoom level.
1810
-     *
1811
-     * @since 1.0.0
1812
-     */
1813
-    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));
1808
+	/**
1809
+	 * Filter GD map zoom level.
1810
+	 *
1811
+	 * @since 1.0.0
1812
+	 */
1813
+	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));
1814 1814
 
1815 1815
 }
1816 1816
 
@@ -1824,12 +1824,12 @@  discard block
 block discarded – undo
1824 1824
  */
1825 1825
 function geodir_option_version_backup($geodir_option_name)
1826 1826
 {
1827
-    $version_date = time();
1828
-    $geodir_option = get_option($geodir_option_name);
1827
+	$version_date = time();
1828
+	$geodir_option = get_option($geodir_option_name);
1829 1829
 
1830
-    if (!empty($geodir_option)) {
1831
-        add_option($geodir_option_name . '_' . $version_date, $geodir_option);
1832
-    }
1830
+	if (!empty($geodir_option)) {
1831
+		add_option($geodir_option_name . '_' . $version_date, $geodir_option);
1832
+	}
1833 1833
 }
1834 1834
 
1835 1835
 /**
@@ -1842,11 +1842,11 @@  discard block
 block discarded – undo
1842 1842
  */
1843 1843
 function get_page_id_geodir_add_listing_page($page_id)
1844 1844
 {
1845
-    if (geodir_wpml_multilingual_status()) {
1846
-        $post_type = 'post_page';
1847
-        $page_id = geodir_get_wpml_element_id($page_id, $post_type);
1848
-    }
1849
-    return $page_id;
1845
+	if (geodir_wpml_multilingual_status()) {
1846
+		$post_type = 'post_page';
1847
+		$page_id = geodir_get_wpml_element_id($page_id, $post_type);
1848
+	}
1849
+	return $page_id;
1850 1850
 }
1851 1851
 
1852 1852
 /**
@@ -1858,10 +1858,10 @@  discard block
 block discarded – undo
1858 1858
  */
1859 1859
 function geodir_wpml_multilingual_status()
1860 1860
 {
1861
-    if (function_exists('icl_object_id')) {
1862
-        return true;
1863
-    }
1864
-    return false;
1861
+	if (function_exists('icl_object_id')) {
1862
+		return true;
1863
+	}
1864
+	return false;
1865 1865
 }
1866 1866
 
1867 1867
 /**
@@ -1875,22 +1875,22 @@  discard block
 block discarded – undo
1875 1875
  */
1876 1876
 function geodir_get_wpml_element_id($page_id, $post_type)
1877 1877
 {
1878
-    global $sitepress;
1879
-    if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1880
-        $trid = $sitepress->get_element_trid($page_id, $post_type);
1881
-
1882
-        if ($trid > 0) {
1883
-            $translations = $sitepress->get_element_translations($trid, $post_type);
1884
-
1885
-            $lang = $sitepress->get_current_language();
1886
-            $lang = $lang ? $lang : $sitepress->get_default_language();
1887
-
1888
-            if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
1889
-                $page_id = $translations[$lang]->element_id;
1890
-            }
1891
-        }
1892
-    }
1893
-    return $page_id;
1878
+	global $sitepress;
1879
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1880
+		$trid = $sitepress->get_element_trid($page_id, $post_type);
1881
+
1882
+		if ($trid > 0) {
1883
+			$translations = $sitepress->get_element_translations($trid, $post_type);
1884
+
1885
+			$lang = $sitepress->get_current_language();
1886
+			$lang = $lang ? $lang : $sitepress->get_default_language();
1887
+
1888
+			if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
1889
+				$page_id = $translations[$lang]->element_id;
1890
+			}
1891
+		}
1892
+	}
1893
+	return $page_id;
1894 1894
 }
1895 1895
 
1896 1896
 /**
@@ -1902,20 +1902,20 @@  discard block
 block discarded – undo
1902 1902
  */
1903 1903
 function geodir_wpml_check_element_id()
1904 1904
 {
1905
-    global $sitepress;
1906
-    if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1907
-        $el_type = 'post_page';
1908
-        $el_id = get_option('geodir_add_listing_page');
1909
-        $default_lang = $sitepress->get_default_language();
1910
-        $el_details = $sitepress->get_element_language_details($el_id, $el_type);
1911
-
1912
-        if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
1913
-            if (!$el_details->source_language_code) {
1914
-                $sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
1915
-                $sitepress->icl_translations_cache->clear();
1916
-            }
1917
-        }
1918
-    }
1905
+	global $sitepress;
1906
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1907
+		$el_type = 'post_page';
1908
+		$el_id = get_option('geodir_add_listing_page');
1909
+		$default_lang = $sitepress->get_default_language();
1910
+		$el_details = $sitepress->get_element_language_details($el_id, $el_type);
1911
+
1912
+		if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
1913
+			if (!$el_details->source_language_code) {
1914
+				$sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
1915
+				$sitepress->icl_translations_cache->clear();
1916
+			}
1917
+		}
1918
+	}
1919 1919
 }
1920 1920
 
1921 1921
 /**
@@ -1930,44 +1930,44 @@  discard block
 block discarded – undo
1930 1930
  */
1931 1931
 function geodir_widget_listings_get_order($query_args)
1932 1932
 {
1933
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1934
-
1935
-    $query_args = $gd_query_args_widgets;
1936
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1937
-        return $wpdb->posts . ".post_date DESC, ";
1938
-    }
1939
-
1940
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1941
-    $table = $plugin_prefix . $post_type . '_detail';
1942
-
1943
-    $sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
1944
-
1945
-    switch ($sort_by) {
1946
-        case 'latest':
1947
-        case 'newest':
1948
-            $orderby = $wpdb->posts . ".post_date DESC, ";
1949
-            break;
1950
-        case 'featured':
1951
-            $orderby = $table . ".is_featured ASC, ";
1952
-            break;
1953
-        case 'az':
1954
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1955
-            break;
1956
-        case 'high_review':
1957
-            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
1958
-            break;
1959
-        case 'high_rating':
1960
-            $orderby = "( " . $table . ".overall_rating  ) DESC, ";
1961
-            break;
1962
-        case 'random':
1963
-            $orderby = "RAND(), ";
1964
-            break;
1965
-        default:
1966
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1967
-            break;
1968
-    }
1969
-
1970
-    return $orderby;
1933
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1934
+
1935
+	$query_args = $gd_query_args_widgets;
1936
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1937
+		return $wpdb->posts . ".post_date DESC, ";
1938
+	}
1939
+
1940
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1941
+	$table = $plugin_prefix . $post_type . '_detail';
1942
+
1943
+	$sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
1944
+
1945
+	switch ($sort_by) {
1946
+		case 'latest':
1947
+		case 'newest':
1948
+			$orderby = $wpdb->posts . ".post_date DESC, ";
1949
+			break;
1950
+		case 'featured':
1951
+			$orderby = $table . ".is_featured ASC, ";
1952
+			break;
1953
+		case 'az':
1954
+			$orderby = $wpdb->posts . ".post_title ASC, ";
1955
+			break;
1956
+		case 'high_review':
1957
+			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
1958
+			break;
1959
+		case 'high_rating':
1960
+			$orderby = "( " . $table . ".overall_rating  ) DESC, ";
1961
+			break;
1962
+		case 'random':
1963
+			$orderby = "RAND(), ";
1964
+			break;
1965
+		default:
1966
+			$orderby = $wpdb->posts . ".post_title ASC, ";
1967
+			break;
1968
+	}
1969
+
1970
+	return $orderby;
1971 1971
 }
1972 1972
 
1973 1973
 /**
@@ -1985,126 +1985,126 @@  discard block
 block discarded – undo
1985 1985
  */
1986 1986
 function geodir_get_widget_listings($query_args = array(), $count_only = false)
1987 1987
 {
1988
-    global $wpdb, $plugin_prefix, $table_prefix;
1989
-    $GLOBALS['gd_query_args_widgets'] = $query_args;
1990
-    $gd_query_args_widgets = $query_args;
1991
-
1992
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1993
-    $table = $plugin_prefix . $post_type . '_detail';
1994
-
1995
-    $fields = $wpdb->posts . ".*, " . $table . ".*";
1996
-    /**
1997
-     * Filter widget listing fields string part that is being used for query.
1998
-     *
1999
-     * @since 1.0.0
2000
-     * @param string $fields Fields string.
2001
-     * @param string $table Table name.
2002
-     * @param string $post_type Post type.
2003
-     */
2004
-    $fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
2005
-
2006
-    $join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
1988
+	global $wpdb, $plugin_prefix, $table_prefix;
1989
+	$GLOBALS['gd_query_args_widgets'] = $query_args;
1990
+	$gd_query_args_widgets = $query_args;
1991
+
1992
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1993
+	$table = $plugin_prefix . $post_type . '_detail';
1994
+
1995
+	$fields = $wpdb->posts . ".*, " . $table . ".*";
1996
+	/**
1997
+	 * Filter widget listing fields string part that is being used for query.
1998
+	 *
1999
+	 * @since 1.0.0
2000
+	 * @param string $fields Fields string.
2001
+	 * @param string $table Table name.
2002
+	 * @param string $post_type Post type.
2003
+	 */
2004
+	$fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
2005
+
2006
+	$join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
2007
+
2008
+	########### WPML ###########
2009
+
2010
+	if (function_exists('icl_object_id')) {
2011
+		global $sitepress;
2012
+		$lang_code = ICL_LANGUAGE_CODE;
2013
+		if ($lang_code) {
2014
+			$join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
2015
+		}
2016
+	}
2007 2017
 
2008
-    ########### WPML ###########
2018
+	########### WPML ###########
2009 2019
 
2010
-    if (function_exists('icl_object_id')) {
2011
-        global $sitepress;
2012
-        $lang_code = ICL_LANGUAGE_CODE;
2013
-        if ($lang_code) {
2014
-            $join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
2015
-        }
2016
-    }
2020
+	/**
2021
+	 * Filter widget listing join clause string part that is being used for query.
2022
+	 *
2023
+	 * @since 1.0.0
2024
+	 * @param string $join Join clause string.
2025
+	 * @param string $post_type Post type.
2026
+	 */
2027
+	$join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
2017 2028
 
2018
-    ########### WPML ###########
2029
+	$post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
2019 2030
 
2020
-    /**
2021
-     * Filter widget listing join clause string part that is being used for query.
2022
-     *
2023
-     * @since 1.0.0
2024
-     * @param string $join Join clause string.
2025
-     * @param string $post_type Post type.
2026
-     */
2027
-    $join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
2028
-
2029
-    $post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
2030
-
2031
-    $where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
2032
-
2033
-    ########### WPML ###########
2034
-    if (function_exists('icl_object_id')) {
2035
-        if ($lang_code) {
2036
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
2037
-        }
2038
-    }
2039
-    ########### WPML ###########
2040
-    /**
2041
-     * Filter widget listing where clause string part that is being used for query.
2042
-     *
2043
-     * @since 1.0.0
2044
-     * @param string $where Where clause string.
2045
-     * @param string $post_type Post type.
2046
-     */
2047
-    $where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2048
-    $where = $where != '' ? " WHERE 1=1 " . $where : '';
2049
-
2050
-    $groupby = " GROUP BY $wpdb->posts.ID ";
2051
-    /**
2052
-     * Filter widget listing groupby clause string part that is being used for query.
2053
-     *
2054
-     * @since 1.0.0
2055
-     * @param string $groupby Group by clause string.
2056
-     * @param string $post_type Post type.
2057
-     */
2058
-    $groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
2031
+	$where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
2059 2032
 
2060
-    if ($count_only) {
2061
-        $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
2033
+	########### WPML ###########
2034
+	if (function_exists('icl_object_id')) {
2035
+		if ($lang_code) {
2036
+			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
2037
+		}
2038
+	}
2039
+	########### WPML ###########
2040
+	/**
2041
+	 * Filter widget listing where clause string part that is being used for query.
2042
+	 *
2043
+	 * @since 1.0.0
2044
+	 * @param string $where Where clause string.
2045
+	 * @param string $post_type Post type.
2046
+	 */
2047
+	$where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2048
+	$where = $where != '' ? " WHERE 1=1 " . $where : '';
2049
+
2050
+	$groupby = " GROUP BY $wpdb->posts.ID ";
2051
+	/**
2052
+	 * Filter widget listing groupby clause string part that is being used for query.
2053
+	 *
2054
+	 * @since 1.0.0
2055
+	 * @param string $groupby Group by clause string.
2056
+	 * @param string $post_type Post type.
2057
+	 */
2058
+	$groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
2059
+
2060
+	if ($count_only) {
2061
+		$sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
2062 2062
 			" . $join . "
2063 2063
 			" . $where;
2064
-        $rows = (int)$wpdb->get_var($sql);
2065
-    } else {
2066
-        $orderby = geodir_widget_listings_get_order($query_args);
2067
-        /**
2068
-         * Filter widget listing orderby clause string part that is being used for query.
2069
-         *
2070
-         * @since 1.0.0
2071
-         * @param string $orderby Order by clause string.
2072
-         * @param string $table Table name.
2073
-         * @param string $post_type Post type.
2074
-         */
2075
-        $orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2076
-        $orderby .= $wpdb->posts . ".post_title ASC";
2077
-        $orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2078
-
2079
-        $limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2080
-        /**
2081
-         * Filter widget listing limit that is being used for query.
2082
-         *
2083
-         * @since 1.0.0
2084
-         * @param int $limit Query results limit.
2085
-         * @param string $post_type Post type.
2086
-         */
2087
-        $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2088
-
2089
-        $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2090
-        if ( !$page )
2091
-            $page = 1;
2092
-
2093
-        $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
2094
-
2095
-        $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
2064
+		$rows = (int)$wpdb->get_var($sql);
2065
+	} else {
2066
+		$orderby = geodir_widget_listings_get_order($query_args);
2067
+		/**
2068
+		 * Filter widget listing orderby clause string part that is being used for query.
2069
+		 *
2070
+		 * @since 1.0.0
2071
+		 * @param string $orderby Order by clause string.
2072
+		 * @param string $table Table name.
2073
+		 * @param string $post_type Post type.
2074
+		 */
2075
+		$orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2076
+		$orderby .= $wpdb->posts . ".post_title ASC";
2077
+		$orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2078
+
2079
+		$limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2080
+		/**
2081
+		 * Filter widget listing limit that is being used for query.
2082
+		 *
2083
+		 * @since 1.0.0
2084
+		 * @param int $limit Query results limit.
2085
+		 * @param string $post_type Post type.
2086
+		 */
2087
+		$limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2088
+
2089
+		$page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2090
+		if ( !$page )
2091
+			$page = 1;
2092
+
2093
+		$limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
2094
+
2095
+		$sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
2096 2096
 			" . $join . "
2097 2097
 			" . $where . "
2098 2098
 			" . $groupby . "
2099 2099
 			" . $orderby . "
2100 2100
 			" . $limit;
2101
-        $rows = $wpdb->get_results($sql);
2102
-    }
2101
+		$rows = $wpdb->get_results($sql);
2102
+	}
2103 2103
 
2104
-    unset($GLOBALS['gd_query_args_widgets']);
2105
-    unset($gd_query_args_widgets);
2104
+	unset($GLOBALS['gd_query_args_widgets']);
2105
+	unset($gd_query_args_widgets);
2106 2106
 
2107
-    return $rows;
2107
+	return $rows;
2108 2108
 }
2109 2109
 
2110 2110
 /**
@@ -2119,14 +2119,14 @@  discard block
 block discarded – undo
2119 2119
  */
2120 2120
 function geodir_function_widget_listings_fields($fields)
2121 2121
 {
2122
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2122
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2123 2123
 
2124
-    $query_args = $gd_query_args_widgets;
2125
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2126
-        return $fields;
2127
-    }
2124
+	$query_args = $gd_query_args_widgets;
2125
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2126
+		return $fields;
2127
+	}
2128 2128
     
2129
-    return $fields;
2129
+	return $fields;
2130 2130
 }
2131 2131
 
2132 2132
 /**
@@ -2141,28 +2141,28 @@  discard block
 block discarded – undo
2141 2141
  */
2142 2142
 function geodir_function_widget_listings_join($join)
2143 2143
 {
2144
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2144
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2145 2145
 
2146
-    $query_args = $gd_query_args_widgets;
2147
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2148
-        return $join;
2149
-    }
2146
+	$query_args = $gd_query_args_widgets;
2147
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2148
+		return $join;
2149
+	}
2150 2150
 
2151
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2152
-    $table = $plugin_prefix . $post_type . '_detail';
2151
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2152
+	$table = $plugin_prefix . $post_type . '_detail';
2153 2153
 
2154
-    if (!empty($query_args['with_pics_only'])) {
2155
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2156
-    }
2154
+	if (!empty($query_args['with_pics_only'])) {
2155
+		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2156
+	}
2157 2157
 
2158
-    if (!empty($query_args['tax_query'])) {
2159
-        $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2160
-        if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2161
-            $join .= $tax_queries['join'];
2162
-        }
2163
-    }
2158
+	if (!empty($query_args['tax_query'])) {
2159
+		$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2160
+		if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2161
+			$join .= $tax_queries['join'];
2162
+		}
2163
+	}
2164 2164
 
2165
-    return $join;
2165
+	return $join;
2166 2166
 }
2167 2167
 
2168 2168
 /**
@@ -2177,54 +2177,54 @@  discard block
 block discarded – undo
2177 2177
  */
2178 2178
 function geodir_function_widget_listings_where($where)
2179 2179
 {
2180
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2181
-
2182
-    $query_args = $gd_query_args_widgets;
2183
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2184
-        return $where;
2185
-    }
2186
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2187
-    $table = $plugin_prefix . $post_type . '_detail';
2188
-
2189
-    if (!empty($query_args)) {
2190
-        if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2191
-            $where = geodir_default_location_where($where, $table);
2192
-        }
2193
-
2194
-        if (!empty($query_args['post_author'])) {
2195
-            $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2196
-        }
2197
-        
2198
-        if (!empty($query_args['show_featured_only'])) {
2199
-            $where .= " AND " . $table . ".is_featured = '1'";
2200
-        }
2180
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2201 2181
 
2202
-        if (!empty($query_args['show_special_only'])) {
2203
-            $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2204
-        }
2205
-
2206
-        if (!empty($query_args['with_pics_only'])) {
2207
-            $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2208
-        }
2209
-
2210
-        if (!empty($query_args['featured_image_only'])) {
2211
-            $where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2212
-        }
2182
+	$query_args = $gd_query_args_widgets;
2183
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2184
+		return $where;
2185
+	}
2186
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2187
+	$table = $plugin_prefix . $post_type . '_detail';
2213 2188
 
2214
-        if (!empty($query_args['with_videos_only'])) {
2215
-            $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2216
-        }
2189
+	if (!empty($query_args)) {
2190
+		if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2191
+			$where = geodir_default_location_where($where, $table);
2192
+		}
2217 2193
 
2218
-        if (!empty($query_args['tax_query'])) {
2219
-            $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2194
+		if (!empty($query_args['post_author'])) {
2195
+			$where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2196
+		}
2197
+        
2198
+		if (!empty($query_args['show_featured_only'])) {
2199
+			$where .= " AND " . $table . ".is_featured = '1'";
2200
+		}
2201
+
2202
+		if (!empty($query_args['show_special_only'])) {
2203
+			$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2204
+		}
2205
+
2206
+		if (!empty($query_args['with_pics_only'])) {
2207
+			$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2208
+		}
2220 2209
 
2221
-            if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2222
-                $where .= $tax_queries['where'];
2223
-            }
2224
-        }
2225
-    }
2210
+		if (!empty($query_args['featured_image_only'])) {
2211
+			$where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2212
+		}
2213
+
2214
+		if (!empty($query_args['with_videos_only'])) {
2215
+			$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2216
+		}
2217
+
2218
+		if (!empty($query_args['tax_query'])) {
2219
+			$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2220
+
2221
+			if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2222
+				$where .= $tax_queries['where'];
2223
+			}
2224
+		}
2225
+	}
2226 2226
 
2227
-    return $where;
2227
+	return $where;
2228 2228
 }
2229 2229
 
2230 2230
 /**
@@ -2239,14 +2239,14 @@  discard block
 block discarded – undo
2239 2239
  */
2240 2240
 function geodir_function_widget_listings_orderby($orderby)
2241 2241
 {
2242
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2242
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2243 2243
 
2244
-    $query_args = $gd_query_args_widgets;
2245
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2246
-        return $orderby;
2247
-    }
2244
+	$query_args = $gd_query_args_widgets;
2245
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2246
+		return $orderby;
2247
+	}
2248 2248
 
2249
-    return $orderby;
2249
+	return $orderby;
2250 2250
 }
2251 2251
 
2252 2252
 /**
@@ -2261,18 +2261,18 @@  discard block
 block discarded – undo
2261 2261
  */
2262 2262
 function geodir_function_widget_listings_limit($limit)
2263 2263
 {
2264
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2264
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2265 2265
 
2266
-    $query_args = $gd_query_args_widgets;
2267
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2268
-        return $limit;
2269
-    }
2266
+	$query_args = $gd_query_args_widgets;
2267
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2268
+		return $limit;
2269
+	}
2270 2270
 
2271
-    if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2272
-        $limit = (int)$query_args['posts_per_page'];
2273
-    }
2271
+	if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2272
+		$limit = (int)$query_args['posts_per_page'];
2273
+	}
2274 2274
 
2275
-    return $limit;
2275
+	return $limit;
2276 2276
 }
2277 2277
 
2278 2278
 /**
@@ -2286,24 +2286,24 @@  discard block
 block discarded – undo
2286 2286
  */
2287 2287
 function geodir_media_image_large_width($default = 800, $params = '')
2288 2288
 {
2289
-    $large_size_w = get_option('large_size_w');
2290
-    $large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2291
-    $large_size_w = absint($large_size_w);
2292
-
2293
-    if (!get_option('geodir_use_wp_media_large_size')) {
2294
-        $large_size_w = 800;
2295
-    }
2296
-
2297
-    /**
2298
-     * Filter large image width.
2299
-     *
2300
-     * @since 1.0.0
2301
-     * @param int $large_size_w Large image width.
2302
-     * @param int $default Default width.
2303
-     * @param string|array $params Image parameters.
2304
-     */
2305
-    $large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2306
-    return $large_size_w;
2289
+	$large_size_w = get_option('large_size_w');
2290
+	$large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2291
+	$large_size_w = absint($large_size_w);
2292
+
2293
+	if (!get_option('geodir_use_wp_media_large_size')) {
2294
+		$large_size_w = 800;
2295
+	}
2296
+
2297
+	/**
2298
+	 * Filter large image width.
2299
+	 *
2300
+	 * @since 1.0.0
2301
+	 * @param int $large_size_w Large image width.
2302
+	 * @param int $default Default width.
2303
+	 * @param string|array $params Image parameters.
2304
+	 */
2305
+	$large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2306
+	return $large_size_w;
2307 2307
 }
2308 2308
 
2309 2309
 /**
@@ -2317,25 +2317,25 @@  discard block
 block discarded – undo
2317 2317
  */
2318 2318
 function geodir_media_image_large_height($default = 800, $params = '')
2319 2319
 {
2320
-    $large_size_h = get_option('large_size_h');
2321
-    $large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2322
-    $large_size_h = absint($large_size_h);
2323
-
2324
-    if (!get_option('geodir_use_wp_media_large_size')) {
2325
-        $large_size_h = 800;
2326
-    }
2327
-
2328
-    /**
2329
-     * Filter large image height.
2330
-     *
2331
-     * @since 1.0.0
2332
-     * @param int $large_size_h Large image height.
2333
-     * @param int $default Default height.
2334
-     * @param string|array $params Image parameters.
2335
-     */
2336
-    $large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2320
+	$large_size_h = get_option('large_size_h');
2321
+	$large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2322
+	$large_size_h = absint($large_size_h);
2337 2323
 
2338
-    return $large_size_h;
2324
+	if (!get_option('geodir_use_wp_media_large_size')) {
2325
+		$large_size_h = 800;
2326
+	}
2327
+
2328
+	/**
2329
+	 * Filter large image height.
2330
+	 *
2331
+	 * @since 1.0.0
2332
+	 * @param int $large_size_h Large image height.
2333
+	 * @param int $default Default height.
2334
+	 * @param string|array $params Image parameters.
2335
+	 */
2336
+	$large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2337
+
2338
+	return $large_size_h;
2339 2339
 }
2340 2340
 
2341 2341
 /**
@@ -2350,25 +2350,25 @@  discard block
 block discarded – undo
2350 2350
  */
2351 2351
 function geodir_sanitize_location_name($type, $name, $translate = true)
2352 2352
 {
2353
-    if ($name == '') {
2354
-        return NULL;
2355
-    }
2356
-
2357
-    $type = $type == 'gd_country' ? 'country' : $type;
2358
-    $type = $type == 'gd_region' ? 'region' : $type;
2359
-    $type = $type == 'gd_city' ? 'city' : $type;
2360
-
2361
-    $return = $name;
2362
-    if (function_exists('get_actual_location_name')) {
2363
-        $return = get_actual_location_name($type, $name, $translate);
2364
-    } else {
2365
-        $return = preg_replace('/-(\d+)$/', '', $return);
2366
-        $return = preg_replace('/[_-]/', ' ', $return);
2367
-        $return = geodir_ucwords($return);
2368
-        $return = $translate ? __($return, 'geodirectory') : $return;
2369
-    }
2370
-
2371
-    return $return;
2353
+	if ($name == '') {
2354
+		return NULL;
2355
+	}
2356
+
2357
+	$type = $type == 'gd_country' ? 'country' : $type;
2358
+	$type = $type == 'gd_region' ? 'region' : $type;
2359
+	$type = $type == 'gd_city' ? 'city' : $type;
2360
+
2361
+	$return = $name;
2362
+	if (function_exists('get_actual_location_name')) {
2363
+		$return = get_actual_location_name($type, $name, $translate);
2364
+	} else {
2365
+		$return = preg_replace('/-(\d+)$/', '', $return);
2366
+		$return = preg_replace('/[_-]/', ' ', $return);
2367
+		$return = geodir_ucwords($return);
2368
+		$return = $translate ? __($return, 'geodirectory') : $return;
2369
+	}
2370
+
2371
+	return $return;
2372 2372
 }
2373 2373
 
2374 2374
 
@@ -2382,14 +2382,14 @@  discard block
 block discarded – undo
2382 2382
 function geodir_comments_number($number)
2383 2383
 {
2384 2384
 
2385
-    if ($number > 1) {
2386
-        $output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2387
-    } elseif ($number == 0 || $number == '') {
2388
-        $output = __('No Reviews', 'geodirectory');
2389
-    } else { // must be one
2390
-        $output = __('1 Review', 'geodirectory');
2391
-    }
2392
-    echo $output;
2385
+	if ($number > 1) {
2386
+		$output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2387
+	} elseif ($number == 0 || $number == '') {
2388
+		$output = __('No Reviews', 'geodirectory');
2389
+	} else { // must be one
2390
+		$output = __('1 Review', 'geodirectory');
2391
+	}
2392
+	echo $output;
2393 2393
 }
2394 2394
 
2395 2395
 /**
@@ -2402,23 +2402,23 @@  discard block
 block discarded – undo
2402 2402
  */
2403 2403
 function is_page_geodir_home()
2404 2404
 {
2405
-    global $wpdb;
2406
-    $cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2407
-    if (function_exists('geodir_location_geo_home_link')) {
2408
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2409
-    }
2410
-    $home_url = home_url('', 'http');
2411
-    if (function_exists('geodir_location_geo_home_link')) {
2412
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2413
-    }
2414
-    $home_url = str_replace("www.", "", $home_url);
2415
-    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')) ) {
2416
-        return true;
2417
-    }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')){
2418
-        return true;
2419
-    } else {
2420
-        return false;
2421
-    }
2405
+	global $wpdb;
2406
+	$cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2407
+	if (function_exists('geodir_location_geo_home_link')) {
2408
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2409
+	}
2410
+	$home_url = home_url('', 'http');
2411
+	if (function_exists('geodir_location_geo_home_link')) {
2412
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2413
+	}
2414
+	$home_url = str_replace("www.", "", $home_url);
2415
+	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')) ) {
2416
+		return true;
2417
+	}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')){
2418
+		return true;
2419
+	} else {
2420
+		return false;
2421
+	}
2422 2422
 
2423 2423
 }
2424 2424
 
@@ -2434,13 +2434,13 @@  discard block
 block discarded – undo
2434 2434
  */
2435 2435
 function geodir_wpseo_homepage_canonical($url)
2436 2436
 {
2437
-    global $post;
2437
+	global $post;
2438 2438
 
2439
-    if (is_page_geodir_home()) {
2440
-        return home_url();
2441
-    }
2439
+	if (is_page_geodir_home()) {
2440
+		return home_url();
2441
+	}
2442 2442
 
2443
-    return $url;
2443
+	return $url;
2444 2444
 }
2445 2445
 
2446 2446
 add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10);
@@ -2457,16 +2457,16 @@  discard block
 block discarded – undo
2457 2457
  */
2458 2458
 function geodir_googlemap_script_extra_details_page($extra)
2459 2459
 {
2460
-    global $post;
2461
-    $add_google_places_api = false;
2462
-    if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2463
-        $add_google_places_api = true;
2464
-    }
2465
-    if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2466
-        $extra .= "&amp;libraries=places";
2467
-    }
2468
-
2469
-    return $extra;
2460
+	global $post;
2461
+	$add_google_places_api = false;
2462
+	if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2463
+		$add_google_places_api = true;
2464
+	}
2465
+	if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2466
+		$extra .= "&amp;libraries=places";
2467
+	}
2468
+
2469
+	return $extra;
2470 2470
 }
2471 2471
 
2472 2472
 add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1);
@@ -2486,98 +2486,98 @@  discard block
 block discarded – undo
2486 2486
  */
2487 2487
 function geodir_popular_post_category_output($args = '', $instance = '')
2488 2488
 {
2489
-    // prints the widget
2490
-    global $wpdb, $plugin_prefix, $geodir_post_category_str;
2491
-    extract($args, EXTR_SKIP);
2492
-
2493
-    echo $before_widget;
2494
-
2495
-    /** This filter is documented in geodirectory_widgets.php */
2496
-    $title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2497
-
2498
-    $gd_post_type = geodir_get_current_posttype();
2499
-
2500
-    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2501
-    if(!empty($gd_post_type)){
2502
-        $default_post_type = $gd_post_type;
2503
-    }elseif(isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ){
2504
-        $default_post_type = $instance['default_post_type'];
2505
-    }else{
2506
-        $all_gd_post_type = geodir_get_posttypes();
2507
-        $default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2508
-    }
2509
-
2510
-    $taxonomy = array();
2511
-    if (!empty($gd_post_type)) {
2512
-        $taxonomy[] = $gd_post_type . "category";
2513
-    } else {
2514
-        $taxonomy = geodir_get_taxonomies($gd_post_type);
2515
-    }
2516
-
2517
-    $terms = get_terms($taxonomy);
2518
-    $a_terms = array();
2519
-    $b_terms = array();
2520
-
2521
-    foreach ($terms as $term) {
2522
-        if ($term->count > 0) {
2523
-            $a_terms[$term->taxonomy][] = $term;
2524
-        }
2525
-    }
2526
-
2527
-    if (!empty($a_terms)) {
2528
-        foreach ($a_terms as $b_key => $b_val) {
2529
-            $b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2530
-        }
2531
-
2532
-        $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : '';
2533
-
2534
-        $tax_change_output = '';
2535
-        if (count($b_terms) > 1) {
2536
-            $tax_change_output .= "<select data-limit='$category_limit' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2537
-            foreach ($b_terms as $key => $val) {
2538
-                $ptype = get_post_type_object(str_replace("category", "", $key));
2539
-                $cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2540
-                $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2541
-            }
2542
-            $tax_change_output .= "</select>";
2543
-        }
2544
-
2545
-        if (!empty($b_terms)) {
2546
-            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2547
-            global $cat_count;//make global so we can change via function
2548
-            $cat_count = 0;
2549
-            ?>
2489
+	// prints the widget
2490
+	global $wpdb, $plugin_prefix, $geodir_post_category_str;
2491
+	extract($args, EXTR_SKIP);
2492
+
2493
+	echo $before_widget;
2494
+
2495
+	/** This filter is documented in geodirectory_widgets.php */
2496
+	$title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2497
+
2498
+	$gd_post_type = geodir_get_current_posttype();
2499
+
2500
+	$category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2501
+	if(!empty($gd_post_type)){
2502
+		$default_post_type = $gd_post_type;
2503
+	}elseif(isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ){
2504
+		$default_post_type = $instance['default_post_type'];
2505
+	}else{
2506
+		$all_gd_post_type = geodir_get_posttypes();
2507
+		$default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2508
+	}
2509
+
2510
+	$taxonomy = array();
2511
+	if (!empty($gd_post_type)) {
2512
+		$taxonomy[] = $gd_post_type . "category";
2513
+	} else {
2514
+		$taxonomy = geodir_get_taxonomies($gd_post_type);
2515
+	}
2516
+
2517
+	$terms = get_terms($taxonomy);
2518
+	$a_terms = array();
2519
+	$b_terms = array();
2520
+
2521
+	foreach ($terms as $term) {
2522
+		if ($term->count > 0) {
2523
+			$a_terms[$term->taxonomy][] = $term;
2524
+		}
2525
+	}
2526
+
2527
+	if (!empty($a_terms)) {
2528
+		foreach ($a_terms as $b_key => $b_val) {
2529
+			$b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2530
+		}
2531
+
2532
+		$default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : '';
2533
+
2534
+		$tax_change_output = '';
2535
+		if (count($b_terms) > 1) {
2536
+			$tax_change_output .= "<select data-limit='$category_limit' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2537
+			foreach ($b_terms as $key => $val) {
2538
+				$ptype = get_post_type_object(str_replace("category", "", $key));
2539
+				$cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2540
+				$tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2541
+			}
2542
+			$tax_change_output .= "</select>";
2543
+		}
2544
+
2545
+		if (!empty($b_terms)) {
2546
+			$terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2547
+			global $cat_count;//make global so we can change via function
2548
+			$cat_count = 0;
2549
+			?>
2550 2550
             <div class="geodir-category-list-in clearfix">
2551 2551
                 <div class="geodir-cat-list clearfix">
2552 2552
                     <?php
2553
-                    echo $before_title . __($title) . $after_title;
2553
+					echo $before_title . __($title) . $after_title;
2554 2554
 
2555
-                    echo $tax_change_output;
2555
+					echo $tax_change_output;
2556 2556
 
2557
-                    echo '<ul class="geodir-popular-cat-list">';
2557
+					echo '<ul class="geodir-popular-cat-list">';
2558 2558
 
2559
-                    geodir_helper_cat_list_output($terms, $category_limit);
2559
+					geodir_helper_cat_list_output($terms, $category_limit);
2560 2560
 
2561
-                    echo '</ul>';
2562
-                    ?>
2561
+					echo '</ul>';
2562
+					?>
2563 2563
                 </div>
2564 2564
                 <?php
2565
-                $hide = '';
2566
-                if ($cat_count < $category_limit) {
2567
-                    $hide = 'style="display:none;"';
2568
-                }
2569
-                echo "<div class='geodir-cat-list-more' $hide >";
2570
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>';
2571
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>';
2572
-                echo "</div>";
2573
-                /* add scripts */
2574
-                add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2575
-                ?>
2565
+				$hide = '';
2566
+				if ($cat_count < $category_limit) {
2567
+					$hide = 'style="display:none;"';
2568
+				}
2569
+				echo "<div class='geodir-cat-list-more' $hide >";
2570
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>';
2571
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>';
2572
+				echo "</div>";
2573
+				/* add scripts */
2574
+				add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2575
+				?>
2576 2576
             </div>
2577 2577
         <?php
2578
-        }
2579
-    }
2580
-    echo $after_widget;
2578
+		}
2579
+	}
2580
+	echo $after_widget;
2581 2581
 }
2582 2582
 
2583 2583
 /**
@@ -2591,38 +2591,38 @@  discard block
 block discarded – undo
2591 2591
  */
2592 2592
 function geodir_helper_cat_list_output($terms, $category_limit)
2593 2593
 {
2594
-    global $geodir_post_category_str, $cat_count;
2595
-    $term_icons = geodir_get_term_icon();
2594
+	global $geodir_post_category_str, $cat_count;
2595
+	$term_icons = geodir_get_term_icon();
2596 2596
 
2597
-    $geodir_post_category_str = array();
2597
+	$geodir_post_category_str = array();
2598 2598
 
2599 2599
 
2600
-    foreach ($terms as $cat) {
2601
-        $post_type = str_replace("category", "", $cat->taxonomy);
2602
-        $term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2600
+	foreach ($terms as $cat) {
2601
+		$post_type = str_replace("category", "", $cat->taxonomy);
2602
+		$term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2603 2603
 
2604
-        $cat_count++;
2604
+		$cat_count++;
2605 2605
 
2606
-        $geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2606
+		$geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2607 2607
 
2608
-        $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2609
-        $total_post = $cat->count;
2608
+		$class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2609
+		$total_post = $cat->count;
2610 2610
 
2611
-        $term_link = get_term_link( $cat, $cat->taxonomy );
2612
-        /**
2613
-         * Filer the category term link.
2614
-         *
2615
-         * @since 1.4.5
2616
-         * @param string $term_link The term permalink.
2617
-         * @param int    $cat->term_id The term id.
2618
-         * @param string $post_type Wordpress post type.
2619
-         */
2620
-        $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2611
+		$term_link = get_term_link( $cat, $cat->taxonomy );
2612
+		/**
2613
+		 * Filer the category term link.
2614
+		 *
2615
+		 * @since 1.4.5
2616
+		 * @param string $term_link The term permalink.
2617
+		 * @param int    $cat->term_id The term id.
2618
+		 * @param string $post_type Wordpress post type.
2619
+		 */
2620
+		$term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2621 2621
 
2622
-        echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2623
-        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> ';
2624
-        echo '</a></li>';
2625
-    }
2622
+		echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2623
+		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> ';
2624
+		echo '</a></li>';
2625
+	}
2626 2626
 }
2627 2627
 
2628 2628
 /**
@@ -2636,108 +2636,108 @@  discard block
 block discarded – undo
2636 2636
  */
2637 2637
 function geodir_listing_slider_widget_output($args = '', $instance = '')
2638 2638
 {
2639
-    // prints the widget
2640
-    extract($args, EXTR_SKIP);
2641
-
2642
-    echo $before_widget;
2643
-
2644
-    /** This filter is documented in geodirectory_widgets.php */
2645
-    $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2646
-    /**
2647
-     * Filter the widget post type.
2648
-     *
2649
-     * @since 1.0.0
2650
-     * @param string $instance['post_type'] Post type of listing.
2651
-     */
2652
-    $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2653
-    /**
2654
-     * Filter the widget's term.
2655
-     *
2656
-     * @since 1.0.0
2657
-     * @param string $instance['category'] Filter by term. Can be any valid term.
2658
-     */
2659
-    $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2660
-    /**
2661
-     * Filter the widget listings limit.
2662
-     *
2663
-     * @since 1.0.0
2664
-     * @param string $instance['post_number'] Number of listings to display.
2665
-     */
2666
-    $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2667
-    /**
2668
-     * Filter the widget listings limit shown at one time.
2669
-     *
2670
-     * @since 1.5.0
2671
-     * @param string $instance['max_show'] Number of listings to display on screen.
2672
-     */
2673
-    $max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
2674
-    /**
2675
-     * Filter the widget slide width.
2676
-     *
2677
-     * @since 1.5.0
2678
-     * @param string $instance['slide_width'] Width of the slides shown.
2679
-     */
2680
-    $slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
2681
-    /**
2682
-     * Filter widget's "show title" value.
2683
-     *
2684
-     * @since 1.0.0
2685
-     * @param string|bool $instance['show_title'] Do you want to display title? Can be 1 or 0.
2686
-     */
2687
-    $show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
2688
-    /**
2689
-     * Filter widget's "slideshow" value.
2690
-     *
2691
-     * @since 1.0.0
2692
-     * @param int $instance['slideshow'] Setup a slideshow for the slider to animate automatically.
2693
-     */
2694
-    $slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
2695
-    /**
2696
-     * Filter widget's "animationLoop" value.
2697
-     *
2698
-     * @since 1.0.0
2699
-     * @param int $instance['animationLoop'] Gives the slider a seamless infinite loop.
2700
-     */
2701
-    $animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
2702
-    /**
2703
-     * Filter widget's "directionNav" value.
2704
-     *
2705
-     * @since 1.0.0
2706
-     * @param int $instance['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
2707
-     */
2708
-    $directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
2709
-    /**
2710
-     * Filter widget's "slideshowSpeed" value.
2711
-     *
2712
-     * @since 1.0.0
2713
-     * @param int $instance['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
2714
-     */
2715
-    $slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
2716
-    /**
2717
-     * Filter widget's "animationSpeed" value.
2718
-     *
2719
-     * @since 1.0.0
2720
-     * @param int $instance['animationSpeed'] Set the speed of animations, in milliseconds.
2721
-     */
2722
-    $animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
2723
-    /**
2724
-     * Filter widget's "animation" value.
2725
-     *
2726
-     * @since 1.0.0
2727
-     * @param string $instance['animation'] Controls the animation type, "fade" or "slide".
2728
-     */
2729
-    $animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
2730
-    /**
2731
-     * Filter widget's "list_sort" type.
2732
-     *
2733
-     * @since 1.0.0
2734
-     * @param string $instance['list_sort'] Listing sort by type.
2735
-     */
2736
-    $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
2737
-    $show_featured_only = !empty($instance['show_featured_only']) ? 1 : NULL;
2738
-
2739
-    wp_enqueue_script('geodirectory-jquery-flexslider-js');
2740
-    ?>
2639
+	// prints the widget
2640
+	extract($args, EXTR_SKIP);
2641
+
2642
+	echo $before_widget;
2643
+
2644
+	/** This filter is documented in geodirectory_widgets.php */
2645
+	$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2646
+	/**
2647
+	 * Filter the widget post type.
2648
+	 *
2649
+	 * @since 1.0.0
2650
+	 * @param string $instance['post_type'] Post type of listing.
2651
+	 */
2652
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2653
+	/**
2654
+	 * Filter the widget's term.
2655
+	 *
2656
+	 * @since 1.0.0
2657
+	 * @param string $instance['category'] Filter by term. Can be any valid term.
2658
+	 */
2659
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2660
+	/**
2661
+	 * Filter the widget listings limit.
2662
+	 *
2663
+	 * @since 1.0.0
2664
+	 * @param string $instance['post_number'] Number of listings to display.
2665
+	 */
2666
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2667
+	/**
2668
+	 * Filter the widget listings limit shown at one time.
2669
+	 *
2670
+	 * @since 1.5.0
2671
+	 * @param string $instance['max_show'] Number of listings to display on screen.
2672
+	 */
2673
+	$max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
2674
+	/**
2675
+	 * Filter the widget slide width.
2676
+	 *
2677
+	 * @since 1.5.0
2678
+	 * @param string $instance['slide_width'] Width of the slides shown.
2679
+	 */
2680
+	$slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
2681
+	/**
2682
+	 * Filter widget's "show title" value.
2683
+	 *
2684
+	 * @since 1.0.0
2685
+	 * @param string|bool $instance['show_title'] Do you want to display title? Can be 1 or 0.
2686
+	 */
2687
+	$show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
2688
+	/**
2689
+	 * Filter widget's "slideshow" value.
2690
+	 *
2691
+	 * @since 1.0.0
2692
+	 * @param int $instance['slideshow'] Setup a slideshow for the slider to animate automatically.
2693
+	 */
2694
+	$slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
2695
+	/**
2696
+	 * Filter widget's "animationLoop" value.
2697
+	 *
2698
+	 * @since 1.0.0
2699
+	 * @param int $instance['animationLoop'] Gives the slider a seamless infinite loop.
2700
+	 */
2701
+	$animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
2702
+	/**
2703
+	 * Filter widget's "directionNav" value.
2704
+	 *
2705
+	 * @since 1.0.0
2706
+	 * @param int $instance['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
2707
+	 */
2708
+	$directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
2709
+	/**
2710
+	 * Filter widget's "slideshowSpeed" value.
2711
+	 *
2712
+	 * @since 1.0.0
2713
+	 * @param int $instance['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
2714
+	 */
2715
+	$slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
2716
+	/**
2717
+	 * Filter widget's "animationSpeed" value.
2718
+	 *
2719
+	 * @since 1.0.0
2720
+	 * @param int $instance['animationSpeed'] Set the speed of animations, in milliseconds.
2721
+	 */
2722
+	$animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
2723
+	/**
2724
+	 * Filter widget's "animation" value.
2725
+	 *
2726
+	 * @since 1.0.0
2727
+	 * @param string $instance['animation'] Controls the animation type, "fade" or "slide".
2728
+	 */
2729
+	$animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
2730
+	/**
2731
+	 * Filter widget's "list_sort" type.
2732
+	 *
2733
+	 * @since 1.0.0
2734
+	 * @param string $instance['list_sort'] Listing sort by type.
2735
+	 */
2736
+	$list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
2737
+	$show_featured_only = !empty($instance['show_featured_only']) ? 1 : NULL;
2738
+
2739
+	wp_enqueue_script('geodirectory-jquery-flexslider-js');
2740
+	?>
2741 2741
     <script type="text/javascript">
2742 2742
         jQuery(window).load(function () {
2743 2743
             jQuery('#geodir_widget_carousel').flexslider({
@@ -2778,86 +2778,86 @@  discard block
 block discarded – undo
2778 2778
         });
2779 2779
     </script>
2780 2780
     <?php
2781
-    $query_args = array(
2782
-        'posts_per_page' => $post_number,
2783
-        'is_geodir_loop' => true,
2784
-        'post_type' => $post_type,
2785
-        'order_by' => $list_sort
2786
-    );
2787
-    if ($show_featured_only) {
2788
-        $query_args['show_featured_only'] = 1;
2789
-    }
2790
-
2791
-    if ($category != 0 || $category != '') {
2792
-        $category_taxonomy = geodir_get_taxonomies($post_type);
2793
-        $tax_query = array(
2794
-            'taxonomy' => $category_taxonomy[0],
2795
-            'field' => 'id',
2796
-            'terms' => $category
2797
-        );
2798
-
2799
-        $query_args['tax_query'] = array($tax_query);
2800
-    }
2801
-
2802
-    // we want listings with featured image only
2803
-    $query_args['featured_image_only'] = 1;
2804
-
2805
-    if ($post_type == 'gd_event') {
2806
-        $query_args['gedir_event_listing_filter'] = 'upcoming';
2807
-    }// show only upcomming events
2808
-
2809
-    $widget_listings = geodir_get_widget_listings($query_args);
2810
-    if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
2811
-        if ($title) {
2812
-            echo $before_title . $title . $after_title;
2813
-        }
2814
-
2815
-        global $post;
2816
-
2817
-        $current_post = $post;// keep current post info
2818
-
2819
-        $widget_main_slides = '';
2820
-        $nav_slides = '';
2821
-        $widget_slides = 0;
2822
-
2823
-        foreach ($widget_listings as $widget_listing) {
2824
-            global $gd_widget_listing_type;
2825
-            $post = $widget_listing;
2826
-            $widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
2827
-
2828
-            if (!empty($widget_image)) {
2829
-                if ($widget_image->height >= 200) {
2830
-                    $widget_spacer_height = 0;
2831
-                } else {
2832
-                    $widget_spacer_height = ((200 - $widget_image->height) / 2);
2833
-                }
2834
-
2835
-                $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" />';
2836
-
2837
-                $title = '';
2838
-                if ($show_title) {
2839
-                    $title_html = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>';
2840
-                    $post_id = $post->ID;
2841
-                    $post_permalink = get_permalink($post->ID);
2842
-                    $post_title = get_the_title($post->ID);
2843
-                    /**
2844
-                     * Filter the listing slider widget title.
2845
-                     *
2846
-                     * @since 1.6.1
2847
-                     * @param string $title_html The html output of the title.
2848
-                     * @param int $post_id The post id.
2849
-                     * @param string $post_permalink The post permalink url.
2850
-                     * @param string $post_title The post title text.
2851
-                     */
2852
-                    $title = apply_filters('geodir_listing_slider_title',$title_html,$post_id,$post_permalink,$post_title);
2853
-                }
2854
-
2855
-                $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>';
2856
-                $nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
2857
-                $widget_slides++;
2858
-            }
2859
-        }
2860
-        ?>
2781
+	$query_args = array(
2782
+		'posts_per_page' => $post_number,
2783
+		'is_geodir_loop' => true,
2784
+		'post_type' => $post_type,
2785
+		'order_by' => $list_sort
2786
+	);
2787
+	if ($show_featured_only) {
2788
+		$query_args['show_featured_only'] = 1;
2789
+	}
2790
+
2791
+	if ($category != 0 || $category != '') {
2792
+		$category_taxonomy = geodir_get_taxonomies($post_type);
2793
+		$tax_query = array(
2794
+			'taxonomy' => $category_taxonomy[0],
2795
+			'field' => 'id',
2796
+			'terms' => $category
2797
+		);
2798
+
2799
+		$query_args['tax_query'] = array($tax_query);
2800
+	}
2801
+
2802
+	// we want listings with featured image only
2803
+	$query_args['featured_image_only'] = 1;
2804
+
2805
+	if ($post_type == 'gd_event') {
2806
+		$query_args['gedir_event_listing_filter'] = 'upcoming';
2807
+	}// show only upcomming events
2808
+
2809
+	$widget_listings = geodir_get_widget_listings($query_args);
2810
+	if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
2811
+		if ($title) {
2812
+			echo $before_title . $title . $after_title;
2813
+		}
2814
+
2815
+		global $post;
2816
+
2817
+		$current_post = $post;// keep current post info
2818
+
2819
+		$widget_main_slides = '';
2820
+		$nav_slides = '';
2821
+		$widget_slides = 0;
2822
+
2823
+		foreach ($widget_listings as $widget_listing) {
2824
+			global $gd_widget_listing_type;
2825
+			$post = $widget_listing;
2826
+			$widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
2827
+
2828
+			if (!empty($widget_image)) {
2829
+				if ($widget_image->height >= 200) {
2830
+					$widget_spacer_height = 0;
2831
+				} else {
2832
+					$widget_spacer_height = ((200 - $widget_image->height) / 2);
2833
+				}
2834
+
2835
+				$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" />';
2836
+
2837
+				$title = '';
2838
+				if ($show_title) {
2839
+					$title_html = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>';
2840
+					$post_id = $post->ID;
2841
+					$post_permalink = get_permalink($post->ID);
2842
+					$post_title = get_the_title($post->ID);
2843
+					/**
2844
+					 * Filter the listing slider widget title.
2845
+					 *
2846
+					 * @since 1.6.1
2847
+					 * @param string $title_html The html output of the title.
2848
+					 * @param int $post_id The post id.
2849
+					 * @param string $post_permalink The post permalink url.
2850
+					 * @param string $post_title The post title text.
2851
+					 */
2852
+					$title = apply_filters('geodir_listing_slider_title',$title_html,$post_id,$post_permalink,$post_title);
2853
+				}
2854
+
2855
+				$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>';
2856
+				$nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
2857
+				$widget_slides++;
2858
+			}
2859
+		}
2860
+		?>
2861 2861
         <div class="flex-container" style="min-height:200px;">
2862 2862
             <div class="geodir-listing-flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
2863 2863
             <div id="geodir_widget_slider" class="geodir_flexslider">
@@ -2870,10 +2870,10 @@  discard block
 block discarded – undo
2870 2870
             <?php } ?>
2871 2871
         </div>
2872 2872
         <?php
2873
-        $GLOBALS['post'] = $current_post;
2874
-        setup_postdata($current_post);
2875
-    }
2876
-    echo $after_widget;
2873
+		$GLOBALS['post'] = $current_post;
2874
+		setup_postdata($current_post);
2875
+	}
2876
+	echo $after_widget;
2877 2877
 }
2878 2878
 
2879 2879
 
@@ -2888,65 +2888,65 @@  discard block
 block discarded – undo
2888 2888
  */
2889 2889
 function geodir_loginwidget_output($args = '', $instance = '')
2890 2890
 {
2891
-    //print_r($args);
2892
-    //print_r($instance);
2893
-    // prints the widget
2894
-    extract($args, EXTR_SKIP);
2891
+	//print_r($args);
2892
+	//print_r($instance);
2893
+	// prints the widget
2894
+	extract($args, EXTR_SKIP);
2895 2895
 
2896
-    /** This filter is documented in geodirectory_widgets.php */
2897
-    $title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2896
+	/** This filter is documented in geodirectory_widgets.php */
2897
+	$title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2898 2898
 
2899
-    echo $before_widget;
2900
-    echo $before_title . $title . $after_title;
2899
+	echo $before_widget;
2900
+	echo $before_title . $title . $after_title;
2901 2901
 
2902
-    if (is_user_logged_in()) {
2903
-        global $current_user;
2902
+	if (is_user_logged_in()) {
2903
+		global $current_user;
2904 2904
 
2905
-        $author_link = get_author_posts_url($current_user->data->ID);
2906
-        $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
2905
+		$author_link = get_author_posts_url($current_user->data->ID);
2906
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
2907 2907
 
2908
-        echo '<ul class="geodir-loginbox-list">';
2909
-        ob_start();
2910
-        ?>
2908
+		echo '<ul class="geodir-loginbox-list">';
2909
+		ob_start();
2910
+		?>
2911 2911
         <li><a class="signin"
2912 2912
                href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li>
2913 2913
         <?php
2914
-        $post_types = geodir_get_posttypes('object');
2915
-        $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
2916
-        $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2914
+		$post_types = geodir_get_posttypes('object');
2915
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
2916
+		$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2917 2917
 
2918
-        if (!empty($show_add_listing_post_types_main_nav)) {
2919
-            $addlisting_links = '';
2920
-            foreach ($post_types as $key => $postobj) {
2918
+		if (!empty($show_add_listing_post_types_main_nav)) {
2919
+			$addlisting_links = '';
2920
+			foreach ($post_types as $key => $postobj) {
2921 2921
 
2922
-                if (in_array($key, $show_add_listing_post_types_main_nav)) {
2922
+				if (in_array($key, $show_add_listing_post_types_main_nav)) {
2923 2923
 
2924
-                    if ($add_link = geodir_get_addlisting_link($key)) {
2924
+					if ($add_link = geodir_get_addlisting_link($key)) {
2925 2925
 
2926
-                        $name = $postobj->labels->name;
2926
+						$name = $postobj->labels->name;
2927 2927
 
2928
-                        $selected = '';
2929
-                        if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing'))
2930
-                            $selected = 'selected="selected"';
2928
+						$selected = '';
2929
+						if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing'))
2930
+							$selected = 'selected="selected"';
2931 2931
 
2932
-                        /**
2933
-                         * Filter add listing link.
2934
-                         *
2935
-                         * @since 1.0.0
2936
-                         * @param string $add_link Add listing link.
2937
-                         * @param string $key Add listing array key.
2938
-                         * @param int $current_user->ID Current user ID.
2939
-                         */
2940
-                        $add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
2932
+						/**
2933
+						 * Filter add listing link.
2934
+						 *
2935
+						 * @since 1.0.0
2936
+						 * @param string $add_link Add listing link.
2937
+						 * @param string $key Add listing array key.
2938
+						 * @param int $current_user->ID Current user ID.
2939
+						 */
2940
+						$add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
2941 2941
 
2942
-                        $addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2942
+						$addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2943 2943
 
2944
-                    }
2945
-                }
2944
+					}
2945
+				}
2946 2946
 
2947
-            }
2947
+			}
2948 2948
 
2949
-            if ($addlisting_links != '') { ?>
2949
+			if ($addlisting_links != '') { ?>
2950 2950
 
2951 2951
                 <li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value"
2952 2952
                             option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false"
@@ -2955,42 +2955,42 @@  discard block
 block discarded – undo
2955 2955
                         <?php echo $addlisting_links; ?>
2956 2956
                     </select></li> <?php
2957 2957
 
2958
-            }
2959
-
2960
-        }
2961
-        // My Favourites in Dashboard
2962
-        $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
2963
-        $user_favourite = geodir_user_favourite_listing_count();
2964
-
2965
-        if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
2966
-            $favourite_links = '';
2967
-
2968
-            foreach ($post_types as $key => $postobj) {
2969
-                if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
2970
-                    $name = $postobj->labels->name;
2971
-                    $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
2972
-
2973
-                    $selected = '';
2974
-
2975
-                    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
2976
-                        $selected = 'selected="selected"';
2977
-                    }
2978
-                    /**
2979
-                     * Filter favorite listing link.
2980
-                     *
2981
-                     * @since 1.0.0
2982
-                     * @param string $post_type_link Favorite listing link.
2983
-                     * @param string $key Favorite listing array key.
2984
-                     * @param int $current_user->ID Current user ID.
2985
-                     */
2986
-                    $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
2987
-
2988
-                    $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2989
-                }
2990
-            }
2991
-
2992
-            if ($favourite_links != '') {
2993
-                ?>
2958
+			}
2959
+
2960
+		}
2961
+		// My Favourites in Dashboard
2962
+		$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
2963
+		$user_favourite = geodir_user_favourite_listing_count();
2964
+
2965
+		if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
2966
+			$favourite_links = '';
2967
+
2968
+			foreach ($post_types as $key => $postobj) {
2969
+				if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
2970
+					$name = $postobj->labels->name;
2971
+					$post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
2972
+
2973
+					$selected = '';
2974
+
2975
+					if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
2976
+						$selected = 'selected="selected"';
2977
+					}
2978
+					/**
2979
+					 * Filter favorite listing link.
2980
+					 *
2981
+					 * @since 1.0.0
2982
+					 * @param string $post_type_link Favorite listing link.
2983
+					 * @param string $key Favorite listing array key.
2984
+					 * @param int $current_user->ID Current user ID.
2985
+					 */
2986
+					$post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
2987
+
2988
+					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2989
+				}
2990
+			}
2991
+
2992
+			if ($favourite_links != '') {
2993
+				?>
2994 2994
                 <li>
2995 2995
                     <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
2996 2996
                             option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false"
@@ -3000,42 +3000,42 @@  discard block
 block discarded – undo
3000 3000
                     </select>
3001 3001
                 </li>
3002 3002
             <?php
3003
-            }
3004
-        }
3005
-
3006
-
3007
-        $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
3008
-        $user_listing = geodir_user_post_listing_count();
3009
-
3010
-        if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
3011
-            $listing_links = '';
3012
-
3013
-            foreach ($post_types as $key => $postobj) {
3014
-                if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
3015
-                    $name = $postobj->labels->name;
3016
-                    $listing_link = geodir_getlink($author_link, array('stype' => $key), false);
3017
-
3018
-                    $selected = '';
3019
-                    if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
3020
-                        $selected = 'selected="selected"';
3021
-                    }
3022
-
3023
-                    /**
3024
-                     * Filter my listing link.
3025
-                     *
3026
-                     * @since 1.0.0
3027
-                     * @param string $listing_link My listing link.
3028
-                     * @param string $key My listing array key.
3029
-                     * @param int $current_user->ID Current user ID.
3030
-                     */
3031
-                    $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
3032
-
3033
-                    $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
3034
-                }
3035
-            }
3036
-
3037
-            if ($listing_links != '') {
3038
-                ?>
3003
+			}
3004
+		}
3005
+
3006
+
3007
+		$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
3008
+		$user_listing = geodir_user_post_listing_count();
3009
+
3010
+		if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
3011
+			$listing_links = '';
3012
+
3013
+			foreach ($post_types as $key => $postobj) {
3014
+				if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
3015
+					$name = $postobj->labels->name;
3016
+					$listing_link = geodir_getlink($author_link, array('stype' => $key), false);
3017
+
3018
+					$selected = '';
3019
+					if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
3020
+						$selected = 'selected="selected"';
3021
+					}
3022
+
3023
+					/**
3024
+					 * Filter my listing link.
3025
+					 *
3026
+					 * @since 1.0.0
3027
+					 * @param string $listing_link My listing link.
3028
+					 * @param string $key My listing array key.
3029
+					 * @param int $current_user->ID Current user ID.
3030
+					 */
3031
+					$listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
3032
+
3033
+					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
3034
+				}
3035
+			}
3036
+
3037
+			if ($listing_links != '') {
3038
+				?>
3039 3039
                 <li>
3040 3040
                     <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
3041 3041
                             option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false"
@@ -3045,27 +3045,27 @@  discard block
 block discarded – undo
3045 3045
                     </select>
3046 3046
                 </li>
3047 3047
             <?php
3048
-            }
3049
-        }
3050
-
3051
-        $dashboard_link = ob_get_clean();
3052
-        /**
3053
-         * Filter dashboard links HTML.
3054
-         *
3055
-         * @since 1.0.0
3056
-         * @param string $dashboard_link Dashboard links HTML.
3057
-         */
3058
-        echo apply_filters('geodir_dashboard_links', $dashboard_link);
3059
-        echo '</ul>';
3060
-    } else {
3061
-        ?>
3048
+			}
3049
+		}
3050
+
3051
+		$dashboard_link = ob_get_clean();
3052
+		/**
3053
+		 * Filter dashboard links HTML.
3054
+		 *
3055
+		 * @since 1.0.0
3056
+		 * @param string $dashboard_link Dashboard links HTML.
3057
+		 */
3058
+		echo apply_filters('geodir_dashboard_links', $dashboard_link);
3059
+		echo '</ul>';
3060
+	} else {
3061
+		?>
3062 3062
         <?php
3063
-        /**
3064
-         * Filter signup form action link.
3065
-         *
3066
-         * @since 1.0.0
3067
-         */
3068
-        ?>
3063
+		/**
3064
+		 * Filter signup form action link.
3065
+		 *
3066
+		 * @since 1.0.0
3067
+		 */
3068
+		?>
3069 3069
         <form name="loginform" class="loginform1"
3070 3070
               action="<?php echo geodir_login_url(); ?>"
3071 3071
               method="post">
@@ -3085,28 +3085,28 @@  discard block
 block discarded – undo
3085 3085
 
3086 3086
                 <p class="geodir-new-forgot-link">
3087 3087
                     <?php
3088
-                    /**
3089
-                     * Filter signup page register form link.
3090
-                     *
3091
-                     * @since 1.0.0
3092
-                     */
3093
-                    ?>
3088
+					/**
3089
+					 * Filter signup page register form link.
3090
+					 *
3091
+					 * @since 1.0.0
3092
+					 */
3093
+					?>
3094 3094
                     <a href="<?php echo geodir_login_url(array('signup' => true)); ?>"
3095 3095
                        class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a>
3096 3096
 
3097 3097
                     <?php
3098
-                    /**
3099
-                     * Filter signup page forgot password form link.
3100
-                     *
3101
-                     * @since 1.0.0
3102
-                     */
3103
-                    ?>
3098
+					/**
3099
+					 * Filter signup page forgot password form link.
3100
+					 *
3101
+					 * @since 1.0.0
3102
+					 */
3103
+					?>
3104 3104
                     <a href="<?php echo geodir_login_url(array('forgot' => true)); ?>"
3105 3105
                        class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div>
3106 3106
         </form>
3107 3107
     <?php }
3108 3108
 
3109
-    echo $after_widget;
3109
+	echo $after_widget;
3110 3110
 }
3111 3111
 
3112 3112
 
@@ -3125,284 +3125,284 @@  discard block
 block discarded – undo
3125 3125
  * @param array|string $instance The settings for the particular instance of the widget.
3126 3126
  */
3127 3127
 function geodir_popular_postview_output($args = '', $instance = '') {
3128
-    global $gd_session;
3128
+	global $gd_session;
3129 3129
 	
3130
-    // prints the widget
3131
-    extract($args, EXTR_SKIP);
3132
-
3133
-    echo $before_widget;
3134
-
3135
-    /** This filter is documented in geodirectory_widgets.php */
3136
-    $title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
3137
-    /**
3138
-     * Filter the widget post type.
3139
-     *
3140
-     * @since 1.0.0
3141
-     * @param string $instance['post_type'] Post type of listing.
3142
-     */
3143
-    $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
3144
-    /**
3145
-     * Filter the widget's term.
3146
-     *
3147
-     * @since 1.0.0
3148
-     * @param string $instance['category'] Filter by term. Can be any valid term.
3149
-     */
3150
-    $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3151
-    /**
3152
-     * Filter the widget listings limit.
3153
-     *
3154
-     * @since 1.0.0
3155
-     * @param string $instance['post_number'] Number of listings to display.
3156
-     */
3157
-    $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3158
-    /**
3159
-     * Filter widget's "layout" type.
3160
-     *
3161
-     * @since 1.0.0
3162
-     * @param string $instance['layout'] Widget layout type.
3163
-     */
3164
-    $layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
3165
-    /**
3166
-     * Filter widget's "add_location_filter" value.
3167
-     *
3168
-     * @since 1.0.0
3169
-     * @param string|bool $instance['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3170
-     */
3171
-    $add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3172
-    /**
3173
-     * Filter widget's listing width.
3174
-     *
3175
-     * @since 1.0.0
3176
-     * @param string $instance['listing_width'] Listing width.
3177
-     */
3178
-    $listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3179
-    /**
3180
-     * Filter widget's "list_sort" type.
3181
-     *
3182
-     * @since 1.0.0
3183
-     * @param string $instance['list_sort'] Listing sort by type.
3184
-     */
3185
-    $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3186
-    $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3187
-
3188
-    // set post type to current viewing post type
3189
-    if ($use_viewing_post_type) {
3190
-        $current_post_type = geodir_get_current_posttype();
3191
-        if ($current_post_type != '' && $current_post_type != $post_type) {
3192
-            $post_type = $current_post_type;
3193
-            $category = array(); // old post type category will not work for current changed post type
3194
-        }
3195
-    }
3196
-    // replace widget title dynamically
3197
-    $posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory');
3198
-    $posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3199
-
3200
-    $title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3201
-    $title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3202
-
3203
-    if (isset($instance['character_count'])) {
3204
-        /**
3205
-         * Filter the widget's excerpt character count.
3206
-         *
3207
-         * @since 1.0.0
3208
-         * @param int $instance['character_count'] Excerpt character count.
3209
-         */
3210
-        $character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3211
-    } else {
3212
-        $character_count = '';
3213
-    }
3214
-
3215
-    if (empty($title) || $title == 'All') {
3216
-        $title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory');
3217
-    }
3218
-
3219
-    $location_url = array();
3220
-    $city = get_query_var('gd_city');
3221
-    if (!empty($city)) {
3222
-        $country = get_query_var('gd_country');
3223
-        $region = get_query_var('gd_region');
3224
-
3225
-        $geodir_show_location_url = get_option('geodir_show_location_url');
3226
-
3227
-        if ($geodir_show_location_url == 'all') {
3228
-            if ($country != '') {
3229
-                $location_url[] = $country;
3230
-            }
3231
-
3232
-            if ($region != '') {
3233
-                $location_url[] = $region;
3234
-            }
3235
-        } else if ($geodir_show_location_url == 'country_city') {
3236
-            if ($country != '') {
3237
-                $location_url[] = $country;
3238
-            }
3239
-        } else if ($geodir_show_location_url == 'region_city') {
3240
-            if ($region != '') {
3241
-                $location_url[] = $region;
3242
-            }
3243
-        }
3244
-
3245
-        $location_url[] = $city;
3246
-    }
3247
-
3248
-    $location_url = implode('/', $location_url);
3249
-    $skip_location = false;
3250
-    if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3251
-        $skip_location = true;
3252
-        $gd_session->un_set('gd_multi_location');
3253
-    }
3254
-
3255
-    if (get_option('permalink_structure')) {
3256
-        $viewall_url = get_post_type_archive_link($post_type);
3257
-    } else {
3258
-        $viewall_url = get_post_type_archive_link($post_type);
3259
-    }
3260
-
3261
-    if (!empty($category) && $category[0] != '0') {
3262
-        global $geodir_add_location_url;
3263
-
3264
-        $geodir_add_location_url = '0';
3265
-
3266
-        if ($add_location_filter != '0') {
3267
-            $geodir_add_location_url = '1';
3268
-        }
3269
-
3270
-        $viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3271
-
3272
-        $geodir_add_location_url = NULL;
3273
-    }
3274
-    if ($skip_location) {
3275
-        $gd_session->set('gd_multi_location', 1);
3276
-    }
3277
-
3278
-    if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3279
-
3280
-    $query_args = array(
3281
-        'posts_per_page' => $post_number,
3282
-        'is_geodir_loop' => true,
3283
-        'gd_location' => $add_location_filter ? true : false,
3284
-        'post_type' => $post_type,
3285
-        'order_by' => $list_sort
3286
-    );
3287
-
3288
-    if ($character_count) {
3289
-        $query_args['excerpt_length'] = $character_count;
3290
-    }
3291
-
3292
-    if (!empty($instance['show_featured_only'])) {
3293
-        $query_args['show_featured_only'] = 1;
3294
-    }
3295
-
3296
-    if (!empty($instance['show_special_only'])) {
3297
-        $query_args['show_special_only'] = 1;
3298
-    }
3299
-
3300
-    if (!empty($instance['with_pics_only'])) {
3301
-        $query_args['with_pics_only'] = 0;
3302
-        $query_args['featured_image_only'] = 1;
3303
-    }
3304
-
3305
-    if (!empty($instance['with_videos_only'])) {
3306
-        $query_args['with_videos_only'] = 1;
3307
-    }
3308
-    $with_no_results = !empty($instance['without_no_results']) ? false : true;
3309
-
3310
-    if (!empty($category) && $category[0] != '0') {
3311
-        $category_taxonomy = geodir_get_taxonomies($post_type);
3312
-
3313
-        ######### WPML #########
3314
-        if (function_exists('icl_object_id')) {
3315
-            $category = gd_lang_object_ids($category, $category_taxonomy[0]);
3316
-        }
3317
-        ######### WPML #########
3318
-
3319
-        $tax_query = array(
3320
-            'taxonomy' => $category_taxonomy[0],
3321
-            'field' => 'id',
3322
-            'terms' => $category
3323
-        );
3324
-
3325
-        $query_args['tax_query'] = array($tax_query);
3326
-    }
3327
-
3328
-    global $gridview_columns_widget, $geodir_is_widget_listing;
3329
-
3330
-    $widget_listings = geodir_get_widget_listings($query_args);
3331
-
3332
-    if (!empty($widget_listings) || $with_no_results) {
3333
-        ?>
3130
+	// prints the widget
3131
+	extract($args, EXTR_SKIP);
3132
+
3133
+	echo $before_widget;
3134
+
3135
+	/** This filter is documented in geodirectory_widgets.php */
3136
+	$title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
3137
+	/**
3138
+	 * Filter the widget post type.
3139
+	 *
3140
+	 * @since 1.0.0
3141
+	 * @param string $instance['post_type'] Post type of listing.
3142
+	 */
3143
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
3144
+	/**
3145
+	 * Filter the widget's term.
3146
+	 *
3147
+	 * @since 1.0.0
3148
+	 * @param string $instance['category'] Filter by term. Can be any valid term.
3149
+	 */
3150
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3151
+	/**
3152
+	 * Filter the widget listings limit.
3153
+	 *
3154
+	 * @since 1.0.0
3155
+	 * @param string $instance['post_number'] Number of listings to display.
3156
+	 */
3157
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3158
+	/**
3159
+	 * Filter widget's "layout" type.
3160
+	 *
3161
+	 * @since 1.0.0
3162
+	 * @param string $instance['layout'] Widget layout type.
3163
+	 */
3164
+	$layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
3165
+	/**
3166
+	 * Filter widget's "add_location_filter" value.
3167
+	 *
3168
+	 * @since 1.0.0
3169
+	 * @param string|bool $instance['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3170
+	 */
3171
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3172
+	/**
3173
+	 * Filter widget's listing width.
3174
+	 *
3175
+	 * @since 1.0.0
3176
+	 * @param string $instance['listing_width'] Listing width.
3177
+	 */
3178
+	$listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3179
+	/**
3180
+	 * Filter widget's "list_sort" type.
3181
+	 *
3182
+	 * @since 1.0.0
3183
+	 * @param string $instance['list_sort'] Listing sort by type.
3184
+	 */
3185
+	$list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3186
+	$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3187
+
3188
+	// set post type to current viewing post type
3189
+	if ($use_viewing_post_type) {
3190
+		$current_post_type = geodir_get_current_posttype();
3191
+		if ($current_post_type != '' && $current_post_type != $post_type) {
3192
+			$post_type = $current_post_type;
3193
+			$category = array(); // old post type category will not work for current changed post type
3194
+		}
3195
+	}
3196
+	// replace widget title dynamically
3197
+	$posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory');
3198
+	$posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3199
+
3200
+	$title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3201
+	$title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3202
+
3203
+	if (isset($instance['character_count'])) {
3204
+		/**
3205
+		 * Filter the widget's excerpt character count.
3206
+		 *
3207
+		 * @since 1.0.0
3208
+		 * @param int $instance['character_count'] Excerpt character count.
3209
+		 */
3210
+		$character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3211
+	} else {
3212
+		$character_count = '';
3213
+	}
3214
+
3215
+	if (empty($title) || $title == 'All') {
3216
+		$title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory');
3217
+	}
3218
+
3219
+	$location_url = array();
3220
+	$city = get_query_var('gd_city');
3221
+	if (!empty($city)) {
3222
+		$country = get_query_var('gd_country');
3223
+		$region = get_query_var('gd_region');
3224
+
3225
+		$geodir_show_location_url = get_option('geodir_show_location_url');
3226
+
3227
+		if ($geodir_show_location_url == 'all') {
3228
+			if ($country != '') {
3229
+				$location_url[] = $country;
3230
+			}
3231
+
3232
+			if ($region != '') {
3233
+				$location_url[] = $region;
3234
+			}
3235
+		} else if ($geodir_show_location_url == 'country_city') {
3236
+			if ($country != '') {
3237
+				$location_url[] = $country;
3238
+			}
3239
+		} else if ($geodir_show_location_url == 'region_city') {
3240
+			if ($region != '') {
3241
+				$location_url[] = $region;
3242
+			}
3243
+		}
3244
+
3245
+		$location_url[] = $city;
3246
+	}
3247
+
3248
+	$location_url = implode('/', $location_url);
3249
+	$skip_location = false;
3250
+	if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3251
+		$skip_location = true;
3252
+		$gd_session->un_set('gd_multi_location');
3253
+	}
3254
+
3255
+	if (get_option('permalink_structure')) {
3256
+		$viewall_url = get_post_type_archive_link($post_type);
3257
+	} else {
3258
+		$viewall_url = get_post_type_archive_link($post_type);
3259
+	}
3260
+
3261
+	if (!empty($category) && $category[0] != '0') {
3262
+		global $geodir_add_location_url;
3263
+
3264
+		$geodir_add_location_url = '0';
3265
+
3266
+		if ($add_location_filter != '0') {
3267
+			$geodir_add_location_url = '1';
3268
+		}
3269
+
3270
+		$viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3271
+
3272
+		$geodir_add_location_url = NULL;
3273
+	}
3274
+	if ($skip_location) {
3275
+		$gd_session->set('gd_multi_location', 1);
3276
+	}
3277
+
3278
+	if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3279
+
3280
+	$query_args = array(
3281
+		'posts_per_page' => $post_number,
3282
+		'is_geodir_loop' => true,
3283
+		'gd_location' => $add_location_filter ? true : false,
3284
+		'post_type' => $post_type,
3285
+		'order_by' => $list_sort
3286
+	);
3287
+
3288
+	if ($character_count) {
3289
+		$query_args['excerpt_length'] = $character_count;
3290
+	}
3291
+
3292
+	if (!empty($instance['show_featured_only'])) {
3293
+		$query_args['show_featured_only'] = 1;
3294
+	}
3295
+
3296
+	if (!empty($instance['show_special_only'])) {
3297
+		$query_args['show_special_only'] = 1;
3298
+	}
3299
+
3300
+	if (!empty($instance['with_pics_only'])) {
3301
+		$query_args['with_pics_only'] = 0;
3302
+		$query_args['featured_image_only'] = 1;
3303
+	}
3304
+
3305
+	if (!empty($instance['with_videos_only'])) {
3306
+		$query_args['with_videos_only'] = 1;
3307
+	}
3308
+	$with_no_results = !empty($instance['without_no_results']) ? false : true;
3309
+
3310
+	if (!empty($category) && $category[0] != '0') {
3311
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3312
+
3313
+		######### WPML #########
3314
+		if (function_exists('icl_object_id')) {
3315
+			$category = gd_lang_object_ids($category, $category_taxonomy[0]);
3316
+		}
3317
+		######### WPML #########
3318
+
3319
+		$tax_query = array(
3320
+			'taxonomy' => $category_taxonomy[0],
3321
+			'field' => 'id',
3322
+			'terms' => $category
3323
+		);
3324
+
3325
+		$query_args['tax_query'] = array($tax_query);
3326
+	}
3327
+
3328
+	global $gridview_columns_widget, $geodir_is_widget_listing;
3329
+
3330
+	$widget_listings = geodir_get_widget_listings($query_args);
3331
+
3332
+	if (!empty($widget_listings) || $with_no_results) {
3333
+		?>
3334 3334
         <div class="geodir_locations geodir_location_listing">
3335 3335
 
3336 3336
             <?php
3337
-            /**
3338
-             * Called before the div containing the title and view all link in popular post view widget.
3339
-             *
3340
-             * @since 1.0.0
3341
-             */
3342
-            do_action('geodir_before_view_all_link_in_widget'); ?>
3337
+			/**
3338
+			 * Called before the div containing the title and view all link in popular post view widget.
3339
+			 *
3340
+			 * @since 1.0.0
3341
+			 */
3342
+			do_action('geodir_before_view_all_link_in_widget'); ?>
3343 3343
             <div class="geodir_list_heading clearfix">
3344 3344
                 <?php echo $before_title . $title . $after_title; ?>
3345 3345
                 <a href="<?php echo $viewall_url; ?>"
3346 3346
                    class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3347 3347
             </div>
3348 3348
             <?php
3349
-            /**
3350
-             * Called after the div containing the title and view all link in popular post view widget.
3351
-             *
3352
-             * @since 1.0.0
3353
-             */
3354
-            do_action('geodir_after_view_all_link_in_widget'); ?>
3349
+			/**
3350
+			 * Called after the div containing the title and view all link in popular post view widget.
3351
+			 *
3352
+			 * @since 1.0.0
3353
+			 */
3354
+			do_action('geodir_after_view_all_link_in_widget'); ?>
3355 3355
             <?php
3356
-            if (strstr($layout, 'gridview')) {
3357
-                $listing_view_exp = explode('_', $layout);
3358
-                $gridview_columns_widget = $layout;
3359
-                $layout = $listing_view_exp[0];
3360
-            } else {
3361
-                $gridview_columns_widget = '';
3362
-            }
3363
-
3364
-            /**
3365
-             * Filter the widget listing listview template path.
3366
-             *
3367
-             * @since 1.0.0
3368
-             */
3369
-            $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3370
-            if (!isset($character_count)) {
3371
-                /**
3372
-                 * Filter the widget's excerpt character count.
3373
-                 *
3374
-                 * @since 1.0.0
3375
-                 * @param int $instance['character_count'] Excerpt character count.
3376
-                 */
3377
-                $character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3378
-            }
3379
-
3380
-            global $post, $map_jason, $map_canvas_arr;
3381
-
3382
-            $current_post = $post;
3383
-            $current_map_jason = $map_jason;
3384
-            $current_map_canvas_arr = $map_canvas_arr;
3385
-            $geodir_is_widget_listing = true;
3386
-
3387
-            /**
3388
-             * Includes related listing listview template.
3389
-             *
3390
-             * @since 1.0.0
3391
-             */
3392
-            include($template);
3393
-
3394
-            $geodir_is_widget_listing = false;
3395
-
3396
-            $GLOBALS['post'] = $current_post;
3397
-            if (!empty($current_post))
3398
-                setup_postdata($current_post);
3399
-            $map_jason = $current_map_jason;
3400
-            $map_canvas_arr = $current_map_canvas_arr;
3401
-            ?>
3356
+			if (strstr($layout, 'gridview')) {
3357
+				$listing_view_exp = explode('_', $layout);
3358
+				$gridview_columns_widget = $layout;
3359
+				$layout = $listing_view_exp[0];
3360
+			} else {
3361
+				$gridview_columns_widget = '';
3362
+			}
3363
+
3364
+			/**
3365
+			 * Filter the widget listing listview template path.
3366
+			 *
3367
+			 * @since 1.0.0
3368
+			 */
3369
+			$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3370
+			if (!isset($character_count)) {
3371
+				/**
3372
+				 * Filter the widget's excerpt character count.
3373
+				 *
3374
+				 * @since 1.0.0
3375
+				 * @param int $instance['character_count'] Excerpt character count.
3376
+				 */
3377
+				$character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3378
+			}
3379
+
3380
+			global $post, $map_jason, $map_canvas_arr;
3381
+
3382
+			$current_post = $post;
3383
+			$current_map_jason = $map_jason;
3384
+			$current_map_canvas_arr = $map_canvas_arr;
3385
+			$geodir_is_widget_listing = true;
3386
+
3387
+			/**
3388
+			 * Includes related listing listview template.
3389
+			 *
3390
+			 * @since 1.0.0
3391
+			 */
3392
+			include($template);
3393
+
3394
+			$geodir_is_widget_listing = false;
3395
+
3396
+			$GLOBALS['post'] = $current_post;
3397
+			if (!empty($current_post))
3398
+				setup_postdata($current_post);
3399
+			$map_jason = $current_map_jason;
3400
+			$map_canvas_arr = $current_map_canvas_arr;
3401
+			?>
3402 3402
         </div>
3403 3403
     <?php
3404
-    }
3405
-    echo $after_widget;
3404
+	}
3405
+	echo $after_widget;
3406 3406
 
3407 3407
 }
3408 3408
 
@@ -3425,26 +3425,26 @@  discard block
 block discarded – undo
3425 3425
  */
3426 3426
 function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type)
3427 3427
 {
3428
-    global $wpdb, $plugin_prefix;
3428
+	global $wpdb, $plugin_prefix;
3429 3429
 
3430
-    $detail_table = $plugin_prefix . $post_type . '_detail';
3430
+	$detail_table = $plugin_prefix . $post_type . '_detail';
3431 3431
 
3432
-    $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 . ")";
3432
+	$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 . ")";
3433 3433
 
3434
-    /**
3435
-     * Filter count review sql query.
3436
-     *
3437
-     * @since 1.5.1
3438
-     * @param string $sql Database sql query..
3439
-     * @param int $term_id The term ID.
3440
-     * @param int $taxonomy The taxonomy Id.
3441
-     * @param string $post_type The post type.
3442
-     */
3443
-    $sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3434
+	/**
3435
+	 * Filter count review sql query.
3436
+	 *
3437
+	 * @since 1.5.1
3438
+	 * @param string $sql Database sql query..
3439
+	 * @param int $term_id The term ID.
3440
+	 * @param int $taxonomy The taxonomy Id.
3441
+	 * @param string $post_type The post type.
3442
+	 */
3443
+	$sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3444 3444
 
3445
-    $count = $wpdb->get_var($sql);
3445
+	$count = $wpdb->get_var($sql);
3446 3446
 
3447
-    return $count;
3447
+	return $count;
3448 3448
 }
3449 3449
 
3450 3450
 /**
@@ -3460,90 +3460,90 @@  discard block
 block discarded – undo
3460 3460
  * @return array Term array data.
3461 3461
  */
3462 3462
 function geodir_count_reviews_by_terms($force_update = false, $post_ID = 0) {
3463
-    /**
3464
-     * Filter review count option data.
3465
-     *
3466
-     * @since 1.0.0
3467
-     * @since 1.6.1 Added $post_ID param.
3468
-     * @param bool $force_update Force update option value?. Default.false.
3469
-     * @param int $post_ID The post id to update if any.
3470
-     */
3471
-    $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update,$post_ID);
3472
-    if (!empty($option_data)) {
3473
-        return $option_data;
3474
-    }
3475
-
3476
-    $option_data = get_option('geodir_global_review_count');
3477
-
3478
-    if (!$option_data || $force_update) {
3479
-        if ((int)$post_ID > 0) { // Update reviews count for specific post categories only.
3480
-            global $gd_session;
3481
-            $term_array = (array)$option_data;
3482
-            $post_type = get_post_type($post_ID);
3483
-            $taxonomy = $post_type . 'category';
3484
-            $terms = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3485
-
3486
-            if (!empty($terms) && !is_wp_error($terms)) {
3487
-                foreach ($terms as $term_id) {
3488
-                    $count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3489
-                    $children = get_term_children($term_id, $taxonomy);
3490
-                    $term_array[$term_id] = $count;
3491
-                }
3492
-            }
3463
+	/**
3464
+	 * Filter review count option data.
3465
+	 *
3466
+	 * @since 1.0.0
3467
+	 * @since 1.6.1 Added $post_ID param.
3468
+	 * @param bool $force_update Force update option value?. Default.false.
3469
+	 * @param int $post_ID The post id to update if any.
3470
+	 */
3471
+	$option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update,$post_ID);
3472
+	if (!empty($option_data)) {
3473
+		return $option_data;
3474
+	}
3475
+
3476
+	$option_data = get_option('geodir_global_review_count');
3477
+
3478
+	if (!$option_data || $force_update) {
3479
+		if ((int)$post_ID > 0) { // Update reviews count for specific post categories only.
3480
+			global $gd_session;
3481
+			$term_array = (array)$option_data;
3482
+			$post_type = get_post_type($post_ID);
3483
+			$taxonomy = $post_type . 'category';
3484
+			$terms = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3485
+
3486
+			if (!empty($terms) && !is_wp_error($terms)) {
3487
+				foreach ($terms as $term_id) {
3488
+					$count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3489
+					$children = get_term_children($term_id, $taxonomy);
3490
+					$term_array[$term_id] = $count;
3491
+				}
3492
+			}
3493 3493
             
3494
-            $session_listing = $gd_session->get('listing');
3494
+			$session_listing = $gd_session->get('listing');
3495 3495
             
3496
-            $terms = array();
3497
-            if (isset($_POST['post_category'][$taxonomy])) {
3498
-                $terms = (array)$_POST['post_category'][$taxonomy];
3499
-            } else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
3500
-                $terms = (array)$session_listing['post_category'][$taxonomy];
3501
-            }
3496
+			$terms = array();
3497
+			if (isset($_POST['post_category'][$taxonomy])) {
3498
+				$terms = (array)$_POST['post_category'][$taxonomy];
3499
+			} else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
3500
+				$terms = (array)$session_listing['post_category'][$taxonomy];
3501
+			}
3502 3502
             
3503
-            if (!empty($terms)) {
3504
-                foreach ($terms as $term_id) {
3505
-                    if ($term_id > 0) {
3506
-                        $count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3507
-                        $children = get_term_children($term_id, $taxonomy);
3508
-                        $term_array[$term_id] = $count;
3509
-                    }
3510
-                }
3511
-            }
3512
-        } else { // Update reviews count for all post categories.
3513
-            $term_array = array();
3514
-            $post_types = geodir_get_posttypes();
3515
-            foreach ($post_types as $post_type) {
3516
-
3517
-                $taxonomy = geodir_get_taxonomies($post_type);
3518
-                $taxonomy = $taxonomy[0];
3519
-
3520
-                $args = array(
3521
-                    'hide_empty' => false
3522
-                );
3523
-
3524
-                $terms = get_terms($taxonomy, $args);
3525
-
3526
-                foreach ($terms as $term) {
3527
-                    $count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3528
-                    $children = get_term_children($term->term_id, $taxonomy);
3529
-                    /*if ( is_array( $children ) ) {
3503
+			if (!empty($terms)) {
3504
+				foreach ($terms as $term_id) {
3505
+					if ($term_id > 0) {
3506
+						$count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3507
+						$children = get_term_children($term_id, $taxonomy);
3508
+						$term_array[$term_id] = $count;
3509
+					}
3510
+				}
3511
+			}
3512
+		} else { // Update reviews count for all post categories.
3513
+			$term_array = array();
3514
+			$post_types = geodir_get_posttypes();
3515
+			foreach ($post_types as $post_type) {
3516
+
3517
+				$taxonomy = geodir_get_taxonomies($post_type);
3518
+				$taxonomy = $taxonomy[0];
3519
+
3520
+				$args = array(
3521
+					'hide_empty' => false
3522
+				);
3523
+
3524
+				$terms = get_terms($taxonomy, $args);
3525
+
3526
+				foreach ($terms as $term) {
3527
+					$count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3528
+					$children = get_term_children($term->term_id, $taxonomy);
3529
+					/*if ( is_array( $children ) ) {
3530 3530
                         foreach ( $children as $child_id ) {
3531 3531
                             $child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type);
3532 3532
                             $count = $count + $child_count;
3533 3533
                         }
3534 3534
                     }*/
3535
-                    $term_array[$term->term_id] = $count;
3536
-                }
3537
-            }
3538
-        }
3539
-
3540
-        update_option('geodir_global_review_count', $term_array);
3541
-        //clear cache
3542
-        wp_cache_delete('geodir_global_review_count');
3543
-        return $term_array;
3544
-    } else {
3545
-        return $option_data;
3546
-    }
3535
+					$term_array[$term->term_id] = $count;
3536
+				}
3537
+			}
3538
+		}
3539
+
3540
+		update_option('geodir_global_review_count', $term_array);
3541
+		//clear cache
3542
+		wp_cache_delete('geodir_global_review_count');
3543
+		return $term_array;
3544
+	} else {
3545
+		return $option_data;
3546
+	}
3547 3547
 }
3548 3548
 
3549 3549
 /**
@@ -3555,38 +3555,38 @@  discard block
 block discarded – undo
3555 3555
  * @return bool
3556 3556
  */
3557 3557
 function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '') {
3558
-    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {
3559
-        return; // do not run if importing listings
3560
-    }
3558
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {
3559
+		return; // do not run if importing listings
3560
+	}
3561 3561
     
3562
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
3563
-        return;
3564
-    }
3565
-
3566
-    $post_ID = 0;
3567
-    if (!empty($post)) {
3568
-        if (isset($post->post_type) && strpos($post->post_type, 'gd_') !== 0) {
3569
-            return;
3570
-        }
3562
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
3563
+		return;
3564
+	}
3565
+
3566
+	$post_ID = 0;
3567
+	if (!empty($post)) {
3568
+		if (isset($post->post_type) && strpos($post->post_type, 'gd_') !== 0) {
3569
+			return;
3570
+		}
3571 3571
         
3572
-        if ($new_status == 'auto-draft' && $old_status == 'new') {
3573
-            return;
3574
-        }
3572
+		if ($new_status == 'auto-draft' && $old_status == 'new') {
3573
+			return;
3574
+		}
3575 3575
         
3576
-        if (!empty($post->ID)) {
3577
-            $post_ID = $post->ID;
3578
-        }
3579
-    }
3576
+		if (!empty($post->ID)) {
3577
+			$post_ID = $post->ID;
3578
+		}
3579
+	}
3580 3580
 
3581
-    if ($new_status != $old_status) {
3582
-        geodir_count_reviews_by_terms(true, $post_ID);
3583
-    }
3581
+	if ($new_status != $old_status) {
3582
+		geodir_count_reviews_by_terms(true, $post_ID);
3583
+	}
3584 3584
 
3585
-    return true;
3585
+	return true;
3586 3586
 }
3587 3587
 
3588 3588
 function geodir_term_review_count_force_update_single_post($post_id){
3589
-    geodir_count_reviews_by_terms(true, $post_id); 
3589
+	geodir_count_reviews_by_terms(true, $post_id); 
3590 3590
 }
3591 3591
 
3592 3592
 /*-----------------------------------------------------------------------------------*/
@@ -3604,15 +3604,15 @@  discard block
 block discarded – undo
3604 3604
 function geodir_count_posts_by_term($data, $term)
3605 3605
 {
3606 3606
 
3607
-    if ($data) {
3608
-        if (isset($data[$term->term_id])) {
3609
-            return $data[$term->term_id];
3610
-        } else {
3611
-            return 0;
3612
-        }
3613
-    } else {
3614
-        return $term->count;
3615
-    }
3607
+	if ($data) {
3608
+		if (isset($data[$term->term_id])) {
3609
+			return $data[$term->term_id];
3610
+		} else {
3611
+			return 0;
3612
+		}
3613
+	} else {
3614
+		return $term->count;
3615
+	}
3616 3616
 }
3617 3617
 
3618 3618
 /**
@@ -3625,8 +3625,8 @@  discard block
 block discarded – undo
3625 3625
  */
3626 3626
 function geodir_sort_terms_by_count($terms)
3627 3627
 {
3628
-    usort($terms, "geodir_sort_by_count_obj");
3629
-    return $terms;
3628
+	usort($terms, "geodir_sort_by_count_obj");
3629
+	return $terms;
3630 3630
 }
3631 3631
 
3632 3632
 /**
@@ -3639,8 +3639,8 @@  discard block
 block discarded – undo
3639 3639
  */
3640 3640
 function geodir_sort_terms_by_review_count($terms)
3641 3641
 {
3642
-    usort($terms, "geodir_sort_by_review_count_obj");
3643
-    return $terms;
3642
+	usort($terms, "geodir_sort_by_review_count_obj");
3643
+	return $terms;
3644 3644
 }
3645 3645
 
3646 3646
 /**
@@ -3654,12 +3654,12 @@  discard block
 block discarded – undo
3654 3654
  */
3655 3655
 function geodir_sort_terms($terms, $sort = 'count')
3656 3656
 {
3657
-    if ($sort == 'count') {
3658
-        return geodir_sort_terms_by_count($terms);
3659
-    }
3660
-    if ($sort == 'review_count') {
3661
-        return geodir_sort_terms_by_review_count($terms);
3662
-    }
3657
+	if ($sort == 'count') {
3658
+		return geodir_sort_terms_by_count($terms);
3659
+	}
3660
+	if ($sort == 'review_count') {
3661
+		return geodir_sort_terms_by_review_count($terms);
3662
+	}
3663 3663
 }
3664 3664
 
3665 3665
 /*-----------------------------------------------------------------------------------*/
@@ -3676,7 +3676,7 @@  discard block
 block discarded – undo
3676 3676
  */
3677 3677
 function geodir_sort_by_count($a, $b)
3678 3678
 {
3679
-    return $a['count'] < $b['count'];
3679
+	return $a['count'] < $b['count'];
3680 3680
 }
3681 3681
 
3682 3682
 /**
@@ -3690,7 +3690,7 @@  discard block
 block discarded – undo
3690 3690
  */
3691 3691
 function geodir_sort_by_count_obj($a, $b)
3692 3692
 {
3693
-    return $a->count < $b->count;
3693
+	return $a->count < $b->count;
3694 3694
 }
3695 3695
 
3696 3696
 /**
@@ -3704,7 +3704,7 @@  discard block
 block discarded – undo
3704 3704
  */
3705 3705
 function geodir_sort_by_review_count_obj($a, $b)
3706 3706
 {
3707
-    return $a->review_count < $b->review_count;
3707
+	return $a->review_count < $b->review_count;
3708 3708
 }
3709 3709
 
3710 3710
 /**
@@ -3714,43 +3714,43 @@  discard block
 block discarded – undo
3714 3714
  * @package GeoDirectory
3715 3715
  */
3716 3716
 function geodir_load_textdomain() {
3717
-    /**
3718
-     * Filter the plugin locale.
3719
-     *
3720
-     * @since 1.4.2
3721
-     * @package GeoDirectory
3722
-     */
3723
-    $locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
3724
-
3725
-    load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo');
3726
-    load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages');
3717
+	/**
3718
+	 * Filter the plugin locale.
3719
+	 *
3720
+	 * @since 1.4.2
3721
+	 * @package GeoDirectory
3722
+	 */
3723
+	$locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
3724
+
3725
+	load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo');
3726
+	load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages');
3727
+
3728
+	/**
3729
+	 * Define language constants.
3730
+	 *
3731
+	 * @since 1.0.0
3732
+	 */
3733
+	require_once(geodir_plugin_path() . '/language.php');
3734
+
3735
+	$language_file = geodir_plugin_path() . '/db-language.php';
3736
+
3737
+	// Load language string file if not created yet
3738
+	if (!file_exists($language_file)) {
3739
+		geodirectory_load_db_language();
3740
+	}
3727 3741
 
3728
-    /**
3729
-     * Define language constants.
3730
-     *
3731
-     * @since 1.0.0
3732
-     */
3733
-    require_once(geodir_plugin_path() . '/language.php');
3734
-
3735
-    $language_file = geodir_plugin_path() . '/db-language.php';
3736
-
3737
-    // Load language string file if not created yet
3738
-    if (!file_exists($language_file)) {
3739
-        geodirectory_load_db_language();
3740
-    }
3741
-
3742
-    if (file_exists($language_file)) {
3743
-        /**
3744
-         * Language strings from database.
3745
-         *
3746
-         * @since 1.4.2
3747
-         */
3748
-        try {
3749
-            require_once($language_file);
3750
-        } catch(Exception $e) {
3751
-            error_log('Language Error: ' . $e->getMessage());
3752
-        }
3753
-    }
3742
+	if (file_exists($language_file)) {
3743
+		/**
3744
+		 * Language strings from database.
3745
+		 *
3746
+		 * @since 1.4.2
3747
+		 */
3748
+		try {
3749
+			require_once($language_file);
3750
+		} catch(Exception $e) {
3751
+			error_log('Language Error: ' . $e->getMessage());
3752
+		}
3753
+	}
3754 3754
 }
3755 3755
 
3756 3756
 /**
@@ -3764,66 +3764,66 @@  discard block
 block discarded – undo
3764 3764
  * @return bool True if file created otherwise false
3765 3765
  */
3766 3766
 function geodirectory_load_db_language() {
3767
-    global $wp_filesystem;
3768
-    if( empty( $wp_filesystem ) ) {
3769
-        require_once( ABSPATH .'/wp-admin/includes/file.php' );
3770
-        WP_Filesystem();
3771
-        global $wp_filesystem;
3772
-    }
3773
-
3774
-    $language_file = geodir_plugin_path() . '/db-language.php';
3767
+	global $wp_filesystem;
3768
+	if( empty( $wp_filesystem ) ) {
3769
+		require_once( ABSPATH .'/wp-admin/includes/file.php' );
3770
+		WP_Filesystem();
3771
+		global $wp_filesystem;
3772
+	}
3775 3773
 
3776
-    if(is_file($language_file) && !is_writable($language_file))
3777
-        return false; // Not possible to create.
3774
+	$language_file = geodir_plugin_path() . '/db-language.php';
3775
+
3776
+	if(is_file($language_file) && !is_writable($language_file))
3777
+		return false; // Not possible to create.
3778
+
3779
+	if(!is_file($language_file) && !is_writable(dirname($language_file)))
3780
+		return false; // Not possible to create.
3781
+
3782
+	$contents_strings = array();
3783
+
3784
+	/**
3785
+	 * Filter the language string from database to translate via po editor
3786
+	 *
3787
+	 * @since 1.4.2
3788
+	 *
3789
+	 * @param array $contents_strings Array of strings.
3790
+	 */
3791
+	$contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
3792
+
3793
+	$contents_strings = array_unique($contents_strings);
3794
+
3795
+	$contents_head = array();
3796
+	$contents_head[] = "<?php";
3797
+	$contents_head[] = "/**";
3798
+	$contents_head[] = " * Translate language string stored in database. Ex: Custom Fields";
3799
+	$contents_head[] = " *";
3800
+	$contents_head[] = " * @package GeoDirectory";
3801
+	$contents_head[] = " * @since 1.4.2";
3802
+	$contents_head[] = " */";
3803
+	$contents_head[] = "";
3804
+	$contents_head[] = "// Language keys";
3805
+
3806
+	$contents_foot = array();
3807
+	$contents_foot[] = "";
3808
+	$contents_foot[] = "";
3809
+
3810
+	$contents = implode(PHP_EOL, $contents_head);
3811
+
3812
+	if (!empty($contents_strings)) {
3813
+		foreach ( $contents_strings as $string ) {
3814
+			if (is_scalar($string) && $string != '') {
3815
+				$string = str_replace("'", "\'", $string);
3816
+				$contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
3817
+			}
3818
+		}
3819
+	}
3778 3820
 
3779
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3780
-        return false; // Not possible to create.
3821
+	$contents .= implode(PHP_EOL, $contents_foot);
3781 3822
 
3782
-    $contents_strings = array();
3823
+	if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3824
+		return false; // Failure; could not write file.
3783 3825
 
3784
-    /**
3785
-     * Filter the language string from database to translate via po editor
3786
-     *
3787
-     * @since 1.4.2
3788
-     *
3789
-     * @param array $contents_strings Array of strings.
3790
-     */
3791
-    $contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
3792
-
3793
-    $contents_strings = array_unique($contents_strings);
3794
-
3795
-    $contents_head = array();
3796
-    $contents_head[] = "<?php";
3797
-    $contents_head[] = "/**";
3798
-    $contents_head[] = " * Translate language string stored in database. Ex: Custom Fields";
3799
-    $contents_head[] = " *";
3800
-    $contents_head[] = " * @package GeoDirectory";
3801
-    $contents_head[] = " * @since 1.4.2";
3802
-    $contents_head[] = " */";
3803
-    $contents_head[] = "";
3804
-    $contents_head[] = "// Language keys";
3805
-
3806
-    $contents_foot = array();
3807
-    $contents_foot[] = "";
3808
-    $contents_foot[] = "";
3809
-
3810
-    $contents = implode(PHP_EOL, $contents_head);
3811
-
3812
-    if (!empty($contents_strings)) {
3813
-        foreach ( $contents_strings as $string ) {
3814
-            if (is_scalar($string) && $string != '') {
3815
-                $string = str_replace("'", "\'", $string);
3816
-                $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
3817
-            }
3818
-        }
3819
-    }
3820
-
3821
-    $contents .= implode(PHP_EOL, $contents_foot);
3822
-
3823
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3824
-        return false; // Failure; could not write file.
3825
-
3826
-    return true;
3826
+	return true;
3827 3827
 }
3828 3828
 
3829 3829
 /**
@@ -3839,31 +3839,31 @@  discard block
 block discarded – undo
3839 3839
  * @return array Translation texts.
3840 3840
  */
3841 3841
 function geodir_load_custom_field_translation($translation_texts = array()) {
3842
-    global $wpdb;
3842
+	global $wpdb;
3843 3843
 
3844
-    // Custom fields table
3845
-    $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
3846
-    $rows = $wpdb->get_results($sql);
3844
+	// Custom fields table
3845
+	$sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
3846
+	$rows = $wpdb->get_results($sql);
3847 3847
 
3848
-    if (!empty($rows)) {
3849
-        foreach($rows as $row) {
3850
-            if (!empty($row->admin_title))
3851
-                $translation_texts[] = stripslashes_deep($row->admin_title);
3848
+	if (!empty($rows)) {
3849
+		foreach($rows as $row) {
3850
+			if (!empty($row->admin_title))
3851
+				$translation_texts[] = stripslashes_deep($row->admin_title);
3852 3852
 			
3853
-            if (!empty($row->admin_desc))
3854
-                $translation_texts[] = stripslashes_deep($row->admin_desc);
3853
+			if (!empty($row->admin_desc))
3854
+				$translation_texts[] = stripslashes_deep($row->admin_desc);
3855 3855
 
3856
-            if (!empty($row->site_title))
3857
-                $translation_texts[] = stripslashes_deep($row->site_title);
3856
+			if (!empty($row->site_title))
3857
+				$translation_texts[] = stripslashes_deep($row->site_title);
3858 3858
 
3859
-            if (!empty($row->clabels))
3860
-                $translation_texts[] = stripslashes_deep($row->clabels);
3859
+			if (!empty($row->clabels))
3860
+				$translation_texts[] = stripslashes_deep($row->clabels);
3861 3861
 
3862
-            if (!empty($row->required_msg))
3863
-                $translation_texts[] = stripslashes_deep($row->required_msg);
3862
+			if (!empty($row->required_msg))
3863
+				$translation_texts[] = stripslashes_deep($row->required_msg);
3864 3864
 			
3865 3865
 			if (!empty($row->default_value))
3866
-                $translation_texts[] = stripslashes_deep($row->default_value);
3866
+				$translation_texts[] = stripslashes_deep($row->default_value);
3867 3867
 			
3868 3868
 			if (!empty($row->option_values)) {
3869 3869
 				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
@@ -3876,25 +3876,25 @@  discard block
 block discarded – undo
3876 3876
 					}
3877 3877
 				}
3878 3878
 			}
3879
-        }
3880
-    }
3879
+		}
3880
+	}
3881 3881
 	
3882
-    // Custom sorting fields table
3883
-    $sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3884
-    $rows = $wpdb->get_results($sql);
3885
-
3886
-    if (!empty($rows)) {
3887
-        foreach($rows as $row) {
3888
-            if (!empty($row->site_title))
3889
-                $translation_texts[] = stripslashes_deep($row->site_title);
3890
-
3891
-            if (!empty($row->asc_title))
3892
-                $translation_texts[] = stripslashes_deep($row->asc_title);
3893
-
3894
-            if (!empty($row->desc_title))
3895
-                $translation_texts[] = stripslashes_deep($row->desc_title);
3896
-        }
3897
-    }
3882
+	// Custom sorting fields table
3883
+	$sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3884
+	$rows = $wpdb->get_results($sql);
3885
+
3886
+	if (!empty($rows)) {
3887
+		foreach($rows as $row) {
3888
+			if (!empty($row->site_title))
3889
+				$translation_texts[] = stripslashes_deep($row->site_title);
3890
+
3891
+			if (!empty($row->asc_title))
3892
+				$translation_texts[] = stripslashes_deep($row->asc_title);
3893
+
3894
+			if (!empty($row->desc_title))
3895
+				$translation_texts[] = stripslashes_deep($row->desc_title);
3896
+		}
3897
+	}
3898 3898
 	
3899 3899
 	// Advance search filter fields table
3900 3900
 	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
@@ -3915,9 +3915,9 @@  discard block
 block discarded – undo
3915 3915
 		}
3916 3916
 	}
3917 3917
 
3918
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3918
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3919 3919
 
3920
-    return $translation_texts;
3920
+	return $translation_texts;
3921 3921
 }
3922 3922
 
3923 3923
 /**
@@ -3929,71 +3929,71 @@  discard block
 block discarded – undo
3929 3929
  * @return array Array of mime types.
3930 3930
  */
3931 3931
 function geodir_allowed_mime_types() {
3932
-    /**
3933
-     * Filter the list of mime types and file extensions allowed for file upload.
3934
-     *
3935
-     * @since 1.4.7
3936
-     * @package GeoDirectory
3937
-     *
3938
-     * @param array $geodir_allowed_mime_types and file extensions.
3939
-     */
3940
-    return apply_filters( 'geodir_allowed_mime_types', array(
3941
-            'Image' => array( // Image formats.
3942
-                'jpg' => 'image/jpeg',
3943
-                'jpe' => 'image/jpeg',
3944
-                'jpeg' => 'image/jpeg',
3945
-                'gif' => 'image/gif',
3946
-                'png' => 'image/png',
3947
-                'bmp' => 'image/bmp',
3948
-                'ico' => 'image/x-icon',
3949
-            ),
3950
-            'Video' => array( // Video formats.
3951
-                'asf' => 'video/x-ms-asf',
3952
-                'avi' => 'video/avi',
3953
-                'flv' => 'video/x-flv',
3954
-                'mkv' => 'video/x-matroska',
3955
-                'mp4' => 'video/mp4',
3956
-                'mpeg' => 'video/mpeg',
3957
-                'mpg' => 'video/mpeg',
3958
-                'wmv' => 'video/x-ms-wmv',
3959
-                '3gp' => 'video/3gpp',
3960
-            ),
3961
-            'Audio' => array( // Audio formats.
3962
-                'ogg' => 'audio/ogg',
3963
-                'mp3' => 'audio/mpeg',
3964
-                'wav' => 'audio/wav',
3965
-                'wma' => 'audio/x-ms-wma',
3966
-            ),
3967
-            'Text' => array( // Text formats.
3968
-                'css' => 'text/css',
3969
-                'csv' => 'text/csv',
3970
-                'htm' => 'text/html',
3971
-                'html' => 'text/html',
3972
-                'txt' => 'text/plain',
3973
-                'rtx' => 'text/richtext',
3974
-                'vtt' => 'text/vtt',
3975
-            ),
3976
-            'Application' => array( // Application formats.
3977
-                'doc' => 'application/msword',
3978
-                'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
3979
-                'exe' => 'application/x-msdownload',
3980
-                'js' => 'application/javascript',
3981
-                'odt' => 'application/vnd.oasis.opendocument.text',
3982
-                'pdf' => 'application/pdf',
3983
-                'pot' => 'application/vnd.ms-powerpoint',
3984
-                'ppt' => 'application/vnd.ms-powerpoint',
3985
-                'pptx' => 'application/vnd.ms-powerpoint',
3986
-                'psd' => 'application/octet-stream',
3987
-                'rar' => 'application/rar',
3988
-                'rtf' => 'application/rtf',
3989
-                'swf' => 'application/x-shockwave-flash',
3990
-                'tar' => 'application/x-tar',
3991
-                'xls' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3992
-                'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3993
-                'zip' => 'application/zip',
3994
-            )
3995
-        )
3996
-    );
3932
+	/**
3933
+	 * Filter the list of mime types and file extensions allowed for file upload.
3934
+	 *
3935
+	 * @since 1.4.7
3936
+	 * @package GeoDirectory
3937
+	 *
3938
+	 * @param array $geodir_allowed_mime_types and file extensions.
3939
+	 */
3940
+	return apply_filters( 'geodir_allowed_mime_types', array(
3941
+			'Image' => array( // Image formats.
3942
+				'jpg' => 'image/jpeg',
3943
+				'jpe' => 'image/jpeg',
3944
+				'jpeg' => 'image/jpeg',
3945
+				'gif' => 'image/gif',
3946
+				'png' => 'image/png',
3947
+				'bmp' => 'image/bmp',
3948
+				'ico' => 'image/x-icon',
3949
+			),
3950
+			'Video' => array( // Video formats.
3951
+				'asf' => 'video/x-ms-asf',
3952
+				'avi' => 'video/avi',
3953
+				'flv' => 'video/x-flv',
3954
+				'mkv' => 'video/x-matroska',
3955
+				'mp4' => 'video/mp4',
3956
+				'mpeg' => 'video/mpeg',
3957
+				'mpg' => 'video/mpeg',
3958
+				'wmv' => 'video/x-ms-wmv',
3959
+				'3gp' => 'video/3gpp',
3960
+			),
3961
+			'Audio' => array( // Audio formats.
3962
+				'ogg' => 'audio/ogg',
3963
+				'mp3' => 'audio/mpeg',
3964
+				'wav' => 'audio/wav',
3965
+				'wma' => 'audio/x-ms-wma',
3966
+			),
3967
+			'Text' => array( // Text formats.
3968
+				'css' => 'text/css',
3969
+				'csv' => 'text/csv',
3970
+				'htm' => 'text/html',
3971
+				'html' => 'text/html',
3972
+				'txt' => 'text/plain',
3973
+				'rtx' => 'text/richtext',
3974
+				'vtt' => 'text/vtt',
3975
+			),
3976
+			'Application' => array( // Application formats.
3977
+				'doc' => 'application/msword',
3978
+				'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
3979
+				'exe' => 'application/x-msdownload',
3980
+				'js' => 'application/javascript',
3981
+				'odt' => 'application/vnd.oasis.opendocument.text',
3982
+				'pdf' => 'application/pdf',
3983
+				'pot' => 'application/vnd.ms-powerpoint',
3984
+				'ppt' => 'application/vnd.ms-powerpoint',
3985
+				'pptx' => 'application/vnd.ms-powerpoint',
3986
+				'psd' => 'application/octet-stream',
3987
+				'rar' => 'application/rar',
3988
+				'rtf' => 'application/rtf',
3989
+				'swf' => 'application/x-shockwave-flash',
3990
+				'tar' => 'application/x-tar',
3991
+				'xls' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3992
+				'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3993
+				'zip' => 'application/zip',
3994
+			)
3995
+		)
3996
+	);
3997 3997
 }
3998 3998
 
3999 3999
 /**
@@ -4005,21 +4005,21 @@  discard block
 block discarded – undo
4005 4005
  * @return string User display name.
4006 4006
  */
4007 4007
 function geodir_get_client_name($user_id) {
4008
-    $client_name = '';
4008
+	$client_name = '';
4009 4009
 
4010
-    $user_data = get_userdata($user_id);
4010
+	$user_data = get_userdata($user_id);
4011 4011
 
4012
-    if (!empty($user_data)) {
4013
-        if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
4014
-            $client_name = trim($user_data->display_name);
4015
-        } else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
4016
-            $client_name = trim($user_data->user_nicename);
4017
-        } else {
4018
-            $client_name = trim($user_data->user_login);
4019
-        }
4020
-    }
4012
+	if (!empty($user_data)) {
4013
+		if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
4014
+			$client_name = trim($user_data->display_name);
4015
+		} else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
4016
+			$client_name = trim($user_data->user_nicename);
4017
+		} else {
4018
+			$client_name = trim($user_data->user_login);
4019
+		}
4020
+	}
4021 4021
 
4022
-    return $client_name;
4022
+	return $client_name;
4023 4023
 }
4024 4024
 
4025 4025
 
@@ -4034,125 +4034,125 @@  discard block
 block discarded – undo
4034 4034
  */
4035 4035
 function geodir_wpseo_replacements($vars){
4036 4036
 
4037
-    global $wp;
4038
-    $title = '';
4039
-    // location variables
4040
-    $gd_post_type = geodir_get_current_posttype();
4041
-    $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4042
-    /**
4043
-     * Filter the title variables location variables array
4044
-     *
4045
-     * @since 1.5.5
4046
-     * @package GeoDirectory
4047
-     * @param array $location_array The array of location variables.
4048
-     * @param array $vars The page title variables.
4049
-     */
4050
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
4051
-    $location_titles = array();
4052
-    if(get_query_var( 'gd_country_full' )){
4053
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4054
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4055
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4056
-    }
4057
-    $location_single = '';
4058
-    $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4059
-    $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4060
-    $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4061
-
4062
-    $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4063
-
4064
-    if (function_exists('get_actual_location_name')) {
4065
-        $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4066
-        $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4067
-        $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4068
-    }
4069
-
4070
-    if ($gd_city != '') {
4071
-        if ($gd_city_actual != '') {
4072
-            $gd_city = $gd_city_actual;
4073
-        } else {
4074
-            $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4075
-            $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4076
-            $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4077
-        }
4078
-        $location_single = $gd_city;
4079
-
4080
-    } else if ($gd_region != '') {
4081
-        if ($gd_region_actual != '') {
4082
-            $gd_region = $gd_region_actual;
4083
-        } else {
4084
-            $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4085
-            $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4086
-            $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4087
-        }
4088
-
4089
-        $location_single = $gd_region;
4090
-    } else if ($gd_country != '') {
4091
-        if ($gd_country_actual != '') {
4092
-            $gd_country = $gd_country_actual;
4093
-        } else {
4094
-            $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4095
-            $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4096
-            $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4097
-        }
4098
-
4099
-        $location_single = $gd_country;
4100
-    }
4101
-
4102
-    if (!empty($location_array)) {
4103
-
4104
-        $actual_location_name = function_exists('get_actual_location_name') ? true : false;
4105
-        $location_array = array_reverse($location_array);
4106
-
4107
-        foreach ($location_array as $location_type => $location) {
4108
-            $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4109
-            $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4110
-
4111
-            $location_name = geodir_ucwords($gd_location_link_text);
4112
-            $location_name = __($location_name, 'geodirectory');
4113
-
4114
-            if ($actual_location_name) {
4115
-                $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4116
-                $location_name = get_actual_location_name($location_type, $location, true);
4117
-            }
4118
-
4119
-            $location_titles[] = $location_name;
4120
-        }
4121
-        if (!empty($location_titles)) {
4122
-            $location_titles = array_unique($location_titles);
4123
-        }
4124
-    }
4125
-
4126
-
4127
-    if(!empty($location_titles)) {
4128
-        $vars['%%location%%'] = implode(", ", $location_titles);
4129
-    }
4130
-
4131
-
4132
-    if(!empty($location_titles)) {
4133
-        $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
4134
-    }
4135
-
4136
-
4137
-
4138
-    if($location_single) {
4139
-        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
4140
-    }
4141
-
4142
-
4143
-    if($location_single) {
4144
-        $vars['%%location_single%%'] = $location_single;
4145
-    }
4146
-
4147
-    /**
4148
-     * Filter the title variables after standard ones have been filtered for wpseo.
4149
-     *
4150
-     * @since 1.5.7
4151
-     * @package GeoDirectory
4152
-     * @param string $vars The title with variables.
4153
-     * @param array $location_array The array of location variables.
4154
-     */
4155
-    return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
4037
+	global $wp;
4038
+	$title = '';
4039
+	// location variables
4040
+	$gd_post_type = geodir_get_current_posttype();
4041
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4042
+	/**
4043
+	 * Filter the title variables location variables array
4044
+	 *
4045
+	 * @since 1.5.5
4046
+	 * @package GeoDirectory
4047
+	 * @param array $location_array The array of location variables.
4048
+	 * @param array $vars The page title variables.
4049
+	 */
4050
+	$location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
4051
+	$location_titles = array();
4052
+	if(get_query_var( 'gd_country_full' )){
4053
+		if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4054
+		if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4055
+		if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4056
+	}
4057
+	$location_single = '';
4058
+	$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4059
+	$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4060
+	$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4061
+
4062
+	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4063
+
4064
+	if (function_exists('get_actual_location_name')) {
4065
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4066
+		$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4067
+		$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4068
+	}
4069
+
4070
+	if ($gd_city != '') {
4071
+		if ($gd_city_actual != '') {
4072
+			$gd_city = $gd_city_actual;
4073
+		} else {
4074
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4075
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4076
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4077
+		}
4078
+		$location_single = $gd_city;
4079
+
4080
+	} else if ($gd_region != '') {
4081
+		if ($gd_region_actual != '') {
4082
+			$gd_region = $gd_region_actual;
4083
+		} else {
4084
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4085
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4086
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4087
+		}
4088
+
4089
+		$location_single = $gd_region;
4090
+	} else if ($gd_country != '') {
4091
+		if ($gd_country_actual != '') {
4092
+			$gd_country = $gd_country_actual;
4093
+		} else {
4094
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4095
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4096
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4097
+		}
4098
+
4099
+		$location_single = $gd_country;
4100
+	}
4101
+
4102
+	if (!empty($location_array)) {
4103
+
4104
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4105
+		$location_array = array_reverse($location_array);
4106
+
4107
+		foreach ($location_array as $location_type => $location) {
4108
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4109
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4110
+
4111
+			$location_name = geodir_ucwords($gd_location_link_text);
4112
+			$location_name = __($location_name, 'geodirectory');
4113
+
4114
+			if ($actual_location_name) {
4115
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4116
+				$location_name = get_actual_location_name($location_type, $location, true);
4117
+			}
4118
+
4119
+			$location_titles[] = $location_name;
4120
+		}
4121
+		if (!empty($location_titles)) {
4122
+			$location_titles = array_unique($location_titles);
4123
+		}
4124
+	}
4125
+
4126
+
4127
+	if(!empty($location_titles)) {
4128
+		$vars['%%location%%'] = implode(", ", $location_titles);
4129
+	}
4130
+
4131
+
4132
+	if(!empty($location_titles)) {
4133
+		$vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
4134
+	}
4135
+
4136
+
4137
+
4138
+	if($location_single) {
4139
+		$vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
4140
+	}
4141
+
4142
+
4143
+	if($location_single) {
4144
+		$vars['%%location_single%%'] = $location_single;
4145
+	}
4146
+
4147
+	/**
4148
+	 * Filter the title variables after standard ones have been filtered for wpseo.
4149
+	 *
4150
+	 * @since 1.5.7
4151
+	 * @package GeoDirectory
4152
+	 * @param string $vars The title with variables.
4153
+	 * @param array $location_array The array of location variables.
4154
+	 */
4155
+	return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
4156 4156
 }
4157 4157
 
4158 4158
 
@@ -4162,10 +4162,10 @@  discard block
 block discarded – undo
4162 4162
 function geodir_filter_title_variables($title, $gd_page, $sep=''){
4163 4163
 
4164 4164
 
4165
-    if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
4166
-    global $post;
4167
-    //print_r($post);
4168
-    /*
4165
+	if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
4166
+	global $post;
4167
+	//print_r($post);
4168
+	/*
4169 4169
     %%date%%	                Replaced with the date of the post/page
4170 4170
     %%title%%	                Replaced with the title of the post/page
4171 4171
     %%sitename%%	            The site's name
@@ -4192,314 +4192,314 @@  discard block
 block discarded – undo
4192 4192
     %%pagenumber%%	            Replaced with the current page number
4193 4193
      */
4194 4194
 
4195
-    if ($sep == '') {
4196
-        /**
4197
-         * Filter the page title separator.
4198
-         *
4199
-         * @since 1.0.0
4200
-         * @package GeoDirectory
4201
-         * @param string $sep The separator, default: `|`.
4202
-         */
4203
-        $sep = apply_filters('geodir_page_title_separator', '|');
4204
-    }
4205
-
4206
-
4207
-    if(strpos($title,'%%title%%') !== false){
4208
-        $title = str_replace("%%title%%",$post->post_title,$title);
4209
-    }
4210
-
4211
-    if(strpos($title,'%%sitename%%') !== false){
4212
-        $title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
4213
-    }
4214
-
4215
-    if(strpos($title,'%%sitedesc%%') !== false){
4216
-        $title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
4217
-    }
4218
-
4219
-    if(strpos($title,'%%excerpt%%') !== false){
4220
-        $title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
4221
-    }
4222
-
4223
-    if(strpos($title,'%%pt_single%%') !== false){
4224
-        $single_name = '';
4225
-        if($gd_page=='search' || $gd_page=='author'){
4226
-            $geodir_post_types = get_option('geodir_post_types');
4227
-            $spt = esc_attr($_REQUEST['stype']);
4228
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4229
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4230
-            }
4231
-        }elseif($gd_page=='add-listing'){
4232
-            $geodir_post_types = get_option('geodir_post_types');
4233
-            $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
4234
-            if(!$spt && isset($_REQUEST['pid'])){
4235
-                $spt = get_post_type( $_REQUEST['pid'] );
4236
-            }
4237
-            if(!$spt){$spt='gd_place';}
4238
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4239
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4240
-            }
4241
-        }
4242
-        elseif($post->post_type){
4243
-            $geodir_post_types = get_option('geodir_post_types');
4244
-            if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4245
-                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
4246
-            }
4247
-
4248
-
4249
-        }
4250
-        $title = str_replace("%%pt_single%%",$single_name,$title);
4251
-    }
4252
-
4253
-    if(strpos($title,'%%pt_plural%%') !== false){
4254
-        $plural_name = '';
4255
-        if($gd_page=='search' || $gd_page=='author'){
4256
-            $geodir_post_types = get_option('geodir_post_types');
4257
-            $spt = esc_attr($_REQUEST['stype']);
4258
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4259
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4260
-            }
4261
-        }elseif($gd_page=='add-listing'){
4262
-            $geodir_post_types = get_option('geodir_post_types');
4263
-            $spt = sanitize_text_field($_REQUEST['listing_type']);
4264
-            if(!$spt){$spt='gd_place';}
4265
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4266
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4267
-            }
4268
-        }
4269
-        elseif(isset($post->post_type) && $post->post_type){
4270
-            $geodir_post_types = get_option('geodir_post_types');
4271
-            if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4272
-                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
4273
-            }
4274
-
4275
-        }
4276
-        $title = str_replace("%%pt_plural%%",$plural_name,$title);
4277
-    }
4278
-
4279
-
4280
-
4281
-    if(strpos($title,'%%category%%') !== false){
4282
-        $cat_name = '';
4283
-
4284
-        if($gd_page=='detail') {
4285
-            if ($post->default_category) {
4286
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4287
-                $cat_name = (isset($cat->name)) ? $cat->name : '';
4288
-            }
4289
-        }elseif($gd_page=='listing'){
4290
-            $queried_object = get_queried_object();
4291
-            if(isset($queried_object->name)){
4292
-                $cat_name = $queried_object->name;
4293
-            }
4294
-        }
4295
-        $title = str_replace("%%category%%",$cat_name,$title);
4296
-    }
4297
-
4298
-    if(strpos($title,'%%tag%%') !== false){
4299
-        $cat_name = '';
4300
-
4301
-        if($gd_page=='detail') {
4302
-            if ($post->default_category) {
4303
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4304
-                $cat_name = (isset($cat->name)) ? $cat->name : '';
4305
-            }
4306
-        }elseif($gd_page=='listing'){
4307
-            $queried_object = get_queried_object();
4308
-            if(isset($queried_object->name)){
4309
-                $cat_name = $queried_object->name;
4310
-            }
4311
-        }
4312
-        $title = str_replace("%%tag%%",$cat_name,$title);
4313
-    }
4314
-
4315
-
4316
-
4317
-    if(strpos($title,'%%id%%') !== false){
4318
-        $ID = (isset($post->ID)) ? $post->ID : '';
4319
-        $title = str_replace("%%id%%",$ID,$title);
4320
-    }
4321
-
4322
-    if(strpos($title,'%%sep%%') !== false){
4323
-        $title = str_replace("%%sep%%",$sep,$title);
4324
-    }
4325
-
4326
-
4327
-    global $wp;
4328
-    // location variables
4329
-    $gd_post_type = geodir_get_current_posttype();
4330
-    $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4331
-    /**
4332
-     * Filter the title variables location variables array
4333
-     *
4334
-     * @since 1.5.5
4335
-     * @package GeoDirectory
4336
-     * @param array $location_array The array of location variables.
4337
-     * @param string $title The title with variables..
4338
-     * @param string $gd_page The page being filtered.
4339
-     * @param string $sep The separator, default: `|`.
4340
-     */
4341
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4342
-    $location_titles = array();
4343
-    if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4344
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4345
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4346
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4347
-    }
4348
-    $location_single = '';
4349
-    $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4350
-    $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4351
-    $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4352
-
4353
-    $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4354
-
4355
-    if (function_exists('get_actual_location_name')) {
4356
-        $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4357
-        $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4358
-        $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4359
-    }
4360
-
4361
-    if ($gd_city != '') {
4362
-        if ($gd_city_actual != '') {
4363
-            $gd_city = $gd_city_actual;
4364
-        } else {
4365
-            $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4366
-            $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4367
-            $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4368
-        }
4369
-        $location_single = $gd_city;
4370
-
4371
-    } else if ($gd_region != '') {
4372
-        if ($gd_region_actual != '') {
4373
-            $gd_region = $gd_region_actual;
4374
-        } else {
4375
-            $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4376
-            $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4377
-            $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4378
-        }
4379
-
4380
-        $location_single = $gd_region;
4381
-    } else if ($gd_country != '') {
4382
-        if ($gd_country_actual != '') {
4383
-            $gd_country = $gd_country_actual;
4384
-        } else {
4385
-            $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4386
-            $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4387
-            $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4388
-        }
4389
-
4390
-        $location_single = $gd_country;
4391
-    }
4392
-
4393
-    if (!empty($location_array)) {
4394
-
4395
-        $actual_location_name = function_exists('get_actual_location_name') ? true : false;
4396
-        $location_array = array_reverse($location_array);
4397
-
4398
-        foreach ($location_array as $location_type => $location) {
4399
-            $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4400
-            $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4401
-
4402
-            $location_name = geodir_ucwords($gd_location_link_text);
4403
-            $location_name = __($location_name, 'geodirectory');
4404
-
4405
-            if ($actual_location_name) {
4406
-                $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4407
-                $location_name = get_actual_location_name($location_type, $location, true);
4408
-            }
4409
-
4410
-            $location_titles[] = $location_name;
4411
-        }
4412
-        if (!empty($location_titles)) {
4413
-            $location_titles = array_unique($location_titles);
4414
-        }
4415
-    }
4416
-
4417
-
4418
-    if(strpos($title,'%%location%%') !== false){
4419
-        $location = '';
4420
-        if($location_titles) {
4421
-            $location = implode(", ", $location_titles);
4422
-        }
4423
-        $title = str_replace("%%location%%",$location,$title);
4424
-    }
4425
-
4426
-    if(strpos($title,'%%in_location%%') !== false){
4427
-        $location = '';
4428
-        if($location_titles) {
4429
-            $location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4430
-        }
4431
-        $title = str_replace("%%in_location%%",$location,$title);
4432
-    }
4433
-
4434
-    if(strpos($title,'%%in_location_single%%') !== false){
4435
-        if($location_single) {
4436
-            $location_single = __('in', 'geodirectory') . ' ' .$location_single;
4437
-        }
4438
-        $title = str_replace("%%in_location_single%%",$location_single,$title);
4439
-    }
4440
-
4441
-    if(strpos($title,'%%location_single%%') !== false){
4442
-        $title = str_replace("%%location_single%%",$location_single,$title);
4443
-    }
4444
-
4445
-
4446
-    if(strpos($title,'%%search_term%%') !== false){
4447
-        $search_term = '';
4448
-        if(isset($_REQUEST['s'])){
4449
-            $search_term = esc_attr($_REQUEST['s']);
4450
-        }
4451
-        $title = str_replace("%%search_term%%",$search_term,$title);
4452
-    }
4453
-
4454
-    if(strpos($title,'%%search_near%%') !== false){
4455
-        $search_term = '';
4456
-        if(isset($_REQUEST['snear'])){
4457
-            $search_term = esc_attr($_REQUEST['snear']);
4458
-        }
4459
-        $title = str_replace("%%search_near%%",$search_term,$title);
4460
-    }
4461
-
4462
-    if(strpos($title,'%%name%%') !== false){
4463
-        $author_name = get_the_author();
4464
-        if (!$author_name || $author_name === '') {
4465
-            $queried_object = get_queried_object();
4195
+	if ($sep == '') {
4196
+		/**
4197
+		 * Filter the page title separator.
4198
+		 *
4199
+		 * @since 1.0.0
4200
+		 * @package GeoDirectory
4201
+		 * @param string $sep The separator, default: `|`.
4202
+		 */
4203
+		$sep = apply_filters('geodir_page_title_separator', '|');
4204
+	}
4205
+
4206
+
4207
+	if(strpos($title,'%%title%%') !== false){
4208
+		$title = str_replace("%%title%%",$post->post_title,$title);
4209
+	}
4210
+
4211
+	if(strpos($title,'%%sitename%%') !== false){
4212
+		$title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
4213
+	}
4214
+
4215
+	if(strpos($title,'%%sitedesc%%') !== false){
4216
+		$title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
4217
+	}
4218
+
4219
+	if(strpos($title,'%%excerpt%%') !== false){
4220
+		$title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
4221
+	}
4222
+
4223
+	if(strpos($title,'%%pt_single%%') !== false){
4224
+		$single_name = '';
4225
+		if($gd_page=='search' || $gd_page=='author'){
4226
+			$geodir_post_types = get_option('geodir_post_types');
4227
+			$spt = esc_attr($_REQUEST['stype']);
4228
+			if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4229
+				$single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4230
+			}
4231
+		}elseif($gd_page=='add-listing'){
4232
+			$geodir_post_types = get_option('geodir_post_types');
4233
+			$spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
4234
+			if(!$spt && isset($_REQUEST['pid'])){
4235
+				$spt = get_post_type( $_REQUEST['pid'] );
4236
+			}
4237
+			if(!$spt){$spt='gd_place';}
4238
+			if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4239
+				$single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4240
+			}
4241
+		}
4242
+		elseif($post->post_type){
4243
+			$geodir_post_types = get_option('geodir_post_types');
4244
+			if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4245
+				$single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
4246
+			}
4247
+
4248
+
4249
+		}
4250
+		$title = str_replace("%%pt_single%%",$single_name,$title);
4251
+	}
4252
+
4253
+	if(strpos($title,'%%pt_plural%%') !== false){
4254
+		$plural_name = '';
4255
+		if($gd_page=='search' || $gd_page=='author'){
4256
+			$geodir_post_types = get_option('geodir_post_types');
4257
+			$spt = esc_attr($_REQUEST['stype']);
4258
+			if(isset($geodir_post_types[$spt]['labels']['name'])){
4259
+				$plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4260
+			}
4261
+		}elseif($gd_page=='add-listing'){
4262
+			$geodir_post_types = get_option('geodir_post_types');
4263
+			$spt = sanitize_text_field($_REQUEST['listing_type']);
4264
+			if(!$spt){$spt='gd_place';}
4265
+			if(isset($geodir_post_types[$spt]['labels']['name'])){
4266
+				$plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4267
+			}
4268
+		}
4269
+		elseif(isset($post->post_type) && $post->post_type){
4270
+			$geodir_post_types = get_option('geodir_post_types');
4271
+			if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4272
+				$plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
4273
+			}
4274
+
4275
+		}
4276
+		$title = str_replace("%%pt_plural%%",$plural_name,$title);
4277
+	}
4278
+
4279
+
4280
+
4281
+	if(strpos($title,'%%category%%') !== false){
4282
+		$cat_name = '';
4283
+
4284
+		if($gd_page=='detail') {
4285
+			if ($post->default_category) {
4286
+				$cat = get_term($post->default_category, $post->post_type . 'category');
4287
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4288
+			}
4289
+		}elseif($gd_page=='listing'){
4290
+			$queried_object = get_queried_object();
4291
+			if(isset($queried_object->name)){
4292
+				$cat_name = $queried_object->name;
4293
+			}
4294
+		}
4295
+		$title = str_replace("%%category%%",$cat_name,$title);
4296
+	}
4297
+
4298
+	if(strpos($title,'%%tag%%') !== false){
4299
+		$cat_name = '';
4300
+
4301
+		if($gd_page=='detail') {
4302
+			if ($post->default_category) {
4303
+				$cat = get_term($post->default_category, $post->post_type . 'category');
4304
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4305
+			}
4306
+		}elseif($gd_page=='listing'){
4307
+			$queried_object = get_queried_object();
4308
+			if(isset($queried_object->name)){
4309
+				$cat_name = $queried_object->name;
4310
+			}
4311
+		}
4312
+		$title = str_replace("%%tag%%",$cat_name,$title);
4313
+	}
4314
+
4315
+
4316
+
4317
+	if(strpos($title,'%%id%%') !== false){
4318
+		$ID = (isset($post->ID)) ? $post->ID : '';
4319
+		$title = str_replace("%%id%%",$ID,$title);
4320
+	}
4321
+
4322
+	if(strpos($title,'%%sep%%') !== false){
4323
+		$title = str_replace("%%sep%%",$sep,$title);
4324
+	}
4325
+
4326
+
4327
+	global $wp;
4328
+	// location variables
4329
+	$gd_post_type = geodir_get_current_posttype();
4330
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4331
+	/**
4332
+	 * Filter the title variables location variables array
4333
+	 *
4334
+	 * @since 1.5.5
4335
+	 * @package GeoDirectory
4336
+	 * @param array $location_array The array of location variables.
4337
+	 * @param string $title The title with variables..
4338
+	 * @param string $gd_page The page being filtered.
4339
+	 * @param string $sep The separator, default: `|`.
4340
+	 */
4341
+	$location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4342
+	$location_titles = array();
4343
+	if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4344
+		if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4345
+		if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4346
+		if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4347
+	}
4348
+	$location_single = '';
4349
+	$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4350
+	$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4351
+	$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4352
+
4353
+	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4354
+
4355
+	if (function_exists('get_actual_location_name')) {
4356
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4357
+		$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4358
+		$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4359
+	}
4360
+
4361
+	if ($gd_city != '') {
4362
+		if ($gd_city_actual != '') {
4363
+			$gd_city = $gd_city_actual;
4364
+		} else {
4365
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4366
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4367
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4368
+		}
4369
+		$location_single = $gd_city;
4370
+
4371
+	} else if ($gd_region != '') {
4372
+		if ($gd_region_actual != '') {
4373
+			$gd_region = $gd_region_actual;
4374
+		} else {
4375
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4376
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4377
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4378
+		}
4379
+
4380
+		$location_single = $gd_region;
4381
+	} else if ($gd_country != '') {
4382
+		if ($gd_country_actual != '') {
4383
+			$gd_country = $gd_country_actual;
4384
+		} else {
4385
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4386
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4387
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4388
+		}
4389
+
4390
+		$location_single = $gd_country;
4391
+	}
4392
+
4393
+	if (!empty($location_array)) {
4394
+
4395
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4396
+		$location_array = array_reverse($location_array);
4397
+
4398
+		foreach ($location_array as $location_type => $location) {
4399
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4400
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4401
+
4402
+			$location_name = geodir_ucwords($gd_location_link_text);
4403
+			$location_name = __($location_name, 'geodirectory');
4404
+
4405
+			if ($actual_location_name) {
4406
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4407
+				$location_name = get_actual_location_name($location_type, $location, true);
4408
+			}
4409
+
4410
+			$location_titles[] = $location_name;
4411
+		}
4412
+		if (!empty($location_titles)) {
4413
+			$location_titles = array_unique($location_titles);
4414
+		}
4415
+	}
4416
+
4417
+
4418
+	if(strpos($title,'%%location%%') !== false){
4419
+		$location = '';
4420
+		if($location_titles) {
4421
+			$location = implode(", ", $location_titles);
4422
+		}
4423
+		$title = str_replace("%%location%%",$location,$title);
4424
+	}
4425
+
4426
+	if(strpos($title,'%%in_location%%') !== false){
4427
+		$location = '';
4428
+		if($location_titles) {
4429
+			$location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4430
+		}
4431
+		$title = str_replace("%%in_location%%",$location,$title);
4432
+	}
4433
+
4434
+	if(strpos($title,'%%in_location_single%%') !== false){
4435
+		if($location_single) {
4436
+			$location_single = __('in', 'geodirectory') . ' ' .$location_single;
4437
+		}
4438
+		$title = str_replace("%%in_location_single%%",$location_single,$title);
4439
+	}
4440
+
4441
+	if(strpos($title,'%%location_single%%') !== false){
4442
+		$title = str_replace("%%location_single%%",$location_single,$title);
4443
+	}
4444
+
4445
+
4446
+	if(strpos($title,'%%search_term%%') !== false){
4447
+		$search_term = '';
4448
+		if(isset($_REQUEST['s'])){
4449
+			$search_term = esc_attr($_REQUEST['s']);
4450
+		}
4451
+		$title = str_replace("%%search_term%%",$search_term,$title);
4452
+	}
4453
+
4454
+	if(strpos($title,'%%search_near%%') !== false){
4455
+		$search_term = '';
4456
+		if(isset($_REQUEST['snear'])){
4457
+			$search_term = esc_attr($_REQUEST['snear']);
4458
+		}
4459
+		$title = str_replace("%%search_near%%",$search_term,$title);
4460
+	}
4461
+
4462
+	if(strpos($title,'%%name%%') !== false){
4463
+		$author_name = get_the_author();
4464
+		if (!$author_name || $author_name === '') {
4465
+			$queried_object = get_queried_object();
4466 4466
             
4467
-            if (isset($queried_object->data->user_nicename)) {
4468
-                $author_name = $queried_object->data->display_name;
4469
-            }
4470
-        }
4471
-        $title = str_replace("%%name%%", $author_name, $title);
4472
-    }
4467
+			if (isset($queried_object->data->user_nicename)) {
4468
+				$author_name = $queried_object->data->display_name;
4469
+			}
4470
+		}
4471
+		$title = str_replace("%%name%%", $author_name, $title);
4472
+	}
4473 4473
     
4474
-    if (strpos($title, '%%page%%') !== false) {
4475
-        $page = geodir_title_meta_page($sep);
4476
-        $title = str_replace("%%page%%", $page, $title);
4477
-    }
4478
-    if (strpos($title, '%%pagenumber%%') !== false) {
4479
-        $pagenumber = geodir_title_meta_pagenumber();
4480
-        $title = str_replace("%%pagenumber%%", $pagenumber, $title);
4481
-    }
4482
-    if (strpos($title, '%%pagetotal%%') !== false) {
4483
-        $pagetotal = geodir_title_meta_pagetotal();
4484
-        $title = str_replace("%%pagetotal%%", $pagetotal, $title);
4485
-    }
4486
-
4487
-    $title = wptexturize( $title );
4488
-    $title = convert_chars( $title );
4489
-    $title = esc_html( $title );
4490
-
4491
-    /**
4492
-     * Filter the title variables after standard ones have been filtered.
4493
-     *
4494
-     * @since 1.5.7
4495
-     * @package GeoDirectory
4496
-     * @param string $title The title with variables.
4497
-     * @param array $location_array The array of location variables.
4498
-     * @param string $gd_page The page being filtered.
4499
-     * @param string $sep The separator, default: `|`.
4500
-     */
4474
+	if (strpos($title, '%%page%%') !== false) {
4475
+		$page = geodir_title_meta_page($sep);
4476
+		$title = str_replace("%%page%%", $page, $title);
4477
+	}
4478
+	if (strpos($title, '%%pagenumber%%') !== false) {
4479
+		$pagenumber = geodir_title_meta_pagenumber();
4480
+		$title = str_replace("%%pagenumber%%", $pagenumber, $title);
4481
+	}
4482
+	if (strpos($title, '%%pagetotal%%') !== false) {
4483
+		$pagetotal = geodir_title_meta_pagetotal();
4484
+		$title = str_replace("%%pagetotal%%", $pagetotal, $title);
4485
+	}
4501 4486
 
4502
-    return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4487
+	$title = wptexturize( $title );
4488
+	$title = convert_chars( $title );
4489
+	$title = esc_html( $title );
4490
+
4491
+	/**
4492
+	 * Filter the title variables after standard ones have been filtered.
4493
+	 *
4494
+	 * @since 1.5.7
4495
+	 * @package GeoDirectory
4496
+	 * @param string $title The title with variables.
4497
+	 * @param array $location_array The array of location variables.
4498
+	 * @param string $gd_page The page being filtered.
4499
+	 * @param string $sep The separator, default: `|`.
4500
+	 */
4501
+
4502
+	return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4503 4503
 }
4504 4504
 
4505 4505
 /**
@@ -4512,65 +4512,65 @@  discard block
 block discarded – undo
4512 4512
  * @return array Translation texts.
4513 4513
  */
4514 4514
 function geodir_load_cpt_text_translation($translation_texts = array()) {
4515
-    $gd_post_types = geodir_get_posttypes('array');
4516
-
4517
-    if (!empty($gd_post_types)) {
4518
-        foreach ($gd_post_types as $post_type => $cpt_info) {
4519
-            $labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4520
-            $description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4521
-            $seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4522
-
4523
-            if (!empty($labels)) {
4524
-                if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts))
4525
-                    $translation_texts[] = $labels['name'];
4526
-                if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts))
4527
-                    $translation_texts[] = $labels['singular_name'];
4528
-                if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts))
4529
-                    $translation_texts[] = $labels['add_new'];
4530
-                if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts))
4531
-                    $translation_texts[] = $labels['add_new_item'];
4532
-                if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts))
4533
-                    $translation_texts[] = $labels['edit_item'];
4534
-                if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts))
4535
-                    $translation_texts[] = $labels['new_item'];
4536
-                if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts))
4537
-                    $translation_texts[] = $labels['view_item'];
4538
-                if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts))
4539
-                    $translation_texts[] = $labels['search_items'];
4540
-                if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts))
4541
-                    $translation_texts[] = $labels['not_found'];
4542
-                if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts))
4543
-                    $translation_texts[] = $labels['not_found_in_trash'];
4544
-                if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts))
4545
-                    $translation_texts[] = $labels['label_post_profile'];
4546
-                if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts))
4547
-                    $translation_texts[] = $labels['label_post_info'];
4548
-                if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts))
4549
-                    $translation_texts[] = $labels['label_post_images'];
4550
-                if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts))
4551
-                    $translation_texts[] = $labels['label_post_map'];
4552
-                if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts))
4553
-                    $translation_texts[] = $labels['label_reviews'];
4554
-                if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts))
4555
-                    $translation_texts[] = $labels['label_related_listing'];
4556
-            }
4557
-
4558
-            if ($description != '' && !in_array($description, $translation_texts)) {
4559
-                $translation_texts[] = normalize_whitespace($description);
4560
-            }
4561
-
4562
-            if (!empty($seo)) {
4563
-                if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts))
4564
-                    $translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4565
-
4566
-                if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts))
4567
-                    $translation_texts[] = normalize_whitespace($seo['meta_description']);
4568
-            }
4569
-        }
4570
-    }
4571
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4572
-
4573
-    return $translation_texts;
4515
+	$gd_post_types = geodir_get_posttypes('array');
4516
+
4517
+	if (!empty($gd_post_types)) {
4518
+		foreach ($gd_post_types as $post_type => $cpt_info) {
4519
+			$labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4520
+			$description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4521
+			$seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4522
+
4523
+			if (!empty($labels)) {
4524
+				if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts))
4525
+					$translation_texts[] = $labels['name'];
4526
+				if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts))
4527
+					$translation_texts[] = $labels['singular_name'];
4528
+				if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts))
4529
+					$translation_texts[] = $labels['add_new'];
4530
+				if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts))
4531
+					$translation_texts[] = $labels['add_new_item'];
4532
+				if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts))
4533
+					$translation_texts[] = $labels['edit_item'];
4534
+				if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts))
4535
+					$translation_texts[] = $labels['new_item'];
4536
+				if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts))
4537
+					$translation_texts[] = $labels['view_item'];
4538
+				if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts))
4539
+					$translation_texts[] = $labels['search_items'];
4540
+				if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts))
4541
+					$translation_texts[] = $labels['not_found'];
4542
+				if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts))
4543
+					$translation_texts[] = $labels['not_found_in_trash'];
4544
+				if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts))
4545
+					$translation_texts[] = $labels['label_post_profile'];
4546
+				if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts))
4547
+					$translation_texts[] = $labels['label_post_info'];
4548
+				if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts))
4549
+					$translation_texts[] = $labels['label_post_images'];
4550
+				if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts))
4551
+					$translation_texts[] = $labels['label_post_map'];
4552
+				if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts))
4553
+					$translation_texts[] = $labels['label_reviews'];
4554
+				if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts))
4555
+					$translation_texts[] = $labels['label_related_listing'];
4556
+			}
4557
+
4558
+			if ($description != '' && !in_array($description, $translation_texts)) {
4559
+				$translation_texts[] = normalize_whitespace($description);
4560
+			}
4561
+
4562
+			if (!empty($seo)) {
4563
+				if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts))
4564
+					$translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4565
+
4566
+				if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts))
4567
+					$translation_texts[] = normalize_whitespace($seo['meta_description']);
4568
+			}
4569
+		}
4570
+	}
4571
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4572
+
4573
+	return $translation_texts;
4574 4574
 }
4575 4575
 
4576 4576
 /**
@@ -4583,27 +4583,27 @@  discard block
 block discarded – undo
4583 4583
  * @return array Location terms.
4584 4584
  */
4585 4585
 function geodir_remove_location_terms($location_terms = array()) {
4586
-    $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4587
-
4588
-    if (!empty($location_terms) && $location_manager) {
4589
-        $hide_country_part = get_option('geodir_location_hide_country_part');
4590
-        $hide_region_part = get_option('geodir_location_hide_region_part');
4591
-
4592
-        if ($hide_region_part && $hide_country_part) {
4593
-            if (isset($location_terms['gd_country']))
4594
-                unset($location_terms['gd_country']);
4595
-            if (isset($location_terms['gd_region']))
4596
-                unset($location_terms['gd_region']);
4597
-        } else if ($hide_region_part && !$hide_country_part) {
4598
-            if (isset($location_terms['gd_region']))
4599
-                unset($location_terms['gd_region']);
4600
-        } else if (!$hide_region_part && $hide_country_part) {
4601
-            if (isset($location_terms['gd_country']))
4602
-                unset($location_terms['gd_country']);
4603
-        }
4604
-    }
4605
-
4606
-    return $location_terms;
4586
+	$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4587
+
4588
+	if (!empty($location_terms) && $location_manager) {
4589
+		$hide_country_part = get_option('geodir_location_hide_country_part');
4590
+		$hide_region_part = get_option('geodir_location_hide_region_part');
4591
+
4592
+		if ($hide_region_part && $hide_country_part) {
4593
+			if (isset($location_terms['gd_country']))
4594
+				unset($location_terms['gd_country']);
4595
+			if (isset($location_terms['gd_region']))
4596
+				unset($location_terms['gd_region']);
4597
+		} else if ($hide_region_part && !$hide_country_part) {
4598
+			if (isset($location_terms['gd_region']))
4599
+				unset($location_terms['gd_region']);
4600
+		} else if (!$hide_region_part && $hide_country_part) {
4601
+			if (isset($location_terms['gd_country']))
4602
+				unset($location_terms['gd_country']);
4603
+		}
4604
+	}
4605
+
4606
+	return $location_terms;
4607 4607
 }
4608 4608
 
4609 4609
 /**
@@ -4617,47 +4617,47 @@  discard block
 block discarded – undo
4617 4617
  * @param bool $update Whether this is an existing listing being updated or not.
4618 4618
  */
4619 4619
 function geodir_on_wp_insert_post($post_ID, $post, $update) {
4620
-    if (!$update) {
4621
-        return;
4622
-    }
4620
+	if (!$update) {
4621
+		return;
4622
+	}
4623 4623
     
4624
-    $action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
4625
-    $is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) )  ? true : false;
4626
-    $inline_save = $action == 'inline-save' ? true : false;
4624
+	$action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
4625
+	$is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) )  ? true : false;
4626
+	$inline_save = $action == 'inline-save' ? true : false;
4627 4627
 
4628
-    if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
4629
-        return;
4630
-    }
4628
+	if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
4629
+		return;
4630
+	}
4631 4631
     
4632
-    if ($action != '' && in_array($action, array('geodir_import_export'))) {
4633
-        return;
4634
-    }
4632
+	if ($action != '' && in_array($action, array('geodir_import_export'))) {
4633
+		return;
4634
+	}
4635 4635
 
4636
-    $user_id = (int)get_current_user_id();
4636
+	$user_id = (int)get_current_user_id();
4637 4637
         
4638
-    if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4639
-        $author_id = !empty($post->post_author) ? $post->post_author : 0;
4638
+	if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4639
+		$author_id = !empty($post->post_author) ? $post->post_author : 0;
4640 4640
         
4641
-        if ($user_id == $author_id && !is_super_admin()) {
4642
-            $from_email = get_option('site_email');
4643
-            $from_name = get_site_emailName();
4644
-            $to_email = get_option('admin_email');
4645
-            $to_name = get_option('name');
4646
-            $message_type = 'listing_edited';
4641
+		if ($user_id == $author_id && !is_super_admin()) {
4642
+			$from_email = get_option('site_email');
4643
+			$from_name = get_site_emailName();
4644
+			$to_email = get_option('admin_email');
4645
+			$to_name = get_option('name');
4646
+			$message_type = 'listing_edited';
4647 4647
             
4648
-            $notify_edited = true;
4649
-            /**
4650
-             * Send notification when listing edited by author?
4651
-             *
4652
-             * @since 1.6.0
4653
-             * @param bool $notify_edited Notify on listing edited by author?
4654
-             * @param object $post The current post object.
4655
-             */
4656
-            $notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
4648
+			$notify_edited = true;
4649
+			/**
4650
+			 * Send notification when listing edited by author?
4651
+			 *
4652
+			 * @since 1.6.0
4653
+			 * @param bool $notify_edited Notify on listing edited by author?
4654
+			 * @param object $post The current post object.
4655
+			 */
4656
+			$notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
4657 4657
             
4658
-            geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
4659
-        }
4660
-    }
4658
+			geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
4659
+		}
4660
+	}
4661 4661
 }
4662 4662
 
4663 4663
 /**
@@ -4671,16 +4671,16 @@  discard block
 block discarded – undo
4671 4671
  * @return string|null The current page start & end numbering.
4672 4672
  */
4673 4673
 function geodir_title_meta_page($sep) {
4674
-    $replacement = null;
4674
+	$replacement = null;
4675 4675
 
4676
-    $max = geodir_title_meta_pagenumbering('max');
4677
-    $nr  = geodir_title_meta_pagenumbering('nr');
4676
+	$max = geodir_title_meta_pagenumbering('max');
4677
+	$nr  = geodir_title_meta_pagenumbering('nr');
4678 4678
 
4679
-    if ($max > 1 && $nr > 1) {
4680
-        $replacement = sprintf($sep . ' ' . __('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
4681
-    }
4679
+	if ($max > 1 && $nr > 1) {
4680
+		$replacement = sprintf($sep . ' ' . __('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
4681
+	}
4682 4682
 
4683
-    return $replacement;
4683
+	return $replacement;
4684 4684
 }
4685 4685
 
4686 4686
 /**
@@ -4692,14 +4692,14 @@  discard block
 block discarded – undo
4692 4692
  * @return string|null The current page number.
4693 4693
  */
4694 4694
 function geodir_title_meta_pagenumber() {
4695
-    $replacement = null;
4695
+	$replacement = null;
4696 4696
 
4697
-    $nr = geodir_title_meta_pagenumbering('nr');
4698
-    if (isset($nr) && $nr > 0) {
4699
-        $replacement = (string)$nr;
4700
-    }
4697
+	$nr = geodir_title_meta_pagenumbering('nr');
4698
+	if (isset($nr) && $nr > 0) {
4699
+		$replacement = (string)$nr;
4700
+	}
4701 4701
 
4702
-    return $replacement;
4702
+	return $replacement;
4703 4703
 }
4704 4704
 
4705 4705
 /**
@@ -4711,14 +4711,14 @@  discard block
 block discarded – undo
4711 4711
  * @return string|null The current page total.
4712 4712
  */
4713 4713
 function geodir_title_meta_pagetotal() {
4714
-    $replacement = null;
4714
+	$replacement = null;
4715 4715
 
4716
-    $max = geodir_title_meta_pagenumbering('max');
4717
-    if (isset($max) && $max > 0) {
4718
-        $replacement = (string)$max;
4719
-    }
4716
+	$max = geodir_title_meta_pagenumbering('max');
4717
+	if (isset($max) && $max > 0) {
4718
+		$replacement = (string)$max;
4719
+	}
4720 4720
 
4721
-    return $replacement;
4721
+	return $replacement;
4722 4722
 }
4723 4723
 
4724 4724
 /**
@@ -4735,44 +4735,44 @@  discard block
 block discarded – undo
4735 4735
  * @return int|null The current page numbering.
4736 4736
  */
4737 4737
 function geodir_title_meta_pagenumbering($request = 'nr') {
4738
-    global $wp_query, $post;
4739
-    $max_num_pages = null;
4740
-    $page_number   = null;
4741
-
4742
-    $max_num_pages = 1;
4743
-
4744
-    if (!is_singular()) {
4745
-        $page_number = get_query_var('paged');
4746
-        if ($page_number === 0 || $page_number === '') {
4747
-            $page_number = 1;
4748
-        }
4749
-
4750
-        if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) {
4751
-            $max_num_pages = $wp_query->max_num_pages;
4752
-        }
4753
-    } else {
4754
-        $page_number = get_query_var('page');
4755
-        if ($page_number === 0 || $page_number === '') {
4756
-            $page_number = 1;
4757
-        }
4758
-
4759
-        if (isset($post->post_content)) {
4760
-            $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->' ) + 1);
4761
-        }
4762
-    }
4763
-
4764
-    $return = null;
4765
-
4766
-    switch ($request) {
4767
-        case 'nr':
4768
-            $return = $page_number;
4769
-            break;
4770
-        case 'max':
4771
-            $return = $max_num_pages;
4772
-            break;
4773
-    }
4774
-
4775
-    return $return;
4738
+	global $wp_query, $post;
4739
+	$max_num_pages = null;
4740
+	$page_number   = null;
4741
+
4742
+	$max_num_pages = 1;
4743
+
4744
+	if (!is_singular()) {
4745
+		$page_number = get_query_var('paged');
4746
+		if ($page_number === 0 || $page_number === '') {
4747
+			$page_number = 1;
4748
+		}
4749
+
4750
+		if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) {
4751
+			$max_num_pages = $wp_query->max_num_pages;
4752
+		}
4753
+	} else {
4754
+		$page_number = get_query_var('page');
4755
+		if ($page_number === 0 || $page_number === '') {
4756
+			$page_number = 1;
4757
+		}
4758
+
4759
+		if (isset($post->post_content)) {
4760
+			$max_num_pages = (substr_count($post->post_content, '<!--nextpage-->' ) + 1);
4761
+		}
4762
+	}
4763
+
4764
+	$return = null;
4765
+
4766
+	switch ($request) {
4767
+		case 'nr':
4768
+			$return = $page_number;
4769
+			break;
4770
+		case 'max':
4771
+			$return = $max_num_pages;
4772
+			break;
4773
+	}
4774
+
4775
+	return $return;
4776 4776
 }
4777 4777
 
4778 4778
 /**
@@ -4784,15 +4784,15 @@  discard block
 block discarded – undo
4784 4784
  * @return array Terms.
4785 4785
  */
4786 4786
 function geodir_filter_empty_terms($terms) {
4787
-    if (empty($terms)) {
4788
-        return $terms;
4789
-    }
4790
-
4791
-    $return = array();
4792
-    foreach ($terms as $term) {
4793
-        if (isset($term->count) && $term->count > 0) {
4794
-            $return[] = $term;
4795
-        }
4796
-    }
4797
-    return $return;
4787
+	if (empty($terms)) {
4788
+		return $terms;
4789
+	}
4790
+
4791
+	$return = array();
4792
+	foreach ($terms as $term) {
4793
+		if (isset($term->count) && $term->count > 0) {
4794
+			$return[] = $term;
4795
+		}
4796
+	}
4797
+	return $return;
4798 4798
 }
4799 4799
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +389 added lines, -389 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 /**
11 11
  * Get All Plugin functions from WordPress
12 12
  */
13
-include_once(ABSPATH . 'wp-admin/includes/plugin.php');
13
+include_once(ABSPATH.'wp-admin/includes/plugin.php');
14 14
 
15 15
 /*-----------------------------------------------------------------------------------*/
16 16
 /* Helper functions */
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 {
30 30
 
31 31
     if (is_ssl()) :
32
-        return str_replace('http://', 'https://', WP_PLUGIN_URL) . "/" . plugin_basename(dirname(dirname(__FILE__)));
32
+        return str_replace('http://', 'https://', WP_PLUGIN_URL)."/".plugin_basename(dirname(dirname(__FILE__)));
33 33
     else :
34
-        return WP_PLUGIN_URL . "/" . plugin_basename(dirname(dirname(__FILE__)));
34
+        return WP_PLUGIN_URL."/".plugin_basename(dirname(dirname(__FILE__)));
35 35
     endif;
36 36
 }
37 37
 
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function geodir_plugin_path()
49 49
 {
50
-    if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
50
+    if (defined('GD_TESTING_MODE') && GD_TESTING_MODE) {
51 51
         return dirname(dirname(__FILE__));
52 52
     } else {
53
-        return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__)));
53
+        return WP_PLUGIN_DIR."/".plugin_basename(dirname(dirname(__FILE__)));
54 54
     }
55 55
 }
56 56
 
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
     foreach ($params as $key => $value) {
130 130
         if (gettype($value) == 'array') { //Handle array data properly
131 131
             foreach ($value as $val) {
132
-                $params_arr[] = $key . '[]=' . urlencode($val);
132
+                $params_arr[] = $key.'[]='.urlencode($val);
133 133
             }
134 134
         } else {
135
-            $params_arr[] = $key . '=' . urlencode($value);
135
+            $params_arr[] = $key.'='.urlencode($value);
136 136
         }
137 137
     }
138 138
     $link .= implode('&', $params_arr);
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
         $add_listing_link = get_page_link(geodir_add_listing_page_id());
162 162
 
163
-        return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
163
+        return esc_url(add_query_arg(array('listing_type' => $post_type), $add_listing_link));
164 164
     } else
165 165
         return get_bloginfo('url');
166 166
 }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         $pageURL .= "s";
181 181
     }
182 182
     $pageURL .= "://";
183
-    $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
183
+    $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
184 184
     /**
185 185
      * Filter the current page URL returned by function geodir_curPageURL().
186 186
      *
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 function geodir_is_page($gdpage = '')
253 253
 {
254 254
 
255
-    global $wp_query, $post,$wp;
255
+    global $wp_query, $post, $wp;
256 256
     //if(!is_admin()):
257 257
 
258 258
     switch ($gdpage):
@@ -277,14 +277,14 @@  discard block
 block discarded – undo
277 277
             break;
278 278
         case 'detail':
279 279
             $post_type = get_query_var('post_type');
280
-            if(is_array($post_type)){$post_type = reset($post_type);}
280
+            if (is_array($post_type)) {$post_type = reset($post_type); }
281 281
             if (is_single() && in_array($post_type, geodir_get_posttypes()))
282 282
                 return true;
283 283
             break;
284 284
         case 'pt':
285 285
             $post_type = get_query_var('post_type');
286
-            if(is_array($post_type)){$post_type = reset($post_type);}
287
-            if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax())
286
+            if (is_array($post_type)) {$post_type = reset($post_type); }
287
+            if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()) && !is_tax())
288 288
                 return true;
289 289
 
290 290
             break;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
                 return true;
296 296
             }
297 297
             $post_type = get_query_var('post_type');
298
-            if(is_array($post_type)){$post_type = reset($post_type);}
298
+            if (is_array($post_type)) {$post_type = reset($post_type); }
299 299
             if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()))
300 300
                 return true;
301 301
 
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
             if (is_author() && isset($_REQUEST['geodir_dashbord']))
315 315
                 return true;
316 316
 			
317
-			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) {
318
-				if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) {
317
+			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) {
318
+				if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) {
319 319
 					return true;
320 320
 				}
321 321
 			}
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
         if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
369 369
             if (get_option('geodir_set_as_home'))
370 370
                 $wp->query_vars['gd_is_geodir_page'] = true;
371
-            if(geodir_is_page('home')){
371
+            if (geodir_is_page('home')) {
372 372
                 $wp->query_vars['gd_is_geodir_page'] = true;
373 373
             }
374 374
 
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 
421 421
         if (!isset($wp->query_vars['gd_is_geodir_page'])) {
422 422
             $geodir_taxonomis = geodir_get_taxonomies('', true);
423
-            if(!empty($geodir_taxonomis)){
423
+            if (!empty($geodir_taxonomis)) {
424 424
                 foreach ($geodir_taxonomis as $taxonomy) {
425 425
                     if (array_key_exists($taxonomy, $wp->query_vars)) {
426 426
                         $wp->query_vars['gd_is_geodir_page'] = true;
@@ -440,10 +440,10 @@  discard block
 block discarded – undo
440 440
 
441 441
 
442 442
 //check if homepage
443
-        if(!isset($wp->query_vars['gd_is_geodir_page'])
443
+        if (!isset($wp->query_vars['gd_is_geodir_page'])
444 444
             && !isset($wp->query_vars['page_id'])
445 445
             && !isset($wp->query_vars['pagename'])
446
-            && is_page_geodir_home()){
446
+            && is_page_geodir_home()) {
447 447
             $wp->query_vars['gd_is_geodir_page'] = true;
448 448
         }
449 449
         //echo $wp->query_vars['gd_is_geodir_page'] ;
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
              * @since 1.0.0
506 506
              * @param array $imagesizes[$size] Image size array of the passed key.
507 507
              */
508
-            return apply_filters('geodir_get_imagesize_' . $size, $imagesizes[$size]);
508
+            return apply_filters('geodir_get_imagesize_'.$size, $imagesizes[$size]);
509 509
 
510 510
         } elseif (!empty($size)) {
511 511
 
@@ -544,13 +544,13 @@  discard block
 block discarded – undo
544 544
     function createRandomString()
545 545
     {
546 546
         $chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
547
-        srand((double)microtime() * 1000000);
547
+        srand((double) microtime() * 1000000);
548 548
         $i = 0;
549 549
         $rstring = '';
550 550
         while ($i <= 25) {
551 551
             $num = rand() % 33;
552 552
             $tmp = substr($chars, $num, 1);
553
-            $rstring = $rstring . $tmp;
553
+            $rstring = $rstring.$tmp;
554 554
             $i++;
555 555
         }
556 556
         return $rstring;
@@ -681,11 +681,11 @@  discard block
 block discarded – undo
681 681
         }
682 682
 		
683 683
 		if (!empty($subject)) {
684
-			$subject = __(stripslashes_deep($subject),'geodirectory');
684
+			$subject = __(stripslashes_deep($subject), 'geodirectory');
685 685
 		}
686 686
 		
687 687
 		if (!empty($message)) {
688
-			$message = __(stripslashes_deep($message),'geodirectory');
688
+			$message = __(stripslashes_deep($message), 'geodirectory');
689 689
 		}
690 690
 
691 691
         $to_message = nl2br($to_message);
@@ -705,12 +705,12 @@  discard block
 block discarded – undo
705 705
 
706 706
         if ($post_info) {
707 707
             $posted_date = $post_info->post_date;
708
-            $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
708
+            $listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
709 709
         }
710 710
         $siteurl = home_url();
711
-        $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
711
+        $siteurl_link = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
712 712
         $loginurl = geodir_login_url();
713
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
713
+        $loginurl_link = '<a href="'.$loginurl.'">login</a>';
714 714
         
715 715
         $post_author_id = !empty($post_info) ? $post_info->post_author : 0;
716 716
         $post_author_name = geodir_get_client_name($post_author_id);
@@ -724,18 +724,18 @@  discard block
 block discarded – undo
724 724
             $fromEmailName = get_option('site_email_name');
725 725
         }
726 726
 
727
-        $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#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
728
-        $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, $post_author_id, $post_author_name, $current_date);
727
+        $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#]', '[#post_author_id#]', '[#post_author_name#]', '[#current_date#]');
728
+        $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, $post_author_id, $post_author_name, $current_date);
729 729
         $message = str_replace($search_array, $replace_array, $message);
730 730
 
731
-        $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#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
732
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
731
+        $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#]', '[#post_author_id#]', '[#post_author_name#]', '[#current_date#]');
732
+        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
733 733
         $subject = str_replace($search_array, $replace_array, $subject);
734 734
 
735
-        $headers = 'MIME-Version: 1.0' . "\r\n";
736
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
737
-        $headers .= "Reply-To: " . $fromEmail . "\r\n";
738
-        $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
735
+        $headers = 'MIME-Version: 1.0'."\r\n";
736
+        $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
737
+        $headers .= "Reply-To: ".$fromEmail."\r\n";
738
+        $headers .= 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>'."\r\n";
739 739
 
740 740
         $to = $toEmail;
741 741
 
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
          * @param string $post_id The post ID.
757 757
          * @param string $user_id The user ID.
758 758
          */
759
-        $to = apply_filters('geodir_sendEmail_to',$to,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
759
+        $to = apply_filters('geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
760 760
         /**
761 761
          * Filter the client email subject.
762 762
          *
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
          * @param string $post_id The post ID.
775 775
          * @param string $user_id The user ID.
776 776
          */
777
-        $subject = apply_filters('geodir_sendEmail_subject',$subject,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
777
+        $subject = apply_filters('geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
778 778
         /**
779 779
          * Filter the client email message.
780 780
          *
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
          * @param string $post_id The post ID.
793 793
          * @param string $user_id The user ID.
794 794
          */
795
-        $message = apply_filters('geodir_sendEmail_message',$message,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
795
+        $message = apply_filters('geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
796 796
         /**
797 797
          * Filter the client email headers.
798 798
          *
@@ -810,22 +810,22 @@  discard block
 block discarded – undo
810 810
          * @param string $post_id The post ID.
811 811
          * @param string $user_id The user ID.
812 812
          */
813
-        $headers = apply_filters('geodir_sendEmail_headers',$headers,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
813
+        $headers = apply_filters('geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
814 814
 
815 815
         $sent = wp_mail($to, $subject, $message, $headers);
816 816
 
817
-        if( ! $sent ) {
818
-            if ( is_array( $to ) ) {
819
-                $to = implode( ',', $to );
817
+        if (!$sent) {
818
+            if (is_array($to)) {
819
+                $to = implode(',', $to);
820 820
             }
821 821
             $log_message = sprintf(
822
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
822
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
823 823
                 $message_type,
824
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
824
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
825 825
                 $to,
826 826
                 $subject
827 827
             );
828
-            geodir_error_log( $log_message );
828
+            geodir_error_log($log_message);
829 829
         }
830 830
 
831 831
         ///////// ADMIN BCC EMIALS
@@ -837,11 +837,11 @@  discard block
 block discarded – undo
837 837
             $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
838 838
             $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
839 839
 
840
-            $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#]');
840
+            $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#]');
841 841
             $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);
842 842
             $message = str_replace($search_array, $replace_array, $message);
843 843
 
844
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
844
+            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]', '[#user_login#]', '[#username#]');
845 845
             $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
846 846
             $subject = str_replace($search_array, $replace_array, $subject);
847 847
 
@@ -866,21 +866,21 @@  discard block
 block discarded – undo
866 866
             $admin_bcc = true;
867 867
         }
868 868
 
869
-        if($admin_bcc===true){
869
+        if ($admin_bcc === true) {
870 870
             $sent = wp_mail($to, $subject, $message, $headers);
871 871
 
872
-            if( ! $sent ) {
873
-                if ( is_array( $to ) ) {
874
-                    $to = implode( ',', $to );
872
+            if (!$sent) {
873
+                if (is_array($to)) {
874
+                    $to = implode(',', $to);
875 875
                 }
876 876
                 $log_message = sprintf(
877
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
877
+                    __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
878 878
                     $message_type,
879
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
879
+                    date_i18n('F j Y H:i:s', current_time('timestamp')),
880 880
                     $to,
881 881
                     $subject
882 882
                 );
883
-                geodir_error_log( $log_message );
883
+                geodir_error_log($log_message);
884 884
             }
885 885
         }
886 886
 
@@ -912,12 +912,12 @@  discard block
 block discarded – undo
912 912
         foreach ($parents as $parent):
913 913
             $item = get_term_by('id', $parent, get_query_var('taxonomy'));
914 914
             $url = get_term_link($item, get_query_var('taxonomy'));
915
-            echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
915
+            echo '<li> > <a href="'.$url.'">'.$item->name.'</a></li>';
916 916
         endforeach;
917 917
 
918 918
     endif;
919 919
 
920
-    echo '<li> > ' . $term->name . '</li>';
920
+    echo '<li> > '.$term->name.'</li>';
921 921
 }
922 922
 
923 923
 
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
          *
952 952
          * @since 1.0.0
953 953
          */
954
-        $breadcrumb .= '<li>' . apply_filters('geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __('Home', 'geodirectory') . '</a>') . '</li>';
954
+        $breadcrumb .= '<li>'.apply_filters('geodir_breadcrumb_first_link', '<a href="'.home_url().'">'.__('Home', 'geodirectory').'</a>').'</li>';
955 955
 
956 956
         $gd_post_type = geodir_get_current_posttype();
957 957
         $post_type_info = get_post_type_object($gd_post_type);
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
             $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
976 976
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
977 977
 				
978
-			if(geodir_is_page('detail') && isset($post->country_slug)){
978
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
979 979
                 $location_terms = array(
980 980
                     'gd_country' => $post->country_slug,
981 981
                     'gd_region' => $post->region_slug,
@@ -1030,12 +1030,12 @@  discard block
 block discarded – undo
1030 1030
             $is_location_last = '';
1031 1031
             $is_taxonomy_last = '';
1032 1032
             $breadcrumb .= '<li>';
1033
-            if (get_query_var($gd_post_type . 'category'))
1034
-                $gd_taxonomy = $gd_post_type . 'category';
1035
-            elseif (get_query_var($gd_post_type . '_tags'))
1036
-                $gd_taxonomy = $gd_post_type . '_tags';
1033
+            if (get_query_var($gd_post_type.'category'))
1034
+                $gd_taxonomy = $gd_post_type.'category';
1035
+            elseif (get_query_var($gd_post_type.'_tags'))
1036
+                $gd_taxonomy = $gd_post_type.'_tags';
1037 1037
 
1038
-            $breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1038
+            $breadcrumb .= $separator.'<a href="'.$listing_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1039 1039
             if (!empty($gd_taxonomy) || geodir_is_page('detail'))
1040 1040
                 $is_location_last = false;
1041 1041
             else
@@ -1085,18 +1085,18 @@  discard block
 block discarded – undo
1085 1085
                         }
1086 1086
 
1087 1087
                         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'] != '')) {
1088
-                            $breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1088
+                            $breadcrumb .= $location_term_actual_country != '' ? $separator.$location_term_actual_country : $separator.$gd_location_link_text;
1089 1089
                         } else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1090
-                            $breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1090
+                            $breadcrumb .= $location_term_actual_region != '' ? $separator.$location_term_actual_region : $separator.$gd_location_link_text;
1091 1091
                         } else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1092
-                            $breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1092
+                            $breadcrumb .= $location_term_actual_city != '' ? $separator.$location_term_actual_city : $separator.$gd_location_link_text;
1093 1093
                         } else if ($is_location_last && $key == 'gd_neighbourhood') {
1094
-                            $breadcrumb .= $separator . $gd_location_link_text;
1094
+                            $breadcrumb .= $separator.$gd_location_link_text;
1095 1095
                         } else {
1096 1096
                             if (get_option('permalink_structure') != '') {
1097
-                                $location_link .= $location_term . '/';
1097
+                                $location_link .= $location_term.'/';
1098 1098
                             } else {
1099
-                                $location_link .= "&$key=" . $location_term;
1099
+                                $location_link .= "&$key=".$location_term;
1100 1100
                             }
1101 1101
 
1102 1102
                             if ($key == 'gd_country' && $location_term_actual_country != '') {
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
                             }
1114 1114
                             */
1115 1115
 
1116
-                            $breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1116
+                            $breadcrumb .= $separator.'<a href="'.$location_link.'">'.$gd_location_link_text.'</a>';
1117 1117
                         }
1118 1118
                     }
1119 1119
                 }
@@ -1124,8 +1124,8 @@  discard block
 block discarded – undo
1124 1124
 
1125 1125
                 //if(get_option('geodir_add_categories_url'))
1126 1126
                 {
1127
-                    if (get_query_var($gd_post_type . '_tags')) {
1128
-                        $cat_link = $listing_link . 'tags/';
1127
+                    if (get_query_var($gd_post_type.'_tags')) {
1128
+                        $cat_link = $listing_link.'tags/';
1129 1129
                     } else
1130 1130
                         $cat_link = $listing_link;
1131 1131
 
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 
1137 1137
                         if ($location_term != '') {
1138 1138
                             if (get_option('permalink_structure') != '') {
1139
-                                $cat_link .= $location_term . '/';
1139
+                                $cat_link .= $location_term.'/';
1140 1140
                             }
1141 1141
                         }
1142 1142
                     }
@@ -1155,10 +1155,10 @@  discard block
 block discarded – undo
1155 1155
                         }
1156 1156
 
1157 1157
                         if ($term_index == count($term_array) && $is_taxonomy_last)
1158
-                            $breadcrumb .= $separator . $term_link_text;
1158
+                            $breadcrumb .= $separator.$term_link_text;
1159 1159
                         else {
1160
-                            $cat_link .= $term . '/';
1161
-                            $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1160
+                            $cat_link .= $term.'/';
1161
+                            $breadcrumb .= $separator.'<a href="'.$cat_link.'">'.$term_link_text.'</a>';
1162 1162
                         }
1163 1163
                         $term_index++;
1164 1164
                     }
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
             }
1169 1169
 
1170 1170
             if (geodir_is_page('detail'))
1171
-                $breadcrumb .= $separator . get_the_title();
1171
+                $breadcrumb .= $separator.get_the_title();
1172 1172
 
1173 1173
             $breadcrumb .= '</li>';
1174 1174
 
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
             $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1189 1189
 
1190 1190
             $breadcrumb .= '<li>';
1191
-            $breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>';
1191
+            $breadcrumb .= $separator.'<a href="'.$default_author_link.'">'.__('My Dashboard', 'geodirectory').'</a>';
1192 1192
 
1193 1193
             if (isset($_REQUEST['list'])) {
1194 1194
                 $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false);
@@ -1203,20 +1203,20 @@  discard block
 block discarded – undo
1203 1203
                  */
1204 1204
                 $author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1205 1205
 
1206
-                $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1207
-                $breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1206
+                $breadcrumb .= $separator.'<a href="'.$author_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1207
+                $breadcrumb .= $separator.ucfirst(__('My', 'geodirectory').' '.$_REQUEST['list']);
1208 1208
             } else
1209
-                $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1209
+                $breadcrumb .= $separator.__(ucfirst($post_type_info->label), 'geodirectory');
1210 1210
 
1211 1211
             $breadcrumb .= '</li>';
1212 1212
         } elseif (is_category() || is_single()) {
1213 1213
             $category = get_the_category();
1214 1214
             if (is_category()) {
1215
-                $breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1215
+                $breadcrumb .= '<li>'.$separator.$category[0]->cat_name.'</li>';
1216 1216
             }
1217 1217
             if (is_single()) {
1218
-                $breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>';
1219
-                $breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1218
+                $breadcrumb .= '<li>'.$separator.'<a href="'.get_category_link($category[0]->term_id).'">'.$category[0]->cat_name.'</a></li>';
1219
+                $breadcrumb .= '<li>'.$separator.get_the_title().'</li>';
1220 1220
             }
1221 1221
             /* End of my version ##################################################### */
1222 1222
         } else if (is_page()) {
@@ -1226,31 +1226,31 @@  discard block
 block discarded – undo
1226 1226
                 $page_title = defined('GD_LOCATION') ? GD_LOCATION : __('Location', 'geodirectory');
1227 1227
             }
1228 1228
 
1229
-            $breadcrumb .= '<li>' . $separator;
1229
+            $breadcrumb .= '<li>'.$separator;
1230 1230
             $breadcrumb .= stripslashes_deep($page_title);
1231 1231
             $breadcrumb .= '</li>';
1232 1232
         } else if (is_tag()) {
1233
-            $breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1233
+            $breadcrumb .= "<li> ".$separator.single_tag_title('', false).'</li>';
1234 1234
         } else if (is_day()) {
1235
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1235
+            $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1236 1236
             the_time('F jS, Y');
1237 1237
             $breadcrumb .= '</li>';
1238 1238
         } else if (is_month()) {
1239
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1239
+            $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1240 1240
             the_time('F, Y');
1241 1241
             $breadcrumb .= '</li>';
1242 1242
         } else if (is_year()) {
1243
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1243
+            $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1244 1244
             the_time('Y');
1245 1245
             $breadcrumb .= '</li>';
1246 1246
         } else if (is_author()) {
1247
-            $breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory');
1247
+            $breadcrumb .= "<li> ".$separator.__(" Author Archive", 'geodirectory');
1248 1248
             $breadcrumb .= '</li>';
1249 1249
         } else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1250
-            $breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory');
1250
+            $breadcrumb .= "<li>".$separator.__("Blog Archives", 'geodirectory');
1251 1251
             $breadcrumb .= '</li>';
1252 1252
         } else if (is_search()) {
1253
-            $breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory');
1253
+            $breadcrumb .= "<li> ".$separator.__(" Search Results", 'geodirectory');
1254 1254
             $breadcrumb .= '</li>';
1255 1255
         }
1256 1256
         $breadcrumb .= '</ul></div>';
@@ -1306,7 +1306,7 @@  discard block
 block discarded – undo
1306 1306
 function fetch_remote_file($url)
1307 1307
 {
1308 1308
     // extract the file name and extension from the url
1309
-    require_once(ABSPATH . 'wp-includes/pluggable.php');
1309
+    require_once(ABSPATH.'wp-includes/pluggable.php');
1310 1310
     $file_name = basename($url);
1311 1311
     if (strpos($file_name, '?') !== false) {
1312 1312
         list($file_name) = explode('?', $file_name);
@@ -1338,15 +1338,15 @@  discard block
 block discarded – undo
1338 1338
         return new WP_Error('upload_dir_error', $upload['error']);
1339 1339
 
1340 1340
 
1341
-    sleep(0.3);// if multiple remote file this can cause the remote server to timeout so we add a slight delay
1341
+    sleep(0.3); // if multiple remote file this can cause the remote server to timeout so we add a slight delay
1342 1342
 
1343 1343
     // fetch the remote url and write it to the placeholder file
1344
-    $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1344
+    $headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
1345 1345
 
1346 1346
     $log_message = '';
1347
-    if( is_wp_error( $headers  ) ) {
1347
+    if (is_wp_error($headers)) {
1348 1348
         echo 'file: '.$url;
1349
-        return new WP_Error('import_file_error',$headers->get_error_message());
1349
+        return new WP_Error('import_file_error', $headers->get_error_message());
1350 1350
     }
1351 1351
 
1352 1352
     $filesize = filesize($upload['file']);
@@ -1359,21 +1359,21 @@  discard block
 block discarded – undo
1359 1359
         $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1360 1360
     }
1361 1361
     elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1362
-        $log_message =  __('Remote file is incorrect size', 'geodirectory');
1362
+        $log_message = __('Remote file is incorrect size', 'geodirectory');
1363 1363
     }
1364 1364
     elseif (0 == $filesize) {
1365 1365
         $log_message = __('Zero size file downloaded', 'geodirectory');
1366 1366
     }
1367 1367
 
1368
-    if($log_message){
1368
+    if ($log_message) {
1369 1369
         $del = unlink($upload['file']);
1370
-        if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1371
-        return new WP_Error('import_file_error',$log_message );
1370
+        if (!$del) {geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory')); }
1371
+        return new WP_Error('import_file_error', $log_message);
1372 1372
     }
1373 1373
 
1374 1374
     if ($dummy && $add_to_cache && is_array($upload)) {
1375 1375
         $images = get_transient('cached_dummy_images');
1376
-        if(is_array($images))
1376
+        if (is_array($images))
1377 1377
             $images[$key] = $upload;
1378 1378
         else
1379 1379
             $images = array($key => $upload);
@@ -1394,12 +1394,12 @@  discard block
 block discarded – undo
1394 1394
  */
1395 1395
 function geodir_max_upload_size()
1396 1396
 {
1397
-    $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1397
+    $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1398 1398
 
1399 1399
     if ($max_filesize > 0 && $max_filesize < 1) {
1400
-        $max_filesize = (int)($max_filesize * 1024) . 'kb';
1400
+        $max_filesize = (int) ($max_filesize * 1024).'kb';
1401 1401
     } else {
1402
-        $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1402
+        $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1403 1403
     }
1404 1404
 
1405 1405
     /**
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
  */
1423 1423
 function geodir_dummy_folder_exists()
1424 1424
 {
1425
-    $path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1425
+    $path = geodir_plugin_path().'/geodirectory-admin/dummy/';
1426 1426
     if (!is_dir($path))
1427 1427
         return false;
1428 1428
     else
@@ -1466,35 +1466,35 @@  discard block
 block discarded – undo
1466 1466
     {
1467 1467
         global $wpdb;
1468 1468
         if ($message_type == 'expiration') {
1469
-            $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1470
-            $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1469
+            $subject = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
1470
+            $client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
1471 1471
         } elseif ($message_type == 'post_submited') {
1472
-            $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1473
-            $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1472
+            $subject = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
1473
+            $client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
1474 1474
         } elseif ($message_type == 'renew') {
1475
-            $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1476
-            $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1475
+            $subject = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
1476
+            $client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
1477 1477
         } elseif ($message_type == 'upgrade') {
1478
-            $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1479
-            $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1478
+            $subject = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
1479
+            $client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
1480 1480
         } elseif ($message_type == 'claim_approved') {
1481
-            $subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1482
-            $client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1481
+            $subject = __(get_option('claim_approved_email_subject'), 'geodirectory');
1482
+            $client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
1483 1483
         } elseif ($message_type == 'claim_rejected') {
1484
-            $subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1485
-            $client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1484
+            $subject = __(get_option('claim_rejected_email_subject'), 'geodirectory');
1485
+            $client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
1486 1486
         } elseif ($message_type == 'claim_requested') {
1487
-            $subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1488
-            $client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1487
+            $subject = __(get_option('claim_email_subject_admin'), 'geodirectory');
1488
+            $client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
1489 1489
         } elseif ($message_type == 'auto_claim') {
1490
-            $subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1491
-            $client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1490
+            $subject = __(get_option('auto_claim_email_subject'), 'geodirectory');
1491
+            $client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
1492 1492
         } elseif ($message_type == 'payment_success') {
1493
-            $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1494
-            $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1493
+            $subject = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
1494
+            $client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
1495 1495
         } elseif ($message_type == 'payment_fail') {
1496
-            $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1497
-            $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1496
+            $subject = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
1497
+            $client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
1498 1498
         }
1499 1499
         $transaction_details = $custom_1;
1500 1500
         $fromEmail = get_option('site_email');
@@ -1505,11 +1505,11 @@  discard block
 block discarded – undo
1505 1505
         $productlink = get_permalink($page_id);
1506 1506
         $post_info = get_post($page_id);
1507 1507
         $post_date = date('dS F,Y', strtotime($post_info->post_date));
1508
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1508
+        $listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
1509 1509
         $loginurl = geodir_login_url();
1510
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1510
+        $loginurl_link = '<a href="'.$loginurl.'">login</a>';
1511 1511
         $siteurl = home_url();
1512
-        $siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1512
+        $siteurl_link = '<a href="'.$siteurl.'">'.$fromEmailName.'</a>';
1513 1513
         $user_info = get_userdata($user_id);
1514 1514
         $user_email = $user_info->user_email;
1515 1515
         $display_name = geodir_get_client_name($user_id);
@@ -1523,14 +1523,14 @@  discard block
 block discarded – undo
1523 1523
         } else {
1524 1524
             $post_type = 'listing';
1525 1525
         }
1526
-        $renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1526
+        $renew_link = '<a href="'.$siteurl.'?ptype=post_'.$post_type.'&renew=1&pid='.$page_id.'">'.RENEW_LINK.'</a>';
1527 1527
         $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#]');
1528 1528
         $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);
1529 1529
         $client_message = str_replace($search_array, $replace_array, $client_message);
1530 1530
         $subject = str_replace($search_array, $replace_array, $subject);
1531
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1532
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1533
-        $headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1531
+        $headers = 'MIME-Version: 1.0'."\r\n";
1532
+        $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
1533
+        $headers .= 'From: '.$fromEmailName.' <'.$fromEmail.'>'."\r\n";
1534 1534
 
1535 1535
         $to = $fromEmail;
1536 1536
         $message = $client_message;
@@ -1547,7 +1547,7 @@  discard block
 block discarded – undo
1547 1547
          * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1548 1548
          * @param string $custom_1 Custom data to be sent.
1549 1549
          */
1550
-        $to = apply_filters('geodir_adminEmail_to',$to,$page_id, $user_id, $message_type, $custom_1 );
1550
+        $to = apply_filters('geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1);
1551 1551
         /**
1552 1552
          * Filter the admin email subject.
1553 1553
          *
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
          * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1560 1560
          * @param string $custom_1 Custom data to be sent.
1561 1561
          */
1562
-        $subject = apply_filters('geodir_adminEmail_subject',$subject,$page_id, $user_id, $message_type, $custom_1);
1562
+        $subject = apply_filters('geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1);
1563 1563
         /**
1564 1564
          * Filter the admin email message.
1565 1565
          *
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
          * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1572 1572
          * @param string $custom_1 Custom data to be sent.
1573 1573
          */
1574
-        $message = apply_filters('geodir_adminEmail_message',$message,$page_id, $user_id, $message_type, $custom_1);
1574
+        $message = apply_filters('geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1);
1575 1575
         /**
1576 1576
          * Filter the admin email headers.
1577 1577
          *
@@ -1583,23 +1583,23 @@  discard block
 block discarded – undo
1583 1583
          * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1584 1584
          * @param string $custom_1 Custom data to be sent.
1585 1585
          */
1586
-        $headers = apply_filters('geodir_adminEmail_headers',$headers,$page_id, $user_id, $message_type, $custom_1);
1586
+        $headers = apply_filters('geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1);
1587 1587
 
1588 1588
 
1589 1589
 
1590 1590
         $sent = wp_mail($to, $subject, $message, $headers);
1591
-        if( ! $sent ) {
1592
-            if ( is_array( $to ) ) {
1593
-                $to = implode( ',', $to );
1591
+        if (!$sent) {
1592
+            if (is_array($to)) {
1593
+                $to = implode(',', $to);
1594 1594
             }
1595 1595
             $log_message = sprintf(
1596
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1596
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1597 1597
                 $message_type,
1598
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1598
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
1599 1599
                 $to,
1600 1600
                 $subject
1601 1601
             );
1602
-            geodir_error_log( $log_message );
1602
+            geodir_error_log($log_message);
1603 1603
         }
1604 1604
     }
1605 1605
 }
@@ -1625,18 +1625,18 @@  discard block
 block discarded – undo
1625 1625
     {
1626 1626
         $login_details = '';
1627 1627
         if ($message_type == 'send_friend') {
1628
-            $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1629
-            $message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1628
+            $subject = stripslashes(__(get_option('email_friend_subject'), 'geodirectory'));
1629
+            $message = stripslashes(__(get_option('email_friend_content'), 'geodirectory'));
1630 1630
         } elseif ($message_type == 'send_enquiry') {
1631
-            $subject = __(get_option('email_enquiry_subject'),'geodirectory');
1632
-            $message = __(get_option('email_enquiry_content'),'geodirectory');
1631
+            $subject = __(get_option('email_enquiry_subject'), 'geodirectory');
1632
+            $message = __(get_option('email_enquiry_content'), 'geodirectory');
1633 1633
         } elseif ($message_type == 'forgot_password') {
1634
-            $subject = __(get_option('forgot_password_subject'),'geodirectory');
1635
-            $message = __(get_option('forgot_password_content'),'geodirectory');
1634
+            $subject = __(get_option('forgot_password_subject'), 'geodirectory');
1635
+            $message = __(get_option('forgot_password_content'), 'geodirectory');
1636 1636
             $login_details = $to_message;
1637 1637
         } elseif ($message_type == 'registration') {
1638
-            $subject = __(get_option('registration_success_email_subject'),'geodirectory');
1639
-            $message = __(get_option('registration_success_email_content'),'geodirectory');
1638
+            $subject = __(get_option('registration_success_email_subject'), 'geodirectory');
1639
+            $message = __(get_option('registration_success_email_content'), 'geodirectory');
1640 1640
             $login_details = $to_message;
1641 1641
         }
1642 1642
         $to_message = nl2br($to_message);
@@ -1644,11 +1644,11 @@  discard block
 block discarded – undo
1644 1644
         $sitefromEmailName = get_site_emailName();
1645 1645
         $productlink = get_permalink($post_id);
1646 1646
         $post_info = get_post($post_id);
1647
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1647
+        $listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
1648 1648
         $siteurl = home_url();
1649
-        $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1649
+        $siteurl_link = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
1650 1650
         $loginurl = geodir_login_url();
1651
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1651
+        $loginurl_link = '<a href="'.$loginurl.'">login</a>';
1652 1652
         if ($fromEmail == '') {
1653 1653
             $fromEmail = get_option('site_email');
1654 1654
         }
@@ -1662,26 +1662,26 @@  discard block
 block discarded – undo
1662 1662
         $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]');
1663 1663
         $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName);
1664 1664
         $subject = str_replace($search_array, $replace_array, $subject);
1665
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1666
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1667
-        $headers .= "Reply-To: " . $fromEmail . "\r\n";
1668
-        $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1665
+        $headers = 'MIME-Version: 1.0'."\r\n";
1666
+        $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
1667
+        $headers .= "Reply-To: ".$fromEmail."\r\n";
1668
+        $headers .= 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>'."\r\n";
1669 1669
 
1670 1670
         $to = $toEmail;
1671 1671
 
1672 1672
         $sent = wp_mail($to, $subject, $message, $headers);
1673
-        if( ! $sent ) {
1674
-            if ( is_array( $to ) ) {
1675
-                $to = implode( ',', $to );
1673
+        if (!$sent) {
1674
+            if (is_array($to)) {
1675
+                $to = implode(',', $to);
1676 1676
             }
1677 1677
             $log_message = sprintf(
1678
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1678
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1679 1679
                 $message_type,
1680
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1680
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
1681 1681
                 $to,
1682 1682
                 $subject
1683 1683
             );
1684
-            geodir_error_log( $log_message );
1684
+            geodir_error_log($log_message);
1685 1685
         }
1686 1686
 
1687 1687
         ///////// ADMIN BCC EMIALS
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
         if ($message_type == 'registration') {
1690 1690
             $message_raw = explode(__("Password:", 'geodirectory'), $message);
1691 1691
             $message_raw2 = explode("</p>", $message_raw[1], 2);
1692
-            $message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1];
1692
+            $message = $message_raw[0].__('Password:', 'geodirectory').' **********</p>'.$message_raw2[1];
1693 1693
         }
1694 1694
         $adminEmail = get_bloginfo('admin_email');
1695 1695
         $to = $adminEmail;
@@ -1707,20 +1707,20 @@  discard block
 block discarded – undo
1707 1707
             $admin_bcc = true;
1708 1708
         }
1709 1709
 
1710
-        if($admin_bcc === true){
1710
+        if ($admin_bcc === true) {
1711 1711
             $sent = wp_mail($to, $subject, $message, $headers);
1712
-            if( ! $sent ) {
1713
-                if ( is_array( $to ) ) {
1714
-                    $to = implode( ',', $to );
1712
+            if (!$sent) {
1713
+                if (is_array($to)) {
1714
+                    $to = implode(',', $to);
1715 1715
                 }
1716 1716
                 $log_message = sprintf(
1717
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1717
+                    __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1718 1718
                     $message_type,
1719
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1719
+                    date_i18n('F j Y H:i:s', current_time('timestamp')),
1720 1720
                     $to,
1721 1721
                     $subject
1722 1722
                 );
1723
-                geodir_error_log( $log_message );
1723
+                geodir_error_log($log_message);
1724 1724
             }
1725 1725
         }
1726 1726
 
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
 function geodir_custom_posts_body_class($classes) {
1769 1769
     global $wpdb, $wp;
1770 1770
     $post_types = geodir_get_posttypes('object');
1771
-    if (!empty($post_types) && count((array)$post_types) > 1) {
1771
+    if (!empty($post_types) && count((array) $post_types) > 1) {
1772 1772
         $classes[] = 'geodir_custom_posts';
1773 1773
     }
1774 1774
 
@@ -1828,7 +1828,7 @@  discard block
 block discarded – undo
1828 1828
     $geodir_option = get_option($geodir_option_name);
1829 1829
 
1830 1830
     if (!empty($geodir_option)) {
1831
-        add_option($geodir_option_name . '_' . $version_date, $geodir_option);
1831
+        add_option($geodir_option_name.'_'.$version_date, $geodir_option);
1832 1832
     }
1833 1833
 }
1834 1834
 
@@ -1934,36 +1934,36 @@  discard block
 block discarded – undo
1934 1934
 
1935 1935
     $query_args = $gd_query_args_widgets;
1936 1936
     if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1937
-        return $wpdb->posts . ".post_date DESC, ";
1937
+        return $wpdb->posts.".post_date DESC, ";
1938 1938
     }
1939 1939
 
1940 1940
     $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1941
-    $table = $plugin_prefix . $post_type . '_detail';
1941
+    $table = $plugin_prefix.$post_type.'_detail';
1942 1942
 
1943 1943
     $sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
1944 1944
 
1945 1945
     switch ($sort_by) {
1946 1946
         case 'latest':
1947 1947
         case 'newest':
1948
-            $orderby = $wpdb->posts . ".post_date DESC, ";
1948
+            $orderby = $wpdb->posts.".post_date DESC, ";
1949 1949
             break;
1950 1950
         case 'featured':
1951
-            $orderby = $table . ".is_featured ASC, ";
1951
+            $orderby = $table.".is_featured ASC, ";
1952 1952
             break;
1953 1953
         case 'az':
1954
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1954
+            $orderby = $wpdb->posts.".post_title ASC, ";
1955 1955
             break;
1956 1956
         case 'high_review':
1957
-            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
1957
+            $orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, ";
1958 1958
             break;
1959 1959
         case 'high_rating':
1960
-            $orderby = "( " . $table . ".overall_rating  ) DESC, ";
1960
+            $orderby = "( ".$table.".overall_rating  ) DESC, ";
1961 1961
             break;
1962 1962
         case 'random':
1963 1963
             $orderby = "RAND(), ";
1964 1964
             break;
1965 1965
         default:
1966
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1966
+            $orderby = $wpdb->posts.".post_title ASC, ";
1967 1967
             break;
1968 1968
     }
1969 1969
 
@@ -1990,9 +1990,9 @@  discard block
 block discarded – undo
1990 1990
     $gd_query_args_widgets = $query_args;
1991 1991
 
1992 1992
     $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1993
-    $table = $plugin_prefix . $post_type . '_detail';
1993
+    $table = $plugin_prefix.$post_type.'_detail';
1994 1994
 
1995
-    $fields = $wpdb->posts . ".*, " . $table . ".*";
1995
+    $fields = $wpdb->posts.".*, ".$table.".*";
1996 1996
     /**
1997 1997
      * Filter widget listing fields string part that is being used for query.
1998 1998
      *
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
      */
2004 2004
     $fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
2005 2005
 
2006
-    $join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
2006
+    $join = "INNER JOIN ".$table." ON (".$table.".post_id = ".$wpdb->posts.".ID)";
2007 2007
 
2008 2008
     ########### WPML ###########
2009 2009
 
@@ -2011,7 +2011,7 @@  discard block
 block discarded – undo
2011 2011
         global $sitepress;
2012 2012
         $lang_code = ICL_LANGUAGE_CODE;
2013 2013
         if ($lang_code) {
2014
-            $join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
2014
+            $join .= " JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID";
2015 2015
         }
2016 2016
     }
2017 2017
 
@@ -2026,9 +2026,9 @@  discard block
 block discarded – undo
2026 2026
      */
2027 2027
     $join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
2028 2028
 
2029
-    $post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
2029
+    $post_status = is_super_admin() ? " OR ".$wpdb->posts.".post_status = 'private'" : '';
2030 2030
 
2031
-    $where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
2031
+    $where = " AND ( ".$wpdb->posts.".post_status = 'publish' ".$post_status." ) AND ".$wpdb->posts.".post_type = '".$post_type."'";
2032 2032
 
2033 2033
     ########### WPML ###########
2034 2034
     if (function_exists('icl_object_id')) {
@@ -2045,7 +2045,7 @@  discard block
 block discarded – undo
2045 2045
      * @param string $post_type Post type.
2046 2046
      */
2047 2047
     $where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2048
-    $where = $where != '' ? " WHERE 1=1 " . $where : '';
2048
+    $where = $where != '' ? " WHERE 1=1 ".$where : '';
2049 2049
 
2050 2050
     $groupby = " GROUP BY $wpdb->posts.ID ";
2051 2051
     /**
@@ -2058,10 +2058,10 @@  discard block
 block discarded – undo
2058 2058
     $groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
2059 2059
 
2060 2060
     if ($count_only) {
2061
-        $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
2062
-			" . $join . "
2061
+        $sql = "SELECT COUNT(".$wpdb->posts.".ID) AS total FROM ".$wpdb->posts."
2062
+			" . $join."
2063 2063
 			" . $where;
2064
-        $rows = (int)$wpdb->get_var($sql);
2064
+        $rows = (int) $wpdb->get_var($sql);
2065 2065
     } else {
2066 2066
         $orderby = geodir_widget_listings_get_order($query_args);
2067 2067
         /**
@@ -2073,8 +2073,8 @@  discard block
 block discarded – undo
2073 2073
          * @param string $post_type Post type.
2074 2074
          */
2075 2075
         $orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2076
-        $orderby .= $wpdb->posts . ".post_title ASC";
2077
-        $orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2076
+        $orderby .= $wpdb->posts.".post_title ASC";
2077
+        $orderby = $orderby != '' ? " ORDER BY ".$orderby : '';
2078 2078
 
2079 2079
         $limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2080 2080
         /**
@@ -2087,16 +2087,16 @@  discard block
 block discarded – undo
2087 2087
         $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2088 2088
 
2089 2089
         $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2090
-        if ( !$page )
2090
+        if (!$page)
2091 2091
             $page = 1;
2092 2092
 
2093
-        $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
2093
+        $limit = (int) $limit > 0 ? " LIMIT ".absint(($page - 1) * (int) $limit).", ".(int) $limit : "";
2094 2094
 
2095
-        $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
2096
-			" . $join . "
2097
-			" . $where . "
2098
-			" . $groupby . "
2099
-			" . $orderby . "
2095
+        $sql = "SELECT SQL_CALC_FOUND_ROWS ".$fields." FROM ".$wpdb->posts."
2096
+			" . $join."
2097
+			" . $where."
2098
+			" . $groupby."
2099
+			" . $orderby."
2100 2100
 			" . $limit;
2101 2101
         $rows = $wpdb->get_results($sql);
2102 2102
     }
@@ -2149,10 +2149,10 @@  discard block
 block discarded – undo
2149 2149
     }
2150 2150
 
2151 2151
     $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2152
-    $table = $plugin_prefix . $post_type . '_detail';
2152
+    $table = $plugin_prefix.$post_type.'_detail';
2153 2153
 
2154 2154
     if (!empty($query_args['with_pics_only'])) {
2155
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2155
+        $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
2156 2156
     }
2157 2157
 
2158 2158
     if (!empty($query_args['tax_query'])) {
@@ -2184,7 +2184,7 @@  discard block
 block discarded – undo
2184 2184
         return $where;
2185 2185
     }
2186 2186
     $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2187
-    $table = $plugin_prefix . $post_type . '_detail';
2187
+    $table = $plugin_prefix.$post_type.'_detail';
2188 2188
 
2189 2189
     if (!empty($query_args)) {
2190 2190
         if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
@@ -2192,27 +2192,27 @@  discard block
 block discarded – undo
2192 2192
         }
2193 2193
 
2194 2194
         if (!empty($query_args['post_author'])) {
2195
-            $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2195
+            $where .= " AND ".$wpdb->posts.".post_author = ".(int) $query_args['post_author'];
2196 2196
         }
2197 2197
         
2198 2198
         if (!empty($query_args['show_featured_only'])) {
2199
-            $where .= " AND " . $table . ".is_featured = '1'";
2199
+            $where .= " AND ".$table.".is_featured = '1'";
2200 2200
         }
2201 2201
 
2202 2202
         if (!empty($query_args['show_special_only'])) {
2203
-            $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2203
+            $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
2204 2204
         }
2205 2205
 
2206 2206
         if (!empty($query_args['with_pics_only'])) {
2207
-            $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2207
+            $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL ";
2208 2208
         }
2209 2209
 
2210 2210
         if (!empty($query_args['featured_image_only'])) {
2211
-            $where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2211
+            $where .= " AND ".$table.".featured_image IS NOT NULL AND ".$table.".featured_image!='' ";
2212 2212
         }
2213 2213
 
2214 2214
         if (!empty($query_args['with_videos_only'])) {
2215
-            $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2215
+            $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
2216 2216
         }
2217 2217
 
2218 2218
         if (!empty($query_args['tax_query'])) {
@@ -2269,7 +2269,7 @@  discard block
 block discarded – undo
2269 2269
     }
2270 2270
 
2271 2271
     if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2272
-        $limit = (int)$query_args['posts_per_page'];
2272
+        $limit = (int) $query_args['posts_per_page'];
2273 2273
     }
2274 2274
 
2275 2275
     return $limit;
@@ -2412,9 +2412,9 @@  discard block
 block discarded – undo
2412 2412
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2413 2413
     }
2414 2414
     $home_url = str_replace("www.", "", $home_url);
2415
-    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')) ) {
2415
+    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'))) {
2416 2416
         return true;
2417
-    }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')){
2417
+    }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')) {
2418 2418
         return true;
2419 2419
     } else {
2420 2420
         return false;
@@ -2497,19 +2497,19 @@  discard block
 block discarded – undo
2497 2497
 
2498 2498
     $gd_post_type = geodir_get_current_posttype();
2499 2499
 
2500
-    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2501
-    if(!empty($gd_post_type)){
2500
+    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2501
+    if (!empty($gd_post_type)) {
2502 2502
         $default_post_type = $gd_post_type;
2503
-    }elseif(isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ){
2503
+    }elseif (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type'])) {
2504 2504
         $default_post_type = $instance['default_post_type'];
2505
-    }else{
2505
+    } else {
2506 2506
         $all_gd_post_type = geodir_get_posttypes();
2507 2507
         $default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2508 2508
     }
2509 2509
 
2510 2510
     $taxonomy = array();
2511 2511
     if (!empty($gd_post_type)) {
2512
-        $taxonomy[] = $gd_post_type . "category";
2512
+        $taxonomy[] = $gd_post_type."category";
2513 2513
     } else {
2514 2514
         $taxonomy = geodir_get_taxonomies($gd_post_type);
2515 2515
     }
@@ -2529,7 +2529,7 @@  discard block
 block discarded – undo
2529 2529
             $b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2530 2530
         }
2531 2531
 
2532
-        $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : '';
2532
+        $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type.'category']) ? $default_post_type.'category' : '';
2533 2533
 
2534 2534
         $tax_change_output = '';
2535 2535
         if (count($b_terms) > 1) {
@@ -2537,20 +2537,20 @@  discard block
 block discarded – undo
2537 2537
             foreach ($b_terms as $key => $val) {
2538 2538
                 $ptype = get_post_type_object(str_replace("category", "", $key));
2539 2539
                 $cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2540
-                $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2540
+                $tax_change_output .= "<option value='$key' ".selected($key, $default_taxonomy, false).">".sprintf(__('%s Categories', 'geodirectory'), $cpt_name)."</option>";
2541 2541
             }
2542 2542
             $tax_change_output .= "</select>";
2543 2543
         }
2544 2544
 
2545 2545
         if (!empty($b_terms)) {
2546
-            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2547
-            global $cat_count;//make global so we can change via function
2546
+            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array
2547
+            global $cat_count; //make global so we can change via function
2548 2548
             $cat_count = 0;
2549 2549
             ?>
2550 2550
             <div class="geodir-category-list-in clearfix">
2551 2551
                 <div class="geodir-cat-list clearfix">
2552 2552
                     <?php
2553
-                    echo $before_title . __($title) . $after_title;
2553
+                    echo $before_title.__($title).$after_title;
2554 2554
 
2555 2555
                     echo $tax_change_output;
2556 2556
 
@@ -2567,8 +2567,8 @@  discard block
 block discarded – undo
2567 2567
                     $hide = 'style="display:none;"';
2568 2568
                 }
2569 2569
                 echo "<div class='geodir-cat-list-more' $hide >";
2570
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>';
2571
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>';
2570
+                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">'.__('More Categories', 'geodirectory').'</a>';
2571
+                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">'.__('Less Categories', 'geodirectory').'</a>';
2572 2572
                 echo "</div>";
2573 2573
                 /* add scripts */
2574 2574
                 add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
@@ -2608,7 +2608,7 @@  discard block
 block discarded – undo
2608 2608
         $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2609 2609
         $total_post = $cat->count;
2610 2610
 
2611
-        $term_link = get_term_link( $cat, $cat->taxonomy );
2611
+        $term_link = get_term_link($cat, $cat->taxonomy);
2612 2612
         /**
2613 2613
          * Filer the category term link.
2614 2614
          *
@@ -2617,10 +2617,10 @@  discard block
 block discarded – undo
2617 2617
          * @param int    $cat->term_id The term id.
2618 2618
          * @param string $post_type Wordpress post type.
2619 2619
          */
2620
-        $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2620
+        $term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
2621 2621
 
2622
-        echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2623
-        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> ';
2622
+        echo '<li class="'.$class_row.'"><a href="'.$term_link.'">';
2623
+        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> ';
2624 2624
         echo '</a></li>';
2625 2625
     }
2626 2626
 }
@@ -2751,29 +2751,29 @@  discard block
 block discarded – undo
2751 2751
                 itemWidth: 75,
2752 2752
                 itemMargin: 5,
2753 2753
                 asNavFor: '#geodir_widget_slider',
2754
-                rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
2754
+                rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
2755 2755
             });
2756 2756
 
2757 2757
             jQuery('#geodir_widget_slider').flexslider({
2758
-                animation: "<?php echo $animation;?>",
2758
+                animation: "<?php echo $animation; ?>",
2759 2759
                 selector: ".geodir-slides > li",
2760 2760
                 namespace: "geodir-",
2761 2761
                 controlNav: true,
2762
-                animationLoop: <?php echo $animationLoop;?>,
2763
-                slideshow: <?php echo $slideshow;?>,
2764
-                slideshowSpeed: <?php echo $slideshowSpeed;?>,
2765
-                animationSpeed: <?php echo $animationSpeed;?>,
2766
-                directionNav: <?php echo $directionNav;?>,
2767
-                maxItems: <?php echo $max_show;?>,
2762
+                animationLoop: <?php echo $animationLoop; ?>,
2763
+                slideshow: <?php echo $slideshow; ?>,
2764
+                slideshowSpeed: <?php echo $slideshowSpeed; ?>,
2765
+                animationSpeed: <?php echo $animationSpeed; ?>,
2766
+                directionNav: <?php echo $directionNav; ?>,
2767
+                maxItems: <?php echo $max_show; ?>,
2768 2768
                 move: 1,
2769
-                <?php if($slide_width){ echo "itemWidth: ".$slide_width.",";}?>
2769
+                <?php if ($slide_width) { echo "itemWidth: ".$slide_width.","; }?>
2770 2770
                 sync: "#geodir_widget_carousel",
2771 2771
                 start: function (slider) {
2772 2772
                     jQuery('.geodir-listing-flex-loader').hide();
2773 2773
                     jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
2774 2774
                     jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
2775 2775
                 },
2776
-                rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
2776
+                rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
2777 2777
             });
2778 2778
         });
2779 2779
     </script>
@@ -2809,12 +2809,12 @@  discard block
 block discarded – undo
2809 2809
     $widget_listings = geodir_get_widget_listings($query_args);
2810 2810
     if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
2811 2811
         if ($title) {
2812
-            echo $before_title . $title . $after_title;
2812
+            echo $before_title.$title.$after_title;
2813 2813
         }
2814 2814
 
2815 2815
         global $post;
2816 2816
 
2817
-        $current_post = $post;// keep current post info
2817
+        $current_post = $post; // keep current post info
2818 2818
 
2819 2819
         $widget_main_slides = '';
2820 2820
         $nav_slides = '';
@@ -2832,11 +2832,11 @@  discard block
 block discarded – undo
2832 2832
                     $widget_spacer_height = ((200 - $widget_image->height) / 2);
2833 2833
                 }
2834 2834
 
2835
-                $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" />';
2835
+                $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" />';
2836 2836
 
2837 2837
                 $title = '';
2838 2838
                 if ($show_title) {
2839
-                    $title_html = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>';
2839
+                    $title_html = '<div class="geodir-slider-title"><a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a></div>';
2840 2840
                     $post_id = $post->ID;
2841 2841
                     $post_permalink = get_permalink($post->ID);
2842 2842
                     $post_title = get_the_title($post->ID);
@@ -2849,11 +2849,11 @@  discard block
 block discarded – undo
2849 2849
                      * @param string $post_permalink The post permalink url.
2850 2850
                      * @param string $post_title The post title text.
2851 2851
                      */
2852
-                    $title = apply_filters('geodir_listing_slider_title',$title_html,$post_id,$post_permalink,$post_title);
2852
+                    $title = apply_filters('geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title);
2853 2853
                 }
2854 2854
 
2855
-                $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>';
2856
-                $nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
2855
+                $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>';
2856
+                $nav_slides .= '<li><img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
2857 2857
                 $widget_slides++;
2858 2858
             }
2859 2859
         }
@@ -2897,7 +2897,7 @@  discard block
 block discarded – undo
2897 2897
     $title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2898 2898
 
2899 2899
     echo $before_widget;
2900
-    echo $before_title . $title . $after_title;
2900
+    echo $before_title.$title.$after_title;
2901 2901
 
2902 2902
     if (is_user_logged_in()) {
2903 2903
         global $current_user;
@@ -2939,7 +2939,7 @@  discard block
 block discarded – undo
2939 2939
                          */
2940 2940
                         $add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
2941 2941
 
2942
-                        $addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2942
+                        $addlisting_links .= '<option '.$selected.' value="'.$add_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
2943 2943
 
2944 2944
                     }
2945 2945
                 }
@@ -2985,7 +2985,7 @@  discard block
 block discarded – undo
2985 2985
                      */
2986 2986
                     $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
2987 2987
 
2988
-                    $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2988
+                    $favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
2989 2989
                 }
2990 2990
             }
2991 2991
 
@@ -3030,7 +3030,7 @@  discard block
 block discarded – undo
3030 3030
                      */
3031 3031
                     $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
3032 3032
 
3033
-                    $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
3033
+                    $listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3034 3034
                 }
3035 3035
             }
3036 3036
 
@@ -3213,7 +3213,7 @@  discard block
 block discarded – undo
3213 3213
     }
3214 3214
 
3215 3215
     if (empty($title) || $title == 'All') {
3216
-        $title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory');
3216
+        $title .= ' '.__(get_post_type_plural_label($post_type), 'geodirectory');
3217 3217
     }
3218 3218
 
3219 3219
     $location_url = array();
@@ -3267,7 +3267,7 @@  discard block
 block discarded – undo
3267 3267
             $geodir_add_location_url = '1';
3268 3268
         }
3269 3269
 
3270
-        $viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3270
+        $viewall_url = get_term_link((int) $category[0], $post_type.'category');
3271 3271
 
3272 3272
         $geodir_add_location_url = NULL;
3273 3273
     }
@@ -3275,7 +3275,7 @@  discard block
 block discarded – undo
3275 3275
         $gd_session->set('gd_multi_location', 1);
3276 3276
     }
3277 3277
 
3278
-    if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3278
+    if (is_wp_error($viewall_url)) {$viewall_url = ''; }
3279 3279
 
3280 3280
     $query_args = array(
3281 3281
         'posts_per_page' => $post_number,
@@ -3341,7 +3341,7 @@  discard block
 block discarded – undo
3341 3341
              */
3342 3342
             do_action('geodir_before_view_all_link_in_widget'); ?>
3343 3343
             <div class="geodir_list_heading clearfix">
3344
-                <?php echo $before_title . $title . $after_title; ?>
3344
+                <?php echo $before_title.$title.$after_title; ?>
3345 3345
                 <a href="<?php echo $viewall_url; ?>"
3346 3346
                    class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3347 3347
             </div>
@@ -3427,9 +3427,9 @@  discard block
 block discarded – undo
3427 3427
 {
3428 3428
     global $wpdb, $plugin_prefix;
3429 3429
 
3430
-    $detail_table = $plugin_prefix . $post_type . '_detail';
3430
+    $detail_table = $plugin_prefix.$post_type.'_detail';
3431 3431
 
3432
-    $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 . ")";
3432
+    $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.")";
3433 3433
 
3434 3434
     /**
3435 3435
      * Filter count review sql query.
@@ -3468,7 +3468,7 @@  discard block
 block discarded – undo
3468 3468
      * @param bool $force_update Force update option value?. Default.false.
3469 3469
      * @param int $post_ID The post id to update if any.
3470 3470
      */
3471
-    $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update,$post_ID);
3471
+    $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update, $post_ID);
3472 3472
     if (!empty($option_data)) {
3473 3473
         return $option_data;
3474 3474
     }
@@ -3476,11 +3476,11 @@  discard block
 block discarded – undo
3476 3476
     $option_data = get_option('geodir_global_review_count');
3477 3477
 
3478 3478
     if (!$option_data || $force_update) {
3479
-        if ((int)$post_ID > 0) { // Update reviews count for specific post categories only.
3479
+        if ((int) $post_ID > 0) { // Update reviews count for specific post categories only.
3480 3480
             global $gd_session;
3481
-            $term_array = (array)$option_data;
3481
+            $term_array = (array) $option_data;
3482 3482
             $post_type = get_post_type($post_ID);
3483
-            $taxonomy = $post_type . 'category';
3483
+            $taxonomy = $post_type.'category';
3484 3484
             $terms = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3485 3485
 
3486 3486
             if (!empty($terms) && !is_wp_error($terms)) {
@@ -3495,9 +3495,9 @@  discard block
 block discarded – undo
3495 3495
             
3496 3496
             $terms = array();
3497 3497
             if (isset($_POST['post_category'][$taxonomy])) {
3498
-                $terms = (array)$_POST['post_category'][$taxonomy];
3498
+                $terms = (array) $_POST['post_category'][$taxonomy];
3499 3499
             } else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
3500
-                $terms = (array)$session_listing['post_category'][$taxonomy];
3500
+                $terms = (array) $session_listing['post_category'][$taxonomy];
3501 3501
             }
3502 3502
             
3503 3503
             if (!empty($terms)) {
@@ -3585,7 +3585,7 @@  discard block
 block discarded – undo
3585 3585
     return true;
3586 3586
 }
3587 3587
 
3588
-function geodir_term_review_count_force_update_single_post($post_id){
3588
+function geodir_term_review_count_force_update_single_post($post_id) {
3589 3589
     geodir_count_reviews_by_terms(true, $post_id); 
3590 3590
 }
3591 3591
 
@@ -3722,17 +3722,17 @@  discard block
 block discarded – undo
3722 3722
      */
3723 3723
     $locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
3724 3724
 
3725
-    load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo');
3726
-    load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages');
3725
+    load_textdomain('geodirectory', WP_LANG_DIR.'/'.'geodirectory'.'/'.'geodirectory'.'-'.$locale.'.mo');
3726
+    load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))).'/geodirectory-languages');
3727 3727
 
3728 3728
     /**
3729 3729
      * Define language constants.
3730 3730
      *
3731 3731
      * @since 1.0.0
3732 3732
      */
3733
-    require_once(geodir_plugin_path() . '/language.php');
3733
+    require_once(geodir_plugin_path().'/language.php');
3734 3734
 
3735
-    $language_file = geodir_plugin_path() . '/db-language.php';
3735
+    $language_file = geodir_plugin_path().'/db-language.php';
3736 3736
 
3737 3737
     // Load language string file if not created yet
3738 3738
     if (!file_exists($language_file)) {
@@ -3747,8 +3747,8 @@  discard block
 block discarded – undo
3747 3747
          */
3748 3748
         try {
3749 3749
             require_once($language_file);
3750
-        } catch(Exception $e) {
3751
-            error_log('Language Error: ' . $e->getMessage());
3750
+        } catch (Exception $e) {
3751
+            error_log('Language Error: '.$e->getMessage());
3752 3752
         }
3753 3753
     }
3754 3754
 }
@@ -3765,18 +3765,18 @@  discard block
 block discarded – undo
3765 3765
  */
3766 3766
 function geodirectory_load_db_language() {
3767 3767
     global $wp_filesystem;
3768
-    if( empty( $wp_filesystem ) ) {
3769
-        require_once( ABSPATH .'/wp-admin/includes/file.php' );
3768
+    if (empty($wp_filesystem)) {
3769
+        require_once(ABSPATH.'/wp-admin/includes/file.php');
3770 3770
         WP_Filesystem();
3771 3771
         global $wp_filesystem;
3772 3772
     }
3773 3773
 
3774
-    $language_file = geodir_plugin_path() . '/db-language.php';
3774
+    $language_file = geodir_plugin_path().'/db-language.php';
3775 3775
 
3776
-    if(is_file($language_file) && !is_writable($language_file))
3776
+    if (is_file($language_file) && !is_writable($language_file))
3777 3777
         return false; // Not possible to create.
3778 3778
 
3779
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3779
+    if (!is_file($language_file) && !is_writable(dirname($language_file)))
3780 3780
         return false; // Not possible to create.
3781 3781
 
3782 3782
     $contents_strings = array();
@@ -3810,17 +3810,17 @@  discard block
 block discarded – undo
3810 3810
     $contents = implode(PHP_EOL, $contents_head);
3811 3811
 
3812 3812
     if (!empty($contents_strings)) {
3813
-        foreach ( $contents_strings as $string ) {
3813
+        foreach ($contents_strings as $string) {
3814 3814
             if (is_scalar($string) && $string != '') {
3815 3815
                 $string = str_replace("'", "\'", $string);
3816
-                $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
3816
+                $contents .= PHP_EOL."__('".$string."', 'geodirectory');";
3817 3817
             }
3818 3818
         }
3819 3819
     }
3820 3820
 
3821 3821
     $contents .= implode(PHP_EOL, $contents_foot);
3822 3822
 
3823
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3823
+    if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE))
3824 3824
         return false; // Failure; could not write file.
3825 3825
 
3826 3826
     return true;
@@ -3842,11 +3842,11 @@  discard block
 block discarded – undo
3842 3842
     global $wpdb;
3843 3843
 
3844 3844
     // Custom fields table
3845
-    $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
3845
+    $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM ".GEODIR_CUSTOM_FIELDS_TABLE;
3846 3846
     $rows = $wpdb->get_results($sql);
3847 3847
 
3848 3848
     if (!empty($rows)) {
3849
-        foreach($rows as $row) {
3849
+        foreach ($rows as $row) {
3850 3850
             if (!empty($row->admin_title))
3851 3851
                 $translation_texts[] = stripslashes_deep($row->admin_title);
3852 3852
 			
@@ -3880,11 +3880,11 @@  discard block
 block discarded – undo
3880 3880
     }
3881 3881
 	
3882 3882
     // Custom sorting fields table
3883
-    $sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3883
+    $sql = "SELECT site_title, asc_title, desc_title FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3884 3884
     $rows = $wpdb->get_results($sql);
3885 3885
 
3886 3886
     if (!empty($rows)) {
3887
-        foreach($rows as $row) {
3887
+        foreach ($rows as $row) {
3888 3888
             if (!empty($row->site_title))
3889 3889
                 $translation_texts[] = stripslashes_deep($row->site_title);
3890 3890
 
@@ -3898,11 +3898,11 @@  discard block
 block discarded – undo
3898 3898
 	
3899 3899
 	// Advance search filter fields table
3900 3900
 	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
3901
-		$sql = "SELECT field_site_name, front_search_title, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE;
3901
+		$sql = "SELECT field_site_name, front_search_title, field_desc FROM ".GEODIR_ADVANCE_SEARCH_TABLE;
3902 3902
 		$rows = $wpdb->get_results($sql);
3903 3903
 
3904 3904
 		if (!empty($rows)) {
3905
-			foreach($rows as $row) {
3905
+			foreach ($rows as $row) {
3906 3906
 				if (!empty($row->field_site_name))
3907 3907
 					$translation_texts[] = stripslashes_deep($row->field_site_name);
3908 3908
 
@@ -3937,7 +3937,7 @@  discard block
 block discarded – undo
3937 3937
      *
3938 3938
      * @param array $geodir_allowed_mime_types and file extensions.
3939 3939
      */
3940
-    return apply_filters( 'geodir_allowed_mime_types', array(
3940
+    return apply_filters('geodir_allowed_mime_types', array(
3941 3941
             'Image' => array( // Image formats.
3942 3942
                 'jpg' => 'image/jpeg',
3943 3943
                 'jpe' => 'image/jpeg',
@@ -4026,13 +4026,13 @@  discard block
 block discarded – undo
4026 4026
 
4027 4027
 
4028 4028
 
4029
-add_filter('wpseo_replacements','geodir_wpseo_replacements',10,1);
4029
+add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
4030 4030
 /*
4031 4031
  * Add location variables to wpseo replacements.
4032 4032
  *
4033 4033
  * @since 1.5.4
4034 4034
  */
4035
-function geodir_wpseo_replacements($vars){
4035
+function geodir_wpseo_replacements($vars) {
4036 4036
 
4037 4037
     global $wp;
4038 4038
     $title = '';
@@ -4047,12 +4047,12 @@  discard block
 block discarded – undo
4047 4047
      * @param array $location_array The array of location variables.
4048 4048
      * @param array $vars The page title variables.
4049 4049
      */
4050
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
4050
+    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
4051 4051
     $location_titles = array();
4052
-    if(get_query_var( 'gd_country_full' )){
4053
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4054
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4055
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4052
+    if (get_query_var('gd_country_full')) {
4053
+        if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
4054
+        if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
4055
+        if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
4056 4056
     }
4057 4057
     $location_single = '';
4058 4058
     $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
@@ -4124,23 +4124,23 @@  discard block
 block discarded – undo
4124 4124
     }
4125 4125
 
4126 4126
 
4127
-    if(!empty($location_titles)) {
4127
+    if (!empty($location_titles)) {
4128 4128
         $vars['%%location%%'] = implode(", ", $location_titles);
4129 4129
     }
4130 4130
 
4131 4131
 
4132
-    if(!empty($location_titles)) {
4133
-        $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
4132
+    if (!empty($location_titles)) {
4133
+        $vars['%%in_location%%'] = __('in ', 'geodirectory').implode(", ", $location_titles);
4134 4134
     }
4135 4135
 
4136 4136
 
4137 4137
 
4138
-    if($location_single) {
4139
-        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
4138
+    if ($location_single) {
4139
+        $vars['%%in_location_single%%'] = __('in', 'geodirectory').' '.$location_single;
4140 4140
     }
4141 4141
 
4142 4142
 
4143
-    if($location_single) {
4143
+    if ($location_single) {
4144 4144
         $vars['%%location_single%%'] = $location_single;
4145 4145
     }
4146 4146
 
@@ -4152,17 +4152,17 @@  discard block
 block discarded – undo
4152 4152
      * @param string $vars The title with variables.
4153 4153
      * @param array $location_array The array of location variables.
4154 4154
      */
4155
-    return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
4155
+    return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
4156 4156
 }
4157 4157
 
4158 4158
 
4159
-add_filter('geodir_seo_meta_title','geodir_filter_title_variables',10,3);
4160
-add_filter('geodir_seo_page_title','geodir_filter_title_variables',10,2);
4161
-add_filter('geodir_seo_meta_description_pre','geodir_filter_title_variables',10,3);
4162
-function geodir_filter_title_variables($title, $gd_page, $sep=''){
4159
+add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
4160
+add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
4161
+add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
4162
+function geodir_filter_title_variables($title, $gd_page, $sep = '') {
4163 4163
 
4164 4164
 
4165
-    if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
4165
+    if (!$gd_page || !$title) {return $title; }// if no a GD page then bail.
4166 4166
     global $post;
4167 4167
     //print_r($post);
4168 4168
     /*
@@ -4204,123 +4204,123 @@  discard block
 block discarded – undo
4204 4204
     }
4205 4205
 
4206 4206
 
4207
-    if(strpos($title,'%%title%%') !== false){
4208
-        $title = str_replace("%%title%%",$post->post_title,$title);
4207
+    if (strpos($title, '%%title%%') !== false) {
4208
+        $title = str_replace("%%title%%", $post->post_title, $title);
4209 4209
     }
4210 4210
 
4211
-    if(strpos($title,'%%sitename%%') !== false){
4212
-        $title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
4211
+    if (strpos($title, '%%sitename%%') !== false) {
4212
+        $title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
4213 4213
     }
4214 4214
 
4215
-    if(strpos($title,'%%sitedesc%%') !== false){
4216
-        $title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
4215
+    if (strpos($title, '%%sitedesc%%') !== false) {
4216
+        $title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
4217 4217
     }
4218 4218
 
4219
-    if(strpos($title,'%%excerpt%%') !== false){
4220
-        $title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
4219
+    if (strpos($title, '%%excerpt%%') !== false) {
4220
+        $title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
4221 4221
     }
4222 4222
 
4223
-    if(strpos($title,'%%pt_single%%') !== false){
4223
+    if (strpos($title, '%%pt_single%%') !== false) {
4224 4224
         $single_name = '';
4225
-        if($gd_page=='search' || $gd_page=='author'){
4225
+        if ($gd_page == 'search' || $gd_page == 'author') {
4226 4226
             $geodir_post_types = get_option('geodir_post_types');
4227 4227
             $spt = esc_attr($_REQUEST['stype']);
4228
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4229
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4228
+            if (isset($geodir_post_types[$spt]['labels']['singular_name'])) {
4229
+                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'], 'geodirectory');
4230 4230
             }
4231
-        }elseif($gd_page=='add-listing'){
4231
+        }elseif ($gd_page == 'add-listing') {
4232 4232
             $geodir_post_types = get_option('geodir_post_types');
4233 4233
             $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
4234
-            if(!$spt && isset($_REQUEST['pid'])){
4235
-                $spt = get_post_type( $_REQUEST['pid'] );
4234
+            if (!$spt && isset($_REQUEST['pid'])) {
4235
+                $spt = get_post_type($_REQUEST['pid']);
4236 4236
             }
4237
-            if(!$spt){$spt='gd_place';}
4238
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4239
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4237
+            if (!$spt) {$spt = 'gd_place'; }
4238
+            if (isset($geodir_post_types[$spt]['labels']['singular_name'])) {
4239
+                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'], 'geodirectory');
4240 4240
             }
4241 4241
         }
4242
-        elseif($post->post_type){
4242
+        elseif ($post->post_type) {
4243 4243
             $geodir_post_types = get_option('geodir_post_types');
4244
-            if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4245
-                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
4244
+            if (isset($geodir_post_types[$post->post_type]['labels']['singular_name'])) {
4245
+                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'], 'geodirectory');
4246 4246
             }
4247 4247
 
4248 4248
 
4249 4249
         }
4250
-        $title = str_replace("%%pt_single%%",$single_name,$title);
4250
+        $title = str_replace("%%pt_single%%", $single_name, $title);
4251 4251
     }
4252 4252
 
4253
-    if(strpos($title,'%%pt_plural%%') !== false){
4253
+    if (strpos($title, '%%pt_plural%%') !== false) {
4254 4254
         $plural_name = '';
4255
-        if($gd_page=='search' || $gd_page=='author'){
4255
+        if ($gd_page == 'search' || $gd_page == 'author') {
4256 4256
             $geodir_post_types = get_option('geodir_post_types');
4257 4257
             $spt = esc_attr($_REQUEST['stype']);
4258
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4259
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4258
+            if (isset($geodir_post_types[$spt]['labels']['name'])) {
4259
+                $plural_name = __($geodir_post_types[$spt]['labels']['name'], 'geodirectory');
4260 4260
             }
4261
-        }elseif($gd_page=='add-listing'){
4261
+        }elseif ($gd_page == 'add-listing') {
4262 4262
             $geodir_post_types = get_option('geodir_post_types');
4263 4263
             $spt = sanitize_text_field($_REQUEST['listing_type']);
4264
-            if(!$spt){$spt='gd_place';}
4265
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4266
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4264
+            if (!$spt) {$spt = 'gd_place'; }
4265
+            if (isset($geodir_post_types[$spt]['labels']['name'])) {
4266
+                $plural_name = __($geodir_post_types[$spt]['labels']['name'], 'geodirectory');
4267 4267
             }
4268 4268
         }
4269
-        elseif(isset($post->post_type) && $post->post_type){
4269
+        elseif (isset($post->post_type) && $post->post_type) {
4270 4270
             $geodir_post_types = get_option('geodir_post_types');
4271
-            if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4272
-                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
4271
+            if (isset($geodir_post_types[$post->post_type]['labels']['name'])) {
4272
+                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'], 'geodirectory');
4273 4273
             }
4274 4274
 
4275 4275
         }
4276
-        $title = str_replace("%%pt_plural%%",$plural_name,$title);
4276
+        $title = str_replace("%%pt_plural%%", $plural_name, $title);
4277 4277
     }
4278 4278
 
4279 4279
 
4280 4280
 
4281
-    if(strpos($title,'%%category%%') !== false){
4281
+    if (strpos($title, '%%category%%') !== false) {
4282 4282
         $cat_name = '';
4283 4283
 
4284
-        if($gd_page=='detail') {
4284
+        if ($gd_page == 'detail') {
4285 4285
             if ($post->default_category) {
4286
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4286
+                $cat = get_term($post->default_category, $post->post_type.'category');
4287 4287
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4288 4288
             }
4289
-        }elseif($gd_page=='listing'){
4289
+        }elseif ($gd_page == 'listing') {
4290 4290
             $queried_object = get_queried_object();
4291
-            if(isset($queried_object->name)){
4291
+            if (isset($queried_object->name)) {
4292 4292
                 $cat_name = $queried_object->name;
4293 4293
             }
4294 4294
         }
4295
-        $title = str_replace("%%category%%",$cat_name,$title);
4295
+        $title = str_replace("%%category%%", $cat_name, $title);
4296 4296
     }
4297 4297
 
4298
-    if(strpos($title,'%%tag%%') !== false){
4298
+    if (strpos($title, '%%tag%%') !== false) {
4299 4299
         $cat_name = '';
4300 4300
 
4301
-        if($gd_page=='detail') {
4301
+        if ($gd_page == 'detail') {
4302 4302
             if ($post->default_category) {
4303
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4303
+                $cat = get_term($post->default_category, $post->post_type.'category');
4304 4304
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4305 4305
             }
4306
-        }elseif($gd_page=='listing'){
4306
+        }elseif ($gd_page == 'listing') {
4307 4307
             $queried_object = get_queried_object();
4308
-            if(isset($queried_object->name)){
4308
+            if (isset($queried_object->name)) {
4309 4309
                 $cat_name = $queried_object->name;
4310 4310
             }
4311 4311
         }
4312
-        $title = str_replace("%%tag%%",$cat_name,$title);
4312
+        $title = str_replace("%%tag%%", $cat_name, $title);
4313 4313
     }
4314 4314
 
4315 4315
 
4316 4316
 
4317
-    if(strpos($title,'%%id%%') !== false){
4317
+    if (strpos($title, '%%id%%') !== false) {
4318 4318
         $ID = (isset($post->ID)) ? $post->ID : '';
4319
-        $title = str_replace("%%id%%",$ID,$title);
4319
+        $title = str_replace("%%id%%", $ID, $title);
4320 4320
     }
4321 4321
 
4322
-    if(strpos($title,'%%sep%%') !== false){
4323
-        $title = str_replace("%%sep%%",$sep,$title);
4322
+    if (strpos($title, '%%sep%%') !== false) {
4323
+        $title = str_replace("%%sep%%", $sep, $title);
4324 4324
     }
4325 4325
 
4326 4326
 
@@ -4338,12 +4338,12 @@  discard block
 block discarded – undo
4338 4338
      * @param string $gd_page The page being filtered.
4339 4339
      * @param string $sep The separator, default: `|`.
4340 4340
      */
4341
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4341
+    $location_array = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
4342 4342
     $location_titles = array();
4343
-    if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4344
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4345
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4346
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4343
+    if ($gd_page == 'location' && get_query_var('gd_country_full')) {
4344
+        if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
4345
+        if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
4346
+        if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
4347 4347
     }
4348 4348
     $location_single = '';
4349 4349
     $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
@@ -4415,51 +4415,51 @@  discard block
 block discarded – undo
4415 4415
     }
4416 4416
 
4417 4417
 
4418
-    if(strpos($title,'%%location%%') !== false){
4418
+    if (strpos($title, '%%location%%') !== false) {
4419 4419
         $location = '';
4420
-        if($location_titles) {
4420
+        if ($location_titles) {
4421 4421
             $location = implode(", ", $location_titles);
4422 4422
         }
4423
-        $title = str_replace("%%location%%",$location,$title);
4423
+        $title = str_replace("%%location%%", $location, $title);
4424 4424
     }
4425 4425
 
4426
-    if(strpos($title,'%%in_location%%') !== false){
4426
+    if (strpos($title, '%%in_location%%') !== false) {
4427 4427
         $location = '';
4428
-        if($location_titles) {
4429
-            $location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4428
+        if ($location_titles) {
4429
+            $location = __('in ', 'geodirectory').implode(", ", $location_titles);
4430 4430
         }
4431
-        $title = str_replace("%%in_location%%",$location,$title);
4431
+        $title = str_replace("%%in_location%%", $location, $title);
4432 4432
     }
4433 4433
 
4434
-    if(strpos($title,'%%in_location_single%%') !== false){
4435
-        if($location_single) {
4436
-            $location_single = __('in', 'geodirectory') . ' ' .$location_single;
4434
+    if (strpos($title, '%%in_location_single%%') !== false) {
4435
+        if ($location_single) {
4436
+            $location_single = __('in', 'geodirectory').' '.$location_single;
4437 4437
         }
4438
-        $title = str_replace("%%in_location_single%%",$location_single,$title);
4438
+        $title = str_replace("%%in_location_single%%", $location_single, $title);
4439 4439
     }
4440 4440
 
4441
-    if(strpos($title,'%%location_single%%') !== false){
4442
-        $title = str_replace("%%location_single%%",$location_single,$title);
4441
+    if (strpos($title, '%%location_single%%') !== false) {
4442
+        $title = str_replace("%%location_single%%", $location_single, $title);
4443 4443
     }
4444 4444
 
4445 4445
 
4446
-    if(strpos($title,'%%search_term%%') !== false){
4446
+    if (strpos($title, '%%search_term%%') !== false) {
4447 4447
         $search_term = '';
4448
-        if(isset($_REQUEST['s'])){
4448
+        if (isset($_REQUEST['s'])) {
4449 4449
             $search_term = esc_attr($_REQUEST['s']);
4450 4450
         }
4451
-        $title = str_replace("%%search_term%%",$search_term,$title);
4451
+        $title = str_replace("%%search_term%%", $search_term, $title);
4452 4452
     }
4453 4453
 
4454
-    if(strpos($title,'%%search_near%%') !== false){
4454
+    if (strpos($title, '%%search_near%%') !== false) {
4455 4455
         $search_term = '';
4456
-        if(isset($_REQUEST['snear'])){
4456
+        if (isset($_REQUEST['snear'])) {
4457 4457
             $search_term = esc_attr($_REQUEST['snear']);
4458 4458
         }
4459
-        $title = str_replace("%%search_near%%",$search_term,$title);
4459
+        $title = str_replace("%%search_near%%", $search_term, $title);
4460 4460
     }
4461 4461
 
4462
-    if(strpos($title,'%%name%%') !== false){
4462
+    if (strpos($title, '%%name%%') !== false) {
4463 4463
         $author_name = get_the_author();
4464 4464
         if (!$author_name || $author_name === '') {
4465 4465
             $queried_object = get_queried_object();
@@ -4484,9 +4484,9 @@  discard block
 block discarded – undo
4484 4484
         $title = str_replace("%%pagetotal%%", $pagetotal, $title);
4485 4485
     }
4486 4486
 
4487
-    $title = wptexturize( $title );
4488
-    $title = convert_chars( $title );
4489
-    $title = esc_html( $title );
4487
+    $title = wptexturize($title);
4488
+    $title = convert_chars($title);
4489
+    $title = esc_html($title);
4490 4490
 
4491 4491
     /**
4492 4492
      * Filter the title variables after standard ones have been filtered.
@@ -4499,7 +4499,7 @@  discard block
 block discarded – undo
4499 4499
      * @param string $sep The separator, default: `|`.
4500 4500
      */
4501 4501
 
4502
-    return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4502
+    return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
4503 4503
 }
4504 4504
 
4505 4505
 /**
@@ -4622,7 +4622,7 @@  discard block
 block discarded – undo
4622 4622
     }
4623 4623
     
4624 4624
     $action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
4625
-    $is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) )  ? true : false;
4625
+    $is_admin = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false;
4626 4626
     $inline_save = $action == 'inline-save' ? true : false;
4627 4627
 
4628 4628
     if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
@@ -4633,7 +4633,7 @@  discard block
 block discarded – undo
4633 4633
         return;
4634 4634
     }
4635 4635
 
4636
-    $user_id = (int)get_current_user_id();
4636
+    $user_id = (int) get_current_user_id();
4637 4637
         
4638 4638
     if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4639 4639
         $author_id = !empty($post->post_author) ? $post->post_author : 0;
@@ -4677,7 +4677,7 @@  discard block
 block discarded – undo
4677 4677
     $nr  = geodir_title_meta_pagenumbering('nr');
4678 4678
 
4679 4679
     if ($max > 1 && $nr > 1) {
4680
-        $replacement = sprintf($sep . ' ' . __('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
4680
+        $replacement = sprintf($sep.' '.__('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
4681 4681
     }
4682 4682
 
4683 4683
     return $replacement;
@@ -4696,7 +4696,7 @@  discard block
 block discarded – undo
4696 4696
 
4697 4697
     $nr = geodir_title_meta_pagenumbering('nr');
4698 4698
     if (isset($nr) && $nr > 0) {
4699
-        $replacement = (string)$nr;
4699
+        $replacement = (string) $nr;
4700 4700
     }
4701 4701
 
4702 4702
     return $replacement;
@@ -4715,7 +4715,7 @@  discard block
 block discarded – undo
4715 4715
 
4716 4716
     $max = geodir_title_meta_pagenumbering('max');
4717 4717
     if (isset($max) && $max > 0) {
4718
-        $replacement = (string)$max;
4718
+        $replacement = (string) $max;
4719 4719
     }
4720 4720
 
4721 4721
     return $replacement;
@@ -4757,7 +4757,7 @@  discard block
 block discarded – undo
4757 4757
         }
4758 4758
 
4759 4759
         if (isset($post->post_content)) {
4760
-            $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->' ) + 1);
4760
+            $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->') + 1);
4761 4761
         }
4762 4762
     }
4763 4763
 
Please login to merge, or discard this patch.