Test Failed
Pull Request — master (#305)
by Kiran
15:15
created
geodirectory_hooks_actions.php 1 patch
Spacing   +150 added lines, -150 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 /* ON TEMPLATE INCLUDE */
137 137
 /////////////////////////
138 138
 
139
-add_filter('template_include', 'geodir_template_loader',9);
139
+add_filter('template_include', 'geodir_template_loader', 9);
140 140
 
141 141
 /////////////////////////
142 142
 /* CATEGORY / TAXONOMY / CUSTOM POST ACTIONS */
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 /* WP REVIEW COUNT ACTIONS */
177 177
 ////////////////////////
178 178
 
179
-add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100,1);
179
+add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100, 1);
180 180
 //add_action('geodir_update_postrating', 'geodir_term_review_count_force_update', 100);
181
-add_action('transition_post_status', 'geodir_term_review_count_force_update', 100,3);
181
+add_action('transition_post_status', 'geodir_term_review_count_force_update', 100, 3);
182 182
 //add_action('created_term', 'geodir_term_review_count_force_update', 100);
183 183
 add_action('edited_term', 'geodir_term_review_count_force_update', 100);
184 184
 add_action('delete_term', 'geodir_term_review_count_force_update', 100);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function geodir_unset_prev_theme_nav_location($newname)
224 224
 {
225
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
225
+    $geodir_theme_location = get_option('geodir_theme_location_nav_'.$newname);
226 226
     if ($geodir_theme_location) {
227 227
         update_option('geodir_theme_location_nav', $geodir_theme_location);
228 228
     } else {
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 
321 321
 /////// GEO DIRECOTORY CUSTOM HOOKS ///
322 322
 
323
-add_action('geodir_before_tab_content', 'geodir_before_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content 
324
-add_action('geodir_after_tab_content', 'geodir_after_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content
323
+add_action('geodir_before_tab_content', 'geodir_before_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content 
324
+add_action('geodir_after_tab_content', 'geodir_after_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content
325 325
 
326 326
 // Detail page sidebar content 
327 327
 add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1);
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
     do_action('geodir_after_social_sharing_buttons');
422 422
     $content_html = ob_get_clean();
423 423
     if (trim($content_html) != '')
424
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
424
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>';
425
+    if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) {
426 426
         /**
427 427
          * Filter the geodir_social_sharing_buttons() function content.
428 428
          *
@@ -462,12 +462,12 @@  discard block
 block discarded – undo
462 462
             $post_id = $post->ID;
463 463
             
464 464
             if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
465
-                $post_id = (int)$_REQUEST['pid'];
465
+                $post_id = (int) $_REQUEST['pid'];
466 466
             }
467 467
 
468 468
             $postlink = get_permalink(geodir_add_listing_page_id());
469 469
             $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
470
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
470
+            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>';
471 471
         }
472 472
     }// end of if, if its a preview or not
473 473
     /**
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
     do_action('geodir_after_edit_post_link');
479 479
     $content_html = ob_get_clean();
480 480
     if (trim($content_html) != '')
481
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
482
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
481
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>';
482
+    if ((int) get_option('geodir_disable_user_links_section') != 1) {
483 483
         /**
484 484
          * Filter the geodir_edit_post_link() function content.
485 485
          *
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
  */
501 501
 function geodir_detail_page_google_analytics()
502 502
 {
503
-    global $post,$preview;
504
-    if($preview){return '';}
503
+    global $post, $preview;
504
+    if ($preview) {return ''; }
505 505
     $package_info = array();
506 506
     $package_info = geodir_post_package_info($package_info, $post);
507 507
 
@@ -533,14 +533,14 @@  discard block
 block discarded – undo
533 533
     $hide_refresh = get_option('geodir_ga_auto_refresh');
534 534
     
535 535
     $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
536
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
536
+    if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id() == $post->post_author || current_user_can('manage_options'))) {
537 537
         $page_url = urlencode($_SERVER['REQUEST_URI']);
538 538
         ?>
539 539
         <script type="text/javascript">
540 540
             var gd_gaTimeOut;
541
-            var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
542
-            var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>;
543
-            var gd_gaAutoRefresh = <?php echo $auto_refresh;?>;
541
+            var gd_gaTime = parseInt('<?php echo $refresh_time; ?>');
542
+            var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>;
543
+            var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>;
544 544
             ga_data1 = false;
545 545
             ga_data2 = false;
546 546
             ga_data3 = false;
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
             }
682 682
 
683 683
             function gdga_noResults() {
684
-                jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>');
684
+                jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>');
685 685
                 jQuery('#gdga-legend-container').html('');
686 686
             }
687 687
 
@@ -713,18 +713,18 @@  discard block
 block discarded – undo
713 713
                     var data2 = results[1].rows.map(function(row) { return +row[2]; });
714 714
                     //var labelsN = results[0].rows.map(function(row) { return +row[1]; });
715 715
 
716
-                    var labels = ['<?php _e('Jan', 'geodirectory');?>',
717
-                        '<?php _e('Feb', 'geodirectory');?>',
718
-                        '<?php _e('Mar', 'geodirectory');?>',
719
-                        '<?php _e('Apr', 'geodirectory');?>',
720
-                        '<?php _e('May', 'geodirectory');?>',
721
-                        '<?php _e('Jun', 'geodirectory');?>',
722
-                        '<?php _e('Jul', 'geodirectory');?>',
723
-                        '<?php _e('Aug', 'geodirectory');?>',
724
-                        '<?php _e('Sep', 'geodirectory');?>',
725
-                        '<?php _e('Oct', 'geodirectory');?>',
726
-                        '<?php _e('Nov', 'geodirectory');?>',
727
-                        '<?php _e('Dec', 'geodirectory');?>'];
716
+                    var labels = ['<?php _e('Jan', 'geodirectory'); ?>',
717
+                        '<?php _e('Feb', 'geodirectory'); ?>',
718
+                        '<?php _e('Mar', 'geodirectory'); ?>',
719
+                        '<?php _e('Apr', 'geodirectory'); ?>',
720
+                        '<?php _e('May', 'geodirectory'); ?>',
721
+                        '<?php _e('Jun', 'geodirectory'); ?>',
722
+                        '<?php _e('Jul', 'geodirectory'); ?>',
723
+                        '<?php _e('Aug', 'geodirectory'); ?>',
724
+                        '<?php _e('Sep', 'geodirectory'); ?>',
725
+                        '<?php _e('Oct', 'geodirectory'); ?>',
726
+                        '<?php _e('Nov', 'geodirectory'); ?>',
727
+                        '<?php _e('Dec', 'geodirectory'); ?>'];
728 728
 
729 729
                     // Ensure the data arrays are at least as long as the labels array.
730 730
                     // Chart.js bar charts don't (yet) accept sparse datasets.
@@ -737,13 +737,13 @@  discard block
 block discarded – undo
737 737
                         labels : labels,
738 738
                         datasets : [
739 739
                             {
740
-                                label: '<?php _e('Last Year', 'geodirectory');?>',
740
+                                label: '<?php _e('Last Year', 'geodirectory'); ?>',
741 741
                                 fillColor : "rgba(220,220,220,0.5)",
742 742
                                 strokeColor : "rgba(220,220,220,1)",
743 743
                                 data : data2
744 744
                             },
745 745
                             {
746
-                                label: '<?php _e('This Year', 'geodirectory');?>',
746
+                                label: '<?php _e('This Year', 'geodirectory'); ?>',
747 747
                                 fillColor : "rgba(151,187,205,0.5)",
748 748
                                 strokeColor : "rgba(151,187,205,1)",
749 749
                                 data : data1
@@ -788,30 +788,30 @@  discard block
 block discarded – undo
788 788
 
789 789
                     <?php
790 790
                     // Here we list the shorthand days of the week so it can be used in translation.
791
-                    __("Mon",'geodirectory');
792
-                    __("Tue",'geodirectory');
793
-                    __("Wed",'geodirectory');
794
-                    __("Thu",'geodirectory');
795
-                    __("Fri",'geodirectory');
796
-                    __("Sat",'geodirectory');
797
-                    __("Sun",'geodirectory');
791
+                    __("Mon", 'geodirectory');
792
+                    __("Tue", 'geodirectory');
793
+                    __("Wed", 'geodirectory');
794
+                    __("Thu", 'geodirectory');
795
+                    __("Fri", 'geodirectory');
796
+                    __("Sat", 'geodirectory');
797
+                    __("Sun", 'geodirectory');
798 798
                     ?>
799 799
 
800 800
                     labels = [
801
-                        "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
802
-                        "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>",
803
-                        "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>",
804
-                        "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>",
805
-                        "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>",
806
-                        "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>",
807
-                        "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>"
801
+                        "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>",
802
+                        "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>",
803
+                        "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>",
804
+                        "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>",
805
+                        "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>",
806
+                        "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>",
807
+                        "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>"
808 808
                     ];
809 809
 
810 810
                     var data = {
811 811
                         labels : labels,
812 812
                         datasets : [
813 813
                             {
814
-                                label: '<?php _e('Last Week', 'geodirectory');?>',
814
+                                label: '<?php _e('Last Week', 'geodirectory'); ?>',
815 815
                                 fillColor : "rgba(220,220,220,0.5)",
816 816
                                 strokeColor : "rgba(220,220,220,1)",
817 817
                                 pointColor : "rgba(220,220,220,1)",
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
                                 data : data2
820 820
                             },
821 821
                             {
822
-                                label: '<?php _e('This Week', 'geodirectory');?>',
822
+                                label: '<?php _e('This Week', 'geodirectory'); ?>',
823 823
                                 fillColor : "rgba(151,187,205,0.5)",
824 824
                                 strokeColor : "rgba(151,187,205,1)",
825 825
                                 pointColor : "rgba(151,187,205,1)",
@@ -1026,18 +1026,18 @@  discard block
 block discarded – undo
1026 1026
         </style>
1027 1027
         <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
1028 1028
         <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
1029
-        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button>
1029
+        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button>
1030 1030
         <span id="ga_stats" class="gdga-analytics-box" style="display:none">
1031
-            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div>
1031
+            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div>
1032 1032
             <div id="gd-active-users-container">
1033
-                <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');?>
1033
+                <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'); ?>
1034 1034
                     <b class="gd-ActiveUsers-value">0</b>
1035 1035
                 </div>
1036 1036
             </div>
1037 1037
             <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;">
1038
-                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option>
1039
-                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option>
1040
-                <option value="country"><?php _e("Top Countries", 'geodirectory');?></option>
1038
+                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option>
1039
+                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option>
1040
+                <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option>
1041 1041
             </select>
1042 1042
             <div class="Chartjs-figure" id="gdga-chart-container"></div>
1043 1043
             <ol class="Chartjs-legend" id="gdga-legend-container"></ol>
@@ -1053,8 +1053,8 @@  discard block
 block discarded – undo
1053 1053
     do_action('geodir_after_google_analytics');
1054 1054
     $content_html = ob_get_clean();
1055 1055
     if (trim($content_html) != '')
1056
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1057
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1056
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>';
1057
+    if ((int) get_option('geodir_disable_google_analytics_section') != 1) {
1058 1058
         /**
1059 1059
          * Filter the geodir_edit_post_link() function content.
1060 1060
          *
@@ -1110,10 +1110,10 @@  discard block
 block discarded – undo
1110 1110
        
1111 1111
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1112 1112
 	   
1113
-	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1113
+	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="'.$post_avgratings.'">'.$post_avgratings.'</span> / <span itemprop="best" content="5">5</span> '.__("based on", 'geodirectory').' </span><span class="count" itemprop="count" content="'.$comment_count.'">'.$comment_count.' '.$reviews_text.'</span><br />';
1114 1114
 
1115 1115
         $html .= '<span class="item">';
1116
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1116
+        $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>';
1117 1117
 
1118 1118
         if ($post_images) {
1119 1119
             foreach ($post_images as $img) {
@@ -1123,7 +1123,7 @@  discard block
 block discarded – undo
1123 1123
         }
1124 1124
 
1125 1125
         if (isset($post_img) && $post_img) {
1126
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1126
+            $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />';
1127 1127
         }
1128 1128
 
1129 1129
         $html .= '</span>';
@@ -1150,9 +1150,9 @@  discard block
 block discarded – undo
1150 1150
     do_action('geodir_after_detail_page_review_rating');
1151 1151
     $content_html = ob_get_clean();
1152 1152
     if (trim($content_html) != '') {
1153
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1153
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>';
1154 1154
     }
1155
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1155
+    if ((int) get_option('geodir_disable_rating_info_section') != 1) {
1156 1156
         /**
1157 1157
          * Filter the geodir_detail_page_review_rating() function content.
1158 1158
          *
@@ -1191,8 +1191,8 @@  discard block
 block discarded – undo
1191 1191
 
1192 1192
     $content_html = ob_get_clean();
1193 1193
     if (trim($content_html) != '')
1194
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1195
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1194
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>';
1195
+    if ((int) get_option('geodir_disable_listing_info_section') != 1) {
1196 1196
         /**
1197 1197
          * Filter the output html for function geodir_detail_page_more_info().
1198 1198
          *
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
1292 1292
 		'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
1293 1293
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1294
-		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1294
+		'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1295 1295
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1296 1296
         'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1297 1297
         'geodir_map_name' => geodir_map_name(),
@@ -1315,10 +1315,10 @@  discard block
 block discarded – undo
1315 1315
     foreach ($arr_alert_msg as $key => $value) {
1316 1316
         if (!is_scalar($value))
1317 1317
             continue;
1318
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1318
+        $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
1319 1319
     }
1320 1320
 
1321
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1321
+    $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';';
1322 1322
     echo '<script>';
1323 1323
     echo $script;
1324 1324
     echo '</script>';
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
         $geodir_old_sidebars = get_option('geodir_sidebars');
1409 1409
         if (is_array($geodir_old_sidebars)) {
1410 1410
             foreach ($geodir_old_sidebars as $key => $val) {
1411
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1411
+                if (0 === strpos($key, 'geodir_'))// if gd widget
1412 1412
                 {
1413 1413
                     $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1414 1414
                 }
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
         global $post;
1488 1488
         $term_condition = '';
1489 1489
         if (isset($_REQUEST['backandedit'])) {
1490
-            $post = (object)$gd_session->get('listing');
1490
+            $post = (object) $gd_session->get('listing');
1491 1491
             $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1492 1492
         }
1493 1493
 
@@ -1501,7 +1501,7 @@  discard block
 block discarded – undo
1501 1501
                     echo 'checked="checked"';
1502 1502
                 } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1503 1503
                        class="geodir_textfield" value="1"
1504
-                       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>
1504
+                       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>
1505 1505
 				</span>
1506 1506
             </div>
1507 1507
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
         /** This action is documented in geodirectory_template_actions.php */
1542 1542
         $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1543 1543
         
1544
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1544
+        if (!($desc_limit === '' || (int) $desc_limit > 0)) {
1545 1545
             $is_display = false;
1546 1546
         }
1547 1547
     }
@@ -1589,16 +1589,16 @@  discard block
 block discarded – undo
1589 1589
     global $wpdb, $plugin_prefix;
1590 1590
 	
1591 1591
 	// Remove unused virtual page
1592
-	$listings_page_id = (int)get_option('geodir_listing_page');
1592
+	$listings_page_id = (int) get_option('geodir_listing_page');
1593 1593
 	if ($listings_page_id) {
1594
-		$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')));
1594
+		$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')));
1595 1595
         delete_option('geodir_listing_page');
1596 1596
 	}
1597 1597
 
1598 1598
     if (!get_option('geodir_changes_in_custom_fields_table')) {
1599 1599
         $wpdb->query(
1600 1600
             $wpdb->prepare(
1601
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1601
+                "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s",
1602 1602
                 array('1', '1', 'admin')
1603 1603
             )
1604 1604
         );
@@ -1606,9 +1606,9 @@  discard block
 block discarded – undo
1606 1606
 
1607 1607
         /* --- terms meta value set --- */
1608 1608
 
1609
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1609
+        update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png');
1610 1610
 
1611
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1611
+        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%')));
1612 1612
 
1613 1613
         if (!empty($options_data)) {
1614 1614
 
@@ -1616,7 +1616,7 @@  discard block
 block discarded – undo
1616 1616
 
1617 1617
                 $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1618 1618
 
1619
-                $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)));
1619
+                $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)));
1620 1620
 
1621 1621
                 if (!empty($taxonomies_data)) {
1622 1622
 
@@ -1625,17 +1625,17 @@  discard block
 block discarded – undo
1625 1625
                         $taxObject = get_taxonomy($taxobj->taxonomy);
1626 1626
                         $post_type = $taxObject->object_type[0];
1627 1627
 
1628
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1628
+                        $opt_value = 'tax_meta_'.$post_type.'_'.$option_val;
1629 1629
 
1630
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1630
+                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val)));
1631 1631
 
1632 1632
                         if ($duplicate_data) {
1633 1633
 
1634
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1634
+                            $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1635 1635
 
1636 1636
                         } else {
1637 1637
 
1638
-                            $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)));
1638
+                            $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)));
1639 1639
 
1640 1640
                         }
1641 1641
 
@@ -1669,14 +1669,14 @@  discard block
 block discarded – undo
1669 1669
 
1670 1670
     global $wpdb, $table_prefix;
1671 1671
 
1672
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1672
+    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug)));
1673 1673
 
1674 1674
     if ($slug_exists) {
1675 1675
 
1676 1676
         $suffix = 1;
1677 1677
         do {
1678
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1679
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1678
+            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1679
+            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name)));
1680 1680
             $suffix++;
1681 1681
         } while ($location_slug_check && $suffix < 100);
1682 1682
 
@@ -1730,7 +1730,7 @@  discard block
 block discarded – undo
1730 1730
 
1731 1731
         $suffix = 1;
1732 1732
         do {
1733
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1733
+            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1734 1734
 
1735 1735
             /** This action is documented in geodirectory_hooks_actions.php */
1736 1736
             $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
@@ -1742,7 +1742,7 @@  discard block
 block discarded – undo
1742 1742
 
1743 1743
         //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1744 1744
 
1745
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1745
+        $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1746 1746
 
1747 1747
     }
1748 1748
 	
@@ -1751,18 +1751,18 @@  discard block
 block discarded – undo
1751 1751
 	$post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL;
1752 1752
 	
1753 1753
 	$post_types = geodir_get_posttypes();
1754
-	if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) {		
1755
-		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id)));
1754
+	if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) {		
1755
+		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id)));
1756 1756
 		
1757 1757
 		if (!empty($posts_obj)) {
1758 1758
 			foreach ($posts_obj as $post_obj) {
1759 1759
 				$post_id = $post_obj->object_id;
1760 1760
 				
1761
-				$raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names'));
1761
+				$raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names'));
1762 1762
 				$post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : '';
1763 1763
 				
1764
-				$listing_table = $plugin_prefix . $post_type . '_detail';
1765
-				$wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1764
+				$listing_table = $plugin_prefix.$post_type.'_detail';
1765
+				$wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1766 1766
 			}
1767 1767
 		}
1768 1768
 	}
@@ -1796,7 +1796,7 @@  discard block
 block discarded – undo
1796 1796
     if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1797 1797
         return $slug_exists = true;
1798 1798
 
1799
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1799
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1800 1800
         return $slug_exists = true;
1801 1801
 
1802 1802
     return $slug_exists;
@@ -1836,43 +1836,43 @@  discard block
 block discarded – undo
1836 1836
 
1837 1837
 
1838 1838
     $gd_page = '';
1839
-    if(geodir_is_page('home')){
1839
+    if (geodir_is_page('home')) {
1840 1840
         $gd_page = 'home';
1841 1841
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1842 1842
     }
1843
-    elseif(geodir_is_page('detail')){
1843
+    elseif (geodir_is_page('detail')) {
1844 1844
         $gd_page = 'detail';
1845 1845
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1846 1846
     }
1847
-    elseif(geodir_is_page('pt')){
1847
+    elseif (geodir_is_page('pt')) {
1848 1848
         $gd_page = 'pt';
1849 1849
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1850 1850
     }
1851
-    elseif(geodir_is_page('listing')){
1851
+    elseif (geodir_is_page('listing')) {
1852 1852
         $gd_page = 'listing';
1853 1853
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1854 1854
     }
1855
-    elseif(geodir_is_page('location')){
1855
+    elseif (geodir_is_page('location')) {
1856 1856
         $gd_page = 'location';
1857 1857
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1858 1858
     }
1859
-    elseif(geodir_is_page('search')){
1859
+    elseif (geodir_is_page('search')) {
1860 1860
         $gd_page = 'search';
1861 1861
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1862 1862
     }
1863
-    elseif(geodir_is_page('add-listing')){
1863
+    elseif (geodir_is_page('add-listing')) {
1864 1864
         $gd_page = 'add-listing';
1865 1865
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1866 1866
     }
1867
-    elseif(geodir_is_page('author')){
1867
+    elseif (geodir_is_page('author')) {
1868 1868
         $gd_page = 'author';
1869 1869
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1870 1870
     }
1871
-    elseif(geodir_is_page('login')){
1871
+    elseif (geodir_is_page('login')) {
1872 1872
         $gd_page = 'login';
1873 1873
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1874 1874
     }
1875
-    elseif(geodir_is_page('listing-success')){
1875
+    elseif (geodir_is_page('listing-success')) {
1876 1876
         $gd_page = 'listing-success';
1877 1877
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1878 1878
     }
@@ -1904,12 +1904,12 @@  discard block
 block discarded – undo
1904 1904
 
1905 1905
     if (!get_option('geodir_set_post_attachments')) {
1906 1906
 
1907
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1908
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1907
+        require_once(ABSPATH.'wp-admin/includes/image.php');
1908
+        require_once(ABSPATH.'wp-admin/includes/file.php');
1909 1909
 
1910 1910
         $all_postypes = geodir_get_posttypes();
1911 1911
 
1912
-        foreach($all_postypes as $post_type){
1912
+        foreach ($all_postypes as $post_type) {
1913 1913
             $args = array(
1914 1914
                 'posts_per_page' => -1,
1915 1915
                 'post_type' => $post_type,
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
 {
2004 2004
     $user_id = get_current_user_id();
2005 2005
 
2006
-    if(!$user_id){return $post;}
2006
+    if (!$user_id) {return $post; }
2007 2007
 
2008 2008
     $gd_post_types = geodir_get_posttypes();
2009 2009
 
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
 
2113 2113
         if (array_key_exists('post_video', $tabs_arr)) {
2114 2114
 
2115
-            $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)));
2115
+            $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)));
2116 2116
 
2117 2117
             if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2118 2118
                 $tabs_arr['post_video']['heading_text'] = $field_title;
@@ -2120,7 +2120,7 @@  discard block
 block discarded – undo
2120 2120
 
2121 2121
         if (array_key_exists('special_offers', $tabs_arr)) {
2122 2122
 
2123
-            $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)));
2123
+            $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)));
2124 2124
 
2125 2125
             if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2126 2126
                 $tabs_arr['special_offers']['heading_text'] = $field_title;
@@ -2141,7 +2141,7 @@  discard block
 block discarded – undo
2141 2141
  */
2142 2142
 function geodir_remove_template_redirect_actions()
2143 2143
 {
2144
-    if (geodir_is_page('login')){
2144
+    if (geodir_is_page('login')) {
2145 2145
         remove_all_actions('template_redirect');
2146 2146
         remove_action('init', 'avia_modify_front', 10);
2147 2147
     }
@@ -2188,25 +2188,25 @@  discard block
 block discarded – undo
2188 2188
         $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2189 2189
 
2190 2190
         $wpdb->query(
2191
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2191
+            $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ",
2192 2192
                 array($post_id, $split_img_file_path)
2193 2193
             )
2194 2194
         );
2195 2195
 
2196 2196
         $attachment_data = $wpdb->get_row(
2197
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2197
+            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d",
2198 2198
                 array($post_id)
2199 2199
             )
2200 2200
         );
2201 2201
 
2202 2202
         if (!empty($attachment_data)) {
2203
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2203
+            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2204 2204
         }
2205 2205
 
2206 2206
 
2207
-        $table_name = $plugin_prefix . $post_type . '_detail';
2207
+        $table_name = $plugin_prefix.$post_type.'_detail';
2208 2208
 
2209
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2209
+        $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id);
2210 2210
 
2211 2211
         geodir_set_wp_featured_image($post_id);
2212 2212
 
@@ -2234,9 +2234,9 @@  discard block
 block discarded – undo
2234 2234
 
2235 2235
     foreach ($all_postypes as $posttype) {
2236 2236
 
2237
-        $tablename = $plugin_prefix . $posttype . '_detail';
2237
+        $tablename = $plugin_prefix.$posttype.'_detail';
2238 2238
 
2239
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2239
+        $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename);
2240 2240
 
2241 2241
         if (!empty($get_post_data)) {
2242 2242
 
@@ -2244,7 +2244,7 @@  discard block
 block discarded – undo
2244 2244
 
2245 2245
                 $post_id = $data->post_id;
2246 2246
 
2247
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2247
+                $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''");
2248 2248
 
2249 2249
                 if (!empty($attachment_data)) {
2250 2250
 
@@ -2261,22 +2261,22 @@  discard block
 block discarded – undo
2261 2261
 
2262 2262
                         $file_name = $file_info['basename'];
2263 2263
 
2264
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2264
+                        $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name;
2265 2265
 
2266 2266
                         if (!file_exists($img_arr['path'])) {
2267 2267
 
2268
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2268
+                            $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID);
2269 2269
 
2270 2270
                         }
2271 2271
 
2272 2272
                     }
2273 2273
 
2274
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2274
+                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id");
2275 2275
 
2276 2276
                     if (!empty($attachment_data)) {
2277 2277
 
2278 2278
                         if ($attachment_data->ID)
2279
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2279
+                            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2280 2280
 
2281 2281
                     } else {
2282 2282
 
@@ -2290,7 +2290,7 @@  discard block
 block discarded – undo
2290 2290
 
2291 2291
                     }
2292 2292
 
2293
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2293
+                    $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id);
2294 2294
 
2295 2295
                     geodir_set_wp_featured_image($post_id);
2296 2296
 
@@ -2319,7 +2319,7 @@  discard block
 block discarded – undo
2319 2319
 {
2320 2320
 
2321 2321
     if (!get_option('geodir_default_rating_star_icon')) {
2322
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2322
+        update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png');
2323 2323
     }
2324 2324
 
2325 2325
 }
@@ -2336,10 +2336,10 @@  discard block
 block discarded – undo
2336 2336
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2337 2337
  * @return array User listing count for each post type.
2338 2338
  */
2339
-function geodir_user_post_listing_count($user_id=null)
2339
+function geodir_user_post_listing_count($user_id = null)
2340 2340
 {
2341 2341
     global $wpdb, $plugin_prefix, $current_user;
2342
-    if(!$user_id){
2342
+    if (!$user_id) {
2343 2343
         $user_id = $current_user->ID;
2344 2344
     }
2345 2345
 
@@ -2350,7 +2350,7 @@  discard block
 block discarded – undo
2350 2350
     $user_listing = array();
2351 2351
     if (is_array($all_posts) && !empty($all_posts)) {
2352 2352
         foreach ($all_posts as $ptype) {
2353
-            $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' )");
2353
+            $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' )");
2354 2354
 
2355 2355
             if ($total_posts > 0) {
2356 2356
                 $user_listing[$ptype] = $total_posts;
@@ -2392,19 +2392,19 @@  discard block
 block discarded – undo
2392 2392
         $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2393 2393
 
2394 2394
         //remove video and special offers if it is already set to show
2395
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2395
+        if (isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']) {
2396 2396
             $unset_video = true;
2397 2397
         }
2398 2398
 
2399
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2399
+        if (isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']) {
2400 2400
             $unset_special_offers = true;
2401 2401
         }
2402
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2403
-            foreach($custom_fields as $key => $custom_field){
2404
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2402
+        if (isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)) {
2403
+            foreach ($custom_fields as $key => $custom_field) {
2404
+                if ($custom_field['name'] == 'geodir_video' && isset($unset_video)) {
2405 2405
                     unset($custom_fields[$key]);
2406 2406
                 }
2407
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2407
+                if ($custom_field['name'] == 'geodir_special_offers' && isset($unset_special_offers)) {
2408 2408
                     unset($custom_fields[$key]);
2409 2409
                 }
2410 2410
             }
@@ -2423,7 +2423,7 @@  discard block
 block discarded – undo
2423 2423
                     $post->{$field_name} = $_REQUEST[$field_name];
2424 2424
                 }
2425 2425
 
2426
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2426
+                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2427 2427
                     if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2428 2428
                         continue;
2429 2429
                     }
@@ -2472,21 +2472,21 @@  discard block
 block discarded – undo
2472 2472
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2473 2473
                         $variables_array['value'] = '';
2474 2474
                         $variables_array['value'] = $post->{$type['htmlvar_name']};
2475
-                    }else{
2475
+                    } else {
2476 2476
                         $i = 0;
2477 2477
                         $fieldset_count++;
2478 2478
                         $field_set_start = 1;
2479
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2479
+                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count;
2480 2480
                         $fieldset_arr[$fieldset_count]['label'] = $label;
2481 2481
                     }
2482 2482
 
2483 2483
 
2484
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2484
+                    if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; }
2485 2485
                     $type = stripslashes_deep($type); // strip slashes
2486
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2486
+                    if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; }
2487 2487
                     $html = '';
2488 2488
                     $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2489
-                    if($html_var=='post'){$html_var='post_address';}
2489
+                    if ($html_var == 'post') {$html_var = 'post_address'; }
2490 2490
                     $field_icon = geodir_field_icon_proccess($type);
2491 2491
                     $filed_type = $type['type'];
2492 2492
 
@@ -2499,7 +2499,7 @@  discard block
 block discarded – undo
2499 2499
                      * @param string $fields_location The location the field is to be show.
2500 2500
                      * @param array $type The array of field values.
2501 2501
                      */
2502
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2502
+                    $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
2503 2503
 
2504 2504
 
2505 2505
                     /**
@@ -2545,7 +2545,7 @@  discard block
 block discarded – undo
2545 2545
                                  * @param string $htmlvar_name The field HTML var name.
2546 2546
                                  */
2547 2547
                                 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2548
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2548
+                                'tab_content' => '<div class="geodir-company_info field-group xxx">'.$fieldset_html.'</div>'
2549 2549
                             );
2550 2550
                         }
2551 2551
                     } else {
@@ -2607,7 +2607,7 @@  discard block
 block discarded – undo
2607 2607
             }
2608 2608
             $status .= ")</strong>";
2609 2609
 
2610
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2610
+            $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>';
2611 2611
         }
2612 2612
     }
2613 2613
 
@@ -2691,7 +2691,7 @@  discard block
 block discarded – undo
2691 2691
 function geodir_no_rating_comment_text($content, $comment = '')
2692 2692
 {
2693 2693
     if (!is_admin()) {
2694
-        return '<div class="description">' . $content . '</div>';
2694
+        return '<div class="description">'.$content.'</div>';
2695 2695
     } else {
2696 2696
         return $content;
2697 2697
     }
@@ -2769,7 +2769,7 @@  discard block
 block discarded – undo
2769 2769
         $classes[] = 'gd-no-rating';
2770 2770
     }
2771 2771
     
2772
-    $classes[] = 'gd-map-' . geodir_map_name();
2772
+    $classes[] = 'gd-map-'.geodir_map_name();
2773 2773
 
2774 2774
     return $classes;
2775 2775
 }
@@ -2789,7 +2789,7 @@  discard block
 block discarded – undo
2789 2789
         $class .= ' gd-no-rating';
2790 2790
     }
2791 2791
     
2792
-    $class .= ' gd-map-' . geodir_map_name();
2792
+    $class .= ' gd-map-'.geodir_map_name();
2793 2793
 
2794 2794
     return $class;
2795 2795
 }
@@ -2824,7 +2824,7 @@  discard block
 block discarded – undo
2824 2824
  * @return array Translation texts.
2825 2825
  */
2826 2826
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2827
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2827
+    $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array();
2828 2828
 
2829 2829
     $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');
2830 2830
 
@@ -2890,17 +2890,17 @@  discard block
 block discarded – undo
2890 2890
  * @param array $args The array of menu arguments.
2891 2891
  * @return array The modified arguments.
2892 2892
  */
2893
-function geodir_add_nav_menu_class( $args )
2893
+function geodir_add_nav_menu_class($args)
2894 2894
 {
2895 2895
 
2896
-        if(isset($args['menu_class'])){
2896
+        if (isset($args['menu_class'])) {
2897 2897
             $args['menu_class'] = $args['menu_class']." gd-menu-z";
2898 2898
         }
2899 2899
     
2900 2900
     return $args;
2901 2901
 }
2902 2902
 
2903
-add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
2903
+add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class');
2904 2904
 
2905 2905
 /**
2906 2906
  * Filters WordPress locale ID.
@@ -2971,7 +2971,7 @@  discard block
 block discarded – undo
2971 2971
         }        
2972 2972
         
2973 2973
         if (!empty($keep_vars)) {
2974
-            foreach ( $languages as $code => $url) {
2974
+            foreach ($languages as $code => $url) {
2975 2975
                 $filter_url = $url['url'];
2976 2976
                 
2977 2977
                 foreach ($keep_vars as $var) {
@@ -2991,4 +2991,4 @@  discard block
 block discarded – undo
2991 2991
 
2992 2992
     return $languages;
2993 2993
 }
2994
-add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2995 2994
\ No newline at end of file
2995
+add_filter('icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1);
2996 2996
\ No newline at end of file
Please login to merge, or discard this patch.