Passed
Pull Request — master (#261)
by Viruthagiri
09:40
created
geodirectory-functions/custom_functions.php 1 patch
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -51,20 +51,20 @@  discard block
 block discarded – undo
51 51
 			jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600);
52 52
 		}
53 53
 
54
-		jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) {
54
+		jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) {
55 55
 			//alert(data );
56 56
 		});
57 57
 	}
58 58
     </script>
59 59
     <div class="geodir-list-view-select">
60 60
         <select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);">
61
-            <?php $listing_view = (int)$gd_session->get('gd_listing_view'); ?>
62
-            <option value=""><?php _e('View:', 'geodirectory');?></option>
63
-            <option value="1" <?php selected(1, $listing_view);?>><?php _e('View: List', 'geodirectory');?></option>
64
-            <option value="2" <?php selected(2, $listing_view);?>><?php _e('View: Grid 2', 'geodirectory');?></option>
65
-            <option value="3" <?php selected(3, $listing_view);?>><?php _e('View: Grid 3', 'geodirectory');?></option>
66
-            <option value="4" <?php selected(4, $listing_view);?>><?php _e('View: Grid 4', 'geodirectory');?></option>
67
-            <option value="5" <?php selected(5, $listing_view);?>><?php _e('View: Grid 5', 'geodirectory');?></option>
61
+            <?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?>
62
+            <option value=""><?php _e('View:', 'geodirectory'); ?></option>
63
+            <option value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option>
64
+            <option value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option>
65
+            <option value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option>
66
+            <option value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option>
67
+            <option value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option>
68 68
         </select>
69 69
     </div>
70 70
 <?php
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
                 $out .= $subex;
116 116
             }
117 117
         }
118
-        $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
118
+        $out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
119 119
         /**
120 120
          * Filter excerpt read more text.
121 121
          *
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
129 129
             $excut = -(mb_strlen($excerpt_more));
130 130
             $out .= mb_substr($excerpt, 0, $excut);
131
-            $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
131
+            $out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
132 132
             /**
133 133
              * Filter excerpt read more text.
134 134
              *
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      * @param object|string $post The post object.
185 185
      * @param string $post_type The post type.
186 186
      */
187
-    return (object)apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
187
+    return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
188 188
 
189 189
 }
190 190
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
         $post_title = $productinfo->post_title;
239 239
     }
240 240
 
241
-    $post_title = '<a href="' . get_permalink($pid) . '">' . $post_title . '</a>';
241
+    $post_title = '<a href="'.get_permalink($pid).'">'.$post_title.'</a>';
242 242
 
243 243
     $user_info = get_userdata($author_id);
244 244
     $to_email = geodir_get_post_meta($pid, 'geodir_email', true);
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     do_action('geodir_after_send_enquiry', $request, 'Enquiry');
269 269
 
270 270
     $client_message = $frnd_comments;
271
-    $client_message .= '<br>' . __('From :', 'geodirectory') . ' ' . $yourname . '<br>' . __('Phone :', 'geodirectory') . ' ' . $inq_phone . '<br>' . __('Email :', 'geodirectory') . ' ' . $youremail . '<br><br>' . __('Sent from', 'geodirectory') . ' - <b><a href="' . trailingslashit(home_url()) . '">' . get_option('blogname') . '</a></b>.';
271
+    $client_message .= '<br>'.__('From :', 'geodirectory').' '.$yourname.'<br>'.__('Phone :', 'geodirectory').' '.$inq_phone.'<br>'.__('Email :', 'geodirectory').' '.$youremail.'<br><br>'.__('Sent from', 'geodirectory').' - <b><a href="'.trailingslashit(home_url()).'">'.get_option('blogname').'</a></b>.';
272 272
     /**
273 273
      * Filter client message text.
274 274
      *
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         // strip slashes message
299 299
         $client_message = stripslashes_deep($client_message);
300 300
 
301
-        geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']);//To client email
301
+        geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email
302 302
     }
303 303
 
304 304
     /**
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
     do_action('geodir_after_send_enquiry_email', $request);
321 321
     $url = get_permalink($pid);
322 322
     if (strstr($url, '?')) {
323
-        $url = $url . "&send_inquiry=success";
323
+        $url = $url."&send_inquiry=success";
324 324
     } else {
325
-        $url = $url . "?send_inquiry=success";
325
+        $url = $url."?send_inquiry=success";
326 326
     }
327 327
     /**
328 328
      * Filter redirect url after the send enquiry email is sent.
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
      * }
404 404
      */
405 405
     do_action('geodir_before_send_to_friend_email', $request);
406
-    geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']);//To client email
406
+    geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email
407 407
 
408 408
     /**
409 409
      * Called after the send to friend email is sent.
@@ -427,9 +427,9 @@  discard block
 block discarded – undo
427 427
 
428 428
     $url = get_permalink($pid);
429 429
     if (strstr($url, '?')) {
430
-        $url = $url . "&sendtofrnd=success";
430
+        $url = $url."&sendtofrnd=success";
431 431
     } else {
432
-        $url = $url . "?sendtofrnd=success";
432
+        $url = $url."?sendtofrnd=success";
433 433
     }
434 434
     /**
435 435
      * Filter redirect url after the send to friend email is sent.
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
              *
464 464
              * @since 1.0.0
465 465
              */
466
-            echo ' <div id="' . apply_filters('geodir_post_gallery_id', 'geodir-post-gallery') . '" class="clearfix" >';
466
+            echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >';
467 467
             break;
468 468
         case 'reviews' :
469 469
             echo '<div id="reviews-wrap" class="clearfix"> ';
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
         if (!in_array($post_type, $all_postypes))
530 530
             return false;
531 531
 
532
-        $sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array($post_type, 1, 1)));
532
+        $sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where	post_type= %s and is_active=%d and is_default=%d", array($post_type, 1, 1)));
533 533
 
534 534
         if (!empty($sort_field_info))
535 535
             return $sort_field_info;
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
         if (!in_array($post_type, $all_postypes))
558 558
             return false;
559 559
 
560
-        $sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array($post_type, 1)));
560
+        $sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array($post_type, 1)));
561 561
         /**
562 562
          * Filter post sort options.
563 563
          *
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 	 *
588 588
 	 * @since 1.4.4
589 589
 	 */
590
-	if ( is_search() ) {
590
+	if (is_search()) {
591 591
 		return;
592 592
 	}
593 593
 
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
             if ($sort->field_type == 'random') {
612 612
                 $key = $sort->field_type;
613 613
                 ($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
614
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
614
+                $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
615 615
             }
616 616
 
617 617
             if ($sort->htmlvar_name == 'comment_count') {
@@ -619,21 +619,21 @@  discard block
 block discarded – undo
619 619
             }
620 620
 
621 621
             if ($sort->sort_asc) {
622
-                $key = $sort->htmlvar_name . '_asc';
622
+                $key = $sort->htmlvar_name.'_asc';
623 623
                 $label = $sort->site_title;
624 624
                 if ($sort->asc_title)
625 625
                     $label = $sort->asc_title;
626 626
                 ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
627
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
627
+                $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
628 628
             }
629 629
 
630 630
             if ($sort->sort_desc) {
631
-                $key = $sort->htmlvar_name . '_desc';
631
+                $key = $sort->htmlvar_name.'_desc';
632 632
                 $label = $sort->site_title;
633 633
                 if ($sort->desc_title)
634 634
                     $label = $sort->desc_title;
635 635
                 ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
636
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
636
+                $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
637 637
             }
638 638
 
639 639
         }
@@ -648,9 +648,9 @@  discard block
 block discarded – undo
648 648
             <select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
649 649
 
650 650
                 <option
651
-                    value="<?php echo esc_url( add_query_arg('sort_by', '') );?>" <?php if ($sort_by == '') echo 'selected="selected"';?>><?php _e('Sort By', 'geodirectory');?></option><?php
651
+                    value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') echo 'selected="selected"'; ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php
652 652
 
653
-                echo $sort_field_options;?>
653
+                echo $sort_field_options; ?>
654 654
 
655 655
             </select>
656 656
 
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
         $category = array();
722 722
 
723 723
         if (isset($_REQUEST['backandedit'])) {
724
-            $post = (object)$gd_session->get('listing');
724
+            $post = (object) $gd_session->get('listing');
725 725
             $post_type = $post->listing_type;
726 726
             if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
727 727
                 $post_id = $_REQUEST['pid'];
@@ -736,13 +736,13 @@  discard block
 block discarded – undo
736 736
 
737 737
         if ($relate_to == 'category') {
738 738
 
739
-            $category_taxonomy = $post_type . $relate_to;
739
+            $category_taxonomy = $post_type.$relate_to;
740 740
             if (isset($post->{$category_taxonomy}) && $post->{$category_taxonomy} != '')
741 741
                 $category = explode(',', trim($post->{$category_taxonomy}, ','));
742 742
 
743 743
         } elseif ($relate_to == 'tags') {
744 744
 
745
-            $category_taxonomy = $post_type . '_' . $relate_to;
745
+            $category_taxonomy = $post_type.'_'.$relate_to;
746 746
             if ($post->post_tags != '')
747 747
                 $category = explode(',', trim($post->post_tags, ','));
748 748
             $tax_field = 'name';
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
             if ($add_location_filter != '0') {
799 799
                 $geodir_add_location_url = '1';
800 800
             }
801
-            $viewall_url = get_term_link((int)$category[0], $post_type . $category_taxonomy);
801
+            $viewall_url = get_term_link((int) $category[0], $post_type.$category_taxonomy);
802 802
             $geodir_add_location_url = NULL;
803 803
         }
804 804
         ob_start();
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
                 $after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
816 816
                 ?>
817 817
                 <div class="location_list_heading clearfix">
818
-                    <?php echo $before_title . $title . $after_title; ?>
818
+                    <?php echo $before_title.$title.$after_title; ?>
819 819
                 </div>
820 820
             <?php
821 821
             }
@@ -903,8 +903,8 @@  discard block
 block discarded – undo
903 903
         $geodir_post_category_str = serialize($geodir_post_category_str);
904 904
     }
905 905
 
906
-    $all_var['post_category_array'] = html_entity_decode((string)$geodir_post_category_str, ENT_QUOTES, 'UTF-8');
907
-    $script = "var post_category_array = " . json_encode($all_var) . ';';
906
+    $all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8');
907
+    $script = "var post_category_array = ".json_encode($all_var).';';
908 908
     echo '<script>';
909 909
     echo $script;
910 910
     echo '</script>';
@@ -1025,9 +1025,9 @@  discard block
 block discarded – undo
1025 1025
         }
1026 1026
     } elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1027 1027
         if (is_category()) {
1028
-            $meta_desc .= __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE));
1028
+            $meta_desc .= __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", FALSE));
1029 1029
         } elseif (is_tag()) {
1030
-            $meta_desc .= __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE));
1030
+            $meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", FALSE));
1031 1031
         }
1032 1032
     } elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1033 1033
         $meta_desc .= isset($current_term->description) ? $current_term->description : '';
@@ -1054,8 +1054,8 @@  discard block
 block discarded – undo
1054 1054
     $replace_location = __('Everywhere', 'geodirectory');
1055 1055
     $location_id = NULL;
1056 1056
     if ($geodir_location_manager) {
1057
-        $sql = $wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1058
-        $location_id = (int)$wpdb->get_var($sql);
1057
+        $sql = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1058
+        $location_id = (int) $wpdb->get_var($sql);
1059 1059
         $location_type = geodir_what_is_current_location();
1060 1060
         if ($location_type == 'city') {
1061 1061
             $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
@@ -1096,65 +1096,65 @@  discard block
 block discarded – undo
1096 1096
                     $category_id = $category->term_id;
1097 1097
                     $category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1098 1098
                     if ($location_id) {
1099
-                        $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1099
+                        $option_name = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id;
1100 1100
                         $cat_loc_option = get_option($option_name);
1101 1101
 
1102 1102
                         $gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1103 1103
                         if (!$gd_cat_loc_default) {
1104
-                            $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1104
+                            $option_name = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id;
1105 1105
                             $option = get_option($option_name);
1106 1106
                             $category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1107 1107
                         }
1108 1108
                     }
1109
-                    $geodir_meta_desc = __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE)) . '. ' . $category_desc;
1109
+                    $geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", FALSE)).'. '.$category_desc;
1110 1110
                 }
1111 1111
             } else if ($geodir_is_tag) {
1112
-                $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE)) . '. ' . $geodir_meta_desc;
1112
+                $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", FALSE)).'. '.$geodir_meta_desc;
1113 1113
             }
1114 1114
         }
1115 1115
     }
1116 1116
 
1117 1117
 
1118 1118
     $gd_page = '';
1119
-    if(geodir_is_page('home')){
1119
+    if (geodir_is_page('home')) {
1120 1120
         $gd_page = 'home';
1121 1121
         $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1122 1122
     }
1123
-    elseif(geodir_is_page('detail')){
1123
+    elseif (geodir_is_page('detail')) {
1124 1124
         $gd_page = 'detail';
1125 1125
         $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1126 1126
     }
1127
-    elseif(geodir_is_page('pt')){
1127
+    elseif (geodir_is_page('pt')) {
1128 1128
         $gd_page = 'pt';
1129 1129
         $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1130 1130
     }
1131
-    elseif(geodir_is_page('listing')){
1131
+    elseif (geodir_is_page('listing')) {
1132 1132
         $gd_page = 'listing';
1133 1133
         $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1134 1134
     }
1135
-    elseif(geodir_is_page('location')){
1135
+    elseif (geodir_is_page('location')) {
1136 1136
         $gd_page = 'location';
1137 1137
         $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1138 1138
         $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1139 1139
 
1140 1140
     }
1141
-    elseif(geodir_is_page('search')){
1141
+    elseif (geodir_is_page('search')) {
1142 1142
         $gd_page = 'search';
1143 1143
         $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1144 1144
     }
1145
-    elseif(geodir_is_page('add-listing')){
1145
+    elseif (geodir_is_page('add-listing')) {
1146 1146
         $gd_page = 'add-listing';
1147 1147
         $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1148 1148
     }
1149
-    elseif(geodir_is_page('author')){
1149
+    elseif (geodir_is_page('author')) {
1150 1150
         $gd_page = 'author';
1151 1151
         $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1152 1152
     }
1153
-    elseif(geodir_is_page('login')){
1153
+    elseif (geodir_is_page('login')) {
1154 1154
         $gd_page = 'login';
1155 1155
         $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1156 1156
     }
1157
-    elseif(geodir_is_page('listing-success')){
1157
+    elseif (geodir_is_page('listing-success')) {
1158 1158
         $gd_page = 'listing-success';
1159 1159
         $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1160 1160
     }
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
          * @param string $title The page description including variables.
1183 1183
          * @param string $gd_page The GeoDirectory page type if any.
1184 1184
          */
1185
-        $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'),$gd_page,'');
1185
+        $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
1186 1186
 
1187 1187
         /**
1188 1188
          * Filter SEO meta description.
@@ -1190,20 +1190,20 @@  discard block
 block discarded – undo
1190 1190
          * @since 1.0.0
1191 1191
          * @param string $meta_desc Meta description content.
1192 1192
          */
1193
-        echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc);
1193
+        echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc);
1194 1194
     }
1195 1195
 
1196 1196
     // meta keywords
1197 1197
     if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1198
-        $place_tags = wp_get_post_terms($post->ID, $post->post_type . '_tags', array("fields" => "names"));
1199
-        $place_cats = wp_get_post_terms($post->ID, $post->post_type . 'category', array("fields" => "names"));
1198
+        $place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names"));
1199
+        $place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names"));
1200 1200
 
1201
-        $meta_key .= implode(", ", array_merge((array)$place_cats, (array)$place_tags));
1201
+        $meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
1202 1202
     } else {
1203 1203
         $posttags = get_the_tags();
1204 1204
         if ($posttags) {
1205 1205
             foreach ($posttags as $tag) {
1206
-                $meta_key .= $tag->name . ' ';
1206
+                $meta_key .= $tag->name.' ';
1207 1207
             }
1208 1208
         } else {
1209 1209
             $tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
 
1212 1212
             foreach ($tags as $tag) {
1213 1213
                 if ($xt <= 20) {
1214
-                    $meta_key .= $tag->name . ", ";
1214
+                    $meta_key .= $tag->name.", ";
1215 1215
                 }
1216 1216
 
1217 1217
                 $xt++;
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
     }
1221 1221
 
1222 1222
     $meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1223
-    $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1223
+    $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1224 1224
     if ($geodir_meta_keys != '') {
1225 1225
         $geodir_meta_keys = strip_tags($geodir_meta_keys);
1226 1226
         $geodir_meta_keys = esc_html($geodir_meta_keys);
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
          * @since 1.0.0
1240 1240
          * @param string $meta_desc Meta keywords.
1241 1241
          */
1242
-        echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key);
1242
+        echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key);
1243 1243
     }
1244 1244
 
1245 1245
 }
@@ -1384,8 +1384,8 @@  discard block
 block discarded – undo
1384 1384
 {
1385 1385
     global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1386 1386
 
1387
-    $post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0;
1388
-    $request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0;
1387
+    $post_id = !empty($post) && isset($post->ID) ? (int) $post->ID : 0;
1388
+    $request_post_id = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
1389 1389
     $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1390 1390
 
1391 1391
     if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
@@ -1395,7 +1395,7 @@  discard block
 block discarded – undo
1395 1395
 
1396 1396
     $geodir_post_detail_fields = geodir_show_listing_info('detail');
1397 1397
 
1398
-    $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1398
+    $arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user
1399 1399
 
1400 1400
     if (geodir_is_page('detail')) {
1401 1401
         $video = geodir_get_video($post->ID);
@@ -1426,7 +1426,7 @@  discard block
 block discarded – undo
1426 1426
         if (!empty($post_images)) {
1427 1427
             foreach ($post_images as $image) {
1428 1428
                 $caption = (!empty($image->caption)) ? $image->caption : '';
1429
-                $thumb_image .= '<a href="' . $image->src . '" title="'.$caption.'">';
1429
+                $thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">';
1430 1430
                 $thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1431 1431
                 $thumb_image .= '</a>';
1432 1432
             }
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
         $map_args['width'] = '600';
1438 1438
         $map_args['height'] = '300';
1439 1439
         if ($post->post_mapzoom) {
1440
-            $map_args['zoom'] = '' . $post->post_mapzoom . '';
1440
+            $map_args['zoom'] = ''.$post->post_mapzoom.'';
1441 1441
         }
1442 1442
         $map_args['autozoom'] = false;
1443 1443
         $map_args['child_collapse'] = '0';
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
         if (!empty($post_images)) {
1464 1464
             foreach ($post_images as $image) {
1465 1465
                 if ($image != '') {
1466
-                    $thumb_image .= '<a href="' . $image . '">';
1466
+                    $thumb_image .= '<a href="'.$image.'">';
1467 1467
                     $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1468 1468
                     $thumb_image .= '</a>';
1469 1469
                 }
@@ -1509,7 +1509,7 @@  discard block
 block discarded – undo
1509 1509
     $active_tab_name = '';
1510 1510
     $default_tab = '';
1511 1511
     $default_tab_name = '';
1512
-    foreach($arr_detail_page_tabs as $tab_index => $tabs){
1512
+    foreach ($arr_detail_page_tabs as $tab_index => $tabs) {
1513 1513
         if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
1514 1514
             $active_tab = $tab_index;
1515 1515
             $active_tab_name = __($tabs['heading_text'], 'geodirectory');
@@ -1530,10 +1530,10 @@  discard block
 block discarded – undo
1530 1530
         $active_tab = $default_tab;
1531 1531
         $active_tab_name = $default_tab_name;
1532 1532
     }
1533
-    $tab_list = (get_option('geodir_disable_tabs',false)) ? true : false;
1533
+    $tab_list = (get_option('geodir_disable_tabs', false)) ? true : false;
1534 1534
     ?>
1535 1535
     <div class="geodir-tabs" id="gd-tabs" style="position:relative;">
1536
-        <?php if(!$tab_list){ ?>
1536
+        <?php if (!$tab_list) { ?>
1537 1537
         <div id="geodir-tab-mobile-menu">
1538 1538
             <i class="fa fa-bars"></i>
1539 1539
             <span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span>
@@ -1554,10 +1554,10 @@  discard block
 block discarded – undo
1554 1554
             foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1555 1555
                 if ($detail_page_tab['is_display']) {
1556 1556
 
1557
-                    if(!$tab_list) {
1557
+                    if (!$tab_list) {
1558 1558
                         ?>
1559 1559
                         <dt></dt> <!-- added to comply with validation -->
1560
-                        <dd <?php if ($detail_page_tab['is_active_tab']){ ?>class="geodir-tab-active"<?php } ?> ><a
1560
+                        <dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a
1561 1561
                                 data-tab="#<?php echo $tab_index; ?>"
1562 1562
                                 data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a>
1563 1563
                         </dd>
@@ -1565,9 +1565,9 @@  discard block
 block discarded – undo
1565 1565
                     }
1566 1566
                     ob_start() // start tab content buffering
1567 1567
                     ?>
1568
-                    <li id="<?php echo $tab_index;?>Tab">
1569
-                        <?php if($tab_list){
1570
-                            $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'],'geodirectory').'</a></span><hr />';
1568
+                    <li id="<?php echo $tab_index; ?>Tab">
1569
+                        <?php if ($tab_list) {
1570
+                            $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />';
1571 1571
                             /**
1572 1572
                              * Filter the tab list title html.
1573 1573
                              *
@@ -1576,9 +1576,9 @@  discard block
 block discarded – undo
1576 1576
                              * @param string $tab_index The tab index type.
1577 1577
                              * @param array $detail_page_tab The array of values including title text.
1578 1578
                              */
1579
-                            echo apply_filters('geodir_tab_list_title',$tab_title ,$tab_index ,$detail_page_tab);
1579
+                            echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab);
1580 1580
                         }?>
1581
-                        <div id="<?php echo $tab_index;?>" class="hash-offset"></div>
1581
+                        <div id="<?php echo $tab_index; ?>" class="hash-offset"></div>
1582 1582
                         <?php
1583 1583
                         /**
1584 1584
                          * Called before the details tab content is output per tab.
@@ -1596,7 +1596,7 @@  discard block
 block discarded – undo
1596 1596
                          * @since 1.0.0
1597 1597
                          * @todo do we need this if we have the hook above? 'geodir_before_tab_content'
1598 1598
                          */
1599
-                        do_action('geodir_before_' . $tab_index . '_tab_content');
1599
+                        do_action('geodir_before_'.$tab_index.'_tab_content');
1600 1600
                         /// write a code to generate content of each tab
1601 1601
                         switch ($tab_index) {
1602 1602
                             case 'post_profile':
@@ -1628,7 +1628,7 @@  discard block
 block discarded – undo
1628 1628
                                 break;
1629 1629
                             case 'post_video':
1630 1630
                                 /** This action is documented in geodirectory_template_actions.php */
1631
-                                echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
1631
+                                echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
1632 1632
                                 break;
1633 1633
                             case 'special_offers':
1634 1634
                                 echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
                          * @since 1.0.0
1667 1667
                          * @todo do we need this if we have the hook above? 'geodir_after_tab_content'
1668 1668
                          */
1669
-                        do_action('geodir_after_' . $tab_index . '_tab_content');
1669
+                        do_action('geodir_after_'.$tab_index.'_tab_content');
1670 1670
                         ?> </li>
1671 1671
                     <?php
1672 1672
                     /**
@@ -1674,7 +1674,7 @@  discard block
 block discarded – undo
1674 1674
                      *
1675 1675
                      * @since 1.0.0
1676 1676
                      */
1677
-                    $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean());
1677
+                    $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean());
1678 1678
                 } // end of if for is_display
1679 1679
             }// end of foreach
1680 1680
 
@@ -1686,8 +1686,8 @@  discard block
 block discarded – undo
1686 1686
              */
1687 1687
             do_action('geodir_after_tab_list');
1688 1688
             ?>
1689
-            <?php if(!$tab_list){?></dl><?php }?>
1690
-        <ul class="geodir-tabs-content entry-content <?php if($tab_list){?>geodir-tabs-list<?php }?>" style="position:relative;">
1689
+            <?php if (!$tab_list) {?></dl><?php }?>
1690
+        <ul class="geodir-tabs-content entry-content <?php if ($tab_list) {?>geodir-tabs-list<?php }?>" style="position:relative;">
1691 1691
             <?php
1692 1692
             foreach ($arr_detail_page_tabs as $detail_page_tab) {
1693 1693
                 if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
         </ul>
1705 1705
         <!--gd-tabs-content ul end-->
1706 1706
     </div>
1707
-    <?php if(!$tab_list){ ?>
1707
+    <?php if (!$tab_list) { ?>
1708 1708
     <script>
1709 1709
         if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) {
1710 1710
             hashVal = window.location.hash;
@@ -1759,7 +1759,7 @@  discard block
 block discarded – undo
1759 1759
     if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
1760 1760
         try {
1761 1761
             $exif = exif_read_data($file_path);
1762
-        } catch(Exception $e) {
1762
+        } catch (Exception $e) {
1763 1763
             $exif = array();
1764 1764
         }
1765 1765
     }
@@ -1769,7 +1769,7 @@  discard block
 block discarded – undo
1769 1769
     $modify = false;
1770 1770
     $orientation = 0;
1771 1771
     if (!empty($exif) && isset($exif['Orientation'])) {
1772
-        switch ((int)$exif['Orientation']) {
1772
+        switch ((int) $exif['Orientation']) {
1773 1773
             case 1:
1774 1774
                 // do nothing
1775 1775
                 break;
@@ -1845,7 +1845,7 @@  discard block
 block discarded – undo
1845 1845
         }
1846 1846
         
1847 1847
         if ($quality !== null) {
1848
-            $image->set_quality((int)$quality);
1848
+            $image->set_quality((int) $quality);
1849 1849
         }
1850 1850
         
1851 1851
        $result = $image->save($file_path);
@@ -1917,7 +1917,7 @@  discard block
 block discarded – undo
1917 1917
 
1918 1918
         $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
1919 1919
 
1920
-        $permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID;
1920
+        $permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
1921 1921
         $comment_author_email = $comment->comment_author_email;
1922 1922
         $comment_post_ID = $comment->post_id;
1923 1923
 
@@ -1932,12 +1932,12 @@  discard block
 block discarded – undo
1932 1932
 
1933 1933
         $post_title = get_the_title($comment_post_ID);
1934 1934
         $permalink = get_permalink($comment_post_ID);
1935
-        $comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
1936
-        $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __('Read more', 'geodirectory') . '</a>';
1935
+        $comment_permalink = $permalink."#comment-".$comment->comment_ID;
1936
+        $read_more = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>';
1937 1937
 
1938 1938
         $comment_content_length = strlen($comment_content);
1939 1939
         if ($comment_content_length > $comment_lenth) {
1940
-            $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth) . '... ' . $read_more;
1940
+            $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth).'... '.$read_more;
1941 1941
         } else {
1942 1942
             $comment_excerpt = $comment_content;
1943 1943
         }
@@ -1950,37 +1950,37 @@  discard block
 block discarded – undo
1950 1950
 
1951 1951
         if ($comment_id && $na) {
1952 1952
             $comments_echo .= '<li class="clearfix">';
1953
-            $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
1953
+            $comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">";
1954 1954
             if (function_exists('get_avatar')) {
1955 1955
                 if (!isset($comment->comment_type)) {
1956 1956
                     if ($user_profile_url) {
1957
-                        $comments_echo .= '<a href="' . $user_profile_url . '">';
1957
+                        $comments_echo .= '<a href="'.$user_profile_url.'">';
1958 1958
                     }
1959
-                    $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1959
+                    $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
1960 1960
                     if ($user_profile_url) {
1961 1961
                         $comments_echo .= '</a>';
1962 1962
                     }
1963 1963
                 } elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
1964 1964
                     if ($user_profile_url) {
1965
-                        $comments_echo .= '<a href="' . $user_profile_url . '">';
1965
+                        $comments_echo .= '<a href="'.$user_profile_url.'">';
1966 1966
                     }
1967
-                    $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1967
+                    $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
1968 1968
                 }
1969 1969
             } elseif (function_exists('gravatar')) {
1970 1970
                 if ($user_profile_url) {
1971
-                    $comments_echo .= '<a href="' . $user_profile_url . '">';
1971
+                    $comments_echo .= '<a href="'.$user_profile_url.'">';
1972 1972
                 }
1973 1973
                 $comments_echo .= "<img src=\"";
1974 1974
                 if ('' == $comment->comment_type) {
1975
-                    $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1975
+                    $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
1976 1976
                     if ($user_profile_url) {
1977 1977
                         $comments_echo .= '</a>';
1978 1978
                     }
1979 1979
                 } elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
1980 1980
                     if ($user_profile_url) {
1981
-                        $comments_echo .= '<a href="' . $user_profile_url . '">';
1981
+                        $comments_echo .= '<a href="'.$user_profile_url.'">';
1982 1982
                     }
1983
-                    $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1983
+                    $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
1984 1984
                     if ($user_profile_url) {
1985 1985
                         $comments_echo .= '</a>';
1986 1986
                     }
@@ -1991,13 +1991,13 @@  discard block
 block discarded – undo
1991 1991
             $comments_echo .= "</span>\n";
1992 1992
 
1993 1993
             $comments_echo .= '<span class="geodir_reviewer_content">';
1994
-            if($comment->user_id){$comments_echo .= '<a href="'.get_author_posts_url( $comment->user_id ).'">';}
1995
-            $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
1996
-            if($comment->user_id){$comments_echo .= '</a>';}
1997
-            $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
1998
-            $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
1994
+            if ($comment->user_id) {$comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">'; }
1995
+            $comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> ';
1996
+            if ($comment->user_id) {$comments_echo .= '</a>'; }
1997
+            $comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> ';
1998
+            $comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>';
1999 1999
             $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
2000
-            $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
2000
+            $comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.'';
2001 2001
             //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
2002 2002
             $comments_echo .= '</p>';
2003 2003
 
@@ -2024,19 +2024,19 @@  discard block
 block discarded – undo
2024 2024
     if (!empty($post_types)) {
2025 2025
         foreach ($post_types as $key => $post_type) {
2026 2026
             $cpt_name = __($post_type->labels->singular_name, 'geodirectory');
2027
-            $post_type_name =   sprintf(__('%s Categories', 'geodirectory'),$cpt_name);
2027
+            $post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
2028 2028
             $taxonomies = geodir_get_taxonomies($key);
2029 2029
             $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL;
2030 2030
             $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL;
2031 2031
 
2032 2032
             if (!empty($cat_terms)) {
2033
-                $return['optgroup_start-' . $key] = $post_type_name;
2033
+                $return['optgroup_start-'.$key] = $post_type_name;
2034 2034
 
2035 2035
                 foreach ($cat_terms as $cat_term) {
2036
-                    $return[$key . '_' . $cat_term->term_id] = $cat_term->name;
2036
+                    $return[$key.'_'.$cat_term->term_id] = $cat_term->name;
2037 2037
                 }
2038 2038
 
2039
-                $return['optgroup_end-' . $key] = $post_type_name;
2039
+                $return['optgroup_end-'.$key] = $post_type_name;
2040 2040
             }
2041 2041
         }
2042 2042
     }
@@ -2128,10 +2128,10 @@  discard block
 block discarded – undo
2128 2128
             stWidget.addEntry({
2129 2129
                 "service": "sharethis",
2130 2130
                 "element": document.getElementById('st_sharethis'),
2131
-                "url": "<?php echo geodir_curPageURL();?>",
2132
-                "title": "<?php echo $post->post_title;?>",
2131
+                "url": "<?php echo geodir_curPageURL(); ?>",
2132
+                "title": "<?php echo $post->post_title; ?>",
2133 2133
                 "type": "chicklet",
2134
-                "text": "<?php _e( 'Share', 'geodirectory' );?>"
2134
+                "text": "<?php _e('Share', 'geodirectory'); ?>"
2135 2135
             });
2136 2136
         </script>
2137 2137
     </div>
@@ -2139,7 +2139,7 @@  discard block
 block discarded – undo
2139 2139
 }
2140 2140
 
2141 2141
 function geodir_listing_bounce_map_pin_on_hover() {
2142
-    if(get_option('geodir_listing_hover_bounce_map_pin',true)) {
2142
+    if (get_option('geodir_listing_hover_bounce_map_pin', true)) {
2143 2143
         ?>
2144 2144
         <script>
2145 2145
             jQuery(function ($) {
@@ -2159,15 +2159,15 @@  discard block
 block discarded – undo
2159 2159
         <?php
2160 2160
     }
2161 2161
 }
2162
-add_action('geodir_after_listing_listview','geodir_listing_bounce_map_pin_on_hover',10);
2162
+add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10);
2163 2163
 
2164
-add_action('geodir_after_favorite_html','geodir_output_favourite_html_listings',1,1);
2165
-function geodir_output_favourite_html_listings( $post_id){
2164
+add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1);
2165
+function geodir_output_favourite_html_listings($post_id) {
2166 2166
     geodir_favourite_html('', $post_id);
2167 2167
 }
2168 2168
 
2169
-add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
2170
-function geodir_output_pinpoint_html_listings( $post_id, $post){
2169
+add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
2170
+function geodir_output_pinpoint_html_listings($post_id, $post) {
2171 2171
     global $wp_query;
2172 2172
 
2173 2173
     $show_pin_point = $wp_query->is_main_query();
Please login to merge, or discard this patch.
geodirectory-functions/listing_filters.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
         } //  Distance
100 100
 
101 101
         if (isset($_REQUEST['sgeo_lat'])) {
102
-            $mylat = (float)esc_attr($_REQUEST['sgeo_lat']);
102
+            $mylat = (float) esc_attr($_REQUEST['sgeo_lat']);
103 103
         } else {
104
-            $mylat = (float)geodir_get_current_city_lat();
104
+            $mylat = (float) geodir_get_current_city_lat();
105 105
         } //  Latatude
106 106
 
107 107
         if (isset($_REQUEST['sgeo_lon'])) {
108
-            $mylon = (float)esc_attr($_REQUEST['sgeo_lon']);
108
+            $mylon = (float) esc_attr($_REQUEST['sgeo_lon']);
109 109
         } else {
110
-            $mylon = (float)geodir_get_current_city_lng();
110
+            $mylon = (float) geodir_get_current_city_lng();
111 111
         } //  Distance
112 112
 
113 113
         if (isset($_REQUEST['snear'])) {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
         if ($snear == 'NEAR ME') {
122 122
             $ip = $_SERVER['REMOTE_ADDR'];
123
-            $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
123
+            $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip));
124 124
             $mylat = stripslashes(ucfirst($addr_details[geoplugin_latitude]));
125 125
             $mylon = stripslashes(ucfirst($addr_details[geoplugin_longitude]));
126 126
         }
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
             $s_AA = str_replace(" ", "", $s);
131 131
             $s_A = explode(",", $s_AA);
132 132
             $s_A = implode('","', $s_A);
133
-            $s_A = '"' . $s_A . '"';
133
+            $s_A = '"'.$s_A.'"';
134 134
         } else {
135
-            $s_A = '"' . $s . '"';
135
+            $s_A = '"'.$s.'"';
136 136
         }
137 137
 
138 138
         if (strstr($s, ' ')) {
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     }
194 194
     if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
195 195
 
196
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
196
+        $table = $plugin_prefix.$geodir_post_type.'_detail';
197 197
 
198 198
         add_filter('posts_fields', 'geodir_posts_fields', 1);
199 199
         add_filter('posts_join', 'geodir_posts_join', 1);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session;
234 234
 
235 235
     // Filter-Location-Manager to add location table.
236
-    $fields .= ", " . $table . ".* ";
236
+    $fields .= ", ".$table.".* ";
237 237
     
238 238
 	if ($snear != '' || $gd_session->get('all_near_me')) {
239 239
         $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
@@ -243,16 +243,16 @@  discard block
 block discarded – undo
243 243
             $mylon = $gd_session->get('user_lon');
244 244
         }
245 245
 
246
-        $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
246
+        $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance ";
247 247
     }
248 248
 
249 249
     global $s;
250 250
     if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
251 251
         $keywords = explode(" ", $s);
252 252
 
253
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
254
-            foreach($keywords as $kkey=>$kword){
255
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
253
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
254
+            foreach ($keywords as $kkey=>$kword) {
255
+                if (mb_strlen($kword, 'UTF-8') <= $klimit) {
256 256
                     unset($keywords[$kkey]);
257 257
                 }
258 258
             }
@@ -270,24 +270,24 @@  discard block
 block discarded – undo
270 270
                 $count = 0;
271 271
                 foreach ($keywords as $keyword) {
272 272
                     $keyword = trim($keyword);
273
-                    $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
273
+                    $keyword = wp_specialchars_decode($keyword, ENT_QUOTES);
274 274
 					$count++;
275 275
                     if ($count < count($keywords)) {
276 276
                        // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
277
-						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " ";
277
+						$gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) ".$key." ";
278 278
                     } else {
279 279
                         //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' ";
280
-						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) ";
280
+						$gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) ";
281 281
                     }
282 282
                 }
283
-                $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ",";
283
+                $gd_titlematch_part .= "THEN 1 ELSE 0 END AS ".$part.",";
284 284
             }
285 285
         } else {
286 286
             $gd_titlematch_part = "";
287 287
         }
288
-        $s = stripslashes_deep( $s );
289
-        $s = wp_specialchars_decode($s,ENT_QUOTES);
290
-		$fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
288
+        $s = stripslashes_deep($s);
289
+        $s = wp_specialchars_decode($s, ENT_QUOTES);
290
+		$fields .= $wpdb->prepare(", CASE WHEN ".$table.".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN ".$wpdb->posts.".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle,".$gd_titlematch_part." CASE WHEN ( ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s.'%', '% '.$s.'%', $s, $s.' %', '% '.$s.' %', '% '.$s));
291 291
     }
292 292
 
293 293
     return $fields;
@@ -316,13 +316,13 @@  discard block
 block discarded – undo
316 316
         $lang_code = ICL_LANGUAGE_CODE;
317 317
         $default_lang_code = $sitepress->get_default_language();
318 318
         if ($lang_code) {
319
-            $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
319
+            $join .= "JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID";
320 320
         }
321 321
 
322 322
     }
323 323
     ########### WPML ###########
324 324
 
325
-    $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID)  ";
325
+    $join .= " INNER JOIN ".$table." ON (".$table.".post_id = $wpdb->posts.ID)  ";
326 326
     //===old code start
327 327
     //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id)  " ;//===old code end
328 328
 
@@ -405,20 +405,20 @@  discard block
 block discarded – undo
405 405
             break;
406 406
         case 'low_review':
407 407
         case 'rating_count_asc':
408
-            $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, ";
408
+            $orderby = $table.".rating_count ASC, ".$table.".overall_rating ASC, ";
409 409
             break;
410 410
         case 'high_review':
411 411
         case 'rating_count_desc':
412
-			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
412
+			$orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, ";
413 413
             break;
414 414
         case 'low_rating':
415
-            $orderby = "( " . $table . ".overall_rating  ) ASC, " . $table . ".rating_count ASC,  ";
415
+            $orderby = "( ".$table.".overall_rating  ) ASC, ".$table.".rating_count ASC,  ";
416 416
             break;
417 417
         case 'high_rating':
418
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
418
+            $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, ";
419 419
             break;
420 420
         case 'featured':
421
-            $orderby = $table . ".is_featured asc, ";
421
+            $orderby = $table.".is_featured asc, ";
422 422
             break;
423 423
         case 'nearest':
424 424
             $orderby = " distance asc, ";
@@ -441,24 +441,24 @@  discard block
 block discarded – undo
441 441
 
442 442
     if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
443 443
         $keywords = explode(" ", $s);
444
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
445
-            foreach($keywords as $kkey=>$kword){
446
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
444
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
445
+            foreach ($keywords as $kkey=>$kword) {
446
+                if (mb_strlen($kword, 'UTF-8') <= $klimit) {
447 447
                     unset($keywords[$kkey]);
448 448
                 }
449 449
             }
450 450
         }
451 451
         if ($sort_by == 'nearest' || $sort_by == 'farthest') {
452 452
             if (count($keywords) > 1) {
453
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
453
+                $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
454 454
             } else {
455
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
455
+                $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
456 456
             }
457 457
         } else {
458 458
             if (count($keywords) > 1) {
459
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
459
+                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ".$orderby;
460 460
             } else {
461
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
461
+                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ".$orderby;
462 462
             }
463 463
         }
464 464
     }
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
      */
474 474
     $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
475 475
 
476
-    $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
476
+    $orderby .= $table.".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
477 477
 
478 478
     return $orderby;
479 479
 }
@@ -505,31 +505,31 @@  discard block
 block discarded – undo
505 505
 
506 506
         if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
507 507
 
508
-            $sort_by = str_replace('_' . $order, '', $sort_by);
508
+            $sort_by = str_replace('_'.$order, '', $sort_by);
509 509
 
510 510
             switch ($sort_by):
511 511
 
512 512
                 case 'post_date':
513 513
                 case 'comment_count':
514 514
 
515
-                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
515
+                    $orderby = "$wpdb->posts.".$sort_by." ".$order.", ".$table.".overall_rating ".$order.", ";
516 516
                     break;
517 517
 
518 518
                 case 'distance':
519
-                    $orderby = $sort_by . " " . $order . ", ";
519
+                    $orderby = $sort_by." ".$order.", ";
520 520
                     break;
521 521
 
522 522
 
523 523
                 // sort by rating
524 524
                 case 'overall_rating':
525
-                    $orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
525
+                    $orderby = " ".$table.".".$sort_by."  ".$order.", ".$table.".rating_count ".$order.", ";
526 526
 
527 527
                     break;
528 528
 
529 529
 
530 530
                 default:
531 531
                     if (geodir_column_exist($table, $sort_by)) {
532
-						$orderby = $table . "." . $sort_by . " " . $order . ", ";
532
+						$orderby = $table.".".$sort_by." ".$order.", ";
533 533
 					}
534 534
                     break;
535 535
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
         }
578 578
 
579 579
         //if (!geodir_is_page('detail'))
580
-            add_filter('posts_where', 'geodir_default_where', 1);/**/
580
+            add_filter('posts_where', 'geodir_default_where', 1); /**/
581 581
 
582 582
         //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
583 583
 
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
         $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
649 649
         //echo '##########'.$q_post_type;
650 650
         if ($lang_code && $q_post_type) {
651
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
651
+            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_".$q_post_type."') ";
652 652
             //$where .= " AND icl_t.language_code = '$lang_code' ";
653 653
         }
654 654
 
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 	}
716 716
 	
717 717
 	$s = trim($s);
718
-    $s  = wp_specialchars_decode($s ,ENT_QUOTES);
719
-    $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
718
+    $s = wp_specialchars_decode($s, ENT_QUOTES);
719
+    $s_A = wp_specialchars_decode($s_A, ENT_QUOTES);
720 720
 
721 721
     $where = '';
722 722
     $better_search_terms = '';
@@ -727,9 +727,9 @@  discard block
 block discarded – undo
727 727
 
728 728
     if ($s != '') {
729 729
         $keywords = explode(" ", $s);
730
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
731
-            foreach($keywords as $kkey=>$kword){
732
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
730
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
731
+            foreach ($keywords as $kkey=>$kword) {
732
+                if (mb_strlen($kword, 'UTF-8') <= $klimit) {
733 733
                     unset($keywords[$kkey]);
734 734
                 }
735 735
             }
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
         if (!empty($keywords)) {
739 739
             foreach ($keywords as $keyword) {
740 740
                 $keyword = trim($keyword);
741
-                $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
741
+                $keyword = wp_specialchars_decode($keyword, ENT_QUOTES);
742 742
                 if ($keyword != '') {
743 743
                     /**
744 744
                      * Filter the search query keywords SQL.
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
                      * @param array $keywords The array of keywords for the query.
750 750
                      * @param string $keyword The single keyword being searched.
751 751
                      */
752
-					$better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword);
752
+					$better_search_terms .= apply_filters("geodir_search_better_search_terms", ' OR ( '.$wpdb->posts.'.post_title LIKE "'.$keyword.'" OR '.$wpdb->posts.'.post_title LIKE "'.$keyword.'%" OR '.$wpdb->posts.'.post_title LIKE "% '.$keyword.'%" )', $keywords, $keyword);
753 753
                 }
754 754
             }
755 755
         }
@@ -757,10 +757,10 @@  discard block
 block discarded – undo
757 757
 
758 758
     /* get taxonomy */
759 759
     $taxonomies = geodir_get_taxonomies($post_types, true);
760
-    if($taxonomies) {
760
+    if ($taxonomies) {
761 761
         $taxonomies = implode("','", $taxonomies);
762
-        $taxonomies = "'" . $taxonomies . "'";
763
-    }else{$taxonomies='';}
762
+        $taxonomies = "'".$taxonomies."'";
763
+    } else {$taxonomies = ''; }
764 764
 
765 765
     $content_where = $terms_where = '';
766 766
 	if ($s != '') {
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
          * @package GeoDirectory
772 772
          * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`.
773 773
          */
774
-		$content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
774
+		$content_where = apply_filters("geodir_search_content_where", " OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
775 775
         /**
776 776
          * Filter the search query term values.
777 777
          *
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
          * @package GeoDirectory
780 780
          * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`.
781 781
          */
782
-        $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
782
+        $terms_where = apply_filters("geodir_search_terms_where", " AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
783 783
 	}
784 784
 		
785 785
     if ($snear != '') {
@@ -814,12 +814,12 @@  discard block
 block discarded – undo
814 814
 							)
815 815
 						AND $wpdb->posts.post_type in ('{$post_types}')
816 816
 						AND ($wpdb->posts.post_status = 'publish')
817
-						AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 )
818
-						AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) ";
817
+						AND ( ".$table.".post_latitude between $rlat1 and $rlat2 )
818
+						AND ( ".$table.".post_longitude between $rlon1 and $rlon2 ) ";
819 819
 
820 820
         if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
821 821
             $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
822
-            $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
822
+            $where .= " AND CONVERT((".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= ".$dist;
823 823
         }
824 824
 
825 825
     } else {
@@ -840,11 +840,11 @@  discard block
 block discarded – undo
840 840
     }
841 841
 	
842 842
 	########### WPML ###########
843
-    if ( function_exists( 'icl_object_id' ) ) {       
843
+    if (function_exists('icl_object_id')) {       
844 844
 		$lang_code = ICL_LANGUAGE_CODE;
845 845
 		
846 846
 		if ($lang_code && $post_types) {
847
-            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
847
+            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_".$post_types."') ";
848 848
         }
849 849
     }
850 850
     ########### WPML ###########
@@ -867,10 +867,10 @@  discard block
 block discarded – undo
867 867
     global $wpdb, $geodir_post_type, $table, $curr;
868 868
 
869 869
     $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
870
-    $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
870
+    $user_id = !empty($curauth->ID) ? (int) $curauth->ID : 0;
871 871
     
872 872
     if (isset($_REQUEST['stype'])) {
873
-        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
873
+        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ", $_REQUEST['stype']);
874 874
     } else {
875 875
         $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
876 876
     }
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
         } else
884 884
             $where .= " AND $wpdb->posts.post_author = $user_id";
885 885
 
886
-        if ($user_id == (int)get_current_user_id()) {
886
+        if ($user_id == (int) get_current_user_id()) {
887 887
             $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
888 888
         } else {
889 889
             $where .= " AND $wpdb->posts.post_status = 'publish' ";
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
     if (function_exists('icl_object_id')) {
897 897
         $lang_code = ICL_LANGUAGE_CODE;
898 898
         if ($lang_code) {
899
-            $where .= " AND icl_t.language_code='" . $lang_code . "' ";
899
+            $where .= " AND icl_t.language_code='".$lang_code."' ";
900 900
         }
901 901
 
902 902
     }
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 {
920 920
     global $wp_query, $table;
921 921
     if (!empty($wp_query->query['with_pics_only'])) {
922
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
922
+        $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
923 923
     }
924 924
     return $join;
925 925
 }
@@ -938,16 +938,16 @@  discard block
 block discarded – undo
938 938
 {
939 939
     global $wp_query, $table;
940 940
     if (!empty($wp_query->query['show_featured_only'])) {
941
-        $where .= " AND " . $table . ".is_featured = '1'";
941
+        $where .= " AND ".$table.".is_featured = '1'";
942 942
     }
943 943
     if (!empty($wp_query->query['show_special_only'])) {
944
-        $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
944
+        $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
945 945
     }
946 946
     if (!empty($wp_query->query['with_pics_only'])) {
947
-        $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
947
+        $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL GROUP BY ".$table.".post_id";
948 948
     }
949 949
     if (!empty($wp_query->query['with_videos_only'])) {
950
-        $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
950
+        $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
951 951
     }
952 952
     return $where;
953 953
 }
@@ -956,21 +956,21 @@  discard block
 block discarded – undo
956 956
 function geodir_related_posts_fields($fields) {
957 957
     global $wp_query, $wpdb, $table, $post;
958 958
 
959
-    $fields .= ", " . $table . ".* ";
959
+    $fields .= ", ".$table.".* ";
960 960
 
961 961
     $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
962 962
 
963 963
     $mylat = $post->post_latitude;
964 964
     $mylon = $post->post_longitude;
965 965
 
966
-    $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
966
+    $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance ";
967 967
     return $fields;
968 968
 }
969 969
 function geodir_related_posts_fields_filter($query) {
970 970
     if (geodir_is_page('detail')) {
971 971
         $arr_detail_page_tabs = geodir_detail_page_tabs_list();
972 972
         $is_display = $arr_detail_page_tabs['related_listing']['is_display'];
973
-        if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
973
+        if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
974 974
             && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest'
975 975
             && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings']
976 976
             && $is_display
Please login to merge, or discard this patch.