@@ -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 | |
@@ -99,7 +99,7 @@ discard block |
||
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 |
||
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 | /** |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | |
237 | 237 | // Filter-Payment-Manager |
238 | 238 | |
239 | - add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side'); |
|
239 | + add_meta_box('geodir_post_images', $post_typename.' '.__('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side'); |
|
240 | 240 | |
241 | - add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high'); |
|
241 | + add_meta_box('geodir_post_info', $post_typename.' '.__('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high'); |
|
242 | 242 | |
243 | 243 | // no need of this box as all fields moved to main information box |
244 | 244 | //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' ); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | } |
249 | 249 | |
250 | -add_action('save_post', 'geodir_post_information_save',10,2); |
|
250 | +add_action('save_post', 'geodir_post_information_save', 10, 2); |
|
251 | 251 | |
252 | 252 | |
253 | 253 | |
@@ -274,10 +274,10 @@ discard block |
||
274 | 274 | |
275 | 275 | $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
276 | 276 | |
277 | - if(!empty($gd_taxonomy)) { |
|
277 | + if (!empty($gd_taxonomy)) { |
|
278 | 278 | foreach ($gd_taxonomy as $tax) { |
279 | 279 | |
280 | - remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
280 | + remove_meta_box($tax.'div', $geodir_post_type, 'normal'); |
|
281 | 281 | |
282 | 282 | } |
283 | 283 | } |
@@ -363,14 +363,14 @@ discard block |
||
363 | 363 | add_action('geodir_manage_available_fields_predefined', 'geodir_manage_available_fields_predefined'); |
364 | 364 | add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom'); |
365 | 365 | |
366 | -function geodir_manage_available_fields_predefined($sub_tab){ |
|
367 | - if($sub_tab=='custom_fields'){ |
|
366 | +function geodir_manage_available_fields_predefined($sub_tab) { |
|
367 | + if ($sub_tab == 'custom_fields') { |
|
368 | 368 | geodir_custom_available_fields('predefined'); |
369 | 369 | } |
370 | 370 | } |
371 | 371 | |
372 | -function geodir_manage_available_fields_custom($sub_tab){ |
|
373 | - if($sub_tab=='custom_fields'){ |
|
372 | +function geodir_manage_available_fields_custom($sub_tab) { |
|
373 | + if ($sub_tab == 'custom_fields') { |
|
374 | 374 | geodir_custom_available_fields('custom'); |
375 | 375 | } |
376 | 376 | } |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | global $wpdb; |
441 | 441 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
442 | 442 | ?> |
443 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
443 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
444 | 444 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
445 | 445 | <ul> |
446 | 446 | <?php |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | |
452 | 452 | $check_html_variable = $wpdb->get_var( |
453 | 453 | $wpdb->prepare( |
454 | - "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
454 | + "SELECT htmlvar_name FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
455 | 455 | array($val['htmlvar_name'], $listing_type, $val['field_type']) |
456 | 456 | ) |
457 | 457 | ); |
@@ -459,23 +459,23 @@ discard block |
||
459 | 459 | $display = $check_html_variable ? ' style="display:none;"' : ''; |
460 | 460 | ?> |
461 | 461 | |
462 | - <li class="gd-cf-tooltip-wrap" <?php echo $display;?>> |
|
462 | + <li class="gd-cf-tooltip-wrap" <?php echo $display; ?>> |
|
463 | 463 | <?php |
464 | - if(isset($val['description']) && $val['description']){ |
|
464 | + if (isset($val['description']) && $val['description']) { |
|
465 | 465 | echo '<div class="gdcf-tooltip">'.$val['description'].'</div>'; |
466 | 466 | }?> |
467 | 467 | |
468 | - <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'];?>" |
|
469 | - title="<?php echo $val['site_title'];?>" |
|
470 | - class="gd-draggable-form-items gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);"> |
|
468 | + <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']; ?>" |
|
469 | + title="<?php echo $val['site_title']; ?>" |
|
470 | + class="gd-draggable-form-items gd-<?php echo $val['field_type']; ?> geodir-sort-<?php echo $val['htmlvar_name']; ?>" href="javascript:void(0);"> |
|
471 | 471 | <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) { |
472 | 472 | echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>'; |
473 | - }elseif(isset($val['field_icon']) && $val['field_icon'] ){ |
|
473 | + }elseif (isset($val['field_icon']) && $val['field_icon']) { |
|
474 | 474 | echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>'; |
475 | - }else{ |
|
475 | + } else { |
|
476 | 476 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
477 | 477 | }?> |
478 | - <?php echo $val['site_title'];?> |
|
478 | + <?php echo $val['site_title']; ?> |
|
479 | 479 | </a> |
480 | 480 | </li> |
481 | 481 | |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | <?php |
504 | 504 | global $wpdb; |
505 | 505 | |
506 | - $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))); |
|
506 | + $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))); |
|
507 | 507 | |
508 | 508 | if (!empty($fields)) { |
509 | 509 | foreach ($fields as $field) { |
@@ -528,14 +528,14 @@ discard block |
||
528 | 528 | * @since 1.6.9 |
529 | 529 | * @package GeoDirectory |
530 | 530 | */ |
531 | -function geodir_custom_fields_custom($post_type=''){ |
|
531 | +function geodir_custom_fields_custom($post_type = '') { |
|
532 | 532 | |
533 | 533 | $custom_fields = array(); |
534 | 534 | |
535 | 535 | /** |
536 | 536 | * @see `geodir_custom_fields` |
537 | 537 | */ |
538 | - return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type); |
|
538 | + return apply_filters('geodir_custom_fields_custom', $custom_fields, $post_type); |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | * @since 1.6.6 |
547 | 547 | * @package GeoDirectory |
548 | 548 | */ |
549 | -function geodir_custom_fields($post_type=''){ |
|
549 | +function geodir_custom_fields($post_type = '') { |
|
550 | 550 | |
551 | 551 | $custom_fields = array( |
552 | 552 | 'text' => array( |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * } |
682 | 682 | * @param string $post_type The post type requested. |
683 | 683 | */ |
684 | - return apply_filters('geodir_custom_fields',$custom_fields,$post_type); |
|
684 | + return apply_filters('geodir_custom_fields', $custom_fields, $post_type); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | /** |
@@ -692,25 +692,25 @@ discard block |
||
692 | 692 | * @param string $type The custom field type, predefined, custom or blank for default |
693 | 693 | * @package GeoDirectory |
694 | 694 | */ |
695 | -function geodir_custom_available_fields($type='') |
|
695 | +function geodir_custom_available_fields($type = '') |
|
696 | 696 | { |
697 | 697 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
698 | 698 | ?> |
699 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
699 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
700 | 700 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" /> |
701 | 701 | |
702 | 702 | <?php |
703 | - if($type=='predefined'){ |
|
703 | + if ($type == 'predefined') { |
|
704 | 704 | $cfs = geodir_custom_fields_predefined($listing_type); |
705 | - }elseif($type=='custom'){ |
|
705 | + }elseif ($type == 'custom') { |
|
706 | 706 | $cfs = geodir_custom_fields_custom($listing_type); |
707 | - }else{ |
|
707 | + } else { |
|
708 | 708 | $cfs = geodir_custom_fields($listing_type); |
709 | 709 | ?> |
710 | 710 | <ul class="full gd-cf-tooltip-wrap"> |
711 | 711 | <li> |
712 | 712 | <div class="gdcf-tooltip"> |
713 | - <?php _e('This adds a section separator with a title.', 'geodirectory');?> |
|
713 | + <?php _e('This adds a section separator with a title.', 'geodirectory'); ?> |
|
714 | 714 | </div> |
715 | 715 | <a id="gt-fieldset" |
716 | 716 | class="gd-draggable-form-items gt-fieldset" |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | |
722 | 722 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
723 | 723 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
724 | - <?php _e('Fieldset (section separator)', 'geodirectory');?> |
|
724 | + <?php _e('Fieldset (section separator)', 'geodirectory'); ?> |
|
725 | 725 | </a> |
726 | 726 | </li> |
727 | 727 | </ul> |
@@ -729,15 +729,15 @@ discard block |
||
729 | 729 | <?php |
730 | 730 | } |
731 | 731 | |
732 | - if(!empty($cfs)) { |
|
732 | + if (!empty($cfs)) { |
|
733 | 733 | echo '<ul>'; |
734 | - foreach ( $cfs as $id => $cf ) { |
|
734 | + foreach ($cfs as $id => $cf) { |
|
735 | 735 | ?> |
736 | 736 | |
737 | 737 | <li class="gd-cf-tooltip-wrap"> |
738 | 738 | <?php |
739 | - if ( isset( $cf['description'] ) && $cf['description'] ) { |
|
740 | - echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>'; |
|
739 | + if (isset($cf['description']) && $cf['description']) { |
|
740 | + echo '<div class="gdcf-tooltip">'.$cf['description'].'</div>'; |
|
741 | 741 | } ?> |
742 | 742 | |
743 | 743 | <a id="gd-<?php echo $id; ?>" |
@@ -747,10 +747,10 @@ discard block |
||
747 | 747 | class="gd-draggable-form-items <?php echo $cf['class']; ?>" |
748 | 748 | href="javascript:void(0);"> |
749 | 749 | |
750 | - <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], 'fa fa-' ) !== false ) { |
|
751 | - echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>'; |
|
752 | - } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) { |
|
753 | - echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>'; |
|
750 | + <?php if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) { |
|
751 | + echo '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
752 | + } elseif (isset($cf['icon']) && $cf['icon']) { |
|
753 | + echo '<b style="background-image: url("'.$cf['icon'].'")"></b>'; |
|
754 | 754 | } else { |
755 | 755 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
756 | 756 | } ?> |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | </li> |
760 | 760 | <?php |
761 | 761 | } |
762 | - }else{ |
|
762 | + } else { |
|
763 | 763 | _e('There are no custom fields here yet.', 'geodirectory'); |
764 | 764 | } |
765 | 765 | ?> |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | <ul class="core"> |
788 | 788 | <?php |
789 | 789 | global $wpdb; |
790 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type))); |
|
790 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type))); |
|
791 | 791 | |
792 | 792 | if (!empty($fields)) { |
793 | 793 | foreach ($fields as $field) { |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | $field_type_key = $field->field_type_key; |
798 | 798 | $field_ins_upd = 'display'; |
799 | 799 | |
800 | - geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key); |
|
800 | + geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd, $field_type_key); |
|
801 | 801 | } |
802 | 802 | } |
803 | 803 | ?></ul> |
@@ -956,8 +956,8 @@ discard block |
||
956 | 956 | |
957 | 957 | if (!get_option('geodir_remove_unnecessary_fields')) { |
958 | 958 | |
959 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) |
|
960 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`"); |
|
959 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$plugin_prefix."gd_place_detail WHERE field = 'categories'")) |
|
960 | + $wpdb->query("ALTER TABLE `".$plugin_prefix."gd_place_detail` DROP `categories`"); |
|
961 | 961 | |
962 | 962 | update_option('geodir_remove_unnecessary_fields', '1'); |
963 | 963 | |
@@ -985,14 +985,14 @@ discard block |
||
985 | 985 | case 'diagnosis' : |
986 | 986 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
987 | 987 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
988 | - call_user_func('geodir_diagnose_' . $diagnose_this); |
|
988 | + call_user_func('geodir_diagnose_'.$diagnose_this); |
|
989 | 989 | exit(); |
990 | 990 | break; |
991 | 991 | |
992 | 992 | case 'diagnosis-fix' : |
993 | 993 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
994 | 994 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
995 | - call_user_func('geodir_diagnose_' . $diagnose_this); |
|
995 | + call_user_func('geodir_diagnose_'.$diagnose_this); |
|
996 | 996 | exit(); |
997 | 997 | break; |
998 | 998 | } |
@@ -1017,50 +1017,50 @@ discard block |
||
1017 | 1017 | { |
1018 | 1018 | global $wpdb; |
1019 | 1019 | //$filter_arr['output_str'] .='###'.$table.'###'; |
1020 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) { |
|
1021 | - $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>"; |
|
1020 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0) { |
|
1021 | + $filter_arr['output_str'] .= "<li>".__('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory')."</li>"; |
|
1022 | 1022 | $filter_arr['is_error_during_diagnose'] = true; |
1023 | 1023 | |
1024 | - } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) { |
|
1025 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>"; |
|
1024 | + } elseif ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) { |
|
1025 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name)."</li>"; |
|
1026 | 1026 | $filter_arr['is_error_during_diagnose'] = true; |
1027 | - $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>"; |
|
1027 | + $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>"; |
|
1028 | 1028 | $filter_arr['is_error_during_diagnose'] = true; |
1029 | 1029 | |
1030 | 1030 | if ($fix) { |
1031 | - $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count |
|
1032 | - $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count |
|
1031 | + $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$table."_ms_bak"); // get backup table count |
|
1032 | + $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table"); // get new table count |
|
1033 | 1033 | |
1034 | 1034 | if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2 |
1035 | 1035 | //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ; |
1036 | 1036 | |
1037 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table |
|
1037 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename bak table to new table |
|
1038 | 1038 | |
1039 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) { |
|
1040 | - $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>"; |
|
1039 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) { |
|
1040 | + $filter_arr['output_str'] .= "<li>".__('-->FIXED: Renamed and backed up the tables', 'geodirectory')."</li>"; |
|
1041 | 1041 | } else { |
1042 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
1042 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>"; |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | 1045 | } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it |
1046 | 1046 | |
1047 | - $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2 |
|
1048 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table |
|
1047 | + $wpdb->query("RENAME TABLE ".$wpdb->prefix."$table TO ".$table."_ms_bak2"); // rename new table to bak2 |
|
1048 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$wpdb->prefix."$table"); // rename bak table to new table |
|
1049 | 1049 | |
1050 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1051 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>"; |
|
1050 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1051 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table)."</li>"; |
|
1052 | 1052 | } else { |
1053 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
1053 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>"; |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors |
1057 | 1057 | |
1058 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2 |
|
1058 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename ms_bak table to ms_bak2 |
|
1059 | 1059 | |
1060 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) { |
|
1061 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>"; |
|
1060 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) { |
|
1061 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table)."</li>"; |
|
1062 | 1062 | } else { |
1063 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
1063 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>"; |
|
1064 | 1064 | } |
1065 | 1065 | |
1066 | 1066 | } |
@@ -1068,54 +1068,54 @@ discard block |
||
1068 | 1068 | } |
1069 | 1069 | |
1070 | 1070 | |
1071 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) { |
|
1072 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>"; |
|
1071 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) { |
|
1072 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name)."</li>"; |
|
1073 | 1073 | $filter_arr['is_error_during_diagnose'] = true; |
1074 | 1074 | |
1075 | 1075 | if ($fix) { |
1076 | 1076 | if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it |
1077 | 1077 | if ($wpdb->query("DROP TABLE IF EXISTS $table")) { |
1078 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>"; |
|
1078 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table)."</li>"; |
|
1079 | 1079 | } else { |
1080 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>"; |
|
1080 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table)."</li>"; |
|
1081 | 1081 | } |
1082 | 1082 | |
1083 | - } 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 |
|
1084 | - if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) { |
|
1085 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>"; |
|
1083 | + } 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 |
|
1084 | + if ($wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."$table")) { |
|
1085 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix.$table)."</li>"; |
|
1086 | 1086 | } else { |
1087 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>"; |
|
1087 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix.$table)."</li>"; |
|
1088 | 1088 | } |
1089 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1090 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
1089 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1090 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>"; |
|
1091 | 1091 | } else { |
1092 | - $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>"; |
|
1092 | + $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>"; |
|
1093 | 1093 | } |
1094 | 1094 | } else {// else rename the original table to _ms_bak |
1095 | - if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1096 | - $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>"; |
|
1095 | + if ($wpdb->query("RENAME TABLE $table TO ".$table."_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1096 | + $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>"; |
|
1097 | 1097 | } else { |
1098 | - $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>"; |
|
1098 | + $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>"; |
|
1099 | 1099 | } |
1100 | 1100 | } |
1101 | 1101 | } |
1102 | 1102 | |
1103 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) { |
|
1104 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>"; |
|
1103 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) { |
|
1104 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name)."</li>"; |
|
1105 | 1105 | $filter_arr['is_error_during_diagnose'] = true; |
1106 | 1106 | |
1107 | 1107 | if ($fix) { |
1108 | 1108 | // if original table exists but new does not, rename |
1109 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1110 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
1109 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1110 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>"; |
|
1111 | 1111 | } else { |
1112 | - $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>"; |
|
1112 | + $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>"; |
|
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | } |
1116 | 1116 | |
1117 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) { |
|
1118 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>"; |
|
1117 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) { |
|
1118 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name)."</li>"; |
|
1119 | 1119 | $filter_arr['is_error_during_diagnose'] = true; |
1120 | 1120 | |
1121 | 1121 | if ($fix) { |
@@ -1129,11 +1129,11 @@ discard block |
||
1129 | 1129 | delete_option('geodir_custom_posts_db_version'); |
1130 | 1130 | delete_option('geodir_reviewratings_db_version'); |
1131 | 1131 | delete_option('geodiradvancesearch_db_version'); |
1132 | - $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>"; |
|
1132 | + $filter_arr['output_str'] .= "<li>".__('-->TRY: Please refresh page to run table install functions', 'geodirectory')."</li>"; |
|
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | } else { |
1136 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>"; |
|
1136 | + $filter_arr['output_str'] .= "<li>".sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name)."</li>"; |
|
1137 | 1137 | } |
1138 | 1138 | return $filter_arr; |
1139 | 1139 | } |
@@ -1162,23 +1162,23 @@ discard block |
||
1162 | 1162 | if (!empty($all_postypes)) { |
1163 | 1163 | foreach ($all_postypes as $key) { |
1164 | 1164 | // update each GD CPT |
1165 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d"); |
|
1165 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d"); |
|
1166 | 1166 | |
1167 | 1167 | if (!empty($posts)) { |
1168 | 1168 | |
1169 | 1169 | foreach ($posts as $p) { |
1170 | 1170 | $p->post_type = $key; |
1171 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names')); |
|
1171 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names')); |
|
1172 | 1172 | if (empty($raw_tags)) { |
1173 | 1173 | $post_tags = ''; |
1174 | 1174 | } else { |
1175 | 1175 | $post_tags = implode(",", $raw_tags); |
1176 | 1176 | } |
1177 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
1178 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id)); |
|
1177 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
1178 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id)); |
|
1179 | 1179 | |
1180 | 1180 | } |
1181 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>"; |
|
1181 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>"; |
|
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | } |
@@ -1187,7 +1187,7 @@ discard block |
||
1187 | 1187 | |
1188 | 1188 | if ($is_error_during_diagnose) { |
1189 | 1189 | $info_div_class = "geodir_problem_info"; |
1190 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1190 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1191 | 1191 | } else { |
1192 | 1192 | $info_div_class = "geodir_noproblem_info"; |
1193 | 1193 | $fix_button_txt = ''; |
@@ -1224,29 +1224,29 @@ discard block |
||
1224 | 1224 | if (!empty($all_postypes)) { |
1225 | 1225 | foreach ($all_postypes as $key) { |
1226 | 1226 | // update each GD CTP |
1227 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' "); |
|
1227 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d WHERE d.".$key."category='' "); |
|
1228 | 1228 | |
1229 | 1229 | if (!empty($posts)) { |
1230 | 1230 | |
1231 | 1231 | foreach ($posts as $p) { |
1232 | 1232 | $p->post_type = $key; |
1233 | - $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids')); |
|
1233 | + $raw_cats = wp_get_object_terms($p->post_id, $p->post_type.'category', array('fields' => 'ids')); |
|
1234 | 1234 | |
1235 | 1235 | if (empty($raw_cats)) { |
1236 | 1236 | $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
1237 | 1237 | |
1238 | - if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) { |
|
1239 | - $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']); |
|
1240 | - foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) { |
|
1238 | + if (!empty($post_categories) && !empty($post_categories[$p->post_type.'category'])) { |
|
1239 | + $post_categories[$p->post_type.'category'] = str_replace("d:", "", $post_categories[$p->post_type.'category']); |
|
1240 | + foreach (explode(",", $post_categories[$p->post_type.'category']) as $cat_part) { |
|
1241 | 1241 | if (is_numeric($cat_part)) { |
1242 | - $raw_cats[] = (int)$cat_part; |
|
1242 | + $raw_cats[] = (int) $cat_part; |
|
1243 | 1243 | } |
1244 | 1244 | } |
1245 | 1245 | |
1246 | 1246 | } |
1247 | 1247 | |
1248 | 1248 | if (!empty($raw_cats)) { |
1249 | - $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
1249 | + $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type.'category'); |
|
1250 | 1250 | |
1251 | 1251 | } |
1252 | 1252 | |
@@ -1256,14 +1256,14 @@ discard block |
||
1256 | 1256 | if (empty($raw_cats)) { |
1257 | 1257 | $post_cats = ''; |
1258 | 1258 | } else { |
1259 | - $post_cats = ',' . implode(",", $raw_cats) . ','; |
|
1259 | + $post_cats = ','.implode(",", $raw_cats).','; |
|
1260 | 1260 | } |
1261 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
1262 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id)); |
|
1261 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
1262 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET ".$p->post_type."category=%s WHERE post_id =%d", $post_cats, $p->post_id)); |
|
1263 | 1263 | } |
1264 | 1264 | |
1265 | 1265 | } |
1266 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>"; |
|
1266 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>"; |
|
1267 | 1267 | |
1268 | 1268 | } |
1269 | 1269 | |
@@ -1271,7 +1271,7 @@ discard block |
||
1271 | 1271 | |
1272 | 1272 | if ($is_error_during_diagnose) { |
1273 | 1273 | $info_div_class = "geodir_problem_info"; |
1274 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1274 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1275 | 1275 | } else { |
1276 | 1276 | $info_div_class = "geodir_noproblem_info"; |
1277 | 1277 | $fix_button_txt = ''; |
@@ -1324,15 +1324,15 @@ discard block |
||
1324 | 1324 | if (!empty($ver_arr)) { |
1325 | 1325 | foreach ($ver_arr as $key => $val) { |
1326 | 1326 | if (delete_option($val)) { |
1327 | - $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>"; |
|
1327 | + $output_str .= "<li>".$key.__(' Version: Deleted', 'geodirectory')."</li>"; |
|
1328 | 1328 | } else { |
1329 | - $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>"; |
|
1329 | + $output_str .= "<li>".$key.__(' Version: Not Found', 'geodirectory')."</li>"; |
|
1330 | 1330 | } |
1331 | 1331 | |
1332 | 1332 | } |
1333 | 1333 | |
1334 | 1334 | if ($output_str) { |
1335 | - $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>"; |
|
1335 | + $output_str .= "<li><strong>".__(' Upgrade/install scripts will run on next page reload.', 'geodirectory')."</strong></li>"; |
|
1336 | 1336 | } |
1337 | 1337 | |
1338 | 1338 | } |
@@ -1369,43 +1369,43 @@ discard block |
||
1369 | 1369 | $output_str = ''; |
1370 | 1370 | |
1371 | 1371 | // check review locations |
1372 | - 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")) { |
|
1373 | - $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>"; |
|
1372 | + 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")) { |
|
1373 | + $output_str .= "<li>".__('Review locations missing or broken', 'geodirectory')."</li>"; |
|
1374 | 1374 | $is_error_during_diagnose = true; |
1375 | 1375 | |
1376 | 1376 | if ($fix) { |
1377 | 1377 | if (geodir_fix_review_location()) { |
1378 | - $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>"; |
|
1378 | + $output_str .= "<li><strong>".__('-->FIXED: Review locations fixed', 'geodirectory')."</strong></li>"; |
|
1379 | 1379 | } else { |
1380 | - $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>"; |
|
1380 | + $output_str .= "<li><strong>".__('-->FAILED: Review locations fix failed', 'geodirectory')."</strong></li>"; |
|
1381 | 1381 | } |
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | } else { |
1385 | - $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>"; |
|
1385 | + $output_str .= "<li>".__('Review locations ok', 'geodirectory')."</li>"; |
|
1386 | 1386 | } |
1387 | 1387 | |
1388 | 1388 | // check review content |
1389 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) { |
|
1390 | - $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>"; |
|
1389 | + if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_content IS NULL")) { |
|
1390 | + $output_str .= "<li>".__('Review content missing or broken', 'geodirectory')."</li>"; |
|
1391 | 1391 | $is_error_during_diagnose = true; |
1392 | 1392 | |
1393 | 1393 | if ($fix) { |
1394 | 1394 | if (geodir_fix_review_content()) { |
1395 | - $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>"; |
|
1395 | + $output_str .= "<li><strong>".__('-->FIXED: Review content fixed', 'geodirectory')."</strong></li>"; |
|
1396 | 1396 | } else { |
1397 | - $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>"; |
|
1397 | + $output_str .= "<li><strong>".__('-->FAILED: Review content fix failed', 'geodirectory')."</strong></li>"; |
|
1398 | 1398 | } |
1399 | 1399 | } |
1400 | 1400 | |
1401 | 1401 | } else { |
1402 | - $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>"; |
|
1402 | + $output_str .= "<li>".__('Review content ok', 'geodirectory')."</li>"; |
|
1403 | 1403 | } |
1404 | 1404 | |
1405 | 1405 | |
1406 | 1406 | if ($is_error_during_diagnose) { |
1407 | 1407 | $info_div_class = "geodir_problem_info"; |
1408 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1408 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1409 | 1409 | } else { |
1410 | 1410 | $info_div_class = "geodir_noproblem_info"; |
1411 | 1411 | $fix_button_txt = ''; |
@@ -1469,7 +1469,7 @@ discard block |
||
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='multisite_conversion' />"; |
|
1472 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />"; |
|
1473 | 1473 | } else { |
1474 | 1474 | $info_div_class = "geodir_noproblem_info"; |
1475 | 1475 | $fix_button_txt = ''; |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | else { |
1504 | 1504 | $page_found = $wpdb->get_var( |
1505 | 1505 | $wpdb->prepare( |
1506 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
1506 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;", |
|
1507 | 1507 | array($slug) |
1508 | 1508 | ) |
1509 | 1509 | ); |
@@ -1549,18 +1549,18 @@ discard block |
||
1549 | 1549 | ////////////////////////////////// |
1550 | 1550 | $option_value = get_option('geodir_home_page'); |
1551 | 1551 | $page = get_post($option_value); |
1552 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1552 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1553 | 1553 | |
1554 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1555 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1554 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1555 | + $output_str .= "<li>".__('GD Home page exists with proper setting.', 'geodirectory')."</li>"; |
|
1556 | 1556 | else { |
1557 | 1557 | $is_error_during_diagnose = true; |
1558 | - $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>"; |
|
1558 | + $output_str .= "<li><strong>".__('GD Home page is missing.', 'geodirectory')."</strong></li>"; |
|
1559 | 1559 | if ($fix) { |
1560 | 1560 | if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) { |
1561 | - $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>"; |
|
1561 | + $output_str .= "<li><strong>".__('-->FIXED: GD Home page fixed', 'geodirectory')."</strong></li>"; |
|
1562 | 1562 | } else { |
1563 | - $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>"; |
|
1563 | + $output_str .= "<li><strong>".__('-->FAILED: GD Home page fix failed', 'geodirectory')."</strong></li>"; |
|
1564 | 1564 | } |
1565 | 1565 | } |
1566 | 1566 | } |
@@ -1574,18 +1574,18 @@ discard block |
||
1574 | 1574 | ////////////////////////////////// |
1575 | 1575 | $option_value = get_option('geodir_add_listing_page'); |
1576 | 1576 | $page = get_post($option_value); |
1577 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1577 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1578 | 1578 | |
1579 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1580 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1579 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1580 | + $output_str .= "<li>".__('Add Listing page exists with proper setting.', 'geodirectory')."</li>"; |
|
1581 | 1581 | else { |
1582 | 1582 | $is_error_during_diagnose = true; |
1583 | - $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>"; |
|
1583 | + $output_str .= "<li><strong>".__('Add Listing page is missing.', 'geodirectory')."</strong></li>"; |
|
1584 | 1584 | if ($fix) { |
1585 | 1585 | if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) { |
1586 | - $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>"; |
|
1586 | + $output_str .= "<li><strong>".__('-->FIXED: Add Listing page fixed', 'geodirectory')."</strong></li>"; |
|
1587 | 1587 | } else { |
1588 | - $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>"; |
|
1588 | + $output_str .= "<li><strong>".__('-->FAILED: Add Listing page fix failed', 'geodirectory')."</strong></li>"; |
|
1589 | 1589 | } |
1590 | 1590 | } |
1591 | 1591 | } |
@@ -1600,18 +1600,18 @@ discard block |
||
1600 | 1600 | ////////////////////////////////// |
1601 | 1601 | $option_value = get_option('geodir_preview_page'); |
1602 | 1602 | $page = get_post($option_value); |
1603 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1603 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1604 | 1604 | |
1605 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1606 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1605 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1606 | + $output_str .= "<li>".__('Listing Preview page exists with proper setting.', 'geodirectory')."</li>"; |
|
1607 | 1607 | else { |
1608 | 1608 | $is_error_during_diagnose = true; |
1609 | - $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>"; |
|
1609 | + $output_str .= "<li><strong>".__('Listing Preview page is missing.', 'geodirectory')."</strong></li>"; |
|
1610 | 1610 | if ($fix) { |
1611 | 1611 | if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) { |
1612 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>"; |
|
1612 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Preview page fixed', 'geodirectory')."</strong></li>"; |
|
1613 | 1613 | } else { |
1614 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>"; |
|
1614 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Preview page fix failed', 'geodirectory')."</strong></li>"; |
|
1615 | 1615 | } |
1616 | 1616 | } |
1617 | 1617 | } |
@@ -1625,18 +1625,18 @@ discard block |
||
1625 | 1625 | ////////////////////////////////// |
1626 | 1626 | $option_value = get_option('geodir_success_page'); |
1627 | 1627 | $page = get_post($option_value); |
1628 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1628 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1629 | 1629 | |
1630 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1631 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1630 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1631 | + $output_str .= "<li>".__('Listing Success page exists with proper setting.', 'geodirectory')."</li>"; |
|
1632 | 1632 | else { |
1633 | 1633 | $is_error_during_diagnose = true; |
1634 | - $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>"; |
|
1634 | + $output_str .= "<li><strong>".__('Listing Success page is missing.', 'geodirectory')."</strong></li>"; |
|
1635 | 1635 | if ($fix) { |
1636 | 1636 | if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) { |
1637 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>"; |
|
1637 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Success page fixed', 'geodirectory')."</strong></li>"; |
|
1638 | 1638 | } else { |
1639 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>"; |
|
1639 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Success page fix failed', 'geodirectory')."</strong></li>"; |
|
1640 | 1640 | } |
1641 | 1641 | } |
1642 | 1642 | } |
@@ -1650,18 +1650,18 @@ discard block |
||
1650 | 1650 | ////////////////////////////////// |
1651 | 1651 | $option_value = get_option('geodir_info_page'); |
1652 | 1652 | $page = get_post($option_value); |
1653 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1653 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1654 | 1654 | |
1655 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1656 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1655 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1656 | + $output_str .= "<li>".__('Info page exists with proper setting.', 'geodirectory')."</li>"; |
|
1657 | 1657 | else { |
1658 | 1658 | $is_error_during_diagnose = true; |
1659 | - $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>"; |
|
1659 | + $output_str .= "<li><strong>".__('Info page is missing.', 'geodirectory')."</strong></li>"; |
|
1660 | 1660 | if ($fix) { |
1661 | 1661 | if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) { |
1662 | - $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>"; |
|
1662 | + $output_str .= "<li><strong>".__('-->FIXED: Info page fixed', 'geodirectory')."</strong></li>"; |
|
1663 | 1663 | } else { |
1664 | - $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>"; |
|
1664 | + $output_str .= "<li><strong>".__('-->FAILED: Info page fix failed', 'geodirectory')."</strong></li>"; |
|
1665 | 1665 | } |
1666 | 1666 | } |
1667 | 1667 | } |
@@ -1675,18 +1675,18 @@ discard block |
||
1675 | 1675 | ////////////////////////////////// |
1676 | 1676 | $option_value = get_option('geodir_login_page'); |
1677 | 1677 | $page = get_post($option_value); |
1678 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1678 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1679 | 1679 | |
1680 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1681 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1680 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1681 | + $output_str .= "<li>".__('Login page exists with proper setting.', 'geodirectory')."</li>"; |
|
1682 | 1682 | else { |
1683 | 1683 | $is_error_during_diagnose = true; |
1684 | - $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>"; |
|
1684 | + $output_str .= "<li><strong>".__('Login page is missing.', 'geodirectory')."</strong></li>"; |
|
1685 | 1685 | if ($fix) { |
1686 | 1686 | if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) { |
1687 | - $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>"; |
|
1687 | + $output_str .= "<li><strong>".__('-->FIXED: Login page fixed', 'geodirectory')."</strong></li>"; |
|
1688 | 1688 | } else { |
1689 | - $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>"; |
|
1689 | + $output_str .= "<li><strong>".__('-->FAILED: Login page fix failed', 'geodirectory')."</strong></li>"; |
|
1690 | 1690 | } |
1691 | 1691 | } |
1692 | 1692 | } |
@@ -1700,18 +1700,18 @@ discard block |
||
1700 | 1700 | ////////////////////////////////// |
1701 | 1701 | $option_value = get_option('geodir_location_page'); |
1702 | 1702 | $page = get_post($option_value); |
1703 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1703 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1704 | 1704 | |
1705 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1706 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1705 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1706 | + $output_str .= "<li>".__('Location page exists with proper setting.', 'geodirectory')."</li>"; |
|
1707 | 1707 | else { |
1708 | 1708 | $is_error_during_diagnose = true; |
1709 | - $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>"; |
|
1709 | + $output_str .= "<li><strong>".__('Location page is missing.', 'geodirectory')."</strong></li>"; |
|
1710 | 1710 | if ($fix) { |
1711 | 1711 | if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) { |
1712 | - $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>"; |
|
1712 | + $output_str .= "<li><strong>".__('-->FIXED: Location page fixed', 'geodirectory')."</strong></li>"; |
|
1713 | 1713 | } else { |
1714 | - $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>"; |
|
1714 | + $output_str .= "<li><strong>".__('-->FAILED: Location page fix failed', 'geodirectory')."</strong></li>"; |
|
1715 | 1715 | } |
1716 | 1716 | } |
1717 | 1717 | } |
@@ -1720,13 +1720,13 @@ discard block |
||
1720 | 1720 | /* Diagnose Location Page Ends */ |
1721 | 1721 | //////////////////////////////// |
1722 | 1722 | |
1723 | - $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose ); |
|
1723 | + $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose); |
|
1724 | 1724 | /** |
1725 | 1725 | * This action is called at the end of the GD Tools page check function. |
1726 | 1726 | * |
1727 | 1727 | * @since 1.5.2 |
1728 | 1728 | */ |
1729 | - $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr); |
|
1729 | + $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr); |
|
1730 | 1730 | |
1731 | 1731 | $output_str = $page_chk_arr['output_str']; |
1732 | 1732 | $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
@@ -1736,7 +1736,7 @@ discard block |
||
1736 | 1736 | flush_rewrite_rules(); |
1737 | 1737 | } |
1738 | 1738 | $info_div_class = "geodir_problem_info"; |
1739 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />"; |
|
1739 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />"; |
|
1740 | 1740 | } else { |
1741 | 1741 | $info_div_class = "geodir_noproblem_info"; |
1742 | 1742 | $fix_button_txt = ''; |
@@ -1764,10 +1764,10 @@ discard block |
||
1764 | 1764 | $fix_button_txt = ''; |
1765 | 1765 | |
1766 | 1766 | if ($is_error_during_diagnose) { |
1767 | - $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>"; |
|
1767 | + $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>"; |
|
1768 | 1768 | $info_div_class = "geodir_problem_info"; |
1769 | 1769 | } else { |
1770 | - $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>"; |
|
1770 | + $output_str .= "<li>".__('Load custom fields in to file for translation: ok', 'geodirectory')."</li>"; |
|
1771 | 1771 | $info_div_class = "geodir_noproblem_info"; |
1772 | 1772 | $fix_button_txt = ''; |
1773 | 1773 | } |
@@ -1809,17 +1809,17 @@ discard block |
||
1809 | 1809 | global $wpdb, $wp_query, $plugin_prefix; |
1810 | 1810 | |
1811 | 1811 | 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'])) { |
1812 | - $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
1812 | + $table = $plugin_prefix.$wp_query->query_vars['post_type'].'_detail'; |
|
1813 | 1813 | |
1814 | - $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
1814 | + $join = $clauses['join'].' INNER JOIN '.$table.' AS gd_posts ON (gd_posts.post_id = '.$wpdb->posts.'.ID)'; |
|
1815 | 1815 | $clauses['join'] = $join; |
1816 | 1816 | |
1817 | - $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
1817 | + $fields = $clauses['fields'] != '' ? $clauses['fields'].', ' : ''; |
|
1818 | 1818 | $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'; |
1819 | 1819 | $clauses['fields'] = $fields; |
1820 | 1820 | |
1821 | 1821 | $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
1822 | - $orderby = 'gd_expire ' . $order; |
|
1822 | + $orderby = 'gd_expire '.$order; |
|
1823 | 1823 | $clauses['orderby'] = $orderby; |
1824 | 1824 | } |
1825 | 1825 | return $clauses; |
@@ -1862,7 +1862,7 @@ discard block |
||
1862 | 1862 | global $current_user; |
1863 | 1863 | $upload_dir = wp_upload_dir(); |
1864 | 1864 | |
1865 | - $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
1865 | + $file = $upload_dir['path'].'/temp_'.$current_user->data->ID.'/geodir_tmp.csv'; |
|
1866 | 1866 | $handle = fopen($file, 'w'); |
1867 | 1867 | |
1868 | 1868 | fwrite($handle, $input); |
@@ -1907,7 +1907,7 @@ discard block |
||
1907 | 1907 | $uploads_dir = $uploads['path']; |
1908 | 1908 | $image_name_arr = explode('/', $filename); |
1909 | 1909 | $filename = end($image_name_arr); |
1910 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
1910 | + $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
1911 | 1911 | $return = array(); |
1912 | 1912 | $return['file'] = $uploadedFile; |
1913 | 1913 | $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory'); |
@@ -1924,8 +1924,8 @@ discard block |
||
1924 | 1924 | |
1925 | 1925 | if (($handle = fopen($target_path, "r")) !== FALSE) { |
1926 | 1926 | while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { |
1927 | - if(is_array($data) && !empty($data)) { |
|
1928 | - $file[] = '"' . implode('","', $data) . '"'; |
|
1927 | + if (is_array($data) && !empty($data)) { |
|
1928 | + $file[] = '"'.implode('","', $data).'"'; |
|
1929 | 1929 | } |
1930 | 1930 | } |
1931 | 1931 | fclose($handle); |
@@ -2042,10 +2042,10 @@ discard block |
||
2042 | 2042 | $tag_arr = explode(',', $post_tags); |
2043 | 2043 | } |
2044 | 2044 | |
2045 | - $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
2045 | + $table = $plugin_prefix.$buffer[5].'_detail'; // check table in database |
|
2046 | 2046 | |
2047 | 2047 | $error = ''; |
2048 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) { |
|
2048 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$table."'") != $table) { |
|
2049 | 2049 | $invalid_post_type++; |
2050 | 2050 | continue; |
2051 | 2051 | } |
@@ -2071,7 +2071,7 @@ discard block |
||
2071 | 2071 | if ($buffer[$c] != '0' && $buffer[$c] != '') { |
2072 | 2072 | $submitdata = date('Y-m-d'); |
2073 | 2073 | |
2074 | - $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days")); |
|
2074 | + $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata."+".addslashes($buffer[$c])." days")); |
|
2075 | 2075 | } else { |
2076 | 2076 | $gd_post_info['expire_date'] = 'Never'; |
2077 | 2077 | } |
@@ -2099,7 +2099,7 @@ discard block |
||
2099 | 2099 | |
2100 | 2100 | // Post status |
2101 | 2101 | if ($customKeyarray[$c] == 'post_status') { |
2102 | - $post_status = sanitize_key( $buffer[$c] ); |
|
2102 | + $post_status = sanitize_key($buffer[$c]); |
|
2103 | 2103 | } |
2104 | 2104 | } |
2105 | 2105 | |
@@ -2117,8 +2117,8 @@ discard block |
||
2117 | 2117 | |
2118 | 2118 | // Default post status |
2119 | 2119 | $default_status = 'publish'; |
2120 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
2121 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
2120 | + $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status; |
|
2121 | + $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status; |
|
2122 | 2122 | |
2123 | 2123 | $my_post['post_title'] = $post_title; |
2124 | 2124 | $my_post['post_content'] = $post_desc; |
@@ -2162,7 +2162,7 @@ discard block |
||
2162 | 2162 | $payment_info = array(); |
2163 | 2163 | $package_info = array(); |
2164 | 2164 | |
2165 | - $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
2165 | + $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]); |
|
2166 | 2166 | $package_id = ''; |
2167 | 2167 | if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') { |
2168 | 2168 | $package_id = $gd_post_info['package_id']; |
@@ -2172,7 +2172,7 @@ discard block |
||
2172 | 2172 | $payment_info['package_id'] = $package_info['pid']; |
2173 | 2173 | |
2174 | 2174 | if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) { |
2175 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days")); |
|
2175 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['alive_days']." days")); |
|
2176 | 2176 | } else { |
2177 | 2177 | $payment_info['expire_date'] = 'Never'; |
2178 | 2178 | } |
@@ -2184,7 +2184,7 @@ discard block |
||
2184 | 2184 | |
2185 | 2185 | $post_type = get_post_type($last_postid); |
2186 | 2186 | |
2187 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
2187 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
2188 | 2188 | |
2189 | 2189 | geodir_save_post_info($last_postid, $gd_post_info); |
2190 | 2190 | |
@@ -2205,7 +2205,7 @@ discard block |
||
2205 | 2205 | $attachment['post_id'] = $last_postid; |
2206 | 2206 | $attachment['title'] = $img_name_arr[0]; |
2207 | 2207 | $attachment['content'] = ''; |
2208 | - $attachment['file'] = $sub_dir . '/' . $image_name; |
|
2208 | + $attachment['file'] = $sub_dir.'/'.$image_name; |
|
2209 | 2209 | $attachment['mime_type'] = $uploaded_file_type; |
2210 | 2210 | $attachment['menu_order'] = $menu_order; |
2211 | 2211 | $attachment['is_featured'] = 0; |
@@ -2214,15 +2214,15 @@ discard block |
||
2214 | 2214 | |
2215 | 2215 | foreach ($attachment as $key => $val) { |
2216 | 2216 | if ($val != '') |
2217 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
2217 | + $attachment_set .= $key." = '".$val."', "; |
|
2218 | 2218 | } |
2219 | 2219 | $attachment_set = trim($attachment_set, ", "); |
2220 | 2220 | |
2221 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set); |
|
2221 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set); |
|
2222 | 2222 | |
2223 | 2223 | if ($menu_order == 1) { |
2224 | 2224 | $post_type = get_post_type($last_postid); |
2225 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid))); |
|
2225 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($sub_dir.'/'.$image_name, $last_postid))); |
|
2226 | 2226 | } |
2227 | 2227 | $menu_order++; |
2228 | 2228 | } |
@@ -2263,11 +2263,11 @@ discard block |
||
2263 | 2263 | } |
2264 | 2264 | |
2265 | 2265 | // Add the tab in left sidebar menu fro import & export page. |
2266 | -add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 ); |
|
2266 | +add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94); |
|
2267 | 2267 | |
2268 | 2268 | // Handle ajax request for import/export. |
2269 | -add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' ); |
|
2270 | -add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' ); |
|
2269 | +add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export'); |
|
2270 | +add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export'); |
|
2271 | 2271 | |
2272 | 2272 | |
2273 | 2273 | /** |
@@ -2278,40 +2278,40 @@ discard block |
||
2278 | 2278 | * @param $post_id int $post_id The post ID of the post being saved. |
2279 | 2279 | * @param $post object $post The post object of the post being saved. |
2280 | 2280 | */ |
2281 | -function geodir_update_location_prefix($post_id,$post){ |
|
2282 | - if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){ |
|
2283 | - update_option('geodir_location_prefix',$post->post_name); |
|
2281 | +function geodir_update_location_prefix($post_id, $post) { |
|
2282 | + if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) { |
|
2283 | + update_option('geodir_location_prefix', $post->post_name); |
|
2284 | 2284 | } |
2285 | 2285 | |
2286 | 2286 | } |
2287 | 2287 | |
2288 | -add_action('save_post', 'geodir_update_location_prefix',10,2); |
|
2288 | +add_action('save_post', 'geodir_update_location_prefix', 10, 2); |
|
2289 | 2289 | |
2290 | -add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' ); |
|
2290 | +add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback'); |
|
2291 | 2291 | |
2292 | -function geodir_ga_callback(){ |
|
2292 | +function geodir_ga_callback() { |
|
2293 | 2293 | |
2294 | -if(isset($_REQUEST['code']) && $_REQUEST['code']) { |
|
2294 | +if (isset($_REQUEST['code']) && $_REQUEST['code']) { |
|
2295 | 2295 | $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
2296 | 2296 | $code = "code=".$_REQUEST['code']; |
2297 | 2297 | $grant_type = "&grant_type=authorization_code"; |
2298 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback"; |
|
2298 | + $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback"; |
|
2299 | 2299 | $client_id = "&client_id=".get_option('geodir_ga_client_id'); |
2300 | 2300 | $client_secret = "&client_secret=".get_option('geodir_ga_client_secret'); |
2301 | 2301 | |
2302 | - $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
2302 | + $auth_url = $oAuthURL.$code.$redirect_uri.$grant_type.$client_id.$client_secret; |
|
2303 | 2303 | |
2304 | 2304 | $response = wp_remote_post($auth_url, array('timeout' => 15)); |
2305 | 2305 | |
2306 | 2306 | //print_r($response); |
2307 | 2307 | |
2308 | - $error_msg = __('Something went wrong','geodirectory'); |
|
2309 | - if(!empty($response['response']['code']) && $response['response']['code']==200){ |
|
2308 | + $error_msg = __('Something went wrong', 'geodirectory'); |
|
2309 | + if (!empty($response['response']['code']) && $response['response']['code'] == 200) { |
|
2310 | 2310 | |
2311 | 2311 | $parts = json_decode($response['body']); |
2312 | 2312 | //print_r($parts); |
2313 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} |
|
2314 | - else{ |
|
2313 | + if (!isset($parts->access_token)) {echo $error_msg." - #1"; exit; } |
|
2314 | + else { |
|
2315 | 2315 | |
2316 | 2316 | update_option('gd_ga_access_token', $parts->access_token); |
2317 | 2317 | update_option('gd_ga_refresh_token', $parts->refresh_token); |
@@ -2320,18 +2320,18 @@ discard block |
||
2320 | 2320 | |
2321 | 2321 | |
2322 | 2322 | } |
2323 | - elseif(!empty($response['response']['code'])) { |
|
2323 | + elseif (!empty($response['response']['code'])) { |
|
2324 | 2324 | $parts = json_decode($response['body']); |
2325 | 2325 | |
2326 | - if(isset($parts->error)){ |
|
2327 | - echo $parts->error.": ".$parts->error_description;exit; |
|
2328 | - }else{ |
|
2329 | - echo $error_msg." - #2";exit; |
|
2326 | + if (isset($parts->error)) { |
|
2327 | + echo $parts->error.": ".$parts->error_description; exit; |
|
2328 | + } else { |
|
2329 | + echo $error_msg." - #2"; exit; |
|
2330 | 2330 | } |
2331 | 2331 | |
2332 | - }else{ |
|
2332 | + } else { |
|
2333 | 2333 | |
2334 | - echo $error_msg." - #3";exit; |
|
2334 | + echo $error_msg." - #3"; exit; |
|
2335 | 2335 | |
2336 | 2336 | } |
2337 | 2337 | } |
@@ -2353,7 +2353,7 @@ discard block |
||
2353 | 2353 | function geodir_uninstall_settings($general_settings) { |
2354 | 2354 | $settings = array(); |
2355 | 2355 | $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory')); |
2356 | - $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' )); |
|
2356 | + $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory')); |
|
2357 | 2357 | |
2358 | 2358 | $plugins = get_plugins(); |
2359 | 2359 | $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array()); |
@@ -2365,7 +2365,7 @@ discard block |
||
2365 | 2365 | if (in_array($plugin_name, $un_plugins)) { |
2366 | 2366 | $settings[] = array( |
2367 | 2367 | 'type' => 'checkbox', |
2368 | - 'id' => 'geodir_un_' . $plugin_name, |
|
2368 | + 'id' => 'geodir_un_'.$plugin_name, |
|
2369 | 2369 | 'name' => $data['Name'], |
2370 | 2370 | 'desc' => __('Remove all data when deleted?', 'geodirectory'), |
2371 | 2371 | 'std' => '0' |
@@ -2399,7 +2399,7 @@ discard block |
||
2399 | 2399 | * @since 1.6.9 |
2400 | 2400 | */ |
2401 | 2401 | function geodir_uninstall_settings_desc() { |
2402 | - 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>'; |
|
2402 | + 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>'; |
|
2403 | 2403 | } |
2404 | 2404 | add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc'); |
2405 | 2405 |