Test Failed
Push — master ( 5bb710...d46671 )
by Stiofan
22:26
created
geodirectory-admin/admin_hooks_actions.php 1 patch
Spacing   +253 added lines, -253 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 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="fa 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="fa fa-long-arrow-left " aria-hidden="true"></i>
727 727
                         <i class="fa fa-long-arrow-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 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 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="fa 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
     }
@@ -1433,43 +1433,43 @@  discard block
 block discarded – undo
1433 1433
     $output_str = '';
1434 1434
 
1435 1435
     // check review locations
1436
-    if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
1437
-        $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
1436
+    if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
1437
+        $output_str .= "<li>".__('Review locations missing or broken', 'geodirectory')."</li>";
1438 1438
         $is_error_during_diagnose = true;
1439 1439
 
1440 1440
         if ($fix) {
1441 1441
             if (geodir_fix_review_location()) {
1442
-                $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
1442
+                $output_str .= "<li><strong>".__('-->FIXED: Review locations fixed', 'geodirectory')."</strong></li>";
1443 1443
             } else {
1444
-                $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
1444
+                $output_str .= "<li><strong>".__('-->FAILED: Review locations fix failed', 'geodirectory')."</strong></li>";
1445 1445
             }
1446 1446
         }
1447 1447
 
1448 1448
     } else {
1449
-        $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
1449
+        $output_str .= "<li>".__('Review locations ok', 'geodirectory')."</li>";
1450 1450
     }
1451 1451
 
1452 1452
     // check review content
1453
-    if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
1454
-        $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
1453
+    if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_content IS NULL")) {
1454
+        $output_str .= "<li>".__('Review content missing or broken', 'geodirectory')."</li>";
1455 1455
         $is_error_during_diagnose = true;
1456 1456
 
1457 1457
         if ($fix) {
1458 1458
             if (geodir_fix_review_content()) {
1459
-                $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
1459
+                $output_str .= "<li><strong>".__('-->FIXED: Review content fixed', 'geodirectory')."</strong></li>";
1460 1460
             } else {
1461
-                $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
1461
+                $output_str .= "<li><strong>".__('-->FAILED: Review content fix failed', 'geodirectory')."</strong></li>";
1462 1462
             }
1463 1463
         }
1464 1464
 
1465 1465
     } else {
1466
-        $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
1466
+        $output_str .= "<li>".__('Review content ok', 'geodirectory')."</li>";
1467 1467
     }
1468 1468
 
1469 1469
 
1470 1470
     if ($is_error_during_diagnose) {
1471 1471
         $info_div_class = "geodir_problem_info";
1472
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1472
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1473 1473
     } else {
1474 1474
         $info_div_class = "geodir_noproblem_info";
1475 1475
         $fix_button_txt = '';
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
 
1534 1534
     if ($is_error_during_diagnose) {
1535 1535
         $info_div_class = "geodir_problem_info";
1536
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1536
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1537 1537
     } else {
1538 1538
         $info_div_class = "geodir_noproblem_info";
1539 1539
         $fix_button_txt = '';
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
     else {
1568 1568
         $page_found = $wpdb->get_var(
1569 1569
             $wpdb->prepare(
1570
-                "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
1570
+                "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;",
1571 1571
                 array($slug)
1572 1572
             )
1573 1573
         );
@@ -1613,18 +1613,18 @@  discard block
 block discarded – undo
1613 1613
     //////////////////////////////////
1614 1614
     $option_value = get_option('geodir_home_page');
1615 1615
     $page = get_post($option_value);
1616
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1616
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1617 1617
 
1618
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1619
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1618
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1619
+        $output_str .= "<li>".__('GD Home page exists with proper setting.', 'geodirectory')."</li>";
1620 1620
     else {
1621 1621
         $is_error_during_diagnose = true;
1622
-        $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1622
+        $output_str .= "<li><strong>".__('GD Home page is missing.', 'geodirectory')."</strong></li>";
1623 1623
         if ($fix) {
1624 1624
             if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
1625
-                $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
1625
+                $output_str .= "<li><strong>".__('-->FIXED: GD Home page fixed', 'geodirectory')."</strong></li>";
1626 1626
             } else {
1627
-                $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
1627
+                $output_str .= "<li><strong>".__('-->FAILED: GD Home page fix failed', 'geodirectory')."</strong></li>";
1628 1628
             }
1629 1629
         }
1630 1630
     }
@@ -1638,18 +1638,18 @@  discard block
 block discarded – undo
1638 1638
     //////////////////////////////////
1639 1639
     $option_value = get_option('geodir_add_listing_page');
1640 1640
     $page = get_post($option_value);
1641
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1641
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1642 1642
 
1643
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1644
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1643
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1644
+        $output_str .= "<li>".__('Add Listing page exists with proper setting.', 'geodirectory')."</li>";
1645 1645
     else {
1646 1646
         $is_error_during_diagnose = true;
1647
-        $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1647
+        $output_str .= "<li><strong>".__('Add Listing page is missing.', 'geodirectory')."</strong></li>";
1648 1648
         if ($fix) {
1649 1649
             if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
1650
-                $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
1650
+                $output_str .= "<li><strong>".__('-->FIXED: Add Listing page fixed', 'geodirectory')."</strong></li>";
1651 1651
             } else {
1652
-                $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
1652
+                $output_str .= "<li><strong>".__('-->FAILED: Add Listing page fix failed', 'geodirectory')."</strong></li>";
1653 1653
             }
1654 1654
         }
1655 1655
     }
@@ -1664,18 +1664,18 @@  discard block
 block discarded – undo
1664 1664
     //////////////////////////////////
1665 1665
     $option_value = get_option('geodir_preview_page');
1666 1666
     $page = get_post($option_value);
1667
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1667
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1668 1668
 
1669
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1670
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1669
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1670
+        $output_str .= "<li>".__('Listing Preview page exists with proper setting.', 'geodirectory')."</li>";
1671 1671
     else {
1672 1672
         $is_error_during_diagnose = true;
1673
-        $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1673
+        $output_str .= "<li><strong>".__('Listing Preview page is missing.', 'geodirectory')."</strong></li>";
1674 1674
         if ($fix) {
1675 1675
             if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
1676
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
1676
+                $output_str .= "<li><strong>".__('-->FIXED: Listing Preview page fixed', 'geodirectory')."</strong></li>";
1677 1677
             } else {
1678
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
1678
+                $output_str .= "<li><strong>".__('-->FAILED: Listing Preview page fix failed', 'geodirectory')."</strong></li>";
1679 1679
             }
1680 1680
         }
1681 1681
     }
@@ -1689,18 +1689,18 @@  discard block
 block discarded – undo
1689 1689
     //////////////////////////////////
1690 1690
     $option_value = get_option('geodir_success_page');
1691 1691
     $page = get_post($option_value);
1692
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1692
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1693 1693
 
1694
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1695
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1694
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1695
+        $output_str .= "<li>".__('Listing Success page exists with proper setting.', 'geodirectory')."</li>";
1696 1696
     else {
1697 1697
         $is_error_during_diagnose = true;
1698
-        $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1698
+        $output_str .= "<li><strong>".__('Listing Success page is missing.', 'geodirectory')."</strong></li>";
1699 1699
         if ($fix) {
1700 1700
             if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
1701
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
1701
+                $output_str .= "<li><strong>".__('-->FIXED: Listing Success page fixed', 'geodirectory')."</strong></li>";
1702 1702
             } else {
1703
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
1703
+                $output_str .= "<li><strong>".__('-->FAILED: Listing Success page fix failed', 'geodirectory')."</strong></li>";
1704 1704
             }
1705 1705
         }
1706 1706
     }
@@ -1714,18 +1714,18 @@  discard block
 block discarded – undo
1714 1714
     //////////////////////////////////
1715 1715
     $option_value = get_option('geodir_info_page');
1716 1716
     $page = get_post($option_value);
1717
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1717
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1718 1718
 
1719
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1720
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1719
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1720
+        $output_str .= "<li>".__('Info page exists with proper setting.', 'geodirectory')."</li>";
1721 1721
     else {
1722 1722
         $is_error_during_diagnose = true;
1723
-        $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1723
+        $output_str .= "<li><strong>".__('Info page is missing.', 'geodirectory')."</strong></li>";
1724 1724
         if ($fix) {
1725 1725
             if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
1726
-                $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
1726
+                $output_str .= "<li><strong>".__('-->FIXED: Info page fixed', 'geodirectory')."</strong></li>";
1727 1727
             } else {
1728
-                $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
1728
+                $output_str .= "<li><strong>".__('-->FAILED: Info page fix failed', 'geodirectory')."</strong></li>";
1729 1729
             }
1730 1730
         }
1731 1731
     }
@@ -1739,18 +1739,18 @@  discard block
 block discarded – undo
1739 1739
     //////////////////////////////////
1740 1740
     $option_value = get_option('geodir_login_page');
1741 1741
     $page = get_post($option_value);
1742
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1742
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1743 1743
 
1744
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1745
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1744
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1745
+        $output_str .= "<li>".__('Login page exists with proper setting.', 'geodirectory')."</li>";
1746 1746
     else {
1747 1747
         $is_error_during_diagnose = true;
1748
-        $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1748
+        $output_str .= "<li><strong>".__('Login page is missing.', 'geodirectory')."</strong></li>";
1749 1749
         if ($fix) {
1750 1750
             if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
1751
-                $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
1751
+                $output_str .= "<li><strong>".__('-->FIXED: Login page fixed', 'geodirectory')."</strong></li>";
1752 1752
             } else {
1753
-                $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
1753
+                $output_str .= "<li><strong>".__('-->FAILED: Login page fix failed', 'geodirectory')."</strong></li>";
1754 1754
             }
1755 1755
         }
1756 1756
     }
@@ -1764,18 +1764,18 @@  discard block
 block discarded – undo
1764 1764
     //////////////////////////////////
1765 1765
     $option_value = get_option('geodir_location_page');
1766 1766
     $page = get_post($option_value);
1767
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1767
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1768 1768
 
1769
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1770
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1769
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1770
+        $output_str .= "<li>".__('Location page exists with proper setting.', 'geodirectory')."</li>";
1771 1771
     else {
1772 1772
         $is_error_during_diagnose = true;
1773
-        $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1773
+        $output_str .= "<li><strong>".__('Location page is missing.', 'geodirectory')."</strong></li>";
1774 1774
         if ($fix) {
1775 1775
             if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
1776
-                $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
1776
+                $output_str .= "<li><strong>".__('-->FIXED: Location page fixed', 'geodirectory')."</strong></li>";
1777 1777
             } else {
1778
-                $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
1778
+                $output_str .= "<li><strong>".__('-->FAILED: Location page fix failed', 'geodirectory')."</strong></li>";
1779 1779
             }
1780 1780
         }
1781 1781
     }
@@ -1784,13 +1784,13 @@  discard block
 block discarded – undo
1784 1784
     /* Diagnose Location Page Ends */
1785 1785
     ////////////////////////////////
1786 1786
 
1787
-    $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
1787
+    $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose);
1788 1788
     /**
1789 1789
      * This action is called at the end of the GD Tools page check function.
1790 1790
      *
1791 1791
      * @since 1.5.2
1792 1792
      */
1793
-    $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
1793
+    $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr);
1794 1794
 
1795 1795
     $output_str = $page_chk_arr['output_str'];
1796 1796
     $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
             flush_rewrite_rules();
1801 1801
         }
1802 1802
         $info_div_class = "geodir_problem_info";
1803
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1803
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1804 1804
     } else {
1805 1805
         $info_div_class = "geodir_noproblem_info";
1806 1806
         $fix_button_txt = '';
@@ -1828,10 +1828,10 @@  discard block
 block discarded – undo
1828 1828
     $fix_button_txt = '';
1829 1829
 
1830 1830
     if ($is_error_during_diagnose) {
1831
-        $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>";
1831
+        $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>";
1832 1832
 		$info_div_class = "geodir_problem_info";
1833 1833
     } else {
1834
-        $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
1834
+        $output_str .= "<li>".__('Load custom fields in to file for translation: ok', 'geodirectory')."</li>";
1835 1835
 		$info_div_class = "geodir_noproblem_info";
1836 1836
         $fix_button_txt = '';
1837 1837
     }
@@ -1873,17 +1873,17 @@  discard block
 block discarded – undo
1873 1873
     global $wpdb, $wp_query, $plugin_prefix;
1874 1874
 
1875 1875
     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'])) {
1876
-        $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail';
1876
+        $table = $plugin_prefix.$wp_query->query_vars['post_type'].'_detail';
1877 1877
 
1878
-        $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)';
1878
+        $join = $clauses['join'].' INNER JOIN '.$table.' AS gd_posts ON (gd_posts.post_id = '.$wpdb->posts.'.ID)';
1879 1879
         $clauses['join'] = $join;
1880 1880
 
1881
-        $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : '';
1881
+        $fields = $clauses['fields'] != '' ? $clauses['fields'].', ' : '';
1882 1882
         $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';
1883 1883
         $clauses['fields'] = $fields;
1884 1884
 
1885 1885
         $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC';
1886
-        $orderby = 'gd_expire ' . $order;
1886
+        $orderby = 'gd_expire '.$order;
1887 1887
         $clauses['orderby'] = $orderby;
1888 1888
     }
1889 1889
     return $clauses;
@@ -1926,7 +1926,7 @@  discard block
 block discarded – undo
1926 1926
         global $current_user;
1927 1927
         $upload_dir = wp_upload_dir();
1928 1928
 
1929
-        $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv';
1929
+        $file = $upload_dir['path'].'/temp_'.$current_user->data->ID.'/geodir_tmp.csv';
1930 1930
         $handle = fopen($file, 'w');
1931 1931
 
1932 1932
         fwrite($handle, $input);
@@ -1971,7 +1971,7 @@  discard block
 block discarded – undo
1971 1971
     $uploads_dir = $uploads['path'];
1972 1972
     $image_name_arr = explode('/', $filename);
1973 1973
     $filename = end($image_name_arr);
1974
-    $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1974
+    $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;
1975 1975
     $return = array();
1976 1976
     $return['file'] = $uploadedFile;
1977 1977
     $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
@@ -1988,8 +1988,8 @@  discard block
 block discarded – undo
1988 1988
 
1989 1989
                 if (($handle = fopen($target_path, "r")) !== FALSE) {
1990 1990
                     while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
1991
-                        if(is_array($data) && !empty($data)) {
1992
-                            $file[] = '"' . implode('","', $data) . '"';
1991
+                        if (is_array($data) && !empty($data)) {
1992
+                            $file[] = '"'.implode('","', $data).'"';
1993 1993
                         }
1994 1994
                     }
1995 1995
                     fclose($handle);
@@ -2106,10 +2106,10 @@  discard block
 block discarded – undo
2106 2106
                     $tag_arr = explode(',', $post_tags);
2107 2107
                 }
2108 2108
 
2109
-                $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database
2109
+                $table = $plugin_prefix.$buffer[5].'_detail'; // check table in database
2110 2110
 
2111 2111
                 $error = '';
2112
-                if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
2112
+                if ($wpdb->get_var("SHOW TABLES LIKE '".$table."'") != $table) {
2113 2113
                     $invalid_post_type++;
2114 2114
                     continue;
2115 2115
                 }
@@ -2135,7 +2135,7 @@  discard block
 block discarded – undo
2135 2135
                             if ($buffer[$c] != '0' && $buffer[$c] != '') {
2136 2136
                                 $submitdata = date('Y-m-d');
2137 2137
 
2138
-                                $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
2138
+                                $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata."+".addslashes($buffer[$c])." days"));
2139 2139
                             } else {
2140 2140
                                 $gd_post_info['expire_date'] = 'Never';
2141 2141
                             }
@@ -2163,7 +2163,7 @@  discard block
 block discarded – undo
2163 2163
 						
2164 2164
 						// Post status
2165 2165
 						if ($customKeyarray[$c] == 'post_status') {
2166
-                            $post_status = sanitize_key( $buffer[$c] );
2166
+                            $post_status = sanitize_key($buffer[$c]);
2167 2167
                         }
2168 2168
                     }
2169 2169
 
@@ -2181,8 +2181,8 @@  discard block
 block discarded – undo
2181 2181
 					
2182 2182
 					// Default post status
2183 2183
 					$default_status = 'publish';
2184
-					$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
2185
-					$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
2184
+					$post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
2185
+					$post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
2186 2186
 
2187 2187
                     $my_post['post_title'] = $post_title;
2188 2188
                     $my_post['post_content'] = $post_desc;
@@ -2226,7 +2226,7 @@  discard block
 block discarded – undo
2226 2226
                     $payment_info = array();
2227 2227
                     $package_info = array();
2228 2228
 
2229
-                    $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
2229
+                    $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]);
2230 2230
                     $package_id = '';
2231 2231
                     if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
2232 2232
                         $package_id = $gd_post_info['package_id'];
@@ -2236,7 +2236,7 @@  discard block
 block discarded – undo
2236 2236
                         $payment_info['package_id'] = $package_info['pid'];
2237 2237
 
2238 2238
                         if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
2239
-                            $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
2239
+                            $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['alive_days']." days"));
2240 2240
                         } else {
2241 2241
                             $payment_info['expire_date'] = 'Never';
2242 2242
                         }
@@ -2248,7 +2248,7 @@  discard block
 block discarded – undo
2248 2248
 
2249 2249
                     $post_type = get_post_type($last_postid);
2250 2250
 
2251
-                    $table = $plugin_prefix . $post_type . '_detail';
2251
+                    $table = $plugin_prefix.$post_type.'_detail';
2252 2252
 
2253 2253
                     geodir_save_post_info($last_postid, $gd_post_info);
2254 2254
 
@@ -2269,7 +2269,7 @@  discard block
 block discarded – undo
2269 2269
                             $attachment['post_id'] = $last_postid;
2270 2270
                             $attachment['title'] = $img_name_arr[0];
2271 2271
                             $attachment['content'] = '';
2272
-                            $attachment['file'] = $sub_dir . '/' . $image_name;
2272
+                            $attachment['file'] = $sub_dir.'/'.$image_name;
2273 2273
                             $attachment['mime_type'] = $uploaded_file_type;
2274 2274
                             $attachment['menu_order'] = $menu_order;
2275 2275
                             $attachment['is_featured'] = 0;
@@ -2278,15 +2278,15 @@  discard block
 block discarded – undo
2278 2278
 
2279 2279
                             foreach ($attachment as $key => $val) {
2280 2280
                                 if ($val != '')
2281
-                                    $attachment_set .= $key . " = '" . $val . "', ";
2281
+                                    $attachment_set .= $key." = '".$val."', ";
2282 2282
                             }
2283 2283
                             $attachment_set = trim($attachment_set, ", ");
2284 2284
 
2285
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
2285
+                            $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
2286 2286
 
2287 2287
                             if ($menu_order == 1) {
2288 2288
                                 $post_type = get_post_type($last_postid);
2289
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
2289
+                                $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($sub_dir.'/'.$image_name, $last_postid)));
2290 2290
                             }
2291 2291
                             $menu_order++;
2292 2292
                         }
@@ -2327,11 +2327,11 @@  discard block
 block discarded – undo
2327 2327
 }
2328 2328
 
2329 2329
 // Add the tab in left sidebar menu fro import & export page.
2330
-add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 );
2330
+add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94);
2331 2331
 
2332 2332
 // Handle ajax request for import/export.
2333
-add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' );
2334
-add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' );
2333
+add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export');
2334
+add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export');
2335 2335
 
2336 2336
 
2337 2337
 /**
@@ -2342,40 +2342,40 @@  discard block
 block discarded – undo
2342 2342
  * @param $post_id int $post_id The post ID of the post being saved.
2343 2343
  * @param $post object $post The post object of the post being saved.
2344 2344
  */
2345
-function geodir_update_location_prefix($post_id,$post){
2346
-    if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
2347
-        update_option('geodir_location_prefix',$post->post_name);
2345
+function geodir_update_location_prefix($post_id, $post) {
2346
+    if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) {
2347
+        update_option('geodir_location_prefix', $post->post_name);
2348 2348
     }
2349 2349
 
2350 2350
 }
2351 2351
 
2352
-add_action('save_post', 'geodir_update_location_prefix',10,2);
2352
+add_action('save_post', 'geodir_update_location_prefix', 10, 2);
2353 2353
 
2354
-add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' );
2354
+add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback');
2355 2355
 
2356
-function geodir_ga_callback(){
2356
+function geodir_ga_callback() {
2357 2357
 
2358
-if(isset($_REQUEST['code']) && $_REQUEST['code']) {
2358
+if (isset($_REQUEST['code']) && $_REQUEST['code']) {
2359 2359
     $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?";
2360 2360
     $code = "code=".$_REQUEST['code'];
2361 2361
     $grant_type = "&grant_type=authorization_code";
2362
-    $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2362
+    $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
2363 2363
     $client_id = "&client_id=".get_option('geodir_ga_client_id');
2364 2364
     $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
2365 2365
 
2366
-    $auth_url = $oAuthURL . $code . $redirect_uri .  $grant_type . $client_id .$client_secret;
2366
+    $auth_url = $oAuthURL.$code.$redirect_uri.$grant_type.$client_id.$client_secret;
2367 2367
 
2368 2368
     $response = wp_remote_post($auth_url, array('timeout' => 15));
2369 2369
 
2370 2370
     //print_r($response);
2371 2371
 
2372
-    $error_msg =  __('Something went wrong','geodirectory');
2373
-    if(!empty($response['response']['code']) && $response['response']['code']==200){
2372
+    $error_msg = __('Something went wrong', 'geodirectory');
2373
+    if (!empty($response['response']['code']) && $response['response']['code'] == 200) {
2374 2374
 
2375 2375
         $parts = json_decode($response['body']);
2376 2376
         //print_r($parts);
2377
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2378
-        else{
2377
+        if (!isset($parts->access_token)) {echo $error_msg." - #1"; exit; }
2378
+        else {
2379 2379
 
2380 2380
             update_option('gd_ga_access_token', $parts->access_token);
2381 2381
             update_option('gd_ga_refresh_token', $parts->refresh_token);
@@ -2384,18 +2384,18 @@  discard block
 block discarded – undo
2384 2384
 
2385 2385
 
2386 2386
     }
2387
-    elseif(!empty($response['response']['code'])) {
2387
+    elseif (!empty($response['response']['code'])) {
2388 2388
         $parts = json_decode($response['body']);
2389 2389
 
2390
-        if(isset($parts->error)){
2391
-            echo $parts->error.": ".$parts->error_description;exit;
2392
-        }else{
2393
-            echo $error_msg." - #2";exit;
2390
+        if (isset($parts->error)) {
2391
+            echo $parts->error.": ".$parts->error_description; exit;
2392
+        } else {
2393
+            echo $error_msg." - #2"; exit;
2394 2394
         }
2395 2395
 
2396
-    }else{
2396
+    } else {
2397 2397
 
2398
-        echo $error_msg." - #3";exit;
2398
+        echo $error_msg." - #3"; exit;
2399 2399
 
2400 2400
     }
2401 2401
 }
@@ -2417,7 +2417,7 @@  discard block
 block discarded – undo
2417 2417
 function geodir_uninstall_settings($general_settings) {
2418 2418
     $settings   = array();
2419 2419
     $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
2420
-    $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
2420
+    $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory'));
2421 2421
     
2422 2422
     $plugins    = get_plugins();
2423 2423
     $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
@@ -2429,7 +2429,7 @@  discard block
 block discarded – undo
2429 2429
             if (in_array($plugin_name, $un_plugins)) {
2430 2430
                 $settings[] = array(
2431 2431
                     'type' => 'checkbox',
2432
-                    'id' => 'geodir_un_' . $plugin_name,
2432
+                    'id' => 'geodir_un_'.$plugin_name,
2433 2433
                     'name' => $data['Name'],
2434 2434
                     'desc' => __('Remove all data when deleted?', 'geodirectory'),
2435 2435
                     'std' => '0'
@@ -2463,7 +2463,7 @@  discard block
 block discarded – undo
2463 2463
  * @since 1.6.9
2464 2464
  */
2465 2465
 function geodir_uninstall_settings_desc() {
2466
-    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>';
2466
+    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>';
2467 2467
 }
2468 2468
 add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc');
2469 2469
 
@@ -2527,12 +2527,12 @@  discard block
 block discarded – undo
2527 2527
 
2528 2528
 
2529 2529
     if ($delete) {
2530
-            $output_str .= "<li><strong>" . __('Table dropped, refresh page to reinstall.', 'geodirectory') . "</strong></li>";
2530
+            $output_str .= "<li><strong>".__('Table dropped, refresh page to reinstall.', 'geodirectory')."</strong></li>";
2531 2531
         ob_start();
2532 2532
         geodir_diagnose_version_clear();
2533 2533
         ob_end_clean();
2534
-    }else{
2535
-        $output_str .= "<li><strong>" . __('Something went wrong.', 'geodirectory') . "</strong></li>";
2534
+    } else {
2535
+        $output_str .= "<li><strong>".__('Something went wrong.', 'geodirectory')."</strong></li>";
2536 2536
     }
2537 2537
 
2538 2538
     if ($is_error_during_diagnose) {
@@ -2557,9 +2557,9 @@  discard block
 block discarded – undo
2557 2557
  * @param object $row The post|taxonomy object.
2558 2558
  * @return array Filtered actions.
2559 2559
  */
2560
-function geodir_disable_quick_edit( $actions = array(), $row = null ) {
2561
-    if ( isset( $actions['inline hide-if-no-js'] ) ) {
2562
-        unset( $actions['inline hide-if-no-js'] );
2560
+function geodir_disable_quick_edit($actions = array(), $row = null) {
2561
+    if (isset($actions['inline hide-if-no-js'])) {
2562
+        unset($actions['inline hide-if-no-js']);
2563 2563
     }
2564 2564
 
2565 2565
     return $actions;
@@ -2578,26 +2578,26 @@  discard block
 block discarded – undo
2578 2578
 function geodir_check_quick_edit() {
2579 2579
     global $pagenow, $current_screen, $gd_cpt_screen;
2580 2580
 
2581
-    if ( ( $pagenow == 'edit.php' || $pagenow == 'edit-tags.php' ) && !empty( $current_screen->post_type ) ) {
2582
-        if ( empty( $gd_cpt_screen ) ) {
2583
-            if ( in_array( $current_screen->post_type, geodir_get_posttypes() ) ) {
2581
+    if (($pagenow == 'edit.php' || $pagenow == 'edit-tags.php') && !empty($current_screen->post_type)) {
2582
+        if (empty($gd_cpt_screen)) {
2583
+            if (in_array($current_screen->post_type, geodir_get_posttypes())) {
2584 2584
                 $gd_cpt_screen = 'y';
2585 2585
             } else {
2586 2586
                 $gd_cpt_screen = 'n';
2587 2587
             }
2588 2588
         }
2589 2589
 
2590
-        if ( $gd_cpt_screen == 'y' ) {
2591
-            if ( $pagenow == 'edit.php' ) {
2592
-                add_filter( 'post_row_actions', 'geodir_disable_quick_edit', 10, 2 );
2593
-                add_filter( 'page_row_actions', 'geodir_disable_quick_edit', 10, 2 );
2594
-            } elseif ( $pagenow == 'edit-tags.php' && !empty( $current_screen->taxonomy ) ) {
2595
-                add_filter( $current_screen->taxonomy . '_row_actions', 'geodir_disable_quick_edit', 10, 2 );
2590
+        if ($gd_cpt_screen == 'y') {
2591
+            if ($pagenow == 'edit.php') {
2592
+                add_filter('post_row_actions', 'geodir_disable_quick_edit', 10, 2);
2593
+                add_filter('page_row_actions', 'geodir_disable_quick_edit', 10, 2);
2594
+            } elseif ($pagenow == 'edit-tags.php' && !empty($current_screen->taxonomy)) {
2595
+                add_filter($current_screen->taxonomy.'_row_actions', 'geodir_disable_quick_edit', 10, 2);
2596 2596
             }
2597 2597
         }
2598 2598
     }
2599 2599
 }
2600
-add_action( 'admin_head', 'geodir_check_quick_edit', 10 );
2600
+add_action('admin_head', 'geodir_check_quick_edit', 10);
2601 2601
 
2602 2602
 /**
2603 2603
  * Filter the bulk actions for GD CPT.
@@ -2608,9 +2608,9 @@  discard block
 block discarded – undo
2608 2608
  * @param array $actions An array of the available bulk actions.
2609 2609
  * @return array Filtered bulk actions.
2610 2610
  */
2611
-function geodir_filter_bulk_actions( $actions ) {
2612
-    if ( isset( $actions['edit'] ) ) {
2613
-        unset( $actions['edit'] );
2611
+function geodir_filter_bulk_actions($actions) {
2612
+    if (isset($actions['edit'])) {
2613
+        unset($actions['edit']);
2614 2614
     }
2615 2615
     
2616 2616
     return $actions;
@@ -2623,15 +2623,15 @@  discard block
 block discarded – undo
2623 2623
  *
2624 2624
  * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference
2625 2625
  */
2626
-function geodir_admin_bar_menu_set_post( $wp_admin_bar ) {
2626
+function geodir_admin_bar_menu_set_post($wp_admin_bar) {
2627 2627
 	global $post, $gd_admin_bar_post, $pagenow;
2628 2628
 
2629
-	if ( $pagenow == 'post.php' && ! empty( $post ) && is_object( $post ) && ! empty( $post->ID ) && ! is_a( $post, 'WP_Post' ) && isset( $post->post_id ) ) {
2629
+	if ($pagenow == 'post.php' && !empty($post) && is_object($post) && !empty($post->ID) && !is_a($post, 'WP_Post') && isset($post->post_id)) {
2630 2630
 		$gd_admin_bar_post = $post;
2631
-		$post = get_post( $post->ID );
2631
+		$post = get_post($post->ID);
2632 2632
 	}
2633 2633
 }
2634
-add_action( 'admin_bar_menu', 'geodir_admin_bar_menu_set_post', 94, 1 );
2634
+add_action('admin_bar_menu', 'geodir_admin_bar_menu_set_post', 94, 1);
2635 2635
 
2636 2636
 /**
2637 2637
  * Reset $post to original.
@@ -2641,9 +2641,9 @@  discard block
 block discarded – undo
2641 2641
 function geodir_admin_bar_menu_reset_post() {
2642 2642
 	global $post, $gd_admin_bar_post;
2643 2643
 
2644
-	if ( ! empty( $gd_admin_bar_post ) && ! empty( $post ) ) {
2644
+	if (!empty($gd_admin_bar_post) && !empty($post)) {
2645 2645
 		$post = $gd_admin_bar_post;
2646 2646
 		$gd_admin_bar_post = NULL;
2647 2647
 	}
2648 2648
 }
2649
-add_action( 'wp_after_admin_bar_render', 'geodir_admin_bar_menu_reset_post', 9999 );
2650 2649
\ No newline at end of file
2650
+add_action('wp_after_admin_bar_render', 'geodir_admin_bar_menu_reset_post', 9999);
2651 2651
\ No newline at end of file
Please login to merge, or discard this patch.