Test Failed
Push — master ( e72891...440de9 )
by Stiofan
25:52
created
geodirectory-functions/general_functions.php 3 patches
Indentation   +3392 added lines, -3392 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,370 +933,370 @@  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
-                            continue;
1155
-                            //$term_link_text = wp_strip_all_tags(geodir_ucwords(urldecode($term_link_text)));
1156
-                        }
1122
+			if (!empty($gd_taxonomy)) {
1123
+				$term_index = 1;
1157 1124
 
1158
-                        if ($term_index == count($term_array) && $is_taxonomy_last)
1159
-                            $breadcrumb .= $separator . $term_link_text;
1160
-                        else {
1161
-                            $cat_link .= $term . '/';
1162
-                            $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1163
-                        }
1164
-                        $term_index++;
1165
-                    }
1166
-                }
1167
-
1168
-
1169
-            }
1170
-
1171
-            if (geodir_is_page('detail'))
1172
-                $breadcrumb .= $separator . get_the_title();
1173
-
1174
-            $breadcrumb .= '</li>';
1175
-
1176
-
1177
-        } elseif (geodir_is_page('author')) {
1178
-            $user_id = get_current_user_id();
1179
-            $author_link = get_author_posts_url($user_id);
1180
-            $default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
1181
-
1182
-            /**
1183
-             * Filter author page link.
1184
-             *
1185
-             * @since 1.0.0
1186
-             * @param string $default_author_link Default author link.
1187
-             * @param int $user_id Author ID.
1188
-             */
1189
-            $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1190
-
1191
-            $breadcrumb .= '<li>';
1192
-            $breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>';
1193
-
1194
-            if (isset($_REQUEST['list'])) {
1195
-                $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false);
1196
-
1197
-                /**
1198
-                 * Filter author page link.
1199
-                 *
1200
-                 * @since 1.0.0
1201
-                 * @param string $author_link Author page link.
1202
-                 * @param int $user_id Author ID.
1203
-                 * @param string $_REQUEST['stype'] Post type.
1204
-                 */
1205
-                $author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1206
-
1207
-                $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1208
-                $breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1209
-            } else
1210
-                $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1211
-
1212
-            $breadcrumb .= '</li>';
1213
-        } elseif (is_category() || is_single()) {
1214
-            $category = get_the_category();
1215
-            if (is_category()) {
1216
-                $breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1217
-            }
1218
-            if (is_single()) {
1219
-                $breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>';
1220
-                $breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1221
-            }
1222
-            /* End of my version ##################################################### */
1223
-        } else if (is_page()) {
1224
-            $page_title = get_the_title();
1225
-
1226
-            if (geodir_is_page('location')) {
1227
-                $location_page_id = geodir_location_page_id();
1228
-                $loc_post = get_post( $location_page_id );
1229
-                $post_name = $loc_post->post_name;
1230
-                $slug= ucwords(str_replace('-',' ',$post_name));
1231
-                $page_title = !empty($slug )? $slug : __('Location', 'geodirectory');
1232
-            }
1233
-
1234
-            $breadcrumb .= '<li>' . $separator;
1235
-            $breadcrumb .= stripslashes_deep($page_title);
1236
-            $breadcrumb .= '</li>';
1237
-        } else if (is_tag()) {
1238
-            $breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1239
-        } else if (is_day()) {
1240
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1241
-            the_time('F jS, Y');
1242
-            $breadcrumb .= '</li>';
1243
-        } else if (is_month()) {
1244
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1245
-            the_time('F, Y');
1246
-            $breadcrumb .= '</li>';
1247
-        } else if (is_year()) {
1248
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1249
-            the_time('Y');
1250
-            $breadcrumb .= '</li>';
1251
-        } else if (is_author()) {
1252
-            $breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory');
1253
-            $breadcrumb .= '</li>';
1254
-        } else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1255
-            $breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory');
1256
-            $breadcrumb .= '</li>';
1257
-        } else if (is_search()) {
1258
-            $breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory');
1259
-            $breadcrumb .= '</li>';
1260
-        }
1261
-        $breadcrumb .= '</ul></div>';
1262
-
1263
-        /**
1264
-         * Filter breadcrumb html output.
1265
-         *
1266
-         * @since 1.0.0
1267
-         * @param string $breadcrumb Breadcrumb HTML.
1268
-         * @param string $separator Breadcrumb separator.
1269
-         */
1270
-        echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1271
-    }
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
+							continue;
1155
+							//$term_link_text = wp_strip_all_tags(geodir_ucwords(urldecode($term_link_text)));
1156
+						}
1157
+
1158
+						if ($term_index == count($term_array) && $is_taxonomy_last)
1159
+							$breadcrumb .= $separator . $term_link_text;
1160
+						else {
1161
+							$cat_link .= $term . '/';
1162
+							$breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1163
+						}
1164
+						$term_index++;
1165
+					}
1166
+				}
1167
+
1168
+
1169
+			}
1170
+
1171
+			if (geodir_is_page('detail'))
1172
+				$breadcrumb .= $separator . get_the_title();
1173
+
1174
+			$breadcrumb .= '</li>';
1175
+
1176
+
1177
+		} elseif (geodir_is_page('author')) {
1178
+			$user_id = get_current_user_id();
1179
+			$author_link = get_author_posts_url($user_id);
1180
+			$default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
1181
+
1182
+			/**
1183
+			 * Filter author page link.
1184
+			 *
1185
+			 * @since 1.0.0
1186
+			 * @param string $default_author_link Default author link.
1187
+			 * @param int $user_id Author ID.
1188
+			 */
1189
+			$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1190
+
1191
+			$breadcrumb .= '<li>';
1192
+			$breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>';
1193
+
1194
+			if (isset($_REQUEST['list'])) {
1195
+				$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false);
1196
+
1197
+				/**
1198
+				 * Filter author page link.
1199
+				 *
1200
+				 * @since 1.0.0
1201
+				 * @param string $author_link Author page link.
1202
+				 * @param int $user_id Author ID.
1203
+				 * @param string $_REQUEST['stype'] Post type.
1204
+				 */
1205
+				$author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1206
+
1207
+				$breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1208
+				$breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1209
+			} else
1210
+				$breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1211
+
1212
+			$breadcrumb .= '</li>';
1213
+		} elseif (is_category() || is_single()) {
1214
+			$category = get_the_category();
1215
+			if (is_category()) {
1216
+				$breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1217
+			}
1218
+			if (is_single()) {
1219
+				$breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>';
1220
+				$breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1221
+			}
1222
+			/* End of my version ##################################################### */
1223
+		} else if (is_page()) {
1224
+			$page_title = get_the_title();
1225
+
1226
+			if (geodir_is_page('location')) {
1227
+				$location_page_id = geodir_location_page_id();
1228
+				$loc_post = get_post( $location_page_id );
1229
+				$post_name = $loc_post->post_name;
1230
+				$slug= ucwords(str_replace('-',' ',$post_name));
1231
+				$page_title = !empty($slug )? $slug : __('Location', 'geodirectory');
1232
+			}
1233
+
1234
+			$breadcrumb .= '<li>' . $separator;
1235
+			$breadcrumb .= stripslashes_deep($page_title);
1236
+			$breadcrumb .= '</li>';
1237
+		} else if (is_tag()) {
1238
+			$breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1239
+		} else if (is_day()) {
1240
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1241
+			the_time('F jS, Y');
1242
+			$breadcrumb .= '</li>';
1243
+		} else if (is_month()) {
1244
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1245
+			the_time('F, Y');
1246
+			$breadcrumb .= '</li>';
1247
+		} else if (is_year()) {
1248
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1249
+			the_time('Y');
1250
+			$breadcrumb .= '</li>';
1251
+		} else if (is_author()) {
1252
+			$breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory');
1253
+			$breadcrumb .= '</li>';
1254
+		} else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1255
+			$breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory');
1256
+			$breadcrumb .= '</li>';
1257
+		} else if (is_search()) {
1258
+			$breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory');
1259
+			$breadcrumb .= '</li>';
1260
+		}
1261
+		$breadcrumb .= '</ul></div>';
1262
+
1263
+		/**
1264
+		 * Filter breadcrumb html output.
1265
+		 *
1266
+		 * @since 1.0.0
1267
+		 * @param string $breadcrumb Breadcrumb HTML.
1268
+		 * @param string $separator Breadcrumb separator.
1269
+		 */
1270
+		echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1271
+	}
1272 1272
 }
1273 1273
 
1274 1274
 
1275 1275
 add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin
1276 1276
 if (!function_exists('geodir_allow_wpadmin')) {
1277
-    /**
1278
-     * Allow only admins to access wp-admin.
1279
-     *
1280
-     * Normal users will be redirected to home page.
1281
-     *
1282
-     * @since 1.0.0
1283
-     * @package GeoDirectory
1284
-     * @global object $wpdb WordPress Database object.
1285
-     */
1286
-    function geodir_allow_wpadmin()
1287
-    {
1288
-        global $wpdb;
1289
-        if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined( 'DOING_AJAX' )) ) // checking action in request to allow ajax request go through
1290
-        {
1291
-            if (current_user_can('administrator')) {
1292
-            } else {
1293
-
1294
-                wp_redirect(home_url());
1295
-                exit;
1296
-            }
1297
-
1298
-        }
1299
-    }
1277
+	/**
1278
+	 * Allow only admins to access wp-admin.
1279
+	 *
1280
+	 * Normal users will be redirected to home page.
1281
+	 *
1282
+	 * @since 1.0.0
1283
+	 * @package GeoDirectory
1284
+	 * @global object $wpdb WordPress Database object.
1285
+	 */
1286
+	function geodir_allow_wpadmin()
1287
+	{
1288
+		global $wpdb;
1289
+		if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined( 'DOING_AJAX' )) ) // checking action in request to allow ajax request go through
1290
+		{
1291
+			if (current_user_can('administrator')) {
1292
+			} else {
1293
+
1294
+				wp_redirect(home_url());
1295
+				exit;
1296
+			}
1297
+
1298
+		}
1299
+	}
1300 1300
 }
1301 1301
 
1302 1302
 
@@ -1310,84 +1310,84 @@  discard block
 block discarded – undo
1310 1310
  */
1311 1311
 function fetch_remote_file($url)
1312 1312
 {
1313
-    // extract the file name and extension from the url
1314
-    require_once(ABSPATH . 'wp-includes/pluggable.php');
1315
-    $file_name = basename($url);
1316
-    if (strpos($file_name, '?') !== false) {
1317
-        list($file_name) = explode('?', $file_name);
1318
-    }
1319
-    $dummy = false;
1320
-    $add_to_cache = false;
1321
-    $key = null;
1322
-    if (strpos($url, '/dummy/') !== false) {
1323
-        $dummy = true;
1324
-        $key = "dummy_".str_replace('.', '_', $file_name);
1325
-        $value = get_transient('cached_dummy_images');
1326
-        if ($value) {
1327
-            if (isset($value[$key])) {
1328
-                return $value[$key];
1329
-            } else {
1330
-                $add_to_cache = true;
1331
-            }
1332
-        } else {
1333
-            $add_to_cache = true;
1334
-        }
1335
-    }
1336
-
1337
-    // get placeholder file in the upload dir with a unique, sanitized filename
1338
-
1339
-    $post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1340
-
1341
-    $upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1342
-    if ($upload['error'])
1343
-        return new WP_Error('upload_dir_error', $upload['error']);
1344
-
1345
-
1346
-    sleep(0.3);// if multiple remote file this can cause the remote server to timeout so we add a slight delay
1347
-
1348
-    // fetch the remote url and write it to the placeholder file
1349
-    $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1350
-
1351
-    $log_message = '';
1352
-    if( is_wp_error( $headers  ) ) {
1353
-        echo 'file: '.$url;
1354
-        return new WP_Error('import_file_error',$headers->get_error_message());
1355
-    }
1356
-
1357
-    $filesize = filesize($upload['file']);
1358
-    // request failed
1359
-    if (!$headers) {
1360
-        $log_message = __('Remote server did not respond', 'geodirectory');
1361
-    }
1362
-    // make sure the fetch was successful
1363
-    elseif ($headers['response']['code'] != '200') {
1364
-        $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1365
-    }
1366
-    elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1367
-        $log_message =  __('Remote file is incorrect size', 'geodirectory');
1368
-    }
1369
-    elseif (0 == $filesize) {
1370
-        $log_message = __('Zero size file downloaded', 'geodirectory');
1371
-    }
1372
-
1373
-    if($log_message){
1374
-        $del = unlink($upload['file']);
1375
-        if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1376
-        return new WP_Error('import_file_error',$log_message );
1377
-    }
1378
-
1379
-    if ($dummy && $add_to_cache && is_array($upload)) {
1380
-        $images = get_transient('cached_dummy_images');
1381
-        if(is_array($images))
1382
-            $images[$key] = $upload;
1383
-        else
1384
-            $images = array($key => $upload);
1385
-
1386
-        //setting the cache using the WP Transient API
1387
-        set_transient('cached_dummy_images', $images, 60 * 10); //10 minutes cache
1388
-    }
1389
-
1390
-    return $upload;
1313
+	// extract the file name and extension from the url
1314
+	require_once(ABSPATH . 'wp-includes/pluggable.php');
1315
+	$file_name = basename($url);
1316
+	if (strpos($file_name, '?') !== false) {
1317
+		list($file_name) = explode('?', $file_name);
1318
+	}
1319
+	$dummy = false;
1320
+	$add_to_cache = false;
1321
+	$key = null;
1322
+	if (strpos($url, '/dummy/') !== false) {
1323
+		$dummy = true;
1324
+		$key = "dummy_".str_replace('.', '_', $file_name);
1325
+		$value = get_transient('cached_dummy_images');
1326
+		if ($value) {
1327
+			if (isset($value[$key])) {
1328
+				return $value[$key];
1329
+			} else {
1330
+				$add_to_cache = true;
1331
+			}
1332
+		} else {
1333
+			$add_to_cache = true;
1334
+		}
1335
+	}
1336
+
1337
+	// get placeholder file in the upload dir with a unique, sanitized filename
1338
+
1339
+	$post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1340
+
1341
+	$upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1342
+	if ($upload['error'])
1343
+		return new WP_Error('upload_dir_error', $upload['error']);
1344
+
1345
+
1346
+	sleep(0.3);// if multiple remote file this can cause the remote server to timeout so we add a slight delay
1347
+
1348
+	// fetch the remote url and write it to the placeholder file
1349
+	$headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1350
+
1351
+	$log_message = '';
1352
+	if( is_wp_error( $headers  ) ) {
1353
+		echo 'file: '.$url;
1354
+		return new WP_Error('import_file_error',$headers->get_error_message());
1355
+	}
1356
+
1357
+	$filesize = filesize($upload['file']);
1358
+	// request failed
1359
+	if (!$headers) {
1360
+		$log_message = __('Remote server did not respond', 'geodirectory');
1361
+	}
1362
+	// make sure the fetch was successful
1363
+	elseif ($headers['response']['code'] != '200') {
1364
+		$log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1365
+	}
1366
+	elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1367
+		$log_message =  __('Remote file is incorrect size', 'geodirectory');
1368
+	}
1369
+	elseif (0 == $filesize) {
1370
+		$log_message = __('Zero size file downloaded', 'geodirectory');
1371
+	}
1372
+
1373
+	if($log_message){
1374
+		$del = unlink($upload['file']);
1375
+		if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1376
+		return new WP_Error('import_file_error',$log_message );
1377
+	}
1378
+
1379
+	if ($dummy && $add_to_cache && is_array($upload)) {
1380
+		$images = get_transient('cached_dummy_images');
1381
+		if(is_array($images))
1382
+			$images[$key] = $upload;
1383
+		else
1384
+			$images = array($key => $upload);
1385
+
1386
+		//setting the cache using the WP Transient API
1387
+		set_transient('cached_dummy_images', $images, 60 * 10); //10 minutes cache
1388
+	}
1389
+
1390
+	return $upload;
1391 1391
 }
1392 1392
 
1393 1393
 /**
@@ -1399,21 +1399,21 @@  discard block
 block discarded – undo
1399 1399
  */
1400 1400
 function geodir_max_upload_size()
1401 1401
 {
1402
-    $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1403
-
1404
-    if ($max_filesize > 0 && $max_filesize < 1) {
1405
-        $max_filesize = (int)($max_filesize * 1024) . 'kb';
1406
-    } else {
1407
-        $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1408
-    }
1409
-
1410
-    /**
1411
-     * Filter default image upload size limit.
1412
-     *
1413
-     * @since 1.0.0
1414
-     * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1415
-     */
1416
-    return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1402
+	$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1403
+
1404
+	if ($max_filesize > 0 && $max_filesize < 1) {
1405
+		$max_filesize = (int)($max_filesize * 1024) . 'kb';
1406
+	} else {
1407
+		$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1408
+	}
1409
+
1410
+	/**
1411
+	 * Filter default image upload size limit.
1412
+	 *
1413
+	 * @since 1.0.0
1414
+	 * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1415
+	 */
1416
+	return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1417 1417
 }
1418 1418
 
1419 1419
 /**
@@ -1427,11 +1427,11 @@  discard block
 block discarded – undo
1427 1427
  */
1428 1428
 function geodir_dummy_folder_exists()
1429 1429
 {
1430
-    $path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1431
-    if (!is_dir($path))
1432
-        return false;
1433
-    else
1434
-        return true;
1430
+	$path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1431
+	if (!is_dir($path))
1432
+		return false;
1433
+	else
1434
+		return true;
1435 1435
 
1436 1436
 }
1437 1437
 
@@ -1446,290 +1446,290 @@  discard block
 block discarded – undo
1446 1446
  */
1447 1447
 function  geodir_get_author_info($aid)
1448 1448
 {
1449
-    global $wpdb;
1450
-    /*$infosql = "select * from $wpdb->users where ID=$aid";*/
1451
-    $infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1452
-    $info = $wpdb->get_results($infosql);
1453
-    if ($info) {
1454
-        return $info[0];
1455
-    }
1449
+	global $wpdb;
1450
+	/*$infosql = "select * from $wpdb->users where ID=$aid";*/
1451
+	$infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1452
+	$info = $wpdb->get_results($infosql);
1453
+	if ($info) {
1454
+		return $info[0];
1455
+	}
1456 1456
 }
1457 1457
 
1458 1458
 if (!function_exists('adminEmail')) {
1459
-    /**
1460
-     * Send emails to client on post submission, renew etc.
1461
-     *
1462
-     * @since 1.0.0
1463
-     * @package GeoDirectory
1464
-     * @global object $wpdb WordPress Database object.
1465
-     * @param int|string $page_id Page ID.
1466
-     * @param int|string $user_id User ID.
1467
-     * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1468
-     * @param string $custom_1 Custom data to be sent.
1469
-     */
1470
-    function adminEmail($page_id, $user_id, $message_type, $custom_1 = '')
1471
-    {
1472
-        global $wpdb;
1473
-        if ($message_type == 'expiration') {
1474
-            $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1475
-            $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1476
-        } elseif ($message_type == 'post_submited') {
1477
-            $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1478
-            $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1479
-        } elseif ($message_type == 'renew') {
1480
-            $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1481
-            $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1482
-        } elseif ($message_type == 'upgrade') {
1483
-            $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1484
-            $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1485
-        } elseif ($message_type == 'claim_approved') {
1486
-            $subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1487
-            $client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1488
-        } elseif ($message_type == 'claim_rejected') {
1489
-            $subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1490
-            $client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1491
-        } elseif ($message_type == 'claim_requested') {
1492
-            $subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1493
-            $client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1494
-        } elseif ($message_type == 'auto_claim') {
1495
-            $subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1496
-            $client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1497
-        } elseif ($message_type == 'payment_success') {
1498
-            $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1499
-            $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1500
-        } elseif ($message_type == 'payment_fail') {
1501
-            $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1502
-            $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1503
-        }
1504
-        $transaction_details = $custom_1;
1505
-        $fromEmail = get_option('site_email');
1506
-        $fromEmailName = get_site_emailName();
1459
+	/**
1460
+	 * Send emails to client on post submission, renew etc.
1461
+	 *
1462
+	 * @since 1.0.0
1463
+	 * @package GeoDirectory
1464
+	 * @global object $wpdb WordPress Database object.
1465
+	 * @param int|string $page_id Page ID.
1466
+	 * @param int|string $user_id User ID.
1467
+	 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1468
+	 * @param string $custom_1 Custom data to be sent.
1469
+	 */
1470
+	function adminEmail($page_id, $user_id, $message_type, $custom_1 = '')
1471
+	{
1472
+		global $wpdb;
1473
+		if ($message_type == 'expiration') {
1474
+			$subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1475
+			$client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1476
+		} elseif ($message_type == 'post_submited') {
1477
+			$subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1478
+			$client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1479
+		} elseif ($message_type == 'renew') {
1480
+			$subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1481
+			$client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1482
+		} elseif ($message_type == 'upgrade') {
1483
+			$subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1484
+			$client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1485
+		} elseif ($message_type == 'claim_approved') {
1486
+			$subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1487
+			$client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1488
+		} elseif ($message_type == 'claim_rejected') {
1489
+			$subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1490
+			$client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1491
+		} elseif ($message_type == 'claim_requested') {
1492
+			$subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1493
+			$client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1494
+		} elseif ($message_type == 'auto_claim') {
1495
+			$subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1496
+			$client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1497
+		} elseif ($message_type == 'payment_success') {
1498
+			$subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1499
+			$client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1500
+		} elseif ($message_type == 'payment_fail') {
1501
+			$subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1502
+			$client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1503
+		}
1504
+		$transaction_details = $custom_1;
1505
+		$fromEmail = get_option('site_email');
1506
+		$fromEmailName = get_site_emailName();
1507 1507
 //$alivedays = get_post_meta($page_id,'alive_days',true);
1508
-        $pkg_limit = get_property_price_info_listing($page_id);
1509
-        $alivedays = $pkg_limit['days'];
1510
-        $productlink = get_permalink($page_id);
1511
-        $post_info = get_post($page_id);
1512
-        $post_date = date('dS F,Y', strtotime($post_info->post_date));
1513
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1514
-        $loginurl = geodir_login_url();
1515
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1516
-        $siteurl = home_url();
1517
-        $siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1518
-        $user_info = get_userdata($user_id);
1519
-        $user_email = $user_info->user_email;
1520
-        $display_name = geodir_get_client_name($user_id);
1521
-        $user_login = $user_info->user_login;
1522
-        $number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1523
-        if ($number_of_grace_days == '') {
1524
-            $number_of_grace_days = 1;
1525
-        }
1526
-        if ($post_info->post_type == 'event') {
1527
-            $post_type = 'event';
1528
-        } else {
1529
-            $post_type = 'listing';
1530
-        }
1531
-        $renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1532
-        $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#]');
1533
-        $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);
1534
-        $client_message = str_replace($search_array, $replace_array, $client_message);
1535
-        $subject = str_replace($search_array, $replace_array, $subject);
1536
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1537
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1538
-        $headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1539
-
1540
-        $to = $fromEmail;
1541
-        $message = $client_message;
1542
-
1543
-
1544
-        /**
1545
-         * Filter the admin email to address.
1546
-         *
1547
-         * @since 1.6.1
1548
-         * @package GeoDirectory
1549
-         * @param string $to The email address the email is being sent to.
1550
-         * @param int|string $page_id Page ID.
1551
-         * @param int|string $user_id User ID.
1552
-         * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1553
-         * @param string $custom_1 Custom data to be sent.
1554
-         */
1555
-        $to = apply_filters('geodir_adminEmail_to',$to,$page_id, $user_id, $message_type, $custom_1 );
1556
-        /**
1557
-         * Filter the admin email subject.
1558
-         *
1559
-         * @since 1.6.1
1560
-         * @package GeoDirectory_Payment_Manager
1561
-         * @param string $subject The email subject.
1562
-         * @param int|string $page_id Page ID.
1563
-         * @param int|string $user_id User ID.
1564
-         * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1565
-         * @param string $custom_1 Custom data to be sent.
1566
-         */
1567
-        $subject = apply_filters('geodir_adminEmail_subject',$subject,$page_id, $user_id, $message_type, $custom_1);
1568
-        /**
1569
-         * Filter the admin email message.
1570
-         *
1571
-         * @since 1.6.1
1572
-         * @package GeoDirectory_Payment_Manager
1573
-         * @param string $message The email message text.
1574
-         * @param int|string $page_id Page ID.
1575
-         * @param int|string $user_id User ID.
1576
-         * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1577
-         * @param string $custom_1 Custom data to be sent.
1578
-         */
1579
-        $message = apply_filters('geodir_adminEmail_message',$message,$page_id, $user_id, $message_type, $custom_1);
1580
-        /**
1581
-         * Filter the admin email headers.
1582
-         *
1583
-         * @since 1.6.1
1584
-         * @package GeoDirectory_Payment_Manager
1585
-         * @param string $headers The email headers.
1586
-         * @param int|string $page_id Page ID.
1587
-         * @param int|string $user_id User ID.
1588
-         * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1589
-         * @param string $custom_1 Custom data to be sent.
1590
-         */
1591
-        $headers = apply_filters('geodir_adminEmail_headers',$headers,$page_id, $user_id, $message_type, $custom_1);
1592
-
1593
-
1594
-
1595
-        $sent = wp_mail($to, $subject, $message, $headers);
1596
-        if( ! $sent ) {
1597
-            if ( is_array( $to ) ) {
1598
-                $to = implode( ',', $to );
1599
-            }
1600
-            $log_message = sprintf(
1601
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1602
-                $message_type,
1603
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1604
-                $to,
1605
-                $subject
1606
-            );
1607
-            geodir_error_log( $log_message );
1608
-        }
1609
-    }
1508
+		$pkg_limit = get_property_price_info_listing($page_id);
1509
+		$alivedays = $pkg_limit['days'];
1510
+		$productlink = get_permalink($page_id);
1511
+		$post_info = get_post($page_id);
1512
+		$post_date = date('dS F,Y', strtotime($post_info->post_date));
1513
+		$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1514
+		$loginurl = geodir_login_url();
1515
+		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
1516
+		$siteurl = home_url();
1517
+		$siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1518
+		$user_info = get_userdata($user_id);
1519
+		$user_email = $user_info->user_email;
1520
+		$display_name = geodir_get_client_name($user_id);
1521
+		$user_login = $user_info->user_login;
1522
+		$number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1523
+		if ($number_of_grace_days == '') {
1524
+			$number_of_grace_days = 1;
1525
+		}
1526
+		if ($post_info->post_type == 'event') {
1527
+			$post_type = 'event';
1528
+		} else {
1529
+			$post_type = 'listing';
1530
+		}
1531
+		$renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1532
+		$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#]');
1533
+		$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);
1534
+		$client_message = str_replace($search_array, $replace_array, $client_message);
1535
+		$subject = str_replace($search_array, $replace_array, $subject);
1536
+		$headers = 'MIME-Version: 1.0' . "\r\n";
1537
+		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1538
+		$headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1539
+
1540
+		$to = $fromEmail;
1541
+		$message = $client_message;
1542
+
1543
+
1544
+		/**
1545
+		 * Filter the admin email to address.
1546
+		 *
1547
+		 * @since 1.6.1
1548
+		 * @package GeoDirectory
1549
+		 * @param string $to The email address the email is being sent to.
1550
+		 * @param int|string $page_id Page ID.
1551
+		 * @param int|string $user_id User ID.
1552
+		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1553
+		 * @param string $custom_1 Custom data to be sent.
1554
+		 */
1555
+		$to = apply_filters('geodir_adminEmail_to',$to,$page_id, $user_id, $message_type, $custom_1 );
1556
+		/**
1557
+		 * Filter the admin email subject.
1558
+		 *
1559
+		 * @since 1.6.1
1560
+		 * @package GeoDirectory_Payment_Manager
1561
+		 * @param string $subject The email subject.
1562
+		 * @param int|string $page_id Page ID.
1563
+		 * @param int|string $user_id User ID.
1564
+		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1565
+		 * @param string $custom_1 Custom data to be sent.
1566
+		 */
1567
+		$subject = apply_filters('geodir_adminEmail_subject',$subject,$page_id, $user_id, $message_type, $custom_1);
1568
+		/**
1569
+		 * Filter the admin email message.
1570
+		 *
1571
+		 * @since 1.6.1
1572
+		 * @package GeoDirectory_Payment_Manager
1573
+		 * @param string $message The email message text.
1574
+		 * @param int|string $page_id Page ID.
1575
+		 * @param int|string $user_id User ID.
1576
+		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1577
+		 * @param string $custom_1 Custom data to be sent.
1578
+		 */
1579
+		$message = apply_filters('geodir_adminEmail_message',$message,$page_id, $user_id, $message_type, $custom_1);
1580
+		/**
1581
+		 * Filter the admin email headers.
1582
+		 *
1583
+		 * @since 1.6.1
1584
+		 * @package GeoDirectory_Payment_Manager
1585
+		 * @param string $headers The email headers.
1586
+		 * @param int|string $page_id Page ID.
1587
+		 * @param int|string $user_id User ID.
1588
+		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1589
+		 * @param string $custom_1 Custom data to be sent.
1590
+		 */
1591
+		$headers = apply_filters('geodir_adminEmail_headers',$headers,$page_id, $user_id, $message_type, $custom_1);
1592
+
1593
+
1594
+
1595
+		$sent = wp_mail($to, $subject, $message, $headers);
1596
+		if( ! $sent ) {
1597
+			if ( is_array( $to ) ) {
1598
+				$to = implode( ',', $to );
1599
+			}
1600
+			$log_message = sprintf(
1601
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1602
+				$message_type,
1603
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1604
+				$to,
1605
+				$subject
1606
+			);
1607
+			geodir_error_log( $log_message );
1608
+		}
1609
+	}
1610 1610
 }
1611 1611
 
1612 1612
 if (!function_exists('sendEmail')) {
1613
-    /**
1614
-     * @todo could be a duplicate of geodir_sendEmail.
1615
-     *
1616
-     * @since 1.0.0
1617
-     * @package GeoDirectory
1618
-     * @param string $fromEmail Sender email address.
1619
-     * @param string $fromEmailName Sender name.
1620
-     * @param string $toEmail Receiver email address.
1621
-     * @param string $toEmailName Receiver name.
1622
-     * @param string $to_subject Email subject.
1623
-     * @param string $to_message Email content.
1624
-     * @param string $extra Not being used.
1625
-     * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration.
1626
-     * @param string $post_id The post ID.
1627
-     * @param string $user_id The user ID.
1628
-     */
1629
-    function sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '')
1630
-    {
1631
-        $login_details = '';
1632
-        if ($message_type == 'send_friend') {
1633
-            $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1634
-            $message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1635
-        } elseif ($message_type == 'send_enquiry') {
1636
-            $subject = __(get_option('email_enquiry_subject'),'geodirectory');
1637
-            $message = __(get_option('email_enquiry_content'),'geodirectory');
1638
-        } elseif ($message_type == 'forgot_password') {
1639
-            $subject = __(get_option('forgot_password_subject'),'geodirectory');
1640
-            $message = __(get_option('forgot_password_content'),'geodirectory');
1641
-            $login_details = $to_message;
1642
-        } elseif ($message_type == 'registration') {
1643
-            $subject = __(get_option('registration_success_email_subject'),'geodirectory');
1644
-            $message = __(get_option('registration_success_email_content'),'geodirectory');
1645
-            $login_details = $to_message;
1646
-        }
1647
-        $to_message = nl2br($to_message);
1648
-        $sitefromEmail = get_option('site_email');
1649
-        $sitefromEmailName = get_site_emailName();
1650
-        $productlink = get_permalink($post_id);
1651
-        $post_info = get_post($post_id);
1652
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1653
-        $siteurl = home_url();
1654
-        $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1655
-        $loginurl = geodir_login_url();
1656
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1657
-        if ($fromEmail == '') {
1658
-            $fromEmail = get_option('site_email');
1659
-        }
1660
-        if ($fromEmailName == '') {
1661
-            $fromEmailName = get_option('site_email_name');
1662
-        }
1663
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]');
1664
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName);
1665
-        $message = str_replace($search_array, $replace_array, $message);
1666
-
1667
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]');
1668
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName);
1669
-        $subject = str_replace($search_array, $replace_array, $subject);
1670
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1671
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1672
-        $headers .= "Reply-To: " . $fromEmail . "\r\n";
1673
-        $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1674
-
1675
-        $to = $toEmail;
1676
-
1677
-        $sent = wp_mail($to, $subject, $message, $headers);
1678
-        if( ! $sent ) {
1679
-            if ( is_array( $to ) ) {
1680
-                $to = implode( ',', $to );
1681
-            }
1682
-            $log_message = sprintf(
1683
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1684
-                $message_type,
1685
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1686
-                $to,
1687
-                $subject
1688
-            );
1689
-            geodir_error_log( $log_message );
1690
-        }
1691
-
1692
-        ///////// ADMIN BCC EMIALS
1693
-        $admin_bcc = false;
1694
-        if ($message_type == 'registration') {
1695
-            $message_raw = explode(__("Password:", 'geodirectory'), $message);
1696
-            $message_raw2 = explode("</p>", $message_raw[1], 2);
1697
-            $message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1];
1698
-        }
1699
-        $adminEmail = get_bloginfo('admin_email');
1700
-        $to = $adminEmail;
1701
-
1702
-        if ($message_type == 'registration' && get_option('bcc_new_user')) {
1703
-            $subject .= ' - ADMIN BCC COPY';
1704
-            $admin_bcc = true;
1705
-        }
1706
-        elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1707
-            $subject .= ' - ADMIN BCC COPY';
1708
-            $admin_bcc = true;
1709
-        }
1710
-        elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1711
-            $subject .= ' - ADMIN BCC COPY';
1712
-            $admin_bcc = true;
1713
-        }
1714
-
1715
-        if($admin_bcc === true){
1716
-            $sent = wp_mail($to, $subject, $message, $headers);
1717
-            if( ! $sent ) {
1718
-                if ( is_array( $to ) ) {
1719
-                    $to = implode( ',', $to );
1720
-                }
1721
-                $log_message = sprintf(
1722
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1723
-                    $message_type,
1724
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1725
-                    $to,
1726
-                    $subject
1727
-                );
1728
-                geodir_error_log( $log_message );
1729
-            }
1730
-        }
1731
-
1732
-    }
1613
+	/**
1614
+	 * @todo could be a duplicate of geodir_sendEmail.
1615
+	 *
1616
+	 * @since 1.0.0
1617
+	 * @package GeoDirectory
1618
+	 * @param string $fromEmail Sender email address.
1619
+	 * @param string $fromEmailName Sender name.
1620
+	 * @param string $toEmail Receiver email address.
1621
+	 * @param string $toEmailName Receiver name.
1622
+	 * @param string $to_subject Email subject.
1623
+	 * @param string $to_message Email content.
1624
+	 * @param string $extra Not being used.
1625
+	 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration.
1626
+	 * @param string $post_id The post ID.
1627
+	 * @param string $user_id The user ID.
1628
+	 */
1629
+	function sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '')
1630
+	{
1631
+		$login_details = '';
1632
+		if ($message_type == 'send_friend') {
1633
+			$subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1634
+			$message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1635
+		} elseif ($message_type == 'send_enquiry') {
1636
+			$subject = __(get_option('email_enquiry_subject'),'geodirectory');
1637
+			$message = __(get_option('email_enquiry_content'),'geodirectory');
1638
+		} elseif ($message_type == 'forgot_password') {
1639
+			$subject = __(get_option('forgot_password_subject'),'geodirectory');
1640
+			$message = __(get_option('forgot_password_content'),'geodirectory');
1641
+			$login_details = $to_message;
1642
+		} elseif ($message_type == 'registration') {
1643
+			$subject = __(get_option('registration_success_email_subject'),'geodirectory');
1644
+			$message = __(get_option('registration_success_email_content'),'geodirectory');
1645
+			$login_details = $to_message;
1646
+		}
1647
+		$to_message = nl2br($to_message);
1648
+		$sitefromEmail = get_option('site_email');
1649
+		$sitefromEmailName = get_site_emailName();
1650
+		$productlink = get_permalink($post_id);
1651
+		$post_info = get_post($post_id);
1652
+		$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1653
+		$siteurl = home_url();
1654
+		$siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1655
+		$loginurl = geodir_login_url();
1656
+		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
1657
+		if ($fromEmail == '') {
1658
+			$fromEmail = get_option('site_email');
1659
+		}
1660
+		if ($fromEmailName == '') {
1661
+			$fromEmailName = get_option('site_email_name');
1662
+		}
1663
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]');
1664
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName);
1665
+		$message = str_replace($search_array, $replace_array, $message);
1666
+
1667
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]');
1668
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName);
1669
+		$subject = str_replace($search_array, $replace_array, $subject);
1670
+		$headers = 'MIME-Version: 1.0' . "\r\n";
1671
+		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1672
+		$headers .= "Reply-To: " . $fromEmail . "\r\n";
1673
+		$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1674
+
1675
+		$to = $toEmail;
1676
+
1677
+		$sent = wp_mail($to, $subject, $message, $headers);
1678
+		if( ! $sent ) {
1679
+			if ( is_array( $to ) ) {
1680
+				$to = implode( ',', $to );
1681
+			}
1682
+			$log_message = sprintf(
1683
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1684
+				$message_type,
1685
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1686
+				$to,
1687
+				$subject
1688
+			);
1689
+			geodir_error_log( $log_message );
1690
+		}
1691
+
1692
+		///////// ADMIN BCC EMIALS
1693
+		$admin_bcc = false;
1694
+		if ($message_type == 'registration') {
1695
+			$message_raw = explode(__("Password:", 'geodirectory'), $message);
1696
+			$message_raw2 = explode("</p>", $message_raw[1], 2);
1697
+			$message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1];
1698
+		}
1699
+		$adminEmail = get_bloginfo('admin_email');
1700
+		$to = $adminEmail;
1701
+
1702
+		if ($message_type == 'registration' && get_option('bcc_new_user')) {
1703
+			$subject .= ' - ADMIN BCC COPY';
1704
+			$admin_bcc = true;
1705
+		}
1706
+		elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1707
+			$subject .= ' - ADMIN BCC COPY';
1708
+			$admin_bcc = true;
1709
+		}
1710
+		elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1711
+			$subject .= ' - ADMIN BCC COPY';
1712
+			$admin_bcc = true;
1713
+		}
1714
+
1715
+		if($admin_bcc === true){
1716
+			$sent = wp_mail($to, $subject, $message, $headers);
1717
+			if( ! $sent ) {
1718
+				if ( is_array( $to ) ) {
1719
+					$to = implode( ',', $to );
1720
+				}
1721
+				$log_message = sprintf(
1722
+					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1723
+					$message_type,
1724
+					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1725
+					$to,
1726
+					$subject
1727
+				);
1728
+				geodir_error_log( $log_message );
1729
+			}
1730
+		}
1731
+
1732
+	}
1733 1733
 }
1734 1734
 
1735 1735
 /*
@@ -1747,16 +1747,16 @@  discard block
 block discarded – undo
1747 1747
  */
1748 1748
 function gd_lang_object_ids($ids_array, $type)
1749 1749
 {
1750
-    if (function_exists('icl_object_id')) {
1751
-        $res = array();
1752
-        foreach ($ids_array as $id) {
1753
-            $xlat = icl_object_id($id, $type, false);
1754
-            if (!is_null($xlat)) $res[] = $xlat;
1755
-        }
1756
-        return $res;
1757
-    } else {
1758
-        return $ids_array;
1759
-    }
1750
+	if (function_exists('icl_object_id')) {
1751
+		$res = array();
1752
+		foreach ($ids_array as $id) {
1753
+			$xlat = icl_object_id($id, $type, false);
1754
+			if (!is_null($xlat)) $res[] = $xlat;
1755
+		}
1756
+		return $res;
1757
+	} else {
1758
+		return $ids_array;
1759
+	}
1760 1760
 }
1761 1761
 
1762 1762
 
@@ -1771,31 +1771,31 @@  discard block
 block discarded – undo
1771 1771
  * @return array Modified Body CSS classes.
1772 1772
  */
1773 1773
 function geodir_custom_posts_body_class($classes) {
1774
-    global $wpdb, $wp;
1775
-    $post_types = geodir_get_posttypes('object');
1776
-    if (!empty($post_types) && count((array)$post_types) > 1) {
1777
-        $classes[] = 'geodir_custom_posts';
1778
-    }
1779
-
1780
-    // fix body class for signup page
1781
-    if (geodir_is_page('login')) {
1782
-        $new_classes = array();
1783
-        $new_classes[] = 'signup page-geodir-signup';
1784
-        if (!empty($classes)) {
1785
-            foreach ($classes as $class) {
1786
-                if ($class && $class != 'home' && $class != 'blog') {
1787
-                    $new_classes[] = $class;
1788
-                }
1789
-            }
1790
-        }
1791
-        $classes = $new_classes;
1792
-    }
1793
-
1794
-    if (geodir_is_geodir_page()) {
1795
-        $classes[] = 'geodir-page';
1796
-    }
1797
-
1798
-    return $classes;
1774
+	global $wpdb, $wp;
1775
+	$post_types = geodir_get_posttypes('object');
1776
+	if (!empty($post_types) && count((array)$post_types) > 1) {
1777
+		$classes[] = 'geodir_custom_posts';
1778
+	}
1779
+
1780
+	// fix body class for signup page
1781
+	if (geodir_is_page('login')) {
1782
+		$new_classes = array();
1783
+		$new_classes[] = 'signup page-geodir-signup';
1784
+		if (!empty($classes)) {
1785
+			foreach ($classes as $class) {
1786
+				if ($class && $class != 'home' && $class != 'blog') {
1787
+					$new_classes[] = $class;
1788
+				}
1789
+			}
1790
+		}
1791
+		$classes = $new_classes;
1792
+	}
1793
+
1794
+	if (geodir_is_geodir_page()) {
1795
+		$classes[] = 'geodir-page';
1796
+	}
1797
+
1798
+	return $classes;
1799 1799
 }
1800 1800
 
1801 1801
 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
@@ -1810,12 +1810,12 @@  discard block
 block discarded – undo
1810 1810
  */
1811 1811
 function geodir_map_zoom_level()
1812 1812
 {
1813
-    /**
1814
-     * Filter GD map zoom level.
1815
-     *
1816
-     * @since 1.0.0
1817
-     */
1818
-    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));
1813
+	/**
1814
+	 * Filter GD map zoom level.
1815
+	 *
1816
+	 * @since 1.0.0
1817
+	 */
1818
+	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));
1819 1819
 
1820 1820
 }
1821 1821
 
@@ -1829,12 +1829,12 @@  discard block
 block discarded – undo
1829 1829
  */
1830 1830
 function geodir_option_version_backup($geodir_option_name)
1831 1831
 {
1832
-    $version_date = time();
1833
-    $geodir_option = get_option($geodir_option_name);
1832
+	$version_date = time();
1833
+	$geodir_option = get_option($geodir_option_name);
1834 1834
 
1835
-    if (!empty($geodir_option)) {
1836
-        add_option($geodir_option_name . '_' . $version_date, $geodir_option);
1837
-    }
1835
+	if (!empty($geodir_option)) {
1836
+		add_option($geodir_option_name . '_' . $version_date, $geodir_option);
1837
+	}
1838 1838
 }
1839 1839
 
1840 1840
 /**
@@ -1847,11 +1847,11 @@  discard block
 block discarded – undo
1847 1847
  */
1848 1848
 function get_page_id_geodir_add_listing_page($page_id)
1849 1849
 {
1850
-    if (geodir_wpml_multilingual_status()) {
1851
-        $post_type = 'post_page';
1852
-        $page_id = geodir_get_wpml_element_id($page_id, $post_type);
1853
-    }
1854
-    return $page_id;
1850
+	if (geodir_wpml_multilingual_status()) {
1851
+		$post_type = 'post_page';
1852
+		$page_id = geodir_get_wpml_element_id($page_id, $post_type);
1853
+	}
1854
+	return $page_id;
1855 1855
 }
1856 1856
 
1857 1857
 /**
@@ -1863,10 +1863,10 @@  discard block
 block discarded – undo
1863 1863
  */
1864 1864
 function geodir_wpml_multilingual_status()
1865 1865
 {
1866
-    if (function_exists('icl_object_id')) {
1867
-        return true;
1868
-    }
1869
-    return false;
1866
+	if (function_exists('icl_object_id')) {
1867
+		return true;
1868
+	}
1869
+	return false;
1870 1870
 }
1871 1871
 
1872 1872
 /**
@@ -1880,22 +1880,22 @@  discard block
 block discarded – undo
1880 1880
  */
1881 1881
 function geodir_get_wpml_element_id($page_id, $post_type)
1882 1882
 {
1883
-    global $sitepress;
1884
-    if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1885
-        $trid = $sitepress->get_element_trid($page_id, $post_type);
1886
-
1887
-        if ($trid > 0) {
1888
-            $translations = $sitepress->get_element_translations($trid, $post_type);
1889
-
1890
-            $lang = $sitepress->get_current_language();
1891
-            $lang = $lang ? $lang : $sitepress->get_default_language();
1892
-
1893
-            if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
1894
-                $page_id = $translations[$lang]->element_id;
1895
-            }
1896
-        }
1897
-    }
1898
-    return $page_id;
1883
+	global $sitepress;
1884
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1885
+		$trid = $sitepress->get_element_trid($page_id, $post_type);
1886
+
1887
+		if ($trid > 0) {
1888
+			$translations = $sitepress->get_element_translations($trid, $post_type);
1889
+
1890
+			$lang = $sitepress->get_current_language();
1891
+			$lang = $lang ? $lang : $sitepress->get_default_language();
1892
+
1893
+			if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
1894
+				$page_id = $translations[$lang]->element_id;
1895
+			}
1896
+		}
1897
+	}
1898
+	return $page_id;
1899 1899
 }
1900 1900
 
1901 1901
 /**
@@ -1907,20 +1907,20 @@  discard block
 block discarded – undo
1907 1907
  */
1908 1908
 function geodir_wpml_check_element_id()
1909 1909
 {
1910
-    global $sitepress;
1911
-    if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1912
-        $el_type = 'post_page';
1913
-        $el_id = get_option('geodir_add_listing_page');
1914
-        $default_lang = $sitepress->get_default_language();
1915
-        $el_details = $sitepress->get_element_language_details($el_id, $el_type);
1916
-
1917
-        if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
1918
-            if (!$el_details->source_language_code) {
1919
-                $sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
1920
-                $sitepress->icl_translations_cache->clear();
1921
-            }
1922
-        }
1923
-    }
1910
+	global $sitepress;
1911
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1912
+		$el_type = 'post_page';
1913
+		$el_id = get_option('geodir_add_listing_page');
1914
+		$default_lang = $sitepress->get_default_language();
1915
+		$el_details = $sitepress->get_element_language_details($el_id, $el_type);
1916
+
1917
+		if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
1918
+			if (!$el_details->source_language_code) {
1919
+				$sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
1920
+				$sitepress->icl_translations_cache->clear();
1921
+			}
1922
+		}
1923
+	}
1924 1924
 }
1925 1925
 
1926 1926
 /**
@@ -1935,44 +1935,44 @@  discard block
 block discarded – undo
1935 1935
  */
1936 1936
 function geodir_widget_listings_get_order($query_args)
1937 1937
 {
1938
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1939
-
1940
-    $query_args = $gd_query_args_widgets;
1941
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1942
-        return $wpdb->posts . ".post_date DESC, ";
1943
-    }
1944
-
1945
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1946
-    $table = $plugin_prefix . $post_type . '_detail';
1947
-
1948
-    $sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
1949
-
1950
-    switch ($sort_by) {
1951
-        case 'latest':
1952
-        case 'newest':
1953
-            $orderby = $wpdb->posts . ".post_date DESC, ";
1954
-            break;
1955
-        case 'featured':
1956
-            $orderby = $table . ".is_featured ASC, ";
1957
-            break;
1958
-        case 'az':
1959
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1960
-            break;
1961
-        case 'high_review':
1962
-            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
1963
-            break;
1964
-        case 'high_rating':
1965
-            $orderby = "( " . $table . ".overall_rating  ) DESC, ";
1966
-            break;
1967
-        case 'random':
1968
-            $orderby = "RAND(), ";
1969
-            break;
1970
-        default:
1971
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1972
-            break;
1973
-    }
1974
-
1975
-    return $orderby;
1938
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1939
+
1940
+	$query_args = $gd_query_args_widgets;
1941
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1942
+		return $wpdb->posts . ".post_date DESC, ";
1943
+	}
1944
+
1945
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1946
+	$table = $plugin_prefix . $post_type . '_detail';
1947
+
1948
+	$sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
1949
+
1950
+	switch ($sort_by) {
1951
+		case 'latest':
1952
+		case 'newest':
1953
+			$orderby = $wpdb->posts . ".post_date DESC, ";
1954
+			break;
1955
+		case 'featured':
1956
+			$orderby = $table . ".is_featured ASC, ";
1957
+			break;
1958
+		case 'az':
1959
+			$orderby = $wpdb->posts . ".post_title ASC, ";
1960
+			break;
1961
+		case 'high_review':
1962
+			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
1963
+			break;
1964
+		case 'high_rating':
1965
+			$orderby = "( " . $table . ".overall_rating  ) DESC, ";
1966
+			break;
1967
+		case 'random':
1968
+			$orderby = "RAND(), ";
1969
+			break;
1970
+		default:
1971
+			$orderby = $wpdb->posts . ".post_title ASC, ";
1972
+			break;
1973
+	}
1974
+
1975
+	return $orderby;
1976 1976
 }
1977 1977
 
1978 1978
 /**
@@ -1990,126 +1990,126 @@  discard block
 block discarded – undo
1990 1990
  */
1991 1991
 function geodir_get_widget_listings($query_args = array(), $count_only = false)
1992 1992
 {
1993
-    global $wpdb, $plugin_prefix, $table_prefix;
1994
-    $GLOBALS['gd_query_args_widgets'] = $query_args;
1995
-    $gd_query_args_widgets = $query_args;
1996
-
1997
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1998
-    $table = $plugin_prefix . $post_type . '_detail';
1999
-
2000
-    $fields = $wpdb->posts . ".*, " . $table . ".*";
2001
-    /**
2002
-     * Filter widget listing fields string part that is being used for query.
2003
-     *
2004
-     * @since 1.0.0
2005
-     * @param string $fields Fields string.
2006
-     * @param string $table Table name.
2007
-     * @param string $post_type Post type.
2008
-     */
2009
-    $fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
2010
-
2011
-    $join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
2012
-
2013
-    ########### WPML ###########
2014
-
2015
-    if (function_exists('icl_object_id')) {
2016
-        global $sitepress;
2017
-        $lang_code = ICL_LANGUAGE_CODE;
2018
-        if ($lang_code) {
2019
-            $join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
2020
-        }
2021
-    }
2022
-
2023
-    ########### WPML ###########
2024
-
2025
-    /**
2026
-     * Filter widget listing join clause string part that is being used for query.
2027
-     *
2028
-     * @since 1.0.0
2029
-     * @param string $join Join clause string.
2030
-     * @param string $post_type Post type.
2031
-     */
2032
-    $join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
2033
-
2034
-    $post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
2035
-
2036
-    $where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
2037
-
2038
-    ########### WPML ###########
2039
-    if (function_exists('icl_object_id')) {
2040
-        if ($lang_code) {
2041
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
2042
-        }
2043
-    }
2044
-    ########### WPML ###########
2045
-    /**
2046
-     * Filter widget listing where clause string part that is being used for query.
2047
-     *
2048
-     * @since 1.0.0
2049
-     * @param string $where Where clause string.
2050
-     * @param string $post_type Post type.
2051
-     */
2052
-    $where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2053
-    $where = $where != '' ? " WHERE 1=1 " . $where : '';
2054
-
2055
-    $groupby = " GROUP BY $wpdb->posts.ID ";
2056
-    /**
2057
-     * Filter widget listing groupby clause string part that is being used for query.
2058
-     *
2059
-     * @since 1.0.0
2060
-     * @param string $groupby Group by clause string.
2061
-     * @param string $post_type Post type.
2062
-     */
2063
-    $groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
2064
-
2065
-    if ($count_only) {
2066
-        $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
1993
+	global $wpdb, $plugin_prefix, $table_prefix;
1994
+	$GLOBALS['gd_query_args_widgets'] = $query_args;
1995
+	$gd_query_args_widgets = $query_args;
1996
+
1997
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1998
+	$table = $plugin_prefix . $post_type . '_detail';
1999
+
2000
+	$fields = $wpdb->posts . ".*, " . $table . ".*";
2001
+	/**
2002
+	 * Filter widget listing fields string part that is being used for query.
2003
+	 *
2004
+	 * @since 1.0.0
2005
+	 * @param string $fields Fields string.
2006
+	 * @param string $table Table name.
2007
+	 * @param string $post_type Post type.
2008
+	 */
2009
+	$fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
2010
+
2011
+	$join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
2012
+
2013
+	########### WPML ###########
2014
+
2015
+	if (function_exists('icl_object_id')) {
2016
+		global $sitepress;
2017
+		$lang_code = ICL_LANGUAGE_CODE;
2018
+		if ($lang_code) {
2019
+			$join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
2020
+		}
2021
+	}
2022
+
2023
+	########### WPML ###########
2024
+
2025
+	/**
2026
+	 * Filter widget listing join clause string part that is being used for query.
2027
+	 *
2028
+	 * @since 1.0.0
2029
+	 * @param string $join Join clause string.
2030
+	 * @param string $post_type Post type.
2031
+	 */
2032
+	$join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
2033
+
2034
+	$post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
2035
+
2036
+	$where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
2037
+
2038
+	########### WPML ###########
2039
+	if (function_exists('icl_object_id')) {
2040
+		if ($lang_code) {
2041
+			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
2042
+		}
2043
+	}
2044
+	########### WPML ###########
2045
+	/**
2046
+	 * Filter widget listing where clause string part that is being used for query.
2047
+	 *
2048
+	 * @since 1.0.0
2049
+	 * @param string $where Where clause string.
2050
+	 * @param string $post_type Post type.
2051
+	 */
2052
+	$where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2053
+	$where = $where != '' ? " WHERE 1=1 " . $where : '';
2054
+
2055
+	$groupby = " GROUP BY $wpdb->posts.ID ";
2056
+	/**
2057
+	 * Filter widget listing groupby clause string part that is being used for query.
2058
+	 *
2059
+	 * @since 1.0.0
2060
+	 * @param string $groupby Group by clause string.
2061
+	 * @param string $post_type Post type.
2062
+	 */
2063
+	$groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
2064
+
2065
+	if ($count_only) {
2066
+		$sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
2067 2067
 			" . $join . "
2068 2068
 			" . $where;
2069
-        $rows = (int)$wpdb->get_var($sql);
2070
-    } else {
2071
-        $orderby = geodir_widget_listings_get_order($query_args);
2072
-        /**
2073
-         * Filter widget listing orderby clause string part that is being used for query.
2074
-         *
2075
-         * @since 1.0.0
2076
-         * @param string $orderby Order by clause string.
2077
-         * @param string $table Table name.
2078
-         * @param string $post_type Post type.
2079
-         */
2080
-        $orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2081
-        $orderby .= $wpdb->posts . ".post_title ASC";
2082
-        $orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2083
-
2084
-        $limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2085
-        /**
2086
-         * Filter widget listing limit that is being used for query.
2087
-         *
2088
-         * @since 1.0.0
2089
-         * @param int $limit Query results limit.
2090
-         * @param string $post_type Post type.
2091
-         */
2092
-        $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2093
-
2094
-        $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2095
-        if ( !$page )
2096
-            $page = 1;
2097
-
2098
-        $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
2099
-
2100
-        $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
2069
+		$rows = (int)$wpdb->get_var($sql);
2070
+	} else {
2071
+		$orderby = geodir_widget_listings_get_order($query_args);
2072
+		/**
2073
+		 * Filter widget listing orderby clause string part that is being used for query.
2074
+		 *
2075
+		 * @since 1.0.0
2076
+		 * @param string $orderby Order by clause string.
2077
+		 * @param string $table Table name.
2078
+		 * @param string $post_type Post type.
2079
+		 */
2080
+		$orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2081
+		$orderby .= $wpdb->posts . ".post_title ASC";
2082
+		$orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2083
+
2084
+		$limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2085
+		/**
2086
+		 * Filter widget listing limit that is being used for query.
2087
+		 *
2088
+		 * @since 1.0.0
2089
+		 * @param int $limit Query results limit.
2090
+		 * @param string $post_type Post type.
2091
+		 */
2092
+		$limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2093
+
2094
+		$page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2095
+		if ( !$page )
2096
+			$page = 1;
2097
+
2098
+		$limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
2099
+
2100
+		$sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
2101 2101
 			" . $join . "
2102 2102
 			" . $where . "
2103 2103
 			" . $groupby . "
2104 2104
 			" . $orderby . "
2105 2105
 			" . $limit;
2106
-        $rows = $wpdb->get_results($sql);
2107
-    }
2106
+		$rows = $wpdb->get_results($sql);
2107
+	}
2108 2108
 
2109
-    unset($GLOBALS['gd_query_args_widgets']);
2110
-    unset($gd_query_args_widgets);
2109
+	unset($GLOBALS['gd_query_args_widgets']);
2110
+	unset($gd_query_args_widgets);
2111 2111
 
2112
-    return $rows;
2112
+	return $rows;
2113 2113
 }
2114 2114
 
2115 2115
 /**
@@ -2124,14 +2124,14 @@  discard block
 block discarded – undo
2124 2124
  */
2125 2125
 function geodir_function_widget_listings_fields($fields)
2126 2126
 {
2127
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2127
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2128 2128
 
2129
-    $query_args = $gd_query_args_widgets;
2130
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2131
-        return $fields;
2132
-    }
2129
+	$query_args = $gd_query_args_widgets;
2130
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2131
+		return $fields;
2132
+	}
2133 2133
     
2134
-    return $fields;
2134
+	return $fields;
2135 2135
 }
2136 2136
 
2137 2137
 /**
@@ -2146,28 +2146,28 @@  discard block
 block discarded – undo
2146 2146
  */
2147 2147
 function geodir_function_widget_listings_join($join)
2148 2148
 {
2149
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2149
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2150 2150
 
2151
-    $query_args = $gd_query_args_widgets;
2152
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2153
-        return $join;
2154
-    }
2151
+	$query_args = $gd_query_args_widgets;
2152
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2153
+		return $join;
2154
+	}
2155 2155
 
2156
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2157
-    $table = $plugin_prefix . $post_type . '_detail';
2156
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2157
+	$table = $plugin_prefix . $post_type . '_detail';
2158 2158
 
2159
-    if (!empty($query_args['with_pics_only'])) {
2160
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2161
-    }
2159
+	if (!empty($query_args['with_pics_only'])) {
2160
+		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2161
+	}
2162 2162
 
2163
-    if (!empty($query_args['tax_query'])) {
2164
-        $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2165
-        if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2166
-            $join .= $tax_queries['join'];
2167
-        }
2168
-    }
2163
+	if (!empty($query_args['tax_query'])) {
2164
+		$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2165
+		if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2166
+			$join .= $tax_queries['join'];
2167
+		}
2168
+	}
2169 2169
 
2170
-    return $join;
2170
+	return $join;
2171 2171
 }
2172 2172
 
2173 2173
 /**
@@ -2182,54 +2182,54 @@  discard block
 block discarded – undo
2182 2182
  */
2183 2183
 function geodir_function_widget_listings_where($where)
2184 2184
 {
2185
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2186
-
2187
-    $query_args = $gd_query_args_widgets;
2188
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2189
-        return $where;
2190
-    }
2191
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2192
-    $table = $plugin_prefix . $post_type . '_detail';
2193
-
2194
-    if (!empty($query_args)) {
2195
-        if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2196
-            $where = geodir_default_location_where($where, $table);
2197
-        }
2198
-
2199
-        if (!empty($query_args['post_author'])) {
2200
-            $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2201
-        }
2185
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2186
+
2187
+	$query_args = $gd_query_args_widgets;
2188
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2189
+		return $where;
2190
+	}
2191
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2192
+	$table = $plugin_prefix . $post_type . '_detail';
2193
+
2194
+	if (!empty($query_args)) {
2195
+		if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2196
+			$where = geodir_default_location_where($where, $table);
2197
+		}
2198
+
2199
+		if (!empty($query_args['post_author'])) {
2200
+			$where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2201
+		}
2202 2202
         
2203
-        if (!empty($query_args['show_featured_only'])) {
2204
-            $where .= " AND " . $table . ".is_featured = '1'";
2205
-        }
2203
+		if (!empty($query_args['show_featured_only'])) {
2204
+			$where .= " AND " . $table . ".is_featured = '1'";
2205
+		}
2206 2206
 
2207
-        if (!empty($query_args['show_special_only'])) {
2208
-            $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2209
-        }
2207
+		if (!empty($query_args['show_special_only'])) {
2208
+			$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2209
+		}
2210 2210
 
2211
-        if (!empty($query_args['with_pics_only'])) {
2212
-            $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2213
-        }
2211
+		if (!empty($query_args['with_pics_only'])) {
2212
+			$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2213
+		}
2214 2214
 
2215
-        if (!empty($query_args['featured_image_only'])) {
2216
-            $where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2217
-        }
2215
+		if (!empty($query_args['featured_image_only'])) {
2216
+			$where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2217
+		}
2218 2218
 
2219
-        if (!empty($query_args['with_videos_only'])) {
2220
-            $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2221
-        }
2219
+		if (!empty($query_args['with_videos_only'])) {
2220
+			$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2221
+		}
2222 2222
 
2223
-        if (!empty($query_args['tax_query'])) {
2224
-            $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2223
+		if (!empty($query_args['tax_query'])) {
2224
+			$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2225 2225
 
2226
-            if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2227
-                $where .= $tax_queries['where'];
2228
-            }
2229
-        }
2230
-    }
2226
+			if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2227
+				$where .= $tax_queries['where'];
2228
+			}
2229
+		}
2230
+	}
2231 2231
 
2232
-    return $where;
2232
+	return $where;
2233 2233
 }
2234 2234
 
2235 2235
 /**
@@ -2244,14 +2244,14 @@  discard block
 block discarded – undo
2244 2244
  */
2245 2245
 function geodir_function_widget_listings_orderby($orderby)
2246 2246
 {
2247
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2247
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2248 2248
 
2249
-    $query_args = $gd_query_args_widgets;
2250
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2251
-        return $orderby;
2252
-    }
2249
+	$query_args = $gd_query_args_widgets;
2250
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2251
+		return $orderby;
2252
+	}
2253 2253
 
2254
-    return $orderby;
2254
+	return $orderby;
2255 2255
 }
2256 2256
 
2257 2257
 /**
@@ -2266,18 +2266,18 @@  discard block
 block discarded – undo
2266 2266
  */
2267 2267
 function geodir_function_widget_listings_limit($limit)
2268 2268
 {
2269
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2269
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2270 2270
 
2271
-    $query_args = $gd_query_args_widgets;
2272
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2273
-        return $limit;
2274
-    }
2271
+	$query_args = $gd_query_args_widgets;
2272
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2273
+		return $limit;
2274
+	}
2275 2275
 
2276
-    if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2277
-        $limit = (int)$query_args['posts_per_page'];
2278
-    }
2276
+	if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2277
+		$limit = (int)$query_args['posts_per_page'];
2278
+	}
2279 2279
 
2280
-    return $limit;
2280
+	return $limit;
2281 2281
 }
2282 2282
 
2283 2283
 /**
@@ -2291,24 +2291,24 @@  discard block
 block discarded – undo
2291 2291
  */
2292 2292
 function geodir_media_image_large_width($default = 800, $params = '')
2293 2293
 {
2294
-    $large_size_w = get_option('large_size_w');
2295
-    $large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2296
-    $large_size_w = absint($large_size_w);
2297
-
2298
-    if (!get_option('geodir_use_wp_media_large_size')) {
2299
-        $large_size_w = 800;
2300
-    }
2301
-
2302
-    /**
2303
-     * Filter large image width.
2304
-     *
2305
-     * @since 1.0.0
2306
-     * @param int $large_size_w Large image width.
2307
-     * @param int $default Default width.
2308
-     * @param string|array $params Image parameters.
2309
-     */
2310
-    $large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2311
-    return $large_size_w;
2294
+	$large_size_w = get_option('large_size_w');
2295
+	$large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2296
+	$large_size_w = absint($large_size_w);
2297
+
2298
+	if (!get_option('geodir_use_wp_media_large_size')) {
2299
+		$large_size_w = 800;
2300
+	}
2301
+
2302
+	/**
2303
+	 * Filter large image width.
2304
+	 *
2305
+	 * @since 1.0.0
2306
+	 * @param int $large_size_w Large image width.
2307
+	 * @param int $default Default width.
2308
+	 * @param string|array $params Image parameters.
2309
+	 */
2310
+	$large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2311
+	return $large_size_w;
2312 2312
 }
2313 2313
 
2314 2314
 /**
@@ -2322,25 +2322,25 @@  discard block
 block discarded – undo
2322 2322
  */
2323 2323
 function geodir_media_image_large_height($default = 800, $params = '')
2324 2324
 {
2325
-    $large_size_h = get_option('large_size_h');
2326
-    $large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2327
-    $large_size_h = absint($large_size_h);
2328
-
2329
-    if (!get_option('geodir_use_wp_media_large_size')) {
2330
-        $large_size_h = 800;
2331
-    }
2332
-
2333
-    /**
2334
-     * Filter large image height.
2335
-     *
2336
-     * @since 1.0.0
2337
-     * @param int $large_size_h Large image height.
2338
-     * @param int $default Default height.
2339
-     * @param string|array $params Image parameters.
2340
-     */
2341
-    $large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2342
-
2343
-    return $large_size_h;
2325
+	$large_size_h = get_option('large_size_h');
2326
+	$large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2327
+	$large_size_h = absint($large_size_h);
2328
+
2329
+	if (!get_option('geodir_use_wp_media_large_size')) {
2330
+		$large_size_h = 800;
2331
+	}
2332
+
2333
+	/**
2334
+	 * Filter large image height.
2335
+	 *
2336
+	 * @since 1.0.0
2337
+	 * @param int $large_size_h Large image height.
2338
+	 * @param int $default Default height.
2339
+	 * @param string|array $params Image parameters.
2340
+	 */
2341
+	$large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2342
+
2343
+	return $large_size_h;
2344 2344
 }
2345 2345
 
2346 2346
 /**
@@ -2355,25 +2355,25 @@  discard block
 block discarded – undo
2355 2355
  */
2356 2356
 function geodir_sanitize_location_name($type, $name, $translate = true)
2357 2357
 {
2358
-    if ($name == '') {
2359
-        return NULL;
2360
-    }
2361
-
2362
-    $type = $type == 'gd_country' ? 'country' : $type;
2363
-    $type = $type == 'gd_region' ? 'region' : $type;
2364
-    $type = $type == 'gd_city' ? 'city' : $type;
2365
-
2366
-    $return = $name;
2367
-    if (function_exists('get_actual_location_name')) {
2368
-        $return = get_actual_location_name($type, $name, $translate);
2369
-    } else {
2370
-        $return = preg_replace('/-(\d+)$/', '', $return);
2371
-        $return = preg_replace('/[_-]/', ' ', $return);
2372
-        $return = geodir_ucwords($return);
2373
-        $return = $translate ? __($return, 'geodirectory') : $return;
2374
-    }
2375
-
2376
-    return $return;
2358
+	if ($name == '') {
2359
+		return NULL;
2360
+	}
2361
+
2362
+	$type = $type == 'gd_country' ? 'country' : $type;
2363
+	$type = $type == 'gd_region' ? 'region' : $type;
2364
+	$type = $type == 'gd_city' ? 'city' : $type;
2365
+
2366
+	$return = $name;
2367
+	if (function_exists('get_actual_location_name')) {
2368
+		$return = get_actual_location_name($type, $name, $translate);
2369
+	} else {
2370
+		$return = preg_replace('/-(\d+)$/', '', $return);
2371
+		$return = preg_replace('/[_-]/', ' ', $return);
2372
+		$return = geodir_ucwords($return);
2373
+		$return = $translate ? __($return, 'geodirectory') : $return;
2374
+	}
2375
+
2376
+	return $return;
2377 2377
 }
2378 2378
 
2379 2379
 
@@ -2387,14 +2387,14 @@  discard block
 block discarded – undo
2387 2387
 function geodir_comments_number($number)
2388 2388
 {
2389 2389
 
2390
-    if ($number > 1) {
2391
-        $output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2392
-    } elseif ($number == 0 || $number == '') {
2393
-        $output = __('No Reviews', 'geodirectory');
2394
-    } else { // must be one
2395
-        $output = __('1 Review', 'geodirectory');
2396
-    }
2397
-    echo $output;
2390
+	if ($number > 1) {
2391
+		$output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2392
+	} elseif ($number == 0 || $number == '') {
2393
+		$output = __('No Reviews', 'geodirectory');
2394
+	} else { // must be one
2395
+		$output = __('1 Review', 'geodirectory');
2396
+	}
2397
+	echo $output;
2398 2398
 }
2399 2399
 
2400 2400
 /**
@@ -2407,23 +2407,23 @@  discard block
 block discarded – undo
2407 2407
  */
2408 2408
 function is_page_geodir_home()
2409 2409
 {
2410
-    global $wpdb;
2411
-    $cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2412
-    if (function_exists('geodir_location_geo_home_link')) {
2413
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2414
-    }
2415
-    $home_url = home_url('', 'http');
2416
-    if (function_exists('geodir_location_geo_home_link')) {
2417
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2418
-    }
2419
-    $home_url = str_replace("www.", "", $home_url);
2420
-    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')) ) {
2421
-        return true;
2422
-    }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')){
2423
-        return true;
2424
-    } else {
2425
-        return false;
2426
-    }
2410
+	global $wpdb;
2411
+	$cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2412
+	if (function_exists('geodir_location_geo_home_link')) {
2413
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2414
+	}
2415
+	$home_url = home_url('', 'http');
2416
+	if (function_exists('geodir_location_geo_home_link')) {
2417
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2418
+	}
2419
+	$home_url = str_replace("www.", "", $home_url);
2420
+	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')) ) {
2421
+		return true;
2422
+	}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')){
2423
+		return true;
2424
+	} else {
2425
+		return false;
2426
+	}
2427 2427
 
2428 2428
 }
2429 2429
 
@@ -2439,13 +2439,13 @@  discard block
 block discarded – undo
2439 2439
  */
2440 2440
 function geodir_wpseo_homepage_canonical($url)
2441 2441
 {
2442
-    global $post;
2442
+	global $post;
2443 2443
 
2444
-    if (is_page_geodir_home()) {
2445
-        return home_url();
2446
-    }
2444
+	if (is_page_geodir_home()) {
2445
+		return home_url();
2446
+	}
2447 2447
 
2448
-    return $url;
2448
+	return $url;
2449 2449
 }
2450 2450
 
2451 2451
 add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10);
@@ -2462,16 +2462,16 @@  discard block
 block discarded – undo
2462 2462
  */
2463 2463
 function geodir_googlemap_script_extra_details_page($extra)
2464 2464
 {
2465
-    global $post;
2466
-    $add_google_places_api = false;
2467
-    if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2468
-        $add_google_places_api = true;
2469
-    }
2470
-    if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2471
-        $extra .= "&amp;libraries=places";
2472
-    }
2473
-
2474
-    return $extra;
2465
+	global $post;
2466
+	$add_google_places_api = false;
2467
+	if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2468
+		$add_google_places_api = true;
2469
+	}
2470
+	if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2471
+		$extra .= "&amp;libraries=places";
2472
+	}
2473
+
2474
+	return $extra;
2475 2475
 }
2476 2476
 
2477 2477
 add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1);
@@ -2491,98 +2491,98 @@  discard block
 block discarded – undo
2491 2491
  */
2492 2492
 function geodir_popular_post_category_output($args = '', $instance = '')
2493 2493
 {
2494
-    // prints the widget
2495
-    global $wpdb, $plugin_prefix, $geodir_post_category_str;
2496
-    extract($args, EXTR_SKIP);
2497
-
2498
-    echo $before_widget;
2499
-
2500
-    /** This filter is documented in geodirectory_widgets.php */
2501
-    $title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2502
-
2503
-    $gd_post_type = geodir_get_current_posttype();
2504
-
2505
-    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2506
-    if(!empty($gd_post_type)){
2507
-        $default_post_type = $gd_post_type;
2508
-    }elseif(isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ){
2509
-        $default_post_type = $instance['default_post_type'];
2510
-    }else{
2511
-        $all_gd_post_type = geodir_get_posttypes();
2512
-        $default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2513
-    }
2514
-
2515
-    $taxonomy = array();
2516
-    if (!empty($gd_post_type)) {
2517
-        $taxonomy[] = $gd_post_type . "category";
2518
-    } else {
2519
-        $taxonomy = geodir_get_taxonomies($gd_post_type);
2520
-    }
2521
-
2522
-    $terms = get_terms($taxonomy);
2523
-    $a_terms = array();
2524
-    $b_terms = array();
2525
-
2526
-    foreach ($terms as $term) {
2527
-        if ($term->count > 0) {
2528
-            $a_terms[$term->taxonomy][] = $term;
2529
-        }
2530
-    }
2531
-
2532
-    if (!empty($a_terms)) {
2533
-        foreach ($a_terms as $b_key => $b_val) {
2534
-            $b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2535
-        }
2536
-
2537
-        $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : '';
2538
-
2539
-        $tax_change_output = '';
2540
-        if (count($b_terms) > 1) {
2541
-            $tax_change_output .= "<select data-limit='$category_limit' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2542
-            foreach ($b_terms as $key => $val) {
2543
-                $ptype = get_post_type_object(str_replace("category", "", $key));
2544
-                $cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2545
-                $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2546
-            }
2547
-            $tax_change_output .= "</select>";
2548
-        }
2549
-
2550
-        if (!empty($b_terms)) {
2551
-            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2552
-            global $cat_count;//make global so we can change via function
2553
-            $cat_count = 0;
2554
-            ?>
2494
+	// prints the widget
2495
+	global $wpdb, $plugin_prefix, $geodir_post_category_str;
2496
+	extract($args, EXTR_SKIP);
2497
+
2498
+	echo $before_widget;
2499
+
2500
+	/** This filter is documented in geodirectory_widgets.php */
2501
+	$title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2502
+
2503
+	$gd_post_type = geodir_get_current_posttype();
2504
+
2505
+	$category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2506
+	if(!empty($gd_post_type)){
2507
+		$default_post_type = $gd_post_type;
2508
+	}elseif(isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ){
2509
+		$default_post_type = $instance['default_post_type'];
2510
+	}else{
2511
+		$all_gd_post_type = geodir_get_posttypes();
2512
+		$default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2513
+	}
2514
+
2515
+	$taxonomy = array();
2516
+	if (!empty($gd_post_type)) {
2517
+		$taxonomy[] = $gd_post_type . "category";
2518
+	} else {
2519
+		$taxonomy = geodir_get_taxonomies($gd_post_type);
2520
+	}
2521
+
2522
+	$terms = get_terms($taxonomy);
2523
+	$a_terms = array();
2524
+	$b_terms = array();
2525
+
2526
+	foreach ($terms as $term) {
2527
+		if ($term->count > 0) {
2528
+			$a_terms[$term->taxonomy][] = $term;
2529
+		}
2530
+	}
2531
+
2532
+	if (!empty($a_terms)) {
2533
+		foreach ($a_terms as $b_key => $b_val) {
2534
+			$b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2535
+		}
2536
+
2537
+		$default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : '';
2538
+
2539
+		$tax_change_output = '';
2540
+		if (count($b_terms) > 1) {
2541
+			$tax_change_output .= "<select data-limit='$category_limit' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2542
+			foreach ($b_terms as $key => $val) {
2543
+				$ptype = get_post_type_object(str_replace("category", "", $key));
2544
+				$cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2545
+				$tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2546
+			}
2547
+			$tax_change_output .= "</select>";
2548
+		}
2549
+
2550
+		if (!empty($b_terms)) {
2551
+			$terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2552
+			global $cat_count;//make global so we can change via function
2553
+			$cat_count = 0;
2554
+			?>
2555 2555
             <div class="geodir-category-list-in clearfix">
2556 2556
                 <div class="geodir-cat-list clearfix">
2557 2557
                     <?php
2558
-                    echo $before_title . __($title) . $after_title;
2558
+					echo $before_title . __($title) . $after_title;
2559 2559
 
2560
-                    echo $tax_change_output;
2560
+					echo $tax_change_output;
2561 2561
 
2562
-                    echo '<ul class="geodir-popular-cat-list">';
2562
+					echo '<ul class="geodir-popular-cat-list">';
2563 2563
 
2564
-                    geodir_helper_cat_list_output($terms, $category_limit);
2564
+					geodir_helper_cat_list_output($terms, $category_limit);
2565 2565
 
2566
-                    echo '</ul>';
2567
-                    ?>
2566
+					echo '</ul>';
2567
+					?>
2568 2568
                 </div>
2569 2569
                 <?php
2570
-                $hide = '';
2571
-                if ($cat_count < $category_limit) {
2572
-                    $hide = 'style="display:none;"';
2573
-                }
2574
-                echo "<div class='geodir-cat-list-more' $hide >";
2575
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>';
2576
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>';
2577
-                echo "</div>";
2578
-                /* add scripts */
2579
-                add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2580
-                ?>
2570
+				$hide = '';
2571
+				if ($cat_count < $category_limit) {
2572
+					$hide = 'style="display:none;"';
2573
+				}
2574
+				echo "<div class='geodir-cat-list-more' $hide >";
2575
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>';
2576
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>';
2577
+				echo "</div>";
2578
+				/* add scripts */
2579
+				add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2580
+				?>
2581 2581
             </div>
2582 2582
         <?php
2583
-        }
2584
-    }
2585
-    echo $after_widget;
2583
+		}
2584
+	}
2585
+	echo $after_widget;
2586 2586
 }
2587 2587
 
2588 2588
 /**
@@ -2596,38 +2596,38 @@  discard block
 block discarded – undo
2596 2596
  */
2597 2597
 function geodir_helper_cat_list_output($terms, $category_limit)
2598 2598
 {
2599
-    global $geodir_post_category_str, $cat_count;
2600
-    $term_icons = geodir_get_term_icon();
2599
+	global $geodir_post_category_str, $cat_count;
2600
+	$term_icons = geodir_get_term_icon();
2601 2601
 
2602
-    $geodir_post_category_str = array();
2602
+	$geodir_post_category_str = array();
2603 2603
 
2604 2604
 
2605
-    foreach ($terms as $cat) {
2606
-        $post_type = str_replace("category", "", $cat->taxonomy);
2607
-        $term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2605
+	foreach ($terms as $cat) {
2606
+		$post_type = str_replace("category", "", $cat->taxonomy);
2607
+		$term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2608 2608
 
2609
-        $cat_count++;
2609
+		$cat_count++;
2610 2610
 
2611
-        $geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2611
+		$geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2612 2612
 
2613
-        $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2614
-        $total_post = $cat->count;
2613
+		$class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2614
+		$total_post = $cat->count;
2615 2615
 
2616
-        $term_link = get_term_link( $cat, $cat->taxonomy );
2617
-        /**
2618
-         * Filer the category term link.
2619
-         *
2620
-         * @since 1.4.5
2621
-         * @param string $term_link The term permalink.
2622
-         * @param int    $cat->term_id The term id.
2623
-         * @param string $post_type Wordpress post type.
2624
-         */
2625
-        $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2616
+		$term_link = get_term_link( $cat, $cat->taxonomy );
2617
+		/**
2618
+		 * Filer the category term link.
2619
+		 *
2620
+		 * @since 1.4.5
2621
+		 * @param string $term_link The term permalink.
2622
+		 * @param int    $cat->term_id The term id.
2623
+		 * @param string $post_type Wordpress post type.
2624
+		 */
2625
+		$term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2626 2626
 
2627
-        echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2628
-        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> ';
2629
-        echo '</a></li>';
2630
-    }
2627
+		echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2628
+		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> ';
2629
+		echo '</a></li>';
2630
+	}
2631 2631
 }
2632 2632
 
2633 2633
 /**
@@ -2641,108 +2641,108 @@  discard block
 block discarded – undo
2641 2641
  */
2642 2642
 function geodir_listing_slider_widget_output($args = '', $instance = '')
2643 2643
 {
2644
-    // prints the widget
2645
-    extract($args, EXTR_SKIP);
2646
-
2647
-    echo $before_widget;
2648
-
2649
-    /** This filter is documented in geodirectory_widgets.php */
2650
-    $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2651
-    /**
2652
-     * Filter the widget post type.
2653
-     *
2654
-     * @since 1.0.0
2655
-     * @param string $instance['post_type'] Post type of listing.
2656
-     */
2657
-    $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2658
-    /**
2659
-     * Filter the widget's term.
2660
-     *
2661
-     * @since 1.0.0
2662
-     * @param string $instance['category'] Filter by term. Can be any valid term.
2663
-     */
2664
-    $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2665
-    /**
2666
-     * Filter the widget listings limit.
2667
-     *
2668
-     * @since 1.0.0
2669
-     * @param string $instance['post_number'] Number of listings to display.
2670
-     */
2671
-    $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2672
-    /**
2673
-     * Filter the widget listings limit shown at one time.
2674
-     *
2675
-     * @since 1.5.0
2676
-     * @param string $instance['max_show'] Number of listings to display on screen.
2677
-     */
2678
-    $max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
2679
-    /**
2680
-     * Filter the widget slide width.
2681
-     *
2682
-     * @since 1.5.0
2683
-     * @param string $instance['slide_width'] Width of the slides shown.
2684
-     */
2685
-    $slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
2686
-    /**
2687
-     * Filter widget's "show title" value.
2688
-     *
2689
-     * @since 1.0.0
2690
-     * @param string|bool $instance['show_title'] Do you want to display title? Can be 1 or 0.
2691
-     */
2692
-    $show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
2693
-    /**
2694
-     * Filter widget's "slideshow" value.
2695
-     *
2696
-     * @since 1.0.0
2697
-     * @param int $instance['slideshow'] Setup a slideshow for the slider to animate automatically.
2698
-     */
2699
-    $slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
2700
-    /**
2701
-     * Filter widget's "animationLoop" value.
2702
-     *
2703
-     * @since 1.0.0
2704
-     * @param int $instance['animationLoop'] Gives the slider a seamless infinite loop.
2705
-     */
2706
-    $animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
2707
-    /**
2708
-     * Filter widget's "directionNav" value.
2709
-     *
2710
-     * @since 1.0.0
2711
-     * @param int $instance['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
2712
-     */
2713
-    $directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
2714
-    /**
2715
-     * Filter widget's "slideshowSpeed" value.
2716
-     *
2717
-     * @since 1.0.0
2718
-     * @param int $instance['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
2719
-     */
2720
-    $slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
2721
-    /**
2722
-     * Filter widget's "animationSpeed" value.
2723
-     *
2724
-     * @since 1.0.0
2725
-     * @param int $instance['animationSpeed'] Set the speed of animations, in milliseconds.
2726
-     */
2727
-    $animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
2728
-    /**
2729
-     * Filter widget's "animation" value.
2730
-     *
2731
-     * @since 1.0.0
2732
-     * @param string $instance['animation'] Controls the animation type, "fade" or "slide".
2733
-     */
2734
-    $animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
2735
-    /**
2736
-     * Filter widget's "list_sort" type.
2737
-     *
2738
-     * @since 1.0.0
2739
-     * @param string $instance['list_sort'] Listing sort by type.
2740
-     */
2741
-    $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
2742
-    $show_featured_only = !empty($instance['show_featured_only']) ? 1 : NULL;
2743
-
2744
-    wp_enqueue_script('geodirectory-jquery-flexslider-js');
2745
-    ?>
2644
+	// prints the widget
2645
+	extract($args, EXTR_SKIP);
2646
+
2647
+	echo $before_widget;
2648
+
2649
+	/** This filter is documented in geodirectory_widgets.php */
2650
+	$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2651
+	/**
2652
+	 * Filter the widget post type.
2653
+	 *
2654
+	 * @since 1.0.0
2655
+	 * @param string $instance['post_type'] Post type of listing.
2656
+	 */
2657
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2658
+	/**
2659
+	 * Filter the widget's term.
2660
+	 *
2661
+	 * @since 1.0.0
2662
+	 * @param string $instance['category'] Filter by term. Can be any valid term.
2663
+	 */
2664
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2665
+	/**
2666
+	 * Filter the widget listings limit.
2667
+	 *
2668
+	 * @since 1.0.0
2669
+	 * @param string $instance['post_number'] Number of listings to display.
2670
+	 */
2671
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2672
+	/**
2673
+	 * Filter the widget listings limit shown at one time.
2674
+	 *
2675
+	 * @since 1.5.0
2676
+	 * @param string $instance['max_show'] Number of listings to display on screen.
2677
+	 */
2678
+	$max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
2679
+	/**
2680
+	 * Filter the widget slide width.
2681
+	 *
2682
+	 * @since 1.5.0
2683
+	 * @param string $instance['slide_width'] Width of the slides shown.
2684
+	 */
2685
+	$slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
2686
+	/**
2687
+	 * Filter widget's "show title" value.
2688
+	 *
2689
+	 * @since 1.0.0
2690
+	 * @param string|bool $instance['show_title'] Do you want to display title? Can be 1 or 0.
2691
+	 */
2692
+	$show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
2693
+	/**
2694
+	 * Filter widget's "slideshow" value.
2695
+	 *
2696
+	 * @since 1.0.0
2697
+	 * @param int $instance['slideshow'] Setup a slideshow for the slider to animate automatically.
2698
+	 */
2699
+	$slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
2700
+	/**
2701
+	 * Filter widget's "animationLoop" value.
2702
+	 *
2703
+	 * @since 1.0.0
2704
+	 * @param int $instance['animationLoop'] Gives the slider a seamless infinite loop.
2705
+	 */
2706
+	$animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
2707
+	/**
2708
+	 * Filter widget's "directionNav" value.
2709
+	 *
2710
+	 * @since 1.0.0
2711
+	 * @param int $instance['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
2712
+	 */
2713
+	$directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
2714
+	/**
2715
+	 * Filter widget's "slideshowSpeed" value.
2716
+	 *
2717
+	 * @since 1.0.0
2718
+	 * @param int $instance['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
2719
+	 */
2720
+	$slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
2721
+	/**
2722
+	 * Filter widget's "animationSpeed" value.
2723
+	 *
2724
+	 * @since 1.0.0
2725
+	 * @param int $instance['animationSpeed'] Set the speed of animations, in milliseconds.
2726
+	 */
2727
+	$animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
2728
+	/**
2729
+	 * Filter widget's "animation" value.
2730
+	 *
2731
+	 * @since 1.0.0
2732
+	 * @param string $instance['animation'] Controls the animation type, "fade" or "slide".
2733
+	 */
2734
+	$animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
2735
+	/**
2736
+	 * Filter widget's "list_sort" type.
2737
+	 *
2738
+	 * @since 1.0.0
2739
+	 * @param string $instance['list_sort'] Listing sort by type.
2740
+	 */
2741
+	$list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
2742
+	$show_featured_only = !empty($instance['show_featured_only']) ? 1 : NULL;
2743
+
2744
+	wp_enqueue_script('geodirectory-jquery-flexslider-js');
2745
+	?>
2746 2746
     <script type="text/javascript">
2747 2747
         jQuery(window).load(function () {
2748 2748
             jQuery('#geodir_widget_carousel').flexslider({
@@ -2783,86 +2783,86 @@  discard block
 block discarded – undo
2783 2783
         });
2784 2784
     </script>
2785 2785
     <?php
2786
-    $query_args = array(
2787
-        'posts_per_page' => $post_number,
2788
-        'is_geodir_loop' => true,
2789
-        'post_type' => $post_type,
2790
-        'order_by' => $list_sort
2791
-    );
2792
-    if ($show_featured_only) {
2793
-        $query_args['show_featured_only'] = 1;
2794
-    }
2795
-
2796
-    if ($category != 0 || $category != '') {
2797
-        $category_taxonomy = geodir_get_taxonomies($post_type);
2798
-        $tax_query = array(
2799
-            'taxonomy' => $category_taxonomy[0],
2800
-            'field' => 'id',
2801
-            'terms' => $category
2802
-        );
2803
-
2804
-        $query_args['tax_query'] = array($tax_query);
2805
-    }
2806
-
2807
-    // we want listings with featured image only
2808
-    $query_args['featured_image_only'] = 1;
2809
-
2810
-    if ($post_type == 'gd_event') {
2811
-        $query_args['gedir_event_listing_filter'] = 'upcoming';
2812
-    }// show only upcoming events
2813
-
2814
-    $widget_listings = geodir_get_widget_listings($query_args);
2815
-    if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
2816
-        if ($title) {
2817
-            echo $before_title . $title . $after_title;
2818
-        }
2819
-
2820
-        global $post;
2821
-
2822
-        $current_post = $post;// keep current post info
2823
-
2824
-        $widget_main_slides = '';
2825
-        $nav_slides = '';
2826
-        $widget_slides = 0;
2827
-
2828
-        foreach ($widget_listings as $widget_listing) {
2829
-            global $gd_widget_listing_type;
2830
-            $post = $widget_listing;
2831
-            $widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
2832
-
2833
-            if (!empty($widget_image)) {
2834
-                if ($widget_image->height >= 200) {
2835
-                    $widget_spacer_height = 0;
2836
-                } else {
2837
-                    $widget_spacer_height = ((200 - $widget_image->height) / 2);
2838
-                }
2839
-
2840
-                $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" />';
2841
-
2842
-                $title = '';
2843
-                if ($show_title) {
2844
-                    $title_html = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>';
2845
-                    $post_id = $post->ID;
2846
-                    $post_permalink = get_permalink($post->ID);
2847
-                    $post_title = get_the_title($post->ID);
2848
-                    /**
2849
-                     * Filter the listing slider widget title.
2850
-                     *
2851
-                     * @since 1.6.1
2852
-                     * @param string $title_html The html output of the title.
2853
-                     * @param int $post_id The post id.
2854
-                     * @param string $post_permalink The post permalink url.
2855
-                     * @param string $post_title The post title text.
2856
-                     */
2857
-                    $title = apply_filters('geodir_listing_slider_title',$title_html,$post_id,$post_permalink,$post_title);
2858
-                }
2859
-
2860
-                $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>';
2861
-                $nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
2862
-                $widget_slides++;
2863
-            }
2864
-        }
2865
-        ?>
2786
+	$query_args = array(
2787
+		'posts_per_page' => $post_number,
2788
+		'is_geodir_loop' => true,
2789
+		'post_type' => $post_type,
2790
+		'order_by' => $list_sort
2791
+	);
2792
+	if ($show_featured_only) {
2793
+		$query_args['show_featured_only'] = 1;
2794
+	}
2795
+
2796
+	if ($category != 0 || $category != '') {
2797
+		$category_taxonomy = geodir_get_taxonomies($post_type);
2798
+		$tax_query = array(
2799
+			'taxonomy' => $category_taxonomy[0],
2800
+			'field' => 'id',
2801
+			'terms' => $category
2802
+		);
2803
+
2804
+		$query_args['tax_query'] = array($tax_query);
2805
+	}
2806
+
2807
+	// we want listings with featured image only
2808
+	$query_args['featured_image_only'] = 1;
2809
+
2810
+	if ($post_type == 'gd_event') {
2811
+		$query_args['gedir_event_listing_filter'] = 'upcoming';
2812
+	}// show only upcoming events
2813
+
2814
+	$widget_listings = geodir_get_widget_listings($query_args);
2815
+	if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
2816
+		if ($title) {
2817
+			echo $before_title . $title . $after_title;
2818
+		}
2819
+
2820
+		global $post;
2821
+
2822
+		$current_post = $post;// keep current post info
2823
+
2824
+		$widget_main_slides = '';
2825
+		$nav_slides = '';
2826
+		$widget_slides = 0;
2827
+
2828
+		foreach ($widget_listings as $widget_listing) {
2829
+			global $gd_widget_listing_type;
2830
+			$post = $widget_listing;
2831
+			$widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
2832
+
2833
+			if (!empty($widget_image)) {
2834
+				if ($widget_image->height >= 200) {
2835
+					$widget_spacer_height = 0;
2836
+				} else {
2837
+					$widget_spacer_height = ((200 - $widget_image->height) / 2);
2838
+				}
2839
+
2840
+				$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" />';
2841
+
2842
+				$title = '';
2843
+				if ($show_title) {
2844
+					$title_html = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>';
2845
+					$post_id = $post->ID;
2846
+					$post_permalink = get_permalink($post->ID);
2847
+					$post_title = get_the_title($post->ID);
2848
+					/**
2849
+					 * Filter the listing slider widget title.
2850
+					 *
2851
+					 * @since 1.6.1
2852
+					 * @param string $title_html The html output of the title.
2853
+					 * @param int $post_id The post id.
2854
+					 * @param string $post_permalink The post permalink url.
2855
+					 * @param string $post_title The post title text.
2856
+					 */
2857
+					$title = apply_filters('geodir_listing_slider_title',$title_html,$post_id,$post_permalink,$post_title);
2858
+				}
2859
+
2860
+				$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>';
2861
+				$nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
2862
+				$widget_slides++;
2863
+			}
2864
+		}
2865
+		?>
2866 2866
         <div class="flex-container" style="min-height:200px;">
2867 2867
             <div class="geodir-listing-flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
2868 2868
             <div id="geodir_widget_slider" class="geodir_flexslider">
@@ -2875,10 +2875,10 @@  discard block
 block discarded – undo
2875 2875
             <?php } ?>
2876 2876
         </div>
2877 2877
         <?php
2878
-        $GLOBALS['post'] = $current_post;
2879
-        setup_postdata($current_post);
2880
-    }
2881
-    echo $after_widget;
2878
+		$GLOBALS['post'] = $current_post;
2879
+		setup_postdata($current_post);
2880
+	}
2881
+	echo $after_widget;
2882 2882
 }
2883 2883
 
2884 2884
 
@@ -2893,65 +2893,65 @@  discard block
 block discarded – undo
2893 2893
  */
2894 2894
 function geodir_loginwidget_output($args = '', $instance = '')
2895 2895
 {
2896
-    //print_r($args);
2897
-    //print_r($instance);
2898
-    // prints the widget
2899
-    extract($args, EXTR_SKIP);
2896
+	//print_r($args);
2897
+	//print_r($instance);
2898
+	// prints the widget
2899
+	extract($args, EXTR_SKIP);
2900 2900
 
2901
-    /** This filter is documented in geodirectory_widgets.php */
2902
-    $title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2901
+	/** This filter is documented in geodirectory_widgets.php */
2902
+	$title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2903 2903
 
2904
-    echo $before_widget;
2905
-    echo $before_title . $title . $after_title;
2904
+	echo $before_widget;
2905
+	echo $before_title . $title . $after_title;
2906 2906
 
2907
-    if (is_user_logged_in()) {
2908
-        global $current_user;
2907
+	if (is_user_logged_in()) {
2908
+		global $current_user;
2909 2909
 
2910
-        $author_link = get_author_posts_url($current_user->data->ID);
2911
-        $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
2910
+		$author_link = get_author_posts_url($current_user->data->ID);
2911
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
2912 2912
 
2913
-        echo '<ul class="geodir-loginbox-list">';
2914
-        ob_start();
2915
-        ?>
2913
+		echo '<ul class="geodir-loginbox-list">';
2914
+		ob_start();
2915
+		?>
2916 2916
         <li><a class="signin"
2917 2917
                href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li>
2918 2918
         <?php
2919
-        $post_types = geodir_get_posttypes('object');
2920
-        $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
2921
-        $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2919
+		$post_types = geodir_get_posttypes('object');
2920
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
2921
+		$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2922 2922
 
2923
-        if (!empty($show_add_listing_post_types_main_nav)) {
2924
-            $addlisting_links = '';
2925
-            foreach ($post_types as $key => $postobj) {
2923
+		if (!empty($show_add_listing_post_types_main_nav)) {
2924
+			$addlisting_links = '';
2925
+			foreach ($post_types as $key => $postobj) {
2926 2926
 
2927
-                if (in_array($key, $show_add_listing_post_types_main_nav)) {
2927
+				if (in_array($key, $show_add_listing_post_types_main_nav)) {
2928 2928
 
2929
-                    if ($add_link = geodir_get_addlisting_link($key)) {
2929
+					if ($add_link = geodir_get_addlisting_link($key)) {
2930 2930
 
2931
-                        $name = $postobj->labels->name;
2931
+						$name = $postobj->labels->name;
2932 2932
 
2933
-                        $selected = '';
2934
-                        if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing'))
2935
-                            $selected = 'selected="selected"';
2933
+						$selected = '';
2934
+						if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing'))
2935
+							$selected = 'selected="selected"';
2936 2936
 
2937
-                        /**
2938
-                         * Filter add listing link.
2939
-                         *
2940
-                         * @since 1.0.0
2941
-                         * @param string $add_link Add listing link.
2942
-                         * @param string $key Add listing array key.
2943
-                         * @param int $current_user->ID Current user ID.
2944
-                         */
2945
-                        $add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
2937
+						/**
2938
+						 * Filter add listing link.
2939
+						 *
2940
+						 * @since 1.0.0
2941
+						 * @param string $add_link Add listing link.
2942
+						 * @param string $key Add listing array key.
2943
+						 * @param int $current_user->ID Current user ID.
2944
+						 */
2945
+						$add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
2946 2946
 
2947
-                        $addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2947
+						$addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2948 2948
 
2949
-                    }
2950
-                }
2949
+					}
2950
+				}
2951 2951
 
2952
-            }
2952
+			}
2953 2953
 
2954
-            if ($addlisting_links != '') { ?>
2954
+			if ($addlisting_links != '') { ?>
2955 2955
 
2956 2956
                 <li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value"
2957 2957
                             option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false"
@@ -2960,42 +2960,42 @@  discard block
 block discarded – undo
2960 2960
                         <?php echo $addlisting_links; ?>
2961 2961
                     </select></li> <?php
2962 2962
 
2963
-            }
2964
-
2965
-        }
2966
-        // My Favourites in Dashboard
2967
-        $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
2968
-        $user_favourite = geodir_user_favourite_listing_count();
2969
-
2970
-        if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
2971
-            $favourite_links = '';
2972
-
2973
-            foreach ($post_types as $key => $postobj) {
2974
-                if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
2975
-                    $name = $postobj->labels->name;
2976
-                    $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
2977
-
2978
-                    $selected = '';
2979
-
2980
-                    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
2981
-                        $selected = 'selected="selected"';
2982
-                    }
2983
-                    /**
2984
-                     * Filter favorite listing link.
2985
-                     *
2986
-                     * @since 1.0.0
2987
-                     * @param string $post_type_link Favorite listing link.
2988
-                     * @param string $key Favorite listing array key.
2989
-                     * @param int $current_user->ID Current user ID.
2990
-                     */
2991
-                    $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
2992
-
2993
-                    $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2994
-                }
2995
-            }
2996
-
2997
-            if ($favourite_links != '') {
2998
-                ?>
2963
+			}
2964
+
2965
+		}
2966
+		// My Favourites in Dashboard
2967
+		$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
2968
+		$user_favourite = geodir_user_favourite_listing_count();
2969
+
2970
+		if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
2971
+			$favourite_links = '';
2972
+
2973
+			foreach ($post_types as $key => $postobj) {
2974
+				if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
2975
+					$name = $postobj->labels->name;
2976
+					$post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
2977
+
2978
+					$selected = '';
2979
+
2980
+					if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
2981
+						$selected = 'selected="selected"';
2982
+					}
2983
+					/**
2984
+					 * Filter favorite listing link.
2985
+					 *
2986
+					 * @since 1.0.0
2987
+					 * @param string $post_type_link Favorite listing link.
2988
+					 * @param string $key Favorite listing array key.
2989
+					 * @param int $current_user->ID Current user ID.
2990
+					 */
2991
+					$post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
2992
+
2993
+					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2994
+				}
2995
+			}
2996
+
2997
+			if ($favourite_links != '') {
2998
+				?>
2999 2999
                 <li>
3000 3000
                     <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
3001 3001
                             option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false"
@@ -3005,42 +3005,42 @@  discard block
 block discarded – undo
3005 3005
                     </select>
3006 3006
                 </li>
3007 3007
             <?php
3008
-            }
3009
-        }
3010
-
3011
-
3012
-        $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
3013
-        $user_listing = geodir_user_post_listing_count();
3014
-
3015
-        if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
3016
-            $listing_links = '';
3017
-
3018
-            foreach ($post_types as $key => $postobj) {
3019
-                if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
3020
-                    $name = $postobj->labels->name;
3021
-                    $listing_link = geodir_getlink($author_link, array('stype' => $key), false);
3022
-
3023
-                    $selected = '';
3024
-                    if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
3025
-                        $selected = 'selected="selected"';
3026
-                    }
3027
-
3028
-                    /**
3029
-                     * Filter my listing link.
3030
-                     *
3031
-                     * @since 1.0.0
3032
-                     * @param string $listing_link My listing link.
3033
-                     * @param string $key My listing array key.
3034
-                     * @param int $current_user->ID Current user ID.
3035
-                     */
3036
-                    $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
3037
-
3038
-                    $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
3039
-                }
3040
-            }
3041
-
3042
-            if ($listing_links != '') {
3043
-                ?>
3008
+			}
3009
+		}
3010
+
3011
+
3012
+		$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
3013
+		$user_listing = geodir_user_post_listing_count();
3014
+
3015
+		if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
3016
+			$listing_links = '';
3017
+
3018
+			foreach ($post_types as $key => $postobj) {
3019
+				if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
3020
+					$name = $postobj->labels->name;
3021
+					$listing_link = geodir_getlink($author_link, array('stype' => $key), false);
3022
+
3023
+					$selected = '';
3024
+					if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
3025
+						$selected = 'selected="selected"';
3026
+					}
3027
+
3028
+					/**
3029
+					 * Filter my listing link.
3030
+					 *
3031
+					 * @since 1.0.0
3032
+					 * @param string $listing_link My listing link.
3033
+					 * @param string $key My listing array key.
3034
+					 * @param int $current_user->ID Current user ID.
3035
+					 */
3036
+					$listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
3037
+
3038
+					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
3039
+				}
3040
+			}
3041
+
3042
+			if ($listing_links != '') {
3043
+				?>
3044 3044
                 <li>
3045 3045
                     <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
3046 3046
                             option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false"
@@ -3050,27 +3050,27 @@  discard block
 block discarded – undo
3050 3050
                     </select>
3051 3051
                 </li>
3052 3052
             <?php
3053
-            }
3054
-        }
3055
-
3056
-        $dashboard_link = ob_get_clean();
3057
-        /**
3058
-         * Filter dashboard links HTML.
3059
-         *
3060
-         * @since 1.0.0
3061
-         * @param string $dashboard_link Dashboard links HTML.
3062
-         */
3063
-        echo apply_filters('geodir_dashboard_links', $dashboard_link);
3064
-        echo '</ul>';
3065
-    } else {
3066
-        ?>
3053
+			}
3054
+		}
3055
+
3056
+		$dashboard_link = ob_get_clean();
3057
+		/**
3058
+		 * Filter dashboard links HTML.
3059
+		 *
3060
+		 * @since 1.0.0
3061
+		 * @param string $dashboard_link Dashboard links HTML.
3062
+		 */
3063
+		echo apply_filters('geodir_dashboard_links', $dashboard_link);
3064
+		echo '</ul>';
3065
+	} else {
3066
+		?>
3067 3067
         <?php
3068
-        /**
3069
-         * Filter signup form action link.
3070
-         *
3071
-         * @since 1.0.0
3072
-         */
3073
-        ?>
3068
+		/**
3069
+		 * Filter signup form action link.
3070
+		 *
3071
+		 * @since 1.0.0
3072
+		 */
3073
+		?>
3074 3074
         <form name="loginform" class="loginform1"
3075 3075
               action="<?php echo geodir_login_url(); ?>"
3076 3076
               method="post">
@@ -3090,28 +3090,28 @@  discard block
 block discarded – undo
3090 3090
 
3091 3091
                 <p class="geodir-new-forgot-link">
3092 3092
                     <?php
3093
-                    /**
3094
-                     * Filter signup page register form link.
3095
-                     *
3096
-                     * @since 1.0.0
3097
-                     */
3098
-                    ?>
3093
+					/**
3094
+					 * Filter signup page register form link.
3095
+					 *
3096
+					 * @since 1.0.0
3097
+					 */
3098
+					?>
3099 3099
                     <a href="<?php echo geodir_login_url(array('signup' => true)); ?>"
3100 3100
                        class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a>
3101 3101
 
3102 3102
                     <?php
3103
-                    /**
3104
-                     * Filter signup page forgot password form link.
3105
-                     *
3106
-                     * @since 1.0.0
3107
-                     */
3108
-                    ?>
3103
+					/**
3104
+					 * Filter signup page forgot password form link.
3105
+					 *
3106
+					 * @since 1.0.0
3107
+					 */
3108
+					?>
3109 3109
                     <a href="<?php echo geodir_login_url(array('forgot' => true)); ?>"
3110 3110
                        class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div>
3111 3111
         </form>
3112 3112
     <?php }
3113 3113
 
3114
-    echo $after_widget;
3114
+	echo $after_widget;
3115 3115
 }
3116 3116
 
3117 3117
 
@@ -3130,284 +3130,284 @@  discard block
 block discarded – undo
3130 3130
  * @param array|string $instance The settings for the particular instance of the widget.
3131 3131
  */
3132 3132
 function geodir_popular_postview_output($args = '', $instance = '') {
3133
-    global $gd_session;
3133
+	global $gd_session;
3134 3134
 	
3135
-    // prints the widget
3136
-    extract($args, EXTR_SKIP);
3137
-
3138
-    echo $before_widget;
3139
-
3140
-    /** This filter is documented in geodirectory_widgets.php */
3141
-    $title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
3142
-    /**
3143
-     * Filter the widget post type.
3144
-     *
3145
-     * @since 1.0.0
3146
-     * @param string $instance['post_type'] Post type of listing.
3147
-     */
3148
-    $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
3149
-    /**
3150
-     * Filter the widget's term.
3151
-     *
3152
-     * @since 1.0.0
3153
-     * @param string $instance['category'] Filter by term. Can be any valid term.
3154
-     */
3155
-    $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3156
-    /**
3157
-     * Filter the widget listings limit.
3158
-     *
3159
-     * @since 1.0.0
3160
-     * @param string $instance['post_number'] Number of listings to display.
3161
-     */
3162
-    $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3163
-    /**
3164
-     * Filter widget's "layout" type.
3165
-     *
3166
-     * @since 1.0.0
3167
-     * @param string $instance['layout'] Widget layout type.
3168
-     */
3169
-    $layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
3170
-    /**
3171
-     * Filter widget's "add_location_filter" value.
3172
-     *
3173
-     * @since 1.0.0
3174
-     * @param string|bool $instance['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3175
-     */
3176
-    $add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3177
-    /**
3178
-     * Filter widget's listing width.
3179
-     *
3180
-     * @since 1.0.0
3181
-     * @param string $instance['listing_width'] Listing width.
3182
-     */
3183
-    $listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3184
-    /**
3185
-     * Filter widget's "list_sort" type.
3186
-     *
3187
-     * @since 1.0.0
3188
-     * @param string $instance['list_sort'] Listing sort by type.
3189
-     */
3190
-    $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3191
-    $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3192
-
3193
-    // set post type to current viewing post type
3194
-    if ($use_viewing_post_type) {
3195
-        $current_post_type = geodir_get_current_posttype();
3196
-        if ($current_post_type != '' && $current_post_type != $post_type) {
3197
-            $post_type = $current_post_type;
3198
-            $category = array(); // old post type category will not work for current changed post type
3199
-        }
3200
-    }
3201
-    // replace widget title dynamically
3202
-    $posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory');
3203
-    $posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3204
-
3205
-    $title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3206
-    $title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3207
-
3208
-    if (isset($instance['character_count'])) {
3209
-        /**
3210
-         * Filter the widget's excerpt character count.
3211
-         *
3212
-         * @since 1.0.0
3213
-         * @param int $instance['character_count'] Excerpt character count.
3214
-         */
3215
-        $character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3216
-    } else {
3217
-        $character_count = '';
3218
-    }
3219
-
3220
-    if (empty($title) || $title == 'All') {
3221
-        $title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory');
3222
-    }
3223
-
3224
-    $location_url = array();
3225
-    $city = get_query_var('gd_city');
3226
-    if (!empty($city)) {
3227
-        $country = get_query_var('gd_country');
3228
-        $region = get_query_var('gd_region');
3229
-
3230
-        $geodir_show_location_url = get_option('geodir_show_location_url');
3231
-
3232
-        if ($geodir_show_location_url == 'all') {
3233
-            if ($country != '') {
3234
-                $location_url[] = $country;
3235
-            }
3236
-
3237
-            if ($region != '') {
3238
-                $location_url[] = $region;
3239
-            }
3240
-        } else if ($geodir_show_location_url == 'country_city') {
3241
-            if ($country != '') {
3242
-                $location_url[] = $country;
3243
-            }
3244
-        } else if ($geodir_show_location_url == 'region_city') {
3245
-            if ($region != '') {
3246
-                $location_url[] = $region;
3247
-            }
3248
-        }
3249
-
3250
-        $location_url[] = $city;
3251
-    }
3252
-
3253
-    $location_url = implode('/', $location_url);
3254
-    $skip_location = false;
3255
-    if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3256
-        $skip_location = true;
3257
-        $gd_session->un_set('gd_multi_location');
3258
-    }
3259
-
3260
-    if (get_option('permalink_structure')) {
3261
-        $viewall_url = get_post_type_archive_link($post_type);
3262
-    } else {
3263
-        $viewall_url = get_post_type_archive_link($post_type);
3264
-    }
3265
-
3266
-    if (!empty($category) && $category[0] != '0') {
3267
-        global $geodir_add_location_url;
3268
-
3269
-        $geodir_add_location_url = '0';
3270
-
3271
-        if ($add_location_filter != '0') {
3272
-            $geodir_add_location_url = '1';
3273
-        }
3274
-
3275
-        $viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3276
-
3277
-        $geodir_add_location_url = NULL;
3278
-    }
3279
-    if ($skip_location) {
3280
-        $gd_session->set('gd_multi_location', 1);
3281
-    }
3282
-
3283
-    if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3284
-
3285
-    $query_args = array(
3286
-        'posts_per_page' => $post_number,
3287
-        'is_geodir_loop' => true,
3288
-        'gd_location' => $add_location_filter ? true : false,
3289
-        'post_type' => $post_type,
3290
-        'order_by' => $list_sort
3291
-    );
3292
-
3293
-    if ($character_count) {
3294
-        $query_args['excerpt_length'] = $character_count;
3295
-    }
3296
-
3297
-    if (!empty($instance['show_featured_only'])) {
3298
-        $query_args['show_featured_only'] = 1;
3299
-    }
3300
-
3301
-    if (!empty($instance['show_special_only'])) {
3302
-        $query_args['show_special_only'] = 1;
3303
-    }
3304
-
3305
-    if (!empty($instance['with_pics_only'])) {
3306
-        $query_args['with_pics_only'] = 0;
3307
-        $query_args['featured_image_only'] = 1;
3308
-    }
3309
-
3310
-    if (!empty($instance['with_videos_only'])) {
3311
-        $query_args['with_videos_only'] = 1;
3312
-    }
3313
-    $with_no_results = !empty($instance['without_no_results']) ? false : true;
3314
-
3315
-    if (!empty($category) && $category[0] != '0') {
3316
-        $category_taxonomy = geodir_get_taxonomies($post_type);
3317
-
3318
-        ######### WPML #########
3319
-        if (function_exists('icl_object_id')) {
3320
-            $category = gd_lang_object_ids($category, $category_taxonomy[0]);
3321
-        }
3322
-        ######### WPML #########
3323
-
3324
-        $tax_query = array(
3325
-            'taxonomy' => $category_taxonomy[0],
3326
-            'field' => 'id',
3327
-            'terms' => $category
3328
-        );
3329
-
3330
-        $query_args['tax_query'] = array($tax_query);
3331
-    }
3332
-
3333
-    global $gridview_columns_widget, $geodir_is_widget_listing;
3334
-
3335
-    $widget_listings = geodir_get_widget_listings($query_args);
3336
-
3337
-    if (!empty($widget_listings) || $with_no_results) {
3338
-        ?>
3135
+	// prints the widget
3136
+	extract($args, EXTR_SKIP);
3137
+
3138
+	echo $before_widget;
3139
+
3140
+	/** This filter is documented in geodirectory_widgets.php */
3141
+	$title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
3142
+	/**
3143
+	 * Filter the widget post type.
3144
+	 *
3145
+	 * @since 1.0.0
3146
+	 * @param string $instance['post_type'] Post type of listing.
3147
+	 */
3148
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
3149
+	/**
3150
+	 * Filter the widget's term.
3151
+	 *
3152
+	 * @since 1.0.0
3153
+	 * @param string $instance['category'] Filter by term. Can be any valid term.
3154
+	 */
3155
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3156
+	/**
3157
+	 * Filter the widget listings limit.
3158
+	 *
3159
+	 * @since 1.0.0
3160
+	 * @param string $instance['post_number'] Number of listings to display.
3161
+	 */
3162
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3163
+	/**
3164
+	 * Filter widget's "layout" type.
3165
+	 *
3166
+	 * @since 1.0.0
3167
+	 * @param string $instance['layout'] Widget layout type.
3168
+	 */
3169
+	$layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
3170
+	/**
3171
+	 * Filter widget's "add_location_filter" value.
3172
+	 *
3173
+	 * @since 1.0.0
3174
+	 * @param string|bool $instance['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3175
+	 */
3176
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3177
+	/**
3178
+	 * Filter widget's listing width.
3179
+	 *
3180
+	 * @since 1.0.0
3181
+	 * @param string $instance['listing_width'] Listing width.
3182
+	 */
3183
+	$listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3184
+	/**
3185
+	 * Filter widget's "list_sort" type.
3186
+	 *
3187
+	 * @since 1.0.0
3188
+	 * @param string $instance['list_sort'] Listing sort by type.
3189
+	 */
3190
+	$list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3191
+	$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3192
+
3193
+	// set post type to current viewing post type
3194
+	if ($use_viewing_post_type) {
3195
+		$current_post_type = geodir_get_current_posttype();
3196
+		if ($current_post_type != '' && $current_post_type != $post_type) {
3197
+			$post_type = $current_post_type;
3198
+			$category = array(); // old post type category will not work for current changed post type
3199
+		}
3200
+	}
3201
+	// replace widget title dynamically
3202
+	$posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory');
3203
+	$posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3204
+
3205
+	$title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3206
+	$title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3207
+
3208
+	if (isset($instance['character_count'])) {
3209
+		/**
3210
+		 * Filter the widget's excerpt character count.
3211
+		 *
3212
+		 * @since 1.0.0
3213
+		 * @param int $instance['character_count'] Excerpt character count.
3214
+		 */
3215
+		$character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3216
+	} else {
3217
+		$character_count = '';
3218
+	}
3219
+
3220
+	if (empty($title) || $title == 'All') {
3221
+		$title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory');
3222
+	}
3223
+
3224
+	$location_url = array();
3225
+	$city = get_query_var('gd_city');
3226
+	if (!empty($city)) {
3227
+		$country = get_query_var('gd_country');
3228
+		$region = get_query_var('gd_region');
3229
+
3230
+		$geodir_show_location_url = get_option('geodir_show_location_url');
3231
+
3232
+		if ($geodir_show_location_url == 'all') {
3233
+			if ($country != '') {
3234
+				$location_url[] = $country;
3235
+			}
3236
+
3237
+			if ($region != '') {
3238
+				$location_url[] = $region;
3239
+			}
3240
+		} else if ($geodir_show_location_url == 'country_city') {
3241
+			if ($country != '') {
3242
+				$location_url[] = $country;
3243
+			}
3244
+		} else if ($geodir_show_location_url == 'region_city') {
3245
+			if ($region != '') {
3246
+				$location_url[] = $region;
3247
+			}
3248
+		}
3249
+
3250
+		$location_url[] = $city;
3251
+	}
3252
+
3253
+	$location_url = implode('/', $location_url);
3254
+	$skip_location = false;
3255
+	if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3256
+		$skip_location = true;
3257
+		$gd_session->un_set('gd_multi_location');
3258
+	}
3259
+
3260
+	if (get_option('permalink_structure')) {
3261
+		$viewall_url = get_post_type_archive_link($post_type);
3262
+	} else {
3263
+		$viewall_url = get_post_type_archive_link($post_type);
3264
+	}
3265
+
3266
+	if (!empty($category) && $category[0] != '0') {
3267
+		global $geodir_add_location_url;
3268
+
3269
+		$geodir_add_location_url = '0';
3270
+
3271
+		if ($add_location_filter != '0') {
3272
+			$geodir_add_location_url = '1';
3273
+		}
3274
+
3275
+		$viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3276
+
3277
+		$geodir_add_location_url = NULL;
3278
+	}
3279
+	if ($skip_location) {
3280
+		$gd_session->set('gd_multi_location', 1);
3281
+	}
3282
+
3283
+	if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3284
+
3285
+	$query_args = array(
3286
+		'posts_per_page' => $post_number,
3287
+		'is_geodir_loop' => true,
3288
+		'gd_location' => $add_location_filter ? true : false,
3289
+		'post_type' => $post_type,
3290
+		'order_by' => $list_sort
3291
+	);
3292
+
3293
+	if ($character_count) {
3294
+		$query_args['excerpt_length'] = $character_count;
3295
+	}
3296
+
3297
+	if (!empty($instance['show_featured_only'])) {
3298
+		$query_args['show_featured_only'] = 1;
3299
+	}
3300
+
3301
+	if (!empty($instance['show_special_only'])) {
3302
+		$query_args['show_special_only'] = 1;
3303
+	}
3304
+
3305
+	if (!empty($instance['with_pics_only'])) {
3306
+		$query_args['with_pics_only'] = 0;
3307
+		$query_args['featured_image_only'] = 1;
3308
+	}
3309
+
3310
+	if (!empty($instance['with_videos_only'])) {
3311
+		$query_args['with_videos_only'] = 1;
3312
+	}
3313
+	$with_no_results = !empty($instance['without_no_results']) ? false : true;
3314
+
3315
+	if (!empty($category) && $category[0] != '0') {
3316
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3317
+
3318
+		######### WPML #########
3319
+		if (function_exists('icl_object_id')) {
3320
+			$category = gd_lang_object_ids($category, $category_taxonomy[0]);
3321
+		}
3322
+		######### WPML #########
3323
+
3324
+		$tax_query = array(
3325
+			'taxonomy' => $category_taxonomy[0],
3326
+			'field' => 'id',
3327
+			'terms' => $category
3328
+		);
3329
+
3330
+		$query_args['tax_query'] = array($tax_query);
3331
+	}
3332
+
3333
+	global $gridview_columns_widget, $geodir_is_widget_listing;
3334
+
3335
+	$widget_listings = geodir_get_widget_listings($query_args);
3336
+
3337
+	if (!empty($widget_listings) || $with_no_results) {
3338
+		?>
3339 3339
         <div class="geodir_locations geodir_location_listing">
3340 3340
 
3341 3341
             <?php
3342
-            /**
3343
-             * Called before the div containing the title and view all link in popular post view widget.
3344
-             *
3345
-             * @since 1.0.0
3346
-             */
3347
-            do_action('geodir_before_view_all_link_in_widget'); ?>
3342
+			/**
3343
+			 * Called before the div containing the title and view all link in popular post view widget.
3344
+			 *
3345
+			 * @since 1.0.0
3346
+			 */
3347
+			do_action('geodir_before_view_all_link_in_widget'); ?>
3348 3348
             <div class="geodir_list_heading clearfix">
3349 3349
                 <?php echo $before_title . $title . $after_title; ?>
3350 3350
                 <a href="<?php echo $viewall_url; ?>"
3351 3351
                    class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3352 3352
             </div>
3353 3353
             <?php
3354
-            /**
3355
-             * Called after the div containing the title and view all link in popular post view widget.
3356
-             *
3357
-             * @since 1.0.0
3358
-             */
3359
-            do_action('geodir_after_view_all_link_in_widget'); ?>
3354
+			/**
3355
+			 * Called after the div containing the title and view all link in popular post view widget.
3356
+			 *
3357
+			 * @since 1.0.0
3358
+			 */
3359
+			do_action('geodir_after_view_all_link_in_widget'); ?>
3360 3360
             <?php
3361
-            if (strstr($layout, 'gridview')) {
3362
-                $listing_view_exp = explode('_', $layout);
3363
-                $gridview_columns_widget = $layout;
3364
-                $layout = $listing_view_exp[0];
3365
-            } else {
3366
-                $gridview_columns_widget = '';
3367
-            }
3368
-
3369
-            /**
3370
-             * Filter the widget listing listview template path.
3371
-             *
3372
-             * @since 1.0.0
3373
-             */
3374
-            $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3375
-            if (!isset($character_count)) {
3376
-                /**
3377
-                 * Filter the widget's excerpt character count.
3378
-                 *
3379
-                 * @since 1.0.0
3380
-                 * @param int $instance['character_count'] Excerpt character count.
3381
-                 */
3382
-                $character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3383
-            }
3384
-
3385
-            global $post, $map_jason, $map_canvas_arr;
3386
-
3387
-            $current_post = $post;
3388
-            $current_map_jason = $map_jason;
3389
-            $current_map_canvas_arr = $map_canvas_arr;
3390
-            $geodir_is_widget_listing = true;
3391
-
3392
-            /**
3393
-             * Includes related listing listview template.
3394
-             *
3395
-             * @since 1.0.0
3396
-             */
3397
-            include($template);
3398
-
3399
-            $geodir_is_widget_listing = false;
3400
-
3401
-            $GLOBALS['post'] = $current_post;
3402
-            if (!empty($current_post))
3403
-                setup_postdata($current_post);
3404
-            $map_jason = $current_map_jason;
3405
-            $map_canvas_arr = $current_map_canvas_arr;
3406
-            ?>
3361
+			if (strstr($layout, 'gridview')) {
3362
+				$listing_view_exp = explode('_', $layout);
3363
+				$gridview_columns_widget = $layout;
3364
+				$layout = $listing_view_exp[0];
3365
+			} else {
3366
+				$gridview_columns_widget = '';
3367
+			}
3368
+
3369
+			/**
3370
+			 * Filter the widget listing listview template path.
3371
+			 *
3372
+			 * @since 1.0.0
3373
+			 */
3374
+			$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3375
+			if (!isset($character_count)) {
3376
+				/**
3377
+				 * Filter the widget's excerpt character count.
3378
+				 *
3379
+				 * @since 1.0.0
3380
+				 * @param int $instance['character_count'] Excerpt character count.
3381
+				 */
3382
+				$character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3383
+			}
3384
+
3385
+			global $post, $map_jason, $map_canvas_arr;
3386
+
3387
+			$current_post = $post;
3388
+			$current_map_jason = $map_jason;
3389
+			$current_map_canvas_arr = $map_canvas_arr;
3390
+			$geodir_is_widget_listing = true;
3391
+
3392
+			/**
3393
+			 * Includes related listing listview template.
3394
+			 *
3395
+			 * @since 1.0.0
3396
+			 */
3397
+			include($template);
3398
+
3399
+			$geodir_is_widget_listing = false;
3400
+
3401
+			$GLOBALS['post'] = $current_post;
3402
+			if (!empty($current_post))
3403
+				setup_postdata($current_post);
3404
+			$map_jason = $current_map_jason;
3405
+			$map_canvas_arr = $current_map_canvas_arr;
3406
+			?>
3407 3407
         </div>
3408 3408
     <?php
3409
-    }
3410
-    echo $after_widget;
3409
+	}
3410
+	echo $after_widget;
3411 3411
 
3412 3412
 }
3413 3413
 
@@ -3430,26 +3430,26 @@  discard block
 block discarded – undo
3430 3430
  */
3431 3431
 function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type)
3432 3432
 {
3433
-    global $wpdb, $plugin_prefix;
3433
+	global $wpdb, $plugin_prefix;
3434 3434
 
3435
-    $detail_table = $plugin_prefix . $post_type . '_detail';
3435
+	$detail_table = $plugin_prefix . $post_type . '_detail';
3436 3436
 
3437
-    $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 . ")";
3437
+	$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 . ")";
3438 3438
 
3439
-    /**
3440
-     * Filter count review sql query.
3441
-     *
3442
-     * @since 1.5.1
3443
-     * @param string $sql Database sql query..
3444
-     * @param int $term_id The term ID.
3445
-     * @param int $taxonomy The taxonomy Id.
3446
-     * @param string $post_type The post type.
3447
-     */
3448
-    $sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3439
+	/**
3440
+	 * Filter count review sql query.
3441
+	 *
3442
+	 * @since 1.5.1
3443
+	 * @param string $sql Database sql query..
3444
+	 * @param int $term_id The term ID.
3445
+	 * @param int $taxonomy The taxonomy Id.
3446
+	 * @param string $post_type The post type.
3447
+	 */
3448
+	$sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3449 3449
 
3450
-    $count = $wpdb->get_var($sql);
3450
+	$count = $wpdb->get_var($sql);
3451 3451
 
3452
-    return $count;
3452
+	return $count;
3453 3453
 }
3454 3454
 
3455 3455
 /**
@@ -3465,90 +3465,90 @@  discard block
 block discarded – undo
3465 3465
  * @return array Term array data.
3466 3466
  */
3467 3467
 function geodir_count_reviews_by_terms($force_update = false, $post_ID = 0) {
3468
-    /**
3469
-     * Filter review count option data.
3470
-     *
3471
-     * @since 1.0.0
3472
-     * @since 1.6.1 Added $post_ID param.
3473
-     * @param bool $force_update Force update option value?. Default.false.
3474
-     * @param int $post_ID The post id to update if any.
3475
-     */
3476
-    $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update,$post_ID);
3477
-    if (!empty($option_data)) {
3478
-        return $option_data;
3479
-    }
3480
-
3481
-    $option_data = get_option('geodir_global_review_count');
3482
-
3483
-    if (!$option_data || $force_update) {
3484
-        if ((int)$post_ID > 0) { // Update reviews count for specific post categories only.
3485
-            global $gd_session;
3486
-            $term_array = (array)$option_data;
3487
-            $post_type = get_post_type($post_ID);
3488
-            $taxonomy = $post_type . 'category';
3489
-            $terms = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3490
-
3491
-            if (!empty($terms) && !is_wp_error($terms)) {
3492
-                foreach ($terms as $term_id) {
3493
-                    $count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3494
-                    $children = get_term_children($term_id, $taxonomy);
3495
-                    $term_array[$term_id] = $count;
3496
-                }
3497
-            }
3468
+	/**
3469
+	 * Filter review count option data.
3470
+	 *
3471
+	 * @since 1.0.0
3472
+	 * @since 1.6.1 Added $post_ID param.
3473
+	 * @param bool $force_update Force update option value?. Default.false.
3474
+	 * @param int $post_ID The post id to update if any.
3475
+	 */
3476
+	$option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update,$post_ID);
3477
+	if (!empty($option_data)) {
3478
+		return $option_data;
3479
+	}
3480
+
3481
+	$option_data = get_option('geodir_global_review_count');
3482
+
3483
+	if (!$option_data || $force_update) {
3484
+		if ((int)$post_ID > 0) { // Update reviews count for specific post categories only.
3485
+			global $gd_session;
3486
+			$term_array = (array)$option_data;
3487
+			$post_type = get_post_type($post_ID);
3488
+			$taxonomy = $post_type . 'category';
3489
+			$terms = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3490
+
3491
+			if (!empty($terms) && !is_wp_error($terms)) {
3492
+				foreach ($terms as $term_id) {
3493
+					$count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3494
+					$children = get_term_children($term_id, $taxonomy);
3495
+					$term_array[$term_id] = $count;
3496
+				}
3497
+			}
3498 3498
             
3499
-            $session_listing = $gd_session->get('listing');
3499
+			$session_listing = $gd_session->get('listing');
3500 3500
             
3501
-            $terms = array();
3502
-            if (isset($_POST['post_category'][$taxonomy])) {
3503
-                $terms = (array)$_POST['post_category'][$taxonomy];
3504
-            } else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
3505
-                $terms = (array)$session_listing['post_category'][$taxonomy];
3506
-            }
3501
+			$terms = array();
3502
+			if (isset($_POST['post_category'][$taxonomy])) {
3503
+				$terms = (array)$_POST['post_category'][$taxonomy];
3504
+			} else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
3505
+				$terms = (array)$session_listing['post_category'][$taxonomy];
3506
+			}
3507 3507
             
3508
-            if (!empty($terms)) {
3509
-                foreach ($terms as $term_id) {
3510
-                    if ($term_id > 0) {
3511
-                        $count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3512
-                        $children = get_term_children($term_id, $taxonomy);
3513
-                        $term_array[$term_id] = $count;
3514
-                    }
3515
-                }
3516
-            }
3517
-        } else { // Update reviews count for all post categories.
3518
-            $term_array = array();
3519
-            $post_types = geodir_get_posttypes();
3520
-            foreach ($post_types as $post_type) {
3521
-
3522
-                $taxonomy = geodir_get_taxonomies($post_type);
3523
-                $taxonomy = $taxonomy[0];
3524
-
3525
-                $args = array(
3526
-                    'hide_empty' => false
3527
-                );
3528
-
3529
-                $terms = get_terms($taxonomy, $args);
3530
-
3531
-                foreach ($terms as $term) {
3532
-                    $count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3533
-                    $children = get_term_children($term->term_id, $taxonomy);
3534
-                    /*if ( is_array( $children ) ) {
3508
+			if (!empty($terms)) {
3509
+				foreach ($terms as $term_id) {
3510
+					if ($term_id > 0) {
3511
+						$count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3512
+						$children = get_term_children($term_id, $taxonomy);
3513
+						$term_array[$term_id] = $count;
3514
+					}
3515
+				}
3516
+			}
3517
+		} else { // Update reviews count for all post categories.
3518
+			$term_array = array();
3519
+			$post_types = geodir_get_posttypes();
3520
+			foreach ($post_types as $post_type) {
3521
+
3522
+				$taxonomy = geodir_get_taxonomies($post_type);
3523
+				$taxonomy = $taxonomy[0];
3524
+
3525
+				$args = array(
3526
+					'hide_empty' => false
3527
+				);
3528
+
3529
+				$terms = get_terms($taxonomy, $args);
3530
+
3531
+				foreach ($terms as $term) {
3532
+					$count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3533
+					$children = get_term_children($term->term_id, $taxonomy);
3534
+					/*if ( is_array( $children ) ) {
3535 3535
                         foreach ( $children as $child_id ) {
3536 3536
                             $child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type);
3537 3537
                             $count = $count + $child_count;
3538 3538
                         }
3539 3539
                     }*/
3540
-                    $term_array[$term->term_id] = $count;
3541
-                }
3542
-            }
3543
-        }
3544
-
3545
-        update_option('geodir_global_review_count', $term_array);
3546
-        //clear cache
3547
-        wp_cache_delete('geodir_global_review_count');
3548
-        return $term_array;
3549
-    } else {
3550
-        return $option_data;
3551
-    }
3540
+					$term_array[$term->term_id] = $count;
3541
+				}
3542
+			}
3543
+		}
3544
+
3545
+		update_option('geodir_global_review_count', $term_array);
3546
+		//clear cache
3547
+		wp_cache_delete('geodir_global_review_count');
3548
+		return $term_array;
3549
+	} else {
3550
+		return $option_data;
3551
+	}
3552 3552
 }
3553 3553
 
3554 3554
 /**
@@ -3560,38 +3560,38 @@  discard block
 block discarded – undo
3560 3560
  * @return bool
3561 3561
  */
3562 3562
 function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '') {
3563
-    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {
3564
-        return; // do not run if importing listings
3565
-    }
3563
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {
3564
+		return; // do not run if importing listings
3565
+	}
3566 3566
     
3567
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
3568
-        return;
3569
-    }
3570
-
3571
-    $post_ID = 0;
3572
-    if (!empty($post)) {
3573
-        if (isset($post->post_type) && strpos($post->post_type, 'gd_') !== 0) {
3574
-            return;
3575
-        }
3567
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
3568
+		return;
3569
+	}
3570
+
3571
+	$post_ID = 0;
3572
+	if (!empty($post)) {
3573
+		if (isset($post->post_type) && strpos($post->post_type, 'gd_') !== 0) {
3574
+			return;
3575
+		}
3576 3576
         
3577
-        if ($new_status == 'auto-draft' && $old_status == 'new') {
3578
-            return;
3579
-        }
3577
+		if ($new_status == 'auto-draft' && $old_status == 'new') {
3578
+			return;
3579
+		}
3580 3580
         
3581
-        if (!empty($post->ID)) {
3582
-            $post_ID = $post->ID;
3583
-        }
3584
-    }
3581
+		if (!empty($post->ID)) {
3582
+			$post_ID = $post->ID;
3583
+		}
3584
+	}
3585 3585
 
3586
-    if ($new_status != $old_status) {
3587
-        geodir_count_reviews_by_terms(true, $post_ID);
3588
-    }
3586
+	if ($new_status != $old_status) {
3587
+		geodir_count_reviews_by_terms(true, $post_ID);
3588
+	}
3589 3589
 
3590
-    return true;
3590
+	return true;
3591 3591
 }
3592 3592
 
3593 3593
 function geodir_term_review_count_force_update_single_post($post_id){
3594
-    geodir_count_reviews_by_terms(true, $post_id); 
3594
+	geodir_count_reviews_by_terms(true, $post_id); 
3595 3595
 }
3596 3596
 
3597 3597
 /*-----------------------------------------------------------------------------------*/
@@ -3609,15 +3609,15 @@  discard block
 block discarded – undo
3609 3609
 function geodir_count_posts_by_term($data, $term)
3610 3610
 {
3611 3611
 
3612
-    if ($data) {
3613
-        if (isset($data[$term->term_id])) {
3614
-            return $data[$term->term_id];
3615
-        } else {
3616
-            return 0;
3617
-        }
3618
-    } else {
3619
-        return $term->count;
3620
-    }
3612
+	if ($data) {
3613
+		if (isset($data[$term->term_id])) {
3614
+			return $data[$term->term_id];
3615
+		} else {
3616
+			return 0;
3617
+		}
3618
+	} else {
3619
+		return $term->count;
3620
+	}
3621 3621
 }
3622 3622
 
3623 3623
 /**
@@ -3630,8 +3630,8 @@  discard block
 block discarded – undo
3630 3630
  */
3631 3631
 function geodir_sort_terms_by_count($terms)
3632 3632
 {
3633
-    usort($terms, "geodir_sort_by_count_obj");
3634
-    return $terms;
3633
+	usort($terms, "geodir_sort_by_count_obj");
3634
+	return $terms;
3635 3635
 }
3636 3636
 
3637 3637
 /**
@@ -3644,8 +3644,8 @@  discard block
 block discarded – undo
3644 3644
  */
3645 3645
 function geodir_sort_terms_by_review_count($terms)
3646 3646
 {
3647
-    usort($terms, "geodir_sort_by_review_count_obj");
3648
-    return $terms;
3647
+	usort($terms, "geodir_sort_by_review_count_obj");
3648
+	return $terms;
3649 3649
 }
3650 3650
 
3651 3651
 /**
@@ -3659,12 +3659,12 @@  discard block
 block discarded – undo
3659 3659
  */
3660 3660
 function geodir_sort_terms($terms, $sort = 'count')
3661 3661
 {
3662
-    if ($sort == 'count') {
3663
-        return geodir_sort_terms_by_count($terms);
3664
-    }
3665
-    if ($sort == 'review_count') {
3666
-        return geodir_sort_terms_by_review_count($terms);
3667
-    }
3662
+	if ($sort == 'count') {
3663
+		return geodir_sort_terms_by_count($terms);
3664
+	}
3665
+	if ($sort == 'review_count') {
3666
+		return geodir_sort_terms_by_review_count($terms);
3667
+	}
3668 3668
 }
3669 3669
 
3670 3670
 /*-----------------------------------------------------------------------------------*/
@@ -3681,7 +3681,7 @@  discard block
 block discarded – undo
3681 3681
  */
3682 3682
 function geodir_sort_by_count($a, $b)
3683 3683
 {
3684
-    return $a['count'] < $b['count'];
3684
+	return $a['count'] < $b['count'];
3685 3685
 }
3686 3686
 
3687 3687
 /**
@@ -3695,7 +3695,7 @@  discard block
 block discarded – undo
3695 3695
  */
3696 3696
 function geodir_sort_by_count_obj($a, $b)
3697 3697
 {
3698
-    return $a->count < $b->count;
3698
+	return $a->count < $b->count;
3699 3699
 }
3700 3700
 
3701 3701
 /**
@@ -3709,7 +3709,7 @@  discard block
 block discarded – undo
3709 3709
  */
3710 3710
 function geodir_sort_by_review_count_obj($a, $b)
3711 3711
 {
3712
-    return $a->review_count < $b->review_count;
3712
+	return $a->review_count < $b->review_count;
3713 3713
 }
3714 3714
 
3715 3715
 /**
@@ -3719,43 +3719,43 @@  discard block
 block discarded – undo
3719 3719
  * @package GeoDirectory
3720 3720
  */
3721 3721
 function geodir_load_textdomain() {
3722
-    /**
3723
-     * Filter the plugin locale.
3724
-     *
3725
-     * @since 1.4.2
3726
-     * @package GeoDirectory
3727
-     */
3728
-    $locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
3729
-
3730
-    load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo');
3731
-    load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages');
3732
-
3733
-    /**
3734
-     * Define language constants.
3735
-     *
3736
-     * @since 1.0.0
3737
-     */
3738
-    require_once(geodir_plugin_path() . '/language.php');
3739
-
3740
-    $language_file = geodir_plugin_path() . '/db-language.php';
3741
-
3742
-    // Load language string file if not created yet
3743
-    if (!file_exists($language_file)) {
3744
-        geodirectory_load_db_language();
3745
-    }
3746
-
3747
-    if (file_exists($language_file)) {
3748
-        /**
3749
-         * Language strings from database.
3750
-         *
3751
-         * @since 1.4.2
3752
-         */
3753
-        try {
3754
-            require_once($language_file);
3755
-        } catch(Exception $e) {
3756
-            error_log('Language Error: ' . $e->getMessage());
3757
-        }
3758
-    }
3722
+	/**
3723
+	 * Filter the plugin locale.
3724
+	 *
3725
+	 * @since 1.4.2
3726
+	 * @package GeoDirectory
3727
+	 */
3728
+	$locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
3729
+
3730
+	load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo');
3731
+	load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages');
3732
+
3733
+	/**
3734
+	 * Define language constants.
3735
+	 *
3736
+	 * @since 1.0.0
3737
+	 */
3738
+	require_once(geodir_plugin_path() . '/language.php');
3739
+
3740
+	$language_file = geodir_plugin_path() . '/db-language.php';
3741
+
3742
+	// Load language string file if not created yet
3743
+	if (!file_exists($language_file)) {
3744
+		geodirectory_load_db_language();
3745
+	}
3746
+
3747
+	if (file_exists($language_file)) {
3748
+		/**
3749
+		 * Language strings from database.
3750
+		 *
3751
+		 * @since 1.4.2
3752
+		 */
3753
+		try {
3754
+			require_once($language_file);
3755
+		} catch(Exception $e) {
3756
+			error_log('Language Error: ' . $e->getMessage());
3757
+		}
3758
+	}
3759 3759
 }
3760 3760
 
3761 3761
 /**
@@ -3769,66 +3769,66 @@  discard block
 block discarded – undo
3769 3769
  * @return bool True if file created otherwise false
3770 3770
  */
3771 3771
 function geodirectory_load_db_language() {
3772
-    global $wp_filesystem;
3773
-    if( empty( $wp_filesystem ) ) {
3774
-        require_once( ABSPATH .'/wp-admin/includes/file.php' );
3775
-        WP_Filesystem();
3776
-        global $wp_filesystem;
3777
-    }
3778
-
3779
-    $language_file = geodir_plugin_path() . '/db-language.php';
3780
-
3781
-    if(is_file($language_file) && !is_writable($language_file))
3782
-        return false; // Not possible to create.
3783
-
3784
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3785
-        return false; // Not possible to create.
3786
-
3787
-    $contents_strings = array();
3788
-
3789
-    /**
3790
-     * Filter the language string from database to translate via po editor
3791
-     *
3792
-     * @since 1.4.2
3793
-     *
3794
-     * @param array $contents_strings Array of strings.
3795
-     */
3796
-    $contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
3797
-
3798
-    $contents_strings = array_unique($contents_strings);
3799
-
3800
-    $contents_head = array();
3801
-    $contents_head[] = "<?php";
3802
-    $contents_head[] = "/**";
3803
-    $contents_head[] = " * Translate language string stored in database. Ex: Custom Fields";
3804
-    $contents_head[] = " *";
3805
-    $contents_head[] = " * @package GeoDirectory";
3806
-    $contents_head[] = " * @since 1.4.2";
3807
-    $contents_head[] = " */";
3808
-    $contents_head[] = "";
3809
-    $contents_head[] = "// Language keys";
3810
-
3811
-    $contents_foot = array();
3812
-    $contents_foot[] = "";
3813
-    $contents_foot[] = "";
3814
-
3815
-    $contents = implode(PHP_EOL, $contents_head);
3816
-
3817
-    if (!empty($contents_strings)) {
3818
-        foreach ( $contents_strings as $string ) {
3819
-            if (is_scalar($string) && $string != '') {
3820
-                $string = str_replace("'", "\'", $string);
3821
-                $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
3822
-            }
3823
-        }
3824
-    }
3825
-
3826
-    $contents .= implode(PHP_EOL, $contents_foot);
3827
-
3828
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3829
-        return false; // Failure; could not write file.
3830
-
3831
-    return true;
3772
+	global $wp_filesystem;
3773
+	if( empty( $wp_filesystem ) ) {
3774
+		require_once( ABSPATH .'/wp-admin/includes/file.php' );
3775
+		WP_Filesystem();
3776
+		global $wp_filesystem;
3777
+	}
3778
+
3779
+	$language_file = geodir_plugin_path() . '/db-language.php';
3780
+
3781
+	if(is_file($language_file) && !is_writable($language_file))
3782
+		return false; // Not possible to create.
3783
+
3784
+	if(!is_file($language_file) && !is_writable(dirname($language_file)))
3785
+		return false; // Not possible to create.
3786
+
3787
+	$contents_strings = array();
3788
+
3789
+	/**
3790
+	 * Filter the language string from database to translate via po editor
3791
+	 *
3792
+	 * @since 1.4.2
3793
+	 *
3794
+	 * @param array $contents_strings Array of strings.
3795
+	 */
3796
+	$contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
3797
+
3798
+	$contents_strings = array_unique($contents_strings);
3799
+
3800
+	$contents_head = array();
3801
+	$contents_head[] = "<?php";
3802
+	$contents_head[] = "/**";
3803
+	$contents_head[] = " * Translate language string stored in database. Ex: Custom Fields";
3804
+	$contents_head[] = " *";
3805
+	$contents_head[] = " * @package GeoDirectory";
3806
+	$contents_head[] = " * @since 1.4.2";
3807
+	$contents_head[] = " */";
3808
+	$contents_head[] = "";
3809
+	$contents_head[] = "// Language keys";
3810
+
3811
+	$contents_foot = array();
3812
+	$contents_foot[] = "";
3813
+	$contents_foot[] = "";
3814
+
3815
+	$contents = implode(PHP_EOL, $contents_head);
3816
+
3817
+	if (!empty($contents_strings)) {
3818
+		foreach ( $contents_strings as $string ) {
3819
+			if (is_scalar($string) && $string != '') {
3820
+				$string = str_replace("'", "\'", $string);
3821
+				$contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
3822
+			}
3823
+		}
3824
+	}
3825
+
3826
+	$contents .= implode(PHP_EOL, $contents_foot);
3827
+
3828
+	if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3829
+		return false; // Failure; could not write file.
3830
+
3831
+	return true;
3832 3832
 }
3833 3833
 
3834 3834
 /**
@@ -3844,31 +3844,31 @@  discard block
 block discarded – undo
3844 3844
  * @return array Translation texts.
3845 3845
  */
3846 3846
 function geodir_load_custom_field_translation($translation_texts = array()) {
3847
-    global $wpdb;
3847
+	global $wpdb;
3848 3848
 
3849
-    // Custom fields table
3850
-    $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
3851
-    $rows = $wpdb->get_results($sql);
3849
+	// Custom fields table
3850
+	$sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
3851
+	$rows = $wpdb->get_results($sql);
3852 3852
 
3853
-    if (!empty($rows)) {
3854
-        foreach($rows as $row) {
3855
-            if (!empty($row->admin_title))
3856
-                $translation_texts[] = stripslashes_deep($row->admin_title);
3853
+	if (!empty($rows)) {
3854
+		foreach($rows as $row) {
3855
+			if (!empty($row->admin_title))
3856
+				$translation_texts[] = stripslashes_deep($row->admin_title);
3857 3857
 			
3858
-            if (!empty($row->admin_desc))
3859
-                $translation_texts[] = stripslashes_deep($row->admin_desc);
3858
+			if (!empty($row->admin_desc))
3859
+				$translation_texts[] = stripslashes_deep($row->admin_desc);
3860 3860
 
3861
-            if (!empty($row->site_title))
3862
-                $translation_texts[] = stripslashes_deep($row->site_title);
3861
+			if (!empty($row->site_title))
3862
+				$translation_texts[] = stripslashes_deep($row->site_title);
3863 3863
 
3864
-            if (!empty($row->clabels))
3865
-                $translation_texts[] = stripslashes_deep($row->clabels);
3864
+			if (!empty($row->clabels))
3865
+				$translation_texts[] = stripslashes_deep($row->clabels);
3866 3866
 
3867
-            if (!empty($row->required_msg))
3868
-                $translation_texts[] = stripslashes_deep($row->required_msg);
3867
+			if (!empty($row->required_msg))
3868
+				$translation_texts[] = stripslashes_deep($row->required_msg);
3869 3869
 			
3870 3870
 			if (!empty($row->default_value))
3871
-                $translation_texts[] = stripslashes_deep($row->default_value);
3871
+				$translation_texts[] = stripslashes_deep($row->default_value);
3872 3872
 			
3873 3873
 			if (!empty($row->option_values)) {
3874 3874
 				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
@@ -3881,25 +3881,25 @@  discard block
 block discarded – undo
3881 3881
 					}
3882 3882
 				}
3883 3883
 			}
3884
-        }
3885
-    }
3884
+		}
3885
+	}
3886 3886
 	
3887
-    // Custom sorting fields table
3888
-    $sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3889
-    $rows = $wpdb->get_results($sql);
3890
-
3891
-    if (!empty($rows)) {
3892
-        foreach($rows as $row) {
3893
-            if (!empty($row->site_title))
3894
-                $translation_texts[] = stripslashes_deep($row->site_title);
3895
-
3896
-            if (!empty($row->asc_title))
3897
-                $translation_texts[] = stripslashes_deep($row->asc_title);
3898
-
3899
-            if (!empty($row->desc_title))
3900
-                $translation_texts[] = stripslashes_deep($row->desc_title);
3901
-        }
3902
-    }
3887
+	// Custom sorting fields table
3888
+	$sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3889
+	$rows = $wpdb->get_results($sql);
3890
+
3891
+	if (!empty($rows)) {
3892
+		foreach($rows as $row) {
3893
+			if (!empty($row->site_title))
3894
+				$translation_texts[] = stripslashes_deep($row->site_title);
3895
+
3896
+			if (!empty($row->asc_title))
3897
+				$translation_texts[] = stripslashes_deep($row->asc_title);
3898
+
3899
+			if (!empty($row->desc_title))
3900
+				$translation_texts[] = stripslashes_deep($row->desc_title);
3901
+		}
3902
+	}
3903 3903
 	
3904 3904
 	// Advance search filter fields table
3905 3905
 	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
@@ -3920,9 +3920,9 @@  discard block
 block discarded – undo
3920 3920
 		}
3921 3921
 	}
3922 3922
 
3923
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3923
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3924 3924
 
3925
-    return $translation_texts;
3925
+	return $translation_texts;
3926 3926
 }
3927 3927
 
3928 3928
 /**
@@ -3934,71 +3934,71 @@  discard block
 block discarded – undo
3934 3934
  * @return array Array of mime types.
3935 3935
  */
3936 3936
 function geodir_allowed_mime_types() {
3937
-    /**
3938
-     * Filter the list of mime types and file extensions allowed for file upload.
3939
-     *
3940
-     * @since 1.4.7
3941
-     * @package GeoDirectory
3942
-     *
3943
-     * @param array $geodir_allowed_mime_types and file extensions.
3944
-     */
3945
-    return apply_filters( 'geodir_allowed_mime_types', array(
3946
-            'Image' => array( // Image formats.
3947
-                'jpg' => 'image/jpeg',
3948
-                'jpe' => 'image/jpeg',
3949
-                'jpeg' => 'image/jpeg',
3950
-                'gif' => 'image/gif',
3951
-                'png' => 'image/png',
3952
-                'bmp' => 'image/bmp',
3953
-                'ico' => 'image/x-icon',
3954
-            ),
3955
-            'Video' => array( // Video formats.
3956
-                'asf' => 'video/x-ms-asf',
3957
-                'avi' => 'video/avi',
3958
-                'flv' => 'video/x-flv',
3959
-                'mkv' => 'video/x-matroska',
3960
-                'mp4' => 'video/mp4',
3961
-                'mpeg' => 'video/mpeg',
3962
-                'mpg' => 'video/mpeg',
3963
-                'wmv' => 'video/x-ms-wmv',
3964
-                '3gp' => 'video/3gpp',
3965
-            ),
3966
-            'Audio' => array( // Audio formats.
3967
-                'ogg' => 'audio/ogg',
3968
-                'mp3' => 'audio/mpeg',
3969
-                'wav' => 'audio/wav',
3970
-                'wma' => 'audio/x-ms-wma',
3971
-            ),
3972
-            'Text' => array( // Text formats.
3973
-                'css' => 'text/css',
3974
-                'csv' => 'text/csv',
3975
-                'htm' => 'text/html',
3976
-                'html' => 'text/html',
3977
-                'txt' => 'text/plain',
3978
-                'rtx' => 'text/richtext',
3979
-                'vtt' => 'text/vtt',
3980
-            ),
3981
-            'Application' => array( // Application formats.
3982
-                'doc' => 'application/msword',
3983
-                'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
3984
-                'exe' => 'application/x-msdownload',
3985
-                'js' => 'application/javascript',
3986
-                'odt' => 'application/vnd.oasis.opendocument.text',
3987
-                'pdf' => 'application/pdf',
3988
-                'pot' => 'application/vnd.ms-powerpoint',
3989
-                'ppt' => 'application/vnd.ms-powerpoint',
3990
-                'pptx' => 'application/vnd.ms-powerpoint',
3991
-                'psd' => 'application/octet-stream',
3992
-                'rar' => 'application/rar',
3993
-                'rtf' => 'application/rtf',
3994
-                'swf' => 'application/x-shockwave-flash',
3995
-                'tar' => 'application/x-tar',
3996
-                'xls' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3997
-                'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3998
-                'zip' => 'application/zip',
3999
-            )
4000
-        )
4001
-    );
3937
+	/**
3938
+	 * Filter the list of mime types and file extensions allowed for file upload.
3939
+	 *
3940
+	 * @since 1.4.7
3941
+	 * @package GeoDirectory
3942
+	 *
3943
+	 * @param array $geodir_allowed_mime_types and file extensions.
3944
+	 */
3945
+	return apply_filters( 'geodir_allowed_mime_types', array(
3946
+			'Image' => array( // Image formats.
3947
+				'jpg' => 'image/jpeg',
3948
+				'jpe' => 'image/jpeg',
3949
+				'jpeg' => 'image/jpeg',
3950
+				'gif' => 'image/gif',
3951
+				'png' => 'image/png',
3952
+				'bmp' => 'image/bmp',
3953
+				'ico' => 'image/x-icon',
3954
+			),
3955
+			'Video' => array( // Video formats.
3956
+				'asf' => 'video/x-ms-asf',
3957
+				'avi' => 'video/avi',
3958
+				'flv' => 'video/x-flv',
3959
+				'mkv' => 'video/x-matroska',
3960
+				'mp4' => 'video/mp4',
3961
+				'mpeg' => 'video/mpeg',
3962
+				'mpg' => 'video/mpeg',
3963
+				'wmv' => 'video/x-ms-wmv',
3964
+				'3gp' => 'video/3gpp',
3965
+			),
3966
+			'Audio' => array( // Audio formats.
3967
+				'ogg' => 'audio/ogg',
3968
+				'mp3' => 'audio/mpeg',
3969
+				'wav' => 'audio/wav',
3970
+				'wma' => 'audio/x-ms-wma',
3971
+			),
3972
+			'Text' => array( // Text formats.
3973
+				'css' => 'text/css',
3974
+				'csv' => 'text/csv',
3975
+				'htm' => 'text/html',
3976
+				'html' => 'text/html',
3977
+				'txt' => 'text/plain',
3978
+				'rtx' => 'text/richtext',
3979
+				'vtt' => 'text/vtt',
3980
+			),
3981
+			'Application' => array( // Application formats.
3982
+				'doc' => 'application/msword',
3983
+				'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
3984
+				'exe' => 'application/x-msdownload',
3985
+				'js' => 'application/javascript',
3986
+				'odt' => 'application/vnd.oasis.opendocument.text',
3987
+				'pdf' => 'application/pdf',
3988
+				'pot' => 'application/vnd.ms-powerpoint',
3989
+				'ppt' => 'application/vnd.ms-powerpoint',
3990
+				'pptx' => 'application/vnd.ms-powerpoint',
3991
+				'psd' => 'application/octet-stream',
3992
+				'rar' => 'application/rar',
3993
+				'rtf' => 'application/rtf',
3994
+				'swf' => 'application/x-shockwave-flash',
3995
+				'tar' => 'application/x-tar',
3996
+				'xls' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3997
+				'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3998
+				'zip' => 'application/zip',
3999
+			)
4000
+		)
4001
+	);
4002 4002
 }
4003 4003
 
4004 4004
 /**
@@ -4010,21 +4010,21 @@  discard block
 block discarded – undo
4010 4010
  * @return string User display name.
4011 4011
  */
4012 4012
 function geodir_get_client_name($user_id) {
4013
-    $client_name = '';
4013
+	$client_name = '';
4014 4014
 
4015
-    $user_data = get_userdata($user_id);
4015
+	$user_data = get_userdata($user_id);
4016 4016
 
4017
-    if (!empty($user_data)) {
4018
-        if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
4019
-            $client_name = trim($user_data->display_name);
4020
-        } else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
4021
-            $client_name = trim($user_data->user_nicename);
4022
-        } else {
4023
-            $client_name = trim($user_data->user_login);
4024
-        }
4025
-    }
4017
+	if (!empty($user_data)) {
4018
+		if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
4019
+			$client_name = trim($user_data->display_name);
4020
+		} else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
4021
+			$client_name = trim($user_data->user_nicename);
4022
+		} else {
4023
+			$client_name = trim($user_data->user_login);
4024
+		}
4025
+	}
4026 4026
 
4027
-    return $client_name;
4027
+	return $client_name;
4028 4028
 }
4029 4029
 
4030 4030
 
@@ -4039,125 +4039,125 @@  discard block
 block discarded – undo
4039 4039
  */
4040 4040
 function geodir_wpseo_replacements($vars){
4041 4041
 
4042
-    global $wp;
4043
-    $title = '';
4044
-    // location variables
4045
-    $gd_post_type = geodir_get_current_posttype();
4046
-    $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4047
-    /**
4048
-     * Filter the title variables location variables array
4049
-     *
4050
-     * @since 1.5.5
4051
-     * @package GeoDirectory
4052
-     * @param array $location_array The array of location variables.
4053
-     * @param array $vars The page title variables.
4054
-     */
4055
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
4056
-    $location_titles = array();
4057
-    if(get_query_var( 'gd_country_full' )){
4058
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4059
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4060
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4061
-    }
4062
-    $location_single = '';
4063
-    $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4064
-    $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4065
-    $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4066
-
4067
-    $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4068
-
4069
-    if (function_exists('get_actual_location_name')) {
4070
-        $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4071
-        $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4072
-        $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4073
-    }
4074
-
4075
-    if ($gd_city != '') {
4076
-        if ($gd_city_actual != '') {
4077
-            $gd_city = $gd_city_actual;
4078
-        } else {
4079
-            $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4080
-            $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4081
-            $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4082
-        }
4083
-        $location_single = $gd_city;
4084
-
4085
-    } else if ($gd_region != '') {
4086
-        if ($gd_region_actual != '') {
4087
-            $gd_region = $gd_region_actual;
4088
-        } else {
4089
-            $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4090
-            $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4091
-            $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4092
-        }
4093
-
4094
-        $location_single = $gd_region;
4095
-    } else if ($gd_country != '') {
4096
-        if ($gd_country_actual != '') {
4097
-            $gd_country = $gd_country_actual;
4098
-        } else {
4099
-            $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4100
-            $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4101
-            $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4102
-        }
4103
-
4104
-        $location_single = $gd_country;
4105
-    }
4106
-
4107
-    if (!empty($location_array)) {
4108
-
4109
-        $actual_location_name = function_exists('get_actual_location_name') ? true : false;
4110
-        $location_array = array_reverse($location_array);
4111
-
4112
-        foreach ($location_array as $location_type => $location) {
4113
-            $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4114
-            $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4115
-
4116
-            $location_name = geodir_ucwords($gd_location_link_text);
4117
-            $location_name = __($location_name, 'geodirectory');
4118
-
4119
-            if ($actual_location_name) {
4120
-                $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4121
-                $location_name = get_actual_location_name($location_type, $location, true);
4122
-            }
4123
-
4124
-            $location_titles[] = $location_name;
4125
-        }
4126
-        if (!empty($location_titles)) {
4127
-            $location_titles = array_unique($location_titles);
4128
-        }
4129
-    }
4130
-
4131
-
4132
-    if(!empty($location_titles)) {
4133
-        $vars['%%location%%'] = implode(", ", $location_titles);
4134
-    }
4135
-
4136
-
4137
-    if(!empty($location_titles)) {
4138
-        $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
4139
-    }
4140
-
4141
-
4142
-
4143
-    if($location_single) {
4144
-        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
4145
-    }
4146
-
4147
-
4148
-    if($location_single) {
4149
-        $vars['%%location_single%%'] = $location_single;
4150
-    }
4151
-
4152
-    /**
4153
-     * Filter the title variables after standard ones have been filtered for wpseo.
4154
-     *
4155
-     * @since 1.5.7
4156
-     * @package GeoDirectory
4157
-     * @param string $vars The title with variables.
4158
-     * @param array $location_array The array of location variables.
4159
-     */
4160
-    return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
4042
+	global $wp;
4043
+	$title = '';
4044
+	// location variables
4045
+	$gd_post_type = geodir_get_current_posttype();
4046
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4047
+	/**
4048
+	 * Filter the title variables location variables array
4049
+	 *
4050
+	 * @since 1.5.5
4051
+	 * @package GeoDirectory
4052
+	 * @param array $location_array The array of location variables.
4053
+	 * @param array $vars The page title variables.
4054
+	 */
4055
+	$location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
4056
+	$location_titles = array();
4057
+	if(get_query_var( 'gd_country_full' )){
4058
+		if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4059
+		if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4060
+		if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4061
+	}
4062
+	$location_single = '';
4063
+	$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4064
+	$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4065
+	$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4066
+
4067
+	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4068
+
4069
+	if (function_exists('get_actual_location_name')) {
4070
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4071
+		$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4072
+		$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4073
+	}
4074
+
4075
+	if ($gd_city != '') {
4076
+		if ($gd_city_actual != '') {
4077
+			$gd_city = $gd_city_actual;
4078
+		} else {
4079
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4080
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4081
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4082
+		}
4083
+		$location_single = $gd_city;
4084
+
4085
+	} else if ($gd_region != '') {
4086
+		if ($gd_region_actual != '') {
4087
+			$gd_region = $gd_region_actual;
4088
+		} else {
4089
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4090
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4091
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4092
+		}
4093
+
4094
+		$location_single = $gd_region;
4095
+	} else if ($gd_country != '') {
4096
+		if ($gd_country_actual != '') {
4097
+			$gd_country = $gd_country_actual;
4098
+		} else {
4099
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4100
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4101
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4102
+		}
4103
+
4104
+		$location_single = $gd_country;
4105
+	}
4106
+
4107
+	if (!empty($location_array)) {
4108
+
4109
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4110
+		$location_array = array_reverse($location_array);
4111
+
4112
+		foreach ($location_array as $location_type => $location) {
4113
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4114
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4115
+
4116
+			$location_name = geodir_ucwords($gd_location_link_text);
4117
+			$location_name = __($location_name, 'geodirectory');
4118
+
4119
+			if ($actual_location_name) {
4120
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4121
+				$location_name = get_actual_location_name($location_type, $location, true);
4122
+			}
4123
+
4124
+			$location_titles[] = $location_name;
4125
+		}
4126
+		if (!empty($location_titles)) {
4127
+			$location_titles = array_unique($location_titles);
4128
+		}
4129
+	}
4130
+
4131
+
4132
+	if(!empty($location_titles)) {
4133
+		$vars['%%location%%'] = implode(", ", $location_titles);
4134
+	}
4135
+
4136
+
4137
+	if(!empty($location_titles)) {
4138
+		$vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
4139
+	}
4140
+
4141
+
4142
+
4143
+	if($location_single) {
4144
+		$vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
4145
+	}
4146
+
4147
+
4148
+	if($location_single) {
4149
+		$vars['%%location_single%%'] = $location_single;
4150
+	}
4151
+
4152
+	/**
4153
+	 * Filter the title variables after standard ones have been filtered for wpseo.
4154
+	 *
4155
+	 * @since 1.5.7
4156
+	 * @package GeoDirectory
4157
+	 * @param string $vars The title with variables.
4158
+	 * @param array $location_array The array of location variables.
4159
+	 */
4160
+	return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
4161 4161
 }
4162 4162
 
4163 4163
 
@@ -4205,291 +4205,291 @@  discard block
 block discarded – undo
4205 4205
  * @return string Title after filtered variables.
4206 4206
  */
4207 4207
 function geodir_filter_title_variables($title, $gd_page, $sep = '') {
4208
-    global $wp, $post;
4208
+	global $wp, $post;
4209 4209
 
4210
-    if (!$gd_page || !$title) {
4211
-        return $title; // if no a GD page then bail.
4212
-    }
4210
+	if (!$gd_page || !$title) {
4211
+		return $title; // if no a GD page then bail.
4212
+	}
4213 4213
     
4214
-    if ($sep == '') {
4215
-        /**
4216
-         * Filter the page title separator.
4217
-         *
4218
-         * @since 1.0.0
4219
-         * @package GeoDirectory
4220
-         * @param string $sep The separator, default: `|`.
4221
-         */
4222
-        $sep = apply_filters('geodir_page_title_separator', '|');
4223
-    }
4224
-
4225
-    if (strpos($title,'%%title%%') !== false) {
4226
-        $title = str_replace("%%title%%", $post->post_title, $title);
4227
-    }
4228
-
4229
-    if (strpos($title,'%%sitename%%') !== false) {
4230
-        $title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
4231
-    }
4232
-
4233
-    if (strpos($title,'%%sitedesc%%') !== false) {
4234
-        $title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
4235
-    }
4236
-
4237
-    if (strpos($title,'%%excerpt%%') !== false) {
4238
-        $title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
4239
-    }
4214
+	if ($sep == '') {
4215
+		/**
4216
+		 * Filter the page title separator.
4217
+		 *
4218
+		 * @since 1.0.0
4219
+		 * @package GeoDirectory
4220
+		 * @param string $sep The separator, default: `|`.
4221
+		 */
4222
+		$sep = apply_filters('geodir_page_title_separator', '|');
4223
+	}
4224
+
4225
+	if (strpos($title,'%%title%%') !== false) {
4226
+		$title = str_replace("%%title%%", $post->post_title, $title);
4227
+	}
4228
+
4229
+	if (strpos($title,'%%sitename%%') !== false) {
4230
+		$title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
4231
+	}
4232
+
4233
+	if (strpos($title,'%%sitedesc%%') !== false) {
4234
+		$title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
4235
+	}
4236
+
4237
+	if (strpos($title,'%%excerpt%%') !== false) {
4238
+		$title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
4239
+	}
4240 4240
     
4241
-    if ($gd_page == 'search' || $gd_page == 'author') {
4242
-        $post_type = isset($_REQUEST['stype']) ? sanitize_text_field($_REQUEST['stype']) : '';
4243
-    } else if ($gd_page == 'add-listing') {
4244
-        $post_type = (isset($_REQUEST['listing_type'])) ? sanitize_text_field($_REQUEST['listing_type']) : '';
4245
-        $post_type = !$post_type && !empty($_REQUEST['pid']) ? get_post_type((int)$_REQUEST['pid']) : $post_type;
4246
-    } else if (isset($post->post_type) && $post->post_type && in_array($post->post_type , geodir_get_posttypes())) {
4247
-        $post_type = $post->post_type;
4248
-    } else {
4249
-        $post_type = get_query_var('post_type');
4250
-    }
4241
+	if ($gd_page == 'search' || $gd_page == 'author') {
4242
+		$post_type = isset($_REQUEST['stype']) ? sanitize_text_field($_REQUEST['stype']) : '';
4243
+	} else if ($gd_page == 'add-listing') {
4244
+		$post_type = (isset($_REQUEST['listing_type'])) ? sanitize_text_field($_REQUEST['listing_type']) : '';
4245
+		$post_type = !$post_type && !empty($_REQUEST['pid']) ? get_post_type((int)$_REQUEST['pid']) : $post_type;
4246
+	} else if (isset($post->post_type) && $post->post_type && in_array($post->post_type , geodir_get_posttypes())) {
4247
+		$post_type = $post->post_type;
4248
+	} else {
4249
+		$post_type = get_query_var('post_type');
4250
+	}
4251 4251
     
4252
-    if (strpos($title, '%%pt_single%%') !== false) {        
4253
-        $singular_name = '';
4254
-        if ($post_type && $singular_name = get_post_type_singular_label($post_type)) {
4255
-            $singular_name = __($singular_name, 'geodirectory');
4256
-        }
4252
+	if (strpos($title, '%%pt_single%%') !== false) {        
4253
+		$singular_name = '';
4254
+		if ($post_type && $singular_name = get_post_type_singular_label($post_type)) {
4255
+			$singular_name = __($singular_name, 'geodirectory');
4256
+		}
4257 4257
         
4258
-        $title = str_replace("%%pt_single%%", $singular_name, $title);
4259
-    }
4260
-
4261
-    if (strpos($title, '%%pt_plural%%') !== false) {        
4262
-        $plural_name = '';
4263
-        if ($post_type && $plural_name = get_post_type_plural_label($post_type)) {
4264
-            $plural_name = __($plural_name, 'geodirectory');
4265
-        }
4258
+		$title = str_replace("%%pt_single%%", $singular_name, $title);
4259
+	}
4260
+
4261
+	if (strpos($title, '%%pt_plural%%') !== false) {        
4262
+		$plural_name = '';
4263
+		if ($post_type && $plural_name = get_post_type_plural_label($post_type)) {
4264
+			$plural_name = __($plural_name, 'geodirectory');
4265
+		}
4266 4266
         
4267
-        $title = str_replace("%%pt_plural%%", $plural_name, $title);
4268
-    }
4269
-
4270
-    if (strpos($title, '%%category%%') !== false) {
4271
-        $cat_name = '';
4272
-
4273
-        if ($gd_page=='detail') {
4274
-            if ($post->default_category) {
4275
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4276
-                $cat_name = (isset($cat->name)) ? $cat->name : '';
4277
-            }
4278
-        } else if ($gd_page == 'listing') {
4279
-            $queried_object = get_queried_object();
4280
-            if (isset($queried_object->name)) {
4281
-                $cat_name = $queried_object->name;
4282
-            }
4283
-        }
4284
-        $title = str_replace("%%category%%", $cat_name, $title);
4285
-    }
4286
-
4287
-    if (strpos($title, '%%tag%%') !== false) {
4288
-        $cat_name = '';
4289
-
4290
-        if ($gd_page=='detail') {
4291
-            if ($post->default_category) {
4292
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4293
-                $cat_name = (isset($cat->name)) ? $cat->name : '';
4294
-            }
4295
-        } else if($gd_page == 'listing') {
4296
-            $queried_object = get_queried_object();
4297
-            if (isset($queried_object->name)) {
4298
-                $cat_name = $queried_object->name;
4299
-            }
4300
-        }
4301
-        $title = str_replace("%%tag%%", $cat_name, $title);
4302
-    }
4303
-
4304
-    if (strpos($title, '%%id%%') !== false) {
4305
-        $ID = (isset($post->ID)) ? $post->ID : '';
4306
-        $title = str_replace("%%id%%", $ID, $title);
4307
-    }
4308
-
4309
-    if (strpos($title,'%%sep%%') !== false) {
4310
-        $title = str_replace("%%sep%%", $sep, $title);
4311
-    }
4312
-
4313
-    // location variables
4314
-    $gd_post_type = geodir_get_current_posttype();
4315
-    $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4316
-    /**
4317
-     * Filter the title variables location variables array
4318
-     *
4319
-     * @since 1.5.5
4320
-     * @package GeoDirectory
4321
-     * @param array $location_array The array of location variables.
4322
-     * @param string $title The title with variables..
4323
-     * @param string $gd_page The page being filtered.
4324
-     * @param string $sep The separator, default: `|`.
4325
-     */
4326
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4327
-    $location_titles = array();
4328
-    if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4329
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4330
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4331
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4332
-    }
4333
-    $location_single = '';
4334
-    $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4335
-    $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4336
-    $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4337
-
4338
-    $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4339
-
4340
-    if (function_exists('get_actual_location_name')) {
4341
-        $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4342
-        $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4343
-        $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4344
-    }
4345
-
4346
-    if ($gd_city != '') {
4347
-        if ($gd_city_actual != '') {
4348
-            $gd_city = $gd_city_actual;
4349
-        } else {
4350
-            $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4351
-            $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4352
-            $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4353
-        }
4354
-        $location_single = $gd_city;
4355
-
4356
-    } else if ($gd_region != '') {
4357
-        if ($gd_region_actual != '') {
4358
-            $gd_region = $gd_region_actual;
4359
-        } else {
4360
-            $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4361
-            $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4362
-            $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4363
-        }
4364
-
4365
-        $location_single = $gd_region;
4366
-    } else if ($gd_country != '') {
4367
-        if ($gd_country_actual != '') {
4368
-            $gd_country = $gd_country_actual;
4369
-        } else {
4370
-            $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4371
-            $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4372
-            $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4373
-        }
4374
-
4375
-        $location_single = $gd_country;
4376
-    }
4377
-
4378
-    if (!empty($location_array)) {
4379
-
4380
-        $actual_location_name = function_exists('get_actual_location_name') ? true : false;
4381
-        $location_array = array_reverse($location_array);
4382
-
4383
-        foreach ($location_array as $location_type => $location) {
4384
-            $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4385
-            $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4386
-
4387
-            $location_name = geodir_ucwords($gd_location_link_text);
4388
-            $location_name = __($location_name, 'geodirectory');
4389
-
4390
-            if ($actual_location_name) {
4391
-                $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4392
-                $location_name = get_actual_location_name($location_type, $location, true);
4393
-            }
4394
-
4395
-            $location_titles[] = $location_name;
4396
-        }
4397
-        if (!empty($location_titles)) {
4398
-            $location_titles = array_unique($location_titles);
4399
-        }
4400
-    }
4401
-
4402
-
4403
-    if(strpos($title,'%%location%%') !== false){
4404
-        $location = '';
4405
-        if($location_titles) {
4406
-            $location = implode(", ", $location_titles);
4407
-        }
4408
-        $title = str_replace("%%location%%",$location,$title);
4409
-    }
4410
-
4411
-    if(strpos($title,'%%in_location%%') !== false){
4412
-        $location = '';
4413
-        if($location_titles) {
4414
-            $location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4415
-        }
4416
-        $title = str_replace("%%in_location%%",$location,$title);
4417
-    }
4418
-
4419
-    if(strpos($title,'%%in_location_single%%') !== false){
4420
-        if($location_single) {
4421
-            $location_single = __('in', 'geodirectory') . ' ' .$location_single;
4422
-        }
4423
-        $title = str_replace("%%in_location_single%%",$location_single,$title);
4424
-    }
4425
-
4426
-    if(strpos($title,'%%location_single%%') !== false){
4427
-        $title = str_replace("%%location_single%%",$location_single,$title);
4428
-    }
4429
-
4430
-
4431
-    if(strpos($title,'%%search_term%%') !== false){
4432
-        $search_term = '';
4433
-        if(isset($_REQUEST['s'])){
4434
-            $search_term = esc_attr($_REQUEST['s']);
4435
-        }
4436
-        $title = str_replace("%%search_term%%",$search_term,$title);
4437
-    }
4438
-
4439
-    if(strpos($title,'%%search_near%%') !== false){
4440
-        $search_term = '';
4441
-        if(isset($_REQUEST['snear'])){
4442
-            $search_term = esc_attr($_REQUEST['snear']);
4443
-        }
4444
-        $title = str_replace("%%search_near%%",$search_term,$title);
4445
-    }
4446
-
4447
-    if(strpos($title,'%%name%%') !== false){
4448
-        if (is_author()) {
4449
-            $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
4450
-            $author_name = $curauth->display_name;
4451
-        } else {
4452
-            $author_name = get_the_author();
4453
-        }
4454
-        if (!$author_name || $author_name === '') {
4455
-            $queried_object = get_queried_object();
4267
+		$title = str_replace("%%pt_plural%%", $plural_name, $title);
4268
+	}
4269
+
4270
+	if (strpos($title, '%%category%%') !== false) {
4271
+		$cat_name = '';
4272
+
4273
+		if ($gd_page=='detail') {
4274
+			if ($post->default_category) {
4275
+				$cat = get_term($post->default_category, $post->post_type . 'category');
4276
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4277
+			}
4278
+		} else if ($gd_page == 'listing') {
4279
+			$queried_object = get_queried_object();
4280
+			if (isset($queried_object->name)) {
4281
+				$cat_name = $queried_object->name;
4282
+			}
4283
+		}
4284
+		$title = str_replace("%%category%%", $cat_name, $title);
4285
+	}
4286
+
4287
+	if (strpos($title, '%%tag%%') !== false) {
4288
+		$cat_name = '';
4289
+
4290
+		if ($gd_page=='detail') {
4291
+			if ($post->default_category) {
4292
+				$cat = get_term($post->default_category, $post->post_type . 'category');
4293
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4294
+			}
4295
+		} else if($gd_page == 'listing') {
4296
+			$queried_object = get_queried_object();
4297
+			if (isset($queried_object->name)) {
4298
+				$cat_name = $queried_object->name;
4299
+			}
4300
+		}
4301
+		$title = str_replace("%%tag%%", $cat_name, $title);
4302
+	}
4303
+
4304
+	if (strpos($title, '%%id%%') !== false) {
4305
+		$ID = (isset($post->ID)) ? $post->ID : '';
4306
+		$title = str_replace("%%id%%", $ID, $title);
4307
+	}
4308
+
4309
+	if (strpos($title,'%%sep%%') !== false) {
4310
+		$title = str_replace("%%sep%%", $sep, $title);
4311
+	}
4312
+
4313
+	// location variables
4314
+	$gd_post_type = geodir_get_current_posttype();
4315
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4316
+	/**
4317
+	 * Filter the title variables location variables array
4318
+	 *
4319
+	 * @since 1.5.5
4320
+	 * @package GeoDirectory
4321
+	 * @param array $location_array The array of location variables.
4322
+	 * @param string $title The title with variables..
4323
+	 * @param string $gd_page The page being filtered.
4324
+	 * @param string $sep The separator, default: `|`.
4325
+	 */
4326
+	$location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4327
+	$location_titles = array();
4328
+	if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4329
+		if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4330
+		if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4331
+		if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4332
+	}
4333
+	$location_single = '';
4334
+	$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4335
+	$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4336
+	$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4337
+
4338
+	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4339
+
4340
+	if (function_exists('get_actual_location_name')) {
4341
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4342
+		$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4343
+		$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4344
+	}
4345
+
4346
+	if ($gd_city != '') {
4347
+		if ($gd_city_actual != '') {
4348
+			$gd_city = $gd_city_actual;
4349
+		} else {
4350
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4351
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4352
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4353
+		}
4354
+		$location_single = $gd_city;
4355
+
4356
+	} else if ($gd_region != '') {
4357
+		if ($gd_region_actual != '') {
4358
+			$gd_region = $gd_region_actual;
4359
+		} else {
4360
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4361
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4362
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4363
+		}
4364
+
4365
+		$location_single = $gd_region;
4366
+	} else if ($gd_country != '') {
4367
+		if ($gd_country_actual != '') {
4368
+			$gd_country = $gd_country_actual;
4369
+		} else {
4370
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4371
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4372
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4373
+		}
4374
+
4375
+		$location_single = $gd_country;
4376
+	}
4377
+
4378
+	if (!empty($location_array)) {
4379
+
4380
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4381
+		$location_array = array_reverse($location_array);
4382
+
4383
+		foreach ($location_array as $location_type => $location) {
4384
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4385
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4386
+
4387
+			$location_name = geodir_ucwords($gd_location_link_text);
4388
+			$location_name = __($location_name, 'geodirectory');
4389
+
4390
+			if ($actual_location_name) {
4391
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4392
+				$location_name = get_actual_location_name($location_type, $location, true);
4393
+			}
4394
+
4395
+			$location_titles[] = $location_name;
4396
+		}
4397
+		if (!empty($location_titles)) {
4398
+			$location_titles = array_unique($location_titles);
4399
+		}
4400
+	}
4401
+
4402
+
4403
+	if(strpos($title,'%%location%%') !== false){
4404
+		$location = '';
4405
+		if($location_titles) {
4406
+			$location = implode(", ", $location_titles);
4407
+		}
4408
+		$title = str_replace("%%location%%",$location,$title);
4409
+	}
4410
+
4411
+	if(strpos($title,'%%in_location%%') !== false){
4412
+		$location = '';
4413
+		if($location_titles) {
4414
+			$location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4415
+		}
4416
+		$title = str_replace("%%in_location%%",$location,$title);
4417
+	}
4418
+
4419
+	if(strpos($title,'%%in_location_single%%') !== false){
4420
+		if($location_single) {
4421
+			$location_single = __('in', 'geodirectory') . ' ' .$location_single;
4422
+		}
4423
+		$title = str_replace("%%in_location_single%%",$location_single,$title);
4424
+	}
4425
+
4426
+	if(strpos($title,'%%location_single%%') !== false){
4427
+		$title = str_replace("%%location_single%%",$location_single,$title);
4428
+	}
4429
+
4430
+
4431
+	if(strpos($title,'%%search_term%%') !== false){
4432
+		$search_term = '';
4433
+		if(isset($_REQUEST['s'])){
4434
+			$search_term = esc_attr($_REQUEST['s']);
4435
+		}
4436
+		$title = str_replace("%%search_term%%",$search_term,$title);
4437
+	}
4438
+
4439
+	if(strpos($title,'%%search_near%%') !== false){
4440
+		$search_term = '';
4441
+		if(isset($_REQUEST['snear'])){
4442
+			$search_term = esc_attr($_REQUEST['snear']);
4443
+		}
4444
+		$title = str_replace("%%search_near%%",$search_term,$title);
4445
+	}
4446
+
4447
+	if(strpos($title,'%%name%%') !== false){
4448
+		if (is_author()) {
4449
+			$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
4450
+			$author_name = $curauth->display_name;
4451
+		} else {
4452
+			$author_name = get_the_author();
4453
+		}
4454
+		if (!$author_name || $author_name === '') {
4455
+			$queried_object = get_queried_object();
4456 4456
             
4457
-            if (isset($queried_object->data->user_nicename)) {
4458
-                $author_name = $queried_object->data->display_name;
4459
-            }
4460
-        }
4461
-        $title = str_replace("%%name%%", $author_name, $title);
4462
-    }
4457
+			if (isset($queried_object->data->user_nicename)) {
4458
+				$author_name = $queried_object->data->display_name;
4459
+			}
4460
+		}
4461
+		$title = str_replace("%%name%%", $author_name, $title);
4462
+	}
4463 4463
     
4464
-    if (strpos($title, '%%page%%') !== false) {
4465
-        $page = geodir_title_meta_page($sep);
4466
-        $title = str_replace("%%page%%", $page, $title);
4467
-    }
4468
-    if (strpos($title, '%%pagenumber%%') !== false) {
4469
-        $pagenumber = geodir_title_meta_pagenumber();
4470
-        $title = str_replace("%%pagenumber%%", $pagenumber, $title);
4471
-    }
4472
-    if (strpos($title, '%%pagetotal%%') !== false) {
4473
-        $pagetotal = geodir_title_meta_pagetotal();
4474
-        $title = str_replace("%%pagetotal%%", $pagetotal, $title);
4475
-    }
4476
-
4477
-    $title = wptexturize( $title );
4478
-    $title = convert_chars( $title );
4479
-    $title = esc_html( $title );
4480
-
4481
-    /**
4482
-     * Filter the title variables after standard ones have been filtered.
4483
-     *
4484
-     * @since 1.5.7
4485
-     * @package GeoDirectory
4486
-     * @param string $title The title with variables.
4487
-     * @param array $location_array The array of location variables.
4488
-     * @param string $gd_page The page being filtered.
4489
-     * @param string $sep The separator, default: `|`.
4490
-     */
4491
-
4492
-    return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4464
+	if (strpos($title, '%%page%%') !== false) {
4465
+		$page = geodir_title_meta_page($sep);
4466
+		$title = str_replace("%%page%%", $page, $title);
4467
+	}
4468
+	if (strpos($title, '%%pagenumber%%') !== false) {
4469
+		$pagenumber = geodir_title_meta_pagenumber();
4470
+		$title = str_replace("%%pagenumber%%", $pagenumber, $title);
4471
+	}
4472
+	if (strpos($title, '%%pagetotal%%') !== false) {
4473
+		$pagetotal = geodir_title_meta_pagetotal();
4474
+		$title = str_replace("%%pagetotal%%", $pagetotal, $title);
4475
+	}
4476
+
4477
+	$title = wptexturize( $title );
4478
+	$title = convert_chars( $title );
4479
+	$title = esc_html( $title );
4480
+
4481
+	/**
4482
+	 * Filter the title variables after standard ones have been filtered.
4483
+	 *
4484
+	 * @since 1.5.7
4485
+	 * @package GeoDirectory
4486
+	 * @param string $title The title with variables.
4487
+	 * @param array $location_array The array of location variables.
4488
+	 * @param string $gd_page The page being filtered.
4489
+	 * @param string $sep The separator, default: `|`.
4490
+	 */
4491
+
4492
+	return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4493 4493
 }
4494 4494
 
4495 4495
 /**
@@ -4502,65 +4502,65 @@  discard block
 block discarded – undo
4502 4502
  * @return array Translation texts.
4503 4503
  */
4504 4504
 function geodir_load_cpt_text_translation($translation_texts = array()) {
4505
-    $gd_post_types = geodir_get_posttypes('array');
4506
-
4507
-    if (!empty($gd_post_types)) {
4508
-        foreach ($gd_post_types as $post_type => $cpt_info) {
4509
-            $labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4510
-            $description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4511
-            $seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4512
-
4513
-            if (!empty($labels)) {
4514
-                if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts))
4515
-                    $translation_texts[] = $labels['name'];
4516
-                if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts))
4517
-                    $translation_texts[] = $labels['singular_name'];
4518
-                if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts))
4519
-                    $translation_texts[] = $labels['add_new'];
4520
-                if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts))
4521
-                    $translation_texts[] = $labels['add_new_item'];
4522
-                if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts))
4523
-                    $translation_texts[] = $labels['edit_item'];
4524
-                if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts))
4525
-                    $translation_texts[] = $labels['new_item'];
4526
-                if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts))
4527
-                    $translation_texts[] = $labels['view_item'];
4528
-                if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts))
4529
-                    $translation_texts[] = $labels['search_items'];
4530
-                if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts))
4531
-                    $translation_texts[] = $labels['not_found'];
4532
-                if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts))
4533
-                    $translation_texts[] = $labels['not_found_in_trash'];
4534
-                if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts))
4535
-                    $translation_texts[] = $labels['label_post_profile'];
4536
-                if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts))
4537
-                    $translation_texts[] = $labels['label_post_info'];
4538
-                if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts))
4539
-                    $translation_texts[] = $labels['label_post_images'];
4540
-                if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts))
4541
-                    $translation_texts[] = $labels['label_post_map'];
4542
-                if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts))
4543
-                    $translation_texts[] = $labels['label_reviews'];
4544
-                if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts))
4545
-                    $translation_texts[] = $labels['label_related_listing'];
4546
-            }
4547
-
4548
-            if ($description != '' && !in_array($description, $translation_texts)) {
4549
-                $translation_texts[] = normalize_whitespace($description);
4550
-            }
4551
-
4552
-            if (!empty($seo)) {
4553
-                if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts))
4554
-                    $translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4555
-
4556
-                if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts))
4557
-                    $translation_texts[] = normalize_whitespace($seo['meta_description']);
4558
-            }
4559
-        }
4560
-    }
4561
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4562
-
4563
-    return $translation_texts;
4505
+	$gd_post_types = geodir_get_posttypes('array');
4506
+
4507
+	if (!empty($gd_post_types)) {
4508
+		foreach ($gd_post_types as $post_type => $cpt_info) {
4509
+			$labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4510
+			$description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4511
+			$seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4512
+
4513
+			if (!empty($labels)) {
4514
+				if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts))
4515
+					$translation_texts[] = $labels['name'];
4516
+				if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts))
4517
+					$translation_texts[] = $labels['singular_name'];
4518
+				if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts))
4519
+					$translation_texts[] = $labels['add_new'];
4520
+				if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts))
4521
+					$translation_texts[] = $labels['add_new_item'];
4522
+				if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts))
4523
+					$translation_texts[] = $labels['edit_item'];
4524
+				if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts))
4525
+					$translation_texts[] = $labels['new_item'];
4526
+				if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts))
4527
+					$translation_texts[] = $labels['view_item'];
4528
+				if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts))
4529
+					$translation_texts[] = $labels['search_items'];
4530
+				if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts))
4531
+					$translation_texts[] = $labels['not_found'];
4532
+				if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts))
4533
+					$translation_texts[] = $labels['not_found_in_trash'];
4534
+				if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts))
4535
+					$translation_texts[] = $labels['label_post_profile'];
4536
+				if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts))
4537
+					$translation_texts[] = $labels['label_post_info'];
4538
+				if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts))
4539
+					$translation_texts[] = $labels['label_post_images'];
4540
+				if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts))
4541
+					$translation_texts[] = $labels['label_post_map'];
4542
+				if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts))
4543
+					$translation_texts[] = $labels['label_reviews'];
4544
+				if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts))
4545
+					$translation_texts[] = $labels['label_related_listing'];
4546
+			}
4547
+
4548
+			if ($description != '' && !in_array($description, $translation_texts)) {
4549
+				$translation_texts[] = normalize_whitespace($description);
4550
+			}
4551
+
4552
+			if (!empty($seo)) {
4553
+				if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts))
4554
+					$translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4555
+
4556
+				if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts))
4557
+					$translation_texts[] = normalize_whitespace($seo['meta_description']);
4558
+			}
4559
+		}
4560
+	}
4561
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4562
+
4563
+	return $translation_texts;
4564 4564
 }
4565 4565
 
4566 4566
 /**
@@ -4573,27 +4573,27 @@  discard block
 block discarded – undo
4573 4573
  * @return array Location terms.
4574 4574
  */
4575 4575
 function geodir_remove_location_terms($location_terms = array()) {
4576
-    $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4577
-
4578
-    if (!empty($location_terms) && $location_manager) {
4579
-        $hide_country_part = get_option('geodir_location_hide_country_part');
4580
-        $hide_region_part = get_option('geodir_location_hide_region_part');
4581
-
4582
-        if ($hide_region_part && $hide_country_part) {
4583
-            if (isset($location_terms['gd_country']))
4584
-                unset($location_terms['gd_country']);
4585
-            if (isset($location_terms['gd_region']))
4586
-                unset($location_terms['gd_region']);
4587
-        } else if ($hide_region_part && !$hide_country_part) {
4588
-            if (isset($location_terms['gd_region']))
4589
-                unset($location_terms['gd_region']);
4590
-        } else if (!$hide_region_part && $hide_country_part) {
4591
-            if (isset($location_terms['gd_country']))
4592
-                unset($location_terms['gd_country']);
4593
-        }
4594
-    }
4595
-
4596
-    return $location_terms;
4576
+	$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4577
+
4578
+	if (!empty($location_terms) && $location_manager) {
4579
+		$hide_country_part = get_option('geodir_location_hide_country_part');
4580
+		$hide_region_part = get_option('geodir_location_hide_region_part');
4581
+
4582
+		if ($hide_region_part && $hide_country_part) {
4583
+			if (isset($location_terms['gd_country']))
4584
+				unset($location_terms['gd_country']);
4585
+			if (isset($location_terms['gd_region']))
4586
+				unset($location_terms['gd_region']);
4587
+		} else if ($hide_region_part && !$hide_country_part) {
4588
+			if (isset($location_terms['gd_region']))
4589
+				unset($location_terms['gd_region']);
4590
+		} else if (!$hide_region_part && $hide_country_part) {
4591
+			if (isset($location_terms['gd_country']))
4592
+				unset($location_terms['gd_country']);
4593
+		}
4594
+	}
4595
+
4596
+	return $location_terms;
4597 4597
 }
4598 4598
 
4599 4599
 /**
@@ -4607,47 +4607,47 @@  discard block
 block discarded – undo
4607 4607
  * @param bool $update Whether this is an existing listing being updated or not.
4608 4608
  */
4609 4609
 function geodir_on_wp_insert_post($post_ID, $post, $update) {
4610
-    if (!$update) {
4611
-        return;
4612
-    }
4610
+	if (!$update) {
4611
+		return;
4612
+	}
4613 4613
     
4614
-    $action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
4615
-    $is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) )  ? true : false;
4616
-    $inline_save = $action == 'inline-save' ? true : false;
4614
+	$action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
4615
+	$is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) )  ? true : false;
4616
+	$inline_save = $action == 'inline-save' ? true : false;
4617 4617
 
4618
-    if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
4619
-        return;
4620
-    }
4618
+	if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
4619
+		return;
4620
+	}
4621 4621
     
4622
-    if ($action != '' && in_array($action, array('geodir_import_export'))) {
4623
-        return;
4624
-    }
4622
+	if ($action != '' && in_array($action, array('geodir_import_export'))) {
4623
+		return;
4624
+	}
4625 4625
 
4626
-    $user_id = (int)get_current_user_id();
4626
+	$user_id = (int)get_current_user_id();
4627 4627
         
4628
-    if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4629
-        $author_id = !empty($post->post_author) ? $post->post_author : 0;
4628
+	if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4629
+		$author_id = !empty($post->post_author) ? $post->post_author : 0;
4630 4630
         
4631
-        if ($user_id == $author_id && !is_super_admin()) {
4632
-            $from_email = get_option('site_email');
4633
-            $from_name = get_site_emailName();
4634
-            $to_email = get_option('admin_email');
4635
-            $to_name = get_option('name');
4636
-            $message_type = 'listing_edited';
4631
+		if ($user_id == $author_id && !is_super_admin()) {
4632
+			$from_email = get_option('site_email');
4633
+			$from_name = get_site_emailName();
4634
+			$to_email = get_option('admin_email');
4635
+			$to_name = get_option('name');
4636
+			$message_type = 'listing_edited';
4637 4637
             
4638
-            $notify_edited = true;
4639
-            /**
4640
-             * Send notification when listing edited by author?
4641
-             *
4642
-             * @since 1.6.0
4643
-             * @param bool $notify_edited Notify on listing edited by author?
4644
-             * @param object $post The current post object.
4645
-             */
4646
-            $notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
4638
+			$notify_edited = true;
4639
+			/**
4640
+			 * Send notification when listing edited by author?
4641
+			 *
4642
+			 * @since 1.6.0
4643
+			 * @param bool $notify_edited Notify on listing edited by author?
4644
+			 * @param object $post The current post object.
4645
+			 */
4646
+			$notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
4647 4647
             
4648
-            geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
4649
-        }
4650
-    }
4648
+			geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
4649
+		}
4650
+	}
4651 4651
 }
4652 4652
 
4653 4653
 /**
@@ -4661,16 +4661,16 @@  discard block
 block discarded – undo
4661 4661
  * @return string|null The current page start & end numbering.
4662 4662
  */
4663 4663
 function geodir_title_meta_page($sep) {
4664
-    $replacement = null;
4664
+	$replacement = null;
4665 4665
 
4666
-    $max = geodir_title_meta_pagenumbering('max');
4667
-    $nr  = geodir_title_meta_pagenumbering('nr');
4666
+	$max = geodir_title_meta_pagenumbering('max');
4667
+	$nr  = geodir_title_meta_pagenumbering('nr');
4668 4668
 
4669
-    if ($max > 1 && $nr > 1) {
4670
-        $replacement = sprintf($sep . ' ' . __('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
4671
-    }
4669
+	if ($max > 1 && $nr > 1) {
4670
+		$replacement = sprintf($sep . ' ' . __('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
4671
+	}
4672 4672
 
4673
-    return $replacement;
4673
+	return $replacement;
4674 4674
 }
4675 4675
 
4676 4676
 /**
@@ -4682,14 +4682,14 @@  discard block
 block discarded – undo
4682 4682
  * @return string|null The current page number.
4683 4683
  */
4684 4684
 function geodir_title_meta_pagenumber() {
4685
-    $replacement = null;
4685
+	$replacement = null;
4686 4686
 
4687
-    $nr = geodir_title_meta_pagenumbering('nr');
4688
-    if (isset($nr) && $nr > 0) {
4689
-        $replacement = (string)$nr;
4690
-    }
4687
+	$nr = geodir_title_meta_pagenumbering('nr');
4688
+	if (isset($nr) && $nr > 0) {
4689
+		$replacement = (string)$nr;
4690
+	}
4691 4691
 
4692
-    return $replacement;
4692
+	return $replacement;
4693 4693
 }
4694 4694
 
4695 4695
 /**
@@ -4701,14 +4701,14 @@  discard block
 block discarded – undo
4701 4701
  * @return string|null The current page total.
4702 4702
  */
4703 4703
 function geodir_title_meta_pagetotal() {
4704
-    $replacement = null;
4704
+	$replacement = null;
4705 4705
 
4706
-    $max = geodir_title_meta_pagenumbering('max');
4707
-    if (isset($max) && $max > 0) {
4708
-        $replacement = (string)$max;
4709
-    }
4706
+	$max = geodir_title_meta_pagenumbering('max');
4707
+	if (isset($max) && $max > 0) {
4708
+		$replacement = (string)$max;
4709
+	}
4710 4710
 
4711
-    return $replacement;
4711
+	return $replacement;
4712 4712
 }
4713 4713
 
4714 4714
 /**
@@ -4725,44 +4725,44 @@  discard block
 block discarded – undo
4725 4725
  * @return int|null The current page numbering.
4726 4726
  */
4727 4727
 function geodir_title_meta_pagenumbering($request = 'nr') {
4728
-    global $wp_query, $post;
4729
-    $max_num_pages = null;
4730
-    $page_number   = null;
4731
-
4732
-    $max_num_pages = 1;
4733
-
4734
-    if (!is_singular()) {
4735
-        $page_number = get_query_var('paged');
4736
-        if ($page_number === 0 || $page_number === '') {
4737
-            $page_number = 1;
4738
-        }
4739
-
4740
-        if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) {
4741
-            $max_num_pages = $wp_query->max_num_pages;
4742
-        }
4743
-    } else {
4744
-        $page_number = get_query_var('page');
4745
-        if ($page_number === 0 || $page_number === '') {
4746
-            $page_number = 1;
4747
-        }
4748
-
4749
-        if (isset($post->post_content)) {
4750
-            $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->' ) + 1);
4751
-        }
4752
-    }
4753
-
4754
-    $return = null;
4755
-
4756
-    switch ($request) {
4757
-        case 'nr':
4758
-            $return = $page_number;
4759
-            break;
4760
-        case 'max':
4761
-            $return = $max_num_pages;
4762
-            break;
4763
-    }
4764
-
4765
-    return $return;
4728
+	global $wp_query, $post;
4729
+	$max_num_pages = null;
4730
+	$page_number   = null;
4731
+
4732
+	$max_num_pages = 1;
4733
+
4734
+	if (!is_singular()) {
4735
+		$page_number = get_query_var('paged');
4736
+		if ($page_number === 0 || $page_number === '') {
4737
+			$page_number = 1;
4738
+		}
4739
+
4740
+		if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) {
4741
+			$max_num_pages = $wp_query->max_num_pages;
4742
+		}
4743
+	} else {
4744
+		$page_number = get_query_var('page');
4745
+		if ($page_number === 0 || $page_number === '') {
4746
+			$page_number = 1;
4747
+		}
4748
+
4749
+		if (isset($post->post_content)) {
4750
+			$max_num_pages = (substr_count($post->post_content, '<!--nextpage-->' ) + 1);
4751
+		}
4752
+	}
4753
+
4754
+	$return = null;
4755
+
4756
+	switch ($request) {
4757
+		case 'nr':
4758
+			$return = $page_number;
4759
+			break;
4760
+		case 'max':
4761
+			$return = $max_num_pages;
4762
+			break;
4763
+	}
4764
+
4765
+	return $return;
4766 4766
 }
4767 4767
 
4768 4768
 /**
@@ -4774,26 +4774,26 @@  discard block
 block discarded – undo
4774 4774
  * @return array Terms.
4775 4775
  */
4776 4776
 function geodir_filter_empty_terms($terms) {
4777
-    if (empty($terms)) {
4778
-        return $terms;
4779
-    }
4780
-
4781
-    $return = array();
4782
-    foreach ($terms as $term) {
4783
-        if (isset($term->count) && $term->count > 0) {
4784
-            $return[] = $term;
4785
-        }else{
4786
-            /**
4787
-             * Allow to filter terms with no count.
4788
-             *
4789
-             * @since 1.6.6
4790
-             * @param array $return The array or terms to return.
4791
-             * @param object $term The term object.
4792
-             */
4793
-            $return =  apply_filters( 'geodir_filter_empty_terms_filter',$return, $term);
4794
-        }
4795
-    }
4796
-    return $return;
4777
+	if (empty($terms)) {
4778
+		return $terms;
4779
+	}
4780
+
4781
+	$return = array();
4782
+	foreach ($terms as $term) {
4783
+		if (isset($term->count) && $term->count > 0) {
4784
+			$return[] = $term;
4785
+		}else{
4786
+			/**
4787
+			 * Allow to filter terms with no count.
4788
+			 *
4789
+			 * @since 1.6.6
4790
+			 * @param array $return The array or terms to return.
4791
+			 * @param object $term The term object.
4792
+			 */
4793
+			$return =  apply_filters( 'geodir_filter_empty_terms_filter',$return, $term);
4794
+		}
4795
+	}
4796
+	return $return;
4797 4797
 }
4798 4798
 
4799 4799
 
@@ -4806,9 +4806,9 @@  discard block
 block discarded – undo
4806 4806
  * @return array
4807 4807
  */
4808 4808
 function geodir_remove_hentry( $class ) {
4809
-    if(geodir_is_page('detail')){
4810
-        $class = array_diff( $class, array( 'hentry' ) );
4811
-    }
4812
-    return $class;
4809
+	if(geodir_is_page('detail')){
4810
+		$class = array_diff( $class, array( 'hentry' ) );
4811
+	}
4812
+	return $class;
4813 4813
 }
4814 4814
 add_filter( 'post_class', 'geodir_remove_hentry' );
4815 4815
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +359 added lines, -359 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
                     }
@@ -1156,10 +1156,10 @@  discard block
 block discarded – undo
1156 1156
                         }
1157 1157
 
1158 1158
                         if ($term_index == count($term_array) && $is_taxonomy_last)
1159
-                            $breadcrumb .= $separator . $term_link_text;
1159
+                            $breadcrumb .= $separator.$term_link_text;
1160 1160
                         else {
1161
-                            $cat_link .= $term . '/';
1162
-                            $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1161
+                            $cat_link .= $term.'/';
1162
+                            $breadcrumb .= $separator.'<a href="'.$cat_link.'">'.$term_link_text.'</a>';
1163 1163
                         }
1164 1164
                         $term_index++;
1165 1165
                     }
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
             }
1170 1170
 
1171 1171
             if (geodir_is_page('detail'))
1172
-                $breadcrumb .= $separator . get_the_title();
1172
+                $breadcrumb .= $separator.get_the_title();
1173 1173
 
1174 1174
             $breadcrumb .= '</li>';
1175 1175
 
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
             $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1190 1190
 
1191 1191
             $breadcrumb .= '<li>';
1192
-            $breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>';
1192
+            $breadcrumb .= $separator.'<a href="'.$default_author_link.'">'.__('My Dashboard', 'geodirectory').'</a>';
1193 1193
 
1194 1194
             if (isset($_REQUEST['list'])) {
1195 1195
                 $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false);
@@ -1204,20 +1204,20 @@  discard block
 block discarded – undo
1204 1204
                  */
1205 1205
                 $author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1206 1206
 
1207
-                $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1208
-                $breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1207
+                $breadcrumb .= $separator.'<a href="'.$author_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1208
+                $breadcrumb .= $separator.ucfirst(__('My', 'geodirectory').' '.$_REQUEST['list']);
1209 1209
             } else
1210
-                $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1210
+                $breadcrumb .= $separator.__(ucfirst($post_type_info->label), 'geodirectory');
1211 1211
 
1212 1212
             $breadcrumb .= '</li>';
1213 1213
         } elseif (is_category() || is_single()) {
1214 1214
             $category = get_the_category();
1215 1215
             if (is_category()) {
1216
-                $breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1216
+                $breadcrumb .= '<li>'.$separator.$category[0]->cat_name.'</li>';
1217 1217
             }
1218 1218
             if (is_single()) {
1219
-                $breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>';
1220
-                $breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1219
+                $breadcrumb .= '<li>'.$separator.'<a href="'.get_category_link($category[0]->term_id).'">'.$category[0]->cat_name.'</a></li>';
1220
+                $breadcrumb .= '<li>'.$separator.get_the_title().'</li>';
1221 1221
             }
1222 1222
             /* End of my version ##################################################### */
1223 1223
         } else if (is_page()) {
@@ -1225,37 +1225,37 @@  discard block
 block discarded – undo
1225 1225
 
1226 1226
             if (geodir_is_page('location')) {
1227 1227
                 $location_page_id = geodir_location_page_id();
1228
-                $loc_post = get_post( $location_page_id );
1228
+                $loc_post = get_post($location_page_id);
1229 1229
                 $post_name = $loc_post->post_name;
1230
-                $slug= ucwords(str_replace('-',' ',$post_name));
1231
-                $page_title = !empty($slug )? $slug : __('Location', 'geodirectory');
1230
+                $slug = ucwords(str_replace('-', ' ', $post_name));
1231
+                $page_title = !empty($slug) ? $slug : __('Location', 'geodirectory');
1232 1232
             }
1233 1233
 
1234
-            $breadcrumb .= '<li>' . $separator;
1234
+            $breadcrumb .= '<li>'.$separator;
1235 1235
             $breadcrumb .= stripslashes_deep($page_title);
1236 1236
             $breadcrumb .= '</li>';
1237 1237
         } else if (is_tag()) {
1238
-            $breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1238
+            $breadcrumb .= "<li> ".$separator.single_tag_title('', false).'</li>';
1239 1239
         } else if (is_day()) {
1240
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1240
+            $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1241 1241
             the_time('F jS, Y');
1242 1242
             $breadcrumb .= '</li>';
1243 1243
         } else if (is_month()) {
1244
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1244
+            $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1245 1245
             the_time('F, Y');
1246 1246
             $breadcrumb .= '</li>';
1247 1247
         } else if (is_year()) {
1248
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1248
+            $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1249 1249
             the_time('Y');
1250 1250
             $breadcrumb .= '</li>';
1251 1251
         } else if (is_author()) {
1252
-            $breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory');
1252
+            $breadcrumb .= "<li> ".$separator.__(" Author Archive", 'geodirectory');
1253 1253
             $breadcrumb .= '</li>';
1254 1254
         } else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1255
-            $breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory');
1255
+            $breadcrumb .= "<li>".$separator.__("Blog Archives", 'geodirectory');
1256 1256
             $breadcrumb .= '</li>';
1257 1257
         } else if (is_search()) {
1258
-            $breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory');
1258
+            $breadcrumb .= "<li> ".$separator.__(" Search Results", 'geodirectory');
1259 1259
             $breadcrumb .= '</li>';
1260 1260
         }
1261 1261
         $breadcrumb .= '</ul></div>';
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
     function geodir_allow_wpadmin()
1287 1287
     {
1288 1288
         global $wpdb;
1289
-        if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined( 'DOING_AJAX' )) ) // checking action in request to allow ajax request go through
1289
+        if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined('DOING_AJAX'))) // checking action in request to allow ajax request go through
1290 1290
         {
1291 1291
             if (current_user_can('administrator')) {
1292 1292
             } else {
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
 function fetch_remote_file($url)
1312 1312
 {
1313 1313
     // extract the file name and extension from the url
1314
-    require_once(ABSPATH . 'wp-includes/pluggable.php');
1314
+    require_once(ABSPATH.'wp-includes/pluggable.php');
1315 1315
     $file_name = basename($url);
1316 1316
     if (strpos($file_name, '?') !== false) {
1317 1317
         list($file_name) = explode('?', $file_name);
@@ -1343,15 +1343,15 @@  discard block
 block discarded – undo
1343 1343
         return new WP_Error('upload_dir_error', $upload['error']);
1344 1344
 
1345 1345
 
1346
-    sleep(0.3);// if multiple remote file this can cause the remote server to timeout so we add a slight delay
1346
+    sleep(0.3); // if multiple remote file this can cause the remote server to timeout so we add a slight delay
1347 1347
 
1348 1348
     // fetch the remote url and write it to the placeholder file
1349
-    $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1349
+    $headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
1350 1350
 
1351 1351
     $log_message = '';
1352
-    if( is_wp_error( $headers  ) ) {
1352
+    if (is_wp_error($headers)) {
1353 1353
         echo 'file: '.$url;
1354
-        return new WP_Error('import_file_error',$headers->get_error_message());
1354
+        return new WP_Error('import_file_error', $headers->get_error_message());
1355 1355
     }
1356 1356
 
1357 1357
     $filesize = filesize($upload['file']);
@@ -1364,21 +1364,21 @@  discard block
 block discarded – undo
1364 1364
         $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1365 1365
     }
1366 1366
     elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1367
-        $log_message =  __('Remote file is incorrect size', 'geodirectory');
1367
+        $log_message = __('Remote file is incorrect size', 'geodirectory');
1368 1368
     }
1369 1369
     elseif (0 == $filesize) {
1370 1370
         $log_message = __('Zero size file downloaded', 'geodirectory');
1371 1371
     }
1372 1372
 
1373
-    if($log_message){
1373
+    if ($log_message) {
1374 1374
         $del = unlink($upload['file']);
1375
-        if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1376
-        return new WP_Error('import_file_error',$log_message );
1375
+        if (!$del) {geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory')); }
1376
+        return new WP_Error('import_file_error', $log_message);
1377 1377
     }
1378 1378
 
1379 1379
     if ($dummy && $add_to_cache && is_array($upload)) {
1380 1380
         $images = get_transient('cached_dummy_images');
1381
-        if(is_array($images))
1381
+        if (is_array($images))
1382 1382
             $images[$key] = $upload;
1383 1383
         else
1384 1384
             $images = array($key => $upload);
@@ -1399,12 +1399,12 @@  discard block
 block discarded – undo
1399 1399
  */
1400 1400
 function geodir_max_upload_size()
1401 1401
 {
1402
-    $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1402
+    $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1403 1403
 
1404 1404
     if ($max_filesize > 0 && $max_filesize < 1) {
1405
-        $max_filesize = (int)($max_filesize * 1024) . 'kb';
1405
+        $max_filesize = (int) ($max_filesize * 1024).'kb';
1406 1406
     } else {
1407
-        $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1407
+        $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1408 1408
     }
1409 1409
 
1410 1410
     /**
@@ -1427,7 +1427,7 @@  discard block
 block discarded – undo
1427 1427
  */
1428 1428
 function geodir_dummy_folder_exists()
1429 1429
 {
1430
-    $path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1430
+    $path = geodir_plugin_path().'/geodirectory-admin/dummy/';
1431 1431
     if (!is_dir($path))
1432 1432
         return false;
1433 1433
     else
@@ -1471,35 +1471,35 @@  discard block
 block discarded – undo
1471 1471
     {
1472 1472
         global $wpdb;
1473 1473
         if ($message_type == 'expiration') {
1474
-            $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1475
-            $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1474
+            $subject = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
1475
+            $client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
1476 1476
         } elseif ($message_type == 'post_submited') {
1477
-            $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1478
-            $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1477
+            $subject = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
1478
+            $client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
1479 1479
         } elseif ($message_type == 'renew') {
1480
-            $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1481
-            $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1480
+            $subject = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
1481
+            $client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
1482 1482
         } elseif ($message_type == 'upgrade') {
1483
-            $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1484
-            $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1483
+            $subject = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
1484
+            $client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
1485 1485
         } elseif ($message_type == 'claim_approved') {
1486
-            $subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1487
-            $client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1486
+            $subject = __(get_option('claim_approved_email_subject'), 'geodirectory');
1487
+            $client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
1488 1488
         } elseif ($message_type == 'claim_rejected') {
1489
-            $subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1490
-            $client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1489
+            $subject = __(get_option('claim_rejected_email_subject'), 'geodirectory');
1490
+            $client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
1491 1491
         } elseif ($message_type == 'claim_requested') {
1492
-            $subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1493
-            $client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1492
+            $subject = __(get_option('claim_email_subject_admin'), 'geodirectory');
1493
+            $client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
1494 1494
         } elseif ($message_type == 'auto_claim') {
1495
-            $subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1496
-            $client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1495
+            $subject = __(get_option('auto_claim_email_subject'), 'geodirectory');
1496
+            $client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
1497 1497
         } elseif ($message_type == 'payment_success') {
1498
-            $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1499
-            $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1498
+            $subject = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
1499
+            $client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
1500 1500
         } elseif ($message_type == 'payment_fail') {
1501
-            $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1502
-            $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1501
+            $subject = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
1502
+            $client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
1503 1503
         }
1504 1504
         $transaction_details = $custom_1;
1505 1505
         $fromEmail = get_option('site_email');
@@ -1510,11 +1510,11 @@  discard block
 block discarded – undo
1510 1510
         $productlink = get_permalink($page_id);
1511 1511
         $post_info = get_post($page_id);
1512 1512
         $post_date = date('dS F,Y', strtotime($post_info->post_date));
1513
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1513
+        $listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
1514 1514
         $loginurl = geodir_login_url();
1515
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1515
+        $loginurl_link = '<a href="'.$loginurl.'">login</a>';
1516 1516
         $siteurl = home_url();
1517
-        $siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1517
+        $siteurl_link = '<a href="'.$siteurl.'">'.$fromEmailName.'</a>';
1518 1518
         $user_info = get_userdata($user_id);
1519 1519
         $user_email = $user_info->user_email;
1520 1520
         $display_name = geodir_get_client_name($user_id);
@@ -1528,14 +1528,14 @@  discard block
 block discarded – undo
1528 1528
         } else {
1529 1529
             $post_type = 'listing';
1530 1530
         }
1531
-        $renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1531
+        $renew_link = '<a href="'.$siteurl.'?ptype=post_'.$post_type.'&renew=1&pid='.$page_id.'">'.RENEW_LINK.'</a>';
1532 1532
         $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#]');
1533 1533
         $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);
1534 1534
         $client_message = str_replace($search_array, $replace_array, $client_message);
1535 1535
         $subject = str_replace($search_array, $replace_array, $subject);
1536
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1537
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1538
-        $headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1536
+        $headers = 'MIME-Version: 1.0'."\r\n";
1537
+        $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
1538
+        $headers .= 'From: '.$fromEmailName.' <'.$fromEmail.'>'."\r\n";
1539 1539
 
1540 1540
         $to = $fromEmail;
1541 1541
         $message = $client_message;
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
          * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1553 1553
          * @param string $custom_1 Custom data to be sent.
1554 1554
          */
1555
-        $to = apply_filters('geodir_adminEmail_to',$to,$page_id, $user_id, $message_type, $custom_1 );
1555
+        $to = apply_filters('geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1);
1556 1556
         /**
1557 1557
          * Filter the admin email subject.
1558 1558
          *
@@ -1564,7 +1564,7 @@  discard block
 block discarded – undo
1564 1564
          * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1565 1565
          * @param string $custom_1 Custom data to be sent.
1566 1566
          */
1567
-        $subject = apply_filters('geodir_adminEmail_subject',$subject,$page_id, $user_id, $message_type, $custom_1);
1567
+        $subject = apply_filters('geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1);
1568 1568
         /**
1569 1569
          * Filter the admin email message.
1570 1570
          *
@@ -1576,7 +1576,7 @@  discard block
 block discarded – undo
1576 1576
          * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1577 1577
          * @param string $custom_1 Custom data to be sent.
1578 1578
          */
1579
-        $message = apply_filters('geodir_adminEmail_message',$message,$page_id, $user_id, $message_type, $custom_1);
1579
+        $message = apply_filters('geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1);
1580 1580
         /**
1581 1581
          * Filter the admin email headers.
1582 1582
          *
@@ -1588,23 +1588,23 @@  discard block
 block discarded – undo
1588 1588
          * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1589 1589
          * @param string $custom_1 Custom data to be sent.
1590 1590
          */
1591
-        $headers = apply_filters('geodir_adminEmail_headers',$headers,$page_id, $user_id, $message_type, $custom_1);
1591
+        $headers = apply_filters('geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1);
1592 1592
 
1593 1593
 
1594 1594
 
1595 1595
         $sent = wp_mail($to, $subject, $message, $headers);
1596
-        if( ! $sent ) {
1597
-            if ( is_array( $to ) ) {
1598
-                $to = implode( ',', $to );
1596
+        if (!$sent) {
1597
+            if (is_array($to)) {
1598
+                $to = implode(',', $to);
1599 1599
             }
1600 1600
             $log_message = sprintf(
1601
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1601
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1602 1602
                 $message_type,
1603
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1603
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
1604 1604
                 $to,
1605 1605
                 $subject
1606 1606
             );
1607
-            geodir_error_log( $log_message );
1607
+            geodir_error_log($log_message);
1608 1608
         }
1609 1609
     }
1610 1610
 }
@@ -1630,18 +1630,18 @@  discard block
 block discarded – undo
1630 1630
     {
1631 1631
         $login_details = '';
1632 1632
         if ($message_type == 'send_friend') {
1633
-            $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1634
-            $message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1633
+            $subject = stripslashes(__(get_option('email_friend_subject'), 'geodirectory'));
1634
+            $message = stripslashes(__(get_option('email_friend_content'), 'geodirectory'));
1635 1635
         } elseif ($message_type == 'send_enquiry') {
1636
-            $subject = __(get_option('email_enquiry_subject'),'geodirectory');
1637
-            $message = __(get_option('email_enquiry_content'),'geodirectory');
1636
+            $subject = __(get_option('email_enquiry_subject'), 'geodirectory');
1637
+            $message = __(get_option('email_enquiry_content'), 'geodirectory');
1638 1638
         } elseif ($message_type == 'forgot_password') {
1639
-            $subject = __(get_option('forgot_password_subject'),'geodirectory');
1640
-            $message = __(get_option('forgot_password_content'),'geodirectory');
1639
+            $subject = __(get_option('forgot_password_subject'), 'geodirectory');
1640
+            $message = __(get_option('forgot_password_content'), 'geodirectory');
1641 1641
             $login_details = $to_message;
1642 1642
         } elseif ($message_type == 'registration') {
1643
-            $subject = __(get_option('registration_success_email_subject'),'geodirectory');
1644
-            $message = __(get_option('registration_success_email_content'),'geodirectory');
1643
+            $subject = __(get_option('registration_success_email_subject'), 'geodirectory');
1644
+            $message = __(get_option('registration_success_email_content'), 'geodirectory');
1645 1645
             $login_details = $to_message;
1646 1646
         }
1647 1647
         $to_message = nl2br($to_message);
@@ -1649,11 +1649,11 @@  discard block
 block discarded – undo
1649 1649
         $sitefromEmailName = get_site_emailName();
1650 1650
         $productlink = get_permalink($post_id);
1651 1651
         $post_info = get_post($post_id);
1652
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1652
+        $listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
1653 1653
         $siteurl = home_url();
1654
-        $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1654
+        $siteurl_link = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
1655 1655
         $loginurl = geodir_login_url();
1656
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1656
+        $loginurl_link = '<a href="'.$loginurl.'">login</a>';
1657 1657
         if ($fromEmail == '') {
1658 1658
             $fromEmail = get_option('site_email');
1659 1659
         }
@@ -1667,26 +1667,26 @@  discard block
 block discarded – undo
1667 1667
         $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]');
1668 1668
         $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName);
1669 1669
         $subject = str_replace($search_array, $replace_array, $subject);
1670
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1671
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1672
-        $headers .= "Reply-To: " . $fromEmail . "\r\n";
1673
-        $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1670
+        $headers = 'MIME-Version: 1.0'."\r\n";
1671
+        $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
1672
+        $headers .= "Reply-To: ".$fromEmail."\r\n";
1673
+        $headers .= 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>'."\r\n";
1674 1674
 
1675 1675
         $to = $toEmail;
1676 1676
 
1677 1677
         $sent = wp_mail($to, $subject, $message, $headers);
1678
-        if( ! $sent ) {
1679
-            if ( is_array( $to ) ) {
1680
-                $to = implode( ',', $to );
1678
+        if (!$sent) {
1679
+            if (is_array($to)) {
1680
+                $to = implode(',', $to);
1681 1681
             }
1682 1682
             $log_message = sprintf(
1683
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1683
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1684 1684
                 $message_type,
1685
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1685
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
1686 1686
                 $to,
1687 1687
                 $subject
1688 1688
             );
1689
-            geodir_error_log( $log_message );
1689
+            geodir_error_log($log_message);
1690 1690
         }
1691 1691
 
1692 1692
         ///////// ADMIN BCC EMIALS
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
         if ($message_type == 'registration') {
1695 1695
             $message_raw = explode(__("Password:", 'geodirectory'), $message);
1696 1696
             $message_raw2 = explode("</p>", $message_raw[1], 2);
1697
-            $message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1];
1697
+            $message = $message_raw[0].__('Password:', 'geodirectory').' **********</p>'.$message_raw2[1];
1698 1698
         }
1699 1699
         $adminEmail = get_bloginfo('admin_email');
1700 1700
         $to = $adminEmail;
@@ -1712,20 +1712,20 @@  discard block
 block discarded – undo
1712 1712
             $admin_bcc = true;
1713 1713
         }
1714 1714
 
1715
-        if($admin_bcc === true){
1715
+        if ($admin_bcc === true) {
1716 1716
             $sent = wp_mail($to, $subject, $message, $headers);
1717
-            if( ! $sent ) {
1718
-                if ( is_array( $to ) ) {
1719
-                    $to = implode( ',', $to );
1717
+            if (!$sent) {
1718
+                if (is_array($to)) {
1719
+                    $to = implode(',', $to);
1720 1720
                 }
1721 1721
                 $log_message = sprintf(
1722
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1722
+                    __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1723 1723
                     $message_type,
1724
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1724
+                    date_i18n('F j Y H:i:s', current_time('timestamp')),
1725 1725
                     $to,
1726 1726
                     $subject
1727 1727
                 );
1728
-                geodir_error_log( $log_message );
1728
+                geodir_error_log($log_message);
1729 1729
             }
1730 1730
         }
1731 1731
 
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 function geodir_custom_posts_body_class($classes) {
1774 1774
     global $wpdb, $wp;
1775 1775
     $post_types = geodir_get_posttypes('object');
1776
-    if (!empty($post_types) && count((array)$post_types) > 1) {
1776
+    if (!empty($post_types) && count((array) $post_types) > 1) {
1777 1777
         $classes[] = 'geodir_custom_posts';
1778 1778
     }
1779 1779
 
@@ -1833,7 +1833,7 @@  discard block
 block discarded – undo
1833 1833
     $geodir_option = get_option($geodir_option_name);
1834 1834
 
1835 1835
     if (!empty($geodir_option)) {
1836
-        add_option($geodir_option_name . '_' . $version_date, $geodir_option);
1836
+        add_option($geodir_option_name.'_'.$version_date, $geodir_option);
1837 1837
     }
1838 1838
 }
1839 1839
 
@@ -1939,36 +1939,36 @@  discard block
 block discarded – undo
1939 1939
 
1940 1940
     $query_args = $gd_query_args_widgets;
1941 1941
     if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1942
-        return $wpdb->posts . ".post_date DESC, ";
1942
+        return $wpdb->posts.".post_date DESC, ";
1943 1943
     }
1944 1944
 
1945 1945
     $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1946
-    $table = $plugin_prefix . $post_type . '_detail';
1946
+    $table = $plugin_prefix.$post_type.'_detail';
1947 1947
 
1948 1948
     $sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
1949 1949
 
1950 1950
     switch ($sort_by) {
1951 1951
         case 'latest':
1952 1952
         case 'newest':
1953
-            $orderby = $wpdb->posts . ".post_date DESC, ";
1953
+            $orderby = $wpdb->posts.".post_date DESC, ";
1954 1954
             break;
1955 1955
         case 'featured':
1956
-            $orderby = $table . ".is_featured ASC, ";
1956
+            $orderby = $table.".is_featured ASC, ";
1957 1957
             break;
1958 1958
         case 'az':
1959
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1959
+            $orderby = $wpdb->posts.".post_title ASC, ";
1960 1960
             break;
1961 1961
         case 'high_review':
1962
-            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
1962
+            $orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, ";
1963 1963
             break;
1964 1964
         case 'high_rating':
1965
-            $orderby = "( " . $table . ".overall_rating  ) DESC, ";
1965
+            $orderby = "( ".$table.".overall_rating  ) DESC, ";
1966 1966
             break;
1967 1967
         case 'random':
1968 1968
             $orderby = "RAND(), ";
1969 1969
             break;
1970 1970
         default:
1971
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1971
+            $orderby = $wpdb->posts.".post_title ASC, ";
1972 1972
             break;
1973 1973
     }
1974 1974
 
@@ -1995,9 +1995,9 @@  discard block
 block discarded – undo
1995 1995
     $gd_query_args_widgets = $query_args;
1996 1996
 
1997 1997
     $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1998
-    $table = $plugin_prefix . $post_type . '_detail';
1998
+    $table = $plugin_prefix.$post_type.'_detail';
1999 1999
 
2000
-    $fields = $wpdb->posts . ".*, " . $table . ".*";
2000
+    $fields = $wpdb->posts.".*, ".$table.".*";
2001 2001
     /**
2002 2002
      * Filter widget listing fields string part that is being used for query.
2003 2003
      *
@@ -2008,7 +2008,7 @@  discard block
 block discarded – undo
2008 2008
      */
2009 2009
     $fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
2010 2010
 
2011
-    $join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
2011
+    $join = "INNER JOIN ".$table." ON (".$table.".post_id = ".$wpdb->posts.".ID)";
2012 2012
 
2013 2013
     ########### WPML ###########
2014 2014
 
@@ -2016,7 +2016,7 @@  discard block
 block discarded – undo
2016 2016
         global $sitepress;
2017 2017
         $lang_code = ICL_LANGUAGE_CODE;
2018 2018
         if ($lang_code) {
2019
-            $join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
2019
+            $join .= " JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID";
2020 2020
         }
2021 2021
     }
2022 2022
 
@@ -2031,9 +2031,9 @@  discard block
 block discarded – undo
2031 2031
      */
2032 2032
     $join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
2033 2033
 
2034
-    $post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
2034
+    $post_status = is_super_admin() ? " OR ".$wpdb->posts.".post_status = 'private'" : '';
2035 2035
 
2036
-    $where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
2036
+    $where = " AND ( ".$wpdb->posts.".post_status = 'publish' ".$post_status." ) AND ".$wpdb->posts.".post_type = '".$post_type."'";
2037 2037
 
2038 2038
     ########### WPML ###########
2039 2039
     if (function_exists('icl_object_id')) {
@@ -2050,7 +2050,7 @@  discard block
 block discarded – undo
2050 2050
      * @param string $post_type Post type.
2051 2051
      */
2052 2052
     $where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2053
-    $where = $where != '' ? " WHERE 1=1 " . $where : '';
2053
+    $where = $where != '' ? " WHERE 1=1 ".$where : '';
2054 2054
 
2055 2055
     $groupby = " GROUP BY $wpdb->posts.ID ";
2056 2056
     /**
@@ -2063,10 +2063,10 @@  discard block
 block discarded – undo
2063 2063
     $groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
2064 2064
 
2065 2065
     if ($count_only) {
2066
-        $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
2067
-			" . $join . "
2066
+        $sql = "SELECT COUNT(".$wpdb->posts.".ID) AS total FROM ".$wpdb->posts."
2067
+			" . $join."
2068 2068
 			" . $where;
2069
-        $rows = (int)$wpdb->get_var($sql);
2069
+        $rows = (int) $wpdb->get_var($sql);
2070 2070
     } else {
2071 2071
         $orderby = geodir_widget_listings_get_order($query_args);
2072 2072
         /**
@@ -2078,8 +2078,8 @@  discard block
 block discarded – undo
2078 2078
          * @param string $post_type Post type.
2079 2079
          */
2080 2080
         $orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2081
-        $orderby .= $wpdb->posts . ".post_title ASC";
2082
-        $orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2081
+        $orderby .= $wpdb->posts.".post_title ASC";
2082
+        $orderby = $orderby != '' ? " ORDER BY ".$orderby : '';
2083 2083
 
2084 2084
         $limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2085 2085
         /**
@@ -2092,16 +2092,16 @@  discard block
 block discarded – undo
2092 2092
         $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2093 2093
 
2094 2094
         $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2095
-        if ( !$page )
2095
+        if (!$page)
2096 2096
             $page = 1;
2097 2097
 
2098
-        $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
2098
+        $limit = (int) $limit > 0 ? " LIMIT ".absint(($page - 1) * (int) $limit).", ".(int) $limit : "";
2099 2099
 
2100
-        $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
2101
-			" . $join . "
2102
-			" . $where . "
2103
-			" . $groupby . "
2104
-			" . $orderby . "
2100
+        $sql = "SELECT SQL_CALC_FOUND_ROWS ".$fields." FROM ".$wpdb->posts."
2101
+			" . $join."
2102
+			" . $where."
2103
+			" . $groupby."
2104
+			" . $orderby."
2105 2105
 			" . $limit;
2106 2106
         $rows = $wpdb->get_results($sql);
2107 2107
     }
@@ -2154,10 +2154,10 @@  discard block
 block discarded – undo
2154 2154
     }
2155 2155
 
2156 2156
     $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2157
-    $table = $plugin_prefix . $post_type . '_detail';
2157
+    $table = $plugin_prefix.$post_type.'_detail';
2158 2158
 
2159 2159
     if (!empty($query_args['with_pics_only'])) {
2160
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2160
+        $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
2161 2161
     }
2162 2162
 
2163 2163
     if (!empty($query_args['tax_query'])) {
@@ -2189,7 +2189,7 @@  discard block
 block discarded – undo
2189 2189
         return $where;
2190 2190
     }
2191 2191
     $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2192
-    $table = $plugin_prefix . $post_type . '_detail';
2192
+    $table = $plugin_prefix.$post_type.'_detail';
2193 2193
 
2194 2194
     if (!empty($query_args)) {
2195 2195
         if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
@@ -2197,27 +2197,27 @@  discard block
 block discarded – undo
2197 2197
         }
2198 2198
 
2199 2199
         if (!empty($query_args['post_author'])) {
2200
-            $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2200
+            $where .= " AND ".$wpdb->posts.".post_author = ".(int) $query_args['post_author'];
2201 2201
         }
2202 2202
         
2203 2203
         if (!empty($query_args['show_featured_only'])) {
2204
-            $where .= " AND " . $table . ".is_featured = '1'";
2204
+            $where .= " AND ".$table.".is_featured = '1'";
2205 2205
         }
2206 2206
 
2207 2207
         if (!empty($query_args['show_special_only'])) {
2208
-            $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2208
+            $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
2209 2209
         }
2210 2210
 
2211 2211
         if (!empty($query_args['with_pics_only'])) {
2212
-            $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2212
+            $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL ";
2213 2213
         }
2214 2214
 
2215 2215
         if (!empty($query_args['featured_image_only'])) {
2216
-            $where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2216
+            $where .= " AND ".$table.".featured_image IS NOT NULL AND ".$table.".featured_image!='' ";
2217 2217
         }
2218 2218
 
2219 2219
         if (!empty($query_args['with_videos_only'])) {
2220
-            $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2220
+            $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
2221 2221
         }
2222 2222
 
2223 2223
         if (!empty($query_args['tax_query'])) {
@@ -2274,7 +2274,7 @@  discard block
 block discarded – undo
2274 2274
     }
2275 2275
 
2276 2276
     if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2277
-        $limit = (int)$query_args['posts_per_page'];
2277
+        $limit = (int) $query_args['posts_per_page'];
2278 2278
     }
2279 2279
 
2280 2280
     return $limit;
@@ -2417,9 +2417,9 @@  discard block
 block discarded – undo
2417 2417
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2418 2418
     }
2419 2419
     $home_url = str_replace("www.", "", $home_url);
2420
-    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')) ) {
2420
+    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'))) {
2421 2421
         return true;
2422
-    }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')){
2422
+    }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')) {
2423 2423
         return true;
2424 2424
     } else {
2425 2425
         return false;
@@ -2502,19 +2502,19 @@  discard block
 block discarded – undo
2502 2502
 
2503 2503
     $gd_post_type = geodir_get_current_posttype();
2504 2504
 
2505
-    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2506
-    if(!empty($gd_post_type)){
2505
+    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2506
+    if (!empty($gd_post_type)) {
2507 2507
         $default_post_type = $gd_post_type;
2508
-    }elseif(isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ){
2508
+    }elseif (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type'])) {
2509 2509
         $default_post_type = $instance['default_post_type'];
2510
-    }else{
2510
+    } else {
2511 2511
         $all_gd_post_type = geodir_get_posttypes();
2512 2512
         $default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2513 2513
     }
2514 2514
 
2515 2515
     $taxonomy = array();
2516 2516
     if (!empty($gd_post_type)) {
2517
-        $taxonomy[] = $gd_post_type . "category";
2517
+        $taxonomy[] = $gd_post_type."category";
2518 2518
     } else {
2519 2519
         $taxonomy = geodir_get_taxonomies($gd_post_type);
2520 2520
     }
@@ -2534,7 +2534,7 @@  discard block
 block discarded – undo
2534 2534
             $b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2535 2535
         }
2536 2536
 
2537
-        $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : '';
2537
+        $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type.'category']) ? $default_post_type.'category' : '';
2538 2538
 
2539 2539
         $tax_change_output = '';
2540 2540
         if (count($b_terms) > 1) {
@@ -2542,20 +2542,20 @@  discard block
 block discarded – undo
2542 2542
             foreach ($b_terms as $key => $val) {
2543 2543
                 $ptype = get_post_type_object(str_replace("category", "", $key));
2544 2544
                 $cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2545
-                $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2545
+                $tax_change_output .= "<option value='$key' ".selected($key, $default_taxonomy, false).">".sprintf(__('%s Categories', 'geodirectory'), $cpt_name)."</option>";
2546 2546
             }
2547 2547
             $tax_change_output .= "</select>";
2548 2548
         }
2549 2549
 
2550 2550
         if (!empty($b_terms)) {
2551
-            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2552
-            global $cat_count;//make global so we can change via function
2551
+            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array
2552
+            global $cat_count; //make global so we can change via function
2553 2553
             $cat_count = 0;
2554 2554
             ?>
2555 2555
             <div class="geodir-category-list-in clearfix">
2556 2556
                 <div class="geodir-cat-list clearfix">
2557 2557
                     <?php
2558
-                    echo $before_title . __($title) . $after_title;
2558
+                    echo $before_title.__($title).$after_title;
2559 2559
 
2560 2560
                     echo $tax_change_output;
2561 2561
 
@@ -2572,8 +2572,8 @@  discard block
 block discarded – undo
2572 2572
                     $hide = 'style="display:none;"';
2573 2573
                 }
2574 2574
                 echo "<div class='geodir-cat-list-more' $hide >";
2575
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>';
2576
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>';
2575
+                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">'.__('More Categories', 'geodirectory').'</a>';
2576
+                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">'.__('Less Categories', 'geodirectory').'</a>';
2577 2577
                 echo "</div>";
2578 2578
                 /* add scripts */
2579 2579
                 add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
@@ -2613,7 +2613,7 @@  discard block
 block discarded – undo
2613 2613
         $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2614 2614
         $total_post = $cat->count;
2615 2615
 
2616
-        $term_link = get_term_link( $cat, $cat->taxonomy );
2616
+        $term_link = get_term_link($cat, $cat->taxonomy);
2617 2617
         /**
2618 2618
          * Filer the category term link.
2619 2619
          *
@@ -2622,10 +2622,10 @@  discard block
 block discarded – undo
2622 2622
          * @param int    $cat->term_id The term id.
2623 2623
          * @param string $post_type Wordpress post type.
2624 2624
          */
2625
-        $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2625
+        $term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
2626 2626
 
2627
-        echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2628
-        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> ';
2627
+        echo '<li class="'.$class_row.'"><a href="'.$term_link.'">';
2628
+        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> ';
2629 2629
         echo '</a></li>';
2630 2630
     }
2631 2631
 }
@@ -2756,29 +2756,29 @@  discard block
 block discarded – undo
2756 2756
                 itemWidth: 75,
2757 2757
                 itemMargin: 5,
2758 2758
                 asNavFor: '#geodir_widget_slider',
2759
-                rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
2759
+                rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
2760 2760
             });
2761 2761
 
2762 2762
             jQuery('#geodir_widget_slider').flexslider({
2763
-                animation: "<?php echo $animation;?>",
2763
+                animation: "<?php echo $animation; ?>",
2764 2764
                 selector: ".geodir-slides > li",
2765 2765
                 namespace: "geodir-",
2766 2766
                 controlNav: true,
2767
-                animationLoop: <?php echo $animationLoop;?>,
2768
-                slideshow: <?php echo $slideshow;?>,
2769
-                slideshowSpeed: <?php echo $slideshowSpeed;?>,
2770
-                animationSpeed: <?php echo $animationSpeed;?>,
2771
-                directionNav: <?php echo $directionNav;?>,
2772
-                maxItems: <?php echo $max_show;?>,
2767
+                animationLoop: <?php echo $animationLoop; ?>,
2768
+                slideshow: <?php echo $slideshow; ?>,
2769
+                slideshowSpeed: <?php echo $slideshowSpeed; ?>,
2770
+                animationSpeed: <?php echo $animationSpeed; ?>,
2771
+                directionNav: <?php echo $directionNav; ?>,
2772
+                maxItems: <?php echo $max_show; ?>,
2773 2773
                 move: 1,
2774
-                <?php if($slide_width){ echo "itemWidth: ".$slide_width.",";}?>
2774
+                <?php if ($slide_width) { echo "itemWidth: ".$slide_width.","; }?>
2775 2775
                 sync: "#geodir_widget_carousel",
2776 2776
                 start: function (slider) {
2777 2777
                     jQuery('.geodir-listing-flex-loader').hide();
2778 2778
                     jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
2779 2779
                     jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
2780 2780
                 },
2781
-                rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
2781
+                rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
2782 2782
             });
2783 2783
         });
2784 2784
     </script>
@@ -2814,12 +2814,12 @@  discard block
 block discarded – undo
2814 2814
     $widget_listings = geodir_get_widget_listings($query_args);
2815 2815
     if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
2816 2816
         if ($title) {
2817
-            echo $before_title . $title . $after_title;
2817
+            echo $before_title.$title.$after_title;
2818 2818
         }
2819 2819
 
2820 2820
         global $post;
2821 2821
 
2822
-        $current_post = $post;// keep current post info
2822
+        $current_post = $post; // keep current post info
2823 2823
 
2824 2824
         $widget_main_slides = '';
2825 2825
         $nav_slides = '';
@@ -2837,11 +2837,11 @@  discard block
 block discarded – undo
2837 2837
                     $widget_spacer_height = ((200 - $widget_image->height) / 2);
2838 2838
                 }
2839 2839
 
2840
-                $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" />';
2840
+                $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" />';
2841 2841
 
2842 2842
                 $title = '';
2843 2843
                 if ($show_title) {
2844
-                    $title_html = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>';
2844
+                    $title_html = '<div class="geodir-slider-title"><a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a></div>';
2845 2845
                     $post_id = $post->ID;
2846 2846
                     $post_permalink = get_permalink($post->ID);
2847 2847
                     $post_title = get_the_title($post->ID);
@@ -2854,11 +2854,11 @@  discard block
 block discarded – undo
2854 2854
                      * @param string $post_permalink The post permalink url.
2855 2855
                      * @param string $post_title The post title text.
2856 2856
                      */
2857
-                    $title = apply_filters('geodir_listing_slider_title',$title_html,$post_id,$post_permalink,$post_title);
2857
+                    $title = apply_filters('geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title);
2858 2858
                 }
2859 2859
 
2860
-                $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>';
2861
-                $nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
2860
+                $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>';
2861
+                $nav_slides .= '<li><img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
2862 2862
                 $widget_slides++;
2863 2863
             }
2864 2864
         }
@@ -2902,7 +2902,7 @@  discard block
 block discarded – undo
2902 2902
     $title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2903 2903
 
2904 2904
     echo $before_widget;
2905
-    echo $before_title . $title . $after_title;
2905
+    echo $before_title.$title.$after_title;
2906 2906
 
2907 2907
     if (is_user_logged_in()) {
2908 2908
         global $current_user;
@@ -2944,7 +2944,7 @@  discard block
 block discarded – undo
2944 2944
                          */
2945 2945
                         $add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
2946 2946
 
2947
-                        $addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2947
+                        $addlisting_links .= '<option '.$selected.' value="'.$add_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
2948 2948
 
2949 2949
                     }
2950 2950
                 }
@@ -2990,7 +2990,7 @@  discard block
 block discarded – undo
2990 2990
                      */
2991 2991
                     $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
2992 2992
 
2993
-                    $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2993
+                    $favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
2994 2994
                 }
2995 2995
             }
2996 2996
 
@@ -3035,7 +3035,7 @@  discard block
 block discarded – undo
3035 3035
                      */
3036 3036
                     $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
3037 3037
 
3038
-                    $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
3038
+                    $listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3039 3039
                 }
3040 3040
             }
3041 3041
 
@@ -3218,7 +3218,7 @@  discard block
 block discarded – undo
3218 3218
     }
3219 3219
 
3220 3220
     if (empty($title) || $title == 'All') {
3221
-        $title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory');
3221
+        $title .= ' '.__(get_post_type_plural_label($post_type), 'geodirectory');
3222 3222
     }
3223 3223
 
3224 3224
     $location_url = array();
@@ -3272,7 +3272,7 @@  discard block
 block discarded – undo
3272 3272
             $geodir_add_location_url = '1';
3273 3273
         }
3274 3274
 
3275
-        $viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3275
+        $viewall_url = get_term_link((int) $category[0], $post_type.'category');
3276 3276
 
3277 3277
         $geodir_add_location_url = NULL;
3278 3278
     }
@@ -3280,7 +3280,7 @@  discard block
 block discarded – undo
3280 3280
         $gd_session->set('gd_multi_location', 1);
3281 3281
     }
3282 3282
 
3283
-    if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3283
+    if (is_wp_error($viewall_url)) {$viewall_url = ''; }
3284 3284
 
3285 3285
     $query_args = array(
3286 3286
         'posts_per_page' => $post_number,
@@ -3346,7 +3346,7 @@  discard block
 block discarded – undo
3346 3346
              */
3347 3347
             do_action('geodir_before_view_all_link_in_widget'); ?>
3348 3348
             <div class="geodir_list_heading clearfix">
3349
-                <?php echo $before_title . $title . $after_title; ?>
3349
+                <?php echo $before_title.$title.$after_title; ?>
3350 3350
                 <a href="<?php echo $viewall_url; ?>"
3351 3351
                    class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3352 3352
             </div>
@@ -3432,9 +3432,9 @@  discard block
 block discarded – undo
3432 3432
 {
3433 3433
     global $wpdb, $plugin_prefix;
3434 3434
 
3435
-    $detail_table = $plugin_prefix . $post_type . '_detail';
3435
+    $detail_table = $plugin_prefix.$post_type.'_detail';
3436 3436
 
3437
-    $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 . ")";
3437
+    $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.")";
3438 3438
 
3439 3439
     /**
3440 3440
      * Filter count review sql query.
@@ -3473,7 +3473,7 @@  discard block
 block discarded – undo
3473 3473
      * @param bool $force_update Force update option value?. Default.false.
3474 3474
      * @param int $post_ID The post id to update if any.
3475 3475
      */
3476
-    $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update,$post_ID);
3476
+    $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update, $post_ID);
3477 3477
     if (!empty($option_data)) {
3478 3478
         return $option_data;
3479 3479
     }
@@ -3481,11 +3481,11 @@  discard block
 block discarded – undo
3481 3481
     $option_data = get_option('geodir_global_review_count');
3482 3482
 
3483 3483
     if (!$option_data || $force_update) {
3484
-        if ((int)$post_ID > 0) { // Update reviews count for specific post categories only.
3484
+        if ((int) $post_ID > 0) { // Update reviews count for specific post categories only.
3485 3485
             global $gd_session;
3486
-            $term_array = (array)$option_data;
3486
+            $term_array = (array) $option_data;
3487 3487
             $post_type = get_post_type($post_ID);
3488
-            $taxonomy = $post_type . 'category';
3488
+            $taxonomy = $post_type.'category';
3489 3489
             $terms = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3490 3490
 
3491 3491
             if (!empty($terms) && !is_wp_error($terms)) {
@@ -3500,9 +3500,9 @@  discard block
 block discarded – undo
3500 3500
             
3501 3501
             $terms = array();
3502 3502
             if (isset($_POST['post_category'][$taxonomy])) {
3503
-                $terms = (array)$_POST['post_category'][$taxonomy];
3503
+                $terms = (array) $_POST['post_category'][$taxonomy];
3504 3504
             } else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
3505
-                $terms = (array)$session_listing['post_category'][$taxonomy];
3505
+                $terms = (array) $session_listing['post_category'][$taxonomy];
3506 3506
             }
3507 3507
             
3508 3508
             if (!empty($terms)) {
@@ -3590,7 +3590,7 @@  discard block
 block discarded – undo
3590 3590
     return true;
3591 3591
 }
3592 3592
 
3593
-function geodir_term_review_count_force_update_single_post($post_id){
3593
+function geodir_term_review_count_force_update_single_post($post_id) {
3594 3594
     geodir_count_reviews_by_terms(true, $post_id); 
3595 3595
 }
3596 3596
 
@@ -3727,17 +3727,17 @@  discard block
 block discarded – undo
3727 3727
      */
3728 3728
     $locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
3729 3729
 
3730
-    load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo');
3731
-    load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages');
3730
+    load_textdomain('geodirectory', WP_LANG_DIR.'/'.'geodirectory'.'/'.'geodirectory'.'-'.$locale.'.mo');
3731
+    load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))).'/geodirectory-languages');
3732 3732
 
3733 3733
     /**
3734 3734
      * Define language constants.
3735 3735
      *
3736 3736
      * @since 1.0.0
3737 3737
      */
3738
-    require_once(geodir_plugin_path() . '/language.php');
3738
+    require_once(geodir_plugin_path().'/language.php');
3739 3739
 
3740
-    $language_file = geodir_plugin_path() . '/db-language.php';
3740
+    $language_file = geodir_plugin_path().'/db-language.php';
3741 3741
 
3742 3742
     // Load language string file if not created yet
3743 3743
     if (!file_exists($language_file)) {
@@ -3752,8 +3752,8 @@  discard block
 block discarded – undo
3752 3752
          */
3753 3753
         try {
3754 3754
             require_once($language_file);
3755
-        } catch(Exception $e) {
3756
-            error_log('Language Error: ' . $e->getMessage());
3755
+        } catch (Exception $e) {
3756
+            error_log('Language Error: '.$e->getMessage());
3757 3757
         }
3758 3758
     }
3759 3759
 }
@@ -3770,18 +3770,18 @@  discard block
 block discarded – undo
3770 3770
  */
3771 3771
 function geodirectory_load_db_language() {
3772 3772
     global $wp_filesystem;
3773
-    if( empty( $wp_filesystem ) ) {
3774
-        require_once( ABSPATH .'/wp-admin/includes/file.php' );
3773
+    if (empty($wp_filesystem)) {
3774
+        require_once(ABSPATH.'/wp-admin/includes/file.php');
3775 3775
         WP_Filesystem();
3776 3776
         global $wp_filesystem;
3777 3777
     }
3778 3778
 
3779
-    $language_file = geodir_plugin_path() . '/db-language.php';
3779
+    $language_file = geodir_plugin_path().'/db-language.php';
3780 3780
 
3781
-    if(is_file($language_file) && !is_writable($language_file))
3781
+    if (is_file($language_file) && !is_writable($language_file))
3782 3782
         return false; // Not possible to create.
3783 3783
 
3784
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3784
+    if (!is_file($language_file) && !is_writable(dirname($language_file)))
3785 3785
         return false; // Not possible to create.
3786 3786
 
3787 3787
     $contents_strings = array();
@@ -3815,17 +3815,17 @@  discard block
 block discarded – undo
3815 3815
     $contents = implode(PHP_EOL, $contents_head);
3816 3816
 
3817 3817
     if (!empty($contents_strings)) {
3818
-        foreach ( $contents_strings as $string ) {
3818
+        foreach ($contents_strings as $string) {
3819 3819
             if (is_scalar($string) && $string != '') {
3820 3820
                 $string = str_replace("'", "\'", $string);
3821
-                $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
3821
+                $contents .= PHP_EOL."__('".$string."', 'geodirectory');";
3822 3822
             }
3823 3823
         }
3824 3824
     }
3825 3825
 
3826 3826
     $contents .= implode(PHP_EOL, $contents_foot);
3827 3827
 
3828
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3828
+    if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE))
3829 3829
         return false; // Failure; could not write file.
3830 3830
 
3831 3831
     return true;
@@ -3847,11 +3847,11 @@  discard block
 block discarded – undo
3847 3847
     global $wpdb;
3848 3848
 
3849 3849
     // Custom fields table
3850
-    $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
3850
+    $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM ".GEODIR_CUSTOM_FIELDS_TABLE;
3851 3851
     $rows = $wpdb->get_results($sql);
3852 3852
 
3853 3853
     if (!empty($rows)) {
3854
-        foreach($rows as $row) {
3854
+        foreach ($rows as $row) {
3855 3855
             if (!empty($row->admin_title))
3856 3856
                 $translation_texts[] = stripslashes_deep($row->admin_title);
3857 3857
 			
@@ -3885,11 +3885,11 @@  discard block
 block discarded – undo
3885 3885
     }
3886 3886
 	
3887 3887
     // Custom sorting fields table
3888
-    $sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3888
+    $sql = "SELECT site_title, asc_title, desc_title FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3889 3889
     $rows = $wpdb->get_results($sql);
3890 3890
 
3891 3891
     if (!empty($rows)) {
3892
-        foreach($rows as $row) {
3892
+        foreach ($rows as $row) {
3893 3893
             if (!empty($row->site_title))
3894 3894
                 $translation_texts[] = stripslashes_deep($row->site_title);
3895 3895
 
@@ -3903,11 +3903,11 @@  discard block
 block discarded – undo
3903 3903
 	
3904 3904
 	// Advance search filter fields table
3905 3905
 	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
3906
-		$sql = "SELECT field_site_name, front_search_title, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE;
3906
+		$sql = "SELECT field_site_name, front_search_title, field_desc FROM ".GEODIR_ADVANCE_SEARCH_TABLE;
3907 3907
 		$rows = $wpdb->get_results($sql);
3908 3908
 
3909 3909
 		if (!empty($rows)) {
3910
-			foreach($rows as $row) {
3910
+			foreach ($rows as $row) {
3911 3911
 				if (!empty($row->field_site_name))
3912 3912
 					$translation_texts[] = stripslashes_deep($row->field_site_name);
3913 3913
 
@@ -3942,7 +3942,7 @@  discard block
 block discarded – undo
3942 3942
      *
3943 3943
      * @param array $geodir_allowed_mime_types and file extensions.
3944 3944
      */
3945
-    return apply_filters( 'geodir_allowed_mime_types', array(
3945
+    return apply_filters('geodir_allowed_mime_types', array(
3946 3946
             'Image' => array( // Image formats.
3947 3947
                 'jpg' => 'image/jpeg',
3948 3948
                 'jpe' => 'image/jpeg',
@@ -4031,13 +4031,13 @@  discard block
 block discarded – undo
4031 4031
 
4032 4032
 
4033 4033
 
4034
-add_filter('wpseo_replacements','geodir_wpseo_replacements',10,1);
4034
+add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
4035 4035
 /*
4036 4036
  * Add location variables to wpseo replacements.
4037 4037
  *
4038 4038
  * @since 1.5.4
4039 4039
  */
4040
-function geodir_wpseo_replacements($vars){
4040
+function geodir_wpseo_replacements($vars) {
4041 4041
 
4042 4042
     global $wp;
4043 4043
     $title = '';
@@ -4052,12 +4052,12 @@  discard block
 block discarded – undo
4052 4052
      * @param array $location_array The array of location variables.
4053 4053
      * @param array $vars The page title variables.
4054 4054
      */
4055
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
4055
+    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
4056 4056
     $location_titles = array();
4057
-    if(get_query_var( 'gd_country_full' )){
4058
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4059
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4060
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4057
+    if (get_query_var('gd_country_full')) {
4058
+        if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
4059
+        if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
4060
+        if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
4061 4061
     }
4062 4062
     $location_single = '';
4063 4063
     $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
@@ -4129,23 +4129,23 @@  discard block
 block discarded – undo
4129 4129
     }
4130 4130
 
4131 4131
 
4132
-    if(!empty($location_titles)) {
4132
+    if (!empty($location_titles)) {
4133 4133
         $vars['%%location%%'] = implode(", ", $location_titles);
4134 4134
     }
4135 4135
 
4136 4136
 
4137
-    if(!empty($location_titles)) {
4138
-        $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
4137
+    if (!empty($location_titles)) {
4138
+        $vars['%%in_location%%'] = __('in ', 'geodirectory').implode(", ", $location_titles);
4139 4139
     }
4140 4140
 
4141 4141
 
4142 4142
 
4143
-    if($location_single) {
4144
-        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
4143
+    if ($location_single) {
4144
+        $vars['%%in_location_single%%'] = __('in', 'geodirectory').' '.$location_single;
4145 4145
     }
4146 4146
 
4147 4147
 
4148
-    if($location_single) {
4148
+    if ($location_single) {
4149 4149
         $vars['%%location_single%%'] = $location_single;
4150 4150
     }
4151 4151
 
@@ -4157,13 +4157,13 @@  discard block
 block discarded – undo
4157 4157
      * @param string $vars The title with variables.
4158 4158
      * @param array $location_array The array of location variables.
4159 4159
      */
4160
-    return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
4160
+    return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
4161 4161
 }
4162 4162
 
4163 4163
 
4164
-add_filter('geodir_seo_meta_title','geodir_filter_title_variables',10,3);
4165
-add_filter('geodir_seo_page_title','geodir_filter_title_variables',10,2);
4166
-add_filter('geodir_seo_meta_description_pre','geodir_filter_title_variables',10,3);
4164
+add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
4165
+add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
4166
+add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
4167 4167
 
4168 4168
 /**
4169 4169
  * Filter the title variables.
@@ -4222,19 +4222,19 @@  discard block
 block discarded – undo
4222 4222
         $sep = apply_filters('geodir_page_title_separator', '|');
4223 4223
     }
4224 4224
 
4225
-    if (strpos($title,'%%title%%') !== false) {
4225
+    if (strpos($title, '%%title%%') !== false) {
4226 4226
         $title = str_replace("%%title%%", $post->post_title, $title);
4227 4227
     }
4228 4228
 
4229
-    if (strpos($title,'%%sitename%%') !== false) {
4229
+    if (strpos($title, '%%sitename%%') !== false) {
4230 4230
         $title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
4231 4231
     }
4232 4232
 
4233
-    if (strpos($title,'%%sitedesc%%') !== false) {
4233
+    if (strpos($title, '%%sitedesc%%') !== false) {
4234 4234
         $title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
4235 4235
     }
4236 4236
 
4237
-    if (strpos($title,'%%excerpt%%') !== false) {
4237
+    if (strpos($title, '%%excerpt%%') !== false) {
4238 4238
         $title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
4239 4239
     }
4240 4240
     
@@ -4242,8 +4242,8 @@  discard block
 block discarded – undo
4242 4242
         $post_type = isset($_REQUEST['stype']) ? sanitize_text_field($_REQUEST['stype']) : '';
4243 4243
     } else if ($gd_page == 'add-listing') {
4244 4244
         $post_type = (isset($_REQUEST['listing_type'])) ? sanitize_text_field($_REQUEST['listing_type']) : '';
4245
-        $post_type = !$post_type && !empty($_REQUEST['pid']) ? get_post_type((int)$_REQUEST['pid']) : $post_type;
4246
-    } else if (isset($post->post_type) && $post->post_type && in_array($post->post_type , geodir_get_posttypes())) {
4245
+        $post_type = !$post_type && !empty($_REQUEST['pid']) ? get_post_type((int) $_REQUEST['pid']) : $post_type;
4246
+    } else if (isset($post->post_type) && $post->post_type && in_array($post->post_type, geodir_get_posttypes())) {
4247 4247
         $post_type = $post->post_type;
4248 4248
     } else {
4249 4249
         $post_type = get_query_var('post_type');
@@ -4270,9 +4270,9 @@  discard block
 block discarded – undo
4270 4270
     if (strpos($title, '%%category%%') !== false) {
4271 4271
         $cat_name = '';
4272 4272
 
4273
-        if ($gd_page=='detail') {
4273
+        if ($gd_page == 'detail') {
4274 4274
             if ($post->default_category) {
4275
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4275
+                $cat = get_term($post->default_category, $post->post_type.'category');
4276 4276
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4277 4277
             }
4278 4278
         } else if ($gd_page == 'listing') {
@@ -4287,12 +4287,12 @@  discard block
 block discarded – undo
4287 4287
     if (strpos($title, '%%tag%%') !== false) {
4288 4288
         $cat_name = '';
4289 4289
 
4290
-        if ($gd_page=='detail') {
4290
+        if ($gd_page == 'detail') {
4291 4291
             if ($post->default_category) {
4292
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4292
+                $cat = get_term($post->default_category, $post->post_type.'category');
4293 4293
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4294 4294
             }
4295
-        } else if($gd_page == 'listing') {
4295
+        } else if ($gd_page == 'listing') {
4296 4296
             $queried_object = get_queried_object();
4297 4297
             if (isset($queried_object->name)) {
4298 4298
                 $cat_name = $queried_object->name;
@@ -4306,7 +4306,7 @@  discard block
 block discarded – undo
4306 4306
         $title = str_replace("%%id%%", $ID, $title);
4307 4307
     }
4308 4308
 
4309
-    if (strpos($title,'%%sep%%') !== false) {
4309
+    if (strpos($title, '%%sep%%') !== false) {
4310 4310
         $title = str_replace("%%sep%%", $sep, $title);
4311 4311
     }
4312 4312
 
@@ -4323,12 +4323,12 @@  discard block
 block discarded – undo
4323 4323
      * @param string $gd_page The page being filtered.
4324 4324
      * @param string $sep The separator, default: `|`.
4325 4325
      */
4326
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4326
+    $location_array = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
4327 4327
     $location_titles = array();
4328
-    if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4329
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4330
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4331
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4328
+    if ($gd_page == 'location' && get_query_var('gd_country_full')) {
4329
+        if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
4330
+        if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
4331
+        if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
4332 4332
     }
4333 4333
     $location_single = '';
4334 4334
     $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
@@ -4400,51 +4400,51 @@  discard block
 block discarded – undo
4400 4400
     }
4401 4401
 
4402 4402
 
4403
-    if(strpos($title,'%%location%%') !== false){
4403
+    if (strpos($title, '%%location%%') !== false) {
4404 4404
         $location = '';
4405
-        if($location_titles) {
4405
+        if ($location_titles) {
4406 4406
             $location = implode(", ", $location_titles);
4407 4407
         }
4408
-        $title = str_replace("%%location%%",$location,$title);
4408
+        $title = str_replace("%%location%%", $location, $title);
4409 4409
     }
4410 4410
 
4411
-    if(strpos($title,'%%in_location%%') !== false){
4411
+    if (strpos($title, '%%in_location%%') !== false) {
4412 4412
         $location = '';
4413
-        if($location_titles) {
4414
-            $location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4413
+        if ($location_titles) {
4414
+            $location = __('in ', 'geodirectory').implode(", ", $location_titles);
4415 4415
         }
4416
-        $title = str_replace("%%in_location%%",$location,$title);
4416
+        $title = str_replace("%%in_location%%", $location, $title);
4417 4417
     }
4418 4418
 
4419
-    if(strpos($title,'%%in_location_single%%') !== false){
4420
-        if($location_single) {
4421
-            $location_single = __('in', 'geodirectory') . ' ' .$location_single;
4419
+    if (strpos($title, '%%in_location_single%%') !== false) {
4420
+        if ($location_single) {
4421
+            $location_single = __('in', 'geodirectory').' '.$location_single;
4422 4422
         }
4423
-        $title = str_replace("%%in_location_single%%",$location_single,$title);
4423
+        $title = str_replace("%%in_location_single%%", $location_single, $title);
4424 4424
     }
4425 4425
 
4426
-    if(strpos($title,'%%location_single%%') !== false){
4427
-        $title = str_replace("%%location_single%%",$location_single,$title);
4426
+    if (strpos($title, '%%location_single%%') !== false) {
4427
+        $title = str_replace("%%location_single%%", $location_single, $title);
4428 4428
     }
4429 4429
 
4430 4430
 
4431
-    if(strpos($title,'%%search_term%%') !== false){
4431
+    if (strpos($title, '%%search_term%%') !== false) {
4432 4432
         $search_term = '';
4433
-        if(isset($_REQUEST['s'])){
4433
+        if (isset($_REQUEST['s'])) {
4434 4434
             $search_term = esc_attr($_REQUEST['s']);
4435 4435
         }
4436
-        $title = str_replace("%%search_term%%",$search_term,$title);
4436
+        $title = str_replace("%%search_term%%", $search_term, $title);
4437 4437
     }
4438 4438
 
4439
-    if(strpos($title,'%%search_near%%') !== false){
4439
+    if (strpos($title, '%%search_near%%') !== false) {
4440 4440
         $search_term = '';
4441
-        if(isset($_REQUEST['snear'])){
4441
+        if (isset($_REQUEST['snear'])) {
4442 4442
             $search_term = esc_attr($_REQUEST['snear']);
4443 4443
         }
4444
-        $title = str_replace("%%search_near%%",$search_term,$title);
4444
+        $title = str_replace("%%search_near%%", $search_term, $title);
4445 4445
     }
4446 4446
 
4447
-    if(strpos($title,'%%name%%') !== false){
4447
+    if (strpos($title, '%%name%%') !== false) {
4448 4448
         if (is_author()) {
4449 4449
             $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
4450 4450
             $author_name = $curauth->display_name;
@@ -4474,9 +4474,9 @@  discard block
 block discarded – undo
4474 4474
         $title = str_replace("%%pagetotal%%", $pagetotal, $title);
4475 4475
     }
4476 4476
 
4477
-    $title = wptexturize( $title );
4478
-    $title = convert_chars( $title );
4479
-    $title = esc_html( $title );
4477
+    $title = wptexturize($title);
4478
+    $title = convert_chars($title);
4479
+    $title = esc_html($title);
4480 4480
 
4481 4481
     /**
4482 4482
      * Filter the title variables after standard ones have been filtered.
@@ -4489,7 +4489,7 @@  discard block
 block discarded – undo
4489 4489
      * @param string $sep The separator, default: `|`.
4490 4490
      */
4491 4491
 
4492
-    return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4492
+    return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
4493 4493
 }
4494 4494
 
4495 4495
 /**
@@ -4612,7 +4612,7 @@  discard block
 block discarded – undo
4612 4612
     }
4613 4613
     
4614 4614
     $action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
4615
-    $is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) )  ? true : false;
4615
+    $is_admin = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false;
4616 4616
     $inline_save = $action == 'inline-save' ? true : false;
4617 4617
 
4618 4618
     if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
@@ -4623,7 +4623,7 @@  discard block
 block discarded – undo
4623 4623
         return;
4624 4624
     }
4625 4625
 
4626
-    $user_id = (int)get_current_user_id();
4626
+    $user_id = (int) get_current_user_id();
4627 4627
         
4628 4628
     if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4629 4629
         $author_id = !empty($post->post_author) ? $post->post_author : 0;
@@ -4667,7 +4667,7 @@  discard block
 block discarded – undo
4667 4667
     $nr  = geodir_title_meta_pagenumbering('nr');
4668 4668
 
4669 4669
     if ($max > 1 && $nr > 1) {
4670
-        $replacement = sprintf($sep . ' ' . __('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
4670
+        $replacement = sprintf($sep.' '.__('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
4671 4671
     }
4672 4672
 
4673 4673
     return $replacement;
@@ -4686,7 +4686,7 @@  discard block
 block discarded – undo
4686 4686
 
4687 4687
     $nr = geodir_title_meta_pagenumbering('nr');
4688 4688
     if (isset($nr) && $nr > 0) {
4689
-        $replacement = (string)$nr;
4689
+        $replacement = (string) $nr;
4690 4690
     }
4691 4691
 
4692 4692
     return $replacement;
@@ -4705,7 +4705,7 @@  discard block
 block discarded – undo
4705 4705
 
4706 4706
     $max = geodir_title_meta_pagenumbering('max');
4707 4707
     if (isset($max) && $max > 0) {
4708
-        $replacement = (string)$max;
4708
+        $replacement = (string) $max;
4709 4709
     }
4710 4710
 
4711 4711
     return $replacement;
@@ -4747,7 +4747,7 @@  discard block
 block discarded – undo
4747 4747
         }
4748 4748
 
4749 4749
         if (isset($post->post_content)) {
4750
-            $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->' ) + 1);
4750
+            $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->') + 1);
4751 4751
         }
4752 4752
     }
4753 4753
 
@@ -4782,7 +4782,7 @@  discard block
 block discarded – undo
4782 4782
     foreach ($terms as $term) {
4783 4783
         if (isset($term->count) && $term->count > 0) {
4784 4784
             $return[] = $term;
4785
-        }else{
4785
+        } else {
4786 4786
             /**
4787 4787
              * Allow to filter terms with no count.
4788 4788
              *
@@ -4790,7 +4790,7 @@  discard block
 block discarded – undo
4790 4790
              * @param array $return The array or terms to return.
4791 4791
              * @param object $term The term object.
4792 4792
              */
4793
-            $return =  apply_filters( 'geodir_filter_empty_terms_filter',$return, $term);
4793
+            $return = apply_filters('geodir_filter_empty_terms_filter', $return, $term);
4794 4794
         }
4795 4795
     }
4796 4796
     return $return;
@@ -4805,10 +4805,10 @@  discard block
 block discarded – undo
4805 4805
  *
4806 4806
  * @return array
4807 4807
  */
4808
-function geodir_remove_hentry( $class ) {
4809
-    if(geodir_is_page('detail')){
4810
-        $class = array_diff( $class, array( 'hentry' ) );
4808
+function geodir_remove_hentry($class) {
4809
+    if (geodir_is_page('detail')) {
4810
+        $class = array_diff($class, array('hentry'));
4811 4811
     }
4812 4812
     return $class;
4813 4813
 }
4814
-add_filter( 'post_class', 'geodir_remove_hentry' );
4815 4814
\ No newline at end of file
4815
+add_filter('post_class', 'geodir_remove_hentry');
4816 4816
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +272 added lines, -187 removed lines patch added patch discarded remove patch
@@ -30,8 +30,10 @@  discard block
 block discarded – undo
30 30
 
31 31
     if (is_ssl()) :
32 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__)));
33
+    else {
34
+    	:
35
+        return WP_PLUGIN_URL . "/" . plugin_basename(dirname(dirname(__FILE__)));
36
+    }
35 37
     endif;
36 38
 }
37 39
 
@@ -67,7 +69,9 @@  discard block
 block discarded – undo
67 69
 {
68 70
     $active_plugins = get_option('active_plugins');
69 71
     foreach ($active_plugins as $key => $active_plugin) {
70
-        if (strstr($active_plugin, $plugin)) return true;
72
+        if (strstr($active_plugin, $plugin)) {
73
+        	return true;
74
+        }
71 75
     }
72 76
     return false;
73 77
 }
@@ -118,12 +122,25 @@  discard block
 block discarded – undo
118 122
  */
119 123
 function geodir_getlink($url, $params = array(), $use_existing_arguments = false)
120 124
 {
121
-    if ($use_existing_arguments) $params = $params + $_GET;
122
-    if (!$params) return $url;
125
+    if ($use_existing_arguments) {
126
+    	$params = $params + $_GET;
127
+    }
128
+    if (!$params) {
129
+    	return $url;
130
+    }
123 131
     $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 .= '&amp;'; //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.
132
+    if (strpos($link, '?') === false) {
133
+    	$link .= '?';
134
+    }
135
+    //If there is no '?' add one at the end
136
+    elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) {
137
+    	$link .= '&amp;';
138
+    }
139
+    //If there is no '&' at the END, add one.
140
+    elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) {
141
+    	$link .= '&';
142
+    }
143
+    //If there is no '&' at the END, add one.
127 144
 
128 145
     $params_arr = array();
129 146
     foreach ($params as $key => $value) {
@@ -161,9 +178,10 @@  discard block
 block discarded – undo
161 178
         $add_listing_link = get_page_link(geodir_add_listing_page_id());
162 179
 
163 180
         return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
164
-    } else
165
-        return get_bloginfo('url');
166
-}
181
+    } else {
182
+            return get_bloginfo('url');
183
+    }
184
+    }
167 185
 
168 186
 /**
169 187
  * Get the current page URL.
@@ -268,24 +286,28 @@  discard block
 block discarded – undo
268 286
         case 'preview':
269 287
             if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
270 288
                 && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
271
-            )
272
-                return true;
289
+            ) {
290
+                            return true;
291
+            }
273 292
             break;
274 293
         case 'listing-success':
275
-            if (is_page() && get_query_var('page_id') == geodir_success_page_id())
276
-                return true;
294
+            if (is_page() && get_query_var('page_id') == geodir_success_page_id()) {
295
+                            return true;
296
+            }
277 297
             break;
278 298
         case 'detail':
279 299
             $post_type = get_query_var('post_type');
280 300
             if(is_array($post_type)){$post_type = reset($post_type);}
281
-            if (is_single() && in_array($post_type, geodir_get_posttypes()))
282
-                return true;
301
+            if (is_single() && in_array($post_type, geodir_get_posttypes())) {
302
+                            return true;
303
+            }
283 304
             break;
284 305
         case 'pt':
285 306
             $post_type = get_query_var('post_type');
286 307
             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;
308
+            if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax()) {
309
+                            return true;
310
+            }
289 311
 
290 312
             break;
291 313
         case 'listing':
@@ -296,23 +318,27 @@  discard block
 block discarded – undo
296 318
             }
297 319
             $post_type = get_query_var('post_type');
298 320
             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;
321
+            if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) {
322
+                            return true;
323
+            }
301 324
 
302 325
             break;
303 326
         case 'home':
304 327
 
305
-            if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home())
306
-                return true;
328
+            if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home()) {
329
+                            return true;
330
+            }
307 331
 
308 332
             break;
309 333
         case 'location':
310
-            if (is_page() && get_query_var('page_id') == geodir_location_page_id())
311
-                return true;
334
+            if (is_page() && get_query_var('page_id') == geodir_location_page_id()) {
335
+                            return true;
336
+            }
312 337
             break;
313 338
         case 'author':
314
-            if (is_author() && isset($_REQUEST['geodir_dashbord']))
315
-                return true;
339
+            if (is_author() && isset($_REQUEST['geodir_dashbord'])) {
340
+                            return true;
341
+            }
316 342
 			
317 343
 			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) {
318 344
 				if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) {
@@ -321,24 +347,29 @@  discard block
 block discarded – undo
321 347
 			}
322 348
             break;
323 349
         case 'search':
324
-            if (is_search() && isset($_REQUEST['geodir_search']))
325
-                return true;
350
+            if (is_search() && isset($_REQUEST['geodir_search'])) {
351
+                            return true;
352
+            }
326 353
             break;
327 354
         case 'info':
328
-            if (is_page() && get_query_var('page_id') == geodir_info_page_id())
329
-                return true;
355
+            if (is_page() && get_query_var('page_id') == geodir_info_page_id()) {
356
+                            return true;
357
+            }
330 358
             break;
331 359
         case 'login':
332
-            if (is_page() && get_query_var('page_id') == geodir_login_page_id())
333
-                return true;
360
+            if (is_page() && get_query_var('page_id') == geodir_login_page_id()) {
361
+                            return true;
362
+            }
334 363
             break;
335 364
         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;
365
+            if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id()) {
366
+                            return true;
367
+            }
338 368
             break;
339 369
         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;
370
+            if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id()) {
371
+                            return true;
372
+            }
342 373
             break;
343 374
         default:
344 375
             return false;
@@ -366,8 +397,9 @@  discard block
 block discarded – undo
366 397
         //$wp->query_vars['gd_is_geodir_page'] = false;
367 398
         //print_r()
368 399
         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;
400
+            if (get_option('geodir_set_as_home')) {
401
+                            $wp->query_vars['gd_is_geodir_page'] = true;
402
+            }
371 403
             if(geodir_is_page('home')){
372 404
                 $wp->query_vars['gd_is_geodir_page'] = true;
373 405
             }
@@ -386,8 +418,9 @@  discard block
 block discarded – undo
386 418
                 || $wp->query_vars['page_id'] == geodir_login_page_id()
387 419
                 || (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
388 420
                 || (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;
421
+            ) {
422
+                            $wp->query_vars['gd_is_geodir_page'] = true;
423
+            }
391 424
         }
392 425
 
393 426
         if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
@@ -404,8 +437,9 @@  discard block
 block discarded – undo
404 437
                     || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
405 438
                     || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
406 439
                 )
407
-            )
408
-                $wp->query_vars['gd_is_geodir_page'] = true;
440
+            ) {
441
+                            $wp->query_vars['gd_is_geodir_page'] = true;
442
+            }
409 443
         }
410 444
 
411 445
 
@@ -431,12 +465,14 @@  discard block
 block discarded – undo
431 465
 
432 466
         }
433 467
 
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;
468
+        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) {
469
+                    $wp->query_vars['gd_is_geodir_page'] = true;
470
+        }
436 471
 
437 472
 
438
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search']))
439
-            $wp->query_vars['gd_is_geodir_page'] = true;
473
+        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) {
474
+                    $wp->query_vars['gd_is_geodir_page'] = true;
475
+        }
440 476
 
441 477
 
442 478
 //check if homepage
@@ -466,11 +502,12 @@  discard block
 block discarded – undo
466 502
 function geodir_is_geodir_page()
467 503
 {
468 504
     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
-}
505
+    if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) {
506
+            return true;
507
+    } else {
508
+            return false;
509
+    }
510
+    }
474 511
 
475 512
 if (!function_exists('geodir_get_imagesize')) {
476 513
     /**
@@ -848,20 +885,16 @@  discard block
 block discarded – undo
848 885
             $subject .= ' - ADMIN BCC COPY';
849 886
             $admin_bcc = true;
850 887
 
851
-        }
852
-        elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
888
+        } elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
853 889
             $subject .= ' - ADMIN BCC COPY';
854 890
             $admin_bcc = true;
855
-        }
856
-        elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
891
+        } elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
857 892
             $subject .= ' - ADMIN BCC COPY';
858 893
             $admin_bcc = true;
859
-        }
860
-        elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
894
+        } elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
861 895
             $subject .= ' - ADMIN BCC COPY';
862 896
             $admin_bcc = true;
863
-        }
864
-        elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
897
+        } elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
865 898
             $subject .= ' - ADMIN BCC COPY';
866 899
             $admin_bcc = true;
867 900
         }
@@ -1030,21 +1063,24 @@  discard block
 block discarded – undo
1030 1063
             $is_location_last = '';
1031 1064
             $is_taxonomy_last = '';
1032 1065
             $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';
1066
+            if (get_query_var($gd_post_type . 'category')) {
1067
+                            $gd_taxonomy = $gd_post_type . 'category';
1068
+            } elseif (get_query_var($gd_post_type . '_tags')) {
1069
+                            $gd_taxonomy = $gd_post_type . '_tags';
1070
+            }
1037 1071
 
1038 1072
             $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;
1073
+            if (!empty($gd_taxonomy) || geodir_is_page('detail')) {
1074
+                            $is_location_last = false;
1075
+            } else {
1076
+                            $is_location_last = true;
1077
+            }
1078
+
1079
+            if (!empty($gd_taxonomy) && geodir_is_page('listing')) {
1080
+                            $is_taxonomy_last = true;
1081
+            } else {
1082
+                            $is_taxonomy_last = false;
1083
+            }
1048 1084
 
1049 1085
             if (!empty($location_terms)) {
1050 1086
                 $geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
@@ -1126,8 +1162,9 @@  discard block
 block discarded – undo
1126 1162
                 {
1127 1163
                     if (get_query_var($gd_post_type . '_tags')) {
1128 1164
                         $cat_link = $listing_link . 'tags/';
1129
-                    } else
1130
-                        $cat_link = $listing_link;
1165
+                    } else {
1166
+                                            $cat_link = $listing_link;
1167
+                    }
1131 1168
 
1132 1169
                     foreach ($location_terms as $key => $location_term) {
1133 1170
                         if ($location_manager && in_array($key, $hide_url_part)) {
@@ -1155,9 +1192,9 @@  discard block
 block discarded – undo
1155 1192
                             //$term_link_text = wp_strip_all_tags(geodir_ucwords(urldecode($term_link_text)));
1156 1193
                         }
1157 1194
 
1158
-                        if ($term_index == count($term_array) && $is_taxonomy_last)
1159
-                            $breadcrumb .= $separator . $term_link_text;
1160
-                        else {
1195
+                        if ($term_index == count($term_array) && $is_taxonomy_last) {
1196
+                                                    $breadcrumb .= $separator . $term_link_text;
1197
+                        } else {
1161 1198
                             $cat_link .= $term . '/';
1162 1199
                             $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1163 1200
                         }
@@ -1168,8 +1205,9 @@  discard block
 block discarded – undo
1168 1205
 
1169 1206
             }
1170 1207
 
1171
-            if (geodir_is_page('detail'))
1172
-                $breadcrumb .= $separator . get_the_title();
1208
+            if (geodir_is_page('detail')) {
1209
+                            $breadcrumb .= $separator . get_the_title();
1210
+            }
1173 1211
 
1174 1212
             $breadcrumb .= '</li>';
1175 1213
 
@@ -1206,8 +1244,9 @@  discard block
 block discarded – undo
1206 1244
 
1207 1245
                 $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1208 1246
                 $breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1209
-            } else
1210
-                $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1247
+            } else {
1248
+                            $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1249
+            }
1211 1250
 
1212 1251
             $breadcrumb .= '</li>';
1213 1252
         } elseif (is_category() || is_single()) {
@@ -1286,12 +1325,14 @@  discard block
 block discarded – undo
1286 1325
     function geodir_allow_wpadmin()
1287 1326
     {
1288 1327
         global $wpdb;
1289
-        if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined( 'DOING_AJAX' )) ) // checking action in request to allow ajax request go through
1328
+        if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined( 'DOING_AJAX' )) ) {
1329
+        	// checking action in request to allow ajax request go through
1290 1330
         {
1291 1331
             if (current_user_can('administrator')) {
1292 1332
             } else {
1293 1333
 
1294
-                wp_redirect(home_url());
1334
+                wp_redirect(home_url());
1335
+        }
1295 1336
                 exit;
1296 1337
             }
1297 1338
 
@@ -1339,8 +1380,9 @@  discard block
 block discarded – undo
1339 1380
     $post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1340 1381
 
1341 1382
     $upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1342
-    if ($upload['error'])
1343
-        return new WP_Error('upload_dir_error', $upload['error']);
1383
+    if ($upload['error']) {
1384
+            return new WP_Error('upload_dir_error', $upload['error']);
1385
+    }
1344 1386
 
1345 1387
 
1346 1388
     sleep(0.3);// if multiple remote file this can cause the remote server to timeout so we add a slight delay
@@ -1362,11 +1404,9 @@  discard block
 block discarded – undo
1362 1404
     // make sure the fetch was successful
1363 1405
     elseif ($headers['response']['code'] != '200') {
1364 1406
         $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1365
-    }
1366
-    elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1407
+    } elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1367 1408
         $log_message =  __('Remote file is incorrect size', 'geodirectory');
1368
-    }
1369
-    elseif (0 == $filesize) {
1409
+    } elseif (0 == $filesize) {
1370 1410
         $log_message = __('Zero size file downloaded', 'geodirectory');
1371 1411
     }
1372 1412
 
@@ -1378,10 +1418,11 @@  discard block
 block discarded – undo
1378 1418
 
1379 1419
     if ($dummy && $add_to_cache && is_array($upload)) {
1380 1420
         $images = get_transient('cached_dummy_images');
1381
-        if(is_array($images))
1382
-            $images[$key] = $upload;
1383
-        else
1384
-            $images = array($key => $upload);
1421
+        if(is_array($images)) {
1422
+                    $images[$key] = $upload;
1423
+        } else {
1424
+                    $images = array($key => $upload);
1425
+        }
1385 1426
 
1386 1427
         //setting the cache using the WP Transient API
1387 1428
         set_transient('cached_dummy_images', $images, 60 * 10); //10 minutes cache
@@ -1428,10 +1469,11 @@  discard block
 block discarded – undo
1428 1469
 function geodir_dummy_folder_exists()
1429 1470
 {
1430 1471
     $path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1431
-    if (!is_dir($path))
1432
-        return false;
1433
-    else
1434
-        return true;
1472
+    if (!is_dir($path)) {
1473
+            return false;
1474
+    } else {
1475
+            return true;
1476
+    }
1435 1477
 
1436 1478
 }
1437 1479
 
@@ -1702,12 +1744,10 @@  discard block
 block discarded – undo
1702 1744
         if ($message_type == 'registration' && get_option('bcc_new_user')) {
1703 1745
             $subject .= ' - ADMIN BCC COPY';
1704 1746
             $admin_bcc = true;
1705
-        }
1706
-        elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1747
+        } elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1707 1748
             $subject .= ' - ADMIN BCC COPY';
1708 1749
             $admin_bcc = true;
1709
-        }
1710
-        elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1750
+        } elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1711 1751
             $subject .= ' - ADMIN BCC COPY';
1712 1752
             $admin_bcc = true;
1713 1753
         }
@@ -1751,7 +1791,9 @@  discard block
 block discarded – undo
1751 1791
         $res = array();
1752 1792
         foreach ($ids_array as $id) {
1753 1793
             $xlat = icl_object_id($id, $type, false);
1754
-            if (!is_null($xlat)) $res[] = $xlat;
1794
+            if (!is_null($xlat)) {
1795
+            	$res[] = $xlat;
1796
+            }
1755 1797
         }
1756 1798
         return $res;
1757 1799
     } else {
@@ -2092,8 +2134,9 @@  discard block
 block discarded – undo
2092 2134
         $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2093 2135
 
2094 2136
         $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2095
-        if ( !$page )
2096
-            $page = 1;
2137
+        if ( !$page ) {
2138
+                    $page = 1;
2139
+        }
2097 2140
 
2098 2141
         $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
2099 2142
 
@@ -2419,7 +2462,7 @@  discard block
 block discarded – undo
2419 2462
     $home_url = str_replace("www.", "", $home_url);
2420 2463
     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')) ) {
2421 2464
         return true;
2422
-    }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')){
2465
+    } 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')){
2423 2466
         return true;
2424 2467
     } else {
2425 2468
         return false;
@@ -2505,9 +2548,9 @@  discard block
 block discarded – undo
2505 2548
     $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2506 2549
     if(!empty($gd_post_type)){
2507 2550
         $default_post_type = $gd_post_type;
2508
-    }elseif(isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ){
2551
+    } elseif(isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ){
2509 2552
         $default_post_type = $instance['default_post_type'];
2510
-    }else{
2553
+    } else{
2511 2554
         $all_gd_post_type = geodir_get_posttypes();
2512 2555
         $default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2513 2556
     }
@@ -2931,8 +2974,9 @@  discard block
 block discarded – undo
2931 2974
                         $name = $postobj->labels->name;
2932 2975
 
2933 2976
                         $selected = '';
2934
-                        if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing'))
2935
-                            $selected = 'selected="selected"';
2977
+                        if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) {
2978
+                                                    $selected = 'selected="selected"';
2979
+                        }
2936 2980
 
2937 2981
                         /**
2938 2982
                          * Filter add listing link.
@@ -3399,8 +3443,9 @@  discard block
 block discarded – undo
3399 3443
             $geodir_is_widget_listing = false;
3400 3444
 
3401 3445
             $GLOBALS['post'] = $current_post;
3402
-            if (!empty($current_post))
3403
-                setup_postdata($current_post);
3446
+            if (!empty($current_post)) {
3447
+                            setup_postdata($current_post);
3448
+            }
3404 3449
             $map_jason = $current_map_jason;
3405 3450
             $map_canvas_arr = $current_map_canvas_arr;
3406 3451
             ?>
@@ -3778,11 +3823,15 @@  discard block
 block discarded – undo
3778 3823
 
3779 3824
     $language_file = geodir_plugin_path() . '/db-language.php';
3780 3825
 
3781
-    if(is_file($language_file) && !is_writable($language_file))
3782
-        return false; // Not possible to create.
3826
+    if(is_file($language_file) && !is_writable($language_file)) {
3827
+            return false;
3828
+    }
3829
+    // Not possible to create.
3783 3830
 
3784
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3785
-        return false; // Not possible to create.
3831
+    if(!is_file($language_file) && !is_writable(dirname($language_file))) {
3832
+            return false;
3833
+    }
3834
+    // Not possible to create.
3786 3835
 
3787 3836
     $contents_strings = array();
3788 3837
 
@@ -3825,8 +3874,10 @@  discard block
 block discarded – undo
3825 3874
 
3826 3875
     $contents .= implode(PHP_EOL, $contents_foot);
3827 3876
 
3828
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3829
-        return false; // Failure; could not write file.
3877
+    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE)) {
3878
+            return false;
3879
+    }
3880
+    // Failure; could not write file.
3830 3881
 
3831 3882
     return true;
3832 3883
 }
@@ -3852,23 +3903,29 @@  discard block
 block discarded – undo
3852 3903
 
3853 3904
     if (!empty($rows)) {
3854 3905
         foreach($rows as $row) {
3855
-            if (!empty($row->admin_title))
3856
-                $translation_texts[] = stripslashes_deep($row->admin_title);
3906
+            if (!empty($row->admin_title)) {
3907
+                            $translation_texts[] = stripslashes_deep($row->admin_title);
3908
+            }
3857 3909
 			
3858
-            if (!empty($row->admin_desc))
3859
-                $translation_texts[] = stripslashes_deep($row->admin_desc);
3910
+            if (!empty($row->admin_desc)) {
3911
+                            $translation_texts[] = stripslashes_deep($row->admin_desc);
3912
+            }
3860 3913
 
3861
-            if (!empty($row->site_title))
3862
-                $translation_texts[] = stripslashes_deep($row->site_title);
3914
+            if (!empty($row->site_title)) {
3915
+                            $translation_texts[] = stripslashes_deep($row->site_title);
3916
+            }
3863 3917
 
3864
-            if (!empty($row->clabels))
3865
-                $translation_texts[] = stripslashes_deep($row->clabels);
3918
+            if (!empty($row->clabels)) {
3919
+                            $translation_texts[] = stripslashes_deep($row->clabels);
3920
+            }
3866 3921
 
3867
-            if (!empty($row->required_msg))
3868
-                $translation_texts[] = stripslashes_deep($row->required_msg);
3922
+            if (!empty($row->required_msg)) {
3923
+                            $translation_texts[] = stripslashes_deep($row->required_msg);
3924
+            }
3869 3925
 			
3870
-			if (!empty($row->default_value))
3871
-                $translation_texts[] = stripslashes_deep($row->default_value);
3926
+			if (!empty($row->default_value)) {
3927
+			                $translation_texts[] = stripslashes_deep($row->default_value);
3928
+			}
3872 3929
 			
3873 3930
 			if (!empty($row->option_values)) {
3874 3931
 				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
@@ -3890,14 +3947,17 @@  discard block
 block discarded – undo
3890 3947
 
3891 3948
     if (!empty($rows)) {
3892 3949
         foreach($rows as $row) {
3893
-            if (!empty($row->site_title))
3894
-                $translation_texts[] = stripslashes_deep($row->site_title);
3950
+            if (!empty($row->site_title)) {
3951
+                            $translation_texts[] = stripslashes_deep($row->site_title);
3952
+            }
3895 3953
 
3896
-            if (!empty($row->asc_title))
3897
-                $translation_texts[] = stripslashes_deep($row->asc_title);
3954
+            if (!empty($row->asc_title)) {
3955
+                            $translation_texts[] = stripslashes_deep($row->asc_title);
3956
+            }
3898 3957
 
3899
-            if (!empty($row->desc_title))
3900
-                $translation_texts[] = stripslashes_deep($row->desc_title);
3958
+            if (!empty($row->desc_title)) {
3959
+                            $translation_texts[] = stripslashes_deep($row->desc_title);
3960
+            }
3901 3961
         }
3902 3962
     }
3903 3963
 	
@@ -3908,14 +3968,17 @@  discard block
 block discarded – undo
3908 3968
 
3909 3969
 		if (!empty($rows)) {
3910 3970
 			foreach($rows as $row) {
3911
-				if (!empty($row->field_site_name))
3912
-					$translation_texts[] = stripslashes_deep($row->field_site_name);
3971
+				if (!empty($row->field_site_name)) {
3972
+									$translation_texts[] = stripslashes_deep($row->field_site_name);
3973
+				}
3913 3974
 
3914
-				if (!empty($row->front_search_title))
3915
-					$translation_texts[] = stripslashes_deep($row->front_search_title);
3975
+				if (!empty($row->front_search_title)) {
3976
+									$translation_texts[] = stripslashes_deep($row->front_search_title);
3977
+				}
3916 3978
 
3917
-				if (!empty($row->field_desc))
3918
-					$translation_texts[] = stripslashes_deep($row->field_desc);
3979
+				if (!empty($row->field_desc)) {
3980
+									$translation_texts[] = stripslashes_deep($row->field_desc);
3981
+				}
3919 3982
 			}
3920 3983
 		}
3921 3984
 	}
@@ -4511,38 +4574,54 @@  discard block
 block discarded – undo
4511 4574
             $seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4512 4575
 
4513 4576
             if (!empty($labels)) {
4514
-                if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts))
4515
-                    $translation_texts[] = $labels['name'];
4516
-                if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts))
4517
-                    $translation_texts[] = $labels['singular_name'];
4518
-                if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts))
4519
-                    $translation_texts[] = $labels['add_new'];
4520
-                if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts))
4521
-                    $translation_texts[] = $labels['add_new_item'];
4522
-                if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts))
4523
-                    $translation_texts[] = $labels['edit_item'];
4524
-                if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts))
4525
-                    $translation_texts[] = $labels['new_item'];
4526
-                if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts))
4527
-                    $translation_texts[] = $labels['view_item'];
4528
-                if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts))
4529
-                    $translation_texts[] = $labels['search_items'];
4530
-                if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts))
4531
-                    $translation_texts[] = $labels['not_found'];
4532
-                if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts))
4533
-                    $translation_texts[] = $labels['not_found_in_trash'];
4534
-                if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts))
4535
-                    $translation_texts[] = $labels['label_post_profile'];
4536
-                if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts))
4537
-                    $translation_texts[] = $labels['label_post_info'];
4538
-                if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts))
4539
-                    $translation_texts[] = $labels['label_post_images'];
4540
-                if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts))
4541
-                    $translation_texts[] = $labels['label_post_map'];
4542
-                if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts))
4543
-                    $translation_texts[] = $labels['label_reviews'];
4544
-                if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts))
4545
-                    $translation_texts[] = $labels['label_related_listing'];
4577
+                if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) {
4578
+                                    $translation_texts[] = $labels['name'];
4579
+                }
4580
+                if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) {
4581
+                                    $translation_texts[] = $labels['singular_name'];
4582
+                }
4583
+                if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) {
4584
+                                    $translation_texts[] = $labels['add_new'];
4585
+                }
4586
+                if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) {
4587
+                                    $translation_texts[] = $labels['add_new_item'];
4588
+                }
4589
+                if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) {
4590
+                                    $translation_texts[] = $labels['edit_item'];
4591
+                }
4592
+                if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) {
4593
+                                    $translation_texts[] = $labels['new_item'];
4594
+                }
4595
+                if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) {
4596
+                                    $translation_texts[] = $labels['view_item'];
4597
+                }
4598
+                if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) {
4599
+                                    $translation_texts[] = $labels['search_items'];
4600
+                }
4601
+                if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) {
4602
+                                    $translation_texts[] = $labels['not_found'];
4603
+                }
4604
+                if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) {
4605
+                                    $translation_texts[] = $labels['not_found_in_trash'];
4606
+                }
4607
+                if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) {
4608
+                                    $translation_texts[] = $labels['label_post_profile'];
4609
+                }
4610
+                if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) {
4611
+                                    $translation_texts[] = $labels['label_post_info'];
4612
+                }
4613
+                if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) {
4614
+                                    $translation_texts[] = $labels['label_post_images'];
4615
+                }
4616
+                if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) {
4617
+                                    $translation_texts[] = $labels['label_post_map'];
4618
+                }
4619
+                if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) {
4620
+                                    $translation_texts[] = $labels['label_reviews'];
4621
+                }
4622
+                if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) {
4623
+                                    $translation_texts[] = $labels['label_related_listing'];
4624
+                }
4546 4625
             }
4547 4626
 
4548 4627
             if ($description != '' && !in_array($description, $translation_texts)) {
@@ -4550,11 +4629,13 @@  discard block
 block discarded – undo
4550 4629
             }
4551 4630
 
4552 4631
             if (!empty($seo)) {
4553
-                if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts))
4554
-                    $translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4632
+                if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) {
4633
+                                    $translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4634
+                }
4555 4635
 
4556
-                if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts))
4557
-                    $translation_texts[] = normalize_whitespace($seo['meta_description']);
4636
+                if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) {
4637
+                                    $translation_texts[] = normalize_whitespace($seo['meta_description']);
4638
+                }
4558 4639
             }
4559 4640
         }
4560 4641
     }
@@ -4580,16 +4661,20 @@  discard block
 block discarded – undo
4580 4661
         $hide_region_part = get_option('geodir_location_hide_region_part');
4581 4662
 
4582 4663
         if ($hide_region_part && $hide_country_part) {
4583
-            if (isset($location_terms['gd_country']))
4584
-                unset($location_terms['gd_country']);
4585
-            if (isset($location_terms['gd_region']))
4586
-                unset($location_terms['gd_region']);
4664
+            if (isset($location_terms['gd_country'])) {
4665
+                            unset($location_terms['gd_country']);
4666
+            }
4667
+            if (isset($location_terms['gd_region'])) {
4668
+                            unset($location_terms['gd_region']);
4669
+            }
4587 4670
         } else if ($hide_region_part && !$hide_country_part) {
4588
-            if (isset($location_terms['gd_region']))
4589
-                unset($location_terms['gd_region']);
4671
+            if (isset($location_terms['gd_region'])) {
4672
+                            unset($location_terms['gd_region']);
4673
+            }
4590 4674
         } else if (!$hide_region_part && $hide_country_part) {
4591
-            if (isset($location_terms['gd_country']))
4592
-                unset($location_terms['gd_country']);
4675
+            if (isset($location_terms['gd_country'])) {
4676
+                            unset($location_terms['gd_country']);
4677
+            }
4593 4678
         }
4594 4679
     }
4595 4680
 
@@ -4782,7 +4867,7 @@  discard block
 block discarded – undo
4782 4867
     foreach ($terms as $term) {
4783 4868
         if (isset($term->count) && $term->count > 0) {
4784 4869
             $return[] = $term;
4785
-        }else{
4870
+        } else{
4786 4871
             /**
4787 4872
              * Allow to filter terms with no count.
4788 4873
              *
Please login to merge, or discard this patch.