|
@@ -62,7 +62,7 @@ discard block |
|
|
block discarded – undo |
|
62
|
62
|
*/
|
|
63
|
63
|
function geodir_get_admin_option_form($current_tab)
|
|
64
|
64
|
{
|
|
65
|
|
- geodir_admin_option_form($current_tab);// defined in admin template tags.php
|
|
|
65
|
+ geodir_admin_option_form($current_tab); // defined in admin template tags.php
|
|
66
|
66
|
}
|
|
67
|
67
|
|
|
68
|
68
|
|
|
@@ -70,7 +70,7 @@ discard block |
|
|
block discarded – undo |
|
70
|
70
|
add_action('geodir_update_options_compatibility_settings', 'geodir_update_options_compatibility_settings');
|
|
71
|
71
|
add_action('geodir_update_options_default_location_settings', 'geodir_location_form_submit');
|
|
72
|
72
|
add_action('geodir_before_admin_panel', 'geodir_before_admin_panel'); // this function is in admin_functions.php
|
|
73
|
|
-add_action('geodir_before_update_options', 'geodir_before_update_options',10,2);
|
|
|
73
|
+add_action('geodir_before_update_options', 'geodir_before_update_options', 10, 2);
|
|
74
|
74
|
|
|
75
|
75
|
//add_action('geodir_before_admin_panel', 'geodir_autoinstall_admin_header');
|
|
76
|
76
|
|
|
@@ -99,7 +99,7 @@ discard block |
|
|
block discarded – undo |
|
99
|
99
|
|
|
100
|
100
|
// Disable VC editor for GD post types.
|
|
101
|
101
|
if (class_exists('Vc_Role_Access_Controller')) {
|
|
102
|
|
- add_filter( 'vc_role_access_with_post_types_can', '__return_false', 100 );
|
|
|
102
|
+ add_filter('vc_role_access_with_post_types_can', '__return_false', 100);
|
|
103
|
103
|
}
|
|
104
|
104
|
}
|
|
105
|
105
|
|
|
@@ -126,8 +126,8 @@ discard block |
|
|
block discarded – undo |
|
126
|
126
|
add_action('admin_panel_init', 'geodir_admin_list_columns', 2);
|
|
127
|
127
|
|
|
128
|
128
|
/* --- insert dummy post action ---*/
|
|
129
|
|
-add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1,3);
|
|
130
|
|
-add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1,3);
|
|
|
129
|
+add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1, 3);
|
|
|
130
|
+add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1, 3);
|
|
131
|
131
|
|
|
132
|
132
|
|
|
133
|
133
|
/**
|
|
@@ -236,9 +236,9 @@ discard block |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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
|
|
|
@@ -986,7 +986,7 @@ discard block |
|
|
block discarded – undo |
|
986
|
986
|
case 'diagnosis' :
|
|
987
|
987
|
if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
|
|
988
|
988
|
$diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
|
|
989
|
|
- call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
|
989
|
+ call_user_func('geodir_diagnose_'.$diagnose_this);
|
|
990
|
990
|
|
|
991
|
991
|
}
|
|
992
|
992
|
exit();
|
|
@@ -995,7 +995,7 @@ discard block |
|
|
block discarded – undo |
|
995
|
995
|
case 'diagnosis-fix' :
|
|
996
|
996
|
if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
|
|
997
|
997
|
$diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
|
|
998
|
|
- call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
|
998
|
+ call_user_func('geodir_diagnose_'.$diagnose_this);
|
|
999
|
999
|
exit();
|
|
1000
|
1000
|
break;
|
|
1001
|
1001
|
}
|
|
@@ -1020,50 +1020,50 @@ discard block |
|
|
block discarded – undo |
|
1020
|
1020
|
{
|
|
1021
|
1021
|
global $wpdb;
|
|
1022
|
1022
|
//$filter_arr['output_str'] .='###'.$table.'###';
|
|
1023
|
|
- if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
|
|
1024
|
|
- $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
|
|
|
1023
|
+ if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0) {
|
|
|
1024
|
+ $filter_arr['output_str'] .= "<li>".__('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory')."</li>";
|
|
1025
|
1025
|
$filter_arr['is_error_during_diagnose'] = true;
|
|
1026
|
1026
|
|
|
1027
|
|
- } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
1028
|
|
- $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
|
|
|
1027
|
+ } elseif ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
|
|
|
1028
|
+ $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name)."</li>";
|
|
1029
|
1029
|
$filter_arr['is_error_during_diagnose'] = true;
|
|
1030
|
|
- $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>";
|
|
|
1030
|
+ $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>";
|
|
1031
|
1031
|
$filter_arr['is_error_during_diagnose'] = true;
|
|
1032
|
1032
|
|
|
1033
|
1033
|
if ($fix) {
|
|
1034
|
|
- $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
|
|
1035
|
|
- $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
|
|
|
1034
|
+ $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$table."_ms_bak"); // get backup table count
|
|
|
1035
|
+ $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table"); // get new table count
|
|
1036
|
1036
|
|
|
1037
|
1037
|
if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
|
|
1038
|
1038
|
//$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
|
|
1039
|
1039
|
|
|
1040
|
|
- $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
|
|
|
1040
|
+ $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename bak table to new table
|
|
1041
|
1041
|
|
|
1042
|
|
- if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
1043
|
|
- $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
|
|
|
1042
|
+ if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
|
|
|
1043
|
+ $filter_arr['output_str'] .= "<li>".__('-->FIXED: Renamed and backed up the tables', 'geodirectory')."</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 ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
|
|
1049
|
1049
|
|
|
1050
|
|
- $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
|
|
1051
|
|
- $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
|
|
|
1050
|
+ $wpdb->query("RENAME TABLE ".$wpdb->prefix."$table TO ".$table."_ms_bak2"); // rename new table to bak2
|
|
|
1051
|
+ $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$wpdb->prefix."$table"); // rename bak table to new table
|
|
1052
|
1052
|
|
|
1053
|
|
- if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
1054
|
|
- $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
|
|
|
1053
|
+ if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
|
1054
|
+ $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table)."</li>";
|
|
1055
|
1055
|
} else {
|
|
1056
|
|
- $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
|
1056
|
+ $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
1057
|
1057
|
}
|
|
1058
|
1058
|
|
|
1059
|
1059
|
} elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
|
|
1060
|
1060
|
|
|
1061
|
|
- $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
|
|
|
1061
|
+ $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename ms_bak table to ms_bak2
|
|
1062
|
1062
|
|
|
1063
|
|
- if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
1064
|
|
- $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
|
|
|
1063
|
+ if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
|
|
|
1064
|
+ $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table)."</li>";
|
|
1065
|
1065
|
} else {
|
|
1066
|
|
- $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
|
1066
|
+ $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
1067
|
1067
|
}
|
|
1068
|
1068
|
|
|
1069
|
1069
|
}
|
|
@@ -1071,54 +1071,54 @@ discard block |
|
|
block discarded – undo |
|
1071
|
1071
|
}
|
|
1072
|
1072
|
|
|
1073
|
1073
|
|
|
1074
|
|
- } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
1075
|
|
- $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
|
|
|
1074
|
+ } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
|
|
|
1075
|
+ $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name)."</li>";
|
|
1076
|
1076
|
$filter_arr['is_error_during_diagnose'] = true;
|
|
1077
|
1077
|
|
|
1078
|
1078
|
if ($fix) {
|
|
1079
|
1079
|
if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
|
|
1080
|
1080
|
if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
|
|
1081
|
|
- $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
|
|
|
1081
|
+ $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table)."</li>";
|
|
1082
|
1082
|
} else {
|
|
1083
|
|
- $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
|
|
|
1083
|
+ $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table)."</li>";
|
|
1084
|
1084
|
}
|
|
1085
|
1085
|
|
|
1086
|
|
- } 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
|
|
1087
|
|
- if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
|
|
1088
|
|
- $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
|
1086
|
+ } 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
|
|
|
1087
|
+ if ($wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."$table")) {
|
|
|
1088
|
+ $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix.$table)."</li>";
|
|
1089
|
1089
|
} else {
|
|
1090
|
|
- $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
|
1090
|
+ $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix.$table)."</li>";
|
|
1091
|
1091
|
}
|
|
1092
|
|
- if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
1093
|
|
- $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
|
1092
|
+ if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
|
1093
|
+ $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
1094
|
1094
|
} else {
|
|
1095
|
|
- $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>";
|
|
|
1095
|
+ $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>";
|
|
1096
|
1096
|
}
|
|
1097
|
1097
|
} else {// else rename the original table to _ms_bak
|
|
1098
|
|
- if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
1099
|
|
- $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>";
|
|
|
1098
|
+ if ($wpdb->query("RENAME TABLE $table TO ".$table."_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
|
1099
|
+ $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>";
|
|
1100
|
1100
|
} else {
|
|
1101
|
|
- $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>";
|
|
|
1101
|
+ $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>";
|
|
1102
|
1102
|
}
|
|
1103
|
1103
|
}
|
|
1104
|
1104
|
}
|
|
1105
|
1105
|
|
|
1106
|
|
- } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
1107
|
|
- $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
|
|
|
1106
|
+ } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
|
|
|
1107
|
+ $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name)."</li>";
|
|
1108
|
1108
|
$filter_arr['is_error_during_diagnose'] = true;
|
|
1109
|
1109
|
|
|
1110
|
1110
|
if ($fix) {
|
|
1111
|
1111
|
// if original table exists but new does not, rename
|
|
1112
|
|
- if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
1113
|
|
- $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
|
1112
|
+ if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
|
1113
|
+ $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
1114
|
1114
|
} else {
|
|
1115
|
|
- $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>";
|
|
|
1115
|
+ $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>";
|
|
1116
|
1116
|
}
|
|
1117
|
1117
|
|
|
1118
|
1118
|
}
|
|
1119
|
1119
|
|
|
1120
|
|
- } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
1121
|
|
- $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
|
|
|
1120
|
+ } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
|
|
|
1121
|
+ $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name)."</li>";
|
|
1122
|
1122
|
$filter_arr['is_error_during_diagnose'] = true;
|
|
1123
|
1123
|
|
|
1124
|
1124
|
if ($fix) {
|
|
@@ -1132,11 +1132,11 @@ discard block |
|
|
block discarded – undo |
|
1132
|
1132
|
delete_option('geodir_custom_posts_db_version');
|
|
1133
|
1133
|
delete_option('geodir_reviewratings_db_version');
|
|
1134
|
1134
|
delete_option('geodiradvancesearch_db_version');
|
|
1135
|
|
- $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
|
|
|
1135
|
+ $filter_arr['output_str'] .= "<li>".__('-->TRY: Please refresh page to run table install functions', 'geodirectory')."</li>";
|
|
1136
|
1136
|
}
|
|
1137
|
1137
|
|
|
1138
|
1138
|
} else {
|
|
1139
|
|
- $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
|
|
|
1139
|
+ $filter_arr['output_str'] .= "<li>".sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name)."</li>";
|
|
1140
|
1140
|
}
|
|
1141
|
1141
|
return $filter_arr;
|
|
1142
|
1142
|
}
|
|
@@ -1177,21 +1177,21 @@ discard block |
|
|
block discarded – undo |
|
1177
|
1177
|
}
|
|
1178
|
1178
|
|
|
1179
|
1179
|
if ($stepped_process) {
|
|
1180
|
|
- $sql = $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $ptype . "_detail LIMIT %d OFFSET %d", $step_max_items, $offset );
|
|
1181
|
|
- $posts = $wpdb->get_results( $sql );
|
|
|
1180
|
+ $sql = $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."geodir_".$ptype."_detail LIMIT %d OFFSET %d", $step_max_items, $offset);
|
|
|
1181
|
+ $posts = $wpdb->get_results($sql);
|
|
1182
|
1182
|
|
|
1183
|
1183
|
if (!empty($posts)) {
|
|
1184
|
1184
|
|
|
1185
|
1185
|
foreach ($posts as $p) {
|
|
1186
|
1186
|
$p->post_type = $ptype;
|
|
1187
|
|
- $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
|
1187
|
+ $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
|
|
1188
|
1188
|
if (empty($raw_tags)) {
|
|
1189
|
1189
|
$post_tags = '';
|
|
1190
|
1190
|
} else {
|
|
1191
|
1191
|
$post_tags = implode(",", $raw_tags);
|
|
1192
|
1192
|
}
|
|
1193
|
|
- $tablename = $plugin_prefix . $p->post_type . '_detail';
|
|
1194
|
|
- $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
|
1193
|
+ $tablename = $plugin_prefix.$p->post_type.'_detail';
|
|
|
1194
|
+ $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
1195
|
1195
|
|
|
1196
|
1196
|
}
|
|
1197
|
1197
|
if ($step >= $max_step) {
|
|
@@ -1207,23 +1207,23 @@ discard block |
|
|
block discarded – undo |
|
1207
|
1207
|
if (!empty($all_postypes)) {
|
|
1208
|
1208
|
foreach ($all_postypes as $key) {
|
|
1209
|
1209
|
// update each GD CPT
|
|
1210
|
|
- $posts = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail");
|
|
|
1210
|
+ $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail");
|
|
1211
|
1211
|
|
|
1212
|
1212
|
if (!empty($posts)) {
|
|
1213
|
1213
|
|
|
1214
|
1214
|
foreach ($posts as $p) {
|
|
1215
|
1215
|
$p->post_type = $key;
|
|
1216
|
|
- $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
|
1216
|
+ $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
|
|
1217
|
1217
|
if (empty($raw_tags)) {
|
|
1218
|
1218
|
$post_tags = '';
|
|
1219
|
1219
|
} else {
|
|
1220
|
1220
|
$post_tags = implode(",", $raw_tags);
|
|
1221
|
1221
|
}
|
|
1222
|
|
- $tablename = $plugin_prefix . $p->post_type . '_detail';
|
|
1223
|
|
- $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
|
1222
|
+ $tablename = $plugin_prefix.$p->post_type.'_detail';
|
|
|
1223
|
+ $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
1224
|
1224
|
|
|
1225
|
1225
|
}
|
|
1226
|
|
- $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
|
1226
|
+ $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
|
|
1227
|
1227
|
}
|
|
1228
|
1228
|
|
|
1229
|
1229
|
}
|
|
@@ -1234,14 +1234,14 @@ discard block |
|
|
block discarded – undo |
|
1234
|
1234
|
|
|
1235
|
1235
|
if ($is_error_during_diagnose) {
|
|
1236
|
1236
|
$info_div_class = "geodir_problem_info";
|
|
1237
|
|
- $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
|
1237
|
+ $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
1238
|
1238
|
} else {
|
|
1239
|
1239
|
$info_div_class = "geodir_noproblem_info";
|
|
1240
|
1240
|
$fix_button_txt = '';
|
|
1241
|
1241
|
}
|
|
1242
|
1242
|
|
|
1243
|
1243
|
if ($stepped_process) {
|
|
1244
|
|
- $percent = ($step/$max_step) * 100;
|
|
|
1244
|
+ $percent = ($step / $max_step) * 100;
|
|
1245
|
1245
|
if ($output_str == 'done') {
|
|
1246
|
1246
|
echo $output_str;
|
|
1247
|
1247
|
} else {
|
|
@@ -1284,29 +1284,29 @@ discard block |
|
|
block discarded – undo |
|
1284
|
1284
|
if (!empty($all_postypes)) {
|
|
1285
|
1285
|
foreach ($all_postypes as $key) {
|
|
1286
|
1286
|
// update each GD CTP
|
|
1287
|
|
- $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
|
|
|
1287
|
+ $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d WHERE d.".$key."category='' ");
|
|
1288
|
1288
|
|
|
1289
|
1289
|
if (!empty($posts)) {
|
|
1290
|
1290
|
|
|
1291
|
1291
|
foreach ($posts as $p) {
|
|
1292
|
1292
|
$p->post_type = $key;
|
|
1293
|
|
- $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
|
|
|
1293
|
+ $raw_cats = wp_get_object_terms($p->post_id, $p->post_type.'category', array('fields' => 'ids'));
|
|
1294
|
1294
|
|
|
1295
|
1295
|
if (empty($raw_cats)) {
|
|
1296
|
1296
|
$post_categories = get_post_meta($p->post_id, 'post_categories', true);
|
|
1297
|
1297
|
|
|
1298
|
|
- if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
|
|
1299
|
|
- $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
|
|
1300
|
|
- foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
|
|
|
1298
|
+ if (!empty($post_categories) && !empty($post_categories[$p->post_type.'category'])) {
|
|
|
1299
|
+ $post_categories[$p->post_type.'category'] = str_replace("d:", "", $post_categories[$p->post_type.'category']);
|
|
|
1300
|
+ foreach (explode(",", $post_categories[$p->post_type.'category']) as $cat_part) {
|
|
1301
|
1301
|
if (is_numeric($cat_part)) {
|
|
1302
|
|
- $raw_cats[] = (int)$cat_part;
|
|
|
1302
|
+ $raw_cats[] = (int) $cat_part;
|
|
1303
|
1303
|
}
|
|
1304
|
1304
|
}
|
|
1305
|
1305
|
|
|
1306
|
1306
|
}
|
|
1307
|
1307
|
|
|
1308
|
1308
|
if (!empty($raw_cats)) {
|
|
1309
|
|
- $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category');
|
|
|
1309
|
+ $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type.'category');
|
|
1310
|
1310
|
|
|
1311
|
1311
|
}
|
|
1312
|
1312
|
|
|
@@ -1316,14 +1316,14 @@ discard block |
|
|
block discarded – undo |
|
1316
|
1316
|
if (empty($raw_cats)) {
|
|
1317
|
1317
|
$post_cats = '';
|
|
1318
|
1318
|
} else {
|
|
1319
|
|
- $post_cats = ',' . implode(",", $raw_cats) . ',';
|
|
|
1319
|
+ $post_cats = ','.implode(",", $raw_cats).',';
|
|
1320
|
1320
|
}
|
|
1321
|
|
- $tablename = $plugin_prefix . $p->post_type . '_detail';
|
|
1322
|
|
- $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
|
1321
|
+ $tablename = $plugin_prefix.$p->post_type.'_detail';
|
|
|
1322
|
+ $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET ".$p->post_type."category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
1323
|
1323
|
}
|
|
1324
|
1324
|
|
|
1325
|
1325
|
}
|
|
1326
|
|
- $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
|
1326
|
+ $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
|
|
1327
|
1327
|
|
|
1328
|
1328
|
}
|
|
1329
|
1329
|
|
|
@@ -1331,7 +1331,7 @@ discard block |
|
|
block discarded – undo |
|
1331
|
1331
|
|
|
1332
|
1332
|
if ($is_error_during_diagnose) {
|
|
1333
|
1333
|
$info_div_class = "geodir_problem_info";
|
|
1334
|
|
- $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
|
1334
|
+ $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
1335
|
1335
|
} else {
|
|
1336
|
1336
|
$info_div_class = "geodir_noproblem_info";
|
|
1337
|
1337
|
$fix_button_txt = '';
|
|
@@ -1384,15 +1384,15 @@ discard block |
|
|
block discarded – undo |
|
1384
|
1384
|
if (!empty($ver_arr)) {
|
|
1385
|
1385
|
foreach ($ver_arr as $key => $val) {
|
|
1386
|
1386
|
if (delete_option($val)) {
|
|
1387
|
|
- $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
|
|
|
1387
|
+ $output_str .= "<li>".$key.__(' Version: Deleted', 'geodirectory')."</li>";
|
|
1388
|
1388
|
} else {
|
|
1389
|
|
- $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
|
|
|
1389
|
+ $output_str .= "<li>".$key.__(' Version: Not Found', 'geodirectory')."</li>";
|
|
1390
|
1390
|
}
|
|
1391
|
1391
|
|
|
1392
|
1392
|
}
|
|
1393
|
1393
|
|
|
1394
|
1394
|
if ($output_str) {
|
|
1395
|
|
- $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
|
|
|
1395
|
+ $output_str .= "<li><strong>".__(' Upgrade/install scripts will run on next page reload.', 'geodirectory')."</strong></li>";
|
|
1396
|
1396
|
}
|
|
1397
|
1397
|
|
|
1398
|
1398
|
}
|
|
@@ -1429,43 +1429,43 @@ discard block |
|
|
block discarded – undo |
|
1429
|
1429
|
$output_str = '';
|
|
1430
|
1430
|
|
|
1431
|
1431
|
// check review locations
|
|
1432
|
|
- 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")) {
|
|
1433
|
|
- $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
|
|
|
1432
|
+ 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")) {
|
|
|
1433
|
+ $output_str .= "<li>".__('Review locations missing or broken', 'geodirectory')."</li>";
|
|
1434
|
1434
|
$is_error_during_diagnose = true;
|
|
1435
|
1435
|
|
|
1436
|
1436
|
if ($fix) {
|
|
1437
|
1437
|
if (geodir_fix_review_location()) {
|
|
1438
|
|
- $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
|
|
|
1438
|
+ $output_str .= "<li><strong>".__('-->FIXED: Review locations fixed', 'geodirectory')."</strong></li>";
|
|
1439
|
1439
|
} else {
|
|
1440
|
|
- $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
|
|
|
1440
|
+ $output_str .= "<li><strong>".__('-->FAILED: Review locations fix failed', 'geodirectory')."</strong></li>";
|
|
1441
|
1441
|
}
|
|
1442
|
1442
|
}
|
|
1443
|
1443
|
|
|
1444
|
1444
|
} else {
|
|
1445
|
|
- $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
|
|
|
1445
|
+ $output_str .= "<li>".__('Review locations ok', 'geodirectory')."</li>";
|
|
1446
|
1446
|
}
|
|
1447
|
1447
|
|
|
1448
|
1448
|
// check review content
|
|
1449
|
|
- if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
|
|
1450
|
|
- $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
|
|
|
1449
|
+ if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_content IS NULL")) {
|
|
|
1450
|
+ $output_str .= "<li>".__('Review content missing or broken', 'geodirectory')."</li>";
|
|
1451
|
1451
|
$is_error_during_diagnose = true;
|
|
1452
|
1452
|
|
|
1453
|
1453
|
if ($fix) {
|
|
1454
|
1454
|
if (geodir_fix_review_content()) {
|
|
1455
|
|
- $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
|
|
|
1455
|
+ $output_str .= "<li><strong>".__('-->FIXED: Review content fixed', 'geodirectory')."</strong></li>";
|
|
1456
|
1456
|
} else {
|
|
1457
|
|
- $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
|
|
|
1457
|
+ $output_str .= "<li><strong>".__('-->FAILED: Review content fix failed', 'geodirectory')."</strong></li>";
|
|
1458
|
1458
|
}
|
|
1459
|
1459
|
}
|
|
1460
|
1460
|
|
|
1461
|
1461
|
} else {
|
|
1462
|
|
- $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
|
|
|
1462
|
+ $output_str .= "<li>".__('Review content ok', 'geodirectory')."</li>";
|
|
1463
|
1463
|
}
|
|
1464
|
1464
|
|
|
1465
|
1465
|
|
|
1466
|
1466
|
if ($is_error_during_diagnose) {
|
|
1467
|
1467
|
$info_div_class = "geodir_problem_info";
|
|
1468
|
|
- $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
|
1468
|
+ $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
1469
|
1469
|
} else {
|
|
1470
|
1470
|
$info_div_class = "geodir_noproblem_info";
|
|
1471
|
1471
|
$fix_button_txt = '';
|
|
@@ -1529,7 +1529,7 @@ discard block |
|
|
block discarded – undo |
|
1529
|
1529
|
|
|
1530
|
1530
|
if ($is_error_during_diagnose) {
|
|
1531
|
1531
|
$info_div_class = "geodir_problem_info";
|
|
1532
|
|
- $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
|
1532
|
+ $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
1533
|
1533
|
} else {
|
|
1534
|
1534
|
$info_div_class = "geodir_noproblem_info";
|
|
1535
|
1535
|
$fix_button_txt = '';
|
|
@@ -1563,7 +1563,7 @@ discard block |
|
|
block discarded – undo |
|
1563
|
1563
|
else {
|
|
1564
|
1564
|
$page_found = $wpdb->get_var(
|
|
1565
|
1565
|
$wpdb->prepare(
|
|
1566
|
|
- "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
|
|
|
1566
|
+ "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;",
|
|
1567
|
1567
|
array($slug)
|
|
1568
|
1568
|
)
|
|
1569
|
1569
|
);
|
|
@@ -1609,18 +1609,18 @@ discard block |
|
|
block discarded – undo |
|
1609
|
1609
|
//////////////////////////////////
|
|
1610
|
1610
|
$option_value = get_option('geodir_home_page');
|
|
1611
|
1611
|
$page = get_post($option_value);
|
|
1612
|
|
- if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
|
1612
|
+ if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
1613
|
1613
|
|
|
1614
|
|
- if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
|
|
1615
|
|
- $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
|
|
|
1614
|
+ if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
|
|
|
1615
|
+ $output_str .= "<li>".__('GD Home page exists with proper setting.', 'geodirectory')."</li>";
|
|
1616
|
1616
|
else {
|
|
1617
|
1617
|
$is_error_during_diagnose = true;
|
|
1618
|
|
- $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
|
|
|
1618
|
+ $output_str .= "<li><strong>".__('GD Home page is missing.', 'geodirectory')."</strong></li>";
|
|
1619
|
1619
|
if ($fix) {
|
|
1620
|
1620
|
if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
|
|
1621
|
|
- $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
|
|
|
1621
|
+ $output_str .= "<li><strong>".__('-->FIXED: GD Home page fixed', 'geodirectory')."</strong></li>";
|
|
1622
|
1622
|
} else {
|
|
1623
|
|
- $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
|
|
|
1623
|
+ $output_str .= "<li><strong>".__('-->FAILED: GD Home page fix failed', 'geodirectory')."</strong></li>";
|
|
1624
|
1624
|
}
|
|
1625
|
1625
|
}
|
|
1626
|
1626
|
}
|
|
@@ -1634,18 +1634,18 @@ discard block |
|
|
block discarded – undo |
|
1634
|
1634
|
//////////////////////////////////
|
|
1635
|
1635
|
$option_value = get_option('geodir_add_listing_page');
|
|
1636
|
1636
|
$page = get_post($option_value);
|
|
1637
|
|
- if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
|
1637
|
+ if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
1638
|
1638
|
|
|
1639
|
|
- if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
|
|
1640
|
|
- $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
|
|
|
1639
|
+ if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
|
|
|
1640
|
+ $output_str .= "<li>".__('Add Listing page exists with proper setting.', 'geodirectory')."</li>";
|
|
1641
|
1641
|
else {
|
|
1642
|
1642
|
$is_error_during_diagnose = true;
|
|
1643
|
|
- $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
|
|
|
1643
|
+ $output_str .= "<li><strong>".__('Add Listing page is missing.', 'geodirectory')."</strong></li>";
|
|
1644
|
1644
|
if ($fix) {
|
|
1645
|
1645
|
if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
|
|
1646
|
|
- $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
|
|
|
1646
|
+ $output_str .= "<li><strong>".__('-->FIXED: Add Listing page fixed', 'geodirectory')."</strong></li>";
|
|
1647
|
1647
|
} else {
|
|
1648
|
|
- $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
|
|
|
1648
|
+ $output_str .= "<li><strong>".__('-->FAILED: Add Listing page fix failed', 'geodirectory')."</strong></li>";
|
|
1649
|
1649
|
}
|
|
1650
|
1650
|
}
|
|
1651
|
1651
|
}
|
|
@@ -1660,18 +1660,18 @@ discard block |
|
|
block discarded – undo |
|
1660
|
1660
|
//////////////////////////////////
|
|
1661
|
1661
|
$option_value = get_option('geodir_preview_page');
|
|
1662
|
1662
|
$page = get_post($option_value);
|
|
1663
|
|
- if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
|
1663
|
+ if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
1664
|
1664
|
|
|
1665
|
|
- if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
|
|
1666
|
|
- $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
|
|
|
1665
|
+ if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
|
|
|
1666
|
+ $output_str .= "<li>".__('Listing Preview page exists with proper setting.', 'geodirectory')."</li>";
|
|
1667
|
1667
|
else {
|
|
1668
|
1668
|
$is_error_during_diagnose = true;
|
|
1669
|
|
- $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
|
|
|
1669
|
+ $output_str .= "<li><strong>".__('Listing Preview page is missing.', 'geodirectory')."</strong></li>";
|
|
1670
|
1670
|
if ($fix) {
|
|
1671
|
1671
|
if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
|
|
1672
|
|
- $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
|
|
|
1672
|
+ $output_str .= "<li><strong>".__('-->FIXED: Listing Preview page fixed', 'geodirectory')."</strong></li>";
|
|
1673
|
1673
|
} else {
|
|
1674
|
|
- $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
|
|
|
1674
|
+ $output_str .= "<li><strong>".__('-->FAILED: Listing Preview page fix failed', 'geodirectory')."</strong></li>";
|
|
1675
|
1675
|
}
|
|
1676
|
1676
|
}
|
|
1677
|
1677
|
}
|
|
@@ -1685,18 +1685,18 @@ discard block |
|
|
block discarded – undo |
|
1685
|
1685
|
//////////////////////////////////
|
|
1686
|
1686
|
$option_value = get_option('geodir_success_page');
|
|
1687
|
1687
|
$page = get_post($option_value);
|
|
1688
|
|
- if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
|
1688
|
+ if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
1689
|
1689
|
|
|
1690
|
|
- if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
|
|
1691
|
|
- $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
|
|
|
1690
|
+ if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
|
|
|
1691
|
+ $output_str .= "<li>".__('Listing Success page exists with proper setting.', 'geodirectory')."</li>";
|
|
1692
|
1692
|
else {
|
|
1693
|
1693
|
$is_error_during_diagnose = true;
|
|
1694
|
|
- $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
|
|
|
1694
|
+ $output_str .= "<li><strong>".__('Listing Success page is missing.', 'geodirectory')."</strong></li>";
|
|
1695
|
1695
|
if ($fix) {
|
|
1696
|
1696
|
if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
|
|
1697
|
|
- $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
|
|
|
1697
|
+ $output_str .= "<li><strong>".__('-->FIXED: Listing Success page fixed', 'geodirectory')."</strong></li>";
|
|
1698
|
1698
|
} else {
|
|
1699
|
|
- $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
|
|
|
1699
|
+ $output_str .= "<li><strong>".__('-->FAILED: Listing Success page fix failed', 'geodirectory')."</strong></li>";
|
|
1700
|
1700
|
}
|
|
1701
|
1701
|
}
|
|
1702
|
1702
|
}
|
|
@@ -1710,18 +1710,18 @@ discard block |
|
|
block discarded – undo |
|
1710
|
1710
|
//////////////////////////////////
|
|
1711
|
1711
|
$option_value = get_option('geodir_info_page');
|
|
1712
|
1712
|
$page = get_post($option_value);
|
|
1713
|
|
- if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
|
1713
|
+ if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
1714
|
1714
|
|
|
1715
|
|
- if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
|
|
1716
|
|
- $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
|
|
|
1715
|
+ if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
|
|
|
1716
|
+ $output_str .= "<li>".__('Info page exists with proper setting.', 'geodirectory')."</li>";
|
|
1717
|
1717
|
else {
|
|
1718
|
1718
|
$is_error_during_diagnose = true;
|
|
1719
|
|
- $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
|
|
|
1719
|
+ $output_str .= "<li><strong>".__('Info page is missing.', 'geodirectory')."</strong></li>";
|
|
1720
|
1720
|
if ($fix) {
|
|
1721
|
1721
|
if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
|
|
1722
|
|
- $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
|
|
|
1722
|
+ $output_str .= "<li><strong>".__('-->FIXED: Info page fixed', 'geodirectory')."</strong></li>";
|
|
1723
|
1723
|
} else {
|
|
1724
|
|
- $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
|
|
|
1724
|
+ $output_str .= "<li><strong>".__('-->FAILED: Info page fix failed', 'geodirectory')."</strong></li>";
|
|
1725
|
1725
|
}
|
|
1726
|
1726
|
}
|
|
1727
|
1727
|
}
|
|
@@ -1735,18 +1735,18 @@ discard block |
|
|
block discarded – undo |
|
1735
|
1735
|
//////////////////////////////////
|
|
1736
|
1736
|
$option_value = get_option('geodir_login_page');
|
|
1737
|
1737
|
$page = get_post($option_value);
|
|
1738
|
|
- if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
|
1738
|
+ if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
1739
|
1739
|
|
|
1740
|
|
- if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
|
|
1741
|
|
- $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
|
|
|
1740
|
+ if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
|
|
|
1741
|
+ $output_str .= "<li>".__('Login page exists with proper setting.', 'geodirectory')."</li>";
|
|
1742
|
1742
|
else {
|
|
1743
|
1743
|
$is_error_during_diagnose = true;
|
|
1744
|
|
- $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
|
|
|
1744
|
+ $output_str .= "<li><strong>".__('Login page is missing.', 'geodirectory')."</strong></li>";
|
|
1745
|
1745
|
if ($fix) {
|
|
1746
|
1746
|
if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
|
|
1747
|
|
- $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
|
|
|
1747
|
+ $output_str .= "<li><strong>".__('-->FIXED: Login page fixed', 'geodirectory')."</strong></li>";
|
|
1748
|
1748
|
} else {
|
|
1749
|
|
- $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
|
|
|
1749
|
+ $output_str .= "<li><strong>".__('-->FAILED: Login page fix failed', 'geodirectory')."</strong></li>";
|
|
1750
|
1750
|
}
|
|
1751
|
1751
|
}
|
|
1752
|
1752
|
}
|
|
@@ -1760,18 +1760,18 @@ discard block |
|
|
block discarded – undo |
|
1760
|
1760
|
//////////////////////////////////
|
|
1761
|
1761
|
$option_value = get_option('geodir_location_page');
|
|
1762
|
1762
|
$page = get_post($option_value);
|
|
1763
|
|
- if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
|
1763
|
+ if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
1764
|
1764
|
|
|
1765
|
|
- if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
|
|
1766
|
|
- $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
|
|
|
1765
|
+ if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
|
|
|
1766
|
+ $output_str .= "<li>".__('Location page exists with proper setting.', 'geodirectory')."</li>";
|
|
1767
|
1767
|
else {
|
|
1768
|
1768
|
$is_error_during_diagnose = true;
|
|
1769
|
|
- $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
|
|
|
1769
|
+ $output_str .= "<li><strong>".__('Location page is missing.', 'geodirectory')."</strong></li>";
|
|
1770
|
1770
|
if ($fix) {
|
|
1771
|
1771
|
if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
|
|
1772
|
|
- $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
|
|
|
1772
|
+ $output_str .= "<li><strong>".__('-->FIXED: Location page fixed', 'geodirectory')."</strong></li>";
|
|
1773
|
1773
|
} else {
|
|
1774
|
|
- $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
|
|
|
1774
|
+ $output_str .= "<li><strong>".__('-->FAILED: Location page fix failed', 'geodirectory')."</strong></li>";
|
|
1775
|
1775
|
}
|
|
1776
|
1776
|
}
|
|
1777
|
1777
|
}
|
|
@@ -1780,13 +1780,13 @@ discard block |
|
|
block discarded – undo |
|
1780
|
1780
|
/* Diagnose Location Page Ends */
|
|
1781
|
1781
|
////////////////////////////////
|
|
1782
|
1782
|
|
|
1783
|
|
- $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
|
|
|
1783
|
+ $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose);
|
|
1784
|
1784
|
/**
|
|
1785
|
1785
|
* This action is called at the end of the GD Tools page check function.
|
|
1786
|
1786
|
*
|
|
1787
|
1787
|
* @since 1.5.2
|
|
1788
|
1788
|
*/
|
|
1789
|
|
- $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
|
|
|
1789
|
+ $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr);
|
|
1790
|
1790
|
|
|
1791
|
1791
|
$output_str = $page_chk_arr['output_str'];
|
|
1792
|
1792
|
$is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];
|
|
@@ -1796,7 +1796,7 @@ discard block |
|
|
block discarded – undo |
|
1796
|
1796
|
flush_rewrite_rules();
|
|
1797
|
1797
|
}
|
|
1798
|
1798
|
$info_div_class = "geodir_problem_info";
|
|
1799
|
|
- $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
|
1799
|
+ $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
1800
|
1800
|
} else {
|
|
1801
|
1801
|
$info_div_class = "geodir_noproblem_info";
|
|
1802
|
1802
|
$fix_button_txt = '';
|
|
@@ -1824,10 +1824,10 @@ discard block |
|
|
block discarded – undo |
|
1824
|
1824
|
$fix_button_txt = '';
|
|
1825
|
1825
|
|
|
1826
|
1826
|
if ($is_error_during_diagnose) {
|
|
1827
|
|
- $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>";
|
|
|
1827
|
+ $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>";
|
|
1828
|
1828
|
$info_div_class = "geodir_problem_info";
|
|
1829
|
1829
|
} else {
|
|
1830
|
|
- $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
|
|
|
1830
|
+ $output_str .= "<li>".__('Load custom fields in to file for translation: ok', 'geodirectory')."</li>";
|
|
1831
|
1831
|
$info_div_class = "geodir_noproblem_info";
|
|
1832
|
1832
|
$fix_button_txt = '';
|
|
1833
|
1833
|
}
|
|
@@ -1869,17 +1869,17 @@ discard block |
|
|
block discarded – undo |
|
1869
|
1869
|
global $wpdb, $wp_query, $plugin_prefix;
|
|
1870
|
1870
|
|
|
1871
|
1871
|
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'])) {
|
|
1872
|
|
- $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail';
|
|
|
1872
|
+ $table = $plugin_prefix.$wp_query->query_vars['post_type'].'_detail';
|
|
1873
|
1873
|
|
|
1874
|
|
- $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)';
|
|
|
1874
|
+ $join = $clauses['join'].' INNER JOIN '.$table.' AS gd_posts ON (gd_posts.post_id = '.$wpdb->posts.'.ID)';
|
|
1875
|
1875
|
$clauses['join'] = $join;
|
|
1876
|
1876
|
|
|
1877
|
|
- $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : '';
|
|
|
1877
|
+ $fields = $clauses['fields'] != '' ? $clauses['fields'].', ' : '';
|
|
1878
|
1878
|
$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';
|
|
1879
|
1879
|
$clauses['fields'] = $fields;
|
|
1880
|
1880
|
|
|
1881
|
1881
|
$order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC';
|
|
1882
|
|
- $orderby = 'gd_expire ' . $order;
|
|
|
1882
|
+ $orderby = 'gd_expire '.$order;
|
|
1883
|
1883
|
$clauses['orderby'] = $orderby;
|
|
1884
|
1884
|
}
|
|
1885
|
1885
|
return $clauses;
|
|
@@ -1922,7 +1922,7 @@ discard block |
|
|
block discarded – undo |
|
1922
|
1922
|
global $current_user;
|
|
1923
|
1923
|
$upload_dir = wp_upload_dir();
|
|
1924
|
1924
|
|
|
1925
|
|
- $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv';
|
|
|
1925
|
+ $file = $upload_dir['path'].'/temp_'.$current_user->data->ID.'/geodir_tmp.csv';
|
|
1926
|
1926
|
$handle = fopen($file, 'w');
|
|
1927
|
1927
|
|
|
1928
|
1928
|
fwrite($handle, $input);
|
|
@@ -1967,7 +1967,7 @@ discard block |
|
|
block discarded – undo |
|
1967
|
1967
|
$uploads_dir = $uploads['path'];
|
|
1968
|
1968
|
$image_name_arr = explode('/', $filename);
|
|
1969
|
1969
|
$filename = end($image_name_arr);
|
|
1970
|
|
- $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
|
|
|
1970
|
+ $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;
|
|
1971
|
1971
|
$return = array();
|
|
1972
|
1972
|
$return['file'] = $uploadedFile;
|
|
1973
|
1973
|
$return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
|
@@ -1984,8 +1984,8 @@ discard block |
|
|
block discarded – undo |
|
1984
|
1984
|
|
|
1985
|
1985
|
if (($handle = fopen($target_path, "r")) !== FALSE) {
|
|
1986
|
1986
|
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
|
1987
|
|
- if(is_array($data) && !empty($data)) {
|
|
1988
|
|
- $file[] = '"' . implode('","', $data) . '"';
|
|
|
1987
|
+ if (is_array($data) && !empty($data)) {
|
|
|
1988
|
+ $file[] = '"'.implode('","', $data).'"';
|
|
1989
|
1989
|
}
|
|
1990
|
1990
|
}
|
|
1991
|
1991
|
fclose($handle);
|
|
@@ -2102,10 +2102,10 @@ discard block |
|
|
block discarded – undo |
|
2102
|
2102
|
$tag_arr = explode(',', $post_tags);
|
|
2103
|
2103
|
}
|
|
2104
|
2104
|
|
|
2105
|
|
- $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database
|
|
|
2105
|
+ $table = $plugin_prefix.$buffer[5].'_detail'; // check table in database
|
|
2106
|
2106
|
|
|
2107
|
2107
|
$error = '';
|
|
2108
|
|
- if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
|
|
|
2108
|
+ if ($wpdb->get_var("SHOW TABLES LIKE '".$table."'") != $table) {
|
|
2109
|
2109
|
$invalid_post_type++;
|
|
2110
|
2110
|
continue;
|
|
2111
|
2111
|
}
|
|
@@ -2131,7 +2131,7 @@ discard block |
|
|
block discarded – undo |
|
2131
|
2131
|
if ($buffer[$c] != '0' && $buffer[$c] != '') {
|
|
2132
|
2132
|
$submitdata = date('Y-m-d');
|
|
2133
|
2133
|
|
|
2134
|
|
- $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
|
|
|
2134
|
+ $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata."+".addslashes($buffer[$c])." days"));
|
|
2135
|
2135
|
} else {
|
|
2136
|
2136
|
$gd_post_info['expire_date'] = 'Never';
|
|
2137
|
2137
|
}
|
|
@@ -2159,7 +2159,7 @@ discard block |
|
|
block discarded – undo |
|
2159
|
2159
|
|
|
2160
|
2160
|
// Post status
|
|
2161
|
2161
|
if ($customKeyarray[$c] == 'post_status') {
|
|
2162
|
|
- $post_status = sanitize_key( $buffer[$c] );
|
|
|
2162
|
+ $post_status = sanitize_key($buffer[$c]);
|
|
2163
|
2163
|
}
|
|
2164
|
2164
|
}
|
|
2165
|
2165
|
|
|
@@ -2177,8 +2177,8 @@ discard block |
|
|
block discarded – undo |
|
2177
|
2177
|
|
|
2178
|
2178
|
// Default post status
|
|
2179
|
2179
|
$default_status = 'publish';
|
|
2180
|
|
- $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
|
|
2181
|
|
- $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
|
|
|
2180
|
+ $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
|
|
|
2181
|
+ $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
|
|
2182
|
2182
|
|
|
2183
|
2183
|
$my_post['post_title'] = $post_title;
|
|
2184
|
2184
|
$my_post['post_content'] = $post_desc;
|
|
@@ -2222,7 +2222,7 @@ discard block |
|
|
block discarded – undo |
|
2222
|
2222
|
$payment_info = array();
|
|
2223
|
2223
|
$package_info = array();
|
|
2224
|
2224
|
|
|
2225
|
|
- $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
|
|
|
2225
|
+ $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]);
|
|
2226
|
2226
|
$package_id = '';
|
|
2227
|
2227
|
if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
|
|
2228
|
2228
|
$package_id = $gd_post_info['package_id'];
|
|
@@ -2232,7 +2232,7 @@ discard block |
|
|
block discarded – undo |
|
2232
|
2232
|
$payment_info['package_id'] = $package_info['pid'];
|
|
2233
|
2233
|
|
|
2234
|
2234
|
if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
|
|
2235
|
|
- $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
|
|
|
2235
|
+ $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['alive_days']." days"));
|
|
2236
|
2236
|
} else {
|
|
2237
|
2237
|
$payment_info['expire_date'] = 'Never';
|
|
2238
|
2238
|
}
|
|
@@ -2244,7 +2244,7 @@ discard block |
|
|
block discarded – undo |
|
2244
|
2244
|
|
|
2245
|
2245
|
$post_type = get_post_type($last_postid);
|
|
2246
|
2246
|
|
|
2247
|
|
- $table = $plugin_prefix . $post_type . '_detail';
|
|
|
2247
|
+ $table = $plugin_prefix.$post_type.'_detail';
|
|
2248
|
2248
|
|
|
2249
|
2249
|
geodir_save_post_info($last_postid, $gd_post_info);
|
|
2250
|
2250
|
|
|
@@ -2265,7 +2265,7 @@ discard block |
|
|
block discarded – undo |
|
2265
|
2265
|
$attachment['post_id'] = $last_postid;
|
|
2266
|
2266
|
$attachment['title'] = $img_name_arr[0];
|
|
2267
|
2267
|
$attachment['content'] = '';
|
|
2268
|
|
- $attachment['file'] = $sub_dir . '/' . $image_name;
|
|
|
2268
|
+ $attachment['file'] = $sub_dir.'/'.$image_name;
|
|
2269
|
2269
|
$attachment['mime_type'] = $uploaded_file_type;
|
|
2270
|
2270
|
$attachment['menu_order'] = $menu_order;
|
|
2271
|
2271
|
$attachment['is_featured'] = 0;
|
|
@@ -2274,15 +2274,15 @@ discard block |
|
|
block discarded – undo |
|
2274
|
2274
|
|
|
2275
|
2275
|
foreach ($attachment as $key => $val) {
|
|
2276
|
2276
|
if ($val != '')
|
|
2277
|
|
- $attachment_set .= $key . " = '" . $val . "', ";
|
|
|
2277
|
+ $attachment_set .= $key." = '".$val."', ";
|
|
2278
|
2278
|
}
|
|
2279
|
2279
|
$attachment_set = trim($attachment_set, ", ");
|
|
2280
|
2280
|
|
|
2281
|
|
- $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
|
2281
|
+ $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
|
|
2282
|
2282
|
|
|
2283
|
2283
|
if ($menu_order == 1) {
|
|
2284
|
2284
|
$post_type = get_post_type($last_postid);
|
|
2285
|
|
- $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
|
|
|
2285
|
+ $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($sub_dir.'/'.$image_name, $last_postid)));
|
|
2286
|
2286
|
}
|
|
2287
|
2287
|
$menu_order++;
|
|
2288
|
2288
|
}
|
|
@@ -2323,11 +2323,11 @@ discard block |
|
|
block discarded – undo |
|
2323
|
2323
|
}
|
|
2324
|
2324
|
|
|
2325
|
2325
|
// Add the tab in left sidebar menu fro import & export page.
|
|
2326
|
|
-add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 );
|
|
|
2326
|
+add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94);
|
|
2327
|
2327
|
|
|
2328
|
2328
|
// Handle ajax request for import/export.
|
|
2329
|
|
-add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' );
|
|
2330
|
|
-add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' );
|
|
|
2329
|
+add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export');
|
|
|
2330
|
+add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export');
|
|
2331
|
2331
|
|
|
2332
|
2332
|
|
|
2333
|
2333
|
/**
|
|
@@ -2338,40 +2338,40 @@ discard block |
|
|
block discarded – undo |
|
2338
|
2338
|
* @param $post_id int $post_id The post ID of the post being saved.
|
|
2339
|
2339
|
* @param $post object $post The post object of the post being saved.
|
|
2340
|
2340
|
*/
|
|
2341
|
|
-function geodir_update_location_prefix($post_id,$post){
|
|
2342
|
|
- if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
|
|
2343
|
|
- update_option('geodir_location_prefix',$post->post_name);
|
|
|
2341
|
+function geodir_update_location_prefix($post_id, $post) {
|
|
|
2342
|
+ if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) {
|
|
|
2343
|
+ update_option('geodir_location_prefix', $post->post_name);
|
|
2344
|
2344
|
}
|
|
2345
|
2345
|
|
|
2346
|
2346
|
}
|
|
2347
|
2347
|
|
|
2348
|
|
-add_action('save_post', 'geodir_update_location_prefix',10,2);
|
|
|
2348
|
+add_action('save_post', 'geodir_update_location_prefix', 10, 2);
|
|
2349
|
2349
|
|
|
2350
|
|
-add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' );
|
|
|
2350
|
+add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback');
|
|
2351
|
2351
|
|
|
2352
|
|
-function geodir_ga_callback(){
|
|
|
2352
|
+function geodir_ga_callback() {
|
|
2353
|
2353
|
|
|
2354
|
|
-if(isset($_REQUEST['code']) && $_REQUEST['code']) {
|
|
|
2354
|
+if (isset($_REQUEST['code']) && $_REQUEST['code']) {
|
|
2355
|
2355
|
$oAuthURL = "https://www.googleapis.com/oauth2/v3/token?";
|
|
2356
|
2356
|
$code = "code=".$_REQUEST['code'];
|
|
2357
|
2357
|
$grant_type = "&grant_type=authorization_code";
|
|
2358
|
|
- $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
|
2358
|
+ $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
|
|
2359
|
2359
|
$client_id = "&client_id=".get_option('geodir_ga_client_id');
|
|
2360
|
2360
|
$client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
|
|
2361
|
2361
|
|
|
2362
|
|
- $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret;
|
|
|
2362
|
+ $auth_url = $oAuthURL.$code.$redirect_uri.$grant_type.$client_id.$client_secret;
|
|
2363
|
2363
|
|
|
2364
|
2364
|
$response = wp_remote_post($auth_url, array('timeout' => 15));
|
|
2365
|
2365
|
|
|
2366
|
2366
|
//print_r($response);
|
|
2367
|
2367
|
|
|
2368
|
|
- $error_msg = __('Something went wrong','geodirectory');
|
|
2369
|
|
- if(!empty($response['response']['code']) && $response['response']['code']==200){
|
|
|
2368
|
+ $error_msg = __('Something went wrong', 'geodirectory');
|
|
|
2369
|
+ if (!empty($response['response']['code']) && $response['response']['code'] == 200) {
|
|
2370
|
2370
|
|
|
2371
|
2371
|
$parts = json_decode($response['body']);
|
|
2372
|
2372
|
//print_r($parts);
|
|
2373
|
|
- if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
|
|
2374
|
|
- else{
|
|
|
2373
|
+ if (!isset($parts->access_token)) {echo $error_msg." - #1"; exit; }
|
|
|
2374
|
+ else {
|
|
2375
|
2375
|
|
|
2376
|
2376
|
update_option('gd_ga_access_token', $parts->access_token);
|
|
2377
|
2377
|
update_option('gd_ga_refresh_token', $parts->refresh_token);
|
|
@@ -2380,18 +2380,18 @@ discard block |
|
|
block discarded – undo |
|
2380
|
2380
|
|
|
2381
|
2381
|
|
|
2382
|
2382
|
}
|
|
2383
|
|
- elseif(!empty($response['response']['code'])) {
|
|
|
2383
|
+ elseif (!empty($response['response']['code'])) {
|
|
2384
|
2384
|
$parts = json_decode($response['body']);
|
|
2385
|
2385
|
|
|
2386
|
|
- if(isset($parts->error)){
|
|
2387
|
|
- echo $parts->error.": ".$parts->error_description;exit;
|
|
2388
|
|
- }else{
|
|
2389
|
|
- echo $error_msg." - #2";exit;
|
|
|
2386
|
+ if (isset($parts->error)) {
|
|
|
2387
|
+ echo $parts->error.": ".$parts->error_description; exit;
|
|
|
2388
|
+ } else {
|
|
|
2389
|
+ echo $error_msg." - #2"; exit;
|
|
2390
|
2390
|
}
|
|
2391
|
2391
|
|
|
2392
|
|
- }else{
|
|
|
2392
|
+ } else {
|
|
2393
|
2393
|
|
|
2394
|
|
- echo $error_msg." - #3";exit;
|
|
|
2394
|
+ echo $error_msg." - #3"; exit;
|
|
2395
|
2395
|
|
|
2396
|
2396
|
}
|
|
2397
|
2397
|
}
|
|
@@ -2413,7 +2413,7 @@ discard block |
|
|
block discarded – undo |
|
2413
|
2413
|
function geodir_uninstall_settings($general_settings) {
|
|
2414
|
2414
|
$settings = array();
|
|
2415
|
2415
|
$settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
|
|
2416
|
|
- $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
|
|
|
2416
|
+ $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory'));
|
|
2417
|
2417
|
|
|
2418
|
2418
|
$plugins = get_plugins();
|
|
2419
|
2419
|
$un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
|
|
@@ -2425,7 +2425,7 @@ discard block |
|
|
block discarded – undo |
|
2425
|
2425
|
if (in_array($plugin_name, $un_plugins)) {
|
|
2426
|
2426
|
$settings[] = array(
|
|
2427
|
2427
|
'type' => 'checkbox',
|
|
2428
|
|
- 'id' => 'geodir_un_' . $plugin_name,
|
|
|
2428
|
+ 'id' => 'geodir_un_'.$plugin_name,
|
|
2429
|
2429
|
'name' => $data['Name'],
|
|
2430
|
2430
|
'desc' => __('Remove all data when deleted?', 'geodirectory'),
|
|
2431
|
2431
|
'std' => '0'
|
|
@@ -2459,7 +2459,7 @@ discard block |
|
|
block discarded – undo |
|
2459
|
2459
|
* @since 1.6.9
|
|
2460
|
2460
|
*/
|
|
2461
|
2461
|
function geodir_uninstall_settings_desc() {
|
|
2462
|
|
- 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>';
|
|
|
2462
|
+ 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>';
|
|
2463
|
2463
|
}
|
|
2464
|
2464
|
add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc');
|
|
2465
|
2465
|
|
|
@@ -2523,12 +2523,12 @@ discard block |
|
|
block discarded – undo |
|
2523
|
2523
|
|
|
2524
|
2524
|
|
|
2525
|
2525
|
if ($delete) {
|
|
2526
|
|
- $output_str .= "<li><strong>" . __('Table dropped, refresh page to reinstall.', 'geodirectory') . "</strong></li>";
|
|
|
2526
|
+ $output_str .= "<li><strong>".__('Table dropped, refresh page to reinstall.', 'geodirectory')."</strong></li>";
|
|
2527
|
2527
|
ob_start();
|
|
2528
|
2528
|
geodir_diagnose_version_clear();
|
|
2529
|
2529
|
ob_end_clean();
|
|
2530
|
|
- }else{
|
|
2531
|
|
- $output_str .= "<li><strong>" . __('Something went wrong.', 'geodirectory') . "</strong></li>";
|
|
|
2530
|
+ } else {
|
|
|
2531
|
+ $output_str .= "<li><strong>".__('Something went wrong.', 'geodirectory')."</strong></li>";
|
|
2532
|
2532
|
}
|
|
2533
|
2533
|
|
|
2534
|
2534
|
if ($is_error_during_diagnose) {
|
|
@@ -2553,9 +2553,9 @@ discard block |
|
|
block discarded – undo |
|
2553
|
2553
|
* @param object $row The post|taxonomy object.
|
|
2554
|
2554
|
* @return array Filtered actions.
|
|
2555
|
2555
|
*/
|
|
2556
|
|
-function geodir_disable_quick_edit( $actions = array(), $row = null ) {
|
|
2557
|
|
- if ( isset( $actions['inline hide-if-no-js'] ) ) {
|
|
2558
|
|
- unset( $actions['inline hide-if-no-js'] );
|
|
|
2556
|
+function geodir_disable_quick_edit($actions = array(), $row = null) {
|
|
|
2557
|
+ if (isset($actions['inline hide-if-no-js'])) {
|
|
|
2558
|
+ unset($actions['inline hide-if-no-js']);
|
|
2559
|
2559
|
}
|
|
2560
|
2560
|
|
|
2561
|
2561
|
return $actions;
|
|
@@ -2574,23 +2574,23 @@ discard block |
|
|
block discarded – undo |
|
2574
|
2574
|
function geodir_check_quick_edit() {
|
|
2575
|
2575
|
global $pagenow, $current_screen, $gd_cpt_screen;
|
|
2576
|
2576
|
|
|
2577
|
|
- if ( ( $pagenow == 'edit.php' || $pagenow == 'edit-tags.php' ) && !empty( $current_screen->post_type ) ) {
|
|
2578
|
|
- if ( empty( $gd_cpt_screen ) ) {
|
|
2579
|
|
- if ( in_array( $current_screen->post_type, geodir_get_posttypes() ) ) {
|
|
|
2577
|
+ if (($pagenow == 'edit.php' || $pagenow == 'edit-tags.php') && !empty($current_screen->post_type)) {
|
|
|
2578
|
+ if (empty($gd_cpt_screen)) {
|
|
|
2579
|
+ if (in_array($current_screen->post_type, geodir_get_posttypes())) {
|
|
2580
|
2580
|
$gd_cpt_screen = 'y';
|
|
2581
|
2581
|
} else {
|
|
2582
|
2582
|
$gd_cpt_screen = 'n';
|
|
2583
|
2583
|
}
|
|
2584
|
2584
|
}
|
|
2585
|
2585
|
|
|
2586
|
|
- if ( $gd_cpt_screen == 'y' ) {
|
|
2587
|
|
- if ( $pagenow == 'edit.php' ) {
|
|
2588
|
|
- add_filter( 'post_row_actions', 'geodir_disable_quick_edit', 10, 2 );
|
|
2589
|
|
- add_filter( 'page_row_actions', 'geodir_disable_quick_edit', 10, 2 );
|
|
2590
|
|
- } elseif ( $pagenow == 'edit-tags.php' && !empty( $current_screen->taxonomy ) ) {
|
|
2591
|
|
- add_filter( $current_screen->taxonomy . '_row_actions', 'geodir_disable_quick_edit', 10, 2 );
|
|
|
2586
|
+ if ($gd_cpt_screen == 'y') {
|
|
|
2587
|
+ if ($pagenow == 'edit.php') {
|
|
|
2588
|
+ add_filter('post_row_actions', 'geodir_disable_quick_edit', 10, 2);
|
|
|
2589
|
+ add_filter('page_row_actions', 'geodir_disable_quick_edit', 10, 2);
|
|
|
2590
|
+ } elseif ($pagenow == 'edit-tags.php' && !empty($current_screen->taxonomy)) {
|
|
|
2591
|
+ add_filter($current_screen->taxonomy.'_row_actions', 'geodir_disable_quick_edit', 10, 2);
|
|
2592
|
2592
|
}
|
|
2593
|
2593
|
}
|
|
2594
|
2594
|
}
|
|
2595
|
2595
|
}
|
|
2596
|
|
-add_action( 'admin_head', 'geodir_check_quick_edit', 10 ); |
|
2597
|
2596
|
\ No newline at end of file |
|
|
2597
|
+add_action('admin_head', 'geodir_check_quick_edit', 10); |
|
2598
|
2598
|
\ No newline at end of file |