Passed
Pull Request — master (#221)
by Kiran
10:36
created
geodirectory-functions/general_functions.php 2 patches
Indentation   +2943 added lines, -2943 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);
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 139
 
140
-    return $link;
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
-            }
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 374
 
375 375
 
376
-        }
376
+		}
377 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
-        }
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 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
-        }
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 410
 
411 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
-        }
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 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
-            }
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 431
 
432
-        }
432
+		}
433 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;
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 436
 
437 437
 
438
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search']))
439
-            $wp->query_vars['gd_is_geodir_page'] = true;
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'));
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 513
 
514
-        }
514
+		}
515 515
 
516
-        return $imagesizes;
517
-    }
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($point2['latitude'] - $point1['latitude']);
621
-        $deltaLongitude = deg2rad($point2['longitude'] - $point1['longitude']);
622
-        $a = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
623
-            cos(deg2rad($point1['latitude'])) * cos(deg2rad($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($point2['latitude'] - $point1['latitude']);
621
+		$deltaLongitude = deg2rad($point2['longitude'] - $point1['longitude']);
622
+		$a = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
623
+			cos(deg2rad($point1['latitude'])) * cos(deg2rad($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,129 +688,129 @@  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);
691
+		$to_message = nl2br($to_message);
692
+		$sitefromEmail = get_option('site_email');
693
+		$sitefromEmailName = get_site_emailName();
694
+		$productlink = get_permalink($post_id);
695 695
 
696
-        $user_login = '';
697
-        if ($user_id > 0 && $user_info = get_userdata($user_id)) {
698
-            $user_login = $user_info->user_login;
699
-        }
696
+		$user_login = '';
697
+		if ($user_id > 0 && $user_info = get_userdata($user_id)) {
698
+			$user_login = $user_info->user_login;
699
+		}
700 700
 
701
-        $posted_date = '';
702
-        $listingLink = '';
701
+		$posted_date = '';
702
+		$listingLink = '';
703 703
 
704
-        $post_info = get_post($post_id);
704
+		$post_info = get_post($post_id);
705 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>';
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'));
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 718
 
719
-        if ($fromEmail == '') {
720
-            $fromEmail = get_option('site_email');
721
-        }
719
+		if ($fromEmail == '') {
720
+			$fromEmail = get_option('site_email');
721
+		}
722 722
 
723
-        if ($fromEmailName == '') {
724
-            $fromEmailName = get_option('site_email_name');
725
-        }
723
+		if ($fromEmailName == '') {
724
+			$fromEmailName = get_option('site_email_name');
725
+		}
726 726
 
727
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
728
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
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
-        $sent = wp_mail($to, $subject, $message, $headers);
742
-
743
-        if( ! $sent ) {
744
-            if ( is_array( $to ) ) {
745
-                $to = implode( ',', $to );
746
-            }
747
-            $log_message = sprintf(
748
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
749
-                $message_type,
750
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
751
-                $to,
752
-                $subject
753
-            );
754
-            geodir_error_log( $log_message );
755
-        }
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);
756 730
 
757
-        ///////// ADMIN BCC EMIALS
758
-        $adminEmail = get_bloginfo('admin_email');
759
-        $to = $adminEmail;
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);
760 734
 
761
-        $admin_bcc = false;
762
-        if ($message_type == 'post_submit') {
763
-            $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
764
-            $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
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";
765 739
 
766
-            $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#]');
767
-            $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);
768
-            $message = str_replace($search_array, $replace_array, $message);
740
+		$to = $toEmail;
741
+		$sent = wp_mail($to, $subject, $message, $headers);
769 742
 
770
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
771
-            $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
772
-            $subject = str_replace($search_array, $replace_array, $subject);
743
+		if( ! $sent ) {
744
+			if ( is_array( $to ) ) {
745
+				$to = implode( ',', $to );
746
+			}
747
+			$log_message = sprintf(
748
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
749
+				$message_type,
750
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
751
+				$to,
752
+				$subject
753
+			);
754
+			geodir_error_log( $log_message );
755
+		}
773 756
 
774
-            $subject .= ' - ADMIN BCC COPY';
775
-            $admin_bcc = true;
757
+		///////// ADMIN BCC EMIALS
758
+		$adminEmail = get_bloginfo('admin_email');
759
+		$to = $adminEmail;
776 760
 
777
-        }
778
-        elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
779
-            $subject .= ' - ADMIN BCC COPY';
780
-            $admin_bcc = true;
781
-        }
782
-        elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
783
-            $subject .= ' - ADMIN BCC COPY';
784
-            $admin_bcc = true;
785
-        }
786
-        elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
787
-            $subject .= ' - ADMIN BCC COPY';
788
-            $admin_bcc = true;
789
-        }
790
-        elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
791
-            $subject .= ' - ADMIN BCC COPY';
792
-            $admin_bcc = true;
793
-        }
761
+		$admin_bcc = false;
762
+		if ($message_type == 'post_submit') {
763
+			$subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
764
+			$message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
794 765
 
795
-        if($admin_bcc===true){
796
-            $sent = wp_mail($to, $subject, $message, $headers);
797
-
798
-            if( ! $sent ) {
799
-                if ( is_array( $to ) ) {
800
-                    $to = implode( ',', $to );
801
-                }
802
-                $log_message = sprintf(
803
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
804
-                    $message_type,
805
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
806
-                    $to,
807
-                    $subject
808
-                );
809
-                geodir_error_log( $log_message );
810
-            }
811
-        }
766
+			$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#]');
767
+			$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);
768
+			$message = str_replace($search_array, $replace_array, $message);
769
+
770
+			$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
771
+			$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
772
+			$subject = str_replace($search_array, $replace_array, $subject);
773
+
774
+			$subject .= ' - ADMIN BCC COPY';
775
+			$admin_bcc = true;
776
+
777
+		}
778
+		elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
779
+			$subject .= ' - ADMIN BCC COPY';
780
+			$admin_bcc = true;
781
+		}
782
+		elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
783
+			$subject .= ' - ADMIN BCC COPY';
784
+			$admin_bcc = true;
785
+		}
786
+		elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
787
+			$subject .= ' - ADMIN BCC COPY';
788
+			$admin_bcc = true;
789
+		}
790
+		elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
791
+			$subject .= ' - ADMIN BCC COPY';
792
+			$admin_bcc = true;
793
+		}
794
+
795
+		if($admin_bcc===true){
796
+			$sent = wp_mail($to, $subject, $message, $headers);
797
+
798
+			if( ! $sent ) {
799
+				if ( is_array( $to ) ) {
800
+					$to = implode( ',', $to );
801
+				}
802
+				$log_message = sprintf(
803
+					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
804
+					$message_type,
805
+					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
806
+					$to,
807
+					$subject
808
+				);
809
+				geodir_error_log( $log_message );
810
+			}
811
+		}
812 812
 
813
-    }
813
+	}
814 814
 }
815 815
 
816 816
 
@@ -823,27 +823,27 @@  discard block
 block discarded – undo
823 823
 function geodir_taxonomy_breadcrumb()
824 824
 {
825 825
 
826
-    $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
827
-    $parent = $term->parent;
826
+	$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
827
+	$parent = $term->parent;
828 828
 
829
-    while ($parent):
830
-        $parents[] = $parent;
831
-        $new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
832
-        $parent = $new_parent->parent;
833
-    endwhile;
829
+	while ($parent):
830
+		$parents[] = $parent;
831
+		$new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
832
+		$parent = $new_parent->parent;
833
+	endwhile;
834 834
 
835
-    if (!empty($parents)):
836
-        $parents = array_reverse($parents);
835
+	if (!empty($parents)):
836
+		$parents = array_reverse($parents);
837 837
 
838
-        foreach ($parents as $parent):
839
-            $item = get_term_by('id', $parent, get_query_var('taxonomy'));
840
-            $url = get_term_link($item, get_query_var('taxonomy'));
841
-            echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
842
-        endforeach;
838
+		foreach ($parents as $parent):
839
+			$item = get_term_by('id', $parent, get_query_var('taxonomy'));
840
+			$url = get_term_link($item, get_query_var('taxonomy'));
841
+			echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
842
+		endforeach;
843 843
 
844
-    endif;
844
+	endif;
845 845
 
846
-    echo '<li> > ' . $term->name . '</li>';
846
+	echo '<li> > ' . $term->name . '</li>';
847 847
 }
848 848
 
849 849
 
@@ -859,365 +859,365 @@  discard block
 block discarded – undo
859 859
  */
860 860
 function geodir_breadcrumb()
861 861
 {
862
-    global $wp_query, $geodir_add_location_url;
863
-
864
-    /**
865
-     * Filter breadcrumb separator.
866
-     *
867
-     * @since 1.0.0
868
-     */
869
-    $separator = apply_filters('geodir_breadcrumb_separator', ' > ');
870
-
871
-    if (!geodir_is_page('home')) {
872
-        $breadcrumb = '';
873
-        $url_categoris = '';
874
-        $breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
875
-        /**
876
-         * Filter breadcrumb's first link.
877
-         *
878
-         * @since 1.0.0
879
-         */
880
-        $breadcrumb .= '<li>' . apply_filters('geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __('Home', 'geodirectory') . '</a>') . '</li>';
862
+	global $wp_query, $geodir_add_location_url;
863
+
864
+	/**
865
+	 * Filter breadcrumb separator.
866
+	 *
867
+	 * @since 1.0.0
868
+	 */
869
+	$separator = apply_filters('geodir_breadcrumb_separator', ' > ');
870
+
871
+	if (!geodir_is_page('home')) {
872
+		$breadcrumb = '';
873
+		$url_categoris = '';
874
+		$breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
875
+		/**
876
+		 * Filter breadcrumb's first link.
877
+		 *
878
+		 * @since 1.0.0
879
+		 */
880
+		$breadcrumb .= '<li>' . apply_filters('geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __('Home', 'geodirectory') . '</a>') . '</li>';
881
+
882
+		$gd_post_type = geodir_get_current_posttype();
883
+		$post_type_info = get_post_type_object($gd_post_type);
884
+
885
+		remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
886
+
887
+		$listing_link = get_post_type_archive_link($gd_post_type);
888
+
889
+		add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
890
+		$listing_link = rtrim($listing_link, '/');
891
+		$listing_link .= '/';
892
+
893
+		$post_type_for_location_link = $listing_link;
894
+		$location_terms = geodir_get_current_location_terms('query_vars', $gd_post_type);
895
+
896
+		global $wp, $gd_session;
897
+		$location_link = $post_type_for_location_link;
898
+
899
+		if (geodir_is_page('detail') || geodir_is_page('listing')) {
900
+			global $post;
901
+			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
902
+			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
903
+				
904
+			if(geodir_is_page('detail') && isset($post->country_slug)){
905
+				$location_terms = array(
906
+					'gd_country' => $post->country_slug,
907
+					'gd_region' => $post->region_slug,
908
+					'gd_city' => $post->city_slug
909
+				);
910
+				
911
+				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
912
+					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
913
+				}
914
+			}
881 915
 
882
-        $gd_post_type = geodir_get_current_posttype();
883
-        $post_type_info = get_post_type_object($gd_post_type);
916
+			$geodir_show_location_url = get_option('geodir_show_location_url');
884 917
 
885
-        remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
918
+			$hide_url_part = array();
919
+			if ($location_manager) {
920
+				$hide_country_part = get_option('geodir_location_hide_country_part');
921
+				$hide_region_part = get_option('geodir_location_hide_region_part');
886 922
 
887
-        $listing_link = get_post_type_archive_link($gd_post_type);
923
+				if ($hide_region_part && $hide_country_part) {
924
+					$hide_url_part = array('gd_country', 'gd_region');
925
+				} else if ($hide_region_part && !$hide_country_part) {
926
+					$hide_url_part = array('gd_region');
927
+				} else if (!$hide_region_part && $hide_country_part) {
928
+					$hide_url_part = array('gd_country');
929
+				}
930
+			}
888 931
 
889
-        add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
890
-        $listing_link = rtrim($listing_link, '/');
891
-        $listing_link .= '/';
932
+			$hide_text_part = array();
933
+			if ($geodir_show_location_url == 'country_city') {
934
+				$hide_text_part = array('gd_region');
892 935
 
893
-        $post_type_for_location_link = $listing_link;
894
-        $location_terms = geodir_get_current_location_terms('query_vars', $gd_post_type);
936
+				if (isset($location_terms['gd_region']) && !$location_manager) {
937
+					unset($location_terms['gd_region']);
938
+				}
939
+			} else if ($geodir_show_location_url == 'region_city') {
940
+				$hide_text_part = array('gd_country');
895 941
 
896
-        global $wp, $gd_session;
897
-        $location_link = $post_type_for_location_link;
942
+				if (isset($location_terms['gd_country']) && !$location_manager) {
943
+					unset($location_terms['gd_country']);
944
+				}
945
+			} else if ($geodir_show_location_url == 'city') {
946
+				$hide_text_part = array('gd_country', 'gd_region');
898 947
 
899
-        if (geodir_is_page('detail') || geodir_is_page('listing')) {
900
-            global $post;
901
-            $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
902
-			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
903
-				
904
-			if(geodir_is_page('detail') && isset($post->country_slug)){
905
-                $location_terms = array(
906
-                    'gd_country' => $post->country_slug,
907
-                    'gd_region' => $post->region_slug,
908
-                    'gd_city' => $post->city_slug
909
-                );
910
-				
911
-				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
912
-					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
948
+				if (isset($location_terms['gd_country']) && !$location_manager) {
949
+					unset($location_terms['gd_country']);
913 950
 				}
914
-            }
915
-
916
-            $geodir_show_location_url = get_option('geodir_show_location_url');
917
-
918
-            $hide_url_part = array();
919
-            if ($location_manager) {
920
-                $hide_country_part = get_option('geodir_location_hide_country_part');
921
-                $hide_region_part = get_option('geodir_location_hide_region_part');
922
-
923
-                if ($hide_region_part && $hide_country_part) {
924
-                    $hide_url_part = array('gd_country', 'gd_region');
925
-                } else if ($hide_region_part && !$hide_country_part) {
926
-                    $hide_url_part = array('gd_region');
927
-                } else if (!$hide_region_part && $hide_country_part) {
928
-                    $hide_url_part = array('gd_country');
929
-                }
930
-            }
931
-
932
-            $hide_text_part = array();
933
-            if ($geodir_show_location_url == 'country_city') {
934
-                $hide_text_part = array('gd_region');
935
-
936
-                if (isset($location_terms['gd_region']) && !$location_manager) {
937
-                    unset($location_terms['gd_region']);
938
-                }
939
-            } else if ($geodir_show_location_url == 'region_city') {
940
-                $hide_text_part = array('gd_country');
941
-
942
-                if (isset($location_terms['gd_country']) && !$location_manager) {
943
-                    unset($location_terms['gd_country']);
944
-                }
945
-            } else if ($geodir_show_location_url == 'city') {
946
-                $hide_text_part = array('gd_country', 'gd_region');
947
-
948
-                if (isset($location_terms['gd_country']) && !$location_manager) {
949
-                    unset($location_terms['gd_country']);
950
-                }
951
-                if (isset($location_terms['gd_region']) && !$location_manager) {
952
-                    unset($location_terms['gd_region']);
953
-                }
954
-            }
955
-
956
-            $is_location_last = '';
957
-            $is_taxonomy_last = '';
958
-            $breadcrumb .= '<li>';
959
-            if (get_query_var($gd_post_type . 'category'))
960
-                $gd_taxonomy = $gd_post_type . 'category';
961
-            elseif (get_query_var($gd_post_type . '_tags'))
962
-                $gd_taxonomy = $gd_post_type . '_tags';
963
-
964
-            $breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
965
-            if (!empty($gd_taxonomy) || geodir_is_page('detail'))
966
-                $is_location_last = false;
967
-            else
968
-                $is_location_last = true;
969
-
970
-            if (!empty($gd_taxonomy) && geodir_is_page('listing'))
971
-                $is_taxonomy_last = true;
972
-            else
973
-                $is_taxonomy_last = false;
974
-
975
-            if (!empty($location_terms)) {
976
-                $geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
977
-
978
-                foreach ($location_terms as $key => $location_term) {
979
-                    if ($location_term != '') {
980
-                        if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
981
-                            continue;
982
-                        }
983
-
984
-                        $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
985
-                        $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
986
-                        $gd_location_link_text = ucfirst($gd_location_link_text);
987
-
988
-                        $location_term_actual_country = '';
989
-                        $location_term_actual_region = '';
990
-                        $location_term_actual_city = '';
991
-                        if ($geodir_get_locations) {
992
-                            if ($key == 'gd_country') {
993
-                                $location_term_actual_country = get_actual_location_name('country', $location_term, true);
994
-                            } else if ($key == 'gd_region') {
995
-                                $location_term_actual_region = get_actual_location_name('region', $location_term, true);
996
-                            } else if ($key == 'gd_city') {
997
-                                $location_term_actual_city = get_actual_location_name('city', $location_term, true);
998
-                            }
999
-                        } else {
1000
-                            $location_info = geodir_get_location();
1001
-
1002
-                            if (!empty($location_info) && isset($location_info->location_id)) {
1003
-                                if ($key == 'gd_country') {
1004
-                                    $location_term_actual_country = __($location_info->country, 'geodirectory');
1005
-                                } else if ($key == 'gd_region') {
1006
-                                    $location_term_actual_region = __($location_info->region, 'geodirectory');
1007
-                                } else if ($key == 'gd_city') {
1008
-                                    $location_term_actual_city = __($location_info->city, 'geodirectory');
1009
-                                }
1010
-                            }
1011
-                        }
1012
-
1013
-                        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'] != '')) {
1014
-                            $breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1015
-                        } else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1016
-                            $breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1017
-                        } else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1018
-                            $breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1019
-                        } else if ($is_location_last && $key == 'gd_neighbourhood') {
1020
-                            $breadcrumb .= $separator . $gd_location_link_text;
1021
-                        } else {
1022
-                            if (get_option('permalink_structure') != '') {
1023
-                                $location_link .= $location_term . '/';
1024
-                            } else {
1025
-                                $location_link .= "&$key=" . $location_term;
1026
-                            }
951
+				if (isset($location_terms['gd_region']) && !$location_manager) {
952
+					unset($location_terms['gd_region']);
953
+				}
954
+			}
1027 955
 
1028
-                            if ($key == 'gd_country' && $location_term_actual_country != '') {
1029
-                                $gd_location_link_text = $location_term_actual_country;
1030
-                            } else if ($key == 'gd_region' && $location_term_actual_region != '') {
1031
-                                $gd_location_link_text = $location_term_actual_region;
1032
-                            } else if ($key == 'gd_city' && $location_term_actual_city != '') {
1033
-                                $gd_location_link_text = $location_term_actual_city;
1034
-                            }
956
+			$is_location_last = '';
957
+			$is_taxonomy_last = '';
958
+			$breadcrumb .= '<li>';
959
+			if (get_query_var($gd_post_type . 'category'))
960
+				$gd_taxonomy = $gd_post_type . 'category';
961
+			elseif (get_query_var($gd_post_type . '_tags'))
962
+				$gd_taxonomy = $gd_post_type . '_tags';
963
+
964
+			$breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
965
+			if (!empty($gd_taxonomy) || geodir_is_page('detail'))
966
+				$is_location_last = false;
967
+			else
968
+				$is_location_last = true;
969
+
970
+			if (!empty($gd_taxonomy) && geodir_is_page('listing'))
971
+				$is_taxonomy_last = true;
972
+			else
973
+				$is_taxonomy_last = false;
974
+
975
+			if (!empty($location_terms)) {
976
+				$geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
977
+
978
+				foreach ($location_terms as $key => $location_term) {
979
+					if ($location_term != '') {
980
+						if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
981
+							continue;
982
+						}
1035 983
 
1036
-                            /*
984
+						$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
985
+						$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
986
+						$gd_location_link_text = ucfirst($gd_location_link_text);
987
+
988
+						$location_term_actual_country = '';
989
+						$location_term_actual_region = '';
990
+						$location_term_actual_city = '';
991
+						if ($geodir_get_locations) {
992
+							if ($key == 'gd_country') {
993
+								$location_term_actual_country = get_actual_location_name('country', $location_term, true);
994
+							} else if ($key == 'gd_region') {
995
+								$location_term_actual_region = get_actual_location_name('region', $location_term, true);
996
+							} else if ($key == 'gd_city') {
997
+								$location_term_actual_city = get_actual_location_name('city', $location_term, true);
998
+							}
999
+						} else {
1000
+							$location_info = geodir_get_location();
1001
+
1002
+							if (!empty($location_info) && isset($location_info->location_id)) {
1003
+								if ($key == 'gd_country') {
1004
+									$location_term_actual_country = __($location_info->country, 'geodirectory');
1005
+								} else if ($key == 'gd_region') {
1006
+									$location_term_actual_region = __($location_info->region, 'geodirectory');
1007
+								} else if ($key == 'gd_city') {
1008
+									$location_term_actual_city = __($location_info->city, 'geodirectory');
1009
+								}
1010
+							}
1011
+						}
1012
+
1013
+						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'] != '')) {
1014
+							$breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1015
+						} else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1016
+							$breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1017
+						} else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1018
+							$breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1019
+						} else if ($is_location_last && $key == 'gd_neighbourhood') {
1020
+							$breadcrumb .= $separator . $gd_location_link_text;
1021
+						} else {
1022
+							if (get_option('permalink_structure') != '') {
1023
+								$location_link .= $location_term . '/';
1024
+							} else {
1025
+								$location_link .= "&$key=" . $location_term;
1026
+							}
1027
+
1028
+							if ($key == 'gd_country' && $location_term_actual_country != '') {
1029
+								$gd_location_link_text = $location_term_actual_country;
1030
+							} else if ($key == 'gd_region' && $location_term_actual_region != '') {
1031
+								$gd_location_link_text = $location_term_actual_region;
1032
+							} else if ($key == 'gd_city' && $location_term_actual_city != '') {
1033
+								$gd_location_link_text = $location_term_actual_city;
1034
+							}
1035
+
1036
+							/*
1037 1037
                             if (geodir_is_page('detail') && !empty($hide_text_part) && in_array($key, $hide_text_part)) {
1038 1038
                                 continue;
1039 1039
                             }
1040 1040
                             */
1041 1041
 
1042
-                            $breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1043
-                        }
1044
-                    }
1045
-                }
1046
-            }
1047
-
1048
-            if (!empty($gd_taxonomy)) {
1049
-                $term_index = 1;
1050
-
1051
-                //if(get_option('geodir_add_categories_url'))
1052
-                {
1053
-                    if (get_query_var($gd_post_type . '_tags')) {
1054
-                        $cat_link = $listing_link . 'tags/';
1055
-                    } else
1056
-                        $cat_link = $listing_link;
1057
-
1058
-                    foreach ($location_terms as $key => $location_term) {
1059
-                        if ($location_manager && in_array($key, $hide_url_part)) {
1060
-                            continue;
1061
-                        }
1062
-
1063
-                        if ($location_term != '') {
1064
-                            if (get_option('permalink_structure') != '') {
1065
-                                $cat_link .= $location_term . '/';
1066
-                            }
1067
-                        }
1068
-                    }
1069
-
1070
-                    $term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1071
-                    foreach ($term_array as $term) {
1072
-                        $term_link_text = preg_replace('/-(\d+)$/', '', $term);
1073
-                        $term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1074
-
1075
-                        // get term actual name
1076
-                        $term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1077
-                        if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1078
-                            $term_link_text = urldecode($term_info['name']);
1079
-                        } else {
1080
-                            $term_link_text = geodir_ucwords(urldecode($term_link_text));
1081
-                        }
1082
-
1083
-                        if ($term_index == count($term_array) && $is_taxonomy_last)
1084
-                            $breadcrumb .= $separator . $term_link_text;
1085
-                        else {
1086
-                            $cat_link .= $term . '/';
1087
-                            $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1088
-                        }
1089
-                        $term_index++;
1090
-                    }
1091
-                }
1092
-
1093
-
1094
-            }
1095
-
1096
-            if (geodir_is_page('detail'))
1097
-                $breadcrumb .= $separator . get_the_title();
1098
-
1099
-            $breadcrumb .= '</li>';
1100
-
1101
-
1102
-        } elseif (geodir_is_page('author')) {
1103
-            $user_id = get_current_user_id();
1104
-            $author_link = get_author_posts_url($user_id);
1105
-            $default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
1106
-
1107
-            /**
1108
-             * Filter author page link.
1109
-             *
1110
-             * @since 1.0.0
1111
-             * @param string $default_author_link Default author link.
1112
-             * @param int $user_id Author ID.
1113
-             */
1114
-            $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1115
-
1116
-            $breadcrumb .= '<li>';
1117
-            $breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>';
1118
-
1119
-            if (isset($_REQUEST['list'])) {
1120
-                $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false);
1121
-
1122
-                /**
1123
-                 * Filter author page link.
1124
-                 *
1125
-                 * @since 1.0.0
1126
-                 * @param string $author_link Author page link.
1127
-                 * @param int $user_id Author ID.
1128
-                 * @param string $_REQUEST['stype'] Post type.
1129
-                 */
1130
-                $author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1131
-
1132
-                $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1133
-                $breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1134
-            } else
1135
-                $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1136
-
1137
-            $breadcrumb .= '</li>';
1138
-        } elseif (is_category() || is_single()) {
1139
-            $category = get_the_category();
1140
-            if (is_category()) {
1141
-                $breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1142
-            }
1143
-            if (is_single()) {
1144
-                $breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>';
1145
-                $breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1146
-            }
1147
-            /* End of my version ##################################################### */
1148
-        } else if (is_page()) {
1149
-            $page_title = get_the_title();
1150
-
1151
-            if (geodir_is_page('location')) {
1152
-                $page_title = defined('GD_LOCATION') ? GD_LOCATION : __('Location', 'geodirectory');
1153
-            }
1154
-
1155
-            $breadcrumb .= '<li>' . $separator;
1156
-            $breadcrumb .= stripslashes_deep($page_title);
1157
-            $breadcrumb .= '</li>';
1158
-        } else if (is_tag()) {
1159
-            $breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1160
-        } else if (is_day()) {
1161
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1162
-            the_time('F jS, Y');
1163
-            $breadcrumb .= '</li>';
1164
-        } else if (is_month()) {
1165
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1166
-            the_time('F, Y');
1167
-            $breadcrumb .= '</li>';
1168
-        } else if (is_year()) {
1169
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1170
-            the_time('Y');
1171
-            $breadcrumb .= '</li>';
1172
-        } else if (is_author()) {
1173
-            $breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory');
1174
-            $breadcrumb .= '</li>';
1175
-        } else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1176
-            $breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory');
1177
-            $breadcrumb .= '</li>';
1178
-        } else if (is_search()) {
1179
-            $breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory');
1180
-            $breadcrumb .= '</li>';
1181
-        }
1182
-        $breadcrumb .= '</ul></div>';
1183
-
1184
-        /**
1185
-         * Filter breadcrumb html output.
1186
-         *
1187
-         * @since 1.0.0
1188
-         * @param string $breadcrumb Breadcrumb HTML.
1189
-         * @param string $separator Breadcrumb separator.
1190
-         */
1191
-        echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1192
-    }
1042
+							$breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1043
+						}
1044
+					}
1045
+				}
1046
+			}
1047
+
1048
+			if (!empty($gd_taxonomy)) {
1049
+				$term_index = 1;
1050
+
1051
+				//if(get_option('geodir_add_categories_url'))
1052
+				{
1053
+					if (get_query_var($gd_post_type . '_tags')) {
1054
+						$cat_link = $listing_link . 'tags/';
1055
+					} else
1056
+						$cat_link = $listing_link;
1057
+
1058
+					foreach ($location_terms as $key => $location_term) {
1059
+						if ($location_manager && in_array($key, $hide_url_part)) {
1060
+							continue;
1061
+						}
1062
+
1063
+						if ($location_term != '') {
1064
+							if (get_option('permalink_structure') != '') {
1065
+								$cat_link .= $location_term . '/';
1066
+							}
1067
+						}
1068
+					}
1069
+
1070
+					$term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1071
+					foreach ($term_array as $term) {
1072
+						$term_link_text = preg_replace('/-(\d+)$/', '', $term);
1073
+						$term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1074
+
1075
+						// get term actual name
1076
+						$term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1077
+						if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1078
+							$term_link_text = urldecode($term_info['name']);
1079
+						} else {
1080
+							$term_link_text = geodir_ucwords(urldecode($term_link_text));
1081
+						}
1082
+
1083
+						if ($term_index == count($term_array) && $is_taxonomy_last)
1084
+							$breadcrumb .= $separator . $term_link_text;
1085
+						else {
1086
+							$cat_link .= $term . '/';
1087
+							$breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1088
+						}
1089
+						$term_index++;
1090
+					}
1091
+				}
1092
+
1093
+
1094
+			}
1095
+
1096
+			if (geodir_is_page('detail'))
1097
+				$breadcrumb .= $separator . get_the_title();
1098
+
1099
+			$breadcrumb .= '</li>';
1100
+
1101
+
1102
+		} elseif (geodir_is_page('author')) {
1103
+			$user_id = get_current_user_id();
1104
+			$author_link = get_author_posts_url($user_id);
1105
+			$default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
1106
+
1107
+			/**
1108
+			 * Filter author page link.
1109
+			 *
1110
+			 * @since 1.0.0
1111
+			 * @param string $default_author_link Default author link.
1112
+			 * @param int $user_id Author ID.
1113
+			 */
1114
+			$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1115
+
1116
+			$breadcrumb .= '<li>';
1117
+			$breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>';
1118
+
1119
+			if (isset($_REQUEST['list'])) {
1120
+				$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false);
1121
+
1122
+				/**
1123
+				 * Filter author page link.
1124
+				 *
1125
+				 * @since 1.0.0
1126
+				 * @param string $author_link Author page link.
1127
+				 * @param int $user_id Author ID.
1128
+				 * @param string $_REQUEST['stype'] Post type.
1129
+				 */
1130
+				$author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1131
+
1132
+				$breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1133
+				$breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1134
+			} else
1135
+				$breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1136
+
1137
+			$breadcrumb .= '</li>';
1138
+		} elseif (is_category() || is_single()) {
1139
+			$category = get_the_category();
1140
+			if (is_category()) {
1141
+				$breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1142
+			}
1143
+			if (is_single()) {
1144
+				$breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>';
1145
+				$breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1146
+			}
1147
+			/* End of my version ##################################################### */
1148
+		} else if (is_page()) {
1149
+			$page_title = get_the_title();
1150
+
1151
+			if (geodir_is_page('location')) {
1152
+				$page_title = defined('GD_LOCATION') ? GD_LOCATION : __('Location', 'geodirectory');
1153
+			}
1154
+
1155
+			$breadcrumb .= '<li>' . $separator;
1156
+			$breadcrumb .= stripslashes_deep($page_title);
1157
+			$breadcrumb .= '</li>';
1158
+		} else if (is_tag()) {
1159
+			$breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1160
+		} else if (is_day()) {
1161
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1162
+			the_time('F jS, Y');
1163
+			$breadcrumb .= '</li>';
1164
+		} else if (is_month()) {
1165
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1166
+			the_time('F, Y');
1167
+			$breadcrumb .= '</li>';
1168
+		} else if (is_year()) {
1169
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1170
+			the_time('Y');
1171
+			$breadcrumb .= '</li>';
1172
+		} else if (is_author()) {
1173
+			$breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory');
1174
+			$breadcrumb .= '</li>';
1175
+		} else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1176
+			$breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory');
1177
+			$breadcrumb .= '</li>';
1178
+		} else if (is_search()) {
1179
+			$breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory');
1180
+			$breadcrumb .= '</li>';
1181
+		}
1182
+		$breadcrumb .= '</ul></div>';
1183
+
1184
+		/**
1185
+		 * Filter breadcrumb html output.
1186
+		 *
1187
+		 * @since 1.0.0
1188
+		 * @param string $breadcrumb Breadcrumb HTML.
1189
+		 * @param string $separator Breadcrumb separator.
1190
+		 */
1191
+		echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1192
+	}
1193 1193
 }
1194 1194
 
1195 1195
 
1196 1196
 add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin
1197 1197
 if (!function_exists('geodir_allow_wpadmin')) {
1198
-    /**
1199
-     * Allow only admins to access wp-admin.
1200
-     *
1201
-     * Normal users will be redirected to home page.
1202
-     *
1203
-     * @since 1.0.0
1204
-     * @package GeoDirectory
1205
-     * @global object $wpdb WordPress Database object.
1206
-     */
1207
-    function geodir_allow_wpadmin()
1208
-    {
1209
-        global $wpdb;
1210
-        if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) // checking action in request to allow ajax request go through
1211
-        {
1212
-            if (current_user_can('manage_options')) {
1213
-            } else {
1214
-
1215
-                wp_redirect(home_url());
1216
-                exit;
1217
-            }
1198
+	/**
1199
+	 * Allow only admins to access wp-admin.
1200
+	 *
1201
+	 * Normal users will be redirected to home page.
1202
+	 *
1203
+	 * @since 1.0.0
1204
+	 * @package GeoDirectory
1205
+	 * @global object $wpdb WordPress Database object.
1206
+	 */
1207
+	function geodir_allow_wpadmin()
1208
+	{
1209
+		global $wpdb;
1210
+		if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) // checking action in request to allow ajax request go through
1211
+		{
1212
+			if (current_user_can('manage_options')) {
1213
+			} else {
1214
+
1215
+				wp_redirect(home_url());
1216
+				exit;
1217
+			}
1218 1218
 
1219
-        }
1220
-    }
1219
+		}
1220
+	}
1221 1221
 }
1222 1222
 
1223 1223
 
@@ -1231,50 +1231,50 @@  discard block
 block discarded – undo
1231 1231
  */
1232 1232
 function fetch_remote_file($url)
1233 1233
 {
1234
-    // extract the file name and extension from the url
1235
-    require_once(ABSPATH . 'wp-includes/pluggable.php');
1236
-    $file_name = basename($url);
1237
-    if (strpos($file_name, '?') !== false) {
1238
-        list($file_name) = explode('?', $file_name);
1239
-    }
1240
-
1241
-
1242
-    // get placeholder file in the upload dir with a unique, sanitized filename
1243
-
1244
-    $post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1245
-
1246
-    $upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1247
-    if ($upload['error'])
1248
-        return new WP_Error('upload_dir_error', $upload['error']);
1249
-
1250
-    // fetch the remote url and write it to the placeholder file
1251
-    $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1252
-
1253
-    $log_message = '';
1254
-    $filesize = filesize($upload['file']);
1255
-    // request failed
1256
-    if (!$headers) {
1257
-        $log_message = __('Remote server did not respond', 'geodirectory');
1258
-    }
1259
-    // make sure the fetch was successful
1260
-    elseif ($headers['response']['code'] != '200') {
1261
-        $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1262
-    }
1263
-    elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1264
-        $log_message =  __('Remote file is incorrect size', 'geodirectory');
1265
-    }
1266
-    elseif (0 == $filesize) {
1267
-        $log_message = __('Zero size file downloaded', 'geodirectory');
1268
-    }
1269
-
1270
-    if($log_message){
1271
-        $del = unlink($upload['file']);
1272
-        if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1273
-        return new WP_Error('import_file_error',$log_message );
1274
-    }
1275
-
1276
-
1277
-    return $upload;
1234
+	// extract the file name and extension from the url
1235
+	require_once(ABSPATH . 'wp-includes/pluggable.php');
1236
+	$file_name = basename($url);
1237
+	if (strpos($file_name, '?') !== false) {
1238
+		list($file_name) = explode('?', $file_name);
1239
+	}
1240
+
1241
+
1242
+	// get placeholder file in the upload dir with a unique, sanitized filename
1243
+
1244
+	$post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1245
+
1246
+	$upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1247
+	if ($upload['error'])
1248
+		return new WP_Error('upload_dir_error', $upload['error']);
1249
+
1250
+	// fetch the remote url and write it to the placeholder file
1251
+	$headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1252
+
1253
+	$log_message = '';
1254
+	$filesize = filesize($upload['file']);
1255
+	// request failed
1256
+	if (!$headers) {
1257
+		$log_message = __('Remote server did not respond', 'geodirectory');
1258
+	}
1259
+	// make sure the fetch was successful
1260
+	elseif ($headers['response']['code'] != '200') {
1261
+		$log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1262
+	}
1263
+	elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1264
+		$log_message =  __('Remote file is incorrect size', 'geodirectory');
1265
+	}
1266
+	elseif (0 == $filesize) {
1267
+		$log_message = __('Zero size file downloaded', 'geodirectory');
1268
+	}
1269
+
1270
+	if($log_message){
1271
+		$del = unlink($upload['file']);
1272
+		if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1273
+		return new WP_Error('import_file_error',$log_message );
1274
+	}
1275
+
1276
+
1277
+	return $upload;
1278 1278
 }
1279 1279
 
1280 1280
 /**
@@ -1286,21 +1286,21 @@  discard block
 block discarded – undo
1286 1286
  */
1287 1287
 function geodir_max_upload_size()
1288 1288
 {
1289
-    $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1290
-
1291
-    if ($max_filesize > 0 && $max_filesize < 1) {
1292
-        $max_filesize = (int)($max_filesize * 1024) . 'kb';
1293
-    } else {
1294
-        $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1295
-    }
1296
-
1297
-    /**
1298
-     * Filter default image upload size limit.
1299
-     *
1300
-     * @since 1.0.0
1301
-     * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1302
-     */
1303
-    return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1289
+	$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1290
+
1291
+	if ($max_filesize > 0 && $max_filesize < 1) {
1292
+		$max_filesize = (int)($max_filesize * 1024) . 'kb';
1293
+	} else {
1294
+		$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1295
+	}
1296
+
1297
+	/**
1298
+	 * Filter default image upload size limit.
1299
+	 *
1300
+	 * @since 1.0.0
1301
+	 * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1302
+	 */
1303
+	return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1304 1304
 }
1305 1305
 
1306 1306
 /**
@@ -1314,11 +1314,11 @@  discard block
 block discarded – undo
1314 1314
  */
1315 1315
 function geodir_dummy_folder_exists()
1316 1316
 {
1317
-    $path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1318
-    if (!is_dir($path))
1319
-        return false;
1320
-    else
1321
-        return true;
1317
+	$path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1318
+	if (!is_dir($path))
1319
+		return false;
1320
+	else
1321
+		return true;
1322 1322
 
1323 1323
 }
1324 1324
 
@@ -1333,237 +1333,237 @@  discard block
 block discarded – undo
1333 1333
  */
1334 1334
 function  geodir_get_author_info($aid)
1335 1335
 {
1336
-    global $wpdb;
1337
-    /*$infosql = "select * from $wpdb->users where ID=$aid";*/
1338
-    $infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1339
-    $info = $wpdb->get_results($infosql);
1340
-    if ($info) {
1341
-        return $info[0];
1342
-    }
1336
+	global $wpdb;
1337
+	/*$infosql = "select * from $wpdb->users where ID=$aid";*/
1338
+	$infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1339
+	$info = $wpdb->get_results($infosql);
1340
+	if ($info) {
1341
+		return $info[0];
1342
+	}
1343 1343
 }
1344 1344
 
1345 1345
 if (!function_exists('adminEmail')) {
1346
-    /**
1347
-     * Send emails to client on post submission, renew etc.
1348
-     *
1349
-     * @since 1.0.0
1350
-     * @package GeoDirectory
1351
-     * @global object $wpdb WordPress Database object.
1352
-     * @param int|string $page_id Page ID.
1353
-     * @param int|string $user_id User ID.
1354
-     * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1355
-     * @param string $custom_1 Custom data to be sent.
1356
-     */
1357
-    function adminEmail($page_id, $user_id, $message_type, $custom_1 = '')
1358
-    {
1359
-        global $wpdb;
1360
-        if ($message_type == 'expiration') {
1361
-            $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1362
-            $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1363
-        } elseif ($message_type == 'post_submited') {
1364
-            $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1365
-            $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1366
-        } elseif ($message_type == 'renew') {
1367
-            $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1368
-            $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1369
-        } elseif ($message_type == 'upgrade') {
1370
-            $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1371
-            $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1372
-        } elseif ($message_type == 'claim_approved') {
1373
-            $subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1374
-            $client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1375
-        } elseif ($message_type == 'claim_rejected') {
1376
-            $subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1377
-            $client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1378
-        } elseif ($message_type == 'claim_requested') {
1379
-            $subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1380
-            $client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1381
-        } elseif ($message_type == 'auto_claim') {
1382
-            $subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1383
-            $client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1384
-        } elseif ($message_type == 'payment_success') {
1385
-            $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1386
-            $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1387
-        } elseif ($message_type == 'payment_fail') {
1388
-            $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1389
-            $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1390
-        }
1391
-        $transaction_details = $custom_1;
1392
-        $fromEmail = get_option('site_email');
1393
-        $fromEmailName = get_site_emailName();
1346
+	/**
1347
+	 * Send emails to client on post submission, renew etc.
1348
+	 *
1349
+	 * @since 1.0.0
1350
+	 * @package GeoDirectory
1351
+	 * @global object $wpdb WordPress Database object.
1352
+	 * @param int|string $page_id Page ID.
1353
+	 * @param int|string $user_id User ID.
1354
+	 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1355
+	 * @param string $custom_1 Custom data to be sent.
1356
+	 */
1357
+	function adminEmail($page_id, $user_id, $message_type, $custom_1 = '')
1358
+	{
1359
+		global $wpdb;
1360
+		if ($message_type == 'expiration') {
1361
+			$subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1362
+			$client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1363
+		} elseif ($message_type == 'post_submited') {
1364
+			$subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1365
+			$client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1366
+		} elseif ($message_type == 'renew') {
1367
+			$subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1368
+			$client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1369
+		} elseif ($message_type == 'upgrade') {
1370
+			$subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1371
+			$client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1372
+		} elseif ($message_type == 'claim_approved') {
1373
+			$subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1374
+			$client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1375
+		} elseif ($message_type == 'claim_rejected') {
1376
+			$subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1377
+			$client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1378
+		} elseif ($message_type == 'claim_requested') {
1379
+			$subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1380
+			$client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1381
+		} elseif ($message_type == 'auto_claim') {
1382
+			$subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1383
+			$client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1384
+		} elseif ($message_type == 'payment_success') {
1385
+			$subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1386
+			$client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1387
+		} elseif ($message_type == 'payment_fail') {
1388
+			$subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1389
+			$client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1390
+		}
1391
+		$transaction_details = $custom_1;
1392
+		$fromEmail = get_option('site_email');
1393
+		$fromEmailName = get_site_emailName();
1394 1394
 //$alivedays = get_post_meta($page_id,'alive_days',true);
1395
-        $pkg_limit = get_property_price_info_listing($page_id);
1396
-        $alivedays = $pkg_limit['days'];
1397
-        $productlink = get_permalink($page_id);
1398
-        $post_info = get_post($page_id);
1399
-        $post_date = date('dS F,Y', strtotime($post_info->post_date));
1400
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1401
-        $loginurl = geodir_login_url();
1402
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1403
-        $siteurl = home_url();
1404
-        $siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1405
-        $user_info = get_userdata($user_id);
1406
-        $user_email = $user_info->user_email;
1407
-        $display_name = geodir_get_client_name($user_id);
1408
-        $user_login = $user_info->user_login;
1409
-        $number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1410
-        if ($number_of_grace_days == '') {
1411
-            $number_of_grace_days = 1;
1412
-        }
1413
-        if ($post_info->post_type == 'event') {
1414
-            $post_type = 'event';
1415
-        } else {
1416
-            $post_type = 'listing';
1417
-        }
1418
-        $renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1419
-        $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#]');
1420
-        $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);
1421
-        $client_message = str_replace($search_array, $replace_array, $client_message);
1422
-        $subject = str_replace($search_array, $replace_array, $subject);
1423
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1424
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1425
-        $headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1426
-
1427
-        $to = $fromEmail;
1428
-        $message = $client_message;
1429
-        $sent = wp_mail($to, $subject, $message, $headers);
1430
-        if( ! $sent ) {
1431
-            if ( is_array( $to ) ) {
1432
-                $to = implode( ',', $to );
1433
-            }
1434
-            $log_message = sprintf(
1435
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1436
-                $message_type,
1437
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1438
-                $to,
1439
-                $subject
1440
-            );
1441
-            geodir_error_log( $log_message );
1442
-        }
1443
-    }
1395
+		$pkg_limit = get_property_price_info_listing($page_id);
1396
+		$alivedays = $pkg_limit['days'];
1397
+		$productlink = get_permalink($page_id);
1398
+		$post_info = get_post($page_id);
1399
+		$post_date = date('dS F,Y', strtotime($post_info->post_date));
1400
+		$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1401
+		$loginurl = geodir_login_url();
1402
+		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
1403
+		$siteurl = home_url();
1404
+		$siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1405
+		$user_info = get_userdata($user_id);
1406
+		$user_email = $user_info->user_email;
1407
+		$display_name = geodir_get_client_name($user_id);
1408
+		$user_login = $user_info->user_login;
1409
+		$number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1410
+		if ($number_of_grace_days == '') {
1411
+			$number_of_grace_days = 1;
1412
+		}
1413
+		if ($post_info->post_type == 'event') {
1414
+			$post_type = 'event';
1415
+		} else {
1416
+			$post_type = 'listing';
1417
+		}
1418
+		$renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1419
+		$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#]');
1420
+		$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);
1421
+		$client_message = str_replace($search_array, $replace_array, $client_message);
1422
+		$subject = str_replace($search_array, $replace_array, $subject);
1423
+		$headers = 'MIME-Version: 1.0' . "\r\n";
1424
+		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1425
+		$headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1426
+
1427
+		$to = $fromEmail;
1428
+		$message = $client_message;
1429
+		$sent = wp_mail($to, $subject, $message, $headers);
1430
+		if( ! $sent ) {
1431
+			if ( is_array( $to ) ) {
1432
+				$to = implode( ',', $to );
1433
+			}
1434
+			$log_message = sprintf(
1435
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1436
+				$message_type,
1437
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1438
+				$to,
1439
+				$subject
1440
+			);
1441
+			geodir_error_log( $log_message );
1442
+		}
1443
+	}
1444 1444
 }
1445 1445
 
1446 1446
 if (!function_exists('sendEmail')) {
1447
-    /**
1448
-     * @todo could be a duplicate of geodir_sendEmail.
1449
-     *
1450
-     * @since 1.0.0
1451
-     * @package GeoDirectory
1452
-     * @param string $fromEmail Sender email address.
1453
-     * @param string $fromEmailName Sender name.
1454
-     * @param string $toEmail Receiver email address.
1455
-     * @param string $toEmailName Receiver name.
1456
-     * @param string $to_subject Email subject.
1457
-     * @param string $to_message Email content.
1458
-     * @param string $extra Not being used.
1459
-     * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration.
1460
-     * @param string $post_id The post ID.
1461
-     * @param string $user_id The user ID.
1462
-     */
1463
-    function sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '')
1464
-    {
1465
-        $login_details = '';
1466
-        if ($message_type == 'send_friend') {
1467
-            $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1468
-            $message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1469
-        } elseif ($message_type == 'send_enquiry') {
1470
-            $subject = __(get_option('email_enquiry_subject'),'geodirectory');
1471
-            $message = __(get_option('email_enquiry_content'),'geodirectory');
1472
-        } elseif ($message_type == 'forgot_password') {
1473
-            $subject = __(get_option('forgot_password_subject'),'geodirectory');
1474
-            $message = __(get_option('forgot_password_content'),'geodirectory');
1475
-            $login_details = $to_message;
1476
-        } elseif ($message_type == 'registration') {
1477
-            $subject = __(get_option('registration_success_email_subject'),'geodirectory');
1478
-            $message = __(get_option('registration_success_email_content'),'geodirectory');
1479
-            $login_details = $to_message;
1480
-        }
1481
-        $to_message = nl2br($to_message);
1482
-        $sitefromEmail = get_option('site_email');
1483
-        $sitefromEmailName = get_site_emailName();
1484
-        $productlink = get_permalink($post_id);
1485
-        $post_info = get_post($post_id);
1486
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1487
-        $siteurl = home_url();
1488
-        $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1489
-        $loginurl = geodir_login_url();
1490
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1491
-        if ($fromEmail == '') {
1492
-            $fromEmail = get_option('site_email');
1493
-        }
1494
-        if ($fromEmailName == '') {
1495
-            $fromEmailName = get_option('site_email_name');
1496
-        }
1497
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]');
1498
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName);
1499
-        $message = str_replace($search_array, $replace_array, $message);
1500
-
1501
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]');
1502
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName);
1503
-        $subject = str_replace($search_array, $replace_array, $subject);
1504
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1505
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1506
-        $headers .= "Reply-To: " . $fromEmail . "\r\n";
1507
-        $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1508
-
1509
-        $to = $toEmail;
1510
-
1511
-        $sent = wp_mail($to, $subject, $message, $headers);
1512
-        if( ! $sent ) {
1513
-            if ( is_array( $to ) ) {
1514
-                $to = implode( ',', $to );
1515
-            }
1516
-            $log_message = sprintf(
1517
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1518
-                $message_type,
1519
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1520
-                $to,
1521
-                $subject
1522
-            );
1523
-            geodir_error_log( $log_message );
1524
-        }
1447
+	/**
1448
+	 * @todo could be a duplicate of geodir_sendEmail.
1449
+	 *
1450
+	 * @since 1.0.0
1451
+	 * @package GeoDirectory
1452
+	 * @param string $fromEmail Sender email address.
1453
+	 * @param string $fromEmailName Sender name.
1454
+	 * @param string $toEmail Receiver email address.
1455
+	 * @param string $toEmailName Receiver name.
1456
+	 * @param string $to_subject Email subject.
1457
+	 * @param string $to_message Email content.
1458
+	 * @param string $extra Not being used.
1459
+	 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration.
1460
+	 * @param string $post_id The post ID.
1461
+	 * @param string $user_id The user ID.
1462
+	 */
1463
+	function sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '')
1464
+	{
1465
+		$login_details = '';
1466
+		if ($message_type == 'send_friend') {
1467
+			$subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1468
+			$message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1469
+		} elseif ($message_type == 'send_enquiry') {
1470
+			$subject = __(get_option('email_enquiry_subject'),'geodirectory');
1471
+			$message = __(get_option('email_enquiry_content'),'geodirectory');
1472
+		} elseif ($message_type == 'forgot_password') {
1473
+			$subject = __(get_option('forgot_password_subject'),'geodirectory');
1474
+			$message = __(get_option('forgot_password_content'),'geodirectory');
1475
+			$login_details = $to_message;
1476
+		} elseif ($message_type == 'registration') {
1477
+			$subject = __(get_option('registration_success_email_subject'),'geodirectory');
1478
+			$message = __(get_option('registration_success_email_content'),'geodirectory');
1479
+			$login_details = $to_message;
1480
+		}
1481
+		$to_message = nl2br($to_message);
1482
+		$sitefromEmail = get_option('site_email');
1483
+		$sitefromEmailName = get_site_emailName();
1484
+		$productlink = get_permalink($post_id);
1485
+		$post_info = get_post($post_id);
1486
+		$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1487
+		$siteurl = home_url();
1488
+		$siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1489
+		$loginurl = geodir_login_url();
1490
+		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
1491
+		if ($fromEmail == '') {
1492
+			$fromEmail = get_option('site_email');
1493
+		}
1494
+		if ($fromEmailName == '') {
1495
+			$fromEmailName = get_option('site_email_name');
1496
+		}
1497
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]');
1498
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName);
1499
+		$message = str_replace($search_array, $replace_array, $message);
1500
+
1501
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]');
1502
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName);
1503
+		$subject = str_replace($search_array, $replace_array, $subject);
1504
+		$headers = 'MIME-Version: 1.0' . "\r\n";
1505
+		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1506
+		$headers .= "Reply-To: " . $fromEmail . "\r\n";
1507
+		$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1508
+
1509
+		$to = $toEmail;
1510
+
1511
+		$sent = wp_mail($to, $subject, $message, $headers);
1512
+		if( ! $sent ) {
1513
+			if ( is_array( $to ) ) {
1514
+				$to = implode( ',', $to );
1515
+			}
1516
+			$log_message = sprintf(
1517
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1518
+				$message_type,
1519
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1520
+				$to,
1521
+				$subject
1522
+			);
1523
+			geodir_error_log( $log_message );
1524
+		}
1525 1525
 
1526
-        ///////// ADMIN BCC EMIALS
1527
-        $admin_bcc = false;
1528
-        if ($message_type == 'registration') {
1529
-            $message_raw = explode(__("Password:", 'geodirectory'), $message);
1530
-            $message_raw2 = explode("</p>", $message_raw[1], 2);
1531
-            $message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1];
1532
-        }
1533
-        $adminEmail = get_bloginfo('admin_email');
1534
-        $to = $adminEmail;
1526
+		///////// ADMIN BCC EMIALS
1527
+		$admin_bcc = false;
1528
+		if ($message_type == 'registration') {
1529
+			$message_raw = explode(__("Password:", 'geodirectory'), $message);
1530
+			$message_raw2 = explode("</p>", $message_raw[1], 2);
1531
+			$message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1];
1532
+		}
1533
+		$adminEmail = get_bloginfo('admin_email');
1534
+		$to = $adminEmail;
1535 1535
 
1536
-        if ($message_type == 'registration' && get_option('bcc_new_user')) {
1537
-            $subject .= ' - ADMIN BCC COPY';
1538
-            $admin_bcc = true;
1539
-        }
1540
-        elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1541
-            $subject .= ' - ADMIN BCC COPY';
1542
-            $admin_bcc = true;
1543
-        }
1544
-        elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1545
-            $subject .= ' - ADMIN BCC COPY';
1546
-            $admin_bcc = true;
1547
-        }
1536
+		if ($message_type == 'registration' && get_option('bcc_new_user')) {
1537
+			$subject .= ' - ADMIN BCC COPY';
1538
+			$admin_bcc = true;
1539
+		}
1540
+		elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1541
+			$subject .= ' - ADMIN BCC COPY';
1542
+			$admin_bcc = true;
1543
+		}
1544
+		elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1545
+			$subject .= ' - ADMIN BCC COPY';
1546
+			$admin_bcc = true;
1547
+		}
1548 1548
 
1549
-        if($admin_bcc === true){
1550
-            $sent = wp_mail($to, $subject, $message, $headers);
1551
-            if( ! $sent ) {
1552
-                if ( is_array( $to ) ) {
1553
-                    $to = implode( ',', $to );
1554
-                }
1555
-                $log_message = sprintf(
1556
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1557
-                    $message_type,
1558
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1559
-                    $to,
1560
-                    $subject
1561
-                );
1562
-                geodir_error_log( $log_message );
1563
-            }
1564
-        }
1549
+		if($admin_bcc === true){
1550
+			$sent = wp_mail($to, $subject, $message, $headers);
1551
+			if( ! $sent ) {
1552
+				if ( is_array( $to ) ) {
1553
+					$to = implode( ',', $to );
1554
+				}
1555
+				$log_message = sprintf(
1556
+					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1557
+					$message_type,
1558
+					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1559
+					$to,
1560
+					$subject
1561
+				);
1562
+				geodir_error_log( $log_message );
1563
+			}
1564
+		}
1565 1565
 
1566
-    }
1566
+	}
1567 1567
 }
1568 1568
 
1569 1569
 /*
@@ -1581,16 +1581,16 @@  discard block
 block discarded – undo
1581 1581
  */
1582 1582
 function gd_lang_object_ids($ids_array, $type)
1583 1583
 {
1584
-    if (function_exists('icl_object_id')) {
1585
-        $res = array();
1586
-        foreach ($ids_array as $id) {
1587
-            $xlat = icl_object_id($id, $type, false);
1588
-            if (!is_null($xlat)) $res[] = $xlat;
1589
-        }
1590
-        return $res;
1591
-    } else {
1592
-        return $ids_array;
1593
-    }
1584
+	if (function_exists('icl_object_id')) {
1585
+		$res = array();
1586
+		foreach ($ids_array as $id) {
1587
+			$xlat = icl_object_id($id, $type, false);
1588
+			if (!is_null($xlat)) $res[] = $xlat;
1589
+		}
1590
+		return $res;
1591
+	} else {
1592
+		return $ids_array;
1593
+	}
1594 1594
 }
1595 1595
 
1596 1596
 
@@ -1605,31 +1605,31 @@  discard block
 block discarded – undo
1605 1605
  * @return array Modified Body CSS classes.
1606 1606
  */
1607 1607
 function geodir_custom_posts_body_class($classes) {
1608
-    global $wpdb, $wp;
1609
-    $post_types = geodir_get_posttypes('object');
1610
-    if (!empty($post_types) && count((array)$post_types) > 1) {
1611
-        $classes[] = 'geodir_custom_posts';
1612
-    }
1613
-
1614
-    // fix body class for signup page
1615
-    if (geodir_is_page('login')) {
1616
-        $new_classes = array();
1617
-        $new_classes[] = 'signup page-geodir-signup';
1618
-        if (!empty($classes)) {
1619
-            foreach ($classes as $class) {
1620
-                if ($class && $class != 'home' && $class != 'blog') {
1621
-                    $new_classes[] = $class;
1622
-                }
1623
-            }
1624
-        }
1625
-        $classes = $new_classes;
1626
-    }
1608
+	global $wpdb, $wp;
1609
+	$post_types = geodir_get_posttypes('object');
1610
+	if (!empty($post_types) && count((array)$post_types) > 1) {
1611
+		$classes[] = 'geodir_custom_posts';
1612
+	}
1613
+
1614
+	// fix body class for signup page
1615
+	if (geodir_is_page('login')) {
1616
+		$new_classes = array();
1617
+		$new_classes[] = 'signup page-geodir-signup';
1618
+		if (!empty($classes)) {
1619
+			foreach ($classes as $class) {
1620
+				if ($class && $class != 'home' && $class != 'blog') {
1621
+					$new_classes[] = $class;
1622
+				}
1623
+			}
1624
+		}
1625
+		$classes = $new_classes;
1626
+	}
1627 1627
 
1628
-    if (geodir_is_geodir_page()) {
1629
-        $classes[] = 'geodir-page';
1630
-    }
1628
+	if (geodir_is_geodir_page()) {
1629
+		$classes[] = 'geodir-page';
1630
+	}
1631 1631
 
1632
-    return $classes;
1632
+	return $classes;
1633 1633
 }
1634 1634
 
1635 1635
 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
@@ -1644,12 +1644,12 @@  discard block
 block discarded – undo
1644 1644
  */
1645 1645
 function geodir_map_zoom_level()
1646 1646
 {
1647
-    /**
1648
-     * Filter GD map zoom level.
1649
-     *
1650
-     * @since 1.0.0
1651
-     */
1652
-    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));
1647
+	/**
1648
+	 * Filter GD map zoom level.
1649
+	 *
1650
+	 * @since 1.0.0
1651
+	 */
1652
+	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));
1653 1653
 
1654 1654
 }
1655 1655
 
@@ -1663,12 +1663,12 @@  discard block
 block discarded – undo
1663 1663
  */
1664 1664
 function geodir_option_version_backup($geodir_option_name)
1665 1665
 {
1666
-    $version_date = time();
1667
-    $geodir_option = get_option($geodir_option_name);
1666
+	$version_date = time();
1667
+	$geodir_option = get_option($geodir_option_name);
1668 1668
 
1669
-    if (!empty($geodir_option)) {
1670
-        add_option($geodir_option_name . '_' . $version_date, $geodir_option);
1671
-    }
1669
+	if (!empty($geodir_option)) {
1670
+		add_option($geodir_option_name . '_' . $version_date, $geodir_option);
1671
+	}
1672 1672
 }
1673 1673
 
1674 1674
 /**
@@ -1681,11 +1681,11 @@  discard block
 block discarded – undo
1681 1681
  */
1682 1682
 function get_page_id_geodir_add_listing_page($page_id)
1683 1683
 {
1684
-    if (geodir_wpml_multilingual_status()) {
1685
-        $post_type = 'post_page';
1686
-        $page_id = geodir_get_wpml_element_id($page_id, $post_type);
1687
-    }
1688
-    return $page_id;
1684
+	if (geodir_wpml_multilingual_status()) {
1685
+		$post_type = 'post_page';
1686
+		$page_id = geodir_get_wpml_element_id($page_id, $post_type);
1687
+	}
1688
+	return $page_id;
1689 1689
 }
1690 1690
 
1691 1691
 /**
@@ -1697,10 +1697,10 @@  discard block
 block discarded – undo
1697 1697
  */
1698 1698
 function geodir_wpml_multilingual_status()
1699 1699
 {
1700
-    if (function_exists('icl_object_id')) {
1701
-        return true;
1702
-    }
1703
-    return false;
1700
+	if (function_exists('icl_object_id')) {
1701
+		return true;
1702
+	}
1703
+	return false;
1704 1704
 }
1705 1705
 
1706 1706
 /**
@@ -1714,22 +1714,22 @@  discard block
 block discarded – undo
1714 1714
  */
1715 1715
 function geodir_get_wpml_element_id($page_id, $post_type)
1716 1716
 {
1717
-    global $sitepress;
1718
-    if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1719
-        $trid = $sitepress->get_element_trid($page_id, $post_type);
1717
+	global $sitepress;
1718
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1719
+		$trid = $sitepress->get_element_trid($page_id, $post_type);
1720 1720
 
1721
-        if ($trid > 0) {
1722
-            $translations = $sitepress->get_element_translations($trid, $post_type);
1721
+		if ($trid > 0) {
1722
+			$translations = $sitepress->get_element_translations($trid, $post_type);
1723 1723
 
1724
-            $lang = $sitepress->get_current_language();
1725
-            $lang = $lang ? $lang : $sitepress->get_default_language();
1724
+			$lang = $sitepress->get_current_language();
1725
+			$lang = $lang ? $lang : $sitepress->get_default_language();
1726 1726
 
1727
-            if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
1728
-                $page_id = $translations[$lang]->element_id;
1729
-            }
1730
-        }
1731
-    }
1732
-    return $page_id;
1727
+			if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
1728
+				$page_id = $translations[$lang]->element_id;
1729
+			}
1730
+		}
1731
+	}
1732
+	return $page_id;
1733 1733
 }
1734 1734
 
1735 1735
 /**
@@ -1741,20 +1741,20 @@  discard block
 block discarded – undo
1741 1741
  */
1742 1742
 function geodir_wpml_check_element_id()
1743 1743
 {
1744
-    global $sitepress;
1745
-    if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1746
-        $el_type = 'post_page';
1747
-        $el_id = get_option('geodir_add_listing_page');
1748
-        $default_lang = $sitepress->get_default_language();
1749
-        $el_details = $sitepress->get_element_language_details($el_id, $el_type);
1750
-
1751
-        if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
1752
-            if (!$el_details->source_language_code) {
1753
-                $sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
1754
-                $sitepress->icl_translations_cache->clear();
1755
-            }
1756
-        }
1757
-    }
1744
+	global $sitepress;
1745
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1746
+		$el_type = 'post_page';
1747
+		$el_id = get_option('geodir_add_listing_page');
1748
+		$default_lang = $sitepress->get_default_language();
1749
+		$el_details = $sitepress->get_element_language_details($el_id, $el_type);
1750
+
1751
+		if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
1752
+			if (!$el_details->source_language_code) {
1753
+				$sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
1754
+				$sitepress->icl_translations_cache->clear();
1755
+			}
1756
+		}
1757
+	}
1758 1758
 }
1759 1759
 
1760 1760
 /**
@@ -1769,44 +1769,44 @@  discard block
 block discarded – undo
1769 1769
  */
1770 1770
 function geodir_widget_listings_get_order($query_args)
1771 1771
 {
1772
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1773
-
1774
-    $query_args = $gd_query_args_widgets;
1775
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1776
-        return $wpdb->posts . ".post_date DESC, ";
1777
-    }
1778
-
1779
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1780
-    $table = $plugin_prefix . $post_type . '_detail';
1781
-
1782
-    $sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
1783
-
1784
-    switch ($sort_by) {
1785
-        case 'latest':
1786
-        case 'newest':
1787
-            $orderby = $wpdb->posts . ".post_date DESC, ";
1788
-            break;
1789
-        case 'featured':
1790
-            $orderby = $table . ".is_featured ASC, ";
1791
-            break;
1792
-        case 'az':
1793
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1794
-            break;
1795
-        case 'high_review':
1796
-            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
1797
-            break;
1798
-        case 'high_rating':
1799
-            $orderby = "( " . $table . ".overall_rating  ) DESC, ";
1800
-            break;
1801
-        case 'random':
1802
-            $orderby = "RAND(), ";
1803
-            break;
1804
-        default:
1805
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1806
-            break;
1807
-    }
1808
-
1809
-    return $orderby;
1772
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1773
+
1774
+	$query_args = $gd_query_args_widgets;
1775
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1776
+		return $wpdb->posts . ".post_date DESC, ";
1777
+	}
1778
+
1779
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1780
+	$table = $plugin_prefix . $post_type . '_detail';
1781
+
1782
+	$sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
1783
+
1784
+	switch ($sort_by) {
1785
+		case 'latest':
1786
+		case 'newest':
1787
+			$orderby = $wpdb->posts . ".post_date DESC, ";
1788
+			break;
1789
+		case 'featured':
1790
+			$orderby = $table . ".is_featured ASC, ";
1791
+			break;
1792
+		case 'az':
1793
+			$orderby = $wpdb->posts . ".post_title ASC, ";
1794
+			break;
1795
+		case 'high_review':
1796
+			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
1797
+			break;
1798
+		case 'high_rating':
1799
+			$orderby = "( " . $table . ".overall_rating  ) DESC, ";
1800
+			break;
1801
+		case 'random':
1802
+			$orderby = "RAND(), ";
1803
+			break;
1804
+		default:
1805
+			$orderby = $wpdb->posts . ".post_title ASC, ";
1806
+			break;
1807
+	}
1808
+
1809
+	return $orderby;
1810 1810
 }
1811 1811
 
1812 1812
 /**
@@ -1824,127 +1824,127 @@  discard block
 block discarded – undo
1824 1824
  */
1825 1825
 function geodir_get_widget_listings($query_args = array(), $count_only = false)
1826 1826
 {
1827
-    global $wpdb, $plugin_prefix, $table_prefix;
1828
-    $GLOBALS['gd_query_args_widgets'] = $query_args;
1829
-    $gd_query_args_widgets = $query_args;
1830
-
1831
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1832
-    $table = $plugin_prefix . $post_type . '_detail';
1833
-
1834
-    $fields = $wpdb->posts . ".*, " . $table . ".*";
1835
-    /**
1836
-     * Filter widget listing fields string part that is being used for query.
1837
-     *
1838
-     * @since 1.0.0
1839
-     * @param string $fields Fields string.
1840
-     * @param string $table Table name.
1841
-     * @param string $post_type Post type.
1842
-     */
1843
-    $fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
1844
-
1845
-    $join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
1846
-
1847
-    ########### WPML ###########
1848
-
1849
-    if (function_exists('icl_object_id')) {
1850
-        global $sitepress;
1851
-        $lang_code = ICL_LANGUAGE_CODE;
1852
-        $default_lang_code = $sitepress->get_default_language();
1853
-        if ($lang_code) {
1854
-            $join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
1855
-        }
1856
-    }
1827
+	global $wpdb, $plugin_prefix, $table_prefix;
1828
+	$GLOBALS['gd_query_args_widgets'] = $query_args;
1829
+	$gd_query_args_widgets = $query_args;
1830
+
1831
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1832
+	$table = $plugin_prefix . $post_type . '_detail';
1833
+
1834
+	$fields = $wpdb->posts . ".*, " . $table . ".*";
1835
+	/**
1836
+	 * Filter widget listing fields string part that is being used for query.
1837
+	 *
1838
+	 * @since 1.0.0
1839
+	 * @param string $fields Fields string.
1840
+	 * @param string $table Table name.
1841
+	 * @param string $post_type Post type.
1842
+	 */
1843
+	$fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
1844
+
1845
+	$join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
1846
+
1847
+	########### WPML ###########
1848
+
1849
+	if (function_exists('icl_object_id')) {
1850
+		global $sitepress;
1851
+		$lang_code = ICL_LANGUAGE_CODE;
1852
+		$default_lang_code = $sitepress->get_default_language();
1853
+		if ($lang_code) {
1854
+			$join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
1855
+		}
1856
+	}
1857 1857
 
1858
-    ########### WPML ###########
1858
+	########### WPML ###########
1859 1859
 
1860
-    /**
1861
-     * Filter widget listing join clause string part that is being used for query.
1862
-     *
1863
-     * @since 1.0.0
1864
-     * @param string $join Join clause string.
1865
-     * @param string $post_type Post type.
1866
-     */
1867
-    $join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
1860
+	/**
1861
+	 * Filter widget listing join clause string part that is being used for query.
1862
+	 *
1863
+	 * @since 1.0.0
1864
+	 * @param string $join Join clause string.
1865
+	 * @param string $post_type Post type.
1866
+	 */
1867
+	$join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
1868 1868
 
1869
-    $post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
1869
+	$post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
1870 1870
 
1871
-    $where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
1872
-
1873
-    ########### WPML ###########
1874
-    if (function_exists('icl_object_id')) {
1875
-        if ($lang_code) {
1876
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
1877
-        }
1878
-    }
1879
-    ########### WPML ###########
1880
-    /**
1881
-     * Filter widget listing where clause string part that is being used for query.
1882
-     *
1883
-     * @since 1.0.0
1884
-     * @param string $where Where clause string.
1885
-     * @param string $post_type Post type.
1886
-     */
1887
-    $where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
1888
-    $where = $where != '' ? " WHERE 1=1 " . $where : '';
1889
-
1890
-    $groupby = " GROUP BY $wpdb->posts.ID ";
1891
-    /**
1892
-     * Filter widget listing groupby clause string part that is being used for query.
1893
-     *
1894
-     * @since 1.0.0
1895
-     * @param string $groupby Group by clause string.
1896
-     * @param string $post_type Post type.
1897
-     */
1898
-    $groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
1871
+	$where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
1899 1872
 
1900
-    if ($count_only) {
1901
-        $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
1873
+	########### WPML ###########
1874
+	if (function_exists('icl_object_id')) {
1875
+		if ($lang_code) {
1876
+			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
1877
+		}
1878
+	}
1879
+	########### WPML ###########
1880
+	/**
1881
+	 * Filter widget listing where clause string part that is being used for query.
1882
+	 *
1883
+	 * @since 1.0.0
1884
+	 * @param string $where Where clause string.
1885
+	 * @param string $post_type Post type.
1886
+	 */
1887
+	$where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
1888
+	$where = $where != '' ? " WHERE 1=1 " . $where : '';
1889
+
1890
+	$groupby = " GROUP BY $wpdb->posts.ID ";
1891
+	/**
1892
+	 * Filter widget listing groupby clause string part that is being used for query.
1893
+	 *
1894
+	 * @since 1.0.0
1895
+	 * @param string $groupby Group by clause string.
1896
+	 * @param string $post_type Post type.
1897
+	 */
1898
+	$groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
1899
+
1900
+	if ($count_only) {
1901
+		$sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
1902 1902
 			" . $join . "
1903 1903
 			" . $where;
1904
-        $rows = (int)$wpdb->get_var($sql);
1905
-    } else {
1906
-        $orderby = geodir_widget_listings_get_order($query_args);
1907
-        /**
1908
-         * Filter widget listing orderby clause string part that is being used for query.
1909
-         *
1910
-         * @since 1.0.0
1911
-         * @param string $orderby Order by clause string.
1912
-         * @param string $table Table name.
1913
-         * @param string $post_type Post type.
1914
-         */
1915
-        $orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
1916
-        $orderby .= $wpdb->posts . ".post_title ASC";
1917
-        $orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
1918
-
1919
-        $limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
1920
-        /**
1921
-         * Filter widget listing limit that is being used for query.
1922
-         *
1923
-         * @since 1.0.0
1924
-         * @param int $limit Query results limit.
1925
-         * @param string $post_type Post type.
1926
-         */
1927
-        $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
1928
-
1929
-        $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
1930
-        if ( !$page )
1931
-            $page = 1;
1932
-
1933
-        $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
1934
-
1935
-        $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
1904
+		$rows = (int)$wpdb->get_var($sql);
1905
+	} else {
1906
+		$orderby = geodir_widget_listings_get_order($query_args);
1907
+		/**
1908
+		 * Filter widget listing orderby clause string part that is being used for query.
1909
+		 *
1910
+		 * @since 1.0.0
1911
+		 * @param string $orderby Order by clause string.
1912
+		 * @param string $table Table name.
1913
+		 * @param string $post_type Post type.
1914
+		 */
1915
+		$orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
1916
+		$orderby .= $wpdb->posts . ".post_title ASC";
1917
+		$orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
1918
+
1919
+		$limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
1920
+		/**
1921
+		 * Filter widget listing limit that is being used for query.
1922
+		 *
1923
+		 * @since 1.0.0
1924
+		 * @param int $limit Query results limit.
1925
+		 * @param string $post_type Post type.
1926
+		 */
1927
+		$limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
1928
+
1929
+		$page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
1930
+		if ( !$page )
1931
+			$page = 1;
1932
+
1933
+		$limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
1934
+
1935
+		$sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
1936 1936
 			" . $join . "
1937 1937
 			" . $where . "
1938 1938
 			" . $groupby . "
1939 1939
 			" . $orderby . "
1940 1940
 			" . $limit;
1941
-        $rows = $wpdb->get_results($sql);
1942
-    }
1941
+		$rows = $wpdb->get_results($sql);
1942
+	}
1943 1943
 
1944
-    unset($GLOBALS['gd_query_args_widgets']);
1945
-    unset($gd_query_args_widgets);
1944
+	unset($GLOBALS['gd_query_args_widgets']);
1945
+	unset($gd_query_args_widgets);
1946 1946
 
1947
-    return $rows;
1947
+	return $rows;
1948 1948
 }
1949 1949
 
1950 1950
 /**
@@ -1959,21 +1959,21 @@  discard block
 block discarded – undo
1959 1959
  */
1960 1960
 function geodir_function_widget_listings_fields($fields)
1961 1961
 {
1962
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1962
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1963 1963
 
1964
-    $query_args = $gd_query_args_widgets;
1965
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1966
-        return $fields;
1967
-    }
1968
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1969
-    $table = $plugin_prefix . $post_type . '_detail';
1964
+	$query_args = $gd_query_args_widgets;
1965
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1966
+		return $fields;
1967
+	}
1968
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1969
+	$table = $plugin_prefix . $post_type . '_detail';
1970 1970
 
1971
-    /*
1971
+	/*
1972 1972
 	if ( $post_type == 'gd_event' && defined( 'EVENT_SCHEDULE' ) ) {
1973 1973
 		$fields .= $fields != '' ? ", " . EVENT_SCHEDULE . ".*" : EVENT_SCHEDULE . ".*";
1974 1974
 	}
1975 1975
 	*/
1976
-    return $fields;
1976
+	return $fields;
1977 1977
 }
1978 1978
 
1979 1979
 /**
@@ -1988,34 +1988,34 @@  discard block
 block discarded – undo
1988 1988
  */
1989 1989
 function geodir_function_widget_listings_join($join)
1990 1990
 {
1991
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1991
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1992 1992
 
1993
-    $query_args = $gd_query_args_widgets;
1994
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1995
-        return $where;
1996
-    }
1993
+	$query_args = $gd_query_args_widgets;
1994
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1995
+		return $where;
1996
+	}
1997 1997
 
1998
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1999
-    $table = $plugin_prefix . $post_type . '_detail';
1998
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1999
+	$table = $plugin_prefix . $post_type . '_detail';
2000 2000
 
2001
-    if (!empty($query_args['with_pics_only'])) {
2002
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2003
-    }
2001
+	if (!empty($query_args['with_pics_only'])) {
2002
+		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2003
+	}
2004 2004
 
2005
-    /*
2005
+	/*
2006 2006
 	if ( $post_type == 'gd_event' && defined( 'EVENT_SCHEDULE' ) ) {
2007 2007
 		$join .= " INNER JOIN " . EVENT_SCHEDULE ." ON (" . EVENT_SCHEDULE .".event_id = " . $wpdb->posts . ".ID)";
2008 2008
 	}
2009 2009
 	*/
2010 2010
 
2011
-    if (!empty($query_args['tax_query'])) {
2012
-        $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2013
-        if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2014
-            $join .= $tax_queries['join'];
2015
-        }
2016
-    }
2011
+	if (!empty($query_args['tax_query'])) {
2012
+		$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2013
+		if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2014
+			$join .= $tax_queries['join'];
2015
+		}
2016
+	}
2017 2017
 
2018
-    return $join;
2018
+	return $join;
2019 2019
 }
2020 2020
 
2021 2021
 /**
@@ -2030,54 +2030,54 @@  discard block
 block discarded – undo
2030 2030
  */
2031 2031
 function geodir_function_widget_listings_where($where)
2032 2032
 {
2033
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2034
-
2035
-    $query_args = $gd_query_args_widgets;
2036
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2037
-        return $where;
2038
-    }
2039
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2040
-    $table = $plugin_prefix . $post_type . '_detail';
2041
-
2042
-    if (!empty($query_args)) {
2043
-        if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2044
-            $where = geodir_default_location_where($where, $table);
2045
-        }
2033
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2046 2034
 
2047
-        if (!empty($query_args['post_author'])) {
2048
-            $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2049
-        }
2035
+	$query_args = $gd_query_args_widgets;
2036
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2037
+		return $where;
2038
+	}
2039
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2040
+	$table = $plugin_prefix . $post_type . '_detail';
2041
+
2042
+	if (!empty($query_args)) {
2043
+		if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2044
+			$where = geodir_default_location_where($where, $table);
2045
+		}
2046
+
2047
+		if (!empty($query_args['post_author'])) {
2048
+			$where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2049
+		}
2050 2050
         
2051
-        if (!empty($query_args['show_featured_only'])) {
2052
-            $where .= " AND " . $table . ".is_featured = '1'";
2053
-        }
2051
+		if (!empty($query_args['show_featured_only'])) {
2052
+			$where .= " AND " . $table . ".is_featured = '1'";
2053
+		}
2054 2054
 
2055
-        if (!empty($query_args['show_special_only'])) {
2056
-            $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2057
-        }
2055
+		if (!empty($query_args['show_special_only'])) {
2056
+			$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2057
+		}
2058 2058
 
2059
-        if (!empty($query_args['with_pics_only'])) {
2060
-            $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2061
-        }
2059
+		if (!empty($query_args['with_pics_only'])) {
2060
+			$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2061
+		}
2062 2062
 
2063
-        if (!empty($query_args['featured_image_only'])) {
2064
-            $where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2065
-        }
2063
+		if (!empty($query_args['featured_image_only'])) {
2064
+			$where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2065
+		}
2066 2066
 
2067
-        if (!empty($query_args['with_videos_only'])) {
2068
-            $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2069
-        }
2067
+		if (!empty($query_args['with_videos_only'])) {
2068
+			$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2069
+		}
2070 2070
 
2071
-        if (!empty($query_args['tax_query'])) {
2072
-            $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2071
+		if (!empty($query_args['tax_query'])) {
2072
+			$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2073 2073
 
2074
-            if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2075
-                $where .= $tax_queries['where'];
2076
-            }
2077
-        }
2078
-    }
2074
+			if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2075
+				$where .= $tax_queries['where'];
2076
+			}
2077
+		}
2078
+	}
2079 2079
 
2080
-    return $where;
2080
+	return $where;
2081 2081
 }
2082 2082
 
2083 2083
 /**
@@ -2092,23 +2092,23 @@  discard block
 block discarded – undo
2092 2092
  */
2093 2093
 function geodir_function_widget_listings_orderby($orderby)
2094 2094
 {
2095
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2095
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2096 2096
 
2097
-    $query_args = $gd_query_args_widgets;
2098
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2099
-        return $orderby;
2100
-    }
2097
+	$query_args = $gd_query_args_widgets;
2098
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2099
+		return $orderby;
2100
+	}
2101 2101
 
2102
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2103
-    $table = $plugin_prefix . $post_type . '_detail';
2102
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2103
+	$table = $plugin_prefix . $post_type . '_detail';
2104 2104
 
2105
-    /*
2105
+	/*
2106 2106
 	if ( $post_type == 'gd_event' && defined( 'EVENT_SCHEDULE' ) ) {
2107 2107
 		$orderby .= EVENT_SCHEDULE . ".event_date ASC, " . EVENT_SCHEDULE . ".event_starttime ASC , " . $table . ".is_featured ASC, ";
2108 2108
 	}
2109 2109
 	*/
2110 2110
 
2111
-    return $orderby;
2111
+	return $orderby;
2112 2112
 }
2113 2113
 
2114 2114
 /**
@@ -2123,18 +2123,18 @@  discard block
 block discarded – undo
2123 2123
  */
2124 2124
 function geodir_function_widget_listings_limit($limit)
2125 2125
 {
2126
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2126
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2127 2127
 
2128
-    $query_args = $gd_query_args_widgets;
2129
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2130
-        return $limit;
2131
-    }
2128
+	$query_args = $gd_query_args_widgets;
2129
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2130
+		return $limit;
2131
+	}
2132 2132
 
2133
-    if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2134
-        $limit = (int)$query_args['posts_per_page'];
2135
-    }
2133
+	if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2134
+		$limit = (int)$query_args['posts_per_page'];
2135
+	}
2136 2136
 
2137
-    return $limit;
2137
+	return $limit;
2138 2138
 }
2139 2139
 
2140 2140
 /**
@@ -2148,24 +2148,24 @@  discard block
 block discarded – undo
2148 2148
  */
2149 2149
 function geodir_media_image_large_width($default = 800, $params = '')
2150 2150
 {
2151
-    $large_size_w = get_option('large_size_w');
2152
-    $large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2153
-    $large_size_w = absint($large_size_w);
2154
-
2155
-    if (!get_option('geodir_use_wp_media_large_size')) {
2156
-        $large_size_w = 800;
2157
-    }
2158
-
2159
-    /**
2160
-     * Filter large image width.
2161
-     *
2162
-     * @since 1.0.0
2163
-     * @param int $large_size_w Large image width.
2164
-     * @param int $default Default width.
2165
-     * @param string|array $params Image parameters.
2166
-     */
2167
-    $large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2168
-    return $large_size_w;
2151
+	$large_size_w = get_option('large_size_w');
2152
+	$large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2153
+	$large_size_w = absint($large_size_w);
2154
+
2155
+	if (!get_option('geodir_use_wp_media_large_size')) {
2156
+		$large_size_w = 800;
2157
+	}
2158
+
2159
+	/**
2160
+	 * Filter large image width.
2161
+	 *
2162
+	 * @since 1.0.0
2163
+	 * @param int $large_size_w Large image width.
2164
+	 * @param int $default Default width.
2165
+	 * @param string|array $params Image parameters.
2166
+	 */
2167
+	$large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2168
+	return $large_size_w;
2169 2169
 }
2170 2170
 
2171 2171
 /**
@@ -2179,25 +2179,25 @@  discard block
 block discarded – undo
2179 2179
  */
2180 2180
 function geodir_media_image_large_height($default = 800, $params = '')
2181 2181
 {
2182
-    $large_size_h = get_option('large_size_h');
2183
-    $large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2184
-    $large_size_h = absint($large_size_h);
2185
-
2186
-    if (!get_option('geodir_use_wp_media_large_size')) {
2187
-        $large_size_h = 800;
2188
-    }
2189
-
2190
-    /**
2191
-     * Filter large image height.
2192
-     *
2193
-     * @since 1.0.0
2194
-     * @param int $large_size_h Large image height.
2195
-     * @param int $default Default height.
2196
-     * @param string|array $params Image parameters.
2197
-     */
2198
-    $large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2182
+	$large_size_h = get_option('large_size_h');
2183
+	$large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2184
+	$large_size_h = absint($large_size_h);
2185
+
2186
+	if (!get_option('geodir_use_wp_media_large_size')) {
2187
+		$large_size_h = 800;
2188
+	}
2199 2189
 
2200
-    return $large_size_h;
2190
+	/**
2191
+	 * Filter large image height.
2192
+	 *
2193
+	 * @since 1.0.0
2194
+	 * @param int $large_size_h Large image height.
2195
+	 * @param int $default Default height.
2196
+	 * @param string|array $params Image parameters.
2197
+	 */
2198
+	$large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2199
+
2200
+	return $large_size_h;
2201 2201
 }
2202 2202
 
2203 2203
 /**
@@ -2212,25 +2212,25 @@  discard block
 block discarded – undo
2212 2212
  */
2213 2213
 function geodir_sanitize_location_name($type, $name, $translate = true)
2214 2214
 {
2215
-    if ($name == '') {
2216
-        return NULL;
2217
-    }
2218
-
2219
-    $type = $type == 'gd_country' ? 'country' : $type;
2220
-    $type = $type == 'gd_region' ? 'region' : $type;
2221
-    $type = $type == 'gd_city' ? 'city' : $type;
2222
-
2223
-    $return = $name;
2224
-    if (function_exists('get_actual_location_name')) {
2225
-        $return = get_actual_location_name($type, $name, $translate);
2226
-    } else {
2227
-        $return = preg_replace('/-(\d+)$/', '', $return);
2228
-        $return = preg_replace('/[_-]/', ' ', $return);
2229
-        $return = geodir_ucwords($return);
2230
-        $return = $translate ? __($return, 'geodirectory') : $return;
2231
-    }
2232
-
2233
-    return $return;
2215
+	if ($name == '') {
2216
+		return NULL;
2217
+	}
2218
+
2219
+	$type = $type == 'gd_country' ? 'country' : $type;
2220
+	$type = $type == 'gd_region' ? 'region' : $type;
2221
+	$type = $type == 'gd_city' ? 'city' : $type;
2222
+
2223
+	$return = $name;
2224
+	if (function_exists('get_actual_location_name')) {
2225
+		$return = get_actual_location_name($type, $name, $translate);
2226
+	} else {
2227
+		$return = preg_replace('/-(\d+)$/', '', $return);
2228
+		$return = preg_replace('/[_-]/', ' ', $return);
2229
+		$return = geodir_ucwords($return);
2230
+		$return = $translate ? __($return, 'geodirectory') : $return;
2231
+	}
2232
+
2233
+	return $return;
2234 2234
 }
2235 2235
 
2236 2236
 
@@ -2244,14 +2244,14 @@  discard block
 block discarded – undo
2244 2244
 function geodir_comments_number($number)
2245 2245
 {
2246 2246
 
2247
-    if ($number > 1) {
2248
-        $output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2249
-    } elseif ($number == 0 || $number == '') {
2250
-        $output = __('No Reviews', 'geodirectory');
2251
-    } else { // must be one
2252
-        $output = __('1 Review', 'geodirectory');
2253
-    }
2254
-    echo $output;
2247
+	if ($number > 1) {
2248
+		$output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2249
+	} elseif ($number == 0 || $number == '') {
2250
+		$output = __('No Reviews', 'geodirectory');
2251
+	} else { // must be one
2252
+		$output = __('1 Review', 'geodirectory');
2253
+	}
2254
+	echo $output;
2255 2255
 }
2256 2256
 
2257 2257
 /**
@@ -2264,23 +2264,23 @@  discard block
 block discarded – undo
2264 2264
  */
2265 2265
 function is_page_geodir_home()
2266 2266
 {
2267
-    global $wpdb;
2268
-    $cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2269
-    if (function_exists('geodir_location_geo_home_link')) {
2270
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2271
-    }
2272
-    $home_url = home_url('', 'http');
2273
-    if (function_exists('geodir_location_geo_home_link')) {
2274
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2275
-    }
2276
-    $home_url = str_replace("www.", "", $home_url);
2277
-    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')) ) {
2278
-        return true;
2279
-    }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')){
2280
-        return true;
2281
-    } else {
2282
-        return false;
2283
-    }
2267
+	global $wpdb;
2268
+	$cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2269
+	if (function_exists('geodir_location_geo_home_link')) {
2270
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2271
+	}
2272
+	$home_url = home_url('', 'http');
2273
+	if (function_exists('geodir_location_geo_home_link')) {
2274
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2275
+	}
2276
+	$home_url = str_replace("www.", "", $home_url);
2277
+	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')) ) {
2278
+		return true;
2279
+	}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')){
2280
+		return true;
2281
+	} else {
2282
+		return false;
2283
+	}
2284 2284
 
2285 2285
 }
2286 2286
 
@@ -2296,13 +2296,13 @@  discard block
 block discarded – undo
2296 2296
  */
2297 2297
 function geodir_wpseo_homepage_canonical($url)
2298 2298
 {
2299
-    global $post;
2299
+	global $post;
2300 2300
 
2301
-    if (is_page_geodir_home()) {
2302
-        return home_url();
2303
-    }
2301
+	if (is_page_geodir_home()) {
2302
+		return home_url();
2303
+	}
2304 2304
 
2305
-    return $url;
2305
+	return $url;
2306 2306
 }
2307 2307
 
2308 2308
 add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10);
@@ -2319,16 +2319,16 @@  discard block
 block discarded – undo
2319 2319
  */
2320 2320
 function geodir_googlemap_script_extra_details_page($extra)
2321 2321
 {
2322
-    global $post;
2323
-    $add_google_places_api = false;
2324
-    if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2325
-        $add_google_places_api = true;
2326
-    }
2327
-    if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2328
-        $extra .= "&amp;libraries=places";
2329
-    }
2330
-
2331
-    return $extra;
2322
+	global $post;
2323
+	$add_google_places_api = false;
2324
+	if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2325
+		$add_google_places_api = true;
2326
+	}
2327
+	if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2328
+		$extra .= "&amp;libraries=places";
2329
+	}
2330
+
2331
+	return $extra;
2332 2332
 }
2333 2333
 
2334 2334
 add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1);
@@ -2348,91 +2348,91 @@  discard block
 block discarded – undo
2348 2348
  */
2349 2349
 function geodir_popular_post_category_output($args = '', $instance = '')
2350 2350
 {
2351
-    // prints the widget
2352
-    global $wpdb, $plugin_prefix, $geodir_post_category_str;
2353
-    extract($args, EXTR_SKIP);
2351
+	// prints the widget
2352
+	global $wpdb, $plugin_prefix, $geodir_post_category_str;
2353
+	extract($args, EXTR_SKIP);
2354 2354
 
2355
-    echo $before_widget;
2355
+	echo $before_widget;
2356 2356
 
2357
-    /** This filter is documented in geodirectory_widgets.php */
2358
-    $title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2357
+	/** This filter is documented in geodirectory_widgets.php */
2358
+	$title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2359 2359
 
2360
-    $gd_post_type = geodir_get_current_posttype();
2360
+	$gd_post_type = geodir_get_current_posttype();
2361 2361
 
2362
-    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2363
-    $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'] : '');
2362
+	$category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2363
+	$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'] : '');
2364 2364
 
2365
-    $taxonomy = array();
2366
-    if (!empty($gd_post_type)) {
2367
-        $taxonomy[] = $gd_post_type . "category";
2368
-    } else {
2369
-        $taxonomy = geodir_get_taxonomies($gd_post_type);
2370
-    }
2365
+	$taxonomy = array();
2366
+	if (!empty($gd_post_type)) {
2367
+		$taxonomy[] = $gd_post_type . "category";
2368
+	} else {
2369
+		$taxonomy = geodir_get_taxonomies($gd_post_type);
2370
+	}
2371 2371
 
2372
-    $terms = get_terms($taxonomy);
2373
-    $a_terms = array();
2374
-    $b_terms = array();
2372
+	$terms = get_terms($taxonomy);
2373
+	$a_terms = array();
2374
+	$b_terms = array();
2375 2375
 
2376
-    foreach ($terms as $term) {
2377
-        if ($term->count > 0) {
2378
-            $a_terms[$term->taxonomy][] = $term;
2379
-        }
2380
-    }
2376
+	foreach ($terms as $term) {
2377
+		if ($term->count > 0) {
2378
+			$a_terms[$term->taxonomy][] = $term;
2379
+		}
2380
+	}
2381 2381
 
2382
-    if (!empty($a_terms)) {
2383
-        foreach ($a_terms as $b_key => $b_val) {
2384
-            $b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2385
-        }
2382
+	if (!empty($a_terms)) {
2383
+		foreach ($a_terms as $b_key => $b_val) {
2384
+			$b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2385
+		}
2386 2386
 
2387
-        $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : '';
2388
-
2389
-        $tax_change_output = '';
2390
-        if (count($b_terms) > 1) {
2391
-            $tax_change_output .= "<select data-limit='$category_limit' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2392
-            foreach ($b_terms as $key => $val) {
2393
-                $ptype = get_post_type_object(str_replace("category", "", $key));
2394
-                $cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2395
-                $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2396
-            }
2397
-            $tax_change_output .= "</select>";
2398
-        }
2387
+		$default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : '';
2388
+
2389
+		$tax_change_output = '';
2390
+		if (count($b_terms) > 1) {
2391
+			$tax_change_output .= "<select data-limit='$category_limit' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2392
+			foreach ($b_terms as $key => $val) {
2393
+				$ptype = get_post_type_object(str_replace("category", "", $key));
2394
+				$cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2395
+				$tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2396
+			}
2397
+			$tax_change_output .= "</select>";
2398
+		}
2399 2399
 
2400
-        if (!empty($b_terms)) {
2401
-            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2402
-            global $cat_count;//make global so we can change via function
2403
-            $cat_count = 0;
2404
-            ?>
2400
+		if (!empty($b_terms)) {
2401
+			$terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2402
+			global $cat_count;//make global so we can change via function
2403
+			$cat_count = 0;
2404
+			?>
2405 2405
             <div class="geodir-category-list-in clearfix">
2406 2406
                 <div class="geodir-cat-list clearfix">
2407 2407
                     <?php
2408
-                    echo $before_title . __($title) . $after_title;
2408
+					echo $before_title . __($title) . $after_title;
2409 2409
 
2410
-                    echo $tax_change_output;
2410
+					echo $tax_change_output;
2411 2411
 
2412
-                    echo '<ul class="geodir-popular-cat-list">';
2412
+					echo '<ul class="geodir-popular-cat-list">';
2413 2413
 
2414
-                    geodir_helper_cat_list_output($terms, $category_limit);
2414
+					geodir_helper_cat_list_output($terms, $category_limit);
2415 2415
 
2416
-                    echo '</ul>';
2417
-                    ?>
2416
+					echo '</ul>';
2417
+					?>
2418 2418
                 </div>
2419 2419
                 <?php
2420
-                $hide = '';
2421
-                if ($cat_count < $category_limit) {
2422
-                    $hide = 'style="display:none;"';
2423
-                }
2424
-                echo "<div class='geodir-cat-list-more' $hide >";
2425
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>';
2426
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>';
2427
-                echo "</div>";
2428
-                /* add scripts */
2429
-                add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2430
-                ?>
2420
+				$hide = '';
2421
+				if ($cat_count < $category_limit) {
2422
+					$hide = 'style="display:none;"';
2423
+				}
2424
+				echo "<div class='geodir-cat-list-more' $hide >";
2425
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>';
2426
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>';
2427
+				echo "</div>";
2428
+				/* add scripts */
2429
+				add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2430
+				?>
2431 2431
             </div>
2432 2432
         <?php
2433
-        }
2434
-    }
2435
-    echo $after_widget;
2433
+		}
2434
+	}
2435
+	echo $after_widget;
2436 2436
 }
2437 2437
 
2438 2438
 /**
@@ -2446,38 +2446,38 @@  discard block
 block discarded – undo
2446 2446
  */
2447 2447
 function geodir_helper_cat_list_output($terms, $category_limit)
2448 2448
 {
2449
-    global $geodir_post_category_str, $cat_count;
2450
-    $term_icons = geodir_get_term_icon();
2449
+	global $geodir_post_category_str, $cat_count;
2450
+	$term_icons = geodir_get_term_icon();
2451 2451
 
2452
-    $geodir_post_category_str = array();
2452
+	$geodir_post_category_str = array();
2453 2453
 
2454 2454
 
2455
-    foreach ($terms as $cat) {
2456
-        $post_type = str_replace("category", "", $cat->taxonomy);
2457
-        $term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2455
+	foreach ($terms as $cat) {
2456
+		$post_type = str_replace("category", "", $cat->taxonomy);
2457
+		$term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2458 2458
 
2459
-        $cat_count++;
2459
+		$cat_count++;
2460 2460
 
2461
-        $geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2461
+		$geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2462 2462
 
2463
-        $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2464
-        $total_post = $cat->count;
2463
+		$class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2464
+		$total_post = $cat->count;
2465 2465
 
2466
-        $term_link = get_term_link( $cat, $cat->taxonomy );
2467
-        /**
2468
-         * Filer the category term link.
2469
-         *
2470
-         * @since 1.4.5
2471
-         * @param string $term_link The term permalink.
2472
-         * @param int    $cat->term_id The term id.
2473
-         * @param string $post_type Wordpress post type.
2474
-         */
2475
-        $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2466
+		$term_link = get_term_link( $cat, $cat->taxonomy );
2467
+		/**
2468
+		 * Filer the category term link.
2469
+		 *
2470
+		 * @since 1.4.5
2471
+		 * @param string $term_link The term permalink.
2472
+		 * @param int    $cat->term_id The term id.
2473
+		 * @param string $post_type Wordpress post type.
2474
+		 */
2475
+		$term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2476 2476
 
2477
-        echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2478
-        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> ';
2479
-        echo '</a></li>';
2480
-    }
2477
+		echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2478
+		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> ';
2479
+		echo '</a></li>';
2480
+	}
2481 2481
 }
2482 2482
 
2483 2483
 /**
@@ -2490,109 +2490,109 @@  discard block
 block discarded – undo
2490 2490
  * @param array|string $instance The settings for the particular instance of the widget.
2491 2491
  */
2492 2492
 function geodir_listing_slider_widget_output($args = '', $instance = '')
2493
-{
2494
-    // prints the widget
2495
-    extract($args, EXTR_SKIP);
2496
-
2497
-    echo $before_widget;
2498
-
2499
-    /** This filter is documented in geodirectory_widgets.php */
2500
-    $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2501
-    /**
2502
-     * Filter the widget post type.
2503
-     *
2504
-     * @since 1.0.0
2505
-     * @param string $instance['post_type'] Post type of listing.
2506
-     */
2507
-    $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2508
-    /**
2509
-     * Filter the widget's term.
2510
-     *
2511
-     * @since 1.0.0
2512
-     * @param string $instance['category'] Filter by term. Can be any valid term.
2513
-     */
2514
-    $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2515
-    /**
2516
-     * Filter the widget listings limit.
2517
-     *
2518
-     * @since 1.0.0
2519
-     * @param string $instance['post_number'] Number of listings to display.
2520
-     */
2521
-    $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2522
-    /**
2523
-     * Filter the widget listings limit shown at one time.
2524
-     *
2525
-     * @since 1.5.0
2526
-     * @param string $instance['max_show'] Number of listings to display on screen.
2527
-     */
2528
-    $max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
2529
-    /**
2530
-     * Filter the widget slide width.
2531
-     *
2532
-     * @since 1.5.0
2533
-     * @param string $instance['slide_width'] Width of the slides shown.
2534
-     */
2535
-    $slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
2536
-    /**
2537
-     * Filter widget's "show title" value.
2538
-     *
2539
-     * @since 1.0.0
2540
-     * @param string|bool $instance['show_title'] Do you want to display title? Can be 1 or 0.
2541
-     */
2542
-    $show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
2543
-    /**
2544
-     * Filter widget's "slideshow" value.
2545
-     *
2546
-     * @since 1.0.0
2547
-     * @param int $instance['slideshow'] Setup a slideshow for the slider to animate automatically.
2548
-     */
2549
-    $slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
2550
-    /**
2551
-     * Filter widget's "animationLoop" value.
2552
-     *
2553
-     * @since 1.0.0
2554
-     * @param int $instance['animationLoop'] Gives the slider a seamless infinite loop.
2555
-     */
2556
-    $animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
2557
-    /**
2558
-     * Filter widget's "directionNav" value.
2559
-     *
2560
-     * @since 1.0.0
2561
-     * @param int $instance['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
2562
-     */
2563
-    $directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
2564
-    /**
2565
-     * Filter widget's "slideshowSpeed" value.
2566
-     *
2567
-     * @since 1.0.0
2568
-     * @param int $instance['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
2569
-     */
2570
-    $slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
2571
-    /**
2572
-     * Filter widget's "animationSpeed" value.
2573
-     *
2574
-     * @since 1.0.0
2575
-     * @param int $instance['animationSpeed'] Set the speed of animations, in milliseconds.
2576
-     */
2577
-    $animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
2578
-    /**
2579
-     * Filter widget's "animation" value.
2580
-     *
2581
-     * @since 1.0.0
2582
-     * @param string $instance['animation'] Controls the animation type, "fade" or "slide".
2583
-     */
2584
-    $animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
2585
-    /**
2586
-     * Filter widget's "list_sort" type.
2587
-     *
2588
-     * @since 1.0.0
2589
-     * @param string $instance['list_sort'] Listing sort by type.
2590
-     */
2591
-    $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
2592
-    $show_featured_only = !empty($instance['show_featured_only']) ? 1 : NULL;
2593
-
2594
-    wp_enqueue_script('geodirectory-jquery-flexslider-js');
2595
-    ?>
2493
+{
2494
+	// prints the widget
2495
+	extract($args, EXTR_SKIP);
2496
+
2497
+	echo $before_widget;
2498
+
2499
+	/** This filter is documented in geodirectory_widgets.php */
2500
+	$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2501
+	/**
2502
+	 * Filter the widget post type.
2503
+	 *
2504
+	 * @since 1.0.0
2505
+	 * @param string $instance['post_type'] Post type of listing.
2506
+	 */
2507
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2508
+	/**
2509
+	 * Filter the widget's term.
2510
+	 *
2511
+	 * @since 1.0.0
2512
+	 * @param string $instance['category'] Filter by term. Can be any valid term.
2513
+	 */
2514
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2515
+	/**
2516
+	 * Filter the widget listings limit.
2517
+	 *
2518
+	 * @since 1.0.0
2519
+	 * @param string $instance['post_number'] Number of listings to display.
2520
+	 */
2521
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2522
+	/**
2523
+	 * Filter the widget listings limit shown at one time.
2524
+	 *
2525
+	 * @since 1.5.0
2526
+	 * @param string $instance['max_show'] Number of listings to display on screen.
2527
+	 */
2528
+	$max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
2529
+	/**
2530
+	 * Filter the widget slide width.
2531
+	 *
2532
+	 * @since 1.5.0
2533
+	 * @param string $instance['slide_width'] Width of the slides shown.
2534
+	 */
2535
+	$slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
2536
+	/**
2537
+	 * Filter widget's "show title" value.
2538
+	 *
2539
+	 * @since 1.0.0
2540
+	 * @param string|bool $instance['show_title'] Do you want to display title? Can be 1 or 0.
2541
+	 */
2542
+	$show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
2543
+	/**
2544
+	 * Filter widget's "slideshow" value.
2545
+	 *
2546
+	 * @since 1.0.0
2547
+	 * @param int $instance['slideshow'] Setup a slideshow for the slider to animate automatically.
2548
+	 */
2549
+	$slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
2550
+	/**
2551
+	 * Filter widget's "animationLoop" value.
2552
+	 *
2553
+	 * @since 1.0.0
2554
+	 * @param int $instance['animationLoop'] Gives the slider a seamless infinite loop.
2555
+	 */
2556
+	$animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
2557
+	/**
2558
+	 * Filter widget's "directionNav" value.
2559
+	 *
2560
+	 * @since 1.0.0
2561
+	 * @param int $instance['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
2562
+	 */
2563
+	$directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
2564
+	/**
2565
+	 * Filter widget's "slideshowSpeed" value.
2566
+	 *
2567
+	 * @since 1.0.0
2568
+	 * @param int $instance['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
2569
+	 */
2570
+	$slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
2571
+	/**
2572
+	 * Filter widget's "animationSpeed" value.
2573
+	 *
2574
+	 * @since 1.0.0
2575
+	 * @param int $instance['animationSpeed'] Set the speed of animations, in milliseconds.
2576
+	 */
2577
+	$animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
2578
+	/**
2579
+	 * Filter widget's "animation" value.
2580
+	 *
2581
+	 * @since 1.0.0
2582
+	 * @param string $instance['animation'] Controls the animation type, "fade" or "slide".
2583
+	 */
2584
+	$animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
2585
+	/**
2586
+	 * Filter widget's "list_sort" type.
2587
+	 *
2588
+	 * @since 1.0.0
2589
+	 * @param string $instance['list_sort'] Listing sort by type.
2590
+	 */
2591
+	$list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
2592
+	$show_featured_only = !empty($instance['show_featured_only']) ? 1 : NULL;
2593
+
2594
+	wp_enqueue_script('geodirectory-jquery-flexslider-js');
2595
+	?>
2596 2596
     <script type="text/javascript">
2597 2597
         jQuery(window).load(function () {
2598 2598
             jQuery('#geodir_widget_carousel').flexslider({
@@ -2633,73 +2633,73 @@  discard block
 block discarded – undo
2633 2633
         });
2634 2634
     </script>
2635 2635
     <?php
2636
-    $query_args = array(
2637
-        'posts_per_page' => $post_number,
2638
-        'is_geodir_loop' => true,
2639
-        'post_type' => $post_type,
2640
-        'order_by' => $list_sort
2641
-    );
2642
-    if ($show_featured_only) {
2643
-        $query_args['show_featured_only'] = 1;
2644
-    }
2645
-
2646
-    if ($category != 0 || $category != '') {
2647
-        $category_taxonomy = geodir_get_taxonomies($post_type);
2648
-        $tax_query = array(
2649
-            'taxonomy' => $category_taxonomy[0],
2650
-            'field' => 'id',
2651
-            'terms' => $category
2652
-        );
2653
-
2654
-        $query_args['tax_query'] = array($tax_query);
2655
-    }
2656
-
2657
-    // we want listings with featured image only
2658
-    $query_args['featured_image_only'] = 1;
2659
-
2660
-    if ($post_type == 'gd_event') {
2661
-        $query_args['gedir_event_listing_filter'] = 'upcoming';
2662
-    }// show only upcomming events
2663
-
2664
-    $widget_listings = geodir_get_widget_listings($query_args);
2665
-    if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
2666
-        if ($title) {
2667
-            echo $before_title . $title . $after_title;
2668
-        }
2636
+	$query_args = array(
2637
+		'posts_per_page' => $post_number,
2638
+		'is_geodir_loop' => true,
2639
+		'post_type' => $post_type,
2640
+		'order_by' => $list_sort
2641
+	);
2642
+	if ($show_featured_only) {
2643
+		$query_args['show_featured_only'] = 1;
2644
+	}
2645
+
2646
+	if ($category != 0 || $category != '') {
2647
+		$category_taxonomy = geodir_get_taxonomies($post_type);
2648
+		$tax_query = array(
2649
+			'taxonomy' => $category_taxonomy[0],
2650
+			'field' => 'id',
2651
+			'terms' => $category
2652
+		);
2669 2653
 
2670
-        global $post;
2654
+		$query_args['tax_query'] = array($tax_query);
2655
+	}
2656
+
2657
+	// we want listings with featured image only
2658
+	$query_args['featured_image_only'] = 1;
2671 2659
 
2672
-        $current_post = $post;// keep current post info
2660
+	if ($post_type == 'gd_event') {
2661
+		$query_args['gedir_event_listing_filter'] = 'upcoming';
2662
+	}// show only upcomming events
2673 2663
 
2674
-        $widget_main_slides = '';
2675
-        $nav_slides = '';
2676
-        $widget_slides = 0;
2664
+	$widget_listings = geodir_get_widget_listings($query_args);
2665
+	if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
2666
+		if ($title) {
2667
+			echo $before_title . $title . $after_title;
2668
+		}
2677 2669
 
2678
-        foreach ($widget_listings as $widget_listing) {
2679
-            global $gd_widget_listing_type;
2680
-            $post = $widget_listing;
2681
-            $widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
2670
+		global $post;
2682 2671
 
2683
-            if (!empty($widget_image)) {
2684
-                if ($widget_image->height >= 200) {
2685
-                    $widget_spacer_height = 0;
2686
-                } else {
2687
-                    $widget_spacer_height = ((200 - $widget_image->height) / 2);
2688
-                }
2672
+		$current_post = $post;// keep current post info
2689 2673
 
2690
-                $widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />';
2674
+		$widget_main_slides = '';
2675
+		$nav_slides = '';
2676
+		$widget_slides = 0;
2691 2677
 
2692
-                $title = '';
2693
-                if ($show_title) {
2694
-                    $title = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>';
2695
-                }
2678
+		foreach ($widget_listings as $widget_listing) {
2679
+			global $gd_widget_listing_type;
2680
+			$post = $widget_listing;
2681
+			$widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
2696 2682
 
2697
-                $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>';
2698
-                $nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
2699
-                $widget_slides++;
2700
-            }
2701
-        }
2702
-        ?>
2683
+			if (!empty($widget_image)) {
2684
+				if ($widget_image->height >= 200) {
2685
+					$widget_spacer_height = 0;
2686
+				} else {
2687
+					$widget_spacer_height = ((200 - $widget_image->height) / 2);
2688
+				}
2689
+
2690
+				$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" />';
2691
+
2692
+				$title = '';
2693
+				if ($show_title) {
2694
+					$title = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>';
2695
+				}
2696
+
2697
+				$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>';
2698
+				$nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
2699
+				$widget_slides++;
2700
+			}
2701
+		}
2702
+		?>
2703 2703
         <div class="flex-container" style="min-height:200px;">
2704 2704
             <div class="geodir-listing-flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
2705 2705
             <div id="geodir_widget_slider" class="geodir_flexslider">
@@ -2712,10 +2712,10 @@  discard block
 block discarded – undo
2712 2712
             <?php } ?>
2713 2713
         </div>
2714 2714
         <?php
2715
-        $GLOBALS['post'] = $current_post;
2716
-        setup_postdata($current_post);
2717
-    }
2718
-    echo $after_widget;
2715
+		$GLOBALS['post'] = $current_post;
2716
+		setup_postdata($current_post);
2717
+	}
2718
+	echo $after_widget;
2719 2719
 }
2720 2720
 
2721 2721
 
@@ -2730,68 +2730,68 @@  discard block
 block discarded – undo
2730 2730
  */
2731 2731
 function geodir_loginwidget_output($args = '', $instance = '')
2732 2732
 {
2733
-    //print_r($args);
2734
-    //print_r($instance);
2735
-    // prints the widget
2736
-    extract($args, EXTR_SKIP);
2733
+	//print_r($args);
2734
+	//print_r($instance);
2735
+	// prints the widget
2736
+	extract($args, EXTR_SKIP);
2737 2737
 
2738
-    /** This filter is documented in geodirectory_widgets.php */
2739
-    $title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2738
+	/** This filter is documented in geodirectory_widgets.php */
2739
+	$title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2740 2740
 
2741
-    echo $before_widget;
2742
-    echo $before_title . $title . $after_title;
2741
+	echo $before_widget;
2742
+	echo $before_title . $title . $after_title;
2743 2743
 
2744
-    if (is_user_logged_in()) {
2745
-        global $current_user;
2744
+	if (is_user_logged_in()) {
2745
+		global $current_user;
2746 2746
 
2747
-        $login_url = geodir_login_url();
2748
-        $add_listurl = get_permalink(geodir_add_listing_page_id());
2749
-        $add_listurl = geodir_getlink($add_listurl, array('listing_type' => 'gd_place'));
2750
-        $author_link = get_author_posts_url($current_user->data->ID);
2751
-        $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
2747
+		$login_url = geodir_login_url();
2748
+		$add_listurl = get_permalink(geodir_add_listing_page_id());
2749
+		$add_listurl = geodir_getlink($add_listurl, array('listing_type' => 'gd_place'));
2750
+		$author_link = get_author_posts_url($current_user->data->ID);
2751
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
2752 2752
 
2753
-        echo '<ul class="geodir-loginbox-list">';
2754
-        ob_start();
2755
-        ?>
2753
+		echo '<ul class="geodir-loginbox-list">';
2754
+		ob_start();
2755
+		?>
2756 2756
         <li><a class="signin"
2757 2757
                href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li>
2758 2758
         <?php
2759
-        $post_types = geodir_get_posttypes('object');
2760
-        $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
2761
-        $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2759
+		$post_types = geodir_get_posttypes('object');
2760
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
2761
+		$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2762 2762
 
2763
-        if (!empty($show_add_listing_post_types_main_nav)) {
2764
-            $addlisting_links = '';
2765
-            foreach ($post_types as $key => $postobj) {
2763
+		if (!empty($show_add_listing_post_types_main_nav)) {
2764
+			$addlisting_links = '';
2765
+			foreach ($post_types as $key => $postobj) {
2766 2766
 
2767
-                if (in_array($key, $show_add_listing_post_types_main_nav)) {
2767
+				if (in_array($key, $show_add_listing_post_types_main_nav)) {
2768 2768
 
2769
-                    if ($add_link = geodir_get_addlisting_link($key)) {
2769
+					if ($add_link = geodir_get_addlisting_link($key)) {
2770 2770
 
2771
-                        $name = $postobj->labels->name;
2771
+						$name = $postobj->labels->name;
2772 2772
 
2773
-                        $selected = '';
2774
-                        if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing'))
2775
-                            $selected = 'selected="selected"';
2773
+						$selected = '';
2774
+						if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing'))
2775
+							$selected = 'selected="selected"';
2776 2776
 
2777
-                        /**
2778
-                         * Filter add listing link.
2779
-                         *
2780
-                         * @since 1.0.0
2781
-                         * @param string $add_link Add listing link.
2782
-                         * @param string $key Add listing array key.
2783
-                         * @param int $current_user->ID Current user ID.
2784
-                         */
2785
-                        $add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
2777
+						/**
2778
+						 * Filter add listing link.
2779
+						 *
2780
+						 * @since 1.0.0
2781
+						 * @param string $add_link Add listing link.
2782
+						 * @param string $key Add listing array key.
2783
+						 * @param int $current_user->ID Current user ID.
2784
+						 */
2785
+						$add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
2786 2786
 
2787
-                        $addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2787
+						$addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2788 2788
 
2789
-                    }
2790
-                }
2789
+					}
2790
+				}
2791 2791
 
2792
-            }
2792
+			}
2793 2793
 
2794
-            if ($addlisting_links != '') { ?>
2794
+			if ($addlisting_links != '') { ?>
2795 2795
 
2796 2796
                 <li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value"
2797 2797
                             option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false"
@@ -2800,42 +2800,42 @@  discard block
 block discarded – undo
2800 2800
                         <?php echo $addlisting_links; ?>
2801 2801
                     </select></li> <?php
2802 2802
 
2803
-            }
2803
+			}
2804
+
2805
+		}
2806
+		// My Favourites in Dashboard
2807
+		$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
2808
+		$user_favourite = geodir_user_favourite_listing_count();
2809
+
2810
+		if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
2811
+			$favourite_links = '';
2804 2812
 
2805
-        }
2806
-        // My Favourites in Dashboard
2807
-        $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
2808
-        $user_favourite = geodir_user_favourite_listing_count();
2809
-
2810
-        if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
2811
-            $favourite_links = '';
2812
-
2813
-            foreach ($post_types as $key => $postobj) {
2814
-                if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
2815
-                    $name = $postobj->labels->name;
2816
-                    $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
2817
-
2818
-                    $selected = '';
2819
-
2820
-                    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
2821
-                        $selected = 'selected="selected"';
2822
-                    }
2823
-                    /**
2824
-                     * Filter favorite listing link.
2825
-                     *
2826
-                     * @since 1.0.0
2827
-                     * @param string $post_type_link Favorite listing link.
2828
-                     * @param string $key Favorite listing array key.
2829
-                     * @param int $current_user->ID Current user ID.
2830
-                     */
2831
-                    $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
2832
-
2833
-                    $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2834
-                }
2835
-            }
2836
-
2837
-            if ($favourite_links != '') {
2838
-                ?>
2813
+			foreach ($post_types as $key => $postobj) {
2814
+				if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
2815
+					$name = $postobj->labels->name;
2816
+					$post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
2817
+
2818
+					$selected = '';
2819
+
2820
+					if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
2821
+						$selected = 'selected="selected"';
2822
+					}
2823
+					/**
2824
+					 * Filter favorite listing link.
2825
+					 *
2826
+					 * @since 1.0.0
2827
+					 * @param string $post_type_link Favorite listing link.
2828
+					 * @param string $key Favorite listing array key.
2829
+					 * @param int $current_user->ID Current user ID.
2830
+					 */
2831
+					$post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
2832
+
2833
+					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2834
+				}
2835
+			}
2836
+
2837
+			if ($favourite_links != '') {
2838
+				?>
2839 2839
                 <li>
2840 2840
                     <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
2841 2841
                             option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false"
@@ -2845,42 +2845,42 @@  discard block
 block discarded – undo
2845 2845
                     </select>
2846 2846
                 </li>
2847 2847
             <?php
2848
-            }
2849
-        }
2850
-
2848
+			}
2849
+		}
2851 2850
 
2852
-        $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
2853
-        $user_listing = geodir_user_post_listing_count();
2854 2851
 
2855
-        if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
2856
-            $listing_links = '';
2852
+		$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
2853
+		$user_listing = geodir_user_post_listing_count();
2857 2854
 
2858
-            foreach ($post_types as $key => $postobj) {
2859
-                if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
2860
-                    $name = $postobj->labels->name;
2861
-                    $listing_link = geodir_getlink($author_link, array('stype' => $key), false);
2855
+		if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
2856
+			$listing_links = '';
2862 2857
 
2863
-                    $selected = '';
2864
-                    if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
2865
-                        $selected = 'selected="selected"';
2866
-                    }
2858
+			foreach ($post_types as $key => $postobj) {
2859
+				if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
2860
+					$name = $postobj->labels->name;
2861
+					$listing_link = geodir_getlink($author_link, array('stype' => $key), false);
2867 2862
 
2868
-                    /**
2869
-                     * Filter my listing link.
2870
-                     *
2871
-                     * @since 1.0.0
2872
-                     * @param string $listing_link My listing link.
2873
-                     * @param string $key My listing array key.
2874
-                     * @param int $current_user->ID Current user ID.
2875
-                     */
2876
-                    $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
2863
+					$selected = '';
2864
+					if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
2865
+						$selected = 'selected="selected"';
2866
+					}
2877 2867
 
2878
-                    $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2879
-                }
2880
-            }
2868
+					/**
2869
+					 * Filter my listing link.
2870
+					 *
2871
+					 * @since 1.0.0
2872
+					 * @param string $listing_link My listing link.
2873
+					 * @param string $key My listing array key.
2874
+					 * @param int $current_user->ID Current user ID.
2875
+					 */
2876
+					$listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
2877
+
2878
+					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2879
+				}
2880
+			}
2881 2881
 
2882
-            if ($listing_links != '') {
2883
-                ?>
2882
+			if ($listing_links != '') {
2883
+				?>
2884 2884
                 <li>
2885 2885
                     <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
2886 2886
                             option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false"
@@ -2890,27 +2890,27 @@  discard block
 block discarded – undo
2890 2890
                     </select>
2891 2891
                 </li>
2892 2892
             <?php
2893
-            }
2894
-        }
2893
+			}
2894
+		}
2895 2895
 
2896
-        $dashboard_link = ob_get_clean();
2897
-        /**
2898
-         * Filter dashboard links HTML.
2899
-         *
2900
-         * @since 1.0.0
2901
-         * @param string $dashboard_link Dashboard links HTML.
2902
-         */
2903
-        echo apply_filters('geodir_dashboard_links', $dashboard_link);
2904
-        echo '</ul>';
2905
-    } else {
2906
-        ?>
2896
+		$dashboard_link = ob_get_clean();
2897
+		/**
2898
+		 * Filter dashboard links HTML.
2899
+		 *
2900
+		 * @since 1.0.0
2901
+		 * @param string $dashboard_link Dashboard links HTML.
2902
+		 */
2903
+		echo apply_filters('geodir_dashboard_links', $dashboard_link);
2904
+		echo '</ul>';
2905
+	} else {
2906
+		?>
2907 2907
         <?php
2908
-        /**
2909
-         * Filter signup form action link.
2910
-         *
2911
-         * @since 1.0.0
2912
-         */
2913
-        ?>
2908
+		/**
2909
+		 * Filter signup form action link.
2910
+		 *
2911
+		 * @since 1.0.0
2912
+		 */
2913
+		?>
2914 2914
         <form name="loginform" class="loginform1"
2915 2915
               action="<?php echo geodir_login_url(); ?>"
2916 2916
               method="post">
@@ -2930,28 +2930,28 @@  discard block
 block discarded – undo
2930 2930
 
2931 2931
                 <p class="geodir-new-forgot-link">
2932 2932
                     <?php
2933
-                    /**
2934
-                     * Filter signup page register form link.
2935
-                     *
2936
-                     * @since 1.0.0
2937
-                     */
2938
-                    ?>
2933
+					/**
2934
+					 * Filter signup page register form link.
2935
+					 *
2936
+					 * @since 1.0.0
2937
+					 */
2938
+					?>
2939 2939
                     <a href="<?php echo geodir_login_url(array('signup' => true)); ?>"
2940 2940
                        class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a>
2941 2941
 
2942 2942
                     <?php
2943
-                    /**
2944
-                     * Filter signup page forgot password form link.
2945
-                     *
2946
-                     * @since 1.0.0
2947
-                     */
2948
-                    ?>
2943
+					/**
2944
+					 * Filter signup page forgot password form link.
2945
+					 *
2946
+					 * @since 1.0.0
2947
+					 */
2948
+					?>
2949 2949
                     <a href="<?php echo geodir_login_url(array('forgot' => true)); ?>"
2950 2950
                        class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div>
2951 2951
         </form>
2952 2952
     <?php }
2953 2953
 
2954
-    echo $after_widget;
2954
+	echo $after_widget;
2955 2955
 }
2956 2956
 
2957 2957
 
@@ -2970,284 +2970,284 @@  discard block
 block discarded – undo
2970 2970
  * @param array|string $instance The settings for the particular instance of the widget.
2971 2971
  */
2972 2972
 function geodir_popular_postview_output($args = '', $instance = '') {
2973
-    global $gd_session;
2973
+	global $gd_session;
2974 2974
 	
2975
-    // prints the widget
2976
-    extract($args, EXTR_SKIP);
2977
-
2978
-    echo $before_widget;
2979
-
2980
-    /** This filter is documented in geodirectory_widgets.php */
2981
-    $title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2982
-    /**
2983
-     * Filter the widget post type.
2984
-     *
2985
-     * @since 1.0.0
2986
-     * @param string $instance['post_type'] Post type of listing.
2987
-     */
2988
-    $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2989
-    /**
2990
-     * Filter the widget's term.
2991
-     *
2992
-     * @since 1.0.0
2993
-     * @param string $instance['category'] Filter by term. Can be any valid term.
2994
-     */
2995
-    $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2996
-    /**
2997
-     * Filter the widget listings limit.
2998
-     *
2999
-     * @since 1.0.0
3000
-     * @param string $instance['post_number'] Number of listings to display.
3001
-     */
3002
-    $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3003
-    /**
3004
-     * Filter widget's "layout" type.
3005
-     *
3006
-     * @since 1.0.0
3007
-     * @param string $instance['layout'] Widget layout type.
3008
-     */
3009
-    $layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
3010
-    /**
3011
-     * Filter widget's "add_location_filter" value.
3012
-     *
3013
-     * @since 1.0.0
3014
-     * @param string|bool $instance['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3015
-     */
3016
-    $add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3017
-    /**
3018
-     * Filter widget's listing width.
3019
-     *
3020
-     * @since 1.0.0
3021
-     * @param string $instance['listing_width'] Listing width.
3022
-     */
3023
-    $listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3024
-    /**
3025
-     * Filter widget's "list_sort" type.
3026
-     *
3027
-     * @since 1.0.0
3028
-     * @param string $instance['list_sort'] Listing sort by type.
3029
-     */
3030
-    $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3031
-    $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3032
-
3033
-    // set post type to current viewing post type
3034
-    if ($use_viewing_post_type) {
3035
-        $current_post_type = geodir_get_current_posttype();
3036
-        if ($current_post_type != '' && $current_post_type != $post_type) {
3037
-            $post_type = $current_post_type;
3038
-            $category = array(); // old post type category will not work for current changed post type
3039
-        }
3040
-    }
3041
-    // replace widget title dynamically
3042
-    $posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory');
3043
-    $posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3044
-
3045
-    $title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3046
-    $title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3047
-
3048
-    if (isset($instance['character_count'])) {
3049
-        /**
3050
-         * Filter the widget's excerpt character count.
3051
-         *
3052
-         * @since 1.0.0
3053
-         * @param int $instance['character_count'] Excerpt character count.
3054
-         */
3055
-        $character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3056
-    } else {
3057
-        $character_count = '';
3058
-    }
3059
-
3060
-    if (empty($title) || $title == 'All') {
3061
-        $title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory');
3062
-    }
3063
-
3064
-    $location_url = array();
3065
-    $city = get_query_var('gd_city');
3066
-    if (!empty($city)) {
3067
-        $country = get_query_var('gd_country');
3068
-        $region = get_query_var('gd_region');
3069
-
3070
-        $geodir_show_location_url = get_option('geodir_show_location_url');
3071
-
3072
-        if ($geodir_show_location_url == 'all') {
3073
-            if ($country != '') {
3074
-                $location_url[] = $country;
3075
-            }
3076
-
3077
-            if ($region != '') {
3078
-                $location_url[] = $region;
3079
-            }
3080
-        } else if ($geodir_show_location_url == 'country_city') {
3081
-            if ($country != '') {
3082
-                $location_url[] = $country;
3083
-            }
3084
-        } else if ($geodir_show_location_url == 'region_city') {
3085
-            if ($region != '') {
3086
-                $location_url[] = $region;
3087
-            }
3088
-        }
2975
+	// prints the widget
2976
+	extract($args, EXTR_SKIP);
2977
+
2978
+	echo $before_widget;
2979
+
2980
+	/** This filter is documented in geodirectory_widgets.php */
2981
+	$title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2982
+	/**
2983
+	 * Filter the widget post type.
2984
+	 *
2985
+	 * @since 1.0.0
2986
+	 * @param string $instance['post_type'] Post type of listing.
2987
+	 */
2988
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2989
+	/**
2990
+	 * Filter the widget's term.
2991
+	 *
2992
+	 * @since 1.0.0
2993
+	 * @param string $instance['category'] Filter by term. Can be any valid term.
2994
+	 */
2995
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2996
+	/**
2997
+	 * Filter the widget listings limit.
2998
+	 *
2999
+	 * @since 1.0.0
3000
+	 * @param string $instance['post_number'] Number of listings to display.
3001
+	 */
3002
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3003
+	/**
3004
+	 * Filter widget's "layout" type.
3005
+	 *
3006
+	 * @since 1.0.0
3007
+	 * @param string $instance['layout'] Widget layout type.
3008
+	 */
3009
+	$layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
3010
+	/**
3011
+	 * Filter widget's "add_location_filter" value.
3012
+	 *
3013
+	 * @since 1.0.0
3014
+	 * @param string|bool $instance['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3015
+	 */
3016
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3017
+	/**
3018
+	 * Filter widget's listing width.
3019
+	 *
3020
+	 * @since 1.0.0
3021
+	 * @param string $instance['listing_width'] Listing width.
3022
+	 */
3023
+	$listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3024
+	/**
3025
+	 * Filter widget's "list_sort" type.
3026
+	 *
3027
+	 * @since 1.0.0
3028
+	 * @param string $instance['list_sort'] Listing sort by type.
3029
+	 */
3030
+	$list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3031
+	$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3032
+
3033
+	// set post type to current viewing post type
3034
+	if ($use_viewing_post_type) {
3035
+		$current_post_type = geodir_get_current_posttype();
3036
+		if ($current_post_type != '' && $current_post_type != $post_type) {
3037
+			$post_type = $current_post_type;
3038
+			$category = array(); // old post type category will not work for current changed post type
3039
+		}
3040
+	}
3041
+	// replace widget title dynamically
3042
+	$posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory');
3043
+	$posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3044
+
3045
+	$title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3046
+	$title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3047
+
3048
+	if (isset($instance['character_count'])) {
3049
+		/**
3050
+		 * Filter the widget's excerpt character count.
3051
+		 *
3052
+		 * @since 1.0.0
3053
+		 * @param int $instance['character_count'] Excerpt character count.
3054
+		 */
3055
+		$character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3056
+	} else {
3057
+		$character_count = '';
3058
+	}
3089 3059
 
3090
-        $location_url[] = $city;
3091
-    }
3060
+	if (empty($title) || $title == 'All') {
3061
+		$title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory');
3062
+	}
3063
+
3064
+	$location_url = array();
3065
+	$city = get_query_var('gd_city');
3066
+	if (!empty($city)) {
3067
+		$country = get_query_var('gd_country');
3068
+		$region = get_query_var('gd_region');
3092 3069
 
3093
-    $location_url = implode('/', $location_url);
3094
-    $skip_location = false;
3095
-    if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3096
-        $skip_location = true;
3097
-        $gd_session->un_set('gd_multi_location');
3098
-    }
3070
+		$geodir_show_location_url = get_option('geodir_show_location_url');
3071
+
3072
+		if ($geodir_show_location_url == 'all') {
3073
+			if ($country != '') {
3074
+				$location_url[] = $country;
3075
+			}
3099 3076
 
3100
-    if (get_option('permalink_structure')) {
3101
-        $viewall_url = get_post_type_archive_link($post_type);
3102
-    } else {
3103
-        $viewall_url = get_post_type_archive_link($post_type);
3104
-    }
3077
+			if ($region != '') {
3078
+				$location_url[] = $region;
3079
+			}
3080
+		} else if ($geodir_show_location_url == 'country_city') {
3081
+			if ($country != '') {
3082
+				$location_url[] = $country;
3083
+			}
3084
+		} else if ($geodir_show_location_url == 'region_city') {
3085
+			if ($region != '') {
3086
+				$location_url[] = $region;
3087
+			}
3088
+		}
3105 3089
 
3106
-    if (!empty($category) && $category[0] != '0') {
3107
-        global $geodir_add_location_url;
3090
+		$location_url[] = $city;
3091
+	}
3108 3092
 
3109
-        $geodir_add_location_url = '0';
3093
+	$location_url = implode('/', $location_url);
3094
+	$skip_location = false;
3095
+	if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3096
+		$skip_location = true;
3097
+		$gd_session->un_set('gd_multi_location');
3098
+	}
3110 3099
 
3111
-        if ($add_location_filter != '0') {
3112
-            $geodir_add_location_url = '1';
3113
-        }
3100
+	if (get_option('permalink_structure')) {
3101
+		$viewall_url = get_post_type_archive_link($post_type);
3102
+	} else {
3103
+		$viewall_url = get_post_type_archive_link($post_type);
3104
+	}
3114 3105
 
3115
-        $viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3106
+	if (!empty($category) && $category[0] != '0') {
3107
+		global $geodir_add_location_url;
3116 3108
 
3117
-        $geodir_add_location_url = NULL;
3118
-    }
3119
-    if ($skip_location) {
3120
-        $gd_session->set('gd_multi_location', 1);
3121
-    }
3109
+		$geodir_add_location_url = '0';
3122 3110
 
3123
-    if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3111
+		if ($add_location_filter != '0') {
3112
+			$geodir_add_location_url = '1';
3113
+		}
3124 3114
 
3125
-    $query_args = array(
3126
-        'posts_per_page' => $post_number,
3127
-        'is_geodir_loop' => true,
3128
-        'gd_location' => $add_location_filter ? true : false,
3129
-        'post_type' => $post_type,
3130
-        'order_by' => $list_sort
3131
-    );
3115
+		$viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3132 3116
 
3133
-    if ($character_count) {
3134
-        $query_args['excerpt_length'] = $character_count;
3135
-    }
3117
+		$geodir_add_location_url = NULL;
3118
+	}
3119
+	if ($skip_location) {
3120
+		$gd_session->set('gd_multi_location', 1);
3121
+	}
3136 3122
 
3137
-    if (!empty($instance['show_featured_only'])) {
3138
-        $query_args['show_featured_only'] = 1;
3139
-    }
3123
+	if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3140 3124
 
3141
-    if (!empty($instance['show_special_only'])) {
3142
-        $query_args['show_special_only'] = 1;
3143
-    }
3125
+	$query_args = array(
3126
+		'posts_per_page' => $post_number,
3127
+		'is_geodir_loop' => true,
3128
+		'gd_location' => $add_location_filter ? true : false,
3129
+		'post_type' => $post_type,
3130
+		'order_by' => $list_sort
3131
+	);
3144 3132
 
3145
-    if (!empty($instance['with_pics_only'])) {
3146
-        $query_args['with_pics_only'] = 0;
3147
-        $query_args['featured_image_only'] = 1;
3148
-    }
3133
+	if ($character_count) {
3134
+		$query_args['excerpt_length'] = $character_count;
3135
+	}
3149 3136
 
3150
-    if (!empty($instance['with_videos_only'])) {
3151
-        $query_args['with_videos_only'] = 1;
3152
-    }
3153
-    $with_no_results = !empty($instance['without_no_results']) ? false : true;
3137
+	if (!empty($instance['show_featured_only'])) {
3138
+		$query_args['show_featured_only'] = 1;
3139
+	}
3154 3140
 
3155
-    if (!empty($category) && $category[0] != '0') {
3156
-        $category_taxonomy = geodir_get_taxonomies($post_type);
3141
+	if (!empty($instance['show_special_only'])) {
3142
+		$query_args['show_special_only'] = 1;
3143
+	}
3157 3144
 
3158
-        ######### WPML #########
3159
-        if (function_exists('icl_object_id')) {
3160
-            $category = gd_lang_object_ids($category, $category_taxonomy[0]);
3161
-        }
3162
-        ######### WPML #########
3145
+	if (!empty($instance['with_pics_only'])) {
3146
+		$query_args['with_pics_only'] = 0;
3147
+		$query_args['featured_image_only'] = 1;
3148
+	}
3163 3149
 
3164
-        $tax_query = array(
3165
-            'taxonomy' => $category_taxonomy[0],
3166
-            'field' => 'id',
3167
-            'terms' => $category
3168
-        );
3150
+	if (!empty($instance['with_videos_only'])) {
3151
+		$query_args['with_videos_only'] = 1;
3152
+	}
3153
+	$with_no_results = !empty($instance['without_no_results']) ? false : true;
3154
+
3155
+	if (!empty($category) && $category[0] != '0') {
3156
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3157
+
3158
+		######### WPML #########
3159
+		if (function_exists('icl_object_id')) {
3160
+			$category = gd_lang_object_ids($category, $category_taxonomy[0]);
3161
+		}
3162
+		######### WPML #########
3169 3163
 
3170
-        $query_args['tax_query'] = array($tax_query);
3171
-    }
3164
+		$tax_query = array(
3165
+			'taxonomy' => $category_taxonomy[0],
3166
+			'field' => 'id',
3167
+			'terms' => $category
3168
+		);
3172 3169
 
3173
-    global $gridview_columns_widget, $geodir_is_widget_listing;
3170
+		$query_args['tax_query'] = array($tax_query);
3171
+	}
3172
+
3173
+	global $gridview_columns_widget, $geodir_is_widget_listing;
3174 3174
 
3175
-    $widget_listings = geodir_get_widget_listings($query_args);
3175
+	$widget_listings = geodir_get_widget_listings($query_args);
3176 3176
 
3177
-    if (!empty($widget_listings) || $with_no_results) {
3178
-        ?>
3177
+	if (!empty($widget_listings) || $with_no_results) {
3178
+		?>
3179 3179
         <div class="geodir_locations geodir_location_listing">
3180 3180
 
3181 3181
             <?php
3182
-            /**
3183
-             * Called before the div containing the title and view all link in popular post view widget.
3184
-             *
3185
-             * @since 1.0.0
3186
-             */
3187
-            do_action('geodir_before_view_all_link_in_widget'); ?>
3182
+			/**
3183
+			 * Called before the div containing the title and view all link in popular post view widget.
3184
+			 *
3185
+			 * @since 1.0.0
3186
+			 */
3187
+			do_action('geodir_before_view_all_link_in_widget'); ?>
3188 3188
             <div class="geodir_list_heading clearfix">
3189 3189
                 <?php echo $before_title . $title . $after_title; ?>
3190 3190
                 <a href="<?php echo $viewall_url; ?>"
3191 3191
                    class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3192 3192
             </div>
3193 3193
             <?php
3194
-            /**
3195
-             * Called after the div containing the title and view all link in popular post view widget.
3196
-             *
3197
-             * @since 1.0.0
3198
-             */
3199
-            do_action('geodir_after_view_all_link_in_widget'); ?>
3194
+			/**
3195
+			 * Called after the div containing the title and view all link in popular post view widget.
3196
+			 *
3197
+			 * @since 1.0.0
3198
+			 */
3199
+			do_action('geodir_after_view_all_link_in_widget'); ?>
3200 3200
             <?php
3201
-            if (strstr($layout, 'gridview')) {
3202
-                $listing_view_exp = explode('_', $layout);
3203
-                $gridview_columns_widget = $layout;
3204
-                $layout = $listing_view_exp[0];
3205
-            } else {
3206
-                $gridview_columns_widget = '';
3207
-            }
3208
-
3209
-            /**
3210
-             * Filter the widget listing listview template path.
3211
-             *
3212
-             * @since 1.0.0
3213
-             */
3214
-            $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3215
-            if (!isset($character_count)) {
3216
-                /**
3217
-                 * Filter the widget's excerpt character count.
3218
-                 *
3219
-                 * @since 1.0.0
3220
-                 * @param int $instance['character_count'] Excerpt character count.
3221
-                 */
3222
-                $character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3223
-            }
3224
-
3225
-            global $post, $map_jason, $map_canvas_arr;
3226
-
3227
-            $current_post = $post;
3228
-            $current_map_jason = $map_jason;
3229
-            $current_map_canvas_arr = $map_canvas_arr;
3230
-            $geodir_is_widget_listing = true;
3231
-
3232
-            /**
3233
-             * Includes related listing listview template.
3234
-             *
3235
-             * @since 1.0.0
3236
-             */
3237
-            include($template);
3238
-
3239
-            $geodir_is_widget_listing = false;
3240
-
3241
-            $GLOBALS['post'] = $current_post;
3242
-            if (!empty($current_post))
3243
-                setup_postdata($current_post);
3244
-            $map_jason = $current_map_jason;
3245
-            $map_canvas_arr = $current_map_canvas_arr;
3246
-            ?>
3201
+			if (strstr($layout, 'gridview')) {
3202
+				$listing_view_exp = explode('_', $layout);
3203
+				$gridview_columns_widget = $layout;
3204
+				$layout = $listing_view_exp[0];
3205
+			} else {
3206
+				$gridview_columns_widget = '';
3207
+			}
3208
+
3209
+			/**
3210
+			 * Filter the widget listing listview template path.
3211
+			 *
3212
+			 * @since 1.0.0
3213
+			 */
3214
+			$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3215
+			if (!isset($character_count)) {
3216
+				/**
3217
+				 * Filter the widget's excerpt character count.
3218
+				 *
3219
+				 * @since 1.0.0
3220
+				 * @param int $instance['character_count'] Excerpt character count.
3221
+				 */
3222
+				$character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3223
+			}
3224
+
3225
+			global $post, $map_jason, $map_canvas_arr;
3226
+
3227
+			$current_post = $post;
3228
+			$current_map_jason = $map_jason;
3229
+			$current_map_canvas_arr = $map_canvas_arr;
3230
+			$geodir_is_widget_listing = true;
3231
+
3232
+			/**
3233
+			 * Includes related listing listview template.
3234
+			 *
3235
+			 * @since 1.0.0
3236
+			 */
3237
+			include($template);
3238
+
3239
+			$geodir_is_widget_listing = false;
3240
+
3241
+			$GLOBALS['post'] = $current_post;
3242
+			if (!empty($current_post))
3243
+				setup_postdata($current_post);
3244
+			$map_jason = $current_map_jason;
3245
+			$map_canvas_arr = $current_map_canvas_arr;
3246
+			?>
3247 3247
         </div>
3248 3248
     <?php
3249
-    }
3250
-    echo $after_widget;
3249
+	}
3250
+	echo $after_widget;
3251 3251
 
3252 3252
 }
3253 3253
 
@@ -3270,26 +3270,26 @@  discard block
 block discarded – undo
3270 3270
  */
3271 3271
 function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type)
3272 3272
 {
3273
-    global $wpdb, $plugin_prefix;
3273
+	global $wpdb, $plugin_prefix;
3274 3274
 
3275
-    $detail_table = $plugin_prefix . $post_type . '_detail';
3275
+	$detail_table = $plugin_prefix . $post_type . '_detail';
3276 3276
 
3277
-    $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 . ")";
3277
+	$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 . ")";
3278 3278
 
3279
-    /**
3280
-     * Filter count review sql query.
3281
-     *
3282
-     * @since 1.5.1
3283
-     * @param string $sql Database sql query..
3284
-     * @param int $term_id The term ID.
3285
-     * @param int $taxonomy The taxonomy Id.
3286
-     * @param string $post_type The post type.
3287
-     */
3288
-    $sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3279
+	/**
3280
+	 * Filter count review sql query.
3281
+	 *
3282
+	 * @since 1.5.1
3283
+	 * @param string $sql Database sql query..
3284
+	 * @param int $term_id The term ID.
3285
+	 * @param int $taxonomy The taxonomy Id.
3286
+	 * @param string $post_type The post type.
3287
+	 */
3288
+	$sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3289 3289
 
3290
-    $count = $wpdb->get_var($sql);
3290
+	$count = $wpdb->get_var($sql);
3291 3291
 
3292
-    return $count;
3292
+	return $count;
3293 3293
 }
3294 3294
 
3295 3295
 /**
@@ -3302,53 +3302,53 @@  discard block
 block discarded – undo
3302 3302
  */
3303 3303
 function geodir_count_reviews_by_terms($force_update = false)
3304 3304
 {
3305
-    /**
3306
-     * Filter review count option data.
3307
-     *
3308
-     * @since 1.0.0
3309
-     * @param bool $force_update Force update option value?. Default.false.
3310
-     */
3311
-    $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update);
3312
-    if (!empty($option_data)) {
3313
-        return $option_data;
3314
-    }
3305
+	/**
3306
+	 * Filter review count option data.
3307
+	 *
3308
+	 * @since 1.0.0
3309
+	 * @param bool $force_update Force update option value?. Default.false.
3310
+	 */
3311
+	$option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update);
3312
+	if (!empty($option_data)) {
3313
+		return $option_data;
3314
+	}
3315 3315
 
3316
-    $option_data = get_option('geodir_global_review_count');
3316
+	$option_data = get_option('geodir_global_review_count');
3317 3317
 
3318
-    if (!$option_data OR $force_update) {
3319
-        $post_types = geodir_get_posttypes();
3320
-        $term_array = array();
3321
-        foreach ($post_types as $post_type) {
3318
+	if (!$option_data OR $force_update) {
3319
+		$post_types = geodir_get_posttypes();
3320
+		$term_array = array();
3321
+		foreach ($post_types as $post_type) {
3322 3322
 
3323
-            $taxonomy = geodir_get_taxonomies($post_type);
3324
-            $taxonomy = $taxonomy[0];
3323
+			$taxonomy = geodir_get_taxonomies($post_type);
3324
+			$taxonomy = $taxonomy[0];
3325 3325
 
3326
-            $args = array(
3327
-                'hide_empty' => false
3328
-            );
3326
+			$args = array(
3327
+				'hide_empty' => false
3328
+			);
3329 3329
 
3330
-            $terms = get_terms($taxonomy, $args);
3330
+			$terms = get_terms($taxonomy, $args);
3331 3331
 
3332
-            foreach ($terms as $term) {
3333
-                $count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3334
-                $children = get_term_children($term->term_id, $taxonomy);
3335
-                /*if ( is_array( $children ) ) {
3332
+			foreach ($terms as $term) {
3333
+				$count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3334
+				$children = get_term_children($term->term_id, $taxonomy);
3335
+				/*if ( is_array( $children ) ) {
3336 3336
 					foreach ( $children as $child_id ) {
3337 3337
 						$child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type);
3338 3338
 						$count = $count + $child_count;
3339 3339
 					}
3340 3340
 				}*/
3341
-                $term_array[$term->term_id] = $count;
3342
-            }
3343
-        }
3341
+				$term_array[$term->term_id] = $count;
3342
+			}
3343
+		}
3344 3344
 
3345
-        update_option('geodir_global_review_count', $term_array);
3346
-        //clear cache
3347
-        wp_cache_delete('geodir_global_review_count');
3348
-        return $term_array;
3349
-    } else {
3350
-        return $option_data;
3351
-    }
3345
+		update_option('geodir_global_review_count', $term_array);
3346
+		//clear cache
3347
+		wp_cache_delete('geodir_global_review_count');
3348
+		return $term_array;
3349
+	} else {
3350
+		return $option_data;
3351
+	}
3352 3352
 }
3353 3353
 
3354 3354
 /**
@@ -3360,15 +3360,15 @@  discard block
 block discarded – undo
3360 3360
  */
3361 3361
 function geodir_term_review_count_force_update($new_status, $old_status='', $post='')
3362 3362
 {
3363
-    if(isset($_REQUEST['action']) && $_REQUEST['action']=='geodir_import_export'){return;}//do not run if importing listings
3364
-
3365
-    if(isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')){
3366
-        return;
3367
-    }
3368
-    if($new_status!=$old_status) {
3369
-        geodir_count_reviews_by_terms(true);
3370
-    }
3371
-    return true;
3363
+	if(isset($_REQUEST['action']) && $_REQUEST['action']=='geodir_import_export'){return;}//do not run if importing listings
3364
+
3365
+	if(isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')){
3366
+		return;
3367
+	}
3368
+	if($new_status!=$old_status) {
3369
+		geodir_count_reviews_by_terms(true);
3370
+	}
3371
+	return true;
3372 3372
 }
3373 3373
 
3374 3374
 
@@ -3387,15 +3387,15 @@  discard block
 block discarded – undo
3387 3387
 function geodir_count_posts_by_term($data, $term)
3388 3388
 {
3389 3389
 
3390
-    if ($data) {
3391
-        if (isset($data[$term->term_id])) {
3392
-            return $data[$term->term_id];
3393
-        } else {
3394
-            return 0;
3395
-        }
3396
-    } else {
3397
-        return $term->count;
3398
-    }
3390
+	if ($data) {
3391
+		if (isset($data[$term->term_id])) {
3392
+			return $data[$term->term_id];
3393
+		} else {
3394
+			return 0;
3395
+		}
3396
+	} else {
3397
+		return $term->count;
3398
+	}
3399 3399
 }
3400 3400
 
3401 3401
 /**
@@ -3408,8 +3408,8 @@  discard block
 block discarded – undo
3408 3408
  */
3409 3409
 function geodir_sort_terms_by_count($terms)
3410 3410
 {
3411
-    usort($terms, "geodir_sort_by_count_obj");
3412
-    return $terms;
3411
+	usort($terms, "geodir_sort_by_count_obj");
3412
+	return $terms;
3413 3413
 }
3414 3414
 
3415 3415
 /**
@@ -3422,8 +3422,8 @@  discard block
 block discarded – undo
3422 3422
  */
3423 3423
 function geodir_sort_terms_by_review_count($terms)
3424 3424
 {
3425
-    usort($terms, "geodir_sort_by_review_count_obj");
3426
-    return $terms;
3425
+	usort($terms, "geodir_sort_by_review_count_obj");
3426
+	return $terms;
3427 3427
 }
3428 3428
 
3429 3429
 /**
@@ -3437,12 +3437,12 @@  discard block
 block discarded – undo
3437 3437
  */
3438 3438
 function geodir_sort_terms($terms, $sort = 'count')
3439 3439
 {
3440
-    if ($sort == 'count') {
3441
-        return geodir_sort_terms_by_count($terms);
3442
-    }
3443
-    if ($sort == 'review_count') {
3444
-        return geodir_sort_terms_by_review_count($terms);
3445
-    }
3440
+	if ($sort == 'count') {
3441
+		return geodir_sort_terms_by_count($terms);
3442
+	}
3443
+	if ($sort == 'review_count') {
3444
+		return geodir_sort_terms_by_review_count($terms);
3445
+	}
3446 3446
 }
3447 3447
 
3448 3448
 /*-----------------------------------------------------------------------------------*/
@@ -3459,7 +3459,7 @@  discard block
 block discarded – undo
3459 3459
  */
3460 3460
 function geodir_sort_by_count($a, $b)
3461 3461
 {
3462
-    return $a['count'] < $b['count'];
3462
+	return $a['count'] < $b['count'];
3463 3463
 }
3464 3464
 
3465 3465
 /**
@@ -3473,7 +3473,7 @@  discard block
 block discarded – undo
3473 3473
  */
3474 3474
 function geodir_sort_by_count_obj($a, $b)
3475 3475
 {
3476
-    return $a->count < $b->count;
3476
+	return $a->count < $b->count;
3477 3477
 }
3478 3478
 
3479 3479
 /**
@@ -3487,7 +3487,7 @@  discard block
 block discarded – undo
3487 3487
  */
3488 3488
 function geodir_sort_by_review_count_obj($a, $b)
3489 3489
 {
3490
-    return $a->review_count < $b->review_count;
3490
+	return $a->review_count < $b->review_count;
3491 3491
 }
3492 3492
 
3493 3493
 /**
@@ -3497,43 +3497,43 @@  discard block
 block discarded – undo
3497 3497
  * @package GeoDirectory
3498 3498
  */
3499 3499
 function geodir_load_textdomain() {
3500
-    /**
3501
-     * Filter the plugin locale.
3502
-     *
3503
-     * @since 1.4.2
3504
-     * @package GeoDirectory
3505
-     */
3506
-    $locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
3507
-
3508
-    load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo');
3509
-    load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages');
3500
+	/**
3501
+	 * Filter the plugin locale.
3502
+	 *
3503
+	 * @since 1.4.2
3504
+	 * @package GeoDirectory
3505
+	 */
3506
+	$locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
3507
+
3508
+	load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo');
3509
+	load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages');
3510
+
3511
+	/**
3512
+	 * Define language constants.
3513
+	 *
3514
+	 * @since 1.0.0
3515
+	 */
3516
+	require_once(geodir_plugin_path() . '/language.php');
3517
+
3518
+	$language_file = geodir_plugin_path() . '/db-language.php';
3519
+
3520
+	// Load language string file if not created yet
3521
+	if (!file_exists($language_file)) {
3522
+		geodirectory_load_db_language();
3523
+	}
3510 3524
 
3511
-    /**
3512
-     * Define language constants.
3513
-     *
3514
-     * @since 1.0.0
3515
-     */
3516
-    require_once(geodir_plugin_path() . '/language.php');
3517
-
3518
-    $language_file = geodir_plugin_path() . '/db-language.php';
3519
-
3520
-    // Load language string file if not created yet
3521
-    if (!file_exists($language_file)) {
3522
-        geodirectory_load_db_language();
3523
-    }
3524
-
3525
-    if (file_exists($language_file)) {
3526
-        /**
3527
-         * Language strings from database.
3528
-         *
3529
-         * @since 1.4.2
3530
-         */
3531
-        try {
3532
-            require_once($language_file);
3533
-        } catch(Exception $e) {
3534
-            error_log('Language Error: ' . $e->getMessage());
3535
-        }
3536
-    }
3525
+	if (file_exists($language_file)) {
3526
+		/**
3527
+		 * Language strings from database.
3528
+		 *
3529
+		 * @since 1.4.2
3530
+		 */
3531
+		try {
3532
+			require_once($language_file);
3533
+		} catch(Exception $e) {
3534
+			error_log('Language Error: ' . $e->getMessage());
3535
+		}
3536
+	}
3537 3537
 }
3538 3538
 
3539 3539
 /**
@@ -3547,66 +3547,66 @@  discard block
 block discarded – undo
3547 3547
  * @return bool True if file created otherwise false
3548 3548
  */
3549 3549
 function geodirectory_load_db_language() {
3550
-    global $wp_filesystem;
3551
-    if( empty( $wp_filesystem ) ) {
3552
-        require_once( ABSPATH .'/wp-admin/includes/file.php' );
3553
-        WP_Filesystem();
3554
-        global $wp_filesystem;
3555
-    }
3556
-
3557
-    $language_file = geodir_plugin_path() . '/db-language.php';
3558
-
3559
-    if(is_file($language_file) && !is_writable($language_file))
3560
-        return false; // Not possible to create.
3561
-
3562
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3563
-        return false; // Not possible to create.
3564
-
3565
-    $contents_strings = array();
3550
+	global $wp_filesystem;
3551
+	if( empty( $wp_filesystem ) ) {
3552
+		require_once( ABSPATH .'/wp-admin/includes/file.php' );
3553
+		WP_Filesystem();
3554
+		global $wp_filesystem;
3555
+	}
3566 3556
 
3567
-    /**
3568
-     * Filter the language string from database to translate via po editor
3569
-     *
3570
-     * @since 1.4.2
3571
-     *
3572
-     * @param array $contents_strings Array of strings.
3573
-     */
3574
-    $contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
3575
-
3576
-    $contents_strings = array_unique($contents_strings);
3577
-
3578
-    $contents_head = array();
3579
-    $contents_head[] = "<?php";
3580
-    $contents_head[] = "/**";
3581
-    $contents_head[] = " * Translate language string stored in database. Ex: Custom Fields";
3582
-    $contents_head[] = " *";
3583
-    $contents_head[] = " * @package GeoDirectory";
3584
-    $contents_head[] = " * @since 1.4.2";
3585
-    $contents_head[] = " */";
3586
-    $contents_head[] = "";
3587
-    $contents_head[] = "// Language keys";
3588
-
3589
-    $contents_foot = array();
3590
-    $contents_foot[] = "";
3591
-    $contents_foot[] = "";
3592
-
3593
-    $contents = implode(PHP_EOL, $contents_head);
3594
-
3595
-    if (!empty($contents_strings)) {
3596
-        foreach ( $contents_strings as $string ) {
3597
-            if (is_scalar($string) && $string != '') {
3598
-                $string = str_replace("'", "\'", $string);
3599
-                $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
3600
-            }
3601
-        }
3602
-    }
3557
+	$language_file = geodir_plugin_path() . '/db-language.php';
3558
+
3559
+	if(is_file($language_file) && !is_writable($language_file))
3560
+		return false; // Not possible to create.
3561
+
3562
+	if(!is_file($language_file) && !is_writable(dirname($language_file)))
3563
+		return false; // Not possible to create.
3564
+
3565
+	$contents_strings = array();
3566
+
3567
+	/**
3568
+	 * Filter the language string from database to translate via po editor
3569
+	 *
3570
+	 * @since 1.4.2
3571
+	 *
3572
+	 * @param array $contents_strings Array of strings.
3573
+	 */
3574
+	$contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
3575
+
3576
+	$contents_strings = array_unique($contents_strings);
3577
+
3578
+	$contents_head = array();
3579
+	$contents_head[] = "<?php";
3580
+	$contents_head[] = "/**";
3581
+	$contents_head[] = " * Translate language string stored in database. Ex: Custom Fields";
3582
+	$contents_head[] = " *";
3583
+	$contents_head[] = " * @package GeoDirectory";
3584
+	$contents_head[] = " * @since 1.4.2";
3585
+	$contents_head[] = " */";
3586
+	$contents_head[] = "";
3587
+	$contents_head[] = "// Language keys";
3588
+
3589
+	$contents_foot = array();
3590
+	$contents_foot[] = "";
3591
+	$contents_foot[] = "";
3592
+
3593
+	$contents = implode(PHP_EOL, $contents_head);
3594
+
3595
+	if (!empty($contents_strings)) {
3596
+		foreach ( $contents_strings as $string ) {
3597
+			if (is_scalar($string) && $string != '') {
3598
+				$string = str_replace("'", "\'", $string);
3599
+				$contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
3600
+			}
3601
+		}
3602
+	}
3603 3603
 
3604
-    $contents .= implode(PHP_EOL, $contents_foot);
3604
+	$contents .= implode(PHP_EOL, $contents_foot);
3605 3605
 
3606
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3607
-        return false; // Failure; could not write file.
3606
+	if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3607
+		return false; // Failure; could not write file.
3608 3608
 
3609
-    return true;
3609
+	return true;
3610 3610
 }
3611 3611
 
3612 3612
 /**
@@ -3622,31 +3622,31 @@  discard block
 block discarded – undo
3622 3622
  * @return array Translation texts.
3623 3623
  */
3624 3624
 function geodir_load_custom_field_translation($translation_texts = array()) {
3625
-    global $wpdb;
3625
+	global $wpdb;
3626 3626
 
3627
-    // Custom fields table
3628
-    $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
3629
-    $rows = $wpdb->get_results($sql);
3627
+	// Custom fields table
3628
+	$sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
3629
+	$rows = $wpdb->get_results($sql);
3630 3630
 
3631
-    if (!empty($rows)) {
3632
-        foreach($rows as $row) {
3633
-            if (!empty($row->admin_title))
3634
-                $translation_texts[] = stripslashes_deep($row->admin_title);
3631
+	if (!empty($rows)) {
3632
+		foreach($rows as $row) {
3633
+			if (!empty($row->admin_title))
3634
+				$translation_texts[] = stripslashes_deep($row->admin_title);
3635 3635
 			
3636
-            if (!empty($row->admin_desc))
3637
-                $translation_texts[] = stripslashes_deep($row->admin_desc);
3636
+			if (!empty($row->admin_desc))
3637
+				$translation_texts[] = stripslashes_deep($row->admin_desc);
3638 3638
 
3639
-            if (!empty($row->site_title))
3640
-                $translation_texts[] = stripslashes_deep($row->site_title);
3639
+			if (!empty($row->site_title))
3640
+				$translation_texts[] = stripslashes_deep($row->site_title);
3641 3641
 
3642
-            if (!empty($row->clabels))
3643
-                $translation_texts[] = stripslashes_deep($row->clabels);
3642
+			if (!empty($row->clabels))
3643
+				$translation_texts[] = stripslashes_deep($row->clabels);
3644 3644
 
3645
-            if (!empty($row->required_msg))
3646
-                $translation_texts[] = stripslashes_deep($row->required_msg);
3645
+			if (!empty($row->required_msg))
3646
+				$translation_texts[] = stripslashes_deep($row->required_msg);
3647 3647
 			
3648 3648
 			if (!empty($row->default_value))
3649
-                $translation_texts[] = stripslashes_deep($row->default_value);
3649
+				$translation_texts[] = stripslashes_deep($row->default_value);
3650 3650
 			
3651 3651
 			if (!empty($row->option_values)) {
3652 3652
 				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
@@ -3659,25 +3659,25 @@  discard block
 block discarded – undo
3659 3659
 					}
3660 3660
 				}
3661 3661
 			}
3662
-        }
3663
-    }
3662
+		}
3663
+	}
3664 3664
 	
3665
-    // Custom sorting fields table
3666
-    $sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3667
-    $rows = $wpdb->get_results($sql);
3665
+	// Custom sorting fields table
3666
+	$sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3667
+	$rows = $wpdb->get_results($sql);
3668 3668
 
3669
-    if (!empty($rows)) {
3670
-        foreach($rows as $row) {
3671
-            if (!empty($row->site_title))
3672
-                $translation_texts[] = stripslashes_deep($row->site_title);
3669
+	if (!empty($rows)) {
3670
+		foreach($rows as $row) {
3671
+			if (!empty($row->site_title))
3672
+				$translation_texts[] = stripslashes_deep($row->site_title);
3673 3673
 
3674
-            if (!empty($row->asc_title))
3675
-                $translation_texts[] = stripslashes_deep($row->asc_title);
3674
+			if (!empty($row->asc_title))
3675
+				$translation_texts[] = stripslashes_deep($row->asc_title);
3676 3676
 
3677
-            if (!empty($row->desc_title))
3678
-                $translation_texts[] = stripslashes_deep($row->desc_title);
3679
-        }
3680
-    }
3677
+			if (!empty($row->desc_title))
3678
+				$translation_texts[] = stripslashes_deep($row->desc_title);
3679
+		}
3680
+	}
3681 3681
 	
3682 3682
 	// Advance search filter fields table
3683 3683
 	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
@@ -3698,9 +3698,9 @@  discard block
 block discarded – undo
3698 3698
 		}
3699 3699
 	}
3700 3700
 
3701
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3701
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3702 3702
 
3703
-    return $translation_texts;
3703
+	return $translation_texts;
3704 3704
 }
3705 3705
 
3706 3706
 /**
@@ -3712,71 +3712,71 @@  discard block
 block discarded – undo
3712 3712
  * @return array Array of mime types.
3713 3713
  */
3714 3714
 function geodir_allowed_mime_types() {
3715
-    /**
3716
-     * Filter the list of mime types and file extensions allowed for file upload.
3717
-     *
3718
-     * @since 1.4.7
3719
-     * @package GeoDirectory
3720
-     *
3721
-     * @param array $geodir_allowed_mime_types and file extensions.
3722
-     */
3723
-    return apply_filters( 'geodir_allowed_mime_types', array(
3724
-            'Image' => array( // Image formats.
3725
-                'jpg' => 'image/jpeg',
3726
-                'jpe' => 'image/jpeg',
3727
-                'jpeg' => 'image/jpeg',
3728
-                'gif' => 'image/gif',
3729
-                'png' => 'image/png',
3730
-                'bmp' => 'image/bmp',
3731
-                'ico' => 'image/x-icon',
3732
-            ),
3733
-            'Video' => array( // Video formats.
3734
-                'asf' => 'video/x-ms-asf',
3735
-                'avi' => 'video/avi',
3736
-                'flv' => 'video/x-flv',
3737
-                'mkv' => 'video/x-matroska',
3738
-                'mp4' => 'video/mp4',
3739
-                'mpeg' => 'video/mpeg',
3740
-                'mpg' => 'video/mpeg',
3741
-                'wmv' => 'video/x-ms-wmv',
3742
-                '3gp' => 'video/3gpp',
3743
-            ),
3744
-            'Audio' => array( // Audio formats.
3745
-                'ogg' => 'audio/ogg',
3746
-                'mp3' => 'audio/mpeg',
3747
-                'wav' => 'audio/wav',
3748
-                'wma' => 'audio/x-ms-wma',
3749
-            ),
3750
-            'Text' => array( // Text formats.
3751
-                'css' => 'text/css',
3752
-                'csv' => 'text/csv',
3753
-                'htm' => 'text/html',
3754
-                'html' => 'text/html',
3755
-                'txt' => 'text/plain',
3756
-                'rtx' => 'text/richtext',
3757
-                'vtt' => 'text/vtt',
3758
-            ),
3759
-            'Application' => array( // Application formats.
3760
-                'doc' => 'application/msword',
3761
-                'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
3762
-                'exe' => 'application/x-msdownload',
3763
-                'js' => 'application/javascript',
3764
-                'odt' => 'application/vnd.oasis.opendocument.text',
3765
-                'pdf' => 'application/pdf',
3766
-                'pot' => 'application/vnd.ms-powerpoint',
3767
-                'ppt' => 'application/vnd.ms-powerpoint',
3768
-                'pptx' => 'application/vnd.ms-powerpoint',
3769
-                'psd' => 'application/octet-stream',
3770
-                'rar' => 'application/rar',
3771
-                'rtf' => 'application/rtf',
3772
-                'swf' => 'application/x-shockwave-flash',
3773
-                'tar' => 'application/x-tar',
3774
-                'xls' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3775
-                'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3776
-                'zip' => 'application/zip',
3777
-            )
3778
-        )
3779
-    );
3715
+	/**
3716
+	 * Filter the list of mime types and file extensions allowed for file upload.
3717
+	 *
3718
+	 * @since 1.4.7
3719
+	 * @package GeoDirectory
3720
+	 *
3721
+	 * @param array $geodir_allowed_mime_types and file extensions.
3722
+	 */
3723
+	return apply_filters( 'geodir_allowed_mime_types', array(
3724
+			'Image' => array( // Image formats.
3725
+				'jpg' => 'image/jpeg',
3726
+				'jpe' => 'image/jpeg',
3727
+				'jpeg' => 'image/jpeg',
3728
+				'gif' => 'image/gif',
3729
+				'png' => 'image/png',
3730
+				'bmp' => 'image/bmp',
3731
+				'ico' => 'image/x-icon',
3732
+			),
3733
+			'Video' => array( // Video formats.
3734
+				'asf' => 'video/x-ms-asf',
3735
+				'avi' => 'video/avi',
3736
+				'flv' => 'video/x-flv',
3737
+				'mkv' => 'video/x-matroska',
3738
+				'mp4' => 'video/mp4',
3739
+				'mpeg' => 'video/mpeg',
3740
+				'mpg' => 'video/mpeg',
3741
+				'wmv' => 'video/x-ms-wmv',
3742
+				'3gp' => 'video/3gpp',
3743
+			),
3744
+			'Audio' => array( // Audio formats.
3745
+				'ogg' => 'audio/ogg',
3746
+				'mp3' => 'audio/mpeg',
3747
+				'wav' => 'audio/wav',
3748
+				'wma' => 'audio/x-ms-wma',
3749
+			),
3750
+			'Text' => array( // Text formats.
3751
+				'css' => 'text/css',
3752
+				'csv' => 'text/csv',
3753
+				'htm' => 'text/html',
3754
+				'html' => 'text/html',
3755
+				'txt' => 'text/plain',
3756
+				'rtx' => 'text/richtext',
3757
+				'vtt' => 'text/vtt',
3758
+			),
3759
+			'Application' => array( // Application formats.
3760
+				'doc' => 'application/msword',
3761
+				'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
3762
+				'exe' => 'application/x-msdownload',
3763
+				'js' => 'application/javascript',
3764
+				'odt' => 'application/vnd.oasis.opendocument.text',
3765
+				'pdf' => 'application/pdf',
3766
+				'pot' => 'application/vnd.ms-powerpoint',
3767
+				'ppt' => 'application/vnd.ms-powerpoint',
3768
+				'pptx' => 'application/vnd.ms-powerpoint',
3769
+				'psd' => 'application/octet-stream',
3770
+				'rar' => 'application/rar',
3771
+				'rtf' => 'application/rtf',
3772
+				'swf' => 'application/x-shockwave-flash',
3773
+				'tar' => 'application/x-tar',
3774
+				'xls' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3775
+				'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3776
+				'zip' => 'application/zip',
3777
+			)
3778
+		)
3779
+	);
3780 3780
 }
3781 3781
 
3782 3782
 /**
@@ -3788,21 +3788,21 @@  discard block
 block discarded – undo
3788 3788
  * @return string User display name.
3789 3789
  */
3790 3790
 function geodir_get_client_name($user_id) {
3791
-    $client_name = '';
3791
+	$client_name = '';
3792 3792
 
3793
-    $user_data = get_userdata($user_id);
3793
+	$user_data = get_userdata($user_id);
3794 3794
 
3795
-    if (!empty($user_data)) {
3796
-        if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
3797
-            $client_name = trim($user_data->display_name);
3798
-        } else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
3799
-            $client_name = trim($user_data->user_nicename);
3800
-        } else {
3801
-            $client_name = trim($user_data->user_login);
3802
-        }
3803
-    }
3795
+	if (!empty($user_data)) {
3796
+		if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
3797
+			$client_name = trim($user_data->display_name);
3798
+		} else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
3799
+			$client_name = trim($user_data->user_nicename);
3800
+		} else {
3801
+			$client_name = trim($user_data->user_login);
3802
+		}
3803
+	}
3804 3804
 
3805
-    return $client_name;
3805
+	return $client_name;
3806 3806
 }
3807 3807
 
3808 3808
 
@@ -3817,125 +3817,125 @@  discard block
 block discarded – undo
3817 3817
  */
3818 3818
 function geodir_wpseo_replacements($vars){
3819 3819
 
3820
-    global $wp;
3821
-    $title = '';
3822
-    // location variables
3823
-    $gd_post_type = geodir_get_current_posttype();
3824
-    $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
3825
-    /**
3826
-     * Filter the title variables location variables array
3827
-     *
3828
-     * @since 1.5.5
3829
-     * @package GeoDirectory
3830
-     * @param array $location_array The array of location variables.
3831
-     * @param array $vars The page title variables.
3832
-     */
3833
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
3834
-    $location_titles = array();
3835
-    if(get_query_var( 'gd_country_full' )){
3836
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
3837
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
3838
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
3839
-    }
3840
-    $location_single = '';
3841
-    $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
3842
-    $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
3843
-    $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
3844
-
3845
-    $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
3846
-
3847
-    if (function_exists('get_actual_location_name')) {
3848
-        $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
3849
-        $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
3850
-        $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
3851
-    }
3852
-
3853
-    if ($gd_city != '') {
3854
-        if ($gd_city_actual != '') {
3855
-            $gd_city = $gd_city_actual;
3856
-        } else {
3857
-            $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
3858
-            $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
3859
-            $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
3860
-        }
3861
-        $location_single = $gd_city;
3862
-
3863
-    } else if ($gd_region != '') {
3864
-        if ($gd_region_actual != '') {
3865
-            $gd_region = $gd_region_actual;
3866
-        } else {
3867
-            $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
3868
-            $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
3869
-            $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
3870
-        }
3820
+	global $wp;
3821
+	$title = '';
3822
+	// location variables
3823
+	$gd_post_type = geodir_get_current_posttype();
3824
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
3825
+	/**
3826
+	 * Filter the title variables location variables array
3827
+	 *
3828
+	 * @since 1.5.5
3829
+	 * @package GeoDirectory
3830
+	 * @param array $location_array The array of location variables.
3831
+	 * @param array $vars The page title variables.
3832
+	 */
3833
+	$location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
3834
+	$location_titles = array();
3835
+	if(get_query_var( 'gd_country_full' )){
3836
+		if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
3837
+		if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
3838
+		if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
3839
+	}
3840
+	$location_single = '';
3841
+	$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
3842
+	$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
3843
+	$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
3871 3844
 
3872
-        $location_single = $gd_region;
3873
-    } else if ($gd_country != '') {
3874
-        if ($gd_country_actual != '') {
3875
-            $gd_country = $gd_country_actual;
3876
-        } else {
3877
-            $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
3878
-            $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
3879
-            $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
3880
-        }
3845
+	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
3846
+
3847
+	if (function_exists('get_actual_location_name')) {
3848
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
3849
+		$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
3850
+		$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
3851
+	}
3881 3852
 
3882
-        $location_single = $gd_country;
3883
-    }
3853
+	if ($gd_city != '') {
3854
+		if ($gd_city_actual != '') {
3855
+			$gd_city = $gd_city_actual;
3856
+		} else {
3857
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
3858
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
3859
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
3860
+		}
3861
+		$location_single = $gd_city;
3862
+
3863
+	} else if ($gd_region != '') {
3864
+		if ($gd_region_actual != '') {
3865
+			$gd_region = $gd_region_actual;
3866
+		} else {
3867
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
3868
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
3869
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
3870
+		}
3871
+
3872
+		$location_single = $gd_region;
3873
+	} else if ($gd_country != '') {
3874
+		if ($gd_country_actual != '') {
3875
+			$gd_country = $gd_country_actual;
3876
+		} else {
3877
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
3878
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
3879
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
3880
+		}
3884 3881
 
3885
-    if (!empty($location_array)) {
3882
+		$location_single = $gd_country;
3883
+	}
3886 3884
 
3887
-        $actual_location_name = function_exists('get_actual_location_name') ? true : false;
3888
-        $location_array = array_reverse($location_array);
3885
+	if (!empty($location_array)) {
3889 3886
 
3890
-        foreach ($location_array as $location_type => $location) {
3891
-            $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
3892
-            $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
3887
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
3888
+		$location_array = array_reverse($location_array);
3893 3889
 
3894
-            $location_name = geodir_ucwords($gd_location_link_text);
3895
-            $location_name = __($location_name, 'geodirectory');
3890
+		foreach ($location_array as $location_type => $location) {
3891
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
3892
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
3896 3893
 
3897
-            if ($actual_location_name) {
3898
-                $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
3899
-                $location_name = get_actual_location_name($location_type, $location, true);
3900
-            }
3894
+			$location_name = geodir_ucwords($gd_location_link_text);
3895
+			$location_name = __($location_name, 'geodirectory');
3901 3896
 
3902
-            $location_titles[] = $location_name;
3903
-        }
3904
-        if (!empty($location_titles)) {
3905
-            $location_titles = array_unique($location_titles);
3906
-        }
3907
-    }
3897
+			if ($actual_location_name) {
3898
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
3899
+				$location_name = get_actual_location_name($location_type, $location, true);
3900
+			}
3908 3901
 
3902
+			$location_titles[] = $location_name;
3903
+		}
3904
+		if (!empty($location_titles)) {
3905
+			$location_titles = array_unique($location_titles);
3906
+		}
3907
+	}
3909 3908
 
3910
-    if(!empty($location_titles)) {
3911
-        $vars['%%location%%'] = implode(", ", $location_titles);
3912
-    }
3913 3909
 
3910
+	if(!empty($location_titles)) {
3911
+		$vars['%%location%%'] = implode(", ", $location_titles);
3912
+	}
3914 3913
 
3915
-    if(!empty($location_titles)) {
3916
-        $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
3917
-    }
3918 3914
 
3915
+	if(!empty($location_titles)) {
3916
+		$vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
3917
+	}
3919 3918
 
3920 3919
 
3921
-    if($location_single) {
3922
-        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
3923
-    }
3924 3920
 
3921
+	if($location_single) {
3922
+		$vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
3923
+	}
3925 3924
 
3926
-    if($location_single) {
3927
-        $vars['%%location_single%%'] = $location_single;
3928
-    }
3929 3925
 
3930
-    /**
3931
-     * Filter the title variables after standard ones have been filtered for wpseo.
3932
-     *
3933
-     * @since 1.5.7
3934
-     * @package GeoDirectory
3935
-     * @param string $vars The title with variables.
3936
-     * @param array $location_array The array of location variables.
3937
-     */
3938
-    return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
3926
+	if($location_single) {
3927
+		$vars['%%location_single%%'] = $location_single;
3928
+	}
3929
+
3930
+	/**
3931
+	 * Filter the title variables after standard ones have been filtered for wpseo.
3932
+	 *
3933
+	 * @since 1.5.7
3934
+	 * @package GeoDirectory
3935
+	 * @param string $vars The title with variables.
3936
+	 * @param array $location_array The array of location variables.
3937
+	 */
3938
+	return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
3939 3939
 }
3940 3940
 
3941 3941
 
@@ -3945,10 +3945,10 @@  discard block
 block discarded – undo
3945 3945
 function geodir_filter_title_variables($title, $gd_page, $sep=''){
3946 3946
 
3947 3947
 
3948
-    if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
3949
-    global $post;
3950
-    //print_r($post);
3951
-    /*
3948
+	if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
3949
+	global $post;
3950
+	//print_r($post);
3951
+	/*
3952 3952
     %%date%%	                Replaced with the date of the post/page
3953 3953
     %%title%%	                Replaced with the title of the post/page
3954 3954
     %%sitename%%	            The site's name
@@ -3975,134 +3975,134 @@  discard block
 block discarded – undo
3975 3975
     %%pagenumber%%	            Replaced with the current page number
3976 3976
      */
3977 3977
 
3978
-    if ($sep == '') {
3979
-        /**
3980
-         * Filter the page title separator.
3981
-         *
3982
-         * @since 1.0.0
3983
-         * @package GeoDirectory
3984
-         * @param string $sep The separator, default: `|`.
3985
-         */
3986
-        $sep = apply_filters('geodir_page_title_separator', '|');
3987
-    }
3988
-
3989
-
3990
-    if(strpos($title,'%%title%%') !== false){
3991
-        $title = str_replace("%%title%%",$post->post_title,$title);
3992
-    }
3993
-
3994
-    if(strpos($title,'%%sitename%%') !== false){
3995
-        $title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
3996
-    }
3997
-
3998
-    if(strpos($title,'%%sitedesc%%') !== false){
3999
-        $title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
4000
-    }
4001
-
4002
-    if(strpos($title,'%%excerpt%%') !== false){
4003
-        $title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
4004
-    }
4005
-
4006
-    if(strpos($title,'%%pt_single%%') !== false){
4007
-        $single_name = '';
4008
-        if($gd_page=='search' || $gd_page=='author'){
4009
-            $geodir_post_types = get_option('geodir_post_types');
4010
-            $spt = esc_attr($_REQUEST['stype']);
4011
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4012
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4013
-            }
4014
-        }elseif($gd_page=='add-listing'){
4015
-            $geodir_post_types = get_option('geodir_post_types');
4016
-            $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
4017
-            if(!$spt && isset($_REQUEST['pid'])){
4018
-                $spt = get_post_type( $_REQUEST['pid'] );
4019
-            }
4020
-            if(!$spt){$spt='gd_place';}
4021
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4022
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4023
-            }
4024
-        }
4025
-        elseif($post->post_type){
4026
-            $geodir_post_types = get_option('geodir_post_types');
4027
-            if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4028
-                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
4029
-            }
3978
+	if ($sep == '') {
3979
+		/**
3980
+		 * Filter the page title separator.
3981
+		 *
3982
+		 * @since 1.0.0
3983
+		 * @package GeoDirectory
3984
+		 * @param string $sep The separator, default: `|`.
3985
+		 */
3986
+		$sep = apply_filters('geodir_page_title_separator', '|');
3987
+	}
4030 3988
 
4031 3989
 
4032
-        }
4033
-        $title = str_replace("%%pt_single%%",$single_name,$title);
4034
-    }
4035
-
4036
-    if(strpos($title,'%%pt_plural%%') !== false){
4037
-        $plural_name = '';
4038
-        if($gd_page=='search' || $gd_page=='author'){
4039
-            $geodir_post_types = get_option('geodir_post_types');
4040
-            $spt = esc_attr($_REQUEST['stype']);
4041
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4042
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4043
-            }
4044
-        }elseif($gd_page=='add-listing'){
4045
-            $geodir_post_types = get_option('geodir_post_types');
4046
-            $spt = sanitize_text_field($_REQUEST['listing_type']);
4047
-            if(!$spt){$spt='gd_place';}
4048
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4049
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4050
-            }
4051
-        }
4052
-        elseif(isset($post->post_type) && $post->post_type){
4053
-            $geodir_post_types = get_option('geodir_post_types');
4054
-            if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4055
-                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
4056
-            }
3990
+	if(strpos($title,'%%title%%') !== false){
3991
+		$title = str_replace("%%title%%",$post->post_title,$title);
3992
+	}
4057 3993
 
4058
-        }
4059
-        $title = str_replace("%%pt_plural%%",$plural_name,$title);
4060
-    }
3994
+	if(strpos($title,'%%sitename%%') !== false){
3995
+		$title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
3996
+	}
4061 3997
 
3998
+	if(strpos($title,'%%sitedesc%%') !== false){
3999
+		$title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
4000
+	}
4062 4001
 
4002
+	if(strpos($title,'%%excerpt%%') !== false){
4003
+		$title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
4004
+	}
4063 4005
 
4064
-    if(strpos($title,'%%category%%') !== false){
4065
-        $cat_name = '';
4006
+	if(strpos($title,'%%pt_single%%') !== false){
4007
+		$single_name = '';
4008
+		if($gd_page=='search' || $gd_page=='author'){
4009
+			$geodir_post_types = get_option('geodir_post_types');
4010
+			$spt = esc_attr($_REQUEST['stype']);
4011
+			if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4012
+				$single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4013
+			}
4014
+		}elseif($gd_page=='add-listing'){
4015
+			$geodir_post_types = get_option('geodir_post_types');
4016
+			$spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
4017
+			if(!$spt && isset($_REQUEST['pid'])){
4018
+				$spt = get_post_type( $_REQUEST['pid'] );
4019
+			}
4020
+			if(!$spt){$spt='gd_place';}
4021
+			if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4022
+				$single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4023
+			}
4024
+		}
4025
+		elseif($post->post_type){
4026
+			$geodir_post_types = get_option('geodir_post_types');
4027
+			if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4028
+				$single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
4029
+			}
4066 4030
 
4067
-        if($gd_page=='detail') {
4068
-            if ($post->default_category) {
4069
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4070
-                $cat_name = (isset($cat->name)) ? $cat->name : '';
4071
-            }
4072
-        }elseif($gd_page=='listing'){
4073
-            $queried_object = get_queried_object();
4074
-            if(isset($queried_object->name)){
4075
-                $cat_name = $queried_object->name;
4076
-            }
4077
-        }
4078
-        $title = str_replace("%%category%%",$cat_name,$title);
4079
-    }
4080
-
4081
-    if(strpos($title,'%%tag%%') !== false){
4082
-        $cat_name = '';
4083
-
4084
-        if($gd_page=='detail') {
4085
-            if ($post->default_category) {
4086
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4087
-                $cat_name = (isset($cat->name)) ? $cat->name : '';
4088
-            }
4089
-        }elseif($gd_page=='listing'){
4090
-            $queried_object = get_queried_object();
4091
-            if(isset($queried_object->name)){
4092
-                $cat_name = $queried_object->name;
4093
-            }
4094
-        }
4095
-        $title = str_replace("%%tag%%",$cat_name,$title);
4096
-    }
4031
+
4032
+		}
4033
+		$title = str_replace("%%pt_single%%",$single_name,$title);
4034
+	}
4035
+
4036
+	if(strpos($title,'%%pt_plural%%') !== false){
4037
+		$plural_name = '';
4038
+		if($gd_page=='search' || $gd_page=='author'){
4039
+			$geodir_post_types = get_option('geodir_post_types');
4040
+			$spt = esc_attr($_REQUEST['stype']);
4041
+			if(isset($geodir_post_types[$spt]['labels']['name'])){
4042
+				$plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4043
+			}
4044
+		}elseif($gd_page=='add-listing'){
4045
+			$geodir_post_types = get_option('geodir_post_types');
4046
+			$spt = sanitize_text_field($_REQUEST['listing_type']);
4047
+			if(!$spt){$spt='gd_place';}
4048
+			if(isset($geodir_post_types[$spt]['labels']['name'])){
4049
+				$plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4050
+			}
4051
+		}
4052
+		elseif(isset($post->post_type) && $post->post_type){
4053
+			$geodir_post_types = get_option('geodir_post_types');
4054
+			if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4055
+				$plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
4056
+			}
4057
+
4058
+		}
4059
+		$title = str_replace("%%pt_plural%%",$plural_name,$title);
4060
+	}
4061
+
4062
+
4063
+
4064
+	if(strpos($title,'%%category%%') !== false){
4065
+		$cat_name = '';
4066
+
4067
+		if($gd_page=='detail') {
4068
+			if ($post->default_category) {
4069
+				$cat = get_term($post->default_category, $post->post_type . 'category');
4070
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4071
+			}
4072
+		}elseif($gd_page=='listing'){
4073
+			$queried_object = get_queried_object();
4074
+			if(isset($queried_object->name)){
4075
+				$cat_name = $queried_object->name;
4076
+			}
4077
+		}
4078
+		$title = str_replace("%%category%%",$cat_name,$title);
4079
+	}
4080
+
4081
+	if(strpos($title,'%%tag%%') !== false){
4082
+		$cat_name = '';
4083
+
4084
+		if($gd_page=='detail') {
4085
+			if ($post->default_category) {
4086
+				$cat = get_term($post->default_category, $post->post_type . 'category');
4087
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4088
+			}
4089
+		}elseif($gd_page=='listing'){
4090
+			$queried_object = get_queried_object();
4091
+			if(isset($queried_object->name)){
4092
+				$cat_name = $queried_object->name;
4093
+			}
4094
+		}
4095
+		$title = str_replace("%%tag%%",$cat_name,$title);
4096
+	}
4097 4097
 
4098 4098
 
4099 4099
 
4100
-    if(strpos($title,'%%id%%') !== false){
4101
-        $ID = (isset($post->ID)) ? $post->ID : '';
4102
-        $title = str_replace("%%id%%",$ID,$title);
4103
-    }
4100
+	if(strpos($title,'%%id%%') !== false){
4101
+		$ID = (isset($post->ID)) ? $post->ID : '';
4102
+		$title = str_replace("%%id%%",$ID,$title);
4103
+	}
4104 4104
 
4105
-    /*
4105
+	/*
4106 4106
         if(strpos($title,'') !== false){
4107 4107
             $title = str_replace("",,$title);
4108 4108
         }
@@ -4112,174 +4112,174 @@  discard block
 block discarded – undo
4112 4112
         }
4113 4113
     */
4114 4114
 
4115
-    if(strpos($title,'%%sep%%') !== false){
4116
-        $title = str_replace("%%sep%%",$sep,$title);
4117
-    }
4118
-
4119
-
4120
-    global $wp;
4121
-    // location variables
4122
-    $gd_post_type = geodir_get_current_posttype();
4123
-    $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4124
-    /**
4125
-     * Filter the title variables location variables array
4126
-     *
4127
-     * @since 1.5.5
4128
-     * @package GeoDirectory
4129
-     * @param array $location_array The array of location variables.
4130
-     * @param string $title The title with variables..
4131
-     * @param string $gd_page The page being filtered.
4132
-     * @param string $sep The separator, default: `|`.
4133
-     */
4134
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4135
-    $location_titles = array();
4136
-    if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4137
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4138
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4139
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4140
-    }
4141
-    $location_single = '';
4142
-    $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4143
-    $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4144
-    $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4145
-
4146
-    $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4147
-
4148
-    if (function_exists('get_actual_location_name')) {
4149
-        $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4150
-        $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4151
-        $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4152
-    }
4153
-
4154
-    if ($gd_city != '') {
4155
-        if ($gd_city_actual != '') {
4156
-            $gd_city = $gd_city_actual;
4157
-        } else {
4158
-            $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4159
-            $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4160
-            $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4161
-        }
4162
-        $location_single = $gd_city;
4163
-
4164
-    } else if ($gd_region != '') {
4165
-        if ($gd_region_actual != '') {
4166
-            $gd_region = $gd_region_actual;
4167
-        } else {
4168
-            $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4169
-            $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4170
-            $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4171
-        }
4115
+	if(strpos($title,'%%sep%%') !== false){
4116
+		$title = str_replace("%%sep%%",$sep,$title);
4117
+	}
4172 4118
 
4173
-        $location_single = $gd_region;
4174
-    } else if ($gd_country != '') {
4175
-        if ($gd_country_actual != '') {
4176
-            $gd_country = $gd_country_actual;
4177
-        } else {
4178
-            $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4179
-            $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4180
-            $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4181
-        }
4182 4119
 
4183
-        $location_single = $gd_country;
4184
-    }
4120
+	global $wp;
4121
+	// location variables
4122
+	$gd_post_type = geodir_get_current_posttype();
4123
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4124
+	/**
4125
+	 * Filter the title variables location variables array
4126
+	 *
4127
+	 * @since 1.5.5
4128
+	 * @package GeoDirectory
4129
+	 * @param array $location_array The array of location variables.
4130
+	 * @param string $title The title with variables..
4131
+	 * @param string $gd_page The page being filtered.
4132
+	 * @param string $sep The separator, default: `|`.
4133
+	 */
4134
+	$location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4135
+	$location_titles = array();
4136
+	if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4137
+		if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4138
+		if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4139
+		if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4140
+	}
4141
+	$location_single = '';
4142
+	$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4143
+	$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4144
+	$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4185 4145
 
4186
-    if (!empty($location_array)) {
4146
+	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4187 4147
 
4188
-        $actual_location_name = function_exists('get_actual_location_name') ? true : false;
4189
-        $location_array = array_reverse($location_array);
4148
+	if (function_exists('get_actual_location_name')) {
4149
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4150
+		$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4151
+		$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4152
+	}
4190 4153
 
4191
-        foreach ($location_array as $location_type => $location) {
4192
-            $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4193
-            $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4154
+	if ($gd_city != '') {
4155
+		if ($gd_city_actual != '') {
4156
+			$gd_city = $gd_city_actual;
4157
+		} else {
4158
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4159
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4160
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4161
+		}
4162
+		$location_single = $gd_city;
4163
+
4164
+	} else if ($gd_region != '') {
4165
+		if ($gd_region_actual != '') {
4166
+			$gd_region = $gd_region_actual;
4167
+		} else {
4168
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4169
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4170
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4171
+		}
4194 4172
 
4195
-            $location_name = geodir_ucwords($gd_location_link_text);
4196
-            $location_name = __($location_name, 'geodirectory');
4173
+		$location_single = $gd_region;
4174
+	} else if ($gd_country != '') {
4175
+		if ($gd_country_actual != '') {
4176
+			$gd_country = $gd_country_actual;
4177
+		} else {
4178
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4179
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4180
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4181
+		}
4197 4182
 
4198
-            if ($actual_location_name) {
4199
-                $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4200
-                $location_name = get_actual_location_name($location_type, $location, true);
4201
-            }
4183
+		$location_single = $gd_country;
4184
+	}
4202 4185
 
4203
-            $location_titles[] = $location_name;
4204
-        }
4205
-        if (!empty($location_titles)) {
4206
-            $location_titles = array_unique($location_titles);
4207
-        }
4208
-    }
4186
+	if (!empty($location_array)) {
4209 4187
 
4188
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4189
+		$location_array = array_reverse($location_array);
4210 4190
 
4211
-    if(strpos($title,'%%location%%') !== false){
4212
-        $location = '';
4213
-        if($location_titles) {
4214
-            $location = implode(", ", $location_titles);
4215
-        }
4216
-        $title = str_replace("%%location%%",$location,$title);
4217
-    }
4191
+		foreach ($location_array as $location_type => $location) {
4192
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4193
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4218 4194
 
4219
-    if(strpos($title,'%%in_location%%') !== false){
4220
-        $location = '';
4221
-        if($location_titles) {
4222
-            $location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4223
-        }
4224
-        $title = str_replace("%%in_location%%",$location,$title);
4225
-    }
4195
+			$location_name = geodir_ucwords($gd_location_link_text);
4196
+			$location_name = __($location_name, 'geodirectory');
4226 4197
 
4227
-    if(strpos($title,'%%in_location_single%%') !== false){
4228
-        if($location_single) {
4229
-            $location_single = __('in', 'geodirectory') . ' ' .$location_single;
4230
-        }
4231
-        $title = str_replace("%%in_location_single%%",$location_single,$title);
4232
-    }
4198
+			if ($actual_location_name) {
4199
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4200
+				$location_name = get_actual_location_name($location_type, $location, true);
4201
+			}
4233 4202
 
4234
-    if(strpos($title,'%%location_single%%') !== false){
4235
-        $title = str_replace("%%location_single%%",$location_single,$title);
4236
-    }
4203
+			$location_titles[] = $location_name;
4204
+		}
4205
+		if (!empty($location_titles)) {
4206
+			$location_titles = array_unique($location_titles);
4207
+		}
4208
+	}
4237 4209
 
4238 4210
 
4239
-    if(strpos($title,'%%search_term%%') !== false){
4240
-        $search_term = '';
4241
-        if(isset($_REQUEST['s'])){
4242
-            $search_term = esc_attr($_REQUEST['s']);
4243
-        }
4244
-        $title = str_replace("%%search_term%%",$search_term,$title);
4245
-    }
4211
+	if(strpos($title,'%%location%%') !== false){
4212
+		$location = '';
4213
+		if($location_titles) {
4214
+			$location = implode(", ", $location_titles);
4215
+		}
4216
+		$title = str_replace("%%location%%",$location,$title);
4217
+	}
4246 4218
 
4247
-    if(strpos($title,'%%search_near%%') !== false){
4248
-        $search_term = '';
4249
-        if(isset($_REQUEST['snear'])){
4250
-            $search_term = esc_attr($_REQUEST['snear']);
4251
-        }
4252
-        $title = str_replace("%%search_near%%",$search_term,$title);
4253
-    }
4254
-
4255
-    if(strpos($title,'%%name%%') !== false){
4256
-        $author_name = '';
4257
-        if($author_name = get_the_author()){}
4258
-        else{
4259
-            $queried_object = get_queried_object();
4260
-            if(isset($queried_object->data->user_nicename)){
4261
-                $author_name = $queried_object->data->user_nicename;
4262
-            }
4263
-        }
4264
-        $title = str_replace("%%name%%",$author_name,$title);
4265
-    }
4266
-
4267
-    $title = wptexturize( $title );
4268
-    $title = convert_chars( $title );
4269
-    $title = esc_html( $title );
4270
-
4271
-    /**
4272
-     * Filter the title variables after standard ones have been filtered.
4273
-     *
4274
-     * @since 1.5.7
4275
-     * @package GeoDirectory
4276
-     * @param string $title The title with variables.
4277
-     * @param array $location_array The array of location variables.
4278
-     * @param string $gd_page The page being filtered.
4279
-     * @param string $sep The separator, default: `|`.
4280
-     */
4219
+	if(strpos($title,'%%in_location%%') !== false){
4220
+		$location = '';
4221
+		if($location_titles) {
4222
+			$location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4223
+		}
4224
+		$title = str_replace("%%in_location%%",$location,$title);
4225
+	}
4226
+
4227
+	if(strpos($title,'%%in_location_single%%') !== false){
4228
+		if($location_single) {
4229
+			$location_single = __('in', 'geodirectory') . ' ' .$location_single;
4230
+		}
4231
+		$title = str_replace("%%in_location_single%%",$location_single,$title);
4232
+	}
4233
+
4234
+	if(strpos($title,'%%location_single%%') !== false){
4235
+		$title = str_replace("%%location_single%%",$location_single,$title);
4236
+	}
4237
+
4238
+
4239
+	if(strpos($title,'%%search_term%%') !== false){
4240
+		$search_term = '';
4241
+		if(isset($_REQUEST['s'])){
4242
+			$search_term = esc_attr($_REQUEST['s']);
4243
+		}
4244
+		$title = str_replace("%%search_term%%",$search_term,$title);
4245
+	}
4281 4246
 
4282
-    return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4247
+	if(strpos($title,'%%search_near%%') !== false){
4248
+		$search_term = '';
4249
+		if(isset($_REQUEST['snear'])){
4250
+			$search_term = esc_attr($_REQUEST['snear']);
4251
+		}
4252
+		$title = str_replace("%%search_near%%",$search_term,$title);
4253
+	}
4254
+
4255
+	if(strpos($title,'%%name%%') !== false){
4256
+		$author_name = '';
4257
+		if($author_name = get_the_author()){}
4258
+		else{
4259
+			$queried_object = get_queried_object();
4260
+			if(isset($queried_object->data->user_nicename)){
4261
+				$author_name = $queried_object->data->user_nicename;
4262
+			}
4263
+		}
4264
+		$title = str_replace("%%name%%",$author_name,$title);
4265
+	}
4266
+
4267
+	$title = wptexturize( $title );
4268
+	$title = convert_chars( $title );
4269
+	$title = esc_html( $title );
4270
+
4271
+	/**
4272
+	 * Filter the title variables after standard ones have been filtered.
4273
+	 *
4274
+	 * @since 1.5.7
4275
+	 * @package GeoDirectory
4276
+	 * @param string $title The title with variables.
4277
+	 * @param array $location_array The array of location variables.
4278
+	 * @param string $gd_page The page being filtered.
4279
+	 * @param string $sep The separator, default: `|`.
4280
+	 */
4281
+
4282
+	return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4283 4283
 }
4284 4284
 
4285 4285
 /**
@@ -4292,65 +4292,65 @@  discard block
 block discarded – undo
4292 4292
  * @return array Translation texts.
4293 4293
  */
4294 4294
 function geodir_load_cpt_text_translation($translation_texts = array()) {
4295
-    $gd_post_types = geodir_get_posttypes('array');
4296
-
4297
-    if (!empty($gd_post_types)) {
4298
-        foreach ($gd_post_types as $post_type => $cpt_info) {
4299
-            $labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4300
-            $description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4301
-            $seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4302
-
4303
-            if (!empty($labels)) {
4304
-                if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts))
4305
-                    $translation_texts[] = $labels['name'];
4306
-                if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts))
4307
-                    $translation_texts[] = $labels['singular_name'];
4308
-                if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts))
4309
-                    $translation_texts[] = $labels['add_new'];
4310
-                if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts))
4311
-                    $translation_texts[] = $labels['add_new_item'];
4312
-                if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts))
4313
-                    $translation_texts[] = $labels['edit_item'];
4314
-                if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts))
4315
-                    $translation_texts[] = $labels['new_item'];
4316
-                if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts))
4317
-                    $translation_texts[] = $labels['view_item'];
4318
-                if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts))
4319
-                    $translation_texts[] = $labels['search_items'];
4320
-                if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts))
4321
-                    $translation_texts[] = $labels['not_found'];
4322
-                if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts))
4323
-                    $translation_texts[] = $labels['not_found_in_trash'];
4324
-                if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts))
4325
-                    $translation_texts[] = $labels['label_post_profile'];
4326
-                if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts))
4327
-                    $translation_texts[] = $labels['label_post_info'];
4328
-                if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts))
4329
-                    $translation_texts[] = $labels['label_post_images'];
4330
-                if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts))
4331
-                    $translation_texts[] = $labels['label_post_map'];
4332
-                if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts))
4333
-                    $translation_texts[] = $labels['label_reviews'];
4334
-                if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts))
4335
-                    $translation_texts[] = $labels['label_related_listing'];
4336
-            }
4337
-
4338
-            if ($description != '' && !in_array($description, $translation_texts)) {
4339
-                $translation_texts[] = normalize_whitespace($description);
4340
-            }
4341
-
4342
-            if (!empty($seo)) {
4343
-                if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts))
4344
-                    $translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4345
-
4346
-                if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts))
4347
-                    $translation_texts[] = normalize_whitespace($seo['meta_description']);
4348
-            }
4349
-        }
4350
-    }
4351
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4295
+	$gd_post_types = geodir_get_posttypes('array');
4296
+
4297
+	if (!empty($gd_post_types)) {
4298
+		foreach ($gd_post_types as $post_type => $cpt_info) {
4299
+			$labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4300
+			$description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4301
+			$seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4302
+
4303
+			if (!empty($labels)) {
4304
+				if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts))
4305
+					$translation_texts[] = $labels['name'];
4306
+				if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts))
4307
+					$translation_texts[] = $labels['singular_name'];
4308
+				if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts))
4309
+					$translation_texts[] = $labels['add_new'];
4310
+				if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts))
4311
+					$translation_texts[] = $labels['add_new_item'];
4312
+				if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts))
4313
+					$translation_texts[] = $labels['edit_item'];
4314
+				if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts))
4315
+					$translation_texts[] = $labels['new_item'];
4316
+				if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts))
4317
+					$translation_texts[] = $labels['view_item'];
4318
+				if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts))
4319
+					$translation_texts[] = $labels['search_items'];
4320
+				if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts))
4321
+					$translation_texts[] = $labels['not_found'];
4322
+				if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts))
4323
+					$translation_texts[] = $labels['not_found_in_trash'];
4324
+				if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts))
4325
+					$translation_texts[] = $labels['label_post_profile'];
4326
+				if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts))
4327
+					$translation_texts[] = $labels['label_post_info'];
4328
+				if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts))
4329
+					$translation_texts[] = $labels['label_post_images'];
4330
+				if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts))
4331
+					$translation_texts[] = $labels['label_post_map'];
4332
+				if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts))
4333
+					$translation_texts[] = $labels['label_reviews'];
4334
+				if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts))
4335
+					$translation_texts[] = $labels['label_related_listing'];
4336
+			}
4337
+
4338
+			if ($description != '' && !in_array($description, $translation_texts)) {
4339
+				$translation_texts[] = normalize_whitespace($description);
4340
+			}
4341
+
4342
+			if (!empty($seo)) {
4343
+				if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts))
4344
+					$translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4345
+
4346
+				if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts))
4347
+					$translation_texts[] = normalize_whitespace($seo['meta_description']);
4348
+			}
4349
+		}
4350
+	}
4351
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4352 4352
 
4353
-    return $translation_texts;
4353
+	return $translation_texts;
4354 4354
 }
4355 4355
 
4356 4356
 /**
@@ -4363,27 +4363,27 @@  discard block
 block discarded – undo
4363 4363
  * @return array Location terms.
4364 4364
  */
4365 4365
 function geodir_remove_location_terms($location_terms = array()) {
4366
-    $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4367
-
4368
-    if (!empty($location_terms) && $location_manager) {
4369
-        $hide_country_part = get_option('geodir_location_hide_country_part');
4370
-        $hide_region_part = get_option('geodir_location_hide_region_part');
4371
-
4372
-        if ($hide_region_part && $hide_country_part) {
4373
-            if (isset($location_terms['gd_country']))
4374
-                unset($location_terms['gd_country']);
4375
-            if (isset($location_terms['gd_region']))
4376
-                unset($location_terms['gd_region']);
4377
-        } else if ($hide_region_part && !$hide_country_part) {
4378
-            if (isset($location_terms['gd_region']))
4379
-                unset($location_terms['gd_region']);
4380
-        } else if (!$hide_region_part && $hide_country_part) {
4381
-            if (isset($location_terms['gd_country']))
4382
-                unset($location_terms['gd_country']);
4383
-        }
4384
-    }
4366
+	$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4367
+
4368
+	if (!empty($location_terms) && $location_manager) {
4369
+		$hide_country_part = get_option('geodir_location_hide_country_part');
4370
+		$hide_region_part = get_option('geodir_location_hide_region_part');
4371
+
4372
+		if ($hide_region_part && $hide_country_part) {
4373
+			if (isset($location_terms['gd_country']))
4374
+				unset($location_terms['gd_country']);
4375
+			if (isset($location_terms['gd_region']))
4376
+				unset($location_terms['gd_region']);
4377
+		} else if ($hide_region_part && !$hide_country_part) {
4378
+			if (isset($location_terms['gd_region']))
4379
+				unset($location_terms['gd_region']);
4380
+		} else if (!$hide_region_part && $hide_country_part) {
4381
+			if (isset($location_terms['gd_country']))
4382
+				unset($location_terms['gd_country']);
4383
+		}
4384
+	}
4385 4385
 
4386
-    return $location_terms;
4386
+	return $location_terms;
4387 4387
 }
4388 4388
 
4389 4389
 /**
@@ -4397,30 +4397,30 @@  discard block
 block discarded – undo
4397 4397
  * @param bool $update Whether this is an existing listing being updated or not.
4398 4398
  */
4399 4399
 function geodir_on_wp_insert_post($post_ID, $post, $update) {
4400
-    if (!$update) {
4401
-        return;
4402
-    }
4400
+	if (!$update) {
4401
+		return;
4402
+	}
4403 4403
     
4404
-    $is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) )  ? true : false;
4405
-    $inline_save = isset($_POST['action']) && $_POST['action'] == 'inline-save' ? true : false;
4404
+	$is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) )  ? true : false;
4405
+	$inline_save = isset($_POST['action']) && $_POST['action'] == 'inline-save' ? true : false;
4406 4406
 
4407
-    if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
4408
-        return;
4409
-    }
4407
+	if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
4408
+		return;
4409
+	}
4410 4410
 
4411
-    $user_id = (int)get_current_user_id();
4411
+	$user_id = (int)get_current_user_id();
4412 4412
         
4413
-    if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4414
-        $author_id = !empty($post->post_author) ? $post->post_author : 0;
4413
+	if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4414
+		$author_id = !empty($post->post_author) ? $post->post_author : 0;
4415 4415
         
4416
-        if ($user_id == $author_id) {
4417
-            $from_email = get_option('site_email');
4418
-            $from_name = get_site_emailName();
4419
-            $to_email = get_option('admin_email');
4420
-            $to_name = get_option('name');
4421
-            $message_type = 'listing_edited';
4416
+		if ($user_id == $author_id) {
4417
+			$from_email = get_option('site_email');
4418
+			$from_name = get_site_emailName();
4419
+			$to_email = get_option('admin_email');
4420
+			$to_name = get_option('name');
4421
+			$message_type = 'listing_edited';
4422 4422
             
4423
-            geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
4424
-        }
4425
-    }
4423
+			geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
4424
+		}
4425
+	}
4426 4426
 }
4427 4427
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +233 added lines, -233 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function geodir_plugin_path()
49 49
 {
50
-    if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
50
+    if (defined('GD_TESTING_MODE') && GD_TESTING_MODE) {
51 51
         return dirname(dirname(__FILE__));
52 52
     } else {
53 53
         return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__)));
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
         $add_listing_link = get_page_link(geodir_add_listing_page_id());
162 162
 
163
-        return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
163
+        return esc_url(add_query_arg(array('listing_type' => $post_type), $add_listing_link));
164 164
     } else
165 165
         return get_bloginfo('url');
166 166
 }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 function geodir_is_page($gdpage = '')
253 253
 {
254 254
 
255
-    global $wp_query, $post,$wp;
255
+    global $wp_query, $post, $wp;
256 256
     //if(!is_admin()):
257 257
 
258 258
     switch ($gdpage):
@@ -277,14 +277,14 @@  discard block
 block discarded – undo
277 277
             break;
278 278
         case 'detail':
279 279
             $post_type = get_query_var('post_type');
280
-            if(is_array($post_type)){$post_type = reset($post_type);}
280
+            if (is_array($post_type)) {$post_type = reset($post_type); }
281 281
             if (is_single() && in_array($post_type, geodir_get_posttypes()))
282 282
                 return true;
283 283
             break;
284 284
         case 'pt':
285 285
             $post_type = get_query_var('post_type');
286
-            if(is_array($post_type)){$post_type = reset($post_type);}
287
-            if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax())
286
+            if (is_array($post_type)) {$post_type = reset($post_type); }
287
+            if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()) && !is_tax())
288 288
                 return true;
289 289
 
290 290
             break;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
                 return true;
296 296
             }
297 297
             $post_type = get_query_var('post_type');
298
-            if(is_array($post_type)){$post_type = reset($post_type);}
298
+            if (is_array($post_type)) {$post_type = reset($post_type); }
299 299
             if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()))
300 300
                 return true;
301 301
 
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
             if (is_author() && isset($_REQUEST['geodir_dashbord']))
315 315
                 return true;
316 316
 			
317
-			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) {
318
-				if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) {
317
+			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) {
318
+				if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) {
319 319
 					return true;
320 320
 				}
321 321
 			}
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
         if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
369 369
             if (get_option('geodir_set_as_home'))
370 370
                 $wp->query_vars['gd_is_geodir_page'] = true;
371
-            if(geodir_is_page('home')){
371
+            if (geodir_is_page('home')) {
372 372
                 $wp->query_vars['gd_is_geodir_page'] = true;
373 373
             }
374 374
 
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 
421 421
         if (!isset($wp->query_vars['gd_is_geodir_page'])) {
422 422
             $geodir_taxonomis = geodir_get_taxonomies('', true);
423
-            if(!empty($geodir_taxonomis)){
423
+            if (!empty($geodir_taxonomis)) {
424 424
                 foreach ($geodir_taxonomis as $taxonomy) {
425 425
                     if (array_key_exists($taxonomy, $wp->query_vars)) {
426 426
                         $wp->query_vars['gd_is_geodir_page'] = true;
@@ -440,10 +440,10 @@  discard block
 block discarded – undo
440 440
 
441 441
 
442 442
 //check if homepage
443
-        if(!isset($wp->query_vars['gd_is_geodir_page'])
443
+        if (!isset($wp->query_vars['gd_is_geodir_page'])
444 444
             && !isset($wp->query_vars['page_id'])
445 445
             && !isset($wp->query_vars['pagename'])
446
-            && is_page_geodir_home()){
446
+            && is_page_geodir_home()) {
447 447
             $wp->query_vars['gd_is_geodir_page'] = true;
448 448
         }
449 449
         //echo $wp->query_vars['gd_is_geodir_page'] ;
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
     function createRandomString()
545 545
     {
546 546
         $chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
547
-        srand((double)microtime() * 1000000);
547
+        srand((double) microtime() * 1000000);
548 548
         $i = 0;
549 549
         $rstring = '';
550 550
         while ($i <= 25) {
@@ -681,11 +681,11 @@  discard block
 block discarded – undo
681 681
         }
682 682
 		
683 683
 		if (!empty($subject)) {
684
-			$subject = __(stripslashes_deep($subject),'geodirectory');
684
+			$subject = __(stripslashes_deep($subject), 'geodirectory');
685 685
 		}
686 686
 		
687 687
 		if (!empty($message)) {
688
-			$message = __(stripslashes_deep($message),'geodirectory');
688
+			$message = __(stripslashes_deep($message), 'geodirectory');
689 689
 		}
690 690
 
691 691
         $to_message = nl2br($to_message);
@@ -724,12 +724,12 @@  discard block
 block discarded – undo
724 724
             $fromEmailName = get_option('site_email_name');
725 725
         }
726 726
 
727
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
728
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
727
+        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]', '[#from_email#]', '[#user_login#]', '[#username#]', '[#post_author_id#]', '[#post_author_name#]', '[#current_date#]');
728
+        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
729 729
         $message = str_replace($search_array, $replace_array, $message);
730 730
 
731
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
732
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
731
+        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]', '[#from_email#]', '[#user_login#]', '[#username#]', '[#post_author_id#]', '[#post_author_name#]', '[#current_date#]');
732
+        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
733 733
         $subject = str_replace($search_array, $replace_array, $subject);
734 734
 
735 735
         $headers = 'MIME-Version: 1.0' . "\r\n";
@@ -740,18 +740,18 @@  discard block
 block discarded – undo
740 740
         $to = $toEmail;
741 741
         $sent = wp_mail($to, $subject, $message, $headers);
742 742
 
743
-        if( ! $sent ) {
744
-            if ( is_array( $to ) ) {
745
-                $to = implode( ',', $to );
743
+        if (!$sent) {
744
+            if (is_array($to)) {
745
+                $to = implode(',', $to);
746 746
             }
747 747
             $log_message = sprintf(
748
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
748
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
749 749
                 $message_type,
750
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
750
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
751 751
                 $to,
752 752
                 $subject
753 753
             );
754
-            geodir_error_log( $log_message );
754
+            geodir_error_log($log_message);
755 755
         }
756 756
 
757 757
         ///////// ADMIN BCC EMIALS
@@ -763,11 +763,11 @@  discard block
 block discarded – undo
763 763
             $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
764 764
             $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
765 765
 
766
-            $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#]');
766
+            $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#]');
767 767
             $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);
768 768
             $message = str_replace($search_array, $replace_array, $message);
769 769
 
770
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
770
+            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]', '[#user_login#]', '[#username#]');
771 771
             $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
772 772
             $subject = str_replace($search_array, $replace_array, $subject);
773 773
 
@@ -792,21 +792,21 @@  discard block
 block discarded – undo
792 792
             $admin_bcc = true;
793 793
         }
794 794
 
795
-        if($admin_bcc===true){
795
+        if ($admin_bcc === true) {
796 796
             $sent = wp_mail($to, $subject, $message, $headers);
797 797
 
798
-            if( ! $sent ) {
799
-                if ( is_array( $to ) ) {
800
-                    $to = implode( ',', $to );
798
+            if (!$sent) {
799
+                if (is_array($to)) {
800
+                    $to = implode(',', $to);
801 801
                 }
802 802
                 $log_message = sprintf(
803
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
803
+                    __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
804 804
                     $message_type,
805
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
805
+                    date_i18n('F j Y H:i:s', current_time('timestamp')),
806 806
                     $to,
807 807
                     $subject
808 808
                 );
809
-                geodir_error_log( $log_message );
809
+                geodir_error_log($log_message);
810 810
             }
811 811
         }
812 812
 
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
             $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
902 902
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
903 903
 				
904
-			if(geodir_is_page('detail') && isset($post->country_slug)){
904
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
905 905
                 $location_terms = array(
906 906
                     'gd_country' => $post->country_slug,
907 907
                     'gd_region' => $post->region_slug,
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
             $breadcrumb .= stripslashes_deep($page_title);
1157 1157
             $breadcrumb .= '</li>';
1158 1158
         } else if (is_tag()) {
1159
-            $breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1159
+            $breadcrumb .= "<li> " . $separator . single_tag_title('', false) . '</li>';
1160 1160
         } else if (is_day()) {
1161 1161
             $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1162 1162
             the_time('F jS, Y');
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
         return new WP_Error('upload_dir_error', $upload['error']);
1249 1249
 
1250 1250
     // fetch the remote url and write it to the placeholder file
1251
-    $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1251
+    $headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
1252 1252
 
1253 1253
     $log_message = '';
1254 1254
     $filesize = filesize($upload['file']);
@@ -1261,16 +1261,16 @@  discard block
 block discarded – undo
1261 1261
         $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1262 1262
     }
1263 1263
     elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1264
-        $log_message =  __('Remote file is incorrect size', 'geodirectory');
1264
+        $log_message = __('Remote file is incorrect size', 'geodirectory');
1265 1265
     }
1266 1266
     elseif (0 == $filesize) {
1267 1267
         $log_message = __('Zero size file downloaded', 'geodirectory');
1268 1268
     }
1269 1269
 
1270
-    if($log_message){
1270
+    if ($log_message) {
1271 1271
         $del = unlink($upload['file']);
1272
-        if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1273
-        return new WP_Error('import_file_error',$log_message );
1272
+        if (!$del) {geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory')); }
1273
+        return new WP_Error('import_file_error', $log_message);
1274 1274
     }
1275 1275
 
1276 1276
 
@@ -1286,10 +1286,10 @@  discard block
 block discarded – undo
1286 1286
  */
1287 1287
 function geodir_max_upload_size()
1288 1288
 {
1289
-    $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1289
+    $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1290 1290
 
1291 1291
     if ($max_filesize > 0 && $max_filesize < 1) {
1292
-        $max_filesize = (int)($max_filesize * 1024) . 'kb';
1292
+        $max_filesize = (int) ($max_filesize * 1024) . 'kb';
1293 1293
     } else {
1294 1294
         $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1295 1295
     }
@@ -1358,35 +1358,35 @@  discard block
 block discarded – undo
1358 1358
     {
1359 1359
         global $wpdb;
1360 1360
         if ($message_type == 'expiration') {
1361
-            $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1362
-            $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1361
+            $subject = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
1362
+            $client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
1363 1363
         } elseif ($message_type == 'post_submited') {
1364
-            $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1365
-            $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1364
+            $subject = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
1365
+            $client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
1366 1366
         } elseif ($message_type == 'renew') {
1367
-            $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1368
-            $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1367
+            $subject = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
1368
+            $client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
1369 1369
         } elseif ($message_type == 'upgrade') {
1370
-            $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1371
-            $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1370
+            $subject = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
1371
+            $client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
1372 1372
         } elseif ($message_type == 'claim_approved') {
1373
-            $subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1374
-            $client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1373
+            $subject = __(get_option('claim_approved_email_subject'), 'geodirectory');
1374
+            $client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
1375 1375
         } elseif ($message_type == 'claim_rejected') {
1376
-            $subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1377
-            $client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1376
+            $subject = __(get_option('claim_rejected_email_subject'), 'geodirectory');
1377
+            $client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
1378 1378
         } elseif ($message_type == 'claim_requested') {
1379
-            $subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1380
-            $client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1379
+            $subject = __(get_option('claim_email_subject_admin'), 'geodirectory');
1380
+            $client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
1381 1381
         } elseif ($message_type == 'auto_claim') {
1382
-            $subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1383
-            $client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1382
+            $subject = __(get_option('auto_claim_email_subject'), 'geodirectory');
1383
+            $client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
1384 1384
         } elseif ($message_type == 'payment_success') {
1385
-            $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1386
-            $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1385
+            $subject = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
1386
+            $client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
1387 1387
         } elseif ($message_type == 'payment_fail') {
1388
-            $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1389
-            $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1388
+            $subject = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
1389
+            $client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
1390 1390
         }
1391 1391
         $transaction_details = $custom_1;
1392 1392
         $fromEmail = get_option('site_email');
@@ -1427,18 +1427,18 @@  discard block
 block discarded – undo
1427 1427
         $to = $fromEmail;
1428 1428
         $message = $client_message;
1429 1429
         $sent = wp_mail($to, $subject, $message, $headers);
1430
-        if( ! $sent ) {
1431
-            if ( is_array( $to ) ) {
1432
-                $to = implode( ',', $to );
1430
+        if (!$sent) {
1431
+            if (is_array($to)) {
1432
+                $to = implode(',', $to);
1433 1433
             }
1434 1434
             $log_message = sprintf(
1435
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1435
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1436 1436
                 $message_type,
1437
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1437
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
1438 1438
                 $to,
1439 1439
                 $subject
1440 1440
             );
1441
-            geodir_error_log( $log_message );
1441
+            geodir_error_log($log_message);
1442 1442
         }
1443 1443
     }
1444 1444
 }
@@ -1464,18 +1464,18 @@  discard block
 block discarded – undo
1464 1464
     {
1465 1465
         $login_details = '';
1466 1466
         if ($message_type == 'send_friend') {
1467
-            $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1468
-            $message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1467
+            $subject = stripslashes(__(get_option('email_friend_subject'), 'geodirectory'));
1468
+            $message = stripslashes(__(get_option('email_friend_content'), 'geodirectory'));
1469 1469
         } elseif ($message_type == 'send_enquiry') {
1470
-            $subject = __(get_option('email_enquiry_subject'),'geodirectory');
1471
-            $message = __(get_option('email_enquiry_content'),'geodirectory');
1470
+            $subject = __(get_option('email_enquiry_subject'), 'geodirectory');
1471
+            $message = __(get_option('email_enquiry_content'), 'geodirectory');
1472 1472
         } elseif ($message_type == 'forgot_password') {
1473
-            $subject = __(get_option('forgot_password_subject'),'geodirectory');
1474
-            $message = __(get_option('forgot_password_content'),'geodirectory');
1473
+            $subject = __(get_option('forgot_password_subject'), 'geodirectory');
1474
+            $message = __(get_option('forgot_password_content'), 'geodirectory');
1475 1475
             $login_details = $to_message;
1476 1476
         } elseif ($message_type == 'registration') {
1477
-            $subject = __(get_option('registration_success_email_subject'),'geodirectory');
1478
-            $message = __(get_option('registration_success_email_content'),'geodirectory');
1477
+            $subject = __(get_option('registration_success_email_subject'), 'geodirectory');
1478
+            $message = __(get_option('registration_success_email_content'), 'geodirectory');
1479 1479
             $login_details = $to_message;
1480 1480
         }
1481 1481
         $to_message = nl2br($to_message);
@@ -1509,18 +1509,18 @@  discard block
 block discarded – undo
1509 1509
         $to = $toEmail;
1510 1510
 
1511 1511
         $sent = wp_mail($to, $subject, $message, $headers);
1512
-        if( ! $sent ) {
1513
-            if ( is_array( $to ) ) {
1514
-                $to = implode( ',', $to );
1512
+        if (!$sent) {
1513
+            if (is_array($to)) {
1514
+                $to = implode(',', $to);
1515 1515
             }
1516 1516
             $log_message = sprintf(
1517
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1517
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1518 1518
                 $message_type,
1519
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1519
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
1520 1520
                 $to,
1521 1521
                 $subject
1522 1522
             );
1523
-            geodir_error_log( $log_message );
1523
+            geodir_error_log($log_message);
1524 1524
         }
1525 1525
 
1526 1526
         ///////// ADMIN BCC EMIALS
@@ -1546,20 +1546,20 @@  discard block
 block discarded – undo
1546 1546
             $admin_bcc = true;
1547 1547
         }
1548 1548
 
1549
-        if($admin_bcc === true){
1549
+        if ($admin_bcc === true) {
1550 1550
             $sent = wp_mail($to, $subject, $message, $headers);
1551
-            if( ! $sent ) {
1552
-                if ( is_array( $to ) ) {
1553
-                    $to = implode( ',', $to );
1551
+            if (!$sent) {
1552
+                if (is_array($to)) {
1553
+                    $to = implode(',', $to);
1554 1554
                 }
1555 1555
                 $log_message = sprintf(
1556
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1556
+                    __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1557 1557
                     $message_type,
1558
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1558
+                    date_i18n('F j Y H:i:s', current_time('timestamp')),
1559 1559
                     $to,
1560 1560
                     $subject
1561 1561
                 );
1562
-                geodir_error_log( $log_message );
1562
+                geodir_error_log($log_message);
1563 1563
             }
1564 1564
         }
1565 1565
 
@@ -1607,7 +1607,7 @@  discard block
 block discarded – undo
1607 1607
 function geodir_custom_posts_body_class($classes) {
1608 1608
     global $wpdb, $wp;
1609 1609
     $post_types = geodir_get_posttypes('object');
1610
-    if (!empty($post_types) && count((array)$post_types) > 1) {
1610
+    if (!empty($post_types) && count((array) $post_types) > 1) {
1611 1611
         $classes[] = 'geodir_custom_posts';
1612 1612
     }
1613 1613
 
@@ -1901,7 +1901,7 @@  discard block
 block discarded – undo
1901 1901
         $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
1902 1902
 			" . $join . "
1903 1903
 			" . $where;
1904
-        $rows = (int)$wpdb->get_var($sql);
1904
+        $rows = (int) $wpdb->get_var($sql);
1905 1905
     } else {
1906 1906
         $orderby = geodir_widget_listings_get_order($query_args);
1907 1907
         /**
@@ -1927,10 +1927,10 @@  discard block
 block discarded – undo
1927 1927
         $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
1928 1928
 
1929 1929
         $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
1930
-        if ( !$page )
1930
+        if (!$page)
1931 1931
             $page = 1;
1932 1932
 
1933
-        $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
1933
+        $limit = (int) $limit > 0 ? " LIMIT " . absint(($page - 1) * (int) $limit) . ", " . (int) $limit : "";
1934 1934
 
1935 1935
         $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
1936 1936
 			" . $join . "
@@ -2045,7 +2045,7 @@  discard block
 block discarded – undo
2045 2045
         }
2046 2046
 
2047 2047
         if (!empty($query_args['post_author'])) {
2048
-            $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2048
+            $where .= " AND " . $wpdb->posts . ".post_author = " . (int) $query_args['post_author'];
2049 2049
         }
2050 2050
         
2051 2051
         if (!empty($query_args['show_featured_only'])) {
@@ -2131,7 +2131,7 @@  discard block
 block discarded – undo
2131 2131
     }
2132 2132
 
2133 2133
     if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2134
-        $limit = (int)$query_args['posts_per_page'];
2134
+        $limit = (int) $query_args['posts_per_page'];
2135 2135
     }
2136 2136
 
2137 2137
     return $limit;
@@ -2274,9 +2274,9 @@  discard block
 block discarded – undo
2274 2274
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2275 2275
     }
2276 2276
     $home_url = str_replace("www.", "", $home_url);
2277
-    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')) ) {
2277
+    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'))) {
2278 2278
         return true;
2279
-    }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')){
2279
+    }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')) {
2280 2280
         return true;
2281 2281
     } else {
2282 2282
         return false;
@@ -2359,7 +2359,7 @@  discard block
 block discarded – undo
2359 2359
 
2360 2360
     $gd_post_type = geodir_get_current_posttype();
2361 2361
 
2362
-    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2362
+    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2363 2363
     $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'] : '');
2364 2364
 
2365 2365
     $taxonomy = array();
@@ -2392,14 +2392,14 @@  discard block
 block discarded – undo
2392 2392
             foreach ($b_terms as $key => $val) {
2393 2393
                 $ptype = get_post_type_object(str_replace("category", "", $key));
2394 2394
                 $cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2395
-                $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2395
+                $tax_change_output .= "<option value='$key' " . selected($key, $default_taxonomy, false) . ">" . sprintf(__('%s Categories', 'geodirectory'), $cpt_name) . "</option>";
2396 2396
             }
2397 2397
             $tax_change_output .= "</select>";
2398 2398
         }
2399 2399
 
2400 2400
         if (!empty($b_terms)) {
2401
-            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2402
-            global $cat_count;//make global so we can change via function
2401
+            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array
2402
+            global $cat_count; //make global so we can change via function
2403 2403
             $cat_count = 0;
2404 2404
             ?>
2405 2405
             <div class="geodir-category-list-in clearfix">
@@ -2463,7 +2463,7 @@  discard block
 block discarded – undo
2463 2463
         $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2464 2464
         $total_post = $cat->count;
2465 2465
 
2466
-        $term_link = get_term_link( $cat, $cat->taxonomy );
2466
+        $term_link = get_term_link($cat, $cat->taxonomy);
2467 2467
         /**
2468 2468
          * Filer the category term link.
2469 2469
          *
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
          * @param int    $cat->term_id The term id.
2473 2473
          * @param string $post_type Wordpress post type.
2474 2474
          */
2475
-        $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2475
+        $term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
2476 2476
 
2477 2477
         echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2478 2478
         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> ';
@@ -2606,29 +2606,29 @@  discard block
 block discarded – undo
2606 2606
                 itemWidth: 75,
2607 2607
                 itemMargin: 5,
2608 2608
                 asNavFor: '#geodir_widget_slider',
2609
-                rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
2609
+                rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
2610 2610
             });
2611 2611
 
2612 2612
             jQuery('#geodir_widget_slider').flexslider({
2613
-                animation: "<?php echo $animation;?>",
2613
+                animation: "<?php echo $animation; ?>",
2614 2614
                 selector: ".geodir-slides > li",
2615 2615
                 namespace: "geodir-",
2616 2616
                 controlNav: true,
2617
-                animationLoop: <?php echo $animationLoop;?>,
2618
-                slideshow: <?php echo $slideshow;?>,
2619
-                slideshowSpeed: <?php echo $slideshowSpeed;?>,
2620
-                animationSpeed: <?php echo $animationSpeed;?>,
2621
-                directionNav: <?php echo $directionNav;?>,
2622
-                maxItems: <?php echo $max_show;?>,
2617
+                animationLoop: <?php echo $animationLoop; ?>,
2618
+                slideshow: <?php echo $slideshow; ?>,
2619
+                slideshowSpeed: <?php echo $slideshowSpeed; ?>,
2620
+                animationSpeed: <?php echo $animationSpeed; ?>,
2621
+                directionNav: <?php echo $directionNav; ?>,
2622
+                maxItems: <?php echo $max_show; ?>,
2623 2623
                 move: 1,
2624
-                <?php if($slide_width){ echo "itemWidth: ".$slide_width.",";}?>
2624
+                <?php if ($slide_width) { echo "itemWidth: " . $slide_width . ","; }?>
2625 2625
                 sync: "#geodir_widget_carousel",
2626 2626
                 start: function (slider) {
2627 2627
                     jQuery('.geodir-listing-flex-loader').hide();
2628 2628
                     jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
2629 2629
                     jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
2630 2630
                 },
2631
-                rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
2631
+                rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
2632 2632
             });
2633 2633
         });
2634 2634
     </script>
@@ -2669,7 +2669,7 @@  discard block
 block discarded – undo
2669 2669
 
2670 2670
         global $post;
2671 2671
 
2672
-        $current_post = $post;// keep current post info
2672
+        $current_post = $post; // keep current post info
2673 2673
 
2674 2674
         $widget_main_slides = '';
2675 2675
         $nav_slides = '';
@@ -3112,7 +3112,7 @@  discard block
 block discarded – undo
3112 3112
             $geodir_add_location_url = '1';
3113 3113
         }
3114 3114
 
3115
-        $viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3115
+        $viewall_url = get_term_link((int) $category[0], $post_type . 'category');
3116 3116
 
3117 3117
         $geodir_add_location_url = NULL;
3118 3118
     }
@@ -3120,7 +3120,7 @@  discard block
 block discarded – undo
3120 3120
         $gd_session->set('gd_multi_location', 1);
3121 3121
     }
3122 3122
 
3123
-    if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3123
+    if (is_wp_error($viewall_url)) {$viewall_url = ''; }
3124 3124
 
3125 3125
     $query_args = array(
3126 3126
         'posts_per_page' => $post_number,
@@ -3358,14 +3358,14 @@  discard block
 block discarded – undo
3358 3358
  * @package GeoDirectory
3359 3359
  * @return bool
3360 3360
  */
3361
-function geodir_term_review_count_force_update($new_status, $old_status='', $post='')
3361
+function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '')
3362 3362
 {
3363
-    if(isset($_REQUEST['action']) && $_REQUEST['action']=='geodir_import_export'){return;}//do not run if importing listings
3363
+    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {return; }//do not run if importing listings
3364 3364
 
3365
-    if(isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')){
3365
+    if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
3366 3366
         return;
3367 3367
     }
3368
-    if($new_status!=$old_status) {
3368
+    if ($new_status != $old_status) {
3369 3369
         geodir_count_reviews_by_terms(true);
3370 3370
     }
3371 3371
     return true;
@@ -3530,7 +3530,7 @@  discard block
 block discarded – undo
3530 3530
          */
3531 3531
         try {
3532 3532
             require_once($language_file);
3533
-        } catch(Exception $e) {
3533
+        } catch (Exception $e) {
3534 3534
             error_log('Language Error: ' . $e->getMessage());
3535 3535
         }
3536 3536
     }
@@ -3548,18 +3548,18 @@  discard block
 block discarded – undo
3548 3548
  */
3549 3549
 function geodirectory_load_db_language() {
3550 3550
     global $wp_filesystem;
3551
-    if( empty( $wp_filesystem ) ) {
3552
-        require_once( ABSPATH .'/wp-admin/includes/file.php' );
3551
+    if (empty($wp_filesystem)) {
3552
+        require_once(ABSPATH . '/wp-admin/includes/file.php');
3553 3553
         WP_Filesystem();
3554 3554
         global $wp_filesystem;
3555 3555
     }
3556 3556
 
3557 3557
     $language_file = geodir_plugin_path() . '/db-language.php';
3558 3558
 
3559
-    if(is_file($language_file) && !is_writable($language_file))
3559
+    if (is_file($language_file) && !is_writable($language_file))
3560 3560
         return false; // Not possible to create.
3561 3561
 
3562
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3562
+    if (!is_file($language_file) && !is_writable(dirname($language_file)))
3563 3563
         return false; // Not possible to create.
3564 3564
 
3565 3565
     $contents_strings = array();
@@ -3593,7 +3593,7 @@  discard block
 block discarded – undo
3593 3593
     $contents = implode(PHP_EOL, $contents_head);
3594 3594
 
3595 3595
     if (!empty($contents_strings)) {
3596
-        foreach ( $contents_strings as $string ) {
3596
+        foreach ($contents_strings as $string) {
3597 3597
             if (is_scalar($string) && $string != '') {
3598 3598
                 $string = str_replace("'", "\'", $string);
3599 3599
                 $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
@@ -3603,7 +3603,7 @@  discard block
 block discarded – undo
3603 3603
 
3604 3604
     $contents .= implode(PHP_EOL, $contents_foot);
3605 3605
 
3606
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3606
+    if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE))
3607 3607
         return false; // Failure; could not write file.
3608 3608
 
3609 3609
     return true;
@@ -3629,7 +3629,7 @@  discard block
 block discarded – undo
3629 3629
     $rows = $wpdb->get_results($sql);
3630 3630
 
3631 3631
     if (!empty($rows)) {
3632
-        foreach($rows as $row) {
3632
+        foreach ($rows as $row) {
3633 3633
             if (!empty($row->admin_title))
3634 3634
                 $translation_texts[] = stripslashes_deep($row->admin_title);
3635 3635
 			
@@ -3667,7 +3667,7 @@  discard block
 block discarded – undo
3667 3667
     $rows = $wpdb->get_results($sql);
3668 3668
 
3669 3669
     if (!empty($rows)) {
3670
-        foreach($rows as $row) {
3670
+        foreach ($rows as $row) {
3671 3671
             if (!empty($row->site_title))
3672 3672
                 $translation_texts[] = stripslashes_deep($row->site_title);
3673 3673
 
@@ -3685,7 +3685,7 @@  discard block
 block discarded – undo
3685 3685
 		$rows = $wpdb->get_results($sql);
3686 3686
 
3687 3687
 		if (!empty($rows)) {
3688
-			foreach($rows as $row) {
3688
+			foreach ($rows as $row) {
3689 3689
 				if (!empty($row->field_site_name))
3690 3690
 					$translation_texts[] = stripslashes_deep($row->field_site_name);
3691 3691
 
@@ -3720,7 +3720,7 @@  discard block
 block discarded – undo
3720 3720
      *
3721 3721
      * @param array $geodir_allowed_mime_types and file extensions.
3722 3722
      */
3723
-    return apply_filters( 'geodir_allowed_mime_types', array(
3723
+    return apply_filters('geodir_allowed_mime_types', array(
3724 3724
             'Image' => array( // Image formats.
3725 3725
                 'jpg' => 'image/jpeg',
3726 3726
                 'jpe' => 'image/jpeg',
@@ -3809,13 +3809,13 @@  discard block
 block discarded – undo
3809 3809
 
3810 3810
 
3811 3811
 
3812
-add_filter('wpseo_replacements','geodir_wpseo_replacements',10,1);
3812
+add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
3813 3813
 /*
3814 3814
  * Add location variables to wpseo replacements.
3815 3815
  *
3816 3816
  * @since 1.5.4
3817 3817
  */
3818
-function geodir_wpseo_replacements($vars){
3818
+function geodir_wpseo_replacements($vars) {
3819 3819
 
3820 3820
     global $wp;
3821 3821
     $title = '';
@@ -3830,12 +3830,12 @@  discard block
 block discarded – undo
3830 3830
      * @param array $location_array The array of location variables.
3831 3831
      * @param array $vars The page title variables.
3832 3832
      */
3833
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
3833
+    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
3834 3834
     $location_titles = array();
3835
-    if(get_query_var( 'gd_country_full' )){
3836
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
3837
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
3838
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
3835
+    if (get_query_var('gd_country_full')) {
3836
+        if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
3837
+        if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
3838
+        if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
3839 3839
     }
3840 3840
     $location_single = '';
3841 3841
     $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
@@ -3907,23 +3907,23 @@  discard block
 block discarded – undo
3907 3907
     }
3908 3908
 
3909 3909
 
3910
-    if(!empty($location_titles)) {
3910
+    if (!empty($location_titles)) {
3911 3911
         $vars['%%location%%'] = implode(", ", $location_titles);
3912 3912
     }
3913 3913
 
3914 3914
 
3915
-    if(!empty($location_titles)) {
3915
+    if (!empty($location_titles)) {
3916 3916
         $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
3917 3917
     }
3918 3918
 
3919 3919
 
3920 3920
 
3921
-    if($location_single) {
3922
-        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
3921
+    if ($location_single) {
3922
+        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' . $location_single;
3923 3923
     }
3924 3924
 
3925 3925
 
3926
-    if($location_single) {
3926
+    if ($location_single) {
3927 3927
         $vars['%%location_single%%'] = $location_single;
3928 3928
     }
3929 3929
 
@@ -3935,17 +3935,17 @@  discard block
 block discarded – undo
3935 3935
      * @param string $vars The title with variables.
3936 3936
      * @param array $location_array The array of location variables.
3937 3937
      */
3938
-    return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
3938
+    return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
3939 3939
 }
3940 3940
 
3941 3941
 
3942
-add_filter('geodir_seo_meta_title','geodir_filter_title_variables',10,3);
3943
-add_filter('geodir_seo_page_title','geodir_filter_title_variables',10,2);
3944
-add_filter('geodir_seo_meta_description_pre','geodir_filter_title_variables',10,3);
3945
-function geodir_filter_title_variables($title, $gd_page, $sep=''){
3942
+add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
3943
+add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
3944
+add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
3945
+function geodir_filter_title_variables($title, $gd_page, $sep = '') {
3946 3946
 
3947 3947
 
3948
-    if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
3948
+    if (!$gd_page || !$title) {return $title; }// if no a GD page then bail.
3949 3949
     global $post;
3950 3950
     //print_r($post);
3951 3951
     /*
@@ -3987,119 +3987,119 @@  discard block
 block discarded – undo
3987 3987
     }
3988 3988
 
3989 3989
 
3990
-    if(strpos($title,'%%title%%') !== false){
3991
-        $title = str_replace("%%title%%",$post->post_title,$title);
3990
+    if (strpos($title, '%%title%%') !== false) {
3991
+        $title = str_replace("%%title%%", $post->post_title, $title);
3992 3992
     }
3993 3993
 
3994
-    if(strpos($title,'%%sitename%%') !== false){
3995
-        $title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
3994
+    if (strpos($title, '%%sitename%%') !== false) {
3995
+        $title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
3996 3996
     }
3997 3997
 
3998
-    if(strpos($title,'%%sitedesc%%') !== false){
3999
-        $title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
3998
+    if (strpos($title, '%%sitedesc%%') !== false) {
3999
+        $title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
4000 4000
     }
4001 4001
 
4002
-    if(strpos($title,'%%excerpt%%') !== false){
4003
-        $title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
4002
+    if (strpos($title, '%%excerpt%%') !== false) {
4003
+        $title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
4004 4004
     }
4005 4005
 
4006
-    if(strpos($title,'%%pt_single%%') !== false){
4006
+    if (strpos($title, '%%pt_single%%') !== false) {
4007 4007
         $single_name = '';
4008
-        if($gd_page=='search' || $gd_page=='author'){
4008
+        if ($gd_page == 'search' || $gd_page == 'author') {
4009 4009
             $geodir_post_types = get_option('geodir_post_types');
4010 4010
             $spt = esc_attr($_REQUEST['stype']);
4011
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4012
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4011
+            if (isset($geodir_post_types[$spt]['labels']['singular_name'])) {
4012
+                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'], 'geodirectory');
4013 4013
             }
4014
-        }elseif($gd_page=='add-listing'){
4014
+        }elseif ($gd_page == 'add-listing') {
4015 4015
             $geodir_post_types = get_option('geodir_post_types');
4016 4016
             $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
4017
-            if(!$spt && isset($_REQUEST['pid'])){
4018
-                $spt = get_post_type( $_REQUEST['pid'] );
4017
+            if (!$spt && isset($_REQUEST['pid'])) {
4018
+                $spt = get_post_type($_REQUEST['pid']);
4019 4019
             }
4020
-            if(!$spt){$spt='gd_place';}
4021
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4022
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4020
+            if (!$spt) {$spt = 'gd_place'; }
4021
+            if (isset($geodir_post_types[$spt]['labels']['singular_name'])) {
4022
+                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'], 'geodirectory');
4023 4023
             }
4024 4024
         }
4025
-        elseif($post->post_type){
4025
+        elseif ($post->post_type) {
4026 4026
             $geodir_post_types = get_option('geodir_post_types');
4027
-            if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4028
-                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
4027
+            if (isset($geodir_post_types[$post->post_type]['labels']['singular_name'])) {
4028
+                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'], 'geodirectory');
4029 4029
             }
4030 4030
 
4031 4031
 
4032 4032
         }
4033
-        $title = str_replace("%%pt_single%%",$single_name,$title);
4033
+        $title = str_replace("%%pt_single%%", $single_name, $title);
4034 4034
     }
4035 4035
 
4036
-    if(strpos($title,'%%pt_plural%%') !== false){
4036
+    if (strpos($title, '%%pt_plural%%') !== false) {
4037 4037
         $plural_name = '';
4038
-        if($gd_page=='search' || $gd_page=='author'){
4038
+        if ($gd_page == 'search' || $gd_page == 'author') {
4039 4039
             $geodir_post_types = get_option('geodir_post_types');
4040 4040
             $spt = esc_attr($_REQUEST['stype']);
4041
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4042
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4041
+            if (isset($geodir_post_types[$spt]['labels']['name'])) {
4042
+                $plural_name = __($geodir_post_types[$spt]['labels']['name'], 'geodirectory');
4043 4043
             }
4044
-        }elseif($gd_page=='add-listing'){
4044
+        }elseif ($gd_page == 'add-listing') {
4045 4045
             $geodir_post_types = get_option('geodir_post_types');
4046 4046
             $spt = sanitize_text_field($_REQUEST['listing_type']);
4047
-            if(!$spt){$spt='gd_place';}
4048
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4049
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4047
+            if (!$spt) {$spt = 'gd_place'; }
4048
+            if (isset($geodir_post_types[$spt]['labels']['name'])) {
4049
+                $plural_name = __($geodir_post_types[$spt]['labels']['name'], 'geodirectory');
4050 4050
             }
4051 4051
         }
4052
-        elseif(isset($post->post_type) && $post->post_type){
4052
+        elseif (isset($post->post_type) && $post->post_type) {
4053 4053
             $geodir_post_types = get_option('geodir_post_types');
4054
-            if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4055
-                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
4054
+            if (isset($geodir_post_types[$post->post_type]['labels']['name'])) {
4055
+                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'], 'geodirectory');
4056 4056
             }
4057 4057
 
4058 4058
         }
4059
-        $title = str_replace("%%pt_plural%%",$plural_name,$title);
4059
+        $title = str_replace("%%pt_plural%%", $plural_name, $title);
4060 4060
     }
4061 4061
 
4062 4062
 
4063 4063
 
4064
-    if(strpos($title,'%%category%%') !== false){
4064
+    if (strpos($title, '%%category%%') !== false) {
4065 4065
         $cat_name = '';
4066 4066
 
4067
-        if($gd_page=='detail') {
4067
+        if ($gd_page == 'detail') {
4068 4068
             if ($post->default_category) {
4069 4069
                 $cat = get_term($post->default_category, $post->post_type . 'category');
4070 4070
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4071 4071
             }
4072
-        }elseif($gd_page=='listing'){
4072
+        }elseif ($gd_page == 'listing') {
4073 4073
             $queried_object = get_queried_object();
4074
-            if(isset($queried_object->name)){
4074
+            if (isset($queried_object->name)) {
4075 4075
                 $cat_name = $queried_object->name;
4076 4076
             }
4077 4077
         }
4078
-        $title = str_replace("%%category%%",$cat_name,$title);
4078
+        $title = str_replace("%%category%%", $cat_name, $title);
4079 4079
     }
4080 4080
 
4081
-    if(strpos($title,'%%tag%%') !== false){
4081
+    if (strpos($title, '%%tag%%') !== false) {
4082 4082
         $cat_name = '';
4083 4083
 
4084
-        if($gd_page=='detail') {
4084
+        if ($gd_page == 'detail') {
4085 4085
             if ($post->default_category) {
4086 4086
                 $cat = get_term($post->default_category, $post->post_type . 'category');
4087 4087
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4088 4088
             }
4089
-        }elseif($gd_page=='listing'){
4089
+        }elseif ($gd_page == 'listing') {
4090 4090
             $queried_object = get_queried_object();
4091
-            if(isset($queried_object->name)){
4091
+            if (isset($queried_object->name)) {
4092 4092
                 $cat_name = $queried_object->name;
4093 4093
             }
4094 4094
         }
4095
-        $title = str_replace("%%tag%%",$cat_name,$title);
4095
+        $title = str_replace("%%tag%%", $cat_name, $title);
4096 4096
     }
4097 4097
 
4098 4098
 
4099 4099
 
4100
-    if(strpos($title,'%%id%%') !== false){
4100
+    if (strpos($title, '%%id%%') !== false) {
4101 4101
         $ID = (isset($post->ID)) ? $post->ID : '';
4102
-        $title = str_replace("%%id%%",$ID,$title);
4102
+        $title = str_replace("%%id%%", $ID, $title);
4103 4103
     }
4104 4104
 
4105 4105
     /*
@@ -4112,8 +4112,8 @@  discard block
 block discarded – undo
4112 4112
         }
4113 4113
     */
4114 4114
 
4115
-    if(strpos($title,'%%sep%%') !== false){
4116
-        $title = str_replace("%%sep%%",$sep,$title);
4115
+    if (strpos($title, '%%sep%%') !== false) {
4116
+        $title = str_replace("%%sep%%", $sep, $title);
4117 4117
     }
4118 4118
 
4119 4119
 
@@ -4131,12 +4131,12 @@  discard block
 block discarded – undo
4131 4131
      * @param string $gd_page The page being filtered.
4132 4132
      * @param string $sep The separator, default: `|`.
4133 4133
      */
4134
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4134
+    $location_array = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
4135 4135
     $location_titles = array();
4136
-    if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4137
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4138
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4139
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4136
+    if ($gd_page == 'location' && get_query_var('gd_country_full')) {
4137
+        if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
4138
+        if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
4139
+        if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
4140 4140
     }
4141 4141
     $location_single = '';
4142 4142
     $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
@@ -4208,65 +4208,65 @@  discard block
 block discarded – undo
4208 4208
     }
4209 4209
 
4210 4210
 
4211
-    if(strpos($title,'%%location%%') !== false){
4211
+    if (strpos($title, '%%location%%') !== false) {
4212 4212
         $location = '';
4213
-        if($location_titles) {
4213
+        if ($location_titles) {
4214 4214
             $location = implode(", ", $location_titles);
4215 4215
         }
4216
-        $title = str_replace("%%location%%",$location,$title);
4216
+        $title = str_replace("%%location%%", $location, $title);
4217 4217
     }
4218 4218
 
4219
-    if(strpos($title,'%%in_location%%') !== false){
4219
+    if (strpos($title, '%%in_location%%') !== false) {
4220 4220
         $location = '';
4221
-        if($location_titles) {
4221
+        if ($location_titles) {
4222 4222
             $location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4223 4223
         }
4224
-        $title = str_replace("%%in_location%%",$location,$title);
4224
+        $title = str_replace("%%in_location%%", $location, $title);
4225 4225
     }
4226 4226
 
4227
-    if(strpos($title,'%%in_location_single%%') !== false){
4228
-        if($location_single) {
4229
-            $location_single = __('in', 'geodirectory') . ' ' .$location_single;
4227
+    if (strpos($title, '%%in_location_single%%') !== false) {
4228
+        if ($location_single) {
4229
+            $location_single = __('in', 'geodirectory') . ' ' . $location_single;
4230 4230
         }
4231
-        $title = str_replace("%%in_location_single%%",$location_single,$title);
4231
+        $title = str_replace("%%in_location_single%%", $location_single, $title);
4232 4232
     }
4233 4233
 
4234
-    if(strpos($title,'%%location_single%%') !== false){
4235
-        $title = str_replace("%%location_single%%",$location_single,$title);
4234
+    if (strpos($title, '%%location_single%%') !== false) {
4235
+        $title = str_replace("%%location_single%%", $location_single, $title);
4236 4236
     }
4237 4237
 
4238 4238
 
4239
-    if(strpos($title,'%%search_term%%') !== false){
4239
+    if (strpos($title, '%%search_term%%') !== false) {
4240 4240
         $search_term = '';
4241
-        if(isset($_REQUEST['s'])){
4241
+        if (isset($_REQUEST['s'])) {
4242 4242
             $search_term = esc_attr($_REQUEST['s']);
4243 4243
         }
4244
-        $title = str_replace("%%search_term%%",$search_term,$title);
4244
+        $title = str_replace("%%search_term%%", $search_term, $title);
4245 4245
     }
4246 4246
 
4247
-    if(strpos($title,'%%search_near%%') !== false){
4247
+    if (strpos($title, '%%search_near%%') !== false) {
4248 4248
         $search_term = '';
4249
-        if(isset($_REQUEST['snear'])){
4249
+        if (isset($_REQUEST['snear'])) {
4250 4250
             $search_term = esc_attr($_REQUEST['snear']);
4251 4251
         }
4252
-        $title = str_replace("%%search_near%%",$search_term,$title);
4252
+        $title = str_replace("%%search_near%%", $search_term, $title);
4253 4253
     }
4254 4254
 
4255
-    if(strpos($title,'%%name%%') !== false){
4255
+    if (strpos($title, '%%name%%') !== false) {
4256 4256
         $author_name = '';
4257
-        if($author_name = get_the_author()){}
4258
-        else{
4257
+        if ($author_name = get_the_author()) {}
4258
+        else {
4259 4259
             $queried_object = get_queried_object();
4260
-            if(isset($queried_object->data->user_nicename)){
4260
+            if (isset($queried_object->data->user_nicename)) {
4261 4261
                 $author_name = $queried_object->data->user_nicename;
4262 4262
             }
4263 4263
         }
4264
-        $title = str_replace("%%name%%",$author_name,$title);
4264
+        $title = str_replace("%%name%%", $author_name, $title);
4265 4265
     }
4266 4266
 
4267
-    $title = wptexturize( $title );
4268
-    $title = convert_chars( $title );
4269
-    $title = esc_html( $title );
4267
+    $title = wptexturize($title);
4268
+    $title = convert_chars($title);
4269
+    $title = esc_html($title);
4270 4270
 
4271 4271
     /**
4272 4272
      * Filter the title variables after standard ones have been filtered.
@@ -4279,7 +4279,7 @@  discard block
 block discarded – undo
4279 4279
      * @param string $sep The separator, default: `|`.
4280 4280
      */
4281 4281
 
4282
-    return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4282
+    return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
4283 4283
 }
4284 4284
 
4285 4285
 /**
@@ -4401,14 +4401,14 @@  discard block
 block discarded – undo
4401 4401
         return;
4402 4402
     }
4403 4403
     
4404
-    $is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) )  ? true : false;
4404
+    $is_admin = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false;
4405 4405
     $inline_save = isset($_POST['action']) && $_POST['action'] == 'inline-save' ? true : false;
4406 4406
 
4407 4407
     if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
4408 4408
         return;
4409 4409
     }
4410 4410
 
4411
-    $user_id = (int)get_current_user_id();
4411
+    $user_id = (int) get_current_user_id();
4412 4412
         
4413 4413
     if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4414 4414
         $author_id = !empty($post->post_author) ? $post->post_author : 0;
Please login to merge, or discard this patch.
geodirectory_hooks_actions.php 1 patch
Indentation   +1491 added lines, -1491 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_get_ajax_url()
21 21
 {
22
-    return admin_url('admin-ajax.php?action=geodir_ajax_action');
22
+	return admin_url('admin-ajax.php?action=geodir_ajax_action');
23 23
 }
24 24
 
25 25
 /////////////////////
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89 89
 if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
90
+	add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91 91
 
92 92
 add_filter('parse_query', 'geodir_modified_query');
93 93
 
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 /* POST AND LOOP ACTIONS */
155 155
 ////////////////////////
156 156
 if (!is_admin()) {
157
-    add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
-    add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
-    /** Exclude Virtual Pages From Pages List **/
160
-    add_action('pre_get_posts', 'set_listing_request', 0);
161
-    add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
-    add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
-    add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
-    add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
157
+	add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
+	add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
+	/** Exclude Virtual Pages From Pages List **/
160
+	add_action('pre_get_posts', 'set_listing_request', 0);
161
+	add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
+	add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
+	add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
+	add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
165 165
 }
166 166
 
167 167
 
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
  */
222 222
 function geodir_unset_prev_theme_nav_location($newname)
223 223
 {
224
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
225
-    if ($geodir_theme_location) {
226
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
227
-    } else {
228
-        update_option('geodir_theme_location_nav', '');
229
-    }
224
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
225
+	if ($geodir_theme_location) {
226
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
227
+	} else {
228
+		update_option('geodir_theme_location_nav', '');
229
+	}
230 230
 }
231 231
 
232 232
 /// add action for theme switch to blank previous theme navigation location setting
@@ -247,32 +247,32 @@  discard block
 block discarded – undo
247 247
  */
248 248
 function geodir_add_post_filters()
249 249
 {
250
-    /**
251
-     * Contains all function for filtering listing.
252
-     *
253
-     * @since 1.0.0
254
-     * @package GeoDirectory
255
-     */
256
-    include_once('geodirectory-functions/listing_filters.php');
250
+	/**
251
+	 * Contains all function for filtering listing.
252
+	 *
253
+	 * @since 1.0.0
254
+	 * @package GeoDirectory
255
+	 */
256
+	include_once('geodirectory-functions/listing_filters.php');
257 257
 }
258 258
 
259 259
 
260 260
 if (!function_exists('geodir_init_defaults')) {
261
-    /**
262
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
263
-     *
264
-     * @since 1.0.0
265
-     * @package GeoDirectory
266
-     */
267
-    function geodir_init_defaults()
268
-    {
269
-        if (function_exists('geodir_register_defaults')) {
261
+	/**
262
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
263
+	 *
264
+	 * @since 1.0.0
265
+	 * @package GeoDirectory
266
+	 */
267
+	function geodir_init_defaults()
268
+	{
269
+		if (function_exists('geodir_register_defaults')) {
270 270
 
271
-            geodir_register_defaults();
271
+			geodir_register_defaults();
272 272
 
273
-        }
273
+		}
274 274
 
275
-    }
275
+	}
276 276
 }
277 277
 
278 278
 
@@ -294,26 +294,26 @@  discard block
 block discarded – undo
294 294
 // CALLED ON 'sidebars_widgets' FILTER
295 295
 
296 296
 if (!function_exists('geodir_restrict_widget')) {
297
-    /**
298
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
299
-     *
300
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
301
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
302
-     * @since 1.0.0
303
-     * @package GeoDirectory
304
-     */
305
-    function geodir_restrict_widget()
306
-    {
307
-        global $is_listing, $is_single_place;
297
+	/**
298
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
299
+	 *
300
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
301
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
302
+	 * @since 1.0.0
303
+	 * @package GeoDirectory
304
+	 */
305
+	function geodir_restrict_widget()
306
+	{
307
+		global $is_listing, $is_single_place;
308 308
 
309
-        // set is listing	
310
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
309
+		// set is listing	
310
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
311 311
 
312
-        // set is single place
313
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
312
+		// set is single place
313
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
314 314
 
315 315
 
316
-    }
316
+	}
317 317
 }
318 318
 
319 319
 
@@ -334,32 +334,32 @@  discard block
 block discarded – undo
334 334
  */
335 335
 function geodir_detail_page_sidebar_content_sorting()
336 336
 {
337
-    $arr_detail_page_sidebar_content =
338
-        /**
339
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
340
-         *
341
-         * This filter can be used to remove sections of the details page sidebar,
342
-         * add new sections or rearrange the order of the sections.
343
-         *
344
-         * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
345
-         * @since 1.0.0
346
-         */
347
-        apply_filters('geodir_detail_page_sidebar_content',
348
-            array('geodir_social_sharing_buttons',
349
-                'geodir_share_this_button',
350
-                'geodir_detail_page_google_analytics',
351
-                'geodir_edit_post_link',
352
-                'geodir_detail_page_review_rating',
353
-                'geodir_detail_page_more_info'
354
-            ) // end of array 
355
-        ); // end of apply filter
356
-    if (!empty($arr_detail_page_sidebar_content)) {
357
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
358
-            if (function_exists($content_function)) {
359
-                add_action('geodir_detail_page_sidebar', $content_function);
360
-            }
361
-        }
362
-    }
337
+	$arr_detail_page_sidebar_content =
338
+		/**
339
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
340
+		 *
341
+		 * This filter can be used to remove sections of the details page sidebar,
342
+		 * add new sections or rearrange the order of the sections.
343
+		 *
344
+		 * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
345
+		 * @since 1.0.0
346
+		 */
347
+		apply_filters('geodir_detail_page_sidebar_content',
348
+			array('geodir_social_sharing_buttons',
349
+				'geodir_share_this_button',
350
+				'geodir_detail_page_google_analytics',
351
+				'geodir_edit_post_link',
352
+				'geodir_detail_page_review_rating',
353
+				'geodir_detail_page_more_info'
354
+			) // end of array 
355
+		); // end of apply filter
356
+	if (!empty($arr_detail_page_sidebar_content)) {
357
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
358
+			if (function_exists($content_function)) {
359
+				add_action('geodir_detail_page_sidebar', $content_function);
360
+			}
361
+		}
362
+	}
363 363
 }
364 364
 
365 365
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -374,14 +374,14 @@  discard block
 block discarded – undo
374 374
  */
375 375
 function geodir_add_to_favourite_link()
376 376
 {
377
-    global $post, $preview;
378
-    if (!$preview && geodir_is_page('detail')) {
379
-        ?>
377
+	global $post, $preview;
378
+	if (!$preview && geodir_is_page('detail')) {
379
+		?>
380 380
         <p class="edit_link">
381 381
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
382 382
         </p>
383 383
     <?php
384
-    }
384
+	}
385 385
 }
386 386
 
387 387
 /**
@@ -395,41 +395,41 @@  discard block
 block discarded – undo
395 395
  */
396 396
 function geodir_social_sharing_buttons()
397 397
 {
398
-    global $preview;
399
-    ob_start(); // Start  buffering;
400
-    /**
401
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
402
-     *
403
-     * @since 1.0.0
404
-     */
405
-    do_action('geodir_before_social_sharing_buttons');
406
-    if (!$preview) {
407
-        ?>
398
+	global $preview;
399
+	ob_start(); // Start  buffering;
400
+	/**
401
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
402
+	 *
403
+	 * @since 1.0.0
404
+	 */
405
+	do_action('geodir_before_social_sharing_buttons');
406
+	if (!$preview) {
407
+		?>
408 408
         <div class="likethis">
409 409
             <?php geodir_twitter_tweet_button(); ?>
410 410
             <?php geodir_fb_like_button(); ?>
411 411
             <?php geodir_google_plus_button(); ?>
412 412
         </div>
413 413
     <?php
414
-    }// end of if, if its a preview or not
415
-
416
-    /**
417
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
418
-     *
419
-     * @since 1.0.0
420
-     */
421
-    do_action('geodir_after_social_sharing_buttons');
422
-    $content_html = ob_get_clean();
423
-    if (trim($content_html) != '')
424
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426
-        /**
427
-         * Filter the geodir_social_sharing_buttons() function content.
428
-         *
429
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
430
-         */
431
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
432
-    }
414
+	}// end of if, if its a preview or not
415
+
416
+	/**
417
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
418
+	 *
419
+	 * @since 1.0.0
420
+	 */
421
+	do_action('geodir_after_social_sharing_buttons');
422
+	$content_html = ob_get_clean();
423
+	if (trim($content_html) != '')
424
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426
+		/**
427
+		 * Filter the geodir_social_sharing_buttons() function content.
428
+		 *
429
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
430
+		 */
431
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
432
+	}
433 433
 
434 434
 
435 435
 }
@@ -445,39 +445,39 @@  discard block
 block discarded – undo
445 445
  */
446 446
 function geodir_share_this_button()
447 447
 {
448
-    global $preview;
449
-    ob_start(); // Start buffering;
450
-    /**
451
-     * This is called before the share this html in the function geodir_share_this_button()
452
-     *
453
-     * @since 1.0.0
454
-     */
455
-    do_action('geodir_before_share_this_button');
456
-    if (!$preview) {
457
-        ?>
448
+	global $preview;
449
+	ob_start(); // Start buffering;
450
+	/**
451
+	 * This is called before the share this html in the function geodir_share_this_button()
452
+	 *
453
+	 * @since 1.0.0
454
+	 */
455
+	do_action('geodir_before_share_this_button');
456
+	if (!$preview) {
457
+		?>
458 458
         <div class="share clearfix">
459 459
             <?php geodir_share_this_button_code(); ?>
460 460
         </div>
461 461
     <?php
462
-    }// end of if, if its a preview or not
463
-    /**
464
-     * This is called after the share this html in the function geodir_share_this_button()
465
-     *
466
-     * @since 1.0.0
467
-     */
468
-    do_action('geodir_after_share_this_button');
469
-    $content_html = ob_get_clean();
470
-    if (trim($content_html) != '')
471
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
472
-    if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
473
-        /**
474
-         * Filter the geodir_share_this_button() function content.
475
-         *
476
-         * @param string $content_html The output html of the geodir_share_this_button() function.
477
-         * @since 1.0.0
478
-         */
479
-        echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
480
-    }
462
+	}// end of if, if its a preview or not
463
+	/**
464
+	 * This is called after the share this html in the function geodir_share_this_button()
465
+	 *
466
+	 * @since 1.0.0
467
+	 */
468
+	do_action('geodir_after_share_this_button');
469
+	$content_html = ob_get_clean();
470
+	if (trim($content_html) != '')
471
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
472
+	if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
473
+		/**
474
+		 * Filter the geodir_share_this_button() function content.
475
+		 *
476
+		 * @param string $content_html The output html of the geodir_share_this_button() function.
477
+		 * @since 1.0.0
478
+		 */
479
+		echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
480
+	}
481 481
 
482 482
 }
483 483
 
@@ -493,46 +493,46 @@  discard block
 block discarded – undo
493 493
  */
494 494
 function geodir_edit_post_link()
495 495
 {
496
-    global $post, $preview;
497
-    ob_start(); // Start buffering;
498
-    /**
499
-     * This is called before the edit post link html in the function geodir_edit_post_link()
500
-     *
501
-     * @since 1.0.0
502
-     */
503
-    do_action('geodir_before_edit_post_link');
504
-    if (!$preview) {
505
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
496
+	global $post, $preview;
497
+	ob_start(); // Start buffering;
498
+	/**
499
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
500
+	 *
501
+	 * @since 1.0.0
502
+	 */
503
+	do_action('geodir_before_edit_post_link');
504
+	if (!$preview) {
505
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
506 506
         
507
-        if ($is_current_user_owner) {
508
-            $post_id = $post->ID;
507
+		if ($is_current_user_owner) {
508
+			$post_id = $post->ID;
509 509
             
510
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
511
-                $post_id = (int)$_REQUEST['pid'];
512
-            }
510
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
511
+				$post_id = (int)$_REQUEST['pid'];
512
+			}
513 513
 
514
-            $postlink = get_permalink(geodir_add_listing_page_id());
515
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
516
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
517
-        }
518
-    }// end of if, if its a preview or not
519
-    /**
520
-     * This is called after the edit post link html in the function geodir_edit_post_link()
521
-     *
522
-     * @since 1.0.0
523
-     */
524
-    do_action('geodir_after_edit_post_link');
525
-    $content_html = ob_get_clean();
526
-    if (trim($content_html) != '')
527
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
528
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
529
-        /**
530
-         * Filter the geodir_edit_post_link() function content.
531
-         *
532
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
533
-         */
534
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
535
-    }
514
+			$postlink = get_permalink(geodir_add_listing_page_id());
515
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
516
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
517
+		}
518
+	}// end of if, if its a preview or not
519
+	/**
520
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
521
+	 *
522
+	 * @since 1.0.0
523
+	 */
524
+	do_action('geodir_after_edit_post_link');
525
+	$content_html = ob_get_clean();
526
+	if (trim($content_html) != '')
527
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
528
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
529
+		/**
530
+		 * Filter the geodir_edit_post_link() function content.
531
+		 *
532
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
533
+		 */
534
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
535
+	}
536 536
 }
537 537
 
538 538
 /**
@@ -546,27 +546,27 @@  discard block
 block discarded – undo
546 546
  */
547 547
 function geodir_detail_page_google_analytics()
548 548
 {
549
-    global $post;
550
-    $package_info = array();
551
-    $package_info = geodir_post_package_info($package_info, $post);
549
+	global $post;
550
+	$package_info = array();
551
+	$package_info = geodir_post_package_info($package_info, $post);
552 552
 
553
-    $id = trim(get_option('geodir_ga_id'));
553
+	$id = trim(get_option('geodir_ga_id'));
554 554
 
555
-    if (!$id) {
556
-        return; //if no Google Analytics ID then bail.
557
-    }
555
+	if (!$id) {
556
+		return; //if no Google Analytics ID then bail.
557
+	}
558 558
 
559
-    ob_start(); // Start buffering;
560
-    /**
561
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
562
-     *
563
-     * @since 1.0.0
564
-     */
565
-    do_action('geodir_before_google_analytics');
559
+	ob_start(); // Start buffering;
560
+	/**
561
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
562
+	 *
563
+	 * @since 1.0.0
564
+	 */
565
+	do_action('geodir_before_google_analytics');
566 566
     
567
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
568
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
569
-        ?>
567
+	if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
568
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
569
+		?>
570 570
         <script type="text/javascript">
571 571
             ga_data1 = false;
572 572
             ga_data2 = false;
@@ -795,15 +795,15 @@  discard block
 block discarded – undo
795 795
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
796 796
 
797 797
                     <?php
798
-                    // Here we list the shorthand days of the week so it can be used in translation.
799
-                    __("Mon",'geodirectory');
800
-                    __("Tue",'geodirectory');
801
-                    __("Wed",'geodirectory');
802
-                    __("Thu",'geodirectory');
803
-                    __("Fri",'geodirectory');
804
-                    __("Sat",'geodirectory');
805
-                    __("Sun",'geodirectory');
806
-                    ?>
798
+					// Here we list the shorthand days of the week so it can be used in translation.
799
+					__("Mon",'geodirectory');
800
+					__("Tue",'geodirectory');
801
+					__("Wed",'geodirectory');
802
+					__("Thu",'geodirectory');
803
+					__("Fri",'geodirectory');
804
+					__("Sat",'geodirectory');
805
+					__("Sun",'geodirectory');
806
+					?>
807 807
 
808 808
                     labels = [
809 809
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1028,24 +1028,24 @@  discard block
 block discarded – undo
1028 1028
         </span>
1029 1029
 
1030 1030
     <?php
1031
-    }
1032
-    /**
1033
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1034
-     *
1035
-     * @since 1.0.0
1036
-     */
1037
-    do_action('geodir_after_google_analytics');
1038
-    $content_html = ob_get_clean();
1039
-    if (trim($content_html) != '')
1040
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1041
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1042
-        /**
1043
-         * Filter the geodir_edit_post_link() function content.
1044
-         *
1045
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1046
-         */
1047
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1048
-    }
1031
+	}
1032
+	/**
1033
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1034
+	 *
1035
+	 * @since 1.0.0
1036
+	 */
1037
+	do_action('geodir_after_google_analytics');
1038
+	$content_html = ob_get_clean();
1039
+	if (trim($content_html) != '')
1040
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1041
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1042
+		/**
1043
+		 * Filter the geodir_edit_post_link() function content.
1044
+		 *
1045
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1046
+		 */
1047
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1048
+	}
1049 1049
 }
1050 1050
 
1051 1051
 /**
@@ -1059,90 +1059,90 @@  discard block
 block discarded – undo
1059 1059
  */
1060 1060
 function geodir_detail_page_review_rating()
1061 1061
 {
1062
-    global $post, $preview, $post_images;
1063
-    ob_start(); // Start  buffering;
1064
-    /**
1065
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1066
-     *
1067
-     * This is called outside the check for an actual rating and the check for preview page.
1068
-     *
1069
-     * @since 1.0.0
1070
-     */
1071
-    do_action('geodir_before_detail_page_review_rating');
1072
-
1073
-    $comment_count = geodir_get_review_count_total($post->ID);
1074
-    $post_avgratings = geodir_get_post_rating($post->ID);
1075
-
1076
-    if ($post_avgratings != 0 && !$preview) {
1077
-        /**
1078
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1079
-         *
1080
-         * This is called inside the check for an actual rating and the check for preview page.
1081
-         *
1082
-         * @since 1.0.0
1083
-         * @param float $post_avgratings Average rating for the surrent post.
1084
-         * @param int $post->ID Current post ID.
1085
-         */
1086
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1087
-
1088
-        $html = '<p style=" float:left;">';
1089
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1090
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1091
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1062
+	global $post, $preview, $post_images;
1063
+	ob_start(); // Start  buffering;
1064
+	/**
1065
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1066
+	 *
1067
+	 * This is called outside the check for an actual rating and the check for preview page.
1068
+	 *
1069
+	 * @since 1.0.0
1070
+	 */
1071
+	do_action('geodir_before_detail_page_review_rating');
1072
+
1073
+	$comment_count = geodir_get_review_count_total($post->ID);
1074
+	$post_avgratings = geodir_get_post_rating($post->ID);
1075
+
1076
+	if ($post_avgratings != 0 && !$preview) {
1077
+		/**
1078
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1079
+		 *
1080
+		 * This is called inside the check for an actual rating and the check for preview page.
1081
+		 *
1082
+		 * @since 1.0.0
1083
+		 * @param float $post_avgratings Average rating for the surrent post.
1084
+		 * @param int $post->ID Current post ID.
1085
+		 */
1086
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1087
+
1088
+		$html = '<p style=" float:left;">';
1089
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1090
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1091
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1092 1092
        
1093 1093
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1094 1094
 	   
1095 1095
 	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1096 1096
 
1097
-        $html .= '<span class="item">';
1098
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1097
+		$html .= '<span class="item">';
1098
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1099 1099
 
1100
-        if ($post_images) {
1101
-            foreach ($post_images as $img) {
1102
-                $post_img = $img->src;
1103
-                break;
1104
-            }
1105
-        }
1106
-
1107
-        if (isset($post_img) && $post_img) {
1108
-            $html .= '<br /><img src="' . $post_img . '" class="photo hreview-img" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo hreview-img" />';
1109
-        }
1110
-
1111
-        $html .= '</span>';
1112
-
1113
-        echo $html .= '</div>';
1114
-        /**
1115
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1116
-         *
1117
-         * This is called inside the check for an actual rating and the check for preview page.
1118
-         *
1119
-         * @since 1.0.0
1120
-         * @param float $post_avgratings Average rating for the surrent post.
1121
-         * @param int $post->ID Current post ID.
1122
-         */
1123
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1124
-    }
1125
-    /**
1126
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1127
-     *
1128
-     * This is called outside the check for an actual rating and the check for preview page.
1129
-     *
1130
-     * @since 1.0.0
1131
-     */
1132
-    do_action('geodir_after_detail_page_review_rating');
1133
-    $content_html = ob_get_clean();
1134
-    if (trim($content_html) != '') {
1135
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1136
-    }
1137
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1138
-        /**
1139
-         * Filter the geodir_detail_page_review_rating() function content.
1140
-         *
1141
-         * @since 1.0.0
1142
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1143
-         */
1144
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1145
-    }
1100
+		if ($post_images) {
1101
+			foreach ($post_images as $img) {
1102
+				$post_img = $img->src;
1103
+				break;
1104
+			}
1105
+		}
1106
+
1107
+		if (isset($post_img) && $post_img) {
1108
+			$html .= '<br /><img src="' . $post_img . '" class="photo hreview-img" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo hreview-img" />';
1109
+		}
1110
+
1111
+		$html .= '</span>';
1112
+
1113
+		echo $html .= '</div>';
1114
+		/**
1115
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1116
+		 *
1117
+		 * This is called inside the check for an actual rating and the check for preview page.
1118
+		 *
1119
+		 * @since 1.0.0
1120
+		 * @param float $post_avgratings Average rating for the surrent post.
1121
+		 * @param int $post->ID Current post ID.
1122
+		 */
1123
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1124
+	}
1125
+	/**
1126
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1127
+	 *
1128
+	 * This is called outside the check for an actual rating and the check for preview page.
1129
+	 *
1130
+	 * @since 1.0.0
1131
+	 */
1132
+	do_action('geodir_after_detail_page_review_rating');
1133
+	$content_html = ob_get_clean();
1134
+	if (trim($content_html) != '') {
1135
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1136
+	}
1137
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1138
+		/**
1139
+		 * Filter the geodir_detail_page_review_rating() function content.
1140
+		 *
1141
+		 * @since 1.0.0
1142
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1143
+		 */
1144
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1145
+	}
1146 1146
 }
1147 1147
 
1148 1148
 /**
@@ -1154,35 +1154,35 @@  discard block
 block discarded – undo
1154 1154
  */
1155 1155
 function geodir_detail_page_more_info()
1156 1156
 {
1157
-    ob_start(); // Start  buffering;
1158
-    /**
1159
-     * This is called before the info section html.
1160
-     *
1161
-     * @since 1.0.0
1162
-     */
1163
-    do_action('geodir_before_detail_page_more_info');
1164
-    if ($geodir_post_detail_fields = geodir_show_listing_info()) {
1165
-        echo $geodir_post_detail_fields;
1166
-    }
1167
-    /**
1168
-     * This is called after the info section html.
1169
-     *
1170
-     * @since 1.0.0
1171
-     */
1172
-    do_action('geodir_after_detail_page_more_info');
1173
-
1174
-    $content_html = ob_get_clean();
1175
-    if (trim($content_html) != '')
1176
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1177
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1178
-        /**
1179
-         * Filter the output html for function geodir_detail_page_more_info().
1180
-         *
1181
-         * @since 1.0.0
1182
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1183
-         */
1184
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1185
-    }
1157
+	ob_start(); // Start  buffering;
1158
+	/**
1159
+	 * This is called before the info section html.
1160
+	 *
1161
+	 * @since 1.0.0
1162
+	 */
1163
+	do_action('geodir_before_detail_page_more_info');
1164
+	if ($geodir_post_detail_fields = geodir_show_listing_info()) {
1165
+		echo $geodir_post_detail_fields;
1166
+	}
1167
+	/**
1168
+	 * This is called after the info section html.
1169
+	 *
1170
+	 * @since 1.0.0
1171
+	 */
1172
+	do_action('geodir_after_detail_page_more_info');
1173
+
1174
+	$content_html = ob_get_clean();
1175
+	if (trim($content_html) != '')
1176
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1177
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1178
+		/**
1179
+		 * Filter the output html for function geodir_detail_page_more_info().
1180
+		 *
1181
+		 * @since 1.0.0
1182
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1183
+		 */
1184
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1185
+	}
1186 1186
 }
1187 1187
 
1188 1188
 
@@ -1196,15 +1196,15 @@  discard block
 block discarded – undo
1196 1196
  */
1197 1197
 function geodir_localize_all_js_msg()
1198 1198
 {// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
1199
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1200
-        $ajax_url = admin_url('admin-ajax.php');
1201
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1202
-        $ajax_url = admin_url('admin-ajax.php');
1203
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1204
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1205
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1206
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1207
-    }
1199
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1200
+		$ajax_url = admin_url('admin-ajax.php');
1201
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1202
+		$ajax_url = admin_url('admin-ajax.php');
1203
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1204
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1205
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1206
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1207
+	}
1208 1208
 	
1209 1209
 	/**
1210 1210
 	 * Filter the allowed image type extensions for post images.
@@ -1214,52 +1214,52 @@  discard block
 block discarded – undo
1214 1214
 	 */
1215 1215
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1216 1216
 	
1217
-    $arr_alert_msg = array(
1218
-        'geodir_plugin_url' => geodir_plugin_url(),
1219
-        'geodir_admin_ajax_url' => $ajax_url,
1220
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1221
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1222
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1223
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1224
-        //start not show alert msg
1225
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1226
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1227
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1228
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1229
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1230
-        // end not show alert msg
1231
-        'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1232
-        //start not show alert msg
1233
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1234
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1235
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1236
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1237
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1238
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1239
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1240
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1241
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1242
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1243
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1244
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1245
-        'geodir_default_marker_icon' => get_option('geodir_default_marker_icon'),
1246
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1247
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1248
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1249
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1250
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1251
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1252
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1253
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1254
-        /* on/off dragging for phone devices */
1255
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1256
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1257
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1258
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1259
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1260
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1261
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1262
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1217
+	$arr_alert_msg = array(
1218
+		'geodir_plugin_url' => geodir_plugin_url(),
1219
+		'geodir_admin_ajax_url' => $ajax_url,
1220
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1221
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1222
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1223
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1224
+		//start not show alert msg
1225
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1226
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1227
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1228
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1229
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1230
+		// end not show alert msg
1231
+		'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1232
+		//start not show alert msg
1233
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1234
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1235
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1236
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1237
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1238
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1239
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1240
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1241
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1242
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1243
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1244
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1245
+		'geodir_default_marker_icon' => get_option('geodir_default_marker_icon'),
1246
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1247
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1248
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1249
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1250
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1251
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1252
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1253
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1254
+		/* on/off dragging for phone devices */
1255
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1256
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1257
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1258
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1259
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1260
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1261
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1262
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1263 1263
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1264 1264
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1265 1265
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1267,28 +1267,28 @@  discard block
 block discarded – undo
1267 1267
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1268 1268
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1269 1269
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1270
-    );
1271
-
1272
-    /**
1273
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1274
-     *
1275
-     * With this filter you can add, remove or change translated JS strings.
1276
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1277
-     *
1278
-     * @since 1.0.0
1279
-     */
1280
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1281
-
1282
-    foreach ($arr_alert_msg as $key => $value) {
1283
-        if (!is_scalar($value))
1284
-            continue;
1285
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1286
-    }
1270
+	);
1271
+
1272
+	/**
1273
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1274
+	 *
1275
+	 * With this filter you can add, remove or change translated JS strings.
1276
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1277
+	 *
1278
+	 * @since 1.0.0
1279
+	 */
1280
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1281
+
1282
+	foreach ($arr_alert_msg as $key => $value) {
1283
+		if (!is_scalar($value))
1284
+			continue;
1285
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1286
+	}
1287 1287
 
1288
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1289
-    echo '<script>';
1290
-    echo $script;
1291
-    echo '</script>';
1288
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1289
+	echo '<script>';
1290
+	echo $script;
1291
+	echo '</script>';
1292 1292
 }
1293 1293
 
1294 1294
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1304,9 +1304,9 @@  discard block
 block discarded – undo
1304 1304
  */
1305 1305
 function geodir_admin_bar_site_menu($wp_admin_bar)
1306 1306
 {
1307
-    if (get_option("geodir_installed")) {
1308
-        $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1309
-    }
1307
+	if (get_option("geodir_installed")) {
1308
+		$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1309
+	}
1310 1310
 }
1311 1311
 
1312 1312
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1332,25 +1332,25 @@  discard block
 block discarded – undo
1332 1332
  */
1333 1333
 function geodir_store_sidebars()
1334 1334
 {
1335
-    global $geodir_sidebars;
1336
-    global $sidebars_widgets;
1337
-
1338
-    if (!is_array($sidebars_widgets))
1339
-        $sidebars_widgets = wp_get_sidebars_widgets();
1340
-    $geodir_old_sidebars = array();
1341
-
1342
-    if (is_array($geodir_sidebars)) {
1343
-        foreach ($geodir_sidebars as $val) {
1344
-            if (is_array($sidebars_widgets)) {
1345
-                if (array_key_exists($val, $sidebars_widgets))
1346
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1347
-                else
1348
-                    $geodir_old_sidebars[$val] = array();
1349
-            }
1350
-        }
1351
-    }
1352
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1353
-    geodir_option_version_backup('geodir_sidebars');
1335
+	global $geodir_sidebars;
1336
+	global $sidebars_widgets;
1337
+
1338
+	if (!is_array($sidebars_widgets))
1339
+		$sidebars_widgets = wp_get_sidebars_widgets();
1340
+	$geodir_old_sidebars = array();
1341
+
1342
+	if (is_array($geodir_sidebars)) {
1343
+		foreach ($geodir_sidebars as $val) {
1344
+			if (is_array($sidebars_widgets)) {
1345
+				if (array_key_exists($val, $sidebars_widgets))
1346
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1347
+				else
1348
+					$geodir_old_sidebars[$val] = array();
1349
+			}
1350
+		}
1351
+	}
1352
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1353
+	geodir_option_version_backup('geodir_sidebars');
1354 1354
 
1355 1355
 }
1356 1356
 
@@ -1364,34 +1364,34 @@  discard block
 block discarded – undo
1364 1364
  */
1365 1365
 function geodir_restore_sidebars()
1366 1366
 {
1367
-    global $sidebars_widgets;
1368
-
1369
-    if (!is_array($sidebars_widgets))
1370
-        $sidebars_widgets = wp_get_sidebars_widgets();
1371
-
1372
-    if (is_array($sidebars_widgets)) {
1373
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1374
-        if (is_array($geodir_old_sidebars)) {
1375
-            foreach ($geodir_old_sidebars as $key => $val) {
1376
-                //if(array_key_exists($key, $sidebars_widgets))
1377
-                {
1378
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1379
-                }
1367
+	global $sidebars_widgets;
1380 1368
 
1369
+	if (!is_array($sidebars_widgets))
1370
+		$sidebars_widgets = wp_get_sidebars_widgets();
1381 1371
 
1382
-            }
1383
-        }
1372
+	if (is_array($sidebars_widgets)) {
1373
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1374
+		if (is_array($geodir_old_sidebars)) {
1375
+			foreach ($geodir_old_sidebars as $key => $val) {
1376
+				//if(array_key_exists($key, $sidebars_widgets))
1377
+				{
1378
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1379
+				}
1384 1380
 
1385
-        // now clear all non geodiretory sidebars 
1386
-        foreach ($sidebars_widgets as $key => $val) {
1387
-            if (!array_key_exists($key, $geodir_old_sidebars)) {
1388
-                $sidebars_widgets[$key] = array();
1389
-            }
1390
-        }
1391
-    }
1392 1381
 
1393
-    update_option('sidebars_widgets', $sidebars_widgets);
1394
-    update_option('geodir_sidebars', '');
1382
+			}
1383
+		}
1384
+
1385
+		// now clear all non geodiretory sidebars 
1386
+		foreach ($sidebars_widgets as $key => $val) {
1387
+			if (!array_key_exists($key, $geodir_old_sidebars)) {
1388
+				$sidebars_widgets[$key] = array();
1389
+			}
1390
+		}
1391
+	}
1392
+
1393
+	update_option('sidebars_widgets', $sidebars_widgets);
1394
+	update_option('geodir_sidebars', '');
1395 1395
 }
1396 1396
 
1397 1397
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1404,9 +1404,9 @@  discard block
 block discarded – undo
1404 1404
  */
1405 1405
 function geodir_after_listing_post_gridview()
1406 1406
 {
1407
-    global $gridview_columns;
1407
+	global $gridview_columns;
1408 1408
 
1409
-    $gridview_columns = '';
1409
+	$gridview_columns = '';
1410 1410
 
1411 1411
 }
1412 1412
 
@@ -1434,11 +1434,11 @@  discard block
 block discarded – undo
1434 1434
  */
1435 1435
 function so_handle_038($url, $original_url, $_context)
1436 1436
 {
1437
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1438
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1439
-    }
1437
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1438
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1439
+	}
1440 1440
 
1441
-    return $url;
1441
+	return $url;
1442 1442
 }
1443 1443
 
1444 1444
 
@@ -1454,34 +1454,34 @@  discard block
 block discarded – undo
1454 1454
 function geodir_after_main_form_fields() {
1455 1455
 	global $gd_session;
1456 1456
 	
1457
-    if (get_option('geodir_accept_term_condition')) {
1458
-        global $post;
1459
-        $term_condition = '';
1460
-        if (isset($_REQUEST['backandedit'])) {
1461
-            $post = (object)$gd_session->get('listing');
1462
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1463
-        }
1464
-
1465
-        ?>
1457
+	if (get_option('geodir_accept_term_condition')) {
1458
+		global $post;
1459
+		$term_condition = '';
1460
+		if (isset($_REQUEST['backandedit'])) {
1461
+			$post = (object)$gd_session->get('listing');
1462
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1463
+		}
1464
+
1465
+		?>
1466 1466
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1467 1467
             <label>&nbsp;</label>
1468 1468
 
1469 1469
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1470 1470
 				<span style="display:block"> 
1471 1471
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1472
-                    echo 'checked="checked"';
1473
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1472
+					echo 'checked="checked"';
1473
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1474 1474
                        class="geodir_textfield" value="1"
1475 1475
                        style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1476 1476
 				</span>
1477 1477
             </div>
1478 1478
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1479
-                    _e($required_msg, 'geodirectory');
1480
-                } ?></span>
1479
+					_e($required_msg, 'geodirectory');
1480
+				} ?></span>
1481 1481
         </div>
1482 1482
     <?php
1483 1483
 
1484
-    }
1484
+	}
1485 1485
 }
1486 1486
 
1487 1487
 
@@ -1506,42 +1506,42 @@  discard block
 block discarded – undo
1506 1506
  */
1507 1507
 function geodir_detail_page_tab_is_display($is_display, $tab)
1508 1508
 {
1509
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1509
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1510 1510
 
1511
-    if ($tab == 'post_profile') {
1512
-        /** This action is documented in geodirectory_template_actions.php */
1513
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1511
+	if ($tab == 'post_profile') {
1512
+		/** This action is documented in geodirectory_template_actions.php */
1513
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1514 1514
         
1515
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1516
-            $is_display = false;
1517
-        }
1518
-    }
1515
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1516
+			$is_display = false;
1517
+		}
1518
+	}
1519 1519
     
1520
-    if ($tab == 'post_info')
1521
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1520
+	if ($tab == 'post_info')
1521
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1522 1522
 
1523
-    if ($tab == 'post_images')
1524
-        $is_display = (!empty($post_images)) ? true : false;
1523
+	if ($tab == 'post_images')
1524
+		$is_display = (!empty($post_images)) ? true : false;
1525 1525
 
1526
-    if ($tab == 'post_video')
1527
-        $is_display = (!empty($video)) ? true : false;
1526
+	if ($tab == 'post_video')
1527
+		$is_display = (!empty($video)) ? true : false;
1528 1528
 
1529
-    if ($tab == 'special_offers')
1530
-        $is_display = (!empty($special_offers)) ? true : false;
1529
+	if ($tab == 'special_offers')
1530
+		$is_display = (!empty($special_offers)) ? true : false;
1531 1531
 
1532
-    if ($tab == 'reviews')
1533
-        $is_display = (geodir_is_page('detail')) ? true : false;
1532
+	if ($tab == 'reviews')
1533
+		$is_display = (geodir_is_page('detail')) ? true : false;
1534 1534
 
1535
-    if ($tab == 'related_listing') {
1536
-       $message = __('No listings found which match your selection.', 'geodirectory');
1535
+	if ($tab == 'related_listing') {
1536
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1537 1537
        
1538
-       /** This action is documented in geodirectory-functions/template_functions.php */
1539
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1538
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1539
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1540 1540
        
1541
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1542
-    }
1541
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1542
+	}
1543 1543
 
1544
-    return $is_display;
1544
+	return $is_display;
1545 1545
 }
1546 1546
 
1547 1547
 
@@ -1557,17 +1557,17 @@  discard block
 block discarded – undo
1557 1557
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1558 1558
  */
1559 1559
 function geodir_changes_in_custom_fields_table() {
1560
-    global $wpdb, $plugin_prefix;
1560
+	global $wpdb, $plugin_prefix;
1561 1561
 	
1562 1562
 	// Remove unused virtual page
1563 1563
 	$listings_page_id = (int)get_option('geodir_listing_page');
1564 1564
 	if ($listings_page_id) {
1565 1565
 		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1566
-        delete_option('geodir_listing_page');
1566
+		delete_option('geodir_listing_page');
1567 1567
 	}
1568 1568
 
1569
-    // updated custom field table(add field to show custom field as a tab)
1570
-    /*if (!$wpdb->get_var("SHOW COLUMNS FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE field = 'show_as_tab'")) {
1569
+	// updated custom field table(add field to show custom field as a tab)
1570
+	/*if (!$wpdb->get_var("SHOW COLUMNS FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE field = 'show_as_tab'")) {
1571 1571
 		$wpdb->query("ALTER TABLE `".GEODIR_CUSTOM_FIELDS_TABLE."` ADD `show_as_tab` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `show_on_detail`");
1572 1572
 	}
1573 1573
 	
@@ -1575,66 +1575,66 @@  discard block
 block discarded – undo
1575 1575
 		$wpdb->query("ALTER TABLE `".GEODIR_CUSTOM_FIELDS_TABLE."` ADD `for_admin_use` ENUM( '0', '1' ) NOT NULL DEFAULT '0'");
1576 1576
 	}*/
1577 1577
 
1578
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1578
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1579 1579
 
1580
-        $post_types = geodir_get_posttypes();
1580
+		$post_types = geodir_get_posttypes();
1581 1581
 
1582
-        /*if(!$wpdb->get_var("SHOW COLUMNS FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE field = 'is_admin'"))
1582
+		/*if(!$wpdb->get_var("SHOW COLUMNS FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE field = 'is_admin'"))
1583 1583
 					$wpdb->query("ALTER TABLE `".GEODIR_CUSTOM_FIELDS_TABLE."` ADD `is_admin` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `is_default`");*/
1584 1584
 
1585
-        $wpdb->query(
1586
-            $wpdb->prepare(
1587
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1588
-                array('1', '1', 'admin')
1589
-            )
1590
-        );
1585
+		$wpdb->query(
1586
+			$wpdb->prepare(
1587
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1588
+				array('1', '1', 'admin')
1589
+			)
1590
+		);
1591 1591
 
1592 1592
 
1593
-        /* --- terms meta value set --- */
1593
+		/* --- terms meta value set --- */
1594 1594
 
1595
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1595
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1596 1596
 
1597
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1597
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1598 1598
 
1599
-        if (!empty($options_data)) {
1599
+		if (!empty($options_data)) {
1600 1600
 
1601
-            foreach ($options_data as $optobj) {
1601
+			foreach ($options_data as $optobj) {
1602 1602
 
1603
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1603
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1604 1604
 
1605
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1605
+				$taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1606 1606
 
1607
-                if (!empty($taxonomies_data)) {
1607
+				if (!empty($taxonomies_data)) {
1608 1608
 
1609
-                    foreach ($taxonomies_data as $taxobj) {
1609
+					foreach ($taxonomies_data as $taxobj) {
1610 1610
 
1611
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1612
-                        $post_type = $taxObject->object_type[0];
1611
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1612
+						$post_type = $taxObject->object_type[0];
1613 1613
 
1614
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1614
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1615 1615
 
1616
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1616
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1617 1617
 
1618
-                        if ($duplicate_data) {
1618
+						if ($duplicate_data) {
1619 1619
 
1620
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1620
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1621 1621
 
1622
-                        } else {
1622
+						} else {
1623 1623
 
1624
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1624
+							$wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1625 1625
 
1626
-                        }
1626
+						}
1627 1627
 
1628
-                    }
1628
+					}
1629 1629
 
1630
-                }
1630
+				}
1631 1631
 
1632
-            }
1633
-        }
1632
+			}
1633
+		}
1634 1634
 
1635
-        update_option('geodir_changes_in_custom_fields_table', '1');
1635
+		update_option('geodir_changes_in_custom_fields_table', '1');
1636 1636
 
1637
-    }
1637
+	}
1638 1638
 
1639 1639
 }
1640 1640
 
@@ -1653,24 +1653,24 @@  discard block
 block discarded – undo
1653 1653
 function geodir_location_slug_check($slug)
1654 1654
 {
1655 1655
 
1656
-    global $wpdb, $table_prefix;
1656
+	global $wpdb, $table_prefix;
1657 1657
 
1658
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1658
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1659 1659
 
1660
-    if ($slug_exists) {
1660
+	if ($slug_exists) {
1661 1661
 
1662
-        $suffix = 1;
1663
-        do {
1664
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1665
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1666
-            $suffix++;
1667
-        } while ($location_slug_check && $suffix < 100);
1662
+		$suffix = 1;
1663
+		do {
1664
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1665
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1666
+			$suffix++;
1667
+		} while ($location_slug_check && $suffix < 100);
1668 1668
 
1669
-        $slug = $alt_location_name;
1669
+		$slug = $alt_location_name;
1670 1670
 
1671
-    }
1671
+	}
1672 1672
 
1673
-    return $slug;
1673
+	return $slug;
1674 1674
 
1675 1675
 }
1676 1676
 
@@ -1695,42 +1695,42 @@  discard block
 block discarded – undo
1695 1695
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1696 1696
 {
1697 1697
 
1698
-    global $wpdb, $plugin_prefix, $table_prefix;
1698
+	global $wpdb, $plugin_prefix, $table_prefix;
1699 1699
 
1700
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1700
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1701 1701
 
1702
-    $slug = $tern_data->slug;
1702
+	$slug = $tern_data->slug;
1703 1703
 
1704
-    /**
1705
-     * Filter if a term slug exists.
1706
-     *
1707
-     * @since 1.0.0
1708
-     * @package GeoDirectory
1709
-     * @param bool $bool Default: false.
1710
-     * @param string $slug The term slug.
1711
-     * @param int $term_id The term ID.
1712
-     */
1713
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1704
+	/**
1705
+	 * Filter if a term slug exists.
1706
+	 *
1707
+	 * @since 1.0.0
1708
+	 * @package GeoDirectory
1709
+	 * @param bool $bool Default: false.
1710
+	 * @param string $slug The term slug.
1711
+	 * @param int $term_id The term ID.
1712
+	 */
1713
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1714 1714
 
1715
-    if ($slug_exists) {
1715
+	if ($slug_exists) {
1716 1716
 
1717
-        $suffix = 1;
1718
-        do {
1719
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1717
+		$suffix = 1;
1718
+		do {
1719
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1720 1720
 
1721
-            /** This action is documented in geodirectory_hooks_actions.php */
1722
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1721
+			/** This action is documented in geodirectory_hooks_actions.php */
1722
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1723 1723
 
1724
-            $suffix++;
1725
-        } while ($term_slug_check && $suffix < 100);
1724
+			$suffix++;
1725
+		} while ($term_slug_check && $suffix < 100);
1726 1726
 
1727
-        $slug = $new_slug;
1727
+		$slug = $new_slug;
1728 1728
 
1729
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1729
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1730 1730
 
1731
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1731
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1732 1732
 
1733
-    }
1733
+	}
1734 1734
 	
1735 1735
 	// Update tag in detail table.
1736 1736
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1771,21 +1771,21 @@  discard block
 block discarded – undo
1771 1771
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1772 1772
 {
1773 1773
 
1774
-    global $wpdb, $table_prefix;
1774
+	global $wpdb, $table_prefix;
1775 1775
 
1776
-    $default_location = geodir_get_default_location();
1776
+	$default_location = geodir_get_default_location();
1777 1777
 
1778
-    $country_slug = $default_location->country_slug;
1779
-    $region_slug = $default_location->region_slug;
1780
-    $city_slug = $default_location->city_slug;
1778
+	$country_slug = $default_location->country_slug;
1779
+	$region_slug = $default_location->region_slug;
1780
+	$city_slug = $default_location->city_slug;
1781 1781
 
1782
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1783
-        return $slug_exists = true;
1782
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1783
+		return $slug_exists = true;
1784 1784
 
1785
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1786
-        return $slug_exists = true;
1785
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1786
+		return $slug_exists = true;
1787 1787
 
1788
-    return $slug_exists;
1788
+	return $slug_exists;
1789 1789
 }
1790 1790
 
1791 1791
 
@@ -1804,75 +1804,75 @@  discard block
 block discarded – undo
1804 1804
  */
1805 1805
 function geodir_custom_page_title($title = '', $sep = '')
1806 1806
 {
1807
-    global $wp;
1808
-    if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1809
-        return $title;
1810
-    }
1807
+	global $wp;
1808
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1809
+		return $title;
1810
+	}
1811 1811
 
1812
-    if ($sep == '') {
1813
-        /**
1814
-         * Filter the page title separator.
1815
-         *
1816
-         * @since 1.0.0
1817
-         * @package GeoDirectory
1818
-         * @param string $sep The separator, default: `|`.
1819
-         */
1820
-        $sep = apply_filters('geodir_page_title_separator', '|');
1821
-    }
1812
+	if ($sep == '') {
1813
+		/**
1814
+		 * Filter the page title separator.
1815
+		 *
1816
+		 * @since 1.0.0
1817
+		 * @package GeoDirectory
1818
+		 * @param string $sep The separator, default: `|`.
1819
+		 */
1820
+		$sep = apply_filters('geodir_page_title_separator', '|');
1821
+	}
1822 1822
 
1823 1823
 
1824
-    $gd_page = '';
1825
-    if(geodir_is_page('home')){
1826
-        $gd_page = 'home';
1827
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1828
-    }
1829
-    elseif(geodir_is_page('detail')){
1830
-        $gd_page = 'detail';
1831
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1832
-    }
1833
-    elseif(geodir_is_page('pt')){
1834
-        $gd_page = 'pt';
1835
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1836
-    }
1837
-    elseif(geodir_is_page('listing')){
1838
-        $gd_page = 'listing';
1839
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1840
-    }
1841
-    elseif(geodir_is_page('location')){
1842
-        $gd_page = 'location';
1843
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1844
-    }
1845
-    elseif(geodir_is_page('search')){
1846
-        $gd_page = 'search';
1847
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1848
-    }
1849
-    elseif(geodir_is_page('add-listing')){
1850
-        $gd_page = 'add-listing';
1851
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1852
-    }
1853
-    elseif(geodir_is_page('author')){
1854
-        $gd_page = 'author';
1855
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1856
-    }
1857
-    elseif(geodir_is_page('login')){
1858
-        $gd_page = 'login';
1859
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1860
-    }
1861
-    elseif(geodir_is_page('listing-success')){
1862
-        $gd_page = 'listing-success';
1863
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1864
-    }
1824
+	$gd_page = '';
1825
+	if(geodir_is_page('home')){
1826
+		$gd_page = 'home';
1827
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1828
+	}
1829
+	elseif(geodir_is_page('detail')){
1830
+		$gd_page = 'detail';
1831
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1832
+	}
1833
+	elseif(geodir_is_page('pt')){
1834
+		$gd_page = 'pt';
1835
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1836
+	}
1837
+	elseif(geodir_is_page('listing')){
1838
+		$gd_page = 'listing';
1839
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1840
+	}
1841
+	elseif(geodir_is_page('location')){
1842
+		$gd_page = 'location';
1843
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1844
+	}
1845
+	elseif(geodir_is_page('search')){
1846
+		$gd_page = 'search';
1847
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1848
+	}
1849
+	elseif(geodir_is_page('add-listing')){
1850
+		$gd_page = 'add-listing';
1851
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1852
+	}
1853
+	elseif(geodir_is_page('author')){
1854
+		$gd_page = 'author';
1855
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1856
+	}
1857
+	elseif(geodir_is_page('login')){
1858
+		$gd_page = 'login';
1859
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1860
+	}
1861
+	elseif(geodir_is_page('listing-success')){
1862
+		$gd_page = 'listing-success';
1863
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1864
+	}
1865 1865
 
1866 1866
 
1867
-    /**
1868
-     * Filter page meta title to replace variables.
1869
-     *
1870
-     * @since 1.5.4
1871
-     * @param string $title The page title including variables.
1872
-     * @param string $gd_page The GeoDirectory page type if any.
1873
-     * @param string $sep The title separator symbol.
1874
-     */
1875
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1867
+	/**
1868
+	 * Filter page meta title to replace variables.
1869
+	 *
1870
+	 * @since 1.5.4
1871
+	 * @param string $title The page title including variables.
1872
+	 * @param string $gd_page The GeoDirectory page type if any.
1873
+	 * @param string $sep The title separator symbol.
1874
+	 */
1875
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1876 1876
 
1877 1877
 }
1878 1878
 
@@ -1888,33 +1888,33 @@  discard block
 block discarded – undo
1888 1888
 function geodir_set_post_attachment()
1889 1889
 {
1890 1890
 
1891
-    if (!get_option('geodir_set_post_attachments')) {
1891
+	if (!get_option('geodir_set_post_attachments')) {
1892 1892
 
1893
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1894
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1893
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1894
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1895 1895
 
1896
-        $all_postypes = geodir_get_posttypes();
1896
+		$all_postypes = geodir_get_posttypes();
1897 1897
 
1898
-        $args = array(
1899
-            'posts_per_page' => -1,
1900
-            'post_type' => $all_postypes,
1901
-            'post_status' => 'publish');
1898
+		$args = array(
1899
+			'posts_per_page' => -1,
1900
+			'post_type' => $all_postypes,
1901
+			'post_status' => 'publish');
1902 1902
 
1903
-        $posts_array = get_posts($args);
1903
+		$posts_array = get_posts($args);
1904 1904
 
1905
-        if (!empty($posts_array)) {
1905
+		if (!empty($posts_array)) {
1906 1906
 
1907
-            foreach ($posts_array as $post) {
1907
+			foreach ($posts_array as $post) {
1908 1908
 
1909
-                geodir_set_wp_featured_image($post->ID);
1909
+				geodir_set_wp_featured_image($post->ID);
1910 1910
 
1911
-            }
1911
+			}
1912 1912
 
1913
-        }
1913
+		}
1914 1914
 
1915
-        update_option('geodir_set_post_attachments', '1');
1915
+		update_option('geodir_set_post_attachments', '1');
1916 1916
 
1917
-    }
1917
+	}
1918 1918
 
1919 1919
 }
1920 1920
 
@@ -1931,19 +1931,19 @@  discard block
 block discarded – undo
1931 1931
 function geodir_remove_url_seperator()
1932 1932
 {
1933 1933
 
1934
-    if (!get_option('geodir_remove_url_seperator')) {
1934
+	if (!get_option('geodir_remove_url_seperator')) {
1935 1935
 
1936
-        if (get_option('geodir_listingurl_separator'))
1937
-            delete_option('geodir_listingurl_separator');
1936
+		if (get_option('geodir_listingurl_separator'))
1937
+			delete_option('geodir_listingurl_separator');
1938 1938
 
1939
-        if (get_option('geodir_detailurl_separator'))
1940
-            delete_option('geodir_detailurl_separator');
1939
+		if (get_option('geodir_detailurl_separator'))
1940
+			delete_option('geodir_detailurl_separator');
1941 1941
 
1942
-        flush_rewrite_rules(false);
1942
+		flush_rewrite_rules(false);
1943 1943
 
1944
-        update_option('geodir_remove_url_seperator', '1');
1944
+		update_option('geodir_remove_url_seperator', '1');
1945 1945
 
1946
-    }
1946
+	}
1947 1947
 
1948 1948
 }
1949 1949
 
@@ -1959,39 +1959,39 @@  discard block
 block discarded – undo
1959 1959
  */
1960 1960
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
1961 1961
 {
1962
-    foreach ($permalink_arr as $key => $value) {
1962
+	foreach ($permalink_arr as $key => $value) {
1963 1963
 
1964
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1965
-            unset($permalink_arr[$key]);
1964
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1965
+			unset($permalink_arr[$key]);
1966 1966
 
1967
-    }
1967
+	}
1968 1968
 
1969
-    return $permalink_arr;
1969
+	return $permalink_arr;
1970 1970
 
1971 1971
 }
1972 1972
 
1973 1973
 if (!is_admin()) {
1974
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
1974
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
1975 1975
 }
1976 1976
 /**
1977
- * Set status from draft to publish.
1978
- *
1979
- * @since 1.0.0
1980
- * @package GeoDirectory
1981
- * @global object $wp WordPress object.
1982
- * @param object $post Post object.
1983
- * @return object Modified post object.
1984
- */
1977
+	 * Set status from draft to publish.
1978
+	 *
1979
+	 * @since 1.0.0
1980
+	 * @package GeoDirectory
1981
+	 * @global object $wp WordPress object.
1982
+	 * @param object $post Post object.
1983
+	 * @return object Modified post object.
1984
+	 */
1985 1985
 function geodir_set_status_draft_to_publish_for_own_post($post)
1986 1986
 {
1987
-    global $wp;
1988
-    $user_id = get_current_user_id();
1987
+	global $wp;
1988
+	$user_id = get_current_user_id();
1989 1989
 
1990
-    if (!empty($post) && $post[0]->post_author == $user_id) {
1991
-        $post[0]->post_status = 'publish';
1992
-    }
1993
-    //print_r($post) ;
1994
-    return $post;
1990
+	if (!empty($post) && $post[0]->post_author == $user_id) {
1991
+		$post[0]->post_status = 'publish';
1992
+	}
1993
+	//print_r($post) ;
1994
+	return $post;
1995 1995
 }
1996 1996
 
1997 1997
 
@@ -2083,33 +2083,33 @@  discard block
 block discarded – undo
2083 2083
  */
2084 2084
 function geodir_detail_page_tab_headings_change($tabs_arr)
2085 2085
 {
2086
-    global $wpdb;
2086
+	global $wpdb;
2087 2087
 
2088
-    $post_type = geodir_get_current_posttype();
2088
+	$post_type = geodir_get_current_posttype();
2089 2089
 
2090
-    $all_postypes = geodir_get_posttypes();
2090
+	$all_postypes = geodir_get_posttypes();
2091 2091
 
2092
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2092
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2093 2093
 
2094
-        if (array_key_exists('post_video', $tabs_arr)) {
2094
+		if (array_key_exists('post_video', $tabs_arr)) {
2095 2095
 
2096
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2096
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2097 2097
 
2098
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2099
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2100
-        }
2098
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2099
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2100
+		}
2101 2101
 
2102
-        if (array_key_exists('special_offers', $tabs_arr)) {
2102
+		if (array_key_exists('special_offers', $tabs_arr)) {
2103 2103
 
2104
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2104
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2105 2105
 
2106
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2107
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2108
-        }
2106
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2107
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2108
+		}
2109 2109
 
2110
-    }
2110
+	}
2111 2111
 
2112
-    return $tabs_arr;
2112
+	return $tabs_arr;
2113 2113
 
2114 2114
 }
2115 2115
 
@@ -2122,10 +2122,10 @@  discard block
 block discarded – undo
2122 2122
  */
2123 2123
 function geodir_remove_template_redirect_actions()
2124 2124
 {
2125
-    if (geodir_is_page('login')){
2126
-        remove_all_actions('template_redirect');
2127
-        remove_action('init', 'avia_modify_front', 10);
2128
-    }
2125
+	if (geodir_is_page('login')){
2126
+		remove_all_actions('template_redirect');
2127
+		remove_action('init', 'avia_modify_front', 10);
2128
+	}
2129 2129
 }
2130 2130
 
2131 2131
 
@@ -2147,51 +2147,51 @@  discard block
 block discarded – undo
2147 2147
 function geodirectory_before_featured_image_delete($attachment_id)
2148 2148
 {
2149 2149
 
2150
-    global $wpdb, $plugin_prefix;
2150
+	global $wpdb, $plugin_prefix;
2151 2151
 
2152
-    $post_id = get_post_field('post_parent', $attachment_id);
2152
+	$post_id = get_post_field('post_parent', $attachment_id);
2153 2153
 
2154
-    $attachment_url = wp_get_attachment_url($attachment_id);
2154
+	$attachment_url = wp_get_attachment_url($attachment_id);
2155 2155
 
2156
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2156
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2157 2157
 
2158
-        $post_type = get_post_type($post_id);
2158
+		$post_type = get_post_type($post_id);
2159 2159
 
2160
-        $all_postypes = geodir_get_posttypes();
2160
+		$all_postypes = geodir_get_posttypes();
2161 2161
 
2162
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2163
-            return false;
2162
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2163
+			return false;
2164 2164
 
2165
-        $uploads = wp_upload_dir();
2165
+		$uploads = wp_upload_dir();
2166 2166
 
2167
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2167
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2168 2168
 
2169
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2169
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2170 2170
 
2171
-        $wpdb->query(
2172
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2173
-                array($post_id, $split_img_file_path)
2174
-            )
2175
-        );
2171
+		$wpdb->query(
2172
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2173
+				array($post_id, $split_img_file_path)
2174
+			)
2175
+		);
2176 2176
 
2177
-        $attachment_data = $wpdb->get_row(
2178
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2179
-                array($post_id)
2180
-            )
2181
-        );
2177
+		$attachment_data = $wpdb->get_row(
2178
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2179
+				array($post_id)
2180
+			)
2181
+		);
2182 2182
 
2183
-        if (!empty($attachment_data)) {
2184
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2185
-        }
2183
+		if (!empty($attachment_data)) {
2184
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2185
+		}
2186 2186
 
2187 2187
 
2188
-        $table_name = $plugin_prefix . $post_type . '_detail';
2188
+		$table_name = $plugin_prefix . $post_type . '_detail';
2189 2189
 
2190
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2190
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2191 2191
 
2192
-        geodir_set_wp_featured_image($post_id);
2192
+		geodir_set_wp_featured_image($post_id);
2193 2193
 
2194
-    }
2194
+	}
2195 2195
 
2196 2196
 }
2197 2197
 
@@ -2209,80 +2209,80 @@  discard block
 block discarded – undo
2209 2209
 function geodir_temp_set_post_attachment()
2210 2210
 {
2211 2211
 
2212
-    global $wpdb, $plugin_prefix;
2212
+	global $wpdb, $plugin_prefix;
2213 2213
 
2214
-    $all_postypes = geodir_get_posttypes();
2214
+	$all_postypes = geodir_get_posttypes();
2215 2215
 
2216
-    foreach ($all_postypes as $posttype) {
2216
+	foreach ($all_postypes as $posttype) {
2217 2217
 
2218
-        $tablename = $plugin_prefix . $posttype . '_detail';
2218
+		$tablename = $plugin_prefix . $posttype . '_detail';
2219 2219
 
2220
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2220
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2221 2221
 
2222
-        if (!empty($get_post_data)) {
2222
+		if (!empty($get_post_data)) {
2223 2223
 
2224
-            foreach ($get_post_data as $data) {
2224
+			foreach ($get_post_data as $data) {
2225 2225
 
2226
-                $post_id = $data->post_id;
2226
+				$post_id = $data->post_id;
2227 2227
 
2228
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2228
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2229 2229
 
2230
-                if (!empty($attachment_data)) {
2230
+				if (!empty($attachment_data)) {
2231 2231
 
2232
-                    foreach ($attachment_data as $attach) {
2232
+					foreach ($attachment_data as $attach) {
2233 2233
 
2234
-                        $file_info = pathinfo($attach->file);
2234
+						$file_info = pathinfo($attach->file);
2235 2235
 
2236
-                        $sub_dir = '';
2237
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2238
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2236
+						$sub_dir = '';
2237
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2238
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2239 2239
 
2240
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2241
-                        $uploads_baseurl = $uploads['baseurl'];
2242
-                        $uploads_path = $uploads['basedir'];
2240
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2241
+						$uploads_baseurl = $uploads['baseurl'];
2242
+						$uploads_path = $uploads['basedir'];
2243 2243
 
2244
-                        $file_name = $file_info['basename'];
2244
+						$file_name = $file_info['basename'];
2245 2245
 
2246
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2246
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2247 2247
 
2248
-                        if (!file_exists($img_arr['path'])) {
2248
+						if (!file_exists($img_arr['path'])) {
2249 2249
 
2250
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2250
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2251 2251
 
2252
-                        }
2252
+						}
2253 2253
 
2254
-                    }
2254
+					}
2255 2255
 
2256
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2256
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2257 2257
 
2258
-                    if (!empty($attachment_data)) {
2258
+					if (!empty($attachment_data)) {
2259 2259
 
2260
-                        if ($attachment_data->ID)
2261
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2260
+						if ($attachment_data->ID)
2261
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2262 2262
 
2263
-                    } else {
2263
+					} else {
2264 2264
 
2265
-                        if (has_post_thumbnail($post_id)) {
2265
+						if (has_post_thumbnail($post_id)) {
2266 2266
 
2267
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2267
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2268 2268
 
2269
-                            wp_delete_attachment($post_thumbnail_id);
2269
+							wp_delete_attachment($post_thumbnail_id);
2270 2270
 
2271
-                        }
2271
+						}
2272 2272
 
2273
-                    }
2273
+					}
2274 2274
 
2275
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2275
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2276 2276
 
2277
-                    geodir_set_wp_featured_image($post_id);
2277
+					geodir_set_wp_featured_image($post_id);
2278 2278
 
2279
-                }
2279
+				}
2280 2280
 
2281
-            }
2281
+			}
2282 2282
 
2283
-        }
2283
+		}
2284 2284
 
2285
-    }
2285
+	}
2286 2286
 
2287 2287
 }
2288 2288
 
@@ -2300,9 +2300,9 @@  discard block
 block discarded – undo
2300 2300
 function geodir_default_rating_star_icon()
2301 2301
 {
2302 2302
 
2303
-    if (!get_option('geodir_default_rating_star_icon')) {
2304
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2305
-    }
2303
+	if (!get_option('geodir_default_rating_star_icon')) {
2304
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2305
+	}
2306 2306
 
2307 2307
 }
2308 2308
 
@@ -2320,24 +2320,24 @@  discard block
 block discarded – undo
2320 2320
  */
2321 2321
 function geodir_user_post_listing_count()
2322 2322
 {
2323
-    global $wpdb, $plugin_prefix, $current_user;
2323
+	global $wpdb, $plugin_prefix, $current_user;
2324 2324
 
2325
-    $user_id = $current_user->ID;
2326
-    $all_postypes = geodir_get_posttypes();
2327
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2325
+	$user_id = $current_user->ID;
2326
+	$all_postypes = geodir_get_posttypes();
2327
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2328 2328
 
2329
-    $user_listing = array();
2330
-    if (is_array($all_posts) && !empty($all_posts)) {
2331
-        foreach ($all_posts as $ptype) {
2332
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2329
+	$user_listing = array();
2330
+	if (is_array($all_posts) && !empty($all_posts)) {
2331
+		foreach ($all_posts as $ptype) {
2332
+			$total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2333 2333
 
2334
-            if ($total_posts > 0) {
2335
-                $user_listing[$ptype] = $total_posts;
2336
-            }
2337
-        }
2338
-    }
2334
+			if ($total_posts > 0) {
2335
+				$user_listing[$ptype] = $total_posts;
2336
+			}
2337
+		}
2338
+	}
2339 2339
 
2340
-    return $user_listing;
2340
+	return $user_listing;
2341 2341
 }
2342 2342
 
2343 2343
 
@@ -2354,27 +2354,27 @@  discard block
 block discarded – undo
2354 2354
  */
2355 2355
 function geodir_user_favourite_listing_count()
2356 2356
 {
2357
-    global $wpdb, $plugin_prefix, $current_user;
2357
+	global $wpdb, $plugin_prefix, $current_user;
2358 2358
 
2359
-    $user_id = $current_user->ID;
2360
-    $all_postypes = geodir_get_posttypes();
2361
-    $user_favorites = get_user_meta($user_id, 'gd_user_favourite_post', true);
2362
-    $all_posts = get_option('geodir_favorite_link_user_dashboard');
2359
+	$user_id = $current_user->ID;
2360
+	$all_postypes = geodir_get_posttypes();
2361
+	$user_favorites = get_user_meta($user_id, 'gd_user_favourite_post', true);
2362
+	$all_posts = get_option('geodir_favorite_link_user_dashboard');
2363 2363
 
2364
-    $user_listing = array();
2365
-    if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) {
2366
-        $user_favorites = "'" . implode("','", $user_favorites) . "'";
2364
+	$user_listing = array();
2365
+	if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) {
2366
+		$user_favorites = "'" . implode("','", $user_favorites) . "'";
2367 2367
 
2368
-        foreach ($all_posts as $ptype) {
2369
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE  post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")");
2368
+		foreach ($all_posts as $ptype) {
2369
+			$total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE  post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")");
2370 2370
 
2371
-            if ($total_posts > 0) {
2372
-                $user_listing[$ptype] = $total_posts;
2373
-            }
2374
-        }
2375
-    }
2371
+			if ($total_posts > 0) {
2372
+				$user_listing[$ptype] = $total_posts;
2373
+			}
2374
+		}
2375
+	}
2376 2376
 
2377
-    return $user_listing;
2377
+	return $user_listing;
2378 2378
 }
2379 2379
 
2380 2380
 add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_page_custom_field_tab');
@@ -2391,584 +2391,584 @@  discard block
 block discarded – undo
2391 2391
  */
2392 2392
 function geodir_detail_page_custom_field_tab($tabs_arr)
2393 2393
 {
2394
-    global $post;
2395
-
2396
-    $post_type = geodir_get_current_posttype();
2397
-    $all_postypes = geodir_get_posttypes();
2398
-
2399
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2400
-        $package_info = array();
2401
-        $package_info = geodir_post_package_info($package_info, $post);
2402
-        $post_package_id = $package_info->pid;
2403
-        $fields_location = 'detail';
2404
-
2405
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'default', $post_type, $fields_location);
2406
-        if (!empty($custom_fields)) {
2407
-            $parse_custom_fields = array();
2408
-            foreach ($custom_fields as $field) {
2409
-                $field = stripslashes_deep($field); // strip slashes
2394
+	global $post;
2395
+
2396
+	$post_type = geodir_get_current_posttype();
2397
+	$all_postypes = geodir_get_posttypes();
2398
+
2399
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2400
+		$package_info = array();
2401
+		$package_info = geodir_post_package_info($package_info, $post);
2402
+		$post_package_id = $package_info->pid;
2403
+		$fields_location = 'detail';
2404
+
2405
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'default', $post_type, $fields_location);
2406
+		if (!empty($custom_fields)) {
2407
+			$parse_custom_fields = array();
2408
+			foreach ($custom_fields as $field) {
2409
+				$field = stripslashes_deep($field); // strip slashes
2410 2410
                 
2411
-                $type = $field;
2412
-                $field_name = $field['htmlvar_name'];
2413
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->$field_name) && isset($_REQUEST[$field_name])) {
2414
-                    $post->$field_name = $_REQUEST[$field_name];
2415
-                }
2416
-
2417
-                if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->$field_name) && $post->$field_name != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2418
-                    if ($type['type'] == 'datepicker' && ($post->$type['htmlvar_name'] == '' || $post->$type['htmlvar_name'] == '0000-00-00')) {
2419
-                        continue;
2420
-                    }
2421
-
2422
-                    $parse_custom_fields[] = $field;
2423
-                }
2424
-            }
2425
-            $custom_fields = $parse_custom_fields;
2426
-        }
2427
-
2428
-        if (!empty($custom_fields)) {
2429
-            $field_set_start = 0;
2430
-            $fieldset_count = 0;
2431
-            $fieldset = '';
2432
-            $total_fields = count($custom_fields);
2433
-            $count_field = 0;
2434
-            $fieldset_arr = array();
2435
-            $i = 0;
2436
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2437
-
2438
-            foreach ($custom_fields as $field) {
2439
-                $count_field++;
2440
-                $field_name = $field['htmlvar_name'];
2441
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->$field_name) && isset($_REQUEST[$field_name])) {
2442
-                    $post->$field_name = $_REQUEST[$field_name];
2443
-                }
2444
-
2445
-                if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->$field_name) && $post->$field_name != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2446
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2447
-                    $site_title = trim($field['site_title']);
2448
-                    $type = $field;
2449
-                    $html = '';
2450
-                    $html_var = $field_name;
2451
-                    $field_icon = '';
2452
-                    $variables_array = array();
2453
-
2454
-                    if ($type['type'] == 'datepicker' && ($post->$type['htmlvar_name'] == '' || $post->$type['htmlvar_name'] == '0000-00-00')) {
2455
-                        continue;
2456
-                    }
2457
-
2458
-                    if ($type['type'] != 'fieldset') {
2459
-                        $i++;
2460
-                        $variables_array['post_id'] = $post->ID;
2461
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2462
-                        $variables_array['value'] = '';
2463
-                        $variables_array['value'] = $post->$type['htmlvar_name'];
2464
-                    }
2465
-
2466
-                    if (strpos($type['field_icon'], 'http') !== false) {
2467
-                        $field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2468
-                    } elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2469
-                        $field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2470
-                    }
2411
+				$type = $field;
2412
+				$field_name = $field['htmlvar_name'];
2413
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->$field_name) && isset($_REQUEST[$field_name])) {
2414
+					$post->$field_name = $_REQUEST[$field_name];
2415
+				}
2416
+
2417
+				if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->$field_name) && $post->$field_name != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2418
+					if ($type['type'] == 'datepicker' && ($post->$type['htmlvar_name'] == '' || $post->$type['htmlvar_name'] == '0000-00-00')) {
2419
+						continue;
2420
+					}
2421
+
2422
+					$parse_custom_fields[] = $field;
2423
+				}
2424
+			}
2425
+			$custom_fields = $parse_custom_fields;
2426
+		}
2471 2427
 
2472
-                    switch ($type['type']) {
2473
-                        case 'fieldset': {
2474
-                            $i = 0;
2475
-                            $fieldset_count++;
2476
-                            $field_set_start = 1;
2477
-                            $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2478
-                            $fieldset_arr[$fieldset_count]['label'] = $label;
2479
-                        }
2480
-                            break;
2481
-                        case 'url': {
2482
-                            if (strpos($field_icon, 'http') !== false) {
2483
-                                $field_icon_af = '';
2484
-                            } elseif ($field_icon == '') {
2485
-
2486
-                                if ($type['name'] == 'geodir_facebook') {
2487
-                                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
2488
-                                } elseif ($type['name'] == 'geodir_twitter') {
2489
-                                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
2490
-                                } else {
2491
-                                    $field_icon_af = '<i class="fa fa-link"></i>';
2492
-                                }
2493
-
2494
-                            } else {
2495
-                                $field_icon_af = $field_icon;
2496
-                                $field_icon = '';
2497
-                            }
2428
+		if (!empty($custom_fields)) {
2429
+			$field_set_start = 0;
2430
+			$fieldset_count = 0;
2431
+			$fieldset = '';
2432
+			$total_fields = count($custom_fields);
2433
+			$count_field = 0;
2434
+			$fieldset_arr = array();
2435
+			$i = 0;
2436
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2437
+
2438
+			foreach ($custom_fields as $field) {
2439
+				$count_field++;
2440
+				$field_name = $field['htmlvar_name'];
2441
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->$field_name) && isset($_REQUEST[$field_name])) {
2442
+					$post->$field_name = $_REQUEST[$field_name];
2443
+				}
2444
+
2445
+				if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->$field_name) && $post->$field_name != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2446
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2447
+					$site_title = trim($field['site_title']);
2448
+					$type = $field;
2449
+					$html = '';
2450
+					$html_var = $field_name;
2451
+					$field_icon = '';
2452
+					$variables_array = array();
2453
+
2454
+					if ($type['type'] == 'datepicker' && ($post->$type['htmlvar_name'] == '' || $post->$type['htmlvar_name'] == '0000-00-00')) {
2455
+						continue;
2456
+					}
2457
+
2458
+					if ($type['type'] != 'fieldset') {
2459
+						$i++;
2460
+						$variables_array['post_id'] = $post->ID;
2461
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2462
+						$variables_array['value'] = '';
2463
+						$variables_array['value'] = $post->$type['htmlvar_name'];
2464
+					}
2465
+
2466
+					if (strpos($type['field_icon'], 'http') !== false) {
2467
+						$field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2468
+					} elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2469
+						$field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2470
+					}
2471
+
2472
+					switch ($type['type']) {
2473
+						case 'fieldset': {
2474
+							$i = 0;
2475
+							$fieldset_count++;
2476
+							$field_set_start = 1;
2477
+							$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2478
+							$fieldset_arr[$fieldset_count]['label'] = $label;
2479
+						}
2480
+							break;
2481
+						case 'url': {
2482
+							if (strpos($field_icon, 'http') !== false) {
2483
+								$field_icon_af = '';
2484
+							} elseif ($field_icon == '') {
2485
+
2486
+								if ($type['name'] == 'geodir_facebook') {
2487
+									$field_icon_af = '<i class="fa fa-facebook-square"></i>';
2488
+								} elseif ($type['name'] == 'geodir_twitter') {
2489
+									$field_icon_af = '<i class="fa fa-twitter-square"></i>';
2490
+								} else {
2491
+									$field_icon_af = '<i class="fa fa-link"></i>';
2492
+								}
2493
+
2494
+							} else {
2495
+								$field_icon_af = $field_icon;
2496
+								$field_icon = '';
2497
+							}
2498 2498
                             
2499
-                            $a_url = geodir_parse_custom_field_url($post->$type['htmlvar_name']);
2500
-
2501
-                            $website = !empty($a_url['url']) ? $a_url['url'] : '';
2502
-                            $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2503
-                            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2504
-
2505
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2506
-
2507
-                            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
2508
-                            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2509
-
2510
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .
2511
-                                /**
2512
-                                 * Filer the custom field website name.
2513
-                                 *
2514
-                                 * @since 1.0.0
2515
-                                 * @param string $title The field name default: "Website".
2516
-                                 * @param string $website The website address.
2517
-                                 * @param int $post->ID The post ID.
2518
-                                 */
2519
-                                apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
2520
-                        }
2521
-                            break;
2522
-                        case 'phone': {
2523
-                            if (strpos($field_icon, 'http') !== false) {
2524
-                                $field_icon_af = '';
2525
-                            } elseif ($field_icon == '') {
2526
-                                $field_icon_af = '<i class="fa fa-phone"></i>';
2527
-                            } else {
2528
-                                $field_icon_af = $field_icon;
2529
-                                $field_icon = '';
2530
-                            }
2531
-
2532
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2533
-
2534
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;
2535
-                            if ($field_set_start == 1 && $site_title != '') {
2536
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2537
-                            }
2538
-                            $html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2539
-                        }
2540
-                            break;
2541
-                        case 'time': {
2542
-                            $value = '';
2543
-                            if ($post->$type['htmlvar_name'] != '')
2544
-                                //$value = date('h:i',strtotime($post->$type['htmlvar_name']));
2545
-                                $value = date(get_option('time_format'), strtotime($post->$type['htmlvar_name']));
2546
-
2547
-                            if (strpos($field_icon, 'http') !== false) {
2548
-                                $field_icon_af = '';
2549
-                            } elseif ($field_icon == '') {
2550
-                                $field_icon_af = '<i class="fa fa-clock-o"></i>';
2551
-                            } else {
2552
-                                $field_icon_af = $field_icon;
2553
-                                $field_icon = '';
2554
-                            }
2555
-
2556
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2557
-
2558
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2559
-                            if ($field_set_start == 1 && $site_title != '') {
2560
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2561
-                            }
2562
-                            $html .= ' </span>' . stripslashes($value) . '</div>';
2563
-                        }
2564
-                            break;
2565
-                        case 'datepicker': {
2566
-                            $date_format = geodir_default_date_format();
2567
-                            if ($type['extra_fields'] != '') {
2568
-                                $date_format = unserialize($type['extra_fields']);
2569
-                                $date_format = $date_format['date_format'];
2570
-                            }
2571
-
2572
-                            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2573
-                            $replace = array('d','j','l','m','n','F','Y');//PHP date format
2574
-
2575
-                            $date_format = str_replace($search, $replace, $date_format);
2576
-
2577
-                            $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->$type['htmlvar_name']) : $post->$type['htmlvar_name']; // PHP doesn't work well with dd/mm/yyyy format
2578
-
2579
-                            $value = '';
2580
-                            if ($post->$type['htmlvar_name'] != '')
2581
-                                $value = date($date_format, strtotime($post_htmlvar_value));
2582
-
2583
-                            if (strpos($field_icon, 'http') !== false) {
2584
-                                $field_icon_af = '';
2585
-                            } elseif ($field_icon == '') {
2586
-                                $field_icon_af = '<i class="fa fa-calendar"></i>';
2587
-                            } else {
2588
-                                $field_icon_af = $field_icon;
2589
-                                $field_icon = '';
2590
-                            }
2591
-
2592
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2593
-
2594
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2595
-                            if ($field_set_start == 1 && $site_title != '') {
2596
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2597
-                            }
2598
-                            $html .= ' </span>' . $value . '</div>';
2599
-                        }
2600
-                            break;
2601
-                        case 'text': {
2602
-                            if (strpos($field_icon, 'http') !== false) {
2603
-                                $field_icon_af = '';
2604
-                            } elseif ($field_icon == '') {
2605
-                                $field_icon_af = '';
2606
-                            } else {
2607
-                                $field_icon_af = $field_icon;
2608
-                                $field_icon = '';
2609
-                            }
2610
-
2611
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2612
-
2613
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2614
-                            if ($field_set_start == 1 && $site_title != '') {
2615
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2616
-                            }
2617
-                            $html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2618
-                        }
2619
-                            break;
2620
-                        case 'radio': {
2621
-
2622
-                            if ($post->$type['htmlvar_name'] != '') {
2623
-                                if ($post->$type['htmlvar_name'] == 'f' || $post->$type['htmlvar_name'] == '0') {
2624
-                                    $html_val = __('No', 'geodirectory');
2625
-                                } else if ($post->$type['htmlvar_name'] == 't' || $post->$type['htmlvar_name'] == '1') {
2626
-                                    $html_val = __('Yes', 'geodirectory');
2627
-                                } else {
2628
-                                    $html_val = __($post->$type['htmlvar_name'], 'geodirectory');
2499
+							$a_url = geodir_parse_custom_field_url($post->$type['htmlvar_name']);
2500
+
2501
+							$website = !empty($a_url['url']) ? $a_url['url'] : '';
2502
+							$title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2503
+							$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2504
+
2505
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2506
+
2507
+							// all search engines that use the nofollow value exclude links that use it from their ranking calculation
2508
+							$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2509
+
2510
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .
2511
+								/**
2512
+								 * Filer the custom field website name.
2513
+								 *
2514
+								 * @since 1.0.0
2515
+								 * @param string $title The field name default: "Website".
2516
+								 * @param string $website The website address.
2517
+								 * @param int $post->ID The post ID.
2518
+								 */
2519
+								apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
2520
+						}
2521
+							break;
2522
+						case 'phone': {
2523
+							if (strpos($field_icon, 'http') !== false) {
2524
+								$field_icon_af = '';
2525
+							} elseif ($field_icon == '') {
2526
+								$field_icon_af = '<i class="fa fa-phone"></i>';
2527
+							} else {
2528
+								$field_icon_af = $field_icon;
2529
+								$field_icon = '';
2530
+							}
2531
+
2532
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2533
+
2534
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;
2535
+							if ($field_set_start == 1 && $site_title != '') {
2536
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2537
+							}
2538
+							$html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2539
+						}
2540
+							break;
2541
+						case 'time': {
2542
+							$value = '';
2543
+							if ($post->$type['htmlvar_name'] != '')
2544
+								//$value = date('h:i',strtotime($post->$type['htmlvar_name']));
2545
+								$value = date(get_option('time_format'), strtotime($post->$type['htmlvar_name']));
2546
+
2547
+							if (strpos($field_icon, 'http') !== false) {
2548
+								$field_icon_af = '';
2549
+							} elseif ($field_icon == '') {
2550
+								$field_icon_af = '<i class="fa fa-clock-o"></i>';
2551
+							} else {
2552
+								$field_icon_af = $field_icon;
2553
+								$field_icon = '';
2554
+							}
2555
+
2556
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2557
+
2558
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2559
+							if ($field_set_start == 1 && $site_title != '') {
2560
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2561
+							}
2562
+							$html .= ' </span>' . stripslashes($value) . '</div>';
2563
+						}
2564
+							break;
2565
+						case 'datepicker': {
2566
+							$date_format = geodir_default_date_format();
2567
+							if ($type['extra_fields'] != '') {
2568
+								$date_format = unserialize($type['extra_fields']);
2569
+								$date_format = $date_format['date_format'];
2570
+							}
2571
+
2572
+							$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2573
+							$replace = array('d','j','l','m','n','F','Y');//PHP date format
2574
+
2575
+							$date_format = str_replace($search, $replace, $date_format);
2576
+
2577
+							$post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->$type['htmlvar_name']) : $post->$type['htmlvar_name']; // PHP doesn't work well with dd/mm/yyyy format
2578
+
2579
+							$value = '';
2580
+							if ($post->$type['htmlvar_name'] != '')
2581
+								$value = date($date_format, strtotime($post_htmlvar_value));
2582
+
2583
+							if (strpos($field_icon, 'http') !== false) {
2584
+								$field_icon_af = '';
2585
+							} elseif ($field_icon == '') {
2586
+								$field_icon_af = '<i class="fa fa-calendar"></i>';
2587
+							} else {
2588
+								$field_icon_af = $field_icon;
2589
+								$field_icon = '';
2590
+							}
2591
+
2592
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2593
+
2594
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2595
+							if ($field_set_start == 1 && $site_title != '') {
2596
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2597
+							}
2598
+							$html .= ' </span>' . $value . '</div>';
2599
+						}
2600
+							break;
2601
+						case 'text': {
2602
+							if (strpos($field_icon, 'http') !== false) {
2603
+								$field_icon_af = '';
2604
+							} elseif ($field_icon == '') {
2605
+								$field_icon_af = '';
2606
+							} else {
2607
+								$field_icon_af = $field_icon;
2608
+								$field_icon = '';
2609
+							}
2610
+
2611
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2612
+
2613
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2614
+							if ($field_set_start == 1 && $site_title != '') {
2615
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2616
+							}
2617
+							$html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2618
+						}
2619
+							break;
2620
+						case 'radio': {
2621
+
2622
+							if ($post->$type['htmlvar_name'] != '') {
2623
+								if ($post->$type['htmlvar_name'] == 'f' || $post->$type['htmlvar_name'] == '0') {
2624
+									$html_val = __('No', 'geodirectory');
2625
+								} else if ($post->$type['htmlvar_name'] == 't' || $post->$type['htmlvar_name'] == '1') {
2626
+									$html_val = __('Yes', 'geodirectory');
2627
+								} else {
2628
+									$html_val = __($post->$type['htmlvar_name'], 'geodirectory');
2629 2629
                                     
2630
-                                    if (!empty($type['option_values'])) {
2631
-                                        $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2630
+									if (!empty($type['option_values'])) {
2631
+										$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2632 2632
                                         
2633
-                                        if (!empty($cf_option_values)) {
2634
-                                            foreach ($cf_option_values as $cf_option_value) {
2635
-                                                if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2636
-                                                    $html_val = $cf_option_value['label'];
2637
-                                                }
2638
-                                            }
2639
-                                        }
2640
-                                    }
2641
-                                }
2642
-
2643
-                                if (strpos($field_icon, 'http') !== false) {
2644
-                                    $field_icon_af = '';
2645
-                                } else if ($field_icon == '') {
2646
-                                    $field_icon_af = '';
2647
-                                } else {
2648
-                                    $field_icon_af = $field_icon;
2649
-                                    $field_icon = '';
2650
-                                }
2651
-
2652
-                                $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2653
-
2654
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2655
-
2656
-                                if ($field_set_start == 1 && $site_title != '') {
2657
-                                    $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2658
-                                }
2659
-
2660
-                                $html .= ' </span>' . $html_val . '</div>';
2661
-                            }
2662
-                        }
2663
-                            break;
2664
-                        case 'checkbox': {
2665
-                            $html_var = $type['htmlvar_name'];
2666
-                            $html_val = $type['htmlvar_name'];
2667
-
2668
-                            if ((int)$post->$html_var == 1) {
2669
-
2670
-                                if ($post->$type['htmlvar_name'] == '1') {
2671
-                                    $html_val = __('Yes', 'geodirectory');
2672
-                                } else {
2673
-                                    $html_val = __('No', 'geodirectory');
2674
-                                }
2675
-
2676
-                                if (strpos($field_icon, 'http') !== false) {
2677
-                                    $field_icon_af = '';
2678
-                                } else if ($field_icon == '') {
2679
-                                    $field_icon_af = '';
2680
-                                } else {
2681
-                                    $field_icon_af = $field_icon;
2682
-                                    $field_icon = '';
2683
-                                }
2684
-
2685
-                                $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2686
-
2687
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2688
-
2689
-                                if ($field_set_start == 1 && $site_title != '') {
2690
-                                    $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2691
-                                }
2692
-
2693
-                                $html .= ' </span>' . $html_val . '</div>';
2694
-                            }
2695
-                        }
2696
-                            break;
2697
-                        case 'select': {
2698
-                            if (strpos($field_icon, 'http') !== false) {
2699
-                                $field_icon_af = '';
2700
-                            } elseif ($field_icon == '') {
2701
-                                $field_icon_af = '';
2702
-                            } else {
2703
-                                $field_icon_af = $field_icon;
2704
-                                $field_icon = '';
2705
-                            }
2633
+										if (!empty($cf_option_values)) {
2634
+											foreach ($cf_option_values as $cf_option_value) {
2635
+												if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2636
+													$html_val = $cf_option_value['label'];
2637
+												}
2638
+											}
2639
+										}
2640
+									}
2641
+								}
2642
+
2643
+								if (strpos($field_icon, 'http') !== false) {
2644
+									$field_icon_af = '';
2645
+								} else if ($field_icon == '') {
2646
+									$field_icon_af = '';
2647
+								} else {
2648
+									$field_icon_af = $field_icon;
2649
+									$field_icon = '';
2650
+								}
2651
+
2652
+								$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2653
+
2654
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2655
+
2656
+								if ($field_set_start == 1 && $site_title != '') {
2657
+									$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2658
+								}
2659
+
2660
+								$html .= ' </span>' . $html_val . '</div>';
2661
+							}
2662
+						}
2663
+							break;
2664
+						case 'checkbox': {
2665
+							$html_var = $type['htmlvar_name'];
2666
+							$html_val = $type['htmlvar_name'];
2667
+
2668
+							if ((int)$post->$html_var == 1) {
2669
+
2670
+								if ($post->$type['htmlvar_name'] == '1') {
2671
+									$html_val = __('Yes', 'geodirectory');
2672
+								} else {
2673
+									$html_val = __('No', 'geodirectory');
2674
+								}
2675
+
2676
+								if (strpos($field_icon, 'http') !== false) {
2677
+									$field_icon_af = '';
2678
+								} else if ($field_icon == '') {
2679
+									$field_icon_af = '';
2680
+								} else {
2681
+									$field_icon_af = $field_icon;
2682
+									$field_icon = '';
2683
+								}
2684
+
2685
+								$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2686
+
2687
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2688
+
2689
+								if ($field_set_start == 1 && $site_title != '') {
2690
+									$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2691
+								}
2692
+
2693
+								$html .= ' </span>' . $html_val . '</div>';
2694
+							}
2695
+						}
2696
+							break;
2697
+						case 'select': {
2698
+							if (strpos($field_icon, 'http') !== false) {
2699
+								$field_icon_af = '';
2700
+							} elseif ($field_icon == '') {
2701
+								$field_icon_af = '';
2702
+							} else {
2703
+								$field_icon_af = $field_icon;
2704
+								$field_icon = '';
2705
+							}
2706 2706
                             
2707
-                            $field_value = __($post->$type['htmlvar_name'], 'geodirectory');
2707
+							$field_value = __($post->$type['htmlvar_name'], 'geodirectory');
2708 2708
                             
2709
-                            if (!empty($type['option_values'])) {
2710
-                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2709
+							if (!empty($type['option_values'])) {
2710
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2711 2711
                                 
2712
-                                if (!empty($cf_option_values)) {
2713
-                                    foreach ($cf_option_values as $cf_option_value) {
2714
-                                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2715
-                                            $field_value = $cf_option_value['label'];
2716
-                                        }
2717
-                                    }
2718
-                                }
2719
-                            }
2720
-
2721
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2722
-
2723
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2724
-                            if ($field_set_start == 1 && $site_title != '') {
2725
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2726
-                            }
2727
-                            $html .= ' </span>' . $field_value . '</div>';
2728
-                        }
2729
-                            break;
2730
-                        case 'multiselect': {
2731
-                            if (is_array($post->$type['htmlvar_name'])) {
2732
-                                $post->$type['htmlvar_name'] = implode(', ', $post->$type['htmlvar_name']);
2733
-                            }
2734
-
2735
-                            if (strpos($field_icon, 'http') !== false) {
2736
-                                $field_icon_af = '';
2737
-                            } elseif ($field_icon == '') {
2738
-                                $field_icon_af = '';
2739
-                            } else {
2740
-                                $field_icon_af = $field_icon;
2741
-                                $field_icon = '';
2742
-                            }
2743
-
2744
-                            $field_values = explode(',', trim($post->$type['htmlvar_name'], ","));
2745
-
2746
-                            $option_values = array();
2747
-                            if (!empty($type['option_values'])) {
2748
-                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2712
+								if (!empty($cf_option_values)) {
2713
+									foreach ($cf_option_values as $cf_option_value) {
2714
+										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2715
+											$field_value = $cf_option_value['label'];
2716
+										}
2717
+									}
2718
+								}
2719
+							}
2720
+
2721
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2722
+
2723
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2724
+							if ($field_set_start == 1 && $site_title != '') {
2725
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2726
+							}
2727
+							$html .= ' </span>' . $field_value . '</div>';
2728
+						}
2729
+							break;
2730
+						case 'multiselect': {
2731
+							if (is_array($post->$type['htmlvar_name'])) {
2732
+								$post->$type['htmlvar_name'] = implode(', ', $post->$type['htmlvar_name']);
2733
+							}
2734
+
2735
+							if (strpos($field_icon, 'http') !== false) {
2736
+								$field_icon_af = '';
2737
+							} elseif ($field_icon == '') {
2738
+								$field_icon_af = '';
2739
+							} else {
2740
+								$field_icon_af = $field_icon;
2741
+								$field_icon = '';
2742
+							}
2743
+
2744
+							$field_values = explode(',', trim($post->$type['htmlvar_name'], ","));
2745
+
2746
+							$option_values = array();
2747
+							if (!empty($type['option_values'])) {
2748
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2749 2749
                                 
2750
-                                if (!empty($cf_option_values)) {
2751
-                                    foreach ($cf_option_values as $cf_option_value) {
2752
-                                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2753
-                                            $option_values[] = $cf_option_value['label'];
2754
-                                        }
2755
-                                    }
2756
-                                }
2757
-                            }
2758
-
2759
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2760
-
2761
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2762
-                            if ($field_set_start == 1 && $site_title != '') {
2763
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2764
-                            }
2765
-                            $html .= ' </span>';
2766
-
2767
-                            if (count($option_values) > 1) {
2768
-                                $html .= '<ul>';
2769
-                                foreach ($option_values as $val) {
2770
-                                    $html .= '<li>' . $val . '</li>';
2771
-                                }
2772
-                                $html .= '</ul>';
2773
-                            } else {
2774
-                                $html .= $post->$type['htmlvar_name'];
2775
-                            }
2776
-                            $html .= '</div>';
2777
-                        }
2778
-                            break;
2779
-                        case 'email': {
2780
-                            if (strpos($field_icon, 'http') !== false) {
2781
-                                $field_icon_af = '';
2782
-                            } elseif ($field_icon == '') {
2783
-                                $field_icon_af = '<i class="fa fa-envelope"></i>';
2784
-                            } else {
2785
-                                $field_icon_af = $field_icon;
2786
-                                $field_icon = '';
2787
-                            }
2788
-
2789
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2790
-
2791
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2792
-                            if ($field_set_start == 1 && $site_title != '') {
2793
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2794
-                            }
2795
-                            $html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2796
-                        }
2797
-                            break;
2798
-                        case 'textarea': {
2799
-                            if (strpos($field_icon, 'http') !== false) {
2800
-                                $field_icon_af = '';
2801
-                            } elseif ($field_icon == '') {
2802
-                                $field_icon_af = '';
2803
-                            } else {
2804
-                                $field_icon_af = $field_icon;
2805
-                                $field_icon = '';
2806
-                            }
2807
-
2808
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2809
-
2810
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2811
-                            if ($field_set_start == 1 && $site_title != '') {
2812
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2813
-                            }
2814
-                            $html .= '</span>' . wpautop(stripslashes($post->$type['htmlvar_name'])) . '</div>';
2815
-                        }
2816
-                            break;
2817
-                        case 'html': {
2818
-                            if (strpos($field_icon, 'http') !== false) {
2819
-                                $field_icon_af = '';
2820
-                            } elseif ($field_icon == '') {
2821
-                                $field_icon_af = '';
2822
-                            } else {
2823
-                                $field_icon_af = $field_icon;
2824
-                                $field_icon = '';
2825
-                            }
2826
-
2827
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2828
-
2829
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2830
-                            if ($field_set_start == 1 && $site_title != '') {
2831
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2832
-                            }
2833
-                            $html .= ' </span>' . wpautop(stripslashes($post->$type['htmlvar_name'])) . '</div>';
2834
-                        }
2835
-                        break;
2836
-                        case 'file': {
2837
-                            $html_var = $type['htmlvar_name'];
2838
-
2839
-                            if (!empty($post->$type['htmlvar_name'])) {
2840
-                                $files = explode(",", $post->$type['htmlvar_name']);
2841
-
2842
-                                if (!empty($files)) {
2843
-                                    $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2844
-                                    $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2750
+								if (!empty($cf_option_values)) {
2751
+									foreach ($cf_option_values as $cf_option_value) {
2752
+										if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2753
+											$option_values[] = $cf_option_value['label'];
2754
+										}
2755
+									}
2756
+								}
2757
+							}
2758
+
2759
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2760
+
2761
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2762
+							if ($field_set_start == 1 && $site_title != '') {
2763
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2764
+							}
2765
+							$html .= ' </span>';
2766
+
2767
+							if (count($option_values) > 1) {
2768
+								$html .= '<ul>';
2769
+								foreach ($option_values as $val) {
2770
+									$html .= '<li>' . $val . '</li>';
2771
+								}
2772
+								$html .= '</ul>';
2773
+							} else {
2774
+								$html .= $post->$type['htmlvar_name'];
2775
+							}
2776
+							$html .= '</div>';
2777
+						}
2778
+							break;
2779
+						case 'email': {
2780
+							if (strpos($field_icon, 'http') !== false) {
2781
+								$field_icon_af = '';
2782
+							} elseif ($field_icon == '') {
2783
+								$field_icon_af = '<i class="fa fa-envelope"></i>';
2784
+							} else {
2785
+								$field_icon_af = $field_icon;
2786
+								$field_icon = '';
2787
+							}
2788
+
2789
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2790
+
2791
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2792
+							if ($field_set_start == 1 && $site_title != '') {
2793
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2794
+							}
2795
+							$html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2796
+						}
2797
+							break;
2798
+						case 'textarea': {
2799
+							if (strpos($field_icon, 'http') !== false) {
2800
+								$field_icon_af = '';
2801
+							} elseif ($field_icon == '') {
2802
+								$field_icon_af = '';
2803
+							} else {
2804
+								$field_icon_af = $field_icon;
2805
+								$field_icon = '';
2806
+							}
2807
+
2808
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2809
+
2810
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2811
+							if ($field_set_start == 1 && $site_title != '') {
2812
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2813
+							}
2814
+							$html .= '</span>' . wpautop(stripslashes($post->$type['htmlvar_name'])) . '</div>';
2815
+						}
2816
+							break;
2817
+						case 'html': {
2818
+							if (strpos($field_icon, 'http') !== false) {
2819
+								$field_icon_af = '';
2820
+							} elseif ($field_icon == '') {
2821
+								$field_icon_af = '';
2822
+							} else {
2823
+								$field_icon_af = $field_icon;
2824
+								$field_icon = '';
2825
+							}
2826
+
2827
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2828
+
2829
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2830
+							if ($field_set_start == 1 && $site_title != '') {
2831
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2832
+							}
2833
+							$html .= ' </span>' . wpautop(stripslashes($post->$type['htmlvar_name'])) . '</div>';
2834
+						}
2835
+						break;
2836
+						case 'file': {
2837
+							$html_var = $type['htmlvar_name'];
2838
+
2839
+							if (!empty($post->$type['htmlvar_name'])) {
2840
+								$files = explode(",", $post->$type['htmlvar_name']);
2841
+
2842
+								if (!empty($files)) {
2843
+									$extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2844
+									$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2845 2845
                                
2846
-                                    $file_paths = '';
2847
-                                    foreach ($files as $file) {
2848
-                                        if (!empty($file)) {
2849
-                                            $filetype = wp_check_filetype($file);
2850
-                                            $image_name_arr = explode('/', $file);
2851
-                                            $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
2852
-                                            $filename = end($image_name_arr);
2853
-                                            $img_name_arr = explode('.', $filename);
2854
-
2855
-                                            $arr_file_type = wp_check_filetype($filename);
2856
-                                            if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2857
-                                                continue;
2858
-                                            }
2859
-                                            $uploaded_file_type = $arr_file_type['type'];
2860
-                                            $uploaded_file_ext = $arr_file_type['ext'];
2846
+									$file_paths = '';
2847
+									foreach ($files as $file) {
2848
+										if (!empty($file)) {
2849
+											$filetype = wp_check_filetype($file);
2850
+											$image_name_arr = explode('/', $file);
2851
+											$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
2852
+											$filename = end($image_name_arr);
2853
+											$img_name_arr = explode('.', $filename);
2854
+
2855
+											$arr_file_type = wp_check_filetype($filename);
2856
+											if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2857
+												continue;
2858
+											}
2859
+											$uploaded_file_type = $arr_file_type['type'];
2860
+											$uploaded_file_ext = $arr_file_type['ext'];
2861 2861
                                             
2862
-                                            if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2863
-                                                continue; // Invalid file type.
2864
-                                            }
2865
-
2866
-                                            //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
2867
-                                            $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2868
-
2869
-                                            // If the uploaded file is image
2870
-                                            if (in_array($uploaded_file_type, $image_file_types)) {
2871
-                                                $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2872
-                                                $file_paths .= '<a href="'.$file.'">';
2873
-                                                $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2874
-                                                $file_paths .= '</a>';
2875
-                                                $file_paths .= '</div>';
2876
-                                            } else {
2877
-                                                $ext_path = '_' . $html_var . '_';
2878
-                                                $filename = explode($ext_path, $filename);
2879
-                                                $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2880
-                                            }
2881
-                                        }
2882
-                                    }
2883
-
2884
-                                    if (strpos($field_icon, 'http') !== false) {
2885
-                                        $field_icon_af = '';
2886
-                                    } else if ($field_icon == '') {
2887
-                                        $field_icon_af = '';
2888
-                                    } else {
2889
-                                        $field_icon_af = $field_icon;
2890
-                                        $field_icon = '';
2891
-                                    }
2892
-
2893
-                                    $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2894
-
2895
-
2896
-                                    $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;
2897
-
2898
-                                    if ($field_set_start == 1 && $site_title != '') {
2899
-                                        $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2900
-                                    }
2901
-
2902
-                                    $html .= ' </span>' . $file_paths . '</div>';
2903
-                                }
2904
-                            }
2905
-                        }
2906
-                            break;
2907
-                    }
2908
-
2909
-
2910
-                    /**
2911
-                     * Filter custom field output in tab.
2912
-                     *
2913
-                     * @since 1.5.6
2914
-                     *
2915
-                     * @param string $html_var The HTML variable name for the field.
2916
-                     * @param string $html Custom field unfiltered HTML.
2917
-                     * @param array $variables_array Custom field variables array.
2918
-                     */
2919
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2920
-
2921
-
2922
-                    if ($field_set_start == 1) {
2923
-                        $add_html = false;
2924
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2925
-                            if ($fieldset != '') {
2926
-                                $add_html = true;
2927
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2928
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2929
-                            }
2930
-                            $fieldset_html = $fieldset;
2931
-                            $fieldset = '';
2932
-                        } else {
2933
-                            $fieldset .= $html;
2934
-                            if ($total_fields == $count_field && $fieldset != '') {
2935
-                                $add_html = true;
2936
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2937
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2938
-                                $fieldset_html = $fieldset;
2939
-                            }
2940
-                        }
2941
-
2942
-                        if ($add_html) {
2943
-                            $tabs_arr[$htmlvar_name] = array(
2944
-                                'heading_text' => __($label, 'geodirectory'),
2945
-                                'is_active_tab' => false,
2946
-                                /**
2947
-                                 * Filter if a custom field should be displayed on the details page tab.
2948
-                                 *
2949
-                                 * @since 1.0.0
2950
-                                 * @param string $htmlvar_name The field HTML var name.
2951
-                                 */
2952
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2953
-                                'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'
2954
-                            );
2955
-                        }
2956
-                    } else {
2957
-                        if ($html != '') {
2958
-                            $tabs_arr[$field['htmlvar_name']] = array(
2959
-                                'heading_text' => __($label, 'geodirectory'),
2960
-                                'is_active_tab' => false,
2961
-                                /** This action is documented in geodirectory_hooks_actions.php */
2962
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2963
-                                'tab_content' => $html
2964
-                            );
2965
-                        }
2966
-                    }
2967
-                }
2968
-            }
2969
-        }
2970
-    }
2971
-    return $tabs_arr;
2862
+											if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2863
+												continue; // Invalid file type.
2864
+											}
2865
+
2866
+											//$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
2867
+											$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2868
+
2869
+											// If the uploaded file is image
2870
+											if (in_array($uploaded_file_type, $image_file_types)) {
2871
+												$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2872
+												$file_paths .= '<a href="'.$file.'">';
2873
+												$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2874
+												$file_paths .= '</a>';
2875
+												$file_paths .= '</div>';
2876
+											} else {
2877
+												$ext_path = '_' . $html_var . '_';
2878
+												$filename = explode($ext_path, $filename);
2879
+												$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2880
+											}
2881
+										}
2882
+									}
2883
+
2884
+									if (strpos($field_icon, 'http') !== false) {
2885
+										$field_icon_af = '';
2886
+									} else if ($field_icon == '') {
2887
+										$field_icon_af = '';
2888
+									} else {
2889
+										$field_icon_af = $field_icon;
2890
+										$field_icon = '';
2891
+									}
2892
+
2893
+									$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2894
+
2895
+
2896
+									$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;
2897
+
2898
+									if ($field_set_start == 1 && $site_title != '') {
2899
+										$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2900
+									}
2901
+
2902
+									$html .= ' </span>' . $file_paths . '</div>';
2903
+								}
2904
+							}
2905
+						}
2906
+							break;
2907
+					}
2908
+
2909
+
2910
+					/**
2911
+					 * Filter custom field output in tab.
2912
+					 *
2913
+					 * @since 1.5.6
2914
+					 *
2915
+					 * @param string $html_var The HTML variable name for the field.
2916
+					 * @param string $html Custom field unfiltered HTML.
2917
+					 * @param array $variables_array Custom field variables array.
2918
+					 */
2919
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2920
+
2921
+
2922
+					if ($field_set_start == 1) {
2923
+						$add_html = false;
2924
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2925
+							if ($fieldset != '') {
2926
+								$add_html = true;
2927
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2928
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2929
+							}
2930
+							$fieldset_html = $fieldset;
2931
+							$fieldset = '';
2932
+						} else {
2933
+							$fieldset .= $html;
2934
+							if ($total_fields == $count_field && $fieldset != '') {
2935
+								$add_html = true;
2936
+								$label = $fieldset_arr[$fieldset_count]['label'];
2937
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2938
+								$fieldset_html = $fieldset;
2939
+							}
2940
+						}
2941
+
2942
+						if ($add_html) {
2943
+							$tabs_arr[$htmlvar_name] = array(
2944
+								'heading_text' => __($label, 'geodirectory'),
2945
+								'is_active_tab' => false,
2946
+								/**
2947
+								 * Filter if a custom field should be displayed on the details page tab.
2948
+								 *
2949
+								 * @since 1.0.0
2950
+								 * @param string $htmlvar_name The field HTML var name.
2951
+								 */
2952
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2953
+								'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'
2954
+							);
2955
+						}
2956
+					} else {
2957
+						if ($html != '') {
2958
+							$tabs_arr[$field['htmlvar_name']] = array(
2959
+								'heading_text' => __($label, 'geodirectory'),
2960
+								'is_active_tab' => false,
2961
+								/** This action is documented in geodirectory_hooks_actions.php */
2962
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2963
+								'tab_content' => $html
2964
+							);
2965
+						}
2966
+					}
2967
+				}
2968
+			}
2969
+		}
2970
+	}
2971
+	return $tabs_arr;
2972 2972
 }
2973 2973
 
2974 2974
 /* display add listing page for wpml */
@@ -2992,37 +2992,37 @@  discard block
 block discarded – undo
2992 2992
  */
2993 2993
 function geodir_add_post_status_author_page()
2994 2994
 {
2995
-    global $wpdb, $post;
2996
-
2997
-    $html = '';
2998
-    if (get_current_user_id()) {
2999
-        if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
3000
-
3001
-            // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
3002
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
3003
-            $status = "<strong>(";
3004
-            $status_icon = '<i class="fa fa-play"></i>';
3005
-            if ($real_status == 'publish') {
3006
-                $status .= __('Published', 'geodirectory');
3007
-            } else {
3008
-                $status .= __('Not published', 'geodirectory');
3009
-                $status_icon = '<i class="fa fa-pause"></i>';
3010
-            }
3011
-            $status .= ")</strong>";
2995
+	global $wpdb, $post;
2996
+
2997
+	$html = '';
2998
+	if (get_current_user_id()) {
2999
+		if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
3000
+
3001
+			// we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
3002
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
3003
+			$status = "<strong>(";
3004
+			$status_icon = '<i class="fa fa-play"></i>';
3005
+			if ($real_status == 'publish') {
3006
+				$status .= __('Published', 'geodirectory');
3007
+			} else {
3008
+				$status .= __('Not published', 'geodirectory');
3009
+				$status_icon = '<i class="fa fa-pause"></i>';
3010
+			}
3011
+			$status .= ")</strong>";
3012 3012
 
3013
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
3014
-        }
3015
-    }
3013
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
3014
+		}
3015
+	}
3016 3016
 
3017
-    if ($html != '') {
3018
-        /**
3019
-         * Filter the post status text on the author page.
3020
-         *
3021
-         * @since 1.0.0
3022
-         * @param string $html The HTML of the status.
3023
-         */
3024
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
3025
-    }
3017
+	if ($html != '') {
3018
+		/**
3019
+		 * Filter the post status text on the author page.
3020
+		 *
3021
+		 * @since 1.0.0
3022
+		 * @param string $html The HTML of the status.
3023
+		 */
3024
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
3025
+	}
3026 3026
 
3027 3027
 
3028 3028
 }
@@ -3036,21 +3036,21 @@  discard block
 block discarded – undo
3036 3036
  */
3037 3037
 function geodir_init_no_rating()
3038 3038
 {
3039
-    if (get_option('geodir_disable_rating')) {
3040
-        remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
3041
-        remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
3042
-        remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
3043
-        remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
3044
-        remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
3045
-        remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
3046
-        remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
3047
-
3048
-        add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
3049
-        add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
3050
-        add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
3051
-        add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
3052
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
3053
-    }
3039
+	if (get_option('geodir_disable_rating')) {
3040
+		remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
3041
+		remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
3042
+		remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
3043
+		remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
3044
+		remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
3045
+		remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
3046
+		remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
3047
+
3048
+		add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
3049
+		add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
3050
+		add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
3051
+		add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
3052
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
3053
+	}
3054 3054
 }
3055 3055
 
3056 3056
 /**
@@ -3062,20 +3062,20 @@  discard block
 block discarded – undo
3062 3062
  */
3063 3063
 function geodir_no_rating_rating_fields()
3064 3064
 {
3065
-    global $post;
3065
+	global $post;
3066 3066
 
3067
-    $post_types = geodir_get_posttypes();
3067
+	$post_types = geodir_get_posttypes();
3068 3068
 
3069
-    if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
3070
-        if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
3071
-            echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
3072
-            if (get_option('geodir_reviewrating_enable_images')) {
3073
-                geodir_reviewrating_rating_img_html();
3074
-            }
3075
-        } else {
3076
-            echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
3077
-        }
3078
-    }
3069
+	if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
3070
+		if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
3071
+			echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
3072
+			if (get_option('geodir_reviewrating_enable_images')) {
3073
+				geodir_reviewrating_rating_img_html();
3074
+			}
3075
+		} else {
3076
+			echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
3077
+		}
3078
+	}
3079 3079
 }
3080 3080
 
3081 3081
 /**
@@ -3089,11 +3089,11 @@  discard block
 block discarded – undo
3089 3089
  */
3090 3090
 function geodir_no_rating_comment_text($content, $comment = '')
3091 3091
 {
3092
-    if (!is_admin()) {
3093
-        return '<div class="description">' . $content . '</div>';
3094
-    } else {
3095
-        return $content;
3096
-    }
3092
+	if (!is_admin()) {
3093
+		return '<div class="description">' . $content . '</div>';
3094
+	} else {
3095
+		return $content;
3096
+	}
3097 3097
 }
3098 3098
 
3099 3099
 /**
@@ -3106,7 +3106,7 @@  discard block
 block discarded – undo
3106 3106
  */
3107 3107
 function geodir_no_rating_review_rating_html($content = '')
3108 3108
 {
3109
-    return NULL;
3109
+	return NULL;
3110 3110
 }
3111 3111
 
3112 3112
 /**
@@ -3120,19 +3120,19 @@  discard block
 block discarded – undo
3120 3120
  */
3121 3121
 function geodir_no_rating_get_sort_options($options, $post_type = '')
3122 3122
 {
3123
-    $new_options = array();
3124
-    if (!empty($options)) {
3125
-        foreach ($options as $option) {
3126
-            if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
3127
-                continue;
3128
-            }
3129
-            $new_options[] = $option;
3130
-        }
3123
+	$new_options = array();
3124
+	if (!empty($options)) {
3125
+		foreach ($options as $option) {
3126
+			if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
3127
+				continue;
3128
+			}
3129
+			$new_options[] = $option;
3130
+		}
3131 3131
 
3132
-        $options = $new_options;
3133
-    }
3132
+		$options = $new_options;
3133
+	}
3134 3134
 
3135
-    return $options;
3135
+	return $options;
3136 3136
 }
3137 3137
 
3138 3138
 add_filter('geodir_all_js_msg', 'geodir_all_js_msg_no_rating', 100);
@@ -3146,11 +3146,11 @@  discard block
 block discarded – undo
3146 3146
  */
3147 3147
 function geodir_all_js_msg_no_rating($msg = array())
3148 3148
 {
3149
-    if (get_option('geodir_disable_rating')) {
3150
-        $msg['gd_cmt_no_rating'] = true;
3151
-    }
3149
+	if (get_option('geodir_disable_rating')) {
3150
+		$msg['gd_cmt_no_rating'] = true;
3151
+	}
3152 3152
 
3153
-    return $msg;
3153
+	return $msg;
3154 3154
 }
3155 3155
 
3156 3156
 add_filter('body_class', 'geodir_body_class_no_rating', 100);
@@ -3164,11 +3164,11 @@  discard block
 block discarded – undo
3164 3164
  */
3165 3165
 function geodir_body_class_no_rating($classes = array())
3166 3166
 {
3167
-    if (get_option('geodir_disable_rating')) {
3168
-        $classes[] = 'gd-no-rating';
3169
-    }
3167
+	if (get_option('geodir_disable_rating')) {
3168
+		$classes[] = 'gd-no-rating';
3169
+	}
3170 3170
 
3171
-    return $classes;
3171
+	return $classes;
3172 3172
 }
3173 3173
 
3174 3174
 add_filter('admin_body_class', 'geodir_admin_body_class_no_rating', 100);
@@ -3182,11 +3182,11 @@  discard block
 block discarded – undo
3182 3182
  */
3183 3183
 function geodir_admin_body_class_no_rating($class = '')
3184 3184
 {
3185
-    if (get_option('geodir_disable_rating')) {
3186
-        $class .= ' gd-no-rating';
3187
-    }
3185
+	if (get_option('geodir_disable_rating')) {
3186
+		$class .= ' gd-no-rating';
3187
+	}
3188 3188
 
3189
-    return $class;
3189
+	return $class;
3190 3190
 }
3191 3191
 
3192 3192
 add_action('wp_head', 'geodir_wp_head_no_rating');
@@ -3199,10 +3199,10 @@  discard block
 block discarded – undo
3199 3199
  */
3200 3200
 function geodir_wp_head_no_rating()
3201 3201
 {
3202
-    if (get_option('geodir_disable_rating')) {
3203
-        echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
3204
-        echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
3205
-    }
3202
+	if (get_option('geodir_disable_rating')) {
3203
+		echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
3204
+		echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
3205
+	}
3206 3206
 }
3207 3207
 
3208 3208
 add_filter('geodir_load_db_language', 'geodir_load_custom_field_translation');
@@ -3219,36 +3219,36 @@  discard block
 block discarded – undo
3219 3219
  * @return array Translation texts.
3220 3220
  */
3221 3221
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
3222
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3223
-
3224
-    $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
3225
-
3226
-    /**
3227
-     * Filters the geodirectory option names that requires to add for translation.
3228
-     *
3229
-     * @since 1.5.7
3230
-     * @package GeoDirectory
3231
-     *
3232
-     * @param  array $gd_options Array of option names.
3233
-     */
3234
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
3235
-    $gd_options = array_unique($gd_options);
3236
-
3237
-    if (!empty($gd_options)) {
3238
-        foreach ($gd_options as $gd_option) {
3239
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
3240
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
3222
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3223
+
3224
+	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
3225
+
3226
+	/**
3227
+	 * Filters the geodirectory option names that requires to add for translation.
3228
+	 *
3229
+	 * @since 1.5.7
3230
+	 * @package GeoDirectory
3231
+	 *
3232
+	 * @param  array $gd_options Array of option names.
3233
+	 */
3234
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
3235
+	$gd_options = array_unique($gd_options);
3236
+
3237
+	if (!empty($gd_options)) {
3238
+		foreach ($gd_options as $gd_option) {
3239
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
3240
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
3241 3241
                 
3242
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
3243
-                    $translation_texts[] = stripslashes_deep($option_value);
3244
-                }
3245
-            }
3246
-        }
3247
-    }
3242
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
3243
+					$translation_texts[] = stripslashes_deep($option_value);
3244
+				}
3245
+			}
3246
+		}
3247
+	}
3248 3248
 
3249
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3249
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3250 3250
 
3251
-    return $translation_texts;
3251
+	return $translation_texts;
3252 3252
 }
3253 3253
 
3254 3254
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/notifications_settings_array.php 1 patch
Indentation   +291 added lines, -291 removed lines patch added patch discarded remove patch
@@ -17,296 +17,296 @@
 block discarded – undo
17 17
 $geodir_settings['notifications_settings'] = apply_filters('geodir_notifications_settings', array(
18 18
 
19 19
 
20
-    array('name' => __('Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'notification_options'),
21
-
22
-
23
-    array('name' => __('Notification Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'notification_options'),
24
-
25
-    array(
26
-        'name' => __('List of usable shortcodes', 'geodirectory'),
27
-        'desc' => __('[#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#],[#from_email#](in most cases this will be the admin email, except for popup forms)', 'geodirectory'),
28
-        'id' => 'geodir_list_of_usable_shordcodes',
29
-        'type' => 'html_content',
30
-        'css' => 'min-width:300px;',
31
-        'std' => 'All Places' // Default value for the page title - changed in settings
32
-    ),
33
-
34
-    array(
35
-        'name' => __('Use advanced editor? (slow loading)', 'geodirectory'),
36
-        'desc' => __('Yes', 'geodirectory'),
37
-        'id' => 'geodir_tiny_editor',
38
-        'std' => 'yes',
39
-        'type' => 'radio',
40
-        'value' => '1',
41
-        'radiogroup' => 'start'
42
-    ),
43
-    array(
44
-        'name' => __('Use advanced editor?(slow loading)', 'geodirectory'),
45
-        'desc' => __('No', 'geodirectory'),
46
-        'id' => 'geodir_tiny_editor',
47
-        'std' => 'yes',
48
-        'type' => 'radio',
49
-        'value' => '0',
50
-        'radiogroup' => 'end'
51
-    ),
52
-
53
-
54
-    array('type' => 'sectionend', 'id' => 'notification_options'),
55
-
56
-
57
-    array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'site_bcc_options'),
58
-
59
-    array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'site_bcc_options'),
60
-
61
-    array(
62
-        'name' => __('New user registration', 'geodirectory'),
63
-        'desc' => __('Yes', 'geodirectory'),
64
-        'id' => 'geodir_bcc_new_user',
65
-        'std' => 'yes',
66
-        'type' => 'radio',
67
-        'value' => '1',
68
-        'radiogroup' => 'start'
69
-    ),
70
-    array(
71
-        'name' => __('New user registration', 'geodirectory'),
72
-        'desc' => __('No', 'geodirectory'),
73
-        'id' => 'geodir_bcc_new_user',
74
-        'std' => 'yes',
75
-        'type' => 'radio',
76
-        'value' => '0',
77
-        'radiogroup' => 'end'
78
-    ),
79
-
80
-    array(
81
-        'name' => __('Send to friend', 'geodirectory'),
82
-        'desc' => __('Yes', 'geodirectory'),
83
-        'id' => 'geodir_bcc_friend',
84
-        'std' => 'yes',
85
-        'type' => 'radio',
86
-        'value' => '1',
87
-        'radiogroup' => 'start'
88
-    ),
89
-    array(
90
-        'name' => __('Send to friend', 'geodirectory'),
91
-        'desc' => __('No', 'geodirectory'),
92
-        'id' => 'geodir_bcc_friend',
93
-        'std' => 'yes',
94
-        'type' => 'radio',
95
-        'value' => '0',
96
-        'radiogroup' => 'end'
97
-    ),
98
-
99
-    array(
100
-        'name' => __('Send enquiry', 'geodirectory'),
101
-        'desc' => __('Yes', 'geodirectory'),
102
-        'id' => 'geodir_bcc_enquiry',
103
-        'std' => 'yes',
104
-        'type' => 'radio',
105
-        'value' => '1',
106
-        'radiogroup' => 'start'
107
-    ),
108
-    array(
109
-        'name' => __('Send enquiry', 'geodirectory'),
110
-        'desc' => __('No', 'geodirectory'),
111
-        'id' => 'geodir_bcc_enquiry',
112
-        'std' => 'yes',
113
-        'type' => 'radio',
114
-        'value' => '0',
115
-        'radiogroup' => 'end'
116
-    ),
117
-
118
-
119
-    array('type' => 'sectionend', 'id' => 'site_bcc_options'),
120
-
121
-
122
-    array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'admin_emails'),
123
-
124
-    array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'admin_emails'),
125
-
126
-    array(
127
-        'name' => __('Post submit success to admin email', 'geodirectory'),
128
-        'desc' => '',
129
-        'id' => 'geodir_post_submited_success_email_subject_admin',
130
-        'type' => 'text',
131
-        'css' => 'min-width:300px;',
132
-        'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
133
-    ),
134
-     array(
135
-        'name' => '',
136
-        'desc' => '',
137
-        'id' => 'geodir_post_submited_success_email_content_admin',
138
-        'css' => 'width:500px; height: 150px;',
139
-        'type' => 'textarea',
140
-        'std' => __('<p>Dear Admin,</p><p>A new  listing has been published [#listing_link#]. This email is just for your information.</p><br><p>[#site_name#]</p>','geodirectory')
141
-    ),
142
-    array(
143
-        'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
144
-        'desc' => __('Yes', 'geodirectory'),
145
-        'id' => 'geodir_notify_post_edited',
146
-        'std' => 'yes',
147
-        'type' => 'radio',
148
-        'value' => '1',
149
-        'radiogroup' => 'start'
150
-    ),
151
-    array(
152
-        'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
153
-        'desc' => __('No', 'geodirectory'),
154
-        'id' => 'geodir_notify_post_edited',
155
-        'std' => 'no',
156
-        'type' => 'radio',
157
-        'value' => '0',
158
-        'radiogroup' => 'end'
159
-    ),
160
-    array(
161
-        'name' => __('Listing edited by Author', 'geodirectory'),
162
-        'desc' => '',
163
-        'id' => 'geodir_post_edited_email_subject_admin',
164
-        'type' => 'text',
165
-        'css' => 'min-width:300px;',
166
-        'std' => __('[[#site_name#]] Listing edited by Author', 'geodirectory')
167
-    ),
168
-    array(
169
-        'name' => '',
170
-        'desc' => '',
171
-        'id' => 'geodir_post_edited_email_content_admin',
172
-        'css' => 'width:500px; height: 150px;',
173
-        'type' => 'textarea',
174
-        'std' => __('<p>Dear Admin,</p><p>A listing [#listing_link#] has been edited by it\'s author [#post_author_name#].</p><br><p><b>Listing Details:</b></p><p>Listing ID: [#post_id#]</p><p>Listing URL: [#listing_link#]</p><p>Date: [#current_date#]</p><br><p>This email is just for your information.</p><p>[#site_name#]</p>', 'geodirectory')
175
-    ),
176
-
177
-
178
-    array('type' => 'sectionend', 'id' => 'admin_emails'),
179
-
180
-
181
-    array('name' => __('Client Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'client_emails'),
182
-
183
-    array('name' => __('Client Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'client_emails'),
184
-
185
-    array(
186
-        'name' => __('Post submit success to client email', 'geodirectory'),
187
-        'desc' => '',
188
-        'id' => 'geodir_post_submited_success_email_subject',
189
-        'type' => 'text',
190
-        'css' => 'min-width:300px;',
191
-        'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
192
-    ),
193
-    array(
194
-        'name' => '',
195
-        'desc' => '',
196
-        'id' => 'geodir_post_submited_success_email_content',
197
-        'css' => 'width:500px; height: 150px;',
198
-        'type' => 'textarea',
199
-        'std' => __('<p>Dear [#client_name#],</p><p>You submitted the below listing information. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>','geodirectory')
200
-    ),
201
-
202
-
203
-    array(
204
-        'name' => __('User forgot password email', 'geodirectory'),
205
-        'desc' => '',
206
-        'id' => 'geodir_forgot_password_subject',
207
-        'type' => 'text',
208
-        'css' => 'min-width:300px;',
209
-        'std' => __('[#site_name#] - Your new password', 'geodirectory') // Default value for the page title - changed in settings
210
-    ),
211
-    array(
212
-        'name' => '',
213
-        'desc' => '',
214
-        'id' => 'geodir_forgot_password_content',
215
-        'css' => 'width:500px; height: 150px;',
216
-        'type' => 'textarea',
217
-        'std' => __("<p>Dear [#client_name#],<p><p>You requested a new password for [#site_name_url#]</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
218
-    ),
219
-
220
-    array(
221
-        'name' => __('Registration success email', 'geodirectory'),
222
-        'desc' => '',
223
-        'id' => 'geodir_registration_success_email_subject',
224
-        'type' => 'text',
225
-        'css' => 'min-width:300px;',
226
-        'std' => __('Your Log In Details', 'geodirectory') // Default value for the page title - changed in settings
227
-    ),
228
-    array(
229
-        'name' => '',
230
-        'desc' => '',
231
-        'id' => 'geodir_registration_success_email_content',
232
-        'css' => 'width:500px; height: 150px;',
233
-        'type' => 'textarea',
234
-        'std' => __("<p>Dear [#client_name#],</p><p>You can log in  with the following information:</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
235
-    ),
236
-    array(
237
-        'name' => __('Listing published email', 'geodirectory'),
238
-        'desc' => '',
239
-        'id' => 'geodir_post_published_email_subject',
240
-        'type' => 'text',
241
-        'css' => 'min-width:300px;',
242
-        'std' => __('Listing Published Successfully', 'geodirectory') // Default value for the page title - changed in settings
243
-    ),
244
-    array(
245
-        'name' => '',
246
-        'desc' => '',
247
-        'id' => 'geodir_post_published_email_content',
248
-        'css' => 'width:500px; height: 150px;',
249
-        'type' => 'textarea',
250
-        'std' => __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory')
251
-    ),
252
-
253
-    array('type' => 'sectionend', 'id' => 'client_emails'),
254
-
255
-    array('name' => __('Other Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'other_emails'),
256
-
257
-    array('name' => __('Other Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'other_emails'),
258
-
259
-    array(
260
-        'name' => __('Send to friend', 'geodirectory'),
261
-        'desc' => '',
262
-        'id' => 'geodir_email_friend_subject',
263
-        'type' => 'text',
264
-        'css' => 'min-width:300px;',
265
-        'std' => __('[#from_name#] thought you might be interested in..', 'geodirectory')
266
-    ),
267
-    array(
268
-        'name' => '',
269
-        'desc' => '',
270
-        'id' => 'geodir_email_friend_content',
271
-        'css' => 'width:500px; height: 150px;',
272
-        'type' => 'textarea',
273
-        'std' => __("<p>Dear [#to_name#],<p><p>Your friend has sent you a message from <b>[#site_name#]</b> </p><p>===============================</p><p><b>Subject : [#subject#]</b></p><p>[#comments#] [#listing_link#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name#].</p>",'geodirectory')
274
-    ),
275
-
276
-    array(
277
-        'name' => __('Email enquiry', 'geodirectory'),
278
-        'desc' => '',
279
-        'id' => 'geodir_email_enquiry_subject',
280
-        'type' => 'text',
281
-        'css' => 'min-width:300px;',
282
-        'std' => __('Website Enquiry', 'geodirectory')
283
-    ),
284
-    array(
285
-        'name' => '',
286
-        'desc' => '',
287
-        'id' => 'geodir_email_enquiry_content',
288
-        'css' => 'width:500px; height: 150px;',
289
-        'type' => 'textarea',
290
-        'std' => __("<p>Dear [#to_name#],<p><p>An enquiry has been sent from <b>[#listing_link#]</b></p><p>===============================</p><p>[#comments#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
291
-    ),
292
-
293
-    array('type' => 'sectionend', 'id' => 'other_emails'),
294
-
295
-
296
-    array('name' => __('Messages', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'messages'),
297
-
298
-    array('name' => __('Messages', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'messages'),
299
-
300
-    array(
301
-        'name' => __('Post submitted success', 'geodirectory'),
302
-        'desc' => '',
303
-        'id' => 'geodir_post_added_success_msg_content',
304
-        'css' => 'width:500px; height: 150px;',
305
-        'type' => 'textarea',
306
-        'std' => __('<p>Thank you, your information has been successfully received.</p><p><a href="[#submited_information_link#]" >View your submitted information &raquo;</a></p><p>Thank you for visiting us at [#site_name#].</p>','geodirectory')
307
-    ),
308
-
309
-
310
-    array('type' => 'sectionend', 'id' => 'messages'),
20
+	array('name' => __('Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'notification_options'),
21
+
22
+
23
+	array('name' => __('Notification Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'notification_options'),
24
+
25
+	array(
26
+		'name' => __('List of usable shortcodes', 'geodirectory'),
27
+		'desc' => __('[#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#],[#from_email#](in most cases this will be the admin email, except for popup forms)', 'geodirectory'),
28
+		'id' => 'geodir_list_of_usable_shordcodes',
29
+		'type' => 'html_content',
30
+		'css' => 'min-width:300px;',
31
+		'std' => 'All Places' // Default value for the page title - changed in settings
32
+	),
33
+
34
+	array(
35
+		'name' => __('Use advanced editor? (slow loading)', 'geodirectory'),
36
+		'desc' => __('Yes', 'geodirectory'),
37
+		'id' => 'geodir_tiny_editor',
38
+		'std' => 'yes',
39
+		'type' => 'radio',
40
+		'value' => '1',
41
+		'radiogroup' => 'start'
42
+	),
43
+	array(
44
+		'name' => __('Use advanced editor?(slow loading)', 'geodirectory'),
45
+		'desc' => __('No', 'geodirectory'),
46
+		'id' => 'geodir_tiny_editor',
47
+		'std' => 'yes',
48
+		'type' => 'radio',
49
+		'value' => '0',
50
+		'radiogroup' => 'end'
51
+	),
52
+
53
+
54
+	array('type' => 'sectionend', 'id' => 'notification_options'),
55
+
56
+
57
+	array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'site_bcc_options'),
58
+
59
+	array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'site_bcc_options'),
60
+
61
+	array(
62
+		'name' => __('New user registration', 'geodirectory'),
63
+		'desc' => __('Yes', 'geodirectory'),
64
+		'id' => 'geodir_bcc_new_user',
65
+		'std' => 'yes',
66
+		'type' => 'radio',
67
+		'value' => '1',
68
+		'radiogroup' => 'start'
69
+	),
70
+	array(
71
+		'name' => __('New user registration', 'geodirectory'),
72
+		'desc' => __('No', 'geodirectory'),
73
+		'id' => 'geodir_bcc_new_user',
74
+		'std' => 'yes',
75
+		'type' => 'radio',
76
+		'value' => '0',
77
+		'radiogroup' => 'end'
78
+	),
79
+
80
+	array(
81
+		'name' => __('Send to friend', 'geodirectory'),
82
+		'desc' => __('Yes', 'geodirectory'),
83
+		'id' => 'geodir_bcc_friend',
84
+		'std' => 'yes',
85
+		'type' => 'radio',
86
+		'value' => '1',
87
+		'radiogroup' => 'start'
88
+	),
89
+	array(
90
+		'name' => __('Send to friend', 'geodirectory'),
91
+		'desc' => __('No', 'geodirectory'),
92
+		'id' => 'geodir_bcc_friend',
93
+		'std' => 'yes',
94
+		'type' => 'radio',
95
+		'value' => '0',
96
+		'radiogroup' => 'end'
97
+	),
98
+
99
+	array(
100
+		'name' => __('Send enquiry', 'geodirectory'),
101
+		'desc' => __('Yes', 'geodirectory'),
102
+		'id' => 'geodir_bcc_enquiry',
103
+		'std' => 'yes',
104
+		'type' => 'radio',
105
+		'value' => '1',
106
+		'radiogroup' => 'start'
107
+	),
108
+	array(
109
+		'name' => __('Send enquiry', 'geodirectory'),
110
+		'desc' => __('No', 'geodirectory'),
111
+		'id' => 'geodir_bcc_enquiry',
112
+		'std' => 'yes',
113
+		'type' => 'radio',
114
+		'value' => '0',
115
+		'radiogroup' => 'end'
116
+	),
117
+
118
+
119
+	array('type' => 'sectionend', 'id' => 'site_bcc_options'),
120
+
121
+
122
+	array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'admin_emails'),
123
+
124
+	array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'admin_emails'),
125
+
126
+	array(
127
+		'name' => __('Post submit success to admin email', 'geodirectory'),
128
+		'desc' => '',
129
+		'id' => 'geodir_post_submited_success_email_subject_admin',
130
+		'type' => 'text',
131
+		'css' => 'min-width:300px;',
132
+		'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
133
+	),
134
+	 array(
135
+		'name' => '',
136
+		'desc' => '',
137
+		'id' => 'geodir_post_submited_success_email_content_admin',
138
+		'css' => 'width:500px; height: 150px;',
139
+		'type' => 'textarea',
140
+		'std' => __('<p>Dear Admin,</p><p>A new  listing has been published [#listing_link#]. This email is just for your information.</p><br><p>[#site_name#]</p>','geodirectory')
141
+	),
142
+	array(
143
+		'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
144
+		'desc' => __('Yes', 'geodirectory'),
145
+		'id' => 'geodir_notify_post_edited',
146
+		'std' => 'yes',
147
+		'type' => 'radio',
148
+		'value' => '1',
149
+		'radiogroup' => 'start'
150
+	),
151
+	array(
152
+		'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
153
+		'desc' => __('No', 'geodirectory'),
154
+		'id' => 'geodir_notify_post_edited',
155
+		'std' => 'no',
156
+		'type' => 'radio',
157
+		'value' => '0',
158
+		'radiogroup' => 'end'
159
+	),
160
+	array(
161
+		'name' => __('Listing edited by Author', 'geodirectory'),
162
+		'desc' => '',
163
+		'id' => 'geodir_post_edited_email_subject_admin',
164
+		'type' => 'text',
165
+		'css' => 'min-width:300px;',
166
+		'std' => __('[[#site_name#]] Listing edited by Author', 'geodirectory')
167
+	),
168
+	array(
169
+		'name' => '',
170
+		'desc' => '',
171
+		'id' => 'geodir_post_edited_email_content_admin',
172
+		'css' => 'width:500px; height: 150px;',
173
+		'type' => 'textarea',
174
+		'std' => __('<p>Dear Admin,</p><p>A listing [#listing_link#] has been edited by it\'s author [#post_author_name#].</p><br><p><b>Listing Details:</b></p><p>Listing ID: [#post_id#]</p><p>Listing URL: [#listing_link#]</p><p>Date: [#current_date#]</p><br><p>This email is just for your information.</p><p>[#site_name#]</p>', 'geodirectory')
175
+	),
176
+
177
+
178
+	array('type' => 'sectionend', 'id' => 'admin_emails'),
179
+
180
+
181
+	array('name' => __('Client Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'client_emails'),
182
+
183
+	array('name' => __('Client Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'client_emails'),
184
+
185
+	array(
186
+		'name' => __('Post submit success to client email', 'geodirectory'),
187
+		'desc' => '',
188
+		'id' => 'geodir_post_submited_success_email_subject',
189
+		'type' => 'text',
190
+		'css' => 'min-width:300px;',
191
+		'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
192
+	),
193
+	array(
194
+		'name' => '',
195
+		'desc' => '',
196
+		'id' => 'geodir_post_submited_success_email_content',
197
+		'css' => 'width:500px; height: 150px;',
198
+		'type' => 'textarea',
199
+		'std' => __('<p>Dear [#client_name#],</p><p>You submitted the below listing information. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>','geodirectory')
200
+	),
201
+
202
+
203
+	array(
204
+		'name' => __('User forgot password email', 'geodirectory'),
205
+		'desc' => '',
206
+		'id' => 'geodir_forgot_password_subject',
207
+		'type' => 'text',
208
+		'css' => 'min-width:300px;',
209
+		'std' => __('[#site_name#] - Your new password', 'geodirectory') // Default value for the page title - changed in settings
210
+	),
211
+	array(
212
+		'name' => '',
213
+		'desc' => '',
214
+		'id' => 'geodir_forgot_password_content',
215
+		'css' => 'width:500px; height: 150px;',
216
+		'type' => 'textarea',
217
+		'std' => __("<p>Dear [#client_name#],<p><p>You requested a new password for [#site_name_url#]</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
218
+	),
219
+
220
+	array(
221
+		'name' => __('Registration success email', 'geodirectory'),
222
+		'desc' => '',
223
+		'id' => 'geodir_registration_success_email_subject',
224
+		'type' => 'text',
225
+		'css' => 'min-width:300px;',
226
+		'std' => __('Your Log In Details', 'geodirectory') // Default value for the page title - changed in settings
227
+	),
228
+	array(
229
+		'name' => '',
230
+		'desc' => '',
231
+		'id' => 'geodir_registration_success_email_content',
232
+		'css' => 'width:500px; height: 150px;',
233
+		'type' => 'textarea',
234
+		'std' => __("<p>Dear [#client_name#],</p><p>You can log in  with the following information:</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
235
+	),
236
+	array(
237
+		'name' => __('Listing published email', 'geodirectory'),
238
+		'desc' => '',
239
+		'id' => 'geodir_post_published_email_subject',
240
+		'type' => 'text',
241
+		'css' => 'min-width:300px;',
242
+		'std' => __('Listing Published Successfully', 'geodirectory') // Default value for the page title - changed in settings
243
+	),
244
+	array(
245
+		'name' => '',
246
+		'desc' => '',
247
+		'id' => 'geodir_post_published_email_content',
248
+		'css' => 'width:500px; height: 150px;',
249
+		'type' => 'textarea',
250
+		'std' => __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory')
251
+	),
252
+
253
+	array('type' => 'sectionend', 'id' => 'client_emails'),
254
+
255
+	array('name' => __('Other Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'other_emails'),
256
+
257
+	array('name' => __('Other Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'other_emails'),
258
+
259
+	array(
260
+		'name' => __('Send to friend', 'geodirectory'),
261
+		'desc' => '',
262
+		'id' => 'geodir_email_friend_subject',
263
+		'type' => 'text',
264
+		'css' => 'min-width:300px;',
265
+		'std' => __('[#from_name#] thought you might be interested in..', 'geodirectory')
266
+	),
267
+	array(
268
+		'name' => '',
269
+		'desc' => '',
270
+		'id' => 'geodir_email_friend_content',
271
+		'css' => 'width:500px; height: 150px;',
272
+		'type' => 'textarea',
273
+		'std' => __("<p>Dear [#to_name#],<p><p>Your friend has sent you a message from <b>[#site_name#]</b> </p><p>===============================</p><p><b>Subject : [#subject#]</b></p><p>[#comments#] [#listing_link#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name#].</p>",'geodirectory')
274
+	),
275
+
276
+	array(
277
+		'name' => __('Email enquiry', 'geodirectory'),
278
+		'desc' => '',
279
+		'id' => 'geodir_email_enquiry_subject',
280
+		'type' => 'text',
281
+		'css' => 'min-width:300px;',
282
+		'std' => __('Website Enquiry', 'geodirectory')
283
+	),
284
+	array(
285
+		'name' => '',
286
+		'desc' => '',
287
+		'id' => 'geodir_email_enquiry_content',
288
+		'css' => 'width:500px; height: 150px;',
289
+		'type' => 'textarea',
290
+		'std' => __("<p>Dear [#to_name#],<p><p>An enquiry has been sent from <b>[#listing_link#]</b></p><p>===============================</p><p>[#comments#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
291
+	),
292
+
293
+	array('type' => 'sectionend', 'id' => 'other_emails'),
294
+
295
+
296
+	array('name' => __('Messages', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'messages'),
297
+
298
+	array('name' => __('Messages', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'messages'),
299
+
300
+	array(
301
+		'name' => __('Post submitted success', 'geodirectory'),
302
+		'desc' => '',
303
+		'id' => 'geodir_post_added_success_msg_content',
304
+		'css' => 'width:500px; height: 150px;',
305
+		'type' => 'textarea',
306
+		'std' => __('<p>Thank you, your information has been successfully received.</p><p><a href="[#submited_information_link#]" >View your submitted information &raquo;</a></p><p>Thank you for visiting us at [#site_name#].</p>','geodirectory')
307
+	),
308
+
309
+
310
+	array('type' => 'sectionend', 'id' => 'messages'),
311 311
 
312 312
 )); // End Manage NOtifications settings
Please login to merge, or discard this patch.