Test Failed
Push — master ( 7a266a...e0908c )
by Stiofan
55:02
created
geodirectory-functions/custom_fields_functions.php 1 patch
Braces   +133 added lines, -92 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@  discard block
 block discarded – undo
51 51
         global $wpdb;
52 52
         $result = 0;// no rows affected
53 53
         if (!geodir_column_exist($db, $column)) {
54
-            if (!empty($db) && !empty($column))
55
-                $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
54
+            if (!empty($db) && !empty($column)) {
55
+                            $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
+            }
56 57
         }
57 58
         return $result;
58 59
     }
@@ -82,10 +83,11 @@  discard block
 block discarded – undo
82 83
 
83 84
     $default_query = '';
84 85
 
85
-    if ($default == 'default')
86
-        $default_query .= " and is_admin IN ('1') ";
87
-    elseif ($default == 'custom')
88
-        $default_query .= " and is_admin = '0' ";
86
+    if ($default == 'default') {
87
+            $default_query .= " and is_admin IN ('1') ";
88
+    } elseif ($default == 'custom') {
89
+            $default_query .= " and is_admin = '0' ";
90
+    }
89 91
 
90 92
     if ($fields_location == 'none') {
91 93
     } else{
@@ -239,10 +241,12 @@  discard block
 block discarded – undo
239 241
                 }
240 242
 
241 243
                 return $field_id;
242
-            } else
243
-                return 0;
244
-        } else
245
-            return 0;
244
+            } else {
245
+                            return 0;
246
+            }
247
+        } else {
248
+                    return 0;
249
+        }
246 250
     }
247 251
 }
248 252
 
@@ -350,7 +354,9 @@  discard block
 block discarded – undo
350 354
 
351 355
 
352 356
 
353
-            if ($post_type == '') $post_type = 'gd_place';
357
+            if ($post_type == '') {
358
+            	$post_type = 'gd_place';
359
+            }
354 360
 
355 361
 
356 362
             $detail_table = $plugin_prefix . $post_type . '_detail';
@@ -390,16 +396,17 @@  discard block
 block discarded – undo
390 396
             }
391 397
 
392 398
             $option_values = '';
393
-            if (isset($request_field['option_values']))
394
-                $option_values = $request_field['option_values'];
399
+            if (isset($request_field['option_values'])) {
400
+                            $option_values = $request_field['option_values'];
401
+            }
395 402
 
396 403
             $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
397 404
 
398 405
             $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
399 406
 
400
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
401
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
402
-            else {
407
+            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) {
408
+                            $price_pkg = implode(",", $request_field['show_on_pkg']);
409
+            } else {
403 410
                 $package_info = array();
404 411
 
405 412
                 $package_info = geodir_post_package_info($package_info, '', $post_type);
@@ -407,22 +414,29 @@  discard block
 block discarded – undo
407 414
             }
408 415
 
409 416
 
410
-            if (isset($request_field['extra']) && !empty($request_field['extra']))
411
-                $extra_fields = $request_field['extra'];
417
+            if (isset($request_field['extra']) && !empty($request_field['extra'])) {
418
+                            $extra_fields = $request_field['extra'];
419
+            }
412 420
 
413
-            if (isset($request_field['is_default']) && $request_field['is_default'] != '')
414
-                $is_default = $request_field['is_default'];
415
-            else
416
-                $is_default = '0';
421
+            if (isset($request_field['is_default']) && $request_field['is_default'] != '') {
422
+                            $is_default = $request_field['is_default'];
423
+            } else {
424
+                            $is_default = '0';
425
+            }
417 426
 
418
-            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
419
-                $is_admin = $request_field['is_admin'];
420
-            else
421
-                $is_admin = '0';
427
+            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') {
428
+                            $is_admin = $request_field['is_admin'];
429
+            } else {
430
+                            $is_admin = '0';
431
+            }
422 432
 
423 433
 
424
-            if ($is_active == '') $is_active = 1;
425
-            if ($is_required == '') $is_required = 0;
434
+            if ($is_active == '') {
435
+            	$is_active = 1;
436
+            }
437
+            if ($is_required == '') {
438
+            	$is_required = 0;
439
+            }
426 440
 
427 441
 
428 442
             if ($sort_order == '') {
@@ -701,7 +715,7 @@  discard block
 block discarded – undo
701 715
                                 }
702 716
                                 if($op_max){$op_size =$op_max; }
703 717
                             }
704
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
718
+                        } elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
705 719
                             if(strlen($option_values)){
706 720
                                 $op_size =  strlen($option_values);
707 721
                             }
@@ -718,11 +732,13 @@  discard block
 block discarded – undo
718 732
                             return __('Column change failed, you may have too many columns.','geodirectory');
719 733
                         }
720 734
 
721
-                        if (isset($request_field['cat_display_type']))
722
-                            $extra_fields = $request_field['cat_display_type'];
735
+                        if (isset($request_field['cat_display_type'])) {
736
+                                                    $extra_fields = $request_field['cat_display_type'];
737
+                        }
723 738
 
724
-                        if (isset($request_field['multi_display_type']))
725
-                            $extra_fields = $request_field['multi_display_type'];
739
+                        if (isset($request_field['multi_display_type'])) {
740
+                                                    $extra_fields = $request_field['multi_display_type'];
741
+                        }
726 742
 
727 743
 
728 744
                         break;
@@ -736,8 +752,9 @@  discard block
 block discarded – undo
736 752
                         if($alter_result===false){
737 753
                             return __('Column change failed, you may have too many columns.','geodirectory');
738 754
                         }
739
-                        if (isset($request_field['advanced_editor']))
740
-                            $extra_fields = $request_field['advanced_editor'];
755
+                        if (isset($request_field['advanced_editor'])) {
756
+                                                    $extra_fields = $request_field['advanced_editor'];
757
+                        }
741 758
 
742 759
                         break;
743 760
 
@@ -833,8 +850,9 @@  discard block
 block discarded – undo
833 850
                 );
834 851
 
835 852
 
836
-                if ($cat_sort == '')
837
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
853
+                if ($cat_sort == '') {
854
+                                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
855
+                }
838 856
 
839 857
 
840 858
                 /**
@@ -1204,8 +1222,10 @@  discard block
 block discarded – undo
1204 1222
         }
1205 1223
 
1206 1224
         return $post_meta_info;
1207
-    else:
1208
-        return false;
1225
+    else {
1226
+    	:
1227
+        return false;
1228
+    }
1209 1229
     endif;
1210 1230
 }
1211 1231
 
@@ -1282,8 +1302,9 @@  discard block
 block discarded – undo
1282 1302
         if (is_admin()) {
1283 1303
             global $post;
1284 1304
 
1285
-            if (isset($_REQUEST['post']))
1286
-                $_REQUEST['pid'] = $_REQUEST['post'];
1305
+            if (isset($_REQUEST['post'])) {
1306
+                            $_REQUEST['pid'] = $_REQUEST['post'];
1307
+            }
1287 1308
         }
1288 1309
 
1289 1310
         
@@ -1375,7 +1396,7 @@  discard block
 block discarded – undo
1375 1396
         $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1376 1397
     } elseif (strpos($cf['field_icon'], ' fa-') !== false) {
1377 1398
         $field_icon = '<i class="' . $cf['field_icon'] . ' fa-fw"></i>';
1378
-    }else{
1399
+    } else{
1379 1400
         $field_icon = $cf['field_icon'];
1380 1401
     }
1381 1402
 
@@ -1449,8 +1470,9 @@  discard block
 block discarded – undo
1449 1470
                     $variables_array['post_id'] = !empty($post->ID) ? $post->ID : (!empty($post->pid) ? $post->pid : NULL);
1450 1471
                     $variables_array['label'] = __($type['site_title'], 'geodirectory');
1451 1472
                     $variables_array['value'] = '';
1452
-                    if (isset($post->{$type['htmlvar_name']}))
1453
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
1473
+                    if (isset($post->{$type['htmlvar_name']})) {
1474
+                                            $variables_array['value'] = $post->{$type['htmlvar_name']};
1475
+                    }
1454 1476
                 endif;
1455 1477
 
1456 1478
 
@@ -1472,7 +1494,9 @@  discard block
 block discarded – undo
1472 1494
                      * @param string $html Custom field unfiltered HTML.
1473 1495
                      * @param array $variables_array Custom field variables array.
1474 1496
                      */
1475
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1497
+                    if ($html) {
1498
+                    	echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1499
+                    }
1476 1500
 
1477 1501
                     /**
1478 1502
                      * Called after a custom fields is output on the frontend.
@@ -1515,10 +1539,11 @@  discard block
 block discarded – undo
1515 1539
      */
1516 1540
     function geodir_default_date_format()
1517 1541
     {
1518
-        if ($format = get_option('date_format'))
1519
-            return $format;
1520
-        else
1521
-            return 'dd-mm-yy';
1542
+        if ($format = get_option('date_format')) {
1543
+                    return $format;
1544
+        } else {
1545
+                    return 'dd-mm-yy';
1546
+        }
1522 1547
     }
1523 1548
 }
1524 1549
 
@@ -1625,11 +1650,13 @@  discard block
 block discarded – undo
1625 1650
                     // Set an array containing a list of acceptable formats
1626 1651
                     //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1627 1652
 
1628
-                    if (!function_exists('wp_handle_upload'))
1629
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1653
+                    if (!function_exists('wp_handle_upload')) {
1654
+                                            require_once(ABSPATH . 'wp-admin/includes/file.php');
1655
+                    }
1630 1656
 
1631
-                    if (!is_dir($geodir_uploadpath))
1632
-                        mkdir($geodir_uploadpath);
1657
+                    if (!is_dir($geodir_uploadpath)) {
1658
+                                            mkdir($geodir_uploadpath);
1659
+                    }
1633 1660
 
1634 1661
                     $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1635 1662
                     $explode_sub_dir = explode("/", $sub_dir);
@@ -1642,16 +1669,19 @@  discard block
 block discarded – undo
1642 1669
                     }
1643 1670
 
1644 1671
                     $uploaded_file = '';
1645
-                    if (file_exists($img_path))
1646
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1672
+                    if (file_exists($img_path)) {
1673
+                                            $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1674
+                    }
1647 1675
 
1648 1676
                     if ($curr_img_dir != $geodir_uploaddir) {
1649
-                        if (file_exists($img_path))
1650
-                            unlink($img_path);
1677
+                        if (file_exists($img_path)) {
1678
+                                                    unlink($img_path);
1679
+                        }
1651 1680
                     }
1652 1681
 
1653
-                    if (!empty($uploaded_file))
1654
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1682
+                    if (!empty($uploaded_file)) {
1683
+                                            $file_urls = $geodir_uploadurl . '/' . $new_name;
1684
+                    }
1655 1685
 
1656 1686
                 } else {
1657 1687
                     $file_urls = $post_image[$m];
@@ -1672,8 +1702,9 @@  discard block
 block discarded – undo
1672 1702
 
1673 1703
         geodir_save_post_meta($post_id, $field_id, $file_urls);
1674 1704
 
1675
-        if (!empty($invalid_files))
1676
-            geodir_remove_attachments($invalid_files);
1705
+        if (!empty($invalid_files)) {
1706
+                    geodir_remove_attachments($invalid_files);
1707
+        }
1677 1708
 
1678 1709
     }
1679 1710
 }
@@ -1899,8 +1930,9 @@  discard block
 block discarded – undo
1899 1930
 
1900 1931
         $all_postypes = geodir_get_posttypes();
1901 1932
 
1902
-        if (!in_array($post_type, $all_postypes))
1903
-            return false;
1933
+        if (!in_array($post_type, $all_postypes)) {
1934
+                    return false;
1935
+        }
1904 1936
 
1905 1937
         $fields = array();
1906 1938
 
@@ -1998,8 +2030,10 @@  discard block
 block discarded – undo
1998 2030
         }
1999 2031
 
2000 2032
         return $field_ids;
2001
-    else:
2002
-        return false;
2033
+    else {
2034
+    	:
2035
+        return false;
2036
+    }
2003 2037
     endif;
2004 2038
 }
2005 2039
 
@@ -2172,8 +2206,9 @@  discard block
 block discarded – undo
2172 2206
 
2173 2207
             return $field_id;
2174 2208
 
2175
-        } else
2176
-            return 0;
2209
+        } else {
2210
+                    return 0;
2211
+        }
2177 2212
 
2178 2213
     }
2179 2214
 }
@@ -2214,8 +2249,9 @@  discard block
 block discarded – undo
2214 2249
         $htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2215 2250
 
2216 2251
         $site_title = '';
2217
-        if ($site_title == '')
2218
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2252
+        if ($site_title == '') {
2253
+                    $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2254
+        }
2219 2255
 
2220 2256
         if ($site_title == '') {
2221 2257
             $fields = geodir_get_custom_sort_options($post_type);
@@ -2229,8 +2265,9 @@  discard block
 block discarded – undo
2229 2265
             }
2230 2266
         }
2231 2267
 
2232
-        if ($htmlvar_name == '')
2233
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2268
+        if ($htmlvar_name == '') {
2269
+                    $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2270
+        }
2234 2271
 
2235 2272
         $nonce = wp_create_nonce('custom_fields_' . $result_str);
2236 2273
 
@@ -2243,7 +2280,7 @@  discard block
 block discarded – undo
2243 2280
 
2244 2281
                 if (isset($cso['field_icon']) && strpos($cso['field_icon'], ' fa-') !== false) {
2245 2282
                     $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2246
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2283
+                } elseif(isset($cso['field_icon']) && $cso['field_icon']){
2247 2284
                     $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cso['field_icon'].'\')"></b>';
2248 2285
                 }
2249 2286
 
@@ -2679,7 +2716,7 @@  discard block
 block discarded – undo
2679 2716
     $dt_value = '';
2680 2717
     if (isset($field_info->data_type)) {
2681 2718
         $dt_value  = esc_attr($field_info->data_type);
2682
-    }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2719
+    } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2683 2720
         $dt_value  = $cf['defaults']['data_type'];
2684 2721
     }
2685 2722
     ?>
@@ -2711,7 +2748,7 @@  discard block
 block discarded – undo
2711 2748
     $value = '';
2712 2749
     if (isset($field_info->decimal_point)) {
2713 2750
         $value = esc_attr($field_info->decimal_point);
2714
-    }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2751
+    } elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2715 2752
         $value = $cf['defaults']['decimal_point'];
2716 2753
     }
2717 2754
     ?>
@@ -2783,11 +2820,13 @@  discard block
 block discarded – undo
2783 2820
 
2784 2821
             <?php
2785 2822
             $selected = '';
2786
-            if (isset($field_info->extra_fields))
2787
-                $advanced_editor = unserialize($field_info->extra_fields);
2823
+            if (isset($field_info->extra_fields)) {
2824
+                            $advanced_editor = unserialize($field_info->extra_fields);
2825
+            }
2788 2826
 
2789
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2790
-                $selected = 'checked="checked"';
2827
+            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor)) {
2828
+                            $selected = 'checked="checked"';
2829
+            }
2791 2830
             ?>
2792 2831
 
2793 2832
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
@@ -2809,7 +2848,7 @@  discard block
 block discarded – undo
2809 2848
     $value = '';
2810 2849
     if (isset($field_info->validation_pattern)) {
2811 2850
         $value = esc_attr($field_info->validation_pattern);
2812
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2851
+    } elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2813 2852
         $value = esc_attr($cf['defaults']['validation_pattern']);
2814 2853
     }
2815 2854
     ?>
@@ -2829,7 +2868,7 @@  discard block
 block discarded – undo
2829 2868
     $value = '';
2830 2869
     if (isset($field_info->validation_msg)) {
2831 2870
         $value = esc_attr($field_info->validation_msg);
2832
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2871
+    } elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2833 2872
         $value = esc_attr($cf['defaults']['validation_msg']);
2834 2873
     }
2835 2874
     ?>
@@ -2859,8 +2898,9 @@  discard block
 block discarded – undo
2859 2898
 
2860 2899
     if (!isset($field_info->post_type)) {
2861 2900
         $post_type = sanitize_text_field($_REQUEST['listing_type']);
2862
-    } else
2863
-        $post_type = $field_info->post_type;
2901
+    } else {
2902
+            $post_type = $field_info->post_type;
2903
+    }
2864 2904
     ?>
2865 2905
     <li style="display: none;">
2866 2906
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
@@ -3134,7 +3174,7 @@  discard block
 block discarded – undo
3134 3174
     $value = '';
3135 3175
     if (isset($field_info->option_values)) {
3136 3176
         $value = esc_attr($field_info->option_values);
3137
-    }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3177
+    } elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3138 3178
         $value = esc_attr($cf['defaults']['option_values']);
3139 3179
     }
3140 3180
 
@@ -3277,7 +3317,7 @@  discard block
 block discarded – undo
3277 3317
     $value = '';
3278 3318
     if ($extra_fields && isset($extra_fields['is_price'])) {
3279 3319
     $value = esc_attr($extra_fields['is_price']);
3280
-    }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3320
+    } elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3281 3321
     $value = esc_attr($cf['defaults']['extra_fields']['is_price']);
3282 3322
     }
3283 3323
 
@@ -3314,7 +3354,7 @@  discard block
 block discarded – undo
3314 3354
     $value = '';
3315 3355
     if ($extra_fields && isset($extra_fields['thousand_separator'])) {
3316 3356
         $value = esc_attr($extra_fields['thousand_separator']);
3317
-    }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3357
+    } elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3318 3358
         $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']);
3319 3359
     }
3320 3360
     ?>
@@ -3342,7 +3382,7 @@  discard block
 block discarded – undo
3342 3382
     $value = '';
3343 3383
     if ($extra_fields && isset($extra_fields['decimal_separator'])) {
3344 3384
         $value = esc_attr($extra_fields['decimal_separator']);
3345
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3385
+    } elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3346 3386
         $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']);
3347 3387
     }
3348 3388
     ?>
@@ -3365,7 +3405,7 @@  discard block
 block discarded – undo
3365 3405
     $value = '';
3366 3406
     if ($extra_fields && isset($extra_fields['decimal_display'])) {
3367 3407
         $value = esc_attr($extra_fields['decimal_display']);
3368
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3408
+    } elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3369 3409
         $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']);
3370 3410
     }
3371 3411
     ?>
@@ -3388,7 +3428,7 @@  discard block
 block discarded – undo
3388 3428
     $value = '';
3389 3429
     if ($extra_fields && isset($extra_fields['currency_symbol'])) {
3390 3430
         $value = esc_attr($extra_fields['currency_symbol']);
3391
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3431
+    } elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3392 3432
         $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']);
3393 3433
     }
3394 3434
     ?>
@@ -3409,7 +3449,7 @@  discard block
 block discarded – undo
3409 3449
     $value = '';
3410 3450
     if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
3411 3451
         $value = esc_attr($extra_fields['currency_symbol_placement']);
3412
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3452
+    } elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3413 3453
         $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']);
3414 3454
     }
3415 3455
     ?>
@@ -3637,8 +3677,9 @@  discard block
 block discarded – undo
3637 3677
     $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left';
3638 3678
 
3639 3679
     if($decimals>0 && $decimal_display=='if'){
3640
-        if(is_int($number) || floor( $number ) == $number)
3641
-            $decimals = 0;
3680
+        if(is_int($number) || floor( $number ) == $number) {
3681
+                    $decimals = 0;
3682
+        }
3642 3683
     }
3643 3684
 
3644 3685
     $number = number_format($number,$decimals,$decimalpoint,$separator);
@@ -3647,7 +3688,7 @@  discard block
 block discarded – undo
3647 3688
 
3648 3689
     if($currency_symbol_placement=='left'){
3649 3690
         $number = $symbol . $number;
3650
-    }else{
3691
+    } else{
3651 3692
         $number = $number . $symbol;
3652 3693
     }
3653 3694
 
Please login to merge, or discard this patch.
geodirectory-functions/custom_field_html.php 1 patch
Braces   +38 added lines, -36 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21 21
     $post_type = sanitize_text_field($_REQUEST['listing_type']);
22
-} else
23
-    $post_type = $field_info->post_type;
22
+} else {
23
+    $post_type = $field_info->post_type;
24
+}
24 25
 
25 26
 //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){
26 27
 //    $cf_arr = geodir_custom_fields_predefined($post_type);
@@ -47,8 +48,9 @@  discard block
 block discarded – undo
47 48
 $nonce = wp_create_nonce('custom_fields_' . $result_str);
48 49
 
49 50
 $field_admin_title = '';
50
-if (isset($field_info->admin_title))
51
-    $field_admin_title = $field_info->admin_title;
51
+if (isset($field_info->admin_title)) {
52
+    $field_admin_title = $field_info->admin_title;
53
+}
52 54
 
53 55
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
54 56
 
@@ -69,15 +71,15 @@  discard block
 block discarded – undo
69 71
 
70 72
 if (isset($cf['icon']) && strpos($cf['icon'], ' fa-') !== false) {
71 73
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
72
-}elseif(isset($cf['icon']) && $cf['icon']){
74
+} elseif(isset($cf['icon']) && $cf['icon']){
73 75
     $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>';
74
-}else{
76
+} else{
75 77
     $field_icon = '<i class="fas fa-cog" aria-hidden="true"></i>';
76 78
 }
77 79
 
78 80
 if(isset($cf['name']) && $cf['name']){
79 81
     $field_type_name = $cf['name'];
80
-}else{
82
+} else{
81 83
     $field_type_name = $field_type;
82 84
 }
83 85
 
@@ -147,11 +149,11 @@  discard block
 block discarded – undo
147 149
 
148 150
                 echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
149 151
 
150
-            }else{
152
+            } else{
151 153
                 $value = '';
152 154
                 if (isset($field_info->data_type)) {
153 155
                     $value = esc_attr($field_info->data_type);
154
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
156
+                } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
155 157
                     $value = $cf['defaults']['data_type'];
156 158
                 }
157 159
                 ?>
@@ -165,11 +167,11 @@  discard block
 block discarded – undo
165 167
 
166 168
                 echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
167 169
 
168
-            }else{
170
+            } else{
169 171
                 $value = '';
170 172
                 if (isset($field_info->admin_title)) {
171 173
                     $value = esc_attr($field_info->admin_title);
172
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
174
+                } elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
173 175
                     $value = $cf['defaults']['admin_title'];
174 176
                 }
175 177
                 ?>
@@ -194,11 +196,11 @@  discard block
 block discarded – undo
194 196
 
195 197
                 echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
196 198
 
197
-            }else{
199
+            } else{
198 200
                 $value = '';
199 201
                 if (isset($field_info->site_title)) {
200 202
                     $value = esc_attr($field_info->site_title);
201
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
203
+                } elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
202 204
                     $value = $cf['defaults']['site_title'];
203 205
                 }
204 206
                 ?>
@@ -222,11 +224,11 @@  discard block
 block discarded – undo
222 224
 
223 225
                 echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
224 226
 
225
-            }else{
227
+            } else{
226 228
                 $value = '';
227 229
                 if (isset($field_info->admin_desc)) {
228 230
                     $value = esc_attr($field_info->admin_desc);
229
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
231
+                } elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
230 232
                     $value = $cf['defaults']['admin_desc'];
231 233
                 }
232 234
                 ?>
@@ -250,11 +252,11 @@  discard block
 block discarded – undo
250 252
 
251 253
                 echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
252 254
 
253
-            }else{
255
+            } else{
254 256
                 $value = '';
255 257
                 if (isset($field_info->htmlvar_name)) {
256 258
                     $value = esc_attr($field_info->htmlvar_name);
257
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
259
+                } elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
258 260
                     $value = $cf['defaults']['htmlvar_name'];
259 261
                 }
260 262
                 ?>
@@ -282,11 +284,11 @@  discard block
 block discarded – undo
282 284
 
283 285
                 echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
284 286
 
285
-            }else{
287
+            } else{
286 288
                 $value = '';
287 289
                 if (isset($field_info->is_active)) {
288 290
                     $value = esc_attr($field_info->is_active);
289
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
291
+                } elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
290 292
                     $value = $cf['defaults']['is_active'];
291 293
                 }
292 294
                 ?>
@@ -321,11 +323,11 @@  discard block
 block discarded – undo
321 323
 
322 324
                 echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
323 325
 
324
-            }else{
326
+            } else{
325 327
                 $value = '';
326 328
                 if (isset($field_info->for_admin_use)) {
327 329
                     $value = esc_attr($field_info->for_admin_use);
328
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
330
+                } elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
329 331
                     $value = $cf['defaults']['for_admin_use'];
330 332
                 }
331 333
                 ?>
@@ -360,11 +362,11 @@  discard block
 block discarded – undo
360 362
 
361 363
                 echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
362 364
 
363
-            }else{
365
+            } else{
364 366
                 $value = '';
365 367
                 if (isset($field_info->default_value)) {
366 368
                     $value = esc_attr($field_info->default_value);
367
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
369
+                } elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
368 370
                     $value = $cf['defaults']['default_value'];
369 371
                 }
370 372
                 ?>
@@ -404,11 +406,11 @@  discard block
 block discarded – undo
404 406
 
405 407
                 echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
406 408
 
407
-            }else{
409
+            } else{
408 410
                 $value = '';
409 411
                 if (isset($field_info->show_in)) {
410 412
                     $value = esc_attr($field_info->show_in);
411
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
413
+                } elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
412 414
                     $value = esc_attr($cf['defaults']['show_in']);
413 415
                 }
414 416
                 ?>
@@ -448,7 +450,7 @@  discard block
 block discarded – undo
448 450
 
449 451
                         // don't show new tab option for some types
450 452
                         if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
451
-                        }else{
453
+                        } else{
452 454
                             unset($show_in_locations['[owntab]']);
453 455
                         }
454 456
 
@@ -561,11 +563,11 @@  discard block
 block discarded – undo
561 563
 
562 564
                 echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
563 565
 
564
-            }else{
566
+            } else{
565 567
                 $value = '';
566 568
                 if (isset($field_info->is_required)) {
567 569
                     $value = esc_attr($field_info->is_required);
568
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
570
+                } elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
569 571
                     $value = $cf['defaults']['is_required'];
570 572
                 }
571 573
                 ?>
@@ -602,11 +604,11 @@  discard block
 block discarded – undo
602 604
 
603 605
                 echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
604 606
 
605
-            }else{
607
+            } else{
606 608
                 $value = '';
607 609
                 if (isset($field_info->required_msg)) {
608 610
                     $value = esc_attr($field_info->required_msg);
609
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
611
+                } elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
610 612
                     $value = $cf['defaults']['required_msg'];
611 613
                 }
612 614
                 ?>
@@ -647,11 +649,11 @@  discard block
 block discarded – undo
647 649
 
648 650
                 echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
649 651
 
650
-            }else{
652
+            } else{
651 653
                 $value = '';
652 654
                 if (isset($field_info->field_icon)) {
653 655
                     $value = esc_attr($field_info->field_icon);
654
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
656
+                } elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
655 657
                     $value = $cf['defaults']['field_icon'];
656 658
                 }
657 659
                 ?>
@@ -680,11 +682,11 @@  discard block
 block discarded – undo
680 682
 
681 683
                 echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
682 684
 
683
-            }else{
685
+            } else{
684 686
                 $value = '';
685 687
                 if (isset($field_info->css_class)) {
686 688
                     $value = esc_attr($field_info->css_class);
687
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
689
+                } elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
688 690
                     $value = $cf['defaults']['css_class'];
689 691
                 }
690 692
                 ?>
@@ -713,12 +715,12 @@  discard block
 block discarded – undo
713 715
 
714 716
                 echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
715 717
 
716
-            }else{
718
+            } else{
717 719
                 $value = '';
718 720
                 $hide_cat_sort  ='';
719 721
                 if (isset($field_info->cat_sort)) {
720 722
                     $value = esc_attr($field_info->cat_sort);
721
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
723
+                } elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
722 724
                     $value = $cf['defaults']['cat_sort'];
723 725
                     $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
724 726
                 }
Please login to merge, or discard this patch.
geodirectory-functions/custom_functions.php 1 patch
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
 		$author_id  = $p_post->post_author;
244 244
 
245
-	}else{
245
+	} else{
246 246
 		gd_die();
247 247
 	}
248 248
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
 		check_ajax_referer( 'send_to_frnd_'.$pid );
391 391
 
392
-	}else{
392
+	} else{
393 393
 		gd_die();
394 394
 	}
395 395
 
@@ -2283,7 +2283,7 @@  discard block
 block discarded – undo
2283 2283
 
2284 2284
 	if ( $new_style ) {
2285 2285
 		$default_search_button_label = '<i class="fas fa-search" aria-hidden="true"></i>';
2286
-	}else{
2286
+	} else{
2287 2287
 		$default_search_button_label = 'Search';
2288 2288
 	}
2289 2289
 	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
@@ -2310,7 +2310,7 @@  discard block
 block discarded – undo
2310 2310
 	if ( $new_style ) {
2311 2311
 		?>
2312 2312
 		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button>
2313
-	<?php }else{?>
2313
+	<?php } else{?>
2314 2314
 		<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2315 2315
 		       class="geodir_submit_search <?php echo $fa_class; ?>"/>
2316 2316
 	<?php }
@@ -2360,17 +2360,17 @@  discard block
 block discarded – undo
2360 2360
 			if ( $new_style ) {
2361 2361
 				echo "</div>";
2362 2362
 			}
2363
-		}else{
2363
+		} else{
2364 2364
 			if(! empty( $post_types )){
2365 2365
 				$pt_arr = (array)$post_types;
2366 2366
 				echo '<input type="hidden" name="stype" value="' . key( $pt_arr  ) . '"  />';
2367
-			}else{
2367
+			} else{
2368 2368
 				echo '<input type="hidden" name="stype" value="gd_place"  />';
2369 2369
 			}
2370 2370
 
2371 2371
 		}
2372 2372
 
2373
-	}elseif ( ! empty( $post_types ) ) {
2373
+	} elseif ( ! empty( $post_types ) ) {
2374 2374
 		echo '<input type="hidden" name="stype" value="gd_place"  />';
2375 2375
 	}
2376 2376
 }
Please login to merge, or discard this patch.
geodirectory-admin/admin_hooks_actions.php 1 patch
Braces   +61 added lines, -54 removed lines patch added patch discarded remove patch
@@ -24,8 +24,11 @@  discard block
 block discarded – undo
24 24
             global $current_tab;
25 25
             geodir_redirect_to_admin_panel_on_installed();
26 26
             $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings';
27
-            if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests
28
-                geodir_handle_option_form_submit($current_tab); // located in admin function.php
27
+            if (!(isset($_REQUEST['action']))) {
28
+            	// this will avoid Ajax requests
29
+                geodir_handle_option_form_submit($current_tab);
30
+            }
31
+            // located in admin function.php
29 32
             /**
30 33
              * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area.
31 34
              *
@@ -328,8 +331,9 @@  discard block
 block discarded – undo
328 331
     if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
329 332
 
330 333
         foreach ($notification as $key => $value) {
331
-            if ($value['type'] == 'textarea')
332
-                $notification[$key]['type'] = 'editor';
334
+            if ($value['type'] == 'textarea') {
335
+                            $notification[$key]['type'] = 'editor';
336
+            }
333 337
         }
334 338
 
335 339
     }
@@ -354,8 +358,9 @@  discard block
 block discarded – undo
354 358
     if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
355 359
 
356 360
         foreach ($design_setting as $key => $value) {
357
-            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content')
358
-                $design_setting[$key]['type'] = 'editor';
361
+            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') {
362
+                            $design_setting[$key]['type'] = 'editor';
363
+            }
359 364
         }
360 365
 
361 366
     }
@@ -474,9 +479,9 @@  discard block
 block discarded – undo
474 479
                    class="gd-draggable-form-items  gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);">
475 480
                     <?php if (isset($val['field_icon']) && strpos($val['field_icon'], ' fa-') !== false) {
476 481
                         echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>';
477
-                    }elseif(isset($val['field_icon']) && $val['field_icon'] ){
482
+                    } elseif(isset($val['field_icon']) && $val['field_icon'] ){
478 483
                         echo '<b class="gd-cf-icon" style="background-image: url(\''.$val['field_icon'].'\')"></b>';
479
-                    }else{
484
+                    } else{
480 485
                         echo '<i class="fas fa-cog" aria-hidden="true"></i>';
481 486
                     }?>
482 487
                     <?php echo (! empty( $val['admin_title'] ) ? $val['admin_title'] : $val['site_title'] );?>
@@ -706,9 +711,9 @@  discard block
 block discarded – undo
706 711
         <?php
707 712
         if($type=='predefined'){
708 713
             $cfs = geodir_custom_fields_predefined($listing_type);
709
-        }elseif($type=='custom'){
714
+        } elseif($type=='custom'){
710 715
             $cfs = geodir_custom_fields_custom($listing_type);
711
-        }else{
716
+        } else{
712 717
             $cfs = geodir_custom_fields($listing_type);
713 718
             ?>
714 719
             <ul class="full gd-cf-tooltip-wrap">
@@ -763,7 +768,7 @@  discard block
 block discarded – undo
763 768
             </li>
764 769
             <?php
765 770
         }
766
-    }else{
771
+    } else{
767 772
         _e('There are no custom fields here yet.', 'geodirectory');
768 773
     }
769 774
         ?>
@@ -960,8 +965,9 @@  discard block
 block discarded – undo
960 965
 
961 966
     if (!get_option('geodir_remove_unnecessary_fields')) {
962 967
 
963
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
964
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
968
+        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) {
969
+                    $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
970
+        }
965 971
 
966 972
         update_option('geodir_remove_unnecessary_fields', '1');
967 973
 
@@ -997,8 +1003,9 @@  discard block
 block discarded – undo
997 1003
                 break;
998 1004
 
999 1005
             case 'diagnosis-fix' :
1000
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
1001
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
1006
+                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
1007
+                                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
1008
+                }
1002 1009
                 call_user_func('geodir_diagnose_' . $diagnose_this);
1003 1010
                 exit();
1004 1011
                 break;
@@ -1613,11 +1620,11 @@  discard block
 block discarded – undo
1613 1620
     //////////////////////////////////
1614 1621
     $option_value = get_option('geodir_home_page');
1615 1622
     $page = get_post($option_value);
1616
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1623
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1617 1624
 
1618
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1619
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1620
-    else {
1625
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1626
+            $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1627
+    } else {
1621 1628
         $is_error_during_diagnose = true;
1622 1629
         $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1623 1630
         if ($fix) {
@@ -1638,11 +1645,11 @@  discard block
 block discarded – undo
1638 1645
     //////////////////////////////////
1639 1646
     $option_value = get_option('geodir_add_listing_page');
1640 1647
     $page = get_post($option_value);
1641
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1648
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1642 1649
 
1643
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1644
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1645
-    else {
1650
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1651
+            $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1652
+    } else {
1646 1653
         $is_error_during_diagnose = true;
1647 1654
         $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1648 1655
         if ($fix) {
@@ -1664,11 +1671,11 @@  discard block
 block discarded – undo
1664 1671
     //////////////////////////////////
1665 1672
     $option_value = get_option('geodir_preview_page');
1666 1673
     $page = get_post($option_value);
1667
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1674
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1668 1675
 
1669
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1670
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1671
-    else {
1676
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1677
+            $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1678
+    } else {
1672 1679
         $is_error_during_diagnose = true;
1673 1680
         $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1674 1681
         if ($fix) {
@@ -1689,11 +1696,11 @@  discard block
 block discarded – undo
1689 1696
     //////////////////////////////////
1690 1697
     $option_value = get_option('geodir_success_page');
1691 1698
     $page = get_post($option_value);
1692
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1699
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1693 1700
 
1694
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1695
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1696
-    else {
1701
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1702
+            $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1703
+    } else {
1697 1704
         $is_error_during_diagnose = true;
1698 1705
         $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1699 1706
         if ($fix) {
@@ -1714,11 +1721,11 @@  discard block
 block discarded – undo
1714 1721
     //////////////////////////////////
1715 1722
     $option_value = get_option('geodir_info_page');
1716 1723
     $page = get_post($option_value);
1717
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1724
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1718 1725
 
1719
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1720
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1721
-    else {
1726
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1727
+            $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1728
+    } else {
1722 1729
         $is_error_during_diagnose = true;
1723 1730
         $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1724 1731
         if ($fix) {
@@ -1739,11 +1746,11 @@  discard block
 block discarded – undo
1739 1746
     //////////////////////////////////
1740 1747
     $option_value = get_option('geodir_login_page');
1741 1748
     $page = get_post($option_value);
1742
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1749
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1743 1750
 
1744
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1745
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1746
-    else {
1751
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1752
+            $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1753
+    } else {
1747 1754
         $is_error_during_diagnose = true;
1748 1755
         $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1749 1756
         if ($fix) {
@@ -1764,11 +1771,11 @@  discard block
 block discarded – undo
1764 1771
     //////////////////////////////////
1765 1772
     $option_value = get_option('geodir_location_page');
1766 1773
     $page = get_post($option_value);
1767
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1774
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1768 1775
 
1769
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1770
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1771
-    else {
1776
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1777
+            $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1778
+    } else {
1772 1779
         $is_error_during_diagnose = true;
1773 1780
         $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1774 1781
         if ($fix) {
@@ -2213,8 +2220,9 @@  discard block
 block discarded – undo
2213 2220
                             );
2214 2221
 
2215 2222
                             $post_location_info = $request_info['post_location'];
2216
-                            if ($location_id = geodir_add_new_location($post_location_info))
2217
-                                $post_location_id = $location_id;
2223
+                            if ($location_id = geodir_add_new_location($post_location_info)) {
2224
+                                                            $post_location_id = $location_id;
2225
+                            }
2218 2226
                         } else {
2219 2227
                             $post_location_id = 0;
2220 2228
                         }
@@ -2277,8 +2285,9 @@  discard block
 block discarded – undo
2277 2285
                             $attachment_set = '';
2278 2286
 
2279 2287
                             foreach ($attachment as $key => $val) {
2280
-                                if ($val != '')
2281
-                                    $attachment_set .= $key . " = '" . $val . "', ";
2288
+                                if ($val != '') {
2289
+                                                                    $attachment_set .= $key . " = '" . $val . "', ";
2290
+                                }
2282 2291
                             }
2283 2292
                             $attachment_set = trim($attachment_set, ", ");
2284 2293
 
@@ -2374,8 +2383,7 @@  discard block
 block discarded – undo
2374 2383
 
2375 2384
         $parts = json_decode($response['body']);
2376 2385
         //print_r($parts);
2377
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2378
-        else{
2386
+        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} else{
2379 2387
 
2380 2388
             update_option('gd_ga_access_token', $parts->access_token);
2381 2389
             update_option('gd_ga_refresh_token', $parts->refresh_token);
@@ -2383,17 +2391,16 @@  discard block
 block discarded – undo
2383 2391
         }
2384 2392
 
2385 2393
 
2386
-    }
2387
-    elseif(!empty($response['response']['code'])) {
2394
+    } elseif(!empty($response['response']['code'])) {
2388 2395
         $parts = json_decode($response['body']);
2389 2396
 
2390 2397
         if(isset($parts->error)){
2391 2398
             echo $parts->error.": ".$parts->error_description;exit;
2392
-        }else{
2399
+        } else{
2393 2400
             echo $error_msg." - #2";exit;
2394 2401
         }
2395 2402
 
2396
-    }else{
2403
+    } else{
2397 2404
 
2398 2405
         echo $error_msg." - #3";exit;
2399 2406
 
@@ -2531,7 +2538,7 @@  discard block
 block discarded – undo
2531 2538
         ob_start();
2532 2539
         geodir_diagnose_version_clear();
2533 2540
         ob_end_clean();
2534
-    }else{
2541
+    } else{
2535 2542
         $output_str .= "<li><strong>" . __('Something went wrong.', 'geodirectory') . "</strong></li>";
2536 2543
     }
2537 2544
 
Please login to merge, or discard this patch.
geodirectory_hooks_actions.php 1 patch
Braces   +89 added lines, -72 removed lines patch added patch discarded remove patch
@@ -86,8 +86,9 @@  discard block
 block discarded – undo
86 86
 add_filter('query_vars', 'geodir_add_location_var');
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89
-if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
89
+if (get_option('permalink_structure') != '') {
90
+    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91
+}
91 92
 
92 93
 add_filter('parse_query', 'geodir_modified_query');
93 94
 
@@ -431,8 +432,9 @@  discard block
 block discarded – undo
431 432
      */
432 433
     do_action('geodir_after_social_sharing_buttons');
433 434
     $content_html = ob_get_clean();
434
-    if (trim($content_html) != '')
435
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
435
+    if (trim($content_html) != '') {
436
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
437
+    }
436 438
     if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
437 439
         /**
438 440
          * Filter the geodir_social_sharing_buttons() function content.
@@ -488,8 +490,9 @@  discard block
 block discarded – undo
488 490
      */
489 491
     do_action('geodir_after_edit_post_link');
490 492
     $content_html = ob_get_clean();
491
-    if (trim($content_html) != '')
492
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
493
+    if (trim($content_html) != '') {
494
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
495
+    }
493 496
     if ((int)get_option('geodir_disable_user_links_section') != 1) {
494 497
         /**
495 498
          * Filter the geodir_edit_post_link() function content.
@@ -1066,8 +1069,9 @@  discard block
 block discarded – undo
1066 1069
      */
1067 1070
     do_action('geodir_after_google_analytics');
1068 1071
     $content_html = ob_get_clean();
1069
-    if (trim($content_html) != '')
1070
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1072
+    if (trim($content_html) != '') {
1073
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1074
+    }
1071 1075
     if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1072 1076
         /**
1073 1077
          * Filter the geodir_edit_post_link() function content.
@@ -1209,8 +1213,9 @@  discard block
 block discarded – undo
1209 1213
     do_action('geodir_after_detail_page_more_info');
1210 1214
 
1211 1215
     $content_html = ob_get_clean();
1212
-    if (trim($content_html) != '')
1213
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1216
+    if (trim($content_html) != '') {
1217
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1218
+    }
1214 1219
     if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1215 1220
         /**
1216 1221
          * Filter the output html for function geodir_detail_page_more_info().
@@ -1342,8 +1347,9 @@  discard block
 block discarded – undo
1342 1347
     $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1343 1348
 
1344 1349
     foreach ($arr_alert_msg as $key => $value) {
1345
-        if (!is_scalar($value))
1346
-            continue;
1350
+        if (!is_scalar($value)) {
1351
+                    continue;
1352
+        }
1347 1353
         $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1348 1354
     }
1349 1355
 
@@ -1399,17 +1405,19 @@  discard block
 block discarded – undo
1399 1405
     global $geodir_sidebars;
1400 1406
     global $sidebars_widgets;
1401 1407
 
1402
-    if (!is_array($sidebars_widgets))
1403
-        $sidebars_widgets = wp_get_sidebars_widgets();
1408
+    if (!is_array($sidebars_widgets)) {
1409
+            $sidebars_widgets = wp_get_sidebars_widgets();
1410
+    }
1404 1411
     $geodir_old_sidebars = array();
1405 1412
 
1406 1413
     if (is_array($geodir_sidebars)) {
1407 1414
         foreach ($geodir_sidebars as $val) {
1408 1415
             if (is_array($sidebars_widgets)) {
1409
-                if (array_key_exists($val, $sidebars_widgets))
1410
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1411
-                else
1412
-                    $geodir_old_sidebars[$val] = array();
1416
+                if (array_key_exists($val, $sidebars_widgets)) {
1417
+                                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1418
+                } else {
1419
+                                    $geodir_old_sidebars[$val] = array();
1420
+                }
1413 1421
             }
1414 1422
         }
1415 1423
     }
@@ -1430,16 +1438,19 @@  discard block
 block discarded – undo
1430 1438
 {
1431 1439
     global $sidebars_widgets;
1432 1440
 
1433
-    if (!is_array($sidebars_widgets))
1434
-        $sidebars_widgets = wp_get_sidebars_widgets();
1441
+    if (!is_array($sidebars_widgets)) {
1442
+            $sidebars_widgets = wp_get_sidebars_widgets();
1443
+    }
1435 1444
 
1436 1445
     if (is_array($sidebars_widgets)) {
1437 1446
         $geodir_old_sidebars = get_option('geodir_sidebars');
1438 1447
         if (is_array($geodir_old_sidebars)) {
1439 1448
             foreach ($geodir_old_sidebars as $key => $val) {
1440
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1449
+                if(0 === strpos($key, 'geodir_')) {
1450
+                	// if gd widget
1441 1451
                 {
1442
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1452
+                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1453
+                }
1443 1454
                 }
1444 1455
 
1445 1456
 
@@ -1575,20 +1586,25 @@  discard block
 block discarded – undo
1575 1586
         }
1576 1587
     }
1577 1588
     
1578
-    if ($tab == 'post_info')
1579
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1589
+    if ($tab == 'post_info') {
1590
+            $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1591
+    }
1580 1592
     
1581
-    if ($tab == 'post_images')
1582
-        $is_display = (!empty($post_images)) ? true : false;
1593
+    if ($tab == 'post_images') {
1594
+            $is_display = (!empty($post_images)) ? true : false;
1595
+    }
1583 1596
 
1584
-    if ($tab == 'post_video')
1585
-        $is_display = (!empty($video)) ? true : false;
1597
+    if ($tab == 'post_video') {
1598
+            $is_display = (!empty($video)) ? true : false;
1599
+    }
1586 1600
 
1587
-    if ($tab == 'special_offers')
1588
-        $is_display = (!empty($special_offers)) ? true : false;
1601
+    if ($tab == 'special_offers') {
1602
+            $is_display = (!empty($special_offers)) ? true : false;
1603
+    }
1589 1604
 
1590
-    if ($tab == 'reviews')
1591
-        $is_display = (geodir_is_page('detail')) ? true : false;
1605
+    if ($tab == 'reviews') {
1606
+            $is_display = (geodir_is_page('detail')) ? true : false;
1607
+    }
1592 1608
 
1593 1609
     if ($tab == 'related_listing') {
1594 1610
        $message = __('No listings found which match your selection.', 'geodirectory');
@@ -1822,11 +1838,13 @@  discard block
 block discarded – undo
1822 1838
     $region_slug = $default_location->region_slug;
1823 1839
     $city_slug = $default_location->city_slug;
1824 1840
 
1825
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1826
-        return $slug_exists = true;
1841
+    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) {
1842
+            return $slug_exists = true;
1843
+    }
1827 1844
 
1828
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1829
-        return $slug_exists = true;
1845
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) {
1846
+            return $slug_exists = true;
1847
+    }
1830 1848
 
1831 1849
     return $slug_exists;
1832 1850
 }
@@ -1869,40 +1887,31 @@  discard block
 block discarded – undo
1869 1887
     if(geodir_is_page('home')){
1870 1888
         $gd_page = 'home';
1871 1889
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1872
-    }
1873
-    elseif(geodir_is_page('detail')){
1890
+    } elseif(geodir_is_page('detail')){
1874 1891
         $gd_page = 'detail';
1875 1892
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1876
-    }
1877
-    elseif(geodir_is_page('pt')){
1893
+    } elseif(geodir_is_page('pt')){
1878 1894
         $gd_page = 'pt';
1879 1895
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1880
-    }
1881
-    elseif(geodir_is_page('listing')){
1896
+    } elseif(geodir_is_page('listing')){
1882 1897
         $gd_page = 'listing';
1883 1898
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1884
-    }
1885
-    elseif(geodir_is_page('location')){
1899
+    } elseif(geodir_is_page('location')){
1886 1900
         $gd_page = 'location';
1887 1901
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1888
-    }
1889
-    elseif(geodir_is_page('search')){
1902
+    } elseif(geodir_is_page('search')){
1890 1903
         $gd_page = 'search';
1891 1904
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1892
-    }
1893
-    elseif(geodir_is_page('add-listing')){
1905
+    } elseif(geodir_is_page('add-listing')){
1894 1906
         $gd_page = 'add-listing';
1895 1907
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1896
-    }
1897
-    elseif(geodir_is_page('author')){
1908
+    } elseif(geodir_is_page('author')){
1898 1909
         $gd_page = 'author';
1899 1910
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1900
-    }
1901
-    elseif(geodir_is_page('login')){
1911
+    } elseif(geodir_is_page('login')){
1902 1912
         $gd_page = 'login';
1903 1913
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1904
-    }
1905
-    elseif(geodir_is_page('listing-success')){
1914
+    } elseif(geodir_is_page('listing-success')){
1906 1915
         $gd_page = 'listing-success';
1907 1916
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1908 1917
     }
@@ -1980,11 +1989,13 @@  discard block
 block discarded – undo
1980 1989
 
1981 1990
     if (!get_option('geodir_remove_url_seperator')) {
1982 1991
 
1983
-        if (get_option('geodir_listingurl_separator'))
1984
-            delete_option('geodir_listingurl_separator');
1992
+        if (get_option('geodir_listingurl_separator')) {
1993
+                    delete_option('geodir_listingurl_separator');
1994
+        }
1985 1995
 
1986
-        if (get_option('geodir_detailurl_separator'))
1987
-            delete_option('geodir_detailurl_separator');
1996
+        if (get_option('geodir_detailurl_separator')) {
1997
+                    delete_option('geodir_detailurl_separator');
1998
+        }
1988 1999
 
1989 2000
         flush_rewrite_rules(false);
1990 2001
 
@@ -2008,8 +2019,9 @@  discard block
 block discarded – undo
2008 2019
 {
2009 2020
     foreach ($permalink_arr as $key => $value) {
2010 2021
 
2011
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2012
-            unset($permalink_arr[$key]);
2022
+        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') {
2023
+                    unset($permalink_arr[$key]);
2024
+        }
2013 2025
 
2014 2026
     }
2015 2027
 
@@ -2144,16 +2156,18 @@  discard block
 block discarded – undo
2144 2156
 
2145 2157
             $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2146 2158
 
2147
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2148
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2159
+            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') {
2160
+                            $tabs_arr['post_video']['heading_text'] = $field_title;
2161
+            }
2149 2162
         }
2150 2163
 
2151 2164
         if (array_key_exists('special_offers', $tabs_arr)) {
2152 2165
 
2153 2166
             $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2154 2167
 
2155
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2156
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2168
+            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') {
2169
+                            $tabs_arr['special_offers']['heading_text'] = $field_title;
2170
+            }
2157 2171
         }
2158 2172
 
2159 2173
     }
@@ -2208,8 +2222,9 @@  discard block
 block discarded – undo
2208 2222
 
2209 2223
         $all_postypes = geodir_get_posttypes();
2210 2224
 
2211
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2212
-            return false;
2225
+        if (!in_array($post_type, $all_postypes) || !is_admin()) {
2226
+                    return false;
2227
+        }
2213 2228
 
2214 2229
         $uploads = wp_upload_dir();
2215 2230
 
@@ -2283,8 +2298,9 @@  discard block
 block discarded – undo
2283 2298
                         $file_info = pathinfo($attach->file);
2284 2299
 
2285 2300
                         $sub_dir = '';
2286
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2287
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2301
+                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
2302
+                                                    $sub_dir = stripslashes_deep($file_info['dirname']);
2303
+                        }
2288 2304
 
2289 2305
                         $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2290 2306
                         $uploads_path = $uploads['basedir'];
@@ -2305,8 +2321,9 @@  discard block
 block discarded – undo
2305 2321
 
2306 2322
                     if (!empty($attachment_data)) {
2307 2323
 
2308
-                        if ($attachment_data->ID)
2309
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2324
+                        if ($attachment_data->ID) {
2325
+                                                    $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2326
+                        }
2310 2327
 
2311 2328
                     } else {
2312 2329
 
@@ -2497,7 +2514,7 @@  discard block
 block discarded – undo
2497 2514
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2498 2515
                         $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2499 2516
 
2500
-                    }else{
2517
+                    } else{
2501 2518
                         $i = 0;
2502 2519
                         $fieldset_count++;
2503 2520
                         $field_set_start = 1;
@@ -2626,7 +2643,7 @@  discard block
 block discarded – undo
2626 2643
             $status_icon = '<i class="fas fa-play"></i>';
2627 2644
             if ($real_status == 'publish') {
2628 2645
                 $status .= __('Published', 'geodirectory');
2629
-            }elseif ($real_status == 'pending') {
2646
+            } elseif ($real_status == 'pending') {
2630 2647
                 $status .= __('Awaiting Review', 'geodirectory');
2631 2648
             } else {
2632 2649
                 $status .= __('Not published', 'geodirectory');
Please login to merge, or discard this patch.