Test Failed
Push — master ( 5e94b8...d26983 )
by Stiofan
22:01
created
geodirectory_hooks_actions.php 3 patches
Indentation   +1083 added lines, -1083 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,32 +335,32 @@  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_share_this_button',
351
-                'geodir_detail_page_google_analytics',
352
-                'geodir_edit_post_link',
353
-                'geodir_detail_page_review_rating',
354
-                'geodir_detail_page_more_info'
355
-            ) // end of array 
356
-        ); // end of apply filter
357
-    if (!empty($arr_detail_page_sidebar_content)) {
358
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
359
-            if (function_exists($content_function)) {
360
-                add_action('geodir_detail_page_sidebar', $content_function);
361
-            }
362
-        }
363
-    }
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_share_this_button',
351
+				'geodir_detail_page_google_analytics',
352
+				'geodir_edit_post_link',
353
+				'geodir_detail_page_review_rating',
354
+				'geodir_detail_page_more_info'
355
+			) // end of array 
356
+		); // end of apply filter
357
+	if (!empty($arr_detail_page_sidebar_content)) {
358
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
359
+			if (function_exists($content_function)) {
360
+				add_action('geodir_detail_page_sidebar', $content_function);
361
+			}
362
+		}
363
+	}
364 364
 }
365 365
 
366 366
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -375,14 +375,14 @@  discard block
 block discarded – undo
375 375
  */
376 376
 function geodir_add_to_favourite_link()
377 377
 {
378
-    global $post, $preview;
379
-    if (!$preview && geodir_is_page('detail')) {
380
-        ?>
378
+	global $post, $preview;
379
+	if (!$preview && geodir_is_page('detail')) {
380
+		?>
381 381
         <p class="edit_link">
382 382
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
383 383
         </p>
384 384
     <?php
385
-    }
385
+	}
386 386
 }
387 387
 
388 388
 /**
@@ -396,41 +396,41 @@  discard block
 block discarded – undo
396 396
  */
397 397
 function geodir_social_sharing_buttons()
398 398
 {
399
-    global $preview;
400
-    ob_start(); // Start  buffering;
401
-    /**
402
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
403
-     *
404
-     * @since 1.0.0
405
-     */
406
-    do_action('geodir_before_social_sharing_buttons');
407
-    if (!$preview) {
408
-        ?>
399
+	global $preview;
400
+	ob_start(); // Start  buffering;
401
+	/**
402
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
403
+	 *
404
+	 * @since 1.0.0
405
+	 */
406
+	do_action('geodir_before_social_sharing_buttons');
407
+	if (!$preview) {
408
+		?>
409 409
         <div class="likethis">
410 410
             <?php geodir_twitter_tweet_button(); ?>
411 411
             <?php geodir_fb_like_button(); ?>
412 412
             <?php geodir_google_plus_button(); ?>
413 413
         </div>
414 414
     <?php
415
-    }// end of if, if its a preview or not
416
-
417
-    /**
418
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
419
-     *
420
-     * @since 1.0.0
421
-     */
422
-    do_action('geodir_after_social_sharing_buttons');
423
-    $content_html = ob_get_clean();
424
-    if (trim($content_html) != '')
425
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
427
-        /**
428
-         * Filter the geodir_social_sharing_buttons() function content.
429
-         *
430
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
431
-         */
432
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
433
-    }
415
+	}// end of if, if its a preview or not
416
+
417
+	/**
418
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
419
+	 *
420
+	 * @since 1.0.0
421
+	 */
422
+	do_action('geodir_after_social_sharing_buttons');
423
+	$content_html = ob_get_clean();
424
+	if (trim($content_html) != '')
425
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
427
+		/**
428
+		 * Filter the geodir_social_sharing_buttons() function content.
429
+		 *
430
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
431
+		 */
432
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
433
+	}
434 434
 
435 435
 
436 436
 }
@@ -446,39 +446,39 @@  discard block
 block discarded – undo
446 446
  */
447 447
 function geodir_share_this_button()
448 448
 {
449
-    global $preview;
450
-    ob_start(); // Start buffering;
451
-    /**
452
-     * This is called before the share this html in the function geodir_share_this_button()
453
-     *
454
-     * @since 1.0.0
455
-     */
456
-    do_action('geodir_before_share_this_button');
457
-    if (!$preview) {
458
-        ?>
449
+	global $preview;
450
+	ob_start(); // Start buffering;
451
+	/**
452
+	 * This is called before the share this html in the function geodir_share_this_button()
453
+	 *
454
+	 * @since 1.0.0
455
+	 */
456
+	do_action('geodir_before_share_this_button');
457
+	if (!$preview) {
458
+		?>
459 459
         <div class="share clearfix">
460 460
             <?php geodir_share_this_button_code(); ?>
461 461
         </div>
462 462
     <?php
463
-    }// end of if, if its a preview or not
464
-    /**
465
-     * This is called after the share this html in the function geodir_share_this_button()
466
-     *
467
-     * @since 1.0.0
468
-     */
469
-    do_action('geodir_after_share_this_button');
470
-    $content_html = ob_get_clean();
471
-    if (trim($content_html) != '')
472
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
-    if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
474
-        /**
475
-         * Filter the geodir_share_this_button() function content.
476
-         *
477
-         * @param string $content_html The output html of the geodir_share_this_button() function.
478
-         * @since 1.0.0
479
-         */
480
-        echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
481
-    }
463
+	}// end of if, if its a preview or not
464
+	/**
465
+	 * This is called after the share this html in the function geodir_share_this_button()
466
+	 *
467
+	 * @since 1.0.0
468
+	 */
469
+	do_action('geodir_after_share_this_button');
470
+	$content_html = ob_get_clean();
471
+	if (trim($content_html) != '')
472
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
+	if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
474
+		/**
475
+		 * Filter the geodir_share_this_button() function content.
476
+		 *
477
+		 * @param string $content_html The output html of the geodir_share_this_button() function.
478
+		 * @since 1.0.0
479
+		 */
480
+		echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
481
+	}
482 482
 
483 483
 }
484 484
 
@@ -494,46 +494,46 @@  discard block
 block discarded – undo
494 494
  */
495 495
 function geodir_edit_post_link()
496 496
 {
497
-    global $post, $preview;
498
-    ob_start(); // Start buffering;
499
-    /**
500
-     * This is called before the edit post link html in the function geodir_edit_post_link()
501
-     *
502
-     * @since 1.0.0
503
-     */
504
-    do_action('geodir_before_edit_post_link');
505
-    if (!$preview) {
506
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
497
+	global $post, $preview;
498
+	ob_start(); // Start buffering;
499
+	/**
500
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
501
+	 *
502
+	 * @since 1.0.0
503
+	 */
504
+	do_action('geodir_before_edit_post_link');
505
+	if (!$preview) {
506
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
507 507
         
508
-        if ($is_current_user_owner) {
509
-            $post_id = $post->ID;
508
+		if ($is_current_user_owner) {
509
+			$post_id = $post->ID;
510 510
             
511
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
512
-                $post_id = (int)$_REQUEST['pid'];
513
-            }
511
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
512
+				$post_id = (int)$_REQUEST['pid'];
513
+			}
514 514
 
515
-            $postlink = get_permalink(geodir_add_listing_page_id());
516
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
517
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
518
-        }
519
-    }// end of if, if its a preview or not
520
-    /**
521
-     * This is called after the edit post link html in the function geodir_edit_post_link()
522
-     *
523
-     * @since 1.0.0
524
-     */
525
-    do_action('geodir_after_edit_post_link');
526
-    $content_html = ob_get_clean();
527
-    if (trim($content_html) != '')
528
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
530
-        /**
531
-         * Filter the geodir_edit_post_link() function content.
532
-         *
533
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
534
-         */
535
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
536
-    }
515
+			$postlink = get_permalink(geodir_add_listing_page_id());
516
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
517
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
518
+		}
519
+	}// end of if, if its a preview or not
520
+	/**
521
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
522
+	 *
523
+	 * @since 1.0.0
524
+	 */
525
+	do_action('geodir_after_edit_post_link');
526
+	$content_html = ob_get_clean();
527
+	if (trim($content_html) != '')
528
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
530
+		/**
531
+		 * Filter the geodir_edit_post_link() function content.
532
+		 *
533
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
534
+		 */
535
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
536
+	}
537 537
 }
538 538
 
539 539
 /**
@@ -547,41 +547,41 @@  discard block
 block discarded – undo
547 547
  */
548 548
 function geodir_detail_page_google_analytics()
549 549
 {
550
-    global $post;
551
-    $package_info = array();
552
-    $package_info = geodir_post_package_info($package_info, $post);
550
+	global $post;
551
+	$package_info = array();
552
+	$package_info = geodir_post_package_info($package_info, $post);
553 553
 
554
-    $id = trim(get_option('geodir_ga_id'));
554
+	$id = trim(get_option('geodir_ga_id'));
555 555
 
556
-    if (!$id) {
557
-        return; //if no Google Analytics ID then bail.
558
-    }
556
+	if (!$id) {
557
+		return; //if no Google Analytics ID then bail.
558
+	}
559 559
 
560
-    ob_start(); // Start buffering;
561
-    /**
562
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
563
-     *
564
-     * @since 1.0.0
565
-     */
566
-    do_action('geodir_before_google_analytics');
560
+	ob_start(); // Start buffering;
561
+	/**
562
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
563
+	 *
564
+	 * @since 1.0.0
565
+	 */
566
+	do_action('geodir_before_google_analytics');
567 567
     
568
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
569
-    /**
570
-     * Filter the time interval to check & refresh new users results.
571
-     *
572
-     * @since 1.5.9
573
-     *
574
-     * @param int $refresh_time Time interval to check & refresh new users results.
575
-     */
576
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
577
-    $refresh_time = absint($refresh_time * 1000);
568
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
569
+	/**
570
+	 * Filter the time interval to check & refresh new users results.
571
+	 *
572
+	 * @since 1.5.9
573
+	 *
574
+	 * @param int $refresh_time Time interval to check & refresh new users results.
575
+	 */
576
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
577
+	$refresh_time = absint($refresh_time * 1000);
578 578
     
579
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
579
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
580 580
     
581
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
582
-    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' )) ) {
583
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
584
-        ?>
581
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
582
+	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' )) ) {
583
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
584
+		?>
585 585
         <script type="text/javascript">
586 586
             var gd_gaTimeOut;
587 587
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -833,15 +833,15 @@  discard block
 block discarded – undo
833 833
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
834 834
 
835 835
                     <?php
836
-                    // Here we list the shorthand days of the week so it can be used in translation.
837
-                    __("Mon",'geodirectory');
838
-                    __("Tue",'geodirectory');
839
-                    __("Wed",'geodirectory');
840
-                    __("Thu",'geodirectory');
841
-                    __("Fri",'geodirectory');
842
-                    __("Sat",'geodirectory');
843
-                    __("Sun",'geodirectory');
844
-                    ?>
836
+					// Here we list the shorthand days of the week so it can be used in translation.
837
+					__("Mon",'geodirectory');
838
+					__("Tue",'geodirectory');
839
+					__("Wed",'geodirectory');
840
+					__("Thu",'geodirectory');
841
+					__("Fri",'geodirectory');
842
+					__("Sat",'geodirectory');
843
+					__("Sun",'geodirectory');
844
+					?>
845 845
 
846 846
                     labels = [
847 847
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1090,24 +1090,24 @@  discard block
 block discarded – undo
1090 1090
         </span>
1091 1091
 
1092 1092
     <?php
1093
-    }
1094
-    /**
1095
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1096
-     *
1097
-     * @since 1.0.0
1098
-     */
1099
-    do_action('geodir_after_google_analytics');
1100
-    $content_html = ob_get_clean();
1101
-    if (trim($content_html) != '')
1102
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1103
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1104
-        /**
1105
-         * Filter the geodir_edit_post_link() function content.
1106
-         *
1107
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1108
-         */
1109
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1110
-    }
1093
+	}
1094
+	/**
1095
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1096
+	 *
1097
+	 * @since 1.0.0
1098
+	 */
1099
+	do_action('geodir_after_google_analytics');
1100
+	$content_html = ob_get_clean();
1101
+	if (trim($content_html) != '')
1102
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1103
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1104
+		/**
1105
+		 * Filter the geodir_edit_post_link() function content.
1106
+		 *
1107
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1108
+		 */
1109
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1110
+	}
1111 1111
 }
1112 1112
 
1113 1113
 /**
@@ -1123,90 +1123,90 @@  discard block
 block discarded – undo
1123 1123
  */
1124 1124
 function geodir_detail_page_review_rating()
1125 1125
 {
1126
-    global $post, $preview, $post_images;
1127
-    ob_start(); // Start  buffering;
1128
-    /**
1129
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1130
-     *
1131
-     * This is called outside the check for an actual rating and the check for preview page.
1132
-     *
1133
-     * @since 1.0.0
1134
-     */
1135
-    do_action('geodir_before_detail_page_review_rating');
1136
-
1137
-    $comment_count = geodir_get_review_count_total($post->ID);
1138
-    $post_avgratings = geodir_get_post_rating($post->ID);
1139
-
1140
-    if ($post_avgratings != 0 && !$preview) {
1141
-        /**
1142
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1143
-         *
1144
-         * This is called inside the check for an actual rating and the check for preview page.
1145
-         *
1146
-         * @since 1.0.0
1147
-         * @param float $post_avgratings Average rating for the surrent post.
1148
-         * @param int $post->ID Current post ID.
1149
-         */
1150
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1151
-
1152
-        $html = '<p style=" float:left;">';
1153
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1154
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1155
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1126
+	global $post, $preview, $post_images;
1127
+	ob_start(); // Start  buffering;
1128
+	/**
1129
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1130
+	 *
1131
+	 * This is called outside the check for an actual rating and the check for preview page.
1132
+	 *
1133
+	 * @since 1.0.0
1134
+	 */
1135
+	do_action('geodir_before_detail_page_review_rating');
1136
+
1137
+	$comment_count = geodir_get_review_count_total($post->ID);
1138
+	$post_avgratings = geodir_get_post_rating($post->ID);
1139
+
1140
+	if ($post_avgratings != 0 && !$preview) {
1141
+		/**
1142
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1143
+		 *
1144
+		 * This is called inside the check for an actual rating and the check for preview page.
1145
+		 *
1146
+		 * @since 1.0.0
1147
+		 * @param float $post_avgratings Average rating for the surrent post.
1148
+		 * @param int $post->ID Current post ID.
1149
+		 */
1150
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1151
+
1152
+		$html = '<p style=" float:left;">';
1153
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1154
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1155
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1156 1156
        
1157 1157
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1158 1158
 	   
1159 1159
 	   $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 />';
1160 1160
 
1161
-        $html .= '<span class="item">';
1162
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1161
+		$html .= '<span class="item">';
1162
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1163 1163
 
1164
-        if ($post_images) {
1165
-            foreach ($post_images as $img) {
1166
-                $post_img = $img->src;
1167
-                break;
1168
-            }
1169
-        }
1170
-
1171
-        if (isset($post_img) && $post_img) {
1172
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1173
-        }
1174
-
1175
-        $html .= '</span>';
1176
-
1177
-        echo $html .= '</div>';
1178
-        /**
1179
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1180
-         *
1181
-         * This is called inside the check for an actual rating and the check for preview page.
1182
-         *
1183
-         * @since 1.0.0
1184
-         * @param float $post_avgratings Average rating for the surrent post.
1185
-         * @param int $post->ID Current post ID.
1186
-         */
1187
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1188
-    }
1189
-    /**
1190
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1191
-     *
1192
-     * This is called outside the check for an actual rating and the check for preview page.
1193
-     *
1194
-     * @since 1.0.0
1195
-     */
1196
-    do_action('geodir_after_detail_page_review_rating');
1197
-    $content_html = ob_get_clean();
1198
-    if (trim($content_html) != '') {
1199
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1200
-    }
1201
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1202
-        /**
1203
-         * Filter the geodir_detail_page_review_rating() function content.
1204
-         *
1205
-         * @since 1.0.0
1206
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1207
-         */
1208
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1209
-    }
1164
+		if ($post_images) {
1165
+			foreach ($post_images as $img) {
1166
+				$post_img = $img->src;
1167
+				break;
1168
+			}
1169
+		}
1170
+
1171
+		if (isset($post_img) && $post_img) {
1172
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1173
+		}
1174
+
1175
+		$html .= '</span>';
1176
+
1177
+		echo $html .= '</div>';
1178
+		/**
1179
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1180
+		 *
1181
+		 * This is called inside the check for an actual rating and the check for preview page.
1182
+		 *
1183
+		 * @since 1.0.0
1184
+		 * @param float $post_avgratings Average rating for the surrent post.
1185
+		 * @param int $post->ID Current post ID.
1186
+		 */
1187
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1188
+	}
1189
+	/**
1190
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1191
+	 *
1192
+	 * This is called outside the check for an actual rating and the check for preview page.
1193
+	 *
1194
+	 * @since 1.0.0
1195
+	 */
1196
+	do_action('geodir_after_detail_page_review_rating');
1197
+	$content_html = ob_get_clean();
1198
+	if (trim($content_html) != '') {
1199
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1200
+	}
1201
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1202
+		/**
1203
+		 * Filter the geodir_detail_page_review_rating() function content.
1204
+		 *
1205
+		 * @since 1.0.0
1206
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1207
+		 */
1208
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1209
+	}
1210 1210
 }
1211 1211
 
1212 1212
 /**
@@ -1218,35 +1218,35 @@  discard block
 block discarded – undo
1218 1218
  */
1219 1219
 function geodir_detail_page_more_info()
1220 1220
 {
1221
-    ob_start(); // Start  buffering;
1222
-    /**
1223
-     * This is called before the info section html.
1224
-     *
1225
-     * @since 1.0.0
1226
-     */
1227
-    do_action('geodir_before_detail_page_more_info');
1228
-    if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1229
-        echo $geodir_post_detail_fields;
1230
-    }
1231
-    /**
1232
-     * This is called after the info section html.
1233
-     *
1234
-     * @since 1.0.0
1235
-     */
1236
-    do_action('geodir_after_detail_page_more_info');
1237
-
1238
-    $content_html = ob_get_clean();
1239
-    if (trim($content_html) != '')
1240
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1241
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1242
-        /**
1243
-         * Filter the output html for function geodir_detail_page_more_info().
1244
-         *
1245
-         * @since 1.0.0
1246
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1247
-         */
1248
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1249
-    }
1221
+	ob_start(); // Start  buffering;
1222
+	/**
1223
+	 * This is called before the info section html.
1224
+	 *
1225
+	 * @since 1.0.0
1226
+	 */
1227
+	do_action('geodir_before_detail_page_more_info');
1228
+	if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1229
+		echo $geodir_post_detail_fields;
1230
+	}
1231
+	/**
1232
+	 * This is called after the info section html.
1233
+	 *
1234
+	 * @since 1.0.0
1235
+	 */
1236
+	do_action('geodir_after_detail_page_more_info');
1237
+
1238
+	$content_html = ob_get_clean();
1239
+	if (trim($content_html) != '')
1240
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1241
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1242
+		/**
1243
+		 * Filter the output html for function geodir_detail_page_more_info().
1244
+		 *
1245
+		 * @since 1.0.0
1246
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1247
+		 */
1248
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1249
+	}
1250 1250
 }
1251 1251
 
1252 1252
 
@@ -1260,15 +1260,15 @@  discard block
 block discarded – undo
1260 1260
  */
1261 1261
 function geodir_localize_all_js_msg()
1262 1262
 {// 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
1263
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1264
-        $ajax_url = admin_url('admin-ajax.php');
1265
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1266
-        $ajax_url = admin_url('admin-ajax.php');
1267
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1268
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1269
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1270
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1271
-    }
1263
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1264
+		$ajax_url = admin_url('admin-ajax.php');
1265
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1266
+		$ajax_url = admin_url('admin-ajax.php');
1267
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1268
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1269
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1270
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1271
+	}
1272 1272
 	
1273 1273
 	/**
1274 1274
 	 * Filter the allowed image type extensions for post images.
@@ -1278,60 +1278,60 @@  discard block
 block discarded – undo
1278 1278
 	 */
1279 1279
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1280 1280
 	
1281
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1282
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1283
-    $default_marker_width = $default_marker_size['w'];
1284
-    $default_marker_height = $default_marker_size['h'];
1281
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1282
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1283
+	$default_marker_width = $default_marker_size['w'];
1284
+	$default_marker_height = $default_marker_size['h'];
1285 1285
     
1286
-    $arr_alert_msg = array(
1287
-        'geodir_plugin_url' => geodir_plugin_url(),
1288
-        'geodir_admin_ajax_url' => $ajax_url,
1289
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1290
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1291
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1292
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1293
-        //start not show alert msg
1294
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1295
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1296
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1297
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1298
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1299
-        // end not show alert msg
1300
-        'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1301
-        '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'),
1302
-        //start not show alert msg
1303
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1304
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1305
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1306
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1307
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1308
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1309
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1310
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1311
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1312
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1313
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1314
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1315
-        'geodir_default_marker_icon' => $default_marker_icon,
1316
-        'geodir_default_marker_w' => $default_marker_width,
1317
-        'geodir_default_marker_h' => $default_marker_height,
1318
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1319
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1320
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1321
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1322
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1323
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1324
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1325
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1326
-        /* on/off dragging for phone devices */
1327
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1328
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1329
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1330
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1331
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1332
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1333
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1334
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1286
+	$arr_alert_msg = array(
1287
+		'geodir_plugin_url' => geodir_plugin_url(),
1288
+		'geodir_admin_ajax_url' => $ajax_url,
1289
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1290
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1291
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1292
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1293
+		//start not show alert msg
1294
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1295
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1296
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1297
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1298
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1299
+		// end not show alert msg
1300
+		'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1301
+		'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'),
1302
+		//start not show alert msg
1303
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1304
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1305
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1306
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1307
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1308
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1309
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1310
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1311
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1312
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1313
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1314
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1315
+		'geodir_default_marker_icon' => $default_marker_icon,
1316
+		'geodir_default_marker_w' => $default_marker_width,
1317
+		'geodir_default_marker_h' => $default_marker_height,
1318
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1319
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1320
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1321
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1322
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1323
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1324
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1325
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1326
+		/* on/off dragging for phone devices */
1327
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1328
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1329
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1330
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1331
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1332
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1333
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1334
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1335 1335
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1336 1336
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1337 1337
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1339,29 +1339,29 @@  discard block
 block discarded – undo
1339 1339
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1340 1340
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1341 1341
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1342
-        'geodir_map_name' => geodir_map_name(),
1343
-    );
1344
-
1345
-    /**
1346
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1347
-     *
1348
-     * With this filter you can add, remove or change translated JS strings.
1349
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1350
-     *
1351
-     * @since 1.0.0
1352
-     */
1353
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1354
-
1355
-    foreach ($arr_alert_msg as $key => $value) {
1356
-        if (!is_scalar($value))
1357
-            continue;
1358
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1359
-    }
1342
+		'geodir_map_name' => geodir_map_name(),
1343
+	);
1344
+
1345
+	/**
1346
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1347
+	 *
1348
+	 * With this filter you can add, remove or change translated JS strings.
1349
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1350
+	 *
1351
+	 * @since 1.0.0
1352
+	 */
1353
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1354
+
1355
+	foreach ($arr_alert_msg as $key => $value) {
1356
+		if (!is_scalar($value))
1357
+			continue;
1358
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1359
+	}
1360 1360
 
1361
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1362
-    echo '<script>';
1363
-    echo $script;
1364
-    echo '</script>';
1361
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1362
+	echo '<script>';
1363
+	echo $script;
1364
+	echo '</script>';
1365 1365
 }
1366 1366
 
1367 1367
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1377,11 +1377,11 @@  discard block
 block discarded – undo
1377 1377
  */
1378 1378
 function geodir_admin_bar_site_menu($wp_admin_bar)
1379 1379
 {
1380
-    if (get_option("geodir_installed")) {
1381
-        if (current_user_can('manage_options')) {
1382
-            $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1383
-        }
1384
-    }
1380
+	if (get_option("geodir_installed")) {
1381
+		if (current_user_can('manage_options')) {
1382
+			$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1383
+		}
1384
+	}
1385 1385
 }
1386 1386
 
1387 1387
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1407,25 +1407,25 @@  discard block
 block discarded – undo
1407 1407
  */
1408 1408
 function geodir_store_sidebars()
1409 1409
 {
1410
-    global $geodir_sidebars;
1411
-    global $sidebars_widgets;
1412
-
1413
-    if (!is_array($sidebars_widgets))
1414
-        $sidebars_widgets = wp_get_sidebars_widgets();
1415
-    $geodir_old_sidebars = array();
1416
-
1417
-    if (is_array($geodir_sidebars)) {
1418
-        foreach ($geodir_sidebars as $val) {
1419
-            if (is_array($sidebars_widgets)) {
1420
-                if (array_key_exists($val, $sidebars_widgets))
1421
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1422
-                else
1423
-                    $geodir_old_sidebars[$val] = array();
1424
-            }
1425
-        }
1426
-    }
1427
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1428
-    geodir_option_version_backup('geodir_sidebars');
1410
+	global $geodir_sidebars;
1411
+	global $sidebars_widgets;
1412
+
1413
+	if (!is_array($sidebars_widgets))
1414
+		$sidebars_widgets = wp_get_sidebars_widgets();
1415
+	$geodir_old_sidebars = array();
1416
+
1417
+	if (is_array($geodir_sidebars)) {
1418
+		foreach ($geodir_sidebars as $val) {
1419
+			if (is_array($sidebars_widgets)) {
1420
+				if (array_key_exists($val, $sidebars_widgets))
1421
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1422
+				else
1423
+					$geodir_old_sidebars[$val] = array();
1424
+			}
1425
+		}
1426
+	}
1427
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1428
+	geodir_option_version_backup('geodir_sidebars');
1429 1429
 
1430 1430
 }
1431 1431
 
@@ -1439,28 +1439,28 @@  discard block
 block discarded – undo
1439 1439
  */
1440 1440
 function geodir_restore_sidebars()
1441 1441
 {
1442
-    global $sidebars_widgets;
1443
-
1444
-    if (!is_array($sidebars_widgets))
1445
-        $sidebars_widgets = wp_get_sidebars_widgets();
1446
-
1447
-    if (is_array($sidebars_widgets)) {
1448
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1449
-        if (is_array($geodir_old_sidebars)) {
1450
-            foreach ($geodir_old_sidebars as $key => $val) {
1451
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1452
-                {
1453
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1454
-                }
1442
+	global $sidebars_widgets;
1455 1443
 
1444
+	if (!is_array($sidebars_widgets))
1445
+		$sidebars_widgets = wp_get_sidebars_widgets();
1456 1446
 
1457
-            }
1458
-        }
1447
+	if (is_array($sidebars_widgets)) {
1448
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1449
+		if (is_array($geodir_old_sidebars)) {
1450
+			foreach ($geodir_old_sidebars as $key => $val) {
1451
+				if(0 === strpos($key, 'geodir_'))// if gd widget
1452
+				{
1453
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1454
+				}
1459 1455
 
1460
-    }
1461 1456
 
1462
-    update_option('sidebars_widgets', $sidebars_widgets);
1463
-    update_option('geodir_sidebars', '');
1457
+			}
1458
+		}
1459
+
1460
+	}
1461
+
1462
+	update_option('sidebars_widgets', $sidebars_widgets);
1463
+	update_option('geodir_sidebars', '');
1464 1464
 }
1465 1465
 
1466 1466
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1473,9 +1473,9 @@  discard block
 block discarded – undo
1473 1473
  */
1474 1474
 function geodir_after_listing_post_gridview()
1475 1475
 {
1476
-    global $gridview_columns;
1476
+	global $gridview_columns;
1477 1477
 
1478
-    $gridview_columns = '';
1478
+	$gridview_columns = '';
1479 1479
 
1480 1480
 }
1481 1481
 
@@ -1503,11 +1503,11 @@  discard block
 block discarded – undo
1503 1503
  */
1504 1504
 function so_handle_038($url, $original_url, $_context)
1505 1505
 {
1506
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1507
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1508
-    }
1506
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1507
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1508
+	}
1509 1509
 
1510
-    return $url;
1510
+	return $url;
1511 1511
 }
1512 1512
 
1513 1513
 
@@ -1523,34 +1523,34 @@  discard block
 block discarded – undo
1523 1523
 function geodir_after_main_form_fields() {
1524 1524
 	global $gd_session;
1525 1525
 	
1526
-    if (get_option('geodir_accept_term_condition')) {
1527
-        global $post;
1528
-        $term_condition = '';
1529
-        if (isset($_REQUEST['backandedit'])) {
1530
-            $post = (object)$gd_session->get('listing');
1531
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1532
-        }
1533
-
1534
-        ?>
1526
+	if (get_option('geodir_accept_term_condition')) {
1527
+		global $post;
1528
+		$term_condition = '';
1529
+		if (isset($_REQUEST['backandedit'])) {
1530
+			$post = (object)$gd_session->get('listing');
1531
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1532
+		}
1533
+
1534
+		?>
1535 1535
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1536 1536
             <label>&nbsp;</label>
1537 1537
 
1538 1538
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1539 1539
 				<span style="display:block"> 
1540 1540
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1541
-                    echo 'checked="checked"';
1542
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1541
+					echo 'checked="checked"';
1542
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1543 1543
                        class="geodir_textfield" value="1"
1544 1544
                        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>
1545 1545
 				</span>
1546 1546
             </div>
1547 1547
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1548
-                    _e($required_msg, 'geodirectory');
1549
-                } ?></span>
1548
+					_e($required_msg, 'geodirectory');
1549
+				} ?></span>
1550 1550
         </div>
1551 1551
     <?php
1552 1552
 
1553
-    }
1553
+	}
1554 1554
 }
1555 1555
 
1556 1556
 
@@ -1575,42 +1575,42 @@  discard block
 block discarded – undo
1575 1575
  */
1576 1576
 function geodir_detail_page_tab_is_display($is_display, $tab)
1577 1577
 {
1578
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1578
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1579 1579
 
1580
-    if ($tab == 'post_profile') {
1581
-        /** This action is documented in geodirectory_template_actions.php */
1582
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1580
+	if ($tab == 'post_profile') {
1581
+		/** This action is documented in geodirectory_template_actions.php */
1582
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1583 1583
         
1584
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1585
-            $is_display = false;
1586
-        }
1587
-    }
1584
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1585
+			$is_display = false;
1586
+		}
1587
+	}
1588 1588
     
1589
-    if ($tab == 'post_info')
1590
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1589
+	if ($tab == 'post_info')
1590
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1591 1591
     
1592
-    if ($tab == 'post_images')
1593
-        $is_display = (!empty($post_images)) ? true : false;
1592
+	if ($tab == 'post_images')
1593
+		$is_display = (!empty($post_images)) ? true : false;
1594 1594
 
1595
-    if ($tab == 'post_video')
1596
-        $is_display = (!empty($video)) ? true : false;
1595
+	if ($tab == 'post_video')
1596
+		$is_display = (!empty($video)) ? true : false;
1597 1597
 
1598
-    if ($tab == 'special_offers')
1599
-        $is_display = (!empty($special_offers)) ? true : false;
1598
+	if ($tab == 'special_offers')
1599
+		$is_display = (!empty($special_offers)) ? true : false;
1600 1600
 
1601
-    if ($tab == 'reviews')
1602
-        $is_display = (geodir_is_page('detail')) ? true : false;
1601
+	if ($tab == 'reviews')
1602
+		$is_display = (geodir_is_page('detail')) ? true : false;
1603 1603
 
1604
-    if ($tab == 'related_listing') {
1605
-       $message = __('No listings found which match your selection.', 'geodirectory');
1604
+	if ($tab == 'related_listing') {
1605
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1606 1606
        
1607
-       /** This action is documented in geodirectory-functions/template_functions.php */
1608
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1607
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1608
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1609 1609
        
1610
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1611
-    }
1610
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1611
+	}
1612 1612
 
1613
-    return $is_display;
1613
+	return $is_display;
1614 1614
 }
1615 1615
 
1616 1616
 
@@ -1626,69 +1626,69 @@  discard block
 block discarded – undo
1626 1626
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1627 1627
  */
1628 1628
 function geodir_changes_in_custom_fields_table() {
1629
-    global $wpdb, $plugin_prefix;
1629
+	global $wpdb, $plugin_prefix;
1630 1630
 	
1631 1631
 	// Remove unused virtual page
1632 1632
 	$listings_page_id = (int)get_option('geodir_listing_page');
1633 1633
 	if ($listings_page_id) {
1634 1634
 		$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')));
1635
-        delete_option('geodir_listing_page');
1635
+		delete_option('geodir_listing_page');
1636 1636
 	}
1637 1637
 
1638
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1639
-        $wpdb->query(
1640
-            $wpdb->prepare(
1641
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1642
-                array('1', '1', 'admin')
1643
-            )
1644
-        );
1638
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1639
+		$wpdb->query(
1640
+			$wpdb->prepare(
1641
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1642
+				array('1', '1', 'admin')
1643
+			)
1644
+		);
1645 1645
 
1646 1646
 
1647
-        /* --- terms meta value set --- */
1647
+		/* --- terms meta value set --- */
1648 1648
 
1649
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1649
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1650 1650
 
1651
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1651
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1652 1652
 
1653
-        if (!empty($options_data)) {
1653
+		if (!empty($options_data)) {
1654 1654
 
1655
-            foreach ($options_data as $optobj) {
1655
+			foreach ($options_data as $optobj) {
1656 1656
 
1657
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1657
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1658 1658
 
1659
-                $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)));
1659
+				$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)));
1660 1660
 
1661
-                if (!empty($taxonomies_data)) {
1661
+				if (!empty($taxonomies_data)) {
1662 1662
 
1663
-                    foreach ($taxonomies_data as $taxobj) {
1663
+					foreach ($taxonomies_data as $taxobj) {
1664 1664
 
1665
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1666
-                        $post_type = $taxObject->object_type[0];
1665
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1666
+						$post_type = $taxObject->object_type[0];
1667 1667
 
1668
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1668
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1669 1669
 
1670
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1670
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1671 1671
 
1672
-                        if ($duplicate_data) {
1672
+						if ($duplicate_data) {
1673 1673
 
1674
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1674
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1675 1675
 
1676
-                        } else {
1676
+						} else {
1677 1677
 
1678
-                            $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)));
1678
+							$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)));
1679 1679
 
1680
-                        }
1680
+						}
1681 1681
 
1682
-                    }
1682
+					}
1683 1683
 
1684
-                }
1684
+				}
1685 1685
 
1686
-            }
1687
-        }
1686
+			}
1687
+		}
1688 1688
 
1689
-        update_option('geodir_changes_in_custom_fields_table', '1');
1689
+		update_option('geodir_changes_in_custom_fields_table', '1');
1690 1690
 
1691
-    }
1691
+	}
1692 1692
 
1693 1693
 }
1694 1694
 
@@ -1707,24 +1707,24 @@  discard block
 block discarded – undo
1707 1707
 function geodir_location_slug_check($slug)
1708 1708
 {
1709 1709
 
1710
-    global $wpdb, $table_prefix;
1710
+	global $wpdb, $table_prefix;
1711 1711
 
1712
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1712
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1713 1713
 
1714
-    if ($slug_exists) {
1714
+	if ($slug_exists) {
1715 1715
 
1716
-        $suffix = 1;
1717
-        do {
1718
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1719
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1720
-            $suffix++;
1721
-        } while ($location_slug_check && $suffix < 100);
1716
+		$suffix = 1;
1717
+		do {
1718
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1719
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1720
+			$suffix++;
1721
+		} while ($location_slug_check && $suffix < 100);
1722 1722
 
1723
-        $slug = $alt_location_name;
1723
+		$slug = $alt_location_name;
1724 1724
 
1725
-    }
1725
+	}
1726 1726
 
1727
-    return $slug;
1727
+	return $slug;
1728 1728
 
1729 1729
 }
1730 1730
 
@@ -1749,42 +1749,42 @@  discard block
 block discarded – undo
1749 1749
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1750 1750
 {
1751 1751
 
1752
-    global $wpdb, $plugin_prefix, $table_prefix;
1752
+	global $wpdb, $plugin_prefix, $table_prefix;
1753 1753
 
1754
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1754
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1755 1755
 
1756
-    $slug = $tern_data->slug;
1756
+	$slug = $tern_data->slug;
1757 1757
 
1758
-    /**
1759
-     * Filter if a term slug exists.
1760
-     *
1761
-     * @since 1.0.0
1762
-     * @package GeoDirectory
1763
-     * @param bool $bool Default: false.
1764
-     * @param string $slug The term slug.
1765
-     * @param int $term_id The term ID.
1766
-     */
1767
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1758
+	/**
1759
+	 * Filter if a term slug exists.
1760
+	 *
1761
+	 * @since 1.0.0
1762
+	 * @package GeoDirectory
1763
+	 * @param bool $bool Default: false.
1764
+	 * @param string $slug The term slug.
1765
+	 * @param int $term_id The term ID.
1766
+	 */
1767
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1768 1768
 
1769
-    if ($slug_exists) {
1769
+	if ($slug_exists) {
1770 1770
 
1771
-        $suffix = 1;
1772
-        do {
1773
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1771
+		$suffix = 1;
1772
+		do {
1773
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1774 1774
 
1775
-            /** This action is documented in geodirectory_hooks_actions.php */
1776
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1775
+			/** This action is documented in geodirectory_hooks_actions.php */
1776
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1777 1777
 
1778
-            $suffix++;
1779
-        } while ($term_slug_check && $suffix < 100);
1778
+			$suffix++;
1779
+		} while ($term_slug_check && $suffix < 100);
1780 1780
 
1781
-        $slug = $new_slug;
1781
+		$slug = $new_slug;
1782 1782
 
1783
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1783
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1784 1784
 
1785
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1785
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1786 1786
 
1787
-    }
1787
+	}
1788 1788
 	
1789 1789
 	// Update tag in detail table.
1790 1790
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1825,21 +1825,21 @@  discard block
 block discarded – undo
1825 1825
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1826 1826
 {
1827 1827
 
1828
-    global $wpdb, $table_prefix;
1828
+	global $wpdb, $table_prefix;
1829 1829
 
1830
-    $default_location = geodir_get_default_location();
1830
+	$default_location = geodir_get_default_location();
1831 1831
 
1832
-    $country_slug = $default_location->country_slug;
1833
-    $region_slug = $default_location->region_slug;
1834
-    $city_slug = $default_location->city_slug;
1832
+	$country_slug = $default_location->country_slug;
1833
+	$region_slug = $default_location->region_slug;
1834
+	$city_slug = $default_location->city_slug;
1835 1835
 
1836
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1837
-        return $slug_exists = true;
1836
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1837
+		return $slug_exists = true;
1838 1838
 
1839
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1840
-        return $slug_exists = true;
1839
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1840
+		return $slug_exists = true;
1841 1841
 
1842
-    return $slug_exists;
1842
+	return $slug_exists;
1843 1843
 }
1844 1844
 
1845 1845
 
@@ -1858,75 +1858,75 @@  discard block
 block discarded – undo
1858 1858
  */
1859 1859
 function geodir_custom_page_title($title = '', $sep = '')
1860 1860
 {
1861
-    global $wp;
1862
-    if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1863
-        return $title;
1864
-    }
1861
+	global $wp;
1862
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1863
+		return $title;
1864
+	}
1865 1865
 
1866
-    if ($sep == '') {
1867
-        /**
1868
-         * Filter the page title separator.
1869
-         *
1870
-         * @since 1.0.0
1871
-         * @package GeoDirectory
1872
-         * @param string $sep The separator, default: `|`.
1873
-         */
1874
-        $sep = apply_filters('geodir_page_title_separator', '|');
1875
-    }
1866
+	if ($sep == '') {
1867
+		/**
1868
+		 * Filter the page title separator.
1869
+		 *
1870
+		 * @since 1.0.0
1871
+		 * @package GeoDirectory
1872
+		 * @param string $sep The separator, default: `|`.
1873
+		 */
1874
+		$sep = apply_filters('geodir_page_title_separator', '|');
1875
+	}
1876 1876
 
1877 1877
 
1878
-    $gd_page = '';
1879
-    if(geodir_is_page('home')){
1880
-        $gd_page = 'home';
1881
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1882
-    }
1883
-    elseif(geodir_is_page('detail')){
1884
-        $gd_page = 'detail';
1885
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1886
-    }
1887
-    elseif(geodir_is_page('pt')){
1888
-        $gd_page = 'pt';
1889
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1890
-    }
1891
-    elseif(geodir_is_page('listing')){
1892
-        $gd_page = 'listing';
1893
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1894
-    }
1895
-    elseif(geodir_is_page('location')){
1896
-        $gd_page = 'location';
1897
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1898
-    }
1899
-    elseif(geodir_is_page('search')){
1900
-        $gd_page = 'search';
1901
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1902
-    }
1903
-    elseif(geodir_is_page('add-listing')){
1904
-        $gd_page = 'add-listing';
1905
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1906
-    }
1907
-    elseif(geodir_is_page('author')){
1908
-        $gd_page = 'author';
1909
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1910
-    }
1911
-    elseif(geodir_is_page('login')){
1912
-        $gd_page = 'login';
1913
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1914
-    }
1915
-    elseif(geodir_is_page('listing-success')){
1916
-        $gd_page = 'listing-success';
1917
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1918
-    }
1878
+	$gd_page = '';
1879
+	if(geodir_is_page('home')){
1880
+		$gd_page = 'home';
1881
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1882
+	}
1883
+	elseif(geodir_is_page('detail')){
1884
+		$gd_page = 'detail';
1885
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1886
+	}
1887
+	elseif(geodir_is_page('pt')){
1888
+		$gd_page = 'pt';
1889
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1890
+	}
1891
+	elseif(geodir_is_page('listing')){
1892
+		$gd_page = 'listing';
1893
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1894
+	}
1895
+	elseif(geodir_is_page('location')){
1896
+		$gd_page = 'location';
1897
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1898
+	}
1899
+	elseif(geodir_is_page('search')){
1900
+		$gd_page = 'search';
1901
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1902
+	}
1903
+	elseif(geodir_is_page('add-listing')){
1904
+		$gd_page = 'add-listing';
1905
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1906
+	}
1907
+	elseif(geodir_is_page('author')){
1908
+		$gd_page = 'author';
1909
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1910
+	}
1911
+	elseif(geodir_is_page('login')){
1912
+		$gd_page = 'login';
1913
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1914
+	}
1915
+	elseif(geodir_is_page('listing-success')){
1916
+		$gd_page = 'listing-success';
1917
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1918
+	}
1919 1919
 
1920 1920
 
1921
-    /**
1922
-     * Filter page meta title to replace variables.
1923
-     *
1924
-     * @since 1.5.4
1925
-     * @param string $title The page title including variables.
1926
-     * @param string $gd_page The GeoDirectory page type if any.
1927
-     * @param string $sep The title separator symbol.
1928
-     */
1929
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1921
+	/**
1922
+	 * Filter page meta title to replace variables.
1923
+	 *
1924
+	 * @since 1.5.4
1925
+	 * @param string $title The page title including variables.
1926
+	 * @param string $gd_page The GeoDirectory page type if any.
1927
+	 * @param string $sep The title separator symbol.
1928
+	 */
1929
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1930 1930
 
1931 1931
 }
1932 1932
 
@@ -1942,36 +1942,36 @@  discard block
 block discarded – undo
1942 1942
 function geodir_set_post_attachment()
1943 1943
 {
1944 1944
 
1945
-    if (!get_option('geodir_set_post_attachments')) {
1945
+	if (!get_option('geodir_set_post_attachments')) {
1946 1946
 
1947
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1948
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1947
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1948
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1949 1949
 
1950
-        $all_postypes = geodir_get_posttypes();
1950
+		$all_postypes = geodir_get_posttypes();
1951 1951
 
1952
-        foreach($all_postypes as $post_type){
1953
-            $args = array(
1954
-                'posts_per_page' => -1,
1955
-                'post_type' => $post_type,
1956
-                'post_status' => 'publish');
1952
+		foreach($all_postypes as $post_type){
1953
+			$args = array(
1954
+				'posts_per_page' => -1,
1955
+				'post_type' => $post_type,
1956
+				'post_status' => 'publish');
1957 1957
 
1958
-            $posts_array = get_posts($args);
1958
+			$posts_array = get_posts($args);
1959 1959
 
1960
-            if (!empty($posts_array)) {
1960
+			if (!empty($posts_array)) {
1961 1961
 
1962
-                foreach ($posts_array as $post) {
1962
+				foreach ($posts_array as $post) {
1963 1963
 
1964
-                    geodir_set_wp_featured_image($post->ID);
1964
+					geodir_set_wp_featured_image($post->ID);
1965 1965
 
1966
-                }
1966
+				}
1967 1967
 
1968
-            }
1969
-        }
1968
+			}
1969
+		}
1970 1970
 
1971 1971
 
1972
-        update_option('geodir_set_post_attachments', '1');
1972
+		update_option('geodir_set_post_attachments', '1');
1973 1973
 
1974
-    }
1974
+	}
1975 1975
 
1976 1976
 }
1977 1977
 
@@ -1988,19 +1988,19 @@  discard block
 block discarded – undo
1988 1988
 function geodir_remove_url_seperator()
1989 1989
 {
1990 1990
 
1991
-    if (!get_option('geodir_remove_url_seperator')) {
1991
+	if (!get_option('geodir_remove_url_seperator')) {
1992 1992
 
1993
-        if (get_option('geodir_listingurl_separator'))
1994
-            delete_option('geodir_listingurl_separator');
1993
+		if (get_option('geodir_listingurl_separator'))
1994
+			delete_option('geodir_listingurl_separator');
1995 1995
 
1996
-        if (get_option('geodir_detailurl_separator'))
1997
-            delete_option('geodir_detailurl_separator');
1996
+		if (get_option('geodir_detailurl_separator'))
1997
+			delete_option('geodir_detailurl_separator');
1998 1998
 
1999
-        flush_rewrite_rules(false);
1999
+		flush_rewrite_rules(false);
2000 2000
 
2001
-        update_option('geodir_remove_url_seperator', '1');
2001
+		update_option('geodir_remove_url_seperator', '1');
2002 2002
 
2003
-    }
2003
+	}
2004 2004
 
2005 2005
 }
2006 2006
 
@@ -2016,19 +2016,19 @@  discard block
 block discarded – undo
2016 2016
  */
2017 2017
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
2018 2018
 {
2019
-    foreach ($permalink_arr as $key => $value) {
2019
+	foreach ($permalink_arr as $key => $value) {
2020 2020
 
2021
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2022
-            unset($permalink_arr[$key]);
2021
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2022
+			unset($permalink_arr[$key]);
2023 2023
 
2024
-    }
2024
+	}
2025 2025
 
2026
-    return $permalink_arr;
2026
+	return $permalink_arr;
2027 2027
 
2028 2028
 }
2029 2029
 
2030 2030
 if (!is_admin()) {
2031
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2031
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2032 2032
 }
2033 2033
 /**
2034 2034
  * Set status from draft to publish.
@@ -2041,16 +2041,16 @@  discard block
 block discarded – undo
2041 2041
  */
2042 2042
 function geodir_set_status_draft_to_publish_for_own_post($post)
2043 2043
 {
2044
-    $user_id = get_current_user_id();
2044
+	$user_id = get_current_user_id();
2045 2045
 
2046
-    if(!$user_id){return $post;}
2046
+	if(!$user_id){return $post;}
2047 2047
 
2048
-    $gd_post_types = geodir_get_posttypes();
2048
+	$gd_post_types = geodir_get_posttypes();
2049 2049
 
2050
-    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2051
-        $post[0]->post_status = 'publish';
2052
-    }
2053
-    return $post;
2050
+	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2051
+		$post[0]->post_status = 'publish';
2052
+	}
2053
+	return $post;
2054 2054
 }
2055 2055
 
2056 2056
 
@@ -2142,33 +2142,33 @@  discard block
 block discarded – undo
2142 2142
  */
2143 2143
 function geodir_detail_page_tab_headings_change($tabs_arr)
2144 2144
 {
2145
-    global $wpdb;
2145
+	global $wpdb;
2146 2146
 
2147
-    $post_type = geodir_get_current_posttype();
2147
+	$post_type = geodir_get_current_posttype();
2148 2148
 
2149
-    $all_postypes = geodir_get_posttypes();
2149
+	$all_postypes = geodir_get_posttypes();
2150 2150
 
2151
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2151
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2152 2152
 
2153
-        if (array_key_exists('post_video', $tabs_arr)) {
2153
+		if (array_key_exists('post_video', $tabs_arr)) {
2154 2154
 
2155
-            $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)));
2155
+			$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)));
2156 2156
 
2157
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2158
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2159
-        }
2157
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2158
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2159
+		}
2160 2160
 
2161
-        if (array_key_exists('special_offers', $tabs_arr)) {
2161
+		if (array_key_exists('special_offers', $tabs_arr)) {
2162 2162
 
2163
-            $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)));
2163
+			$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)));
2164 2164
 
2165
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2166
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2167
-        }
2165
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2166
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2167
+		}
2168 2168
 
2169
-    }
2169
+	}
2170 2170
 
2171
-    return $tabs_arr;
2171
+	return $tabs_arr;
2172 2172
 
2173 2173
 }
2174 2174
 
@@ -2181,10 +2181,10 @@  discard block
 block discarded – undo
2181 2181
  */
2182 2182
 function geodir_remove_template_redirect_actions()
2183 2183
 {
2184
-    if (geodir_is_page('login')){
2185
-        remove_all_actions('template_redirect');
2186
-        remove_action('init', 'avia_modify_front', 10);
2187
-    }
2184
+	if (geodir_is_page('login')){
2185
+		remove_all_actions('template_redirect');
2186
+		remove_action('init', 'avia_modify_front', 10);
2187
+	}
2188 2188
 }
2189 2189
 
2190 2190
 
@@ -2206,51 +2206,51 @@  discard block
 block discarded – undo
2206 2206
 function geodirectory_before_featured_image_delete($attachment_id)
2207 2207
 {
2208 2208
 
2209
-    global $wpdb, $plugin_prefix;
2209
+	global $wpdb, $plugin_prefix;
2210 2210
 
2211
-    $post_id = get_post_field('post_parent', $attachment_id);
2211
+	$post_id = get_post_field('post_parent', $attachment_id);
2212 2212
 
2213
-    $attachment_url = wp_get_attachment_url($attachment_id);
2213
+	$attachment_url = wp_get_attachment_url($attachment_id);
2214 2214
 
2215
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2215
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2216 2216
 
2217
-        $post_type = get_post_type($post_id);
2217
+		$post_type = get_post_type($post_id);
2218 2218
 
2219
-        $all_postypes = geodir_get_posttypes();
2219
+		$all_postypes = geodir_get_posttypes();
2220 2220
 
2221
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2222
-            return false;
2221
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2222
+			return false;
2223 2223
 
2224
-        $uploads = wp_upload_dir();
2224
+		$uploads = wp_upload_dir();
2225 2225
 
2226
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2226
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2227 2227
 
2228
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2228
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2229 2229
 
2230
-        $wpdb->query(
2231
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2232
-                array($post_id, $split_img_file_path)
2233
-            )
2234
-        );
2230
+		$wpdb->query(
2231
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2232
+				array($post_id, $split_img_file_path)
2233
+			)
2234
+		);
2235 2235
 
2236
-        $attachment_data = $wpdb->get_row(
2237
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2238
-                array($post_id)
2239
-            )
2240
-        );
2236
+		$attachment_data = $wpdb->get_row(
2237
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2238
+				array($post_id)
2239
+			)
2240
+		);
2241 2241
 
2242
-        if (!empty($attachment_data)) {
2243
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2244
-        }
2242
+		if (!empty($attachment_data)) {
2243
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2244
+		}
2245 2245
 
2246 2246
 
2247
-        $table_name = $plugin_prefix . $post_type . '_detail';
2247
+		$table_name = $plugin_prefix . $post_type . '_detail';
2248 2248
 
2249
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2249
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2250 2250
 
2251
-        geodir_set_wp_featured_image($post_id);
2251
+		geodir_set_wp_featured_image($post_id);
2252 2252
 
2253
-    }
2253
+	}
2254 2254
 
2255 2255
 }
2256 2256
 
@@ -2268,79 +2268,79 @@  discard block
 block discarded – undo
2268 2268
 function geodir_temp_set_post_attachment()
2269 2269
 {
2270 2270
 
2271
-    global $wpdb, $plugin_prefix;
2271
+	global $wpdb, $plugin_prefix;
2272 2272
 
2273
-    $all_postypes = geodir_get_posttypes();
2273
+	$all_postypes = geodir_get_posttypes();
2274 2274
 
2275
-    foreach ($all_postypes as $posttype) {
2275
+	foreach ($all_postypes as $posttype) {
2276 2276
 
2277
-        $tablename = $plugin_prefix . $posttype . '_detail';
2277
+		$tablename = $plugin_prefix . $posttype . '_detail';
2278 2278
 
2279
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2279
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2280 2280
 
2281
-        if (!empty($get_post_data)) {
2281
+		if (!empty($get_post_data)) {
2282 2282
 
2283
-            foreach ($get_post_data as $data) {
2283
+			foreach ($get_post_data as $data) {
2284 2284
 
2285
-                $post_id = $data->post_id;
2285
+				$post_id = $data->post_id;
2286 2286
 
2287
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2287
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2288 2288
 
2289
-                if (!empty($attachment_data)) {
2289
+				if (!empty($attachment_data)) {
2290 2290
 
2291
-                    foreach ($attachment_data as $attach) {
2291
+					foreach ($attachment_data as $attach) {
2292 2292
 
2293
-                        $file_info = pathinfo($attach->file);
2293
+						$file_info = pathinfo($attach->file);
2294 2294
 
2295
-                        $sub_dir = '';
2296
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2297
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2295
+						$sub_dir = '';
2296
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2297
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2298 2298
 
2299
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2300
-                        $uploads_path = $uploads['basedir'];
2299
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2300
+						$uploads_path = $uploads['basedir'];
2301 2301
 
2302
-                        $file_name = $file_info['basename'];
2302
+						$file_name = $file_info['basename'];
2303 2303
 
2304
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2304
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2305 2305
 
2306
-                        if (!file_exists($img_arr['path'])) {
2306
+						if (!file_exists($img_arr['path'])) {
2307 2307
 
2308
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2308
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2309 2309
 
2310
-                        }
2310
+						}
2311 2311
 
2312
-                    }
2312
+					}
2313 2313
 
2314
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2314
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2315 2315
 
2316
-                    if (!empty($attachment_data)) {
2316
+					if (!empty($attachment_data)) {
2317 2317
 
2318
-                        if ($attachment_data->ID)
2319
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2318
+						if ($attachment_data->ID)
2319
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2320 2320
 
2321
-                    } else {
2321
+					} else {
2322 2322
 
2323
-                        if (has_post_thumbnail($post_id)) {
2323
+						if (has_post_thumbnail($post_id)) {
2324 2324
 
2325
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2325
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2326 2326
 
2327
-                            wp_delete_attachment($post_thumbnail_id);
2327
+							wp_delete_attachment($post_thumbnail_id);
2328 2328
 
2329
-                        }
2329
+						}
2330 2330
 
2331
-                    }
2331
+					}
2332 2332
 
2333
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2333
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2334 2334
 
2335
-                    geodir_set_wp_featured_image($post_id);
2335
+					geodir_set_wp_featured_image($post_id);
2336 2336
 
2337
-                }
2337
+				}
2338 2338
 
2339
-            }
2339
+			}
2340 2340
 
2341
-        }
2341
+		}
2342 2342
 
2343
-    }
2343
+	}
2344 2344
 
2345 2345
 }
2346 2346
 
@@ -2358,9 +2358,9 @@  discard block
 block discarded – undo
2358 2358
 function geodir_default_rating_star_icon()
2359 2359
 {
2360 2360
 
2361
-    if (!get_option('geodir_default_rating_star_icon')) {
2362
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2363
-    }
2361
+	if (!get_option('geodir_default_rating_star_icon')) {
2362
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2363
+	}
2364 2364
 
2365 2365
 }
2366 2366
 
@@ -2378,27 +2378,27 @@  discard block
 block discarded – undo
2378 2378
  */
2379 2379
 function geodir_user_post_listing_count($user_id=null)
2380 2380
 {
2381
-    global $wpdb, $plugin_prefix, $current_user;
2382
-    if(!$user_id){
2383
-        $user_id = $current_user->ID;
2384
-    }
2381
+	global $wpdb, $plugin_prefix, $current_user;
2382
+	if(!$user_id){
2383
+		$user_id = $current_user->ID;
2384
+	}
2385 2385
 
2386
-    $user_id = $current_user->ID;
2387
-    $all_postypes = geodir_get_posttypes();
2388
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2386
+	$user_id = $current_user->ID;
2387
+	$all_postypes = geodir_get_posttypes();
2388
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2389 2389
 
2390
-    $user_listing = array();
2391
-    if (is_array($all_posts) && !empty($all_posts)) {
2392
-        foreach ($all_posts as $ptype) {
2393
-            $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' )");
2390
+	$user_listing = array();
2391
+	if (is_array($all_posts) && !empty($all_posts)) {
2392
+		foreach ($all_posts as $ptype) {
2393
+			$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' )");
2394 2394
 
2395
-            if ($total_posts > 0) {
2396
-                $user_listing[$ptype] = $total_posts;
2397
-            }
2398
-        }
2399
-    }
2395
+			if ($total_posts > 0) {
2396
+				$user_listing[$ptype] = $total_posts;
2397
+			}
2398
+		}
2399
+	}
2400 2400
 
2401
-    return $user_listing;
2401
+	return $user_listing;
2402 2402
 }
2403 2403
 
2404 2404
 
@@ -2418,170 +2418,170 @@  discard block
 block discarded – undo
2418 2418
  */
2419 2419
 function geodir_detail_page_custom_field_tab($tabs_arr)
2420 2420
 {
2421
-    global $post;
2421
+	global $post;
2422 2422
 
2423
-    $post_type = geodir_get_current_posttype();
2424
-    $all_postypes = geodir_get_posttypes();
2423
+	$post_type = geodir_get_current_posttype();
2424
+	$all_postypes = geodir_get_posttypes();
2425 2425
 
2426
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2427
-        $package_info = array();
2428
-        $package_info = geodir_post_package_info($package_info, $post);
2429
-        $post_package_id = $package_info->pid;
2430
-        $fields_location = 'owntab';
2426
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2427
+		$package_info = array();
2428
+		$package_info = geodir_post_package_info($package_info, $post);
2429
+		$post_package_id = $package_info->pid;
2430
+		$fields_location = 'owntab';
2431 2431
 
2432
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'custom', $post_type, $fields_location);
2432
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'custom', $post_type, $fields_location);
2433 2433
 
2434 2434
 
2435 2435
 
2436
-        if (!empty($custom_fields)) {
2437
-            $parse_custom_fields = array();
2438
-            foreach ($custom_fields as $field) {
2439
-                $field = stripslashes_deep($field); // strip slashes
2436
+		if (!empty($custom_fields)) {
2437
+			$parse_custom_fields = array();
2438
+			foreach ($custom_fields as $field) {
2439
+				$field = stripslashes_deep($field); // strip slashes
2440 2440
                 
2441
-                $type = $field;
2442
-                $field_name = $field['htmlvar_name'];
2443
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2444
-                    $post->{$field_name} = $_REQUEST[$field_name];
2445
-                }
2446
-
2447
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2448
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2449
-                        continue;
2450
-                    }
2451
-
2452
-                    $parse_custom_fields[] = $field;
2453
-                }
2454
-            }
2455
-            $custom_fields = $parse_custom_fields;
2456
-        }
2457
-        //print_r($custom_fields);
2458
-        if (!empty($custom_fields)) {
2441
+				$type = $field;
2442
+				$field_name = $field['htmlvar_name'];
2443
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2444
+					$post->{$field_name} = $_REQUEST[$field_name];
2445
+				}
2446
+
2447
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2448
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2449
+						continue;
2450
+					}
2451
+
2452
+					$parse_custom_fields[] = $field;
2453
+				}
2454
+			}
2455
+			$custom_fields = $parse_custom_fields;
2456
+		}
2457
+		//print_r($custom_fields);
2458
+		if (!empty($custom_fields)) {
2459 2459
 
2460
-            global $field_set_start;
2460
+			global $field_set_start;
2461 2461
 
2462
-            $post = stripslashes_deep($post); // strip slashes
2462
+			$post = stripslashes_deep($post); // strip slashes
2463 2463
             
2464
-            $field_set_start = 0;
2465
-            $fieldset_count = 0;
2466
-            $fieldset = '';
2467
-            $total_fields = count($custom_fields);
2468
-            $count_field = 0;
2469
-            $fieldset_arr = array();
2470
-            $i = 0;
2471
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2472
-
2473
-            foreach ($custom_fields as $field) {
2474
-                $count_field++;
2475
-                $field_name = $field['htmlvar_name'];
2476
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2477
-                    $post->{$field_name} = $_REQUEST[$field_name];
2478
-                }
2479
-
2480
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2481
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2482
-                    $site_title = trim($field['site_title']);
2483
-                    $type = $field;
2484
-                    $variables_array = array();
2485
-
2486
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2487
-                        continue;
2488
-                    }
2489
-
2490
-                    if ($type['type'] != 'fieldset') {
2491
-                        $i++;
2492
-                        $variables_array['post_id'] = $post->ID;
2493
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2494
-                        $variables_array['value'] = '';
2495
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
2496
-                    }else{
2497
-                        $i = 0;
2498
-                        $fieldset_count++;
2499
-                        $field_set_start = 1;
2500
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2501
-                        $fieldset_arr[$fieldset_count]['label'] = $label;
2502
-                    }
2503
-
2504
-
2505
-                    $type = stripslashes_deep($type); // strip slashes
2506
-                    $html = '';
2507
-                    $html_var = '';
2508
-                    $field_icon = geodir_field_icon_proccess($type);
2509
-                    $filed_type = $type['type'];
2510
-
2511
-                    /**
2512
-                     * Filter the output for custom fields.
2513
-                     *
2514
-                     * Here we can remove or add new functions depending on the field type.
2515
-                     *
2516
-                     * @param string $html The html to be filtered (blank).
2517
-                     * @param string $fields_location The location the field is to be show.
2518
-                     * @param array $type The array of field values.
2519
-                     */
2520
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2521
-
2522
-
2523
-                    /**
2524
-                     * Filter custom field output in tab.
2525
-                     *
2526
-                     * @since 1.5.6
2527
-                     *
2528
-                     * @param string $html_var The HTML variable name for the field.
2529
-                     * @param string $html Custom field unfiltered HTML.
2530
-                     * @param array $variables_array Custom field variables array.
2531
-                     */
2532
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2533
-
2534
-                    $fieldset_html = '';
2535
-                    if ($field_set_start == 1) {
2536
-                        $add_html = false;
2537
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2538
-                            if ($fieldset != '') {
2539
-                                $add_html = true;
2540
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2541
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2542
-                            }
2543
-                            $fieldset_html = $fieldset;
2544
-                            $fieldset = '';
2545
-                        } else {
2546
-                            $fieldset .= $html;
2547
-                            if ($total_fields == $count_field && $fieldset != '') {
2548
-                                $add_html = true;
2549
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2550
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2551
-                                $fieldset_html = $fieldset;
2552
-                            }
2553
-                        }
2554
-
2555
-                        if ($add_html) {
2556
-                            $tabs_arr[$htmlvar_name] = array(
2557
-                                'heading_text' => __($label, 'geodirectory'),
2558
-                                'is_active_tab' => false,
2559
-                                /**
2560
-                                 * Filter if a custom field should be displayed on the details page tab.
2561
-                                 *
2562
-                                 * @since 1.0.0
2563
-                                 * @param string $htmlvar_name The field HTML var name.
2564
-                                 */
2565
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2566
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2567
-                            );
2568
-                        }
2569
-                    } else {
2570
-                        if ($html != '') {
2571
-                            $tabs_arr[$field['htmlvar_name']] = array(
2572
-                                'heading_text' => __($label, 'geodirectory'),
2573
-                                'is_active_tab' => false,
2574
-                                /** This action is documented in geodirectory_hooks_actions.php */
2575
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2576
-                                'tab_content' => $html
2577
-                            );
2578
-                        }
2579
-                    }
2580
-                }
2581
-            }
2582
-        }
2583
-    }
2584
-    return $tabs_arr;
2464
+			$field_set_start = 0;
2465
+			$fieldset_count = 0;
2466
+			$fieldset = '';
2467
+			$total_fields = count($custom_fields);
2468
+			$count_field = 0;
2469
+			$fieldset_arr = array();
2470
+			$i = 0;
2471
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2472
+
2473
+			foreach ($custom_fields as $field) {
2474
+				$count_field++;
2475
+				$field_name = $field['htmlvar_name'];
2476
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2477
+					$post->{$field_name} = $_REQUEST[$field_name];
2478
+				}
2479
+
2480
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2481
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2482
+					$site_title = trim($field['site_title']);
2483
+					$type = $field;
2484
+					$variables_array = array();
2485
+
2486
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2487
+						continue;
2488
+					}
2489
+
2490
+					if ($type['type'] != 'fieldset') {
2491
+						$i++;
2492
+						$variables_array['post_id'] = $post->ID;
2493
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2494
+						$variables_array['value'] = '';
2495
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
2496
+					}else{
2497
+						$i = 0;
2498
+						$fieldset_count++;
2499
+						$field_set_start = 1;
2500
+						$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2501
+						$fieldset_arr[$fieldset_count]['label'] = $label;
2502
+					}
2503
+
2504
+
2505
+					$type = stripslashes_deep($type); // strip slashes
2506
+					$html = '';
2507
+					$html_var = '';
2508
+					$field_icon = geodir_field_icon_proccess($type);
2509
+					$filed_type = $type['type'];
2510
+
2511
+					/**
2512
+					 * Filter the output for custom fields.
2513
+					 *
2514
+					 * Here we can remove or add new functions depending on the field type.
2515
+					 *
2516
+					 * @param string $html The html to be filtered (blank).
2517
+					 * @param string $fields_location The location the field is to be show.
2518
+					 * @param array $type The array of field values.
2519
+					 */
2520
+					$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2521
+
2522
+
2523
+					/**
2524
+					 * Filter custom field output in tab.
2525
+					 *
2526
+					 * @since 1.5.6
2527
+					 *
2528
+					 * @param string $html_var The HTML variable name for the field.
2529
+					 * @param string $html Custom field unfiltered HTML.
2530
+					 * @param array $variables_array Custom field variables array.
2531
+					 */
2532
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2533
+
2534
+					$fieldset_html = '';
2535
+					if ($field_set_start == 1) {
2536
+						$add_html = false;
2537
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2538
+							if ($fieldset != '') {
2539
+								$add_html = true;
2540
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2541
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2542
+							}
2543
+							$fieldset_html = $fieldset;
2544
+							$fieldset = '';
2545
+						} else {
2546
+							$fieldset .= $html;
2547
+							if ($total_fields == $count_field && $fieldset != '') {
2548
+								$add_html = true;
2549
+								$label = $fieldset_arr[$fieldset_count]['label'];
2550
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2551
+								$fieldset_html = $fieldset;
2552
+							}
2553
+						}
2554
+
2555
+						if ($add_html) {
2556
+							$tabs_arr[$htmlvar_name] = array(
2557
+								'heading_text' => __($label, 'geodirectory'),
2558
+								'is_active_tab' => false,
2559
+								/**
2560
+								 * Filter if a custom field should be displayed on the details page tab.
2561
+								 *
2562
+								 * @since 1.0.0
2563
+								 * @param string $htmlvar_name The field HTML var name.
2564
+								 */
2565
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2566
+								'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2567
+							);
2568
+						}
2569
+					} else {
2570
+						if ($html != '') {
2571
+							$tabs_arr[$field['htmlvar_name']] = array(
2572
+								'heading_text' => __($label, 'geodirectory'),
2573
+								'is_active_tab' => false,
2574
+								/** This action is documented in geodirectory_hooks_actions.php */
2575
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2576
+								'tab_content' => $html
2577
+							);
2578
+						}
2579
+					}
2580
+				}
2581
+			}
2582
+		}
2583
+	}
2584
+	return $tabs_arr;
2585 2585
 }
2586 2586
 
2587 2587
 /* display add listing page for wpml */
@@ -2605,37 +2605,37 @@  discard block
 block discarded – undo
2605 2605
  */
2606 2606
 function geodir_add_post_status_author_page()
2607 2607
 {
2608
-    global $wpdb, $post;
2609
-
2610
-    $html = '';
2611
-    if (get_current_user_id()) {
2612
-        if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2613
-
2614
-            // 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.
2615
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2616
-            $status = "<strong>(";
2617
-            $status_icon = '<i class="fa fa-play"></i>';
2618
-            if ($real_status == 'publish') {
2619
-                $status .= __('Published', 'geodirectory');
2620
-            } else {
2621
-                $status .= __('Not published', 'geodirectory');
2622
-                $status_icon = '<i class="fa fa-pause"></i>';
2623
-            }
2624
-            $status .= ")</strong>";
2608
+	global $wpdb, $post;
2609
+
2610
+	$html = '';
2611
+	if (get_current_user_id()) {
2612
+		if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2613
+
2614
+			// 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.
2615
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2616
+			$status = "<strong>(";
2617
+			$status_icon = '<i class="fa fa-play"></i>';
2618
+			if ($real_status == 'publish') {
2619
+				$status .= __('Published', 'geodirectory');
2620
+			} else {
2621
+				$status .= __('Not published', 'geodirectory');
2622
+				$status_icon = '<i class="fa fa-pause"></i>';
2623
+			}
2624
+			$status .= ")</strong>";
2625 2625
 
2626
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2627
-        }
2628
-    }
2626
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2627
+		}
2628
+	}
2629 2629
 
2630
-    if ($html != '') {
2631
-        /**
2632
-         * Filter the post status text on the author page.
2633
-         *
2634
-         * @since 1.0.0
2635
-         * @param string $html The HTML of the status.
2636
-         */
2637
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2638
-    }
2630
+	if ($html != '') {
2631
+		/**
2632
+		 * Filter the post status text on the author page.
2633
+		 *
2634
+		 * @since 1.0.0
2635
+		 * @param string $html The HTML of the status.
2636
+		 */
2637
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2638
+	}
2639 2639
 
2640 2640
 
2641 2641
 }
@@ -2649,21 +2649,21 @@  discard block
 block discarded – undo
2649 2649
  */
2650 2650
 function geodir_init_no_rating()
2651 2651
 {
2652
-    if (get_option('geodir_disable_rating')) {
2653
-        remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
2654
-        remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
2655
-        remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
2656
-        remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
2657
-        remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
2658
-        remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
2659
-        remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
2660
-
2661
-        add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
2662
-        add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
2663
-        add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
2664
-        add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
2665
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2666
-    }
2652
+	if (get_option('geodir_disable_rating')) {
2653
+		remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
2654
+		remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
2655
+		remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
2656
+		remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
2657
+		remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
2658
+		remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
2659
+		remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
2660
+
2661
+		add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
2662
+		add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
2663
+		add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
2664
+		add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
2665
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2666
+	}
2667 2667
 }
2668 2668
 
2669 2669
 /**
@@ -2675,20 +2675,20 @@  discard block
 block discarded – undo
2675 2675
  */
2676 2676
 function geodir_no_rating_rating_fields()
2677 2677
 {
2678
-    global $post;
2678
+	global $post;
2679 2679
 
2680
-    $post_types = geodir_get_posttypes();
2680
+	$post_types = geodir_get_posttypes();
2681 2681
 
2682
-    if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
2683
-        if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
2684
-            echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
2685
-            if (get_option('geodir_reviewrating_enable_images')) {
2686
-                geodir_reviewrating_rating_img_html();
2687
-            }
2688
-        } else {
2689
-            echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
2690
-        }
2691
-    }
2682
+	if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
2683
+		if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
2684
+			echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
2685
+			if (get_option('geodir_reviewrating_enable_images')) {
2686
+				geodir_reviewrating_rating_img_html();
2687
+			}
2688
+		} else {
2689
+			echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
2690
+		}
2691
+	}
2692 2692
 }
2693 2693
 
2694 2694
 /**
@@ -2702,11 +2702,11 @@  discard block
 block discarded – undo
2702 2702
  */
2703 2703
 function geodir_no_rating_comment_text($content, $comment = '')
2704 2704
 {
2705
-    if (!is_admin()) {
2706
-        return '<div class="description">' . $content . '</div>';
2707
-    } else {
2708
-        return $content;
2709
-    }
2705
+	if (!is_admin()) {
2706
+		return '<div class="description">' . $content . '</div>';
2707
+	} else {
2708
+		return $content;
2709
+	}
2710 2710
 }
2711 2711
 
2712 2712
 /**
@@ -2719,7 +2719,7 @@  discard block
 block discarded – undo
2719 2719
  */
2720 2720
 function geodir_no_rating_review_rating_html($content = '')
2721 2721
 {
2722
-    return NULL;
2722
+	return NULL;
2723 2723
 }
2724 2724
 
2725 2725
 /**
@@ -2733,19 +2733,19 @@  discard block
 block discarded – undo
2733 2733
  */
2734 2734
 function geodir_no_rating_get_sort_options($options, $post_type = '')
2735 2735
 {
2736
-    $new_options = array();
2737
-    if (!empty($options)) {
2738
-        foreach ($options as $option) {
2739
-            if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2740
-                continue;
2741
-            }
2742
-            $new_options[] = $option;
2743
-        }
2736
+	$new_options = array();
2737
+	if (!empty($options)) {
2738
+		foreach ($options as $option) {
2739
+			if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2740
+				continue;
2741
+			}
2742
+			$new_options[] = $option;
2743
+		}
2744 2744
 
2745
-        $options = $new_options;
2746
-    }
2745
+		$options = $new_options;
2746
+	}
2747 2747
 
2748
-    return $options;
2748
+	return $options;
2749 2749
 }
2750 2750
 
2751 2751
 add_filter('geodir_all_js_msg', 'geodir_all_js_msg_no_rating', 100);
@@ -2759,11 +2759,11 @@  discard block
 block discarded – undo
2759 2759
  */
2760 2760
 function geodir_all_js_msg_no_rating($msg = array())
2761 2761
 {
2762
-    if (get_option('geodir_disable_rating')) {
2763
-        $msg['gd_cmt_no_rating'] = true;
2764
-    }
2762
+	if (get_option('geodir_disable_rating')) {
2763
+		$msg['gd_cmt_no_rating'] = true;
2764
+	}
2765 2765
 
2766
-    return $msg;
2766
+	return $msg;
2767 2767
 }
2768 2768
 
2769 2769
 add_filter('body_class', 'geodir_body_class_no_rating', 100);
@@ -2777,13 +2777,13 @@  discard block
 block discarded – undo
2777 2777
  */
2778 2778
 function geodir_body_class_no_rating($classes = array())
2779 2779
 {
2780
-    if (get_option('geodir_disable_rating')) {
2781
-        $classes[] = 'gd-no-rating';
2782
-    }
2780
+	if (get_option('geodir_disable_rating')) {
2781
+		$classes[] = 'gd-no-rating';
2782
+	}
2783 2783
     
2784
-    $classes[] = 'gd-map-' . geodir_map_name();
2784
+	$classes[] = 'gd-map-' . geodir_map_name();
2785 2785
 
2786
-    return $classes;
2786
+	return $classes;
2787 2787
 }
2788 2788
 
2789 2789
 add_filter('admin_body_class', 'geodir_admin_body_class_no_rating', 100);
@@ -2797,13 +2797,13 @@  discard block
 block discarded – undo
2797 2797
  */
2798 2798
 function geodir_admin_body_class_no_rating($class = '')
2799 2799
 {
2800
-    if (get_option('geodir_disable_rating')) {
2801
-        $class .= ' gd-no-rating';
2802
-    }
2800
+	if (get_option('geodir_disable_rating')) {
2801
+		$class .= ' gd-no-rating';
2802
+	}
2803 2803
     
2804
-    $class .= ' gd-map-' . geodir_map_name();
2804
+	$class .= ' gd-map-' . geodir_map_name();
2805 2805
 
2806
-    return $class;
2806
+	return $class;
2807 2807
 }
2808 2808
 
2809 2809
 add_action('wp_head', 'geodir_wp_head_no_rating');
@@ -2816,10 +2816,10 @@  discard block
 block discarded – undo
2816 2816
  */
2817 2817
 function geodir_wp_head_no_rating()
2818 2818
 {
2819
-    if (get_option('geodir_disable_rating')) {
2820
-        echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
2821
-        echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
2822
-    }
2819
+	if (get_option('geodir_disable_rating')) {
2820
+		echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
2821
+		echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
2822
+	}
2823 2823
 }
2824 2824
 
2825 2825
 add_filter('geodir_load_db_language', 'geodir_load_custom_field_translation');
@@ -2836,36 +2836,36 @@  discard block
 block discarded – undo
2836 2836
  * @return array Translation texts.
2837 2837
  */
2838 2838
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2839
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2840
-
2841
-    $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');
2842
-
2843
-    /**
2844
-     * Filters the geodirectory option names that requires to add for translation.
2845
-     *
2846
-     * @since 1.5.7
2847
-     * @package GeoDirectory
2848
-     *
2849
-     * @param  array $gd_options Array of option names.
2850
-     */
2851
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2852
-    $gd_options = array_unique($gd_options);
2853
-
2854
-    if (!empty($gd_options)) {
2855
-        foreach ($gd_options as $gd_option) {
2856
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
2857
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2839
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2840
+
2841
+	$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');
2842
+
2843
+	/**
2844
+	 * Filters the geodirectory option names that requires to add for translation.
2845
+	 *
2846
+	 * @since 1.5.7
2847
+	 * @package GeoDirectory
2848
+	 *
2849
+	 * @param  array $gd_options Array of option names.
2850
+	 */
2851
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2852
+	$gd_options = array_unique($gd_options);
2853
+
2854
+	if (!empty($gd_options)) {
2855
+		foreach ($gd_options as $gd_option) {
2856
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
2857
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2858 2858
                 
2859
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2860
-                    $translation_texts[] = stripslashes_deep($option_value);
2861
-                }
2862
-            }
2863
-        }
2864
-    }
2859
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2860
+					$translation_texts[] = stripslashes_deep($option_value);
2861
+				}
2862
+			}
2863
+		}
2864
+	}
2865 2865
 
2866
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2866
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2867 2867
 
2868
-    return $translation_texts;
2868
+	return $translation_texts;
2869 2869
 }
2870 2870
 
2871 2871
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -2879,15 +2879,15 @@  discard block
 block discarded – undo
2879 2879
 
2880 2880
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
2881 2881
 function gd_get_comments_link($comments_link, $post_id) {
2882
-    $post_type = get_post_type($post_id);
2882
+	$post_type = get_post_type($post_id);
2883 2883
 
2884
-    $all_postypes = geodir_get_posttypes();
2885
-    if (in_array($post_type, $all_postypes)) {
2886
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
2887
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
2888
-    }
2884
+	$all_postypes = geodir_get_posttypes();
2885
+	if (in_array($post_type, $all_postypes)) {
2886
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
2887
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
2888
+	}
2889 2889
 
2890
-    return $comments_link;
2890
+	return $comments_link;
2891 2891
 }
2892 2892
 
2893 2893
 
@@ -2905,11 +2905,11 @@  discard block
 block discarded – undo
2905 2905
 function geodir_add_nav_menu_class( $args )
2906 2906
 {
2907 2907
 
2908
-        if(isset($args['menu_class'])){
2909
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
2910
-        }
2908
+		if(isset($args['menu_class'])){
2909
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
2910
+		}
2911 2911
     
2912
-    return $args;
2912
+	return $args;
2913 2913
 }
2914 2914
 
2915 2915
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
2916 2916
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 /* ON TEMPLATE INCLUDE */
137 137
 /////////////////////////
138 138
 
139
-add_filter('template_include', 'geodir_template_loader',9);
139
+add_filter('template_include', 'geodir_template_loader', 9);
140 140
 
141 141
 /////////////////////////
142 142
 /* CATEGORY / TAXONOMY / CUSTOM POST ACTIONS */
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 /* WP REVIEW COUNT ACTIONS */
177 177
 ////////////////////////
178 178
 
179
-add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100,1);
179
+add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100, 1);
180 180
 //add_action('geodir_update_postrating', 'geodir_term_review_count_force_update', 100);
181
-add_action('transition_post_status', 'geodir_term_review_count_force_update', 100,3);
181
+add_action('transition_post_status', 'geodir_term_review_count_force_update', 100, 3);
182 182
 //add_action('created_term', 'geodir_term_review_count_force_update', 100);
183 183
 add_action('edited_term', 'geodir_term_review_count_force_update', 100);
184 184
 add_action('delete_term', 'geodir_term_review_count_force_update', 100);
@@ -222,7 +222,7 @@  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);
225
+    $geodir_theme_location = get_option('geodir_theme_location_nav_'.$newname);
226 226
     if ($geodir_theme_location) {
227 227
         update_option('geodir_theme_location_nav', $geodir_theme_location);
228 228
     } else {
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 
321 321
 /////// GEO DIRECOTORY CUSTOM HOOKS ///
322 322
 
323
-add_action('geodir_before_tab_content', 'geodir_before_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content 
324
-add_action('geodir_after_tab_content', 'geodir_after_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content
323
+add_action('geodir_before_tab_content', 'geodir_before_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content 
324
+add_action('geodir_after_tab_content', 'geodir_after_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content
325 325
 
326 326
 // Detail page sidebar content 
327 327
 add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1);
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
     do_action('geodir_after_social_sharing_buttons');
423 423
     $content_html = ob_get_clean();
424 424
     if (trim($content_html) != '')
425
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
425
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>';
426
+    if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) {
427 427
         /**
428 428
          * Filter the geodir_social_sharing_buttons() function content.
429 429
          *
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
     do_action('geodir_after_share_this_button');
470 470
     $content_html = ob_get_clean();
471 471
     if (trim($content_html) != '')
472
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
-    if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
472
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">'.$content_html.'</div>';
473
+    if ((int) get_option('geodir_disable_sharethis_button_section') != 1) {
474 474
         /**
475 475
          * Filter the geodir_share_this_button() function content.
476 476
          *
@@ -509,12 +509,12 @@  discard block
 block discarded – undo
509 509
             $post_id = $post->ID;
510 510
             
511 511
             if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
512
-                $post_id = (int)$_REQUEST['pid'];
512
+                $post_id = (int) $_REQUEST['pid'];
513 513
             }
514 514
 
515 515
             $postlink = get_permalink(geodir_add_listing_page_id());
516 516
             $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
517
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
517
+            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>';
518 518
         }
519 519
     }// end of if, if its a preview or not
520 520
     /**
@@ -525,8 +525,8 @@  discard block
 block discarded – undo
525 525
     do_action('geodir_after_edit_post_link');
526 526
     $content_html = ob_get_clean();
527 527
     if (trim($content_html) != '')
528
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
528
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>';
529
+    if ((int) get_option('geodir_disable_user_links_section') != 1) {
530 530
         /**
531 531
          * Filter the geodir_edit_post_link() function content.
532 532
          *
@@ -579,14 +579,14 @@  discard block
 block discarded – undo
579 579
     $hide_refresh = get_option('geodir_ga_auto_refresh');
580 580
     
581 581
     $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
582
-    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' )) ) {
582
+    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'))) {
583 583
         $page_url = urlencode($_SERVER['REQUEST_URI']);
584 584
         ?>
585 585
         <script type="text/javascript">
586 586
             var gd_gaTimeOut;
587
-            var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
588
-            var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>;
589
-            var gd_gaAutoRefresh = <?php echo $auto_refresh;?>;
587
+            var gd_gaTime = parseInt('<?php echo $refresh_time; ?>');
588
+            var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>;
589
+            var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>;
590 590
             ga_data1 = false;
591 591
             ga_data2 = false;
592 592
             ga_data3 = false;
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
             }
728 728
 
729 729
             function gdga_noResults() {
730
-                jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>');
730
+                jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>');
731 731
                 jQuery('#gdga-legend-container').html('');
732 732
             }
733 733
 
@@ -759,18 +759,18 @@  discard block
 block discarded – undo
759 759
                     var data2 = results[1].rows.map(function(row) { return +row[2]; });
760 760
                     //var labelsN = results[0].rows.map(function(row) { return +row[1]; });
761 761
 
762
-                    var labels = ['<?php _e('Jan', 'geodirectory');?>',
763
-                        '<?php _e('Feb', 'geodirectory');?>',
764
-                        '<?php _e('Mar', 'geodirectory');?>',
765
-                        '<?php _e('Apr', 'geodirectory');?>',
766
-                        '<?php _e('May', 'geodirectory');?>',
767
-                        '<?php _e('Jun', 'geodirectory');?>',
768
-                        '<?php _e('Jul', 'geodirectory');?>',
769
-                        '<?php _e('Aug', 'geodirectory');?>',
770
-                        '<?php _e('Sep', 'geodirectory');?>',
771
-                        '<?php _e('Oct', 'geodirectory');?>',
772
-                        '<?php _e('Nov', 'geodirectory');?>',
773
-                        '<?php _e('Dec', 'geodirectory');?>'];
762
+                    var labels = ['<?php _e('Jan', 'geodirectory'); ?>',
763
+                        '<?php _e('Feb', 'geodirectory'); ?>',
764
+                        '<?php _e('Mar', 'geodirectory'); ?>',
765
+                        '<?php _e('Apr', 'geodirectory'); ?>',
766
+                        '<?php _e('May', 'geodirectory'); ?>',
767
+                        '<?php _e('Jun', 'geodirectory'); ?>',
768
+                        '<?php _e('Jul', 'geodirectory'); ?>',
769
+                        '<?php _e('Aug', 'geodirectory'); ?>',
770
+                        '<?php _e('Sep', 'geodirectory'); ?>',
771
+                        '<?php _e('Oct', 'geodirectory'); ?>',
772
+                        '<?php _e('Nov', 'geodirectory'); ?>',
773
+                        '<?php _e('Dec', 'geodirectory'); ?>'];
774 774
 
775 775
                     // Ensure the data arrays are at least as long as the labels array.
776 776
                     // Chart.js bar charts don't (yet) accept sparse datasets.
@@ -783,13 +783,13 @@  discard block
 block discarded – undo
783 783
                         labels : labels,
784 784
                         datasets : [
785 785
                             {
786
-                                label: '<?php _e('Last Year', 'geodirectory');?>',
786
+                                label: '<?php _e('Last Year', 'geodirectory'); ?>',
787 787
                                 fillColor : "rgba(220,220,220,0.5)",
788 788
                                 strokeColor : "rgba(220,220,220,1)",
789 789
                                 data : data2
790 790
                             },
791 791
                             {
792
-                                label: '<?php _e('This Year', 'geodirectory');?>',
792
+                                label: '<?php _e('This Year', 'geodirectory'); ?>',
793 793
                                 fillColor : "rgba(151,187,205,0.5)",
794 794
                                 strokeColor : "rgba(151,187,205,1)",
795 795
                                 data : data1
@@ -834,30 +834,30 @@  discard block
 block discarded – undo
834 834
 
835 835
                     <?php
836 836
                     // Here we list the shorthand days of the week so it can be used in translation.
837
-                    __("Mon",'geodirectory');
838
-                    __("Tue",'geodirectory');
839
-                    __("Wed",'geodirectory');
840
-                    __("Thu",'geodirectory');
841
-                    __("Fri",'geodirectory');
842
-                    __("Sat",'geodirectory');
843
-                    __("Sun",'geodirectory');
837
+                    __("Mon", 'geodirectory');
838
+                    __("Tue", 'geodirectory');
839
+                    __("Wed", 'geodirectory');
840
+                    __("Thu", 'geodirectory');
841
+                    __("Fri", 'geodirectory');
842
+                    __("Sat", 'geodirectory');
843
+                    __("Sun", 'geodirectory');
844 844
                     ?>
845 845
 
846 846
                     labels = [
847
-                        "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
848
-                        "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>",
849
-                        "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>",
850
-                        "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>",
851
-                        "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>",
852
-                        "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>",
853
-                        "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>"
847
+                        "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>",
848
+                        "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>",
849
+                        "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>",
850
+                        "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>",
851
+                        "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>",
852
+                        "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>",
853
+                        "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>"
854 854
                     ];
855 855
 
856 856
                     var data = {
857 857
                         labels : labels,
858 858
                         datasets : [
859 859
                             {
860
-                                label: '<?php _e('Last Week', 'geodirectory');?>',
860
+                                label: '<?php _e('Last Week', 'geodirectory'); ?>',
861 861
                                 fillColor : "rgba(220,220,220,0.5)",
862 862
                                 strokeColor : "rgba(220,220,220,1)",
863 863
                                 pointColor : "rgba(220,220,220,1)",
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
                                 data : data2
866 866
                             },
867 867
                             {
868
-                                label: '<?php _e('This Week', 'geodirectory');?>',
868
+                                label: '<?php _e('This Week', 'geodirectory'); ?>',
869 869
                                 fillColor : "rgba(151,187,205,0.5)",
870 870
                                 strokeColor : "rgba(151,187,205,1)",
871 871
                                 pointColor : "rgba(151,187,205,1)",
@@ -1072,18 +1072,18 @@  discard block
 block discarded – undo
1072 1072
         </style>
1073 1073
         <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
1074 1074
         <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
1075
-        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button>
1075
+        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button>
1076 1076
         <span id="ga_stats" class="gdga-analytics-box" style="display:none">
1077
-            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div>
1077
+            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div>
1078 1078
             <div id="gd-active-users-container">
1079
-                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory');?>"></i><?php _e("Active Users:", 'geodirectory');?>
1079
+                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory'); ?>"></i><?php _e("Active Users:", 'geodirectory'); ?>
1080 1080
                     <b class="gd-ActiveUsers-value">0</b>
1081 1081
                 </div>
1082 1082
             </div>
1083 1083
             <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;">
1084
-                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option>
1085
-                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option>
1086
-                <option value="country"><?php _e("Top Countries", 'geodirectory');?></option>
1084
+                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option>
1085
+                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option>
1086
+                <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option>
1087 1087
             </select>
1088 1088
             <div class="Chartjs-figure" id="gdga-chart-container"></div>
1089 1089
             <ol class="Chartjs-legend" id="gdga-legend-container"></ol>
@@ -1099,8 +1099,8 @@  discard block
 block discarded – undo
1099 1099
     do_action('geodir_after_google_analytics');
1100 1100
     $content_html = ob_get_clean();
1101 1101
     if (trim($content_html) != '')
1102
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1103
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1102
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>';
1103
+    if ((int) get_option('geodir_disable_google_analytics_section') != 1) {
1104 1104
         /**
1105 1105
          * Filter the geodir_edit_post_link() function content.
1106 1106
          *
@@ -1156,10 +1156,10 @@  discard block
 block discarded – undo
1156 1156
        
1157 1157
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1158 1158
 	   
1159
-	   $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 />';
1159
+	   $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 />';
1160 1160
 
1161 1161
         $html .= '<span class="item">';
1162
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1162
+        $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>';
1163 1163
 
1164 1164
         if ($post_images) {
1165 1165
             foreach ($post_images as $img) {
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
         }
1170 1170
 
1171 1171
         if (isset($post_img) && $post_img) {
1172
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1172
+            $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />';
1173 1173
         }
1174 1174
 
1175 1175
         $html .= '</span>';
@@ -1196,9 +1196,9 @@  discard block
 block discarded – undo
1196 1196
     do_action('geodir_after_detail_page_review_rating');
1197 1197
     $content_html = ob_get_clean();
1198 1198
     if (trim($content_html) != '') {
1199
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1199
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>';
1200 1200
     }
1201
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1201
+    if ((int) get_option('geodir_disable_rating_info_section') != 1) {
1202 1202
         /**
1203 1203
          * Filter the geodir_detail_page_review_rating() function content.
1204 1204
          *
@@ -1237,8 +1237,8 @@  discard block
 block discarded – undo
1237 1237
 
1238 1238
     $content_html = ob_get_clean();
1239 1239
     if (trim($content_html) != '')
1240
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1241
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1240
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>';
1241
+    if ((int) get_option('geodir_disable_listing_info_section') != 1) {
1242 1242
         /**
1243 1243
          * Filter the output html for function geodir_detail_page_more_info().
1244 1244
          *
@@ -1337,7 +1337,7 @@  discard block
 block discarded – undo
1337 1337
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
1338 1338
 		'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
1339 1339
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1340
-		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1340
+		'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1341 1341
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1342 1342
         'geodir_map_name' => geodir_map_name(),
1343 1343
     );
@@ -1355,10 +1355,10 @@  discard block
 block discarded – undo
1355 1355
     foreach ($arr_alert_msg as $key => $value) {
1356 1356
         if (!is_scalar($value))
1357 1357
             continue;
1358
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1358
+        $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
1359 1359
     }
1360 1360
 
1361
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1361
+    $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';';
1362 1362
     echo '<script>';
1363 1363
     echo $script;
1364 1364
     echo '</script>';
@@ -1448,7 +1448,7 @@  discard block
 block discarded – undo
1448 1448
         $geodir_old_sidebars = get_option('geodir_sidebars');
1449 1449
         if (is_array($geodir_old_sidebars)) {
1450 1450
             foreach ($geodir_old_sidebars as $key => $val) {
1451
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1451
+                if (0 === strpos($key, 'geodir_'))// if gd widget
1452 1452
                 {
1453 1453
                     $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1454 1454
                 }
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
         global $post;
1528 1528
         $term_condition = '';
1529 1529
         if (isset($_REQUEST['backandedit'])) {
1530
-            $post = (object)$gd_session->get('listing');
1530
+            $post = (object) $gd_session->get('listing');
1531 1531
             $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1532 1532
         }
1533 1533
 
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
                     echo 'checked="checked"';
1542 1542
                 } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1543 1543
                        class="geodir_textfield" value="1"
1544
-                       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>
1544
+                       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>
1545 1545
 				</span>
1546 1546
             </div>
1547 1547
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
@@ -1581,7 +1581,7 @@  discard block
 block discarded – undo
1581 1581
         /** This action is documented in geodirectory_template_actions.php */
1582 1582
         $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1583 1583
         
1584
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1584
+        if (!($desc_limit === '' || (int) $desc_limit > 0)) {
1585 1585
             $is_display = false;
1586 1586
         }
1587 1587
     }
@@ -1629,16 +1629,16 @@  discard block
 block discarded – undo
1629 1629
     global $wpdb, $plugin_prefix;
1630 1630
 	
1631 1631
 	// Remove unused virtual page
1632
-	$listings_page_id = (int)get_option('geodir_listing_page');
1632
+	$listings_page_id = (int) get_option('geodir_listing_page');
1633 1633
 	if ($listings_page_id) {
1634
-		$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')));
1634
+		$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')));
1635 1635
         delete_option('geodir_listing_page');
1636 1636
 	}
1637 1637
 
1638 1638
     if (!get_option('geodir_changes_in_custom_fields_table')) {
1639 1639
         $wpdb->query(
1640 1640
             $wpdb->prepare(
1641
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1641
+                "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s",
1642 1642
                 array('1', '1', 'admin')
1643 1643
             )
1644 1644
         );
@@ -1646,9 +1646,9 @@  discard block
 block discarded – undo
1646 1646
 
1647 1647
         /* --- terms meta value set --- */
1648 1648
 
1649
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1649
+        update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png');
1650 1650
 
1651
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1651
+        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%')));
1652 1652
 
1653 1653
         if (!empty($options_data)) {
1654 1654
 
@@ -1656,7 +1656,7 @@  discard block
 block discarded – undo
1656 1656
 
1657 1657
                 $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1658 1658
 
1659
-                $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)));
1659
+                $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)));
1660 1660
 
1661 1661
                 if (!empty($taxonomies_data)) {
1662 1662
 
@@ -1665,17 +1665,17 @@  discard block
 block discarded – undo
1665 1665
                         $taxObject = get_taxonomy($taxobj->taxonomy);
1666 1666
                         $post_type = $taxObject->object_type[0];
1667 1667
 
1668
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1668
+                        $opt_value = 'tax_meta_'.$post_type.'_'.$option_val;
1669 1669
 
1670
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1670
+                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val)));
1671 1671
 
1672 1672
                         if ($duplicate_data) {
1673 1673
 
1674
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1674
+                            $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1675 1675
 
1676 1676
                         } else {
1677 1677
 
1678
-                            $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)));
1678
+                            $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)));
1679 1679
 
1680 1680
                         }
1681 1681
 
@@ -1709,14 +1709,14 @@  discard block
 block discarded – undo
1709 1709
 
1710 1710
     global $wpdb, $table_prefix;
1711 1711
 
1712
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1712
+    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug)));
1713 1713
 
1714 1714
     if ($slug_exists) {
1715 1715
 
1716 1716
         $suffix = 1;
1717 1717
         do {
1718
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1719
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1718
+            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1719
+            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name)));
1720 1720
             $suffix++;
1721 1721
         } while ($location_slug_check && $suffix < 100);
1722 1722
 
@@ -1770,7 +1770,7 @@  discard block
 block discarded – undo
1770 1770
 
1771 1771
         $suffix = 1;
1772 1772
         do {
1773
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1773
+            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1774 1774
 
1775 1775
             /** This action is documented in geodirectory_hooks_actions.php */
1776 1776
             $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
@@ -1782,7 +1782,7 @@  discard block
 block discarded – undo
1782 1782
 
1783 1783
         //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1784 1784
 
1785
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1785
+        $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1786 1786
 
1787 1787
     }
1788 1788
 	
@@ -1791,18 +1791,18 @@  discard block
 block discarded – undo
1791 1791
 	$post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL;
1792 1792
 	
1793 1793
 	$post_types = geodir_get_posttypes();
1794
-	if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) {		
1795
-		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id)));
1794
+	if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) {		
1795
+		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id)));
1796 1796
 		
1797 1797
 		if (!empty($posts_obj)) {
1798 1798
 			foreach ($posts_obj as $post_obj) {
1799 1799
 				$post_id = $post_obj->object_id;
1800 1800
 				
1801
-				$raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names'));
1801
+				$raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names'));
1802 1802
 				$post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : '';
1803 1803
 				
1804
-				$listing_table = $plugin_prefix . $post_type . '_detail';
1805
-				$wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1804
+				$listing_table = $plugin_prefix.$post_type.'_detail';
1805
+				$wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1806 1806
 			}
1807 1807
 		}
1808 1808
 	}
@@ -1836,7 +1836,7 @@  discard block
 block discarded – undo
1836 1836
     if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1837 1837
         return $slug_exists = true;
1838 1838
 
1839
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1839
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1840 1840
         return $slug_exists = true;
1841 1841
 
1842 1842
     return $slug_exists;
@@ -1876,43 +1876,43 @@  discard block
 block discarded – undo
1876 1876
 
1877 1877
 
1878 1878
     $gd_page = '';
1879
-    if(geodir_is_page('home')){
1879
+    if (geodir_is_page('home')) {
1880 1880
         $gd_page = 'home';
1881 1881
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1882 1882
     }
1883
-    elseif(geodir_is_page('detail')){
1883
+    elseif (geodir_is_page('detail')) {
1884 1884
         $gd_page = 'detail';
1885 1885
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1886 1886
     }
1887
-    elseif(geodir_is_page('pt')){
1887
+    elseif (geodir_is_page('pt')) {
1888 1888
         $gd_page = 'pt';
1889 1889
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1890 1890
     }
1891
-    elseif(geodir_is_page('listing')){
1891
+    elseif (geodir_is_page('listing')) {
1892 1892
         $gd_page = 'listing';
1893 1893
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1894 1894
     }
1895
-    elseif(geodir_is_page('location')){
1895
+    elseif (geodir_is_page('location')) {
1896 1896
         $gd_page = 'location';
1897 1897
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1898 1898
     }
1899
-    elseif(geodir_is_page('search')){
1899
+    elseif (geodir_is_page('search')) {
1900 1900
         $gd_page = 'search';
1901 1901
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1902 1902
     }
1903
-    elseif(geodir_is_page('add-listing')){
1903
+    elseif (geodir_is_page('add-listing')) {
1904 1904
         $gd_page = 'add-listing';
1905 1905
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1906 1906
     }
1907
-    elseif(geodir_is_page('author')){
1907
+    elseif (geodir_is_page('author')) {
1908 1908
         $gd_page = 'author';
1909 1909
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1910 1910
     }
1911
-    elseif(geodir_is_page('login')){
1911
+    elseif (geodir_is_page('login')) {
1912 1912
         $gd_page = 'login';
1913 1913
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1914 1914
     }
1915
-    elseif(geodir_is_page('listing-success')){
1915
+    elseif (geodir_is_page('listing-success')) {
1916 1916
         $gd_page = 'listing-success';
1917 1917
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1918 1918
     }
@@ -1944,12 +1944,12 @@  discard block
 block discarded – undo
1944 1944
 
1945 1945
     if (!get_option('geodir_set_post_attachments')) {
1946 1946
 
1947
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1948
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1947
+        require_once(ABSPATH.'wp-admin/includes/image.php');
1948
+        require_once(ABSPATH.'wp-admin/includes/file.php');
1949 1949
 
1950 1950
         $all_postypes = geodir_get_posttypes();
1951 1951
 
1952
-        foreach($all_postypes as $post_type){
1952
+        foreach ($all_postypes as $post_type) {
1953 1953
             $args = array(
1954 1954
                 'posts_per_page' => -1,
1955 1955
                 'post_type' => $post_type,
@@ -2043,7 +2043,7 @@  discard block
 block discarded – undo
2043 2043
 {
2044 2044
     $user_id = get_current_user_id();
2045 2045
 
2046
-    if(!$user_id){return $post;}
2046
+    if (!$user_id) {return $post; }
2047 2047
 
2048 2048
     $gd_post_types = geodir_get_posttypes();
2049 2049
 
@@ -2152,7 +2152,7 @@  discard block
 block discarded – undo
2152 2152
 
2153 2153
         if (array_key_exists('post_video', $tabs_arr)) {
2154 2154
 
2155
-            $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)));
2155
+            $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)));
2156 2156
 
2157 2157
             if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2158 2158
                 $tabs_arr['post_video']['heading_text'] = $field_title;
@@ -2160,7 +2160,7 @@  discard block
 block discarded – undo
2160 2160
 
2161 2161
         if (array_key_exists('special_offers', $tabs_arr)) {
2162 2162
 
2163
-            $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)));
2163
+            $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)));
2164 2164
 
2165 2165
             if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2166 2166
                 $tabs_arr['special_offers']['heading_text'] = $field_title;
@@ -2181,7 +2181,7 @@  discard block
 block discarded – undo
2181 2181
  */
2182 2182
 function geodir_remove_template_redirect_actions()
2183 2183
 {
2184
-    if (geodir_is_page('login')){
2184
+    if (geodir_is_page('login')) {
2185 2185
         remove_all_actions('template_redirect');
2186 2186
         remove_action('init', 'avia_modify_front', 10);
2187 2187
     }
@@ -2228,25 +2228,25 @@  discard block
 block discarded – undo
2228 2228
         $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2229 2229
 
2230 2230
         $wpdb->query(
2231
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2231
+            $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ",
2232 2232
                 array($post_id, $split_img_file_path)
2233 2233
             )
2234 2234
         );
2235 2235
 
2236 2236
         $attachment_data = $wpdb->get_row(
2237
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2237
+            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d",
2238 2238
                 array($post_id)
2239 2239
             )
2240 2240
         );
2241 2241
 
2242 2242
         if (!empty($attachment_data)) {
2243
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2243
+            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2244 2244
         }
2245 2245
 
2246 2246
 
2247
-        $table_name = $plugin_prefix . $post_type . '_detail';
2247
+        $table_name = $plugin_prefix.$post_type.'_detail';
2248 2248
 
2249
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2249
+        $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id);
2250 2250
 
2251 2251
         geodir_set_wp_featured_image($post_id);
2252 2252
 
@@ -2274,9 +2274,9 @@  discard block
 block discarded – undo
2274 2274
 
2275 2275
     foreach ($all_postypes as $posttype) {
2276 2276
 
2277
-        $tablename = $plugin_prefix . $posttype . '_detail';
2277
+        $tablename = $plugin_prefix.$posttype.'_detail';
2278 2278
 
2279
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2279
+        $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename);
2280 2280
 
2281 2281
         if (!empty($get_post_data)) {
2282 2282
 
@@ -2284,7 +2284,7 @@  discard block
 block discarded – undo
2284 2284
 
2285 2285
                 $post_id = $data->post_id;
2286 2286
 
2287
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2287
+                $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''");
2288 2288
 
2289 2289
                 if (!empty($attachment_data)) {
2290 2290
 
@@ -2301,22 +2301,22 @@  discard block
 block discarded – undo
2301 2301
 
2302 2302
                         $file_name = $file_info['basename'];
2303 2303
 
2304
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2304
+                        $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name;
2305 2305
 
2306 2306
                         if (!file_exists($img_arr['path'])) {
2307 2307
 
2308
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2308
+                            $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID);
2309 2309
 
2310 2310
                         }
2311 2311
 
2312 2312
                     }
2313 2313
 
2314
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2314
+                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id");
2315 2315
 
2316 2316
                     if (!empty($attachment_data)) {
2317 2317
 
2318 2318
                         if ($attachment_data->ID)
2319
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2319
+                            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2320 2320
 
2321 2321
                     } else {
2322 2322
 
@@ -2330,7 +2330,7 @@  discard block
 block discarded – undo
2330 2330
 
2331 2331
                     }
2332 2332
 
2333
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2333
+                    $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id);
2334 2334
 
2335 2335
                     geodir_set_wp_featured_image($post_id);
2336 2336
 
@@ -2359,7 +2359,7 @@  discard block
 block discarded – undo
2359 2359
 {
2360 2360
 
2361 2361
     if (!get_option('geodir_default_rating_star_icon')) {
2362
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2362
+        update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png');
2363 2363
     }
2364 2364
 
2365 2365
 }
@@ -2376,10 +2376,10 @@  discard block
 block discarded – undo
2376 2376
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2377 2377
  * @return array User listing count for each post type.
2378 2378
  */
2379
-function geodir_user_post_listing_count($user_id=null)
2379
+function geodir_user_post_listing_count($user_id = null)
2380 2380
 {
2381 2381
     global $wpdb, $plugin_prefix, $current_user;
2382
-    if(!$user_id){
2382
+    if (!$user_id) {
2383 2383
         $user_id = $current_user->ID;
2384 2384
     }
2385 2385
 
@@ -2390,7 +2390,7 @@  discard block
 block discarded – undo
2390 2390
     $user_listing = array();
2391 2391
     if (is_array($all_posts) && !empty($all_posts)) {
2392 2392
         foreach ($all_posts as $ptype) {
2393
-            $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' )");
2393
+            $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' )");
2394 2394
 
2395 2395
             if ($total_posts > 0) {
2396 2396
                 $user_listing[$ptype] = $total_posts;
@@ -2444,7 +2444,7 @@  discard block
 block discarded – undo
2444 2444
                     $post->{$field_name} = $_REQUEST[$field_name];
2445 2445
                 }
2446 2446
 
2447
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2447
+                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2448 2448
                     if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2449 2449
                         continue;
2450 2450
                     }
@@ -2493,11 +2493,11 @@  discard block
 block discarded – undo
2493 2493
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2494 2494
                         $variables_array['value'] = '';
2495 2495
                         $variables_array['value'] = $post->{$type['htmlvar_name']};
2496
-                    }else{
2496
+                    } else {
2497 2497
                         $i = 0;
2498 2498
                         $fieldset_count++;
2499 2499
                         $field_set_start = 1;
2500
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2500
+                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count;
2501 2501
                         $fieldset_arr[$fieldset_count]['label'] = $label;
2502 2502
                     }
2503 2503
 
@@ -2517,7 +2517,7 @@  discard block
 block discarded – undo
2517 2517
                      * @param string $fields_location The location the field is to be show.
2518 2518
                      * @param array $type The array of field values.
2519 2519
                      */
2520
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2520
+                    $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
2521 2521
 
2522 2522
 
2523 2523
                     /**
@@ -2563,7 +2563,7 @@  discard block
 block discarded – undo
2563 2563
                                  * @param string $htmlvar_name The field HTML var name.
2564 2564
                                  */
2565 2565
                                 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2566
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2566
+                                'tab_content' => '<div class="geodir-company_info field-group xxx">'.$fieldset_html.'</div>'
2567 2567
                             );
2568 2568
                         }
2569 2569
                     } else {
@@ -2623,7 +2623,7 @@  discard block
 block discarded – undo
2623 2623
             }
2624 2624
             $status .= ")</strong>";
2625 2625
 
2626
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2626
+            $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>';
2627 2627
         }
2628 2628
     }
2629 2629
 
@@ -2703,7 +2703,7 @@  discard block
 block discarded – undo
2703 2703
 function geodir_no_rating_comment_text($content, $comment = '')
2704 2704
 {
2705 2705
     if (!is_admin()) {
2706
-        return '<div class="description">' . $content . '</div>';
2706
+        return '<div class="description">'.$content.'</div>';
2707 2707
     } else {
2708 2708
         return $content;
2709 2709
     }
@@ -2781,7 +2781,7 @@  discard block
 block discarded – undo
2781 2781
         $classes[] = 'gd-no-rating';
2782 2782
     }
2783 2783
     
2784
-    $classes[] = 'gd-map-' . geodir_map_name();
2784
+    $classes[] = 'gd-map-'.geodir_map_name();
2785 2785
 
2786 2786
     return $classes;
2787 2787
 }
@@ -2801,7 +2801,7 @@  discard block
 block discarded – undo
2801 2801
         $class .= ' gd-no-rating';
2802 2802
     }
2803 2803
     
2804
-    $class .= ' gd-map-' . geodir_map_name();
2804
+    $class .= ' gd-map-'.geodir_map_name();
2805 2805
 
2806 2806
     return $class;
2807 2807
 }
@@ -2836,7 +2836,7 @@  discard block
 block discarded – undo
2836 2836
  * @return array Translation texts.
2837 2837
  */
2838 2838
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2839
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2839
+    $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array();
2840 2840
 
2841 2841
     $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');
2842 2842
 
@@ -2902,14 +2902,14 @@  discard block
 block discarded – undo
2902 2902
  * @param array $args The array of menu arguments.
2903 2903
  * @return array The modified arguments.
2904 2904
  */
2905
-function geodir_add_nav_menu_class( $args )
2905
+function geodir_add_nav_menu_class($args)
2906 2906
 {
2907 2907
 
2908
-        if(isset($args['menu_class'])){
2908
+        if (isset($args['menu_class'])) {
2909 2909
             $args['menu_class'] = $args['menu_class']." gd-menu-z";
2910 2910
         }
2911 2911
     
2912 2912
     return $args;
2913 2913
 }
2914 2914
 
2915
-add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
2916 2915
\ No newline at end of file
2916
+add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class');
2917 2917
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +91 added lines, -73 removed lines patch added patch discarded remove patch
@@ -86,8 +86,9 @@  discard block
 block discarded – undo
86 86
 add_filter('query_vars', 'geodir_add_location_var');
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
-if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
89
+if (get_option('permalink_structure') != '') {
90
+    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91
+}
91 92
 
92 93
 add_filter('parse_query', 'geodir_modified_query');
93 94
 
@@ -421,8 +422,9 @@  discard block
 block discarded – undo
421 422
      */
422 423
     do_action('geodir_after_social_sharing_buttons');
423 424
     $content_html = ob_get_clean();
424
-    if (trim($content_html) != '')
425
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
+    if (trim($content_html) != '') {
426
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
427
+    }
426 428
     if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
427 429
         /**
428 430
          * Filter the geodir_social_sharing_buttons() function content.
@@ -468,8 +470,9 @@  discard block
 block discarded – undo
468 470
      */
469 471
     do_action('geodir_after_share_this_button');
470 472
     $content_html = ob_get_clean();
471
-    if (trim($content_html) != '')
472
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
+    if (trim($content_html) != '') {
474
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
475
+    }
473 476
     if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
474 477
         /**
475 478
          * Filter the geodir_share_this_button() function content.
@@ -524,8 +527,9 @@  discard block
 block discarded – undo
524 527
      */
525 528
     do_action('geodir_after_edit_post_link');
526 529
     $content_html = ob_get_clean();
527
-    if (trim($content_html) != '')
528
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
530
+    if (trim($content_html) != '') {
531
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
532
+    }
529 533
     if ((int)get_option('geodir_disable_user_links_section') != 1) {
530 534
         /**
531 535
          * Filter the geodir_edit_post_link() function content.
@@ -1098,8 +1102,9 @@  discard block
 block discarded – undo
1098 1102
      */
1099 1103
     do_action('geodir_after_google_analytics');
1100 1104
     $content_html = ob_get_clean();
1101
-    if (trim($content_html) != '')
1102
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1105
+    if (trim($content_html) != '') {
1106
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1107
+    }
1103 1108
     if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1104 1109
         /**
1105 1110
          * Filter the geodir_edit_post_link() function content.
@@ -1236,8 +1241,9 @@  discard block
 block discarded – undo
1236 1241
     do_action('geodir_after_detail_page_more_info');
1237 1242
 
1238 1243
     $content_html = ob_get_clean();
1239
-    if (trim($content_html) != '')
1240
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1244
+    if (trim($content_html) != '') {
1245
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1246
+    }
1241 1247
     if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1242 1248
         /**
1243 1249
          * Filter the output html for function geodir_detail_page_more_info().
@@ -1353,8 +1359,9 @@  discard block
 block discarded – undo
1353 1359
     $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1354 1360
 
1355 1361
     foreach ($arr_alert_msg as $key => $value) {
1356
-        if (!is_scalar($value))
1357
-            continue;
1362
+        if (!is_scalar($value)) {
1363
+                    continue;
1364
+        }
1358 1365
         $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1359 1366
     }
1360 1367
 
@@ -1410,17 +1417,19 @@  discard block
 block discarded – undo
1410 1417
     global $geodir_sidebars;
1411 1418
     global $sidebars_widgets;
1412 1419
 
1413
-    if (!is_array($sidebars_widgets))
1414
-        $sidebars_widgets = wp_get_sidebars_widgets();
1420
+    if (!is_array($sidebars_widgets)) {
1421
+            $sidebars_widgets = wp_get_sidebars_widgets();
1422
+    }
1415 1423
     $geodir_old_sidebars = array();
1416 1424
 
1417 1425
     if (is_array($geodir_sidebars)) {
1418 1426
         foreach ($geodir_sidebars as $val) {
1419 1427
             if (is_array($sidebars_widgets)) {
1420
-                if (array_key_exists($val, $sidebars_widgets))
1421
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1422
-                else
1423
-                    $geodir_old_sidebars[$val] = array();
1428
+                if (array_key_exists($val, $sidebars_widgets)) {
1429
+                                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1430
+                } else {
1431
+                                    $geodir_old_sidebars[$val] = array();
1432
+                }
1424 1433
             }
1425 1434
         }
1426 1435
     }
@@ -1441,16 +1450,19 @@  discard block
 block discarded – undo
1441 1450
 {
1442 1451
     global $sidebars_widgets;
1443 1452
 
1444
-    if (!is_array($sidebars_widgets))
1445
-        $sidebars_widgets = wp_get_sidebars_widgets();
1453
+    if (!is_array($sidebars_widgets)) {
1454
+            $sidebars_widgets = wp_get_sidebars_widgets();
1455
+    }
1446 1456
 
1447 1457
     if (is_array($sidebars_widgets)) {
1448 1458
         $geodir_old_sidebars = get_option('geodir_sidebars');
1449 1459
         if (is_array($geodir_old_sidebars)) {
1450 1460
             foreach ($geodir_old_sidebars as $key => $val) {
1451
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1461
+                if(0 === strpos($key, 'geodir_')) {
1462
+                	// if gd widget
1452 1463
                 {
1453
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1464
+                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1465
+                }
1454 1466
                 }
1455 1467
 
1456 1468
 
@@ -1586,20 +1598,25 @@  discard block
 block discarded – undo
1586 1598
         }
1587 1599
     }
1588 1600
     
1589
-    if ($tab == 'post_info')
1590
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1601
+    if ($tab == 'post_info') {
1602
+            $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1603
+    }
1591 1604
     
1592
-    if ($tab == 'post_images')
1593
-        $is_display = (!empty($post_images)) ? true : false;
1605
+    if ($tab == 'post_images') {
1606
+            $is_display = (!empty($post_images)) ? true : false;
1607
+    }
1594 1608
 
1595
-    if ($tab == 'post_video')
1596
-        $is_display = (!empty($video)) ? true : false;
1609
+    if ($tab == 'post_video') {
1610
+            $is_display = (!empty($video)) ? true : false;
1611
+    }
1597 1612
 
1598
-    if ($tab == 'special_offers')
1599
-        $is_display = (!empty($special_offers)) ? true : false;
1613
+    if ($tab == 'special_offers') {
1614
+            $is_display = (!empty($special_offers)) ? true : false;
1615
+    }
1600 1616
 
1601
-    if ($tab == 'reviews')
1602
-        $is_display = (geodir_is_page('detail')) ? true : false;
1617
+    if ($tab == 'reviews') {
1618
+            $is_display = (geodir_is_page('detail')) ? true : false;
1619
+    }
1603 1620
 
1604 1621
     if ($tab == 'related_listing') {
1605 1622
        $message = __('No listings found which match your selection.', 'geodirectory');
@@ -1833,11 +1850,13 @@  discard block
 block discarded – undo
1833 1850
     $region_slug = $default_location->region_slug;
1834 1851
     $city_slug = $default_location->city_slug;
1835 1852
 
1836
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1837
-        return $slug_exists = true;
1853
+    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) {
1854
+            return $slug_exists = true;
1855
+    }
1838 1856
 
1839
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1840
-        return $slug_exists = true;
1857
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) {
1858
+            return $slug_exists = true;
1859
+    }
1841 1860
 
1842 1861
     return $slug_exists;
1843 1862
 }
@@ -1879,40 +1898,31 @@  discard block
 block discarded – undo
1879 1898
     if(geodir_is_page('home')){
1880 1899
         $gd_page = 'home';
1881 1900
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1882
-    }
1883
-    elseif(geodir_is_page('detail')){
1901
+    } elseif(geodir_is_page('detail')){
1884 1902
         $gd_page = 'detail';
1885 1903
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1886
-    }
1887
-    elseif(geodir_is_page('pt')){
1904
+    } elseif(geodir_is_page('pt')){
1888 1905
         $gd_page = 'pt';
1889 1906
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1890
-    }
1891
-    elseif(geodir_is_page('listing')){
1907
+    } elseif(geodir_is_page('listing')){
1892 1908
         $gd_page = 'listing';
1893 1909
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1894
-    }
1895
-    elseif(geodir_is_page('location')){
1910
+    } elseif(geodir_is_page('location')){
1896 1911
         $gd_page = 'location';
1897 1912
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1898
-    }
1899
-    elseif(geodir_is_page('search')){
1913
+    } elseif(geodir_is_page('search')){
1900 1914
         $gd_page = 'search';
1901 1915
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1902
-    }
1903
-    elseif(geodir_is_page('add-listing')){
1916
+    } elseif(geodir_is_page('add-listing')){
1904 1917
         $gd_page = 'add-listing';
1905 1918
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1906
-    }
1907
-    elseif(geodir_is_page('author')){
1919
+    } elseif(geodir_is_page('author')){
1908 1920
         $gd_page = 'author';
1909 1921
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1910
-    }
1911
-    elseif(geodir_is_page('login')){
1922
+    } elseif(geodir_is_page('login')){
1912 1923
         $gd_page = 'login';
1913 1924
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1914
-    }
1915
-    elseif(geodir_is_page('listing-success')){
1925
+    } elseif(geodir_is_page('listing-success')){
1916 1926
         $gd_page = 'listing-success';
1917 1927
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1918 1928
     }
@@ -1990,11 +2000,13 @@  discard block
 block discarded – undo
1990 2000
 
1991 2001
     if (!get_option('geodir_remove_url_seperator')) {
1992 2002
 
1993
-        if (get_option('geodir_listingurl_separator'))
1994
-            delete_option('geodir_listingurl_separator');
2003
+        if (get_option('geodir_listingurl_separator')) {
2004
+                    delete_option('geodir_listingurl_separator');
2005
+        }
1995 2006
 
1996
-        if (get_option('geodir_detailurl_separator'))
1997
-            delete_option('geodir_detailurl_separator');
2007
+        if (get_option('geodir_detailurl_separator')) {
2008
+                    delete_option('geodir_detailurl_separator');
2009
+        }
1998 2010
 
1999 2011
         flush_rewrite_rules(false);
2000 2012
 
@@ -2018,8 +2030,9 @@  discard block
 block discarded – undo
2018 2030
 {
2019 2031
     foreach ($permalink_arr as $key => $value) {
2020 2032
 
2021
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2022
-            unset($permalink_arr[$key]);
2033
+        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') {
2034
+                    unset($permalink_arr[$key]);
2035
+        }
2023 2036
 
2024 2037
     }
2025 2038
 
@@ -2154,16 +2167,18 @@  discard block
 block discarded – undo
2154 2167
 
2155 2168
             $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)));
2156 2169
 
2157
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2158
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2170
+            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') {
2171
+                            $tabs_arr['post_video']['heading_text'] = $field_title;
2172
+            }
2159 2173
         }
2160 2174
 
2161 2175
         if (array_key_exists('special_offers', $tabs_arr)) {
2162 2176
 
2163 2177
             $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)));
2164 2178
 
2165
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2166
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2179
+            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') {
2180
+                            $tabs_arr['special_offers']['heading_text'] = $field_title;
2181
+            }
2167 2182
         }
2168 2183
 
2169 2184
     }
@@ -2218,8 +2233,9 @@  discard block
 block discarded – undo
2218 2233
 
2219 2234
         $all_postypes = geodir_get_posttypes();
2220 2235
 
2221
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2222
-            return false;
2236
+        if (!in_array($post_type, $all_postypes) || !is_admin()) {
2237
+                    return false;
2238
+        }
2223 2239
 
2224 2240
         $uploads = wp_upload_dir();
2225 2241
 
@@ -2293,8 +2309,9 @@  discard block
 block discarded – undo
2293 2309
                         $file_info = pathinfo($attach->file);
2294 2310
 
2295 2311
                         $sub_dir = '';
2296
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2297
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2312
+                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
2313
+                                                    $sub_dir = stripslashes_deep($file_info['dirname']);
2314
+                        }
2298 2315
 
2299 2316
                         $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2300 2317
                         $uploads_path = $uploads['basedir'];
@@ -2315,8 +2332,9 @@  discard block
 block discarded – undo
2315 2332
 
2316 2333
                     if (!empty($attachment_data)) {
2317 2334
 
2318
-                        if ($attachment_data->ID)
2319
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2335
+                        if ($attachment_data->ID) {
2336
+                                                    $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2337
+                        }
2320 2338
 
2321 2339
                     } else {
2322 2340
 
@@ -2493,7 +2511,7 @@  discard block
 block discarded – undo
2493 2511
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2494 2512
                         $variables_array['value'] = '';
2495 2513
                         $variables_array['value'] = $post->{$type['htmlvar_name']};
2496
-                    }else{
2514
+                    } else{
2497 2515
                         $i = 0;
2498 2516
                         $fieldset_count++;
2499 2517
                         $field_set_start = 1;
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_output_functions.php 2 patches
Indentation   +1523 added lines, -1523 removed lines patch added patch discarded remove patch
@@ -21,84 +21,84 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function geodir_cf_checkbox($html,$location,$cf,$p=''){
23 23
 
24
-    // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
27
-
28
-    if(!is_array($cf) && $cf!=''){
29
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
-        if(!$cf){return NULL;}
31
-    }
32
-
33
-    $html_var = $cf['htmlvar_name'];
34
-
35
-    // Check if there is a location specific filter.
36
-    if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
37
-        /**
38
-         * Filter the checkbox html by location.
39
-         *
40
-         * @param string $html The html to filter.
41
-         * @param array $cf The custom field array.
42
-         * @since 1.6.6
43
-         */
44
-        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
45
-    }
46
-
47
-    // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
49
-        /**
50
-         * Filter the checkbox html by individual custom field.
51
-         *
52
-         * @param string $html The html to filter.
53
-         * @param string $location The location to output the html.
54
-         * @param array $cf The custom field array.
55
-         * @since 1.6.6
56
-         */
57
-        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
58
-    }
59
-
60
-    // Check if there is a custom field key specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
62
-        /**
63
-         * Filter the checkbox html by field type key.
64
-         *
65
-         * @param string $html The html to filter.
66
-         * @param string $location The location to output the html.
67
-         * @param array $cf The custom field array.
68
-         * @since 1.6.6
69
-         */
70
-        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
71
-    }
72
-
73
-    // If not html then we run the standard output.
74
-    if(empty($html)){
75
-
76
-        if ( (int) $post->{$html_var} == 1 ):
77
-
78
-            if ( $post->{$html_var} == '1' ):
79
-                $html_val = __( 'Yes', 'geodirectory' );
80
-            else:
81
-                $html_val = __( 'No', 'geodirectory' );
82
-            endif;
83
-
84
-            $field_icon = geodir_field_icon_proccess($cf);
85
-            if (strpos($field_icon, 'http') !== false) {
86
-                $field_icon_af = '';
87
-            } elseif ($field_icon == '') {
88
-                $field_icon_af = '';
89
-            } else {
90
-                $field_icon_af = $field_icon;
91
-                $field_icon = '';
92
-            }
93
-
94
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
-            $html .= '</span>' . $html_val . '</div>';
97
-        endif;
98
-
99
-    }
100
-
101
-    return $html;
24
+	// check we have the post value
25
+	if(is_int($p)){$post = geodir_get_post_info($p);}
26
+	else{ global $post;}
27
+
28
+	if(!is_array($cf) && $cf!=''){
29
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
+		if(!$cf){return NULL;}
31
+	}
32
+
33
+	$html_var = $cf['htmlvar_name'];
34
+
35
+	// Check if there is a location specific filter.
36
+	if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
37
+		/**
38
+		 * Filter the checkbox html by location.
39
+		 *
40
+		 * @param string $html The html to filter.
41
+		 * @param array $cf The custom field array.
42
+		 * @since 1.6.6
43
+		 */
44
+		$html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
45
+	}
46
+
47
+	// Check if there is a custom field specific filter.
48
+	if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
49
+		/**
50
+		 * Filter the checkbox html by individual custom field.
51
+		 *
52
+		 * @param string $html The html to filter.
53
+		 * @param string $location The location to output the html.
54
+		 * @param array $cf The custom field array.
55
+		 * @since 1.6.6
56
+		 */
57
+		$html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
58
+	}
59
+
60
+	// Check if there is a custom field key specific filter.
61
+	if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
62
+		/**
63
+		 * Filter the checkbox html by field type key.
64
+		 *
65
+		 * @param string $html The html to filter.
66
+		 * @param string $location The location to output the html.
67
+		 * @param array $cf The custom field array.
68
+		 * @since 1.6.6
69
+		 */
70
+		$html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
71
+	}
72
+
73
+	// If not html then we run the standard output.
74
+	if(empty($html)){
75
+
76
+		if ( (int) $post->{$html_var} == 1 ):
77
+
78
+			if ( $post->{$html_var} == '1' ):
79
+				$html_val = __( 'Yes', 'geodirectory' );
80
+			else:
81
+				$html_val = __( 'No', 'geodirectory' );
82
+			endif;
83
+
84
+			$field_icon = geodir_field_icon_proccess($cf);
85
+			if (strpos($field_icon, 'http') !== false) {
86
+				$field_icon_af = '';
87
+			} elseif ($field_icon == '') {
88
+				$field_icon_af = '';
89
+			} else {
90
+				$field_icon_af = $field_icon;
91
+				$field_icon = '';
92
+			}
93
+
94
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
+			$html .= '</span>' . $html_val . '</div>';
97
+		endif;
98
+
99
+	}
100
+
101
+	return $html;
102 102
 }
103 103
 add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
104 104
 
@@ -115,72 +115,72 @@  discard block
 block discarded – undo
115 115
  */
116 116
 function geodir_cf_fieldset($html,$location,$cf,$p=''){
117 117
 
118
-    // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
121
-
122
-    if(!is_array($cf) && $cf!=''){
123
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
-        if(!$cf){return NULL;}
125
-    }
126
-
127
-    $html_var = $cf['htmlvar_name'];
128
-
129
-    // Check if there is a location specific filter.
130
-    if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
131
-        /**
132
-         * Filter the fieldset html by location.
133
-         *
134
-         * @param string $html The html to filter.
135
-         * @param array $cf The custom field array.
136
-         * @since 1.6.6
137
-         */
138
-        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
139
-    }
140
-
141
-    // Check if there is a custom field specific filter.
142
-    if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
143
-        /**
144
-         * Filter the fieldset html by individual custom field.
145
-         *
146
-         * @param string $html The html to filter.
147
-         * @param string $location The location to output the html.
148
-         * @param array $cf The custom field array.
149
-         * @since 1.6.6
150
-         */
151
-        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
152
-    }
153
-
154
-    // Check if there is a custom field key specific filter.
155
-    if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
156
-        /**
157
-         * Filter the fieldset html by field type key.
158
-         *
159
-         * @param string $html The html to filter.
160
-         * @param string $location The location to output the html.
161
-         * @param array $cf The custom field array.
162
-         * @since 1.6.6
163
-         */
164
-        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
165
-    }
166
-
167
-    // If not html then we run the standard output.
168
-    if(empty($html)){
169
-
170
-        global $field_set_start;
171
-        $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
172
-
173
-        if ($field_set_start == 1) {
174
-            $html = '';//'<h2 class="'.$fieldset_class.'">xxx'.$field_set_start  . __($cf['site_title'], 'geodirectory') . '</h2>';
175
-           //$html = '</div><div class="geodir-company_info field-group ' . $cf['htmlvar_name'] . '"><h2 class="'.$fieldset_class.'">' . __($cf['site_title'], 'geodirectory') . '</h2>';
176
-        } else {
177
-            $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
178
-            //$field_set_start = 1;
179
-        }
180
-
181
-    }
182
-
183
-    return $html;
118
+	// check we have the post value
119
+	if(is_int($p)){$post = geodir_get_post_info($p);}
120
+	else{ global $post;}
121
+
122
+	if(!is_array($cf) && $cf!=''){
123
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
+		if(!$cf){return NULL;}
125
+	}
126
+
127
+	$html_var = $cf['htmlvar_name'];
128
+
129
+	// Check if there is a location specific filter.
130
+	if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
131
+		/**
132
+		 * Filter the fieldset html by location.
133
+		 *
134
+		 * @param string $html The html to filter.
135
+		 * @param array $cf The custom field array.
136
+		 * @since 1.6.6
137
+		 */
138
+		$html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
139
+	}
140
+
141
+	// Check if there is a custom field specific filter.
142
+	if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
143
+		/**
144
+		 * Filter the fieldset html by individual custom field.
145
+		 *
146
+		 * @param string $html The html to filter.
147
+		 * @param string $location The location to output the html.
148
+		 * @param array $cf The custom field array.
149
+		 * @since 1.6.6
150
+		 */
151
+		$html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
152
+	}
153
+
154
+	// Check if there is a custom field key specific filter.
155
+	if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
156
+		/**
157
+		 * Filter the fieldset html by field type key.
158
+		 *
159
+		 * @param string $html The html to filter.
160
+		 * @param string $location The location to output the html.
161
+		 * @param array $cf The custom field array.
162
+		 * @since 1.6.6
163
+		 */
164
+		$html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
165
+	}
166
+
167
+	// If not html then we run the standard output.
168
+	if(empty($html)){
169
+
170
+		global $field_set_start;
171
+		$fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
172
+
173
+		if ($field_set_start == 1) {
174
+			$html = '';//'<h2 class="'.$fieldset_class.'">xxx'.$field_set_start  . __($cf['site_title'], 'geodirectory') . '</h2>';
175
+		   //$html = '</div><div class="geodir-company_info field-group ' . $cf['htmlvar_name'] . '"><h2 class="'.$fieldset_class.'">' . __($cf['site_title'], 'geodirectory') . '</h2>';
176
+		} else {
177
+			$html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
178
+			//$field_set_start = 1;
179
+		}
180
+
181
+	}
182
+
183
+	return $html;
184 184
 }
185 185
 add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
186 186
 
@@ -197,106 +197,106 @@  discard block
 block discarded – undo
197 197
  */
198 198
 function geodir_cf_url($html,$location,$cf,$p=''){
199 199
 
200
-    // check we have the post value
201
-    if(is_int($p)){$post = geodir_get_post_info($p);}
202
-    else{ global $post;}
203
-
204
-    if(!is_array($cf) && $cf!=''){
205
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
206
-        if(!$cf){return NULL;}
207
-    }
208
-
209
-    $html_var = $cf['htmlvar_name'];
210
-
211
-    // Check if there is a location specific filter.
212
-    if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
213
-        /**
214
-         * Filter the url html by location.
215
-         *
216
-         * @param string $html The html to filter.
217
-         * @param array $cf The custom field array.
218
-         * @since 1.6.6
219
-         */
220
-        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
221
-    }
222
-
223
-    // Check if there is a custom field specific filter.
224
-    if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
225
-        /**
226
-         * Filter the url html by individual custom field.
227
-         *
228
-         * @param string $html The html to filter.
229
-         * @param string $location The location to output the html.
230
-         * @param array $cf The custom field array.
231
-         * @since 1.6.6
232
-         */
233
-        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
234
-    }
235
-
236
-    // Check if there is a custom field key specific filter.
237
-    if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
238
-        /**
239
-         * Filter the url html by field type key.
240
-         *
241
-         * @param string $html The html to filter.
242
-         * @param string $location The location to output the html.
243
-         * @param array $cf The custom field array.
244
-         * @since 1.6.6
245
-         */
246
-        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
247
-    }
248
-
249
-    // If not html then we run the standard output.
250
-    if(empty($html)){
251
-
252
-        if ($post->{$cf['htmlvar_name']}):
253
-
254
-            $field_icon = geodir_field_icon_proccess($cf);
255
-            if (strpos($field_icon, 'http') !== false) {
256
-                $field_icon_af = '';
257
-            } elseif ($field_icon == '') {
258
-
259
-                if ($cf['name'] == 'geodir_facebook') {
260
-                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
261
-                } elseif ($cf['name'] == 'geodir_twitter') {
262
-                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
263
-                } else {
264
-                    $field_icon_af = '<i class="fa fa-link"></i>';
265
-                }
266
-
267
-            } else {
268
-                $field_icon_af = $field_icon;
269
-                $field_icon = '';
270
-            }
271
-
272
-            $a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
273
-
274
-
275
-            $website = !empty($a_url['url']) ? $a_url['url'] : '';
276
-            $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
277
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
278
-            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
279
-
280
-
281
-
282
-            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
283
-            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
284
-            /**
285
-             * Filter custom field website name.
286
-             *
287
-             * @since 1.0.0
288
-             *
289
-             * @param string $title Website Title.
290
-             * @param string $website Website URL.
291
-             * @param int $post->ID Post ID.
292
-             */
293
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
294
-
295
-        endif;
296
-
297
-    }
298
-
299
-    return $html;
200
+	// check we have the post value
201
+	if(is_int($p)){$post = geodir_get_post_info($p);}
202
+	else{ global $post;}
203
+
204
+	if(!is_array($cf) && $cf!=''){
205
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
206
+		if(!$cf){return NULL;}
207
+	}
208
+
209
+	$html_var = $cf['htmlvar_name'];
210
+
211
+	// Check if there is a location specific filter.
212
+	if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
213
+		/**
214
+		 * Filter the url html by location.
215
+		 *
216
+		 * @param string $html The html to filter.
217
+		 * @param array $cf The custom field array.
218
+		 * @since 1.6.6
219
+		 */
220
+		$html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
221
+	}
222
+
223
+	// Check if there is a custom field specific filter.
224
+	if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
225
+		/**
226
+		 * Filter the url html by individual custom field.
227
+		 *
228
+		 * @param string $html The html to filter.
229
+		 * @param string $location The location to output the html.
230
+		 * @param array $cf The custom field array.
231
+		 * @since 1.6.6
232
+		 */
233
+		$html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
234
+	}
235
+
236
+	// Check if there is a custom field key specific filter.
237
+	if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
238
+		/**
239
+		 * Filter the url html by field type key.
240
+		 *
241
+		 * @param string $html The html to filter.
242
+		 * @param string $location The location to output the html.
243
+		 * @param array $cf The custom field array.
244
+		 * @since 1.6.6
245
+		 */
246
+		$html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
247
+	}
248
+
249
+	// If not html then we run the standard output.
250
+	if(empty($html)){
251
+
252
+		if ($post->{$cf['htmlvar_name']}):
253
+
254
+			$field_icon = geodir_field_icon_proccess($cf);
255
+			if (strpos($field_icon, 'http') !== false) {
256
+				$field_icon_af = '';
257
+			} elseif ($field_icon == '') {
258
+
259
+				if ($cf['name'] == 'geodir_facebook') {
260
+					$field_icon_af = '<i class="fa fa-facebook-square"></i>';
261
+				} elseif ($cf['name'] == 'geodir_twitter') {
262
+					$field_icon_af = '<i class="fa fa-twitter-square"></i>';
263
+				} else {
264
+					$field_icon_af = '<i class="fa fa-link"></i>';
265
+				}
266
+
267
+			} else {
268
+				$field_icon_af = $field_icon;
269
+				$field_icon = '';
270
+			}
271
+
272
+			$a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
273
+
274
+
275
+			$website = !empty($a_url['url']) ? $a_url['url'] : '';
276
+			$title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
277
+			if(!empty($cf['default_value'])){$title = $cf['default_value'];}
278
+			$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
279
+
280
+
281
+
282
+			// all search engines that use the nofollow value exclude links that use it from their ranking calculation
283
+			$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
284
+			/**
285
+			 * Filter custom field website name.
286
+			 *
287
+			 * @since 1.0.0
288
+			 *
289
+			 * @param string $title Website Title.
290
+			 * @param string $website Website URL.
291
+			 * @param int $post->ID Post ID.
292
+			 */
293
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
294
+
295
+		endif;
296
+
297
+	}
298
+
299
+	return $html;
300 300
 }
301 301
 add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
302 302
 
@@ -313,80 +313,80 @@  discard block
 block discarded – undo
313 313
  */
314 314
 function geodir_cf_phone($html,$location,$cf,$p=''){
315 315
 
316
-    // check we have the post value
317
-    if(is_int($p)){$post = geodir_get_post_info($p);}
318
-    else{ global $post;}
319
-
320
-    if(!is_array($cf) && $cf!=''){
321
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
322
-        if(!$cf){return NULL;}
323
-    }
324
-
325
-    $html_var = $cf['htmlvar_name'];
326
-
327
-    // Check if there is a location specific filter.
328
-    if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
329
-        /**
330
-         * Filter the phone html by location.
331
-         *
332
-         * @param string $html The html to filter.
333
-         * @param array $cf The custom field array.
334
-         * @since 1.6.6
335
-         */
336
-        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
337
-    }
338
-
339
-    // Check if there is a custom field specific filter.
340
-    if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
341
-        /**
342
-         * Filter the phone html by individual custom field.
343
-         *
344
-         * @param string $html The html to filter.
345
-         * @param string $location The location to output the html.
346
-         * @param array $cf The custom field array.
347
-         * @since 1.6.6
348
-         */
349
-        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
350
-    }
351
-
352
-    // Check if there is a custom field key specific filter.
353
-    if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
354
-        /**
355
-         * Filter the phone html by field type key.
356
-         *
357
-         * @param string $html The html to filter.
358
-         * @param string $location The location to output the html.
359
-         * @param array $cf The custom field array.
360
-         * @since 1.6.6
361
-         */
362
-        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
363
-    }
364
-
365
-    // If not html then we run the standard output.
366
-    if(empty($html)){
367
-
368
-        if ($post->{$cf['htmlvar_name']}):
369
-
370
-            $field_icon = geodir_field_icon_proccess($cf);
371
-            if (strpos($field_icon, 'http') !== false) {
372
-                $field_icon_af = '';
373
-            } elseif ($field_icon == '') {
374
-                $field_icon_af = '<i class="fa fa-phone"></i>';
375
-            } else {
376
-                $field_icon_af = $field_icon;
377
-                $field_icon = '';
378
-            }
379
-
380
-
381
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
382
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
383
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
384
-
385
-        endif;
386
-
387
-    }
388
-
389
-    return $html;
316
+	// check we have the post value
317
+	if(is_int($p)){$post = geodir_get_post_info($p);}
318
+	else{ global $post;}
319
+
320
+	if(!is_array($cf) && $cf!=''){
321
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
322
+		if(!$cf){return NULL;}
323
+	}
324
+
325
+	$html_var = $cf['htmlvar_name'];
326
+
327
+	// Check if there is a location specific filter.
328
+	if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
329
+		/**
330
+		 * Filter the phone html by location.
331
+		 *
332
+		 * @param string $html The html to filter.
333
+		 * @param array $cf The custom field array.
334
+		 * @since 1.6.6
335
+		 */
336
+		$html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
337
+	}
338
+
339
+	// Check if there is a custom field specific filter.
340
+	if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
341
+		/**
342
+		 * Filter the phone html by individual custom field.
343
+		 *
344
+		 * @param string $html The html to filter.
345
+		 * @param string $location The location to output the html.
346
+		 * @param array $cf The custom field array.
347
+		 * @since 1.6.6
348
+		 */
349
+		$html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
350
+	}
351
+
352
+	// Check if there is a custom field key specific filter.
353
+	if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
354
+		/**
355
+		 * Filter the phone html by field type key.
356
+		 *
357
+		 * @param string $html The html to filter.
358
+		 * @param string $location The location to output the html.
359
+		 * @param array $cf The custom field array.
360
+		 * @since 1.6.6
361
+		 */
362
+		$html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
363
+	}
364
+
365
+	// If not html then we run the standard output.
366
+	if(empty($html)){
367
+
368
+		if ($post->{$cf['htmlvar_name']}):
369
+
370
+			$field_icon = geodir_field_icon_proccess($cf);
371
+			if (strpos($field_icon, 'http') !== false) {
372
+				$field_icon_af = '';
373
+			} elseif ($field_icon == '') {
374
+				$field_icon_af = '<i class="fa fa-phone"></i>';
375
+			} else {
376
+				$field_icon_af = $field_icon;
377
+				$field_icon = '';
378
+			}
379
+
380
+
381
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
382
+					$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
383
+			$html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
384
+
385
+		endif;
386
+
387
+	}
388
+
389
+	return $html;
390 390
 }
391 391
 add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
392 392
 
@@ -403,85 +403,85 @@  discard block
 block discarded – undo
403 403
  */
404 404
 function geodir_cf_time($html,$location,$cf,$p=''){
405 405
 
406
-    // check we have the post value
407
-    if(is_int($p)){$post = geodir_get_post_info($p);}
408
-    else{ global $post;}
409
-
410
-    if(!is_array($cf) && $cf!=''){
411
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
412
-        if(!$cf){return NULL;}
413
-    }
414
-
415
-    $html_var = $cf['htmlvar_name'];
416
-
417
-    // Check if there is a location specific filter.
418
-    if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
419
-        /**
420
-         * Filter the time html by location.
421
-         *
422
-         * @param string $html The html to filter.
423
-         * @param array $cf The custom field array.
424
-         * @since 1.6.6
425
-         */
426
-        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
427
-    }
428
-
429
-    // Check if there is a custom field specific filter.
430
-    if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
431
-        /**
432
-         * Filter the time html by individual custom field.
433
-         *
434
-         * @param string $html The html to filter.
435
-         * @param string $location The location to output the html.
436
-         * @param array $cf The custom field array.
437
-         * @since 1.6.6
438
-         */
439
-        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
440
-    }
441
-
442
-    // Check if there is a custom field key specific filter.
443
-    if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
444
-        /**
445
-         * Filter the time html by field type key.
446
-         *
447
-         * @param string $html The html to filter.
448
-         * @param string $location The location to output the html.
449
-         * @param array $cf The custom field array.
450
-         * @since 1.6.6
451
-         */
452
-        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
453
-    }
454
-
455
-    // If not html then we run the standard output.
456
-    if(empty($html)){
457
-
458
-        if ($post->{$cf['htmlvar_name']}):
459
-
460
-            $value = '';
461
-            if ($post->{$cf['htmlvar_name']} != '')
462
-                //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
463
-                $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
464
-
465
-            $field_icon = geodir_field_icon_proccess($cf);
466
-            if (strpos($field_icon, 'http') !== false) {
467
-                $field_icon_af = '';
468
-            } elseif ($field_icon == '') {
469
-                $field_icon_af = '<i class="fa fa-clock-o"></i>';
470
-            } else {
471
-                $field_icon_af = $field_icon;
472
-                $field_icon = '';
473
-            }
474
-
475
-
476
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
477
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
478
-            $html .= '</span>' . $value . '</div>';
479
-
480
-        endif;
481
-
482
-    }
483
-
484
-    return $html;
406
+	// check we have the post value
407
+	if(is_int($p)){$post = geodir_get_post_info($p);}
408
+	else{ global $post;}
409
+
410
+	if(!is_array($cf) && $cf!=''){
411
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
412
+		if(!$cf){return NULL;}
413
+	}
414
+
415
+	$html_var = $cf['htmlvar_name'];
416
+
417
+	// Check if there is a location specific filter.
418
+	if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
419
+		/**
420
+		 * Filter the time html by location.
421
+		 *
422
+		 * @param string $html The html to filter.
423
+		 * @param array $cf The custom field array.
424
+		 * @since 1.6.6
425
+		 */
426
+		$html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
427
+	}
428
+
429
+	// Check if there is a custom field specific filter.
430
+	if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
431
+		/**
432
+		 * Filter the time html by individual custom field.
433
+		 *
434
+		 * @param string $html The html to filter.
435
+		 * @param string $location The location to output the html.
436
+		 * @param array $cf The custom field array.
437
+		 * @since 1.6.6
438
+		 */
439
+		$html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
440
+	}
441
+
442
+	// Check if there is a custom field key specific filter.
443
+	if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
444
+		/**
445
+		 * Filter the time html by field type key.
446
+		 *
447
+		 * @param string $html The html to filter.
448
+		 * @param string $location The location to output the html.
449
+		 * @param array $cf The custom field array.
450
+		 * @since 1.6.6
451
+		 */
452
+		$html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
453
+	}
454
+
455
+	// If not html then we run the standard output.
456
+	if(empty($html)){
457
+
458
+		if ($post->{$cf['htmlvar_name']}):
459
+
460
+			$value = '';
461
+			if ($post->{$cf['htmlvar_name']} != '')
462
+				//$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
463
+				$value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
464
+
465
+			$field_icon = geodir_field_icon_proccess($cf);
466
+			if (strpos($field_icon, 'http') !== false) {
467
+				$field_icon_af = '';
468
+			} elseif ($field_icon == '') {
469
+				$field_icon_af = '<i class="fa fa-clock-o"></i>';
470
+			} else {
471
+				$field_icon_af = $field_icon;
472
+				$field_icon = '';
473
+			}
474
+
475
+
476
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
477
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
478
+			$html .= '</span>' . $value . '</div>';
479
+
480
+		endif;
481
+
482
+	}
483
+
484
+	return $html;
485 485
 }
486 486
 add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
487 487
 
@@ -498,107 +498,107 @@  discard block
 block discarded – undo
498 498
  */
499 499
 function geodir_cf_datepicker($html,$location,$cf,$p=''){
500 500
 
501
-    // check we have the post value
502
-    if(is_int($p)){$post = geodir_get_post_info($p);}
503
-    else{ global $post;}
504
-
505
-    if(!is_array($cf) && $cf!=''){
506
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
507
-        if(!$cf){return NULL;}
508
-    }
509
-
510
-    $html_var = $cf['htmlvar_name'];
511
-
512
-    // Check if there is a location specific filter.
513
-    if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
514
-        /**
515
-         * Filter the datepicker html by location.
516
-         *
517
-         * @param string $html The html to filter.
518
-         * @param array $cf The custom field array.
519
-         * @since 1.6.6
520
-         */
521
-        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
522
-    }
523
-
524
-    // Check if there is a custom field specific filter.
525
-    if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
526
-        /**
527
-         * Filter the datepicker html by individual custom field.
528
-         *
529
-         * @param string $html The html to filter.
530
-         * @param string $location The location to output the html.
531
-         * @param array $cf The custom field array.
532
-         * @since 1.6.6
533
-         */
534
-        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
535
-    }
536
-
537
-    // Check if there is a custom field key specific filter.
538
-    if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
539
-        /**
540
-         * Filter the datepicker html by field type key.
541
-         *
542
-         * @param string $html The html to filter.
543
-         * @param string $location The location to output the html.
544
-         * @param array $cf The custom field array.
545
-         * @since 1.6.6
546
-         */
547
-        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
548
-    }
549
-
550
-    // If not html then we run the standard output.
551
-    if(empty($html)){
552
-
553
-        if ($post->{$cf['htmlvar_name']}):
554
-
555
-            $date_format = geodir_default_date_format();
556
-            if ($cf['extra_fields'] != '') {
557
-                $date_format = unserialize($cf['extra_fields']);
558
-                $date_format = $date_format['date_format'];
559
-            }
560
-            // check if we need to change the format or not
561
-            $date_format_len = strlen(str_replace(' ', '', $date_format));
562
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
563
-
564
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
565
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
566
-
567
-                $date_format = str_replace($search, $replace, $date_format);
568
-
569
-                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
570
-            }else{
571
-                $post_htmlvar_value = $post->{$cf['htmlvar_name']};
572
-            }
573
-
574
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
575
-                $value = date_i18n($date_format, strtotime($post_htmlvar_value));
576
-            }else{
577
-                return '';
578
-            }
579
-
580
-            $field_icon = geodir_field_icon_proccess($cf);
581
-
582
-            if (strpos($field_icon, 'http') !== false) {
583
-                $field_icon_af = '';
584
-            } elseif ($field_icon == '') {
585
-                $field_icon_af = '<i class="fa fa-calendar"></i>';
586
-            } else {
587
-                $field_icon_af = $field_icon;
588
-                $field_icon = '';
589
-            }
590
-
591
-
592
-
593
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
594
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
595
-            $html .= '</span>' . $value . '</div>';
596
-
597
-        endif;
598
-
599
-    }
600
-
601
-    return $html;
501
+	// check we have the post value
502
+	if(is_int($p)){$post = geodir_get_post_info($p);}
503
+	else{ global $post;}
504
+
505
+	if(!is_array($cf) && $cf!=''){
506
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
507
+		if(!$cf){return NULL;}
508
+	}
509
+
510
+	$html_var = $cf['htmlvar_name'];
511
+
512
+	// Check if there is a location specific filter.
513
+	if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
514
+		/**
515
+		 * Filter the datepicker html by location.
516
+		 *
517
+		 * @param string $html The html to filter.
518
+		 * @param array $cf The custom field array.
519
+		 * @since 1.6.6
520
+		 */
521
+		$html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
522
+	}
523
+
524
+	// Check if there is a custom field specific filter.
525
+	if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
526
+		/**
527
+		 * Filter the datepicker html by individual custom field.
528
+		 *
529
+		 * @param string $html The html to filter.
530
+		 * @param string $location The location to output the html.
531
+		 * @param array $cf The custom field array.
532
+		 * @since 1.6.6
533
+		 */
534
+		$html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
535
+	}
536
+
537
+	// Check if there is a custom field key specific filter.
538
+	if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
539
+		/**
540
+		 * Filter the datepicker html by field type key.
541
+		 *
542
+		 * @param string $html The html to filter.
543
+		 * @param string $location The location to output the html.
544
+		 * @param array $cf The custom field array.
545
+		 * @since 1.6.6
546
+		 */
547
+		$html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
548
+	}
549
+
550
+	// If not html then we run the standard output.
551
+	if(empty($html)){
552
+
553
+		if ($post->{$cf['htmlvar_name']}):
554
+
555
+			$date_format = geodir_default_date_format();
556
+			if ($cf['extra_fields'] != '') {
557
+				$date_format = unserialize($cf['extra_fields']);
558
+				$date_format = $date_format['date_format'];
559
+			}
560
+			// check if we need to change the format or not
561
+			$date_format_len = strlen(str_replace(' ', '', $date_format));
562
+			if($date_format_len>5){// if greater then 4 then it's the old style format.
563
+
564
+				$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
565
+				$replace = array('d','j','l','m','n','F','Y');//PHP date format
566
+
567
+				$date_format = str_replace($search, $replace, $date_format);
568
+
569
+				$post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
570
+			}else{
571
+				$post_htmlvar_value = $post->{$cf['htmlvar_name']};
572
+			}
573
+
574
+			if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
575
+				$value = date_i18n($date_format, strtotime($post_htmlvar_value));
576
+			}else{
577
+				return '';
578
+			}
579
+
580
+			$field_icon = geodir_field_icon_proccess($cf);
581
+
582
+			if (strpos($field_icon, 'http') !== false) {
583
+				$field_icon_af = '';
584
+			} elseif ($field_icon == '') {
585
+				$field_icon_af = '<i class="fa fa-calendar"></i>';
586
+			} else {
587
+				$field_icon_af = $field_icon;
588
+				$field_icon = '';
589
+			}
590
+
591
+
592
+
593
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
594
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
595
+			$html .= '</span>' . $value . '</div>';
596
+
597
+		endif;
598
+
599
+	}
600
+
601
+	return $html;
602 602
 }
603 603
 add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
604 604
 
@@ -615,84 +615,84 @@  discard block
 block discarded – undo
615 615
  */
616 616
 function geodir_cf_text($html,$location,$cf,$p=''){
617 617
 
618
-    // check we have the post value
619
-    if(is_int($p)){$post = geodir_get_post_info($p);}
620
-    else{ global $post;}
621
-
622
-    if(!is_array($cf) && $cf!=''){
623
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
624
-        if(!$cf){return NULL;}
625
-    }
626
-
627
-    $html_var = $cf['htmlvar_name'];
628
-
629
-    // Check if there is a location specific filter.
630
-    if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
631
-        /**
632
-         * Filter the text html by location.
633
-         *
634
-         * @param string $html The html to filter.
635
-         * @param array $cf The custom field array.
636
-         * @since 1.6.6
637
-         */
638
-        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
639
-    }
640
-
641
-    // Check if there is a custom field specific filter.
642
-    if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
643
-        /**
644
-         * Filter the text html by individual custom field.
645
-         *
646
-         * @param string $html The html to filter.
647
-         * @param string $location The location to output the html.
648
-         * @param array $cf The custom field array.
649
-         * @since 1.6.6
650
-         */
651
-        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
652
-    }
653
-
654
-    // Check if there is a custom field key specific filter.
655
-    if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
656
-        /**
657
-         * Filter the text html by field type key.
658
-         *
659
-         * @param string $html The html to filter.
660
-         * @param string $location The location to output the html.
661
-         * @param array $cf The custom field array.
662
-         * @since 1.6.6
663
-         */
664
-        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
665
-    }
618
+	// check we have the post value
619
+	if(is_int($p)){$post = geodir_get_post_info($p);}
620
+	else{ global $post;}
621
+
622
+	if(!is_array($cf) && $cf!=''){
623
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
624
+		if(!$cf){return NULL;}
625
+	}
626
+
627
+	$html_var = $cf['htmlvar_name'];
628
+
629
+	// Check if there is a location specific filter.
630
+	if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
631
+		/**
632
+		 * Filter the text html by location.
633
+		 *
634
+		 * @param string $html The html to filter.
635
+		 * @param array $cf The custom field array.
636
+		 * @since 1.6.6
637
+		 */
638
+		$html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
639
+	}
640
+
641
+	// Check if there is a custom field specific filter.
642
+	if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
643
+		/**
644
+		 * Filter the text html by individual custom field.
645
+		 *
646
+		 * @param string $html The html to filter.
647
+		 * @param string $location The location to output the html.
648
+		 * @param array $cf The custom field array.
649
+		 * @since 1.6.6
650
+		 */
651
+		$html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
652
+	}
653
+
654
+	// Check if there is a custom field key specific filter.
655
+	if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
656
+		/**
657
+		 * Filter the text html by field type key.
658
+		 *
659
+		 * @param string $html The html to filter.
660
+		 * @param string $location The location to output the html.
661
+		 * @param array $cf The custom field array.
662
+		 * @since 1.6.6
663
+		 */
664
+		$html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
665
+	}
666 666
 
667 667
     
668 668
 
669
-    // If not html then we run the standard output.
670
-    if(empty($html)){
669
+	// If not html then we run the standard output.
670
+	if(empty($html)){
671 671
 
672
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
672
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
673 673
 
674
-            $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
674
+			$class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
675 675
 
676
-            $field_icon = geodir_field_icon_proccess($cf);
677
-            if (strpos($field_icon, 'http') !== false) {
678
-                $field_icon_af = '';
679
-            } elseif ($field_icon == '') {
680
-                $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
681
-            } else {
682
-                $field_icon_af = $field_icon;
683
-                $field_icon = '';
684
-            }
676
+			$field_icon = geodir_field_icon_proccess($cf);
677
+			if (strpos($field_icon, 'http') !== false) {
678
+				$field_icon_af = '';
679
+			} elseif ($field_icon == '') {
680
+				$field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
681
+			} else {
682
+				$field_icon_af = $field_icon;
683
+				$field_icon = '';
684
+			}
685 685
 
686 686
 
687
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
688
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
689
-            $html .= '</span>' . $post->{$cf['htmlvar_name']} . '</div>';
687
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
688
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
689
+			$html .= '</span>' . $post->{$cf['htmlvar_name']} . '</div>';
690 690
 
691
-        endif;
691
+		endif;
692 692
 
693
-    }
693
+	}
694 694
 
695
-    return $html;
695
+	return $html;
696 696
 }
697 697
 add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
698 698
 
@@ -709,98 +709,98 @@  discard block
 block discarded – undo
709 709
  */
710 710
 function geodir_cf_radio($html,$location,$cf,$p=''){
711 711
 
712
-    // check we have the post value
713
-    if(is_int($p)){$post = geodir_get_post_info($p);}
714
-    else{ global $post;}
715
-
716
-    if(!is_array($cf) && $cf!=''){
717
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
718
-        if(!$cf){return NULL;}
719
-    }
720
-
721
-    $html_var = $cf['htmlvar_name'];
722
-
723
-    // Check if there is a location specific filter.
724
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
725
-        /**
726
-         * Filter the radio html by location.
727
-         *
728
-         * @param string $html The html to filter.
729
-         * @param array $cf The custom field array.
730
-         * @since 1.6.6
731
-         */
732
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
733
-    }
734
-
735
-    // Check if there is a custom field specific filter.
736
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
737
-        /**
738
-         * Filter the radio html by individual custom field.
739
-         *
740
-         * @param string $html The html to filter.
741
-         * @param string $location The location to output the html.
742
-         * @param array $cf The custom field array.
743
-         * @since 1.6.6
744
-         */
745
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
746
-    }
747
-
748
-    // Check if there is a custom field key specific filter.
749
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
750
-        /**
751
-         * Filter the radio html by field type key.
752
-         *
753
-         * @param string $html The html to filter.
754
-         * @param string $location The location to output the html.
755
-         * @param array $cf The custom field array.
756
-         * @since 1.6.6
757
-         */
758
-        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
759
-    }
760
-
761
-    // If not html then we run the standard output.
762
-    if(empty($html)){
763
-
764
-        $html_val = __($post->{$cf['htmlvar_name']}, 'geodirectory');
765
-        if ($post->{$cf['htmlvar_name']} != ''):
766
-
767
-            if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
768
-                $html_val = __('No', 'geodirectory');
769
-            } else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
770
-                $html_val = __('Yes', 'geodirectory');
771
-            } else {
772
-                if (!empty($cf['option_values'])) {
773
-                    $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
774
-
775
-                    if (!empty($cf_option_values)) {
776
-                        foreach ($cf_option_values as $cf_option_value) {
777
-                            if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
778
-                                $html_val = $cf_option_value['label'];
779
-                            }
780
-                        }
781
-                    }
782
-                }
783
-            }
784
-
785
-            $field_icon = geodir_field_icon_proccess($cf);
786
-            if (strpos($field_icon, 'http') !== false) {
787
-                $field_icon_af = '';
788
-            } elseif ($field_icon == '') {
789
-                $field_icon_af = '';
790
-            } else {
791
-                $field_icon_af = $field_icon;
792
-                $field_icon = '';
793
-            }
794
-
795
-
796
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
797
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
798
-            $html .= '</span>' . $html_val . '</div>';
799
-        endif;
800
-
801
-    }
802
-
803
-    return $html;
712
+	// check we have the post value
713
+	if(is_int($p)){$post = geodir_get_post_info($p);}
714
+	else{ global $post;}
715
+
716
+	if(!is_array($cf) && $cf!=''){
717
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
718
+		if(!$cf){return NULL;}
719
+	}
720
+
721
+	$html_var = $cf['htmlvar_name'];
722
+
723
+	// Check if there is a location specific filter.
724
+	if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
725
+		/**
726
+		 * Filter the radio html by location.
727
+		 *
728
+		 * @param string $html The html to filter.
729
+		 * @param array $cf The custom field array.
730
+		 * @since 1.6.6
731
+		 */
732
+		$html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
733
+	}
734
+
735
+	// Check if there is a custom field specific filter.
736
+	if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
737
+		/**
738
+		 * Filter the radio html by individual custom field.
739
+		 *
740
+		 * @param string $html The html to filter.
741
+		 * @param string $location The location to output the html.
742
+		 * @param array $cf The custom field array.
743
+		 * @since 1.6.6
744
+		 */
745
+		$html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
746
+	}
747
+
748
+	// Check if there is a custom field key specific filter.
749
+	if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
750
+		/**
751
+		 * Filter the radio html by field type key.
752
+		 *
753
+		 * @param string $html The html to filter.
754
+		 * @param string $location The location to output the html.
755
+		 * @param array $cf The custom field array.
756
+		 * @since 1.6.6
757
+		 */
758
+		$html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
759
+	}
760
+
761
+	// If not html then we run the standard output.
762
+	if(empty($html)){
763
+
764
+		$html_val = __($post->{$cf['htmlvar_name']}, 'geodirectory');
765
+		if ($post->{$cf['htmlvar_name']} != ''):
766
+
767
+			if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
768
+				$html_val = __('No', 'geodirectory');
769
+			} else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
770
+				$html_val = __('Yes', 'geodirectory');
771
+			} else {
772
+				if (!empty($cf['option_values'])) {
773
+					$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
774
+
775
+					if (!empty($cf_option_values)) {
776
+						foreach ($cf_option_values as $cf_option_value) {
777
+							if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
778
+								$html_val = $cf_option_value['label'];
779
+							}
780
+						}
781
+					}
782
+				}
783
+			}
784
+
785
+			$field_icon = geodir_field_icon_proccess($cf);
786
+			if (strpos($field_icon, 'http') !== false) {
787
+				$field_icon_af = '';
788
+			} elseif ($field_icon == '') {
789
+				$field_icon_af = '';
790
+			} else {
791
+				$field_icon_af = $field_icon;
792
+				$field_icon = '';
793
+			}
794
+
795
+
796
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
797
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
798
+			$html .= '</span>' . $html_val . '</div>';
799
+		endif;
800
+
801
+	}
802
+
803
+	return $html;
804 804
 }
805 805
 add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
806 806
 
@@ -817,92 +817,92 @@  discard block
 block discarded – undo
817 817
  */
818 818
 function geodir_cf_select($html,$location,$cf,$p=''){
819 819
 
820
-    // check we have the post value
821
-    if(is_int($p)){$post = geodir_get_post_info($p);}
822
-    else{ global $post;}
823
-
824
-    if(!is_array($cf) && $cf!=''){
825
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
826
-        if(!$cf){return NULL;}
827
-    }
828
-
829
-    $html_var = $cf['htmlvar_name'];
830
-
831
-    // Check if there is a location specific filter.
832
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
833
-        /**
834
-         * Filter the select html by location.
835
-         *
836
-         * @param string $html The html to filter.
837
-         * @param array $cf The custom field array.
838
-         * @since 1.6.6
839
-         */
840
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
841
-    }
842
-
843
-    // Check if there is a custom field specific filter.
844
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
845
-        /**
846
-         * Filter the select html by individual custom field.
847
-         *
848
-         * @param string $html The html to filter.
849
-         * @param string $location The location to output the html.
850
-         * @param array $cf The custom field array.
851
-         * @since 1.6.6
852
-         */
853
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
854
-    }
855
-
856
-    // Check if there is a custom field key specific filter.
857
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
858
-        /**
859
-         * Filter the select html by field type key.
860
-         *
861
-         * @param string $html The html to filter.
862
-         * @param string $location The location to output the html.
863
-         * @param array $cf The custom field array.
864
-         * @since 1.6.6
865
-         */
866
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
867
-    }
868
-
869
-    // If not html then we run the standard output.
870
-    if(empty($html)){
871
-
872
-        if ($post->{$cf['htmlvar_name']}):
873
-            $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
874
-
875
-            if (!empty($cf['option_values'])) {
876
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
877
-
878
-                if (!empty($cf_option_values)) {
879
-                    foreach ($cf_option_values as $cf_option_value) {
880
-                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
881
-                            //$field_value = $cf_option_value['label']; // no longer needed here.
882
-                        }
883
-                    }
884
-                }
885
-            }
886
-
887
-            $field_icon = geodir_field_icon_proccess($cf);
888
-            if (strpos($field_icon, 'http') !== false) {
889
-                $field_icon_af = '';
890
-            } elseif ($field_icon == '') {
891
-                $field_icon_af = '';
892
-            } else {
893
-                $field_icon_af = $field_icon;
894
-                $field_icon = '';
895
-            }
896
-
897
-
898
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
899
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
900
-            $html .= '</span>' . $field_value . '</div>';
901
-        endif;
902
-
903
-    }
904
-
905
-    return $html;
820
+	// check we have the post value
821
+	if(is_int($p)){$post = geodir_get_post_info($p);}
822
+	else{ global $post;}
823
+
824
+	if(!is_array($cf) && $cf!=''){
825
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
826
+		if(!$cf){return NULL;}
827
+	}
828
+
829
+	$html_var = $cf['htmlvar_name'];
830
+
831
+	// Check if there is a location specific filter.
832
+	if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
833
+		/**
834
+		 * Filter the select html by location.
835
+		 *
836
+		 * @param string $html The html to filter.
837
+		 * @param array $cf The custom field array.
838
+		 * @since 1.6.6
839
+		 */
840
+		$html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
841
+	}
842
+
843
+	// Check if there is a custom field specific filter.
844
+	if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
845
+		/**
846
+		 * Filter the select html by individual custom field.
847
+		 *
848
+		 * @param string $html The html to filter.
849
+		 * @param string $location The location to output the html.
850
+		 * @param array $cf The custom field array.
851
+		 * @since 1.6.6
852
+		 */
853
+		$html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
854
+	}
855
+
856
+	// Check if there is a custom field key specific filter.
857
+	if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
858
+		/**
859
+		 * Filter the select html by field type key.
860
+		 *
861
+		 * @param string $html The html to filter.
862
+		 * @param string $location The location to output the html.
863
+		 * @param array $cf The custom field array.
864
+		 * @since 1.6.6
865
+		 */
866
+		$html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
867
+	}
868
+
869
+	// If not html then we run the standard output.
870
+	if(empty($html)){
871
+
872
+		if ($post->{$cf['htmlvar_name']}):
873
+			$field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
874
+
875
+			if (!empty($cf['option_values'])) {
876
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
877
+
878
+				if (!empty($cf_option_values)) {
879
+					foreach ($cf_option_values as $cf_option_value) {
880
+						if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
881
+							//$field_value = $cf_option_value['label']; // no longer needed here.
882
+						}
883
+					}
884
+				}
885
+			}
886
+
887
+			$field_icon = geodir_field_icon_proccess($cf);
888
+			if (strpos($field_icon, 'http') !== false) {
889
+				$field_icon_af = '';
890
+			} elseif ($field_icon == '') {
891
+				$field_icon_af = '';
892
+			} else {
893
+				$field_icon_af = $field_icon;
894
+				$field_icon = '';
895
+			}
896
+
897
+
898
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
899
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
900
+			$html .= '</span>' . $field_value . '</div>';
901
+		endif;
902
+
903
+	}
904
+
905
+	return $html;
906 906
 }
907 907
 add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
908 908
 
@@ -919,113 +919,113 @@  discard block
 block discarded – undo
919 919
  */
920 920
 function geodir_cf_multiselect($html,$location,$cf,$p=''){
921 921
 
922
-    // check we have the post value
923
-    if(is_int($p)){$post = geodir_get_post_info($p);}
924
-    else{ global $post;}
925
-
926
-    if(!is_array($cf) && $cf!=''){
927
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
928
-        if(!$cf){return NULL;}
929
-    }
930
-
931
-    $html_var = $cf['htmlvar_name'];
932
-
933
-    // Check if there is a location specific filter.
934
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
935
-        /**
936
-         * Filter the multiselect html by location.
937
-         *
938
-         * @param string $html The html to filter.
939
-         * @param array $cf The custom field array.
940
-         * @since 1.6.6
941
-         */
942
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
943
-    }
944
-
945
-    // Check if there is a custom field specific filter.
946
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
947
-        /**
948
-         * Filter the multiselect html by individual custom field.
949
-         *
950
-         * @param string $html The html to filter.
951
-         * @param string $location The location to output the html.
952
-         * @param array $cf The custom field array.
953
-         * @since 1.6.6
954
-         */
955
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
956
-    }
957
-
958
-    // Check if there is a custom field key specific filter.
959
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
960
-        /**
961
-         * Filter the multiselect html by field type key.
962
-         *
963
-         * @param string $html The html to filter.
964
-         * @param string $location The location to output the html.
965
-         * @param array $cf The custom field array.
966
-         * @since 1.6.6
967
-         */
968
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
969
-    }
970
-
971
-    // If not html then we run the standard output.
972
-    if(empty($html)){
973
-
974
-
975
-        if (!empty($post->{$cf['htmlvar_name']})):
976
-
977
-            if (is_array($post->{$cf['htmlvar_name']})) {
978
-                $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
979
-            }
980
-
981
-            $field_icon = geodir_field_icon_proccess($cf);
982
-            if (strpos($field_icon, 'http') !== false) {
983
-                $field_icon_af = '';
984
-            } elseif ($field_icon == '') {
985
-                $field_icon_af = '';
986
-            } else {
987
-                $field_icon_af = $field_icon;
988
-                $field_icon = '';
989
-            }
990
-
991
-            $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
992
-
993
-            $option_values = array();
994
-            if (!empty($cf['option_values'])) {
995
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
996
-
997
-                if (!empty($cf_option_values)) {
998
-                    foreach ($cf_option_values as $cf_option_value) {
999
-                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1000
-                            $option_values[] = $cf_option_value['label'];
1001
-                        }
1002
-                    }
1003
-                }
1004
-            }
1005
-
1006
-
1007
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1008
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1009
-            $html .= '</span>';
1010
-
1011
-            if (count($option_values) > 1) {
1012
-                $html .= '<ul>';
1013
-
1014
-                foreach ($option_values as $val) {
1015
-                    $html .= '<li>' . $val . '</li>';
1016
-                }
1017
-
1018
-                $html .= '</ul>';
1019
-            } else {
1020
-                $html .= $post->{$cf['htmlvar_name']};
1021
-            }
1022
-
1023
-            $html .= '</div>';
1024
-        endif;
1025
-
1026
-    }
1027
-
1028
-    return $html;
922
+	// check we have the post value
923
+	if(is_int($p)){$post = geodir_get_post_info($p);}
924
+	else{ global $post;}
925
+
926
+	if(!is_array($cf) && $cf!=''){
927
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
928
+		if(!$cf){return NULL;}
929
+	}
930
+
931
+	$html_var = $cf['htmlvar_name'];
932
+
933
+	// Check if there is a location specific filter.
934
+	if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
935
+		/**
936
+		 * Filter the multiselect html by location.
937
+		 *
938
+		 * @param string $html The html to filter.
939
+		 * @param array $cf The custom field array.
940
+		 * @since 1.6.6
941
+		 */
942
+		$html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
943
+	}
944
+
945
+	// Check if there is a custom field specific filter.
946
+	if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
947
+		/**
948
+		 * Filter the multiselect html by individual custom field.
949
+		 *
950
+		 * @param string $html The html to filter.
951
+		 * @param string $location The location to output the html.
952
+		 * @param array $cf The custom field array.
953
+		 * @since 1.6.6
954
+		 */
955
+		$html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
956
+	}
957
+
958
+	// Check if there is a custom field key specific filter.
959
+	if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
960
+		/**
961
+		 * Filter the multiselect html by field type key.
962
+		 *
963
+		 * @param string $html The html to filter.
964
+		 * @param string $location The location to output the html.
965
+		 * @param array $cf The custom field array.
966
+		 * @since 1.6.6
967
+		 */
968
+		$html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
969
+	}
970
+
971
+	// If not html then we run the standard output.
972
+	if(empty($html)){
973
+
974
+
975
+		if (!empty($post->{$cf['htmlvar_name']})):
976
+
977
+			if (is_array($post->{$cf['htmlvar_name']})) {
978
+				$post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
979
+			}
980
+
981
+			$field_icon = geodir_field_icon_proccess($cf);
982
+			if (strpos($field_icon, 'http') !== false) {
983
+				$field_icon_af = '';
984
+			} elseif ($field_icon == '') {
985
+				$field_icon_af = '';
986
+			} else {
987
+				$field_icon_af = $field_icon;
988
+				$field_icon = '';
989
+			}
990
+
991
+			$field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
992
+
993
+			$option_values = array();
994
+			if (!empty($cf['option_values'])) {
995
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
996
+
997
+				if (!empty($cf_option_values)) {
998
+					foreach ($cf_option_values as $cf_option_value) {
999
+						if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1000
+							$option_values[] = $cf_option_value['label'];
1001
+						}
1002
+					}
1003
+				}
1004
+			}
1005
+
1006
+
1007
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1008
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1009
+			$html .= '</span>';
1010
+
1011
+			if (count($option_values) > 1) {
1012
+				$html .= '<ul>';
1013
+
1014
+				foreach ($option_values as $val) {
1015
+					$html .= '<li>' . $val . '</li>';
1016
+				}
1017
+
1018
+				$html .= '</ul>';
1019
+			} else {
1020
+				$html .= $post->{$cf['htmlvar_name']};
1021
+			}
1022
+
1023
+			$html .= '</div>';
1024
+		endif;
1025
+
1026
+	}
1027
+
1028
+	return $html;
1029 1029
 }
1030 1030
 add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1031 1031
 
@@ -1042,153 +1042,153 @@  discard block
 block discarded – undo
1042 1042
  */
1043 1043
 function geodir_cf_email($html,$location,$cf,$p=''){
1044 1044
 
1045
-    // check we have the post value
1046
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1047
-    else{ global $post;}
1048
-
1049
-    if(!is_array($cf) && $cf!=''){
1050
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1051
-        if(!$cf){return NULL;}
1052
-    }
1053
-
1054
-    $html_var = $cf['htmlvar_name'];
1055
-
1056
-    // Check if there is a location specific filter.
1057
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1058
-        /**
1059
-         * Filter the email html by location.
1060
-         *
1061
-         * @param string $html The html to filter.
1062
-         * @param array $cf The custom field array.
1063
-         * @since 1.6.6
1064
-         */
1065
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1066
-    }
1067
-
1068
-    // Check if there is a custom field specific filter.
1069
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1070
-        /**
1071
-         * Filter the email html by individual custom field.
1072
-         *
1073
-         * @param string $html The html to filter.
1074
-         * @param string $location The location to output the html.
1075
-         * @param array $cf The custom field array.
1076
-         * @since 1.6.6
1077
-         */
1078
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1079
-    }
1080
-
1081
-    // Check if there is a custom field key specific filter.
1082
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1083
-        /**
1084
-         * Filter the email html by field type key.
1085
-         *
1086
-         * @param string $html The html to filter.
1087
-         * @param string $location The location to output the html.
1088
-         * @param array $cf The custom field array.
1089
-         * @since 1.6.6
1090
-         */
1091
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1092
-    }
1093
-
1094
-    // If not html then we run the standard output.
1095
-    if(empty($html)){
1096
-
1097
-        global $preview;
1098
-        if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1099
-            return ''; // Remove Send Enquiry | Send To Friend from listings page
1100
-        }
1101
-
1102
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1103
-
1104
-        if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$cf['htmlvar_name']})) {
1105
-            $send_to_friend = true;
1106
-            $b_send_inquiry = '';
1107
-            $b_sendtofriend = '';
1108
-
1109
-            $html = '';
1110
-            if (!$preview) {
1111
-                $b_send_inquiry = 'b_send_inquiry';
1112
-                $b_sendtofriend = 'b_sendtofriend';
1113
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1114
-            }
1115
-
1116
-            $field_icon = geodir_field_icon_proccess($cf);
1117
-            if (strpos($field_icon, 'http') !== false) {
1118
-                $field_icon_af = '';
1119
-            } elseif ($field_icon == '') {
1120
-                $field_icon_af = '<i class="fa fa-envelope"></i>';
1121
-            } else {
1122
-                $field_icon_af = $field_icon;
1123
-                $field_icon = '';
1124
-            }
1125
-
1126
-
1127
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1128
-            $seperator = '';
1129
-            if ($post->{$cf['htmlvar_name']}) {
1130
-                $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1131
-                $seperator = ' | ';
1132
-            }
1133
-
1134
-            if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
1135
-                $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1136
-            }
1137
-
1138
-            $html .= '</span></div>';
1139
-
1140
-
1141
-            if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1142
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1143
-            } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1144
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1145
-            } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1146
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1147
-            }
1148
-
1149
-            /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1150
-
1151
-        } else {
1152
-
1153
-            if ($post->{$cf['htmlvar_name']}) {
1154
-
1155
-                $field_icon = geodir_field_icon_proccess($cf);
1156
-                if (strpos($field_icon, 'http') !== false) {
1157
-                    $field_icon_af = '';
1158
-                } elseif ($field_icon == '') {
1159
-                    $field_icon_af = '<i class="fa fa-envelope"></i>';
1160
-                } else {
1161
-                    $field_icon_af = $field_icon;
1162
-                    $field_icon = '';
1163
-                }
1164
-
1165
-
1166
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1167
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1168
-                $html .= '</span><span class="geodir-email-address-output">';
1169
-                $email = $post->{$cf['htmlvar_name']} ;
1170
-                if($e_split = explode('@',$email)){
1171
-                    /**
1172
-                     * Filter email custom field name output.
1173
-                     *
1174
-                     * @since 1.5.3
1175
-                     *
1176
-                     * @param string $email The email string being output.
1177
-                     * @param array $cf Custom field variables array.
1178
-                     */
1179
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1180
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1181
-                }else{
1182
-                    $html .=  $email;
1183
-                }
1184
-                $html .= '</span></div>';
1185
-            }
1186
-
1187
-        }
1188
-
1189
-    }
1190
-
1191
-    return $html;
1045
+	// check we have the post value
1046
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1047
+	else{ global $post;}
1048
+
1049
+	if(!is_array($cf) && $cf!=''){
1050
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1051
+		if(!$cf){return NULL;}
1052
+	}
1053
+
1054
+	$html_var = $cf['htmlvar_name'];
1055
+
1056
+	// Check if there is a location specific filter.
1057
+	if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1058
+		/**
1059
+		 * Filter the email html by location.
1060
+		 *
1061
+		 * @param string $html The html to filter.
1062
+		 * @param array $cf The custom field array.
1063
+		 * @since 1.6.6
1064
+		 */
1065
+		$html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1066
+	}
1067
+
1068
+	// Check if there is a custom field specific filter.
1069
+	if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1070
+		/**
1071
+		 * Filter the email html by individual custom field.
1072
+		 *
1073
+		 * @param string $html The html to filter.
1074
+		 * @param string $location The location to output the html.
1075
+		 * @param array $cf The custom field array.
1076
+		 * @since 1.6.6
1077
+		 */
1078
+		$html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1079
+	}
1080
+
1081
+	// Check if there is a custom field key specific filter.
1082
+	if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1083
+		/**
1084
+		 * Filter the email html by field type key.
1085
+		 *
1086
+		 * @param string $html The html to filter.
1087
+		 * @param string $location The location to output the html.
1088
+		 * @param array $cf The custom field array.
1089
+		 * @since 1.6.6
1090
+		 */
1091
+		$html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1092
+	}
1093
+
1094
+	// If not html then we run the standard output.
1095
+	if(empty($html)){
1096
+
1097
+		global $preview;
1098
+		if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1099
+			return ''; // Remove Send Enquiry | Send To Friend from listings page
1100
+		}
1101
+
1102
+		$package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1103
+
1104
+		if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$cf['htmlvar_name']})) {
1105
+			$send_to_friend = true;
1106
+			$b_send_inquiry = '';
1107
+			$b_sendtofriend = '';
1108
+
1109
+			$html = '';
1110
+			if (!$preview) {
1111
+				$b_send_inquiry = 'b_send_inquiry';
1112
+				$b_sendtofriend = 'b_sendtofriend';
1113
+				$html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1114
+			}
1115
+
1116
+			$field_icon = geodir_field_icon_proccess($cf);
1117
+			if (strpos($field_icon, 'http') !== false) {
1118
+				$field_icon_af = '';
1119
+			} elseif ($field_icon == '') {
1120
+				$field_icon_af = '<i class="fa fa-envelope"></i>';
1121
+			} else {
1122
+				$field_icon_af = $field_icon;
1123
+				$field_icon = '';
1124
+			}
1125
+
1126
+
1127
+			$html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1128
+			$seperator = '';
1129
+			if ($post->{$cf['htmlvar_name']}) {
1130
+				$html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1131
+				$seperator = ' | ';
1132
+			}
1133
+
1134
+			if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
1135
+				$html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1136
+			}
1137
+
1138
+			$html .= '</span></div>';
1139
+
1140
+
1141
+			if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1142
+				$html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1143
+			} elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1144
+				$html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1145
+			} elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1146
+				$html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1147
+			}
1148
+
1149
+			/*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1150
+
1151
+		} else {
1152
+
1153
+			if ($post->{$cf['htmlvar_name']}) {
1154
+
1155
+				$field_icon = geodir_field_icon_proccess($cf);
1156
+				if (strpos($field_icon, 'http') !== false) {
1157
+					$field_icon_af = '';
1158
+				} elseif ($field_icon == '') {
1159
+					$field_icon_af = '<i class="fa fa-envelope"></i>';
1160
+				} else {
1161
+					$field_icon_af = $field_icon;
1162
+					$field_icon = '';
1163
+				}
1164
+
1165
+
1166
+				$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1167
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1168
+				$html .= '</span><span class="geodir-email-address-output">';
1169
+				$email = $post->{$cf['htmlvar_name']} ;
1170
+				if($e_split = explode('@',$email)){
1171
+					/**
1172
+					 * Filter email custom field name output.
1173
+					 *
1174
+					 * @since 1.5.3
1175
+					 *
1176
+					 * @param string $email The email string being output.
1177
+					 * @param array $cf Custom field variables array.
1178
+					 */
1179
+					$email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1180
+					$html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1181
+				}else{
1182
+					$html .=  $email;
1183
+				}
1184
+				$html .= '</span></div>';
1185
+			}
1186
+
1187
+		}
1188
+
1189
+	}
1190
+
1191
+	return $html;
1192 1192
 }
1193 1193
 add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1194 1194
 
@@ -1205,130 +1205,130 @@  discard block
 block discarded – undo
1205 1205
  */
1206 1206
 function geodir_cf_file($html,$location,$cf,$p=''){
1207 1207
 
1208
-    // check we have the post value
1209
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1210
-    else{ global $post;}
1211
-
1212
-    if(!is_array($cf) && $cf!=''){
1213
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1214
-        if(!$cf){return NULL;}
1215
-    }
1216
-
1217
-    $html_var = $cf['htmlvar_name'];
1218
-
1219
-    // Check if there is a location specific filter.
1220
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1221
-        /**
1222
-         * Filter the file html by location.
1223
-         *
1224
-         * @param string $html The html to filter.
1225
-         * @param array $cf The custom field array.
1226
-         * @since 1.6.6
1227
-         */
1228
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1229
-    }
1230
-
1231
-    // Check if there is a custom field specific filter.
1232
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1233
-        /**
1234
-         * Filter the file html by individual custom field.
1235
-         *
1236
-         * @param string $html The html to filter.
1237
-         * @param string $location The location to output the html.
1238
-         * @param array $cf The custom field array.
1239
-         * @since 1.6.6
1240
-         */
1241
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1242
-    }
1243
-
1244
-    // Check if there is a custom field key specific filter.
1245
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1246
-        /**
1247
-         * Filter the file html by field type key.
1248
-         *
1249
-         * @param string $html The html to filter.
1250
-         * @param string $location The location to output the html.
1251
-         * @param array $cf The custom field array.
1252
-         * @since 1.6.6
1253
-         */
1254
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1255
-    }
1256
-
1257
-    // If not html then we run the standard output.
1258
-    if(empty($html)){
1259
-
1260
-        if (!empty($post->{$cf['htmlvar_name']})):
1261
-
1262
-            $files = explode(",", $post->{$cf['htmlvar_name']});
1263
-            if (!empty($files)):
1264
-
1265
-                $extra_fields = !empty($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : NULL;
1266
-                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1267
-
1268
-                $file_paths = '';
1269
-                foreach ($files as $file) {
1270
-                    if (!empty($file)) {
1271
-
1272
-                        // $filetype = wp_check_filetype($file);
1273
-
1274
-                        $image_name_arr = explode('/', $file);
1275
-                        $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1276
-                        $filename = end($image_name_arr);
1277
-                        $img_name_arr = explode('.', $filename);
1278
-
1279
-                        $arr_file_type = wp_check_filetype($filename);
1280
-                        if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1281
-                            continue;
1282
-                        }
1283
-
1284
-                        $uploaded_file_type = $arr_file_type['type'];
1285
-                        $uploaded_file_ext = $arr_file_type['ext'];
1286
-
1287
-                        if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1288
-                            continue; // Invalid file type.
1289
-                        }
1290
-
1291
-                        //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1292
-                        $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1293
-
1294
-                        // If the uploaded file is image
1295
-                        if (in_array($uploaded_file_type, $image_file_types)) {
1296
-                            $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1297
-                            $file_paths .= '<a href="'.$file.'">';
1298
-                            $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1299
-                            $file_paths .= '</a>';
1300
-                            //$file_paths .= '<img src="'.$file.'"  />';	
1301
-                            $file_paths .= '</div>';
1302
-                        } else {
1303
-                            $ext_path = '_' . $html_var . '_';
1304
-                            $filename = explode($ext_path, $filename);
1305
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1306
-                        }
1307
-                    }
1308
-                }
1309
-
1310
-                $field_icon = geodir_field_icon_proccess($cf);
1311
-                if (strpos($field_icon, 'http') !== false) {
1312
-                    $field_icon_af = '';
1313
-                } elseif ($field_icon == '') {
1314
-                    $field_icon_af = '';
1315
-                } else {
1316
-                    $field_icon_af = $field_icon;
1317
-                    $field_icon = '';
1318
-                }
1319
-
1320
-                $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1321
-                $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1322
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1323
-                $html .= '</span>';
1324
-                $html .= $file_paths . '</div></div>';
1325
-
1326
-            endif;
1327
-        endif;
1328
-
1329
-    }
1330
-
1331
-    return $html;
1208
+	// check we have the post value
1209
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1210
+	else{ global $post;}
1211
+
1212
+	if(!is_array($cf) && $cf!=''){
1213
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1214
+		if(!$cf){return NULL;}
1215
+	}
1216
+
1217
+	$html_var = $cf['htmlvar_name'];
1218
+
1219
+	// Check if there is a location specific filter.
1220
+	if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1221
+		/**
1222
+		 * Filter the file html by location.
1223
+		 *
1224
+		 * @param string $html The html to filter.
1225
+		 * @param array $cf The custom field array.
1226
+		 * @since 1.6.6
1227
+		 */
1228
+		$html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1229
+	}
1230
+
1231
+	// Check if there is a custom field specific filter.
1232
+	if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1233
+		/**
1234
+		 * Filter the file html by individual custom field.
1235
+		 *
1236
+		 * @param string $html The html to filter.
1237
+		 * @param string $location The location to output the html.
1238
+		 * @param array $cf The custom field array.
1239
+		 * @since 1.6.6
1240
+		 */
1241
+		$html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1242
+	}
1243
+
1244
+	// Check if there is a custom field key specific filter.
1245
+	if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1246
+		/**
1247
+		 * Filter the file html by field type key.
1248
+		 *
1249
+		 * @param string $html The html to filter.
1250
+		 * @param string $location The location to output the html.
1251
+		 * @param array $cf The custom field array.
1252
+		 * @since 1.6.6
1253
+		 */
1254
+		$html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1255
+	}
1256
+
1257
+	// If not html then we run the standard output.
1258
+	if(empty($html)){
1259
+
1260
+		if (!empty($post->{$cf['htmlvar_name']})):
1261
+
1262
+			$files = explode(",", $post->{$cf['htmlvar_name']});
1263
+			if (!empty($files)):
1264
+
1265
+				$extra_fields = !empty($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : NULL;
1266
+				$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1267
+
1268
+				$file_paths = '';
1269
+				foreach ($files as $file) {
1270
+					if (!empty($file)) {
1271
+
1272
+						// $filetype = wp_check_filetype($file);
1273
+
1274
+						$image_name_arr = explode('/', $file);
1275
+						$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1276
+						$filename = end($image_name_arr);
1277
+						$img_name_arr = explode('.', $filename);
1278
+
1279
+						$arr_file_type = wp_check_filetype($filename);
1280
+						if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1281
+							continue;
1282
+						}
1283
+
1284
+						$uploaded_file_type = $arr_file_type['type'];
1285
+						$uploaded_file_ext = $arr_file_type['ext'];
1286
+
1287
+						if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1288
+							continue; // Invalid file type.
1289
+						}
1290
+
1291
+						//$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1292
+						$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1293
+
1294
+						// If the uploaded file is image
1295
+						if (in_array($uploaded_file_type, $image_file_types)) {
1296
+							$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1297
+							$file_paths .= '<a href="'.$file.'">';
1298
+							$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1299
+							$file_paths .= '</a>';
1300
+							//$file_paths .= '<img src="'.$file.'"  />';	
1301
+							$file_paths .= '</div>';
1302
+						} else {
1303
+							$ext_path = '_' . $html_var . '_';
1304
+							$filename = explode($ext_path, $filename);
1305
+							$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1306
+						}
1307
+					}
1308
+				}
1309
+
1310
+				$field_icon = geodir_field_icon_proccess($cf);
1311
+				if (strpos($field_icon, 'http') !== false) {
1312
+					$field_icon_af = '';
1313
+				} elseif ($field_icon == '') {
1314
+					$field_icon_af = '';
1315
+				} else {
1316
+					$field_icon_af = $field_icon;
1317
+					$field_icon = '';
1318
+				}
1319
+
1320
+				$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1321
+				$html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1322
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1323
+				$html .= '</span>';
1324
+				$html .= $file_paths . '</div></div>';
1325
+
1326
+			endif;
1327
+		endif;
1328
+
1329
+	}
1330
+
1331
+	return $html;
1332 1332
 }
1333 1333
 add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1334 1334
 
@@ -1346,80 +1346,80 @@  discard block
 block discarded – undo
1346 1346
  */
1347 1347
 function geodir_cf_textarea($html,$location,$cf,$p=''){
1348 1348
 
1349
-    // check we have the post value
1350
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1351
-    else{ global $post;}
1352
-
1353
-    if(!is_array($cf) && $cf!=''){
1354
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1355
-        if(!$cf){return NULL;}
1356
-    }
1357
-
1358
-    $html_var = $cf['htmlvar_name'];
1359
-
1360
-    // Check if there is a location specific filter.
1361
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1362
-        /**
1363
-         * Filter the textarea html by location.
1364
-         *
1365
-         * @param string $html The html to filter.
1366
-         * @param array $cf The custom field array.
1367
-         * @since 1.6.6
1368
-         */
1369
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1370
-    }
1371
-
1372
-    // Check if there is a custom field specific filter.
1373
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1374
-        /**
1375
-         * Filter the textarea html by individual custom field.
1376
-         *
1377
-         * @param string $html The html to filter.
1378
-         * @param string $location The location to output the html.
1379
-         * @param array $cf The custom field array.
1380
-         * @since 1.6.6
1381
-         */
1382
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1383
-    }
1384
-
1385
-    // Check if there is a custom field key specific filter.
1386
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1387
-        /**
1388
-         * Filter the textarea html by field type key.
1389
-         *
1390
-         * @param string $html The html to filter.
1391
-         * @param string $location The location to output the html.
1392
-         * @param array $cf The custom field array.
1393
-         * @since 1.6.6
1394
-         */
1395
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1396
-    }
1397
-
1398
-    // If not html then we run the standard output.
1399
-    if(empty($html)){
1400
-
1401
-        if (!empty($post->{$cf['htmlvar_name']})) {
1402
-
1403
-            $field_icon = geodir_field_icon_proccess($cf);
1404
-            if (strpos($field_icon, 'http') !== false) {
1405
-                $field_icon_af = '';
1406
-            } elseif ($field_icon == '') {
1407
-                $field_icon_af = '';
1408
-            } else {
1409
-                $field_icon_af = $field_icon;
1410
-                $field_icon = '';
1411
-            }
1412
-
1413
-
1414
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1415
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1416
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1417
-
1418
-        }
1419
-
1420
-    }
1421
-
1422
-    return $html;
1349
+	// check we have the post value
1350
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1351
+	else{ global $post;}
1352
+
1353
+	if(!is_array($cf) && $cf!=''){
1354
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1355
+		if(!$cf){return NULL;}
1356
+	}
1357
+
1358
+	$html_var = $cf['htmlvar_name'];
1359
+
1360
+	// Check if there is a location specific filter.
1361
+	if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1362
+		/**
1363
+		 * Filter the textarea html by location.
1364
+		 *
1365
+		 * @param string $html The html to filter.
1366
+		 * @param array $cf The custom field array.
1367
+		 * @since 1.6.6
1368
+		 */
1369
+		$html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1370
+	}
1371
+
1372
+	// Check if there is a custom field specific filter.
1373
+	if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1374
+		/**
1375
+		 * Filter the textarea html by individual custom field.
1376
+		 *
1377
+		 * @param string $html The html to filter.
1378
+		 * @param string $location The location to output the html.
1379
+		 * @param array $cf The custom field array.
1380
+		 * @since 1.6.6
1381
+		 */
1382
+		$html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1383
+	}
1384
+
1385
+	// Check if there is a custom field key specific filter.
1386
+	if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1387
+		/**
1388
+		 * Filter the textarea html by field type key.
1389
+		 *
1390
+		 * @param string $html The html to filter.
1391
+		 * @param string $location The location to output the html.
1392
+		 * @param array $cf The custom field array.
1393
+		 * @since 1.6.6
1394
+		 */
1395
+		$html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1396
+	}
1397
+
1398
+	// If not html then we run the standard output.
1399
+	if(empty($html)){
1400
+
1401
+		if (!empty($post->{$cf['htmlvar_name']})) {
1402
+
1403
+			$field_icon = geodir_field_icon_proccess($cf);
1404
+			if (strpos($field_icon, 'http') !== false) {
1405
+				$field_icon_af = '';
1406
+			} elseif ($field_icon == '') {
1407
+				$field_icon_af = '';
1408
+			} else {
1409
+				$field_icon_af = $field_icon;
1410
+				$field_icon = '';
1411
+			}
1412
+
1413
+
1414
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1415
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1416
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1417
+
1418
+		}
1419
+
1420
+	}
1421
+
1422
+	return $html;
1423 1423
 }
1424 1424
 add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1425 1425
 
@@ -1437,79 +1437,79 @@  discard block
 block discarded – undo
1437 1437
  */
1438 1438
 function geodir_cf_html($html,$location,$cf,$p=''){
1439 1439
 
1440
-    // check we have the post value
1441
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1442
-    else{ global $post;}
1443
-
1444
-    if(!is_array($cf) && $cf!=''){
1445
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1446
-        if(!$cf){return NULL;}
1447
-    }
1448
-
1449
-    $html_var = $cf['htmlvar_name'];
1450
-
1451
-    // Check if there is a location specific filter.
1452
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1453
-        /**
1454
-         * Filter the html html by location.
1455
-         *
1456
-         * @param string $html The html to filter.
1457
-         * @param array $cf The custom field array.
1458
-         * @since 1.6.6
1459
-         */
1460
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1461
-    }
1462
-
1463
-    // Check if there is a custom field specific filter.
1464
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1465
-        /**
1466
-         * Filter the html html by individual custom field.
1467
-         *
1468
-         * @param string $html The html to filter.
1469
-         * @param string $location The location to output the html.
1470
-         * @param array $cf The custom field array.
1471
-         * @since 1.6.6
1472
-         */
1473
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1474
-    }
1475
-
1476
-    // Check if there is a custom field key specific filter.
1477
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1478
-        /**
1479
-         * Filter the html html by field type key.
1480
-         *
1481
-         * @param string $html The html to filter.
1482
-         * @param string $location The location to output the html.
1483
-         * @param array $cf The custom field array.
1484
-         * @since 1.6.6
1485
-         */
1486
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1487
-    }
1488
-
1489
-    // If not html then we run the standard output.
1490
-    if(empty($html)){
1491
-
1492
-        if (!empty($post->{$cf['htmlvar_name']})) {
1493
-
1494
-            $field_icon = geodir_field_icon_proccess($cf);
1495
-            if (strpos($field_icon, 'http') !== false) {
1496
-                $field_icon_af = '';
1497
-            } elseif ($field_icon == '') {
1498
-                $field_icon_af = '';
1499
-            } else {
1500
-                $field_icon_af = $field_icon;
1501
-                $field_icon = '';
1502
-            }
1503
-
1504
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1505
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1506
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1507
-
1508
-        }
1509
-
1510
-    }
1511
-
1512
-    return $html;
1440
+	// check we have the post value
1441
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1442
+	else{ global $post;}
1443
+
1444
+	if(!is_array($cf) && $cf!=''){
1445
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1446
+		if(!$cf){return NULL;}
1447
+	}
1448
+
1449
+	$html_var = $cf['htmlvar_name'];
1450
+
1451
+	// Check if there is a location specific filter.
1452
+	if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1453
+		/**
1454
+		 * Filter the html html by location.
1455
+		 *
1456
+		 * @param string $html The html to filter.
1457
+		 * @param array $cf The custom field array.
1458
+		 * @since 1.6.6
1459
+		 */
1460
+		$html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1461
+	}
1462
+
1463
+	// Check if there is a custom field specific filter.
1464
+	if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1465
+		/**
1466
+		 * Filter the html html by individual custom field.
1467
+		 *
1468
+		 * @param string $html The html to filter.
1469
+		 * @param string $location The location to output the html.
1470
+		 * @param array $cf The custom field array.
1471
+		 * @since 1.6.6
1472
+		 */
1473
+		$html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1474
+	}
1475
+
1476
+	// Check if there is a custom field key specific filter.
1477
+	if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1478
+		/**
1479
+		 * Filter the html html by field type key.
1480
+		 *
1481
+		 * @param string $html The html to filter.
1482
+		 * @param string $location The location to output the html.
1483
+		 * @param array $cf The custom field array.
1484
+		 * @since 1.6.6
1485
+		 */
1486
+		$html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1487
+	}
1488
+
1489
+	// If not html then we run the standard output.
1490
+	if(empty($html)){
1491
+
1492
+		if (!empty($post->{$cf['htmlvar_name']})) {
1493
+
1494
+			$field_icon = geodir_field_icon_proccess($cf);
1495
+			if (strpos($field_icon, 'http') !== false) {
1496
+				$field_icon_af = '';
1497
+			} elseif ($field_icon == '') {
1498
+				$field_icon_af = '';
1499
+			} else {
1500
+				$field_icon_af = $field_icon;
1501
+				$field_icon = '';
1502
+			}
1503
+
1504
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1505
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1506
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1507
+
1508
+		}
1509
+
1510
+	}
1511
+
1512
+	return $html;
1513 1513
 }
1514 1514
 add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1515 1515
 
@@ -1527,113 +1527,113 @@  discard block
 block discarded – undo
1527 1527
  */
1528 1528
 function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1529 1529
 
1530
-    // check we have the post value
1531
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1532
-    else{ global $post;}
1533
-
1534
-    if(!is_array($cf) && $cf!=''){
1535
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1536
-        if(!$cf){return NULL;}
1537
-    }
1538
-
1539
-    $html_var = $cf['htmlvar_name'];
1540
-
1541
-    // Check if there is a location specific filter.
1542
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1543
-        /**
1544
-         * Filter the taxonomy html by location.
1545
-         *
1546
-         * @param string $html The html to filter.
1547
-         * @param array $cf The custom field array.
1548
-         * @since 1.6.6
1549
-         */
1550
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1551
-    }
1552
-
1553
-    // Check if there is a custom field specific filter.
1554
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1555
-        /**
1556
-         * Filter the taxonomy html by individual custom field.
1557
-         *
1558
-         * @param string $html The html to filter.
1559
-         * @param string $location The location to output the html.
1560
-         * @param array $cf The custom field array.
1561
-         * @since 1.6.6
1562
-         */
1563
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1564
-    }
1565
-
1566
-    // Check if there is a custom field key specific filter.
1567
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1568
-        /**
1569
-         * Filter the taxonomy html by field type key.
1570
-         *
1571
-         * @param string $html The html to filter.
1572
-         * @param string $location The location to output the html.
1573
-         * @param array $cf The custom field array.
1574
-         * @since 1.6.6
1575
-         */
1576
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1577
-    }
1578
-
1579
-    // If not html then we run the standard output.
1580
-    if(empty($html)){
1581
-
1582
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1583
-            $post_taxonomy = $post->post_type . 'category';
1584
-            $field_value = $post->{$html_var};
1585
-            $links = array();
1586
-            $terms = array();
1587
-            $termsOrdered = array();
1588
-            if (!is_array($field_value)) {
1589
-                $field_value = explode(",", trim($field_value, ","));
1590
-            }
1591
-
1592
-            $field_value = array_unique($field_value);
1593
-
1594
-            if (!empty($field_value)) {
1595
-                foreach ($field_value as $term) {
1596
-                    $term = trim($term);
1597
-
1598
-                    if ($term != '') {
1599
-                        $term = get_term_by('id', $term, $html_var);
1600
-                        if (is_object($term)) {
1601
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1602
-                            $terms[] = $term;
1603
-                        }
1604
-                    }
1605
-                }
1606
-                if (!empty($links)) {
1607
-                    // order alphabetically
1608
-                    asort($links);
1609
-                    foreach (array_keys($links) as $key) {
1610
-                        $termsOrdered[$key] = $terms[$key];
1611
-                    }
1612
-                    $terms = $termsOrdered;
1613
-                }
1614
-            }
1615
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1616
-
1617
-            if ($html_value != '') {
1618
-                $field_icon = geodir_field_icon_proccess($cf);
1619
-                if (strpos($field_icon, 'http') !== false) {
1620
-                    $field_icon_af = '';
1621
-                } else if ($field_icon == '') {
1622
-                    $field_icon_af = '';
1623
-                } else {
1624
-                    $field_icon_af = $field_icon;
1625
-                    $field_icon = '';
1626
-                }
1627
-
1628
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1629
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1630
-                $html .= '</span> ' . $html_value . '</div>';
1631
-            }
1632
-        }
1633
-
1634
-    }
1635
-
1636
-    return $html;
1530
+	// check we have the post value
1531
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1532
+	else{ global $post;}
1533
+
1534
+	if(!is_array($cf) && $cf!=''){
1535
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1536
+		if(!$cf){return NULL;}
1537
+	}
1538
+
1539
+	$html_var = $cf['htmlvar_name'];
1540
+
1541
+	// Check if there is a location specific filter.
1542
+	if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1543
+		/**
1544
+		 * Filter the taxonomy html by location.
1545
+		 *
1546
+		 * @param string $html The html to filter.
1547
+		 * @param array $cf The custom field array.
1548
+		 * @since 1.6.6
1549
+		 */
1550
+		$html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1551
+	}
1552
+
1553
+	// Check if there is a custom field specific filter.
1554
+	if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1555
+		/**
1556
+		 * Filter the taxonomy html by individual custom field.
1557
+		 *
1558
+		 * @param string $html The html to filter.
1559
+		 * @param string $location The location to output the html.
1560
+		 * @param array $cf The custom field array.
1561
+		 * @since 1.6.6
1562
+		 */
1563
+		$html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1564
+	}
1565
+
1566
+	// Check if there is a custom field key specific filter.
1567
+	if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1568
+		/**
1569
+		 * Filter the taxonomy html by field type key.
1570
+		 *
1571
+		 * @param string $html The html to filter.
1572
+		 * @param string $location The location to output the html.
1573
+		 * @param array $cf The custom field array.
1574
+		 * @since 1.6.6
1575
+		 */
1576
+		$html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1577
+	}
1578
+
1579
+	// If not html then we run the standard output.
1580
+	if(empty($html)){
1581
+
1582
+		if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1583
+			$post_taxonomy = $post->post_type . 'category';
1584
+			$field_value = $post->{$html_var};
1585
+			$links = array();
1586
+			$terms = array();
1587
+			$termsOrdered = array();
1588
+			if (!is_array($field_value)) {
1589
+				$field_value = explode(",", trim($field_value, ","));
1590
+			}
1591
+
1592
+			$field_value = array_unique($field_value);
1593
+
1594
+			if (!empty($field_value)) {
1595
+				foreach ($field_value as $term) {
1596
+					$term = trim($term);
1597
+
1598
+					if ($term != '') {
1599
+						$term = get_term_by('id', $term, $html_var);
1600
+						if (is_object($term)) {
1601
+							$links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1602
+							$terms[] = $term;
1603
+						}
1604
+					}
1605
+				}
1606
+				if (!empty($links)) {
1607
+					// order alphabetically
1608
+					asort($links);
1609
+					foreach (array_keys($links) as $key) {
1610
+						$termsOrdered[$key] = $terms[$key];
1611
+					}
1612
+					$terms = $termsOrdered;
1613
+				}
1614
+			}
1615
+			$html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1616
+
1617
+			if ($html_value != '') {
1618
+				$field_icon = geodir_field_icon_proccess($cf);
1619
+				if (strpos($field_icon, 'http') !== false) {
1620
+					$field_icon_af = '';
1621
+				} else if ($field_icon == '') {
1622
+					$field_icon_af = '';
1623
+				} else {
1624
+					$field_icon_af = $field_icon;
1625
+					$field_icon = '';
1626
+				}
1627
+
1628
+				$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1629
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1630
+				$html .= '</span> ' . $html_value . '</div>';
1631
+			}
1632
+		}
1633
+
1634
+	}
1635
+
1636
+	return $html;
1637 1637
 }
1638 1638
 add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1639 1639
 
@@ -1650,162 +1650,162 @@  discard block
 block discarded – undo
1650 1650
  */
1651 1651
 function geodir_cf_address($html,$location,$cf,$p=''){
1652 1652
 
1653
-    // check we have the post value
1654
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1655
-    else{ global $post;}
1656
-
1657
-    if(!is_array($cf) && $cf!=''){
1658
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1659
-        if(!$cf){return NULL;}
1660
-    }
1661
-
1662
-    $html_var = $cf['htmlvar_name'];
1663
-
1664
-    // Check if there is a location specific filter.
1665
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1666
-        /**
1667
-         * Filter the address html by location.
1668
-         *
1669
-         * @param string $html The html to filter.
1670
-         * @param array $cf The custom field array.
1671
-         * @since 1.6.6
1672
-         */
1673
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1674
-    }
1675
-
1676
-    // Check if there is a custom field specific filter.
1677
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1678
-        /**
1679
-         * Filter the address html by individual custom field.
1680
-         *
1681
-         * @param string $html The html to filter.
1682
-         * @param string $location The location to output the html.
1683
-         * @param array $cf The custom field array.
1684
-         * @since 1.6.6
1685
-         */
1686
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1687
-    }
1688
-
1689
-    // Check if there is a custom field key specific filter.
1690
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1691
-        /**
1692
-         * Filter the address html by field type key.
1693
-         *
1694
-         * @param string $html The html to filter.
1695
-         * @param string $location The location to output the html.
1696
-         * @param array $cf The custom field array.
1697
-         * @since 1.6.6
1698
-         */
1699
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1700
-    }
1701
-
1702
-    // If not html then we run the standard output.
1703
-    if(empty($html)){
1704
-
1705
-        global $preview;
1706
-        $html_var = $cf['htmlvar_name'] . '_address';
1707
-
1708
-        if ($cf['extra_fields']) {
1709
-
1710
-            $extra_fields = unserialize($cf['extra_fields']);
1711
-
1712
-            $addition_fields = '';
1713
-
1714
-            if (!empty($extra_fields)) {
1715
-
1716
-                $show_city_in_address = false;
1717
-                if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1718
-                    $show_city_in_address = true;
1719
-                }
1720
-                /**
1721
-                 * Filter "show city in address" value.
1722
-                 *
1723
-                 * @since 1.0.0
1724
-                 */
1725
-                $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1726
-
1727
-
1728
-                $show_region_in_address = false;
1729
-                if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1730
-                    $show_region_in_address = true;
1731
-                }
1732
-                /**
1733
-                 * Filter "show region in address" value.
1734
-                 *
1735
-                 * @since 1.6.6
1736
-                 */
1737
-                $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1738
-
1739
-                $show_country_in_address = false;
1740
-                if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1741
-                    $show_country_in_address = true;
1742
-                }
1743
-                /**
1744
-                 * Filter "show country in address" value.
1745
-                 *
1746
-                 * @since 1.6.6
1747
-                 */
1748
-                $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1749
-
1750
-                $show_zip_in_address = false;
1751
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1752
-                    $show_zip_in_address = true;
1753
-                }
1754
-                /**
1755
-                 * Filter "show zip in address" value.
1756
-                 *
1757
-                 * @since 1.6.6
1758
-                 */
1759
-                $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1760
-
1761
-
1762
-            }
1763
-
1764
-        }
1765
-
1766
-
1767
-        if ($post->{$html_var}) {
1768
-
1769
-            $field_icon = geodir_field_icon_proccess( $cf );
1770
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1771
-                $field_icon_af = '';
1772
-            } elseif ( $field_icon == '' ) {
1773
-                $field_icon_af = '<i class="fa fa-home"></i>';
1774
-            } else {
1775
-                $field_icon_af = $field_icon;
1776
-                $field_icon    = '';
1777
-            }
1653
+	// check we have the post value
1654
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1655
+	else{ global $post;}
1656
+
1657
+	if(!is_array($cf) && $cf!=''){
1658
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1659
+		if(!$cf){return NULL;}
1660
+	}
1661
+
1662
+	$html_var = $cf['htmlvar_name'];
1663
+
1664
+	// Check if there is a location specific filter.
1665
+	if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1666
+		/**
1667
+		 * Filter the address html by location.
1668
+		 *
1669
+		 * @param string $html The html to filter.
1670
+		 * @param array $cf The custom field array.
1671
+		 * @since 1.6.6
1672
+		 */
1673
+		$html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1674
+	}
1675
+
1676
+	// Check if there is a custom field specific filter.
1677
+	if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1678
+		/**
1679
+		 * Filter the address html by individual custom field.
1680
+		 *
1681
+		 * @param string $html The html to filter.
1682
+		 * @param string $location The location to output the html.
1683
+		 * @param array $cf The custom field array.
1684
+		 * @since 1.6.6
1685
+		 */
1686
+		$html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1687
+	}
1688
+
1689
+	// Check if there is a custom field key specific filter.
1690
+	if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1691
+		/**
1692
+		 * Filter the address html by field type key.
1693
+		 *
1694
+		 * @param string $html The html to filter.
1695
+		 * @param string $location The location to output the html.
1696
+		 * @param array $cf The custom field array.
1697
+		 * @since 1.6.6
1698
+		 */
1699
+		$html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1700
+	}
1701
+
1702
+	// If not html then we run the standard output.
1703
+	if(empty($html)){
1704
+
1705
+		global $preview;
1706
+		$html_var = $cf['htmlvar_name'] . '_address';
1707
+
1708
+		if ($cf['extra_fields']) {
1709
+
1710
+			$extra_fields = unserialize($cf['extra_fields']);
1711
+
1712
+			$addition_fields = '';
1713
+
1714
+			if (!empty($extra_fields)) {
1715
+
1716
+				$show_city_in_address = false;
1717
+				if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1718
+					$show_city_in_address = true;
1719
+				}
1720
+				/**
1721
+				 * Filter "show city in address" value.
1722
+				 *
1723
+				 * @since 1.0.0
1724
+				 */
1725
+				$show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1726
+
1727
+
1728
+				$show_region_in_address = false;
1729
+				if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1730
+					$show_region_in_address = true;
1731
+				}
1732
+				/**
1733
+				 * Filter "show region in address" value.
1734
+				 *
1735
+				 * @since 1.6.6
1736
+				 */
1737
+				$show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1738
+
1739
+				$show_country_in_address = false;
1740
+				if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1741
+					$show_country_in_address = true;
1742
+				}
1743
+				/**
1744
+				 * Filter "show country in address" value.
1745
+				 *
1746
+				 * @since 1.6.6
1747
+				 */
1748
+				$show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1749
+
1750
+				$show_zip_in_address = false;
1751
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1752
+					$show_zip_in_address = true;
1753
+				}
1754
+				/**
1755
+				 * Filter "show zip in address" value.
1756
+				 *
1757
+				 * @since 1.6.6
1758
+				 */
1759
+				$show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1760
+
1761
+
1762
+			}
1763
+
1764
+		}
1765
+
1766
+
1767
+		if ($post->{$html_var}) {
1768
+
1769
+			$field_icon = geodir_field_icon_proccess( $cf );
1770
+			if ( strpos( $field_icon, 'http' ) !== false ) {
1771
+				$field_icon_af = '';
1772
+			} elseif ( $field_icon == '' ) {
1773
+				$field_icon_af = '<i class="fa fa-home"></i>';
1774
+			} else {
1775
+				$field_icon_af = $field_icon;
1776
+				$field_icon    = '';
1777
+			}
1778 1778
             
1779 1779
 
1780 1780
 
1781
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1782
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1783
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1784
-            $html .= '</span>';
1781
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1782
+			$html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1783
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1784
+			$html .= '</span>';
1785 1785
 
1786 1786
 
1787
-            if ( $post->post_address ) {
1788
-                $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1789
-            }
1790
-            if ($show_city_in_address && $post->post_city ) {
1791
-                $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1792
-            }
1793
-            if ($show_region_in_address && $post->post_region ) {
1794
-                $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1795
-            }
1796
-            if ($show_zip_in_address && $post->post_zip ) {
1797
-                $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1798
-            }
1799
-            if ($show_country_in_address && $post->post_country ) {
1800
-                $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1801
-            }
1802
-            $html .= '</div>';
1787
+			if ( $post->post_address ) {
1788
+				$html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1789
+			}
1790
+			if ($show_city_in_address && $post->post_city ) {
1791
+				$html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1792
+			}
1793
+			if ($show_region_in_address && $post->post_region ) {
1794
+				$html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1795
+			}
1796
+			if ($show_zip_in_address && $post->post_zip ) {
1797
+				$html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1798
+			}
1799
+			if ($show_country_in_address && $post->post_country ) {
1800
+				$html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1801
+			}
1802
+			$html .= '</div>';
1803 1803
 
1804
-        }
1804
+		}
1805 1805
 
1806
-    }
1806
+	}
1807 1807
 
1808 1808
 
1809
-    return $html;
1809
+	return $html;
1810 1810
 }
1811 1811
 add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1812 1812
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +299 added lines, -299 removed lines patch added patch discarded remove patch
@@ -19,21 +19,21 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @return string The html to output for the custom field.
21 21
  */
22
-function geodir_cf_checkbox($html,$location,$cf,$p=''){
22
+function geodir_cf_checkbox($html, $location, $cf, $p = '') {
23 23
 
24 24
     // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
25
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
26
+    else { global $post; }
27 27
 
28
-    if(!is_array($cf) && $cf!=''){
28
+    if (!is_array($cf) && $cf != '') {
29 29
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
-        if(!$cf){return NULL;}
30
+        if (!$cf) {return NULL; }
31 31
     }
32 32
 
33 33
     $html_var = $cf['htmlvar_name'];
34 34
 
35 35
     // Check if there is a location specific filter.
36
-    if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
36
+    if (has_filter("geodir_custom_field_output_checkbox_loc_{$location}")) {
37 37
         /**
38 38
          * Filter the checkbox html by location.
39 39
          *
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
          * @param array $cf The custom field array.
42 42
          * @since 1.6.6
43 43
          */
44
-        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
44
+        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}", $html, $cf);
45 45
     }
46 46
 
47 47
     // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
48
+    if (has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")) {
49 49
         /**
50 50
          * Filter the checkbox html by individual custom field.
51 51
          *
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
          * @param array $cf The custom field array.
55 55
          * @since 1.6.6
56 56
          */
57
-        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
57
+        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}", $html, $location, $cf);
58 58
     }
59 59
 
60 60
     // Check if there is a custom field key specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
61
+    if (has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")) {
62 62
         /**
63 63
          * Filter the checkbox html by field type key.
64 64
          *
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
          * @param array $cf The custom field array.
68 68
          * @since 1.6.6
69 69
          */
70
-        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
70
+        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}", $html, $location, $cf);
71 71
     }
72 72
 
73 73
     // If not html then we run the standard output.
74
-    if(empty($html)){
74
+    if (empty($html)) {
75 75
 
76
-        if ( (int) $post->{$html_var} == 1 ):
76
+        if ((int) $post->{$html_var} == 1):
77 77
 
78
-            if ( $post->{$html_var} == '1' ):
79
-                $html_val = __( 'Yes', 'geodirectory' );
78
+            if ($post->{$html_var} == '1'):
79
+                $html_val = __('Yes', 'geodirectory');
80 80
             else:
81
-                $html_val = __( 'No', 'geodirectory' );
81
+                $html_val = __('No', 'geodirectory');
82 82
             endif;
83 83
 
84 84
             $field_icon = geodir_field_icon_proccess($cf);
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
                 $field_icon = '';
92 92
             }
93 93
 
94
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
-            $html .= '</span>' . $html_val . '</div>';
94
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-checkbox" style="'.$field_icon.'">'.$field_icon_af;
95
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
96
+            $html .= '</span>'.$html_val.'</div>';
97 97
         endif;
98 98
 
99 99
     }
100 100
 
101 101
     return $html;
102 102
 }
103
-add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
103
+add_filter('geodir_custom_field_output_checkbox', 'geodir_cf_checkbox', 10, 3);
104 104
 
105 105
 
106 106
 /**
@@ -113,21 +113,21 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return string The html to output for the custom field.
115 115
  */
116
-function geodir_cf_fieldset($html,$location,$cf,$p=''){
116
+function geodir_cf_fieldset($html, $location, $cf, $p = '') {
117 117
 
118 118
     // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
119
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
120
+    else { global $post; }
121 121
 
122
-    if(!is_array($cf) && $cf!=''){
122
+    if (!is_array($cf) && $cf != '') {
123 123
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
-        if(!$cf){return NULL;}
124
+        if (!$cf) {return NULL; }
125 125
     }
126 126
 
127 127
     $html_var = $cf['htmlvar_name'];
128 128
 
129 129
     // Check if there is a location specific filter.
130
-    if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
130
+    if (has_filter("geodir_custom_field_output_fieldset_loc_{$location}")) {
131 131
         /**
132 132
          * Filter the fieldset html by location.
133 133
          *
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
          * @param array $cf The custom field array.
136 136
          * @since 1.6.6
137 137
          */
138
-        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
138
+        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}", $html, $cf);
139 139
     }
140 140
 
141 141
     // Check if there is a custom field specific filter.
142
-    if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
142
+    if (has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")) {
143 143
         /**
144 144
          * Filter the fieldset html by individual custom field.
145 145
          *
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
          * @param array $cf The custom field array.
149 149
          * @since 1.6.6
150 150
          */
151
-        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
151
+        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}", $html, $location, $cf);
152 152
     }
153 153
 
154 154
     // Check if there is a custom field key specific filter.
155
-    if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
155
+    if (has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")) {
156 156
         /**
157 157
          * Filter the fieldset html by field type key.
158 158
          *
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
          * @param array $cf The custom field array.
162 162
          * @since 1.6.6
163 163
          */
164
-        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
164
+        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}", $html, $location, $cf);
165 165
     }
166 166
 
167 167
     // If not html then we run the standard output.
168
-    if(empty($html)){
168
+    if (empty($html)) {
169 169
 
170 170
         global $field_set_start;
171 171
         $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
172 172
 
173 173
         if ($field_set_start == 1) {
174
-            $html = '';//'<h2 class="'.$fieldset_class.'">xxx'.$field_set_start  . __($cf['site_title'], 'geodirectory') . '</h2>';
174
+            $html = ''; //'<h2 class="'.$fieldset_class.'">xxx'.$field_set_start  . __($cf['site_title'], 'geodirectory') . '</h2>';
175 175
            //$html = '</div><div class="geodir-company_info field-group ' . $cf['htmlvar_name'] . '"><h2 class="'.$fieldset_class.'">' . __($cf['site_title'], 'geodirectory') . '</h2>';
176 176
         } else {
177
-            $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
177
+            $html = '<h2 class="'.$fieldset_class.'">'.__($cf['site_title'], 'geodirectory').'</h2>';
178 178
             //$field_set_start = 1;
179 179
         }
180 180
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
     return $html;
184 184
 }
185
-add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
185
+add_filter('geodir_custom_field_output_fieldset', 'geodir_cf_fieldset', 10, 3);
186 186
 
187 187
 
188 188
 /**
@@ -195,21 +195,21 @@  discard block
 block discarded – undo
195 195
  *
196 196
  * @return string The html to output for the custom field.
197 197
  */
198
-function geodir_cf_url($html,$location,$cf,$p=''){
198
+function geodir_cf_url($html, $location, $cf, $p = '') {
199 199
 
200 200
     // check we have the post value
201
-    if(is_int($p)){$post = geodir_get_post_info($p);}
202
-    else{ global $post;}
201
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
202
+    else { global $post; }
203 203
 
204
-    if(!is_array($cf) && $cf!=''){
204
+    if (!is_array($cf) && $cf != '') {
205 205
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
206
-        if(!$cf){return NULL;}
206
+        if (!$cf) {return NULL; }
207 207
     }
208 208
 
209 209
     $html_var = $cf['htmlvar_name'];
210 210
 
211 211
     // Check if there is a location specific filter.
212
-    if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
212
+    if (has_filter("geodir_custom_field_output_url_loc_{$location}")) {
213 213
         /**
214 214
          * Filter the url html by location.
215 215
          *
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
          * @param array $cf The custom field array.
218 218
          * @since 1.6.6
219 219
          */
220
-        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
220
+        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}", $html, $cf);
221 221
     }
222 222
 
223 223
     // Check if there is a custom field specific filter.
224
-    if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
224
+    if (has_filter("geodir_custom_field_output_url_var_{$html_var}")) {
225 225
         /**
226 226
          * Filter the url html by individual custom field.
227 227
          *
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
          * @param array $cf The custom field array.
231 231
          * @since 1.6.6
232 232
          */
233
-        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
233
+        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}", $html, $location, $cf);
234 234
     }
235 235
 
236 236
     // Check if there is a custom field key specific filter.
237
-    if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
237
+    if (has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")) {
238 238
         /**
239 239
          * Filter the url html by field type key.
240 240
          *
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
          * @param array $cf The custom field array.
244 244
          * @since 1.6.6
245 245
          */
246
-        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
246
+        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}", $html, $location, $cf);
247 247
     }
248 248
 
249 249
     // If not html then we run the standard output.
250
-    if(empty($html)){
250
+    if (empty($html)) {
251 251
 
252 252
         if ($post->{$cf['htmlvar_name']}):
253 253
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 
275 275
             $website = !empty($a_url['url']) ? $a_url['url'] : '';
276 276
             $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
277
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
277
+            if (!empty($cf['default_value'])) {$title = $cf['default_value']; }
278 278
             $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
279 279
 
280 280
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
              * @param string $website Website URL.
291 291
              * @param int $post->ID Post ID.
292 292
              */
293
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
293
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-website" style="'.$field_icon.'">'.$field_icon_af.'<a href="'.$website.'" target="_blank" '.$rel.' ><strong>'.apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID).'</strong></a></span></div>';
294 294
 
295 295
         endif;
296 296
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 
299 299
     return $html;
300 300
 }
301
-add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
301
+add_filter('geodir_custom_field_output_url', 'geodir_cf_url', 10, 3);
302 302
 
303 303
 
304 304
 /**
@@ -311,21 +311,21 @@  discard block
 block discarded – undo
311 311
  *
312 312
  * @return string The html to output for the custom field.
313 313
  */
314
-function geodir_cf_phone($html,$location,$cf,$p=''){
314
+function geodir_cf_phone($html, $location, $cf, $p = '') {
315 315
 
316 316
     // check we have the post value
317
-    if(is_int($p)){$post = geodir_get_post_info($p);}
318
-    else{ global $post;}
317
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
318
+    else { global $post; }
319 319
 
320
-    if(!is_array($cf) && $cf!=''){
320
+    if (!is_array($cf) && $cf != '') {
321 321
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
322
-        if(!$cf){return NULL;}
322
+        if (!$cf) {return NULL; }
323 323
     }
324 324
 
325 325
     $html_var = $cf['htmlvar_name'];
326 326
 
327 327
     // Check if there is a location specific filter.
328
-    if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
328
+    if (has_filter("geodir_custom_field_output_phone_loc_{$location}")) {
329 329
         /**
330 330
          * Filter the phone html by location.
331 331
          *
@@ -333,11 +333,11 @@  discard block
 block discarded – undo
333 333
          * @param array $cf The custom field array.
334 334
          * @since 1.6.6
335 335
          */
336
-        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
336
+        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}", $html, $cf);
337 337
     }
338 338
 
339 339
     // Check if there is a custom field specific filter.
340
-    if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
340
+    if (has_filter("geodir_custom_field_output_phone_var_{$html_var}")) {
341 341
         /**
342 342
          * Filter the phone html by individual custom field.
343 343
          *
@@ -346,11 +346,11 @@  discard block
 block discarded – undo
346 346
          * @param array $cf The custom field array.
347 347
          * @since 1.6.6
348 348
          */
349
-        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
349
+        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}", $html, $location, $cf);
350 350
     }
351 351
 
352 352
     // Check if there is a custom field key specific filter.
353
-    if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
353
+    if (has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")) {
354 354
         /**
355 355
          * Filter the phone html by field type key.
356 356
          *
@@ -359,11 +359,11 @@  discard block
 block discarded – undo
359 359
          * @param array $cf The custom field array.
360 360
          * @since 1.6.6
361 361
          */
362
-        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
362
+        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}", $html, $location, $cf);
363 363
     }
364 364
 
365 365
     // If not html then we run the standard output.
366
-    if(empty($html)){
366
+    if (empty($html)) {
367 367
 
368 368
         if ($post->{$cf['htmlvar_name']}):
369 369
 
@@ -378,9 +378,9 @@  discard block
 block discarded – undo
378 378
             }
379 379
 
380 380
 
381
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
382
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
383
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
381
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-contact" style="'.$field_icon.'">'.$field_icon_af.
382
+                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
383
+            $html .= '</span><a href="tel:'.preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}).'">'.$post->{$cf['htmlvar_name']}.'</a></div>';
384 384
 
385 385
         endif;
386 386
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 
389 389
     return $html;
390 390
 }
391
-add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
391
+add_filter('geodir_custom_field_output_phone', 'geodir_cf_phone', 10, 3);
392 392
 
393 393
 
394 394
 /**
@@ -401,21 +401,21 @@  discard block
 block discarded – undo
401 401
  *
402 402
  * @return string The html to output for the custom field.
403 403
  */
404
-function geodir_cf_time($html,$location,$cf,$p=''){
404
+function geodir_cf_time($html, $location, $cf, $p = '') {
405 405
 
406 406
     // check we have the post value
407
-    if(is_int($p)){$post = geodir_get_post_info($p);}
408
-    else{ global $post;}
407
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
408
+    else { global $post; }
409 409
 
410
-    if(!is_array($cf) && $cf!=''){
410
+    if (!is_array($cf) && $cf != '') {
411 411
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
412
-        if(!$cf){return NULL;}
412
+        if (!$cf) {return NULL; }
413 413
     }
414 414
 
415 415
     $html_var = $cf['htmlvar_name'];
416 416
 
417 417
     // Check if there is a location specific filter.
418
-    if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
418
+    if (has_filter("geodir_custom_field_output_time_loc_{$location}")) {
419 419
         /**
420 420
          * Filter the time html by location.
421 421
          *
@@ -423,11 +423,11 @@  discard block
 block discarded – undo
423 423
          * @param array $cf The custom field array.
424 424
          * @since 1.6.6
425 425
          */
426
-        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
426
+        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}", $html, $cf);
427 427
     }
428 428
 
429 429
     // Check if there is a custom field specific filter.
430
-    if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
430
+    if (has_filter("geodir_custom_field_output_time_var_{$html_var}")) {
431 431
         /**
432 432
          * Filter the time html by individual custom field.
433 433
          *
@@ -436,11 +436,11 @@  discard block
 block discarded – undo
436 436
          * @param array $cf The custom field array.
437 437
          * @since 1.6.6
438 438
          */
439
-        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
439
+        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}", $html, $location, $cf);
440 440
     }
441 441
 
442 442
     // Check if there is a custom field key specific filter.
443
-    if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
443
+    if (has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")) {
444 444
         /**
445 445
          * Filter the time html by field type key.
446 446
          *
@@ -449,11 +449,11 @@  discard block
 block discarded – undo
449 449
          * @param array $cf The custom field array.
450 450
          * @since 1.6.6
451 451
          */
452
-        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
452
+        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}", $html, $location, $cf);
453 453
     }
454 454
 
455 455
     // If not html then we run the standard output.
456
-    if(empty($html)){
456
+    if (empty($html)) {
457 457
 
458 458
         if ($post->{$cf['htmlvar_name']}):
459 459
 
@@ -473,9 +473,9 @@  discard block
 block discarded – undo
473 473
             }
474 474
 
475 475
 
476
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
477
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
478
-            $html .= '</span>' . $value . '</div>';
476
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-time" style="'.$field_icon.'">'.$field_icon_af;
477
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
478
+            $html .= '</span>'.$value.'</div>';
479 479
 
480 480
         endif;
481 481
 
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 
484 484
     return $html;
485 485
 }
486
-add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
486
+add_filter('geodir_custom_field_output_time', 'geodir_cf_time', 10, 3);
487 487
 
488 488
 
489 489
 /**
@@ -496,21 +496,21 @@  discard block
 block discarded – undo
496 496
  *
497 497
  * @return string The html to output for the custom field.
498 498
  */
499
-function geodir_cf_datepicker($html,$location,$cf,$p=''){
499
+function geodir_cf_datepicker($html, $location, $cf, $p = '') {
500 500
 
501 501
     // check we have the post value
502
-    if(is_int($p)){$post = geodir_get_post_info($p);}
503
-    else{ global $post;}
502
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
503
+    else { global $post; }
504 504
 
505
-    if(!is_array($cf) && $cf!=''){
505
+    if (!is_array($cf) && $cf != '') {
506 506
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
507
-        if(!$cf){return NULL;}
507
+        if (!$cf) {return NULL; }
508 508
     }
509 509
 
510 510
     $html_var = $cf['htmlvar_name'];
511 511
 
512 512
     // Check if there is a location specific filter.
513
-    if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
513
+    if (has_filter("geodir_custom_field_output_datepicker_loc_{$location}")) {
514 514
         /**
515 515
          * Filter the datepicker html by location.
516 516
          *
@@ -518,11 +518,11 @@  discard block
 block discarded – undo
518 518
          * @param array $cf The custom field array.
519 519
          * @since 1.6.6
520 520
          */
521
-        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
521
+        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}", $html, $cf);
522 522
     }
523 523
 
524 524
     // Check if there is a custom field specific filter.
525
-    if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
525
+    if (has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")) {
526 526
         /**
527 527
          * Filter the datepicker html by individual custom field.
528 528
          *
@@ -531,11 +531,11 @@  discard block
 block discarded – undo
531 531
          * @param array $cf The custom field array.
532 532
          * @since 1.6.6
533 533
          */
534
-        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
534
+        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}", $html, $location, $cf);
535 535
     }
536 536
 
537 537
     // Check if there is a custom field key specific filter.
538
-    if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
538
+    if (has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")) {
539 539
         /**
540 540
          * Filter the datepicker html by field type key.
541 541
          *
@@ -544,11 +544,11 @@  discard block
 block discarded – undo
544 544
          * @param array $cf The custom field array.
545 545
          * @since 1.6.6
546 546
          */
547
-        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
547
+        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}", $html, $location, $cf);
548 548
     }
549 549
 
550 550
     // If not html then we run the standard output.
551
-    if(empty($html)){
551
+    if (empty($html)) {
552 552
 
553 553
         if ($post->{$cf['htmlvar_name']}):
554 554
 
@@ -559,21 +559,21 @@  discard block
 block discarded – undo
559 559
             }
560 560
             // check if we need to change the format or not
561 561
             $date_format_len = strlen(str_replace(' ', '', $date_format));
562
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
562
+            if ($date_format_len > 5) {// if greater then 4 then it's the old style format.
563 563
 
564
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
565
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
564
+                $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
565
+                $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
566 566
 
567 567
                 $date_format = str_replace($search, $replace, $date_format);
568 568
 
569
-                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
570
-            }else{
569
+                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y') ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
570
+            } else {
571 571
                 $post_htmlvar_value = $post->{$cf['htmlvar_name']};
572 572
             }
573 573
 
574
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
574
+            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']} != "0000-00-00") {
575 575
                 $value = date_i18n($date_format, strtotime($post_htmlvar_value));
576
-            }else{
576
+            } else {
577 577
                 return '';
578 578
             }
579 579
 
@@ -590,9 +590,9 @@  discard block
 block discarded – undo
590 590
 
591 591
 
592 592
 
593
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
594
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
595
-            $html .= '</span>' . $value . '</div>';
593
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-datepicker" style="'.$field_icon.'">'.$field_icon_af;
594
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
595
+            $html .= '</span>'.$value.'</div>';
596 596
 
597 597
         endif;
598 598
 
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 
601 601
     return $html;
602 602
 }
603
-add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
603
+add_filter('geodir_custom_field_output_datepicker', 'geodir_cf_datepicker', 10, 3);
604 604
 
605 605
 
606 606
 /**
@@ -613,21 +613,21 @@  discard block
 block discarded – undo
613 613
  *
614 614
  * @return string The html to output for the custom field.
615 615
  */
616
-function geodir_cf_text($html,$location,$cf,$p=''){
616
+function geodir_cf_text($html, $location, $cf, $p = '') {
617 617
 
618 618
     // check we have the post value
619
-    if(is_int($p)){$post = geodir_get_post_info($p);}
620
-    else{ global $post;}
619
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
620
+    else { global $post; }
621 621
 
622
-    if(!is_array($cf) && $cf!=''){
622
+    if (!is_array($cf) && $cf != '') {
623 623
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
624
-        if(!$cf){return NULL;}
624
+        if (!$cf) {return NULL; }
625 625
     }
626 626
 
627 627
     $html_var = $cf['htmlvar_name'];
628 628
 
629 629
     // Check if there is a location specific filter.
630
-    if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
630
+    if (has_filter("geodir_custom_field_output_text_loc_{$location}")) {
631 631
         /**
632 632
          * Filter the text html by location.
633 633
          *
@@ -635,11 +635,11 @@  discard block
 block discarded – undo
635 635
          * @param array $cf The custom field array.
636 636
          * @since 1.6.6
637 637
          */
638
-        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
638
+        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}", $html, $cf);
639 639
     }
640 640
 
641 641
     // Check if there is a custom field specific filter.
642
-    if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
642
+    if (has_filter("geodir_custom_field_output_text_var_{$html_var}")) {
643 643
         /**
644 644
          * Filter the text html by individual custom field.
645 645
          *
@@ -648,11 +648,11 @@  discard block
 block discarded – undo
648 648
          * @param array $cf The custom field array.
649 649
          * @since 1.6.6
650 650
          */
651
-        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
651
+        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}", $html, $location, $cf);
652 652
     }
653 653
 
654 654
     // Check if there is a custom field key specific filter.
655
-    if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
655
+    if (has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")) {
656 656
         /**
657 657
          * Filter the text html by field type key.
658 658
          *
@@ -661,15 +661,15 @@  discard block
 block discarded – undo
661 661
          * @param array $cf The custom field array.
662 662
          * @since 1.6.6
663 663
          */
664
-        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
664
+        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}", $html, $location, $cf);
665 665
     }
666 666
 
667 667
     
668 668
 
669 669
     // If not html then we run the standard output.
670
-    if(empty($html)){
670
+    if (empty($html)) {
671 671
 
672
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
672
+        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
673 673
 
674 674
             $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
675 675
 
@@ -684,9 +684,9 @@  discard block
 block discarded – undo
684 684
             }
685 685
 
686 686
 
687
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
688
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
689
-            $html .= '</span>' . $post->{$cf['htmlvar_name']} . '</div>';
687
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="'.$class.'" style="'.$field_icon.'">'.$field_icon_af;
688
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
689
+            $html .= '</span>'.$post->{$cf['htmlvar_name']}.'</div>';
690 690
 
691 691
         endif;
692 692
 
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 
695 695
     return $html;
696 696
 }
697
-add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
697
+add_filter('geodir_custom_field_output_text', 'geodir_cf_text', 10, 3);
698 698
 
699 699
 
700 700
 /**
@@ -707,21 +707,21 @@  discard block
 block discarded – undo
707 707
  *
708 708
  * @return string The html to output for the custom field.
709 709
  */
710
-function geodir_cf_radio($html,$location,$cf,$p=''){
710
+function geodir_cf_radio($html, $location, $cf, $p = '') {
711 711
 
712 712
     // check we have the post value
713
-    if(is_int($p)){$post = geodir_get_post_info($p);}
714
-    else{ global $post;}
713
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
714
+    else { global $post; }
715 715
 
716
-    if(!is_array($cf) && $cf!=''){
716
+    if (!is_array($cf) && $cf != '') {
717 717
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
718
-        if(!$cf){return NULL;}
718
+        if (!$cf) {return NULL; }
719 719
     }
720 720
 
721 721
     $html_var = $cf['htmlvar_name'];
722 722
 
723 723
     // Check if there is a location specific filter.
724
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
724
+    if (has_filter("geodir_custom_field_output_radio_loc_{$location}")) {
725 725
         /**
726 726
          * Filter the radio html by location.
727 727
          *
@@ -729,11 +729,11 @@  discard block
 block discarded – undo
729 729
          * @param array $cf The custom field array.
730 730
          * @since 1.6.6
731 731
          */
732
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
732
+        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}", $html, $cf);
733 733
     }
734 734
 
735 735
     // Check if there is a custom field specific filter.
736
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
736
+    if (has_filter("geodir_custom_field_output_radio_var_{$html_var}")) {
737 737
         /**
738 738
          * Filter the radio html by individual custom field.
739 739
          *
@@ -742,11 +742,11 @@  discard block
 block discarded – undo
742 742
          * @param array $cf The custom field array.
743 743
          * @since 1.6.6
744 744
          */
745
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
745
+        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}", $html, $location, $cf);
746 746
     }
747 747
 
748 748
     // Check if there is a custom field key specific filter.
749
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
749
+    if (has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")) {
750 750
         /**
751 751
          * Filter the radio html by field type key.
752 752
          *
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
          * @param array $cf The custom field array.
756 756
          * @since 1.6.6
757 757
          */
758
-        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
758
+        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}", $html, $location, $cf);
759 759
     }
760 760
 
761 761
     // If not html then we run the standard output.
762
-    if(empty($html)){
762
+    if (empty($html)) {
763 763
 
764 764
         $html_val = __($post->{$cf['htmlvar_name']}, 'geodirectory');
765 765
         if ($post->{$cf['htmlvar_name']} != ''):
@@ -793,16 +793,16 @@  discard block
 block discarded – undo
793 793
             }
794 794
 
795 795
 
796
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
797
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
798
-            $html .= '</span>' . $html_val . '</div>';
796
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-radio" style="'.$field_icon.'">'.$field_icon_af;
797
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
798
+            $html .= '</span>'.$html_val.'</div>';
799 799
         endif;
800 800
 
801 801
     }
802 802
 
803 803
     return $html;
804 804
 }
805
-add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
805
+add_filter('geodir_custom_field_output_radio', 'geodir_cf_radio', 10, 3);
806 806
 
807 807
 
808 808
 /**
@@ -815,21 +815,21 @@  discard block
 block discarded – undo
815 815
  *
816 816
  * @return string The html to output for the custom field.
817 817
  */
818
-function geodir_cf_select($html,$location,$cf,$p=''){
818
+function geodir_cf_select($html, $location, $cf, $p = '') {
819 819
 
820 820
     // check we have the post value
821
-    if(is_int($p)){$post = geodir_get_post_info($p);}
822
-    else{ global $post;}
821
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
822
+    else { global $post; }
823 823
 
824
-    if(!is_array($cf) && $cf!=''){
824
+    if (!is_array($cf) && $cf != '') {
825 825
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
826
-        if(!$cf){return NULL;}
826
+        if (!$cf) {return NULL; }
827 827
     }
828 828
 
829 829
     $html_var = $cf['htmlvar_name'];
830 830
 
831 831
     // Check if there is a location specific filter.
832
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
832
+    if (has_filter("geodir_custom_field_output_select_loc_{$location}")) {
833 833
         /**
834 834
          * Filter the select html by location.
835 835
          *
@@ -837,11 +837,11 @@  discard block
 block discarded – undo
837 837
          * @param array $cf The custom field array.
838 838
          * @since 1.6.6
839 839
          */
840
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
840
+        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}", $html, $cf);
841 841
     }
842 842
 
843 843
     // Check if there is a custom field specific filter.
844
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
844
+    if (has_filter("geodir_custom_field_output_select_var_{$html_var}")) {
845 845
         /**
846 846
          * Filter the select html by individual custom field.
847 847
          *
@@ -850,11 +850,11 @@  discard block
 block discarded – undo
850 850
          * @param array $cf The custom field array.
851 851
          * @since 1.6.6
852 852
          */
853
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
853
+        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}", $html, $location, $cf);
854 854
     }
855 855
 
856 856
     // Check if there is a custom field key specific filter.
857
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
857
+    if (has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")) {
858 858
         /**
859 859
          * Filter the select html by field type key.
860 860
          *
@@ -863,11 +863,11 @@  discard block
 block discarded – undo
863 863
          * @param array $cf The custom field array.
864 864
          * @since 1.6.6
865 865
          */
866
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
866
+        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}", $html, $location, $cf);
867 867
     }
868 868
 
869 869
     // If not html then we run the standard output.
870
-    if(empty($html)){
870
+    if (empty($html)) {
871 871
 
872 872
         if ($post->{$cf['htmlvar_name']}):
873 873
             $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
@@ -895,16 +895,16 @@  discard block
 block discarded – undo
895 895
             }
896 896
 
897 897
 
898
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
899
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
900
-            $html .= '</span>' . $field_value . '</div>';
898
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
899
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
900
+            $html .= '</span>'.$field_value.'</div>';
901 901
         endif;
902 902
 
903 903
     }
904 904
 
905 905
     return $html;
906 906
 }
907
-add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
907
+add_filter('geodir_custom_field_output_select', 'geodir_cf_select', 10, 3);
908 908
 
909 909
 
910 910
 /**
@@ -917,21 +917,21 @@  discard block
 block discarded – undo
917 917
  *
918 918
  * @return string The html to output for the custom field.
919 919
  */
920
-function geodir_cf_multiselect($html,$location,$cf,$p=''){
920
+function geodir_cf_multiselect($html, $location, $cf, $p = '') {
921 921
 
922 922
     // check we have the post value
923
-    if(is_int($p)){$post = geodir_get_post_info($p);}
924
-    else{ global $post;}
923
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
924
+    else { global $post; }
925 925
 
926
-    if(!is_array($cf) && $cf!=''){
926
+    if (!is_array($cf) && $cf != '') {
927 927
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
928
-        if(!$cf){return NULL;}
928
+        if (!$cf) {return NULL; }
929 929
     }
930 930
 
931 931
     $html_var = $cf['htmlvar_name'];
932 932
 
933 933
     // Check if there is a location specific filter.
934
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
934
+    if (has_filter("geodir_custom_field_output_multiselect_loc_{$location}")) {
935 935
         /**
936 936
          * Filter the multiselect html by location.
937 937
          *
@@ -939,11 +939,11 @@  discard block
 block discarded – undo
939 939
          * @param array $cf The custom field array.
940 940
          * @since 1.6.6
941 941
          */
942
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
942
+        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}", $html, $cf);
943 943
     }
944 944
 
945 945
     // Check if there is a custom field specific filter.
946
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
946
+    if (has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")) {
947 947
         /**
948 948
          * Filter the multiselect html by individual custom field.
949 949
          *
@@ -952,11 +952,11 @@  discard block
 block discarded – undo
952 952
          * @param array $cf The custom field array.
953 953
          * @since 1.6.6
954 954
          */
955
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
955
+        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}", $html, $location, $cf);
956 956
     }
957 957
 
958 958
     // Check if there is a custom field key specific filter.
959
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
959
+    if (has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")) {
960 960
         /**
961 961
          * Filter the multiselect html by field type key.
962 962
          *
@@ -965,11 +965,11 @@  discard block
 block discarded – undo
965 965
          * @param array $cf The custom field array.
966 966
          * @since 1.6.6
967 967
          */
968
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
968
+        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}", $html, $location, $cf);
969 969
     }
970 970
 
971 971
     // If not html then we run the standard output.
972
-    if(empty($html)){
972
+    if (empty($html)) {
973 973
 
974 974
 
975 975
         if (!empty($post->{$cf['htmlvar_name']})):
@@ -1004,15 +1004,15 @@  discard block
 block discarded – undo
1004 1004
             }
1005 1005
 
1006 1006
 
1007
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1008
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1007
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
1008
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1009 1009
             $html .= '</span>';
1010 1010
 
1011 1011
             if (count($option_values) > 1) {
1012 1012
                 $html .= '<ul>';
1013 1013
 
1014 1014
                 foreach ($option_values as $val) {
1015
-                    $html .= '<li>' . $val . '</li>';
1015
+                    $html .= '<li>'.$val.'</li>';
1016 1016
                 }
1017 1017
 
1018 1018
                 $html .= '</ul>';
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 
1028 1028
     return $html;
1029 1029
 }
1030
-add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1030
+add_filter('geodir_custom_field_output_multiselect', 'geodir_cf_multiselect', 10, 3);
1031 1031
 
1032 1032
 
1033 1033
 /**
@@ -1040,21 +1040,21 @@  discard block
 block discarded – undo
1040 1040
  *
1041 1041
  * @return string The html to output for the custom field.
1042 1042
  */
1043
-function geodir_cf_email($html,$location,$cf,$p=''){
1043
+function geodir_cf_email($html, $location, $cf, $p = '') {
1044 1044
 
1045 1045
     // check we have the post value
1046
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1047
-    else{ global $post;}
1046
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1047
+    else { global $post; }
1048 1048
 
1049
-    if(!is_array($cf) && $cf!=''){
1049
+    if (!is_array($cf) && $cf != '') {
1050 1050
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1051
-        if(!$cf){return NULL;}
1051
+        if (!$cf) {return NULL; }
1052 1052
     }
1053 1053
 
1054 1054
     $html_var = $cf['htmlvar_name'];
1055 1055
 
1056 1056
     // Check if there is a location specific filter.
1057
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1057
+    if (has_filter("geodir_custom_field_output_email_loc_{$location}")) {
1058 1058
         /**
1059 1059
          * Filter the email html by location.
1060 1060
          *
@@ -1062,11 +1062,11 @@  discard block
 block discarded – undo
1062 1062
          * @param array $cf The custom field array.
1063 1063
          * @since 1.6.6
1064 1064
          */
1065
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1065
+        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}", $html, $cf);
1066 1066
     }
1067 1067
 
1068 1068
     // Check if there is a custom field specific filter.
1069
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1069
+    if (has_filter("geodir_custom_field_output_email_var_{$html_var}")) {
1070 1070
         /**
1071 1071
          * Filter the email html by individual custom field.
1072 1072
          *
@@ -1075,11 +1075,11 @@  discard block
 block discarded – undo
1075 1075
          * @param array $cf The custom field array.
1076 1076
          * @since 1.6.6
1077 1077
          */
1078
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1078
+        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}", $html, $location, $cf);
1079 1079
     }
1080 1080
 
1081 1081
     // Check if there is a custom field key specific filter.
1082
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1082
+    if (has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")) {
1083 1083
         /**
1084 1084
          * Filter the email html by field type key.
1085 1085
          *
@@ -1088,18 +1088,18 @@  discard block
 block discarded – undo
1088 1088
          * @param array $cf The custom field array.
1089 1089
          * @since 1.6.6
1090 1090
          */
1091
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1091
+        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}", $html, $location, $cf);
1092 1092
     }
1093 1093
 
1094 1094
     // If not html then we run the standard output.
1095
-    if(empty($html)){
1095
+    if (empty($html)) {
1096 1096
 
1097 1097
         global $preview;
1098 1098
         if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1099 1099
             return ''; // Remove Send Enquiry | Send To Friend from listings page
1100 1100
         }
1101 1101
 
1102
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1102
+        $package_info = (array) geodir_post_package_info(array(), $post, $post->post_type);
1103 1103
 
1104 1104
         if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$cf['htmlvar_name']})) {
1105 1105
             $send_to_friend = true;
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
             if (!$preview) {
1111 1111
                 $b_send_inquiry = 'b_send_inquiry';
1112 1112
                 $b_sendtofriend = 'b_sendtofriend';
1113
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1113
+                $html = '<input type="hidden" name="geodir_popup_post_id" value="'.$post->ID.'" /><div class="geodir_display_popup_forms"></div>';
1114 1114
             }
1115 1115
 
1116 1116
             $field_icon = geodir_field_icon_proccess($cf);
@@ -1124,26 +1124,26 @@  discard block
 block discarded – undo
1124 1124
             }
1125 1125
 
1126 1126
 
1127
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1127
+            $html .= '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
1128 1128
             $seperator = '';
1129 1129
             if ($post->{$cf['htmlvar_name']}) {
1130
-                $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1130
+                $html .= '<a href="javascript:void(0);" class="'.$b_send_inquiry.'" >'.SEND_INQUIRY.'</a>';
1131 1131
                 $seperator = ' | ';
1132 1132
             }
1133 1133
 
1134 1134
             if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
1135
-                $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1135
+                $html .= $seperator.'<a href="javascript:void(0);" class="'.$b_sendtofriend.'">'.SEND_TO_FRIEND.'</a>';
1136 1136
             }
1137 1137
 
1138 1138
             $html .= '</span></div>';
1139 1139
 
1140 1140
 
1141 1141
             if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1142
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1142
+                $html .= '<p class="sucess_msg">'.SEND_INQUIRY_SUCCESS.'</p>';
1143 1143
             } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1144
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1144
+                $html .= '<p class="sucess_msg">'.SEND_FRIEND_SUCCESS.'</p>';
1145 1145
             } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1146
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1146
+                $html .= '<p class="error_msg_fix">'.WRONG_CAPTCH_MSG.'</p>';
1147 1147
             }
1148 1148
 
1149 1149
             /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
@@ -1163,11 +1163,11 @@  discard block
 block discarded – undo
1163 1163
                 }
1164 1164
 
1165 1165
 
1166
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1167
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1166
+                $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
1167
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1168 1168
                 $html .= '</span><span class="geodir-email-address-output">';
1169 1169
                 $email = $post->{$cf['htmlvar_name']} ;
1170
-                if($e_split = explode('@',$email)){
1170
+                if ($e_split = explode('@', $email)) {
1171 1171
                     /**
1172 1172
                      * Filter email custom field name output.
1173 1173
                      *
@@ -1176,10 +1176,10 @@  discard block
 block discarded – undo
1176 1176
                      * @param string $email The email string being output.
1177 1177
                      * @param array $cf Custom field variables array.
1178 1178
                      */
1179
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1180
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1181
-                }else{
1182
-                    $html .=  $email;
1179
+                    $email_name = apply_filters('geodir_email_field_name_output', $email, $cf);
1180
+                    $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1181
+                } else {
1182
+                    $html .= $email;
1183 1183
                 }
1184 1184
                 $html .= '</span></div>';
1185 1185
             }
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
 
1191 1191
     return $html;
1192 1192
 }
1193
-add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1193
+add_filter('geodir_custom_field_output_email', 'geodir_cf_email', 10, 3);
1194 1194
 
1195 1195
 
1196 1196
 /**
@@ -1203,21 +1203,21 @@  discard block
 block discarded – undo
1203 1203
  *
1204 1204
  * @return string The html to output for the custom field.
1205 1205
  */
1206
-function geodir_cf_file($html,$location,$cf,$p=''){
1206
+function geodir_cf_file($html, $location, $cf, $p = '') {
1207 1207
 
1208 1208
     // check we have the post value
1209
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1210
-    else{ global $post;}
1209
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1210
+    else { global $post; }
1211 1211
 
1212
-    if(!is_array($cf) && $cf!=''){
1212
+    if (!is_array($cf) && $cf != '') {
1213 1213
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1214
-        if(!$cf){return NULL;}
1214
+        if (!$cf) {return NULL; }
1215 1215
     }
1216 1216
 
1217 1217
     $html_var = $cf['htmlvar_name'];
1218 1218
 
1219 1219
     // Check if there is a location specific filter.
1220
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1220
+    if (has_filter("geodir_custom_field_output_file_loc_{$location}")) {
1221 1221
         /**
1222 1222
          * Filter the file html by location.
1223 1223
          *
@@ -1225,11 +1225,11 @@  discard block
 block discarded – undo
1225 1225
          * @param array $cf The custom field array.
1226 1226
          * @since 1.6.6
1227 1227
          */
1228
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1228
+        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}", $html, $cf);
1229 1229
     }
1230 1230
 
1231 1231
     // Check if there is a custom field specific filter.
1232
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1232
+    if (has_filter("geodir_custom_field_output_file_var_{$html_var}")) {
1233 1233
         /**
1234 1234
          * Filter the file html by individual custom field.
1235 1235
          *
@@ -1238,11 +1238,11 @@  discard block
 block discarded – undo
1238 1238
          * @param array $cf The custom field array.
1239 1239
          * @since 1.6.6
1240 1240
          */
1241
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1241
+        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}", $html, $location, $cf);
1242 1242
     }
1243 1243
 
1244 1244
     // Check if there is a custom field key specific filter.
1245
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1245
+    if (has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")) {
1246 1246
         /**
1247 1247
          * Filter the file html by field type key.
1248 1248
          *
@@ -1251,11 +1251,11 @@  discard block
 block discarded – undo
1251 1251
          * @param array $cf The custom field array.
1252 1252
          * @since 1.6.6
1253 1253
          */
1254
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1254
+        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}", $html, $location, $cf);
1255 1255
     }
1256 1256
 
1257 1257
     // If not html then we run the standard output.
1258
-    if(empty($html)){
1258
+    if (empty($html)) {
1259 1259
 
1260 1260
         if (!empty($post->{$cf['htmlvar_name']})):
1261 1261
 
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
             if (!empty($files)):
1264 1264
 
1265 1265
                 $extra_fields = !empty($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : NULL;
1266
-                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1266
+                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
1267 1267
 
1268 1268
                 $file_paths = '';
1269 1269
                 foreach ($files as $file) {
@@ -1300,9 +1300,9 @@  discard block
 block discarded – undo
1300 1300
                             //$file_paths .= '<img src="'.$file.'"  />';	
1301 1301
                             $file_paths .= '</div>';
1302 1302
                         } else {
1303
-                            $ext_path = '_' . $html_var . '_';
1303
+                            $ext_path = '_'.$html_var.'_';
1304 1304
                             $filename = explode($ext_path, $filename);
1305
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1305
+                            $file_paths .= '<a href="'.$file.'" target="_blank">'.$filename[count($filename) - 1].'</a>';
1306 1306
                         }
1307 1307
                     }
1308 1308
                 }
@@ -1317,11 +1317,11 @@  discard block
 block discarded – undo
1317 1317
                     $field_icon = '';
1318 1318
                 }
1319 1319
 
1320
-                $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1320
+                $html = '<div class="geodir_more_info  '.$cf['css_class'].' geodir-custom-file-box '.$cf['htmlvar_name'].'"><div class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
1321 1321
                 $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1322
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1322
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1323 1323
                 $html .= '</span>';
1324
-                $html .= $file_paths . '</div></div>';
1324
+                $html .= $file_paths.'</div></div>';
1325 1325
 
1326 1326
             endif;
1327 1327
         endif;
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 
1331 1331
     return $html;
1332 1332
 }
1333
-add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1333
+add_filter('geodir_custom_field_output_file', 'geodir_cf_file', 10, 3);
1334 1334
 
1335 1335
 
1336 1336
 
@@ -1344,21 +1344,21 @@  discard block
 block discarded – undo
1344 1344
  *
1345 1345
  * @return string The html to output for the custom field.
1346 1346
  */
1347
-function geodir_cf_textarea($html,$location,$cf,$p=''){
1347
+function geodir_cf_textarea($html, $location, $cf, $p = '') {
1348 1348
 
1349 1349
     // check we have the post value
1350
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1351
-    else{ global $post;}
1350
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1351
+    else { global $post; }
1352 1352
 
1353
-    if(!is_array($cf) && $cf!=''){
1353
+    if (!is_array($cf) && $cf != '') {
1354 1354
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1355
-        if(!$cf){return NULL;}
1355
+        if (!$cf) {return NULL; }
1356 1356
     }
1357 1357
 
1358 1358
     $html_var = $cf['htmlvar_name'];
1359 1359
 
1360 1360
     // Check if there is a location specific filter.
1361
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1361
+    if (has_filter("geodir_custom_field_output_textarea_loc_{$location}")) {
1362 1362
         /**
1363 1363
          * Filter the textarea html by location.
1364 1364
          *
@@ -1366,11 +1366,11 @@  discard block
 block discarded – undo
1366 1366
          * @param array $cf The custom field array.
1367 1367
          * @since 1.6.6
1368 1368
          */
1369
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1369
+        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}", $html, $cf);
1370 1370
     }
1371 1371
 
1372 1372
     // Check if there is a custom field specific filter.
1373
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1373
+    if (has_filter("geodir_custom_field_output_textarea_var_{$html_var}")) {
1374 1374
         /**
1375 1375
          * Filter the textarea html by individual custom field.
1376 1376
          *
@@ -1379,11 +1379,11 @@  discard block
 block discarded – undo
1379 1379
          * @param array $cf The custom field array.
1380 1380
          * @since 1.6.6
1381 1381
          */
1382
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1382
+        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}", $html, $location, $cf);
1383 1383
     }
1384 1384
 
1385 1385
     // Check if there is a custom field key specific filter.
1386
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1386
+    if (has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")) {
1387 1387
         /**
1388 1388
          * Filter the textarea html by field type key.
1389 1389
          *
@@ -1392,11 +1392,11 @@  discard block
 block discarded – undo
1392 1392
          * @param array $cf The custom field array.
1393 1393
          * @since 1.6.6
1394 1394
          */
1395
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1395
+        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}", $html, $location, $cf);
1396 1396
     }
1397 1397
 
1398 1398
     // If not html then we run the standard output.
1399
-    if(empty($html)){
1399
+    if (empty($html)) {
1400 1400
 
1401 1401
         if (!empty($post->{$cf['htmlvar_name']})) {
1402 1402
 
@@ -1411,9 +1411,9 @@  discard block
 block discarded – undo
1411 1411
             }
1412 1412
 
1413 1413
 
1414
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1415
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1416
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1414
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
1415
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1416
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1417 1417
 
1418 1418
         }
1419 1419
 
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
 
1422 1422
     return $html;
1423 1423
 }
1424
-add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1424
+add_filter('geodir_custom_field_output_textarea', 'geodir_cf_textarea', 10, 3);
1425 1425
 
1426 1426
 
1427 1427
 
@@ -1435,21 +1435,21 @@  discard block
 block discarded – undo
1435 1435
  *
1436 1436
  * @return string The html to output for the custom field.
1437 1437
  */
1438
-function geodir_cf_html($html,$location,$cf,$p=''){
1438
+function geodir_cf_html($html, $location, $cf, $p = '') {
1439 1439
 
1440 1440
     // check we have the post value
1441
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1442
-    else{ global $post;}
1441
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1442
+    else { global $post; }
1443 1443
 
1444
-    if(!is_array($cf) && $cf!=''){
1444
+    if (!is_array($cf) && $cf != '') {
1445 1445
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1446
-        if(!$cf){return NULL;}
1446
+        if (!$cf) {return NULL; }
1447 1447
     }
1448 1448
 
1449 1449
     $html_var = $cf['htmlvar_name'];
1450 1450
 
1451 1451
     // Check if there is a location specific filter.
1452
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1452
+    if (has_filter("geodir_custom_field_output_html_loc_{$location}")) {
1453 1453
         /**
1454 1454
          * Filter the html html by location.
1455 1455
          *
@@ -1457,11 +1457,11 @@  discard block
 block discarded – undo
1457 1457
          * @param array $cf The custom field array.
1458 1458
          * @since 1.6.6
1459 1459
          */
1460
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1460
+        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}", $html, $cf);
1461 1461
     }
1462 1462
 
1463 1463
     // Check if there is a custom field specific filter.
1464
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1464
+    if (has_filter("geodir_custom_field_output_html_var_{$html_var}")) {
1465 1465
         /**
1466 1466
          * Filter the html html by individual custom field.
1467 1467
          *
@@ -1470,11 +1470,11 @@  discard block
 block discarded – undo
1470 1470
          * @param array $cf The custom field array.
1471 1471
          * @since 1.6.6
1472 1472
          */
1473
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1473
+        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}", $html, $location, $cf);
1474 1474
     }
1475 1475
 
1476 1476
     // Check if there is a custom field key specific filter.
1477
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1477
+    if (has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")) {
1478 1478
         /**
1479 1479
          * Filter the html html by field type key.
1480 1480
          *
@@ -1483,11 +1483,11 @@  discard block
 block discarded – undo
1483 1483
          * @param array $cf The custom field array.
1484 1484
          * @since 1.6.6
1485 1485
          */
1486
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1486
+        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}", $html, $location, $cf);
1487 1487
     }
1488 1488
 
1489 1489
     // If not html then we run the standard output.
1490
-    if(empty($html)){
1490
+    if (empty($html)) {
1491 1491
 
1492 1492
         if (!empty($post->{$cf['htmlvar_name']})) {
1493 1493
 
@@ -1501,9 +1501,9 @@  discard block
 block discarded – undo
1501 1501
                 $field_icon = '';
1502 1502
             }
1503 1503
 
1504
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1505
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1506
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1504
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
1505
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1506
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1507 1507
 
1508 1508
         }
1509 1509
 
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 
1512 1512
     return $html;
1513 1513
 }
1514
-add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1514
+add_filter('geodir_custom_field_output_html', 'geodir_cf_html', 10, 3);
1515 1515
 
1516 1516
 
1517 1517
 
@@ -1525,21 +1525,21 @@  discard block
 block discarded – undo
1525 1525
  *
1526 1526
  * @return string The html to output for the custom field.
1527 1527
  */
1528
-function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1528
+function geodir_cf_taxonomy($html, $location, $cf, $p = '') {
1529 1529
 
1530 1530
     // check we have the post value
1531
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1532
-    else{ global $post;}
1531
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1532
+    else { global $post; }
1533 1533
 
1534
-    if(!is_array($cf) && $cf!=''){
1534
+    if (!is_array($cf) && $cf != '') {
1535 1535
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1536
-        if(!$cf){return NULL;}
1536
+        if (!$cf) {return NULL; }
1537 1537
     }
1538 1538
 
1539 1539
     $html_var = $cf['htmlvar_name'];
1540 1540
 
1541 1541
     // Check if there is a location specific filter.
1542
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1542
+    if (has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")) {
1543 1543
         /**
1544 1544
          * Filter the taxonomy html by location.
1545 1545
          *
@@ -1547,11 +1547,11 @@  discard block
 block discarded – undo
1547 1547
          * @param array $cf The custom field array.
1548 1548
          * @since 1.6.6
1549 1549
          */
1550
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1550
+        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}", $html, $cf);
1551 1551
     }
1552 1552
 
1553 1553
     // Check if there is a custom field specific filter.
1554
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1554
+    if (has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")) {
1555 1555
         /**
1556 1556
          * Filter the taxonomy html by individual custom field.
1557 1557
          *
@@ -1560,11 +1560,11 @@  discard block
 block discarded – undo
1560 1560
          * @param array $cf The custom field array.
1561 1561
          * @since 1.6.6
1562 1562
          */
1563
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1563
+        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}", $html, $location, $cf);
1564 1564
     }
1565 1565
 
1566 1566
     // Check if there is a custom field key specific filter.
1567
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1567
+    if (has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")) {
1568 1568
         /**
1569 1569
          * Filter the taxonomy html by field type key.
1570 1570
          *
@@ -1573,14 +1573,14 @@  discard block
 block discarded – undo
1573 1573
          * @param array $cf The custom field array.
1574 1574
          * @since 1.6.6
1575 1575
          */
1576
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1576
+        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}", $html, $location, $cf);
1577 1577
     }
1578 1578
 
1579 1579
     // If not html then we run the standard output.
1580
-    if(empty($html)){
1580
+    if (empty($html)) {
1581 1581
 
1582
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1583
-            $post_taxonomy = $post->post_type . 'category';
1582
+        if ($html_var == $post->post_type.'category' && !empty($post->{$html_var})) {
1583
+            $post_taxonomy = $post->post_type.'category';
1584 1584
             $field_value = $post->{$html_var};
1585 1585
             $links = array();
1586 1586
             $terms = array();
@@ -1598,7 +1598,7 @@  discard block
 block discarded – undo
1598 1598
                     if ($term != '') {
1599 1599
                         $term = get_term_by('id', $term, $html_var);
1600 1600
                         if (is_object($term)) {
1601
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1601
+                            $links[] = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>".$term->name."</a>";
1602 1602
                             $terms[] = $term;
1603 1603
                         }
1604 1604
                     }
@@ -1612,7 +1612,7 @@  discard block
 block discarded – undo
1612 1612
                     $terms = $termsOrdered;
1613 1613
                 }
1614 1614
             }
1615
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1615
+            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object) $terms) : '';
1616 1616
 
1617 1617
             if ($html_value != '') {
1618 1618
                 $field_icon = geodir_field_icon_proccess($cf);
@@ -1625,9 +1625,9 @@  discard block
 block discarded – undo
1625 1625
                     $field_icon = '';
1626 1626
                 }
1627 1627
 
1628
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1629
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1630
-                $html .= '</span> ' . $html_value . '</div>';
1628
+                $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="'.$field_icon.'">'.$field_icon_af;
1629
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1630
+                $html .= '</span> '.$html_value.'</div>';
1631 1631
             }
1632 1632
         }
1633 1633
 
@@ -1635,7 +1635,7 @@  discard block
 block discarded – undo
1635 1635
 
1636 1636
     return $html;
1637 1637
 }
1638
-add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1638
+add_filter('geodir_custom_field_output_taxonomy', 'geodir_cf_taxonomy', 10, 3);
1639 1639
 
1640 1640
 
1641 1641
 /**
@@ -1648,21 +1648,21 @@  discard block
 block discarded – undo
1648 1648
  *
1649 1649
  * @return string The html to output for the custom field.
1650 1650
  */
1651
-function geodir_cf_address($html,$location,$cf,$p=''){
1651
+function geodir_cf_address($html, $location, $cf, $p = '') {
1652 1652
 
1653 1653
     // check we have the post value
1654
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1655
-    else{ global $post;}
1654
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1655
+    else { global $post; }
1656 1656
 
1657
-    if(!is_array($cf) && $cf!=''){
1657
+    if (!is_array($cf) && $cf != '') {
1658 1658
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1659
-        if(!$cf){return NULL;}
1659
+        if (!$cf) {return NULL; }
1660 1660
     }
1661 1661
 
1662 1662
     $html_var = $cf['htmlvar_name'];
1663 1663
 
1664 1664
     // Check if there is a location specific filter.
1665
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1665
+    if (has_filter("geodir_custom_field_output_address_loc_{$location}")) {
1666 1666
         /**
1667 1667
          * Filter the address html by location.
1668 1668
          *
@@ -1670,11 +1670,11 @@  discard block
 block discarded – undo
1670 1670
          * @param array $cf The custom field array.
1671 1671
          * @since 1.6.6
1672 1672
          */
1673
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1673
+        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}", $html, $cf);
1674 1674
     }
1675 1675
 
1676 1676
     // Check if there is a custom field specific filter.
1677
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1677
+    if (has_filter("geodir_custom_field_output_address_var_{$html_var}")) {
1678 1678
         /**
1679 1679
          * Filter the address html by individual custom field.
1680 1680
          *
@@ -1683,11 +1683,11 @@  discard block
 block discarded – undo
1683 1683
          * @param array $cf The custom field array.
1684 1684
          * @since 1.6.6
1685 1685
          */
1686
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1686
+        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}", $html, $location, $cf);
1687 1687
     }
1688 1688
 
1689 1689
     // Check if there is a custom field key specific filter.
1690
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1690
+    if (has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")) {
1691 1691
         /**
1692 1692
          * Filter the address html by field type key.
1693 1693
          *
@@ -1696,14 +1696,14 @@  discard block
 block discarded – undo
1696 1696
          * @param array $cf The custom field array.
1697 1697
          * @since 1.6.6
1698 1698
          */
1699
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1699
+        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}", $html, $location, $cf);
1700 1700
     }
1701 1701
 
1702 1702
     // If not html then we run the standard output.
1703
-    if(empty($html)){
1703
+    if (empty($html)) {
1704 1704
 
1705 1705
         global $preview;
1706
-        $html_var = $cf['htmlvar_name'] . '_address';
1706
+        $html_var = $cf['htmlvar_name'].'_address';
1707 1707
 
1708 1708
         if ($cf['extra_fields']) {
1709 1709
 
@@ -1766,10 +1766,10 @@  discard block
 block discarded – undo
1766 1766
 
1767 1767
         if ($post->{$html_var}) {
1768 1768
 
1769
-            $field_icon = geodir_field_icon_proccess( $cf );
1770
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1769
+            $field_icon = geodir_field_icon_proccess($cf);
1770
+            if (strpos($field_icon, 'http') !== false) {
1771 1771
                 $field_icon_af = '';
1772
-            } elseif ( $field_icon == '' ) {
1772
+            } elseif ($field_icon == '') {
1773 1773
                 $field_icon_af = '<i class="fa fa-home"></i>';
1774 1774
             } else {
1775 1775
                 $field_icon_af = $field_icon;
@@ -1778,26 +1778,26 @@  discard block
 block discarded – undo
1778 1778
             
1779 1779
 
1780 1780
 
1781
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1782
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1783
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1781
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1782
+            $html .= '<span class="geodir-i-location" style="'.$field_icon.'">'.$field_icon_af;
1783
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
1784 1784
             $html .= '</span>';
1785 1785
 
1786 1786
 
1787
-            if ( $post->post_address ) {
1788
-                $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1787
+            if ($post->post_address) {
1788
+                $html .= '<span itemprop="streetAddress">'.$post->post_address.'</span><br>';
1789 1789
             }
1790
-            if ($show_city_in_address && $post->post_city ) {
1791
-                $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1790
+            if ($show_city_in_address && $post->post_city) {
1791
+                $html .= '<span itemprop="addressLocality">'.$post->post_city.'</span><br>';
1792 1792
             }
1793
-            if ($show_region_in_address && $post->post_region ) {
1794
-                $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1793
+            if ($show_region_in_address && $post->post_region) {
1794
+                $html .= '<span itemprop="addressRegion">'.$post->post_region.'</span><br>';
1795 1795
             }
1796
-            if ($show_zip_in_address && $post->post_zip ) {
1797
-                $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1796
+            if ($show_zip_in_address && $post->post_zip) {
1797
+                $html .= '<span itemprop="postalCode">'.$post->post_zip.'</span><br>';
1798 1798
             }
1799
-            if ($show_country_in_address && $post->post_country ) {
1800
-                $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1799
+            if ($show_country_in_address && $post->post_country) {
1800
+                $html .= '<span itemprop="addressCountry">'.__($post->post_country, 'geodirectory').'</span><br>';
1801 1801
             }
1802 1802
             $html .= '</div>';
1803 1803
 
@@ -1808,4 +1808,4 @@  discard block
 block discarded – undo
1808 1808
 
1809 1809
     return $html;
1810 1810
 }
1811
-add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1812 1811
\ No newline at end of file
1812
+add_filter('geodir_custom_field_output_address', 'geodir_cf_address', 10, 3);
1813 1813
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_functions.php 1 patch
Indentation   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function  geodir_init_map_jason()
17 17
 {
18
-    global $map_jason;
19
-    $map_jason = array();
18
+	global $map_jason;
19
+	$map_jason = array();
20 20
 }
21 21
 
22 22
 /**
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
  */
29 29
 function geodir_init_map_canvas_array()
30 30
 {
31
-    global $map_canvas_arr;
32
-    $map_canvas_arr = array();
31
+	global $map_canvas_arr;
32
+	$map_canvas_arr = array();
33 33
 }
34 34
 
35 35
 
@@ -50,47 +50,47 @@  discard block
 block discarded – undo
50 50
  */
51 51
 function create_marker_jason_of_posts($post)
52 52
 {
53
-    global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes;
53
+	global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes;
54 54
 
55
-    if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
56
-        $srcharr = array("'", "/", "-", '"', '\\');
57
-        $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
55
+	if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
56
+		$srcharr = array("'", "/", "-", '"', '\\');
57
+		$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
58 58
 
59 59
 
60
-        $geodir_cat_icons = geodir_get_term_icon();
61
-        $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$post->default_category]) ? $geodir_cat_icons[$post->default_category] : '';
60
+		$geodir_cat_icons = geodir_get_term_icon();
61
+		$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$post->default_category]) ? $geodir_cat_icons[$post->default_category] : '';
62 62
 
63
-        $post_title = $post->post_title;
64
-        $title = str_replace($srcharr, $replarr, $post_title);
63
+		$post_title = $post->post_title;
64
+		$title = str_replace($srcharr, $replarr, $post_title);
65 65
 
66
-        if (is_ssl()) {
67
-            $icon = str_replace("http:","https:",$icon );
68
-        }
66
+		if (is_ssl()) {
67
+			$icon = str_replace("http:","https:",$icon );
68
+		}
69 69
         
70
-        if ($icon != '') {
71
-            $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
70
+		if ($icon != '') {
71
+			$gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
72 72
             
73
-            if (isset($gd_marker_sizes[$icon])) {
74
-                $icon_size = $gd_marker_sizes[$icon];
75
-            } else {
76
-                $icon_size = geodir_get_marker_size($icon);
77
-                $gd_marker_sizes[$icon] = $icon_size;
78
-            }               
79
-        } else {
80
-            $icon_size = array('w' => 36, 'h' => 45);
81
-        }
82
-
83
-        $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}';
84
-
85
-        /**
86
-         * Filter the json data when creating output for post json marker..
87
-         *
88
-         * @since 1.5.7
89
-         * @param string $post_json JSON representation of the post marker info.
90
-         * @param object $post The post object.
91
-         */
92
-        $map_jason[] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
93
-    }
73
+			if (isset($gd_marker_sizes[$icon])) {
74
+				$icon_size = $gd_marker_sizes[$icon];
75
+			} else {
76
+				$icon_size = geodir_get_marker_size($icon);
77
+				$gd_marker_sizes[$icon] = $icon_size;
78
+			}               
79
+		} else {
80
+			$icon_size = array('w' => 36, 'h' => 45);
81
+		}
82
+
83
+		$post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}';
84
+
85
+		/**
86
+		 * Filter the json data when creating output for post json marker..
87
+		 *
88
+		 * @since 1.5.7
89
+		 * @param string $post_json JSON representation of the post marker info.
90
+		 * @param object $post The post object.
91
+		 */
92
+		$map_jason[] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
93
+	}
94 94
 }
95 95
 
96 96
 /**
@@ -103,58 +103,58 @@  discard block
 block discarded – undo
103 103
  */
104 104
 function send_marker_jason_to_js()
105 105
 {
106
-    global $map_jason, $map_canvas_arr;
107
-
108
-    if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
109
-        foreach ($map_canvas_arr as $canvas => $jason) {
110
-            if (is_array($map_jason) && !empty($map_jason)) {
111
-                $canvas_jason = $canvas . "_jason";
112
-                $map_canvas_arr[$canvas] = array_unique($map_jason);
113
-                unset($cat_content_info);
114
-                $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
115
-                $totalcount = count(array_unique($map_jason));
116
-                if (!empty($cat_content_info)) {
117
-                    $json_content = substr(implode(',', $cat_content_info), 1);
118
-                    $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
119
-                    $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
120
-                } else {
121
-                    $canvas_jason = '[{"totalcount":"0"}]';
122
-                }
123
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
124
-
125
-                /**
126
-                 * Filter the send_marker_jason_to_js() function map canvas json args.
127
-                 *
128
-                 * You can use this filter to modify map canvas json args.
129
-                 *
130
-                 * @since 1.0.0
131
-                 * @package GeoDirectory
132
-                 * @param string $canvas Map canvas array key.
133
-                 * @param array $map_canvas_jason_args Map canvas args.
134
-                 */
135
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
136
-
137
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
138
-            } else {
139
-                $canvas_jason = '[{"totalcount":"0"}]';
140
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
141
-
142
-                /**
143
-                 * Filter the send_marker_jason_to_js() function map canvas json args.
144
-                 *
145
-                 * You can use this filter to modify map canvas json args.
146
-                 *
147
-                 * @since 1.0.0
148
-                 * @package GeoDirectory
149
-                 * @param string $canvas Map canvas array key.
150
-                 * @param array $map_canvas_jason_args Map canvas args.
151
-                 */
152
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
153
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
154
-            }
155
-        }
156
-
157
-    }
106
+	global $map_jason, $map_canvas_arr;
107
+
108
+	if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
109
+		foreach ($map_canvas_arr as $canvas => $jason) {
110
+			if (is_array($map_jason) && !empty($map_jason)) {
111
+				$canvas_jason = $canvas . "_jason";
112
+				$map_canvas_arr[$canvas] = array_unique($map_jason);
113
+				unset($cat_content_info);
114
+				$cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
115
+				$totalcount = count(array_unique($map_jason));
116
+				if (!empty($cat_content_info)) {
117
+					$json_content = substr(implode(',', $cat_content_info), 1);
118
+					$json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
119
+					$canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
120
+				} else {
121
+					$canvas_jason = '[{"totalcount":"0"}]';
122
+				}
123
+				$map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
124
+
125
+				/**
126
+				 * Filter the send_marker_jason_to_js() function map canvas json args.
127
+				 *
128
+				 * You can use this filter to modify map canvas json args.
129
+				 *
130
+				 * @since 1.0.0
131
+				 * @package GeoDirectory
132
+				 * @param string $canvas Map canvas array key.
133
+				 * @param array $map_canvas_jason_args Map canvas args.
134
+				 */
135
+				$map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
136
+
137
+				wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
138
+			} else {
139
+				$canvas_jason = '[{"totalcount":"0"}]';
140
+				$map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
141
+
142
+				/**
143
+				 * Filter the send_marker_jason_to_js() function map canvas json args.
144
+				 *
145
+				 * You can use this filter to modify map canvas json args.
146
+				 *
147
+				 * @since 1.0.0
148
+				 * @package GeoDirectory
149
+				 * @param string $canvas Map canvas array key.
150
+				 * @param array $map_canvas_jason_args Map canvas args.
151
+				 */
152
+				$map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
153
+				wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
154
+			}
155
+		}
156
+
157
+	}
158 158
 }
159 159
 
160 160
 /**
@@ -173,92 +173,92 @@  discard block
 block discarded – undo
173 173
  */
174 174
 function home_map_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = true, $pading = 0, $map_canvas_name = '', $child_collapse, $is_home_map = false)
175 175
 {
176
-    global $cat_count, $geodir_cat_icons;
176
+	global $cat_count, $geodir_cat_icons;
177 177
 
178
-    $exclude_categories = get_option('geodir_exclude_cat_on_map');
179
-    $exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
178
+	$exclude_categories = get_option('geodir_exclude_cat_on_map');
179
+	$exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
180 180
 
181
-    // check if exclude categories saved before fix of categories identical names
182
-    if ($exclude_categories_new) {
183
-        $gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : '';
184
-        $exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array();
185
-    }
181
+	// check if exclude categories saved before fix of categories identical names
182
+	if ($exclude_categories_new) {
183
+		$gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : '';
184
+		$exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array();
185
+	}
186 186
 
187
-    $exclude_cat_str = implode(',', $exclude_categories);
187
+	$exclude_cat_str = implode(',', $exclude_categories);
188 188
 
189
-    if ($exclude_cat_str == '') {
190
-        $exclude_cat_str = '0';
191
-    }
189
+	if ($exclude_cat_str == '') {
190
+		$exclude_cat_str = '0';
191
+	}
192 192
 
193
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
193
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
194 194
 
195
-    if ($hide_empty) {
196
-        $cat_terms = geodir_filter_empty_terms($cat_terms);
197
-    }
195
+	if ($hide_empty) {
196
+		$cat_terms = geodir_filter_empty_terms($cat_terms);
197
+	}
198 198
 
199
-    $main_list_class = '';
200
-    //If there are terms, start displaying
201
-    if (count($cat_terms) > 0) {
202
-        //Displaying as a list
203
-        $p = $pading * 15;
204
-        $pading++;
199
+	$main_list_class = '';
200
+	//If there are terms, start displaying
201
+	if (count($cat_terms) > 0) {
202
+		//Displaying as a list
203
+		$p = $pading * 15;
204
+		$pading++;
205 205
 
206
-        if ($cat_parent == 0) {
207
-            $list_class = 'main_list';
208
-            $display = '';
209
-        } else {
210
-            $list_class = 'sub_list';
211
-            $display = !$child_collapse ? '' : 'display:none';
212
-        }
206
+		if ($cat_parent == 0) {
207
+			$list_class = 'main_list';
208
+			$display = '';
209
+		} else {
210
+			$list_class = 'sub_list';
211
+			$display = !$child_collapse ? '' : 'display:none';
212
+		}
213 213
 
214 214
 
215
-        $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
215
+		$out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
216 216
 
217
-        $geodir_cat_icons = geodir_get_term_icon();
217
+		$geodir_cat_icons = geodir_get_term_icon();
218 218
 
219
-        $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
220
-        $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : $geodir_default_map_search_pt;
221
-        foreach ($cat_terms as $cat_term):
219
+		$geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
220
+		$post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : $geodir_default_map_search_pt;
221
+		foreach ($cat_terms as $cat_term):
222 222
 
223 223
 
224 224
 
225
-            $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : '';
225
+			$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : '';
226 226
 
227
-            if (!in_array($cat_term->term_id, $exclude_categories)):
228
-                //Secret sauce.  Function calls itself to display child elements, if any
229
-                $checked = 'checked="checked"';
227
+			if (!in_array($cat_term->term_id, $exclude_categories)):
228
+				//Secret sauce.  Function calls itself to display child elements, if any
229
+				$checked = 'checked="checked"';
230 230
 
231
-                // Untick the category by default on home map
232
-                if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
233
-                    if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $cat_term->term_id, $geodir_home_map_untick)) {
234
-                        $checked = '';
235
-                    }
236
-                }
231
+				// Untick the category by default on home map
232
+				if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
233
+					if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $cat_term->term_id, $geodir_home_map_untick)) {
234
+						$checked = '';
235
+					}
236
+				}
237 237
 
238
-                $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
239
-                $term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
240
-                $term_check .= '  title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
241
-                $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>';
242
-                $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
238
+				$term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
239
+				$term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
240
+				$term_check .= '  title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
241
+				$term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>';
242
+				$out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
243 243
 
244
-            endif;
244
+			endif;
245 245
 
246 246
 
247
-            // get sub category by recursion
248
-            $out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map);
247
+			// get sub category by recursion
248
+			$out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map);
249 249
 
250
-            $out .= '</li>';
250
+			$out .= '</li>';
251 251
 
252
-        endforeach;
252
+		endforeach;
253 253
 
254
-        $out .= '</ul>';
254
+		$out .= '</ul>';
255 255
 
256
-        return $out;
257
-    } else {
258
-        if ($cat_parent == 0)
259
-            return _e('No category', 'geodirectory');
260
-    }
261
-    return;
256
+		return $out;
257
+	} else {
258
+		if ($cat_parent == 0)
259
+			return _e('No category', 'geodirectory');
260
+	}
261
+	return;
262 262
 }
263 263
 
264 264
 /**
@@ -270,19 +270,19 @@  discard block
 block discarded – undo
270 270
  * @return string The map API provider name.
271 271
  */
272 272
 function geodir_map_name() {
273
-    $geodir_map_name = get_option('geodir_load_map', 'google');
273
+	$geodir_map_name = get_option('geodir_load_map', 'google');
274 274
     
275
-    if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
276
-        $geodir_map_name = 'auto';
277
-    }
278
-
279
-    /**
280
-     * Filter the map JS API provider name.
281
-     *
282
-     * @since 1.6.1
283
-     * @param string $geodir_map_name The map API provider name.
284
-     */
285
-    return apply_filters('geodir_map_name', $geodir_map_name);
275
+	if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
276
+		$geodir_map_name = 'auto';
277
+	}
278
+
279
+	/**
280
+	 * Filter the map JS API provider name.
281
+	 *
282
+	 * @since 1.6.1
283
+	 * @param string $geodir_map_name The map API provider name.
284
+	 */
285
+	return apply_filters('geodir_map_name', $geodir_map_name);
286 286
 }
287 287
 
288 288
 /**
@@ -298,48 +298,48 @@  discard block
 block discarded – undo
298 298
  * @return array The icon size.
299 299
  */
300 300
 function geodir_get_marker_size($icon, $default_size = array('w' => 36, 'h' => 45)) {
301
-    global $gd_marker_sizes;
301
+	global $gd_marker_sizes;
302 302
     
303
-    if (empty($gd_marker_sizes)) {
304
-        $gd_marker_sizes = array();
305
-    }
303
+	if (empty($gd_marker_sizes)) {
304
+		$gd_marker_sizes = array();
305
+	}
306 306
       
307
-    if (!empty($gd_marker_sizes[$icon])) {
308
-        return $gd_marker_sizes[$icon];
309
-    }
307
+	if (!empty($gd_marker_sizes[$icon])) {
308
+		return $gd_marker_sizes[$icon];
309
+	}
310 310
     
311
-    if (empty($icon)) {
312
-        $gd_marker_sizes[$icon] = $default_size;
311
+	if (empty($icon)) {
312
+		$gd_marker_sizes[$icon] = $default_size;
313 313
         
314
-        return $default_size;
315
-    }
314
+		return $default_size;
315
+	}
316 316
     
317
-    $icon_url = $icon;
317
+	$icon_url = $icon;
318 318
     
319
-    $uploads = wp_upload_dir(); // Array of key => value pairs
319
+	$uploads = wp_upload_dir(); // Array of key => value pairs
320 320
       
321
-    if (!path_is_absolute($icon)) {
322
-        $icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon);
323
-    }
321
+	if (!path_is_absolute($icon)) {
322
+		$icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon);
323
+	}
324 324
     
325
-    if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
326
-        $icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon);
327
-    }
325
+	if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
326
+		$icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon);
327
+	}
328 328
     
329
-    $sizes = array();
330
-    if (is_file($icon) && file_exists($icon)) {
331
-        $size = getimagesize(trim($icon));
329
+	$sizes = array();
330
+	if (is_file($icon) && file_exists($icon)) {
331
+		$size = getimagesize(trim($icon));
332 332
         
333
-        if (!empty($size[0]) && !empty($size[1])) {
334
-            $sizes = array('w' => $size[0], 'h' => $size[1]);
335
-        }
336
-    }
333
+		if (!empty($size[0]) && !empty($size[1])) {
334
+			$sizes = array('w' => $size[0], 'h' => $size[1]);
335
+		}
336
+	}
337 337
     
338
-    $sizes = !empty($sizes) ? $sizes : $default_size;
338
+	$sizes = !empty($sizes) ? $sizes : $default_size;
339 339
     
340
-    $gd_marker_sizes[$icon_url] = $sizes;
340
+	$gd_marker_sizes[$icon_url] = $sizes;
341 341
     
342
-    return $sizes;
342
+	return $sizes;
343 343
 }
344 344
 
345 345
 add_action('wp_head', 'geodir_map_load_style', 10);
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
  * @package GeoDirectory
352 352
  */
353 353
 function geodir_map_load_style() {    
354
-    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
354
+	if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
355 355
 ?>
356 356
 <script type="text/javascript">
357 357
 if (!(window.google && typeof google.maps !== 'undefined')) {
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 }
360 360
 </script>
361 361
 <?php
362
-    }
362
+	}
363 363
 }
364 364
 
365 365
 add_action('wp_footer', 'geodir_map_load_script', 10);
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
  * @package GeoDirectory
372 372
  */
373 373
 function geodir_map_load_script() {
374
-    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
374
+	if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
375 375
 ?>
376 376
 <script type="text/javascript">
377 377
 if (!(window.google && typeof google.maps !== 'undefined')) {
@@ -380,5 +380,5 @@  discard block
 block discarded – undo
380 380
 }
381 381
 </script>
382 382
 <?php
383
-    }
383
+	}
384 384
 }
385 385
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_functions.php 1 patch
Indentation   +1977 added lines, -1977 removed lines patch added patch discarded remove patch
@@ -10,52 +10,52 @@  discard block
 block discarded – undo
10 10
 global $wpdb, $table_prefix;
11 11
 
12 12
 if (!function_exists('geodir_column_exist')) {
13
-    /**
14
-     * Check table column exist or not.
15
-     *
16
-     * @since 1.0.0
17
-     * @package GeoDirectory
18
-     * @global object $wpdb WordPress Database object.
19
-     * @param string $db The table name.
20
-     * @param string $column The column name.
21
-     * @return bool If column exists returns true. Otherwise false.
22
-     */
23
-    function geodir_column_exist($db, $column)
24
-    {
25
-        global $wpdb;
26
-        $exists = false;
27
-        $columns = $wpdb->get_col("show columns from $db");
28
-        foreach ($columns as $c) {
29
-            if ($c == $column) {
30
-                $exists = true;
31
-                break;
32
-            }
33
-        }
34
-        return $exists;
35
-    }
13
+	/**
14
+	 * Check table column exist or not.
15
+	 *
16
+	 * @since 1.0.0
17
+	 * @package GeoDirectory
18
+	 * @global object $wpdb WordPress Database object.
19
+	 * @param string $db The table name.
20
+	 * @param string $column The column name.
21
+	 * @return bool If column exists returns true. Otherwise false.
22
+	 */
23
+	function geodir_column_exist($db, $column)
24
+	{
25
+		global $wpdb;
26
+		$exists = false;
27
+		$columns = $wpdb->get_col("show columns from $db");
28
+		foreach ($columns as $c) {
29
+			if ($c == $column) {
30
+				$exists = true;
31
+				break;
32
+			}
33
+		}
34
+		return $exists;
35
+	}
36 36
 }
37 37
 
38 38
 if (!function_exists('geodir_add_column_if_not_exist')) {
39
-    /**
40
-     * Add column if table column not exist.
41
-     *
42
-     * @since 1.0.0
43
-     * @package GeoDirectory
44
-     * @global object $wpdb WordPress Database object.
45
-     * @param string $db The table name.
46
-     * @param string $column The column name.
47
-     * @param string $column_attr The column attributes.
48
-     */
49
-    function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50
-    {
51
-        global $wpdb;
52
-        $result = 0;// no rows affected
53
-        if (!geodir_column_exist($db, $column)) {
54
-            if (!empty($db) && !empty($column))
55
-                $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
-        }
57
-        return $result;
58
-    }
39
+	/**
40
+	 * Add column if table column not exist.
41
+	 *
42
+	 * @since 1.0.0
43
+	 * @package GeoDirectory
44
+	 * @global object $wpdb WordPress Database object.
45
+	 * @param string $db The table name.
46
+	 * @param string $column The column name.
47
+	 * @param string $column_attr The column attributes.
48
+	 */
49
+	function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50
+	{
51
+		global $wpdb;
52
+		$result = 0;// no rows affected
53
+		if (!geodir_column_exist($db, $column)) {
54
+			if (!empty($db) && !empty($column))
55
+				$result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
+		}
57
+		return $result;
58
+	}
59 59
 }
60 60
 
61 61
 /**
@@ -72,705 +72,705 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function geodir_post_custom_fields($package_id = '', $default = 'all', $post_type = 'gd_place', $fields_location = 'none')
74 74
 {
75
-    global $wpdb, $geodir_post_custom_fields_cache;
76
-
77
-    $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;
78
-
79
-    if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
80
-        return $geodir_post_custom_fields_cache[$cache_stored];
81
-    }
82
-
83
-    $default_query = '';
84
-
85
-    if ($default == 'default')
86
-        $default_query .= " and is_admin IN ('1') ";
87
-    elseif ($default == 'custom')
88
-        $default_query .= " and is_admin = '0' ";
89
-
90
-    if ($fields_location == 'none') {
91
-    } else{
92
-        $fields_location = esc_sql( $fields_location );
93
-        $default_query .= " and show_in LIKE '%%[$fields_location]%%' ";
94
-    }
95
-
96
-    $post_meta_info = $wpdb->get_results(
97
-        $wpdb->prepare(
98
-            "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
99
-            array($post_type)
100
-        )
101
-    );
102
-
103
-
104
-    $return_arr = array();
105
-    if ($post_meta_info) {
106
-
107
-        foreach ($post_meta_info as $post_meta_info_obj) {
108
-
109
-            $custom_fields = array(
110
-                "name" => $post_meta_info_obj->htmlvar_name,
111
-                "label" => $post_meta_info_obj->clabels,
112
-                "default" => $post_meta_info_obj->default_value,
113
-                "type" => $post_meta_info_obj->field_type,
114
-                "desc" => $post_meta_info_obj->admin_desc);
115
-
116
-            if ($post_meta_info_obj->field_type) {
117
-                $options = explode(',', $post_meta_info_obj->option_values);
118
-                $custom_fields["options"] = $options;
119
-            }
120
-
121
-            foreach ($post_meta_info_obj as $key => $val) {
122
-                $custom_fields[$key] = $val;
123
-            }
124
-
125
-            $pricearr = array();
126
-            $pricearr = explode(',', $post_meta_info_obj->packages);
127
-
128
-            if ($package_id != '' && in_array($package_id, $pricearr)) {
129
-                $return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
130
-            } elseif ($package_id == '') {
131
-                $return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
132
-            }
133
-        }
134
-    }
135
-    $geodir_post_custom_fields_cache[$cache_stored] = $return_arr;
136
-
137
-    if (has_filter('geodir_filter_geodir_post_custom_fields')) {
138
-        /**
139
-         * Filter the post custom fields array.
140
-         *
141
-         * @since 1.0.0
142
-         *
143
-         * @param array $return_arr Post custom fields array.
144
-         * @param int|string $package_id The package ID.
145
-         * @param string $post_type Optional. The wordpress post type.
146
-         * @param string $fields_location Optional. Where exactly are you going to place this custom fields?.
147
-         */
148
-        $return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
149
-    }
150
-
151
-    return $return_arr;
75
+	global $wpdb, $geodir_post_custom_fields_cache;
76
+
77
+	$cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;
78
+
79
+	if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
80
+		return $geodir_post_custom_fields_cache[$cache_stored];
81
+	}
82
+
83
+	$default_query = '';
84
+
85
+	if ($default == 'default')
86
+		$default_query .= " and is_admin IN ('1') ";
87
+	elseif ($default == 'custom')
88
+		$default_query .= " and is_admin = '0' ";
89
+
90
+	if ($fields_location == 'none') {
91
+	} else{
92
+		$fields_location = esc_sql( $fields_location );
93
+		$default_query .= " and show_in LIKE '%%[$fields_location]%%' ";
94
+	}
95
+
96
+	$post_meta_info = $wpdb->get_results(
97
+		$wpdb->prepare(
98
+			"select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
99
+			array($post_type)
100
+		)
101
+	);
102
+
103
+
104
+	$return_arr = array();
105
+	if ($post_meta_info) {
106
+
107
+		foreach ($post_meta_info as $post_meta_info_obj) {
108
+
109
+			$custom_fields = array(
110
+				"name" => $post_meta_info_obj->htmlvar_name,
111
+				"label" => $post_meta_info_obj->clabels,
112
+				"default" => $post_meta_info_obj->default_value,
113
+				"type" => $post_meta_info_obj->field_type,
114
+				"desc" => $post_meta_info_obj->admin_desc);
115
+
116
+			if ($post_meta_info_obj->field_type) {
117
+				$options = explode(',', $post_meta_info_obj->option_values);
118
+				$custom_fields["options"] = $options;
119
+			}
120
+
121
+			foreach ($post_meta_info_obj as $key => $val) {
122
+				$custom_fields[$key] = $val;
123
+			}
124
+
125
+			$pricearr = array();
126
+			$pricearr = explode(',', $post_meta_info_obj->packages);
127
+
128
+			if ($package_id != '' && in_array($package_id, $pricearr)) {
129
+				$return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
130
+			} elseif ($package_id == '') {
131
+				$return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
132
+			}
133
+		}
134
+	}
135
+	$geodir_post_custom_fields_cache[$cache_stored] = $return_arr;
136
+
137
+	if (has_filter('geodir_filter_geodir_post_custom_fields')) {
138
+		/**
139
+		 * Filter the post custom fields array.
140
+		 *
141
+		 * @since 1.0.0
142
+		 *
143
+		 * @param array $return_arr Post custom fields array.
144
+		 * @param int|string $package_id The package ID.
145
+		 * @param string $post_type Optional. The wordpress post type.
146
+		 * @param string $fields_location Optional. Where exactly are you going to place this custom fields?.
147
+		 */
148
+		$return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
149
+	}
150
+
151
+	return $return_arr;
152 152
 }
153 153
 
154
-    /**
155
-     * Adds admin html for custom fields.
156
-     *
157
-     * @since 1.0.0
158
-     * @package GeoDirectory
159
-     * @global object $wpdb WordPress Database object.
160
-     * @param string $field_type The form field type.
161
-     * @param object|int $result_str The custom field results object or row id.
162
-     * @param string $field_ins_upd When set to "submit" displays form.
163
-     * @param string $field_type_key The key of the custom field.
164
-     */
165
-    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='')
166
-    {
167
-        global $wpdb;
168
-        $cf = $result_str;
169
-        if (!is_object($cf)) {
170
-
171
-            $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
172
-
173
-        } else {
174
-            $field_info = $cf;
175
-            $result_str = $cf->id;
176
-        }
177
-        /**
178
-         * Contains custom field html.
179
-         *
180
-         * @since 1.0.0
181
-         */
182
-        include('custom_field_html.php');
183
-
184
-    }
154
+	/**
155
+	 * Adds admin html for custom fields.
156
+	 *
157
+	 * @since 1.0.0
158
+	 * @package GeoDirectory
159
+	 * @global object $wpdb WordPress Database object.
160
+	 * @param string $field_type The form field type.
161
+	 * @param object|int $result_str The custom field results object or row id.
162
+	 * @param string $field_ins_upd When set to "submit" displays form.
163
+	 * @param string $field_type_key The key of the custom field.
164
+	 */
165
+	function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='')
166
+	{
167
+		global $wpdb;
168
+		$cf = $result_str;
169
+		if (!is_object($cf)) {
170
+
171
+			$field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
172
+
173
+		} else {
174
+			$field_info = $cf;
175
+			$result_str = $cf->id;
176
+		}
177
+		/**
178
+		 * Contains custom field html.
179
+		 *
180
+		 * @since 1.0.0
181
+		 */
182
+		include('custom_field_html.php');
183
+
184
+	}
185 185
 
186 186
 
187 187
 if (!function_exists('geodir_custom_field_delete')) {
188
-    /**
189
-     * Delete custom field using field id.
190
-     *
191
-     * @since 1.0.0
192
-     * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
193
-     * @package GeoDirectory
194
-     * @global object $wpdb WordPress Database object.
195
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
196
-     * @param string $field_id The custom field ID.
197
-     * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
198
-     */
199
-    function geodir_custom_field_delete($field_id = '') {
200
-        global $wpdb, $plugin_prefix;
201
-
202
-        if ($field_id != '') {
203
-            $cf = trim($field_id, '_');
204
-
205
-            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
206
-                $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
207
-
208
-                $post_type = $field->post_type;
209
-                $htmlvar_name = $field->htmlvar_name;
210
-
211
-                if ($post_type != '' && $htmlvar_name != '') {
212
-                    $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
213
-                }
214
-
215
-                /**
216
-                 * Called after a custom field is deleted.
217
-                 *
218
-                 * @since 1.0.0
219
-                 * @param string $cf The fields ID.
220
-                 * @param string $field->htmlvar_name The html variable name for the field.
221
-                 * @param string $post_type The post type the field belongs to.
222
-                 */
223
-                do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
224
-
225
-                if ($field->field_type == 'address') {
226
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
227
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
228
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
229
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
230
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
231
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
232
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
233
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
234
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
235
-                } else {
236
-                    if ($field->field_type != 'fieldset') {
237
-                        $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
238
-                    }
239
-                }
240
-
241
-                return $field_id;
242
-            } else
243
-                return 0;
244
-        } else
245
-            return 0;
246
-    }
188
+	/**
189
+	 * Delete custom field using field id.
190
+	 *
191
+	 * @since 1.0.0
192
+	 * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
193
+	 * @package GeoDirectory
194
+	 * @global object $wpdb WordPress Database object.
195
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
196
+	 * @param string $field_id The custom field ID.
197
+	 * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
198
+	 */
199
+	function geodir_custom_field_delete($field_id = '') {
200
+		global $wpdb, $plugin_prefix;
201
+
202
+		if ($field_id != '') {
203
+			$cf = trim($field_id, '_');
204
+
205
+			if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
206
+				$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
207
+
208
+				$post_type = $field->post_type;
209
+				$htmlvar_name = $field->htmlvar_name;
210
+
211
+				if ($post_type != '' && $htmlvar_name != '') {
212
+					$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
213
+				}
214
+
215
+				/**
216
+				 * Called after a custom field is deleted.
217
+				 *
218
+				 * @since 1.0.0
219
+				 * @param string $cf The fields ID.
220
+				 * @param string $field->htmlvar_name The html variable name for the field.
221
+				 * @param string $post_type The post type the field belongs to.
222
+				 */
223
+				do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
224
+
225
+				if ($field->field_type == 'address') {
226
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
227
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
228
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
229
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
230
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
231
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
232
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
233
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
234
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
235
+				} else {
236
+					if ($field->field_type != 'fieldset') {
237
+						$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
238
+					}
239
+				}
240
+
241
+				return $field_id;
242
+			} else
243
+				return 0;
244
+		} else
245
+			return 0;
246
+	}
247 247
 }
248 248
 
249 249
 if (!function_exists('geodir_custom_field_save')) {
250
-    /**
251
-     * Save or Update custom fields into the database.
252
-     *
253
-     * @since 1.0.0
254
-     * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
255
-     * @package GeoDirectory
256
-     * @global object $wpdb WordPress Database object.
257
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
258
-     * @param array $request_field {
259
-     *    Attributes of the request field array.
260
-     *
261
-     *    @type string $action Ajax Action name. Default "geodir_ajax_action".
262
-     *    @type string $manage_field_type Field type Default "custom_fields".
263
-     *    @type string $create_field Create field Default "true".
264
-     *    @type string $field_ins_upd Field ins upd Default "submit".
265
-     *    @type string $_wpnonce WP nonce value.
266
-     *    @type string $listing_type Listing type Example "gd_place".
267
-     *    @type string $field_type Field type Example "radio".
268
-     *    @type string $field_id Field id Example "12".
269
-     *    @type string $data_type Data type Example "VARCHAR".
270
-     *    @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.
271
-     *    @type array $show_on_pkg Package list to display this field.
272
-     *    @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.
273
-     *    @type string $site_title Section title which you wish to display in frontend.
274
-     *    @type string $admin_desc Section description which will appear in frontend.
275
-     *    @type string $htmlvar_name Html variable name. This should be a unique name.
276
-     *    @type string $clabels Section Title which will appear in backend.
277
-     *    @type string $default_value The default value (for "link" this will be used as the link text).
278
-     *    @type string $sort_order The display order of this field in backend. e.g. 5.
279
-     *    @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field.
280
-     *    @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.
281
-     *    @type string $is_required Use "1" to set field as required.
282
-     *    @type string $required_msg Enter text for error message if field required and have not full fill requirment.
283
-     *    @type string $show_on_listing Want to show this on listing page?.
284
-     *    @type string $show_in What locations to show the custom field in.
285
-     *    @type string $show_on_detail Want to show this in More Info tab on detail page?.
286
-     *    @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes.
287
-     *    @type string $option_values Option Values should be separated by comma.
288
-     *    @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class.
289
-     *    @type string $css_class Enter custom css class for field custom style.
290
-     *
291
-     * }
292
-     * @param bool $default Not yet implemented.
293
-     * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
294
-     */
295
-    function geodir_custom_field_save($request_field = array(), $default = false)
296
-    {
297
-
298
-        global $wpdb, $plugin_prefix;
299
-
300
-        $old_html_variable = '';
301
-
302
-        $data_type = trim($request_field['data_type']);
303
-
304
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
305
-
306
-        // some servers fail if a POST value is VARCHAR so we change it.
307
-        if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
308
-            $request_field['data_type'] = 'VARCHAR';
309
-        }
310
-
311
-        $cf = trim($result_str, '_');
312
-
313
-
314
-        /*-------- check dublicate validation --------*/
315
-
316
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
317
-        $post_type = $request_field['listing_type'];
318
-
319
-        if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
320
-            $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
321
-        }
322
-
323
-        $check_html_variable = $wpdb->get_var(
324
-            $wpdb->prepare(
325
-                "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
326
-                array($cf, $cehhtmlvar_name, $post_type)
327
-            )
328
-        );
329
-
330
-
331
-        if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
332
-
333
-            if ($cf != '') {
334
-
335
-                $post_meta_info = $wpdb->get_row(
336
-                    $wpdb->prepare(
337
-                        "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
338
-                        array($cf)
339
-                    )
340
-                );
341
-
342
-            }
343
-
344
-            if (!empty($post_meta_info)) {
345
-                $post_val = $post_meta_info;
346
-                $old_html_variable = $post_val->htmlvar_name;
347
-
348
-            }
349
-
350
-
351
-
352
-            if ($post_type == '') $post_type = 'gd_place';
353
-
354
-
355
-            $detail_table = $plugin_prefix . $post_type . '_detail';
356
-
357
-            $admin_title = $request_field['admin_title'];
358
-            $site_title = $request_field['site_title'];
359
-            $data_type = $request_field['data_type'];
360
-            $field_type = $request_field['field_type'];
361
-            $field_type_key = $request_field['field_type_key'];
362
-            $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
363
-            $admin_desc = $request_field['admin_desc'];
364
-            $clabels = $request_field['clabels'];
365
-            $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
366
-            $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
367
-            $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
368
-            $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
369
-            $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
370
-            $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
371
-            $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
372
-            $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
373
-            $show_in = isset($request_field['show_in']) ? $request_field['show_in'] : '';
374
-            $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
375
-            $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
376
-            $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
377
-            $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
378
-            $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
379
-            $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
380
-            $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
250
+	/**
251
+	 * Save or Update custom fields into the database.
252
+	 *
253
+	 * @since 1.0.0
254
+	 * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
255
+	 * @package GeoDirectory
256
+	 * @global object $wpdb WordPress Database object.
257
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
258
+	 * @param array $request_field {
259
+	 *    Attributes of the request field array.
260
+	 *
261
+	 *    @type string $action Ajax Action name. Default "geodir_ajax_action".
262
+	 *    @type string $manage_field_type Field type Default "custom_fields".
263
+	 *    @type string $create_field Create field Default "true".
264
+	 *    @type string $field_ins_upd Field ins upd Default "submit".
265
+	 *    @type string $_wpnonce WP nonce value.
266
+	 *    @type string $listing_type Listing type Example "gd_place".
267
+	 *    @type string $field_type Field type Example "radio".
268
+	 *    @type string $field_id Field id Example "12".
269
+	 *    @type string $data_type Data type Example "VARCHAR".
270
+	 *    @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.
271
+	 *    @type array $show_on_pkg Package list to display this field.
272
+	 *    @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.
273
+	 *    @type string $site_title Section title which you wish to display in frontend.
274
+	 *    @type string $admin_desc Section description which will appear in frontend.
275
+	 *    @type string $htmlvar_name Html variable name. This should be a unique name.
276
+	 *    @type string $clabels Section Title which will appear in backend.
277
+	 *    @type string $default_value The default value (for "link" this will be used as the link text).
278
+	 *    @type string $sort_order The display order of this field in backend. e.g. 5.
279
+	 *    @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field.
280
+	 *    @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.
281
+	 *    @type string $is_required Use "1" to set field as required.
282
+	 *    @type string $required_msg Enter text for error message if field required and have not full fill requirment.
283
+	 *    @type string $show_on_listing Want to show this on listing page?.
284
+	 *    @type string $show_in What locations to show the custom field in.
285
+	 *    @type string $show_on_detail Want to show this in More Info tab on detail page?.
286
+	 *    @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes.
287
+	 *    @type string $option_values Option Values should be separated by comma.
288
+	 *    @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class.
289
+	 *    @type string $css_class Enter custom css class for field custom style.
290
+	 *
291
+	 * }
292
+	 * @param bool $default Not yet implemented.
293
+	 * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
294
+	 */
295
+	function geodir_custom_field_save($request_field = array(), $default = false)
296
+	{
297
+
298
+		global $wpdb, $plugin_prefix;
299
+
300
+		$old_html_variable = '';
301
+
302
+		$data_type = trim($request_field['data_type']);
303
+
304
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
305
+
306
+		// some servers fail if a POST value is VARCHAR so we change it.
307
+		if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
308
+			$request_field['data_type'] = 'VARCHAR';
309
+		}
310
+
311
+		$cf = trim($result_str, '_');
312
+
313
+
314
+		/*-------- check dublicate validation --------*/
315
+
316
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
317
+		$post_type = $request_field['listing_type'];
318
+
319
+		if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
320
+			$cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
321
+		}
322
+
323
+		$check_html_variable = $wpdb->get_var(
324
+			$wpdb->prepare(
325
+				"select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
326
+				array($cf, $cehhtmlvar_name, $post_type)
327
+			)
328
+		);
329
+
330
+
331
+		if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
332
+
333
+			if ($cf != '') {
334
+
335
+				$post_meta_info = $wpdb->get_row(
336
+					$wpdb->prepare(
337
+						"select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
338
+						array($cf)
339
+					)
340
+				);
341
+
342
+			}
343
+
344
+			if (!empty($post_meta_info)) {
345
+				$post_val = $post_meta_info;
346
+				$old_html_variable = $post_val->htmlvar_name;
347
+
348
+			}
349
+
350
+
351
+
352
+			if ($post_type == '') $post_type = 'gd_place';
353
+
354
+
355
+			$detail_table = $plugin_prefix . $post_type . '_detail';
356
+
357
+			$admin_title = $request_field['admin_title'];
358
+			$site_title = $request_field['site_title'];
359
+			$data_type = $request_field['data_type'];
360
+			$field_type = $request_field['field_type'];
361
+			$field_type_key = $request_field['field_type_key'];
362
+			$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
363
+			$admin_desc = $request_field['admin_desc'];
364
+			$clabels = $request_field['clabels'];
365
+			$default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
366
+			$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
367
+			$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
368
+			$is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
369
+			$required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
370
+			$css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
371
+			$field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
372
+			$show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
373
+			$show_in = isset($request_field['show_in']) ? $request_field['show_in'] : '';
374
+			$show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
375
+			$show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
376
+			$decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
377
+			$decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
378
+			$validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
379
+			$validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
380
+			$for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
381 381
 
382 382
             
383
-            if(is_array($show_in)){
384
-                $show_in = implode(",", $request_field['show_in']);
385
-            }
383
+			if(is_array($show_in)){
384
+				$show_in = implode(",", $request_field['show_in']);
385
+			}
386 386
             
387
-            if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
388
-                $htmlvar_name = 'geodir_' . $htmlvar_name;
389
-            }
387
+			if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
388
+				$htmlvar_name = 'geodir_' . $htmlvar_name;
389
+			}
390 390
 
391
-            $option_values = '';
392
-            if (isset($request_field['option_values']))
393
-                $option_values = $request_field['option_values'];
391
+			$option_values = '';
392
+			if (isset($request_field['option_values']))
393
+				$option_values = $request_field['option_values'];
394 394
 
395
-            $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
395
+			$cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
396 396
 
397
-            $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
397
+			$cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
398 398
 
399
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
400
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
401
-            else {
402
-                $package_info = array();
399
+			if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
400
+				$price_pkg = implode(",", $request_field['show_on_pkg']);
401
+			else {
402
+				$package_info = array();
403 403
 
404
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
405
-                $price_pkg = $package_info->pid;
406
-            }
404
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
405
+				$price_pkg = $package_info->pid;
406
+			}
407 407
 
408 408
 
409
-            if (isset($request_field['extra']) && !empty($request_field['extra']))
410
-                $extra_fields = $request_field['extra'];
409
+			if (isset($request_field['extra']) && !empty($request_field['extra']))
410
+				$extra_fields = $request_field['extra'];
411 411
 
412
-            if (isset($request_field['is_default']) && $request_field['is_default'] != '')
413
-                $is_default = $request_field['is_default'];
414
-            else
415
-                $is_default = '0';
412
+			if (isset($request_field['is_default']) && $request_field['is_default'] != '')
413
+				$is_default = $request_field['is_default'];
414
+			else
415
+				$is_default = '0';
416 416
 
417
-            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
418
-                $is_admin = $request_field['is_admin'];
419
-            else
420
-                $is_admin = '0';
417
+			if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
418
+				$is_admin = $request_field['is_admin'];
419
+			else
420
+				$is_admin = '0';
421 421
 
422 422
 
423
-            if ($is_active == '') $is_active = 1;
424
-            if ($is_required == '') $is_required = 0;
423
+			if ($is_active == '') $is_active = 1;
424
+			if ($is_required == '') $is_required = 0;
425 425
 
426 426
 
427
-            if ($sort_order == '') {
427
+			if ($sort_order == '') {
428 428
 
429
-                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
429
+				$last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
430 430
 
431
-                $sort_order = (int)$last_order + 1;
432
-            }
431
+				$sort_order = (int)$last_order + 1;
432
+			}
433 433
 
434
-            $default_value_add = '';
434
+			$default_value_add = '';
435 435
 
436 436
 
437
-            if (!empty($post_meta_info)) {
438
-                switch ($field_type):
437
+			if (!empty($post_meta_info)) {
438
+				switch ($field_type):
439 439
 
440
-                    case 'address':
440
+					case 'address':
441 441
 
442
-                        if ($htmlvar_name != '') {
443
-                            $prefix = $htmlvar_name . '_';
444
-                        }
445
-                        $old_prefix = $old_html_variable . '_';
442
+						if ($htmlvar_name != '') {
443
+							$prefix = $htmlvar_name . '_';
444
+						}
445
+						$old_prefix = $old_html_variable . '_';
446 446
 
447 447
 
448
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
448
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
449 449
 
450
-                        if ($default_value != '') {
451
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
452
-                        }
450
+						if ($default_value != '') {
451
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
452
+						}
453 453
 
454
-                        $wpdb->query($meta_field_add);
454
+						$wpdb->query($meta_field_add);
455 455
 
456
-                        if ($extra_fields != '') {
456
+						if ($extra_fields != '') {
457 457
 
458
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
458
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
459 459
 
460
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
461
-                                if ($is_column) {
462
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
460
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
461
+								if ($is_column) {
462
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
463 463
 
464
-                                    if ($default_value != '') {
465
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
466
-                                    }
464
+									if ($default_value != '') {
465
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
466
+									}
467 467
 
468
-                                    $wpdb->query($meta_field_add);
469
-                                } else {
468
+									$wpdb->query($meta_field_add);
469
+								} else {
470 470
 
471
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
472
-                                    if ($default_value != '') {
473
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
474
-                                    }
475
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
471
+									$meta_field_add = "VARCHAR( 50 ) NULL";
472
+									if ($default_value != '') {
473
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
474
+									}
475
+									geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
476 476
 
477
-                                }
477
+								}
478 478
 
479 479
 
480
-                            }
480
+							}
481 481
 
482 482
 
483
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
483
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
484 484
 
485
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
485
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
486 486
 
487
-                                if ($is_column) {
488
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
487
+								if ($is_column) {
488
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
489 489
 
490
-                                    if ($default_value != '') {
491
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
492
-                                    }
490
+									if ($default_value != '') {
491
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
492
+									}
493 493
 
494
-                                    $wpdb->query($meta_field_add);
495
-                                } else {
496
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
497
-                                    if ($default_value != '') {
498
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
499
-                                    }
494
+									$wpdb->query($meta_field_add);
495
+								} else {
496
+									$meta_field_add = "VARCHAR( 50 ) NULL";
497
+									if ($default_value != '') {
498
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
499
+									}
500 500
 
501
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
502
-                                }
501
+									geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
502
+								}
503 503
 
504
-                            }
505
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
504
+							}
505
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
506 506
 
507
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
507
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
508 508
 
509
-                                if ($is_column) {
509
+								if ($is_column) {
510 510
 
511
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
511
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
512 512
 
513
-                                    if ($default_value != '') {
514
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
515
-                                    }
513
+									if ($default_value != '') {
514
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
515
+									}
516 516
 
517
-                                    $wpdb->query($meta_field_add);
518
-                                } else {
517
+									$wpdb->query($meta_field_add);
518
+								} else {
519 519
 
520
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
521
-                                    if ($default_value != '') {
522
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
523
-                                    }
520
+									$meta_field_add = "VARCHAR( 50 ) NULL";
521
+									if ($default_value != '') {
522
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
523
+									}
524 524
 
525
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
525
+									geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
526 526
 
527
-                                }
527
+								}
528 528
 
529
-                            }
530
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
529
+							}
530
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
531 531
 
532
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
532
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
533 533
 
534
-                                if ($is_column) {
534
+								if ($is_column) {
535 535
 
536
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
536
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
537 537
 
538
-                                    if ($default_value != '') {
539
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
540
-                                    }
538
+									if ($default_value != '') {
539
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
540
+									}
541 541
 
542
-                                    $wpdb->query($meta_field_add);
543
-                                } else {
542
+									$wpdb->query($meta_field_add);
543
+								} else {
544 544
 
545
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
546
-                                    if ($default_value != '') {
547
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
548
-                                    }
545
+									$meta_field_add = "VARCHAR( 50 ) NULL";
546
+									if ($default_value != '') {
547
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
548
+									}
549 549
 
550
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
550
+									geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
551 551
 
552
-                                }
552
+								}
553 553
 
554
-                            }
555
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
554
+							}
555
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
556 556
 
557
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
558
-                                if ($is_column) {
557
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
558
+								if ($is_column) {
559 559
 
560
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
560
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
561 561
 
562
-                                    if ($default_value != '') {
563
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
564
-                                    }
562
+									if ($default_value != '') {
563
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
564
+									}
565 565
 
566
-                                    $wpdb->query($meta_field_add);
567
-                                } else {
566
+									$wpdb->query($meta_field_add);
567
+								} else {
568 568
 
569
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
570
-                                    $meta_field_add = "VARCHAR( 20 ) NULL";
571
-                                    if ($default_value != '') {
572
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
573
-                                    }
569
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
570
+									$meta_field_add = "VARCHAR( 20 ) NULL";
571
+									if ($default_value != '') {
572
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
573
+									}
574 574
 
575
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
575
+									geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
576 576
 
577
-                                }
577
+								}
578 578
 
579 579
 
580
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
580
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
581 581
 
582
-                                if ($is_column) {
583
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
582
+								if ($is_column) {
583
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
584 584
 
585
-                                    if ($default_value != '') {
586
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
587
-                                    }
585
+									if ($default_value != '') {
586
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
587
+									}
588 588
 
589
-                                    $wpdb->query($meta_field_add);
590
-                                } else {
589
+									$wpdb->query($meta_field_add);
590
+								} else {
591 591
 
592
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
593
-                                    $meta_field_add = "VARCHAR( 20 ) NULL";
594
-                                    if ($default_value != '') {
595
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
596
-                                    }
592
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
593
+									$meta_field_add = "VARCHAR( 20 ) NULL";
594
+									if ($default_value != '') {
595
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
596
+									}
597 597
 
598
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
599
-                                }
598
+									geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
599
+								}
600 600
 
601
-                            }
602
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
601
+							}
602
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
603 603
 
604
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
604
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
605 605
 
606
-                                if ($is_column) {
607
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
606
+								if ($is_column) {
607
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
608 608
 
609
-                                    if ($default_value != '') {
610
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
611
-                                    }
609
+									if ($default_value != '') {
610
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
611
+									}
612 612
 
613
-                                    $wpdb->query($meta_field_add);
614
-                                } else {
613
+									$wpdb->query($meta_field_add);
614
+								} else {
615 615
 
616
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
616
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
617 617
 
618
-                                    $meta_field_add = "VARCHAR( 15 ) NULL";
619
-                                    if ($default_value != '') {
620
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
621
-                                    }
618
+									$meta_field_add = "VARCHAR( 15 ) NULL";
619
+									if ($default_value != '') {
620
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
621
+									}
622 622
 
623
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
624
-                                }
623
+									geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
624
+								}
625 625
 
626 626
 
627
-                            }
628
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
627
+							}
628
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
629 629
 
630
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
631
-                                if ($is_column) {
632
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
630
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
631
+								if ($is_column) {
632
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
633 633
 
634
-                                    if ($default_value != '') {
635
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
636
-                                    }
634
+									if ($default_value != '') {
635
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
636
+									}
637 637
 
638
-                                    $wpdb->query($meta_field_add);
638
+									$wpdb->query($meta_field_add);
639 639
 
640
-                                } else {
640
+								} else {
641 641
 
642
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
642
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
643 643
 
644
-                                    $meta_field_add = "VARCHAR( 3 ) NULL";
645
-                                    if ($default_value != '') {
646
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
647
-                                    }
644
+									$meta_field_add = "VARCHAR( 3 ) NULL";
645
+									if ($default_value != '') {
646
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
647
+									}
648 648
 
649
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
650
-                                }
649
+									geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
650
+								}
651 651
 
652
-                            }
653
-                            // show lat lng
654
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
655
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
652
+							}
653
+							// show lat lng
654
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
655
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
656 656
 
657
-                                if ($is_column) {
658
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
659
-                                    $meta_field_add .= " DEFAULT '1'";
657
+								if ($is_column) {
658
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
659
+									$meta_field_add .= " DEFAULT '1'";
660 660
 
661
-                                    $wpdb->query($meta_field_add);
662
-                                } else {
663
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
661
+									$wpdb->query($meta_field_add);
662
+								} else {
663
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
664 664
 
665
-                                    $meta_field_add = "VARCHAR( 3 ) NULL";
666
-                                    $meta_field_add .= " DEFAULT '1'";
665
+									$meta_field_add = "VARCHAR( 3 ) NULL";
666
+									$meta_field_add .= " DEFAULT '1'";
667 667
 
668
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
669
-                                }
668
+									geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
669
+								}
670 670
 
671
-                            }
672
-                        }// end extra
671
+							}
672
+						}// end extra
673 673
 
674
-                        break;
674
+						break;
675 675
 
676
-                    case 'checkbox':
677
-                    case 'multiselect':
678
-                    case 'select':
679
-                    case 'taxonomy':
676
+					case 'checkbox':
677
+					case 'multiselect':
678
+					case 'select':
679
+					case 'taxonomy':
680 680
 
681
-                        $op_size = '500';
681
+						$op_size = '500';
682 682
 
683
-                        // only make the field as big as it needs to be.
684
-                        if(isset($option_values) && $option_values && $field_type=='select'){
685
-                            $option_values_arr = explode(',',$option_values);
686
-                            if(is_array($option_values_arr)){
687
-                                $op_max = 0;
688
-                                foreach($option_values_arr as $op_val){
689
-                                    if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
690
-                                }
691
-                                if($op_max){$op_size =$op_max; }
692
-                            }
693
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694
-                            if(strlen($option_values)){
695
-                                $op_size =  strlen($option_values);
696
-                            }
697
-                        }
683
+						// only make the field as big as it needs to be.
684
+						if(isset($option_values) && $option_values && $field_type=='select'){
685
+							$option_values_arr = explode(',',$option_values);
686
+							if(is_array($option_values_arr)){
687
+								$op_max = 0;
688
+								foreach($option_values_arr as $op_val){
689
+									if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
690
+								}
691
+								if($op_max){$op_size =$op_max; }
692
+							}
693
+						}elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694
+							if(strlen($option_values)){
695
+								$op_size =  strlen($option_values);
696
+							}
697
+						}
698 698
 
699
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
699
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
700 700
 
701
-                        if ($default_value != '') {
702
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
703
-                        }
701
+						if ($default_value != '') {
702
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
703
+						}
704 704
 
705
-                        $alter_result = $wpdb->query($meta_field_add);
706
-                        if($alter_result===false){
707
-                            return __('Column change failed, you may have too many columns.','geodirectory');
708
-                        }
705
+						$alter_result = $wpdb->query($meta_field_add);
706
+						if($alter_result===false){
707
+							return __('Column change failed, you may have too many columns.','geodirectory');
708
+						}
709 709
 
710
-                        if (isset($request_field['cat_display_type']))
711
-                            $extra_fields = $request_field['cat_display_type'];
710
+						if (isset($request_field['cat_display_type']))
711
+							$extra_fields = $request_field['cat_display_type'];
712 712
 
713
-                        if (isset($request_field['multi_display_type']))
714
-                            $extra_fields = $request_field['multi_display_type'];
713
+						if (isset($request_field['multi_display_type']))
714
+							$extra_fields = $request_field['multi_display_type'];
715 715
 
716 716
 
717
-                        break;
717
+						break;
718 718
 
719
-                    case 'textarea':
720
-                    case 'html':
721
-                    case 'url':
722
-                    case 'file':
719
+					case 'textarea':
720
+					case 'html':
721
+					case 'url':
722
+					case 'file':
723 723
 
724
-                        $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
725
-                        if($alter_result===false){
726
-                            return __('Column change failed, you may have too many columns.','geodirectory');
727
-                        }
728
-                        if (isset($request_field['advanced_editor']))
729
-                            $extra_fields = $request_field['advanced_editor'];
730
-
731
-                        break;
724
+						$alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
725
+						if($alter_result===false){
726
+							return __('Column change failed, you may have too many columns.','geodirectory');
727
+						}
728
+						if (isset($request_field['advanced_editor']))
729
+							$extra_fields = $request_field['advanced_editor'];
730
+
731
+						break;
732 732
 
733
-                    case 'fieldset':
734
-                        // Nothig happend for fieldset
735
-                        break;
733
+					case 'fieldset':
734
+						// Nothig happend for fieldset
735
+						break;
736 736
 
737
-                    default:
738
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
739
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
740
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
741
-                            } else {
742
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
743
-                            }
744
-
745
-                            if (is_numeric($default_value) && $default_value != '') {
746
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
747
-                            }
748
-                        } else {
749
-                            $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
750
-                            if ($default_value != '') {
751
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
752
-                            }
753
-                        }
754
-
755
-                        $alter_result = $wpdb->query($default_value_add);
756
-                        if($alter_result===false){
757
-                            return __('Column change failed, you may have too many columns.','geodirectory');
758
-                        }
759
-                        break;
760
-                endswitch;
761
-
762
-                $extra_field_query = '';
763
-                if (!empty($extra_fields)) {
764
-                    $extra_field_query = serialize($extra_fields);
765
-                }
766
-
767
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
768
-
769
-                $wpdb->query(
770
-
771
-                    $wpdb->prepare(
772
-
773
-                        "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
737
+					default:
738
+						if ($data_type != 'VARCHAR' && $data_type != '') {
739
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
740
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
741
+							} else {
742
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
743
+							}
744
+
745
+							if (is_numeric($default_value) && $default_value != '') {
746
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
747
+							}
748
+						} else {
749
+							$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
750
+							if ($default_value != '') {
751
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
752
+							}
753
+						}
754
+
755
+						$alter_result = $wpdb->query($default_value_add);
756
+						if($alter_result===false){
757
+							return __('Column change failed, you may have too many columns.','geodirectory');
758
+						}
759
+						break;
760
+				endswitch;
761
+
762
+				$extra_field_query = '';
763
+				if (!empty($extra_fields)) {
764
+					$extra_field_query = serialize($extra_fields);
765
+				}
766
+
767
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
768
+
769
+				$wpdb->query(
770
+
771
+					$wpdb->prepare(
772
+
773
+						"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
774 774
 					post_type = %s,
775 775
 					admin_title = %s,
776 776
 					site_title = %s,
@@ -804,308 +804,308 @@  discard block
 block discarded – undo
804 804
 					for_admin_use = %s
805 805
 					where id = %d",
806 806
 
807
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
808
-                    )
807
+						array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
808
+					)
809 809
 
810
-                );
810
+				);
811 811
 
812
-                $lastid = trim($cf);
812
+				$lastid = trim($cf);
813 813
 
814 814
 
815
-                $wpdb->query(
816
-                    $wpdb->prepare(
817
-                        "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
815
+				$wpdb->query(
816
+					$wpdb->prepare(
817
+						"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
818 818
 					 	site_title=%s
819 819
 					where post_type = %s and htmlvar_name = %s",
820
-                        array($site_title, $post_type, $htmlvar_name)
821
-                    )
822
-                );
823
-
824
-
825
-                if ($cat_sort == '')
826
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
827
-
828
-
829
-                /**
830
-                 * Called after all custom fields are saved for a post.
831
-                 *
832
-                 * @since 1.0.0
833
-                 * @param int $lastid The post ID.
834
-                 */
835
-                do_action('geodir_after_custom_fields_updated', $lastid);
836
-
837
-            } else {
838
-
839
-                switch ($field_type):
840
-
841
-                    case 'address':
842
-
843
-                        $data_type = '';
844
-
845
-                        if ($htmlvar_name != '') {
846
-                            $prefix = $htmlvar_name . '_';
847
-                        }
848
-                        $old_prefix = $old_html_variable;
849
-
850
-                        //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
851
-
852
-                        $meta_field_add = "VARCHAR( 254 ) NULL";
853
-                        if ($default_value != '') {
854
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
855
-                        }
856
-
857
-                        geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
858
-                        //$wpdb->query($meta_field_add);
859
-
860
-
861
-                        if (!empty($extra_fields)) {
820
+						array($site_title, $post_type, $htmlvar_name)
821
+					)
822
+				);
823
+
824
+
825
+				if ($cat_sort == '')
826
+					$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
827
+
828
+
829
+				/**
830
+				 * Called after all custom fields are saved for a post.
831
+				 *
832
+				 * @since 1.0.0
833
+				 * @param int $lastid The post ID.
834
+				 */
835
+				do_action('geodir_after_custom_fields_updated', $lastid);
836
+
837
+			} else {
838
+
839
+				switch ($field_type):
840
+
841
+					case 'address':
842
+
843
+						$data_type = '';
844
+
845
+						if ($htmlvar_name != '') {
846
+							$prefix = $htmlvar_name . '_';
847
+						}
848
+						$old_prefix = $old_html_variable;
849
+
850
+						//$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
851
+
852
+						$meta_field_add = "VARCHAR( 254 ) NULL";
853
+						if ($default_value != '') {
854
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
855
+						}
856
+
857
+						geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
858
+						//$wpdb->query($meta_field_add);
859
+
860
+
861
+						if (!empty($extra_fields)) {
862 862
 
863
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
864
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
865
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
866
-                                if ($default_value != '') {
867
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
868
-                                }
869
-
870
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
871
-                                //$wpdb->query($meta_field_add);
872
-                            }
873
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
874
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
875
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
876
-                                if ($default_value != '') {
877
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
878
-                                }
879
-
880
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
881
-                                //$wpdb->query($meta_field_add);
882
-                            }
883
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
884
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
885
-
886
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
887
-                                if ($default_value != '') {
888
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
889
-                                }
890
-
891
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
892
-                                //$wpdb->query($meta_field_add);
893
-                            }
894
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
895
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
896
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
897
-                                if ($default_value != '') {
898
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
899
-                                }
900
-
901
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
902
-                                //$wpdb->query($meta_field_add);
903
-                            }
904
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
905
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
906
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
907
-                                if ($default_value != '') {
908
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
909
-                                }
910
-
911
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
912
-                                //$wpdb->query($meta_field_add);
913
-
914
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
915
-
916
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
917
-                                if ($default_value != '') {
918
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
919
-                                }
920
-
921
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
922
-
923
-                                //$wpdb->query($meta_field_add);
924
-                            }
925
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
926
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
927
-
928
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
929
-                                if ($default_value != '') {
930
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
931
-                                }
932
-
933
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
934
-
935
-                                //$wpdb->query($meta_field_add);
936
-                            }
937
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
938
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
939
-
940
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
941
-                                if ($default_value != '') {
942
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
943
-                                }
944
-
945
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
946
-
947
-                                //$wpdb->query($meta_field_add);
948
-                            }
949
-                            // show lat lng
950
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
951
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
952
-
953
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
954
-                                $meta_field_add .= " DEFAULT '1'";
955
-
956
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
957
-                                //$wpdb->query($meta_field_add);
958
-                            }
959
-                        }
960
-
961
-                        break;
962
-
963
-                    case 'checkbox':
964
-                        $data_type = 'TINYINT';
965
-
966
-                        $meta_field_add = $data_type . "( 1 ) NOT NULL ";
967
-                        if ((int)$default_value === 1) {
968
-                            $meta_field_add .= " DEFAULT '1'";
969
-                        }
970
-
971
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
972
-                        if ($add_result === false) {
973
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
974
-                        }
975
-                        break;
976
-                    case 'multiselect':
977
-                    case 'select':
978
-                        $data_type = 'VARCHAR';
979
-                        $op_size = '500';
980
-
981
-                        // only make the field as big as it needs to be.
982
-                        if (isset($option_values) && $option_values && $field_type == 'select') {
983
-                            $option_values_arr = explode(',', $option_values);
984
-
985
-                            if (is_array($option_values_arr)) {
986
-                                $op_max = 0;
987
-
988
-                                foreach ($option_values_arr as $op_val) {
989
-                                    if (strlen($op_val) && strlen($op_val) > $op_max) {
990
-                                        $op_max = strlen($op_val);
991
-                                    }
992
-                                }
993
-
994
-                                if ($op_max) {
995
-                                    $op_size = $op_max;
996
-                                }
997
-                            }
998
-                        } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
999
-                            if (strlen($option_values)) {
1000
-                                $op_size =  strlen($option_values);
1001
-                            }
1002
-
1003
-                            if (isset($request_field['multi_display_type'])) {
1004
-                                $extra_fields = $request_field['multi_display_type'];
1005
-                            }
1006
-                        }
1007
-
1008
-                        $meta_field_add = $data_type . "( $op_size ) NULL ";
1009
-                        if ($default_value != '') {
1010
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
1011
-                        }
1012
-
1013
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1014
-                        if ($add_result === false) {
1015
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1016
-                        }
1017
-                        break;
1018
-                    case 'textarea':
1019
-                    case 'html':
1020
-                    case 'url':
1021
-                    case 'file':
1022
-
1023
-                        $data_type = 'TEXT';
1024
-
1025
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1026
-
1027
-                        $meta_field_add = $data_type . " NULL ";
1028
-                        /*if($default_value != '')
863
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
864
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
865
+								$meta_field_add = "VARCHAR( 30 ) NULL";
866
+								if ($default_value != '') {
867
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
868
+								}
869
+
870
+								geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
871
+								//$wpdb->query($meta_field_add);
872
+							}
873
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
874
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
875
+								$meta_field_add = "VARCHAR( 30 ) NULL";
876
+								if ($default_value != '') {
877
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
878
+								}
879
+
880
+								geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
881
+								//$wpdb->query($meta_field_add);
882
+							}
883
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
884
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
885
+
886
+								$meta_field_add = "VARCHAR( 30 ) NULL";
887
+								if ($default_value != '') {
888
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
889
+								}
890
+
891
+								geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
892
+								//$wpdb->query($meta_field_add);
893
+							}
894
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
895
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
896
+								$meta_field_add = "VARCHAR( 15 ) NULL";
897
+								if ($default_value != '') {
898
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
899
+								}
900
+
901
+								geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
902
+								//$wpdb->query($meta_field_add);
903
+							}
904
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
905
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
906
+								$meta_field_add = "VARCHAR( 20 ) NULL";
907
+								if ($default_value != '') {
908
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
909
+								}
910
+
911
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
912
+								//$wpdb->query($meta_field_add);
913
+
914
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
915
+
916
+								$meta_field_add = "VARCHAR( 20 ) NULL";
917
+								if ($default_value != '') {
918
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
919
+								}
920
+
921
+								geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
922
+
923
+								//$wpdb->query($meta_field_add);
924
+							}
925
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
926
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
927
+
928
+								$meta_field_add = "VARCHAR( 15 ) NULL";
929
+								if ($default_value != '') {
930
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
931
+								}
932
+
933
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
934
+
935
+								//$wpdb->query($meta_field_add);
936
+							}
937
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
938
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
939
+
940
+								$meta_field_add = "VARCHAR( 3 ) NULL";
941
+								if ($default_value != '') {
942
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
943
+								}
944
+
945
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
946
+
947
+								//$wpdb->query($meta_field_add);
948
+							}
949
+							// show lat lng
950
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
951
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
952
+
953
+								$meta_field_add = "VARCHAR( 3 ) NULL";
954
+								$meta_field_add .= " DEFAULT '1'";
955
+
956
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
957
+								//$wpdb->query($meta_field_add);
958
+							}
959
+						}
960
+
961
+						break;
962
+
963
+					case 'checkbox':
964
+						$data_type = 'TINYINT';
965
+
966
+						$meta_field_add = $data_type . "( 1 ) NOT NULL ";
967
+						if ((int)$default_value === 1) {
968
+							$meta_field_add .= " DEFAULT '1'";
969
+						}
970
+
971
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
972
+						if ($add_result === false) {
973
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
974
+						}
975
+						break;
976
+					case 'multiselect':
977
+					case 'select':
978
+						$data_type = 'VARCHAR';
979
+						$op_size = '500';
980
+
981
+						// only make the field as big as it needs to be.
982
+						if (isset($option_values) && $option_values && $field_type == 'select') {
983
+							$option_values_arr = explode(',', $option_values);
984
+
985
+							if (is_array($option_values_arr)) {
986
+								$op_max = 0;
987
+
988
+								foreach ($option_values_arr as $op_val) {
989
+									if (strlen($op_val) && strlen($op_val) > $op_max) {
990
+										$op_max = strlen($op_val);
991
+									}
992
+								}
993
+
994
+								if ($op_max) {
995
+									$op_size = $op_max;
996
+								}
997
+							}
998
+						} elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
999
+							if (strlen($option_values)) {
1000
+								$op_size =  strlen($option_values);
1001
+							}
1002
+
1003
+							if (isset($request_field['multi_display_type'])) {
1004
+								$extra_fields = $request_field['multi_display_type'];
1005
+							}
1006
+						}
1007
+
1008
+						$meta_field_add = $data_type . "( $op_size ) NULL ";
1009
+						if ($default_value != '') {
1010
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
1011
+						}
1012
+
1013
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1014
+						if ($add_result === false) {
1015
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1016
+						}
1017
+						break;
1018
+					case 'textarea':
1019
+					case 'html':
1020
+					case 'url':
1021
+					case 'file':
1022
+
1023
+						$data_type = 'TEXT';
1024
+
1025
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1026
+
1027
+						$meta_field_add = $data_type . " NULL ";
1028
+						/*if($default_value != '')
1029 1029
 					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
1030 1030
 
1031
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1032
-                        if ($add_result === false) {
1033
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1034
-                        }
1031
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1032
+						if ($add_result === false) {
1033
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1034
+						}
1035 1035
 
1036
-                        break;
1036
+						break;
1037 1037
 
1038
-                    case 'datepicker':
1038
+					case 'datepicker':
1039 1039
 
1040
-                        $data_type = 'DATE';
1040
+						$data_type = 'DATE';
1041 1041
 
1042
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1042
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1043 1043
 
1044
-                        $meta_field_add = $data_type . " NULL ";
1044
+						$meta_field_add = $data_type . " NULL ";
1045 1045
 
1046
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1047
-                        if ($add_result === false) {
1048
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1049
-                        }
1046
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1047
+						if ($add_result === false) {
1048
+							return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1049
+						}
1050 1050
 
1051
-                        break;
1051
+						break;
1052 1052
 
1053
-                    case 'time':
1053
+					case 'time':
1054 1054
 
1055
-                        $data_type = 'TIME';
1055
+						$data_type = 'TIME';
1056 1056
 
1057
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1057
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1058 1058
 
1059
-                        $meta_field_add = $data_type . " NULL ";
1059
+						$meta_field_add = $data_type . " NULL ";
1060 1060
 
1061
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1062
-                        if ($add_result === false) {
1063
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1064
-                        }
1061
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1062
+						if ($add_result === false) {
1063
+							return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1064
+						}
1065 1065
 
1066
-                        break;
1066
+						break;
1067 1067
 
1068
-                    default:
1068
+					default:
1069 1069
 
1070
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
1071
-                            $meta_field_add = $data_type . " NULL ";
1070
+						if ($data_type != 'VARCHAR' && $data_type != '') {
1071
+							$meta_field_add = $data_type . " NULL ";
1072 1072
 
1073
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
1074
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1075
-                            }
1073
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
1074
+								$meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1075
+							}
1076 1076
 
1077
-                            if (is_numeric($default_value) && $default_value != '') {
1078
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1079
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1080
-                            }
1081
-                        } else {
1082
-                            $meta_field_add = " VARCHAR( 254 ) NULL ";
1077
+							if (is_numeric($default_value) && $default_value != '') {
1078
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1079
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1080
+							}
1081
+						} else {
1082
+							$meta_field_add = " VARCHAR( 254 ) NULL ";
1083 1083
 
1084
-                            if ($default_value != '') {
1085
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1086
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1087
-                            }
1088
-                        }
1084
+							if ($default_value != '') {
1085
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1086
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1087
+							}
1088
+						}
1089 1089
 
1090
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1091
-                        if ($add_result === false) {
1092
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1093
-                        }
1094
-                        break;
1095
-                endswitch;
1090
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1091
+						if ($add_result === false) {
1092
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1093
+						}
1094
+						break;
1095
+				endswitch;
1096 1096
 
1097
-                $extra_field_query = '';
1098
-                if (!empty($extra_fields)) {
1099
-                    $extra_field_query = serialize($extra_fields);
1100
-                }
1097
+				$extra_field_query = '';
1098
+				if (!empty($extra_fields)) {
1099
+					$extra_field_query = serialize($extra_fields);
1100
+				}
1101 1101
 
1102
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1102
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1103 1103
 
1104
-                $wpdb->query(
1104
+				$wpdb->query(
1105 1105
 
1106
-                    $wpdb->prepare(
1106
+					$wpdb->prepare(
1107 1107
 
1108
-                        "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1108
+						"insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1109 1109
 					post_type = %s,
1110 1110
 					admin_title = %s,
1111 1111
 					site_title = %s,
@@ -1138,26 +1138,26 @@  discard block
 block discarded – undo
1138 1138
 					validation_msg = %s,
1139 1139
 					for_admin_use = %s ",
1140 1140
 
1141
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1141
+						array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1142 1142
 
1143
-                    )
1143
+					)
1144 1144
 
1145
-                );
1145
+				);
1146 1146
 
1147
-                $lastid = $wpdb->insert_id;
1147
+				$lastid = $wpdb->insert_id;
1148 1148
 
1149
-                $lastid = trim($lastid);
1149
+				$lastid = trim($lastid);
1150 1150
 
1151
-            }
1151
+			}
1152 1152
 
1153
-            return (int)$lastid;
1153
+			return (int)$lastid;
1154 1154
 
1155 1155
 
1156
-        } else {
1157
-            return 'HTML Variable Name should be a unique name';
1158
-        }
1156
+		} else {
1157
+			return 'HTML Variable Name should be a unique name';
1158
+		}
1159 1159
 
1160
-    }
1160
+	}
1161 1161
 }
1162 1162
 
1163 1163
 /**
@@ -1172,54 +1172,54 @@  discard block
 block discarded – undo
1172 1172
 function godir_set_field_order($field_ids = array())
1173 1173
 {
1174 1174
 
1175
-    global $wpdb;
1175
+	global $wpdb;
1176 1176
 
1177
-    $count = 0;
1178
-    if (!empty($field_ids)):
1179
-        $post_meta_info = false;
1180
-        foreach ($field_ids as $id) {
1177
+	$count = 0;
1178
+	if (!empty($field_ids)):
1179
+		$post_meta_info = false;
1180
+		foreach ($field_ids as $id) {
1181 1181
 
1182
-            $cf = trim($id, '_');
1182
+			$cf = trim($id, '_');
1183 1183
 
1184
-            $post_meta_info = $wpdb->query(
1185
-                $wpdb->prepare(
1186
-                    "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1184
+			$post_meta_info = $wpdb->query(
1185
+				$wpdb->prepare(
1186
+					"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1187 1187
 															sort_order=%d 
1188 1188
 															where id= %d",
1189
-                    array($count, $cf)
1190
-                )
1191
-            );
1192
-            $count++;
1193
-        }
1194
-
1195
-        return $post_meta_info;
1196
-    else:
1197
-        return false;
1198
-    endif;
1189
+					array($count, $cf)
1190
+				)
1191
+			);
1192
+			$count++;
1193
+		}
1194
+
1195
+		return $post_meta_info;
1196
+	else:
1197
+		return false;
1198
+	endif;
1199 1199
 }
1200 1200
 
1201 1201
 
1202 1202
 function geodir_get_cf_value($cf){
1203
-    global $gd_session;
1204
-    $value = '';
1205
-    if (is_admin()) {
1206
-        global $post,$gd_session;
1207
-
1208
-        if (isset($_REQUEST['post']))
1209
-            $_REQUEST['pid'] = $_REQUEST['post'];
1210
-    }
1211
-
1212
-    if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1213
-        $post = $gd_ses_listing;
1214
-        $value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1215
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1216
-        $value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1217
-    } else {
1218
-        if ($value == '') {
1219
-            $value = $cf['default'];
1220
-        }
1221
-    }
1222
-    return $value;
1203
+	global $gd_session;
1204
+	$value = '';
1205
+	if (is_admin()) {
1206
+		global $post,$gd_session;
1207
+
1208
+		if (isset($_REQUEST['post']))
1209
+			$_REQUEST['pid'] = $_REQUEST['post'];
1210
+	}
1211
+
1212
+	if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1213
+		$post = $gd_ses_listing;
1214
+		$value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1215
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1216
+		$value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1217
+	} else {
1218
+		if ($value == '') {
1219
+			$value = $cf['default'];
1220
+		}
1221
+	}
1222
+	return $value;
1223 1223
 }
1224 1224
 
1225 1225
 /**
@@ -1238,412 +1238,412 @@  discard block
 block discarded – undo
1238 1238
  * @param string $post_type Optional. The wordpress post type.
1239 1239
  */
1240 1240
 function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') {
1241
-    global $is_default, $mapzoom, $gd_session;
1241
+	global $is_default, $mapzoom, $gd_session;
1242 1242
 
1243
-    $listing_type = $post_type;
1243
+	$listing_type = $post_type;
1244 1244
 
1245
-    $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1245
+	$custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1246 1246
 
1247
-    foreach ($custom_fields as $key => $val) {
1248
-        $val = stripslashes_deep($val); // strip slashes from labels
1249
-        $name = $val['name'];
1250
-        $type = $val['type'];
1251
-        $is_default = $val['is_default'];
1247
+	foreach ($custom_fields as $key => $val) {
1248
+		$val = stripslashes_deep($val); // strip slashes from labels
1249
+		$name = $val['name'];
1250
+		$type = $val['type'];
1251
+		$is_default = $val['is_default'];
1252 1252
 
1253
-        /* field available to site admin only for edit */
1254
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1255
-        if ($for_admin_use && !is_super_admin()) {
1256
-            continue;
1257
-        }
1253
+		/* field available to site admin only for edit */
1254
+		$for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1255
+		if ($for_admin_use && !is_super_admin()) {
1256
+			continue;
1257
+		}
1258 1258
 
1259
-        if (is_admin()) {
1260
-            global $post;
1259
+		if (is_admin()) {
1260
+			global $post;
1261 1261
 
1262
-            if (isset($_REQUEST['post']))
1263
-                $_REQUEST['pid'] = $_REQUEST['post'];
1264
-        }
1262
+			if (isset($_REQUEST['post']))
1263
+				$_REQUEST['pid'] = $_REQUEST['post'];
1264
+		}
1265 1265
 
1266 1266
         
1267 1267
 
1268
-        /**
1269
-         * Called before the custom fields info is output for submitting a post.
1270
-         *
1271
-         * Used dynamic hook type geodir_before_custom_form_field_$name.
1272
-         *
1273
-         * @since 1.0.0
1274
-         * @param string $listing_type The post post type.
1275
-         * @param int $package_id The price package ID for the post.
1276
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1277
-         * @see 'geodir_after_custom_form_field_$name'
1278
-         */
1279
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1280
-
1281
-
1282
-        $custom_field = $val;
1283
-        $html ='';
1284
-        /**
1285
-         * Filter the output for custom fields.
1286
-         *
1287
-         * Here we can remove or add new functions depending on the field type.
1288
-         *
1289
-         * @param string $html The html to be filtered (blank).
1290
-         * @param array $custom_field The custom field array values.
1291
-         */
1292
-        echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1293
-
1294
-
1295
-
1296
-        /**
1297
-         * Called after the custom fields info is output for submitting a post.
1298
-         *
1299
-         * Used dynamic hook type geodir_after_custom_form_field_$name.
1300
-         *
1301
-         * @since 1.0.0
1302
-         * @param string $listing_type The post post type.
1303
-         * @param int $package_id The price package ID for the post.
1304
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1305
-         * @see 'geodir_before_custom_form_field_$name'
1306
-         */
1307
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1308
-
1309
-    }
1268
+		/**
1269
+		 * Called before the custom fields info is output for submitting a post.
1270
+		 *
1271
+		 * Used dynamic hook type geodir_before_custom_form_field_$name.
1272
+		 *
1273
+		 * @since 1.0.0
1274
+		 * @param string $listing_type The post post type.
1275
+		 * @param int $package_id The price package ID for the post.
1276
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1277
+		 * @see 'geodir_after_custom_form_field_$name'
1278
+		 */
1279
+		do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1280
+
1281
+
1282
+		$custom_field = $val;
1283
+		$html ='';
1284
+		/**
1285
+		 * Filter the output for custom fields.
1286
+		 *
1287
+		 * Here we can remove or add new functions depending on the field type.
1288
+		 *
1289
+		 * @param string $html The html to be filtered (blank).
1290
+		 * @param array $custom_field The custom field array values.
1291
+		 */
1292
+		echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1293
+
1294
+
1295
+
1296
+		/**
1297
+		 * Called after the custom fields info is output for submitting a post.
1298
+		 *
1299
+		 * Used dynamic hook type geodir_after_custom_form_field_$name.
1300
+		 *
1301
+		 * @since 1.0.0
1302
+		 * @param string $listing_type The post post type.
1303
+		 * @param int $package_id The price package ID for the post.
1304
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1305
+		 * @see 'geodir_before_custom_form_field_$name'
1306
+		 */
1307
+		do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1308
+
1309
+	}
1310 1310
 
1311 1311
 }
1312 1312
 
1313 1313
 
1314 1314
 if (!function_exists('geodir_get_field_infoby')) {
1315
-    /**
1316
-     * Get custom field using key and value.
1317
-     *
1318
-     * @since 1.0.0
1319
-     * @package GeoDirectory
1320
-     * @global object $wpdb WordPress Database object.
1321
-     * @param string $key The key you want to look for.
1322
-     * @param string $value The value of the key you want to look for.
1323
-     * @param string $geodir_post_type The post type.
1324
-     * @return bool|mixed Returns field info when available. otherwise returns false.
1325
-     */
1326
-    function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1327
-    {
1328
-
1329
-        global $wpdb;
1330
-
1331
-        $filter = $wpdb->get_row(
1332
-            $wpdb->prepare(
1333
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1334
-                array($geodir_post_type)
1335
-            )
1336
-        );
1337
-
1338
-        if ($filter) {
1339
-            return $filter;
1340
-        } else {
1341
-            return false;
1342
-        }
1343
-
1344
-    }
1315
+	/**
1316
+	 * Get custom field using key and value.
1317
+	 *
1318
+	 * @since 1.0.0
1319
+	 * @package GeoDirectory
1320
+	 * @global object $wpdb WordPress Database object.
1321
+	 * @param string $key The key you want to look for.
1322
+	 * @param string $value The value of the key you want to look for.
1323
+	 * @param string $geodir_post_type The post type.
1324
+	 * @return bool|mixed Returns field info when available. otherwise returns false.
1325
+	 */
1326
+	function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1327
+	{
1328
+
1329
+		global $wpdb;
1330
+
1331
+		$filter = $wpdb->get_row(
1332
+			$wpdb->prepare(
1333
+				"SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1334
+				array($geodir_post_type)
1335
+			)
1336
+		);
1337
+
1338
+		if ($filter) {
1339
+			return $filter;
1340
+		} else {
1341
+			return false;
1342
+		}
1343
+
1344
+	}
1345 1345
 }
1346 1346
 
1347 1347
 
1348 1348
 function geodir_field_icon_proccess($cf){
1349 1349
 
1350 1350
 
1351
-    if (strpos($cf['field_icon'], 'http') !== false) {
1352
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353
-    } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
-    }else{
1356
-        $field_icon = $cf['field_icon'];
1357
-    }
1351
+	if (strpos($cf['field_icon'], 'http') !== false) {
1352
+		$field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353
+	} elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354
+		$field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
+	}else{
1356
+		$field_icon = $cf['field_icon'];
1357
+	}
1358 1358
 
1359
-    return $field_icon;
1359
+	return $field_icon;
1360 1360
 }
1361 1361
 
1362 1362
 if (!function_exists('geodir_show_listing_info')) {
1363
-    /**
1364
-     * Show listing info depending on field location.
1365
-     *
1366
-     * @since 1.0.0
1367
-     * @since 1.5.7 Custom fields option values added to db translation.
1368
-     *              Changes to display url fields title.
1369
-     * @package GeoDirectory
1370
-     * @global object $wpdb WordPress Database object.
1371
-     * @global object $post The current post object.
1372
-     * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
1373
-     *
1374
-     * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1375
-     * @return string Returns listing info html.
1376
-     */
1377
-    function geodir_show_listing_info($fields_location = '') {
1378
-        global $post, $preview, $wpdb, $send_to_friend;
1379
-
1380
-        $payment_info = array();
1381
-        $package_info = array();
1382
-
1383
-        $package_info = geodir_post_package_info($package_info, $post);
1384
-        $post_package_id = $package_info->pid;
1385
-        $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
1386
-        $send_to_friend = false;
1387
-
1388
-        ob_start();
1389
-        $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
1390
-
1391
-        if (!empty($fields_info)) {
1392
-            $post = stripslashes_deep($post); // strip slashes
1363
+	/**
1364
+	 * Show listing info depending on field location.
1365
+	 *
1366
+	 * @since 1.0.0
1367
+	 * @since 1.5.7 Custom fields option values added to db translation.
1368
+	 *              Changes to display url fields title.
1369
+	 * @package GeoDirectory
1370
+	 * @global object $wpdb WordPress Database object.
1371
+	 * @global object $post The current post object.
1372
+	 * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
1373
+	 *
1374
+	 * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1375
+	 * @return string Returns listing info html.
1376
+	 */
1377
+	function geodir_show_listing_info($fields_location = '') {
1378
+		global $post, $preview, $wpdb, $send_to_friend;
1379
+
1380
+		$payment_info = array();
1381
+		$package_info = array();
1382
+
1383
+		$package_info = geodir_post_package_info($package_info, $post);
1384
+		$post_package_id = $package_info->pid;
1385
+		$p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
1386
+		$send_to_friend = false;
1387
+
1388
+		ob_start();
1389
+		$fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
1390
+
1391
+		if (!empty($fields_info)) {
1392
+			$post = stripslashes_deep($post); // strip slashes
1393 1393
             
1394
-            //echo '<div class="geodir-company_info field-group">';
1395
-            global $field_set_start;
1396
-            $field_set_start = 0;
1397
-
1398
-
1399
-
1400
-            foreach ($fields_info as $type) {
1401
-                $type = stripslashes_deep($type); // strip slashes
1402
-                $html = '';
1403
-                $html_var = '';
1404
-                $field_icon = geodir_field_icon_proccess($type);
1405
-                $filed_type = $type['type'];
1406
-
1407
-                /**
1408
-                 * Filter the output for custom fields.
1409
-                 *
1410
-                 * Here we can remove or add new functions depending on the field type.
1411
-                 *
1412
-                 * @param string $html The html to be filtered (blank).
1413
-                 * @param string $fields_location The location the field is to be show.
1414
-                 * @param array $type The array of field values.
1415
-                 */
1416
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1417
-
1418
-                $variables_array = array();
1419
-
1420
-                if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
1421
-                    continue;
1422
-                }
1423
-
1424
-                if ($type['type'] != 'fieldset'):
1425
-                    $variables_array['post_id'] = $post->ID;
1426
-                    $variables_array['label'] = __($type['site_title'], 'geodirectory');
1427
-                    $variables_array['value'] = '';
1428
-                    if (isset($post->{$type['htmlvar_name']}))
1429
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
1430
-                endif;
1431
-
1432
-
1433
-
1434
-                if ($html):
1435
-
1436
-                    /**
1437
-                     * Called before a custom fields is output on the frontend.
1438
-                     *
1439
-                     * @since 1.0.0
1440
-                     * @param string $html_var The HTML variable name for the field.
1441
-                     */
1442
-                    do_action("geodir_before_show_{$html_var}");
1443
-                    /**
1444
-                     * Filter custom field output.
1445
-                     *
1446
-                     * @since 1.0.0
1447
-                     *
1448
-                     * @param string $html_var The HTML variable name for the field.
1449
-                     * @param string $html Custom field unfiltered HTML.
1450
-                     * @param array $variables_array Custom field variables array.
1451
-                     */
1452
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1453
-
1454
-                    /**
1455
-                     * Called after a custom fields is output on the frontend.
1456
-                     *
1457
-                     * @since 1.0.0
1458
-                     * @param string $html_var The HTML variable name for the field.
1459
-                     */
1460
-                    do_action("geodir_after_show_{$html_var}");
1461
-
1462
-                endif;
1463
-
1464
-            }
1465
-
1466
-            //echo '</div>';
1467
-
1468
-        }
1469
-
1470
-
1471
-        return $html = ob_get_clean();
1472
-
1473
-    }
1394
+			//echo '<div class="geodir-company_info field-group">';
1395
+			global $field_set_start;
1396
+			$field_set_start = 0;
1397
+
1398
+
1399
+
1400
+			foreach ($fields_info as $type) {
1401
+				$type = stripslashes_deep($type); // strip slashes
1402
+				$html = '';
1403
+				$html_var = '';
1404
+				$field_icon = geodir_field_icon_proccess($type);
1405
+				$filed_type = $type['type'];
1406
+
1407
+				/**
1408
+				 * Filter the output for custom fields.
1409
+				 *
1410
+				 * Here we can remove or add new functions depending on the field type.
1411
+				 *
1412
+				 * @param string $html The html to be filtered (blank).
1413
+				 * @param string $fields_location The location the field is to be show.
1414
+				 * @param array $type The array of field values.
1415
+				 */
1416
+				$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1417
+
1418
+				$variables_array = array();
1419
+
1420
+				if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
1421
+					continue;
1422
+				}
1423
+
1424
+				if ($type['type'] != 'fieldset'):
1425
+					$variables_array['post_id'] = $post->ID;
1426
+					$variables_array['label'] = __($type['site_title'], 'geodirectory');
1427
+					$variables_array['value'] = '';
1428
+					if (isset($post->{$type['htmlvar_name']}))
1429
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
1430
+				endif;
1431
+
1432
+
1433
+
1434
+				if ($html):
1435
+
1436
+					/**
1437
+					 * Called before a custom fields is output on the frontend.
1438
+					 *
1439
+					 * @since 1.0.0
1440
+					 * @param string $html_var The HTML variable name for the field.
1441
+					 */
1442
+					do_action("geodir_before_show_{$html_var}");
1443
+					/**
1444
+					 * Filter custom field output.
1445
+					 *
1446
+					 * @since 1.0.0
1447
+					 *
1448
+					 * @param string $html_var The HTML variable name for the field.
1449
+					 * @param string $html Custom field unfiltered HTML.
1450
+					 * @param array $variables_array Custom field variables array.
1451
+					 */
1452
+					if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1453
+
1454
+					/**
1455
+					 * Called after a custom fields is output on the frontend.
1456
+					 *
1457
+					 * @since 1.0.0
1458
+					 * @param string $html_var The HTML variable name for the field.
1459
+					 */
1460
+					do_action("geodir_after_show_{$html_var}");
1461
+
1462
+				endif;
1463
+
1464
+			}
1465
+
1466
+			//echo '</div>';
1467
+
1468
+		}
1469
+
1470
+
1471
+		return $html = ob_get_clean();
1472
+
1473
+	}
1474 1474
 }
1475 1475
 
1476 1476
 if (!function_exists('geodir_default_date_format')) {
1477
-    /**
1478
-     * Returns default date format.
1479
-     *
1480
-     * @since 1.0.0
1481
-     * @package GeoDirectory
1482
-     * @return mixed|string|void Returns default date format.
1483
-     */
1484
-    function geodir_default_date_format()
1485
-    {
1486
-        if ($format = get_option('date_format'))
1487
-            return $format;
1488
-        else
1489
-            return 'dd-mm-yy';
1490
-    }
1477
+	/**
1478
+	 * Returns default date format.
1479
+	 *
1480
+	 * @since 1.0.0
1481
+	 * @package GeoDirectory
1482
+	 * @return mixed|string|void Returns default date format.
1483
+	 */
1484
+	function geodir_default_date_format()
1485
+	{
1486
+		if ($format = get_option('date_format'))
1487
+			return $format;
1488
+		else
1489
+			return 'dd-mm-yy';
1490
+	}
1491 1491
 }
1492 1492
 
1493 1493
 if (!function_exists('geodir_get_formated_date')) {
1494
-    /**
1495
-     * Returns formatted date.
1496
-     *
1497
-     * @since 1.0.0
1498
-     * @package GeoDirectory
1499
-     * @param string $date Date string to convert.
1500
-     * @return bool|int|string Returns formatted date.
1501
-     */
1502
-    function geodir_get_formated_date($date)
1503
-    {
1504
-        return mysql2date(get_option('date_format'), $date);
1505
-    }
1494
+	/**
1495
+	 * Returns formatted date.
1496
+	 *
1497
+	 * @since 1.0.0
1498
+	 * @package GeoDirectory
1499
+	 * @param string $date Date string to convert.
1500
+	 * @return bool|int|string Returns formatted date.
1501
+	 */
1502
+	function geodir_get_formated_date($date)
1503
+	{
1504
+		return mysql2date(get_option('date_format'), $date);
1505
+	}
1506 1506
 }
1507 1507
 
1508 1508
 if (!function_exists('geodir_get_formated_time')) {
1509
-    /**
1510
-     * Returns formatted time.
1511
-     *
1512
-     * @since 1.0.0
1513
-     * @package GeoDirectory
1514
-     * @param string $time Time string to convert.
1515
-     * @return bool|int|string Returns formatted time.
1516
-     */
1517
-    function geodir_get_formated_time($time)
1518
-    {
1519
-        return mysql2date(get_option('time_format'), $time, $translate = true);
1520
-    }
1509
+	/**
1510
+	 * Returns formatted time.
1511
+	 *
1512
+	 * @since 1.0.0
1513
+	 * @package GeoDirectory
1514
+	 * @param string $time Time string to convert.
1515
+	 * @return bool|int|string Returns formatted time.
1516
+	 */
1517
+	function geodir_get_formated_time($time)
1518
+	{
1519
+		return mysql2date(get_option('time_format'), $time, $translate = true);
1520
+	}
1521 1521
 }
1522 1522
 
1523 1523
 
1524 1524
 if (!function_exists('geodir_save_post_file_fields')) {
1525
-    /**
1526
-     * Save post file fields
1527
-     *
1528
-     * @since 1.0.0
1529
-     * @since 1.4.7 Added `$extra_fields` parameter.
1530
-     * @package GeoDirectory
1531
-     * @global object $wpdb WordPress Database object.
1532
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1533
-     * @global object $current_user Current user object.
1534
-     * @param int $post_id
1535
-     * @param string $field_id
1536
-     * @param array $post_image
1537
-     * @param array $extra_fields Array of extra fields.
1538
-     */
1539
-    function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1540
-    {
1525
+	/**
1526
+	 * Save post file fields
1527
+	 *
1528
+	 * @since 1.0.0
1529
+	 * @since 1.4.7 Added `$extra_fields` parameter.
1530
+	 * @package GeoDirectory
1531
+	 * @global object $wpdb WordPress Database object.
1532
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1533
+	 * @global object $current_user Current user object.
1534
+	 * @param int $post_id
1535
+	 * @param string $field_id
1536
+	 * @param array $post_image
1537
+	 * @param array $extra_fields Array of extra fields.
1538
+	 */
1539
+	function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1540
+	{
1541 1541
 
1542
-        global $wpdb, $plugin_prefix, $current_user;
1542
+		global $wpdb, $plugin_prefix, $current_user;
1543 1543
 
1544
-        $post_type = get_post_type($post_id);
1545
-        //echo $field_id; exit;
1546
-        $table = $plugin_prefix . $post_type . '_detail';
1544
+		$post_type = get_post_type($post_id);
1545
+		//echo $field_id; exit;
1546
+		$table = $plugin_prefix . $post_type . '_detail';
1547 1547
 
1548
-        $postcurr_images = array();
1549
-        $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1550
-        $file_urls = '';
1548
+		$postcurr_images = array();
1549
+		$postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1550
+		$file_urls = '';
1551 1551
 
1552
-        if (!empty($post_image)) {
1552
+		if (!empty($post_image)) {
1553 1553
 
1554
-            $invalid_files = array();
1554
+			$invalid_files = array();
1555 1555
 
1556
-            //Get and remove all old images of post from database to set by new order
1557
-            $geodir_uploaddir = '';
1558
-            $uploads = wp_upload_dir();
1559
-            $uploads_dir = $uploads['path'];
1556
+			//Get and remove all old images of post from database to set by new order
1557
+			$geodir_uploaddir = '';
1558
+			$uploads = wp_upload_dir();
1559
+			$uploads_dir = $uploads['path'];
1560 1560
 
1561
-            $geodir_uploadpath = $uploads['path'];
1562
-            $geodir_uploadurl = $uploads['url'];
1563
-            $sub_dir = $uploads['subdir'];
1561
+			$geodir_uploadpath = $uploads['path'];
1562
+			$geodir_uploadurl = $uploads['url'];
1563
+			$sub_dir = $uploads['subdir'];
1564 1564
 
1565
-            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1565
+			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1566 1566
 
1567
-            for ($m = 0; $m < count($post_image); $m++) {
1567
+			for ($m = 0; $m < count($post_image); $m++) {
1568 1568
 
1569
-                /* --------- start ------- */
1569
+				/* --------- start ------- */
1570 1570
 
1571
-                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
1571
+				if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
1572 1572
 
1573 1573
 
1574
-                    $curr_img_url = $post_image[$m];
1575
-                    $image_name_arr = explode('/', $curr_img_url);
1576
-                    $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1577
-                    $filename = end($image_name_arr);
1578
-                    $img_name_arr = explode('.', $filename);
1574
+					$curr_img_url = $post_image[$m];
1575
+					$image_name_arr = explode('/', $curr_img_url);
1576
+					$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1577
+					$filename = end($image_name_arr);
1578
+					$img_name_arr = explode('.', $filename);
1579 1579
 
1580
-                    $arr_file_type = wp_check_filetype($filename);
1580
+					$arr_file_type = wp_check_filetype($filename);
1581 1581
 
1582
-                    if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1583
-                        continue;
1584
-                    }
1582
+					if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1583
+						continue;
1584
+					}
1585 1585
 
1586
-                    $uploaded_file_type = $arr_file_type['type'];
1587
-                    $uploaded_file_ext = $arr_file_type['ext'];
1586
+					$uploaded_file_type = $arr_file_type['type'];
1587
+					$uploaded_file_ext = $arr_file_type['ext'];
1588 1588
 
1589
-                    if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1590
-                        continue; // Invalid file type.
1591
-                    }
1589
+					if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1590
+						continue; // Invalid file type.
1591
+					}
1592 1592
 
1593
-                    // Set an array containing a list of acceptable formats
1594
-                    //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1593
+					// Set an array containing a list of acceptable formats
1594
+					//$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1595 1595
 
1596
-                    if (!function_exists('wp_handle_upload'))
1597
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1596
+					if (!function_exists('wp_handle_upload'))
1597
+						require_once(ABSPATH . 'wp-admin/includes/file.php');
1598 1598
 
1599
-                    if (!is_dir($geodir_uploadpath))
1600
-                        mkdir($geodir_uploadpath);
1599
+					if (!is_dir($geodir_uploadpath))
1600
+						mkdir($geodir_uploadpath);
1601 1601
 
1602
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1603
-                    $explode_sub_dir = explode("/", $sub_dir);
1604
-                    if ($curr_img_dir == end($explode_sub_dir)) {
1605
-                        $img_path = $geodir_uploadpath . '/' . $filename;
1606
-                        $img_url = $geodir_uploadurl . '/' . $filename;
1607
-                    } else {
1608
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1609
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1610
-                    }
1602
+					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1603
+					$explode_sub_dir = explode("/", $sub_dir);
1604
+					if ($curr_img_dir == end($explode_sub_dir)) {
1605
+						$img_path = $geodir_uploadpath . '/' . $filename;
1606
+						$img_url = $geodir_uploadurl . '/' . $filename;
1607
+					} else {
1608
+						$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1609
+						$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1610
+					}
1611 1611
 
1612
-                    $uploaded_file = '';
1613
-                    if (file_exists($img_path))
1614
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1612
+					$uploaded_file = '';
1613
+					if (file_exists($img_path))
1614
+						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1615 1615
 
1616
-                    if ($curr_img_dir != $geodir_uploaddir) {
1617
-                        if (file_exists($img_path))
1618
-                            unlink($img_path);
1619
-                    }
1616
+					if ($curr_img_dir != $geodir_uploaddir) {
1617
+						if (file_exists($img_path))
1618
+							unlink($img_path);
1619
+					}
1620 1620
 
1621
-                    if (!empty($uploaded_file))
1622
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1621
+					if (!empty($uploaded_file))
1622
+						$file_urls = $geodir_uploadurl . '/' . $new_name;
1623 1623
 
1624
-                } else {
1625
-                    $file_urls = $post_image[$m];
1626
-                }
1627
-            }
1624
+				} else {
1625
+					$file_urls = $post_image[$m];
1626
+				}
1627
+			}
1628 1628
 
1629 1629
 
1630
-        }
1630
+		}
1631 1631
 
1632
-        //Remove all old attachments and temp images
1633
-        if (!empty($postcurr_images)) {
1632
+		//Remove all old attachments and temp images
1633
+		if (!empty($postcurr_images)) {
1634 1634
 
1635
-            if ($file_urls != $postcurr_images) {
1636
-                $invalid_files[] = (object)array('src' => $postcurr_images);
1637
-                $invalid_files = (object)$invalid_files;
1638
-            }
1639
-        }
1635
+			if ($file_urls != $postcurr_images) {
1636
+				$invalid_files[] = (object)array('src' => $postcurr_images);
1637
+				$invalid_files = (object)$invalid_files;
1638
+			}
1639
+		}
1640 1640
 
1641
-        geodir_save_post_meta($post_id, $field_id, $file_urls);
1641
+		geodir_save_post_meta($post_id, $field_id, $file_urls);
1642 1642
 
1643
-        if (!empty($invalid_files))
1644
-            geodir_remove_attachments($invalid_files);
1643
+		if (!empty($invalid_files))
1644
+			geodir_remove_attachments($invalid_files);
1645 1645
 
1646
-    }
1646
+	}
1647 1647
 }
1648 1648
 
1649 1649
 
@@ -1658,76 +1658,76 @@  discard block
 block discarded – undo
1658 1658
  */
1659 1659
 function geodir_custom_upload_mimes($existing_mimes = array())
1660 1660
 {
1661
-    $existing_mimes['wif'] = 'text/plain';
1662
-    $existing_mimes['jpg|jpeg'] = 'image/jpeg';
1663
-    $existing_mimes['gif'] = 'image/gif';
1664
-    $existing_mimes['png'] = 'image/png';
1665
-    $existing_mimes['pdf'] = 'application/pdf';
1666
-    $existing_mimes['txt'] = 'text/text';
1667
-    $existing_mimes['csv'] = 'application/octet-stream';
1668
-    $existing_mimes['doc'] = 'application/msword';
1669
-    $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1670
-    $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1671
-    $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1672
-    return $existing_mimes;
1661
+	$existing_mimes['wif'] = 'text/plain';
1662
+	$existing_mimes['jpg|jpeg'] = 'image/jpeg';
1663
+	$existing_mimes['gif'] = 'image/gif';
1664
+	$existing_mimes['png'] = 'image/png';
1665
+	$existing_mimes['pdf'] = 'application/pdf';
1666
+	$existing_mimes['txt'] = 'text/text';
1667
+	$existing_mimes['csv'] = 'application/octet-stream';
1668
+	$existing_mimes['doc'] = 'application/msword';
1669
+	$existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1670
+	$existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1671
+	$existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1672
+	return $existing_mimes;
1673 1673
 }
1674 1674
 
1675 1675
 if (!function_exists('geodir_plupload_action')) {
1676 1676
 
1677
-    /**
1678
-     * Get upload directory path details
1679
-     *
1680
-     * @since 1.0.0
1681
-     * @package GeoDirectory
1682
-     * @global object $current_user Current user object.
1683
-     * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1684
-     * @return mixed Returns upload directory details as an array.
1685
-     */
1686
-    function geodir_upload_dir($upload)
1687
-    {
1688
-        global $current_user;
1689
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1690
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
1691
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
1692
-        return $upload;
1693
-    }
1694
-
1695
-    /**
1696
-     * Handles place file and image upload.
1697
-     *
1698
-     * @since 1.0.0
1699
-     * @package GeoDirectory
1700
-     */
1701
-    function geodir_plupload_action()
1702
-    {
1703
-        // check ajax noonce
1704
-        $imgid = $_POST["imgid"];
1705
-
1706
-        check_ajax_referer($imgid . 'pluploadan');
1707
-
1708
-        // handle custom file uploaddir
1709
-        add_filter('upload_dir', 'geodir_upload_dir');
1710
-
1711
-        // change file orinetation if needed
1712
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1713
-
1714
-        // handle file upload
1715
-        $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1716
-        // remove handle custom file uploaddir
1717
-        remove_filter('upload_dir', 'geodir_upload_dir');
1718
-
1719
-        if(!isset($status['url']) && isset($status['error'])){
1720
-            print_r($status);
1721
-        }
1722
-
1723
-        // send the uploaded file url in response
1724
-        if (isset($status['url'])) {
1725
-            echo $status['url'];
1726
-        } else {
1727
-            echo 'x';
1728
-        }
1729
-        exit;
1730
-    }
1677
+	/**
1678
+	 * Get upload directory path details
1679
+	 *
1680
+	 * @since 1.0.0
1681
+	 * @package GeoDirectory
1682
+	 * @global object $current_user Current user object.
1683
+	 * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1684
+	 * @return mixed Returns upload directory details as an array.
1685
+	 */
1686
+	function geodir_upload_dir($upload)
1687
+	{
1688
+		global $current_user;
1689
+		$upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1690
+		$upload['path'] = $upload['basedir'] . $upload['subdir'];
1691
+		$upload['url'] = $upload['baseurl'] . $upload['subdir'];
1692
+		return $upload;
1693
+	}
1694
+
1695
+	/**
1696
+	 * Handles place file and image upload.
1697
+	 *
1698
+	 * @since 1.0.0
1699
+	 * @package GeoDirectory
1700
+	 */
1701
+	function geodir_plupload_action()
1702
+	{
1703
+		// check ajax noonce
1704
+		$imgid = $_POST["imgid"];
1705
+
1706
+		check_ajax_referer($imgid . 'pluploadan');
1707
+
1708
+		// handle custom file uploaddir
1709
+		add_filter('upload_dir', 'geodir_upload_dir');
1710
+
1711
+		// change file orinetation if needed
1712
+		$fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1713
+
1714
+		// handle file upload
1715
+		$status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1716
+		// remove handle custom file uploaddir
1717
+		remove_filter('upload_dir', 'geodir_upload_dir');
1718
+
1719
+		if(!isset($status['url']) && isset($status['error'])){
1720
+			print_r($status);
1721
+		}
1722
+
1723
+		// send the uploaded file url in response
1724
+		if (isset($status['url'])) {
1725
+			echo $status['url'];
1726
+		} else {
1727
+			echo 'x';
1728
+		}
1729
+		exit;
1730
+	}
1731 1731
 }
1732 1732
 
1733 1733
 /**
@@ -1742,17 +1742,17 @@  discard block
 block discarded – undo
1742 1742
  */
1743 1743
 function geodir_get_video($post_id)
1744 1744
 {
1745
-    global $wpdb, $plugin_prefix;
1745
+	global $wpdb, $plugin_prefix;
1746 1746
 
1747
-    $post_type = get_post_type($post_id);
1747
+	$post_type = get_post_type($post_id);
1748 1748
 
1749
-    $table = $plugin_prefix . $post_type . '_detail';
1749
+	$table = $plugin_prefix . $post_type . '_detail';
1750 1750
 
1751
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1751
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1752 1752
 
1753
-    if ($results) {
1754
-        return $results[0]->geodir_video;
1755
-    }
1753
+	if ($results) {
1754
+		return $results[0]->geodir_video;
1755
+	}
1756 1756
 
1757 1757
 }
1758 1758
 
@@ -1768,40 +1768,40 @@  discard block
 block discarded – undo
1768 1768
  */
1769 1769
 function geodir_get_special_offers($post_id)
1770 1770
 {
1771
-    global $wpdb, $plugin_prefix;
1771
+	global $wpdb, $plugin_prefix;
1772 1772
 
1773
-    $post_type = get_post_type($post_id);
1773
+	$post_type = get_post_type($post_id);
1774 1774
 
1775
-    $table = $plugin_prefix . $post_type . '_detail';
1775
+	$table = $plugin_prefix . $post_type . '_detail';
1776 1776
 
1777
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1777
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1778 1778
 
1779
-    if ($results) {
1780
-        return $results[0]->geodir_special_offers;
1781
-    }
1779
+	if ($results) {
1780
+		return $results[0]->geodir_special_offers;
1781
+	}
1782 1782
 
1783 1783
 }
1784 1784
 
1785 1785
 if (!function_exists('geodir_max_upload_size')) {
1786
-    /**
1787
-     * Get max upload file size
1788
-     *
1789
-     * @since 1.0.0
1790
-     * @package GeoDirectory
1791
-     * @return mixed|void Returns max upload file size.
1792
-     */
1793
-    function geodir_max_upload_size()
1794
-    {
1795
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1796
-
1797
-        if ($max_filesize > 0 && $max_filesize < 1) {
1798
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
1799
-        } else {
1800
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1801
-        }
1802
-        /** Filter documented in geodirectory-functions/general_functions.php **/
1803
-        return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1804
-    }
1786
+	/**
1787
+	 * Get max upload file size
1788
+	 *
1789
+	 * @since 1.0.0
1790
+	 * @package GeoDirectory
1791
+	 * @return mixed|void Returns max upload file size.
1792
+	 */
1793
+	function geodir_max_upload_size()
1794
+	{
1795
+		$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1796
+
1797
+		if ($max_filesize > 0 && $max_filesize < 1) {
1798
+			$max_filesize = (int)($max_filesize * 1024) . 'kb';
1799
+		} else {
1800
+			$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1801
+		}
1802
+		/** Filter documented in geodirectory-functions/general_functions.php **/
1803
+		return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1804
+	}
1805 1805
 }
1806 1806
 
1807 1807
 
@@ -1819,33 +1819,33 @@  discard block
 block discarded – undo
1819 1819
  */
1820 1820
 function geodir_add_custom_sort_options($fields, $post_type)
1821 1821
 {
1822
-    global $wpdb;
1822
+	global $wpdb;
1823 1823
 
1824
-    if ($post_type != '') {
1824
+	if ($post_type != '') {
1825 1825
 
1826
-        $all_postypes = geodir_get_posttypes();
1826
+		$all_postypes = geodir_get_posttypes();
1827 1827
 
1828
-        if (in_array($post_type, $all_postypes)) {
1828
+		if (in_array($post_type, $all_postypes)) {
1829 1829
 
1830
-            $custom_fields = $wpdb->get_results(
1831
-                $wpdb->prepare(
1832
-                    "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1833
-                    array($post_type)
1834
-                ), 'ARRAY_A'
1835
-            );
1830
+			$custom_fields = $wpdb->get_results(
1831
+				$wpdb->prepare(
1832
+					"select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1833
+					array($post_type)
1834
+				), 'ARRAY_A'
1835
+			);
1836 1836
 
1837
-            if (!empty($custom_fields)) {
1837
+			if (!empty($custom_fields)) {
1838 1838
 
1839
-                foreach ($custom_fields as $val) {
1840
-                    $fields[] = $val;
1841
-                }
1842
-            }
1839
+				foreach ($custom_fields as $val) {
1840
+					$fields[] = $val;
1841
+				}
1842
+			}
1843 1843
 
1844
-        }
1844
+		}
1845 1845
 
1846
-    }
1846
+	}
1847 1847
 
1848
-    return $fields;
1848
+	return $fields;
1849 1849
 }
1850 1850
 
1851 1851
 
@@ -1861,76 +1861,76 @@  discard block
 block discarded – undo
1861 1861
 function geodir_get_custom_sort_options($post_type = '')
1862 1862
 {
1863 1863
 
1864
-    global $wpdb;
1865
-
1866
-    if ($post_type != '') {
1867
-
1868
-        $all_postypes = geodir_get_posttypes();
1869
-
1870
-        if (!in_array($post_type, $all_postypes))
1871
-            return false;
1872
-
1873
-        $fields = array();
1874
-
1875
-        $fields[] = array(
1876
-            'post_type' => $post_type,
1877
-            'data_type' => '',
1878
-            'field_type' => 'random',
1879
-            'site_title' => 'Random',
1880
-            'htmlvar_name' => 'post_title',
1881
-            'field_icon' =>  'fa fa-random',
1882
-            'description' =>  __('Random sort (not recommended for large sites)', 'geodirectory')
1883
-        );
1884
-
1885
-        $fields[] = array(
1886
-            'post_type' => $post_type,
1887
-            'data_type' => '',
1888
-            'field_type' => 'datetime',
1889
-            'site_title' => __('Add date', 'geodirectory'),
1890
-            'htmlvar_name' => 'post_date',
1891
-            'field_icon' =>  'fa fa-calendar',
1892
-            'description' =>  __('Sort by date added', 'geodirectory')
1893
-        );
1894
-        $fields[] = array(
1895
-            'post_type' => $post_type,
1896
-            'data_type' => '',
1897
-            'field_type' => 'bigint',
1898
-            'site_title' => __('Review', 'geodirectory'),
1899
-            'htmlvar_name' => 'comment_count',
1900
-            'field_icon' =>  'fa fa-commenting-o',
1901
-            'description' =>  __('Sort by the number of reviews', 'geodirectory')
1902
-        );
1903
-        $fields[] = array(
1904
-            'post_type' => $post_type,
1905
-            'data_type' => '',
1906
-            'field_type' => 'float',
1907
-            'site_title' => __('Rating', 'geodirectory'),
1908
-            'htmlvar_name' => 'overall_rating',
1909
-            'field_icon' =>  'fa fa-star-o',
1910
-            'description' =>  __('Sort by the overall rating value', 'geodirectory')
1911
-        );
1912
-        $fields[] = array(
1913
-            'post_type' => $post_type,
1914
-            'data_type' => '',
1915
-            'field_type' => 'text',
1916
-            'site_title' => __('Title', 'geodirectory'),
1917
-            'htmlvar_name' => 'post_title',
1918
-            'field_icon' =>  'fa fa-sort-alpha-desc',
1919
-            'description' =>  __('Sort alphabetically by title', 'geodirectory')
1920
-        );
1921
-
1922
-        /**
1923
-         * Hook to add custom sort options.
1924
-         *
1925
-         * @since 1.0.0
1926
-         * @param array $fields Unmodified sort options array.
1927
-         * @param string $post_type Post type.
1928
-         */
1929
-        return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1930
-
1931
-    }
1932
-
1933
-    return false;
1864
+	global $wpdb;
1865
+
1866
+	if ($post_type != '') {
1867
+
1868
+		$all_postypes = geodir_get_posttypes();
1869
+
1870
+		if (!in_array($post_type, $all_postypes))
1871
+			return false;
1872
+
1873
+		$fields = array();
1874
+
1875
+		$fields[] = array(
1876
+			'post_type' => $post_type,
1877
+			'data_type' => '',
1878
+			'field_type' => 'random',
1879
+			'site_title' => 'Random',
1880
+			'htmlvar_name' => 'post_title',
1881
+			'field_icon' =>  'fa fa-random',
1882
+			'description' =>  __('Random sort (not recommended for large sites)', 'geodirectory')
1883
+		);
1884
+
1885
+		$fields[] = array(
1886
+			'post_type' => $post_type,
1887
+			'data_type' => '',
1888
+			'field_type' => 'datetime',
1889
+			'site_title' => __('Add date', 'geodirectory'),
1890
+			'htmlvar_name' => 'post_date',
1891
+			'field_icon' =>  'fa fa-calendar',
1892
+			'description' =>  __('Sort by date added', 'geodirectory')
1893
+		);
1894
+		$fields[] = array(
1895
+			'post_type' => $post_type,
1896
+			'data_type' => '',
1897
+			'field_type' => 'bigint',
1898
+			'site_title' => __('Review', 'geodirectory'),
1899
+			'htmlvar_name' => 'comment_count',
1900
+			'field_icon' =>  'fa fa-commenting-o',
1901
+			'description' =>  __('Sort by the number of reviews', 'geodirectory')
1902
+		);
1903
+		$fields[] = array(
1904
+			'post_type' => $post_type,
1905
+			'data_type' => '',
1906
+			'field_type' => 'float',
1907
+			'site_title' => __('Rating', 'geodirectory'),
1908
+			'htmlvar_name' => 'overall_rating',
1909
+			'field_icon' =>  'fa fa-star-o',
1910
+			'description' =>  __('Sort by the overall rating value', 'geodirectory')
1911
+		);
1912
+		$fields[] = array(
1913
+			'post_type' => $post_type,
1914
+			'data_type' => '',
1915
+			'field_type' => 'text',
1916
+			'site_title' => __('Title', 'geodirectory'),
1917
+			'htmlvar_name' => 'post_title',
1918
+			'field_icon' =>  'fa fa-sort-alpha-desc',
1919
+			'description' =>  __('Sort alphabetically by title', 'geodirectory')
1920
+		);
1921
+
1922
+		/**
1923
+		 * Hook to add custom sort options.
1924
+		 *
1925
+		 * @since 1.0.0
1926
+		 * @param array $fields Unmodified sort options array.
1927
+		 * @param string $post_type Post type.
1928
+		 */
1929
+		return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1930
+
1931
+	}
1932
+
1933
+	return false;
1934 1934
 }
1935 1935
 
1936 1936
 
@@ -1946,117 +1946,117 @@  discard block
 block discarded – undo
1946 1946
 function godir_set_sort_field_order($field_ids = array())
1947 1947
 {
1948 1948
 
1949
-    global $wpdb;
1949
+	global $wpdb;
1950 1950
 
1951
-    $count = 0;
1952
-    if (!empty($field_ids)):
1953
-        foreach ($field_ids as $id) {
1951
+	$count = 0;
1952
+	if (!empty($field_ids)):
1953
+		foreach ($field_ids as $id) {
1954 1954
 
1955
-            $cf = trim($id, '_');
1955
+			$cf = trim($id, '_');
1956 1956
 
1957
-            $post_meta_info = $wpdb->query(
1958
-                $wpdb->prepare(
1959
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1957
+			$post_meta_info = $wpdb->query(
1958
+				$wpdb->prepare(
1959
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1960 1960
 															sort_order=%d 
1961 1961
 															where id= %d",
1962
-                    array($count, $cf)
1963
-                )
1964
-            );
1965
-            $count++;
1966
-        }
1967
-
1968
-        return $field_ids;
1969
-    else:
1970
-        return false;
1971
-    endif;
1962
+					array($count, $cf)
1963
+				)
1964
+			);
1965
+			$count++;
1966
+		}
1967
+
1968
+		return $field_ids;
1969
+	else:
1970
+		return false;
1971
+	endif;
1972 1972
 }
1973 1973
 
1974 1974
 
1975 1975
 if (!function_exists('geodir_custom_sort_field_save')) {
1976
-    /**
1977
-     * Save or Update custom sort fields into the database.
1978
-     *
1979
-     * @since 1.0.0
1980
-     * @package GeoDirectory
1981
-     * @global object $wpdb WordPress Database object.
1982
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1983
-     * @param array $request_field {
1984
-     *    Attributes of the Request field.
1985
-     *
1986
-     *    @type string $action Ajax action name.
1987
-     *    @type string $manage_field_type Manage field type Default "sorting_options".
1988
-     *    @type string $create_field Do you want to create this field?.
1989
-     *    @type string $field_ins_upd Field created or updated?.
1990
-     *    @type string $_wpnonce Nonce value.
1991
-     *    @type string $listing_type The Post type.
1992
-     *    @type string $field_type Field Type.
1993
-     *    @type string $field_id Field ID.
1994
-     *    @type string $data_type Data Type.
1995
-     *    @type string $htmlvar_name HTML variable name.
1996
-     *    @type string $site_title Section title which you wish to display in frontend.
1997
-     *    @type string $is_default Is this default sorting?.
1998
-     *    @type string $is_active If not active then the field will not be displayed anywhere.
1999
-     *    @type string $sort_order Sort Order.
2000
-     *
2001
-     * }
2002
-     * @param bool $default Not yet implemented.
2003
-     * @return int Returns the last affected db table row id.
2004
-     */
2005
-    function geodir_custom_sort_field_save($request_field = array(), $default = false)
2006
-    {
2007
-
2008
-        global $wpdb, $plugin_prefix;
2009
-
2010
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2011
-
2012
-        $cf = trim($result_str, '_');
2013
-
2014
-        /*-------- check dublicate validation --------*/
2015
-
2016
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2017
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2018
-
2019
-        $post_type = $request_field['listing_type'];
2020
-        $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2021
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2022
-        $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2023
-        $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2024
-        $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2025
-        $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2026
-        $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2027
-        $asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2028
-        $desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2029
-        $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2030
-        $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2031
-
2032
-        $default_order = '';
2033
-        if ($is_default != '') {
2034
-            $default_order = $is_default;
2035
-            $is_default = '1';
2036
-        }
2037
-
2038
-
2039
-        $check_html_variable = $wpdb->get_var(
2040
-            $wpdb->prepare(
2041
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2042
-                array($cehhtmlvar_name, $post_type, $field_type)
2043
-            )
2044
-        );
2045
-
2046
-        if ($is_default == 1) {
2047
-
2048
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2049
-
2050
-        }
2051
-
2052
-
2053
-        if (!$check_html_variable) {
2054
-
2055
-            $wpdb->query(
2056
-
2057
-                $wpdb->prepare(
2058
-
2059
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1976
+	/**
1977
+	 * Save or Update custom sort fields into the database.
1978
+	 *
1979
+	 * @since 1.0.0
1980
+	 * @package GeoDirectory
1981
+	 * @global object $wpdb WordPress Database object.
1982
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1983
+	 * @param array $request_field {
1984
+	 *    Attributes of the Request field.
1985
+	 *
1986
+	 *    @type string $action Ajax action name.
1987
+	 *    @type string $manage_field_type Manage field type Default "sorting_options".
1988
+	 *    @type string $create_field Do you want to create this field?.
1989
+	 *    @type string $field_ins_upd Field created or updated?.
1990
+	 *    @type string $_wpnonce Nonce value.
1991
+	 *    @type string $listing_type The Post type.
1992
+	 *    @type string $field_type Field Type.
1993
+	 *    @type string $field_id Field ID.
1994
+	 *    @type string $data_type Data Type.
1995
+	 *    @type string $htmlvar_name HTML variable name.
1996
+	 *    @type string $site_title Section title which you wish to display in frontend.
1997
+	 *    @type string $is_default Is this default sorting?.
1998
+	 *    @type string $is_active If not active then the field will not be displayed anywhere.
1999
+	 *    @type string $sort_order Sort Order.
2000
+	 *
2001
+	 * }
2002
+	 * @param bool $default Not yet implemented.
2003
+	 * @return int Returns the last affected db table row id.
2004
+	 */
2005
+	function geodir_custom_sort_field_save($request_field = array(), $default = false)
2006
+	{
2007
+
2008
+		global $wpdb, $plugin_prefix;
2009
+
2010
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2011
+
2012
+		$cf = trim($result_str, '_');
2013
+
2014
+		/*-------- check dublicate validation --------*/
2015
+
2016
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2017
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2018
+
2019
+		$post_type = $request_field['listing_type'];
2020
+		$data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2021
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2022
+		$site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2023
+		$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2024
+		$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2025
+		$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2026
+		$is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2027
+		$asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2028
+		$desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2029
+		$asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2030
+		$desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2031
+
2032
+		$default_order = '';
2033
+		if ($is_default != '') {
2034
+			$default_order = $is_default;
2035
+			$is_default = '1';
2036
+		}
2037
+
2038
+
2039
+		$check_html_variable = $wpdb->get_var(
2040
+			$wpdb->prepare(
2041
+				"select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2042
+				array($cehhtmlvar_name, $post_type, $field_type)
2043
+			)
2044
+		);
2045
+
2046
+		if ($is_default == 1) {
2047
+
2048
+			$wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2049
+
2050
+		}
2051
+
2052
+
2053
+		if (!$check_html_variable) {
2054
+
2055
+			$wpdb->query(
2056
+
2057
+				$wpdb->prepare(
2058
+
2059
+					"insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2060 2060
 				post_type = %s,
2061 2061
 				data_type = %s,
2062 2062
 				field_type = %s,
@@ -2071,23 +2071,23 @@  discard block
 block discarded – undo
2071 2071
 				asc_title = %s,
2072 2072
 				desc_title = %s",
2073 2073
 
2074
-                    array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title)
2075
-                )
2074
+					array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title)
2075
+				)
2076 2076
 
2077
-            );
2077
+			);
2078 2078
 
2079 2079
 
2080
-            $lastid = $wpdb->insert_id;
2080
+			$lastid = $wpdb->insert_id;
2081 2081
 
2082
-            $lastid = trim($lastid);
2082
+			$lastid = trim($lastid);
2083 2083
 
2084
-        } else {
2084
+		} else {
2085 2085
 
2086
-            $wpdb->query(
2086
+			$wpdb->query(
2087 2087
 
2088
-                $wpdb->prepare(
2088
+				$wpdb->prepare(
2089 2089
 
2090
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2090
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2091 2091
 				post_type = %s,
2092 2092
 				data_type = %s,
2093 2093
 				field_type = %s,
@@ -2103,123 +2103,123 @@  discard block
 block discarded – undo
2103 2103
 				desc_title = %s
2104 2104
 				where id = %d",
2105 2105
 
2106
-                    array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf)
2107
-                )
2106
+					array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf)
2107
+				)
2108 2108
 
2109
-            );
2109
+			);
2110 2110
 
2111
-            $lastid = trim($cf);
2111
+			$lastid = trim($cf);
2112 2112
 
2113
-        }
2113
+		}
2114 2114
 
2115 2115
 
2116
-        return (int)$lastid;
2116
+		return (int)$lastid;
2117 2117
 
2118
-    }
2118
+	}
2119 2119
 }
2120 2120
 
2121 2121
 
2122 2122
 if (!function_exists('geodir_custom_sort_field_delete')) {
2123
-    /**
2124
-     * Delete a custom sort field using field id.
2125
-     * @since 1.0.0
2126
-     * @package GeoDirectory
2127
-     * @global object $wpdb WordPress Database object.
2128
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2129
-     * @param string $field_id The field ID.
2130
-     * @return int|string Returns field id when successful deletion, else returns 0.
2131
-     */
2132
-    function geodir_custom_sort_field_delete($field_id = '')
2133
-    {
2134
-
2135
-        global $wpdb, $plugin_prefix;
2136
-        if ($field_id != '') {
2137
-            $cf = trim($field_id, '_');
2138
-
2139
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2140
-
2141
-            return $field_id;
2142
-
2143
-        } else
2144
-            return 0;
2145
-
2146
-    }
2123
+	/**
2124
+	 * Delete a custom sort field using field id.
2125
+	 * @since 1.0.0
2126
+	 * @package GeoDirectory
2127
+	 * @global object $wpdb WordPress Database object.
2128
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2129
+	 * @param string $field_id The field ID.
2130
+	 * @return int|string Returns field id when successful deletion, else returns 0.
2131
+	 */
2132
+	function geodir_custom_sort_field_delete($field_id = '')
2133
+	{
2134
+
2135
+		global $wpdb, $plugin_prefix;
2136
+		if ($field_id != '') {
2137
+			$cf = trim($field_id, '_');
2138
+
2139
+			$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2140
+
2141
+			return $field_id;
2142
+
2143
+		} else
2144
+			return 0;
2145
+
2146
+	}
2147 2147
 }
2148 2148
 
2149 2149
 
2150 2150
 if (!function_exists('geodir_custom_sort_field_adminhtml')) {
2151
-    /**
2152
-     * Custom sort field admin html.
2153
-     *
2154
-     * @since 1.0.0
2155
-     * @package GeoDirectory
2156
-     * @global object $wpdb WordPress Database object.
2157
-     * @param string $field_type The form field type.
2158
-     * @param object|int $result_str The custom field results object or row id.
2159
-     * @param string $field_ins_upd When set to "submit" displays form.
2160
-     * @param bool $default when set to true field will be for admin use only.
2161
-     */
2162
-    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2163
-    {
2164
-        global $wpdb;
2165
-        $cf = $result_str;
2166
-        if (!is_object($cf)) {
2167
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2168
-        } else {
2169
-            $field_info = $cf;
2170
-            $result_str = $cf->id;
2171
-        }
2172
-
2173
-        $field_info = stripslashes_deep($field_info); // strip slashes
2174
-
2175
-        if (!isset($field_info->post_type)) {
2176
-            $post_type = sanitize_text_field($_REQUEST['listing_type']);
2177
-        } else {
2178
-            $post_type = $field_info->post_type;
2179
-        }
2180
-
2181
-
2182
-        $htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2183
-
2184
-        $site_title = '';
2185
-        if ($site_title == '')
2186
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2187
-
2188
-        if ($site_title == '') {
2189
-            $fields = geodir_get_custom_sort_options($post_type);
2190
-
2191
-            foreach ($fields as $val) {
2192
-                $val = stripslashes_deep($val); // strip slashes
2193
-
2194
-                if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2195
-                    $site_title = isset($val['site_title']) ? $val['site_title'] : '';
2196
-                }
2197
-            }
2198
-        }
2199
-
2200
-        if ($htmlvar_name == '')
2201
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2202
-
2203
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
2204
-
2205
-        $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2206
-        $cso_arr = geodir_get_custom_sort_options($post_type);
2207
-
2208
-        $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2209
-        foreach($cso_arr as $cso){
2210
-            if($cur_field_type==$cso['field_type']){
2211
-
2212
-                if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2213
-                    $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2214
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2215
-                    $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2216
-                }
2217
-
2218
-            }
2219
-        }
2220
-
2221
-        $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2222
-        ?>
2151
+	/**
2152
+	 * Custom sort field admin html.
2153
+	 *
2154
+	 * @since 1.0.0
2155
+	 * @package GeoDirectory
2156
+	 * @global object $wpdb WordPress Database object.
2157
+	 * @param string $field_type The form field type.
2158
+	 * @param object|int $result_str The custom field results object or row id.
2159
+	 * @param string $field_ins_upd When set to "submit" displays form.
2160
+	 * @param bool $default when set to true field will be for admin use only.
2161
+	 */
2162
+	function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2163
+	{
2164
+		global $wpdb;
2165
+		$cf = $result_str;
2166
+		if (!is_object($cf)) {
2167
+			$field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2168
+		} else {
2169
+			$field_info = $cf;
2170
+			$result_str = $cf->id;
2171
+		}
2172
+
2173
+		$field_info = stripslashes_deep($field_info); // strip slashes
2174
+
2175
+		if (!isset($field_info->post_type)) {
2176
+			$post_type = sanitize_text_field($_REQUEST['listing_type']);
2177
+		} else {
2178
+			$post_type = $field_info->post_type;
2179
+		}
2180
+
2181
+
2182
+		$htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2183
+
2184
+		$site_title = '';
2185
+		if ($site_title == '')
2186
+			$site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2187
+
2188
+		if ($site_title == '') {
2189
+			$fields = geodir_get_custom_sort_options($post_type);
2190
+
2191
+			foreach ($fields as $val) {
2192
+				$val = stripslashes_deep($val); // strip slashes
2193
+
2194
+				if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2195
+					$site_title = isset($val['site_title']) ? $val['site_title'] : '';
2196
+				}
2197
+			}
2198
+		}
2199
+
2200
+		if ($htmlvar_name == '')
2201
+			$htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2202
+
2203
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
2204
+
2205
+		$field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2206
+		$cso_arr = geodir_get_custom_sort_options($post_type);
2207
+
2208
+		$cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2209
+		foreach($cso_arr as $cso){
2210
+			if($cur_field_type==$cso['field_type']){
2211
+
2212
+				if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2213
+					$field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2214
+				}elseif(isset($cso['field_icon']) && $cso['field_icon']){
2215
+					$field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2216
+				}
2217
+
2218
+			}
2219
+		}
2220
+
2221
+		$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2222
+		?>
2223 2223
 
2224 2224
         <li class="text" id="licontainer_<?php echo $result_str;?>">
2225 2225
             <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
@@ -2228,7 +2228,7 @@  discard block
 block discarded – undo
2228 2228
                  ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
2229 2229
                 <?php
2230 2230
 
2231
-                ?>
2231
+				?>
2232 2232
 
2233 2233
                 <div title="<?php _e('Click to remove field', 'geodirectory');?>"
2234 2234
                      onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
@@ -2243,17 +2243,17 @@  discard block
 block discarded – undo
2243 2243
 
2244 2244
             <div id="field_frm<?php echo $result_str;?>" class="field_frm"
2245 2245
                  style="display:<?php if ($field_ins_upd == 'submit') {
2246
-                     echo 'block;';
2247
-                 } else {
2248
-                     echo 'none;';
2249
-                 } ?>">
2246
+					 echo 'block;';
2247
+				 } else {
2248
+					 echo 'none;';
2249
+				 } ?>">
2250 2250
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
2251 2251
                 <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
2252 2252
                 <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
2253 2253
                 <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
2254 2254
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
2255
-                    echo $field_info->data_type;
2256
-                }?>"/>
2255
+					echo $field_info->data_type;
2256
+				}?>"/>
2257 2257
                 <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
2258 2258
 
2259 2259
 
@@ -2276,14 +2276,14 @@  discard block
 block discarded – undo
2276 2276
 
2277 2277
                                 <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled"  value="1"
2278 2278
                                     <?php if ($value == '1') {
2279
-                                        echo 'checked';
2280
-                                    } ?>/>
2279
+										echo 'checked';
2280
+									} ?>/>
2281 2281
                                 <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2282 2282
 
2283 2283
                                 <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0"
2284 2284
                                     <?php if ($value == '0' || !$value) {
2285
-                                        echo 'checked';
2286
-                                    } ?>/>
2285
+										echo 'checked';
2286
+									} ?>/>
2287 2287
                                 <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2288 2288
 
2289 2289
                             </div>
@@ -2320,8 +2320,8 @@  discard block
 block discarded – undo
2320 2320
 
2321 2321
                                 <input type="radio" name="is_default"
2322 2322
                                        value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
2323
-                                    echo 'checked="checked"';
2324
-                                } ?>/>
2323
+									echo 'checked="checked"';
2324
+								} ?>/>
2325 2325
                             </div>
2326 2326
 
2327 2327
                         </li>
@@ -2341,14 +2341,14 @@  discard block
 block discarded – undo
2341 2341
 
2342 2342
                                 <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled"  value="1"
2343 2343
                                     <?php if ($value == '1') {
2344
-                                        echo 'checked';
2345
-                                    } ?>/>
2344
+										echo 'checked';
2345
+									} ?>/>
2346 2346
                                 <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2347 2347
 
2348 2348
                                 <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0"
2349 2349
                                     <?php if ($value == '0' || !$value) {
2350
-                                        echo 'checked';
2351
-                                    } ?>/>
2350
+										echo 'checked';
2351
+									} ?>/>
2352 2352
                                 <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2353 2353
 
2354 2354
                             </div>
@@ -2384,8 +2384,8 @@  discard block
 block discarded – undo
2384 2384
 
2385 2385
                                 <input type="radio" name="is_default"
2386 2386
                                        value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
2387
-                                    echo 'checked="checked"';
2388
-                                } ?>/>
2387
+									echo 'checked="checked"';
2388
+								} ?>/>
2389 2389
                             </div>
2390 2390
 
2391 2391
                         </li>
@@ -2427,8 +2427,8 @@  discard block
 block discarded – undo
2427 2427
 
2428 2428
                                 <input type="checkbox" name="is_default"
2429 2429
                                        value="<?php echo $field_type; ?>"  <?php if (isset($value) && $value == '1') {
2430
-                                    echo 'checked="checked"';
2431
-                                } ?>/>
2430
+									echo 'checked="checked"';
2431
+								} ?>/>
2432 2432
                             </div>
2433 2433
 
2434 2434
 
@@ -2451,14 +2451,14 @@  discard block
 block discarded – undo
2451 2451
 
2452 2452
                             <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
2453 2453
                                 <?php if ($value == '1') {
2454
-                                    echo 'checked';
2455
-                                } ?>/>
2454
+									echo 'checked';
2455
+								} ?>/>
2456 2456
                             <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2457 2457
 
2458 2458
                             <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
2459 2459
                                 <?php if ($value == '0' || !$value) {
2460
-                                    echo 'checked';
2461
-                                } ?>/>
2460
+									echo 'checked';
2461
+								} ?>/>
2462 2462
                             <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2463 2463
 
2464 2464
                         </div>
@@ -2468,8 +2468,8 @@  discard block
 block discarded – undo
2468 2468
 
2469 2469
                     <input type="hidden" readonly="readonly" name="sort_order" id="sort_order"
2470 2470
                                                 value="<?php if (isset($field_info->sort_order)) {
2471
-                                                    echo esc_attr($field_info->sort_order);
2472
-                                                }?>" size="50"/>
2471
+													echo esc_attr($field_info->sort_order);
2472
+												}?>" size="50"/>
2473 2473
 
2474 2474
 
2475 2475
 
@@ -2493,38 +2493,38 @@  discard block
 block discarded – undo
2493 2493
             </form>
2494 2494
         </li> <?php
2495 2495
 
2496
-    }
2496
+	}
2497 2497
 }
2498 2498
 
2499 2499
 if (!function_exists('check_field_visibility')) {
2500
-    /**
2501
-     * Check field visibility as per price package.
2502
-     *
2503
-     * @since 1.0.0
2504
-     * @package GeoDirectory
2505
-     * @global object $wpdb WordPress Database object.
2506
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
2507
-     * @param int|string $package_id The package ID.
2508
-     * @param string $field_name The field name.
2509
-     * @param string $post_type Optional. The wordpress post type.
2510
-     * @return bool Returns true when field visible, otherwise false.
2511
-     */
2512
-    function check_field_visibility($package_id, $field_name, $post_type)
2513
-    {
2514
-        global $wpdb, $geodir_addon_list;
2515
-        if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2516
-            return true;
2517
-        }
2518
-        if (!$package_id || !$field_name || !$post_type) {
2519
-            return true;
2520
-        }
2521
-        $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
2522
-
2523
-        if ($wpdb->get_var($sql)) {
2524
-            return true;
2525
-        }
2526
-        return false;
2527
-    }
2500
+	/**
2501
+	 * Check field visibility as per price package.
2502
+	 *
2503
+	 * @since 1.0.0
2504
+	 * @package GeoDirectory
2505
+	 * @global object $wpdb WordPress Database object.
2506
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
2507
+	 * @param int|string $package_id The package ID.
2508
+	 * @param string $field_name The field name.
2509
+	 * @param string $post_type Optional. The wordpress post type.
2510
+	 * @return bool Returns true when field visible, otherwise false.
2511
+	 */
2512
+	function check_field_visibility($package_id, $field_name, $post_type)
2513
+	{
2514
+		global $wpdb, $geodir_addon_list;
2515
+		if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2516
+			return true;
2517
+		}
2518
+		if (!$package_id || !$field_name || !$post_type) {
2519
+			return true;
2520
+		}
2521
+		$sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
2522
+
2523
+		if ($wpdb->get_var($sql)) {
2524
+			return true;
2525
+		}
2526
+		return false;
2527
+	}
2528 2528
 }
2529 2529
 
2530 2530
 /**
@@ -2539,43 +2539,43 @@  discard block
 block discarded – undo
2539 2539
  */
2540 2540
 function geodir_string_to_options($input = '', $translated = false)
2541 2541
 {
2542
-    $return = array();
2543
-    if ($input != '') {
2544
-        $input = trim($input);
2545
-        $input = rtrim($input, ",");
2546
-        $input = ltrim($input, ",");
2547
-        $input = trim($input);
2548
-    }
2549
-
2550
-    $input_arr = explode(',', $input);
2551
-
2552
-    if (!empty($input_arr)) {
2553
-        foreach ($input_arr as $input_str) {
2554
-            $input_str = trim($input_str);
2555
-
2556
-            if (strpos($input_str, "/") !== false) {
2557
-                $input_str = explode("/", $input_str, 2);
2558
-                $label = trim($input_str[0]);
2559
-                if ($translated && $label != '') {
2560
-                    $label = __($label, 'geodirectory');
2561
-                }
2562
-                $label = ucfirst($label);
2563
-                $value = trim($input_str[1]);
2564
-            } else {
2565
-                if ($translated && $input_str != '') {
2566
-                    $input_str = __($input_str, 'geodirectory');
2567
-                }
2568
-                $label = ucfirst($input_str);
2569
-                $value = $input_str;
2570
-            }
2571
-
2572
-            if ($label != '') {
2573
-                $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2574
-            }
2575
-        }
2576
-    }
2577
-
2578
-    return $return;
2542
+	$return = array();
2543
+	if ($input != '') {
2544
+		$input = trim($input);
2545
+		$input = rtrim($input, ",");
2546
+		$input = ltrim($input, ",");
2547
+		$input = trim($input);
2548
+	}
2549
+
2550
+	$input_arr = explode(',', $input);
2551
+
2552
+	if (!empty($input_arr)) {
2553
+		foreach ($input_arr as $input_str) {
2554
+			$input_str = trim($input_str);
2555
+
2556
+			if (strpos($input_str, "/") !== false) {
2557
+				$input_str = explode("/", $input_str, 2);
2558
+				$label = trim($input_str[0]);
2559
+				if ($translated && $label != '') {
2560
+					$label = __($label, 'geodirectory');
2561
+				}
2562
+				$label = ucfirst($label);
2563
+				$value = trim($input_str[1]);
2564
+			} else {
2565
+				if ($translated && $input_str != '') {
2566
+					$input_str = __($input_str, 'geodirectory');
2567
+				}
2568
+				$label = ucfirst($input_str);
2569
+				$value = $input_str;
2570
+			}
2571
+
2572
+			if ($label != '') {
2573
+				$return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2574
+			}
2575
+		}
2576
+	}
2577
+
2578
+	return $return;
2579 2579
 }
2580 2580
 
2581 2581
 /**
@@ -2590,59 +2590,59 @@  discard block
 block discarded – undo
2590 2590
  */
2591 2591
 function geodir_string_values_to_options($option_values = '', $translated = false)
2592 2592
 {
2593
-    $options = array();
2594
-    if ($option_values == '') {
2595
-        return NULL;
2596
-    }
2597
-
2598
-    if (strpos($option_values, "{/optgroup}") !== false) {
2599
-        $option_values_arr = explode("{/optgroup}", $option_values);
2600
-
2601
-        foreach ($option_values_arr as $optgroup) {
2602
-            if (strpos($optgroup, "{optgroup}") !== false) {
2603
-                $optgroup_arr = explode("{optgroup}", $optgroup);
2604
-
2605
-                $count = 0;
2606
-                foreach ($optgroup_arr as $optgroup_str) {
2607
-                    $count++;
2608
-                    $optgroup_str = trim($optgroup_str);
2609
-
2610
-                    $optgroup_label = '';
2611
-                    if (strpos($optgroup_str, "|") !== false) {
2612
-                        $optgroup_str_arr = explode("|", $optgroup_str, 2);
2613
-                        $optgroup_label = trim($optgroup_str_arr[0]);
2614
-                        if ($translated && $optgroup_label != '') {
2615
-                            $optgroup_label = __($optgroup_label, 'geodirectory');
2616
-                        }
2617
-                        $optgroup_label = ucfirst($optgroup_label);
2618
-                        $optgroup_str = $optgroup_str_arr[1];
2619
-                    }
2620
-
2621
-                    $optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2622
-
2623
-                    if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2624
-                        $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2625
-                        $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2626
-                        $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2627
-                    }
2628
-                    $options = array_merge($options, $optgroup3);
2629
-                }
2630
-            } else {
2631
-                $optgroup1 = geodir_string_to_options($optgroup, $translated);
2632
-                $options = array_merge($options, $optgroup1);
2633
-            }
2634
-        }
2635
-    } else {
2636
-        $options = geodir_string_to_options($option_values, $translated);
2637
-    }
2638
-
2639
-    return $options;
2593
+	$options = array();
2594
+	if ($option_values == '') {
2595
+		return NULL;
2596
+	}
2597
+
2598
+	if (strpos($option_values, "{/optgroup}") !== false) {
2599
+		$option_values_arr = explode("{/optgroup}", $option_values);
2600
+
2601
+		foreach ($option_values_arr as $optgroup) {
2602
+			if (strpos($optgroup, "{optgroup}") !== false) {
2603
+				$optgroup_arr = explode("{optgroup}", $optgroup);
2604
+
2605
+				$count = 0;
2606
+				foreach ($optgroup_arr as $optgroup_str) {
2607
+					$count++;
2608
+					$optgroup_str = trim($optgroup_str);
2609
+
2610
+					$optgroup_label = '';
2611
+					if (strpos($optgroup_str, "|") !== false) {
2612
+						$optgroup_str_arr = explode("|", $optgroup_str, 2);
2613
+						$optgroup_label = trim($optgroup_str_arr[0]);
2614
+						if ($translated && $optgroup_label != '') {
2615
+							$optgroup_label = __($optgroup_label, 'geodirectory');
2616
+						}
2617
+						$optgroup_label = ucfirst($optgroup_label);
2618
+						$optgroup_str = $optgroup_str_arr[1];
2619
+					}
2620
+
2621
+					$optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2622
+
2623
+					if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2624
+						$optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2625
+						$optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2626
+						$optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2627
+					}
2628
+					$options = array_merge($options, $optgroup3);
2629
+				}
2630
+			} else {
2631
+				$optgroup1 = geodir_string_to_options($optgroup, $translated);
2632
+				$options = array_merge($options, $optgroup1);
2633
+			}
2634
+		}
2635
+	} else {
2636
+		$options = geodir_string_to_options($option_values, $translated);
2637
+	}
2638
+
2639
+	return $options;
2640 2640
 }
2641 2641
 
2642 2642
 
2643 2643
 function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
2644
-    ob_start();
2645
-    ?>
2644
+	ob_start();
2645
+	?>
2646 2646
     <li>
2647 2647
         <label for="data_type""><?php _e('Field Data Type ? :', 'geodirectory'); ?></label>
2648 2648
         <div class="gd-cf-input-wrap">
@@ -2651,16 +2651,16 @@  discard block
 block discarded – undo
2651 2651
                     onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');">
2652 2652
                 <option
2653 2653
                     value="XVARCHAR" <?php if (isset($field_info->data_type) && $field_info->data_type == 'VARCHAR') {
2654
-                    echo 'selected="selected"';
2655
-                } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2654
+					echo 'selected="selected"';
2655
+				} ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2656 2656
                 <option
2657 2657
                     value="INT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'INT') {
2658
-                    echo 'selected="selected"';
2659
-                } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2658
+					echo 'selected="selected"';
2659
+				} ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2660 2660
                 <option
2661 2661
                     value="FLOAT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'FLOAT') {
2662
-                    echo 'selected="selected"';
2663
-                } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2662
+					echo 'selected="selected"';
2663
+				} ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2664 2664
             </select>
2665 2665
             <br/> <span><?php _e('Select Custom Field type', 'geodirectory'); ?></span>
2666 2666
 
@@ -2673,8 +2673,8 @@  discard block
 block discarded – undo
2673 2673
             <select name="decimal_point" id="decimal_point">
2674 2674
                 <option value=""><?php echo _e('Select', 'geodirectory'); ?></option>
2675 2675
                 <?php for ($i = 1; $i <= 10; $i++) {
2676
-                    $decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : '';
2677
-                    $selected = $i == $decimal_point ? 'selected="selected"' : ''; ?>
2676
+					$decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : '';
2677
+					$selected = $i == $decimal_point ? 'selected="selected"' : ''; ?>
2678 2678
                     <option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>
2679 2679
                 <?php } ?>
2680 2680
             </select>
@@ -2683,8 +2683,8 @@  discard block
 block discarded – undo
2683 2683
     </li>
2684 2684
 <?php
2685 2685
 
2686
-    $output = ob_get_clean();
2687
-    return $output;
2686
+	$output = ob_get_clean();
2687
+	return $output;
2688 2688
 }
2689 2689
 add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
2690 2690
 
@@ -2722,9 +2722,9 @@  discard block
 block discarded – undo
2722 2722
 
2723 2723
 
2724 2724
 function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
2725
-    if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2726
-    ob_start();
2727
-    ?>
2725
+	if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2726
+	ob_start();
2727
+	?>
2728 2728
     <li>
2729 2729
         <label for="advanced_editor" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show advanced editor :', 'geodirectory'); ?>
2730 2730
             <div class="gdcf-tooltip">
@@ -2735,13 +2735,13 @@  discard block
 block discarded – undo
2735 2735
         <div class="gd-cf-input-wrap">
2736 2736
 
2737 2737
             <?php
2738
-            $selected = '';
2739
-            if (isset($field_info->extra_fields))
2740
-                $advanced_editor = unserialize($field_info->extra_fields);
2738
+			$selected = '';
2739
+			if (isset($field_info->extra_fields))
2740
+				$advanced_editor = unserialize($field_info->extra_fields);
2741 2741
 
2742
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2743
-                $selected = 'checked="checked"';
2744
-            ?>
2742
+			if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2743
+				$selected = 'checked="checked"';
2744
+			?>
2745 2745
 
2746 2746
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
2747 2747
                    value="1" <?php echo $selected; ?>/>
@@ -2750,22 +2750,22 @@  discard block
 block discarded – undo
2750 2750
     </li>
2751 2751
     <?php
2752 2752
 
2753
-    $output = ob_get_clean();
2754
-    return $output;
2753
+	$output = ob_get_clean();
2754
+	return $output;
2755 2755
 }
2756 2756
 add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
2757 2757
 
2758 2758
 
2759 2759
 function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
2760
-    ob_start();
2761
-
2762
-    $value = '';
2763
-    if (isset($field_info->validation_pattern)) {
2764
-        $value = esc_attr($field_info->validation_pattern);
2765
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2766
-        $value = esc_attr($cf['defaults']['validation_pattern']);
2767
-    }
2768
-    ?>
2760
+	ob_start();
2761
+
2762
+	$value = '';
2763
+	if (isset($field_info->validation_pattern)) {
2764
+		$value = esc_attr($field_info->validation_pattern);
2765
+	}elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2766
+		$value = esc_attr($cf['defaults']['validation_pattern']);
2767
+	}
2768
+	?>
2769 2769
     <li>
2770 2770
         <label for="validation_pattern" class="gd-cf-tooltip-wrap">
2771 2771
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Pattern:', 'geodirectory'); ?>
@@ -2779,13 +2779,13 @@  discard block
 block discarded – undo
2779 2779
         </div>
2780 2780
     </li>
2781 2781
     <?php
2782
-    $value = '';
2783
-    if (isset($field_info->validation_msg)) {
2784
-        $value = esc_attr($field_info->validation_msg);
2785
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2786
-        $value = esc_attr($cf['defaults']['validation_msg']);
2787
-    }
2788
-    ?>
2782
+	$value = '';
2783
+	if (isset($field_info->validation_msg)) {
2784
+		$value = esc_attr($field_info->validation_msg);
2785
+	}elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2786
+		$value = esc_attr($cf['defaults']['validation_msg']);
2787
+	}
2788
+	?>
2789 2789
     <li>
2790 2790
         <label for="validation_msg" class="gd-cf-tooltip-wrap">
2791 2791
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Message:', 'geodirectory'); ?>
@@ -2800,21 +2800,21 @@  discard block
 block discarded – undo
2800 2800
     </li>
2801 2801
     <?php
2802 2802
 
2803
-    $output = ob_get_clean();
2804
-    return $output;
2803
+	$output = ob_get_clean();
2804
+	return $output;
2805 2805
 }
2806 2806
 add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
2807 2807
 
2808 2808
 
2809 2809
 function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
2810
-    ob_start();
2811
-    global $post_type;
2812
-
2813
-    if (!isset($field_info->post_type)) {
2814
-        $post_type = sanitize_text_field($_REQUEST['listing_type']);
2815
-    } else
2816
-        $post_type = $field_info->post_type;
2817
-    ?>
2810
+	ob_start();
2811
+	global $post_type;
2812
+
2813
+	if (!isset($field_info->post_type)) {
2814
+		$post_type = sanitize_text_field($_REQUEST['listing_type']);
2815
+	} else
2816
+		$post_type = $field_info->post_type;
2817
+	?>
2818 2818
     <li style="display: none;">
2819 2819
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
2820 2820
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Select taxonomy:', 'geodirectory'); ?>
@@ -2825,15 +2825,15 @@  discard block
 block discarded – undo
2825 2825
         <div class="gd-cf-input-wrap">
2826 2826
             <select name="htmlvar_name" id="htmlvar_name">
2827 2827
                 <?php
2828
-                $gd_taxonomy = geodir_get_taxonomies($post_type);
2828
+				$gd_taxonomy = geodir_get_taxonomies($post_type);
2829 2829
 
2830
-                foreach ($gd_taxonomy as $gd_tax) {
2831
-                    ?>
2830
+				foreach ($gd_taxonomy as $gd_tax) {
2831
+					?>
2832 2832
                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
2833
-                        echo 'selected="selected"';
2834
-                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2835
-                }
2836
-                ?>
2833
+						echo 'selected="selected"';
2834
+					}?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2835
+				}
2836
+				?>
2837 2837
             </select>
2838 2838
         </div>
2839 2839
     </li>
@@ -2849,49 +2849,49 @@  discard block
 block discarded – undo
2849 2849
 
2850 2850
             <select name="cat_display_type" id="cat_display_type">
2851 2851
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
2852
-                    echo 'selected="selected"';
2853
-                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2852
+					echo 'selected="selected"';
2853
+				}?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2854 2854
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2855
-                    echo 'selected="selected"';
2856
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2855
+					echo 'selected="selected"';
2856
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
2857 2857
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
2858
-                    echo 'selected="selected"';
2859
-                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2858
+					echo 'selected="selected"';
2859
+				}?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2860 2860
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2861
-                    echo 'selected="selected"';
2862
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2861
+					echo 'selected="selected"';
2862
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2863 2863
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2864
-                    echo 'selected="selected"';
2865
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2864
+					echo 'selected="selected"';
2865
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2866 2866
             </select>
2867 2867
         </div>
2868 2868
     </li>
2869 2869
     <?php
2870 2870
 
2871
-    $output = ob_get_clean();
2872
-    return $output;
2871
+	$output = ob_get_clean();
2872
+	return $output;
2873 2873
 }
2874 2874
 add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
2875 2875
 
2876 2876
 
2877 2877
 function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
2878 2878
 
2879
-    ob_start();
2880
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2881
-        $address = unserialize($field_info->extra_fields);
2882
-    }
2879
+	ob_start();
2880
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2881
+		$address = unserialize($field_info->extra_fields);
2882
+	}
2883 2883
 
2884
-    $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2885
-    ?>
2884
+	$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2885
+	?>
2886 2886
     <?php
2887
-    /**
2888
-     * Called on the add custom fields settings page before the address field is output.
2889
-     *
2890
-     * @since 1.0.0
2891
-     * @param array $address The address settings array.
2892
-     * @param object $field_info Extra fields info.
2893
-     */
2894
-    do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2887
+	/**
2888
+	 * Called on the add custom fields settings page before the address field is output.
2889
+	 *
2890
+	 * @since 1.0.0
2891
+	 * @param array $address The address settings array.
2892
+	 * @param object $field_info Extra fields info.
2893
+	 */
2894
+	do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2895 2895
 
2896 2896
     <li>
2897 2897
         <label for="show_zip" class="gd-cf-tooltip-wrap">
@@ -2904,14 +2904,14 @@  discard block
 block discarded – undo
2904 2904
 
2905 2905
             <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2906 2906
                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
2907
-                    echo 'checked';
2908
-                } ?>/>
2907
+					echo 'checked';
2908
+				} ?>/>
2909 2909
             <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2910 2910
 
2911 2911
             <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2912 2912
                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
2913
-                    echo 'checked';
2914
-                } ?>/>
2913
+					echo 'checked';
2914
+				} ?>/>
2915 2915
             <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2916 2916
 
2917 2917
 
@@ -2928,8 +2928,8 @@  discard block
 block discarded – undo
2928 2928
         <div class="gd-cf-input-wrap">
2929 2929
             <input type="text" name="extra[zip_lable]" id="zip_lable"
2930 2930
                    value="<?php if (isset($address['zip_lable'])) {
2931
-                       echo esc_attr($address['zip_lable']);
2932
-                   }?>"/>
2931
+					   echo esc_attr($address['zip_lable']);
2932
+				   }?>"/>
2933 2933
         </div>
2934 2934
     </li>
2935 2935
 
@@ -2946,8 +2946,8 @@  discard block
 block discarded – undo
2946 2946
         <div class="gd-cf-input-wrap">
2947 2947
             <input type="text" name="extra[map_lable]" id="map_lable"
2948 2948
                    value="<?php if (isset($address['map_lable'])) {
2949
-                       echo esc_attr($address['map_lable']);
2950
-                   }?>"/>
2949
+					   echo esc_attr($address['map_lable']);
2950
+				   }?>"/>
2951 2951
         </div>
2952 2952
     </li>
2953 2953
 
@@ -2962,14 +2962,14 @@  discard block
 block discarded – undo
2962 2962
 
2963 2963
             <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2964 2964
                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
2965
-                    echo 'checked';
2966
-                } ?>/>
2965
+					echo 'checked';
2966
+				} ?>/>
2967 2967
             <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2968 2968
 
2969 2969
             <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2970 2970
                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
2971
-                    echo 'checked';
2972
-                } ?>/>
2971
+					echo 'checked';
2972
+				} ?>/>
2973 2973
             <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2974 2974
 
2975 2975
         </div>
@@ -2986,14 +2986,14 @@  discard block
 block discarded – undo
2986 2986
 
2987 2987
             <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
2988 2988
                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
2989
-                    echo 'checked';
2990
-                } ?>/>
2989
+					echo 'checked';
2990
+				} ?>/>
2991 2991
             <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2992 2992
 
2993 2993
             <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
2994 2994
                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
2995
-                    echo 'checked';
2996
-                } ?>/>
2995
+					echo 'checked';
2996
+				} ?>/>
2997 2997
             <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2998 2998
 
2999 2999
         </div>
@@ -3010,8 +3010,8 @@  discard block
 block discarded – undo
3010 3010
         <div class="gd-cf-input-wrap">
3011 3011
             <input type="text" name="extra[mapview_lable]" id="mapview_lable"
3012 3012
                    value="<?php if (isset($address['mapview_lable'])) {
3013
-                       echo esc_attr($address['mapview_lable']);
3014
-                   }?>"/>
3013
+					   echo esc_attr($address['mapview_lable']);
3014
+				   }?>"/>
3015 3015
         </div>
3016 3016
     </li>
3017 3017
     <li>
@@ -3025,29 +3025,29 @@  discard block
 block discarded – undo
3025 3025
 
3026 3026
             <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3027 3027
                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
3028
-                    echo 'checked';
3029
-                } ?>/>
3028
+					echo 'checked';
3029
+				} ?>/>
3030 3030
             <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3031 3031
 
3032 3032
             <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3033 3033
                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
3034
-                    echo 'checked';
3035
-                } ?>/>
3034
+					echo 'checked';
3035
+				} ?>/>
3036 3036
             <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3037 3037
 
3038 3038
         </div>
3039 3039
     </li>
3040 3040
     <?php
3041 3041
 
3042
-    $output = ob_get_clean();
3043
-    return $output;
3042
+	$output = ob_get_clean();
3043
+	return $output;
3044 3044
 }
3045 3045
 add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
3046 3046
 
3047 3047
 
3048 3048
 function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
3049
-    ob_start();
3050
-    ?>
3049
+	ob_start();
3050
+	?>
3051 3051
     <li>
3052 3052
         <label for="multi_display_type" class="gd-cf-tooltip-wrap">
3053 3053
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
@@ -3059,14 +3059,14 @@  discard block
 block discarded – undo
3059 3059
 
3060 3060
             <select name="multi_display_type" id="multi_display_type">
3061 3061
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
3062
-                    echo 'selected="selected"';
3063
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
3062
+					echo 'selected="selected"';
3063
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
3064 3064
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
3065
-                    echo 'selected="selected"';
3066
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3065
+					echo 'selected="selected"';
3066
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3067 3067
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
3068
-                    echo 'selected="selected"';
3069
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3068
+					echo 'selected="selected"';
3069
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3070 3070
             </select>
3071 3071
 
3072 3072
             <br/>
@@ -3074,15 +3074,15 @@  discard block
 block discarded – undo
3074 3074
     </li>
3075 3075
     <?php
3076 3076
 
3077
-    $output = ob_get_clean();
3078
-    return $output;
3077
+	$output = ob_get_clean();
3078
+	return $output;
3079 3079
 }
3080 3080
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
3081 3081
 
3082 3082
 
3083 3083
 function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
3084
-    ob_start();
3085
-    ?>
3084
+	ob_start();
3085
+	?>
3086 3086
     <li>
3087 3087
         <label for="option_values" class="gd-cf-tooltip-wrap">
3088 3088
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
@@ -3103,16 +3103,16 @@  discard block
 block discarded – undo
3103 3103
         <div class="gd-cf-input-wrap">
3104 3104
             <input type="text" name="option_values" id="option_values"
3105 3105
                    value="<?php if (isset($field_info->option_values)) {
3106
-                       echo esc_attr($field_info->option_values);
3107
-                   }?>"/>
3106
+					   echo esc_attr($field_info->option_values);
3107
+				   }?>"/>
3108 3108
             <br/>
3109 3109
 
3110 3110
         </div>
3111 3111
     </li>
3112 3112
     <?php
3113 3113
 
3114
-    $output = ob_get_clean();
3115
-    return $output;
3114
+	$output = ob_get_clean();
3115
+	return $output;
3116 3116
 }
3117 3117
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
3118 3118
 add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
@@ -3120,11 +3120,11 @@  discard block
 block discarded – undo
3120 3120
 
3121 3121
 
3122 3122
 function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
3123
-    ob_start();
3124
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
3125
-        $extra = unserialize($field_info->extra_fields);
3126
-    }
3127
-    ?>
3123
+	ob_start();
3124
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
3125
+		$extra = unserialize($field_info->extra_fields);
3126
+	}
3127
+	?>
3128 3128
     <li>
3129 3129
         <label for="date_format" class="gd-cf-tooltip-wrap">
3130 3130
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
@@ -3134,52 +3134,52 @@  discard block
 block discarded – undo
3134 3134
         </label>
3135 3135
         <div class="gd-cf-input-wrap" style="overflow:inherit;">
3136 3136
             <?php
3137
-            $date_formats = array(
3138
-                'm/d/Y',
3139
-                'd/m/Y',
3140
-                'Y/m/d',
3141
-                'm-d-Y',
3142
-                'd-m-Y',
3143
-                'Y-m-d',
3144
-                'F j, Y',
3145
-            );
3146
-            /**
3147
-             * Filter the custom field date format options.
3148
-             *
3149
-             * @since 1.6.5
3150
-             * @param array $date_formats The PHP date format array.
3151
-             */
3152
-            $date_formats = apply_filters('geodir_date_formats',$date_formats);
3153
-            ?>
3137
+			$date_formats = array(
3138
+				'm/d/Y',
3139
+				'd/m/Y',
3140
+				'Y/m/d',
3141
+				'm-d-Y',
3142
+				'd-m-Y',
3143
+				'Y-m-d',
3144
+				'F j, Y',
3145
+			);
3146
+			/**
3147
+			 * Filter the custom field date format options.
3148
+			 *
3149
+			 * @since 1.6.5
3150
+			 * @param array $date_formats The PHP date format array.
3151
+			 */
3152
+			$date_formats = apply_filters('geodir_date_formats',$date_formats);
3153
+			?>
3154 3154
             <select name="extra[date_format]" id="date_format">
3155 3155
                 <?php
3156
-                foreach($date_formats as $format){
3157
-                    $selected = '';
3158
-                    if(esc_attr($extra['date_format'])==$format){
3159
-                        $selected = "selected='selected'";
3160
-                    }
3161
-                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3162
-                }
3163
-                ?>
3156
+				foreach($date_formats as $format){
3157
+					$selected = '';
3158
+					if(esc_attr($extra['date_format'])==$format){
3159
+						$selected = "selected='selected'";
3160
+					}
3161
+					echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3162
+				}
3163
+				?>
3164 3164
             </select>
3165 3165
 
3166 3166
         </div>
3167 3167
     </li>
3168 3168
     <?php
3169 3169
 
3170
-    $output = ob_get_clean();
3171
-    return $output;
3170
+	$output = ob_get_clean();
3171
+	return $output;
3172 3172
 }
3173 3173
 add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
3174 3174
 
3175 3175
 
3176 3176
 function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
3177
-    ob_start();
3178
-    $allowed_file_types = geodir_allowed_mime_types();
3177
+	ob_start();
3178
+	$allowed_file_types = geodir_allowed_mime_types();
3179 3179
 
3180
-    $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3181
-    $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3182
-    ?>
3180
+	$extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3181
+	$gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3182
+	?>
3183 3183
     <li>
3184 3184
         <label for="gd_file_types" class="gd-cf-tooltip-wrap">
3185 3185
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
@@ -3202,7 +3202,7 @@  discard block
 block discarded – undo
3202 3202
     </li>
3203 3203
     <?php
3204 3204
 
3205
-    $output = ob_get_clean();
3206
-    return $output;
3205
+	$output = ob_get_clean();
3206
+	return $output;
3207 3207
 }
3208 3208
 add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
3209 3209
\ No newline at end of file
Please login to merge, or discard this patch.