Test Failed
Push — master ( 5e22d4...26349a )
by Stiofan
01:19 queued 10s
created
geodirectory-admin/admin_hooks_actions.php 1 patch
Spacing   +258 added lines, -258 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
  */
63 63
 function geodir_get_admin_option_form($current_tab)
64 64
 {
65
-    geodir_admin_option_form($current_tab);// defined in admin template tags.php
65
+    geodir_admin_option_form($current_tab); // defined in admin template tags.php
66 66
 }
67 67
 
68 68
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 add_action('geodir_update_options_compatibility_settings', 'geodir_update_options_compatibility_settings');
71 71
 add_action('geodir_update_options_default_location_settings', 'geodir_location_form_submit');
72 72
 add_action('geodir_before_admin_panel', 'geodir_before_admin_panel'); // this function is in admin_functions.php
73
-add_action('geodir_before_update_options', 'geodir_before_update_options',10,2);
73
+add_action('geodir_before_update_options', 'geodir_before_update_options', 10, 2);
74 74
 
75 75
 //add_action('geodir_before_admin_panel', 'geodir_autoinstall_admin_header');
76 76
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         
100 100
         // Disable VC editor for GD post types.
101 101
         if (class_exists('Vc_Role_Access_Controller')) {
102
-            add_filter( 'vc_role_access_with_post_types_can', '__return_false', 100 );
102
+            add_filter('vc_role_access_with_post_types_can', '__return_false', 100);
103 103
         }
104 104
     }
105 105
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 add_action('admin_panel_init', 'geodir_admin_list_columns', 2);
127 127
 
128 128
 /* --- insert dummy post action ---*/
129
-add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1,3);
130
-add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1,3);
129
+add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1, 3);
130
+add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1, 3);
131 131
 
132 132
 
133 133
 /**
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
 
241 241
         // Filter-Payment-Manager
242 242
 
243
-        add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
243
+        add_meta_box('geodir_post_images', $post_typename.' '.__('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
244 244
 
245
-        add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
245
+        add_meta_box('geodir_post_info', $post_typename.' '.__('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
246 246
 
247 247
         // no need of this box as all fields moved to main information box
248 248
         //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 
252 252
 }
253 253
 
254
-add_action('save_post', 'geodir_post_information_save',10,2);
254
+add_action('save_post', 'geodir_post_information_save', 10, 2);
255 255
 
256 256
 
257 257
 
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
 
279 279
             $gd_taxonomy = geodir_get_taxonomies($geodir_post_type);
280 280
 
281
-            if(!empty($gd_taxonomy)) {
281
+            if (!empty($gd_taxonomy)) {
282 282
                 foreach ($gd_taxonomy as $tax) {
283 283
 
284
-                    remove_meta_box($tax . 'div', $geodir_post_type, 'normal');
284
+                    remove_meta_box($tax.'div', $geodir_post_type, 'normal');
285 285
 
286 286
                 }
287 287
             }
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
 add_action('geodir_manage_available_fields_predefined', 'geodir_manage_available_fields_predefined');
368 368
 add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom');
369 369
 
370
-function geodir_manage_available_fields_predefined($sub_tab){
371
-    if($sub_tab=='custom_fields'){
370
+function geodir_manage_available_fields_predefined($sub_tab) {
371
+    if ($sub_tab == 'custom_fields') {
372 372
         geodir_custom_available_fields('predefined');
373 373
     }
374 374
 }
375 375
 
376
-function geodir_manage_available_fields_custom($sub_tab){
377
-    if($sub_tab=='custom_fields'){
376
+function geodir_manage_available_fields_custom($sub_tab) {
377
+    if ($sub_tab == 'custom_fields') {
378 378
         geodir_custom_available_fields('custom');
379 379
     }
380 380
 }
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
     global $wpdb;
445 445
     $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
446 446
     ?>
447
-    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
447
+    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/>
448 448
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
449 449
     <ul>
450 450
     <?php
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 
456 456
             $check_html_variable = $wpdb->get_var(
457 457
                 $wpdb->prepare(
458
-                    "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s",
458
+                    "SELECT htmlvar_name FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s",
459 459
                     array($val['htmlvar_name'], $listing_type, $val['field_type'])
460 460
                 )
461 461
             );
@@ -463,23 +463,23 @@  discard block
 block discarded – undo
463 463
             $display = $check_html_variable ? ' style="display:none;"' : '';
464 464
            ?>
465 465
 
466
-            <li   class="gd-cf-tooltip-wrap" <?php echo $display;?>>
466
+            <li   class="gd-cf-tooltip-wrap" <?php echo $display; ?>>
467 467
                 <?php
468
-                if(isset($val['description']) && $val['description']){
468
+                if (isset($val['description']) && $val['description']) {
469 469
                     echo '<div class="gdcf-tooltip">'.$val['description'].'</div>';
470 470
                 }?>
471 471
 
472
-                <a id="gd-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>" data-field-type-key="<?php echo $val['htmlvar_name'];?>"  data-field-type="<?php echo $val['field_type'];?>"
473
-                   title="<?php echo $val['site_title'];?>"
474
-                   class="gd-draggable-form-items  gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);">
472
+                <a id="gd-<?php echo $val['field_type']; ?>-_-<?php echo $val['htmlvar_name']; ?>" data-field-type-key="<?php echo $val['htmlvar_name']; ?>"  data-field-type="<?php echo $val['field_type']; ?>"
473
+                   title="<?php echo $val['site_title']; ?>"
474
+                   class="gd-draggable-form-items  gd-<?php echo $val['field_type']; ?> geodir-sort-<?php echo $val['htmlvar_name']; ?>" href="javascript:void(0);">
475 475
                     <?php if (isset($val['field_icon']) && strpos($val['field_icon'], ' fa-') !== false) {
476 476
                         echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>';
477
-                    }elseif(isset($val['field_icon']) && $val['field_icon'] ){
477
+                    }elseif (isset($val['field_icon']) && $val['field_icon']) {
478 478
                         echo '<b class="gd-cf-icon" style="background-image: url(\''.$val['field_icon'].'\')"></b>';
479
-                    }else{
479
+                    } else {
480 480
                         echo '<i class="fas fa-cog" aria-hidden="true"></i>';
481 481
                     }?>
482
-                    <?php echo (! empty( $val['admin_title'] ) ? $val['admin_title'] : $val['site_title'] );?>
482
+                    <?php echo (!empty($val['admin_title']) ? $val['admin_title'] : $val['site_title']); ?>
483 483
                 </a>
484 484
             </li>
485 485
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
     <?php 
508 508
         global $wpdb;
509 509
         
510
-        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
510
+        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
511 511
 
512 512
         if (!empty($fields)) {
513 513
             foreach ($fields as $field) {
@@ -532,14 +532,14 @@  discard block
 block discarded – undo
532 532
  * @since 1.6.9
533 533
  * @package GeoDirectory
534 534
  */
535
-function geodir_custom_fields_custom($post_type=''){
535
+function geodir_custom_fields_custom($post_type = '') {
536 536
 
537 537
     $custom_fields = array();
538 538
 
539 539
     /**
540 540
      * @see `geodir_custom_fields`
541 541
      */
542
-    return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
542
+    return apply_filters('geodir_custom_fields_custom', $custom_fields, $post_type);
543 543
 }
544 544
 
545 545
 
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
  * @since 1.6.6
551 551
  * @package GeoDirectory
552 552
  */
553
-function geodir_custom_fields($post_type=''){
553
+function geodir_custom_fields($post_type = '') {
554 554
     
555 555
     $custom_fields = array(
556 556
         'text' => array(
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
      * }
686 686
      * @param string $post_type The post type requested.
687 687
      */
688
-    return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
688
+    return apply_filters('geodir_custom_fields', $custom_fields, $post_type);
689 689
 }
690 690
 
691 691
 /**
@@ -696,25 +696,25 @@  discard block
 block discarded – undo
696 696
  * @param string $type The custom field type, predefined, custom or blank for default
697 697
  * @package GeoDirectory
698 698
  */
699
-function geodir_custom_available_fields($type='')
699
+function geodir_custom_available_fields($type = '')
700 700
 {
701 701
     $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
702 702
     ?>
703
-    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
703
+    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/>
704 704
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" />
705 705
 
706 706
         <?php
707
-        if($type=='predefined'){
707
+        if ($type == 'predefined') {
708 708
             $cfs = geodir_custom_fields_predefined($listing_type);
709
-        }elseif($type=='custom'){
709
+        }elseif ($type == 'custom') {
710 710
             $cfs = geodir_custom_fields_custom($listing_type);
711
-        }else{
711
+        } else {
712 712
             $cfs = geodir_custom_fields($listing_type);
713 713
             ?>
714 714
             <ul class="full gd-cf-tooltip-wrap">
715 715
                 <li>
716 716
                     <div class="gdcf-tooltip">
717
-                        <?php _e('This adds a section separator with a title.', 'geodirectory');?>
717
+                        <?php _e('This adds a section separator with a title.', 'geodirectory'); ?>
718 718
                     </div>
719 719
                     <a id="gt-fieldset"
720 720
                        class="gd-draggable-form-items gt-fieldset"
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 
726 726
                         <i class="fas fa-long-arrow-alt-left " aria-hidden="true"></i>
727 727
                         <i class="fas fa-long-arrow-alt-right " aria-hidden="true"></i>
728
-                        <?php _e('Fieldset (section separator)', 'geodirectory');?>
728
+                        <?php _e('Fieldset (section separator)', 'geodirectory'); ?>
729 729
                     </a>
730 730
                 </li>
731 731
             </ul>
@@ -733,15 +733,15 @@  discard block
 block discarded – undo
733 733
             <?php
734 734
         }
735 735
 
736
-    if(!empty($cfs)) {
736
+    if (!empty($cfs)) {
737 737
         echo '<ul>';
738
-        foreach ( $cfs as $id => $cf ) {
738
+        foreach ($cfs as $id => $cf) {
739 739
             ?>
740 740
 
741 741
             <li class="gd-cf-tooltip-wrap">
742 742
                 <?php
743
-                if ( isset( $cf['description'] ) && $cf['description'] ) {
744
-                    echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>';
743
+                if (isset($cf['description']) && $cf['description']) {
744
+                    echo '<div class="gdcf-tooltip">'.$cf['description'].'</div>';
745 745
                 } ?>
746 746
 
747 747
                 <a id="gd-<?php echo $id; ?>"
@@ -751,10 +751,10 @@  discard block
 block discarded – undo
751 751
                    class="gd-draggable-form-items <?php echo $cf['class']; ?>"
752 752
                    href="javascript:void(0);">
753 753
 
754
-                    <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], ' fa-' ) !== false ) {
755
-                        echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>';
756
-                    } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
757
-                        echo '<b class="gd-cf-icon" style="background-image: url(\'' . $cf['icon'] . '\')"></b>';
754
+                    <?php if (isset($cf['icon']) && strpos($cf['icon'], ' fa-') !== false) {
755
+                        echo '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
756
+                    } elseif (isset($cf['icon']) && $cf['icon']) {
757
+                        echo '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>';
758 758
                     } else {
759 759
                         echo '<i class="fas fa-cog" aria-hidden="true"></i>';
760 760
                     } ?>
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
             </li>
764 764
             <?php
765 765
         }
766
-    }else{
766
+    } else {
767 767
         _e('There are no custom fields here yet.', 'geodirectory');
768 768
     }
769 769
         ?>
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
     <ul class="core">
792 792
     <?php 
793 793
         global $wpdb;
794
-        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
794
+        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
795 795
 
796 796
         if (!empty($fields)) {
797 797
             foreach ($fields as $field) {
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
                 $field_type_key = $field->field_type_key;
802 802
                 $field_ins_upd = 'display';
803 803
 
804
-                geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key);
804
+                geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd, $field_type_key);
805 805
             }
806 806
         }
807 807
         ?></ul>
@@ -960,8 +960,8 @@  discard block
 block discarded – undo
960 960
 
961 961
     if (!get_option('geodir_remove_unnecessary_fields')) {
962 962
 
963
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
964
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
963
+        if ($wpdb->get_var("SHOW COLUMNS FROM ".$plugin_prefix."gd_place_detail WHERE field = 'categories'"))
964
+            $wpdb->query("ALTER TABLE `".$plugin_prefix."gd_place_detail` DROP `categories`");
965 965
 
966 966
         update_option('geodir_remove_unnecessary_fields', '1');
967 967
 
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
             case 'diagnosis' :
991 991
                 if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
992 992
                     $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
993
-                    call_user_func('geodir_diagnose_' . $diagnose_this);
993
+                    call_user_func('geodir_diagnose_'.$diagnose_this);
994 994
 
995 995
                 }
996 996
                 exit();
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
             case 'diagnosis-fix' :
1000 1000
                 if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
1001 1001
                     $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
1002
-                call_user_func('geodir_diagnose_' . $diagnose_this);
1002
+                call_user_func('geodir_diagnose_'.$diagnose_this);
1003 1003
                 exit();
1004 1004
                 break;
1005 1005
         }
@@ -1024,50 +1024,50 @@  discard block
 block discarded – undo
1024 1024
 {
1025 1025
     global $wpdb;
1026 1026
     //$filter_arr['output_str'] .='###'.$table.'###';
1027
-    if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
1028
-        $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
1027
+    if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0) {
1028
+        $filter_arr['output_str'] .= "<li>".__('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory')."</li>";
1029 1029
         $filter_arr['is_error_during_diagnose'] = true;
1030 1030
 
1031
-    } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1032
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
1031
+    } elseif ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
1032
+        $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name)."</li>";
1033 1033
         $filter_arr['is_error_during_diagnose'] = true;
1034
-        $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
1034
+        $filter_arr['output_str'] .= "<li>".__('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory')."</li>";
1035 1035
         $filter_arr['is_error_during_diagnose'] = true;
1036 1036
 
1037 1037
         if ($fix) {
1038
-            $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
1039
-            $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
1038
+            $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$table."_ms_bak"); // get backup table count
1039
+            $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table"); // get new table count
1040 1040
 
1041 1041
             if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
1042 1042
                 //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
1043 1043
 
1044
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
1044
+                $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename bak table to new table
1045 1045
 
1046
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1047
-                    $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
1046
+                if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
1047
+                    $filter_arr['output_str'] .= "<li>".__('-->FIXED: Renamed and backed up the tables', 'geodirectory')."</li>";
1048 1048
                 } else {
1049
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1049
+                    $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
1050 1050
                 }
1051 1051
 
1052 1052
             } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
1053 1053
 
1054
-                $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
1055
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
1054
+                $wpdb->query("RENAME TABLE ".$wpdb->prefix."$table TO ".$table."_ms_bak2"); // rename new table to bak2
1055
+                $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$wpdb->prefix."$table"); // rename bak table to new table
1056 1056
 
1057
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1058
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
1057
+                if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1058
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table)."</li>";
1059 1059
                 } else {
1060
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1060
+                    $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
1061 1061
                 }
1062 1062
 
1063 1063
             } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
1064 1064
 
1065
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
1065
+                $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename ms_bak table to ms_bak2
1066 1066
 
1067
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1068
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
1067
+                if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
1068
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table)."</li>";
1069 1069
                 } else {
1070
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1070
+                    $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
1071 1071
                 }
1072 1072
 
1073 1073
             }
@@ -1075,54 +1075,54 @@  discard block
 block discarded – undo
1075 1075
         }
1076 1076
 
1077 1077
 
1078
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1079
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
1078
+    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
1079
+        $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name)."</li>";
1080 1080
         $filter_arr['is_error_during_diagnose'] = true;
1081 1081
 
1082 1082
         if ($fix) {
1083 1083
             if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
1084 1084
                 if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
1085
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
1085
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table)."</li>";
1086 1086
                 } else {
1087
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
1087
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table)."</li>";
1088 1088
                 }
1089 1089
 
1090
-            } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original
1091
-                if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
1092
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1090
+            } elseif ($wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table") == 0) {// if main table is empty but original is not, delete main and rename original
1091
+                if ($wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."$table")) {
1092
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix.$table)."</li>";
1093 1093
                 } else {
1094
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1094
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix.$table)."</li>";
1095 1095
                 }
1096
-                if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1097
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1096
+                if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1097
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
1098 1098
                 } else {
1099
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1099
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
1100 1100
                 }
1101 1101
             } else {// else rename the original table to _ms_bak
1102
-                if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1103
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
1102
+                if ($wpdb->query("RENAME TABLE $table TO ".$table."_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1103
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table."_ms_bak")."</li>";
1104 1104
                 } else {
1105
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
1105
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table."_ms_bak")."</li>";
1106 1106
                 }
1107 1107
             }
1108 1108
         }
1109 1109
 
1110
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1111
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
1110
+    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
1111
+        $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name)."</li>";
1112 1112
         $filter_arr['is_error_during_diagnose'] = true;
1113 1113
 
1114 1114
         if ($fix) {
1115 1115
             // if original table exists but new does not, rename
1116
-            if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1117
-                $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1116
+            if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1117
+                $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
1118 1118
             } else {
1119
-                $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1119
+                $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
1120 1120
             }
1121 1121
 
1122 1122
         }
1123 1123
 
1124
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1125
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
1124
+    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
1125
+        $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name)."</li>";
1126 1126
         $filter_arr['is_error_during_diagnose'] = true;
1127 1127
 
1128 1128
         if ($fix) {
@@ -1136,11 +1136,11 @@  discard block
 block discarded – undo
1136 1136
             delete_option('geodir_custom_posts_db_version');
1137 1137
             delete_option('geodir_reviewratings_db_version');
1138 1138
             delete_option('geodiradvancesearch_db_version');
1139
-            $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
1139
+            $filter_arr['output_str'] .= "<li>".__('-->TRY: Please refresh page to run table install functions', 'geodirectory')."</li>";
1140 1140
         }
1141 1141
 
1142 1142
     } else {
1143
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
1143
+        $filter_arr['output_str'] .= "<li>".sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name)."</li>";
1144 1144
     }
1145 1145
     return $filter_arr;
1146 1146
 }
@@ -1181,21 +1181,21 @@  discard block
 block discarded – undo
1181 1181
     }
1182 1182
 
1183 1183
     if ($stepped_process) {
1184
-        $sql = $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $ptype . "_detail LIMIT %d OFFSET %d", $step_max_items, $offset );
1185
-        $posts = $wpdb->get_results( $sql );
1184
+        $sql = $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."geodir_".$ptype."_detail LIMIT %d OFFSET %d", $step_max_items, $offset);
1185
+        $posts = $wpdb->get_results($sql);
1186 1186
 
1187 1187
         if (!empty($posts)) {
1188 1188
 
1189 1189
             foreach ($posts as $p) {
1190 1190
                 $p->post_type = $ptype;
1191
-                $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
1191
+                $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
1192 1192
                 if (empty($raw_tags)) {
1193 1193
                     $post_tags = '';
1194 1194
                 } else {
1195 1195
                     $post_tags = implode(",", $raw_tags);
1196 1196
                 }
1197
-                $tablename = $plugin_prefix . $p->post_type . '_detail';
1198
-                $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1197
+                $tablename = $plugin_prefix.$p->post_type.'_detail';
1198
+                $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1199 1199
 
1200 1200
             }
1201 1201
             if ($step >= $max_step) {
@@ -1211,23 +1211,23 @@  discard block
 block discarded – undo
1211 1211
         if (!empty($all_postypes)) {
1212 1212
             foreach ($all_postypes as $key) {
1213 1213
                 // update each GD CPT
1214
-                $posts = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail");
1214
+                $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail");
1215 1215
 
1216 1216
                 if (!empty($posts)) {
1217 1217
 
1218 1218
                     foreach ($posts as $p) {
1219 1219
                         $p->post_type = $key;
1220
-                        $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
1220
+                        $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
1221 1221
                         if (empty($raw_tags)) {
1222 1222
                             $post_tags = '';
1223 1223
                         } else {
1224 1224
                             $post_tags = implode(",", $raw_tags);
1225 1225
                         }
1226
-                        $tablename = $plugin_prefix . $p->post_type . '_detail';
1227
-                        $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1226
+                        $tablename = $plugin_prefix.$p->post_type.'_detail';
1227
+                        $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1228 1228
 
1229 1229
                     }
1230
-                    $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1230
+                    $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
1231 1231
                 }
1232 1232
 
1233 1233
             }
@@ -1238,14 +1238,14 @@  discard block
 block discarded – undo
1238 1238
 
1239 1239
     if ($is_error_during_diagnose) {
1240 1240
         $info_div_class = "geodir_problem_info";
1241
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1241
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1242 1242
     } else {
1243 1243
         $info_div_class = "geodir_noproblem_info";
1244 1244
         $fix_button_txt = '';
1245 1245
     }
1246 1246
 
1247 1247
     if ($stepped_process) {
1248
-        $percent = ($step/$max_step) * 100;
1248
+        $percent = ($step / $max_step) * 100;
1249 1249
         if ($output_str == 'done') {
1250 1250
             echo $output_str;
1251 1251
         } else {
@@ -1288,29 +1288,29 @@  discard block
 block discarded – undo
1288 1288
     if (!empty($all_postypes)) {
1289 1289
         foreach ($all_postypes as $key) {
1290 1290
             // update each GD CTP
1291
-            $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
1291
+            $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d WHERE d.".$key."category='' ");
1292 1292
 
1293 1293
             if (!empty($posts)) {
1294 1294
 
1295 1295
                 foreach ($posts as $p) {
1296 1296
                     $p->post_type = $key;
1297
-                    $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
1297
+                    $raw_cats = wp_get_object_terms($p->post_id, $p->post_type.'category', array('fields' => 'ids'));
1298 1298
 
1299 1299
                     if (empty($raw_cats)) {
1300 1300
                         $post_categories = get_post_meta($p->post_id, 'post_categories', true);
1301 1301
 
1302
-                        if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
1303
-                            $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
1304
-                            foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
1302
+                        if (!empty($post_categories) && !empty($post_categories[$p->post_type.'category'])) {
1303
+                            $post_categories[$p->post_type.'category'] = str_replace("d:", "", $post_categories[$p->post_type.'category']);
1304
+                            foreach (explode(",", $post_categories[$p->post_type.'category']) as $cat_part) {
1305 1305
                                 if (is_numeric($cat_part)) {
1306
-                                    $raw_cats[] = (int)$cat_part;
1306
+                                    $raw_cats[] = (int) $cat_part;
1307 1307
                                 }
1308 1308
                             }
1309 1309
 
1310 1310
                         }
1311 1311
 
1312 1312
                         if (!empty($raw_cats)) {
1313
-                            $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category');
1313
+                            $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type.'category');
1314 1314
 
1315 1315
                         }
1316 1316
 
@@ -1320,14 +1320,14 @@  discard block
 block discarded – undo
1320 1320
                     if (empty($raw_cats)) {
1321 1321
                         $post_cats = '';
1322 1322
                     } else {
1323
-                        $post_cats = ',' . implode(",", $raw_cats) . ',';
1323
+                        $post_cats = ','.implode(",", $raw_cats).',';
1324 1324
                     }
1325
-                    $tablename = $plugin_prefix . $p->post_type . '_detail';
1326
-                    $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
1325
+                    $tablename = $plugin_prefix.$p->post_type.'_detail';
1326
+                    $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET ".$p->post_type."category=%s WHERE post_id =%d", $post_cats, $p->post_id));
1327 1327
                 }
1328 1328
 
1329 1329
             }
1330
-            $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1330
+            $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
1331 1331
 
1332 1332
         }
1333 1333
 
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
 
1336 1336
     if ($is_error_during_diagnose) {
1337 1337
         $info_div_class = "geodir_problem_info";
1338
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1338
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1339 1339
     } else {
1340 1340
         $info_div_class = "geodir_noproblem_info";
1341 1341
         $fix_button_txt = '';
@@ -1388,15 +1388,15 @@  discard block
 block discarded – undo
1388 1388
     if (!empty($ver_arr)) {
1389 1389
         foreach ($ver_arr as $key => $val) {
1390 1390
             if (delete_option($val)) {
1391
-                $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
1391
+                $output_str .= "<li>".$key.__(' Version: Deleted', 'geodirectory')."</li>";
1392 1392
             } else {
1393
-                $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
1393
+                $output_str .= "<li>".$key.__(' Version: Not Found', 'geodirectory')."</li>";
1394 1394
             }
1395 1395
 
1396 1396
         }
1397 1397
 
1398 1398
         if ($output_str) {
1399
-            $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
1399
+            $output_str .= "<li><strong>".__(' Upgrade/install scripts will run on next page reload.', 'geodirectory')."</strong></li>";
1400 1400
         }
1401 1401
 
1402 1402
     }
@@ -1435,55 +1435,55 @@  discard block
 block discarded – undo
1435 1435
 	$gd_post_types = geodir_get_posttypes();
1436 1436
 
1437 1437
 	$skip_post_types = array();
1438
-	if ( ! empty( $gd_post_types ) ) {
1439
-		foreach ( $gd_post_types as $post_type ) {
1440
-			$location_allowed = $post_type && function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
1441
-			if ( $location_allowed ) {
1438
+	if (!empty($gd_post_types)) {
1439
+		foreach ($gd_post_types as $post_type) {
1440
+			$location_allowed = $post_type && function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
1441
+			if ($location_allowed) {
1442 1442
 				continue;
1443 1443
 			}
1444 1444
 			$skip_post_types[] = $post_type;
1445 1445
 		}
1446 1446
 	}
1447
-	$skip_post_types_where = ! empty( $skip_post_types ) ? " AND post_type NOT IN( '" . implode( "','", $skip_post_types ) . "' )" : '';
1447
+	$skip_post_types_where = !empty($skip_post_types) ? " AND post_type NOT IN( '".implode("','", $skip_post_types)."' )" : '';
1448 1448
 
1449 1449
     // check review locations
1450
-    if ($wpdb->get_var("SELECT COUNT(*) FROM " . GEODIR_REVIEW_TABLE . " WHERE ( post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL ) {$skip_post_types_where}")) {
1451
-        $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
1450
+    if ($wpdb->get_var("SELECT COUNT(*) FROM ".GEODIR_REVIEW_TABLE." WHERE ( post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL ) {$skip_post_types_where}")) {
1451
+        $output_str .= "<li>".__('Review locations missing or broken', 'geodirectory')."</li>";
1452 1452
         $is_error_during_diagnose = true;
1453 1453
 
1454 1454
         if ($fix) {
1455 1455
             if (geodir_fix_review_location()) {
1456
-                $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
1456
+                $output_str .= "<li><strong>".__('-->FIXED: Review locations fixed', 'geodirectory')."</strong></li>";
1457 1457
             } else {
1458
-                $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
1458
+                $output_str .= "<li><strong>".__('-->FAILED: Review locations fix failed', 'geodirectory')."</strong></li>";
1459 1459
             }
1460 1460
         }
1461 1461
 
1462 1462
     } else {
1463
-        $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
1463
+        $output_str .= "<li>".__('Review locations ok', 'geodirectory')."</li>";
1464 1464
     }
1465 1465
 
1466 1466
     // check review content
1467
-    if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
1468
-        $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
1467
+    if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_content IS NULL")) {
1468
+        $output_str .= "<li>".__('Review content missing or broken', 'geodirectory')."</li>";
1469 1469
         $is_error_during_diagnose = true;
1470 1470
 
1471 1471
         if ($fix) {
1472 1472
             if (geodir_fix_review_content()) {
1473
-                $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
1473
+                $output_str .= "<li><strong>".__('-->FIXED: Review content fixed', 'geodirectory')."</strong></li>";
1474 1474
             } else {
1475
-                $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
1475
+                $output_str .= "<li><strong>".__('-->FAILED: Review content fix failed', 'geodirectory')."</strong></li>";
1476 1476
             }
1477 1477
         }
1478 1478
 
1479 1479
     } else {
1480
-        $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
1480
+        $output_str .= "<li>".__('Review content ok', 'geodirectory')."</li>";
1481 1481
     }
1482 1482
 
1483 1483
 
1484 1484
     if ($is_error_during_diagnose) {
1485 1485
         $info_div_class = "geodir_problem_info";
1486
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1486
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1487 1487
     } else {
1488 1488
         $info_div_class = "geodir_noproblem_info";
1489 1489
         $fix_button_txt = '';
@@ -1547,7 +1547,7 @@  discard block
 block discarded – undo
1547 1547
 
1548 1548
     if ($is_error_during_diagnose) {
1549 1549
         $info_div_class = "geodir_problem_info";
1550
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1550
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1551 1551
     } else {
1552 1552
         $info_div_class = "geodir_noproblem_info";
1553 1553
         $fix_button_txt = '';
@@ -1581,7 +1581,7 @@  discard block
 block discarded – undo
1581 1581
     else {
1582 1582
         $page_found = $wpdb->get_var(
1583 1583
             $wpdb->prepare(
1584
-                "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
1584
+                "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;",
1585 1585
                 array($slug)
1586 1586
             )
1587 1587
         );
@@ -1627,18 +1627,18 @@  discard block
 block discarded – undo
1627 1627
     //////////////////////////////////
1628 1628
     $option_value = get_option('geodir_home_page');
1629 1629
     $page = get_post($option_value);
1630
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1630
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1631 1631
 
1632
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1633
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1632
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1633
+        $output_str .= "<li>".__('GD Home page exists with proper setting.', 'geodirectory')."</li>";
1634 1634
     else {
1635 1635
         $is_error_during_diagnose = true;
1636
-        $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1636
+        $output_str .= "<li><strong>".__('GD Home page is missing.', 'geodirectory')."</strong></li>";
1637 1637
         if ($fix) {
1638 1638
             if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
1639
-                $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
1639
+                $output_str .= "<li><strong>".__('-->FIXED: GD Home page fixed', 'geodirectory')."</strong></li>";
1640 1640
             } else {
1641
-                $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
1641
+                $output_str .= "<li><strong>".__('-->FAILED: GD Home page fix failed', 'geodirectory')."</strong></li>";
1642 1642
             }
1643 1643
         }
1644 1644
     }
@@ -1652,18 +1652,18 @@  discard block
 block discarded – undo
1652 1652
     //////////////////////////////////
1653 1653
     $option_value = get_option('geodir_add_listing_page');
1654 1654
     $page = get_post($option_value);
1655
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1655
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1656 1656
 
1657
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1658
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1657
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1658
+        $output_str .= "<li>".__('Add Listing page exists with proper setting.', 'geodirectory')."</li>";
1659 1659
     else {
1660 1660
         $is_error_during_diagnose = true;
1661
-        $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1661
+        $output_str .= "<li><strong>".__('Add Listing page is missing.', 'geodirectory')."</strong></li>";
1662 1662
         if ($fix) {
1663 1663
             if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
1664
-                $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
1664
+                $output_str .= "<li><strong>".__('-->FIXED: Add Listing page fixed', 'geodirectory')."</strong></li>";
1665 1665
             } else {
1666
-                $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
1666
+                $output_str .= "<li><strong>".__('-->FAILED: Add Listing page fix failed', 'geodirectory')."</strong></li>";
1667 1667
             }
1668 1668
         }
1669 1669
     }
@@ -1678,18 +1678,18 @@  discard block
 block discarded – undo
1678 1678
     //////////////////////////////////
1679 1679
     $option_value = get_option('geodir_preview_page');
1680 1680
     $page = get_post($option_value);
1681
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1681
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1682 1682
 
1683
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1684
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1683
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1684
+        $output_str .= "<li>".__('Listing Preview page exists with proper setting.', 'geodirectory')."</li>";
1685 1685
     else {
1686 1686
         $is_error_during_diagnose = true;
1687
-        $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1687
+        $output_str .= "<li><strong>".__('Listing Preview page is missing.', 'geodirectory')."</strong></li>";
1688 1688
         if ($fix) {
1689 1689
             if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
1690
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
1690
+                $output_str .= "<li><strong>".__('-->FIXED: Listing Preview page fixed', 'geodirectory')."</strong></li>";
1691 1691
             } else {
1692
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
1692
+                $output_str .= "<li><strong>".__('-->FAILED: Listing Preview page fix failed', 'geodirectory')."</strong></li>";
1693 1693
             }
1694 1694
         }
1695 1695
     }
@@ -1703,18 +1703,18 @@  discard block
 block discarded – undo
1703 1703
     //////////////////////////////////
1704 1704
     $option_value = get_option('geodir_success_page');
1705 1705
     $page = get_post($option_value);
1706
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1706
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1707 1707
 
1708
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1709
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1708
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1709
+        $output_str .= "<li>".__('Listing Success page exists with proper setting.', 'geodirectory')."</li>";
1710 1710
     else {
1711 1711
         $is_error_during_diagnose = true;
1712
-        $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1712
+        $output_str .= "<li><strong>".__('Listing Success page is missing.', 'geodirectory')."</strong></li>";
1713 1713
         if ($fix) {
1714 1714
             if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
1715
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
1715
+                $output_str .= "<li><strong>".__('-->FIXED: Listing Success page fixed', 'geodirectory')."</strong></li>";
1716 1716
             } else {
1717
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
1717
+                $output_str .= "<li><strong>".__('-->FAILED: Listing Success page fix failed', 'geodirectory')."</strong></li>";
1718 1718
             }
1719 1719
         }
1720 1720
     }
@@ -1728,18 +1728,18 @@  discard block
 block discarded – undo
1728 1728
     //////////////////////////////////
1729 1729
     $option_value = get_option('geodir_info_page');
1730 1730
     $page = get_post($option_value);
1731
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1731
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1732 1732
 
1733
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1734
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1733
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1734
+        $output_str .= "<li>".__('Info page exists with proper setting.', 'geodirectory')."</li>";
1735 1735
     else {
1736 1736
         $is_error_during_diagnose = true;
1737
-        $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1737
+        $output_str .= "<li><strong>".__('Info page is missing.', 'geodirectory')."</strong></li>";
1738 1738
         if ($fix) {
1739 1739
             if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
1740
-                $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
1740
+                $output_str .= "<li><strong>".__('-->FIXED: Info page fixed', 'geodirectory')."</strong></li>";
1741 1741
             } else {
1742
-                $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
1742
+                $output_str .= "<li><strong>".__('-->FAILED: Info page fix failed', 'geodirectory')."</strong></li>";
1743 1743
             }
1744 1744
         }
1745 1745
     }
@@ -1753,18 +1753,18 @@  discard block
 block discarded – undo
1753 1753
     //////////////////////////////////
1754 1754
     $option_value = get_option('geodir_login_page');
1755 1755
     $page = get_post($option_value);
1756
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1756
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1757 1757
 
1758
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1759
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1758
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1759
+        $output_str .= "<li>".__('Login page exists with proper setting.', 'geodirectory')."</li>";
1760 1760
     else {
1761 1761
         $is_error_during_diagnose = true;
1762
-        $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1762
+        $output_str .= "<li><strong>".__('Login page is missing.', 'geodirectory')."</strong></li>";
1763 1763
         if ($fix) {
1764 1764
             if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
1765
-                $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
1765
+                $output_str .= "<li><strong>".__('-->FIXED: Login page fixed', 'geodirectory')."</strong></li>";
1766 1766
             } else {
1767
-                $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
1767
+                $output_str .= "<li><strong>".__('-->FAILED: Login page fix failed', 'geodirectory')."</strong></li>";
1768 1768
             }
1769 1769
         }
1770 1770
     }
@@ -1778,18 +1778,18 @@  discard block
 block discarded – undo
1778 1778
     //////////////////////////////////
1779 1779
     $option_value = get_option('geodir_location_page');
1780 1780
     $page = get_post($option_value);
1781
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1781
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1782 1782
 
1783
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1784
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1783
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1784
+        $output_str .= "<li>".__('Location page exists with proper setting.', 'geodirectory')."</li>";
1785 1785
     else {
1786 1786
         $is_error_during_diagnose = true;
1787
-        $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1787
+        $output_str .= "<li><strong>".__('Location page is missing.', 'geodirectory')."</strong></li>";
1788 1788
         if ($fix) {
1789 1789
             if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
1790
-                $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
1790
+                $output_str .= "<li><strong>".__('-->FIXED: Location page fixed', 'geodirectory')."</strong></li>";
1791 1791
             } else {
1792
-                $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
1792
+                $output_str .= "<li><strong>".__('-->FAILED: Location page fix failed', 'geodirectory')."</strong></li>";
1793 1793
             }
1794 1794
         }
1795 1795
     }
@@ -1798,13 +1798,13 @@  discard block
 block discarded – undo
1798 1798
     /* Diagnose Location Page Ends */
1799 1799
     ////////////////////////////////
1800 1800
 
1801
-    $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
1801
+    $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose);
1802 1802
     /**
1803 1803
      * This action is called at the end of the GD Tools page check function.
1804 1804
      *
1805 1805
      * @since 1.5.2
1806 1806
      */
1807
-    $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
1807
+    $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr);
1808 1808
 
1809 1809
     $output_str = $page_chk_arr['output_str'];
1810 1810
     $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];
@@ -1814,7 +1814,7 @@  discard block
 block discarded – undo
1814 1814
             flush_rewrite_rules();
1815 1815
         }
1816 1816
         $info_div_class = "geodir_problem_info";
1817
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1817
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1818 1818
     } else {
1819 1819
         $info_div_class = "geodir_noproblem_info";
1820 1820
         $fix_button_txt = '';
@@ -1842,10 +1842,10 @@  discard block
 block discarded – undo
1842 1842
     $fix_button_txt = '';
1843 1843
 
1844 1844
     if ($is_error_during_diagnose) {
1845
-        $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>";
1845
+        $output_str .= "<li>".__('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory').' '.geodir_plugin_path().'/db-language.php'."</li>";
1846 1846
 		$info_div_class = "geodir_problem_info";
1847 1847
     } else {
1848
-        $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
1848
+        $output_str .= "<li>".__('Load custom fields in to file for translation: ok', 'geodirectory')."</li>";
1849 1849
 		$info_div_class = "geodir_noproblem_info";
1850 1850
         $fix_button_txt = '';
1851 1851
     }
@@ -1887,17 +1887,17 @@  discard block
 block discarded – undo
1887 1887
     global $wpdb, $wp_query, $plugin_prefix;
1888 1888
 
1889 1889
     if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) {
1890
-        $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail';
1890
+        $table = $plugin_prefix.$wp_query->query_vars['post_type'].'_detail';
1891 1891
 
1892
-        $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)';
1892
+        $join = $clauses['join'].' INNER JOIN '.$table.' AS gd_posts ON (gd_posts.post_id = '.$wpdb->posts.'.ID)';
1893 1893
         $clauses['join'] = $join;
1894 1894
 
1895
-        $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : '';
1895
+        $fields = $clauses['fields'] != '' ? $clauses['fields'].', ' : '';
1896 1896
         $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire';
1897 1897
         $clauses['fields'] = $fields;
1898 1898
 
1899 1899
         $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC';
1900
-        $orderby = 'gd_expire ' . $order;
1900
+        $orderby = 'gd_expire '.$order;
1901 1901
         $clauses['orderby'] = $orderby;
1902 1902
     }
1903 1903
     return $clauses;
@@ -1940,7 +1940,7 @@  discard block
 block discarded – undo
1940 1940
         global $current_user;
1941 1941
         $upload_dir = wp_upload_dir();
1942 1942
 
1943
-        $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv';
1943
+        $file = $upload_dir['path'].'/temp_'.$current_user->data->ID.'/geodir_tmp.csv';
1944 1944
         $handle = fopen($file, 'w');
1945 1945
 
1946 1946
         fwrite($handle, $input);
@@ -1985,7 +1985,7 @@  discard block
 block discarded – undo
1985 1985
     $uploads_dir = $uploads['path'];
1986 1986
     $image_name_arr = explode('/', $filename);
1987 1987
     $filename = end($image_name_arr);
1988
-    $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1988
+    $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;
1989 1989
     $return = array();
1990 1990
     $return['file'] = $uploadedFile;
1991 1991
     $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
@@ -2002,8 +2002,8 @@  discard block
 block discarded – undo
2002 2002
 
2003 2003
                 if (($handle = fopen($target_path, "r")) !== FALSE) {
2004 2004
                     while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
2005
-                        if(is_array($data) && !empty($data)) {
2006
-                            $file[] = '"' . implode('","', $data) . '"';
2005
+                        if (is_array($data) && !empty($data)) {
2006
+                            $file[] = '"'.implode('","', $data).'"';
2007 2007
                         }
2008 2008
                     }
2009 2009
                     fclose($handle);
@@ -2120,10 +2120,10 @@  discard block
 block discarded – undo
2120 2120
                     $tag_arr = explode(',', $post_tags);
2121 2121
                 }
2122 2122
 
2123
-                $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database
2123
+                $table = $plugin_prefix.$buffer[5].'_detail'; // check table in database
2124 2124
 
2125 2125
                 $error = '';
2126
-                if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
2126
+                if ($wpdb->get_var("SHOW TABLES LIKE '".$table."'") != $table) {
2127 2127
                     $invalid_post_type++;
2128 2128
                     continue;
2129 2129
                 }
@@ -2149,7 +2149,7 @@  discard block
 block discarded – undo
2149 2149
                             if ($buffer[$c] != '0' && $buffer[$c] != '') {
2150 2150
                                 $submitdata = date('Y-m-d');
2151 2151
 
2152
-                                $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
2152
+                                $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata."+".addslashes($buffer[$c])." days"));
2153 2153
                             } else {
2154 2154
                                 $gd_post_info['expire_date'] = 'Never';
2155 2155
                             }
@@ -2177,7 +2177,7 @@  discard block
 block discarded – undo
2177 2177
 						
2178 2178
 						// Post status
2179 2179
 						if ($customKeyarray[$c] == 'post_status') {
2180
-                            $post_status = sanitize_key( $buffer[$c] );
2180
+                            $post_status = sanitize_key($buffer[$c]);
2181 2181
                         }
2182 2182
                     }
2183 2183
 
@@ -2195,8 +2195,8 @@  discard block
 block discarded – undo
2195 2195
 					
2196 2196
 					// Default post status
2197 2197
 					$default_status = 'publish';
2198
-					$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
2199
-					$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
2198
+					$post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
2199
+					$post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
2200 2200
 
2201 2201
                     $my_post['post_title'] = $post_title;
2202 2202
                     $my_post['post_content'] = $post_desc;
@@ -2240,7 +2240,7 @@  discard block
 block discarded – undo
2240 2240
                     $payment_info = array();
2241 2241
                     $package_info = array();
2242 2242
 
2243
-                    $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
2243
+                    $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]);
2244 2244
                     $package_id = '';
2245 2245
                     if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
2246 2246
                         $package_id = $gd_post_info['package_id'];
@@ -2250,7 +2250,7 @@  discard block
 block discarded – undo
2250 2250
                         $payment_info['package_id'] = $package_info['pid'];
2251 2251
 
2252 2252
                         if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
2253
-                            $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
2253
+                            $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['alive_days']." days"));
2254 2254
                         } else {
2255 2255
                             $payment_info['expire_date'] = 'Never';
2256 2256
                         }
@@ -2262,7 +2262,7 @@  discard block
 block discarded – undo
2262 2262
 
2263 2263
                     $post_type = get_post_type($last_postid);
2264 2264
 
2265
-                    $table = $plugin_prefix . $post_type . '_detail';
2265
+                    $table = $plugin_prefix.$post_type.'_detail';
2266 2266
 
2267 2267
                     geodir_save_post_info($last_postid, $gd_post_info);
2268 2268
 
@@ -2283,7 +2283,7 @@  discard block
 block discarded – undo
2283 2283
                             $attachment['post_id'] = $last_postid;
2284 2284
                             $attachment['title'] = $img_name_arr[0];
2285 2285
                             $attachment['content'] = '';
2286
-                            $attachment['file'] = $sub_dir . '/' . $image_name;
2286
+                            $attachment['file'] = $sub_dir.'/'.$image_name;
2287 2287
                             $attachment['mime_type'] = $uploaded_file_type;
2288 2288
                             $attachment['menu_order'] = $menu_order;
2289 2289
                             $attachment['is_featured'] = 0;
@@ -2292,15 +2292,15 @@  discard block
 block discarded – undo
2292 2292
 
2293 2293
                             foreach ($attachment as $key => $val) {
2294 2294
                                 if ($val != '')
2295
-                                    $attachment_set .= $key . " = '" . $val . "', ";
2295
+                                    $attachment_set .= $key." = '".$val."', ";
2296 2296
                             }
2297 2297
                             $attachment_set = trim($attachment_set, ", ");
2298 2298
 
2299
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
2299
+                            $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
2300 2300
 
2301 2301
                             if ($menu_order == 1) {
2302 2302
                                 $post_type = get_post_type($last_postid);
2303
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
2303
+                                $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($sub_dir.'/'.$image_name, $last_postid)));
2304 2304
                             }
2305 2305
                             $menu_order++;
2306 2306
                         }
@@ -2341,11 +2341,11 @@  discard block
 block discarded – undo
2341 2341
 }
2342 2342
 
2343 2343
 // Add the tab in left sidebar menu fro import & export page.
2344
-add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 );
2344
+add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94);
2345 2345
 
2346 2346
 // Handle ajax request for import/export.
2347
-add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' );
2348
-add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' );
2347
+add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export');
2348
+add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export');
2349 2349
 
2350 2350
 
2351 2351
 /**
@@ -2356,40 +2356,40 @@  discard block
 block discarded – undo
2356 2356
  * @param $post_id int $post_id The post ID of the post being saved.
2357 2357
  * @param $post object $post The post object of the post being saved.
2358 2358
  */
2359
-function geodir_update_location_prefix($post_id,$post){
2360
-    if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
2361
-        update_option('geodir_location_prefix',$post->post_name);
2359
+function geodir_update_location_prefix($post_id, $post) {
2360
+    if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) {
2361
+        update_option('geodir_location_prefix', $post->post_name);
2362 2362
     }
2363 2363
 
2364 2364
 }
2365 2365
 
2366
-add_action('save_post', 'geodir_update_location_prefix',10,2);
2366
+add_action('save_post', 'geodir_update_location_prefix', 10, 2);
2367 2367
 
2368
-add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' );
2368
+add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback');
2369 2369
 
2370
-function geodir_ga_callback(){
2370
+function geodir_ga_callback() {
2371 2371
 
2372
-if(isset($_REQUEST['code']) && $_REQUEST['code']) {
2372
+if (isset($_REQUEST['code']) && $_REQUEST['code']) {
2373 2373
     $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?";
2374 2374
     $code = "code=".$_REQUEST['code'];
2375 2375
     $grant_type = "&grant_type=authorization_code";
2376
-    $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2376
+    $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
2377 2377
     $client_id = "&client_id=".get_option('geodir_ga_client_id');
2378 2378
     $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
2379 2379
 
2380
-    $auth_url = $oAuthURL . $code . $redirect_uri .  $grant_type . $client_id .$client_secret;
2380
+    $auth_url = $oAuthURL.$code.$redirect_uri.$grant_type.$client_id.$client_secret;
2381 2381
 
2382 2382
     $response = wp_remote_post($auth_url, array('timeout' => 15));
2383 2383
 
2384 2384
     //print_r($response);
2385 2385
 
2386
-    $error_msg =  __('Something went wrong','geodirectory');
2387
-    if(!empty($response['response']['code']) && $response['response']['code']==200){
2386
+    $error_msg = __('Something went wrong', 'geodirectory');
2387
+    if (!empty($response['response']['code']) && $response['response']['code'] == 200) {
2388 2388
 
2389 2389
         $parts = json_decode($response['body']);
2390 2390
         //print_r($parts);
2391
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2392
-        else{
2391
+        if (!isset($parts->access_token)) {echo $error_msg." - #1"; exit; }
2392
+        else {
2393 2393
 
2394 2394
             update_option('gd_ga_access_token', $parts->access_token);
2395 2395
             update_option('gd_ga_refresh_token', $parts->refresh_token);
@@ -2398,18 +2398,18 @@  discard block
 block discarded – undo
2398 2398
 
2399 2399
 
2400 2400
     }
2401
-    elseif(!empty($response['response']['code'])) {
2401
+    elseif (!empty($response['response']['code'])) {
2402 2402
         $parts = json_decode($response['body']);
2403 2403
 
2404
-        if(isset($parts->error)){
2405
-            echo $parts->error.": ".$parts->error_description;exit;
2406
-        }else{
2407
-            echo $error_msg." - #2";exit;
2404
+        if (isset($parts->error)) {
2405
+            echo $parts->error.": ".$parts->error_description; exit;
2406
+        } else {
2407
+            echo $error_msg." - #2"; exit;
2408 2408
         }
2409 2409
 
2410
-    }else{
2410
+    } else {
2411 2411
 
2412
-        echo $error_msg." - #3";exit;
2412
+        echo $error_msg." - #3"; exit;
2413 2413
 
2414 2414
     }
2415 2415
 }
@@ -2431,7 +2431,7 @@  discard block
 block discarded – undo
2431 2431
 function geodir_uninstall_settings($general_settings) {
2432 2432
     $settings   = array();
2433 2433
     $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
2434
-    $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
2434
+    $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory'));
2435 2435
     
2436 2436
     $plugins    = get_plugins();
2437 2437
     $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
@@ -2443,7 +2443,7 @@  discard block
 block discarded – undo
2443 2443
             if (in_array($plugin_name, $un_plugins)) {
2444 2444
                 $settings[] = array(
2445 2445
                     'type' => 'checkbox',
2446
-                    'id' => 'geodir_un_' . $plugin_name,
2446
+                    'id' => 'geodir_un_'.$plugin_name,
2447 2447
                     'name' => $data['Name'],
2448 2448
                     'desc' => __('Remove all data when deleted?', 'geodirectory'),
2449 2449
                     'std' => '0'
@@ -2477,7 +2477,7 @@  discard block
 block discarded – undo
2477 2477
  * @since 1.6.9
2478 2478
  */
2479 2479
 function geodir_uninstall_settings_desc() {
2480
-    echo '<p class="gd-un-settings-desc">' . __('Select the plugin(s) for which all data should be completely removed when the plugin is deleted.', 'geodirectory') . '</p>';
2480
+    echo '<p class="gd-un-settings-desc">'.__('Select the plugin(s) for which all data should be completely removed when the plugin is deleted.', 'geodirectory').'</p>';
2481 2481
 }
2482 2482
 add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc');
2483 2483
 
@@ -2541,12 +2541,12 @@  discard block
 block discarded – undo
2541 2541
 
2542 2542
 
2543 2543
     if ($delete) {
2544
-            $output_str .= "<li><strong>" . __('Table dropped, refresh page to reinstall.', 'geodirectory') . "</strong></li>";
2544
+            $output_str .= "<li><strong>".__('Table dropped, refresh page to reinstall.', 'geodirectory')."</strong></li>";
2545 2545
         ob_start();
2546 2546
         geodir_diagnose_version_clear();
2547 2547
         ob_end_clean();
2548
-    }else{
2549
-        $output_str .= "<li><strong>" . __('Something went wrong.', 'geodirectory') . "</strong></li>";
2548
+    } else {
2549
+        $output_str .= "<li><strong>".__('Something went wrong.', 'geodirectory')."</strong></li>";
2550 2550
     }
2551 2551
 
2552 2552
     if ($is_error_during_diagnose) {
@@ -2571,9 +2571,9 @@  discard block
 block discarded – undo
2571 2571
  * @param object $row The post|taxonomy object.
2572 2572
  * @return array Filtered actions.
2573 2573
  */
2574
-function geodir_disable_quick_edit( $actions = array(), $row = null ) {
2575
-    if ( isset( $actions['inline hide-if-no-js'] ) ) {
2576
-        unset( $actions['inline hide-if-no-js'] );
2574
+function geodir_disable_quick_edit($actions = array(), $row = null) {
2575
+    if (isset($actions['inline hide-if-no-js'])) {
2576
+        unset($actions['inline hide-if-no-js']);
2577 2577
     }
2578 2578
 
2579 2579
     return $actions;
@@ -2592,26 +2592,26 @@  discard block
 block discarded – undo
2592 2592
 function geodir_check_quick_edit() {
2593 2593
     global $pagenow, $current_screen, $gd_cpt_screen;
2594 2594
 
2595
-    if ( ( $pagenow == 'edit.php' || $pagenow == 'edit-tags.php' ) && !empty( $current_screen->post_type ) ) {
2596
-        if ( empty( $gd_cpt_screen ) ) {
2597
-            if ( in_array( $current_screen->post_type, geodir_get_posttypes() ) ) {
2595
+    if (($pagenow == 'edit.php' || $pagenow == 'edit-tags.php') && !empty($current_screen->post_type)) {
2596
+        if (empty($gd_cpt_screen)) {
2597
+            if (in_array($current_screen->post_type, geodir_get_posttypes())) {
2598 2598
                 $gd_cpt_screen = 'y';
2599 2599
             } else {
2600 2600
                 $gd_cpt_screen = 'n';
2601 2601
             }
2602 2602
         }
2603 2603
 
2604
-        if ( $gd_cpt_screen == 'y' ) {
2605
-            if ( $pagenow == 'edit.php' ) {
2606
-                add_filter( 'post_row_actions', 'geodir_disable_quick_edit', 10, 2 );
2607
-                add_filter( 'page_row_actions', 'geodir_disable_quick_edit', 10, 2 );
2608
-            } elseif ( $pagenow == 'edit-tags.php' && !empty( $current_screen->taxonomy ) ) {
2609
-                add_filter( $current_screen->taxonomy . '_row_actions', 'geodir_disable_quick_edit', 10, 2 );
2604
+        if ($gd_cpt_screen == 'y') {
2605
+            if ($pagenow == 'edit.php') {
2606
+                add_filter('post_row_actions', 'geodir_disable_quick_edit', 10, 2);
2607
+                add_filter('page_row_actions', 'geodir_disable_quick_edit', 10, 2);
2608
+            } elseif ($pagenow == 'edit-tags.php' && !empty($current_screen->taxonomy)) {
2609
+                add_filter($current_screen->taxonomy.'_row_actions', 'geodir_disable_quick_edit', 10, 2);
2610 2610
             }
2611 2611
         }
2612 2612
     }
2613 2613
 }
2614
-add_action( 'admin_head', 'geodir_check_quick_edit', 10 );
2614
+add_action('admin_head', 'geodir_check_quick_edit', 10);
2615 2615
 
2616 2616
 /**
2617 2617
  * Filter the bulk actions for GD CPT.
@@ -2622,9 +2622,9 @@  discard block
 block discarded – undo
2622 2622
  * @param array $actions An array of the available bulk actions.
2623 2623
  * @return array Filtered bulk actions.
2624 2624
  */
2625
-function geodir_filter_bulk_actions( $actions ) {
2626
-    if ( isset( $actions['edit'] ) ) {
2627
-        unset( $actions['edit'] );
2625
+function geodir_filter_bulk_actions($actions) {
2626
+    if (isset($actions['edit'])) {
2627
+        unset($actions['edit']);
2628 2628
     }
2629 2629
     
2630 2630
     return $actions;
@@ -2637,15 +2637,15 @@  discard block
 block discarded – undo
2637 2637
  *
2638 2638
  * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference
2639 2639
  */
2640
-function geodir_admin_bar_menu_set_post( $wp_admin_bar ) {
2640
+function geodir_admin_bar_menu_set_post($wp_admin_bar) {
2641 2641
 	global $post, $gd_admin_bar_post, $pagenow;
2642 2642
 
2643
-	if ( $pagenow == 'post.php' && ! empty( $post ) && is_object( $post ) && ! empty( $post->ID ) && ! is_a( $post, 'WP_Post' ) && isset( $post->post_id ) ) {
2643
+	if ($pagenow == 'post.php' && !empty($post) && is_object($post) && !empty($post->ID) && !is_a($post, 'WP_Post') && isset($post->post_id)) {
2644 2644
 		$gd_admin_bar_post = $post;
2645
-		$post = get_post( $post->ID );
2645
+		$post = get_post($post->ID);
2646 2646
 	}
2647 2647
 }
2648
-add_action( 'admin_bar_menu', 'geodir_admin_bar_menu_set_post', 94, 1 );
2648
+add_action('admin_bar_menu', 'geodir_admin_bar_menu_set_post', 94, 1);
2649 2649
 
2650 2650
 /**
2651 2651
  * Reset $post to original.
@@ -2655,9 +2655,9 @@  discard block
 block discarded – undo
2655 2655
 function geodir_admin_bar_menu_reset_post() {
2656 2656
 	global $post, $gd_admin_bar_post;
2657 2657
 
2658
-	if ( ! empty( $gd_admin_bar_post ) && ! empty( $post ) ) {
2658
+	if (!empty($gd_admin_bar_post) && !empty($post)) {
2659 2659
 		$post = $gd_admin_bar_post;
2660 2660
 		$gd_admin_bar_post = NULL;
2661 2661
 	}
2662 2662
 }
2663
-add_action( 'wp_after_admin_bar_render', 'geodir_admin_bar_menu_reset_post', 9999 );
2664 2663
\ No newline at end of file
2664
+add_action('wp_after_admin_bar_render', 'geodir_admin_bar_menu_reset_post', 9999);
2665 2665
\ No newline at end of file
Please login to merge, or discard this patch.