Test Failed
Push — master ( 256a70...7eb7ae )
by Stiofan
26:02 queued 05:16
created
geodirectory_hooks_actions.php 1 patch
Spacing   +195 added lines, -195 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);
@@ -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,8 +258,8 @@  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 265
 
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
 
327 327
 /////// GEO DIRECOTORY CUSTOM HOOKS ///
328 328
 
329
-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 
330
-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
329
+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 
330
+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
331 331
 
332 332
 // Detail page sidebar content 
333 333
 add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1);
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
     do_action('geodir_after_social_sharing_buttons');
428 428
     $content_html = ob_get_clean();
429 429
     if (trim($content_html) != '')
430
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
431
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
430
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>';
431
+    if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) {
432 432
         /**
433 433
          * Filter the geodir_social_sharing_buttons() function content.
434 434
          *
@@ -468,12 +468,12 @@  discard block
 block discarded – undo
468 468
             $post_id = $post->ID;
469 469
             
470 470
             if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
471
-                $post_id = (int)$_REQUEST['pid'];
471
+                $post_id = (int) $_REQUEST['pid'];
472 472
             }
473 473
 
474 474
             $postlink = get_permalink(geodir_add_listing_page_id());
475 475
             $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
476
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
476
+            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>';
477 477
         }
478 478
     }// end of if, if its a preview or not
479 479
     /**
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
     do_action('geodir_after_edit_post_link');
485 485
     $content_html = ob_get_clean();
486 486
     if (trim($content_html) != '')
487
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
488
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
487
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>';
488
+    if ((int) get_option('geodir_disable_user_links_section') != 1) {
489 489
         /**
490 490
          * Filter the geodir_edit_post_link() function content.
491 491
          *
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
  */
507 507
 function geodir_detail_page_google_analytics()
508 508
 {
509
-    global $post,$preview;
510
-    if($preview){return '';}
509
+    global $post, $preview;
510
+    if ($preview) {return ''; }
511 511
     $package_info = array();
512 512
     $package_info = geodir_post_package_info($package_info, $post);
513 513
 
@@ -539,14 +539,14 @@  discard block
 block discarded – undo
539 539
     $hide_refresh = get_option('geodir_ga_auto_refresh');
540 540
     
541 541
     $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
542
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
542
+    if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id() == $post->post_author || current_user_can('manage_options'))) {
543 543
         $page_url = urlencode($_SERVER['REQUEST_URI']);
544 544
         ?>
545 545
         <script type="text/javascript">
546 546
             var gd_gaTimeOut;
547
-            var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
548
-            var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>;
549
-            var gd_gaAutoRefresh = <?php echo $auto_refresh;?>;
547
+            var gd_gaTime = parseInt('<?php echo $refresh_time; ?>');
548
+            var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>;
549
+            var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>;
550 550
             ga_data1 = false;
551 551
             ga_data2 = false;
552 552
             ga_data3 = false;
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
             }
688 688
 
689 689
             function gdga_noResults() {
690
-                jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>');
690
+                jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>');
691 691
                 jQuery('#gdga-legend-container').html('');
692 692
             }
693 693
 
@@ -719,18 +719,18 @@  discard block
 block discarded – undo
719 719
                     var data2 = results[1].rows.map(function(row) { return +row[2]; });
720 720
                     //var labelsN = results[0].rows.map(function(row) { return +row[1]; });
721 721
 
722
-                    var labels = ['<?php _e('Jan', 'geodirectory');?>',
723
-                        '<?php _e('Feb', 'geodirectory');?>',
724
-                        '<?php _e('Mar', 'geodirectory');?>',
725
-                        '<?php _e('Apr', 'geodirectory');?>',
726
-                        '<?php _e('May', 'geodirectory');?>',
727
-                        '<?php _e('Jun', 'geodirectory');?>',
728
-                        '<?php _e('Jul', 'geodirectory');?>',
729
-                        '<?php _e('Aug', 'geodirectory');?>',
730
-                        '<?php _e('Sep', 'geodirectory');?>',
731
-                        '<?php _e('Oct', 'geodirectory');?>',
732
-                        '<?php _e('Nov', 'geodirectory');?>',
733
-                        '<?php _e('Dec', 'geodirectory');?>'];
722
+                    var labels = ['<?php _e('Jan', 'geodirectory'); ?>',
723
+                        '<?php _e('Feb', 'geodirectory'); ?>',
724
+                        '<?php _e('Mar', 'geodirectory'); ?>',
725
+                        '<?php _e('Apr', 'geodirectory'); ?>',
726
+                        '<?php _e('May', 'geodirectory'); ?>',
727
+                        '<?php _e('Jun', 'geodirectory'); ?>',
728
+                        '<?php _e('Jul', 'geodirectory'); ?>',
729
+                        '<?php _e('Aug', 'geodirectory'); ?>',
730
+                        '<?php _e('Sep', 'geodirectory'); ?>',
731
+                        '<?php _e('Oct', 'geodirectory'); ?>',
732
+                        '<?php _e('Nov', 'geodirectory'); ?>',
733
+                        '<?php _e('Dec', 'geodirectory'); ?>'];
734 734
 
735 735
                     // Ensure the data arrays are at least as long as the labels array.
736 736
                     // Chart.js bar charts don't (yet) accept sparse datasets.
@@ -743,13 +743,13 @@  discard block
 block discarded – undo
743 743
                         labels : labels,
744 744
                         datasets : [
745 745
                             {
746
-                                label: '<?php _e('Last Year', 'geodirectory');?>',
746
+                                label: '<?php _e('Last Year', 'geodirectory'); ?>',
747 747
                                 fillColor : "rgba(220,220,220,0.5)",
748 748
                                 strokeColor : "rgba(220,220,220,1)",
749 749
                                 data : data2
750 750
                             },
751 751
                             {
752
-                                label: '<?php _e('This Year', 'geodirectory');?>',
752
+                                label: '<?php _e('This Year', 'geodirectory'); ?>',
753 753
                                 fillColor : "rgba(151,187,205,0.5)",
754 754
                                 strokeColor : "rgba(151,187,205,1)",
755 755
                                 data : data1
@@ -794,30 +794,30 @@  discard block
 block discarded – undo
794 794
 
795 795
                     <?php
796 796
                     // Here we list the shorthand days of the week so it can be used in translation.
797
-                    __("Mon",'geodirectory');
798
-                    __("Tue",'geodirectory');
799
-                    __("Wed",'geodirectory');
800
-                    __("Thu",'geodirectory');
801
-                    __("Fri",'geodirectory');
802
-                    __("Sat",'geodirectory');
803
-                    __("Sun",'geodirectory');
797
+                    __("Mon", 'geodirectory');
798
+                    __("Tue", 'geodirectory');
799
+                    __("Wed", 'geodirectory');
800
+                    __("Thu", 'geodirectory');
801
+                    __("Fri", 'geodirectory');
802
+                    __("Sat", 'geodirectory');
803
+                    __("Sun", 'geodirectory');
804 804
                     ?>
805 805
 
806 806
                     labels = [
807
-                        "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
808
-                        "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>",
809
-                        "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>",
810
-                        "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>",
811
-                        "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>",
812
-                        "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>",
813
-                        "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>"
807
+                        "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>",
808
+                        "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>",
809
+                        "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>",
810
+                        "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>",
811
+                        "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>",
812
+                        "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>",
813
+                        "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>"
814 814
                     ];
815 815
 
816 816
                     var data = {
817 817
                         labels : labels,
818 818
                         datasets : [
819 819
                             {
820
-                                label: '<?php _e('Last Week', 'geodirectory');?>',
820
+                                label: '<?php _e('Last Week', 'geodirectory'); ?>',
821 821
                                 fillColor : "rgba(220,220,220,0.5)",
822 822
                                 strokeColor : "rgba(220,220,220,1)",
823 823
                                 pointColor : "rgba(220,220,220,1)",
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
                                 data : data2
826 826
                             },
827 827
                             {
828
-                                label: '<?php _e('This Week', 'geodirectory');?>',
828
+                                label: '<?php _e('This Week', 'geodirectory'); ?>',
829 829
                                 fillColor : "rgba(151,187,205,0.5)",
830 830
                                 strokeColor : "rgba(151,187,205,1)",
831 831
                                 pointColor : "rgba(151,187,205,1)",
@@ -1032,18 +1032,18 @@  discard block
 block discarded – undo
1032 1032
         </style>
1033 1033
         <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
1034 1034
         <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
1035
-        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button>
1035
+        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button>
1036 1036
         <span id="ga_stats" class="gdga-analytics-box" style="display:none">
1037
-            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div>
1037
+            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div>
1038 1038
             <div id="gd-active-users-container">
1039
-                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory');?>"></i><?php _e("Active Users:", 'geodirectory');?>
1039
+                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory'); ?>"></i><?php _e("Active Users:", 'geodirectory'); ?>
1040 1040
                     <b class="gd-ActiveUsers-value">0</b>
1041 1041
                 </div>
1042 1042
             </div>
1043 1043
             <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;">
1044
-                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option>
1045
-                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option>
1046
-                <option value="country"><?php _e("Top Countries", 'geodirectory');?></option>
1044
+                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option>
1045
+                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option>
1046
+                <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option>
1047 1047
             </select>
1048 1048
             <div class="Chartjs-figure" id="gdga-chart-container"></div>
1049 1049
             <ol class="Chartjs-legend" id="gdga-legend-container"></ol>
@@ -1059,8 +1059,8 @@  discard block
 block discarded – undo
1059 1059
     do_action('geodir_after_google_analytics');
1060 1060
     $content_html = ob_get_clean();
1061 1061
     if (trim($content_html) != '')
1062
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1063
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1062
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>';
1063
+    if ((int) get_option('geodir_disable_google_analytics_section') != 1) {
1064 1064
         /**
1065 1065
          * Filter the geodir_edit_post_link() function content.
1066 1066
          *
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 {
1087 1087
     global $post, $preview, $post_images;
1088 1088
     
1089
-    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1089
+    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int) $post->ID)) {
1090 1090
         return;
1091 1091
     }
1092 1092
     ob_start(); // Start  buffering;
@@ -1121,10 +1121,10 @@  discard block
 block discarded – undo
1121 1121
        
1122 1122
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1123 1123
 	   
1124
-	   $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 />';
1124
+	   $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 />';
1125 1125
 
1126 1126
         $html .= '<span class="item">';
1127
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1127
+        $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>';
1128 1128
 
1129 1129
         if ($post_images) {
1130 1130
             foreach ($post_images as $img) {
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
         }
1135 1135
 
1136 1136
         if (isset($post_img) && $post_img) {
1137
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1137
+            $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />';
1138 1138
         }
1139 1139
 
1140 1140
         $html .= '</span>';
@@ -1161,9 +1161,9 @@  discard block
 block discarded – undo
1161 1161
     do_action('geodir_after_detail_page_review_rating');
1162 1162
     $content_html = ob_get_clean();
1163 1163
     if (trim($content_html) != '') {
1164
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1164
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>';
1165 1165
     }
1166
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1166
+    if ((int) get_option('geodir_disable_rating_info_section') != 1) {
1167 1167
         /**
1168 1168
          * Filter the geodir_detail_page_review_rating() function content.
1169 1169
          *
@@ -1202,8 +1202,8 @@  discard block
 block discarded – undo
1202 1202
 
1203 1203
     $content_html = ob_get_clean();
1204 1204
     if (trim($content_html) != '')
1205
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1206
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1205
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>';
1206
+    if ((int) get_option('geodir_disable_listing_info_section') != 1) {
1207 1207
         /**
1208 1208
          * Filter the output html for function geodir_detail_page_more_info().
1209 1209
          *
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
1303 1303
 		'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
1304 1304
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1305
-		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1305
+		'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1306 1306
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1307 1307
         'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1308 1308
         'geodir_map_name' => geodir_map_name(),
@@ -1331,10 +1331,10 @@  discard block
 block discarded – undo
1331 1331
     foreach ($arr_alert_msg as $key => $value) {
1332 1332
         if (!is_scalar($value))
1333 1333
             continue;
1334
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1334
+        $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
1335 1335
     }
1336 1336
 
1337
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1337
+    $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';';
1338 1338
     echo '<script>';
1339 1339
     echo $script;
1340 1340
     echo '</script>';
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
         $geodir_old_sidebars = get_option('geodir_sidebars');
1425 1425
         if (is_array($geodir_old_sidebars)) {
1426 1426
             foreach ($geodir_old_sidebars as $key => $val) {
1427
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1427
+                if (0 === strpos($key, 'geodir_'))// if gd widget
1428 1428
                 {
1429 1429
                     $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1430 1430
                 }
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
         global $post;
1504 1504
         $term_condition = '';
1505 1505
         if (isset($_REQUEST['backandedit'])) {
1506
-            $post = (object)$gd_session->get('listing');
1506
+            $post = (object) $gd_session->get('listing');
1507 1507
             $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1508 1508
         }
1509 1509
 
@@ -1517,7 +1517,7 @@  discard block
 block discarded – undo
1517 1517
                     echo 'checked="checked"';
1518 1518
                 } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1519 1519
                        class="geodir_textfield" value="1"
1520
-                       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>
1520
+                       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>
1521 1521
 				</span>
1522 1522
             </div>
1523 1523
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
         /** This action is documented in geodirectory_template_actions.php */
1558 1558
         $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1559 1559
         
1560
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1560
+        if (!($desc_limit === '' || (int) $desc_limit > 0)) {
1561 1561
             $is_display = false;
1562 1562
         }
1563 1563
     }
@@ -1605,16 +1605,16 @@  discard block
 block discarded – undo
1605 1605
     global $wpdb, $plugin_prefix;
1606 1606
 	
1607 1607
 	// Remove unused virtual page
1608
-	$listings_page_id = (int)get_option('geodir_listing_page');
1608
+	$listings_page_id = (int) get_option('geodir_listing_page');
1609 1609
 	if ($listings_page_id) {
1610
-		$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')));
1610
+		$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')));
1611 1611
         delete_option('geodir_listing_page');
1612 1612
 	}
1613 1613
 
1614 1614
     if (!get_option('geodir_changes_in_custom_fields_table')) {
1615 1615
         $wpdb->query(
1616 1616
             $wpdb->prepare(
1617
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1617
+                "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s",
1618 1618
                 array('1', '1', 'admin')
1619 1619
             )
1620 1620
         );
@@ -1622,9 +1622,9 @@  discard block
 block discarded – undo
1622 1622
 
1623 1623
         /* --- terms meta value set --- */
1624 1624
 
1625
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1625
+        update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png');
1626 1626
 
1627
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1627
+        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%')));
1628 1628
 
1629 1629
         if (!empty($options_data)) {
1630 1630
 
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
 
1633 1633
                 $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1634 1634
 
1635
-                $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)));
1635
+                $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)));
1636 1636
 
1637 1637
                 if (!empty($taxonomies_data)) {
1638 1638
 
@@ -1641,17 +1641,17 @@  discard block
 block discarded – undo
1641 1641
                         $taxObject = get_taxonomy($taxobj->taxonomy);
1642 1642
                         $post_type = $taxObject->object_type[0];
1643 1643
 
1644
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1644
+                        $opt_value = 'tax_meta_'.$post_type.'_'.$option_val;
1645 1645
 
1646
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1646
+                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val)));
1647 1647
 
1648 1648
                         if ($duplicate_data) {
1649 1649
 
1650
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1650
+                            $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1651 1651
 
1652 1652
                         } else {
1653 1653
 
1654
-                            $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)));
1654
+                            $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)));
1655 1655
 
1656 1656
                         }
1657 1657
 
@@ -1685,14 +1685,14 @@  discard block
 block discarded – undo
1685 1685
 
1686 1686
     global $wpdb, $table_prefix;
1687 1687
 
1688
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1688
+    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug)));
1689 1689
 
1690 1690
     if ($slug_exists) {
1691 1691
 
1692 1692
         $suffix = 1;
1693 1693
         do {
1694
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1695
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1694
+            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1695
+            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name)));
1696 1696
             $suffix++;
1697 1697
         } while ($location_slug_check && $suffix < 100);
1698 1698
 
@@ -1746,7 +1746,7 @@  discard block
 block discarded – undo
1746 1746
 
1747 1747
         $suffix = 1;
1748 1748
         do {
1749
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1749
+            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1750 1750
 
1751 1751
             /** This action is documented in geodirectory_hooks_actions.php */
1752 1752
             $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
 
1759 1759
         //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1760 1760
 
1761
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1761
+        $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1762 1762
 
1763 1763
     }
1764 1764
 	
@@ -1767,18 +1767,18 @@  discard block
 block discarded – undo
1767 1767
 	$post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL;
1768 1768
 	
1769 1769
 	$post_types = geodir_get_posttypes();
1770
-	if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) {		
1771
-		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id)));
1770
+	if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) {		
1771
+		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id)));
1772 1772
 		
1773 1773
 		if (!empty($posts_obj)) {
1774 1774
 			foreach ($posts_obj as $post_obj) {
1775 1775
 				$post_id = $post_obj->object_id;
1776 1776
 				
1777
-				$raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names'));
1777
+				$raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names'));
1778 1778
 				$post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : '';
1779 1779
 				
1780
-				$listing_table = $plugin_prefix . $post_type . '_detail';
1781
-				$wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1780
+				$listing_table = $plugin_prefix.$post_type.'_detail';
1781
+				$wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1782 1782
 			}
1783 1783
 		}
1784 1784
 	}
@@ -1812,7 +1812,7 @@  discard block
 block discarded – undo
1812 1812
     if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1813 1813
         return $slug_exists = true;
1814 1814
 
1815
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1815
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1816 1816
         return $slug_exists = true;
1817 1817
 
1818 1818
     return $slug_exists;
@@ -1853,43 +1853,43 @@  discard block
 block discarded – undo
1853 1853
 
1854 1854
 
1855 1855
     $gd_page = '';
1856
-    if(geodir_is_page('home')){
1856
+    if (geodir_is_page('home')) {
1857 1857
         $gd_page = 'home';
1858 1858
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1859 1859
     }
1860
-    elseif(geodir_is_page('detail')){
1860
+    elseif (geodir_is_page('detail')) {
1861 1861
         $gd_page = 'detail';
1862 1862
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1863 1863
     }
1864
-    elseif(geodir_is_page('pt')){
1864
+    elseif (geodir_is_page('pt')) {
1865 1865
         $gd_page = 'pt';
1866 1866
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1867 1867
     }
1868
-    elseif(geodir_is_page('listing')){
1868
+    elseif (geodir_is_page('listing')) {
1869 1869
         $gd_page = 'listing';
1870 1870
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1871 1871
     }
1872
-    elseif(geodir_is_page('location')){
1872
+    elseif (geodir_is_page('location')) {
1873 1873
         $gd_page = 'location';
1874 1874
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1875 1875
     }
1876
-    elseif(geodir_is_page('search')){
1876
+    elseif (geodir_is_page('search')) {
1877 1877
         $gd_page = 'search';
1878 1878
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1879 1879
     }
1880
-    elseif(geodir_is_page('add-listing')){
1880
+    elseif (geodir_is_page('add-listing')) {
1881 1881
         $gd_page = 'add-listing';
1882 1882
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1883 1883
     }
1884
-    elseif(geodir_is_page('author')){
1884
+    elseif (geodir_is_page('author')) {
1885 1885
         $gd_page = 'author';
1886 1886
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1887 1887
     }
1888
-    elseif(geodir_is_page('login')){
1888
+    elseif (geodir_is_page('login')) {
1889 1889
         $gd_page = 'login';
1890 1890
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1891 1891
     }
1892
-    elseif(geodir_is_page('listing-success')){
1892
+    elseif (geodir_is_page('listing-success')) {
1893 1893
         $gd_page = 'listing-success';
1894 1894
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1895 1895
     }
@@ -1921,12 +1921,12 @@  discard block
 block discarded – undo
1921 1921
 
1922 1922
     if (!get_option('geodir_set_post_attachments')) {
1923 1923
 
1924
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1925
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1924
+        require_once(ABSPATH.'wp-admin/includes/image.php');
1925
+        require_once(ABSPATH.'wp-admin/includes/file.php');
1926 1926
 
1927 1927
         $all_postypes = geodir_get_posttypes();
1928 1928
 
1929
-        foreach($all_postypes as $post_type){
1929
+        foreach ($all_postypes as $post_type) {
1930 1930
             $args = array(
1931 1931
                 'posts_per_page' => -1,
1932 1932
                 'post_type' => $post_type,
@@ -2020,7 +2020,7 @@  discard block
 block discarded – undo
2020 2020
 {
2021 2021
     $user_id = get_current_user_id();
2022 2022
 
2023
-    if(!$user_id){return $post;}
2023
+    if (!$user_id) {return $post; }
2024 2024
 
2025 2025
     $gd_post_types = geodir_get_posttypes();
2026 2026
 
@@ -2129,7 +2129,7 @@  discard block
 block discarded – undo
2129 2129
 
2130 2130
         if (array_key_exists('post_video', $tabs_arr)) {
2131 2131
 
2132
-            $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)));
2132
+            $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)));
2133 2133
 
2134 2134
             if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2135 2135
                 $tabs_arr['post_video']['heading_text'] = $field_title;
@@ -2137,7 +2137,7 @@  discard block
 block discarded – undo
2137 2137
 
2138 2138
         if (array_key_exists('special_offers', $tabs_arr)) {
2139 2139
 
2140
-            $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)));
2140
+            $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)));
2141 2141
 
2142 2142
             if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2143 2143
                 $tabs_arr['special_offers']['heading_text'] = $field_title;
@@ -2158,7 +2158,7 @@  discard block
 block discarded – undo
2158 2158
  */
2159 2159
 function geodir_remove_template_redirect_actions()
2160 2160
 {
2161
-    if (geodir_is_page('login')){
2161
+    if (geodir_is_page('login')) {
2162 2162
         remove_all_actions('template_redirect');
2163 2163
         remove_action('init', 'avia_modify_front', 10);
2164 2164
     }
@@ -2205,25 +2205,25 @@  discard block
 block discarded – undo
2205 2205
         $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2206 2206
 
2207 2207
         $wpdb->query(
2208
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2208
+            $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ",
2209 2209
                 array($post_id, $split_img_file_path)
2210 2210
             )
2211 2211
         );
2212 2212
 
2213 2213
         $attachment_data = $wpdb->get_row(
2214
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2214
+            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d",
2215 2215
                 array($post_id)
2216 2216
             )
2217 2217
         );
2218 2218
 
2219 2219
         if (!empty($attachment_data)) {
2220
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2220
+            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2221 2221
         }
2222 2222
 
2223 2223
 
2224
-        $table_name = $plugin_prefix . $post_type . '_detail';
2224
+        $table_name = $plugin_prefix.$post_type.'_detail';
2225 2225
 
2226
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2226
+        $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id);
2227 2227
 
2228 2228
         geodir_set_wp_featured_image($post_id);
2229 2229
 
@@ -2251,9 +2251,9 @@  discard block
 block discarded – undo
2251 2251
 
2252 2252
     foreach ($all_postypes as $posttype) {
2253 2253
 
2254
-        $tablename = $plugin_prefix . $posttype . '_detail';
2254
+        $tablename = $plugin_prefix.$posttype.'_detail';
2255 2255
 
2256
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2256
+        $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename);
2257 2257
 
2258 2258
         if (!empty($get_post_data)) {
2259 2259
 
@@ -2261,7 +2261,7 @@  discard block
 block discarded – undo
2261 2261
 
2262 2262
                 $post_id = $data->post_id;
2263 2263
 
2264
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2264
+                $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''");
2265 2265
 
2266 2266
                 if (!empty($attachment_data)) {
2267 2267
 
@@ -2278,22 +2278,22 @@  discard block
 block discarded – undo
2278 2278
 
2279 2279
                         $file_name = $file_info['basename'];
2280 2280
 
2281
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2281
+                        $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name;
2282 2282
 
2283 2283
                         if (!file_exists($img_arr['path'])) {
2284 2284
 
2285
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2285
+                            $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID);
2286 2286
 
2287 2287
                         }
2288 2288
 
2289 2289
                     }
2290 2290
 
2291
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2291
+                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id");
2292 2292
 
2293 2293
                     if (!empty($attachment_data)) {
2294 2294
 
2295 2295
                         if ($attachment_data->ID)
2296
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2296
+                            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2297 2297
 
2298 2298
                     } else {
2299 2299
 
@@ -2307,7 +2307,7 @@  discard block
 block discarded – undo
2307 2307
 
2308 2308
                     }
2309 2309
 
2310
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2310
+                    $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id);
2311 2311
 
2312 2312
                     geodir_set_wp_featured_image($post_id);
2313 2313
 
@@ -2336,7 +2336,7 @@  discard block
 block discarded – undo
2336 2336
 {
2337 2337
 
2338 2338
     if (!get_option('geodir_default_rating_star_icon')) {
2339
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2339
+        update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png');
2340 2340
     }
2341 2341
 
2342 2342
 }
@@ -2356,7 +2356,7 @@  discard block
 block discarded – undo
2356 2356
 function geodir_user_post_listing_count($user_id = 0)
2357 2357
 {
2358 2358
     global $wpdb, $plugin_prefix, $current_user;
2359
-    if(!$user_id){
2359
+    if (!$user_id) {
2360 2360
         $user_id = $current_user->ID;
2361 2361
     }
2362 2362
 
@@ -2365,7 +2365,7 @@  discard block
 block discarded – undo
2365 2365
     $user_listing = array();
2366 2366
     if ($user_id && is_array($all_posts) && !empty($all_posts)) {
2367 2367
         foreach ($all_posts as $ptype) {
2368
-            $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' )");
2368
+            $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' )");
2369 2369
 
2370 2370
             if ($total_posts > 0) {
2371 2371
                 $user_listing[$ptype] = $total_posts;
@@ -2406,19 +2406,19 @@  discard block
 block discarded – undo
2406 2406
 
2407 2407
         $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2408 2408
         //remove video and special offers if it is already set to show
2409
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2409
+        if (isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']) {
2410 2410
             $unset_video = true;
2411 2411
         }
2412 2412
 
2413
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2413
+        if (isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']) {
2414 2414
             $unset_special_offers = true;
2415 2415
         }
2416
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2417
-            foreach($custom_fields as $key => $custom_field){
2418
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2416
+        if (isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)) {
2417
+            foreach ($custom_fields as $key => $custom_field) {
2418
+                if ($custom_field['name'] == 'geodir_video' && isset($unset_video)) {
2419 2419
                     unset($custom_fields[$key]);
2420 2420
                 }
2421
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2421
+                if ($custom_field['name'] == 'geodir_special_offers' && isset($unset_special_offers)) {
2422 2422
                     unset($custom_fields[$key]);
2423 2423
                 }
2424 2424
             }
@@ -2435,7 +2435,7 @@  discard block
 block discarded – undo
2435 2435
                     $post->{$field_name} = $_REQUEST[$field_name];
2436 2436
                 }
2437 2437
 
2438
-                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'))) {
2438
+                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'))) {
2439 2439
                     if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2440 2440
                         continue;
2441 2441
                     }
@@ -2468,7 +2468,7 @@  discard block
 block discarded – undo
2468 2468
                     $post->{$field_name} = $_REQUEST[$field_name];
2469 2469
                 }
2470 2470
 
2471
-                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'))) {
2471
+                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'))) {
2472 2472
                     $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2473 2473
                     $site_title = trim($field['site_title']);
2474 2474
                     $type = $field;
@@ -2484,21 +2484,21 @@  discard block
 block discarded – undo
2484 2484
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2485 2485
                         $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2486 2486
 
2487
-                    }else{
2487
+                    } else {
2488 2488
                         $i = 0;
2489 2489
                         $fieldset_count++;
2490 2490
                         $field_set_start = 1;
2491
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2491
+                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count;
2492 2492
                         $fieldset_arr[$fieldset_count]['label'] = $label;
2493 2493
                     }
2494 2494
 
2495 2495
 
2496
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2496
+                    if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; }
2497 2497
                     $type = stripslashes_deep($type); // strip slashes
2498
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2498
+                    if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; }
2499 2499
                     $html = '';
2500 2500
                     $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2501
-                    if($html_var=='post'){$html_var='post_address';}
2501
+                    if ($html_var == 'post') {$html_var = 'post_address'; }
2502 2502
                     $field_icon = geodir_field_icon_proccess($type);
2503 2503
                     $filed_type = $type['type'];
2504 2504
 
@@ -2511,7 +2511,7 @@  discard block
 block discarded – undo
2511 2511
                      * @param string $fields_location The location the field is to be show.
2512 2512
                      * @param array $type The array of field values.
2513 2513
                      */
2514
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2514
+                    $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
2515 2515
 
2516 2516
 
2517 2517
                     /**
@@ -2557,7 +2557,7 @@  discard block
 block discarded – undo
2557 2557
                                  * @param string $htmlvar_name The field HTML var name.
2558 2558
                                  */
2559 2559
                                 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2560
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2560
+                                'tab_content' => '<div class="geodir-company_info field-group xxx">'.$fieldset_html.'</div>'
2561 2561
                             );
2562 2562
                         }
2563 2563
                     } else {
@@ -2619,7 +2619,7 @@  discard block
 block discarded – undo
2619 2619
             }
2620 2620
             $status .= ")</strong>";
2621 2621
 
2622
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2622
+            $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>';
2623 2623
         }
2624 2624
     }
2625 2625
 
@@ -2688,7 +2688,7 @@  discard block
 block discarded – undo
2688 2688
  * @return array Modified class array.
2689 2689
  */
2690 2690
 function geodir_body_class_active_map($classes = array()) {
2691
-    $classes[] = 'gd-map-' . geodir_map_name();
2691
+    $classes[] = 'gd-map-'.geodir_map_name();
2692 2692
 
2693 2693
     return $classes;
2694 2694
 }
@@ -2703,7 +2703,7 @@  discard block
 block discarded – undo
2703 2703
  * @return string Modified class string.
2704 2704
  */
2705 2705
 function geodir_admin_body_class_active_map($class = '') {    
2706
-    $class .= ' gd-map-' . geodir_map_name();
2706
+    $class .= ' gd-map-'.geodir_map_name();
2707 2707
 
2708 2708
     return $class;
2709 2709
 }
@@ -2723,7 +2723,7 @@  discard block
 block discarded – undo
2723 2723
  * @return array Translation texts.
2724 2724
  */
2725 2725
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2726
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2726
+    $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array();
2727 2727
 
2728 2728
     $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2729 2729
 
@@ -2789,17 +2789,17 @@  discard block
 block discarded – undo
2789 2789
  * @param array $args The array of menu arguments.
2790 2790
  * @return array The modified arguments.
2791 2791
  */
2792
-function geodir_add_nav_menu_class( $args )
2792
+function geodir_add_nav_menu_class($args)
2793 2793
 {
2794 2794
 
2795
-        if(isset($args['menu_class'])){
2795
+        if (isset($args['menu_class'])) {
2796 2796
             $args['menu_class'] = $args['menu_class']." gd-menu-z";
2797 2797
         }
2798 2798
     
2799 2799
     return $args;
2800 2800
 }
2801 2801
 
2802
-add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
2802
+add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class');
2803 2803
 
2804 2804
 /**
2805 2805
  * Filters WordPress locale ID.
@@ -2839,9 +2839,9 @@  discard block
 block discarded – undo
2839 2839
         }
2840 2840
         
2841 2841
         add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2842
-        add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2842
+        add_action('geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1);
2843 2843
         if (is_admin()) {
2844
-            add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2844
+            add_filter('geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1);
2845 2845
         }
2846 2846
     }
2847 2847
 }
@@ -2870,7 +2870,7 @@  discard block
 block discarded – undo
2870 2870
         }        
2871 2871
         
2872 2872
         if (!empty($keep_vars)) {
2873
-            foreach ( $languages as $code => $url) {
2873
+            foreach ($languages as $code => $url) {
2874 2874
                 $filter_url = $url['url'];
2875 2875
                 
2876 2876
                 foreach ($keep_vars as $var) {
@@ -2889,7 +2889,7 @@  discard block
 block discarded – undo
2889 2889
 
2890 2890
     return $languages;
2891 2891
 }
2892
-add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2892
+add_filter('icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1);
2893 2893
 
2894 2894
 /**
2895 2895
  * Remove Yoast SEO hook if disabled on GD pages.
@@ -2897,18 +2897,18 @@  discard block
 block discarded – undo
2897 2897
  * @since 1.6.18
2898 2898
  *
2899 2899
  */
2900
-function geodir_remove_yoast_seo_metas(){
2901
-    if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2900
+function geodir_remove_yoast_seo_metas() {
2901
+    if (class_exists('WPSEO_Frontend') && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas()) {
2902 2902
         $wpseo = WPSEO_Frontend::get_instance();
2903 2903
         
2904
-        remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2905
-        remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2906
-        remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2907
-        remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2908
-        remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2909
-        remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2904
+        remove_action('wp_head', array($wpseo, 'metadesc'), 6);
2905
+        remove_action('wp_head', array($wpseo, 'metakeywords'), 11);
2906
+        remove_filter('pre_get_document_title', array($wpseo, 'title'), 15);
2907
+        remove_filter('wp_title', array($wpseo, 'title'), 15, 3);
2908
+        remove_filter('thematic_doctitle', array($wpseo, 'title'), 15);
2909
+        remove_filter('woo_title', array($wpseo, 'fix_woo_title'), 99);
2910 2910
         
2911
-        remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2911
+        remove_action('template_redirect', 'wpseo_frontend_head_init', 999);
2912 2912
     }
2913 2913
 }
2914 2914
 
@@ -2923,22 +2923,22 @@  discard block
 block discarded – undo
2923 2923
  *
2924 2924
  */
2925 2925
  function geodir_wpml_ajax_set_guest_lang() {    
2926
-    if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2927
-        if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2926
+    if (geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in()) {
2927
+        if (empty($_GET['lang']) && !(!empty($_SERVER['REQUEST_URI']) && preg_match('@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename(preg_replace('@\?.*$@', '', $_SERVER['REQUEST_URI']))))) {
2928 2928
             global $sitepress;
2929 2929
             
2930 2930
             $referer = wp_get_referer();
2931 2931
             
2932 2932
             $current_lang = $sitepress->get_current_language();
2933
-            $referrer_lang = $sitepress->get_language_from_url( $referer );
2933
+            $referrer_lang = $sitepress->get_language_from_url($referer);
2934 2934
             
2935
-            if ( $referrer_lang && $current_lang != $referrer_lang ) {
2935
+            if ($referrer_lang && $current_lang != $referrer_lang) {
2936 2936
                 $_GET['lang'] = $referrer_lang;
2937 2937
             }
2938 2938
         }
2939 2939
     }
2940 2940
 }
2941
-add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 );
2941
+add_action('plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1);
2942 2942
 
2943 2943
 /**
2944 2944
  * Change country slug czech-republic to czechia and redirect.
@@ -2959,18 +2959,18 @@  discard block
 block discarded – undo
2959 2959
         }
2960 2960
         
2961 2961
         $redirect = false;
2962
-        if (strpos($current_url, '/' . $search . '/') !== false) {
2962
+        if (strpos($current_url, '/'.$search.'/') !== false) {
2963 2963
             $redirect = true;
2964
-            $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2964
+            $current_url = preg_replace('/\/'.$search.'\//', '/'.$replace.'/', $current_url, 1);
2965 2965
         }
2966 2966
         
2967 2967
         if ($has_slash != "/") {
2968 2968
             $current_url = trim($current_url, '/');
2969 2969
         }
2970 2970
         
2971
-        if (strpos($current_url, 'gd_country=' . $search) !== false) {
2971
+        if (strpos($current_url, 'gd_country='.$search) !== false) {
2972 2972
             $redirect = true;
2973
-            $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2973
+            $current_url = str_replace('gd_country='.$search, 'gd_country='.$replace, $current_url);
2974 2974
         }
2975 2975
 
2976 2976
         if ($redirect) {
@@ -2996,10 +2996,10 @@  discard block
 block discarded – undo
2996 2996
  * @param int    $post_parent   Post parent ID
2997 2997
  * @param string $original_slug The original post slug.
2998 2998
  */
2999
-function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
2999
+function geodir_check_post_to_term_slug($slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug) {
3000 3000
     global $wpdb, $sitepress;
3001 3001
     
3002
-    if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3002
+    if ($post_type && strpos($post_type, 'gd_') === 0) {
3003 3003
         $wpml_post_join = "";
3004 3004
         $wpml_post_where = "";
3005 3005
         $wpml_term_join = "";
@@ -3013,28 +3013,28 @@  discard block
 block discarded – undo
3013 3013
             }
3014 3014
             
3015 3015
             $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)";
3016
-            $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3016
+            $wpml_post_where = " AND icl_t.language_code = '".$post_language."'";
3017 3017
             
3018 3018
             $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)";
3019
-            $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3019
+            $wpml_term_where = " AND icl_t.language_code = '".$post_language."'";
3020 3020
         }
3021 3021
 
3022
-        $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 ) );
3022
+        $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));
3023 3023
 
3024
-        if ( $term_slug_check ) {
3024
+        if ($term_slug_check) {
3025 3025
             $suffix = 1;
3026 3026
             
3027 3027
             do {
3028
-                $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3028
+                $alt_slug = _truncate_post_slug($original_slug, 200 - (strlen($suffix) + 1))."-$suffix";
3029 3029
                 
3030
-                $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 ) );
3030
+                $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));
3031 3031
                 
3032
-                $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 ) );
3032
+                $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));
3033 3033
                 
3034 3034
                 $term_slug_check = $term_check || $post_check;
3035 3035
                 
3036 3036
                 $suffix++;
3037
-            } while ( $term_slug_check );
3037
+            } while ($term_slug_check);
3038 3038
             
3039 3039
             $slug = $alt_slug;
3040 3040
         }
@@ -3042,7 +3042,7 @@  discard block
 block discarded – undo
3042 3042
     
3043 3043
     return $slug;
3044 3044
 }
3045
-add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 );
3045
+add_filter('wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6);
3046 3046
 
3047 3047
 /**
3048 3048
  * Check whether a post name with slug exists or not.
@@ -3059,48 +3059,48 @@  discard block
 block discarded – undo
3059 3059
  * @param int $term_id The term ID.
3060 3060
  * @return bool true when exists. false when not exists.
3061 3061
  */
3062
-function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) {
3062
+function geodir_check_term_to_post_slug($slug_exists, $slug, $term_id) {
3063 3063
     global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3064 3064
     
3065
-    if ( $slug_exists ) {
3065
+    if ($slug_exists) {
3066 3066
         return $slug_exists;
3067 3067
     }
3068 3068
     
3069
-    if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3069
+    if (!empty($gd_term_taxonomy) && isset($gd_term_taxonomy[$term_id])) {
3070 3070
         $taxonomy = $gd_term_taxonomy[$term_id];
3071 3071
     } else {
3072
-        $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3072
+        $taxonomy = $wpdb->get_var($wpdb->prepare("SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id));
3073 3073
         $gd_term_taxonomy[$term_id] = $taxonomy;
3074 3074
     }
3075 3075
     
3076
-    if ( empty($taxonomy) ) {
3076
+    if (empty($taxonomy)) {
3077 3077
         return $slug_exists;
3078 3078
     }
3079 3079
     
3080
-    if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3080
+    if (!empty($gd_term_post_type) && $gd_term_post_type[$term_id]) {
3081 3081
         $post_type = $gd_term_post_type[$term_id];
3082 3082
     } else {
3083
-        $taxonomy_obj = get_taxonomy( $taxonomy );
3084
-        $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3083
+        $taxonomy_obj = get_taxonomy($taxonomy);
3084
+        $post_type = !empty($taxonomy_obj->object_type) ? $taxonomy_obj->object_type[0] : NULL;
3085 3085
     }
3086 3086
     
3087 3087
     $wpml_post_join = "";
3088 3088
     $wpml_post_where = "";
3089 3089
     
3090 3090
     if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3091
-        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3091
+        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_'.$taxonomy) : $sitepress->get_current_language();
3092 3092
         if (!$term_language) {
3093 3093
             $term_language = $sitepress->get_current_language();
3094 3094
         }
3095 3095
         
3096 3096
         $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)";
3097
-        $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3097
+        $wpml_post_where = " AND icl_t.language_code = '".$term_language."'";
3098 3098
     }
3099 3099
     
3100
-    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 ) ) ) {
3100
+    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))) {
3101 3101
         $slug_exists = true;
3102 3102
     }
3103 3103
 
3104 3104
     return $slug_exists;
3105 3105
 }
3106
-add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 );
3107 3106
\ No newline at end of file
3107
+add_filter('geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3);
3108 3108
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/location_functions.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 {
125 125
     global $wpdb;
126 126
 
127
-    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
127
+    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM ".GEODIR_COUNTRIES_TABLE." ORDER BY Country ASC");
128 128
     
129 129
     $ISO2 = array();
130 130
     $countries = array();
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
     
137 137
     asort($countries);
138 138
     
139
-    $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
139
+    $out_put = '<option '.selected('', $post_country, false).' value="">'.__('Select Country', 'geodirectory').'</option>';
140 140
     foreach ($countries as $country => $name) {
141 141
         $ccode = $ISO2[$country];
142 142
 
143
-        $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
143
+        $out_put .= '<option '.selected($post_country, $country, false).' value="'.esc_attr($country).'" data-country_code="'.$ccode.'">'.$name.'</option>';
144 144
     }
145 145
 
146 146
     echo $out_put;
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
         if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
183 183
 
184 184
             foreach ($posttype as $posttypeobj) {
185
-                $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
185
+                $post_locations = '['.$default_location->city_slug.'],['.$default_location->region_slug.'],['.$default_location->country_slug.']'; // set all overall post location
186 186
 
187 187
                 $sql = $wpdb->prepare(
188
-                    "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
188
+                    "UPDATE ".$plugin_prefix.$posttypeobj."_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189 189
                     array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190 190
                 );
191 191
                 $wpdb->query($sql);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
          *
234 234
          * @since 1.0.0
235 235
          */
236
-        $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
236
+        $geodir_location = (object) apply_filters('geodir_add_new_location', array('location_id' => 0,
237 237
             'country' => $location_country,
238 238
             'region' => $location_region,
239 239
             'city' => $location_city,
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
  */
295 295
 function geodir_get_address_by_lat_lan($lat, $lng)
296 296
 {
297
-    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) . "&key=" . geodir_get_map_api_key();
297
+    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng='.trim($lat).','.trim($lng)."&key=".geodir_get_map_api_key();
298 298
 
299 299
     $ch = curl_init();
300 300
     curl_setopt($ch, CURLOPT_URL, $url);
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	 * @param string $location_array_from Source type of location terms. Default session.
390 390
 	 * @param string $gd_post_type WP post type.
391 391
 	 */
392
-	$location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type );
392
+	$location_array = apply_filters('geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type);
393 393
 
394 394
     return $location_array;
395 395
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
  */
436 436
 function geodir_get_osm_address_by_lat_lan($lat, $lng) {
437 437
     $url = is_ssl() ? 'https:' : 'http:';
438
-    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
438
+    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat='.trim($lat).'&lon='.trim($lng).'&zoom=16&addressdetails=1&email='.get_option('admin_email');
439 439
 
440 440
     $ch = curl_init();
441 441
     curl_setopt($ch, CURLOPT_URL, $url);
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
     
450 450
     if (!empty($data) && !empty($data->address)) {
451 451
         $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
452
-        $formatted_address = (array)$data->address;
452
+        $formatted_address = (array) $data->address;
453 453
         
454
-        foreach ( $data->address as $key => $value ) {
454
+        foreach ($data->address as $key => $value) {
455 455
             if (!in_array($key, $address_fields)) {
456 456
                 unset($formatted_address[$key]);
457 457
             }
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
     }
482 482
     
483 483
     if (defined('POST_LOCATION_TABLE')) {
484
-        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
484
+        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM ".POST_LOCATION_TABLE." WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
485 485
         if (!empty($rows)) {
486 486
             foreach ($rows as $row) {
487 487
                 $translated = __($row->country, 'geodirectory');
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
             }
492 492
         }
493 493
         
494
-        $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
494
+        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM ".POST_LOCATION_TABLE." WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country));
495 495
         if (!empty($rows)) {
496 496
             foreach ($rows as $row) {
497 497
                 $translated = __($row->country, 'geodirectory');
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
         }
503 503
     }
504 504
     
505
-    if ( $default === '0' ) {
505
+    if ($default === '0') {
506 506
         return NULL;
507 507
     }
508 508
     
@@ -533,10 +533,10 @@  discard block
 block discarded – undo
533 533
 function geodir_get_country_iso2($country) {
534 534
     global $wpdb;
535 535
     
536
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
536
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", $country))) {
537 537
         return $result;
538 538
     }
539
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
539
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
540 540
         return $result;
541 541
     }
542 542
     
@@ -555,10 +555,10 @@  discard block
 block discarded – undo
555 555
 function geodir_get_country_by_name($country, $iso2 = false) {
556 556
     global $wpdb;
557 557
     
558
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
558
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", $country))) {
559 559
         return $result;
560 560
     }
561
-    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
561
+    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM ".GEODIR_COUNTRIES_TABLE." WHERE ISO2 LIKE %s", $country))) {
562 562
         return $result;
563 563
     }
564 564
     
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
603 603
 
604 604
 
605
-function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
605
+function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = '') {
606 606
 
607 607
     global $wp;
608 608
     
@@ -627,8 +627,8 @@  discard block
 block discarded – undo
627 627
                 $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
628 628
                 $location_name = get_actual_location_name($location_type, $location, true);
629 629
             } else {
630
-                $location_name = preg_replace( '/-(\d+)$/', '', $location_name);
631
-                $location_name = preg_replace( '/[_-]/', ' ', $location_name );
630
+                $location_name = preg_replace('/-(\d+)$/', '', $location_name);
631
+                $location_name = preg_replace('/[_-]/', ' ', $location_name);
632 632
                 $location_name = __(geodir_ucwords($location_name), 'geodirectory');
633 633
             }
634 634
         }
@@ -646,8 +646,8 @@  discard block
 block discarded – undo
646 646
                     $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
647 647
                     $location_single = get_actual_location_name($location_type, $location, true);
648 648
                 } else {
649
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
650
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
649
+                    $location_name = preg_replace('/-(\d+)$/', '', $location);
650
+                    $location_name = preg_replace('/[_-]/', ' ', $location_name);
651 651
                     $location_single = __(geodir_ucwords($location_name), 'geodirectory');
652 652
                 }
653 653
             }
@@ -667,8 +667,8 @@  discard block
 block discarded – undo
667 667
                     $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
668 668
                     $location_name = get_actual_location_name($location_type, $location, true);
669 669
                 } else {
670
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
671
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
670
+                    $location_name = preg_replace('/-(\d+)$/', '', $location);
671
+                    $location_name = preg_replace('/[_-]/', ' ', $location_name);
672 672
                     $location_name = __(geodir_ucwords($location_name), 'geodirectory');
673 673
                 }
674 674
             }
@@ -680,9 +680,9 @@  discard block
 block discarded – undo
680 680
             $full_location = array_unique($full_location);
681 681
         }
682 682
     }
683
-    $full_location = !empty($full_location) ? implode(', ', $full_location): '';
683
+    $full_location = !empty($full_location) ? implode(', ', $full_location) : '';
684 684
     
685
-    if ( empty( $full_location ) ) {
685
+    if (empty($full_location)) {
686 686
         /**
687 687
          * Filter the text in meta description in full location is empty.
688 688
          *
@@ -693,10 +693,10 @@  discard block
 block discarded – undo
693 693
          * @param string $gd_page       The page being filtered.
694 694
          * @param string $sep           The separator.
695 695
          */
696
-         $full_location = apply_filters( 'geodir_meta_description_location_empty_text', '', $location_array, $gd_page, $sep );
696
+         $full_location = apply_filters('geodir_meta_description_location_empty_text', '', $location_array, $gd_page, $sep);
697 697
     }
698 698
     
699
-    if ( empty( $location_single ) ) {
699
+    if (empty($location_single)) {
700 700
         /**
701 701
          * Filter the text in meta description in single location is empty.
702 702
          *
@@ -707,21 +707,21 @@  discard block
 block discarded – undo
707 707
          * @param string $gd_page       The page being filtered.
708 708
          * @param string $sep           The separator.
709 709
          */
710
-         $location_single = apply_filters( 'geodir_meta_description_single_location_empty_text', '', $location_array, $gd_page, $sep );
710
+         $location_single = apply_filters('geodir_meta_description_single_location_empty_text', '', $location_array, $gd_page, $sep);
711 711
     }
712 712
 
713 713
     $location_replace_vars = array();
714 714
     $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
715 715
     $location_replace_vars['%%location%%'] = $full_location;
716
-    $location_replace_vars['%%in_location%%'] = $full_location != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $full_location ) : '';
716
+    $location_replace_vars['%%in_location%%'] = $full_location != '' ? sprintf(_x('in %s', 'in location', 'geodirectory'), $full_location) : '';
717 717
     $location_replace_vars['%%location_single%%'] = $location_single;
718
-    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $location_single ) : '';
718
+    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? sprintf(_x('in %s', 'in location', 'geodirectory'), $location_single) : '';
719 719
 
720 720
     foreach ($location_names as $type => $name) {
721 721
         $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
722 722
 
723
-        $location_replace_vars['%%location_' . $location_type . '%%'] = $name;
724
-        $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? sprintf( _x('in %s','in location', 'geodirectory'), $name ) : '';
723
+        $location_replace_vars['%%location_'.$location_type.'%%'] = $name;
724
+        $location_replace_vars['%%in_location_'.$location_type.'%%'] = !empty($name) ? sprintf(_x('in %s', 'in location', 'geodirectory'), $name) : '';
725 725
     }
726 726
 
727 727
     /**
@@ -735,5 +735,5 @@  discard block
 block discarded – undo
735 735
      * @param string $gd_page       The page being filtered.
736 736
      * @param string $sep           The separator.
737 737
      */
738
-    return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
738
+    return apply_filters('geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep);
739 739
 }
740 740
\ No newline at end of file
Please login to merge, or discard this patch.