Test Failed
Pull Request — master (#476)
by Kiran
12:47
created
geodirectory_hooks_actions.php 1 patch
Spacing   +212 added lines, -212 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); /*causes memory timeout on delete bulk tags*/
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function geodir_unset_prev_theme_nav_location($newname)
225 225
 {
226
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
+    $geodir_theme_location = get_option('geodir_theme_location_nav_'.$newname);
227 227
     if ($geodir_theme_location) {
228 228
         update_option('geodir_theme_location_nav', $geodir_theme_location);
229 229
     } else {
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
     include_once('geodirectory-functions/listing_filters.php');
259 259
     
260 260
     // Theme My Login compatibility fix
261
-    if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
262
-        remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
261
+    if (isset($_REQUEST['geodir_search']) && class_exists('Theme_My_Login')) {
262
+        remove_action('pre_get_posts', array(Theme_My_Login::get_object(), 'pre_get_posts'));
263 263
     }
264 264
     
265
-    if ( isset( $_REQUEST['geodir_search'] ) ) {
266
-        add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 );
267
-        add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 );
265
+    if (isset($_REQUEST['geodir_search'])) {
266
+        add_filter('geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3);
267
+        add_filter('geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3);
268 268
     }
269 269
 }
270 270
 
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
 
332 332
 /////// GEO DIRECOTORY CUSTOM HOOKS ///
333 333
 
334
-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 
335
-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
334
+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 
335
+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
336 336
 
337 337
 // Detail page sidebar content 
338 338
 add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1);
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
     do_action('geodir_after_social_sharing_buttons');
433 433
     $content_html = ob_get_clean();
434 434
     if (trim($content_html) != '')
435
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
436
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
435
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>';
436
+    if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) {
437 437
         /**
438 438
          * Filter the geodir_social_sharing_buttons() function content.
439 439
          *
@@ -473,12 +473,12 @@  discard block
 block discarded – undo
473 473
             $post_id = $post->ID;
474 474
             
475 475
             if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
476
-                $post_id = (int)$_REQUEST['pid'];
476
+                $post_id = (int) $_REQUEST['pid'];
477 477
             }
478 478
 
479 479
             $postlink = get_permalink(geodir_add_listing_page_id());
480 480
             $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
481
-            echo ' <p class="edit_link"><i class="fas fa-pencil-alt"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
481
+            echo ' <p class="edit_link"><i class="fas fa-pencil-alt"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>';
482 482
         }
483 483
     }// end of if, if its a preview or not
484 484
     /**
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
     do_action('geodir_after_edit_post_link');
490 490
     $content_html = ob_get_clean();
491 491
     if (trim($content_html) != '')
492
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
493
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
492
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>';
493
+    if ((int) get_option('geodir_disable_user_links_section') != 1) {
494 494
         /**
495 495
          * Filter the geodir_edit_post_link() function content.
496 496
          *
@@ -511,11 +511,11 @@  discard block
 block discarded – undo
511 511
  */
512 512
 function geodir_detail_page_google_analytics()
513 513
 {
514
-    if ( ! get_option( 'geodir_ga_stats' ) ) {
514
+    if (!get_option('geodir_ga_stats')) {
515 515
 		return;
516 516
 	}
517
-	global $post,$preview;
518
-    if($preview){return '';}
517
+	global $post, $preview;
518
+    if ($preview) {return ''; }
519 519
     $package_info = array();
520 520
     $package_info = geodir_post_package_info($package_info, $post);
521 521
 
@@ -547,14 +547,14 @@  discard block
 block discarded – undo
547 547
     $hide_refresh = get_option('geodir_ga_auto_refresh');
548 548
     
549 549
     $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
550
-    if (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' )) ) {
550
+    if (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'))) {
551 551
         $page_url = urlencode($_SERVER['REQUEST_URI']);
552 552
         ?>
553 553
         <script type="text/javascript">
554 554
             var gd_gaTimeOut;
555
-            var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
556
-            var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>;
557
-            var gd_gaAutoRefresh = <?php echo $auto_refresh;?>;
555
+            var gd_gaTime = parseInt('<?php echo $refresh_time; ?>');
556
+            var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>;
557
+            var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>;
558 558
             ga_data1 = false;
559 559
             ga_data2 = false;
560 560
             ga_data3 = false;
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
             }
696 696
 
697 697
             function gdga_noResults() {
698
-                jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>');
698
+                jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>');
699 699
                 jQuery('#gdga-legend-container').html('');
700 700
             }
701 701
 
@@ -727,18 +727,18 @@  discard block
 block discarded – undo
727 727
                     var data2 = results[1].rows.map(function(row) { return +row[2]; });
728 728
                     //var labelsN = results[0].rows.map(function(row) { return +row[1]; });
729 729
 
730
-                    var labels = ['<?php _e('Jan', 'geodirectory');?>',
731
-                        '<?php _e('Feb', 'geodirectory');?>',
732
-                        '<?php _e('Mar', 'geodirectory');?>',
733
-                        '<?php _e('Apr', 'geodirectory');?>',
734
-                        '<?php _e('May', 'geodirectory');?>',
735
-                        '<?php _e('Jun', 'geodirectory');?>',
736
-                        '<?php _e('Jul', 'geodirectory');?>',
737
-                        '<?php _e('Aug', 'geodirectory');?>',
738
-                        '<?php _e('Sep', 'geodirectory');?>',
739
-                        '<?php _e('Oct', 'geodirectory');?>',
740
-                        '<?php _e('Nov', 'geodirectory');?>',
741
-                        '<?php _e('Dec', 'geodirectory');?>'];
730
+                    var labels = ['<?php _e('Jan', 'geodirectory'); ?>',
731
+                        '<?php _e('Feb', 'geodirectory'); ?>',
732
+                        '<?php _e('Mar', 'geodirectory'); ?>',
733
+                        '<?php _e('Apr', 'geodirectory'); ?>',
734
+                        '<?php _e('May', 'geodirectory'); ?>',
735
+                        '<?php _e('Jun', 'geodirectory'); ?>',
736
+                        '<?php _e('Jul', 'geodirectory'); ?>',
737
+                        '<?php _e('Aug', 'geodirectory'); ?>',
738
+                        '<?php _e('Sep', 'geodirectory'); ?>',
739
+                        '<?php _e('Oct', 'geodirectory'); ?>',
740
+                        '<?php _e('Nov', 'geodirectory'); ?>',
741
+                        '<?php _e('Dec', 'geodirectory'); ?>'];
742 742
 
743 743
                     // Ensure the data arrays are at least as long as the labels array.
744 744
                     // Chart.js bar charts don't (yet) accept sparse datasets.
@@ -751,13 +751,13 @@  discard block
 block discarded – undo
751 751
                         labels : labels,
752 752
                         datasets : [
753 753
                             {
754
-                                label: '<?php _e('Last Year', 'geodirectory');?>',
754
+                                label: '<?php _e('Last Year', 'geodirectory'); ?>',
755 755
                                 fillColor : "rgba(220,220,220,0.5)",
756 756
                                 strokeColor : "rgba(220,220,220,1)",
757 757
                                 data : data2
758 758
                             },
759 759
                             {
760
-                                label: '<?php _e('This Year', 'geodirectory');?>',
760
+                                label: '<?php _e('This Year', 'geodirectory'); ?>',
761 761
                                 fillColor : "rgba(151,187,205,0.5)",
762 762
                                 strokeColor : "rgba(151,187,205,1)",
763 763
                                 data : data1
@@ -802,30 +802,30 @@  discard block
 block discarded – undo
802 802
 
803 803
                     <?php
804 804
                     // Here we list the shorthand days of the week so it can be used in translation.
805
-                    __("Mon",'geodirectory');
806
-                    __("Tue",'geodirectory');
807
-                    __("Wed",'geodirectory');
808
-                    __("Thu",'geodirectory');
809
-                    __("Fri",'geodirectory');
810
-                    __("Sat",'geodirectory');
811
-                    __("Sun",'geodirectory');
805
+                    __("Mon", 'geodirectory');
806
+                    __("Tue", 'geodirectory');
807
+                    __("Wed", 'geodirectory');
808
+                    __("Thu", 'geodirectory');
809
+                    __("Fri", 'geodirectory');
810
+                    __("Sat", 'geodirectory');
811
+                    __("Sun", 'geodirectory');
812 812
                     ?>
813 813
 
814 814
                     labels = [
815
-                        "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
816
-                        "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>",
817
-                        "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>",
818
-                        "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>",
819
-                        "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>",
820
-                        "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>",
821
-                        "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>"
815
+                        "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>",
816
+                        "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>",
817
+                        "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>",
818
+                        "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>",
819
+                        "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>",
820
+                        "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>",
821
+                        "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>"
822 822
                     ];
823 823
 
824 824
                     var data = {
825 825
                         labels : labels,
826 826
                         datasets : [
827 827
                             {
828
-                                label: '<?php _e('Last Week', 'geodirectory');?>',
828
+                                label: '<?php _e('Last Week', 'geodirectory'); ?>',
829 829
                                 fillColor : "rgba(220,220,220,0.5)",
830 830
                                 strokeColor : "rgba(220,220,220,1)",
831 831
                                 pointColor : "rgba(220,220,220,1)",
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
                                 data : data2
834 834
                             },
835 835
                             {
836
-                                label: '<?php _e('This Week', 'geodirectory');?>',
836
+                                label: '<?php _e('This Week', 'geodirectory'); ?>',
837 837
                                 fillColor : "rgba(151,187,205,0.5)",
838 838
                                 strokeColor : "rgba(151,187,205,1)",
839 839
                                 pointColor : "rgba(151,187,205,1)",
@@ -1040,18 +1040,18 @@  discard block
 block discarded – undo
1040 1040
         </style>
1041 1041
         <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
1042 1042
         <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
1043
-        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button>
1043
+        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button>
1044 1044
         <span id="ga_stats" class="gdga-analytics-box" style="display:none">
1045
-            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div>
1045
+            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div>
1046 1046
             <div id="gd-active-users-container">
1047
-                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fas fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory');?>"></i><?php _e("Active Users:", 'geodirectory');?>
1047
+                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fas fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory'); ?>"></i><?php _e("Active Users:", 'geodirectory'); ?>
1048 1048
                     <b class="gd-ActiveUsers-value">0</b>
1049 1049
                 </div>
1050 1050
             </div>
1051 1051
             <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;">
1052
-                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option>
1053
-                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option>
1054
-                <option value="country"><?php _e("Top Countries", 'geodirectory');?></option>
1052
+                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option>
1053
+                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option>
1054
+                <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option>
1055 1055
             </select>
1056 1056
             <div class="Chartjs-figure" id="gdga-chart-container"></div>
1057 1057
             <ol class="Chartjs-legend" id="gdga-legend-container"></ol>
@@ -1067,8 +1067,8 @@  discard block
 block discarded – undo
1067 1067
     do_action('geodir_after_google_analytics');
1068 1068
     $content_html = ob_get_clean();
1069 1069
     if (trim($content_html) != '')
1070
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1071
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1070
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>';
1071
+    if ((int) get_option('geodir_disable_google_analytics_section') != 1) {
1072 1072
         /**
1073 1073
          * Filter the geodir_edit_post_link() function content.
1074 1074
          *
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 {
1095 1095
     global $post, $preview, $post_images;
1096 1096
     
1097
-    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1097
+    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int) $post->ID)) {
1098 1098
         return;
1099 1099
     }
1100 1100
     ob_start(); // Start  buffering;
@@ -1129,10 +1129,10 @@  discard block
 block discarded – undo
1129 1129
        
1130 1130
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1131 1131
 	   
1132
-	   $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 />';
1132
+	   $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 />';
1133 1133
 
1134 1134
         $html .= '<span class="item">';
1135
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1135
+        $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>';
1136 1136
 
1137 1137
         if ($post_images) {
1138 1138
             foreach ($post_images as $img) {
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
         }
1143 1143
 
1144 1144
         if (isset($post_img) && $post_img) {
1145
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1145
+            $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />';
1146 1146
         }
1147 1147
 
1148 1148
         $html .= '</span>';
@@ -1169,9 +1169,9 @@  discard block
 block discarded – undo
1169 1169
     do_action('geodir_after_detail_page_review_rating');
1170 1170
     $content_html = ob_get_clean();
1171 1171
     if (trim($content_html) != '') {
1172
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1172
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>';
1173 1173
     }
1174
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1174
+    if ((int) get_option('geodir_disable_rating_info_section') != 1) {
1175 1175
         /**
1176 1176
          * Filter the geodir_detail_page_review_rating() function content.
1177 1177
          *
@@ -1210,8 +1210,8 @@  discard block
 block discarded – undo
1210 1210
 
1211 1211
     $content_html = ob_get_clean();
1212 1212
     if (trim($content_html) != '')
1213
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1214
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1213
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>';
1214
+    if ((int) get_option('geodir_disable_listing_info_section') != 1) {
1215 1215
         /**
1216 1216
          * Filter the output html for function geodir_detail_page_more_info().
1217 1217
          *
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
1313 1313
 		'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
1314 1314
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1315
-		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1315
+		'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1316 1316
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1317 1317
         'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1318 1318
         'geodir_map_name' => geodir_map_name(),
@@ -1344,10 +1344,10 @@  discard block
 block discarded – undo
1344 1344
     foreach ($arr_alert_msg as $key => $value) {
1345 1345
         if (!is_scalar($value))
1346 1346
             continue;
1347
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1347
+        $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
1348 1348
     }
1349 1349
 
1350
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1350
+    $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';';
1351 1351
     echo '<script>';
1352 1352
     echo $script;
1353 1353
     echo '</script>';
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
         $geodir_old_sidebars = get_option('geodir_sidebars');
1438 1438
         if (is_array($geodir_old_sidebars)) {
1439 1439
             foreach ($geodir_old_sidebars as $key => $val) {
1440
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1440
+                if (0 === strpos($key, 'geodir_'))// if gd widget
1441 1441
                 {
1442 1442
                     $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1443 1443
                 }
@@ -1516,7 +1516,7 @@  discard block
 block discarded – undo
1516 1516
         global $post;
1517 1517
         $term_condition = '';
1518 1518
         if (isset($_REQUEST['backandedit'])) {
1519
-            $post = (object)$gd_session->get('listing');
1519
+            $post = (object) $gd_session->get('listing');
1520 1520
             $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1521 1521
         }
1522 1522
 
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
                     echo 'checked="checked"';
1531 1531
                 } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1532 1532
                        class="geodir_textfield" value="1"
1533
-                       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>
1533
+                       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>
1534 1534
 				</span>
1535 1535
             </div>
1536 1536
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
@@ -1570,7 +1570,7 @@  discard block
 block discarded – undo
1570 1570
         /** This action is documented in geodirectory_template_actions.php */
1571 1571
         $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1572 1572
         
1573
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1573
+        if (!($desc_limit === '' || (int) $desc_limit > 0)) {
1574 1574
             $is_display = false;
1575 1575
         }
1576 1576
     }
@@ -1618,16 +1618,16 @@  discard block
 block discarded – undo
1618 1618
     global $wpdb, $plugin_prefix;
1619 1619
 	
1620 1620
 	// Remove unused virtual page
1621
-	$listings_page_id = (int)get_option('geodir_listing_page');
1621
+	$listings_page_id = (int) get_option('geodir_listing_page');
1622 1622
 	if ($listings_page_id) {
1623
-		$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')));
1623
+		$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')));
1624 1624
         delete_option('geodir_listing_page');
1625 1625
 	}
1626 1626
 
1627 1627
     if (!get_option('geodir_changes_in_custom_fields_table')) {
1628 1628
         $wpdb->query(
1629 1629
             $wpdb->prepare(
1630
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1630
+                "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s",
1631 1631
                 array('1', '1', 'admin')
1632 1632
             )
1633 1633
         );
@@ -1635,9 +1635,9 @@  discard block
 block discarded – undo
1635 1635
 
1636 1636
         /* --- terms meta value set --- */
1637 1637
 
1638
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1638
+        update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png');
1639 1639
 
1640
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1640
+        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%')));
1641 1641
 
1642 1642
         if (!empty($options_data)) {
1643 1643
 
@@ -1645,7 +1645,7 @@  discard block
 block discarded – undo
1645 1645
 
1646 1646
                 $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1647 1647
 
1648
-                $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)));
1648
+                $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)));
1649 1649
 
1650 1650
                 if (!empty($taxonomies_data)) {
1651 1651
 
@@ -1654,17 +1654,17 @@  discard block
 block discarded – undo
1654 1654
                         $taxObject = get_taxonomy($taxobj->taxonomy);
1655 1655
                         $post_type = $taxObject->object_type[0];
1656 1656
 
1657
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1657
+                        $opt_value = 'tax_meta_'.$post_type.'_'.$option_val;
1658 1658
 
1659
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1659
+                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val)));
1660 1660
 
1661 1661
                         if ($duplicate_data) {
1662 1662
 
1663
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1663
+                            $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1664 1664
 
1665 1665
                         } else {
1666 1666
 
1667
-                            $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)));
1667
+                            $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)));
1668 1668
 
1669 1669
                         }
1670 1670
 
@@ -1698,14 +1698,14 @@  discard block
 block discarded – undo
1698 1698
 
1699 1699
     global $wpdb, $table_prefix;
1700 1700
 
1701
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1701
+    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug)));
1702 1702
 
1703 1703
     if ($slug_exists) {
1704 1704
 
1705 1705
         $suffix = 1;
1706 1706
         do {
1707
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1708
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1707
+            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1708
+            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name)));
1709 1709
             $suffix++;
1710 1710
         } while ($location_slug_check && $suffix < 100);
1711 1711
 
@@ -1720,7 +1720,7 @@  discard block
 block discarded – undo
1720 1720
 
1721 1721
 add_action('edited_term', 'geodir_update_term_slug', '1', 3);
1722 1722
 add_action('create_term', 'geodir_update_term_slug', '1', 3);
1723
-add_action( 'delete_term', 'geodir_on_delete_term', 1, 5 );
1723
+add_action('delete_term', 'geodir_on_delete_term', 1, 5);
1724 1724
 
1725 1725
 /**
1726 1726
  * Update term slug.
@@ -1759,7 +1759,7 @@  discard block
 block discarded – undo
1759 1759
 
1760 1760
         $suffix = 1;
1761 1761
         do {
1762
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1762
+            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1763 1763
 
1764 1764
             /** This action is documented in geodirectory_hooks_actions.php */
1765 1765
             $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
@@ -1771,7 +1771,7 @@  discard block
 block discarded – undo
1771 1771
 
1772 1772
         //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1773 1773
 
1774
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1774
+        $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1775 1775
 
1776 1776
     }
1777 1777
 	
@@ -1780,18 +1780,18 @@  discard block
 block discarded – undo
1780 1780
 	$post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL;
1781 1781
 	
1782 1782
 	$post_types = geodir_get_posttypes();
1783
-	if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) {		
1784
-		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id)));
1783
+	if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) {		
1784
+		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id)));
1785 1785
 		
1786 1786
 		if (!empty($posts_obj)) {
1787 1787
 			foreach ($posts_obj as $post_obj) {
1788 1788
 				$post_id = $post_obj->object_id;
1789 1789
 				
1790
-				$raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names'));
1790
+				$raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names'));
1791 1791
 				$post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : '';
1792 1792
 				
1793
-				$listing_table = $plugin_prefix . $post_type . '_detail';
1794
-				$wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1793
+				$listing_table = $plugin_prefix.$post_type.'_detail';
1794
+				$wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1795 1795
 			}
1796 1796
 		}
1797 1797
 	}
@@ -1825,7 +1825,7 @@  discard block
 block discarded – undo
1825 1825
     if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1826 1826
         return $slug_exists = true;
1827 1827
 
1828
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1828
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1829 1829
         return $slug_exists = true;
1830 1830
 
1831 1831
     return $slug_exists;
@@ -1866,43 +1866,43 @@  discard block
 block discarded – undo
1866 1866
 
1867 1867
 
1868 1868
     $gd_page = '';
1869
-    if(geodir_is_page('home')){
1869
+    if (geodir_is_page('home')) {
1870 1870
         $gd_page = 'home';
1871 1871
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1872 1872
     }
1873
-    elseif(geodir_is_page('detail')){
1873
+    elseif (geodir_is_page('detail')) {
1874 1874
         $gd_page = 'detail';
1875 1875
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1876 1876
     }
1877
-    elseif(geodir_is_page('pt')){
1877
+    elseif (geodir_is_page('pt')) {
1878 1878
         $gd_page = 'pt';
1879 1879
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1880 1880
     }
1881
-    elseif(geodir_is_page('listing')){
1881
+    elseif (geodir_is_page('listing')) {
1882 1882
         $gd_page = 'listing';
1883 1883
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1884 1884
     }
1885
-    elseif(geodir_is_page('location')){
1885
+    elseif (geodir_is_page('location')) {
1886 1886
         $gd_page = 'location';
1887 1887
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1888 1888
     }
1889
-    elseif(geodir_is_page('search')){
1889
+    elseif (geodir_is_page('search')) {
1890 1890
         $gd_page = 'search';
1891 1891
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1892 1892
     }
1893
-    elseif(geodir_is_page('add-listing')){
1893
+    elseif (geodir_is_page('add-listing')) {
1894 1894
         $gd_page = 'add-listing';
1895 1895
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1896 1896
     }
1897
-    elseif(geodir_is_page('author')){
1897
+    elseif (geodir_is_page('author')) {
1898 1898
         $gd_page = 'author';
1899 1899
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1900 1900
     }
1901
-    elseif(geodir_is_page('login')){
1901
+    elseif (geodir_is_page('login')) {
1902 1902
         $gd_page = 'login';
1903 1903
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1904 1904
     }
1905
-    elseif(geodir_is_page('listing-success')){
1905
+    elseif (geodir_is_page('listing-success')) {
1906 1906
         $gd_page = 'listing-success';
1907 1907
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1908 1908
     }
@@ -1934,12 +1934,12 @@  discard block
 block discarded – undo
1934 1934
 
1935 1935
     if (!get_option('geodir_set_post_attachments')) {
1936 1936
 
1937
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1938
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1937
+        require_once(ABSPATH.'wp-admin/includes/image.php');
1938
+        require_once(ABSPATH.'wp-admin/includes/file.php');
1939 1939
 
1940 1940
         $all_postypes = geodir_get_posttypes();
1941 1941
 
1942
-        foreach($all_postypes as $post_type){
1942
+        foreach ($all_postypes as $post_type) {
1943 1943
             $args = array(
1944 1944
                 'posts_per_page' => -1,
1945 1945
                 'post_type' => $post_type,
@@ -2033,7 +2033,7 @@  discard block
 block discarded – undo
2033 2033
 {
2034 2034
     $user_id = get_current_user_id();
2035 2035
 
2036
-    if(!$user_id){return $post;}
2036
+    if (!$user_id) {return $post; }
2037 2037
 
2038 2038
     $gd_post_types = geodir_get_posttypes();
2039 2039
 
@@ -2142,7 +2142,7 @@  discard block
 block discarded – undo
2142 2142
 
2143 2143
         if (array_key_exists('post_video', $tabs_arr)) {
2144 2144
 
2145
-            $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)));
2145
+            $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)));
2146 2146
 
2147 2147
             if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2148 2148
                 $tabs_arr['post_video']['heading_text'] = $field_title;
@@ -2150,7 +2150,7 @@  discard block
 block discarded – undo
2150 2150
 
2151 2151
         if (array_key_exists('special_offers', $tabs_arr)) {
2152 2152
 
2153
-            $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)));
2153
+            $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)));
2154 2154
 
2155 2155
             if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2156 2156
                 $tabs_arr['special_offers']['heading_text'] = $field_title;
@@ -2171,7 +2171,7 @@  discard block
 block discarded – undo
2171 2171
  */
2172 2172
 function geodir_remove_template_redirect_actions()
2173 2173
 {
2174
-    if (geodir_is_page('login')){
2174
+    if (geodir_is_page('login')) {
2175 2175
         remove_all_actions('template_redirect');
2176 2176
         remove_action('init', 'avia_modify_front', 10);
2177 2177
     }
@@ -2218,25 +2218,25 @@  discard block
 block discarded – undo
2218 2218
         $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2219 2219
 
2220 2220
         $wpdb->query(
2221
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2221
+            $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ",
2222 2222
                 array($post_id, $split_img_file_path)
2223 2223
             )
2224 2224
         );
2225 2225
 
2226 2226
         $attachment_data = $wpdb->get_row(
2227
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2227
+            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d",
2228 2228
                 array($post_id)
2229 2229
             )
2230 2230
         );
2231 2231
 
2232 2232
         if (!empty($attachment_data)) {
2233
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2233
+            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2234 2234
         }
2235 2235
 
2236 2236
 
2237
-        $table_name = $plugin_prefix . $post_type . '_detail';
2237
+        $table_name = $plugin_prefix.$post_type.'_detail';
2238 2238
 
2239
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2239
+        $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id);
2240 2240
 
2241 2241
         geodir_set_wp_featured_image($post_id);
2242 2242
 
@@ -2264,9 +2264,9 @@  discard block
 block discarded – undo
2264 2264
 
2265 2265
     foreach ($all_postypes as $posttype) {
2266 2266
 
2267
-        $tablename = $plugin_prefix . $posttype . '_detail';
2267
+        $tablename = $plugin_prefix.$posttype.'_detail';
2268 2268
 
2269
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2269
+        $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename);
2270 2270
 
2271 2271
         if (!empty($get_post_data)) {
2272 2272
 
@@ -2274,7 +2274,7 @@  discard block
 block discarded – undo
2274 2274
 
2275 2275
                 $post_id = $data->post_id;
2276 2276
 
2277
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2277
+                $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''");
2278 2278
 
2279 2279
                 if (!empty($attachment_data)) {
2280 2280
 
@@ -2291,22 +2291,22 @@  discard block
 block discarded – undo
2291 2291
 
2292 2292
                         $file_name = $file_info['basename'];
2293 2293
 
2294
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2294
+                        $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name;
2295 2295
 
2296 2296
                         if (!file_exists($img_arr['path'])) {
2297 2297
 
2298
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2298
+                            $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID);
2299 2299
 
2300 2300
                         }
2301 2301
 
2302 2302
                     }
2303 2303
 
2304
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2304
+                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id");
2305 2305
 
2306 2306
                     if (!empty($attachment_data)) {
2307 2307
 
2308 2308
                         if ($attachment_data->ID)
2309
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2309
+                            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2310 2310
 
2311 2311
                     } else {
2312 2312
 
@@ -2320,7 +2320,7 @@  discard block
 block discarded – undo
2320 2320
 
2321 2321
                     }
2322 2322
 
2323
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2323
+                    $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id);
2324 2324
 
2325 2325
                     geodir_set_wp_featured_image($post_id);
2326 2326
 
@@ -2349,7 +2349,7 @@  discard block
 block discarded – undo
2349 2349
 {
2350 2350
 
2351 2351
     if (!get_option('geodir_default_rating_star_icon')) {
2352
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2352
+        update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png');
2353 2353
     }
2354 2354
 
2355 2355
 }
@@ -2369,7 +2369,7 @@  discard block
 block discarded – undo
2369 2369
 function geodir_user_post_listing_count($user_id = 0)
2370 2370
 {
2371 2371
     global $wpdb, $plugin_prefix, $current_user;
2372
-    if(!$user_id){
2372
+    if (!$user_id) {
2373 2373
         $user_id = $current_user->ID;
2374 2374
     }
2375 2375
 
@@ -2378,7 +2378,7 @@  discard block
 block discarded – undo
2378 2378
     $user_listing = array();
2379 2379
     if ($user_id && is_array($all_posts) && !empty($all_posts)) {
2380 2380
         foreach ($all_posts as $ptype) {
2381
-            $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' OR post_status = 'pending' )");
2381
+            $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' OR post_status = 'pending' )");
2382 2382
 
2383 2383
             if ($total_posts > 0) {
2384 2384
                 $user_listing[$ptype] = $total_posts;
@@ -2419,19 +2419,19 @@  discard block
 block discarded – undo
2419 2419
 
2420 2420
         $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2421 2421
         //remove video and special offers if it is already set to show
2422
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2422
+        if (isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']) {
2423 2423
             $unset_video = true;
2424 2424
         }
2425 2425
 
2426
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2426
+        if (isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']) {
2427 2427
             $unset_special_offers = true;
2428 2428
         }
2429
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2430
-            foreach($custom_fields as $key => $custom_field){
2431
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2429
+        if (isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)) {
2430
+            foreach ($custom_fields as $key => $custom_field) {
2431
+                if ($custom_field['name'] == 'geodir_video' && isset($unset_video)) {
2432 2432
                     unset($custom_fields[$key]);
2433 2433
                 }
2434
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2434
+                if ($custom_field['name'] == 'geodir_special_offers' && isset($unset_special_offers)) {
2435 2435
                     unset($custom_fields[$key]);
2436 2436
                 }
2437 2437
             }
@@ -2448,7 +2448,7 @@  discard block
 block discarded – undo
2448 2448
                     $post->{$field_name} = $_REQUEST[$field_name];
2449 2449
                 }
2450 2450
 
2451
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2451
+                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
2452 2452
                     if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2453 2453
                         continue;
2454 2454
                     }
@@ -2481,7 +2481,7 @@  discard block
 block discarded – undo
2481 2481
                     $post->{$field_name} = $_REQUEST[$field_name];
2482 2482
                 }
2483 2483
 
2484
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2484
+                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
2485 2485
                     $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2486 2486
                     $site_title = trim($field['site_title']);
2487 2487
                     $type = $field;
@@ -2497,21 +2497,21 @@  discard block
 block discarded – undo
2497 2497
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2498 2498
                         $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2499 2499
 
2500
-                    }else{
2500
+                    } else {
2501 2501
                         $i = 0;
2502 2502
                         $fieldset_count++;
2503 2503
                         $field_set_start = 1;
2504
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2504
+                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count;
2505 2505
                         $fieldset_arr[$fieldset_count]['label'] = $label;
2506 2506
                     }
2507 2507
 
2508 2508
 
2509
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2509
+                    if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; }
2510 2510
                     $type = stripslashes_deep($type); // strip slashes
2511
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2511
+                    if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; }
2512 2512
                     $html = '';
2513 2513
                     $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2514
-                    if($html_var=='post'){$html_var='post_address';}
2514
+                    if ($html_var == 'post') {$html_var = 'post_address'; }
2515 2515
                     $field_icon = geodir_field_icon_proccess($type);
2516 2516
                     $filed_type = $type['type'];
2517 2517
 
@@ -2524,7 +2524,7 @@  discard block
 block discarded – undo
2524 2524
                      * @param string $fields_location The location the field is to be show.
2525 2525
                      * @param array $type The array of field values.
2526 2526
                      */
2527
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2527
+                    $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
2528 2528
 
2529 2529
 
2530 2530
                     /**
@@ -2570,7 +2570,7 @@  discard block
 block discarded – undo
2570 2570
                                  * @param string $htmlvar_name The field HTML var name.
2571 2571
                                  */
2572 2572
                                 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2573
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2573
+                                'tab_content' => '<div class="geodir-company_info field-group xxx">'.$fieldset_html.'</div>'
2574 2574
                             );
2575 2575
                         }
2576 2576
                     } else {
@@ -2634,7 +2634,7 @@  discard block
 block discarded – undo
2634 2634
             }
2635 2635
             $status .= ")</strong>";
2636 2636
 
2637
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2637
+            $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>';
2638 2638
         }
2639 2639
     }
2640 2640
 
@@ -2703,7 +2703,7 @@  discard block
 block discarded – undo
2703 2703
  * @return array Modified class array.
2704 2704
  */
2705 2705
 function geodir_body_class_active_map($classes = array()) {
2706
-    $classes[] = 'gd-map-' . geodir_map_name();
2706
+    $classes[] = 'gd-map-'.geodir_map_name();
2707 2707
 
2708 2708
     return $classes;
2709 2709
 }
@@ -2718,7 +2718,7 @@  discard block
 block discarded – undo
2718 2718
  * @return string Modified class string.
2719 2719
  */
2720 2720
 function geodir_admin_body_class_active_map($class = '') {    
2721
-    $class .= ' gd-map-' . geodir_map_name();
2721
+    $class .= ' gd-map-'.geodir_map_name();
2722 2722
 
2723 2723
     return $class;
2724 2724
 }
@@ -2738,7 +2738,7 @@  discard block
 block discarded – undo
2738 2738
  * @return array Translation texts.
2739 2739
  */
2740 2740
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2741
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2741
+    $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array();
2742 2742
 
2743 2743
     $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_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2744 2744
 
@@ -2804,17 +2804,17 @@  discard block
 block discarded – undo
2804 2804
  * @param array $args The array of menu arguments.
2805 2805
  * @return array The modified arguments.
2806 2806
  */
2807
-function geodir_add_nav_menu_class( $args )
2807
+function geodir_add_nav_menu_class($args)
2808 2808
 {
2809 2809
 
2810
-        if(isset($args['menu_class'])){
2810
+        if (isset($args['menu_class'])) {
2811 2811
             $args['menu_class'] = $args['menu_class']." gd-menu-z";
2812 2812
         }
2813 2813
     
2814 2814
     return $args;
2815 2815
 }
2816 2816
 
2817
-add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
2817
+add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class');
2818 2818
 
2819 2819
 /**
2820 2820
  * Filters WordPress locale ID.
@@ -2854,10 +2854,10 @@  discard block
 block discarded – undo
2854 2854
         }
2855 2855
         
2856 2856
         add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2857
-        add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2858
-		add_action( 'geodir_after_search_form', 'geodir_wpml_add_language_input_field' );
2857
+        add_action('geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1);
2858
+		add_action('geodir_after_search_form', 'geodir_wpml_add_language_input_field');
2859 2859
         if (is_admin()) {
2860
-            add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2860
+            add_filter('geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1);
2861 2861
         }
2862 2862
     }
2863 2863
 }
@@ -2886,7 +2886,7 @@  discard block
 block discarded – undo
2886 2886
         }        
2887 2887
         
2888 2888
         if (!empty($keep_vars)) {
2889
-            foreach ( $languages as $code => $url) {
2889
+            foreach ($languages as $code => $url) {
2890 2890
                 $filter_url = $url['url'];
2891 2891
                 
2892 2892
                 foreach ($keep_vars as $var) {
@@ -2905,7 +2905,7 @@  discard block
 block discarded – undo
2905 2905
 
2906 2906
     return $languages;
2907 2907
 }
2908
-add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2908
+add_filter('icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1);
2909 2909
 
2910 2910
 /**
2911 2911
  * Remove Yoast SEO hook if disabled on GD pages.
@@ -2913,18 +2913,18 @@  discard block
 block discarded – undo
2913 2913
  * @since 1.6.18
2914 2914
  *
2915 2915
  */
2916
-function geodir_remove_yoast_seo_metas(){
2917
-    if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2916
+function geodir_remove_yoast_seo_metas() {
2917
+    if (class_exists('WPSEO_Frontend') && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas()) {
2918 2918
         $wpseo = WPSEO_Frontend::get_instance();
2919 2919
         
2920
-        remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2921
-        remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2922
-        remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2923
-        remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2924
-        remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2925
-        remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2920
+        remove_action('wp_head', array($wpseo, 'metadesc'), 6);
2921
+        remove_action('wp_head', array($wpseo, 'metakeywords'), 11);
2922
+        remove_filter('pre_get_document_title', array($wpseo, 'title'), 15);
2923
+        remove_filter('wp_title', array($wpseo, 'title'), 15, 3);
2924
+        remove_filter('thematic_doctitle', array($wpseo, 'title'), 15);
2925
+        remove_filter('woo_title', array($wpseo, 'fix_woo_title'), 99);
2926 2926
         
2927
-        remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2927
+        remove_action('template_redirect', 'wpseo_frontend_head_init', 999);
2928 2928
     }
2929 2929
 }
2930 2930
 
@@ -2939,22 +2939,22 @@  discard block
 block discarded – undo
2939 2939
  *
2940 2940
  */
2941 2941
  function geodir_wpml_ajax_set_guest_lang() {    
2942
-    if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2943
-        if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2942
+    if (geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in()) {
2943
+        if (empty($_GET['lang']) && !(!empty($_SERVER['REQUEST_URI']) && preg_match('@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename(preg_replace('@\?.*$@', '', $_SERVER['REQUEST_URI']))))) {
2944 2944
             global $sitepress;
2945 2945
             
2946 2946
             $referer = wp_get_referer();
2947 2947
             
2948 2948
             $current_lang = $sitepress->get_current_language();
2949
-            $referrer_lang = $sitepress->get_language_from_url( $referer );
2949
+            $referrer_lang = $sitepress->get_language_from_url($referer);
2950 2950
             
2951
-            if ( $referrer_lang && $current_lang != $referrer_lang ) {
2951
+            if ($referrer_lang && $current_lang != $referrer_lang) {
2952 2952
                 $_GET['lang'] = $referrer_lang;
2953 2953
             }
2954 2954
         }
2955 2955
     }
2956 2956
 }
2957
-add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 );
2957
+add_action('plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1);
2958 2958
 
2959 2959
 /**
2960 2960
  * Change country slug czech-republic to czechia and redirect.
@@ -2975,18 +2975,18 @@  discard block
 block discarded – undo
2975 2975
         }
2976 2976
         
2977 2977
         $redirect = false;
2978
-        if (strpos($current_url, '/' . $search . '/') !== false) {
2978
+        if (strpos($current_url, '/'.$search.'/') !== false) {
2979 2979
             $redirect = true;
2980
-            $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2980
+            $current_url = preg_replace('/\/'.$search.'\//', '/'.$replace.'/', $current_url, 1);
2981 2981
         }
2982 2982
         
2983 2983
         if ($has_slash != "/") {
2984 2984
             $current_url = trim($current_url, '/');
2985 2985
         }
2986 2986
         
2987
-        if (strpos($current_url, 'gd_country=' . $search) !== false) {
2987
+        if (strpos($current_url, 'gd_country='.$search) !== false) {
2988 2988
             $redirect = true;
2989
-            $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2989
+            $current_url = str_replace('gd_country='.$search, 'gd_country='.$replace, $current_url);
2990 2990
         }
2991 2991
 
2992 2992
         if ($redirect) {
@@ -3012,10 +3012,10 @@  discard block
 block discarded – undo
3012 3012
  * @param int    $post_parent   Post parent ID
3013 3013
  * @param string $original_slug The original post slug.
3014 3014
  */
3015
-function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
3015
+function geodir_check_post_to_term_slug($slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug) {
3016 3016
     global $wpdb, $sitepress;
3017 3017
     
3018
-    if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3018
+    if ($post_type && strpos($post_type, 'gd_') === 0) {
3019 3019
         $wpml_post_join = "";
3020 3020
         $wpml_post_where = "";
3021 3021
         $wpml_term_join = "";
@@ -3029,28 +3029,28 @@  discard block
 block discarded – undo
3029 3029
             }
3030 3030
             
3031 3031
             $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3032
-            $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3032
+            $wpml_post_where = " AND icl_t.language_code = '".$post_language."'";
3033 3033
             
3034 3034
             $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
3035
-            $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3035
+            $wpml_term_where = " AND icl_t.language_code = '".$post_language."'";
3036 3036
         }
3037 3037
 
3038
-        $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
3038
+        $term_slug_check = $wpdb->get_var($wpdb->prepare("SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '".$post_type."category' OR tt.taxonomy = '".$post_type."_tags' ) {$wpml_term_where} LIMIT 1", $slug));
3039 3039
 
3040
-        if ( $term_slug_check ) {
3040
+        if ($term_slug_check) {
3041 3041
             $suffix = 1;
3042 3042
             
3043 3043
             do {
3044
-                $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3044
+                $alt_slug = _truncate_post_slug($original_slug, 200 - (strlen($suffix) + 1))."-$suffix";
3045 3045
                 
3046
-                $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
3046
+                $term_check = $wpdb->get_var($wpdb->prepare("SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '".$post_type."category' OR tt.taxonomy = '".$post_type."_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug));
3047 3047
                 
3048
-                $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
3048
+                $post_check = !$term_check && $wpdb->get_var($wpdb->prepare("SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID));
3049 3049
                 
3050 3050
                 $term_slug_check = $term_check || $post_check;
3051 3051
                 
3052 3052
                 $suffix++;
3053
-            } while ( $term_slug_check );
3053
+            } while ($term_slug_check);
3054 3054
             
3055 3055
             $slug = $alt_slug;
3056 3056
         }
@@ -3058,7 +3058,7 @@  discard block
 block discarded – undo
3058 3058
     
3059 3059
     return $slug;
3060 3060
 }
3061
-add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 );
3061
+add_filter('wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6);
3062 3062
 
3063 3063
 /**
3064 3064
  * Check whether a post name with slug exists or not.
@@ -3075,51 +3075,51 @@  discard block
 block discarded – undo
3075 3075
  * @param int $term_id The term ID.
3076 3076
  * @return bool true when exists. false when not exists.
3077 3077
  */
3078
-function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) {
3078
+function geodir_check_term_to_post_slug($slug_exists, $slug, $term_id) {
3079 3079
     global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3080 3080
     
3081
-    if ( $slug_exists ) {
3081
+    if ($slug_exists) {
3082 3082
         return $slug_exists;
3083 3083
     }
3084 3084
     
3085
-    if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3085
+    if (!empty($gd_term_taxonomy) && isset($gd_term_taxonomy[$term_id])) {
3086 3086
         $taxonomy = $gd_term_taxonomy[$term_id];
3087 3087
     } else {
3088
-        $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3088
+        $taxonomy = $wpdb->get_var($wpdb->prepare("SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id));
3089 3089
         $gd_term_taxonomy[$term_id] = $taxonomy;
3090 3090
     }
3091 3091
     
3092
-    if ( empty($taxonomy) ) {
3092
+    if (empty($taxonomy)) {
3093 3093
         return $slug_exists;
3094 3094
     }
3095 3095
     
3096
-    if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3096
+    if (!empty($gd_term_post_type) && $gd_term_post_type[$term_id]) {
3097 3097
         $post_type = $gd_term_post_type[$term_id];
3098 3098
     } else {
3099
-        $taxonomy_obj = get_taxonomy( $taxonomy );
3100
-        $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3099
+        $taxonomy_obj = get_taxonomy($taxonomy);
3100
+        $post_type = !empty($taxonomy_obj->object_type) ? $taxonomy_obj->object_type[0] : NULL;
3101 3101
     }
3102 3102
     
3103 3103
     $wpml_post_join = "";
3104 3104
     $wpml_post_where = "";
3105 3105
     
3106 3106
     if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3107
-        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3107
+        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_'.$taxonomy) : $sitepress->get_current_language();
3108 3108
         if (!$term_language) {
3109 3109
             $term_language = $sitepress->get_current_language();
3110 3110
         }
3111 3111
         
3112 3112
         $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3113
-        $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3113
+        $wpml_post_where = " AND icl_t.language_code = '".$term_language."'";
3114 3114
     }
3115 3115
     
3116
-    if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
3116
+    if ($post_type && $wpdb->get_var($wpdb->prepare("SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type))) {
3117 3117
         $slug_exists = true;
3118 3118
     }
3119 3119
 
3120 3120
     return $slug_exists;
3121 3121
 }
3122
-add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 );
3122
+add_filter('geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3);
3123 3123
 
3124 3124
 /**
3125 3125
  * Add hidden WPML language input field.
@@ -3133,7 +3133,7 @@  discard block
 block discarded – undo
3133 3133
 function geodir_wpml_add_language_input_field() {
3134 3134
 	global $sitepress;
3135 3135
 
3136
-	if ( function_exists( 'wpml_add_language_form_field_action' ) && WPML_LANGUAGE_NEGOTIATION_TYPE_PARAMETER === (int) $sitepress->get_setting( 'language_negotiation_type' ) ) {
3136
+	if (function_exists('wpml_add_language_form_field_action') && WPML_LANGUAGE_NEGOTIATION_TYPE_PARAMETER === (int) $sitepress->get_setting('language_negotiation_type')) {
3137 3137
 		wpml_add_language_form_field_action();
3138 3138
 	}
3139 3139
 }
@@ -3153,21 +3153,21 @@  discard block
 block discarded – undo
3153 3153
  *                              by the parent function. WP_Error otherwise.
3154 3154
  * @param array   $object_ids   List of term object IDs.
3155 3155
  */
3156
-function geodir_on_delete_term( $term, $tt_id, $taxonomy = '', $deleted_term = array(), $object_ids = array() ) {
3156
+function geodir_on_delete_term($term, $tt_id, $taxonomy = '', $deleted_term = array(), $object_ids = array()) {
3157 3157
 	global $wpdb, $plugin_prefix;
3158 3158
 
3159
-	if ( ! empty( $object_ids ) && strpos( $taxonomy, 'gd_' ) === 0 && substr( $taxonomy , -5 ) == '_tags' && ( $taxonomy_obj = get_taxonomy( $taxonomy ) ) ) {
3160
-		$post_type = !empty( $taxonomy_obj ) ? $taxonomy_obj->object_type[0] : '';
3159
+	if (!empty($object_ids) && strpos($taxonomy, 'gd_') === 0 && substr($taxonomy, -5) == '_tags' && ($taxonomy_obj = get_taxonomy($taxonomy))) {
3160
+		$post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : '';
3161 3161
 
3162
-		if ( $post_type ) {
3163
-			$table = $plugin_prefix . $post_type . '_detail';
3162
+		if ($post_type) {
3163
+			$table = $plugin_prefix.$post_type.'_detail';
3164 3164
 		
3165
-			foreach ( $object_ids as $post_id ) {
3166
-				$post_tags = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'names' ) );
3167
-				$post_tags = ! empty( $post_tags ) && ! is_wp_error( $post_tags ) ? array_map( 'trim', $post_tags ) : '';
3168
-				$post_tags = ! empty( $post_tags ) ? implode( ',', array_filter( array_unique( $post_tags ) ) ) : '';
3165
+			foreach ($object_ids as $post_id) {
3166
+				$post_tags = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'names'));
3167
+				$post_tags = !empty($post_tags) && !is_wp_error($post_tags) ? array_map('trim', $post_tags) : '';
3168
+				$post_tags = !empty($post_tags) ? implode(',', array_filter(array_unique($post_tags))) : '';
3169 3169
 
3170
-				$wpdb->query( $wpdb->prepare( "UPDATE {$table} SET post_tags = %s WHERE post_id = %d", array( $post_tags, $post_id ) ) );
3170
+				$wpdb->query($wpdb->prepare("UPDATE {$table} SET post_tags = %s WHERE post_id = %d", array($post_tags, $post_id)));
3171 3171
 			}
3172 3172
 		}
3173 3173
 	}
Please login to merge, or discard this patch.