Test Failed
Push — master ( 9a1c33...395cef )
by
unknown
04:26
created
geodirectory_hooks_actions.php 1 patch
Indentation   +1135 added lines, -1135 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
 
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function geodir_unset_prev_theme_nav_location($newname)
224 224
 {
225
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
-    if ($geodir_theme_location) {
227
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
228
-    } else {
229
-        update_option('geodir_theme_location_nav', '');
230
-    }
225
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
+	if ($geodir_theme_location) {
227
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
228
+	} else {
229
+		update_option('geodir_theme_location_nav', '');
230
+	}
231 231
 }
232 232
 
233 233
 /// add action for theme switch to blank previous theme navigation location setting
@@ -248,32 +248,32 @@  discard block
 block discarded – undo
248 248
  */
249 249
 function geodir_add_post_filters()
250 250
 {
251
-    /**
252
-     * Contains all function for filtering listing.
253
-     *
254
-     * @since 1.0.0
255
-     * @package GeoDirectory
256
-     */
257
-    include_once('geodirectory-functions/listing_filters.php');
251
+	/**
252
+	 * Contains all function for filtering listing.
253
+	 *
254
+	 * @since 1.0.0
255
+	 * @package GeoDirectory
256
+	 */
257
+	include_once('geodirectory-functions/listing_filters.php');
258 258
 }
259 259
 
260 260
 
261 261
 if (!function_exists('geodir_init_defaults')) {
262
-    /**
263
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
-     *
265
-     * @since 1.0.0
266
-     * @package GeoDirectory
267
-     */
268
-    function geodir_init_defaults()
269
-    {
270
-        if (function_exists('geodir_register_defaults')) {
262
+	/**
263
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
+	 *
265
+	 * @since 1.0.0
266
+	 * @package GeoDirectory
267
+	 */
268
+	function geodir_init_defaults()
269
+	{
270
+		if (function_exists('geodir_register_defaults')) {
271 271
 
272
-            geodir_register_defaults();
272
+			geodir_register_defaults();
273 273
 
274
-        }
274
+		}
275 275
 
276
-    }
276
+	}
277 277
 }
278 278
 
279 279
 
@@ -295,26 +295,26 @@  discard block
 block discarded – undo
295 295
 // CALLED ON 'sidebars_widgets' FILTER
296 296
 
297 297
 if (!function_exists('geodir_restrict_widget')) {
298
-    /**
299
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
-     *
301
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
-     * @since 1.0.0
304
-     * @package GeoDirectory
305
-     */
306
-    function geodir_restrict_widget()
307
-    {
308
-        global $is_listing, $is_single_place;
298
+	/**
299
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
+	 *
301
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
+	 * @since 1.0.0
304
+	 * @package GeoDirectory
305
+	 */
306
+	function geodir_restrict_widget()
307
+	{
308
+		global $is_listing, $is_single_place;
309 309
 
310
-        // set is listing	
311
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
310
+		// set is listing	
311
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
312 312
 
313
-        // set is single place
314
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
313
+		// set is single place
314
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
315 315
 
316 316
 
317
-    }
317
+	}
318 318
 }
319 319
 
320 320
 
@@ -335,31 +335,31 @@  discard block
 block discarded – undo
335 335
  */
336 336
 function geodir_detail_page_sidebar_content_sorting()
337 337
 {
338
-    $arr_detail_page_sidebar_content =
339
-        /**
340
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
341
-         *
342
-         * This filter can be used to remove sections of the details page sidebar,
343
-         * add new sections or rearrange the order of the sections.
344
-         *
345
-         * @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.
346
-         * @since 1.0.0
347
-         */
348
-        apply_filters('geodir_detail_page_sidebar_content',
349
-            array('geodir_social_sharing_buttons',
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
-    }
338
+	$arr_detail_page_sidebar_content =
339
+		/**
340
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
341
+		 *
342
+		 * This filter can be used to remove sections of the details page sidebar,
343
+		 * add new sections or rearrange the order of the sections.
344
+		 *
345
+		 * @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.
346
+		 * @since 1.0.0
347
+		 */
348
+		apply_filters('geodir_detail_page_sidebar_content',
349
+			array('geodir_social_sharing_buttons',
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
 }
@@ -447,46 +447,46 @@  discard block
 block discarded – undo
447 447
  */
448 448
 function geodir_edit_post_link()
449 449
 {
450
-    global $post, $preview;
451
-    ob_start(); // Start buffering;
452
-    /**
453
-     * This is called before the edit post link html in the function geodir_edit_post_link()
454
-     *
455
-     * @since 1.0.0
456
-     */
457
-    do_action('geodir_before_edit_post_link');
458
-    if (!$preview) {
459
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
450
+	global $post, $preview;
451
+	ob_start(); // Start buffering;
452
+	/**
453
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
454
+	 *
455
+	 * @since 1.0.0
456
+	 */
457
+	do_action('geodir_before_edit_post_link');
458
+	if (!$preview) {
459
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
460 460
         
461
-        if ($is_current_user_owner) {
462
-            $post_id = $post->ID;
461
+		if ($is_current_user_owner) {
462
+			$post_id = $post->ID;
463 463
             
464
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
465
-                $post_id = (int)$_REQUEST['pid'];
466
-            }
464
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
465
+				$post_id = (int)$_REQUEST['pid'];
466
+			}
467 467
 
468
-            $postlink = get_permalink(geodir_add_listing_page_id());
469
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
470
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
471
-        }
472
-    }// end of if, if its a preview or not
473
-    /**
474
-     * This is called after the edit post link html in the function geodir_edit_post_link()
475
-     *
476
-     * @since 1.0.0
477
-     */
478
-    do_action('geodir_after_edit_post_link');
479
-    $content_html = ob_get_clean();
480
-    if (trim($content_html) != '')
481
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
482
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
483
-        /**
484
-         * Filter the geodir_edit_post_link() function content.
485
-         *
486
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
487
-         */
488
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
489
-    }
468
+			$postlink = get_permalink(geodir_add_listing_page_id());
469
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
470
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
471
+		}
472
+	}// end of if, if its a preview or not
473
+	/**
474
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
475
+	 *
476
+	 * @since 1.0.0
477
+	 */
478
+	do_action('geodir_after_edit_post_link');
479
+	$content_html = ob_get_clean();
480
+	if (trim($content_html) != '')
481
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
482
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
483
+		/**
484
+		 * Filter the geodir_edit_post_link() function content.
485
+		 *
486
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
487
+		 */
488
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
489
+	}
490 490
 }
491 491
 
492 492
 /**
@@ -500,42 +500,42 @@  discard block
 block discarded – undo
500 500
  */
501 501
 function geodir_detail_page_google_analytics()
502 502
 {
503
-    global $post,$preview;
504
-    if($preview){return '';}
505
-    $package_info = array();
506
-    $package_info = geodir_post_package_info($package_info, $post);
503
+	global $post,$preview;
504
+	if($preview){return '';}
505
+	$package_info = array();
506
+	$package_info = geodir_post_package_info($package_info, $post);
507 507
 
508
-    $id = trim(get_option('geodir_ga_account_id'));
508
+	$id = trim(get_option('geodir_ga_account_id'));
509 509
 
510
-    if (!$id) {
511
-        return; //if no Google Analytics ID then bail.
512
-    }
510
+	if (!$id) {
511
+		return; //if no Google Analytics ID then bail.
512
+	}
513 513
 
514
-    ob_start(); // Start buffering;
515
-    /**
516
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
517
-     *
518
-     * @since 1.0.0
519
-     */
520
-    do_action('geodir_before_google_analytics');
514
+	ob_start(); // Start buffering;
515
+	/**
516
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
517
+	 *
518
+	 * @since 1.0.0
519
+	 */
520
+	do_action('geodir_before_google_analytics');
521 521
     
522
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
523
-    /**
524
-     * Filter the time interval to check & refresh new users results.
525
-     *
526
-     * @since 1.5.9
527
-     *
528
-     * @param int $refresh_time Time interval to check & refresh new users results.
529
-     */
530
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
531
-    $refresh_time = absint($refresh_time * 1000);
522
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
523
+	/**
524
+	 * Filter the time interval to check & refresh new users results.
525
+	 *
526
+	 * @since 1.5.9
527
+	 *
528
+	 * @param int $refresh_time Time interval to check & refresh new users results.
529
+	 */
530
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
531
+	$refresh_time = absint($refresh_time * 1000);
532 532
     
533
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
533
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
534 534
     
535
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
536
-    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' )) ) {
537
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
538
-        ?>
535
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
536
+	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' )) ) {
537
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
538
+		?>
539 539
         <script type="text/javascript">
540 540
             var gd_gaTimeOut;
541 541
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -787,15 +787,15 @@  discard block
 block discarded – undo
787 787
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
788 788
 
789 789
                     <?php
790
-                    // Here we list the shorthand days of the week so it can be used in translation.
791
-                    __("Mon",'geodirectory');
792
-                    __("Tue",'geodirectory');
793
-                    __("Wed",'geodirectory');
794
-                    __("Thu",'geodirectory');
795
-                    __("Fri",'geodirectory');
796
-                    __("Sat",'geodirectory');
797
-                    __("Sun",'geodirectory');
798
-                    ?>
790
+					// Here we list the shorthand days of the week so it can be used in translation.
791
+					__("Mon",'geodirectory');
792
+					__("Tue",'geodirectory');
793
+					__("Wed",'geodirectory');
794
+					__("Thu",'geodirectory');
795
+					__("Fri",'geodirectory');
796
+					__("Sat",'geodirectory');
797
+					__("Sun",'geodirectory');
798
+					?>
799 799
 
800 800
                     labels = [
801 801
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1044,24 +1044,24 @@  discard block
 block discarded – undo
1044 1044
         </span>
1045 1045
 
1046 1046
     <?php
1047
-    }
1048
-    /**
1049
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1050
-     *
1051
-     * @since 1.0.0
1052
-     */
1053
-    do_action('geodir_after_google_analytics');
1054
-    $content_html = ob_get_clean();
1055
-    if (trim($content_html) != '')
1056
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1057
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1058
-        /**
1059
-         * Filter the geodir_edit_post_link() function content.
1060
-         *
1061
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1062
-         */
1063
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1064
-    }
1047
+	}
1048
+	/**
1049
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1050
+	 *
1051
+	 * @since 1.0.0
1052
+	 */
1053
+	do_action('geodir_after_google_analytics');
1054
+	$content_html = ob_get_clean();
1055
+	if (trim($content_html) != '')
1056
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1057
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1058
+		/**
1059
+		 * Filter the geodir_edit_post_link() function content.
1060
+		 *
1061
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1062
+		 */
1063
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1064
+	}
1065 1065
 }
1066 1066
 
1067 1067
 /**
@@ -1077,90 +1077,90 @@  discard block
 block discarded – undo
1077 1077
  */
1078 1078
 function geodir_detail_page_review_rating()
1079 1079
 {
1080
-    global $post, $preview, $post_images;
1081
-    ob_start(); // Start  buffering;
1082
-    /**
1083
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1084
-     *
1085
-     * This is called outside the check for an actual rating and the check for preview page.
1086
-     *
1087
-     * @since 1.0.0
1088
-     */
1089
-    do_action('geodir_before_detail_page_review_rating');
1090
-
1091
-    $comment_count = geodir_get_review_count_total($post->ID);
1092
-    $post_avgratings = geodir_get_post_rating($post->ID);
1093
-
1094
-    if ($post_avgratings != 0 && !$preview) {
1095
-        /**
1096
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1097
-         *
1098
-         * This is called inside the check for an actual rating and the check for preview page.
1099
-         *
1100
-         * @since 1.0.0
1101
-         * @param float $post_avgratings Average rating for the surrent post.
1102
-         * @param int $post->ID Current post ID.
1103
-         */
1104
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1105
-
1106
-        $html = '<p style=" float:left;">';
1107
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1108
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1109
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1080
+	global $post, $preview, $post_images;
1081
+	ob_start(); // Start  buffering;
1082
+	/**
1083
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1084
+	 *
1085
+	 * This is called outside the check for an actual rating and the check for preview page.
1086
+	 *
1087
+	 * @since 1.0.0
1088
+	 */
1089
+	do_action('geodir_before_detail_page_review_rating');
1090
+
1091
+	$comment_count = geodir_get_review_count_total($post->ID);
1092
+	$post_avgratings = geodir_get_post_rating($post->ID);
1093
+
1094
+	if ($post_avgratings != 0 && !$preview) {
1095
+		/**
1096
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1097
+		 *
1098
+		 * This is called inside the check for an actual rating and the check for preview page.
1099
+		 *
1100
+		 * @since 1.0.0
1101
+		 * @param float $post_avgratings Average rating for the surrent post.
1102
+		 * @param int $post->ID Current post ID.
1103
+		 */
1104
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1105
+
1106
+		$html = '<p style=" float:left;">';
1107
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1108
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1109
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1110 1110
        
1111 1111
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1112 1112
 	   
1113 1113
 	   $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 />';
1114 1114
 
1115
-        $html .= '<span class="item">';
1116
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1115
+		$html .= '<span class="item">';
1116
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1117 1117
 
1118
-        if ($post_images) {
1119
-            foreach ($post_images as $img) {
1120
-                $post_img = $img->src;
1121
-                break;
1122
-            }
1123
-        }
1124
-
1125
-        if (isset($post_img) && $post_img) {
1126
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1127
-        }
1128
-
1129
-        $html .= '</span>';
1130
-
1131
-        echo $html .= '</div>';
1132
-        /**
1133
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1134
-         *
1135
-         * This is called inside the check for an actual rating and the check for preview page.
1136
-         *
1137
-         * @since 1.0.0
1138
-         * @param float $post_avgratings Average rating for the surrent post.
1139
-         * @param int $post->ID Current post ID.
1140
-         */
1141
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1142
-    }
1143
-    /**
1144
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1145
-     *
1146
-     * This is called outside the check for an actual rating and the check for preview page.
1147
-     *
1148
-     * @since 1.0.0
1149
-     */
1150
-    do_action('geodir_after_detail_page_review_rating');
1151
-    $content_html = ob_get_clean();
1152
-    if (trim($content_html) != '') {
1153
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1154
-    }
1155
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1156
-        /**
1157
-         * Filter the geodir_detail_page_review_rating() function content.
1158
-         *
1159
-         * @since 1.0.0
1160
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1161
-         */
1162
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1163
-    }
1118
+		if ($post_images) {
1119
+			foreach ($post_images as $img) {
1120
+				$post_img = $img->src;
1121
+				break;
1122
+			}
1123
+		}
1124
+
1125
+		if (isset($post_img) && $post_img) {
1126
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1127
+		}
1128
+
1129
+		$html .= '</span>';
1130
+
1131
+		echo $html .= '</div>';
1132
+		/**
1133
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1134
+		 *
1135
+		 * This is called inside the check for an actual rating and the check for preview page.
1136
+		 *
1137
+		 * @since 1.0.0
1138
+		 * @param float $post_avgratings Average rating for the surrent post.
1139
+		 * @param int $post->ID Current post ID.
1140
+		 */
1141
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1142
+	}
1143
+	/**
1144
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1145
+	 *
1146
+	 * This is called outside the check for an actual rating and the check for preview page.
1147
+	 *
1148
+	 * @since 1.0.0
1149
+	 */
1150
+	do_action('geodir_after_detail_page_review_rating');
1151
+	$content_html = ob_get_clean();
1152
+	if (trim($content_html) != '') {
1153
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1154
+	}
1155
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1156
+		/**
1157
+		 * Filter the geodir_detail_page_review_rating() function content.
1158
+		 *
1159
+		 * @since 1.0.0
1160
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1161
+		 */
1162
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1163
+	}
1164 1164
 }
1165 1165
 
1166 1166
 /**
@@ -1172,35 +1172,35 @@  discard block
 block discarded – undo
1172 1172
  */
1173 1173
 function geodir_detail_page_more_info()
1174 1174
 {
1175
-    ob_start(); // Start  buffering;
1176
-    /**
1177
-     * This is called before the info section html.
1178
-     *
1179
-     * @since 1.0.0
1180
-     */
1181
-    do_action('geodir_before_detail_page_more_info');
1182
-    if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1183
-        echo $geodir_post_detail_fields;
1184
-    }
1185
-    /**
1186
-     * This is called after the info section html.
1187
-     *
1188
-     * @since 1.0.0
1189
-     */
1190
-    do_action('geodir_after_detail_page_more_info');
1191
-
1192
-    $content_html = ob_get_clean();
1193
-    if (trim($content_html) != '')
1194
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1195
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1196
-        /**
1197
-         * Filter the output html for function geodir_detail_page_more_info().
1198
-         *
1199
-         * @since 1.0.0
1200
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1201
-         */
1202
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1203
-    }
1175
+	ob_start(); // Start  buffering;
1176
+	/**
1177
+	 * This is called before the info section html.
1178
+	 *
1179
+	 * @since 1.0.0
1180
+	 */
1181
+	do_action('geodir_before_detail_page_more_info');
1182
+	if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1183
+		echo $geodir_post_detail_fields;
1184
+	}
1185
+	/**
1186
+	 * This is called after the info section html.
1187
+	 *
1188
+	 * @since 1.0.0
1189
+	 */
1190
+	do_action('geodir_after_detail_page_more_info');
1191
+
1192
+	$content_html = ob_get_clean();
1193
+	if (trim($content_html) != '')
1194
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1195
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1196
+		/**
1197
+		 * Filter the output html for function geodir_detail_page_more_info().
1198
+		 *
1199
+		 * @since 1.0.0
1200
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1201
+		 */
1202
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1203
+	}
1204 1204
 }
1205 1205
 
1206 1206
 
@@ -1214,15 +1214,15 @@  discard block
 block discarded – undo
1214 1214
  */
1215 1215
 function geodir_localize_all_js_msg()
1216 1216
 {// 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
1217
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1218
-        $ajax_url = admin_url('admin-ajax.php');
1219
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1220
-        $ajax_url = admin_url('admin-ajax.php');
1221
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1222
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1223
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1224
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1225
-    }
1217
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1218
+		$ajax_url = admin_url('admin-ajax.php');
1219
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1220
+		$ajax_url = admin_url('admin-ajax.php');
1221
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1222
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1223
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1224
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1225
+	}
1226 1226
 	
1227 1227
 	/**
1228 1228
 	 * Filter the allowed image type extensions for post images.
@@ -1232,60 +1232,60 @@  discard block
 block discarded – undo
1232 1232
 	 */
1233 1233
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1234 1234
 	
1235
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1236
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1237
-    $default_marker_width = $default_marker_size['w'];
1238
-    $default_marker_height = $default_marker_size['h'];
1235
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1236
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1237
+	$default_marker_width = $default_marker_size['w'];
1238
+	$default_marker_height = $default_marker_size['h'];
1239 1239
     
1240
-    $arr_alert_msg = array(
1241
-        'geodir_plugin_url' => geodir_plugin_url(),
1242
-        'geodir_admin_ajax_url' => $ajax_url,
1243
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1244
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1245
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1246
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1247
-        //start not show alert msg
1248
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1249
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1250
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1251
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1252
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1253
-        // end not show alert msg
1254
-        'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1255
-        'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
1256
-        //start not show alert msg
1257
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1258
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1259
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1260
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1261
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1262
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1263
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1264
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1265
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1266
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1267
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1268
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1269
-        'geodir_default_marker_icon' => $default_marker_icon,
1270
-        'geodir_default_marker_w' => $default_marker_width,
1271
-        'geodir_default_marker_h' => $default_marker_height,
1272
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1273
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1274
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1275
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1276
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1277
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1278
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1279
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1280
-        /* on/off dragging for phone devices */
1281
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1282
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1283
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1284
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1285
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1286
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1287
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1288
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1240
+	$arr_alert_msg = array(
1241
+		'geodir_plugin_url' => geodir_plugin_url(),
1242
+		'geodir_admin_ajax_url' => $ajax_url,
1243
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1244
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1245
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1246
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1247
+		//start not show alert msg
1248
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1249
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1250
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1251
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1252
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1253
+		// end not show alert msg
1254
+		'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1255
+		'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
1256
+		//start not show alert msg
1257
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1258
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1259
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1260
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1261
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1262
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1263
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1264
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1265
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1266
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1267
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1268
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1269
+		'geodir_default_marker_icon' => $default_marker_icon,
1270
+		'geodir_default_marker_w' => $default_marker_width,
1271
+		'geodir_default_marker_h' => $default_marker_height,
1272
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1273
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1274
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1275
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1276
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1277
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1278
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1279
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1280
+		/* on/off dragging for phone devices */
1281
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1282
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1283
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1284
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1285
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1286
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1287
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1288
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1289 1289
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1290 1290
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1291 1291
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1293,40 +1293,40 @@  discard block
 block discarded – undo
1293 1293
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1294 1294
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1295 1295
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1296
-        'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1297
-        'geodir_map_name' => geodir_map_name(),
1298
-        'osmStart' => __('Start', 'geodirectory'),
1299
-        'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1300
-        'osmEnd' => __('Enter Your Location', 'geodirectory'),
1301
-        'ga_delete_check' => __('Are you wish to Deauthorize and break Analytics?', 'geodirectory'),
1302
-        'geoMyLocation' => __('My Location', 'geodirectory'),
1303
-        'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1304
-        'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1305
-        'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1306
-        'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1307
-        'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1308
-    );
1309
-
1310
-    /**
1311
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1312
-     *
1313
-     * With this filter you can add, remove or change translated JS strings.
1314
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1315
-     *
1316
-     * @since 1.0.0
1317
-     */
1318
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1319
-
1320
-    foreach ($arr_alert_msg as $key => $value) {
1321
-        if (!is_scalar($value))
1322
-            continue;
1323
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1324
-    }
1296
+		'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1297
+		'geodir_map_name' => geodir_map_name(),
1298
+		'osmStart' => __('Start', 'geodirectory'),
1299
+		'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1300
+		'osmEnd' => __('Enter Your Location', 'geodirectory'),
1301
+		'ga_delete_check' => __('Are you wish to Deauthorize and break Analytics?', 'geodirectory'),
1302
+		'geoMyLocation' => __('My Location', 'geodirectory'),
1303
+		'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1304
+		'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1305
+		'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1306
+		'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1307
+		'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1308
+	);
1309
+
1310
+	/**
1311
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1312
+	 *
1313
+	 * With this filter you can add, remove or change translated JS strings.
1314
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1315
+	 *
1316
+	 * @since 1.0.0
1317
+	 */
1318
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1325 1319
 
1326
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1327
-    echo '<script>';
1328
-    echo $script;
1329
-    echo '</script>';
1320
+	foreach ($arr_alert_msg as $key => $value) {
1321
+		if (!is_scalar($value))
1322
+			continue;
1323
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1324
+	}
1325
+
1326
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1327
+	echo '<script>';
1328
+	echo $script;
1329
+	echo '</script>';
1330 1330
 }
1331 1331
 
1332 1332
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1342,11 +1342,11 @@  discard block
 block discarded – undo
1342 1342
  */
1343 1343
 function geodir_admin_bar_site_menu($wp_admin_bar)
1344 1344
 {
1345
-    if (get_option("geodir_installed")) {
1346
-        if (current_user_can('manage_options')) {
1347
-            $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1348
-        }
1349
-    }
1345
+	if (get_option("geodir_installed")) {
1346
+		if (current_user_can('manage_options')) {
1347
+			$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1348
+		}
1349
+	}
1350 1350
 }
1351 1351
 
1352 1352
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1372,25 +1372,25 @@  discard block
 block discarded – undo
1372 1372
  */
1373 1373
 function geodir_store_sidebars()
1374 1374
 {
1375
-    global $geodir_sidebars;
1376
-    global $sidebars_widgets;
1377
-
1378
-    if (!is_array($sidebars_widgets))
1379
-        $sidebars_widgets = wp_get_sidebars_widgets();
1380
-    $geodir_old_sidebars = array();
1381
-
1382
-    if (is_array($geodir_sidebars)) {
1383
-        foreach ($geodir_sidebars as $val) {
1384
-            if (is_array($sidebars_widgets)) {
1385
-                if (array_key_exists($val, $sidebars_widgets))
1386
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1387
-                else
1388
-                    $geodir_old_sidebars[$val] = array();
1389
-            }
1390
-        }
1391
-    }
1392
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1393
-    geodir_option_version_backup('geodir_sidebars');
1375
+	global $geodir_sidebars;
1376
+	global $sidebars_widgets;
1377
+
1378
+	if (!is_array($sidebars_widgets))
1379
+		$sidebars_widgets = wp_get_sidebars_widgets();
1380
+	$geodir_old_sidebars = array();
1381
+
1382
+	if (is_array($geodir_sidebars)) {
1383
+		foreach ($geodir_sidebars as $val) {
1384
+			if (is_array($sidebars_widgets)) {
1385
+				if (array_key_exists($val, $sidebars_widgets))
1386
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1387
+				else
1388
+					$geodir_old_sidebars[$val] = array();
1389
+			}
1390
+		}
1391
+	}
1392
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1393
+	geodir_option_version_backup('geodir_sidebars');
1394 1394
 
1395 1395
 }
1396 1396
 
@@ -1404,28 +1404,28 @@  discard block
 block discarded – undo
1404 1404
  */
1405 1405
 function geodir_restore_sidebars()
1406 1406
 {
1407
-    global $sidebars_widgets;
1408
-
1409
-    if (!is_array($sidebars_widgets))
1410
-        $sidebars_widgets = wp_get_sidebars_widgets();
1411
-
1412
-    if (is_array($sidebars_widgets)) {
1413
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1414
-        if (is_array($geodir_old_sidebars)) {
1415
-            foreach ($geodir_old_sidebars as $key => $val) {
1416
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1417
-                {
1418
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1419
-                }
1407
+	global $sidebars_widgets;
1420 1408
 
1409
+	if (!is_array($sidebars_widgets))
1410
+		$sidebars_widgets = wp_get_sidebars_widgets();
1421 1411
 
1422
-            }
1423
-        }
1412
+	if (is_array($sidebars_widgets)) {
1413
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1414
+		if (is_array($geodir_old_sidebars)) {
1415
+			foreach ($geodir_old_sidebars as $key => $val) {
1416
+				if(0 === strpos($key, 'geodir_'))// if gd widget
1417
+				{
1418
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1419
+				}
1424 1420
 
1425
-    }
1426 1421
 
1427
-    update_option('sidebars_widgets', $sidebars_widgets);
1428
-    update_option('geodir_sidebars', '');
1422
+			}
1423
+		}
1424
+
1425
+	}
1426
+
1427
+	update_option('sidebars_widgets', $sidebars_widgets);
1428
+	update_option('geodir_sidebars', '');
1429 1429
 }
1430 1430
 
1431 1431
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1438,9 +1438,9 @@  discard block
 block discarded – undo
1438 1438
  */
1439 1439
 function geodir_after_listing_post_gridview()
1440 1440
 {
1441
-    global $gridview_columns;
1441
+	global $gridview_columns;
1442 1442
 
1443
-    $gridview_columns = '';
1443
+	$gridview_columns = '';
1444 1444
 
1445 1445
 }
1446 1446
 
@@ -1468,11 +1468,11 @@  discard block
 block discarded – undo
1468 1468
  */
1469 1469
 function so_handle_038($url, $original_url, $_context)
1470 1470
 {
1471
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1472
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1473
-    }
1471
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1472
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1473
+	}
1474 1474
 
1475
-    return $url;
1475
+	return $url;
1476 1476
 }
1477 1477
 
1478 1478
 
@@ -1488,34 +1488,34 @@  discard block
 block discarded – undo
1488 1488
 function geodir_after_main_form_fields() {
1489 1489
 	global $gd_session;
1490 1490
 	
1491
-    if (get_option('geodir_accept_term_condition')) {
1492
-        global $post;
1493
-        $term_condition = '';
1494
-        if (isset($_REQUEST['backandedit'])) {
1495
-            $post = (object)$gd_session->get('listing');
1496
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1497
-        }
1498
-
1499
-        ?>
1491
+	if (get_option('geodir_accept_term_condition')) {
1492
+		global $post;
1493
+		$term_condition = '';
1494
+		if (isset($_REQUEST['backandedit'])) {
1495
+			$post = (object)$gd_session->get('listing');
1496
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1497
+		}
1498
+
1499
+		?>
1500 1500
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1501 1501
             <label>&nbsp;</label>
1502 1502
 
1503 1503
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1504 1504
 				<span style="display:block"> 
1505 1505
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1506
-                    echo 'checked="checked"';
1507
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1506
+					echo 'checked="checked"';
1507
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1508 1508
                        class="geodir_textfield" value="1"
1509 1509
                        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>
1510 1510
 				</span>
1511 1511
             </div>
1512 1512
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1513
-                    _e($required_msg, 'geodirectory');
1514
-                } ?></span>
1513
+					_e($required_msg, 'geodirectory');
1514
+				} ?></span>
1515 1515
         </div>
1516 1516
     <?php
1517 1517
 
1518
-    }
1518
+	}
1519 1519
 }
1520 1520
 
1521 1521
 
@@ -1540,42 +1540,42 @@  discard block
 block discarded – undo
1540 1540
  */
1541 1541
 function geodir_detail_page_tab_is_display($is_display, $tab)
1542 1542
 {
1543
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1543
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1544 1544
 
1545
-    if ($tab == 'post_profile') {
1546
-        /** This action is documented in geodirectory_template_actions.php */
1547
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1545
+	if ($tab == 'post_profile') {
1546
+		/** This action is documented in geodirectory_template_actions.php */
1547
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1548 1548
         
1549
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1550
-            $is_display = false;
1551
-        }
1552
-    }
1549
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1550
+			$is_display = false;
1551
+		}
1552
+	}
1553 1553
     
1554
-    if ($tab == 'post_info')
1555
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1554
+	if ($tab == 'post_info')
1555
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1556 1556
     
1557
-    if ($tab == 'post_images')
1558
-        $is_display = (!empty($post_images)) ? true : false;
1557
+	if ($tab == 'post_images')
1558
+		$is_display = (!empty($post_images)) ? true : false;
1559 1559
 
1560
-    if ($tab == 'post_video')
1561
-        $is_display = (!empty($video)) ? true : false;
1560
+	if ($tab == 'post_video')
1561
+		$is_display = (!empty($video)) ? true : false;
1562 1562
 
1563
-    if ($tab == 'special_offers')
1564
-        $is_display = (!empty($special_offers)) ? true : false;
1563
+	if ($tab == 'special_offers')
1564
+		$is_display = (!empty($special_offers)) ? true : false;
1565 1565
 
1566
-    if ($tab == 'reviews')
1567
-        $is_display = (geodir_is_page('detail')) ? true : false;
1566
+	if ($tab == 'reviews')
1567
+		$is_display = (geodir_is_page('detail')) ? true : false;
1568 1568
 
1569
-    if ($tab == 'related_listing') {
1570
-       $message = __('No listings found which match your selection.', 'geodirectory');
1569
+	if ($tab == 'related_listing') {
1570
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1571 1571
        
1572
-       /** This action is documented in geodirectory-functions/template_functions.php */
1573
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1572
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1573
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1574 1574
        
1575
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1576
-    }
1575
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1576
+	}
1577 1577
 
1578
-    return $is_display;
1578
+	return $is_display;
1579 1579
 }
1580 1580
 
1581 1581
 
@@ -1591,69 +1591,69 @@  discard block
 block discarded – undo
1591 1591
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1592 1592
  */
1593 1593
 function geodir_changes_in_custom_fields_table() {
1594
-    global $wpdb, $plugin_prefix;
1594
+	global $wpdb, $plugin_prefix;
1595 1595
 	
1596 1596
 	// Remove unused virtual page
1597 1597
 	$listings_page_id = (int)get_option('geodir_listing_page');
1598 1598
 	if ($listings_page_id) {
1599 1599
 		$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')));
1600
-        delete_option('geodir_listing_page');
1600
+		delete_option('geodir_listing_page');
1601 1601
 	}
1602 1602
 
1603
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1604
-        $wpdb->query(
1605
-            $wpdb->prepare(
1606
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1607
-                array('1', '1', 'admin')
1608
-            )
1609
-        );
1603
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1604
+		$wpdb->query(
1605
+			$wpdb->prepare(
1606
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1607
+				array('1', '1', 'admin')
1608
+			)
1609
+		);
1610 1610
 
1611 1611
 
1612
-        /* --- terms meta value set --- */
1612
+		/* --- terms meta value set --- */
1613 1613
 
1614
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1614
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1615 1615
 
1616
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1616
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1617 1617
 
1618
-        if (!empty($options_data)) {
1618
+		if (!empty($options_data)) {
1619 1619
 
1620
-            foreach ($options_data as $optobj) {
1620
+			foreach ($options_data as $optobj) {
1621 1621
 
1622
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1622
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1623 1623
 
1624
-                $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)));
1624
+				$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)));
1625 1625
 
1626
-                if (!empty($taxonomies_data)) {
1626
+				if (!empty($taxonomies_data)) {
1627 1627
 
1628
-                    foreach ($taxonomies_data as $taxobj) {
1628
+					foreach ($taxonomies_data as $taxobj) {
1629 1629
 
1630
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1631
-                        $post_type = $taxObject->object_type[0];
1630
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1631
+						$post_type = $taxObject->object_type[0];
1632 1632
 
1633
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1633
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1634 1634
 
1635
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1635
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1636 1636
 
1637
-                        if ($duplicate_data) {
1637
+						if ($duplicate_data) {
1638 1638
 
1639
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1639
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1640 1640
 
1641
-                        } else {
1641
+						} else {
1642 1642
 
1643
-                            $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)));
1643
+							$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)));
1644 1644
 
1645
-                        }
1645
+						}
1646 1646
 
1647
-                    }
1647
+					}
1648 1648
 
1649
-                }
1649
+				}
1650 1650
 
1651
-            }
1652
-        }
1651
+			}
1652
+		}
1653 1653
 
1654
-        update_option('geodir_changes_in_custom_fields_table', '1');
1654
+		update_option('geodir_changes_in_custom_fields_table', '1');
1655 1655
 
1656
-    }
1656
+	}
1657 1657
 
1658 1658
 }
1659 1659
 
@@ -1672,24 +1672,24 @@  discard block
 block discarded – undo
1672 1672
 function geodir_location_slug_check($slug)
1673 1673
 {
1674 1674
 
1675
-    global $wpdb, $table_prefix;
1675
+	global $wpdb, $table_prefix;
1676 1676
 
1677
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1677
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1678 1678
 
1679
-    if ($slug_exists) {
1679
+	if ($slug_exists) {
1680 1680
 
1681
-        $suffix = 1;
1682
-        do {
1683
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1684
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1685
-            $suffix++;
1686
-        } while ($location_slug_check && $suffix < 100);
1681
+		$suffix = 1;
1682
+		do {
1683
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1684
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1685
+			$suffix++;
1686
+		} while ($location_slug_check && $suffix < 100);
1687 1687
 
1688
-        $slug = $alt_location_name;
1688
+		$slug = $alt_location_name;
1689 1689
 
1690
-    }
1690
+	}
1691 1691
 
1692
-    return $slug;
1692
+	return $slug;
1693 1693
 
1694 1694
 }
1695 1695
 
@@ -1714,42 +1714,42 @@  discard block
 block discarded – undo
1714 1714
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1715 1715
 {
1716 1716
 
1717
-    global $wpdb, $plugin_prefix, $table_prefix;
1717
+	global $wpdb, $plugin_prefix, $table_prefix;
1718 1718
 
1719
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1719
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1720 1720
 
1721
-    $slug = $tern_data->slug;
1721
+	$slug = $tern_data->slug;
1722 1722
 
1723
-    /**
1724
-     * Filter if a term slug exists.
1725
-     *
1726
-     * @since 1.0.0
1727
-     * @package GeoDirectory
1728
-     * @param bool $bool Default: false.
1729
-     * @param string $slug The term slug.
1730
-     * @param int $term_id The term ID.
1731
-     */
1732
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1723
+	/**
1724
+	 * Filter if a term slug exists.
1725
+	 *
1726
+	 * @since 1.0.0
1727
+	 * @package GeoDirectory
1728
+	 * @param bool $bool Default: false.
1729
+	 * @param string $slug The term slug.
1730
+	 * @param int $term_id The term ID.
1731
+	 */
1732
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1733 1733
 
1734
-    if ($slug_exists) {
1734
+	if ($slug_exists) {
1735 1735
 
1736
-        $suffix = 1;
1737
-        do {
1738
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1736
+		$suffix = 1;
1737
+		do {
1738
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1739 1739
 
1740
-            /** This action is documented in geodirectory_hooks_actions.php */
1741
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1740
+			/** This action is documented in geodirectory_hooks_actions.php */
1741
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1742 1742
 
1743
-            $suffix++;
1744
-        } while ($term_slug_check && $suffix < 100);
1743
+			$suffix++;
1744
+		} while ($term_slug_check && $suffix < 100);
1745 1745
 
1746
-        $slug = $new_slug;
1746
+		$slug = $new_slug;
1747 1747
 
1748
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1748
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1749 1749
 
1750
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1750
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1751 1751
 
1752
-    }
1752
+	}
1753 1753
 	
1754 1754
 	// Update tag in detail table.
1755 1755
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1790,21 +1790,21 @@  discard block
 block discarded – undo
1790 1790
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1791 1791
 {
1792 1792
 
1793
-    global $wpdb, $table_prefix;
1793
+	global $wpdb, $table_prefix;
1794 1794
 
1795
-    $default_location = geodir_get_default_location();
1795
+	$default_location = geodir_get_default_location();
1796 1796
 
1797
-    $country_slug = $default_location->country_slug;
1798
-    $region_slug = $default_location->region_slug;
1799
-    $city_slug = $default_location->city_slug;
1797
+	$country_slug = $default_location->country_slug;
1798
+	$region_slug = $default_location->region_slug;
1799
+	$city_slug = $default_location->city_slug;
1800 1800
 
1801
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1802
-        return $slug_exists = true;
1801
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1802
+		return $slug_exists = true;
1803 1803
 
1804
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1805
-        return $slug_exists = true;
1804
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1805
+		return $slug_exists = true;
1806 1806
 
1807
-    return $slug_exists;
1807
+	return $slug_exists;
1808 1808
 }
1809 1809
 
1810 1810
 
@@ -1823,75 +1823,75 @@  discard block
 block discarded – undo
1823 1823
  */
1824 1824
 function geodir_custom_page_title($title = '', $sep = '')
1825 1825
 {
1826
-    global $wp;
1827
-    if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1828
-        return $title;
1829
-    }
1826
+	global $wp;
1827
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1828
+		return $title;
1829
+	}
1830 1830
 
1831
-    if ($sep == '') {
1832
-        /**
1833
-         * Filter the page title separator.
1834
-         *
1835
-         * @since 1.0.0
1836
-         * @package GeoDirectory
1837
-         * @param string $sep The separator, default: `|`.
1838
-         */
1839
-        $sep = apply_filters('geodir_page_title_separator', '|');
1840
-    }
1831
+	if ($sep == '') {
1832
+		/**
1833
+		 * Filter the page title separator.
1834
+		 *
1835
+		 * @since 1.0.0
1836
+		 * @package GeoDirectory
1837
+		 * @param string $sep The separator, default: `|`.
1838
+		 */
1839
+		$sep = apply_filters('geodir_page_title_separator', '|');
1840
+	}
1841 1841
 
1842 1842
 
1843
-    $gd_page = '';
1844
-    if(geodir_is_page('home')){
1845
-        $gd_page = 'home';
1846
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1847
-    }
1848
-    elseif(geodir_is_page('detail')){
1849
-        $gd_page = 'detail';
1850
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1851
-    }
1852
-    elseif(geodir_is_page('pt')){
1853
-        $gd_page = 'pt';
1854
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1855
-    }
1856
-    elseif(geodir_is_page('listing')){
1857
-        $gd_page = 'listing';
1858
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1859
-    }
1860
-    elseif(geodir_is_page('location')){
1861
-        $gd_page = 'location';
1862
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1863
-    }
1864
-    elseif(geodir_is_page('search')){
1865
-        $gd_page = 'search';
1866
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1867
-    }
1868
-    elseif(geodir_is_page('add-listing')){
1869
-        $gd_page = 'add-listing';
1870
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1871
-    }
1872
-    elseif(geodir_is_page('author')){
1873
-        $gd_page = 'author';
1874
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1875
-    }
1876
-    elseif(geodir_is_page('login')){
1877
-        $gd_page = 'login';
1878
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1879
-    }
1880
-    elseif(geodir_is_page('listing-success')){
1881
-        $gd_page = 'listing-success';
1882
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1883
-    }
1843
+	$gd_page = '';
1844
+	if(geodir_is_page('home')){
1845
+		$gd_page = 'home';
1846
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1847
+	}
1848
+	elseif(geodir_is_page('detail')){
1849
+		$gd_page = 'detail';
1850
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1851
+	}
1852
+	elseif(geodir_is_page('pt')){
1853
+		$gd_page = 'pt';
1854
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1855
+	}
1856
+	elseif(geodir_is_page('listing')){
1857
+		$gd_page = 'listing';
1858
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1859
+	}
1860
+	elseif(geodir_is_page('location')){
1861
+		$gd_page = 'location';
1862
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1863
+	}
1864
+	elseif(geodir_is_page('search')){
1865
+		$gd_page = 'search';
1866
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1867
+	}
1868
+	elseif(geodir_is_page('add-listing')){
1869
+		$gd_page = 'add-listing';
1870
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1871
+	}
1872
+	elseif(geodir_is_page('author')){
1873
+		$gd_page = 'author';
1874
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1875
+	}
1876
+	elseif(geodir_is_page('login')){
1877
+		$gd_page = 'login';
1878
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1879
+	}
1880
+	elseif(geodir_is_page('listing-success')){
1881
+		$gd_page = 'listing-success';
1882
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1883
+	}
1884 1884
 
1885 1885
 
1886
-    /**
1887
-     * Filter page meta title to replace variables.
1888
-     *
1889
-     * @since 1.5.4
1890
-     * @param string $title The page title including variables.
1891
-     * @param string $gd_page The GeoDirectory page type if any.
1892
-     * @param string $sep The title separator symbol.
1893
-     */
1894
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1886
+	/**
1887
+	 * Filter page meta title to replace variables.
1888
+	 *
1889
+	 * @since 1.5.4
1890
+	 * @param string $title The page title including variables.
1891
+	 * @param string $gd_page The GeoDirectory page type if any.
1892
+	 * @param string $sep The title separator symbol.
1893
+	 */
1894
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1895 1895
 
1896 1896
 }
1897 1897
 
@@ -1907,36 +1907,36 @@  discard block
 block discarded – undo
1907 1907
 function geodir_set_post_attachment()
1908 1908
 {
1909 1909
 
1910
-    if (!get_option('geodir_set_post_attachments')) {
1910
+	if (!get_option('geodir_set_post_attachments')) {
1911 1911
 
1912
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1913
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1912
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1913
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1914 1914
 
1915
-        $all_postypes = geodir_get_posttypes();
1915
+		$all_postypes = geodir_get_posttypes();
1916 1916
 
1917
-        foreach($all_postypes as $post_type){
1918
-            $args = array(
1919
-                'posts_per_page' => -1,
1920
-                'post_type' => $post_type,
1921
-                'post_status' => 'publish');
1917
+		foreach($all_postypes as $post_type){
1918
+			$args = array(
1919
+				'posts_per_page' => -1,
1920
+				'post_type' => $post_type,
1921
+				'post_status' => 'publish');
1922 1922
 
1923
-            $posts_array = get_posts($args);
1923
+			$posts_array = get_posts($args);
1924 1924
 
1925
-            if (!empty($posts_array)) {
1925
+			if (!empty($posts_array)) {
1926 1926
 
1927
-                foreach ($posts_array as $post) {
1927
+				foreach ($posts_array as $post) {
1928 1928
 
1929
-                    geodir_set_wp_featured_image($post->ID);
1929
+					geodir_set_wp_featured_image($post->ID);
1930 1930
 
1931
-                }
1931
+				}
1932 1932
 
1933
-            }
1934
-        }
1933
+			}
1934
+		}
1935 1935
 
1936 1936
 
1937
-        update_option('geodir_set_post_attachments', '1');
1937
+		update_option('geodir_set_post_attachments', '1');
1938 1938
 
1939
-    }
1939
+	}
1940 1940
 
1941 1941
 }
1942 1942
 
@@ -1953,19 +1953,19 @@  discard block
 block discarded – undo
1953 1953
 function geodir_remove_url_seperator()
1954 1954
 {
1955 1955
 
1956
-    if (!get_option('geodir_remove_url_seperator')) {
1956
+	if (!get_option('geodir_remove_url_seperator')) {
1957 1957
 
1958
-        if (get_option('geodir_listingurl_separator'))
1959
-            delete_option('geodir_listingurl_separator');
1958
+		if (get_option('geodir_listingurl_separator'))
1959
+			delete_option('geodir_listingurl_separator');
1960 1960
 
1961
-        if (get_option('geodir_detailurl_separator'))
1962
-            delete_option('geodir_detailurl_separator');
1961
+		if (get_option('geodir_detailurl_separator'))
1962
+			delete_option('geodir_detailurl_separator');
1963 1963
 
1964
-        flush_rewrite_rules(false);
1964
+		flush_rewrite_rules(false);
1965 1965
 
1966
-        update_option('geodir_remove_url_seperator', '1');
1966
+		update_option('geodir_remove_url_seperator', '1');
1967 1967
 
1968
-    }
1968
+	}
1969 1969
 
1970 1970
 }
1971 1971
 
@@ -1981,19 +1981,19 @@  discard block
 block discarded – undo
1981 1981
  */
1982 1982
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
1983 1983
 {
1984
-    foreach ($permalink_arr as $key => $value) {
1984
+	foreach ($permalink_arr as $key => $value) {
1985 1985
 
1986
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1987
-            unset($permalink_arr[$key]);
1986
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1987
+			unset($permalink_arr[$key]);
1988 1988
 
1989
-    }
1989
+	}
1990 1990
 
1991
-    return $permalink_arr;
1991
+	return $permalink_arr;
1992 1992
 
1993 1993
 }
1994 1994
 
1995 1995
 if (!is_admin()) {
1996
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
1996
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
1997 1997
 }
1998 1998
 /**
1999 1999
  * Set status from draft to publish.
@@ -2006,16 +2006,16 @@  discard block
 block discarded – undo
2006 2006
  */
2007 2007
 function geodir_set_status_draft_to_publish_for_own_post($post)
2008 2008
 {
2009
-    $user_id = get_current_user_id();
2009
+	$user_id = get_current_user_id();
2010 2010
 
2011
-    if(!$user_id){return $post;}
2011
+	if(!$user_id){return $post;}
2012 2012
 
2013
-    $gd_post_types = geodir_get_posttypes();
2013
+	$gd_post_types = geodir_get_posttypes();
2014 2014
 
2015
-    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2016
-        $post[0]->post_status = 'publish';
2017
-    }
2018
-    return $post;
2015
+	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2016
+		$post[0]->post_status = 'publish';
2017
+	}
2018
+	return $post;
2019 2019
 }
2020 2020
 
2021 2021
 
@@ -2107,33 +2107,33 @@  discard block
 block discarded – undo
2107 2107
  */
2108 2108
 function geodir_detail_page_tab_headings_change($tabs_arr)
2109 2109
 {
2110
-    global $wpdb;
2110
+	global $wpdb;
2111 2111
 
2112
-    $post_type = geodir_get_current_posttype();
2112
+	$post_type = geodir_get_current_posttype();
2113 2113
 
2114
-    $all_postypes = geodir_get_posttypes();
2114
+	$all_postypes = geodir_get_posttypes();
2115 2115
 
2116
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2116
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2117 2117
 
2118
-        if (array_key_exists('post_video', $tabs_arr)) {
2118
+		if (array_key_exists('post_video', $tabs_arr)) {
2119 2119
 
2120
-            $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)));
2120
+			$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)));
2121 2121
 
2122
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2123
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2124
-        }
2122
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2123
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2124
+		}
2125 2125
 
2126
-        if (array_key_exists('special_offers', $tabs_arr)) {
2126
+		if (array_key_exists('special_offers', $tabs_arr)) {
2127 2127
 
2128
-            $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)));
2128
+			$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)));
2129 2129
 
2130
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2131
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2132
-        }
2130
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2131
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2132
+		}
2133 2133
 
2134
-    }
2134
+	}
2135 2135
 
2136
-    return $tabs_arr;
2136
+	return $tabs_arr;
2137 2137
 
2138 2138
 }
2139 2139
 
@@ -2146,10 +2146,10 @@  discard block
 block discarded – undo
2146 2146
  */
2147 2147
 function geodir_remove_template_redirect_actions()
2148 2148
 {
2149
-    if (geodir_is_page('login')){
2150
-        remove_all_actions('template_redirect');
2151
-        remove_action('init', 'avia_modify_front', 10);
2152
-    }
2149
+	if (geodir_is_page('login')){
2150
+		remove_all_actions('template_redirect');
2151
+		remove_action('init', 'avia_modify_front', 10);
2152
+	}
2153 2153
 }
2154 2154
 
2155 2155
 
@@ -2171,51 +2171,51 @@  discard block
 block discarded – undo
2171 2171
 function geodirectory_before_featured_image_delete($attachment_id)
2172 2172
 {
2173 2173
 
2174
-    global $wpdb, $plugin_prefix;
2174
+	global $wpdb, $plugin_prefix;
2175 2175
 
2176
-    $post_id = get_post_field('post_parent', $attachment_id);
2176
+	$post_id = get_post_field('post_parent', $attachment_id);
2177 2177
 
2178
-    $attachment_url = wp_get_attachment_url($attachment_id);
2178
+	$attachment_url = wp_get_attachment_url($attachment_id);
2179 2179
 
2180
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2180
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2181 2181
 
2182
-        $post_type = get_post_type($post_id);
2182
+		$post_type = get_post_type($post_id);
2183 2183
 
2184
-        $all_postypes = geodir_get_posttypes();
2184
+		$all_postypes = geodir_get_posttypes();
2185 2185
 
2186
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2187
-            return false;
2186
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2187
+			return false;
2188 2188
 
2189
-        $uploads = wp_upload_dir();
2189
+		$uploads = wp_upload_dir();
2190 2190
 
2191
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2191
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2192 2192
 
2193
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2193
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2194 2194
 
2195
-        $wpdb->query(
2196
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2197
-                array($post_id, $split_img_file_path)
2198
-            )
2199
-        );
2195
+		$wpdb->query(
2196
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2197
+				array($post_id, $split_img_file_path)
2198
+			)
2199
+		);
2200 2200
 
2201
-        $attachment_data = $wpdb->get_row(
2202
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2203
-                array($post_id)
2204
-            )
2205
-        );
2201
+		$attachment_data = $wpdb->get_row(
2202
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2203
+				array($post_id)
2204
+			)
2205
+		);
2206 2206
 
2207
-        if (!empty($attachment_data)) {
2208
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2209
-        }
2207
+		if (!empty($attachment_data)) {
2208
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2209
+		}
2210 2210
 
2211 2211
 
2212
-        $table_name = $plugin_prefix . $post_type . '_detail';
2212
+		$table_name = $plugin_prefix . $post_type . '_detail';
2213 2213
 
2214
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2214
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2215 2215
 
2216
-        geodir_set_wp_featured_image($post_id);
2216
+		geodir_set_wp_featured_image($post_id);
2217 2217
 
2218
-    }
2218
+	}
2219 2219
 
2220 2220
 }
2221 2221
 
@@ -2233,79 +2233,79 @@  discard block
 block discarded – undo
2233 2233
 function geodir_temp_set_post_attachment()
2234 2234
 {
2235 2235
 
2236
-    global $wpdb, $plugin_prefix;
2236
+	global $wpdb, $plugin_prefix;
2237 2237
 
2238
-    $all_postypes = geodir_get_posttypes();
2238
+	$all_postypes = geodir_get_posttypes();
2239 2239
 
2240
-    foreach ($all_postypes as $posttype) {
2240
+	foreach ($all_postypes as $posttype) {
2241 2241
 
2242
-        $tablename = $plugin_prefix . $posttype . '_detail';
2242
+		$tablename = $plugin_prefix . $posttype . '_detail';
2243 2243
 
2244
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2244
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2245 2245
 
2246
-        if (!empty($get_post_data)) {
2246
+		if (!empty($get_post_data)) {
2247 2247
 
2248
-            foreach ($get_post_data as $data) {
2248
+			foreach ($get_post_data as $data) {
2249 2249
 
2250
-                $post_id = $data->post_id;
2250
+				$post_id = $data->post_id;
2251 2251
 
2252
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2252
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2253 2253
 
2254
-                if (!empty($attachment_data)) {
2254
+				if (!empty($attachment_data)) {
2255 2255
 
2256
-                    foreach ($attachment_data as $attach) {
2256
+					foreach ($attachment_data as $attach) {
2257 2257
 
2258
-                        $file_info = pathinfo($attach->file);
2258
+						$file_info = pathinfo($attach->file);
2259 2259
 
2260
-                        $sub_dir = '';
2261
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2262
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2260
+						$sub_dir = '';
2261
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2262
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2263 2263
 
2264
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2265
-                        $uploads_path = $uploads['basedir'];
2264
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2265
+						$uploads_path = $uploads['basedir'];
2266 2266
 
2267
-                        $file_name = $file_info['basename'];
2267
+						$file_name = $file_info['basename'];
2268 2268
 
2269
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2269
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2270 2270
 
2271
-                        if (!file_exists($img_arr['path'])) {
2271
+						if (!file_exists($img_arr['path'])) {
2272 2272
 
2273
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2273
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2274 2274
 
2275
-                        }
2275
+						}
2276 2276
 
2277
-                    }
2277
+					}
2278 2278
 
2279
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2279
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2280 2280
 
2281
-                    if (!empty($attachment_data)) {
2281
+					if (!empty($attachment_data)) {
2282 2282
 
2283
-                        if ($attachment_data->ID)
2284
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2283
+						if ($attachment_data->ID)
2284
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2285 2285
 
2286
-                    } else {
2286
+					} else {
2287 2287
 
2288
-                        if (has_post_thumbnail($post_id)) {
2288
+						if (has_post_thumbnail($post_id)) {
2289 2289
 
2290
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2290
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2291 2291
 
2292
-                            wp_delete_attachment($post_thumbnail_id);
2292
+							wp_delete_attachment($post_thumbnail_id);
2293 2293
 
2294
-                        }
2294
+						}
2295 2295
 
2296
-                    }
2296
+					}
2297 2297
 
2298
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2298
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2299 2299
 
2300
-                    geodir_set_wp_featured_image($post_id);
2300
+					geodir_set_wp_featured_image($post_id);
2301 2301
 
2302
-                }
2302
+				}
2303 2303
 
2304
-            }
2304
+			}
2305 2305
 
2306
-        }
2306
+		}
2307 2307
 
2308
-    }
2308
+	}
2309 2309
 
2310 2310
 }
2311 2311
 
@@ -2323,9 +2323,9 @@  discard block
 block discarded – undo
2323 2323
 function geodir_default_rating_star_icon()
2324 2324
 {
2325 2325
 
2326
-    if (!get_option('geodir_default_rating_star_icon')) {
2327
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2328
-    }
2326
+	if (!get_option('geodir_default_rating_star_icon')) {
2327
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2328
+	}
2329 2329
 
2330 2330
 }
2331 2331
 
@@ -2343,27 +2343,27 @@  discard block
 block discarded – undo
2343 2343
  */
2344 2344
 function geodir_user_post_listing_count($user_id=null)
2345 2345
 {
2346
-    global $wpdb, $plugin_prefix, $current_user;
2347
-    if(!$user_id){
2348
-        $user_id = $current_user->ID;
2349
-    }
2346
+	global $wpdb, $plugin_prefix, $current_user;
2347
+	if(!$user_id){
2348
+		$user_id = $current_user->ID;
2349
+	}
2350 2350
 
2351
-    $user_id = $current_user->ID;
2352
-    $all_postypes = geodir_get_posttypes();
2353
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2351
+	$user_id = $current_user->ID;
2352
+	$all_postypes = geodir_get_posttypes();
2353
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2354 2354
 
2355
-    $user_listing = array();
2356
-    if (is_array($all_posts) && !empty($all_posts)) {
2357
-        foreach ($all_posts as $ptype) {
2358
-            $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' )");
2355
+	$user_listing = array();
2356
+	if (is_array($all_posts) && !empty($all_posts)) {
2357
+		foreach ($all_posts as $ptype) {
2358
+			$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' )");
2359 2359
 
2360
-            if ($total_posts > 0) {
2361
-                $user_listing[$ptype] = $total_posts;
2362
-            }
2363
-        }
2364
-    }
2360
+			if ($total_posts > 0) {
2361
+				$user_listing[$ptype] = $total_posts;
2362
+			}
2363
+		}
2364
+	}
2365 2365
 
2366
-    return $user_listing;
2366
+	return $user_listing;
2367 2367
 }
2368 2368
 
2369 2369
 
@@ -2383,189 +2383,189 @@  discard block
 block discarded – undo
2383 2383
  */
2384 2384
 function geodir_detail_page_custom_field_tab($tabs_arr)
2385 2385
 {
2386
-    global $post;
2387
-
2388
-    $post_type = geodir_get_current_posttype();
2389
-    $all_postypes = geodir_get_posttypes();
2390
-
2391
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2392
-        $package_info = array();
2393
-        $package_info = geodir_post_package_info($package_info, $post);
2394
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2395
-        $fields_location = 'owntab';
2396
-
2397
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2398
-        //remove video and special offers if it is already set to show
2399
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2400
-            $unset_video = true;
2401
-        }
2402
-
2403
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2404
-            $unset_special_offers = true;
2405
-        }
2406
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2407
-            foreach($custom_fields as $key => $custom_field){
2408
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2409
-                    unset($custom_fields[$key]);
2410
-                }
2411
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2412
-                    unset($custom_fields[$key]);
2413
-                }
2414
-            }
2415
-        }
2416
-
2417
-
2418
-        if (!empty($custom_fields)) {
2419
-            $parse_custom_fields = array();
2420
-            foreach ($custom_fields as $field) {
2421
-                $field = stripslashes_deep($field); // strip slashes
2422
-                $type = $field;
2423
-                $field_name = $field['htmlvar_name'];
2424
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2425
-                    $post->{$field_name} = $_REQUEST[$field_name];
2426
-                }
2386
+	global $post;
2427 2387
 
2428
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2429
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2430
-                        continue;
2431
-                    }
2388
+	$post_type = geodir_get_current_posttype();
2389
+	$all_postypes = geodir_get_posttypes();
2432 2390
 
2433
-                    $parse_custom_fields[] = $field;
2434
-                }
2435
-            }
2436
-            $custom_fields = $parse_custom_fields;
2437
-        }
2438
-        //print_r($custom_fields);
2439
-        if (!empty($custom_fields)) {
2391
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2392
+		$package_info = array();
2393
+		$package_info = geodir_post_package_info($package_info, $post);
2394
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2395
+		$fields_location = 'owntab';
2440 2396
 
2441
-            global $field_set_start;
2397
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2398
+		//remove video and special offers if it is already set to show
2399
+		if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2400
+			$unset_video = true;
2401
+		}
2442 2402
 
2443
-            $post = stripslashes_deep($post); // strip slashes
2444
-            
2445
-            $field_set_start = 0;
2446
-            $fieldset_count = 0;
2447
-            $fieldset = '';
2448
-            $total_fields = count($custom_fields);
2449
-            $count_field = 0;
2450
-            $fieldset_arr = array();
2451
-            $i = 0;
2452
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2453
-
2454
-            foreach ($custom_fields as $field) {
2455
-                $count_field++;
2456
-                $field_name = $field['htmlvar_name'];
2457
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2458
-                    $post->{$field_name} = $_REQUEST[$field_name];
2459
-                }
2403
+		if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2404
+			$unset_special_offers = true;
2405
+		}
2406
+		if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2407
+			foreach($custom_fields as $key => $custom_field){
2408
+				if($custom_field['name']=='geodir_video' && isset($unset_video)){
2409
+					unset($custom_fields[$key]);
2410
+				}
2411
+				if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2412
+					unset($custom_fields[$key]);
2413
+				}
2414
+			}
2415
+		}
2460 2416
 
2461
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2462
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2463
-                    $site_title = trim($field['site_title']);
2464
-                    $type = $field;
2465
-                    $variables_array = array();
2466 2417
 
2467
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2468
-                        continue;
2469
-                    }
2418
+		if (!empty($custom_fields)) {
2419
+			$parse_custom_fields = array();
2420
+			foreach ($custom_fields as $field) {
2421
+				$field = stripslashes_deep($field); // strip slashes
2422
+				$type = $field;
2423
+				$field_name = $field['htmlvar_name'];
2424
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2425
+					$post->{$field_name} = $_REQUEST[$field_name];
2426
+				}
2470 2427
 
2471
-                    if ($type['type'] != 'fieldset') {
2472
-                        $i++;
2473
-                        $variables_array['post_id'] = $post->ID;
2474
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2475
-                        $variables_array['value'] = '';
2476
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
2477
-                    }else{
2478
-                        $i = 0;
2479
-                        $fieldset_count++;
2480
-                        $field_set_start = 1;
2481
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2482
-                        $fieldset_arr[$fieldset_count]['label'] = $label;
2483
-                    }
2428
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2429
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2430
+						continue;
2431
+					}
2484 2432
 
2433
+					$parse_custom_fields[] = $field;
2434
+				}
2435
+			}
2436
+			$custom_fields = $parse_custom_fields;
2437
+		}
2438
+		//print_r($custom_fields);
2439
+		if (!empty($custom_fields)) {
2485 2440
 
2486
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2487
-                    $type = stripslashes_deep($type); // strip slashes
2488
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2489
-                    $html = '';
2490
-                    $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2491
-                    if($html_var=='post'){$html_var='post_address';}
2492
-                    $field_icon = geodir_field_icon_proccess($type);
2493
-                    $filed_type = $type['type'];
2494
-
2495
-                    /**
2496
-                     * Filter the output for custom fields.
2497
-                     *
2498
-                     * Here we can remove or add new functions depending on the field type.
2499
-                     *
2500
-                     * @param string $html The html to be filtered (blank).
2501
-                     * @param string $fields_location The location the field is to be show.
2502
-                     * @param array $type The array of field values.
2503
-                     */
2504
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2505
-
2506
-
2507
-                    /**
2508
-                     * Filter custom field output in tab.
2509
-                     *
2510
-                     * @since 1.5.6
2511
-                     *
2512
-                     * @param string $html_var The HTML variable name for the field.
2513
-                     * @param string $html Custom field unfiltered HTML.
2514
-                     * @param array $variables_array Custom field variables array.
2515
-                     */
2516
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2517
-
2518
-                    $fieldset_html = '';
2519
-                    if ($field_set_start == 1) {
2520
-                        $add_html = false;
2521
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2522
-                            if ($fieldset != '') {
2523
-                                $add_html = true;
2524
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2525
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2526
-                            }
2527
-                            $fieldset_html = $fieldset;
2528
-                            $fieldset = '';
2529
-                        } else {
2530
-                            $fieldset .= $html;
2531
-                            if ($total_fields == $count_field && $fieldset != '') {
2532
-                                $add_html = true;
2533
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2534
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2535
-                                $fieldset_html = $fieldset;
2536
-                            }
2537
-                        }
2441
+			global $field_set_start;
2538 2442
 
2539
-                        if ($add_html) {
2540
-                            $tabs_arr[$htmlvar_name] = array(
2541
-                                'heading_text' => __($label, 'geodirectory'),
2542
-                                'is_active_tab' => false,
2543
-                                /**
2544
-                                 * Filter if a custom field should be displayed on the details page tab.
2545
-                                 *
2546
-                                 * @since 1.0.0
2547
-                                 * @param string $htmlvar_name The field HTML var name.
2548
-                                 */
2549
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2550
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2551
-                            );
2552
-                        }
2553
-                    } else {
2554
-                        if ($html != '') {
2555
-                            $tabs_arr[$html_var] = array(
2556
-                                'heading_text' => __($label, 'geodirectory'),
2557
-                                'is_active_tab' => false,
2558
-                                /** This action is documented in geodirectory_hooks_actions.php */
2559
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2560
-                                'tab_content' => $html
2561
-                            );
2562
-                        }
2563
-                    }
2564
-                }
2565
-            }
2566
-        }
2567
-    }
2568
-    return $tabs_arr;
2443
+			$post = stripslashes_deep($post); // strip slashes
2444
+            
2445
+			$field_set_start = 0;
2446
+			$fieldset_count = 0;
2447
+			$fieldset = '';
2448
+			$total_fields = count($custom_fields);
2449
+			$count_field = 0;
2450
+			$fieldset_arr = array();
2451
+			$i = 0;
2452
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2453
+
2454
+			foreach ($custom_fields as $field) {
2455
+				$count_field++;
2456
+				$field_name = $field['htmlvar_name'];
2457
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2458
+					$post->{$field_name} = $_REQUEST[$field_name];
2459
+				}
2460
+
2461
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2462
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2463
+					$site_title = trim($field['site_title']);
2464
+					$type = $field;
2465
+					$variables_array = array();
2466
+
2467
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2468
+						continue;
2469
+					}
2470
+
2471
+					if ($type['type'] != 'fieldset') {
2472
+						$i++;
2473
+						$variables_array['post_id'] = $post->ID;
2474
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2475
+						$variables_array['value'] = '';
2476
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
2477
+					}else{
2478
+						$i = 0;
2479
+						$fieldset_count++;
2480
+						$field_set_start = 1;
2481
+						$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2482
+						$fieldset_arr[$fieldset_count]['label'] = $label;
2483
+					}
2484
+
2485
+
2486
+					if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2487
+					$type = stripslashes_deep($type); // strip slashes
2488
+					if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2489
+					$html = '';
2490
+					$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2491
+					if($html_var=='post'){$html_var='post_address';}
2492
+					$field_icon = geodir_field_icon_proccess($type);
2493
+					$filed_type = $type['type'];
2494
+
2495
+					/**
2496
+					 * Filter the output for custom fields.
2497
+					 *
2498
+					 * Here we can remove or add new functions depending on the field type.
2499
+					 *
2500
+					 * @param string $html The html to be filtered (blank).
2501
+					 * @param string $fields_location The location the field is to be show.
2502
+					 * @param array $type The array of field values.
2503
+					 */
2504
+					$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2505
+
2506
+
2507
+					/**
2508
+					 * Filter custom field output in tab.
2509
+					 *
2510
+					 * @since 1.5.6
2511
+					 *
2512
+					 * @param string $html_var The HTML variable name for the field.
2513
+					 * @param string $html Custom field unfiltered HTML.
2514
+					 * @param array $variables_array Custom field variables array.
2515
+					 */
2516
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2517
+
2518
+					$fieldset_html = '';
2519
+					if ($field_set_start == 1) {
2520
+						$add_html = false;
2521
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2522
+							if ($fieldset != '') {
2523
+								$add_html = true;
2524
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2525
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2526
+							}
2527
+							$fieldset_html = $fieldset;
2528
+							$fieldset = '';
2529
+						} else {
2530
+							$fieldset .= $html;
2531
+							if ($total_fields == $count_field && $fieldset != '') {
2532
+								$add_html = true;
2533
+								$label = $fieldset_arr[$fieldset_count]['label'];
2534
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2535
+								$fieldset_html = $fieldset;
2536
+							}
2537
+						}
2538
+
2539
+						if ($add_html) {
2540
+							$tabs_arr[$htmlvar_name] = array(
2541
+								'heading_text' => __($label, 'geodirectory'),
2542
+								'is_active_tab' => false,
2543
+								/**
2544
+								 * Filter if a custom field should be displayed on the details page tab.
2545
+								 *
2546
+								 * @since 1.0.0
2547
+								 * @param string $htmlvar_name The field HTML var name.
2548
+								 */
2549
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2550
+								'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2551
+							);
2552
+						}
2553
+					} else {
2554
+						if ($html != '') {
2555
+							$tabs_arr[$html_var] = array(
2556
+								'heading_text' => __($label, 'geodirectory'),
2557
+								'is_active_tab' => false,
2558
+								/** This action is documented in geodirectory_hooks_actions.php */
2559
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2560
+								'tab_content' => $html
2561
+							);
2562
+						}
2563
+					}
2564
+				}
2565
+			}
2566
+		}
2567
+	}
2568
+	return $tabs_arr;
2569 2569
 }
2570 2570
 
2571 2571
 /* display add listing page for wpml */
@@ -2589,39 +2589,39 @@  discard block
 block discarded – undo
2589 2589
  */
2590 2590
 function geodir_add_post_status_author_page()
2591 2591
 {
2592
-    global $wpdb, $post;
2593
-
2594
-    $html = '';
2595
-    if (get_current_user_id()) {
2596
-
2597
-        $is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2598
-        if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2599
-
2600
-            // 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.
2601
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2602
-            $status = "<strong>(";
2603
-            $status_icon = '<i class="fa fa-play"></i>';
2604
-            if ($real_status == 'publish') {
2605
-                $status .= __('Published', 'geodirectory');
2606
-            } else {
2607
-                $status .= __('Not published', 'geodirectory');
2608
-                $status_icon = '<i class="fa fa-pause"></i>';
2609
-            }
2610
-            $status .= ")</strong>";
2592
+	global $wpdb, $post;
2593
+
2594
+	$html = '';
2595
+	if (get_current_user_id()) {
2596
+
2597
+		$is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2598
+		if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2599
+
2600
+			// 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.
2601
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2602
+			$status = "<strong>(";
2603
+			$status_icon = '<i class="fa fa-play"></i>';
2604
+			if ($real_status == 'publish') {
2605
+				$status .= __('Published', 'geodirectory');
2606
+			} else {
2607
+				$status .= __('Not published', 'geodirectory');
2608
+				$status_icon = '<i class="fa fa-pause"></i>';
2609
+			}
2610
+			$status .= ")</strong>";
2611 2611
 
2612
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2613
-        }
2614
-    }
2612
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2613
+		}
2614
+	}
2615 2615
 
2616
-    if ($html != '') {
2617
-        /**
2618
-         * Filter the post status text on the author page.
2619
-         *
2620
-         * @since 1.0.0
2621
-         * @param string $html The HTML of the status.
2622
-         */
2623
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2624
-    }
2616
+	if ($html != '') {
2617
+		/**
2618
+		 * Filter the post status text on the author page.
2619
+		 *
2620
+		 * @since 1.0.0
2621
+		 * @param string $html The HTML of the status.
2622
+		 */
2623
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2624
+	}
2625 2625
 
2626 2626
 
2627 2627
 }
@@ -2635,21 +2635,21 @@  discard block
 block discarded – undo
2635 2635
  */
2636 2636
 function geodir_init_no_rating()
2637 2637
 {
2638
-    if (get_option('geodir_disable_rating')) {
2639
-        remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
2640
-        remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
2641
-        remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
2642
-        remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
2643
-        remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
2644
-        remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
2645
-        remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
2646
-
2647
-        add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
2648
-        add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
2649
-        add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
2650
-        add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
2651
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2652
-    }
2638
+	if (get_option('geodir_disable_rating')) {
2639
+		remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
2640
+		remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
2641
+		remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
2642
+		remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
2643
+		remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
2644
+		remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
2645
+		remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
2646
+
2647
+		add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
2648
+		add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
2649
+		add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
2650
+		add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
2651
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2652
+	}
2653 2653
 }
2654 2654
 
2655 2655
 /**
@@ -2661,24 +2661,24 @@  discard block
 block discarded – undo
2661 2661
  */
2662 2662
 function geodir_no_rating_rating_fields()
2663 2663
 {
2664
-    global $post;
2664
+	global $post;
2665 2665
 
2666
-    $post_types = geodir_get_posttypes();
2666
+	$post_types = geodir_get_posttypes();
2667 2667
 
2668
-    if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
2669
-        if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
2670
-            if (get_option('geodir_reviewrating_enable_rating')) {
2671
-                echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
2672
-            } else {
2673
-                echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
2674
-            }
2675
-            if (get_option('geodir_reviewrating_enable_images')) {
2676
-                geodir_reviewrating_rating_img_html();
2677
-            }
2678
-        } else {
2679
-            echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
2680
-        }
2681
-    }
2668
+	if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
2669
+		if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
2670
+			if (get_option('geodir_reviewrating_enable_rating')) {
2671
+				echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
2672
+			} else {
2673
+				echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
2674
+			}
2675
+			if (get_option('geodir_reviewrating_enable_images')) {
2676
+				geodir_reviewrating_rating_img_html();
2677
+			}
2678
+		} else {
2679
+			echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
2680
+		}
2681
+	}
2682 2682
 }
2683 2683
 
2684 2684
 /**
@@ -2692,11 +2692,11 @@  discard block
 block discarded – undo
2692 2692
  */
2693 2693
 function geodir_no_rating_comment_text($content, $comment = '')
2694 2694
 {
2695
-    if (!is_admin()) {
2696
-        return '<div class="description">' . $content . '</div>';
2697
-    } else {
2698
-        return $content;
2699
-    }
2695
+	if (!is_admin()) {
2696
+		return '<div class="description">' . $content . '</div>';
2697
+	} else {
2698
+		return $content;
2699
+	}
2700 2700
 }
2701 2701
 
2702 2702
 /**
@@ -2709,7 +2709,7 @@  discard block
 block discarded – undo
2709 2709
  */
2710 2710
 function geodir_no_rating_review_rating_html($content = '')
2711 2711
 {
2712
-    return NULL;
2712
+	return NULL;
2713 2713
 }
2714 2714
 
2715 2715
 /**
@@ -2723,19 +2723,19 @@  discard block
 block discarded – undo
2723 2723
  */
2724 2724
 function geodir_no_rating_get_sort_options($options, $post_type = '')
2725 2725
 {
2726
-    $new_options = array();
2727
-    if (!empty($options)) {
2728
-        foreach ($options as $option) {
2729
-            if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2730
-                continue;
2731
-            }
2732
-            $new_options[] = $option;
2733
-        }
2726
+	$new_options = array();
2727
+	if (!empty($options)) {
2728
+		foreach ($options as $option) {
2729
+			if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2730
+				continue;
2731
+			}
2732
+			$new_options[] = $option;
2733
+		}
2734 2734
 
2735
-        $options = $new_options;
2736
-    }
2735
+		$options = $new_options;
2736
+	}
2737 2737
 
2738
-    return $options;
2738
+	return $options;
2739 2739
 }
2740 2740
 
2741 2741
 add_filter('geodir_all_js_msg', 'geodir_all_js_msg_no_rating', 100);
@@ -2749,11 +2749,11 @@  discard block
 block discarded – undo
2749 2749
  */
2750 2750
 function geodir_all_js_msg_no_rating($msg = array())
2751 2751
 {
2752
-    if (get_option('geodir_disable_rating')) {
2753
-        $msg['gd_cmt_no_rating'] = true;
2754
-    }
2752
+	if (get_option('geodir_disable_rating')) {
2753
+		$msg['gd_cmt_no_rating'] = true;
2754
+	}
2755 2755
 
2756
-    return $msg;
2756
+	return $msg;
2757 2757
 }
2758 2758
 
2759 2759
 add_filter('body_class', 'geodir_body_class_no_rating', 100);
@@ -2767,13 +2767,13 @@  discard block
 block discarded – undo
2767 2767
  */
2768 2768
 function geodir_body_class_no_rating($classes = array())
2769 2769
 {
2770
-    if (get_option('geodir_disable_rating')) {
2771
-        $classes[] = 'gd-no-rating';
2772
-    }
2770
+	if (get_option('geodir_disable_rating')) {
2771
+		$classes[] = 'gd-no-rating';
2772
+	}
2773 2773
     
2774
-    $classes[] = 'gd-map-' . geodir_map_name();
2774
+	$classes[] = 'gd-map-' . geodir_map_name();
2775 2775
 
2776
-    return $classes;
2776
+	return $classes;
2777 2777
 }
2778 2778
 
2779 2779
 add_filter('admin_body_class', 'geodir_admin_body_class_no_rating', 100);
@@ -2787,13 +2787,13 @@  discard block
 block discarded – undo
2787 2787
  */
2788 2788
 function geodir_admin_body_class_no_rating($class = '')
2789 2789
 {
2790
-    if (get_option('geodir_disable_rating')) {
2791
-        $class .= ' gd-no-rating';
2792
-    }
2790
+	if (get_option('geodir_disable_rating')) {
2791
+		$class .= ' gd-no-rating';
2792
+	}
2793 2793
     
2794
-    $class .= ' gd-map-' . geodir_map_name();
2794
+	$class .= ' gd-map-' . geodir_map_name();
2795 2795
 
2796
-    return $class;
2796
+	return $class;
2797 2797
 }
2798 2798
 
2799 2799
 add_action('wp_head', 'geodir_wp_head_no_rating');
@@ -2806,10 +2806,10 @@  discard block
 block discarded – undo
2806 2806
  */
2807 2807
 function geodir_wp_head_no_rating()
2808 2808
 {
2809
-    if (get_option('geodir_disable_rating')) {
2810
-        echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
2811
-        echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
2812
-    }
2809
+	if (get_option('geodir_disable_rating')) {
2810
+		echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
2811
+		echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
2812
+	}
2813 2813
 }
2814 2814
 
2815 2815
 add_filter('geodir_load_db_language', 'geodir_load_custom_field_translation');
@@ -2826,36 +2826,36 @@  discard block
 block discarded – undo
2826 2826
  * @return array Translation texts.
2827 2827
  */
2828 2828
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2829
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2830
-
2831
-    $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');
2832
-
2833
-    /**
2834
-     * Filters the geodirectory option names that requires to add for translation.
2835
-     *
2836
-     * @since 1.5.7
2837
-     * @package GeoDirectory
2838
-     *
2839
-     * @param  array $gd_options Array of option names.
2840
-     */
2841
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2842
-    $gd_options = array_unique($gd_options);
2843
-
2844
-    if (!empty($gd_options)) {
2845
-        foreach ($gd_options as $gd_option) {
2846
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
2847
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2829
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2830
+
2831
+	$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');
2832
+
2833
+	/**
2834
+	 * Filters the geodirectory option names that requires to add for translation.
2835
+	 *
2836
+	 * @since 1.5.7
2837
+	 * @package GeoDirectory
2838
+	 *
2839
+	 * @param  array $gd_options Array of option names.
2840
+	 */
2841
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2842
+	$gd_options = array_unique($gd_options);
2843
+
2844
+	if (!empty($gd_options)) {
2845
+		foreach ($gd_options as $gd_option) {
2846
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
2847
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2848 2848
                 
2849
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2850
-                    $translation_texts[] = stripslashes_deep($option_value);
2851
-                }
2852
-            }
2853
-        }
2854
-    }
2849
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2850
+					$translation_texts[] = stripslashes_deep($option_value);
2851
+				}
2852
+			}
2853
+		}
2854
+	}
2855 2855
 
2856
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2856
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2857 2857
 
2858
-    return $translation_texts;
2858
+	return $translation_texts;
2859 2859
 }
2860 2860
 
2861 2861
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -2869,15 +2869,15 @@  discard block
 block discarded – undo
2869 2869
 
2870 2870
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
2871 2871
 function gd_get_comments_link($comments_link, $post_id) {
2872
-    $post_type = get_post_type($post_id);
2872
+	$post_type = get_post_type($post_id);
2873 2873
 
2874
-    $all_postypes = geodir_get_posttypes();
2875
-    if (in_array($post_type, $all_postypes)) {
2876
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
2877
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
2878
-    }
2874
+	$all_postypes = geodir_get_posttypes();
2875
+	if (in_array($post_type, $all_postypes)) {
2876
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
2877
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
2878
+	}
2879 2879
 
2880
-    return $comments_link;
2880
+	return $comments_link;
2881 2881
 }
2882 2882
 
2883 2883
 
@@ -2895,11 +2895,11 @@  discard block
 block discarded – undo
2895 2895
 function geodir_add_nav_menu_class( $args )
2896 2896
 {
2897 2897
 
2898
-        if(isset($args['menu_class'])){
2899
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
2900
-        }
2898
+		if(isset($args['menu_class'])){
2899
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
2900
+		}
2901 2901
     
2902
-    return $args;
2902
+	return $args;
2903 2903
 }
2904 2904
 
2905 2905
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
@@ -2916,15 +2916,15 @@  discard block
 block discarded – undo
2916 2916
  * @return string Filtered locale ID.
2917 2917
  */
2918 2918
 function geodir_wpml_filter_locale($locale) {
2919
-    global $sitepress;
2919
+	global $sitepress;
2920 2920
     
2921
-    $post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2921
+	$post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2922 2922
     
2923
-    if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2924
-        $locale = $sitepress->get_locale($current_lang);
2925
-    }
2923
+	if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2924
+		$locale = $sitepress->get_locale($current_lang);
2925
+	}
2926 2926
     
2927
-    return $locale;
2927
+	return $locale;
2928 2928
 }
2929 2929
 
2930 2930
 /**
@@ -2934,15 +2934,15 @@  discard block
 block discarded – undo
2934 2934
  * @package GeoDirectory
2935 2935
  */
2936 2936
 function geodir_wpml_set_filter() {
2937
-    if (function_exists('icl_object_id')) {
2938
-        global $sitepress;
2937
+	if (function_exists('icl_object_id')) {
2938
+		global $sitepress;
2939 2939
         
2940
-        if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2941
-            add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2942
-        }
2940
+		if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2941
+			add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2942
+		}
2943 2943
         
2944
-        add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2945
-    }
2944
+		add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2945
+	}
2946 2946
 }
2947 2947
 add_filter('plugins_loaded', 'geodir_wpml_set_filter');
2948 2948
 
@@ -2955,44 +2955,44 @@  discard block
 block discarded – undo
2955 2955
  * @return array Filtered languages.
2956 2956
  */
2957 2957
 function geodir_wpml_filter_ls_languages($languages) {
2958
-    global $gd_icl_ls_languages;
2958
+	global $gd_icl_ls_languages;
2959 2959
     
2960
-    if (geodir_is_geodir_page()) {
2961
-        if ($gd_icl_ls_languages) {
2962
-            return $languages;
2963
-        }
2960
+	if (geodir_is_geodir_page()) {
2961
+		if ($gd_icl_ls_languages) {
2962
+			return $languages;
2963
+		}
2964 2964
         
2965
-        $keep_vars = array();
2965
+		$keep_vars = array();
2966 2966
         
2967
-        if (geodir_is_page('add-listing')) {
2968
-            $keep_vars = array('listing_type', 'package_id');
2969
-        } else if (geodir_is_page('search')) {
2970
-            $keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2971
-        } else if (geodir_is_page('author')) {
2972
-            $keep_vars = array('geodir_dashbord', 'stype', 'list');
2973
-        } else if (geodir_is_page('login')) {
2974
-            $keep_vars = array('forgot', 'signup');
2975
-        }        
2967
+		if (geodir_is_page('add-listing')) {
2968
+			$keep_vars = array('listing_type', 'package_id');
2969
+		} else if (geodir_is_page('search')) {
2970
+			$keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2971
+		} else if (geodir_is_page('author')) {
2972
+			$keep_vars = array('geodir_dashbord', 'stype', 'list');
2973
+		} else if (geodir_is_page('login')) {
2974
+			$keep_vars = array('forgot', 'signup');
2975
+		}        
2976 2976
         
2977
-        if (!empty($keep_vars)) {
2978
-            foreach ( $languages as $code => $url) {
2979
-                $filter_url = $url['url'];
2977
+		if (!empty($keep_vars)) {
2978
+			foreach ( $languages as $code => $url) {
2979
+				$filter_url = $url['url'];
2980 2980
                 
2981
-                foreach ($keep_vars as $var) {
2982
-                    if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2983
-                        $filter_url = remove_query_arg(array($var), $filter_url);
2984
-                        $filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2985
-                    }
2986
-                }
2981
+				foreach ($keep_vars as $var) {
2982
+					if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2983
+						$filter_url = remove_query_arg(array($var), $filter_url);
2984
+						$filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2985
+					}
2986
+				}
2987 2987
                 
2988
-                if ($filter_url != $url['url']) {
2989
-                    $languages[$code]['url'] = $filter_url;
2990
-                }
2991
-            }
2992
-            $gd_icl_ls_languages = true;
2993
-        }
2994
-    }
2988
+				if ($filter_url != $url['url']) {
2989
+					$languages[$code]['url'] = $filter_url;
2990
+				}
2991
+			}
2992
+			$gd_icl_ls_languages = true;
2993
+		}
2994
+	}
2995 2995
 
2996
-    return $languages;
2996
+	return $languages;
2997 2997
 }
2998 2998
 add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2999 2999
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/general_functions.php 1 patch
Spacing   +1274 added lines, -1274 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 /**
11 11
  * Get All Plugin functions from WordPress
12 12
  */
13
-include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
13
+include_once(ABSPATH.'wp-admin/includes/plugin.php');
14 14
 
15 15
 /*-----------------------------------------------------------------------------------*/
16 16
 /* Helper functions */
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
  */
28 28
 function geodir_plugin_url() {
29 29
 
30
-	if ( is_ssl() ) :
31
-		return str_replace( 'http://', 'https://', WP_PLUGIN_URL ) . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
30
+	if (is_ssl()) :
31
+		return str_replace('http://', 'https://', WP_PLUGIN_URL)."/".plugin_basename(dirname(dirname(__FILE__)));
32 32
 	else :
33
-		return WP_PLUGIN_URL . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
33
+		return WP_PLUGIN_URL."/".plugin_basename(dirname(dirname(__FILE__)));
34 34
 	endif;
35 35
 }
36 36
 
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
  * @return string example url eg: /home/geo/public_html/wp-content/plugins/geodirectory
46 46
  */
47 47
 function geodir_plugin_path() {
48
-	if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
49
-		return dirname( dirname( __FILE__ ) );
48
+	if (defined('GD_TESTING_MODE') && GD_TESTING_MODE) {
49
+		return dirname(dirname(__FILE__));
50 50
 	} else {
51
-		return WP_PLUGIN_DIR . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
51
+		return WP_PLUGIN_DIR."/".plugin_basename(dirname(dirname(__FILE__)));
52 52
 	}
53 53
 }
54 54
 
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
  * @return bool true or false.
64 64
  * @todo    check if this is faster than normal WP check and remove if not.
65 65
  */
66
-function geodir_is_plugin_active( $plugin ) {
67
-	$active_plugins = get_option( 'active_plugins' );
68
-	foreach ( $active_plugins as $key => $active_plugin ) {
69
-		if ( strstr( $active_plugin, $plugin ) ) {
66
+function geodir_is_plugin_active($plugin) {
67
+	$active_plugins = get_option('active_plugins');
68
+	foreach ($active_plugins as $key => $active_plugin) {
69
+		if (strstr($active_plugin, $plugin)) {
70 70
 			return true;
71 71
 		}
72 72
 	}
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
  *
89 89
  * @return bool|int|string the formatted date.
90 90
  */
91
-function geodir_get_formated_date( $date ) {
92
-	return mysql2date( get_option( 'date_format' ), $date );
91
+function geodir_get_formated_date($date) {
92
+	return mysql2date(get_option('date_format'), $date);
93 93
 }
94 94
 
95 95
 /**
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
  *
106 106
  * @return bool|int|string the formatted time.
107 107
  */
108
-function geodir_get_formated_time( $time ) {
109
-	return mysql2date( get_option( 'time_format' ), $time, $translate = true );
108
+function geodir_get_formated_time($time) {
109
+	return mysql2date(get_option('time_format'), $time, $translate = true);
110 110
 }
111 111
 
112 112
 
@@ -124,35 +124,35 @@  discard block
 block discarded – undo
124 124
  *
125 125
  * @return string Formatted link.
126 126
  */
127
-function geodir_getlink( $url, $params = array(), $use_existing_arguments = false ) {
128
-	if ( $use_existing_arguments ) {
127
+function geodir_getlink($url, $params = array(), $use_existing_arguments = false) {
128
+	if ($use_existing_arguments) {
129 129
 		$params = $params + $_GET;
130 130
 	}
131
-	if ( ! $params ) {
131
+	if (!$params) {
132 132
 		return $url;
133 133
 	}
134 134
 	$link = $url;
135
-	if ( strpos( $link, '?' ) === false ) {
135
+	if (strpos($link, '?') === false) {
136 136
 		$link .= '?';
137 137
 	} //If there is no '?' add one at the end
138
-	elseif ( strpos( $link, '//maps.google.com/maps/api/js?language=' ) ) {
138
+	elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) {
139 139
 		$link .= '&amp;';
140 140
 	} //If there is no '&' at the END, add one.
141
-	elseif ( ! preg_match( '/(\?|\&(amp;)?)$/', $link ) ) {
141
+	elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) {
142 142
 		$link .= '&';
143 143
 	} //If there is no '&' at the END, add one.
144 144
 
145 145
 	$params_arr = array();
146
-	foreach ( $params as $key => $value ) {
147
-		if ( gettype( $value ) == 'array' ) { //Handle array data properly
148
-			foreach ( $value as $val ) {
149
-				$params_arr[] = $key . '[]=' . urlencode( $val );
146
+	foreach ($params as $key => $value) {
147
+		if (gettype($value) == 'array') { //Handle array data properly
148
+			foreach ($value as $val) {
149
+				$params_arr[] = $key.'[]='.urlencode($val);
150 150
 			}
151 151
 		} else {
152
-			$params_arr[] = $key . '=' . urlencode( $value );
152
+			$params_arr[] = $key.'='.urlencode($value);
153 153
 		}
154 154
 	}
155
-	$link .= implode( '&', $params_arr );
155
+	$link .= implode('&', $params_arr);
156 156
 
157 157
 	return $link;
158 158
 }
@@ -169,18 +169,18 @@  discard block
 block discarded – undo
169 169
  *
170 170
  * @return string Listing page url if valid. Otherwise home url will be returned.
171 171
  */
172
-function geodir_get_addlisting_link( $post_type = '' ) {
172
+function geodir_get_addlisting_link($post_type = '') {
173 173
 	global $wpdb;
174 174
 
175 175
 	//$check_pkg  = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'");
176 176
 	$check_pkg = 1;
177
-	if ( post_type_exists( $post_type ) && $check_pkg ) {
177
+	if (post_type_exists($post_type) && $check_pkg) {
178 178
 
179
-		$add_listing_link = get_page_link( geodir_add_listing_page_id() );
179
+		$add_listing_link = get_page_link(geodir_add_listing_page_id());
180 180
 
181
-		return esc_url( add_query_arg( array( 'listing_type' => $post_type ), $add_listing_link ) );
181
+		return esc_url(add_query_arg(array('listing_type' => $post_type), $add_listing_link));
182 182
 	} else {
183
-		return get_bloginfo( 'url' );
183
+		return get_bloginfo('url');
184 184
 	}
185 185
 }
186 186
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	if (!empty($_SERVER['PHP_SELF']) && !empty($_SERVER['REQUEST_URI'])) {
209 209
 		// To build the entire URI we need to prepend the protocol, and the http host
210 210
 		// to the URI string.
211
-		$pageURL .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
211
+		$pageURL .= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
212 212
 	} else {
213 213
 		/*
214 214
 		 * Since we do not have REQUEST_URI to work with, we will assume we are
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 		 *
218 218
 		 * IIS uses the SCRIPT_NAME variable instead of a REQUEST_URI variable... thanks, MS
219 219
 		 */
220
-		$pageURL .= $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
220
+		$pageURL .= $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
221 221
 		
222 222
 		// If the query string exists append it to the URI string
223 223
 		if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
224
-			$pageURL .= '?' . $_SERVER['QUERY_STRING'];
224
+			$pageURL .= '?'.$_SERVER['QUERY_STRING'];
225 225
 		}
226 226
 	}
227 227
 	
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 *
233 233
 	 * @param string $pageURL The URL of the current page.
234 234
 	 */
235
-	return apply_filters( 'geodir_curPageURL', $pageURL );
235
+	return apply_filters('geodir_curPageURL', $pageURL);
236 236
 }
237 237
 
238 238
 /**
@@ -247,12 +247,12 @@  discard block
 block discarded – undo
247 247
  *
248 248
  * @return string Cleaned variable.
249 249
  */
250
-function geodir_clean( $string ) {
250
+function geodir_clean($string) {
251 251
 
252
-	$string = trim( strip_tags( stripslashes( $string ) ) );
253
-	$string = str_replace( " ", "-", $string ); // Replaces all spaces with hyphens.
254
-	$string = preg_replace( '/[^A-Za-z0-9\-\_]/', '', $string ); // Removes special chars.
255
-	$string = preg_replace( '/-+/', '-', $string ); // Replaces multiple hyphens with single one.
252
+	$string = trim(strip_tags(stripslashes($string)));
253
+	$string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
254
+	$string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars.
255
+	$string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
256 256
 
257 257
 	return $string;
258 258
 }
@@ -266,13 +266,13 @@  discard block
 block discarded – undo
266 266
  */
267 267
 function geodir_get_weekday() {
268 268
 	return array(
269
-		__( 'Sunday', 'geodirectory' ),
270
-		__( 'Monday', 'geodirectory' ),
271
-		__( 'Tuesday', 'geodirectory' ),
272
-		__( 'Wednesday', 'geodirectory' ),
273
-		__( 'Thursday', 'geodirectory' ),
274
-		__( 'Friday', 'geodirectory' ),
275
-		__( 'Saturday', 'geodirectory' )
269
+		__('Sunday', 'geodirectory'),
270
+		__('Monday', 'geodirectory'),
271
+		__('Tuesday', 'geodirectory'),
272
+		__('Wednesday', 'geodirectory'),
273
+		__('Thursday', 'geodirectory'),
274
+		__('Friday', 'geodirectory'),
275
+		__('Saturday', 'geodirectory')
276 276
 	);
277 277
 }
278 278
 
@@ -285,11 +285,11 @@  discard block
 block discarded – undo
285 285
  */
286 286
 function geodir_get_weeks() {
287 287
 	return array(
288
-		__( 'First', 'geodirectory' ),
289
-		__( 'Second', 'geodirectory' ),
290
-		__( 'Third', 'geodirectory' ),
291
-		__( 'Fourth', 'geodirectory' ),
292
-		__( 'Last', 'geodirectory' )
288
+		__('First', 'geodirectory'),
289
+		__('Second', 'geodirectory'),
290
+		__('Third', 'geodirectory'),
291
+		__('Fourth', 'geodirectory'),
292
+		__('Last', 'geodirectory')
293 293
 	);
294 294
 }
295 295
 
@@ -308,112 +308,112 @@  discard block
 block discarded – undo
308 308
  *
309 309
  * @return bool If valid returns true. Otherwise false.
310 310
  */
311
-function geodir_is_page( $gdpage = '' ) {
311
+function geodir_is_page($gdpage = '') {
312 312
 
313 313
 	global $wp_query, $post, $wp;
314 314
 	//if(!is_admin()):
315 315
 
316
-	switch ( $gdpage ):
316
+	switch ($gdpage):
317 317
 		case 'add-listing':
318 318
 
319
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_add_listing_page_id() ) {
319
+			if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) {
320 320
 				return true;
321
-			} elseif ( is_page() && isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
321
+			} elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
322 322
 				return true;
323 323
 			}
324 324
 
325 325
 			break;
326 326
 		case 'preview':
327
-			if ( ( is_page() && get_query_var( 'page_id' ) == geodir_preview_page_id() ) && isset( $_REQUEST['listing_type'] )
328
-			     && in_array( $_REQUEST['listing_type'], geodir_get_posttypes() )
327
+			if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
328
+			     && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
329 329
 			) {
330 330
 				return true;
331 331
 			}
332 332
 			break;
333 333
 		case 'listing-success':
334
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_success_page_id() ) {
334
+			if (is_page() && get_query_var('page_id') == geodir_success_page_id()) {
335 335
 				return true;
336 336
 			}
337 337
 			break;
338 338
 		case 'detail':
339
-			$post_type = get_query_var( 'post_type' );
340
-			if ( is_array( $post_type ) ) {
341
-				$post_type = reset( $post_type );
339
+			$post_type = get_query_var('post_type');
340
+			if (is_array($post_type)) {
341
+				$post_type = reset($post_type);
342 342
 			}
343
-			if ( is_single() && in_array( $post_type, geodir_get_posttypes() ) ) {
343
+			if (is_single() && in_array($post_type, geodir_get_posttypes())) {
344 344
 				return true;
345 345
 			}
346 346
 			break;
347 347
 		case 'pt':
348
-			$post_type = get_query_var( 'post_type' );
349
-			if ( is_array( $post_type ) ) {
350
-				$post_type = reset( $post_type );
348
+			$post_type = get_query_var('post_type');
349
+			if (is_array($post_type)) {
350
+				$post_type = reset($post_type);
351 351
 			}
352
-			if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) && ! is_tax() ) {
352
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()) && !is_tax()) {
353 353
 				return true;
354 354
 			}
355 355
 
356 356
 			break;
357 357
 		case 'listing':
358
-			if ( is_tax() && geodir_get_taxonomy_posttype() ) {
358
+			if (is_tax() && geodir_get_taxonomy_posttype()) {
359 359
 				global $current_term, $taxonomy, $term;
360 360
 
361 361
 				return true;
362 362
 			}
363
-			$post_type = get_query_var( 'post_type' );
364
-			if ( is_array( $post_type ) ) {
365
-				$post_type = reset( $post_type );
363
+			$post_type = get_query_var('post_type');
364
+			if (is_array($post_type)) {
365
+				$post_type = reset($post_type);
366 366
 			}
367
-			if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) ) {
367
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) {
368 368
 				return true;
369 369
 			}
370 370
 
371 371
 			break;
372 372
 		case 'home':
373 373
 
374
-			if ( ( is_page() && get_query_var( 'page_id' ) == geodir_home_page_id() ) || is_page_geodir_home() ) {
374
+			if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home()) {
375 375
 				return true;
376 376
 			}
377 377
 
378 378
 			break;
379 379
 		case 'location':
380
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_location_page_id() ) {
380
+			if (is_page() && get_query_var('page_id') == geodir_location_page_id()) {
381 381
 				return true;
382 382
 			}
383 383
 			break;
384 384
 		case 'author':
385
-			if ( is_author() && isset( $_REQUEST['geodir_dashbord'] ) ) {
385
+			if (is_author() && isset($_REQUEST['geodir_dashbord'])) {
386 386
 				return true;
387 387
 			}
388 388
 
389
-			if ( function_exists( 'bp_loggedin_user_id' ) && function_exists( 'bp_displayed_user_id' ) && $my_id = (int) bp_loggedin_user_id() ) {
390
-				if ( ( (bool) bp_is_current_component( 'listings' ) || (bool) bp_is_current_component( 'favorites' ) ) && $my_id > 0 && $my_id == (int) bp_displayed_user_id() ) {
389
+			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) {
390
+				if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) {
391 391
 					return true;
392 392
 				}
393 393
 			}
394 394
 			break;
395 395
 		case 'search':
396
-			if ( is_search() && isset( $_REQUEST['geodir_search'] ) ) {
396
+			if (is_search() && isset($_REQUEST['geodir_search'])) {
397 397
 				return true;
398 398
 			}
399 399
 			break;
400 400
 		case 'info':
401
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_info_page_id() ) {
401
+			if (is_page() && get_query_var('page_id') == geodir_info_page_id()) {
402 402
 				return true;
403 403
 			}
404 404
 			break;
405 405
 		case 'login':
406
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_login_page_id() ) {
406
+			if (is_page() && get_query_var('page_id') == geodir_login_page_id()) {
407 407
 				return true;
408 408
 			}
409 409
 			break;
410 410
 		case 'checkout':
411
-			if ( is_page() && function_exists( 'geodir_payment_checkout_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_checkout_page_id() ) {
411
+			if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id()) {
412 412
 				return true;
413 413
 			}
414 414
 			break;
415 415
 		case 'invoices':
416
-			if ( is_page() && function_exists( 'geodir_payment_invoices_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_invoices_page_id() ) {
416
+			if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id()) {
417 417
 				return true;
418 418
 			}
419 419
 			break;
@@ -438,25 +438,25 @@  discard block
 block discarded – undo
438 438
  *
439 439
  * @param object $wp WordPress object.
440 440
  */
441
-function geodir_set_is_geodir_page( $wp ) {
442
-	if ( ! is_admin() ) {
441
+function geodir_set_is_geodir_page($wp) {
442
+	if (!is_admin()) {
443 443
 		//$wp->query_vars['gd_is_geodir_page'] = false;
444 444
 		//print_r()
445
-		if ( empty( $wp->query_vars ) || ! array_diff( array_keys( $wp->query_vars ), array(
445
+		if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array(
446 446
 				'preview',
447 447
 				'page',
448 448
 				'paged',
449 449
 				'cpage'
450
-			) )
450
+			))
451 451
 		) {
452
-			if ( geodir_is_page( 'home' ) ) {
452
+			if (geodir_is_page('home')) {
453 453
 				$wp->query_vars['gd_is_geodir_page'] = true;
454 454
 			}
455 455
 
456 456
 
457 457
 		}
458 458
 
459
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['page_id'] ) ) {
459
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
460 460
 			if (
461 461
 				$wp->query_vars['page_id'] == geodir_add_listing_page_id()
462 462
 				|| $wp->query_vars['page_id'] == geodir_preview_page_id()
@@ -465,26 +465,26 @@  discard block
 block discarded – undo
465 465
 				|| $wp->query_vars['page_id'] == geodir_home_page_id()
466 466
 				|| $wp->query_vars['page_id'] == geodir_info_page_id()
467 467
 				|| $wp->query_vars['page_id'] == geodir_login_page_id()
468
-				|| ( function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() )
469
-				|| ( function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() )
468
+				|| (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
469
+				|| (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
470 470
 			) {
471 471
 				$wp->query_vars['gd_is_geodir_page'] = true;
472 472
 			}
473 473
 		}
474 474
 
475
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['pagename'] ) ) {
476
-			$page = get_page_by_path( $wp->query_vars['pagename'] );
475
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
476
+			$page = get_page_by_path($wp->query_vars['pagename']);
477 477
 
478
-			if ( ! empty( $page ) && (
478
+			if (!empty($page) && (
479 479
 					$page->ID == geodir_add_listing_page_id()
480 480
 					|| $page->ID == geodir_preview_page_id()
481 481
 					|| $page->ID == geodir_success_page_id()
482 482
 					|| $page->ID == geodir_location_page_id()
483
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_home_page_id() )
484
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_info_page_id() )
485
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_login_page_id() )
486
-					|| ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() )
487
-					|| ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() )
483
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id())
484
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id())
485
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id())
486
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
487
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
488 488
 				)
489 489
 			) {
490 490
 				$wp->query_vars['gd_is_geodir_page'] = true;
@@ -492,20 +492,20 @@  discard block
 block discarded – undo
492 492
 		}
493 493
 
494 494
 
495
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['post_type'] ) && $wp->query_vars['post_type'] != '' ) {
495
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
496 496
 			$requested_post_type = $wp->query_vars['post_type'];
497 497
 			// check if this post type is geodirectory post types
498 498
 			$post_type_array = geodir_get_posttypes();
499
-			if ( in_array( $requested_post_type, $post_type_array ) ) {
499
+			if (in_array($requested_post_type, $post_type_array)) {
500 500
 				$wp->query_vars['gd_is_geodir_page'] = true;
501 501
 			}
502 502
 		}
503 503
 
504
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) ) {
505
-			$geodir_taxonomis = geodir_get_taxonomies( '', true );
506
-			if ( ! empty( $geodir_taxonomis ) ) {
507
-				foreach ( $geodir_taxonomis as $taxonomy ) {
508
-					if ( array_key_exists( $taxonomy, $wp->query_vars ) ) {
504
+		if (!isset($wp->query_vars['gd_is_geodir_page'])) {
505
+			$geodir_taxonomis = geodir_get_taxonomies('', true);
506
+			if (!empty($geodir_taxonomis)) {
507
+				foreach ($geodir_taxonomis as $taxonomy) {
508
+					if (array_key_exists($taxonomy, $wp->query_vars)) {
509 509
 						$wp->query_vars['gd_is_geodir_page'] = true;
510 510
 						break;
511 511
 					}
@@ -514,20 +514,20 @@  discard block
 block discarded – undo
514 514
 
515 515
 		}
516 516
 
517
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['author_name'] ) && isset( $_REQUEST['geodir_dashbord'] ) ) {
517
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) {
518 518
 			$wp->query_vars['gd_is_geodir_page'] = true;
519 519
 		}
520 520
 
521 521
 
522
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $_REQUEST['geodir_search'] ) ) {
522
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) {
523 523
 			$wp->query_vars['gd_is_geodir_page'] = true;
524 524
 		}
525 525
 
526 526
 
527 527
 //check if homepage
528
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] )
529
-		     && ! isset( $wp->query_vars['page_id'] )
530
-		     && ! isset( $wp->query_vars['pagename'] )
528
+		if (!isset($wp->query_vars['gd_is_geodir_page'])
529
+		     && !isset($wp->query_vars['page_id'])
530
+		     && !isset($wp->query_vars['pagename'])
531 531
 		     && is_page_geodir_home()
532 532
 		) {
533 533
 			$wp->query_vars['gd_is_geodir_page'] = true;
@@ -551,14 +551,14 @@  discard block
 block discarded – undo
551 551
  */
552 552
 function geodir_is_geodir_page() {
553 553
 	global $wp;
554
-	if ( isset( $wp->query_vars['gd_is_geodir_page'] ) && $wp->query_vars['gd_is_geodir_page'] ) {
554
+	if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) {
555 555
 		return true;
556 556
 	} else {
557 557
 		return false;
558 558
 	}
559 559
 }
560 560
 
561
-if ( ! function_exists( 'geodir_get_imagesize' ) ) {
561
+if (!function_exists('geodir_get_imagesize')) {
562 562
 	/**
563 563
 	 * Get image size using the size key .
564 564
 	 *
@@ -569,13 +569,13 @@  discard block
 block discarded – undo
569 569
 	 *
570 570
 	 * @return array|mixed|void|WP_Error If valid returns image size. Else returns error.
571 571
 	 */
572
-	function geodir_get_imagesize( $size = '' ) {
572
+	function geodir_get_imagesize($size = '') {
573 573
 
574 574
 		$imagesizes = array(
575
-			'list-thumb'   => array( 'w' => 283, 'h' => 188 ),
576
-			'thumbnail'    => array( 'w' => 125, 'h' => 125 ),
577
-			'widget-thumb' => array( 'w' => 50, 'h' => 50 ),
578
-			'slider-thumb' => array( 'w' => 100, 'h' => 100 )
575
+			'list-thumb'   => array('w' => 283, 'h' => 188),
576
+			'thumbnail'    => array('w' => 125, 'h' => 125),
577
+			'widget-thumb' => array('w' => 50, 'h' => 50),
578
+			'slider-thumb' => array('w' => 100, 'h' => 100)
579 579
 		);
580 580
 
581 581
 		/**
@@ -585,9 +585,9 @@  discard block
 block discarded – undo
585 585
 		 *
586 586
 		 * @param array $imagesizes Image size array.
587 587
 		 */
588
-		$imagesizes = apply_filters( 'geodir_imagesizes', $imagesizes );
588
+		$imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
589 589
 
590
-		if ( ! empty( $size ) && array_key_exists( $size, $imagesizes ) ) {
590
+		if (!empty($size) && array_key_exists($size, $imagesizes)) {
591 591
 			/**
592 592
 			 * Filters image size of the passed key.
593 593
 			 *
@@ -595,11 +595,11 @@  discard block
 block discarded – undo
595 595
 			 *
596 596
 			 * @param array $imagesizes [$size] Image size array of the passed key.
597 597
 			 */
598
-			return apply_filters( 'geodir_get_imagesize_' . $size, $imagesizes[ $size ] );
598
+			return apply_filters('geodir_get_imagesize_'.$size, $imagesizes[$size]);
599 599
 
600
-		} elseif ( ! empty( $size ) ) {
600
+		} elseif (!empty($size)) {
601 601
 
602
-			return new WP_Error( 'geodir_no_imagesize', __( "Given image size is not valid", 'geodirectory' ) );
602
+			return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
603 603
 
604 604
 		}
605 605
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 */
624 624
 
625 625
 
626
-if ( ! function_exists( 'createRandomString' ) ) {
626
+if (!function_exists('createRandomString')) {
627 627
 	/**
628 628
 	 * Creates random string.
629 629
 	 *
@@ -633,21 +633,21 @@  discard block
 block discarded – undo
633 633
 	 */
634 634
 	function createRandomString() {
635 635
 		$chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
636
-		srand( (double) microtime() * 1000000 );
636
+		srand((double) microtime() * 1000000);
637 637
 		$i       = 0;
638 638
 		$rstring = '';
639
-		while ( $i <= 25 ) {
639
+		while ($i <= 25) {
640 640
 			$num     = rand() % 33;
641
-			$tmp     = substr( $chars, $num, 1 );
642
-			$rstring = $rstring . $tmp;
643
-			$i ++;
641
+			$tmp     = substr($chars, $num, 1);
642
+			$rstring = $rstring.$tmp;
643
+			$i++;
644 644
 		}
645 645
 
646 646
 		return $rstring;
647 647
 	}
648 648
 }
649 649
 
650
-if ( ! function_exists( 'geodir_getDistanceRadius' ) ) {
650
+if (!function_exists('geodir_getDistanceRadius')) {
651 651
 	/**
652 652
 	 * Calculates the distance radius.
653 653
 	 *
@@ -658,9 +658,9 @@  discard block
 block discarded – undo
658 658
 	 *
659 659
 	 * @return float The mean radius.
660 660
 	 */
661
-	function geodir_getDistanceRadius( $uom = 'km' ) {
661
+	function geodir_getDistanceRadius($uom = 'km') {
662 662
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
663
-		switch ( geodir_strtolower( $uom ) ):
663
+		switch (geodir_strtolower($uom)):
664 664
 			case 'km'    :
665 665
 				$earthMeanRadius = 6371.009; // km
666 666
 				break;
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 }
693 693
 
694 694
 
695
-if ( ! function_exists( 'geodir_calculateDistanceFromLatLong' ) ) {
695
+if (!function_exists('geodir_calculateDistanceFromLatLong')) {
696 696
 	/**
697 697
 	 * Calculate the great circle distance between two points identified by longitude and latitude.
698 698
 	 *
@@ -705,17 +705,17 @@  discard block
 block discarded – undo
705 705
 	 *
706 706
 	 * @return float The distance.
707 707
 	 */
708
-	function geodir_calculateDistanceFromLatLong( $point1, $point2, $uom = 'km' ) {
708
+	function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km') {
709 709
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
710 710
 
711
-		$earthMeanRadius = geodir_getDistanceRadius( $uom );
711
+		$earthMeanRadius = geodir_getDistanceRadius($uom);
712 712
 
713
-		$deltaLatitude  = deg2rad( (float) $point2['latitude'] - (float) $point1['latitude'] );
714
-		$deltaLongitude = deg2rad( (float) $point2['longitude'] - (float) $point1['longitude'] );
715
-		$a              = sin( $deltaLatitude / 2 ) * sin( $deltaLatitude / 2 ) +
716
-		                  cos( deg2rad( (float) $point1['latitude'] ) ) * cos( deg2rad( (float) $point2['latitude'] ) ) *
717
-		                  sin( $deltaLongitude / 2 ) * sin( $deltaLongitude / 2 );
718
-		$c              = 2 * atan2( sqrt( $a ), sqrt( 1 - $a ) );
713
+		$deltaLatitude  = deg2rad((float) $point2['latitude'] - (float) $point1['latitude']);
714
+		$deltaLongitude = deg2rad((float) $point2['longitude'] - (float) $point1['longitude']);
715
+		$a              = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
716
+		                  cos(deg2rad((float) $point1['latitude'])) * cos(deg2rad((float) $point2['latitude'])) *
717
+		                  sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
718
+		$c              = 2 * atan2(sqrt($a), sqrt(1 - $a));
719 719
 		$distance       = $earthMeanRadius * $c;
720 720
 
721 721
 		return $distance;
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 }
725 725
 
726 726
 
727
-if ( ! function_exists( 'geodir_sendEmail' ) ) {
727
+if (!function_exists('geodir_sendEmail')) {
728 728
 	/**
729 729
 	 * The main function that send transactional emails using the args provided.
730 730
 	 *
@@ -743,95 +743,95 @@  discard block
 block discarded – undo
743 743
 	 * @param string $post_id       The post ID.
744 744
 	 * @param string $user_id       The user ID.
745 745
 	 */
746
-	function geodir_sendEmail( $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '' ) {
746
+	function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
747 747
 		$login_details = '';
748 748
 
749 749
 		// strip slashes from subject & message text
750
-		$to_subject = stripslashes_deep( $to_subject );
751
-		$to_message = stripslashes_deep( $to_message );
750
+		$to_subject = stripslashes_deep($to_subject);
751
+		$to_message = stripslashes_deep($to_message);
752 752
 
753
-		if ( $message_type == 'send_friend' ) {
754
-			$subject = get_option( 'geodir_email_friend_subject' );
755
-			$message = get_option( 'geodir_email_friend_content' );
756
-		} elseif ( $message_type == 'send_enquiry' ) {
757
-			$subject = get_option( 'geodir_email_enquiry_subject' );
758
-			$message = get_option( 'geodir_email_enquiry_content' );
753
+		if ($message_type == 'send_friend') {
754
+			$subject = get_option('geodir_email_friend_subject');
755
+			$message = get_option('geodir_email_friend_content');
756
+		} elseif ($message_type == 'send_enquiry') {
757
+			$subject = get_option('geodir_email_enquiry_subject');
758
+			$message = get_option('geodir_email_enquiry_content');
759 759
 
760 760
 			// change to name in some cases
761
-			$post_author = get_post_field( 'post_author', $post_id );
762
-			if(is_super_admin( $post_author  )){// if admin probably not the post author so change name
763
-				$toEmailName = __('Business Owner','geodirectory');
764
-			}elseif(defined('GEODIRCLAIM_VERSION') && geodir_get_post_meta($post_id,'claimed')!='1'){// if claim manager installed but listing not claimed
765
-				$toEmailName = __('Business Owner','geodirectory');
761
+			$post_author = get_post_field('post_author', $post_id);
762
+			if (is_super_admin($post_author)) {// if admin probably not the post author so change name
763
+				$toEmailName = __('Business Owner', 'geodirectory');
764
+			}elseif (defined('GEODIRCLAIM_VERSION') && geodir_get_post_meta($post_id, 'claimed') != '1') {// if claim manager installed but listing not claimed
765
+				$toEmailName = __('Business Owner', 'geodirectory');
766 766
 			}
767 767
 
768 768
 
769
-		} elseif ( $message_type == 'forgot_password' ) {
770
-			$subject       = get_option( 'geodir_forgot_password_subject' );
771
-			$message       = get_option( 'geodir_forgot_password_content' );
769
+		} elseif ($message_type == 'forgot_password') {
770
+			$subject       = get_option('geodir_forgot_password_subject');
771
+			$message       = get_option('geodir_forgot_password_content');
772 772
 			$login_details = $to_message;
773
-		} elseif ( $message_type == 'registration' ) {
774
-			$subject       = get_option( 'geodir_registration_success_email_subject' );
775
-			$message       = get_option( 'geodir_registration_success_email_content' );
773
+		} elseif ($message_type == 'registration') {
774
+			$subject       = get_option('geodir_registration_success_email_subject');
775
+			$message       = get_option('geodir_registration_success_email_content');
776 776
 			$login_details = $to_message;
777
-		} elseif ( $message_type == 'post_submit' ) {
778
-			$subject = get_option( 'geodir_post_submited_success_email_subject' );
779
-			$message = get_option( 'geodir_post_submited_success_email_content' );
780
-		} elseif ( $message_type == 'listing_published' ) {
781
-			$subject = get_option( 'geodir_post_published_email_subject' );
782
-			$message = get_option( 'geodir_post_published_email_content' );
783
-		} elseif ( $message_type == 'listing_edited' ) {
784
-			$subject = get_option( 'geodir_post_edited_email_subject_admin' );
785
-			$message = get_option( 'geodir_post_edited_email_content_admin' );
777
+		} elseif ($message_type == 'post_submit') {
778
+			$subject = get_option('geodir_post_submited_success_email_subject');
779
+			$message = get_option('geodir_post_submited_success_email_content');
780
+		} elseif ($message_type == 'listing_published') {
781
+			$subject = get_option('geodir_post_published_email_subject');
782
+			$message = get_option('geodir_post_published_email_content');
783
+		} elseif ($message_type == 'listing_edited') {
784
+			$subject = get_option('geodir_post_edited_email_subject_admin');
785
+			$message = get_option('geodir_post_edited_email_content_admin');
786 786
 		}
787 787
 
788
-		if ( ! empty( $subject ) ) {
789
-			$subject = __( stripslashes_deep( $subject ), 'geodirectory' );
788
+		if (!empty($subject)) {
789
+			$subject = __(stripslashes_deep($subject), 'geodirectory');
790 790
 		}
791 791
 
792
-		if ( ! empty( $message ) ) {
793
-			$message = __( stripslashes_deep( $message ), 'geodirectory' );
792
+		if (!empty($message)) {
793
+			$message = __(stripslashes_deep($message), 'geodirectory');
794 794
 		}
795 795
 
796
-		$to_message        = nl2br( $to_message );
797
-		$sitefromEmail     = get_option( 'site_email' );
796
+		$to_message        = nl2br($to_message);
797
+		$sitefromEmail     = get_option('site_email');
798 798
 		$sitefromEmailName = get_site_emailName();
799
-		$productlink       = get_permalink( $post_id );
799
+		$productlink       = get_permalink($post_id);
800 800
 
801 801
 		$user_login = '';
802
-		if ( $user_id > 0 && $user_info = get_userdata( $user_id ) ) {
802
+		if ($user_id > 0 && $user_info = get_userdata($user_id)) {
803 803
 			$user_login = $user_info->user_login;
804 804
 		}
805 805
 
806 806
 		$posted_date = '';
807 807
 		$listingLink = '';
808 808
 
809
-		$post_info = get_post( $post_id );
809
+		$post_info = get_post($post_id);
810 810
 
811
-		if ( $post_info ) {
811
+		if ($post_info) {
812 812
 			$posted_date = $post_info->post_date;
813
-			$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
813
+			$listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
814 814
 		}
815 815
 		$siteurl       = home_url();
816
-		$siteurl_link  = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
816
+		$siteurl_link  = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
817 817
 		$loginurl      = geodir_login_url();
818
-		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
818
+		$loginurl_link = '<a href="'.$loginurl.'">login</a>';
819 819
         
820
-		$post_author_id   = ! empty( $post_info ) ? $post_info->post_author : 0;
821
-		$post_author_data = $post_author_id ? get_userdata( $post_author_id ) : NULL;
822
-		$post_author_name = geodir_get_client_name( $post_author_id );
823
-		$post_author_email = !empty( $post_author_data->user_email ) ? $post_author_data->user_email : '';
824
-		$current_date     = date_i18n( 'Y-m-d H:i:s', current_time( 'timestamp' ) );
825
-
826
-		if ( $fromEmail == '' ) {
827
-			$fromEmail = get_option( 'site_email' );
820
+		$post_author_id   = !empty($post_info) ? $post_info->post_author : 0;
821
+		$post_author_data = $post_author_id ? get_userdata($post_author_id) : NULL;
822
+		$post_author_name = geodir_get_client_name($post_author_id);
823
+		$post_author_email = !empty($post_author_data->user_email) ? $post_author_data->user_email : '';
824
+		$current_date     = date_i18n('Y-m-d H:i:s', current_time('timestamp'));
825
+
826
+		if ($fromEmail == '') {
827
+			$fromEmail = get_option('site_email');
828 828
 		}
829 829
 
830
-		if ( $fromEmailName == '' ) {
831
-			$fromEmailName = get_option( 'site_email_name' );
830
+		if ($fromEmailName == '') {
831
+			$fromEmailName = get_option('site_email_name');
832 832
 		}
833 833
 
834
-		$search_array  = array(
834
+		$search_array = array(
835 835
 			'[#listing_link#]',
836 836
 			'[#site_name_url#]',
837 837
 			'[#post_id#]',
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
 			$post_author_email,
874 874
 			$current_date,
875 875
 		);
876
-		$message       = str_replace( $search_array, $replace_array, $message );
876
+		$message       = str_replace($search_array, $replace_array, $message);
877 877
 
878 878
 		$search_array  = array(
879 879
 			'[#listing_link#]',
@@ -911,12 +911,12 @@  discard block
 block discarded – undo
911 911
 			$post_author_email,
912 912
 			$current_date
913 913
 		);
914
-		$subject       = str_replace( $search_array, $replace_array, $subject );
914
+		$subject = str_replace($search_array, $replace_array, $subject);
915 915
 
916
-		$headers =  array();
916
+		$headers = array();
917 917
 		$headers[] = 'Content-type: text/html; charset=UTF-8';
918
-		$headers[] = "Reply-To: " . $fromEmail;
919
-		$headers[] = 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>';
918
+		$headers[] = "Reply-To: ".$fromEmail;
919
+		$headers[] = 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>';
920 920
 
921 921
 		$to = $toEmail;
922 922
 
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 		 * @param string $post_id       The post ID.
939 939
 		 * @param string $user_id       The user ID.
940 940
 		 */
941
-		$to = apply_filters( 'geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
941
+		$to = apply_filters('geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
942 942
 		/**
943 943
 		 * Filter the client email subject.
944 944
 		 *
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 		 * @param string $post_id       The post ID.
958 958
 		 * @param string $user_id       The user ID.
959 959
 		 */
960
-		$subject = apply_filters( 'geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
960
+		$subject = apply_filters('geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
961 961
 		/**
962 962
 		 * Filter the client email message.
963 963
 		 *
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
 		 * @param string $post_id       The post ID.
977 977
 		 * @param string $user_id       The user ID.
978 978
 		 */
979
-		$message = apply_filters( 'geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
979
+		$message = apply_filters('geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
980 980
 		/**
981 981
 		 * Filter the client email headers.
982 982
 		 *
@@ -995,39 +995,39 @@  discard block
 block discarded – undo
995 995
 		 * @param string $post_id       The post ID.
996 996
 		 * @param string $user_id       The user ID.
997 997
 		 */
998
-		$headers = apply_filters( 'geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
998
+		$headers = apply_filters('geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
999 999
 
1000
-		$sent = wp_mail( $to, $subject, $message, $headers );
1000
+		$sent = wp_mail($to, $subject, $message, $headers);
1001 1001
 
1002
-		if ( ! $sent ) {
1003
-			if ( is_array( $to ) ) {
1004
-				$to = implode( ',', $to );
1002
+		if (!$sent) {
1003
+			if (is_array($to)) {
1004
+				$to = implode(',', $to);
1005 1005
 			}
1006 1006
 			$log_message = sprintf(
1007
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1007
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1008 1008
 				$message_type,
1009
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1009
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
1010 1010
 				$to,
1011 1011
 				$subject
1012 1012
 			);
1013
-			geodir_error_log( $log_message );
1013
+			geodir_error_log($log_message);
1014 1014
 		}
1015 1015
 
1016 1016
 		///////// ADMIN BCC EMIALS
1017
-		$adminEmail = get_bloginfo( 'admin_email' );
1017
+		$adminEmail = get_bloginfo('admin_email');
1018 1018
 		$to         = $adminEmail;
1019 1019
 
1020 1020
 		$admin_bcc = false;
1021
-		if ( $message_type == 'registration' ) {
1022
-			$message_raw  = explode( __( "Password:", 'geodirectory' ), $message );
1023
-			$message_raw2 = explode( "</p>", $message_raw[1], 2 );
1024
-			$message      = $message_raw[0] . __( 'Password:', 'geodirectory' ) . ' **********</p>' . $message_raw2[1];
1021
+		if ($message_type == 'registration') {
1022
+			$message_raw  = explode(__("Password:", 'geodirectory'), $message);
1023
+			$message_raw2 = explode("</p>", $message_raw[1], 2);
1024
+			$message      = $message_raw[0].__('Password:', 'geodirectory').' **********</p>'.$message_raw2[1];
1025 1025
 		}
1026
-		if ( $message_type == 'post_submit' ) {
1027
-			$subject = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_subject_admin' ) ), 'geodirectory' );
1028
-			$message = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_content_admin' ) ), 'geodirectory' );
1026
+		if ($message_type == 'post_submit') {
1027
+			$subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
1028
+			$message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
1029 1029
 
1030
-			$search_array  = array(
1030
+			$search_array = array(
1031 1031
 				'[#listing_link#]',
1032 1032
 				'[#site_name_url#]',
1033 1033
 				'[#post_id#]',
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
 				$user_login,
1064 1064
 				$post_author_email,
1065 1065
 			);
1066
-			$message       = str_replace( $search_array, $replace_array, $message );
1066
+			$message       = str_replace($search_array, $replace_array, $message);
1067 1067
 
1068 1068
 			$search_array  = array(
1069 1069
 				'[#listing_link#]',
@@ -1095,26 +1095,26 @@  discard block
 block discarded – undo
1095 1095
 				$user_login,
1096 1096
 				$post_author_email,
1097 1097
 			);
1098
-			$subject       = str_replace( $search_array, $replace_array, $subject );
1098
+			$subject = str_replace($search_array, $replace_array, $subject);
1099 1099
 
1100 1100
 			$subject .= ' - ADMIN BCC COPY';
1101 1101
 			$admin_bcc = true;
1102 1102
 
1103
-		} elseif ( $message_type == 'registration' && get_option( 'geodir_bcc_new_user' ) ) {
1103
+		} elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
1104 1104
 			$subject .= ' - ADMIN BCC COPY';
1105 1105
 			$admin_bcc = true;
1106
-		} elseif ( $message_type == 'send_friend' && get_option( 'geodir_bcc_friend' ) ) {
1106
+		} elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
1107 1107
 			$subject .= ' - ADMIN BCC COPY';
1108 1108
 			$admin_bcc = true;
1109
-		} elseif ( $message_type == 'send_enquiry' && get_option( 'geodir_bcc_enquiry' ) ) {
1109
+		} elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
1110 1110
 			$subject .= ' - ADMIN BCC COPY';
1111 1111
 			$admin_bcc = true;
1112
-		} elseif ( $message_type == 'listing_published' && get_option( 'geodir_bcc_listing_published' ) ) {
1112
+		} elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
1113 1113
 			$subject .= ' - ADMIN BCC COPY';
1114 1114
 			$admin_bcc = true;
1115 1115
 		}
1116 1116
 
1117
-		if ( $admin_bcc === true ) {
1117
+		if ($admin_bcc === true) {
1118 1118
 
1119 1119
 			/**
1120 1120
 			 * Filter the client email subject.
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 			 * @param string $post_id       The post ID.
1135 1135
 			 * @param string $user_id       The user ID.
1136 1136
 			 */
1137
-			$subject = apply_filters( 'geodir_sendEmail_subject_admin_bcc', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
1137
+			$subject = apply_filters('geodir_sendEmail_subject_admin_bcc', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
1138 1138
 			/**
1139 1139
 			 * Filter the client email message.
1140 1140
 			 *
@@ -1153,23 +1153,23 @@  discard block
 block discarded – undo
1153 1153
 			 * @param string $post_id       The post ID.
1154 1154
 			 * @param string $user_id       The user ID.
1155 1155
 			 */
1156
-			$message = apply_filters( 'geodir_sendEmail_message_admin_bcc', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
1156
+			$message = apply_filters('geodir_sendEmail_message_admin_bcc', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
1157 1157
 
1158 1158
 
1159
-			$sent = wp_mail( $to, $subject, $message, $headers );
1159
+			$sent = wp_mail($to, $subject, $message, $headers);
1160 1160
 
1161
-			if ( ! $sent ) {
1162
-				if ( is_array( $to ) ) {
1163
-					$to = implode( ',', $to );
1161
+			if (!$sent) {
1162
+				if (is_array($to)) {
1163
+					$to = implode(',', $to);
1164 1164
 				}
1165 1165
 				$log_message = sprintf(
1166
-					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1166
+					__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1167 1167
 					$message_type,
1168
-					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1168
+					date_i18n('F j Y H:i:s', current_time('timestamp')),
1169 1169
 					$to,
1170 1170
 					$subject
1171 1171
 				);
1172
-				geodir_error_log( $log_message );
1172
+				geodir_error_log($log_message);
1173 1173
 			}
1174 1174
 		}
1175 1175
 
@@ -1185,49 +1185,49 @@  discard block
 block discarded – undo
1185 1185
  */
1186 1186
 function geodir_taxonomy_breadcrumb() {
1187 1187
 
1188
-	$term   = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
1188
+	$term   = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
1189 1189
 	$parent = $term->parent;
1190 1190
 
1191
-	while ( $parent ):
1191
+	while ($parent):
1192 1192
 		$parents[]  = $parent;
1193
-		$new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
1193
+		$new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
1194 1194
 		$parent     = $new_parent->parent;
1195 1195
 	endwhile;
1196 1196
 
1197
-	if ( ! empty( $parents ) ):
1198
-		$parents = array_reverse( $parents );
1197
+	if (!empty($parents)):
1198
+		$parents = array_reverse($parents);
1199 1199
 
1200
-		foreach ( $parents as $parent ):
1201
-			$item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
1202
-			$url  = get_term_link( $item, get_query_var( 'taxonomy' ) );
1203
-			echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
1200
+		foreach ($parents as $parent):
1201
+			$item = get_term_by('id', $parent, get_query_var('taxonomy'));
1202
+			$url  = get_term_link($item, get_query_var('taxonomy'));
1203
+			echo '<li> > <a href="'.$url.'">'.$item->name.'</a></li>';
1204 1204
 		endforeach;
1205 1205
 
1206 1206
 	endif;
1207 1207
 
1208
-	echo '<li> > ' . $term->name . '</li>';
1208
+	echo '<li> > '.$term->name.'</li>';
1209 1209
 }
1210 1210
 
1211
-function geodir_wpml_post_type_archive_link($link, $post_type){
1211
+function geodir_wpml_post_type_archive_link($link, $post_type) {
1212 1212
 	if (function_exists('icl_object_id')) {
1213
-		$post_types   = get_option( 'geodir_post_types' );
1214
-		$slug         = $post_types[ $post_type ]['rewrite']['slug'];
1213
+		$post_types   = get_option('geodir_post_types');
1214
+		$slug         = $post_types[$post_type]['rewrite']['slug'];
1215 1215
 
1216 1216
 		// Alter the CPT slug if WPML is set to do so
1217
-		if ( function_exists( 'icl_object_id' ) ) {
1218
-			if ( gd_wpml_slug_translation_turned_on( $post_type ) && $language_code = gd_wpml_get_lang_from_url( $link) ) {
1217
+		if (function_exists('icl_object_id')) {
1218
+			if (gd_wpml_slug_translation_turned_on($post_type) && $language_code = gd_wpml_get_lang_from_url($link)) {
1219 1219
 
1220 1220
 				$org_slug = $slug;
1221
-				$slug     = apply_filters( 'wpml_translate_single_string',
1221
+				$slug     = apply_filters('wpml_translate_single_string',
1222 1222
 					$slug,
1223 1223
 					'WordPress',
1224
-					'URL slug: ' . $slug,
1225
-					$language_code );
1224
+					'URL slug: '.$slug,
1225
+					$language_code);
1226 1226
                     
1227
-				if ( ! $slug ) {
1227
+				if (!$slug) {
1228 1228
 					$slug = $org_slug;
1229 1229
 				} else {
1230
-					$link = str_replace( $org_slug, $slug, $link );
1230
+					$link = str_replace($org_slug, $slug, $link);
1231 1231
 				}
1232 1232
 			}
1233 1233
 		}
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
 
1236 1236
 	return $link;
1237 1237
 }
1238
-add_filter( 'post_type_archive_link','geodir_wpml_post_type_archive_link', 1000, 2);
1238
+add_filter('post_type_archive_link', 'geodir_wpml_post_type_archive_link', 1000, 2);
1239 1239
 
1240 1240
 /**
1241 1241
  * Main function that generates breadcrumb for all pages.
@@ -1256,9 +1256,9 @@  discard block
 block discarded – undo
1256 1256
 	 *
1257 1257
 	 * @since 1.0.0
1258 1258
 	 */
1259
-	$separator = apply_filters( 'geodir_breadcrumb_separator', ' > ' );
1259
+	$separator = apply_filters('geodir_breadcrumb_separator', ' > ');
1260 1260
 
1261
-	if ( ! geodir_is_page( 'home' ) ) {
1261
+	if (!geodir_is_page('home')) {
1262 1262
 		$breadcrumb    = '';
1263 1263
 		$url_categoris = '';
1264 1264
 		$breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
@@ -1267,167 +1267,167 @@  discard block
 block discarded – undo
1267 1267
 		 *
1268 1268
 		 * @since 1.0.0
1269 1269
 		 */
1270
-		$breadcrumb .= '<li>' . apply_filters( 'geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __( 'Home', 'geodirectory' ) . '</a>' ) . '</li>';
1270
+		$breadcrumb .= '<li>'.apply_filters('geodir_breadcrumb_first_link', '<a href="'.home_url().'">'.__('Home', 'geodirectory').'</a>').'</li>';
1271 1271
 
1272 1272
 		$gd_post_type   = geodir_get_current_posttype();
1273
-		$post_type_info = get_post_type_object( $gd_post_type );
1273
+		$post_type_info = get_post_type_object($gd_post_type);
1274 1274
 
1275
-		remove_filter( 'post_type_archive_link', 'geodir_get_posttype_link' );
1275
+		remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
1276 1276
 
1277
-		$listing_link = get_post_type_archive_link( $gd_post_type );
1277
+		$listing_link = get_post_type_archive_link($gd_post_type);
1278 1278
 
1279
-		add_filter( 'post_type_archive_link', 'geodir_get_posttype_link', 10, 2 );
1280
-		$listing_link = rtrim( $listing_link, '/' );
1279
+		add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
1280
+		$listing_link = rtrim($listing_link, '/');
1281 1281
 		$listing_link .= '/';
1282 1282
 
1283 1283
 		$post_type_for_location_link = $listing_link;
1284
-		$location_terms              = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
1284
+		$location_terms              = geodir_get_current_location_terms('query_vars', $gd_post_type);
1285 1285
 
1286 1286
 		global $wp, $gd_session;
1287 1287
 		$location_link = $post_type_for_location_link;
1288 1288
 
1289
-		if ( geodir_is_page( 'detail' ) || geodir_is_page( 'listing' ) ) {
1289
+		if (geodir_is_page('detail') || geodir_is_page('listing')) {
1290 1290
 			global $post;
1291
-			$location_manager     = defined( 'POST_LOCATION_TABLE' ) ? true : false;
1292
-			$neighbourhood_active = $location_manager && get_option( 'location_neighbourhoods' ) ? true : false;
1291
+			$location_manager     = defined('POST_LOCATION_TABLE') ? true : false;
1292
+			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1293 1293
 
1294
-			if ( geodir_is_page( 'detail' ) && isset( $post->country_slug ) ) {
1294
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1295 1295
 				$location_terms = array(
1296 1296
 					'gd_country' => $post->country_slug,
1297 1297
 					'gd_region'  => $post->region_slug,
1298 1298
 					'gd_city'    => $post->city_slug
1299 1299
 				);
1300 1300
 
1301
-				if ( $neighbourhood_active && ! empty( $location_terms['gd_city'] ) && $gd_ses_neighbourhood = $gd_session->get( 'gd_neighbourhood' ) ) {
1301
+				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1302 1302
 					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1303 1303
 				}
1304 1304
 			}
1305 1305
 
1306
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
1306
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1307 1307
 
1308 1308
 			$hide_url_part = array();
1309
-			if ( $location_manager ) {
1310
-				$hide_country_part = get_option( 'geodir_location_hide_country_part' );
1311
-				$hide_region_part  = get_option( 'geodir_location_hide_region_part' );
1312
-
1313
-				if ( $hide_region_part && $hide_country_part ) {
1314
-					$hide_url_part = array( 'gd_country', 'gd_region' );
1315
-				} else if ( $hide_region_part && ! $hide_country_part ) {
1316
-					$hide_url_part = array( 'gd_region' );
1317
-				} else if ( ! $hide_region_part && $hide_country_part ) {
1318
-					$hide_url_part = array( 'gd_country' );
1309
+			if ($location_manager) {
1310
+				$hide_country_part = get_option('geodir_location_hide_country_part');
1311
+				$hide_region_part  = get_option('geodir_location_hide_region_part');
1312
+
1313
+				if ($hide_region_part && $hide_country_part) {
1314
+					$hide_url_part = array('gd_country', 'gd_region');
1315
+				} else if ($hide_region_part && !$hide_country_part) {
1316
+					$hide_url_part = array('gd_region');
1317
+				} else if (!$hide_region_part && $hide_country_part) {
1318
+					$hide_url_part = array('gd_country');
1319 1319
 				}
1320 1320
 			}
1321 1321
 
1322 1322
 			$hide_text_part = array();
1323
-			if ( $geodir_show_location_url == 'country_city' ) {
1324
-				$hide_text_part = array( 'gd_region' );
1323
+			if ($geodir_show_location_url == 'country_city') {
1324
+				$hide_text_part = array('gd_region');
1325 1325
 
1326
-				if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
1327
-					unset( $location_terms['gd_region'] );
1326
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1327
+					unset($location_terms['gd_region']);
1328 1328
 				}
1329
-			} else if ( $geodir_show_location_url == 'region_city' ) {
1330
-				$hide_text_part = array( 'gd_country' );
1329
+			} else if ($geodir_show_location_url == 'region_city') {
1330
+				$hide_text_part = array('gd_country');
1331 1331
 
1332
-				if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
1333
-					unset( $location_terms['gd_country'] );
1332
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1333
+					unset($location_terms['gd_country']);
1334 1334
 				}
1335
-			} else if ( $geodir_show_location_url == 'city' ) {
1336
-				$hide_text_part = array( 'gd_country', 'gd_region' );
1335
+			} else if ($geodir_show_location_url == 'city') {
1336
+				$hide_text_part = array('gd_country', 'gd_region');
1337 1337
 
1338
-				if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
1339
-					unset( $location_terms['gd_country'] );
1338
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1339
+					unset($location_terms['gd_country']);
1340 1340
 				}
1341
-				if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
1342
-					unset( $location_terms['gd_region'] );
1341
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1342
+					unset($location_terms['gd_region']);
1343 1343
 				}
1344 1344
 			}
1345 1345
 
1346 1346
 			$is_location_last = '';
1347 1347
 			$is_taxonomy_last = '';
1348 1348
 			$breadcrumb .= '<li>';
1349
-			if ( get_query_var( $gd_post_type . 'category' ) ) {
1350
-				$gd_taxonomy = $gd_post_type . 'category';
1351
-			} elseif ( get_query_var( $gd_post_type . '_tags' ) ) {
1352
-				$gd_taxonomy = $gd_post_type . '_tags';
1349
+			if (get_query_var($gd_post_type.'category')) {
1350
+				$gd_taxonomy = $gd_post_type.'category';
1351
+			} elseif (get_query_var($gd_post_type.'_tags')) {
1352
+				$gd_taxonomy = $gd_post_type.'_tags';
1353 1353
 			}
1354 1354
 
1355
-			$breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>';
1356
-			if ( ! empty( $gd_taxonomy ) || geodir_is_page( 'detail' ) ) {
1355
+			$breadcrumb .= $separator.'<a href="'.$listing_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1356
+			if (!empty($gd_taxonomy) || geodir_is_page('detail')) {
1357 1357
 				$is_location_last = false;
1358 1358
 			} else {
1359 1359
 				$is_location_last = true;
1360 1360
 			}
1361 1361
 
1362
-			if ( ! empty( $gd_taxonomy ) && geodir_is_page( 'listing' ) ) {
1362
+			if (!empty($gd_taxonomy) && geodir_is_page('listing')) {
1363 1363
 				$is_taxonomy_last = true;
1364 1364
 			} else {
1365 1365
 				$is_taxonomy_last = false;
1366 1366
 			}
1367 1367
 
1368
-			if ( ! empty( $location_terms ) ) {
1369
-				$geodir_get_locations = function_exists( 'get_actual_location_name' ) ? true : false;
1368
+			if (!empty($location_terms)) {
1369
+				$geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
1370 1370
 
1371
-				foreach ( $location_terms as $key => $location_term ) {
1372
-					if ( $location_term != '' ) {
1373
-						if ( ! empty( $hide_url_part ) && in_array( $key, $hide_url_part ) ) { // Hide location part from url & breadcrumb.
1371
+				foreach ($location_terms as $key => $location_term) {
1372
+					if ($location_term != '') {
1373
+						if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
1374 1374
 							continue;
1375 1375
 						}
1376 1376
 
1377
-						$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location_term );
1378
-						$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
1379
-						$gd_location_link_text = ucfirst( $gd_location_link_text );
1377
+						$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
1378
+						$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
1379
+						$gd_location_link_text = ucfirst($gd_location_link_text);
1380 1380
 
1381 1381
 						$location_term_actual_country = '';
1382 1382
 						$location_term_actual_region  = '';
1383 1383
 						$location_term_actual_city    = '';
1384 1384
 						$location_term_actual_neighbourhood = '';
1385
-						if ( $geodir_get_locations ) {
1386
-							if ( $key == 'gd_country' ) {
1387
-								$location_term_actual_country = get_actual_location_name( 'country', $location_term, true );
1388
-							} else if ( $key == 'gd_region' ) {
1389
-								$location_term_actual_region = get_actual_location_name( 'region', $location_term, true );
1390
-							} else if ( $key == 'gd_city' ) {
1391
-								$location_term_actual_city = get_actual_location_name( 'city', $location_term, true );
1392
-							} else if ( $key == 'gd_neighbourhood' ) {
1393
-								$location_term_actual_neighbourhood = get_actual_location_name( 'neighbourhood', $location_term, true );
1385
+						if ($geodir_get_locations) {
1386
+							if ($key == 'gd_country') {
1387
+								$location_term_actual_country = get_actual_location_name('country', $location_term, true);
1388
+							} else if ($key == 'gd_region') {
1389
+								$location_term_actual_region = get_actual_location_name('region', $location_term, true);
1390
+							} else if ($key == 'gd_city') {
1391
+								$location_term_actual_city = get_actual_location_name('city', $location_term, true);
1392
+							} else if ($key == 'gd_neighbourhood') {
1393
+								$location_term_actual_neighbourhood = get_actual_location_name('neighbourhood', $location_term, true);
1394 1394
 							}
1395 1395
 						} else {
1396 1396
 							$location_info = geodir_get_location();
1397 1397
 
1398
-							if ( ! empty( $location_info ) && isset( $location_info->location_id ) ) {
1399
-								if ( $key == 'gd_country' ) {
1400
-									$location_term_actual_country = __( $location_info->country, 'geodirectory' );
1401
-								} else if ( $key == 'gd_region' ) {
1402
-									$location_term_actual_region = __( $location_info->region, 'geodirectory' );
1403
-								} else if ( $key == 'gd_city' ) {
1404
-									$location_term_actual_city = __( $location_info->city, 'geodirectory' );
1398
+							if (!empty($location_info) && isset($location_info->location_id)) {
1399
+								if ($key == 'gd_country') {
1400
+									$location_term_actual_country = __($location_info->country, 'geodirectory');
1401
+								} else if ($key == 'gd_region') {
1402
+									$location_term_actual_region = __($location_info->region, 'geodirectory');
1403
+								} else if ($key == 'gd_city') {
1404
+									$location_term_actual_city = __($location_info->city, 'geodirectory');
1405 1405
 								}
1406 1406
 							}
1407 1407
 						}
1408 1408
 
1409
-						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'] != '' ) ) {
1410
-							$breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1411
-						} else if ( $is_location_last && $key == 'gd_region' && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) {
1412
-							$breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1413
-						} else if ( $is_location_last && $key == 'gd_city' && empty( $location_terms['gd_neighbourhood'] ) ) {
1414
-							$breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1415
-						} else if ( $is_location_last && $key == 'gd_neighbourhood' ) {
1416
-							$breadcrumb .= $location_term_actual_neighbourhood != '' ? $separator . $location_term_actual_neighbourhood : $separator . $gd_location_link_text;
1409
+						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'] != '')) {
1410
+							$breadcrumb .= $location_term_actual_country != '' ? $separator.$location_term_actual_country : $separator.$gd_location_link_text;
1411
+						} else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1412
+							$breadcrumb .= $location_term_actual_region != '' ? $separator.$location_term_actual_region : $separator.$gd_location_link_text;
1413
+						} else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1414
+							$breadcrumb .= $location_term_actual_city != '' ? $separator.$location_term_actual_city : $separator.$gd_location_link_text;
1415
+						} else if ($is_location_last && $key == 'gd_neighbourhood') {
1416
+							$breadcrumb .= $location_term_actual_neighbourhood != '' ? $separator.$location_term_actual_neighbourhood : $separator.$gd_location_link_text;
1417 1417
 						} else {
1418
-							if ( get_option( 'permalink_structure' ) != '' ) {
1419
-								$location_link .= $location_term . '/';
1418
+							if (get_option('permalink_structure') != '') {
1419
+								$location_link .= $location_term.'/';
1420 1420
 							} else {
1421
-								$location_link .= "&$key=" . $location_term;
1421
+								$location_link .= "&$key=".$location_term;
1422 1422
 							}
1423 1423
 
1424
-							if ( $key == 'gd_country' && $location_term_actual_country != '' ) {
1424
+							if ($key == 'gd_country' && $location_term_actual_country != '') {
1425 1425
 								$gd_location_link_text = $location_term_actual_country;
1426
-							} else if ( $key == 'gd_region' && $location_term_actual_region != '' ) {
1426
+							} else if ($key == 'gd_region' && $location_term_actual_region != '') {
1427 1427
 								$gd_location_link_text = $location_term_actual_region;
1428
-							} else if ( $key == 'gd_city' && $location_term_actual_city != '' ) {
1428
+							} else if ($key == 'gd_city' && $location_term_actual_city != '') {
1429 1429
 								$gd_location_link_text = $location_term_actual_city;
1430
-							} else if ( $key == 'gd_neighbourhood' && $location_term_actual_neighbourhood != '' ) {
1430
+							} else if ($key == 'gd_neighbourhood' && $location_term_actual_neighbourhood != '') {
1431 1431
 								$gd_location_link_text = $location_term_actual_neighbourhood;
1432 1432
 							}
1433 1433
 
@@ -1437,76 +1437,76 @@  discard block
 block discarded – undo
1437 1437
                             }
1438 1438
                             */
1439 1439
 
1440
-							$breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1440
+							$breadcrumb .= $separator.'<a href="'.$location_link.'">'.$gd_location_link_text.'</a>';
1441 1441
 						}
1442 1442
 					}
1443 1443
 				}
1444 1444
 			}
1445 1445
 
1446
-			if ( ! empty( $gd_taxonomy ) ) {
1446
+			if (!empty($gd_taxonomy)) {
1447 1447
 				$term_index = 1;
1448 1448
 
1449 1449
 				//if(get_option('geodir_add_categories_url'))
1450 1450
 				{
1451
-					if ( get_query_var( $gd_post_type . '_tags' ) ) {
1452
-						$cat_link = $listing_link . 'tags/';
1451
+					if (get_query_var($gd_post_type.'_tags')) {
1452
+						$cat_link = $listing_link.'tags/';
1453 1453
 					} else {
1454 1454
 						$cat_link = $listing_link;
1455 1455
 					}
1456 1456
 
1457
-					foreach ( $location_terms as $key => $location_term ) {
1458
-						if ( $location_manager && in_array( $key, $hide_url_part ) ) {
1457
+					foreach ($location_terms as $key => $location_term) {
1458
+						if ($location_manager && in_array($key, $hide_url_part)) {
1459 1459
 							continue;
1460 1460
 						}
1461 1461
 
1462
-						if ( $location_term != '' ) {
1463
-							if ( get_option( 'permalink_structure' ) != '' ) {
1464
-								$cat_link .= $location_term . '/';
1462
+						if ($location_term != '') {
1463
+							if (get_option('permalink_structure') != '') {
1464
+								$cat_link .= $location_term.'/';
1465 1465
 							}
1466 1466
 						}
1467 1467
 					}
1468 1468
 
1469
-					$term_array = explode( "/", trim( $wp_query->query[ $gd_taxonomy ], "/" ) );
1470
-					foreach ( $term_array as $term ) {
1471
-						$term_link_text = preg_replace( '/-(\d+)$/', '', $term );
1472
-						$term_link_text = preg_replace( '/[_-]/', ' ', $term_link_text );
1469
+					$term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1470
+					foreach ($term_array as $term) {
1471
+						$term_link_text = preg_replace('/-(\d+)$/', '', $term);
1472
+						$term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1473 1473
 
1474 1474
 						// get term actual name
1475
-						$term_info = get_term_by( 'slug', $term, $gd_taxonomy, 'ARRAY_A' );
1476
-						if ( ! empty( $term_info ) && isset( $term_info['name'] ) && $term_info['name'] != '' ) {
1477
-							$term_link_text = urldecode( $term_info['name'] );
1475
+						$term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1476
+						if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1477
+							$term_link_text = urldecode($term_info['name']);
1478 1478
 						} else {
1479 1479
 							continue;
1480 1480
 							//$term_link_text = wp_strip_all_tags(geodir_ucwords(urldecode($term_link_text)));
1481 1481
 						}
1482 1482
 
1483
-						if ( $term_index == count( $term_array ) && $is_taxonomy_last ) {
1484
-							$breadcrumb .= $separator . $term_link_text;
1483
+						if ($term_index == count($term_array) && $is_taxonomy_last) {
1484
+							$breadcrumb .= $separator.$term_link_text;
1485 1485
 						} else {
1486
-							$cat_link .= $term . '/';
1487
-							$breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1486
+							$cat_link .= $term.'/';
1487
+							$breadcrumb .= $separator.'<a href="'.$cat_link.'">'.$term_link_text.'</a>';
1488 1488
 						}
1489
-						$term_index ++;
1489
+						$term_index++;
1490 1490
 					}
1491 1491
 				}
1492 1492
 
1493 1493
 
1494 1494
 			}
1495 1495
 
1496
-			if ( geodir_is_page( 'detail' ) ) {
1497
-				$breadcrumb .= $separator . get_the_title();
1496
+			if (geodir_is_page('detail')) {
1497
+				$breadcrumb .= $separator.get_the_title();
1498 1498
 			}
1499 1499
 
1500 1500
 			$breadcrumb .= '</li>';
1501 1501
 
1502 1502
 
1503
-		} elseif ( geodir_is_page( 'author' ) ) {
1503
+		} elseif (geodir_is_page('author')) {
1504 1504
 			$user_id             = get_current_user_id();
1505
-			$author_link         = get_author_posts_url( $user_id );
1506
-			$default_author_link = geodir_getlink( $author_link, array(
1505
+			$author_link         = get_author_posts_url($user_id);
1506
+			$default_author_link = geodir_getlink($author_link, array(
1507 1507
 				'geodir_dashbord' => 'true',
1508 1508
 				'stype'           => 'gd_place'
1509
-			), false );
1509
+			), false);
1510 1510
 
1511 1511
 			/**
1512 1512
 			 * Filter author page link.
@@ -1516,16 +1516,16 @@  discard block
 block discarded – undo
1516 1516
 			 * @param string $default_author_link Default author link.
1517 1517
 			 * @param int $user_id                Author ID.
1518 1518
 			 */
1519
-			$default_author_link = apply_filters( 'geodir_dashboard_author_link', $default_author_link, $user_id );
1519
+			$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1520 1520
 
1521 1521
 			$breadcrumb .= '<li>';
1522
-			$breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __( 'My Dashboard', 'geodirectory' ) . '</a>';
1522
+			$breadcrumb .= $separator.'<a href="'.$default_author_link.'">'.__('My Dashboard', 'geodirectory').'</a>';
1523 1523
 
1524
-			if ( isset( $_REQUEST['list'] ) ) {
1525
-				$author_link = geodir_getlink( $author_link, array(
1524
+			if (isset($_REQUEST['list'])) {
1525
+				$author_link = geodir_getlink($author_link, array(
1526 1526
 					'geodir_dashbord' => 'true',
1527 1527
 					'stype'           => $_REQUEST['stype']
1528
-				), false );
1528
+				), false);
1529 1529
 
1530 1530
 				/**
1531 1531
 				 * Filter author page link.
@@ -1536,61 +1536,61 @@  discard block
 block discarded – undo
1536 1536
 				 * @param int $user_id        Author ID.
1537 1537
 				 * @param string $_REQUEST    ['stype'] Post type.
1538 1538
 				 */
1539
-				$author_link = apply_filters( 'geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype'] );
1539
+				$author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1540 1540
 
1541
-				$breadcrumb .= $separator . '<a href="' . $author_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>';
1542
-				$breadcrumb .= $separator . ucfirst( __( 'My', 'geodirectory' ) . ' ' . $_REQUEST['list'] );
1541
+				$breadcrumb .= $separator.'<a href="'.$author_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1542
+				$breadcrumb .= $separator.ucfirst(__('My', 'geodirectory').' '.$_REQUEST['list']);
1543 1543
 			} else {
1544
-				$breadcrumb .= $separator . __( ucfirst( $post_type_info->label ), 'geodirectory' );
1544
+				$breadcrumb .= $separator.__(ucfirst($post_type_info->label), 'geodirectory');
1545 1545
 			}
1546 1546
 
1547 1547
 			$breadcrumb .= '</li>';
1548
-		} elseif ( is_category() || is_single() ) {
1548
+		} elseif (is_category() || is_single()) {
1549 1549
 			$category = get_the_category();
1550
-			if ( is_category() ) {
1551
-				$breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1550
+			if (is_category()) {
1551
+				$breadcrumb .= '<li>'.$separator.$category[0]->cat_name.'</li>';
1552 1552
 			}
1553
-			if ( is_single() ) {
1554
-				$breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link( $category[0]->term_id ) . '">' . $category[0]->cat_name . '</a></li>';
1555
-				$breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1553
+			if (is_single()) {
1554
+				$breadcrumb .= '<li>'.$separator.'<a href="'.get_category_link($category[0]->term_id).'">'.$category[0]->cat_name.'</a></li>';
1555
+				$breadcrumb .= '<li>'.$separator.get_the_title().'</li>';
1556 1556
 			}
1557 1557
 			/* End of my version ##################################################### */
1558
-		} else if ( is_page() ) {
1558
+		} else if (is_page()) {
1559 1559
 			$page_title = get_the_title();
1560 1560
 
1561
-			if ( geodir_is_page( 'location' ) ) {
1561
+			if (geodir_is_page('location')) {
1562 1562
 				$location_page_id = geodir_location_page_id();
1563
-				$loc_post         = get_post( $location_page_id );
1563
+				$loc_post         = get_post($location_page_id);
1564 1564
 				$post_name        = $loc_post->post_name;
1565
-				$slug             = ucwords( str_replace( '-', ' ', $post_name ) );
1566
-				$page_title       = ! empty( $slug ) ? $slug : __( 'Location', 'geodirectory' );
1565
+				$slug             = ucwords(str_replace('-', ' ', $post_name));
1566
+				$page_title       = !empty($slug) ? $slug : __('Location', 'geodirectory');
1567 1567
 			}
1568 1568
 
1569
-			$breadcrumb .= '<li>' . $separator;
1570
-			$breadcrumb .= stripslashes_deep( $page_title );
1569
+			$breadcrumb .= '<li>'.$separator;
1570
+			$breadcrumb .= stripslashes_deep($page_title);
1571 1571
 			$breadcrumb .= '</li>';
1572
-		} else if ( is_tag() ) {
1573
-			$breadcrumb .= "<li> " . $separator . single_tag_title( '', false ) . '</li>';
1574
-		} else if ( is_day() ) {
1575
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1576
-			the_time( 'F jS, Y' );
1572
+		} else if (is_tag()) {
1573
+			$breadcrumb .= "<li> ".$separator.single_tag_title('', false).'</li>';
1574
+		} else if (is_day()) {
1575
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1576
+			the_time('F jS, Y');
1577 1577
 			$breadcrumb .= '</li>';
1578
-		} else if ( is_month() ) {
1579
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1580
-			the_time( 'F, Y' );
1578
+		} else if (is_month()) {
1579
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1580
+			the_time('F, Y');
1581 1581
 			$breadcrumb .= '</li>';
1582
-		} else if ( is_year() ) {
1583
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1584
-			the_time( 'Y' );
1582
+		} else if (is_year()) {
1583
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1584
+			the_time('Y');
1585 1585
 			$breadcrumb .= '</li>';
1586
-		} else if ( is_author() ) {
1587
-			$breadcrumb .= "<li> " . $separator . __( " Author Archive", 'geodirectory' );
1586
+		} else if (is_author()) {
1587
+			$breadcrumb .= "<li> ".$separator.__(" Author Archive", 'geodirectory');
1588 1588
 			$breadcrumb .= '</li>';
1589
-		} else if ( isset( $_GET['paged'] ) && ! empty( $_GET['paged'] ) ) {
1590
-			$breadcrumb .= "<li>" . $separator . __( "Blog Archives", 'geodirectory' );
1589
+		} else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1590
+			$breadcrumb .= "<li>".$separator.__("Blog Archives", 'geodirectory');
1591 1591
 			$breadcrumb .= '</li>';
1592
-		} else if ( is_search() ) {
1593
-			$breadcrumb .= "<li> " . $separator . __( " Search Results", 'geodirectory' );
1592
+		} else if (is_search()) {
1593
+			$breadcrumb .= "<li> ".$separator.__(" Search Results", 'geodirectory');
1594 1594
 			$breadcrumb .= '</li>';
1595 1595
 		}
1596 1596
 		$breadcrumb .= '</ul></div>';
@@ -1603,13 +1603,13 @@  discard block
 block discarded – undo
1603 1603
 		 * @param string $breadcrumb Breadcrumb HTML.
1604 1604
 		 * @param string $separator  Breadcrumb separator.
1605 1605
 		 */
1606
-		echo $breadcrumb = apply_filters( 'geodir_breadcrumb', $breadcrumb, $separator );
1606
+		echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1607 1607
 	}
1608 1608
 }
1609 1609
 
1610 1610
 
1611
-add_action( "admin_init", "geodir_allow_wpadmin" ); // check user is admin
1612
-if ( ! function_exists( 'geodir_allow_wpadmin' ) ) {
1611
+add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin
1612
+if (!function_exists('geodir_allow_wpadmin')) {
1613 1613
 	/**
1614 1614
 	 * Allow only admins to access wp-admin.
1615 1615
 	 *
@@ -1621,12 +1621,12 @@  discard block
 block discarded – undo
1621 1621
 	 */
1622 1622
 	function geodir_allow_wpadmin() {
1623 1623
 		global $wpdb;
1624
-		if ( get_option( 'geodir_allow_wpadmin' ) == '0' && is_user_logged_in() && ( ! defined( 'DOING_AJAX' ) ) ) // checking action in request to allow ajax request go through
1624
+		if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined('DOING_AJAX'))) // checking action in request to allow ajax request go through
1625 1625
 		{
1626
-			if ( current_user_can( 'administrator' ) ) {
1626
+			if (current_user_can('administrator')) {
1627 1627
 			} else {
1628 1628
 
1629
-				wp_redirect( home_url() );
1629
+				wp_redirect(home_url());
1630 1630
 				exit;
1631 1631
 			}
1632 1632
 
@@ -1645,23 +1645,23 @@  discard block
 block discarded – undo
1645 1645
  *
1646 1646
  * @return array|WP_Error The uploaded data as array. When failure returns error.
1647 1647
  */
1648
-function fetch_remote_file( $url ) {
1648
+function fetch_remote_file($url) {
1649 1649
 	// extract the file name and extension from the url
1650
-	require_once( ABSPATH . 'wp-includes/pluggable.php' );
1651
-	$file_name = basename( $url );
1652
-	if ( strpos( $file_name, '?' ) !== false ) {
1653
-		list( $file_name ) = explode( '?', $file_name );
1650
+	require_once(ABSPATH.'wp-includes/pluggable.php');
1651
+	$file_name = basename($url);
1652
+	if (strpos($file_name, '?') !== false) {
1653
+		list($file_name) = explode('?', $file_name);
1654 1654
 	}
1655 1655
 	$dummy        = false;
1656 1656
 	$add_to_cache = false;
1657 1657
 	$key          = null;
1658
-	if ( strpos( $url, '/dummy/' ) !== false ) {
1658
+	if (strpos($url, '/dummy/') !== false) {
1659 1659
 		$dummy = true;
1660
-		$key   = "dummy_" . str_replace( '.', '_', $file_name );
1661
-		$value = get_transient( 'cached_dummy_images' );
1662
-		if ( $value ) {
1663
-			if ( isset( $value[ $key ] ) ) {
1664
-				return $value[ $key ];
1660
+		$key   = "dummy_".str_replace('.', '_', $file_name);
1661
+		$value = get_transient('cached_dummy_images');
1662
+		if ($value) {
1663
+			if (isset($value[$key])) {
1664
+				return $value[$key];
1665 1665
 			} else {
1666 1666
 				$add_to_cache = true;
1667 1667
 			}
@@ -1672,58 +1672,58 @@  discard block
 block discarded – undo
1672 1672
 
1673 1673
 	// get placeholder file in the upload dir with a unique, sanitized filename
1674 1674
 
1675
-	$post_upload_date = isset( $post['upload_date'] ) ? $post['upload_date'] : '';
1675
+	$post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1676 1676
 
1677
-	$upload = wp_upload_bits( $file_name, 0, '', $post_upload_date );
1678
-	if ( $upload['error'] ) {
1679
-		return new WP_Error( 'upload_dir_error', $upload['error'] );
1677
+	$upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1678
+	if ($upload['error']) {
1679
+		return new WP_Error('upload_dir_error', $upload['error']);
1680 1680
 	}
1681 1681
 
1682 1682
 
1683
-	sleep( 0.3 );// if multiple remote file this can cause the remote server to timeout so we add a slight delay
1683
+	sleep(0.3); // if multiple remote file this can cause the remote server to timeout so we add a slight delay
1684 1684
 
1685 1685
 	// fetch the remote url and write it to the placeholder file
1686
-	$headers = wp_remote_get( $url, array( 'stream' => true, 'filename' => $upload['file'] ) );
1686
+	$headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
1687 1687
 
1688 1688
 	$log_message = '';
1689
-	if ( is_wp_error( $headers ) ) {
1690
-		echo 'file: ' . $url;
1689
+	if (is_wp_error($headers)) {
1690
+		echo 'file: '.$url;
1691 1691
 
1692
-		return new WP_Error( 'import_file_error', $headers->get_error_message() );
1692
+		return new WP_Error('import_file_error', $headers->get_error_message());
1693 1693
 	}
1694 1694
 
1695
-	$filesize = filesize( $upload['file'] );
1695
+	$filesize = filesize($upload['file']);
1696 1696
 	// request failed
1697
-	if ( ! $headers ) {
1698
-		$log_message = __( 'Remote server did not respond', 'geodirectory' );
1697
+	if (!$headers) {
1698
+		$log_message = __('Remote server did not respond', 'geodirectory');
1699 1699
 	} // make sure the fetch was successful
1700
-	elseif ( $headers['response']['code'] != '200' ) {
1701
-		$log_message = sprintf( __( 'Remote server returned error response %1$d %2$s', 'geodirectory' ), esc_html( $headers['response'] ), get_status_header_desc( $headers['response'] ) );
1702
-	} elseif ( isset( $headers['headers']['content-length'] ) && $filesize != $headers['headers']['content-length'] ) {
1703
-		$log_message = __( 'Remote file is incorrect size', 'geodirectory' );
1704
-	} elseif ( 0 == $filesize ) {
1705
-		$log_message = __( 'Zero size file downloaded', 'geodirectory' );
1706
-	}
1707
-
1708
-	if ( $log_message ) {
1709
-		$del = unlink( $upload['file'] );
1710
-		if ( ! $del ) {
1711
-			geodir_error_log( __( 'GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory' ) );
1700
+	elseif ($headers['response']['code'] != '200') {
1701
+		$log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1702
+	} elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1703
+		$log_message = __('Remote file is incorrect size', 'geodirectory');
1704
+	} elseif (0 == $filesize) {
1705
+		$log_message = __('Zero size file downloaded', 'geodirectory');
1706
+	}
1707
+
1708
+	if ($log_message) {
1709
+		$del = unlink($upload['file']);
1710
+		if (!$del) {
1711
+			geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));
1712 1712
 		}
1713 1713
 
1714
-		return new WP_Error( 'import_file_error', $log_message );
1714
+		return new WP_Error('import_file_error', $log_message);
1715 1715
 	}
1716 1716
 
1717
-	if ( $dummy && $add_to_cache && is_array( $upload ) ) {
1718
-		$images = get_transient( 'cached_dummy_images' );
1719
-		if ( is_array( $images ) ) {
1720
-			$images[ $key ] = $upload;
1717
+	if ($dummy && $add_to_cache && is_array($upload)) {
1718
+		$images = get_transient('cached_dummy_images');
1719
+		if (is_array($images)) {
1720
+			$images[$key] = $upload;
1721 1721
 		} else {
1722
-			$images = array( $key => $upload );
1722
+			$images = array($key => $upload);
1723 1723
 		}
1724 1724
 
1725 1725
 		//setting the cache using the WP Transient API
1726
-		set_transient( 'cached_dummy_images', $images, 60 * 10 ); //10 minutes cache
1726
+		set_transient('cached_dummy_images', $images, 60 * 10); //10 minutes cache
1727 1727
 	}
1728 1728
 
1729 1729
 	return $upload;
@@ -1737,12 +1737,12 @@  discard block
 block discarded – undo
1737 1737
  * @return string|void Max upload size.
1738 1738
  */
1739 1739
 function geodir_max_upload_size() {
1740
-	$max_filesize = (float) get_option( 'geodir_upload_max_filesize', 2 );
1740
+	$max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1741 1741
 
1742
-	if ( $max_filesize > 0 && $max_filesize < 1 ) {
1743
-		$max_filesize = (int) ( $max_filesize * 1024 ) . 'kb';
1742
+	if ($max_filesize > 0 && $max_filesize < 1) {
1743
+		$max_filesize = (int) ($max_filesize * 1024).'kb';
1744 1744
 	} else {
1745
-		$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1745
+		$max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1746 1746
 	}
1747 1747
 
1748 1748
 	/**
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
 	 *
1753 1753
 	 * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1754 1754
 	 */
1755
-	return apply_filters( 'geodir_default_image_upload_size_limit', $max_filesize );
1755
+	return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1756 1756
 }
1757 1757
 
1758 1758
 /**
@@ -1765,8 +1765,8 @@  discard block
 block discarded – undo
1765 1765
  * @return bool If dummy folder exists returns true, else false.
1766 1766
  */
1767 1767
 function geodir_dummy_folder_exists() {
1768
-	$path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1769
-	if ( ! is_dir( $path ) ) {
1768
+	$path = geodir_plugin_path().'/geodirectory-admin/dummy/';
1769
+	if (!is_dir($path)) {
1770 1770
 		return false;
1771 1771
 	} else {
1772 1772
 		return true;
@@ -1785,17 +1785,17 @@  discard block
 block discarded – undo
1785 1785
  *
1786 1786
  * @return object Author info.
1787 1787
  */
1788
-function geodir_get_author_info( $aid ) {
1788
+function geodir_get_author_info($aid) {
1789 1789
 	global $wpdb;
1790 1790
 	/*$infosql = "select * from $wpdb->users where ID=$aid";*/
1791
-	$infosql = $wpdb->prepare( "select * from $wpdb->users where ID=%d", array( $aid ) );
1792
-	$info    = $wpdb->get_results( $infosql );
1793
-	if ( $info ) {
1791
+	$infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1792
+	$info    = $wpdb->get_results($infosql);
1793
+	if ($info) {
1794 1794
 		return $info[0];
1795 1795
 	}
1796 1796
 }
1797 1797
 
1798
-if ( ! function_exists( 'adminEmail' ) ) {
1798
+if (!function_exists('adminEmail')) {
1799 1799
 	/**
1800 1800
 	 * Send emails to client on post submission, renew etc.
1801 1801
 	 *
@@ -1808,67 +1808,67 @@  discard block
 block discarded – undo
1808 1808
 	 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1809 1809
 	 * @param string $custom_1     Custom data to be sent.
1810 1810
 	 */
1811
-	function adminEmail( $page_id, $user_id, $message_type, $custom_1 = '' ) {
1811
+	function adminEmail($page_id, $user_id, $message_type, $custom_1 = '') {
1812 1812
 		global $wpdb;
1813
-		if ( $message_type == 'expiration' ) {
1814
-			$subject        = stripslashes( __( get_option( 'renew_email_subject' ), 'geodirectory' ) );
1815
-			$client_message = stripslashes( __( get_option( 'renew_email_content' ), 'geodirectory' ) );
1816
-		} elseif ( $message_type == 'post_submited' ) {
1817
-			$subject        = __( get_option( 'post_submited_success_email_subject_admin' ), 'geodirectory' );
1818
-			$client_message = __( get_option( 'post_submited_success_email_content_admin' ), 'geodirectory' );
1819
-		} elseif ( $message_type == 'renew' ) {
1820
-			$subject        = __( get_option( 'post_renew_success_email_subject_admin' ), 'geodirectory' );
1821
-			$client_message = __( get_option( 'post_renew_success_email_content_admin' ), 'geodirectory' );
1822
-		} elseif ( $message_type == 'upgrade' ) {
1823
-			$subject        = __( get_option( 'post_upgrade_success_email_subject_admin' ), 'geodirectory' );
1824
-			$client_message = __( get_option( 'post_upgrade_success_email_content_admin' ), 'geodirectory' );
1825
-		} elseif ( $message_type == 'claim_approved' ) {
1826
-			$subject        = __( get_option( 'claim_approved_email_subject' ), 'geodirectory' );
1827
-			$client_message = __( get_option( 'claim_approved_email_content' ), 'geodirectory' );
1828
-		} elseif ( $message_type == 'claim_rejected' ) {
1829
-			$subject        = __( get_option( 'claim_rejected_email_subject' ), 'geodirectory' );
1830
-			$client_message = __( get_option( 'claim_rejected_email_content' ), 'geodirectory' );
1831
-		} elseif ( $message_type == 'claim_requested' ) {
1832
-			$subject        = __( get_option( 'claim_email_subject_admin' ), 'geodirectory' );
1833
-			$client_message = __( get_option( 'claim_email_content_admin' ), 'geodirectory' );
1834
-		} elseif ( $message_type == 'auto_claim' ) {
1835
-			$subject        = __( get_option( 'auto_claim_email_subject' ), 'geodirectory' );
1836
-			$client_message = __( get_option( 'auto_claim_email_content' ), 'geodirectory' );
1837
-		} elseif ( $message_type == 'payment_success' ) {
1838
-			$subject        = __( get_option( 'post_payment_success_admin_email_subject' ), 'geodirectory' );
1839
-			$client_message = __( get_option( 'post_payment_success_admin_email_content' ), 'geodirectory' );
1840
-		} elseif ( $message_type == 'payment_fail' ) {
1841
-			$subject        = __( get_option( 'post_payment_fail_admin_email_subject' ), 'geodirectory' );
1842
-			$client_message = __( get_option( 'post_payment_fail_admin_email_content' ), 'geodirectory' );
1813
+		if ($message_type == 'expiration') {
1814
+			$subject        = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
1815
+			$client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
1816
+		} elseif ($message_type == 'post_submited') {
1817
+			$subject        = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
1818
+			$client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
1819
+		} elseif ($message_type == 'renew') {
1820
+			$subject        = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
1821
+			$client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
1822
+		} elseif ($message_type == 'upgrade') {
1823
+			$subject        = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
1824
+			$client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
1825
+		} elseif ($message_type == 'claim_approved') {
1826
+			$subject        = __(get_option('claim_approved_email_subject'), 'geodirectory');
1827
+			$client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
1828
+		} elseif ($message_type == 'claim_rejected') {
1829
+			$subject        = __(get_option('claim_rejected_email_subject'), 'geodirectory');
1830
+			$client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
1831
+		} elseif ($message_type == 'claim_requested') {
1832
+			$subject        = __(get_option('claim_email_subject_admin'), 'geodirectory');
1833
+			$client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
1834
+		} elseif ($message_type == 'auto_claim') {
1835
+			$subject        = __(get_option('auto_claim_email_subject'), 'geodirectory');
1836
+			$client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
1837
+		} elseif ($message_type == 'payment_success') {
1838
+			$subject        = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
1839
+			$client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
1840
+		} elseif ($message_type == 'payment_fail') {
1841
+			$subject        = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
1842
+			$client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
1843 1843
 		}
1844 1844
 		$transaction_details = $custom_1;
1845
-		$fromEmail           = get_option( 'site_email' );
1845
+		$fromEmail           = get_option('site_email');
1846 1846
 		$fromEmailName       = get_site_emailName();
1847 1847
 //$alivedays = get_post_meta($page_id,'alive_days',true);
1848
-		$pkg_limit            = get_property_price_info_listing( $page_id );
1848
+		$pkg_limit            = get_property_price_info_listing($page_id);
1849 1849
 		$alivedays            = $pkg_limit['days'];
1850
-		$productlink          = get_permalink( $page_id );
1851
-		$post_info            = get_post( $page_id );
1852
-		$post_date            = date( 'dS F,Y', strtotime( $post_info->post_date ) );
1853
-		$listingLink          = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1850
+		$productlink          = get_permalink($page_id);
1851
+		$post_info            = get_post($page_id);
1852
+		$post_date            = date('dS F,Y', strtotime($post_info->post_date));
1853
+		$listingLink          = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
1854 1854
 		$loginurl             = geodir_login_url();
1855
-		$loginurl_link        = '<a href="' . $loginurl . '">login</a>';
1855
+		$loginurl_link        = '<a href="'.$loginurl.'">login</a>';
1856 1856
 		$siteurl              = home_url();
1857
-		$siteurl_link         = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1858
-		$user_info            = get_userdata( $user_id );
1857
+		$siteurl_link         = '<a href="'.$siteurl.'">'.$fromEmailName.'</a>';
1858
+		$user_info            = get_userdata($user_id);
1859 1859
 		$user_email           = $user_info->user_email;
1860
-		$display_name         = geodir_get_client_name( $user_id );
1860
+		$display_name         = geodir_get_client_name($user_id);
1861 1861
 		$user_login           = $user_info->user_login;
1862
-		$number_of_grace_days = get_option( 'ptthemes_listing_preexpiry_notice_days' );
1863
-		if ( $number_of_grace_days == '' ) {
1862
+		$number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1863
+		if ($number_of_grace_days == '') {
1864 1864
 			$number_of_grace_days = 1;
1865 1865
 		}
1866
-		if ( $post_info->post_type == 'event' ) {
1866
+		if ($post_info->post_type == 'event') {
1867 1867
 			$post_type = 'event';
1868 1868
 		} else {
1869 1869
 			$post_type = 'listing';
1870 1870
 		}
1871
-		$renew_link     = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1871
+		$renew_link     = '<a href="'.$siteurl.'?ptype=post_'.$post_type.'&renew=1&pid='.$page_id.'">'.RENEW_LINK.'</a>';
1872 1872
 		$search_array   = array(
1873 1873
 			'[#client_name#]',
1874 1874
 			'[#listing_link#]',
@@ -1884,7 +1884,7 @@  discard block
 block discarded – undo
1884 1884
 			'[#site_name#]',
1885 1885
 			'[#transaction_details#]'
1886 1886
 		);
1887
-		$replace_array  = array(
1887
+		$replace_array = array(
1888 1888
 			$display_name,
1889 1889
 			$listingLink,
1890 1890
 			$post_date,
@@ -1899,13 +1899,13 @@  discard block
 block discarded – undo
1899 1899
 			$fromEmailName,
1900 1900
 			$transaction_details
1901 1901
 		);
1902
-		$client_message = str_replace( $search_array, $replace_array, $client_message );
1903
-		$subject        = str_replace( $search_array, $replace_array, $subject );
1902
+		$client_message = str_replace($search_array, $replace_array, $client_message);
1903
+		$subject        = str_replace($search_array, $replace_array, $subject);
1904 1904
 		
1905 1905
 		
1906
-		$headers  = array();
1906
+		$headers = array();
1907 1907
 		$headers[] = 'Content-type: text/html; charset=UTF-8';
1908
-		$headers[] = 'From: ' . $fromEmailName . ' <' . $fromEmail . '>';
1908
+		$headers[] = 'From: '.$fromEmailName.' <'.$fromEmail.'>';
1909 1909
 
1910 1910
 		$to      = $fromEmail;
1911 1911
 		$message = $client_message;
@@ -1923,7 +1923,7 @@  discard block
 block discarded – undo
1923 1923
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1924 1924
 		 * @param string $custom_1     Custom data to be sent.
1925 1925
 		 */
1926
-		$to = apply_filters( 'geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1 );
1926
+		$to = apply_filters('geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1);
1927 1927
 		/**
1928 1928
 		 * Filter the admin email subject.
1929 1929
 		 *
@@ -1936,7 +1936,7 @@  discard block
 block discarded – undo
1936 1936
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1937 1937
 		 * @param string $custom_1     Custom data to be sent.
1938 1938
 		 */
1939
-		$subject = apply_filters( 'geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1 );
1939
+		$subject = apply_filters('geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1);
1940 1940
 		/**
1941 1941
 		 * Filter the admin email message.
1942 1942
 		 *
@@ -1949,7 +1949,7 @@  discard block
 block discarded – undo
1949 1949
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1950 1950
 		 * @param string $custom_1     Custom data to be sent.
1951 1951
 		 */
1952
-		$message = apply_filters( 'geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1 );
1952
+		$message = apply_filters('geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1);
1953 1953
 		/**
1954 1954
 		 * Filter the admin email headers.
1955 1955
 		 *
@@ -1962,22 +1962,22 @@  discard block
 block discarded – undo
1962 1962
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1963 1963
 		 * @param string $custom_1     Custom data to be sent.
1964 1964
 		 */
1965
-		$headers = apply_filters( 'geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1 );
1965
+		$headers = apply_filters('geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1);
1966 1966
 
1967 1967
 
1968
-		$sent = wp_mail( $to, $subject, $message, $headers );
1969
-		if ( ! $sent ) {
1970
-			if ( is_array( $to ) ) {
1971
-				$to = implode( ',', $to );
1968
+		$sent = wp_mail($to, $subject, $message, $headers);
1969
+		if (!$sent) {
1970
+			if (is_array($to)) {
1971
+				$to = implode(',', $to);
1972 1972
 			}
1973 1973
 			$log_message = sprintf(
1974
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1974
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1975 1975
 				$message_type,
1976
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1976
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
1977 1977
 				$to,
1978 1978
 				$subject
1979 1979
 			);
1980
-			geodir_error_log( $log_message );
1980
+			geodir_error_log($log_message);
1981 1981
 		}
1982 1982
 	}
1983 1983
 }
@@ -1997,12 +1997,12 @@  discard block
 block discarded – undo
1997 1997
  *
1998 1998
  * @return array Category IDs.
1999 1999
  */
2000
-function gd_lang_object_ids( $ids_array, $type ) {
2001
-	if ( function_exists( 'icl_object_id' ) ) {
2000
+function gd_lang_object_ids($ids_array, $type) {
2001
+	if (function_exists('icl_object_id')) {
2002 2002
 		$res = array();
2003
-		foreach ( $ids_array as $id ) {
2004
-			$xlat = icl_object_id( $id, $type, false );
2005
-			if ( ! is_null( $xlat ) ) {
2003
+		foreach ($ids_array as $id) {
2004
+			$xlat = icl_object_id($id, $type, false);
2005
+			if (!is_null($xlat)) {
2006 2006
 				$res[] = $xlat;
2007 2007
 			}
2008 2008
 		}
@@ -2026,20 +2026,20 @@  discard block
 block discarded – undo
2026 2026
  *
2027 2027
  * @return array Modified Body CSS classes.
2028 2028
  */
2029
-function geodir_custom_posts_body_class( $classes ) {
2029
+function geodir_custom_posts_body_class($classes) {
2030 2030
 	global $wpdb, $wp;
2031
-	$post_types = geodir_get_posttypes( 'object' );
2032
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2031
+	$post_types = geodir_get_posttypes('object');
2032
+	if (!empty($post_types) && count((array) $post_types) > 1) {
2033 2033
 		$classes[] = 'geodir_custom_posts';
2034 2034
 	}
2035 2035
 
2036 2036
 	// fix body class for signup page
2037
-	if ( geodir_is_page( 'login' ) ) {
2037
+	if (geodir_is_page('login')) {
2038 2038
 		$new_classes   = array();
2039 2039
 		$new_classes[] = 'signup page-geodir-signup';
2040
-		if ( ! empty( $classes ) ) {
2041
-			foreach ( $classes as $class ) {
2042
-				if ( $class && $class != 'home' && $class != 'blog' ) {
2040
+		if (!empty($classes)) {
2041
+			foreach ($classes as $class) {
2042
+				if ($class && $class != 'home' && $class != 'blog') {
2043 2043
 					$new_classes[] = $class;
2044 2044
 				}
2045 2045
 			}
@@ -2047,14 +2047,14 @@  discard block
 block discarded – undo
2047 2047
 		$classes = $new_classes;
2048 2048
 	}
2049 2049
 
2050
-	if ( geodir_is_geodir_page() ) {
2050
+	if (geodir_is_geodir_page()) {
2051 2051
 		$classes[] = 'geodir-page';
2052 2052
 	}
2053 2053
 
2054 2054
 	return $classes;
2055 2055
 }
2056 2056
 
2057
-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
2057
+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
2058 2058
 
2059 2059
 
2060 2060
 /**
@@ -2070,7 +2070,7 @@  discard block
 block discarded – undo
2070 2070
 	 *
2071 2071
 	 * @since 1.0.0
2072 2072
 	 */
2073
-	return apply_filters( 'geodir_map_zoom_level', array(
2073
+	return apply_filters('geodir_map_zoom_level', array(
2074 2074
 		1,
2075 2075
 		2,
2076 2076
 		3,
@@ -2090,7 +2090,7 @@  discard block
 block discarded – undo
2090 2090
 		17,
2091 2091
 		18,
2092 2092
 		19
2093
-	) );
2093
+	));
2094 2094
 
2095 2095
 }
2096 2096
 
@@ -2103,12 +2103,12 @@  discard block
 block discarded – undo
2103 2103
  *
2104 2104
  * @param string $geodir_option_name Option key.
2105 2105
  */
2106
-function geodir_option_version_backup( $geodir_option_name ) {
2106
+function geodir_option_version_backup($geodir_option_name) {
2107 2107
 	$version_date  = time();
2108
-	$geodir_option = get_option( $geodir_option_name );
2108
+	$geodir_option = get_option($geodir_option_name);
2109 2109
 
2110
-	if ( ! empty( $geodir_option ) ) {
2111
-		add_option( $geodir_option_name . '_' . $version_date, $geodir_option );
2110
+	if (!empty($geodir_option)) {
2111
+		add_option($geodir_option_name.'_'.$version_date, $geodir_option);
2112 2112
 	}
2113 2113
 }
2114 2114
 
@@ -2122,10 +2122,10 @@  discard block
 block discarded – undo
2122 2122
  *
2123 2123
  * @return int Page ID.
2124 2124
  */
2125
-function get_page_id_geodir_add_listing_page( $page_id ) {
2126
-	if ( geodir_wpml_multilingual_status() ) {
2125
+function get_page_id_geodir_add_listing_page($page_id) {
2126
+	if (geodir_wpml_multilingual_status()) {
2127 2127
 		$post_type = 'post_page';
2128
-		$page_id   = geodir_get_wpml_element_id( $page_id, $post_type );
2128
+		$page_id   = geodir_get_wpml_element_id($page_id, $post_type);
2129 2129
 	}
2130 2130
 
2131 2131
 	return $page_id;
@@ -2139,7 +2139,7 @@  discard block
 block discarded – undo
2139 2139
  * @return bool Returns true when sitepress multilingual CMS active. else returns false.
2140 2140
  */
2141 2141
 function geodir_wpml_multilingual_status() {
2142
-	if ( function_exists( 'icl_object_id' ) ) {
2142
+	if (function_exists('icl_object_id')) {
2143 2143
 		return true;
2144 2144
 	}
2145 2145
 
@@ -2157,19 +2157,19 @@  discard block
 block discarded – undo
2157 2157
  *
2158 2158
  * @return int Element ID when exists. Else the page id.
2159 2159
  */
2160
-function geodir_get_wpml_element_id( $page_id, $post_type ) {
2160
+function geodir_get_wpml_element_id($page_id, $post_type) {
2161 2161
 	global $sitepress;
2162
-	if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
2163
-		$trid = $sitepress->get_element_trid( $page_id, $post_type );
2162
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
2163
+		$trid = $sitepress->get_element_trid($page_id, $post_type);
2164 2164
 
2165
-		if ( $trid > 0 ) {
2166
-			$translations = $sitepress->get_element_translations( $trid, $post_type );
2165
+		if ($trid > 0) {
2166
+			$translations = $sitepress->get_element_translations($trid, $post_type);
2167 2167
 
2168 2168
 			$lang = $sitepress->get_current_language();
2169 2169
 			$lang = $lang ? $lang : $sitepress->get_default_language();
2170 2170
 
2171
-			if ( ! empty( $translations ) && ! empty( $lang ) && isset( $translations[ $lang ] ) && isset( $translations[ $lang ]->element_id ) && ! empty( $translations[ $lang ]->element_id ) ) {
2172
-				$page_id = $translations[ $lang ]->element_id;
2171
+			if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
2172
+				$page_id = $translations[$lang]->element_id;
2173 2173
 			}
2174 2174
 		}
2175 2175
 	}
@@ -2186,15 +2186,15 @@  discard block
 block discarded – undo
2186 2186
  */
2187 2187
 function geodir_wpml_check_element_id() {
2188 2188
 	global $sitepress;
2189
-	if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
2189
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
2190 2190
 		$el_type      = 'post_page';
2191
-		$el_id        = get_option( 'geodir_add_listing_page' );
2191
+		$el_id        = get_option('geodir_add_listing_page');
2192 2192
 		$default_lang = $sitepress->get_default_language();
2193
-		$el_details   = $sitepress->get_element_language_details( $el_id, $el_type );
2193
+		$el_details   = $sitepress->get_element_language_details($el_id, $el_type);
2194 2194
 
2195
-		if ( ! ( $el_id > 0 && $default_lang && ! empty( $el_details ) && isset( $el_details->language_code ) && $el_details->language_code == $default_lang ) ) {
2196
-			if ( ! $el_details->source_language_code ) {
2197
-				$sitepress->set_element_language_details( $el_id, $el_type, '', $default_lang );
2195
+		if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
2196
+			if (!$el_details->source_language_code) {
2197
+				$sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
2198 2198
 				$sitepress->icl_translations_cache->clear();
2199 2199
 			}
2200 2200
 		}
@@ -2213,41 +2213,41 @@  discard block
 block discarded – undo
2213 2213
  *
2214 2214
  * @return string Orderby SQL.
2215 2215
  */
2216
-function geodir_widget_listings_get_order( $query_args ) {
2216
+function geodir_widget_listings_get_order($query_args) {
2217 2217
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2218 2218
 
2219 2219
 	$query_args = $gd_query_args_widgets;
2220
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2221
-		return $wpdb->posts . ".post_date DESC, ";
2220
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2221
+		return $wpdb->posts.".post_date DESC, ";
2222 2222
 	}
2223 2223
 
2224
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2225
-	$table     = $plugin_prefix . $post_type . '_detail';
2224
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2225
+	$table     = $plugin_prefix.$post_type.'_detail';
2226 2226
 
2227
-	$sort_by = ! empty( $query_args['order_by'] ) ? $query_args['order_by'] : '';
2227
+	$sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
2228 2228
 
2229
-	switch ( $sort_by ) {
2229
+	switch ($sort_by) {
2230 2230
 		case 'latest':
2231 2231
 		case 'newest':
2232
-			$orderby = $wpdb->posts . ".post_date DESC, ";
2232
+			$orderby = $wpdb->posts.".post_date DESC, ";
2233 2233
 			break;
2234 2234
 		case 'featured':
2235
-			$orderby = $table . ".is_featured ASC, ". $wpdb->posts . ".post_date DESC, ";
2235
+			$orderby = $table.".is_featured ASC, ".$wpdb->posts.".post_date DESC, ";
2236 2236
 			break;
2237 2237
 		case 'az':
2238
-			$orderby = $wpdb->posts . ".post_title ASC, ";
2238
+			$orderby = $wpdb->posts.".post_title ASC, ";
2239 2239
 			break;
2240 2240
 		case 'high_review':
2241
-			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
2241
+			$orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, ";
2242 2242
 			break;
2243 2243
 		case 'high_rating':
2244
-			$orderby = "( " . $table . ".overall_rating  ) DESC, ";
2244
+			$orderby = "( ".$table.".overall_rating  ) DESC, ";
2245 2245
 			break;
2246 2246
 		case 'random':
2247 2247
 			$orderby = "RAND(), ";
2248 2248
 			break;
2249 2249
 		default:
2250
-			$orderby = $wpdb->posts . ".post_title ASC, ";
2250
+			$orderby = $wpdb->posts.".post_title ASC, ";
2251 2251
 			break;
2252 2252
 	}
2253 2253
 
@@ -2270,15 +2270,15 @@  discard block
 block discarded – undo
2270 2270
  *
2271 2271
  * @return mixed Result object.
2272 2272
  */
2273
-function geodir_get_widget_listings( $query_args = array(), $count_only = false ) {
2273
+function geodir_get_widget_listings($query_args = array(), $count_only = false) {
2274 2274
 	global $wpdb, $plugin_prefix, $table_prefix;
2275 2275
 	$GLOBALS['gd_query_args_widgets'] = $query_args;
2276 2276
 	$gd_query_args_widgets            = $query_args;
2277 2277
 
2278
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2279
-	$table     = $plugin_prefix . $post_type . '_detail';
2278
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2279
+	$table     = $plugin_prefix.$post_type.'_detail';
2280 2280
 
2281
-	$fields = $wpdb->posts . ".*, " . $table . ".*";
2281
+	$fields = $wpdb->posts.".*, ".$table.".*";
2282 2282
 	/**
2283 2283
 	 * Filter widget listing fields string part that is being used for query.
2284 2284
 	 *
@@ -2288,17 +2288,17 @@  discard block
 block discarded – undo
2288 2288
 	 * @param string $table     Table name.
2289 2289
 	 * @param string $post_type Post type.
2290 2290
 	 */
2291
-	$fields = apply_filters( 'geodir_filter_widget_listings_fields', $fields, $table, $post_type );
2291
+	$fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
2292 2292
 
2293
-	$join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
2293
+	$join = "INNER JOIN ".$table." ON (".$table.".post_id = ".$wpdb->posts.".ID)";
2294 2294
 
2295 2295
 	########### WPML ###########
2296 2296
 
2297
-	if ( function_exists( 'icl_object_id' ) ) {
2297
+	if (function_exists('icl_object_id')) {
2298 2298
 		global $sitepress;
2299 2299
 		$lang_code = ICL_LANGUAGE_CODE;
2300
-		if ( $lang_code ) {
2301
-			$join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
2300
+		if ($lang_code) {
2301
+			$join .= " JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID";
2302 2302
 		}
2303 2303
 	}
2304 2304
 
@@ -2312,15 +2312,15 @@  discard block
 block discarded – undo
2312 2312
 	 * @param string $join      Join clause string.
2313 2313
 	 * @param string $post_type Post type.
2314 2314
 	 */
2315
-	$join = apply_filters( 'geodir_filter_widget_listings_join', $join, $post_type );
2315
+	$join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
2316 2316
 
2317
-	$post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
2317
+	$post_status = is_super_admin() ? " OR ".$wpdb->posts.".post_status = 'private'" : '';
2318 2318
 
2319
-	$where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
2319
+	$where = " AND ( ".$wpdb->posts.".post_status = 'publish' ".$post_status." ) AND ".$wpdb->posts.".post_type = '".$post_type."'";
2320 2320
 
2321 2321
 	########### WPML ###########
2322
-	if ( function_exists( 'icl_object_id' ) ) {
2323
-		if ( $lang_code ) {
2322
+	if (function_exists('icl_object_id')) {
2323
+		if ($lang_code) {
2324 2324
 			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
2325 2325
 		}
2326 2326
 	}
@@ -2333,8 +2333,8 @@  discard block
 block discarded – undo
2333 2333
 	 * @param string $where     Where clause string.
2334 2334
 	 * @param string $post_type Post type.
2335 2335
 	 */
2336
-	$where = apply_filters( 'geodir_filter_widget_listings_where', $where, $post_type );
2337
-	$where = $where != '' ? " WHERE 1=1 " . $where : '';
2336
+	$where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2337
+	$where = $where != '' ? " WHERE 1=1 ".$where : '';
2338 2338
 
2339 2339
 	$groupby = " GROUP BY $wpdb->posts.ID "; //@todo is this needed? faster withotu
2340 2340
 	/**
@@ -2345,15 +2345,15 @@  discard block
 block discarded – undo
2345 2345
 	 * @param string $groupby   Group by clause string.
2346 2346
 	 * @param string $post_type Post type.
2347 2347
 	 */
2348
-	$groupby = apply_filters( 'geodir_filter_widget_listings_groupby', $groupby, $post_type );
2348
+	$groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
2349 2349
 
2350
-	if ( $count_only ) {
2351
-		$sql  = "SELECT COUNT(DISTINCT " . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
2352
-			" . $join . "
2350
+	if ($count_only) {
2351
+		$sql  = "SELECT COUNT(DISTINCT ".$wpdb->posts.".ID) AS total FROM ".$wpdb->posts."
2352
+			" . $join."
2353 2353
 			" . $where;
2354
-		$rows = (int) $wpdb->get_var( $sql );
2354
+		$rows = (int) $wpdb->get_var($sql);
2355 2355
 	} else {
2356
-		$orderby = geodir_widget_listings_get_order( $query_args );
2356
+		$orderby = geodir_widget_listings_get_order($query_args);
2357 2357
 		/**
2358 2358
 		 * Filter widget listing orderby clause string part that is being used for query.
2359 2359
 		 *
@@ -2363,11 +2363,11 @@  discard block
 block discarded – undo
2363 2363
 		 * @param string $table     Table name.
2364 2364
 		 * @param string $post_type Post type.
2365 2365
 		 */
2366
-		$orderby = apply_filters( 'geodir_filter_widget_listings_orderby', $orderby, $table, $post_type );
2367
-		$orderby .= $wpdb->posts . ".post_title ASC";
2368
-		$orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2366
+		$orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2367
+		$orderby .= $wpdb->posts.".post_title ASC";
2368
+		$orderby = $orderby != '' ? " ORDER BY ".$orderby : '';
2369 2369
 
2370
-		$limit = ! empty( $query_args['posts_per_page'] ) ? $query_args['posts_per_page'] : 5;
2370
+		$limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2371 2371
 		/**
2372 2372
 		 * Filter widget listing limit that is being used for query.
2373 2373
 		 *
@@ -2376,27 +2376,27 @@  discard block
 block discarded – undo
2376 2376
 		 * @param int $limit        Query results limit.
2377 2377
 		 * @param string $post_type Post type.
2378 2378
 		 */
2379
-		$limit = apply_filters( 'geodir_filter_widget_listings_limit', $limit, $post_type );
2379
+		$limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2380 2380
 
2381
-		$page = ! empty( $query_args['pageno'] ) ? absint( $query_args['pageno'] ) : 1;
2382
-		if ( ! $page ) {
2381
+		$page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2382
+		if (!$page) {
2383 2383
 			$page = 1;
2384 2384
 		}
2385 2385
 
2386
-		$limit = (int) $limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int) $limit ) . ", " . (int) $limit : "";
2386
+		$limit = (int) $limit > 0 ? " LIMIT ".absint(($page - 1) * (int) $limit).", ".(int) $limit : "";
2387 2387
 
2388 2388
 		//@todo removed SQL_CALC_FOUND_ROWS from below as don't think it is needed and query is faster without
2389
-		$sql  = "SELECT " . $fields . " FROM " . $wpdb->posts . "
2390
-			" . $join . "
2391
-			" . $where . "
2392
-			" . $groupby . "
2393
-			" . $orderby . "
2389
+		$sql = "SELECT ".$fields." FROM ".$wpdb->posts."
2390
+			" . $join."
2391
+			" . $where."
2392
+			" . $groupby."
2393
+			" . $orderby."
2394 2394
 			" . $limit;
2395
-		$rows = $wpdb->get_results( $sql );
2395
+		$rows = $wpdb->get_results($sql);
2396 2396
 	}
2397 2397
 
2398
-	unset( $GLOBALS['gd_query_args_widgets'] );
2399
-	unset( $gd_query_args_widgets );
2398
+	unset($GLOBALS['gd_query_args_widgets']);
2399
+	unset($gd_query_args_widgets);
2400 2400
 
2401 2401
 	return $rows;
2402 2402
 }
@@ -2413,11 +2413,11 @@  discard block
 block discarded – undo
2413 2413
  *
2414 2414
  * @return string Modified fields SQL.
2415 2415
  */
2416
-function geodir_function_widget_listings_fields( $fields ) {
2416
+function geodir_function_widget_listings_fields($fields) {
2417 2417
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2418 2418
 
2419 2419
 	$query_args = $gd_query_args_widgets;
2420
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2420
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2421 2421
 		return $fields;
2422 2422
 	}
2423 2423
 
@@ -2436,24 +2436,24 @@  discard block
 block discarded – undo
2436 2436
  *
2437 2437
  * @return string Modified join clause SQL.
2438 2438
  */
2439
-function geodir_function_widget_listings_join( $join ) {
2439
+function geodir_function_widget_listings_join($join) {
2440 2440
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2441 2441
 
2442 2442
 	$query_args = $gd_query_args_widgets;
2443
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2443
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2444 2444
 		return $join;
2445 2445
 	}
2446 2446
 
2447
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2448
-	$table     = $plugin_prefix . $post_type . '_detail';
2447
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2448
+	$table     = $plugin_prefix.$post_type.'_detail';
2449 2449
 
2450
-	if ( ! empty( $query_args['with_pics_only'] ) ) {
2451
-		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2450
+	if (!empty($query_args['with_pics_only'])) {
2451
+		$join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
2452 2452
 	}
2453 2453
 
2454
-	if ( ! empty( $query_args['tax_query'] ) ) {
2455
-		$tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' );
2456
-		if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
2454
+	if (!empty($query_args['tax_query'])) {
2455
+		$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2456
+		if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2457 2457
 			$join .= $tax_queries['join'];
2458 2458
 		}
2459 2459
 	}
@@ -2473,49 +2473,49 @@  discard block
 block discarded – undo
2473 2473
  *
2474 2474
  * @return string Modified where clause SQL.
2475 2475
  */
2476
-function geodir_function_widget_listings_where( $where ) {
2476
+function geodir_function_widget_listings_where($where) {
2477 2477
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2478 2478
 
2479 2479
 	$query_args = $gd_query_args_widgets;
2480
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2480
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2481 2481
 		return $where;
2482 2482
 	}
2483
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2484
-	$table     = $plugin_prefix . $post_type . '_detail';
2483
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2484
+	$table     = $plugin_prefix.$post_type.'_detail';
2485 2485
 
2486
-	if ( ! empty( $query_args ) ) {
2487
-		if ( ! empty( $query_args['gd_location'] ) && function_exists( 'geodir_default_location_where' ) ) {
2488
-			$where = geodir_default_location_where( $where, $table );
2486
+	if (!empty($query_args)) {
2487
+		if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2488
+			$where = geodir_default_location_where($where, $table);
2489 2489
 		}
2490 2490
 
2491
-		if ( ! empty( $query_args['post_author'] ) ) {
2492
-			$where .= " AND " . $wpdb->posts . ".post_author = " . (int) $query_args['post_author'];
2491
+		if (!empty($query_args['post_author'])) {
2492
+			$where .= " AND ".$wpdb->posts.".post_author = ".(int) $query_args['post_author'];
2493 2493
 		}
2494 2494
 
2495
-		if ( ! empty( $query_args['show_featured_only'] ) ) {
2496
-			$where .= " AND " . $table . ".is_featured = '1'";
2495
+		if (!empty($query_args['show_featured_only'])) {
2496
+			$where .= " AND ".$table.".is_featured = '1'";
2497 2497
 		}
2498 2498
 
2499
-		if ( ! empty( $query_args['show_special_only'] ) ) {
2500
-			$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2499
+		if (!empty($query_args['show_special_only'])) {
2500
+			$where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
2501 2501
 		}
2502 2502
 
2503
-		if ( ! empty( $query_args['with_pics_only'] ) ) {
2504
-			$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2503
+		if (!empty($query_args['with_pics_only'])) {
2504
+			$where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL ";
2505 2505
 		}
2506 2506
 
2507
-		if ( ! empty( $query_args['featured_image_only'] ) ) {
2508
-			$where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2507
+		if (!empty($query_args['featured_image_only'])) {
2508
+			$where .= " AND ".$table.".featured_image IS NOT NULL AND ".$table.".featured_image!='' ";
2509 2509
 		}
2510 2510
 
2511
-		if ( ! empty( $query_args['with_videos_only'] ) ) {
2512
-			$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2511
+		if (!empty($query_args['with_videos_only'])) {
2512
+			$where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
2513 2513
 		}
2514 2514
 
2515
-		if ( ! empty( $query_args['tax_query'] ) ) {
2516
-			$tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' );
2515
+		if (!empty($query_args['tax_query'])) {
2516
+			$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2517 2517
 
2518
-			if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
2518
+			if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2519 2519
 				$where .= $tax_queries['where'];
2520 2520
 			}
2521 2521
 		}
@@ -2536,11 +2536,11 @@  discard block
 block discarded – undo
2536 2536
  *
2537 2537
  * @return string Modified orderby clause SQL.
2538 2538
  */
2539
-function geodir_function_widget_listings_orderby( $orderby ) {
2539
+function geodir_function_widget_listings_orderby($orderby) {
2540 2540
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2541 2541
 
2542 2542
 	$query_args = $gd_query_args_widgets;
2543
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2543
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2544 2544
 		return $orderby;
2545 2545
 	}
2546 2546
 
@@ -2559,15 +2559,15 @@  discard block
 block discarded – undo
2559 2559
  *
2560 2560
  * @return int Query limit.
2561 2561
  */
2562
-function geodir_function_widget_listings_limit( $limit ) {
2562
+function geodir_function_widget_listings_limit($limit) {
2563 2563
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2564 2564
 
2565 2565
 	$query_args = $gd_query_args_widgets;
2566
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2566
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2567 2567
 		return $limit;
2568 2568
 	}
2569 2569
 
2570
-	if ( ! empty( $query_args ) && ! empty( $query_args['posts_per_page'] ) ) {
2570
+	if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2571 2571
 		$limit = (int) $query_args['posts_per_page'];
2572 2572
 	}
2573 2573
 
@@ -2585,12 +2585,12 @@  discard block
 block discarded – undo
2585 2585
  *
2586 2586
  * @return int Large size width.
2587 2587
  */
2588
-function geodir_media_image_large_width( $default = 800, $params = '' ) {
2589
-	$large_size_w = get_option( 'large_size_w' );
2588
+function geodir_media_image_large_width($default = 800, $params = '') {
2589
+	$large_size_w = get_option('large_size_w');
2590 2590
 	$large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2591
-	$large_size_w = absint( $large_size_w );
2591
+	$large_size_w = absint($large_size_w);
2592 2592
 
2593
-	if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
2593
+	if (!get_option('geodir_use_wp_media_large_size')) {
2594 2594
 		$large_size_w = 800;
2595 2595
 	}
2596 2596
 
@@ -2603,7 +2603,7 @@  discard block
 block discarded – undo
2603 2603
 	 * @param int $default         Default width.
2604 2604
 	 * @param string|array $params Image parameters.
2605 2605
 	 */
2606
-	$large_size_w = apply_filters( 'geodir_filter_media_image_large_width', $large_size_w, $default, $params );
2606
+	$large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2607 2607
 
2608 2608
 	return $large_size_w;
2609 2609
 }
@@ -2619,12 +2619,12 @@  discard block
 block discarded – undo
2619 2619
  *
2620 2620
  * @return int Large size height.
2621 2621
  */
2622
-function geodir_media_image_large_height( $default = 800, $params = '' ) {
2623
-	$large_size_h = get_option( 'large_size_h' );
2622
+function geodir_media_image_large_height($default = 800, $params = '') {
2623
+	$large_size_h = get_option('large_size_h');
2624 2624
 	$large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2625
-	$large_size_h = absint( $large_size_h );
2625
+	$large_size_h = absint($large_size_h);
2626 2626
 
2627
-	if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
2627
+	if (!get_option('geodir_use_wp_media_large_size')) {
2628 2628
 		$large_size_h = 800;
2629 2629
 	}
2630 2630
 
@@ -2637,7 +2637,7 @@  discard block
 block discarded – undo
2637 2637
 	 * @param int $default         Default height.
2638 2638
 	 * @param string|array $params Image parameters.
2639 2639
 	 */
2640
-	$large_size_h = apply_filters( 'geodir_filter_media_image_large_height', $large_size_h, $default, $params );
2640
+	$large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2641 2641
 
2642 2642
 	return $large_size_h;
2643 2643
 }
@@ -2654,8 +2654,8 @@  discard block
 block discarded – undo
2654 2654
  *
2655 2655
  * @return string Sanitized name.
2656 2656
  */
2657
-function geodir_sanitize_location_name( $type, $name, $translate = true ) {
2658
-	if ( $name == '' ) {
2657
+function geodir_sanitize_location_name($type, $name, $translate = true) {
2658
+	if ($name == '') {
2659 2659
 		return null;
2660 2660
 	}
2661 2661
 
@@ -2664,13 +2664,13 @@  discard block
 block discarded – undo
2664 2664
 	$type = $type == 'gd_city' ? 'city' : $type;
2665 2665
 
2666 2666
 	$return = $name;
2667
-	if ( function_exists( 'get_actual_location_name' ) ) {
2668
-		$return = get_actual_location_name( $type, $name, $translate );
2667
+	if (function_exists('get_actual_location_name')) {
2668
+		$return = get_actual_location_name($type, $name, $translate);
2669 2669
 	} else {
2670
-		$return = preg_replace( '/-(\d+)$/', '', $return );
2671
-		$return = preg_replace( '/[_-]/', ' ', $return );
2672
-		$return = geodir_ucwords( $return );
2673
-		$return = $translate ? __( $return, 'geodirectory' ) : $return;
2670
+		$return = preg_replace('/-(\d+)$/', '', $return);
2671
+		$return = preg_replace('/[_-]/', ' ', $return);
2672
+		$return = geodir_ucwords($return);
2673
+		$return = $translate ? __($return, 'geodirectory') : $return;
2674 2674
 	}
2675 2675
 
2676 2676
 	return $return;
@@ -2685,14 +2685,14 @@  discard block
 block discarded – undo
2685 2685
  *
2686 2686
  * @param int $number Comments number.
2687 2687
  */
2688
-function geodir_comments_number( $number ) {
2688
+function geodir_comments_number($number) {
2689 2689
 
2690
-	if ( $number > 1 ) {
2691
-		$output = str_replace( '%', number_format_i18n( $number ), __( '% Reviews', 'geodirectory' ) );
2692
-	} elseif ( $number == 0 || $number == '' ) {
2693
-		$output = __( 'No Reviews', 'geodirectory' );
2690
+	if ($number > 1) {
2691
+		$output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2692
+	} elseif ($number == 0 || $number == '') {
2693
+		$output = __('No Reviews', 'geodirectory');
2694 2694
 	} else { // must be one
2695
-		$output = __( '1 Review', 'geodirectory' );
2695
+		$output = __('1 Review', 'geodirectory');
2696 2696
 	}
2697 2697
 	echo $output;
2698 2698
 }
@@ -2707,18 +2707,18 @@  discard block
 block discarded – undo
2707 2707
  */
2708 2708
 function is_page_geodir_home() {
2709 2709
 	global $wpdb;
2710
-	$cur_url = str_replace( array( "https://", "http://", "www." ), array( '', '', '' ), geodir_curPageURL() );
2711
-	if ( function_exists( 'geodir_location_geo_home_link' ) ) {
2712
-		remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 );
2710
+	$cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2711
+	if (function_exists('geodir_location_geo_home_link')) {
2712
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2713 2713
 	}
2714
-	$home_url = home_url( '', 'http' );
2715
-	if ( function_exists( 'geodir_location_geo_home_link' ) ) {
2716
-		add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 );
2714
+	$home_url = home_url('', 'http');
2715
+	if (function_exists('geodir_location_geo_home_link')) {
2716
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2717 2717
 	}
2718
-	$home_url = str_replace( "www.", "", $home_url );
2719
-	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' ) ) ) {
2718
+	$home_url = str_replace("www.", "", $home_url);
2719
+	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'))) {
2720 2720
 		return true;
2721
-	} 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' ) ) {
2721
+	} 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')) {
2722 2722
 		return true;
2723 2723
 	} else {
2724 2724
 		return false;
@@ -2738,18 +2738,18 @@  discard block
 block discarded – undo
2738 2738
  *
2739 2739
  * @return string The canonical URL.
2740 2740
  */
2741
-function geodir_wpseo_homepage_canonical( $url ) {
2741
+function geodir_wpseo_homepage_canonical($url) {
2742 2742
 	global $post;
2743 2743
 
2744
-	if ( is_page_geodir_home() ) {
2744
+	if (is_page_geodir_home()) {
2745 2745
 		return home_url();
2746 2746
 	}
2747 2747
 
2748 2748
 	return $url;
2749 2749
 }
2750 2750
 
2751
-add_filter( 'wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10 );
2752
-add_filter( 'aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10 );
2751
+add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10);
2752
+add_filter('aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10);
2753 2753
 
2754 2754
 /**
2755 2755
  * Add extra fields to google maps script call.
@@ -2762,20 +2762,20 @@  discard block
 block discarded – undo
2762 2762
  *
2763 2763
  * @return string Modified extra string.
2764 2764
  */
2765
-function geodir_googlemap_script_extra_details_page( $extra ) {
2765
+function geodir_googlemap_script_extra_details_page($extra) {
2766 2766
 	global $post;
2767 2767
 	$add_google_places_api = false;
2768
-	if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
2768
+	if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2769 2769
 		$add_google_places_api = true;
2770 2770
 	}
2771
-	if ( ! str_replace( 'libraries=places', '', $extra ) && ( geodir_is_page( 'detail' ) || $add_google_places_api ) ) {
2771
+	if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2772 2772
 		$extra .= "&amp;libraries=places";
2773 2773
 	}
2774 2774
 
2775 2775
 	return $extra;
2776 2776
 }
2777 2777
 
2778
-add_filter( 'geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1 );
2778
+add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1);
2779 2779
 
2780 2780
 
2781 2781
 /**
@@ -2793,104 +2793,104 @@  discard block
 block discarded – undo
2793 2793
  *                                          after_widget.
2794 2794
  * @param array|string $instance            The settings for the particular instance of the widget.
2795 2795
  */
2796
-function geodir_popular_post_category_output( $args = '', $instance = '' ) {
2796
+function geodir_popular_post_category_output($args = '', $instance = '') {
2797 2797
 	// prints the widget
2798 2798
 	global $wpdb, $plugin_prefix, $geodir_post_category_str;
2799
-	extract( $args, EXTR_SKIP );
2799
+	extract($args, EXTR_SKIP);
2800 2800
 
2801 2801
 	echo $before_widget;
2802 2802
 
2803 2803
 	/** This filter is documented in geodirectory_widgets.php */
2804
-	$title = empty( $instance['title'] ) ? __( 'Popular Categories', 'geodirectory' ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
2804
+	$title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2805 2805
 
2806 2806
 	$gd_post_type = geodir_get_current_posttype();
2807 2807
 
2808
-	$category_limit = isset( $instance['category_limit'] ) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2808
+	$category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2809 2809
 	if (!isset($category_restrict)) {
2810 2810
 		$category_restrict = false;
2811 2811
 	}
2812
-	if ( ! empty( $gd_post_type ) ) {
2812
+	if (!empty($gd_post_type)) {
2813 2813
 		$default_post_type = $gd_post_type;
2814
-	} elseif ( isset( $instance['default_post_type'] ) && gdsc_is_post_type_valid( $instance['default_post_type'] ) ) {
2814
+	} elseif (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type'])) {
2815 2815
 		$default_post_type = $instance['default_post_type'];
2816 2816
 	} else {
2817 2817
 		$all_gd_post_type  = geodir_get_posttypes();
2818
-		$default_post_type = ( isset( $all_gd_post_type[0] ) ) ? $all_gd_post_type[0] : '';
2818
+		$default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2819 2819
 	}
2820
-	$parent_only = !empty( $instance['parent_only'] ) ? true : false;
2820
+	$parent_only = !empty($instance['parent_only']) ? true : false;
2821 2821
 
2822 2822
 	$taxonomy = array();
2823
-	if ( ! empty( $gd_post_type ) ) {
2824
-		$taxonomy[] = $gd_post_type . "category";
2823
+	if (!empty($gd_post_type)) {
2824
+		$taxonomy[] = $gd_post_type."category";
2825 2825
 	} else {
2826
-		$taxonomy = geodir_get_taxonomies( $gd_post_type );
2826
+		$taxonomy = geodir_get_taxonomies($gd_post_type);
2827 2827
 	}
2828 2828
 
2829 2829
 	$taxonomy = apply_filters('geodir_pp_category_taxonomy', $taxonomy);
2830 2830
 
2831
-	$term_args = array( 'taxonomy' => $taxonomy );
2832
-	if ( $parent_only ) {
2831
+	$term_args = array('taxonomy' => $taxonomy);
2832
+	if ($parent_only) {
2833 2833
 		$term_args['parent'] = 0;
2834 2834
 	}
2835 2835
 
2836
-	$terms   = get_terms( $term_args );
2836
+	$terms   = get_terms($term_args);
2837 2837
 	$a_terms = array();
2838 2838
 	$b_terms = array();
2839 2839
 
2840
-	foreach ( $terms as $term ) {
2841
-		if ( $term->count > 0 ) {
2842
-			$a_terms[ $term->taxonomy ][] = $term;
2840
+	foreach ($terms as $term) {
2841
+		if ($term->count > 0) {
2842
+			$a_terms[$term->taxonomy][] = $term;
2843 2843
 		}
2844 2844
 	}
2845 2845
 
2846
-	if ( ! empty( $a_terms ) ) {
2847
-		foreach ( $a_terms as $b_key => $b_val ) {
2848
-			$b_terms[ $b_key ] = geodir_sort_terms( $b_val, 'count' );
2846
+	if (!empty($a_terms)) {
2847
+		foreach ($a_terms as $b_key => $b_val) {
2848
+			$b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2849 2849
 		}
2850 2850
 
2851
-		$default_taxonomy = $default_post_type != '' && isset( $b_terms[ $default_post_type . 'category' ] ) ? $default_post_type . 'category' : '';
2851
+		$default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type.'category']) ? $default_post_type.'category' : '';
2852 2852
 
2853 2853
 		$tax_change_output = '';
2854
-		if ( count( $b_terms ) > 1 ) {
2855
-			$tax_change_output .= "<select data-limit='$category_limit' data-parent='" . (int)$parent_only . "' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2856
-			foreach ( $b_terms as $key => $val ) {
2857
-				$ptype    = get_post_type_object( str_replace( "category", "", $key ) );
2858
-				$cpt_name = __( $ptype->labels->singular_name, 'geodirectory' );
2859
-				$tax_change_output .= "<option value='$key' " . selected( $key, $default_taxonomy, false ) . ">" . sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name ) . "</option>";
2854
+		if (count($b_terms) > 1) {
2855
+			$tax_change_output .= "<select data-limit='$category_limit' data-parent='".(int) $parent_only."' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2856
+			foreach ($b_terms as $key => $val) {
2857
+				$ptype    = get_post_type_object(str_replace("category", "", $key));
2858
+				$cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2859
+				$tax_change_output .= "<option value='$key' ".selected($key, $default_taxonomy, false).">".sprintf(__('%s Categories', 'geodirectory'), $cpt_name)."</option>";
2860 2860
 			}
2861 2861
 			$tax_change_output .= "</select>";
2862 2862
 		}
2863 2863
 
2864
-		if ( ! empty( $b_terms ) ) {
2865
-			$terms = $default_taxonomy != '' && isset( $b_terms[ $default_taxonomy ] ) ? $b_terms[ $default_taxonomy ] : reset( $b_terms );// get the first array
2866
-			global $cat_count;//make global so we can change via function
2864
+		if (!empty($b_terms)) {
2865
+			$terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array
2866
+			global $cat_count; //make global so we can change via function
2867 2867
 			$cat_count = 0;
2868 2868
 			?>
2869 2869
 			<div class="geodir-category-list-in clearfix">
2870 2870
 				<div class="geodir-cat-list clearfix">
2871 2871
 					<?php
2872
-					echo $before_title . __( $title ) . $after_title;
2872
+					echo $before_title.__($title).$after_title;
2873 2873
 
2874 2874
 					echo $tax_change_output;
2875 2875
 
2876 2876
 					echo '<ul class="geodir-popular-cat-list">';
2877 2877
 
2878
-					geodir_helper_cat_list_output( $terms, $category_limit, $category_restrict);
2878
+					geodir_helper_cat_list_output($terms, $category_limit, $category_restrict);
2879 2879
 
2880 2880
 					echo '</ul>';
2881 2881
 					?>
2882 2882
 				</div>
2883 2883
 				<?php
2884 2884
 				$hide = '';
2885
-				if ( $cat_count < $category_limit ) {
2885
+				if ($cat_count < $category_limit) {
2886 2886
 					$hide = 'style="display:none;"';
2887 2887
 				}
2888 2888
 				echo "<div class='geodir-cat-list-more' $hide >";
2889
-				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __( 'More Categories', 'geodirectory' ) . '</a>';
2890
-				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __( 'Less Categories', 'geodirectory' ) . '</a>';
2889
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">'.__('More Categories', 'geodirectory').'</a>';
2890
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">'.__('Less Categories', 'geodirectory').'</a>';
2891 2891
 				echo "</div>";
2892 2892
 				/* add scripts */
2893
-				add_action( 'wp_footer', 'geodir_popular_category_add_scripts', 100 );
2893
+				add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2894 2894
 				?>
2895 2895
 			</div>
2896 2896
 			<?php
@@ -2910,28 +2910,28 @@  discard block
 block discarded – undo
2910 2910
  * @param int $category_limit               Number of categories to display by default.
2911 2911
  * @param bool $category_restrict           If the cat limit shoudl be hidden or not shown.
2912 2912
  */
2913
-function geodir_helper_cat_list_output( $terms, $category_limit , $category_restrict=false) {
2913
+function geodir_helper_cat_list_output($terms, $category_limit, $category_restrict = false) {
2914 2914
 	global $geodir_post_category_str, $cat_count;
2915 2915
 	$term_icons = geodir_get_term_icon();
2916 2916
 
2917 2917
 	$geodir_post_category_str = array();
2918 2918
 
2919 2919
 
2920
-	foreach ( $terms as $cat ) {
2921
-		$post_type     = str_replace( "category", "", $cat->taxonomy );
2922
-		$term_icon_url = ! empty( $term_icons ) && isset( $term_icons[ $cat->term_id ] ) ? $term_icons[ $cat->term_id ] : '';
2920
+	foreach ($terms as $cat) {
2921
+		$post_type     = str_replace("category", "", $cat->taxonomy);
2922
+		$term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2923 2923
 
2924
-		$cat_count ++;
2924
+		$cat_count++;
2925 2925
 
2926
-		$geodir_post_category_str[] = array( 'posttype' => $post_type, 'termid' => $cat->term_id );
2926
+		$geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2927 2927
 
2928
-		$class_row  = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2929
-		if($category_restrict && $cat_count > $category_limit ){
2928
+		$class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2929
+		if ($category_restrict && $cat_count > $category_limit) {
2930 2930
 			continue;
2931 2931
 		}
2932 2932
 		$total_post = $cat->count;
2933 2933
 
2934
-		$term_link = get_term_link( $cat, $cat->taxonomy );
2934
+		$term_link = get_term_link($cat, $cat->taxonomy);
2935 2935
 		/**
2936 2936
 		 * Filer the category term link.
2937 2937
 		 *
@@ -2941,11 +2941,11 @@  discard block
 block discarded – undo
2941 2941
 		 * @param int $cat          ->term_id The term id.
2942 2942
 		 * @param string $post_type Wordpress post type.
2943 2943
 		 */
2944
-		$term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2944
+		$term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
2945 2945
 
2946
-		echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2947
-		echo '<img alt="' . esc_attr( $cat->name ) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">';
2948
-		echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
2946
+		echo '<li class="'.$class_row.'"><a href="'.$term_link.'">';
2947
+		echo '<img alt="'.esc_attr($cat->name).' icon" style="height:20px;vertical-align:middle;" src="'.$term_icon_url.'"/> <span class="cat-link">';
2948
+		echo $cat->name.'</span> <span class="geodir_term_class geodir_link_span geodir_category_class_'.$post_type.'_'.$cat->term_id.'">('.$total_post.')</span> ';
2949 2949
 		echo '</a></li>';
2950 2950
 	}
2951 2951
 }
@@ -2960,14 +2960,14 @@  discard block
 block discarded – undo
2960 2960
  * @param array|string $args     Display arguments including before_title, after_title, before_widget, and after_widget.
2961 2961
  * @param array|string $instance The settings for the particular instance of the widget.
2962 2962
  */
2963
-function geodir_listing_slider_widget_output( $args = '', $instance = '' ) {
2963
+function geodir_listing_slider_widget_output($args = '', $instance = '') {
2964 2964
 	// prints the widget
2965
-	extract( $args, EXTR_SKIP );
2965
+	extract($args, EXTR_SKIP);
2966 2966
 
2967 2967
 	echo $before_widget;
2968 2968
 
2969 2969
 	/** This filter is documented in geodirectory_widgets.php */
2970
-	$title = empty( $instance['title'] ) ? '' : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
2970
+	$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2971 2971
 	/**
2972 2972
 	 * Filter the widget post type.
2973 2973
 	 *
@@ -2975,7 +2975,7 @@  discard block
 block discarded – undo
2975 2975
 	 *
2976 2976
 	 * @param string $instance ['post_type'] Post type of listing.
2977 2977
 	 */
2978
-	$post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] );
2978
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2979 2979
 	/**
2980 2980
 	 * Filter the widget's term.
2981 2981
 	 *
@@ -2983,7 +2983,7 @@  discard block
 block discarded – undo
2983 2983
 	 *
2984 2984
 	 * @param string $instance ['category'] Filter by term. Can be any valid term.
2985 2985
 	 */
2986
-	$category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] );
2986
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2987 2987
 	/**
2988 2988
 	 * Filter widget's "add_location_filter" value.
2989 2989
 	 *
@@ -2991,7 +2991,7 @@  discard block
 block discarded – undo
2991 2991
 	 *
2992 2992
 	 * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
2993 2993
 	 */
2994
-	$add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] );
2994
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
2995 2995
 	/**
2996 2996
 	 * Filter the widget listings limit.
2997 2997
 	 *
@@ -2999,7 +2999,7 @@  discard block
 block discarded – undo
2999 2999
 	 *
3000 3000
 	 * @param string $instance ['post_number'] Number of listings to display.
3001 3001
 	 */
3002
-	$post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] );
3002
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3003 3003
 	/**
3004 3004
 	 * Filter the widget listings limit shown at one time.
3005 3005
 	 *
@@ -3007,7 +3007,7 @@  discard block
 block discarded – undo
3007 3007
 	 *
3008 3008
 	 * @param string $instance ['max_show'] Number of listings to display on screen.
3009 3009
 	 */
3010
-	$max_show = empty( $instance['max_show'] ) ? '1' : apply_filters( 'widget_max_show', $instance['max_show'] );
3010
+	$max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
3011 3011
 	/**
3012 3012
 	 * Filter the widget slide width.
3013 3013
 	 *
@@ -3015,7 +3015,7 @@  discard block
 block discarded – undo
3015 3015
 	 *
3016 3016
 	 * @param string $instance ['slide_width'] Width of the slides shown.
3017 3017
 	 */
3018
-	$slide_width = empty( $instance['slide_width'] ) ? '' : apply_filters( 'widget_slide_width', $instance['slide_width'] );
3018
+	$slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
3019 3019
 	/**
3020 3020
 	 * Filter widget's "show title" value.
3021 3021
 	 *
@@ -3023,7 +3023,7 @@  discard block
 block discarded – undo
3023 3023
 	 *
3024 3024
 	 * @param string|bool $instance ['show_title'] Do you want to display title? Can be 1 or 0.
3025 3025
 	 */
3026
-	$show_title = empty( $instance['show_title'] ) ? '' : apply_filters( 'widget_show_title', $instance['show_title'] );
3026
+	$show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
3027 3027
 	/**
3028 3028
 	 * Filter widget's "slideshow" value.
3029 3029
 	 *
@@ -3031,7 +3031,7 @@  discard block
 block discarded – undo
3031 3031
 	 *
3032 3032
 	 * @param int $instance ['slideshow'] Setup a slideshow for the slider to animate automatically.
3033 3033
 	 */
3034
-	$slideshow = empty( $instance['slideshow'] ) ? 0 : apply_filters( 'widget_slideshow', $instance['slideshow'] );
3034
+	$slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
3035 3035
 	/**
3036 3036
 	 * Filter widget's "animationLoop" value.
3037 3037
 	 *
@@ -3039,7 +3039,7 @@  discard block
 block discarded – undo
3039 3039
 	 *
3040 3040
 	 * @param int $instance ['animationLoop'] Gives the slider a seamless infinite loop.
3041 3041
 	 */
3042
-	$animationLoop = empty( $instance['animationLoop'] ) ? 0 : apply_filters( 'widget_animationLoop', $instance['animationLoop'] );
3042
+	$animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
3043 3043
 	/**
3044 3044
 	 * Filter widget's "directionNav" value.
3045 3045
 	 *
@@ -3047,7 +3047,7 @@  discard block
 block discarded – undo
3047 3047
 	 *
3048 3048
 	 * @param int $instance ['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
3049 3049
 	 */
3050
-	$directionNav = empty( $instance['directionNav'] ) ? 0 : apply_filters( 'widget_directionNav', $instance['directionNav'] );
3050
+	$directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
3051 3051
 	/**
3052 3052
 	 * Filter widget's "slideshowSpeed" value.
3053 3053
 	 *
@@ -3055,7 +3055,7 @@  discard block
 block discarded – undo
3055 3055
 	 *
3056 3056
 	 * @param int $instance ['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
3057 3057
 	 */
3058
-	$slideshowSpeed = empty( $instance['slideshowSpeed'] ) ? 5000 : apply_filters( 'widget_slideshowSpeed', $instance['slideshowSpeed'] );
3058
+	$slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
3059 3059
 	/**
3060 3060
 	 * Filter widget's "animationSpeed" value.
3061 3061
 	 *
@@ -3063,7 +3063,7 @@  discard block
 block discarded – undo
3063 3063
 	 *
3064 3064
 	 * @param int $instance ['animationSpeed'] Set the speed of animations, in milliseconds.
3065 3065
 	 */
3066
-	$animationSpeed = empty( $instance['animationSpeed'] ) ? 600 : apply_filters( 'widget_animationSpeed', $instance['animationSpeed'] );
3066
+	$animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
3067 3067
 	/**
3068 3068
 	 * Filter widget's "animation" value.
3069 3069
 	 *
@@ -3071,7 +3071,7 @@  discard block
 block discarded – undo
3071 3071
 	 *
3072 3072
 	 * @param string $instance ['animation'] Controls the animation type, "fade" or "slide".
3073 3073
 	 */
3074
-	$animation = empty( $instance['animation'] ) ? 'slide' : apply_filters( 'widget_animation', $instance['animation'] );
3074
+	$animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
3075 3075
 	/**
3076 3076
 	 * Filter widget's "list_sort" type.
3077 3077
 	 *
@@ -3079,10 +3079,10 @@  discard block
 block discarded – undo
3079 3079
 	 *
3080 3080
 	 * @param string $instance ['list_sort'] Listing sort by type.
3081 3081
 	 */
3082
-	$list_sort          = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] );
3083
-	$show_featured_only = ! empty( $instance['show_featured_only'] ) ? 1 : null;
3082
+	$list_sort          = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3083
+	$show_featured_only = !empty($instance['show_featured_only']) ? 1 : null;
3084 3084
 
3085
-	wp_enqueue_script( 'geodirectory-jquery-flexslider-js' );
3085
+	wp_enqueue_script('geodirectory-jquery-flexslider-js');
3086 3086
 	?>
3087 3087
 	<script type="text/javascript">
3088 3088
 		jQuery(window).load(function () {
@@ -3100,23 +3100,23 @@  discard block
 block discarded – undo
3100 3100
 				itemWidth: 75,
3101 3101
 				itemMargin: 5,
3102 3102
 				asNavFor: '#geodir_widget_slider',
3103
-				rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
3103
+				rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
3104 3104
 			});
3105 3105
 
3106 3106
 			jQuery('#geodir_widget_slider').flexslider({
3107
-				animation: "<?php echo $animation;?>",
3107
+				animation: "<?php echo $animation; ?>",
3108 3108
 				selector: ".geodir-slides > li",
3109 3109
 				namespace: "geodir-",
3110 3110
 				controlNav: true,
3111
-				animationLoop: <?php echo $animationLoop;?>,
3112
-				slideshow: <?php echo $slideshow;?>,
3113
-				slideshowSpeed: <?php echo $slideshowSpeed;?>,
3114
-				animationSpeed: <?php echo $animationSpeed;?>,
3115
-				directionNav: <?php echo $directionNav;?>,
3116
-				maxItems: <?php echo $max_show;?>,
3111
+				animationLoop: <?php echo $animationLoop; ?>,
3112
+				slideshow: <?php echo $slideshow; ?>,
3113
+				slideshowSpeed: <?php echo $slideshowSpeed; ?>,
3114
+				animationSpeed: <?php echo $animationSpeed; ?>,
3115
+				directionNav: <?php echo $directionNav; ?>,
3116
+				maxItems: <?php echo $max_show; ?>,
3117 3117
 				move: 1,
3118
-				<?php if ( $slide_width ) {
3119
-				echo "itemWidth: " . $slide_width . ",";
3118
+				<?php if ($slide_width) {
3119
+				echo "itemWidth: ".$slide_width.",";
3120 3120
 			}?>
3121 3121
 				sync: "#geodir_widget_carousel",
3122 3122
 				start: function (slider) {
@@ -3128,7 +3128,7 @@  discard block
 block discarded – undo
3128 3128
 					jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
3129 3129
 					jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
3130 3130
 				},
3131
-				rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
3131
+				rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
3132 3132
 			});
3133 3133
 		});
3134 3134
 	</script>
@@ -3141,62 +3141,62 @@  discard block
 block discarded – undo
3141 3141
 		'order_by'       => $list_sort
3142 3142
 	);
3143 3143
 
3144
-	if ( $show_featured_only ) {
3144
+	if ($show_featured_only) {
3145 3145
 		$query_args['show_featured_only'] = 1;
3146 3146
 	}
3147 3147
 
3148
-	if ( $category != 0 || $category != '' ) {
3149
-		$category_taxonomy = geodir_get_taxonomies( $post_type );
3148
+	if ($category != 0 || $category != '') {
3149
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3150 3150
 		$tax_query         = array(
3151 3151
 			'taxonomy' => $category_taxonomy[0],
3152 3152
 			'field'    => 'id',
3153 3153
 			'terms'    => $category
3154 3154
 		);
3155 3155
 
3156
-		$query_args['tax_query'] = array( $tax_query );
3156
+		$query_args['tax_query'] = array($tax_query);
3157 3157
 	}
3158 3158
 
3159 3159
 	// we want listings with featured image only
3160 3160
 	$query_args['featured_image_only'] = 1;
3161 3161
 
3162
-	if ( $post_type == 'gd_event' ) {
3162
+	if ($post_type == 'gd_event') {
3163 3163
 		$query_args['gedir_event_listing_filter'] = 'upcoming';
3164 3164
 	}// show only upcoming events
3165 3165
 
3166
-	$widget_listings = geodir_get_widget_listings( $query_args );
3167
-	if ( ! empty( $widget_listings ) || ( isset( $with_no_results ) && $with_no_results ) ) {
3168
-		if ( $title ) {
3169
-			echo $before_title . $title . $after_title;
3166
+	$widget_listings = geodir_get_widget_listings($query_args);
3167
+	if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
3168
+		if ($title) {
3169
+			echo $before_title.$title.$after_title;
3170 3170
 		}
3171 3171
 
3172 3172
 		global $post;
3173 3173
 
3174
-		$current_post = $post;// keep current post info
3174
+		$current_post = $post; // keep current post info
3175 3175
 
3176 3176
 		$widget_main_slides = '';
3177 3177
 		$nav_slides         = '';
3178 3178
 		$widget_slides      = 0;
3179 3179
 
3180
-		foreach ( $widget_listings as $widget_listing ) {
3180
+		foreach ($widget_listings as $widget_listing) {
3181 3181
 			global $gd_widget_listing_type;
3182 3182
 			$post         = $widget_listing;
3183
-			$widget_image = geodir_get_featured_image( $post->ID, 'thumbnail', get_option( 'geodir_listing_no_img' ) );
3183
+			$widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
3184 3184
 
3185
-			if ( ! empty( $widget_image ) ) {
3186
-				if ( $widget_image->height >= 200 ) {
3185
+			if (!empty($widget_image)) {
3186
+				if ($widget_image->height >= 200) {
3187 3187
 					$widget_spacer_height = 0;
3188 3188
 				} else {
3189
-					$widget_spacer_height = ( ( 200 - $widget_image->height ) / 2 );
3189
+					$widget_spacer_height = ((200 - $widget_image->height) / 2);
3190 3190
 				}
3191 3191
 
3192
-				$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" />';
3192
+				$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" />';
3193 3193
 
3194 3194
 				$title = '';
3195
-				if ( $show_title ) {
3196
-					$title_html     = '<div class="geodir-slider-title"><a href="' . get_permalink( $post->ID ) . '">' . get_the_title( $post->ID ) . '</a></div>';
3195
+				if ($show_title) {
3196
+					$title_html     = '<div class="geodir-slider-title"><a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a></div>';
3197 3197
 					$post_id        = $post->ID;
3198
-					$post_permalink = get_permalink( $post->ID );
3199
-					$post_title     = get_the_title( $post->ID );
3198
+					$post_permalink = get_permalink($post->ID);
3199
+					$post_title     = get_the_title($post->ID);
3200 3200
 					/**
3201 3201
 					 * Filter the listing slider widget title.
3202 3202
 					 *
@@ -3207,12 +3207,12 @@  discard block
 block discarded – undo
3207 3207
 					 * @param string $post_permalink The post permalink url.
3208 3208
 					 * @param string $post_title     The post title text.
3209 3209
 					 */
3210
-					$title = apply_filters( 'geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title );
3210
+					$title = apply_filters('geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title);
3211 3211
 				}
3212 3212
 
3213
-				$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>';
3214
-				$nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
3215
-				$widget_slides ++;
3213
+				$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>';
3214
+				$nav_slides .= '<li><img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
3215
+				$widget_slides++;
3216 3216
 			}
3217 3217
 		}
3218 3218
 		?>
@@ -3221,7 +3221,7 @@  discard block
 block discarded – undo
3221 3221
 			<div id="geodir_widget_slider" class="geodir_flexslider">
3222 3222
 				<ul class="geodir-slides clearfix"><?php echo $widget_main_slides; ?></ul>
3223 3223
 			</div>
3224
-			<?php if ( $widget_slides > 1 ) { ?>
3224
+			<?php if ($widget_slides > 1) { ?>
3225 3225
 				<div id="geodir_widget_carousel" class="geodir_flexslider">
3226 3226
 					<ul class="geodir-slides clearfix"><?php echo $nav_slides; ?></ul>
3227 3227
 				</div>
@@ -3229,7 +3229,7 @@  discard block
 block discarded – undo
3229 3229
 		</div>
3230 3230
 		<?php
3231 3231
 		$GLOBALS['post'] = $current_post;
3232
-		setup_postdata( $current_post );
3232
+		setup_postdata($current_post);
3233 3233
 	}
3234 3234
 	echo $after_widget;
3235 3235
 }
@@ -3245,46 +3245,46 @@  discard block
 block discarded – undo
3245 3245
  * @param array|string $args     Display arguments including before_title, after_title, before_widget, and after_widget.
3246 3246
  * @param array|string $instance The settings for the particular instance of the widget.
3247 3247
  */
3248
-function geodir_loginwidget_output( $args = '', $instance = '' ) {
3248
+function geodir_loginwidget_output($args = '', $instance = '') {
3249 3249
 	//print_r($args);
3250 3250
 	//print_r($instance);
3251 3251
 	// prints the widget
3252
-	extract( $args, EXTR_SKIP );
3252
+	extract($args, EXTR_SKIP);
3253 3253
 
3254 3254
 	/** This filter is documented in geodirectory_widgets.php */
3255
-	$title = empty( $instance['title'] ) ? __( 'My Dashboard', 'geodirectory' ) : apply_filters( 'my_dashboard_widget_title', __( $instance['title'], 'geodirectory' ) );
3255
+	$title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('my_dashboard_widget_title', __($instance['title'], 'geodirectory'));
3256 3256
 
3257 3257
 	echo $before_widget;
3258
-	echo $before_title . $title . $after_title;
3258
+	echo $before_title.$title.$after_title;
3259 3259
 
3260
-	if ( is_user_logged_in() ) {
3260
+	if (is_user_logged_in()) {
3261 3261
 		global $current_user;
3262 3262
 
3263
-		$author_link = get_author_posts_url( $current_user->data->ID );
3264
-		$author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false );
3263
+		$author_link = get_author_posts_url($current_user->data->ID);
3264
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
3265 3265
 
3266 3266
 		echo '<ul class="geodir-loginbox-list">';
3267 3267
 		ob_start();
3268 3268
 		?>
3269 3269
 		<li><a class="signin"
3270
-		       href="<?php echo wp_logout_url( home_url() ); ?>"><?php _e( 'Logout', 'geodirectory' ); ?></a></li>
3270
+		       href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li>
3271 3271
 		<?php
3272
-		$post_types                           = geodir_get_posttypes( 'object' );
3273
-		$show_add_listing_post_types_main_nav = get_option( 'geodir_add_listing_link_user_dashboard' );
3274
-		$geodir_allow_posttype_frontend       = get_option( 'geodir_allow_posttype_frontend' );
3272
+		$post_types                           = geodir_get_posttypes('object');
3273
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
3274
+		$geodir_allow_posttype_frontend       = get_option('geodir_allow_posttype_frontend');
3275 3275
 
3276
-		if ( ! empty( $show_add_listing_post_types_main_nav ) ) {
3276
+		if (!empty($show_add_listing_post_types_main_nav)) {
3277 3277
 			$addlisting_links = '';
3278
-			foreach ( $post_types as $key => $postobj ) {
3278
+			foreach ($post_types as $key => $postobj) {
3279 3279
 
3280
-				if ( in_array( $key, $show_add_listing_post_types_main_nav ) ) {
3280
+				if (in_array($key, $show_add_listing_post_types_main_nav)) {
3281 3281
 
3282
-					if ( $add_link = geodir_get_addlisting_link( $key ) ) {
3282
+					if ($add_link = geodir_get_addlisting_link($key)) {
3283 3283
 
3284 3284
 						$name = $postobj->labels->name;
3285 3285
 
3286 3286
 						$selected = '';
3287
-						if ( geodir_get_current_posttype() == $key && geodir_is_page( 'add-listing' ) ) {
3287
+						if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) {
3288 3288
 							$selected = 'selected="selected"';
3289 3289
 						}
3290 3290
 
@@ -3297,22 +3297,22 @@  discard block
 block discarded – undo
3297 3297
 						 * @param string $key       Add listing array key.
3298 3298
 						 * @param int $current_user ->ID Current user ID.
3299 3299
 						 */
3300
-						$add_link = apply_filters( 'geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID );
3300
+						$add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
3301 3301
 
3302
-						$addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3302
+						$addlisting_links .= '<option '.$selected.' value="'.$add_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3303 3303
 
3304 3304
 					}
3305 3305
 				}
3306 3306
 
3307 3307
 			}
3308 3308
 
3309
-			if ( $addlisting_links != '' ) { ?>
3309
+			if ($addlisting_links != '') { ?>
3310 3310
 
3311 3311
 				<li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value"
3312 3312
 				            option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false"
3313
-				            data-placeholder="<?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?>">
3313
+				            data-placeholder="<?php echo esc_attr(__('Add Listing', 'geodirectory')); ?>">
3314 3314
 						<option value="" disabled="disabled" selected="selected"
3315
-						        style='display:none;'><?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?></option>
3315
+						        style='display:none;'><?php echo esc_attr(__('Add Listing', 'geodirectory')); ?></option>
3316 3316
 						<?php echo $addlisting_links; ?>
3317 3317
 					</select></li> <?php
3318 3318
 
@@ -3320,23 +3320,23 @@  discard block
 block discarded – undo
3320 3320
 
3321 3321
 		}
3322 3322
 		// My Favourites in Dashboard
3323
-		$show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' );
3323
+		$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
3324 3324
 		$user_favourite                    = geodir_user_favourite_listing_count();
3325 3325
 
3326
-		if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) {
3326
+		if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
3327 3327
 			$favourite_links = '';
3328 3328
 
3329
-			foreach ( $post_types as $key => $postobj ) {
3330
-				if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) {
3329
+			foreach ($post_types as $key => $postobj) {
3330
+				if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
3331 3331
 					$name           = $postobj->labels->name;
3332
-					$post_type_link = geodir_getlink( $author_link, array(
3332
+					$post_type_link = geodir_getlink($author_link, array(
3333 3333
 						'stype' => $key,
3334 3334
 						'list'  => 'favourite'
3335
-					), false );
3335
+					), false);
3336 3336
 
3337 3337
 					$selected = '';
3338 3338
 
3339
-					if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) {
3339
+					if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
3340 3340
 						$selected = 'selected="selected"';
3341 3341
 					}
3342 3342
 					/**
@@ -3348,20 +3348,20 @@  discard block
 block discarded – undo
3348 3348
 					 * @param string $key            Favorite listing array key.
3349 3349
 					 * @param int $current_user      ->ID Current user ID.
3350 3350
 					 */
3351
-					$post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID );
3351
+					$post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
3352 3352
 
3353
-					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3353
+					$favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3354 3354
 				}
3355 3355
 			}
3356 3356
 
3357
-			if ( $favourite_links != '' ) {
3357
+			if ($favourite_links != '') {
3358 3358
 				?>
3359 3359
 				<li>
3360 3360
 					<select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
3361 3361
 					        option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false"
3362
-					        data-placeholder="<?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?>">
3362
+					        data-placeholder="<?php echo esc_attr(__('My Favorites', 'geodirectory')); ?>">
3363 3363
 						<option value="" disabled="disabled" selected="selected"
3364
-						        style='display:none;'><?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?></option>
3364
+						        style='display:none;'><?php echo esc_attr(__('My Favorites', 'geodirectory')); ?></option>
3365 3365
 						<?php echo $favourite_links; ?>
3366 3366
 					</select>
3367 3367
 				</li>
@@ -3370,19 +3370,19 @@  discard block
 block discarded – undo
3370 3370
 		}
3371 3371
 
3372 3372
 
3373
-		$show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' );
3373
+		$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
3374 3374
 		$user_listing                     = geodir_user_post_listing_count();
3375 3375
 
3376
-		if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) {
3376
+		if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
3377 3377
 			$listing_links = '';
3378 3378
 
3379
-			foreach ( $post_types as $key => $postobj ) {
3380
-				if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) {
3379
+			foreach ($post_types as $key => $postobj) {
3380
+				if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
3381 3381
 					$name         = $postobj->labels->name;
3382
-					$listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false );
3382
+					$listing_link = geodir_getlink($author_link, array('stype' => $key), false);
3383 3383
 
3384 3384
 					$selected = '';
3385
-					if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) {
3385
+					if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
3386 3386
 						$selected = 'selected="selected"';
3387 3387
 					}
3388 3388
 
@@ -3395,20 +3395,20 @@  discard block
 block discarded – undo
3395 3395
 					 * @param string $key          My listing array key.
3396 3396
 					 * @param int $current_user    ->ID Current user ID.
3397 3397
 					 */
3398
-					$listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID );
3398
+					$listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
3399 3399
 
3400
-					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3400
+					$listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3401 3401
 				}
3402 3402
 			}
3403 3403
 
3404
-			if ( $listing_links != '' ) {
3404
+			if ($listing_links != '') {
3405 3405
 				?>
3406 3406
 				<li>
3407 3407
 					<select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
3408 3408
 					        option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false"
3409
-					        data-placeholder="<?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?>">
3409
+					        data-placeholder="<?php echo esc_attr(__('My Listings', 'geodirectory')); ?>">
3410 3410
 						<option value="" disabled="disabled" selected="selected"
3411
-						        style='display:none;'><?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?></option>
3411
+						        style='display:none;'><?php echo esc_attr(__('My Listings', 'geodirectory')); ?></option>
3412 3412
 						<?php echo $listing_links; ?>
3413 3413
 					</select>
3414 3414
 				</li>
@@ -3424,7 +3424,7 @@  discard block
 block discarded – undo
3424 3424
 		 *
3425 3425
 		 * @param string $dashboard_link Dashboard links HTML.
3426 3426
 		 */
3427
-		echo apply_filters( 'geodir_dashboard_links', $dashboard_link );
3427
+		echo apply_filters('geodir_dashboard_links', $dashboard_link);
3428 3428
 		echo '</ul>';
3429 3429
 
3430 3430
 		/**
@@ -3432,7 +3432,7 @@  discard block
 block discarded – undo
3432 3432
 		 *
3433 3433
 		 * @since 1.6.6
3434 3434
 		 */
3435
-		do_action( 'geodir_after_loginwidget_form_logged_in' );
3435
+		do_action('geodir_after_loginwidget_form_logged_in');
3436 3436
 
3437 3437
 
3438 3438
 	} else {
@@ -3447,18 +3447,18 @@  discard block
 block discarded – undo
3447 3447
 		<form name="loginform" class="loginform1"
3448 3448
 		      action="<?php echo geodir_login_url(); ?>"
3449 3449
 		      method="post">
3450
-			<div class="geodir_form_row"><input placeholder="<?php _e( 'Email', 'geodirectory' ); ?>" name="log"
3450
+			<div class="geodir_form_row"><input placeholder="<?php _e('Email', 'geodirectory'); ?>" name="log"
3451 3451
 			                                    type="text" class="textfield user_login1"/> <span
3452 3452
 					class="user_loginInfo"></span></div>
3453
-			<div class="geodir_form_row"><input placeholder="<?php _e( 'Password', 'geodirectory' ); ?>"
3453
+			<div class="geodir_form_row"><input placeholder="<?php _e('Password', 'geodirectory'); ?>"
3454 3454
 			                                    name="pwd" type="password"
3455 3455
 			                                    class="textfield user_pass1 input-text"/><span
3456 3456
 					class="user_passInfo"></span></div>
3457 3457
 
3458
-			<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars( geodir_curPageURL() ); ?>"/>
3458
+			<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars(geodir_curPageURL()); ?>"/>
3459 3459
 			<input type="hidden" name="testcookie" value="1"/>
3460 3460
 
3461
-				<?php do_action( 'login_form' ); ?>
3461
+				<?php do_action('login_form'); ?>
3462 3462
 
3463 3463
 			<div class="geodir_form_row clearfix"><input type="submit" name="submit"
3464 3464
 			                                             value="<?php echo SIGN_IN_BUTTON; ?>" class="b_signin"/>
@@ -3471,7 +3471,7 @@  discard block
 block discarded – undo
3471 3471
 					 * @since 1.0.0
3472 3472
 					 */
3473 3473
 					?>
3474
-					<a href="<?php echo geodir_login_url( array( 'signup' => true ) ); ?>"
3474
+					<a href="<?php echo geodir_login_url(array('signup' => true)); ?>"
3475 3475
 					   class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a>
3476 3476
 
3477 3477
 					<?php
@@ -3481,7 +3481,7 @@  discard block
 block discarded – undo
3481 3481
 					 * @since 1.0.0
3482 3482
 					 */
3483 3483
 					?>
3484
-					<a href="<?php echo geodir_login_url( array( 'forgot' => true ) ); ?>"
3484
+					<a href="<?php echo geodir_login_url(array('forgot' => true)); ?>"
3485 3485
 					   class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div>
3486 3486
 		</form>
3487 3487
 		<?php
@@ -3490,7 +3490,7 @@  discard block
 block discarded – undo
3490 3490
 		 *
3491 3491
 		 * @since 1.6.6
3492 3492
 		 */
3493
-		do_action( 'geodir_after_loginwidget_form_logged_out' );
3493
+		do_action('geodir_after_loginwidget_form_logged_out');
3494 3494
 	}
3495 3495
 
3496 3496
 	echo $after_widget;
@@ -3512,16 +3512,16 @@  discard block
 block discarded – undo
3512 3512
  *                                         after_widget.
3513 3513
  * @param array|string $instance           The settings for the particular instance of the widget.
3514 3514
  */
3515
-function geodir_popular_postview_output( $args = '', $instance = '' ) {
3515
+function geodir_popular_postview_output($args = '', $instance = '') {
3516 3516
 	global $gd_session;
3517 3517
 
3518 3518
 	// prints the widget
3519
-	extract( $args, EXTR_SKIP );
3519
+	extract($args, EXTR_SKIP);
3520 3520
 
3521 3521
 	echo $before_widget;
3522 3522
 
3523 3523
 	/** This filter is documented in geodirectory_widgets.php */
3524
-	$title = empty( $instance['title'] ) ? geodir_ucwords( $instance['category_title'] ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
3524
+	$title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
3525 3525
 	/**
3526 3526
 	 * Filter the widget post type.
3527 3527
 	 *
@@ -3529,7 +3529,7 @@  discard block
 block discarded – undo
3529 3529
 	 *
3530 3530
 	 * @param string $instance ['post_type'] Post type of listing.
3531 3531
 	 */
3532
-	$post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] );
3532
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
3533 3533
 	/**
3534 3534
 	 * Filter the widget's term.
3535 3535
 	 *
@@ -3537,7 +3537,7 @@  discard block
 block discarded – undo
3537 3537
 	 *
3538 3538
 	 * @param string $instance ['category'] Filter by term. Can be any valid term.
3539 3539
 	 */
3540
-	$category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] );
3540
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3541 3541
 	/**
3542 3542
 	 * Filter the widget listings limit.
3543 3543
 	 *
@@ -3545,7 +3545,7 @@  discard block
 block discarded – undo
3545 3545
 	 *
3546 3546
 	 * @param string $instance ['post_number'] Number of listings to display.
3547 3547
 	 */
3548
-	$post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] );
3548
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3549 3549
 	/**
3550 3550
 	 * Filter widget's "layout" type.
3551 3551
 	 *
@@ -3553,7 +3553,7 @@  discard block
 block discarded – undo
3553 3553
 	 *
3554 3554
 	 * @param string $instance ['layout'] Widget layout type.
3555 3555
 	 */
3556
-	$layout = empty( $instance['layout'] ) ? 'gridview_onehalf' : apply_filters( 'widget_layout', $instance['layout'] );
3556
+	$layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
3557 3557
 	/**
3558 3558
 	 * Filter widget's "add_location_filter" value.
3559 3559
 	 *
@@ -3561,7 +3561,7 @@  discard block
 block discarded – undo
3561 3561
 	 *
3562 3562
 	 * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3563 3563
 	 */
3564
-	$add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] );
3564
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3565 3565
 	/**
3566 3566
 	 * Filter widget's listing width.
3567 3567
 	 *
@@ -3569,7 +3569,7 @@  discard block
 block discarded – undo
3569 3569
 	 *
3570 3570
 	 * @param string $instance ['listing_width'] Listing width.
3571 3571
 	 */
3572
-	$listing_width = empty( $instance['listing_width'] ) ? '' : apply_filters( 'widget_listing_width', $instance['listing_width'] );
3572
+	$listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3573 3573
 	/**
3574 3574
 	 * Filter widget's "list_sort" type.
3575 3575
 	 *
@@ -3577,25 +3577,25 @@  discard block
 block discarded – undo
3577 3577
 	 *
3578 3578
 	 * @param string $instance ['list_sort'] Listing sort by type.
3579 3579
 	 */
3580
-	$list_sort             = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] );
3581
-	$use_viewing_post_type = ! empty( $instance['use_viewing_post_type'] ) ? true : false;
3580
+	$list_sort             = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3581
+	$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3582 3582
 
3583 3583
 	// set post type to current viewing post type
3584
-	if ( $use_viewing_post_type ) {
3584
+	if ($use_viewing_post_type) {
3585 3585
 		$current_post_type = geodir_get_current_posttype();
3586
-		if ( $current_post_type != '' && $current_post_type != $post_type ) {
3586
+		if ($current_post_type != '' && $current_post_type != $post_type) {
3587 3587
 			$post_type = $current_post_type;
3588 3588
 			$category  = array(); // old post type category will not work for current changed post type
3589 3589
 		}
3590 3590
 	}
3591 3591
 	// replace widget title dynamically
3592
-	$posttype_plural_label   = __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3593
-	$posttype_singular_label = __( get_post_type_singular_label( $post_type ), 'geodirectory' );
3592
+	$posttype_plural_label   = __(get_post_type_plural_label($post_type), 'geodirectory');
3593
+	$posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3594 3594
 
3595
-	$title = str_replace( "%posttype_plural_label%", $posttype_plural_label, $title );
3596
-	$title = str_replace( "%posttype_singular_label%", $posttype_singular_label, $title );
3595
+	$title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3596
+	$title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3597 3597
 
3598
-	if ( isset( $instance['character_count'] ) ) {
3598
+	if (isset($instance['character_count'])) {
3599 3599
 		/**
3600 3600
 		 * Filter the widget's excerpt character count.
3601 3601
 		 *
@@ -3603,37 +3603,37 @@  discard block
 block discarded – undo
3603 3603
 		 *
3604 3604
 		 * @param int $instance ['character_count'] Excerpt character count.
3605 3605
 		 */
3606
-		$character_count = apply_filters( 'widget_list_character_count', $instance['character_count'] );
3606
+		$character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3607 3607
 	} else {
3608 3608
 		$character_count = '';
3609 3609
 	}
3610 3610
 
3611
-	if ( empty( $title ) || $title == 'All' ) {
3612
-		$title .= ' ' . __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3611
+	if (empty($title) || $title == 'All') {
3612
+		$title .= ' '.__(get_post_type_plural_label($post_type), 'geodirectory');
3613 3613
 	}
3614 3614
 
3615 3615
 	$location_url = array();
3616
-	$city         = get_query_var( 'gd_city' );
3617
-	if ( ! empty( $city ) ) {
3618
-		$country = get_query_var( 'gd_country' );
3619
-		$region  = get_query_var( 'gd_region' );
3616
+	$city         = get_query_var('gd_city');
3617
+	if (!empty($city)) {
3618
+		$country = get_query_var('gd_country');
3619
+		$region  = get_query_var('gd_region');
3620 3620
 
3621
-		$geodir_show_location_url = get_option( 'geodir_show_location_url' );
3621
+		$geodir_show_location_url = get_option('geodir_show_location_url');
3622 3622
 
3623
-		if ( $geodir_show_location_url == 'all' ) {
3624
-			if ( $country != '' ) {
3623
+		if ($geodir_show_location_url == 'all') {
3624
+			if ($country != '') {
3625 3625
 				$location_url[] = $country;
3626 3626
 			}
3627 3627
 
3628
-			if ( $region != '' ) {
3628
+			if ($region != '') {
3629 3629
 				$location_url[] = $region;
3630 3630
 			}
3631
-		} else if ( $geodir_show_location_url == 'country_city' ) {
3632
-			if ( $country != '' ) {
3631
+		} else if ($geodir_show_location_url == 'country_city') {
3632
+			if ($country != '') {
3633 3633
 				$location_url[] = $country;
3634 3634
 			}
3635
-		} else if ( $geodir_show_location_url == 'region_city' ) {
3636
-			if ( $region != '' ) {
3635
+		} else if ($geodir_show_location_url == 'region_city') {
3636
+			if ($region != '') {
3637 3637
 				$location_url[] = $region;
3638 3638
 			}
3639 3639
 		}
@@ -3641,37 +3641,37 @@  discard block
 block discarded – undo
3641 3641
 		$location_url[] = $city;
3642 3642
 	}
3643 3643
 
3644
-	$location_url  = implode( '/', $location_url );
3644
+	$location_url  = implode('/', $location_url);
3645 3645
 	$skip_location = false;
3646
-	if ( ! $add_location_filter && $gd_session->get( 'gd_multi_location' ) ) {
3646
+	if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3647 3647
 		$skip_location = true;
3648
-		$gd_session->un_set( 'gd_multi_location' );
3648
+		$gd_session->un_set('gd_multi_location');
3649 3649
 	}
3650 3650
 
3651
-	if ( get_option( 'permalink_structure' ) ) {
3652
-		$viewall_url = get_post_type_archive_link( $post_type );
3651
+	if (get_option('permalink_structure')) {
3652
+		$viewall_url = get_post_type_archive_link($post_type);
3653 3653
 	} else {
3654
-		$viewall_url = get_post_type_archive_link( $post_type );
3654
+		$viewall_url = get_post_type_archive_link($post_type);
3655 3655
 	}
3656 3656
 
3657
-	if ( ! empty( $category ) && $category[0] != '0' ) {
3657
+	if (!empty($category) && $category[0] != '0') {
3658 3658
 		global $geodir_add_location_url;
3659 3659
 
3660 3660
 		$geodir_add_location_url = '0';
3661 3661
 
3662
-		if ( $add_location_filter != '0' ) {
3662
+		if ($add_location_filter != '0') {
3663 3663
 			$geodir_add_location_url = '1';
3664 3664
 		}
3665 3665
 
3666
-		$viewall_url = get_term_link( (int) $category[0], $post_type . 'category' );
3666
+		$viewall_url = get_term_link((int) $category[0], $post_type.'category');
3667 3667
 
3668 3668
 		$geodir_add_location_url = null;
3669 3669
 	}
3670
-	if ( $skip_location ) {
3671
-		$gd_session->set( 'gd_multi_location', 1 );
3670
+	if ($skip_location) {
3671
+		$gd_session->set('gd_multi_location', 1);
3672 3672
 	}
3673 3673
 
3674
-	if ( is_wp_error( $viewall_url ) ) {
3674
+	if (is_wp_error($viewall_url)) {
3675 3675
 		$viewall_url = '';
3676 3676
 	}
3677 3677
 
@@ -3683,34 +3683,34 @@  discard block
 block discarded – undo
3683 3683
 		'order_by'       => $list_sort
3684 3684
 	);
3685 3685
 
3686
-	if ( $character_count ) {
3686
+	if ($character_count) {
3687 3687
 		$query_args['excerpt_length'] = $character_count;
3688 3688
 	}
3689 3689
 
3690
-	if ( ! empty( $instance['show_featured_only'] ) ) {
3690
+	if (!empty($instance['show_featured_only'])) {
3691 3691
 		$query_args['show_featured_only'] = 1;
3692 3692
 	}
3693 3693
 
3694
-	if ( ! empty( $instance['show_special_only'] ) ) {
3694
+	if (!empty($instance['show_special_only'])) {
3695 3695
 		$query_args['show_special_only'] = 1;
3696 3696
 	}
3697 3697
 
3698
-	if ( ! empty( $instance['with_pics_only'] ) ) {
3698
+	if (!empty($instance['with_pics_only'])) {
3699 3699
 		$query_args['with_pics_only']      = 0;
3700 3700
 		$query_args['featured_image_only'] = 1;
3701 3701
 	}
3702 3702
 
3703
-	if ( ! empty( $instance['with_videos_only'] ) ) {
3703
+	if (!empty($instance['with_videos_only'])) {
3704 3704
 		$query_args['with_videos_only'] = 1;
3705 3705
 	}
3706
-	$with_no_results = ! empty( $instance['without_no_results'] ) ? false : true;
3706
+	$with_no_results = !empty($instance['without_no_results']) ? false : true;
3707 3707
 
3708
-	if ( ! empty( $category ) && $category[0] != '0' ) {
3709
-		$category_taxonomy = geodir_get_taxonomies( $post_type );
3708
+	if (!empty($category) && $category[0] != '0') {
3709
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3710 3710
 
3711 3711
 		######### WPML #########
3712
-		if ( function_exists( 'icl_object_id' ) ) {
3713
-			$category = gd_lang_object_ids( $category, $category_taxonomy[0] );
3712
+		if (function_exists('icl_object_id')) {
3713
+			$category = gd_lang_object_ids($category, $category_taxonomy[0]);
3714 3714
 		}
3715 3715
 		######### WPML #########
3716 3716
 
@@ -3720,14 +3720,14 @@  discard block
 block discarded – undo
3720 3720
 			'terms'    => $category
3721 3721
 		);
3722 3722
 
3723
-		$query_args['tax_query'] = array( $tax_query );
3723
+		$query_args['tax_query'] = array($tax_query);
3724 3724
 	}
3725 3725
 
3726 3726
 	global $gridview_columns_widget, $geodir_is_widget_listing;
3727 3727
 
3728
-	$widget_listings = geodir_get_widget_listings( $query_args );
3728
+	$widget_listings = geodir_get_widget_listings($query_args);
3729 3729
 
3730
-	if ( ! empty( $widget_listings ) || $with_no_results ) {
3730
+	if (!empty($widget_listings) || $with_no_results) {
3731 3731
 		?>
3732 3732
 		<div class="geodir_locations geodir_location_listing">
3733 3733
 
@@ -3737,11 +3737,11 @@  discard block
 block discarded – undo
3737 3737
 			 *
3738 3738
 			 * @since 1.0.0
3739 3739
 			 */
3740
-			do_action( 'geodir_before_view_all_link_in_widget' ); ?>
3740
+			do_action('geodir_before_view_all_link_in_widget'); ?>
3741 3741
 			<div class="geodir_list_heading clearfix">
3742
-				<?php echo $before_title . $title . $after_title; ?>
3742
+				<?php echo $before_title.$title.$after_title; ?>
3743 3743
 				<a href="<?php echo $viewall_url; ?>"
3744
-				   class="geodir-viewall"><?php _e( 'View all', 'geodirectory' ); ?></a>
3744
+				   class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3745 3745
 			</div>
3746 3746
 			<?php
3747 3747
 			/**
@@ -3749,10 +3749,10 @@  discard block
 block discarded – undo
3749 3749
 			 *
3750 3750
 			 * @since 1.0.0
3751 3751
 			 */
3752
-			do_action( 'geodir_after_view_all_link_in_widget' ); ?>
3752
+			do_action('geodir_after_view_all_link_in_widget'); ?>
3753 3753
 			<?php
3754
-			if ( strstr( $layout, 'gridview' ) ) {
3755
-				$listing_view_exp        = explode( '_', $layout );
3754
+			if (strstr($layout, 'gridview')) {
3755
+				$listing_view_exp        = explode('_', $layout);
3756 3756
 				$gridview_columns_widget = $layout;
3757 3757
 				$layout                  = $listing_view_exp[0];
3758 3758
 			} else {
@@ -3764,8 +3764,8 @@  discard block
 block discarded – undo
3764 3764
 			 *
3765 3765
 			 * @since 1.0.0
3766 3766
 			 */
3767
-			$template = apply_filters( "geodir_template_part-widget-listing-listview", geodir_locate_template( 'widget-listing-listview' ) );
3768
-			if ( ! isset( $character_count ) ) {
3767
+			$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3768
+			if (!isset($character_count)) {
3769 3769
 				/**
3770 3770
 				 * Filter the widget's excerpt character count.
3771 3771
 				 *
@@ -3773,7 +3773,7 @@  discard block
 block discarded – undo
3773 3773
 				 *
3774 3774
 				 * @param int $instance ['character_count'] Excerpt character count.
3775 3775
 				 */
3776
-				$character_count = $character_count == '' ? 50 : apply_filters( 'widget_character_count', $character_count );
3776
+				$character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3777 3777
 			}
3778 3778
 
3779 3779
 			global $post, $map_jason, $map_canvas_arr;
@@ -3788,13 +3788,13 @@  discard block
 block discarded – undo
3788 3788
 			 *
3789 3789
 			 * @since 1.0.0
3790 3790
 			 */
3791
-			include( $template );
3791
+			include($template);
3792 3792
 
3793 3793
 			$geodir_is_widget_listing = false;
3794 3794
 
3795 3795
 			$GLOBALS['post'] = $current_post;
3796
-			if ( ! empty( $current_post ) ) {
3797
-				setup_postdata( $current_post );
3796
+			if (!empty($current_post)) {
3797
+				setup_postdata($current_post);
3798 3798
 			}
3799 3799
 			$map_jason      = $current_map_jason;
3800 3800
 			$map_canvas_arr = $current_map_canvas_arr;
@@ -3825,12 +3825,12 @@  discard block
 block discarded – undo
3825 3825
  *
3826 3826
  * @return int Reviews count.
3827 3827
  */
3828
-function geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type ) {
3828
+function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type) {
3829 3829
 	global $wpdb, $plugin_prefix;
3830 3830
 
3831
-	$detail_table = $plugin_prefix . $post_type . '_detail';
3831
+	$detail_table = $plugin_prefix.$post_type.'_detail';
3832 3832
 
3833
-	$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 . ")";
3833
+	$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.")";
3834 3834
 
3835 3835
 	/**
3836 3836
 	 * Filter count review sql query.
@@ -3842,9 +3842,9 @@  discard block
 block discarded – undo
3842 3842
 	 * @param int $taxonomy     The taxonomy Id.
3843 3843
 	 * @param string $post_type The post type.
3844 3844
 	 */
3845
-	$sql = apply_filters( 'geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type );
3845
+	$sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3846 3846
 
3847
-	$count = $wpdb->get_var( $sql );
3847
+	$count = $wpdb->get_var($sql);
3848 3848
 
3849 3849
 	return $count;
3850 3850
 }
@@ -3862,7 +3862,7 @@  discard block
 block discarded – undo
3862 3862
  *
3863 3863
  * @return array Term array data.
3864 3864
  */
3865
-function geodir_count_reviews_by_terms( $force_update = false, $post_ID = 0 ) {
3865
+function geodir_count_reviews_by_terms($force_update = false, $post_ID = 0) {
3866 3866
 	/**
3867 3867
 	 * Filter review count option data.
3868 3868
 	 *
@@ -3872,78 +3872,78 @@  discard block
 block discarded – undo
3872 3872
 	 * @param bool $force_update Force update option value?. Default.false.
3873 3873
 	 * @param int $post_ID       The post id to update if any.
3874 3874
 	 */
3875
-	$option_data = apply_filters( 'geodir_count_reviews_by_terms_before', '', $force_update, $post_ID );
3876
-	if ( ! empty( $option_data ) ) {
3875
+	$option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update, $post_ID);
3876
+	if (!empty($option_data)) {
3877 3877
 		return $option_data;
3878 3878
 	}
3879 3879
 
3880
-	$option_data = get_option( 'geodir_global_review_count' );
3880
+	$option_data = get_option('geodir_global_review_count');
3881 3881
 
3882
-	if ( ! $option_data || $force_update ) {
3883
-		if ( (int) $post_ID > 0 ) { // Update reviews count for specific post categories only.
3882
+	if (!$option_data || $force_update) {
3883
+		if ((int) $post_ID > 0) { // Update reviews count for specific post categories only.
3884 3884
 			global $gd_session;
3885 3885
 			$term_array = (array) $option_data;
3886
-			$post_type  = get_post_type( $post_ID );
3887
-			$taxonomy   = $post_type . 'category';
3888
-			$terms      = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) );
3889
-
3890
-			if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
3891
-				foreach ( $terms as $term_id ) {
3892
-					$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3893
-					$children               = get_term_children( $term_id, $taxonomy );
3894
-					$term_array[ $term_id ] = $count;
3886
+			$post_type  = get_post_type($post_ID);
3887
+			$taxonomy   = $post_type.'category';
3888
+			$terms      = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3889
+
3890
+			if (!empty($terms) && !is_wp_error($terms)) {
3891
+				foreach ($terms as $term_id) {
3892
+					$count                  = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3893
+					$children               = get_term_children($term_id, $taxonomy);
3894
+					$term_array[$term_id] = $count;
3895 3895
 				}
3896 3896
 			}
3897 3897
 
3898
-			$session_listing = $gd_session->get( 'listing' );
3898
+			$session_listing = $gd_session->get('listing');
3899 3899
 
3900 3900
 			$terms = array();
3901
-			if ( isset( $_POST['post_category'][ $taxonomy ] ) ) {
3902
-				$terms = (array) $_POST['post_category'][ $taxonomy ];
3903
-			} else if ( ! empty( $session_listing ) && isset( $session_listing['post_category'][ $taxonomy ] ) ) {
3904
-				$terms = (array) $session_listing['post_category'][ $taxonomy ];
3901
+			if (isset($_POST['post_category'][$taxonomy])) {
3902
+				$terms = (array) $_POST['post_category'][$taxonomy];
3903
+			} else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
3904
+				$terms = (array) $session_listing['post_category'][$taxonomy];
3905 3905
 			}
3906 3906
 
3907
-			if ( ! empty( $terms ) ) {
3908
-				foreach ( $terms as $term_id ) {
3909
-					if ( $term_id > 0 ) {
3910
-						$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3911
-						$children               = get_term_children( $term_id, $taxonomy );
3912
-						$term_array[ $term_id ] = $count;
3907
+			if (!empty($terms)) {
3908
+				foreach ($terms as $term_id) {
3909
+					if ($term_id > 0) {
3910
+						$count                  = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3911
+						$children               = get_term_children($term_id, $taxonomy);
3912
+						$term_array[$term_id] = $count;
3913 3913
 					}
3914 3914
 				}
3915 3915
 			}
3916 3916
 		} else { // Update reviews count for all post categories.
3917 3917
 			$term_array = array();
3918 3918
 			$post_types = geodir_get_posttypes();
3919
-			foreach ( $post_types as $post_type ) {
3919
+			foreach ($post_types as $post_type) {
3920 3920
 
3921
-				$taxonomy = geodir_get_taxonomies( $post_type );
3921
+				$taxonomy = geodir_get_taxonomies($post_type);
3922 3922
 				$taxonomy = $taxonomy[0];
3923 3923
 
3924 3924
 				$args = array(
3925 3925
 					'hide_empty' => false
3926 3926
 				);
3927 3927
 
3928
-				$terms = get_terms( $taxonomy, $args );
3928
+				$terms = get_terms($taxonomy, $args);
3929 3929
 
3930
-				foreach ( $terms as $term ) {
3931
-					$count    = geodir_count_reviews_by_term_id( $term->term_id, $taxonomy, $post_type );
3932
-					$children = get_term_children( $term->term_id, $taxonomy );
3930
+				foreach ($terms as $term) {
3931
+					$count    = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3932
+					$children = get_term_children($term->term_id, $taxonomy);
3933 3933
 					/*if ( is_array( $children ) ) {
3934 3934
                         foreach ( $children as $child_id ) {
3935 3935
                             $child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type);
3936 3936
                             $count = $count + $child_count;
3937 3937
                         }
3938 3938
                     }*/
3939
-					$term_array[ $term->term_id ] = $count;
3939
+					$term_array[$term->term_id] = $count;
3940 3940
 				}
3941 3941
 			}
3942 3942
 		}
3943 3943
 
3944
-		update_option( 'geodir_global_review_count', $term_array );
3944
+		update_option('geodir_global_review_count', $term_array);
3945 3945
 		//clear cache
3946
-		wp_cache_delete( 'geodir_global_review_count' );
3946
+		wp_cache_delete('geodir_global_review_count');
3947 3947
 
3948 3948
 		return $term_array;
3949 3949
 	} else {
@@ -3959,39 +3959,39 @@  discard block
 block discarded – undo
3959 3959
  * @package GeoDirectory
3960 3960
  * @return bool
3961 3961
  */
3962
-function geodir_term_review_count_force_update( $new_status, $old_status = '', $post = '' ) {
3963
-	if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'geodir_import_export' ) {
3962
+function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '') {
3963
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {
3964 3964
 		return; // do not run if importing listings
3965 3965
 	}
3966 3966
 
3967
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
3967
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
3968 3968
 		return;
3969 3969
 	}
3970 3970
 
3971 3971
 	$post_ID = 0;
3972
-	if ( ! empty( $post ) ) {
3973
-		if ( isset( $post->post_type ) && strpos( $post->post_type, 'gd_' ) !== 0 ) {
3972
+	if (!empty($post)) {
3973
+		if (isset($post->post_type) && strpos($post->post_type, 'gd_') !== 0) {
3974 3974
 			return;
3975 3975
 		}
3976 3976
 
3977
-		if ( $new_status == 'auto-draft' && $old_status == 'new' ) {
3977
+		if ($new_status == 'auto-draft' && $old_status == 'new') {
3978 3978
 			return;
3979 3979
 		}
3980 3980
 
3981
-		if ( ! empty( $post->ID ) ) {
3981
+		if (!empty($post->ID)) {
3982 3982
 			$post_ID = $post->ID;
3983 3983
 		}
3984 3984
 	}
3985 3985
 
3986
-	if ( $new_status != $old_status ) {
3987
-		geodir_count_reviews_by_terms( true, $post_ID );
3986
+	if ($new_status != $old_status) {
3987
+		geodir_count_reviews_by_terms(true, $post_ID);
3988 3988
 	}
3989 3989
 
3990 3990
 	return true;
3991 3991
 }
3992 3992
 
3993
-function geodir_term_review_count_force_update_single_post( $post_id ) {
3994
-	geodir_count_reviews_by_terms( true, $post_id );
3993
+function geodir_term_review_count_force_update_single_post($post_id) {
3994
+	geodir_count_reviews_by_terms(true, $post_id);
3995 3995
 }
3996 3996
 
3997 3997
 /*-----------------------------------------------------------------------------------*/
@@ -4008,11 +4008,11 @@  discard block
 block discarded – undo
4008 4008
  *
4009 4009
  * @return int Post count.
4010 4010
  */
4011
-function geodir_count_posts_by_term( $data, $term ) {
4011
+function geodir_count_posts_by_term($data, $term) {
4012 4012
 
4013
-	if ( $data ) {
4014
-		if ( isset( $data[ $term->term_id ] ) ) {
4015
-			return $data[ $term->term_id ];
4013
+	if ($data) {
4014
+		if (isset($data[$term->term_id])) {
4015
+			return $data[$term->term_id];
4016 4016
 		} else {
4017 4017
 			return 0;
4018 4018
 		}
@@ -4029,8 +4029,8 @@  discard block
 block discarded – undo
4029 4029
  * param array $terms An array of term objects.
4030 4030
  * @return array Sorted terms array.
4031 4031
  */
4032
-function geodir_sort_terms_by_count( $terms ) {
4033
-	usort( $terms, "geodir_sort_by_count_obj" );
4032
+function geodir_sort_terms_by_count($terms) {
4033
+	usort($terms, "geodir_sort_by_count_obj");
4034 4034
 
4035 4035
 	return $terms;
4036 4036
 }
@@ -4045,8 +4045,8 @@  discard block
 block discarded – undo
4045 4045
  *
4046 4046
  * @return array Sorted terms array.
4047 4047
  */
4048
-function geodir_sort_terms_by_review_count( $terms ) {
4049
-	usort( $terms, "geodir_sort_by_review_count_obj" );
4048
+function geodir_sort_terms_by_review_count($terms) {
4049
+	usort($terms, "geodir_sort_by_review_count_obj");
4050 4050
 
4051 4051
 	return $terms;
4052 4052
 }
@@ -4062,12 +4062,12 @@  discard block
 block discarded – undo
4062 4062
  *
4063 4063
  * @return array Sorted terms array.
4064 4064
  */
4065
-function geodir_sort_terms( $terms, $sort = 'count' ) {
4066
-	if ( $sort == 'count' ) {
4067
-		return geodir_sort_terms_by_count( $terms );
4065
+function geodir_sort_terms($terms, $sort = 'count') {
4066
+	if ($sort == 'count') {
4067
+		return geodir_sort_terms_by_count($terms);
4068 4068
 	}
4069
-	if ( $sort == 'review_count' ) {
4070
-		return geodir_sort_terms_by_review_count( $terms );
4069
+	if ($sort == 'review_count') {
4070
+		return geodir_sort_terms_by_review_count($terms);
4071 4071
 	}
4072 4072
 }
4073 4073
 
@@ -4085,7 +4085,7 @@  discard block
 block discarded – undo
4085 4085
  *
4086 4086
  * @return bool
4087 4087
  */
4088
-function geodir_sort_by_count( $a, $b ) {
4088
+function geodir_sort_by_count($a, $b) {
4089 4089
 	return $a['count'] < $b['count'];
4090 4090
 }
4091 4091
 
@@ -4100,7 +4100,7 @@  discard block
 block discarded – undo
4100 4100
  *
4101 4101
  * @return bool
4102 4102
  */
4103
-function geodir_sort_by_count_obj( $a, $b ) {
4103
+function geodir_sort_by_count_obj($a, $b) {
4104 4104
 	return $a->count < $b->count;
4105 4105
 }
4106 4106
 
@@ -4115,7 +4115,7 @@  discard block
 block discarded – undo
4115 4115
  *
4116 4116
  * @return bool
4117 4117
  */
4118
-function geodir_sort_by_review_count_obj( $a, $b ) {
4118
+function geodir_sort_by_review_count_obj($a, $b) {
4119 4119
 	return $a->review_count < $b->review_count;
4120 4120
 }
4121 4121
 
@@ -4132,35 +4132,35 @@  discard block
 block discarded – undo
4132 4132
 	 * @since   1.4.2
4133 4133
 	 * @package GeoDirectory
4134 4134
 	 */
4135
-	$locale = apply_filters( 'plugin_locale', get_locale(), 'geodirectory' );
4135
+	$locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
4136 4136
 
4137
-	load_textdomain( 'geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo' );
4138
-	load_plugin_textdomain( 'geodirectory', false, plugin_basename( dirname( dirname( __FILE__ ) ) ) . '/geodirectory-languages' );
4137
+	load_textdomain('geodirectory', WP_LANG_DIR.'/'.'geodirectory'.'/'.'geodirectory'.'-'.$locale.'.mo');
4138
+	load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))).'/geodirectory-languages');
4139 4139
 
4140 4140
 	/**
4141 4141
 	 * Define language constants.
4142 4142
 	 *
4143 4143
 	 * @since 1.0.0
4144 4144
 	 */
4145
-	require_once( geodir_plugin_path() . '/language.php' );
4145
+	require_once(geodir_plugin_path().'/language.php');
4146 4146
 
4147
-	$language_file = geodir_plugin_path() . '/db-language.php';
4147
+	$language_file = geodir_plugin_path().'/db-language.php';
4148 4148
 
4149 4149
 	// Load language string file if not created yet
4150
-	if ( ! file_exists( $language_file ) ) {
4150
+	if (!file_exists($language_file)) {
4151 4151
 		geodirectory_load_db_language();
4152 4152
 	}
4153 4153
 
4154
-	if ( file_exists( $language_file ) ) {
4154
+	if (file_exists($language_file)) {
4155 4155
 		/**
4156 4156
 		 * Language strings from database.
4157 4157
 		 *
4158 4158
 		 * @since 1.4.2
4159 4159
 		 */
4160 4160
 		try {
4161
-			require_once( $language_file );
4162
-		} catch ( Exception $e ) {
4163
-			error_log( 'Language Error: ' . $e->getMessage() );
4161
+			require_once($language_file);
4162
+		} catch (Exception $e) {
4163
+			error_log('Language Error: '.$e->getMessage());
4164 4164
 		}
4165 4165
 	}
4166 4166
 }
@@ -4177,19 +4177,19 @@  discard block
 block discarded – undo
4177 4177
  */
4178 4178
 function geodirectory_load_db_language() {
4179 4179
 	global $wp_filesystem;
4180
-	if ( empty( $wp_filesystem ) ) {
4181
-		require_once( ABSPATH . '/wp-admin/includes/file.php' );
4180
+	if (empty($wp_filesystem)) {
4181
+		require_once(ABSPATH.'/wp-admin/includes/file.php');
4182 4182
 		WP_Filesystem();
4183 4183
 		global $wp_filesystem;
4184 4184
 	}
4185 4185
 
4186
-	$language_file = geodir_plugin_path() . '/db-language.php';
4186
+	$language_file = geodir_plugin_path().'/db-language.php';
4187 4187
 
4188
-	if ( is_file( $language_file ) && ! is_writable( $language_file ) ) {
4188
+	if (is_file($language_file) && !is_writable($language_file)) {
4189 4189
 		return false;
4190 4190
 	} // Not possible to create.
4191 4191
 
4192
-	if ( ! is_file( $language_file ) && ! is_writable( dirname( $language_file ) ) ) {
4192
+	if (!is_file($language_file) && !is_writable(dirname($language_file))) {
4193 4193
 		return false;
4194 4194
 	} // Not possible to create.
4195 4195
 
@@ -4203,9 +4203,9 @@  discard block
 block discarded – undo
4203 4203
 	 *
4204 4204
 	 * @param array $contents_strings Array of strings.
4205 4205
 	 */
4206
-	$contents_strings = apply_filters( 'geodir_load_db_language', $contents_strings );
4206
+	$contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
4207 4207
 
4208
-	$contents_strings = array_unique( $contents_strings );
4208
+	$contents_strings = array_unique($contents_strings);
4209 4209
 
4210 4210
 	$contents_head   = array();
4211 4211
 	$contents_head[] = "<?php";
@@ -4222,21 +4222,21 @@  discard block
 block discarded – undo
4222 4222
 	$contents_foot[] = "";
4223 4223
 	$contents_foot[] = "";
4224 4224
 
4225
-	$contents = implode( PHP_EOL, $contents_head );
4225
+	$contents = implode(PHP_EOL, $contents_head);
4226 4226
 
4227
-	if ( ! empty( $contents_strings ) ) {
4228
-		foreach ( $contents_strings as $string ) {
4229
-			if ( is_scalar( $string ) && $string != '' ) {
4230
-				$string = str_replace( "'", "\'", $string );
4231
-				geodir_wpml_register_string( $string );
4232
-				$contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
4227
+	if (!empty($contents_strings)) {
4228
+		foreach ($contents_strings as $string) {
4229
+			if (is_scalar($string) && $string != '') {
4230
+				$string = str_replace("'", "\'", $string);
4231
+				geodir_wpml_register_string($string);
4232
+				$contents .= PHP_EOL."__('".$string."', 'geodirectory');";
4233 4233
 			}
4234 4234
 		}
4235 4235
 	}
4236 4236
 
4237
-	$contents .= implode( PHP_EOL, $contents_foot );
4237
+	$contents .= implode(PHP_EOL, $contents_foot);
4238 4238
 
4239
-	if ( $wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE ) ) {
4239
+	if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE)) {
4240 4240
 		return false;
4241 4241
 	} // Failure; could not write file.
4242 4242
 
@@ -4257,49 +4257,49 @@  discard block
 block discarded – undo
4257 4257
  *
4258 4258
  * @return array Translation texts.
4259 4259
  */
4260
-function geodir_load_custom_field_translation( $translation_texts = array() ) {
4260
+function geodir_load_custom_field_translation($translation_texts = array()) {
4261 4261
 	global $wpdb;
4262 4262
 
4263 4263
 	// Custom fields table
4264
-	$sql  = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values, validation_msg FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
4265
-	$rows = $wpdb->get_results( $sql );
4264
+	$sql  = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values, validation_msg FROM ".GEODIR_CUSTOM_FIELDS_TABLE;
4265
+	$rows = $wpdb->get_results($sql);
4266 4266
 
4267
-	if ( ! empty( $rows ) ) {
4268
-		foreach ( $rows as $row ) {
4269
-			if ( ! empty( $row->admin_title ) ) {
4270
-				$translation_texts[] = stripslashes_deep( $row->admin_title );
4267
+	if (!empty($rows)) {
4268
+		foreach ($rows as $row) {
4269
+			if (!empty($row->admin_title)) {
4270
+				$translation_texts[] = stripslashes_deep($row->admin_title);
4271 4271
 			}
4272 4272
 
4273
-			if ( ! empty( $row->admin_desc ) ) {
4274
-				$translation_texts[] = stripslashes_deep( $row->admin_desc );
4273
+			if (!empty($row->admin_desc)) {
4274
+				$translation_texts[] = stripslashes_deep($row->admin_desc);
4275 4275
 			}
4276 4276
 
4277
-			if ( ! empty( $row->site_title ) ) {
4278
-				$translation_texts[] = stripslashes_deep( $row->site_title );
4277
+			if (!empty($row->site_title)) {
4278
+				$translation_texts[] = stripslashes_deep($row->site_title);
4279 4279
 			}
4280 4280
 
4281
-			if ( ! empty( $row->clabels ) ) {
4282
-				$translation_texts[] = stripslashes_deep( $row->clabels );
4281
+			if (!empty($row->clabels)) {
4282
+				$translation_texts[] = stripslashes_deep($row->clabels);
4283 4283
 			}
4284 4284
 
4285
-			if ( ! empty( $row->required_msg ) ) {
4286
-				$translation_texts[] = stripslashes_deep( $row->required_msg );
4285
+			if (!empty($row->required_msg)) {
4286
+				$translation_texts[] = stripslashes_deep($row->required_msg);
4287 4287
 			}
4288 4288
             
4289
-			if ( ! empty( $row->validation_msg ) ) {
4290
-				$translation_texts[] = stripslashes_deep( $row->validation_msg );
4289
+			if (!empty($row->validation_msg)) {
4290
+				$translation_texts[] = stripslashes_deep($row->validation_msg);
4291 4291
 			}
4292 4292
 
4293
-			if ( ! empty( $row->default_value ) ) {
4294
-				$translation_texts[] = stripslashes_deep( $row->default_value );
4293
+			if (!empty($row->default_value)) {
4294
+				$translation_texts[] = stripslashes_deep($row->default_value);
4295 4295
 			}
4296 4296
 
4297
-			if ( ! empty( $row->option_values ) ) {
4298
-				$option_values = geodir_string_values_to_options( stripslashes_deep( $row->option_values ) );
4297
+			if (!empty($row->option_values)) {
4298
+				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
4299 4299
 
4300
-				if ( ! empty( $option_values ) ) {
4301
-					foreach ( $option_values as $option_value ) {
4302
-						if ( ! empty( $option_value['label'] ) ) {
4300
+				if (!empty($option_values)) {
4301
+					foreach ($option_values as $option_value) {
4302
+						if (!empty($option_value['label'])) {
4303 4303
 							$translation_texts[] = $option_value['label'];
4304 4304
 						}
4305 4305
 					}
@@ -4309,56 +4309,56 @@  discard block
 block discarded – undo
4309 4309
 	}
4310 4310
 
4311 4311
 	// Custom sorting fields table
4312
-	$sql  = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
4313
-	$rows = $wpdb->get_results( $sql );
4312
+	$sql  = "SELECT site_title, asc_title, desc_title FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE;
4313
+	$rows = $wpdb->get_results($sql);
4314 4314
 
4315
-	if ( ! empty( $rows ) ) {
4316
-		foreach ( $rows as $row ) {
4317
-			if ( ! empty( $row->site_title ) ) {
4318
-				$translation_texts[] = stripslashes_deep( $row->site_title );
4315
+	if (!empty($rows)) {
4316
+		foreach ($rows as $row) {
4317
+			if (!empty($row->site_title)) {
4318
+				$translation_texts[] = stripslashes_deep($row->site_title);
4319 4319
 			}
4320 4320
 
4321
-			if ( ! empty( $row->asc_title ) ) {
4322
-				$translation_texts[] = stripslashes_deep( $row->asc_title );
4321
+			if (!empty($row->asc_title)) {
4322
+				$translation_texts[] = stripslashes_deep($row->asc_title);
4323 4323
 			}
4324 4324
 
4325
-			if ( ! empty( $row->desc_title ) ) {
4326
-				$translation_texts[] = stripslashes_deep( $row->desc_title );
4325
+			if (!empty($row->desc_title)) {
4326
+				$translation_texts[] = stripslashes_deep($row->desc_title);
4327 4327
 			}
4328 4328
 		}
4329 4329
 	}
4330 4330
 
4331 4331
 	// Advance search filter fields table
4332
-	if ( defined( 'GEODIR_ADVANCE_SEARCH_TABLE' ) ) {
4333
-		$sql  = "SELECT field_site_name, front_search_title, first_search_text, last_search_text, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE;
4334
-		$rows = $wpdb->get_results( $sql );
4335
-
4336
-		if ( ! empty( $rows ) ) {
4337
-			foreach ( $rows as $row ) {
4338
-				if ( ! empty( $row->field_site_name ) ) {
4339
-					$translation_texts[] = stripslashes_deep( $row->field_site_name );
4332
+	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
4333
+		$sql  = "SELECT field_site_name, front_search_title, first_search_text, last_search_text, field_desc FROM ".GEODIR_ADVANCE_SEARCH_TABLE;
4334
+		$rows = $wpdb->get_results($sql);
4335
+
4336
+		if (!empty($rows)) {
4337
+			foreach ($rows as $row) {
4338
+				if (!empty($row->field_site_name)) {
4339
+					$translation_texts[] = stripslashes_deep($row->field_site_name);
4340 4340
 				}
4341 4341
 
4342
-				if ( ! empty( $row->front_search_title ) ) {
4343
-					$translation_texts[] = stripslashes_deep( $row->front_search_title );
4342
+				if (!empty($row->front_search_title)) {
4343
+					$translation_texts[] = stripslashes_deep($row->front_search_title);
4344 4344
 				}
4345 4345
 
4346
-				if ( ! empty( $row->first_search_text ) ) {
4347
-					$translation_texts[] = stripslashes_deep( $row->first_search_text );
4346
+				if (!empty($row->first_search_text)) {
4347
+					$translation_texts[] = stripslashes_deep($row->first_search_text);
4348 4348
 				}
4349 4349
 
4350
-				if ( ! empty( $row->last_search_text ) ) {
4351
-					$translation_texts[] = stripslashes_deep( $row->last_search_text );
4350
+				if (!empty($row->last_search_text)) {
4351
+					$translation_texts[] = stripslashes_deep($row->last_search_text);
4352 4352
 				}
4353 4353
 
4354
-				if ( ! empty( $row->field_desc ) ) {
4355
-					$translation_texts[] = stripslashes_deep( $row->field_desc );
4354
+				if (!empty($row->field_desc)) {
4355
+					$translation_texts[] = stripslashes_deep($row->field_desc);
4356 4356
 				}
4357 4357
 			}
4358 4358
 		}
4359 4359
 	}
4360 4360
 
4361
-	$translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts;
4361
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4362 4362
 
4363 4363
 	return $translation_texts;
4364 4364
 }
@@ -4380,7 +4380,7 @@  discard block
 block discarded – undo
4380 4380
 	 *
4381 4381
 	 * @param array $geodir_allowed_mime_types and file extensions.
4382 4382
 	 */
4383
-	return apply_filters( 'geodir_allowed_mime_types', array(
4383
+	return apply_filters('geodir_allowed_mime_types', array(
4384 4384
 			'Image'       => array( // Image formats.
4385 4385
 				'jpg'  => 'image/jpeg',
4386 4386
 				'jpe'  => 'image/jpeg',
@@ -4448,18 +4448,18 @@  discard block
 block discarded – undo
4448 4448
  *
4449 4449
  * @return string User display name.
4450 4450
  */
4451
-function geodir_get_client_name( $user_id ) {
4451
+function geodir_get_client_name($user_id) {
4452 4452
 	$client_name = '';
4453 4453
 
4454
-	$user_data = get_userdata( $user_id );
4454
+	$user_data = get_userdata($user_id);
4455 4455
 
4456
-	if ( ! empty( $user_data ) ) {
4457
-		if ( isset( $user_data->display_name ) && trim( $user_data->display_name ) != '' ) {
4458
-			$client_name = trim( $user_data->display_name );
4459
-		} else if ( isset( $user_data->user_nicename ) && trim( $user_data->user_nicename ) != '' ) {
4460
-			$client_name = trim( $user_data->user_nicename );
4456
+	if (!empty($user_data)) {
4457
+		if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
4458
+			$client_name = trim($user_data->display_name);
4459
+		} else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
4460
+			$client_name = trim($user_data->user_nicename);
4461 4461
 		} else {
4462
-			$client_name = trim( $user_data->user_login );
4462
+			$client_name = trim($user_data->user_login);
4463 4463
 		}
4464 4464
 	}
4465 4465
 
@@ -4467,19 +4467,19 @@  discard block
 block discarded – undo
4467 4467
 }
4468 4468
 
4469 4469
 
4470
-add_filter( 'wpseo_replacements', 'geodir_wpseo_replacements', 10, 1 );
4470
+add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
4471 4471
 /*
4472 4472
  * Add location variables to wpseo replacements.
4473 4473
  *
4474 4474
  * @since 1.5.4
4475 4475
  */
4476
-function geodir_wpseo_replacements( $vars ) {
4476
+function geodir_wpseo_replacements($vars) {
4477 4477
 
4478 4478
 	global $wp;
4479 4479
 	$title = '';
4480 4480
 	// location variables
4481 4481
 	$gd_post_type   = geodir_get_current_posttype();
4482
-	$location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
4482
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4483 4483
 	/**
4484 4484
 	 * Filter the title variables location variables array
4485 4485
 	 *
@@ -4489,20 +4489,20 @@  discard block
 block discarded – undo
4489 4489
 	 * @param array $location_array The array of location variables.
4490 4490
 	 * @param array $vars           The page title variables.
4491 4491
 	 */
4492
-	$location_array  = apply_filters( 'geodir_filter_title_variables_location_arr_seo', $location_array, $vars );
4492
+	$location_array  = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
4493 4493
 	$location_titles = array();
4494
-	if ( get_query_var( 'gd_country_full' ) ) {
4495
-		if ( get_query_var( 'gd_country_full' ) ) {
4496
-			$location_array['gd_country'] = get_query_var( 'gd_country_full' );
4494
+	if (get_query_var('gd_country_full')) {
4495
+		if (get_query_var('gd_country_full')) {
4496
+			$location_array['gd_country'] = get_query_var('gd_country_full');
4497 4497
 		}
4498
-		if ( get_query_var( 'gd_region_full' ) ) {
4499
-			$location_array['gd_region'] = get_query_var( 'gd_region_full' );
4498
+		if (get_query_var('gd_region_full')) {
4499
+			$location_array['gd_region'] = get_query_var('gd_region_full');
4500 4500
 		}
4501
-		if ( get_query_var( 'gd_city_full' ) ) {
4502
-			$location_array['gd_city'] = get_query_var( 'gd_city_full' );
4501
+		if (get_query_var('gd_city_full')) {
4502
+			$location_array['gd_city'] = get_query_var('gd_city_full');
4503 4503
 		}
4504
-		if ( get_query_var( 'gd_neighbourhood_full' ) ) {
4505
-			$location_array['gd_neighbourhood'] = get_query_var( 'gd_neighbourhood_full' );
4504
+		if (get_query_var('gd_neighbourhood_full')) {
4505
+			$location_array['gd_neighbourhood'] = get_query_var('gd_neighbourhood_full');
4506 4506
 		}
4507 4507
 	}
4508 4508
 	
@@ -4517,7 +4517,7 @@  discard block
 block discarded – undo
4517 4517
 	 * @param string $gd_page       The page being filtered.
4518 4518
 	 * @param string $sep           The separator, default: `|`.
4519 4519
 	 */
4520
-	$title = apply_filters( 'geodir_replace_location_variables_seo', $title, $location_array, '', '' );
4520
+	$title = apply_filters('geodir_replace_location_variables_seo', $title, $location_array, '', '');
4521 4521
 
4522 4522
 	/**
4523 4523
 	 * Filter the title variables after standard ones have been filtered for wpseo.
@@ -4528,13 +4528,13 @@  discard block
 block discarded – undo
4528 4528
 	 * @param string $vars          The title with variables.
4529 4529
 	 * @param array $location_array The array of location variables.
4530 4530
 	 */
4531
-	return apply_filters( 'geodir_wpseo_replacements_vars', $vars, $location_array );
4531
+	return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
4532 4532
 }
4533 4533
 
4534 4534
 
4535
-add_filter( 'geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3 );
4536
-add_filter( 'geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2 );
4537
-add_filter( 'geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3 );
4535
+add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
4536
+add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
4537
+add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
4538 4538
 
4539 4539
 /**
4540 4540
  * Filter the title variables.
@@ -4576,14 +4576,14 @@  discard block
 block discarded – undo
4576 4576
  *
4577 4577
  * @return string Title after filtered variables.
4578 4578
  */
4579
-function geodir_filter_title_variables( $title, $gd_page, $sep = '' ) {
4579
+function geodir_filter_title_variables($title, $gd_page, $sep = '') {
4580 4580
 	global $wp, $post;
4581 4581
 
4582
-	if ( ! $gd_page || ! $title ) {
4582
+	if (!$gd_page || !$title) {
4583 4583
 		return $title; // if no a GD page then bail.
4584 4584
 	}
4585 4585
 
4586
-	if ( $sep == '' ) {
4586
+	if ($sep == '') {
4587 4587
 		/**
4588 4588
 		 * Filter the page title separator.
4589 4589
 		 *
@@ -4592,100 +4592,100 @@  discard block
 block discarded – undo
4592 4592
 		 *
4593 4593
 		 * @param string $sep The separator, default: `|`.
4594 4594
 		 */
4595
-		$sep = apply_filters( 'geodir_page_title_separator', '|' );
4595
+		$sep = apply_filters('geodir_page_title_separator', '|');
4596 4596
 	}
4597 4597
 
4598
-	if ( strpos( $title, '%%title%%' ) !== false ) {
4599
-		$title = str_replace( "%%title%%", $post->post_title, $title );
4598
+	if (strpos($title, '%%title%%') !== false) {
4599
+		$title = str_replace("%%title%%", $post->post_title, $title);
4600 4600
 	}
4601 4601
 
4602
-	if ( strpos( $title, '%%sitename%%' ) !== false ) {
4603
-		$title = str_replace( "%%sitename%%", get_bloginfo( 'name' ), $title );
4602
+	if (strpos($title, '%%sitename%%') !== false) {
4603
+		$title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
4604 4604
 	}
4605 4605
 
4606
-	if ( strpos( $title, '%%sitedesc%%' ) !== false ) {
4607
-		$title = str_replace( "%%sitedesc%%", get_bloginfo( 'description' ), $title );
4606
+	if (strpos($title, '%%sitedesc%%') !== false) {
4607
+		$title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
4608 4608
 	}
4609 4609
 
4610
-	if ( strpos( $title, '%%excerpt%%' ) !== false ) {
4611
-		$title = str_replace( "%%excerpt%%", strip_tags( get_the_excerpt() ), $title );
4610
+	if (strpos($title, '%%excerpt%%') !== false) {
4611
+		$title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
4612 4612
 	}
4613 4613
 
4614
-	if ( $gd_page == 'search' || $gd_page == 'author' ) {
4615
-		$post_type = isset( $_REQUEST['stype'] ) ? sanitize_text_field( $_REQUEST['stype'] ) : '';
4616
-	} else if ( $gd_page == 'add-listing' ) {
4617
-		$post_type = ( isset( $_REQUEST['listing_type'] ) ) ? sanitize_text_field( $_REQUEST['listing_type'] ) : '';
4618
-		$post_type = ! $post_type && ! empty( $_REQUEST['pid'] ) ? get_post_type( (int) $_REQUEST['pid'] ) : $post_type;
4619
-	} else if ( isset( $post->post_type ) && $post->post_type && in_array( $post->post_type, geodir_get_posttypes() ) ) {
4614
+	if ($gd_page == 'search' || $gd_page == 'author') {
4615
+		$post_type = isset($_REQUEST['stype']) ? sanitize_text_field($_REQUEST['stype']) : '';
4616
+	} else if ($gd_page == 'add-listing') {
4617
+		$post_type = (isset($_REQUEST['listing_type'])) ? sanitize_text_field($_REQUEST['listing_type']) : '';
4618
+		$post_type = !$post_type && !empty($_REQUEST['pid']) ? get_post_type((int) $_REQUEST['pid']) : $post_type;
4619
+	} else if (isset($post->post_type) && $post->post_type && in_array($post->post_type, geodir_get_posttypes())) {
4620 4620
 		$post_type = $post->post_type;
4621 4621
 	} else {
4622
-		$post_type = get_query_var( 'post_type' );
4622
+		$post_type = get_query_var('post_type');
4623 4623
 	}
4624 4624
 
4625
-	if ( strpos( $title, '%%pt_single%%' ) !== false ) {
4625
+	if (strpos($title, '%%pt_single%%') !== false) {
4626 4626
 		$singular_name = '';
4627
-		if ( $post_type && $singular_name = get_post_type_singular_label( $post_type ) ) {
4628
-			$singular_name = __( $singular_name, 'geodirectory' );
4627
+		if ($post_type && $singular_name = get_post_type_singular_label($post_type)) {
4628
+			$singular_name = __($singular_name, 'geodirectory');
4629 4629
 		}
4630 4630
 
4631
-		$title = str_replace( "%%pt_single%%", $singular_name, $title );
4631
+		$title = str_replace("%%pt_single%%", $singular_name, $title);
4632 4632
 	}
4633 4633
 
4634
-	if ( strpos( $title, '%%pt_plural%%' ) !== false ) {
4634
+	if (strpos($title, '%%pt_plural%%') !== false) {
4635 4635
 		$plural_name = '';
4636
-		if ( $post_type && $plural_name = get_post_type_plural_label( $post_type ) ) {
4637
-			$plural_name = __( $plural_name, 'geodirectory' );
4636
+		if ($post_type && $plural_name = get_post_type_plural_label($post_type)) {
4637
+			$plural_name = __($plural_name, 'geodirectory');
4638 4638
 		}
4639 4639
 
4640
-		$title = str_replace( "%%pt_plural%%", $plural_name, $title );
4640
+		$title = str_replace("%%pt_plural%%", $plural_name, $title);
4641 4641
 	}
4642 4642
 
4643
-	if ( strpos( $title, '%%category%%' ) !== false ) {
4643
+	if (strpos($title, '%%category%%') !== false) {
4644 4644
 		$cat_name = '';
4645 4645
 
4646
-		if ( $gd_page == 'detail' ) {
4647
-			if ( $post->default_category ) {
4648
-				$cat      = get_term( $post->default_category, $post->post_type . 'category' );
4649
-				$cat_name = ( isset( $cat->name ) ) ? $cat->name : '';
4646
+		if ($gd_page == 'detail') {
4647
+			if ($post->default_category) {
4648
+				$cat      = get_term($post->default_category, $post->post_type.'category');
4649
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4650 4650
 			}
4651
-		} else if ( $gd_page == 'listing' ) {
4651
+		} else if ($gd_page == 'listing') {
4652 4652
 			$queried_object = get_queried_object();
4653
-			if ( isset( $queried_object->name ) ) {
4653
+			if (isset($queried_object->name)) {
4654 4654
 				$cat_name = $queried_object->name;
4655 4655
 			}
4656 4656
 		}
4657
-		$title = str_replace( "%%category%%", $cat_name, $title );
4657
+		$title = str_replace("%%category%%", $cat_name, $title);
4658 4658
 	}
4659 4659
 
4660
-	if ( strpos( $title, '%%tag%%' ) !== false ) {
4660
+	if (strpos($title, '%%tag%%') !== false) {
4661 4661
 		$cat_name = '';
4662 4662
 
4663
-		if ( $gd_page == 'detail' ) {
4664
-			if ( $post->default_category ) {
4665
-				$cat      = get_term( $post->default_category, $post->post_type . 'category' );
4666
-				$cat_name = ( isset( $cat->name ) ) ? $cat->name : '';
4663
+		if ($gd_page == 'detail') {
4664
+			if ($post->default_category) {
4665
+				$cat      = get_term($post->default_category, $post->post_type.'category');
4666
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4667 4667
 			}
4668
-		} else if ( $gd_page == 'listing' ) {
4668
+		} else if ($gd_page == 'listing') {
4669 4669
 			$queried_object = get_queried_object();
4670
-			if ( isset( $queried_object->name ) ) {
4670
+			if (isset($queried_object->name)) {
4671 4671
 				$cat_name = $queried_object->name;
4672 4672
 			}
4673 4673
 		}
4674
-		$title = str_replace( "%%tag%%", $cat_name, $title );
4674
+		$title = str_replace("%%tag%%", $cat_name, $title);
4675 4675
 	}
4676 4676
 
4677
-	if ( strpos( $title, '%%id%%' ) !== false ) {
4678
-		$ID    = ( isset( $post->ID ) ) ? $post->ID : '';
4679
-		$title = str_replace( "%%id%%", $ID, $title );
4677
+	if (strpos($title, '%%id%%') !== false) {
4678
+		$ID    = (isset($post->ID)) ? $post->ID : '';
4679
+		$title = str_replace("%%id%%", $ID, $title);
4680 4680
 	}
4681 4681
 
4682
-	if ( strpos( $title, '%%sep%%' ) !== false ) {
4683
-		$title = str_replace( "%%sep%%", $sep, $title );
4682
+	if (strpos($title, '%%sep%%') !== false) {
4683
+		$title = str_replace("%%sep%%", $sep, $title);
4684 4684
 	}
4685 4685
 
4686 4686
 	// location variables
4687 4687
 	$gd_post_type   = geodir_get_current_posttype();
4688
-	$location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
4688
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4689 4689
 	
4690 4690
 	/**
4691 4691
 	 * Filter the title variables location variables array
@@ -4698,20 +4698,20 @@  discard block
 block discarded – undo
4698 4698
 	 * @param string $gd_page       The page being filtered.
4699 4699
 	 * @param string $sep           The separator, default: `|`.
4700 4700
 	 */
4701
-	$location_array  = apply_filters( 'geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep );
4701
+	$location_array = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
4702 4702
 	
4703
-	if ( $gd_page == 'location' && get_query_var( 'gd_country_full' ) ) {
4704
-		if ( get_query_var( 'gd_country_full' ) ) {
4705
-			$location_array['gd_country'] = get_query_var( 'gd_country_full' );
4703
+	if ($gd_page == 'location' && get_query_var('gd_country_full')) {
4704
+		if (get_query_var('gd_country_full')) {
4705
+			$location_array['gd_country'] = get_query_var('gd_country_full');
4706 4706
 		}
4707
-		if ( get_query_var( 'gd_region_full' ) ) {
4708
-			$location_array['gd_region'] = get_query_var( 'gd_region_full' );
4707
+		if (get_query_var('gd_region_full')) {
4708
+			$location_array['gd_region'] = get_query_var('gd_region_full');
4709 4709
 		}
4710
-		if ( get_query_var( 'gd_city_full' ) ) {
4711
-			$location_array['gd_city'] = get_query_var( 'gd_city_full' );
4710
+		if (get_query_var('gd_city_full')) {
4711
+			$location_array['gd_city'] = get_query_var('gd_city_full');
4712 4712
 		}
4713
-		if ( get_query_var( 'gd_neighbourhood_full' ) ) {
4714
-			$location_array['gd_neighbourhood'] = get_query_var( 'gd_neighbourhood_full' );
4713
+		if (get_query_var('gd_neighbourhood_full')) {
4714
+			$location_array['gd_neighbourhood'] = get_query_var('gd_neighbourhood_full');
4715 4715
 		}
4716 4716
 	}
4717 4717
 	
@@ -4726,57 +4726,57 @@  discard block
 block discarded – undo
4726 4726
 	 * @param string $gd_page       The page being filtered.
4727 4727
 	 * @param string $sep           The separator, default: `|`.
4728 4728
 	 */
4729
-	$title = apply_filters( 'geodir_replace_location_variables', $title, $location_array, $gd_page, $sep );
4729
+	$title = apply_filters('geodir_replace_location_variables', $title, $location_array, $gd_page, $sep);
4730 4730
 	
4731
-	if ( strpos( $title, '%%search_term%%' ) !== false ) {
4731
+	if (strpos($title, '%%search_term%%') !== false) {
4732 4732
 		$search_term = '';
4733
-		if ( isset( $_REQUEST['s'] ) ) {
4734
-			$search_term = esc_attr( $_REQUEST['s'] );
4733
+		if (isset($_REQUEST['s'])) {
4734
+			$search_term = esc_attr($_REQUEST['s']);
4735 4735
 		}
4736
-		$title = str_replace( "%%search_term%%", $search_term, $title );
4736
+		$title = str_replace("%%search_term%%", $search_term, $title);
4737 4737
 	}
4738 4738
 
4739
-	if ( strpos( $title, '%%search_near%%' ) !== false ) {
4739
+	if (strpos($title, '%%search_near%%') !== false) {
4740 4740
 		$search_term = '';
4741
-		if ( isset( $_REQUEST['snear'] ) ) {
4742
-			$search_term = esc_attr( $_REQUEST['snear'] );
4741
+		if (isset($_REQUEST['snear'])) {
4742
+			$search_term = esc_attr($_REQUEST['snear']);
4743 4743
 		}
4744
-		$title = str_replace( "%%search_near%%", $search_term, $title );
4744
+		$title = str_replace("%%search_near%%", $search_term, $title);
4745 4745
 	}
4746 4746
 
4747
-	if ( strpos( $title, '%%name%%' ) !== false ) {
4748
-		if ( is_author() ) {
4749
-			$curauth     = ( get_query_var( 'author_name' ) ) ? get_user_by( 'slug', get_query_var( 'author_name' ) ) : get_userdata( get_query_var( 'author' ) );
4747
+	if (strpos($title, '%%name%%') !== false) {
4748
+		if (is_author()) {
4749
+			$curauth     = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
4750 4750
 			$author_name = $curauth->display_name;
4751 4751
 		} else {
4752 4752
 			$author_name = get_the_author();
4753 4753
 		}
4754
-		if ( ! $author_name || $author_name === '' ) {
4754
+		if (!$author_name || $author_name === '') {
4755 4755
 			$queried_object = get_queried_object();
4756 4756
 
4757
-			if ( isset( $queried_object->data->user_nicename ) ) {
4757
+			if (isset($queried_object->data->user_nicename)) {
4758 4758
 				$author_name = $queried_object->data->display_name;
4759 4759
 			}
4760 4760
 		}
4761
-		$title = str_replace( "%%name%%", $author_name, $title );
4761
+		$title = str_replace("%%name%%", $author_name, $title);
4762 4762
 	}
4763 4763
 
4764
-	if ( strpos( $title, '%%page%%' ) !== false ) {
4765
-		$page  = geodir_title_meta_page( $sep );
4766
-		$title = str_replace( "%%page%%", $page, $title );
4764
+	if (strpos($title, '%%page%%') !== false) {
4765
+		$page  = geodir_title_meta_page($sep);
4766
+		$title = str_replace("%%page%%", $page, $title);
4767 4767
 	}
4768
-	if ( strpos( $title, '%%pagenumber%%' ) !== false ) {
4768
+	if (strpos($title, '%%pagenumber%%') !== false) {
4769 4769
 		$pagenumber = geodir_title_meta_pagenumber();
4770
-		$title      = str_replace( "%%pagenumber%%", $pagenumber, $title );
4770
+		$title      = str_replace("%%pagenumber%%", $pagenumber, $title);
4771 4771
 	}
4772
-	if ( strpos( $title, '%%pagetotal%%' ) !== false ) {
4772
+	if (strpos($title, '%%pagetotal%%') !== false) {
4773 4773
 		$pagetotal = geodir_title_meta_pagetotal();
4774
-		$title     = str_replace( "%%pagetotal%%", $pagetotal, $title );
4774
+		$title     = str_replace("%%pagetotal%%", $pagetotal, $title);
4775 4775
 	}
4776 4776
 
4777
-	$title = wptexturize( $title );
4778
-	$title = convert_chars( $title );
4779
-	$title = esc_html( $title );
4777
+	$title = wptexturize($title);
4778
+	$title = convert_chars($title);
4779
+	$title = esc_html($title);
4780 4780
 
4781 4781
 	/**
4782 4782
 	 * Filter the title variables after standard ones have been filtered.
@@ -4790,7 +4790,7 @@  discard block
 block discarded – undo
4790 4790
 	 * @param string $sep           The separator, default: `|`.
4791 4791
 	 */
4792 4792
 
4793
-	return apply_filters( 'geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep );
4793
+	return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
4794 4794
 }
4795 4795
 
4796 4796
 /**
@@ -4803,82 +4803,82 @@  discard block
 block discarded – undo
4803 4803
  *
4804 4804
  * @return array Translation texts.
4805 4805
  */
4806
-function geodir_load_cpt_text_translation( $translation_texts = array() ) {
4807
-	$gd_post_types = geodir_get_posttypes( 'array' );
4806
+function geodir_load_cpt_text_translation($translation_texts = array()) {
4807
+	$gd_post_types = geodir_get_posttypes('array');
4808 4808
 
4809
-	if ( ! empty( $gd_post_types ) ) {
4810
-		foreach ( $gd_post_types as $post_type => $cpt_info ) {
4811
-			$labels      = isset( $cpt_info['labels'] ) ? $cpt_info['labels'] : '';
4812
-			$description = isset( $cpt_info['description'] ) ? $cpt_info['description'] : '';
4813
-			$seo         = isset( $cpt_info['seo'] ) ? $cpt_info['seo'] : '';
4809
+	if (!empty($gd_post_types)) {
4810
+		foreach ($gd_post_types as $post_type => $cpt_info) {
4811
+			$labels      = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4812
+			$description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4813
+			$seo         = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4814 4814
 
4815
-			if ( ! empty( $labels ) ) {
4816
-				if ( $labels['name'] != '' && ! in_array( $labels['name'], $translation_texts ) ) {
4815
+			if (!empty($labels)) {
4816
+				if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) {
4817 4817
 					$translation_texts[] = $labels['name'];
4818 4818
 				}
4819
-				if ( $labels['singular_name'] != '' && ! in_array( $labels['singular_name'], $translation_texts ) ) {
4819
+				if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) {
4820 4820
 					$translation_texts[] = $labels['singular_name'];
4821 4821
 				}
4822
-				if ( $labels['add_new'] != '' && ! in_array( $labels['add_new'], $translation_texts ) ) {
4822
+				if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) {
4823 4823
 					$translation_texts[] = $labels['add_new'];
4824 4824
 				}
4825
-				if ( $labels['add_new_item'] != '' && ! in_array( $labels['add_new_item'], $translation_texts ) ) {
4825
+				if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) {
4826 4826
 					$translation_texts[] = $labels['add_new_item'];
4827 4827
 				}
4828
-				if ( $labels['edit_item'] != '' && ! in_array( $labels['edit_item'], $translation_texts ) ) {
4828
+				if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) {
4829 4829
 					$translation_texts[] = $labels['edit_item'];
4830 4830
 				}
4831
-				if ( $labels['new_item'] != '' && ! in_array( $labels['new_item'], $translation_texts ) ) {
4831
+				if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) {
4832 4832
 					$translation_texts[] = $labels['new_item'];
4833 4833
 				}
4834
-				if ( $labels['view_item'] != '' && ! in_array( $labels['view_item'], $translation_texts ) ) {
4834
+				if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) {
4835 4835
 					$translation_texts[] = $labels['view_item'];
4836 4836
 				}
4837
-				if ( $labels['search_items'] != '' && ! in_array( $labels['search_items'], $translation_texts ) ) {
4837
+				if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) {
4838 4838
 					$translation_texts[] = $labels['search_items'];
4839 4839
 				}
4840
-				if ( $labels['not_found'] != '' && ! in_array( $labels['not_found'], $translation_texts ) ) {
4840
+				if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) {
4841 4841
 					$translation_texts[] = $labels['not_found'];
4842 4842
 				}
4843
-				if ( $labels['not_found_in_trash'] != '' && ! in_array( $labels['not_found_in_trash'], $translation_texts ) ) {
4843
+				if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) {
4844 4844
 					$translation_texts[] = $labels['not_found_in_trash'];
4845 4845
 				}
4846
-				if ( isset( $labels['label_post_profile'] ) && $labels['label_post_profile'] != '' && ! in_array( $labels['label_post_profile'], $translation_texts ) ) {
4846
+				if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) {
4847 4847
 					$translation_texts[] = $labels['label_post_profile'];
4848 4848
 				}
4849
-				if ( isset( $labels['label_post_info'] ) && $labels['label_post_info'] != '' && ! in_array( $labels['label_post_info'], $translation_texts ) ) {
4849
+				if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) {
4850 4850
 					$translation_texts[] = $labels['label_post_info'];
4851 4851
 				}
4852
-				if ( isset( $labels['label_post_images'] ) && $labels['label_post_images'] != '' && ! in_array( $labels['label_post_images'], $translation_texts ) ) {
4852
+				if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) {
4853 4853
 					$translation_texts[] = $labels['label_post_images'];
4854 4854
 				}
4855
-				if ( isset( $labels['label_post_map'] ) && $labels['label_post_map'] != '' && ! in_array( $labels['label_post_map'], $translation_texts ) ) {
4855
+				if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) {
4856 4856
 					$translation_texts[] = $labels['label_post_map'];
4857 4857
 				}
4858
-				if ( isset( $labels['label_reviews'] ) && $labels['label_reviews'] != '' && ! in_array( $labels['label_reviews'], $translation_texts ) ) {
4858
+				if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) {
4859 4859
 					$translation_texts[] = $labels['label_reviews'];
4860 4860
 				}
4861
-				if ( isset( $labels['label_related_listing'] ) && $labels['label_related_listing'] != '' && ! in_array( $labels['label_related_listing'], $translation_texts ) ) {
4861
+				if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) {
4862 4862
 					$translation_texts[] = $labels['label_related_listing'];
4863 4863
 				}
4864 4864
 			}
4865 4865
 
4866
-			if ( $description != '' && ! in_array( $description, $translation_texts ) ) {
4867
-				$translation_texts[] = normalize_whitespace( $description );
4866
+			if ($description != '' && !in_array($description, $translation_texts)) {
4867
+				$translation_texts[] = normalize_whitespace($description);
4868 4868
 			}
4869 4869
 
4870
-			if ( ! empty( $seo ) ) {
4871
-				if ( isset( $seo['meta_keyword'] ) && $seo['meta_keyword'] != '' && ! in_array( $seo['meta_keyword'], $translation_texts ) ) {
4872
-					$translation_texts[] = normalize_whitespace( $seo['meta_keyword'] );
4870
+			if (!empty($seo)) {
4871
+				if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) {
4872
+					$translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4873 4873
 				}
4874 4874
 
4875
-				if ( isset( $seo['meta_description'] ) && $seo['meta_description'] != '' && ! in_array( $seo['meta_description'], $translation_texts ) ) {
4876
-					$translation_texts[] = normalize_whitespace( $seo['meta_description'] );
4875
+				if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) {
4876
+					$translation_texts[] = normalize_whitespace($seo['meta_description']);
4877 4877
 				}
4878 4878
 			}
4879 4879
 		}
4880 4880
 	}
4881
-	$translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts;
4881
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4882 4882
 
4883 4883
 	return $translation_texts;
4884 4884
 }
@@ -4893,27 +4893,27 @@  discard block
 block discarded – undo
4893 4893
  *
4894 4894
  * @return array Location terms.
4895 4895
  */
4896
-function geodir_remove_location_terms( $location_terms = array() ) {
4897
-	$location_manager = defined( 'POST_LOCATION_TABLE' ) ? true : false;
4896
+function geodir_remove_location_terms($location_terms = array()) {
4897
+	$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4898 4898
 
4899
-	if ( ! empty( $location_terms ) && $location_manager ) {
4900
-		$hide_country_part = get_option( 'geodir_location_hide_country_part' );
4901
-		$hide_region_part  = get_option( 'geodir_location_hide_region_part' );
4899
+	if (!empty($location_terms) && $location_manager) {
4900
+		$hide_country_part = get_option('geodir_location_hide_country_part');
4901
+		$hide_region_part  = get_option('geodir_location_hide_region_part');
4902 4902
 
4903
-		if ( $hide_region_part && $hide_country_part ) {
4904
-			if ( isset( $location_terms['gd_country'] ) ) {
4905
-				unset( $location_terms['gd_country'] );
4903
+		if ($hide_region_part && $hide_country_part) {
4904
+			if (isset($location_terms['gd_country'])) {
4905
+				unset($location_terms['gd_country']);
4906 4906
 			}
4907
-			if ( isset( $location_terms['gd_region'] ) ) {
4908
-				unset( $location_terms['gd_region'] );
4907
+			if (isset($location_terms['gd_region'])) {
4908
+				unset($location_terms['gd_region']);
4909 4909
 			}
4910
-		} else if ( $hide_region_part && ! $hide_country_part ) {
4911
-			if ( isset( $location_terms['gd_region'] ) ) {
4912
-				unset( $location_terms['gd_region'] );
4910
+		} else if ($hide_region_part && !$hide_country_part) {
4911
+			if (isset($location_terms['gd_region'])) {
4912
+				unset($location_terms['gd_region']);
4913 4913
 			}
4914
-		} else if ( ! $hide_region_part && $hide_country_part ) {
4915
-			if ( isset( $location_terms['gd_country'] ) ) {
4916
-				unset( $location_terms['gd_country'] );
4914
+		} else if (!$hide_region_part && $hide_country_part) {
4915
+			if (isset($location_terms['gd_country'])) {
4916
+				unset($location_terms['gd_country']);
4917 4917
 			}
4918 4918
 		}
4919 4919
 	}
@@ -4931,33 +4931,33 @@  discard block
 block discarded – undo
4931 4931
  * @param WP_Post $post Post object.
4932 4932
  * @param bool $update  Whether this is an existing listing being updated or not.
4933 4933
  */
4934
-function geodir_on_wp_insert_post( $post_ID, $post, $update ) {
4935
-	if ( ! $update ) {
4934
+function geodir_on_wp_insert_post($post_ID, $post, $update) {
4935
+	if (!$update) {
4936 4936
 		return;
4937 4937
 	}
4938 4938
 
4939
-	$action      = isset( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : '';
4940
-	$is_admin    = is_admin() && ( ! defined( 'DOING_AJAX' ) || ( defined( 'DOING_AJAX' ) && ! DOING_AJAX ) ) ? true : false;
4939
+	$action      = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
4940
+	$is_admin    = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false;
4941 4941
 	$inline_save = $action == 'inline-save' ? true : false;
4942 4942
 
4943
-	if ( empty( $post->post_type ) || $is_admin || $inline_save || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) {
4943
+	if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
4944 4944
 		return;
4945 4945
 	}
4946 4946
 
4947
-	if ( $action != '' && in_array( $action, array( 'geodir_import_export' ) ) ) {
4947
+	if ($action != '' && in_array($action, array('geodir_import_export'))) {
4948 4948
 		return;
4949 4949
 	}
4950 4950
 
4951 4951
 	$user_id = (int) get_current_user_id();
4952 4952
 
4953
-	if ( $user_id > 0 && get_option( 'geodir_notify_post_edited' ) && ! wp_is_post_revision( $post_ID ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
4954
-		$author_id = ! empty( $post->post_author ) ? $post->post_author : 0;
4953
+	if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4954
+		$author_id = !empty($post->post_author) ? $post->post_author : 0;
4955 4955
 
4956
-		if ( $user_id == $author_id && ! is_super_admin() ) {
4957
-			$from_email   = get_option( 'site_email' );
4956
+		if ($user_id == $author_id && !is_super_admin()) {
4957
+			$from_email   = get_option('site_email');
4958 4958
 			$from_name    = get_site_emailName();
4959
-			$to_email     = get_option( 'admin_email' );
4960
-			$to_name      = get_option( 'name' );
4959
+			$to_email     = get_option('admin_email');
4960
+			$to_name      = get_option('name');
4961 4961
 			$message_type = 'listing_edited';
4962 4962
 
4963 4963
 			$notify_edited = true;
@@ -4969,9 +4969,9 @@  discard block
 block discarded – undo
4969 4969
 			 * @param bool $notify_edited Notify on listing edited by author?
4970 4970
 			 * @param object $post        The current post object.
4971 4971
 			 */
4972
-			$notify_edited = apply_filters( 'geodir_notify_on_listing_edited', $notify_edited, $post );
4972
+			$notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
4973 4973
 
4974
-			geodir_sendEmail( $from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID );
4974
+			geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
4975 4975
 		}
4976 4976
 	}
4977 4977
 }
@@ -4986,14 +4986,14 @@  discard block
 block discarded – undo
4986 4986
  *
4987 4987
  * @return string|null The current page start & end numbering.
4988 4988
  */
4989
-function geodir_title_meta_page( $sep ) {
4989
+function geodir_title_meta_page($sep) {
4990 4990
 	$replacement = null;
4991 4991
 
4992
-	$max = geodir_title_meta_pagenumbering( 'max' );
4993
-	$nr  = geodir_title_meta_pagenumbering( 'nr' );
4992
+	$max = geodir_title_meta_pagenumbering('max');
4993
+	$nr  = geodir_title_meta_pagenumbering('nr');
4994 4994
 
4995
-	if ( $max > 1 && $nr > 1 ) {
4996
-		$replacement = sprintf( $sep . ' ' . __( 'Page %1$d of %2$d', 'geodirectory' ), $nr, $max );
4995
+	if ($max > 1 && $nr > 1) {
4996
+		$replacement = sprintf($sep.' '.__('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
4997 4997
 	}
4998 4998
 
4999 4999
 	return $replacement;
@@ -5010,8 +5010,8 @@  discard block
 block discarded – undo
5010 5010
 function geodir_title_meta_pagenumber() {
5011 5011
 	$replacement = null;
5012 5012
 
5013
-	$nr = geodir_title_meta_pagenumbering( 'nr' );
5014
-	if ( isset( $nr ) && $nr > 0 ) {
5013
+	$nr = geodir_title_meta_pagenumbering('nr');
5014
+	if (isset($nr) && $nr > 0) {
5015 5015
 		$replacement = (string) $nr;
5016 5016
 	}
5017 5017
 
@@ -5029,8 +5029,8 @@  discard block
 block discarded – undo
5029 5029
 function geodir_title_meta_pagetotal() {
5030 5030
 	$replacement = null;
5031 5031
 
5032
-	$max = geodir_title_meta_pagenumbering( 'max' );
5033
-	if ( isset( $max ) && $max > 0 ) {
5032
+	$max = geodir_title_meta_pagenumbering('max');
5033
+	if (isset($max) && $max > 0) {
5034 5034
 		$replacement = (string) $max;
5035 5035
 	}
5036 5036
 
@@ -5050,36 +5050,36 @@  discard block
 block discarded – undo
5050 5050
  *
5051 5051
  * @return int|null The current page numbering.
5052 5052
  */
5053
-function geodir_title_meta_pagenumbering( $request = 'nr' ) {
5053
+function geodir_title_meta_pagenumbering($request = 'nr') {
5054 5054
 	global $wp_query, $post;
5055 5055
 	$max_num_pages = null;
5056 5056
 	$page_number   = null;
5057 5057
 
5058 5058
 	$max_num_pages = 1;
5059 5059
 
5060
-	if ( ! is_singular() ) {
5061
-		$page_number = get_query_var( 'paged' );
5062
-		if ( $page_number === 0 || $page_number === '' ) {
5060
+	if (!is_singular()) {
5061
+		$page_number = get_query_var('paged');
5062
+		if ($page_number === 0 || $page_number === '') {
5063 5063
 			$page_number = 1;
5064 5064
 		}
5065 5065
 
5066
-		if ( isset( $wp_query->max_num_pages ) && ( $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0 ) ) {
5066
+		if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) {
5067 5067
 			$max_num_pages = $wp_query->max_num_pages;
5068 5068
 		}
5069 5069
 	} else {
5070
-		$page_number = get_query_var( 'page' );
5071
-		if ( $page_number === 0 || $page_number === '' ) {
5070
+		$page_number = get_query_var('page');
5071
+		if ($page_number === 0 || $page_number === '') {
5072 5072
 			$page_number = 1;
5073 5073
 		}
5074 5074
 
5075
-		if ( isset( $post->post_content ) ) {
5076
-			$max_num_pages = ( substr_count( $post->post_content, '<!--nextpage-->' ) + 1 );
5075
+		if (isset($post->post_content)) {
5076
+			$max_num_pages = (substr_count($post->post_content, '<!--nextpage-->') + 1);
5077 5077
 		}
5078 5078
 	}
5079 5079
 
5080 5080
 	$return = null;
5081 5081
 
5082
-	switch ( $request ) {
5082
+	switch ($request) {
5083 5083
 		case 'nr':
5084 5084
 			$return = $page_number;
5085 5085
 			break;
@@ -5100,14 +5100,14 @@  discard block
 block discarded – undo
5100 5100
  *
5101 5101
  * @return array Terms.
5102 5102
  */
5103
-function geodir_filter_empty_terms( $terms ) {
5104
-	if ( empty( $terms ) ) {
5103
+function geodir_filter_empty_terms($terms) {
5104
+	if (empty($terms)) {
5105 5105
 		return $terms;
5106 5106
 	}
5107 5107
 
5108 5108
 	$return = array();
5109
-	foreach ( $terms as $term ) {
5110
-		if ( isset( $term->count ) && $term->count > 0 ) {
5109
+	foreach ($terms as $term) {
5110
+		if (isset($term->count) && $term->count > 0) {
5111 5111
 			$return[] = $term;
5112 5112
 		} else {
5113 5113
 			/**
@@ -5118,7 +5118,7 @@  discard block
 block discarded – undo
5118 5118
 			 * @param array $return The array of terms to return.
5119 5119
 			 * @param object $term  The term object.
5120 5120
 			 */
5121
-			$return = apply_filters( 'geodir_filter_empty_terms_filter', $return, $term );
5121
+			$return = apply_filters('geodir_filter_empty_terms_filter', $return, $term);
5122 5122
 		}
5123 5123
 	}
5124 5124
 
@@ -5135,15 +5135,15 @@  discard block
 block discarded – undo
5135 5135
  *
5136 5136
  * @return array
5137 5137
  */
5138
-function geodir_remove_hentry( $class ) {
5139
-	if ( geodir_is_page( 'detail' ) ) {
5140
-		$class = array_diff( $class, array( 'hentry' ) );
5138
+function geodir_remove_hentry($class) {
5139
+	if (geodir_is_page('detail')) {
5140
+		$class = array_diff($class, array('hentry'));
5141 5141
 	}
5142 5142
 
5143 5143
 	return $class;
5144 5144
 }
5145 5145
 
5146
-add_filter( 'post_class', 'geodir_remove_hentry' );
5146
+add_filter('post_class', 'geodir_remove_hentry');
5147 5147
 
5148 5148
 /**
5149 5149
  * Registers a individual text string for WPML translation.
@@ -5155,8 +5155,8 @@  discard block
 block discarded – undo
5155 5155
  * @param string $domain The plugin domain. Default geodirectory.
5156 5156
  * @param string $name The name of the string which helps to know what's being translated.
5157 5157
  */
5158
-function geodir_wpml_register_string( $string, $domain = 'geodirectory', $name = '' ) {
5159
-    do_action( 'wpml_register_single_string', $domain, $name, $string );
5158
+function geodir_wpml_register_string($string, $domain = 'geodirectory', $name = '') {
5159
+    do_action('wpml_register_single_string', $domain, $name, $string);
5160 5160
 }
5161 5161
 
5162 5162
 /**
@@ -5171,6 +5171,6 @@  discard block
 block discarded – undo
5171 5171
  * @param string $language_code Return the translation in this language. Default is NULL which returns the current language.
5172 5172
  * @return string The translated string.
5173 5173
  */
5174
-function geodir_wpml_translate_string( $string, $domain = 'geodirectory', $name = '', $language_code = NULL ) {
5175
-    return apply_filters( 'wpml_translate_single_string', $string, $domain, $name, $language_code );
5174
+function geodir_wpml_translate_string($string, $domain = 'geodirectory', $name = '', $language_code = NULL) {
5175
+    return apply_filters('wpml_translate_single_string', $string, $domain, $name, $language_code);
5176 5176
 }
5177 5177
\ No newline at end of file
Please login to merge, or discard this patch.