Passed
Push — master ( 1996f0...67ecc4 )
by Stiofan
13:18
created
geodirectory-functions/general_functions.php 1 patch
Indentation   +3360 added lines, -3360 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 function geodir_plugin_url()
29 29
 {
30 30
 
31
-    if (is_ssl()) :
32
-        return str_replace('http://', 'https://', WP_PLUGIN_URL) . "/" . plugin_basename(dirname(dirname(__FILE__)));
33
-    else :
34
-        return WP_PLUGIN_URL . "/" . plugin_basename(dirname(dirname(__FILE__)));
35
-    endif;
31
+	if (is_ssl()) :
32
+		return str_replace('http://', 'https://', WP_PLUGIN_URL) . "/" . plugin_basename(dirname(dirname(__FILE__)));
33
+	else :
34
+		return WP_PLUGIN_URL . "/" . plugin_basename(dirname(dirname(__FILE__)));
35
+	endif;
36 36
 }
37 37
 
38 38
 
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function geodir_plugin_path()
49 49
 {
50
-    if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
51
-        return dirname(dirname(__FILE__));
52
-    } else {
53
-        return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__)));
54
-    }
50
+	if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
51
+		return dirname(dirname(__FILE__));
52
+	} else {
53
+		return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__)));
54
+	}
55 55
 }
56 56
 
57 57
 /**
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
  */
66 66
 function geodir_is_plugin_active($plugin)
67 67
 {
68
-    $active_plugins = get_option('active_plugins');
69
-    foreach ($active_plugins as $key => $active_plugin) {
70
-        if (strstr($active_plugin, $plugin)) return true;
71
-    }
72
-    return false;
68
+	$active_plugins = get_option('active_plugins');
69
+	foreach ($active_plugins as $key => $active_plugin) {
70
+		if (strstr($active_plugin, $plugin)) return true;
71
+	}
72
+	return false;
73 73
 }
74 74
 
75 75
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
  */
86 86
 function geodir_get_formated_date($date)
87 87
 {
88
-    return mysql2date(get_option('date_format'), $date);
88
+	return mysql2date(get_option('date_format'), $date);
89 89
 }
90 90
 
91 91
 /**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
  */
101 101
 function geodir_get_formated_time($time)
102 102
 {
103
-    return mysql2date(get_option('time_format'), $time, $translate = true);
103
+	return mysql2date(get_option('time_format'), $time, $translate = true);
104 104
 }
105 105
 
106 106
 
@@ -118,26 +118,26 @@  discard block
 block discarded – undo
118 118
  */
119 119
 function geodir_getlink($url, $params = array(), $use_existing_arguments = false)
120 120
 {
121
-    if ($use_existing_arguments) $params = $params + $_GET;
122
-    if (!$params) return $url;
123
-    $link = $url;
124
-    if (strpos($link, '?') === false) $link .= '?'; //If there is no '?' add one at the end
125
-    elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) $link .= '&'; //If there is no '&' at the END, add one.
126
-    elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) $link .= '&'; //If there is no '&' at the END, add one.
127
-
128
-    $params_arr = array();
129
-    foreach ($params as $key => $value) {
130
-        if (gettype($value) == 'array') { //Handle array data properly
131
-            foreach ($value as $val) {
132
-                $params_arr[] = $key . '[]=' . urlencode($val);
133
-            }
134
-        } else {
135
-            $params_arr[] = $key . '=' . urlencode($value);
136
-        }
137
-    }
138
-    $link .= implode('&', $params_arr);
139
-
140
-    return $link;
121
+	if ($use_existing_arguments) $params = $params + $_GET;
122
+	if (!$params) return $url;
123
+	$link = $url;
124
+	if (strpos($link, '?') === false) $link .= '?'; //If there is no '?' add one at the end
125
+	elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) $link .= '&'; //If there is no '&' at the END, add one.
126
+	elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) $link .= '&'; //If there is no '&' at the END, add one.
127
+
128
+	$params_arr = array();
129
+	foreach ($params as $key => $value) {
130
+		if (gettype($value) == 'array') { //Handle array data properly
131
+			foreach ($value as $val) {
132
+				$params_arr[] = $key . '[]=' . urlencode($val);
133
+			}
134
+		} else {
135
+			$params_arr[] = $key . '=' . urlencode($value);
136
+		}
137
+	}
138
+	$link .= implode('&', $params_arr);
139
+
140
+	return $link;
141 141
 }
142 142
 
143 143
 
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
  */
153 153
 function geodir_get_addlisting_link($post_type = '')
154 154
 {
155
-    global $wpdb;
155
+	global $wpdb;
156 156
 
157
-    //$check_pkg  = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'");
158
-    $check_pkg = 1;
159
-    if (post_type_exists($post_type) && $check_pkg) {
157
+	//$check_pkg  = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'");
158
+	$check_pkg = 1;
159
+	if (post_type_exists($post_type) && $check_pkg) {
160 160
 
161
-        $add_listing_link = get_page_link(geodir_add_listing_page_id());
161
+		$add_listing_link = get_page_link(geodir_add_listing_page_id());
162 162
 
163
-        return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
164
-    } else
165
-        return get_bloginfo('url');
163
+		return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
164
+	} else
165
+		return get_bloginfo('url');
166 166
 }
167 167
 
168 168
 /**
@@ -175,19 +175,19 @@  discard block
 block discarded – undo
175 175
  */
176 176
 function geodir_curPageURL()
177 177
 {
178
-    $pageURL = 'http';
179
-    if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
180
-        $pageURL .= "s";
181
-    }
182
-    $pageURL .= "://";
183
-    $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
184
-    /**
185
-     * Filter the current page URL returned by function geodir_curPageURL().
186
-     *
187
-     * @since 1.4.1
188
-     * @param string $pageURL The URL of the current page.
189
-     */
190
-    return apply_filters('geodir_curPageURL', $pageURL);
178
+	$pageURL = 'http';
179
+	if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
180
+		$pageURL .= "s";
181
+	}
182
+	$pageURL .= "://";
183
+	$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
184
+	/**
185
+	 * Filter the current page URL returned by function geodir_curPageURL().
186
+	 *
187
+	 * @since 1.4.1
188
+	 * @param string $pageURL The URL of the current page.
189
+	 */
190
+	return apply_filters('geodir_curPageURL', $pageURL);
191 191
 }
192 192
 
193 193
 
@@ -204,12 +204,12 @@  discard block
 block discarded – undo
204 204
 function geodir_clean($string)
205 205
 {
206 206
 
207
-    $string = trim(strip_tags(stripslashes($string)));
208
-    $string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
209
-    $string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars.
210
-    $string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
207
+	$string = trim(strip_tags(stripslashes($string)));
208
+	$string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
209
+	$string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars.
210
+	$string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
211 211
 
212
-    return $string;
212
+	return $string;
213 213
 }
214 214
 
215 215
 /**
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
  */
222 222
 function geodir_get_weekday()
223 223
 {
224
-    return array(__('Sunday', 'geodirectory'), __('Monday', 'geodirectory'), __('Tuesday', 'geodirectory'), __('Wednesday', 'geodirectory'), __('Thursday', 'geodirectory'), __('Friday', 'geodirectory'), __('Saturday', 'geodirectory'));
224
+	return array(__('Sunday', 'geodirectory'), __('Monday', 'geodirectory'), __('Tuesday', 'geodirectory'), __('Wednesday', 'geodirectory'), __('Thursday', 'geodirectory'), __('Friday', 'geodirectory'), __('Saturday', 'geodirectory'));
225 225
 }
226 226
 
227 227
 /**
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
  */
234 234
 function geodir_get_weeks()
235 235
 {
236
-    return array(__('First', 'geodirectory'), __('Second', 'geodirectory'), __('Third', 'geodirectory'), __('Fourth', 'geodirectory'), __('Last', 'geodirectory'));
236
+	return array(__('First', 'geodirectory'), __('Second', 'geodirectory'), __('Third', 'geodirectory'), __('Fourth', 'geodirectory'), __('Last', 'geodirectory'));
237 237
 }
238 238
 
239 239
 
@@ -252,103 +252,103 @@  discard block
 block discarded – undo
252 252
 function geodir_is_page($gdpage = '')
253 253
 {
254 254
 
255
-    global $wp_query, $post,$wp;
256
-    //if(!is_admin()):
257
-
258
-    switch ($gdpage):
259
-        case 'add-listing':
260
-
261
-            if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) {
262
-                return true;
263
-            } elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
264
-                return true;
265
-            }
266
-
267
-            break;
268
-        case 'preview':
269
-            if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
270
-                && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
271
-            )
272
-                return true;
273
-            break;
274
-        case 'listing-success':
275
-            if (is_page() && get_query_var('page_id') == geodir_success_page_id())
276
-                return true;
277
-            break;
278
-        case 'detail':
279
-            $post_type = get_query_var('post_type');
280
-            if(is_array($post_type)){$post_type = reset($post_type);}
281
-            if (is_single() && in_array($post_type, geodir_get_posttypes()))
282
-                return true;
283
-            break;
284
-        case 'pt':
285
-            $post_type = get_query_var('post_type');
286
-            if(is_array($post_type)){$post_type = reset($post_type);}
287
-            if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax())
288
-                return true;
289
-
290
-            break;
291
-        case 'listing':
292
-            if (is_tax() && geodir_get_taxonomy_posttype()) {
293
-                global $current_term, $taxonomy, $term;
294
-
295
-                return true;
296
-            }
297
-            $post_type = get_query_var('post_type');
298
-            if(is_array($post_type)){$post_type = reset($post_type);}
299
-            if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()))
300
-                return true;
301
-
302
-            break;
303
-        case 'home':
304
-
305
-            if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home())
306
-                return true;
307
-
308
-            break;
309
-        case 'location':
310
-            if (is_page() && get_query_var('page_id') == geodir_location_page_id())
311
-                return true;
312
-            break;
313
-        case 'author':
314
-            if (is_author() && isset($_REQUEST['geodir_dashbord']))
315
-                return true;
255
+	global $wp_query, $post,$wp;
256
+	//if(!is_admin()):
257
+
258
+	switch ($gdpage):
259
+		case 'add-listing':
260
+
261
+			if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) {
262
+				return true;
263
+			} elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
264
+				return true;
265
+			}
266
+
267
+			break;
268
+		case 'preview':
269
+			if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
270
+				&& in_array($_REQUEST['listing_type'], geodir_get_posttypes())
271
+			)
272
+				return true;
273
+			break;
274
+		case 'listing-success':
275
+			if (is_page() && get_query_var('page_id') == geodir_success_page_id())
276
+				return true;
277
+			break;
278
+		case 'detail':
279
+			$post_type = get_query_var('post_type');
280
+			if(is_array($post_type)){$post_type = reset($post_type);}
281
+			if (is_single() && in_array($post_type, geodir_get_posttypes()))
282
+				return true;
283
+			break;
284
+		case 'pt':
285
+			$post_type = get_query_var('post_type');
286
+			if(is_array($post_type)){$post_type = reset($post_type);}
287
+			if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax())
288
+				return true;
289
+
290
+			break;
291
+		case 'listing':
292
+			if (is_tax() && geodir_get_taxonomy_posttype()) {
293
+				global $current_term, $taxonomy, $term;
294
+
295
+				return true;
296
+			}
297
+			$post_type = get_query_var('post_type');
298
+			if(is_array($post_type)){$post_type = reset($post_type);}
299
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()))
300
+				return true;
301
+
302
+			break;
303
+		case 'home':
304
+
305
+			if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home())
306
+				return true;
307
+
308
+			break;
309
+		case 'location':
310
+			if (is_page() && get_query_var('page_id') == geodir_location_page_id())
311
+				return true;
312
+			break;
313
+		case 'author':
314
+			if (is_author() && isset($_REQUEST['geodir_dashbord']))
315
+				return true;
316 316
 			
317 317
 			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) {
318 318
 				if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) {
319 319
 					return true;
320 320
 				}
321 321
 			}
322
-            break;
323
-        case 'search':
324
-            if (is_search() && isset($_REQUEST['geodir_search']))
325
-                return true;
326
-            break;
327
-        case 'info':
328
-            if (is_page() && get_query_var('page_id') == geodir_info_page_id())
329
-                return true;
330
-            break;
331
-        case 'login':
332
-            if (is_page() && get_query_var('page_id') == geodir_login_page_id())
333
-                return true;
334
-            break;
335
-        case 'checkout':
336
-            if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id())
337
-                return true;
338
-            break;
339
-        case 'invoices':
340
-            if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id())
341
-                return true;
342
-            break;
343
-        default:
344
-            return false;
345
-            break;
346
-
347
-    endswitch;
348
-
349
-    //endif;
350
-
351
-    return false;
322
+			break;
323
+		case 'search':
324
+			if (is_search() && isset($_REQUEST['geodir_search']))
325
+				return true;
326
+			break;
327
+		case 'info':
328
+			if (is_page() && get_query_var('page_id') == geodir_info_page_id())
329
+				return true;
330
+			break;
331
+		case 'login':
332
+			if (is_page() && get_query_var('page_id') == geodir_login_page_id())
333
+				return true;
334
+			break;
335
+		case 'checkout':
336
+			if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id())
337
+				return true;
338
+			break;
339
+		case 'invoices':
340
+			if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id())
341
+				return true;
342
+			break;
343
+		default:
344
+			return false;
345
+			break;
346
+
347
+	endswitch;
348
+
349
+	//endif;
350
+
351
+	return false;
352 352
 }
353 353
 
354 354
 /**
@@ -362,97 +362,97 @@  discard block
 block discarded – undo
362 362
  */
363 363
 function geodir_set_is_geodir_page($wp)
364 364
 {
365
-    if (!is_admin()) {
366
-        //$wp->query_vars['gd_is_geodir_page'] = false;
367
-        //print_r()
368
-        if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
369
-            if (get_option('geodir_set_as_home'))
370
-                $wp->query_vars['gd_is_geodir_page'] = true;
371
-            if(geodir_is_page('home')){
372
-                $wp->query_vars['gd_is_geodir_page'] = true;
373
-            }
374
-
375
-
376
-        }
377
-
378
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
379
-            if (
380
-                $wp->query_vars['page_id'] == geodir_add_listing_page_id()
381
-                || $wp->query_vars['page_id'] == geodir_preview_page_id()
382
-                || $wp->query_vars['page_id'] == geodir_success_page_id()
383
-                || $wp->query_vars['page_id'] == geodir_location_page_id()
384
-                || $wp->query_vars['page_id'] == geodir_home_page_id()
385
-                || $wp->query_vars['page_id'] == geodir_info_page_id()
386
-                || $wp->query_vars['page_id'] == geodir_login_page_id()
387
-                || (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
388
-                || (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
389
-            )
390
-                $wp->query_vars['gd_is_geodir_page'] = true;
391
-        }
392
-
393
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
394
-            $page = get_page_by_path($wp->query_vars['pagename']);
395
-
396
-            if (!empty($page) && (
397
-                    $page->ID == geodir_add_listing_page_id()
398
-                    || $page->ID == geodir_preview_page_id()
399
-                    || $page->ID == geodir_success_page_id()
400
-                    || $page->ID == geodir_location_page_id()
401
-                    || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id())
402
-                    || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id())
403
-                    || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id())
404
-                    || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
405
-                    || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
406
-                )
407
-            )
408
-                $wp->query_vars['gd_is_geodir_page'] = true;
409
-        }
410
-
411
-
412
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
413
-            $requested_post_type = $wp->query_vars['post_type'];
414
-            // check if this post type is geodirectory post types 
415
-            $post_type_array = geodir_get_posttypes();
416
-            if (in_array($requested_post_type, $post_type_array)) {
417
-                $wp->query_vars['gd_is_geodir_page'] = true;
418
-            }
419
-        }
420
-
421
-        if (!isset($wp->query_vars['gd_is_geodir_page'])) {
422
-            $geodir_taxonomis = geodir_get_taxonomies('', true);
423
-            if(!empty($geodir_taxonomis)){
424
-                foreach ($geodir_taxonomis as $taxonomy) {
425
-                    if (array_key_exists($taxonomy, $wp->query_vars)) {
426
-                        $wp->query_vars['gd_is_geodir_page'] = true;
427
-                        break;
428
-                    }
429
-                }
430
-            }
431
-
432
-        }
433
-
434
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord']))
435
-            $wp->query_vars['gd_is_geodir_page'] = true;
436
-
437
-
438
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search']))
439
-            $wp->query_vars['gd_is_geodir_page'] = true;
365
+	if (!is_admin()) {
366
+		//$wp->query_vars['gd_is_geodir_page'] = false;
367
+		//print_r()
368
+		if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
369
+			if (get_option('geodir_set_as_home'))
370
+				$wp->query_vars['gd_is_geodir_page'] = true;
371
+			if(geodir_is_page('home')){
372
+				$wp->query_vars['gd_is_geodir_page'] = true;
373
+			}
374
+
375
+
376
+		}
377
+
378
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
379
+			if (
380
+				$wp->query_vars['page_id'] == geodir_add_listing_page_id()
381
+				|| $wp->query_vars['page_id'] == geodir_preview_page_id()
382
+				|| $wp->query_vars['page_id'] == geodir_success_page_id()
383
+				|| $wp->query_vars['page_id'] == geodir_location_page_id()
384
+				|| $wp->query_vars['page_id'] == geodir_home_page_id()
385
+				|| $wp->query_vars['page_id'] == geodir_info_page_id()
386
+				|| $wp->query_vars['page_id'] == geodir_login_page_id()
387
+				|| (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
388
+				|| (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
389
+			)
390
+				$wp->query_vars['gd_is_geodir_page'] = true;
391
+		}
392
+
393
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
394
+			$page = get_page_by_path($wp->query_vars['pagename']);
395
+
396
+			if (!empty($page) && (
397
+					$page->ID == geodir_add_listing_page_id()
398
+					|| $page->ID == geodir_preview_page_id()
399
+					|| $page->ID == geodir_success_page_id()
400
+					|| $page->ID == geodir_location_page_id()
401
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id())
402
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id())
403
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id())
404
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
405
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
406
+				)
407
+			)
408
+				$wp->query_vars['gd_is_geodir_page'] = true;
409
+		}
410
+
411
+
412
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
413
+			$requested_post_type = $wp->query_vars['post_type'];
414
+			// check if this post type is geodirectory post types 
415
+			$post_type_array = geodir_get_posttypes();
416
+			if (in_array($requested_post_type, $post_type_array)) {
417
+				$wp->query_vars['gd_is_geodir_page'] = true;
418
+			}
419
+		}
420
+
421
+		if (!isset($wp->query_vars['gd_is_geodir_page'])) {
422
+			$geodir_taxonomis = geodir_get_taxonomies('', true);
423
+			if(!empty($geodir_taxonomis)){
424
+				foreach ($geodir_taxonomis as $taxonomy) {
425
+					if (array_key_exists($taxonomy, $wp->query_vars)) {
426
+						$wp->query_vars['gd_is_geodir_page'] = true;
427
+						break;
428
+					}
429
+				}
430
+			}
431
+
432
+		}
433
+
434
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord']))
435
+			$wp->query_vars['gd_is_geodir_page'] = true;
436
+
437
+
438
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search']))
439
+			$wp->query_vars['gd_is_geodir_page'] = true;
440 440
 
441 441
 
442 442
 //check if homepage
443
-        if(!isset($wp->query_vars['gd_is_geodir_page'])
444
-            && !isset($wp->query_vars['page_id'])
445
-            && !isset($wp->query_vars['pagename'])
446
-            && is_page_geodir_home()){
447
-            $wp->query_vars['gd_is_geodir_page'] = true;
448
-        }
449
-        //echo $wp->query_vars['gd_is_geodir_page'] ;
450
-        /*echo "<pre>" ;
443
+		if(!isset($wp->query_vars['gd_is_geodir_page'])
444
+			&& !isset($wp->query_vars['page_id'])
445
+			&& !isset($wp->query_vars['pagename'])
446
+			&& is_page_geodir_home()){
447
+			$wp->query_vars['gd_is_geodir_page'] = true;
448
+		}
449
+		//echo $wp->query_vars['gd_is_geodir_page'] ;
450
+		/*echo "<pre>" ;
451 451
 		print_r($wp) ;
452 452
 		echo "</pre>" ;
453 453
 	//	exit();
454 454
 			*/
455
-    } // end of is admin
455
+	} // end of is admin
456 456
 }
457 457
 
458 458
 /**
@@ -465,56 +465,56 @@  discard block
 block discarded – undo
465 465
  */
466 466
 function geodir_is_geodir_page()
467 467
 {
468
-    global $wp;
469
-    if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page'])
470
-        return true;
471
-    else
472
-        return false;
468
+	global $wp;
469
+	if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page'])
470
+		return true;
471
+	else
472
+		return false;
473 473
 }
474 474
 
475 475
 if (!function_exists('geodir_get_imagesize')) {
476
-    /**
477
-     * Get image size using the size key .
478
-     *
479
-     * @since 1.0.0
480
-     * @package GeoDirectory
481
-     * @param string $size The image size key.
482
-     * @return array|mixed|void|WP_Error If valid returns image size. Else returns error.
483
-     */
484
-    function geodir_get_imagesize($size = '')
485
-    {
486
-
487
-        $imagesizes = array('list-thumb' => array('w' => 283, 'h' => 188),
488
-            'thumbnail' => array('w' => 125, 'h' => 125),
489
-            'widget-thumb' => array('w' => 50, 'h' => 50),
490
-            'slider-thumb' => array('w' => 100, 'h' => 100)
491
-        );
492
-
493
-        /**
494
-         * Filter the image sizes array.
495
-         *
496
-         * @since 1.0.0
497
-         * @param array $imagesizes Image size array.
498
-         */
499
-        $imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
500
-
501
-        if (!empty($size) && array_key_exists($size, $imagesizes)) {
502
-            /**
503
-             * Filters image size of the passed key.
504
-             *
505
-             * @since 1.0.0
506
-             * @param array $imagesizes[$size] Image size array of the passed key.
507
-             */
508
-            return apply_filters('geodir_get_imagesize_' . $size, $imagesizes[$size]);
509
-
510
-        } elseif (!empty($size)) {
511
-
512
-            return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
513
-
514
-        }
515
-
516
-        return $imagesizes;
517
-    }
476
+	/**
477
+	 * Get image size using the size key .
478
+	 *
479
+	 * @since 1.0.0
480
+	 * @package GeoDirectory
481
+	 * @param string $size The image size key.
482
+	 * @return array|mixed|void|WP_Error If valid returns image size. Else returns error.
483
+	 */
484
+	function geodir_get_imagesize($size = '')
485
+	{
486
+
487
+		$imagesizes = array('list-thumb' => array('w' => 283, 'h' => 188),
488
+			'thumbnail' => array('w' => 125, 'h' => 125),
489
+			'widget-thumb' => array('w' => 50, 'h' => 50),
490
+			'slider-thumb' => array('w' => 100, 'h' => 100)
491
+		);
492
+
493
+		/**
494
+		 * Filter the image sizes array.
495
+		 *
496
+		 * @since 1.0.0
497
+		 * @param array $imagesizes Image size array.
498
+		 */
499
+		$imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
500
+
501
+		if (!empty($size) && array_key_exists($size, $imagesizes)) {
502
+			/**
503
+			 * Filters image size of the passed key.
504
+			 *
505
+			 * @since 1.0.0
506
+			 * @param array $imagesizes[$size] Image size array of the passed key.
507
+			 */
508
+			return apply_filters('geodir_get_imagesize_' . $size, $imagesizes[$size]);
509
+
510
+		} elseif (!empty($size)) {
511
+
512
+			return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
513
+
514
+		}
515
+
516
+		return $imagesizes;
517
+	}
518 518
 }
519 519
 
520 520
 /**
@@ -534,151 +534,151 @@  discard block
 block discarded – undo
534 534
 
535 535
 
536 536
 if (!function_exists('createRandomString')) {
537
-    /**
538
-     * Creates random string.
539
-     *
540
-     * @since 1.0.0
541
-     * @package GeoDirectory
542
-     * @return string Random string.
543
-     */
544
-    function createRandomString()
545
-    {
546
-        $chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
547
-        srand((double)microtime() * 1000000);
548
-        $i = 0;
549
-        $rstring = '';
550
-        while ($i <= 25) {
551
-            $num = rand() % 33;
552
-            $tmp = substr($chars, $num, 1);
553
-            $rstring = $rstring . $tmp;
554
-            $i++;
555
-        }
556
-        return $rstring;
557
-    }
537
+	/**
538
+	 * Creates random string.
539
+	 *
540
+	 * @since 1.0.0
541
+	 * @package GeoDirectory
542
+	 * @return string Random string.
543
+	 */
544
+	function createRandomString()
545
+	{
546
+		$chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
547
+		srand((double)microtime() * 1000000);
548
+		$i = 0;
549
+		$rstring = '';
550
+		while ($i <= 25) {
551
+			$num = rand() % 33;
552
+			$tmp = substr($chars, $num, 1);
553
+			$rstring = $rstring . $tmp;
554
+			$i++;
555
+		}
556
+		return $rstring;
557
+	}
558 558
 }
559 559
 
560 560
 if (!function_exists('geodir_getDistanceRadius')) {
561
-    /**
562
-     * Calculates the distance radius.
563
-     *
564
-     * @since 1.0.0
565
-     * @package GeoDirectory
566
-     * @param string $uom Measurement unit type.
567
-     * @return float The mean radius.
568
-     */
569
-    function geodir_getDistanceRadius($uom = 'km')
570
-    {
561
+	/**
562
+	 * Calculates the distance radius.
563
+	 *
564
+	 * @since 1.0.0
565
+	 * @package GeoDirectory
566
+	 * @param string $uom Measurement unit type.
567
+	 * @return float The mean radius.
568
+	 */
569
+	function geodir_getDistanceRadius($uom = 'km')
570
+	{
571 571
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
572
-        switch (geodir_strtolower($uom)):
573
-            case 'km'    :
574
-                $earthMeanRadius = 6371.009; // km
575
-                break;
576
-            case 'm'    :
577
-            case 'meters'    :
578
-                $earthMeanRadius = 6371.009 * 1000; // km
579
-                break;
580
-            case 'miles'    :
581
-                $earthMeanRadius = 3958.761; // miles
582
-                break;
583
-            case 'yards'    :
584
-            case 'yds'    :
585
-                $earthMeanRadius = 3958.761 * 1760; // yards
586
-                break;
587
-            case 'feet'    :
588
-            case 'ft'    :
589
-                $earthMeanRadius = 3958.761 * 1760 * 3; // feet
590
-                break;
591
-            case 'nm'    :
592
-                $earthMeanRadius = 3440.069; //  miles
593
-                break;
594
-            default:
595
-                $earthMeanRadius = 3958.761; // miles
596
-                break;
597
-        endswitch;
598
-        return $earthMeanRadius;
599
-    }
572
+		switch (geodir_strtolower($uom)):
573
+			case 'km'    :
574
+				$earthMeanRadius = 6371.009; // km
575
+				break;
576
+			case 'm'    :
577
+			case 'meters'    :
578
+				$earthMeanRadius = 6371.009 * 1000; // km
579
+				break;
580
+			case 'miles'    :
581
+				$earthMeanRadius = 3958.761; // miles
582
+				break;
583
+			case 'yards'    :
584
+			case 'yds'    :
585
+				$earthMeanRadius = 3958.761 * 1760; // yards
586
+				break;
587
+			case 'feet'    :
588
+			case 'ft'    :
589
+				$earthMeanRadius = 3958.761 * 1760 * 3; // feet
590
+				break;
591
+			case 'nm'    :
592
+				$earthMeanRadius = 3440.069; //  miles
593
+				break;
594
+			default:
595
+				$earthMeanRadius = 3958.761; // miles
596
+				break;
597
+		endswitch;
598
+		return $earthMeanRadius;
599
+	}
600 600
 }
601 601
 
602 602
 
603 603
 if (!function_exists('geodir_calculateDistanceFromLatLong')) {
604
-    /**
605
-     * Calculate the great circle distance between two points identified by longitude and latitude.
606
-     *
607
-     * @since 1.0.0
608
-     * @package GeoDirectory
609
-     * @param array $point1 Latitude and Longitude of point 1.
610
-     * @param array $point2 Latitude and Longitude of point 2.
611
-     * @param string $uom Unit of measurement.
612
-     * @return float The distance.
613
-     */
614
-    function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km')
615
-    {
604
+	/**
605
+	 * Calculate the great circle distance between two points identified by longitude and latitude.
606
+	 *
607
+	 * @since 1.0.0
608
+	 * @package GeoDirectory
609
+	 * @param array $point1 Latitude and Longitude of point 1.
610
+	 * @param array $point2 Latitude and Longitude of point 2.
611
+	 * @param string $uom Unit of measurement.
612
+	 * @return float The distance.
613
+	 */
614
+	function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km')
615
+	{
616 616
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
617 617
 
618
-        $earthMeanRadius = geodir_getDistanceRadius($uom);
618
+		$earthMeanRadius = geodir_getDistanceRadius($uom);
619 619
 
620
-        $deltaLatitude = deg2rad((float) $point2['latitude'] - (float) $point1['latitude']);
621
-        $deltaLongitude = deg2rad((float) $point2['longitude'] - (float) $point1['longitude']);
622
-        $a = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
623
-            cos(deg2rad((float) $point1['latitude'])) * cos(deg2rad((float) $point2['latitude'])) *
624
-            sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
625
-        $c = 2 * atan2(sqrt($a), sqrt(1 - $a));
626
-        $distance = $earthMeanRadius * $c;
627
-        return $distance;
620
+		$deltaLatitude = deg2rad((float) $point2['latitude'] - (float) $point1['latitude']);
621
+		$deltaLongitude = deg2rad((float) $point2['longitude'] - (float) $point1['longitude']);
622
+		$a = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
623
+			cos(deg2rad((float) $point1['latitude'])) * cos(deg2rad((float) $point2['latitude'])) *
624
+			sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
625
+		$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
626
+		$distance = $earthMeanRadius * $c;
627
+		return $distance;
628 628
 
629
-    }
629
+	}
630 630
 }
631 631
 
632 632
 
633 633
 if (!function_exists('geodir_sendEmail')) {
634
-    /**
635
-     * The main function that send transactional emails using the args provided.
636
-     *
637
-     * @since 1.0.0
638
-     * @since 1.5.7 Added db translations for notifications subject and content.
639
-     * @package GeoDirectory
640
-     * @param string $fromEmail Sender email address.
641
-     * @param string $fromEmailName Sender name.
642
-     * @param string $toEmail Receiver email address.
643
-     * @param string $toEmailName Receiver name.
644
-     * @param string $to_subject Email subject.
645
-     * @param string $to_message Email content.
646
-     * @param string $extra Not being used.
647
-     * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
648
-     * @param string $post_id The post ID.
649
-     * @param string $user_id The user ID.
650
-     */
651
-    function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
652
-        $login_details = '';
653
-
654
-        // strip slashes from subject & message text
655
-        $to_subject = stripslashes_deep($to_subject);
656
-        $to_message = stripslashes_deep($to_message);
657
-
658
-        if ($message_type == 'send_friend') {
659
-            $subject = get_option('geodir_email_friend_subject');
660
-            $message = get_option('geodir_email_friend_content');
661
-        } elseif ($message_type == 'send_enquiry') {
662
-            $subject = get_option('geodir_email_enquiry_subject');
663
-            $message = get_option('geodir_email_enquiry_content');
664
-        } elseif ($message_type == 'forgot_password') {
665
-            $subject = get_option('geodir_forgot_password_subject');
666
-            $message = get_option('geodir_forgot_password_content');
667
-            $login_details = $to_message;
668
-        } elseif ($message_type == 'registration') {
669
-            $subject = get_option('geodir_registration_success_email_subject');
670
-            $message = get_option('geodir_registration_success_email_content');
671
-            $login_details = $to_message;
672
-        } elseif ($message_type == 'post_submit') {
673
-            $subject = get_option('geodir_post_submited_success_email_subject');
674
-            $message = get_option('geodir_post_submited_success_email_content');
675
-        } elseif ($message_type == 'listing_published') {
676
-            $subject = get_option('geodir_post_published_email_subject');
677
-            $message = get_option('geodir_post_published_email_content');
678
-        } elseif ($message_type == 'listing_edited') {
679
-            $subject = get_option('geodir_post_edited_email_subject_admin');
680
-            $message = get_option('geodir_post_edited_email_content_admin');
681
-        }
634
+	/**
635
+	 * The main function that send transactional emails using the args provided.
636
+	 *
637
+	 * @since 1.0.0
638
+	 * @since 1.5.7 Added db translations for notifications subject and content.
639
+	 * @package GeoDirectory
640
+	 * @param string $fromEmail Sender email address.
641
+	 * @param string $fromEmailName Sender name.
642
+	 * @param string $toEmail Receiver email address.
643
+	 * @param string $toEmailName Receiver name.
644
+	 * @param string $to_subject Email subject.
645
+	 * @param string $to_message Email content.
646
+	 * @param string $extra Not being used.
647
+	 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
648
+	 * @param string $post_id The post ID.
649
+	 * @param string $user_id The user ID.
650
+	 */
651
+	function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
652
+		$login_details = '';
653
+
654
+		// strip slashes from subject & message text
655
+		$to_subject = stripslashes_deep($to_subject);
656
+		$to_message = stripslashes_deep($to_message);
657
+
658
+		if ($message_type == 'send_friend') {
659
+			$subject = get_option('geodir_email_friend_subject');
660
+			$message = get_option('geodir_email_friend_content');
661
+		} elseif ($message_type == 'send_enquiry') {
662
+			$subject = get_option('geodir_email_enquiry_subject');
663
+			$message = get_option('geodir_email_enquiry_content');
664
+		} elseif ($message_type == 'forgot_password') {
665
+			$subject = get_option('geodir_forgot_password_subject');
666
+			$message = get_option('geodir_forgot_password_content');
667
+			$login_details = $to_message;
668
+		} elseif ($message_type == 'registration') {
669
+			$subject = get_option('geodir_registration_success_email_subject');
670
+			$message = get_option('geodir_registration_success_email_content');
671
+			$login_details = $to_message;
672
+		} elseif ($message_type == 'post_submit') {
673
+			$subject = get_option('geodir_post_submited_success_email_subject');
674
+			$message = get_option('geodir_post_submited_success_email_content');
675
+		} elseif ($message_type == 'listing_published') {
676
+			$subject = get_option('geodir_post_published_email_subject');
677
+			$message = get_option('geodir_post_published_email_content');
678
+		} elseif ($message_type == 'listing_edited') {
679
+			$subject = get_option('geodir_post_edited_email_subject_admin');
680
+			$message = get_option('geodir_post_edited_email_content_admin');
681
+		}
682 682
 		
683 683
 		if (!empty($subject)) {
684 684
 			$subject = __(stripslashes_deep($subject),'geodirectory');
@@ -688,203 +688,203 @@  discard block
 block discarded – undo
688 688
 			$message = __(stripslashes_deep($message),'geodirectory');
689 689
 		}
690 690
 
691
-        $to_message = nl2br($to_message);
692
-        $sitefromEmail = get_option('site_email');
693
-        $sitefromEmailName = get_site_emailName();
694
-        $productlink = get_permalink($post_id);
695
-
696
-        $user_login = '';
697
-        if ($user_id > 0 && $user_info = get_userdata($user_id)) {
698
-            $user_login = $user_info->user_login;
699
-        }
700
-
701
-        $posted_date = '';
702
-        $listingLink = '';
703
-
704
-        $post_info = get_post($post_id);
705
-
706
-        if ($post_info) {
707
-            $posted_date = $post_info->post_date;
708
-            $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
709
-        }
710
-        $siteurl = home_url();
711
-        $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
712
-        $loginurl = geodir_login_url();
713
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
691
+		$to_message = nl2br($to_message);
692
+		$sitefromEmail = get_option('site_email');
693
+		$sitefromEmailName = get_site_emailName();
694
+		$productlink = get_permalink($post_id);
695
+
696
+		$user_login = '';
697
+		if ($user_id > 0 && $user_info = get_userdata($user_id)) {
698
+			$user_login = $user_info->user_login;
699
+		}
700
+
701
+		$posted_date = '';
702
+		$listingLink = '';
703
+
704
+		$post_info = get_post($post_id);
705
+
706
+		if ($post_info) {
707
+			$posted_date = $post_info->post_date;
708
+			$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
709
+		}
710
+		$siteurl = home_url();
711
+		$siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
712
+		$loginurl = geodir_login_url();
713
+		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
714 714
         
715
-        $post_author_id = !empty($post_info) ? $post_info->post_author : 0;
716
-        $post_author_name = geodir_get_client_name($post_author_id);
717
-        $current_date = date_i18n('Y-m-d H:i:s', current_time('timestamp'));
718
-
719
-        if ($fromEmail == '') {
720
-            $fromEmail = get_option('site_email');
721
-        }
722
-
723
-        if ($fromEmailName == '') {
724
-            $fromEmailName = get_option('site_email_name');
725
-        }
726
-
727
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
728
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
729
-        $message = str_replace($search_array, $replace_array, $message);
730
-
731
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
732
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
733
-        $subject = str_replace($search_array, $replace_array, $subject);
734
-
735
-        $headers = 'MIME-Version: 1.0' . "\r\n";
736
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
737
-        $headers .= "Reply-To: " . $fromEmail . "\r\n";
738
-        $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
739
-
740
-        $to = $toEmail;
741
-
742
-        /**
743
-         * Filter the client email to address.
744
-         *
745
-         * @since 1.6.1
746
-         * @package GeoDirectory
747
-         * @param string $to The email address the email is being sent to.
748
-         * @param string $fromEmail Sender email address.
749
-         * @param string $fromEmailName Sender name.
750
-         * @param string $toEmail Receiver email address.
751
-         * @param string $toEmailName Receiver name.
752
-         * @param string $to_subject Email subject.
753
-         * @param string $to_message Email content.
754
-         * @param string $extra Not being used.
755
-         * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
756
-         * @param string $post_id The post ID.
757
-         * @param string $user_id The user ID.
758
-         */
759
-        $to = apply_filters('geodir_sendEmail_to',$to,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
760
-        /**
761
-         * Filter the client email subject.
762
-         *
763
-         * @since 1.6.1
764
-         * @package GeoDirectory_Payment_Manager
765
-         * @param string $subject The email subject.
766
-         * @param string $fromEmail Sender email address.
767
-         * @param string $fromEmailName Sender name.
768
-         * @param string $toEmail Receiver email address.
769
-         * @param string $toEmailName Receiver name.
770
-         * @param string $to_subject Email subject.
771
-         * @param string $to_message Email content.
772
-         * @param string $extra Not being used.
773
-         * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
774
-         * @param string $post_id The post ID.
775
-         * @param string $user_id The user ID.
776
-         */
777
-        $subject = apply_filters('geodir_sendEmail_subject',$subject,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
778
-        /**
779
-         * Filter the client email message.
780
-         *
781
-         * @since 1.6.1
782
-         * @package GeoDirectory_Payment_Manager
783
-         * @param string $message The email message text.
784
-         * @param string $fromEmail Sender email address.
785
-         * @param string $fromEmailName Sender name.
786
-         * @param string $toEmail Receiver email address.
787
-         * @param string $toEmailName Receiver name.
788
-         * @param string $to_subject Email subject.
789
-         * @param string $to_message Email content.
790
-         * @param string $extra Not being used.
791
-         * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
792
-         * @param string $post_id The post ID.
793
-         * @param string $user_id The user ID.
794
-         */
795
-        $message = apply_filters('geodir_sendEmail_message',$message,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
796
-        /**
797
-         * Filter the client email headers.
798
-         *
799
-         * @since 1.6.1
800
-         * @package GeoDirectory_Payment_Manager
801
-         * @param string $headers The email headers.
802
-         * @param string $fromEmail Sender email address.
803
-         * @param string $fromEmailName Sender name.
804
-         * @param string $toEmail Receiver email address.
805
-         * @param string $toEmailName Receiver name.
806
-         * @param string $to_subject Email subject.
807
-         * @param string $to_message Email content.
808
-         * @param string $extra Not being used.
809
-         * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
810
-         * @param string $post_id The post ID.
811
-         * @param string $user_id The user ID.
812
-         */
813
-        $headers = apply_filters('geodir_sendEmail_headers',$headers,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
814
-
815
-        $sent = wp_mail($to, $subject, $message, $headers);
816
-
817
-        if( ! $sent ) {
818
-            if ( is_array( $to ) ) {
819
-                $to = implode( ',', $to );
820
-            }
821
-            $log_message = sprintf(
822
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
823
-                $message_type,
824
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
825
-                $to,
826
-                $subject
827
-            );
828
-            geodir_error_log( $log_message );
829
-        }
830
-
831
-        ///////// ADMIN BCC EMIALS
832
-        $adminEmail = get_bloginfo('admin_email');
833
-        $to = $adminEmail;
834
-
835
-        $admin_bcc = false;
836
-        if ($message_type == 'post_submit') {
837
-            $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
838
-            $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
839
-
840
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
841
-            $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $user_login, $user_login);
842
-            $message = str_replace($search_array, $replace_array, $message);
843
-
844
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
845
-            $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
846
-            $subject = str_replace($search_array, $replace_array, $subject);
847
-
848
-            $subject .= ' - ADMIN BCC COPY';
849
-            $admin_bcc = true;
850
-
851
-        }
852
-        elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
853
-            $subject .= ' - ADMIN BCC COPY';
854
-            $admin_bcc = true;
855
-        }
856
-        elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
857
-            $subject .= ' - ADMIN BCC COPY';
858
-            $admin_bcc = true;
859
-        }
860
-        elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
861
-            $subject .= ' - ADMIN BCC COPY';
862
-            $admin_bcc = true;
863
-        }
864
-        elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
865
-            $subject .= ' - ADMIN BCC COPY';
866
-            $admin_bcc = true;
867
-        }
868
-
869
-        if($admin_bcc===true){
870
-            $sent = wp_mail($to, $subject, $message, $headers);
871
-
872
-            if( ! $sent ) {
873
-                if ( is_array( $to ) ) {
874
-                    $to = implode( ',', $to );
875
-                }
876
-                $log_message = sprintf(
877
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
878
-                    $message_type,
879
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
880
-                    $to,
881
-                    $subject
882
-                );
883
-                geodir_error_log( $log_message );
884
-            }
885
-        }
886
-
887
-    }
715
+		$post_author_id = !empty($post_info) ? $post_info->post_author : 0;
716
+		$post_author_name = geodir_get_client_name($post_author_id);
717
+		$current_date = date_i18n('Y-m-d H:i:s', current_time('timestamp'));
718
+
719
+		if ($fromEmail == '') {
720
+			$fromEmail = get_option('site_email');
721
+		}
722
+
723
+		if ($fromEmailName == '') {
724
+			$fromEmailName = get_option('site_email_name');
725
+		}
726
+
727
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
728
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
729
+		$message = str_replace($search_array, $replace_array, $message);
730
+
731
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
732
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
733
+		$subject = str_replace($search_array, $replace_array, $subject);
734
+
735
+		$headers = 'MIME-Version: 1.0' . "\r\n";
736
+		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
737
+		$headers .= "Reply-To: " . $fromEmail . "\r\n";
738
+		$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
739
+
740
+		$to = $toEmail;
741
+
742
+		/**
743
+		 * Filter the client email to address.
744
+		 *
745
+		 * @since 1.6.1
746
+		 * @package GeoDirectory
747
+		 * @param string $to The email address the email is being sent to.
748
+		 * @param string $fromEmail Sender email address.
749
+		 * @param string $fromEmailName Sender name.
750
+		 * @param string $toEmail Receiver email address.
751
+		 * @param string $toEmailName Receiver name.
752
+		 * @param string $to_subject Email subject.
753
+		 * @param string $to_message Email content.
754
+		 * @param string $extra Not being used.
755
+		 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
756
+		 * @param string $post_id The post ID.
757
+		 * @param string $user_id The user ID.
758
+		 */
759
+		$to = apply_filters('geodir_sendEmail_to',$to,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
760
+		/**
761
+		 * Filter the client email subject.
762
+		 *
763
+		 * @since 1.6.1
764
+		 * @package GeoDirectory_Payment_Manager
765
+		 * @param string $subject The email subject.
766
+		 * @param string $fromEmail Sender email address.
767
+		 * @param string $fromEmailName Sender name.
768
+		 * @param string $toEmail Receiver email address.
769
+		 * @param string $toEmailName Receiver name.
770
+		 * @param string $to_subject Email subject.
771
+		 * @param string $to_message Email content.
772
+		 * @param string $extra Not being used.
773
+		 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
774
+		 * @param string $post_id The post ID.
775
+		 * @param string $user_id The user ID.
776
+		 */
777
+		$subject = apply_filters('geodir_sendEmail_subject',$subject,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
778
+		/**
779
+		 * Filter the client email message.
780
+		 *
781
+		 * @since 1.6.1
782
+		 * @package GeoDirectory_Payment_Manager
783
+		 * @param string $message The email message text.
784
+		 * @param string $fromEmail Sender email address.
785
+		 * @param string $fromEmailName Sender name.
786
+		 * @param string $toEmail Receiver email address.
787
+		 * @param string $toEmailName Receiver name.
788
+		 * @param string $to_subject Email subject.
789
+		 * @param string $to_message Email content.
790
+		 * @param string $extra Not being used.
791
+		 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
792
+		 * @param string $post_id The post ID.
793
+		 * @param string $user_id The user ID.
794
+		 */
795
+		$message = apply_filters('geodir_sendEmail_message',$message,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
796
+		/**
797
+		 * Filter the client email headers.
798
+		 *
799
+		 * @since 1.6.1
800
+		 * @package GeoDirectory_Payment_Manager
801
+		 * @param string $headers The email headers.
802
+		 * @param string $fromEmail Sender email address.
803
+		 * @param string $fromEmailName Sender name.
804
+		 * @param string $toEmail Receiver email address.
805
+		 * @param string $toEmailName Receiver name.
806
+		 * @param string $to_subject Email subject.
807
+		 * @param string $to_message Email content.
808
+		 * @param string $extra Not being used.
809
+		 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
810
+		 * @param string $post_id The post ID.
811
+		 * @param string $user_id The user ID.
812
+		 */
813
+		$headers = apply_filters('geodir_sendEmail_headers',$headers,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
814
+
815
+		$sent = wp_mail($to, $subject, $message, $headers);
816
+
817
+		if( ! $sent ) {
818
+			if ( is_array( $to ) ) {
819
+				$to = implode( ',', $to );
820
+			}
821
+			$log_message = sprintf(
822
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
823
+				$message_type,
824
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
825
+				$to,
826
+				$subject
827
+			);
828
+			geodir_error_log( $log_message );
829
+		}
830
+
831
+		///////// ADMIN BCC EMIALS
832
+		$adminEmail = get_bloginfo('admin_email');
833
+		$to = $adminEmail;
834
+
835
+		$admin_bcc = false;
836
+		if ($message_type == 'post_submit') {
837
+			$subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
838
+			$message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
839
+
840
+			$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
841
+			$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $user_login, $user_login);
842
+			$message = str_replace($search_array, $replace_array, $message);
843
+
844
+			$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
845
+			$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
846
+			$subject = str_replace($search_array, $replace_array, $subject);
847
+
848
+			$subject .= ' - ADMIN BCC COPY';
849
+			$admin_bcc = true;
850
+
851
+		}
852
+		elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
853
+			$subject .= ' - ADMIN BCC COPY';
854
+			$admin_bcc = true;
855
+		}
856
+		elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
857
+			$subject .= ' - ADMIN BCC COPY';
858
+			$admin_bcc = true;
859
+		}
860
+		elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
861
+			$subject .= ' - ADMIN BCC COPY';
862
+			$admin_bcc = true;
863
+		}
864
+		elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
865
+			$subject .= ' - ADMIN BCC COPY';
866
+			$admin_bcc = true;
867
+		}
868
+
869
+		if($admin_bcc===true){
870
+			$sent = wp_mail($to, $subject, $message, $headers);
871
+
872
+			if( ! $sent ) {
873
+				if ( is_array( $to ) ) {
874
+					$to = implode( ',', $to );
875
+				}
876
+				$log_message = sprintf(
877
+					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
878
+					$message_type,
879
+					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
880
+					$to,
881
+					$subject
882
+				);
883
+				geodir_error_log( $log_message );
884
+			}
885
+		}
886
+
887
+	}
888 888
 }
889 889
 
890 890
 
@@ -897,27 +897,27 @@  discard block
 block discarded – undo
897 897
 function geodir_taxonomy_breadcrumb()
898 898
 {
899 899
 
900
-    $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
901
-    $parent = $term->parent;
900
+	$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
901
+	$parent = $term->parent;
902 902
 
903
-    while ($parent):
904
-        $parents[] = $parent;
905
-        $new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
906
-        $parent = $new_parent->parent;
907
-    endwhile;
903
+	while ($parent):
904
+		$parents[] = $parent;
905
+		$new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
906
+		$parent = $new_parent->parent;
907
+	endwhile;
908 908
 
909
-    if (!empty($parents)):
910
-        $parents = array_reverse($parents);
909
+	if (!empty($parents)):
910
+		$parents = array_reverse($parents);
911 911
 
912
-        foreach ($parents as $parent):
913
-            $item = get_term_by('id', $parent, get_query_var('taxonomy'));
914
-            $url = get_term_link($item, get_query_var('taxonomy'));
915
-            echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
916
-        endforeach;
912
+		foreach ($parents as $parent):
913
+			$item = get_term_by('id', $parent, get_query_var('taxonomy'));
914
+			$url = get_term_link($item, get_query_var('taxonomy'));
915
+			echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
916
+		endforeach;
917 917
 
918
-    endif;
918
+	endif;
919 919
 
920
-    echo '<li> > ' . $term->name . '</li>';
920
+	echo '<li> > ' . $term->name . '</li>';
921 921
 }
922 922
 
923 923
 
@@ -933,365 +933,365 @@  discard block
 block discarded – undo
933 933
  */
934 934
 function geodir_breadcrumb()
935 935
 {
936
-    global $wp_query, $geodir_add_location_url;
937
-
938
-    /**
939
-     * Filter breadcrumb separator.
940
-     *
941
-     * @since 1.0.0
942
-     */
943
-    $separator = apply_filters('geodir_breadcrumb_separator', ' > ');
944
-
945
-    if (!geodir_is_page('home')) {
946
-        $breadcrumb = '';
947
-        $url_categoris = '';
948
-        $breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
949
-        /**
950
-         * Filter breadcrumb's first link.
951
-         *
952
-         * @since 1.0.0
953
-         */
954
-        $breadcrumb .= '<li>' . apply_filters('geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __('Home', 'geodirectory') . '</a>') . '</li>';
955
-
956
-        $gd_post_type = geodir_get_current_posttype();
957
-        $post_type_info = get_post_type_object($gd_post_type);
958
-
959
-        remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
960
-
961
-        $listing_link = get_post_type_archive_link($gd_post_type);
962
-
963
-        add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
964
-        $listing_link = rtrim($listing_link, '/');
965
-        $listing_link .= '/';
966
-
967
-        $post_type_for_location_link = $listing_link;
968
-        $location_terms = geodir_get_current_location_terms('query_vars', $gd_post_type);
969
-
970
-        global $wp, $gd_session;
971
-        $location_link = $post_type_for_location_link;
972
-
973
-        if (geodir_is_page('detail') || geodir_is_page('listing')) {
974
-            global $post;
975
-            $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
936
+	global $wp_query, $geodir_add_location_url;
937
+
938
+	/**
939
+	 * Filter breadcrumb separator.
940
+	 *
941
+	 * @since 1.0.0
942
+	 */
943
+	$separator = apply_filters('geodir_breadcrumb_separator', ' > ');
944
+
945
+	if (!geodir_is_page('home')) {
946
+		$breadcrumb = '';
947
+		$url_categoris = '';
948
+		$breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
949
+		/**
950
+		 * Filter breadcrumb's first link.
951
+		 *
952
+		 * @since 1.0.0
953
+		 */
954
+		$breadcrumb .= '<li>' . apply_filters('geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __('Home', 'geodirectory') . '</a>') . '</li>';
955
+
956
+		$gd_post_type = geodir_get_current_posttype();
957
+		$post_type_info = get_post_type_object($gd_post_type);
958
+
959
+		remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
960
+
961
+		$listing_link = get_post_type_archive_link($gd_post_type);
962
+
963
+		add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
964
+		$listing_link = rtrim($listing_link, '/');
965
+		$listing_link .= '/';
966
+
967
+		$post_type_for_location_link = $listing_link;
968
+		$location_terms = geodir_get_current_location_terms('query_vars', $gd_post_type);
969
+
970
+		global $wp, $gd_session;
971
+		$location_link = $post_type_for_location_link;
972
+
973
+		if (geodir_is_page('detail') || geodir_is_page('listing')) {
974
+			global $post;
975
+			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
976 976
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
977 977
 				
978 978
 			if(geodir_is_page('detail') && isset($post->country_slug)){
979
-                $location_terms = array(
980
-                    'gd_country' => $post->country_slug,
981
-                    'gd_region' => $post->region_slug,
982
-                    'gd_city' => $post->city_slug
983
-                );
979
+				$location_terms = array(
980
+					'gd_country' => $post->country_slug,
981
+					'gd_region' => $post->region_slug,
982
+					'gd_city' => $post->city_slug
983
+				);
984 984
 				
985 985
 				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
986 986
 					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
987 987
 				}
988
-            }
989
-
990
-            $geodir_show_location_url = get_option('geodir_show_location_url');
991
-
992
-            $hide_url_part = array();
993
-            if ($location_manager) {
994
-                $hide_country_part = get_option('geodir_location_hide_country_part');
995
-                $hide_region_part = get_option('geodir_location_hide_region_part');
996
-
997
-                if ($hide_region_part && $hide_country_part) {
998
-                    $hide_url_part = array('gd_country', 'gd_region');
999
-                } else if ($hide_region_part && !$hide_country_part) {
1000
-                    $hide_url_part = array('gd_region');
1001
-                } else if (!$hide_region_part && $hide_country_part) {
1002
-                    $hide_url_part = array('gd_country');
1003
-                }
1004
-            }
1005
-
1006
-            $hide_text_part = array();
1007
-            if ($geodir_show_location_url == 'country_city') {
1008
-                $hide_text_part = array('gd_region');
1009
-
1010
-                if (isset($location_terms['gd_region']) && !$location_manager) {
1011
-                    unset($location_terms['gd_region']);
1012
-                }
1013
-            } else if ($geodir_show_location_url == 'region_city') {
1014
-                $hide_text_part = array('gd_country');
1015
-
1016
-                if (isset($location_terms['gd_country']) && !$location_manager) {
1017
-                    unset($location_terms['gd_country']);
1018
-                }
1019
-            } else if ($geodir_show_location_url == 'city') {
1020
-                $hide_text_part = array('gd_country', 'gd_region');
1021
-
1022
-                if (isset($location_terms['gd_country']) && !$location_manager) {
1023
-                    unset($location_terms['gd_country']);
1024
-                }
1025
-                if (isset($location_terms['gd_region']) && !$location_manager) {
1026
-                    unset($location_terms['gd_region']);
1027
-                }
1028
-            }
1029
-
1030
-            $is_location_last = '';
1031
-            $is_taxonomy_last = '';
1032
-            $breadcrumb .= '<li>';
1033
-            if (get_query_var($gd_post_type . 'category'))
1034
-                $gd_taxonomy = $gd_post_type . 'category';
1035
-            elseif (get_query_var($gd_post_type . '_tags'))
1036
-                $gd_taxonomy = $gd_post_type . '_tags';
1037
-
1038
-            $breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1039
-            if (!empty($gd_taxonomy) || geodir_is_page('detail'))
1040
-                $is_location_last = false;
1041
-            else
1042
-                $is_location_last = true;
1043
-
1044
-            if (!empty($gd_taxonomy) && geodir_is_page('listing'))
1045
-                $is_taxonomy_last = true;
1046
-            else
1047
-                $is_taxonomy_last = false;
1048
-
1049
-            if (!empty($location_terms)) {
1050
-                $geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
1051
-
1052
-                foreach ($location_terms as $key => $location_term) {
1053
-                    if ($location_term != '') {
1054
-                        if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
1055
-                            continue;
1056
-                        }
988
+			}
1057 989
 
1058
-                        $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
1059
-                        $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
1060
-                        $gd_location_link_text = ucfirst($gd_location_link_text);
1061
-
1062
-                        $location_term_actual_country = '';
1063
-                        $location_term_actual_region = '';
1064
-                        $location_term_actual_city = '';
1065
-                        if ($geodir_get_locations) {
1066
-                            if ($key == 'gd_country') {
1067
-                                $location_term_actual_country = get_actual_location_name('country', $location_term, true);
1068
-                            } else if ($key == 'gd_region') {
1069
-                                $location_term_actual_region = get_actual_location_name('region', $location_term, true);
1070
-                            } else if ($key == 'gd_city') {
1071
-                                $location_term_actual_city = get_actual_location_name('city', $location_term, true);
1072
-                            }
1073
-                        } else {
1074
-                            $location_info = geodir_get_location();
1075
-
1076
-                            if (!empty($location_info) && isset($location_info->location_id)) {
1077
-                                if ($key == 'gd_country') {
1078
-                                    $location_term_actual_country = __($location_info->country, 'geodirectory');
1079
-                                } else if ($key == 'gd_region') {
1080
-                                    $location_term_actual_region = __($location_info->region, 'geodirectory');
1081
-                                } else if ($key == 'gd_city') {
1082
-                                    $location_term_actual_city = __($location_info->city, 'geodirectory');
1083
-                                }
1084
-                            }
1085
-                        }
990
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1086 991
 
1087
-                        if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1088
-                            $breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1089
-                        } else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1090
-                            $breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1091
-                        } else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1092
-                            $breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1093
-                        } else if ($is_location_last && $key == 'gd_neighbourhood') {
1094
-                            $breadcrumb .= $separator . $gd_location_link_text;
1095
-                        } else {
1096
-                            if (get_option('permalink_structure') != '') {
1097
-                                $location_link .= $location_term . '/';
1098
-                            } else {
1099
-                                $location_link .= "&$key=" . $location_term;
1100
-                            }
992
+			$hide_url_part = array();
993
+			if ($location_manager) {
994
+				$hide_country_part = get_option('geodir_location_hide_country_part');
995
+				$hide_region_part = get_option('geodir_location_hide_region_part');
1101 996
 
1102
-                            if ($key == 'gd_country' && $location_term_actual_country != '') {
1103
-                                $gd_location_link_text = $location_term_actual_country;
1104
-                            } else if ($key == 'gd_region' && $location_term_actual_region != '') {
1105
-                                $gd_location_link_text = $location_term_actual_region;
1106
-                            } else if ($key == 'gd_city' && $location_term_actual_city != '') {
1107
-                                $gd_location_link_text = $location_term_actual_city;
1108
-                            }
997
+				if ($hide_region_part && $hide_country_part) {
998
+					$hide_url_part = array('gd_country', 'gd_region');
999
+				} else if ($hide_region_part && !$hide_country_part) {
1000
+					$hide_url_part = array('gd_region');
1001
+				} else if (!$hide_region_part && $hide_country_part) {
1002
+					$hide_url_part = array('gd_country');
1003
+				}
1004
+			}
1005
+
1006
+			$hide_text_part = array();
1007
+			if ($geodir_show_location_url == 'country_city') {
1008
+				$hide_text_part = array('gd_region');
1009
+
1010
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1011
+					unset($location_terms['gd_region']);
1012
+				}
1013
+			} else if ($geodir_show_location_url == 'region_city') {
1014
+				$hide_text_part = array('gd_country');
1015
+
1016
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1017
+					unset($location_terms['gd_country']);
1018
+				}
1019
+			} else if ($geodir_show_location_url == 'city') {
1020
+				$hide_text_part = array('gd_country', 'gd_region');
1021
+
1022
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1023
+					unset($location_terms['gd_country']);
1024
+				}
1025
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1026
+					unset($location_terms['gd_region']);
1027
+				}
1028
+			}
1109 1029
 
1110
-                            /*
1030
+			$is_location_last = '';
1031
+			$is_taxonomy_last = '';
1032
+			$breadcrumb .= '<li>';
1033
+			if (get_query_var($gd_post_type . 'category'))
1034
+				$gd_taxonomy = $gd_post_type . 'category';
1035
+			elseif (get_query_var($gd_post_type . '_tags'))
1036
+				$gd_taxonomy = $gd_post_type . '_tags';
1037
+
1038
+			$breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1039
+			if (!empty($gd_taxonomy) || geodir_is_page('detail'))
1040
+				$is_location_last = false;
1041
+			else
1042
+				$is_location_last = true;
1043
+
1044
+			if (!empty($gd_taxonomy) && geodir_is_page('listing'))
1045
+				$is_taxonomy_last = true;
1046
+			else
1047
+				$is_taxonomy_last = false;
1048
+
1049
+			if (!empty($location_terms)) {
1050
+				$geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
1051
+
1052
+				foreach ($location_terms as $key => $location_term) {
1053
+					if ($location_term != '') {
1054
+						if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
1055
+							continue;
1056
+						}
1057
+
1058
+						$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
1059
+						$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
1060
+						$gd_location_link_text = ucfirst($gd_location_link_text);
1061
+
1062
+						$location_term_actual_country = '';
1063
+						$location_term_actual_region = '';
1064
+						$location_term_actual_city = '';
1065
+						if ($geodir_get_locations) {
1066
+							if ($key == 'gd_country') {
1067
+								$location_term_actual_country = get_actual_location_name('country', $location_term, true);
1068
+							} else if ($key == 'gd_region') {
1069
+								$location_term_actual_region = get_actual_location_name('region', $location_term, true);
1070
+							} else if ($key == 'gd_city') {
1071
+								$location_term_actual_city = get_actual_location_name('city', $location_term, true);
1072
+							}
1073
+						} else {
1074
+							$location_info = geodir_get_location();
1075
+
1076
+							if (!empty($location_info) && isset($location_info->location_id)) {
1077
+								if ($key == 'gd_country') {
1078
+									$location_term_actual_country = __($location_info->country, 'geodirectory');
1079
+								} else if ($key == 'gd_region') {
1080
+									$location_term_actual_region = __($location_info->region, 'geodirectory');
1081
+								} else if ($key == 'gd_city') {
1082
+									$location_term_actual_city = __($location_info->city, 'geodirectory');
1083
+								}
1084
+							}
1085
+						}
1086
+
1087
+						if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1088
+							$breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1089
+						} else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1090
+							$breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1091
+						} else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1092
+							$breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1093
+						} else if ($is_location_last && $key == 'gd_neighbourhood') {
1094
+							$breadcrumb .= $separator . $gd_location_link_text;
1095
+						} else {
1096
+							if (get_option('permalink_structure') != '') {
1097
+								$location_link .= $location_term . '/';
1098
+							} else {
1099
+								$location_link .= "&$key=" . $location_term;
1100
+							}
1101
+
1102
+							if ($key == 'gd_country' && $location_term_actual_country != '') {
1103
+								$gd_location_link_text = $location_term_actual_country;
1104
+							} else if ($key == 'gd_region' && $location_term_actual_region != '') {
1105
+								$gd_location_link_text = $location_term_actual_region;
1106
+							} else if ($key == 'gd_city' && $location_term_actual_city != '') {
1107
+								$gd_location_link_text = $location_term_actual_city;
1108
+							}
1109
+
1110
+							/*
1111 1111
                             if (geodir_is_page('detail') && !empty($hide_text_part) && in_array($key, $hide_text_part)) {
1112 1112
                                 continue;
1113 1113
                             }
1114 1114
                             */
1115 1115
 
1116
-                            $breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1117
-                        }
1118
-                    }
1119
-                }
1120
-            }
1121
-
1122
-            if (!empty($gd_taxonomy)) {
1123
-                $term_index = 1;
1124
-
1125
-                //if(get_option('geodir_add_categories_url'))
1126
-                {
1127
-                    if (get_query_var($gd_post_type . '_tags')) {
1128
-                        $cat_link = $listing_link . 'tags/';
1129
-                    } else
1130
-                        $cat_link = $listing_link;
1131
-
1132
-                    foreach ($location_terms as $key => $location_term) {
1133
-                        if ($location_manager && in_array($key, $hide_url_part)) {
1134
-                            continue;
1135
-                        }
1116
+							$breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1117
+						}
1118
+					}
1119
+				}
1120
+			}
1136 1121
 
1137
-                        if ($location_term != '') {
1138
-                            if (get_option('permalink_structure') != '') {
1139
-                                $cat_link .= $location_term . '/';
1140
-                            }
1141
-                        }
1142
-                    }
1143
-
1144
-                    $term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1145
-                    foreach ($term_array as $term) {
1146
-                        $term_link_text = preg_replace('/-(\d+)$/', '', $term);
1147
-                        $term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1148
-
1149
-                        // get term actual name
1150
-                        $term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1151
-                        if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1152
-                            $term_link_text = urldecode($term_info['name']);
1153
-                        } else {
1154
-                            $term_link_text = geodir_ucwords(urldecode($term_link_text));
1155
-                        }
1122
+			if (!empty($gd_taxonomy)) {
1123
+				$term_index = 1;
1156 1124
 
1157
-                        if ($term_index == count($term_array) && $is_taxonomy_last)
1158
-                            $breadcrumb .= $separator . $term_link_text;
1159
-                        else {
1160
-                            $cat_link .= $term . '/';
1161
-                            $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1162
-                        }
1163
-                        $term_index++;
1164
-                    }
1165
-                }
1166
-
1167
-
1168
-            }
1169
-
1170
-            if (geodir_is_page('detail'))
1171
-                $breadcrumb .= $separator . get_the_title();
1172
-
1173
-            $breadcrumb .= '</li>';
1174
-
1175
-
1176
-        } elseif (geodir_is_page('author')) {
1177
-            $user_id = get_current_user_id();
1178
-            $author_link = get_author_posts_url($user_id);
1179
-            $default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
1180
-
1181
-            /**
1182
-             * Filter author page link.
1183
-             *
1184
-             * @since 1.0.0
1185
-             * @param string $default_author_link Default author link.
1186
-             * @param int $user_id Author ID.
1187
-             */
1188
-            $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1189
-
1190
-            $breadcrumb .= '<li>';
1191
-            $breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>';
1192
-
1193
-            if (isset($_REQUEST['list'])) {
1194
-                $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false);
1195
-
1196
-                /**
1197
-                 * Filter author page link.
1198
-                 *
1199
-                 * @since 1.0.0
1200
-                 * @param string $author_link Author page link.
1201
-                 * @param int $user_id Author ID.
1202
-                 * @param string $_REQUEST['stype'] Post type.
1203
-                 */
1204
-                $author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1205
-
1206
-                $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1207
-                $breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1208
-            } else
1209
-                $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1210
-
1211
-            $breadcrumb .= '</li>';
1212
-        } elseif (is_category() || is_single()) {
1213
-            $category = get_the_category();
1214
-            if (is_category()) {
1215
-                $breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1216
-            }
1217
-            if (is_single()) {
1218
-                $breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>';
1219
-                $breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1220
-            }
1221
-            /* End of my version ##################################################### */
1222
-        } else if (is_page()) {
1223
-            $page_title = get_the_title();
1224
-
1225
-            if (geodir_is_page('location')) {
1226
-                $page_title = defined('GD_LOCATION') ? GD_LOCATION : __('Location', 'geodirectory');
1227
-            }
1228
-
1229
-            $breadcrumb .= '<li>' . $separator;
1230
-            $breadcrumb .= stripslashes_deep($page_title);
1231
-            $breadcrumb .= '</li>';
1232
-        } else if (is_tag()) {
1233
-            $breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1234
-        } else if (is_day()) {
1235
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1236
-            the_time('F jS, Y');
1237
-            $breadcrumb .= '</li>';
1238
-        } else if (is_month()) {
1239
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1240
-            the_time('F, Y');
1241
-            $breadcrumb .= '</li>';
1242
-        } else if (is_year()) {
1243
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1244
-            the_time('Y');
1245
-            $breadcrumb .= '</li>';
1246
-        } else if (is_author()) {
1247
-            $breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory');
1248
-            $breadcrumb .= '</li>';
1249
-        } else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1250
-            $breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory');
1251
-            $breadcrumb .= '</li>';
1252
-        } else if (is_search()) {
1253
-            $breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory');
1254
-            $breadcrumb .= '</li>';
1255
-        }
1256
-        $breadcrumb .= '</ul></div>';
1257
-
1258
-        /**
1259
-         * Filter breadcrumb html output.
1260
-         *
1261
-         * @since 1.0.0
1262
-         * @param string $breadcrumb Breadcrumb HTML.
1263
-         * @param string $separator Breadcrumb separator.
1264
-         */
1265
-        echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1266
-    }
1125
+				//if(get_option('geodir_add_categories_url'))
1126
+				{
1127
+					if (get_query_var($gd_post_type . '_tags')) {
1128
+						$cat_link = $listing_link . 'tags/';
1129
+					} else
1130
+						$cat_link = $listing_link;
1131
+
1132
+					foreach ($location_terms as $key => $location_term) {
1133
+						if ($location_manager && in_array($key, $hide_url_part)) {
1134
+							continue;
1135
+						}
1136
+
1137
+						if ($location_term != '') {
1138
+							if (get_option('permalink_structure') != '') {
1139
+								$cat_link .= $location_term . '/';
1140
+							}
1141
+						}
1142
+					}
1143
+
1144
+					$term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1145
+					foreach ($term_array as $term) {
1146
+						$term_link_text = preg_replace('/-(\d+)$/', '', $term);
1147
+						$term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1148
+
1149
+						// get term actual name
1150
+						$term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1151
+						if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1152
+							$term_link_text = urldecode($term_info['name']);
1153
+						} else {
1154
+							$term_link_text = geodir_ucwords(urldecode($term_link_text));
1155
+						}
1156
+
1157
+						if ($term_index == count($term_array) && $is_taxonomy_last)
1158
+							$breadcrumb .= $separator . $term_link_text;
1159
+						else {
1160
+							$cat_link .= $term . '/';
1161
+							$breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1162
+						}
1163
+						$term_index++;
1164
+					}
1165
+				}
1166
+
1167
+
1168
+			}
1169
+
1170
+			if (geodir_is_page('detail'))
1171
+				$breadcrumb .= $separator . get_the_title();
1172
+
1173
+			$breadcrumb .= '</li>';
1174
+
1175
+
1176
+		} elseif (geodir_is_page('author')) {
1177
+			$user_id = get_current_user_id();
1178
+			$author_link = get_author_posts_url($user_id);
1179
+			$default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
1180
+
1181
+			/**
1182
+			 * Filter author page link.
1183
+			 *
1184
+			 * @since 1.0.0
1185
+			 * @param string $default_author_link Default author link.
1186
+			 * @param int $user_id Author ID.
1187
+			 */
1188
+			$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1189
+
1190
+			$breadcrumb .= '<li>';
1191
+			$breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>';
1192
+
1193
+			if (isset($_REQUEST['list'])) {
1194
+				$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false);
1195
+
1196
+				/**
1197
+				 * Filter author page link.
1198
+				 *
1199
+				 * @since 1.0.0
1200
+				 * @param string $author_link Author page link.
1201
+				 * @param int $user_id Author ID.
1202
+				 * @param string $_REQUEST['stype'] Post type.
1203
+				 */
1204
+				$author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1205
+
1206
+				$breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1207
+				$breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1208
+			} else
1209
+				$breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1210
+
1211
+			$breadcrumb .= '</li>';
1212
+		} elseif (is_category() || is_single()) {
1213
+			$category = get_the_category();
1214
+			if (is_category()) {
1215
+				$breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1216
+			}
1217
+			if (is_single()) {
1218
+				$breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>';
1219
+				$breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1220
+			}
1221
+			/* End of my version ##################################################### */
1222
+		} else if (is_page()) {
1223
+			$page_title = get_the_title();
1224
+
1225
+			if (geodir_is_page('location')) {
1226
+				$page_title = defined('GD_LOCATION') ? GD_LOCATION : __('Location', 'geodirectory');
1227
+			}
1228
+
1229
+			$breadcrumb .= '<li>' . $separator;
1230
+			$breadcrumb .= stripslashes_deep($page_title);
1231
+			$breadcrumb .= '</li>';
1232
+		} else if (is_tag()) {
1233
+			$breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1234
+		} else if (is_day()) {
1235
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1236
+			the_time('F jS, Y');
1237
+			$breadcrumb .= '</li>';
1238
+		} else if (is_month()) {
1239
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1240
+			the_time('F, Y');
1241
+			$breadcrumb .= '</li>';
1242
+		} else if (is_year()) {
1243
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1244
+			the_time('Y');
1245
+			$breadcrumb .= '</li>';
1246
+		} else if (is_author()) {
1247
+			$breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory');
1248
+			$breadcrumb .= '</li>';
1249
+		} else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1250
+			$breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory');
1251
+			$breadcrumb .= '</li>';
1252
+		} else if (is_search()) {
1253
+			$breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory');
1254
+			$breadcrumb .= '</li>';
1255
+		}
1256
+		$breadcrumb .= '</ul></div>';
1257
+
1258
+		/**
1259
+		 * Filter breadcrumb html output.
1260
+		 *
1261
+		 * @since 1.0.0
1262
+		 * @param string $breadcrumb Breadcrumb HTML.
1263
+		 * @param string $separator Breadcrumb separator.
1264
+		 */
1265
+		echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1266
+	}
1267 1267
 }
1268 1268
 
1269 1269
 
1270 1270
 add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin
1271 1271
 if (!function_exists('geodir_allow_wpadmin')) {
1272
-    /**
1273
-     * Allow only admins to access wp-admin.
1274
-     *
1275
-     * Normal users will be redirected to home page.
1276
-     *
1277
-     * @since 1.0.0
1278
-     * @package GeoDirectory
1279
-     * @global object $wpdb WordPress Database object.
1280
-     */
1281
-    function geodir_allow_wpadmin()
1282
-    {
1283
-        global $wpdb;
1284
-        if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) // checking action in request to allow ajax request go through
1285
-        {
1286
-            if (current_user_can('manage_options')) {
1287
-            } else {
1288
-
1289
-                wp_redirect(home_url());
1290
-                exit;
1291
-            }
1292
-
1293
-        }
1294
-    }
1272
+	/**
1273
+	 * Allow only admins to access wp-admin.
1274
+	 *
1275
+	 * Normal users will be redirected to home page.
1276
+	 *
1277
+	 * @since 1.0.0
1278
+	 * @package GeoDirectory
1279
+	 * @global object $wpdb WordPress Database object.
1280
+	 */
1281
+	function geodir_allow_wpadmin()
1282
+	{
1283
+		global $wpdb;
1284
+		if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) // checking action in request to allow ajax request go through
1285
+		{
1286
+			if (current_user_can('manage_options')) {
1287
+			} else {
1288
+
1289
+				wp_redirect(home_url());
1290
+				exit;
1291
+			}
1292
+
1293
+		}
1294
+	}
1295 1295
 }
1296 1296
 
1297 1297
 
@@ -1305,50 +1305,50 @@  discard block
 block discarded – undo
1305 1305
  */
1306 1306
 function fetch_remote_file($url)
1307 1307
 {
1308
-    // extract the file name and extension from the url
1309
-    require_once(ABSPATH . 'wp-includes/pluggable.php');
1310
-    $file_name = basename($url);
1311
-    if (strpos($file_name, '?') !== false) {
1312
-        list($file_name) = explode('?', $file_name);
1313
-    }
1314
-
1315
-
1316
-    // get placeholder file in the upload dir with a unique, sanitized filename
1317
-
1318
-    $post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1319
-
1320
-    $upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1321
-    if ($upload['error'])
1322
-        return new WP_Error('upload_dir_error', $upload['error']);
1323
-
1324
-    // fetch the remote url and write it to the placeholder file
1325
-    $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1326
-
1327
-    $log_message = '';
1328
-    $filesize = filesize($upload['file']);
1329
-    // request failed
1330
-    if (!$headers) {
1331
-        $log_message = __('Remote server did not respond', 'geodirectory');
1332
-    }
1333
-    // make sure the fetch was successful
1334
-    elseif ($headers['response']['code'] != '200') {
1335
-        $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1336
-    }
1337
-    elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1338
-        $log_message =  __('Remote file is incorrect size', 'geodirectory');
1339
-    }
1340
-    elseif (0 == $filesize) {
1341
-        $log_message = __('Zero size file downloaded', 'geodirectory');
1342
-    }
1343
-
1344
-    if($log_message){
1345
-        $del = unlink($upload['file']);
1346
-        if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1347
-        return new WP_Error('import_file_error',$log_message );
1348
-    }
1349
-
1350
-
1351
-    return $upload;
1308
+	// extract the file name and extension from the url
1309
+	require_once(ABSPATH . 'wp-includes/pluggable.php');
1310
+	$file_name = basename($url);
1311
+	if (strpos($file_name, '?') !== false) {
1312
+		list($file_name) = explode('?', $file_name);
1313
+	}
1314
+
1315
+
1316
+	// get placeholder file in the upload dir with a unique, sanitized filename
1317
+
1318
+	$post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1319
+
1320
+	$upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1321
+	if ($upload['error'])
1322
+		return new WP_Error('upload_dir_error', $upload['error']);
1323
+
1324
+	// fetch the remote url and write it to the placeholder file
1325
+	$headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1326
+
1327
+	$log_message = '';
1328
+	$filesize = filesize($upload['file']);
1329
+	// request failed
1330
+	if (!$headers) {
1331
+		$log_message = __('Remote server did not respond', 'geodirectory');
1332
+	}
1333
+	// make sure the fetch was successful
1334
+	elseif ($headers['response']['code'] != '200') {
1335
+		$log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1336
+	}
1337
+	elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1338
+		$log_message =  __('Remote file is incorrect size', 'geodirectory');
1339
+	}
1340
+	elseif (0 == $filesize) {
1341
+		$log_message = __('Zero size file downloaded', 'geodirectory');
1342
+	}
1343
+
1344
+	if($log_message){
1345
+		$del = unlink($upload['file']);
1346
+		if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1347
+		return new WP_Error('import_file_error',$log_message );
1348
+	}
1349
+
1350
+
1351
+	return $upload;
1352 1352
 }
1353 1353
 
1354 1354
 /**
@@ -1360,21 +1360,21 @@  discard block
 block discarded – undo
1360 1360
  */
1361 1361
 function geodir_max_upload_size()
1362 1362
 {
1363
-    $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1364
-
1365
-    if ($max_filesize > 0 && $max_filesize < 1) {
1366
-        $max_filesize = (int)($max_filesize * 1024) . 'kb';
1367
-    } else {
1368
-        $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1369
-    }
1370
-
1371
-    /**
1372
-     * Filter default image upload size limit.
1373
-     *
1374
-     * @since 1.0.0
1375
-     * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1376
-     */
1377
-    return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1363
+	$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1364
+
1365
+	if ($max_filesize > 0 && $max_filesize < 1) {
1366
+		$max_filesize = (int)($max_filesize * 1024) . 'kb';
1367
+	} else {
1368
+		$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1369
+	}
1370
+
1371
+	/**
1372
+	 * Filter default image upload size limit.
1373
+	 *
1374
+	 * @since 1.0.0
1375
+	 * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1376
+	 */
1377
+	return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1378 1378
 }
1379 1379
 
1380 1380
 /**
@@ -1388,11 +1388,11 @@  discard block
 block discarded – undo
1388 1388
  */
1389 1389
 function geodir_dummy_folder_exists()
1390 1390
 {
1391
-    $path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1392
-    if (!is_dir($path))
1393
-        return false;
1394
-    else
1395
-        return true;
1391
+	$path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1392
+	if (!is_dir($path))
1393
+		return false;
1394
+	else
1395
+		return true;
1396 1396
 
1397 1397
 }
1398 1398
 
@@ -1407,290 +1407,290 @@  discard block
 block discarded – undo
1407 1407
  */
1408 1408
 function  geodir_get_author_info($aid)
1409 1409
 {
1410
-    global $wpdb;
1411
-    /*$infosql = "select * from $wpdb->users where ID=$aid";*/
1412
-    $infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1413
-    $info = $wpdb->get_results($infosql);
1414
-    if ($info) {
1415
-        return $info[0];
1416
-    }
1410
+	global $wpdb;
1411
+	/*$infosql = "select * from $wpdb->users where ID=$aid";*/
1412
+	$infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1413
+	$info = $wpdb->get_results($infosql);
1414
+	if ($info) {
1415
+		return $info[0];
1416
+	}
1417 1417
 }
1418 1418
 
1419 1419
 if (!function_exists('adminEmail')) {
1420
-    /**
1421
-     * Send emails to client on post submission, renew etc.
1422
-     *
1423
-     * @since 1.0.0
1424
-     * @package GeoDirectory
1425
-     * @global object $wpdb WordPress Database object.
1426
-     * @param int|string $page_id Page ID.
1427
-     * @param int|string $user_id User ID.
1428
-     * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1429
-     * @param string $custom_1 Custom data to be sent.
1430
-     */
1431
-    function adminEmail($page_id, $user_id, $message_type, $custom_1 = '')
1432
-    {
1433
-        global $wpdb;
1434
-        if ($message_type == 'expiration') {
1435
-            $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1436
-            $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1437
-        } elseif ($message_type == 'post_submited') {
1438
-            $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1439
-            $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1440
-        } elseif ($message_type == 'renew') {
1441
-            $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1442
-            $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1443
-        } elseif ($message_type == 'upgrade') {
1444
-            $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1445
-            $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1446
-        } elseif ($message_type == 'claim_approved') {
1447
-            $subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1448
-            $client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1449
-        } elseif ($message_type == 'claim_rejected') {
1450
-            $subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1451
-            $client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1452
-        } elseif ($message_type == 'claim_requested') {
1453
-            $subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1454
-            $client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1455
-        } elseif ($message_type == 'auto_claim') {
1456
-            $subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1457
-            $client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1458
-        } elseif ($message_type == 'payment_success') {
1459
-            $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1460
-            $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1461
-        } elseif ($message_type == 'payment_fail') {
1462
-            $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1463
-            $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1464
-        }
1465
-        $transaction_details = $custom_1;
1466
-        $fromEmail = get_option('site_email');
1467
-        $fromEmailName = get_site_emailName();
1420
+	/**
1421
+	 * Send emails to client on post submission, renew etc.
1422
+	 *
1423
+	 * @since 1.0.0
1424
+	 * @package GeoDirectory
1425
+	 * @global object $wpdb WordPress Database object.
1426
+	 * @param int|string $page_id Page ID.
1427
+	 * @param int|string $user_id User ID.
1428
+	 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1429
+	 * @param string $custom_1 Custom data to be sent.
1430
+	 */
1431
+	function adminEmail($page_id, $user_id, $message_type, $custom_1 = '')
1432
+	{
1433
+		global $wpdb;
1434
+		if ($message_type == 'expiration') {
1435
+			$subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1436
+			$client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1437
+		} elseif ($message_type == 'post_submited') {
1438
+			$subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1439
+			$client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1440
+		} elseif ($message_type == 'renew') {
1441
+			$subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1442
+			$client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1443
+		} elseif ($message_type == 'upgrade') {
1444
+			$subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1445
+			$client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1446
+		} elseif ($message_type == 'claim_approved') {
1447
+			$subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1448
+			$client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1449
+		} elseif ($message_type == 'claim_rejected') {
1450
+			$subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1451
+			$client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1452
+		} elseif ($message_type == 'claim_requested') {
1453
+			$subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1454
+			$client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1455
+		} elseif ($message_type == 'auto_claim') {
1456
+			$subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1457
+			$client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1458
+		} elseif ($message_type == 'payment_success') {
1459
+			$subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1460
+			$client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1461
+		} elseif ($message_type == 'payment_fail') {
1462
+			$subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1463
+			$client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1464
+		}
1465
+		$transaction_details = $custom_1;
1466
+		$fromEmail = get_option('site_email');
1467
+		$fromEmailName = get_site_emailName();
1468 1468
 //$alivedays = get_post_meta($page_id,'alive_days',true);
1469
-        $pkg_limit = get_property_price_info_listing($page_id);
1470
-        $alivedays = $pkg_limit['days'];
1471
-        $productlink = get_permalink($page_id);
1472
-        $post_info = get_post($page_id);
1473
-        $post_date = date('dS F,Y', strtotime($post_info->post_date));
1474
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1475
-        $loginurl = geodir_login_url();
1476
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1477
-        $siteurl = home_url();
1478
-        $siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1479
-        $user_info = get_userdata($user_id);
1480
-        $user_email = $user_info->user_email;
1481
-        $display_name = geodir_get_client_name($user_id);
1482
-        $user_login = $user_info->user_login;
1483
-        $number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1484
-        if ($number_of_grace_days == '') {
1485
-            $number_of_grace_days = 1;
1486
-        }
1487
-        if ($post_info->post_type == 'event') {
1488
-            $post_type = 'event';
1489
-        } else {
1490
-            $post_type = 'listing';
1491
-        }
1492
-        $renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1493
-        $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#]');
1494
-        $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);
1495
-        $client_message = str_replace($search_array, $replace_array, $client_message);
1496
-        $subject = str_replace($search_array, $replace_array, $subject);
1497
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1498
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1499
-        $headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1500
-
1501
-        $to = $fromEmail;
1502
-        $message = $client_message;
1503
-
1504
-
1505
-        /**
1506
-         * Filter the admin email to address.
1507
-         *
1508
-         * @since 1.6.1
1509
-         * @package GeoDirectory
1510
-         * @param string $to The email address the email is being sent to.
1511
-         * @param int|string $page_id Page ID.
1512
-         * @param int|string $user_id User ID.
1513
-         * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1514
-         * @param string $custom_1 Custom data to be sent.
1515
-         */
1516
-        $to = apply_filters('geodir_adminEmail_to',$to,$page_id, $user_id, $message_type, $custom_1 );
1517
-        /**
1518
-         * Filter the admin email subject.
1519
-         *
1520
-         * @since 1.6.1
1521
-         * @package GeoDirectory_Payment_Manager
1522
-         * @param string $subject The email subject.
1523
-         * @param int|string $page_id Page ID.
1524
-         * @param int|string $user_id User ID.
1525
-         * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1526
-         * @param string $custom_1 Custom data to be sent.
1527
-         */
1528
-        $subject = apply_filters('geodir_adminEmail_subject',$subject,$page_id, $user_id, $message_type, $custom_1);
1529
-        /**
1530
-         * Filter the admin email message.
1531
-         *
1532
-         * @since 1.6.1
1533
-         * @package GeoDirectory_Payment_Manager
1534
-         * @param string $message The email message text.
1535
-         * @param int|string $page_id Page ID.
1536
-         * @param int|string $user_id User ID.
1537
-         * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1538
-         * @param string $custom_1 Custom data to be sent.
1539
-         */
1540
-        $message = apply_filters('geodir_adminEmail_message',$message,$page_id, $user_id, $message_type, $custom_1);
1541
-        /**
1542
-         * Filter the admin email headers.
1543
-         *
1544
-         * @since 1.6.1
1545
-         * @package GeoDirectory_Payment_Manager
1546
-         * @param string $headers The email headers.
1547
-         * @param int|string $page_id Page ID.
1548
-         * @param int|string $user_id User ID.
1549
-         * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1550
-         * @param string $custom_1 Custom data to be sent.
1551
-         */
1552
-        $headers = apply_filters('geodir_adminEmail_headers',$headers,$page_id, $user_id, $message_type, $custom_1);
1553
-
1554
-
1555
-
1556
-        $sent = wp_mail($to, $subject, $message, $headers);
1557
-        if( ! $sent ) {
1558
-            if ( is_array( $to ) ) {
1559
-                $to = implode( ',', $to );
1560
-            }
1561
-            $log_message = sprintf(
1562
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1563
-                $message_type,
1564
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1565
-                $to,
1566
-                $subject
1567
-            );
1568
-            geodir_error_log( $log_message );
1569
-        }
1570
-    }
1469
+		$pkg_limit = get_property_price_info_listing($page_id);
1470
+		$alivedays = $pkg_limit['days'];
1471
+		$productlink = get_permalink($page_id);
1472
+		$post_info = get_post($page_id);
1473
+		$post_date = date('dS F,Y', strtotime($post_info->post_date));
1474
+		$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1475
+		$loginurl = geodir_login_url();
1476
+		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
1477
+		$siteurl = home_url();
1478
+		$siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1479
+		$user_info = get_userdata($user_id);
1480
+		$user_email = $user_info->user_email;
1481
+		$display_name = geodir_get_client_name($user_id);
1482
+		$user_login = $user_info->user_login;
1483
+		$number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1484
+		if ($number_of_grace_days == '') {
1485
+			$number_of_grace_days = 1;
1486
+		}
1487
+		if ($post_info->post_type == 'event') {
1488
+			$post_type = 'event';
1489
+		} else {
1490
+			$post_type = 'listing';
1491
+		}
1492
+		$renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1493
+		$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#]');
1494
+		$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);
1495
+		$client_message = str_replace($search_array, $replace_array, $client_message);
1496
+		$subject = str_replace($search_array, $replace_array, $subject);
1497
+		$headers = 'MIME-Version: 1.0' . "\r\n";
1498
+		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1499
+		$headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1500
+
1501
+		$to = $fromEmail;
1502
+		$message = $client_message;
1503
+
1504
+
1505
+		/**
1506
+		 * Filter the admin email to address.
1507
+		 *
1508
+		 * @since 1.6.1
1509
+		 * @package GeoDirectory
1510
+		 * @param string $to The email address the email is being sent to.
1511
+		 * @param int|string $page_id Page ID.
1512
+		 * @param int|string $user_id User ID.
1513
+		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1514
+		 * @param string $custom_1 Custom data to be sent.
1515
+		 */
1516
+		$to = apply_filters('geodir_adminEmail_to',$to,$page_id, $user_id, $message_type, $custom_1 );
1517
+		/**
1518
+		 * Filter the admin email subject.
1519
+		 *
1520
+		 * @since 1.6.1
1521
+		 * @package GeoDirectory_Payment_Manager
1522
+		 * @param string $subject The email subject.
1523
+		 * @param int|string $page_id Page ID.
1524
+		 * @param int|string $user_id User ID.
1525
+		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1526
+		 * @param string $custom_1 Custom data to be sent.
1527
+		 */
1528
+		$subject = apply_filters('geodir_adminEmail_subject',$subject,$page_id, $user_id, $message_type, $custom_1);
1529
+		/**
1530
+		 * Filter the admin email message.
1531
+		 *
1532
+		 * @since 1.6.1
1533
+		 * @package GeoDirectory_Payment_Manager
1534
+		 * @param string $message The email message text.
1535
+		 * @param int|string $page_id Page ID.
1536
+		 * @param int|string $user_id User ID.
1537
+		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1538
+		 * @param string $custom_1 Custom data to be sent.
1539
+		 */
1540
+		$message = apply_filters('geodir_adminEmail_message',$message,$page_id, $user_id, $message_type, $custom_1);
1541
+		/**
1542
+		 * Filter the admin email headers.
1543
+		 *
1544
+		 * @since 1.6.1
1545
+		 * @package GeoDirectory_Payment_Manager
1546
+		 * @param string $headers The email headers.
1547
+		 * @param int|string $page_id Page ID.
1548
+		 * @param int|string $user_id User ID.
1549
+		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1550
+		 * @param string $custom_1 Custom data to be sent.
1551
+		 */
1552
+		$headers = apply_filters('geodir_adminEmail_headers',$headers,$page_id, $user_id, $message_type, $custom_1);
1553
+
1554
+
1555
+
1556
+		$sent = wp_mail($to, $subject, $message, $headers);
1557
+		if( ! $sent ) {
1558
+			if ( is_array( $to ) ) {
1559
+				$to = implode( ',', $to );
1560
+			}
1561
+			$log_message = sprintf(
1562
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1563
+				$message_type,
1564
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1565
+				$to,
1566
+				$subject
1567
+			);
1568
+			geodir_error_log( $log_message );
1569
+		}
1570
+	}
1571 1571
 }
1572 1572
 
1573 1573
 if (!function_exists('sendEmail')) {
1574
-    /**
1575
-     * @todo could be a duplicate of geodir_sendEmail.
1576
-     *
1577
-     * @since 1.0.0
1578
-     * @package GeoDirectory
1579
-     * @param string $fromEmail Sender email address.
1580
-     * @param string $fromEmailName Sender name.
1581
-     * @param string $toEmail Receiver email address.
1582
-     * @param string $toEmailName Receiver name.
1583
-     * @param string $to_subject Email subject.
1584
-     * @param string $to_message Email content.
1585
-     * @param string $extra Not being used.
1586
-     * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration.
1587
-     * @param string $post_id The post ID.
1588
-     * @param string $user_id The user ID.
1589
-     */
1590
-    function sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '')
1591
-    {
1592
-        $login_details = '';
1593
-        if ($message_type == 'send_friend') {
1594
-            $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1595
-            $message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1596
-        } elseif ($message_type == 'send_enquiry') {
1597
-            $subject = __(get_option('email_enquiry_subject'),'geodirectory');
1598
-            $message = __(get_option('email_enquiry_content'),'geodirectory');
1599
-        } elseif ($message_type == 'forgot_password') {
1600
-            $subject = __(get_option('forgot_password_subject'),'geodirectory');
1601
-            $message = __(get_option('forgot_password_content'),'geodirectory');
1602
-            $login_details = $to_message;
1603
-        } elseif ($message_type == 'registration') {
1604
-            $subject = __(get_option('registration_success_email_subject'),'geodirectory');
1605
-            $message = __(get_option('registration_success_email_content'),'geodirectory');
1606
-            $login_details = $to_message;
1607
-        }
1608
-        $to_message = nl2br($to_message);
1609
-        $sitefromEmail = get_option('site_email');
1610
-        $sitefromEmailName = get_site_emailName();
1611
-        $productlink = get_permalink($post_id);
1612
-        $post_info = get_post($post_id);
1613
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1614
-        $siteurl = home_url();
1615
-        $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1616
-        $loginurl = geodir_login_url();
1617
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1618
-        if ($fromEmail == '') {
1619
-            $fromEmail = get_option('site_email');
1620
-        }
1621
-        if ($fromEmailName == '') {
1622
-            $fromEmailName = get_option('site_email_name');
1623
-        }
1624
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]');
1625
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName);
1626
-        $message = str_replace($search_array, $replace_array, $message);
1627
-
1628
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]');
1629
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName);
1630
-        $subject = str_replace($search_array, $replace_array, $subject);
1631
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1632
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1633
-        $headers .= "Reply-To: " . $fromEmail . "\r\n";
1634
-        $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1635
-
1636
-        $to = $toEmail;
1637
-
1638
-        $sent = wp_mail($to, $subject, $message, $headers);
1639
-        if( ! $sent ) {
1640
-            if ( is_array( $to ) ) {
1641
-                $to = implode( ',', $to );
1642
-            }
1643
-            $log_message = sprintf(
1644
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1645
-                $message_type,
1646
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1647
-                $to,
1648
-                $subject
1649
-            );
1650
-            geodir_error_log( $log_message );
1651
-        }
1652
-
1653
-        ///////// ADMIN BCC EMIALS
1654
-        $admin_bcc = false;
1655
-        if ($message_type == 'registration') {
1656
-            $message_raw = explode(__("Password:", 'geodirectory'), $message);
1657
-            $message_raw2 = explode("</p>", $message_raw[1], 2);
1658
-            $message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1];
1659
-        }
1660
-        $adminEmail = get_bloginfo('admin_email');
1661
-        $to = $adminEmail;
1662
-
1663
-        if ($message_type == 'registration' && get_option('bcc_new_user')) {
1664
-            $subject .= ' - ADMIN BCC COPY';
1665
-            $admin_bcc = true;
1666
-        }
1667
-        elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1668
-            $subject .= ' - ADMIN BCC COPY';
1669
-            $admin_bcc = true;
1670
-        }
1671
-        elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1672
-            $subject .= ' - ADMIN BCC COPY';
1673
-            $admin_bcc = true;
1674
-        }
1675
-
1676
-        if($admin_bcc === true){
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
-
1693
-    }
1574
+	/**
1575
+	 * @todo could be a duplicate of geodir_sendEmail.
1576
+	 *
1577
+	 * @since 1.0.0
1578
+	 * @package GeoDirectory
1579
+	 * @param string $fromEmail Sender email address.
1580
+	 * @param string $fromEmailName Sender name.
1581
+	 * @param string $toEmail Receiver email address.
1582
+	 * @param string $toEmailName Receiver name.
1583
+	 * @param string $to_subject Email subject.
1584
+	 * @param string $to_message Email content.
1585
+	 * @param string $extra Not being used.
1586
+	 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration.
1587
+	 * @param string $post_id The post ID.
1588
+	 * @param string $user_id The user ID.
1589
+	 */
1590
+	function sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '')
1591
+	{
1592
+		$login_details = '';
1593
+		if ($message_type == 'send_friend') {
1594
+			$subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1595
+			$message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1596
+		} elseif ($message_type == 'send_enquiry') {
1597
+			$subject = __(get_option('email_enquiry_subject'),'geodirectory');
1598
+			$message = __(get_option('email_enquiry_content'),'geodirectory');
1599
+		} elseif ($message_type == 'forgot_password') {
1600
+			$subject = __(get_option('forgot_password_subject'),'geodirectory');
1601
+			$message = __(get_option('forgot_password_content'),'geodirectory');
1602
+			$login_details = $to_message;
1603
+		} elseif ($message_type == 'registration') {
1604
+			$subject = __(get_option('registration_success_email_subject'),'geodirectory');
1605
+			$message = __(get_option('registration_success_email_content'),'geodirectory');
1606
+			$login_details = $to_message;
1607
+		}
1608
+		$to_message = nl2br($to_message);
1609
+		$sitefromEmail = get_option('site_email');
1610
+		$sitefromEmailName = get_site_emailName();
1611
+		$productlink = get_permalink($post_id);
1612
+		$post_info = get_post($post_id);
1613
+		$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1614
+		$siteurl = home_url();
1615
+		$siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1616
+		$loginurl = geodir_login_url();
1617
+		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
1618
+		if ($fromEmail == '') {
1619
+			$fromEmail = get_option('site_email');
1620
+		}
1621
+		if ($fromEmailName == '') {
1622
+			$fromEmailName = get_option('site_email_name');
1623
+		}
1624
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]');
1625
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName);
1626
+		$message = str_replace($search_array, $replace_array, $message);
1627
+
1628
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]');
1629
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName);
1630
+		$subject = str_replace($search_array, $replace_array, $subject);
1631
+		$headers = 'MIME-Version: 1.0' . "\r\n";
1632
+		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1633
+		$headers .= "Reply-To: " . $fromEmail . "\r\n";
1634
+		$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1635
+
1636
+		$to = $toEmail;
1637
+
1638
+		$sent = wp_mail($to, $subject, $message, $headers);
1639
+		if( ! $sent ) {
1640
+			if ( is_array( $to ) ) {
1641
+				$to = implode( ',', $to );
1642
+			}
1643
+			$log_message = sprintf(
1644
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1645
+				$message_type,
1646
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1647
+				$to,
1648
+				$subject
1649
+			);
1650
+			geodir_error_log( $log_message );
1651
+		}
1652
+
1653
+		///////// ADMIN BCC EMIALS
1654
+		$admin_bcc = false;
1655
+		if ($message_type == 'registration') {
1656
+			$message_raw = explode(__("Password:", 'geodirectory'), $message);
1657
+			$message_raw2 = explode("</p>", $message_raw[1], 2);
1658
+			$message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1];
1659
+		}
1660
+		$adminEmail = get_bloginfo('admin_email');
1661
+		$to = $adminEmail;
1662
+
1663
+		if ($message_type == 'registration' && get_option('bcc_new_user')) {
1664
+			$subject .= ' - ADMIN BCC COPY';
1665
+			$admin_bcc = true;
1666
+		}
1667
+		elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1668
+			$subject .= ' - ADMIN BCC COPY';
1669
+			$admin_bcc = true;
1670
+		}
1671
+		elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1672
+			$subject .= ' - ADMIN BCC COPY';
1673
+			$admin_bcc = true;
1674
+		}
1675
+
1676
+		if($admin_bcc === true){
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
+
1693
+	}
1694 1694
 }
1695 1695
 
1696 1696
 /*
@@ -1708,16 +1708,16 @@  discard block
 block discarded – undo
1708 1708
  */
1709 1709
 function gd_lang_object_ids($ids_array, $type)
1710 1710
 {
1711
-    if (function_exists('icl_object_id')) {
1712
-        $res = array();
1713
-        foreach ($ids_array as $id) {
1714
-            $xlat = icl_object_id($id, $type, false);
1715
-            if (!is_null($xlat)) $res[] = $xlat;
1716
-        }
1717
-        return $res;
1718
-    } else {
1719
-        return $ids_array;
1720
-    }
1711
+	if (function_exists('icl_object_id')) {
1712
+		$res = array();
1713
+		foreach ($ids_array as $id) {
1714
+			$xlat = icl_object_id($id, $type, false);
1715
+			if (!is_null($xlat)) $res[] = $xlat;
1716
+		}
1717
+		return $res;
1718
+	} else {
1719
+		return $ids_array;
1720
+	}
1721 1721
 }
1722 1722
 
1723 1723
 
@@ -1732,31 +1732,31 @@  discard block
 block discarded – undo
1732 1732
  * @return array Modified Body CSS classes.
1733 1733
  */
1734 1734
 function geodir_custom_posts_body_class($classes) {
1735
-    global $wpdb, $wp;
1736
-    $post_types = geodir_get_posttypes('object');
1737
-    if (!empty($post_types) && count((array)$post_types) > 1) {
1738
-        $classes[] = 'geodir_custom_posts';
1739
-    }
1740
-
1741
-    // fix body class for signup page
1742
-    if (geodir_is_page('login')) {
1743
-        $new_classes = array();
1744
-        $new_classes[] = 'signup page-geodir-signup';
1745
-        if (!empty($classes)) {
1746
-            foreach ($classes as $class) {
1747
-                if ($class && $class != 'home' && $class != 'blog') {
1748
-                    $new_classes[] = $class;
1749
-                }
1750
-            }
1751
-        }
1752
-        $classes = $new_classes;
1753
-    }
1754
-
1755
-    if (geodir_is_geodir_page()) {
1756
-        $classes[] = 'geodir-page';
1757
-    }
1758
-
1759
-    return $classes;
1735
+	global $wpdb, $wp;
1736
+	$post_types = geodir_get_posttypes('object');
1737
+	if (!empty($post_types) && count((array)$post_types) > 1) {
1738
+		$classes[] = 'geodir_custom_posts';
1739
+	}
1740
+
1741
+	// fix body class for signup page
1742
+	if (geodir_is_page('login')) {
1743
+		$new_classes = array();
1744
+		$new_classes[] = 'signup page-geodir-signup';
1745
+		if (!empty($classes)) {
1746
+			foreach ($classes as $class) {
1747
+				if ($class && $class != 'home' && $class != 'blog') {
1748
+					$new_classes[] = $class;
1749
+				}
1750
+			}
1751
+		}
1752
+		$classes = $new_classes;
1753
+	}
1754
+
1755
+	if (geodir_is_geodir_page()) {
1756
+		$classes[] = 'geodir-page';
1757
+	}
1758
+
1759
+	return $classes;
1760 1760
 }
1761 1761
 
1762 1762
 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
@@ -1771,12 +1771,12 @@  discard block
 block discarded – undo
1771 1771
  */
1772 1772
 function geodir_map_zoom_level()
1773 1773
 {
1774
-    /**
1775
-     * Filter GD map zoom level.
1776
-     *
1777
-     * @since 1.0.0
1778
-     */
1779
-    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));
1774
+	/**
1775
+	 * Filter GD map zoom level.
1776
+	 *
1777
+	 * @since 1.0.0
1778
+	 */
1779
+	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));
1780 1780
 
1781 1781
 }
1782 1782
 
@@ -1790,12 +1790,12 @@  discard block
 block discarded – undo
1790 1790
  */
1791 1791
 function geodir_option_version_backup($geodir_option_name)
1792 1792
 {
1793
-    $version_date = time();
1794
-    $geodir_option = get_option($geodir_option_name);
1793
+	$version_date = time();
1794
+	$geodir_option = get_option($geodir_option_name);
1795 1795
 
1796
-    if (!empty($geodir_option)) {
1797
-        add_option($geodir_option_name . '_' . $version_date, $geodir_option);
1798
-    }
1796
+	if (!empty($geodir_option)) {
1797
+		add_option($geodir_option_name . '_' . $version_date, $geodir_option);
1798
+	}
1799 1799
 }
1800 1800
 
1801 1801
 /**
@@ -1808,11 +1808,11 @@  discard block
 block discarded – undo
1808 1808
  */
1809 1809
 function get_page_id_geodir_add_listing_page($page_id)
1810 1810
 {
1811
-    if (geodir_wpml_multilingual_status()) {
1812
-        $post_type = 'post_page';
1813
-        $page_id = geodir_get_wpml_element_id($page_id, $post_type);
1814
-    }
1815
-    return $page_id;
1811
+	if (geodir_wpml_multilingual_status()) {
1812
+		$post_type = 'post_page';
1813
+		$page_id = geodir_get_wpml_element_id($page_id, $post_type);
1814
+	}
1815
+	return $page_id;
1816 1816
 }
1817 1817
 
1818 1818
 /**
@@ -1824,10 +1824,10 @@  discard block
 block discarded – undo
1824 1824
  */
1825 1825
 function geodir_wpml_multilingual_status()
1826 1826
 {
1827
-    if (function_exists('icl_object_id')) {
1828
-        return true;
1829
-    }
1830
-    return false;
1827
+	if (function_exists('icl_object_id')) {
1828
+		return true;
1829
+	}
1830
+	return false;
1831 1831
 }
1832 1832
 
1833 1833
 /**
@@ -1841,22 +1841,22 @@  discard block
 block discarded – undo
1841 1841
  */
1842 1842
 function geodir_get_wpml_element_id($page_id, $post_type)
1843 1843
 {
1844
-    global $sitepress;
1845
-    if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1846
-        $trid = $sitepress->get_element_trid($page_id, $post_type);
1847
-
1848
-        if ($trid > 0) {
1849
-            $translations = $sitepress->get_element_translations($trid, $post_type);
1850
-
1851
-            $lang = $sitepress->get_current_language();
1852
-            $lang = $lang ? $lang : $sitepress->get_default_language();
1853
-
1854
-            if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
1855
-                $page_id = $translations[$lang]->element_id;
1856
-            }
1857
-        }
1858
-    }
1859
-    return $page_id;
1844
+	global $sitepress;
1845
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1846
+		$trid = $sitepress->get_element_trid($page_id, $post_type);
1847
+
1848
+		if ($trid > 0) {
1849
+			$translations = $sitepress->get_element_translations($trid, $post_type);
1850
+
1851
+			$lang = $sitepress->get_current_language();
1852
+			$lang = $lang ? $lang : $sitepress->get_default_language();
1853
+
1854
+			if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
1855
+				$page_id = $translations[$lang]->element_id;
1856
+			}
1857
+		}
1858
+	}
1859
+	return $page_id;
1860 1860
 }
1861 1861
 
1862 1862
 /**
@@ -1868,20 +1868,20 @@  discard block
 block discarded – undo
1868 1868
  */
1869 1869
 function geodir_wpml_check_element_id()
1870 1870
 {
1871
-    global $sitepress;
1872
-    if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1873
-        $el_type = 'post_page';
1874
-        $el_id = get_option('geodir_add_listing_page');
1875
-        $default_lang = $sitepress->get_default_language();
1876
-        $el_details = $sitepress->get_element_language_details($el_id, $el_type);
1877
-
1878
-        if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
1879
-            if (!$el_details->source_language_code) {
1880
-                $sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
1881
-                $sitepress->icl_translations_cache->clear();
1882
-            }
1883
-        }
1884
-    }
1871
+	global $sitepress;
1872
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1873
+		$el_type = 'post_page';
1874
+		$el_id = get_option('geodir_add_listing_page');
1875
+		$default_lang = $sitepress->get_default_language();
1876
+		$el_details = $sitepress->get_element_language_details($el_id, $el_type);
1877
+
1878
+		if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
1879
+			if (!$el_details->source_language_code) {
1880
+				$sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
1881
+				$sitepress->icl_translations_cache->clear();
1882
+			}
1883
+		}
1884
+	}
1885 1885
 }
1886 1886
 
1887 1887
 /**
@@ -1896,44 +1896,44 @@  discard block
 block discarded – undo
1896 1896
  */
1897 1897
 function geodir_widget_listings_get_order($query_args)
1898 1898
 {
1899
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1900
-
1901
-    $query_args = $gd_query_args_widgets;
1902
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1903
-        return $wpdb->posts . ".post_date DESC, ";
1904
-    }
1905
-
1906
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1907
-    $table = $plugin_prefix . $post_type . '_detail';
1908
-
1909
-    $sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
1910
-
1911
-    switch ($sort_by) {
1912
-        case 'latest':
1913
-        case 'newest':
1914
-            $orderby = $wpdb->posts . ".post_date DESC, ";
1915
-            break;
1916
-        case 'featured':
1917
-            $orderby = $table . ".is_featured ASC, ";
1918
-            break;
1919
-        case 'az':
1920
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1921
-            break;
1922
-        case 'high_review':
1923
-            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
1924
-            break;
1925
-        case 'high_rating':
1926
-            $orderby = "( " . $table . ".overall_rating  ) DESC, ";
1927
-            break;
1928
-        case 'random':
1929
-            $orderby = "RAND(), ";
1930
-            break;
1931
-        default:
1932
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1933
-            break;
1934
-    }
1935
-
1936
-    return $orderby;
1899
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1900
+
1901
+	$query_args = $gd_query_args_widgets;
1902
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1903
+		return $wpdb->posts . ".post_date DESC, ";
1904
+	}
1905
+
1906
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1907
+	$table = $plugin_prefix . $post_type . '_detail';
1908
+
1909
+	$sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
1910
+
1911
+	switch ($sort_by) {
1912
+		case 'latest':
1913
+		case 'newest':
1914
+			$orderby = $wpdb->posts . ".post_date DESC, ";
1915
+			break;
1916
+		case 'featured':
1917
+			$orderby = $table . ".is_featured ASC, ";
1918
+			break;
1919
+		case 'az':
1920
+			$orderby = $wpdb->posts . ".post_title ASC, ";
1921
+			break;
1922
+		case 'high_review':
1923
+			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
1924
+			break;
1925
+		case 'high_rating':
1926
+			$orderby = "( " . $table . ".overall_rating  ) DESC, ";
1927
+			break;
1928
+		case 'random':
1929
+			$orderby = "RAND(), ";
1930
+			break;
1931
+		default:
1932
+			$orderby = $wpdb->posts . ".post_title ASC, ";
1933
+			break;
1934
+	}
1935
+
1936
+	return $orderby;
1937 1937
 }
1938 1938
 
1939 1939
 /**
@@ -1951,126 +1951,126 @@  discard block
 block discarded – undo
1951 1951
  */
1952 1952
 function geodir_get_widget_listings($query_args = array(), $count_only = false)
1953 1953
 {
1954
-    global $wpdb, $plugin_prefix, $table_prefix;
1955
-    $GLOBALS['gd_query_args_widgets'] = $query_args;
1956
-    $gd_query_args_widgets = $query_args;
1957
-
1958
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1959
-    $table = $plugin_prefix . $post_type . '_detail';
1960
-
1961
-    $fields = $wpdb->posts . ".*, " . $table . ".*";
1962
-    /**
1963
-     * Filter widget listing fields string part that is being used for query.
1964
-     *
1965
-     * @since 1.0.0
1966
-     * @param string $fields Fields string.
1967
-     * @param string $table Table name.
1968
-     * @param string $post_type Post type.
1969
-     */
1970
-    $fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
1971
-
1972
-    $join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
1954
+	global $wpdb, $plugin_prefix, $table_prefix;
1955
+	$GLOBALS['gd_query_args_widgets'] = $query_args;
1956
+	$gd_query_args_widgets = $query_args;
1957
+
1958
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1959
+	$table = $plugin_prefix . $post_type . '_detail';
1960
+
1961
+	$fields = $wpdb->posts . ".*, " . $table . ".*";
1962
+	/**
1963
+	 * Filter widget listing fields string part that is being used for query.
1964
+	 *
1965
+	 * @since 1.0.0
1966
+	 * @param string $fields Fields string.
1967
+	 * @param string $table Table name.
1968
+	 * @param string $post_type Post type.
1969
+	 */
1970
+	$fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
1971
+
1972
+	$join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
1973
+
1974
+	########### WPML ###########
1975
+
1976
+	if (function_exists('icl_object_id')) {
1977
+		global $sitepress;
1978
+		$lang_code = ICL_LANGUAGE_CODE;
1979
+		if ($lang_code) {
1980
+			$join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
1981
+		}
1982
+	}
1973 1983
 
1974
-    ########### WPML ###########
1984
+	########### WPML ###########
1975 1985
 
1976
-    if (function_exists('icl_object_id')) {
1977
-        global $sitepress;
1978
-        $lang_code = ICL_LANGUAGE_CODE;
1979
-        if ($lang_code) {
1980
-            $join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
1981
-        }
1982
-    }
1986
+	/**
1987
+	 * Filter widget listing join clause string part that is being used for query.
1988
+	 *
1989
+	 * @since 1.0.0
1990
+	 * @param string $join Join clause string.
1991
+	 * @param string $post_type Post type.
1992
+	 */
1993
+	$join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
1983 1994
 
1984
-    ########### WPML ###########
1995
+	$post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
1985 1996
 
1986
-    /**
1987
-     * Filter widget listing join clause string part that is being used for query.
1988
-     *
1989
-     * @since 1.0.0
1990
-     * @param string $join Join clause string.
1991
-     * @param string $post_type Post type.
1992
-     */
1993
-    $join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
1994
-
1995
-    $post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
1996
-
1997
-    $where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
1998
-
1999
-    ########### WPML ###########
2000
-    if (function_exists('icl_object_id')) {
2001
-        if ($lang_code) {
2002
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
2003
-        }
2004
-    }
2005
-    ########### WPML ###########
2006
-    /**
2007
-     * Filter widget listing where clause string part that is being used for query.
2008
-     *
2009
-     * @since 1.0.0
2010
-     * @param string $where Where clause string.
2011
-     * @param string $post_type Post type.
2012
-     */
2013
-    $where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2014
-    $where = $where != '' ? " WHERE 1=1 " . $where : '';
2015
-
2016
-    $groupby = " GROUP BY $wpdb->posts.ID ";
2017
-    /**
2018
-     * Filter widget listing groupby clause string part that is being used for query.
2019
-     *
2020
-     * @since 1.0.0
2021
-     * @param string $groupby Group by clause string.
2022
-     * @param string $post_type Post type.
2023
-     */
2024
-    $groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
1997
+	$where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
2025 1998
 
2026
-    if ($count_only) {
2027
-        $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
1999
+	########### WPML ###########
2000
+	if (function_exists('icl_object_id')) {
2001
+		if ($lang_code) {
2002
+			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
2003
+		}
2004
+	}
2005
+	########### WPML ###########
2006
+	/**
2007
+	 * Filter widget listing where clause string part that is being used for query.
2008
+	 *
2009
+	 * @since 1.0.0
2010
+	 * @param string $where Where clause string.
2011
+	 * @param string $post_type Post type.
2012
+	 */
2013
+	$where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2014
+	$where = $where != '' ? " WHERE 1=1 " . $where : '';
2015
+
2016
+	$groupby = " GROUP BY $wpdb->posts.ID ";
2017
+	/**
2018
+	 * Filter widget listing groupby clause string part that is being used for query.
2019
+	 *
2020
+	 * @since 1.0.0
2021
+	 * @param string $groupby Group by clause string.
2022
+	 * @param string $post_type Post type.
2023
+	 */
2024
+	$groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
2025
+
2026
+	if ($count_only) {
2027
+		$sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
2028 2028
 			" . $join . "
2029 2029
 			" . $where;
2030
-        $rows = (int)$wpdb->get_var($sql);
2031
-    } else {
2032
-        $orderby = geodir_widget_listings_get_order($query_args);
2033
-        /**
2034
-         * Filter widget listing orderby clause string part that is being used for query.
2035
-         *
2036
-         * @since 1.0.0
2037
-         * @param string $orderby Order by clause string.
2038
-         * @param string $table Table name.
2039
-         * @param string $post_type Post type.
2040
-         */
2041
-        $orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2042
-        $orderby .= $wpdb->posts . ".post_title ASC";
2043
-        $orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2044
-
2045
-        $limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2046
-        /**
2047
-         * Filter widget listing limit that is being used for query.
2048
-         *
2049
-         * @since 1.0.0
2050
-         * @param int $limit Query results limit.
2051
-         * @param string $post_type Post type.
2052
-         */
2053
-        $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2054
-
2055
-        $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2056
-        if ( !$page )
2057
-            $page = 1;
2058
-
2059
-        $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
2060
-
2061
-        $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
2030
+		$rows = (int)$wpdb->get_var($sql);
2031
+	} else {
2032
+		$orderby = geodir_widget_listings_get_order($query_args);
2033
+		/**
2034
+		 * Filter widget listing orderby clause string part that is being used for query.
2035
+		 *
2036
+		 * @since 1.0.0
2037
+		 * @param string $orderby Order by clause string.
2038
+		 * @param string $table Table name.
2039
+		 * @param string $post_type Post type.
2040
+		 */
2041
+		$orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2042
+		$orderby .= $wpdb->posts . ".post_title ASC";
2043
+		$orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2044
+
2045
+		$limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2046
+		/**
2047
+		 * Filter widget listing limit that is being used for query.
2048
+		 *
2049
+		 * @since 1.0.0
2050
+		 * @param int $limit Query results limit.
2051
+		 * @param string $post_type Post type.
2052
+		 */
2053
+		$limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2054
+
2055
+		$page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2056
+		if ( !$page )
2057
+			$page = 1;
2058
+
2059
+		$limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
2060
+
2061
+		$sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
2062 2062
 			" . $join . "
2063 2063
 			" . $where . "
2064 2064
 			" . $groupby . "
2065 2065
 			" . $orderby . "
2066 2066
 			" . $limit;
2067
-        $rows = $wpdb->get_results($sql);
2068
-    }
2067
+		$rows = $wpdb->get_results($sql);
2068
+	}
2069 2069
 
2070
-    unset($GLOBALS['gd_query_args_widgets']);
2071
-    unset($gd_query_args_widgets);
2070
+	unset($GLOBALS['gd_query_args_widgets']);
2071
+	unset($gd_query_args_widgets);
2072 2072
 
2073
-    return $rows;
2073
+	return $rows;
2074 2074
 }
2075 2075
 
2076 2076
 /**
@@ -2085,14 +2085,14 @@  discard block
 block discarded – undo
2085 2085
  */
2086 2086
 function geodir_function_widget_listings_fields($fields)
2087 2087
 {
2088
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2088
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2089 2089
 
2090
-    $query_args = $gd_query_args_widgets;
2091
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2092
-        return $fields;
2093
-    }
2090
+	$query_args = $gd_query_args_widgets;
2091
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2092
+		return $fields;
2093
+	}
2094 2094
     
2095
-    return $fields;
2095
+	return $fields;
2096 2096
 }
2097 2097
 
2098 2098
 /**
@@ -2107,28 +2107,28 @@  discard block
 block discarded – undo
2107 2107
  */
2108 2108
 function geodir_function_widget_listings_join($join)
2109 2109
 {
2110
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2110
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2111 2111
 
2112
-    $query_args = $gd_query_args_widgets;
2113
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2114
-        return $join;
2115
-    }
2112
+	$query_args = $gd_query_args_widgets;
2113
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2114
+		return $join;
2115
+	}
2116 2116
 
2117
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2118
-    $table = $plugin_prefix . $post_type . '_detail';
2117
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2118
+	$table = $plugin_prefix . $post_type . '_detail';
2119 2119
 
2120
-    if (!empty($query_args['with_pics_only'])) {
2121
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2122
-    }
2120
+	if (!empty($query_args['with_pics_only'])) {
2121
+		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2122
+	}
2123 2123
 
2124
-    if (!empty($query_args['tax_query'])) {
2125
-        $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2126
-        if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2127
-            $join .= $tax_queries['join'];
2128
-        }
2129
-    }
2124
+	if (!empty($query_args['tax_query'])) {
2125
+		$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2126
+		if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2127
+			$join .= $tax_queries['join'];
2128
+		}
2129
+	}
2130 2130
 
2131
-    return $join;
2131
+	return $join;
2132 2132
 }
2133 2133
 
2134 2134
 /**
@@ -2143,58 +2143,58 @@  discard block
 block discarded – undo
2143 2143
  */
2144 2144
 function geodir_function_widget_listings_where($where)
2145 2145
 {
2146
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2147
-
2148
-    $query_args = $gd_query_args_widgets;
2149
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2150
-        return $where;
2151
-    }
2152
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2153
-    $table = $plugin_prefix . $post_type . '_detail';
2154
-
2155
-    if (!empty($query_args)) {
2156
-        if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2157
-            $where = geodir_default_location_where($where, $table);
2158
-        }
2159
-
2160
-        if (!empty($query_args['post_author'])) {
2161
-            $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2162
-        }
2163
-        
2164
-        if (!empty($query_args['show_featured_only'])) {
2165
-            $where .= " AND " . $table . ".is_featured = '1'";
2166
-        }
2146
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2167 2147
 
2168
-        if (!empty($query_args['show_special_only'])) {
2169
-            $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2170
-        }
2148
+	$query_args = $gd_query_args_widgets;
2149
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2150
+		return $where;
2151
+	}
2152
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2153
+	$table = $plugin_prefix . $post_type . '_detail';
2171 2154
 
2172
-        if (!empty($query_args['with_pics_only'])) {
2173
-            $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2174
-        }
2155
+	if (!empty($query_args)) {
2156
+		if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2157
+			$where = geodir_default_location_where($where, $table);
2158
+		}
2175 2159
 
2176
-        if (!empty($query_args['featured_image_only'])) {
2177
-            $where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2178
-        }
2160
+		if (!empty($query_args['post_author'])) {
2161
+			$where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2162
+		}
2163
+        
2164
+		if (!empty($query_args['show_featured_only'])) {
2165
+			$where .= " AND " . $table . ".is_featured = '1'";
2166
+		}
2179 2167
 
2180
-        if (!empty($query_args['with_videos_only'])) {
2181
-            $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2182
-        }
2168
+		if (!empty($query_args['show_special_only'])) {
2169
+			$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2170
+		}
2183 2171
 
2184
-        if (!empty($query_args['tax_query'])) {
2185
-            $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2172
+		if (!empty($query_args['with_pics_only'])) {
2173
+			$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2174
+		}
2186 2175
 
2187
-            if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2188
-                $where .= $tax_queries['where'];
2189
-            }
2190
-        }
2191
-    }
2176
+		if (!empty($query_args['featured_image_only'])) {
2177
+			$where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2178
+		}
2192 2179
 
2193
-    return $where;
2194
-}
2180
+		if (!empty($query_args['with_videos_only'])) {
2181
+			$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2182
+		}
2195 2183
 
2196
-/**
2197
- * Listing query orderby clause SQL part for widgets.
2184
+		if (!empty($query_args['tax_query'])) {
2185
+			$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2186
+
2187
+			if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2188
+				$where .= $tax_queries['where'];
2189
+			}
2190
+		}
2191
+	}
2192
+
2193
+	return $where;
2194
+}
2195
+
2196
+/**
2197
+ * Listing query orderby clause SQL part for widgets.
2198 2198
  *
2199 2199
  * @since 1.0.0
2200 2200
  * @package GeoDirectory
@@ -2205,14 +2205,14 @@  discard block
 block discarded – undo
2205 2205
  */
2206 2206
 function geodir_function_widget_listings_orderby($orderby)
2207 2207
 {
2208
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2208
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2209 2209
 
2210
-    $query_args = $gd_query_args_widgets;
2211
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2212
-        return $orderby;
2213
-    }
2210
+	$query_args = $gd_query_args_widgets;
2211
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2212
+		return $orderby;
2213
+	}
2214 2214
 
2215
-    return $orderby;
2215
+	return $orderby;
2216 2216
 }
2217 2217
 
2218 2218
 /**
@@ -2227,18 +2227,18 @@  discard block
 block discarded – undo
2227 2227
  */
2228 2228
 function geodir_function_widget_listings_limit($limit)
2229 2229
 {
2230
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2230
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2231 2231
 
2232
-    $query_args = $gd_query_args_widgets;
2233
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2234
-        return $limit;
2235
-    }
2232
+	$query_args = $gd_query_args_widgets;
2233
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2234
+		return $limit;
2235
+	}
2236 2236
 
2237
-    if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2238
-        $limit = (int)$query_args['posts_per_page'];
2239
-    }
2237
+	if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2238
+		$limit = (int)$query_args['posts_per_page'];
2239
+	}
2240 2240
 
2241
-    return $limit;
2241
+	return $limit;
2242 2242
 }
2243 2243
 
2244 2244
 /**
@@ -2252,24 +2252,24 @@  discard block
 block discarded – undo
2252 2252
  */
2253 2253
 function geodir_media_image_large_width($default = 800, $params = '')
2254 2254
 {
2255
-    $large_size_w = get_option('large_size_w');
2256
-    $large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2257
-    $large_size_w = absint($large_size_w);
2258
-
2259
-    if (!get_option('geodir_use_wp_media_large_size')) {
2260
-        $large_size_w = 800;
2261
-    }
2262
-
2263
-    /**
2264
-     * Filter large image width.
2265
-     *
2266
-     * @since 1.0.0
2267
-     * @param int $large_size_w Large image width.
2268
-     * @param int $default Default width.
2269
-     * @param string|array $params Image parameters.
2270
-     */
2271
-    $large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2272
-    return $large_size_w;
2255
+	$large_size_w = get_option('large_size_w');
2256
+	$large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2257
+	$large_size_w = absint($large_size_w);
2258
+
2259
+	if (!get_option('geodir_use_wp_media_large_size')) {
2260
+		$large_size_w = 800;
2261
+	}
2262
+
2263
+	/**
2264
+	 * Filter large image width.
2265
+	 *
2266
+	 * @since 1.0.0
2267
+	 * @param int $large_size_w Large image width.
2268
+	 * @param int $default Default width.
2269
+	 * @param string|array $params Image parameters.
2270
+	 */
2271
+	$large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2272
+	return $large_size_w;
2273 2273
 }
2274 2274
 
2275 2275
 /**
@@ -2283,25 +2283,25 @@  discard block
 block discarded – undo
2283 2283
  */
2284 2284
 function geodir_media_image_large_height($default = 800, $params = '')
2285 2285
 {
2286
-    $large_size_h = get_option('large_size_h');
2287
-    $large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2288
-    $large_size_h = absint($large_size_h);
2289
-
2290
-    if (!get_option('geodir_use_wp_media_large_size')) {
2291
-        $large_size_h = 800;
2292
-    }
2293
-
2294
-    /**
2295
-     * Filter large image height.
2296
-     *
2297
-     * @since 1.0.0
2298
-     * @param int $large_size_h Large image height.
2299
-     * @param int $default Default height.
2300
-     * @param string|array $params Image parameters.
2301
-     */
2302
-    $large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2286
+	$large_size_h = get_option('large_size_h');
2287
+	$large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2288
+	$large_size_h = absint($large_size_h);
2303 2289
 
2304
-    return $large_size_h;
2290
+	if (!get_option('geodir_use_wp_media_large_size')) {
2291
+		$large_size_h = 800;
2292
+	}
2293
+
2294
+	/**
2295
+	 * Filter large image height.
2296
+	 *
2297
+	 * @since 1.0.0
2298
+	 * @param int $large_size_h Large image height.
2299
+	 * @param int $default Default height.
2300
+	 * @param string|array $params Image parameters.
2301
+	 */
2302
+	$large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2303
+
2304
+	return $large_size_h;
2305 2305
 }
2306 2306
 
2307 2307
 /**
@@ -2316,25 +2316,25 @@  discard block
 block discarded – undo
2316 2316
  */
2317 2317
 function geodir_sanitize_location_name($type, $name, $translate = true)
2318 2318
 {
2319
-    if ($name == '') {
2320
-        return NULL;
2321
-    }
2322
-
2323
-    $type = $type == 'gd_country' ? 'country' : $type;
2324
-    $type = $type == 'gd_region' ? 'region' : $type;
2325
-    $type = $type == 'gd_city' ? 'city' : $type;
2326
-
2327
-    $return = $name;
2328
-    if (function_exists('get_actual_location_name')) {
2329
-        $return = get_actual_location_name($type, $name, $translate);
2330
-    } else {
2331
-        $return = preg_replace('/-(\d+)$/', '', $return);
2332
-        $return = preg_replace('/[_-]/', ' ', $return);
2333
-        $return = geodir_ucwords($return);
2334
-        $return = $translate ? __($return, 'geodirectory') : $return;
2335
-    }
2336
-
2337
-    return $return;
2319
+	if ($name == '') {
2320
+		return NULL;
2321
+	}
2322
+
2323
+	$type = $type == 'gd_country' ? 'country' : $type;
2324
+	$type = $type == 'gd_region' ? 'region' : $type;
2325
+	$type = $type == 'gd_city' ? 'city' : $type;
2326
+
2327
+	$return = $name;
2328
+	if (function_exists('get_actual_location_name')) {
2329
+		$return = get_actual_location_name($type, $name, $translate);
2330
+	} else {
2331
+		$return = preg_replace('/-(\d+)$/', '', $return);
2332
+		$return = preg_replace('/[_-]/', ' ', $return);
2333
+		$return = geodir_ucwords($return);
2334
+		$return = $translate ? __($return, 'geodirectory') : $return;
2335
+	}
2336
+
2337
+	return $return;
2338 2338
 }
2339 2339
 
2340 2340
 
@@ -2348,14 +2348,14 @@  discard block
 block discarded – undo
2348 2348
 function geodir_comments_number($number)
2349 2349
 {
2350 2350
 
2351
-    if ($number > 1) {
2352
-        $output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2353
-    } elseif ($number == 0 || $number == '') {
2354
-        $output = __('No Reviews', 'geodirectory');
2355
-    } else { // must be one
2356
-        $output = __('1 Review', 'geodirectory');
2357
-    }
2358
-    echo $output;
2351
+	if ($number > 1) {
2352
+		$output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2353
+	} elseif ($number == 0 || $number == '') {
2354
+		$output = __('No Reviews', 'geodirectory');
2355
+	} else { // must be one
2356
+		$output = __('1 Review', 'geodirectory');
2357
+	}
2358
+	echo $output;
2359 2359
 }
2360 2360
 
2361 2361
 /**
@@ -2368,23 +2368,23 @@  discard block
 block discarded – undo
2368 2368
  */
2369 2369
 function is_page_geodir_home()
2370 2370
 {
2371
-    global $wpdb;
2372
-    $cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2373
-    if (function_exists('geodir_location_geo_home_link')) {
2374
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2375
-    }
2376
-    $home_url = home_url('', 'http');
2377
-    if (function_exists('geodir_location_geo_home_link')) {
2378
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2379
-    }
2380
-    $home_url = str_replace("www.", "", $home_url);
2381
-    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')) ) {
2382
-        return true;
2383
-    }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')){
2384
-        return true;
2385
-    } else {
2386
-        return false;
2387
-    }
2371
+	global $wpdb;
2372
+	$cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2373
+	if (function_exists('geodir_location_geo_home_link')) {
2374
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2375
+	}
2376
+	$home_url = home_url('', 'http');
2377
+	if (function_exists('geodir_location_geo_home_link')) {
2378
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2379
+	}
2380
+	$home_url = str_replace("www.", "", $home_url);
2381
+	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')) ) {
2382
+		return true;
2383
+	}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')){
2384
+		return true;
2385
+	} else {
2386
+		return false;
2387
+	}
2388 2388
 
2389 2389
 }
2390 2390
 
@@ -2400,13 +2400,13 @@  discard block
 block discarded – undo
2400 2400
  */
2401 2401
 function geodir_wpseo_homepage_canonical($url)
2402 2402
 {
2403
-    global $post;
2403
+	global $post;
2404 2404
 
2405
-    if (is_page_geodir_home()) {
2406
-        return home_url();
2407
-    }
2405
+	if (is_page_geodir_home()) {
2406
+		return home_url();
2407
+	}
2408 2408
 
2409
-    return $url;
2409
+	return $url;
2410 2410
 }
2411 2411
 
2412 2412
 add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10);
@@ -2423,16 +2423,16 @@  discard block
 block discarded – undo
2423 2423
  */
2424 2424
 function geodir_googlemap_script_extra_details_page($extra)
2425 2425
 {
2426
-    global $post;
2427
-    $add_google_places_api = false;
2428
-    if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2429
-        $add_google_places_api = true;
2430
-    }
2431
-    if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2432
-        $extra .= "&amp;libraries=places";
2433
-    }
2434
-
2435
-    return $extra;
2426
+	global $post;
2427
+	$add_google_places_api = false;
2428
+	if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2429
+		$add_google_places_api = true;
2430
+	}
2431
+	if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2432
+		$extra .= "&amp;libraries=places";
2433
+	}
2434
+
2435
+	return $extra;
2436 2436
 }
2437 2437
 
2438 2438
 add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1);
@@ -2452,93 +2452,93 @@  discard block
 block discarded – undo
2452 2452
  */
2453 2453
 function geodir_popular_post_category_output($args = '', $instance = '')
2454 2454
 {
2455
-    // prints the widget
2456
-    global $wpdb, $plugin_prefix, $geodir_post_category_str;
2457
-    extract($args, EXTR_SKIP);
2458
-
2459
-    echo $before_widget;
2460
-
2461
-    /** This filter is documented in geodirectory_widgets.php */
2462
-    $title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2463
-
2464
-    $gd_post_type = geodir_get_current_posttype();
2465
-
2466
-    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2467
-    $default_post_type = !empty($gd_post_type) ? $gd_post_type : (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ? $instance['default_post_type'] : '');
2468
-
2469
-    $taxonomy = array();
2470
-    if (!empty($gd_post_type)) {
2471
-        $taxonomy[] = $gd_post_type . "category";
2472
-    } else {
2473
-        $all_gd_post_type = geodir_get_posttypes();
2474
-        $default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2475
-        $taxonomy = geodir_get_taxonomies($gd_post_type);
2476
-    }
2477
-
2478
-    $terms = get_terms($taxonomy);
2479
-    $a_terms = array();
2480
-    $b_terms = array();
2481
-
2482
-    foreach ($terms as $term) {
2483
-        if ($term->count > 0) {
2484
-            $a_terms[$term->taxonomy][] = $term;
2485
-        }
2486
-    }
2487
-
2488
-    if (!empty($a_terms)) {
2489
-        foreach ($a_terms as $b_key => $b_val) {
2490
-            $b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2491
-        }
2492
-
2493
-        $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : '';
2494
-
2495
-        $tax_change_output = '';
2496
-        if (count($b_terms) > 1) {
2497
-            $tax_change_output .= "<select data-limit='$category_limit' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2498
-            foreach ($b_terms as $key => $val) {
2499
-                $ptype = get_post_type_object(str_replace("category", "", $key));
2500
-                $cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2501
-                $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2502
-            }
2503
-            $tax_change_output .= "</select>";
2504
-        }
2505
-
2506
-        if (!empty($b_terms)) {
2507
-            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2508
-            global $cat_count;//make global so we can change via function
2509
-            $cat_count = 0;
2510
-            ?>
2455
+	// prints the widget
2456
+	global $wpdb, $plugin_prefix, $geodir_post_category_str;
2457
+	extract($args, EXTR_SKIP);
2458
+
2459
+	echo $before_widget;
2460
+
2461
+	/** This filter is documented in geodirectory_widgets.php */
2462
+	$title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2463
+
2464
+	$gd_post_type = geodir_get_current_posttype();
2465
+
2466
+	$category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2467
+	$default_post_type = !empty($gd_post_type) ? $gd_post_type : (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ? $instance['default_post_type'] : '');
2468
+
2469
+	$taxonomy = array();
2470
+	if (!empty($gd_post_type)) {
2471
+		$taxonomy[] = $gd_post_type . "category";
2472
+	} else {
2473
+		$all_gd_post_type = geodir_get_posttypes();
2474
+		$default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2475
+		$taxonomy = geodir_get_taxonomies($gd_post_type);
2476
+	}
2477
+
2478
+	$terms = get_terms($taxonomy);
2479
+	$a_terms = array();
2480
+	$b_terms = array();
2481
+
2482
+	foreach ($terms as $term) {
2483
+		if ($term->count > 0) {
2484
+			$a_terms[$term->taxonomy][] = $term;
2485
+		}
2486
+	}
2487
+
2488
+	if (!empty($a_terms)) {
2489
+		foreach ($a_terms as $b_key => $b_val) {
2490
+			$b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2491
+		}
2492
+
2493
+		$default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : '';
2494
+
2495
+		$tax_change_output = '';
2496
+		if (count($b_terms) > 1) {
2497
+			$tax_change_output .= "<select data-limit='$category_limit' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2498
+			foreach ($b_terms as $key => $val) {
2499
+				$ptype = get_post_type_object(str_replace("category", "", $key));
2500
+				$cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2501
+				$tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2502
+			}
2503
+			$tax_change_output .= "</select>";
2504
+		}
2505
+
2506
+		if (!empty($b_terms)) {
2507
+			$terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2508
+			global $cat_count;//make global so we can change via function
2509
+			$cat_count = 0;
2510
+			?>
2511 2511
             <div class="geodir-category-list-in clearfix">
2512 2512
                 <div class="geodir-cat-list clearfix">
2513 2513
                     <?php
2514
-                    echo $before_title . __($title) . $after_title;
2514
+					echo $before_title . __($title) . $after_title;
2515 2515
 
2516
-                    echo $tax_change_output;
2516
+					echo $tax_change_output;
2517 2517
 
2518
-                    echo '<ul class="geodir-popular-cat-list">';
2518
+					echo '<ul class="geodir-popular-cat-list">';
2519 2519
 
2520
-                    geodir_helper_cat_list_output($terms, $category_limit);
2520
+					geodir_helper_cat_list_output($terms, $category_limit);
2521 2521
 
2522
-                    echo '</ul>';
2523
-                    ?>
2522
+					echo '</ul>';
2523
+					?>
2524 2524
                 </div>
2525 2525
                 <?php
2526
-                $hide = '';
2527
-                if ($cat_count < $category_limit) {
2528
-                    $hide = 'style="display:none;"';
2529
-                }
2530
-                echo "<div class='geodir-cat-list-more' $hide >";
2531
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>';
2532
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>';
2533
-                echo "</div>";
2534
-                /* add scripts */
2535
-                add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2536
-                ?>
2526
+				$hide = '';
2527
+				if ($cat_count < $category_limit) {
2528
+					$hide = 'style="display:none;"';
2529
+				}
2530
+				echo "<div class='geodir-cat-list-more' $hide >";
2531
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>';
2532
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>';
2533
+				echo "</div>";
2534
+				/* add scripts */
2535
+				add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2536
+				?>
2537 2537
             </div>
2538 2538
         <?php
2539
-        }
2540
-    }
2541
-    echo $after_widget;
2539
+		}
2540
+	}
2541
+	echo $after_widget;
2542 2542
 }
2543 2543
 
2544 2544
 /**
@@ -2552,38 +2552,38 @@  discard block
 block discarded – undo
2552 2552
  */
2553 2553
 function geodir_helper_cat_list_output($terms, $category_limit)
2554 2554
 {
2555
-    global $geodir_post_category_str, $cat_count;
2556
-    $term_icons = geodir_get_term_icon();
2555
+	global $geodir_post_category_str, $cat_count;
2556
+	$term_icons = geodir_get_term_icon();
2557 2557
 
2558
-    $geodir_post_category_str = array();
2558
+	$geodir_post_category_str = array();
2559 2559
 
2560 2560
 
2561
-    foreach ($terms as $cat) {
2562
-        $post_type = str_replace("category", "", $cat->taxonomy);
2563
-        $term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2561
+	foreach ($terms as $cat) {
2562
+		$post_type = str_replace("category", "", $cat->taxonomy);
2563
+		$term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2564 2564
 
2565
-        $cat_count++;
2565
+		$cat_count++;
2566 2566
 
2567
-        $geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2567
+		$geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2568 2568
 
2569
-        $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2570
-        $total_post = $cat->count;
2569
+		$class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2570
+		$total_post = $cat->count;
2571 2571
 
2572
-        $term_link = get_term_link( $cat, $cat->taxonomy );
2573
-        /**
2574
-         * Filer the category term link.
2575
-         *
2576
-         * @since 1.4.5
2577
-         * @param string $term_link The term permalink.
2578
-         * @param int    $cat->term_id The term id.
2579
-         * @param string $post_type Wordpress post type.
2580
-         */
2581
-        $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2572
+		$term_link = get_term_link( $cat, $cat->taxonomy );
2573
+		/**
2574
+		 * Filer the category term link.
2575
+		 *
2576
+		 * @since 1.4.5
2577
+		 * @param string $term_link The term permalink.
2578
+		 * @param int    $cat->term_id The term id.
2579
+		 * @param string $post_type Wordpress post type.
2580
+		 */
2581
+		$term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2582 2582
 
2583
-        echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2584
-        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> ';
2585
-        echo '</a></li>';
2586
-    }
2583
+		echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2584
+		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> ';
2585
+		echo '</a></li>';
2586
+	}
2587 2587
 }
2588 2588
 
2589 2589
 /**
@@ -2597,108 +2597,108 @@  discard block
 block discarded – undo
2597 2597
  */
2598 2598
 function geodir_listing_slider_widget_output($args = '', $instance = '')
2599 2599
 {
2600
-    // prints the widget
2601
-    extract($args, EXTR_SKIP);
2602
-
2603
-    echo $before_widget;
2604
-
2605
-    /** This filter is documented in geodirectory_widgets.php */
2606
-    $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2607
-    /**
2608
-     * Filter the widget post type.
2609
-     *
2610
-     * @since 1.0.0
2611
-     * @param string $instance['post_type'] Post type of listing.
2612
-     */
2613
-    $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2614
-    /**
2615
-     * Filter the widget's term.
2616
-     *
2617
-     * @since 1.0.0
2618
-     * @param string $instance['category'] Filter by term. Can be any valid term.
2619
-     */
2620
-    $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2621
-    /**
2622
-     * Filter the widget listings limit.
2623
-     *
2624
-     * @since 1.0.0
2625
-     * @param string $instance['post_number'] Number of listings to display.
2626
-     */
2627
-    $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2628
-    /**
2629
-     * Filter the widget listings limit shown at one time.
2630
-     *
2631
-     * @since 1.5.0
2632
-     * @param string $instance['max_show'] Number of listings to display on screen.
2633
-     */
2634
-    $max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
2635
-    /**
2636
-     * Filter the widget slide width.
2637
-     *
2638
-     * @since 1.5.0
2639
-     * @param string $instance['slide_width'] Width of the slides shown.
2640
-     */
2641
-    $slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
2642
-    /**
2643
-     * Filter widget's "show title" value.
2644
-     *
2645
-     * @since 1.0.0
2646
-     * @param string|bool $instance['show_title'] Do you want to display title? Can be 1 or 0.
2647
-     */
2648
-    $show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
2649
-    /**
2650
-     * Filter widget's "slideshow" value.
2651
-     *
2652
-     * @since 1.0.0
2653
-     * @param int $instance['slideshow'] Setup a slideshow for the slider to animate automatically.
2654
-     */
2655
-    $slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
2656
-    /**
2657
-     * Filter widget's "animationLoop" value.
2658
-     *
2659
-     * @since 1.0.0
2660
-     * @param int $instance['animationLoop'] Gives the slider a seamless infinite loop.
2661
-     */
2662
-    $animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
2663
-    /**
2664
-     * Filter widget's "directionNav" value.
2665
-     *
2666
-     * @since 1.0.0
2667
-     * @param int $instance['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
2668
-     */
2669
-    $directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
2670
-    /**
2671
-     * Filter widget's "slideshowSpeed" value.
2672
-     *
2673
-     * @since 1.0.0
2674
-     * @param int $instance['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
2675
-     */
2676
-    $slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
2677
-    /**
2678
-     * Filter widget's "animationSpeed" value.
2679
-     *
2680
-     * @since 1.0.0
2681
-     * @param int $instance['animationSpeed'] Set the speed of animations, in milliseconds.
2682
-     */
2683
-    $animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
2684
-    /**
2685
-     * Filter widget's "animation" value.
2686
-     *
2687
-     * @since 1.0.0
2688
-     * @param string $instance['animation'] Controls the animation type, "fade" or "slide".
2689
-     */
2690
-    $animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
2691
-    /**
2692
-     * Filter widget's "list_sort" type.
2693
-     *
2694
-     * @since 1.0.0
2695
-     * @param string $instance['list_sort'] Listing sort by type.
2696
-     */
2697
-    $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
2698
-    $show_featured_only = !empty($instance['show_featured_only']) ? 1 : NULL;
2699
-
2700
-    wp_enqueue_script('geodirectory-jquery-flexslider-js');
2701
-    ?>
2600
+	// prints the widget
2601
+	extract($args, EXTR_SKIP);
2602
+
2603
+	echo $before_widget;
2604
+
2605
+	/** This filter is documented in geodirectory_widgets.php */
2606
+	$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2607
+	/**
2608
+	 * Filter the widget post type.
2609
+	 *
2610
+	 * @since 1.0.0
2611
+	 * @param string $instance['post_type'] Post type of listing.
2612
+	 */
2613
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2614
+	/**
2615
+	 * Filter the widget's term.
2616
+	 *
2617
+	 * @since 1.0.0
2618
+	 * @param string $instance['category'] Filter by term. Can be any valid term.
2619
+	 */
2620
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2621
+	/**
2622
+	 * Filter the widget listings limit.
2623
+	 *
2624
+	 * @since 1.0.0
2625
+	 * @param string $instance['post_number'] Number of listings to display.
2626
+	 */
2627
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2628
+	/**
2629
+	 * Filter the widget listings limit shown at one time.
2630
+	 *
2631
+	 * @since 1.5.0
2632
+	 * @param string $instance['max_show'] Number of listings to display on screen.
2633
+	 */
2634
+	$max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
2635
+	/**
2636
+	 * Filter the widget slide width.
2637
+	 *
2638
+	 * @since 1.5.0
2639
+	 * @param string $instance['slide_width'] Width of the slides shown.
2640
+	 */
2641
+	$slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
2642
+	/**
2643
+	 * Filter widget's "show title" value.
2644
+	 *
2645
+	 * @since 1.0.0
2646
+	 * @param string|bool $instance['show_title'] Do you want to display title? Can be 1 or 0.
2647
+	 */
2648
+	$show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
2649
+	/**
2650
+	 * Filter widget's "slideshow" value.
2651
+	 *
2652
+	 * @since 1.0.0
2653
+	 * @param int $instance['slideshow'] Setup a slideshow for the slider to animate automatically.
2654
+	 */
2655
+	$slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
2656
+	/**
2657
+	 * Filter widget's "animationLoop" value.
2658
+	 *
2659
+	 * @since 1.0.0
2660
+	 * @param int $instance['animationLoop'] Gives the slider a seamless infinite loop.
2661
+	 */
2662
+	$animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
2663
+	/**
2664
+	 * Filter widget's "directionNav" value.
2665
+	 *
2666
+	 * @since 1.0.0
2667
+	 * @param int $instance['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
2668
+	 */
2669
+	$directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
2670
+	/**
2671
+	 * Filter widget's "slideshowSpeed" value.
2672
+	 *
2673
+	 * @since 1.0.0
2674
+	 * @param int $instance['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
2675
+	 */
2676
+	$slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
2677
+	/**
2678
+	 * Filter widget's "animationSpeed" value.
2679
+	 *
2680
+	 * @since 1.0.0
2681
+	 * @param int $instance['animationSpeed'] Set the speed of animations, in milliseconds.
2682
+	 */
2683
+	$animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
2684
+	/**
2685
+	 * Filter widget's "animation" value.
2686
+	 *
2687
+	 * @since 1.0.0
2688
+	 * @param string $instance['animation'] Controls the animation type, "fade" or "slide".
2689
+	 */
2690
+	$animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
2691
+	/**
2692
+	 * Filter widget's "list_sort" type.
2693
+	 *
2694
+	 * @since 1.0.0
2695
+	 * @param string $instance['list_sort'] Listing sort by type.
2696
+	 */
2697
+	$list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
2698
+	$show_featured_only = !empty($instance['show_featured_only']) ? 1 : NULL;
2699
+
2700
+	wp_enqueue_script('geodirectory-jquery-flexslider-js');
2701
+	?>
2702 2702
     <script type="text/javascript">
2703 2703
         jQuery(window).load(function () {
2704 2704
             jQuery('#geodir_widget_carousel').flexslider({
@@ -2739,86 +2739,86 @@  discard block
 block discarded – undo
2739 2739
         });
2740 2740
     </script>
2741 2741
     <?php
2742
-    $query_args = array(
2743
-        'posts_per_page' => $post_number,
2744
-        'is_geodir_loop' => true,
2745
-        'post_type' => $post_type,
2746
-        'order_by' => $list_sort
2747
-    );
2748
-    if ($show_featured_only) {
2749
-        $query_args['show_featured_only'] = 1;
2750
-    }
2751
-
2752
-    if ($category != 0 || $category != '') {
2753
-        $category_taxonomy = geodir_get_taxonomies($post_type);
2754
-        $tax_query = array(
2755
-            'taxonomy' => $category_taxonomy[0],
2756
-            'field' => 'id',
2757
-            'terms' => $category
2758
-        );
2759
-
2760
-        $query_args['tax_query'] = array($tax_query);
2761
-    }
2762
-
2763
-    // we want listings with featured image only
2764
-    $query_args['featured_image_only'] = 1;
2765
-
2766
-    if ($post_type == 'gd_event') {
2767
-        $query_args['gedir_event_listing_filter'] = 'upcoming';
2768
-    }// show only upcomming events
2769
-
2770
-    $widget_listings = geodir_get_widget_listings($query_args);
2771
-    if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
2772
-        if ($title) {
2773
-            echo $before_title . $title . $after_title;
2774
-        }
2775
-
2776
-        global $post;
2777
-
2778
-        $current_post = $post;// keep current post info
2779
-
2780
-        $widget_main_slides = '';
2781
-        $nav_slides = '';
2782
-        $widget_slides = 0;
2783
-
2784
-        foreach ($widget_listings as $widget_listing) {
2785
-            global $gd_widget_listing_type;
2786
-            $post = $widget_listing;
2787
-            $widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
2788
-
2789
-            if (!empty($widget_image)) {
2790
-                if ($widget_image->height >= 200) {
2791
-                    $widget_spacer_height = 0;
2792
-                } else {
2793
-                    $widget_spacer_height = ((200 - $widget_image->height) / 2);
2794
-                }
2795
-
2796
-                $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" />';
2797
-
2798
-                $title = '';
2799
-                if ($show_title) {
2800
-                    $title_html = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>';
2801
-                    $post_id = $post->ID;
2802
-                    $post_permalink = get_permalink($post->ID);
2803
-                    $post_title = get_the_title($post->ID);
2804
-                    /**
2805
-                     * Filter the listing slider widget title.
2806
-                     *
2807
-                     * @since 1.6.1
2808
-                     * @param string $title_html The html output of the title.
2809
-                     * @param int $post_id The post id.
2810
-                     * @param string $post_permalink The post permalink url.
2811
-                     * @param string $post_title The post title text.
2812
-                     */
2813
-                    $title = apply_filters('geodir_listing_slider_title',$title_html,$post_id,$post_permalink,$post_title);
2814
-                }
2815
-
2816
-                $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>';
2817
-                $nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
2818
-                $widget_slides++;
2819
-            }
2820
-        }
2821
-        ?>
2742
+	$query_args = array(
2743
+		'posts_per_page' => $post_number,
2744
+		'is_geodir_loop' => true,
2745
+		'post_type' => $post_type,
2746
+		'order_by' => $list_sort
2747
+	);
2748
+	if ($show_featured_only) {
2749
+		$query_args['show_featured_only'] = 1;
2750
+	}
2751
+
2752
+	if ($category != 0 || $category != '') {
2753
+		$category_taxonomy = geodir_get_taxonomies($post_type);
2754
+		$tax_query = array(
2755
+			'taxonomy' => $category_taxonomy[0],
2756
+			'field' => 'id',
2757
+			'terms' => $category
2758
+		);
2759
+
2760
+		$query_args['tax_query'] = array($tax_query);
2761
+	}
2762
+
2763
+	// we want listings with featured image only
2764
+	$query_args['featured_image_only'] = 1;
2765
+
2766
+	if ($post_type == 'gd_event') {
2767
+		$query_args['gedir_event_listing_filter'] = 'upcoming';
2768
+	}// show only upcomming events
2769
+
2770
+	$widget_listings = geodir_get_widget_listings($query_args);
2771
+	if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
2772
+		if ($title) {
2773
+			echo $before_title . $title . $after_title;
2774
+		}
2775
+
2776
+		global $post;
2777
+
2778
+		$current_post = $post;// keep current post info
2779
+
2780
+		$widget_main_slides = '';
2781
+		$nav_slides = '';
2782
+		$widget_slides = 0;
2783
+
2784
+		foreach ($widget_listings as $widget_listing) {
2785
+			global $gd_widget_listing_type;
2786
+			$post = $widget_listing;
2787
+			$widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
2788
+
2789
+			if (!empty($widget_image)) {
2790
+				if ($widget_image->height >= 200) {
2791
+					$widget_spacer_height = 0;
2792
+				} else {
2793
+					$widget_spacer_height = ((200 - $widget_image->height) / 2);
2794
+				}
2795
+
2796
+				$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" />';
2797
+
2798
+				$title = '';
2799
+				if ($show_title) {
2800
+					$title_html = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>';
2801
+					$post_id = $post->ID;
2802
+					$post_permalink = get_permalink($post->ID);
2803
+					$post_title = get_the_title($post->ID);
2804
+					/**
2805
+					 * Filter the listing slider widget title.
2806
+					 *
2807
+					 * @since 1.6.1
2808
+					 * @param string $title_html The html output of the title.
2809
+					 * @param int $post_id The post id.
2810
+					 * @param string $post_permalink The post permalink url.
2811
+					 * @param string $post_title The post title text.
2812
+					 */
2813
+					$title = apply_filters('geodir_listing_slider_title',$title_html,$post_id,$post_permalink,$post_title);
2814
+				}
2815
+
2816
+				$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>';
2817
+				$nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
2818
+				$widget_slides++;
2819
+			}
2820
+		}
2821
+		?>
2822 2822
         <div class="flex-container" style="min-height:200px;">
2823 2823
             <div class="geodir-listing-flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
2824 2824
             <div id="geodir_widget_slider" class="geodir_flexslider">
@@ -2831,10 +2831,10 @@  discard block
 block discarded – undo
2831 2831
             <?php } ?>
2832 2832
         </div>
2833 2833
         <?php
2834
-        $GLOBALS['post'] = $current_post;
2835
-        setup_postdata($current_post);
2836
-    }
2837
-    echo $after_widget;
2834
+		$GLOBALS['post'] = $current_post;
2835
+		setup_postdata($current_post);
2836
+	}
2837
+	echo $after_widget;
2838 2838
 }
2839 2839
 
2840 2840
 
@@ -2849,65 +2849,65 @@  discard block
 block discarded – undo
2849 2849
  */
2850 2850
 function geodir_loginwidget_output($args = '', $instance = '')
2851 2851
 {
2852
-    //print_r($args);
2853
-    //print_r($instance);
2854
-    // prints the widget
2855
-    extract($args, EXTR_SKIP);
2852
+	//print_r($args);
2853
+	//print_r($instance);
2854
+	// prints the widget
2855
+	extract($args, EXTR_SKIP);
2856 2856
 
2857
-    /** This filter is documented in geodirectory_widgets.php */
2858
-    $title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2857
+	/** This filter is documented in geodirectory_widgets.php */
2858
+	$title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2859 2859
 
2860
-    echo $before_widget;
2861
-    echo $before_title . $title . $after_title;
2860
+	echo $before_widget;
2861
+	echo $before_title . $title . $after_title;
2862 2862
 
2863
-    if (is_user_logged_in()) {
2864
-        global $current_user;
2863
+	if (is_user_logged_in()) {
2864
+		global $current_user;
2865 2865
 
2866
-        $author_link = get_author_posts_url($current_user->data->ID);
2867
-        $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
2866
+		$author_link = get_author_posts_url($current_user->data->ID);
2867
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
2868 2868
 
2869
-        echo '<ul class="geodir-loginbox-list">';
2870
-        ob_start();
2871
-        ?>
2869
+		echo '<ul class="geodir-loginbox-list">';
2870
+		ob_start();
2871
+		?>
2872 2872
         <li><a class="signin"
2873 2873
                href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li>
2874 2874
         <?php
2875
-        $post_types = geodir_get_posttypes('object');
2876
-        $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
2877
-        $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2875
+		$post_types = geodir_get_posttypes('object');
2876
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
2877
+		$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2878 2878
 
2879
-        if (!empty($show_add_listing_post_types_main_nav)) {
2880
-            $addlisting_links = '';
2881
-            foreach ($post_types as $key => $postobj) {
2879
+		if (!empty($show_add_listing_post_types_main_nav)) {
2880
+			$addlisting_links = '';
2881
+			foreach ($post_types as $key => $postobj) {
2882 2882
 
2883
-                if (in_array($key, $show_add_listing_post_types_main_nav)) {
2883
+				if (in_array($key, $show_add_listing_post_types_main_nav)) {
2884 2884
 
2885
-                    if ($add_link = geodir_get_addlisting_link($key)) {
2885
+					if ($add_link = geodir_get_addlisting_link($key)) {
2886 2886
 
2887
-                        $name = $postobj->labels->name;
2887
+						$name = $postobj->labels->name;
2888 2888
 
2889
-                        $selected = '';
2890
-                        if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing'))
2891
-                            $selected = 'selected="selected"';
2889
+						$selected = '';
2890
+						if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing'))
2891
+							$selected = 'selected="selected"';
2892 2892
 
2893
-                        /**
2894
-                         * Filter add listing link.
2895
-                         *
2896
-                         * @since 1.0.0
2897
-                         * @param string $add_link Add listing link.
2898
-                         * @param string $key Add listing array key.
2899
-                         * @param int $current_user->ID Current user ID.
2900
-                         */
2901
-                        $add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
2893
+						/**
2894
+						 * Filter add listing link.
2895
+						 *
2896
+						 * @since 1.0.0
2897
+						 * @param string $add_link Add listing link.
2898
+						 * @param string $key Add listing array key.
2899
+						 * @param int $current_user->ID Current user ID.
2900
+						 */
2901
+						$add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
2902 2902
 
2903
-                        $addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2903
+						$addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2904 2904
 
2905
-                    }
2906
-                }
2905
+					}
2906
+				}
2907 2907
 
2908
-            }
2908
+			}
2909 2909
 
2910
-            if ($addlisting_links != '') { ?>
2910
+			if ($addlisting_links != '') { ?>
2911 2911
 
2912 2912
                 <li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value"
2913 2913
                             option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false"
@@ -2916,42 +2916,42 @@  discard block
 block discarded – undo
2916 2916
                         <?php echo $addlisting_links; ?>
2917 2917
                     </select></li> <?php
2918 2918
 
2919
-            }
2920
-
2921
-        }
2922
-        // My Favourites in Dashboard
2923
-        $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
2924
-        $user_favourite = geodir_user_favourite_listing_count();
2925
-
2926
-        if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
2927
-            $favourite_links = '';
2928
-
2929
-            foreach ($post_types as $key => $postobj) {
2930
-                if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
2931
-                    $name = $postobj->labels->name;
2932
-                    $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
2933
-
2934
-                    $selected = '';
2935
-
2936
-                    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
2937
-                        $selected = 'selected="selected"';
2938
-                    }
2939
-                    /**
2940
-                     * Filter favorite listing link.
2941
-                     *
2942
-                     * @since 1.0.0
2943
-                     * @param string $post_type_link Favorite listing link.
2944
-                     * @param string $key Favorite listing array key.
2945
-                     * @param int $current_user->ID Current user ID.
2946
-                     */
2947
-                    $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
2948
-
2949
-                    $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2950
-                }
2951
-            }
2952
-
2953
-            if ($favourite_links != '') {
2954
-                ?>
2919
+			}
2920
+
2921
+		}
2922
+		// My Favourites in Dashboard
2923
+		$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
2924
+		$user_favourite = geodir_user_favourite_listing_count();
2925
+
2926
+		if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
2927
+			$favourite_links = '';
2928
+
2929
+			foreach ($post_types as $key => $postobj) {
2930
+				if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
2931
+					$name = $postobj->labels->name;
2932
+					$post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
2933
+
2934
+					$selected = '';
2935
+
2936
+					if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
2937
+						$selected = 'selected="selected"';
2938
+					}
2939
+					/**
2940
+					 * Filter favorite listing link.
2941
+					 *
2942
+					 * @since 1.0.0
2943
+					 * @param string $post_type_link Favorite listing link.
2944
+					 * @param string $key Favorite listing array key.
2945
+					 * @param int $current_user->ID Current user ID.
2946
+					 */
2947
+					$post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
2948
+
2949
+					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2950
+				}
2951
+			}
2952
+
2953
+			if ($favourite_links != '') {
2954
+				?>
2955 2955
                 <li>
2956 2956
                     <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
2957 2957
                             option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false"
@@ -2961,42 +2961,42 @@  discard block
 block discarded – undo
2961 2961
                     </select>
2962 2962
                 </li>
2963 2963
             <?php
2964
-            }
2965
-        }
2966
-
2967
-
2968
-        $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
2969
-        $user_listing = geodir_user_post_listing_count();
2970
-
2971
-        if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
2972
-            $listing_links = '';
2973
-
2974
-            foreach ($post_types as $key => $postobj) {
2975
-                if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
2976
-                    $name = $postobj->labels->name;
2977
-                    $listing_link = geodir_getlink($author_link, array('stype' => $key), false);
2978
-
2979
-                    $selected = '';
2980
-                    if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
2981
-                        $selected = 'selected="selected"';
2982
-                    }
2983
-
2984
-                    /**
2985
-                     * Filter my listing link.
2986
-                     *
2987
-                     * @since 1.0.0
2988
-                     * @param string $listing_link My listing link.
2989
-                     * @param string $key My listing array key.
2990
-                     * @param int $current_user->ID Current user ID.
2991
-                     */
2992
-                    $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
2993
-
2994
-                    $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2995
-                }
2996
-            }
2997
-
2998
-            if ($listing_links != '') {
2999
-                ?>
2964
+			}
2965
+		}
2966
+
2967
+
2968
+		$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
2969
+		$user_listing = geodir_user_post_listing_count();
2970
+
2971
+		if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
2972
+			$listing_links = '';
2973
+
2974
+			foreach ($post_types as $key => $postobj) {
2975
+				if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
2976
+					$name = $postobj->labels->name;
2977
+					$listing_link = geodir_getlink($author_link, array('stype' => $key), false);
2978
+
2979
+					$selected = '';
2980
+					if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
2981
+						$selected = 'selected="selected"';
2982
+					}
2983
+
2984
+					/**
2985
+					 * Filter my listing link.
2986
+					 *
2987
+					 * @since 1.0.0
2988
+					 * @param string $listing_link My listing link.
2989
+					 * @param string $key My listing array key.
2990
+					 * @param int $current_user->ID Current user ID.
2991
+					 */
2992
+					$listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
2993
+
2994
+					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2995
+				}
2996
+			}
2997
+
2998
+			if ($listing_links != '') {
2999
+				?>
3000 3000
                 <li>
3001 3001
                     <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
3002 3002
                             option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false"
@@ -3006,27 +3006,27 @@  discard block
 block discarded – undo
3006 3006
                     </select>
3007 3007
                 </li>
3008 3008
             <?php
3009
-            }
3010
-        }
3011
-
3012
-        $dashboard_link = ob_get_clean();
3013
-        /**
3014
-         * Filter dashboard links HTML.
3015
-         *
3016
-         * @since 1.0.0
3017
-         * @param string $dashboard_link Dashboard links HTML.
3018
-         */
3019
-        echo apply_filters('geodir_dashboard_links', $dashboard_link);
3020
-        echo '</ul>';
3021
-    } else {
3022
-        ?>
3009
+			}
3010
+		}
3011
+
3012
+		$dashboard_link = ob_get_clean();
3013
+		/**
3014
+		 * Filter dashboard links HTML.
3015
+		 *
3016
+		 * @since 1.0.0
3017
+		 * @param string $dashboard_link Dashboard links HTML.
3018
+		 */
3019
+		echo apply_filters('geodir_dashboard_links', $dashboard_link);
3020
+		echo '</ul>';
3021
+	} else {
3022
+		?>
3023 3023
         <?php
3024
-        /**
3025
-         * Filter signup form action link.
3026
-         *
3027
-         * @since 1.0.0
3028
-         */
3029
-        ?>
3024
+		/**
3025
+		 * Filter signup form action link.
3026
+		 *
3027
+		 * @since 1.0.0
3028
+		 */
3029
+		?>
3030 3030
         <form name="loginform" class="loginform1"
3031 3031
               action="<?php echo geodir_login_url(); ?>"
3032 3032
               method="post">
@@ -3046,28 +3046,28 @@  discard block
 block discarded – undo
3046 3046
 
3047 3047
                 <p class="geodir-new-forgot-link">
3048 3048
                     <?php
3049
-                    /**
3050
-                     * Filter signup page register form link.
3051
-                     *
3052
-                     * @since 1.0.0
3053
-                     */
3054
-                    ?>
3049
+					/**
3050
+					 * Filter signup page register form link.
3051
+					 *
3052
+					 * @since 1.0.0
3053
+					 */
3054
+					?>
3055 3055
                     <a href="<?php echo geodir_login_url(array('signup' => true)); ?>"
3056 3056
                        class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a>
3057 3057
 
3058 3058
                     <?php
3059
-                    /**
3060
-                     * Filter signup page forgot password form link.
3061
-                     *
3062
-                     * @since 1.0.0
3063
-                     */
3064
-                    ?>
3059
+					/**
3060
+					 * Filter signup page forgot password form link.
3061
+					 *
3062
+					 * @since 1.0.0
3063
+					 */
3064
+					?>
3065 3065
                     <a href="<?php echo geodir_login_url(array('forgot' => true)); ?>"
3066 3066
                        class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div>
3067 3067
         </form>
3068 3068
     <?php }
3069 3069
 
3070
-    echo $after_widget;
3070
+	echo $after_widget;
3071 3071
 }
3072 3072
 
3073 3073
 
@@ -3086,284 +3086,284 @@  discard block
 block discarded – undo
3086 3086
  * @param array|string $instance The settings for the particular instance of the widget.
3087 3087
  */
3088 3088
 function geodir_popular_postview_output($args = '', $instance = '') {
3089
-    global $gd_session;
3089
+	global $gd_session;
3090 3090
 	
3091
-    // prints the widget
3092
-    extract($args, EXTR_SKIP);
3093
-
3094
-    echo $before_widget;
3095
-
3096
-    /** This filter is documented in geodirectory_widgets.php */
3097
-    $title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
3098
-    /**
3099
-     * Filter the widget post type.
3100
-     *
3101
-     * @since 1.0.0
3102
-     * @param string $instance['post_type'] Post type of listing.
3103
-     */
3104
-    $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
3105
-    /**
3106
-     * Filter the widget's term.
3107
-     *
3108
-     * @since 1.0.0
3109
-     * @param string $instance['category'] Filter by term. Can be any valid term.
3110
-     */
3111
-    $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3112
-    /**
3113
-     * Filter the widget listings limit.
3114
-     *
3115
-     * @since 1.0.0
3116
-     * @param string $instance['post_number'] Number of listings to display.
3117
-     */
3118
-    $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3119
-    /**
3120
-     * Filter widget's "layout" type.
3121
-     *
3122
-     * @since 1.0.0
3123
-     * @param string $instance['layout'] Widget layout type.
3124
-     */
3125
-    $layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
3126
-    /**
3127
-     * Filter widget's "add_location_filter" value.
3128
-     *
3129
-     * @since 1.0.0
3130
-     * @param string|bool $instance['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3131
-     */
3132
-    $add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3133
-    /**
3134
-     * Filter widget's listing width.
3135
-     *
3136
-     * @since 1.0.0
3137
-     * @param string $instance['listing_width'] Listing width.
3138
-     */
3139
-    $listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3140
-    /**
3141
-     * Filter widget's "list_sort" type.
3142
-     *
3143
-     * @since 1.0.0
3144
-     * @param string $instance['list_sort'] Listing sort by type.
3145
-     */
3146
-    $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3147
-    $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3148
-
3149
-    // set post type to current viewing post type
3150
-    if ($use_viewing_post_type) {
3151
-        $current_post_type = geodir_get_current_posttype();
3152
-        if ($current_post_type != '' && $current_post_type != $post_type) {
3153
-            $post_type = $current_post_type;
3154
-            $category = array(); // old post type category will not work for current changed post type
3155
-        }
3156
-    }
3157
-    // replace widget title dynamically
3158
-    $posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory');
3159
-    $posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3160
-
3161
-    $title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3162
-    $title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3163
-
3164
-    if (isset($instance['character_count'])) {
3165
-        /**
3166
-         * Filter the widget's excerpt character count.
3167
-         *
3168
-         * @since 1.0.0
3169
-         * @param int $instance['character_count'] Excerpt character count.
3170
-         */
3171
-        $character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3172
-    } else {
3173
-        $character_count = '';
3174
-    }
3175
-
3176
-    if (empty($title) || $title == 'All') {
3177
-        $title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory');
3178
-    }
3179
-
3180
-    $location_url = array();
3181
-    $city = get_query_var('gd_city');
3182
-    if (!empty($city)) {
3183
-        $country = get_query_var('gd_country');
3184
-        $region = get_query_var('gd_region');
3185
-
3186
-        $geodir_show_location_url = get_option('geodir_show_location_url');
3187
-
3188
-        if ($geodir_show_location_url == 'all') {
3189
-            if ($country != '') {
3190
-                $location_url[] = $country;
3191
-            }
3192
-
3193
-            if ($region != '') {
3194
-                $location_url[] = $region;
3195
-            }
3196
-        } else if ($geodir_show_location_url == 'country_city') {
3197
-            if ($country != '') {
3198
-                $location_url[] = $country;
3199
-            }
3200
-        } else if ($geodir_show_location_url == 'region_city') {
3201
-            if ($region != '') {
3202
-                $location_url[] = $region;
3203
-            }
3204
-        }
3205
-
3206
-        $location_url[] = $city;
3207
-    }
3208
-
3209
-    $location_url = implode('/', $location_url);
3210
-    $skip_location = false;
3211
-    if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3212
-        $skip_location = true;
3213
-        $gd_session->un_set('gd_multi_location');
3214
-    }
3215
-
3216
-    if (get_option('permalink_structure')) {
3217
-        $viewall_url = get_post_type_archive_link($post_type);
3218
-    } else {
3219
-        $viewall_url = get_post_type_archive_link($post_type);
3220
-    }
3221
-
3222
-    if (!empty($category) && $category[0] != '0') {
3223
-        global $geodir_add_location_url;
3224
-
3225
-        $geodir_add_location_url = '0';
3226
-
3227
-        if ($add_location_filter != '0') {
3228
-            $geodir_add_location_url = '1';
3229
-        }
3230
-
3231
-        $viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3232
-
3233
-        $geodir_add_location_url = NULL;
3234
-    }
3235
-    if ($skip_location) {
3236
-        $gd_session->set('gd_multi_location', 1);
3237
-    }
3238
-
3239
-    if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3240
-
3241
-    $query_args = array(
3242
-        'posts_per_page' => $post_number,
3243
-        'is_geodir_loop' => true,
3244
-        'gd_location' => $add_location_filter ? true : false,
3245
-        'post_type' => $post_type,
3246
-        'order_by' => $list_sort
3247
-    );
3248
-
3249
-    if ($character_count) {
3250
-        $query_args['excerpt_length'] = $character_count;
3251
-    }
3252
-
3253
-    if (!empty($instance['show_featured_only'])) {
3254
-        $query_args['show_featured_only'] = 1;
3255
-    }
3256
-
3257
-    if (!empty($instance['show_special_only'])) {
3258
-        $query_args['show_special_only'] = 1;
3259
-    }
3260
-
3261
-    if (!empty($instance['with_pics_only'])) {
3262
-        $query_args['with_pics_only'] = 0;
3263
-        $query_args['featured_image_only'] = 1;
3264
-    }
3265
-
3266
-    if (!empty($instance['with_videos_only'])) {
3267
-        $query_args['with_videos_only'] = 1;
3268
-    }
3269
-    $with_no_results = !empty($instance['without_no_results']) ? false : true;
3270
-
3271
-    if (!empty($category) && $category[0] != '0') {
3272
-        $category_taxonomy = geodir_get_taxonomies($post_type);
3273
-
3274
-        ######### WPML #########
3275
-        if (function_exists('icl_object_id')) {
3276
-            $category = gd_lang_object_ids($category, $category_taxonomy[0]);
3277
-        }
3278
-        ######### WPML #########
3279
-
3280
-        $tax_query = array(
3281
-            'taxonomy' => $category_taxonomy[0],
3282
-            'field' => 'id',
3283
-            'terms' => $category
3284
-        );
3285
-
3286
-        $query_args['tax_query'] = array($tax_query);
3287
-    }
3288
-
3289
-    global $gridview_columns_widget, $geodir_is_widget_listing;
3290
-
3291
-    $widget_listings = geodir_get_widget_listings($query_args);
3292
-
3293
-    if (!empty($widget_listings) || $with_no_results) {
3294
-        ?>
3091
+	// prints the widget
3092
+	extract($args, EXTR_SKIP);
3093
+
3094
+	echo $before_widget;
3095
+
3096
+	/** This filter is documented in geodirectory_widgets.php */
3097
+	$title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
3098
+	/**
3099
+	 * Filter the widget post type.
3100
+	 *
3101
+	 * @since 1.0.0
3102
+	 * @param string $instance['post_type'] Post type of listing.
3103
+	 */
3104
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
3105
+	/**
3106
+	 * Filter the widget's term.
3107
+	 *
3108
+	 * @since 1.0.0
3109
+	 * @param string $instance['category'] Filter by term. Can be any valid term.
3110
+	 */
3111
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3112
+	/**
3113
+	 * Filter the widget listings limit.
3114
+	 *
3115
+	 * @since 1.0.0
3116
+	 * @param string $instance['post_number'] Number of listings to display.
3117
+	 */
3118
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3119
+	/**
3120
+	 * Filter widget's "layout" type.
3121
+	 *
3122
+	 * @since 1.0.0
3123
+	 * @param string $instance['layout'] Widget layout type.
3124
+	 */
3125
+	$layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
3126
+	/**
3127
+	 * Filter widget's "add_location_filter" value.
3128
+	 *
3129
+	 * @since 1.0.0
3130
+	 * @param string|bool $instance['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3131
+	 */
3132
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3133
+	/**
3134
+	 * Filter widget's listing width.
3135
+	 *
3136
+	 * @since 1.0.0
3137
+	 * @param string $instance['listing_width'] Listing width.
3138
+	 */
3139
+	$listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3140
+	/**
3141
+	 * Filter widget's "list_sort" type.
3142
+	 *
3143
+	 * @since 1.0.0
3144
+	 * @param string $instance['list_sort'] Listing sort by type.
3145
+	 */
3146
+	$list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3147
+	$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3148
+
3149
+	// set post type to current viewing post type
3150
+	if ($use_viewing_post_type) {
3151
+		$current_post_type = geodir_get_current_posttype();
3152
+		if ($current_post_type != '' && $current_post_type != $post_type) {
3153
+			$post_type = $current_post_type;
3154
+			$category = array(); // old post type category will not work for current changed post type
3155
+		}
3156
+	}
3157
+	// replace widget title dynamically
3158
+	$posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory');
3159
+	$posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3160
+
3161
+	$title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3162
+	$title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3163
+
3164
+	if (isset($instance['character_count'])) {
3165
+		/**
3166
+		 * Filter the widget's excerpt character count.
3167
+		 *
3168
+		 * @since 1.0.0
3169
+		 * @param int $instance['character_count'] Excerpt character count.
3170
+		 */
3171
+		$character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3172
+	} else {
3173
+		$character_count = '';
3174
+	}
3175
+
3176
+	if (empty($title) || $title == 'All') {
3177
+		$title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory');
3178
+	}
3179
+
3180
+	$location_url = array();
3181
+	$city = get_query_var('gd_city');
3182
+	if (!empty($city)) {
3183
+		$country = get_query_var('gd_country');
3184
+		$region = get_query_var('gd_region');
3185
+
3186
+		$geodir_show_location_url = get_option('geodir_show_location_url');
3187
+
3188
+		if ($geodir_show_location_url == 'all') {
3189
+			if ($country != '') {
3190
+				$location_url[] = $country;
3191
+			}
3192
+
3193
+			if ($region != '') {
3194
+				$location_url[] = $region;
3195
+			}
3196
+		} else if ($geodir_show_location_url == 'country_city') {
3197
+			if ($country != '') {
3198
+				$location_url[] = $country;
3199
+			}
3200
+		} else if ($geodir_show_location_url == 'region_city') {
3201
+			if ($region != '') {
3202
+				$location_url[] = $region;
3203
+			}
3204
+		}
3205
+
3206
+		$location_url[] = $city;
3207
+	}
3208
+
3209
+	$location_url = implode('/', $location_url);
3210
+	$skip_location = false;
3211
+	if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3212
+		$skip_location = true;
3213
+		$gd_session->un_set('gd_multi_location');
3214
+	}
3215
+
3216
+	if (get_option('permalink_structure')) {
3217
+		$viewall_url = get_post_type_archive_link($post_type);
3218
+	} else {
3219
+		$viewall_url = get_post_type_archive_link($post_type);
3220
+	}
3221
+
3222
+	if (!empty($category) && $category[0] != '0') {
3223
+		global $geodir_add_location_url;
3224
+
3225
+		$geodir_add_location_url = '0';
3226
+
3227
+		if ($add_location_filter != '0') {
3228
+			$geodir_add_location_url = '1';
3229
+		}
3230
+
3231
+		$viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3232
+
3233
+		$geodir_add_location_url = NULL;
3234
+	}
3235
+	if ($skip_location) {
3236
+		$gd_session->set('gd_multi_location', 1);
3237
+	}
3238
+
3239
+	if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3240
+
3241
+	$query_args = array(
3242
+		'posts_per_page' => $post_number,
3243
+		'is_geodir_loop' => true,
3244
+		'gd_location' => $add_location_filter ? true : false,
3245
+		'post_type' => $post_type,
3246
+		'order_by' => $list_sort
3247
+	);
3248
+
3249
+	if ($character_count) {
3250
+		$query_args['excerpt_length'] = $character_count;
3251
+	}
3252
+
3253
+	if (!empty($instance['show_featured_only'])) {
3254
+		$query_args['show_featured_only'] = 1;
3255
+	}
3256
+
3257
+	if (!empty($instance['show_special_only'])) {
3258
+		$query_args['show_special_only'] = 1;
3259
+	}
3260
+
3261
+	if (!empty($instance['with_pics_only'])) {
3262
+		$query_args['with_pics_only'] = 0;
3263
+		$query_args['featured_image_only'] = 1;
3264
+	}
3265
+
3266
+	if (!empty($instance['with_videos_only'])) {
3267
+		$query_args['with_videos_only'] = 1;
3268
+	}
3269
+	$with_no_results = !empty($instance['without_no_results']) ? false : true;
3270
+
3271
+	if (!empty($category) && $category[0] != '0') {
3272
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3273
+
3274
+		######### WPML #########
3275
+		if (function_exists('icl_object_id')) {
3276
+			$category = gd_lang_object_ids($category, $category_taxonomy[0]);
3277
+		}
3278
+		######### WPML #########
3279
+
3280
+		$tax_query = array(
3281
+			'taxonomy' => $category_taxonomy[0],
3282
+			'field' => 'id',
3283
+			'terms' => $category
3284
+		);
3285
+
3286
+		$query_args['tax_query'] = array($tax_query);
3287
+	}
3288
+
3289
+	global $gridview_columns_widget, $geodir_is_widget_listing;
3290
+
3291
+	$widget_listings = geodir_get_widget_listings($query_args);
3292
+
3293
+	if (!empty($widget_listings) || $with_no_results) {
3294
+		?>
3295 3295
         <div class="geodir_locations geodir_location_listing">
3296 3296
 
3297 3297
             <?php
3298
-            /**
3299
-             * Called before the div containing the title and view all link in popular post view widget.
3300
-             *
3301
-             * @since 1.0.0
3302
-             */
3303
-            do_action('geodir_before_view_all_link_in_widget'); ?>
3298
+			/**
3299
+			 * Called before the div containing the title and view all link in popular post view widget.
3300
+			 *
3301
+			 * @since 1.0.0
3302
+			 */
3303
+			do_action('geodir_before_view_all_link_in_widget'); ?>
3304 3304
             <div class="geodir_list_heading clearfix">
3305 3305
                 <?php echo $before_title . $title . $after_title; ?>
3306 3306
                 <a href="<?php echo $viewall_url; ?>"
3307 3307
                    class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3308 3308
             </div>
3309 3309
             <?php
3310
-            /**
3311
-             * Called after the div containing the title and view all link in popular post view widget.
3312
-             *
3313
-             * @since 1.0.0
3314
-             */
3315
-            do_action('geodir_after_view_all_link_in_widget'); ?>
3310
+			/**
3311
+			 * Called after the div containing the title and view all link in popular post view widget.
3312
+			 *
3313
+			 * @since 1.0.0
3314
+			 */
3315
+			do_action('geodir_after_view_all_link_in_widget'); ?>
3316 3316
             <?php
3317
-            if (strstr($layout, 'gridview')) {
3318
-                $listing_view_exp = explode('_', $layout);
3319
-                $gridview_columns_widget = $layout;
3320
-                $layout = $listing_view_exp[0];
3321
-            } else {
3322
-                $gridview_columns_widget = '';
3323
-            }
3324
-
3325
-            /**
3326
-             * Filter the widget listing listview template path.
3327
-             *
3328
-             * @since 1.0.0
3329
-             */
3330
-            $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3331
-            if (!isset($character_count)) {
3332
-                /**
3333
-                 * Filter the widget's excerpt character count.
3334
-                 *
3335
-                 * @since 1.0.0
3336
-                 * @param int $instance['character_count'] Excerpt character count.
3337
-                 */
3338
-                $character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3339
-            }
3340
-
3341
-            global $post, $map_jason, $map_canvas_arr;
3342
-
3343
-            $current_post = $post;
3344
-            $current_map_jason = $map_jason;
3345
-            $current_map_canvas_arr = $map_canvas_arr;
3346
-            $geodir_is_widget_listing = true;
3347
-
3348
-            /**
3349
-             * Includes related listing listview template.
3350
-             *
3351
-             * @since 1.0.0
3352
-             */
3353
-            include($template);
3354
-
3355
-            $geodir_is_widget_listing = false;
3356
-
3357
-            $GLOBALS['post'] = $current_post;
3358
-            if (!empty($current_post))
3359
-                setup_postdata($current_post);
3360
-            $map_jason = $current_map_jason;
3361
-            $map_canvas_arr = $current_map_canvas_arr;
3362
-            ?>
3317
+			if (strstr($layout, 'gridview')) {
3318
+				$listing_view_exp = explode('_', $layout);
3319
+				$gridview_columns_widget = $layout;
3320
+				$layout = $listing_view_exp[0];
3321
+			} else {
3322
+				$gridview_columns_widget = '';
3323
+			}
3324
+
3325
+			/**
3326
+			 * Filter the widget listing listview template path.
3327
+			 *
3328
+			 * @since 1.0.0
3329
+			 */
3330
+			$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3331
+			if (!isset($character_count)) {
3332
+				/**
3333
+				 * Filter the widget's excerpt character count.
3334
+				 *
3335
+				 * @since 1.0.0
3336
+				 * @param int $instance['character_count'] Excerpt character count.
3337
+				 */
3338
+				$character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3339
+			}
3340
+
3341
+			global $post, $map_jason, $map_canvas_arr;
3342
+
3343
+			$current_post = $post;
3344
+			$current_map_jason = $map_jason;
3345
+			$current_map_canvas_arr = $map_canvas_arr;
3346
+			$geodir_is_widget_listing = true;
3347
+
3348
+			/**
3349
+			 * Includes related listing listview template.
3350
+			 *
3351
+			 * @since 1.0.0
3352
+			 */
3353
+			include($template);
3354
+
3355
+			$geodir_is_widget_listing = false;
3356
+
3357
+			$GLOBALS['post'] = $current_post;
3358
+			if (!empty($current_post))
3359
+				setup_postdata($current_post);
3360
+			$map_jason = $current_map_jason;
3361
+			$map_canvas_arr = $current_map_canvas_arr;
3362
+			?>
3363 3363
         </div>
3364 3364
     <?php
3365
-    }
3366
-    echo $after_widget;
3365
+	}
3366
+	echo $after_widget;
3367 3367
 
3368 3368
 }
3369 3369
 
@@ -3386,26 +3386,26 @@  discard block
 block discarded – undo
3386 3386
  */
3387 3387
 function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type)
3388 3388
 {
3389
-    global $wpdb, $plugin_prefix;
3389
+	global $wpdb, $plugin_prefix;
3390 3390
 
3391
-    $detail_table = $plugin_prefix . $post_type . '_detail';
3391
+	$detail_table = $plugin_prefix . $post_type . '_detail';
3392 3392
 
3393
-    $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 . ")";
3393
+	$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 . ")";
3394 3394
 
3395
-    /**
3396
-     * Filter count review sql query.
3397
-     *
3398
-     * @since 1.5.1
3399
-     * @param string $sql Database sql query..
3400
-     * @param int $term_id The term ID.
3401
-     * @param int $taxonomy The taxonomy Id.
3402
-     * @param string $post_type The post type.
3403
-     */
3404
-    $sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3395
+	/**
3396
+	 * Filter count review sql query.
3397
+	 *
3398
+	 * @since 1.5.1
3399
+	 * @param string $sql Database sql query..
3400
+	 * @param int $term_id The term ID.
3401
+	 * @param int $taxonomy The taxonomy Id.
3402
+	 * @param string $post_type The post type.
3403
+	 */
3404
+	$sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3405 3405
 
3406
-    $count = $wpdb->get_var($sql);
3406
+	$count = $wpdb->get_var($sql);
3407 3407
 
3408
-    return $count;
3408
+	return $count;
3409 3409
 }
3410 3410
 
3411 3411
 /**
@@ -3421,90 +3421,90 @@  discard block
 block discarded – undo
3421 3421
  * @return array Term array data.
3422 3422
  */
3423 3423
 function geodir_count_reviews_by_terms($force_update = false, $post_ID = 0) {
3424
-    /**
3425
-     * Filter review count option data.
3426
-     *
3427
-     * @since 1.0.0
3428
-     * @since 1.6.1 Added $post_ID param.
3429
-     * @param bool $force_update Force update option value?. Default.false.
3430
-     * @param int $post_ID The post id to update if any.
3431
-     */
3432
-    $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update,$post_ID);
3433
-    if (!empty($option_data)) {
3434
-        return $option_data;
3435
-    }
3436
-
3437
-    $option_data = get_option('geodir_global_review_count');
3438
-
3439
-    if (!$option_data || $force_update) {
3440
-        if ((int)$post_ID > 0) { // Update reviews count for specific post categories only.
3441
-            global $gd_session;
3442
-            $term_array = (array)$option_data;
3443
-            $post_type = get_post_type($post_ID);
3444
-            $taxonomy = $post_type . 'category';
3445
-            $terms = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3446
-
3447
-            if (!empty($terms) && !is_wp_error($terms)) {
3448
-                foreach ($terms as $term_id) {
3449
-                    $count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3450
-                    $children = get_term_children($term_id, $taxonomy);
3451
-                    $term_array[$term_id] = $count;
3452
-                }
3453
-            }
3424
+	/**
3425
+	 * Filter review count option data.
3426
+	 *
3427
+	 * @since 1.0.0
3428
+	 * @since 1.6.1 Added $post_ID param.
3429
+	 * @param bool $force_update Force update option value?. Default.false.
3430
+	 * @param int $post_ID The post id to update if any.
3431
+	 */
3432
+	$option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update,$post_ID);
3433
+	if (!empty($option_data)) {
3434
+		return $option_data;
3435
+	}
3436
+
3437
+	$option_data = get_option('geodir_global_review_count');
3438
+
3439
+	if (!$option_data || $force_update) {
3440
+		if ((int)$post_ID > 0) { // Update reviews count for specific post categories only.
3441
+			global $gd_session;
3442
+			$term_array = (array)$option_data;
3443
+			$post_type = get_post_type($post_ID);
3444
+			$taxonomy = $post_type . 'category';
3445
+			$terms = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3446
+
3447
+			if (!empty($terms) && !is_wp_error($terms)) {
3448
+				foreach ($terms as $term_id) {
3449
+					$count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3450
+					$children = get_term_children($term_id, $taxonomy);
3451
+					$term_array[$term_id] = $count;
3452
+				}
3453
+			}
3454 3454
             
3455
-            $session_listing = $gd_session->get('listing');
3455
+			$session_listing = $gd_session->get('listing');
3456 3456
             
3457
-            $terms = array();
3458
-            if (isset($_POST['post_category'][$taxonomy])) {
3459
-                $terms = (array)$_POST['post_category'][$taxonomy];
3460
-            } else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
3461
-                $terms = (array)$session_listing['post_category'][$taxonomy];
3462
-            }
3457
+			$terms = array();
3458
+			if (isset($_POST['post_category'][$taxonomy])) {
3459
+				$terms = (array)$_POST['post_category'][$taxonomy];
3460
+			} else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
3461
+				$terms = (array)$session_listing['post_category'][$taxonomy];
3462
+			}
3463 3463
             
3464
-            if (!empty($terms)) {
3465
-                foreach ($terms as $term_id) {
3466
-                    if ($term_id > 0) {
3467
-                        $count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3468
-                        $children = get_term_children($term_id, $taxonomy);
3469
-                        $term_array[$term_id] = $count;
3470
-                    }
3471
-                }
3472
-            }
3473
-        } else { // Update reviews count for all post categories.
3474
-            $term_array = array();
3475
-            $post_types = geodir_get_posttypes();
3476
-            foreach ($post_types as $post_type) {
3477
-
3478
-                $taxonomy = geodir_get_taxonomies($post_type);
3479
-                $taxonomy = $taxonomy[0];
3480
-
3481
-                $args = array(
3482
-                    'hide_empty' => false
3483
-                );
3484
-
3485
-                $terms = get_terms($taxonomy, $args);
3486
-
3487
-                foreach ($terms as $term) {
3488
-                    $count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3489
-                    $children = get_term_children($term->term_id, $taxonomy);
3490
-                    /*if ( is_array( $children ) ) {
3464
+			if (!empty($terms)) {
3465
+				foreach ($terms as $term_id) {
3466
+					if ($term_id > 0) {
3467
+						$count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3468
+						$children = get_term_children($term_id, $taxonomy);
3469
+						$term_array[$term_id] = $count;
3470
+					}
3471
+				}
3472
+			}
3473
+		} else { // Update reviews count for all post categories.
3474
+			$term_array = array();
3475
+			$post_types = geodir_get_posttypes();
3476
+			foreach ($post_types as $post_type) {
3477
+
3478
+				$taxonomy = geodir_get_taxonomies($post_type);
3479
+				$taxonomy = $taxonomy[0];
3480
+
3481
+				$args = array(
3482
+					'hide_empty' => false
3483
+				);
3484
+
3485
+				$terms = get_terms($taxonomy, $args);
3486
+
3487
+				foreach ($terms as $term) {
3488
+					$count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3489
+					$children = get_term_children($term->term_id, $taxonomy);
3490
+					/*if ( is_array( $children ) ) {
3491 3491
                         foreach ( $children as $child_id ) {
3492 3492
                             $child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type);
3493 3493
                             $count = $count + $child_count;
3494 3494
                         }
3495 3495
                     }*/
3496
-                    $term_array[$term->term_id] = $count;
3497
-                }
3498
-            }
3499
-        }
3500
-
3501
-        update_option('geodir_global_review_count', $term_array);
3502
-        //clear cache
3503
-        wp_cache_delete('geodir_global_review_count');
3504
-        return $term_array;
3505
-    } else {
3506
-        return $option_data;
3507
-    }
3496
+					$term_array[$term->term_id] = $count;
3497
+				}
3498
+			}
3499
+		}
3500
+
3501
+		update_option('geodir_global_review_count', $term_array);
3502
+		//clear cache
3503
+		wp_cache_delete('geodir_global_review_count');
3504
+		return $term_array;
3505
+	} else {
3506
+		return $option_data;
3507
+	}
3508 3508
 }
3509 3509
 
3510 3510
 /**
@@ -3516,38 +3516,38 @@  discard block
 block discarded – undo
3516 3516
  * @return bool
3517 3517
  */
3518 3518
 function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '') {
3519
-    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {
3520
-        return; // do not run if importing listings
3521
-    }
3519
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {
3520
+		return; // do not run if importing listings
3521
+	}
3522 3522
     
3523
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
3524
-        return;
3525
-    }
3526
-
3527
-    $post_ID = 0;
3528
-    if (!empty($post)) {
3529
-        if (isset($post->post_type) && strpos($post->post_type, 'gd_') !== 0) {
3530
-            return;
3531
-        }
3523
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
3524
+		return;
3525
+	}
3526
+
3527
+	$post_ID = 0;
3528
+	if (!empty($post)) {
3529
+		if (isset($post->post_type) && strpos($post->post_type, 'gd_') !== 0) {
3530
+			return;
3531
+		}
3532 3532
         
3533
-        if ($new_status == 'auto-draft' && $old_status == 'new') {
3534
-            return;
3535
-        }
3533
+		if ($new_status == 'auto-draft' && $old_status == 'new') {
3534
+			return;
3535
+		}
3536 3536
         
3537
-        if (!empty($post->ID)) {
3538
-            $post_ID = $post->ID;
3539
-        }
3540
-    }
3537
+		if (!empty($post->ID)) {
3538
+			$post_ID = $post->ID;
3539
+		}
3540
+	}
3541 3541
 
3542
-    if ($new_status != $old_status) {
3543
-        geodir_count_reviews_by_terms(true, $post_ID);
3544
-    }
3542
+	if ($new_status != $old_status) {
3543
+		geodir_count_reviews_by_terms(true, $post_ID);
3544
+	}
3545 3545
 
3546
-    return true;
3546
+	return true;
3547 3547
 }
3548 3548
 
3549 3549
 function geodir_term_review_count_force_update_single_post($post_id){
3550
-    geodir_count_reviews_by_terms(true, $post_id); 
3550
+	geodir_count_reviews_by_terms(true, $post_id); 
3551 3551
 }
3552 3552
 
3553 3553
 /*-----------------------------------------------------------------------------------*/
@@ -3565,15 +3565,15 @@  discard block
 block discarded – undo
3565 3565
 function geodir_count_posts_by_term($data, $term)
3566 3566
 {
3567 3567
 
3568
-    if ($data) {
3569
-        if (isset($data[$term->term_id])) {
3570
-            return $data[$term->term_id];
3571
-        } else {
3572
-            return 0;
3573
-        }
3574
-    } else {
3575
-        return $term->count;
3576
-    }
3568
+	if ($data) {
3569
+		if (isset($data[$term->term_id])) {
3570
+			return $data[$term->term_id];
3571
+		} else {
3572
+			return 0;
3573
+		}
3574
+	} else {
3575
+		return $term->count;
3576
+	}
3577 3577
 }
3578 3578
 
3579 3579
 /**
@@ -3586,8 +3586,8 @@  discard block
 block discarded – undo
3586 3586
  */
3587 3587
 function geodir_sort_terms_by_count($terms)
3588 3588
 {
3589
-    usort($terms, "geodir_sort_by_count_obj");
3590
-    return $terms;
3589
+	usort($terms, "geodir_sort_by_count_obj");
3590
+	return $terms;
3591 3591
 }
3592 3592
 
3593 3593
 /**
@@ -3600,8 +3600,8 @@  discard block
 block discarded – undo
3600 3600
  */
3601 3601
 function geodir_sort_terms_by_review_count($terms)
3602 3602
 {
3603
-    usort($terms, "geodir_sort_by_review_count_obj");
3604
-    return $terms;
3603
+	usort($terms, "geodir_sort_by_review_count_obj");
3604
+	return $terms;
3605 3605
 }
3606 3606
 
3607 3607
 /**
@@ -3615,12 +3615,12 @@  discard block
 block discarded – undo
3615 3615
  */
3616 3616
 function geodir_sort_terms($terms, $sort = 'count')
3617 3617
 {
3618
-    if ($sort == 'count') {
3619
-        return geodir_sort_terms_by_count($terms);
3620
-    }
3621
-    if ($sort == 'review_count') {
3622
-        return geodir_sort_terms_by_review_count($terms);
3623
-    }
3618
+	if ($sort == 'count') {
3619
+		return geodir_sort_terms_by_count($terms);
3620
+	}
3621
+	if ($sort == 'review_count') {
3622
+		return geodir_sort_terms_by_review_count($terms);
3623
+	}
3624 3624
 }
3625 3625
 
3626 3626
 /*-----------------------------------------------------------------------------------*/
@@ -3637,7 +3637,7 @@  discard block
 block discarded – undo
3637 3637
  */
3638 3638
 function geodir_sort_by_count($a, $b)
3639 3639
 {
3640
-    return $a['count'] < $b['count'];
3640
+	return $a['count'] < $b['count'];
3641 3641
 }
3642 3642
 
3643 3643
 /**
@@ -3651,7 +3651,7 @@  discard block
 block discarded – undo
3651 3651
  */
3652 3652
 function geodir_sort_by_count_obj($a, $b)
3653 3653
 {
3654
-    return $a->count < $b->count;
3654
+	return $a->count < $b->count;
3655 3655
 }
3656 3656
 
3657 3657
 /**
@@ -3665,7 +3665,7 @@  discard block
 block discarded – undo
3665 3665
  */
3666 3666
 function geodir_sort_by_review_count_obj($a, $b)
3667 3667
 {
3668
-    return $a->review_count < $b->review_count;
3668
+	return $a->review_count < $b->review_count;
3669 3669
 }
3670 3670
 
3671 3671
 /**
@@ -3675,43 +3675,43 @@  discard block
 block discarded – undo
3675 3675
  * @package GeoDirectory
3676 3676
  */
3677 3677
 function geodir_load_textdomain() {
3678
-    /**
3679
-     * Filter the plugin locale.
3680
-     *
3681
-     * @since 1.4.2
3682
-     * @package GeoDirectory
3683
-     */
3684
-    $locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
3685
-
3686
-    load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo');
3687
-    load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages');
3678
+	/**
3679
+	 * Filter the plugin locale.
3680
+	 *
3681
+	 * @since 1.4.2
3682
+	 * @package GeoDirectory
3683
+	 */
3684
+	$locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
3685
+
3686
+	load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo');
3687
+	load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages');
3688
+
3689
+	/**
3690
+	 * Define language constants.
3691
+	 *
3692
+	 * @since 1.0.0
3693
+	 */
3694
+	require_once(geodir_plugin_path() . '/language.php');
3695
+
3696
+	$language_file = geodir_plugin_path() . '/db-language.php';
3697
+
3698
+	// Load language string file if not created yet
3699
+	if (!file_exists($language_file)) {
3700
+		geodirectory_load_db_language();
3701
+	}
3688 3702
 
3689
-    /**
3690
-     * Define language constants.
3691
-     *
3692
-     * @since 1.0.0
3693
-     */
3694
-    require_once(geodir_plugin_path() . '/language.php');
3695
-
3696
-    $language_file = geodir_plugin_path() . '/db-language.php';
3697
-
3698
-    // Load language string file if not created yet
3699
-    if (!file_exists($language_file)) {
3700
-        geodirectory_load_db_language();
3701
-    }
3702
-
3703
-    if (file_exists($language_file)) {
3704
-        /**
3705
-         * Language strings from database.
3706
-         *
3707
-         * @since 1.4.2
3708
-         */
3709
-        try {
3710
-            require_once($language_file);
3711
-        } catch(Exception $e) {
3712
-            error_log('Language Error: ' . $e->getMessage());
3713
-        }
3714
-    }
3703
+	if (file_exists($language_file)) {
3704
+		/**
3705
+		 * Language strings from database.
3706
+		 *
3707
+		 * @since 1.4.2
3708
+		 */
3709
+		try {
3710
+			require_once($language_file);
3711
+		} catch(Exception $e) {
3712
+			error_log('Language Error: ' . $e->getMessage());
3713
+		}
3714
+	}
3715 3715
 }
3716 3716
 
3717 3717
 /**
@@ -3725,66 +3725,66 @@  discard block
 block discarded – undo
3725 3725
  * @return bool True if file created otherwise false
3726 3726
  */
3727 3727
 function geodirectory_load_db_language() {
3728
-    global $wp_filesystem;
3729
-    if( empty( $wp_filesystem ) ) {
3730
-        require_once( ABSPATH .'/wp-admin/includes/file.php' );
3731
-        WP_Filesystem();
3732
-        global $wp_filesystem;
3733
-    }
3734
-
3735
-    $language_file = geodir_plugin_path() . '/db-language.php';
3728
+	global $wp_filesystem;
3729
+	if( empty( $wp_filesystem ) ) {
3730
+		require_once( ABSPATH .'/wp-admin/includes/file.php' );
3731
+		WP_Filesystem();
3732
+		global $wp_filesystem;
3733
+	}
3736 3734
 
3737
-    if(is_file($language_file) && !is_writable($language_file))
3738
-        return false; // Not possible to create.
3735
+	$language_file = geodir_plugin_path() . '/db-language.php';
3736
+
3737
+	if(is_file($language_file) && !is_writable($language_file))
3738
+		return false; // Not possible to create.
3739
+
3740
+	if(!is_file($language_file) && !is_writable(dirname($language_file)))
3741
+		return false; // Not possible to create.
3742
+
3743
+	$contents_strings = array();
3744
+
3745
+	/**
3746
+	 * Filter the language string from database to translate via po editor
3747
+	 *
3748
+	 * @since 1.4.2
3749
+	 *
3750
+	 * @param array $contents_strings Array of strings.
3751
+	 */
3752
+	$contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
3753
+
3754
+	$contents_strings = array_unique($contents_strings);
3755
+
3756
+	$contents_head = array();
3757
+	$contents_head[] = "<?php";
3758
+	$contents_head[] = "/**";
3759
+	$contents_head[] = " * Translate language string stored in database. Ex: Custom Fields";
3760
+	$contents_head[] = " *";
3761
+	$contents_head[] = " * @package GeoDirectory";
3762
+	$contents_head[] = " * @since 1.4.2";
3763
+	$contents_head[] = " */";
3764
+	$contents_head[] = "";
3765
+	$contents_head[] = "// Language keys";
3766
+
3767
+	$contents_foot = array();
3768
+	$contents_foot[] = "";
3769
+	$contents_foot[] = "";
3770
+
3771
+	$contents = implode(PHP_EOL, $contents_head);
3772
+
3773
+	if (!empty($contents_strings)) {
3774
+		foreach ( $contents_strings as $string ) {
3775
+			if (is_scalar($string) && $string != '') {
3776
+				$string = str_replace("'", "\'", $string);
3777
+				$contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
3778
+			}
3779
+		}
3780
+	}
3739 3781
 
3740
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3741
-        return false; // Not possible to create.
3782
+	$contents .= implode(PHP_EOL, $contents_foot);
3742 3783
 
3743
-    $contents_strings = array();
3784
+	if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3785
+		return false; // Failure; could not write file.
3744 3786
 
3745
-    /**
3746
-     * Filter the language string from database to translate via po editor
3747
-     *
3748
-     * @since 1.4.2
3749
-     *
3750
-     * @param array $contents_strings Array of strings.
3751
-     */
3752
-    $contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
3753
-
3754
-    $contents_strings = array_unique($contents_strings);
3755
-
3756
-    $contents_head = array();
3757
-    $contents_head[] = "<?php";
3758
-    $contents_head[] = "/**";
3759
-    $contents_head[] = " * Translate language string stored in database. Ex: Custom Fields";
3760
-    $contents_head[] = " *";
3761
-    $contents_head[] = " * @package GeoDirectory";
3762
-    $contents_head[] = " * @since 1.4.2";
3763
-    $contents_head[] = " */";
3764
-    $contents_head[] = "";
3765
-    $contents_head[] = "// Language keys";
3766
-
3767
-    $contents_foot = array();
3768
-    $contents_foot[] = "";
3769
-    $contents_foot[] = "";
3770
-
3771
-    $contents = implode(PHP_EOL, $contents_head);
3772
-
3773
-    if (!empty($contents_strings)) {
3774
-        foreach ( $contents_strings as $string ) {
3775
-            if (is_scalar($string) && $string != '') {
3776
-                $string = str_replace("'", "\'", $string);
3777
-                $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
3778
-            }
3779
-        }
3780
-    }
3781
-
3782
-    $contents .= implode(PHP_EOL, $contents_foot);
3783
-
3784
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3785
-        return false; // Failure; could not write file.
3786
-
3787
-    return true;
3787
+	return true;
3788 3788
 }
3789 3789
 
3790 3790
 /**
@@ -3800,31 +3800,31 @@  discard block
 block discarded – undo
3800 3800
  * @return array Translation texts.
3801 3801
  */
3802 3802
 function geodir_load_custom_field_translation($translation_texts = array()) {
3803
-    global $wpdb;
3803
+	global $wpdb;
3804 3804
 
3805
-    // Custom fields table
3806
-    $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
3807
-    $rows = $wpdb->get_results($sql);
3805
+	// Custom fields table
3806
+	$sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
3807
+	$rows = $wpdb->get_results($sql);
3808 3808
 
3809
-    if (!empty($rows)) {
3810
-        foreach($rows as $row) {
3811
-            if (!empty($row->admin_title))
3812
-                $translation_texts[] = stripslashes_deep($row->admin_title);
3809
+	if (!empty($rows)) {
3810
+		foreach($rows as $row) {
3811
+			if (!empty($row->admin_title))
3812
+				$translation_texts[] = stripslashes_deep($row->admin_title);
3813 3813
 			
3814
-            if (!empty($row->admin_desc))
3815
-                $translation_texts[] = stripslashes_deep($row->admin_desc);
3814
+			if (!empty($row->admin_desc))
3815
+				$translation_texts[] = stripslashes_deep($row->admin_desc);
3816 3816
 
3817
-            if (!empty($row->site_title))
3818
-                $translation_texts[] = stripslashes_deep($row->site_title);
3817
+			if (!empty($row->site_title))
3818
+				$translation_texts[] = stripslashes_deep($row->site_title);
3819 3819
 
3820
-            if (!empty($row->clabels))
3821
-                $translation_texts[] = stripslashes_deep($row->clabels);
3820
+			if (!empty($row->clabels))
3821
+				$translation_texts[] = stripslashes_deep($row->clabels);
3822 3822
 
3823
-            if (!empty($row->required_msg))
3824
-                $translation_texts[] = stripslashes_deep($row->required_msg);
3823
+			if (!empty($row->required_msg))
3824
+				$translation_texts[] = stripslashes_deep($row->required_msg);
3825 3825
 			
3826 3826
 			if (!empty($row->default_value))
3827
-                $translation_texts[] = stripslashes_deep($row->default_value);
3827
+				$translation_texts[] = stripslashes_deep($row->default_value);
3828 3828
 			
3829 3829
 			if (!empty($row->option_values)) {
3830 3830
 				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
@@ -3837,25 +3837,25 @@  discard block
 block discarded – undo
3837 3837
 					}
3838 3838
 				}
3839 3839
 			}
3840
-        }
3841
-    }
3840
+		}
3841
+	}
3842 3842
 	
3843
-    // Custom sorting fields table
3844
-    $sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3845
-    $rows = $wpdb->get_results($sql);
3846
-
3847
-    if (!empty($rows)) {
3848
-        foreach($rows as $row) {
3849
-            if (!empty($row->site_title))
3850
-                $translation_texts[] = stripslashes_deep($row->site_title);
3851
-
3852
-            if (!empty($row->asc_title))
3853
-                $translation_texts[] = stripslashes_deep($row->asc_title);
3854
-
3855
-            if (!empty($row->desc_title))
3856
-                $translation_texts[] = stripslashes_deep($row->desc_title);
3857
-        }
3858
-    }
3843
+	// Custom sorting fields table
3844
+	$sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3845
+	$rows = $wpdb->get_results($sql);
3846
+
3847
+	if (!empty($rows)) {
3848
+		foreach($rows as $row) {
3849
+			if (!empty($row->site_title))
3850
+				$translation_texts[] = stripslashes_deep($row->site_title);
3851
+
3852
+			if (!empty($row->asc_title))
3853
+				$translation_texts[] = stripslashes_deep($row->asc_title);
3854
+
3855
+			if (!empty($row->desc_title))
3856
+				$translation_texts[] = stripslashes_deep($row->desc_title);
3857
+		}
3858
+	}
3859 3859
 	
3860 3860
 	// Advance search filter fields table
3861 3861
 	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
@@ -3876,9 +3876,9 @@  discard block
 block discarded – undo
3876 3876
 		}
3877 3877
 	}
3878 3878
 
3879
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3879
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3880 3880
 
3881
-    return $translation_texts;
3881
+	return $translation_texts;
3882 3882
 }
3883 3883
 
3884 3884
 /**
@@ -3890,71 +3890,71 @@  discard block
 block discarded – undo
3890 3890
  * @return array Array of mime types.
3891 3891
  */
3892 3892
 function geodir_allowed_mime_types() {
3893
-    /**
3894
-     * Filter the list of mime types and file extensions allowed for file upload.
3895
-     *
3896
-     * @since 1.4.7
3897
-     * @package GeoDirectory
3898
-     *
3899
-     * @param array $geodir_allowed_mime_types and file extensions.
3900
-     */
3901
-    return apply_filters( 'geodir_allowed_mime_types', array(
3902
-            'Image' => array( // Image formats.
3903
-                'jpg' => 'image/jpeg',
3904
-                'jpe' => 'image/jpeg',
3905
-                'jpeg' => 'image/jpeg',
3906
-                'gif' => 'image/gif',
3907
-                'png' => 'image/png',
3908
-                'bmp' => 'image/bmp',
3909
-                'ico' => 'image/x-icon',
3910
-            ),
3911
-            'Video' => array( // Video formats.
3912
-                'asf' => 'video/x-ms-asf',
3913
-                'avi' => 'video/avi',
3914
-                'flv' => 'video/x-flv',
3915
-                'mkv' => 'video/x-matroska',
3916
-                'mp4' => 'video/mp4',
3917
-                'mpeg' => 'video/mpeg',
3918
-                'mpg' => 'video/mpeg',
3919
-                'wmv' => 'video/x-ms-wmv',
3920
-                '3gp' => 'video/3gpp',
3921
-            ),
3922
-            'Audio' => array( // Audio formats.
3923
-                'ogg' => 'audio/ogg',
3924
-                'mp3' => 'audio/mpeg',
3925
-                'wav' => 'audio/wav',
3926
-                'wma' => 'audio/x-ms-wma',
3927
-            ),
3928
-            'Text' => array( // Text formats.
3929
-                'css' => 'text/css',
3930
-                'csv' => 'text/csv',
3931
-                'htm' => 'text/html',
3932
-                'html' => 'text/html',
3933
-                'txt' => 'text/plain',
3934
-                'rtx' => 'text/richtext',
3935
-                'vtt' => 'text/vtt',
3936
-            ),
3937
-            'Application' => array( // Application formats.
3938
-                'doc' => 'application/msword',
3939
-                'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
3940
-                'exe' => 'application/x-msdownload',
3941
-                'js' => 'application/javascript',
3942
-                'odt' => 'application/vnd.oasis.opendocument.text',
3943
-                'pdf' => 'application/pdf',
3944
-                'pot' => 'application/vnd.ms-powerpoint',
3945
-                'ppt' => 'application/vnd.ms-powerpoint',
3946
-                'pptx' => 'application/vnd.ms-powerpoint',
3947
-                'psd' => 'application/octet-stream',
3948
-                'rar' => 'application/rar',
3949
-                'rtf' => 'application/rtf',
3950
-                'swf' => 'application/x-shockwave-flash',
3951
-                'tar' => 'application/x-tar',
3952
-                'xls' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3953
-                'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3954
-                'zip' => 'application/zip',
3955
-            )
3956
-        )
3957
-    );
3893
+	/**
3894
+	 * Filter the list of mime types and file extensions allowed for file upload.
3895
+	 *
3896
+	 * @since 1.4.7
3897
+	 * @package GeoDirectory
3898
+	 *
3899
+	 * @param array $geodir_allowed_mime_types and file extensions.
3900
+	 */
3901
+	return apply_filters( 'geodir_allowed_mime_types', array(
3902
+			'Image' => array( // Image formats.
3903
+				'jpg' => 'image/jpeg',
3904
+				'jpe' => 'image/jpeg',
3905
+				'jpeg' => 'image/jpeg',
3906
+				'gif' => 'image/gif',
3907
+				'png' => 'image/png',
3908
+				'bmp' => 'image/bmp',
3909
+				'ico' => 'image/x-icon',
3910
+			),
3911
+			'Video' => array( // Video formats.
3912
+				'asf' => 'video/x-ms-asf',
3913
+				'avi' => 'video/avi',
3914
+				'flv' => 'video/x-flv',
3915
+				'mkv' => 'video/x-matroska',
3916
+				'mp4' => 'video/mp4',
3917
+				'mpeg' => 'video/mpeg',
3918
+				'mpg' => 'video/mpeg',
3919
+				'wmv' => 'video/x-ms-wmv',
3920
+				'3gp' => 'video/3gpp',
3921
+			),
3922
+			'Audio' => array( // Audio formats.
3923
+				'ogg' => 'audio/ogg',
3924
+				'mp3' => 'audio/mpeg',
3925
+				'wav' => 'audio/wav',
3926
+				'wma' => 'audio/x-ms-wma',
3927
+			),
3928
+			'Text' => array( // Text formats.
3929
+				'css' => 'text/css',
3930
+				'csv' => 'text/csv',
3931
+				'htm' => 'text/html',
3932
+				'html' => 'text/html',
3933
+				'txt' => 'text/plain',
3934
+				'rtx' => 'text/richtext',
3935
+				'vtt' => 'text/vtt',
3936
+			),
3937
+			'Application' => array( // Application formats.
3938
+				'doc' => 'application/msword',
3939
+				'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
3940
+				'exe' => 'application/x-msdownload',
3941
+				'js' => 'application/javascript',
3942
+				'odt' => 'application/vnd.oasis.opendocument.text',
3943
+				'pdf' => 'application/pdf',
3944
+				'pot' => 'application/vnd.ms-powerpoint',
3945
+				'ppt' => 'application/vnd.ms-powerpoint',
3946
+				'pptx' => 'application/vnd.ms-powerpoint',
3947
+				'psd' => 'application/octet-stream',
3948
+				'rar' => 'application/rar',
3949
+				'rtf' => 'application/rtf',
3950
+				'swf' => 'application/x-shockwave-flash',
3951
+				'tar' => 'application/x-tar',
3952
+				'xls' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3953
+				'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3954
+				'zip' => 'application/zip',
3955
+			)
3956
+		)
3957
+	);
3958 3958
 }
3959 3959
 
3960 3960
 /**
@@ -3966,21 +3966,21 @@  discard block
 block discarded – undo
3966 3966
  * @return string User display name.
3967 3967
  */
3968 3968
 function geodir_get_client_name($user_id) {
3969
-    $client_name = '';
3969
+	$client_name = '';
3970 3970
 
3971
-    $user_data = get_userdata($user_id);
3971
+	$user_data = get_userdata($user_id);
3972 3972
 
3973
-    if (!empty($user_data)) {
3974
-        if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
3975
-            $client_name = trim($user_data->display_name);
3976
-        } else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
3977
-            $client_name = trim($user_data->user_nicename);
3978
-        } else {
3979
-            $client_name = trim($user_data->user_login);
3980
-        }
3981
-    }
3973
+	if (!empty($user_data)) {
3974
+		if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
3975
+			$client_name = trim($user_data->display_name);
3976
+		} else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
3977
+			$client_name = trim($user_data->user_nicename);
3978
+		} else {
3979
+			$client_name = trim($user_data->user_login);
3980
+		}
3981
+	}
3982 3982
 
3983
-    return $client_name;
3983
+	return $client_name;
3984 3984
 }
3985 3985
 
3986 3986
 
@@ -3995,125 +3995,125 @@  discard block
 block discarded – undo
3995 3995
  */
3996 3996
 function geodir_wpseo_replacements($vars){
3997 3997
 
3998
-    global $wp;
3999
-    $title = '';
4000
-    // location variables
4001
-    $gd_post_type = geodir_get_current_posttype();
4002
-    $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4003
-    /**
4004
-     * Filter the title variables location variables array
4005
-     *
4006
-     * @since 1.5.5
4007
-     * @package GeoDirectory
4008
-     * @param array $location_array The array of location variables.
4009
-     * @param array $vars The page title variables.
4010
-     */
4011
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
4012
-    $location_titles = array();
4013
-    if(get_query_var( 'gd_country_full' )){
4014
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4015
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4016
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4017
-    }
4018
-    $location_single = '';
4019
-    $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4020
-    $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4021
-    $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4022
-
4023
-    $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4024
-
4025
-    if (function_exists('get_actual_location_name')) {
4026
-        $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4027
-        $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4028
-        $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4029
-    }
4030
-
4031
-    if ($gd_city != '') {
4032
-        if ($gd_city_actual != '') {
4033
-            $gd_city = $gd_city_actual;
4034
-        } else {
4035
-            $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4036
-            $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4037
-            $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4038
-        }
4039
-        $location_single = $gd_city;
4040
-
4041
-    } else if ($gd_region != '') {
4042
-        if ($gd_region_actual != '') {
4043
-            $gd_region = $gd_region_actual;
4044
-        } else {
4045
-            $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4046
-            $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4047
-            $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4048
-        }
4049
-
4050
-        $location_single = $gd_region;
4051
-    } else if ($gd_country != '') {
4052
-        if ($gd_country_actual != '') {
4053
-            $gd_country = $gd_country_actual;
4054
-        } else {
4055
-            $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4056
-            $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4057
-            $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4058
-        }
4059
-
4060
-        $location_single = $gd_country;
4061
-    }
4062
-
4063
-    if (!empty($location_array)) {
4064
-
4065
-        $actual_location_name = function_exists('get_actual_location_name') ? true : false;
4066
-        $location_array = array_reverse($location_array);
4067
-
4068
-        foreach ($location_array as $location_type => $location) {
4069
-            $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4070
-            $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4071
-
4072
-            $location_name = geodir_ucwords($gd_location_link_text);
4073
-            $location_name = __($location_name, 'geodirectory');
4074
-
4075
-            if ($actual_location_name) {
4076
-                $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4077
-                $location_name = get_actual_location_name($location_type, $location, true);
4078
-            }
4079
-
4080
-            $location_titles[] = $location_name;
4081
-        }
4082
-        if (!empty($location_titles)) {
4083
-            $location_titles = array_unique($location_titles);
4084
-        }
4085
-    }
4086
-
4087
-
4088
-    if(!empty($location_titles)) {
4089
-        $vars['%%location%%'] = implode(", ", $location_titles);
4090
-    }
4091
-
4092
-
4093
-    if(!empty($location_titles)) {
4094
-        $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
4095
-    }
4096
-
4097
-
4098
-
4099
-    if($location_single) {
4100
-        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
4101
-    }
4102
-
4103
-
4104
-    if($location_single) {
4105
-        $vars['%%location_single%%'] = $location_single;
4106
-    }
4107
-
4108
-    /**
4109
-     * Filter the title variables after standard ones have been filtered for wpseo.
4110
-     *
4111
-     * @since 1.5.7
4112
-     * @package GeoDirectory
4113
-     * @param string $vars The title with variables.
4114
-     * @param array $location_array The array of location variables.
4115
-     */
4116
-    return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
3998
+	global $wp;
3999
+	$title = '';
4000
+	// location variables
4001
+	$gd_post_type = geodir_get_current_posttype();
4002
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4003
+	/**
4004
+	 * Filter the title variables location variables array
4005
+	 *
4006
+	 * @since 1.5.5
4007
+	 * @package GeoDirectory
4008
+	 * @param array $location_array The array of location variables.
4009
+	 * @param array $vars The page title variables.
4010
+	 */
4011
+	$location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
4012
+	$location_titles = array();
4013
+	if(get_query_var( 'gd_country_full' )){
4014
+		if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4015
+		if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4016
+		if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4017
+	}
4018
+	$location_single = '';
4019
+	$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4020
+	$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4021
+	$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4022
+
4023
+	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4024
+
4025
+	if (function_exists('get_actual_location_name')) {
4026
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4027
+		$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4028
+		$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4029
+	}
4030
+
4031
+	if ($gd_city != '') {
4032
+		if ($gd_city_actual != '') {
4033
+			$gd_city = $gd_city_actual;
4034
+		} else {
4035
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4036
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4037
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4038
+		}
4039
+		$location_single = $gd_city;
4040
+
4041
+	} else if ($gd_region != '') {
4042
+		if ($gd_region_actual != '') {
4043
+			$gd_region = $gd_region_actual;
4044
+		} else {
4045
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4046
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4047
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4048
+		}
4049
+
4050
+		$location_single = $gd_region;
4051
+	} else if ($gd_country != '') {
4052
+		if ($gd_country_actual != '') {
4053
+			$gd_country = $gd_country_actual;
4054
+		} else {
4055
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4056
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4057
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4058
+		}
4059
+
4060
+		$location_single = $gd_country;
4061
+	}
4062
+
4063
+	if (!empty($location_array)) {
4064
+
4065
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4066
+		$location_array = array_reverse($location_array);
4067
+
4068
+		foreach ($location_array as $location_type => $location) {
4069
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4070
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4071
+
4072
+			$location_name = geodir_ucwords($gd_location_link_text);
4073
+			$location_name = __($location_name, 'geodirectory');
4074
+
4075
+			if ($actual_location_name) {
4076
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4077
+				$location_name = get_actual_location_name($location_type, $location, true);
4078
+			}
4079
+
4080
+			$location_titles[] = $location_name;
4081
+		}
4082
+		if (!empty($location_titles)) {
4083
+			$location_titles = array_unique($location_titles);
4084
+		}
4085
+	}
4086
+
4087
+
4088
+	if(!empty($location_titles)) {
4089
+		$vars['%%location%%'] = implode(", ", $location_titles);
4090
+	}
4091
+
4092
+
4093
+	if(!empty($location_titles)) {
4094
+		$vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
4095
+	}
4096
+
4097
+
4098
+
4099
+	if($location_single) {
4100
+		$vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
4101
+	}
4102
+
4103
+
4104
+	if($location_single) {
4105
+		$vars['%%location_single%%'] = $location_single;
4106
+	}
4107
+
4108
+	/**
4109
+	 * Filter the title variables after standard ones have been filtered for wpseo.
4110
+	 *
4111
+	 * @since 1.5.7
4112
+	 * @package GeoDirectory
4113
+	 * @param string $vars The title with variables.
4114
+	 * @param array $location_array The array of location variables.
4115
+	 */
4116
+	return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
4117 4117
 }
4118 4118
 
4119 4119
 
@@ -4123,10 +4123,10 @@  discard block
 block discarded – undo
4123 4123
 function geodir_filter_title_variables($title, $gd_page, $sep=''){
4124 4124
 
4125 4125
 
4126
-    if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
4127
-    global $post;
4128
-    //print_r($post);
4129
-    /*
4126
+	if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
4127
+	global $post;
4128
+	//print_r($post);
4129
+	/*
4130 4130
     %%date%%	                Replaced with the date of the post/page
4131 4131
     %%title%%	                Replaced with the title of the post/page
4132 4132
     %%sitename%%	            The site's name
@@ -4153,314 +4153,314 @@  discard block
 block discarded – undo
4153 4153
     %%pagenumber%%	            Replaced with the current page number
4154 4154
      */
4155 4155
 
4156
-    if ($sep == '') {
4157
-        /**
4158
-         * Filter the page title separator.
4159
-         *
4160
-         * @since 1.0.0
4161
-         * @package GeoDirectory
4162
-         * @param string $sep The separator, default: `|`.
4163
-         */
4164
-        $sep = apply_filters('geodir_page_title_separator', '|');
4165
-    }
4166
-
4167
-
4168
-    if(strpos($title,'%%title%%') !== false){
4169
-        $title = str_replace("%%title%%",$post->post_title,$title);
4170
-    }
4171
-
4172
-    if(strpos($title,'%%sitename%%') !== false){
4173
-        $title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
4174
-    }
4175
-
4176
-    if(strpos($title,'%%sitedesc%%') !== false){
4177
-        $title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
4178
-    }
4179
-
4180
-    if(strpos($title,'%%excerpt%%') !== false){
4181
-        $title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
4182
-    }
4183
-
4184
-    if(strpos($title,'%%pt_single%%') !== false){
4185
-        $single_name = '';
4186
-        if($gd_page=='search' || $gd_page=='author'){
4187
-            $geodir_post_types = get_option('geodir_post_types');
4188
-            $spt = esc_attr($_REQUEST['stype']);
4189
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4190
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4191
-            }
4192
-        }elseif($gd_page=='add-listing'){
4193
-            $geodir_post_types = get_option('geodir_post_types');
4194
-            $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
4195
-            if(!$spt && isset($_REQUEST['pid'])){
4196
-                $spt = get_post_type( $_REQUEST['pid'] );
4197
-            }
4198
-            if(!$spt){$spt='gd_place';}
4199
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4200
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4201
-            }
4202
-        }
4203
-        elseif($post->post_type){
4204
-            $geodir_post_types = get_option('geodir_post_types');
4205
-            if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4206
-                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
4207
-            }
4208
-
4209
-
4210
-        }
4211
-        $title = str_replace("%%pt_single%%",$single_name,$title);
4212
-    }
4213
-
4214
-    if(strpos($title,'%%pt_plural%%') !== false){
4215
-        $plural_name = '';
4216
-        if($gd_page=='search' || $gd_page=='author'){
4217
-            $geodir_post_types = get_option('geodir_post_types');
4218
-            $spt = esc_attr($_REQUEST['stype']);
4219
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4220
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4221
-            }
4222
-        }elseif($gd_page=='add-listing'){
4223
-            $geodir_post_types = get_option('geodir_post_types');
4224
-            $spt = sanitize_text_field($_REQUEST['listing_type']);
4225
-            if(!$spt){$spt='gd_place';}
4226
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4227
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4228
-            }
4229
-        }
4230
-        elseif(isset($post->post_type) && $post->post_type){
4231
-            $geodir_post_types = get_option('geodir_post_types');
4232
-            if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4233
-                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
4234
-            }
4235
-
4236
-        }
4237
-        $title = str_replace("%%pt_plural%%",$plural_name,$title);
4238
-    }
4239
-
4240
-
4241
-
4242
-    if(strpos($title,'%%category%%') !== false){
4243
-        $cat_name = '';
4244
-
4245
-        if($gd_page=='detail') {
4246
-            if ($post->default_category) {
4247
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4248
-                $cat_name = (isset($cat->name)) ? $cat->name : '';
4249
-            }
4250
-        }elseif($gd_page=='listing'){
4251
-            $queried_object = get_queried_object();
4252
-            if(isset($queried_object->name)){
4253
-                $cat_name = $queried_object->name;
4254
-            }
4255
-        }
4256
-        $title = str_replace("%%category%%",$cat_name,$title);
4257
-    }
4258
-
4259
-    if(strpos($title,'%%tag%%') !== false){
4260
-        $cat_name = '';
4261
-
4262
-        if($gd_page=='detail') {
4263
-            if ($post->default_category) {
4264
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4265
-                $cat_name = (isset($cat->name)) ? $cat->name : '';
4266
-            }
4267
-        }elseif($gd_page=='listing'){
4268
-            $queried_object = get_queried_object();
4269
-            if(isset($queried_object->name)){
4270
-                $cat_name = $queried_object->name;
4271
-            }
4272
-        }
4273
-        $title = str_replace("%%tag%%",$cat_name,$title);
4274
-    }
4275
-
4276
-
4277
-
4278
-    if(strpos($title,'%%id%%') !== false){
4279
-        $ID = (isset($post->ID)) ? $post->ID : '';
4280
-        $title = str_replace("%%id%%",$ID,$title);
4281
-    }
4282
-
4283
-    if(strpos($title,'%%sep%%') !== false){
4284
-        $title = str_replace("%%sep%%",$sep,$title);
4285
-    }
4286
-
4287
-
4288
-    global $wp;
4289
-    // location variables
4290
-    $gd_post_type = geodir_get_current_posttype();
4291
-    $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4292
-    /**
4293
-     * Filter the title variables location variables array
4294
-     *
4295
-     * @since 1.5.5
4296
-     * @package GeoDirectory
4297
-     * @param array $location_array The array of location variables.
4298
-     * @param string $title The title with variables..
4299
-     * @param string $gd_page The page being filtered.
4300
-     * @param string $sep The separator, default: `|`.
4301
-     */
4302
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4303
-    $location_titles = array();
4304
-    if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4305
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4306
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4307
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4308
-    }
4309
-    $location_single = '';
4310
-    $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4311
-    $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4312
-    $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4313
-
4314
-    $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4315
-
4316
-    if (function_exists('get_actual_location_name')) {
4317
-        $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4318
-        $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4319
-        $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4320
-    }
4321
-
4322
-    if ($gd_city != '') {
4323
-        if ($gd_city_actual != '') {
4324
-            $gd_city = $gd_city_actual;
4325
-        } else {
4326
-            $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4327
-            $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4328
-            $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4329
-        }
4330
-        $location_single = $gd_city;
4331
-
4332
-    } else if ($gd_region != '') {
4333
-        if ($gd_region_actual != '') {
4334
-            $gd_region = $gd_region_actual;
4335
-        } else {
4336
-            $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4337
-            $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4338
-            $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4339
-        }
4340
-
4341
-        $location_single = $gd_region;
4342
-    } else if ($gd_country != '') {
4343
-        if ($gd_country_actual != '') {
4344
-            $gd_country = $gd_country_actual;
4345
-        } else {
4346
-            $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4347
-            $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4348
-            $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4349
-        }
4350
-
4351
-        $location_single = $gd_country;
4352
-    }
4353
-
4354
-    if (!empty($location_array)) {
4355
-
4356
-        $actual_location_name = function_exists('get_actual_location_name') ? true : false;
4357
-        $location_array = array_reverse($location_array);
4358
-
4359
-        foreach ($location_array as $location_type => $location) {
4360
-            $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4361
-            $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4362
-
4363
-            $location_name = geodir_ucwords($gd_location_link_text);
4364
-            $location_name = __($location_name, 'geodirectory');
4365
-
4366
-            if ($actual_location_name) {
4367
-                $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4368
-                $location_name = get_actual_location_name($location_type, $location, true);
4369
-            }
4370
-
4371
-            $location_titles[] = $location_name;
4372
-        }
4373
-        if (!empty($location_titles)) {
4374
-            $location_titles = array_unique($location_titles);
4375
-        }
4376
-    }
4377
-
4378
-
4379
-    if(strpos($title,'%%location%%') !== false){
4380
-        $location = '';
4381
-        if($location_titles) {
4382
-            $location = implode(", ", $location_titles);
4383
-        }
4384
-        $title = str_replace("%%location%%",$location,$title);
4385
-    }
4386
-
4387
-    if(strpos($title,'%%in_location%%') !== false){
4388
-        $location = '';
4389
-        if($location_titles) {
4390
-            $location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4391
-        }
4392
-        $title = str_replace("%%in_location%%",$location,$title);
4393
-    }
4394
-
4395
-    if(strpos($title,'%%in_location_single%%') !== false){
4396
-        if($location_single) {
4397
-            $location_single = __('in', 'geodirectory') . ' ' .$location_single;
4398
-        }
4399
-        $title = str_replace("%%in_location_single%%",$location_single,$title);
4400
-    }
4401
-
4402
-    if(strpos($title,'%%location_single%%') !== false){
4403
-        $title = str_replace("%%location_single%%",$location_single,$title);
4404
-    }
4405
-
4406
-
4407
-    if(strpos($title,'%%search_term%%') !== false){
4408
-        $search_term = '';
4409
-        if(isset($_REQUEST['s'])){
4410
-            $search_term = esc_attr($_REQUEST['s']);
4411
-        }
4412
-        $title = str_replace("%%search_term%%",$search_term,$title);
4413
-    }
4414
-
4415
-    if(strpos($title,'%%search_near%%') !== false){
4416
-        $search_term = '';
4417
-        if(isset($_REQUEST['snear'])){
4418
-            $search_term = esc_attr($_REQUEST['snear']);
4419
-        }
4420
-        $title = str_replace("%%search_near%%",$search_term,$title);
4421
-    }
4422
-
4423
-    if(strpos($title,'%%name%%') !== false){
4424
-        $author_name = get_the_author();
4425
-        if (!$author_name || $author_name === '') {
4426
-            $queried_object = get_queried_object();
4156
+	if ($sep == '') {
4157
+		/**
4158
+		 * Filter the page title separator.
4159
+		 *
4160
+		 * @since 1.0.0
4161
+		 * @package GeoDirectory
4162
+		 * @param string $sep The separator, default: `|`.
4163
+		 */
4164
+		$sep = apply_filters('geodir_page_title_separator', '|');
4165
+	}
4166
+
4167
+
4168
+	if(strpos($title,'%%title%%') !== false){
4169
+		$title = str_replace("%%title%%",$post->post_title,$title);
4170
+	}
4171
+
4172
+	if(strpos($title,'%%sitename%%') !== false){
4173
+		$title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
4174
+	}
4175
+
4176
+	if(strpos($title,'%%sitedesc%%') !== false){
4177
+		$title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
4178
+	}
4179
+
4180
+	if(strpos($title,'%%excerpt%%') !== false){
4181
+		$title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
4182
+	}
4183
+
4184
+	if(strpos($title,'%%pt_single%%') !== false){
4185
+		$single_name = '';
4186
+		if($gd_page=='search' || $gd_page=='author'){
4187
+			$geodir_post_types = get_option('geodir_post_types');
4188
+			$spt = esc_attr($_REQUEST['stype']);
4189
+			if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4190
+				$single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4191
+			}
4192
+		}elseif($gd_page=='add-listing'){
4193
+			$geodir_post_types = get_option('geodir_post_types');
4194
+			$spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
4195
+			if(!$spt && isset($_REQUEST['pid'])){
4196
+				$spt = get_post_type( $_REQUEST['pid'] );
4197
+			}
4198
+			if(!$spt){$spt='gd_place';}
4199
+			if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4200
+				$single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4201
+			}
4202
+		}
4203
+		elseif($post->post_type){
4204
+			$geodir_post_types = get_option('geodir_post_types');
4205
+			if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4206
+				$single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
4207
+			}
4208
+
4209
+
4210
+		}
4211
+		$title = str_replace("%%pt_single%%",$single_name,$title);
4212
+	}
4213
+
4214
+	if(strpos($title,'%%pt_plural%%') !== false){
4215
+		$plural_name = '';
4216
+		if($gd_page=='search' || $gd_page=='author'){
4217
+			$geodir_post_types = get_option('geodir_post_types');
4218
+			$spt = esc_attr($_REQUEST['stype']);
4219
+			if(isset($geodir_post_types[$spt]['labels']['name'])){
4220
+				$plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4221
+			}
4222
+		}elseif($gd_page=='add-listing'){
4223
+			$geodir_post_types = get_option('geodir_post_types');
4224
+			$spt = sanitize_text_field($_REQUEST['listing_type']);
4225
+			if(!$spt){$spt='gd_place';}
4226
+			if(isset($geodir_post_types[$spt]['labels']['name'])){
4227
+				$plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4228
+			}
4229
+		}
4230
+		elseif(isset($post->post_type) && $post->post_type){
4231
+			$geodir_post_types = get_option('geodir_post_types');
4232
+			if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4233
+				$plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
4234
+			}
4235
+
4236
+		}
4237
+		$title = str_replace("%%pt_plural%%",$plural_name,$title);
4238
+	}
4239
+
4240
+
4241
+
4242
+	if(strpos($title,'%%category%%') !== false){
4243
+		$cat_name = '';
4244
+
4245
+		if($gd_page=='detail') {
4246
+			if ($post->default_category) {
4247
+				$cat = get_term($post->default_category, $post->post_type . 'category');
4248
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4249
+			}
4250
+		}elseif($gd_page=='listing'){
4251
+			$queried_object = get_queried_object();
4252
+			if(isset($queried_object->name)){
4253
+				$cat_name = $queried_object->name;
4254
+			}
4255
+		}
4256
+		$title = str_replace("%%category%%",$cat_name,$title);
4257
+	}
4258
+
4259
+	if(strpos($title,'%%tag%%') !== false){
4260
+		$cat_name = '';
4261
+
4262
+		if($gd_page=='detail') {
4263
+			if ($post->default_category) {
4264
+				$cat = get_term($post->default_category, $post->post_type . 'category');
4265
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4266
+			}
4267
+		}elseif($gd_page=='listing'){
4268
+			$queried_object = get_queried_object();
4269
+			if(isset($queried_object->name)){
4270
+				$cat_name = $queried_object->name;
4271
+			}
4272
+		}
4273
+		$title = str_replace("%%tag%%",$cat_name,$title);
4274
+	}
4275
+
4276
+
4277
+
4278
+	if(strpos($title,'%%id%%') !== false){
4279
+		$ID = (isset($post->ID)) ? $post->ID : '';
4280
+		$title = str_replace("%%id%%",$ID,$title);
4281
+	}
4282
+
4283
+	if(strpos($title,'%%sep%%') !== false){
4284
+		$title = str_replace("%%sep%%",$sep,$title);
4285
+	}
4286
+
4287
+
4288
+	global $wp;
4289
+	// location variables
4290
+	$gd_post_type = geodir_get_current_posttype();
4291
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4292
+	/**
4293
+	 * Filter the title variables location variables array
4294
+	 *
4295
+	 * @since 1.5.5
4296
+	 * @package GeoDirectory
4297
+	 * @param array $location_array The array of location variables.
4298
+	 * @param string $title The title with variables..
4299
+	 * @param string $gd_page The page being filtered.
4300
+	 * @param string $sep The separator, default: `|`.
4301
+	 */
4302
+	$location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4303
+	$location_titles = array();
4304
+	if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4305
+		if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4306
+		if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4307
+		if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4308
+	}
4309
+	$location_single = '';
4310
+	$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4311
+	$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4312
+	$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4313
+
4314
+	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4315
+
4316
+	if (function_exists('get_actual_location_name')) {
4317
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4318
+		$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4319
+		$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4320
+	}
4321
+
4322
+	if ($gd_city != '') {
4323
+		if ($gd_city_actual != '') {
4324
+			$gd_city = $gd_city_actual;
4325
+		} else {
4326
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4327
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4328
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4329
+		}
4330
+		$location_single = $gd_city;
4331
+
4332
+	} else if ($gd_region != '') {
4333
+		if ($gd_region_actual != '') {
4334
+			$gd_region = $gd_region_actual;
4335
+		} else {
4336
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4337
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4338
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4339
+		}
4340
+
4341
+		$location_single = $gd_region;
4342
+	} else if ($gd_country != '') {
4343
+		if ($gd_country_actual != '') {
4344
+			$gd_country = $gd_country_actual;
4345
+		} else {
4346
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4347
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4348
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4349
+		}
4350
+
4351
+		$location_single = $gd_country;
4352
+	}
4353
+
4354
+	if (!empty($location_array)) {
4355
+
4356
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4357
+		$location_array = array_reverse($location_array);
4358
+
4359
+		foreach ($location_array as $location_type => $location) {
4360
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4361
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4362
+
4363
+			$location_name = geodir_ucwords($gd_location_link_text);
4364
+			$location_name = __($location_name, 'geodirectory');
4365
+
4366
+			if ($actual_location_name) {
4367
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4368
+				$location_name = get_actual_location_name($location_type, $location, true);
4369
+			}
4370
+
4371
+			$location_titles[] = $location_name;
4372
+		}
4373
+		if (!empty($location_titles)) {
4374
+			$location_titles = array_unique($location_titles);
4375
+		}
4376
+	}
4377
+
4378
+
4379
+	if(strpos($title,'%%location%%') !== false){
4380
+		$location = '';
4381
+		if($location_titles) {
4382
+			$location = implode(", ", $location_titles);
4383
+		}
4384
+		$title = str_replace("%%location%%",$location,$title);
4385
+	}
4386
+
4387
+	if(strpos($title,'%%in_location%%') !== false){
4388
+		$location = '';
4389
+		if($location_titles) {
4390
+			$location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4391
+		}
4392
+		$title = str_replace("%%in_location%%",$location,$title);
4393
+	}
4394
+
4395
+	if(strpos($title,'%%in_location_single%%') !== false){
4396
+		if($location_single) {
4397
+			$location_single = __('in', 'geodirectory') . ' ' .$location_single;
4398
+		}
4399
+		$title = str_replace("%%in_location_single%%",$location_single,$title);
4400
+	}
4401
+
4402
+	if(strpos($title,'%%location_single%%') !== false){
4403
+		$title = str_replace("%%location_single%%",$location_single,$title);
4404
+	}
4405
+
4406
+
4407
+	if(strpos($title,'%%search_term%%') !== false){
4408
+		$search_term = '';
4409
+		if(isset($_REQUEST['s'])){
4410
+			$search_term = esc_attr($_REQUEST['s']);
4411
+		}
4412
+		$title = str_replace("%%search_term%%",$search_term,$title);
4413
+	}
4414
+
4415
+	if(strpos($title,'%%search_near%%') !== false){
4416
+		$search_term = '';
4417
+		if(isset($_REQUEST['snear'])){
4418
+			$search_term = esc_attr($_REQUEST['snear']);
4419
+		}
4420
+		$title = str_replace("%%search_near%%",$search_term,$title);
4421
+	}
4422
+
4423
+	if(strpos($title,'%%name%%') !== false){
4424
+		$author_name = get_the_author();
4425
+		if (!$author_name || $author_name === '') {
4426
+			$queried_object = get_queried_object();
4427 4427
             
4428
-            if (isset($queried_object->data->user_nicename)) {
4429
-                $author_name = $queried_object->data->user_nicename;
4430
-            }
4431
-        }
4432
-        $title = str_replace("%%name%%", $author_name, $title);
4433
-    }
4428
+			if (isset($queried_object->data->user_nicename)) {
4429
+				$author_name = $queried_object->data->user_nicename;
4430
+			}
4431
+		}
4432
+		$title = str_replace("%%name%%", $author_name, $title);
4433
+	}
4434 4434
     
4435
-    if (strpos($title, '%%page%%') !== false) {
4436
-        $page = geodir_title_meta_page($sep);
4437
-        $title = str_replace("%%page%%", $page, $title);
4438
-    }
4439
-    if (strpos($title, '%%pagenumber%%') !== false) {
4440
-        $pagenumber = geodir_title_meta_pagenumber();
4441
-        $title = str_replace("%%pagenumber%%", $pagenumber, $title);
4442
-    }
4443
-    if (strpos($title, '%%pagetotal%%') !== false) {
4444
-        $pagetotal = geodir_title_meta_pagetotal();
4445
-        $title = str_replace("%%pagetotal%%", $pagetotal, $title);
4446
-    }
4447
-
4448
-    $title = wptexturize( $title );
4449
-    $title = convert_chars( $title );
4450
-    $title = esc_html( $title );
4451
-
4452
-    /**
4453
-     * Filter the title variables after standard ones have been filtered.
4454
-     *
4455
-     * @since 1.5.7
4456
-     * @package GeoDirectory
4457
-     * @param string $title The title with variables.
4458
-     * @param array $location_array The array of location variables.
4459
-     * @param string $gd_page The page being filtered.
4460
-     * @param string $sep The separator, default: `|`.
4461
-     */
4435
+	if (strpos($title, '%%page%%') !== false) {
4436
+		$page = geodir_title_meta_page($sep);
4437
+		$title = str_replace("%%page%%", $page, $title);
4438
+	}
4439
+	if (strpos($title, '%%pagenumber%%') !== false) {
4440
+		$pagenumber = geodir_title_meta_pagenumber();
4441
+		$title = str_replace("%%pagenumber%%", $pagenumber, $title);
4442
+	}
4443
+	if (strpos($title, '%%pagetotal%%') !== false) {
4444
+		$pagetotal = geodir_title_meta_pagetotal();
4445
+		$title = str_replace("%%pagetotal%%", $pagetotal, $title);
4446
+	}
4462 4447
 
4463
-    return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4448
+	$title = wptexturize( $title );
4449
+	$title = convert_chars( $title );
4450
+	$title = esc_html( $title );
4451
+
4452
+	/**
4453
+	 * Filter the title variables after standard ones have been filtered.
4454
+	 *
4455
+	 * @since 1.5.7
4456
+	 * @package GeoDirectory
4457
+	 * @param string $title The title with variables.
4458
+	 * @param array $location_array The array of location variables.
4459
+	 * @param string $gd_page The page being filtered.
4460
+	 * @param string $sep The separator, default: `|`.
4461
+	 */
4462
+
4463
+	return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4464 4464
 }
4465 4465
 
4466 4466
 /**
@@ -4473,65 +4473,65 @@  discard block
 block discarded – undo
4473 4473
  * @return array Translation texts.
4474 4474
  */
4475 4475
 function geodir_load_cpt_text_translation($translation_texts = array()) {
4476
-    $gd_post_types = geodir_get_posttypes('array');
4477
-
4478
-    if (!empty($gd_post_types)) {
4479
-        foreach ($gd_post_types as $post_type => $cpt_info) {
4480
-            $labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4481
-            $description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4482
-            $seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4483
-
4484
-            if (!empty($labels)) {
4485
-                if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts))
4486
-                    $translation_texts[] = $labels['name'];
4487
-                if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts))
4488
-                    $translation_texts[] = $labels['singular_name'];
4489
-                if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts))
4490
-                    $translation_texts[] = $labels['add_new'];
4491
-                if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts))
4492
-                    $translation_texts[] = $labels['add_new_item'];
4493
-                if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts))
4494
-                    $translation_texts[] = $labels['edit_item'];
4495
-                if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts))
4496
-                    $translation_texts[] = $labels['new_item'];
4497
-                if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts))
4498
-                    $translation_texts[] = $labels['view_item'];
4499
-                if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts))
4500
-                    $translation_texts[] = $labels['search_items'];
4501
-                if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts))
4502
-                    $translation_texts[] = $labels['not_found'];
4503
-                if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts))
4504
-                    $translation_texts[] = $labels['not_found_in_trash'];
4505
-                if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts))
4506
-                    $translation_texts[] = $labels['label_post_profile'];
4507
-                if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts))
4508
-                    $translation_texts[] = $labels['label_post_info'];
4509
-                if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts))
4510
-                    $translation_texts[] = $labels['label_post_images'];
4511
-                if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts))
4512
-                    $translation_texts[] = $labels['label_post_map'];
4513
-                if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts))
4514
-                    $translation_texts[] = $labels['label_reviews'];
4515
-                if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts))
4516
-                    $translation_texts[] = $labels['label_related_listing'];
4517
-            }
4518
-
4519
-            if ($description != '' && !in_array($description, $translation_texts)) {
4520
-                $translation_texts[] = normalize_whitespace($description);
4521
-            }
4522
-
4523
-            if (!empty($seo)) {
4524
-                if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts))
4525
-                    $translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4526
-
4527
-                if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts))
4528
-                    $translation_texts[] = normalize_whitespace($seo['meta_description']);
4529
-            }
4530
-        }
4531
-    }
4532
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4533
-
4534
-    return $translation_texts;
4476
+	$gd_post_types = geodir_get_posttypes('array');
4477
+
4478
+	if (!empty($gd_post_types)) {
4479
+		foreach ($gd_post_types as $post_type => $cpt_info) {
4480
+			$labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4481
+			$description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4482
+			$seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4483
+
4484
+			if (!empty($labels)) {
4485
+				if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts))
4486
+					$translation_texts[] = $labels['name'];
4487
+				if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts))
4488
+					$translation_texts[] = $labels['singular_name'];
4489
+				if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts))
4490
+					$translation_texts[] = $labels['add_new'];
4491
+				if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts))
4492
+					$translation_texts[] = $labels['add_new_item'];
4493
+				if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts))
4494
+					$translation_texts[] = $labels['edit_item'];
4495
+				if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts))
4496
+					$translation_texts[] = $labels['new_item'];
4497
+				if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts))
4498
+					$translation_texts[] = $labels['view_item'];
4499
+				if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts))
4500
+					$translation_texts[] = $labels['search_items'];
4501
+				if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts))
4502
+					$translation_texts[] = $labels['not_found'];
4503
+				if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts))
4504
+					$translation_texts[] = $labels['not_found_in_trash'];
4505
+				if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts))
4506
+					$translation_texts[] = $labels['label_post_profile'];
4507
+				if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts))
4508
+					$translation_texts[] = $labels['label_post_info'];
4509
+				if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts))
4510
+					$translation_texts[] = $labels['label_post_images'];
4511
+				if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts))
4512
+					$translation_texts[] = $labels['label_post_map'];
4513
+				if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts))
4514
+					$translation_texts[] = $labels['label_reviews'];
4515
+				if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts))
4516
+					$translation_texts[] = $labels['label_related_listing'];
4517
+			}
4518
+
4519
+			if ($description != '' && !in_array($description, $translation_texts)) {
4520
+				$translation_texts[] = normalize_whitespace($description);
4521
+			}
4522
+
4523
+			if (!empty($seo)) {
4524
+				if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts))
4525
+					$translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4526
+
4527
+				if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts))
4528
+					$translation_texts[] = normalize_whitespace($seo['meta_description']);
4529
+			}
4530
+		}
4531
+	}
4532
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4533
+
4534
+	return $translation_texts;
4535 4535
 }
4536 4536
 
4537 4537
 /**
@@ -4544,27 +4544,27 @@  discard block
 block discarded – undo
4544 4544
  * @return array Location terms.
4545 4545
  */
4546 4546
 function geodir_remove_location_terms($location_terms = array()) {
4547
-    $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4548
-
4549
-    if (!empty($location_terms) && $location_manager) {
4550
-        $hide_country_part = get_option('geodir_location_hide_country_part');
4551
-        $hide_region_part = get_option('geodir_location_hide_region_part');
4552
-
4553
-        if ($hide_region_part && $hide_country_part) {
4554
-            if (isset($location_terms['gd_country']))
4555
-                unset($location_terms['gd_country']);
4556
-            if (isset($location_terms['gd_region']))
4557
-                unset($location_terms['gd_region']);
4558
-        } else if ($hide_region_part && !$hide_country_part) {
4559
-            if (isset($location_terms['gd_region']))
4560
-                unset($location_terms['gd_region']);
4561
-        } else if (!$hide_region_part && $hide_country_part) {
4562
-            if (isset($location_terms['gd_country']))
4563
-                unset($location_terms['gd_country']);
4564
-        }
4565
-    }
4566
-
4567
-    return $location_terms;
4547
+	$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4548
+
4549
+	if (!empty($location_terms) && $location_manager) {
4550
+		$hide_country_part = get_option('geodir_location_hide_country_part');
4551
+		$hide_region_part = get_option('geodir_location_hide_region_part');
4552
+
4553
+		if ($hide_region_part && $hide_country_part) {
4554
+			if (isset($location_terms['gd_country']))
4555
+				unset($location_terms['gd_country']);
4556
+			if (isset($location_terms['gd_region']))
4557
+				unset($location_terms['gd_region']);
4558
+		} else if ($hide_region_part && !$hide_country_part) {
4559
+			if (isset($location_terms['gd_region']))
4560
+				unset($location_terms['gd_region']);
4561
+		} else if (!$hide_region_part && $hide_country_part) {
4562
+			if (isset($location_terms['gd_country']))
4563
+				unset($location_terms['gd_country']);
4564
+		}
4565
+	}
4566
+
4567
+	return $location_terms;
4568 4568
 }
4569 4569
 
4570 4570
 /**
@@ -4578,47 +4578,47 @@  discard block
 block discarded – undo
4578 4578
  * @param bool $update Whether this is an existing listing being updated or not.
4579 4579
  */
4580 4580
 function geodir_on_wp_insert_post($post_ID, $post, $update) {
4581
-    if (!$update) {
4582
-        return;
4583
-    }
4581
+	if (!$update) {
4582
+		return;
4583
+	}
4584 4584
     
4585
-    $action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
4586
-    $is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) )  ? true : false;
4587
-    $inline_save = $action == 'inline-save' ? true : false;
4585
+	$action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
4586
+	$is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) )  ? true : false;
4587
+	$inline_save = $action == 'inline-save' ? true : false;
4588 4588
 
4589
-    if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
4590
-        return;
4591
-    }
4589
+	if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
4590
+		return;
4591
+	}
4592 4592
     
4593
-    if ($action != '' && in_array($action, array('geodir_import_export'))) {
4594
-        return;
4595
-    }
4593
+	if ($action != '' && in_array($action, array('geodir_import_export'))) {
4594
+		return;
4595
+	}
4596 4596
 
4597
-    $user_id = (int)get_current_user_id();
4597
+	$user_id = (int)get_current_user_id();
4598 4598
         
4599
-    if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4600
-        $author_id = !empty($post->post_author) ? $post->post_author : 0;
4599
+	if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4600
+		$author_id = !empty($post->post_author) ? $post->post_author : 0;
4601 4601
         
4602
-        if ($user_id == $author_id && !is_super_admin()) {
4603
-            $from_email = get_option('site_email');
4604
-            $from_name = get_site_emailName();
4605
-            $to_email = get_option('admin_email');
4606
-            $to_name = get_option('name');
4607
-            $message_type = 'listing_edited';
4602
+		if ($user_id == $author_id && !is_super_admin()) {
4603
+			$from_email = get_option('site_email');
4604
+			$from_name = get_site_emailName();
4605
+			$to_email = get_option('admin_email');
4606
+			$to_name = get_option('name');
4607
+			$message_type = 'listing_edited';
4608 4608
             
4609
-            $notify_edited = true;
4610
-            /**
4611
-             * Send notification when listing edited by author?
4612
-             *
4613
-             * @since 1.6.0
4614
-             * @param bool $notify_edited Notify on listing edited by author?
4615
-             * @param object $post The current post object.
4616
-             */
4617
-            $notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
4609
+			$notify_edited = true;
4610
+			/**
4611
+			 * Send notification when listing edited by author?
4612
+			 *
4613
+			 * @since 1.6.0
4614
+			 * @param bool $notify_edited Notify on listing edited by author?
4615
+			 * @param object $post The current post object.
4616
+			 */
4617
+			$notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
4618 4618
             
4619
-            geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
4620
-        }
4621
-    }
4619
+			geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
4620
+		}
4621
+	}
4622 4622
 }
4623 4623
 
4624 4624
 /**
@@ -4632,16 +4632,16 @@  discard block
 block discarded – undo
4632 4632
  * @return string|null The current page start & end numbering.
4633 4633
  */
4634 4634
 function geodir_title_meta_page($sep) {
4635
-    $replacement = null;
4635
+	$replacement = null;
4636 4636
 
4637
-    $max = geodir_title_meta_pagenumbering('max');
4638
-    $nr  = geodir_title_meta_pagenumbering('nr');
4637
+	$max = geodir_title_meta_pagenumbering('max');
4638
+	$nr  = geodir_title_meta_pagenumbering('nr');
4639 4639
 
4640
-    if ($max > 1 && $nr > 1) {
4641
-        $replacement = sprintf($sep . ' ' . __('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
4642
-    }
4640
+	if ($max > 1 && $nr > 1) {
4641
+		$replacement = sprintf($sep . ' ' . __('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
4642
+	}
4643 4643
 
4644
-    return $replacement;
4644
+	return $replacement;
4645 4645
 }
4646 4646
 
4647 4647
 /**
@@ -4653,14 +4653,14 @@  discard block
 block discarded – undo
4653 4653
  * @return string|null The current page number.
4654 4654
  */
4655 4655
 function geodir_title_meta_pagenumber() {
4656
-    $replacement = null;
4656
+	$replacement = null;
4657 4657
 
4658
-    $nr = geodir_title_meta_pagenumbering('nr');
4659
-    if (isset($nr) && $nr > 0) {
4660
-        $replacement = (string)$nr;
4661
-    }
4658
+	$nr = geodir_title_meta_pagenumbering('nr');
4659
+	if (isset($nr) && $nr > 0) {
4660
+		$replacement = (string)$nr;
4661
+	}
4662 4662
 
4663
-    return $replacement;
4663
+	return $replacement;
4664 4664
 }
4665 4665
 
4666 4666
 /**
@@ -4672,14 +4672,14 @@  discard block
 block discarded – undo
4672 4672
  * @return string|null The current page total.
4673 4673
  */
4674 4674
 function geodir_title_meta_pagetotal() {
4675
-    $replacement = null;
4675
+	$replacement = null;
4676 4676
 
4677
-    $max = geodir_title_meta_pagenumbering('max');
4678
-    if (isset($max) && $max > 0) {
4679
-        $replacement = (string)$max;
4680
-    }
4677
+	$max = geodir_title_meta_pagenumbering('max');
4678
+	if (isset($max) && $max > 0) {
4679
+		$replacement = (string)$max;
4680
+	}
4681 4681
 
4682
-    return $replacement;
4682
+	return $replacement;
4683 4683
 }
4684 4684
 
4685 4685
 /**
@@ -4696,44 +4696,44 @@  discard block
 block discarded – undo
4696 4696
  * @return int|null The current page numbering.
4697 4697
  */
4698 4698
 function geodir_title_meta_pagenumbering($request = 'nr') {
4699
-    global $wp_query, $post;
4700
-    $max_num_pages = null;
4701
-    $page_number   = null;
4702
-
4703
-    $max_num_pages = 1;
4704
-
4705
-    if (!is_singular()) {
4706
-        $page_number = get_query_var('paged');
4707
-        if ($page_number === 0 || $page_number === '') {
4708
-            $page_number = 1;
4709
-        }
4710
-
4711
-        if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) {
4712
-            $max_num_pages = $wp_query->max_num_pages;
4713
-        }
4714
-    } else {
4715
-        $page_number = get_query_var('page');
4716
-        if ($page_number === 0 || $page_number === '') {
4717
-            $page_number = 1;
4718
-        }
4719
-
4720
-        if (isset($post->post_content)) {
4721
-            $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->' ) + 1);
4722
-        }
4723
-    }
4724
-
4725
-    $return = null;
4726
-
4727
-    switch ($request) {
4728
-        case 'nr':
4729
-            $return = $page_number;
4730
-            break;
4731
-        case 'max':
4732
-            $return = $max_num_pages;
4733
-            break;
4734
-    }
4735
-
4736
-    return $return;
4699
+	global $wp_query, $post;
4700
+	$max_num_pages = null;
4701
+	$page_number   = null;
4702
+
4703
+	$max_num_pages = 1;
4704
+
4705
+	if (!is_singular()) {
4706
+		$page_number = get_query_var('paged');
4707
+		if ($page_number === 0 || $page_number === '') {
4708
+			$page_number = 1;
4709
+		}
4710
+
4711
+		if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) {
4712
+			$max_num_pages = $wp_query->max_num_pages;
4713
+		}
4714
+	} else {
4715
+		$page_number = get_query_var('page');
4716
+		if ($page_number === 0 || $page_number === '') {
4717
+			$page_number = 1;
4718
+		}
4719
+
4720
+		if (isset($post->post_content)) {
4721
+			$max_num_pages = (substr_count($post->post_content, '<!--nextpage-->' ) + 1);
4722
+		}
4723
+	}
4724
+
4725
+	$return = null;
4726
+
4727
+	switch ($request) {
4728
+		case 'nr':
4729
+			$return = $page_number;
4730
+			break;
4731
+		case 'max':
4732
+			$return = $max_num_pages;
4733
+			break;
4734
+	}
4735
+
4736
+	return $return;
4737 4737
 }
4738 4738
 
4739 4739
 /**
@@ -4745,15 +4745,15 @@  discard block
 block discarded – undo
4745 4745
  * @return array Terms.
4746 4746
  */
4747 4747
 function geodir_filter_empty_terms($terms) {
4748
-    if (empty($terms)) {
4749
-        return $terms;
4750
-    }
4751
-
4752
-    $return = array();
4753
-    foreach ($terms as $term) {
4754
-        if (isset($term->count) && $term->count > 0) {
4755
-            $return[] = $term;
4756
-        }
4757
-    }
4758
-    return $return;
4748
+	if (empty($terms)) {
4749
+		return $terms;
4750
+	}
4751
+
4752
+	$return = array();
4753
+	foreach ($terms as $term) {
4754
+		if (isset($term->count) && $term->count > 0) {
4755
+			$return[] = $term;
4756
+		}
4757
+	}
4758
+	return $return;
4759 4759
 }
4760 4760
\ No newline at end of file
Please login to merge, or discard this patch.