@@ -62,7 +62,7 @@ discard block |
||
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 |
||
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 | |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | |
229 | 229 | // Filter-Payment-Manager |
230 | 230 | |
231 | - add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side'); |
|
231 | + add_meta_box('geodir_post_images', $post_typename.' '.__('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side'); |
|
232 | 232 | |
233 | - add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high'); |
|
233 | + add_meta_box('geodir_post_info', $post_typename.' '.__('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high'); |
|
234 | 234 | |
235 | 235 | // no need of this box as all fields moved to main information box |
236 | 236 | //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' ); |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | |
240 | 240 | } |
241 | 241 | |
242 | -add_action('save_post', 'geodir_post_information_save',10,2); |
|
242 | +add_action('save_post', 'geodir_post_information_save', 10, 2); |
|
243 | 243 | |
244 | 244 | |
245 | 245 | |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | |
267 | 267 | $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
268 | 268 | |
269 | - if(!empty($gd_taxonomy)) { |
|
269 | + if (!empty($gd_taxonomy)) { |
|
270 | 270 | foreach ($gd_taxonomy as $tax) { |
271 | 271 | |
272 | - remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
272 | + remove_meta_box($tax.'div', $geodir_post_type, 'normal'); |
|
273 | 273 | |
274 | 274 | } |
275 | 275 | } |
@@ -355,14 +355,14 @@ discard block |
||
355 | 355 | add_action('geodir_manage_available_fields_predefined', 'geodir_manage_available_fields_predefined'); |
356 | 356 | add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom'); |
357 | 357 | |
358 | -function geodir_manage_available_fields_predefined($sub_tab){ |
|
359 | - if($sub_tab=='custom_fields'){ |
|
358 | +function geodir_manage_available_fields_predefined($sub_tab) { |
|
359 | + if ($sub_tab == 'custom_fields') { |
|
360 | 360 | geodir_custom_available_fields('predefined'); |
361 | 361 | } |
362 | 362 | } |
363 | 363 | |
364 | -function geodir_manage_available_fields_custom($sub_tab){ |
|
365 | - if($sub_tab=='custom_fields'){ |
|
364 | +function geodir_manage_available_fields_custom($sub_tab) { |
|
365 | + if ($sub_tab == 'custom_fields') { |
|
366 | 366 | geodir_custom_available_fields('custom'); |
367 | 367 | } |
368 | 368 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | global $wpdb; |
433 | 433 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
434 | 434 | ?> |
435 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
435 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
436 | 436 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
437 | 437 | <ul> |
438 | 438 | <?php |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | |
444 | 444 | $check_html_variable = $wpdb->get_var( |
445 | 445 | $wpdb->prepare( |
446 | - "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
446 | + "SELECT htmlvar_name FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
447 | 447 | array($val['htmlvar_name'], $listing_type, $val['field_type']) |
448 | 448 | ) |
449 | 449 | ); |
@@ -451,23 +451,23 @@ discard block |
||
451 | 451 | $display = $check_html_variable ? ' style="display:none;"' : ''; |
452 | 452 | ?> |
453 | 453 | |
454 | - <li class="gd-cf-tooltip-wrap" <?php echo $display;?>> |
|
454 | + <li class="gd-cf-tooltip-wrap" <?php echo $display; ?>> |
|
455 | 455 | <?php |
456 | - if(isset($val['description']) && $val['description']){ |
|
456 | + if (isset($val['description']) && $val['description']) { |
|
457 | 457 | echo '<div class="gdcf-tooltip">'.$val['description'].'</div>'; |
458 | 458 | }?> |
459 | 459 | |
460 | - <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'];?>" |
|
461 | - title="<?php echo $val['site_title'];?>" |
|
462 | - class="gd-draggable-form-items gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);"> |
|
460 | + <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']; ?>" |
|
461 | + title="<?php echo $val['site_title']; ?>" |
|
462 | + class="gd-draggable-form-items gd-<?php echo $val['field_type']; ?> geodir-sort-<?php echo $val['htmlvar_name']; ?>" href="javascript:void(0);"> |
|
463 | 463 | <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) { |
464 | 464 | echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>'; |
465 | - }elseif(isset($val['field_icon']) && $val['field_icon'] ){ |
|
465 | + }elseif (isset($val['field_icon']) && $val['field_icon']) { |
|
466 | 466 | echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>'; |
467 | - }else{ |
|
467 | + } else { |
|
468 | 468 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
469 | 469 | }?> |
470 | - <?php echo $val['site_title'];?> |
|
470 | + <?php echo $val['site_title']; ?> |
|
471 | 471 | </a> |
472 | 472 | </li> |
473 | 473 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | <?php |
496 | 496 | global $wpdb; |
497 | 497 | |
498 | - $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))); |
|
498 | + $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))); |
|
499 | 499 | |
500 | 500 | if (!empty($fields)) { |
501 | 501 | foreach ($fields as $field) { |
@@ -520,14 +520,14 @@ discard block |
||
520 | 520 | * @since 1.6.9 |
521 | 521 | * @package GeoDirectory |
522 | 522 | */ |
523 | -function geodir_custom_fields_custom($post_type=''){ |
|
523 | +function geodir_custom_fields_custom($post_type = '') { |
|
524 | 524 | |
525 | 525 | $custom_fields = array(); |
526 | 526 | |
527 | 527 | /** |
528 | 528 | * @see `geodir_custom_fields` |
529 | 529 | */ |
530 | - return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type); |
|
530 | + return apply_filters('geodir_custom_fields_custom', $custom_fields, $post_type); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | * @since 1.6.6 |
539 | 539 | * @package GeoDirectory |
540 | 540 | */ |
541 | -function geodir_custom_fields($post_type=''){ |
|
541 | +function geodir_custom_fields($post_type = '') { |
|
542 | 542 | |
543 | 543 | $custom_fields = array( |
544 | 544 | 'text' => array( |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | * } |
674 | 674 | * @param string $post_type The post type requested. |
675 | 675 | */ |
676 | - return apply_filters('geodir_custom_fields',$custom_fields,$post_type); |
|
676 | + return apply_filters('geodir_custom_fields', $custom_fields, $post_type); |
|
677 | 677 | } |
678 | 678 | |
679 | 679 | /** |
@@ -684,25 +684,25 @@ discard block |
||
684 | 684 | * @param string $type The custom field type, predefined, custom or blank for default |
685 | 685 | * @package GeoDirectory |
686 | 686 | */ |
687 | -function geodir_custom_available_fields($type='') |
|
687 | +function geodir_custom_available_fields($type = '') |
|
688 | 688 | { |
689 | 689 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
690 | 690 | ?> |
691 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
691 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
692 | 692 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" /> |
693 | 693 | |
694 | 694 | <?php |
695 | - if($type=='predefined'){ |
|
695 | + if ($type == 'predefined') { |
|
696 | 696 | $cfs = geodir_custom_fields_predefined($listing_type); |
697 | - }elseif($type=='custom'){ |
|
697 | + }elseif ($type == 'custom') { |
|
698 | 698 | $cfs = geodir_custom_fields_custom($listing_type); |
699 | - }else{ |
|
699 | + } else { |
|
700 | 700 | $cfs = geodir_custom_fields($listing_type); |
701 | 701 | ?> |
702 | 702 | <ul class="full gd-cf-tooltip-wrap"> |
703 | 703 | <li> |
704 | 704 | <div class="gdcf-tooltip"> |
705 | - <?php _e('This adds a section separator with a title.', 'geodirectory');?> |
|
705 | + <?php _e('This adds a section separator with a title.', 'geodirectory'); ?> |
|
706 | 706 | </div> |
707 | 707 | <a id="gt-fieldset" |
708 | 708 | class="gd-draggable-form-items gt-fieldset" |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | |
714 | 714 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
715 | 715 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
716 | - <?php _e('Fieldset (section separator)', 'geodirectory');?> |
|
716 | + <?php _e('Fieldset (section separator)', 'geodirectory'); ?> |
|
717 | 717 | </a> |
718 | 718 | </li> |
719 | 719 | </ul> |
@@ -721,15 +721,15 @@ discard block |
||
721 | 721 | <?php |
722 | 722 | } |
723 | 723 | |
724 | - if(!empty($cfs)) { |
|
724 | + if (!empty($cfs)) { |
|
725 | 725 | |
726 | - foreach ( $cfs as $id => $cf ) { |
|
726 | + foreach ($cfs as $id => $cf) { |
|
727 | 727 | ?> |
728 | 728 | <ul> |
729 | 729 | <li class="gd-cf-tooltip-wrap"> |
730 | 730 | <?php |
731 | - if ( isset( $cf['description'] ) && $cf['description'] ) { |
|
732 | - echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>'; |
|
731 | + if (isset($cf['description']) && $cf['description']) { |
|
732 | + echo '<div class="gdcf-tooltip">'.$cf['description'].'</div>'; |
|
733 | 733 | } ?> |
734 | 734 | |
735 | 735 | <a id="gd-<?php echo $id; ?>" |
@@ -739,10 +739,10 @@ discard block |
||
739 | 739 | class="gd-draggable-form-items <?php echo $cf['class']; ?>" |
740 | 740 | href="javascript:void(0);"> |
741 | 741 | |
742 | - <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], 'fa fa-' ) !== false ) { |
|
743 | - echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>'; |
|
744 | - } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) { |
|
745 | - echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>'; |
|
742 | + <?php if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) { |
|
743 | + echo '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
744 | + } elseif (isset($cf['icon']) && $cf['icon']) { |
|
745 | + echo '<b style="background-image: url("'.$cf['icon'].'")"></b>'; |
|
746 | 746 | } else { |
747 | 747 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
748 | 748 | } ?> |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | </li> |
752 | 752 | <?php |
753 | 753 | } |
754 | - }else{ |
|
754 | + } else { |
|
755 | 755 | _e('There are no custom fields here yet.', 'geodirectory'); |
756 | 756 | } |
757 | 757 | ?> |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | <ul class="core"> |
780 | 780 | <?php |
781 | 781 | global $wpdb; |
782 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type))); |
|
782 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type))); |
|
783 | 783 | |
784 | 784 | if (!empty($fields)) { |
785 | 785 | foreach ($fields as $field) { |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | $field_type_key = $field->field_type_key; |
790 | 790 | $field_ins_upd = 'display'; |
791 | 791 | |
792 | - geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key); |
|
792 | + geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd, $field_type_key); |
|
793 | 793 | } |
794 | 794 | } |
795 | 795 | ?></ul> |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | |
868 | 868 | switch ($sub_tab) { |
869 | 869 | case 'custom_fields': |
870 | - $note = sprintf(__('Click on any box below to add a field of that type to the add %s listing form. You can use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));; |
|
870 | + $note = sprintf(__('Click on any box below to add a field of that type to the add %s listing form. You can use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type)); ; |
|
871 | 871 | break; |
872 | 872 | |
873 | 873 | case 'sorting_options': |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | |
922 | 922 | switch ($sub_tab) { |
923 | 923 | case 'custom_fields': |
924 | - $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));; |
|
924 | + $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type)); ; |
|
925 | 925 | break; |
926 | 926 | |
927 | 927 | case 'sorting_options': |
@@ -948,8 +948,8 @@ discard block |
||
948 | 948 | |
949 | 949 | if (!get_option('geodir_remove_unnecessary_fields')) { |
950 | 950 | |
951 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) |
|
952 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`"); |
|
951 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$plugin_prefix."gd_place_detail WHERE field = 'categories'")) |
|
952 | + $wpdb->query("ALTER TABLE `".$plugin_prefix."gd_place_detail` DROP `categories`"); |
|
953 | 953 | |
954 | 954 | update_option('geodir_remove_unnecessary_fields', '1'); |
955 | 955 | |
@@ -977,14 +977,14 @@ discard block |
||
977 | 977 | case 'diagnosis' : |
978 | 978 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
979 | 979 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
980 | - call_user_func('geodir_diagnose_' . $diagnose_this); |
|
980 | + call_user_func('geodir_diagnose_'.$diagnose_this); |
|
981 | 981 | exit(); |
982 | 982 | break; |
983 | 983 | |
984 | 984 | case 'diagnosis-fix' : |
985 | 985 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
986 | 986 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
987 | - call_user_func('geodir_diagnose_' . $diagnose_this); |
|
987 | + call_user_func('geodir_diagnose_'.$diagnose_this); |
|
988 | 988 | exit(); |
989 | 989 | break; |
990 | 990 | } |
@@ -1009,50 +1009,50 @@ discard block |
||
1009 | 1009 | { |
1010 | 1010 | global $wpdb; |
1011 | 1011 | //$filter_arr['output_str'] .='###'.$table.'###'; |
1012 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) { |
|
1013 | - $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>"; |
|
1012 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0) { |
|
1013 | + $filter_arr['output_str'] .= "<li>".__('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory')."</li>"; |
|
1014 | 1014 | $filter_arr['is_error_during_diagnose'] = true; |
1015 | 1015 | |
1016 | - } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) { |
|
1017 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>"; |
|
1016 | + } elseif ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) { |
|
1017 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name)."</li>"; |
|
1018 | 1018 | $filter_arr['is_error_during_diagnose'] = true; |
1019 | - $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>"; |
|
1019 | + $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>"; |
|
1020 | 1020 | $filter_arr['is_error_during_diagnose'] = true; |
1021 | 1021 | |
1022 | 1022 | if ($fix) { |
1023 | - $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count |
|
1024 | - $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count |
|
1023 | + $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$table."_ms_bak"); // get backup table count |
|
1024 | + $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table"); // get new table count |
|
1025 | 1025 | |
1026 | 1026 | if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2 |
1027 | 1027 | //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ; |
1028 | 1028 | |
1029 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table |
|
1029 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename bak table to new table |
|
1030 | 1030 | |
1031 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) { |
|
1032 | - $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>"; |
|
1031 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) { |
|
1032 | + $filter_arr['output_str'] .= "<li>".__('-->FIXED: Renamed and backed up the tables', 'geodirectory')."</li>"; |
|
1033 | 1033 | } else { |
1034 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
1034 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>"; |
|
1035 | 1035 | } |
1036 | 1036 | |
1037 | 1037 | } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it |
1038 | 1038 | |
1039 | - $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2 |
|
1040 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table |
|
1039 | + $wpdb->query("RENAME TABLE ".$wpdb->prefix."$table TO ".$table."_ms_bak2"); // rename new table to bak2 |
|
1040 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$wpdb->prefix."$table"); // rename bak table to new table |
|
1041 | 1041 | |
1042 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1043 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>"; |
|
1042 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1043 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table)."</li>"; |
|
1044 | 1044 | } else { |
1045 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
1045 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>"; |
|
1046 | 1046 | } |
1047 | 1047 | |
1048 | 1048 | } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors |
1049 | 1049 | |
1050 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2 |
|
1050 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename ms_bak table to ms_bak2 |
|
1051 | 1051 | |
1052 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) { |
|
1053 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>"; |
|
1052 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) { |
|
1053 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table)."</li>"; |
|
1054 | 1054 | } else { |
1055 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
1055 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>"; |
|
1056 | 1056 | } |
1057 | 1057 | |
1058 | 1058 | } |
@@ -1060,54 +1060,54 @@ discard block |
||
1060 | 1060 | } |
1061 | 1061 | |
1062 | 1062 | |
1063 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) { |
|
1064 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>"; |
|
1063 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) { |
|
1064 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name)."</li>"; |
|
1065 | 1065 | $filter_arr['is_error_during_diagnose'] = true; |
1066 | 1066 | |
1067 | 1067 | if ($fix) { |
1068 | 1068 | if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it |
1069 | 1069 | if ($wpdb->query("DROP TABLE IF EXISTS $table")) { |
1070 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>"; |
|
1070 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table)."</li>"; |
|
1071 | 1071 | } else { |
1072 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>"; |
|
1072 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table)."</li>"; |
|
1073 | 1073 | } |
1074 | 1074 | |
1075 | - } 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 |
|
1076 | - if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) { |
|
1077 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>"; |
|
1075 | + } 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 |
|
1076 | + if ($wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."$table")) { |
|
1077 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix.$table)."</li>"; |
|
1078 | 1078 | } else { |
1079 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>"; |
|
1079 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix.$table)."</li>"; |
|
1080 | 1080 | } |
1081 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1082 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
1081 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1082 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>"; |
|
1083 | 1083 | } else { |
1084 | - $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>"; |
|
1084 | + $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>"; |
|
1085 | 1085 | } |
1086 | 1086 | } else {// else rename the original table to _ms_bak |
1087 | - if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1088 | - $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>"; |
|
1087 | + if ($wpdb->query("RENAME TABLE $table TO ".$table."_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1088 | + $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>"; |
|
1089 | 1089 | } else { |
1090 | - $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>"; |
|
1090 | + $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>"; |
|
1091 | 1091 | } |
1092 | 1092 | } |
1093 | 1093 | } |
1094 | 1094 | |
1095 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) { |
|
1096 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>"; |
|
1095 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) { |
|
1096 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name)."</li>"; |
|
1097 | 1097 | $filter_arr['is_error_during_diagnose'] = true; |
1098 | 1098 | |
1099 | 1099 | if ($fix) { |
1100 | 1100 | // if original table exists but new does not, rename |
1101 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1102 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
1101 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1102 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>"; |
|
1103 | 1103 | } else { |
1104 | - $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>"; |
|
1104 | + $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>"; |
|
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | } |
1108 | 1108 | |
1109 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) { |
|
1110 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>"; |
|
1109 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) { |
|
1110 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name)."</li>"; |
|
1111 | 1111 | $filter_arr['is_error_during_diagnose'] = true; |
1112 | 1112 | |
1113 | 1113 | if ($fix) { |
@@ -1121,11 +1121,11 @@ discard block |
||
1121 | 1121 | delete_option('geodir_custom_posts_db_version'); |
1122 | 1122 | delete_option('geodir_reviewratings_db_version'); |
1123 | 1123 | delete_option('geodiradvancesearch_db_version'); |
1124 | - $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>"; |
|
1124 | + $filter_arr['output_str'] .= "<li>".__('-->TRY: Please refresh page to run table install functions', 'geodirectory')."</li>"; |
|
1125 | 1125 | } |
1126 | 1126 | |
1127 | 1127 | } else { |
1128 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>"; |
|
1128 | + $filter_arr['output_str'] .= "<li>".sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name)."</li>"; |
|
1129 | 1129 | } |
1130 | 1130 | return $filter_arr; |
1131 | 1131 | } |
@@ -1154,23 +1154,23 @@ discard block |
||
1154 | 1154 | if (!empty($all_postypes)) { |
1155 | 1155 | foreach ($all_postypes as $key) { |
1156 | 1156 | // update each GD CPT |
1157 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d"); |
|
1157 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d"); |
|
1158 | 1158 | |
1159 | 1159 | if (!empty($posts)) { |
1160 | 1160 | |
1161 | 1161 | foreach ($posts as $p) { |
1162 | 1162 | $p->post_type = $key; |
1163 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names')); |
|
1163 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names')); |
|
1164 | 1164 | if (empty($raw_tags)) { |
1165 | 1165 | $post_tags = ''; |
1166 | 1166 | } else { |
1167 | 1167 | $post_tags = implode(",", $raw_tags); |
1168 | 1168 | } |
1169 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
1170 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id)); |
|
1169 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
1170 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id)); |
|
1171 | 1171 | |
1172 | 1172 | } |
1173 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>"; |
|
1173 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>"; |
|
1174 | 1174 | } |
1175 | 1175 | |
1176 | 1176 | } |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | |
1180 | 1180 | if ($is_error_during_diagnose) { |
1181 | 1181 | $info_div_class = "geodir_problem_info"; |
1182 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1182 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1183 | 1183 | } else { |
1184 | 1184 | $info_div_class = "geodir_noproblem_info"; |
1185 | 1185 | $fix_button_txt = ''; |
@@ -1216,29 +1216,29 @@ discard block |
||
1216 | 1216 | if (!empty($all_postypes)) { |
1217 | 1217 | foreach ($all_postypes as $key) { |
1218 | 1218 | // update each GD CTP |
1219 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' "); |
|
1219 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d WHERE d.".$key."category='' "); |
|
1220 | 1220 | |
1221 | 1221 | if (!empty($posts)) { |
1222 | 1222 | |
1223 | 1223 | foreach ($posts as $p) { |
1224 | 1224 | $p->post_type = $key; |
1225 | - $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids')); |
|
1225 | + $raw_cats = wp_get_object_terms($p->post_id, $p->post_type.'category', array('fields' => 'ids')); |
|
1226 | 1226 | |
1227 | 1227 | if (empty($raw_cats)) { |
1228 | 1228 | $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
1229 | 1229 | |
1230 | - if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) { |
|
1231 | - $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']); |
|
1232 | - foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) { |
|
1230 | + if (!empty($post_categories) && !empty($post_categories[$p->post_type.'category'])) { |
|
1231 | + $post_categories[$p->post_type.'category'] = str_replace("d:", "", $post_categories[$p->post_type.'category']); |
|
1232 | + foreach (explode(",", $post_categories[$p->post_type.'category']) as $cat_part) { |
|
1233 | 1233 | if (is_numeric($cat_part)) { |
1234 | - $raw_cats[] = (int)$cat_part; |
|
1234 | + $raw_cats[] = (int) $cat_part; |
|
1235 | 1235 | } |
1236 | 1236 | } |
1237 | 1237 | |
1238 | 1238 | } |
1239 | 1239 | |
1240 | 1240 | if (!empty($raw_cats)) { |
1241 | - $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
1241 | + $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type.'category'); |
|
1242 | 1242 | |
1243 | 1243 | } |
1244 | 1244 | |
@@ -1248,14 +1248,14 @@ discard block |
||
1248 | 1248 | if (empty($raw_cats)) { |
1249 | 1249 | $post_cats = ''; |
1250 | 1250 | } else { |
1251 | - $post_cats = ',' . implode(",", $raw_cats) . ','; |
|
1251 | + $post_cats = ','.implode(",", $raw_cats).','; |
|
1252 | 1252 | } |
1253 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
1254 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id)); |
|
1253 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
1254 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET ".$p->post_type."category=%s WHERE post_id =%d", $post_cats, $p->post_id)); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | } |
1258 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>"; |
|
1258 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>"; |
|
1259 | 1259 | |
1260 | 1260 | } |
1261 | 1261 | |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | |
1264 | 1264 | if ($is_error_during_diagnose) { |
1265 | 1265 | $info_div_class = "geodir_problem_info"; |
1266 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1266 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1267 | 1267 | } else { |
1268 | 1268 | $info_div_class = "geodir_noproblem_info"; |
1269 | 1269 | $fix_button_txt = ''; |
@@ -1316,15 +1316,15 @@ discard block |
||
1316 | 1316 | if (!empty($ver_arr)) { |
1317 | 1317 | foreach ($ver_arr as $key => $val) { |
1318 | 1318 | if (delete_option($val)) { |
1319 | - $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>"; |
|
1319 | + $output_str .= "<li>".$key.__(' Version: Deleted', 'geodirectory')."</li>"; |
|
1320 | 1320 | } else { |
1321 | - $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>"; |
|
1321 | + $output_str .= "<li>".$key.__(' Version: Not Found', 'geodirectory')."</li>"; |
|
1322 | 1322 | } |
1323 | 1323 | |
1324 | 1324 | } |
1325 | 1325 | |
1326 | 1326 | if ($output_str) { |
1327 | - $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>"; |
|
1327 | + $output_str .= "<li><strong>".__(' Upgrade/install scripts will run on next page reload.', 'geodirectory')."</strong></li>"; |
|
1328 | 1328 | } |
1329 | 1329 | |
1330 | 1330 | } |
@@ -1361,43 +1361,43 @@ discard block |
||
1361 | 1361 | $output_str = ''; |
1362 | 1362 | |
1363 | 1363 | // check review locations |
1364 | - 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")) { |
|
1365 | - $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>"; |
|
1364 | + 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")) { |
|
1365 | + $output_str .= "<li>".__('Review locations missing or broken', 'geodirectory')."</li>"; |
|
1366 | 1366 | $is_error_during_diagnose = true; |
1367 | 1367 | |
1368 | 1368 | if ($fix) { |
1369 | 1369 | if (geodir_fix_review_location()) { |
1370 | - $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>"; |
|
1370 | + $output_str .= "<li><strong>".__('-->FIXED: Review locations fixed', 'geodirectory')."</strong></li>"; |
|
1371 | 1371 | } else { |
1372 | - $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>"; |
|
1372 | + $output_str .= "<li><strong>".__('-->FAILED: Review locations fix failed', 'geodirectory')."</strong></li>"; |
|
1373 | 1373 | } |
1374 | 1374 | } |
1375 | 1375 | |
1376 | 1376 | } else { |
1377 | - $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>"; |
|
1377 | + $output_str .= "<li>".__('Review locations ok', 'geodirectory')."</li>"; |
|
1378 | 1378 | } |
1379 | 1379 | |
1380 | 1380 | // check review content |
1381 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) { |
|
1382 | - $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>"; |
|
1381 | + if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_content IS NULL")) { |
|
1382 | + $output_str .= "<li>".__('Review content missing or broken', 'geodirectory')."</li>"; |
|
1383 | 1383 | $is_error_during_diagnose = true; |
1384 | 1384 | |
1385 | 1385 | if ($fix) { |
1386 | 1386 | if (geodir_fix_review_content()) { |
1387 | - $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>"; |
|
1387 | + $output_str .= "<li><strong>".__('-->FIXED: Review content fixed', 'geodirectory')."</strong></li>"; |
|
1388 | 1388 | } else { |
1389 | - $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>"; |
|
1389 | + $output_str .= "<li><strong>".__('-->FAILED: Review content fix failed', 'geodirectory')."</strong></li>"; |
|
1390 | 1390 | } |
1391 | 1391 | } |
1392 | 1392 | |
1393 | 1393 | } else { |
1394 | - $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>"; |
|
1394 | + $output_str .= "<li>".__('Review content ok', 'geodirectory')."</li>"; |
|
1395 | 1395 | } |
1396 | 1396 | |
1397 | 1397 | |
1398 | 1398 | if ($is_error_during_diagnose) { |
1399 | 1399 | $info_div_class = "geodir_problem_info"; |
1400 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1400 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1401 | 1401 | } else { |
1402 | 1402 | $info_div_class = "geodir_noproblem_info"; |
1403 | 1403 | $fix_button_txt = ''; |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | |
1462 | 1462 | if ($is_error_during_diagnose) { |
1463 | 1463 | $info_div_class = "geodir_problem_info"; |
1464 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />"; |
|
1464 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />"; |
|
1465 | 1465 | } else { |
1466 | 1466 | $info_div_class = "geodir_noproblem_info"; |
1467 | 1467 | $fix_button_txt = ''; |
@@ -1495,7 +1495,7 @@ discard block |
||
1495 | 1495 | else { |
1496 | 1496 | $page_found = $wpdb->get_var( |
1497 | 1497 | $wpdb->prepare( |
1498 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
1498 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;", |
|
1499 | 1499 | array($slug) |
1500 | 1500 | ) |
1501 | 1501 | ); |
@@ -1541,18 +1541,18 @@ discard block |
||
1541 | 1541 | ////////////////////////////////// |
1542 | 1542 | $option_value = get_option('geodir_home_page'); |
1543 | 1543 | $page = get_post($option_value); |
1544 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1544 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1545 | 1545 | |
1546 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1547 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1546 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1547 | + $output_str .= "<li>".__('GD Home page exists with proper setting.', 'geodirectory')."</li>"; |
|
1548 | 1548 | else { |
1549 | 1549 | $is_error_during_diagnose = true; |
1550 | - $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>"; |
|
1550 | + $output_str .= "<li><strong>".__('GD Home page is missing.', 'geodirectory')."</strong></li>"; |
|
1551 | 1551 | if ($fix) { |
1552 | 1552 | if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) { |
1553 | - $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>"; |
|
1553 | + $output_str .= "<li><strong>".__('-->FIXED: GD Home page fixed', 'geodirectory')."</strong></li>"; |
|
1554 | 1554 | } else { |
1555 | - $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>"; |
|
1555 | + $output_str .= "<li><strong>".__('-->FAILED: GD Home page fix failed', 'geodirectory')."</strong></li>"; |
|
1556 | 1556 | } |
1557 | 1557 | } |
1558 | 1558 | } |
@@ -1566,18 +1566,18 @@ discard block |
||
1566 | 1566 | ////////////////////////////////// |
1567 | 1567 | $option_value = get_option('geodir_add_listing_page'); |
1568 | 1568 | $page = get_post($option_value); |
1569 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1569 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1570 | 1570 | |
1571 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1572 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1571 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1572 | + $output_str .= "<li>".__('Add Listing page exists with proper setting.', 'geodirectory')."</li>"; |
|
1573 | 1573 | else { |
1574 | 1574 | $is_error_during_diagnose = true; |
1575 | - $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>"; |
|
1575 | + $output_str .= "<li><strong>".__('Add Listing page is missing.', 'geodirectory')."</strong></li>"; |
|
1576 | 1576 | if ($fix) { |
1577 | 1577 | if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) { |
1578 | - $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>"; |
|
1578 | + $output_str .= "<li><strong>".__('-->FIXED: Add Listing page fixed', 'geodirectory')."</strong></li>"; |
|
1579 | 1579 | } else { |
1580 | - $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>"; |
|
1580 | + $output_str .= "<li><strong>".__('-->FAILED: Add Listing page fix failed', 'geodirectory')."</strong></li>"; |
|
1581 | 1581 | } |
1582 | 1582 | } |
1583 | 1583 | } |
@@ -1592,18 +1592,18 @@ discard block |
||
1592 | 1592 | ////////////////////////////////// |
1593 | 1593 | $option_value = get_option('geodir_preview_page'); |
1594 | 1594 | $page = get_post($option_value); |
1595 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1595 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1596 | 1596 | |
1597 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1598 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1597 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1598 | + $output_str .= "<li>".__('Listing Preview page exists with proper setting.', 'geodirectory')."</li>"; |
|
1599 | 1599 | else { |
1600 | 1600 | $is_error_during_diagnose = true; |
1601 | - $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>"; |
|
1601 | + $output_str .= "<li><strong>".__('Listing Preview page is missing.', 'geodirectory')."</strong></li>"; |
|
1602 | 1602 | if ($fix) { |
1603 | 1603 | if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) { |
1604 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>"; |
|
1604 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Preview page fixed', 'geodirectory')."</strong></li>"; |
|
1605 | 1605 | } else { |
1606 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>"; |
|
1606 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Preview page fix failed', 'geodirectory')."</strong></li>"; |
|
1607 | 1607 | } |
1608 | 1608 | } |
1609 | 1609 | } |
@@ -1617,18 +1617,18 @@ discard block |
||
1617 | 1617 | ////////////////////////////////// |
1618 | 1618 | $option_value = get_option('geodir_success_page'); |
1619 | 1619 | $page = get_post($option_value); |
1620 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1620 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1621 | 1621 | |
1622 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1623 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1622 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1623 | + $output_str .= "<li>".__('Listing Success page exists with proper setting.', 'geodirectory')."</li>"; |
|
1624 | 1624 | else { |
1625 | 1625 | $is_error_during_diagnose = true; |
1626 | - $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>"; |
|
1626 | + $output_str .= "<li><strong>".__('Listing Success page is missing.', 'geodirectory')."</strong></li>"; |
|
1627 | 1627 | if ($fix) { |
1628 | 1628 | if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) { |
1629 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>"; |
|
1629 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Success page fixed', 'geodirectory')."</strong></li>"; |
|
1630 | 1630 | } else { |
1631 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>"; |
|
1631 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Success page fix failed', 'geodirectory')."</strong></li>"; |
|
1632 | 1632 | } |
1633 | 1633 | } |
1634 | 1634 | } |
@@ -1642,18 +1642,18 @@ discard block |
||
1642 | 1642 | ////////////////////////////////// |
1643 | 1643 | $option_value = get_option('geodir_info_page'); |
1644 | 1644 | $page = get_post($option_value); |
1645 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1645 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1646 | 1646 | |
1647 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1648 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1647 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1648 | + $output_str .= "<li>".__('Info page exists with proper setting.', 'geodirectory')."</li>"; |
|
1649 | 1649 | else { |
1650 | 1650 | $is_error_during_diagnose = true; |
1651 | - $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>"; |
|
1651 | + $output_str .= "<li><strong>".__('Info page is missing.', 'geodirectory')."</strong></li>"; |
|
1652 | 1652 | if ($fix) { |
1653 | 1653 | if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) { |
1654 | - $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>"; |
|
1654 | + $output_str .= "<li><strong>".__('-->FIXED: Info page fixed', 'geodirectory')."</strong></li>"; |
|
1655 | 1655 | } else { |
1656 | - $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>"; |
|
1656 | + $output_str .= "<li><strong>".__('-->FAILED: Info page fix failed', 'geodirectory')."</strong></li>"; |
|
1657 | 1657 | } |
1658 | 1658 | } |
1659 | 1659 | } |
@@ -1667,18 +1667,18 @@ discard block |
||
1667 | 1667 | ////////////////////////////////// |
1668 | 1668 | $option_value = get_option('geodir_login_page'); |
1669 | 1669 | $page = get_post($option_value); |
1670 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1670 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1671 | 1671 | |
1672 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1673 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1672 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1673 | + $output_str .= "<li>".__('Login page exists with proper setting.', 'geodirectory')."</li>"; |
|
1674 | 1674 | else { |
1675 | 1675 | $is_error_during_diagnose = true; |
1676 | - $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>"; |
|
1676 | + $output_str .= "<li><strong>".__('Login page is missing.', 'geodirectory')."</strong></li>"; |
|
1677 | 1677 | if ($fix) { |
1678 | 1678 | if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) { |
1679 | - $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>"; |
|
1679 | + $output_str .= "<li><strong>".__('-->FIXED: Login page fixed', 'geodirectory')."</strong></li>"; |
|
1680 | 1680 | } else { |
1681 | - $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>"; |
|
1681 | + $output_str .= "<li><strong>".__('-->FAILED: Login page fix failed', 'geodirectory')."</strong></li>"; |
|
1682 | 1682 | } |
1683 | 1683 | } |
1684 | 1684 | } |
@@ -1692,18 +1692,18 @@ discard block |
||
1692 | 1692 | ////////////////////////////////// |
1693 | 1693 | $option_value = get_option('geodir_location_page'); |
1694 | 1694 | $page = get_post($option_value); |
1695 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1695 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1696 | 1696 | |
1697 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1698 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1697 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1698 | + $output_str .= "<li>".__('Location page exists with proper setting.', 'geodirectory')."</li>"; |
|
1699 | 1699 | else { |
1700 | 1700 | $is_error_during_diagnose = true; |
1701 | - $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>"; |
|
1701 | + $output_str .= "<li><strong>".__('Location page is missing.', 'geodirectory')."</strong></li>"; |
|
1702 | 1702 | if ($fix) { |
1703 | 1703 | if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) { |
1704 | - $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>"; |
|
1704 | + $output_str .= "<li><strong>".__('-->FIXED: Location page fixed', 'geodirectory')."</strong></li>"; |
|
1705 | 1705 | } else { |
1706 | - $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>"; |
|
1706 | + $output_str .= "<li><strong>".__('-->FAILED: Location page fix failed', 'geodirectory')."</strong></li>"; |
|
1707 | 1707 | } |
1708 | 1708 | } |
1709 | 1709 | } |
@@ -1712,13 +1712,13 @@ discard block |
||
1712 | 1712 | /* Diagnose Location Page Ends */ |
1713 | 1713 | //////////////////////////////// |
1714 | 1714 | |
1715 | - $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose ); |
|
1715 | + $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose); |
|
1716 | 1716 | /** |
1717 | 1717 | * This action is called at the end of the GD Tools page check function. |
1718 | 1718 | * |
1719 | 1719 | * @since 1.5.2 |
1720 | 1720 | */ |
1721 | - $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr); |
|
1721 | + $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr); |
|
1722 | 1722 | |
1723 | 1723 | $output_str = $page_chk_arr['output_str']; |
1724 | 1724 | $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
@@ -1728,7 +1728,7 @@ discard block |
||
1728 | 1728 | flush_rewrite_rules(); |
1729 | 1729 | } |
1730 | 1730 | $info_div_class = "geodir_problem_info"; |
1731 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />"; |
|
1731 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />"; |
|
1732 | 1732 | } else { |
1733 | 1733 | $info_div_class = "geodir_noproblem_info"; |
1734 | 1734 | $fix_button_txt = ''; |
@@ -1756,10 +1756,10 @@ discard block |
||
1756 | 1756 | $fix_button_txt = ''; |
1757 | 1757 | |
1758 | 1758 | if ($is_error_during_diagnose) { |
1759 | - $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>"; |
|
1759 | + $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>"; |
|
1760 | 1760 | $info_div_class = "geodir_problem_info"; |
1761 | 1761 | } else { |
1762 | - $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>"; |
|
1762 | + $output_str .= "<li>".__('Load custom fields in to file for translation: ok', 'geodirectory')."</li>"; |
|
1763 | 1763 | $info_div_class = "geodir_noproblem_info"; |
1764 | 1764 | $fix_button_txt = ''; |
1765 | 1765 | } |
@@ -1801,17 +1801,17 @@ discard block |
||
1801 | 1801 | global $wpdb, $wp_query, $plugin_prefix; |
1802 | 1802 | |
1803 | 1803 | 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'])) { |
1804 | - $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
1804 | + $table = $plugin_prefix.$wp_query->query_vars['post_type'].'_detail'; |
|
1805 | 1805 | |
1806 | - $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
1806 | + $join = $clauses['join'].' INNER JOIN '.$table.' AS gd_posts ON (gd_posts.post_id = '.$wpdb->posts.'.ID)'; |
|
1807 | 1807 | $clauses['join'] = $join; |
1808 | 1808 | |
1809 | - $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
1809 | + $fields = $clauses['fields'] != '' ? $clauses['fields'].', ' : ''; |
|
1810 | 1810 | $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'; |
1811 | 1811 | $clauses['fields'] = $fields; |
1812 | 1812 | |
1813 | 1813 | $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
1814 | - $orderby = 'gd_expire ' . $order; |
|
1814 | + $orderby = 'gd_expire '.$order; |
|
1815 | 1815 | $clauses['orderby'] = $orderby; |
1816 | 1816 | } |
1817 | 1817 | return $clauses; |
@@ -1854,7 +1854,7 @@ discard block |
||
1854 | 1854 | global $current_user; |
1855 | 1855 | $upload_dir = wp_upload_dir(); |
1856 | 1856 | |
1857 | - $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
1857 | + $file = $upload_dir['path'].'/temp_'.$current_user->data->ID.'/geodir_tmp.csv'; |
|
1858 | 1858 | $handle = fopen($file, 'w'); |
1859 | 1859 | |
1860 | 1860 | fwrite($handle, $input); |
@@ -1899,7 +1899,7 @@ discard block |
||
1899 | 1899 | $uploads_dir = $uploads['path']; |
1900 | 1900 | $image_name_arr = explode('/', $filename); |
1901 | 1901 | $filename = end($image_name_arr); |
1902 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
1902 | + $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
1903 | 1903 | $return = array(); |
1904 | 1904 | $return['file'] = $uploadedFile; |
1905 | 1905 | $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory'); |
@@ -1916,8 +1916,8 @@ discard block |
||
1916 | 1916 | |
1917 | 1917 | if (($handle = fopen($target_path, "r")) !== FALSE) { |
1918 | 1918 | while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { |
1919 | - if(is_array($data) && !empty($data)) { |
|
1920 | - $file[] = '"' . implode('","', $data) . '"'; |
|
1919 | + if (is_array($data) && !empty($data)) { |
|
1920 | + $file[] = '"'.implode('","', $data).'"'; |
|
1921 | 1921 | } |
1922 | 1922 | } |
1923 | 1923 | fclose($handle); |
@@ -2034,10 +2034,10 @@ discard block |
||
2034 | 2034 | $tag_arr = explode(',', $post_tags); |
2035 | 2035 | } |
2036 | 2036 | |
2037 | - $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
2037 | + $table = $plugin_prefix.$buffer[5].'_detail'; // check table in database |
|
2038 | 2038 | |
2039 | 2039 | $error = ''; |
2040 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) { |
|
2040 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$table."'") != $table) { |
|
2041 | 2041 | $invalid_post_type++; |
2042 | 2042 | continue; |
2043 | 2043 | } |
@@ -2063,7 +2063,7 @@ discard block |
||
2063 | 2063 | if ($buffer[$c] != '0' && $buffer[$c] != '') { |
2064 | 2064 | $submitdata = date('Y-m-d'); |
2065 | 2065 | |
2066 | - $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days")); |
|
2066 | + $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata."+".addslashes($buffer[$c])." days")); |
|
2067 | 2067 | } else { |
2068 | 2068 | $gd_post_info['expire_date'] = 'Never'; |
2069 | 2069 | } |
@@ -2091,7 +2091,7 @@ discard block |
||
2091 | 2091 | |
2092 | 2092 | // Post status |
2093 | 2093 | if ($customKeyarray[$c] == 'post_status') { |
2094 | - $post_status = sanitize_key( $buffer[$c] ); |
|
2094 | + $post_status = sanitize_key($buffer[$c]); |
|
2095 | 2095 | } |
2096 | 2096 | } |
2097 | 2097 | |
@@ -2109,8 +2109,8 @@ discard block |
||
2109 | 2109 | |
2110 | 2110 | // Default post status |
2111 | 2111 | $default_status = 'publish'; |
2112 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
2113 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
2112 | + $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status; |
|
2113 | + $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status; |
|
2114 | 2114 | |
2115 | 2115 | $my_post['post_title'] = $post_title; |
2116 | 2116 | $my_post['post_content'] = $post_desc; |
@@ -2154,7 +2154,7 @@ discard block |
||
2154 | 2154 | $payment_info = array(); |
2155 | 2155 | $package_info = array(); |
2156 | 2156 | |
2157 | - $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
2157 | + $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]); |
|
2158 | 2158 | $package_id = ''; |
2159 | 2159 | if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') { |
2160 | 2160 | $package_id = $gd_post_info['package_id']; |
@@ -2164,7 +2164,7 @@ discard block |
||
2164 | 2164 | $payment_info['package_id'] = $package_info['pid']; |
2165 | 2165 | |
2166 | 2166 | if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) { |
2167 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days")); |
|
2167 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['alive_days']." days")); |
|
2168 | 2168 | } else { |
2169 | 2169 | $payment_info['expire_date'] = 'Never'; |
2170 | 2170 | } |
@@ -2176,7 +2176,7 @@ discard block |
||
2176 | 2176 | |
2177 | 2177 | $post_type = get_post_type($last_postid); |
2178 | 2178 | |
2179 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
2179 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
2180 | 2180 | |
2181 | 2181 | geodir_save_post_info($last_postid, $gd_post_info); |
2182 | 2182 | |
@@ -2197,7 +2197,7 @@ discard block |
||
2197 | 2197 | $attachment['post_id'] = $last_postid; |
2198 | 2198 | $attachment['title'] = $img_name_arr[0]; |
2199 | 2199 | $attachment['content'] = ''; |
2200 | - $attachment['file'] = $sub_dir . '/' . $image_name; |
|
2200 | + $attachment['file'] = $sub_dir.'/'.$image_name; |
|
2201 | 2201 | $attachment['mime_type'] = $uploaded_file_type; |
2202 | 2202 | $attachment['menu_order'] = $menu_order; |
2203 | 2203 | $attachment['is_featured'] = 0; |
@@ -2206,15 +2206,15 @@ discard block |
||
2206 | 2206 | |
2207 | 2207 | foreach ($attachment as $key => $val) { |
2208 | 2208 | if ($val != '') |
2209 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
2209 | + $attachment_set .= $key." = '".$val."', "; |
|
2210 | 2210 | } |
2211 | 2211 | $attachment_set = trim($attachment_set, ", "); |
2212 | 2212 | |
2213 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set); |
|
2213 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set); |
|
2214 | 2214 | |
2215 | 2215 | if ($menu_order == 1) { |
2216 | 2216 | $post_type = get_post_type($last_postid); |
2217 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid))); |
|
2217 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($sub_dir.'/'.$image_name, $last_postid))); |
|
2218 | 2218 | } |
2219 | 2219 | $menu_order++; |
2220 | 2220 | } |
@@ -2255,11 +2255,11 @@ discard block |
||
2255 | 2255 | } |
2256 | 2256 | |
2257 | 2257 | // Add the tab in left sidebar menu fro import & export page. |
2258 | -add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 ); |
|
2258 | +add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94); |
|
2259 | 2259 | |
2260 | 2260 | // Handle ajax request for import/export. |
2261 | -add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' ); |
|
2262 | -add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' ); |
|
2261 | +add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export'); |
|
2262 | +add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export'); |
|
2263 | 2263 | |
2264 | 2264 | |
2265 | 2265 | /** |
@@ -2270,40 +2270,40 @@ discard block |
||
2270 | 2270 | * @param $post_id int $post_id The post ID of the post being saved. |
2271 | 2271 | * @param $post object $post The post object of the post being saved. |
2272 | 2272 | */ |
2273 | -function geodir_update_location_prefix($post_id,$post){ |
|
2274 | - if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){ |
|
2275 | - update_option('geodir_location_prefix',$post->post_name); |
|
2273 | +function geodir_update_location_prefix($post_id, $post) { |
|
2274 | + if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) { |
|
2275 | + update_option('geodir_location_prefix', $post->post_name); |
|
2276 | 2276 | } |
2277 | 2277 | |
2278 | 2278 | } |
2279 | 2279 | |
2280 | -add_action('save_post', 'geodir_update_location_prefix',10,2); |
|
2280 | +add_action('save_post', 'geodir_update_location_prefix', 10, 2); |
|
2281 | 2281 | |
2282 | -add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' ); |
|
2282 | +add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback'); |
|
2283 | 2283 | |
2284 | -function geodir_ga_callback(){ |
|
2284 | +function geodir_ga_callback() { |
|
2285 | 2285 | |
2286 | -if(isset($_REQUEST['code']) && $_REQUEST['code']) { |
|
2286 | +if (isset($_REQUEST['code']) && $_REQUEST['code']) { |
|
2287 | 2287 | $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
2288 | 2288 | $code = "code=".$_REQUEST['code']; |
2289 | 2289 | $grant_type = "&grant_type=authorization_code"; |
2290 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback"; |
|
2290 | + $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback"; |
|
2291 | 2291 | $client_id = "&client_id=".get_option('geodir_ga_client_id'); |
2292 | 2292 | $client_secret = "&client_secret=".get_option('geodir_ga_client_secret'); |
2293 | 2293 | |
2294 | - $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
2294 | + $auth_url = $oAuthURL.$code.$redirect_uri.$grant_type.$client_id.$client_secret; |
|
2295 | 2295 | |
2296 | 2296 | $response = wp_remote_post($auth_url, array('timeout' => 15)); |
2297 | 2297 | |
2298 | 2298 | //print_r($response); |
2299 | 2299 | |
2300 | - $error_msg = __('Something went wrong','geodirectory'); |
|
2301 | - if(!empty($response['response']['code']) && $response['response']['code']==200){ |
|
2300 | + $error_msg = __('Something went wrong', 'geodirectory'); |
|
2301 | + if (!empty($response['response']['code']) && $response['response']['code'] == 200) { |
|
2302 | 2302 | |
2303 | 2303 | $parts = json_decode($response['body']); |
2304 | 2304 | //print_r($parts); |
2305 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} |
|
2306 | - else{ |
|
2305 | + if (!isset($parts->access_token)) {echo $error_msg." - #1"; exit; } |
|
2306 | + else { |
|
2307 | 2307 | |
2308 | 2308 | update_option('gd_ga_access_token', $parts->access_token); |
2309 | 2309 | update_option('gd_ga_refresh_token', $parts->refresh_token); |
@@ -2312,25 +2312,25 @@ discard block |
||
2312 | 2312 | |
2313 | 2313 | |
2314 | 2314 | } |
2315 | - elseif(!empty($response['response']['code'])) { |
|
2315 | + elseif (!empty($response['response']['code'])) { |
|
2316 | 2316 | $parts = json_decode($response['body']); |
2317 | 2317 | |
2318 | - if(isset($parts->error)){ |
|
2319 | - echo $parts->error.": ".$parts->error_description;exit; |
|
2320 | - }else{ |
|
2321 | - echo $error_msg." - #2";exit; |
|
2318 | + if (isset($parts->error)) { |
|
2319 | + echo $parts->error.": ".$parts->error_description; exit; |
|
2320 | + } else { |
|
2321 | + echo $error_msg." - #2"; exit; |
|
2322 | 2322 | } |
2323 | 2323 | |
2324 | - }else{ |
|
2324 | + } else { |
|
2325 | 2325 | |
2326 | - echo $error_msg." - #3";exit; |
|
2326 | + echo $error_msg." - #3"; exit; |
|
2327 | 2327 | |
2328 | 2328 | } |
2329 | 2329 | } |
2330 | 2330 | exit; |
2331 | 2331 | } |
2332 | 2332 | |
2333 | -add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 ); |
|
2333 | +add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4); |
|
2334 | 2334 | |
2335 | 2335 | if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') { |
2336 | 2336 | add_action('geodir_before_admin_panel', 'geodir_wpml_permalink_setting_notice'); |
@@ -2381,13 +2381,13 @@ discard block |
||
2381 | 2381 | |
2382 | 2382 | $settings = array(); |
2383 | 2383 | $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory')); |
2384 | - $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' )); |
|
2384 | + $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory')); |
|
2385 | 2385 | |
2386 | 2386 | if (!empty($gd_plugins)) { |
2387 | 2387 | foreach ($gd_plugins as $plugin => $name) { |
2388 | 2388 | $setting = array( |
2389 | 2389 | 'type' => 'checkbox', |
2390 | - 'id' => 'geodir_un_' . $plugin, |
|
2390 | + 'id' => 'geodir_un_'.$plugin, |
|
2391 | 2391 | 'name' => $name, |
2392 | 2392 | 'desc' => wp_sprintf(__('Remove all of its data when the <b>%s</b> is deleted', 'geodirectory'), $plugin), |
2393 | 2393 | 'std' => '0' |
@@ -2401,7 +2401,7 @@ discard block |
||
2401 | 2401 | * @param bool $return If True then plugin will be displayed in uninstall settings. Default true. |
2402 | 2402 | * @param array $plugin The plugin name. |
2403 | 2403 | */ |
2404 | - $has_uninstall = apply_filters('geodir_has_uninstall_settings', true, $plugin) && apply_filters('geodir_has_uninstall_' . $plugin, true, $plugin); |
|
2404 | + $has_uninstall = apply_filters('geodir_has_uninstall_settings', true, $plugin) && apply_filters('geodir_has_uninstall_'.$plugin, true, $plugin); |
|
2405 | 2405 | |
2406 | 2406 | if ($has_uninstall) { |
2407 | 2407 | $settings[] = $setting; |
@@ -2434,7 +2434,7 @@ discard block |
||
2434 | 2434 | * @since 1.6.9 |
2435 | 2435 | */ |
2436 | 2436 | function geodir_uninstall_settings_desc() { |
2437 | - echo '<p class="gd-un-settings-desc">' . __('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory') . '</p>'; |
|
2437 | + echo '<p class="gd-un-settings-desc">'.__('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory').'</p>'; |
|
2438 | 2438 | } |
2439 | 2439 | add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc'); |
2440 | 2440 |